// jscript
function MM_reloadPage(init) { //reloads the window if Nav4 resized
  if (init==true) with (navigator ) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

var pagina = new Array("trentino-new.asp","azienda.asp","storia.asp","vino.asp?id=1","vino.asp?id=2","info.asp");
var tipobrowser="Explorer";

if (document.layers){ 
tipobrowser="Netscape4" 
//document.write("<link rel='stylesheet' href='stile_netscape4.css' type='text/css'>"); 
} 
else if (document.all){
tipobrowser="Explorer"
//document.write("<link rel='stylesheet' href='stile_explorer.css' type='text/css'>"); 
}
else if (document.getElementById){
tipobrowser="Netscape6"
//document.write("<link rel='stylesheet' href='stile_netscape6.css' type='text/css'>");
}
function stampa(i){
	winstampa=window.open("stampa.asp?id="+i,'popupcampomaseri','scrollbars=1,resizable=0,status=0,location=0,toolbar=0,width=680,height=500,top=50,left=50');
	winstampa.focus();
}
function stampa_chiudi(){
	var NS = (navigator.appName == "Netscape");
	var VERSION = parseInt(navigator.appVersion);	
	if (VERSION > 3) {
	//	alert('Avvia stampante...');
		window.print();
	}else{
		var WebBrowser = '<OBJECT ID="WebBrowser1" WIDTH=0 HEIGHT=0 CLASSID="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2"></OBJECT>';
		document.body.insertAdjacentHTML('beforeEnd', WebBrowser);
		WebBrowser1.ExecWB(6, 2);
		WebBrowser1.outerHTML = "";  
	}
	window.setTimeout('window.close()',30000);
}
function vaia(p){
	parent.corpo.location.href=pagina[p];
}
function invia(which){
	var pass=true;
	var tmp=which.textfield0;
	if (tmp.value==""){
		pass=false;
		alert("Inserisci il tuo nominativo");
	}else{
		trimIn(tmp.value," ");
		if (t==""){
			pass=false;
			alert("Il tuo nominativo è necessario \ncontrolla che sia scritto correttamente \ngrazie");
		}
	}
	if (pass){
		tmp=which.textfield1;
		if (!tmp.value==""){
			if ((tmp.value.indexOf("@")==-1 || tmp.value.indexOf(".")==-1 || tmp.value.indexOf("'")!=-1 || tmp.value.indexOf('"')!=-1) || tmp.value.length<8){
				alert("controlla che la tua e-mail sia scritta correttamente \ngrazie");
				pass=false;
			}
		}	
	}
	if (pass){
		tmp=which.textfield2;
		if (tmp.value==""){
			pass=false;
			alert("Inserisci un numero di telefono");
		}else{	
			if (!Number(tmp.value)){
				alert("Il tuo telefono è necessario \ncontrolla che sia scritto correttamente \nSONO AMMESSI SOLO CARATTERI NUMERICI \ngrazie");
				pass=false;
			}
		}			
	}
	if (pass){
		tmp=which.textfield3;
		if (tmp.value==""){
			pass=false;
			alert("Inserisci il messaggio");
		}else{
			trimIn(tmp.value," ");
			if (t==""||t.length<10){
				pass=false;
				alert("Il campo messaggio deve essere lungo più di 10 caratteri \ncontrolla che sia scritto correttamente \ngrazie");
			}
		}
	}
	if (!pass){
		tmp.select();
	}else{	
		which.method="post";
		which.action="send.asp";
		which.submit();
	}
}
function trimIn(test,c){
	p = test.indexOf(c);
	while(p!= -1){
		t1 = test.substring(0,p);
		t2 = test.substring(p+1);
		test = t1+t2;
		p = test.indexOf(c);
	} 
//	return t;
	t=test;
}
function credits(){
	winC=window.open('http://www.1191.it/credits.asp?dom='+document.URL,'credits','scrollbars=0,resizable=0,status=1,location=0,toolbar=0,width=100,height=100,top=0,left=0');
	winC.focus();
}
function init(){
	if (navigator.appName == "Netscape") {
		TipoBrow="N";
		layerStyleRef="layer.";
		layerRef="document.getElementById";
		Versione=navigator.appVersion;
		Versione=Versione.substr(0,3)
		if (Versione.search('5.')!=-1) {
			styleSwitch=".style";
			layerRef="document.getElementById";
				parentesi1="(";
				parentesi2=")";
		}else{
			parentesi1="[";
			parentesi2="]";
			styleSwitch="";
			layerRef="document.layers";
		}
	}else{
		TipoBrow="E";
		parentesi1="(";
		parentesi2=")";
		layerStyleRef="layer.style.";
		layerRef="document.all";
		styleSwitch=".style";
	} 
	if (navigator.platform.indexOf("Mac",0)==0){
		TipoBrow="N";
		ObjNonDefinito="null";
	}
	//else { 
	//	ObjNonDefinito=undefined;
	//}
	finecar=true;
	self.focus();
}
init();
function OpenPage(params)
{
	var oldPage=document.location.href;
	var newPage=TipoPagina;

	if(oldPage.indexOf("?")>-1)
	{
		newPage=newPage + oldPage.substring(oldPage.indexOf("?"));
	}
	else
	{
		var winName=window.top.name;
		newPage=newPage + "?H=" + winName;		
	}

	newPage=newPage + "&IDpag=" + params;

	document.location.href=newPage;
}
//Attiva il click su un link anche quando si clicca nel TD che lo contiene senza dover centrare 
//il link
function mClk(src){ 
   if(event.srcElement.tagName=='TD') src.children.tags('A')[0].click();
}
//Al passaggio del mouse sopra l'oggetto passato a parametro viene impostato il cursore come 
//mano e viene impostato il colore passato a parametro
function mOvr(src,clrOver){ 
	if (!src.contains(event.fromElement)){ 
		src.style.cursor = 'hand'; 
		src.bgColor = clrOver; 
	} 
} 
//All'uscita dal controllo fa ritornare il puntatore del mouse al valore di default
//e ripristina il colore a quello passato a parametro
function mOut(src,clrIn){ 
	if (!src.contains(event.toElement)){ 
		src.style.cursor = 'default'; 
		src.bgColor = clrIn;
	} 
}