var xmlHttp
var classs;
function Offer(ww,destto,num)
{
	    classs=ww;
        xmlHttp=GetXmlHttpObject();
        if (xmlHttp==null)
          {
          alert ("Your browser does not support AJAX!");
          return;
          } 
		  var url;
		  try
		  {
			  if (num=="1"){url="../flightOffer1.aspx";}
			  else{url="flightOffer1.aspx";}
		  }catch(e){url="flightOffer1.aspx";}
        
	    url=url+"?class="+ww+"&destto="+destto;
        xmlHttp.onreadystatechange=stateServer1;
        xmlHttp.open("GET",url,true);
        xmlHttp.send(null);
}

function stateServer1() 
{ 
	if(xmlHttp.readyState == 4)
	{
		if(xmlHttp.status == 200)
		{
	 
		document.getElementById("result").innerHTML=xmlHttp.responseText;
		 var GB_ANIMATION = true;
		 $(document).ready(function(){
        $("a.greybox").click(function(){
           GB_show(this.id,this.href,300,550);
          return false;
        });
      });
		//WriteData1(xmlHttp.responseText);
		}
		else
		{
			alert("There was a problem retrieving data from the server." );
		}
	}
}

function WriteData1(countryNode)
{ 
var rs;
var str="";
var linkimg="";
var rss=countryNode.split("^|");
if(rss.length-1>0)
	{
	str="<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">";
	str=str + "<tr><td colspan=6>&nbsp;</td></tr>"
	str=str + "<tr class=\"SideOrange\"><td style='border-bottom:1px solid #cccccc; padding-bottom:5px;'>Dest From</td><td style='border-bottom:1px solid #cccccc; padding-bottom:5px;'>Flight Type</td><td style='border-bottom:1px solid #cccccc; padding-bottom:5px;'>Airline</td><td style='border-bottom:1px solid #cccccc; padding-bottom:5px;'>Class Type</td><td style='border-bottom:1px solid #cccccc; padding-bottom:5px;'>Amount+Tax</td><td style='border-bottom:1px solid #cccccc; padding-bottom:5px;'>Travel Between</td><td style='border-bottom:1px solid #cccccc; padding-bottom:5px;'>&nbsp;</td></tr>"
	for(i=0;i<rss.length-1;i++)
		{
		
			var field;
			var j;
				field=rss[i].split("|");
				if(classs.toUpperCase()=="ECONOMY")
				{
				linkimg="<a href=\"transfer.aspx?DestFrom=" + field[1] +"&DestTo=" + field[3] + "&Airline=" + field[5] + "&AirlineName=" + field[4] + "&Price=" + field[7] + "&DestFromAirportName=" + field[0] + "&DestToAirportName=" + field[2] + "\"><img src=\"Pix/check_now.gif\" width=\"70\" height=\"18\" border=\"0\"></a>"; 
				
				}
				else
				{
					linkimg="<a href=\"booking.aspx?DestFrom=" + field[1] +"&DestTo=" + field[3] + "&Airline=" + field[5] + "&AirlineName=" + field[4] + "&Price=" + field[7] + "&DestFromAirportName=" + field[0] + "&DestToAirportName=" + field[2] + "\"><img src=\"Pix/check_now.gif\" width=\"70\" height=\"18\" border=\"0\"></a>"; 
				}
					
			
		if(i%2==0)
			{
				
			str=str + "<tr height=25 bgcolor=\"#ffffff\" class=text><td align=left style='border-bottom:1px solid #cccccc' >" + field[0]+"<img onMouseOver=\'dis(\""+field[8]+"\");\' onMouseOut=\"outMouse();\" src=\"Pix/blue.gif\"></td><td style='border-bottom:1px solid #cccccc'>" + field[9]+ "</td><td style='border-bottom:1px solid #cccccc'>" + "<img src='airlogo/"+ field[5]+".gif'/>"+"</td><td style='border-bottom:1px solid #cccccc'>" + field[6]+ "</td><td style='border-bottom:1px solid #cccccc'><strong class=sidered>&pound;" + field[7]  + "</strong></td><td style='border-bottom:1px solid #cccccc'>" + field[11]+ "</td><td style='border-bottom:1px solid #cccccc'><a href='#'><img name='" +field[0]+ "-" + field[5]+"' src=\"images/Book_now.gif\" border=\"0\" ></a></td></tr>"
			}
			else
			{
			str=str + "<tr height=25 class=text><td align=left style='border-bottom:1px solid #cccccc'>" + field[0]+"<img onMouseOver=\'dis(\""+field[8]+"\");\' onMouseOut=\"outMouse();\" src=\"Pix/white.gif\"></td><td style='border-bottom:1px solid #cccccc'>" + field[9]+ "</td><td style='border-bottom:1px solid #cccccc'>" + "<img src='airlogo/"+ field[5]+".gif'/>"+ "</td><td style='border-bottom:1px solid #cccccc'>" + field[6]+ "</td><td style='border-bottom:1px solid #cccccc'><strong class=sidered>&pound;" + field[7] +  "</strong></td><td style='border-bottom:1px solid #cccccc'>" + field[11]+ "</td><td style='border-bottom:1px solid #cccccc'><a href='#'><img name='" +field[0]+ "-" + field[5]+"' src=\"images/Book_now.gif\" border=\"0\"  ></a></td></tr>"
			}
		}
	str=str+"<tr><td colSpan=7>&nbsp;</td></tr>"
	str=str+"<tr><td colSpan=7 id=\"sheet\" class=usa>&nbsp;</td></tr>"
	str=str+"</table>";
	document.getElementById("result").innerHTML=str;
	}
	else
	{
		str="<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr><td colSpan=6>&nbsp;</td><tr><td colSpan=6>&nbsp;</td></tr><tr><td colspan=6 align=center class=bluebignew>There Is No Offer Found In " + classs + " Class</td></tr><tr><td colSpan=6>&nbsp;</td><tr><td colSpan=6>&nbsp;</td></tr></table>"
		document.getElementById("result").innerHTML=str;
	}
}


function Dest_ft(name)
{
	try
	{
    var ts=name.split("-");
    document.getElementById("val1").value=ts[0];
    document.getElementById("val2").value=ts[1];
	}
	catch(err){}
}


function GetXmlHttpObject()
{
var xmlHttp=null;
try
  {
  // Firefox, Opera 8.0+, Safari
  xmlHttp=new XMLHttpRequest();
  }
catch (e)
  {
  // Internet Explorer
  try
    {
    xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
    }
  catch (e)
    {
    xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
    }
  }
return xmlHttp;
}

//function changePicture(num)
//	{
//		
//		if(num==0)
//			{
//				document.getElementById("eco").setAttribute("src","../pix/eco1.gif"); 
//				document.getElementById("bus").setAttribute("src","../pix/bus.gif"); 
//				document.getElementById("fir").setAttribute("src","../pix/fir.gif"); 
//			}
//			if(num==1)
//			{
//				
//				document.getElementById("eco").setAttribute("src","../pix/eco.gif"); 
//				document.getElementById("bus").setAttribute("src","../pix/bus1.gif"); 
//				document.getElementById("fir").setAttribute("src","../pix/fir.gif"); 
//			}
//			if(num==2)
//			{
//				document.getElementById("eco").setAttribute("src","../pix/eco.gif"); 
//				document.getElementById("bus").setAttribute("src","../pix/bus.gif"); 
//				document.getElementById("fir").setAttribute("src","../pix/fir1.gif");//				
//		    }			
//	}



function changePictureoff(num,dcode)
	{
		
		if(num==0)
			{
				
				document.getElementById("eco").setAttribute("src","http://www.crystaltravel.co.uk/pix/eco1.gif"); 
				document.getElementById("bus").setAttribute("src","http://www.crystaltravel.co.uk/pix/bus.gif"); 
				document.getElementById("fir").setAttribute("src","http://www.crystaltravel.co.uk/pix/fir.gif"); 
				try
				{
				document.getElementById("pre").setAttribute("src","http://www.crystaltravel.co.uk/pix/peco.jpg");
				}
				catch(e)
				{}
			}
			if(num==1)
			{
				
				document.getElementById("eco").setAttribute("src","http://www.crystaltravel.co.uk/pix/eco.gif"); 
				document.getElementById("bus").setAttribute("src","http://www.crystaltravel.co.uk/pix/bus1.gif"); 
				document.getElementById("fir").setAttribute("src","http://www.crystaltravel.co.uk/pix/fir.gif"); 
				try
				{
	document.getElementById("pre").setAttribute("src","pix/http://www.crystaltravel.co.uk/peco.jpg");
	}
				catch(e)
				{}
			
			}
			if(num==2)
			{
				document.getElementById("eco").setAttribute("src","http://www.crystaltravel.co.uk/pix/eco.gif"); 
				document.getElementById("bus").setAttribute("src","http://www.crystaltravel.co.uk/pix/bus.gif"); 
				document.getElementById("fir").setAttribute("src","http://www.crystaltravel.co.uk/pix/fir1.gif");
				try
				{
            					document.getElementById("pre").setAttribute("src","http://www.crystaltravel.co.uk/pix/peco.jpg");
            					}
				catch(e)
				{}
			}
			if(num==3)
			{
				document.getElementById("eco").setAttribute("src","http://www.crystaltravel.co.uk/pix/eco.gif"); 
				document.getElementById("bus").setAttribute("src","http://www.crystaltravel.co.uk/pix/bus.gif"); 
				document.getElementById("fir").setAttribute("src","http://www.crystaltravel.co.uk/pix/fir.gif");
				try
				{
            			document.getElementById("pre").setAttribute("src","http://www.crystaltravel.co.uk/pix/peco1.jpg");	
            			}
				catch(e)
				{}	
			}
			
}		


function changePictureoffer(num,dcode)
	{		
		if(num==0)
			{
				document.getElementById("ecott").setAttribute("src","http://www.crystaltravel.co.uk/pix/eco1.gif"); 
				document.getElementById("bustt").setAttribute("src","http://www.crystaltravel.co.uk/pix/bus.gif"); 
				document.getElementById("firtt").setAttribute("src","http://www.crystaltravel.co.uk/pix/fir.gif"); 
			}
			if(num==1)
			{
				
				document.getElementById("ecott").setAttribute("src","http://www.crystaltravel.co.uk/pix/eco.gif"); 
				document.getElementById("bustt").setAttribute("src","http://www.crystaltravel.co.uk/pix/bus1.gif"); 
				document.getElementById("firtt").setAttribute("src","http://www.crystaltravel.co.uk/pix/fir.gif"); 
	
			
			}
			if(num==2)
			{
				document.getElementById("ecott").setAttribute("src","http://www.crystaltravel.co.uk/pix/eco.gif"); 
				document.getElementById("bustt").setAttribute("src","http://www.crystaltravel.co.uk/pix/bus.gif"); 
				document.getElementById("firtt").setAttribute("src","http://www.crystaltravel.co.uk/pix/fir1.gif");
            					
			}
			
}		
function dyoffers(dcode)
{
//        document.getElementById("result_EBF").style.display="none"
//        //document.getElementById("RatingRow").style.display="block"
//		var rating="0";
//		//rating=	document.getElementById("Rating").options[document.getElementById("Rating").selectedIndex].value;
//       // document.getElementById('result2').src="../destinations/topten.aspx?count=1&CityCode="+dcode+"&sorttype=Price&num=1&rating="+rating;
//        ////document.getElementById('result2').src="../topten.aspx?count=1&CityCode="+dcode+"&sorttype=Price&num=1";
//        document.getElementById("result_dy").style.display="block"   

try
{
        document.getElementById("result_EBF").style.display="none"
		var rating="0";
        document.getElementById('result2').src="destinations/topten.aspx?count=1&CityCode="+dcode+"&sorttype=Price&num=1";
        document.getElementById("result_dy").style.display="block"    
}
 catch(e){}
        
}

	
	
function dis(sheet)
{
document.getElementById("sheet").innerHTML=""
document.getElementById("sheet").innerHTML=sheet;
}
function outMouse()
{
document.getElementById("sheet").innerHTML=""
}
	
	
	
function Offerworld(destfrom,ww,destto,Airline)
{
document.getElementById("loadingpro").style.visibility='visible'
var arr = new Array();
var arroff = new Array();
arr = destfrom.split('(');
destfrom = arr[1].substring(0,3);
arroff = destto.split('(')
destto = arroff[1].substring(0,3);
        classs=ww;
        xmlHttp=GetXmlHttpObject();
        if (xmlHttp==null)
          {
          alert ("Your browser does not support AJAX!");
          return;
          } 
        var url="flightOffertt.aspx";
	    url=url+"?class="+ww+"&destto="+destto+"&destfrom="+destfrom+"&Airline="+Airline;
        xmlHttp.onreadystatechange=stateServer2;
        xmlHttp.open("GET",url,true);
        xmlHttp.send(null);
}

function stateServer2() 
{ 
	if(xmlHttp.readyState == 4)
	{
		if(xmlHttp.status == 200)
		{		
		document.getElementById("OfferLayer").innerHTML=xmlHttp.responseText;	
		document.getElementById("loadingpro").style.visibility='hidden'	
		//WriteData1(xmlHttp.responseText);
		}
		else
		{
			alert("There was a problem retrieving data from the server." );
		}
	}
}	



