
function showHide(newDivId) {

	var pageDivs = new Array('t1', 't2', 't3', 't4', 't5', 't6', 't7', 't8', 't9');

	for(var i = 0; i < pageDivs.length; i++) {
		if(pageDivs[i] == newDivId) {
			document.getElementById(newDivId).style.display = 'block';
		} else {
  			var tab=document.getElementById(pageDivs[i]);
			if(tab != undefined)
				tab.style.display = 'none';
		}
	}
}


function validate_contactform() {
    validateError="";
    
    if (document.enquiryform.name.value == ""){
            validateError += "You must fill in your name.\n";
       }
    else if (document.enquiryform.email.value == "") {
        validateError += "You must fill in a valid email address.\n";
       }

	else if (document.enquiryform.subject.value == "") {
        validateError += "You must fill in your contact number.\n";
       }

    else if (document.enquiryform.message.value == "") {
        validateError += "You must fill in your comments.\n";
       }
if (validateError!="") {
         alert(validateError);
         return false;
    }
  else
      {
       var email = document.enquiryform.email.value;
	   if (email != "") {
	      var regexp = /^([-A-Z0-9_]+(\.[-A-Z0-9_]+)*)\@([-A-Z0-9\.]+\.[A-Z]+(\.[A-Z]+)?)$/i
	      if(!email.match(regexp)) {
			  alert("Invalid email address! \n Please enter a valid email address.");
			  return false;
			}
		  else {
			   document.enquiryform.action="contact-us.php";
			  return true;
			  }
         }
      }
  }

function MM_preloadImages() {
  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 validate_bookingform() {
    validateError="";
    document.booking.action="reservation.php";

    if (document.booking.firstname.value == "") {
        validateError = "You must fill in all required fields.\n";
       }

	else if (document.booking.lastname.value == "") {
        validateError = "You must fill in all required fields.\n";
       }

    else if (document.booking.primary_contact.value == "") {
        validateError = "You must fill in all required fields.\n";
       }
    else if (document.booking.room_type.value == "") {
        validateError = "You must fill in all required fields.\n";
       }
    else if (document.booking.numofrooms.value == "") {
        validateError = "You must fill in all required fields.\n";
       }
    else if (document.booking.numofpersons.value == "") {
        validateError = "You must fill in all required fields.\n";
       } 
	else if (document.booking.checkin.value == "") {
        validateError = "You must fill in all required fields.\n";
       }
	else if (document.booking.checkout.value == "") {
        validateError = "You must fill in all required fields.\n";
       }

  if (validateError!="") {
         alert(validateError);
         return false;
    }
  else
      {
       var pcontact = document.booking.primary_contact.value;
       if (pcontact.length < 6) {
			  alert("Invalid email address or phone number\nFor phone number please enter area code with phone number.");
			  return false;
	       }
    }

}

