function openwindow(url,l,h,s,r){ var largeur_ecran=screen.width; var hauteur_ecran=screen.height; var win=window.open(url,"_blank","scrollbars="+parseInt(s)+",resizable="+parseInt(r)+",width="+parseInt(l)+",height="+parseInt(h)+",top="+parseInt(((hauteur_ecran-h)/2)-50)+",left="+parseInt((largeur_ecran-l)/2)+""); }
function loadReturnCities(){ document.saisie.OUTWARD_DATE.value = ""; document.saisie.INWARD_DATE.value = ""; }
function resetReturnCities(){ i = 0; while (document.saisie.DESTINATION_COMBO.options.length){ document.saisie.DESTINATION_COMBO.options[i] = null; } }
function changeFromCities(range){ resetReturnCities(); i = 0; while (document.saisie.ORIGINE_COMBO.options.length){ document.saisie.ORIGINE_COMBO.options[i] = null; } i = 0; firstCityNum = arrFrom[range][1][0]; j = arrFrom[range][1][0]; lastCityNum = arrFrom[range][1][1]; while (j <= lastCityNum){ document.saisie.ORIGINE_COMBO.options[i] = new Option(arrCities[j][0], arrCities[j][0]); i++; j++; } }
function changeReturnCities(choix){ choix += firstCityNum; resetReturnCities(); i = 0; while (i < arrCities[choix][1].length){ document.saisie.DESTINATION_COMBO.options[i] = new Option(arrCities[choix][1][i], arrCities[choix][1][i]); i++; } }
function hideODBox(){ initODBox(); }
function showODBox(){ strDep = document.saisie.ORIGINE_COMBO.options[document.saisie.ORIGINE_COMBO.selectedIndex].text; strArr = document.saisie.DESTINATION_COMBO.options[document.saisie.DESTINATION_COMBO.selectedIndex].text; printODBoxMsg(strDep, strArr); }
function initODBox(){ document.getElementById('dv_ODBox').innerHTML = ''; }
function printODBoxMsg(strDep, strArr){ var strODBox = "<table border=0 cellpadding=0 cellspacing=0><tr><td class=txtselectod width=160>Vous avez s&eacute;lectionn&eacute; :</tc><td class=txtnoirgras>D&eacute;part : <span class=txtod>" + strDep.toUpperCase() + "</span>&nbsp;&nbsp;&nbsp;Arriv&eacute;e : <span class=txtod>" + strArr.toUpperCase() + "</span></td></tr></table>"; document.getElementById('dv_ODBox').innerHTML = strODBox; document.getElementById('dv_ODBox').style.display = 'block'; reWorkDate(strDep.toUpperCase(),strArr.toUpperCase()); if ((get("strDEP")!='') && (get("strARR")!='')) document.getElementById('dv_ODSelected').style.display = 'none'; }
function printODSelectMsg(strDep, strArr){ var strODBox = "<table border=0 cellpadding=0 cellspacing=0><tr><td class=txtselectod width=160>Vous avez s&eacute;lectionn&eacute; :</tc><td class=txtnoirgras>D&eacute;part : <span class=txtod>" + strDep.toUpperCase() + "</span>&nbsp;&nbsp;&nbsp;Arriv&eacute;e : <span class=txtod>" + strArr.toUpperCase() + "</span></td></tr></table>"; document.getElementById('dv_ODSelected').innerHTML = strODBox; document.getElementById('dv_ODSelected').style.display = 'block'; }
function validDate(data){ if (data != ''){ var TabDate = new Array; TabDate = data.split("/"); if (TabDate[0].length == 1) TabDate[0] = "0" + TabDate[0]; if (TabDate[1].length == 1) TabDate[1] = "0" + TabDate[1]; if (TabDate[2].length == 2) TabDate[2] = "20" + TabDate[2]; data = TabDate[0] + "/" + TabDate[1] + "/" + TabDate[2]; return(data); } else return(""); }
function validDateNb(data){ var strNb=0; var strNbList="0123456789"; for(i=0;i<data.length;i++){ if (strNbList.indexOf(data.charAt(i)) >= 0) strNb++; } return strNb; }
function showLayerRetour(id){ document.getElementById(id).style.display = 'block'; }
function hideLayerRetour(id){ document.getElementById(id).style.display = 'none'; }

// Implantation du calendrier
var calendTrn = new CalendarPopup("calendardiv");
calendTrn.setCssPrefix("CAL_STYLE"); calendTrn.setYearSelectStartOffset(0); calendTrn.setWeekStartDay(1); calendTrn.setDayHeaders("D","L","M","M","J","V","S"); calendTrn.setTodayText("Aujourd'hui"); calendTrn.setMonthNames("Janvier","Février","Mars","Avril","Mai","Juin","Juillet","Août","Septembre","Octobre","Novembre","Décembre");  
monthFr = new Array("janvier","février","mars","avril","mai","juin","juillet","août","septembre","octobre","novembre","décembre");
dayFr = new Array("lundi","mardi","mercredi","jeudi","vendredi","samedi","dimanche");

//Paramétrage URL strDEP et strARR
list = new Array; list_valeur = new Array; pos = document.location.href.indexOf("?",0);
if(pos >= 0){ requete = document.location.href.substring(pos+1, document.location.href.length); pos_and = requete.indexOf("&",0); if(pos_and >= 0) list = requete.split("&"); else list[0] = requete; for(i=0;i<list.length;i++){ temp = list[i].split("="); variable = temp[0]; valeur = temp[1]; plus_pos = valeur.indexOf("+",0); while (plus_pos >-1){ temp2 = valeur.substring(0,plus_pos) + ' ' + valeur.substring(plus_pos+1,valeur.length);	valeur = temp2;	plus_pos = valeur.indexOf("+",plus_pos+2); } list_valeur[variable] = valeur; } }
function get(get){ if(list_valeur[get]) return(unescape(list_valeur[get])); else return(""); }
function odSelect(){ if ((get("strDEP")!='') && (get("strARR")!='')){ printODSelectMsg(get("strDEP"), get("strARR")); document.saisie.ORIGINE.value = get("strDEP").toUpperCase(); document.saisie.DESTINATION.value = get("strARR").toUpperCase(); reWorkDate(get("strDEP"),get("strARR")); } }
