 
mois=new Array(get_trad_champ("janvier"),get_trad_champ("février"),get_trad_champ("mars"),get_trad_champ("avril"),get_trad_champ("mai"),get_trad_champ("juin"),get_trad_champ("juillet"),get_trad_champ("août"),get_trad_champ("septembre"),get_trad_champ("octobre"),get_trad_champ("novembre"),get_trad_champ("décembre"));
chainePrestation = get_trad_champ("hotel")+";"+get_trad_champ("hotel_appartements")+";"+get_trad_champ("meubles");
chaineCentrale = "https://activresa-secure2.icor.fr/courchevel/entreegb.html?xurl#https://activresa-secure2.icor.fr/distributeur/virtual_session.asp?centrale=COURCHEVEL&distributeur=V0002&stop=1&changelangue=2&ZETAT=RechercheDirecte";									  
/*chaineCentrale = "https://activresa-secure2.icor.fr/courchevel/entreegb.html?xFrame#https://activresa-secure2.icor.fr:443/distributeur/include/page_attente.asp?sid=TO0B3HIQD9LSOSF7P1X6RB16&langue=1&pagetoload=%2Fdistributeur%2FgestRechercheV2%2FresultatGP%2Easp&ChangeLangue=2&pac%5Fid=&url=%2Fdistributeur%2FgestRechercheV2%2FresultatGP%2Easp&baa%5Fid=&dos%5Fid=&envoiemail=&adresseMailClient=&DOSSIER=&NOM=&zcen_code=courchevel&zfournisseur=&ztp=&zzog_id=&zdis_id_pq=&zprod=&zprodtc=&zdtdebut=28/07/2007&zdtfin=&zduree=7&znbpersonne=2&zzetat=RechercheDirecte&zpromo=&zcodetc=&zproduit=";*/
	
  function loadinit(){
  	tprestation=chainePrestation.split("@");
  	document.portail.prestation.options.length = tprestation.length+1;
  	document.portail.prestation.options[0].value = "";
  	document.portail.prestation.options[0].text  = get_trad_champ("prestation");
  	for (var jc=0;jc<tprestation.length;jc++) {
  		tdetail=tprestation[jc].split(";");
  		document.portail.prestation.options[jc+1].value = tdetail[1];
  		document.portail.prestation.options[jc+1].text  = tdetail[0];
  	}

  	d = new Date();  	  	
  	
  	moiscourant=d.getMonth();
  	anneecourant=d.getFullYear();
  	idtcourant=new Date(anneecourant, moiscourant ,"01"  );

		//--- TEST SI IL RESTE DES SEMAINE A AFFICHER SUR CE MOIS ---
		//--- SINON ON AFFICHE LE MOIS SUIVANT ---
		affFirstMois = false;		
		if(moiscourant==11){moissuivantTest=0; anneesuivantTest=idtcourant.getFullYear()+1;}else{moissuivantTest=idtcourant.getMonth()+1;	anneesuivantTest=idtcourant.getFullYear();}
		jourEncoursTest=d.getDate();
		dtsuivantTest=new Date(anneesuivantTest, moissuivantTest ,"01");
		jourfindemoisTestTest=Math.round((dtsuivantTest-idtcourant)/86400000);  			
		for (var idayTest=jourEncoursTest;idayTest<jourfindemoisTestTest;idayTest++) {
			dtencoursTest=new Date(anneecourant, moiscourant ,idayTest );
			if ((dtencoursTest.getDay()==6 || dtencoursTest.getDay()==0) && dtencoursTest>=d){affFirstMois = true;}
		}		
		if(!affFirstMois){idtcourant=new Date(anneesuivantTest, moissuivantTest ,"01"  );}				
  	
  	document.portail.mois.options.length = 12;  	
  	for (var yy=0;yy<12;yy++) {  		  		  		  		  		
  		moiscourant=idtcourant.getMonth();  		
  		anneecourant=idtcourant.getFullYear();
  		document.portail.mois.options[yy].value = moiscourant +"/" + anneecourant ;
  		document.portail.mois.options[yy].text = mois[moiscourant] +" " + anneecourant;
  		if (moiscourant!=11){
  			moiscourant=moiscourant+1;
  		}else{
  			moiscourant=0;
  			anneecourant=anneecourant+1;
  		}
    	idtcourant=new Date(anneecourant, moiscourant ,"01");    	
    	changeMois(document.portail.mois.options.selectedIndex);	    
    }
  }

  function changeMois(index){
  	vtxt=document.portail.mois.options[index].value;
  	tvtxt=vtxt.split("/");
  	
  	dttoday=new Date();  	
  	  	
  	jourtoday=dttoday.getDate();
  	moistoday=dttoday.getMonth();
  	anneetoday=dttoday.getFullYear();
  	joursencours=0;
  	moisencours=parseInt(tvtxt[0]);
  	anneeencours=parseInt(tvtxt[1]);
  	dtencours=new Date(anneeencours, moisencours ,"01");
  	if (moisencours==11){
  		moissuivant=0;
  		anneesuivant=dtencours.getFullYear()+1;
  	}else{
  		moissuivant=dtencours.getMonth()+1;
  		anneesuivant=dtencours.getFullYear();
  	}
  	dtsuivant=new Date(anneesuivant, moissuivant ,"01");
  	jourfindemois=Math.round((dtsuivant-dtencours)/86400000);
  	document.portail.jour.options.length =0;
  	for (var iday=1;iday<=jourfindemois;iday++) {
  		if (joursencours!=jourfindemois) {
  			joursencours=joursencours+1;
  		}
  		dtencours=new Date(anneeencours, moisencours ,joursencours );
  		//if (dtencours.getDay()==6 && joursencours>=jourtoday){  		
  		if ((dtencours.getDay()==6 || dtencours.getDay()==0) && dtencours>=dttoday){  		
  			document.portail.jour.options.length = document.portail.jour.options.length + 1;
  			if ((moisencours+1)<10){
  				moischaine='0'+(moisencours+1)
  			}else{
  				moischaine=(moisencours+1);
  			}
  			if ((joursencours)<10){
  				jourschaine='0'+(joursencours);
  			}else{
  				jourschaine=(joursencours);
  			}
  			totalchaine=jourschaine+ '/'+ moischaine +'/'+ anneeencours
  			document.portail.jour.options[document.portail.jour.options.length-1].value = totalchaine ;
  			if (dtencours.getDay()==6) {
  				document.portail.jour.options[document.portail.jour.options.length-1].text  = 'Samedi ' + jourschaine + "/" + moischaine + "/" + anneeencours ;
  			} else if (dtencours.getDay()==0) {
  				document.portail.jour.options[document.portail.jour.options.length-1].text  = 'Dimanche ' + jourschaine + "/" + moischaine + "/" + anneeencours ;
  			}
  		}
  	}
  }

  function openWin2(url, x, y) {
  	if(document.all) { width = screen.width; height = screen.height; }
  	else { width=800; height=600; }
  	var al = Math.round(Math.random()*10000);
  	window.open(url,al,"status=no,location=no,menubar=no,resizable=yes,toolbar=no,scrolling=auto,scrollbars=yes,width="+width+",height="+height+",left="+x+",top="+y);
  }

	function centrerPopup( page, titrePage, largeur, hauteur)
	{  
		var top=(screen.height-hauteur)/2;
	  var left=(screen.width-largeur)/2;
	  var param ;
	  param = "top="+top+",left="+left+",width="+largeur+",scrollbars=no,height="+hauteur;            
	  window.open( page, titrePage, param);
	}

  function submitCentrale(thisForm){    
    if (document.portail.prestation.options.selectedIndex==0){    	    	
    	alert(get_trad_champ("type_hebergement"));
    }else{    	
    	linktoform= chaineCentrale +'&DTDEBUT=' +document.portail.jour.options[document.portail.jour.options.selectedIndex].value + '&DUREE=' + document.portail.duree.options[document.portail.duree.options.selectedIndex].value + '&NBPERS=' +  document.portail.nbpersonne.options[document.portail.nbpersonne.options.selectedIndex].value + '&TP=' + document.portail.prestation.options[document.portail.prestation.options.selectedIndex].value;
    	centrerPopup(linktoform, "Reservation", 817, 692);
    }
  }


