var all_month = new Array("JAN", "FEV", "MAR", "AVR", "MAI", "JUN", "JUL", "AOU", "SEP", "OCT", "NOV", "DEC");
var lstHoursCar = new Array("07H00","08H00","09H00", "10H00", "11H00", "12H00","13H00","14H00","15H00","16H00","17H00","18H00","19H00","20H00","21H00","22H00");
var lstHoursTrn = new Array("00h-04h", "01h-05h", "02h-06h", "03h-07h", "04h-08h", "05h-09h", "06h-10h", "07h-11h", "08h-12h", "09h-13h", "10h-14h", "11h-15h", "12h-16h", "13h-17h", "14h-18h", "15h-19h", "16h-20h", "17h-21h", "18h-22h", "19h-23h", "20h-24h", "21h-01h", "22h-02h", "23h-03h");

var fltDelay = 3;
var carDelay = 2;
var hotDelay = 2;
var trnDelay = 7;

var protocol = location.protocol.indexOf('https')>-1?'https':'http';
l('<SCRIPT LANGUAGE="javascript" SRC="' + protocol + '://www.vivacances.fr/js/delay.js"></SCRIPT>');

//l('<SCRIPT LANGUAGE="javascript" >fltDelay = 12;</SCRIPT>');

var valFormCurrent = 'flt';

var num_field = 0;
var num_form;

var lstDest =  null;
if (!this.frameOrigin)
{
  frameOrigin="NOFRAME";
}

/*for lighter code*/
function w(inValue)
{
	document.write(inValue);
}

/*for lighter code*/
function l(inValue)
{
	document.writeln(inValue);
}

function prefill (retrievedVar, toSetVar)
{
	if(retrievedVar.value!=""&&retrievedVar.value!=null) 
		{
			toSetVar.value=retrievedVar.value;
		}

}

function createobjDest(objDest,tagDestCity)
{
	if (lstDest == null)
	{
		cptDest = 0;
		lstDest = new Array();
		for (i=1;i<lstDestinations.length;i=i+2)
		{
			if (lstDestinations[i] != "")
			{
				lstDest[cptDest] = lstDestinations[i];
				cptDest++;
			}
		}
		lstDest.sort();
	}
	cptListBox = 1;

	for (i=0;i<lstDest.length;i++)
	{
		objDest.options[cptListBox] = new Option(lstDest[i],lstDest[i]);
		cptListBox++;
	}
	if(tagDestCity!="" && tagDestCity!=null)
		objDest.value = tagDestCity;
}

function selectPax(ObjMaster,ObjCustom)
{
	var minCustom = parseInt(ObjCustom.options[0].value);
	var ObjCustomMaxLength = 9 - parseInt(ObjMaster.value);
	var ObjCustomLength = ObjCustom.options.length;
	var ObjCustomSelect = ObjCustom.value;
	for (j = ObjCustomLength-1; j >0; j--)
		ObjCustom.options[j] = null;
	for (j=0;j<=ObjCustomMaxLength-minCustom;j++)
		ObjCustom.options[j] = new Option(j+minCustom,j+minCustom);
	if (parseInt(ObjCustomSelect) <= ObjCustomMaxLength)
		ObjCustom.value = ObjCustomSelect;
}

function updateBebe(ObjMaster,ObjCustom)
{
	var ObjCustomSelect = ObjCustom.value;
	var ObjCustomLength = ObjCustom.options.length;
	var ObjCustomMaxLength = parseInt(ObjMaster.value);
	for (j = ObjCustomLength-1; j >0; j--)
		ObjCustom.options[j] = null;
	for (j=0;j<=ObjCustomMaxLength;j++)
		ObjCustom.options[j] = new Option(j,j);
	if (parseInt(ObjCustomSelect) <= ObjCustomMaxLength)
		ObjCustom.value = ObjCustomSelect;
	else
		ObjCustom.value = ObjCustomMaxLength;
}

function selectDest(objReg,objDest)
{
	var boxLength = objDest.options.length ;
	for (j = boxLength-1; j >0; j--)
		objDest.options[j] = null;
	var currentReg = objReg.value;
	if (currentReg == 0)
	{
		createobjDest(objDest,null)
	}
	else
	{
		var cptListBox = 1
		for (i=0;i<lstDestinations.length;i++)
		{
			if (lstDestinations[i] == currentReg)
			{
				if (i+1 <lstDestinations.length)
				{
					objDest.options[cptListBox] = new Option(lstDestinations[i+1],lstDestinations[i+1]);
					cptListBox ++;
				}
			}
		}
	}
	objDest.focus();
}

function NumFieldForm(form, name){
  lf = document.forms;
    for(n = 0; lf.length > n; n++) {
        if(lf[n].name == form) {
            num_form = n;
        }
    }
    of = lf[num_form];
    for(n = 0; of.elements.length > n; n++) {
        if(of.elements[n].name == name) {
            num_field = n;
        }
    }
}

function NumFields(formu,name){
	for(n = 0;n < eval("document."+formu+".elements.length");n ++) {
		if(eval("document."+formu+".elements[n].name") == name)
               		return n;
	}
}

function el(name_form,n) {
	return (eval("document."+name_form+".elements["+n+"]"));
}

function showCLhotel(form, field){
 NumFieldForm(form, field);
 var w = window.open("./jsp/pub_clean.jsp?FCT=CLCITYLOOKUPENTRY", "lookup_location", "toolbar=no,location=no,directories=no,status=yes,scrollbars=yes,menubar=no,resizable=yes,width=450,height=400");
}


function NumFieldscar(name){
   for(n = 0;n != document.forms[1].elements.length;n ++) {
        if(document.forms[1].elements[n].name == name) {
            return n;
        }
    }
}

function showCLcar1(){
 num_field = NumFieldscar("ctrVoiVillePriseEnCharge");
 var w = window.open("./jsp/location_entry_fr.jsp?FCT=CACITYLOCATIONENTRY&FORMULARIO=formSearch&FIELD_NAME=ctrVoiVillePriseEnCharge&FIELD2_NAME=P_Address&FIELD3_NAME=P_Location", "lookup_location", "toolbar=no,location=no,directories=no,status=yes,scrollbars=yes,menubar=no,resizable=yes,width=550,height=500");
}

function showCLcar2(){
 num_field = NumFieldscar("ctrVoiVilleRestitution");
 var w = window.open("./jsp/location_entry_fr.jsp?FCT=CACITYLOCATIONENTRY&FORMULARIO=formSearch&FIELD_NAME=ctrVoiVilleRestitution&FIELD2_NAME=D_Address&FIELD3_NAME=D_Location", "lookup_location", "toolbar=no,location=no,directories=no,status=yes,scrollbars=yes,menubar=no,resizable=yes,width=550,height=500");
}

function putDateDelay(delay)
{
	var today = new Date();
	today.setDate(today.getDate()+delay);
	strToday = today.getMonth() + 1;
	if (strToday < 10)
		strToday = '0'+strToday;
	if (today.getDate()<10)
		strToday = strToday+ '/0'+today.getDate();
	else
		strToday = strToday+ '/'+today.getDate();
	strToday = strToday+'/'+today.getFullYear();
	return strToday;
}

function fGetDateAgenda(currentDay,currentMonth,updateDate)
{
	cptMonth = -1;
	cday = currentDay.value;
	i=0;
	while (i<all_month.length && cptMonth == -1)
	{
		if (currentMonth.value.substring(0,3) == all_month[i])
			cptMonth = i+1;
		i++;
	}
	
	if (cptMonth < 10)
		cptMonth = '0' + cptMonth;
	if (cday < 10)
		cday = '0' + cday;

	cdate = cptMonth+'/'+cday+'/'+currentMonth.value.substring(4,8);
	updateDate.value = cdate;
}

function writeMonthsDates(dayDelay, nbrMonths, newDelay, noPreselect)
{
	var now = new Date();
	now.setDate(now.getDate() + dayDelay);
	
	newDate=new Date(Date.UTC(now.getFullYear(),now.getMonth(),now.getDate()+newDelay*1,0,0,0));	
				
	for (i=0;i<=nbrMonths;i++)
	{
		if(now.getMonth()==newDate.getMonth()&&newDate.getYear()==now.getYear() && noPreselect==undefined)
		{
			w('<option value="'+all_month[now.getMonth()]+' '+now.getFullYear()+'" selected="selected">'+all_month[now.getMonth()].toLowerCase()+' '+now.getFullYear()+'</option>');
		}
		else
		{
			w('<option value="'+all_month[now.getMonth()]+' '+now.getFullYear()+'">'+all_month[now.getMonth()].toLowerCase()+' '+now.getFullYear()+'</option>');			
		}
		now.setDate(28);
		now.setMonth(now.getMonth()+1);
	}
}

function writeOptionList(nbrSelect,lstHours)
{
	var lstLength = lstHours.length;
	for (i=0;i<lstLength;i++)
	{
		if (lstHours[i] != '')
		{
			if (i == nbrSelect)
				w('<option value="'+lstHours[i]+'" selected>'+lstHours[i].toLowerCase()+'</option>');
			else
				w('<option value="'+lstHours[i]+'">'+lstHours[i].toLowerCase()+'</option>');
		}
	}
}

function writeDaysDates(dayDelay,departureDay, noPreselect)
{
	var now = new Date();
	now.setDate(now.getDate() + dayDelay);
	var currentDay = now.getDate();

	for (i=1;i<=9;i++)
	{
		if(departureDay!="" && departureDay!=null)
		{
			if (i == departureDay && noPreselect==undefined)
				w('<option value='+'0'+i+' selected>'+i+'</option>');
			else
				w('<option value='+'0'+i+'>'+i+'</option>');
		}
		else
		{
			if (i == currentDay && noPreselect==undefined)
				w('<option value='+'0'+i+' selected>'+i+'</option>');
			else
				w('<option value='+'0'+i+'>'+i+'</option>');
		}		
	}
	for (i=10;i<=31;i++)
	{
		if(departureDay!="" && departureDay!=null)
		{
			if (i == departureDay && noPreselect==undefined)
				w('<option value='+i+' selected>'+i+'</option>');
			else
				w('<option value='+i+'>'+i+'</option>');
		}
		else
		{	
			if (i == currentDay && noPreselect==undefined)
				w('<option value='+i+' selected>'+i+'</option>');
			else
				w('<option value='+i+'>'+i+'</option>');
		}
	}
}

function isSameDay()
{
	if( (document.formSearch.ctrVolDepartJour.value == document.formSearch.ctrVolRetourJour.value) && (document.formSearch.ctrVolDepartMois.value == document.formSearch.ctrVolRetourMois.value) )
	{
		document.formSearch.D_ANYTIME.value = '0900';
		document.formSearch.R_ANYTIME.value = '1800';
		document.formSearch.D_Time.value = '0900';
		document.formSearch.R_Time.value = '1800';
	}
}

function updateRetour(ObjDepartJour,ObjDepartMois,ObjRetourJour,ObjRetourMois,moteur,typeD,typeR)
{
	var departureYear=returnYear(typeD,moteur)+'';
	var departureMonth=returnMonth(typeD,moteur)+'';
	var departureDay=returnDay(typeD,moteur)+'';
	var yyyymmddDeparture=departureYear+departureMonth+departureDay+'';
	yyyymmddDeparture=yyyymmddDeparture*1;
			
	var arrivalYear=returnYear(typeR,moteur)+'';
	var arrivalMonth=returnMonth(typeR,moteur)+'';
	var arrivalDay=returnDay(typeR,moteur)+'';
	var yyyymmddArrival=arrivalYear+arrivalMonth+arrivalDay+'';
	yyyymmddArrival=yyyymmddArrival*1;
	
	//difference between departure date and arrival date
	//if positive : ok
	// else : nok
	var diffDatesReturnDepart=yyyymmddArrival-yyyymmddDeparture;
	if(diffDatesReturnDepart <= 0)
	{
		if(moteur=="Train")
		{
			document.formSearch.ctrTrainRetourJour.value = document.formSearch.ctrTrainDepartJour.value;
			document.formSearch.ctrTrainRetourMois.value = document.formSearch.ctrTrainDepartMois.value;
		}
		else
		{
			departureYear= parseInt(departureYear);
			var tmp=departureMonth.substring(0,1);
			if(tmp=="0")
				departureMonth=departureMonth.substring(1,2);
			departureMonth = parseInt(departureMonth)-1;
			tmp=departureDay.substring(0,1);
			if(tmp=="0")
				departureDay=departureDay.substring(1,2);
			departureDay = parseInt(departureDay);
			var dayreturn = new Date(Date.UTC(departureYear,departureMonth,departureDay,0,0,0));
			
			
			dayreturn.setDate(dayreturn.getDate() +1);
			
			var year = dayreturn.getYear();
			var month = dayreturn.getMonth();
			var day = dayreturn.getDate();
			//alert(day);
			if (day>0 && day <10)
				day="0"+day;
			if(year<1900)
				year+=1900;
				
			if(moteur=="Vol")
			{
				document.formSearch.ctrVolRetourJour.value = day;
				document.formSearch.ctrVolRetourMois.value = all_month[month] + " " +year;
			}
			else if(moteur=="Hot")
			{
				document.formSearch.ctrHotDepartJour.value = day;
				document.formSearch.ctrHotDepartMois.value = all_month[month] + " " +year;
			}
			else if(moteur=="Voi")
			{
				document.formSearch.ctrVoiRetourJour.value = day;
				document.formSearch.ctrVoiRetourMois.value = all_month[month] + " " +year;
			}
		}
		
	}
	
	
	
}

//returns the day from the select list
function returnDay(type,moteur)
{
	var returnedDay;
	var field="ctr"+moteur+type+"Jour";
	returnedDay=eval("document.formSearch."+field+".value");
	return returnedDay;
}			

// returns the month from the select list
function returnMonth(type,moteur)
{
	var returnedMonth;
	var field="ctr"+moteur+type+"Mois";
	returnedMonth=eval("document.formSearch."+field+".value");
	//returns SEP 2004 for example
	returnedMonth=returnedMonth.substring(0,returnedMonth.length-5);
	return monthNumber(returnedMonth);
}

//returns the year from the select list
function returnYear(type,moteur)
{
	var returnedYear;
	var field="ctr"+moteur+type+"Mois";
	returnedYear=eval("document.formSearch."+field+".value");
	//returns Septembre 2004 for example
	returnedYear=returnedYear.substring(returnedYear.length-4);
	return returnedYear;
}

//returns the month number
function monthNumber(monthName)
{
	var returnedMonth='';
	switch(monthName)
	{
		case 'JAN':
			returnedMonth='01';
			break;
		case 'FEV':
			returnedMonth='02';
			break;
		case 'MAR':
			returnedMonth='03';
			break;
		case 'AVR':
			returnedMonth='04';
			break;
		case 'MAI':
			returnedMonth='05';
			break;
		case 'JUN':
			returnedMonth='06';
			break;
		case 'JUL':
			returnedMonth='07';
			break;
		case 'AOU':
			returnedMonth='08';
			break;
		case 'SEP':
			returnedMonth='09';
			break;
		case 'OCT':
			returnedMonth='10';
			break;
		case 'NOV':
			returnedMonth='11';
			break;
		case 'DEC':
			returnedMonth='12';
			break;
		default:
			break;
	}
	return returnedMonth;
}

function createExpressSearch(formCurrent,depCity,destCity,depDay,depMonthYear,priceCriteria,minusPlusDateTrl,dureeTrl)
{
	if (formCurrent != null)
		valFormCurrent = formCurrent;
l('<script language="JavaScript">');
l('<!--');
l('dom=document.getElementById?true:false');
l('function hideAll()');
l('{');
l('	hide(\'flt\');');
l('	hide(\'trl\');');
l('	hide(\'trn\');');
l('}');

l('function hide(idLayer)');
l('{');
l('	cLayer=dom?document.getElementById(idLayer).style:document.all[idLayer].style;');
l('	if (idLayer == \'flt\')');
l('		document.iflt.src = \'/img/volb_sb.gif\';');
l('	else if (idLayer == \'trl\')');
l('		document.itrl.src = \'/img/packageb_sb.gif\';');
l('	else if (idLayer == \'trn\')');
l('		document.itrn.src = \'/img/trainb_sb.gif\';');
l('	cLayer.display=\'none\';');
l('}');
l('');
l('');
l('function show(idLayer)');
l('{');
l('	cLayer=dom?document.getElementById(idLayer).style:document.all[idLayer].style;');
l('	cLayer.display=\'block\';');
l('	');
l('	if (idLayer == \'flt\'){');
l('		hide(\'tdFormAdv5\');');
l('		hide(\'tdFormAdv6\');');
l('		hide(\'tdFormAdv7\');');
l('		hide(\'tdFormAdv8\');');
l('		document.iflt.src = \'/img/volbr_sb.gif\';}');
l('	else if (idLayer == \'trl\')');
l('	{');
l('		hide(\'tdFormAdv5\');');
l('		hide(\'tdFormAdv6\');');
l('		hide(\'tdFormAdv7\');');
l('		hide(\'tdFormAdv8\');');
l('		document.itrl.src = \'/img/packagebr_sb.gif\';');

var lstDest =  null;
var tagDestCity = "";
for(var i=0;i<lstDestinations.length;i++)
{
	if( lstDestinations[i]== destCity)
		tagDestCity = lstDestinations[i];
}
l('createobjDest(document.formSearch.ctrVoyDestination,"'+tagDestCity+'");');

l('	}');
l('	else if (idLayer == \'trn\'){');
l('		hide(\'tdFormAdv5\');');
l('		hide(\'tdFormAdv6\');');
l('		hide(\'tdFormAdv7\');');
l('		hide(\'tdFormAdv8\');');
l('		document.itrn.src = \'/img/trainbr_sb.gif\';}');
l('	valFormCurrent = idLayer;');
l('}');
l('');
l('');
l('function togglefltPrime(idCurrent)');
l('{	');
l('	if (idCurrent.disabled == true)');
l('		idCurrent.disabled = false;');
l('	else');
l('	{	');
l('		idCurrent.value = 0;');
l('		idCurrent.disabled = true;');
l('	}		');
l('}');
l('');
l('function togglefltWay(objectVal1,objectVal2)');
l('{');
l('	if (objectVal1.disabled == true)');
l('	{');
l('		objectVal1.disabled = false;');
l('		objectVal2.disabled = false;');
l('	}');
l('	else');
l('	{	');
l('		objectVal1.disabled = true;');
l('		objectVal2.disabled = true;');
l('	}');
l('}');
l('');
l('//-->');
l('');
l('</script>');
l('');
l('');
l('<table cellspacing="0" cellpadding="0" border="0" width="206">');
l('  <tr>');
l('    <td width="15"></td>');
l('    <td width="212" height="34" align="right">');
l('    <table width="191" height="34" cellspacing="0" cellpadding="0" border="0" background="/img/pic062.gif">');
l('      <tr>');
l('        <td height="3" colspan="3"></td>');
l('      </tr>');
l('    </table>');
l('    </td>');
l('  </tr>');
l('  <!-- END : TITLE -->');


l('  <!-- START : FORM -->');
l('  <tr>');
l('    <td background="/img/pic063.gif" height="248" colspan="2" valign="top" align="right">');
l('    ');
l('  <table width="206" cellspacing="0" cellpadding="0" border="0">');
l('	 <tr><td><img src="/img/t.gif" width=8 height=1></td>');
l('  <td width="30" valign="top">');
l('  ');
l('  <a style="cursor: pointer;" onclick=hideAll();show(\'flt\');>');
l('  <img src="/img/pic024.gif" width=42 height=49 border="0" alt="Rechercher un vol" name="iflt" ></a><br>');
l('  <a style="cursor: pointer;" onclick=hideAll();show(\'trl\');>');
l('  <img src="/img/pic028.gif" width=42 height=49 border="0" alt="Rechercher un voyage" name="itrl" ></a><br>');
l('  <a style="cursor: pointer;" onclick=hideAll();show(\'trn\');>');
l('  <img src="/img/pic050.gif" width=42 height=49 border="0" alt="Rechercher un train" name="itrn" ></a><br>');
l('  </td>');
l('  ');
l('  <td valign="top" align="center" class="TexteNoirNormal">');
l('  ');
l('	  <form name="formSearch" method="POST" action="">');

// DIV FLIGHT
l('        <!-- DIV FLIGHT -->');
w('<input type=hidden name="D_Month" id="D_Month" value="">');
w('<input type=hidden name="R_Month" id="R_Month" value="">');
w('<input type=hidden name="D_Day" id="D_Day" value="">');
w('<input type=hidden name="R_Day" id="R_Day" value="">');
w('<input type=hidden name="D_Time" id="D_Time" value="ANY">');
w('<input type=hidden name="R_Time" id="R_Time" value="ANY">');
w('<input type=hidden name="numAdu" id="numAdu" value="1">');
w('<input type=hidden name="numEnf" id="numEnf" value="0">');
w('<input type=hidden name="FCT" id="FCT" value="AAGETAVAIL">');
w('<input type=hidden name="origin" id="origin" value="">');

//Master pricer 
w('<input type=hidden name="ADVANCED_SEARCH" value="false">');
w('<input type=hidden name="TRIP_TYPE" value="">');
w('<input type=hidden name="B_LOCATION_IN" value="">');
w('<input type=hidden name="E_LOCATION_IN" value="">');
w('<input type=hidden name="D_DATE" value="">');
w('<input type=hidden name="R_DATE" value="">');
w('<input type=hidden name="TRAVELLER_TYPE_1" value="">');
w('<input type=hidden name="HAS_INFANT_1" value="false">');
w('<input type=hidden name="TRAVELLER_TYPE_2" value="">');
w('<input type=hidden name="HAS_INFANT_2" value="false">');
w('<input type=hidden name="TRAVELLER_TYPE_3" value="">');
w('<input type=hidden name="HAS_INFANT_3" value="false">');
w('<input type=hidden name="TRAVELLER_TYPE_4" value="">');
w('<input type=hidden name="HAS_INFANT_4" value="false">');
w('<input type=hidden name="TRAVELLER_TYPE_5" value="">');
w('<input type=hidden name="HAS_INFANT_5" value="false">');
w('<input type=hidden name="TRAVELLER_TYPE_6" value="">');
w('<input type=hidden name="HAS_INFANT_6" value="false">');
w('<input type=hidden name="TRAVELLER_TYPE_7" value="">');
w('<input type=hidden name="HAS_INFANT_7" value="false">');
w('<input type=hidden name="TRAVELLER_TYPE_8" value="">');
w('<input type=hidden name="HAS_INFANT_8" value="false">');
w('<input type=hidden name="TRAVELLER_TYPE_9" value="">');
w('<input type=hidden name="HAS_INFANT_9" value="false">');
w('<input type=hidden name="TRAVELLER_TYPE_10" value="">');
w('<input type=hidden name="WAITING_SCREEN" value="OK">');
w('<input type=hidden name="D_ANYTIME" value="">');
w('<input type=hidden name="R_ANYTIME" value="">');

//TEST GDS
if (frameOrigin!="FREE")
{
w('<input type=hidden name="BV_EngineID" value="">');
w('<input type=hidden name="BV_SessionID" value="">');
}

//TEST GDS
w('<input type=hidden name="CHANNEL" value="">');
w('<input type=hidden name="value2" value="sssss">');

l('        <div id="flt">');
for (i=1 ;i<=10;i++){
w('<input type=hidden name="PaxType'+i+'" value="000">');
w('<input type=hidden name="PaxType'+i+'_Infant_Option" value="YES">');
w('<input type=hidden name="PaxType'+i+'_Infant" value="N">');
}

w('<input type=hidden name="FORWARDING_ACTION" value="">');
w('<input type=hidden name="Destination#1_DIRECT_NON_STOP" value="N">');
w('<input type=hidden name="Destination#1_Airline#1" value="00">');
w('<input type=hidden name="Destination#1_Airline#2" value="00">');
w('<input type=hidden name="Destination#1_Airline#3" value="00">');
w('<input type=hidden name="SEARCH_BY" value="2">');
w('<input type=hidden name="TripType" value="2">');
w('<input type=hidden name="ClassOfService" value="E">');
l('<input name="fltdc1" id="fltdc1" type="hidden" value="'+putDateDelay(fltDelay)+'">');
l('<input name="fltdc2" id="fltdc2" type="hidden" value="'+putDateDelay(fltDelay)+'">');
l('<input name="fltdc3" id="fltdc3" type="hidden" value="'+putDateDelay(fltDelay)+'">');

l('<table width="150" border="0">');
l('  <tr>');
l('    <td valign="left"><font class="TexteNoirNormal">De :</font></td>');
l('    <td align="left">');
l('    <input type="text" name="D_City" id="D_City" class="content_text" maxlength="100" size="20"></td>');
l('  </tr>');
l('  <tr>');
l('    <td valign="left"><font class="TexteNoirNormal">Vers :</font></td>');
l('    <td align="left">');
l('    <input type="text" name="A_City" id="A_City" class="content_text" maxlength="100" size="20"></td>');
l('  </tr>');
l('  <tr>');
l('    <td height="23" valign="middle"><font class="TexteNoirNormal">D&eacute;part ');
l('    :</font></td>');
l('    <td></td>');
l('  </tr>');
l('  <tr>');
l('    <td><select name="ctrVolDepartJour" id="ctrVolDepartJour" onChange="javascript:updateRetour(ctrVolDepartJour,ctrVolDepartMois,ctrVolRetourJour,ctrVolRetourMois,\'Vol\',\'Depart\',\'Retour\')" class="content_listbox">');
writeDaysDates(fltDelay);
l('    </select></td>');
l('    <td><select name="ctrVolDepartMois" id="ctrVolDepartMois" onChange="javascript:updateRetour(ctrVolDepartJour,ctrVolDepartMois,ctrVolRetourJour,ctrVolRetourMois,\'Vol\',\'Depart\',\'Retour\')" class="content_listbox">');
writeMonthsDates(fltDelay, 13,0);
l('    </select>&nbsp;<a href="javascript:void(0)" onClick="fGetDateAgenda(ctrVolDepartJour,ctrVolDepartMois,fltdc2);gfPop.fEndPop(ctrVolDepartJour,ctrVolDepartMois,fltdc1,fltdc2);return false;" HIDEFOCUS><img name="popcal" valign="middle" src="/img/pic195.gif" border="0"></a></td>');
l('  </tr>');
l('  <tr>');
l('    <td colspan="2">');
l('    <input type="checkbox" name="inputVolAllerSimple" id="inputVolAllerSimple" class="content_checkbox" onClick="javascript:togglefltWay(ctrVolRetourJour,ctrVolRetourMois);"><font class="TexteNoirNormal"> ');
l('    Aller simple </font></td>');
l('  </tr>');
l('  <tr>');
l('    <td valign="left"><font class="TexteNoirNormal">Retour :</font></td>');
l('    <td></td>');
l('  </tr>');
l('  <tr>');
l('    <td><select name="ctrVolRetourJour" id="ctrVolRetourJour" class="content_listbox">');
writeDaysDates(fltDelay+7);
l('   </select></td>');
l('   <td><select name="ctrVolRetourMois" id="ctrVolRetourMois" class="content_listbox">');
writeMonthsDates(fltDelay, 19, 7);
l('   </select>&nbsp;<a href="javascript:void(0)" onclick="fGetDateAgenda(ctrVolRetourJour,ctrVolRetourMois,fltdc3);gfPop.fEndPop(ctrVolRetourJour,ctrVolRetourMois,fltdc2,fltdc3);return false;" HIDEFOCUS><img name="popcal" valign="middle" src="/img/pic195.gif" border="0"></a></td>');
l(' </tr>');
l(' <tr>');
l('   <td colspan="2">');
l('   <input type="checkbox" name="MINUS_PLUS_DATE" id="MINUS_PLUS_DATE" value="OK" class="content_checkbox"><font class="TexteNoirNormal"> ');
l('   Dates flexibles (+/-1jour)</font>');
l(' </td>');
l(' </tr>');l('            <tr>');
l('   <td colspan="2">');
if (!this.frameOrigin)
{
	this.frameOrigin="NOFRAME";
}
if (this.frameOrigin!="FREE")
{
	l(' <input type="checkbox" name="inputVolUtiliserSMiles" id="inputVolUtiliserSMiles" class="content_checkbox" onClick="javascript:togglefltPrime(ctrVolNbBebes); eval(MINUS_PLUS_DATE.checked=false); togglefltPrime(MINUS_PLUS_DATE);"><font class="TexteNoirNormal"> ');
	l(' Utiliser mes S&#39;Miles</font>');
}
else
{
	l(' <input type="hidden" name="inputVolUtiliserSMiles" id="inputVolUtiliserSMiles" class="content_checkbox" onClick="javascript:togglefltPrime(ctrVolNbBebes);"><font class="TexteNoirNormal"> ');
}
l(' </td>');
l(' </tr>');
l(' <tr>');
l('   <td valign="left"><select name="ctrVolNbAdultes" id="ctrVolNbAdultes" class="content_listbox" onChange="javascript:selectPax(ctrVolNbAdultes,ctrVolNbEnfants);updateBebe(ctrVolNbAdultes,ctrVolNbBebes)">');
l('   <option value="1" selected>1</option>');
l('   <option value="2">2</option>');
l('   <option value="3">3</option>');
l('   <option value="4">4</option>');
l('   <option value="5">5</option>');
l('   <option value="6">6</option>');
l('   <option value="7">7</option>');
l('   <option value="8">8</option>');
l('   <option value="9">9</option>');
l('   </select></td>');
l('   <td><font class="TexteNoirNormal">Adulte(s)</font></td>');
l(' </tr>');
l(' <tr>');
l('   <td valign="left"><select name="ctrVolNbEnfants" id="ctrVolNbEnfants" class="content_listbox" onChange="javascript:selectPax(ctrVolNbEnfants,ctrVolNbAdultes)">');
l('   <option value="0" selected>0</option>');
l('   <option value="1">1</option>');
l('   <option value="2">2</option>');
l('   <option value="3">3</option>');
l('   <option value="4">4</option>');
l('   <option value="5">5</option>');
l('   <option value="6">6</option>');
l('   <option value="7">7</option>');
l('   <option value="8">8</option>');
l('   <option value="9">9</option>');
l('   </select></td>');
l('   <td><font class="TexteNoirNormal">Enfant(s) -12 ans</font></td>');
l(' </tr>');
l(' <tr>');
l('   <td valign="left"><select class="content_listbox" name="ctrVolNbBebes" id="ctrVolNbBebes">');
l('   <option value="0" selected>0</option>');
l('   <option value="1">1</option>');
l('   </select></td>');
l('   <td><font class="TexteNoirNormal" name="txtselect3" id="txtselect3">Enfant(s) -2 ans </font></td>');
l(' </tr>');
l('    </table>');
l('  </div>');
l('  <!-- FIN DIV FLIGHT -->');


w('<input type=hidden name="category" id="category" value="">');
w('<input type=hidden name="zone" id="zone" value="">');
w('<input type=hidden name="country" id="country" value="">');
w('<input type=hidden name="mes" id="mes" value="">'); 
w('<input type=hidden name="OPTION" id="OPTION" value="">');

// DIV TRAVLE
l('	<!-- DIV TRAVLE -->');
l('	<div id="trl">');
l('              <table width=150 border=0>');

	// SELECTIONNER VOS CRITERES
l('  <tr> ');
l('    <td colspan="2"><font class=TexteNoirNormal>S&eacute;lectionnez vos crit&egrave;res ');
l('      :<br>');
l('      </font></td>');
l('  </tr>');
l('	<tr> ');
l('   <td colspan="2"><img src="/img/t.gif" width="1" height="5" /></td>');
l(' </tr>');

	// VILLE DE DEPART
l(' <tr> ');
l('   <td colspan="2"><font class=TexteNoirNormal>Ville de départ :</font></td>');
l(' </tr>');
l(' <tr> ');
l('   <td colspan="2">');
l('<select name=ctrDepCityVoyage id=ctrDepCityVoyage class=content_listbox>');
l('  <option value="" selected>Indifférent</option>');
var tagDepCity = -1;
for(var i=0;i<lstDepartureCity.length;i++)
{
	if( lstDepartureCity[i]==depCity )
		tagDepCity = i;
}
writeOptionList(tagDepCity,lstDepartureCity);
l('                    </select></td>');
prefill (document.LinkForm.OPTION, document.formSearch.ctrDepCityVoyage);
l('  </tr>');
l(' <tr> ');
l('   <td colspan="2"><img src="/img/t.gif" width="1" height="5" /></td>');
l('  </tr>');
	
	// FORMULE
l('<tr> ');
l('  <td colspan="2"><font class=TexteNoirNormal>Formule de voyage :</font></td>');
l('</tr>');
l('<tr> ');
l('  <td colspan="2">');
l('			<select name=ctrVoyTypeVoyage id=ctrVoyTypeVoyage class=content_listbox onChange="if(this.options[this.selectedIndex].value!=\'SEJOURS AVION + HOTEL\'){submitForm();return false;}">');
l('  	<option value="SEJOURS AVION + HOTEL">Séjours</option>');
l('   	<option value="WEEKENDS - COURTS_SEJOURS">Week-end courts séjours</option>');
l('   <option value="CIRCUITS">Circuits</option>');
l('   <option value="LOCATIONS DE VACANCES">Locations vacances</option>');
l('  	<option value="CROISIERE">Croisières</option>');
l('	</select></td>');
l('</tr>');
l('</tr>');
l('<tr> ');
l('  <td colspan="2"><img src="/img/t.gif" width="1" height="5" /></td>');
l('</tr>');

l('	<tr> ');
l('  		<td colspan="2"><font class=TexteNoirNormal>Destination :</font></td>');
l('	</tr>');
l('	<tr> ');
l('<td colspan="2">');
l('<select name=ctrVoyDestination id=ctrVoyDestination class=content_listbox style="width:150px;">');
l(' <option value="NOT" selected>Indifférent</option>');
l(' </select>');
l('</td>');
l('</tr>');
l('<tr> ');
l('<td colspan="2"><img src="/img/t.gif" width="1" height="5" /></td>');
l('</tr>');

//departure
l('<tr>');
l('	<td colspan="2"><font class=TexteNoirNormal>D&eacute;part :</font></td>');
l('</tr>');
l('<tr>');
l('	<td>');
l('<select name="ctrTrlDepDay" id="ctrTrlDepDay" class="content_listbox">');
l('<option value="ANY_DAY" >   </option>');
writeDaysDates(7,depDay, true);
l('              			</select>');
if(depDay!=""&&depDay!=null) 
	document.formSearch.ctrTrlDepDay.value=depDay;
w('</td>');
l('       		<td>');
l('	<select name="ctrTrlDepMonthYear" id="ctrTrlDepMonthYear" class="content_listbox">');
l('	<option value="ANY_MONTH" >ts les mois</option>');
writeMonthsDates(0,19,7, true);
l('              			</select>');
if(depMonthYear!=""&&depMonthYear!=null) 
	document.formSearch.ctrTrlDepMonthYear.value=depMonthYear;

w('&nbsp;<a href="javascript:void(0)" onclick="fGetDateAgenda(ctrTrlDepDay,ctrTrlDepMonthYear,fltdc3);gfPop.fEndPop(ctrTrlDepDay,ctrTrlDepMonthYear,fltdc2,fltdc3);return false;" HIDEFOCUS><img name="popcal" valign="middle" src="/img/pic195.gif" border="0"></a>');
l('				</td>');
l('            		</tr>');

//dates flexibles
l('		<tr><td colspan="2" align="left">');
l('		<select name="flexibleDepartureDate"  class=content_listbox>');
l('		  <option value="0">à +/- 0 jours</option>');
l('		  <option value="1">à +/- 1 jours</option>');
l('		  <option value="2">à +/- 2 jours</option>');
l('	    <option value="3">à +/- 3 jours</option>');
l('	    <option value="4" selected="selected">à +/- 4 jours</option>');
l('		</select>');
l('		</td></tr>');
if(minusPlusDateTrl!=undefined){document.formSearch.flexibleDepartureDate.value = minusPlusDateTrl;}

//duree
l('	<tr>');
l('  		<td colspan="2"><font class=TexteNoirNormal>Dur&eacute;e :</font></td>');
l('	</tr>');
l('	<tr>');

w('                            <td colspan="2"> ');
l('					<select name="ctrVoyDuree" id="ctrVoyDuree" class="content_listbox" style="width:142px;">');
//by default duree must be "Une Semaine" 
	if (dureeTrl=="" || dureeTrl==null)
		dureeTrl = "1";
if(dureeTrl=="NOT")
	w('						<option value="" selected="selected">Indifférent</option>');
else
	w('						<option value="" >Indifférent</option>');
if(dureeTrl=="0")
	w('						<option value="0" selected="selected">Courts Séjours (1-5 Nuits)</option>');
else
	w('						<option value="0">Courts Séjours (1-5 Nuits)</option>');
if(dureeTrl=="1")
	w('						<option value="1" selected="selected">Une Semaine (6-9 Nuits)</option>');
else
	w('						<option value="1">Une Semaine (6-9 Nuits)</option>');
if(dureeTrl=="2")
	w('						<option value="2" selected="selected">Deux Semaines (10-16 Nuits)</option>');
else
	w('						<option value="2">Deux Semaines (10-16 Nuits)</option>');
w('                    			</select>');
l('				</td>');
l('                	</tr>');

//prix
l(' <tr>');
l('  		<td colspan="2"><font class=TexteNoirNormal>Prix :</font></td>');
l(' </tr>');
l(' <tr>');
l('  		<td colspan="2">');
w('	<select name="ctrVoyPrix" id="ctrVoyPrix" class="content_listbox">');
if(priceCriteria == "" && priceCriteria != null)
			w('<option value="" selected="selected" >Indifférent</option>');
			else
			w('<option value="">Indifférent</option>');
if(priceCriteria == "0-300" && priceCriteria != null)
			w('<option value="0-300" selected="selected" >Moins de 300€</option>');
			else
			w('<option value="0-300" >Moins de 300€</option>');
if(priceCriteria == "300-449" && priceCriteria != null)
			w('<option value="300-449" selected="selected" >Entre 300€ et 449€</option>');
			else
			w('<option value="300-449" >Entre 300€ et 449€</option>');
if(priceCriteria == "450-599" && priceCriteria != null)
			w('<option value="450-599" selected="selected" >Entre 450€ et 599€</option>');
			else
			w('<option value="450-599" >Entre 450€ et 599€</option>');
if(priceCriteria == "600-749" && priceCriteria != null)
			w('<option value="600-749" selected="selected" >Entre 600€ et 749€</option>');
			else
			w('<option value="600-749" >Entre 600€ et 749€</option>');
if(priceCriteria == "751" && priceCriteria != null)
			w('<option value="751" selected="selected" >Plus de 750€</option>');
			else
			w('<option value="751" >Plus de 750€</option>');
w('</select>');
//alert(ctrVoyPrix);
//if (ctrVoyPrix) alert(ctrVoyPrix.value);
//if (valPriceCriteria) alert(valPriceCriteria);
//if (valPriceCriteria) alert(valPriceCriteria);


//check ctrVoyPrix is passed in the linkform.
//prefill (document.LinkForm.ctrVoyPrix, document.formSearch.ctrVoyPrix);
//if(ctrVoyPrix!=""&&ctrVoyPrix!=null) 
//	{document.formSearch.ctrVoyPrix.value=ctrVoyPrix;}
l('</td>');
l('</tr>');

l('</table>');
l('	</div>');
l('<!-- FIN DIV TRAVEL -->');

// DIV TRAIN
l('<!-- DIV TRAIN -->');
		
l('<div id="trn">');

w('<input type=hidden name="DESTINATION" id="DESTINATION" value="">');
w('<input type=hidden name="JOUR_DEPART_ALLER" id="JOUR_DEPART_ALLER" value="">');
w('<input type=hidden name="MOIS_DEPART_ALLER" id="MOIS_DEPART_ALLER" value="">');
w('<input type=hidden name="JOUR_DEPART_RETOUR" id="JOUR_DEPART_RETOUR" value="">');
w('<input type=hidden name="MOIS_DEPART_RETOUR" id="MOIS_DEPART_RETOUR" value="">');
w('<input type=hidden name="HEURE_DEPART_ALLER" id="HEURE_DEPART_ALLER" value="">');
w('<input type=hidden name="HEURE_DEPART_RETOUR" id="HEURE_DEPART_RETOUR" value="">');
w('<input type=hidden name="ORIGINE" id="ORIGINE" value="">');
w('<input type=hidden name="EXPRESS_BOOKING" id="EXPRESS_BOOKING" value="">');
l('<input name="trndc1" id="trndc1" type="hidden" value="'+putDateDelay(trnDelay)+'">');
l('<input name="trndc2" id="trndc2" type="hidden" value="'+putDateDelay(trnDelay)+'">');
l('<input name="trndc3" id="trndc3" type="hidden" value="'+putDateDelay(trnDelay)+'">');

l('<table width=150 border=0>');
l(' <tr> ');
l('   <td valign=left><font class=TexteNoirNormal>De :</font></td>');
l('   <td colspan="2" align="left"><input type=text name=ctrTrainDe id=ctrTrainDe class=content_text maxlength=100></td>');
l(' </tr>');
l(' <tr> ');
l('   <td valign=left><font class=TexteNoirNormal>Vers :</font></td>');
l('   <td colspan="2" align="left"><input type=text name=ctrTrainVers id=ctrTrainVers class=content_text maxlength=100></td>');
l(' </tr>');
l(' <tr> ');
l('   <td height="23" colspan="3" valign=middle><font class=TexteNoirNormal>D&eacute;part ');
l('     :</font></td>');
l(' </tr>');
l(' <tr> ');
l('   <td valign=left><select name=ctrTrainDepartJour id=ctrTrainDepartJour onChange="javascript:updateRetour(ctrTrainDepartJour,ctrTrainDepartMois,ctrTrainRetourJour,ctrTrainRetourMois,\'Train\',\'Depart\',\'Retour\')" class=content_listbox>');
writeDaysDates(trnDelay);
l('   </select></td>');
l(' <td><select name=ctrTrainDepartMois id=ctrTrainDepartMois onChange="javascript:updateRetour(ctrTrainDepartJour,ctrTrainDepartMois,ctrTrainRetourJour,ctrTrainRetourMois,\'Train\',\'Depart\',\'Retour\')" class=content_listbox>');
writeMonthsDates(trnDelay, 3,0);
l('    </select></td>');
l('  <td><a href="javascript:void(0)" onclick="fGetDateAgenda(ctrTrainDepartJour,ctrTrainDepartMois,trndc2);gfPop.fEndPop(ctrTrainDepartJour,ctrTrainDepartMois,trndc1,trndc2);return false;" HIDEFOCUS><img name="popcal" valign="middle" src="/img/pic195.gif" border="0"></a></td>');
l('</tr>');
l('<tr> ');
l('  <td colspan="3"><font class=TexteNoirNormal>Horaire : ');
l('    <select name=ctrTrainDepartHeure id=ctrTrainDepartHeure class=content_listbox>');
writeOptionList(11,lstHoursTrn);
l('    </select>');
l('    </font></td>');
l('</tr>');
l('<tr> ');
l('  <td colspan="3"></td>');
l('</tr>');
l('<tr> ');
l('  <td></td>');
l('</tr>');
l('<tr> ');
l('  <td colspan="3" valign=left><font class=TexteNoirNormal>Retour ');
l('    :</font></td>');
l('</tr>');
l('<tr> ');
l('  <td><select name=ctrTrainRetourJour id=ctrTrainRetourJour class=content_listbox>');
writeDaysDates(trnDelay);
l('  </select></td>');
l('<td><select name=ctrTrainRetourMois id=ctrTrainRetourMois class=content_listbox>');
writeMonthsDates(trnDelay, 3,0);
l('    </select></td>');
l('  <td><a href="javascript:void(0)" onclick="fGetDateAgenda(ctrTrainRetourJour,ctrTrainRetourMois,trndc3);gfPop.fEndPop(ctrTrainRetourJour,ctrTrainRetourMois,trndc2,trndc3);return false;" HIDEFOCUS><img name="popcal" valign="middle" src="/img/pic195.gif" border="0"></a></td>');
l('</tr>');
l('<tr> ');
l('  <td colspan="3"><font class=TexteNoirNormal> Horaire : ');
l('    <select name=ctrTrainRetourHeure id=ctrTrainRetourHeure class=content_listbox>');
writeOptionList(11,lstHoursTrn);
l('      </select>');
l('      </font></td>');
l('  </tr>');
l('  <tr> ');
l('    <td colspan="3"></td>');
l('  </tr>');
l('  <tr> ');
l('    <td colspan="3" valign=left><font class=TexteNoirNormal>N&deg; ');
l('      de passagers :</font> <select name=ctrTrainNbPersonnes id=ctrTrainNbPersonnes class=content_listbox>');
l('        <option value="0">0</option>');
l('        <option value="1" selected>1</option>');
l('        <option value="2">2</option>');
l('        <option value="3">3</option>');
l('        <option value="4">4</option>');
l('        <option value="5">5</option>');
l('        <option value="6">6</option>');
l('      </select> </td>');
l('  </tr>');
l('  <tr> ');
l('    <td align="right" valign=left> <input type="radio" name="TrainClasse" id="TrainClasse" value="A"> ');
l('    </td>');
l('    <td colspan="2"><font class=TexteNoirNormal>1&egrave;re classe</font> ');
l('    </td>');
l('  </tr>');
l('  <tr> ');
l('    <td align="right" valign=left> <input name="TrainClasse" id="TrainClasse" type="radio" value="B" checked> ');
l('    </td>');
l('    <td colspan="2"><font class=TexteNoirNormal>2&egrave;me classe</font></td>');
l('  </tr>');
l('</table>');
l('</div>');
l('<!-- FIN DIV TRAIN -->');


l('');
l('        ');
l('        </td>');
l('      </tr>');
l('    </table>');
l('    </td>');
l('  </tr>');
l('  <!-- END : FORM -->');


l('  <!-- START : BUTTONS -->');
l('  <tr>');
l('    <td width="15"></td>');
l('    <td width="212" height="33" align="right">');
l('    <table width="191" height="33" cellspacing="0" cellpadding="0" border="0" background="/img/pic067.gif">');
l('      <tr>');
l('        <td width="56"></td>');
l('        <td width="24" height="20" class="search_button">');


l('        <input type="image" src="/img/pic075.gif" width="19" height="19" border="0" onClick="isSameDay();submitForm();return false;" alt/></td>');

l('        <td height="20">');
l('        <a href="/" class="button" onClick="isSameDay();submitForm();return false;">Rechercher</a></td>');
l('        <td width="15"></td>');
l('      </tr>');
l('    </table>');
l('    </td>');
l('  </tr>');
l('  <!-- END : BUTTONS -->');
l('  <!-- START : OPTIONS -->');
l('  <tr valign="top">');
l('    <td width="212" height="35" class="search_option" align="right" colspan="2">');
l('    	<table width="191" height="35" cellspacing="0" cellpadding="0" border="0" background="/img/pic060.gif" >');
l('      	<tr>');
l('       <td width="4" align="left" height="1" valign="top"><img src="/img/t.gif" width="56" height="1" /></td>');
l('       <td id="tdFormAdv1" name="tdFormAdv1" width="20" height="13" valign="top" ><img src="/img/pic083_sb.gif" width="13" height="13" border="0" alt></td>');
l('       <td id="tdFormAdv2" name="tdFormAdv2" class="search_option" valign="top" ><a href="/" class="vv_lien_bleuCD" onClick="isSameDay();submitFormAdv(); return false;">Ajouter des crit&egrave;res</a></td>');
l('       <td id="tdFormAdv3" width="15" height="1" valign="top"><img src="/img/t.gif" width="1" height="1" /></td>');		
l('       <td id="tdFormAdv4" width="15" height="1" style="display:none;" valign="top"><img src="/img/t.gif" width="1" height="1" /></td>');
l('       <td id="tdFormAdv5" name="tdFormAdv1" width="20" height="13" valign="top" ><img src="/img/t.gif" width="1" height="13" border="0" alt></td>');
l('       <td id="tdFormAdv6" name="tdFormAdv2" class="search_option" valign="top" ><img src="/img/t.gif" /></td>');
l('       <td id="tdFormAdv7" width="15" height="1" valign="top"><img src="/img/t.gif" width="1" height="1" /></td>');		
l('       <td id="tdFormAdv8" width="15" height="1" style="display:none;" valign="top"><img src="/img/t.gif" width="1" height="1" /></td>');
l('      	</tr>');
l('    	</table>');
l('    </td>');
l('  </tr>');



l('  <!-- END : OPTIONS -->');
l('</form>');
l('<!-- END SEARCH BOX -->');
l('');
l('<script language="JavaScript">');
l('<!--');
l('');
l('hideAll();');
l('show(valFormCurrent);');
l('');
l('//-->');
l('</script>');
} 

<!-- htdocs\safari\js\search_box.js VERSION 1.61 -->
