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')
		//createMonthoptions('FDptMMYear');
		//addOption('FDptDay','FDptDate','FDptMMYear',true);
		//createMonthoptions('FRetMMYear');
		//addOption('FRetDay','FRetDate','FRetMMYear',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
		{
		
			document.getElementById("retDateRowID").innerHTML=retRowContent;
			document.getElementById("FJrnType").value="";
			var field=document.getElementById("FRetMMYear");
		    createMonthoptions(field.id);
			selectField(document.getElementById("FDptMMYear").value,field)
			addOptionReturn('FRetDay','FRetDate','FDptDate','FRetMMYear',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/BHX/BRS/DSA/EDI/EMA/GLA/LBA/LPL/MAN/NCL"
		DestFromValues="London All/London City/London Gatwick/London Heathrow/London Stansted/London Luton/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";
		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="LGW/LHR/BFS/BRS/EMA/EDI/LBA/LPL/MAN"
		DestFromValues="London Gatwick/London Heathrow/Belfast/Bristol/East Midland/Edinburgh/Leeds(Bradford)/Liverpool/Manchester";
		ShowCitys(DestFrom,DestFromCode,DestFromValues);
		}
	if(DestTo=="MLA")
		{
		DestFromCode="LON/LCY/LGW/LHR/STN/BHX/BRS/EMA/EDI/GLA/LPL/MAN/NCL"
		DestFromValues="London All/London City Airport/London Gatwick/London Heathrow/London Stansted/Birmingham/Bristol/East Midland/Edinburgh/Glasgow/Liverpool/Manchester/New Castle";
		ShowCitys(DestFrom,DestFromCode,DestFromValues);
		}
	if(DestTo=="ROM")
		{
		DestFromCode="LCY/LGW/LHR/ABZ/BHX/BRS/CWL/EDI/MAN/LBA/BFS/NCL/GLA";
		DestFromValues="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="LHR/LGW/LTN/STN/ABZ/BHX/BRS/EDI/GLA/HUY/LPL/MAN/NCL/NWI";
		DestFromValues="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";
		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);
		}
//-------------------------------------------------------------------------------------------------------------------------------------
}

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)
{

	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 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 gDeptDate= new Date(year,mon-1,day);
	var gDeptDate1= new Date(year1,mon1-1,day1);
	
	var dValue=gDeptDate.getDay();
	var dValue1=gDeptDate1.getDay();

	var dayName="";
	var dayName1="";

	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"
		}
		
		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(DptDateDay.id).value=" "+dayName;
document.getElementById(RetDateDay.id).value=" "+dayName1;
}







