
		
	var timeout = 500;
	var closetimer = 0;
	var ddmenuitem = 0;
 
	function jsddm_open(){	
		jsddm_canceltimer();
		jsddm_close();
		ddmenuitem = $(this).find('ul').eq(0).css('display', 'block');
	}
	
	function jsddm_close()
	{ 
		if(ddmenuitem) ddmenuitem.css('display', 'none');
	}
	
	function jsddm_timer()
	{ closetimer = window.setTimeout(jsddm_close, timeout);}
	
	function jsddm_canceltimer(){ 
		if(closetimer)
			{ window.clearTimeout(closetimer);
			  closetimer = null;}
		}
	
	
	
	//document.onclick = jsddm_close;
	document.onMouseUp=jsddm_close;
	document.onMouseDown=jsddm_open;
	


function unixTime(){
   var foo = new Date; // Generic JS date object
   var unixtime_ms = foo.getTime(); // Returns milliseconds since the epoch
   // var unixtime = parseInt(unixtime_ms / 1000);
   var unixtime = parseInt(unixtime_ms);
   return(unixtime);
}

		function attivaCufon(idElemento){
			   idElemento=(typeof(idElemento)=="undefined")?"":(idElemento+" ");
			   Cufon.replace(idElemento+'.filzerhand', { fontFamily: 'filzerhand', hover:'true' });
			   Cufon.replace(idElemento+'.btn_vai', { fontFamily: 'filzerhand', hover:'true' });
			   Cufon.replace(idElemento+'.region', { fontFamily: 'filzerhand', hover:'true' });
			   Cufon.replace(".voce a", { fontFamily: 'filzerhand', fontStretch:'150%', hover:'true' });
			   Cufon.replace(".voce_finale a", { fontFamily: 'filzerhand', fontStretch:'150%', hover:'true' });
			   Cufon.replace(".sottovoce", { fontFamily: 'filzerhand', fontStretch:'150%', hover:'true' });
			   Cufon.replace(".sottovoce_coming", { fontFamily: 'filzerhand', fontStretch:'150%', hover:'true' });
			   Cufon.replace(".sottovoce2", { fontFamily: 'filzerhand', fontStretch:'150%', hover:'true' });
			   Cufon.replace(".sottovoce1", { fontFamily: 'filzerhand', fontStretch:'150%', hover:'true' });
			   Cufon.replace("div.region", { fontFamily: 'filzerhand', textShadow:'2px 3px white,-2px -3px white', color:'#a71930', hover:'true' });
			   Cufon.replace("div.main_title_pv", { fontFamily: 'filzerhand', textShadow:'2px 3px white,-2px -3px white', color:'#a71930', hover:'true' });
			   Cufon.replace("#sottovoce_select a", { fontFamily: 'filzerhand', fontStretch:'150%',color:'#d78c8c', hover:'false' });
			   
			   Cufon.replace("#select", { fontFamily: 'filzerhand', fontStretch:'150%',color:'#a71930',hover:'false' });
			   Cufon.replace('#title_franchising', {letterSpacing:'0px'});
			   Cufon.replace('#title_download', {letterSpacing:'1px'});
			   /*$('.voce_finale a').css('display','none');
			   $('.sottovoce').css('display','none');
			   $('.sottovoce2').css('display','none');
			   $('.filzerhand').css('display','none');
			   $('.voce').bind('ready', showObjects);*/
		}
		
		$(document).ready(function() {
		  // Handler for .ready() called.
		  $('#menu').css('display','block');
		  $('.filzerhand').css('display','block');
		  $('#nro_page').css('display','block');
		  $('#scheda_pr').css('display','block');
		});
		

		

		function attivaGallery(){
			//borrowed from jQuery easing plugin
			//http://gsgd.co.uk/sandbox/jquery.easing.php
			$.easing.backout = function(x, t, b, c, d){
				var s=1.70158;
				return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b;
			};
			
			$('#screen').scrollShow({
				view:'#view',
				content:'#images',
				easing:'backout',
				wrappers:'link,crop',
				navigators:'a[id]',
				navigationMode:'sr',
				circular:true,
				start:0
			});
		 }
		 
		 function attivaDialog(){
			$("#dialog").dialog({height:330,position: ['left',0],autoOpen:false}); 
			$('#btn_privacy').click(function() 
			{ 
				$("#dialog").dialog("open");
			}); 
						
		}
		
		function attivaGllFranchising(){
			$("#scroller ul a").unbind();
			$("#scroller ul a").bind("click", function(){
				var urlImg=$(this).attr("href");
				var urlImgBig=$(this).attr("urlBig");

				$("#grande").attr("src",urlImgBig);
				$("#grandeUrl").attr("href",urlImg);

				// attivaResize();
				return(false);
			});
		}
		

function showAddress(address,titolo,idDiv) {
 // document.getElementById('daddr').value=address;
 if (GBrowserIsCompatible()) {
       geocoder = new GClientGeocoder();
 }

 if (geocoder) {
       geocoder.getLatLng(
         address,
         function(point) {
               if (!point) {
                 alert(address + " non trovato");
               } else {
               /*zoom*/

                       coordinate = point;

                       map = new GMap2(document.getElementById(idDiv));
                       
                       /*mappa - satellite - ibrida */
                       map.addControl(new GMapTypeControl());
                       
                       /*controller con barra vert*/
                       // map.addControl(new GSmallMapControl());
                       map.addControl(new GLargeMapControl());
                       
                       /*zoom box, in basso a dx*/
						/*
						map.addControl(new GOverviewMapControl(),
                       new GControlPosition(G_ANCHOR_BOTTOM_RIGHT, new GSize(9, 9)));
                       */
					   
                       /*COORDINATE DI PARTENZA DELLA MAPPA*/
                       map.setCenter(point, 15);
                       // map.setCenter(point, 12);
                       var marker = new GMarker(point);
                       map.addOverlay(marker);
                       if(titolo){
                               marker.openInfoWindowHtml(titolo+" &nbsp;  ");
                       } else {
                               marker.openInfoWindowHtml(address+" &nbsp;  ");
                       }
               }
         }
       );
 }
}


function showAddressScehdaPV() {
 // document.getElementById('daddr').value=address;
 var address=$("#address").val();
 var titolo=$("#titolopv").val();
 var idDiv=$("#idDiv").val();
 if (GBrowserIsCompatible()) {
       geocoder = new GClientGeocoder();
 }

 if (geocoder) {
       geocoder.getLatLng(
         address,
         function(point) {
               if (!point) {
                 alert(address + " non trovato");
               } else {
               /*zoom*/

                       coordinate = point;

                       map = new GMap2(document.getElementById(idDiv));
                       
                       /*mappa - satellite - ibrida */
                       map.addControl(new GMapTypeControl());
                       
                       /*controller con barra vert*/
                       // map.addControl(new GSmallMapControl());
                       map.addControl(new GLargeMapControl());
                       
                       /*zoom box, in basso a dx*/
						/*
						map.addControl(new GOverviewMapControl(),
                       new GControlPosition(G_ANCHOR_BOTTOM_RIGHT, new GSize(9, 9)));
                       */
					   
                       /*COORDINATE DI PARTENZA DELLA MAPPA*/
                       map.setCenter(point, 15);
                       // map.setCenter(point, 12);
                       var marker = new GMarker(point);
                       map.addOverlay(marker);
                       if(titolo){
                               marker.openInfoWindowHtml(titolo+" &nbsp;  ");
                       } else {
                               marker.openInfoWindowHtml(address+" &nbsp;  ");
                       }
               }
         }
       );
 }
}


function attivaFormContact(){
	$("#bottInviaContact").unbind();
	$("#bottInviaContact").bind("click", function(){
		$.post("contacts.php", {
		   act: "inviaForm",
		   lang: $("#lang").val(),
		   nome: $("#nome").val(),
		   cognome: $("#cognome").val(),
		   email: $("#email").val(),
		   telefono: $("#telefono").val(),
		   note: $("#note").val(),
		   nl: (($('#nl:checked').val()==1)?1:0),
		   privacy: (($('#privacy:checked').val()==1)?1:0),
		   time: unixTime()
		}, function(data){
		   if(data=="ok"){
			  // location.href="contacts_ok.php";
			  	var el8 = document.getElementById("txt_space_info");
 				if($("#lang").val()=="en"){
						el8.innerHTML = "<b>Thank you. The form has been sent correctl</b>";
					}else if($("#lang").val()=="it"){
						el8.innerHTML = "<b>Grazie. Modulo inviato correttamente</b>";
					}else{el8.innerHTML = "<b>Danke. Das Formular ist abgeschickt worden</b>";} 	
				$("#bottInviaContact").remove();
		   } else {
			   switch(data){
				   case "nome_missing":
				   		var el = document.getElementById("txt_space_info");
						if($("#lang").val()=="en"){
							el.innerHTML = "<b>Insert name</b>";
						}else if($("#lang").val()=="it"){
							el.innerHTML = "<b>Inserire il nome</b>";
						}else{el.innerHTML = "<b>Name eingeben</b>";}
 						
						$("#nome").focus();						
				   break;
				   case "cognome_missing":
				   		var el1 = document.getElementById("txt_space_info");
 						if($("#lang").val()=="en"){
							el1.innerHTML = "<b>Insert surname</b>";
						}else if($("#lang").val()=="it"){
							el1.innerHTML = "<b>Inserire il cognome</b>";
						}else{el1.innerHTML = "<b>Familienname eingeben</b>";}
						$("#cognome").focus();
				   break;
				   case "email_missing":
				   		var el2 = document.getElementById("txt_space_info");
 						if($("#lang").val()=="en"){
							el2.innerHTML = "<b>Insert e-mail</b>";
						}else if($("#lang").val()=="it"){
							el2.innerHTML = "<b>Inserire l'email</b>";
						}else{el2.innerHTML = "<b>E-mail eingeben</b>";}
						$("#email").focus();
				   break;
				   case "email_wrong":
				   		var el3 = document.getElementById("txt_space_info");
 						if($("#lang").val()=="en"){
							el3.innerHTML = "<b>e-mail not valid</b>";
						}else if($("#lang").val()=="it"){
							el3.innerHTML = "<b>Inserire un'email valida</b>";
						}else{el3.innerHTML = "<b>E-mail nicht g&uuml;ltig</b>";}
						$("#email").focus();
				   break;
				   case "telefono_missing":
				   		var el4 = document.getElementById("txt_space_info");
 						if($("#lang").val()=="en"){
							el4.innerHTML = "<b>Insert telephone</b>";
						}else if($("#lang").val()=="it"){
							el4.innerHTML = "<b>Inserire il telefono</b>";
						}else{el4.innerHTML = "<b>Telefon eingeben</b>";}
						$("#telefono").focus();
				   break;
				   case "messaggio_missing":
				   		var el5 = document.getElementById("txt_space_info");
 						if($("#lang").val()=="en"){
							el5.innerHTML = "<b>Insert message</b>";
						}else if($("#lang").val()=="it"){
							el5.innerHTML = "<b>Inserire il messaggio</b>";
						}else{el5.innerHTML = "<b>Nachricht eingeben</b>";}
						$("#note").focus();
				   break;
				   case "privacy":
				   		var el6 = document.getElementById("txt_space_info");
 						if($("#lang").val()=="en"){
							el6.innerHTML = "<b>Accept the privacy policy</b>";
						}else if($("#lang").val()=="it"){
							el6.innerHTML = "<b>Acettare l'informativa sulla privacy</b>";
						}else{el6.innerHTML = "<b>Datenschutzerkl&auml;rung akzeptieren</b>";}
						$("#privacy").focus();
				   break;
				   default: // errore generico
				   		var el7 = document.getElementById("txt_space_info");
 						if($("#lang").val()=="en"){
							el7.innerHTML = "<b>Error!Try again later!</b>";
						}else if($("#lang").val()=="it"){
							el7.innerHTML = "<b>Errore!riprovare pi&ugrave; tardi!</b>";
						}else{el7.innerHTML = "<b>Ein fehler ist aufgetreten, bitte versuche es später erneut.</b>";}
				   break;
				}
		   }
		});
		return(false);
	});
}

	function attivaFormContactNl(){
		$("#bottInviaContactNl").unbind();
		$("#bottInviaContactNl").bind("click", function(){
			$.post("contacts.php", {
			   act: "inviaFormNl",
			   lang: $("#langNl").val(),
			   nl: "1",
			   idSiti: "1",
			   nome: $("#nomeNl").val(),
			   cognome: $("#cognomeNl").val(),
			   email: $("#emailNl").val(),
			   privacy: (($('#privacyNl:checked').val()==1)?1:0),
			   time: unixTime()
			}, function(data){
			   if(data=="ok"){
				   //location.href="contacts_ok.php";
				   	var el8 = document.getElementById("txt_space_info2");
					if($("#lang").val()=="en"){
						el8.innerHTML = "<b>Thank you. The form has been sent correctl</b>";
					}else if($("#lang").val()=="it"){
						el8.innerHTML = "<b>Grazie. Modulo inviato correttamente</b>";
					}else{el8.innerHTML = "<b>Danke. Das Formular ist abgeschickt worden</b>";} 	
					$("#bottInviaContactNl").remove();
			   } else {
				   switch(data){
					   case "nome_missing":
				   		var el = document.getElementById("txt_space_info2");
						if($("#lang").val()=="en"){
							el.innerHTML = "<b>Insert name</b>";
						}else if($("#lang").val()=="it"){
							el.innerHTML = "<b>Inserire il nome</b>";
						}else{el.innerHTML = "<b>Name eingeben</b>";} 						
						$("#nomeNl").focus();						
					   break;
					   case "cognome_missing":
							var el1 = document.getElementById("txt_space_info2");
							if($("#lang").val()=="en"){
								el1.innerHTML = "<b>Insert surname</b>";
							}else if($("#lang").val()=="it"){
								el1.innerHTML = "<b>Inserire il cognome</b>";
							}else{el1.innerHTML = "<b>Familienname eingeben</b>";}
							$("#cognomeNl").focus();
					   break;
					   case "email_missing":
							var el2 = document.getElementById("txt_space_info2");
							if($("#lang").val()=="en"){
								el2.innerHTML = "<b>Insert e-mail</b>";
							}else if($("#lang").val()=="it"){
								el2.innerHTML = "<b>Inserire l'email</b>";
							}else{el2.innerHTML = "<b>E-mail eingeben</b>";}
							$("#emailNl").focus();
					   break;
					   case "email_wrong":
							var el3 = document.getElementById("txt_space_info2");
							if($("#lang").val()=="en"){
								el3.innerHTML = "<b>e-mail not valid</b>";
							}else if($("#lang").val()=="it"){
								el3.innerHTML = "<b>Inserire un'email valida</b>";
							}else{el3.innerHTML = "<b>E-mail nicht g&uuml;ltig</b>";}
							$("#emailNl").focus();
					   break;
					   case "privacy":
				   		var el6 = document.getElementById("txt_space_info2");
 						if($("#lang").val()=="en"){
							el6.innerHTML = "<b>Accept the privacy policy</b>";
						}else if($("#lang").val()=="it"){
							el6.innerHTML = "<b>Acettare l'informativa sulla privacy</b>";
						}else{el6.innerHTML = "<b>Datenschutzerkl&auml;rung akzeptieren</b>";}
						$("#privacyNl").focus();
					   break;
					   default: // errore generico
							var el7 = document.getElementById("txt_space_info2");
							if($("#lang").val()=="en"){
								el7.innerHTML = "<b>Error!Try again later!</b>";
							}else if($("#lang").val()=="it"){
								el7.innerHTML = "<b>Errore!riprovare pi&ugrave; tardi!</b>";
							}else{el7.innerHTML = "<b>Ein fehler ist aufgetreten, bitte versuche es sp&auml;ter erneut.</b>";}
					   break;
					}
			   }
			});
			return(false);
		});
	}

		 
		 $(document).ready(function(){
			attivaCufon("");
			// jsddm_close();
			$('#jsddm > li').bind('mouseover', jsddm_open);
			$('#jsddm > li').bind('mouseout', jsddm_timer);
			return true;
		 });

