<!--
var openedWindow; // used for live support chat window

/*
=================================================================================
	Function Name : trim
	Synopsis	  : trims text
	Created On    : 19-Oct-2004 
=================================================================================
*/

	function trim(text)
	{
		return rTrim(lTrim(text));
	}

	/*
	=================================================================================
		Function Name : lTrim
		Synopsis	  : Left trims text
		Created On    : 19-Oct-2004 
	=================================================================================
	*/

	function lTrim(text)
	{
		var i=0;
		var theValue=new String(text);
		while(theValue.charAt(i)==' ')	{	i=i+1;	}
		return theValue.substring(i,theValue.length);
	}
	
	/*
	=================================================================================
		Function Name : rTrim
		Synopsis	  : right trims text
		Created On    : 19-Oct-2004 
	=================================================================================
	*/
	
	
	function rTrim(text)
	{
		var theValue=new String(text);
		var i=theValue.length-1;
		while(theValue.charAt(i)==' '){	i=i-1;	}
		return theValue.substring(0,i+1);
	}
	/*
	=================================================================================
		Function Name : isValidAlphaNumericWithoutDashes
		Synopsis	  : check that passed value contain only alphanumeric charaters 
		Last Updated    : 19-Oct-2004 
		Returns		  : returns a boolean value indivating wether invalid charater is 
						found or not.
	=================================================================================
*/

	function isValidAlphaNumericWithoutDashes(theValue)
	{
		var chr;
		for(var i=0;i<theValue.length;i++)
		{
			chr=theValue.charAt(i)
			if( !( (chr>='A' &&  chr <= 'Z') || (chr>='a' &&  chr <= 'z') || (chr>='0' &&  chr <= '9') || chr==' ') )
			{
				return false;
			} // end of if
		} // end of for
		
		return true;
	}
	
	
/*
	=================================================================================
		Function Name : isValidAlphaNumeric
		Synopsis	  : check that passed value contain only alphanumeric charaters 
		Last Updated    : 19-Oct-2004 
		Returns		  : returns a boolean value indivating wether invalid charater is 
						found or not.
	=================================================================================
*/

	function isValidAlphaNumeric(theValue,fieldName)
	{
		var chr;
		for(var i=0;i<theValue.length;i++)
		{
			chr=theValue.charAt(i)
			if( !( (chr>='A' &&  chr <= 'Z') || (chr>='a' &&  chr <= 'z') || (chr>='0' &&  chr <= '9') || (chr=='-') || (chr=='_') || chr==' ' ) )
			{
				alert(fieldName+" contains invalid character '"+chr+"'");
				return false;
			} // end of if
		} // end of for
		
		return true;
	}
	
	/*
	=================================================================================
		Function Name : isValidAlpha
		Synopsis	  : check that passed value contain only alpha charaters 
		Created On    : 19-Oct-2004 
		Returns		  : returns a boolean value indivating wether invalid charater is 
						found or not.
	=================================================================================
	*/
	function isValidAlpha(theValue,fieldName)
	{
		var chr;
		theValue=trim(theValue);
		for(var i=0;i<theValue.length;i++)
		{
			chr=theValue.charAt(i)
			if( !( (chr>='A' &&  chr <= 'Z' ) || (chr>='a' &&  chr <= 'z'  ) ||( chr==' ' ) ))
			{
				//alert(fieldName+" contains invalid character '"+chr+"'");
				alert(fieldName+" contains invalid character(s).");
				return false;
			} // end of if
		} // end of for
		
		return true;
	}
	
	
	/*
	=================================================================================
		Function Name : isValidAlphaNumeric
		Synopsis	  : check that passed value contain only alphanumeric charaters 
		Created On    : 19-Oct-2004 
		Returns		  : returns a boolean value indivating wether invalid charater is 
						found or not.
	=================================================================================
	*/
	function isValidNumeric(theValue,fieldName)
	{
		var chr;
		theValue=trim(theValue);
		for(var i=0;i<theValue.length;i++)
		{
			chr=theValue.charAt(i)
			if( !(chr>='0' &&  chr <= '9') )
			{
				//alert(fieldName+" contains invalid character '"+chr+"'");
				alert(fieldName+" contains invalid character(s).");
				
				return false;
			} // end of if
		} // end of for
		
		return true;
	}
	
	

	/*
		=================================================================================
			Function Name : isValidCityName
			Synopsis	  : check that 
							1) City Name is atleast 3 characters
							2) Contains Only Alpha 
							
			Last Updated    : 23-Nov-2004 
			Returns		  : returns a boolean value indivating city name is valid 
							or not
		=================================================================================
	*/
	function isValidCityName(theValue,fieldName)
	{
		theValue=trim(theValue);
		if(theValue.length<3)
		{
			alert("Invalid "+fieldName+" specified.");
			return false;
		}
		return isValidAlpha(theValue,fieldName);
		
	}
	
	/*
		=================================================================================
			Function Name : isValidStreetName
			Synopsis	  : check that 
							1) Street  Name is atleast 4 characters
						
							
			Last Updated    : 23-Nov-2004 
			Returns		  : returns a boolean value indivating street name is valid 
							or not
		=================================================================================
	*/
	function isValidStreetName(theValue,fieldName)
	{
		theValue=trim(theValue);
		if(theValue.length<4)
		{
			alert("Invalid "+fieldName+" specified.");
			return false;
		}
		return true;
	
	}
	
	
/*
	=================================================================================
		Function Name : isValidPhone
		Synopsis	  : check that 
						1) Phone No is atleast 10 characters
						2) It CAN NOT start with 0 or 1
						
		Last Updated    : 23-Nov-2004 
		Returns		  : returns a boolean value indivating wether invalid charater is 
						found or not.
	=================================================================================
*/
	
	
	
	function isValidPhone(theValue,fieldName)
	{
		var chr;
		if(theValue.length<10)
		{
			alert("Invalid "+fieldName+". Please enter your "+fieldName+" with area code first and without any dashes.");
			return false;
		}
		
		if(theValue.charAt(i)=='0' || theValue.charAt(0)=='1')
		{
			alert("Invalid "+fieldName+". Please enter your "+fieldName+" with area code first and without any dashes.");
			return false;
		}
		for(var i=0;i<theValue.length;i++)
		{
			chr=theValue.charAt(i)
			if( !( (chr>='0' &&  chr <= '9') || (chr==' ')  ) )
			{
				alert(fieldName+" contains invalid character(s). Please enter your "+fieldName+" with area code first and without any dashes.");
				return false;
			} // end of if
		} // end of for
		
		return true;
	}
	
	/*
	=================================================================================
		Function Name : isValidPersonName
		Synopsis	  : check that
						1)  passed value contain only alpha charaters 
						2)  MUST be atleast 2 char
		Created On    : 23-Nov-2004 
		Returns		  : returns a boolean value indivating wether invalid charater is 
						found or not.
	=================================================================================
	*/
	function isValidPersonName(theValue,fieldName)
	{
		theValue=trim(theValue);
		if(theValue.length<2)
		{
			alert("Invalid "+fieldName+" specified.");
			return false;
		} 
		return isValidAlpha(theValue,fieldName);
	}
	
	/*
	=================================================================================
		Function Name : isValidIVRPin
		Synopsis	  : check that
						1)  passed value contain only digits
						2)  MUST be atleast 10 char
						
		Created On    : 23-Nov-2004 
		Returns		  : returns a boolean value indivating wether invalid charater is 
						found or not.
	=================================================================================
	*/
	function isValidIVRPin(theValue,fieldName)
	{
		theValue=trim(theValue);
		if(theValue.length<10)
		{
			alert("Invalid "+fieldName+" specified.");
			return false;
		} 
		return isValidNumeric(theValue,fieldName);
	}
		
	function isValidZip(theValue,fieldName)
	{
		
		theValue=trim(theValue);
		var chr;
		// For USA, zip code must be 5 characters long.
		if(theValue.length!=5)
		{
			alert("Invalid zip code.");
			return false;
		}
			
		
		for(var i=0;i<theValue.length;i++)
		{
			chr=theValue.charAt(i)
			if( !(chr>='0' &&  chr <= '9') )
			{
				alert("Zip Code contains invalid character(s).");
				return false;
			} // end of if
		} // end of for
		return true;
	}
	
	
	function isValidCharsForEmail(theValue)
	{
		var chr;
		for(var i=0;i<theValue.length;i++)
		{
			chr=theValue.charAt(i)
			if( !( (chr>='A' &&  chr <= 'Z') || (chr>='a' &&  chr <= 'z') || (chr>='0' &&  chr <= '9') || (chr=='-') || (chr=='_') || chr=='@' || chr=='.' ) )
			{
			
				return false;
			} // end of if
		} // end of for
		
		return true;
	}
	

	function checkEmailAddress(email)
	{
		var filter = "^[\\w-_\.]*[\\w-_\.]\@[\\w]\.+[\\w]+[a-zA-Z]$";
		//var filter="^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$";
		var regex = new RegExp(filter);
		var res=regex.test(email);	
		// ToDo : Incorporate all the follwoing checks in reg exp
		if(res)
		{
			
			 var signs=email.split("@");
			 // can not contain two signs..
			 if(signs.length>2)
			 {
				
				return false;
			 }
			 //Notes : This check is to cope with follwoing bug of regular expression
			 // doesnt give error if 4 or more characters are given after "@" and no dot is 
//				given
			 if(email.indexOf(".")==-1)
			 {
				return false;
			 }
			 if(!isValidCharsForEmail(email))
			 {
				
				return false;
			 }
			 var domain=email.substring(email.indexOf("@")+1)
			  // As Domain Name And Server CAn NOT CONTAIN _
			 // SO, lets test it...
			 if(domain.indexOf("_")>0)
			 {
				return false;
			 }
		}
		else
		{
			return false;
		}
		return true;

	
	}
	
	
	function checkEmail(emailField)
	{
		return checkEmailAddress(emailField.value);
	}
	function checkEmailList(EmailTextBox)
	{
		
		var emailList = new String(EmailTextBox.value);
		
		if (emailList.charAt(emailList.length - 1) == ",")
			emailList = emailList.substring(0, (emailList.length - 1));
		emailList = emailList.split(",");
		for (var a = 0; a < emailList.length; a++)
		{
			if (!checkEmailAddress(trim(emailList[a])))
				return false;
		}
		return true;
	}

	

		
	function verifyCreditCard(CreditCard)
	{
		
		if (trim(CreditCard.value) == "")
		{
			alert("Please provide the credit card number.");
			CreditCard.focus();
			return false;
		}
		else
		{
			temp = new String(trim(CreditCard.value));
			if ((temp.length < 14) || isNaN(CreditCard.value) ||
				(temp.substr(0, 1) < "3") || (temp.substr(0, 1) > "6"))
			{
				alert("Please provide a valid credit card number.");
				CreditCard.select();
				return false;
			}
		}
		return true;
	}	// End of function
	
	function toggleCheckBox(chkBoxPostFix,chkBox)
	{
		for(i=0;i<document.forms[0].elements.length;i++)
		{
			if(document.forms[0].elements[i].type=="checkbox")
			{
				if(document.forms[0].elements[i].name.indexOf(chkBoxPostFix)>-1)
				{
					document.forms[0].elements[i].checked=chkBox.checked;
				}
			}
		}
	}
	
	function isAnyCheckBoxChecked(chkBoxPostFix)
	{
		for(i=0;i<document.forms[0].elements.length;i++)
		{
			if(document.forms[0].elements[i].type=="checkbox")
			{
				if(document.forms[0].elements[i].name.indexOf(chkBoxPostFix)>-1 && document.forms[0].elements[i].checked)
				{
					return true;
				}
			}
		}
		return false;
	}
	
	
	
	
//title text
    //var titletext="XYZCAR.COM - Number One Source for ONLINE CAR RESERVATION SYSTEM AND MORE!" 
    var titletext="Odyssey Transportation Group - THE CENTER FOR WORLDWIDE EXECUTIVE TRANSPORTATION!" 
    var thetext=""
    var started=false
    var step=0
    var times=1

    function showText()
    {
	  times--
      if (times==0)
      {
        if (started==false)
        {
          started = true;
          document.title = titletext;
          setTimeout("animate()",1);
        }
        thetext = titletext;
      }
    }

    function showStatusText(txt)
    {
      thetext = txt;
      setTimeout("showText()",4000)
      times++;
    }

    function animate()
    {
      //step++
      //if (step==7) {step=1}
      //if (step==1) {document.title='>==='+thetext+'===<'}
      //if (step==2) {document.title='=>=='+thetext+'==<='}
      //if (step==3) {document.title='>=>='+thetext+'=<=<'}
      //if (step==4) {document.title='=>=>'+thetext+'<=<='}
      //if (step==5) {document.title='==>='+thetext+'=<=='}
      //if (step==6) {document.title='===>'+thetext+'<==='}
      //setTimeout("animate()",200);
    }
    
    
  /*
	=================================================================================
	Function Name : showHelp
	Synopsis	  : Shows help in help area.
	Created On    : 21-Oct-2004
	
	
	=================================================================================
	*/
	
    function showHelp(index)
    {

		if(typeof(document.all['divHelp'])!="undefined" && typeof(document.all.box[index])!="undefined")
		{
			document.all['divHelp'].innerHTML=document.all.box[index].innerHTML;
		}
		return false;
    }
    
    function moveBack(step)
	{
		if(step==2)
		{
			location.href="PersonalInfo.aspx"
		}
		if(step==3)
		{
			location.href="MailingAddressInfo.aspx"
		}
		if(step==4)
		{
			location.href="BillingInfo.aspx"
		}
		return false;
	
	}


/*
	=================================================================================
		Function Name : check4CookieSupport()
		Synopsis	  : Check for cookie support. If cookie support is disbled then 
						redirect user to "CookieError.aspx".
		Created On    : 31-Oct-2004
		Author		  : Yassar 
		Returns		  : 
	=================================================================================
	*/
	function check4CookieSupport()
	{
		if(document.cookie.indexOf("smartCabTestCookie")<0)
		{
			location.href="/CookieError.aspx";
		}

	}
	
	
	/*
	=================================================================================
		Function Name : setDefaultCity
		Synopsis	  : 
		Created On    : 31-Oct-2004
		Author		  : Yassar 
		Returns		  : 
	=================================================================================
	*/
	function setDefaultCity(cboState,txtCity,defaultState,defaultCity)
	{
		
		
		if(cboState.options[cboState.selectedIndex].text==defaultState)
		{
			txtCity.value=defaultCity;
		}
		else
		{
			txtCity.value="";
		}

	}
	
	
	function handleEnter(defaultButton)
	{
		
		if(window.event)
		{
			
			if(window.event.keyCode==13)
			{
				// We dont want to subm,it form, if enter is pressed inside a 
				// text area
				if(window.event.srcElement.type!="textarea")
				{
					
					document.getElementById(defaultButton).click();
					return false;
				}
			}
		}
		return true;
	}
/*
	=================================================================================
		Function Name : clearDropdownList
		Synopsis	  : This functions is user to clear all values present in list box
		Created On    : 19-DEC-2004 
		Author		  : YAS
	=================================================================================
*/

	function clearDropdownList(lstBox)
	{
		var i;
		var len = lstBox.length;

		for (i = len-1; i >= 0; i--) 
		{
			lstBox.options[i] = null;
		}
	}
	
	
	function isItemAlreadyAdded(lstBox,selectedText)
	{
		
		for (i = 0; i<lstBox.length; i++) 
		{
			if(lstBox.options[i].text==selectedText)
			{
				return true;
			} 
		}
		return false;
	}
	
	function selectListItemByValue(lstBox,selectedValue)
	{
		if(typeof(selectedValue)=="undefined")
		{
			selectedValue="";
		} 
		
		for (i = 0; i<lstBox.options.length; i++) 
		{
		
		
			if(  trim(lstBox.options[i].value.toUpperCase()) == trim(selectedValue.toUpperCase()))
			{

			//	alert( "combo value :" + trim(lstBox.options[i].value) + " == selected value : " + trim(selectedValue) );							
			
			lstBox.selectedIndex=i;
			} 
		}
	
	}
	function selectListItemByText(lstBox,selectedText)
	{
		
		for (i = 0; i<lstBox.options.length; i++) 
		{
			if(trim(lstBox.options[i].text.toUpperCase())==trim(selectedText.toUpperCase()))
			{
				lstBox.selectedIndex=i;
			} 
		}
	}
	
	
	function isValidDate(day,month,year)
	{
		if (month == 2) 
		{ // check for february 29th
			var isleap = (year % 4 == 0 && (year % 100 != 0 || year % 400 == 0));
			if (day>29 || (day==29 && !isleap)) 
			{
				return false;
			}
		}
		return true;
		
	}
	
	
	function openHelpWindow()
	{
		window.showModalDialog('../HelpWindow.aspx?fname='+ document.location ,'','dialogHeight: 375px; dialogWidth: 453px; edge: Raised; center: Yes; help: Yes; resizable: No; status: No');
	}
	
	function getCardIndex()
			{
				if(document.forms[0].optVisa.checked)
				{
					return 0;
				}
				if(document.forms[0].optMaster.checked)
				{
					return 1;
				}
				if(document.forms[0].optAmEx.checked)
				{
					return 2;
				}
				if(document.forms[0].optDiscover.checked)
				{
					return 3;
				}
				if(document.forms[0].optDiners.checked)
				{
					return 4;
				}
			}
			
	/*============================================================================*/

/*

This routine checks the credit card number. The following checks are made:

1. A number has been provided
2. The number is a right length for the card
3. The number has an appropriate prefix for the card
4. The number has a valid modulus 10 number check digit if required

If the validation fails an error is reported.

The structure of credit card formats was gleaned from
    http://www.blackmarket-press.net/info/plastic/check_digit.htm 
where the details of other cards may also be found.

Parameters:
            cardnumber           number on the card
            cardname             name of card as defined in the card list below

Author:     John Gardner
Date:       1st November 2003

*/

/*
   If a credit card number is invalid, an error reason is loaded into the 
   global ccErrorNo variable. This can be be used to index into the global error  
   string array to report the reason to the user if required:
   
   e.g. if (!checkCreditCard (number, name) alert (ccErrors(ccErrorNo);
*/

/*
Visa 4111 1111 1111 1111 
MasterCard 5500 0000 0000 0004 
American Express 3400 0000 0000 009 
Diner's Club 3000 0000 0000 04 
Carte Blanche 3000 0000 0000 04 
*/
function isValidCreditCard(cardNumber, cardType)
{
	
	if (cardType == 0) 
	{
	  // Visa: length 16, prefix 4, dashes optional.
	  var re = /^4\d{3}-?\d{4}-?\d{4}-?\d{4}$/;
	}
    else if (cardType == 1) 
    {
	  // Mastercard: length 16, prefix 51-55, dashes optional.
	  var re = /^5[1-5]\d{2}-?\d{4}-?\d{4}-?\d{4}$/;
   } 
   else if (cardType == 3) 
   {
	  // Discover: length 16, prefix 6011, dashes optional.
	  var re = /^6011-?\d{4}-?\d{4}-?\d{4}$/;
   } 
   else if (cardType ==2) 
   {
	  // American Express: length 15, prefix 34 or 37.
	  var re = /^3[4,7]\d{13}$/;
   } 
   else if (cardType == 4) 
   {
	  // Diners: length 14, prefix 30, 36, or 38.
	  var re = /^3[0,6,8]\d{12}$/;
    }
   if (!re.test(cardNumber)) 
	return false;
   // Checksum ("Mod 10")
   // Add even digits in even length strings or odd digits in odd length strings.
   var checksum = 0;
   for (var i=(2-(cardNumber.length % 2)); i<=cardNumber.length; i+=2) 
   {
	  checksum += parseInt(cardNumber.charAt(i-1));
   }
   // Analyze odd digits in even length strings or even digits in odd length strings.
   for (var i=(cardNumber.length % 2) + 1; i<cardNumber.length; i+=2) 
   {
	  var digit = parseInt(cardNumber.charAt(i-1)) * 2;
	  if (digit < 10)
	  { 
		checksum += digit; 
	  } 
	  else 
	  { 
		checksum += (digit-9)	; 
	  }
	}
	
   if ((checksum % 10) == 0) 
		return true; 
	else
		 return false;
}

function OpenWinMax(targetURL) 
{
		var xMax 	= screen.availWidth, yMax = screen.availHeight;
		window.open(targetURL, "Multi","screenX=0,screenY=0,top=0,left=0,toolbar=yes,location=yes,directories=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes,width="+xMax+",height="+yMax);
}


function ValidateCardInfo(res)
{
		
	if(trim(document.forms[0].txtCardHolderName.value)=="")
	{
		alert("Please provide card holder name.");
		document.forms[0].txtCardHolderName.select();
		return false;
	}
	if(!isValidPersonName(document.forms[0].txtCardHolderName.value,"Card holder name"))
	{
		document.forms[0].txtCardHolderName.select();
		return false;
	}
	
	if(res)
	{
		if(
				document.forms[0].ccEmpty.value.toLowerCase() == "true"
				|| trim(document.forms[0].txtCardNumber.value) != GetFormattedCardNo(trim(document.forms[0].ccOriginalNo.value))
				|| trim(document.forms[0].ccType.value) != GetCurrentCCType()
		  )
		  {
			if(trim(document.forms[0].txtCardNumber.value)=="")
			{
				alert("Please provide your Card Number.");
				document.forms[0].txtCardNumber.select();
				return false;
			}
			if(trim(document.forms[0].txtCardNumber.value).indexOf("*")>-1)
			{
				alert("Please provide your Card Number.");
				document.forms[0].txtCardNumber.select();
				return false;
			}
	
			if(!isValidCreditCard(trim(document.forms[0].txtCardNumber.value),getCardIndex()))
			{
				alert("Invalid Card Number.");
				document.forms[0].txtCardNumber.select();
				return false;
			}
		}
	}
	else
	{
			if(trim(document.forms[0].txtCardNumber.value)=="")
			{
				alert("Please provide your Card Number.");
				document.forms[0].txtCardNumber.select();
				return false;
			}
			if(trim(document.forms[0].txtCardNumber.value).indexOf("*")>-1)
			{
				alert("Please provide your Card Number.");
				document.forms[0].txtCardNumber.select();
				return false;
			}
	
			if(!isValidCreditCard(trim(document.forms[0].txtCardNumber.value),getCardIndex()))
			{
				alert("Invalid Card Number.");
				document.forms[0].txtCardNumber.select();
				return false;
			}		
		
	}
	/*
	if(trim(document.forms[0].txtVerificationCode.value)=="")
	{
		alert("Please provide your 3 digit card verification code.");
		document.forms[0].txtVerificationCode.select();
		return false;
	}
	if(trim(document.forms[0].txtVerificationCode.value).length<3)
	{
		alert("Please provide your 3 digit card verification code.");
		document.forms[0].txtVerificationCode.select();
		return false;
	}
	
	if(!isValidNumeric(document.forms[0].txtVerificationCode.value,"Verification code"))
	{
		document.forms[0].txtVerificationCode.select();
		return false;
	}
	
	if(!isValidNumeric(document.forms[0].txtVerificationCode.value,"card verification code"))
	{
		document.forms[0].txtVerificationCode.select();
		return false;
	}
	*/
	var curDate = new Date();
	
	if((curDate.getMonth()+1)>document.forms[0].cboMonth.options[document.forms[0].cboMonth.selectedIndex].value && (curDate.getFullYear()-2000)==document.forms[0].cboYear.options[document.forms[0].cboYear.selectedIndex].value)
	{
		alert("Please provide a valid expiration date.");
		return false;
	
	}
	return true;
}




/*
	=================================================================================
		Function Name : openLiveStatusWindow
		Synopsis	  : Used to open Live Status Window.
		Created On    : 21-Feb-2005
	=================================================================================
	*/
function openLiveStatusWindow(urlParams) 
{
	var liveStatusWin = window.open("/Reservation/nyReservationStatus.aspx?"+urlParams,"LiveStatus","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,width=700,height=250");
	
}

/*
	=================================================================================
		Function Name : openBilledVoucherWindow
		Synopsis	  : Used to open Billed Voucher window 
		Created On    : 21-Feb-2005
		
	=================================================================================
	*/

function openBilledVoucherWindow(urlParams) 
{
	var width 	= screen.availWidth;
	 var  height = screen.availHeight;
	var voucherWin = window.open("/Reservation/nyViewVoucher.aspx?"+urlParams,"Voucher","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,width="+width+",height="+height);
	//return false;
}

/*
	=================================================================================
		Function Name : openPrintVoucherWindow
		Synopsis	  : Used to open window ,so that voucher can be printed
		Created On    : 21-Feb-2005
	=================================================================================
	*/


	function openPrintVoucherWindow(urlParams) 
	{

		//var width 	= screen.availWidth;
		//var  height = screen.availHeight;
		var voucherWin = window.open("/Reservation/nyPrintVoucher.aspx?"+urlParams,"Voucher","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,width=720,height=445");
		//return false;
	}

	function getAbsPos(elt,which) 
	{
		iPos = 0;
		while (elt != null) 
		{
			iPos += elt["offset" + which];
			elt = elt.offsetParent;
		}
		return iPos;
	}

	function getAbsX(elt) 
	{
			return (elt.x) ? elt.x : getAbsPos(elt,"Left"); 
	}
	function getAbsY(elt)
	{
		return (elt.y) ? elt.y : getAbsPos(elt,"Top"); 
	}
	
	
	/*
	=================================================================================
		Function Name : hideWaitMessage
		Synopsis	  : Used to show actual page contenets. Will be called on bodyLoad
						event of pages where we r showing wait message 
		Created On    : 24-Feb-2005
		Notes		  : DONT CHNAGE ids in this message, as it will have 
						effect on following pages 
							1) AddressInfo.aspx
							2) CityAssistant.aspx
							3) StateAssistant.aspx
	=================================================================================
	*/

	function hideWaitMessage()
	{
	
		document.all["loadMessage"].style.display="none";
		document.all["pageContents"].style.display="Block";
	}
	
	/*
	=================================================================================
		Function Name : filterKeys
		Synopsis	  : This function will be used to filter keys. It returns a boolean 
						value indicating wetehr we have to ignore this key or not
		Created On    : 24-Feb-2005
		
	=================================================================================
	*/

	function isValidKey(e)
	{
		var key = document.layers ? e.which : e.keyCode;
		// 46 for Delete 
		if (key == 0 || key == 8 || key==46 || key == 9 || key == 16 || (key >= 35 && key <= 40))
		{
			return false;
		}
		return true;	
	}
	
	/*
	=================================================================================
		The following function will be used to open City and street popup windows.
		Notes : These function assumes that Check box field on poages will have same 
		name 
	=================================================================================
	*/
	
	
	function openStreetAssistantWindow(stateField,cityField,streetField,e)
	{
		// In case of link, no need of filtering key or checking state 
		// of check box....
		if(e!=null)
		{
			if(!isValidKey(e) || !document.forms[0].chkAddressAssistant.checked )
			{
				return;
			}
		}
		var stateCode=stateField.options[stateField.selectedIndex].value;
		if(stateField.selectedIndex<1)
		{
			alert("Please select state first.");
			stateField.focus();
			return;
		}
		if(trim(cityField.value)=="")
		{
			alert("Please provide city.");
			cityField.focus();
			return;
		}
		var winWidth	= 350;
		var winHeight	= 390;
		//var winHeight	= 500;
		var res=window.showModalDialog("/Reservation/StreetAssistant.aspx?c="+cityField.value+"&st="+stateCode+"&fld="+streetField.name+"&stree="+streetField.value, null,   "dialogHeight:"+winHeight+"px; dialogWidth: "+winWidth+"px; help:no;scroll:no;resizable:no");
		//var res=window.open("/Reservation/StreetAssistant.aspx?c="+cityField.value+"&st="+stateCode+"&fld="+streetField.name+"&stree="+streetField.value, null);
		if( typeof(res)!="undefined")
		{
			streetField.value=res;
			streetField.focus();
		}
		else
		{
			streetField.focus();
		}
		
	}
	
	
	function openCityAssistantWindow(stateField,cityField,e)
	{
	
		// In case of link, no need of filtering key or checking state 
		// of check box....
		if(e!=null)
		{
			if(!isValidKey(e) || !document.forms[0].chkAddressAssistant.checked )
			{
				return;
			}
		}
		var stateCode=stateField.options[stateField.selectedIndex].value;
		if(stateField.selectedIndex<1)
		{
			alert("Please select state first.");
			cityField.value="";
			stateField.focus();
			return;
		}
		var winWidth	= 350;
		var winHeight	= 390;
		var res=window.showModalDialog("/Reservation/CityAssistant.aspx?c="+cityField.value+"&st="+stateCode+"&fld="+cityField.name, null,   "dialogHeight:"+winHeight+"px; dialogWidth: "+winWidth+"px; help:no;scroll:no;resizable:no");
		
		if( typeof(res)!="undefined")
		{
			cityField.value=res;
			cityField.focus();
		}
		else
		{
			cityField.focus();
		}
		
	}
	
	
			/*
	=================================================================================
		Function Name : setEditor
		Synopsis	  : Includes  script files according to browser
						browser.
		Created On    : 22-March-2005
		Author		  : Yassar 
		Returns		  : 
	=================================================================================
	*/
	
	function setEditor()
	{
		_editor_url = "../Script/";                   
		win_ie_ver = parseFloat(navigator.appVersion.split("MSIE")[1]);
		if (navigator.userAgent.indexOf('Mac')        >= 0) { win_ie_ver = 0; }
		if (navigator.userAgent.indexOf('Windows CE') >= 0) { win_ie_ver = 0; }
		if (navigator.userAgent.indexOf('Opera')      >= 0) { win_ie_ver = 0; }
		if (win_ie_ver >= 5.5) {
		document.write('<scr' + 'ipt src="' +_editor_url+ 'editor.js"');
			
		document.write(' language="Javascript1.2"></scr' + 'ipt>');  
		} 
		else
		{ 
			 document.write('<scr'+'ipt>function editor_generate() { return false; }</scr'+'ipt>'); 
		}
	}
	
	
			/*
	=================================================================================
		Function Name : cancelConfirmation
		Synopsis	  : used to confirm reservatiobn cancellation
						
		Created On    : 22-March-2005
		Author		  : Yassar 
		Notes 		  : Used in Reservation List.aspx and SearchResults.aspx page
	=================================================================================
	*/
	
	function cancelConfirmation(reservationId)
	{
		// We dont want to buble this event to row click event handler..
		window.event.cancelBubble=true;
		return confirm("You have selected to cancel reservation '"+reservationId+"'. This action is irreversible. Are you sure you want to continue.?");
	}
	
	
	function showCommingSoon()
	{
		alert("Under construction.");
	}
	
	
	function sleep(interval)
	{
	
		var date = new Date() //today's date
		var currentTime = new Date() //today's date
		while (1)
		{
			currentTime=new Date() // Current Date
			diff = currentTime-date
			if( diff > interval ) 
			{
				break;
			}
		}
	}

	function openLiveChatWindow()
	{
		//var helpWin=window.open('http://hc2.humanclick.com/hc/34291691/?cmd=file&amp;file=visitorWantsToChat&amp;site=34291691','chat34291691','width=475,height=320');
		
		//var chatWin=window.open('/LiveChat/ChatOpener.aspx','chat34291691','width=475,height=320');
		
			if (openedWindow != null)
				{
						if (openedWindow.closed)			
						{
							openChat();
						}
						else
						{
							openedWindow.focus();
						}
				}
				else
				{
						openChat();
				}
		
		
	}	

		function openChat()
		{
			var winWidth = 477;
			var winHeight = 321;
			
			var scrLeftPos = parseInt(screen.width/2) - parseInt(winWidth/2) ;
			var scrTopPos  = parseInt(screen.height/2) - parseInt(winHeight/2) ;
			openedWindow   = window.open("/LiveChat/ChatOpener.aspx","chatWindow","toolbar=no,Height="+winHeight+",Width="+winWidth+",left="+scrLeftPos+",top="+scrTopPos+"");
			//openedWindow   = window.open("/LiveChat/ChatFrame.aspx","chatWindow","toolbar=no,Height="+winHeight+",Width="+winWidth+",left="+scrLeftPos+",top="+scrTopPos+"");
		}		
	
	
	//-->
		
