function MM_displayStatusMsg(msgStr) { //v1.0
  status=msgStr;
  document.MM_returnValue = true;
}
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];}
}
var aCh="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
var dCh="0123456789-";
var sCh="ÀÂÃÄÅÆÇÈÉÊËÌÍÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿSOZsozY'_`~()^&*+-|=<>,./\{}[] ";
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));
}

function Form1_Validator(theForm){
	// Check the Voucher Number
	cVoucherError = "";
	if (document.EntryForm.voucher.value.length<1) { 
		cVoucherError = "Voucher Number should not be empty.\n";
	} else {
		if (isNaN(document.EntryForm.voucher.value)) { 
			cVoucherError = "Voucher Number should be numeric.\n";
		} else {
			if (document.EntryForm.voucher.value<0) { 
				cVoucherError = "Voucher Number should not be negative.\n";
			}
		}
	}


	// Check sponsor
	cSponsorError = "";
	if (document.EntryForm.sponsor.value.length <1) { 
		cSponsorError = "Sponsor is empty.\n"; 
	} else {
		if (!isName(document.EntryForm.sponsor.value)){
			cSponsorError = "Sponsor is invalid. Please use 0-9, A-Z, "+sCh+"\n";
		}
	}
	
	// Check Name
	cName1Error = "";
	if (document.EntryForm.name1.value.length <1) { 
		cName1Error = "Name is empty.\n"; 
	} else {
		if (!isName(document.EntryForm.name1.value)){
			cName1Error = "Name is invalid. Please use 0-9, A-Z, "+sCh+"\n";
		}
	}
	// Check the Age 
	cAge1Error = "";
	if (document.EntryForm.age1.value.length<1) { 
		cAge1Error = "Age should not be empty.\n";
	} else {
		if (isNaN(document.EntryForm.age1.value)) { 
			cAge1Error = "Age should be numeric.\n";
		} else {
			if (document.EntryForm.age1.value<0) { 
				cAge1Error = "Age should not be negative.\n";
			}
		}
	}
	// Check Nationality1
	cNationality1Error = "";
	if (document.EntryForm.nationality1.value.length <1) { 
		cNationality1Error = "Nationality is empty.\n"; 
	} else {
		if (!isName(document.EntryForm.nationality1.value)){
			cNationality1Error = "Nationality 1 is invalid. Please use 0-9, A-Z, "+sCh+"\n";
		}
	}

	cAge2Error = "";
	cName2Error = "";
	cNationality2Error = "";
	// Check Name
	if (document.EntryForm.name2.value.length>0) { 
		if (!isName(document.EntryForm.name2.value)){
			cName2Error = "Name 2 is invalid. Please use 0-9, A-Z, "+sCh+"\n";
		}
		// Check the Age 
		if (document.EntryForm.age2.value.length<1) { 
			cAge2Error = "Age 2 should not be empty.\n";
		} else {
			if (isNaN(document.EntryForm.age2.value)) { 
				cAge2Error = "Age 2 should be numeric.\n";
			} else {
				if (document.EntryForm.age2.value<0) { 
					cAge2Error = "Age 2 should not be negative.\n";
				}
			}
		}
		//Check Nationality
		if (document.EntryForm.nationality2.value.length <1) { 
			cNationality2Error = "Nationality 2 is empty.\n"; 
		} else {
			if (!isName(document.EntryForm.nationality2.value)){
				cNationality2Error = "Nationality 2 is invalid. Please use 0-9, A-Z, "+sCh+"\n";
			}
		}
	} else {
		// Check the Age 
		if (document.EntryForm.age2.value.length>0) { 
			if (isNaN(document.EntryForm.age2.value)) { 
				cAge2Error = "Age 2 should be numeric.\n";
			} else {
				if (document.EntryForm.age2.value<0) { 
					cAge2Error = "Age 2 should not be negative.\n";
				}
			}
			// Check Name
			if (document.EntryForm.name2.value.length <1) { 
				cName2Error = "Name 2 is empty.\n"; 
			} else {
				if (!isName(document.EntryForm.name2.value)){
					cName2Error = "Name 2 is invalid. Please use 0-9, A-Z, "+sCh+"\n";
				}
			}
			//Check Nationality
			if (document.EntryForm.nationality2.value.length <1) { 
				cNationality2Error = "Nationality 2 is empty.\n"; 
			} else {
				if (!isName(document.EntryForm.nationality2.value)){
					cNationality2Error = "Nationality 2 is invalid. Please use 0-9, A-Z, "+sCh+"\n";
				}
			}
		} else {
		// Check Nationality2
			if (document.EntryForm.nationality2.value.length >0) { 
				if (!isName(document.EntryForm.nationality2.value)){
					cNationality2Error = "Nationality 2 is invalid. Please use 0-9, A-Z, "+sCh+"\n";
				}
				// Check Name
				if (document.EntryForm.name2.value.length <1) { 
					cName2Error = "Name 2 is empty.\n"; 
				} else {
					if (!isName(document.EntryForm.name2.value)){
						cName2Error = "Name 2 is invalid. Please use 0-9, A-Z, "+sCh+"\n";
					}
				}
				// Check the Age 
				if (document.EntryForm.age2.value.length<1) { 
					cAge2Error = "Age 2 should not be empty.\n";
				} else {
					if (isNaN(document.EntryForm.age2.value)) { 
						cAge2Error = "Age 2 should be numeric.\n";
					} else {
						if (document.EntryForm.age2.value<0) { 
							cAge2Error = "Age 2 should not be negative.\n";
						}
					}
				}
			}
		}
	} 

	cAge3Error = "";
	cName3Error = "";
	cNationality3Error = "";
	// Check Name
	if (document.EntryForm.name3.value.length>0) { 
		if (!isName(document.EntryForm.name3.value)){
			cName3Error = "Name 3 is invalid. Please use 0-9, A-Z, "+sCh+"\n";
		}
		// Check the Age 
		if (document.EntryForm.age3.value.length<1) { 
			cAge3Error = "Age 3 should not be empty.\n";
		} else {
			if (isNaN(document.EntryForm.age3.value)) { 
				cAge3Error = "Age 3 should be numeric.\n";
			} else {
				if (document.EntryForm.age3.value<0) { 
					cAge3Error = "Age 3 should not be negative.\n";
				}
			}
		}
		//Check Nationality
		if (document.EntryForm.nationality3.value.length <1) { 
			cNationality3Error = "Nationality 3 is empty.\n"; 
		} else {
			if (!isName(document.EntryForm.nationality3.value)){
				cNationality3Error = "Nationality 3 is invalid. Please use 0-9, A-Z, "+sCh+"\n";
			}
		}
	} else {
		// Check the Age 
		if (document.EntryForm.age3.value.length>0) { 
			if (isNaN(document.EntryForm.age3.value)) { 
				cAge3Error = "Age 3 should be numeric.\n";
			} else {
				if (document.EntryForm.age3.value<0) { 
					cAge3Error = "Age 3 should not be negative.\n";
				}
			}
			// Check Name
			if (document.EntryForm.name3.value.length <1) { 
				cName3Error = "Name 3 is empty.\n"; 
			} else {
				if (!isName(document.EntryForm.name3.value)){
					cName3Error = "Name 3 is invalid. Please use 0-9, A-Z, "+sCh+"\n";
				}
			}
			//Check Nationality
			if (document.EntryForm.nationality3.value.length <1) { 
				cNationality3Error = "Nationality 3 is empty.\n"; 
			} else {
				if (!isName(document.EntryForm.nationality3.value)){
					cNationality3Error = "Nationality 3 is invalid. Please use 0-9, A-Z, "+sCh+"\n";
				}
			}
		} else {
		// Check Nationality 3
			if (document.EntryForm.nationality3.value.length >0) { 
				if (!isName(document.EntryForm.nationality3.value)){
					cNationality3Error = "Nationality 3 is invalid. Please use 0-9, A-Z, "+sCh+"\n";
				}
				// Check Name
				if (document.EntryForm.name3.value.length <1) { 
					cName3Error = "Name 3 is empty.\n"; 
				} else {
					if (!isName(document.EntryForm.name3.value)){
						cName3Error = "Name 3 is invalid. Please use 0-9, A-Z, "+sCh+"\n";
					}
				}
				// Check the Age 
				if (document.EntryForm.age3.value.length<1) { 
					cAge3Error = "Age 3 should not be empty.\n";
				} else {
					if (isNaN(document.EntryForm.age3.value)) { 
						cAge3Error = "Age 3 should be numeric.\n";
					} else {
						if (document.EntryForm.age3.value<0) { 
							cAge3Error = "Age 3 should not be negative.\n";
						}
					}
				}
			}
		}
	} 
	cAge4Error = "";
	cName4Error = "";
	cNationality4Error = "";
	// Check Name
	if (document.EntryForm.name4.value.length>0) { 
		if (!isName(document.EntryForm.name4.value)){
			cName4Error = "Name 4 is invalid. Please use 0-9, A-Z, "+sCh+"\n";
		}
		// Check the Age 
		if (document.EntryForm.age4.value.length<1) { 
			cAge4Error = "Age 4 should not be empty.\n";
		} else {
			if (isNaN(document.EntryForm.age4.value)) { 
				cAge4Error = "Age 4 should be numeric.\n";
			} else {
				if (document.EntryForm.age4.value<0) { 
					cAge4Error = "Age 4 should not be negative.\n";
				}
			}
		}
		//Check Nationality
		if (document.EntryForm.nationality4.value.length <1) { 
			cNationality4Error = "Nationality 4 is empty.\n"; 
		} else {
			if (!isName(document.EntryForm.nationality4.value)){
				cNationality4Error = "Nationality 4 is invalid. Please use 0-9, A-Z, "+sCh+"\n";
			}
		}
	} else {
		// Check the Age 
		if (document.EntryForm.age4.value.length>0) { 
			if (isNaN(document.EntryForm.age4.value)) { 
				cAge4Error = "Age 4 should be numeric.\n";
			} else {
				if (document.EntryForm.age4.value<0) { 
					cAge4Error = "Age 4 should not be negative.\n";
				}
			}
			// Check Name
			if (document.EntryForm.name4.value.length <1) { 
				cName4Error = "Name 4 is empty.\n"; 
			} else {
				if (!isName(document.EntryForm.name4.value)){
					cName4Error = "Name 4 is invalid. Please use 0-9, A-Z, "+sCh+"\n";
				}
			}
			//Check Nationality
			if (document.EntryForm.nationality4.value.length <1) { 
				cNationality4Error = "Nationality 4 is empty.\n"; 
			} else {
				if (!isName(document.EntryForm.nationality4.value)){
					cNationality4Error = "Nationality 4 is invalid. Please use 0-9, A-Z, "+sCh+"\n";
				}
			}
		} else {
		// Check Nationality 4
			if (document.EntryForm.nationality4.value.length >0) { 
				if (!isName(document.EntryForm.nationality4.value)){
					cNationality4Error = "Nationality 4 is invalid. Please use 0-9, A-Z, "+sCh+"\n";
				}
				// Check Name
				if (document.EntryForm.name4.value.length <1) { 
					cName4Error = "Name 4 is empty.\n"; 
				} else {
					if (!isName(document.EntryForm.name4.value)){
						cName4Error = "Name 4 is invalid. Please use 0-9, A-Z, "+sCh+"\n";
					}
				}
				// Check the Age 
				if (document.EntryForm.age4.value.length<1) { 
					cAge4Error = "Age 4 should not be empty.\n";
				} else {
					if (isNaN(document.EntryForm.age4.value)) { 
						cAge4Error = "Age 4 should be numeric.\n";
					} else {
						if (document.EntryForm.age4.value<0) { 
							cAge4Error = "Age 4 should not be negative.\n";
						}
					}
				}
			}
		}
	} 
	
	// Check Address
	cAddressError = "";
	if (document.EntryForm.address.value.length <1) { 
		cAddressError = "Address is empty.\n"; 
	}
	
	// Check City
	//cCityError = "";
	//if (document.EntryForm.city.value.length <1) { 
		//cCityError = "City is empty.\n"; 
	//}
	
	// Check the Zip or Post Code
//	cPostError = "";
	//if (document.EntryForm.post.value.length<1) { 
	//	cPostError = "Zip or Post Code should not be empty.\n";
	//} else {
	//	if (isNaN(document.EntryForm.post.value)) { 
	//		cPostError = "Zip or Post Code should be numeric.\n";
	//	} else {
	//		if (document.EntryForm.post.value<0) { 
	//			cPostError = "Zip or Post Code should not be negative.\n";
	//		}
	//	}
//	}
	
	
	cTelpError = "";

	if ((document.EntryForm.telp.value.length<1) && (document.EntryForm.telp1.value.length<1) && (document.EntryForm.fax.value.length<1)) { 
		cTelpError = "You must fill one of the Telephone(Day/Night/Fax) Number.\n";
	} 
	
	// Check the Email
	cEmailError = "";
	if (document.EntryForm.email.value.length <1) { 
		cEmailError = "Your email address is empty.\n";
	}	
	else { 
		if(!isEmail(document.EntryForm.email.value)) {
			cEmailError = "Your email address is invalid.\ne.g. : (email@domainname.com).\n";
		}
	}
	// Check years 
	cYearsError = "";
	if (document.EntryForm.years.value.length<1) { 
		cYearsError = "Years should not be empty.\n";
	} else {
		if (isNaN(document.EntryForm.years.value)) { 
			cYearsError = "Years should be numeric.\n";
		} else {
			if (document.EntryForm.years.value<0) { 
				cYearsError = "Years should not be negative.\n";
			}
		}
	}
	
	//check timeshare
	
	cnoweeksError = "";
	cresortError = "";
	cpurchaseError = "";
	if (document.EntryForm.timeshare[0].checked) {
		if (document.EntryForm.noweeks.value.length <1) { cnoweeksError = "No of weeks is empty.\n"; }
		if (document.EntryForm.resort.value.length <1) { cresortError = "Resort is empty.\n"; }
		if (document.EntryForm.purchase.value.length <1) { cpurchaseError = "When did you purchase? is empty.\n"; }
	};	
	// Check Occupation
	cOccupation1Error = "";
	if (document.EntryForm.occupation1.value.length <1) { 
		cOccupation1Error = "Occupation is empty.\n"; 
	}

	// Check income
	cIncome1Error = "";
	if (document.EntryForm.income1.value.length <1) { 
		cIncome1Error = "Income is empty.\n"; 
	}

	// Check Destination1
	cDestination1Error = "";
	if (document.EntryForm.destination1.value.length <1) { 
		cDestination1Error = "Destination Choice 1st is empty.\n"; 
	}
	
	// Check Destination2
	cDestination2Error = "";
	if (document.EntryForm.destination2.value.length <1) { 
		cDestination2Error = "Destination Choice 2st is empty.\n"; 
	}
	// Check Destination3
	cDestination3Error = "";
	if (document.EntryForm.destination3.value.length <1) { 
		cDestination3Error = "Destination Choice 3rd is empty.\n"; 
	}

	// Check Travel2
	cTravel1Error = "";
	if (document.EntryForm.travel1.value.length <1) { 
		cTravel1Error = "Travel Date 1st is empty.\n"; 
	}
	
	// Check Travel2
	cTravel2Error = "";
	if (document.EntryForm.travel2.value.length <1) { 
		cTravel2Error = "Travel Date 2nd is empty.\n"; 
	}

	// Check Travel3
	cTravel3Error = "";
	if (document.EntryForm.travel3.value.length <1) { 
		cTravel3Error = "Travel Date 3rd is empty.\n"; 
	}
		// Check the debit 
	cDebitError = "";
			if (document.EntryForm.Debit.value.length<1) { 
				cDebitError = "Credit Card Debit should not be empty.\n";
			} else {
				if (isNaN(document.EntryForm.Debit.value)) { 
					cDebitError = "Credit Card Debit should be numeric.\n";
				} else {
					if (document.EntryForm.Debit.value<0) { 
						cDebitError = "Credit Card Debit should not be negative.\n";
					}
				}
			}

	// Check the Card Number 1
	cCardNo1Error = "";
	if (document.EntryForm.cardNo1.value.length<1) { 
		cCardNo1Error = "Card Number should not be empty.\n";
	} else {
		if (isNaN(document.EntryForm.cardNo1.value)) { 
			cCardNo1Error = "Card Number should be numeric.\n";
		} else {
			if (document.EntryForm.cardNo1.value<0) { 
				cCardNo1Error = "Card Number should not be negative.\n";
				} else {
					if (document.EntryForm.cardNo1.value.length<4) { 
						cCardNo1Error = "Card Number should be 4 digit.\n";
					}

			}
		}
	}
	
	// Check the Card Number 2
	cCardNo2Error = "";
	if (document.EntryForm.cardNo2.value.length<1) { 
		cCardNo2Error = "Card Number should not be empty.\n";
	} else {
		if (isNaN(document.EntryForm.cardNo2.value)) { 
			cCardNo2Error = "Card Number should be numeric.\n";
		} else {
			if (document.EntryForm.cardNo2.value<0) { 
				cCardNo2Error = "Card Number should not be negative.\n";
				} else {
					if (document.EntryForm.cardNo2.value.length<4) { 
						cCardNo2Error = "Card Number should be 4 digit.\n";
					}

			}
		}
	}


	// Check the Card Number 3
	cCardNo3Error = "";
	if (document.EntryForm.cardNo3.value.length<1) { 
		cCardNo3Error = "Card Number should not be empty.\n";
	} else {
		if (isNaN(document.EntryForm.cardNo3.value)) { 
			cCardNo3Error = "Card Number should be numeric.\n";
		} else {
			if (document.EntryForm.cardNo3.value<0) { 
				cCardNo3Error = "Card Number should not be negative.\n";
				} else {
					if (document.EntryForm.cardNo3.value.length<4) { 
						cCardNo3Error = "Card Number should be 4 digit.\n";
					}

			}
		}
	}


	// Check the Card Number 4
	cCardNo4Error = "";
	if (document.EntryForm.cardNo4.value.length<1) { 
		cCardNo4Error = "Card Number should not be empty.\n";
	} else {
		if (isNaN(document.EntryForm.cardNo4.value)) { 
			cCardNo4Error = "Card Number should be numeric.\n";
		} else {
			if (document.EntryForm.cardNo4.value<0) { 
				cCardNo4Error = "Card Number should not be negative.\n";
				} else {
					if (document.EntryForm.cardNo4.value.length<4) { 
						cCardNo4Error = "Card Number should be 4 digit.\n";
					}

			}
		}
	}
	
	// Check the Credit Card Type 
	cCcTypeError = "";
	if (document.EntryForm.cc_type.value=="-") { 
		cCcTypeError = "Credit Card Type is not selected.\n";
	}
	
	// Check the Credit Card expiration Month
	cCcMonthError = "";
	if (document.EntryForm.cc_month.value=="-") { 
		cCcMonthError = "Credit Card Expiration Month is not selected.\n";
	}
	
	// Check the Credit Card
	cCcYearError = "";
	if (document.EntryForm.cc_year.value=="-") { 
		cCcYearError = "Credit Card Expiration Year is not selected.\n";
	}
	
	cError = cVoucherError + cSponsorError + cName1Error + cAge1Error + cNationality1Error + cName2Error + cAge2Error + cNationality2Error + cName3Error + cAge3Error + cNationality3Error + cName4Error + cAge4Error + cNationality4Error + cAddressError + cTelpError + cEmailError + cYearsError + cnoweeksError + cresortError + cpurchaseError + cOccupation1Error + cIncome1Error + cDestination1Error + cDestination2Error + cDestination3Error + cTravel1Error + cTravel2Error + cTravel3Error + cDebitError + cCardNo1Error + cCardNo2Error + cCardNo3Error + cCardNo4Error + cCcTypeError + cCcMonthError+ cCcYearError;

	if (cError.length>0) { 
		alert("Sorry, but you haven\'t filled out all fields required correctly.\n"+cError); 
		if (cVoucherError.length>0) { document.EntryForm.voucher.focus(); } else {
		if (cSponsorError.length>0) { document.EntryForm.sponsor.focus(); } else {
		if (cName1Error.length>0) { document.EntryForm.name1.focus(); } else {
		if (cAge1Error.length>0) { document.EntryForm.age1.focus(); } else {
		if (cNationality1Error.length>0) { document.EntryForm.nationality1.focus(); } else {
		if (cName2Error.length>0) { document.EntryForm.name2.focus(); } else {
		if (cAge2Error.length>0) { document.EntryForm.age2.focus(); } else {
		if (cNationality2Error.length>0) { document.EntryForm.nationality2.focus(); } else {
		if (cName3Error.length>0) { document.EntryForm.name3.focus(); } else {
		if (cAge3Error.length>0) { document.EntryForm.age3.focus(); } else {
		if (cNationality3Error.length>0) { document.EntryForm.nationality3.focus(); } else {
		if (cName4Error.length>0) { document.EntryForm.name4.focus(); } else {
		if (cAge4Error.length>0) { document.EntryForm.age4.focus(); } else {
		if (cNationality4Error.length>0) { document.EntryForm.nationality4.focus(); } else {
		if (cAddressError.length>0) { document.EntryForm.address.focus(); } else {
		if (cTelpError.length>0) { document.EntryForm.telp.focus(); } else {
		if (cEmailError.length>0) { document.EntryForm.email.focus(); } else {
		if (cYearsError.length>0) { document.EntryForm.years.focus(); } else {
		if (cnoweeksError.length>0) { document.EntryForm.noweeks.focus(); } else {
		if (cresortError.length>0) { document.EntryForm.resort.focus(); } else {
		if (cpurchaseError.length>0) { document.EntryForm.purchase.focus(); } else {
		if (cOccupation1Error.length>0) { document.EntryForm.occupation1.focus(); } else {
		if (cIncome1Error.length>0) { document.EntryForm.income1.focus(); } else {
		if (cDestination1Error.length>0) { document.EntryForm.destination1.focus(); } else {
		if (cDestination2Error.length>0) { document.EntryForm.destination2.focus(); } else {
		if (cDestination3Error.length>0) { document.EntryForm.destination3.focus(); } else {
		if (cTravel1Error.length>0) { document.EntryForm.travel1.focus(); } else {
		if (cTravel2Error.length>0) { document.EntryForm.travel2.focus(); } else {
		if (cTravel3Error.length>0) { document.EntryForm.travel3.focus(); } else {
		if (cDebitError.length>0) { document.EntryForm.Debit.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 (cCcTypeError.length>0) { document.EntryForm.cc_type.focus(); } else {
		if (cCcMonthError.length>0) { document.EntryForm.cc_month.focus(); } else {
		if (cCcYearError.length>0) { document.EntryForm.cc_year.focus(); } } } } }  } } } } } } }  } } } } } } } } } } } } } } } } } } } } } } } } }
		return false; 
	}
	if (!document.EntryForm.understand.checked) { 
		alert("Please check the confirmation check box.\n");
		return false; 
	}

}	



function popUp(URL) {
	x = (screen.width-520)/2;
	y = (screen.height-200)/2;
	popupWin = window.open('URL','Premiercard','width=520,height=200,left='+x+',top='+y);
	popupWin.document.open('text/html','replace');
	popupWin.document.write('<html><head><title>Beware of Fraud</title><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><link href="premier-card.css" rel=stylesheet type="text/css"></head><body><table width="500" border="0" cellspacing="0" cellpadding="4"><tr><td align="center" class="warning">Beware of Fraud</td></tr><tr><td align="center" class="tdlink">Use only our official email addresses when communicating with us.<br><br>Our email address is always \'name\'@premiercard.biz<br><span class="italic">(example: <a href="mailto:reservations@premiercard.biz" class="link">reservations@premiercard.biz</a>, <a href="mailto:sales@premiercard.biz" class="link">sales@premiercard.biz</a>)</span><br><br>Or contact us by using the Contact and Booking forms on this website<br><br><a href="javascript:self.close()">close this window</a></td></tr></table></body></html>');
     popupWin.focus();
}

function C_Show() { 
  var i,obj,args=C_Show.arguments;
  for (i=0; i<(args.length-2); i+=3) {
    if ((obj=MM_findObj(args[i]))!=null) {
      if (obj.style)
        obj=obj.style;
      obj.display='';
	}
  }
}

function C_Hide() { 
  var i,obj,args=C_Hide.arguments;
  for (i=0; i<(args.length-2); i+=3) {
    if ((obj=MM_findObj(args[i]))!=null) {
      if (obj.style)
        obj=obj.style;
      obj.display='none';
	}
  }
}

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=200,top=400');
	popupWin.focus();
}
function C_ShowLayer() { 
  var i,v,obj,args=C_ShowLayer.arguments;
  for (i=0; i<(args.length-2); i+=3) {
    if ((obj=MM_findObj(args[i]))!=null) {
      if (obj.style) {
        obj=obj.style;
        obj.visibility='visible';
      }
      else {
        obj.visibility='show';
      }
    }
  }
}

function C_HideLayer() { 
  var i,v,obj,args=C_HideLayer.arguments;
  for (i=0; i<(args.length-2); i+=3) {
    if ((obj=MM_findObj(args[i]))!=null) {
      if (obj.style) {
        obj=obj.style;
        obj.visibility='hidden';
      }
      else {
        obj.visibility='hide';
      }
    }
  }
}
function C_SetMenuPosition() { 
var nLeft
if (document.body.clientWidth>970){
	nLeft=298+((document.body.clientWidth-970)/2);
}else{
	nLeft=298;
}
  var i,v,obj,args=C_SetMenuPosition.arguments;
  for (i=0; i<(args.length-2); i+=3) {
    if ((obj=MM_findObj(args[i]))!=null) {
      if (obj.style) {
        obj=obj.style;
        obj.left=nLeft+"px";
      }
      else {
        obj.left=nLeft+"px";
      }
    }
  }
}
function C_SetMPranayamaPosition() { 
var nLeft
if (document.body.clientWidth>970){
	nLeft=531+((document.body.clientWidth-970)/2);
}else{
	nLeft=531;
}
  var i,v,obj,args=C_SetMPranayamaPosition.arguments;
  for (i=0; i<(args.length-2); i+=3) {
    if ((obj=MM_findObj(args[i]))!=null) {
      if (obj.style) {
        obj=obj.style;
        obj.left=nLeft+"px";
      }
      else {
        obj.left=nLeft+"px";
      }
    }
  }
}
function C_SetMenuPosition2() { 
var nLeft
if (document.body.clientWidth>970){
	nLeft=565+((document.body.clientWidth-970)/2);
}else{
	nLeft=565;
}
  var i,v,obj,args=C_SetMenuPosition2.arguments;
  for (i=0; i<(args.length-2); i+=3) {
    if ((obj=MM_findObj(args[i]))!=null) {
      if (obj.style) {
        obj=obj.style;
        obj.left=nLeft+"px";
      }
      else {
        obj.left=nLeft+"px";
      }
    }
  }
}
function Form2_Validator(theForm){
	// Check the Voucher Number
	cVoucherError = "";
	if (document.EntryForm.voucher.value.length<1) { 
		cVoucherError = "Voucher Number should not be empty.\n";
	} else {
			if (document.EntryForm.voucher.value<0) { 
				cVoucherError = "Voucher Number should not be negative.\n";
			}
		}
	


	// Check sponsor
	cSponsorError = "";
	if (document.EntryForm.sponsor.value.length <1) { 
		cSponsorError = "Sponsor is empty.\n"; 
	} else {
		if (!isName(document.EntryForm.sponsor.value)){
			cSponsorError = "Sponsor is invalid. Please use 0-9, A-Z, "+sCh+"\n";
		}
	}
	
	// Check Name
	cName1Error = "";
	if (document.EntryForm.name1.value.length <1) { 
		cName1Error = "Name is empty.\n"; 
	} else {
		if (!isName(document.EntryForm.name1.value)){
			cName1Error = "Name is invalid. Please use 0-9, A-Z, "+sCh+"\n";
		}
	}
	// Check the Age 
	cAge1Error = "";
	if (document.EntryForm.age1.value.length<1) { 
		cAge1Error = "Age should not be empty.\n";
	} else {
		if (isNaN(document.EntryForm.age1.value)) { 
			cAge1Error = "Age should be numeric.\n";
		} else {
			if (document.EntryForm.age1.value<0) { 
				cAge1Error = "Age should not be negative.\n";
			}
		}
	}
	// Check Nationality
	cNationality1Error = "";
	if (document.EntryForm.nationality1.value.length <1) { 
		cNationality1Error = "Nationality is empty.\n"; 
	} else {
		if (!isName(document.EntryForm.nationality1.value)){
			cNationality1Error = "Nationality  is invalid. Please use 0-9, A-Z, "+sCh+"\n";
		}
	}
	
	// Check Address
	cAddressError = "";
	if (document.EntryForm.address.value.length <1) { 
		cAddressError = "Address is empty.\n"; 
	}
		
	
	cTelpError = "";

	if ((document.EntryForm.telp.value.length<1) && (document.EntryForm.telp1.value.length<1) && (document.EntryForm.fax.value.length<1)) { 
		cTelpError = "You must fill one of the Telephone(Day/Night/Fax) Number.\n";
	} 
	
	// Check the Email
	cEmailError = "";
	if (document.EntryForm.email.value.length <1) { 
		cEmailError = "Your email address is empty.\n";
	}	
	else { 
		if(!isEmail(document.EntryForm.email.value)) {
			cEmailError = "Your email address is invalid.\ne.g. : (email@domainname.com).\n";
		}
	}
	
	//check timeshare
	cnoweeksError = "";
	cresortError = "";
	cpurchaseError = "";
	if (document.EntryForm.timeshare[0].checked) {
		if (document.EntryForm.noweeks.value.length <1) { cnoweeksError = "No of weeks is empty.\n"; }
		if (document.EntryForm.resort.value.length <1) { cresortError = "Resort is empty.\n"; }
		if (document.EntryForm.purchase.value.length <1) { cpurchaseError = "When did you purchase? is empty.\n"; }
	};	
	// Check Occupation
	cOccupation1Error = "";
	if (document.EntryForm.occupation1.value.length <1) { 
		cOccupation1Error = "Occupation is empty.\n"; 
	}

	// Check income
	cIncome1Error = "";
	if (document.EntryForm.income1.value.length <1) { 
		cIncome1Error = "Income is empty.\n"; 
	}

	// Check Destination1
	cDestination1Error = "";
	if (document.EntryForm.destination1.value.length <1) { 
		cDestination1Error = "Destination Choice 1st is empty.\n"; 
	}
	
	// Check Destination2
	cDestination2Error = "";
	if (document.EntryForm.destination2.value.length <1) { 
		cDestination2Error = "Destination Choice 2st is empty.\n"; 
	}
	
	// Check Destination3
	cDestination3Error = "";
	if (document.EntryForm.destination3.value.length <1) { 
		cDestination3Error = "Destination Choice 3rd is empty.\n"; 
	}

	// Check Travel2
	cTravel1Error = "";
	if (document.EntryForm.travel1.value.length <1) { 
		cTravel1Error = "Travel Date 1st is empty.\n"; 
	}
	
	// Check Travel2
	cTravel2Error = "";
	if (document.EntryForm.travel2.value.length <1) { 
		cTravel2Error = "Travel Date 2nd is empty.\n"; 
	}

	// Check Travel3
	cTravel3Error = "";
	if (document.EntryForm.travel3.value.length <1) { 
		cTravel3Error = "Travel Date 3rd is empty.\n"; 
	}
	// Check the Card Number 1
	cCardNo1Error = "";
	if (document.EntryForm.cardNo1.value.length<1) { 
		cCardNo1Error = "Card Number should not be empty.\n";
	} else {
		if (isNaN(document.EntryForm.cardNo1.value)) { 
			cCardNo1Error = "Card Number should be numeric.\n";
		} else {
			if (document.EntryForm.cardNo1.value<0) { 
				cCardNo1Error = "Card Number should not be negative.\n";
				} else {
					if (document.EntryForm.cardNo1.value.length<4) { 
						cCardNo1Error = "Card Number should be 4 digit.\n";
					}

			}
		}
	}
	
	// Check the Card Number 2
	cCardNo2Error = "";
	if (document.EntryForm.cardNo2.value.length<1) { 
		cCardNo2Error = "Card Number should not be empty.\n";
	} else {
		if (isNaN(document.EntryForm.cardNo2.value)) { 
			cCardNo2Error = "Card Number should be numeric.\n";
		} else {
			if (document.EntryForm.cardNo2.value<0) { 
				cCardNo2Error = "Card Number should not be negative.\n";
				} else {
					if (document.EntryForm.cardNo2.value.length<4) { 
						cCardNo2Error = "Card Number should be 4 digit.\n";
					}

			}
		}
	}


	// Check the Card Number 3
	cCardNo3Error = "";
	if (document.EntryForm.cardNo3.value.length<1) { 
		cCardNo3Error = "Card Number should not be empty.\n";
	} else {
		if (isNaN(document.EntryForm.cardNo3.value)) { 
			cCardNo3Error = "Card Number should be numeric.\n";
		} else {
			if (document.EntryForm.cardNo3.value<0) { 
				cCardNo3Error = "Card Number should not be negative.\n";
				} else {
					if (document.EntryForm.cardNo3.value.length<4) { 
						cCardNo3Error = "Card Number should be 4 digit.\n";
					}

			}
		}
	}


	// Check the Card Number 4
	cCardNo4Error = "";
	if (document.EntryForm.cardNo4.value.length<1) { 
		cCardNo4Error = "Card Number should not be empty.\n";
	} else {
		if (isNaN(document.EntryForm.cardNo4.value)) { 
			cCardNo4Error = "Card Number should be numeric.\n";
		} else {
			if (document.EntryForm.cardNo4.value<0) { 
				cCardNo4Error = "Card Number should not be negative.\n";
				} else {
					if (document.EntryForm.cardNo4.value.length<4) { 
						cCardNo4Error = "Card Number should be 4 digit.\n";
					}

			}
		}
	}
	
	// Check the Credit Card Type 
	cCcTypeError = "";
	if (document.EntryForm.cc_type.value=="-") { 
		cCcTypeError = "Credit Card Type is not selected.\n";
	}
	
	// Check the Credit Card expiration Month
	cCcMonthError = "";
	if (document.EntryForm.cc_month.value=="-") { 
		cCcMonthError = "Credit Card Expiration Month is not selected.\n";
	}
	
	// Check the Credit Card
	cCcYearError = "";
	if (document.EntryForm.cc_year.value=="-") { 
		cCcYearError = "Credit Card Expiration Year is not selected.\n";
	}
	
	cError = cVoucherError + cSponsorError + cName1Error + cAge1Error + cNationality1Error + cAddressError + cTelpError + cEmailError +  cnoweeksError + cresortError + cpurchaseError + cOccupation1Error + cIncome1Error + cDestination1Error + cDestination2Error + cDestination3Error + cTravel1Error + cTravel2Error + cTravel3Error +  cCardNo1Error + cCardNo2Error + cCardNo3Error + cCardNo4Error + cCcTypeError + cCcMonthError+ cCcYearError;

	if (cError.length>0) { 
		alert("Sorry, but you haven\'t filled out all fields required correctly.\n"+cError); 
		if (cVoucherError.length>0) { document.EntryForm.voucher.focus(); } else {
		if (cSponsorError.length>0) { document.EntryForm.sponsor.focus(); } else {
		if (cName1Error.length>0) { document.EntryForm.name1.focus(); } else {
		if (cAge1Error.length>0) { document.EntryForm.age1.focus(); } else {
		if (cNationality1Error.length>0) { document.EntryForm.nationality1.focus(); } else {
		if (cAddressError.length>0) { document.EntryForm.address.focus(); } else {
		if (cTelpError.length>0) { document.EntryForm.telp.focus(); } else {
		if (cEmailError.length>0) { document.EntryForm.email.focus(); } else {
		if (cnoweeksError.length>0) { document.EntryForm.noweeks.focus(); } else {
		if (cresortError.length>0) { document.EntryForm.resort.focus(); } else {
		if (cpurchaseError.length>0) { document.EntryForm.purchase.focus(); } else {
		if (cOccupation1Error.length>0) { document.EntryForm.occupation1.focus(); } else {
		if (cIncome1Error.length>0) { document.EntryForm.income1.focus(); } else {
		if (cDestination1Error.length>0) { document.EntryForm.destination1.focus(); } else {
		if (cDestination2Error.length>0) { document.EntryForm.destination2.focus(); } else {
		if (cDestination3Error.length>0) { document.EntryForm.destination3.focus(); } else {
		if (cTravel1Error.length>0) { document.EntryForm.travel1.focus(); } else {
		if (cTravel2Error.length>0) { document.EntryForm.travel2.focus(); } else {
		if (cTravel3Error.length>0) { document.EntryForm.travel3.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 (cCcTypeError.length>0) { document.EntryForm.cc_type.focus(); } else {
		if (cCcMonthError.length>0) { document.EntryForm.cc_month.focus(); } else {
		if (cCcYearError.length>0) { document.EntryForm.cc_year.focus(); } } } } }  } } } } } } }  } } } } } } } } } } } } } } 
		return false; 
	}
	if (!document.EntryForm.understand.checked) { 
		alert("Please check the confirmation check box.\n");
		return false; 
	}

}	