﻿function MM_openBrWindow(theURL,winName,features){ 
  addwindow=window.open(theURL,winName,features);
  addwindow.focus();}
 function nomversion(){
document.forms[0].TextBox1.value = navigator.appName}
function resizewin() { self.moveTo(0,0); x = screen.availWidth; y = screen.availHeight;
 //if(x > 840) x = 840; if(y > 610) y = 610;
  self.resizeTo(x,y);} 
function jourdeb(){
var madate2 =new Date(document.forms[0].DropDownList12.value,document.forms[0].DropDownList2.selectedIndex,document.forms[0].DropDownList1.selectedIndex+1,0,0,0)
var madate =new Date(madate2.getFullYear(),madate2.getMonth(),madate2.getDate());
document.forms[0].jrdeb.selectedIndex=madate.getDay();}
function jourfin(){
var madate2 =new Date(document.forms[0].DropDownList15.value,document.forms[0].DropDownList13.selectedIndex,document.forms[0].DropDownList14.selectedIndex+1,0,0,0)
var madate =new Date(madate2.getFullYear(),madate2.getMonth(),madate2.getDate());
document.forms[0].jrfin.selectedIndex=madate.getDay();}
function newdpl1(){
corrigerjourdeb();jourdeb();
var madate2 =new Date(document.forms[0].DropDownList12.value,document.forms[0].DropDownList2.selectedIndex,document.forms[0].DropDownList1.selectedIndex+1,0,0,0)
var madate =new Date(madate2.getFullYear(),madate2.getMonth(),madate2.getDate()+1);
var aujourdhui= new Date();majcalhid1(madate2);
document.forms[0].DropDownList13.selectedIndex=madate.getMonth();
document.forms[0].DropDownList14.selectedIndex=madate.getDate()-1;
document.forms[0].DropDownList15.selectedIndex=madate.getFullYear() -aujourdhui.getFullYear();
jourfin();
var madate3 =new Date(document.forms[0].DropDownList15.value,document.forms[0].DropDownList13.selectedIndex,document.forms[0].DropDownList14.selectedIndex+1,0,0,0)
cptnuits(madate2,madate3);majcalhid2(madate3);}
function newjourdpl1(){
var madate2 =new Date(document.forms[0].DropDownList12.value,document.forms[0].DropDownList2.selectedIndex,document.forms[0].DropDownList1.selectedIndex+1,0,0,0)
var madate =new Date(madate2.getFullYear(),madate2.getMonth(),madate2.getDate()+1);
var aujourdhui= new Date();
if (madate2.getYear()== aujourdhui.getYear()){
if (madate2.getMonth()== aujourdhui.getMonth()){
if (madate2.getDate()< aujourdhui.getDate()){
var index =document.forms[0].DropDownList2.selectedIndex;
index++;
if (index==12){index=0;document.forms[0].DropDownList12.selectedIndex=1;}
document.forms[0].DropDownList2.selectedIndex=index;
}}}
corrigerjourdeb();jourdeb();
madate2 =new Date(document.forms[0].DropDownList12.value,document.forms[0].DropDownList2.selectedIndex,document.forms[0].DropDownList1.selectedIndex+1,0,0,0)
madate =new Date(madate2.getFullYear(),madate2.getMonth(),madate2.getDate()+1);
majcalhid1(madate2);
document.forms[0].DropDownList13.selectedIndex=madate.getMonth();
document.forms[0].DropDownList14.selectedIndex=madate.getDate()-1;
document.forms[0].DropDownList15.selectedIndex=madate.getFullYear() -aujourdhui.getFullYear();
jourfin();
var madate3 =new Date(document.forms[0].DropDownList15.value,document.forms[0].DropDownList13.selectedIndex,document.forms[0].DropDownList14.selectedIndex+1,0,0,0)
cptnuits(madate2,madate3);majcalhid2(madate3);}
function newjourdpl2(){
var madate2 =new Date(document.forms[0].DropDownList15.value,document.forms[0].DropDownList13.selectedIndex,document.forms[0].DropDownList14.selectedIndex+1,0,0,0)
var aujourdhui= new Date(document.forms[0].DropDownList12.value,document.forms[0].DropDownList2.selectedIndex,document.forms[0].DropDownList1.selectedIndex+1,0,0,0);
if (madate2.getMonth()== aujourdhui.getMonth()){
if (madate2.getDate()< aujourdhui.getDate()){
var index =document.forms[0].DropDownList13.selectedIndex;
index++;
if (index==12){index=0;document.forms[0].DropDownList15.selectedIndex=1;}
document.forms[0].DropDownList13.selectedIndex=index;
}}
corrigerjourfin();jourfin();
madate2 =new Date(document.forms[0].DropDownList15.value,document.forms[0].DropDownList13.selectedIndex,document.forms[0].DropDownList14.selectedIndex+1,0,0,0);
cptnuits(aujourdhui,madate2);majcalhid2(madate2);}
function newmoisdpl1(){
var madate2 =new Date(document.forms[0].DropDownList12.value,document.forms[0].DropDownList2.selectedIndex,document.forms[0].DropDownList1.selectedIndex+1,0,0,0)
var madate =new Date(madate2.getFullYear(),madate2.getMonth(),madate2.getDate()+1);
var aujourdhui= new Date();
if (madate2.getMonth()< aujourdhui.getMonth()){
var index =document.forms[0].DropDownList12.selectedIndex;
if (index==0){index++;document.forms[0].DropDownList12.selectedIndex=index;}
}
corrigerjourdeb();jourdeb();
madate2 =new Date(document.forms[0].DropDownList12.value,document.forms[0].DropDownList2.selectedIndex,document.forms[0].DropDownList1.selectedIndex+1,0,0,0)
madate =new Date(madate2.getFullYear(),madate2.getMonth(),madate2.getDate()+1);
majcalhid1(madate2);
document.forms[0].DropDownList13.selectedIndex=madate.getMonth();
document.forms[0].DropDownList14.selectedIndex=madate.getDate()-1;
document.forms[0].DropDownList15.selectedIndex=madate.getFullYear() -aujourdhui.getFullYear();
jourfin();
var madate3 =new Date(document.forms[0].DropDownList15.value,document.forms[0].DropDownList13.selectedIndex,document.forms[0].DropDownList14.selectedIndex+1,0,0,0)
cptnuits(madate2,madate3);majcalhid2(madate3);}
function newmoisdpl2(){
var madate2 =new Date(document.forms[0].DropDownList15.value,document.forms[0].DropDownList13.selectedIndex,document.forms[0].DropDownList14.selectedIndex+1,0,0,0)
var aujourdhui= new Date(document.forms[0].DropDownList12.value,document.forms[0].DropDownList2.selectedIndex,document.forms[0].DropDownList1.selectedIndex+1,0,0,0);
if (madate2.getMonth()< aujourdhui.getMonth()){
var index =document.forms[0].DropDownList15.selectedIndex;
if (index==0){index++;document.forms[0].DropDownList15.selectedIndex=index;}}
corrigerjourfin();jourfin();
madate2 =new Date(document.forms[0].DropDownList15.value,document.forms[0].DropDownList13.selectedIndex,document.forms[0].DropDownList14.selectedIndex+1,0,0,0)
cptnuits(aujourdhui,madate2);majcalhid2(madate2);}
function newdpl2(){
corrigerjourfin();jourfin();
var madate2 =new Date(document.forms[0].DropDownList15.value,document.forms[0].DropDownList13.selectedIndex,document.forms[0].DropDownList14.selectedIndex+1,0,0,0)
var aujourdhui= new Date(document.forms[0].DropDownList12.value,document.forms[0].DropDownList2.selectedIndex,document.forms[0].DropDownList1.selectedIndex+1,0,0,0);
if (madate2.getFullYear()== aujourdhui.getFullYear()){
if ((madate2.getMonth()< aujourdhui.getMonth()) || ((madate2.getMonth()== aujourdhui.getMonth()) && (madate2.getDate()< aujourdhui.getDate()))){
var index =document.forms[0].DropDownList1.selectedIndex;document.forms[0].DropDownList14.selectedIndex=index;
index =document.forms[0].DropDownList2.selectedIndex;document.forms[0].DropDownList13.selectedIndex=index;
index =document.forms[0].DropDownList12.selectedIndex;document.forms[0].DropDownList15.selectedIndex=index;
}}
corrigerjourfin();jourfin();
var madate2 =new Date(document.forms[0].DropDownList15.value,document.forms[0].DropDownList13.selectedIndex,document.forms[0].DropDownList14.selectedIndex+1,0,0,0)
cptnuits(aujourdhui,madate2);majcalhid2(madate2);}
function nbnuits(){
var index =document.forms[0].DropDownList3.selectedIndex;
if (index <30)
{index=index+1 //index=index*24*3600*1000;
var today= new Date(document.forms[0].DropDownList12.value,document.forms[0].DropDownList2.selectedIndex,document.forms[0].DropDownList1.selectedIndex+1,0,0,0);
var madate= new Date(document.forms[0].DropDownList12.value,document.forms[0].DropDownList2.selectedIndex,document.forms[0].DropDownList1.selectedIndex+1,0,0,0);
var aujourdhui=new Date()
madate.setDate(madate.getDate()+index);
document.forms[0].DropDownList13.selectedIndex=madate.getMonth();
document.forms[0].DropDownList14.selectedIndex=madate.getDate()-1;
document.forms[0].DropDownList15.selectedIndex=madate.getFullYear() -today.getFullYear()
if (madate.getFullYear()>aujourdhui.getFullYear())
{document.forms[0].DropDownList15.selectedIndex=1}
}jourfin();
var madate2 =new Date(document.forms[0].DropDownList15.value,document.forms[0].DropDownList13.selectedIndex,document.forms[0].DropDownList14.selectedIndex+1,0,0,0);
majcalhid2(madate2);}
function cptnuits(date1,date2){
var d1=date1.getTime();var d2=date2.getTime();
var nbnuits=d2-d1;
nbnuits=Math.round((Math.round(nbnuits)/1000)/60/60/24);
if (nbnuits <31 && nbnuits >0)
{document.forms[0].DropDownList3.selectedIndex=nbnuits-1}
if (nbnuits ==0)
{document.forms[0].DropDownList3.selectedIndex=0}
if (nbnuits >30)
{document.forms[0].DropDownList3.selectedIndex=30}}
function corrigerjourdeb(){
var monmois =document.forms[0].DropDownList2.selectedIndex;
var monan=document.forms[0].DropDownList12.value;
if (document.forms[0].DropDownList1.selectedIndex >29){
if (monmois ==3 || monmois ==5 || monmois ==8 || monmois ==10){
document.forms[0].DropDownList1.selectedIndex =29}}
if (monmois ==1){ 
if (monan % 4 == 0){
if (document.forms[0].DropDownList1.selectedIndex >28){
document.forms[0].DropDownList1.selectedIndex =28}}
else { 
if (document.forms[0].DropDownList1.selectedIndex >27){
document.forms[0].DropDownList1.selectedIndex =27}}
}}
function corrigerjourfin(){
var monmois =document.forms[0].DropDownList13.selectedIndex;
var monan=document.forms[0].DropDownList15.value;
if (document.forms[0].DropDownList14.selectedIndex >29){
if (monmois ==3 || monmois ==5 || monmois ==8 || monmois ==10){
document.forms[0].DropDownList14.selectedIndex =29}}
if (monmois ==1){ 
if (monan % 4 == 0){
if (document.forms[0].DropDownList14.selectedIndex >28){
document.forms[0].DropDownList14.selectedIndex =28}}
else { 
if (document.forms[0].DropDownList14.selectedIndex >27){
document.forms[0].DropDownList14.selectedIndex =27}}
}}
function button_change(obj_button){
  var fcoul= obj_button.style.color;
  var bcoul=obj_button.style.backgroundColor;
  obj_button.style.cursor="pointer";
  obj_button.style.color=bcoul;
  obj_button.style.backgroundColor = fcoul;  }
function majcalhid1(ladate){// mise à jour du popupcal à partir d'une date composée avec les dropdownlist
var monmois=ladate.getMonth()+1
if (monmois <10){monmois="0"+monmois}
var monjour=ladate.getDate()
if (monjour<10){monjour="0"+monjour}
document.forms[0].hidcal1.value=ladate.getFullYear()+"/"+monmois+"/"+monjour
reshidcal1=document.forms[0].hidcal1.value} 
function majhidcal1(){//mise à jour des dropdownlist1 2 12 date darrivée suite à une date composée sur le popupcal
    var mystr=document.forms[0].hidcal1.value;
    var myarr=mystr.split("/")
    var today=new Date()
   if (mystr !="" && reshidcal1!=mystr){
    if (compareDates(mystr,getCurrentDate())>=0){
    document.forms[0].DropDownList1.selectedIndex=myarr[2]-1;
    document.forms[0].DropDownList2.selectedIndex=myarr[1]-1;
    document.forms[0].DropDownList12.selectedIndex=myarr[0]-today.getFullYear();
    var madate2 =new Date(document.forms[0].DropDownList12.value,document.forms[0].DropDownList2.selectedIndex,document.forms[0].DropDownList1.selectedIndex+1,0,0,0)
    var madate =new Date(madate2.getFullYear(),madate2.getMonth(),madate2.getDate()+1);
    jourdeb();
    document.forms[0].DropDownList13.selectedIndex=madate.getMonth();
    document.forms[0].DropDownList14.selectedIndex=madate.getDate()-1;
   document.forms[0].DropDownList15.selectedIndex=madate.getFullYear() -today.getFullYear();
   jourfin();
var madate3 =new Date(document.forms[0].DropDownList15.value,document.forms[0].DropDownList13.selectedIndex,document.forms[0].DropDownList14.selectedIndex+1,0,0,0)
cptnuits(madate2,madate3);majcalhid2(madate3);
reshidcal1=mystr}}
setTimeout("majhidcal1()",500);}
function majcalhid2(ladate){// mise à jour du popupcal à partir d'une date composée avec les dropdownlist
var monmois=ladate.getMonth()+1
if (monmois <10){monmois="0"+monmois}
var monjour=ladate.getDate()
if (monjour<10){monjour="0"+monjour}
document.forms[0].hidcal2.value=ladate.getFullYear()+"/"+monmois+"/"+monjour
reshidcal2=document.forms[0].hidcal2.value}
function majhidcal2(){//mise à jour des dropdownlist1 2 12 date darrivée suite à une date composée sur le popupcal
var mystr=document.forms[0].hidcal2.value;
var myarr=mystr.split("/")
var today=new Date()
var mydatedeb =new Date(document.forms[0].DropDownList12.value,document.forms[0].DropDownList2.selectedIndex,document.forms[0].DropDownList1.selectedIndex+1,0,0,0)
var monmois=mydatedeb.getMonth()+1
if (monmois <10){monmois="0"+monmois}
var monjour=mydatedeb.getDate()
if (monjour<10){monjour="0"+monjour}
var strdeb=mydatedeb.getFullYear()+"/"+monmois+"/"+monjour
if (mystr !="" && reshidcal2!=mystr){
if (compareDates(mystr,strdeb)>=0){
document.forms[0].DropDownList14.selectedIndex=myarr[2]-1;
document.forms[0].DropDownList13.selectedIndex=myarr[1]-1;
document.forms[0].DropDownList15.selectedIndex=myarr[0]-today.getFullYear();
var madate2 =new Date(document.forms[0].DropDownList15.value,document.forms[0].DropDownList13.selectedIndex,document.forms[0].DropDownList14.selectedIndex+1,0,0,0)
var madate =new Date(madate2.getFullYear(),madate2.getMonth(),madate2.getDate()+1);
jourfin();
var madate3 =new Date(document.forms[0].DropDownList15.value,document.forms[0].DropDownList13.selectedIndex,document.forms[0].DropDownList14.selectedIndex+1,0,0,0)
cptnuits(mydatedeb,madate3);
reshidcal2=mystr}}
setTimeout("majhidcal2()",500);}
function changepolice(param){
if (param !=""){
document.all.body.style.fontFamily=param;}}
function monurl(){
var myurl=document.URL 
if (myurl.indexOf("&") !=-1){
var param =myurl.substring(myurl.indexOf("&")+1)
var myarr=param.split("&")
for (var i =0; i<=3;i++){
if (myarr[i].indexOf("ftcolor") !=-1) {document.all.body.text=myarr[i].substring(myarr[i].indexOf("=")+1)}
if (myarr[i].indexOf("bgcolor") !=-1) {document.all.body.bgColor="#"+myarr[i].substring(myarr[i].indexOf("=")+1)}
if (myarr[i].indexOf("font") !=-1) {document.all.body.style.fontFamily=myarr[i].substring(myarr[i].indexOf("=")+1)}
}
}}
function Ouvrirpackage(x) {
var iavail=0; //window.screen.availWidth-350;
var havail=(window.screen.height-300)/2; //var havail=(window.screen.availHeight-300)/2;
if (!window.winpackage)
{window.winpackage=window.open("webpackage.aspx?nbpromos="+x,"pop1","width=550,height=300,top="+havail+",left="+iavail+",scrollbars=yes,resizable=yes");window.winpackage.focus();}
//{window.winpackage=window.open("webpackage.aspx","pop1","width=550,height=300,top="+havail+",left="+iavail+",scrollbars=yes");window.winpackage.focus();}   
    }
 function Fermerpackage() {
       if (window.winpackage) {window.winpackage.close(); }
    }
function Ouvrirpromos(lg) {
document.forms[0].hidnbpromo.value ="";
var iavail=0; 
var havail=(window.screen.height-300)/2; 
if (!window.winpackage)
{window.winpackage=window.open("webpackage.aspx?propack=promos&nbpromos=1&langue="+lg,"pop1","width=550,height=300,top="+havail+",left="+iavail+",scrollbars=yes");window.winpackage.focus();}
}   
function divpromo(lg) {
        document.getElementById("popuppromo").style.display = "block";
        document.getElementById("popuppromo").style.border = "solid 3px red";
        document.getElementById("popuppromo").style.color = "white";
        document.getElementById("popuppromo").style.backgroundColor = "red";
        document.getElementById("popuppromo").style.textAlign = "center";
        document.getElementById("popuppromo").style.position = "absolute";
        document.getElementById("popuppromo").style.left = "200px";
        document.getElementById("popuppromo").style.top = "200px";
        document.getElementById("popuppromo").style.width = "400px";
        document.getElementById("popuppromo").style.height = "50px";
        document.getElementById("popuppromo").style.fontSize = "24pt";
         var bodyText =  "Merci de consulter nos promotions";
         if (lg ==2){bodyText =  "Please consult our promotions";}
         if (lg ==3){bodyText =  "Gracias de consultar nuestras promociones";}
         if (lg ==4){bodyText =  "Grazie di consultare le nostre promozioni";}
         if (lg ==5){bodyText =  "Danke unsere Förderungen zu befragen";} 
       bodyText = "<font size=5 >" + bodyText + "</font>";
                document.getElementById("popuppromo").innerHTML = bodyText
               currCount = 3
               countDowndivpromo()
}
function countDowndivpromo() {
    currCount = currCount - 1
    if (currCount <= 0) {
        document.getElementById("popuppromo").style.display = "none";
    }
    else {
        setTimeout("countDowndivpromo()", 1000);
    }
} 