function ShowFrame(optFrame)
{
	parent.location.href="data.asp?corpo="+optFrame;
}

function ShowFrameHome(optFrame, menu)
{
	parent.location.href="data.asp?corpo="+optFrame+"&menu="+menu;
}

function ShowFrameOther(optFrame)
{
	parent.iFrameMenu.location.href="menusx.asp?menu="+optFrame;
	switch (optFrame)
		{
		case "PR":
			parent.iFrameCorpo.location.href="menulinee.asp?menu=PR";
			break;
		case "MA":
			parent.iFrameMenu.location.href="menusx.asp?Linea=1&menu="+optFrame;		
			parent.iFrameCorpo.location.href="materiali.asp?menu=1";
			break;
		case "AG":
			parent.iFrameMenu.location.href="menusx.asp?Linea=1&menu="+optFrame;
			parent.iFrameCorpo.location.href="assistenzagaranzia.asp?menu=1";
			break;
		case "IN":
			parent.iFrameMenu.location.href="menusx.asp?Linea=1&menu="+optFrame;
			parent.iFrameCorpo.location.href="infoTecniche.asp?menu=1";
			break;
		case "GU":
			parent.iFrameMenu.location.href="menusx.asp?Linea=1&menu="+optFrame;
			parent.iFrameCorpo.location.href="guidaAcquisto.asp?menu=1";
			break;
		case "RE":
			parent.iFrameMenu.location.href="menusx.asp?Linea=1&menu="+optFrame;		
			parent.iFrameCorpo.location.href="realizzazioni.asp?menu=1";
			break;
		case "CE":
			parent.iFrameMenu.location.href="menusx.asp?Linea=1&menu="+optFrame;
			parent.iFrameCorpo.location.href="certificazioniGaranzia.asp?menu=1";
			break;
		case "DI":
			parent.iFrameMenu.location.href="menusx.asp?Linea=1&menu="+optFrame;
			parent.iFrameCorpo.location.href="distribuzione.asp";
			break;
		case "LA":
			parent.iFrameMenu.location.href="menusx.asp?Linea=1&menu="+optFrame;				
			parent.iFrameCorpo.location.href="lavoraconnoi.asp";
			break;
		case "CO":
			parent.iFrameMenu.location.href="menusx.asp?Linea=1&menu="+optFrame;				
			parent.iFrameCorpo.location.href="contatti.asp";
			break;
		case "DS":
			parent.iFrameMenu.location.href="menusx.asp?Linea=1&menu="+optFrame;				
			parent.iFrameCorpo.location.href="dovesiamo.asp";
			break;
		case "AZ":
			parent.iFrameMenu.location.href="menusx.asp?Linea=0&menu="+optFrame;		
			parent.iFrameCorpo.location.href="azienda.asp";
			break;
		case "NW":
			parent.iFrameMenu.location.href="menusx.asp?Linea=1&menu="+optFrame;
			parent.iFrameCorpo.location.href="news.asp";
			break;
		case "LP":
			parent.iFrameCorpo.location.href="leggeprivacy.asp";
			break;
		case "QA":
			parent.iFrameMenu.location.href="menusx.asp?Linea=1&menu="+optFrame;
			parent.iFrameCorpo.location.href="qualitaAmbiente.asp?menu=1";
			break;
		case "EV":
			parent.iFrameMenu.location.href="menusx.asp?Linea=1&menu="+optFrame;						
			parent.iFrameCorpo.location.href="eventi.asp";
			break;
	}
}

function ShowFrameHome(optFrame, menu)
{
	parent.location.href="other.asp?Corpo="+optFrame+"&menu="+menu;
}

function ShowFrameOtherHome(optFrame, menu)
{
	parent.iFrameMenu.location.href="menusx.asp?Linea="+menu+"&menu="+optFrame;
	switch (optFrame)
		{
		case "PR":
			parent.iFrameCorpo.location.href="sintesi78.asp";
			break;
		case "MA":
			parent.iFrameCorpo.location.href="";
			break;
		case "AG":
			parent.iFrameCorpo.location.href="";
			break;
		case "IN":
			parent.iFrameCorpo.location.href="";
			break;
		case "GU":
			parent.iFrameCorpo.location.href="guidaAcquisto.asp?menu="+menu;
			break;
		case "RE":
			parent.iFrameCorpo.location.href="";
			break;
		case "CE":
			parent.iFrameCorpo.location.href="";
			break;
		case "DI":
			parent.iFrameCorpo.location.href="";
			break;
		case "LA":
			parent.iFrameCorpo.location.href="";
			break;
		case "CO":
			parent.iFrameCorpo.location.href="";
			break;
		case "AZ":
			parent.iFrameCorpo.location.href="";
			break;
		case "QA":
			//if(menu>1) {
				parent.iFrameCorpo.location.href="qualitaambiente.asp?menu="+menu;
			//	}
			break;
	}
}

function ShowFrameMenuSx(optFrame, menu)
{
	parent.iFrameMenu.location.href="menusx.asp?Linea="+optFrame+"&menu="+menu;
	switch (menu)
		{
		case "PR":
			switch(optFrame)
			{
				case "S":
					parent.iFrameCorpo.location.href="sistemaintegra.asp";	
					break;
				case "78":
					parent.iFrameCorpo.location.href="sintesi78.asp";	
					break;
				default:
					parent.iFrameCorpo.location.href="prodottiDettaglio.asp?linea="+optFrame;
					break;
			}
			break;
		case "MA":
			parent.iFrameCorpo.location.href="materiali.asp?menu="+optFrame;
			break;
		case "AG":
			parent.iFrameCorpo.location.href="assistenzagaranzia.asp?menu="+optFrame;
			break;
		case "IN":
			parent.iFrameCorpo.location.href="infotecniche.asp?menu="+optFrame;
			break;
		case "GU":
			parent.iFrameCorpo.location.href="guidaacquisto.asp?menu="+optFrame;
			break;
		case "RE":
			parent.iFrameCorpo.location.href="realizzazioni.asp?menu="+optFrame;
			break;
		case "CE":
			parent.iFrameCorpo.location.href="certificazioniGaranzia.asp?menu="+optFrame;
			break;
		case "DI":
			parent.iFrameCorpo.location.href="";
			break;
		case "LA":
			parent.iFrameCorpo.location.href="lavoraconnoiCurriculumVitae.asp";
			break;
		case "NW":
			//parent.iFrameCorpo.location.href="news.asp";
			break;
		case "CO":
			parent.iFrameCorpo.location.href="";
			break;
		case "DS":
			parent.iFrameCorpo.location.href="";
			break;
		case "AZ":
			switch (optFrame)
				{
				case "9":
					parent.iFrameCorpo.location.href="video.asp";
					break;
				default:
					parent.iFrameCorpo.location.href="azienda.asp?menu="+optFrame;
					break;
				}
			break;
		case "QA":
			parent.iFrameCorpo.location.href="qualitaAmbiente.asp?menu="+optFrame;
			break;
	}	
}

function ShowFrameDettagli(linea, tipo)
{
	parent.iFrameCorpo.location.href="prodottiScheda.asp?linea="+linea+"&tipo="+tipo;
}

function ShowFrameNews(id,tipo)
{
	parent.location.href="data.asp?corpo=NE&id="+id+"&tipo="+tipo;
}

function ShowNews(id,tipo)
{
	parent.iFrameCorpo.location.href="news.asp?id="+id+"&tipo="+tipo;
}

function Restart(Lingua)
{
//	if (Lingua!="IT")
//		{
//		alert("Coming soon...");
//		}
//	else
//		{
		url = "restart.asp?ID=" + Lingua;
		window.location.href = url
//		}
}

function Reload(Lingua)
{
//	if (Lingua!="IT")
//		{
//		alert("Coming soon...");
//		}
//	else
//		{
		url = "reload.asp?ID=" + Lingua;
		window.location.href = url
//		}
}

function ShowSezioneMENU(strSezione)
{

	// Hide ALL
	document.getElementById('Menu_0').style.visibility="hidden";
	document.getElementById('Menu_1').style.visibility="hidden";
	document.getElementById('Menu_2').style.visibility="hidden";
	document.getElementById('Menu_3').style.visibility="hidden";
	document.getElementById('Menu_5').style.visibility="hidden";
	document.getElementById('Menu_7').style.visibility="hidden";

	//Show IT
	document.getElementById(strSezione).style.visibility="visible";
}

function CheckCRLF(input, e, idform)
{
	if (e.keyCode==13)
		{
		idform.submit();
		}
}

function CheckForm(theForm, IDLingua)
{

	//LOGIN
	if (theForm.cmdLogin != null)
		{
		theForm.cmdLogin.disabled=true
		}
	if (theForm.txtUtente != null)
		{
		if (theForm.txtUtente.value=="")
			{
			switch (IDLingua)
				{
					case "IT":
						alert('Inserire l\'utente!');
						break;
					case "EN":
						alert('Digit a valid User ID!');
						break;
					default:
						alert('');
				}
			theForm.txtUtente.focus();
			theForm.cmdLogin.disabled=false
			return false;
			}
		}
	if (theForm.txtUtente != null)
		{
		if (theForm.txtPassword.value=="")
			{
			switch (IDLingua)
				{
					case "IT":
						alert('Inserire la password!');
						break;
					case "EN":
						alert('Digit a valid password!');
						break;
					default:
						alert('');
				}
			theForm.txtPassword.focus();
			theForm.cmdLogin.disabled=false
			return false;
			}
		}
		
	//SEARCH
	if (theForm.cmdCerca != null)
		{
		theForm.cmdCerca.disabled=true
		}
	if (theForm.txtSearch != null)
		{
		if (theForm.txtSearch.value=="")
			{
			switch (IDLingua)
				{
					case "IT":
						alert('Inserire un testo da ricercare!');
						break;
					case "EN":
						alert('Digit a text for search!');
						break;
					default:
						alert('');
				}
			theForm.txtSearch.focus();
			theForm.cmdCerca.disabled=false
			return false;
			}
		}

	//MAILING
	if (theForm.cmdInvia != null)
		{
		theForm.cmdInvia.disabled=true
		}
	if (theForm.txtEmail != null)
		{
		if (theForm.txtEmail.value=="")
			{
			switch (IDLingua)
				{
					case "IT":
						alert('Inserire una email a cui poter inviare la mailing list!');
						break;
					case "EN":
						alert('Digit a valid email address to send newsletter!');
						break;
					default:
						alert('');
				}
			theForm.txtEmail.focus();
			theForm.cmdInvia.disabled=false
			return false;
			}
		}
		
	return true;

}

function openWindow(pagina, url)
{
	w=670;
	h=470;
	l=(screen.width-w)/2;
	t=(screen.height-h)/2;

	OpenWin = window.open(url, pagina, "toolbar=no,menubar=no,location=no,scrollbars=yes,resizable=no,height="+h+",width="+w+",top="+t+",left="+l+"");
}
function ControllaData(sDate, sFormatData)
{
	var tmpCheckDate = sDate;
	//TRIM
	tmpCheckDate = tmpCheckDate.replace(/^\s*|\s*$/g,'');

    if (tmpCheckDate=='')
		{
        return false;
		}
    else
		{
        if (tmpCheckDate.length == 10)
			{
			//Specifica le posizioni di ricerca
			switch(sFormatData)
				{
				case 'DD/MM/YYYY':
					{
					var sep1 = 2; 
					var sep2 = 5; 
					//
					var iYear = tmpCheckDate.substr(sep2 + 1, 4);
					var iMonth = tmpCheckDate.substr(sep1 + 1, 2);
					var iDay = tmpCheckDate.substr(0, 2);
					break;
					}
				case 'MM/DD/YYYY':
					{
					var sep1 = 2; 
					var sep2 = 5; 
					//
					var iYear = tmpCheckDate.substr(sep2 + 1, 4);
					var iMonth = tmpCheckDate.substr(0, 2);
					var iDay = tmpCheckDate.substr(sep1 + 1, 2);
					break;
					}
				case 'YYYY/MM/DD':
					{
					var sep1 = 4; 
					var sep2 = 7; 
					//
					var iYear = tmpCheckDate.substr(0, 4);
					var iMonth = tmpCheckDate.substr(sep1 + 1, 2);
					var iDay = tmpCheckDate.substr(sep2 + 1, 2);
					break;
					}
				}			

			//il formato è giusto!
			var sValidChar = '0123456789';

			for (i = 0; i <= 9; i++)
				{
				if (i != sep1 && i != sep2)
					{
					if (sValidChar.indexOf(tmpCheckDate.charAt(i)) == -1) {return false}
					}
				else
					{
					if (tmpCheckDate.charAt(i) != '/') {return false}
					}
				}

			// definisco vettore giorni x mese
			var aGiorniMM = new Array(31,28,31,30,31,30,31,31,30,31,30,31);

			//Controlla se bisestile
			if (((iYear % 4 == 0) && !(iYear % 100 == 0)) || (iYear % 400 == 0))
				{
				aGiorniMM[1]++;  // aggiungo 1 giorno a Febbraio
				}
			
			//Controlla Mese
            if (iMonth >= 1 && iMonth <= 12)
				{			
			    //Controlla Giorno:
                if (iDay >= 1 && iDay <= aGiorniMM[iMonth-1])
					{
			       	return true;
                	}
				else
					{
			       	return false;
	            	}
				}
			else
				{
		       	return false;
				}
			}
		else
			{
	        return false;
			}
		}
}