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 checkContacts(str1,str2)
{
var error =false;

if((document.forms[0].elements[5].value==17)&&((document.contsForm.fld8.value == "")||(document.contsForm.fld9.value == ""))){
	document.contsForm.fld1.value == ""
	error=true;
	//alert('CAP + PROVINCIA');
	//str1=str1+'\n\nErrore: Inserire CAP e provincia.';
	}
if ((document.contsForm.fld1.value == "")||(document.contsForm.fld3.value == "")||(document.contsForm.fld5.value == "")||(document.contsForm.fld7.value == ""))
	{
	error=true;
    }

if(!document.contsForm.privacy.checked)
	{
	error=true;
	}

if(error){
	alert(str1);
	return false;
	}
else{
	document.contsForm.submit();
	return 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;
}

function showMap(map){
	if (GBrowserIsCompatible()){
		map.addControl(new GSmallMapControl());
		map.addControl(new GMapTypeControl());
		map.enableScrollWheelZoom();
		map.enableContinuousZoom();
		map.setCenter(new GLatLng(44.59097,10.75534),15);
		var point = new GLatLng(44.59097,10.75534);
		
		var indirizzo="Via Macina, 2p 42013 Casalgrande Reggio nell'Emilia";
		var testo="Mineraria Di Boca Srl <br/> Via Macina, 2p 42013 Casalgrande Reggio nell'Emilia ";
        var formus = '<div style="width:240px; height:70px;">'+testo+'</div>';
        var marker = createMarker(point,formus);
        map.addOverlay(marker);
       }
}


function newmap(indirizzo){
		indirizzo='Largo G.Garibaldi , 2 41124 - Modena';
         var arrivo=indirizzo;
         var partenza=document.forms[0].start.value;
        var url='http://maps.google.it/maps?f=d&saddr='+partenza+'&daddr='+arrivo;
         weblink=window.open(url);
         }

function createMarker(point,html) {
	        var marker = new GMarker(point);
	        GEvent.addListener(marker, "click", function() {
	         marker.openInfoWindowHtml(html);
	     });
	      return marker;
	}
function LoadData(id){
	$.post("GetProduct.php", { "id":id},
		function(data){
			$("#LeftBarData").html(data);
			},"html");
	}

