function ValidateContactSupportForm (form) {
  var fname = form.fullname.value;   
  var membershipno = form.membership_no.value;   
  var email = form.email.value;   
  var phone = form.phone.value;   
  var nature = form.enquiry_nature.value;   
  var enquiry = form.enquiry.value;   

  if (!fname)	{
    alert("You must enter full name.");
    return false;
	} else if (!membershipno) {
		alert("You must enter your membership number.");
		return false;
	} else if (!email) {
		alert("You must enter your email.");
		return false;
	} else if ((email.indexOf('@') == -1) || (email.indexOf('.') == -1)) {
		alert("Wrong email format.");
		return false;
	} else if (!phone) {
		alert("You must enter your telephone number.");
		return false;
	} else if (!nature) {
		alert("You must select the nature of your enquiry.");
		return false;
	} else if (!enquiry) {
		alert("You must enter your enquiry.");
		return false;
	} else {
		return true;
	}
}
function ValidateContactForm (form) {
  var fname = form.fullname.value;   
  var email = form.email.value;   
  var phone = form.phone.value;   
  var enquiry = form.enquiry.value;   

  if (!fname)	{
    alert("You must enter full name.");
    return false;
	} else if (!email) {
		alert("You must enter your email.");
		return false;
	} else if ((email.indexOf('@') == -1) || (email.indexOf('.') == -1)) {
		alert("Wrong email format.");
		return false;
	} else if (!phone) {
		alert("You must enter your telephone number.");
		return false;
	} else if (!enquiry) {
		alert("You must enter your enquiry.");
		return false;
	} else {
		return true;
	}
}
function ValidateRequestBookingForm (form) {
  var fname = form.fullname.value;   
  var email = form.email.value;   
  var phone = form.phone.value;   
  var arrival = form.arrival_date.value;   
  var departure = form.departure_date.value;   
  var enquiry = form.enquiry.value;   

  if (!fname)	{
    alert("You must enter full name.");
    return false;
	} else if (!email) {
		alert("You must enter your email.");
		return false;
	} else if ((email.indexOf('@') == -1) || (email.indexOf('.') == -1)) {
		alert("Wrong email format.");
		return false;
	} else if (!phone) {
		alert("You must enter your telephone number.");
		return false;
	} else if (!arrival) {
		alert("You must enter your arrival date.");
		return false;
	} else if (!departure) {
		alert("You must enter your departure date.");
		return false;
	} else if (!enquiry) {
		alert("You must enter your enquiry.");
		return false;
	} else {
		return true;
	}
}
function printPage() {
  lochref = '' + this.location;
	if (lochref.indexOf('?') > 0) {
		lochref = '?' + lochref.substring((lochref.indexOf('?')) + 1);
	} else {
		lochref = '';
	}

	w_width = 595;
	w_height = 500;
	if (screen) {
		w_left = (screen.availWidth - w_width)/2;
		w_top = ((screen.availHeight - w_height)/2)-20;
	}
	theWindowParam = 'width='+w_width+',height='+w_height+',left='+w_left+',top='+w_top+',status=no,resizable=no,scrollbars=yes';

	fparam = 'print.php'+lochref;
  window.showPrintWindow = open(fparam, 'showPrintWindow', theWindowParam);
	setTimeout('if(showPrintWindow&&!showPrintWindow.closed)showPrintWindow.focus()',100);
}
function emailPage() {
  lochref = '' + this.location;
	if (lochref.indexOf('?') > 0) {
		lochref = '?' + lochref.substring((lochref.indexOf('?')) + 1);
	} else {
		lochref = '';
	}

	w_width = 420;
	w_height = 300;
	if (screen) {
		w_left = (screen.availWidth - w_width)/2;
		w_top = ((screen.availHeight - w_height)/2)-20;
	}
	theWindowParam = 'width='+w_width+',height='+w_height+',left='+w_left+',top='+w_top+',status=no,resizable=no,scrollbars=yes';

	fparam = 'tools/emailpage/index.php'+lochref;
  window.showEmailWindow = open(fparam, 'showEmailWindow', theWindowParam);
	setTimeout('if(showEmailWindow&&!showEmailWindow.closed)showEmailWindow.focus()',100);
}
function popupWindow (theWindow, theParam) {

//	newLeft = screen.width
//	newTop = screen.height
	switch (theWindow)
	{
		case 'newmenu':
			window.open('menuform.php?'+theParam, 'NewMenu', 'toolbar=no,status=no,scrollbars=yes,resizable=yes,location=no,menubar=no,directories=no,width=500,height=500,left=50,top=50');
		break
		case 'editmenu':
			window.open('menuform.php?'+theParam, 'EditMenu', 'toolbar=no,status=no,scrollbars=yes,resizable=yes,location=no,menubar=no,directories=no,width=500,height=500,left=50,top=50');
		break
		default:
			return;
	}
}
function changeLangAlert(theLang) {
	alert('The '+theLang+' language is not published yet. Please check back soon.');
}
function changeLang(theLang) {
  lochref = '' + this.location;
	if (lochref.match('lang=') != null) {
		langPos = lochref.indexOf('lang=');
		lochref = lochref.substring(0,(langPos-1))+lochref.substring((langPos-1)+8);
	}
	// Check all parameters that 'index.php' files handles
	if ( (lochref.match("pageid=") == null) && (lochref.match("smpageid=") == null) ) {
		lochref = 'index.php?lang=' + theLang;
	} else {
		if (lochref.match("smpageid=") != null) {
			lochref = 'index.php?'+lochref.substring(lochref.indexOf('smpageid='))+'&lang=' + theLang;
		} else {
			lochref = 'index.php?'+lochref.substring(lochref.indexOf('pageid='))+'&lang=' + theLang;
		}
	}

	location = lochref;
}
function goToSearch(theform) {
  var theSearchQuery = theform.searchquery.value;
	
  lochref = 'index.php?pageaction=search&searchquery=' + theSearchQuery;
	
	location = lochref;
}
function goToSitemap() {

  lochref = 'index.php?pageaction=sitemap';

	location = lochref;
}
function goToMemberLogin(theform) {
  var theUserName = theform.memberusername.value;
  var thePassword = theform.memberpassword.value;

  lochref = 'index.php?pageaction=member&action=login&username='+theUserName;

	location = lochref;
}
function goToMemberRegister() {

  lochref = 'index.php?pageaction=member';

	location = lochref;
}
function goToMember(theAction) {

  lochref = 'index.php?pageaction=member&action='+theAction;
	
	location = lochref;
}
function bm_title_over(theId) {
  if (document.images) {
    document["bm"+theId].src = "layout/images/bm_title_"+theId+"_over.gif";
  }
}
function bm_title_up(theId) {
  if (document.images) {
	  document["bm"+theId].src = "layout/images/bm_title_"+theId+"_up.gif";
  }
} 
