function preload()
{
  if (!document.images) return;
  var wl = new Array();
  var arguments = preload.arguments;
  for (var i = 0; i < arguments.length; i++) {
    wl[i] = new Image();
    wl[i].src = arguments[i];
  }
}
function rememberFnc(){
strMail = document.form1.txtEmail.value;
strMail.test = /\w/;
strUser = document.form1.txtIDutente.value;
strUser.test = /\w/;
if (strMail != false){
if (checkMail('txtEmail') == true){
if (strUser != false){
document.form1.BodyFnc.value = 1;
document.form1.submit();
}
else{
document.form1.txtIDutente.focus();
}
}
else{
document.form1.txtEmail.focus();
}
}
else{
document.form1.txtEmail.focus();
}
}
function clearRemFnc(){
parent.location.href = "forgotpassword.asp?ID=127384017015";
}
function clearFnc(){
parent.location.href = "contacts.asp?ID=127384017005";
}
function sendFnc(){
document.retVal = false;
one_check = 0;

if (document.form1.forename.value == "" && one_check == 0){
first_check = "forename";
one_check = 1;
}
if (document.form1.lastname.value == "" && one_check == 0){
first_check = "lastname";
one_check = 1;
}
if (document.form1.street.value == "" && one_check == 0){
first_check = "street";
one_check = 1;
}
if (document.form1.housenumber.value == "" && one_check == 0){
first_check = "housenumber";
one_check = 1;
}
if (document.form1.zipcode.value == "" && one_check == 0){
first_check = "zipcode";
one_check = 1;
}
if (document.form1.city.value == "" && one_check == 0){
first_check = "city";
one_check = 1;
}
if (document.form1.phone.value == "" && one_check == 0){
first_check = "phone";
one_check = 1;
}
if (document.form1.emailadress.value == "" && one_check == 0){
first_check = "emailadress";
one_check = 1;
}
if (document.form1.notice.value == "" && one_check == 0){
first_check = "notice";
one_check = 1;
}

if (one_check == 0){
document.form1.HdnFnc.value = 4;
document.retVal = true;
}
else{
	document.form1[first_check].focus();
}	
}
function changeBg(objectThis,objectThis2,objectThis3,imageBg,imageBg2){
document.getElementById(objectThis).background = imageBg;
document.getElementById(objectThis2).background = imageBg2;
document.getElementById(objectThis3).background = imageBg2;
}
function addfav(){
if (document.all){
window.external.AddFavorite("http://www.tutto626.it","www.tutto626.it");}
}
function printpage(){
width = (screen.width - 550)/2;
height = (screen.height - 360)/2;
var testo = "<html><head><title>"+document.title+"</title></head>";
testo += "<body>";
testo += "<table width=\"100%\" border=\"0\"><tr><td>";
testo += document.getElementById('bodyPage').innerHTML+"</td></tr></table>";
testo += "</body></html>";
var ident_finestra = window.open("","finestra_stampa",'width=550,height=360,toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=yes,copyhistory=no,resizable=no,screenX='+width+',screenY='+height+',top='+height+',left='+width+'');
ident_finestra.document.open();
ident_finestra.document.write(testo);
ident_finestra.document.close();
ident_finestra.print();
ident_finestra.close(); 
}

function checkForm(){
document.retVal = false;
one_check = 0;

if (document.form1.txtNome.value == "" && one_check == 0){
first_check = "txtNome";
one_check = 1;
}	

if (document.form1.txtCognome.value == "" && one_check == 0){
first_check = "txtCognome";
one_check = 1;
}	

if (document.form1.txtCittanascita.value == "" && one_check == 0){
first_check = "txtCittanascita";
one_check = 1;
}	

if (document.form1.txtDataDiNascita.value == "" && one_check == 0){
first_check = "txtDataDiNascita";
one_check = 1;
}

if (document.form1.txtCf.value == "" && one_check == 0){
first_check = "txtCf";
one_check = 1;
}

if (document.form1.txtTel_1.value == "" && one_check == 0){
first_check = "txtTel_1";
one_check = 1;
}

if (checkInputData('txtIndirizzo') == true && checkInputData('txtCitta') == false && one_check == 0){
first_check = "txtCitta";
one_check = 1;
}

if (checkInputData('txtIndirizzo') == true && checkInputData('txtCap') == false && one_check == 0){
first_check = "txtCap";
one_check = 1;
}

if (checkInputData('txtEmail') == false && one_check == 0){
first_check = "txtEmail";
one_check = 1;
}

if (document.form1.txtEmail.value != document.form1.txtREmail.value && one_check == 0){
first_check = "txtEmail";
one_check = 1;
}

if (checkUserID('txtIDuser') == false && one_check == 0){
alert("Attenzione.\nID Utente e Password devono essere composti da minimo 6 caratteri.\nGrazie.");
first_check = "txtIDuser";
one_check = 1;
}

if (checkPwd('txtPassword','txtRPassword') == false && one_check == 0){
first_check = "txtPassword";
one_check = 1;
}

if (one_check == 0){
document.form1.HdnFnc.value = 1;
document.retVal = true;
}
else{
	document.form1[first_check].focus();
}
}

function clearForm(){
window.location.href('home.asp?ID=1011567831089001');
}
function checkInputData(InputName){
strData = document.form1[InputName].value;
strData.test = /\w/;
if (strData != false){
bTrue = true;
}
else{
bTrue = false;
}
return bTrue;
}
function checkMail(InputData){
Mail = document.form1[InputData].value;
var mailRet = false;
	Filtro = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-]{2,})+\.)+([a-zA-Z0-9]{2,})+$/;
  	if (Filtro.test(Mail)){
	mailRet = true;}
return mailRet;}
function checkUserID(InputData){
user = document.form1[InputData].value;
var userRet = false;
user.test=/\w/;
if (user != false){
		if (user.length >= 6 && user.length <= 12 ){
		userRet = true;}
}
return userRet;}
function checkPwd(InputData,InputDataR){
var pwdRet = false;
password = document.form1[InputData].value;
passwordR = document.form1[InputDataR].value;
password.test=/\w/;
if (password == passwordR && password != false){
	if (password.length >= 6 && password.length <= 10 ){
	pwdRet = true;}
}
return pwdRet;}

function loginFnc(){
document.retVal = false;
strUser=document.form1.txtuserid.value;
strUser.test = /\w/;
strPassword=document.form1.txtpassword.value;
strPassword.test = /\w/;
if (strUser != false){
if (strPassword != false){
document.form1.HdnFnc.value = 2;
document.retVal = true;
}
else{
document.form1.txtpassword.focus();
}
}
else{
document.form1.txtuserid.focus();
}
}
function CheckQuiz(){
document.form1.BodyFnc.value = "1";
document.form1.submit();
}
function sendInfo(){
document.retVal = false;
one_check = 0;
if (document.form1.txtName.value == "" && one_check == 0){
first_check = "txtName";
one_check = 1;
}

if (document.form1.txtLastName.value == "" && one_check == 0){
first_check = "txtLastName";
one_check = 1;
}
if (document.form1.txtIndirizzo.value == "" && one_check == 0){
first_check = "txtIndirizzo";
one_check = 1;
}
if (document.form1.txtLocalita.value == "" && one_check == 0){
first_check = "txtLocalita";
one_check = 1;
}
if (document.form1.txtTelefono.value == "" && one_check == 0){
first_check = "txtTelefono";
one_check = 1;
}
if (checkMail("txtEmail") == false && one_check == 0){
first_check = "txtEmail";
one_check = 1;
}
if (document.form1.txtCap.value == "" && one_check == 0){
first_check = "txtCap";
one_check = 1;
}
if (document.form1.list_PROVINCIA.value == "" && one_check == 0){
first_check = "list_PROVINCIA";
one_check = 1;
}
if (document.form1.drop_tipologia_richiesta.value == "" && one_check == 0){
first_check = "drop_tipologia_richiesta";
one_check = 1;
}
if (document.form1.drop_tipologia_servizio.value == "" && one_check == 0){
first_check = "drop_tipologia_servizio";
one_check = 1;
}
if (document.form1.txMsg.value == "" && one_check == 0){
first_check = "txMsg";
one_check = 1;
}

if (one_check == 0){
document.form1.HdnFnc.value = 5;
document.retVal = true;
}
else{
	document.form1[first_check].focus();
}
}
