/* Setting the step URLs*/ var eb_step1 = 'http://www.piac.com.pk/index.aspx'; var eb_step2 = 'http://www.piac.com.pk/Ebooking_select.aspx'; var eb_step3 = 'http://www.piac.com.pk/Ebooking_info.aspx'; var eb_step4 = 'http://www.piac.com.pk/Ebooking_pnr.aspx'; var eb_fare = 'http://www.piac.com.pk/Ebooking_fares_inline.aspx'; var eb_print_pnr = 'http://www.piac.com.pk/Print_pnr.aspx'; var processing_page = 'http://www.piac.com.pk/processing.htm'; var eb_payment = 'https://www.piac.com.pk/Ebooking_payment.aspx'; var imgDir = "images/"; var Image1 = new Image(); Image1.src = imgDir+"calendar.gif"; var ms_table_row_guid = 2; var check_num_sectors = true; var foreground = '#F3F3F3'; var background = '#434e64'; var months_abbr = ["JAN", "FEB", "MAR", "APR", "MAY", "JUN","JUL", "AUG", "SEP", "OCT", "NOV", "DEC"]; //var width_1 = '30%'; //var width_2 = '26%'; function IsDepartureAfterToday() { var str = new String(trim(document.getElementById("CurrentDate").value)); var splitString = str.split("-"); var curr_dt = new Date( Number(splitString[2]), Number(splitString[1]) - 1, Number(splitString[0])); var strDayFrom = new String(trim(document.getElementById("day_from").value)); var strMonthYearFrom = new String(trim(document.getElementById("month_year_from").value)); var strMonthNoFrom = getMonthIndexForAbbr(strMonthYearFrom.substr(0,3)); var strYearNoFrom = strMonthYearFrom.substr(strMonthYearFrom.length - 4, 4); var dt_from = new Date( Number(strYearNoFrom), Number(strMonthNoFrom), Number(strDayFrom)); if(dt_from > curr_dt) { return true; } return false; } function checkDates() { var str = new String(trim(document.getElementById("CurrentDate").value)); var splitString = str.split("-"); var curr_dt = new Date( Number(splitString[2]), Number(splitString[1]) - 1, Number(splitString[0])); var strDayFrom = new String(trim(document.getElementById("day_from").value)); var strMonthYearFrom = new String(trim(document.getElementById("month_year_from").value)); var strMonthNoFrom = getMonthIndexForAbbr(strMonthYearFrom.substr(0,3)); var strYearNoFrom = strMonthYearFrom.substr(strMonthYearFrom.length - 4, 4); var dt_from = new Date( Number(strYearNoFrom), Number(strMonthNoFrom), Number(strDayFrom)); if(dt_from < curr_dt) { alert("Departure date should be ahead of the current date."); return false; } if(direction == 'returntravel') { var strDayTo = new String(trim(document.getElementById("day_to").value)); var strMonthYearTo = new String(trim(document.getElementById("month_year_to").value)); var strMonthNoTo = getMonthIndexForAbbr(strMonthYearTo.substr(0,3)); var strYearNoTo = strMonthYearTo.substr(strMonthYearTo.length - 4, 4); var dt_to = new Date( Number(strYearNoTo), Number(strMonthNoTo), Number(strDayTo)); if(dt_to < dt_from) { alert("Departure date can not be ahead of the Arrival date."); return false; } if(dt_to < curr_dt) { alert("Departure/Arrival date should be greater than the current date."); return false; } } return true; } var direction = "returntravel"; function redirectTosabresonic() { //window.open("http://www.piac.com.pk/Apologize_Ticketing.aspx", target='_self'); //return; //var strReferer = Request.ServerVariables["HTTP_REFERER"]; if(!checkDates()) return; if(document.frm_ebooking.num_adults.selectedIndex<=(document.frm_ebooking.num_infants.selectedIndex-1)) { alert("Number of infants can not exceed the number of adults"); return; } if(document.frm_ebooking.num_adults.selectedIndex==0 && document.frm_ebooking.num_children.selectedIndex==0) { alert("Atleast one passenger should be specified (whether a child or an adult)."); return; } if(document.getElementById("from_0").value == document.getElementById("to_0").value) { alert('Origin and destination cannot be the same '); return } if( (Number(document.getElementById("num_adults").value) + Number(document.getElementById("num_children").value)) > 6 ) { alert('The total number of adults and children can not exceed 6') document.getElementById("num_children").focus(); return; } if(document.frm_ebooking.from_0.value == 'ZAH' || document.frm_ebooking.to_0.value == 'ZAH') { alert('We do not offer Online Ticketing Services for Zahedan at the moment.\nPlease Contact PIA Contact Centre / Booking Office ') return; } /* yyz origin opened in webticketing ref email malik shueb ecomm 8nov2013 if(document.frm_ebooking.from_0.value == 'YYZ') { alert('We regret to inform our valued customers that temporary booking option for all flights originating from Toronto, Canada are suspended. Customers may call PIA Contact Center for further assistance with bookings.') return; } */ var fr_city = document.frm_ebooking.from_0.value; var to_city = document.frm_ebooking.to_0.value; var fr_time = document.frm_ebooking.time_0.value; if(fr_city == 'DXB' || fr_city == 'JFK' || fr_city == 'NYC' || fr_city == 'YYZ' || fr_city == 'YTO' || fr_city == 'BAH'|| fr_city == 'IST' || fr_city == 'ORD' || fr_city == 'CHI'|| fr_city == 'DOH') fr_time = '1300'; var to_time = document.frm_ebooking.time_1.value; if(to_city == 'DOH' || to_city == 'DXB' || to_city == 'JFK' || to_city == 'NYC') to_time = '1300'; if(IsDepartureAfterToday() && (fr_city == 'KHI' || fr_city == 'LHE' || fr_city == 'ISB') && (to_city == 'KHI' || to_city == 'LHE' || to_city == 'ISB') && fr_time >= 2000 && fr_time <= 2300) { fr_time = '1300'; } var fr_day = new String(trim(document.getElementById("day_from").value)); var strMonthYearFrom = new String(trim(document.getElementById("month_year_from").value)); var fr_month = getMonthIndexForAbbr(strMonthYearFrom.substr(0,3))+1; var fr_year = strMonthYearFrom.substr(strMonthYearFrom.length - 4, 4); var to_day = new String(trim(document.getElementById("day_to").value)); var strMonthYearTo = new String(trim(document.getElementById("month_year_to").value)); var to_month = getMonthIndexForAbbr(strMonthYearTo.substr(0,3))+1; var to_year = strMonthYearTo.substr(strMonthYearTo.length - 4, 4); var adt = document.frm_ebooking.num_adults.value; var chd = document.frm_ebooking.num_children.value; var inf = document.frm_ebooking.num_infants.value; var addt = "empty"; if(Number(adt)>0) addt = "&numAdults="+adt; if(Number(chd)>0) addt = addt + "&numChildren="+chd; if(Number(inf)>0) addt = addt + "&numInfants="+inf; /* var clas = document.frm_ebooking.class_0.value; if(clas == "0") clas = "BusinessClass"; else clas = "EconomyClass"; */ var language = document.frm_ebooking.language.value; //var query_string = "https://cat.sabresonicweb.com/meridia?posid=03L7&bM=air&page=requestAirMessage_air&action=airRequest¤cy=PKR&departCity="+fr_city+"&depMonth="+fr_month+"&depDay="+fr_day+"&depTime="+fr_time+"&returnCity="+to_city; //var query_string = "https://ww3.dotres.com/meridia?posid=03L7&bM=air&page=requestAirMessage_air&action=airRequest¤cy=PKR&departCity="+fr_city+"&depMonth="+fr_month+"&depDay="+fr_day+"&depTime="+fr_time+"&returnCity="+to_city; //var query_string = "https://cat.sabresonicweb.com/meridia?posid=03L7&bM=air&page=requestAirMessage_air&action=airRequest¤cy=PKR&departCity="+fr_city+"&depMonth="+fr_month+"&depDay="+fr_day+"&depTime="+fr_time+"&returnCity="+to_city; //var query_string = "https://ww3.dotres.com/meridia?posid=PKPK&bM=air&page=requestAirMessage_air&action=airRequest&departCity="+fr_city+"&depMonth="+fr_month+"&depDay="+fr_day+"&depTime="+fr_time+"&returnCity="+to_city; //var query_string = "https://cat.sabresonicweb.com/SSWVN/meridia?posid=PKPK&bM=air&page=requestAirMessage_air&action=airRequest&departCity="+fr_city+"&depMonth="+fr_month+"&depDay="+fr_day+"&depTime="+fr_time+"&returnCity="+to_city; // var query_string = "https://wl-prod.sabresonicweb.com/SSW2010/PKPK/webqtrip.html?origin="+fr_city+"&destination="+to_city+"&lang=en_GB&departureDate="+ fr_year+"-"+ fr_month+"-"+ fr_day; var query_string = "https://booking.piac.com.pk/SSW2010/PKPK/webqtrip.html?origin="+fr_city+"&destination="+to_city+"&lang=en_GB&departureDate="+ fr_year+"-"+ fr_month+"-"+ fr_day; if(direction == "returntravel") query_string = query_string + "&journeySpan=RT&returnDate="+ to_year+"-"+ to_month+"-"+ to_day; else query_string = query_string + "&journeySpan=OW&retMonth="+fr_month+"&retDay="+fr_day+"&retTime="+fr_time; query_string = query_string + "&alternativeLandingPage=true"+ addt; //document.frm_ebooking.__VIEWSTATE.value = ''; //document.frm_ebooking.__VIEWSTATE.name = 'void'; window.open(query_string, target='_self'); //document.frm_ebooking.action = query_string; //document.frm_ebooking.action = "http://www.piac.com.pk/SError.aspx"; //document.frm_ebooking.submit(); } function validateAndSubmit() { if(document.frm_ebooking.sector_mode.value == "single") { if(document.getElementById('return_date_span').style.visibility == 'visible') { if(!checkDates()) return; } } if(document.frm_ebooking.num_adults.selectedIndex<=(document.frm_ebooking.num_infants.selectedIndex-1)) { alert("Number of infants can not exceed the number of adults"); return; } if(document.frm_ebooking.num_adults.selectedIndex==0 && document.frm_ebooking.num_children.selectedIndex==0) { alert("Atleast one passenger should be specified (whether a child or an adult)."); return; } if(Number(document.frm_ebooking.last_pane.value)==1) { var to = document.getElementById("to_0"); var from = document.getElementById("from_0"); if(to.selectedIndex==from.selectedIndex) { alert('Origin and destination cannot be the same '); to.focus(); return } } else { var count = Number(document.getElementById("num_ms_sectors").value) for(var i=1;i<=count;i++) { var to = document.getElementById("to_"+i); var from = document.getElementById("from_"+i); if(to.selectedIndex==from.selectedIndex) { alert('Origin and destination cannot be the same'); to.focus(); return } } } if( (Number(document.getElementById("num_adults").value) + Number(document.getElementById("num_children").value)) > 6 ) { alert('The total number of adults and children can not exceed 6') document.getElementById("num_children").focus(); return; } document.frm_ebooking.__VIEWSTATE.value = ''; document.frm_ebooking.__VIEWSTATE.name = 'void'; document.frm_ebooking.action = eb_step2; displayProcessing(); document.frm_ebooking.submit(); } function switchPane(num) { if(num==2) { document.frm_ebooking.departure_date_1.value = document.frm_ebooking.departure_date_0.value; document.frm_ebooking.from_1.selectedIndex = document.frm_ebooking.from_0.selectedIndex; document.frm_ebooking.to_1.selectedIndex = document.frm_ebooking.to_0.selectedIndex; if(document.getElementById('ms_table').rows.length==4) { check_num_sectors = false; addSector(); } //document.getElementById("_div").doScroll("pageDown"); try{document.getElementById("_div").doScroll("pageDown");}catch(err){} }else { document.frm_ebooking.departure_date_0.value = document.frm_ebooking.departure_date_1.value; document.frm_ebooking.from_0.selectedIndex = document.frm_ebooking.from_1.selectedIndex; document.frm_ebooking.to_0.selectedIndex = document.frm_ebooking.to_1.selectedIndex; } var lastPane = document.frm_ebooking.last_pane.value; //var thisTab = document.getElementById("tab_"+num); //var lastTab = document.getElementById("tab_"+lastPane); //alert(num==lastPane) document.frm_ebooking.last_pane.value = num; if(num==1) document.frm_ebooking.sector_mode.value = "single"; else document.frm_ebooking.sector_mode.value = "multiple" if(num==lastPane) return; document.getElementById("pane_"+lastPane).style.display = "none"; document.getElementById("pane_"+num).style.display = "block"; } function init() { var lastTab = document.getElementById("tab_"+document.frm_ebooking.last_pane.value); lastTab.style.backgroundColor = foreground; lastTab.style.color = background; lastTab.style.cursor = 'none'; } function getCalendarFor(field) { var cal = new calendar2(field); cal.year_scroll = true; cal.time_comp = false; cal.popup(); } function getCalendarForId(_id) { var field = document.getElementById(_id); var cal = new calendar2(field); cal.year_scroll = true; cal.time_comp = false; cal.popup(); } function singleSectorModeChanged(_mode) { if(_mode==1) { //document.getElementById('return_date_span').style.visibility = 'hidden'; direction = "onewaytravel"; document.getElementById('day_to').disabled = true; document.getElementById('month_year_to').disabled = true; } else { //document.getElementById('return_date_span').style.visibility = 'visible'; //var departure_dt_str = document.frm_ebooking.departure_date_0.value; //var tmp_dt = strToDate(departure_dt_str); //tmp_dt = getOffsettedDateForDate(2,tmp_dt); //document.frm_ebooking.return_date.value = // (tmp_dt.getDate()<10? '0'+tmp_dt.getDate():tmp_dt.getDate())+ // '-'+months_abbr[tmp_dt.getMonth()]+ // '-'+tmp_dt.getFullYear(); direction = "returntravel"; document.getElementById('day_to').disabled = false; document.getElementById('month_year_to').disabled = false; } } function strToDate(dt_str) { var str = new String(trim(dt_str)); var splitString = str.split("-") var new_dt = new Date( Number(splitString[2]), getMonthIndexForAbbr(splitString[1]), Number(splitString[0]) ); return new_dt } function trim(value) { var temp = value; var obj = /^(\s*)([\W\w]*)(\b\s*$)/; if (obj.test(temp)) { temp = temp.replace(obj, '$2'); } var obj = / /g; while (temp.match(obj)) { temp = temp.replace(obj, " "); } return temp; } function getOffsettedDateForDate(days,dt) { return new Date(dt.getTime() + days*24*60*60*1000); } function getMonthIndexForAbbr(month_str) { var _tmp = new String(month_str).toUpperCase(); for(var _cnt=0;_cnt<12;_cnt++) if(_tmp==months_abbr[_cnt]) return _cnt; } function addSector() { if(check_num_sectors) { if(Number(document.getElementById("num_ms_sectors").value)==5) { alert("The maximum number of allowed destinations is 5. No more can be added"); return; } } else check_num_sectors = true; var ms_table = document.getElementById("ms_table"); var this_index = ms_table.rows.length-2; var prev_row = ms_table.rows[this_index-1]; var new_row = ms_table.insertRow(this_index); new_row.id = 'ms_table_row_guid_'+ms_table_row_guid; var cell_from = new_row.insertCell(0); var cell_to = new_row.insertCell(1); /*constructing the from and to cells*/ var from_select = document.createElement("select"); var to_select = document.createElement("select"); var citiesOption = document.getElementById("to_1").options var i = citiesOption.length; var tmp1,tmp2,txt1,txt2; for(j=0;jOpen Calendar"; /*constructing the leaving on cell*/ var cell_leaving_on = new_row.insertCell(3); cell_leaving_on.innerHTML = ""; cell_leaving_on.align = "right"; cell_leaving_on.valign = "top"; var dt_tmp; if(trim(prev_row.cells[3].firstChild.value)=='') dt_tmp = strToDate(sdt_str); else dt_tmp = strToDate(prev_row.cells[3].firstChild.value); dt_tmp = getOffsettedDateForDate(2,dt_tmp); document.getElementById('departure_date_guid_'+ms_table_row_guid).value = (dt_tmp.getDate()<10? '0'+dt_tmp.getDate():dt_tmp.getDate()) + '-'+months_abbr[dt_tmp.getMonth()]+ '-'+dt_tmp.getFullYear(); /*constructing the remove cell*/ var cell_remove = new_row.insertCell(4); var row_id = 'ms_table_row_guid_'+ms_table_row_guid; var tmp_str = "href='javascript:deleteRowById(\""+row_id+"\")'"; cell_remove.innerHTML = "Drop"; ms_table_row_guid++; var num_ms_sectors = document.getElementById("num_ms_sectors"); num_ms_sectors.value++; try{document.getElementById("_div").doScroll("pageDown");}catch(err){} } function deleteRowById(row_id) { var ms_table_row = document.getElementById(row_id); var ms_table = document.getElementById("ms_table"); var _index = ms_table_row.rowIndex; ms_table.deleteRow(_index); var num_ms_sectors = document.getElementById("num_ms_sectors"); num_ms_sectors.value--; var total_rows = document.getElementById('ms_table').rows.length; var elem; for(var i=_index+1;i<(total_rows-1);i++) { elem = document.getElementById('to_'+i); elem.id = 'to_'+(i-1); elem.name = 'to_'+(i-1); elem = document.getElementById('from_'+i); elem.id = 'from_'+(i-1); elem.name = 'from_'+(i-1); elem = ms_table.rows[i-1].cells[3].firstChild; elem.name = 'departure_date_'+(i-1); } //document.getElementById("_div").doScroll("pageDown"); try{document.getElementById("_div").doScroll("pageDown");}catch(err){} } // Ebooking_select.aspx function fs_proceed() { document.forms[0].target = "_self"; if(document.forms[0].__VIEWSTATE!=null) { document.forms[0].__VIEWSTATE.name = 'void'; document.forms[0].__VIEWSTATE.value = ''; } document.forms[0].action = eb_step3; document.forms[0].submit(); } function fs_modify_search() { document.forms[0].target = "_self"; if(document.forms[0].__VIEWSTATE!=null) { document.forms[0].__VIEWSTATE.name = 'void'; document.forms[0].__VIEWSTATE.value = ''; } document.forms[0].action = eb_step1; document.forms[0].submit(); } function info_modify_search() { if(document.frm_info.__VIEWSTATE!=null) { document.frm_info.__VIEWSTATE.name = 'void'; document.frm_info.__VIEWSTATE.value = ''; } document.frm_info.action = eb_step1; document.frm_info.submit(); } function info_change_flights() { if(document.forms[0].__VIEWSTATE!=null) { document.forms[0].__VIEWSTATE.name = 'void'; document.forms[0].__VIEWSTATE.value = ''; } document.forms[0].action = eb_step2; document.forms[0].submit(); } function pnr_modify_search() { if(document.frm_pnr.__VIEWSTATE!=null) { document.frm_pnr.__VIEWSTATE.name = 'void'; document.frm_pnr.__VIEWSTATE.value = ''; } document.frm_pnr.action = eb_step1; document.frm_pnr.submit(); } function pnr_change_flights() { if(document.forms[0].__VIEWSTATE!=null) { document.forms[0].__VIEWSTATE.name = 'void'; document.forms[0].__VIEWSTATE.value = ''; } document.forms[0].action = eb_step2; document.forms[0].submit(); } function fs_weekly_search() { document.forms[0].target = "_self"; if(document.forms[0].__VIEWSTATE!=null) { document.forms[0].__VIEWSTATE.name = 'void'; document.forms[0].__VIEWSTATE.value = ''; } document.forms[0].action = 'FlightScheduleWeekly.aspx'; displayProcessing(); document.forms[0].submit(); } function pnr_edit_info() { if(document.forms[0].__VIEWSTATE!=null) { document.forms[0].__VIEWSTATE.name = 'void'; document.forms[0].__VIEWSTATE.value = ''; } document.forms[0].action = eb_step3; document.forms[0].submit(); } function retry() { document.forms[0].action = eb_step2; document.forms[0].submit(); } function back_to_fare() { //window.location = eb_fare; if(document.forms[0].__VIEWSTATE!=null) { document.forms[0].__VIEWSTATE.name = 'void'; document.forms[0].__VIEWSTATE.value = ''; } document.forms[0].action = eb_fare; document.forms[0].submit(); } function info_proceed() { if(validateInfo()) { if(document.forms[0].__VIEWSTATE!=null) { document.forms[0].__VIEWSTATE.name = 'void'; document.forms[0].__VIEWSTATE.value = ''; } document.forms[0].action = eb_step4; displayProcessing(); document.forms[0].submit(); } } /* ================================================================== LTrim(string) : Returns a copy of a string without leading spaces. ================================================================== */ function LTrim(str) /* PURPOSE: Remove leading blanks from our string. IN: str - the string we want to LTrim */ { var whitespace = new String(" \t\n\r"); var s = new String(str); if (whitespace.indexOf(s.charAt(0)) != -1) { // We have a string with leading blank(s)... var j=0, i = s.length; // Iterate from the far left of string until we // don't have any more whitespace... while (j < i && whitespace.indexOf(s.charAt(j)) != -1) j++; // Get the substring from the first non-whitespace // character to the end of the string... s = s.substring(j, i); } return s; } /* ================================================================== RTrim(string) : Returns a copy of a string without trailing spaces. ================================================================== */ function RTrim(str) /* PURPOSE: Remove trailing blanks from our string. IN: str - the string we want to RTrim */ { // We don't want to trip JUST spaces, but also tabs, // line feeds, etc. Add anything else you want to // "trim" here in Whitespace var whitespace = new String(" \t\n\r"); var s = new String(str); if (whitespace.indexOf(s.charAt(s.length-1)) != -1) { // We have a string with trailing blank(s)... var i = s.length - 1; // Get length of string // Iterate from the far right of string until we // don't have any more whitespace... while (i >= 0 && whitespace.indexOf(s.charAt(i)) != -1) i--; // Get the substring from the front of the string to // where the last non-whitespace character is... s = s.substring(0, i+1); } return s; } /* ============================================================= Trim(string) : Returns a copy of a string without leading or trailing spaces ============================================================= */ function LRTrim(str) /* PURPOSE: Remove trailing and leading blanks from our string. IN: str - the string we want to Trim RETVAL: A Trimmed string! */ { return RTrim(LTrim(str)); } var processingWindow = null; function displayProcessing() { var w = 400; var h = 150; if(processingWindow !=null) { processingWindow.close(); } var _top = screen.availHeight/2-(h/2); var _left = screen.availWidth/2-(w/2); processingWindow = window.open(processing_page,'pw','top='+_top+',left='+_left+',width='+w+',height='+h+',scrollbars=no'); processingWindow.focus(); return true; } function stopDisplayProcessing() { if(processingWindow!=null) processingWindow.close(); } function pnrDetails(_pnr) { document.frm_pnr.pnr.value = _pnr; document.frm_pnr.submit(); } function populate(y_id,m_id,d_id) { var year_elem = document.getElementById(y_id); var month_elem = document.getElementById(m_id); var day_elem = document.getElementById(d_id); timeA = new Date(year_elem.options[year_elem.selectedIndex].text,month_elem.options[month_elem.selectedIndex].value,1); timeDifference = timeA - 86400000; timeB = new Date(timeDifference); var daysInMonth = timeB.getDate(); for (var i = 0; i < day_elem.length; i++) { day_elem.options[0] = null; } for (var i = 0; i < daysInMonth; i++) { day_elem.options[i] = new Option(i+1); } day_elem.options[0].selected = true; } function fs_calculateFares() { //var win = window.open('','Fare_Window','top=2500,left=2500,toolbar=no,menubar=no,width=592,height=550,scrollbars=yes'); displayProcessing(); //document.frm_flight_schedule.target = 'Fare_Window'; document.frm_flight_schedule.action = 'Ebooking_Fares_Inline.aspx'; document.frm_flight_schedule.__VIEWSTATE.value = ''; document.frm_flight_schedule.__VIEWSTATE.name = 'void'; document.frm_flight_schedule.submit(); } function fs_calculateFares_displayMessage() { if(confirm('It is hereby informed that passengers must check-in 2 hours before flight departure and \ncheck-in counter closes 30 min. before flight departure.\nKindly make sure that the flight(s) you have selected allow you to reach airport well in time.')) { //var win = window.open('','Fare_Window','top=2500,left=2500,toolbar=no,menubar=no,width=592,height=550,scrollbars=yes'); //document.frm_flight_schedule.target = 'Fare_Window'; document.frm_flight_schedule.action = 'Ebooking_Fares_Inline.aspx'; document.frm_flight_schedule.__VIEWSTATE.value = ''; document.frm_flight_schedule.__VIEWSTATE.name = 'void'; document.frm_flight_schedule.submit(); displayProcessing(); } } function showDoc(name) { } function payOnline() { if(!document.getElementById('cb_ofp').checked) { alert('You must agree to PIA\'s Online Fare Policy in order to pay online.'); return; } if(!document.getElementById('cb_pp').checked) { alert('You must agree to PIA\'s Privacy Policy in order to pay online.'); return; } if(!document.getElementById('cb_tou').checked) { alert('You must agree to PIA\'s Terms of Use in order to pay online.'); return; } document.forms[0].action = eb_step4; document.forms[0].submit(); } var preallocationWindow = null; function preallocateSeats(fltNum, fltDate, removeSeat) { var w = 650; var h = 550; if(removeSeat == '1') { if(confirm('Are you sure you want to Deallocate Seat(s).')) { document.getElementById('flt_'+ fltNum +'_'+ fltDate + '_Seat_Remove').value = '1'; } else return; } if(preallocationWindow !=null) { preallocationWindow.close(); } var _top = screen.availHeight/2-(h/2); var _left = screen.availWidth/2-(w/2); preallocationWindow = window.open('','paw','top='+_top+',left='+_left+',width='+w+',height='+h+',scrollbars=yes'); document.frm_pnr.action = 'Seatmap.aspx?flt='+fltNum + '&flt_Date=' + fltDate; document.frm_pnr.target = "paw"; if(document.frm_pnr.__VIEWSTATE!=null) { document.frm_pnr.__VIEWSTATE.name = 'void'; document.frm_pnr.__VIEWSTATE.value = ''; } document.frm_pnr.submit(); stopDisplayProcessing(); preallocationWindow.focus(); } function modifyPaymentDetails() { document.forms[0].action = eb_payment; if(document.forms[0].__VIEWSTATE !=null) document.forms[0].__VIEWSTATE.name = 'void'; //alert(document.forms[0].action) //alert('--'); document.forms[0].submit(); } var pnrWin; function printPnr() { var w = 700; var h = 500; if(pnrWin !=null) { pnrWin.close(); } var _top = screen.availHeight/2-(h/2); var _left = screen.availWidth/2-(w/2); pnrWin = window.open('','pnrWin','top='+_top+',left='+_left+',width='+w+',height='+h+',scrollbars=yes,resizable=false'); pnrWin.focus(); document.forms[0].action = eb_print_pnr; document.forms[0].target = 'pnrWin'; document.forms[0].submit(); } function LiveChat_openBrWindow(theURL,winName,features) { window.open(theURL,winName,features); } function WebTicket_Origin_OnChange() { //Disable Destination Combo document.getElementById("to_0").disabled = true; var comboDestinationList = document.getElementById("to_0"); //Clears the Destination combo box contents. for (var count = comboDestinationList.options.length-1; count >-1; count--) comboDestinationList.options[count] = null; //Display Info Message comboDestinationList.options[0] = new Option("Loading...", "", false, false); var varOrigin = document.getElementById('from_0').options[document.getElementById('from_0').selectedIndex].value; var xmlhttp=null; if (window.XMLHttpRequest) // code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest(); else // code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); var strURL = "GetWebTicketDestinations.aspx?ORG="+ varOrigin xmlhttp.onreadystatechange =function() { if(xmlhttp.readyState==4) { var strResponse = xmlhttp.responseText; var comboDestinationList = document.getElementById("to_0"); for (var count = comboDestinationList.options.length-1; count >-1; count--) comboDestinationList.options[count] = null; var optionItem; if(strResponse.length != 0 && strResponse.indexOf("ERROR") < 0) { var strRow; var strColumns; //Add destination list to the combo box. var strRows = strResponse.split("&"); for (var count = 0; count < strRows.length; count++) { strRow = strRows[count]; strColumns = strRow.split("#"); optionItem = new Option(strColumns[1] +", "+ strColumns[2], strColumns[0], false, false); comboDestinationList.options[comboDestinationList.length] = optionItem; } } else //No response received copy Origin to Destination { var comboOriginList = document.getElementById('from_0') for (var nElement =0; nElement < comboOriginList.options.length; nElement++) { // if(comboOriginList.options[nElement].value == 'JED')//Except Jeddah // continue; optionItem = new Option(comboOriginList.options[nElement].text , comboOriginList.options[nElement].value , false, false); comboDestinationList.options[comboDestinationList.length] = optionItem; } } document.getElementById("to_0").disabled = false; //Enable Destination Combo } } xmlhttp.open("GET", strURL , true); xmlhttp.send(null); }