﻿/* Condition d'utilisation */
function showCondition(url,width, height) {
    Popup(url,"Condition_des_primes",width,height,"");
}

function Popup(url, name, width, height, options) {
var stroptions = "width="+ width +",height="+ height;
if(options.length > 0)
    stroptions +=","+ options;
    
    var nwin = window.open(url, name, stroptions).focus();
}

/* Recherche InfoLigne */
function InfoLigne(elm) {
			    window.open(elm[elm.selectedIndex].value);
}


function RechercheHoraire() {
    var defaultDay = "JJ/MM/AAAA";
    var defaultDepart = "Gare ou commune de départ";
    var defaultArrive = "Gare ou commune d’arrivée";

    var dateid= document.getElementById("ctl00_NavSearch_input_search_date") ;
    var departid= document.getElementById("ctl00_NavSearch_input_search_out") ;
    var arriveeid= document.getElementById("ctl00_NavSearch_input_search_in") ;
    var heureid = document.getElementById("ctl00_NavSearch_select_hours");

    if(departid.value == defaultDepart)
    {
        departSended = "";
    }
    else
    {
        departSended = departid.value;
    }

    if(arriveeid.value == defaultArrive)
    {
        arriveeSended = "";
    }
    else
    {
        arriveeSended = arriveeid.value;
    }
    //if(dateid != null && departid != null && arriveeid != null && heureid != null) 
    if(dateid != null)
    {
        var split = dateid.value.split('/');
        var j_aller = split[0];
        var m_aller = split[1];
        var h_aller = heureid[heureid.selectedIndex].value;
     }
    var stdUrl = "http://www.voyages-sncf.com/dynamic/_SvVsc?_CMD=CmdOrderTravel&EXPRESS_BOOKING=Y&ID_AGENCE=VSC&CODE_LANGUE=FR";
    var searchUrl = stdUrl +"&ORIGINE="+ departSended +"&DESTINATION="+ arriveeSended +"&JOUR_ALLER="+ j_aller +"&MOIS_ALLER="+ m_aller +"&HEURE_ALLER="+ h_aller;
    window.open(searchUrl);
}

