
//========================================================================
// GESTION DES MOTEURS HOME
//========================================================================
var http_moteur = getHTTPObject();
var http1 = getHTTPObject();
var bool_moteur_1=1;
var bool_moteur_2=0;
var bool_moteur_3=0;



function selectfamil(Langue,URL) {
				if(Langue.options[Langue.selectedIndex].value=="") {
						 alert('Veuillez sélectionner une gamme d\'articles dans le menu.');
				}
				else {
						parent.location.href =URL+"?Nom_Loueur="+Langue.options[Langue.selectedIndex].value;
Langue.selectedIndex=0;
				}
		}


function ong_home(id){
	for(i=1;i<=3;i++){
		if(i==id){
			gId('div_ong_home_'+i).style.backgroundImage="url(design/slide/onglets/"+i+"_on.png)";	
			gId('R_B_'+i).style.display='';	
		}else{
			gId('div_ong_home_'+i).style.backgroundImage="url(design/slide/onglets/"+i+"_off.png)";	
			gId('R_B_'+i).style.display='none';
		}
	}
	actu(id+1);

window.setTimeout("chargement_moteur_home("+id+")",1000);	
}

function chargement_moteur_home(id){
	if(id==2 && bool_moteur_2==0){
		url="moteur_cabine.asp";
		http_moteur.open("GET", url, true);
		http_moteur.onreadystatechange = handleHttpResponsehttpMoteurHomeHotel;
		http_moteur.send(null);	
	}
	if(id==3 && bool_moteur_3==0){

		url="moteur_boat.asp";
		http_moteur.open("GET", url, true);
		http_moteur.onreadystatechange = handleHttpResponsehttpMoteurHomeVoiture;
		http_moteur.send(null);	

	}
}

function handleHttpResponsehttpMoteurHomeHotel(){
	if (http_moteur.readyState == 4) {
		results = http_moteur.responseText;
		gId('div_MoteurHotel').innerHTML=results;
		//startautocomp_hotel("hotel_dest", "hotel_id_dest", "ajax/autohotel.php", 274, true, false);
		//init_calendar_hotel();
		bool_moteur_2=1;
		format_moteur_hotel_home=1;
	}
}

function handleHttpResponsehttpMoteurHomeVoiture(){
	if (http_moteur.readyState == 4) {
		results = http_moteur.responseText;
		gId('div_MoteurVoiture').innerHTML=results;
		//startautocomp_voiture("voiture_dest", "voiture_id_dest", "ajax/autovoiture.php", 400, false, false);
		//init_calendar_voiture();
		bool_moteur_3=1;
		format_moteur_voiture_home=1;
	}
}



//========================================================================
// GESTION DES PHOTOS HOME
//========================================================================
var id_actu_cur=1;
var nb_actu_max=9;
function actu(id){
	id_actu_cur=id;
	move_flash(calcul_mvt_actu(id_actu_cur));
	clearInterval(flashs_automatique);
}

function move_flash(largeur) {
	$('#slideflash_liste').stop().animate({marginLeft:largeur},"slow", myCallBackMvt);
}

function myCallBackMvt(){
	if(id_actu_cur==nb_actu_max){
		gId("slideflash_liste").style.marginLeft=0+"px";
		id_actu_cur=1;
	}
}
		
function auto_move_flash() {
	id_actu_cur++;
	if(id_actu_cur>nb_actu_max){
		id_actu_cur=1;
	}
	move_flash(calcul_mvt_actu(id_actu_cur));
}	

function calcul_mvt_actu(id){
	var marg=-940*(id_actu_cur-1);		
	return marg;	
}	
	
flashs_automatique = setInterval("auto_move_flash()",9000);


function go_theme_home(id){
	http1.open("GET", "/ajax/home_theme.php?id=" + id + "", true);
	http1.onreadystatechange = handleHttpResponseTheme;
	http1.send(null);
}

function handleHttpResponseTheme(){
	if (http1.readyState == 4) {
		results = http1.responseText;		
		document.location.href=results;	
	}
}


  function checkCapacity(Category,MsgCapInv)
{
	Capacity=Number(document.Wiz.Adult.value) + Number(document.Wiz.Child.value) ;

if (Capacity >12) 
	{	var message=MsgCapInv;
		alert(message);
		switch(Category)
		{	case 'Adult':
				document.Wiz.Adult.value=2;
				break;	
			case 'Child':
				break;
		}
		document.Wiz.pparamequipage.value=Capacity;			
	}
	else
	{	document.Wiz.pparamequipage.value=Capacity;
	}
}
