function isDate(DateToCheck)
{
if(DateToCheck==""){return true;}
var m_strDate = FormatDate(DateToCheck);
if(m_strDate==""){
return false;
}
var m_arrDate = m_strDate.split("/");
var m_DAY = m_arrDate[0];
var m_MONTH = m_arrDate[1];
var m_YEAR = m_arrDate[2];
if(m_YEAR.length > 4){;return false;}
m_strDate = m_MONTH + "/" + m_DAY + "/" + m_YEAR;
var testDate=new Date(m_strDate);
if(testDate.getMonth()+1==m_MONTH){;
return true;
} 
else{;
return false;
}
}//end function

function notYet()
{
	alert("Sorry this feature is not available, please try later")
}

function FormatDate(DateToFormat,FormatAs){

if(DateToFormat==""){return"";}
if(!FormatAs){FormatAs="dd/mm/yyyy";}
var strReturnDate;
FormatAs = FormatAs.toLowerCase();
DateToFormat = DateToFormat.toLowerCase();
var arrDate
var arrMonths = new Array("January","February","March","April","May","June","July","August","September","October","November","December");
var strMONTH;
var Separator;

while(DateToFormat.indexOf("st")>-1){
DateToFormat = DateToFormat.replace("st","");
}

while(DateToFormat.indexOf("nd")>-1){
DateToFormat = DateToFormat.replace("nd","");
}

while(DateToFormat.indexOf("rd")>-1){
DateToFormat = DateToFormat.replace("rd","");
}

while(DateToFormat.indexOf("th")>-1){
DateToFormat = DateToFormat.replace("th","");
}

if(DateToFormat.indexOf(".")>-1){
Separator = ".";
}

if(DateToFormat.indexOf("-")>-1){
Separator = "-";
}


if(DateToFormat.indexOf("/")>-1){
Separator = "/";
}

if(DateToFormat.indexOf(" ")>-1){
Separator = " ";
}

arrDate = DateToFormat.split(Separator);
DateToFormat = "";
	for(var iSD = 0;iSD < arrDate.length;iSD++){
		if(arrDate[iSD]!=""){
		DateToFormat += arrDate[iSD] + Separator;
		}
	}
DateToFormat = DateToFormat.substring(0,DateToFormat.length-1);
arrDate = DateToFormat.split(Separator);

if(arrDate.length < 3){
return "";
}

var DAY = arrDate[0];
var MONTH = arrDate[1];
var YEAR = arrDate[2];




if(parseFloat(arrDate[1]) > 12){
DAY = arrDate[1];
MONTH = arrDate[0];
}

if(parseFloat(DAY) && DAY.toString().length==4){
YEAR = arrDate[0];
DAY = arrDate[2];
MONTH = arrDate[1];
}


for(var iSD = 0;iSD < arrMonths.length;iSD++){
var ShortMonth = arrMonths[iSD].substring(0,3).toLowerCase();
var MonthPosition = DateToFormat.indexOf(ShortMonth);
	if(MonthPosition > -1){
	MONTH = iSD + 1;
		if(MonthPosition == 0){
		DAY = arrDate[1];
		YEAR = arrDate[2];
		}
	break;
	}
}

var strTemp = YEAR.toString();
if(strTemp.length==2){

	if(parseFloat(YEAR)>40){
	YEAR = "19" + YEAR;
	}
	else{
	YEAR = "20" + YEAR;
	}

}


	if(parseInt(MONTH)< 10 && MONTH.toString().length < 2){
	MONTH = "0" + MONTH;
	}
	if(parseInt(DAY)< 10 && DAY.toString().length < 2){
	DAY = "0" + DAY;
	}
	switch (FormatAs){
	case "dd/mm/yyyy":
	return DAY + "/" + MONTH + "/" + YEAR;
	case "mm/dd/yyyy":
	return MONTH + "/" + DAY + "/" + YEAR;
	case "dd/mmm/yyyy":
	return DAY + " " + arrMonths[MONTH -1].substring(0,3) + " " + YEAR;
	case "mmm/dd/yyyy":
	return arrMonths[MONTH -1].substring(0,3) + " " + DAY + " " + YEAR;
	case "dd/mmmm/yyyy":
	return DAY + " " + arrMonths[MONTH -1] + " " + YEAR;	
	case "mmmm/dd/yyyy":
	return arrMonths[MONTH -1] + " " + DAY + " " + YEAR;
	}

return DAY + "/" + strMONTH + "/" + YEAR;;

}

function checkEmailValid(emailStr)
{
var emailPat=/^(.+)@(.+)$/
var specialChars="\\(\\)<>@,;:\\\\\\\"\\.\\[\\]"
var validChars="\[^\\s" + specialChars + "\]"
var quotedUser="(\"[^\"]*\")"
var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/
var atom=validChars + '+'
var word="(" + atom + "|" + quotedUser + ")"
var userPat=new RegExp("^" + word + "(\\." + word + ")*$")
var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$")
var errMsg="";   
var matchArray=emailStr.match(emailPat)
if (matchArray==null) 
{
   errMsg=errMsg+"The eMail Address seems incorrect (please check @ and .).";
   return errMsg;
}
else
{
  var user=matchArray[1]
  var domain=matchArray[2]
  if (user.match(userPat)==null) 
  {
    errMsg=errMsg+"Invalid eMail address ";
	return errMsg;       
  }
  var IPArray=domain.match(ipDomainPat)
  if (IPArray!=null) 
  {
	  for (var i=1;i<=4;i++) 
          {
	    if (IPArray[i]>255) 
            {
	        errMsg=errMsg+"Destination IP address is invalid ";
			return errMsg;
            }//IF
          }//for
   }//IP Array
   var domainArray=domain.match(domainPat)
   if (domainArray==null) 
   {
	 errMsg=errMsg+"The Domain Name is invalid";
	 return errMsg;
   }
   var atomPat=new RegExp(atom,"g")
   var domArr=domain.match(atomPat)
   var len=domArr.length
   if (domArr[domArr.length-1].length<2 || domArr[domArr.length-1].length>3) 
   {
     errMsg=errMsg+"The eMail Address must end with a three-letter domain, or two letter country.";
	 return errMsg;	
   } 
   if (len<2) 
   {
     errMsg=errMsg+"Your eMail address does not have a Hostname";
	 return errMsg;	 
   } 
 }//End  Match
return "0";
} 

function GP_AdvOpenWindow(theURL,winName,features,popWidth,popHeight,winAlign,ignorelink,alwaysOnTop,autoCloseTime,borderless) { //v2.0
  var leftPos=0,topPos=0,autoCloseTimeoutHandle, ontopIntervalHandle, w = 480, h = 340;  
  if (popWidth > 0) features += (features.length > 0 ? ',' : '') + 'width=' + popWidth;
  if (popHeight > 0) features += (features.length > 0 ? ',' : '') + 'height=' + popHeight;
  if (winAlign && winAlign != "" && popWidth > 0 && popHeight > 0) {
    if (document.all || document.layers || document.getElementById) {w = screen.availWidth; h = screen.availHeight;}
		if (winAlign.indexOf("center") != -1) {topPos = (h-popHeight)/2;leftPos = (w-popWidth)/2;}
		if (winAlign.indexOf("bottom") != -1) topPos = h-popHeight; if (winAlign.indexOf("right") != -1) leftPos = w-popWidth; 
		if (winAlign.indexOf("left") != -1) leftPos = 0; if (winAlign.indexOf("top") != -1) topPos = 0; 						
    features += (features.length > 0 ? ',' : '') + 'top=' + topPos+',left='+leftPos;}
  if (document.all && borderless && borderless != "" && features.indexOf("fullscreen") != -1) features+=",fullscreen=1";
  if (window["popupWindow"] == null) window["popupWindow"] = new Array();
  var wp = popupWindow.length;
  popupWindow[wp] = window.open(theURL,winName,features);
  if (popupWindow[wp].opener == null) popupWindow[wp].opener = self;  
  if (document.all || document.layers || document.getElementById) {
    if (borderless && borderless != "") {popupWindow[wp].resizeTo(popWidth,popHeight); popupWindow[wp].moveTo(leftPos, topPos);}
    if (alwaysOnTop && alwaysOnTop != "") {
    	ontopIntervalHandle = popupWindow[wp].setInterval("window.focus();", 50);
    	popupWindow[wp].document.body.onload = function() {window.setInterval("window.focus();", 50);}; }
    if (autoCloseTime && autoCloseTime > 0) {
    	popupWindow[wp].document.body.onbeforeunload = function() {
  			if (autoCloseTimeoutHandle) window.clearInterval(autoCloseTimeoutHandle);
    		window.onbeforeunload = null;	}  
   		autoCloseTimeoutHandle = window.setTimeout("popupWindow["+wp+"].close()", autoCloseTime * 1000); }
  	window.onbeforeunload = function() {for (var i=0;i<popupWindow.length;i++) popupWindow[i].close();}; }   
  document.MM_returnValue = (ignorelink && ignorelink != "") ? false : true;
}

function WholeNumberOnly(opt,msg)
{
	var pos=opt.value.indexOf(".")
	if  (pos>0)
	  {
		alert("The "+msg+" can only be whole numbers!"); 
		opt.value=opt.value.substr(0,opt.value.length-1);
		opt.focus();
	  }	 
	if  (isNaN(opt.value))
	  {
		alert("The "+msg+" can only be whole numbers!"); 
		opt.value=opt.value.substr(0,opt.value.length-1);
		opt.focus();
	  }
}

function SetDefault(opt)
{
	if  (opt.value=="")
	  {
		opt.value=1;
	  }
}

function SetBlank(opt)
{
	if  (opt.value=="0")
	  {
		opt.value="";
	  }
}

function validateContactUs()
    {
	if  (document.frmData.strContactName.value=="")
      {
        alert("We would really like to know your name"); 
        return false;
      }
	var e=document.frmData.strEmail.value;
	if (e.length==0)
	{
	   alert("Your eMail Address is missing");
	   return false;
	}
	if (checkEmailValid(e)!="0") 
	{
		alert(checkEmailValid(e));
		return false;	
	}
	if  (document.frmData.strMessage.value=="")
      {
        alert("You forgot the Message"); 
        return false;
      }
	if (document.frmData.strMessage.value.length>2000)
     {
       alert("The Length of Message must smaller than 2000 characters"); 
        return false;
     }
  	return true;
    }


    function validateTellAFriend()
    {
	if  (document.frmData.strSendTo.value=="")
      {
        alert("We would really like to know who do you want to send to"); 
        return false;
      }

	if  (document.frmData.strName.value=="")
      {
        alert("You forgot your name"); 
        return false;
      }

	if  (document.frmData.strEmail.value=="")
      {
        alert("Your eMail Address is missing"); 
        return false;
      }

  	return true;
      
    }


    function validatePackageEnquiry()
    {
	if  (document.frmData.strFirstName.value=="")
      {
        alert("Please enter your First Name"); 
        return false;
      }

	if  (document.frmData.strLastName.value=="")
      {
        alert("Please enter your Last Name"); 
        return false;
      }

	if  (document.frmData.strEmail.value=="" && document.frmData.strContactNo.value=="")
      {
        alert("Please enter your eMail Address or Telephone Number"); 
        return false;
      }

	if  (document.frmData.arrday.value=="0" || document.frmData.arrmonth.value=="0" || document.frmData.arryear.value=="0")
      {
        alert("Please make sure that you have selected the Day, Month & Year of your Arrival Date"); 
        return false;
      }

	if  (document.frmData.depday.value=="0" || document.frmData.depmonth.value=="0" || document.frmData.depyear.value=="0")
      {
        alert("Please make sure that you have selected the Day, Month & Year of your Departure Date"); 
        return false;
      }


	if  (document.frmData.intNoOfGolfers.value=="" || document.frmData.intNoOfGolfers.value=="0")
      {
        alert("Please enter the Number of Golfers"); 
        return false;
      }

	if  (isNaN(document.frmData.intNoOfGolfers.value))
      {
        alert("The Number of Golfers has to be in number format"); 
        return false;
      }

	if  (isNaN(document.frmData.intNoOfNonGolfers.value))
      {
        alert("The Number of Non-Golfers has to be in number format"); 
        return false;
      }

	if  (document.frmData.intNoOfHotelRooms.value=="")
      {
        alert("Please enter the Number of Hotel Rooms"); 
        return false;
      }
	  
  	return true;
      
    }


    function validateLogon()
    {
     

	if  (document.frmData.strLogonName.value=="")
      {
        alert("Please enter a Logon Name"); 
        return false;
      }

	if  (document.frmData.strPassword.value=="")
      {
        alert("Please enter the password"); 
        return false;
      }
	return true;      
    }


    function validateAdministrator()
    {
     

	if  (document.frmData.strLogon.value=="")
      {
        alert("Please enter a Logon Name"); 
        return false;
      }

	if  (document.frmData.strPassword.value=="")
      {
        alert("Please enter the Password"); 
        return false;
      }
	if  (document.frmData.strConfPassword.value=="")
      {
        alert("Please confirm the Password"); 
        return false;
      }
	if (document.frmData.strPassword.value!=document.frmData.strConfPassword.value)
      {
        alert("The Password and Confirm Password do not match"); 
        return false;
      }
	return true; 
    }


    function validateContactCategory()
    {
     

	if  (document.frmData.strCategoryName.value=="")
      {
        alert("The Category Name is mandatory"); 
        return false;
      }
	return true; 
    }


    function validateStatus()
    {
     

	if  (document.frmData.strStatusName.value=="")
      {
        alert("The Status Name is mandatory"); 
        return false;
      }
	return true; 
    }


    function validateRegion()
    {
     

	if  (document.frmData.strRegionName.value=="")
      {
        alert("The Region Name is mandatory"); 
        return false;
      }
	return true; 
    }
 
    function validatePaymentMethod()
    {
     

	if  (document.frmData.strPaymentMethodName.value=="")
      {
        alert("The Payment Method Name is mandatory"); 
        return false;
      }
	return true; 
    }


    function validateCountry()
    {
	if  (document.frmData.strCountryName.value=="")
      {
        alert("The Country Name is mandatory"); 
        return false;
      }
	if  (document.frmData.intRegionId.value=="")
      {
        return false;
      }
	return true; 
    }


    function validateGolfregion()
    {
	if  (document.frmData.strGolfregionName.value=="")
      {
        alert("The Golf Region Name is mandatory"); 
        return false;
      }
	if  (document.frmData.intCountryId.value=="")
      {
        return false;
      }
	return true; 
    }
 
    
    function validateAirPort()
    {
     

	if  (document.frmData.strAirportName.value=="")
      {
        alert("The Airport Name is mandatory"); 
        return false;
      }
	return true; 
    }

    
    function openTellAFriendWindow(url,name)
    {
	var widgets ="toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,left=130,top=50,resizable=no,width=530,height=450"
                popupWin = window.open (url,name,widgets);
	popupWin.focus();
    }

	function openDimples(url,name)
    {
	var widgets ="toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,left=150,top=150,resizable=no,width=528,height=250"
                popupWin = window.open (url,name,widgets);
	popupWin.focus();
    }

	function openHotelDetail(url,name)
    {
	var widgets ="toolbar=yes,location=no,directories=no,status=yes,menubar=yes,scrollbars=yes,left=40,top=20,resizable=yes,width=600,height=410"
                popupWin = window.open (url,name,widgets);
	popupWin.focus();
    }
	function openPackageDetail(url,name)
    {
	var widgets ="toolbar=yes,location=no,directories=no,status=yes,menubar=yes,scrollbars=yes,left=20,top=20,resizable=yes,width=780,height=550"
                popupWin = window.open (url,name,widgets);
	popupWin.focus();
    }

	function openGolfCourseSummary(url,name)
    {
	var widgets ="toolbar=yes,location=no,directories=no,status=yes,menubar=yes,scrollbars=yes,left=60,top=25,resizable=yes,width=630,height=410"
                popupWin = window.open (url,name,widgets);
	popupWin.focus();
    }
	
	function openPackageSignin(url,name)
    {
	var widgets ="toolbar=yes,location=no,directories=no,status=yes,menubar=yes,scrollbars=no,left=200,top=200,resizable=no,width=300,height=300"
                popupWin = window.open (url,name,widgets);
	popupWin.focus();
    }

	function openCalc(amt)
    {
	var loc="calc.asp?amt="+amt
	var name="calc"
	var widgets ="toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,left=150,top=150,resizable=no,width=630,height=230"
                popupWin = window.open (loc,name,widgets);
	popupWin.focus();
    }

    function CloseIt()
   {
  	window.close();
   }


    function validateWineListType()
    {
	if  (document.frmData.strWineListTypeName.value=="")
      {
        alert("The Wine List Type is mandatory"); 
        return false;
      }
	return true; 
    }

function validateRecipeCategory()
    {   
	if  (document.frmData.strRecipeCategoryName.value=="")
      {
        alert("The Recipe Category is mandatory"); 
        return false;
      }
	return true; 
    }


function validateRecipe()
    {
	if  (document.frmData.strRecipeName.value=="")
      {
        alert("The Recipe Name is mandatory"); 
        return false;
      }
	if  (document.frmData.intCategoryId.value=="")
      {
        return false;
      }
	var a=document.frmData.strRecipeDescription.value
	if (a.length>1000)
     {
       alert("The Length of Description must smaller than 1000 characters"); 
        return false;
     }
	var a=document.frmData.strIngredients.value
	if (a.length>1000)
     {
       alert("The Length of Ingredients must smaller than 1000 characters"); 
        return false;
     }
	var b=document.frmData.strRecipeMethod.value
	if (b.length>4000)
     {
       alert("The Length of Method must smaller than 4000 characters"); 
        return false;
     }
	return true; 
    }

    function validateCity()
    {   
	if  (document.frmData.strCityName.value=="")
      {
        alert("The City Name is mandatory"); 
        return false;
      }
	if  (document.frmData.intGolfRegionId.value=="")
      {
        return false;
      }
	return true; 
    }

    function validateCreditCard()
    {   
	if  (document.frmData.strCreditCardName.value=="")
      {
        alert("The Credit Card Name is mandatory"); 
        return false;
      }
	if  (document.frmData.strShortName.value=="")
      {
        alert("The Credit Card Short Name is mandatory"); 
        return false;
      }
	return true; 
    }

    function validateTemple()
    {
	if  (document.frmData.strTempleName.value=="")
      {
        alert("The Temple Name is mandatory"); 
        return false;
      }
	if  (document.frmData.intCityId.value=="")
      {
        return false;
      }
	var a=document.frmData.strDescription.value
	if (a.length>2000)
     {
       alert("The Length of Description must smaller than 2000 characters"); 
        return false;
     }
	var b=document.frmData.strDirections.value
	if (b.length>1000)
     {
       alert("The Length of Directions must smaller than 1000 characters"); 
        return false;
     }
	return true; 
    }

     function validateRestaurant()
    {
	if  (document.frmData.strRestaurantName.value=="")
      {
        alert("The Restaurant Name is mandatory"); 
        return false;
      }
	if  (document.frmData.intCityId.value=="")
      {
        return false;
      }
	if  (document.frmData.intWineListTypeId.value=="")
      {
        return false;
      }
	var a=document.frmData.strDescription.value
	if (a.length>2000)
     {
       alert("The Length of Description must smaller than 2000 characters"); 
        return false;
     }
	var b=document.frmData.strDirections.value
	if (b.length>1000)
     {
       alert("The Length of Directions must smaller than 1000 characters"); 
        return false;
     }
	return true; 
    }

     function checkDisplayImage()
    {
	if  (document.frmData.strFileName.value=="")
      {
        alert("The File Name is mandatory"); 
        return false;
      }
	if  (document.frmData.strAlternateText.value=="")
      {
        alert("The Alternate Text is mandatory"); 
        return false;
      }
	var a=document.frmData.strAlternateText.value
	if (a.length>200)
     {
       alert("The Length of Alternate Text must smaller than 200 characters"); 
        return false;
     }
	if  (document.frmData.strReDirection.value=="")
      {
        alert("The Re-Direction Text is mandatory"); 
        return false;
      }
	return true; 
    }

    function checkEventFestivalType()
    {   
	if  (document.frmData.strEventFestivalTypeName.value=="")
      {
        alert("The Event Festival Type Name is mandatory"); 
        return false;
      }
	return true; 
    }

    function checkEventFestival()
    {   
	if  (document.frmData.strEventFestivalName.value=="")
      {
        alert("The Event Festival Name is mandatory"); 
        return false;
      }

	var a=document.frmData.strDescription.value
	if (a.length>2000)
     {
       alert("The Length of Description must smaller than 2000 characters"); 
        return false;
     }
	return true; 
    }

    function checkEventFestivalCategory()
    {   
	if  (document.frmData.strEventFestivalCategoryName.value=="")
      {
        alert("The Event Festival Category Name is mandatory"); 
        return false;
      }
	return true; 
    }

function checkSurchargeType()
    {   
	if  (document.frmData.strSurchargeTypeName.value=="")
      {
        alert("The Surcharge Type Name is mandatory"); 
        return false;
      }
	return true; 
    }

    function checkRoomType()
    {   
	if  (document.frmData.strRoomTypeName.value=="")
      {
        alert("The Room Type Name is mandatory"); 
        return false;
      }
	return true; 
   }

	function checkPicture()
    {   
	if  (document.frmData.intTypeId.value=="")
      {
        alert("The Item Name is mandatory"); 
        return false;
      }

	if  (document.frmData.strFileLoc.value=="")
      {
        alert("You forgot to include a picture"); 
        return false;
      }
	return true; 
   }


	function checkPackagePicture()
    {   
	if  (document.frmData.strFileLoc.value=="")
      {
        alert("You forgot to include a picture"); 
        return false;
      }
	return true; 
   }


    function checkPackage()
    {   
	if  (document.frmData.strHotelName.value=="")
      {
        alert("The Package Hotel Name is mandatory"); 
        return false;
      }
	if  (document.frmData.intHotelId.value=="0")
      {
        alert("The Hotel is mandatory"); 
        return false;
      }
	if  (document.frmData.intGolfRegionId.value=="0")
      {
        alert("The Golf Region is mandatory"); 
        return false;
      }
	if  (document.frmData.strDescription.value=="")
      {
        alert("The Description is mandatory"); 
        document.frmData.strDescription.value='';
        return false;
      }
	return true; 
    }

function checkHotel()
    {   
	if  (document.frmData.strHotelName.value=="")
      {
        alert("The Hotel Name is mandatory"); 
        return false;
      }
	if  (document.frmData.lngHotelStandardId.value=="0")
      {
        alert("Please select the Hotel Rating"); 
        return false;
      }
	if  (document.frmData.intGolfRegionId.value=="0")
      {
        alert("Please select the Golf Region"); 
        return false;
      }
	if  (document.frmData.strShortDescription.value=="")
      {
        alert("The Short Description is mandatory"); 
        return false;
      }
	if (document.frmData.strShortDescription.value.length>255)
     {
       alert("The Length of Short Description must smaller than 255 characters"); 
        return false;
     }
	if (document.frmData.strDescription.value.length>1500)
     {
       alert("The Length of Description must smaller than 1500 characters"); 
        return false;
     }
/*	if(document.frmData.bStandard.value=="True" && document.frmData.bType.value=="True")
	{
		 if(document.frmData.chkCusPack.checked==true)
		 {
			var ctrl = document.frmData.strLow
			var ctrl2 = document.frmData.strHigh
			var i;
			var strText="";
			var strText2="";
			for (i = 0; i < ctrl.length; i++) 
			{
				if (ctrl[i].value=="0") 
				{
					strText="incorrect"
				}
			}
			if (ctrl.value=="0") 
			{
				strText="incorrect"
			}
			for (i = 0; i < ctrl2.length; i++) 
			{
				if (ctrl2[i].value=="0") 
				{
					strText2="incorrect"
				}
			}
			if (ctrl2.value=="0") 
			{
				strText2="incorrect"
			}
			if(strText!="" || strText2!="")
			{
				if(confirm("You have selected Custom Package Hotel."+'\n'+"There are Room Prices missing! Continue?"))
				{
					return true;
				}
				else
				{
					return false;
				}
			}
		 }
	}*/
	 if(isNaN(document.frmData.strCarTransfer.value))
	 {
	 	alert("The Car Transfer can only be number");
		return false;
	 }
	 if(isNaN(document.frmData.strLimo.value))
	 {
	 	alert("The Limo Transfer can only be number");
		return false;
	 }
	 if(isNaN(document.frmData.strMinibus.value))
	 {
	 	alert("The Minibus Transfer can only be number");
		return false;
	 }
	return true; 
}


   function checkNewPackageDetail()
    {   
	if  (document.frmData.strPackageDetailName.value=="")
      {
        alert("The Package Detail Name is mandatory"); 
        return false;
      }
	if  (document.frmData.strDescription.value=="")
      {
        alert("The Package Detail Description is mandatory"); 
        document.frmData.strDescription.value='';
        return false;
      }
	if  (isNaN(document.frmData.intDisplayOrder.value))
      {
        alert("The Display Order has to be in number format"); 
        return false;
      }

	return true; 
    }


   function checkEditPackageDetail()
    {   
	if  (document.frmData.strPackageDetailName.value=="")
      {
        alert("The Package Detail Name is mandatory"); 
        return false;
      }
	if  (document.frmData.strDescription.value=="")
      {
        alert("The Package Detail Description is mandatory"); 
        document.frmData.strDescription.value='';
        return false;
      }
	if  (isNaN(document.frmData.intDisplayOrder.value))
      {
        alert("The Display Order has to be in number format"); 
        return false;
      }
	if  (document.frmData.strGolferLSC.value=="")
      {
        alert("The Golfer Low Season Package Cost is mandatory"); 
        return false;
      }
	if  (isNaN(document.frmData.strGolferLSC.value))
      {
        alert("The Golfer Low Season Package Cost has to be in number format"); 
        return false;
      }
	if  (document.frmData.strGolferHSC.value=="")
      {
        alert("The Golfer High Season Package Cost is mandatory"); 
        return false;
      }
	if  (isNaN(document.frmData.strGolferHSC.value))
      {
        alert("The Golfer High Season Package Cost has to be in number format"); 
        return false;
      }
	if  (document.frmData.strNonGolferLSC.value=="")
      {
        alert("The Non-Golfer Low Season Package Cost is mandatory"); 
        return false;
      }
	if  (isNaN(document.frmData.strNonGolferLSC.value))
      {
        alert("The Non-Golfer Low Season Package Cost has to be in number format"); 
        return false;
      }
	if  (document.frmData.strNonGolferHSC.value=="")
      {
        alert("The Non-Golfer High Season Package Cost is mandatory"); 
        return false;
      }
	if  (isNaN(document.frmData.strNonGolferHSC.value))
      {
        alert("The Non-Golfer High Season Package Cost has to be in number format"); 
        return false;
      }

	return true; 
    }

   function checkHotelArea()
    {   
	if  (document.frmData.strHotelAreaName.value=="")
      {
        alert("The Hotel Area Name is mandatory"); 
        return false;
      }
	if  (document.frmData.strDescription.value=="")
      {
        alert("The Hotel Area Description is mandatory"); 
        document.frmData.strDescription.value='';
        return false;
      }
	return true; 
    }


    function checkDrivingRange()
    {   
	if  (document.frmData.strDrivingRangeName.value=="")
      {
        alert("The Driving Range Name is mandatory"); 
        return false;
      }

	var a=document.frmData.strDescription.value
	if (a.length>2000)
     {
       alert("The Length of Description must smaller than 2000 characters"); 
        return false;
     }
	var b=document.frmData.strLocation.value
	if (b.length>1000)
     {
       alert("The Length of Location must smaller than 1000 characters"); 
        return false;
     }
	return true; 
    }
    
    function checksitepage()
    {   
	if  (document.frmData.strFileName.value=="")
      {
        alert("The Page Name is mandatory"); 
        return false;
      }

	var a=document.frmData.strDescription.value
	if (a.length>100)
     {
       alert("The Length of Description must smaller than 100 characters"); 
        return false;
     }
	var b=document.frmData.strText.value
	if (b.length>2000)
     {
       alert("The Length of Page Text must smaller than 2000 characters"); 
        return false;
     }
     
    var c=document.frmData.strOfflineText.value
	if (c.length>1000)
     {
       alert("The Length of Page Text must smaller than 1000 characters"); 
        return false;
     } 
	return true; 
    }
  
function checkActivityEnquiry()
    {
	if  (document.frmData.strContactName.value=="")
      {
        alert("Please enter your Contact Name"); 
        return false;
      }
	var e=document.frmData.strEmail.value;
	if (e.length==0)
	{
	   alert("Please enter your Email Address");
	   return false;
	}
	if (checkEmailValid(e)!="0") 
	{
		alert( checkEmailValid(e));
		return false;	
	}
	var bSelected = false;
	for (counter = 0; counter < document.frmData.chkActivity.length; counter++)
		{
			if (document.frmData.chkActivity[counter].checked)
			{
				bSelected = true; 
			}
		}
	if (document.frmData.chkActivity.checked)
	{
		bSelected = true;
	}
	if (bSelected==false)
		{
			alert("Please select an Activity")
			return false;
		}
	if  (document.frmData.intNoOfPeople.value=="0")
	{
		  alert("Please indicate the Number of Person");
		  return false;
	}
	if (document.frmData.intNoOfPeople.value > 10)
	{
		  alert("The value of Number of People in Party must be lesser than 10");
		  return false;
	 }
	if  (isNaN(document.frmData.intNoOfPeople.value))
	  {
		alert("The Number of People in Party can only be whole numbers!"); 
		return false;
	  }
	if  (document.frmData.strAddress.value!="")
	{
		if (document.frmData.strAddress.value.length > 500)
		{
			  alert("The length of Address must be lesser than 500 characters");
			  return false;
		 }
	}
	if  (document.frmData.strMessage.value!="")
	{
		if (document.frmData.strMessage.value.length > 2000)
		{
			  alert("The length of Additional Request must be lesser than 2000 characters");
			  return false;
		 }
	}
  	return true;
    }
		function checkSubscribeConfirm()
	{
		if(document.frmData.strFirstName.value.length==0)
		{
			alert("The First Name is required!")
			return false;
		}
		if(document.frmData.strLastName.value.length==0)
		{
			alert("The Last Name is required!")
			return false;
		}
		if (document.frmData.strPassword.value.length==0)
		{
			alert("The Password is required!");
			return false;
		}
		if (document.frmData.strConfirmPassword.value.length==0)
		{
			alert("The Confirm Password is required!");
			return false;
		}
		if (document.frmData.strPassword.value != document.frmData.strConfirmPassword.value)
		{
			alert("The Password and Confirm Password do not match!");
			return false;
		}
		var c=document.frmData.chkEmailGroup;
		var valid=false;
		for(i=0;i<c.length;++i)
		{
			if(c[i].checked)
			{
				valid=true;
			}
		}
		if(c.checked)
		{
			valid=true;
		}
		if(valid==false)
		{
			alert("Please select an Interests!");
			return false;
		}
		if (document.frmData.strAddress.value.length > 250)
		{
			  alert("The length of Address must be lesser than 250 characters!");
			  return false;
		}
		return true;
	}
	function checkSubscribe()
	{
		if (document.frmData.strContactName.value=="")
			{
				alert("Your name is required");
				return false;
			}
		var e=document.frmData.strEmail.value;
		if (e=="")
		{
			alert("A valid email address is required to process your subscription");
			return false;
		}
		else
		{
			if (checkEmailValid(e) !="0") 
			{
				alert( checkEmailValid(e));
				return false;	
			}
		}
			
	
		return true;
	}
	
	function checkForgotPassword()
	{
		var e=document.frmData.strEmail.value;
		if (e.length==0)
		{
		   alert("The eMail Address is required!");
		   return false;
		}
		if (checkEmailValid(e)!="0") 
		{
			alert( checkEmailValid(e));
			return false;	
		}
		return true;
	}
	
	function checkEditDetailsLogon()
	{
		var e=document.frmData.strEmail.value;
		if (e.length==0)
		{
		   alert("The eMail Address is required!");
		   return false;
		}
		if (checkEmailValid(e)!="0") 
		{
			alert( checkEmailValid(e));
			return false;	
		}
		if (document.frmData.strPassword.value.length==0)
		{
		   alert("The Password is required!");
		   return false;
		}
		return true;
	}
	function checkUnSubscribe()
	{
		var e=document.frmData.strEmail.value;
		if (e.length==0)
		{
		   alert("The eMail Address is required!");
		   return false;
		}
		if (checkEmailValid(e)!="0") 
		{
			alert( checkEmailValid(e));
			return false;	
		}
		if (document.frmData.strPassword.value.length==0)
		{
		   alert("The Password is required!");
		   return false;
		}
		return true;
	}

function CheckLatestInformation()
    {   
	if  (document.frmData.strLatestInfoName.value=="")
      {
        alert("The Information Item Name is mandatory"); 
        return false;
      }
         
	if(document.frmData.chkCountry.checked==false)
	{
		if(document.frmData.intGolfRegionId.value=="0")
		{
			alert("Please Select Golf Region!"); 
			return false;				
		}
	}	  
	if(document.frmData.intStartDay.value=="0" || document.frmData.intStartMonth.value=="0" || document.frmData.intStartYear.value=="0")
	{
		alert("The Start Date is missing");
		return false;
	}
	
	if(isDate(document.frmData.intStartDay.value+'/'+document.frmData.intStartMonth.value+'/'+document.frmData.intStartYear.value)==false)
	{
		alert("The Start Date does not appear to be a correct date")
		return false;
	}
	if  (document.frmData.intEndDay.value=="0" && document.frmData.intEndMonth.value!="0" && document.frmData.intEndYear.value!="0")
	{
		alert("The End Date is missing");
		return false;
	}
	if  (document.frmData.intEndDay.value=="0" && document.frmData.intEndMonth.value=="0" && document.frmData.intEndYear.value!="0")
	{
		alert("The End Date is missing");
		return false;
	}
	if  (document.frmData.intEndDay.value!="0" && document.frmData.intEndMonth.value=="0" && document.frmData.intEndYear.value=="0")
	{
		alert("The End Date is missing");
		return false;
	}
	if  (document.frmData.intEndDay.value!="0" && document.frmData.intEndMonth.value!="0" && document.frmData.intEndYear.value=="0")
	{
		alert("The End Date is missing");
		return false;
	}
	if  (document.frmData.intEndDay.value=="0" && document.frmData.intEndMonth.value!="0" && document.frmData.intEndYear.value=="0")
	{
		alert("The End Date is missing");
		return false;
	}
	if  (document.frmData.intEndDay.value!="0" && document.frmData.intEndMonth.value!="0" && document.frmData.intEndYear.value!="0")
	{
		if(isDate(document.frmData.intEndDay.value+'/'+document.frmData.intEndMonth.value+'/'+document.frmData.intEndYear.value)==false)
		{
			alert("The End Date does not appear to be a correct date");
			return false;
		}
	}
	if  (document.frmData.intEndDay.value!="0" && document.frmData.intEndMonth.value!="0" && document.frmData.intEndYear.value!="0")
	{
		var sd = (document.frmData.intStartDay.value)/1;
		var sm = (document.frmData.intStartMonth.value)/1;
		var sy = (document.frmData.intStartYear.value)/1;	  
		var ed = (document.frmData.intEndDay.value)/1;
		var em = (document.frmData.intEndMonth.value)/1;
		var ey = (document.frmData.intEndYear.value)/1;	  
		if(ey<sy)
		{
			alert("The start date is after the end date.")
			return false
		}
		else
		{
			if (sy==ey)
			{
				if(em<sm)
				{
					alert("The start date is after the end date.")
					return false
				}
				else
				{
					if (em==sm)
					{
						if (ed<=sd)
						{
							alert("The start date is after the end date.")
							return false
						}
					}
				}
			}
		}
	}
	var c=document.frmData.strDescription.value
	if (c.length>2000)
     {
       alert("The Length of Description must be 2000 characters or less"); 
        return false;
     }
    var e=document.frmData.strLatestInfoLink.value
	if (e.length>50)
     {
       alert("The Length of Link must be 50 characters or less"); 
        return false;
     }
	return true; 
}
function checkEventFestival()
    {   
	if  (document.frmData.strEventFestivalName.value=="")
      {
        alert("The Event Festival Name is mandatory!"); 
        return false;
      }
	if  (document.frmData.intCategoryId.value=="0")
      {
        alert("The Event Festival Category is mandatory!"); 
        return false;
      }
	if  (document.frmData.intFestivalTypeId.value=="0")
      {
        alert("The Event Festival Type is mandatory!"); 
        return false;
      }
	if(document.frmData.chkCountry.checked==false)
	{
		if(document.frmData.intGolfRegionId.value=="0")
		{
			alert("Please Select Golf Region!"); 
			return false;				
		}
	}	  
	if(document.frmData.intStartDay.value=="0" || document.frmData.intStartMonth.value=="0" || document.frmData.intStartYear.value=="0")
	{
		alert("The Start Date is missing");
		return false;
	}
	
	if(isDate(document.frmData.intStartDay.value+'/'+document.frmData.intStartMonth.value+'/'+document.frmData.intStartYear.value)==false)
	{
		alert("The Start Date does not appear to be a correct date")
		return false;
	}
	if  (document.frmData.intEndDay.value=="0" && document.frmData.intEndMonth.value!="0" && document.frmData.intEndYear.value!="0")
	{
		alert("The End Date is missing");
		return false;
	}
	if  (document.frmData.intEndDay.value=="0" && document.frmData.intEndMonth.value=="0" && document.frmData.intEndYear.value!="0")
	{
		alert("The End Date is missing");
		return false;
	}
	if  (document.frmData.intEndDay.value!="0" && document.frmData.intEndMonth.value=="0" && document.frmData.intEndYear.value=="0")
	{
		alert("The End Date is missing");
		return false;
	}
	if  (document.frmData.intEndDay.value!="0" && document.frmData.intEndMonth.value!="0" && document.frmData.intEndYear.value=="0")
	{
		alert("The End Date is missing");
		return false;
	}
	if  (document.frmData.intEndDay.value=="0" && document.frmData.intEndMonth.value!="0" && document.frmData.intEndYear.value=="0")
	{
		alert("The End Date is missing");
		return false;
	}
	if  (document.frmData.intEndDay.value!="0" && document.frmData.intEndMonth.value!="0" && document.frmData.intEndYear.value!="0")
	{
		if(isDate(document.frmData.intEndDay.value+'/'+document.frmData.intEndMonth.value+'/'+document.frmData.intEndYear.value)==false)
		{
			alert("The End Date does not appear to be a correct date");
			return false;
		}
	}
	if  (document.frmData.intEndDay.value!="0" && document.frmData.intEndMonth.value!="0" && document.frmData.intEndYear.value!="0")
	{
		var sd = (document.frmData.intStartDay.value)/1;
		var sm = (document.frmData.intStartMonth.value)/1;
		var sy = (document.frmData.intStartYear.value)/1;	  
		var ed = (document.frmData.intEndDay.value)/1;
		var em = (document.frmData.intEndMonth.value)/1;
		var ey = (document.frmData.intEndYear.value)/1;	  
		if(ey<sy)
		{
			alert("The start date is after the end date.")
			return false
		}
		else
		{
			if (sy==ey)
			{
				if(em<sm)
				{
					alert("The start date is after the end date.")
					return false
				}
				else
				{
					if (em==sm)
					{
						if (ed<=sd)
						{
							alert("The start date is after the end date.")
							return false
						}
					}
				}
			}
		}
	}
	var a=document.frmData.strDescription.value
	if (a.length>2000)
     {
       alert("The Length of Description must smaller than 2000 characters!"); 
        return false;
     }
	return true; 
}
function setGolfRegion()
{
	if(document.frmData.chkCountry.checked==false)
	{
		document.frmData.intGolfRegionId.disabled="";
	}
	else
	{
		document.frmData.intGolfRegionId.disabled="yes";
	}
}	


function setMarket()
{
	if  (document.frmData.lngMarketingSourceId.value=="0")
	{
		document.frmData.strMarketOther.disabled="";
	}
	else
	{
		document.frmData.strMarketOther.disabled="yes";
	}
}	
function checkAffSignin()
{
	if (document.frmData.strRefNo.value=="")
	{
		alert("Please enter your Reference Number!");
		return false;
	}	
	if (document.frmData.strPassword.value=="")
	{
		alert("Please enter your Password!");
		return false;
	}	
	return true;
}
function checkAffForgotpwd()
{
	if (document.frmData.strRefNo.value.length==0 && document.frmData.strEmail.value.length==0)
	{
		alert("Please enter your HGT Reference Number or eMail Address!");
		return false;
	}	
	var e=document.frmData.strEmail.value;
	if(e.length!=0)
	{
		if (checkEmailValid(e)!="0") 
		{
			alert(checkEmailValid(e));
			return false;	
		}
	}
	return true;
}

function checkDate()
{
	var selDate=document.frmData.strDateText.value;
	var utcDate=document.frmData.strUTCDate.value;

	if(Date.parse(selDate)<new Date())
	{
		document.frmData.strDateText.value="";
		alert("The Selected Date is historic!");
		return false;
	}
	if(Date.parse(selDate)<Date.parse(utcDate))
	{
		document.frmData.strDateText.value="";
		alert("A minimum of 2 days notice is required!");
		return false;
	}
}

function checkAffiliateApplies()
{   
	if(document.frmData.strBusinessName.value=="")
      {
		alert("Please enter your Business Name!");
        return false;
      }
	if(document.frmData.strContactName.value=="")
      {
		alert("Please enter your Contact Name!");
        return false;
      }
	var e=document.frmData.strEmail.value;
	if(e.length==0)
	{
		alert("Plase enter your eMail Address!");
		return false;
	}
	if (e!="")
	{
		if (checkEmailValid(e) !="0") 
		{
			alert(checkEmailValid(e));
			return false;	
		}
	}
	if (document.frmData.strComments.value.length > 500)
	{
		  alert("The length of Comments must be lesser than 500 characters.");
		  return false;
	 }		
	return true; 
}
function checkAffiliateDetails()
{   
	if(document.frmData.strContactName.value=="")
      {
		alert("Please enter your Contact Name!");
        return false;
      }
	var e=document.frmData.strEmail.value;
	if(e.length==0)
	{
		alert("Plase enter your eMail Address!");
		return false;
	}
	if (e!="")
	{
		if (checkEmailValid(e) !="0") 
		{
			alert(checkEmailValid(e));
			return false;	
		}
	}
	if (document.frmData.strPassword.value.length==0)
	{
	   alert("Please enter your Password!");
	   return false;
	}
	if (document.frmData.strConfPassword.value.length==0)
	{
	   alert("Please enter your Confirm Password!");
	   return false;
	}
	if (document.frmData.strPassword.value!=document.frmData.strConfPassword.value)
	{
	   alert("The Password and Confirm Password do not match!");
	   return false;
	}
	if (document.frmData.strComments.value.length > 500)
	{
		  alert("The length of Comments must be lesser than 500 characters.");
		  return false;
	 }		
	return true; 
}
