// ouverture d'une fenêtre version "accessible"
function OpenWindowByTarget(target, url, width, height, top, left) {
var wdw;
var options = "status=yes,location=yes,menubar=yes,toolbar=yes,resizable=yes,scrollbars=yes";
wdw = window.open(url, target, "top="+top+",left="+left+",width="+width+",height="+height+","+options);
wdw.focus();
return false;
}
// activation / désactivation de l'affichage d'un élément
function displayElement(elementId) {
var display = document.getElementById(elementId).style.display;
if (display == "block")
document.getElementById(elementId).style.display = "none";
else
document.getElementById(elementId).style.display = "block";
}
// insertion du lien vers les listes des arrêts et lieux publics
function insertGetPointsList(typePT, DepArr, formName, separateur) {
var html = "";
if (typePT == 0 || typePT == 2) {
// lien vers les arrêts
if (DepArr == "Via")
html = separateur + 'Arrêts';
else if (DepArr == "Arr")
html = separateur + 'Arrêts';
else
html = separateur + 'Arrêts';
}
if (typePT == 0 || typePT == 1) {
// lien vers les lieux publics
if (DepArr == "Via")
html = separateur + 'Lieux publics';
else if (DepArr == "Arr")
html = separateur + 'Lieux publics';
else
html = separateur + 'Lieux publics';
}
document.write(html);
}
// accès à la liste des points d'arrêt / lieux publics
function getPointsList(type, dest, formName, rub_code)
{
// récup de l'objet commune (hidden ou combo)
var obj = eval("document." + formName + ".com" + dest);
if (obj.type != "hidden")
var comID = obj.options[obj.selectedIndex].value;
else
var comID = obj.value;
var listPopup = window.open("/ri/popup.asp?rub_code=" + rub_code + "&type=" + type + "&dest=" + dest + "&comID=" + comID, "listPopup", "width=600,height=560,top=0,left=150,resizable=yes,scrollbars=yes,menubar=no,status=no");
listPopup.focus();
}
function ChangeValueInUrl(oldUrl, attributeName, newValue)
{
i1 = oldUrl.indexOf("&" + attributeName + "=");
if(-1 != i1)
{
i2 = oldUrl.indexOf("&", i1 + 1);
return oldUrl.substring(0, i1) + "&" + attributeName + "=" + newValue + newhref.substring(i2);
}
else return oldUrl + "&" + attributeName + "=" + newValue
}
function FindCheckedValue(id)
{
checkedValue = "";
var ctrlList = document.getElementsByTagName("input");
for(i=0; i< ctrlList.length; i++)
{
if(ctrlList.item(i).id == id)
{
if(ctrlList.item(i).checked)
{
checkedValue = ctrlList.item(i).value;
break;
}
}
}
return checkedValue;
}
function replaceKeywordsAndPoint(DepArr)
{
newKeywordsList = document.getElementsByName('keywords' + DepArr);
savedPointList = document.getElementsByName('point' + DepArr);
if ((savedPointList.item.length == 1) && (savedPointList.item(0).value != ""))
{
newhref = ChangeValueInUrl(newhref, 'point' + DepArr, savedPointList.item(0).value);
}
if(newKeywordsList.item(0).value != "")
{
newhref = ChangeValueInUrl(newhref, 'keywords' + DepArr, newKeywordsList.item(0).value);
}
}
// DepArr peut valoir "Dep", "Arr" ou "DepArrVia"
function GetAllParameters(DepArr, newUrl)
{
newhref = newUrl;
// Il y a 2 contrôles "input" d'id 'typeDate'
typeDateValue = FindCheckedValue('typeDate');
// Il y a 2 contrôles "input" d'id 'radioDateOrPeriod'
radioDateOrPeriodValue = FindCheckedValue('radioDateOrPeriod');
newhref = ChangeValueInUrl(newhref, "radioDateOrPeriod", radioDateOrPeriodValue);
newhref = ChangeValueInUrl(newhref, "typeJour", encodeURIComponent(document.getElementById('typeJour').value));
newhref = ChangeValueInUrl(newhref, "typePeriod", encodeURIComponent(document.getElementById('typePeriod').value));
newhref = ChangeValueInUrl(newhref, "laDate", encodeURIComponent(document.getElementById('laDate').value));
newhref = ChangeValueInUrl(newhref, "typeDate", typeDateValue);
newhref = ChangeValueInUrl(newhref, "lHeure", document.getElementById('lHeure').value);
newhref = ChangeValueInUrl(newhref, "laMinute", document.getElementById('laMinute').value);
newhref = ChangeValueInUrl(newhref, "critereRI", document.getElementById('critereRI').value);
newhref = ChangeValueInUrl(newhref, "goodWalker", 0 + document.getElementById('goodWalker').checked);
if(-1 != DepArr.indexOf("Dep", 0))
{
replaceKeywordsAndPoint("Arr");
replaceKeywordsAndPoint("Via");
}
if(-1 != DepArr.indexOf("Arr", 0))
{
replaceKeywordsAndPoint("Dep");
replaceKeywordsAndPoint("Via");
}
if(-1 != DepArr.indexOf("Via", 0))
{
replaceKeywordsAndPoint("Dep");
replaceKeywordsAndPoint("Arr");
}
document.location.href = newhref;
return false;
}