
function showVideo(videoCode, title, desc){

	embedCode="<h2>"+title+"</h2><div style='padding:5px;'>"+desc+"</div><object width='425' height='344'><param name='movie' value='http://www.youtube.com/v/"+videoCode+"&autoplay=1'></param><param name='allowFullScreen' value='true'></param><param name='allowscriptaccess' value='always'></param><embed src='http://www.youtube.com/v/"+videoCode+"&hl=it&fs=1&autoplay=1' type='application/x-shockwave-flash' allowscriptaccess='always' allowfullscreen='true' width='425' height='344'></embed></object>";
	document.getElementById("videoContainer").innerHTML=embedCode;
}

function switchFilter(id,page,filter, mixed){

	if(filter=="type" && String(id)=="none"){
		window.location=page+"?"+filter+"=none";
		return;
	}

	if(mixed==0){
		window.location=page+"?"+filter+"="+id;
	}else{
	//var querystring = location.search;	
	var urlString=self.location.href.split("?");
		if(urlString[1]==undefined || urlString[1]=="" || urlString[1]=="type=none"){
			window.location=page+"?"+filter+"="+id;
		}else{
			//prima di procedere elimino il parametro pNum
			
			if(urlString[1].indexOf("Rs1pNum=")==-1){
				var paramString=urlString[1];
			}else{
				var strippingParamArray=urlString[1].split("Rs1pNum")
				// Se pNum è l'ultimo parametro...
				if(strippingParamArray[1].indexOf("&")==-1){
					var paramString=strippingParamArray[0];
				}else{
					var otherParams=strippingParamArray[1].split("&")
					otherParams=otherParams.slice (1,otherParams.length );
					
					var paramString=otherParams.join("&");

				}
				
				
			}
			
	
			var params=paramString.split("&")
			var totParams=params.length;
			var paramFound=false;

			for(i=0;i<params.length;i++){
				if(params[i].split("=")[0]==filter){
					var paramFound=true;
					if(id!=0){
						params[i]=filter+"="+id;
					}else{
						params.splice(i,1);
					}					
				}
			}
			if(paramFound==false){
				params.push(filter+"="+id)
			}
			
			var querystring=params.join("&");

			window.location=urlString[0]+"?"+querystring
		}
	}	

}




function checkMail (form,lang){
		switch (lang){
		case 1:
		 if (document.forms[form].nome.value == "") {
		   alert("Prego compilare il campo NOME")
		   document.forms[form].nome.focus();
		   return false;}   
		 if (document.forms[form].cognome.value == "") {
		   alert("Prego compilare il campo COGNOME")
		   document.forms[form].cognome.focus();
		   return false;}
		 if (document.forms[form].email.value == "") {
		   alert("Prego compilare il campo MAIL")
		   document.forms[form].email.focus();
		   return false;}
		if (document.forms[form].privacyCheck.checked == false) {
		   alert("Prego accettare le condizioni relative alla Privacy")
		   document.forms[form].privacyCheck.focus();
		   return false;} 
		break;
		case 2:
		 if (document.forms[form].nome.value == "") {
		   alert("Please fill the \"First name\" field")
		   document.forms[form].nome.focus();
		   return false;}   
		 if (document.forms[form].cognome.value == "") {
		   alert("Please fill the \"Last name\" field")
		   document.forms[form].cognome.focus();
		   return false;}
		 if (document.forms[form].email.value == "") {
		   alert("Please fill the \"E-mail\" field")
		   document.forms[form].email.focus();
		   return false;}
		if (document.forms[form].privacyCheck.checked == false) {
		   alert("Please accept the Privacy policy agreement")
		   document.forms[form].privacyCheck.focus();
		   return false;} 
		break;
		case 3:
		 if (document.forms[form].nome.value == "") {
		   alert("Prière de compléter le champ \"Nom\"")
		   document.forms[form].nome.focus();
		   return false;}   
		 if (document.forms[form].cognome.value == "") {
		   alert("Prière de compléter le champ \"Prénom\"")
		   document.forms[form].cognome.focus();
		   return false;}
		 if (document.forms[form].mail.value == "") {
		   alert("Prière de compléter le champ \"E-mail\"")
		   document.forms[form].mail.focus();
		   return false;}
		if (document.forms[form].privacyCheck.checked == false) {
		   alert("Prière d’accepter les conditions sur la protection de la vie privée")
		   document.forms[form].privacyCheck.focus();
		   return false;}
		break;	
		
	}
}



