// cfbgre.js  18.04.2009

function chformre()
{
// per form registrazione
	var err = "You have to fill the fields below:\n";
	var OK = true;
	var z;

	m1=["nome","cognome","indirizzo","cap","citta","prov","telefono","fax","e_mail"]
	m2=["First name","Last Name","Address","ZIP","City","State/Country","Phone","Fax","E-mail"]

	for (z=0;z<9;z++)
	{
		if (z != 7)
		{
		obj = "document.forms[0]."+m1[z]+".value";
		if (eval(obj) == "")
		{
			err=err+"\n-"+m2[z];
			OK=false;
		}
		}
	}

	if (OK)
	{
		if (document.forms[0].nome.value.length < 2)
		{
			err = err + "\n-Please fill the field First name correctly!";
			OK=false;
		}

		if (document.forms[0].cognome.value.length < 2)
		{
			err = err + "\n-Please fill the field Last Name correctly!";
			OK=false;
		}

		if (document.forms[0].indirizzo.value.length < 6)
		{
			err = err + "\n-Please fill the field Address correctly!";
			OK=false;
		}

		if (document.forms[0].cap.value.length < 4)
		{
			err = err + "\n-Please fill the field Zip correctly!";
			OK=false;
		}

		if (document.forms[0].citta.value.length < 3)
		{
			err = err + "\n-Please fill the field City correctly!";
			OK=false;
		}

		if (document.forms[0].prov.value.length < 2)
		{
			err = err + "\n-Please fill the field State/Country correctly!";
			OK=false;
		}

		if ((document.forms[0].telefono.value.length < 6) | document.forms[0].telefono.value.search("0000") >= 0 )
		{
			err = err + "\n-Please fill the field Phone correctly!";
			OK=false;
		}

		if ((document.forms[0].e_mail.value.search("@") <= 0) | (document.forms[0].e_mail.value.length < 6))
		{
			err = err + "\n-Please fill the field E-mail correctly!";
			OK=false;
		}
	}

	if (document.forms[0].consenso_privacy[1].checked)
	{
		err = err + "\n-Please read and approve the General Conditions";
		OK = false;
	}

	if (OK)
	{
//
	}
	else
	{
		alert(err);
	}
  return OK
}

function chformre2()
{
// per form registrazione
	var err = "You have to fill the fields below:\n";
	var OK = true;
	var z;

        m1=["nome","cognome","indirizzo","cap","citta","prov","stato","telefono","fax","e_mail","cimg"]
        m2=["First name","Last Name","Address","ZIP","City","State","Country","Phone","Fax","E-mail","Code"]

        for (z=0;z<11;z++)
	{
                if (z != 8)
		{
		obj = "document.forms[0]."+m1[z]+".value";
		if (eval(obj) == "")
		{
			err=err+"\n-"+m2[z];
			OK=false;
		}
		}
	}

	if (OK)
	{
		if (document.forms[0].nome.value.length < 2)
		{
			err = err + "\n-Please fill the field First name correctly!";
			OK=false;
		}

		if (document.forms[0].cognome.value.length < 2)
		{
			err = err + "\n-Please fill the field Last Name correctly!";
			OK=false;
		}

		if (document.forms[0].indirizzo.value.length < 6)
		{
			err = err + "\n-Please fill the field Address correctly!";
			OK=false;
		}

		if (document.forms[0].cap.value.length < 4)
		{
			err = err + "\n-Please fill the field Zip correctly!";
			OK=false;
		}

		if (document.forms[0].citta.value.length < 3)
		{
			err = err + "\n-Please fill the field City correctly!";
			OK=false;
		}

		if (document.forms[0].prov.value.length < 2)
		{
                        err = err + "\n-Please fill the field State correctly!";
			OK=false;
		}

                if (document.forms[0].stato.value == "")
		{
                        err = err + "\n-Please fill the field Country correctly!";
			OK=false;
		}

		if ((document.forms[0].telefono.value.length < 6) | document.forms[0].telefono.value.search("0000") >= 0 )
		{
			err = err + "\n-Please fill the field Phone correctly!";
			OK=false;
		}

		if ((document.forms[0].e_mail.value.search("@") <= 0) | (document.forms[0].e_mail.value.length < 6))
		{
			err = err + "\n-Please fill the field E-mail correctly!";
			OK=false;
		}

                if (document.forms[0].cimg.value.length != 5)
		{
                        err = err + "\n-Please fill the field Code correctly!";
			OK=false;
		}

	}

	if (document.forms[0].consenso_privacy[1].checked)
	{
		err = err + "\n-Please read and approve the General Conditions";
		OK = false;
	}

	if (OK)
	{
//
	}
	else
	{
		alert(err);
	}
  return OK
}

function chforman()
{
// per form conferma anagrafica
	var err = "You have to fill the fields below:\n";
	var OK = true;
	var z;

	m1=["nome","cognome","indirizzo","cap","citta","prov","stato","telefono","fax"]
	m2=["First name","Last Name","Address","ZIP","City","State","Country","Phone","Fax"]

	for (z=0;z<=8;z++)
	{
		if (z != 8)
		{
		obj = "document.forms[0]."+m1[z]+".value";
		if (eval(obj) == "")
		{
			err=err+"\n-"+m2[z];
			OK=false;
		}
		}
	}

	if (OK)
	{
		if (document.forms[0].nome.value.length < 2)
		{
			err = err + "\n-Please fill the field First name correctly!";
			OK=false;
		}

		if (document.forms[0].cognome.value.length < 2)
		{
			err = err + "\n-Please fill the field Last Name correctly!";
			OK=false;
		}

		if (document.forms[0].indirizzo.value.length < 6)
		{
			err = err + "\n-Please fill the field Address correctly!";
			OK=false;
		}

		if (document.forms[0].cap.value.length < 4)
		{
			err = err + "\n-Please fill the field Zip correctly!";
			OK=false;
		}

		if (document.forms[0].citta.value.length < 7)
		{
			err = err + "\n-Please fill the field City correctly!";
			OK=false;
		}

		if (document.forms[0].prov.value.length < 2)
		{
			err = err + "\n-Please fill the field State correctly!";
			OK=false;
		}

		if (document.forms[0].stato.value.length < 2)
		{
			err = err + "\n-Please fill the field Country correctly!";
			OK=false;
		}

		if ((document.forms[0].telefono.value.length < 6) | document.forms[0].telefono.value.search("0000") >= 0 )
		{
			err = err + "\n-Please fill the field Phone correctly!";
			OK=false;
		}

	}

	if (OK)
	{
//
	}
	else
	{
		alert(err);
	}
  return OK
}

function chformanl(nl)
{
// per form conferma anagrafica
//	var err = "You have to fill the fields below:\n";
    var err;
	var OK = true;
	var z;

    if (nl == 1)
    {
      err="Devi compilare correttamente i seguenti campi:\n";
    }
    else
    {
      err="You have to fill the fields below:\n";
    }
    
	m1=["nome","cognome","indirizzo","cap","citta","prov","stato","telefono","fax"]
	m2=["Nome","Cognome","Indirizzo","CAP","Cittą","Provincia","Stato","Telefono","Fax","First name","Last Name","Address","ZIP","City","State","Country","Phone","Fax"]
    e2=["Per favore compila correttamente il campo ","Please fill this field correctly: "]

	for (z=0;z<=8;z++)
	{
		if (z != 8)
		{
		obj = "document.forms[0]."+m1[z]+".value";
		if (eval(obj) == "")
		{
			err=err+"\n-"+m2[z];
			OK=false;
		}
		}
	}

	if (OK)
	{
		if (document.forms[0].nome.value.length < 2)
		{
            err = err + "\n-" + e2[nl-1] + m2[((nl-1)*9)]
//			err = err + "\n-Please fill the field First name correctly!";
			OK=false;
		}

		if (document.forms[0].cognome.value.length < 2)
		{
            err = err + "\n-" + e2[nl-1] + m2[((nl-1)*9)+1]
//			err = err + "\n-Please fill the field Last Name correctly!";
			OK=false;
		}

		if (document.forms[0].indirizzo.value.length < 6)
		{
            err = err + "\n-" + e2[nl-1] + m2[((nl-1)*9)+2]
//        err = err + "\n-Please fill the field Address correctly!";
			OK=false;
		}

		if (document.forms[0].cap.value.length < 4)
		{
            err = err + "\n-" + e2[nl-1] + m2[((nl-1)*9)+3]
//			err = err + "\n-Please fill the field Zip correctly!";
			OK=false;
		}

		if (document.forms[0].citta.value.length < 7)
		{
            err = err + "\n-" + e2[nl-1] + m2[((nl-1)*9)+4]
//        err = err + "\n-Please fill the field City correctly!";
			OK=false;
		}

		if (document.forms[0].prov.value.length < 2)
		{
            err = err + "\n-" + e2[nl-1] + m2[((nl-1)*9)+5]
//        err = err + "\n-Please fill the field State correctly!";
			OK=false;
		}

		if (document.forms[0].stato.value.length < 2)
		{
            err = err + "\n-" + e2[nl-1] + m2[((nl-1)*9)+6]
//        err = err + "\n-Please fill the field Country correctly!";
			OK=false;
		}

		if ((document.forms[0].telefono.value.length < 6) | document.forms[0].telefono.value.search("0000") >= 0 )
		{
            err = err + "\n-" + e2[nl-1] + m2[((nl-1)*9)+7]
//        err = err + "\n-Please fill the field Phone correctly!";
			OK=false;
		}

	}

	if (OK)
	{
//
	}
	else
	{
		alert(err);
	}
  return OK
}

function chforman2()
{
// per form conferma anagrafica su carrello
	var err = "You have to fill the fields below:\n";
	var OK = true;
	var z;

	m1=["nome","cognome","indirizzo","cap","citta","prov","stato","tel","fax"]
	m2=["First name","Last Name","Address","ZIP","City","State","Country","Phone","Fax"]

	obj = "document.forms[1].nps.value";
        if (eval(obj) == "1")
        {
	for (z=0;z<=8;z++)
	{
		if (z != 8)
		{
		obj = "document.forms[1]."+m1[z]+".value";
		if (eval(obj) == "")
		{
			err=err+"\n-"+m2[z];
			OK=false;
		}
		}
	}

	if (OK)
	{
		if (document.forms[1].nome.value.length < 2)
		{
			err = err + "\n-Please fill the field First name correctly!";
			OK=false;
		}

		if (document.forms[1].cognome.value.length < 2)
		{
			err = err + "\n-Please fill the field Last Name correctly!";
			OK=false;
		}

		if (document.forms[1].indirizzo.value.length < 6)
		{
			err = err + "\n-Please fill the field Address correctly!";
			OK=false;
		}

		if (document.forms[1].cap.value.length < 4)
		{
			err = err + "\n-Please fill the field Zip correctly!";
			OK=false;
		}

		if (document.forms[1].citta.value.length < 3)
		{
			err = err + "\n-Please fill the field City correctly!";
			OK=false;
		}

		if (document.forms[1].prov.value.length < 2)
		{
			err = err + "\n-Please fill the field State correctly!";
			OK=false;
		}

		if ((document.forms[1].tel.value.length < 6) | document.forms[1].tel.value.search("0000") >= 0 )
		{
			err = err + "\n-Please fill the field Phone correctly!";
			OK=false;
		}

	}
        }

	if (OK)
	{
//
	}
	else
	{
		alert(err);
	}
  return OK
}

function chformct()
{
// per form contatti
	var err = "You have to fill the fields below:\n";
	var OK = true;
	var z;

        m1=["Name","email","Comments"]
        m2=["Name","e-mail","Text message"]

        for (z=0;z<3;z++)
	{
		obj = "document.forms[0]."+m1[z]+".value";
		if (eval(obj) == "")
		{
			err=err+"\n-"+m2[z];
			OK=false;
		}
	}

	if (OK)
	{
                if ((document.forms[0].email.value.search("@") <= 0) | (document.forms[0].email.value.length < 6))
		{
                        err = err + "\n-Please fill the field e-mail correctly!";
			OK=false;
		}
	}

	if (OK)
	{
//
	}
	else
	{
		alert(err);
	}
  return OK
}

function chformiv()
{
// per form invio promo
	var err = "You have to fill the fields below:\n";
	var OK = true;
	var z;

        m1=["oggetto","testo","mail"]
        m2=["Subject","Text message","e-mail"]

        for (z=0;z<3;z++)
	{
		obj = "document.forms[0]."+m1[z]+".value";
		if (eval(obj) == "")
		{
			err=err+"\n-"+m2[z];
			OK=false;
		}
	}

	if (OK)
	{
                if ((document.forms[0].mail.value.search("@") <= 0) | (document.forms[0].mail.value.length < 6))
		{
                        err = err + "\n-Please fill the field e-mail correctly!";
			OK=false;
		}
	}

	if (OK)
	{
//
	}
	else
	{
		alert(err);
	}
  return OK
}

function chformrc()
{
// per form recupero password
	var err = "You have to fill the fields below:\n";
	var OK = true;
	var z;

    m1=["e_mail","cimg"]
    m2=["E-mail","Code"]

    for (z=0;z<2;z++)
	{
		obj = "document.forms[0]."+m1[z]+".value";
		if (eval(obj) == "")
		{
			err=err+"\n-"+m2[z];
			OK=false;
		}

	}

	if (OK)
	{
		if ((document.forms[0].e_mail.value.search("@") <= 0) | (document.forms[0].e_mail.value.length < 6))
		{
			err = err + "\n-Please fill the field E-mail correctly!";
			OK=false;
		}

        	if (document.forms[0].cimg.value.length != 5)
		{
                        err = err + "\n-Please fill the field Code correctly!";
			OK=false;
		}

	}

	if (OK)
	{
//
	}
	else
	{
		alert(err);
	}
  return OK
}

function popupwcr() 
{
wcr=window.open("","newwin","toolbar=no,scrollbars=yes,width=600,height=400")
wcr.focus()
wcr.location.reload()
}
function popupnw1() 
{
wcr1=window.open("","nw1","toolbar=no,scrollbars=yes,width=600,height=400")
wcr1.focus()
}
function popupnw2() 
{
wcr2=window.open("","nw2","toolbar=no,scrollbars=yes,width=600,height=400")
wcr2.focus()
}
function popupnw3()
{
wcr3=window.open("","nw3","toolbar=no,scrollbars=yes,width=600,height=400")
wcr3.focus()
}
function popupnw4()
{
wcr4=window.open("","nw4","toolbar=no,scrollbars=yes,width=600,height=400")
wcr4.focus()
}

function rpl(ns)
{
  var pr=new Array();
  var obj;

  obj = "document.iAccInput" + ns + ".selp.value";
  prj=eval(obj)

  if ((prj != 0) && (prj.length != 0))
  {
    pr=prj.split("#");
    if (pr[1] != null)
    {
      obj="pl"+ns;
      document.getElementById(obj).innerHTML = pr[1];
      if (pr[2] != null)
      {
        obj="pn"+ns;
        document.getElementById(obj).innerHTML = pr[2];
      }
    }
  }
  else
  {
    obj="pl"+ns;  
    document.getElementById(obj).innerHTML = "";
    obj="pn"+ns;
    document.getElementById(obj).innerHTML = "";
    pr[0]="0";
  }
  obj="iAccInput"+ns;
  document.forms[obj].mc.value=pr[0];
}
