function updateAccount(){
document.retVal = false;
one_check = 0;

if (document.form1.txtCOGNOME.value == "" && one_check == 0){
first_check = "txtCOGNOME";
one_check = 1;
}

if (document.form1.txtINDIRIZZO.value == "" && one_check == 0){
first_check = "txtINDIRIZZO";
one_check = 1;
}

if (document.form1.txtCAP.value == "" && one_check == 0){
first_check = "txtCAP";
one_check = 1;
}

if (document.form1.txtCITTA.value == "" && one_check == 0){
first_check = "txtCITTA";
one_check = 1;
}

if (document.form1.txtTELEFONO1.value == "" && one_check == 0){
first_check = "txtTELEFONO1";
one_check = 1;
}

if (checkMail("txtEMAIL") == false && one_check == 0){
first_check = "txtEMAIL";
one_check = 1;
}

if (document.form1.txtEMAIL.value == "" && one_check == 0 || document.form1.txtEMAIL.value != document.form1.txtREMAIL.value && one_check == 0){
first_check = "txtREMAIL";
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 = 14;
document.retVal = true;
}
else{
	document.form1[first_check].focus();
}
}


function sendpassword() {
one_check = 0;

if (document.form1.txtLastName.value == "" && one_check == 0){
first_check = "txtLastName";
one_check = 1;
}

if (checkMail("txtEmail") == false && one_check == 0){
first_check = "txtEmail";
one_check = 1;
}

if (one_check == 0){
document.form1.HdnFnc.value = 11;
document.form1.submit();
}
else{
	document.form1[first_check].focus();
}
}

function sendmail(){
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 (checkMail("txtEmail") == false && one_check == 0){
first_check = "txtEmail";
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 = 4;
document.form1.submit();
}
else{
	if (first_check != "accetta[0]"){
	document.form1[first_check].focus();
	}
}
}

function chekNewAccount(){
document.retVal = false;
one_check = 0;

if (document.form1.txtCOGNOME.value == "" && one_check == 0){
first_check = "txtCOGNOME";
one_check = 1;
}

if (document.form1.txtINDIRIZZO.value == "" && one_check == 0){
first_check = "txtINDIRIZZO";
one_check = 1;
}

if (document.form1.txtCAP.value == "" && one_check == 0){
first_check = "txtCAP";
one_check = 1;
}

if (document.form1.txtCITTA.value == "" && one_check == 0){
first_check = "txtCITTA";
one_check = 1;
}

if (document.form1.txtTELEFONO1.value == "" && one_check == 0){
first_check = "txtTELEFONO1";
one_check = 1;
}

if (checkMail("txtEMAIL") == false && one_check == 0){
first_check = "txtEMAIL";
one_check = 1;
}

if (document.form1.txtEMAIL.value == "" && one_check == 0 || document.form1.txtEMAIL.value != document.form1.txtREMAIL.value && one_check == 0){
first_check = "txtREMAIL";
one_check = 1;
}

if (checkPwd("txtPASSWORD","txtRPassword") == false && one_check == 0){
first_check = "txtPASSWORD";
one_check = 1;
}

if (document.form1.accetta[0].checked == false && one_check == 0){
first_check = "accetta[0]";
one_check = 1;
}

if (one_check == 0){
document.form1.HdnFnc.value = 1
document.retVal = true;
}
else{
	if (first_check != "accetta[0]"){
	document.form1[first_check].focus();
	}
}
}

function logon(){
one_check = 0;

if (checkMail("txt_logemail") == false && one_check == 0){
first_check = "txt_logemail";
one_check = 1;
}

if (document.form1.txt_logpassword.value == "" && one_check == 0){
first_check = "txt_logpassword";
one_check = 1;
}

if (one_check == 0){
document.form1.HdnFnc.value = 9;
document.form1.submit();
}
else{
document.form1[first_check].focus();
}
}

function LogBasket(){
one_check = 0;

if (document.form1.txt_log_email.value == "" && one_check == 0){
first_check = "txt_log_email";
one_check = 1;
}

if (document.form1.txt_log_password.value == "" && one_check == 0){
first_check = "txt_log_password";
one_check = 1;
}

if (one_check == 0){
document.form1.HdnFnc.value = 7;
document.form1.submit();
}
else{
document.form1[first_check].focus();
}
}

function logout(){
document.form1.HdnFnc.value = 8;
document.form1.submit();
}

function NewsLetter(){
if (checkMail('txt_newsletter_email') == true){
document.form1.HdnFnc.value = 3;
document.form1.submit();
}
else{
document.form1.txt_newsletter_email.style.color="#FFFFFF";
document.form1.txt_newsletter_email.style.background="#BE004A";
document.form1.txt_newsletter_email.focus();
}
}

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 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 keyControl(){
	if( (event.keyCode < 48) || (event.keyCode > 57 ) ){
		event.keyCode = "".charCodeAt(0);
	}
}

function resetForm(){
document.form1.txtPickUp.value="";
document.form1.txtReturn.value="";
document.form1.txtDestination.value="";
document.form1.txtPickUpTime.value="";
document.form1.txtReturnDate.value="";
document.form1.txtReturnTime.value="";
document.form1.txtPersons.value="";
document.form1.AnyRequest.value="";
}

function checkForm(){
document.retVal = false;
one_check = 0;

if (document.form1.dropDown_Services.value == "" && one_check == 0){
first_check = "dropDown_Services";
one_check = 1;
}

if (document.form1.dropDown_Cars.value == "" && one_check == 0){
first_check = "dropDown_Cars";
one_check = 1;
}

if (document.form1.txtPickUp.value == "" && one_check == 0){
first_check = "txtPickUp";
one_check = 1;
}

if (document.form1.dropDown_Day.value == "DD1" && one_check == 0){
first_check = "dropDown_Day";
one_check = 1;
}

if (document.form1.dropDown_Month.value == "00" && one_check == 0){
first_check = "dropDown_Month";
one_check = 1;
}

if (document.form1.dropDown_Year.value == "Year1" && one_check == 0){
first_check = "dropDown_Year";
one_check = 1;
}

if (document.form1.txtPickUpTime.value == "" && one_check == 0){
first_check = "txtPickUpTime";
one_check = 1;
}

if (document.form1.txtPersons.value == "" && one_check == 0){
first_check = "txtPersons";
one_check = 1;
}

if (document.form1.txtLuggage.value == "" && one_check == 0){
first_check = "txtLuggage";
one_check = 1;
}

if (document.form1.DropDownCard.value == "" && one_check == 0){
first_check = "DropDownCard";
one_check = 1;
}

if (document.form1.txtOwner.value == "" && one_check == 0){
first_check = "txtOwner";
one_check = 1;
}

if (document.form1.txtOwnerAddress.value == "" && one_check == 0){
first_check = "txtOwnerAddress";
one_check = 1;
}

if (document.form1.txtCity1.value == "" && one_check == 0){
first_check = "txtCity1";
one_check = 1;
}

if (document.form1.txtProvince1.value == "" && one_check == 0){
first_check = "txtProvince1";
one_check = 1;
}

if (document.form1.txtCardNumber.value == "" && one_check == 0){
first_check = "txtCardNumber";
one_check = 1;
}

if (document.form1.txtExpirationDate.value == "" && one_check == 0){
first_check = "txtExpirationDate";
one_check = 1;
}

if (one_check == 0){
document.form1.HdnFnc.value = 3;
document.retVal = true;
}
else{
document.form1[first_check].focus();
}
}
function openUploadPage()
{
width = (screen.width - 400)/2;
height = (screen.height - 260)/2;
win = window.open('upload_guestbook.asp','popup','width=400,height=260,toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=no,copyhistory=no,resizable=no,screenX='+width+',screenY='+height+',top='+height+',left='+width+'');
win.focus();
}
function ClearMsgFnc(){
document.form1.txtGuestBook.value = "";
document.form1.txtGuestBook.focus();
}
function SaveMsgFnc(){
strMsg = document.form1.txtGuestBook.value;
strMsg.test = /\w/;
strNickname = document.form1.txt_nick.value;
strNickname.test = /\w/;
if (strNickname != false || strNickname != ""){
if (strMsg != false || strMsg != ""){
document.form1.HdnFnc.value = 113;
document.form1.submit();
}
else{
alert('Attention.\nText has required.\nThanks.');
document.form1.txtGuestBook.focus();
}
}
else{
alert('Attention.\nNick has required.\nThanks.');
document.form1.txt_nick.focus();
}
}
