/* Project : Airavath Module : B2C Source or Header file name : jsfunctions.js Description : It contains JavaSript functions used in B2C pages. Author : Venkatesh Prabhu M Copyright : Copyright © 1996-2011, Robosoft Technologies Pvt.Ltd. History : */ var gResizeDelay; function WindowResized() { var ClientHeight=document.documentElement.clientHeight; var ClientWidth=document.documentElement.clientWidth; // Checking if height or width is changed - Useful for IE and Google Chrome if(gClientHeight!=ClientHeight || gClientWidth!=ClientWidth) { gClientHeight=ClientHeight; gClientWidth=ClientWidth; try { if(document.getElementById('divDialogBox').style.display=='' || document.getElementById('divDialogBox').style.display=='block') correctProgressBarAlertPopup(); if(gbSelectBus==true || gbSelectBus=='true') { if(document.getElementById('divDisplayOnwardBusLayout').style.display=='block' || document.getElementById('divDisplayOnwardBusLayout').style.display=='') displayBusPreview('Onward'); else if(document.getElementById('divDisplayReturnBusLayout').style.display=='block' || document.getElementById('divDisplayReturnBusLayout').style.display=='') displayBusPreview('Return'); } else if(gbConfirmTicket==true || gbConfirmTicket=='true') { if(document.getElementById('divDisplayOnwardBusLayout').style.display=='block' || document.getElementById('divDisplayOnwardBusLayout').style.display=='') selectedSeats('Onward'); else if(document.getElementById('divDisplayReturnBusLayout').style.display=='block' || document.getElementById('divDisplayReturnBusLayout').style.display=='') selectedSeats('Return'); } }catch(e){} } } window.onresize=function() { clearTimeout(gResizeDelay); gResizeDelay=setTimeout("WindowResized()", 200); } /* --- Common JS functions - Starts --- */ /* Function : checkAllCheckboxes(inTableId, inHaveDependentCheckBox) Brief : It is used to check/uncheck all the checkboxes organized in the given table. If dependent checkbox present then the state of selected checkbox will be copied to its dependent Detail : None Input param : inTableID1 - Table containing the checkboxes inHaveDependentCheckBox - value indicating whether dependent fields (in other table) exists or not Input/output param : None Return : None */ function checkAllCheckboxes(inTableID, inHaveDependentCheckBox) { try { var TableObject = document.getElementById(inTableID); var InputObject = TableObject.getElementsByTagName("input"); var CheckAllObject = InputObject[0]; if(CheckAllObject.checked==true) {//If CheckAll is checked var iIndex=0; for(iIndex=1;iIndex0) // If Select Box is not empty { for(iCounter=0;iCounter2) { iDay=DateValues[0]; iMonth=DateValues[1]; iYear=DateValues[2]; iMonth--; //Sadananda Shetty, 31-Jan-11: Added as fix for a data selection defect } outDateObject = new Date(iYear, iMonth, iDay, 0, 0, 0, 0); }catch(e){} return outDateObject; } /* Function : displayProgressBar(inStatus) Brief : It is used to display/hide progress bar. Detail : None Input param : inStatus Input/output param : None Return : None */ function displayProgressBar(inStatus) { try { if(inStatus=='show') { document.getElementById('divDialogBoxInnerPanel').innerHTML="
" document.getElementById('divDialogBox').style.display='block'; document.getElementById('divDialogBoxInnerPanel').style.width='125px'; try {//Set width for the outer panel and the left of inner panel var ScrollLeft=0; if(gClientWidth<1000) { document.getElementById('divDialogBoxOuterPanel').style.width='1000px'; if(document.body.scrollLeft!=0) //For Google Chrome ScrollLeft=document.body.scrollLeft; else if(document.documentElement.scrollLeft!=0) //For IE and Firefox ScrollLeft=document.documentElement.scrollLeft; } else { document.getElementById('divDialogBoxOuterPanel').style.width=gClientWidth+'px'; } var DialogBoxInnerPanelLeft=parseInt((gClientWidth-125)/2)+ScrollLeft; document.getElementById('divDialogBoxInnerPanel').style.left=DialogBoxInnerPanelLeft+'px'; }catch(e){} try {//Set height for the outer panel and the top of inner panel //var PageBodyHeight=Number(document.getElementById("DocBody").clientHeight); var PageBodyHeight=getDocHeight(); if(gClientHeight
"+inMessage+"
" document.getElementById('divDialogBox').style.display='block'; document.getElementById('divDialogBoxInnerPanel').style.width=inWidth+'px'; try {//Set width for the outer panel and the left of inner panel var ScrollLeft=0; if(gClientWidth<1000) { document.getElementById('divDialogBoxOuterPanel').style.width='1000px'; if(document.body.scrollLeft!=0) //For Google Chrome ScrollLeft=document.body.scrollLeft; else if(document.documentElement.scrollLeft!=0) //For IE and Firefox ScrollLeft=document.documentElement.scrollLeft; } else { document.getElementById('divDialogBoxOuterPanel').style.width=gClientWidth+'px'; } var DialogBoxInnerPanelLeft=parseInt((gClientWidth-inWidth)/2)+ScrollLeft; document.getElementById('divDialogBoxInnerPanel').style.left=DialogBoxInnerPanelLeft+'px'; }catch(e){} try {//Set height for the outer panel and the top of inner panel // var PageBodyHeight=Number(document.getElementById("DocBody").clientHeight); var PageBodyHeight=getDocHeight(); if(gClientHeight1000) document.getElementById('divDialogBoxOuterPanel').style.width=gClientWidth+'px'; else document.getElementById('divDialogBoxOuterPanel').style.width='1000px'; }catch(e){} } /* --- Common JS functions - Ends --- */ /* --- JS functions used in Home related pages - Starts --- */ /* Function : setSelectBusHeight() Brief : It used to set height for the div related to Select Bus and Publish Message. Detail : None Input param : None Input/output param : None Return : None */ function setSelectBusHeight() { try { // document.getElementById('divSearchingBtn').style.display='none'; // document.getElementById('divSearchBtn').style.display='block'; var iSelectBusDivHeight=124; var iPublishMessageDivHeight=137; if(document.getElementById('frm:hdnReturnTripAllowed').value==true || document.getElementById('frm:hdnReturnTripAllowed').value=='true') { iSelectBusDivHeight=150; iPublishMessageDivHeight=111; } document.getElementById('divSelectBus').style.height=iSelectBusDivHeight+'px'; document.getElementById('divPublishMessage').style.height=iPublishMessageDivHeight+'px'; }catch(e){} } /* Function : checkReturnJourneyDetailsHome() Brief : It used to display/hide return journey related fields. Detail : None Input param : None Input/output param : None Return : None */ function checkReturnJourneyDetailsHome() { try { if(document.getElementById('frm:hdnReturnTripAllowed').value==true || document.getElementById('frm:hdnReturnTripAllowed').value=='true') {//If Return Trip is allowed if(document.getElementById('frm:subviewInner:rdbTripType:0').checked) {//If One Way document.getElementById('divReturnJourneyDate').style.display='none'; // document.getElementById('divReturnJourneyDateText').style.display='none'; } else if(document.getElementById('frm:subviewInner:rdbTripType:1').checked) {//If Round Trip document.getElementById('divReturnJourneyDate').style.display='block'; // document.getElementById('divReturnJourneyDateText').style.display='block'; } document.getElementById('frm:subviewInner:txtOnwardJourneyDate').readOnly = true; document.getElementById('frm:subviewInner:txtReturnJourneyDate').readOnly = true; } else {//If Return Trip is not allowed document.getElementById('divReturnJourneyDate').style.display='none'; // document.getElementById('divReturnJourneyDateText').style.display='none'; document.getElementById('frm:subviewInner:txtOnwardJourneyDate').readOnly = true; } }catch(e){} } /* Function : validateSearchBusOperation() Brief : It used to validate for the 'Seach Bus' operation, give alert message if it fails. Detail : None Input param : None Input/output param : None Return : None */ function validateSearchBusOperation() { var outbSearch=false; var AlertMessage=null; var FocusID=null; // document.getElementById('divSearchBtn').style.display='none'; // document.getElementById('divSearchingBtn').style.display='block'; if(document.getElementById('frm:subviewInner:sltSource').value==0 && document.getElementById('frm:subviewInner:sltDestination').value==0) {//If Source and Destination are not selected AlertMessage='Please select Source and Destination'; FocusID='frm:subviewInner:sltSource'; } else if(document.getElementById('frm:subviewInner:sltSource').value==0) {//If Source is not selected AlertMessage='Please select Source'; FocusID='frm:subviewInner:sltSource'; } else if(document.getElementById('frm:subviewInner:sltDestination').value==0) {//If Destination is not selected AlertMessage='Please select Destination'; FocusID='frm:subviewInner:sltDestination'; } else if(document.getElementById('frm:subviewInner:sltSource').value==document.getElementById('frm:subviewInner:sltDestination').value) {//If Source and Destination are same AlertMessage='Please select different Source and Destination'; FocusID='frm:subviewInner:sltSource'; } else {//If Source and Destination are selected and are not same var TodayDate=getDateObject(document.getElementById('frm:hdnToday').value); var BeforeDate=getDateObject(document.getElementById('frm:hdnBefore').value); var OnwardJourneyDate=null; var ReturnJourneyDate=null; if(document.getElementById('frm:hdnReturnTripAllowed').value==true || document.getElementById('frm:hdnReturnTripAllowed').value=='true') {//If Return Trip is allowed if(document.getElementById('frm:subviewInner:rdbTripType:0').checked) {//If One Way //If Departure Date is selected if(document.getElementById('frm:subviewInner:txtOnwardJourneyDate').value!='') { OnwardJourneyDate=getDateObject(document.getElementById('frm:subviewInner:txtOnwardJourneyDate').value); /* if(!(TodayDate<=OnwardJourneyDate && OnwardJourneyDate<=BeforeDate)) {//Check if Departure Date is between today and set before date AlertMessage='Please select Departure Date between '+document.getElementById('frm:hdnToday').value+' and '+document.getElementById('frm:hdnBefore').value; FocusID='frm:subviewInner:txtOnwardJourneyDate'; } */ if(TodayDate>OnwardJourneyDate) {//Check if Departure Date is before today AlertMessage='Please select Departure Date after '+document.getElementById('frm:hdnToday').value; FocusID='frm:subviewInner:txtOnwardJourneyDate'; } else if(OnwardJourneyDate>BeforeDate) {//Check if Departure Date is after the set before date AlertMessage="Web Booking starts from '"+document.getElementById('frm:hdnOpenBookingBefore').value+"' days prior to Date of Journey"; FocusID='frm:subviewInner:txtOnwardJourneyDate'; } else { outbSearch=true; document.getElementById('frm:subviewInner:txtOnwardJourneyDate').readOnly = false; document.getElementById('frm:subviewInner:txtReturnJourneyDate').readOnly = false; } } else { AlertMessage='Please select Departure Date'; FocusID='frm:subviewInner:txtOnwardJourneyDate'; } } else if(document.getElementById('frm:subviewInner:rdbTripType:1').checked) {//If Round Trip if(document.getElementById('frm:subviewInner:txtOnwardJourneyDate').value!='' && document.getElementById('frm:subviewInner:txtReturnJourneyDate').value!='') {//If Departure and Return Dates are selected OnwardJourneyDate=getDateObject(document.getElementById('frm:subviewInner:txtOnwardJourneyDate').value); ReturnJourneyDate=getDateObject(document.getElementById('frm:subviewInner:txtReturnJourneyDate').value); /* if(!(TodayDate<=OnwardJourneyDate && OnwardJourneyDate<=BeforeDate)) {//Check if Departure Date is between today and set before date AlertMessage='Please select Departure Date between '+document.getElementById('frm:hdnToday').value+' and '+document.getElementById('frm:hdnBefore').value; FocusID='frm:subviewInner:txtOnwardJourneyDate'; } else if(!(TodayDate<=ReturnJourneyDate && ReturnJourneyDate<=BeforeDate)) {//Check if Return Date is between today and set before date AlertMessage='Please select Return Date between '+document.getElementById('frm:hdnToday').value+' and '+document.getElementById('frm:hdnBefore').value; FocusID='frm:subviewInner:txtReturnJourneyDate'; } */ if(TodayDate>OnwardJourneyDate) {//Check if Departure Date is before today AlertMessage='Please select Departure Date after '+document.getElementById('frm:hdnToday').value; FocusID='frm:subviewInner:txtOnwardJourneyDate'; } else if(OnwardJourneyDate>BeforeDate) {//Check if Departure Date is after the set before date AlertMessage="Web Booking starts from '"+document.getElementById('frm:hdnOpenBookingBefore').value+"' days prior to Date of Journey"; FocusID='frm:subviewInner:txtOnwardJourneyDate'; } else if(TodayDate>ReturnJourneyDate) {//Check if Return Date is before today AlertMessage='Please select Departure Date after '+document.getElementById('frm:hdnToday').value; FocusID='frm:subviewInner:txtReturnJourneyDate'; } else if(ReturnJourneyDate>BeforeDate) {//Check if Return Date is after the set before date AlertMessage="Web Booking starts from '"+document.getElementById('frm:hdnOpenBookingBefore').value+"' days prior to Date of Journey"; FocusID='frm:subviewInner:txtReturnJourneyDate'; } else if(!(OnwardJourneyDate<=ReturnJourneyDate)) {//Check if Return Date is before Departure Date AlertMessage='Please select Return Date on or after Departure Date'; FocusID='frm:subviewInner:txtReturnJourneyDate'; } else { outbSearch=true; document.getElementById('frm:subviewInner:txtOnwardJourneyDate').readOnly = false; document.getElementById('frm:subviewInner:txtReturnJourneyDate').readOnly = false; } } else { if(document.getElementById('frm:subviewInner:txtOnwardJourneyDate').value=='' && document.getElementById('frm:subviewInner:txtReturnJourneyDate').value=='') {//If Departure and Return Dates are not selected AlertMessage='Please select Onward and Return Dates'; FocusID='frm:subviewInner:txtOnwardJourneyDate'; } else if(document.getElementById('frm:subviewInner:txtOnwardJourneyDate').value=='') {//If Departure Date is not selected AlertMessage='Please select Departure Date'; FocusID='frm:subviewInner:txtOnwardJourneyDate'; } else if(document.getElementById('frm:subviewInner:txtReturnJourneyDate').value=='') {//If Return Date is not selected AlertMessage='Please select Return Date'; FocusID='frm:subviewInner:txtReturnJourneyDate'; } } } } else {//If Return Trip is not allowed //If Departure Date is selected if(document.getElementById('frm:subviewInner:txtOnwardJourneyDate').value!='') { OnwardJourneyDate=getDateObject(document.getElementById('frm:subviewInner:txtOnwardJourneyDate').value); /* if(!(TodayDate<=OnwardJourneyDate && OnwardJourneyDate<=BeforeDate)) {//Check if Departure Date is between today and set before date AlertMessage='Please select Departure Date between '+document.getElementById('frm:hdnToday').value+' and '+document.getElementById('frm:hdnBefore').value; FocusID='frm:subviewInner:txtOnwardJourneyDate'; } */ if(TodayDate>OnwardJourneyDate) {//Check if Departure Date is before today AlertMessage='Please select Departure Date after '+document.getElementById('frm:hdnToday').value; FocusID='frm:subviewInner:txtOnwardJourneyDate'; } else if(OnwardJourneyDate>BeforeDate) {//Check if Departure Date is after the set before date AlertMessage="Web Booking starts from '"+document.getElementById('frm:hdnOpenBookingBefore').value+"' days prior to Date of Journey"; FocusID='frm:subviewInner:txtOnwardJourneyDate'; } else { outbSearch=true; document.getElementById('frm:subviewInner:txtOnwardJourneyDate').readOnly = false; } } else { AlertMessage='Please select Departure Date'; FocusID='frm:subviewInner:txtOnwardJourneyDate'; } } } if(!outbSearch) { // document.getElementById('divSearchingBtn').style.display='none'; // document.getElementById('divSearchBtn').style.display='block'; if(AlertMessage!=null) displayAlertMessage(AlertMessage,null,FocusID); } return outbSearch; } /* --- JS functions used in Home related pages - Ends --- */ /* --- JS functions used in Select Bus related pages - Starts --- */ /* Function : setBusListHeight() Brief : It used to set bus list height. Detail : None Input param : None Input/output param : None Return : None */ function setBusListHeight() { document.getElementById('divDetailsBottom').style.display='none'; document.getElementById('tblDetailsBottom').style.height='0px'; if(document.getElementById('tblDetails').clientHeight<325) { var NewHeight=325-(document.getElementById('tblDetails').clientHeight); document.getElementById('divDetailsBottom').style.display='block'; document.getElementById('tblDetailsBottom').style.height=NewHeight+'px'; document.getElementById('tdDetailsBottom').style.height=NewHeight+'px'; } } /* Function : initializeSelectBus() Brief : It used to set initialize Select Bus page. Detail : None Input param : None Input/output param : None Return : None */ function initializeSelectBus() { checkReturnJourneyDetails(); selectedBoardingPoint('Onward'); initializeBusBgColor('frm:subviewInner:tblOnwardJourneyBus'); selectedBoardingPoint('Return'); initializeBusBgColor('frm:subviewInner:tblReturnJourneyBus'); try { document.getElementById('hdnTripType').value=0; document.getElementById('hdnSourceID').value=document.getElementById('frm:subviewInner:sltSource').value; document.getElementById('hdnDestinationID').value=document.getElementById('frm:subviewInner:sltDestination').value; document.getElementById('hdnSeatTypeID').value=document.getElementById('frm:subviewInner:sltSeatType').value; document.getElementById('hdnBusTypeID').value=document.getElementById('frm:subviewInner:sltBusType').value; document.getElementById('hdnGetFromDatabase').value="0"; document.getElementById('hdnOnwardJourneyStartDate').value=document.getElementById('frm:subviewInner:txtOnwardJourneyDate').value; document.getElementById('hdnReturnJourneyStartDate').value=''; if(document.getElementById('frm:hdnReturnTripAllowed').value==true || document.getElementById('frm:hdnReturnTripAllowed').value=='true') {//If Return Trip is allowed if(document.getElementById('frm:subviewInner:rdbTripType:1').checked) {//If Round Trip document.getElementById('hdnReturnJourneyStartDate').value=document.getElementById('frm:subviewInner:txtReturnJourneyDate').value; document.getElementById('hdnReturnTrip').value='true'; document.getElementById('hdnTripType').value=1; } } }catch(e){} var StopB2CBookingBefore=0; if(Number(document.getElementById('frm:hdnAlertFlag').value)==-4) displayAlertMessage('Invalid Seat selection.
One of your selection is adjacent to seat booked for Ladies.
Select a valid Seat and try again.',5000,null,450); else if(Number(document.getElementById('frm:hdnAlertFlag').value)==-3) displayAlertMessage('The selected seats could not be booked successfully as some of the seats are already Booked'); else if(Number(document.getElementById('frm:hdnAlertFlag').value)==-2) displayAlertMessage('The selected seats could not be booked successfully as the bus is already departed'); else if(Number(document.getElementById('frm:hdnAlertFlag').value)==-1) displayAlertMessage('The selected seats could not be booked as the booking is blocked. You can book through Branches/Agents.'); else if(Number(document.getElementById('frm:hdnAlertFlag').value)>0) { StopB2CBookingBefore=document.getElementById('frm:hdnAlertFlag').value; displayAlertMessage('The selected seats could not be booked as the booking is blocked before '+StopB2CBookingBefore+' hrs from journey. You can book through Branches/Agents.'); } else if(Number(document.getElementById('frm:hdnAlertFlagSelectSeat').value)==-4) displayAlertMessage('Invalid Seat selection.
One of your selection is adjacent to seat booked for Ladies.
Select a valid Seat and try again.',5000,null,450); else if(Number(document.getElementById('frm:hdnAlertFlagSelectSeat').value)==-3) displayAlertMessage('The selected seats could not be processed successfully as some of the seats are already Booked'); else if(Number(document.getElementById('frm:hdnAlertFlagSelectSeat').value)==-2) displayAlertMessage('The selected seats could not be processed successfully as the bus is already departed'); else if(Number(document.getElementById('frm:hdnAlertFlagSelectSeat').value)==-1) displayAlertMessage('The selected seats could not be booked as the booking is blocked. You can book through Branches/Agents.'); else if(Number(document.getElementById('frm:hdnAlertFlagSelectSeat').value)>0) { StopB2CBookingBefore=document.getElementById('frm:hdnAlertFlagSelectSeat').value; displayAlertMessage('The selected seats could not be booked as the booking is blocked before '+StopB2CBookingBefore+' hrs from journey. You can book through Branches/Agents.'); } document.getElementById('frm:hdnAlertFlag').value=0; document.getElementById('frm:hdnAlertFlagSelectSeat').value=0; } /* Function : validateSearchBusOperationOuter() Brief : It used to validate for the 'Seach Bus' operation in Search Bus page, give alert message if it fails. Detail : None Input param : None Input/output param : None Return : None */ function validateSearchBusOperationOuter() { var outbSearch=validateSearchBusOperation(); if(outbSearch) { try { document.getElementById('hdnTripType').value=0; if(document.getElementById('frm:hdnReturnTripAllowed').value==true || document.getElementById('frm:hdnReturnTripAllowed').value=='true') {//If Return Trip is allowed if(document.getElementById('frm:subviewInner:rdbTripType:1').checked) {//If Round Trip document.getElementById('hdnTripType').value=1; } } document.getElementById('hdnSourceID').value=document.getElementById('frm:subviewInner:sltSource').value; document.getElementById('hdnDestinationID').value=document.getElementById('frm:subviewInner:sltDestination').value; document.getElementById('hdnSeatTypeID').value=document.getElementById('frm:subviewInner:sltSeatType').value; document.getElementById('hdnBusTypeID').value=document.getElementById('frm:subviewInner:sltBusType').value; document.getElementById('hdnGetFromDatabase').value="1"; }catch(e){} } return outbSearch; } /* Function : modifySearch() Brief : It used to set hide/display Modify Search. Detail : None Input param : None Input/output param : None Return : None */ function modifySearch() { try { if(document.getElementById('divSearchArrowRight').style.display=='block') { document.getElementById('spnModifySearchLine').style.display='none'; document.getElementById('spnModifySearch').style.display='block'; document.getElementById('divSearchArrowRight').style.display='none'; document.getElementById('divSearchArrowDown').style.display='block'; document.getElementById('divModifySearch').style.display='block'; } else { document.getElementById('spnModifySearch').style.display='none'; document.getElementById('spnModifySearchLine').style.display='block'; document.getElementById('divModifySearch').style.display='none'; document.getElementById('divSearchArrowDown').style.display='none'; document.getElementById('divSearchArrowRight').style.display='block'; } }catch(e){ // alert(e); } } /* Function : checkReturnJourneyDetails() Brief : It used to display/hide return journey related fields. Detail : None Input param : None Input/output param : None Return : None */ function checkReturnJourneyDetails() { try { if(document.getElementById('frm:hdnReturnTripAllowed').value==true || document.getElementById('frm:hdnReturnTripAllowed').value=='true') {//If Return Trip is allowed if(document.getElementById('frm:subviewInner:rdbTripType:0').checked) {//If One Way document.getElementById('divReturnJourneyDate').style.display='none'; document.getElementById('divReturnJourneyDateText').style.display='none'; document.getElementById('divReturnJourneyDateHide').style.display='block'; document.getElementById('divReturnJourneyDateTextHide').style.display='block'; } else if(document.getElementById('frm:subviewInner:rdbTripType:1').checked) {//If Round Trip document.getElementById('divReturnJourneyDateHide').style.display='none'; document.getElementById('divReturnJourneyDateTextHide').style.display='none'; document.getElementById('divReturnJourneyDate').style.display='block'; document.getElementById('divReturnJourneyDateText').style.display='block'; } document.getElementById('frm:subviewInner:txtOnwardJourneyDate').readOnly = true; document.getElementById('frm:subviewInner:txtReturnJourneyDate').readOnly = true; } else {//If Return Trip is not allowed document.getElementById('divReturnJourneyDate').style.display='none'; document.getElementById('divReturnJourneyDateText').style.display='none'; document.getElementById('divReturnJourneyDateHide').style.display='block'; document.getElementById('divReturnJourneyDateTextHide').style.display='block'; document.getElementById('frm:subviewInner:txtOnwardJourneyDate').readOnly = true; } }catch(e){} } /* Function : initializeBusBgColor(inTableID) Brief : It used to display alternate background colors for the routes. Detail : None Input param : inTableID Input/output param : None Return : None */ function initializeBusBgColor(inTableID) { try { //Get row objects of table var RowCounter=0; var tblBusRowObjects=document.getElementById(inTableID).rows; for(var tblBusRowCounter=0;tblBusRowCounter-1) { //Checking with each Boarding Point ID var aBoardingPointIDs=inputObjects[inputCounter].value.split(','); for(var iIndex = 0; iIndex < aBoardingPointIDs.length; iIndex++) { var BoardingPointID=aBoardingPointIDs[iIndex]; if(BoardingPointID==SelectBoxObjectValue) { tblBusRowObjects[tblBusRowCounter].style.display=''; bAtleastOneRowDisplayed=true; } } } } } } if(bAtleastOneRowDisplayed) document.getElementById('tr'+inType+'BusesPresent').style.display=''; else document.getElementById('tr'+inType+'BusesNotPresent').style.display=''; }catch(e){} } /* Function : highlightBusBgColor(inType,inBusID) Brief : It used to highlight the selected route. Detail : None Input param : inType,inBusID Input/output param : None Return : None */ function highlightBusBgColor(inType,inBusID) { try { //Get row objects of table var RowCounter=0; var tblBusRowObjects=document.getElementById('frm:subviewInner:tbl'+inType+'JourneyBus').rows; for(var tblBusRowCounter=0;tblBusRowCounter-1) { if(inputID==inBusID) tblBusRowObjects[tblBusRowCounter].className='SelectedBusColor'; } } RowCounter++; } } } }catch(e){} } /* Function : selectedBusInit(inFlag,inType,inBusID,inRouteJourneyStartDate) Brief : It is used to set the Bus ID selected for viewing the preview. Detail : None Input param : inFlag,inType,inBusID,inRouteJourneyStartDate Input/output param : None Return : None */ function selectedBusInit(inFlag,inType,inBusID,inRouteJourneyStartDate) { var outbContinue=false; try { var BoardingPointID=Number(document.getElementById('frm:subviewInner:slt'+inType+'BoardingPoint').value); if(BoardingPointID==0) { document.getElementById(inBusID).checked=false; displayAlertMessage('Please select a Boarding Point',null,'frm:subviewInner:slt'+inType+'BoardingPoint'); } else if(document.getElementById('divDisplay'+inType+'BusLayout').style.display=='block') { var BusID=document.getElementById('hdnPreviewBusID').value; document.getElementById(BusID).checked=true; } else { document.getElementById('hdnFlag').value=inFlag; document.getElementById('hdnPreviewBusID').value=inBusID; document.getElementById('hdnPreviewBusBoardingPointID').value=BoardingPointID; document.getElementById('hdnPreviewRouteJourneyStartDate').value=inRouteJourneyStartDate; if(document.getElementById('hdn'+inType+'BusID').value!=inBusID) { document.getElementById(inBusID).checked=true; document.getElementById('hdn'+inType+'BusID').value=inBusID; document.getElementById('hdn'+inType+'RouteJourneyStartDate').value=inRouteJourneyStartDate; document.getElementById('hdn'+inType+'SelectedSeats').value=''; document.getElementById('hdn'+inType+'SelectedSeatCounter').value='0'; document.getElementById('hdn'+inType+'TotalFare').value='0'; outbContinue=true; highlightBusBgColor(inType,inBusID); } else { displayBusPreview(inType) } } }catch(e){ } if(outbContinue) { displayProgressBar('show'); calculateTotalFare(); } return outbContinue; } /* Function : selectedBusFinish(inType) Brief : It is used to set the UI for viewing the preview. Detail : None Input param : inType Input/output param : None Return : None */ function selectedBusFinish(inType) { var tblJourneyBusObject=document.getElementById('frm:subviewInner:tbl'+inType+'JourneyBus'); tblJourneyBusObject.deleteTFoot(); displayProgressBar('hide'); displayBusPreview(inType) } /* Function : displayBusPreview(inType) Brief : It is used to set the UI for viewing the preview. Detail : None Input param : inType Input/output param : None Return : None */ function displayBusPreview(inType) { var divDisplayBusLayoutInnerPanelWidth = 850; //Display the popup document.getElementById('divDisplay'+inType+'BusLayout').style.display='block'; document.getElementById('divDisplay'+inType+'BusLayoutInnerPanel').style.width=divDisplayBusLayoutInnerPanelWidth+'px'; try {//Set width for the outer panel and the left of inner panel if(gClientWidth<1000) { document.getElementById('divDisplay'+inType+'BusLayoutOuterPanel').style.width='1000px'; document.getElementById('divDisplay'+inType+'BusLayoutInnerPanel').style.left='75px'; } else { document.getElementById('divDisplay'+inType+'BusLayoutOuterPanel').style.width=gClientWidth+'px'; var DialogBoxInnerPanelLeft=parseInt((gClientWidth-1000)/2)+75; document.getElementById('divDisplay'+inType+'BusLayoutInnerPanel').style.left=DialogBoxInnerPanelLeft+'px'; } }catch(e){} try {//Set height for the outer panel and the top of inner panel // var PageBodyHeight=Number(document.getElementById("DocBody").clientHeight); var PageBodyHeight=getDocHeight(); var divDisplayBusLayoutInnerPanelHeight=0; if(gClientHeight-1) { var inputIDSplitCheckBox=inputID.split('_'); ReservationIDCheckBox=Number(inputIDSplitCheckBox[1]); if(inputObjects[inputCounter].checked==true) { inputObjects[inputCounter].checked=false; bSeatSelected=false; inTDObject.className='cellSeat Available Border'; SeatCounter--; var TempSeatSelectedIDs=''; //Checking with each seat id var aSeatSelectedIDs=SeatSelectedIDs.split(','); for(var iIndex = 0; iIndex < aSeatSelectedIDs.length; iIndex++) { var LayoutID=aSeatSelectedIDs[iIndex]; if(LayoutID!=ReservationIDCheckBox) { if(TempSeatSelectedIDs=='') TempSeatSelectedIDs=LayoutID; else TempSeatSelectedIDs+=','+LayoutID; } } SeatSelectedIDs=TempSeatSelectedIDs; bProcessSuccessful=true; } else { var MaxSeatsAllowed=Number(document.getElementById('frm:hdnMaxSeatsAllowed').value); if(SeatCounter-1) { var inputIDSplitHiddenField=inputID.split('_'); ReservationIDHiddenField=Number(inputIDSplitHiddenField[1]); Fare=Number(inputIDSplitHiddenField[2]); } } if(bProcessSuccessful && ReservationIDCheckBox==ReservationIDHiddenField) { if(bSeatSelected) TotalFare=TotalFare+Fare; else TotalFare=TotalFare-Fare; document.getElementById('hdn'+inType+'TotalFare').value=TotalFare; document.getElementById('hdn'+inType+'SelectedSeats').value=SeatSelectedIDs; document.getElementById('hdn'+inType+'SelectedSeatCounter').value=SeatCounter; } }catch(e){} calculateTotalFare(); } /* Function : calculateTotalFare() Brief : It is used to calculate the total fare that is to be displayed. Detail : None Input param : None Input/output param : None Return : None */ function calculateTotalFare() { var TotalFare=0; try { OnwardTotalFare=0; ReturnTotalFare=0; OnwardTotalFare=Number(document.getElementById('hdnOnwardTotalFare').value); if(document.getElementById('hdnReturnTrip').value==true || document.getElementById('hdnReturnTrip').value=='true') {//If Return Trip ReturnTotalFare=Number(document.getElementById('hdnReturnTotalFare').value); } TotalFare=OnwardTotalFare+ReturnTotalFare; }catch(e){} document.getElementById('divTotal').innerHTML=TotalFare; } /* Function : seatsSelected(inType) Brief : It is used to hide the bus layout. Detail : None Input param : inType Input/output param : None Return : None */ function seatsSelected(inType) { var Fare=null; //If Return Trip if(document.getElementById('hdnReturnTrip').value==true || document.getElementById('hdnReturnTrip').value=='true') { if(!isNaN(document.getElementById('hdn'+inType+'TotalFare').value) && Number(document.getElementById('hdn'+inType+'TotalFare').value)>0) Fare="   (Fare: Rs "+document.getElementById('hdn'+inType+'TotalFare').value+")"; } var SelectedSeats=null; var tblJourneyBusObject=document.getElementById('frm:subviewInner:tbl'+inType+'JourneyBus'); var tblBusSeatLayoutObject=document.getElementById('tbl'+inType+'BusSeatLayout'); var inputObjects=tblBusSeatLayoutObject.getElementsByTagName('input'); for(var inputCounter=0;inputCounter-1) { var inputIDSplitCheckBox=inputID.split('_'); SeatNumber=inputIDSplitCheckBox[2]; if(inputObjects[inputCounter].checked==true) { if(SelectedSeats==null) SelectedSeats=SeatNumber; else SelectedSeats+=", "+SeatNumber; } } } if(SelectedSeats==null) { tblJourneyBusObject.deleteTFoot(); } else { var tblJourneyBusFooterSeatNoFareObject=document.getElementById('frm:subviewInner:tbl'+inType+'JourneyBus:tdFooterSeatNoFare'); if(tblJourneyBusFooterSeatNoFareObject==undefined || tblJourneyBusFooterSeatNoFareObject=='undefined') { var tblJourneyBusFooterObject=tblJourneyBusObject.createTFoot() //Create Footer var tblJourneyBusFooterRowObject=tblJourneyBusFooterObject.insertRow(0) //Create a row for the Footer tblJourneyBusFooterRowObject.setAttribute('id','frm:subviewInner:tbl'+inType+'JourneyBus:trFooter');//Set the id //Create a cell for the Footer's row, this contains the Blinking Image var tblJourneyBusFooterRowCellObject=tblJourneyBusFooterRowObject.insertCell(0); tblJourneyBusFooterRowCellObject.setAttribute('id','frm:subviewInner:tbl'+inType+'JourneyBus:tdFooterImage');//Set the id tblJourneyBusFooterRowCellObject.setAttribute('class','SelectedSeatNos');//Set the style class tblJourneyBusFooterRowCellObject.setAttribute('className','SelectedSeatNos');//Set the style class (for IE) tblJourneyBusFooterRowCellObject.setAttribute('align','right'); tblJourneyBusFooterRowCellObject.setAttribute('colspan','2');//Set the Column span tblJourneyBusFooterRowCellObject.colSpan='2';//Set the Column span (for IE) tblJourneyBusFooterRowCellObject.innerHTML='
'; //Create a cell for the Footer's row, this contains the Selecte Seats and fare tblJourneyBusFooterSeatNoFareObject=tblJourneyBusFooterRowObject.insertCell(1); tblJourneyBusFooterSeatNoFareObject.setAttribute('id','frm:subviewInner:tbl'+inType+'JourneyBus:tdFooterSeatNoFare');//Set the id tblJourneyBusFooterSeatNoFareObject.setAttribute('class','SelectedSeats');//Set the style class tblJourneyBusFooterSeatNoFareObject.setAttribute('className','SelectedSeats');//Set the style class (for IE) tblJourneyBusFooterSeatNoFareObject.setAttribute('colspan','6');//Set the Column span tblJourneyBusFooterSeatNoFareObject.colSpan='6';//Set the Column span (for IE) } if(Fare==null) tblJourneyBusFooterSeatNoFareObject.innerHTML=SelectedSeats; else tblJourneyBusFooterSeatNoFareObject.innerHTML=SelectedSeats+Fare; } document.getElementById('divDisplay'+inType+'BusLayout').style.display='none'; } /* Function : bookTicket() Brief : It is used to check if the seats can be booked (in Select Bus page). Detail : None Input param : None Input/output param : None Return : None */ function bookTicket() { var outbCanBook=true; var AlertMessage=null; var bReturnTrip=false; if(document.getElementById('hdnReturnTrip').value==true || document.getElementById('hdnReturnTrip').value=='true') {//If Return Trip bReturnTrip=true; } var SelectedBoardingPoint=document.getElementById('frm:subviewInner:sltOnwardBoardingPoint').value; if(SelectedBoardingPoint==0) { if(bReturnTrip) AlertMessage='Please select a boarding point for onward journey'; else AlertMessage='Please select a boarding point for journey'; outbCanBook=false; } else { if(bReturnTrip) { SelectedBoardingPoint=document.getElementById('frm:subviewInner:sltReturnBoardingPoint').value; if(SelectedBoardingPoint==0) { AlertMessage='Please select a boarding point for return journey'; outbCanBook=false; } } } if(outbCanBook) { var OnwardSelectedSeats=Number(document.getElementById('hdnOnwardSelectedSeatCounter').value); if(OnwardSelectedSeats<=0) { if(bReturnTrip) AlertMessage='Please select a seat for onward journey'; else AlertMessage='Please select a seat for journey'; outbCanBook=false; } else { if(bReturnTrip) { var ReturnSelectedSeats=Number(document.getElementById('hdnReturnSelectedSeatCounter').value); if(ReturnSelectedSeats<=0) { AlertMessage='Please select a seat for return journey'; outbCanBook=false; } else if(OnwardSelectedSeats!=ReturnSelectedSeats) { AlertMessage='Please select equal seats for onward and return journey'; outbCanBook=false; } } } } if(outbCanBook) { displayProgressBar('show'); document.getElementById('hdnGetFromDatabase').value="1"; } else if(AlertMessage!=null) displayAlertMessage(AlertMessage); return outbCanBook; } /* Function : paginatePreviousNext(inType,inDate) Brief : It is used to paginate between between Next and Previous dates. Detail : None Input param : inType,inDate Input/output param : None Return : None */ function paginatePreviousNext(inType,inDate) { document.getElementById('frm:subviewInner:txtOnwardJourneyDate').readOnly = false; if(document.getElementById('hdnReturnTrip').value==true || document.getElementById('hdnReturnTrip').value=='true') {//If Return Trip document.getElementById('frm:subviewInner:txtReturnJourneyDate').readOnly = false; } document.getElementById('frm:subviewInner:txt'+inType+'JourneyDate').value=inDate; document.getElementById('frm:hdnAlertFlagSelectSeat').value=0; document.getElementById('hdnGetFromDatabase').value="1"; return true; } /* Function : removeTableContent() Brief : It used to remove the rows of Onward and Return Bus List table Detail : Called when Search button is clicked in Modify Search panel Input param : None Input/output param : None Return : None */ function removeTableContent() { //Sadananda Shetty, 26-Dec-10: Added this function to fix defect related to modified search where the list is not populated properly when a Droping Point is selected var tblBusRowObjects; var iNumRows; try { tblBusRowObjects=document.getElementById('frm:subviewInner:tblOnwardJourneyBus').rows; iNumRows = tblBusRowObjects.length; for(var iRowCounter=0;iRowCounter-1 || inputID.indexOf('txtAge', 0)>-1) { inputObject.value=trim(inputObject.value); if(inputObject.value=='') { FocusID=inputID; outbCanBook=false; break; } else if(bIntValue && (inputID.indexOf('txtAge', 0)>-1) && (isNaN(inputObject.value) || (inputObject.value.indexOf('.', 0)>-1))) { IntFocusID=inputID; bIntValue=false; } } inputObject=null; inputID=null; } inputObjects=null; } } }catch(e){ } if(!outbCanBook) { if(!bReturnTrip) AlertMessage='Please enter value for all the mandatory fields(*) related to Passenger details'; else AlertMessage='Please enter value for all the mandatory fields(*) related to Passenger details: Onward Journey'; } else if(bReturnTrip) { try { //Get row objects of tblReturnSeats table var tblReturnSeatRowObjects=document.getElementById('frm:subviewInner:tblReturnSeats').rows; for(var tblReturnSeatRowCounter=0;tblReturnSeatRowCounter-1 || inputID.indexOf('txtAge', 0)>-1) { inputObject.value=trim(inputObject.value); if(inputObject.value=='') { FocusID=inputID; outbCanBook=false; break; } else if(bIntValue && (inputID.indexOf('txtAge', 0)>-1) && (isNaN(inputObject.value) || (inputObject.value.indexOf('.', 0)>-1))) { IntFocusID=inputID; bIntValue=false; } } inputObject=null; inputID=null; } inputObjects=null; } } }catch(e){ } if(!outbCanBook) { AlertMessage='Please enter value for all the mandatory fields(*) related to Passenger details: Return Journey'; } } if(!bIntValue) { AlertMessage='Please enter integer value for all age fields'; outbCanBook=false; FocusID=IntFocusID; } } if(outbCanBook) { if(document.getElementById('frm:subviewInner:tarAddress').value.length>120) { AlertMessage='Please enter the address within 120 characters'; outbCanBook=false; FocusID='frm:subviewInner:tarAddress'; } else if(!document.getElementById('frm:subviewInner:chkIAgree').checked) { AlertMessage='Please accept the Terms and Conditions'; outbCanBook=false; FocusID=null; } } if(outbCanBook) { gClientHeight=document.documentElement.clientHeight; gClientWidth=document.documentElement.clientWidth; if (!bCookieEnabled) { try { var SltGateways = document.getElementById('frm:subviewConfirmation:sltGateway'); var iIndex = SltGateways.length; while (iIndex>1) { iIndex--; SltGateways.remove(iIndex); } } catch (Ex) { } } //Display the popup document.getElementById('divConfirmation').style.display='block'; try {//Set width for the outer panel and the left of inner panel if(gClientWidth<1000) { document.getElementById('divConfirmationOuterPanel').style.width='1000px'; document.getElementById('divConfirmationInnerPanel').style.left='250px'; } else { document.getElementById('divConfirmationOuterPanel').style.width=gClientWidth+'px'; var DialogBoxInnerPanelLeft=parseInt((gClientWidth-1000)/2)+250; document.getElementById('divConfirmationInnerPanel').style.left=DialogBoxInnerPanelLeft+'px'; } }catch(e){ } try {//Set height for the outer panel and the top of inner panel // var PageBodyHeight=Number(document.getElementById("DocBody").clientHeight); var PageBodyHeight=getDocHeight(); if(gClientHeight0) continue; if (ChkBoxID.indexOf('chkCheck')>0 && InputObject[iIndex].checked==true) { aTemp = ChkBoxID.split('chkCheck'); try { HdnID = aTemp[0] + 'hdnSeatID' + aTemp[1]; if (bFirstSeat) { SeatIDs += document.getElementById(HdnID).value; bFirstSeat = false; } else SeatIDs += ","+document.getElementById(HdnID).value; } catch (Ex) { } } } } } catch(Exc) {} document.getElementById('frm:hdnPartialCancelSeats').value = SeatIDs; } /* Function : canCancelTicket() Brief : It is used to check if all the related feilds are entered. Detail : None Input param : None Input/output param : outbCanCancel Return : boolean */ function canCancelTicket() { //Hide 'Cancel' button having the action and display just Cancel button. document.getElementById('divCancelBtn').style.display='none'; document.getElementById('divCancelBtnNoAction').style.display='block'; var outbCanCancel=true; var AlertMessage=null; var FocusID=null; try { PNRNumber=document.getElementById('frm:subviewInner:txtCnclPNRNumber'); EmailID=document.getElementById('frm:subviewInner:txtCnclEmaiID'); MobileNo=document.getElementById('frm:subviewInner:txtCnclMobileNumber'); PNRNumber.value=trim(PNRNumber.value); EmailID.value=trim(EmailID.value); MobileNo.value=trim(MobileNo.value); if(PNRNumber.value=='' || EmailID.value=='' || MobileNo.value=='') { AlertMessage='Please enter value for all the mandatory fields(*)'; if(PNRNumber.value=='') FocusID='frm:subviewInner:txtCnclPNRNumber'; else if(EmailID.value=='') FocusID='frm:subviewInner:txtCnclEmaiID'; else if(MobileNo.value=='') FocusID='frm:subviewInner:txtCnclMobileNumber'; outbCanCancel=false; } else { var bValidEmail=isValidEmail(EmailID.value); if(!bValidEmail) { AlertMessage='Please enter a valid E-mail ID'; FocusID='frm:subviewInner:txtCnclEmaiID'; outbCanCancel=false; } else if(isNaN(MobileNo.value)) { AlertMessage='Please enter integer for Mobile Number'; FocusID='frm:subviewInner:txtCnclMobileNumber'; outbCanCancel=false; } else if(MobileNo.value.length!=10) { AlertMessage='Please enter 10 digits for Mobile Number'; FocusID='frm:subviewInner:txtCnclMobileNumber'; outbCanCancel=false; } } }catch(e){} if(outbCanCancel) { document.getElementById('frm:subviewInner:txtPNRNumber').value=PNRNumber.value; document.getElementById('frm:subviewInner:txtEmaiID').value=EmailID.value; document.getElementById('frm:subviewInner:txtMobileNumber').value=MobileNo.value; displayProgressBar('show'); } else { //Hide just Cancel button and display 'Cancel' button having the action. document.getElementById('divCancelBtnNoAction').style.display='none'; document.getElementById('divCancelBtn').style.display='block'; if(AlertMessage!=null) displayAlertMessage(AlertMessage,null,FocusID); } return outbCanCancel; } /* Function : cancelledTicket() Brief : It is used to display the confirmation messages. Detail : None Input param : None Input/output param : None Return : None */ function cancelledTicket() { displayProgressBar('hide'); var AlertMessage=null; try { if(document.getElementById('frm:hdnSuccess').value==true || document.getElementById('frm:hdnSuccess').value=='true') {//If Successful, display Refund Amount and Cancellation Charge var RefundAmount="
Refund Amount: "+document.getElementById('frm:hdnRefundAmount').value; var CancellationCharge="
Cancellation Charge: "+document.getElementById('frm:hdnCancellationCharge').value; var RefundAmountLength=RefundAmount.length; var CancellationChargeLength=CancellationCharge.length; if(RefundAmountLength150) { iFactor = 25; if (iRowCount>1) bAdditionalFactor = true; } else { iFactor = 1; if (iRowCount>1) iFactor = 25; } iSeatContainerHeight = (tblRowObjects.length * iFactor); if (iSeatContainerHeight>170) iSeatContainerHeight = 170; iInnerPanelHeight += (iSeatContainerHeight - 30); if (bAdditionalFactor) iInnerPanelHeight -= 50; if (SeatContainer!=null) SeatContainer.style.height = iSeatContainerHeight + "px"; document.getElementById('divCancelConfirmationInnerPanel').style.height = iInnerPanelHeight + "px"; for (i=0; i1000) { AlertMessage='Please enter the Description within 1000 characters'; FocusID='frm:subviewInner:tarDescription'; outbCanSendFeedback=false; } } }catch(e){ } if(outbCanSendFeedback) displayProgressBar('show'); else if(AlertMessage!=null) displayAlertMessage(AlertMessage,null,FocusID); return outbCanSendFeedback; } /* Function : sentFeedback() Brief : It is used to display the confirmation messages. Detail : None Input param : None Input/output param : None Return : None */ function sentFeedback() { displayProgressBar('hide'); var AlertMessage=null; try { AlertMessage="Thanks for giving your valuable feedback"; document.getElementById('frm:subviewInner:txtName').value=''; document.getElementById('frm:subviewInner:txtEmailID').value=''; document.getElementById('frm:subviewInner:txtContactNo').value=''; document.getElementById('frm:subviewInner:txtSubject').value=''; document.getElementById('frm:subviewInner:tarDescription').value=''; }catch(e){} if(AlertMessage!=null) displayAlertMessage(AlertMessage); } /* Function : getDocHeight() Brief : Returns the height of the document Detail : None Input param : None Input/output param : None Return : None */ function getDocHeight() { var DcObj = document; return Math.max( Math.max(DcObj.body.scrollHeight, DcObj.documentElement.scrollHeight), Math.max(DcObj.body.offsetHeight, DcObj.documentElement.offsetHeight), Math.max(DcObj.body.clientHeight, DcObj.documentElement.clientHeight) ); } /* --- JS functions used in Feedback related pages - Ends --- */