// JavaScript Document
window.onresize = centrerHauteur;
var h;
var plan="<div id='conteneurPlan'><div id='conteneurPlan2'><img src='images/croix.png' style='float:right; cursor:pointer' alt='Fermer' onclick='supprimerPlan()'/> <br style='clear:both' />  		<div id='map_canvas' style='width: 800px; height: 500px; margin:auto; border:#999999 1px solid'></div>    </div></div>";


function centrerHauteur(){
	var monObjet = document.getElementById('conteneur');
	if(document.innerHeight){ 
				   h=document.innerHeight;
	} else if(document.documentElement.clientHeight){
				   h=document.documentElement.clientHeight;
	} else if(document.body){
				   h=document.body.clientHeight;
	}
	
	var hauteurObjet = 678;
	if(h>hauteurObjet){
				   monObjet.style.top = '50%';
				   monObjet.style.marginTop = '-338px';           
	} else {
				   monObjet.style.top = '0';
				   monObjet.style.marginTop = '0px';        
	}
	
}

var xhr = null;

// CREATION D4UN OBJET XMLHTTPREQUEST EN FONCTION DU NAVIGATEUR

function getXhr()
 {
  if(window.XMLHttpRequest) xhr = new XMLHttpRequest(); 
  else if(window.ActiveXObject)
   {  
    try
     {
      xhr = new ActiveXObject('Msxml2.XMLHTTP');
     }
    catch (e)
     {
      xhr = new ActiveXObject('Microsoft.XMLHTTP');
     }
   }
  else 
   { 
    alert('Votre navigateur ne supporte pas les objets XMLHTTPRequest, veuillez le mettre à jour'); 
    xhr = false; 
   } 
 }
 
 
 
function envoyerContactMail(){
	getXhr();
	data = 'email='+document.getElementById('idEmailNewsletter').value;
	xhr.onreadystatechange = function()
	{
		if(xhr.readyState == 4 && xhr.status == 200){
			document.getElementById('idFrmNewsletter').innerHTML = xhr.responseText;
		}
	}
	 xhr.open('POST', 'ajax/ajax.php', true);
	 xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');                  
	 xhr.send(data);
}


function afficherClip(){
	document.getElementById('clipVideo').style.display = 'block';
	/*if(h>640){
			document.getElementById('clipVideo').style.height=h+'px';
			document.getElementById('clipVideo').style.paddingTop = ((h-640)/2)+'px';
	} else {
			document.getElementById('clipVideo').style.height='640px';
	}*/
	document.getElementById('clipVideo').innerHTML="<div id='conteneurFlash'><div style='text-align:right; width:640px;'><img src='images/croix.png' alt='' style='cursor:pointer' onclick=\"document.getElementById('clipVideo').style.display='none';document.getElementById('clipVideo').innerHTML='none'; \"></div><object type='application/x-shockwave-flash' data='animations/sdb.swf' id='idmenu' width='640' height='494'><param name='id' value='idClip' /><param name='movie' value='animations/sdb.swf' /><param name='wmode' value='transparent' /><param name='quality' value='best' /><param name='AllowScriptAccess' value='always' /><p style='text-align:center; margin-left:150px'>Si vous ne voyez pas cette animation<br />téléchargez la dernière version du lecteur flash <br />disponible <a href='http://get.adobe.com.fr/flashplayer/'>ici</a></p> </object></div>";
	

}

function carreGris(){
	if(document.getElementById('clipVideo').style.display !='none'){
		
	}	
}


function avancer(diapo){
	monDiapo = "#"+diapo;
	if(parseInt($(monDiapo).css("marginLeft"))>(0-(parseInt($(monDiapo).css("width")))+650)){
		$(monDiapo).animate({
    		marginLeft: "-=200px"			
		}, 1000);
	}
}
function reculer(diapo){
	monDiapo = "#"+diapo;
	if(parseInt($(monDiapo).css("marginLeft"))<0){
		if(parseInt($(monDiapo).css("marginLeft"))>-200){
			$(monDiapo).animate({
				marginLeft: 0			
			}, 1000);
		} else {
			$(monDiapo).animate({
				marginLeft: "+=200px"			
			}, 1000);
		}
	}
}

