function formsubmit(obj){
		//alert('action '+obj);
		document.form1.action = obj;
		document.form1.submit();
	}
	function login(){
		document.loginform.submit();
	}
	function logout(){
		document.logoutform.submit();
	}
	function mi_cuenta_logout(idioma){
		document.logoutform.action = "detallUsuari.html?lang=" + idioma;
		document.logoutform.submit();
	}
	function registre_login(idioma){
		document.loginform.action = "detallUsuari_registre.html?lang=" + idioma;
		document.loginform.submit();
	}
	function canvi_password_login(idioma){
		document.loginform.action = "detallUsuari_password.html?lang=" + idioma;
		document.loginform.submit();
	}
	function mi_cuenta_login(idioma){
		document.loginform.action = "detallUsuari.html?lang=" + idioma;
		document.loginform.submit();
	}
	function submitform2(obj){
		document.form2.action = obj;
		document.form2.submit();
	}
	
	function submitform3(obj){
		document.form3.action = obj;
		document.form3.submit();
	}
	
	function clearPresentation(){
		document.form3.reset();
	}
	
	function changeImg(obj) {
		document.getElementById("continueImg").src = obj;
	}
	
	function changeBack(obj) {
		document.getElementById("continueImg").src = obj;
	}
	
	function changeImg1(obj) {
		document.getElementById("saveImg").src = obj;
	}
	
	function changeBack1(obj) {
		document.getElementById("saveImg").src = obj;
	}
	
	function fnclear(field)
	{
		field.value="";
		document.form3.presentationFile.outerHTML='<input name="presentationFile" type="file" style="width:250px;">';
	}
	
	function clearField(field)
	{
		field.value="";
		document.form3.helpDocuments.outerHTML='<input name="helpDocuments" type="file" style="width:250px;">';
	}
	
	function clearAttachment()
	{
		document.ContactUs.attachment.outerHTML='<input name="attachment" type="file">';
	}
	
	function changeState()
	{
 		var selectedItem = document.getElementById("region2");
 		var selectedInd = selectedItem.selectedIndex;
 		document.getElementById("state").value=document.getElementById("state").options[selectedInd].value;
 		if(document.getElementById("stateValue").value==null || 
 		document.getElementById("stateValue").value=="")
 			document.getElementById("stateValue").value=document.getElementById("state").options[selectedInd].value;
	}
	

function appendLang(obj) {
	var str = location.href;
	if(obj=='es' && str.indexOf("?lang=es#")>0){
		str=str.replace(/lang=es#/,"lang=es");
		str=str.replace("/es/","/es/");
		location.href = str;
	}
	else if(obj=='en' && str.indexOf("?lang=en#")>0){
		st=str.replace(/lang=en#/,"lang=en");
		str=str.replace("/en/","/en/");
		location.href = str;
	}
	else if(obj=='en' && str.indexOf("?lang=es#")>0){
		str=str.replace(/lang=es#/,"lang=en");
		str=str.replace("/es/","/en/");
		location.href = str;		
	}
	else if(obj=='es' && str.indexOf("?lang=en")>0)
	{
		str=str.replace(/lang=en/,"lang=es");
		str=str.replace("/en/","/es/");
		location.href = str;
	}
	else if(obj=='es' && str.indexOf("?lang=es")>0){
		str=str.replace(/lang=es/,"lang=es");
		str=str.replace("/es/","/es/");
		location.href = str;
	}
	else if(obj=='en' && str.indexOf("?lang=en")>0){
		str=str.replace(/lang=en/,"lang=en");
		str=str.replace("/en/","/en/");
		location.href = str;
	}
	else if(obj=='en' && str.indexOf("?lang=es")>0){
		str=str.replace(/lang=es/,"lang=en");
		str=str.replace("/es/","/en/");
		location.href = str;
	}
	else if(obj=='en')
	{
		str=str.replace("/es/","/en/");
		location.href=str+'?lang=en';
	}	
	else if(obj=='es')
	{
		str=str.replace("/en/","/es/");
		location.href=str+'?lang=es';
	}			
}


function changeFootImageb1(obj){
	document.getElementById("banner1").src = obj;
}

function changeFootImageBackb1(obj){
	document.getElementById("banner1").src = obj;
}

function changeFootImageb2(obj){
	document.getElementById("banner2").src = obj;
}

function changeFootImageBackb2(obj){
	document.getElementById("banner2").src = obj;
}

function changeFootImageb3(obj){
	document.getElementById("banner3").src = obj;
}

function changeFootImageBackb3(obj){
	document.getElementById("banner3").src = obj;
}

function changeFootImageb4(obj){
	document.getElementById("banner4").src = obj;
}

function changeFootImageBackb4(obj){
	document.getElementById("banner4").src = obj;
}

function changeFootImageb5(obj){
	document.getElementById("banner5").src = obj;
}

function changeFootImageBackb5(obj){
	document.getElementById("banner5").src = obj;
}
function changeFootImageb6(obj){
	document.getElementById("banner6").src = obj;
}

function changeFootImageBackb6(obj){
	document.getElementById("banner6").src = obj;
}

function changeFootImageb7(obj){
	document.getElementById("banner7").src = obj;
}

function changeFootImageBackb7(obj){
	document.getElementById("banner7").src = obj;
}

function changeFootImageb8(obj){
	document.getElementById("banner8").src = obj;
}

function changeFootImageBackb8(obj){
	document.getElementById("banner8").src = obj;
}

function changeFootImageb9(obj){
	document.getElementById("banner9").src = obj;
}

function changeFootImageBackb9(obj){
	document.getElementById("banner9").src = obj;
}

function changeFootImageb10(obj){
	document.getElementById("banner10").src = obj;
}

function changeFootImageBackb10(obj){
	document.getElementById("banner10").src = obj;
}

function changeFootImageb11(obj){
	document.getElementById("banner11").src = obj;
}

function changeFootImageBackb11(obj){
	document.getElementById("banner11").src = obj;
}

function changeFootImageb12(obj){
	document.getElementById("banner12").src = obj;
}

function changeFootImageBackb12(obj){
	document.getElementById("banner12").src = obj;
}

function changeFootImageb13(obj){
	document.getElementById("banner13").src = obj;
}

function changeFootImageBackb13(obj){
	document.getElementById("banner13").src = obj;
}

function changeFootImageb14(obj){
	document.getElementById("banner14").src = obj;
}

function changeFootImageBackb14(obj){
	document.getElementById("banner14").src = obj;
}

function changeFootImageb15(obj){
	document.getElementById("banner15").src = obj;
}

function changeFootImageBackb15(obj){
	document.getElementById("banner15").src = obj;
}

function changeFootImageb16(obj){
	document.getElementById("banner16").src = obj;
}

function changeFootImageBackb16(obj){
	document.getElementById("banner16").src = obj;
}

function changeFootImageb17(obj){
	document.getElementById("banner17").src = obj;
}

function changeFootImageBackb17(obj){
	document.getElementById("banner17").src = obj;
}

function changeFootImageb18(obj){
	document.getElementById("banner18").src = obj;
}

function changeFootImageBackb18(obj){
	document.getElementById("banner18").src = obj;
}

function changeFootImageb19(obj){
	document.getElementById("banner19").src = obj;
}

function changeFootImageBackb19(obj){
	document.getElementById("banner19").src = obj;
}

function changeFootImageb30(obj){
	document.getElementById("banner30").src = obj;
}

function changeFootImageBackb30(obj){
	document.getElementById("banner30").src = obj;
}

function AJAXCrearObjeto(){
	 
	  // this is the object that we're going to (try to) create
	  var request;
	 
	  // does the browser have native support for 
	  // the XMLHttpRequest object
	  try {
	    request = new XMLHttpRequest();
	  }
	 
	  // it failed so it's likely to be Internet Explorer which 
	  // uses a different way to do this
	  catch (tryIE) {
	 
	    // try to see if it's a newer version of Internet Explorer
	    try {
	      request = new ActiveXObject("Msxml2.XMLHTTP");
	    } 
	 
	    // that didn't work so ...
	    catch (tryOlderIE) {
	 
	      // maybe it's an older version of Internet Explorer
	      try {
	        request = new ActiveXObject("Microsoft.XMLHTTP");
	      }
	 
	      // even that didn't work (sigh)
	      catch (failed) {
	        alert("Error creating XMLHttpRequest");
	      }
	 
	    }
	  }
	 
	  return request;
	 
	}

function popup_text(id)
{
 document.getElementById(id+"_meta-info").style.visibility="visible";
}

function hide_text(id)
{
 document.getElementById(id+"_meta-info").style.visibility="hidden";
}

function SwapOut(){
	for(i = 5; i > vots_totals; i--){
		document.getElementById("bomb" + i).src = "resources/bomb_off.jpg";
	}
	for(i = vots_totals; i > 0; i--){
		document.getElementById("bomb" + i).src = "resources/bomb_on.jpg";
	}
}

function SwapOver(vot){
	switch(vot){
		case "1":
			document.getElementById("bomb1").src = "resources/bomb_on.jpg";
			document.getElementById("bomb2").src = "resources/bomb_off.jpg";
			document.getElementById("bomb3").src = "resources/bomb_off.jpg";
			document.getElementById("bomb4").src = "resources/bomb_off.jpg";
			document.getElementById("bomb5").src = "resources/bomb_off.jpg";
			break;
		case "2":
			document.getElementById("bomb1").src = "resources/bomb_on.jpg";
			document.getElementById("bomb2").src = "resources/bomb_on.jpg";
			document.getElementById("bomb3").src = "resources/bomb_off.jpg";
			document.getElementById("bomb4").src = "resources/bomb_off.jpg";
			document.getElementById("bomb5").src = "resources/bomb_off.jpg";
			break;
		case "3":
			document.getElementById("bomb1").src = "resources/bomb_on.jpg";
			document.getElementById("bomb2").src = "resources/bomb_on.jpg";
			document.getElementById("bomb3").src = "resources/bomb_on.jpg";
			document.getElementById("bomb4").src = "resources/bomb_off.jpg";
			document.getElementById("bomb5").src = "resources/bomb_off.jpg";
			break;
		case "4":
			document.getElementById("bomb1").src = "resources/bomb_on.jpg";
			document.getElementById("bomb2").src = "resources/bomb_on.jpg";
			document.getElementById("bomb3").src = "resources/bomb_on.jpg";
			document.getElementById("bomb4").src = "resources/bomb_on.jpg";
			document.getElementById("bomb5").src = "resources/bomb_off.jpg";
			break;
		case "5":
			document.getElementById("bomb1").src = "resources/bomb_on.jpg";
			document.getElementById("bomb2").src = "resources/bomb_on.jpg";
			document.getElementById("bomb3").src = "resources/bomb_on.jpg";
			document.getElementById("bomb4").src = "resources/bomb_on.jpg";
			document.getElementById("bomb5").src = "resources/bomb_on.jpg";
			break;
		default:
			document.getElementById("bomb1").src = "resources/bomb_off.jpg";
			document.getElementById("bomb2").src = "resources/bomb_off.jpg";
			document.getElementById("bomb3").src = "resources/bomb_off.jpg";
			document.getElementById("bomb4").src = "resources/bomb_off.jpg";
			document.getElementById("bomb5").src = "resources/bomb_off.jpg";
	}
}

function limitText(limitField, limitCount, limitNum) {
	if (limitField.value.length > limitNum) {
		limitField.value = limitField.value.substring(0, limitNum);
	} else {
		limitCount.value = limitNum - limitField.value.length;
	}
}

