var pjName = "/AtlasjetWeb";
var show=0;
var hide=0;
function setBrowser() {
	if(show==0 || hide==0) {
		if (navigator.appName=="Microsoft Internet Explorer"){	
			show='inline';
			hide='none';
		}
		else {
			show='table-row';
			hide='none';
		}
	}
}
setBrowser();


function ajxFlightNumberList(from,to,fsdate,fedate,dvname,lang) {
	ajaxpack.getAjaxRequest(pjName+'/include/flightNumberProcess.jsp', 'from='+from+'&to='+to+'&fsdate='+fsdate+'&fedate='+fedate+'&dvname='+dvname+'&lang='+lang, processFlightNumberList, 'xml');
}


function processFlightNumberList(){  
	arrayList = null;
	basketlg = 0;
	var myajax=ajaxpack.ajaxobj
	var myfiletype=ajaxpack.filetype
	if (myajax.readyState == 4){
		if (myajax.status==200 || window.location.href.indexOf("http")==-1){
			if (myfiletype=="txt") {
				aaa = myajax.responseText;
				alert(aaa);
			}else{
	
				var fNoParamStr = "";
				var fNoParam = myajax.responseXML.getElementsByTagName("FlightNumberParam")[0];
				if (fNoParam!=null){
					fNoParamStr = fNoParam.childNodes[0].nodeValue.split(","); 
					dvname = fNoParamStr[0];
					lang = fNoParamStr[1];
				}

				var fNoListStr = "";
				
				fNoListStr  = "<table border=\"2\" cellpadding=\"0\" cellspacing=\"0\" bordercolor=\"Red\">";
				fNoListStr += "<tr>";
				fNoListStr += "<td align=\"right\" bgcolor=\"red\">";
				if (lang=='EN'){
					fNoListStr += "<a href=\"#\" onclick=\"HideContent('"+dvname+"'); return true;\"><font color=\"#FFFFFF\"><b>Close</b></font></a>";
				}else{
					fNoListStr += "<a href=\"#\" onclick=\"HideContent('"+dvname+"'); return true;\"><font color=\"#FFFFFF\"><b>Kapat</b></font></a>";
				}
	
				fNoListStr += "</td>";
				fNoListStr += "</tr>";
				fNoListStr += "<tr>";
				fNoListStr += "<td>";
				fNoListStr += "<table width=\"130\"  border=\"1\" cellspacing=\"0\" cellpadding=\"1\" bordercolorlight=\"#808080\" bordercolordark=\"#808080\" style=\"border-collapse: collapse\">";
				  
				var fNoList = myajax.responseXML.getElementsByTagName("FlightNumberList")[0];
				if (fNoList!=null){
					arrayList = new Array(fNoList.childNodes.length);
					for(var i=0;i<fNoList.childNodes.length;i++) {
					  var fNo = myajax.responseXML.getElementsByTagName("FlightNumberInfo")[i];
					   if (fNo != null){
							fNoStr = fNo.childNodes[0].nodeValue.split(","); 
							arrayList[i] = new Array(5);
							flightnumber = fNoStr[0];
							flighttime = fNoStr[1];
			
							fNoListStr += "<tr bgcolor=\"FDFDF7\">";
							fNoListStr += "<td align=\"left\">";
							if (dvname=='f_tooltip_ret'){
								fNoListStr += "<a href=\"#\" onclick=\"document.criters.airDNFlightNum.value = '"+flightnumber+" - "+flighttime+"';HideContent('"+dvname+"'); return true;\">"+flightnumber+" - "+flighttime+"</a>";
							}else{
								fNoListStr += "<a href=\"#\" onclick=\"document.criters.airFlightNum.value = '"+flightnumber+" - "+flighttime+"';HideContent('"+dvname+"'); return true;\">"+flightnumber+" - "+flighttime+"</a>";
							}
							fNoListStr += "</td>";
							fNoListStr += "</tr>";
						}
					}	
				}

				fNoListStr += "</table>";
				fNoListStr += "</td>";
				fNoListStr += "</tr>";
				fNoListStr += "</table>";

				document.getElementById(dvname).style.display = "block";
				document.getElementById(dvname).innerHTML = fNoListStr;

			}
				
		}
	}
}				

 


function createAjaxObj(){
var httprequest=false
if (window.XMLHttpRequest){ // if Mozilla, Safari etc
httprequest=new XMLHttpRequest()
if (httprequest.overrideMimeType)
httprequest.overrideMimeType('text/xml')
}
else if (window.ActiveXObject){ // if IE
try {
httprequest=new ActiveXObject("Msxml2.XMLHTTP");
} 
catch (e){
try{
httprequest=new ActiveXObject("Microsoft.XMLHTTP");
}
catch (e){}
}
}
return httprequest
}

var ajaxpack=new Object()
ajaxpack.basedomain="http://"+window.location.hostname
ajaxpack.ajaxobj=createAjaxObj()
ajaxpack.filetype="txt"
ajaxpack.addrandomnumber=0 //Set to 1 or 0. See documentation.

ajaxpack.getAjaxRequest=function(url, parameters, callbackfunc, filetype){
ajaxpack.ajaxobj=createAjaxObj() //recreate ajax object to defeat cache problem in IE
if (ajaxpack.addrandomnumber==1) //Further defeat caching problem in IE?
var parameters=parameters+"&ajaxcachebust="+new Date().getTime()
if (this.ajaxobj){
this.filetype=filetype
this.ajaxobj.onreadystatechange=callbackfunc
this.ajaxobj.open('GET', url+"?"+parameters, true)
this.ajaxobj.send(null)
}
}

ajaxpack.postAjaxRequest=function(url, parameters, callbackfunc, filetype){
ajaxpack.ajaxobj=createAjaxObj() //recreate ajax object to defeat cache problem in IE
if (this.ajaxobj){
this.filetype=filetype
this.ajaxobj.onreadystatechange = callbackfunc;
this.ajaxobj.open('POST', url, true);
this.ajaxobj.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
this.ajaxobj.setRequestHeader("Content-length", parameters.length);
this.ajaxobj.setRequestHeader("Connection", "close");
this.ajaxobj.send(parameters);
}
}




