function place_contenu_accueil(){
	hauteur=(document.body.clientHeight);
	le_top=((hauteur-250)/2)-30;
	document.getElementById('contenu_accueil').style.marginTop=le_top+"px";
}

function resize_contenu(){
	hauteur=(document.body.clientHeight);
	la_hauteur=(hauteur-400)
	//document.getElementById('cadre_contenu').style.height=la_hauteur+"px";
	document.getElementById('cadre_contenu').style.marginTop=la_hauteur+"px";
	resize_galerie();
}

function resize_galerie(){
	hauteur=(document.body.clientHeight);
	largeur=(document.body.clientWidth);
	new_hauteur=hauteur-80;
	new_largeur=largeur-80;
	new_margin_top=-(new_hauteur/2)-20;
	new_margin_left=-(new_largeur/2)-20;
	document.getElementById('gallerie_photos').style.height=new_hauteur+"px";
	document.getElementById('gallerie_photos').style.width=new_largeur+"px";
	document.getElementById('gallerie_photos').style.marginTop=new_margin_top+"px";
	document.getElementById('gallerie_photos').style.marginLeft=new_margin_left+"px";
	document.getElementById('bt_fermer_gallerie').style.marginLeft=(new_largeur-18)+"px";
}

function fullscr(fichier) {
	ff=window.open(fichier,'plein','fullscreen=yes');
}
  
function createXHR(){
	var request = false;
	try{
		request = new ActiveXObject('Msxml2.XMLHTTP');
	}catch (err2) {
		try {
			request = new ActiveXObject('Microsoft.XMLHTTP');
		}catch (err3) {
			try {
				request = new XMLHttpRequest();
			}catch (err1){
				request = false;
			}
		}
	}
	return request;
}

function contenu_aff(valeur){
	var req = createXHR();
	req.onreadystatechange = function(){									
		if(req.readyState == 4){
			if(req.status == 200){
				//alert(req.responseText);
			}	
		} 
	}; 
	req.open("GET", "change_affichage.php?affichage=" + valeur, true); 
	req.send(null);	
}	

$(document).ready(function() {
	
	$('#survol_bain').mouseover(function() {
		$('#fond_bouton_bain').stop(true, false).animate({marginTop: '-30px', opacity:'1'},500);
		$('#bouton_bain').stop(true, false).animate({marginTop: '-30px', paddingTop: '118px', height: '112px'},500);
		$('#carre_bain').stop(true, true).fadeIn(500);
		$('#photo_bain').stop(true, false).animate({height: '70px'},500);
	});
	
	$('#survol_bain').mouseout(function() {
		$('#fond_bouton_bain').stop(true, false).animate({marginTop: '-50px', opacity:'0'},500);
		$('#bouton_bain').stop(true, false).animate({marginTop: '-50px', paddingTop: '188px', height: '42px'},500);
		$('#carre_bain').stop(true, true).fadeOut(500);
		$('#photo_bain').stop(true, false).animate({height: '0px'},500);
	});
	
	$('#survol_restaurant').mouseover(function() {
		$('#fond_bouton_restaurant').stop(true, false).animate({marginTop: '-30px', opacity:'1'},500);
		$('#bouton_restaurant').stop(true, false).animate({marginTop: '-30px', paddingTop: '118px', height: '112px'},500);
		$('#carre_restaurant').stop(true, true).fadeIn(500);
		$('#photo_restaurant').stop(true, false).animate({height: '70px'},500);
	});
	
	$('#survol_restaurant').mouseout(function() {
		$('#fond_bouton_restaurant').stop(true, false).animate({marginTop: '-80px', opacity:'0'},500);
		$('#bouton_restaurant').stop(true, false).animate({marginTop: '-80px', paddingTop: '188px', height: '42px'},500);
		$('#carre_restaurant').stop(true, true).fadeOut(500);
		$('#photo_restaurant').stop(true, false).animate({height: '0px'},500);
	});
	
	$('#survol_chambre').mouseover(function() {
		$('#fond_bouton_chambre').stop(true, false).animate({marginTop: '-30px', opacity:'1'},500);
		$('#bouton_chambre').stop(true, false).animate({marginTop: '-30px', paddingTop: '118px', height: '112px'},500);
		$('#carre_chambre').stop(true, true).fadeIn(500);
		$('#photo_chambre').stop(true, false).animate({height: '70px'},500);
	});
	
	$('#survol_chambre').mouseout(function() {
		$('#fond_bouton_chambre').stop(true, false).animate({marginTop: '0px', opacity:'0'},500);
		$('#bouton_chambre').stop(true, false).animate({marginTop: '0px', paddingTop: '188px', height: '42px'},500);
		$('#carre_chambre').stop(true, true).fadeOut(500);
		$('#photo_chambre').stop(true, false).animate({height: '0px'},500);
	});
	
	$('#survol_spa').mouseover(function() {
		$('#fond_bouton_spa').stop(true, false).animate({marginTop: '-30px', opacity:'1'},500);
		$('#bouton_spa').stop(true, false).animate({marginTop: '-30px', paddingTop: '92px', height: '138px'},500);
		$('#carre_spa').stop(true, true).fadeIn(500);
		$('#photo_spa').stop(true, false).animate({height: '70px'},500);
	});
	
	$('#survol_spa').mouseout(function() {
		$('#fond_bouton_spa').stop(true, false).animate({marginTop: '-50px', opacity:'0'},500);
		$('#bouton_spa').stop(true, false).animate({marginTop: '-50px', paddingTop: '162px', height: '68px'},500);
		$('#carre_spa').stop(true, true).fadeOut(500);
		$('#photo_spa').stop(true, false).animate({height: '0px'},500);
	});
	
	$('#survol_golf').mouseover(function() {
		$('#fond_bouton_golf').stop(true, false).animate({marginTop: '-30px', opacity:'1'},500);
		$('#bouton_golf').stop(true, false).animate({marginTop: '-30px', paddingTop: '118px', height: '112px'},500);
		$('#carre_golf').stop(true, true).fadeIn(500);
		$('#photo_golf').stop(true, false).animate({height: '70px'},500);
	});
	
	$('#survol_golf').mouseout(function() {
		$('#fond_bouton_golf').stop(true, false).animate({marginTop: '-100px', opacity:'0'},500);
		$('#bouton_golf').stop(true, false).animate({marginTop: '-100px', paddingTop: '188px', height: '42px'},500);
		$('#carre_golf').stop(true, true).fadeOut(500);
		$('#photo_golf').stop(true, false).animate({height: '0px'},500);
	});
	
	$('#survol_yacht').mouseover(function() {
		$('#fond_bouton_yacht').stop(true, false).animate({marginTop: '-30px', opacity:'1'},500);
		$('#bouton_yacht').stop(true, false).animate({marginTop: '-30px', paddingTop: '118px', height: '112px'},500);
		$('#carre_yacht').stop(true, true).fadeIn(500);
		$('#photo_yacht').stop(true, false).animate({height: '70px'},500);
	});
	
	$('#survol_yacht').mouseout(function() {
		$('#fond_bouton_yacht').stop(true, false).animate({marginTop: '-60px', opacity:'0'},500);
		$('#bouton_yacht').stop(true, false).animate({marginTop: '-60px', paddingTop: '188px', height: '42px'},500);
		$('#carre_yacht').stop(true, true).fadeOut(500);
		$('#photo_yacht').stop(true, false).animate({height: '0px'},500);
	});
	
	$('#bt_fermer').click(function() {
		if(document.getElementById('cadre_contenu').style.display=='none'){
			$('#cadre_contenu').stop(true, true).fadeIn(500);
			contenu_aff("1");
		}else{
			$('#cadre_contenu').stop(true, true).fadeOut(500);
			contenu_aff("0");
		}
	});
	$('#bt_fermer_gallerie').click(function() {
		if(document.getElementById('gallerie_photos').style.display=='none'){
			$('#gallerie_photos').stop(true, true).fadeIn(500);
		}else{
			$('#gallerie_photos').stop(true, true).fadeOut(500);
			contenu_aff("0");
		}
	});
	$('#bt_galerie').click(function() {
		if(document.getElementById('gallerie_photos').style.display=='none'){
			$('#gallerie_photos').stop(true, true).fadeIn(500);
		}else{
			$('#gallerie_photos').stop(true, true).fadeOut(500);
			contenu_aff("0");
		}
	});
});
