function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_displayStatusMsg(msgStr) { //v1.0
  status=msgStr;
  document.MM_returnValue = true;
}
function OpenWin() {
	x = (screen.width-650)/2;
	y = (screen.height-500)/2;
	popupWin = window.open('../NotesPayment.asp','JimbaranHills','width=650,height=500,left='+x+',top='+y+'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=0');
	popupWin.focus();
}
var aCh="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
var dCh="0123456789-";
var sCh="ÀÂÃÄÅÆÇÈÉÊËÌÍÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿŠŒŽšœžŸ'_`~()^&*+-|=<>,./\{}[] ";
var asCh=aCh + dCh + "!\"#$%&'()*+,-./:;<=>?@[\]^_`{}~";

function isAlphaNum(S) {
	var AlphaNum=aCh + dCh;
	for (var i=0; i < S.length; i++) {
		if (AlphaNum.indexOf(S.charAt(i)) == -1)
			return false;
	}
	return true;
}

function isASCII(S) {
	for (var i=0; i < S.length; i++) {
		if (asCh.indexOf(S.charAt(i)) == -1)
			return false;
	}
	return true;
}

function isName(S) {
	var cName=aCh + dCh + sCh;
	for (var i=0; i < S.length; i++) {
		if (cName.indexOf(S.charAt(i)) == -1)
			return false;
	}
	return true;
}

function isEmail(S) {
	var pass=0;
	if (window.RegExp) {
		var tempS="a";
		var tempReg=new RegExp(tempS);
		if (tempReg.test(tempS)) pass=1;
	}
	if (!pass)
		return (S.indexOf(".") > 2) && (S.indexOf("@") > 0);

	var r1=new RegExp("(@.*@)|(\\.\\.)|(@\\.)|(^\\.)");
	var r2=new RegExp("^[a-zA-Z0-9\\.\\!\\#\\$\\%\\&\\'\\*\\+\\-\\/\\=\\?\\^\\_\\`\\{\\}\\~]*[a-zA-Z0-9\\!\\#\\$\\%\\&\\'\\*\\+\\-\\/\\=\\?\\^\\_\\`\\{\\}\\~]\\@(\\[?)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,3}|[0-9]{1,3})(\\]?)$");
	return (!r1.test(S) && r2.test(S));
}
//booking form 
  function EntryForm_Validator(theForm){
	// Check Name
	cNameError = "";
	if (document.EntryForm.name.value.length <1) { 
		cNameError = "Name is empty.\n"; 
	}


	// Check the Email
	cEmailError = "";
	if (document.EntryForm.email.value.length <1) { 
		cEmailError = "Email is empty.\n";
	}	
	else { 
		if(!isEmail(document.EntryForm.email.value)) {
			cEmailError = "Email address is invalid.\ne.g. : (email@domainname.com).\n";
		}
	}
	
	// Check Address
	cAddressError = "";
	if (document.EntryForm.address.value.length <1) { 
		cAddressError = "Address is empty.\n"; 
	}

	// Check the Arrival Date
	cArrivalDateError = "";
	if (document.EntryForm.arrivaldate.value.length<1) { 
		cArrivalDateError = "Arrival Date should not be empty.\n";
	}
	
	// Check the Number of Weeks
	cNumberofWeeksError = "";
	if (document.EntryForm.numberofweeks.value.length<1) { 
		cNumberofWeeksError = "Number of Weeks should not be empty.\n";
	} else {
		if (isNaN(document.EntryForm.numberofweeks.value)) { 
			cNumberofWeeksError = "Number of Weeks should be numeric.\n";
		} else {
			if (document.EntryForm.numberofweeks.value<0) { 
				cNumberofWeeksError = "Number of Weeks should not be negative.\n";
			}
		}
	}




	// Check the Deduct US$
	cDeductError = "";
	if (document.EntryForm.deduct.value.length<1) { 
		cDeductError = "Deduct US$ should not be empty.\n";
	} else {
		if (isNaN(document.EntryForm.deduct.value)) { 
			cDeductError = "Deduct US$ should be numeric.\n";
		} else {
			if (document.EntryForm.deduct.value<0) { 
				cDeductError = "Deduct US$ should not be negative.\n";
			}
		}
	}


	// Check the Card Number 1
	cCardNo1Error = "";
	if (document.EntryForm.cardNo1.value.length<1) { 
		cCardNo1Error = "Card Number 1 should not be empty.\n";
	} else {
		if (isNaN(document.EntryForm.cardNo1.value)) { 
			cCardNo1Error = "Card Number 1 should be numeric.\n";
		} else {
			if (document.EntryForm.cardNo1.value<0) { 
				cCardNo1Error = "Card Number 1 should not be negative.\n";
				} else {
					if (document.EntryForm.cardNo1.value.length<4) { 
						cCardNo1Error = "Card Number 1 should be 4 digit.\n";
					}

			}
		}
	}
	
	// Check the Card Number 2
	cCardNo2Error = "";
	if (document.EntryForm.cardNo2.value.length<1) { 
		cCardNo2Error = "Card Number 2 should not be empty.\n";
	} else {
		if (isNaN(document.EntryForm.cardNo2.value)) { 
			cCardNo2Error = "Card Number 2 should be numeric.\n";
		} else {
			if (document.EntryForm.cardNo2.value<0) { 
				cCardNo2Error = "Card Number 2 should not be negative.\n";
				} else {
					if (document.EntryForm.cardNo2.value.length<4) { 
						cCardNo2Error = "Card Number 2 should be 4 digit.\n";
					}

			}
		}
	}


	// Check the Card Number 3
	cCardNo3Error = "";
	if (document.EntryForm.cardNo3.value.length<1) { 
		cCardNo3Error = "Card Number 3 should not be empty.\n";
	} else {
		if (isNaN(document.EntryForm.cardNo3.value)) { 
			cCardNo3Error = "Card Number 3 should be numeric.\n";
		} else {
			if (document.EntryForm.cardNo3.value<0) { 
				cCardNo3Error = "Card Number 3 should not be negative.\n";
				} else {
					if (document.EntryForm.cardNo3.value.length<4) { 
						cCardNo3Error = "Card Number 3 should be 4 digit.\n";
					}

			}
		}
	}


	// Check the Card Number 4
	cCardNo4Error = "";
	if (document.EntryForm.cardNo4.value.length<1) { 
		cCardNo4Error = "Card Number 4 should not be empty.\n";
	} else {
		if (isNaN(document.EntryForm.cardNo4.value)) { 
			cCardNo4Error = "Card Number 4 should be numeric.\n";
		} else {
			if (document.EntryForm.cardNo4.value<0) { 
				cCardNo4Error = "Card Number 4 should not be negative.\n";
				} else {
					if (document.EntryForm.cardNo4.value.length<4) { 
						cCardNo4Error = "Card Number 4 should be 4 digit.\n";
					}

			}
		}
	}

	
		// Check Card Holder Name
	cCardHolderError = "";
	if (document.EntryForm.cardholder.value.length <1) { 
		cCardHolderError = "Card Holder Name is empty.\n"; 
	} else {
		if (!isName(document.EntryForm.cardholder.value)){
			cCardHolderError = "Card Holder Name is invalid. Please use 0-9, A-Z, "+sCh+"\n";
		}
	}
	
	// Check the Credit Card Type 
	cCardTypeError = "";
	if (document.EntryForm.cardtype.value=="-") { 
		cCardTypeError = "Credit Card Type is not selected.\n";
	}
	
	
	// Check the Credit Card Expiration Month 
	cExpiryMonthError = "";
	if (document.EntryForm.expirymonth.value=="-") { 
		cExpiryMonthError = "Credit Card Expiration Month is not selected.\n";
	}
	
	// Check the Credit Card Expiration Year 
	cExpiryYearError = "";
	if (document.EntryForm.expiryyear.value=="-") { 
		cExpiryYearError = "Credit Card Expiration Year is not selected.\n";
	}
	
	
	cError = cNameError + cEmailError + cAddressError + cArrivalDateError + cNumberofWeeksError + cDeductError + cCardNo1Error + cCardNo2Error + cCardNo3Error + cCardNo4Error + cCardHolderError + cCardTypeError + cExpiryMonthError + cExpiryYearError;


	if (cError.length>0) { 
		alert("Sorry, but you haven\'t filled out all fields required correctly.\n"+cError); 
		if (cNameError.length>0) { document.EntryForm.name.focus(); } else {
		if (cEmailError.length>0) { document.EntryForm.email.focus(); } else {
		if (cAddressError.length>0) { document.EntryForm.address.focus(); } else {
		if (cArrivalDateError.length>0) { document.EntryForm.arrivaldate.focus(); } else {
		if (cNumberofWeeksError.length>0) { document.EntryForm.numberofweeks.focus(); } else {
		if (cDeductError.length>0) { document.EntryForm.deduct.focus(); } else {
		if (cCardNo1Error.length>0) { document.EntryForm.cardNo1.focus(); } else {
		if (cCardNo2Error.length>0) { document.EntryForm.cardNo2.focus(); } else {
		if (cCardNo3Error.length>0) { document.EntryForm.cardNo3.focus(); } else {
		if (cCardNo4Error.length>0) { document.EntryForm.cardNo4.focus(); } else {
		if (cCardHolderError.length>0) { document.EntryForm.cardholder.focus(); } else {
		if (cCardTypeError.length>0) { document.EntryForm.cardtype.focus(); } else {
		if (cExpiryMonthError.length>0) { document.EntryForm.expirymonth.focus(); } else {
		if (cExpiryYearError.length>0) { document.EntryForm.expiryyear.focus(); } } } } } } } } } } } } } } 
		return false; 
		}
}	


//memberhip form checking
function Form2_Validator(form2){
	// Check Membership Number
	cMembershipError = "";
	if (document.form2.membership.value.length <1) { 
		cMembershipError = "Membership Number is empty.\n"; 
	}


	// Check Name
	cNameError = "";
	if (document.form2.name.value.length <1) { 
		cNameError = "Family Name is empty.\n"; 
	}


	// Check the Email
	cEmailError = "";
	if (document.form2.email.value.length <1) { 
		cEmailError = "Your Email address is empty.\n";
	}	
	else { 
		dmn = document.form2.email.value.substr(document.form2.email.value.indexOf("@")+1,document.form2.email.value.length);
		if((document.form2.email.value.indexOf("@")<1) ||(dmn.indexOf("@")>-1) || (dmn.indexOf(".")<1) || (dmn.indexOf(".")>dmn.length-2)) {
			cEmailError = "Your email address is invalid.\ne.g. : (email@domainname.com).\n";
		}
	}
	

	// Check the Current Apt Type
	cCurrentAptError = "";
	if (document.form2.current_apt.value=="-") { 
		cCurrentAptError = "Current Apt Type is not selected.\n";
	}

	// Check the Upgrade Apt Type
	cUpgradeAptError = "";
	if (document.form2.upgrade_apt.value=="-") { 
		cUpgradeAptError = "Upgrade Apt Type is not selected.\n";
	}

	// Check the Apartment Size
	cApartmentSizeError = "";
	if (document.form2.apartmentsize.value=="-") { 
		cApartmentSizeError = "Apartment Size is not selected.\n";
	}
	
	// Check the Card Number
	cCardNoError = "";
	if (document.form2.cardno.value.length<1) { 
		cCardNoError = "Card Number should not be empty.\n";
	} else {
		if (isNaN(document.form2.cardno.value)) { 
			cCardNoError = "Card Number should be numeric.\n";
		} else {
			if (document.form2.cardno.value<0) { 
				cCardNoError = "Card Number should not be negative.\n";
			}
		}
	}



	// Check the Credit Card
	cCcError = "";
	if (document.form2.cc.value=="-") { 
		cCcError = "Credit Card is not selected.\n";
	}


	// Check the Credit Card expiration Month
	cMonthError = "";
	if (document.form2.month.value=="-") { 
		cMonthError = "Credit Card Expiration Month is not selected.\n";
	}
	
	// Check the Credit Card Expiration Year 
	cYearError = "";
	if (document.form2.year.value=="-") { 
		cYearError = "Credit Card Expiration Year is not selected.\n";
	}
	
	// Check Card Holder Name
	cCardNameError = "";
	if (document.form2.cardname.value.length <1) { 
		cCardNameError = "Card Holder Name is empty.\n"; 
	}	
		
	cError = cMembershipError + cNameError + cEmailError + cCurrentAptError + cUpgradeAptError  +  cApartmentSizeError + cCardNoError + cCcError + cMonthError + cYearError + cCardNameError;


	if (cError.length>0) { 
		alert("Sorry, but you haven\'t filled out all fields required correctly.\n"+cError); 
		if (cMembershipError.length>0) { document.form2.membership.focus(); } else {
		if (cNameError.length>0) { document.form2.name.focus(); } else {
		if (cEmailError.length>0) { document.form2.email.focus(); } else {
		if (cCurrentAptError.length>0) { document.form2.current_apt.focus(); } else {
		if (cUpgradeAptError.length>0) { document.form2.upgrade_apt.focus(); } else {	
		if (cApartmentSizeError.length>0) { document.form2.apartmentsize.focus(); } else {
		if (cCardNoError.length>0) { document.form2.cardno.focus(); } else {
		if (cCcError.length>0) { document.form2.cc.focus(); } else {
		if (cMonthError.length>0) { document.form2.month.focus(); } else {
		if (cYearError.length>0) { document.form2.year.focus(); } else {
		if (cCardNameError.length>0) { document.form2.cardname.focus(); } } } } } } } } } } }  
		return false; 
		}
}



function checkForm2() {

	// Check Real Name
	cNameError = "";
	if (document.mf.name.value.length <1) { cNameError = "Your Name is empty.\n"; }
	
	// Check the Email
	cEmailError = "";
	if (document.mf.email.value.length <1) { 
		cEmailError = "Your Email address is empty.\n";
	}	
	else { 
		dmn = document.mf.email.value.substr(document.mf.email.value.indexOf("@")+1,document.mf.email.value.length);
		if((document.mf.email.value.indexOf("@")<1) ||(dmn.indexOf("@")>-1) || (dmn.indexOf(".")<1) || (dmn.indexOf(".")>dmn.length-2)) {
			cEmailError = "Your email address is invalid.\ne.g. : (email@domainname.com).\n";
		}  else {
			if (document.mf.emailconfirmation.value!=document.mf.email.value)
				cEmailError = "Your Email and Confirmation email is different.\n";
		}
	}
	
	// Check Comment
	cCommentError = "";
	if (document.mf.comment.value.length <1) { cCommentError = "Your Comment is empty.\n"; }
	
	cError =  cNameError + cEmailError + cCommentError;
	
	if (cError.length>0) { 
		alert("Sorry, but you haven\'t filled out all fields required.\n"+cError); 
		if (cNameError.length>0) { document.mf.name.focus(); } else {
		if (cEmailError.length>0) { document.mf.email.focus(); } else {
		if (cCommentError.length>0) { document.mf.comment.focus(); } } } 
		return false; 
	}
	
	document.mf.submit();
}
function checkForm3() {
	if (document.form1.membership.value.length <1) { alert("Sorry, but you haven\'t filled out all fields required.\nPlease enter your membership number."); document.form1.membership.focus(); return false; }
	if (document.form1.realname.value.length <1) { alert("Sorry, but you haven\'t filled out all fields required.\nPlease enter your name."); document.form1.realname.focus(); return false; }
	if (document.form1.email.value.length <1) { 
		alert("Sorry, but you haven\'t filled out all fields required.\nPlease enter your email address."); document.form1.email.focus(); return false; 
	}	
	else { 
		dmn = document.form1.email.value.substr(document.form1.email.value.indexOf("@")+1,document.form1.email.value.length);
		if((document.form1.email.value.indexOf("@")<1) ||(dmn.indexOf("@")>-1) || (dmn.indexOf(".")<1) || (dmn.indexOf(".")>dmn.length-2)) {
			alert("Please type a valid email address.\nEx : (email@domainname.com)."); document.form1.email.focus(); return false; 
		} else {
			if (document.form1.emailconfirmation.value!=document.form1.email.value) { alert("Your Email and Confirmation email is different"); document.form1.email.focus(); return false; }
		}
	}
	document.form1.submit();
}
function checkForm4() {
	if (document.form1.membership.value.length <1) { alert("Sorry, but you haven\'t filled out all fields required.\nPlease enter your membership number."); document.form1.membership.focus(); return false; }
	if (document.form1.realname.value.length <1) { alert("Sorry, but you haven\'t filled out all fields required.\nPlease enter your name."); document.form1.realname.focus(); return false; }
	if (document.form1.email.value.length <1) { 
		alert("Sorry, but you haven\'t filled out all fields required.\nPlease enter your email address."); document.form1.email.focus(); return false; 
	}	
	else { 
		dmn = document.form1.email.value.substr(document.form1.email.value.indexOf("@")+1,document.form1.email.value.length);
		if((document.form1.email.value.indexOf("@")<1) ||(dmn.indexOf("@")>-1) || (dmn.indexOf(".")<1) || (dmn.indexOf(".")>dmn.length-2)) {
			alert("Please type a valid email address.\nEx : (email@domainname.com)."); document.form1.email.focus(); return false; 
		} else {
			if (document.form1.emailconfirmation.value!=document.form1.email.value) { alert("Your Email and Confirmation email is different"); document.form1.email.focus(); return false; }
		}
	}
	document.form1.submit();
}
function checkForm5() {
	if (document.form1.membership.value.length <1) { alert("Sorry, but you haven\'t filled out all fields required.\nPlease enter your membership number."); document.form1.membership.focus(); return false; }
	if (document.form1.realname.value.length <1) { alert("Sorry, but you haven\'t filled out all fields required.\nPlease enter your name."); document.form1.realname.focus(); return false; }
	if (document.form1.email.value.length <1) { 
		alert("Sorry, but you haven\'t filled out all fields required.\nPlease enter your email address."); document.form1.email.focus(); return false; 
	}	
	else { 
		dmn = document.form1.email.value.substr(document.form1.email.value.indexOf("@")+1,document.form1.email.value.length);
		if((document.form1.email.value.indexOf("@")<1) ||(dmn.indexOf("@")>-1) || (dmn.indexOf(".")<1) || (dmn.indexOf(".")>dmn.length-2)) {
			alert("Please type a valid email address.\nEx : (email@domainname.com)."); document.form1.email.focus(); return false; 
		} else {
			if (document.form1.emailconfirmation.value!=document.form1.email.value) { alert("Your Email and Confirmation email is different"); document.form1.email.focus(); return false; }
		}
	}
	document.form1.submit();
}

var win=null;
function OpenWindow(mypage,myname,w,h,scroll,pos){
if(pos=="random"){LeftPosition=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;TopPosition=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;}
if(pos=="center"){LeftPosition=(screen.width)?(screen.width-w)/2:100;TopPosition=(screen.height)?(screen.height-h)/2:100;}
else if((pos!="center" && pos!="random") || pos==null){LeftPosition=0;TopPosition=20}
settings='width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no';
win=window.open(mypage,myname,settings);
win.focus()
}

//Resort Payment form checking
function checkResortPayment() {
	
	// Check Membership Number
	cMembershipError = "";
	if (document.form1.membership.value.length <1) { 
		cMembershipError = "Membership Number is empty.\n"; 
	} else {
		if (!isName(document.form1.membership.value)){
			cMembershipError = "Membership Number is invalid. Please use 0-9, A-Z, "+sCh+"\n";
		}
	}
	
	

	// Check Name
	cNameError = "";
	if (document.form1.name.value.length <1) { 
		cNameError = "Name is empty.\n"; 
	} else {
		if (!isName(document.form1.name.value)){
			cNameError = "Name is invalid. Please use 0-9, A-Z, "+sCh+"\n";
		}
	}


	// Check the Email
	cEmailError = "";
	if (document.form1.email.value.length <1) { 
		cEmailError = "Your Email address is empty.\n";
	}	
	else { 
		dmn = document.form1.email.value.substr(document.form1.email.value.indexOf("@")+1,document.form1.email.value.length);
		if((document.form1.email.value.indexOf("@")<1) ||(dmn.indexOf("@")>-1) || (dmn.indexOf(".")<1) || (dmn.indexOf(".")>dmn.length-2)) {
			cEmailError = "Your email address is invalid.\ne.g. : (email@domainname.com).\n";
		} else {
				if (document.form1.emailconfirmation.value!=document.form1.email.value)
						cEmailError = "Your Email and Confirmation email is different.\n";
		}	
	}
	
	
	
	// Check the Card Number 1
	cCardNo1Error = "";
	if (document.form1.cardNo1.value.length<1) { 
		cCardNo1Error = "Card Number 1 should not be empty.\n";
	} else {
		if (isNaN(document.form1.cardNo1.value)) { 
			cCardNo1Error = "Card Number 1 should be numeric.\n";
		} else {
			if (document.form1.cardNo1.value<0) { 
				cCardNo1Error = "Card Number 1 should not be negative.\n";
				} else {
					if (document.form1.cardNo1.value.length<4) { 
						cCardNo1Error = "Card Number 1 should be 4 digit.\n";
					}

			}
		}
	}
	
	// Check the Card Number 2
	cCardNo2Error = "";
	if (document.form1.cardNo2.value.length<1) { 
		cCardNo2Error = "Card Number 2 should not be empty.\n";
	} else {
		if (isNaN(document.form1.cardNo2.value)) { 
			cCardNo2Error = "Card Number 2 should be numeric.\n";
		} else {
			if (document.form1.cardNo2.value<0) { 
				cCardNo2Error = "Card Number 2 should not be negative.\n";
				} else {
					if (document.form1.cardNo2.value.length<4) { 
						cCardNo2Error = "Card Number 2 should be 4 digit.\n";
					}

			}
		}
	}


	// Check the Card Number 3
	cCardNo3Error = "";
	if (document.form1.cardNo3.value.length<1) { 
		cCardNo3Error = "Card Number 3 should not be empty.\n";
	} else {
		if (isNaN(document.form1.cardNo3.value)) { 
			cCardNo3Error = "Card Number 3 should be numeric.\n";
		} else {
			if (document.form1.cardNo3.value<0) { 
				cCardNo3Error = "Card Number 3 should not be negative.\n";
				} else {
					if (document.form1.cardNo3.value.length<4) { 
						cCardNo3Error = "Card Number 3 should be 4 digit.\n";
					}

			}
		}
	}


	// Check the Card Number 4
	cCardNo4Error = "";
	if (document.form1.cardNo4.value.length<1) { 
		cCardNo4Error = "Card Number 4 should not be empty.\n";
	} else {
		if (isNaN(document.form1.cardNo4.value)) { 
			cCardNo4Error = "Card Number 4 should be numeric.\n";
		} else {
			if (document.form1.cardNo4.value<0) { 
				cCardNo4Error = "Card Number 4 should not be negative.\n";
				} else {
					if (document.form1.cardNo4.value.length<4) { 
						cCardNo4Error = "Card Number 4 should be 4 digit.\n";
					}

			}
		}
	}


	// Check the Credit Card expiration Month
	cMonthError = "";
	if (document.form1.month.value=="1") { 
		cMonthError = "Credit Card Expiration Month is not selected.\n";
	}
	
	// Check the Credit Card Expiration Year 
	cYearError = "";
	if (document.form1.year.value=="1") { 
		cYearError = "Credit Card Expiration Year is not selected.\n";
	}
	
	// Check Card Number
	cCardNameerror = "";
	if (document.form1.cardName.value.length <1) { 
		cCardNameerror = "Credit Card Name is empty.\n"; 
	}
	

	// Check Payment for
	cPaymentForerror = "";
	if (document.form1.paymentfor.value.length <1) { 
		cPaymentForerror = "Payment for is empty.\n"; 
	}

	cError = cMembershipError + cNameError + cEmailError + cCardNo1Error + cCardNo2Error + cCardNo3Error + cCardNo4Error + cMonthError + cYearError + cCardNameerror + cPaymentForerror ;

	if (cError.length>0) { 
		alert("Sorry, but you haven\'t filled out all fields required correctly.\n"+cError); 
		if (cMembershipError.length>0) { document.form1.membership.focus(); } else {
		if (cNameError.length>0) { document.form1.name.focus(); } else {
		if (cEmailError.length>0) { document.form1.email.focus(); } else {
		if (cCardNo1Error.length>0) { document.form1.cardNo1.focus(); } else {
		if (cCardNo2Error.length>0) { document.form1.cardNo2.focus(); } else {
		if (cCardNo3Error.length>0) { document.form1.cardNo3.focus(); } else {
		if (cCardNo4Error.length>0) { document.form1.cardNo4.focus(); } else {
		if (cMonthError.length>0) { document.form1.month.focus();  } else {
		if (cYearError.length>0) { document.form1.year.focus(); } else {
		if (cCardNameerror.length>0) { document.form1.cardName.focus(); } else {
		if (cPaymentForerror.length>0) { document.form1.paymentfor.focus(); } } } } } } } } } } }
		return false; 
	}
	document.form1.submit();
}

//Resort Payment form checking
function checkMiscellaniousPayment() {
	
	// Check Membership Number
	cMembershipError = "";
	if (document.form1.membership.value.length <1) { 
		cMembershipError = "Membership Number is empty.\n"; 
	} else {
		if (!isName(document.form1.membership.value)){
			cMembershipError = "Membership Number is invalid. Please use 0-9, A-Z, "+sCh+"\n";
		}
	}
	
	

	// Check Name
	cNameError = "";
	if (document.form1.name.value.length <1) { 
		cNameError = "Name is empty.\n"; 
	} else {
		if (!isName(document.form1.name.value)){
			cNameError = "Name is invalid. Please use 0-9, A-Z, "+sCh+"\n";
		}
	}


	// Check the Email
	cEmailError = "";
	if (document.form1.email.value.length <1) { 
		cEmailError = "Your Email address is empty.\n";
	}	
	else { 
		dmn = document.form1.email.value.substr(document.form1.email.value.indexOf("@")+1,document.form1.email.value.length);
		if((document.form1.email.value.indexOf("@")<1) ||(dmn.indexOf("@")>-1) || (dmn.indexOf(".")<1) || (dmn.indexOf(".")>dmn.length-2)) {
			cEmailError = "Your email address is invalid.\ne.g. : (email@domainname.com).\n";
		} else {
				if (document.form1.emailconfirmation.value!=document.form1.email.value)
						cEmailError = "Your Email and Confirmation email is different.\n";
		}	}
	
	// Check the Card Number 1
	cCardNo1Error = "";
	if (document.form1.cardNo1.value.length<1) { 
		cCardNo1Error = "Card Number 1 should not be empty.\n";
	} else {
		if (isNaN(document.form1.cardNo1.value)) { 
			cCardNo1Error = "Card Number 1 should be numeric.\n";
		} else {
			if (document.form1.cardNo1.value<0) { 
				cCardNo1Error = "Card Number 1 should not be negative.\n";
				} else {
					if (document.form1.cardNo1.value.length<4) { 
						cCardNo1Error = "Card Number 1 should be 4 digit.\n";
					}

			}
		}
	}
	
	// Check the Card Number 2
	cCardNo2Error = "";
	if (document.form1.cardNo2.value.length<1) { 
		cCardNo2Error = "Card Number 2 should not be empty.\n";
	} else {
		if (isNaN(document.form1.cardNo2.value)) { 
			cCardNo2Error = "Card Number 2 should be numeric.\n";
		} else {
			if (document.form1.cardNo2.value<0) { 
				cCardNo2Error = "Card Number 2 should not be negative.\n";
				} else {
					if (document.form1.cardNo2.value.length<4) { 
						cCardNo2Error = "Card Number 2 should be 4 digit.\n";
					}

			}
		}
	}


	// Check the Card Number 3
	cCardNo3Error = "";
	if (document.form1.cardNo3.value.length<1) { 
		cCardNo3Error = "Card Number 3 should not be empty.\n";
	} else {
		if (isNaN(document.form1.cardNo3.value)) { 
			cCardNo3Error = "Card Number 3 should be numeric.\n";
		} else {
			if (document.form1.cardNo3.value<0) { 
				cCardNo3Error = "Card Number 3 should not be negative.\n";
				} else {
					if (document.form1.cardNo3.value.length<4) { 
						cCardNo3Error = "Card Number 3 should be 4 digit.\n";
					}

			}
		}
	}


	// Check the Card Number 4
	cCardNo4Error = "";
	if (document.form1.cardNo4.value.length<1) { 
		cCardNo4Error = "Card Number 4 should not be empty.\n";
	} else {
		if (isNaN(document.form1.cardNo4.value)) { 
			cCardNo4Error = "Card Number 4 should be numeric.\n";
		} else {
			if (document.form1.cardNo4.value<0) { 
				cCardNo4Error = "Card Number 4 should not be negative.\n";
				} else {
					if (document.form1.cardNo4.value.length<4) { 
						cCardNo4Error = "Card Number 4 should be 4 digit.\n";
					}

			}
		}
	}



	// Check the Credit Card expiration Month
	cMonthError = "";
	if (document.form1.month.value=="1") { 
		cMonthError = "Credit Card Expiration Month is not selected.\n";
	}
	
	// Check the Credit Card Expiration Year 
	cYearError = "";
	if (document.form1.year.value=="1") { 
		cYearError = "Credit Card Expiration Year is not selected.\n";
	}
	
	// Check Card Number
	cCardNameerror = "";
	if (document.form1.cardName.value.length <1) { 
		cCardNameerror = "Credit Card Name is empty.\n"; 
	}
	

	// Check Payment for
	cPaymentForerror = "";
	if (document.form1.paymentfor.value.length <1) { 
		cPaymentForerror = "Payment for is empty.\n"; 
	}

	cError = cMembershipError + cNameError + cEmailError + cCardNo1Error + cCardNo2Error + cCardNo3Error + cCardNo4Error + cMonthError + cYearError + cCardNameerror + cPaymentForerror ;

	if (cError.length>0) { 
		alert("Sorry, but you haven\'t filled out all fields required correctly.\n"+cError); 
		if (cMembershipError.length>0) { document.form1.membership.focus(); } else {
		if (cNameError.length>0) { document.form1.name.focus(); } else {
		if (cEmailError.length>0) { document.form1.email.focus(); } else {
		if (cCardNo1Error.length>0) { document.form1.cardNo1.focus(); } else {
		if (cCardNo2Error.length>0) { document.form1.cardNo2.focus(); } else {
		if (cCardNo3Error.length>0) { document.form1.cardNo3.focus(); } else {
		if (cCardNo4Error.length>0) { document.form1.cardNo4.focus(); } else {
		if (cMonthError.length>0) { document.form1.month.focus();  } else {
		if (cYearError.length>0) { document.form1.year.focus(); } else {
		if (cCardNameerror.length>0) { document.form1.cardName.focus(); } else {
		if (cPaymentForerror.length>0) { document.form1.paymentfor.focus(); } } } } } } } } } } }
		return false; 
	}	
	document.form1.submit();
}


//managemnet fee payment form checking
function checkPayment() {
	// Check Membership Number
	cMembershipError = "";
	if (document.form1.membership.value.length <1) { 
		cMembershipError = "Membership Number is empty.\n"; 
	} else {
		if (!isName(document.form1.membership.value)){
			cMembershipError = "Membership Number is invalid. Please use 0-9, A-Z, "+sCh+"\n";
		}
	}
	
	// Check Name
	cNameError = "";
	if (document.form1.name.value.length <1) { 
		cNameError = "Family Name is empty.\n"; 
	} else {
		if (!isName(document.form1.name.value)){
			cNameError = "Family Name is invalid. Please use 0-9, A-Z, "+sCh+"\n";
		}
	}


	// Check the Email
	cEmailError = "";
	if (document.form1.email.value.length <1) { 
		cEmailError = "Your Email address is empty.\n";
	}	
	else { 
		dmn = document.form1.email.value.substr(document.form1.email.value.indexOf("@")+1,document.form1.email.value.length);
		if((document.form1.email.value.indexOf("@")<1) ||(dmn.indexOf("@")>-1) || (dmn.indexOf(".")<1) || (dmn.indexOf(".")>dmn.length-2)) {
			cEmailError = "Your email address is invalid.\ne.g. : (email@domainname.com).\n";
		} else {
				if (document.form1.emailconfirmation.value!=document.form1.email.value)
						cEmailError = "Your Email and Confirmation email is different.\n";
		}	}

	

	// Check the Apartment Size
	cApartmentSizeError = "";
	if (document.form1.apartmentsize.value=="1") { 
		cApartmentSizeError = "Apartment Size is not selected.\n";
	}
	
	// Check credit card
	cCardNo1Error = "";
	cCardNo2Error = "";
	cCardNo3Error = "";
	cCardNo4Error = "";
	cMonthError = "";
	cYearError = "";
	cCardNameError = "";
		if ((document.form1.cc[0].checked) || (document.form1.cc[1].checked)){

	// Check the Card Number 1
	cCardNo1Error = "";
	if (document.form1.cardNo1.value.length<1) { 
		cCardNo1Error = "Card Number 1 should not be empty.\n";
	} else {
		if (isNaN(document.form1.cardNo1.value)) { 
			cCardNo1Error = "Card Number 1 should be numeric.\n";
		} else {
			if (document.form1.cardNo1.value<0) { 
				cCardNo1Error = "Card Number 1 should not be negative.\n";
				} else {
					if (document.form1.cardNo1.value.length<4) { 
						cCardNo1Error = "Card Number 1 should be 4 digit.\n";
					}

			}
		}
	}
	
	// Check the Card Number 2
	cCardNo2Error = "";
	if (document.form1.cardNo2.value.length<1) { 
		cCardNo2Error = "Card Number 2 should not be empty.\n";
	} else {
		if (isNaN(document.form1.cardNo2.value)) { 
			cCardNo2Error = "Card Number 2 should be numeric.\n";
		} else {
			if (document.form1.cardNo2.value<0) { 
				cCardNo2Error = "Card Number 2 should not be negative.\n";
				} else {
					if (document.form1.cardNo2.value.length<4) { 
						cCardNo2Error = "Card Number 2 should be 4 digit.\n";
					}

			}
		}
	}


	// Check the Card Number 3
	cCardNo3Error = "";
	if (document.form1.cardNo3.value.length<1) { 
		cCardNo3Error = "Card Number 3 should not be empty.\n";
	} else {
		if (isNaN(document.form1.cardNo3.value)) { 
			cCardNo3Error = "Card Number 3 should be numeric.\n";
		} else {
			if (document.form1.cardNo3.value<0) { 
				cCardNo3Error = "Card Number 3 should not be negative.\n";
				} else {
					if (document.form1.cardNo3.value.length<4) { 
						cCardNo3Error = "Card Number 3 should be 4 digit.\n";
					}

			}
		}
	}


	// Check the Card Number 4
	cCardNo4Error = "";
	if (document.form1.cardNo4.value.length<1) { 
		cCardNo4Error = "Card Number 4 should not be empty.\n";
	} else {
		if (isNaN(document.form1.cardNo4.value)) { 
			cCardNo4Error = "Card Number 4 should be numeric.\n";
		} else {
			if (document.form1.cardNo4.value<0) { 
				cCardNo4Error = "Card Number 4 should not be negative.\n";
				} else {
					if (document.form1.cardNo4.value.length<4) { 
						cCardNo4Error = "Card Number 4 should be 4 digit.\n";
					}

			}
		}
	}

	
	// Check the Credit Card expiration Month
	cMonthError = "";
	if (document.form1.month.value=="1") { 
		cMonthError = "Credit Card Expiration Month is not selected.\n";
	}
	
	// Check the Credit Card Expiration Year 
	cYearError = "";
	if (document.form1.year.value=="1") { 
		cYearError = "Credit Card Expiration Year is not selected.\n";
	}
	
	// Check the Credit Card Name
	cCardNameError = "";
	if (document.form1.cardName.value.length <1) { 
		cCardNameError = "Card Holder Name is empty.\n"; 
		}

}
	cdate1Error = "";
	cdate2Error = "";
	if (document.form1.holiday[0].checked) {
		if (document.form1.date1.value.length <1) { cdate1Error = "Holiday 1st date is empty.\n"; }
		if (document.form1.date2.value.length <1) { cdate2Error = "Holiday 2nd date is empty.\n"; }
	}
	
	cError = cMembershipError + cNameError + cEmailError + cApartmentSizeError + cCardNo1Error + cCardNo2Error + cCardNo3Error + cCardNo4Error + cMonthError + cYearError + cCardNameError + cdate1Error + cdate2Error;


	if (cError.length>0) { 
		alert("Sorry, but you haven\'t filled out all fields required correctly.\n"+cError); 
		if (cMembershipError.length>0) { document.form1.membership.focus(); } else {
		if (cNameError.length>0) { document.form1.name.focus(); } else {
		if (cEmailError.length>0) { document.form1.email.focus(); } else {
		if (cApartmentSizeError.length>0) { document.form1.apartmentsize.focus(); } else {
		if (cCardNo1Error.length>0) { document.form1.cardNo1.focus(); } else {
		if (cCardNo2Error.length>0) { document.form1.cardNo2.focus(); } else {
		if (cCardNo3Error.length>0) { document.form1.cardNo3.focus(); } else {
		if (cCardNo4Error.length>0) { document.form1.cardNo4.focus(); } else {
		if (cMonthError.length>0) { document.form1.month.focus(); } else {
		if (cYearError.length>0) { document.form1.year.focus(); } else {
		if (cCardNameError.length>0) { document.form1.cardName.focus(); } else {
		if (cdate1Error.length>0) { document.form1.date1.focus(); } else {
		if (cdate2Error.length>0) { document.form1.date2.focus(); } } } } } } } } } } } } }
		return false; 
	}	
		if (!document.form1.agree.checked) { 
		alert("Please check the confirmation check box.\n");
		return false; 
		}
	document.form1.submit();	
}	


function openwin2(source) {
	popupWin = window.open(source,'jhr','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,width=500,height=180,left=170,top=420');
	//popupWin.moveTo(window.screen.width-700,200)
	popupWin.focus();
}

function checkDiscovery() {
	// Check Name
	cNameError = "";
	if (document.form1.name.value.length <1) { 
		cNameError = "Family Name is empty.\n"; 
	} else {
		if (!isName(document.form1.name.value)){
			cNameError = "Family Name is invalid. Please use 0-9, A-Z, "+sCh+"\n";
		}
	}


	// Check the Email
	cEmailError = "";
	if (document.form1.email.value.length <1) { 
		cEmailError = "Your Email address is empty.\n";
	}	
	else { 
		dmn = document.form1.email.value.substr(document.form1.email.value.indexOf("@")+1,document.form1.email.value.length);
		if((document.form1.email.value.indexOf("@")<1) ||(dmn.indexOf("@")>-1) || (dmn.indexOf(".")<1) || (dmn.indexOf(".")>dmn.length-2)) {
			cEmailError = "Your email address is invalid.\ne.g. : (email@domainname.com).\n";
		} else {
				if (document.form1.emailconfirmation.value!=document.form1.email.value)
						cEmailError = "Your Email and Confirmation email is different.\n";
		}	}
	
	// Check Membership Number
	cMembershipError = "";
	if (document.form1.membership.value.length <1) { 
		cMembershipError = "Membership Number is empty.\n"; 
	} else {
		if (!isName(document.form1.membership.value)){
			cMembershipError = "Membership Number is invalid. Please use 0-9, A-Z, "+sCh+"\n";
		}
	}

	// Check credit card
	cCardNo1Error = "";
	cCardNo2Error = "";
	cCardNo3Error = "";
	cCardNo4Error = "";
	cMonthError = "";
	cYearError = "";
	cCardNameError = "";
	
		if ((document.form1.cc[0].checked) || (document.form1.cc[1].checked)){
		// Check the Card Number 1
		if (document.form1.cardNo1.value.length<1) { 
			cCardNo1Error = "Card Number 1 should not be empty.\n";
		} else {
			if (isNaN(document.form1.cardNo1.value)) { 
				cCardNo1Error = "Card Number 1 should be numeric.\n";
			} else {
				if (document.form1.cardNo1.value<0) { 
					cCardNo1Error = "Card Number 1 should not be negative.\n";
					} else {
						if (document.form1.cardNo1.value.length<4) { 
							cCardNo1Error = "Card Number 1 should be 4 digit.\n";
						}
	
				}
			}
		}
		// Check the Card Number 2
		if (document.form1.cardNo2.value.length<1) { 
			cCardNo2Error = "Card Number 2 should not be empty.\n";
		} else {
			if (isNaN(document.form1.cardNo2.value)) { 
				cCardNo2Error = "Card Number 2 should be numeric.\n";
			} else {
				if (document.form1.cardNo2.value<0) { 
					cCardNo2Error = "Card Number 2 should not be negative.\n";
					} else {
						if (document.form1.cardNo2.value.length<4) { 
							cCardNo2Error = "Card Number 2 should be 4 digit.\n";
						}
	
				}
			}
		}
	
	
		// Check the Card Number 3
		if (document.form1.cardNo3.value.length<1) { 
			cCardNo3Error = "Card Number 3 should not be empty.\n";
		} else {
			if (isNaN(document.form1.cardNo3.value)) { 
				cCardNo3Error = "Card Number 3 should be numeric.\n";
			} else {
				if (document.form1.cardNo3.value<0) { 
					cCardNo3Error = "Card Number 3 should not be negative.\n";
					} else {
						if (document.form1.cardNo3.value.length<4) { 
							cCardNo3Error = "Card Number 3 should be 4 digit.\n";
						}
	
				}
			}
		}
	
		// Check the Card Number 4
		if (document.form1.cardNo4.value.length<1) { 
			cCardNo4Error = "Card Number 4 should not be empty.\n";
		} else {
			if (isNaN(document.form1.cardNo4.value)) { 
				cCardNo4Error = "Card Number 4 should be numeric.\n";
			} else {
				if (document.form1.cardNo4.value<0) { 
					cCardNo4Error = "Card Number 4 should not be negative.\n";
					} else {
						if (document.form1.cardNo4.value.length<4) { 
							cCardNo4Error = "Card Number 4 should be 4 digit.\n";
						}
						if (document.form1.cardNo4.value.length>4) { 
							cCardNo4Error = "Card Number 4 should be 4 digit.\n";
						}	
	
				}
			}
		}
	}
		
	// Check the Credit Card expiration Month
	cMonthError = "";
	if (document.form1.month.value=="1") { 
		cMonthError = "Credit Card Expiration Month is not selected.\n";
	}
	
	// Check the Credit Card Expiration Year 
	cYearError = "";
	if (document.form1.year.value=="1") { 
		cYearError = "Credit Card Expiration Year is not selected.\n";
	}
	if (document.form1.cardName.value.length <1) { cCardNameError = "Card Holder Name is empty.\n"; }
	
	cdate1Error = "";
	cdate2Error = "";
	if (document.form1.deposit[0].checked) {
		if (document.form1.date1.value.length <1) { cdate1Error = "Holiday 1st date is empty.\n"; }
		if (document.form1.date2.value.length <1) { cdate2Error = "Holiday 2nd date is empty.\n"; }
	}
	
	
	cError = cMembershipError + cNameError + cEmailError + cCardNo1Error + cCardNo2Error + cCardNo3Error + cCardNo4Error + cMonthError + cYearError + cCardNameError + cdate1Error + cdate2Error;


	if (cError.length>0) { 
		alert("Sorry, but you haven\'t filled out all fields required correctly.\n"+cError); 
		if (cMembershipError.length>0) { document.form1.membership.focus(); } else {
		if (cNameError.length>0) { document.form1.name.focus(); } else {
		if (cEmailError.length>0) { document.form1.email.focus(); } else {
		if (cCardNo1Error.length>0) { document.form1.cardNo1.focus(); } else {
		if (cCardNo2Error.length>0) { document.form1.cardNo2.focus(); } else {
		if (cCardNo3Error.length>0) { document.form1.cardNo3.focus(); } else {
		if (cCardNo4Error.length>0) { document.form1.cardNo4.focus(); } else {
		if (cMonthError.length>0) { document.form1.month.focus(); } else { 
		if (cYearError.length>0) { document.form1.year.focus(); } else {
		if (cCardNameError.length>0) { document.form1.cardName.focus(); } else {
		if (cdate1Error.length>0) { document.form1.date1.focus(); } else {
		if (cdate2Error.length>0) { document.form1.date2.focus(); } } } } } } } } } } } } 
		return false; 
	}	
	document.form1.submit();	
}	

