<!--

function MM_displayStatusMsg(msgStr) { //v1.0

  status=msgStr;

  document.MM_returnValue = true;

}

//-->

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));

}

function checkForm() {

	if (document.mf.realname.value.length <1) { alert("Sorry, but you haven\'t filled out all fields required.\nPlease enter your name."); document.mf.realname.focus(); return false; }

	if (document.mf.email.value.length <1) { 

		alert("Sorry, but you haven\'t filled out all fields required.\nPlease enter your email address."); document.mf.email.focus(); return false; 

	}	

	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)) {

			alert("Please type a valid email address.\nEx : (email@domainname.com)."); document.mf.email.focus(); return false; 

		}

	}

	if (document.mf.comment.value.length <1) { alert("Sorry, but you haven\'t filled out all fields required.\nPlease enter your comment."); document.mf.comment.focus(); return false; }

	document.mf.submit();

}



function RequestForm() {



	// Check the Adult people

	cAdultsError = "";

	if (document.EntryForm.Adults.value.length<1) { 

		cAdultsError = "Adult should not be empty.\n";

	} else {

		if (isNaN(document.EntryForm.Adults.value)) { 

			cAdultsError = "Adult should be numeric.\n";

		} else {

			if (document.EntryForm.Adults.value<0) { 

				cAdultsError = "Adult should not be negative.\n";

			}

		}

	}



	



	// Check the No Room

	cNoRoomError = "";

	if (document.EntryForm.NoRoom.value.length<1) { 

		cNoRoomError = "Room should not be empty.\n";

	} else {

		if (isNaN(document.EntryForm.NoRoom.value)) { 

			cNoRoomError = "Room should be numeric.\n";

		} else {

			if (document.EntryForm.NoRoom.value<0) { 

				cNoRoomError = "Room should not be negative.\n";

			}

		}

	}





	// Check Name

	cNameError = "";

	if (document.EntryForm.Name.value.length<1) {

		cNameError ="Your Name is empty.\n"; 

	} else {

		if (!isName(document.EntryForm.Name.value)){

			cNameError = "Name is invalid. Please use 0-9, A-Z, "+sCh+"\n";

		}

	}

	// Check Address

	cAddressError = "";

	if (document.EntryForm.Address.value.length<1) { 

		cAddressError ="Your Address is empty.\n"; 

	} else {

		if (!isName(document.EntryForm.Address.value)){

			cAddressError ="Address is invalid. Please use 0-9, A-Z, "+sCh+"\n";

		}

	}



	// Check City

	cCityError = "";

	if (document.EntryForm.City.value.length<1) { 

		cCityError ="City Name is empty.\n"; 

	} else {

		if (!isName(document.EntryForm.City.value)){

			cCityError = "City name is invalid. Please use 0-9, A-Z, "+sCh+"\n";

		}

	}



	// Check State

	cStateError = "";

	if (document.EntryForm.State.value.length<1) { 

		cStateError ="State Name is empty.\n"; 

	} else {

		if (!isName(document.EntryForm.State.value)){

			cStateError ="State Name is invalid. Please use 0-9, A-Z, "+sCh+"\n";

		}

	}



	// Check Country

	cCountryError = "";

	if (document.EntryForm.Country.value.length<1) { 

		cCountryError ="Country Name is empty.\n"; 

	} else {

		if (!isName(document.EntryForm.Country.value)){

			cCountryError ="Country Name is invalid. Please use 0-9, A-Z, "+sCh+"\n";

		}

	}



	// Check Phone

	cPhoneError = "";

	if (document.EntryForm.Phone.value.length<1) { 

		cPhoneError ="Phone Number is empty.\n"; 

	} else {

		if (!isName(document.EntryForm.Phone.value)){

			cPhoneError ="Phone Number is invalid. Please use 0-9, A-Z, "+sCh+"\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 Message

	cMessageError = "";

	if (document.EntryForm.Message.value.length <1) { 

		cMessageError ="Your Message is empty.\n"; 

	}



	

	cError = cAdultsError + cNoRoomError + cNameError + cAddressError + cCityError + cStateError + cCountryError + cPhoneError + cEmailError + cMessageError;

	

	if (cError.length>0) { 

		alert("Sorry, but you haven\'t filled out all fields required correctly.\n"+cError); 

		if (cAdultsError.length>0) { document.EntryForm.Adults.focus(); } else {

		if (cNoRoomError.length>0) { document.EntryForm.NoRoom.focus(); } else {

		if (cNameError.length>0) { document.EntryForm.Name.focus(); } else {

		if (cAddressError.length>0) { document.EntryForm.Address.focus(); } else {

		if (cCityError.length>0) { document.EntryForm.City.focus(); } else {

		if (cStateError.length>0) { document.EntryForm.State.focus(); } else {

		if (cCountryError.length>0) { document.EntryForm.Country.focus(); } else {

		if (cPhoneError.length>0) { document.EntryForm.Phone.focus(); } else {	

		if (cEmailError.length>0) { document.EntryForm.Email.focus(); } else {

		if (cMessageError.length>0) { document.EntryForm.Message.focus(); } } } } } } } } } } 

		return false; 

	}

	

	document.EntryForm.submit();

}



function OpenWindow(theImage,Width,Height,Caption) { //v2.0

  popUp=window.open('', '','width='+Width+',height='+Height);

  popUp.document.write("<HTML><HEAD><TITLE>Nusa Lembongan Resort - Image Gallery - "+Caption+"</TITLE></HEAD><BODY bgcolor=6666CC leftmargin=0 topmargin=0 marginwidth=0 marginheight=0>");

  popUp.document.write("<IMG SRC=",theImage," width=",Width," height=",Height,"></BODY></HTML>");

}

function checkPass() {

	if (document.mf.username.value.length <1) { alert("Sorry, but you haven\'t filled out all fields required.\nPlease enter your user name."); document.mf.username.focus(); return false; }

	if (document.mf.password.value.length <1) { alert("Sorry, but you haven\'t filled out all fields required.\nPlease enter your password."); document.mf.password.focus(); return false; }

	if (document.mf.newpass.value.length <1) { alert("Sorry, but you haven\'t filled out all fields required.\nPlease enter your new password."); document.mf.newpass.focus(); return false; }

	document.mf.submit();

}



function checkContent() {

	if (document.mf.username.value.length <1) { alert("Sorry, but you haven\'t filled out all fields required.\nPlease enter your user name."); document.mf.username.focus(); return false; }

	if (document.mf.password.value.length <1) { alert("Sorry, but you haven\'t filled out all fields required.\nPlease enter your password."); document.mf.password.focus(); return false; }

	document.mf.submit();

}
