function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

/// <summary>
/// Change the DataGrid colour when the mouse Over
/// </summary>
/// <returns>bool</returns>
var currentcolor;
function onMouseOverChangeColor(objDataGrid)
{
	currentcolor = objDataGrid.style.backgroundColor;
	objDataGrid.style.backgroundColor='#F8E9A3';
}

/// <summary>
/// Change the DataGrid colour when the mouse Out
/// </summary>
/// <returns>bool</returns>
function onMouseOutChangeColor(objDataGrid)
{
	objDataGrid.style.backgroundColor = currentcolor;
}
/*
 * trim(strValue)
 *
*/
function trim(strValue)
{
    if(strValue==null || strValue.length == 0) return ("");
    var cr=String.fromCharCode(13);
    var oldstr="";

    while (oldstr.length!=strValue.length)
    {
        oldstr = strValue;
        strValue=b_trim(strValue," ");
        strValue=b_trim(strValue," ");
        strValue=b_trim(strValue,cr);
    }
    return strValue;
}

/*********************************************
  remove chr from left & right side of strValue
  b_trimleft('aaabcdaaa','a') = 'bcd'
*********************************************/

function b_trim(strValue,chr)
{
    return (b_trimleft(b_trimright(strValue,chr),chr));
}

/*********************************************
  remove chr from left side of strValue
    b_trimleft('aaabcde','a') = 'bcde'
*********************************************/

function b_trimleft(strValue,chr)
{
    if(strValue == null || strValue.length == 0) return ("");
    i = 0;
    if (chr==String.fromCharCode(13))
    {
        while(strValue.charAt(i) == chr) {i=i+2;}
    }
    else
    {
        while(strValue.charAt(i) == chr) {i=i+1;}
    }
  return (strValue.substring(i));
}

/*********************************************

  remove chr from right side of strValue

    b_trimleft('abcdeee','e') = 'abcd'

*********************************************/

function b_trimright(strValue,chr)
{
    if(strValue == null || strValue.length == 0) return ("");
    i = strValue.length-1;
    if (chr==String.fromCharCode(13))
    {
        while(strValue.charAt(i-1) == chr) {i=i-2;}
    }
    else
    {
        while(strValue.charAt(i) == chr) {i=i-1;}
    }
    return (strValue.substring(0,i+1));
}

/// <summary>
/// Check the Date,It will less than current date or (date-1)
/// </summary>
/// <returns>int</returns>
function CheckDateType( obj_date )
{
	var theArray = obj_date.split("/");
	var today = new Date();
	var year = parseInt(today.getFullYear());
	if  ( parseInt( 20 + theArray[2]) < ( year-1 ) )
	{
		alert( getErrMessage("910") );
		return false;
	}
	return true;
}

/// <summary>
/// Check the Date
/// </summary>
/// <returns>bool</returns>
function checkDate(	obj )
{
	var da = obj.value;
	var strs = da.split("/");
	if(strs.length != 3){
		return false;
	}
	if(isNaN(strs[0]) || isNaN(strs[1]) || isNaN(strs[2])){
		return false;
	}
	var year = parseFloat(strs[2]);
	var months = parseFloat(strs[0]);
	var day = parseFloat(strs[1]);
	if(year < 100){
		year = year + 2000;
	}
	if(months < 1 || months > 12){
		return false;
	}
	switch(months){
		case 1 :
		case 3 :
		case 5 :
		case 7 :
		case 8 :
		case 10 :
		case 12 :
		if(day > 31 || day < 1){
			return false;
		}
		break;
		case 4 :
		case 6 :
		case 9 :
		case 11 :
		if(day > 30 || day < 1){
			return false;
	
		}
		break;
		case 2 :
		if((year % 4 == 0 && year % 100 != 0) || year % 400 == 0){
			if(day > 29 || day < 1){
				return false
			}
		}else{
			if(day > 28 || day < 1){
				return false
			}
		}
		break;		
	}

	obj.value = months + '/' + day + '/' + year;
	return true;		
}

/// <summary>
/// Check the Date,Will show message if it is more than
/// </summary>
/// <returns>int</returns>
function CheckDateMore(obj_date)
{
	var theArray = obj_date.split("/");
	
	var theMonth;
	var theDay;
	if ( parseInt(theArray[0]) < 10 )
	{
		theMonth = "0" + theArray[0];
	}else
	{
		theMonth = theArray[0]
	}
	if ( parseInt(theArray[1]) < 10 )
	{
		theDay = "0" + theArray[1];
	}else
	{
		theDay = theArray[1];
	}
	
	return (theArray[2] + theMonth + theDay);
}

/// <summary>
/// Check the Date,It will less than current date or (date-1)
/// </summary>
/// <returns>int</returns>
function CheckDateType( obj_date )
{
	var theArray = obj_date.split("/");
	var today = new Date();
	var year = parseInt(today.getFullYear());
	if  ( parseInt( 20 + theArray[2]) < ( year-1 ) )
	{
		alert( getErrMessage("910") );
		return false;
	}
	return true;
}

/// <summary>
/// Check the Date,It will less than current date
/// </summary>
/// <returns>int</returns>
function CheckDateTypeC( obj_date )
{
	var theArray = obj_date.split("/");
	var today = new Date();
	var year = parseInt(today.getFullYear());
	if  ( parseInt( 20 + theArray[2]) <  year )
	{
		alert( getErrMessage("910") );
		return false;
	}
	return true;
}

function isNumber( strNumber )
{
    strNumber = trim(strNumber);
    for (i=0; i < strNumber.length; i++)
    {
        var c = strNumber.substring(i, i + 1);
        if (!b_isDigit(c))
        {
            return false;
        }
    }
    return true;
}

function b_isDigit(c) { return (c >= '0' && c <= '9');}


/// <summary>
/// Only can input the Enligh Char
/// </summary>
function JHshNumberTextPlus()
{
     var keyPressed;
     if ( navigator.appName == "Netscape" )
     {
        keyPressed = arguments.callee.caller.arguments[0].which;
     }  
     else if ( navigator.appName == "Microsoft Internet Explorer" )
     {
        keyPressed = window.event.keyCode;
     }

     if ( !( ( keyPressed >= 48 ) && ( keyPressed <= 57 ) || ( keyPressed == 8 || keyPressed == 0 ) ))
     {
          var event = window.event|| arguments.callee.caller.arguments[0];
          if( navigator.appName == "Microsoft Internet Explorer" )
          {
            event.returnValue = false;
          }
          else if (navigator.appName == "Netscape" )
          {
            event.preventDefault();
          }
     }
}

function JHshTextPlus()
{
        var keyPressed;
        if ( navigator.appName == "Netscape" )
        {
            keyPressed = arguments.callee.caller.arguments[0].which;
        }
        else if ( navigator.appName == "Microsoft Internet Explorer" )
        {
            keyPressed = window.event.keyCode;
        }
 
    if ( !(  ( ( keyPressed >= 65 ) && ( keyPressed <= 90 ) 
    ||  ( keyPressed >= 97 ) && ( keyPressed <= 122 ) || ( keyPressed == 8  || keyPressed == 0 || keyPressed == 32 ) )))
    {
        var event = window.event || arguments.callee.caller.arguments[0];
        if( navigator.appName == "Microsoft Internet Explorer" )
        {
            event.returnValue = false;
        }
        else if (navigator.appName == "Netscape")
        {
            event.preventDefault();
        }
    }
}

  function checkReg(str) 
    { 
        if ( str.length >=1 && str.length < 2 )
            return false;
        if(/[^\w\d,]/.test(str) || /[\w\d]{3}/.test(str) || /^[\d\w]{0,1}\,/.test(str) || /\,[\d\w]{0,1}$/.test(str) || /\,[\d\w]\,/.test(str)  ) 
            return false; 
        else 
            return true; 
    }

    /// <summary>
    /// Check Airline if it is correct
    /// </summary>
    function CheckInputAirline()
    {
        var airlines  = document.getElementById("airText");
        if( !checkReg( airlines.value ) )
        {
            alert("Invalid Airline.");
            airlines.select();
            return; 
        }
        
        if ( /(\w[^,]+(?=(,|$))).*?(\1(?=,)|\1$)/.test(airlines.value))
        {
            alert("duplicated Airline.");
            airlines.select();
            return; 
        }
    }

    function ConfirmDialogue()
    {   
        try
        {     
            var radValue = document.getElementById("rdoLstCabin_4").value;
            if ( document.getElementById("rdoLstCabin_4").checked &&  radValue == "ALL" )
            {
                if ( DoConfirmVB( "Select several carriers, or select a cabin. Your search result may be faster & more successful if you narrow your search.  \nWould you like to continue ?" )) 
                { 
                    document.getElementById("HideConfirm").value ="true";
                    return true; 
                } 
                else 
                { 
                    document.getElementById("HideConfirm").value ="false";
                    return false; 
                 } 
             }
         }catch(e)
         {
         }
         return true;
    }

    function CheckInptIsnull()
    {
        if ( document.getElementById("txtDepCity").value = "" )
        {
            alert("Please input departure city");
            document.getElementById("txtDepCity").select();
            return false;
        }
        if ( document.getElementById("txtDesCity").value = "" )
        {
            alert("Please input Destination city");
            document.getElementById("txtDesCity").select();
            return false;
        }
		if(type == "openjaw")
		{
		    if ( document.getElementById("txtRtnFrom").value = "" )
            {
                alert("Please input departure city");
                document.getElementById("txtRtnFrom").select();
                return false;
            }
            if ( document.getElementById("txtRtnTo").value = "" )
            {
                alert("Please input Destination city");
                document.getElementById("txtRtnTo").select();
                return false;
            }
		}
		return true;
    }

    /// <summary>
	/// AirLine Select
	/// </summary>
	function doSelect(item,airCode)
	{
		document.getElementById("Hide_AirLineSelect").value = "1";
		var objAirCount	= document.getElementById("airCount");
		var objAirText	= document.getElementById("airText");
		var airCount	= parseInt(objAirCount.value);
		var strAir		= objAirText.value;

		if(item.title	==	0)
		{
			if(airCount == 5)
			{
				document.getElementById("lbAirlineMsg").innerHTML = "Requirement Exceeded.";
				document.getElementById("div_airline").style.display = "none";
				return;
			}
			//Add
			item.title = 1;
			item.parentElement.className="cssSel";
			airCount++;
			if(strAir != "")
			{
				strAir += ",";
			}
			strAir += airCode;
			
		}else
		{
			//Remove
			item.title = 0;
			item.parentElement.className="cssUnSel";
			airCount--;
			strAir = strAir.replace(airCode + ",","");
			strAir = strAir.replace("," + airCode,"");
			strAir = strAir.replace(airCode,"");
			document.getElementById("lbAirlineMsg").innerHTML = "";	
		}
		if ( airCount < 0 )
		{
			objAirCount.value	= 0;	
		}else
		{
			objAirCount.value	= airCount;
		}
		
		document.getElementById("airText").value = strAir;
	}

    /*
    /// <summary>
    /// On Search Fare
    /// </summary>
    function OnSearch(obj)
    {
        //document.getElementById("OnSearch").value ="searching";
        //document.getElementById("Form1").submit();
    }
    */

	/// <summary>
	/// On Search Fare
	/// </summary>
	var temp=1;
	function OnSearch(objs)
	{
		var count;
		count=temp;
		temp-=1;
		if(count==0)
		{
			document.getElementById("OnSearch").value ="searching";
			document.getElementById("form1").submit();
		}
	}
	var obj=setTimeout("OnSearch('s')",0.1);

	/// Add By:echo Xue 2006/12/06 Begin

	/// <summary>
	/// Set the Length of Day
	/// </summary>
	function GetStay(obj)
	{
		//Form1.document.all.txtStayLen.value = obj;
		document.getElementById("txtStayLen").value = obj;
	}					
	/// Add By:echo Xue 2006/12/06 End

	function ChangeFlightType(type)
	{
		if(type == "roundtrip")
		{
			
			document.getElementById("FlightType").value = "roundtrip";
			document.getElementById("Image4").src = "../Images/roundtrip1.gif";
			document.getElementById("Image6").src = "../Images/oneway1.gif";
			document.getElementById("Image5").src = "../Images/openjaw1.gif";
			
			document.getElementById("txtRtnFrom").style.display = "none";
			document.getElementById("txtRtnTo").style.display = "none";
			document.getElementById("lblRtnFrom").style.display = "block";
			document.getElementById("lblRtnTo").style.display = "block";
			
			SetReturnCity();
		}
		if(type == "oneway")
		{
			document.getElementById("FlightType").value = "oneway";
			document.getElementById("Image4").src = "../Images/roundtrip2.gif";
			document.getElementById("Image6").src = "../Images/oneway2.gif";
			document.getElementById("Image5").src = "../Images/openjaw1.gif";
			
			document.getElementById("txtRtnFrom").style.display = "none";
			document.getElementById("txtRtnTo").style.display = "none";
			document.getElementById("lblRtnFrom").style.display = "block";
			document.getElementById("lblRtnTo").style.display = "block";
			
			SetReturnCity();
		}
		if(type == "openjaw")
		{
			document.getElementById("FlightType").value = "openjaw";
			document.getElementById("Image4").src = "../Images/roundtrip2.gif";
			document.getElementById("Image6").src = "../Images/oneway1.gif";
			document.getElementById("Image5").src = "../Images/openjaw2.gif";
			
			document.getElementById("txtRtnFrom").style.display = "block";
			document.getElementById("txtRtnTo").style.display = "block";
			document.getElementById("lblRtnFrom").style.display = "none";
			document.getElementById("lblRtnTo").style.display = "none";
		}
	}

	function Mouseout()
	{
        try
        {
		    document.getElementById("lblError").style.display = "none";

		    if(document.getElementById("FlightType").value == "roundtrip")
		    {
			    //Edit by:Echo Xue 2006/11/11 Begin 
			    document.getElementById("OneWayTable").style.display = "";
			    //Edit by:Echo Xue 2006/11/11 End 
				
			    document.getElementById("Image4").src = "../Images/roundtrip1.gif";
			    document.getElementById("Image6").src = "../Images/oneway1.gif";
			    document.getElementById("Image5").src = "../Images/openjaw1.gif";
				
			    document.getElementById("txtRtnFrom").style.display = "none";
			    document.getElementById("txtRtnTo").style.display = "none";
			    document.getElementById("lblRtnFrom").style.display = "block";
			    document.getElementById("lblRtnTo").style.display = "block";
				
			    SetReturnCity();
		    }
			
		    if(document.getElementById("FlightType").value == "oneway")
		    {
			    document.getElementById("Image4").src = "../Images/roundtrip2.gif";
			    document.getElementById("Image6").src = "../Images/oneway2.gif";
			    document.getElementById("Image5").src = "../Images/openjaw1.gif";
			    document.getElementById("txtRtnFrom").style.display = "none";
			    document.getElementById("txtRtnTo").style.display = "none";
				
			    //Edit by:Echo Xue 2006/11/11 Begin 
			    //document.all.lblRtnFrom.style.display = "block";
			    //document.all.lblRtnTo.style.display = "block";
				
			    document.getElementById("OneWayTable").style.display = "none";
				
			    //SetReturnCity();
			    //Edit by:Echo Xue 2006/11/11 End 
		    }
			
		    if(document.getElementById("FlightType").value == "openjaw")
		    {
			    //Edit by:Echo Xue 2006/11/11 Begin 
			    document.getElementById("OneWayTable").style.display	= "";
			    //Edit by:Echo Xue 2006/11/11 End 
				
			    document.getElementById("Image4").src = "../Images/roundtrip2.gif";
			    document.getElementById("Image6").src = "../Images/oneway1.gif";
			    document.getElementById("Image5").src = "../Images/openjaw2.gif";
				
			    document.getElementById("txtRtnFrom").style.display = "block";
			    document.getElementById("txtRtnTo").style.display = "block";
			    document.getElementById("lblRtnFrom").style.display = "none";
			    document.getElementById("lblRtnTo").style.display = "none";
		    }
        }
        catch(e)
        {}
	}

	//**********************
	//根据出发城市填写返回城市
	//**********************
	function SetReturnCity() {
			var lblRtnFrom	= document.getElementById("lblRtnFrom");
			var lblRtnTo	= document.getElementById("lblRtnTo");
			var txtDepCity	= document.getElementById("txtDepCity");
			var txtDesCity	= document.getElementById("txtDesCity");
			
			UpperCase(txtDepCity);
			UpperCase(txtDesCity);
			
			isIE();
			lblRtnFrom.innerText	= txtDesCity.value;
			lblRtnTo.innerText		= txtDepCity.value;
	}

	//**********************
	//转到大写
	//**********************
	function UpperCase(obj) {
			
			/*if (obj.value.length != 3) 
			{	
				alert("Invalid Airport Code.");
				obj.select();
				return; 
			}*/
			
			obj.value = obj.value.toUpperCase();
	}

	function isIE(){ //ie? 
		if (window.navigator.userAgent.toLowerCase().indexOf("msie")>=1) 
			return true; 
		else 
			return false; 
	} 

	if(!isIE()){ //firefox innerText define
		HTMLElement.prototype.__defineGetter__(    "innerText", 
			function(){ 
				return this.textContent.replace(/(^\s*)|(\s*$)/g, "");
			} 
		); 
		HTMLElement.prototype.__defineSetter__(    "innerText", 
			function(sText){ 
				this.textContent=sText; 
			} 
		); 
	}

	/// <summary>
	/// Check the return from airPort Of OpenJaw
	/// </summary>
	function CheckRtnOpenJaw()
	{
		//if ( document.getElementById("FlightType").value == "openjaw" )
		//{
			var rtnFrom = document.getElementById("txtRtnFrom").value;
			var txtDesCity	= document.getElementById("txtDesCity").value;
			
			if ( (rtnFrom.length == 3) && (rtnFrom != txtDesCity) )
			{
				document.getElementById("txtRtnTo").value = document.getElementById("txtDepCity").value;
				document.getElementById("txtRtnTo").readOnly	= true;
				//document.getElementById("txtRtnTo").Enabled	= false;
				//document.getElementById("txtRtnTo").disabled	= true;
			}else
			{
				document.getElementById("txtRtnTo").value = "";
				//document.getElementById("txtRtnTo").disabled	= false;
				document.getElementById("txtRtnTo").readOnly	= false;
			}
		//}
	}

	/// <summary>
	///  Check the return to airPort Of OpenJaw
	/// </summary>
	function CheckToOpenJaw()
	{
	    try
        {
		    var rtnFrom = document.getElementById("txtRtnFrom").value;
		    var txtDesCity	= document.getElementById("txtDesCity").value;
		    if ( ( rtnFrom.length == 3) && ( rtnFrom == txtDesCity) )
		    {
			    document.getElementById("txtRtnTo").disabled	= false;
			    var RtnTo	= document.getElementById("txtRtnTo").value;
			    var DepCity = document.getElementById("txtDepCity").value;

			    if ( RtnTo == DepCity )
			    {
				    alert("Invalid Airport Code.");
				    document.getElementById("txtRtnTo").focus();
				    document.getElementById("btnSearch").disabled = true;

				    document.getElementById("lblError").style.display = "";
				    return;
			    }else
			    {
				    document.getElementById("btnSearch").disabled = false;
				    document.getElementById("lblError").style.display = "none";
			    }
		    }
        }catch(e)
        {}
	}

	/// <summary>
	/// Show the airline
	/// </summary>
	function Showairline(obj)
	{
		if (navigator.appName=="Netscape")
		{
			return;
		}	
		document.getElementById("div_airline").style.display = "block";

		if ( document.getElementById("Hide_AirLineSelect").value == "0" )
		{
			document.getElementById("airText").value	= "";
			document.getElementById("airCount").value	= "0";
		}
	}

	/// <summary>
	/// Hide the airline
	/// </summary>
	function HideAirline()
	{
		document.getElementById("div_airline").style.display = "none";
	}

	/// <summary>
	/// Check the airline whether it exist
	/// </summary>
	function CheckAirLine()
	{
		if ( document.getElementById("Hide_AirLineSelect").value == "1" )
		{
			document.getElementById("Hide_AirLineSelect").value = "0";
		}

		document.getElementById("airText").value = document.getElementById("airText").value.toUpperCase();
		var strAir	= trim(document.getElementById("airText").value);
		if ( strAir == "")
		{
			document.getElementById("airCount").value = 0;
			return; 
		}
		var theArray	= strAir.split(",");
		for( i = 0; i < theArray.length; i++)
		{
            if (!Ahash.contains(theArray[i]) )
            {
                alert("The Airline " + theArray[i].toLowerCase() + " does not exist.");
				document.getElementById("airCount").value	= 0;
				document.getElementById("airText").select();
				return;
            }
            
		}
		document.getElementById("airCount").value = parseInt(theArray.length);
		document.getElementById("Hide_AirLineSelect").value = "0";
	}

	function setSelect(obj)
	{
        obj.select();
    }

    function SetStayDays(type)
    {
        var depatureDate = document.getElementById("depatureDate_calendarDate");
        var returnDate = document.getElementById("returnDate_calendarDate");
        var txtStayLen = document.getElementById("txtStayLen");

        if(txtStayLen.value.length == 0)
            return;

        switch(type)
        {
            case "dep":
                var depatureDateDT = new Date(Date.parse(depatureDate.value));
                var returnDateDT = new Date(Date.parse(returnDate.value));
                txtStayLen.value = parseInt((returnDateDT - depatureDateDT)/1000/60/60/24);
                break;

            case "rtn":
                var depatureDateDT = new Date(Date.parse(depatureDate.value));
                var returnDateDT = new Date(Date.parse(returnDate.value));
                txtStayLen.value = parseInt((returnDateDT - depatureDateDT)/1000/60/60/24);
                break;

            case "len":
                var depatureDateDT = new Date(Date.parse(depatureDate.value));
                var returnDateDT = new Date(Date.parse(returnDate.value));
                var newDate = new Date(depatureDateDT.valueOf() + parseInt(txtStayLen.value)*24*60*60*1000);

                var yy = newDate.getFullYear();
                var mm = newDate.getMonth() + 1;
                var dd = newDate.getDate();

                yy = yy.toString().substring(0,4);

                if (mm < 10)
                {
                    mm = "0" + mm;
                }
                
                if (dd < 10)
                {
                    dd = "0" + dd; 
                }

                returnDate.value = mm + "/" + dd + "/" + yy;
                break;

        }
    }

    function Hashtable()
    {
        this._hash = new Object();
        this.add = function(key,value)
        {
            if(typeof(key)!="undefined")
            {
                if(this.contains(key)==false)
                {
                    this._hash[key]=typeof(value)=="undefined"?null:value;
                    return true;
                }
                else
                {
                    return false;
                }
            }
            else
            {
                return false;
            }
        }

        this.remove = function(key){delete this._hash[key];}
        this.count = function(){var i=0;for(var k in this._hash){i++;} return i;}
        this.items = function(key){return this._hash[key];}
        this.contains = function(key){ return typeof(this._hash[key])!="undefined";}
        this.clear = function(){for(var k in this._hash){delete this._hash[k];}}
        this.edit=function(key,value)
        {
            if(typeof(key)!="undefined")
            {
                if(this.contains(key)==true)
                {
                    this._hash[key]=typeof(value)=="undefined"?null:value;
                    return true;
                }
                else
                {
                    return false;
                }
            }
            else
            {
                return false;
            }
        }

        this.readall= function()
        {
            var i=0;
            var hash_all=new Array();
            for(var k in this._hash)
            {
                hash_all[i]=[k,this._hash[k]];
                i++;
            }
            return hash_all;
        }
    }
    
    function StringBuffer()
    {
        this._strings = new Array;
    }

    StringBuffer.prototype.append = function(str)
    {
        this._strings.push(str);
    };

    StringBuffer.prototype.toString = function()
    {
        return this._strings.join("");
    };

    var Ahash = new Hashtable();
    Ahash.add('AQ','');Ahash.add('2K','');Ahash.add('AR','');Ahash.add('AM','');Ahash.add('AB','');Ahash.add('SB','');Ahash.add('AC','');
    Ahash.add('CA','');Ahash.add('AF','');Ahash.add('AI','');Ahash.add('IX','');Ahash.add('NX','');Ahash.add('NZ','');Ahash.add('FJ','');
    Ahash.add('A7','');Ahash.add('TN','');Ahash.add('AS','');Ahash.add('AZ','');Ahash.add('NH','');Ahash.add('KM','');Ahash.add('AA','');
    Ahash.add('AX','');Ahash.add('HP','');Ahash.add('OZ','');Ahash.add('EV','');Ahash.add('OS','');Ahash.add('AV','');Ahash.add('UM','');
    Ahash.add('PG','');Ahash.add('GQ','');Ahash.add('BG','');Ahash.add('JJ','');Ahash.add('BA','');Ahash.add('BD','');Ahash.add('SN','');
    Ahash.add('V3','');Ahash.add('CX','');Ahash.add('5J','');Ahash.add('RP','');Ahash.add('CI','');Ahash.add('MU','');Ahash.add('CZ','');
    Ahash.add('OH','');Ahash.add('CO','');Ahash.add('CM','');Ahash.add('OU','');Ahash.add('CY','');Ahash.add('OK','');Ahash.add('AH','');
    Ahash.add('DL','');Ahash.add('KA','');Ahash.add('MS','');Ahash.add('EI','');Ahash.add('LY','');Ahash.add('EK','');Ahash.add('ET','');
    Ahash.add('EY','');Ahash.add('BR','');Ahash.add('EX','');Ahash.add('AY','');Ahash.add('F8','');Ahash.add('F9','');Ahash.add('GB','');
    Ahash.add('Z5','');Ahash.add('GF','');Ahash.add('HU','');Ahash.add('HA','');Ahash.add('UO','');Ahash.add('HX','');Ahash.add('QX','');
    Ahash.add('IB','');Ahash.add('FI','');Ahash.add('IC','');Ahash.add('JC','');Ahash.add('JL','');Ahash.add('EG','');Ahash.add('9W','');
    Ahash.add('KQ','');Ahash.add('IT','');Ahash.add('KL','');Ahash.add('KE','');Ahash.add('KU','');Ahash.add('LR','');Ahash.add('LA','');
    Ahash.add('4M','');Ahash.add('XL','');Ahash.add('LP','');Ahash.add('QV','');Ahash.add('LO','');Ahash.add('LT','');Ahash.add('LH','');
    Ahash.add('LG','');Ahash.add('MA','');Ahash.add('MH','');Ahash.add('AE','');Ahash.add('YX','');Ahash.add('MX','');Ahash.add('8M','');
    Ahash.add('EL','');Ahash.add('NW','');Ahash.add('OA','');Ahash.add('PR','');Ahash.add('PK','');Ahash.add('QF','');Ahash.add('QR','');
    Ahash.add('RA','');Ahash.add('AT','');Ahash.add('RJ','');Ahash.add('S2','');Ahash.add('SK','');Ahash.add('SC','');Ahash.add('FM','');
    Ahash.add('S5','');Ahash.add('FT','');Ahash.add('MI','');Ahash.add('SQ','');Ahash.add('XR','');Ahash.add('SA','');Ahash.add('JK','');
    Ahash.add('NK','');Ahash.add('UL','');Ahash.add('LX','');Ahash.add('NU','');Ahash.add('TA','');Ahash.add('RO','');Ahash.add('TG','');
    Ahash.add('TU','');Ahash.add('TK','');Ahash.add('B7','');Ahash.add('UA','');Ahash.add('US','');Ahash.add('AP','');Ahash.add('VA','');
    Ahash.add('VN','');Ahash.add('VS','');Ahash.add('MF','');

    function addLoadEvent(func) {
        var oldonload = window.onload;
            if (typeof window.onload != 'function') {
                window.onload = func;
                } else {  
                window.onload = function() {
                oldonload();
                func();
            }
        }
    }

    function InitAirline()
    {
        var tdCount = 1;
        var strHTML = new StringBuffer(); 
        strHTML.append("<table class='menu' cellspacing='1' border='0'><tbody><tr>");
        for(var key in Ahash._hash)
        {
            strHTML.append("<td class='cssUnSel'><span onClick=doSelect(this,'");
            strHTML.append(key);
            strHTML.append("') title='0' style='CURSOR:hand;'>");  
            strHTML.append(key);
            strHTML.append("</span></td>");

            if(tdCount % 27 == 0)
            {
                strHTML.append("</tr><tr>");
            }

            tdCount = tdCount + 1;
        }
        strHTML.append("</tr></tbody></table>");

        var _divAirline = document.getElementById("divAirline");
        _divAirline.innerHTML = strHTML.toString();
    }