﻿// JScript File

var dtCh= "/";
var minYear=1900;
var maxYear=2100;
var whitespace = " \t\n\r";

function isEmpty(s)
{   return ((s == null) || (s.length == 0))
}

function isWhitespace (s)
{   var i;

    // Is s empty?
    if (isEmpty(s)) return true;

    // Search through string's characters one by one
    // until we find a non-whitespace character.
    // When we do, return false; if we don't, return true.

    for (i = 0; i < s.length; i++)
    {   
        // Check that current character isn't whitespace.
        var c = s.charAt(i);

        if (whitespace.indexOf(c) == -1) return false;
    }

    // All characters are whitespace.
    return true;
}

function isLetter (c)
{   return ( ((c >= "a") && (c <= "z")) || ((c >= "A") && (c <= "Z")) )
}

function isDigit (c)
{   return ((c >= "0") && (c <= "9"))
}

function isEmailChar (c)
{
	return ((c == ".") || (c == "_") || (c == "@") || (c == "-"))
}

function hasValidChars (s)
{   var i;

    // Search through string's characters one by one
    // until we find a non-alphanumeric character.
    // When we do, return false; if we don't, return true.

    for (i = 0; i < s.length; i++)
    {   
        // Check that current character is number or letter.
        var c = s.charAt(i);

        if (! (isLetter(c) || isDigit(c) || isEmailChar(c)) )
        return false;
    }

    // All characters are numbers or letters.
    return true;
}

function isEmail (s)
{
    // is s whitespace?
    if (isWhitespace(s)) return false;
    
    if (!hasValidChars(s)) return false;
    
    // there must be >= 1 character before @, so we
    // start looking at character position 1 
    // (i.e. second character)
    var i = 1;
    var sLength = s.length;

    // look for @
    while ((i < sLength) && (s.charAt(i) != "@"))
    { i++
    }

    if ((i >= sLength) || (s.charAt(i) != "@")) return false;
    else i += 2;

    // look for .
    while ((i < sLength) && (s.charAt(i) != "."))
    { i++
    }

    // there must be at least one character after the .
    if ((i >= sLength - 1) || (s.charAt(i) != ".")) return false;
    else return true;
}

function showDate()
{
  showDate=new Date();
}

function isInteger(s){
	var i;
    for (i = 0; i < s.length; i++){   
        // Check that current character is number.
        var c = s.charAt(i);
        if (((c < "0") || (c > "9"))) return false;
    }
    // All characters are numbers.
    return true;
}

function stripCharsInBag(s, bag){
	var i;
    var returnString = "";
    // Search through string's characters one by one.
    // If character is not in bag, append to returnString.
    for (i = 0; i < s.length; i++){   
        var c = s.charAt(i);
        if (bag.indexOf(c) == -1) returnString += c;
    }
    return returnString;
}

function daysInFebruary (year){
	// February has 29 days in any year evenly divisible by four,
    // EXCEPT for centurial years which are not also divisible by 400.
    return (((year % 4 == 0) && ( (!(year % 100 == 0)) || (year % 400 == 0))) ? 29 : 28 );
}
function DaysArray(n) {
	for (var i = 1; i <= n; i++) {
		this[i] = 31
		if (i==4 || i==6 || i==9 || i==11) {this[i] = 30}
		if (i==2) {this[i] = 29}
   } 
   return this
}

function isDate(dtStr)
{
	var daysInMonth = DaysArray(12);
	var pos1=dtStr.indexOf(dtCh);
	var pos2=dtStr.indexOf(dtCh,pos1+1);
	var strDay=dtStr.substring(0,pos1);
	var strMonth=dtStr.substring(pos1+1,pos2);
	var strYear=dtStr.substring(pos2+1);
	strYr=strYear;
	if (strDay.charAt(0)=="0" && strDay.length>1) strDay=strDay.substring(1);
	if (strMonth.charAt(0)=="0" && strMonth.length>1) strMonth=strMonth.substring(1);
	for (var i = 1; i <= 3; i++) 
	{
		if (strYr.charAt(0)=="0" && strYr.length>1) strYr=strYr.substring(1);
	}
	month=parseInt(strMonth);
	day=parseInt(strDay);
	year=parseInt(strYr);
	if (pos1==-1 || pos2==-1)
	{
		alert("The date format should be : dd/mm/yyyy");
		return false;
	}
	if (strMonth.length<1 || month<1 || month>12)
	{
		alert("Please enter a valid month");
		return false;
	}
	if (strDay.length<1 || day<1 || day>31 || (month==2 && day>daysInFebruary(year)) || day > daysInMonth[month])
	{
		alert("Please enter a valid day");
		return false;
	}
	if (strYear.length != 4 || year==0 || year<minYear || year>maxYear)
	{
		alert("Please enter a valid 4 digit year between "+minYear+" and "+maxYear);
		return false;
	}
	if (dtStr.indexOf(dtCh,pos2+1)!=-1 || isInteger(stripCharsInBag(dtStr, dtCh))==false)
	{
		alert("Please enter a valid date");
		return false;
	}
}

function checkForm()
{
  var errorColor="#FFFF00";
  var color="#FFFFFF";
  document.form1.Email.style.background=color;
  document.form1.Password.style.background=color;

  if (document.form1.Email.value == ""){ 
       alert("Please, enter your email address."); 
       document.form1.Email.style.background=errorColor;
       document.form1.Email.focus();
       return false;
  }
  if (!isEmail(window.document.form1.Email.value)) {
       alert("Please, enter a valid email address.");
       document.form1.Email.style.background=errorColor;
       document.form1.Email.focus();
       return false;
  }
  if (document.form1.Password.value == ""){ 
       alert("Enter your Password please."); 
       document.form1.Password.style.background=errorColor;
       document.form1.Password.focus();
       return false;
  }
  if (document.form1.Password.value.length < 6) {
  	   alert("Your password should be at least 6 characters long.");
       document.form1.Password.focus();
       document.form1.Password.style.background=errorColor;
	   return false;
  }
}

function checkForm1()
{
  var errorColor="#FFFF00";
  var color="#FFFFFF";
  document.form2.Email.style.background=color;
  document.form2.Password.style.background=color;

  if (document.form2.Email.value == ""){ 
       alert("Please, enter your email address."); 
       document.form2.Email.style.background=errorColor;
       document.form2.Email.focus();
       return false;
  }
  if (!isEmail(window.document.form2.Email.value)) {
       alert("Please, enter a valid email address.");
       document.form2.Email.style.background=errorColor;
       document.form2.Email.focus();
       return false;
  }
  if (document.form2.Password.value == ""){ 
       alert("Enter your Password please."); 
       document.form2.Password.style.background=errorColor;
       document.form2.Password.focus();
       return false;
  }
  if (document.form2.Password.value.length < 6) {
  	   alert("Your password should be at least 6 characters long.");
       document.form2.Password.focus();
       document.form2.Password.style.background=errorColor;
	   return false;
  }
}

function checkDateForSearch()
{
    var valuecheck;

    valuecheck = document.form1.strDay.value + "/" + document.form1.strMonth.value + "/" + document.form1.strYear.value;
    if (isDate(valuecheck)==false)
	{
	     return false;
    }
}

function checkCommission()
{
  var errorColor="#FFFF00";
  var color="#FFFFFF";
  document.aspnetForm.ctl00$ContentPlaceHolder1$fltCommission.style.background=color;

  if (document.aspnetForm.ctl00$ContentPlaceHolder1$fltCommission.value == "")
  { 
       alert("Enter commission please.");
       document.aspnetForm.ctl00$ContentPlaceHolder1$fltCommission.style.background=errorColor;
       document.aspnetForm.ctl00$ContentPlaceHolder1$fltCommission.focus();
       return false;
  }
}

function checkHotelDetails()
{
  var errorColor="#FFFF00";
  var color="#FFFFFF";
  document.aspnetForm.ctl00$ContentPlaceHolder1$strHotelName.style.background=color;
  document.aspnetForm.ctl00$ContentPlaceHolder1$intStarsNumber.style.background=color;
  document.aspnetForm.ctl00$ContentPlaceHolder1$strFirstName.style.background=color;
  document.aspnetForm.ctl00$ContentPlaceHolder1$strLastName.style.background=color;
  document.aspnetForm.ctl00$ContentPlaceHolder1$strAddress.style.background=color;
  document.aspnetForm.ctl00$ContentPlaceHolder1$strCity.style.background=color;
  document.aspnetForm.ctl00$ContentPlaceHolder1$strPhone.style.background=color;
  document.aspnetForm.ctl00$ContentPlaceHolder1$strEmail.style.background=color;
  document.aspnetForm.ctl00$ContentPlaceHolder1$strAgentDetails.style.background=color;
  document.aspnetForm.ctl00$ContentPlaceHolder1$fltCommision.style.background=color;
//  document.aspnetForm.ctl00$ContentPlaceHolder1$strDescription.style.background=color;
//  document.aspnetForm.ctl00$ContentPlaceHolder1$strLongDescription.style.background=color;
//  document.aspnetForm.ctl00$ContentPlaceHolder1$strCancellation.style.background=color;
  
  if (document.aspnetForm.ctl00$ContentPlaceHolder1$strHotelName.value == "")
  { 
       alert("Enter hotel name, please.");
       document.aspnetForm.ctl00$ContentPlaceHolder1$strHotelName.style.background=errorColor;
       document.aspnetForm.ctl00$ContentPlaceHolder1$strHotelName.focus();
       return false;
  }
  if (document.aspnetForm.ctl00$ContentPlaceHolder1$intStarsNumber.value == "")
  { 
       alert("Enter number of stars, please.");
       document.aspnetForm.ctl00$ContentPlaceHolder1$intStarsNumber.style.background=errorColor;
       document.aspnetForm.ctl00$ContentPlaceHolder1$intStarsNumber.focus();
       return false;
  }
  if (isNaN(document.aspnetForm.ctl00$ContentPlaceHolder1$intStarsNumber.value))
  { 
       alert("Number of stars must be a number.");
       document.aspnetForm.ctl00$ContentPlaceHolder1$intStarsNumber.style.background=errorColor;
       document.aspnetForm.ctl00$ContentPlaceHolder1$intStarsNumber.focus();
       return false;
  }
  if (document.aspnetForm.ctl00$ContentPlaceHolder1$strFirstName.value == "")
  { 
       alert("Enter first name, please.");
       document.aspnetForm.ctl00$ContentPlaceHolder1$strFirstName.style.background=errorColor;
       document.aspnetForm.ctl00$ContentPlaceHolder1$strFirstName.focus();
       return false;
  }
  if (document.aspnetForm.ctl00$ContentPlaceHolder1$strLastName.value == "")
  { 
       alert("Enter last name, please.");
       document.aspnetForm.ctl00$ContentPlaceHolder1$strLastName.style.background=errorColor;
       document.aspnetForm.ctl00$ContentPlaceHolder1$strLastName.focus();
       return false;
  }
  if (document.aspnetForm.ctl00$ContentPlaceHolder1$strAddress.value == "")
  { 
       alert("Enter address, please.");
       document.aspnetForm.ctl00$ContentPlaceHolder1$strAddress.style.background=errorColor;
       document.aspnetForm.ctl00$ContentPlaceHolder1$strAddress.focus();
       return false;
  }
  if (document.aspnetForm.ctl00$ContentPlaceHolder1$strCity.value == "")
  { 
       alert("Enter city, please.");
       document.aspnetForm.ctl00$ContentPlaceHolder1$strCity.style.background=errorColor;
       document.aspnetForm.ctl00$ContentPlaceHolder1$strCity.focus();
       return false;
  }
  if (document.aspnetForm.ctl00$ContentPlaceHolder1$strPhone.value == "")
  { 
       alert("Enter phone number, please.");
       document.aspnetForm.ctl00$ContentPlaceHolder1$strPhone.style.background=errorColor;
       document.aspnetForm.ctl00$ContentPlaceHolder1$strPhone.focus();
       return false;
  }
  if (document.aspnetForm.ctl00$ContentPlaceHolder1$strEmail.value == "")
  { 
       alert("Enter email address, please.");
       document.aspnetForm.ctl00$ContentPlaceHolder1$strEmail.style.background=errorColor;
       document.aspnetForm.ctl00$ContentPlaceHolder1$strEmail.focus();
       return false;
  }
  if (!isEmail(window.document.aspnetForm.ctl00$ContentPlaceHolder1$strEmail.value)) 
  {
		alert("Enter a valid email address.");
        document.aspnetForm.ctl00$ContentPlaceHolder1$strEmail.style.background=errorColor;
        document.aspnetForm.ctl00$ContentPlaceHolder1$strEmail.focus();
        return false;
   }
  if (document.aspnetForm.ctl00$ContentPlaceHolder1$strAgentDetails.value == "")
  { 
       alert("Enter agent details, please.");
       document.aspnetForm.ctl00$ContentPlaceHolder1$strAgentDetails.style.background=errorColor;
       document.aspnetForm.ctl00$ContentPlaceHolder1$strAgentDetails.focus();
       return false;
  }
  if (document.aspnetForm.ctl00$ContentPlaceHolder1$fltCommision.value == "")
  { 
       alert("Enter commission, please.");
       document.aspnetForm.ctl00$ContentPlaceHolder1$fltCommision.style.background=errorColor;
       document.aspnetForm.ctl00$ContentPlaceHolder1$fltCommision.focus();
       return false;
  }
  if (isNaN(document.aspnetForm.ctl00$ContentPlaceHolder1$fltCommision.value))
  { 
       alert("Enter a valid number for commission.");
       document.aspnetForm.ctl00$ContentPlaceHolder1$fltCommision.style.background=errorColor;
       document.aspnetForm.ctl00$ContentPlaceHolder1$fltCommision.focus();
       return false;
  }
/*
  if (document.aspnetForm.ctl00$ContentPlaceHolder1$strDescription.value == "")
  { 
       alert("Enter short description, please.");
       document.aspnetForm.ctl00$ContentPlaceHolder1$strDescription.style.background=errorColor;
       document.aspnetForm.ctl00$ContentPlaceHolder1$strDescription.focus();
       return false;
  }
  if (document.aspnetForm.ctl00$ContentPlaceHolder1$strLongDescription.value == "")
  { 
       alert("Enter long description, please.");
       document.aspnetForm.ctl00$ContentPlaceHolder1$strLongDescription.style.background=errorColor;
       document.aspnetForm.ctl00$ContentPlaceHolder1$strLongDescription.focus();
       return false;
  }
  if (document.aspnetForm.ctl00$ContentPlaceHolder1$strCancellation.value == "")
  { 
       alert("Enter cancellation policy, please.");
       document.aspnetForm.ctl00$ContentPlaceHolder1$strCancellation.style.background=errorColor;
       document.aspnetForm.ctl00$ContentPlaceHolder1$strCancellation.focus();
       return false;
  }
  */
}

function checkHotelDetails1()
{
  var errorColor="#FFFF00";
  var color="#FFFFFF";
  document.aspnetForm.ctl00_ContentPlaceHolder1_strHotelName.style.background=color;
  document.aspnetForm.ctl00_ContentPlaceHolder1_intStarsNumber.style.background=color;
  document.aspnetForm.ctl00_ContentPlaceHolder1_strFirstName.style.background=color;
  document.aspnetForm.ctl00_ContentPlaceHolder1_strLastName.style.background=color;
  document.aspnetForm.ctl00_ContentPlaceHolder1_strAddress.style.background=color;
  document.aspnetForm.ctl00_ContentPlaceHolder1_strCity.style.background=color;
  document.aspnetForm.ctl00_ContentPlaceHolder1_strPhone.style.background=color;
  document.aspnetForm.ctl00_ContentPlaceHolder1_strEmail.style.background=color;
  document.aspnetForm.ctl00_ContentPlaceHolder1_strAgentDetails.style.background=color;
  document.aspnetForm.ctl00_ContentPlaceHolder1_strDescription.style.background=color;
  document.aspnetForm.ctl00_ContentPlaceHolder1_strLongDescription.style.background=color;
  document.aspnetForm.ctl00_ContentPlaceHolder1_strCancellation.style.background=color;
  
  if (document.aspnetForm.ctl00_ContentPlaceHolder1_strHotelName.value == "")
  { 
       alert("Enter hotel name, please.");
       document.aspnetForm.ctl00_ContentPlaceHolder1_strHotelName.style.background=errorColor;
       document.aspnetForm.ctl00_ContentPlaceHolder1_strHotelName.focus();
       return false;
  }
  if (document.aspnetForm.ctl00_ContentPlaceHolder1_intStarsNumber.value == "")
  { 
       alert("Enter number of stars, please.");
       document.aspnetForm.ctl00_ContentPlaceHolder1_intStarsNumber.style.background=errorColor;
       document.aspnetForm.ctl00_ContentPlaceHolder1_intStarsNumber.focus();
       return false;
  }
  if (isNaN(document.aspnetForm.ctl00_ContentPlaceHolder1_intStarsNumber.value))
  { 
       alert("Number of stars must be a number.");
       document.aspnetForm.ctl00_ContentPlaceHolder1_intStarsNumber.style.background=errorColor;
       document.aspnetForm.ctl00_ContentPlaceHolder1_intStarsNumber.focus();
       return false;
  }
  if (document.aspnetForm.ctl00_ContentPlaceHolder1_strFirstName.value == "")
  { 
       alert("Enter first name, please.");
       document.aspnetForm.ctl00_ContentPlaceHolder1_strFirstName.style.background=errorColor;
       document.aspnetForm.ctl00_ContentPlaceHolder1_strFirstName.focus();
       return false;
  }
  if (document.aspnetForm.ctl00_ContentPlaceHolder1_strLastName.value == "")
  { 
       alert("Enter last name, please.");
       document.aspnetForm.ctl00_ContentPlaceHolder1_strLastName.style.background=errorColor;
       document.aspnetForm.ctl00_ContentPlaceHolder1_strLastName.focus();
       return false;
  }
  if (document.aspnetForm.ctl00_ContentPlaceHolder1_strAddress.value == "")
  { 
       alert("Enter address, please.");
       document.aspnetForm.ctl00_ContentPlaceHolder1_strAddress.style.background=errorColor;
       document.aspnetForm.ctl00_ContentPlaceHolder1_strAddress.focus();
       return false;
  }
  if (document.aspnetForm.ctl00_ContentPlaceHolder1_strCity.value == "")
  { 
       alert("Enter city, please.");
       document.aspnetForm.ctl00_ContentPlaceHolder1_strCity.style.background=errorColor;
       document.aspnetForm.ctl00_ContentPlaceHolder1_strCity.focus();
       return false;
  }
  if (document.aspnetForm.ctl00_ContentPlaceHolder1_strPhone.value == "")
  { 
       alert("Enter phone number, please.");
       document.aspnetForm.ctl00_ContentPlaceHolder1_strPhone.style.background=errorColor;
       document.aspnetForm.ctl00_ContentPlaceHolder1_strPhone.focus();
       return false;
  }
  if (document.aspnetForm.ctl00_ContentPlaceHolder1_strEmail.value == "")
  { 
       alert("Enter email address, please.");
       document.aspnetForm.ctl00_ContentPlaceHolder1_strEmail.style.background=errorColor;
       document.aspnetForm.ctl00_ContentPlaceHolder1_strEmail.focus();
       return false;
  }
  if (!isEmail(window.document.aspnetForm.ctl00_ContentPlaceHolder1_strEmail.value)) 
  {
		alert("Enter a valid email address.");
        document.aspnetForm.ctl00_ContentPlaceHolder1_strEmail.style.background=errorColor;
        document.aspnetForm.ctl00_ContentPlaceHolder1_strEmail.focus();
        return false;
   }
  if (document.aspnetForm.ctl00_ContentPlaceHolder1_strAgentDetails.value == "")
  { 
       alert("Enter agent details, please.");
       document.aspnetForm.ctl00_ContentPlaceHolder1_strAgentDetails.style.background=errorColor;
       document.aspnetForm.ctl00_ContentPlaceHolder1_strAgentDetails.focus();
       return false;
  }
  if (document.aspnetForm.ctl00_ContentPlaceHolder1_strDescription.value == "")
  { 
       alert("Enter short description, please.");
       document.aspnetForm.ctl00_ContentPlaceHolder1_strDescription.style.background=errorColor;
       document.aspnetForm.ctl00_ContentPlaceHolder1_strDescription.focus();
       return false;
  }
  if (document.aspnetForm.ctl00_ContentPlaceHolder1_strLongDescription.value == "")
  { 
       alert("Enter long description, please.");
       document.aspnetForm.ctl00_ContentPlaceHolder1_strLongDescription.style.background=errorColor;
       document.aspnetForm.ctl00_ContentPlaceHolder1_strLongDescription.focus();
       return false;
  }
  if (document.aspnetForm.ctl00_ContentPlaceHolder1_strCancellation.value == "")
  { 
       alert("Enter cancellation policy, please.");
       document.aspnetForm.ctl00_ContentPlaceHolder1_strCancellation.style.background=errorColor;
       document.aspnetForm.ctl00_ContentPlaceHolder1_strCancellation.focus();
       return false;
  }
}

function checkSettingsForm()
{
  var errorColor="#FFFF00";
  var color="#FFFFFF";
  document.aspnetForm.ctl00$ContentPlaceHolder1$fltDiscountPercentage.style.background=color;
  
  if (document.aspnetForm.ctl00$ContentPlaceHolder1$fltDiscountPercentage.value == "")
  { 
       alert("Enter minimum discount percentage, please.");
       document.aspnetForm.ctl00$ContentPlaceHolder1$fltDiscountPercentage.style.background=errorColor;
       document.aspnetForm.ctl00$ContentPlaceHolder1$fltDiscountPercentage.focus();
       return false;
  }
  if (isNaN(document.aspnetForm.ctl00$ContentPlaceHolder1$fltDiscountPercentage.value))
  { 
       alert("Enter a valid number for discount percentage.");
       document.aspnetForm.ctl00$ContentPlaceHolder1$fltDiscountPercentage.style.background=errorColor;
       document.aspnetForm.ctl00$ContentPlaceHolder1$fltDiscountPercentage.focus();
       return false;
  }  
}

function checkUserDetails()
{
  var errorColor="#FFFF00";
  var color="#FFFFFF";
  document.aspnetForm.ctl00$ContentPlaceHolder1$strFirstName.style.background=color;
  document.aspnetForm.ctl00$ContentPlaceHolder1$strLastName.style.background=color;
  document.aspnetForm.ctl00$ContentPlaceHolder1$strAddress.style.background=color;
  document.aspnetForm.ctl00$ContentPlaceHolder1$strCity.style.background=color;
  document.aspnetForm.ctl00$ContentPlaceHolder1$strPhone.style.background=color;
  document.aspnetForm.ctl00$ContentPlaceHolder1$strEmail.style.background=color;
  document.aspnetForm.ctl00$ContentPlaceHolder1$strPassword.style.background=color;
  document.aspnetForm.ctl00$ContentPlaceHolder1$strRepeatPassword.style.background=color;

  if (document.aspnetForm.ctl00$ContentPlaceHolder1$strFirstName.value == "")
  { 
       alert("Enter first name, please.");
       document.aspnetForm.ctl00$ContentPlaceHolder1$strFirstName.style.background=errorColor;
       document.aspnetForm.ctl00$ContentPlaceHolder1$strFirstName.focus();
       return false;
  }
  if (document.aspnetForm.ctl00$ContentPlaceHolder1$strLastName.value == "")
  { 
       alert("Enter last name, please.");
       document.aspnetForm.ctl00$ContentPlaceHolder1$strLastName.style.background=errorColor;
       document.aspnetForm.ctl00$ContentPlaceHolder1$strLastName.focus();
       return false;
  }
  if (document.aspnetForm.ctl00$ContentPlaceHolder1$strAddress.value == "")
  { 
       alert("Enter address, please.");
       document.aspnetForm.ctl00$ContentPlaceHolder1$strAddress.style.background=errorColor;
       document.aspnetForm.ctl00$ContentPlaceHolder1$strAddress.focus();
       return false;
  }
  if (document.aspnetForm.ctl00$ContentPlaceHolder1$strCity.value == "")
  { 
       alert("Enter city, please.");
       document.aspnetForm.ctl00$ContentPlaceHolder1$strCity.style.background=errorColor;
       document.aspnetForm.ctl00$ContentPlaceHolder1$strCity.focus();
       return false;
  }
  if (document.aspnetForm.ctl00$ContentPlaceHolder1$strPhone.value == "")
  { 
       alert("Enter phone number, please.");
       document.aspnetForm.ctl00$ContentPlaceHolder1$strPhone.style.background=errorColor;
       document.aspnetForm.ctl00$ContentPlaceHolder1$strPhone.focus();
       return false;
  }
  if (document.aspnetForm.ctl00$ContentPlaceHolder1$strEmail.value == "")
  { 
       alert("Enter email address, please.");
       document.aspnetForm.ctl00$ContentPlaceHolder1$strEmail.style.background=errorColor;
       document.aspnetForm.ctl00$ContentPlaceHolder1$strEmail.focus();
       return false;
  }
  if (!isEmail(window.document.aspnetForm.ctl00$ContentPlaceHolder1$strEmail.value)) 
  {
		alert("Enter a valid email address.");
        document.aspnetForm.ctl00$ContentPlaceHolder1$strEmail.style.background=errorColor;
        document.aspnetForm.ctl00$ContentPlaceHolder1$strEmail.focus();
        return false;
   }
  if (!document.aspnetForm.ctl00$ContentPlaceHolder1$strPassword.value == "")
  { 
    if (document.aspnetForm.ctl00$ContentPlaceHolder1$strPassword.value.length < 6) {
   	   alert("Your password should be at least 6 characters long.");
       document.aspnetForm.ctl00$ContentPlaceHolder1$strPassword.focus();
       document.aspnetForm.ctl00$ContentPlaceHolder1$strPassword.style.background=errorColor;
	   return false;
    }
    if (document.aspnetForm.ctl00$ContentPlaceHolder1$strRepeatPassword.value == "")
    { 
       alert("Re-type password, please.");
       document.aspnetForm.ctl00$ContentPlaceHolder1$strRepeatPassword.style.background=errorColor;
       document.aspnetForm.ctl00$ContentPlaceHolder1$strRepeatPassword.focus();
       return false;
    }
    if (document.aspnetForm.ctl00$ContentPlaceHolder1$strPassword.value != document.aspnetForm.ctl00$ContentPlaceHolder1$strRepeatPassword.value)
    {
	   alert("Passwords do not match.");
       document.aspnetForm.ctl00$ContentPlaceHolder1$strRepeatPassword.focus();
       document.aspnetForm.ctl00$ContentPlaceHolder1$strRepeatPassword.style.background=errorColor;
	   return false;
    }
  }
}

function checkTravellerDetails()
{
  var errorColor="#FFFF00";
  var color="#FFFFFF";
  document.form2.strFirstName.style.background=color;
  document.form2.strLastName.style.background=color;
  document.form2.strAddress.style.background=color;
  document.form2.strCity.style.background=color;
  document.form2.strPhone.style.background=color;
  document.form2.strEmail.style.background=color;
  document.form2.strPassword.style.background=color;
  document.form2.strRepeatPassword.style.background=color;

  if (document.form2.strFirstName.value == "")
  { 
       alert("Enter first name, please.");
       document.form2.strFirstName.style.background=errorColor;
       document.form2.strFirstName.focus();
       return false;
  }
  if (document.form2.strLastName.value == "")
  { 
       alert("Enter last name, please.");
       document.form2.strLastName.style.background=errorColor;
       document.form2.strLastName.focus();
       return false;
  }
  if (document.form2.strAddress.value == "")
  { 
       alert("Enter address, please.");
       document.form2.strAddress.style.background=errorColor;
       document.form2.strAddress.focus();
       return false;
  }
  if (document.form2.strCity.value == "")
  { 
       alert("Enter city, please.");
       document.form2.strCity.style.background=errorColor;
       document.form2.strCity.focus();
       return false;
  }
  if (document.form2.strPhone.value == "")
  { 
       alert("Enter phone number, please.");
       document.form2.strPhone.style.background=errorColor;
       document.form2.strPhone.focus();
       return false;
  }
  if (document.form2.strEmail.value == "")
  { 
       alert("Enter email address, please.");
       document.form2.strEmail.style.background=errorColor;
       document.form2.strEmail.focus();
       return false;
  }
  if (!isEmail(window.document.form2.strEmail.value)) 
  {
		alert("Enter a valid email address.");
        document.form2.strEmail.style.background=errorColor;
        document.form2.strEmail.focus();
        return false;
   }
  if (document.form2.strPassword.value == "")
  { 
       alert("Enter password, please.");
       document.form2.strPassword.style.background=errorColor;
       document.form2.strPassword.focus();
       return false;
  }
  if (document.form2.strPassword.value.length < 6) {
   	   alert("Your password should be at least 6 characters long.");
       document.form2.strPassword.focus();
       document.form2.strPassword.style.background=errorColor;
	   return false;
  }
  if (document.form2.strRepeatPassword.value == "")
  { 
       alert("Re-type password, please.");
       document.form2.strRepeatPassword.style.background=errorColor;
       document.form2.strRepeatPassword.focus();
       return false;
  }
  if (document.form2.strPassword.value != document.form2.ctl00$ContentPlaceHolder1$strRepeatPassword.value)
  {
	   alert("Passwords do not match.");
       document.form2.strRepeatPassword.focus();
       document.form2.strRepeatPassword.style.background=errorColor;
	   return false;
  }
}

function checkSignUp()
{
  var errorColor="#FFFF00";
  var color="#FFFFFF";
  document.form2.strFirstName.style.background=color;
  document.form2.strLastName.style.background=color;
  document.form2.strAddress.style.background=color;
  document.form2.strCity.style.background=color;
  document.form2.strPhone.style.background=color;
  document.form2.strEmail.style.background=color;
  document.form2.strPassword.style.background=color;
  document.form2.strRepeatPassword.style.background=color;
  
  if (document.form2.strFirstName.value == "")
  { 
       alert("Enter first name, please.");
       document.form2.strFirstName.style.background=errorColor;
       document.form2.strFirstName.focus();
       return false;
  }
  if (document.form2.strLastName.value == "")
  { 
       alert("Enter last name, please.");
       document.form2.strLastName.style.background=errorColor;
       document.form2.strLastName.focus();
       return false;
  }
  if (document.form2.strFirstName.value == "")
  { 
       alert("Enter first name, please.");
       document.form2.strFirstName.style.background=errorColor;
       document.form2.strFirstName.focus();
       return false;
  }
  if (document.form2.strAddress.value == "")
  { 
       alert("Enter address, please.");
       document.form2.strAddress.style.background=errorColor;
       document.form2.strAddress.focus();
       return false;
  }
  if (document.form2.strCity.value == "")
  { 
       alert("Enter city, please.");
       document.form2.strCity.style.background=errorColor;
       document.form2.strCity.focus();
       return false;
  }
  if (document.form2.strPhone.value == "")
  { 
       alert("Enter phone, please.");
       document.form2.strPhone.style.background=errorColor;
       document.form2.strPhone.focus();
       return false;
  }
  if (document.form2.strEmail.value == "")
  { 
       alert("Enter email, please.");
       document.form2.strEmail.style.background=errorColor;
       document.form2.strEmail.focus();
       return false;
  }
  if (!isEmail(window.document.form2.strEmail.value)) 
  {
		alert("Enter a valid email address.");
        document.form2.strEmail.style.background=errorColor;
        document.form2.strEmail.focus();
        return false;
  }
  if (document.form2.strPassword.value == "")
  { 
       alert("Enter password, please.");
       document.form2.strPassword.style.background=errorColor;
       document.form2.strPassword.focus();
       return false;
  }
  if (document.form2.strPassword.value.length < 6) {
   	   alert("Your password should be at least 6 characters long.");
       document.form2.strPassword.focus();
       document.form2.strPassword.style.background=errorColor;
	   return false;
  }
  if (document.form2.strRepeatPassword.value == "")
  { 
       alert("Re-type password, please.");
       document.form2.strRepeatPassword.style.background=errorColor;
       document.form2.strRepeatPassword.focus();
       return false;
  }
  if (document.form2.strPassword.value != document.form2.strRepeatPassword.value)
  {
	   alert("Passwords do not match.");
       document.form2.strRepeatPassword.focus();
       document.form2.strRepeatPassword.style.background=errorColor;
	   return false;
  }
}

function checkSignUpHotel()
{
  var errorColor="#FFFF00";
  var color="#FFFFFF";
  document.form2.strFirstName.style.background=color;
  document.form2.strLastName.style.background=color;
  document.form2.strAddress.style.background=color;
  document.form2.strCity.style.background=color;
  document.form2.strPhone.style.background=color;
  document.form2.strEmail.style.background=color;
  document.form2.strPassword.style.background=color;
  document.form2.strRepeatPassword.style.background=color;

  document.form2.HotelName.style.background=color;
  document.form2.intStarsNumber.style.background=color;
  document.form2.strContactFirstName.style.background=color;
  document.form2.strContactLastName.style.background=color;
  document.form2.strHotelAddress.style.background=color;
  document.form2.strHotelCity.style.background=color;
  document.form2.strHotelPhone.style.background=color;
  document.form2.strHotelEmail.style.background=color;
  document.form2.strAgentDetails.style.background=color;
  
  if (document.form2.strFirstName.value == "")
  { 
       alert("Enter first name, please.");
       document.form2.strFirstName.style.background=errorColor;
       document.form2.strFirstName.focus();
       return false;
  }
  if (document.form2.strLastName.value == "")
  { 
       alert("Enter last name, please.");
       document.form2.strLastName.style.background=errorColor;
       document.form2.strLastName.focus();
       return false;
  }
  if (document.form2.strFirstName.value == "")
  { 
       alert("Enter first name, please.");
       document.form2.strFirstName.style.background=errorColor;
       document.form2.strFirstName.focus();
       return false;
  }
  if (document.form2.strAddress.value == "")
  { 
       alert("Enter address, please.");
       document.form2.strAddress.style.background=errorColor;
       document.form2.strAddress.focus();
       return false;
  }
  if (document.form2.strCity.value == "")
  { 
       alert("Enter city, please.");
       document.form2.strCity.style.background=errorColor;
       document.form2.strCity.focus();
       return false;
  }
  if (document.form2.strPhone.value == "")
  { 
       alert("Enter phone, please.");
       document.form2.strPhone.style.background=errorColor;
       document.form2.strPhone.focus();
       return false;
  }
  if (document.form2.strEmail.value == "")
  { 
       alert("Enter email, please.");
       document.form2.strEmail.style.background=errorColor;
       document.form2.strEmail.focus();
       return false;
  }
  if (!isEmail(window.document.form2.strEmail.value)) 
  {
		alert("Enter a valid email address.");
        document.form2.strEmail.style.background=errorColor;
        document.form2.strEmail.focus();
        return false;
  }
  if (document.form2.strPassword.value == "")
  { 
       alert("Enter password, please.");
       document.form2.strPassword.style.background=errorColor;
       document.form2.strPassword.focus();
       return false;
  }
  if (document.form2.strPassword.value.length < 6) {
   	   alert("Your password should be at least 6 characters long.");
       document.form2.strPassword.focus();
       document.form2.strPassword.style.background=errorColor;
	   return false;
  }
  if (document.form2.strRepeatPassword.value == "")
  { 
       alert("Re-type password, please.");
       document.form2.strRepeatPassword.style.background=errorColor;
       document.form2.strRepeatPassword.focus();
       return false;
  }
  if (document.form2.strPassword.value != document.form2.strRepeatPassword.value)
  {
	   alert("Passwords do not match.");
       document.form2.strRepeatPassword.focus();
       document.form2.strRepeatPassword.style.background=errorColor;
	   return false;
  }
  if (document.form2.HotelName.value == "")
  { 
       alert("Enter hotel name, please.");
       document.form2.HotelName.style.background=errorColor;
       document.form2.HotelName.focus();
       return false;
  }
  if (document.form2.intStarsNumber.value == "")
  { 
       alert("Enter number of stars for hotel, please.");
       document.form2.intStarsNumber.style.background=errorColor;
       document.form2.intStarsNumber.focus();
       return false;
  }
  if (isNaN(document.form2.intStarsNumber.value))
  { 
       alert("Enter a valid number for number of stars.");
       document.form2.intStarsNumber.style.background=errorColor;
       document.form2.intStarsNumber.focus();
       return false;
  }  
  if (document.form2.strContactFirstName.value == "")
  { 
       alert("Enter contact's first name, please.");
       document.form2.strContactFirstName.style.background=errorColor;
       document.form2.strContactFirstName.focus();
       return false;
  }
  if (document.form2.strContactLastName.value == "")
  { 
       alert("Enter contact's last name, please.");
       document.form2.strContactLastName.style.background=errorColor;
       document.form2.strContactLastName.focus();
       return false;
  }
  if (document.form2.strHotelAddress.value == "")
  { 
       alert("Enter hotel address, please.");
       document.form2.strHotelAddress.style.background=errorColor;
       document.form2.strHotelAddress.focus();
       return false;
  }
  if (document.form2.strHotelCity.value == "")
  { 
       alert("Enter hotel city, please.");
       document.form2.strHotelCity.style.background=errorColor;
       document.form2.strHotelCity.focus();
       return false;
  }
  if (document.form2.strHotelPhone.value == "")
  { 
       alert("Enter hotel phone, please.");
       document.form2.strHotelPhone.style.background=errorColor;
       document.form2.strHotelPhone.focus();
       return false;
  }
  if (document.form2.strHotelEmail.value == "")
  { 
       alert("Enter hotel email address, please.");
       document.form2.strHotelEmail.style.background=errorColor;
       document.form2.strHotelEmail.focus();
       return false;
  }
  if (!isEmail(window.document.form2.strHotelEmail.value)) 
  {
		alert("Enter a valid email address.");
        document.form2.strHotelEmail.style.background=errorColor;
        document.form2.strHotelEmail.focus();
        return false;
  }
  if (document.form2.strAgentDetails.value == "")
  { 
       alert("Enter agent details, please.");
       document.form2.strAgentDetails.style.background=errorColor;
       document.form2.strAgentDetails.focus();
       return false;
  }
}

function checkBooking()
{
  var errorColor="#FFFF00";
  var color="#FFFFFF";
  document.form2.strFirstName.style.background=color;
  document.form2.strLastName.style.background=color;
  document.form2.strAddress.style.background=color;
  document.form2.strCity.style.background=color;
  document.form2.strPhone.style.background=color;
  document.form2.strEmail.style.background=color;
  document.form2.strNameOnCard.style.background=color;
  document.form2.strCCNumber.style.background=color;
  document.form2.strIssueNumber.style.background=color;
  document.form2.strCVV.style.background=color;
  document.form2.strBillingAddress.style.background=color;
  document.form2.strBillingCity.style.background=color;
  document.form2.strBillingPostalCode.style.background=color;
  
  if (document.form2.strFirstName.value == "")
  { 
       alert("Enter first name, please.");
       document.form2.strFirstName.style.background=errorColor;
       document.form2.strFirstName.focus();
       return false;
  }
  if (document.form2.strLastName.value == "")
  { 
       alert("Enter last name, please.");
       document.form2.strLastName.style.background=errorColor;
       document.form2.strLastName.focus();
       return false;
  }
  if (document.form2.strFirstName.value == "")
  { 
       alert("Enter first name, please.");
       document.form2.strFirstName.style.background=errorColor;
       document.form2.strFirstName.focus();
       return false;
  }
  if (document.form2.strAddress.value == "")
  { 
       alert("Enter address, please.");
       document.form2.strAddress.style.background=errorColor;
       document.form2.strAddress.focus();
       return false;
  }
  if (document.form2.strCity.value == "")
  { 
       alert("Enter city, please.");
       document.form2.strCity.style.background=errorColor;
       document.form2.strCity.focus();
       return false;
  }
  if (document.form2.strPhone.value == "")
  { 
       alert("Enter phone, please.");
       document.form2.strPhone.style.background=errorColor;
       document.form2.strPhone.focus();
       return false;
  }
  if (document.form2.strEmail.value == "")
  { 
       alert("Enter email, please.");
       document.form2.strEmail.style.background=errorColor;
       document.form2.strEmail.focus();
       return false;
  }
  if (!isEmail(window.document.form2.strEmail.value)) 
  {
		alert("Enter a valid email address.");
        document.form2.strEmail.style.background=errorColor;
        document.form2.strEmail.focus();
        return false;
  }
  if (document.form2.strNameOnCard.value == "")
  { 
       alert("Enter name on card exactly as it appears, please.");
       document.form2.strNameOnCard.style.background=errorColor;
       document.form2.strNameOnCard.focus();
       return false;
  }
  if (document.form2.strCCNumber.value == "")
  { 
       alert("Enter credit card number, please.");
       document.form2.strCCNumber.style.background=errorColor;
       document.form2.strCCNumber.focus();
       return false;
  }
  if (document.form2.strCVV.value == "")
  { 
       alert("Enter CVV code, please.");
       document.form2.strCVV.style.background=errorColor;
       document.form2.strCVV.focus();
       return false;
  }
  if (document.form2.strBillingAddress.value == "")
  { 
       alert("Enter billing address, please.");
       document.form2.strBillingAddress.style.background=errorColor;
       document.form2.strBillingAddress.focus();
       return false;
  }
  if (document.form2.strBillingCity.value == "")
  { 
       alert("Enter billing city, please.");
       document.form2.strBillingCity.style.background=errorColor;
       document.form2.strBillingCity.focus();
       return false;
  }
  if (document.form2.strBillingPostalCode.value == "")
  { 
       alert("Enter billing postal code, please.");
       document.form2.strBillingPostalCode.style.background=errorColor;
       document.form2.strBillingPostalCode.focus();
       return false;
  }
}

function checkRoomTypeDetails()
{
  var errorColor="#FFFF00";
  var color="#FFFFFF";
  document.aspnetForm.ctl00_ContentPlaceHolder1_strRoomType.style.background=color;
  document.aspnetForm.ctl00_ContentPlaceHolder1_intSleeps.style.background=color;
  document.aspnetForm.ctl00_ContentPlaceHolder1_intMinimum.style.background=color;
  document.aspnetForm.ctl00_ContentPlaceHolder1_intMaximum.style.background=color;
  document.aspnetForm.ctl00_ContentPlaceHolder1_strDescription.style.background=color;
  
  if (document.aspnetForm.ctl00_ContentPlaceHolder1_strRoomType.value == "")
  {
       alert("Enter room type name, please.");
       document.aspnetForm.ctl00_ContentPlaceHolder1_strRoomType.style.background=errorColor;
       document.aspnetForm.ctl00_ContentPlaceHolder1_strRoomType.focus();
       return false;
  }
  if (document.aspnetForm.ctl00_ContentPlaceHolder1_intSleeps.value == "")
  {
       alert("Enter number of sleeps, please.");
       document.aspnetForm.ctl00_ContentPlaceHolder1_intSleeps.style.background=errorColor;
       document.aspnetForm.ctl00_ContentPlaceHolder1_intSleeps.focus();
       return false;
  }
  if (isNaN(document.aspnetForm.ctl00_ContentPlaceHolder1_intSleeps.value))
  { 
       alert("Number of sleeps must be a number.");
       document.aspnetForm.ctl00_ContentPlaceHolder1_intSleeps.style.background=errorColor;
       document.aspnetForm.ctl00_ContentPlaceHolder1_intSleeps.focus();
       return false;
  }
  if (document.aspnetForm.ctl00_ContentPlaceHolder1_intMinimum.value == "")
  {
       alert("Enter minimum number of days for booking, please.");
       document.aspnetForm.ctl00_ContentPlaceHolder1_intMinimum.style.background=errorColor;
       document.aspnetForm.ctl00_ContentPlaceHolder1_intMinimum.focus();
       return false;
  }
  if (isNaN(document.aspnetForm.ctl00_ContentPlaceHolder1_intMinimum.value))
  { 
       alert("Minimum number of days for booking must be a number.");
       document.aspnetForm.ctl00_ContentPlaceHolder1_intMinimum.style.background=errorColor;
       document.aspnetForm.ctl00_ContentPlaceHolder1_intMinimum.focus();
       return false;
  }
  if (document.aspnetForm.ctl00_ContentPlaceHolder1_intMaximum.value == "")
  {
       alert("Enter maximum number of days for booking, please.");
       document.aspnetForm.ctl00_ContentPlaceHolder1_intMaximum.style.background=errorColor;
       document.aspnetForm.ctl00_ContentPlaceHolder1_intMaximum.focus();
       return false;
  }
  if (isNaN(document.aspnetForm.ctl00_ContentPlaceHolder1_intMaximum.value))
  { 
       alert("Maximum number of days for booking must be a number.");
       document.aspnetForm.ctl00_ContentPlaceHolder1_intMaximum.style.background=errorColor;
       document.aspnetForm.ctl00_ContentPlaceHolder1_intMaximum.focus();
       return false;
  }
if (document.aspnetForm.ctl00_ContentPlaceHolder1_strDescription.value == "")
  {
       alert("Enter description, please.");
       document.aspnetForm.ctl00_ContentPlaceHolder1_strDescription.style.background=errorColor;
       document.aspnetForm.ctl00_ContentPlaceHolder1_strDescription.focus();
       return false;
  }
}

function checkNewPeriod()
{
  var errorColor="#FFFF00";
  var color="#FFFFFF";
  document.aspnetForm.ctl00_ContentPlaceHolder1_intRooms.style.background=color;
  document.aspnetForm.ctl00_ContentPlaceHolder1_fltStandardRate.style.background=color;
  document.aspnetForm.ctl00_ContentPlaceHolder1_fltStandardRateIncludingBreakfast.style.background=color;
  
  if (document.aspnetForm.ctl00_ContentPlaceHolder1_intRooms.value == "")
  {
       alert("Enter number of rooms, please.");
       document.aspnetForm.ctl00_ContentPlaceHolder1_intRooms.style.background=errorColor;
       document.aspnetForm.ctl00_ContentPlaceHolder1_intRooms.focus();
       return false;
  }
  if (isNaN(document.aspnetForm.ctl00_ContentPlaceHolder1_intRooms.value))
  { 
       alert("Number of rooms must be a number.");
       document.aspnetForm.ctl00_ContentPlaceHolder1_intRooms.style.background=errorColor;
       document.aspnetForm.ctl00_ContentPlaceHolder1_intRooms.focus();
       return false;
  }
  if (document.aspnetForm.ctl00_ContentPlaceHolder1_fltStandardRate.value == "")
  {
       alert("Enter standard rate, please.");
       document.aspnetForm.ctl00_ContentPlaceHolder1_fltStandardRate.style.background=errorColor;
       document.aspnetForm.ctl00_ContentPlaceHolder1_fltStandardRate.focus();
       return false;
  }
  if (isNaN(document.aspnetForm.ctl00_ContentPlaceHolder1_fltStandardRate.value))
  { 
       alert("Standard rate must be a number.");
       document.aspnetForm.ctl00_ContentPlaceHolder1_fltStandardRate.style.background=errorColor;
       document.aspnetForm.ctl00_ContentPlaceHolder1_fltStandardRate.focus();
       return false;
  }
  if (document.aspnetForm.ctl00_ContentPlaceHolder1_fltStandardRateIncludingBreakfast.value == "")
  {
       alert("Enter standard rate including breakfast, please.");
       document.aspnetForm.ctl00_ContentPlaceHolder1_fltStandardRateIncludingBreakfast.style.background=errorColor;
       document.aspnetForm.ctl00_ContentPlaceHolder1_fltStandardRateIncludingBreakfast.focus();
       return false;
  }
  if (isNaN(document.aspnetForm.ctl00_ContentPlaceHolder1_fltStandardRateIncludingBreakfast.value))
  { 
       alert("Standard rate including breakfast must be a number.");
       document.aspnetForm.ctl00_ContentPlaceHolder1_fltStandardRateIncludingBreakfast.style.background=errorColor;
       document.aspnetForm.ctl00_ContentPlaceHolder1_fltStandardRateIncludingBreakfast.focus();
       return false;
  }
}

function checkMailingList()
{
  var errorColor="#FFFF00";
  var color="#FFFFFF";
  document.aspnetForm.ctl00_ContentPlaceHolder1_strSubject.style.background=color;
  document.aspnetForm.ctl00_ContentPlaceHolder1_strBody.style.background=color;
  
  if (document.aspnetForm.ctl00_ContentPlaceHolder1_strSubject.value == "")
  {
       alert("Enter subject for email, please.");
       document.aspnetForm.ctl00_ContentPlaceHolder1_strSubject.style.background=errorColor;
       document.aspnetForm.ctl00_ContentPlaceHolder1_strSubject.focus();
       return false;
  }
  if (document.aspnetForm.ctl00_ContentPlaceHolder1_strBody.value == "")
  {
       alert("Enter body for email, please.");
       document.aspnetForm.ctl00_ContentPlaceHolder1_strBody.style.background=errorColor;
       document.aspnetForm.ctl00_ContentPlaceHolder1_strBody.focus();
       return false;
  }
}