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 clearPrevFnc(){
parent.location.href = "preventivo.asp?ID=127384017030";
}
function sendFnc(){
strMail = document.form1.txtEmail.value;
strMail.test = /\w/;
strText = document.form1.AreaEmailText.value;
strText.test = /\w/;
strSubject = document.form1.DropDownSubject.value;
if (strMail != false){
if (checkMail('txtEmail') == true){
if (strSubject != ""){
if (strText != false){
document.form1.BodyFnc.value = 1;
document.form1.submit();
}
else{
document.form1.AreaEmailText.focus();
}
}
else{
document.form1.DropDownSubject.focus();
}
}
else{
document.form1.txtEmail.focus();
}
}
else{
document.form1.txtEmail.focus();
}
}

function sendPrevFnc(){
strNome = document.form1.txtNome.value;
strCognome = document.form1.txtCognome.value;
strAzienda = document.form1.txtAzienda.value;
strRuolo = document.form1.txtRuolo.value;
strOggetto = document.form1.txtOggetto.value;
strTelefono = document.form1.txtTelefono.value;
strMail = document.form1.txtEmail.value;
strMail.test = /\w/;
strText = document.form1.AreaEmailText.value;
strText.test = /\w/;
if (strNome != ''){
if (strCognome != '') {
if (strAzienda != '') {
if (strOggetto != '') {
if (strMail != false){
if (checkMail('txtEmail') == true){
if (strText != ''){
document.form1.BodyFnc.value = 1;
document.form1.submit();
}
else{
document.form1.txtNome.focus();
}
}
else{
document.form1.txtCognome.focus();
}
}
else{
document.form1.txtAzienda.focus();
}
}
else{
document.form1.txtOggetto.focus();
}
}
else{
document.form1.AreaEmailText.focus();
}
}
else{
document.form1.txtEmail.focus();
}
}
else{
document.form1.txtEmail.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){
alert("Attenzione.\nLa password non corrisponde, controllare la loro esattezza.\nGrazie.");
first_check = "txtPassword";
one_check = 1;
}

if (one_check == 0){
document.form1.BodyFnc.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;}
