// JScript source code
<!-- // hide from old browsers


////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// used  mainly for testing javascript functions are working
function fnAlert(strAlertText)
{
	alert(strAlertText);
}

function redirect()
{
	if( typeof( window.innerWidth ) == 'number' ) {
		//Non-IE
		myWidth = window.innerWidth;
	} else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
		//IE 6+ in 'standards compliant mode'
		myWidth = document.documentElement.clientWidth;
	} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
		//IE 4 compatible
		myWidth = document.body.clientWidth;
	}

	if(myWidth>1000){
		window.location='default.asp?width=1000';
	} else {
		window.location='default.asp?width=800';
	}
}


////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// validate add user form
function validate(strFormName) {

	var isErrors;
	var strMessage;
	var strFormName;
	var emailFilter=/^.+@.+\..{2,3}$/;
	var illegalChars= /[\(\)\<\>\,\;\:\\\/\"\[\]]/
	
	isErrors = "false";
	strMessage = "Please complete the following mandatory fields            ";
	strMessage = strMessage + "\n--------------------------------------------------------"
	
	//alert(strFormName);
	
	// -----------------------------------------------------
	// ////// contact enquiry form
	// -----------------------------------------------------
	if (strFormName == "frmEnquiryForm")
	{
		// Name
		if (document.frmEnquiryForm.frmFromName.value == "") {	
			strMessage = strMessage + "\n - Name";		
			isErrors = "true";	
		}
		
		var emailstrng = document.frmEnquiryForm.frmFromEmail.value
		
		// Email
		if (emailstrng == "") {	
			strMessage = strMessage + "\n - Email Address";		
			isErrors = "true";	
		} 
		else if (!(emailFilter.test(emailstrng))) 
		{
			strMessage = strMessage + "\n - Email not valid";		
			isErrors = "true";	
		}
		else if (emailstrng.match(illegalChars)) 
		{
			strMessage = strMessage + "\n - Email contains illegal characters";		
			isErrors = "true";	
		}
		
		// Enquiry
		if (document.frmEnquiryForm.frmEnquiry.value == "") {	
			strMessage = strMessage + "\n - Enquiry";		
			isErrors = "true";	
		}
	}
	// -----------------------------------------------------
	// ////// treatment booking form
	// -----------------------------------------------------
	else if (strFormName == "frmBookingForm")
	{
		// Name
		if (document.frmBookingForm.frmName.value == "") {	
			strMessage = strMessage + "\n - Name";		
			isErrors = "true";	
		}
		
		var emailstrng = document.frmBookingForm.frmEmail.value
		
		// Email
		if (emailstrng == "") {	
			strMessage = strMessage + "\n - Email Address";		
			isErrors = "true";	
		} 
		else if (!(emailFilter.test(emailstrng))) 
		{
			strMessage = strMessage + "\n - Email not valid";		
			isErrors = "true";	
		}
		else if (emailstrng.match(illegalChars)) 
		{
			strMessage = strMessage + "\n - Email contains illegal characters";		
			isErrors = "true";	
		}		
		
		// Phone
		if (document.frmBookingForm.frmPhone.value == "") {	
			strMessage = strMessage + "\n - Phone Number";		
			isErrors = "true";	
		}
		
		// Treatment
		if (document.frmBookingForm.frmTreatment.value == "NONE") {	
			strMessage = strMessage + "\n - Spa Treatment";		
			isErrors = "true";	
		}
		
		// Preference 1
		if (document.frmBookingForm.frmDateTime1.value == "") {	
			strMessage = strMessage + "\n - Date and Time of Preference 1";		
			isErrors = "true";	
		}
		
		// Preference 2
		if (document.frmBookingForm.frmDateTime2.value == "") {	
			strMessage = strMessage + "\n - Date and Time of Preference 2";		
			isErrors = "true";	
		}
	}

	// -----------------------------------------------------
	// ////// checkout
	// -----------------------------------------------------
	else if (strFormName == "frmCheckout")
	{
		// Email
		if (document.frmCheckout.frmEmail.value == "") {	
			strMessage = strMessage + "\n - Email Address";		
			isErrors = "true";	
		}
		// Password
		if (document.frmCheckout.frmUser_Type[1].checked == true && document.frmCheckout.frmPassword.value == "") {	
			strMessage = strMessage + "\n - Password";		
			isErrors = "true";	
		}	
	}
	else if (strFormName == "frmCheckout_Step2_New")
	{
		// Password
		if (document.frmCheckout_Step2_New.frmPassword.value == "") {	
			strMessage = strMessage + "\n - Password";		
			isErrors = "true";	
		}
		// Password2
		if (document.frmCheckout_Step2_New.frmPassword2.value == "") {	
			strMessage = strMessage + "\n - Re-enter Password";		
			isErrors = "true";	
		}
		else if(document.frmCheckout_Step2_New.frmPassword.value != document.frmCheckout_Step2_New.frmPassword2.value)
		{
			strMessage = strMessage + "\n - Passwords dont match";		
			isErrors = "true";
			document.frmCheckout_Step2.frmPassword.value = "";
			document.frmCheckout_Step2.frmPassword2.value = "";
		}	
		
		// FirstName
		if (document.frmCheckout_Step2_New.frmName_First.value == "") {	
			strMessage = strMessage + "\n - FirstName";		
			isErrors = "true";	
		}
		// Last Name
		if (document.frmCheckout_Step2_New.frmName_Last.value == "") {	
			strMessage = strMessage + "\n - Last Name";		
			isErrors = "true";	
		}
		// Address Line 1
		if (document.frmCheckout_Step2_New.frmAddress_Line1.value == "") {	
			strMessage = strMessage + "\n - Address";		
			isErrors = "true";	
		}
		// Suburb
		if (document.frmCheckout_Step2_New.frmSuburb.value == "") {	
			strMessage = strMessage + "\n - Suburb";		
			isErrors = "true";	
		}
		// Post Code
		if (document.frmCheckout_Step2_New.frmPostCode.value == "") {	
			strMessage = strMessage + "\n - Post Code";		
			isErrors = "true";	
		}
		// State
		if (document.frmCheckout_Step2_New.frmState.value == "") {	
			strMessage = strMessage + "\n - State";		
			isErrors = "true";	
		}
		// Country
		if (document.frmCheckout_Step2_New.frmCountryID.value == "NONE") {	
			strMessage = strMessage + "\n - Country";		
			isErrors = "true";	
		}
		// Phone or Mobile
		if (document.frmCheckout_Step2_New.frmPhone.value == "" && document.frmCheckout_Step2_New.frmMobile.value == "") {	
			strMessage = strMessage + "\n - Phone or Mobile";		
			isErrors = "true";	
		}
		
	}
	else if (strFormName == "frmCheckout_Step2_Exist")
	{		
		// FirstName
		if (document.frmCheckout_Step2_Exist.frmName_First.value == "") {	
			strMessage = strMessage + "\n - FirstName";		
			isErrors = "true";	
		}
		// Last Name
		if (document.frmCheckout_Step2_Exist.frmName_Last.value == "") {	
			strMessage = strMessage + "\n - Last Name";		
			isErrors = "true";	
		}
		// Address Line 1
		if (document.frmCheckout_Step2_Exist.frmAddress_Line1.value == "") {	
			strMessage = strMessage + "\n - Address";		
			isErrors = "true";	
		}
		// Suburb
		if (document.frmCheckout_Step2_Exist.frmSuburb.value == "") {	
			strMessage = strMessage + "\n - Suburb";		
			isErrors = "true";	
		}
		// Post Code
		if (document.frmCheckout_Step2_Exist.frmPostCode.value == "") {	
			strMessage = strMessage + "\n - Post Code";		
			isErrors = "true";	
		}
		// State
		if (document.frmCheckout_Step2_Exist.frmState.value == "") {	
			strMessage = strMessage + "\n - State";		
			isErrors = "true";	
		}
		// Country
		if (document.frmCheckout_Step2_Exist.frmCountryID.value == "NONE") {	
			strMessage = strMessage + "\n - Country";		
			isErrors = "true";	
		}
		// Phone or Mobile
		if (document.frmCheckout_Step2_Exist.frmPhone.value == "" && document.frmCheckout_Step2_Exist.frmMobile.value == "") {	
			strMessage = strMessage + "\n - Phone or Mobile";		
			isErrors = "true";	
		}
		
	} // end if
	
	strMessage = strMessage + "\n--------------------------------------------------------";	
	if (isErrors == "true") {	
		alert(strMessage);
		return false;	
	} 

} // end function




////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

function checkEmail(strng) {
   var error = ""
   var emailFilter=/^.+@.+\..{2,3}$/;
   if (!(emailFilter.test(strng))) { 
               error = "Please enter a valid email address.\n";
   }

   var illegalChars= /[\(\)\<\>\,\;\:\\\/\"\[\]]/
   if (strng.match(illegalChars)) {
      error = "The email address contains illegal characters.\n";
   }
   return error;
} 

/*
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function jumpTo(newLoc) {
	newPage = newLoc.options[newLoc.selectedIndex].value
	
	if (newPage != "") {
		window.location.href = newPage
	}
}
*/


////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/*
var message="Right-click function has been disabled!";
function clickIE4(){
	if (event.button==2){
		alert(message);
		return false;
	}
}

function clickNS4(e){
	if (document.layers||document.getElementById&&!document.all){
		if (e.which==2||e.which==3){
			alert(message);
			return false;
		}
	}
}

	if (document.layers){
		document.captureEvents(Event.MOUSEDOWN);
		document.onmousedown=clickNS4;
	}
	else if (document.all&&!document.getElementById){
		document.onmousedown=clickIE4;
	}

	document.oncontextmenu=new Function("alert(message);return false")

*/




///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////




// -- OPEN WINDOW
function fnOpenWindow(strUrl,intWidth,intHeight) {
	strNewWin = window.open(strUrl, 'pop_window', 'width='+intWidth+',height='+intHeight+',status=1,scrollbars=1,resizable=1');
	strNewWin.focus();
}

/*
// CreateControl
function fnCreateControl(DivID, CLSID, ObjectID,WIDTH, HEIGHT, URL, AUTOSTART)
{
  var d = document.getElementById(DivID);
  d.innerHTML = 
    '<object classid=' + CLSID + ' id=' + ObjectID + 
    ' width=' + WIDTH + ' height=' + HEIGHT +'>
    <param name="URL" value=' + URL + '>
    <param name="autoStart" value=' + AUTOSTART + '/>';
}

*/
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// browser window size
function alertSize() {
  var myWidth = 0, myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
  }
  window.alert( 'Width = ' + myWidth );
  window.alert( 'Height = ' + myHeight );
 
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

function fnSelectRadio(strForm,strRadio) {
    document.strForm.choice[strRadio].checked = true;
}

// popup window with sizing
function popWin_adv(strUrl,strWidth,strHeight,strScrollbars) {
	popupWindow = window.open(strUrl, 'win_showpic', 'width='+strWidth+',height='+strHeight+','+strScrollbars+',toolbar=no,status=yes,resizable=yes')
	popupWindow.focus()
}


// --> 
