function toggleview(item) {

	if (document.getElementById(item+"content").style.display == "none") {

		document.getElementById(item+"content").style.display="block";

		document.getElementById(item+"status").innerHTML="-";

	} else {

		document.getElementById(item+"content").style.display="none";

		document.getElementById(item+"status").innerHTML="+";

	}

}



function getCities(aForm, anArray) {

   var selIndex = aForm.country.value;



   if (selIndex != 0) {

      aForm.cityname.options.length = 0;

      aForm.property.options.length = 0;

      if(!anArray[selIndex]) {

         return;

      }

      for(var i = 0, n = 0; i < anArray[selIndex].length; i++) {

         aForm.cityname.options[n++] = new Option(anArray[selIndex][i][1], anArray[selIndex][i][0]);

      }

      aForm.cityname.selectedIndex = 0;

   }

}



function getProperties(aForm, anArray) {

   var selIndex = aForm.cityname.value;

   if (selIndex != 0) {

      aForm.property.options.length = 0;

      if(!anArray[selIndex]) {

         return;

      }

      for (var i = 0, n = 0; i < anArray[selIndex].length; i++) {

         aForm.property.options[n++] = new Option(anArray[selIndex][i][1], anArray[selIndex][i][0]);

      }

      aForm.property.selectedIndex = 0;

   }

}



function visitURL(aForm) {

	if(aForm.country.options.selectedIndex != 0) {

		if(aForm.cityname.options[aForm.cityname.options.selectedIndex].value != 0) {

			window.open(aForm.property.options[aForm.property.options.selectedIndex].value);

		} else {

			alert('You must select a City first!');	

		}

	} else {

		alert('You must select a Country first!');	

	}

}



function getsubcategories(aForm, anArray) {

   var selIndex = aForm.country.selectedIndex;

   aForm.Hotelnames.options.length = 0;



   if (!anArray[selIndex]) {

      return;

   }

   for (var i = 0, n = 0; i < anArray[selIndex].length; i++) {

      aForm.Hotelnames.options[n++] = new Option(anArray[selIndex][i][1], anArray[selIndex][i][0]

      );

   }

   aForm.Hotelnames.selectedIndex = 0;

}



function checkSelections() {

   if (document.idForm.country.value.length == 0) {

      alert('Please select a country.');

      return false;

   } else {

      return true;

   }

}





function MM_openBrWindow(theURL,winName,features) { //v2.0

  window.open(theURL,winName,features);

}



function validateEnquiry(f) {

   //declare some variables here first

   var strErrMsg = "";

   var regExp1 = /[^a-zA-Z0-9 ]/

   var regstr1 = "(@.*@)|(\\.\\.)|(@\\.)|(\\.@)|(^\\.)";

   var regstr2 = "^.+\\@(\\[?)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,3}|[0-9]{1,3})(\\]?)$";

   var regEmail1 = new RegExp(regstr1);

   var regEmail2 = new RegExp(regstr2);

   var regEmail3 = /[^a-zA-Z0-9\-_.@]/;



   //reset all the fields to #FFFFFF

   f.txtFirstName.style.backgroundColor = '#FFFFFF';

   f.txtLastName.style.backgroundColor = '#FFFFFF';

   f.txtEmailAddress.style.backgroundColor = '#FFFFFF';

   f.captcha.style.backgroundColor = '#FFFFFF';

   f.numPhoneCountryCode.style.backgroundColor = '#FFFFFF';

   f.txtAddress.style.backgroundColor = '#FFFFFF';

   f.txtEnquiryContents.style.backgroundColor = '#FFFFFF';



   if(!f.txtFirstName.value) {

      strErrMsg = strErrMsg + "- First Name/Given Name is required\n";

      f.txtFirstName.style.backgroundColor = '#FF0000';

   } else {

      if(window.RegExp) {

         if(regExp1.test(f.txtFirstName.value)) {

            strErrMsg = strErrMsg + "- Family Name is invalid\n";

            f.txtFirstName.style.backgroundColor = '#FF0000';

         }

      }

   }



   if(!f.txtLastName.value) {

      strErrMsg = strErrMsg + "- Last Name/Family Name is required\n";

      f.txtLastName.style.backgroundColor = '#FF0000';

   } else {

      if(window.RegExp) {

         if(regExp1.test(f.txtLastName.value)) {

            strErrMsg = strErrMsg + "- Given Name is invalid\n";

            f.txtLastName.style.backgroundColor = '#FF0000';

         }

      }

   }



   if(!f.txtEmailAddress.value) {  //for the Email Address field

      strErrMsg = strErrMsg + "- Email Address is required\n";

      f.txtEmailAddress.style.backgroundColor = "#FF0000";

   } else {

      if(window.RegExp) {

         if(!(!regEmail1.test(f.txtEmailAddress.value) && regEmail2.test(f.txtEmailAddress.value) && !regEmail3.test(f.txtEmailAddress.value)) || !(f.txtEmailAddress.value.indexOf("@")>=0)) {

            strErrMsg = strErrMsg + "- Invalid Email Address\n";

            f.txtEmailAddress.style.backgroundColor = '#FF0000';

         }

      }

   }



   if(!f.numPhoneCountryCode.value){

      strErrMsg = strErrMsg +"- Country Code is required\n";

      f.numPhoneCountryCode.style.backgroundColor = '#FF0000';

   }



   if(!f.numPhoneNumber.value){

      strErrMsg = strErrMsg +"- Phone Number is required\n";

      f.numPhoneNumber.style.backgroundColor = '#FF0000';

   }



   if(!f.txtAddress.value){

      strErrMsg = strErrMsg +"- Address is required\n";

      f.txtAddress.style.backgroundColor = '#FF0000';

   }



   if(!f.txtEnquiryContents.value){

      strErrMsg = strErrMsg +"- Enquiry / Feedback is required\n";

      f.txtEnquiryContents.style.backgroundColor = '#FF0000';

   }



   if(!f.captcha.value) {

      strErrMsg = strErrMsg + "- Anti Spam Code is required\n";

      f.captcha.style.backgroundColor = '#FF0000';

   } else {

      if(window.RegExp) {

         if(regExp1.test(f.captcha.value)) {

            strErrMsg = strErrMsg + "- Please enter the Anti Spam Code shown in the image shown on the left \n";

            f.captcha.style.backgroundColor = '#FF0000';

         }

      }

   }



   if(strErrMsg != "") {

      alert(strErrMsg);

      return false;

   } else {

      return true;

   }

}



function validateFeedback(f) {

   var strErrMsg = "";

   var regExp1 = /[^a-zA-Z0-9 ]/

   var regstr1 = "(@.*@)|(\\.\\.)|(@\\.)|(\\.@)|(^\\.)";

   var regstr2 = "^.+\\@(\\[?)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,3}|[0-9]{1,3})(\\]?)$";

   var regEmail1 = new RegExp(regstr1);

   var regEmail2 = new RegExp(regstr2);

   var regEmail3 = /[^a-zA-Z0-9\-_.@]/;



   //reset all the fields to #FFFFFF

   f.txtFirstName.style.backgroundColor = '#FFFFFF';

   f.txtLastName.style.backgroundColor = '#FFFFFF';

   f.txtEmailAddress.style.backgroundColor = '#FFFFFF';

   f.txtComments.style.backgroundColor = '#FFFFFF';

   f.captcha.style.backgroundColor = '#FFFFFF';



   if(!f.txtFirstName.value) {

      strErrMsg = strErrMsg + "- First Name is required\n";

      f.txtFirstName.style.backgroundColor = '#FF0000';

   } else {

      if(window.RegExp) {

         if(regExp1.test(f.txtFirstName.value)) {

            strErrMsg = strErrMsg + "- First Name is invalid\n";

            f.txtFirstName.style.backgroundColor = '#FF0000';

         }

      }

   }



   if(!f.txtLastName.value) {

      strErrMsg = strErrMsg + "- Last Name is required\n";

      f.txtLastName.style.backgroundColor = '#FF0000';

   } else {

      if(window.RegExp) {

         if(regExp1.test(f.txtLastName.value)) {

            strErrMsg = strErrMsg + "- Last Name is invalid\n";

            f.txtLastName.style.backgroundColor = '#FF0000';

         }

      }

   }



   if(!f.txtEmailAddress.value) {  //for the Email Address field

      strErrMsg = strErrMsg + "- Email Address is required\n";

      f.txtEmailAddress.style.backgroundColor = "#FF0000";

   } else {

      if(window.RegExp) {

         if(!(!regEmail1.test(f.txtEmailAddress.value) && regEmail2.test(f.txtEmailAddress.value) && !regEmail3.test(f.txtEmailAddress.value)) || !(f.txtEmailAddress.value.indexOf("@")>=0)) {

            strErrMsg = strErrMsg + "- Invalid Email Address\n";

            f.txtEmailAddress.style.backgroundColor = '#FF0000';

         }

      }

   }



   if(!f.txtComments.value) {

      strErrMsg = strErrMsg + "- Comments is required\n";

      f.txtComments.style.backgroundColor = '#FF0000';

   }



   if(!f.captcha.value) {

      strErrMsg = strErrMsg + "- Anti Spam Code is required\n";

      f.captcha.style.backgroundColor = '#FF0000';

   } else {

      if(window.RegExp) {

         if(regExp1.test(f.captcha.value)) {

            strErrMsg = strErrMsg + "- Please enter the Anti Spam Code shown in the image shown on the left \n";

            f.captcha.style.backgroundColor = '#FF0000';

         }

      }

   }



   if(strErrMsg != "") {

      alert(strErrMsg);

      return false;

   } else {

      return true;

   }

}



function isNumberKey(evt) {

   var charCode = (evt.which) ? evt.which : event.keyCode

   if (charCode > 31 && (charCode < 48 || charCode > 57)) {

      return false;

   }

   return true;

}



//function to automatically populate the form fields in the booking engine with the current date

function todayDate(f) {

   var now = new Date();

   //f.txtArrivalDate.value = now.getDate() + "/" + (now.getMonth() + 1) + "/" + now.getFullYear();

	/*var dteArrivalDate = new Date(now.getTime() + (7*24*60*60*1000));

	f.txtArrivalDate.value = dteArrivalDate.getDate() + "/" + (dteArrivalDate.getMonth() + 1) + "/" + dteArrivalDate.getFullYear();

   f.fromday.value = dteArrivalDate.getDate();

   f.frommonth.value = dteArrivalDate.getMonth() + 1;

   f.fromyear.value = dteArrivalDate.getFullYear();



   //var txtDaysForward = f.nbdays.options[f.nbdays.selectedIndex].value;



   var dteDepartureDate = new Date(now.getTime() + (8*24*60*60*1000));

   f.txtDepartureDate.value = dteDepartureDate.getDate() + "/" + (dteDepartureDate.getMonth() + 1) + "/" + dteDepartureDate.getFullYear();

	f.endday.value = dteDepartureDate.getDate();

   f.endmonth.value = dteDepartureDate.getMonth() + 1;

   f.endyear.value = dteDepartureDate.getFullYear();*/

}



//added by Darryl on 300508



function GoogleLocationMapPopUp() {

	window.open("location_map_google.php", "", "width=670, height=520, resizable=no");	

}



function NormalLocationMapPopup() {

	window.open("location_map_normal.php", "", "width=800, height=650, resizable=no, scrollbars=yes");	

}
