﻿<!--
//Owner : Allan Montesa*******
//Use to Add Dates************

function dateAddExtention(p_Interval, p_Number){ 

   var thing = new String(); 
    
    
   //in the spirt of VB we'll make this function non-case sensitive 
   //and convert the charcters for the coder. 
   p_Interval = p_Interval.toLowerCase(); 
    
   if(isNaN(p_Number)){ 
    
      //Only accpets numbers  
      //throws an error so that the coder can see why he effed up    
      throw "The second parameter must be a number. \n You passed: " + p_Number; 
      return false; 
   } 

   p_Number = new Number(p_Number); 
   switch(p_Interval.toLowerCase()){ 
      case "yyyy": {// year 
         this.setFullYear(this.getFullYear() + p_Number); 
         break; 
      } 
      case "q": {      // quarter 
         this.setMonth(this.getMonth() + (p_Number*3)); 
         break; 
      } 
      case "m": {      // month 
         this.setMonth(this.getMonth() + p_Number); 
         break; 
      } 
      case "y":      // day of year 
      case "d":      // day 
      case "w": {      // weekday 
         this.setDate(this.getDate() + p_Number); 
         break; 
      } 
      case "ww": {   // week of year 
         this.setDate(this.getDate() + (p_Number*7)); 
         break; 
      } 
      case "h": {      // hour 
         this.setHours(this.getHours() + p_Number); 
         break; 
      } 
      case "n": {      // minute 
         this.setMinutes(this.getMinutes() + p_Number); 
         break; 
      } 
      case "s": {      // second 
         this.setSeconds(this.getSeconds() + p_Number); 
         break; 
      } 
      case "ms": {      // second 
         this.setMilliseconds(this.getMilliseconds() + p_Number); 
         break; 
      } 
      default: { 
       
         //throws an error so that the coder can see why he effed up and 
         //a list of elegible letters. 
         throw   "The first parameter must be a string from this list: \n" + 
               "yyyy, q, m, y, d, w, ww, h, n, s, or ms.  You passed: " + p_Interval; 
         return false; 
      } 
   } 
   return this; 
} 




function setDateFromDate()
{
	var cur_date=new Date();
	document.form._depday.selectedIndex = cur_date.getDate();
	document.form._depmonthyear.selectedIndex = "1";
}

function setDateToDate()
{
	Date.prototype.dateAdd = dateAddExtention; 
	var curDate = new Date();
    var toDate = new Date(); 
    
	toDate.dateAdd("d", 1);
	
	
	document.form._retday.selectedIndex = toDate.getDate();
	
	if (curDate.getMonth() == toDate.getMonth())
	{ document.form._retmonthyear.selectedIndex = "1"; }
	else 
	{ document.form._retmonthyear.selectedIndex = "2"; }
}



//*********************************

function enableReturnDate(){
	document.form._retmonthyear.disabled=false;
	document.form._retday.disabled=false;
}
		
function disableReturnDate(){
	document.form._retmonthyear.disabled=true;
	document.form._retday.disabled=true;
	document.form._retmonthyear.value="";
	document.form._retday.value="";
}

function pleaseWait() {
if (document.getElementById('header')!=null){
document.getElementById('header').style.visibility="hidden";
}
if (document.getElementById('footer')!=null){
document.getElementById('footer').style.visibility="hidden";
}
if (navigator.userAgent.indexOf('Opera') == -1) {
document.getElementById('main').style.visibility="hidden";
}
document.getElementById('wait').style.visibility="visible";
document.getElementById('wait').style.display="block";
window.scroll(0, 0);
if (typeof pleaseWaitSetDynamic=='function') {
pleaseWaitSetDynamic();
}
window.setTimeout("if ( document.images['PleaseWaitImage'] ) {document.images['PleaseWaitImage'].src = document.images['PleaseWaitImage'].src;}",200);
}
function resetPleaseWait() {
if (navigator.userAgent.indexOf('Opera') != -1) {
document.getElementById('wait').style.visibility="hidden";
if (document.getElementById('header')!=null){
document.getElementById('header').style.visibility="visible";
}
if (document.getElementById('footer')!=null){
document.getElementById('footer').style.visibility="visible";
}
document.getElementById('main').style.visibility="visible";
}
}
// ===========================================

var routes="ADVO{ACEBAMNLACEBAILOAZAMAILOAMNLAZAM}ABCD{AMNLAMNL}ATAC{AMNLAMNL}AZAM{ACEBADVOAMNLAMNLACEBADVO}APPS{AMNLAMNL}ATAG{AMNLAMNL}AMNL{ABCDABXUACBOACEBACGYADGTADVOAILOAKLOABCDABXUACBOACGYACEBADVOADGTAILOAKLOAPPSARXSATACATAGAZAMAPPSARXSATACATAGAZAM}ABXU{AMNLAMNL}AKLO{AMNLAMNL}ACEB{AMNLADVOAILOAZAMADVOAILOAMNLAZAM}ARXS{AMNLAMNL}AILO{ACEBADVOAMNLACEBADVOAMNL}ADGT{AMNLAMNL}ACBO{AMNLAMNL}ACGY{AMNLAMNL}";

// ============================================

var destinations = null;
storeDests();
function storeDests() {
 if(destinations!=null) return;
 destinations=new Array();
 var id=1;
 var fld=document.getElementById('wdfdest'+id);
 if(fld == null) fld=document.getElementById('wdfdest'+(++id));
 while(fld!=null){
  destinations[id]=new Array();
  for(var i=0; i<fld.options.length; i++){
   destinations[id][i*2]=fld.options[i].text;
   destinations[id][i*2+1]=fld.options[i].value;
  }
  fld=document.getElementById('wdfdest'+(++id));
  if(fld == null) fld=document.getElementById('wdfdest'+(++id));
 }
}

repopulateDests();
function repopulateDests() {
 var id=1;
 var fld=document.getElementById('wdfdest'+id);
 if(fld == null) fld=document.getElementById('wdfdest'+(++id));
 while(fld!=null){
  updateDests(id,fld.value);
  fld=document.getElementById('wdfdest'+(++id));
  if(fld == null) fld=document.getElementById('wdfdest'+(++id));
 }
}

function addDests(id,fld,filter,selCode){

 fld.options.length=0;
 for(var i=0; i<destinations[id].length; ){
  var text=destinations[id][i++];
  var value=destinations[id][i++];
  if(value.length==0 || filter==null || filter.indexOf(value)>=0) {
   fld.options[fld.options.length]=new Option(text, value, false, (value==selCode));
  }
 }
 for(var i=0; i<fld.options.length; i++) {
  if (fld.options[i].value == selCode) {
   fld.selectedIndex = i;
  }
 }
}

function updateDests(id,selDest) {
 var ofld=document.getElementById('wdforigin'+id);
 var fld=document.getElementById('wdfdest'+id);
 if(routes==null || ofld==null || fld==null || destinations[id]==null) return;
 if(ofld.value.length==0){
  addDests(id,fld,null,selDest);
 }else{
  var matched='';
  var selOrig=ofld.value;
  selOrig=selOrig.substring(0,1)+selOrig.substring(selOrig.length-3)+"{";
  var pos=routes.indexOf(selOrig);
  if(pos>=0){
   pos=pos+5;
   var end=routes.indexOf("}",pos);
   if(end>=0){
    var dests=routes.substring(pos,end);
    for(var i=0; i<dests.length; i+=4){
     if(dests.charAt(i)=='A'){
      matched+='#Airport.'+dests.substring(i+1,i+4);
     }else if(dests.charAt(i)=='C'){
      matched+='#City.'+dests.substring(i+1,i+4);
     }else if(dests.charAt(i)=='R'){
      matched+='#RailStation.'+dests.substring(i+1,i+4);
     }
    }
   }
  }
  if(selDest==''){
   if(matched.lastIndexOf('#')==0) selDest=matched.substring(1);
   else selDest=fld.value;
  }
  addDests(id,fld,matched,selDest);
 }
}

function originChanged(id) {
 updateDests(id,'');
}

function destChanged(id) {
 if(routes==null) return;
 var baseOrig=document.getElementById('wdforigin1');
 var dest=document.getElementById('wdfdest'+id).value;
 var nextOrig=document.getElementById('wdforigin'+(id+1));
 if (nextOrig!=null && nextOrig.value.length==0 && baseOrig!=null && baseOrig.value!=dest){
  nextOrig.value=dest;
  originChanged(id+1);
 }
}

//================================================

function replaceDefaultDestinationsAndReselect() {
 var id=1;
 var fld=document.getElementById('wdfdest'+id);
 if (fld == null) fld=document.getElementById('wdfdest'+(++id));
 while (fld!=null){
  addDests(id,fld,null,fld.value);
  fld=document.getElementById('wdfdest'+(++id));
  if (fld == null) fld=document.getElementById('wdfdest'+(++id));
 }
}

//================================================
function getField(name,id){
 return document.getElementById(name+id);
}

function fieldExists(id){
 return (document.getElementById('wdfday'+id)!=null);
}

function setDateDate(id,dt) {
 setDate(id,dt.getFullYear(),dt.getMonth()+1,dt.getDate());
}

function setDate(id,year,month,day) {
 var daySel=getField('wdfday',id);
 var mySel=getField('wdfmonthyear',id);
 if (day==0) {
  setField(daySel,"");
 }else{
  setField(daySel,leadingZero(day));
 }
 if (year==0 || month==0) {
  setField(mySel,"");
 }else{
  setField(mySel,leadingZero(year+"-"+leadingZero(month)));
 }
}

function leadingZero(value) {
 if (value<10) value="0"+value;
 return ""+value;
}

function setField(fld,val) {
 for (var i=0; i<fld.options.length; i++) {
  if (fld.options[i].value==val) {
   fld.selectedIndex=i;
   break;
  }
 }
}

function currentDateArray(){
 var dt=new Date();
 return new Array(dt.getFullYear(),dt.getMonth()+1,dt.getDate());
}

function previousValidDateArray(id) {
 if (fieldExists(id-1)){
  var dt=getValidatedDateArray(id-1);
  if (isValidDate(dt)){
   return dt;
  }
 }
 return currentDateArray();
}

function getValidatedDateArray(id) {
 var array=getDateArray(id);
 var year=parseInt(array[0],10);
 var month=parseInt(array[1],10);
 var day=parseInt(array[2],10);
 if (isNaN(year)) year=0;
 if (isNaN(month)) month=0;
 if (isNaN(day)) day=0;
 return new Array(year,month,day);
}

function getDateArray(id) {
 var day=getField('wdfday',id).value;
 var my=getField('wdfmonthyear',id).value+'       ';
 var month=my.substring(5,7);
 var year=my.substring(0,4);
 return new Array(year,month,day);
}

function isValidDate(array) {
 return (array[2]!=0 && array[1]!=0 && array[0]!=0);
}

function bumpMonth(id) {
 var thisArray=getValidatedDateArray(id);
 var prevArray=previousValidDateArray(id);
 if (thisArray[1]<=prevArray[1]) {
  thisArray[1]=prevArray[1];
  if (thisArray[2]<prevArray[2]) {
   thisArray[1]=prevArray[1]+1;
   if (thisArray[1]==13) {
    thisArray[1]=1;
    thisArray[0]++;
   }
  }
 }
 setDate(id,thisArray[0],thisArray[1],thisArray[2]);
}

function bumpNext(id, daysGap) {
 if (fieldExists(id+1)){
  var thisArray=getValidatedDateArray(id);
  var nextArray=getValidatedDateArray(id+1);
  if (isValidDate(nextArray)){
   if ((thisArray[0]>nextArray[0]) ||
       (thisArray[0]==nextArray[0] && thisArray[1]>nextArray[1]) ||
       (thisArray[0]==nextArray[0] && thisArray[1]==nextArray[1] && thisArray[2]>nextArray[2])) {
    var dt = new Date(thisArray[0],thisArray[1]-1,thisArray[2]+daysGap,0,0,0,1);
    setDateDate(id+1,dt);
   }
  }
 }
}

function updateDateState() {
 if (self.updateRadioState) updateRadioState();
 if (self.updateDowState) updateDowState();
 if (self.updateTimeState) updateTimeState();
}

function dayChanged(id, daysGap) {
 var day=getField('wdfday',id).value;
 if (day.length==0) {
  setField(getField('wdfmonthyear',id),"");
 }else{
  var my=getField('wdfmonthyear',id).value;
  if (my.length==0 && fieldExists(id-1)) {
   var prevMY=getField('wdfmonthyear',id-1).value;
   setField(getField('wdfmonthyear',id),prevMY);
  }
  bumpMonth(id);
  bumpNext(id, daysGap);
 }
 updateDateState();

}

function myChanged(id, daysGap) {
 var my=getField('wdfmonthyear',id).value;
 if (my.length==0) {
  setField(getField('wdfday',id),"");
 }else{
  var day=getField('wdfday',id).value;
  if (day.length==0){
   var prev=previousValidDateArray(id);
   var dt=getValidatedDateArray(id);
   if (dt[1]==prev[1]){
    setDate(id,dt[0],dt[1],prev[2]);
   }else{
    setDate(id,dt[0],dt[1],1);
   }
  }
  bumpNext(id, daysGap);
 }
 updateDateState();
}

// =================================================
function showCal(id) {
activeID=id;
var array=getValidatedDateArray(id);
if (!isValidDate(array)&&id>1) {
if (fieldExists(id-1)) {
array=getValidatedDateArray(id-1);
}
}
if (!isValidDate(array)) {
var now = new Date();
array=new Array(now.getFullYear(),now.getMonth()+1,now.getDate());
}
var dt=new Date(array[0],array[1]-1,array[2],0,0,0,1);
while (dt.getDate()<array[2] && array[2]>=1) {
dt=new Date(array[0],array[1]-1,--array[2],0,0,0,1);
}
genCal(dt);
}
var activeID=0;
function selectDate(year,month,day) {
setDate(activeID,year,month,day);
updateDateState();
}
months = new Array;
months[0]='January'
months[1]='February'
months[2]='March'
months[3]='April'
months[4]='May'
months[5]='June'
months[6]='July'
months[7]='August'
months[8]='September'
months[9]='October'
months[10]='November'
months[11]='December'

var days = new Array;
days[0]='Mon';
days[1]='Tue';
days[2]='Wed';
days[3]='Thu';
days[4]='Fri';
days[5]='Sat';
days[6]='Sun';
var firstDayOfWeekOffset = 1;

function numDays(y,m) {
return (m==3 || m==5 || m==8 || m==10)? 30 : ((m==1) && (((y%4==0) && y%100!=0) || y%400==0)) ? 29 : (m==1)? 28 : 31;
}
function genCal(inputDate) {
var selectedDate = new Date(inputDate.getFullYear(), inputDate.getMonth(), inputDate.getDate());
inputDate.setDate(1);
var pastMonthsCount = 1;
var futureMonthsCount = 1;
inputDate.setMonth(inputDate.getMonth() - pastMonthsCount);
var totalCalendars = 1 + pastMonthsCount + futureMonthsCount;
genCalDoHtmlAndPopup(inputDate, selectedDate, totalCalendars);
}
function getValues(sourceString) {
sourceString = sourceString.replace(/[^0-9|-]/g,",").replace(/[,]+/g,",").replace(/,$/,"").replace(/^,/,"");
return sourceString.split(",");
}
function getArgument(theArray, index) {
if (theArray.length >= index) {
return parseInt(theArray[index],10);
}
return 0;
}
function dateAdd(theDate, Years, Months, Days) {
theDate.setFullYear(theDate.getFullYear()+Years);
theDate.setMonth(theDate.getMonth()+Months+1);
theDate.setDate(theDate.getDate()+Days);
theDate.setHours(0);
theDate.setMinutes(0);
theDate.setSeconds(0);
theDate.setMilliseconds(1);
return theDate;
}
function genCalDoHtmlAndPopup(inputDate, selectedDate, totalCalendars) {
var todayDate = new Date();
todayDate = new Date(todayDate.getFullYear(),(todayDate.getMonth()),todayDate.getDate(),0,0,0,1);
var selectableDaysOffsetsArrayStart = getValues("0 Years, 0 Months, 0 Days");
var selectableDaysOffsetsArrayEnd = getValues("1 Year, 0 Months, -1 Day");
var days = getArgument(selectableDaysOffsetsArrayStart,2);
var months  = getArgument(selectableDaysOffsetsArrayStart, 1);
var years = getArgument(selectableDaysOffsetsArrayStart, 0);
var selectableDaysStartDate = dateAdd( new Date(), years, months, days);
days = getArgument(selectableDaysOffsetsArrayEnd, 2);
months  = getArgument(selectableDaysOffsetsArrayEnd, 1);
years = getArgument(selectableDaysOffsetsArrayEnd, 0);
var selectableDaysEndDate = dateAdd( new Date(), years, months, days);
var out_start = '<'+'!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">'+ '\n'+ '<'+'html>'+ '\n'+ '<'+'head>'+ '\n'+ '<'+'title>Calendar<'+'/title>'+ '\n'+ '<'+'meta http-equiv="content-type" content="text/html; charset=UTF-8" />'+ '\n'+'<'+'style type="text/css">'+'\n'+'<'+'!'+'-'+'-'+'\n'+'@import url(styles/calendar.css);\n'+'@import url(css/cebu.css);\n'+'@import url(itd/css/configured.css);\n'+'-'+'->'+'\n'+'<'+'/style>'+'\n'+ '<'+'/head>'+ '\n'
+ '<body marginheight="0" leftmargin="0" topmargin="0" marginwidth="0">'
+ '<div class="cal">'
+ '<center>'
+ '<table border="0" cellpadding="0" cellspacing="0" class="structure">'
+ '<tr>'
+ '<td>';
for(var i=0; i < totalCalendars; i++) {
var showPrevArrow = (i==0);
var showNextArrow = (i+1 == totalCalendars);
out_start += doCalForMonth(inputDate, todayDate, selectedDate, selectableDaysStartDate, selectableDaysEndDate, showPrevArrow, showNextArrow, totalCalendars);
inputDate.setMonth(inputDate.getMonth() +1);
}
out_start += '</td>'
+'</tr>'
+'<tr>'
+'<td class="calfooter">'
+'<a href="javascript:self.close()">Close this window</a>'
+'</td>'
+'</tr>'
+'</table>'
+'</center>'
+'</div>'
+'</body>';
var out_end = '<'+'/html>'

var scrollbars = "no";
var winWidth = 222;
if (totalCalendars > 3) {
scrollbars = "yes";
winWidth = 700;
}
else {
winWidth = winWidth*totalCalendars;
}
calwin = window.open("","calendar","width="+winWidth+",height=200,resizable=no,scrollbars="+scrollbars);
calwin.document.write(out_start + out_end);
calwin.document.close();
if (window.focus) {
calwin.focus();
}
}
function doCalForMonth(inputDate, todayDate, selectedDate, selectableDaysStartDate, selectableDaysEndDate, showPrevArrow, showNextArrow, totalCalendars) {
var row = 1;
var month = inputDate.getMonth()+1;
var year = inputDate.getFullYear();
var todayMonthMatch = (inputDate.getMonth()==todayDate.getMonth() && inputDate.getFullYear()==todayDate.getFullYear());
var selectedMonthMatch = (inputDate.getMonth()==selectedDate.getMonth() && inputDate.getFullYear()==selectedDate.getFullYear());
var out = '<table align="left" border="0" cellpadding="0" cellspacing="10" width="200" class="monthblock">';
out+='<tr>';
out+='<td>';
out+='<table width="200" border="0" cellpadding="0" cellspacing="0" class="monthhead">';
out+='<tr>';
out+='<td class="monthprevious">';
if (showPrevArrow) {
out+='<a href="javascript:opener.prevCal(\''+inputDate.toGMTString()+'\', \''+selectedDate.toGMTString()+'\', '+totalCalendars+')"><img src="images/btn_back.gif" border="0" /></a>';
} else {
out+='&nbsp;';
}
out+='</td>';
out+='<td class="monthname">'+months[month - 1] + ' ' + year + '</td>';
out+='<td class="monthnext">';
if (showNextArrow) {
out+='<a href="javascript:opener.nextCal(\''+inputDate.toGMTString()+'\', \''+selectedDate.toGMTString()+'\', '+totalCalendars+')"><img src="images/btn_next.gif" border="0" /></a>';
} else {
out+='&nbsp;';
}
out+='</td>';
out+='</tr>';
out+='</table>';
out+='</td>';
out+='</tr>';
out+='<tr>';
out+='<td>';
out+='<table width="200" border="0" cellpadding="0" cellspacing="0" class="monthmain">';
out+='<tr>';
for (d=0;d<7;d++) {
out+='<td class="day dayname">'+days[d] + '</td>';
}
out+='</tr>';
var offset = 7 - firstDayOfWeekOffset;
var firstDayRelativeToSunday = new Date(year,month - 1,1,0,0,0,0).getDay();
offset = offset + firstDayRelativeToSunday;
if (offset >= 7) offset = offset - 7;
var day=1-offset;
var col=0;
out+='<tr>';
totalDays = numDays(year,month - 1);
while (day<=totalDays) {
if (day>0) {
if ((null == selectableDaysStartDate)
|| (null == selectableDaysEndDate)
|| ((new Date(year, month, day, 0,0,0,1).getTime() >= selectableDaysStartDate.getTime())
&& (new Date(year, month, day, 0,0,0,1).getTime() <= selectableDaysEndDate.getTime()))) {
if (todayMonthMatch && day==todayDate.getDate()) {
out+='<td class="day dayselectable today">';
} else if (selectedMonthMatch && day==selectedDate.getDate()) {
out+='<td class="day dayselectable selected">';
} else {
out+='<td class="day dayselectable">';
}
out+='<a href="javascript:self.close();opener.selectDate('+year+','+month+','+day+');">';
out+='&nbsp;&nbsp;'+day+'&nbsp;&nbsp;';
out+='</a>';
} else {
if (todayMonthMatch && day==todayDate.getDate()) {
out+='<td class="day dayselectable today">';
} else if (selectedMonthMatch && day==selectedDate.getDate()) {
out+='<td class="day dayselectable selected">';
} else {
out+='<td class="day daynotselectable">';
}
out+=day;
}
} else {
out+='<td class="day dayempty">';
out+='&nbsp;';
}
out+='</td>';
col++;
if (col>6) {
out+='</tr>';
col=0;
row++;
}
if (col==0 && day<totalDays) {
out+='<tr>';
}
day++;
}
if (col!=0) {
for (;col<7;col++) {
out+='<td class="day dayempty">&nbsp;</td>';
}
}
out+='</tr>';
if (row<6 || (row==6 && col==0)) {
out+='<tr>';
for (col=0;col<7;col++) {
out+='<td class="day dayempty">&nbsp;</td>';
}
out+='</tr>';
}
out+='</table>';
out+='</td>';
out+='</tr>';
out+='</table>';
return out;
}
function prevCal(inputDateStr, selDateStr, totalCalendars){
var inputDate = new Date(inputDateStr);
var selDate = new Date(selDateStr);
var month = inputDate.getMonth() - 1;
if (month<0) {
month = month+12;
inputDate.setFullYear(inputDate.getFullYear()-1);
}
inputDate.setMonth(month);
genCalDoHtmlAndPopup(inputDate, selDate, totalCalendars);
}
function nextCal(inputDateStr, selDateStr, totalCalendars){
var inputDate = new Date(inputDateStr);
var selDate = new Date(selDateStr);
var month = inputDate.getMonth() + 2 - totalCalendars;
if (month>11) {
month = month-12;
inputDate.setFullYear(inputDate.getFullYear()+1);
}
inputDate.setMonth(month);
genCalDoHtmlAndPopup(inputDate, selDate, totalCalendars);
}

// ================================================

function updateRadioState() {
 if (document.getElementById('wdfonewayradio')!=null) {
  var array=getValidatedDateArray(2);
  var oneway=!isValidDate(array);
  document.getElementById('wdfonewayradio').checked=oneway;
  document.getElementById('wdfreturnradio').checked=!oneway;
 }
}

function radioChangedOneWay() {
 setDate(2,0,0,0);
 updateDateState();
}

function radioChangedReturn(daysGap) {
 var out=getValidatedDateArray(1);
 if (!isValidDate(out)) {
  var dt1=new Date();
  out[0]=dt1.getFullYear();
  out[1]=dt1.getMonth()+1;
  out[2]=dt1.getDate();
  setDate(1,out[0],out[1],out[2]);
 }
 var dt=new Date(out[0],out[1]-1,out[2]+daysGap,0,0,0,1);
 setDateDate(2,dt);
 updateDateState();
}

function makeArray(n) {
this.length = n
return this
}
monthNames = new makeArray(12)
monthNames[1] = "01/2006"
monthNames[2] = "02/2006"
monthNames[3] = "03/2006"
monthNames[4] = "04/2006"
monthNames[5] = "05/2006"
monthNames[6] = "06/2006"
monthNames[7] = "07/2006"
monthNames[8] = "08/2006"
monthNames[9] = "09/2006"
monthNames[10] = "10/2006"
monthNames[11] = "11/2006"
monthNames[12] = "12/2006"

function dateString(oneDate) {
var theMonth = monthNames[oneDate.getMonth() + 1]
//var theYear = oneDate.getFullYear()

return oneDate.getDate() + "/" + theMonth
document.form.depday.options[document.form.depday.selectedIndex].value.getDate();
document.form.depmonyear.options[document.form.depmonyear.selectedIndex].value.theMonth;
}

// =================================================
var UNDEFINED;
var originalDestinations = new Array();
function CheckArrivalCity(destination) {
    origName = destination;    
    index = eval("document.form." + destination).selectedIndex;
    destination = eval("document.form." +destination).options[index].value.substring(0, 18);
    if(destination=='MPH')
    {
        alert('Due to airport runway restrictions, we have temporarily suspended our Caticlan operations. Although we are selling Caticlan flights for travel starting March 28, 2010 there is still a possibility that these flights will be rerouted to Kalibo. Please standby for futher announcement. Thank you.');
    }
    var ddlArrival = document.getElementById("_destination");
    if (ddlArrival.value == 'KIX') {
        ftype_msg();
    }
}

function repopulateDestinations() {

if (eval('routeMap') == UNDEFINED) return;

var ISOcode = null;

var dest = eval("document.form._destination");
if (UNDEFINED == originalDestinations[0]) {
originalDestinations[0] = new Array();
for (var j=0; j < dest.options.length; j++) {
originalDestinations[0][j] = dest.options[j];
}

ISOcode = dest[dest.selectedIndex].value;
if (ISOcode.length > 3) ISOcode = ISOcode.substring(ISOcode.length-3);
populateDestinations("_origin");
}
}
function populateDestinations(origin) {
origName = origin;
origIndex = origin.substr(10, 1);
destName = "_destination";
var destLocationArray = new Array();
var origLocationArray = new Array();
index = eval("document.form." + origin).selectedIndex;
origin = eval("document.form." +origin).options[index].value.substring(0, 18);
destList = eval("document.form." +destName).options;
destList.length = 1;
if(origin=='MPH')
{
    alert('Due to airport runway restrictions, we have temporarily suspended our Caticlan operations. Although we are selling Caticlan flights for travel starting March 28, 2010 there is still a possibility that these flights will be rerouted to Kalibo. Please standby for futher announcement. Thank you.');
}

var ddlDestination = document.getElementById("_origin");
if (ddlDestination.value == 'KIX') {
    ftype_msg();
}

if (origin.length < 1) {
destList.length = 1;
return;
}
var n = 0;
for (var loop=0; loop < routeMap.length; loop++) {
var index = routeMap[loop].indexOf(origin);
if (index == 0) {
var destination = routeMap[loop].substring(origin.length);
if (destNames[destination] != UNDEFINED) {
destLocationArray[destNames[destination]] = destination;
}
} else if (index == 8 || index == 11) {
var destination = routeMap[loop].substring(0, index);
if (destNames[destination] != UNDEFINED) {
destLocationArray[destNames[destination]] = destination;
}
}
}
count = 0;
for (var locationID in destLocationArray) {
origLocationArray[count] = locationID;
count++;
}
origLocationArray.sort();
count = 0;
for (var n in origLocationArray) {
destList[count+1] = new Option(origLocationArray[count]);
destList[count+1].value = destLocationArray[origLocationArray[count]];
count++;
}
destList.selectedIndex = 0;
}

var originNames = new Array();
originNames["BCD"] = "Bacolod";
originNames["BXU"] = "Butuan";
originNames["CGY"] = "Cagayan de Oro";
originNames["CEB"] = "Cebu";
originNames["CRK"] = "Clark";
originNames["CBO"] = "Cotabato";
originNames["DVO"] = "Davao";
originNames["DPL"] = "Dipolog";
originNames["DGT"] = "Dumaguete";
originNames["GES"] = "General Santos";
originNames["ILO"] = "Iloilo";
originNames["KLO"] = "Kalibo";
originNames["LAO"] = "Laoag";
originNames["LGP"] = "Legaspi";
originNames["MNL"] = "Manila";
originNames["PPS"] = "Puerto Princesa";
originNames["RXS"] = "Roxas";
originNames["TAC"] = "Tacloban";
originNames["TAG"] = "Tagbilaran";
originNames["ZAM"] = "Zamboanga";
originNames["HKG"] = "Hong Kong";
originNames["SIN"] = "Singapore";
originNames["KUL"] = "Kuala Lumpur";
originNames["BKK"] = "Bangkok";
originNames["CGK"] = "Jakarta";
originNames["TPE"] = "Taipei";
originNames["PVG"] = "Shanghai";
originNames["CAN"] = "Guangzhou";
originNames["MFM"] = "Macau";
originNames["SGN"] = "Saigon";
originNames["BKI"] = "Kota Kinabalu";
originNames["WNP"] = "Naga";
originNames["TUG"] = "Tuguegarao";
originNames["SJI"] = "San Jose (Mindoro)";
originNames["USU"] = "Busuanga";
originNames["OZC"] = "Ozamiz";
originNames["SUG"] = "Surigao";
originNames["KIX"] = "Osaka (Kansai)";
originNames["IAO"] = "Siargao";
originNames["CYP"] = "Calbayog";
originNames["CRM"] = "Catarman";
originNames["CYZ"] = "Cauayan";
originNames["VRC"] = "Virac";



var destNames = new Array();
destNames["BCD"] = "Bacolod";
destNames["BXU"] = "Butuan";
destNames["CGY"] = "Cagayan de Oro";
destNames["CEB"] = "Cebu";
destNames["CRK"] = "Clark";
destNames["CBO"] = "Cotabato";
destNames["DVO"] = "Davao";
destNames["DPL"] = "Dipolog";
destNames["DGT"] = "Dumaguete";
destNames["GES"] = "General Santos";
destNames["ILO"] = "Iloilo";
destNames["KLO"] = "Kalibo";
destNames["LAO"] = "Laoag";
destNames["LGP"] = "Legaspi";
destNames["MNL"] = "Manila";
destNames["PPS"] = "Puerto Princesa";
destNames["RXS"] = "Roxas";
destNames["TAC"] = "Tacloban";
destNames["TAG"] = "Tagbilaran";
destNames["ZAM"] = "Zamboanga";
destNames["HKG"] = "Hong Kong";
destNames["SIN"] = "Singapore";
destNames["KUL"] = "Kuala Lumpur";
destNames["BKK"] = "Bangkok";
destNames["CGK"] = "Jakarta";
destNames["TPE"] = "Taipei";
destNames["PVG"] = "Shanghai";
destNames["CAN"] = "Guangzhou";
destNames["MFM"] = "Macau";
destNames["SGN"] = "Saigon";
destNames["BKI"] = "Kota Kinabalu";
destNames["WNP"] = "Naga";
destNames["TUG"] = "Tuguegarao";
destNames["SJI"] = "San Jose (Mindoro)";
destNames["USU"] = "Busuanga";
destNames["OZC"] = "Ozamiz";
destNames["SUG"] = "Surigao";
destNames["KIX"] = "Osaka (Kansai)";
destNames["IAO"] = "Siargao";
destNames["CYP"] = "Calbayog";
destNames["CRM"] = "Catarman";
destNames["CYZ"] = "Cauayan";
destNames["VRC"] = "Virac";

routeMap = new Array(
'MNLICN',
'ICNMNL',
'PUSCEB',
'ICNCEB',
'CEBPUS',
'CEBICN',					 
'MNLCYP',
'CYPMNL',
'MNLCRM',
'CRMMNL',
'MNLCYZ',
'CYZMNL',
'MNLVRC',
'VRCMNL',
'IAOCEB',
'CEBIAO',
'MNLKIX',
'KIXMNL',
'MNLUSU',
'CEBOZC',
'CEBSUG',
'USUMNL',
'OZCCEB',
'SUGCEB',
'DPLCEB',
'CEBGES',
'GESCEB',
'MNLWNP',
'MNLTUG',
'MNLSJI',
'WNPMNL',
'TUGMNL',
'SJIMNL',
'MNLBKI',
'BKIMNL',
'MPHMNL',
'MPHCEB',
'MPHBKK',
'MPHCAN',
'MPHHKG',
'MPHCGK',
'MPHKUL',
'MPHMFM',
'MPHSIN',
'MPHPVG',
'MNLBCD',
'MNLBXU',
'MNLMPH',
'MNLCGY',
'MNLCEB',
'MNLCBO',
'MNLDVO',
'MNLDPL',
'MNLDGT',
'MNLGES',
'MNLILO',
'MNLKLO',
'MNLLAO',
'MNLLGP',
'MNLPPS',
'MNLRXS',
'MNLTAC',
'MNLTAG',
'MNLZAM',
'MNLHKG',
'MNLSIN',
'MNLKUL',
'MNLBKK',
'MNLCGK',
'MNLTPE',
'MNLCAN',
'MNLPVG',
'MNLXMN',
'MNLMFM',
'MNLTPE',
'MNLHAN',
'MNLSGN',
'BCDMNL',
'BCDBXU',
'BCDCEB',
'BCDCGY',
'BCDDPL',
'BCDDGT',
'BCDDVO',
'BCDKLO',
'BCDLAO',
'BCDPPS',
'BCDRXS',
'BCDTAC',
'BCDTAG',
'BXUMNL',
'BXUCEB',
'BXUDVO',
'BXUILO',
'BKKMNL',
'BKKBCD',
'BKKMPH',
'BKKBXU',
'BKKCGY',
'BKKCEB',
'BKKCBO',
'BKKDVO',
'BKKGES',
'BKKHKG',
'BKKKLO',
'BKKLGP',
'BKKTAG',
'BKKTAC',
'BKKTPE',
'CGKMPH',
'CGKBXU',
'CGKCGY',
'CGKCEB',
'CGKDVO',
'CGKGES',
'CGKHKG',
'CGKKLO',
'CGKLAO',
'CGKLGP',
'CGKRXS',
'CGKTAC',
'CGKTAG',
'CGKTPE',
'CGKMNL',
'CRKCEB',
'CRKDVO',
'CBOCEB',
'CBODVO',
'CBOILO',
'CGYMNL',
'CGYDGT',
'CGYDVO',
'CGYILO',
'CGYKLO',
'CGYLAO',
'CGYRXS',
'CGYTAC',
'CGYTAG',
'CEBMPH',
'CEBMNL',
'CEBBCD',
'CEBBXU',
'CEBCGY',
'CEBDPL',
'CEBDGT',
'CEBGES',
'CEBKLO',
'CEBLGP',
'CEBLAO',
'CEBPPS',
'CEBRXS',
'CEBTAC',
'CEBTAG',
'CEBCRK',
'CEBDVO',
'CEBHKG',
'CEBILO',
'CEBSIN',
'CEBZAM',
'CEBTPE',
'DVOGES',
'DVOMNL',
'DVOILO',
'DVOKLO',
'DVOLAO',
'DVOLGP',
'DVORXS',
'DVOTAC',
'DVOTAG',
'DVOPPS',
'DVOCEB',
'DVOHKG',
'DVOSIN',
'DVOILO',
'DVOZAM',
'DVOTPE',
'DPLMNL',
'DPLBCD',
'DPLCEB',
'DPLDVO',
'DPLILO',
'DGTMNL',
'DGTBCD',
'DGTCEB',
'DGTHKG',
'DGTDVO',
'DGTILO',
'DGTCGY',
'DGTKLO',
'DGTTAC',
'DGTTAG',
'GESDVO',
'GESCEB',
'GESMNL',
'ILOBXU',
'ILOCGY',
'ILODPL',
'ILODGT',
'ILOMNL',
'ILOKLO',
'ILOLAO',
'ILOLGP',
'ILORXS',
'ILOTAC',
'ILOTAG',
'ILODVO',
'ILOCEB',
'ILOPPS',
'ILOCBO',
'LAOMNL',
'LGPMNL',
'KLOBCD',
'KLOCGY',
'KLOCEB',
'KLODVO',
'KLODGT',
'KLOTAG',
'KLOMNL',
'KLOILO',
'KLOTAC',
'MFMMPH',
'MFMCGY',
'MFMDVO',
'MFMMNL',
'MFMTAC',
'MFMTAG',
'MFMZAM',
'PPSMNL',
'PPSBCD',
'PPSCEB',
'PPSDVO',
'PPSILO',
'RXSMNL',
'RXSBCD',
'RXSCGY',
'RXSCEB',
'RXSDVO',
'RXSILO',
'SGNMNL',
'TACMNL',
'TACTAG',
'TACDGT',
'TAGMNL',
'TAGDGT',
'TPEMNL',
'HKGMNL',
'SINMNL',
'SINMPH',
'SINBXU',
'SINCGY',
'SINCEB',
'SINCRK',
'SINCBO',
'SINDVO',
'SINDPL',
'SINHKG',
'SINLAO',
'SINPPS',
'SINRXS',
'SINTAC',
'SINTAG',
'SINTPE',
'KULMPH',
'KULBXU',
'KULCGY',
'KULCEB',
'KULCBO',
'KULDVO',
'KULDPL',
'KULGES',
'KULHKG',
'KULKLO',
'KULLAO',
'KULLGP',
'KULRXS',
'KULTAC',
'KULTAG',
'KULTPE',
'KULMNL',
'ZAMMNL',
'ZAMCEB',
'HKGBKK',
'HKGMPH',
'HKGCEB',
'HKGCRK',
'HKGDVO',
'HKGDGT',
'HKGILO',
'HKGCGK',
'HKGKUL',
'HKGPVG',
'HKGPPS',
'HKGSIN',
'HANMNL',
'TPEBKK',
'TPECEB',
'TPEDVO',
'TPEILO',
'TPECGK',
'TPEKUL',
'TPEPVG',
'TPESIN',
'ZAMDVO',
'BCDBKK',
'BXUBCD',
'BXUBKK',
'BXUCGK',
'BXUKUL',
'BXUPVG',
'BXUSIN',
'CANMPH',
'CANCGY',
'CANCEB',
'CANDVO',
'CANMNL',
'CANTAC',
'CANTAG',
'CANZAM',
'CBOBKK',
'CBOKUL',
'CBOMNL',
'CBOPVG',
'CBOSIN',
'CEBBKK',
'CEBCAN',
'CEBCBO',
'CEBCGK',
'CEBHKG',
'CEBKUL',
//'CEBMFM',
'CEBPVG',
'CEBSIN',
'CEBTPE',
'CGYBKK',
'CGYBCD',
'CGYCAN',
'CGYCEB',
'CGYCGK',
'CGYKUL',
'CGYMFM',
'CGYPVG',
'CGYSIN',
'CRKHKG',
'CRKSIN',
'DPLBKK',
'DPLKUL',
'DPLPVG',
'DPLSIN',
'DVOBCD',
'DVOBKK',
'DVOBXU',
'DVOCGY',
'DVOCAN',
'DVOCRK',
'DVOCBO',
'DVODPL',
'DVODGT',
'DVOCGK',
'DVOHKG',
'DVOKUL',
'DVOMFM',
'DVOPVG',
'DVOSIN',
'GESBKK',
'GESCGK',
'GESKUL',
'ILOHKG',
'ILOTPE',
'KLOBKK',
'KLOCGK',
'KLOKUL',
'LAOBCD',
'LAOCGY',
'LAOCEB',
'LAODVO',
'LAOILO',
'LAOCGK',
'LAOKUL',
'LAOPVG',
'LAOSIN',
'LGPCEB',
'LGPDVO',
'LGPILO',
'LGPBKK',
'LGPCGK',
'LGPKUL',
'PPSHKG',
'PPSSIN',
'PVGMPH',
'PVGBXU',
'PVGCGY',
'PVGCEB',
'PVGCBO',
'PVGDVO',
'PVGDPL',
'PVGHKG',
'PVGLAO',
'PVGMNL',
'PVGRXS',
'PVGTAC',
'PVGTAG',
'PVGTPE',
'RXSCGK',
'RXSKUL',
'RXSPVG',
'RXSSIN',
'TACBCD',
'TACBKK',
'TACCGY',
'TACCAN',
'TACCEB',
'TACDVO',
'TACILO',
'TACKLO',
'TACCGK',
'TACKUL',
'TACMFM',
'TACPVG',
'TACSIN',
'TAGBCD',
'TAGCGY',
'TAGCAN',
'TAGCEB',
'TAGDVO',
'TAGILO',
'TAGKLO',
'TAGTAC',
'TAGBKK',
'TAGCAN',
'TAGCGK',
'TAGKUL',
'TAGMFM',
'TAGPVG',
'TAGSIN',
'XMNMNL',
'ZAMCAN',
'ZAMMFM',
'CRKBKK',
'CRKHKG',
'CRKMFM',
'CRKSIN',
'SINCRK',
'MFMCRK',
'BKKCRK',
'HKGCRK',
'BCDUSU',    //Additional Routes
'BCDBXU',
'BCDCGY',
'BCDCYP',
'BCDCRM',
'BCDMPH',
'BCDCYZ',
'BCDCEB',
'BCDCBO',
'BCDDVO',
'BCDDPL',
'BCDDGT',
'BCDGES',
'BCDILO',
'BCDKLO',
'BCDLAO',
'BCDLGP',
'BCDWNP',
'BCDPPS',
'BCDRXS',
'BCDSJI',
'BCDTAC',
'BCDTAG',
'BCDVRC',
'BCDTUG',
'BCDZAM',
'USUBXU',
'USUCGY',
'USUCYP',
'USUCRM',
'USUMPH',
'USUCYZ',
'USUCEB',
'USUCBO',
'USUDVO',
'USUDPL',
'USUDGT',
'USUGES',
'USUILO',
'USUKLO',
'USULAO',
'USULGP',
'USUWNP',
'USUPPS',
'USURXS',
'USUSJI',
'USUTAC',
'USUTAG',
'USUVRC',
'USUTUG',
'USUZAM',
'BXUCGY',
'BXUCYP',
'BXUCRM',
'BXUMPH',
'BXUCYZ',
'BXUCEB',
'BXUCBO',
'BXUDVO',
'BXUDPL',
'BXUDGT',
'BXUGES',
'BXUILO',
'BXUKLO',
'BXULAO',
'BXULGP',
'BXUWNP',
'BXUPPS',
'BXURXS',
'BXUSJI',
'BXUTAC',
'BXUTAG',
'BXUVRC',
'BXUTUG',
'BXUZAM', // ADDITIONAL ROUTES
'CGYCYP',
'CGYCRM',
'CGYMPH',
'CGYCYZ',
'CGYCEB',
'CGYCBO',
'CGYDVO',
'CGYDPL',
'CGYDGT',
'CGYGES',
'CGYILO',
'CGYKLO',
'CGYLAO',
'CGYLGP',
'CGYWNP',
'CGYPPS',
'CGYRXS',
'CGYSJI',
'CGYTAC',
'CGYTAG',
'CGYVRC',
'CGYTUG',
'CGYZAM', // ADDITIONAL ROUTES
'CYPCRM',
'CYPMPH',
'CYPCYZ',
'CYPCEB',
'CYPCBO',
'CYPDVO',
'CYPDPL',
'CYPDGT',
'CYPGES',
'CYPILO',
'CYPKLO',
'CYPLAO',
'CYPLGP',
'CYPWNP',
'CYPPPS',
'CYPRXS',
'CYPSJI',
'CYPTAC',
'CYPTAG',
'CYPVRC',
'CYPTUG',
'CYPZAM', // ADDITIONAL ROUTES
'CRMMPH',
'CRMCYZ',
'CRMCEB',
'CRMCBO',
'CRMDVO',
'CRMDPL',
'CRMDGT',
'CRMGES',
'CRMILO',
'CRMKLO',
'CRMLAO',
'CRMLGP',
'CRMWNP',
'CRMPPS',
'CRMRXS',
'CRMSJI',
'CRMTAC',
'CRMTAG',
'CRMVRC',
'CRMTUG',
'CRMZAM', // ADDITIONAL ROUTES
'MPHCYZ',
'MPHCEB',
'MPHCBO',
'MPHDVO',
'MPHDPL',
'MPHDGT',
'MPHGES',
'MPHILO',
'MPHKLO',
'MPHLAO',
'MPHLGP',
'MPHWNP',
'MPHPPS',
'MPHRXS',
'MPHSJI',
'MPHTAC',
'MPHTAG',
'MPHVRC',
'MPHTUG',
'MPHZAM', // ADDITIONAL ROUTES
'CYZCEB',
'CYZCBO',
'CYZDVO',
'CYZDPL',
'CYZDGT',
'CYZGES',
'CYZILO',
'CYZKLO',
'CYZLAO',
'CYZLGP',
'CYZWNP',
'CYZPPS',
'CYZRXS',
'CYZSJI',
'CYZTAC',
'CYZTAG',
'CYZVRC',
'CYZTUG',
'CYZZAM', // ADDITIONAL ROUTE
'CEBCBO',
'CEBDVO',
'CEBDPL',
'CEBDGT',
'CEBGES',
'CEBILO',
'CEBKLO',
'CEBLAO',
'CEBLGP',
'CEBWNP',
'CEBPPS',
'CEBRXS',
'CEBSJI',
'CEBTAC',
'CEBTAG',
'CEBVRC',
'CEBTUG',
'CEBZAM', // ADDITIONAL ROUTE
'CBODVO',
'CBODPL',
'CBODGT',
'CBOGES',
'CBOILO',
'CBOKLO',
'CBOLAO',
'CBOLGP',
'CBOWNP',
'CBOPPS',
'CBORXS',
'CBOSJI',
'CBOTAC',
'CBOTAG',
'CBOVRC',
'CBOTUG',
'CBOZAM', // ADDITIONAL ROUTE
'DVODPL',
'DVODGT',
'DVOGES',
'DVOILO',
'DVOKLO',
'DVOLAO',
'DVOLGP',
'DVOWNP',
'DVOPPS',
'DVORXS',
'DVOSJI',
'DVOTAC',
'DVOTAG',
'DVOVRC',
'DVOTUG',
'DVOZAM', // ADDITIONAL ROUTE
'DPLDGT',
'DPLGES',
'DPLILO',
'DPLKLO',
'DPLLAO',
'DPLLGP',
'DPLWNP',
'DPLPPS',
'DPLRXS',
'DPLSJI',
'DPLTAC',
'DPLTAG',
'DPLVRC',
'DPLTUG',
'DPLZAM', // ADDITIONAL ROUTE
'DGTGES',
'DGTILO',
'DGTKLO',
'DGTLAO',
'DGTLGP',
'DGTWNP',
'DGTPPS',
'DGTRXS',
'DGTSJI',
'DGTTAC',
'DGTTAG',
'DGTVRC',
'DGTTUG',
'DGTZAM', // ADDITIONAL ROUTE
'GESILO',
'GESKLO',
'GESLAO',
'GESLGP',
'GESWNP',
'GESPPS',
'GESRXS',
'GESSJI',
'GESTAC',
'GESTAG',
'GESVRC',
'GESTUG',
'GESZAM', // ADDITIONAL ROUTE
'ILOKLO',
'ILOLAO',
'ILOLGP',
'ILOWNP',
'ILOPPS',
'ILORXS',
'ILOSJI',
'ILOTAC',
'ILOTAG',
'ILOVRC',
'ILOTUG',
'ILOZAM', // ADDITIONAL ROUTE
'KLOLAO',
'KLOLGP',
'KLOWNP',
'KLOPPS',
'KLORXS',
'KLOSJI',
'KLOTAC',
'KLOTAG',
'KLOVRC',
'KLOTUG',
'KLOZAM', // ADDITIONAL ROUTE
'LAOLGP',
'LAOWNP',
'LAOPPS',
'LAORXS',
'LAOSJI',
'LAOTAC',
'LAOTAG',
'LAOVRC',
'LAOTUG',
'LAOZAM', // ADDITIONAL ROUTE
'LGPWNP',
'LGPPPS',
'LGPRXS',
'LGPSJI',
'LGPTAC',
'LGPTAG',
'LGPVRC',
'LGPTUG',
'LGPZAM', // ADDITIONAL ROUTE
'WNPPPS',
'WNPRXS',
'WNPSJI',
'WNPTAC',
'WNPTAG',
'WNPVRC',
'WNPTUG',
'WNPZAM', // ADDITIONAL ROUTE
'PPSRXS',
'PPSSJI',
'PPSTAC',
'PPSTAG',
'PPSVRC',
'PPSTUG',
'PPSZAM', // ADDITIONAL ROUTE
'RXSSJI',
'RXSTAC',
'RXSTAG',
'RXSVRC',
'RXSTUG',
'RXSZAM', // ADDITIONAL ROUTE
'SJITAC',
'SJITAG',
'SJIVRC',
'SJITUG',
'SJIZAM', // ADDITIONAL ROUTE
'TACTAG',
'TACVRC',
'TACTUG',
'TACZAM', // ADDITIONAL ROUTE
'TAGVRC',
'TAGTUG',
'TAGZAM', // ADDITIONAL ROUTE
'TUGVRC',
'TUGZAM', // ADDITIONAL ROUTE
'BCDCRK',
'BCDMNL',
'BCDOZC',
'BCDIAO',
'BCDSUG',
'BXUCRK',
'BXUMNL',
'BXUOZC',
'BXUIAO',
'BXUSUG',
'CGYCRK',
'CGYMNL',
'CGYOZC',
'CGYIAO',
'CGYSUG',
'MPHCRK',
'MPHMNL',
'MPHOZC',
'MPHIAO',
'MPHSUG',
'CRKCBO',
'CRKDVO',
'CRKDPL',
'CRKDGT',
'CRKGES',
'CRKILO',
'CRKLGP',
'CRKMNL',
'CRKOZC',
'CRKPPS',
'CRKIAO',
'CRKSUG',
'CRKTAC',
'CRKZAM',
'COTMNL',
'COTOZC',
'COTIAO',
'COTSUG',
'DVOMNL',
'DVOOZC',
'DVOIAO',
'DVOSUG',
'DPLMNL',
'DPLOZC',
'DPLIAO',
'DPLSUG',
'DGTMNL',
'DGTOZC',
'DGTIAO',
'DGTSUG',
'GESMNL',
'GESOZC',
'GESIAO',
'GESSUG',
'ILOMNL',
'ILOOZC',
'ILOIAO',
'ILOSUG',
'LGPMNL',
'LGPOZC',
'LGPIAO',
'LGPSUG',
'OZCMNL',
'OZCPPS',
'OZCIAO',
'OZCSUG',
'OZCTAC',
'OZCZAM',
'PPSMNL',
'PPSIAO',
'PPSSUG',
'IAOMNL',
'IAOSUG',
'IAOTAC',
'IAOZAM',
'SUGMNL',
'SUGTAC',
'SUGZAM',
'TACMNL',
'ZAMMNL',
'MNLCRK',
'MNLOZC',
'MNLIAO',
'MNLSUG',
'BCDCAN',	//as of June 19, 2009
'BCDHKG',
'BCDCGK',
'BCDBKI',
'BCDKUL',
'BCDMFM',
'BCDSGN',
'BCDPVG',
'BCDSIN',
'BCDTPE',
'USUBKK',
'USUCAN',
'USUHKG',
'USUCGK',
'USUBKI',
'USUKUL',
'USUMFM',
'USUSGN',
'USUPVG',
'USUSIN',
'USUTPE',
'BXUCAN',
'BXUHKG',
'BXUBKI',
'BXUMFM',
'BXUSGN',
'BXUTPE',
'CGYHKG',
'CGYBKI',
'CGYSGN',
'CGYTPE',
'CYPBKK',
'CYPCAN',
'CYPHKG',
'CYPCGK',
'CYPBKI',
'CYPKUL',
'CYPMFM',
'CYPSGN',
'CYPPVG',
'CYPSIN',
'CYPTPE',
'CRMBKK',
'CRMCAN',
'CRMHKG',
'CRMCGK',
'CRMBKI',
'CRMKUL',
'CRMMFM',
'CRMSGN',
'CRMPVG',
'CRMSIN',
'CRMTPE',
'MPHBKI',
'MPHSGN',
'MPHTPE',
'CYZBKK',
'CYZCAN',
'CYZHKG',
'CYZCGK',
'CYZBKI',
'CYZKUL',
'CYZMFM',
'CYZSGN',
'CYZPVG',
'CYZSIN',
'CYZTPE',
'CEBBKI',
'CEBMFM',
'CEBSGN',
'CEBPVG',
'CBOCAN',
'CBOHKG',
'CBOCGK',
'CBOBKI',
'CBOMFM',
'CBOSGN',
'CBOTPE',
'DVOBKI',
'DVOSGN',
'DPLCAN',
'DPLHKG',
'DPLCGK',
'DPLBKI',
'DPLMFM',
'DPLSGN',
'DPLTPE',
'DGTBKK',
'DGTCAN',
'DGTCGK',
'DGTBKI',
'DGTKUL',
'DGTMFM',
'DGTSGN',
'DGTPVG',
'DGTSIN',
'DGTTPE',
'GESCAN',
'GESHKG',
'GESBKI',
'GESMFM',
'GESSGN',
'GESPVG',
'GESSIN',
'GESTPE',
'ILOBKK',
'ILOCAN',
'ILOCGK',
'ILOBKI',
'ILOKUL',
'ILOMFM',
'ILOSGN',
'ILOPVG',
'ILOSIN',
'ILOTPE',
'KLOCAN',
'KLOHKG',
'KLOBKI',
'KLOMFM',
'KLOSGN',
'KLOPVG',
'KLOSIN',
'KLOTPE',
'LAOBKK',
'LAOCAN',
'LAOHKG',
'LAOBKI',
'LAOKUL',
'LAOMFM',
'LAOSGN',
'LAOTPE',
'LGPCAN',
'LGPHKG',
'LGPBKI',
'LGPMFM',
'LGPSGN',
'LGPPVG',
'LGPSIN',
'LGPTPE',
'WNPBKK',
'WNPCAN',
'WNPHKG',
'WNPCGK',
'WNPBKI',
'WNPKUL',
'WNPMFM',
'WNPSGN',
'WNPSGN',
'WNPPVG',
'WNPSIN',
'WNPTPE',
'PPSBKK',
'PPSCAN',
'PPSCGK',
'PPSBKI',
'PPSKUL',
'PPSMFM',
'PPSSGN',
'PPSPVG',
'PPSSIN',
'PPSTPE',
'RXSBKK',
'RXSBKK',
'RXSCAN',
'RXSHKG',
'RXSBKI',
'RXSMFM',
'RXSSGN',
'RXSTPE',
'SJIBKK',
'SJICAN',
'SJIHKG',
'SJICGK',
'SJIBKI',
'SJIKUL',
'SJIMFM',
'SJISGN',
'SJIPVG',
'SJISIN',
'SJITPE',
'TACHKG',
'TACBKI',
'TACSGN',
'TACTPE',
'TAGHKG',
'TAGBKI',
'TAGSGN',
'TAGTPE',
'TUGBKK',
'TUGCAN',
'TUGHKG',
'TUGCGK',
'TUGBKI',
'TUGKUL',
'TUGMFM',
'TUGSGN',
'TUGSGN',
'TUGPVG',
'TUGSIN',
'TUGTPE',
'VRCBKK',
'VRCCAN',
'VRCHKG',
'VRCCGK',
'VRCBKI',
'VRCKUL',
'VRCMFM',
'VRCSGN',
'VRCPVG',
'VRCSIN',
'VRCTPE',
'ZAMBKK',
'ZAMHKG',
'ZAMCGK',
'ZAMBKI',
'ZAMKUL',
'ZAMSGN',
'ZAMPVG',
'ZAMSIN',
'ZAMTPE',
'CANBCD',	//as of June 21, 2009
'HKGBCD',
'BKIBCD',
'KULBCD',
'MFMBCD',
'SGNBCD',
'PVGBCD',
'SINBCD',
'TPEBCD',
'BKKUSU',
'CANUSU',
'HKGUSU',
'CGKUSU',
'BKIUSU',
'KULUSU',
'MFMUSU',
'SGNUSU',
'PVGUSU',
'SINUSU',
'TPEUSU',
'CANBXU',
'HKGBXU',
'BKIBXU',
'MFMBXU',
'SGNBXU',
'TPEBXU',
'HKGCGY',
'BKICGY',
'SGNCGY',
'TPECGY',
'BKKCYP',
'CANCYP',
'HKGCYP',
'CGKCYP',
'BKICYP',
'KULCYP',
'MFMCYP',
'SGNCYP',
'PVGCYP',
'SINCYP',
'TPECYP',
'BKKCRM',
'CANCRM',
'HKGCRM',
'CGKCRM',
'BKICRM',
'KULCRM',
'MFMCRM',
'SGNCRM',
'PVGCRM',
'SINCRM',
'TPECRM',
'BKIMPH',
'SGNMPH',
'TPEMPH',
'BKKCYZ',
'CANCYZ',
'HKGCYZ',
'CGLCYZ',
'BKICYZ',
'KULCYZ',
'MFMCYZ',
'SGNCYZ',
'PVGCYZ',
'SINCYZ',
'TPRCYZ',
'BKICEB',
'MFMCEB',
'SGNCEB',
'PVGCEB',
'CANCBO',
'HKGCBO',
'CGKCBO',
'BKICBO',
'MFMCBO',
'SGNCBO',
'TPECBO',
'BKIDVO',
'SGNDVO',
'CANDPL',
'HKGDPL',
'CGKDPL',
'BKIDPL',
'MFMDPL',
'SGNDPL',
'TPEDPL',
'BKKDGT',
'CANDGT',
'CGKDGT',
'BKIDGT',
'KULDGT',
'MFMDGT',
'SGNDGT',
'PVGDGT',
'SINDGT',
'TPEDGT',
'CANGES',
'HKGGES',
'BKIGES',
'MFMGES',
'SGNGES',
'PVGGES',
'SINGES',
'TPEGES',
'BKKILO',
'CANILO',
'CGKILO',
'BKIILO',
'KULILO',
'MFMILO',
'SGNILO',
'PVGILO',
'SINILO',
'TPEILO',
'CANKLO',
'HKGKLO',
'BKIKLO',
'MFMKLO',
'SGNKLO',
'PVGKLO',
'SINKLO',
'TPEKLO',
'BKKLAO',
'CANLAO',
'HKGLAO',
'BKILAO',
'KULLAO',
'MFMLAO',
'SGNLAO',
'TPELAO',
'CANLGP',
'HKGLGP',
'BKILGP',
'MFMLGP',
'SGNLGP',
'PVGLGP',
'SINLGP',
'TPELGP',
'BKKWNP',
'CANWNP',
'HKGWNP',
'CGKWNP',
'BKIWNP',
'KULWNP',
'MFMWNP',
'SGNWNP',
'PVGWNP',
'SINWNP',
'TPEWNP',
'BKKPPS',
'CANPPS',
'CGKPPS',
'BKIPPS',
'KULPPS',
'MFMPPS',
'SGNPPS',
'PVGPPS',
'SINPPS',
'TPEPPS',
'BKKRXS',
'CANRXS',
'RXSHKG',
'BKIRXS',
'MFMRXS',
'SGNRXS',
'TPERXS',
'BKISJI',
'CANSJI',
'HKGSJI',
'CGKSJI',
'BKISJI',
'KULSJI',
'MFMSJI',
'SGNSJI',
'PVGSJI',
'SINSJI',
'TPESJI',
'HKGTAC',
'BKITAC',
'SGNTAC',
'TPETAC',
'HKGTAG',
'BKITAG',
'SGNTAG',
'TPETAG',
'BKKTUG',
'CANTUG',
'HKGTUG',
'CGKTUG',
'BKITUG',
'KULTUG',
'MFMTUG',
'SGNTUG',
'PVGTUG',
'SINTUG',
'TPETUG',
'BKKVRC',
'CANVRC',
'HKGVRC',
'CGKVRC',
'BKIVRC',
'KULVRC',
'MFMVRC',
'SGNVRC',
'PVGVRC',
'SINVRC',
'TPEVRC',
'BKKZAM',
'HKGZAM',
'CGKZAM',
'BKIZAM',
'KULZAM',
'SGNZAM',
'PVGZAM',
'SINZAM',
'TPEZAM',
'BKKCAN',
'CANBKK',
'BKKCGK',
'CGKBKK',
'BKKBKI',
'BKIBKK',
'BKKKUL',
'KULBKK',
'BKKMFM',
'MFMBKK',
'BKKKIX',
'KIXBKK',
'BKKSGN',	
'SGNBKK',
'BKKPVG',
'PVGBKK',
'BKKSIN',	
'SINBKK',
'CANHKG',
'HKGCAN',
'CANCGK',	
'CGKCAN',
'CANBKI',
'BKICAN',
'CANKUL',
'KULCAN',
'CANMFM',
'MFMCAN',
'CANKIX',
'KIXCAN',
'CANSGN',
'SGNCAN',
'CANPVG',
'PVGCAN',
'CANSIN',
'SINCAN',
'CANTPE',
'TPECAN',
'HKGCGK',
'CGKHKG',
'HKGBKI',
'BKIHKG',
'HKGKUL',
'KULHKG',
'HKGMFM',
'MFMHKG',
'HKGSGN',
'SGNHKG',
'HKGPVG',
'PVGHKG',
'HKGSIN',
'SINHKG',
'HKGTPE',
'TPEHKG',
'CGKBKI',
'BKICGK',
'CGKKUL',
'KULCGK',
'CGKMFM',
'MFMCGK',
'CGKSGN',
'SGNCGK',
'CGKPVG',
'PVGCGK',
'CGKSIN',
'SINCGK',
'BKIKUL',
'KULBKI',
'BKIMFM',
'MFMBKI',
'BKISGN',
'SGNBKI',
'BKIPVG',
'PVGBKI',
'BKISIN',
'SINBKI',
'BKITPE',
'TPEBKI',
'KULMFM',
'MFMKUL',
'KULSGN',
'SGNKUL',
'KULSGN',
'SGNKUL',
'KULPVG',
'PVGKUL',
'KULSIN',
'SINKUL',
'KULTPE',
'TPEKUL',
'MFMSGN',
'SGNMFM',
'MFMPVG',
'PVGMFM',
'MFMSIN',
'SINMFM',
'MFMTPE',
'TPEMFM',
'SGNPVG',
'PVGSGN',
'SGNSIN',
'SINSGN',
'SGNTPE',
'TPESGN',
'PVGSIN',
'SINPVG',
'PVGTPE',
'TPEPVG',
'SINTPE',
'TPESIN'

);

// ================================================
var xnow = new Date();
var xday = xnow.getDate()+1;
var xmonth = 1 //xnow.getMonth()+1; // numbered from 0
var xyear = xnow.getYear();
if (xyear < 1900) xyear += 1900; // or use getFullYear() in v4 browsers
/* comment the following line out to remove the display of date */
//document.write(now.toString()+'<br>'+year+'/'+month+'/'+day);

function setDrops() {
   // I assume Day and months are all there and start with "Select a Day and Select a month
   document.form._depday.selectedIndex = xday;
   document.form._depmonthyear.selectedIndex = xmonth;
   document.form._retday.selectedIndex = xday;
   document.form._retmonthyear.selectedIndex = xmonth;
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  var popup = window.open(theURL,winName,features);
  if (!popup.opener) 
    popup.opener = self;
}

function showmsg(){
	//alert("We've just completed our refleeting program and our fleet age is now less than 1 year. To celebrate, we'll fly you to any of our domestic or international destinations for a fare of only P1.00! This is non-refundable and exclusive of applicable taxes, fees and surcharges.  Please read the complete fare rules before confirming your payment.  Please also note that changes to your bookings will have to be made via our ticket offices.");
	return true;
}

//-->

function alert1(){
//alert('hello');
//alert(document.form._adults.value);
//return false;
}	

function chknumDays(y,m) {
return (m==3 || m==5 || m==8 || m==10)? 30 : ((m==1) && (((y%4==0) && y%100!=0) || y%400==0)) ? 29 : (m==1)? 28 : 31;
}
	
function SimulateFlightSearch(adults,children,infants,triptype,origin,destination,depday,depmonthyear,retday,retmonthyear,faretype)
{
	/*alert("Thanks for visiting our site ! unfortunately, we are doing some site maintenance work to improve our transaction speed." + '\n' + " Please do check back with us at around 2AM, PH time.");*/

	if (origin=='') {
		alert("Please select a departure city.");
		return false;
	}
	
	if (destination=='') { 
		alert("Please select an arrival city.");
		return false;
	}
	
	var dtnow = new Date();
	dtnow_day = dtnow.getDate();
	dtnow_yr = dtnow.getFullYear();
	dtnow_mon = dtnow.getMonth()+1;
	
	var dt1= depmonthyear.split('-');
	if (depday>numDays(dt1[0],(dt1[1])-1) || (depday=='') || depmonthyear =='')  {
		alert('Departure date is invalid!');
		return false;
	}	
	
	var dt2= retmonthyear.split('-');
	if (retday>numDays(dt2[0],(dt2[1])-1))  {
		alert('Return date is invalid!');
		return false;
	}

	if (depday==dtnow_day && dt1[0]==dtnow_yr && dt1[1]==dtnow_mon) {
		alert('Internet bookings are not permitted within 23 hours 59 minutes from the scheduled time of departure. \n\nIf you wish to travel within the next 23 hours and 59 minutes, you may call our Call Center to check the availability of your preferred flight. \n\nClick "OK" if you wish to check the availability and book for a flight outside of 23 hours and 59 minutes from the schedule time of departure.\n\n');
		//return false;
	}
	else 
		if (retday==dtnow_day && dt2[0]==dtnow_yr && dt2[1]==dtnow_mon) {
			alert('Internet bookings are not permitted within 23 hours 59 minutes from the scheduled time of departure. \n\nIf you wish to travel within the next 23 hours and 59 minutes, you may call our Call Center to check the availability of your preferred flight. \n\nClick "OK" if you wish to check the availability and book for a flight outside of 23 hours and 59 minutes from the schedule time of departure.\n\n');
			//return false;
		}
	
	if (parseInt(infants)>0){
		alert('Reminder: Infant(s) must be more than 16 days and under 24 months at date(s) of travel.');
	}
	var msg = '';
	var BKIlist = 'BKI';
	if (BKIlist.indexOf(origin)>-1 || BKIlist.indexOf(destination)>-1) {
		msg = 'Please be advised that Cebu Pacific is operating from Terminal 2, Kota Kinabalu International Airport, Old Airport Road, 88100 Tanjung Aru. Kota Kinabalu, Sabah Malaysia.\n\n';
	}
	
	var T3list = 'MNL';
	//*********** Edited By Allan Montesa Remove PopUp*****
	//*****************************************************	
	//if (T3list.indexOf(origin)>-1 || T3list.indexOf(destination)>-1) {
//		//alert(T3list.indexOf(origin));
//		//alert('Cebu Pacific flights to and from Caticlan, Laoag, Tuguegarao, Naga and San Jose will operate at the Ninoy Aquino International Airport – Terminal 3 along Andrews Ave., Pasay City starting July 22, 2008.');
		//alert(msg+'Please be advised that all Cebu Pacific domestic and international flights will operate at Ninoy Aquino International Airport Terminal 3 along Andrews Ave., Pasay City.');
	//}
	
	if (popalert()==false) return false;	
	
	//Origin1=CGY&Destination1=MNL&Day1=26&MonthYear1=2008-03&Day2=30&MonthYear2=2008-03&RadioButtonMarketStructure=RoundTrip
    
    //TODO: Retrieve this from CebuPacificAir search control
    var d=document.form;
    for( i = 0; i < d._tripType.length; i++ )    {
    if(d._tripType[i].checked == true )
     tripType = d._tripType[i].value;
    }
	//alert("adults="+adults+"children="+children+"infants="+infants+"triptype="+tripType+"origin="+origin+"destination="+destination+"depday="+depday+"depmonthyear="+depmonthyear+"retday="+retday+"retmonthyear="+retmonthyear);
	//alert(tripType);
	
	if ((tripType=='RoundTrip') && (retday=='' || retmonthyear =='')){
		alert('Please select a return date.');
		return false;
	}
	
	var RadioButtonMarketStructure = tripType; //RoundTrip; OneWay
    var Origin1 = origin;
    var Destination1 = destination;
    var Day1 = depday;                //DD
    var MonthYear1 = depmonthyear;    //YYYY-MM
    var Day2 = retday;
    var MonthYear2 = retmonthyear;  
    var AdultCount = adults;
    var ChildCount = children;
    var InfantCount = infants;
    if (faretype) 
		var faretype1="P" 
	else 
		var faretype1="R"
      
    //create a SkySales Search Form    
    //<form name="SkySales" method="post" action="Search.aspx" id="SkySales" ><div>
	var skySalesPlaceHolder = document.createElement("div");
	skySalesPlaceHolder.name = "skySalesPlaceHolder"; 
	skySalesPlaceHolder.id = "skySalesPlaceHolder";
	//skySalesPlaceHolder.method = "post";
	//skySalesPlaceHolder.action = "http://book.cebupacificair.com/Search.aspx";
	
	//<input type="hidden" name="__EVENTTARGET" id="__EVENTTARGET" value="">
	var eventTarget = document.createElement("input");
	eventTarget.type = "hidden";
	eventTarget.name = "__EVENTTARGET";
	eventTarget.id = "__EVENTTARGET";
	eventTarget.value = "AvailabilitySearchInputSearchView$LinkButtonNewSearch";
	skySalesPlaceHolder.appendChild(eventTarget);
	
	//<input type="hidden" name="__EVENTARGUMENT" id="__EVENTARGUMENT" value="">
	var eventArgument = document.createElement("input");
	eventArgument.type = "hidden";
	eventArgument.name = "__EVENTARGUMENT";
	eventArgument.id = "__EVENTARGUMENT";
	eventArgument.value = "";
	skySalesPlaceHolder.appendChild(eventArgument);
	
	//<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwUBMGRkUahpmA9TwoxMieg3UIUbSewRUZk="> 
	var viewState = document.createElement("input");
	viewState.type = "hidden";
	viewState.name = "__VIEWSTATE";
	viewState.id = "__VIEWSTATE";
	viewState.value = ""; ///wEPDwUBMGRkUahpmA9TwoxMieg3UIUbSewRUZk=
	skySalesPlaceHolder.appendChild(viewState);
	
	skySalesPlaceHolder = prepopulateAvailabilitySearchControlValues(skySalesPlaceHolder,
	                                                                    RadioButtonMarketStructure,
                                                                        Origin1,
                                                                        Destination1,
                                                                        Day1,
                                                                        MonthYear1,
                                                                        Day2,
                                                                        MonthYear2,
                                                                        AdultCount,
                                                                        ChildCount,
                                                                        InfantCount,faretype1);      
	
	
	 
	//Submit form
	var SkySalesDiv = document.getElementById("SkySalesAvailabilitySearchDiv");
	SkySalesDiv.appendChild(skySalesPlaceHolder);
//alert(SkySalesDiv);
	//document.getElementById("skySalesPlaceHolder").submit();

                    
}

function prepopulateAvailabilitySearchControlValues(skySalesPlaceHolder,
                                                    RadioButtonMarketStructure,
                                                    Origin1,
                                                    Destination1,
                                                    Day1,
                                                    MonthYear1,
                                                    Day2,
                                                    MonthYear2,
                                                    AdultCount,
                                                    ChildCount,
                                                    InfantCount,
                                                    faretype1)
    
{
    //RadioButtonMarketStructure
	var RadioButtonMarketStructureControl = document.createElement("input");
	RadioButtonMarketStructureControl.type = "hidden";
	RadioButtonMarketStructureControl.name = "AvailabilitySearchInputSearchView$RadioButtonMarketStructure";
	RadioButtonMarketStructureControl.id = "AvailabilitySearchInputSearchView_RadioButtonMarketStructure";
	RadioButtonMarketStructureControl.value = RadioButtonMarketStructure;
	skySalesPlaceHolder.appendChild(RadioButtonMarketStructureControl);
	
	//Origin1
	var Origin1Control = document.createElement("input");
	Origin1Control.type = "hidden";
	Origin1Control.name = "AvailabilitySearchInputSearchView$DropDownListMarketOrigin1";
	Origin1Control.id = "AvailabilitySearchInputSearchView_DropDownListMarketOrigin1";
	Origin1Control.value = Origin1;
	skySalesPlaceHolder.appendChild(Origin1Control);
	
	//Destination1
	var Destination1Control = document.createElement("input");
	Destination1Control.type = "hidden";
	Destination1Control.name = "AvailabilitySearchInputSearchView$DropDownListMarketDestination1";
	Destination1Control.id = "AvailabilitySearchInputSearchView_DropDownListMarketDestination1";
	Destination1Control.value = Destination1;
	skySalesPlaceHolder.appendChild(Destination1Control);

	//Day1
	var Day1Control = document.createElement("input");
	Day1Control.type = "hidden";
	Day1Control.name = "AvailabilitySearchInputSearchView$DropDownListMarketDay1";
	Day1Control.id = "AvailabilitySearchInputSearchView_DropDownListMarketDay1";
	Day1Control.value = Day1;
	skySalesPlaceHolder.appendChild(Day1Control);
	
	//MonthYear1
	var MonthYear1Control = document.createElement("input");
	MonthYear1Control.type = "hidden";
	MonthYear1Control.name = "AvailabilitySearchInputSearchView$DropDownListMarketMonth1";
	MonthYear1Control.id = "AvailabilitySearchInputSearchView_DropDownListMarketMonth1";
	MonthYear1Control.value = MonthYear1;
	skySalesPlaceHolder.appendChild(MonthYear1Control);									

    //Day2
	var Day2Control = document.createElement("input");
	Day2Control.type = "hidden";
	Day2Control.name = "AvailabilitySearchInputSearchView$DropDownListMarketDay2";
	Day2Control.id = "AvailabilitySearchInputSearchView_DropDownListMarketDay2";
	Day2Control.value = Day2;
	skySalesPlaceHolder.appendChild(Day2Control);
	
	//MonthYear2
	var MonthYear2Control = document.createElement("input");
	MonthYear2Control.type = "hidden";
	MonthYear2Control.name = "AvailabilitySearchInputSearchView$DropDownListMarketMonth2";
	MonthYear2Control.id = "AvailabilitySearchInputSearchView_DropDownListMarketMonth2";
	MonthYear2Control.value = MonthYear2;
	skySalesPlaceHolder.appendChild(MonthYear2Control);
											
	//ADT
	var AdultCountField = document.createElement("input");
	AdultCountField.type = "hidden";
	AdultCountField.name = "AvailabilitySearchInputSearchView$DropDownListPassengerType_ADT";
	AdultCountField.id = AdultCountField.name.replace("$","_");
	AdultCountField.value = AdultCount;
	skySalesPlaceHolder.appendChild(AdultCountField);
	
	//CHD
	var ChildCountField = document.createElement("input");
	ChildCountField.type = "hidden";
	ChildCountField.name = "AvailabilitySearchInputSearchView$DropDownListPassengerType_CHD";
	ChildCountField.id = ChildCountField.name.replace("$","_");
	ChildCountField.value = ChildCount;
	skySalesPlaceHolder.appendChild(ChildCountField);
	
	//INFANT
	var InfantCoundField = document.createElement("input");
	InfantCoundField.type = "hidden";
	InfantCoundField.name = "AvailabilitySearchInputSearchView$DropDownListPassengerType_INFANT";
	InfantCoundField.id = InfantCoundField.name.replace("$","_");
	InfantCoundField.value = InfantCount;
	skySalesPlaceHolder.appendChild(InfantCoundField);
	
	//Go-lite faretype
	var FareTypesControl = document.createElement("input");
	FareTypesControl.type = "hidden";
	FareTypesControl.name = "AvailabilitySearchInputSearchView$DropDownListFareTypes";
	FareTypesControl.id = "AvailabilitySearchInputSearchView_DropDownListFareTypes";
	FareTypesControl.value = faretype1;
	skySalesPlaceHolder.appendChild(FareTypesControl);
	
	return skySalesPlaceHolder;
}
	
	function ftype_msg()
	{
	    var cbxGoLite = document.getElementById("_faretype");
	    var ddlDeparture = document.getElementById("_origin");
	    var ddlArrival = document.getElementById("_destination");
	    
	    if (cbxGoLite.checked)
	    {
	        if (ddlDeparture.value == "KIX" || ddlArrival.value == "KIX")
	        {
	            alert("Please be advised that Go lite fares are temporarily unavailable for Osaka. Please restart your booking and uncheck the check box fo Go lite option.");
	            cbxGoLite.checked = false;
	        }
	        else
	        {
	            alert("Go Lite fares are for guests traveling with no checked-in bags.  With this fare, you will enjoy a P100 discount per flight per guest.  You may still bring your hand-carried item (carry-on bag) not exceeding 7kgs.  If you purchase a Go Lite fare and decide to check-in your bag at the airport, you will be charged a P400 Baggage reinstatement fee for a checked bag up to 15kg.  Standard excess baggage rates apply for anything in excess of 15kgs. Click OK to Continue with your booking or untick the box if you\'ll choose Go Fare instead of Go Lite.");
	        }
	    }
	    
//	    if ( form._faretype.checked && form._origin.value != "KIX" && form._destination.value != "KIX" )
//	    {
//		    alert("Go Lite fares are for guests traveling with no checked-in bags.  With this fare, you will enjoy a P200 discount per flight per guest.  You may still bring your hand-carried item (carry-on bag) not exceeding 7kgs.  If you purchase a Go Lite fare and decide to check-in your bag at the airport, you will be charged a P400 Baggage reinstatement fee for a checked bag up to 15kg.  Standard excess baggage rates apply for anything in excess of 15kgs. Click OK to Continue with your booking or untick the box if you\'ll choose Go Fare instead of Go Lite.");
//	        //alert(form._origin.value);
//	    }
//	    
//        if( (form._origin.value == "KIX") || (form._destination.value == "KIX") )
//        {
//            alert("Please be advised that Go lite fares are temporarily unavailable for Osaka. Please restart your booking and uncheck the check box fo Go lite option.");
//            form._faretype.checked = false;
//        }
	  
	        // if(form._origin.value == "KIX")
        //	 {
        //    alert('Please be advised that Go lite fares are temporarily unavailable for Osaka.  Please restart your booking and uncheck the check box fo Go lite option.
        //');
        //	 }
	}
	
	
	function ftype_msg1(){
		alert('Go Lite fares are for guests traveling with no checked-in bags.  With this fare, you will enjoy a P100 discount per flight per guest.  You may still bring your hand-carried item (carry-on bag) not exceeding 7kgs.  If you purchase a Go Lite fare and decide to check-in your bag at the airport, you will be charged a P300 Baggage reinstatement fee for a checked bag up to 15kg.  Standard excess baggage rates apply for anything in excess of 15kgs. Click OK to Continue with your booking or untick the box if you\'ll choose Go Fare instead of Go Lite.');
	}
	
	function openSSR(){
		MM_openBrWindow('http://book.cebupacificair.com/PopupSsr_View1.aspx?culture=zh-CN','bookingSSR','left=300,top=30,scrollbars=yes,resizable=no,width=550,height=600');
	}
	
	function blurflt() {
		image0.src=img_path+"images/flights_tab1.gif";
	     }
		loadImage0 = new Image();
		loadImage0.src = img_path+"images/flights_tab2.gif";
		
		loadImage1 = new Image();
		loadImage1.src = img_path+"images/ft_tab1.gif";
		staticImage1 = new Image();
		staticImage1.src = img_path+"images/ft_tab2.gif";
		
		loadImage2 = new Image();
		loadImage2.src = img_path+"images/hotels_tab1.gif";
		staticImage2 = new Image();
		staticImage2.src = img_path+"images/hotels_tab2.gif";
		// End -->

    document.writeln(' <div class="bookingtabs" id="flight-tab"><img name="image0" style="cursor:hand;" onMouseover="image0.src=\''+img_path+'images\/flights_tab1.gif\';" src="'+img_path+'images\/flights_tab1.gif" name="Image17" width="67" height="29" alt="Flights Only" title="Flights Only"><img title="Fun Tours Package" name="bpimage1" style="cursor:hand\;" src="'+img_path+'images\/ft_tab2.gif" width="66" height="29" onmouseover="bpimage1.src=loadImage1.src;blurflt();" onmouseout="bpimage1.src=staticImage1.src;" onClick="location.href=\'http:\/\/funtours.cebupacificair.com\/travel\/arc.cfm\?tab=p&nav=chCN\'" alt="Fun Tours Package"><img title="Hotels Only" name="bpimage2" style="cursor:hand\;" src="'+img_path+'images\/hotels_tab2.gif" width="70" height="29" onmouseover="bpimage2.src=loadImage2.src;" onmouseout="bpimage2.src=staticImage2.src;" onClick="location.href=\'http:\/\/funtours.cebupacificair.com\/travel\/arc.cfm\?tab=r&nav=chCN \'" alt="Hotels Only"><\/div>');
	document.writeln('<div class="bookingbox" id="flight-form" style="visibility: show"> \r\n    <form name="form" method="post" action="http://book.cebupacificair.com/Search.aspx?culture=zh-CN">             <table border="0" cellspacing="0" cellpadding="0">\r\n            <tr> \r\n              <td><input name="_tripType" type="radio" value="RoundTrip" checked onClick="javascript:enableReturnDate();javascript:setDateFromDate();javascript:setDateToDate();"><\/td>\r\n              <td>往返 &nbsp;&nbsp;&nbsp;<\/td>\r\n              <td><input name="_tripType" type="radio" value="OneWay" onClick="javascript:disableReturnDate();javascript:setDateFromDate();"><\/td>\r\n              <td>单程<\/td>\r\n            <\/tr>\r\n          <\/table>\r\n          <SELECT onchange=" populateDestinations(\'_origin\')" name="_origin" id="_origin" style="width:175px">\r\n			  <option value="" selected>选择出发城市<\/option>\r\n              <option value="">---------DOMESTIC---------<\/option>\r\n              <option value="BCD">Bacolod<\/option>\r\n <option value="USU">Busuanga<\/option>\r\n            <option value="BXU">Butuan<\/option>\r\n              <option value="CGY">Cagayan de Oro<\/option>\r\n <option value="CYP">Calbayog<\/option>\r\n <option value="CRM">Catarman<\/option>\r\n <option value="CYZ">Cauayan<\/option>\r\n                 <option value="CEB">Cebu<\/option>\r\n              <option value="CRK">Clark<\/option>\r\n              <option value="CBO">Cotabato<\/option>\r\n              <option value="DVO">Davao<\/option>\r\n              <option value="DPL">Dipolog<\/option>\r\n              <option value="DGT">Dumaguete<\/option>\r\n              <option value="GES">General Santos<\/option> \r\n              <option value="ILO">Iloilo<\/option>\r\n              <option value="KLO">Kalibo (For Boracay)<\/option>\r\n              <option value="LAO">Laoag<\/option>\r\n              <option value="LGP">Legaspi<\/option>\r\n              <option value="MNL">Manila<\/option>\r\n   <option value="WNP">Naga<\/option>\r\n<option value="OZC">Ozamiz<\/option>\r\n              <option value="PPS">Puerto Princesa<\/option>\r\n              <option value="RXS">Roxas<\/option>\r\n    <option value="SJI">San Jose (Mindoro)<\/option>\r\n  <option value="IAO">Siargao<\/option>\r\n             <option value="SUG">Surigao<\/option>\r\n<option value="TAC">Tacloban<\/option>\r\n              <option value="TAG">Tagbilaran<\/option>\r\n   <option value="TUG">Tuguegarao<\/option>\r\n      <option value="VRC">Virac<\/option>\r\n        <option value="ZAM">Zamboanga<\/option>\r\n              <option value="">------INTERNATIONAL-------<\/option>\r\n              <option value="BKK">Bangkok<\/option>\r\n  <option value="CAN">Guangzhou<\/option>\r\n<option value="HKG">Hong Kong<\/option>\r\n              <option value="CGK">Jakarta<\/option>\r\n              <option value="BKI">Kota Kinabalu<\/option>\r\n<option value="KUL">Kuala Lumpur<\/option>\r\n<option value="MFM">Macau<\/option>\r\n <option value="KIX">Osaka (Kansai)<\/option>\r\n <option value="SGN">Saigon<\/option>\r\n <option value="PVG">Shanghai<\/option>\r\n             <option value="SIN">Singapore<\/option>\r\n              <option value="TPE">Taipei<\/option>\r\n <\/SELECT>\r\n          <br>\r\n          <select name="_destination" id="_destination" onchange=" CheckArrivalCity(\'_destination\')" style="width:175px">\r\n			  <option value="" selected>选择到达城市<\/option>\r\n              <option value="">---------DOMESTIC---------<\/option>\r\n              <option value="BCD">Bacolod<\/option>\r\n <option value="USU">Busuanga<\/option>\r\n              <option value="BXU">Butuan<\/option>\r\n              <option value="CGY">Cagayan de Oro<\/option>\r\n <option value="CYP">Calbayog<\/option>\r\n <option value="CRM">Catarman<\/option>\r\n <option value="CYZ">Cauayan<\/option>\r\n                 <option value="CEB">Cebu<\/option>\r\n              <option value="CRK">Clark<\/option>\r\n              <option value="CBO">Cotabato<\/option>\r\n              <option value="DVO">Davao<\/option>\r\n              <option value="DPL">Dipolog<\/option>\r\n              <option value="DGT">Dumaguete<\/option>\r\n              <option value="GES">General Santos<\/option> \r\n              <option value="ILO">Iloilo<\/option>\r\n              <option value="KLO">Kalibo (For Boracay)<\/option>\r\n              <option value="LAO">Laoag<\/option>\r\n              <option value="LGP">Legaspi<\/option>\r\n              <option value="MNL">Manila<\/option>\r\n  <option value="WNP">Naga<\/option>\r\n  <option value="OZC">Ozamiz<\/option>\r\n          <option value="PPS">Puerto Princesa<\/option>\r\n              <option value="RXS">Roxas<\/option>\r\n <option value="SJI">San Jose (Mindoro)<\/option>\r\n   <option value="IAO">Siargao<\/option>\r\n<option value="SUG">Surigao<\/option>\r\n<option value="TAC">Tacloban<\/option>\r\n              <option value="TAG">Tagbilaran<\/option>\r\n         <option value="VRC">Virac<\/option>\r\n        <option value="ZAM">Zamboanga<\/option>\r\n              <option value="">------INTERNATIONAL-------<\/option>\r\n              <option value="BKK">Bangkok<\/option>\r\n <option value="CAN">Guangzhou<\/option>\r\n <option value="HKG">Hong Kong<\/option>\r\n              <option value="CGK">Jakarta<\/option>\r\n            <option value="BKI">Kota Kinabalu<\/option>\r\n<option value="KUL">Kuala Lumpur<\/option>\r\n<option value="MFM">Macau<\/option>\r\n<option value="KIX">Osaka (Kansai)<\/option>\r\n <option value="SGN">Saigon<\/option>\r\n<option value="SIN">Singapore<\/option>\r\n              <option value="TPE">Taipei<\/option>\r\n<option value="SHA">Shanghai<\/option>\r\n<\/SELECT>\r\n          <p><strong>出发日期<\/strong><br>\r\n          <table width="100%"  border="0" cellspacing="0" cellpadding="0">\r\n            <tr> \r\n              <td width="127"> \r\n				<select onchange="dayChanged(1,0)" id="wdfday1" name="_depday" style="WIDTH: 43px">\r\n                  <option value="" selected="selected">天<\/option>\r\n                  <option value="01">1<\/option>\r\n                  <option value="02">2<\/option>\r\n                  <option value="03">3<\/option>\r\n                  <option value="04">4<\/option>\r\n                  <option value="05">5<\/option>\r\n                  <option value="06">6<\/option>\r\n                  <option value="07">7<\/option>\r\n                  <option value="08">8<\/option>\r\n                  <option value="09">9<\/option>\r\n                  <option value="10">10<\/option>\r\n                  <option value="11">11<\/option>\r\n                  <option value="12">12<\/option>\r\n                  <option value="13">13<\/option>\r\n                  <option value="14">14<\/option>\r\n                  <option value="15">15<\/option>\r\n                  <option value="16">16<\/option>\r\n                  <option value="17">17<\/option>\r\n                  <option value="18">18<\/option>\r\n                  <option value="19">19<\/option>\r\n                  <option value="20">20<\/option>\r\n                  <option value="21">21<\/option>\r\n                  <option value="22">22<\/option>\r\n                  <option value="23">23<\/option>\r\n                  <option value="24">24<\/option>\r\n                  <option value="25">25<\/option>\r\n                  <option value="26">26<\/option>\r\n                  <option value="27">27<\/option>\r\n                  <option value="28">28<\/option>\r\n                  <option value="29">29<\/option>\r\n                  <option value="30">30<\/option>\r\n                  <option value="31">31<\/option>\r\n                <\/select><select onchange="myChanged(1,0)" id="wdfmonthyear1" name="_depmonthyear" style="WIDTH: 80px">\r\n                    <option value="" selected>月<\/option>\r\n   		<option value="2009-11">Nov-2009<\/option> \r\n<option value="2009-12">Dec-2009<\/option>\r\n <option value="2010-01">Jan-2010<\/option>\r\n  <option value="2010-02">Feb-2010<\/option>\r\n					<option value="2010-03">Mar-2010<\/option>\r\n     <option value="2010-04">Apr-2010<\/option>\r\n   <option value="2010-05">May-2010<\/option>\r\n  <option value="2010-06">Jun-2010<\/option>\r\n 	 <option value="2010-07">Jul-2010<\/option>\r\n<option value="2010-08">Aug-2010<\/option>\r\n <option value="2010-09">Sep-2010<\/option>\r\n	<option value="2010-10">Oct-2010<\/option>\r\n  <\/select>\r\n    <\/td>\r\n              <td><a href="#" onclick="javascript:showCal(1);return false;"><img src="'+img_path+'images\/icn_calendar.gif" width="24" height="18" border=0><\/a><\/td>\r\n            <\/tr>\r\n          <\/table><\/p>\r\n          <p><strong>返程日期<\/strong><br>\r\n          <table width="100%"  border="0" cellspacing="0" cellpadding="0">\r\n            <tr> \r\n              <td width="127"> \r\n				<select name="_retday" onchange="dayChanged(2,0)" id="wdfday2" style="WIDTH: 43px">\r\n                  <option value="" selected="selected">天<\/option>\r\n                  <option value="01">1<\/option>\r\n                  <option value="02">2<\/option>\r\n                  <option value="03">3<\/option>\r\n                  <option value="04">4<\/option>\r\n                  <option value="05">5<\/option>\r\n                  <option value="06">6<\/option>\r\n                  <option value="07">7<\/option>\r\n                  <option value="08">8<\/option>\r\n                  <option value="09">9<\/option>\r\n                  <option value="10">10<\/option>\r\n                  <option value="11">11<\/option>\r\n                  <option value="12">12<\/option>\r\n                  <option value="13">13<\/option>\r\n                  <option value="14">14<\/option>\r\n                  <option value="15">15<\/option>\r\n                  <option value="16">16<\/option>\r\n                  <option value="17">17<\/option>\r\n                  <option value="18">18<\/option>\r\n                  <option value="19">19<\/option>\r\n                  <option value="20">20<\/option>\r\n                  <option value="21">21<\/option>\r\n                  <option value="22">22<\/option>\r\n                  <option value="23">23<\/option>\r\n                  <option value="24">24<\/option>\r\n                  <option value="25">25<\/option>\r\n                  <option value="26">26<\/option>\r\n                  <option value="27">27<\/option>\r\n                  <option value="28">28<\/option>\r\n                  <option value="29">29<\/option>\r\n                  <option value="30">30<\/option>\r\n                  <option value="31">31<\/option>\r\n                <\/select>\r\n                  <select name="_retmonthyear" onchange="myChanged(2,0)" id="wdfmonthyear2" style="WIDTH: 80px">\r\n					<option value ="" selected>月<\/option>\r\n	<option value="2009-11">Nov-2009<\/option>\r\n<option value="2009-12">Dec-2009<\/option>\r\n <option value="2010-01">Jan-2010<\/option>\r\n	<option value="2010-02">Feb-2010<\/option>\r\n					<option value="2010-03">Mar-2010<\/option>\r\n		<option value="2010-04">Apr-2010<\/option>\r\n	  <option value="2010-05">May-2010<\/option>\r\n <option value="2010-06">Jun-2010<\/option>\r\n		<option value="2010-07">Jul-2010<\/option>\r\n <option value="2010-08">Aug-2010<\/option>\r\n <option value="2010-09">Sep-2010<\/option>\r\n <option value="2010-10">Oct-2010<\/option>\r\n  <\/select>\r\n              <\/td>\r\n              <td><a href="#" onclick="javascript:showCal(2);return false;"><img id="cal2" name="cal2" src="'+img_path+'images\/icn_calendar.gif" width="24" height="18" border=0><\/a><\/td>\r\n            <\/tr>\r\n          <\/table><\/p>\r\n          <p><strong>乘客人数<\/strong><br>\r\n            <input name="_adults" type="text" value="1" class="textfield" size="3"\/>\r\n            成人(十二周岁以上)<br>\r\n            <input name="_children" type="text" value="0" class="textfield" size="3"\/>\r\n            儿童(两岁到十二周岁)<br>\r\n  <input name="_infants" type="text" value="0" class="textfield" size="3"\/>\r\n             婴儿(十六天到二十三个月)<\/p>\r\n <div class="rowspace"><input class="clsSSRcheckbox" type="checkbox" name="_faretype" id="_faretype" value="P" onClick="ftype_msg()"> <span class="clsgreen">I’m\/We’re traveling <br>with no bags for check-in.</span><br>Save P100 per guest per flight with <a href="javascript:ftype_msg1();"><span class="clsgreen">Go Lite</span></a> 机票，每位乘客每<br>次乘坐航班节省 200比索！</div><div class="rowspace"><a href="javascript:openSSR()"><font color=blue><b>特殊服务要求 </b></font></a></div><div class="rowspace"><p align="center"> \r\n <input name="Submit" type="image"onclick=\"javascript:return SimulateFlightSearch(_adults.value, _children.value, _infants.value, _tripType.value,_origin.value, _destination.value, _depday.value, _depmonthyear.value,_retday.value, _retmonthyear.value,_faretype.checked);\" src="'+img_path+'images\/btn_searchnow.gif">\r\n<\/p></div>');
	//document.writeln('<br><br><br>');
	//document.writeln('	 <div class="bluebox" style="width:167px; margin-top:0px;">\r\n');
	//document.writeln('		<ul class="bluesquare">\r\n');
	//document.writeln('		<li><a href="javascript:;" title="Booking Changes" onclick="MM_openBrWindow(\''+pg_path+'popbookingchange.html\',\'bookingchange\',\'left=300,top=300,scrollbars=no,resizable=no,width=300,height=120\')">Booking Changes<\/a>\r\n');	
	//document.writeln('		<li><a href="javascript:;" title="Help" onClick="MM_openBrWindow(\''+pg_path+'help\/bookandpay\/index.html\',\'bookinghelp\',\'scrollbars=yes,resizable=yes,width=500,height=440\')">Online Booking Help<\/a><\/li>   ');
	//document.writeln('		<li><a href="javascript:;" title="Flight Schedule" onclick="MM_openBrWindow(\''+pg_path+'popflightsked.html\',\'flightsked\',\'left=300,top=300,scrollbars=no,resizable=no,width=300,height=120\')">Flight Schedules<\/a><\/li>');
	//document.writeln('		</ul>');
	//document.writeln('	  </div>');
	document.writeln('<div id=\"SkySalesAvailabilitySearchDiv\"><\/div> ');	
	document.writeln(' </form>');
	document.writeln(' </div>');
