/*
	iSMARTS  Version
	Copyright (C) 2003.Comsoft Infotech Pvt. Ltd  All Rights Reserved.
	Module Name    			: Eticket
	File Name      			: eticketweb_home_page.js
	Created By     			: Shilpa Nadkarni
	Created Date   			: 20/05/2008
	Version					: 1.0
	Purpose	   				: Functions for validations required on home page
	Assumptions	   			:
	Links          			: eticketweb_home_page.jsp
	Modified By   	 		: Shilpa
	Modified Date  			: 10 July 2009 
	Reason	   				:	added the code for bowser compatibility of the ajax and the date picker not working in some browsers 
	Version					:
	Functions in File		: compareDate(), validateInputData(), checkKeyCode(), onContinue(), checkWindowOpen()
	//\\192.168.1.198\WebsiteDemo\eticketweb_home_page.htm
*/
var _objSelActive;
var _offsetTop;
var _offsetLeft;
var _offsetLeftClip;
var _comboBoxArray;
var _spanToCity = "spanid_ToCity";
var _spanFromCity = "spanid_FromCity";
var strToCityName="slctToCity";
var strFromCityName="slctFromCity";
var strCodeString;
var strNameString;
var req=null;
var reqPage=null;
var isIE=false;
var idEdit, idSel;

	var linkArray = new Array();

window.onload = function () 
{  
	// Following function is for Paulo.To be commented in case of Prasanna (showandhide(b)).
	if(document.forms[0].hidCustomerName.value == "Prasanna")
	{
		document.forms[0].txtFromCityName.focus();
		//showandhide(b);
	}
	else
	{  
		/* Added by Vandana on 30/09/09 : For Process Bar functionality */
		/*---Commented by shreyash on 16-Jun-2010 as giving js error for blur div style---*/
		blurDiv = document.getElementById("body_transparentDivs"); 
		blurDiv.style.display = "block";

		blurDiv.id = body_transparentDivs; 
		blurDiv.style.cssText = "background-color: white; opacity:0.5; filter:alpha(opacity=50);";
		document.body.style.overflow = "hidden" ;

		/* End Addition by Vandana for Process Bar functionality */

		loadImages();

		showandhide(b);
	}

	rebuild();
	noBack();
	checkWindowOpen();
	var browser = checkBrowser();
	//alert(browser);
	if(browser[0] == "Explorer") {
		_offsetTop = 0;
		_offsetLeft =0;
		_offsetLeftClip = 18;
	} else {
		_offsetTop = 0;
		_offsetLeft = 0;
		_offsetLeftClip = 20;
	}
   _objSelActive = true;
   checkSysDate();
   //alert("in Load");
	pageHitCount();


}

function onSchedulePageLoad()
{
	var browser = checkBrowser();
	if(browser[0] == "Explorer") {
		_offsetTop = 0;
		_offsetLeft =0;
		_offsetLeftClip = 18;
	} else {
		_offsetTop = 0;
		_offsetLeft = 0;
		_offsetLeftClip = 20;
	}
   _objSelActive = true;
}

function onCityNameChange(){
	document.forms[0].txtFromCityName.value="";
}


/*
	Function Name: compareDate()
	Description	 : This function is used to make comparisons between two dates.
	Author		 : Abhijeet S Bhatambrekar
	Parameter	 : string, string
	Return Type	 : Boolean
*/
function compareDate(Fromdt, Todt)
{
	var obj = document.forms[0]
	var delimiters;
	var from = Fromdt.value;
	var to = Todt.value;
	if(from.lastIndexOf("/")>0)
	{
		delimiters = "/";
	}
	else if(from.lastIndexOf("-")>0)
	{
		delimiters = "-";
	}
	
	var fromyear = eval(from.substring(from.lastIndexOf(delimiters)+1,from.length));
	var toyear = eval(to.substring(to.lastIndexOf(delimiters)+1,to.length));

	from = from.substring(0,from.lastIndexOf(delimiters))
	to = to.substring(0,to.lastIndexOf(delimiters))
	
	var frommonth = eval(from.substring(from.lastIndexOf(delimiters)+1,from.length));
	if(frommonth.length==1)
	{
			frommonth = "0" + frommonth;
	}
	var tomonth = eval(to.substring(to.lastIndexOf(delimiters)+1,to.length));
	if(tomonth.length==1)
	{
		tomonth = "0" + tomonth;
	}
	
	from = eval(from.substring(0,from.lastIndexOf(delimiters)))
	to = eval(to.substring(0,to.lastIndexOf(delimiters)))

	if(from.length==1)
	{
		from = "0" + from;
	}
	
	if(to.length==1)
	{
		to = "0" + to;
	}
	
	var flag = false;

	if(fromyear<toyear)
	{
		flag = true;
	}
	else if(fromyear == toyear)
	{
		if(frommonth < tomonth)
		{
			  flag = true;
		}
		else if(frommonth == tomonth)
		{
			if(from < to)
			{
				flag = true;
			}
		}
	}
	return flag;
}

/*
	Function Name: validateInputData()
	Description	 : This function is used to validate the input data before invoking required action.
	Author		 : Abhijeet S Bhatambrekar
	Parameter	 : string user type
	Return Type	 : void
*/
function validateInputData(strUserType)
{
	var documentObject	=	document.forms[0];
	if(documentObject.txtFromCityName.value == "")
	{
		alert("Please enter From City");
		documentObject.hidFromCityCode.value = "";
		documentObject.txtFromCityName.focus();
		return true;
	}
	else if(documentObject.hidFromCityCode.value == "" || documentObject.hidFromCityCode.value == "0")
	{
		alert("Please enter valid From City");
		documentObject.txtFromCityName.focus();
		return true;
	}

	if(documentObject.txtToCityName.value == "")
	{
		alert("Please enter To City");
		documentObject.hidToCityCode.value = "";
		documentObject.txtToCityName.focus();
		return true;
	}
	else if(documentObject.hidToCityCode.value == "" || documentObject.hidToCityCode.value == "0")
	{
		alert("Please enter valid To City");
		documentObject.txtToCityName.focus();
		return true;
	}

	if(documentObject.txtFromCityName.value == "" && documentObject.txtToCityName.value=="")
	{
		alert("Please enter city.");
		documentObject.txtFromCityName.focus();
		return true;
	}

	if(documentObject.txtFromCityName.value == documentObject.txtToCityName.value)
	{
		alert("From City and To City should not be the same");
		documentObject.txtFromCityName.focus();
		return true;
	}

	if(documentObject.txtJourneyDate.value == "")
	{
		alert("Please select the Journey Date");
		return true;
	}

	if(compareDate(documentObject.txtJourneyDate, documentObject.hidSystemDate))
	{
		alert("Please enter Journey Date greater than or equal to today's date.");
		return true;
	}

	if(documentObject.rdoBookingOption[1].checked == true)
	{
		if(documentObject.txtReturnJourneyDate.value == "")
		{
			alert("Please select the Return Journey Date, as you have selected Round Trip option");
			return true;
		}

		if(compareDate(documentObject.txtReturnJourneyDate, documentObject.txtJourneyDate))
		{
			alert("Please enter Return Date greater than or equal to Journey Date.");
			return true;
		}

		if(compareDate(documentObject.txtReturnJourneyDate, documentObject.hidSystemDate))
		{
			alert("Please enter Return Date greater than or equal to today's date.");
			return true;
		}
	}

	if(strUserType == "RU")
	{
		if(documentObject.txtUserName.value == "")
		{
			alert("Please enter Login Id");
			documentObject.txtUserName.focus();
			return true;
		}

		if(documentObject.txtUserPassword.value == "")
		{
			alert("Please enter Password");
			documentObject.txtUserPassword.focus();
			return true;
		}
	}
	return false;
}

/*
	Function Name: checkKeyCode()
	Description	 : This function is used to call the function onContinue() when user has pressed ENTER key.
	Author		 : Abhijeet S Bhatambrekar
	Parameter	 : void
	Return Type	 : void
*/
function checkKeyCode(str,event)
{
	var objWin = browserSpec(event);
	if(objWin.keyCode == 13)
		onContinue(str);
}

/*
	Function Name: checkKeyCode()
	Description	 : This function is used to call the function onContinue() when user has pressed ENTER key.
	Author		 : Satish B
	Parameter	 : void
	Return Type	 : void
*/
function checkKeyCodeForPrasanna(str,event)
{
	if(window.event.keyCode == 13)
		onContinueForPrasanna(str,event);
}

/*
	Function Name: onContinue()
	Description	 : This function is used to validate the input data and call controller to invoke required action.
	Author		 : Abhijeet S Bhatambrekar
	Parameter	 : String user type
	Return Type	 : void
*/
function onContinue(strUserType)
{
	var documentObject	=	document.forms[0];

	if(validateInputData(strUserType))
		return;

	if(documentObject.rdoUserType[0].checked == true)
		documentObject.hidUserType.value = documentObject.rdoUserType[0].value;
	else
		documentObject.hidUserType.value = documentObject.rdoUserType[1].value;

	if(documentObject.rdoBookingOption[0].checked == true)
		documentObject.hidBookingOption.value = documentObject.rdoBookingOption[0].value;
	else if(documentObject.rdoBookingOption[1].checked == true)
		documentObject.hidBookingOption.value = documentObject.rdoBookingOption[1].value;

	documentObject.hidFromCityName.value = documentObject.txtFromCityName.value;
	documentObject.hidToCityName.value	 = documentObject.txtToCityName.value;
	
	// Avoid displaying cached data (from and to city names) from browser cache once form submit.
	documentObject.txtFromCityName.value = "";
	documentObject.txtToCityName.value = "";

	documentObject.hidAction.value = "LOGIN";
	documentObject.method = "post";
	documentObject.action = "http://www.paulotravels.com/ismarts/eticketweb/jsp/loginController.do";
	documentObject.submit();
}

function onCallCustFeed()
{
	var documentObject	=	document.forms[0];
	documentObject.hidAction.value = "CustFeed";
	documentObject.method = "post";
	documentObject.action = "http://www.paulotravels.com/ismarts/eticketweb/jsp/loginController.do";
	documentObject.submit();
}

/*
	Function Name: checkWindowOpen()
	Description	 : This function is used to close the window in which application is running and refresh the base and displaying appropriate error message on it, e.g. invalid session.
	Author		 : Abhijeet S Bhatambrekar
	Parameter	 : void
	Return Type	 : void
*/
function checkWindowOpen()
{
	if(document.forms[0].errMsg.value != "" && document.forms[0].errMsg.value != "Invalid Login Id/Password")
	{
		if(typeof(window.opener) != "undefined")
		{
			window.opener.document.forms[0].method = "post";
			window.opener.document.forms[0].errMsg.value = document.forms[0].errMsg.value;
			window.opener.document.forms[0].focus();
			window.opener.document.forms[0].submit();
			window.close();
		}
	}
}


function onForgetPassword()
{

	window.open('eticketweb_forget_password.jsp','iSMARTS','0, 0, status = yes,scrollbars = yes, resizable = yes, width = 1020, height = 680, left = 0, top = 0');
}


var _CityCount =0;
function createComboList(strString)
{
var elements = document.forms[0];
if (document.getElementsByTagName) {elements = document.getElementsByTagName('*');}
else if (document.all) {elements = document.all.tags('*');}
var strCodeSplit = strCodeString.split(",");
var strNameSplit = strNameString.split(",");

//strCodeSplit = trim(strCodeSplit);
//strNameSplit = trim(strNameSplit);

var strOpt,strOpt1;

var comboLen = strNameSplit.length;
//alert(strNameSplit.length);
if (comboLen == 1)
{
	comboLen = 2;
}
else if (comboLen > 10)
{
	comboLen = 10;
}
_CityCount= strCodeSplit.length;
var strSel = "selected";
if(strString=="F")
{
	//strOpt = "<select name ='"+strFromCityName+"' id='"+strFromCityName+"' size='5' class='text' autocomplete='off' ><option value='0' selected >--- Select City ---</option>";

	strOpt = "<select name ='"+strFromCityName+"' id='"+strFromCityName+"' style='width: 120px;' size='"+comboLen+"' class='text' autocomplete='off' valign='top'>";
}
else
{
	//strOpt = "<select name ='"+strToCityName+"' id='"+strToCityName+"' size='5' class='text' autocomplete='off'><option value='0' selected >--- Select City ---</option>";

	strOpt = "<select name ='"+strToCityName+"' id='"+strToCityName+"' style='width: 120px;' size='"+comboLen+"' class='text' autocomplete='off' valign='top'>";
}
if(strCodeSplit.length>1){
	//alert("in if-->"+strCodeSplit.length);
	for(i=0;i<strCodeSplit.length;i++){
	if (elements[i].id.search(strFromCityName) == (-1) && strCodeSplit[i]!="") {

			//strOpt = strOpt  + "<option value ='"+strCodeSplit[i]+"' "+strSel+">"+trim(strNameSplit[i])+"("+trim(strCodeSplit[i])+")"+"</option>";
			strOpt = strOpt  + "<option value ='"+strCodeSplit[i]+"' >"+trim(strNameSplit[i])+"("+trim(strCodeSplit[i])+")"+"</option>";

			strOpt = trim(strOpt);

			strSel = "";
		}
	}
	//alert("strOpt :--> "+strOpt);
}else if(strCodeSplit.length==1){
	//alert("in else if");
	 if (elements[0].id.search(strFromCityName) == -1 && strCodeSplit[0]!="") {
			//strOpt = strOpt  + "<option value ='"+strCodeSplit[0]+"' "+strSel+">"+trim(strNameSplit[0])+"("+trim(strCodeSplit[0])+")"+"</option>";
			strOpt = strOpt  + "<option value ='"+strCodeSplit[0]+"' >"+trim(strNameSplit[0])+"("+trim(strCodeSplit[0])+")"+"</option>";

			strSel = "";

			strOpt = trim(strOpt);
	}else{
			if(strString=="F")
            {
                strOpt = strOpt+ "<option value ='-'"+strSel+">City Not Found</option>";
            }
            else if(strString=="T")
            {
                strOpt = strOpt+ "<option value ='-'"+strSel+">Route Not Found</option>";
            }
	}
	//alert("strOpt :--> "+strOpt);
}
strOpt=strOpt+"</select>";

if(strString=="F")
{
	document.getElementById(_spanFromCity).innerHTML = strOpt;

	/*if(document.getElementById("loader"))
	{
		document.getElementById("loader").style.display="none";
	}*/
}
if(strString=="T")
{
	document.getElementById(_spanToCity).innerHTML = strOpt;

	/*if(document.getElementById("loader1"))
	{
		document.getElementById("loader1").style.display="none";
	}*/
}

}
function checkp(){
	//alert("check call");

	document.onkeypress = function () {
  var e=window.event;
  key = e.keyCode ? e.keyCode : e.which;
 // alert(key);
  if(key==13) {
  e.returnValue=false;
  key=37;
  }
  //alert(key);
}
}
function findPos(obj) {
  // Credit for this function: http://www.quirksmode.org/js/findpos.html
  // Visit the URL for a complete tutorial on this function
  var curleft = curtop = parent_offSetLeft = 0;
  var parent_offSetTop=0;
  if (obj.offsetParent) {
     curleft = obj.offsetLeft
     curtop = obj.offsetTop
     curwidth = obj.offsetWidth;
     while (obj = obj.offsetParent) {
        curleft += obj.offsetLeft
        curtop += obj.offsetTop
        if(obj.id) {
           parent_offSetLeft = obj.offsetLeft;
           parent_offSetTop = obj.offsetTop;
         }
     }
  }
  return [curleft,curtop,curwidth,parent_offSetLeft,parent_offSetTop];      ////201,425,131,0,0      467
}

function positionComboBox(inpId, selId) {  
  inpObj = document.getElementById(inpId);
  selObj = document.getElementById(selId);

   // Positioning of the combotext boxes
 inpObj.style.marginRight = _offsetLeftClip+'px';
  inpObj.style.position = "relative";
  selObj.style.position = "absolute";
  ofs=findPos(inpObj);                                        // Find the left/top & width of span
if(selObj.name=="slctToCity"){
   selObj.style.top=(ofs[1]+_offsetTop+(ofs[4]*-1))-2+'px';      // Set select box top location
  selObj.style.left=(ofs[0]+_offsetLeft+(ofs[3]*-1))+1+'px';    // Set select box left location =
}else{
	var temp = (ofs[1]+_offsetTop+(ofs[4]*-1))-2;
   selObj.style.top=(ofs[1]+_offsetTop+(ofs[4]*-1))-2+'px';      // Set select box top location
  selObj.style.left=(ofs[0]+_offsetLeft+(ofs[3]*-1))+1+'px';    // Set select box left location =
}

  if(window.addEventListener){ // Mozilla, Netscape, Firefox
	selObj.addEventListener("click", evtMozSelect,false);
	selObj.addEventListener("change", evtMozSelect1, false);
    selObj.addEventListener("keyup", evtKeyForMozi, false);
    
    if(inpObj.id==strFromCityName){
	selObj.inputEl = "txtFromCityName";
	}else{
	selObj.inputEl = "txtToCityName";
	}

    selObj.selectEl = selObj;
  } else { // IE
    selObj.attachEvent('onclick', evtIESelect);
    selObj.attachEvent('onkeypress', evtKey);
    selObj.inputEl = inpObj.id;
    selObj.selectEl = selObj;
  }
  selObj.style.visibility = 'visible';
 }


function checkEvent(evt){
  var ie_var = "srcElement";
  var moz_var = "target";
  // "target" for Mozilla, Netscape, Firefox et al. ; "srcElement" for IE
	//alert("evt[moz_var]:---->"+evt[moz_var]);
  if(evt[moz_var]) {
    e_out = [evt[moz_var]['inputEl'],evt[moz_var]['selectEl']];
	//alert("e_out----: Mozilla :- "+e_out);
  } else {
    e_out = [evt[ie_var]['inputEl'],evt[ie_var]['selectEl'] ];
	//alert("e_out----: IE :- "+e_out);
  }
  //alert("e_out----:"+e_out);
  return e_out;
}

function comboFocus(cId) {
document.getElementById(cId).focus();
  return false;
}

function evtMozSelect(evt) {
	//alert("In evtMozSelect -->"+evt);
  //objs = checkEvent(evt);
  idEdit = objs[0];
  idSel = objs[1];
	//alert("Mozilla : idEdit :--> "+idEdit);
	//alert("Mozilla : idSel :--> "+idSel);
  
  /*
  if(idSel.selectedIndex > -1) {
    document.getElementById(idEdit).value = idSel.options[idSel.options.selectedIndex].text;
    idSel.selectedIndex = -1;
  }*/
  if (eval(idSel.options.selectedIndex) < 0)
	{
		idSel.style.visibility = 'visible';
		return;
	}

 //following code for populating the to city combo depending on the from city selected 
	if (idEdit=="txtFromCityName" && (idSel.options[idSel.options.selectedIndex].value=="-")){
		document.getElementById("txtFromCityName").value ="";
		document.getElementById("hidFromCityCode").value ="";
		document.getElementById(strFromCityName).style.display='none'; 
		document.getElementById("txtFromCityName").focus();
	}
	else if (idEdit=="txtFromCityName" && (idSel.options[idSel.options.selectedIndex].value!=0)){
		document.getElementById("txtFromCityName").value =idSel.options[idSel.options.selectedIndex].text;
		document.getElementById("hidFromCityCode").value =idSel.options[idSel.options.selectedIndex].value;
		document.getElementById(strFromCityName).style.display='none'; 
	}

	if (idEdit=="txtToCityName" && (idSel.options[idSel.options.selectedIndex].value=="-")){
		document.getElementById("txtToCityName").value ="";
		document.getElementById("hidToCityCode").value ="";
		document.getElementById(strFromCityName).style.display='none'; 
		document.getElementById("txtToCityName").focus();
	}
	else if (idEdit=="txtToCityName" && (idSel.options[idSel.options.selectedIndex].value!=0)){
		document.getElementById("txtToCityName").value =idSel.options[idSel.options.selectedIndex].text;
		document.getElementById("hidToCityCode").value =idSel.options[idSel.options.selectedIndex].value;
		document.getElementById(strToCityName).style.display='none'; 
	}
  comboFocus(idEdit);
}

function evtMozSelect1(evt)
{
	//alert("In evtMozSelect1 -->"+evt);
	objs = checkEvent(evt);
	idEdit = objs[0];
	idSel = objs[1];
/*
	
	if (eval(idSel.options.selectedIndex) < 0)
	{
		idSel.style.visibility = 'visible';
		return;
	}

 //following code for populating the to city combo depending on the from city selected 
	if (idEdit=="txtFromCityName" && (idSel.options[idSel.options.selectedIndex].value=="-")){
		document.getElementById("txtFromCityName").value ="";
		document.getElementById("hidFromCityCode").value ="";
		document.getElementById(strFromCityName).style.display='none'; 
		document.getElementById("txtFromCityName").focus();
	}
	else if (idEdit=="txtFromCityName" && (idSel.options[idSel.options.selectedIndex].value!=0)){
		document.getElementById("txtFromCityName").value =idSel.options[idSel.options.selectedIndex].text;
		document.getElementById("hidFromCityCode").value =idSel.options[idSel.options.selectedIndex].value;
		document.getElementById(strFromCityName).style.display='none'; 
	}

	if (idEdit=="txtToCityName" && (idSel.options[idSel.options.selectedIndex].value=="-")){
		document.getElementById("txtToCityName").value ="";
		document.getElementById("hidToCityCode").value ="";
		document.getElementById(strFromCityName).style.display='none'; 
		document.getElementById("txtToCityName").focus();
	}
	else if (idEdit=="txtToCityName" && (idSel.options[idSel.options.selectedIndex].value!=0)){
		document.getElementById("txtToCityName").value =idSel.options[idSel.options.selectedIndex].text;
		document.getElementById("hidToCityCode").value =idSel.options[idSel.options.selectedIndex].value;
		document.getElementById(strToCityName).style.display='none'; 
	}
  comboFocus(idEdit);*/
}
/*
function evtMozSelect2(evt) {
objs = checkEvent(evt);
alert("evtMozSelect2 :"+objs);
  idEdit = objs[0];
  idSel = objs[1];
  
}*/


function evtIESelect(evt) {
  if(_objSelActive) {
    objs = checkEvent(evt);
    idEdit = objs[0];
    idSel = objs[1];
	//alert("IE : idEdit :--> "+idEdit);
	//alert("IE : idSel :--> "+idSel);

	//following code for populating the to city combo depending on the from city selected 
	if (eval(idSel.options.selectedIndex) < 0)
	{
		idSel.style.visibility = 'visible';
		return;
	}

	if (idEdit==strFromCityName && (idSel.options[idSel.options.selectedIndex].value=="-"))
	{
		document.getElementById("txtFromCityName").value ="";
		document.getElementById("hidFromCityCode").value ="";
		//document.getElementById(idEdit).style.display='none';
	}
	else if (idEdit==strFromCityName && (idSel.options[idSel.options.selectedIndex].value!=0))
	{
		document.getElementById("txtFromCityName").value =idSel.options[idSel.options.selectedIndex].text;
		document.getElementById("hidFromCityCode").value =idSel.options[idSel.options.selectedIndex].value;
		document.getElementById(idEdit).style.display='none';
	}

	if (idEdit==strToCityName && (idSel.options[idSel.options.selectedIndex].value=="-"))
	{
		document.getElementById("txtToCityName").value ="";
		document.getElementById("hidToCityCode").value ="";
		//document.getElementById(idEdit).style.display='none';
	}
	else if (idEdit==strToCityName && (idSel.options[idSel.options.selectedIndex].value!=0))
	{
		document.getElementById("txtToCityName").value =idSel.options[idSel.options.selectedIndex].text;
		document.getElementById("hidToCityCode").value =idSel.options[idSel.options.selectedIndex].value;
		document.getElementById(idEdit).style.display='none';
	}
	//_objSelActive = false;
  } else {
    _objSelActive = true;
  }
}

function comboIESelect(idEdit, idSel) {
  if(idSel.selectedIndex > -1)
  {
	document.getElementById(idEdit).value = idSel.options[idSel.options.selectedIndex].value;
  }
  //comboFocus(idEdit);
 if(idEdit == strFromCityName && (idSel.options[idSel.options.selectedIndex].value== "-"))
 {
	document.getElementById("txtFromCityName").value = "";
	document.getElementById("hidFromCityCode").value = "";
	document.getElementById(idEdit).style.display = 'none';
	document.getElementById("txtFromCityName").focus();
 }
 else if(idEdit==strToCityName && (idSel.options[idSel.options.selectedIndex].value== "-"))
 {
	document.getElementById("txtToCityName").value = "";
	document.getElementById("hidToCityCode").value = "";
	document.getElementById(idEdit).style.display = 'none'; 
	document.getElementById("txtToCityName").focus();
 }
 else if(idEdit == strFromCityName && (idSel.options[idSel.options.selectedIndex].value!=0))
 {
	document.getElementById("txtFromCityName").value = idSel.options[idSel.options.selectedIndex].text;
	document.getElementById("hidFromCityCode").value = idSel.options[idSel.options.selectedIndex].value;
	document.getElementById(idEdit).style.display = 'none';
	document.getElementById("txtToCityName").focus();
 }
 else if(idEdit==strToCityName && (idSel.options[idSel.options.selectedIndex].value!=0))
 {
	document.getElementById("txtToCityName").value = idSel.options[idSel.options.selectedIndex].text;
	document.getElementById("hidToCityCode").value = idSel.options[idSel.options.selectedIndex].value;
	document.getElementById(idEdit).style.display = 'none'; 
	document.forms[0].txtJourneyDate.focus();
 }
  //_objSelActive = false;
}

function comboMoziSelect(idEdit, idSel) {
  
  if(idSel.selectedIndex > -1)
  {
	document.getElementById(idEdit).value = idSel.options[idSel.options.selectedIndex].value;
  }

  //comboFocus(idEdit);

 if(idEdit == "txtFromCityName" && (idSel.options[idSel.options.selectedIndex].value== "-"))
 {
	document.getElementById("txtFromCityName").value = "";
	document.getElementById("hidFromCityCode").value = "";
	//document.getElementById(idEdit).style.display = 'none';
	document.getElementById("slctFromCity").style.display="none";
	document.getElementById("txtFromCityName").focus();
 }
 else if(idEdit=="txtToCityName" && (idSel.options[idSel.options.selectedIndex].value== "-"))
 {
	document.getElementById("txtToCityName").value = "";
	document.getElementById("hidToCityCode").value = "";
	//document.getElementById(idEdit).style.display = 'none'; 
	document.getElementById("slctToCity").style.display="none";
	document.getElementById("txtToCityName").focus();
 }
 else if(idEdit == "txtFromCityName" && (idSel.options[idSel.options.selectedIndex].value!=0))
 {
	document.getElementById("txtFromCityName").value = idSel.options[idSel.options.selectedIndex].text;
	document.getElementById("hidFromCityCode").value = idSel.options[idSel.options.selectedIndex].value;
	document.getElementById(strFromCityName).style.display = 'none';
	document.getElementById("txtToCityName").focus();
 }
 else if(idEdit=="txtToCityName" && (idSel.options[idSel.options.selectedIndex].value!=0))
 {
	document.getElementById("txtToCityName").value = idSel.options[idSel.options.selectedIndex].text;
	document.getElementById("hidToCityCode").value = idSel.options[idSel.options.selectedIndex].value;
	document.getElementById(strToCityName).style.display = 'none'; 
	document.forms[0].txtJourneyDate.focus();
 }
  //_objSelActive = false;
}

function evtKey(evt) {
	
  objs = checkEvent(evt);
  idEdit = objs[0];

  idSel = objs[1];

  var objW = browserSpec(evt);
  
  keyCode = objW.keyCode;
 
  if (keyCode == 13 || keyCode == 32) {
    comboIESelect(idEdit,idSel);
  }
  else if (keyCode == 27)
  {
	//document.getElementById(idEdit).style.display = 'none';
    idSel.selectedIndex = -1;
    comboFocus(idEdit);
    _objSelActive = false;
  }
}


function evtKeyForMozi(evt) {
  objs = checkEvent(evt);
  idEdit = objs[0];

  idSel = objs[1];

  var objW = browserSpec(evt);
  /*if(window.event)
    keyCode = window.event.keyCode;  //IE
  else
    keyCode = evt.keyCode;           //firefox*/

	keyCode = objW.keyCode;

  if (keyCode == 13 || keyCode == 32) {
    comboMoziSelect(idEdit,idSel);
  }
  else if (keyCode == 27)
  {
	//document.getElementById(idEdit).style.display = 'none';
    idSel.selectedIndex = -1;
    comboFocus(idEdit);
    _objSelActive = false;
  }
}


function checkBrowser() {
  // Credit for this function: http://www.quirksmode.org/js/detect.html
  // Visit the URL for a complete tutorial on this function
  var BrowserDetect = {
    init: function () {
      this.browser = this.searchString(this.dataBrowser) || "An unknown browser";
      this.version = this.searchVersion(navigator.userAgent)
        || this.searchVersion(navigator.appVersion)
        || "an unknown version";
      this.OS = this.searchString(this.dataOS) || "an unknown OS";
    },

	searchString: function (data) {
      for (var i=0;i<data.length;i++) {
        var dataString = data[i].string;
        var dataProp = data[i].prop;
        this.versionSearchString = data[i].versionSearch || data[i].identity;
        if (dataString) {
          if (dataString.indexOf(data[i].subString) != -1)
            return data[i].identity;
        }
        else if (dataProp)
          return data[i].identity;
      }
    },

    searchVersion: function (dataString) {
      var index = dataString.indexOf(this.versionSearchString);
      if (index == -1) return;
      return parseFloat(dataString.substring(index+this.versionSearchString.length+1));
    },
    dataBrowser: [
      { string: navigator.userAgent,
        subString: "OmniWeb",
        versionSearch: "OmniWeb/",
        identity: "OmniWeb"
      },
      {
        string: navigator.vendor,
        subString: "Apple",
        identity: "Safari"
      },
      {
        prop: window.opera,
        identity: "Opera"
      },
      {
        string: navigator.vendor,
        subString: "iCab",
        identity: "iCab"
      },
      {
        string: navigator.vendor,
        subString: "KDE",
        identity: "Konqueror"
      },
      {
        string: navigator.userAgent,
        subString: "Firefox",
        identity: "Firefox"
      },
      {
        string: navigator.vendor,
        subString: "Camino",
        identity: "Camino"
      },
      {   // for newer Netscapes (6+)
        string: navigator.userAgent,
        subString: "Netscape",
        identity: "Netscape"
      },
      {
        string: navigator.userAgent,
        subString: "MSIE",
        identity: "Explorer",
        versionSearch: "MSIE"
      },
      {
        string: navigator.userAgent,
        subString: "Gecko",
        identity: "Mozilla",
        versionSearch: "rv"
      },
      {     // for older Netscapes (4-)
        string: navigator.userAgent,
        subString: "Mozilla",
        identity: "Netscape",
        versionSearch: "Mozilla"
      }
    ],
	dataOS : [
      {
        string: navigator.platform,
        subString: "Win",
        identity: "Windows"
      },
      {
        string: navigator.platform,
        subString: "Mac",
        identity: "Mac"
      },
      {
        string: navigator.platform,
        subString: "Linux",
        identity: "Linux"
      }
    ]

  };
  BrowserDetect.init();
  return [BrowserDetect.browser,BrowserDetect.version,BrowserDetect.OS];
}

function repositionComboBox() {
  for(j=0; j<_comboBoxArray.length;j++) {
    positionComboBox(_comboBoxArray[j][0],_comboBoxArray[j][1])
  }
}

function getCity()
{
	req = initRequest1();
	var obj = document.forms[0];
	var strFrmCityName ="";
	var strToCityName ="";
	if(_strSearchFor=="F")
	{
		strFrmCityName =obj.txtFromCityName.value;
	}
	else
	{
		strToCityName =obj.txtToCityName.value;
        var strFromCityCode =obj.hidFromCityCode.value;
	}
	//var strCity="CityList";
	req.onreadystatechange = processRequestCity;
	if(_strSearchFor=="F")
	{
        var strCity="CityList";
		var url = "http://www.paulotravels.com/ismarts/eticketweb/jsp/loginController.do?hidAction="+strCity+"&hidFrmCityName="+strFrmCityName;
	}
	else
	{
        var strCity="ToCityList";
		var url = "http://www.paulotravels.com/ismarts/eticketweb/jsp/loginController.do?hidAction="+strCity+"&hidFrmCityName="+strFromCityCode+"&hidToCityName="+strToCityName;
	}
	req.open("GET", url, true);
	req.send(null);
}

/*
Function Name: initRequest1()
Description	 : This function is required as part of AJAX.
Author		 : Abhijeet S Bhatambrekar
Parameter	 : 
Return Type	 : 
*/
function initRequest1()
{
	req=null;
	try
	{
		req=new XMLHttpRequest();	// Firefox, Opera 8.0+, Safari
	}
	catch(e)
	{
		// Internet Explorer 5.5 and above 
		try
		{
			req=new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch (e)
		{
			req=new ActiveXObject("Microsoft.XMLHTTP");
		}
	}
	return req;
}

/*
Function Name: processRequestCity()
Description	 : This function is required as part of AJAX.
Author		 : Abhijeet S Bhatambrekar
Parameter	 : 
Return Type	 : 
*/
function processRequestCity()
{
	if (req.readyState == 4)
	{
		if (req.status == 200)
		{
			var msg = "";
			var result = "";
			var temp;
			var strReturnString = req.responseText;
			var strSplit = strReturnString.split("#");
			document.forms[0].hidCityCodeStr.value=strSplit[0];
			document.forms[0].hidCityNameStr.value=strSplit[1];
			strCodeString = strSplit[0];
			strNameString = strSplit[1];
			if(_strSearchFor=="F")
			{
				createComboList("F");
				positionComboBox(strFromCityName,strFromCityName);
			}
			else
			{
				createComboList("T");
				positionComboBox(strToCityName,strToCityName);
			}
		}
	}
}


/*
Function Name: processRequestCity()
Description	 : This function is required as part of AJAX.
Author		 : Abhijeet S Bhatambrekar
Parameter	 : 
Return Type	 : 
*/
function processRequestToCity()
{
	if (req.readyState == 4) 
	{
		if (req.status == 200) 
		{
			var msg = "";
			var result = "";
			var temp;
			var strReturnString = req.responseText;
			var strSplit = strReturnString.split("#");
			strCodeString = strSplit[0];
			strNameString = strSplit[1];
			createComboList(document.getElementById(strToCityName));
			positionComboBox(strToCityName,strToCityName);
			if(strCodeString!="" && strNameString!="")
			{
				document.getElementById(strToCityName).size=(_CityCount+1);
				document.getElementById(strToCityName).disabled=false	;
			}
			else if(strCodeString=="")
			{
				document.getElementById(strToCityName).disabled=true;
				document.getElementById(strToCityName).size=1;
			}
		}
	}
}

function trim(s)
{
	while (s.substring(0,1) == ' ')
	{
		s = s.substring(1,s.length);
	}
	while (s.substring(s.length-1,s.length) == ' ')
	{
		s = s.substring(0,s.length-1);
	}
	return s;
}


/*
Function Name: checkOnlyNumeric()
Description	 : This function is used to check only numeric values.
Author		 : Abhijeet S Bhatambrekar
Parameter	 : String, Text box Control name
Return Type	 : boolean
*/
function checkOnlyNumeric(vTextBxValue, vTextBxCntrl)
{
	var vNumericString = "1234567890";
	var vCharFlag = "N";
	if(vTextBxValue != "")
	{
		for(var i = 0; i < vTextBxValue.length; i++)
		{
			if(vNumericString.indexOf(vTextBxValue.charAt(i)) == -1)
			{
				vCharFlag = "Y";
			}
		}

		if (vCharFlag == "N")
		{
			vTextBxCntrl.focus();
			vTextBxCntrl.select();
			return false;
		}
	}
	return true;
}


var _strSearchFor ="";

function onCityNameSearch(strSearch,event)
{
	///alert("in onCityNameSearch");
	var objWin =  (event);
	var strFromCityName = "";
	var strToCityName = "";
	var strInValidStr = "";

	if (strSearch == "F")
	{
		//alert(objWin.keyCode);
		if (objWin.keyCode == 9)
		{
			if(document.getElementById("slctFromCity"))
			{
				//alert(document.getElementById("slctFromCity").selectedIndex);
				if(document.getElementById("slctFromCity").selectedIndex == -1)
				{
					document.getElementById("slctFromCity").selectedIndex = 0;
				}
				else
				{
					strInValidStr = document.getElementById("slctFromCity").options[document.getElementById("slctFromCity").selectedIndex].value;
				}
			}
			else
				strInValidStr = "-";

			
			
			if (strInValidStr == "-")
			{
				return;
			}
			document.getElementById("txtFromCityName").value = document.getElementById("slctFromCity").options[document.getElementById("slctFromCity").selectedIndex].text;
			document.getElementById("hidFromCityCode").value = document.getElementById("slctFromCity").options[document.getElementById("slctFromCity").selectedIndex].value;
			document.getElementById("slctFromCity").style.display = 'none';
			return;
		}
	}
	else if (strSearch == "T")
	{
		//alert(strSearch);
		//alert(objWin.keyCode);
		//alert(document.getElementById("hidFromCityCode").value);
		
		if(document.getElementById("hidFromCityCode").value =="")
		{
			alert("Please Enter From City First");
			document.getElementById("txtFromCityName").focus();
			document.getElementById("txtFromCityName").value = "";
			return;
		}
		if (objWin.keyCode == 9)
		{
			//alert("1184 :--> "+document.getElementById("slctToCity").selectedIndex);
			if(document.getElementById("slctToCity"))
			{
				if(document.getElementById("slctToCity").selectedIndex == -1)
				{
					document.getElementById("slctToCity").selectedIndex = 0;
				}
				else
				{
					//alert(document.getElementById("slctToCity").selectedIndex);
					strInValidStr = document.getElementById("slctToCity").options[document.getElementById("slctToCity").selectedIndex].value;
				}
				//alert(strInValidStr);
				if (strInValidStr == "-")
				{
					return;
				}
				document.getElementById("txtToCityName").value = document.getElementById("slctToCity").options[document.getElementById("slctToCity").selectedIndex].text;
				document.getElementById("hidToCityCode").value = document.getElementById("slctToCity").options[document.getElementById("slctToCity").selectedIndex].value;
				document.getElementById("slctToCity").style.display = 'none';
				return;
			}
			else
			{
				if(trim(document.getElementById("txtToCityName").value) == "")
				{
					//alert("Please Enter To City");
					document.getElementById("txtToCityName").focus();
					return;
				}
				if(document.getElementById("slctToCity"))
				{
					if(document.getElementById("slctToCity").selectedIndex == -1)
					{
						//document.getElementById("slctToCity").selectedIndex = 0;
					}
					else
					{
						document.getElementById("slctToCity").style.display = 'none';
					}
				}
			}
		}
	}

	if((objWin.keyCode == 13) && strSearch == "F")
	{
		if(trim(document.getElementById("txtFromCityName").value)=="")
		{
			/*document.getElementById("txtFromCityName").value = document.getElementById("slctFromCity").options[document.getElementById("slctFromCity").selectedIndex].text;
			document.getElementById("hidFromCityCode").value = document.getElementById("slctFromCity").options[document.getElementById("slctFromCity").selectedIndex].value;
			document.getElementById("slctFromCity").style.display = 'none';
			document.getElementById("txtToCityName").focus();*/
			return;
		}
		else
		{
			if(document.getElementById("slctFromCity").selectedIndex == -1)
			{
				
			}
			else
			{
				document.getElementById("txtFromCityName").value = document.getElementById("slctFromCity").options[document.getElementById("slctFromCity").selectedIndex].text;
				document.getElementById("hidFromCityCode").value = document.getElementById("slctFromCity").options[document.getElementById("slctFromCity").selectedIndex].value;
				document.getElementById("slctFromCity").style.display = 'none';
				document.getElementById("txtToCityName").focus();
				return;
			}
		}
	}
	else if(objWin.keyCode == 13 && strSearch == "T")
	{
		if(trim(document.getElementById("txtToCityName").value)=="")
		{
			/*document.getElementById("txtToCityName").value = document.getElementById("slctToCity").options[document.getElementById("slctToCity").selectedIndex].text;
			document.getElementById("hidToCityCode").value = document.getElementById("slctToCity").options[document.getElementById("slctToCity").selectedIndex].value;
			document.getElementById("slctToCity").style.display = 'none';
			document.getElementById("txtJourneyDate").focus();*/
			return;
		}
		else
		{
			if(document.getElementById("slctToCity").selectedIndex == -1)
			{
				
			}
			else
			{
				document.getElementById("txtToCityName").value = document.getElementById("slctToCity").options[document.getElementById("slctToCity").selectedIndex].text;
				document.getElementById("hidToCityCode").value = document.getElementById("slctToCity").options[document.getElementById("slctToCity").selectedIndex].value;
				document.getElementById("slctToCity").style.display = 'none';
				document.getElementById("txtJourneyDate").focus();
				return;
			}
		}
	}
	if(objWin.keyCode == 40 && strSearch == "F")
	{
		if(document.getElementById("slctFromCity"))
		{
			document.getElementById("slctFromCity").focus();
		}
	}
	else if(objWin.keyCode == 40 && strSearch == "T")
	{
		if(document.getElementById("slctToCity"))
		{
			document.getElementById("slctToCity").focus();
		}
	}
	else
	{
		if (strSearch == "F")
		{
			var n1 = document.getElementById("txtFromCityName").value;
			if (document.getElementById("hidFromCityCode").value != "")
			{
				if (n1.substring(n1.indexOf("(")+1,n1.indexOf(")")) == document.getElementById("hidFromCityCode").value)
				{ 
					strFromCityName = n1.substring(n1.indexOf("(")-1,0)
					document.forms[0].txtFromCityName.value = strFromCityName;
					document.forms[0].hidFromCityCode.value ="";
				}
				else
				{ 
					document.forms[0].hidFromCityCode.value ="";
				}
			}

			/*if(document.getElementById("loader"))
			{
				document.getElementById("loader").style.display="inline";
			}*/
		}
		else
		{
			var n1 = document.getElementById("txtToCityName").value;
			if (document.getElementById("hidToCityCode").value != "")
			{
				if (n1.substring(n1.indexOf("(")+1,n1.indexOf(")")) == document.getElementById("hidToCityCode").value)
				{
					strToCityName = n1.substring(n1.indexOf("(")-1,0)
					document.forms[0].txtToCityName.value = strToCityName;
					document.forms[0].hidToCityCode.value ="";
				}
				else
				{
					document.forms[0].hidToCityCode.value ="";
				}
			}
			/*if(document.getElementById("loader1"))
			{
				document.getElementById("loader1").style.display="inline";
			}*/
		}
		_strSearchFor = strSearch; //'F' - From City name and 'T' - To City Name
		
		setTimeout("getCity()", 1);
		//getCity();
	}
}


function test(param)
{
	if (param == "T")
	{
		if(document.getElementById("slctFromCity"))
		{
			document.getElementById("slctFromCity").style.display="none";
		}
	}
	else if (param == "F")
	{
		//alert("IN test");
		if(document.getElementById("slctToCity"))
		{
			document.getElementById("slctToCity").style.display="none";
		}
		//document.getElementById("txtFromCityName").focus();

	}
	else
	{
		if(document.getElementById("slctFromCity")){
			document.getElementById("slctFromCity").style.display="none";
		}
		if(document.getElementById("slctToCity")){
			document.getElementById("slctToCity").style.display="none";
		}
	}

	/*if(document.getElementById("loader"))
	{
		document.getElementById("loader").style.display="none";
	}

	if(document.getElementById("loader1"))
	{
		document.getElementById("loader1").style.display="none";
	}*/
}


/*
	Function Name: onContinueForPrasanna()
	Description	 : This function is used to validate the input data and call controller to invoke required action.
	Author		 : Abhijeet S Bhatambrekar
	Parameter	 : String user type
	Return Type	 : void
*/

function onContinueForPrasanna(strUserType,event)
{
	var documentObject	=	document.frmWebHomePage;

	if(validateInputDataForPrasanna(strUserType))
		return;

	if(documentObject.rdoUserType[0].checked == true)
		documentObject.hidUserType.value = documentObject.rdoUserType[0].value;
	else
		documentObject.hidUserType.value = documentObject.rdoUserType[1].value;

	if(documentObject.rdoBookingOption[0].checked == true)
		documentObject.hidBookingOption.value = documentObject.rdoBookingOption[0].value;
	else if(documentObject.rdoBookingOption[1].checked == true)
		documentObject.hidBookingOption.value = documentObject.rdoBookingOption[1].value;

	//objFormName.comboName.options[objFormName.comboName.selectedIndex].text

	documentObject.hidFromCityName.value	=	documentObject.slctFromCity.options[documentObject.slctFromCity.selectedIndex].text;
	documentObject.hidToCityName.value		=	documentObject.slctToCity.options[documentObject.slctToCity.selectedIndex].text;

	documentObject.hidAction.value = "LOGIN";
	documentObject.method = "post";
	documentObject.action = "loginController.do";
	documentObject.submit();
}

/*
	Function Name: validateInputData()
	Description	 : This function is used to validate the input data before invoking required action.
	Author		 : Abhijeet S Bhatambrekar
	Parameter	 : string user type
	Return Type	 : void
*/

function validateInputDataForPrasanna(strUserType)
{
	var documentObject	=	document.frmWebHomePage;
	
	if(documentObject.slctFromCity.value == "0")
	{
		alert("Please select From City");
		documentObject.slctFromCity.focus();
		return true;
	}

	if(documentObject.slctToCity.value == "0")
	{
		alert("Please select To City");
		documentObject.slctToCity.focus();
		return true;
	}
	if(documentObject.slctFromCity.value == "0" && documentObject.slctToCity.value=="0")
	{
		alert("Please select city.");
		documentObject.slctFromCity.focus();
		return true;
	}

	if(documentObject.slctFromCity.value == documentObject.slctToCity.value)
	{
		alert("From City and To City should not be the same");
		documentObject.slctToCity.focus();
		return true;
	}

	if(documentObject.txtJourneyDate.value == "")
	{
		alert("Please select the Journey Date");
		return true;
	}
	if(compareDate(documentObject.txtJourneyDate, documentObject.hidSystemDate))
	{
		alert("Please enter Journey Date greater than or equal to today's date.");
		return true;
	}

	if(documentObject.rdoBookingOption[1].checked == true)
	{
		if(documentObject.txtReturnJourneyDate.value == "")
		{
			alert("Please select the Return Journey Date, as you have selected Round Trip option");
			return true;
		}

		if(compareDate(documentObject.txtReturnJourneyDate, documentObject.txtJourneyDate))
		{
			alert("Please enter Return Date greater than or equal to Journey Date.");
			return true;
		}

		if(compareDate(documentObject.txtReturnJourneyDate, documentObject.hidSystemDate))
		{
			alert("Please enter Return Date greater than or equal to today's date.");
			return true;
		}
	}else{
		if(documentObject.txtReturnJourneyDate.value != ""){
			alert("When 'One Way' is selected, you cannot enter the 'Return Date'.");
			documentObject.txtReturnJourneyDate.value ="";
			return true;
		}
	}

	if(strUserType == "RU")
	{
		if(documentObject.txtUserName.value == "")
		{
			alert("Please enter Login Id");
			documentObject.txtUserName.focus();
			return true;
		}

		if(documentObject.txtUserPassword.value == "")
		{
			alert("Please enter Password");
			documentObject.txtUserPassword.focus();
			return true;
		}
	}
	return false;
}
/*
Function Name	: checkSysDate()
Description		: This function is used to get the City value as per the id from the page and call the request object and go to the process page
Author			: Shreyash Thakre
Return Type		: -
*/
function checkSysDate()
{
	req= initRequest_Date();
	var url = "http://www.paulotravels.com/ismarts/eticketweb/jsp/dateServlet.go";
	req.onreadystatechange=processRequestDate;
	req.open("GET", url,true);
	req.send("null");
}
/*
Function Name	: checkSysDate()
Description		: This function is used to get the City value as per the id from the page and call the request object and go to the process page
Author			: Shilpa Nadkarni
Return Type		: -
*/
function pageHitCount()
{
	//alert("In pageHitCount()");
	reqPage = initRequest_Page();	
	//alert("reqPage:"+reqPage);	
	var url = "http://www.paulotravels.com/ismarts/eticketweb/jsp/loginController.do?hidAction=hitcount";
	reqPage.onreadystatechange=processRequestPageHitCount1;

	reqPage.open("GET", url,true);
	reqPage.send("null");
}


/*
Function Name	: initRequest_Date()
Description		: This function is used to give a call to the request object.
Parameter		: void
Author			: Shreyash Thakre
Return Type		: -
*/
function initRequest_Date()
{
	req=null;
	try
	{
		req=new XMLHttpRequest();  // Firefox, Opera 8.0+, Safari
	}
	catch (e)
	{
		// Internet Explorer 5.5 and above 
		try
		{
			req=new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch (e)
		{
			 req=new ActiveXObject("Microsoft.XMLHTTP");
		}
	}
	return req;
}
/*
Function Name	: initRequest_Date()
Description		: This function is used to give a call to the request object.
Parameter		: void
Author			: Shreyash Thakre
Return Type		: -
*/
function initRequest_Page()
{
	//alert("In initRequest_Page");
	reqPage=null;
	try
	{
		reqPage=new XMLHttpRequest();  // Firefox, Opera 8.0+, Safari
	}
	catch (e)
	{
		// Internet Explorer 5.5 and above 
		try
		{

			reqPage=new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch (e)
		{			
			 reqPage=new ActiveXObject("Microsoft.XMLHTTP");
		}
	}
	//alert("In initRequest_Page : reqPage::"+reqPage);
	return reqPage;
}


/*
Function Name	: processRequestDate()
Description		: This function is used to process the request.
Parameter		: void
Author			: Shreyash Thakre
Return Type		: -
*/
function processRequestDate(e)
{
	var evt = browserSpec(e)
	var rs = req.readyState || "None";
	
	if (req.readyState == 4)
	{
		if (req.status == 200)
		{
			var msg		= "";
			var result	= "";
			var shwhidimg="";
			var temp;
			msg	= req.responseXML.getElementsByTagName("message")[0];
//			alert("msgdffddffddf:"+msg);
			result = msg.childNodes[0].nodeValue;
			//alert("result:"+result);
			document.forms[0].hidSystemDate.value =result;
			document.forms[0].txtJourneyDate.value =result;
		}
	}
}

/*
Function Name	: processRequestDate()
Description		: This function is used to process the request.
Parameter		: void
Author			: Shreyash Thakre
Return Type		: -
*/
function processRequestPageHitCount1(e)
{
	var msg1		= "";
	var result1	= "";			
	var evt = browserSpec(e)
//	var rs = reqPage.readyState || "None";
	
	if (reqPage.readyState == 4)
	{
		if (reqPage.status == 200)
		{
			//alert("msg1:"+reqPage.responseText);
			msg1	= reqPage.responseXML.getElementsByTagName("message")[0];
		//alert("msg1 :"+msg1);
			result1 = msg1.childNodes[0].nodeValue;
			document.forms[0].txtNoOfHits.value =result1;
			//alert("jjj:"+result1);
		}
	}
}

function browserSpec(e)
{
	if (navigator.appName == "Netscape")
	{
		return e;
	}
	else
	{
		return window.event;
	}
}

function openReturnDate()
{  
	if(document.frmWebHomePage.rdoBookingOption[0].checked == true)
	{
		return true;
	}
	else
	{
		show_calendar('document.frmWebHomePage.txtReturnJourneyDate',document.frmWebHomePage.txtReturnJourneyDate.value,document.frmWebHomePage.hidSystemDate.value);
	}
}

function openReturnDateSchedulePage()
{  
	if(document.frmSchedule.rdoRoundTripFlg[0].checked == true)
	{
		return true;
	}
	else
	{
		show_calendar('document.frmSchedule.txtRetJourneyDate', document.frmSchedule.txtRetJourneyDate.value,document.frmSchedule.hidSysDate.value);
	}
}

function onCheckRetDate()
{    
	if(document.frmWebHomePage.txtReturnJourneyDate.value != "")
	{
		document.frmWebHomePage.txtReturnJourneyDate.value  = "";
	}
}

function onCheckRetDateSchedulePage()
{    
	if(document.frmSchedule.txtRetJourneyDate.value != "")
	{
		document.frmSchedule.txtRetJourneyDate.value  = "";
	}
}