﻿var filteredArray=new Array();
var actb_curr_Status = 1;

var actb_value="";
function actb(obj,ca,isfrom,from, countryfilter, istimetable,ismulti,langSelected){
	/* ---- Public Variables ---- */
	this.actb_timeOut = -1; // Autocomplete Timeout in ms (-1: autocomplete never time out)
	this.actb_lim = 4;    // Number of elements autocomplete can show (-1: no limit)
	this.actb_firstText = false; // should the auto complete be limited to the beginning of keyword?
	this.actb_mouse = true; // Enable Mouse Support
	this.actb_delimiter = new Array();  // Delimiter for multiple autocomplete. Set it to empty array for single autocomplete
	this.actb_startcheck = 2; // Show widget only after this number of characters is typed in.
	/* ---- Public Variables ---- */
    this.actb_from=from;
    this.actb_isfrom=isfrom;
    this.old_text='';
    this.actb_langSelected=langSelected

	/* --- Styles --- */
	this.actb_bgColor = '#C5E0FE';
	this.actb_textColor = '#133886';
	this.actb_hColor = '#DAF8FF';
	this.actb_fFamily = 'Verdana';
	this.actb_fSize = '11px';
	this.actb_hStyle = 'text-decoration:underline;font-weight="bold"';
	/* --- Styles --- */

	/* ---- Private Variables ---- */
	var actb_delimwords = new Array();
	var actb_cdelimword = 0;
	var actb_delimchar = new Array();
	var actb_display = false;
	var actb_pos = 0;
	var actb_total = 0;
	var actb_curr = null;
	var actb_rangeu = 0;
	var actb_ranged = 0;
	var actb_bool = new Array();
	var actb_pre = 0;
	var actb_toid;
	var actb_tomake = false;
	var actb_getpre = "";
	var actb_mouse_on_list = 1;
	var actb_kwcount = 0;
	//var actb_clearr=0;
	var actb_caretmove = false;
	this.actb_keywords = new Array();
	/* ---- Private Variables---- */
	this.actb_keywords = ca;
	var actb_self = this;
	actb_curr = obj;
    addEvent(actb_curr,"focus",actb_setup);
	function actb_setup(){	
	    if(actb_curr.value=='')
	    {
	    actb_Mygenerate();
	    }
	   // actb_curr.value='';
	    /* here to add you code of onfocus*/
	    
	    /*------------END-----------------*/
	    actb_curr.style.backgroundColor = 'white';
	    addEvent(document,"keydown",actb_checkkey);
		addEvent(actb_curr,"blur",actb_clear);
		addEvent(document,"keypress",actb_keypress);
				
		}
		
	function Prevent_click()
	{
	   if(actb_curr_Status == 1)
	    { 	    
	        if(
	            !(actb_curr.id.toLowerCase().indexOf("txttocity") > -1 && 
	              document.getElementById(actb_curr.id.replace("txtToCity","txtFromCity")).value == '')
	           ) 
	            { 
	                actb_curr.old_text= actb_curr.value;
	                if(actb_langSelected=='1')
	                    actb_curr.value='Please, select from the auto complete list.';
	                else if(actb_langSelected=='2')
	                    actb_curr.value='Bitte treffen Sie Ihre Auswahl anhand der Liste.';
	                else if(actb_langSelected=='3')
	                    actb_curr.value='Selezionare dalla lista di autocomplete.';
	                else if(actb_langSelected=='9')
	                    actb_curr.value='请选择从自动完成列表';
	                else if(actb_langSelected=='12')
	                    actb_curr.value = 'الرجاء الاختيار من القائمة';
	                else if (actb_langSelected == '5')
	                    actb_curr.value = 'Seleccione de la lista de autocompletar.';
	                else if(actb_langSelected == '4')
	                    actb_curr.value = 'Veuillez sélectionner dans la liste complète automatique.';    
	                else
	                    actb_curr.value='NL- Please, select from the auto complete list.';
	                    
	            }
	        actb_curr_Status = 2; // not 0 as the current value is not correct, and not 1 as it's also not wrong!!
	    }
	}

	function actb_clear(evt)
	{	    
		if (!evt) evt = event;
		removeEvent(document,"keydown",actb_checkkey);
		removeEvent(actb_curr,"blur",actb_clear);
		removeEvent(document,"keypress",actb_keypress);
		Prevent_click();
		actb_removedisp();
	}
//	function actb_parse(n){
//	if(actb_curr.value=='Please, select from the auto complete list.')
//	{
//        if (actb_self.actb_delimiter.length > 0){
//			var t = actb_delimwords[actb_cdelimword].trim().addslashes();
//			var plen = actb_delimwords[actb_cdelimword].trim().length;
//		}else{
//			var t = actb_curr.old_text.addslashes();
//			var plen = actb_curr.old_text.length;
//		}
//		
//	}
//	else
//	{
//	if (actb_self.actb_delimiter.length > 0){
//			var t = actb_delimwords[actb_cdelimword].trim().addslashes();
//			var plen = actb_delimwords[actb_cdelimword].trim().length;
//		}else{
//			var t = actb_curr.value.addslashes();
//			var plen = actb_curr.value.length;
//		}
//	}
//		
//		var tobuild = '';
//		var i;

//		if (actb_self.actb_firstText){
//			var re = new RegExp("^" + t, "i");
//		}else{
//			var re = new RegExp(t, "i");
//		}
//		var p = n.search(re);
//		for (i=0;i<p;i++){
//			tobuild += n.substr(i,1);
//		}
//		  tobuild += "<font style='"+(actb_self.actb_hStyle)+"'>"
//		    for (i=p;i<plen+p;i++){
//			    tobuild += n.substr(i,1);
//		    }
//		    tobuild += "</font>";
//			    for (i=plen+p;i<n.length;i++){
//			    tobuild += n.substr(i,1);
//		    }
//		}
//		
//		return tobuild;
//	}
////////////////////////////////////////////////////////////
	function actb_parse(n){
		if (actb_self.actb_delimiter.length > 0){
			var t = actb_delimwords[actb_cdelimword].trim().addslashes();
			var plen = actb_delimwords[actb_cdelimword].trim().length;
		}else{

		if (actb_curr.value == 'Please, select from the auto complete list.' || actb_curr.value == 'Bitte treffen Sie Ihre Auswahl anhand der Liste.' || actb_curr.value == 'Selezionare dalla lista di autocomplete.' || actb_curr.value == '请选择从自动完成列表' || actb_curr.value == 'الرجاء الاختيار من القائمة' || actb_curr.value == 'Seleccione de la lista de autocompletar.' || actb_curr.value == 'Veuillez sélectionner dans la liste complète automatique.')
                {
        //        actb_curr.value=actb_curr.old_text;
                    var t = actb_curr.old_text.addslashes();
			        var plen = actb_curr.old_text.length;
                }
                else
                {
                   var t = actb_curr.value.addslashes();
			        var plen = actb_curr.value.length;
                }
	
		}
		
		
		
		var tobuild = '';
		var i;

		if (actb_self.actb_firstText){
			var re = new RegExp("^" + t, "i");
		}else{
			var re = new RegExp(t, "i");
		}
		var p = n.search(re);
		for (i=0;i<p;i++){
			tobuild += n.substr(i,1);
		}
		  tobuild += "<font style='"+(actb_self.actb_hStyle)+"'>"
		    for (i=p;i<plen+p;i++){
			    tobuild += n.substr(i,1);
		    }
		    tobuild += "</font>";
			    for (i=plen+p;i<n.length;i++){
			    tobuild += n.substr(i,1);
		    }
		
		return tobuild;
	}
	///////////////////////////////////////////////////////////////
//	function actb_parse(n){
//	if(actb_curr.value=='Please, select from the auto complete list.')
//	{
//	actb_curr.value=actb_curr.old_text;
//	}
//		if (actb_self.actb_delimiter.length > 0){
//			var t = actb_delimwords[actb_cdelimword].trim().addslashes();
//			var plen = actb_delimwords[actb_cdelimword].trim().length;
//		}else{
//			var t = actb_curr.value.addslashes();
//			var plen = actb_curr.value.length;
//		}
//		var tobuild = '';
//		var i;

//		if (actb_self.actb_firstText){
//			var re = new RegExp("^" + t, "i");
//		}else{
//			var re = new RegExp(t, "i");
//		}
//		var p = n.search(re);
//		if(actb_curr.value=='Please, select from the auto complete list.')
//		{
//			tobuild = n;
//		    
//		}
//		else
//		{
//		for (i=0;i<p;i++){
//			tobuild += n.substr(i,1);
//		}
//		  tobuild += "<font style='"+(actb_self.actb_hStyle)+"'>"
//		    for (i=p;i<plen+p;i++){
//			    tobuild += n.substr(i,1);
//		    }
//		    tobuild += "</font>";
//			    for (i=plen+p;i<n.length;i++){
//			    tobuild += n.substr(i,1);
//		    }
//		}
//		return tobuild;
//	}


//function actb_parse(n){
//		if (actb_self.actb_delimiter.length > 0){
//			var t = actb_delimwords[actb_cdelimword].trim().addslashes();
//			var plen = actb_delimwords[actb_cdelimword].trim().length;
//		}else{
//			var t = actb_curr.value.addslashes();
//			var plen = actb_curr.value.length;
//		}
//		var tobuild = '';
//		var i;

//		if (actb_self.actb_firstText){
//			var re = new RegExp("^" + t, "i");
//		}else{
//			var re = new RegExp(t, "i");
//		}
//		var p = n.search(re);
//				
//		for (i=0;i<p;i++){
//			tobuild += n.substr(i,1);
//		}

//		tobuild += "<font style='"+(actb_self.actb_hStyle)+"'>"
//		for (i=p;i<plen+p;i++){
//			tobuild += n.substr(i,1);
//		}
//		tobuild += "</font>";
//			for (i=plen+p;i<n.length;i++){
//			tobuild += n.substr(i,1);
//		}
//		return tobuild;
//	}

//	function createFrame()
//	{	    
//		removeFrame();
//		var myframe = document.createElement('IFRAME');		
//		myframe.style.position='absolute';
//		myframe.style.top = eval(curTop(actb_curr) + actb_curr.offsetHeight) + "px";
//		myframe.style.left = curLeft(actb_curr) + "px";
//		myframe.style.backgroundColor=actb_self.actb_bgColor;
//		var pxh=document.getElementById('tat_table').offsetHeight;
//		var pxw=document.getElementById('tat_table').offsetWidth;
//      myframe.style.height = pxh + "px";
//      myframe.style.width = pxw + "px";
//		myframe.id = 'tat_tableiframe';
//		document.body.appendChild(myframe);
        
//      if (/MSIE (\d+\.\d+);/.test(navigator.userAgent))
//      {
//          var ieversion=new Number(RegExp.$1);             
//          if (ieversion>=6 && ieversion<7)
//          {
//              //Hide dropdowns        
//              document.getElementById('ctl00_SPWebPartManager1_g_52b6cdac_8a5d_47f0_bff9_064e6860c06f_ctl00_ucBookingOnlineSearch_ucDepTime_1_drpTime').style.visibility = 'hidden';
//              document.getElementById('ctl00_SPWebPartManager1_g_52b6cdac_8a5d_47f0_bff9_064e6860c06f_ctl00_ucBookingOnlineSearch_ucReturnDate_drpTime').style.visibility = 'hidden';
//          }
//      }
//    }
	
	//Hide the 2 dropdowns -> for the ie 6 only
	function Hide()
	{
	    if (/MSIE (\d+\.\d+);/.test(navigator.userAgent))
        {
            var ieversion=new Number(RegExp.$1);
            if (ieversion>=6 && ieversion<7)
            {
//                if(document.location.href.toLowerCase().indexOf('default.aspx') != -1)
//                {       
//                    if(document.location.href.toLowerCase().indexOf('english') != -1)
//                    {                        
//                        //Hide dropdowns        
//                        document.getElementById('ctl00_SPWebPartManager1_g_52b6cdac_8a5d_47f0_bff9_064e6860c06f_ctl00_ucBookingOnlineSearch_ucDepTime_1_drpTime').style.visibility = 'hidden';
//                        document.getElementById('ctl00_SPWebPartManager1_g_52b6cdac_8a5d_47f0_bff9_064e6860c06f_ctl00_ucBookingOnlineSearch_ucReturnDate_drpTime').style.visibility = 'hidden';                                                
//                    
//                        document.getElementById('ctl00_SPWebPartManager1_g_52b6cdac_8a5d_47f0_bff9_064e6860c06f_ctl00_FlightSchedule1_ucDepTime_1_drpTime').style.visibility = 'hidden';
//                        document.getElementById('ctl00_SPWebPartManager1_g_52b6cdac_8a5d_47f0_bff9_064e6860c06f_ctl00_FlightSchedule1_ucReturnDate_drpTime').style.visibility = 'hidden';
//                    }
//                    
//                    if(document.location.href.toLowerCase().indexOf('italian') != -1)
//                    {                        
//                        //Hide dropdowns        
//                        document.getElementById('ctl00_SPWebPartManager1_g_38475541_90f2_4d3f_a1d4_391713d1cc83_ctl00_ucBookingOnlineSearch_ucDepTime_1_drpTime').style.visibility = 'hidden';
//                        document.getElementById('ctl00_SPWebPartManager1_g_38475541_90f2_4d3f_a1d4_391713d1cc83_ctl00_ucBookingOnlineSearch_ucReturnDate_drpTime').style.visibility = 'hidden';                                                
//                    
//                        document.getElementById('ctl00_SPWebPartManager1_g_38475541_90f2_4d3f_a1d4_391713d1cc83_ctl00_FlightSchedule1_ucDepTime_1_drpTime').style.visibility = 'hidden';
//                        document.getElementById('ctl00_SPWebPartManager1_g_38475541_90f2_4d3f_a1d4_391713d1cc83_ctl00_FlightSchedule1_ucReturnDate_drpTime').style.visibility = 'hidden';
//                    }
//                    
//                    if(document.location.href.toLowerCase().indexOf('german') != -1)
//                    {                        
//                        //Hide dropdowns        
//                        document.getElementById('ctl00_SPWebPartManager1_g_50a760cf_13ea_4e3a_ba89_2689f0fa0315_ctl00_ucBookingOnlineSearch_ucDepTime_1_drpTime').style.visibility = 'hidden';
//                        document.getElementById('ctl00_SPWebPartManager1_g_50a760cf_13ea_4e3a_ba89_2689f0fa0315_ctl00_ucBookingOnlineSearch_ucReturnDate_drpTime').style.visibility = 'hidden';                        
//                    
//                        document.getElementById('ctl00_SPWebPartManager1_g_50a760cf_13ea_4e3a_ba89_2689f0fa0315_ctl00_FlightSchedule1_ucDepTime_1_drpTime').style.visibility = 'hidden';
//                        document.getElementById('ctl00_SPWebPartManager1_g_50a760cf_13ea_4e3a_ba89_2689f0fa0315_ctl00_FlightSchedule1_ucReturnDate_drpTime').style.visibility = 'hidden';
//                    }
//                }

                if(document.location.href.toLowerCase().indexOf('timetable.aspx') != -1)
                {
                    var ObjID = actb_curr.id + "";
                    //alert(ObjID);
                    if (ObjID.indexOf('ucCountry_1_txtFromCity') != -1)
                        ObjID = ObjID.replace("ucCountry_1_txtFromCity", "");
                    else if (ObjID.indexOf('ucCountry_1_txtToCity') != -1)
                        ObjID = ObjID.replace("ucCountry_1_txtToCity", "");
                    //alert(ObjID);
                    document.getElementById(ObjID + 'ucDepTime_1_drpTime').style.visibility = 'hidden';




                    document.getElementById(ObjID + 'ucReturnDate_drpTime').style.visibility = 'hidden';


                }
//                if(document.location.href.toLowerCase().indexOf('specialoffersdetails.aspx') != -1)
//                {
//                    document.getElementById('ctl00_SPWebPartManager1_g_e1fab71b_478d_4190_91f9_91aff4b8c234_ctl00_ucBookingOnlineSearch_ucDepTime_1_drpTime').style.visibility = 'hidden';
//                    document.getElementById('ctl00_SPWebPartManager1_g_e1fab71b_478d_4190_91f9_91aff4b8c234_ctl00_ucBookingOnlineSearch_ucReturnDate_drpTime').style.visibility = 'hidden';
//                }
            }            
        } 
	}
	
	//Show the 2 dropdowns -> for the ie 6 only
	function Show()
	{	
	    if (/MSIE (\d+\.\d+);/.test(navigator.userAgent))
        {
            var ieversion=new Number(RegExp.$1);
            if (ieversion>=6 && ieversion<7)
            {                         
//                if(document.location.href.toLowerCase().indexOf('default.aspx') != -1)
//                {
//                    if(document.location.href.toLowerCase().indexOf('english') != -1)
//                    { 
//                        //Show dropdowns again
//                        document.getElementById('ctl00_SPWebPartManager1_g_52b6cdac_8a5d_47f0_bff9_064e6860c06f_ctl00_ucBookingOnlineSearch_ucDepTime_1_drpTime').style.visibility = '';
//                        document.getElementById('ctl00_SPWebPartManager1_g_52b6cdac_8a5d_47f0_bff9_064e6860c06f_ctl00_ucBookingOnlineSearch_ucReturnDate_drpTime').style.visibility = '';
//                        
//                        document.getElementById('ctl00_SPWebPartManager1_g_52b6cdac_8a5d_47f0_bff9_064e6860c06f_ctl00_FlightSchedule1_ucDepTime_1_drpTime').style.visibility = '';
//                        document.getElementById('ctl00_SPWebPartManager1_g_52b6cdac_8a5d_47f0_bff9_064e6860c06f_ctl00_FlightSchedule1_ucReturnDate_drpTime').style.visibility = '';
//                    }
//                    
//                    if(document.location.href.toLowerCase().indexOf('italian') != -1)
//                    { 
//                        //Show dropdowns again                        
//                        document.getElementById('ctl00_SPWebPartManager1_g_38475541_90f2_4d3f_a1d4_391713d1cc83_ctl00_ucBookingOnlineSearch_ucDepTime_1_drpTime').style.visibility = '';
//                        document.getElementById('ctl00_SPWebPartManager1_g_38475541_90f2_4d3f_a1d4_391713d1cc83_ctl00_ucBookingOnlineSearch_ucReturnDate_drpTime').style.visibility = '';                                                
//                    
//                        document.getElementById('ctl00_SPWebPartManager1_g_38475541_90f2_4d3f_a1d4_391713d1cc83_ctl00_FlightSchedule1_ucDepTime_1_drpTime').style.visibility = '';
//                        document.getElementById('ctl00_SPWebPartManager1_g_38475541_90f2_4d3f_a1d4_391713d1cc83_ctl00_FlightSchedule1_ucReturnDate_drpTime').style.visibility = '';
//                    }
//                    
//                    if(document.location.href.toLowerCase().indexOf('german') != -1)
//                    { 
//                        //Show dropdowns again
//                        document.getElementById('ctl00_SPWebPartManager1_g_50a760cf_13ea_4e3a_ba89_2689f0fa0315_ctl00_ucBookingOnlineSearch_ucDepTime_1_drpTime').style.visibility = '';
//                        document.getElementById('ctl00_SPWebPartManager1_g_50a760cf_13ea_4e3a_ba89_2689f0fa0315_ctl00_ucBookingOnlineSearch_ucReturnDate_drpTime').style.visibility = '';
//                        
//                        document.getElementById('ctl00_SPWebPartManager1_g_50a760cf_13ea_4e3a_ba89_2689f0fa0315_ctl00_FlightSchedule1_ucDepTime_1_drpTime').style.visibility = '';
//                        document.getElementById('ctl00_SPWebPartManager1_g_50a760cf_13ea_4e3a_ba89_2689f0fa0315_ctl00_FlightSchedule1_ucReturnDate_drpTime').style.visibility = '';
//                    }
//                }

                if(document.location.href.toLowerCase().indexOf('timetable.aspx') != -1)
                {
                    var ObjID = actb_curr.id + "";
                    //alert(ObjID);
                    if (ObjID.indexOf('ucCountry_1_txtFromCity') != -1)
                        ObjID = ObjID.replace("ucCountry_1_txtFromCity", "");
                    else if (ObjID.indexOf('ucCountry_1_txtToCity') != -1)
                        ObjID = ObjID.replace("ucCountry_1_txtToCity", "");
                    document.getElementById(ObjID + 'ucDepTime_1_drpTime').style.visibility = '';
                    document.getElementById(ObjID + 'ucReturnDate_drpTime').style.visibility = '';
                }
//                if(document.location.href.toLowerCase().indexOf('specialoffersdetails.aspx') != -1)
//                {                    
//                    document.getElementById('ctl00_SPWebPartManager1_g_e1fab71b_478d_4190_91f9_91aff4b8c234_ctl00_ucBookingOnlineSearch_ucDepTime_1_drpTime').style.visibility = '';
//                    document.getElementById('ctl00_SPWebPartManager1_g_e1fab71b_478d_4190_91f9_91aff4b8c234_ctl00_ucBookingOnlineSearch_ucReturnDate_drpTime').style.visibility = '';
//                }
            }
        }
	}
	
//	function removeFrame()
//	{
//	    if (document.getElementById('tat_tableiframe')){document.body.removeChild(document.getElementById('tat_tableiframe')); } 
//	}

	function actb_generate(){
		if (document.getElementById('tat_table')){ actb_display = false;document.body.removeChild(document.getElementById('tat_table')); } 
		if (actb_kwcount == 0){
            Show();		
			actb_display = false;
			return;
		}
		a = document.createElement('table');
		a.cellSpacing='1px';
		a.cellPadding='2px';
		a.style.width='400px';
		a.style.position='absolute';
		a.style.top = eval(curTop(actb_curr) + actb_curr.offsetHeight) + "px";
		if(actb_langSelected=='12')
		a.style.left = curLeft(actb_curr)-75 + "px";
		else
		a.style.left = curLeft(actb_curr) + "px";
		a.style.backgroundColor=actb_self.actb_bgColor;
		a.id = 'tat_table';
		document.body.appendChild(a);
		var i;
		var first = true;
		var j = 1;
		if (actb_self.actb_mouse){
			a.onmouseout = actb_table_unfocus;
			a.onmouseover = actb_table_focus;
		}
		var counter = 0;
		for (i=0;i<actb_self.actb_keywords.length;i++){
			if (actb_bool[i]){
				counter++;
				r = a.insertRow(-1);							
				
				//document.getElementById('ctl00_SPWebPartManager1_g_52b6cdac_8a5d_47f0_bff9_064e6860c06f_ctl00_ucBookingOnlineSearch_lblClass').innerHTML = counter;				
				
				//Check if this is the from or to textbox
				if(actb_curr.id.toLowerCase().indexOf('txtfromcity') != -1)
				{		
					if(document.location.href.toLowerCase().indexOf('bookaflight.aspx') != -1)
					{	    
				        if(counter == 1 || counter == 2)				    
				            Show();				    
				        else				    
				            Hide();
				    }
				    else
				    {
				        if(counter == 1 || counter == 2 || counter == 3)
				            Show();
				        else
				            Hide();
				    }
				}				
				else
				{	
				    if(document.location.href.toLowerCase().indexOf('bookaflight.aspx') != -1)
					{
						if(counter == 1 || counter == 2 || counter == 3)				    
				            Show();				    
				        else
				            Hide();
					}
					else
					{		    
				        if(counter == 1 || counter == 2)				    
				            Show();				    
				        else				    
				            Hide();
				    }
				}				
				
				if (first && !actb_tomake){				    
					r.style.backgroundColor = actb_self.actb_hColor;
					first = false;
					actb_pos = counter;
				}else if(actb_pre == i){				    
					r.style.backgroundColor = actb_self.actb_hColor;
					first = false;
					actb_pos = counter;
				}else{				    
					r.style.backgroundColor = actb_self.actb_bgColor;
				}
				r.id = 'tat_tr'+(j);
				c = r.insertCell(-1);
				c.style.color = actb_self.actb_textColor;
				c.style.fontFamily = actb_self.actb_fFamily;
				c.style.fontSize = actb_self.actb_fSize;
				c.innerHTML = actb_parse(actb_self.actb_keywords[i]);
				c.id = 'tat_td'+(j);
				c.setAttribute('pos',j);
				if (actb_self.actb_mouse){				    
					c.style.cursor = 'pointer';
					c.onclick=actb_mouseclick;
					c.onmouseover = actb_table_highlight;
				}
				j++;
			}
			if (j - 1 == actb_self.actb_lim && j < actb_total){			    
				r = a.insertRow(-1);
				r.style.backgroundColor = actb_self.actb_bgColor;
				c = r.insertCell(-1);
				c.style.color = actb_self.actb_textColor;
				c.style.fontFamily = 'arial narrow';
				c.style.fontSize = actb_self.actb_fSize;
				c.align='center';
				c.innerHTML='<IMG SRC="/App_Themes/default/autodownarrow.gif" />';
				if (actb_self.actb_mouse){
					c.style.cursor = 'pointer';
					c.onclick = actb_mouse_down;					
				}
				break;
			}
		}
		//createFrame();
		actb_rangeu = 1;
		actb_ranged = j-1;
		actb_display = true;
		if (actb_pos <= 0) actb_pos = 1;
	}
	///////////////////////////////////////////////////
	function actb_Mygenerate()
	{

	actb_mouse_on_list=0;
		if (document.getElementById('tat_table')){ actb_display = false;document.body.removeChild(document.getElementById('tat_table')); } 

		a = document.createElement('table');
		a.cellSpacing='1px';
		a.cellPadding='2px';
		a.style.width='400px';
		a.style.position='absolute';
		a.style.top = eval(curTop(actb_curr) + actb_curr.offsetHeight) + "px";
		if(actb_langSelected=='12')
		a.style.left = curLeft(actb_curr)-75 + "px";
		else
		a.style.left = curLeft(actb_curr) + "px";
		a.style.backgroundColor=actb_self.actb_bgColor;
		a.id = 'tat_table';
		document.body.appendChild(a);

		if (actb_self.actb_mouse){
			a.onmouseout = actb_table_unfocus;
			a.onmouseover = actb_table_focus;
		}
		r = a.insertRow(-1);
		r.style.backgroundColor = actb_self.actb_hColor;

        r.id = 'tat_tr1';
		c = r.insertCell(-1);
		c.style.color = actb_self.actb_textColor;
		c.style.fontFamily = actb_self.actb_fFamily;
		c.style.fontSize = actb_self.actb_fSize;
		if(actb_langSelected=='1')
		    c.innerHTML = '<b>Enter the 2 first characters of:</b><ul><li>City name</li><li>Airport name or code</li><li>Country name</li></ul>';//<a href="javascript:;" onclick="actb_removedisp();">Close</a>
		 else if(actb_langSelected=='2')
		    c.innerHTML = '<b>Eingabe der ersten zwei Buchstaben von:</b><ul><li>Name der Stadt</li><li>Name/Code des Flughafens</li><li>Name des Landes</li></ul>';//<a href="javascript:;" onclick="actb_removedisp();">Close</a>
		 else if(actb_langSelected=='3')
		    c.innerHTML = '<b>Inserire le prime due lettere di:</b><ul><li>Nome della città </li><li>Nome aeroporto o codice</li><li>Nome dello stato</li></ul>';//<a href="javascript:;" onclick="actb_removedisp();">Close</a>
	     else if(actb_langSelected=='9')
		    c.innerHTML = '<b>输入头2个字母:</b><ul><li>城市名称</li><li>机场名称或代码</li><li>国名</li></ul>';//<a href="javascript:;" onclick="actb_removedisp();">Close</a>
         else if(actb_langSelected=='12')
             c.innerHTML = '<b style=\'direction:rtl;text-align:right!importan;font-family:tahoma\'>:ادخل الحروف الاولى من</b><ul style=\'direction:rtl;text-align:right!importan;font-family:tahoma\'><li>اسم المدينة</li><li>اسم او رمز المطار</li><li>اسم البلد</li></ul>'; //<a href="javascript:;" onclick="actb_removedisp();">Close</a>
         else if (actb_langSelected == '5')
             c.innerHTML = '<b>Introduzca los primeros 2 caracteres de:</b><ul><li>Nombre de la ciudad</li><li>Nombre o código del aeropuerto</li><li>Nombre del país</li></ul>'; //<a href="javascript:;" onclick="actb_removedisp();">Close</a>
         else if (actb_langSelected == '4')
             c.innerHTML = '<b>Saisissez les 2 premiers caractères de :</b><ul><li>Nom de la ville</li><li>Nom ou code de l\'aéroport</li><li>Nom du pays</li></ul>'; //<a href="javascript:;" onclick="actb_removedisp();">Close</a>
		 else
		    c.innerHTML = '<b>NL- Enter the 2 first characters of:</b><ul><li>City name</li><li>Airport name or code</li><li>Country name</li></ul>';//<a href="javascript:;" onclick="actb_removedisp();">Close</a>
		c.id = 'tat_td1';
				c.setAttribute('pos',1);

		//createFrame();		
		Hide();		
		actb_display = false;

	}
	///////////////////////////////////////////////////////////////////////////////////////////
	function actb_remake(){	
		document.body.removeChild(document.getElementById('tat_table'));		
		a = document.createElement('table');
		a.cellSpacing='1px';
		a.cellPadding='2px';
		a.style.width='400px';
		a.style.position='absolute';
		a.style.top = eval(curTop(actb_curr) + actb_curr.offsetHeight) + "px";
		if(actb_langSelected=='12')
		a.style.left = curLeft(actb_curr)-75 + "px";
		else
		a.style.left = curLeft(actb_curr) + "px";
		a.style.backgroundColor=actb_self.actb_bgColor;
		a.id = 'tat_table';
		if (actb_self.actb_mouse){
			a.onmouseout= actb_table_unfocus;
			a.onmouseover=actb_table_focus;
		}
		document.body.appendChild(a);
		var i;
		var first = true;
		var j = 1;
		if (actb_rangeu > 1){
			r = a.insertRow(-1);
			r.style.backgroundColor = actb_self.actb_bgColor;
			c = r.insertCell(-1);
			c.style.color = actb_self.actb_textColor;
			c.style.fontFamily = 'arial narrow';
			c.style.fontSize = actb_self.actb_fSize;
			c.align='center';
		    c.innerHTML='<IMG SRC="/App_Themes/default/autotoparrow.gif" />';
			if (actb_self.actb_mouse){
				c.style.cursor = 'pointer';
				c.onclick = actb_mouse_up;
			}
		}
		for (i=0;i<actb_self.actb_keywords.length;i++){
			if (actb_bool[i]){
				if (j >= actb_rangeu && j <= actb_ranged){
					r = a.insertRow(-1);
					r.style.backgroundColor = actb_self.actb_bgColor;
					r.id = 'tat_tr'+(j);
					c = r.insertCell(-1);
					c.style.color = actb_self.actb_textColor;
					c.style.fontFamily = actb_self.actb_fFamily;
					c.style.fontSize = actb_self.actb_fSize;
					c.innerHTML = actb_parse(actb_self.actb_keywords[i]);
					c.id = 'tat_td'+(j);
					c.setAttribute('pos',j);
					if (actb_self.actb_mouse){
						c.style.cursor = 'pointer';
						c.onclick=actb_mouseclick;
						c.onmouseover = actb_table_highlight;
					}
					j++;
				}else{
					j++;
				}
			}
			if (j > actb_ranged) break;
		}
		if (j-1 < actb_total){
			r = a.insertRow(-1);
			r.style.backgroundColor = actb_self.actb_bgColor;
			c = r.insertCell(-1);
			c.style.color = actb_self.actb_textColor;
			c.style.fontFamily = 'arial narrow';
			c.style.fontSize = actb_self.actb_fSize;
			c.align='center';
			c.innerHTML='<IMG SRC="/App_Themes/default/autodownarrow.gif" />';
			if (actb_self.actb_mouse){
				c.style.cursor = 'pointer';
				c.onclick = actb_mouse_down;
			}
		}

		//createFrame();
		
	}
	function actb_goup(){
		if (!actb_display) return;
		if (actb_pos == 1) return;
		document.getElementById('tat_tr'+actb_pos).style.backgroundColor = actb_self.actb_bgColor;
		actb_pos--;
		if (actb_pos < actb_rangeu) actb_moveup();
		document.getElementById('tat_tr'+actb_pos).style.backgroundColor = actb_self.actb_hColor;
		if (actb_toid) clearTimeout(actb_toid);
		if (actb_self.actb_timeOut > 0) actb_toid = setTimeout(function(){actb_mouse_on_list=0;actb_removedisp();},actb_self.actb_timeOut);
	}
	function actb_godown(){
		if (!actb_display) return;
		if (actb_pos == actb_total) return;
		document.getElementById('tat_tr'+actb_pos).style.backgroundColor = actb_self.actb_bgColor;
		actb_pos++;
		if (actb_pos > actb_ranged) actb_movedown();
		document.getElementById('tat_tr'+actb_pos).style.backgroundColor = actb_self.actb_hColor;
		if (actb_toid) clearTimeout(actb_toid);
		if (actb_self.actb_timeOut > 0) actb_toid = setTimeout(function(){actb_mouse_on_list=0;actb_removedisp();},actb_self.actb_timeOut);
	}
	function actb_movedown(){
		actb_rangeu++;
		actb_ranged++;
		actb_remake();
	}
	function actb_moveup(){
		actb_rangeu--;
		actb_ranged--;
		actb_remake();
	}

	/* Mouse */
	function actb_mouse_down(){
	
	
		document.getElementById('tat_tr'+actb_pos).style.backgroundColor = actb_self.actb_bgColor;
		actb_pos++;
		actb_movedown();
		document.getElementById('tat_tr'+actb_pos).style.backgroundColor = actb_self.actb_hColor;
		actb_curr.focus();
		actb_mouse_on_list = 0;
		if (actb_toid) clearTimeout(actb_toid);
		if (actb_self.actb_timeOut > 0) actb_toid = setTimeout(function(){actb_mouse_on_list=0;actb_removedisp();},actb_self.actb_timeOut);
	}
	function actb_mouse_up(evt){
	
	
		if (!evt) evt = event;
		if (evt.stopPropagation){
			evt.stopPropagation();
		}else{
			evt.cancelBubble = true;
		}
		document.getElementById('tat_tr'+actb_pos).style.backgroundColor = actb_self.actb_bgColor;
		actb_pos--;
		actb_moveup();
		document.getElementById('tat_tr'+actb_pos).style.backgroundColor = actb_self.actb_hColor;
		actb_curr.focus();
		actb_mouse_on_list = 0;
		if (actb_toid) clearTimeout(actb_toid);
		if (actb_self.actb_timeOut > 0) actb_toid = setTimeout(function(){actb_mouse_on_list=0;actb_removedisp();},actb_self.actb_timeOut);
	}
	function actb_mouseclick(evt){
		if (!evt) evt = event;
		if (!actb_display) return;
		actb_mouse_on_list = 0;
		actb_pos = this.getAttribute('pos');
		actb_penter();
	}
	function actb_table_focus(){
		actb_mouse_on_list = 1;
	}
	function actb_table_unfocus(){
		actb_mouse_on_list = 0;
		if (actb_toid) clearTimeout(actb_toid);
		if (actb_self.actb_timeOut > 0) actb_toid = setTimeout(function(){actb_mouse_on_list = 0;actb_removedisp();},actb_self.actb_timeOut);
	}
	
	function actb_table_highlight(){
		actb_mouse_on_list = 1;
		document.getElementById('tat_tr'+actb_pos).style.backgroundColor = actb_self.actb_bgColor;
		actb_pos = this.getAttribute('pos');
		while (actb_pos < actb_rangeu) actb_moveup();
		while (actb_pos > actb_ranged) actb_movedown();
		document.getElementById('tat_tr'+actb_pos).style.backgroundColor = actb_self.actb_hColor;
		if (actb_toid) clearTimeout(actb_toid);
		if (actb_self.actb_timeOut > 0) actb_toid = setTimeout(function(){actb_mouse_on_list = 0;actb_removedisp();},actb_self.actb_timeOut);
	}
	function actb_insertword(a){	
		if (actb_self.actb_delimiter.length > 0){
			str = '';
			l=0;
			for (i=0;i<actb_delimwords.length;i++)
			{
				if (actb_cdelimword == i)
				{
					prespace = postspace = '';
					gotbreak = false;
					for (j=0;j<actb_delimwords[i].length;++j)
					{
						if (actb_delimwords[i].charAt(j) != ' ')
						{
							gotbreak = true;
							break;
						}
						prespace += ' ';
					}
					for (j=actb_delimwords[i].length-1;j>=0;--j)
					{
						if (actb_delimwords[i].charAt(j) != ' ') break;
						postspace += ' ';
					}
					str += prespace;
					str += a;
					l = str.length;
					if (gotbreak) str += postspace;
				}
				else
				{
					str += actb_delimwords[i];
				}
				if (i != actb_delimwords.length - 1)
				{
					str += actb_delimchar[i];
				}
			}			
			actb_curr.value = str;
			setCaret(actb_curr,l);
		}
		else
		{
			actb_curr.value = a;
			actb_curr_Status = 0;
		}	
		
		//Check the FP Routes
		if(istimetable.toLowerCase() == 'false')
		{
		    if(actb_curr.id.toLowerCase().indexOf("txttocity") > -1)
		    {
		        if(!FPMatchRoute())
		        {
		            RBPrice.checked = true;
		            CKBPrice.checked = true;
		            RBPrice.removeAttribute('disabled');		        
		            CKBPrice.removeAttribute('disabled');		        
    		        
		            if(RBPrice.parentNode.attributes['disabled'].value == 'true')
                    {
                        RBPrice.parentElement.removeAttribute('disabled');
                        CKBPrice.parentElement.removeAttribute('disabled');
                    }
    		        
		            drpFareType.style.display = 'none';
                    drpFlexPricer.style.display = '';
                    
                    hiddenRBSchedule.value = false;
                    hiddenRBPrice.value = true;
                    hiddenCBFlexPrice.value = true;
                    hiddenDrpFareTypes.value = drpFlexPricer.options[drpFlexPricer.selectedIndex].value;                    
		        }
		        else
		        {
		            RBSchedule.checked = true;
		            RBPrice.disabled = true;
		            CKBPrice.disabled = true;
		            CKBPrice.checked = false;
    		        		        
		            drpFareType.style.display = '';
                    drpFlexPricer.style.display = 'none';
                    
                    hiddenRBSchedule.value = true;
                    hiddenRBPrice.value = false;
                    hiddenCBFlexPrice.value = false;
                    hiddenRBPriceDisabled.value = true;
                    
                    hiddenDrpFareTypes.value = 'none';
		        }
		    }
		}
		
		actb_mouse_on_list = 0;
		actb_removedisp();
	}
		
	function FPMatchRoute()
	{	    
	    var Result = false;
	    var arFPString = '';	   	    
	    
	    var fromcontrol='';
	    if (window.XMLHttpRequest)
            fromcontrol = actb_curr.getAttribute('from');
        else
            fromcontrol = actb_curr.from;
	    
	    var strFromAll = document.getElementById(fromcontrol).value;
	    var strToAll = actb_curr.value;
	    
	    var strFromArr = strFromAll.split("(");
	    var strToArr = strToAll.split("(");
	    
	    var strFrom = strFromArr[1].split(")");
	    var strTo = strToArr[1].split(")");	    	    

        var strFromTo = strFrom[0] + ',' + strTo[0];
        var strFromFrom = strTo[0] + ',' + strFrom[0];       
        
        for(i = 0; i < arFPStrings.length; i++)            
        {                  
            arFPString = arFPStrings[i].split('|');
                        
            if(arFPString[0].toLowerCase() == strFromFrom.toLowerCase())
            {
//                for (i = (drpFlexPricer.options.length-1); i >= 0; i--)
//                {
//                    drpFlexPricer.options[i]=null;
//                }
//                
//                var drpItems = arFPString[1].split('-');
//                for(i = 0; i < drpItems.length ; i++)
//                {        
//                    var drpItem = drpItems[i].split('+');
//                    var option = document.createElement("OPTION");
//                    option.value = drpItem[1];
//                    option.text = drpItem[0];
//                    drpFlexPricer.options.add(option);
//                    
//                    hiddenDrpFareTypesItems.value = hiddenDrpFareTypesItems.value + drpItem[0] + '|' + drpItem[1] + ';';
//                }
                     
                //hiddenDrpFareTypesItems.value = hiddenDrpFareTypesItems.value.slice(0, hiddenDrpFareTypesItems.value.length -1);
                //hiddenDrpFareTypesItems.value = 'LONFARE';
                
                return true;
            }
            else if(arFPString[0].toLowerCase() == strFromTo.toLowerCase())
            {
//                for (i = (drpFlexPricer.options.length-1); i >= 0; i--)
//                {
//                    drpFlexPricer.options[i]=null;
//                }
//                
//                var drpItems = arFPString[1].split('-');
//                for(i = 0; i < drpItems.length ; i++)
//                {
//                    var drpItem = drpItems[i].split('+');
//                    var option = document.createElement("OPTION");
//                    option.value = drpItem[1];
//                    option.text = drpItem[0];
//                    drpFlexPricer.options.add(option);
//                    
//                    hiddenDrpFareTypesItems.value = hiddenDrpFareTypesItems.value + drpItem[0] + '|' + drpItem[1] + ';';
//                }
                
                //hiddenDrpFareTypesItems.value = hiddenDrpFareTypesItems.value.slice(0, hiddenDrpFareTypesItems.value.length -1);
                //hiddenDrpFareTypesItems.value = 'LONFARE';
                
                return true;
            }
        }
	}	
		
	function actb_penter(){
		if (!actb_display) return;
		actb_display = false;
		var word = '';
		var c = 0;
		for (var i=0;i<=actb_self.actb_keywords.length;i++){
			if (actb_bool[i]) c++;
			if (c == actb_pos){
				word = actb_self.actb_keywords[i];
				break;
			}
		}
		actb_insertword(word);
		l = getCaretStart(actb_curr);
	}
	function actb_removedisp(){	       	       
	        
	        //Show dropdowns
	        Show();
	        
	   		if (actb_mouse_on_list==0){
			actb_display = 0;
			if (document.getElementById('tat_table')){ document.body.removeChild(document.getElementById('tat_table')); }
			//removeFrame();
			if (actb_toid) clearTimeout(actb_toid);
		}
	}
	/////////////////////////////////////
	
	function actb_keypress(e){
		if (actb_caretmove) stopEvent(e);
		return !actb_caretmove;
	}
	function actb_checkkey(evt){
		if (!evt) evt = event;
		a = evt.keyCode;
		caret_pos_start = getCaretStart(actb_curr);
		actb_caretmove = 0;
		switch (a){
			case 38:
				actb_goup();
				actb_caretmove = 1;				
				return false;
				break;
			case 40:
				actb_godown();
				actb_caretmove = 1;
				return false;
				break;
			case 13: case 9:
				if (actb_display){
					actb_caretmove = 1;					
					actb_penter();					
					return false;
				}else{
					return true;
				}
				break;
			default:
				setTimeout(function(){actb_tocomplete(a)},10);
				break;
		}
	}

	function actb_tocomplete(kc){
		if (kc == 38 || kc == 40 || kc == 13) return;
		if(kc==8)
		{
    	    actb_curr.style.backgroundColor = 'white';
     	}
		var i;
		actb_self.actb_keywords = getList(actb_curr.value);
		if (actb_display){ 
			var word = 0;
			var c = 0;
			for (var i=0;i<=actb_self.actb_keywords.length;i++){
				if (actb_bool[i]) c++;
				if (c == actb_pos){
					word = i;
					break;
				}
			}
			actb_pre = word;
		}else{ actb_pre = -1};
		
		if (actb_curr.value == ''){
			actb_mouse_on_list = 0;
			actb_removedisp();
			return;
		}
		
		if (actb_self.actb_delimiter.length > 0){
			caret_pos_start = getCaretStart(actb_curr);
			caret_pos_end = getCaretEnd(actb_curr);
			
			delim_split = '';
			for (i=0;i<actb_self.actb_delimiter.length;i++){
				delim_split += actb_self.actb_delimiter[i];
			}
			delim_split = delim_split.addslashes();
			delim_split_rx = new RegExp("(["+delim_split+"])");
			c = 0;
			actb_delimwords = new Array();
			actb_delimwords[0] = '';
			for (i=0,j=actb_curr.value.length;i<actb_curr.value.length;i++,j--){
				if (actb_curr.value.substr(i,j).search(delim_split_rx) == 0){
					ma = actb_curr.value.substr(i,j).match(delim_split_rx);
					actb_delimchar[c] = ma[1];
					c++;
					actb_delimwords[c] = '';
				}else{
					actb_delimwords[c] += actb_curr.value.charAt(i);
				}
			}

			var l = 0;
			actb_cdelimword = -1;
			for (i=0;i<actb_delimwords.length;i++){
				if (caret_pos_end >= l && caret_pos_end <= l + actb_delimwords[i].length){
					actb_cdelimword = i;
				}
				l+=actb_delimwords[i].length + 1;
			}
			var ot = actb_delimwords[actb_cdelimword].trim(); 
			var t = actb_delimwords[actb_cdelimword].addslashes().trim();
		}else{
			var ot = actb_curr.value;
			var t = actb_curr.value.addslashes();
		}
		if (ot.length == 0){
			actb_mouse_on_list = 0;
			actb_removedisp();
		}
		if (ot.length < actb_self.actb_startcheck) return this;
		if (actb_self.actb_firstText){
			var re = new RegExp("^" + t, "i");
		}else{
			var re = new RegExp(t, "i");
		}

		actb_total = 0;
		actb_tomake = false;
		actb_kwcount = 0;
		for (i=0;i<actb_self.actb_keywords.length;i++){
			actb_bool[i] = false;
			if (re.test(actb_self.actb_keywords[i])){
				actb_total++;
				actb_bool[i] = true;
				actb_kwcount++;
				if (actb_pre == i) actb_tomake = true;
			}
		}

		if (actb_toid) clearTimeout(actb_toid);
		if (actb_self.actb_timeOut > 0) actb_toid = setTimeout(function(){actb_mouse_on_list = 0;actb_removedisp();},actb_self.actb_timeOut);
		actb_generate();
	}
	    //AJAX
    function getList(txt)
    {
        var fromcontrol='';
        
        if (window.XMLHttpRequest)
            fromcontrol = actb_curr.getAttribute('from');
        else
            fromcontrol = actb_curr.from;
          
        if(istimetable.toLowerCase() == 'false')//Booking
        {
        
            if(ismulti.toLowerCase()=='false')//case one trip
            {
                if(fromcontrol!= '')
                {
                    var customarray;
                    return MatchText(arAutoCompStringsTo,escape(txt),document.getElementById(fromcontrol).value);
                }
                else
                {
                    var customarray;
                    return MatchText(arAutoCompStringsFrom,escape(txt),'0');
                }
            }
            else//case multi
            {
                if(fromcontrol!= '')
                {
                    var customarray;
                    return MatchText(arAutoCompStringsTo,escape(txt),document.getElementById(fromcontrol).value);
                }
                else
                {
                    var customarray;
                    return MatchText(arAutoCompStringsTo,escape(txt),'0');
                    
                }
            }
        }
        else //Timetable
        {
            if(fromcontrol!= '')
            {
                var customarray;
                return MatchText(arAutoCompStrings,escape(txt),document.getElementById(fromcontrol).value);
            }
            else
            {
                var customarray;
                return MatchText(arAutoCompStrings,escape(txt),'0');
            }
        }
        
    }
    // global flag
    var isIE = false;
    // global request and XML document objects
    var req;
//Match Given text to airport array
function MatchText(arData,strtxt, strfilter)
{
  var arFilteredData = new Array();
  var arFilteredData_New = new Array();
  while(strtxt.indexOf("%20")>-1 || strtxt.indexOf("%2C") >-1|| strtxt.indexOf(",%20")>-1)
  {
    strtxt = strtxt.replace("%20"," ").replace("%2C",",").replace(",%20",", ").replace("%28","(").replace("%29",")"); 
  }
    T=0;
     //This Line Modified By Khaled Abed .. for Arabic and Chinese Languages
    strtxt = unescape(strtxt);
    for(i=0; i < arData.length; i++)
    {
        if(strtxt.toLowerCase() == arData[i].substring(0,strtxt.length).toLowerCase())
        {
            arFilteredData[T] = arData[i];
            T++;
        }    
        else
        {
            strSub = arData[i].substring(arData[i].indexOf(", ")+2,arData[i].length);
            if(strtxt.toLowerCase() == strSub.substring(0,strtxt.length).toLowerCase())
            {
                arFilteredData[T] = arData[i];
                T++;
            }    
            else
            {
                strSub0 = strSub.substring(strSub.indexOf("(")+1,strSub.length)
                if(strtxt.toLowerCase() == strSub0.substring(0,strtxt.length).toLowerCase())
                {
                    arFilteredData[T] = arData[i];
                    T++;
                }
                else
                {
                    strSub1 = strSub0.substring(strSub0.indexOf(", ")+2,strSub0.length);
                    if(strtxt.toLowerCase() == strSub1.substring(0,strtxt.length).toLowerCase())
                    {
                        arFilteredData[T] = arData[i];
                        T++;
                    }
                }    
            }    
        }
    }
         
  if(strfilter !='0')
    { 
        j=0;
        for(i=0; i < arFilteredData.length; i++)
          {
            if(strfilter.toLowerCase()!=arFilteredData[i].toLowerCase())
             {
                arFilteredData_New[j] = arFilteredData[i];
                j++;
             }
          } 
    }
  else
    {
        if(istimetable.toLowerCase() == 'false' && ismulti.toLowerCase()=='false')
        {
            if(actb_curr.id.toLowerCase().indexOf('txtfromcity') > -1)//khaled:logically this condition is worthless, kept to jst make things clear!!
            {            
            arCountryFilter = new Array();
            arCountryFilter = countryfilter.split(',');
             for(j=0; j<arCountryFilter.length; j++)
              {
                k=0;
                for(i=0; i < arFilteredData.length; i++)
                    {
                     if(arFilteredData[i].toLowerCase().indexOf(arCountryFilter[j].toLowerCase()) > -1)
                        {
                         arFilteredData_New[k] = arFilteredData[i];
                         k++;
                        }
                    } 
              }
            }
        }
        else
        {
            arFilteredData_New = arFilteredData;
        }
    }

    if(arFilteredData_New.length == 0)
    {
        actb_curr.style.backgroundColor = '#fb8686';
    }
 actb_curr_Status = 1;
   return arFilteredData_New; 
}

    // retrieve XML document (reusable generic function);
    // parameter is URL string (relative or complete) to
    // an .xml file whose Content-Type is a valid XML
    // type, such as text/xml; XML source must be from
    // same domain as HTML file
   
    function loadXMLDoc(url) {
        // branch for native XMLHttpRequest object
        if (window.XMLHttpRequest) {
            req = new XMLHttpRequest();
            req.onreadystatechange = processReqChange;
            req.open("GET", url, true);
            req.send(null);
        // branch for IE/Windows ActiveX version
        } else if (window.ActiveXObject) {
            isIE = true;
            req = new ActiveXObject("Microsoft.XMLHTTP");
            if (req) {
                req.onreadystatechange = processReqChange;
                req.open("GET", url, true);
                req.send();
            }
        }
    }

    // handle onreadystatechange event of req object
    function processReqChange() {
        // only if req shows "loaded"
        if (req.readyState == 4) {
            // only if "OK"
            if (req.status == 200) {
    	    filteredArray = eval('new Array('+req.responseText+')');      
             } 
             else 
             {

             }
        }
    }
}


