        var result_array=new Array();
        var count_result=0;
        order=new Array();
        crtpage=0;
	var language = '';

        ex_shops=new Array();
        check_shop= new Array();

       function addRows(BigIndex,n,go_d_airport,go_a_airport,go_d_time,go_a_time,go_trip_time,go_stops,go_info,airline,total_price,query_url,shop,ret_d_airport,ret_a_airport,ret_d_time,ret_a_time,ret_trip_time,ret_stops,ret_info,search_id,pid,parser_for_click,go_airline,ret_airline,go_fnr,ret_fnr,go_via,ret_via,lang)
        {

                if (!airline.match(/[^a-zA-Z0-9\,+\)\(\s+]/)){
                  airline = airline.toUpperCase();
                }
                var newRow=new Array();
                var newCell=new Array();
                tmp_arr=new Array();
                newRow[0]=document.getElementById('tbl').tBodies[0].insertRow(-1);

                if (count_result % 2 != 0){
                   newRow[0].className="highlight1";
                }else{
                   newRow[0].className="highlight2";
                }
 
                var i;
                for(i=0; i<8; i++)
                {
                   newCell[i] = newRow[0].insertCell(i);
                }
		id_x=go_d_time.indexOf(":");
		h=go_d_time.substr(0,id_x);
		minute=go_d_time.substr(id_x+1,go_d_time.length);

		id_x=go_d_time.indexOf(":");
		go_d_hour=go_d_time.substr(0,id_x);
		go_d_minute=go_d_time.substr(id_x+1,go_d_time.length);

		id_x=go_a_time.indexOf(":");
		go_a_hour=go_a_time.substr(0,id_x);
		go_a_minute=go_a_time.substr(id_x+1,go_a_time.length);

		id_x=ret_d_time.indexOf(":");
		ret_d_hour=ret_d_time.substr(0,id_x);
		ret_d_minute=ret_d_time.substr(id_x+1,ret_d_time.length);

		id_x=ret_a_time.indexOf(":");
		ret_a_hour=ret_a_time.substr(0,id_x);
		ret_a_minute=ret_a_time.substr(id_x+1,ret_a_time.length);

		tmp_arr['ret_d']=parseInt(ret_d_hour,10)*60+parseInt(ret_d_minute,10);
                tmp_arr['ret_a']=parseInt(ret_a_hour,10)*60+parseInt(ret_a_minute,10);
                tmp_arr['go_d']=parseInt(h,10)*60+parseInt(minute,10);
                tmp_arr['go_a']=parseInt(go_a_hour,10)*60+parseInt(go_a_minute,10);

                go_d_hour = parseInt(go_d_hour);                 
                if(  go_d_hour < 12   ){
                 us_format_go_d_time =  (parseInt(go_d_hour)).toString()+":"+ go_d_minute +" am";
                }else{
                 us_format_go_d_time = (parseInt(go_d_hour)-12).toString()+":"+ go_d_minute +" pm";              
                } 

                go_a_hour = parseInt(go_a_hour);                
                if(  go_a_hour < 12  ){
                 us_format_go_a_time =  (parseInt(go_a_hour)).toString() + ":"+ go_a_minute +" am";
                }else{
                 us_format_go_a_time = (parseInt(go_a_hour)-12).toString() + ":"+ go_a_minute  +" pm";
                }
                

                ret_d_hour = parseInt(ret_d_hour);
                if(  ret_d_hour < 12   ){
                 us_format_ret_d_time =  (parseInt(ret_d_hour)).toString()+":"+ ret_d_minute +" am";
                }else if(ret_d_hour >= 12 && ret_d_hour < 24){
                 us_format_ret_d_time =  (parseInt(ret_d_hour)-12).toString()+":"+ ret_d_minute +" pm";              
                }else{
                   us_format_ret_d_time = "";
                }  
            
                ret_a_hour = parseInt(ret_a_hour);      
      
                if(  ret_a_hour < 12   ){
                 us_format_ret_a_time =  (parseInt(ret_a_hour)).toString() + ":"+ ret_a_minute +" am";
                }else if( ret_a_hour >= 12 && ret_a_hour < 24 ){
                 us_format_ret_a_time =  (parseInt(ret_a_hour)-12).toString() + ":"+ ret_a_minute +" pm";
                }else{
                  us_format_ret_a_time = "";
                }
                
                sort_go_d="<A href=\"#\" onclick=\"sort_hour('go_d','"+go_d_hour+"','"+go_d_minute+"')\">"+us_format_go_d_time+"</A>";
	        sort_go_a="<A href=\"#\" onclick=\"sort_hour('go_a','"+go_a_hour+"','"+go_a_minute+"')\">"+us_format_go_a_time+"</A>";

                sort_ret_d="<A href=\"#\" onclick=\"sort_hour('ret_d','"+ret_d_hour+"','"+ret_d_minute+"')\">"+us_format_ret_d_time+"</A>";
		sort_ret_a="<A href=\"#\" onclick=\"sort_hour('ret_a','"+ret_a_hour+"','"+ret_a_minute+"')\">"+us_format_ret_a_time+"</A>";

                tmp_arr['n'] ='<b>'+n+'</b>';

                var  val=new Array();
                val[0]=go_d_airport+"<br>"+go_a_airport;
                val[1]=ret_d_airport+"<br>"+ret_a_airport;
                newCell[0].innerHTML=createTable(val);
                tmp_arr['flughafen'] =go_d_airport+"</br>"+go_a_airport+"#"+ret_d_airport+"<br>"+ret_a_airport;

                val[0]=sort_go_d+"<br>"+sort_go_a;
                val[1]=sort_ret_d+"<br>"+sort_ret_a;
                newCell[1].innerHTML=createTable(val);
                tmp_arr['zeit'] =go_d_time+"</br>"+go_a_time+"#"+ret_d_time+"<br>"+ret_a_time;

                val[0]=go_trip_time;
                val[1]=ret_trip_time;
                newCell[2].innerHTML=createTable(val);

                id_x=go_trip_time.indexOf(":");
	        go_trip_hour=go_trip_time.substr(0,id_x);
	        go_trip_minute=go_trip_time.substr(id_x+1,go_trip_time.length);

		//tmp_arr['flugzeit']=parseInt(go_trip_hour,10)*60+parseInt(go_trip_minute,10);
                tmp_arr['flugzeit'] =go_trip_time;
                tmp_arr['flugzeit_for_fr'] =go_trip_time+"#"+ret_trip_time;

                val[0]=go_stops;
                val[1]=ret_stops;
                newCell[3].innerHTML=createTable(val);
                tmp_arr['stops'] =go_stops+"#"+ret_stops;

                tmp_arr['details']=go_info+"#"+ret_info;

                if(go_airline.length > 0){
                  newCell[4].innerHTML= go_airline+"<br>"+ "Flight number : "+go_fnr ;
                 if( go_via.length > 0 ) {
                  newCell[4].innerHTML += " change in " + go_via + "<br>";
                 }
                 if( ret_airline.length > 0 ){
                   newCell[4].innerHTML += ret_airline+"<br>"+ "Flight number : "+ret_fnr ;
                    if( ret_via.length > 0 ){
                      newCell[4].innerHTML += " change in " + ret_via + "<br>";
                    }
                 }
                }
                else{
                 newCell[4].innerHTML=airline+"<br>"+go_info+"<br>"+ret_info;
                }
                
                tmp_arr['airline']=airline;
                tmp_arr['for_fr_details'] = newCell[4];
                tmp_arr['shop'] = shop;

                total_price = total_price.replace(",",".");

		newCell[5].innerHTML='<b>'+total_price+' USD</b>';
		var picture="http://reise.idealo.de/pics/buchen.uk.gif";

                tmp_arr['price'] = Number(total_price);

                var shop_picture;

		if(shop.lastIndexOf('*')!=-1){
		  shop=shop.substring(0,shop.lastIndexOf('*'));
		}
		if (shop!='no')
		{
		  shop_picture="<input type='image' src='http://reise.idealo.de/bilder/flugshops/"+shop+".gif' alt='Flugbuchung bei "+shop+"' style='border: 1px solid black;' ><br><input type='Image' src='"+picture+"' alt='Flugbuchung bei "+shop+"' style='border:0'>";
		}
		else
		{
		  shop_picture='<font class="orange"><b>'+shop+'</b></font>';
		}

		newCell[6].innerHTML="<form method='post' action='http://flights.idealo.com/search/link.php?id=' target=_blank><input type=hidden name=q_url value='"+query_url+"'><input type=hidden name=shop value='"+shop+"'><input type=hidden name= Search_id value='"+search_id+"'><input type=hidden name=total_price value='"+total_price+"'><input type=hidden name=language value='"+lang+"'><input type=hidden name=parser_for_click value='"+parser_for_click+"'><input type=hidden name=pid value='"+pid+"'><input type=hidden name=airline value='"+airline+"'>"+shop_picture+"</form>";
		newCell[6].valign="top";

                tmp_arr['anbieter']=shop+"#"+query_url;
                tmp_arr['for_fr_shop'] = newCell[6];

                result_array[count_result]=tmp_arr;
                order[count_result]=count_result;
                count_result=count_result+1;
        }

        function createTable(val)
        {
                var str='<table align=center width=100% border:none cellspasing="0" style="padding: 3px;" >';

                var i;
                for(i=0;i<2;i++)
                {
                    if (i==0)
                      str=str+'<tr class= "linedown"><td>'+val[i]+'</td></tr>';
                    else {
                    	if (val[i].indexOf('nbsp') != -1) {
				val[i] = '';
			}
			str=str+'<tr><td>'+val[i]+'</td></tr>';
			}

                }
                str=str+'</table>'
                return str;
        }

        function _addShop(shop)
        {
           var shp=document.getElementById('shop');
           var count_row=document.getElementById('shop').rows.length;
           var newRow;
           var newCell;
           var oldRow=document.getElementById('shop').rows[count_row-1];
           newRow=document.getElementById('shop').tBodies[0].insertRow(count_row-1);
           newCell = newRow.insertCell(0);
           newCell.align='center';
           newCell.innerHTML=shop;
           newCell = newRow.insertCell(1);
           newCell.align='right';
           newCell.innerHTML="<div id='"+shop+"'>0</div>";
        }

        function _addShop_nav(shop)
        {
           var shp=document.getElementById('shop_nav');
           var count_row=document.getElementById('shop_nav').rows.length;
           var newRow;
           var newCell;
           var oldRow=document.getElementById('shop_nav').rows[count_row-1];
           newRow=document.getElementById('shop_nav').tBodies[0].insertRow(count_row-1);
           newCell = newRow.insertCell(0);
           newCell.align='left';
           newCell.style.fontWeight = "bold";
           newCell.style.color = "#FF8415";
           newCell.innerHTML= shop;
           newCell = newRow.insertCell(1);
            newCell.align='center';
           newCell.width='30';
           newCell.innerHTML="<div id ="+shop+"_sh ><img src='http://www.idealo.de/pics/buttons/sucht_ani.gif'></div>" ;
           newCell = newRow.insertCell(2);
           newCell.style.fontWeight = "bold";
           newCell.style.color = "#FF8415";
           newCell.width='20';
           newCell.align='right';
           newCell.innerHTML="<div id='"+shop+"'>0</div>";
        }

        function _addShop_table_1(shop)
        {
			var span = document.createElement("div");
			span.className = 'flights';

			var bild = document.createElement("img");
			bild.className = 'fleft';
			bild.src = 'http://reise.idealo.de/bilder/flugshops/'+shop+'_small.gif';
			bild.alt = shop ;
			span.appendChild(bild);

			var countSpan = document.createElement("div");
			countSpan.id = shop;
			countSpan.className = 'shopresultcount';
			span.appendChild(countSpan);

			var tr_fs = document.getElementById('tr_for_shops');
			tr_fs.appendChild(span);
        }

        function stop_shop_search (shop)
        {
        	shop=shop+"_sh";

        	document.getElementById(shop).innerHTML = '';
        }

        function _addItem(shop)
        {
        	var html = document.getElementById(shop).innerHTML;
        	if(html == ''){
        		document.getElementById(shop).innerHTML = '1';
        	}else{
        		document.getElementById(shop).innerHTML = Number(html)+1;
        	}
        }

         function show_status(shop_index){

        	var st;
        	switch(shop_index){

        		 case "1":
        		  st = 10;
        		  break;
        		 case "2":
        		  st = 25;
        		  break;
        		 case "3":
        		   st = 30;
        		   break;
        		 case "4":
        		  st = 45;
        		  break;
        		 case "5":
        		  st = 66;
        		  break;
        		  case "6":
        		  st = 78;
        		  break;
        		  case "7":
        		  st = 90;
        		  break;
        		  case "8":
        		  st = 99;
        		  break;
        		  default:
        		  st = 99;
        		  break;
        	}
        document.getElementById("shop_status").innerHTML= "<img  src=http://flug.idealo.de/pics/status/"+st+".gif>";
       }

       function show_status_new(shop_index){

        	var st;
        	switch(shop_index){

        		 case "1":
        		  st = 1;
        		  break;
        		 case "2":
        		  st = 2;
        		  break;
        		 case "3":
        		   st = 3;
        		   break;

        		 default:
        		  st = 1;
        		  break;
        	}
        document.getElementById("shop_status").innerHTML= "<img  src=http://flug.idealo.de/pics/status/step_0"+st+".gif>";
       }

    function createNewTable(id,width,align,border)
    {
        var newElem=document.createElement('table');
        newElem.id=id;
        newElem.width=width;
        newElem.border=border;
        newElem.align='center';
        document.body.appendChild(newElem);
    }

    function destroyTable(id)
    {
        document.getElementById(id).innerHTML='';
    }

    function destroyRows(id)
    {
         while(document.getElementById(id).rows.length>1)
         {
           document.getElementById("tbl").tBodies[0].deleteRow(1);
         }
    }


//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////



  all_res=new Array();
	order=new Array();
	mem_rows=new Array();

	mem_crawlers=new Array();
	mem_values=new Array();
	mem_links=new Array();
	crawlers=0;
	total_add=0;

	shop_count=0;

	nn4=ie=nn6=false;

  if(document.layers)
    {
		   nn4=true;
    }
	  else if(document.all)
    {
			ie=true;
    }
	else if(document.getElementById)
	  nn6=true;

    rows=0;
    row=Array();
    crtRow=0;
    results=0;
    limit=15 ;
    tip=1;

    crtpage=0;

    field=7;
    direction=0;

    search_details="";
    months=new Array("","Jan","Feb","Mär","Apr","Mai","Jun","Jul","Aug","Sep","Okt","Nov","Dez");
    months_en=new Array("","Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec");
    months_fr=new Array("","Jan","Fév","Mar","Avr","Mai","Jun","Jui","Aou","Sep","Oct","Nov","Déc");
    months_it=new Array("","Gen", "Feb", "Mar", "Apr", "Mag", "Giu", "Lug", "Ago", "Set", "Ott", "Nov", "Dec");
    months_es=new Array("","Ene","Feb","Mar","Abr","May","Jun","Jul","Ago","Set","Oct","Nov","Dic");  
    months_nl = new Array("", "jan", "feb", "mrt", "apr", "mei", "jun", "jul", "aug", "sep", "okt", "nov", "dec");
    
    short_search_details = '';
    
    function setdetails(from,to,go_day,go_month,go_year,ret_day,ret_month,ret_year,lang)
    {
    
      if (short_search_details==''){
	short_search_details = document.getElementById('results_banner').innerHTML;
      }
      language = lang;
      search_details=short_search_details+", "+go_day+"-"+months_en[go_month]+". "+go_year+"  and return flight on "+ ret_day+"-"+months_en[ret_month]+". "+ret_year;
      updatePages(Math.floor((results-1)/limit)+1,crtpage,lang);

    }

    function setdetails_oneway(from,to,go_day,go_month,go_year,ret_day,ret_month,ret_year,lang)
    {
	
	  if (short_search_details==''){
	    short_search_details = document.getElementById('results_banner').innerHTML;
	  }
	    
	 language = lang;	    
	  search_details=short_search_details+", "+go_day+"-"+months_en[go_month]+". "+go_year;
	  updatePages(Math.floor((results-1)/limit)+1,crtpage,lang);
	
	}

	function setlimit(limita)
	{
		limit=limita;
	}

	function settype(type)
	{
		tip=type;
	}

	function showarray()
	{
		for (i=0;i<results ;i++ )
		{
			alert(all_res[i][0]);
		}
	}

       function sort_hour(sort_by,hour,minute)
	{
		total_after=0;
		after_array=new Array();
		after_array_order=new Array();

		total_before=0;
		before_array=new Array();
		before_array_order=new Array();

		total_rest=0;
		rest_array=new Array();
		rest_array_order=new Array();

		time=60*parseInt(hour,10)+parseInt(minute,10);
		for(i=0;i<count_result;i++)
		{


			if(result_array[i][sort_by]==time)
			{
				rest_array[total_rest]=result_array[i];
				rest_array_order[total_rest]=order[i];
				total_rest++;
			}
			else if(result_array[i][sort_by]>time)
			{
				after_array[total_after]=result_array[i];
				after_array_order[total_after]=order[i];
				total_after++;
			}
			else
			{
				before_array[total_before]=result_array[i];
				before_array_order[total_before]=order[i];
				total_before++;
			}
		}


		//sort ascending the after array
		sorted=false;
		while(!sorted)
		{
			sorted=true;
			for (i=1;i<total_after;i++ )
			{
				if (after_array[i][sort_by]<after_array[i-1][sort_by])
				{
					tmp=after_array[i];
					after_array[i]=after_array[i-1];
					after_array[i-1]=tmp;
					tmp=after_array_order[i];
					after_array_order[i]=after_array_order[i-1];
					after_array_order[i-1]=tmp;
					sorted=false;
				}
			}
		}
		//sort ascending the before array
		sorted=false;
		while(!sorted)
		{
			sorted=true;
			for (i=1;i<total_before;i++ )
			{
				if (before_array[i][sort_by]<before_array[i-1][sort_by])
				{
					tmp=before_array[i];
					before_array[i]=before_array[i-1];
					before_array[i-1]=tmp;
					tmp=before_array_order[i];
					before_array_order[i]=before_array_order[i-1];
					before_array_order[i-1]=tmp;
					sorted=false;
				}
			}
		}

		//rebuild the initial results vector for display

		cur_pos=0;
		for(i=0;i<total_rest;i++)
		{
			result_array[cur_pos]=rest_array[i];
			order[cur_pos]=rest_array_order[i];
			cur_pos++;
		}
		for(i=0;i<total_after;i++)
		{
			result_array[cur_pos]=after_array[i];
			order[cur_pos]=after_array_order[i];
			cur_pos++;
		}
		for(i=0;i<total_before;i++)
		{
			result_array[cur_pos]=before_array[i];
			order[cur_pos]=before_array_order[i];
			cur_pos++;
		}

		distroy();
	}

	function sort_1(by,dir)
	{
		var red_asc_src="http://reise.idealo.de/pics/desc_order.gif";
		var red_desc_src="http://reise.idealo.de/pics/asc_order.gif";
		var green_asc_src="http://reise.idealo.de/pics/desc_order_green.gif";
		var green_desc_src="http://reise.idealo.de/pics/asc_order_green.gif";
		var asc_name;
		var desc_name;

		if (dir==0)
		{
			sorted=false;

			while (!sorted)
			{
				sorted=true;

				for (i=2;i<count_result;i++ )
				{
					if ((result_array[i][by]<result_array[i-1][by] && result_array[i][by]!=-1) || (result_array[i][by]>result_array[i-1][by] && result_array[i-1][by]==-1))
					{
						tmp=result_array[i];
						result_array[i]=result_array[i-1];
						result_array[i-1]=tmp;
						tmp=order[i];
						order[i]=order[i-1];
						order[i-1]=tmp;

						sorted=false;
					}
				}
			}

			sorted=false;
			while (!sorted)
			{
				sorted=true;
				for (i=1;i<count_result;i++ )
				{
					if ((result_array[i][by]<result_array[i-1][by] && result_array[i][by]!=-1) || (result_array[i][by]>result_array[i-1][by] && result_array[i-1][by]==-1))
					{
						tmp=result_array[i];
						result_array[i]=result_array[i-1];
						result_array[i-1]=tmp;
						tmp=order[i];
						order[i]=order[i-1];
						order[i-1]=tmp;
						sorted=false;
					}
				}
			}

			distroy();
		}

		if (dir==1)
		{
			sorted=false;
			while (!sorted)
			{
				sorted=true;

				for (i=1;i<count_result;i++ )  // changed  sb i=1
				{
					if (result_array[i][by]>result_array[i-1][by])
					{

						tmp=result_array[i];
						result_array[i]=result_array[i-1];
						result_array[i-1]=tmp;
						tmp=order[i];
						order[i]=order[i-1];
						order[i-1]=tmp;
						sorted=false;
					}
				}
			}
			distroy();
		}
		field=by;
		direction=dir;

    field_sort=new Array("","flughafen","zeit","flugzeit","stops","","airline","price","anbieter");

		for ( j=1 ; j <= 8 ; j++ )
		{
			if ( j==5 )
			{
				continue;
			}

			asc_name="asc"+j;
			desc_name="desc"+j;

			if(field_sort[j]==by)
			{

				if(dir==0)
				{
					document[asc_name].src=green_asc_src;
					document[desc_name].src=red_desc_src;
				}
				else
				{
					document[asc_name].src=red_asc_src;
					document[desc_name].src=green_desc_src;
				}
			}
			else
			{
				document[asc_name].src=red_asc_src;
				document[desc_name].src=red_desc_src;
			}
		}
	}

	function distroy()
	{
		rTable=getElementByIdAll("results_table");
		for (i=2;i<=tip*count_result+1;i++)
		{
			mem_rows[i-2]=document.getElementById("tbl").rows[2]
			mem_rows[i-2].style.display="none";
			rTable.removeChild(document.getElementById("tbl").rows[2]);
		}
		highlight=1;

		for (i=0;i<count_result;i++)
		{
			style="highlight"+highlight;

			if (highlight==1)
			{
				highlight=2;
			}
			else
			{
				highlight=1;
			}
			if (tip>1)
			{
				mem_rows[2*order[i]].className=style;
				rTable.appendChild(mem_rows[2*order[i]]);
				mem_rows[2*order[i]+1].className=style;
				rTable.appendChild(mem_rows[2*order[i]+1]);
			}
			else
			{
				mem_rows[order[i]].className=style;
				rTable.appendChild(mem_rows[order[i]]);
			}

		}
		for (i=0;i<count_result;i++)
		{
			order[i]=i;
		}

		changePage(crtpage,language);
	//	changePage(crtpage);


	}


	function addHTML(element,htmlCont){
		if (nn4) {
			nDiv=document.createElement("div");
			nDiv.document.clear();
			nDiv.document.open();
			nDiv.document.write(htmlCont);
			nDiv.document.close();
			element.appendChild(nDiv);
		}
		if(ie)
			element.innerHTML+=htmlCont;
		if(nn6){
			nDiv=document.createElement("DIV");
			nDiv.innerHTML=htmlCont;
			element.appendChild(nDiv);
		}
	}

	function replaceHTML(element,htmlCont){
		if (nn4) {
			element.document.clear();
			element.document.open();
			element.document.write(htmlCont);
			element.document.close();
		}
		if(ie||nn6){
			element.innerHTML=htmlCont;
		}
	}

	function replaceHTML_1(element,htmlCont){
		if (nn4) {
			element.document.clear();
			element.document.open();
			element.document.write(htmlCont);
			element.document.close();
		}
		if(ie||nn6){

			element.innerHTML=htmlCont;
				//alert(element);
		}
	}
	function replaceHTML_ALL(count,htmlCont){

		for( i= 1;i<count;i++){

			  t = 'Did_'+i+'';
			  element = document.getElementById(t);

			if (nn4) {
				element.document.clear();
				element.document.open();
				element.document.write(htmlCont);
				element.document.close();
			}
			if(ie||nn6){

				element.innerHTML=htmlCont;
				 // alert(t);
				 //	alert(element.innerHTML);
			}
	 }
	}

	function getElementByIdAll(id){
		if(nn4)
			return document.layers(id);
		if(ie)
			return document.getElementById(id);
		return document.getElementById(id);
	}

	function resetTable(){
		crtRow=0;
	}

	function changePage(page,lang){

    //  alert("function changePage page="+page + "lang="+lang);
//		for (i=2;i<=tip*count_result+1;i++)   // changed SB
			for (i=2;i<=tip*count_result+1;i++)
		{
			document.getElementById("tbl").rows[i].style.display="none";
		}
		start=tip*limit*page+1;
		end=tip*limit*(page+1);

		if (end>(tip*count_result)) end=tip*count_result;
		for (i=start+1;i<=end+1;i++)
		{
			document.getElementById("tbl").rows[i].style.display="";
		}
		updatePages(Math.floor((count_result-1)/limit)+1,page,lang);
		crtpage=page;
	}



  function updateLogo(go_d_airport,go_a_airport,ret_d_airport,ret_a_airport,lang) {

  	var text="";

  	switch(lang)
  	{
  	case  "de" :
	  	text+="Flugpreissuche  "+ go_d_airport+"-"+go_a_airport+"  und Rückflug";
	  	replaceHTML(getElementByIdAll("logo_sb"),text);
	  	break;

  	case  "uk" :
  	  text+="FLIGHT SEARCH "+ go_d_airport+"-"+go_a_airport+"  and return flight on";
	  	replaceHTML(getElementByIdAll("logo_sb"),text);
	  	break;

  	case  "com" :
  	  text+="FLIGHT SEARCH "+ go_d_airport+"-"+go_a_airport+"  and return flight on";
	  	replaceHTML(getElementByIdAll("logo_sb"),text);
	  	break;

  	case  "fr" :
  	  text+="RECHERCHE DE VOL "+ go_d_airport+"-"+go_a_airport+"  et vol retour à";
	  	replaceHTML(getElementByIdAll("logo_sb"),text);
	  	break;

  	case  "it" :
  	  text+="Cerca voli"+ go_d_airport+"-"+go_a_airport+" e ritorno il";
	  	replaceHTML(getElementByIdAll("logo_sb"),text);
	  	break;

  	case  "es" :
  	   text+="Buscar precio de vuelos"+ go_d_airport+"-"+go_a_airport+"  y vuelta el";
	  	replaceHTML(getElementByIdAll("logo_sb"),text);
	  	break;
	case  "nl" :
  	  text+="FLIGHT SEARCH "+ go_d_airport+"-"+go_a_airport+"  and return flight on";
	  	replaceHTML(getElementByIdAll("logo_sb"),text);
	  	break;  	

	  }
  }

  function updateLogo_oneway(go_d_airport,go_a_airport,lang) {

  	var text="";

    switch(lang)
    {
    case  "de" :
	  	text+="FLUGPREISSUCHE  "+ go_d_airport+"-"+go_a_airport;
	  	replaceHTML(getElementByIdAll("logo_sb"),text);
	  	break;
	 case  "uk" :
	  	text+="FLIGHT SEARCH "+ go_d_airport+"-"+go_a_airport;
	  	replaceHTML(getElementByIdAll("logo_sb"),text);
	  	break;
	 case  "com" :
	  	text+="FLIGHT SEARCH "+ go_d_airport+"-"+go_a_airport;
	  	replaceHTML(getElementByIdAll("logo_sb"),text);
	  	break;
   	case  "fr" :
	  	text+="RECHERCHE DE VOL "+ go_d_airport+"-"+go_a_airport;
	  	replaceHTML(getElementByIdAll("logo_sb"),text);
	  	break;
	case  "it" :
	  	text+="Cerca voli "+ go_d_airport+"-"+go_a_airport;
	  	replaceHTML(getElementByIdAll("logo_sb"),text);
	  	break;
   	case  "es" :
	  	text+="Buscar precio de vuelos "+ go_d_airport+"-"+go_a_airport;
	  	replaceHTML(getElementByIdAll("logo_sb"),text);
	  	break;
	case  "nl" :
	  	text+="FLIGHT SEARCH "+ go_d_airport+"-"+go_a_airport;
	  	replaceHTML(getElementByIdAll("logo_sb"),text);
	  	break;  	
	  }
  }

   function wrong_date( lang ) {

  	var text="";
    switch(lang)
    {
     case 'de' :
     	text+="***** ES GIBT FEHLER IN IHREM SUCHFORMULAR. BITTE ÄNDERN SIE DIE ANFRAGE *****";
      break;
     case 'uk' :
    	text+="***** SORRY , THERE WAS AN ERROR IN YOUR REQUEST, PLEASE CHANGE YOUR SEARCH CRITERIA AND TRY AGAIN *****";
      break;
     case 'it' :
     	text+="***** C'È UN ERRORE NEI VOSTRI CRITERI DI RICERCA. PER FAVORE RIFORMULATE LA RICERCA. *****";
      break;
     case 'es' :
    	text+="***** HAY UN ERROR EN SU CRITERIO DE BÚSQUEDA. POR FAVOR MODIFIQUE SU CONSULTA. *****";
      break;
     case 'fr' :
    	text+="***** Il y a des erreurs dans votre formulaire de recherche. Veuillez modifier votre demande.. *****";
      break;
     default :
        text+="***** SORRY , THERE WAS AN ERROR IN YOUR REQUEST, PLEASE CHANGE YOUR SEARCH CRITERIA AND TRY AGAIN *****";
      break;
   }
  	replaceHTML(getElementByIdAll("Error_date"),text);

  }
  
function updatePages(pages,crtPage,lang) {

		var text="";
		if(crtPage>0)text+="<a href=\"#\" class=\"apages\"><span onClick=\"changePage("+(crtPage-1)+",'" +lang+"')\" style=cursor:hand>&lt;&lt;&lt; </span></a>&nbsp;&nbsp;";
		for(i=0;i<pages;i++)
			if(i!=crtPage)text+="<a href=\"#\" class=apages><span onClick= \"changePage("+i+",'"+lang+"')\" style=cursor:hand> ["+(i+1)+"]</span></a>&nbsp;&nbsp;";
			else text+="-"+(i+1)+"-&nbsp;&nbsp;";
		if(crtPage<pages-1)text+="<a href=\"#\" class=apages><span onClick= \" changePage("+(crtPage+1)+",'"+lang+"')\" style=cursor:hand> &gt;&gt;&gt;</span></a>&nbsp;&nbsp; ";
		replaceHTML(getElementByIdAll("pagesNav"),text);

		if( Math.floor(pages) == 0 )
		{
			pages = 1;
		}

   switch (lang)
   {
	   case "de" :
			text=search_details+": "+count_result+" Ergebnisse gefunden - Seite "+(Math.floor(crtPage)+1)+"/"+(Math.floor(pages));
			replaceHTML(getElementByIdAll("results_banner"),text);
			break;
		 case "uk" :
			text=search_details+": "+count_result+" results found - page "+(Math.floor(crtPage)+1)+"/"+(Math.floor(pages));
			replaceHTML(getElementByIdAll("results_banner"),text);
			break;
		 case "com" :
			text=search_details+": "+count_result+" results found - page "+(Math.floor(crtPage)+1)+"/"+(Math.floor(pages));
			replaceHTML(getElementByIdAll("results_banner"),text);
			break;

		 case "fr" :
			text=search_details+": "+count_result+" Résultats trouvés - page "+(Math.floor(crtPage)+1)+"/"+(Math.floor(pages));
			replaceHTML(getElementByIdAll("results_banner"),text);
			break;
		 case "it" :
			text=search_details+": "+count_result+" Risultati trovati - Pagina "+(Math.floor(crtPage)+1)+"/"+(Math.floor(pages));
			replaceHTML(getElementByIdAll("results_banner"),text);
			break;
		 case "es" :
			text=search_details+": "+count_result+" Resultados encontrados- Página  "+(Math.floor(crtPage)+1)+"/"+(Math.floor(pages));
			replaceHTML(getElementByIdAll("results_banner"),text);
			break;			
		 case "nl":
			text = search_details + ": " + count_result + " Resultaten gevonden - pagina  " + (Math.floor(crtpage) + 1) + "/" + (Math.floor(pages));;
			break;				
	 }
}

function noResults( lang ){
		rTable=getElementByIdAll("results_table");
		rRow= document.createElement("TR");
		rCell= document.createElement("TD");
		rCell.align="center";
		rCell.height="80";

		switch (lang)
		{

		case 'de' :
		 	addHTML(rCell,"<b>Leider brachte Ihre Anfrage keine Ergebnisse. Bitte modifizieren Sie die Abfrage und starten Sie eine neue Suche</b>");
		    break;

		case 'uk' :
		   addHTML(rCell,"<b>We are unable to find flights for the date, location and duration that you selected. Please try again.</b>");
		   break;

		case 'com' :
		   addHTML(rCell,"<b>We are unable to find flights for the date, location and duration that you have selected. Please try again.</b>");
		   break;

		case 'fr' :
		   addHTML(rCell,"<b>Il n'y a malheureusement aucun résultat à votre recherche. Veuillez modifier votre recherche.</b>");
		   break;
		case 'it' :
		   addHTML(rCell,"<b>La vostra ricerca non ha dato alcun risultato. Per favore modificate i criteri di ricerca e provate di nuovo.</b>");
		   break;

		case 'es' :
		   addHTML(rCell,"<b>No se ha encontrado ningún resultado. Por favor, modifique usted la búsqueda y comience de nuevo</b>");
		   break;
		   
		case 'nl':
		   addHTML(rCell,"<b>Wij kunnen geen vluchten vinden voor de door u geselecteerde datum, locatie en duur. Probeer het a.u.b. nogmaals.</b>");
		   break;
	   
		 }

		rRow.appendChild(rCell);
		rTable.replaceChild(rRow,getElementByIdAll("table_header"));
		rRow=getElementByIdAll("table_header_");
		rTable.removeChild(rRow);
		searchDone( lang );

	}

	function once_more( message,lang ){
		rTable=getElementByIdAll("results_table");
		rRow= document.createElement("TR");
		rCell= document.createElement("TD");
		rCell.align="center";
		rCell.height="80";

		switch (lang)
		{

		case 'de' :
		 if(message ==1 )
		   addHTML(rCell,"<b>Die Eingabe stimmt mit keinem Zielflughafen überein. Kontrollieren Sie Ihre Eingabe bitte auf Tippfehler oder wählen Sie einen Flughafen indem Sie auf das Wort 'NACH' links neben dem Eingabefeld klicken.</b>");
		 else if (message ==2)
		 	 addHTML(rCell,"<b>Die Eingabe stimmt mit keinem Abflughafen überein. Kontrollieren Sie Ihre Eingabe bitte auf Tippfehler oder wählen Sie einen Flughafen indem Sie auf das Wort 'VON' links neben dem Eingabefeld klicken.</b>");
		 else if (message ==3)
		 	 addHTML(rCell,"<b>Die Eingabe stimmt mit keinem Zielflughafen oder Abflughafen überein. Kontrollieren Sie Ihre Eingabe bitte auf Tippfehler oder wählen Sie einen Flughafen indem Sie auf das Wort 'NACH' oder 'VON'links neben dem Eingabefeld klicken.</b>");
		 break;
        case 'nl' : 
		case 'uk' :
		 if(message ==1 )
		   addHTML(rCell,"<b>We cannot find the airport you have specified for your flight departure.Please click on the 'flying to' button and choose from our list of airports.</b>");
		 else if (message ==2)
		 	 addHTML(rCell,"<b>We cannot find the airport you have specified for your flight departure.Please click on the 'flying from' button and choose from our list of airports.</b>");
		 else if (message ==3)
		 	 addHTML(rCell,"<b>We cannot find the airport you have specified for your flight departure.Please click on the 'flying to' button or 'flying from' button and choose from our list of airports.</b>");
		 break;

		case 'com' :
		 if(message ==1 )
		   addHTML(rCell,"<b>We cannot find the airport you have specified for your flight departure.Please click on the 'flying to' button and choose from our list of airports.</b>");
		 else if (message ==2)
		 	 addHTML(rCell,"<b>We cannot find the airport you have specified for your flight departure.Please click on the 'flying from' button and choose from our list of airports.</b>");
		 else if (message ==3)
		 	 addHTML(rCell,"<b>We cannot find the airport you have specified for your flight departure.Please click on the 'flying to' button or 'flying from' button and choose from our list of airports.</b>");
		 break;

		case 'fr' :
		 if(message ==1 )
		   addHTML(rCell,"<b>L'entrée ne correspond à aucun aéroport de destination. Veuillez vérifier l'orthographe de votre entrée ou bien choisir un aéroport en cliquant sur le mot 'VERS', à gauche du champ de recherche. </b>");
		 else if (message ==2)
		 	 addHTML(rCell,"<b>L'entrée ne correspond à aucun aéroport de départ. Veuillez vérifier l'orthographe de votre entrée ou bien choisir un aéroport en cliquant sur le mot 'DE', à gauche du champ de recherche.</b>");
		 else if (message ==3)
		 	 addHTML(rCell,"<b>L'entrée ne correspond à aucun aéroport de départ ou de destination. Veuillez vérifier l'orthographe de votre entrée ou bien choisir un aéroport en cliquant sur le mot 'VERS' ou bien 'DE', à gauche du champ de recherche.</b>");
		 break;

		case 'it' :
		 if(message ==1 )
		   addHTML(rCell,"<b>I dati non corrispondono ad alcun aeroporto di arrivo. Controllate che non ci siano errori di battitura oppure scegliete un aeroporto cliccando sul tasto 'PER' a sinistra a fianco del campo vuoto. </b>");
		 else if (message ==2)
		 	 addHTML(rCell,"<b>I dati inseriti non corrispondono ad alcun aeroporto di partenza. Controllate che non ci siano errori di battitura oppure scegliete un aeroporto cliccando sul tasto 'DA' a sinistra a fianco del campo vuoto. </b>");
		 else if (message ==3)
		 	 addHTML(rCell,"<b>I dati inseriti non corrispondono ad alcun aeroporto di partenza o di arrivo. Controllate che non ci siano errori di battitura oppure scegliete un aeroporto cliccando sui tasti 'PER' oppure 'DA' a sinistra a fianco del campo vuoto. </b>");
		 break;

		case 'es' :
		 if(message ==1 )
		   addHTML(rCell,"<b>La entrada no corresponde a ningún aeropuerto de llegada. Compruebe por favor su entrada o elija otro aeropuerto haciendo clic en la palabra HACIA junto a la casilla de entrada.</b>");
		 else if (message ==2)
		 	 addHTML(rCell,"<b>La entrada no corresponde a ningún aeropuerto de salida. Compruebe por favor su entrada o elija otro aeropuerto haciendo clic en la palabra DESDE junto a la casilla de entrada. </b>");
		 else if (message ==3)
		 	 addHTML(rCell,"<b>La entrada no corresponde a ningún aeropuerto de salida y llegada. Compruebe por favor su entrada  o elija otro aeropuerto haciendo clic en la palabra HACIA o DESDE junto a la casilla de entrada. </b>");
		 break;

		}
		rRow.appendChild(rCell);
		rTable.replaceChild(rRow,getElementByIdAll("table_header"));
		rRow=getElementByIdAll("table_header_");
		rTable.removeChild(rRow);
		searchDone( lang );
	}

    function searchDone( lang ){

	  var Monat_en = new Array("January", "February", "March", "April", "May", "June","July", "August", "September", "Oktober", "November", "December");
	  var now = new Date();
	  d = now.getDate();
	  m = now.getMonth();
	  y = now.getYear();
	  var year = (y < 1000) ? y + 1900 : y;
	  min = now.getMinutes();
	  h= now.getHours();

	  var minute = (min < 10) ? "0" + min : min;
	  document.getElementById("shop_status").innerHTML='';

	  toRemove=document.getElementById("stoping_pic_1");
	  toRemove.style.visibility = 'hidden';
	  toRemove.width=0;
	  toRemove.height=0;

	  Final_text=document.getElementById("erstellt_date");
	  Monat_en[m]=Monat_en[m].toUpperCase();
	  Final_text.innerHTML = "CREATED ON " +d+" "+ Monat_en[m]+ " "+year+" "+h+ ":" +minute;

	}

	function addSearch(name,link)
	{
		document.getElementById("searchstatus").innerHTML+='<div id="'+name+'"><table cellpading=0 cellspacing=0 width=100%><tr><td width=100>&nbsp;<a href="'+link+'" class="topshop" target="_blank">'+name+'</a></td><td width=50 align=right><img src="http://reise.idealo.de/pics/sucht_ani.gif"></td><td align=right><font style="color:#465d73">0</td></tr><tr><td height="1"></td><td height="1"></td><td height="1"></td></tr></table></div>';
		mem_crawlers[crawlers]=name;
		mem_links[crawlers]=link;
		mem_values[crawlers]=0;
		crawlers++;
	}

	function updateSearch(name,link,value)
	{
		for (i=0; i<crawlers;i++ )
		{
			if (mem_crawlers[i]==name)
			{
				mem_values[i]=Math.floor(value)+1;
			}
		}
	}

	function stopSearch(name,link,value)
	{
		getElementByIdAll(name).innerHTML='<table cellpading=0 cellspacing=0 width=100%><tr><td width=100>&nbsp;<a href="'+link+'" class="topshop" target="_blank">'+name+'</a></td><td align=right><font style="color:#465d73">'+value+'</td></tr></table>';
	}

	function addTotal()
	{
		if (total_add==0)
		{
			document.getElementById("totalstatus").innerHTML+='<table cellpading=0 cellspacing=0 width=100%><tr height=10><td><font style="color:#465d73">&nbsp;<b>Angebote gesamt</td></td><td align=right><div id="total"><font style="color:#465d73"><b>'+results+'</div></td></tr></table>';
			total_add=1;
		}
		else
		{
			getElementByIdAll("total").innerHTML='<font style="color:#465d73"><b>'+results;
		}

	}

	function addShop(name,link)
	{
		document.getElementById("topshops").innerHTML+='<span><table cellpading=0 cellspacing=0 width=100%><tr><td>&nbsp;<a href="'+link+'" target="_blank" class="topshop">'+name+'</a></td></tr></table>';
		shop_count++;
		if (shop_count==5)
		{
			document.getElementById("allshops").innerHTML+='<tr><td align=right>&nbsp;<a href="../flights/partners.php" class="topshop">...mehr Shops</a></td></tr>';
		}
	}

	function set_real_limit(limit)
	{
		setlimit(limit);
		changePage(0);
	}

	function set_real_limit_new(limit,lang)
	{
		setlimit(limit);
		changePage(0);
		set_html_for_limit(limit,lang);

	}
function set_html_for_limit(limit,lang){


if (lang== 'de'){

		switch (limit){
		 case 15 :
		   document.getElementById("lim_sort").innerHTML= '<span class="orange">ERGEBNISSE/SEITE:</span><font class="linkblau" style="text-transform: uppercase;">15</font><span style="font-weight: normal;">|</span><a href="#" rel="nofollow" onclick = "set_real_limit_new(30,\'de\')">30</a><span style="font-weight: normal;">|</span><a href="#" rel="nofollow" onclick = "set_real_limit_new(100,\'de\')">100</a>&nbsp; &nbsp; &nbsp;</nobr>';
		   break;
		 case 30:

		   document.getElementById("lim_sort").innerHTML= '<span class="orange">ERGEBNISSE/SEITE:</span><a href="#" rel="nofollow" onclick = "set_real_limit_new(15,\'de\')">15</a><span style="font-weight: normal;">|</span><font class="linkblau" style="text-transform: uppercase;">30</font><span style="font-weight: normal;">|</span><a href="#" rel="nofollow" onclick = "set_real_limit_new(100,\'de\')">100</a>&nbsp; &nbsp; &nbsp;</nobr>';
		   break;
		 case 100 :
		   document.getElementById("lim_sort").innerHTML= '<span class="orange">ERGEBNISSE/SEITE:</span><a href="#" rel="nofollow" onclick = "set_real_limit_new(15,\'de\')">15</a> <span style="font-weight: normal;">|</span><a href="#" rel="nofollow" onclick = "set_real_limit_new(30,\'de\')">30</a><span style="font-weight: normal;">|</span><font class="linkblau" style="text-transform: uppercase;">100</font>&nbsp; &nbsp; &nbsp;</nobr>';
	     break;
      }
      }
else if (lang== 'uk'){

		switch (limit){
		 case 15 :
		   document.getElementById("lim_sort").innerHTML= '<span class="orange"> Results/Page:</span><font class="linkblau" style="text-transform: uppercase;">15</font><span style="font-weight: normal;">|</span><a href="#" rel="nofollow" onclick = "set_real_limit_new(30,\'uk\')">30</a><span style="font-weight: normal;">|</span><a href="#" rel="nofollow" onclick = "set_real_limit_new(100,\'uk\')">100</a>&nbsp; &nbsp; &nbsp;</nobr>';
		   break;
		 case 30:

		   document.getElementById("lim_sort").innerHTML= '<span class="orange">Results/Page:</span><a href="#" rel="nofollow" onclick = "set_real_limit_new(15,\'uk\')">15</a><span style="font-weight: normal;">|</span><font class="linkblau" style="text-transform: uppercase;">30</font><span style="font-weight: normal;">|</span><a href="#" rel="nofollow" onclick = "set_real_limit_new(100,\'uk\')">100</a>&nbsp; &nbsp; &nbsp;</nobr>';
		   break;
		 case 100 :
		   document.getElementById("lim_sort").innerHTML= '<span class="orange">Results/Page:</span><a href="#" rel="nofollow" onclick = "set_real_limit_new(15,\'uk\')">15</a> <span style="font-weight: normal;">|</span><a href="#" rel="nofollow" onclick = "set_real_limit_new(30,\'uk\')">30</a><span style="font-weight: normal;">|</span><font class="linkblau" style="text-transform: uppercase;">100</font>&nbsp; &nbsp; &nbsp;</nobr>';
	     break;
     }
     }
else if (lang== 'com'){

		switch (limit){
		 case 15 :
		   document.getElementById("lim_sort").innerHTML= '<span class="orange">Results/Page:</span><font class="linkblau" style="text-transform: uppercase;">15</font><span style="font-weight: normal;">|</span><a href="#" rel="nofollow" onclick = "set_real_limit_new(30,\'com\')">30</a><span style="font-weight: normal;">|</span><a href="#" rel="nofollow" onclick = "set_real_limit_new(100,\'com\')">100</a>&nbsp; &nbsp; &nbsp;</nobr>';
		   break;
		 case 30:

		   document.getElementById("lim_sort").innerHTML= '<span class="orange">Results/Page:</span><a href="#" rel="nofollow" onclick = "set_real_limit_new(15,\'com\')">15</a><span style="font-weight: normal;">|</span><font class="linkblau" style="text-transform: uppercase;">30</font><span style="font-weight: normal;">|</span><a href="#" rel="nofollow" onclick = "set_real_limit_new(100,\'com\')">100</a>&nbsp; &nbsp; &nbsp;</nobr>';
		   break;
		 case 100 :
		   document.getElementById("lim_sort").innerHTML= '<span class="orange">Results/Page:</span><a href="#" rel="nofollow" onclick = "set_real_limit_new(15,\'com\')">15</a> <span style="font-weight: normal;">|</span><a href="#" rel="nofollow" onclick = "set_real_limit_new(30,\'com\')">30</a><span style="font-weight: normal;">|</span><font class="linkblau" style="text-transform: uppercase;">100</font>&nbsp; &nbsp; &nbsp;</nobr>';
	     break;
      }
     }
else if (lang== 'fr'){

		switch (limit){
		 case 15 :
		   document.getElementById("lim_sort").innerHTML= '<span class="orange">Résultats trouvés/page:</span><font class="linkblau" style="text-transform: uppercase;">15</font><span style="font-weight: normal;">|</span><a href="#" rel="nofollow" onclick = "set_real_limit_new(30,\'fr\')">30</a><span style="font-weight: normal;">|</span><a href="#" rel="nofollow" onclick = "set_real_limit_new(100,\'fr\')">100</a>&nbsp; &nbsp; &nbsp;</nobr>';
		   break;
		 case 30:

		   document.getElementById("lim_sort").innerHTML= '<span class="orange">Résultats trouvés/page:</span><a href="#" rel="nofollow" onclick = "set_real_limit_new(15,\'fr\')">15</a><span style="font-weight: normal;">|</span><font class="linkblau" style="text-transform: uppercase;">30</font><span style="font-weight: normal;">|</span><a href="#" rel="nofollow" onclick = "set_real_limit_new(100,\'fr\')">100</a>&nbsp; &nbsp; &nbsp;</nobr>';
		   break;
		 case 100 :
		   document.getElementById("lim_sort").innerHTML= '<span class="orange">Résultats trouvés/page:</span><a href="#" rel="nofollow" onclick = "set_real_limit_new(15,\'fr\')">15</a> <span style="font-weight: normal;">|</span><a href="#" rel="nofollow" onclick = "set_real_limit_new(30,\'fr\')">30</a><span style="font-weight: normal;">|</span><font class="linkblau" style="text-transform: uppercase;">100</font>&nbsp; &nbsp; &nbsp;</nobr>';
	     break;
     }
    }
else if (lang== 'it'){

		switch (limit){
		 case 15 :
		   document.getElementById("lim_sort").innerHTML= '<span class="orange">Risultati trovati/Pagina:</span><font class="linkblau" style="text-transform: uppercase;">15</font><span style="font-weight: normal;">|</span><a href="#" rel="nofollow" onclick = "set_real_limit_new(30,\'it\')">30</a><span style="font-weight: normal;">|</span><a href="#" rel="nofollow" onclick = "set_real_limit_new(100,\'it\')">100</a>&nbsp; &nbsp; &nbsp;</nobr>';
		   break;
		 case 30:

		   document.getElementById("lim_sort").innerHTML= '<span class="orange">Risultati trovati/Pagina:</span><a href="#" rel="nofollow" onclick = "set_real_limit_new(15,\'it\')">15</a><span style="font-weight: normal;">|</span><font class="linkblau" style="text-transform: uppercase;">30</font><span style="font-weight: normal;">|</span><a href="#" rel="nofollow" onclick = "set_real_limit_new(100,\'it\')">100</a>&nbsp; &nbsp; &nbsp;</nobr>';
		   break;
		 case 100 :
		   document.getElementById("lim_sort").innerHTML= '<span class="orange">Risultati trovati/Pagina:</span><a href="#" rel="nofollow" onclick = "set_real_limit_new(15,\'it\')">15</a> <span style="font-weight: normal;">|</span><a href="#" rel="nofollow" onclick = "set_real_limit_new(30,\'it\')">30</a><span style="font-weight: normal;">|</span><font class="linkblau" style="text-transform: uppercase;">100</font>&nbsp; &nbsp; &nbsp;</nobr>';
	     break;
     }
}
else if (lang== 'es'){

		switch (limit){
		 case 15 :
		   document.getElementById("lim_sort").innerHTML= '<span class="orange">Resultados encontrados/Página:</span><font class="linkblau" style="text-transform: uppercase;">15</font><span style="font-weight: normal;">|</span><a href="#" rel="nofollow" onclick = "set_real_limit_new(30,\'es\')">30</a><span style="font-weight: normal;">|</span><a href="#" rel="nofollow" onclick = "set_real_limit_new(100,\'it\')">100</a>&nbsp; &nbsp; &nbsp;</nobr>';
		   break;
		 case 30:

		   document.getElementById("lim_sort").innerHTML= '<span class="orange">Resultados encontrados/Página:</span><a href="#" rel="nofollow" onclick = "set_real_limit_new(15,\'it\')">15</a><span style="font-weight: normal;">|</span><font class="linkblau" style="text-transform: uppercase;">30</font><span style="font-weight: normal;">|</span><a href="#" rel="nofollow" onclick = "set_real_limit_new(100,\'it\')">100</a>&nbsp; &nbsp; &nbsp;</nobr>';
		   break;
		 case 100 :
		   document.getElementById("lim_sort").innerHTML= '<span class="orange">Resultados encontrados/Página:</span><a href="#" rel="nofollow" onclick = "set_real_limit_new(15,\'it\')">15</a> <span style="font-weight: normal;">|</span><a href="#" rel="nofollow" onclick = "set_real_limit_new(30,\'it\')">30</a><span style="font-weight: normal;">|</span><font class="linkblau" style="text-transform: uppercase;">100</font>&nbsp; &nbsp; &nbsp;</nobr>';
	     break;
	  }
	 }
else if (lang== 'nl'){

		switch (limit){
		 case 15 :
		   document.getElementById("lim_sort").innerHTML= '<span class="orange">Results/Page:</span><font class="linkblau" style="text-transform: uppercase;">15</font><span style="font-weight: normal;">|</span><a href="#" rel="nofollow" onclick = "set_real_limit_new(30,\'com\')">30</a><span style="font-weight: normal;">|</span><a href="#" rel="nofollow" onclick = "set_real_limit_new(100,\'com\')">100</a>&nbsp; &nbsp; &nbsp;</nobr>';
		   break;
		 case 30:

		   document.getElementById("lim_sort").innerHTML= '<span class="orange">Results/Page:</span><a href="#" rel="nofollow" onclick = "set_real_limit_new(15,\'com\')">15</a><span style="font-weight: normal;">|</span><font class="linkblau" style="text-transform: uppercase;">30</font><span style="font-weight: normal;">|</span><a href="#" rel="nofollow" onclick = "set_real_limit_new(100,\'com\')">100</a>&nbsp; &nbsp; &nbsp;</nobr>';
		   break;
		 case 100 :
		   document.getElementById("lim_sort").innerHTML= '<span class="orange">Results/Page:</span><a href="#" rel="nofollow" onclick = "set_real_limit_new(15,\'com\')">15</a> <span style="font-weight: normal;">|</span><a href="#" rel="nofollow" onclick = "set_real_limit_new(30,\'com\')">30</a><span style="font-weight: normal;">|</span><font class="linkblau" style="text-transform: uppercase;">100</font>&nbsp; &nbsp; &nbsp;</nobr>';
	     break;
      }
     }
	}

	function stopAll( lang )
	{
    if (window.stop)
        window.stop();
    else if (window.document && window.document.execCommand)
        window.document.execCommand('Stop');

		searchDone( lang );
	}

//=======================================================


function set_daten_nach_pruefung_in_maske(from,to,go_day,go_month,go_year,ret_day,ret_month,ret_year,flight_hours_from,flight_hours_to)
{


		if(to)
		document.forms["searchForm"].to.value = to;

		if(go_day)
		document.forms["searchForm"].go_day.value= go_day;
	  if(go_month)
		document.forms["searchForm"].go_month.value= go_month.toString()+ go_year.toString();
		//if(go_year)
	//	document.forms["searchForm"].go_year.value=go_year;
		if(ret_day)
		document.forms["searchForm"].ret_day.value=ret_day;

		if(ret_month)
		document.forms["searchForm"].ret_month.value= ret_month.toString()+ret_year.toString();;
	//	if(ret_year)
	//	document.forms["searchForm"].ret_year.value=ret_year;
		if(flight_hours_from)
		document.forms["searchForm"].flight_hours_from.value= flight_hours_from;
		if(flight_hours_to)
		document.forms["searchForm"].flight_hours_to.value=flight_hours_to;

		if(from)
		document.forms["searchForm"].from.value = from;


}

var filter_arr =new Array();
var result_array_fr =new Array();
var count_result_fr;
var fl_filter = 0 ;
var mem_cout_fr;
var mem_save =new Array();
var old_shop;
var all_shops=new Array();

function filter_time (formname){

        if(result_array_fr.length == 0 && result_array.length == 0 )
             return -1;

                  if( fl_filter==1 ){
				  result_array=mem_save;
				  count_result=result_array.length;
				  }
				 else
				  mem_save =  result_array;

                var j = 0 ;
                var f_h_t = document.forms[formname].flight_hours_to.value;
                var f_h_f = document.forms[formname].flight_hours_from.value;
                count_res = count_result;

                result_array_fr.length = 0;


 				for (i=0;i< count_res ;i++ )
				{
					 h_gd = 1*result_array[i]['zeit'].substring(0,2);
					 h_rd = 1*result_array[i]['zeit'].substring(16,18);

                     fl_kom = f_h_f+"-"+f_h_t;

                     switch ( fl_kom )

                     {
              ////////////////////   0  //////////////////////////////
                        case '0-0' :

					       result_array_fr[j] = result_array[i] ;
					       j++;

					         break;
                        case '0-1' :
                          if ( (h_rd < 9) && (h_rd > 0) ){
					       result_array_fr[j] = result_array[i] ;
					       j++;
					        }
					         break;
                        case '0-2' :
                          if ( (h_rd < 12) && (h_rd > 9) ){
					       result_array_fr[j] = result_array[i] ;
					       j++;
					        }
					         break;
                        case '0-3' :
                          if ( (h_rd < 18) && (h_rd > 12) ){
					       result_array_fr[j] = result_array[i] ;
					       j++;
					        }
					         break;

                        case '0-4' :
                          if ( (h_rd < 24) && (h_rd > 18) ){
					       result_array_fr[j] = result_array[i] ;
					       j++;
					        }
					         break;
	////////////////////   1 //////////////////////////////
                        case '1-0' :

                          if ( (h_gd < 9) && (h_gd > 0) ){
                          // alert(h_rd);
					       result_array_fr[j] = result_array[i] ;
					       j++;
					        }
					         break;
                        case '1-1' :
                          if ( (h_gd < 9) && (h_gd > 0) && (h_rd < 9) && (h_rd > 0) ){
					       result_array_fr[j] = result_array[i] ;
					       j++;
					        }
					         break;
                        case '1-2' :
                          if ( (h_gd < 9) && (h_gd > 0) && (h_rd < 12) && (h_rd > 9) ){
					       result_array_fr[j] = result_array[i] ;
					       j++;
					        }
					         break;
                        case '1-3' :
                          if ( (h_gd < 9) && (h_gd > 0) && (h_rd < 18) && (h_rd > 12) ){
					       result_array_fr[j] = result_array[i] ;
					       j++;
					        }
					         break;
                        case '1-4' :
                          if ( (h_gd < 9) && (h_gd > 0) && (h_rd < 24) && (h_rd > 18) ){
					       result_array_fr[j] = result_array[i] ;
					       j++;
					        }
					         break;
	 ////////////////////   2    //////////////////////////////
                        case '2-0' :
                          if ( (h_gd < 12) && (h_gd > 9) ){
					       result_array_fr[j] = result_array[i] ;
					       j++;
					        }
					         break;
                        case '2-1' :
                          if ( (h_gd < 12) && (h_gd > 9) && (h_rd < 9) && (h_rd > 0) ){
					       result_array_fr[j] = result_array[i] ;
					       j++;
					        }
					         break;
                        case '2-2' :
                          if ( (h_gd < 12) && (h_gd > 9) && (h_rd < 12) && (h_rd > 9) ){
					       result_array_fr[j] = result_array[i] ;
					       j++;
					        }
					         break;
                        case '2-3' :
                          if ( (h_gd < 12) && (h_gd > 9) && (h_rd < 18) && (h_rd > 12) ){
					       result_array_fr[j] = result_array[i] ;
					       j++;
					        }
					         break;
                        case '2-4' :
                          if ( (h_gd < 12) && (h_gd > 9) && (h_rd < 24) && (h_rd > 18) ){
					       result_array_fr[j] = result_array[i] ;
					       j++;
					        }
					         break;
////////////////////   3    //////////////////////////////
                        case '3-0' :
                          if ( (h_gd < 18) && (h_gd > 12) ){
					       result_array_fr[j] = result_array[i] ;
					       j++;
					        }
					         break;
                        case '3-1' :
                          if ( (h_gd < 18) && (h_gd > 12) && (h_rd < 9) && (h_rd > 0) ){
					       result_array_fr[j] = result_array[i] ;
					       j++;
					        }
					         break;
                        case '3-2' :
                          if ( (h_gd < 18) && (h_gd > 12) && (h_rd < 12) && (h_rd > 9) ){
					       result_array_fr[j] = result_array[i] ;
					       j++;
					        }
					         break;
                        case '3-3' :
                          if ( (h_gd < 18) && (h_gd > 12) && (h_rd < 18) && (h_rd > 12) ){
					       result_array_fr[j] = result_array[i] ;
					       j++;
					        }
					         break;
                        case '3-4' :
                          if ( (h_gd < 18) && (h_gd > 12) && (h_rd < 24) && (h_rd > 18) ){
					       result_array_fr[j] = result_array[i] ;
					       j++;
					        }
					         break;
		////////////////////   4    //////////////////////////////
                        case '4-0' :
                          if ( (h_gd < 24) && (h_gd > 18 ) ){
					       result_array_fr[j] = result_array[i] ;
					       j++;
					        }
					         break;
                        case '4-1' :
                          if ( (h_gd < 24) && (h_gd > 18) && (h_rd < 9) && (h_rd > 9) ){
					       result_array_fr[j] = result_array[i] ;
					       j++;
					        }
					         break;
                        case '4-2' :
                          if ( (h_gd < 24) && (h_gd > 18) && (h_rd < 12) && (h_rd > 9) ){
					       result_array_fr[j] = result_array[i] ;
					       j++;
					        }
					         break;
                        case '4-3' :
                          if ( (h_gd < 24) && (h_gd > 18) && (h_rd < 18) && (h_rd > 12) ){
					       result_array_fr[j] = result_array[i] ;
					       j++;
					        }
					         break;
                        case '4-4' :
                          if ( (h_gd < 24) && (h_gd > 18) && (h_rd < 24) && (h_rd > 18) ){
					       result_array_fr[j] = result_array[i] ;
					       j++;
					        }
					         break;
/////////////////////////////////////////////////////////////////////////////////////
					    default :
					        break;

                     }

			    }



		rTable=getElementByIdAll("results_table");



		if(fl_filter==1){

				for (i=2;i<=tip*mem_cout_fr+1;i++)
					{

					  rTable.removeChild(document.getElementById("tbl").rows[2]);

					}
		}
		else{

				for (i=2;i<=tip*count_result+1;i++)
				{

				  rTable.removeChild(document.getElementById("tbl").rows[2]);

				}
        }

        fl_filter = 1;
        if(ie) {
          document.getElementById('tr_for_shops').innerHTML='';
         /*
         row_sh = document.getElementById("tb_show_shops").rows[0];
         ln = row_sh.getElementsByTagName("td").length
         var tds = row_sh.getElementsByTagName("td");
           for( k=ln-1; k >= 0  ; k-- ){

           row_sh.removeChild( tds[k] );

           }
           */
         }else
          document.getElementById('tr_for_shops').innerHTML='';

         all_shops.length=0 ;
         old_shop="";

 		for (i=0; i< result_array_fr.length ;i++ )
		{
			addRows_filter(i);
		}

//

//



  count_res = result_array_fr.length;
  count_result = count_res ;
//  result_array =  result_array_fr;
//  mem_cout_fr = result_array.length ;

  mem_cout_fr = result_array_fr.length ;
  result_array =  mem_save;

  changePage(crtpage, language );


}

function addRows_filter(k)
        {

          // if (k==100)
			// alert ("in funk 100");

                var newRow=new Array();
                var newCell=new Array();
                tmp_arr=new Array();
                newRow[0]=document.getElementById('tbl').tBodies[0].insertRow(-1);



                if ( k % 2 != 0)
                   newRow[0].className="highlight1";
                else
                	newRow[0].className="highlight2";

                var i;
                for(i=0; i<8; i++)
                {
                        newCell[i] = newRow[0].insertCell(i);


                }

 				var  val=new Array();



		        go_d_time = result_array_fr[k]['zeit'].substring(0,5);
				go_a_time = result_array_fr[k]['zeit'].substring(10,15);
				ret_d_time = result_array_fr[k]['zeit'].substring(16,21);
				ret_a_time = result_array_fr[k]['zeit'].substring(25,30);

				go_d_hour    = result_array_fr[k]['zeit'].substring(0,2);
				go_d_minute  = result_array_fr[k]['zeit'].substring(3,5);
				go_a_hour    = result_array_fr[k]['zeit'].substring(10,12);
				go_a_minute  = result_array_fr[k]['zeit'].substring(13,15);

				ret_d_hour   = result_array_fr[k]['zeit'].substring(16,17);
				ret_d_minute = result_array_fr[k]['zeit'].substring(19,21);
				ret_a_hour   = result_array_fr[k]['zeit'].substring(25,27);
				ret_a_minute = result_array_fr[k]['zeit'].substring(29,31);

		             sort_go_d="<A href=\"#\" onclick=\"sort_hour('go_d','"+go_d_hour+"','"+go_d_minute+"')\">"+go_d_time+"</A>";
					 sort_go_a="<A href=\"#\" onclick=\"sort_hour('go_a','"+go_a_hour+"','"+go_a_minute+"')\">"+go_a_time+"</A>";
                     sort_ret_d="<A href=\"#\" onclick=\"sort_hour('ret_d','"+ret_d_hour+"','"+ret_d_minute+"')\">"+ret_d_time+"</A>";
			         sort_ret_a="<A href=\"#\" onclick=\"sort_hour('ret_a','"+ret_a_hour+"','"+ret_a_minute+"')\">"+ret_a_time+"</A>";

                val[0]=sort_go_d+"<br>"+sort_go_a;
                val[1]=sort_ret_d+"<br>"+sort_ret_a;
                newCell[1].innerHTML=createTable(val);


                ///////  flight time  ///////

 //               tmp_arr['flugzeit'] =go_trip_time+"#"+ret_trip_time;

                tm  = result_array_fr[k]['flugzeit_for_fr'].split("#");
                go_trip_time = tm[0];
                ret_trip_time = tm[1];
                val[0]=go_trip_time;
                val[1]=ret_trip_time;
                newCell[2].innerHTML=createTable(val);
 //               tmp_arr['flugzeit'] = result_array_fr[k]['flugzeit'];

                ///////  details ///////

                newCell[4].innerHTML= result_array_fr[k]['for_fr_details'].innerHTML;

                ///////  stops ///////

                tm  = result_array_fr[k]['stops'].split("#");
                go_stops = tm[0];
                ret_stops = tm[1];
                val[0]=go_stops;
                val[1]=ret_stops;
                newCell[3].innerHTML=createTable(val);
                tmp_arr['stops'] =go_stops+"#"+ret_stops;

               ///////  flights ///////

                tm  = result_array_fr[k]['flughafen'].split("#");
                val[0]=tm[0];
                val[1]=tm[1];
                newCell[0].innerHTML=createTable(val);


               ///////  shop - book ///////

              newCell[6].innerHTML= result_array_fr[k]['for_fr_shop'].innerHTML;

              ///////  price ///////

                total_price = result_array_fr[k]['price'];

                	  switch(language)
										  {
										  case "de" :
												newCell[5].innerHTML='<b>'+total_price+' EUR</b>';
												var picture="http://reise.idealo.de/pics/buchen.gif";
												break;

											case "uk" :
											  newCell[5].innerHTML='<b>£ '+total_price+'</b>';
											  var picture="http://reise.idealo.de/pics/buchen.uk.gif";
												break;

											case "fr" :
											  newCell[5].innerHTML='<b> '+total_price+' EUR</b>';
											  var picture="http://reise.idealo.de/pics/buchen.fr.gif";
												break;
										  }


                tmp_arr['price'] = Number(total_price);


             //   var shop_picture;


                result_array_fr[count_result_fr]=tmp_arr;

                order[count_result_fr]=count_result_fr;

                count_resul_fr=count_result_fr+1;

                ////////////// shop pictures /////////////////////////////


                if(old_shop!=result_array_fr[k]['shop'])
                       {

                             if(!in_array(result_array_fr[k]['shop'],all_shops)){
                              all_shops[k]= result_array_fr[k]['shop'] ;
                             _addShop_table_1( result_array_fr[k]['shop'] );
                             old_shop=result_array_fr[k]['shop'];
                             }
                        }
                _addItem( result_array_fr[k]['shop'] );



    }

function in_array(item,arr) {
for(p=0;p<arr.length;p++) if (item == arr[p]) return true;
return false;
}

 function hhn( lang ) {

  	var text="";

    switch(lang)
    {
    case  "de" :
  	text+="<b>Bitte kontrollieren Sie während des Buchens noch einmal Ihre Angaben um sicherzustellen, dass Sie von/nach Hahn (HHN) oder Frankfurt Airport (FRA) fliegen.</b>";
  	replaceHTML(getElementByIdAll("hhn"),text);
	  	break;
	case  "uk" :
  	text+="<b>Please make sure to provide the correct data when booking, to ensure your flight from/to Hahn (HNN) or Frankfurt Airport (FRA).</b>";
  	replaceHTML(getElementByIdAll("hhn"),text);
	  	break;
	case  "fr" :
  	text+="<b>Merci de bien vouloir contrôler encore une fois les informations données avant de poursuivre la réservation, afin que nous sachions si vous souhaitez un vol au départ de Hahn (HHN) ou de Frankfurt Airport (FRA).</b>";
  	replaceHTML(getElementByIdAll("hhn"),text);
	  	break;
	case  "it" :
  	text+="<b>Per favore controllate nuovamente i dati inseriti in fase di ricerca per sincerarvi che il volo scelto sia da/a Hahn (HHN) o Francoforte (FRA).</b>";
  	replaceHTML(getElementByIdAll("hhn"),text);
	  	break;
	case  "es" :
  	text+="<b>Por favor, asegúrese de poner correctamente sus datos mientras realiza la reserva, que usted vuela desde/hacia Hahn (HHN) o Frankfurt Airport (FRA)</b>";
  	replaceHTML(getElementByIdAll("hhn"),text);
	  	break;
	case  "nl" :
  	text+="<b>Please make sure to provide the correct data when booking, to ensure your flight from/to Hahn (HNN) or Frankfurt Airport (FRA).</b>";
  	replaceHTML(getElementByIdAll("hhn"),text);
	  	break;	  	
   
    default:
       break;
	}
 }
