if(typeof($)=="function"){
	$(document).ready (menu);
}
$(document).ready(function(){
						  
						   
		path_assoluto = "http://extranet.websolute.it/tecnowind/";
		
		
		// GUIDA AI PRODOTTI - set pag interna
		var thisUrl = location.href; // recupero la URL		
		// Cappe
		if (thisUrl.indexOf("ca_id=52") != -1) {
				$("#titolo_azienda").css({background:"#6670AD"});
		}
		// Piani cottura
		if (thisUrl.indexOf("ca_id=57") != -1) {
				$("#titolo_azienda").css({background:"#6B6203"});
		}
		// Macchine Caffe
		if (thisUrl.indexOf("ca_id=63") != -1) {
				$("#titolo_azienda").css({background:"#a4640c"});
		}
		
		/* Form invia curriculum
		- - - - - - - - - - - - - - - - - - - - */
		$("#cv_ok").hide();
		$("#cv_ko").hide();
		$("#articolo").show();
		if (thisUrl.indexOf("form_cv=OK") != -1) {
				$("#cv_ok").show();
				$("#articolo").hide();
		}
		if (thisUrl.indexOf("form_cv=KO") != -1) {
				$("#cv_ko").show();
		}
		
		
		/* Funzione stampa 
		- - - - - - - - - - - - - - - - - - - - */
		$("#dimensioni_ico a").click(function(){
			window.print();						   
		});
		
		$("#print a").click(function(){
			window.print();							   
		});
		
		$("#print_caffe a").click(function(){
			window.print();						   
		});
						   
		/* Funzione per il blocco GALLERY IMGS 
		- - - - - - - - - - - - - - - - - - - - */
		//$("#gallery ul li a img").css({opacity:0.5});
						   
		/* Funzione per il blocco DIMENSIONI ---> OLD 
		- - - - - - - - - - - - - - - - - - - - */
		/*$("#dimensioni_tab dd").hide();
		$("#dimensioni_tab dt").click(function(){
			if ($(this).next().attr("class") == "on") {
				$(this).next().removeClass("on").slideUp("fast");
			} else {
				$("#dimensioni_tab dd.on").removeClass("on").slideUp("fast");
				$(this).next().addClass("on").slideDown("fast");
			}
			return false;
		});*/
		
		/* Funzione per il blocco ZOOM GALLERY 
		- - - - - - - - - - - - - - - - - - - - */
		// setto la prima immagine di default		
		first_img = $("#zoom_gallery ul li a").eq(0).attr("rel");
		$("#zoom_img").html("<img src='"+first_img+"' />");
		// setto e gli attribuisco la classe ON
		$("#zoom_gallery ul li a img").eq(0).addClass("on");
		$("#zoom_gallery ul li a img").not(".on").css({opacity:0.5});
		
		// rollover
		/*$("#zoom_gallery ul li a img").not(".on").hover(function() {
		  $(this).css({opacity:1});
		}, function() {
		  $(this).css({opacity:0.5});
		});*/
		
		// al click ...
		$("#zoom_gallery ul li a").click(function(){
			$("#zoom_gallery ul li a img.on").removeClass("on");
			$(this).find("img").addClass("on").css({opacity:1});
			$("#zoom_gallery ul li a img").not(".on").css({opacity:0.5});
			url = $(this).attr("rel");
			//title = $(this).find("img").attr("title");			
			$("#zoom_img").empty();
			$("#zoom_img").html("<div id='zoom_loading'><br/><br/><br/><br/><br/><br/><img src='"+path_assoluto+"imgs/loading.gif' /></div>").show("normal");
				$.ajax({
				url:url,
				success: function(){
					$("#zoom_img").empty();
					$("#zoom_img").html("<img src='"+url+"' />");
					//$("#zoom_img").html("<img src='"+url+"' alt='"+title+"' />");
					},
				error: function(){
					$("#zoom_img").empty();
					$("#zoom_img").html("<img src='"+url+"' />");
				}
				});
			return false;
		});		
		
		/* Funzione per il blocco COMANDI riga 01 - 02 -03
		- - - - - - - - - - - - - - - - - - - - - - - - - */
		$("#comandi table.descrizione tr.riga_1 td.cx a").click(function(){
				$("#comandi table.descrizione tr.riga_1 td.cx a").removeClass("on");
				$(this).addClass("on")
				desc = $(this).attr("rel");
				//alert (desc);
				$("#comandi table.descrizione tr.riga_1 td.dx").html(desc);
			return false;
		});
		$("#comandi table.descrizione tr.riga_2 td.cx a").click(function(){
				$("#comandi table.descrizione tr.riga_2 td.cx a").removeClass("on");
				$(this).addClass("on")
				desc = $(this).attr("rel");
				//alert (desc);
				$("#comandi table.descrizione tr.riga_2 td.dx").html(desc);
			return false;
		});
		$("#comandi table.descrizione tr.riga_3 td.cx a").click(function(){
				$("#comandi table.descrizione tr.riga_3 td.cx a").removeClass("on");
				$(this).addClass("on")
				desc = $(this).attr("rel");
				//alert (desc);
				$("#comandi table.descrizione tr.riga_3 td.dx").html(desc);
			return false;
		});
		$("#comandi table.descrizione tr.riga_4 td.cx a").click(function(){
				$("#comandi table.descrizione tr.riga_4 td.cx a").removeClass("on");
				$(this).addClass("on")
				desc = $(this).attr("rel");
				//alert (desc);
				$("#comandi table.descrizione tr.riga_4 td.dx").html(desc);
			return false;
		});
		$("#comandi table.descrizione tr.riga_5 td.cx a").click(function(){
				$("#comandi table.descrizione tr.riga_5 td.cx a").removeClass("on");
				$(this).addClass("on")
				desc = $(this).attr("rel");
				//alert (desc);
				$("#comandi table.descrizione tr.riga_5 td.dx").html(desc);
			return false;
		});
		$("#comandi table.descrizione tr.riga_6 td.cx a").click(function(){
				$("#comandi table.descrizione tr.riga_6 td.cx a").removeClass("on");
				$(this).addClass("on")
				desc = $(this).attr("rel");
				//alert (desc);
				$("#comandi table.descrizione tr.riga_6 td.dx").html(desc);
			return false;
		});
		$("#comandi table.descrizione tr.riga_7 td.cx a").click(function(){
				$("#comandi table.descrizione tr.riga_7 td.cx a").removeClass("on");
				$(this).addClass("on")
				desc = $(this).attr("rel");
				//alert (desc);
				$("#comandi table.descrizione tr.riga_7 td.dx").html(desc);
			return false;
		});
		$("#comandi table.descrizione tr.riga_8 td.cx a").click(function(){
				$("#comandi table.descrizione tr.riga_8 td.cx a").removeClass("on");
				$(this).addClass("on")
				desc = $(this).attr("rel");
				//alert (desc);
				$("#comandi table.descrizione tr.riga_8 td.dx").html(desc);
			return false;
		});
		$("#comandi table.descrizione tr.riga_9 td.cx a").click(function(){
				$("#comandi table.descrizione tr.riga_9 td.cx a").removeClass("on");
				$(this).addClass("on")
				desc = $(this).attr("rel");
				//alert (desc);
				$("#comandi table.descrizione tr.riga_9 td.dx").html(desc);
			return false;
		});
		$("#comandi table.descrizione tr.riga_10 td.cx a").click(function(){
				$("#comandi table.descrizione tr.riga_10 td.cx a").removeClass("on");
				$(this).addClass("on")
				desc = $(this).attr("rel");
				//alert (desc);
				$("#comandi table.descrizione tr.riga_10 td.dx").html(desc);
			return false;
		});
		$("#comandi table.descrizione tr.riga_11 td.cx a").click(function(){
				$("#comandi table.descrizione tr.riga_11 td.cx a").removeClass("on");
				$(this).addClass("on")
				desc = $(this).attr("rel");
				//alert (desc);
				$("#comandi table.descrizione tr.riga_11 td.dx").html(desc);
			return false;
		});
		$("#comandi table.descrizione tr.riga_12 td.cx a").click(function(){
				$("#comandi table.descrizione tr.riga_12 td.cx a").removeClass("on");
				$(this).addClass("on")
				desc = $(this).attr("rel");
				//alert (desc);
				$("#comandi table.descrizione tr.riga_12 td.dx").html(desc);
			return false;
		});
		
		/* Funzione per il blocco DISEGNO TECNICO 
		- - - - - - - - - - - - - - - - - - - - */		
		first_dis = $("#dimensioni_disegno_bottom a").eq(0).attr("rel");
		$("#dimensioni_disegno_bottom a").eq(0).addClass("active");
		$("#dimensioni_disegno_top").html("<img src='"+first_dis+"' />");
		
		dis_tot = ($("#dimensioni_disegno_bottom a").length);
		if (dis_tot == 1) {
		$("#dimensioni_disegno_bottom a").css({display:'none'});
		} else if (dis_tot == 0) {
		$("#dimensioni_disegno_top").css({display:'none'});
		$("#dimensioni_disegno_bottom a").css({display:'none'});
		}
		
		$("#dimensioni_disegno_bottom a").click(function(){
			url = $(this).attr("rel");
			$("#dimensioni_disegno_bottom a").removeClass("active");
			$(this).addClass("active");
			$("#dimensioni_disegno_top").empty();
			$("#dimensioni_disegno_top").html("<div id='tecnico_loading'><br/><br/><img src='"+path_assoluto+"imgs/loading.gif' /></div>").show("normal");
			$.ajax({
				url:url,
				success: function(){
					$("#dimensioni_disegno_top").empty();
					$("#dimensioni_disegno_top").html("<img src='"+url+"' />");
					},
				error: function(){
					$("#dimensioni_disegno_top").empty();
					$("#dimensioni_disegno_top").html("<img src='"+url+"' />");
				}
				});
			return false;
		});
		
		/* Funzione per il blocco DISEGNO 02 TECNICO 
		- - - - - - - - - - - - - - - - - - - - */		
		first_dis = $("#dimensioni_disegno02_bottom a").eq(0).attr("rel");
		$("#dimensioni_disegno02_bottom a").eq(0).addClass("active");
		$("#dimensioni_disegno02_top").html("<img src='"+first_dis+"' />");
		
		dis_tot = ($("#dimensioni_disegno02_bottom a").length);
		if (dis_tot == 1) {
		$("#dimensioni_disegno02_bottom a").css({display:'none'});
		} else if (dis_tot == 0) {
		$("#dimensioni_disegno02_top").css({display:'none'});
		$("#dimensioni_disegno02_bottom a").css({display:'none'});
		}
		
		$("#dimensioni_disegno02_bottom a").click(function(){
			url = $(this).attr("rel");
			$("#dimensioni_disegno02_bottom a").removeClass("active");
			$(this).addClass("active");
			$("#dimensioni_disegno02_top").empty();
			$("#dimensioni_disegno02_top").html("<div id='tecnico_loading'><br/><br/><img src='"+path_assoluto+"imgs/loading.gif' /></div>").show("normal");
			$.ajax({
				url:url,
				success: function(){
					$("#dimensioni_disegno02_top").empty();
					$("#dimensioni_disegno02_top").html("<img src='"+url+"' />");
					},
				error: function(){
					$("#dimensioni_disegno02_top").empty();
					$("#dimensioni_disegno02_top").html("<img src='"+url+"' />");
				}
				});
			return false;
		});
		
		
		/* Funzione per il blocco DISEGNO 03 TECNICO 
		- - - - - - - - - - - - - - - - - - - - */		
		first_dis = $("#dimensioni_disegno_bottom03 a").eq(0).attr("rel");
		$("#dimensioni_disegno_bottom03 a").eq(0).addClass("active");
		$("#dimensioni_disegno_top03").html("<img src='"+first_dis+"' />");
		
		dis_tot = ($("#dimensioni_disegno_bottom03 a").length);
		if (dis_tot == 1) {
		$("#dimensioni_disegno_bottom03 a").css({display:'none'});
		} else if (dis_tot == 0) {
		$("#dimensioni_disegno_top03").css({display:'none'});
		$("#dimensioni_disegno_bottom03 a").css({display:'none'});
		}
		
		$("#dimensioni_disegno_bottom03 a").click(function(){
			url = $(this).attr("rel");
			$("#dimensioni_disegno_bottom03 a").removeClass("active");
			$(this).addClass("active");
			$("#dimensioni_disegno_top03").empty();
			$("#dimensioni_disegno_top03").html("<div id='tecnico_loading'><br/><br/><img src='"+path_assoluto+"imgs/loading.gif' /></div>").show("normal");
			$.ajax({
				url:url,
				success: function(){
					$("#dimensioni_disegno_top03").empty();
					$("#dimensioni_disegno_top03").html("<img src='"+url+"' />");
					},
				error: function(){
					$("#dimensioni_disegno_top03").empty();
					$("#dimensioni_disegno_top03").html("<img src='"+url+"' />");
				}
				});
			return false;
		});
		/* Funzione per il blocco CORNICE 
		- - - - - - - - - - - - - - - - */
		first_cornice = $("#cornice_menu a").eq(0).attr("rel");
		$("#cornice_menu a").eq(0).addClass("on");
		$("#cornice").html("<img src='"+first_cornice+"' />");
		
		$("#cornice_menu a").click(function(){
			$("#cornice_menu a").removeClass();
			$(this).addClass("on");
			url = $(this).attr("rel");
			$("#cornice").empty();
			$("#cornice").html("<div id='tecnico_loading'><br/><img src='"+path_assoluto+"imgs/loading.gif' /></div>").show("normal");
			$.ajax({
				url:url,
				success: function(){
					$("#cornice").empty();
					$("#cornice").html("<img src='"+url+"' />");
					},
				error: function(){
					$("#cornice").empty();
					$("#cornice").html("<img src='"+url+"' />");
				}
				});
			return false;
		});
	
	apriMenu();
	
	/* Funzione ZOOM 
		- - - - - - - - - - - - - - - - - - - - */
	//$("#zoom").hide();
	// inizio zoom
		$("#corpo_azienda a.pop").click(function(){
		var url_img = $(this).attr("rel");
		$("body").append("<div id='pop_bg' style='position:absolute; z-index:5; top:0; width:100%; height:100%;'></div>")/*.css({opacity:0.3})*/;
		$("body").append("<div id='pop' style='position:absolute; z-index:10; top:0; width:100%; height:100%;'><div style='margin:0 auto; padding:50px 0 2px 0; text-align:center;'><a href='#' onclick='closePop();'><img src='"+url_img+"' border:0; alt='close' /></a></div></div>");
		return false;
	});	
	
	// fine zoom

	
/* Altre funzioni 
- - - - - - - - - - - - - - - - - - - - */
//$("#titolo_corpo.azienda").css({background:"#999999"});
$("#titolo_corpo.cappe").css({background:"#6670AD"});
$("#titolo_corpo.cottura").css({background:"#6B6203"});
$("#titolo_caffe.caffe").css({background:"#a4640c"});
$("#titolo_corpo.complementi").css({background:"#820024"});
$("#titolo_corpo.accessori").css({background:"#640557"});

//$("#logo.en").css({background:"url(imgs/logo_tecnowind_en.jpg) top left no-repeat #fff;"});
	
});


/* Funzione per Menù 
- - - - - - - - - - - - - - - - - - - - */
function menu(){
	$("#menu ul li ul").hide();
	$("#menu ul li a").click(function(){
		if($(this).attr("href")=="#"){
			if ($(this).next().attr("class") == "on") {
				$(this).next().removeClass("on").slideUp("normal");
				// scriverlo due volte per trovare gli elementi successivi con classe .on
				$(this).next().find(".on").removeClass("on").slideUp("normal");
			} else {
				$(this).parent().parent().find(".on").removeClass("on").slideUp("normal");
				$(this).next().addClass("on").slideDown("normal");
			}
			return false;
		}
	});
}

function apriMenu(){
	$("#menu a.active").each(function(){
	  $(this).parent().show().parent().show().parent().show().parent().show().parent().show().parent().show().parent().show();

	});
}

function closePop() {
	$("#pop_bg").fadeOut("normal",function(){
		$("body").css({opacity:1});
		$(this).remove();
	});
	$("#pop").fadeOut("normal",function(){
		$(this).remove();
	});
}

function ShowAndHide(id1){
if(document.getElementById){
    el1=document.getElementById(id1);
    if(el1.style.display=="none"){
        el1.style.display="block";
        }
    else{
        el1.style.display="none";
        }
    }
}



function check (form1) {
var manca;
manca=0;
if  (document.form1.Nome.value=='' )  {
     confirm(j_Nome)
     manca=1;
 } 
if  (document.form1.Cognome.value=='' )  {
     confirm(j_Cognome)
     manca=1;
 }
if  (document.form1.Email.value=='' )  {
     confirm(j_Email)
     manca=1;
 }
if  (document.form1.LuogoNascita.value=='' )  {
     confirm(j_LuogoNascita)
     manca=1;
 }
if  (document.form1.DataNascita.value=='' )  {
     confirm(j_DataNascita)
     manca=1;
 }
if  (document.form1.CodiceFiscale.value=='' )  {
     confirm(j_CodiceFiscale)
     manca=1;
 }
if  (document.form1.TitoloDiStudio.value=='' )  {
     confirm(j_TitoloDiStudio)
     manca=1;
}

if  (document.form1.NomeFile.value=='' )  {
     confirm(j_NomeFile)
     manca=1;
}

for (i=0;i<document.form1.CURRICULUM_privacy.length;i++)
{
if (document.form1.CURRICULUM_privacy[i].checked)
{
rbgroup_value = document.form1.CURRICULUM_privacy[i].value;
	if  (rbgroup_value=='0' )  {
		 confirm(j_CURRICULUM_privacy)
		 manca=1;
	}
//alert (document.form1.CURRICULUM_privacy[i].value);
}
} 

if  (manca==0)  {
          document.form1.submit();
 } 

}

	var j_Nome="Devi specificare il tuo NOME per proseguire"
	var j_Cognome="Devi specificare il tuo COGNOME per proseguire"
	var j_Email="Devi specificare la tua EMAIL per proseguire"
	var j_LuogoNascita="Devi specificare il LUOGO DI NASCITA per proseguire"
	var j_DataNascita="Devi specificare la DATA DI NASCITA per proseguire"
	var j_CodiceFiscale="Devi specificare il CODICE FISCALE per proseguire"
	var j_TitoloDiStudio="Devi specificare il TITOLO DI STUDIO per proseguire"
	var j_NomeFile="Devi caricare il FILE .PDF per proseguire"
	var j_CURRICULUM_privacy="Devi confermare la LETTURA DELL'INFORMATIVA per proseguire"
	
	
function check2 (form2) {
var manca;
manca=0;
if  (document.form2.Nome.value=='' )  {
     confirm(j_Nome_en)
     manca=1;
 } 
if  (document.form2.Cognome.value=='' )  {
     confirm(j_Cognome_en)
     manca=1;
 }
if  (document.form2.Email.value=='' )  {
     confirm(j_Email_en)
     manca=1;
 }
if  (document.form2.LuogoNascita.value=='' )  {
     confirm(j_LuogoNascita_en)
     manca=1;
 }
if  (document.form2.DataNascita.value=='' )  {
     confirm(j_DataNascita_en)
     manca=1;
 }
if  (document.form2.TitoloDiStudio.value=='' )  {
     confirm(j_TitoloDiStudio_en)
     manca=1;
}

if  (document.form2.NomeFile.value=='' )  {
     confirm(j_NomeFile_en)
     manca=1;
}

for (i=0;i<document.form2.CURRICULUM_privacy.length;i++)
{
if (document.form2.CURRICULUM_privacy[i].checked)
{
rbgroup_value = document.form2.CURRICULUM_privacy[i].value;
	if  (rbgroup_value=='0' )  {
		 confirm(j_CURRICULUM_privacy_en)
		 manca=1;
	}
//alert (document.form1.CURRICULUM_privacy[i].value);
}
} 

if  (manca==0)  {
          document.form2.submit();
 } 

}

	var j_Nome_en="Please specify your NAME to continue"
	var j_Cognome_en="Please specify your SURNAME to continue"
	var j_Email_en="Please specify your EMAIL to continue"
	var j_LuogoNascita_en="Please specify your PLACE OF BIRTH to continue"
	var j_DataNascita_en="Please specify your DATE OF BIRTH to continue"
	var j_TitoloDiStudio_en="Please specify your DEGREE to continue"
	var j_NomeFile_en="Please attach the file of your CURRICULUM to continue"
	var j_CURRICULUM_privacy_en="You must agree to the use of your personal data"

