var winWin=null;
var winWin2=null;
var winWin3=null;

function winOpen(url)
{
if ((winWin==null)|| winWin.closed)
	winWin=window.open(url,'','top=20,left=20,width=900,height=700,toolbar=yes,directories=no,menubar=yes,status=yes,resizable=yes,location=yes,scrollbars=yes,copyhistory=no,');
else
{winWin.location.href=url;
    winWin.focus();}
}

function winOpen2(url)
{
if ((winWin2==null)|| winWin2.closed)
	winWin2=window.open(url,'','top=20,left=20,width=1000,height=700,toolbar=no,directories=no,menubar=no,status=no,resizable=yes,location=no,scrollbars=yes,copyhistory=no,');
else
{winWin2.location.href=url;
    winWin2.focus();}
}

function winOpen3(url)
{
if ((winWin3==null)|| winWin3.closed)
	winWin3=window.open(url,'','top=20,left=20,width=900,height=700,toolbar=yes,directories=no,menubar=yes,status=yes,resizable=yes,location=yes,scrollbars=yes,copyhistory=no,');
else
{winWin3.location.href=url;
    winWin3.focus();}
}


function inset(t)
{
t.style.cursor='hand';
t.className=t.className + "_in";
}

function outset(t)
{
t.style.cursor='pointer';
var s=new String();
s=t.className;
t.className=s.substr(0,s.length-3);
}

function insetM(t)
{
t.style.color="#FF1A1A";
t.style.cursor='hand';
}

function outsetM(t)
{
t.style.color="#000066";
}

function imgON(element)
{
var s=new String();
s=element.src;
ext=s.substr(s.length-4,4);
s=s.substr(0,s.length-4) + "-ON" + ext;
element.src=s;
}

function imgOFF(element)
{
var s=new String();
s=element.src;
ext=s.substr(s.length-4,4);
s=s.substr(0,s.length-7)+ ext;
element.src=s;
}

function setWhiteBGK(elemnt)
{
for (i=0;i<8;i++)
	{elementName="divn"+i;
	var theELE=document.getElementById(elementName);
	if (!theELE)
		break;
	if (elementName==elemnt)
		theELE.style.background="#E8E7E0";
	else
		theELE.style.background="#FFFFFF";
	}

}

function checkLogin(str1,str2,str3)
{
var error =false;
var text ="";
var i=0;
if (document.login.user.value == "")
        {
        error = true;
        text = text + "\n- " + str1;
        }
if (document.login.pass.value == "")
        {
        error = true;
                text = text + "\n- " + str2;
        }
if (error)
        {
        text = str3 + text;
        alert(text);
		return false;
        }
document.login.submit();
return true;
}

function checkEmail(str)
{
if (str=="")
	return true;
var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
if (filter.test(str))
	return true;
else
	return false;
}

function submitForm2(lang)
{
if (lang=="it")
	{
	switch(document.forms[1].select3.selectedIndex)
		{
		case 1:document.location.href='stampa-su-bottiglia.php';
			break;
		case 2:document.location.href='Z5000.php';
			break;
		case 3:document.location.href='Z5000its.php';
			break;
		case 4:document.location.href='GraphJET.php';
			break;
		case 5:document.location.href='ModulPrint-stampa-codice.php';
			break;
		case 6:document.location.href='ZJET303-timbratore.php';
			break;
		}
	}
if (lang=="EN")
	{
	switch(document.forms[1].select3.selectedIndex)
		{
		case 1:document.location.href='print-on-bottle.php';
			break;
		case 2:document.location.href='Z5000-batch-printing.php';
			break;
		case 3:document.location.href='Z5000its-printer.php';
			break;
		case 4:document.location.href='GraphJET-barcodes.php';
			break;
		case 5:document.location.href='ModulPrint-print-barcode.php';
			break;
		case 6:document.location.href='ZJET303-print-on-plastic.php';
			break;
		}
	}
}

function goSITE()
{
switch (document.nelMondo.goOUT.selectedIndex)
	{
	case 1:document.location.href="http://www.zanasi.it/index.php";
			break;
	case 2:document.location.href="http://www.zanasi.it/printer.php";
			break;
	case 3:winOpen("http://www.zanasi.es/");
		break;
	case 4:winOpen("http://www.zanasiusa.com/");
		break;
	case 5:winOpen("http://www.zanasichina.com/");
		break;
	case 6:winOpen("http://www.zanasi.co.kr/");
		break;
	case 7:winOpen("http://www.zanasi.co.id/");
		break;
	}
/*["LANG"]=="FR"["LANG"]=="ES"["LANG"]=="DE"["LANG"]=="PT"*/
}


function decoloracampo(campo){
      	$("input[name='"+campo+"']").animate({ 
		backgroundColor:"#FFFFFF"
      }, 1500 );	
}

function coloracampo(campo){
      	$("input[name='"+campo+"']").animate({ 
		backgroundColor:"#EE7777"
      }, 1500 );	
}


function checkContacts(str1,str2)
{
var email= new String();
var telefono= new String();
email = document.contsForm.fld3.value;
telefono = document.contsForm.fld4.value; 
var error =false;

if((document.forms[0].elements[5].value==17)&&((document.contsForm.fld8.value == "")||(document.contsForm.fld9.value == ""))){
	error=true;
	}

if ((document.contsForm.fld1.value == ""))
	{
	coloracampo("fld1");
	error=true;
    }
	else decoloracampo("fld1");
if ((document.contsForm.fld3.value == ""))
	{
	coloracampo("fld3");
	error=true;
    }else decoloracampo("fld3");
if ((document.contsForm.fld5.value == ""))
	{
	$("#fld5").animate({
		backgroundColor:"#EE7777"
      }, 1500 );
	error=true;
    }
	else{
		$("#fld5").animate({
		backgroundColor:"#FFFFFF"
      }, 1500 );
	}
if ((document.contsForm.fld7.value == "")) {
	$("#fromWcomp").animate({
		backgroundColor: "#EE7777"
	}, 1500);
}
else {
	$("#fromWcomp").animate({
		backgroundColor: "#FFFFFF"
	}, 1500);
}
if(email.search('@')==-1 || email.length<8 || email.search('.')==-1){
	error=true;
	coloracampo("fld3");
	}else decoloracampo("fld3");
if(telefono.length<8)
	{
	coloracampo("fld4");
	error=true;
	}else decoloracampo("fld4");
	
if(!document.contsForm.privacy.checked)
	{
	error=1;
	$("#privacy").animate({
		backgroundColor:"#EE7777"
      }, 1500 );
	}else{
		$("#privacy").animate({
		backgroundColor:"#FFFFFF"
      }, 1500 );
	}

if(error){
	alert(str1);
	return false;//VA A FALSE!!!
	}
else{
	document.contsForm.submit();
	return true;// va a true
	}
}








function checkUPL(txt1,txt2,txt3,txt4,enc)
{
errore=0;
testo="";
/*if (document.upload.tipoFILE.selectedIndex<1)
	{errore=1;
	testo= txt1 + "\n";}
if (enc)
	{if (document.upload.encripted.selectedIndex<1)
		{errore=1;
		testo= testo + txt2+ "\n";}
	}*/
if (document.upload.upFile.value=="")
	{testo=testo + txt3 + "\n";
	errore=1;}
if (errore)
	{alert(txt4 + "\n"+testo);
	return false;
	}
else
	{
	document.upload.azione.value=2;
	document.upload.submit();
	return true;
	}
}

function checkRicerca(txt,mode)
{if ((document.forms[0].categoria.selectedIndex==0)&&(document.forms[0].norme.selectedIndex==0))
	{alert(txt);
	return false;}
if (!mode)
	document.forms[0].submit();
else
	return true;
}

