/*******Sommaire*******/
// 00 - Initialisation
// 05 - Methodes communes
// 10 - AJAX
// 15 - Home
// 20 - Pages filles
// 25 - Recherche
/*********************/

function popmy(url){


	pop = window.open(url,'glossaire','width=600,height=400');
	pop.focus();

}

// 00 - Inititalisation

var cpt			= "";
var xmlFill 		= '';
var xmlText 		= '';
var addFav 		= '';
var bookmarkurl		= window.location.href;
var bookmarktitle	= "Foncation Recherche M&eacute;dicale";

// 05 - Methodes communes

function favoris() { 


   if (window.sidebar) { 
	window.sidebar.addPanel(document.title, window.location,""); 
   } else if( document.all ) { 
	window.external.AddFavorite(window.location, document.title); 
   } else { 
	return true; 
   } 


}


function createFavoris()
{
	if(document.all && navigator.platform == 'Win32'){
		addFav = '<a href="javascript:addbookmark ();">Ajouter aux favoris</a>';
	} else if (navigator.userAgent.indexOf('Firefox') != -1){
		addFav = '<a rel="sidebar" title="'+bookmarktitle+'" href="'+bookmarkurl+'">Ajouter aux favoris</a>';
	}
	document.getElementById('favori').innerHTML = addFav;
}

function addbookmark(){
	if (document.all)
	window.external.AddFavorite(bookmarkurl,bookmarktitle)
}

function sendFriend(url,larg,haut)   
{     
	popup = window.open(url,'popup','toolbar=no,location=no,directories=no,status=no,scrollbars=yes,resizable=no,copyhistory=no,width='+larg+',height='+haut);
}

function openWin(url,larg,haut)   
{     
	popup = window.open(url,'popup','toolbar=no,location=no,directories=no,status=no,scrollbars=yes,resizable=no,copyhistory=no,width='+larg+',height='+haut);
}

function limite(zone,max)
{
	if(zone.value.length >= max)
		zone.value = zone.value.substring(0,max);
}

// 10 - AJAX


function file(fichier)
{
	if(window.XMLHttpRequest) { // Firefox et autres
		xhr_object = new XMLHttpRequest();
	} else if(window.ActiveXObject) { // Internet Explorer
		try{
                	xhr_object = new ActiveXObject("Msxml2.XMLHTTP");
            	} catch (e) {
	                xhr_object = new ActiveXObject("Microsoft.XMLHTTP");
            	}
	} else {
		xhr_object = false;
		return(false);
	}
	xhr_object.onreadystatechange = function(){getFillInfos (xhr_object);}
	xhr_object.open("GET", fichier, true);
	xhr_object.send(null);
}

function getFillInfos (xhr_object)
{
	if (xhr_object.readyState == 4) {
	        if (xhr_object.status == 200) {
				xmlFill = xhr_object.responseXML;
				xmlText = xhr_object.responseText;
	        	setTimeout("changeFillInfos ();",4000);
	        }
	}
}

function changeFillInfos ()
{	
	if(navigator.appName == "Microsoft Internet Explorer"){
		xmlFill = parse_xml(xmlText);
	}
	var arrInfos = xmlFill.getElementsByTagName('info');
	if ((cpt == "" && cpt != 0) || cpt == arrInfos.length-1) cpt = 0;
	else cpt++;

	/*
	var xmlId 	= arrInfos[cpt].childNodes[0].childNodes[0].nodeValue;	
	var xmlEvent 	= arrInfos[cpt].childNodes[2].childNodes[0].nodeValue;	
	if (xmlEvent == 0) {
		option = "com_content";
		itemid = 39;
	} else {
		option = "com_event";
		itemid = 37;
	}
	*/	
	if(arrInfos[cpt]) {
		var xmlTitle 	= arrInfos[cpt].childNodes[1].childNodes[0].nodeValue;	
		var xmlUrl 	   = arrInfos[cpt].childNodes[4].childNodes[0].nodeValue;	
	}
	var info = "<a href='"+xmlUrl+"'>"+xmlTitle+"</a><a href='"+xmlUrl+"' class='btn'><img src='templates/images/puces/plus-blue.gif' alt='Lire la suite' /></a>";
	
	document.getElementById('filInfo').innerHTML = info;

	setTimeout("changeFillInfos ();",4000);
}

function parse_xml(xml){
	if(navigator.appName == "Microsoft Internet Explorer"){
		xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
		xmlDoc.loadXML(xml);
		xml = xmlDoc;
		
		return xml;
	}
}

// 15 - Home


function directAccess ()
{
	var query = document.FormDirectAccess.acces[document.FormDirectAccess.acces.selectedIndex].value;
	if(query != 0) document.location.href = query;
	return false;
}

function goFaq() 
{
	var form = document.faq;
	if(form.id.value != "-") document.location.href = form.id.value;
	return false;
}

// 20 - Pages filles

function changeDon (type)
{
	with (document.FormDon)
	{
		if (type == 0)
		{
			other.value = "";
		}
		else
		{
			for (i=0;i<5;i++)
			{
				donLvl[i].checked = false;
			}
		}
	}
}

// 25 - Recherche

function trim(s) {
    return s.replace(/(^\s*)|(\s*$)/g,''); 
}

function valid_recherche(num)
{
	if (num == 1)
		strSearch = trim(document.getElementById('search_searchword').value);
	else
		strSearch = trim(document.getElementById('mod_search_searchword').value);
		
	if (strSearch.length > 2) return true;
	else
	{
		err = "Votre recherche doit comporter <br />au moins 3 caractères";
		document.getElementById('err'+num).innerHTML = err;
		if (num == 1 && document.getElementById('err0')) document.getElementById('err0').innerHTML = "";
		else if (num == 0 && document.getElementById('err1')) document.getElementById('err1').innerHTML = "";
		return false;	
	}
}


/* Javascript - Délices du soleil */

/***** Sommaire *****/
// 00 - Variables
// 10 - Ecriture des flashs
// 20 - Glossaire
// 30 - Popup
// 99 - onLoad
/*******************/

/***** 00 - Variables *****/
var actURL = document.location.href;

/***** 10 - Ecriture des flashs *****/
function writeFlash(url,id,w,h,o){
	var tempFlashContent = '';
	var flashOptionsTab = new Array();
	flashOptionsTab = o.split('|');
	tempFlashContent += '<object id="'+id+'" type="application/x-shockwave-flash" data="'+url+'" width="'+w+'" height="'+h+'">\n';
	tempFlashContent += '\t<param name="movie" value="'+url+'" />\n';
	for(i=0; i<flashOptionsTab.length; i++){
		var tempParam = flashOptionsTab[i].split('#')[0];
		var tempValue = flashOptionsTab[i].split('#')[1];
		tempFlashContent += '\t<param name="'+tempParam+'" value="'+tempValue+'" />\n';
	}
	tempFlashContent += '</object>\n';
	document.write(tempFlashContent);
}

/***** 20 - Gloassaire *****/
function buildGlossaire(list){
	var wordTab = list.getElementsByTagName('li');
	for(j=0; j<wordTab.length; j++){
		// Attribution des ID
		wordTab[j].id = 'gloss'+j;
		wordTab[j].getElementsByTagName('a')[0].href = 'javascript:showGlossaire('+j+');';
		wordTab[j].className = 'off';
	}
}

var lastGloss = 'no';
function showGlossaire(id){
	if(lastGloss != 'no' && lastGloss != id){
		hideGlossaire(lastGloss);
	}
	if(document.getElementById('gloss'+id).className == 'on'){
		hideGlossaire(id);
	} else {
		document.getElementById('gloss'+id).className = 'on';
		lastGloss = id;
	}
}

function hideGlossaire(id){
	document.getElementById('gloss'+id).className = 'off';
	lastGloss = 'no';
}

/***** 30 - Popup *****/
function popThis(url,nom,w,h,o){

	pop = window.open(url,nom,'width='+w+',height='+h+','+o);
	pop.focus();

}


	
/***** 99 - onLoad *****/

window.onclick = function() {

	masque_menus();
	
}

window.onload = function(){
	//colorTextDon();
	closeGlossaire ();
}

function closeGlossaire () {
	// 20 - Glossaire
	listTab = document.getElementsByTagName('ul');
	for(i=0; i<listTab.length; i++){
		if(listTab[i].className == 'glossaire'){
			buildGlossaire(listTab[i]);
		}
	}
}

function emailCheck (emailStr) {
	var myAtSymbolAt = emailStr.indexOf('@');
	var myLastDotAt = emailStr.lastIndexOf('.');
	var mySpaceAt = emailStr.indexOf(' ');
	var myLength = emailStr.length;
	if (myAtSymbolAt < 1 ) return false;
	if (myLastDotAt < myAtSymbolAt) return false;
	if (myLength - myLastDotAt <= 2) return false;
	if (mySpaceAt != -1) return false;
	else return true;
}

function checkContact() {
	var form = document.formContact;
	if(!(form.civilite[0].checked || form.civilite[1].checked || form.civilite[2].checked || form.civilite[3].checked)) {
		alert("veuillez indiquer votre Civilité.");
		form.nom.focus();
	}
	else if(form.nom.value=="") {
		alert("veuillez saisir votre nom.");
		form.nom.focus();
	}
	else if(form.prenom.value=="") {
		alert("veuillez saisir votre prénom.");
		form.prenom.focus();
	}
	else if(form.mail.value=="") {
		alert("veuillez saisir un email.");
		form.mail.focus();
	}
	else if(!emailCheck(form.mail.value)) {
		alert("veuillez saisir un email valide.");
		form.mail.focus();
	}	
	else if(form.subject.options[form.subject.selectedIndex].value == "00") {
		alert("veuillez saisir une question.");
		form.subject.focus();
	}
	else if(form.message.value=="") {
		alert("veuillez saisir votre message.");
		form.message.focus();
	}				
	else {
		/*
		if(form.civilite[0].checked) civilite = form.civilite[0].value;
		else if(form.civilite[1].checked) civilite = form.civilite[1].value;
		else if(form.civilite[2].checked) civilite = form.civilite[2].value;
		else civilite = form.civilite[3].value;
		*/
		form.submit();		
	}
		
}

function checkPostuler() {
	var form = document.formPostuler;
	var cvPath = form.cv.value;
	var cvExt = cvPath.substring(cvPath.lastIndexOf("."),cvPath.length);
	var motivPath = form.motivation.value;
	var motivExt = cvPath.substring(cvPath.lastIndexOf("."),cvPath.length);
	if(form.mail.value=="") {
		alert("veuillez saisir un email.");
		form.mail.focus();
	}
	else if(!emailCheck(form.mail.value)) {
		alert("veuillez saisir un email valide.");
		form.mail.focus();
	}	
	else if(cvPath == "") {
		alert("veuillez attacher votre CV.");
		form.cv.focus();
	}
	else if(cvExt != ".doc") {
		alert("Votre Cv doit-être au format doc.");
		form.cv.focus();
	}				
	else if(motivPath == "") {
		alert("veuillez attacher votre CV.");
		form.motivation.focus();
	}
	else if(cvExt != ".doc") {
		alert("Votre lettre de motivation doit-être au format doc.");
		form.motivation.focus();
	}
	else {
		form.submit();			
	}
		
}

function checkNewsletterchercheurs() {
	var form = document.forms.FormNewsletter;

	if(form.mailNews.value=="") {
		alert("veuillez saisir un email pour recevoir la newsletter chercheurs de la FRM");
		form.mailNews.focus();
		return false;
	}

	if(!form.mailNews.value.match("^.+@.+\\..+$")) {
		alert("Veuillez saisir un email valide.");
		form.mailNews.focus();
		return false;
	}
	
	var xhr_object = null;   
        
	if(window.XMLHttpRequest) { // FIREFOX
		xhr_object = new XMLHttpRequest();
	} else if(window.ActiveXObject) { // IE
		xhr_object = new ActiveXObject("Microsoft.XMLHTTP");
	} else {
		return(false);
	}  
   
	xhr_object.open("POST", "/includes/Ajax/setNewsletterChercheurs.php", true);   
 
	xhr_object.onreadystatechange = function() {   
		if(xhr_object.readyState == 4) {
			eval(xhr_object.responseText);   
		}
	}

	xhr_object.setRequestHeader("Content-type", "application/x-www-form-urlencoded");   
	var data = "email="+form.mailNews.value;   
	xhr_object.send(data);	
	
	return false;
}

function checkNewsletter() {
	var form = document.forms.FormNewsletter;

	if(form.mailNews.value=="") {
		alert("veuillez saisir un email pour recevoir la newsletter de la FRM");
		form.mailNews.focus();
		return false;
	}

	if(!form.mailNews.value.match("^.+@.+\\..+$")) {
		alert("Veuillez saisir un email valide.");
		form.mailNews.focus();
		return false;
	}
	
	var xhr_object = null;   
        
	if(window.XMLHttpRequest) { // FIREFOX
		xhr_object = new XMLHttpRequest();
	} else if(window.ActiveXObject) { // IE
		xhr_object = new ActiveXObject("Microsoft.XMLHTTP");
	} else {
		return(false);
	}  
   
	xhr_object.open("POST", "/includes/Ajax/setNewsletter.php", true);   
 
	xhr_object.onreadystatechange = function() {   
		if(xhr_object.readyState == 4) {
			eval(xhr_object.responseText);   
		}
	}

	xhr_object.setRequestHeader("Content-type", "application/x-www-form-urlencoded");   
	var data = "email="+form.mailNews.value;   
	xhr_object.send(data);	
	
	return false;
}

function loadAxControl() {
  if (!document.all || !window.print || window.opera) return;
  if (document.getElementsByTagName) { 

//object   
	var theObjects = document.getElementsByTagName("object");
   for (var i = 0; i < theObjects.length; i++) {
      //ajout d'un div autour de object
      div = theObjects[i].parentNode.insertBefore(document.createElement("div"), theObjects[i]);
      div.style.display="none";
      div.appendChild(theObjects[i]);

      if(div.firstChild.data){
			// Fix for Flash Satay style objects
			div.firstChild.removeAttribute('data');
		}
      
      //Recuperation des flashvars
      var theParams = div.getElementsByTagName("param");
		for (var j = 0; j < theParams.length; j++) {
			if(theParams[j].name.toLowerCase() == 'flashvars'){
				var theFlashVars = theParams[j].value;
            break;
			}
		}
      
      //changement des flashvars
      var theInnnerHTML = div.innerHTML;
		var re = /<param name="FlashVars" value="">/ig;
		theInnnerHTML = theInnnerHTML.replace(re, "<param name='FlashVars' value='" + theFlashVars + "'>");
		div.outerHTML = theInnnerHTML;
	}

//embed
	var embs = document.getElementsByTagName("embed");
	for (i=0; i<embs.length; i++) {
		embs[i].outerHTML = embs[i].outerHTML;
	}
 }
}

function viewImage(n){

	w = window.open('','chargement','width=10,height=10');
	w.document.write( "<html><head><title>:: Preview image</title>\n" );
	w.document.write( "<script language='JavaScript'>\n");
	w.document.write( "IE5=NN4=NN6=false;\n");
	w.document.write( "if(document.all)IE5=true;\n");
	w.document.write( "else if(document.getElementById)NN6=true;\n");
	w.document.write( "else if(document.layers)NN4=true;\n");
	w.document.write( "function autoSize() {\n");
	w.document.write( "if(IE5) self.resizeTo(document.images[0].width+10,document.images[0].height+111);\n");
	w.document.write( "else if(NN6) self.sizeToContent();\n");
	w.document.write( "else window.resizeTo(document.images[0].width,document.images[0].height+110);\n");
	w.document.write( "self.focus();\n");
	w.document.write( "}\n</scri");
	w.document.write( "pt>\n");
	w.document.write( "</head><body leftmargin=0 topmargin=0 marginwidth=0 marginheight=0 onLoad='javascript:autoSize();'>" );
	w.document.write( "<table width=100% height=100% cellpadding=0 cellspacing=0 border=0>");
	w.document.write( "<tr><td><a href='javascript:window.close();'><img src='"+n+"' border=0 alt=''></a></td></tr>" );
	w.document.write( "<tr><td><img alt name='espace1' src='/02_images/pix.gif' width='1' height='4' border='0'></td></tr>" );
	w.document.write( "<tr><td bgcolor='#EDDAC9'><img alt name='espace2' src='/02_images/pix.gif' width='1' height='1' border='0'></td></tr>" );		
	w.document.write( "<tr><td><img alt name='espace1' src='/02_images/pix.gif' width='1' height='4' border='0'></td></tr>" );
 	w.document.write( "<tr><td height='100%' align='right' style='padding-right:15px;'><a href='javascript:window.close();'><img alt name='fermer' src='/templates/images/FR/btns/fermer.gif' border='0'></a></td></tr></table>" );
	w.document.write( "</body></html>" );
	w.document.close();

}

function colorTextDon(){
	var h2Elements = document.getElementsByTagName("h2");
	var h3Elements = document.getElementsByTagName("h3");
	var linkElements = document.getElementsByTagName("a");
	for ( var i = 0; ( elem = h2Elements[i] ); i++ ) {
		changeClass(elem, "don","red");
		changeClass(elem, "dons","red");
	} 
	for ( var i = 0; ( elem = h3Elements[i] ); i++ ) {
		changeClass(elem, "don","red");
		changeClass(elem, "dons","red");
	} 	
	for ( var i = 0; ( elem = linkElements[i] ); i++ ) {
		changeClass(elem, "don","red");
		changeClass(elem, "dons","red");
	} 
}

function changeClass(elem,ch,class_name) {
	stg = elem.innerHTML.toLowerCase();
	indexCh = stg.search(ch.toLowerCase());
	chlength = ch.length;
	charAfter = (indexCh + chlength + 1) > stg.length || stg.charAt(indexCh + chlength) == " " || stg.charAt(indexCh + chlength) == "." || stg.charAt(indexCh + chlength) == "!" || stg.charAt(indexCh + chlength) == "?" || stg.charAt(indexCh + chlength) == "," || stg.charAt(indexCh + chlength) == ";" || stg.charAt(indexCh + chlength) == ":";
	charBefore = (indexCh -1) < 0 || stg.charAt(indexCh - 1) == " " || stg.charAt(indexCh - 1) == "." || stg.charAt(indexCh - 1) == "!" || stg.charAt(indexCh - 1) == "?" || stg.charAt(indexCh - 1) == "," || stg.charAt(indexCh - 1) == ";" || stg.charAt(indexCh - 1) == ":";
	/*ch est dans stg && (ch est au début de stg || ch est en fin de stg || ch est dans stg || ch est stg)*/
	cond  = indexCh != -1 && charBefore && charAfter;
	if(cond) {
		if(elem.className != null) elem.className = elem.className + " " + class_name;
		else elem.className = " " + class_name;
		elemParent = elem.parentNode;
		if(elemParent) {
			/*if(elemParent.tagName == 'DIV'){
				eParent = elemParent.parentNode;
				if(eParent) {
					elemParentId = eParent.getAttribute("id");
					if(elemParentId && elemParentId.indexOf("_") != -1 && elemParentId.split("_")[0] == "navLeft") {
						eParent.className = eParent.className + " red" ;
					}
				}
			} else {*/
				elemParentId = elemParent.getAttribute("id");
				if(elemParentId && elemParentId.indexOf("_") != -1 && elemParentId.split("_")[0] == "navLeft") {
					elemParent.className = elemParent.className + " red" ;
				}
			/*}*/
		}
	}
}
function fill_city(formId) {
	var myForm = document.getElementById(formId);
	myForm.fillCity.value = 1;
	myForm.submit();
}
function sendToFriends() {
	var ami = document.forms.formAmi;
	if(ami.mail1.value=="") {
		alert("veuillez saisir le 1er email");
		ami.mail1.focus();
		return false;
	}
	if(!ami.mail1.value.match("^.+@.+\\..+$")) {
		alert("Veuillez saisir un email valide pour le 1er ami.");
		ami.mail1.focus();
		return false;
	}

	if(ami.mail2.value!="" && !ami.mail2.value.match("^.+@.+\\..+$")) {
		alert("Veuillez saisir un email valide pour le 2eme ami.");
		ami.mail2.focus();
		return false;
	}
	
	if(ami.mail3.value!="" && !ami.mail3.value.match("^.+@.+\\..+$")) {
		alert("Veuillez saisir un email valide pour le 2eme ami.");
		ami.mail3.focus();
		return false;
	}
	
	if(ami.nom.value=="") {
		alert("Veuillez saisir votre nom.");
		ami.nom.focus();
		return false;
	}	
	
	if(ami.mail.value=="") {
		alert("veuillez saisir votre email");
		ami.mail.focus();
		return false;
	}
	
	if(!ami.mail.value.match("^.+@.+\\..+$")) {
		alert("Votre email n\'est pas valide.");
		ami.mail1.focus();
		return false;
	}


}



/**** menu **/


var myurl = "";
var myorder = "";

function set_url(url) {

	myurl = url;

}

function set_order(order) {

	myorder = order;

}

function getObj(name) {

	if (document.getElementById) { 
	
	 	this.obj = document.getElementById(name);
		this.style = document.getElementById(name).style; 
		
	}  else if (document.all) {	  
	
		this.obj = document.all[name];
		this.style = document.all[name].style;	
		
	} else if (document.layers) { 
	
	  	this.obj = document.layers[name];
	  	this.style = document.layers[name];	 
		
	}
	
}

function getAbsoluteLeft(objectId){
	var x = (new getObj(objectId)).obj;
	var xLeft = x.offsetLeft;
	while(x.offsetParent!=null){
		var xParent = x.offsetParent;
		xLeft += xParent.offsetLeft;
		x = xParent;
	}
	return xLeft;
}

function getAbsoluteTop(objectId){
	var x = (new getObj(objectId)).obj;
	var xTop = x.offsetTop;
	while(x.offsetParent!=null) {
		var xParent = x.offsetParent;
		xTop += xParent.offsetTop;
		x = xParent;
	}
	return xTop;
}

function getWidth(objectId){
	return (new getObj(objectId)).obj.offsetWidth;
}
function getHeight(objectId){
	return (new getObj(objectId)).obj.offsetHeight;
}

/* click droit  */

document.onmousemove = position;
var positionX=0;
var positionY=0;
var offsetYAdd=0;
var offsetXAdd=0;

function getMousePos(e) {

	if(document.all) {
    	positionX=event.x+document.body.scrollLeft; 
    	positionY=event.y+document.body.scrollTop;		
	} else {
		positionX=e.pageX; 
		positionY=e.pageY; 
   }

}

var isVisibleMenu = 0;

function setVisibleMenu(visible){
	isVisibleMenu = visible;
}

function setMenu(){

	if(document.getElementById("menu").style.visibility=="visible") {
		masque_menu();
	}
	
	//lay = new getObj("layCom");
	
	if(document.getElementById("layCom").style.visibility=="visible") {
		
		closeMenu();
	} else { 
	//alert("setMenu");
		document.getElementById("layCom").style.top = (getAbsoluteTop("toolbar_top")+getHeight("toolbar_top"))+'px';
		document.getElementById("layCom").style.left = (getAbsoluteLeft("toolbar_top")+7)+'px';
		document.getElementById("layCom").style.visibility="visible";

		//si le menu trop haut
		if(document.getElementById("sujet")) {
			document.getElementById("sujet").style.visibility="hidden";
		}	
	}
}

function position(e) {
	if(navigator.platform.indexOf('Mac') != -1 || navigator.userAgent.indexOf('Netscape') != -1){
		offsetYAdd = document.body.scrollTop;
		offsetXAdd = document.body.scrollLeft;
	} else {
		offsetYAdd = document.documentElement.scrollTop;
		offsetXAdd = document.documentElement.scrollLeft;
	}
	positionX = (navigator.appName.substring(0,3) == "Net") ? e.pageX+"px" : event.clientX+offsetXAdd+"px";
	positionY = (navigator.appName.substring(0,3) == "Net") ? e.pageY+"px" : event.clientY+offsetYAdd+"px";
}

function affiche_menu() {
	document.getElementById("menu").style.position = "absolute";
	document.getElementById("menu").style.zindex = "200";
	document.getElementById("menu").style.visibility = "visible";
	document.getElementById("menu").style.display     = "block";
	document.getElementById("menu").style.left = positionX;
	document.getElementById("menu").style.top = positionY;
	return false;
}

function masque_menu () {
	document.getElementById("menu").style.visibility  = "hidden";
	document.getElementById("menu").style.display     = "none";
}

function masque_menus () {
	if(document.getElementById("menu") && document.getElementById("menu").style.visibility  == "visible")
		masque_menu();
		
	if(document.getElementById("layCom") && document.getElementById("layCom").style.visibility  == "visible" && isVisibleMenu != 1)
		closeMenu();

	isVisibleMenu = 0;
}

function admin_popup(page,largeur,hauteur) {
	if(document.getElementById("menu")) masque_menu();

	largeur = largeur ? largeur : 550;
	hauteur = hauteur ? hauteur : 600;	


	var gauche = ( screen.width - largeur ) / 2;
	var haut = ( screen.height - hauteur ) / 2;
	var a = window.open(page,"site_manager","width="+largeur+",height="+hauteur+",top="+haut+",left="+gauche+",scrollbars=1");
	return false;
}

function admin_link(page,largeur,hauteur) {

	if(document.getElementById("menu")) masque_menu();

	largeur = largeur ? largeur : 550;
	hauteur = hauteur ? hauteur : 350;	


	var gauche = ( screen.width - largeur ) / 2;
	var haut = ( screen.height - hauteur ) / 2;
	var a = window.open(page,"link_manager","width="+largeur+",height="+hauteur+",top="+haut+",left="+gauche+",scrollbars=1");
	return false;
}

function order_popup(page,order,myorder,largeur,hauteur) {
	//console.log(order);
	//console.log(myorder);
	masque_menu();
	largeur = largeur ? largeur : 1;
	hauteur = hauteur ? hauteur : 1;	

	var gauche = ( screen.width - largeur ) / 2;
	var haut = ( screen.height - hauteur ) / 2;
	var a = window.open(page+"&order="+order+"&myorder="+myorder,"site_manager","width="+largeur+",height="+hauteur+",top="+haut+",left="+gauche);
	return false;
}


/* click droit  */

function checkIdentification() {

	var form = document.forms.identification;
	if(form.nom.value=="") {
		alert("veuillez saisir votre nom");
		form.nom.focus();
		return false;
	}
	if(form.prenom.value=="") {
		alert("veuillez saisir votre prénom");
		form.prenom.focus();
		return false;
	}
	if(form.email.value=="") {
		alert("veuillez saisir votre email");
		form.email.focus();
		return false;
	}
	if(form.message.value=="") {
		alert("veuillez saisir votre message");
		form.message.focus();
		return false;
	}
}
