function selectField(FieldValue,Field)
{

	var F;
	for(F=0;F<document.getElementById(Field.id).length;F++)
		{
		if(document.getElementById(Field.id).options[F].value==FieldValue.toUpperCase())
			{
			document.getElementById(Field.id).options[F].selected=true;
			break;
			}
		}
}
function searchEngineType(num)
{if(num=="FH")
		{
		document.getElementById("flthtl").style.display="block";
		document.getElementById("hotel").style.display="none";
		document.getElementById("flight").style.display="none";
		changePicture(0);
		FillDestFrom('FHDestTo','FHDestFrom')
		//createMonthoptions('FHDptMMYear');
		//addOption('FHDptDay','FHDptDate','FHDptMMYear',true);
		//createMonthoptions('FHRetMMYear');
		//addOption('FHRetDay','FHRetDate','FHRetMMYear',true);
		}
	if(num=="F")
		{
			
		document.getElementById("flthtl").style.display="none";
		document.getElementById("hotel").style.display="none";
		document.getElementById("flight").style.display="block";
		changePicture(1);
		FillDestFrom('FDestTo','FDestFrom');
		try{FillAirline("FDestTo","FAirline");}catch(e){}
		//createMonthoptions('FDptDateDDMMYY');
		//addOption('FDptDay','FDptDate','FDptDateDDMMYY',true);
		//createMonthoptions('FRetDateDDMMYY');
		//addOption('FRetDay','FRetDate','FRetDateDDMMYY',true);
		}
	if(num=="H")
		{
		document.getElementById("flthtl").style.display="none";
		document.getElementById("hotel").style.display="block";
		document.getElementById("flight").style.display="none";
		changePicture(2);
		//createMonthoptions('HDptMMYear');
		//addOption('HDptDay','HDptDate','HDptMMYear',true);
		//createMonthoptions('HRetMMYear');		
		//addOption('HRetDay','HRetDate','HRetMMYear',true);
		}
		
}

function changePicture(num)
	{
	if(num==0)
		{
			document.getElementById("flthtlbutton").setAttribute("src","http://www.cityvacations.co.uk/comimg/btn_holiday_sel.jpg"); 
			document.getElementById("fltbutton").setAttribute("src","http://www.cityvacations.co.uk/comimg/btn_flt.jpg"); 
			document.getElementById("htlbutton").setAttribute("src","http://www.cityvacations.co.uk/comimg/btn_htl.jpg");
			}
	if(num==1)
		{	
			document.getElementById("fltbutton").setAttribute("src","http://www.cityvacations.co.uk/comimg/btn_flt_sel.jpg"); 
			document.getElementById("flthtlbutton").setAttribute("src","http://www.cityvacations.co.uk/comimg/btn_holiday.jpg"); 
			document.getElementById("htlbutton").setAttribute("src","http://www.cityvacations.co.uk/comimg/btn_htl.jpg");}
	if(num==2)
		{	
			document.getElementById("htlbutton").setAttribute("src","http://www.cityvacations.co.uk/comimg/btn_htl_sel.jpg"); 
			document.getElementById("flthtlbutton").setAttribute("src","http://www.cityvacations.co.uk/comimg/btn_holiday.jpg"); 
			document.getElementById("fltbutton").setAttribute("src","http://www.cityvacations.co.uk/comimg/btn_flt.jpg"); 
			
		}			
	}	
	function hideSearchEngine()
	{
		
		
		if(document.getElementById("SearchEngineID").innerHTML=="")
		{
		document.getElementById("SearchEngineID").innerHTML=SearchEngine;
		selectField(selDestFrom,document.getElementById("FDestFrom"));
		selectField(selDestTo,document.getElementById("FDestTo"));
		document.getElementById("SerImg").setAttribute("src","../compic/pindown.jpg");
		}
		else
		{
		selDestFrom=document.getElementById("FDestFrom").value;
		selDestTo=document.getElementById("FDestTo").value;
		SearchEngine=document.getElementById("SearchEngineID").innerHTML;
		document.getElementById("SearchEngineID").innerHTML="";
		document.getElementById("SerImg").setAttribute("src","../compic/pinup.jpg");
		}
	}
	
	
	function selectAirline(AirlineField,Airline)
{
	var F;
	for(F=0;F<document.getElementById(AirlineField).length;F++)
		{
		if(document.getElementById(AirlineField).options[F].value==Airline.toUpperCase())
			{
			document.getElementById(AirlineField).options[F].selected=true;
			break;
			}
		}
}


function selectDestFrom(DestFromField,DestFrom)
{

	var F;
	for(F=0;F<document.getElementById(DestFromField).length;F++)
		{
		if(document.getElementById(DestFromField).options[F].value==DestFrom.toUpperCase())
			{
			document.getElementById(DestFromField).options[F].selected=true;
			break;
			}
		}
}

function selectDestTo(DestTo)
{
	var F;
	for(F=0;F<document.getElementById("FDestTo").length;F++)
		{
		if(document.getElementById("FDestTo").options[F].value==DestTo.toUpperCase())
			{
			document.getElementById("FDestTo").options[F].selected=true;
			break;
			}
		}
}



function selectClass(FClsTypeField,FClsType)
{
	var F;
	for(F=0;F<document.getElementById(FClsTypeField).length;F++)
		{
		if(document.getElementById(FClsTypeField).options[F].value.toUpperCase()==FClsType.toUpperCase())
			{
			document.getElementById(FClsTypeField).options[F].selected=true;
			break;
			}
		}
}


function selectHRoom(HRoomField,HRoom)
	{
	var F;
	for(F=0;F<document.getElementById(HRoomField).length;F++)
		{
		if(document.getElementById(HRoomField).options[F].value.toUpperCase()==HRoom.toUpperCase())
			{
			document.getElementById(HRoomField).options[F].selected=true;
			break;
			}
		}
	}
	
	
function selectHAdult(HAdultField,HAdult)
	{
	var F;
	for(F=0;F<document.getElementById(HAdultField).length;F++)
		{
		if(document.getElementById(HAdultField).options[F].value.toUpperCase()==HAdult.toUpperCase())
			{
			document.getElementById(HAdultField).options[F].selected=true;
			break;
			}
		}
	}
	
function selectHChild(HChildField,HChild)
	{
	var F;
	for(F=0;F<document.getElementById(HChildField).length;F++)
		{
		if(document.getElementById(HChildField).options[F].value.toUpperCase()==HChild.toUpperCase())
			{
			document.getElementById(HChildField).options[F].selected=true;
			break;
			}
		}
	}
	
function selectHAge(HAgeField,HAge)
{
var F;
for(F=0;F<document.getElementById(HAgeField).length;F++)
	{
	if(document.getElementById(HAgeField).options[F].value.toUpperCase()==HAge.toUpperCase())
		{
		document.getElementById(HAgeField).options[F].selected=true;
		break;
		}
	}
}
function hideRetRow(j)
{
	
	if(j==0)
		{
		if(retRowContent=="")
		    {
		    retRowContent=document.getElementById("retDateRowID").innerHTML;
		    }
		document.getElementById("retDateRowID").innerHTML="";
		document.getElementById("FJrnType").value="1";
		}
		else
		{
		
		try
		{
			document.getElementById("retDateRowID").innerHTML=retRowContent;
			document.getElementById("FJrnType").value="";
			document.getElementById("FRetDateDDMMYY").value=document.getElementById("FDptDateDDMMYY").value
			document.getElementById("FDayMonthRet").value=document.getElementById("FDayMonth").value
		}
		catch(err)	
		{
		}
			
			
			
			
			//var field=document.getElementById("FRetDateDDMMYY");
		   // createMonthoptions(field.id);
			//selectField(document.getElementById("FDptDateDDMMYY").value,field)
			//addOptionReturn('FRetDay','FRetDate','FDptDate','FRetDateDDMMYY',false);
		}
	
}

function addOptionReturn(DayField,DateFieldSet,DateField,MonYearField)
{

var i;
var emp=document.getElementById(DateFieldSet);
var monYear=document.getElementById(MonYearField).value;

var DaysInMonth;
var selMon=parseInt(monYear.substring(0,2),10);
var selYear=parseInt(monYear.substring(2,6),10);
DaysInMonth=getDaysInMonth(selMon,selYear);

var tempDate=parseInt(document.getElementById(DateField).value,10);

while(emp.options.length)
	{
		d = emp.options.length - 1;
		emp.remove(d);
	}
for(i=1;i<=parseInt(DaysInMonth,10);i++)
	{
	if(i<10)
		{
		textValue=i;
		textText="0"+""+i;
		}
		else
		{
		textValue=i;
		textText=i;
		}
	 optionItem = new Option(textText,textValue);
     emp.options[i] = optionItem;
   	}
	  	
   	try
   	    {
        emp.options[tempDate].selected=true;
		}catch(ex){}
	
   	
document.getElementById(DayField).value=getDayString(new Date(selYear,selMon-1,tempDate).getDay())
}

//Hotel Search Engine Start
function setDDIndex(idval)
{
var FHChild="FHChild"+idval;
var FHAge="FHAge"+idval;
var HAge="HAge"+idval;
document.getElementById(FHChild).selectedIndex=0;
document.getElementById(FHAge).selectedIndex=0;
document.getElementById(HAge).selectedIndex=0;       
}

function createoptions(AdtID,ChID)
{
var AdtDropDwnID=document.getElementById(AdtID);
var ChDropDwnID=document.getElementById(ChID);
        while(ChDropDwnID.options.length)
		{
				d = ChDropDwnID.options.length - 1;
				ChDropDwnID.remove(d);
		}
        if(AdtDropDwnID.value==2)
        {
                    var i;
                    for(i=0;i<3;i++)
                    {
                    ChDropDwnID.options[i] =  new Option();
			        ChDropDwnID.options[i].text =i;
			        ChDropDwnID.options[i].value =i;
                    }
        }
        else
        {
                    ChDropDwnID.options[0] =  new Option();
			        ChDropDwnID.options[0].text =0;
			        ChDropDwnID.options[0].value =0;
			        ChDropDwnID.options[1] =  new Option();
			        ChDropDwnID.options[1].text =1;
			        ChDropDwnID.options[1].value =1;
        
        }
}



function Room(HRoom)
{
		var str;
		var i;
		for(i=2;i < 9;i++)
		{
			str="TR"+i;		
			if(i<=HRoom)
			{
				document.getElementById(str).style.display="block";	
			}
			else			
			{
				document.getElementById(str).style.display="none";
				document.getElementById("a"+i).style.display="none"
				setDDIndex(i);
			}
		}
}

	function Tit()
	{	
	var i;
	for(i=1;i<=8;i++)
	{
	        try
	        {
	        var FHID;
	        FHID="FHChild"+i;
	                if (document.getElementById(FHID).value > 0)
	                {
	                    document.getElementById("t1").style.visibility="visible"
	                    document.getElementById("chnmsg1").style.display="block";	
	                     document.getElementById("chnmsg2").style.display="block";	
	                    break;
			        }
			        else
			        {
				        document.getElementById("t1").style.visibility="hidden"
				        document.getElementById("chnmsg1").style.display="none";	
				         document.getElementById("chnmsg2").style.display="none";	
			        }			       
	        }
	        catch(err){}
	}	
	for(i=1;i<=8;i++)
	{
	        try
	        {
	        var FHID;
	        FHID="FHChild"+i;
	               if (document.getElementById(FHID).value==2)
			        {
			            document.getElementById("t2").style.visibility="visible"
			             break;
			        }
			        else
			        {
			            document.getElementById("t2").style.visibility="hidden"
			        }
	        }
	        catch(err){}
	}				
	}

function showtd(tdID,subID)
{
			if(document.getElementById(tdID).value==0) 
			{
				document.getElementById("a"+subID).style.display="none"
					
			}
			else
			{
				document.getElementById("a"+subID).style.display="block";	
				
			}
									
			if(document.getElementById(tdID).value==1) 
			{	
				document.getElementById("HAge"+subID).style.display="none";	
			}
			else if(document.getElementById(tdID).value==2) 
			{
				document.getElementById("HAge"+subID).style.display="block";	
			}
}


function createMonthoptions(smonthselect)
{
var i;
var textValue; 
var textText; 
var optionItem;
crMonthDPT=document.getElementById(smonthselect);
var Ddate1 = new Date();
var myMonths=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];
var month=myMonths[Ddate1.getMonth()]
var arraylength;
var yearvalue=Ddate1.getFullYear()
for(j=0;j<myMonths.length;j++)
{
    if(month==myMonths[j])
    {
    arraylength=j;
    break;
    }
}
     for(i=0;i<=11;i++)
        {
        var monVal=0;
        monVal=arraylength+1;
                    if(monVal < 10)
                    {
		            textValue = 0+""+monVal;
		            }
		            else
		            {
		            textValue=monVal;
		            }
                    textValue =textValue+""+yearvalue;
                    if(arraylength<=12)
                    {
                    textText=myMonths[arraylength]+" "+yearvalue;
	                optionItem = new Option( textText,textValue);
	                crMonthDPT.options[i] = optionItem;
	                arraylength=arraylength+1;    
	                }
	                if(arraylength==12)
	                {
	                arraylength=0;
	                yearvalue=yearvalue+1;
	                }
	                 if(i==10 && smonthselect=="FRetDateDDMMYY")
                        {
                            optionItem = new Option( "Just one way","00");
	                        crMonthDPT.options[11] = optionItem;
//	                        crMonthDPT.options[11].selected=true;
                        }
                                              
                       
        }
}
function Left(str, n)
{
   if (n <= 0)
         return "";
   else if (n > String(str).length)
         return str;
   else
         return String(str).substring(0,n);
}


function hotel(value,supp,roomtype,value1,room,meal,noofroom)
{
document.getElementById(roomtype).value=value+"-"+supp+"-"+value1+"-"+room+"-"+meal+"-"+noofroom;
}
function selecthotel(supp,rcount,supplier)
{
finalprice=0;
prcWithoutcom=0;
nroom=""
selroom="";
selmeal="";
   if (supp=='' || rcount=='')
   {
   alert("Please select room")
   return false;
   }
  else
  {
    var k,i,c;
    c=parseInt(rcount)
    i=0
    for (k=1; k<=8; k++) 
    {
        var tempStr=document.getElementById("h"+k).value;
        
        if (tempStr != '')
        {
            var strArr=tempStr.split("-");
            var price = strArr[0];
            var supp1=strArr[1];
            var price1=strArr[2];
            var sroom=strArr[3];
            var smeal=strArr[4];
            var nr=strArr[5];
            if (supp==supp1)
            {
            i=i+1
           
                finalprice=parseFloat(finalprice)+parseFloat(price);
                prcWithoutcom=parseFloat(prcWithoutcom)+parseFloat(price1); 
                if (Left(supp,1)!='C')
                {
               selroom=selroom + "-"+ nr + " " + sroom;
               }
               else
               {
                selroom=selroom + "-" + sroom;
                }
               selmeal=selmeal+"-"+smeal;
            }           
        }
    }
    if (i==c)
    {  
    document.getElementById("totamount").value=finalprice;
    document.getElementById("HotelSppid").value=supp;
    document.getElementById("prcWithoutcom").value=prcWithoutcom;
    document.getElementById("RoomType").value=selroom;
    document.getElementById("MealType").value=selmeal;
    document.getElementById("supp").value=supplier;    
    return true
    }
    else
    {
    alert("Please Select  Hotel's Room");
     return false
    } 
}
}
function createfromoption(fh,d)
{
var ft=new Array(),fv=new Array(); 
var fhf,i;
fhf=document.getElementById(fh);
if (d=="BCN"||d=="BUD")
{
ft=["London All","London City","London Gatwick","London Heathrow","London Stansted","London Luton","Birmingham","Bristol","Edinburgh","Glasgow","Leeds(Bradford)","Manchester","Liverpool"];
fv=["LON","LCY","LGW","LHR","STN","LTN","BHX","BRS","EDI","GLA","LBA","MAN","LPL"];
}

for(i=1;i<=ft.length-1;i++){optionItem = new Option(ft[i],fv[i]);fhf.options[i] = optionItem;}}




//

function FillDestFrom(objTo,objFrom)
{
var DestFromCode,DestFromValues
var DestTo=document.getElementById(objTo).value
var DestFrom=document.getElementById(objFrom)
	if(DestTo=='BCN')
		{
		DestFromCode="LON/LCY/LGW/LHR/STN/LTN/ABZ/BFS/BHX/BRS/DSA/EDI/EMA/GLA/LBA/LPL/MAN/NCL"
		DestFromValues="London All/London City/London Gatwick/London Heathrow/London Stansted/London Luton/Aberdeen/BelFast/Birmingham/Bristol/Doncaster Sheffield/Edinburgh/East Midlands/Glasgow/Leeds(Bradford)/Liverpool/Manchester/Newcastle";
		ShowCitys(DestFrom,DestFromCode,DestFromValues);
		//document.getElementById(DestFrom).options[0].selected=true;
		}
	if(DestTo=="AUH" || DestTo=="DXB")
		{
		DestFromCode="LON/LCY/LGW/LHR/STN/ABZ/BHX/BRS/EDI/GLA/MAN/NCL"
		DestFromValues="London All/London City/London Gatwick/London Heathrow/London Stansted/Aberdeen/Birmingham/Bristol/Edinburgh/Glasgow/Manchester/Newcastle";
		ShowCitys(DestFrom,DestFromCode,DestFromValues);
		//document.getElementById(DestFrom).options[0].selected=true;
		}
	if(DestTo=="AMS")
		{
		//DestFromCode="LON/LCY/LGW/LHR/STN/LTN/ABZ/BHX/BRS/BFS/EDI/EMA/GLA/LBA/MAN/NCL/LPL"
		//DestFromValues="London All/London City/London Gatwick/London Heathrow/London Stansted/London Luton/Aberdeen/Birmingham/Bristol/BelFast/Edinburgh/Eastmidlands/Glasgow/Leeds(Bradford)/Manchester/New Castle/Liverpool";
		
		DestFromCode="LON/LCY/LGW/LHR/STN/LTN/ABZ/BHX/BRS/BFS/CWL/ORK/DUB/DND/MME/EDI/EMA/EXT/GLA/HUY/JER/LBA/LPL/MAN/NCL/NWI/SOU"
		DestFromValues="London All/London City/London Gatwick/London Heathrow/London Stansted/London Luton/Aberdeen/Birmingham/Bristol/BelFast/Cardiff/Cork/Dublin/Dundee/Durham Tees Valley/Edinburgh/Eastmidlands/Exeter/Glasgow/Humberside/Jersey/Leeds(Bradford)/Liverpool/Manchester/New Castle/Norwich/Southampton"
		ShowCitys(DestFrom,DestFromCode,DestFromValues);
		//document.getElementById(DestFrom).options[0].selected=true;
		}
	if(DestTo=="BER")
		{
		DestFromCode="LON/LCY/LGW/LHR/STN/LTN/BHX/BRS/EDI/GLA/LBA/MAN/LPL"
		DestFromValues="London All/London City/London Gatwick/London Heathrow/London Stansted/London Luton/Birmingham/Bristol/Edinburgh/Glasgow/Leeds(Bradford)/Manchester/Liverpool";
		ShowCitys(DestFrom,DestFromCode,DestFromValues);
		//document.getElementById(DestFrom).options[0].selected=true;
		}
	if(DestTo=="BUD")
		{
		DestFromCode="LON/LCY/LGW/LHR/STN/LTN/BHX/BRS/EDI/GLA/LBA/MAN"
		DestFromValues="London All/London City/London Gatwick/London Heathrow/London Stansted/London Luton/Birmingham/Bristol/Edinburgh/Glasgow/Leeds(Bradford)/Manchester";
		ShowCitys(DestFrom,DestFromCode,DestFromValues);
		}
	if(DestTo=="VCE")
		{
		DestFromCode="LON/LGW/LHR/BFS/BRS/EMA/EDI/LBA/LPL/MAN"
		DestFromValues="London All/London Gatwick/London Heathrow/Belfast/Bristol/East Midland/Edinburgh/Leeds(Bradford)/Liverpool/Manchester";
		ShowCitys(DestFrom,DestFromCode,DestFromValues);
		}
	if(DestTo=="MLA")
		{
		DestFromCode="LON/LGW/LHR/BFS/BHX/BRS/EMA/EDI/LPL/MAN/NCL"
		DestFromValues="London All/London Gatwick/London Heathrow/Belfast/Birmingham/Bristol/East Midland/Edinburgh/Liverpool/Manchester/New Castle";
		ShowCitys(DestFrom,DestFromCode,DestFromValues);
		}
	if(DestTo=="ROM")
		{
		DestFromCode="LON/LCY/LGW/LHR/ABZ/BHX/BRS/CWL/EDI/MAN/LBA/BFS/NCL/GLA";
		DestFromValues="London All/London City/London Gatwick/London Heathrow/Aberdeen/Birmingham/Bristol/Cardiff/Edinburgh/Manchester/Leeds(Bradford)/Belfast Intl/Newcastle/Glasgow";
		ShowCitys(DestFrom,DestFromCode,DestFromValues);
		}
	if(DestTo=="MIL")
		{
		DestFromCode="LON/LHR/LGW/LTN/STN/ABZ/BHX/BRS/EDI/GLA/HUY/LPL/MAN/NCL/NWI";
		DestFromValues="London All/London Heathrow/London Gatwick/London Luton/London Stansted/Aberdeen/Birmingham/Bristol/Edinburgh/Glasgow/Humberside/Liverpool/Manchester/Newcastle/Norwich";
		ShowCitys(DestFrom,DestFromCode,DestFromValues);
		}
	if(DestTo=="PRG")
		{
		DestFromCode="LON/LCY/LGW/LHR/STN/LTN/ABZ/BHX/BRS/EMA/EDI/MAN/LBA/NCL/BFS/LPL";
		DestFromValues="London All/London City/London Gatwick/London Heathrow/London Stansted/London Luton/Aberdeen/Birmingham/Bristol/East Midlands/Edinburgh/Manchester/Leeds(Bradford)/New Castle/Belfast Intl/Liverpool";
		ShowCitys(DestFrom,DestFromCode,DestFromValues);
		}
		
		//-------------------------------------------------------------------------------------------------------------------------------------	
if(DestTo=="PAR")
		{
		//DestFromCode="LON/LCY/LGW/LHR/STN/LTN/BHX/BRS/CWL/EMA/EDI/GLA/MAN/LBA/NCL/NWI/BFS/LPL";
		//DestFromValues="London All/London City/London Gatwick/London Heathrow/London Stansted/London Luton/Birmingham/Bristol/Cardiff/East Midlands/Edinburgh/Glasgow/Manchester/Leeds(Bradford)/New Castle/Norwich/Belfast Intl/Liverpool";
		DestFromCode="LON/LCY/LGW/LHR/STN/LTN/ABZ/BHD/BFS/BHX/BRS/CWL/DND/MME/EMA/EDI/EXT/GLA/HUY/MAN/JER/LBA/NCL/NWI/LPL/SOU"		
		DestFromValues="London All/London City/London Gatwick/London Heathrow/London Stansted/London Luton/Aberdeen/Belfast City/Belfast Intl/Birmingham/Bristol/Cardiff/Dundee/Durham Tees Valley/East Midlands/Edinburgh/Exeter/Glasgow/Humberside/Manchester/Jersey/Leeds(Bradford)/New Castle/Norwich/Liverpool/Southampton"
		ShowCitys(DestFrom,DestFromCode,DestFromValues);
		}	
	if(DestTo=="CPH")
		{
		DestFromCode="LON/LCY/LGW/LHR/STN/ABZ/BHX/BRS/EMA/EDI/MAN/LBA/BFS";
		DestFromValues="London All/London City/London Gatwick/London Heathrow/London Stansted/Aberdeen/Birmingham/Bristol/East Midlands/Edinburgh/Manchester/Leeds(Bradford)/Belfast Intl";
		ShowCitys(DestFrom,DestFromCode,DestFromValues);
		}		
		
	if(DestTo=="NYC")
		{
		DestFromCode="LON/LCY/LGW/LHR/STN/LTN/ABZ/BHX/BRS/EMA/EDI/GLA/MAN/LBA/NCL/BFS";
		DestFromValues="London All/London City/London Gatwick/London Heathrow/London Stansted/London Luton/Aberdeen/Birmingham/Bristol/East Midlands/Edinburgh/Glasgow/Manchester/Leeds(Bradford)/New Castle/Belfast Intl";
		ShowCitys(DestFrom,DestFromCode,DestFromValues);
		}
	if(DestTo=="LIS")
		{
		DestFromCode="LON/LCY/LGW/LHR/STN/LTN/ABZ/BHX/BRS/CWL/EMA/EDI/GLA/MAN/LBA/BFS/LPL";
		DestFromValues="London All/London City/London Gatwick/London Heathrow/London Stansted/London Luton/Aberdeen/Birmingham/Bristol/Cardiff/East Midlands/Edinburgh/Glasgow/Manchester/Leeds(Bradford)/Belfast Intl/Liverpool";
		ShowCitys(DestFrom,DestFromCode,DestFromValues);
		}		
	if(DestTo=="IST")
		{
		DestFromCode="LON/LCY/LGW/LHR/STN/LTN/BHX/BRS/EMA/EDI/GLA/MAN/LBA/BFS/LPL";
		DestFromValues="London All/London City/London Gatwick/London Heathrow/London Stansted/London Luton/Birmingham/Bristol/East Midlands/Edinburgh/Glasgow/Manchester/Leeds(Bradford)/Belfast Intl/Liverpool";
		ShowCitys(DestFrom,DestFromCode,DestFromValues);
		}
				
	if(DestTo=="MAD")
		{
	DestFromCode="LON/LCY/LGW/LHR/STN/LTN/ABZ/BHX/BRS/EDI/GLA/MAN/NCL/BFS/LPL";
		DestFromValues="London All/London City/London Gatwick/London Heathrow/London Stansted/London Luton/Aberdeen/Birmingham/Bristol/Edinburgh/Glasgow/Manchester/New Castle/Belfast Intl/Liverpool";
		ShowCitys(DestFrom,DestFromCode,DestFromValues);
		}
	    if(DestTo=="BRU")
		{
	    DestFromCode="LON/LCY/LGW/LHR/STN/LTN/ABZ/BHX/BRS/EMA/EDI/GLA/MAN/LBA/NCL/BFS";
		DestFromValues="London All/London City/London Gatwick/London Heathrow/London Stansted/London Luton/Aberdeen/Birmingham/Bristol/East Midlands/Edinburgh/Glasgow/Manchester/Leeds(Bradford)/New Castle/Belfast Intl";
		ShowCitys(DestFrom,DestFromCode,DestFromValues);
		}
				
	    if(DestTo=="RIX")
		{		
		DestFromCode="LON/LCY/LGW/LHR/STN/LTN/ABZ/BHX/BRS/EMA/GLA/MAN/NCL/LPL";
		DestFromValues="London All/London City/London Gatwick/London Heathrow/London Stansted/London Luton/Aberdeen/Birmingham/Bristol/East Midlands/Glasgow/Manchester/New Castle/Liverpool";
		ShowCitys(DestFrom,DestFromCode,DestFromValues);
		}
		
		if(DestTo=="TLL")
		{
		DestFromCode="LON/LGW/LHR/STN/ABZ/BHX/MAN/NCL";
		DestFromValues="London All/London Gatwick/London Heathrow/London Stansted/Aberdeen/Birmingham/Manchester/Newcastle";
		ShowCitys(DestFrom,DestFromCode,DestFromValues);
		}	   
		if(DestTo=="BTS")
		{
		DestFromCode="LON/LCY/LGW/LHR/LTN/ABZ/BHX/BRS/MAN/NCL/LPL";
		DestFromValues="London All/London City/London Gatwick/London Heathrow/London Luton/Aberdeen/Birmingham/Manchester/Newcastle/Liverpool";
		ShowCitys(DestFrom,DestFromCode,DestFromValues);
		}
		if(DestTo=="TUN")
		{
		DestFromCode="LON/LCY/LGW/LHR/STN/BHX/BRS/EDI/GLA/MAN";
		DestFromValues="London All/London City/London Gatwick/London Heathrow/London Stansted/Birmingham/Bristol/Edinburgh/Glasgow/Manchester";
		ShowCitys(DestFrom,DestFromCode,DestFromValues);
		}
		if(DestTo=="ZRH")
		{
		DestFromCode="LON/LCY/LGW/LHR/STN/LTN/ABZ/BHX/BRS/EMA/EDI/GLA/MAN/LBA/MME";
		DestFromValues="London All/London City/London Gatwick/London Heathrow/London Stansted/London Luton/Aberdeen/Birmingham/Bristol/East Midlands/Edinburgh/Glasgow/Manchester/Leeds(Bradford)/Tees-side";
		ShowCitys(DestFrom,DestFromCode,DestFromValues);
		}
		if(DestTo=="YVB" || DestTo=="YYC" || DestTo=="YHG" || DestTo=="YCS" ||DestTo=="YCR" || DestTo=="YQD" || DestTo=="YEG" || DestTo=="YXJ" || DestTo=="YQX" || DestTo=="YGX" || DestTo=="YHZ" || DestTo=="YHM" || DestTo=="YHB" || DestTo=="YKA" || DestTo=="YGK" || DestTo=="YXU" || DestTo=="YUL" || DestTo=="YMX" || DestTo=="YNO" || DestTo=="YOW" || DestTo=="YPA" || DestTo=="YXS" || DestTo=="YPR" || DestTo=="YQB" || DestTo=="YRL" || DestTo=="YQY" || DestTo=="YBB" || DestTo=="YQT" || DestTo=="YXT" || DestTo=="YYZ" || DestTo=="YVR" || DestTo=="YYJ" || DestTo=="YQG" || DestTo=="YWG")
		{
		DestFromCode="LON/LHR/LGW/BHX/BRS/EDI/GLA/MAN";
		DestFromValues="London All/London Heathrow/London Gatwick/Birmingham/Bristol/Edinburgh/Glasgow/Manchester";
		ShowCitys(DestFrom,DestFromCode,DestFromValues);
		}
		if(DestTo=="LHE" || DestTo=="ISB" || DestTo=="KHI" || DestTo=="PEW")
		{
		DestFromCode="LON/LHR/LGW/MAN/BHX/ABZ/GLA/MAN/NCL";
		DestFromValues="London All/London Heathrow/London Gatwick/Manchester/Birmingham/Aberdeen/Glasgow/Manchester/Newcastle";
		ShowCitys(DestFrom,DestFromCode,DestFromValues);
		}
		if(DestTo=="DAC" || DestTo=="CGP" || DestTo=="CXB" || DestTo=="ZYL")
		{
		DestFromCode="LON/LHR/LGW/BHX/MAN/NCL/GLA";
		DestFromValues="London All/London Heathrow/Londan Gatwick/Birmingham/Manchester/New Castle/Glasgow";
		ShowCitys(DestFrom,DestFromCode,DestFromValues);
		}
		if(DestTo=="BKK")
		{
		DestFromCode="LON/LHR/LGW/BHX/MAN";
		DestFromValues="London All/London Heathrow/Londan Gatwick/Birmingham/Manchester";
		ShowCitys(DestFrom,DestFromCode,DestFromValues);
		}
//-------------------------------------------------------------------------------------------------------------------------------------
}

function FillAirline(objTo,objAirline)
{
var AirlineCode,AirlineValues
var DestTo=document.getElementById(objTo).value
var Airline=document.getElementById(objAirline)	
		if(DestTo=="YVB" || DestTo=="YYC" || DestTo=="YHG" || DestTo=="YCS" ||DestTo=="YCR" || DestTo=="YQD" || DestTo=="YEG" || DestTo=="YXJ" || DestTo=="YQX" || DestTo=="YGX" || DestTo=="YHZ" || DestTo=="YHM" || DestTo=="YHB" || DestTo=="YKA" || DestTo=="YGK" || DestTo=="YXU" || DestTo=="YUL" || DestTo=="YMX" || DestTo=="YNO" || DestTo=="YOW" || DestTo=="YPA" || DestTo=="YXS" || DestTo=="YPR" || DestTo=="YQB" || DestTo=="YRL" || DestTo=="YQY" || DestTo=="YBB" || DestTo=="YQT" || DestTo=="YXT" || DestTo=="YYZ" || DestTo=="YVR" || DestTo=="YYJ" || DestTo=="YQG" || DestTo=="YWG")
		{
		AirlineCode="ALL/AI/AF/BA/CO/DL/EK/EY/KL/KU/QR/US";
		AirlineValues="Any Airline/Air India/Air France/British Airways/Continental Airline/Delta Airways/Emirates Air/Etihad Airways/KLM Royal Dutch/Kuwait Airways/Qatar Airways/US Airways";
		ShowCitys(Airline,AirlineCode,AirlineValues);
		}
		else if(DestTo=="LHE" || DestTo=="ISB" || DestTo=="KHI" || DestTo=="PEW")
		{
		AirlineCode="ALL/EK/EY/GF/KU/WY/QR/HY";
		AirlineValues="Any Airline/Emirates Air/Etihad Airways/Gulf Air/Kuwait Airways/Oman Air/Qatar Airways/Uzbekistan Airways";
		ShowCitys(Airline,AirlineCode,AirlineValues);
		}
		else if(DestTo=="DAC" || DestTo=="CGP" || DestTo=="CXB" || DestTo=="ZYL")
		{
		AirlineCode="ALL/AI/AF/BG/BA/EK/EY/GF/9W/KU/WY/QR/SV";
		AirlineValues="Any Airline/Air India/Air France/Biman Airways/British Airways/Emirates Air/Etihad Airways/Gulf Air/Jet Airways/Kuwait Airways/Oman Airways/Qatar Airways/Saudi Airlines";
		ShowCitys(Airline,AirlineCode,AirlineValues);
		}
		else
		{
		AirlineCode="ALL/SU/AF/AI/KM/NZ/W3/0Z/BG/BD/BA/CX/CI/CO/DL/EK/ET/EY/BR/AY/GF/JL/9W/IT/KL/KU/LH/MH/W5/QF/QR/WY/BI/RJ/SK/SQ/SA/UL/LX/TP/TG/US/VS";
		AirlineValues="Any Airline/Aeroflot/Air France/Air India/Air Malta/Air New Zealand/Arik Air International/Asiana Airlines/Biman Airways/BMI Airline/British Airways/Cathay Pacific/China Airways/Continental Airlines/Delta Airways/Emirates Air/Ethiopian/Etihad Airways/EVA Airways/Finnair/Gulf Air/Japan Airways/Jet Airways/Kingfisher Airlines/KLM Royal Dutch/Kuwait Airways/Lufthansa Airline/Malaysian Airlines/Mahan Airlines/Qantas Airline/Qatar Airways/Oman Airways/Royal Brunei/Royal Jordan/Scandinavian Airlines/Singapore Airways/South African/Srilankan Airlines/Swiss Airline/Tap Portugal/Thai Airways/US Airways/Virgin Atlantic";
		ShowCitys(Airline,AirlineCode,AirlineValues);
		}
}

function ShowCitys(SortField,DestFromCode,DestFromValues)
{

var SplitNameCode,SplitNameText
SplitNameCode = DestFromCode.split("/")
SplitNameText = DestFromValues.split("/")

var newIndex, d, sorttext;
index = 0;
try
{
while(SortField.options.length)
{
	d = SortField.options.length - 1;
	SortField.remove(d);
}
}
catch(e){}
	 for (var i=0;i<SplitNameCode.length;i++)
		{
			SortField.options[i] =  new Option();
			SortField.options[i].text = SplitNameText[i];
			SortField.options[i].value = SplitNameCode[i];
		}

}
function replaceDays(num)
{
	if(num=='FH')
		{
			ChangeDayDepRet(document.FltHtlSearch.FHDptDateDDMMYY,document.FltHtlSearch.FHDayMonth,document.FltHtlSearch.FHRetDateDDMMYY,document.FltHtlSearch.FHDayMonthRet);
		}
	if(num=='F')
		{
			 try
		    {
		    ChangeDayDepRet(document.FlightSearch.FDptDateDDMMYY,document.FlightSearch.FDayMonth,document.FlightSearch.FRetDateDDMMYY,document.FlightSearch.FDayMonthRet);
		    }
		    catch(err)
		    {
		    ChangeDayDepRet(document.getElementById("FDptDateDDMMYY"),document.getElementById("FDayMonth"),document.getElementById("FRetDateDDMMYY"),document.getElementById("FDayMonthRet"));
		    }		
		}
	if(num=='H')
		{
			ChangeDayDepRet(document.HotelSearch.HDptDateDDMMYY,document.HotelSearch.HDayMonth,document.HotelSearch.HRetDateDDMMYY,document.HotelSearch.HDayMonthRet);
		}

}

function ChangeDayDepRet(DptDateDDMMYY,DptDateDay,RetDateDDMMYY,RetDateDay)
{

		try
		{
		var year=document.getElementById(DptDateDDMMYY.id).value.substr(6,4);
		var mon=document.getElementById(DptDateDDMMYY.id).value.substr(3,2);
		var day=document.getElementById(DptDateDDMMYY.id).value.substr(0,2);
		var gDeptDate= new Date(year,mon-1,day);
		var dValue=gDeptDate.getDay();
		var dayName="";
		if(dValue=="0")
		{
		dayName="Sun";
		}
		else if(dValue=="1")
		{
		dayName="Mon"
		}
		else if(dValue=="2")
		{
		dayName="Tue"
		}
		else if(dValue=="3")
		{
		dayName="Wed"
		}
		else if(dValue=="4")
		{
		dayName="Thu"
		}
		else if(dValue=="5")
		{
		dayName="Fri"
		}
		else if(dValue=="6")
		{
		dayName="Sat"
		}
		document.getElementById(DptDateDay.id).value=dayName;
		}
		catch(eerr){}
		
		try
		{		
		var year1=document.getElementById(RetDateDDMMYY.id).value.substr(6,4);
		var mon1=document.getElementById(RetDateDDMMYY.id).value.substr(3,2);
		var day1=document.getElementById(RetDateDDMMYY.id).value.substr(0,2);
		var gDeptDate1= new Date(year1,mon1-1,day1);
		var dValue1=gDeptDate1.getDay();
		var dayName1="";
		if(dValue1=="0")
		{
		dayName1="Sun";
		}
		else if(dValue1=="1")
		{
		dayName1="Mon"
		}
		else if(dValue1=="2")
		{
		dayName1="Tue"
		}
		else if(dValue1=="3")
		{
		dayName1="Wed"
		}
		else if(dValue1=="4")
		{
		dayName1="Thu"
		}
		else if(dValue1=="5")
		{
		dayName1="Fri"
		}
		else if(dValue1=="6")
		{
		dayName1="Sat"
		}
		document.getElementById(RetDateDay.id).value=dayName1;
		}
		catch(eerr){}
}


function setNonStop(Nobj)
{
		try
		{
			if( Nobj.checked==true)
			{
				Nobj.value=1
			}
			else
			{
				Nobj.value=0
			}
		}
		catch(err)
		{}
}

function selectNonstop(ddlNameId,nonStopId)
{
	/* var destval;	
try{
	destval=document.getElementById(ddlNameId).options[document.getElementById(ddlNameId).selectedIndex].value;
	 if(destval=="LON"||destval=="LHR"||destval=="LCY"||destval=="LTN"||destval=="STN"||destval=="LGW")
		{document.getElementById(nonStopId).checked=true;document.getElementById(nonStopId).value=1;}
	 else{document.getElementById(nonStopId).checked=false;document.getElementById(nonStopId).value=0;}
}catch(e){} */
}


function selectNonstopNew(ddlFromId,ddlToId,nonStopId)
{
	/*var destFromval,destToval;	
try{
	destFromval=document.getElementById(ddlFromId).options[document.getElementById(ddlFromId).selectedIndex].value;
	destToval=document.getElementById(ddlToId).options[document.getElementById(ddlToId).selectedIndex].value;
	 if(destFromval=="LON"||destFromval=="LHR"||destFromval=="LCY"||destFromval=="LTN"||destFromval=="STN"||destFromval=="LGW"){document.getElementById(nonStopId).checked=true;document.getElementById(nonStopId).value=1;}
	 else if((destFromval=="EMA"||destFromval=="LPL"||destFromval=="MAN"||destFromval=="NCL") && (destToval=="MLA")){document.getElementById(nonStopId).checked=true;document.getElementById(nonStopId).value=1;}
	 else{document.getElementById(nonStopId).checked=false;document.getElementById(nonStopId).value=0;}
}catch(e){}*/
}
