// JavaScript Document
// OBJ

function getOb(ob) { return (document.all)?eval('document.all.'+ob):(document.getElementById)?eval('document.getElementById("'+ob+'")'):null }
function getHt(ob) { return ob.offsetHeight }
function getLg(ob) { return ob.offsetWidth }
function show(ob) { ob.style.visibility = "visible" }
function hide(ob) { ob.style.visibility = "hidden" }
function enx(ob,px) { if (document.all) ob.style.pixelLeft = px; else ob.style.left = px }
function eny(ob,px) {if (document.all) {ob.style.pixelTop = px} else {ob.style.top = px; } }
function getx(ob) { return (document.all)?ob.style.pixelLeft:parseInt(ob.style.left) }
function gety(ob) { return (document.all)?ob.style.pixelTop:parseInt(ob.style.top) }
function laht(ob,px) { ob.style.height = px }
function lalg(ob,px) { ob.style.width = px }
function clp(ob,htm,lgd,htp,lgg) { ob.style.clip = eval("'rect("+htm+"px, "+lgd+"px, "+htp+"px, "+lgg+"px)'");}
function prop(binf,ind,bsup,min,max) { return parseInt((ind*(max-min)/(bsup-binf))+min) }
function inner(idob,contenu){getOb(idob).innerHTML=contenu;}
// IMG
function swimg(im, sc) { eval( 'document.'+im+'.src = "'+sc+'"' ) }
function iht(im,px) { eval('document.'+im+'.style.height = '+px) }
function ilg(im,px) { eval('document.'+im+'.style.width = '+px) }

// fonction qui affiche les infos invalides du formulaire
function display_show_verif(ob) {if(navigator.appName=="Microsoft Internet Explorer"){getOb(ob).style.display = "block"}else{getOb(ob).style.display = "table-row"} }


function popup(url_page)
{
//    var url_page = "popup.htm";
    var hauteurPopUp = 400;
    var largeurPopUp = 400;
    var hauteurFenetre = screen.height;
    var largeurFenetre = screen.width;
    var top = (hauteurFenetre - hauteurPopUp)/2;
    var left = (largeurFenetre - largeurPopUp)/2;
    var popup = window.open(url_page,"popup","width="+largeurPopUp+"px,height="+hauteurPopUp+"px,top="+top+"px,left="+left+"px,menubar=no,resizable=no,scrollbars=no");
    popup.focus();
}



/*--------------------------- sondage --------------------------------------*/
function verif_sondage(langue,form_sondage)
{
	var choix_sondage = false;
	var sondage = getOb(form_sondage);
	for(var i=0; i<document.sondage.length; i++)
	{
		if(document.sondage[i].checked)
		{
			choix_sondage=true;
		}
	}
	if(!choix_sondage)
	{
		if(langue=='fr')
		{
			alert("Vous devez répondre au sondage pour le valider.")
		}
		else
		{
			alert("Traduction en anglais")
		}
	}
	return choix_sondage;
}
/*--------------------------- /sondage --------------------------------------*/

/*--------------------------- image --------------------------------------*/
function image_avec_croix(chemin_image,largeur,hauteur)
{
	if(largeur>391)
	{alert("L'image ayant le chemin \""+chemin_image+"\" n'est pas affichée car sa largeur dépasse les 391 pixels.")}
	else
	{
	var rendu = '<div>'+
				'<div><img style="margin:3px;" src="'+chemin_image+'"/></div>' +
				'<div class="croix_img" style="top:'+0+'px;left:'+0+'px;"></div>' +
				'<div class="croix_img" style="top:'+0+'px;left:'+(largeur-1)+'px;"></div>' +
				'<div class="croix_img" style="top:'+(hauteur-1)+'px;left:'+0+'px;"></div>' +
				'<div class="croix_img" style="top:'+(hauteur-1)+'px;left:'+(largeur-1)+'px;"></div>' +
				'</div>';	
	document.writeln(rendu);
	}
}
/*--------------------------- image --------------------------------------*/

/*--------------------------- image --------------------------------------*/
function bordure_form(contenu)
{
	var rendu = '<table cellpadding="0" cellspacing="0" border="0">' +
				'<tr>' +
					'<td class="form_ombre_haut_gauche form_ombre form_ombre_coin">&nbsp;</td>' +
					'<td class="form_ombre_haut form_ombre">&nbsp;</td>' +
					'<td class="form_ombre_haut_droit form_ombre form_ombre_coin">&nbsp;</td>' +
				'</tr>' +
				'<tr>' +
					'<td class="form_ombre_gauche form_ombre form_ombre_coin">&nbsp;</td>' +
					'<td>'+contenu+'</td>' +
					'<td class="form_ombre_droit form_ombre form_ombre_coin">&nbsp;</td>' +
				'</tr>' +
				'<tr>' +
					'<td class="form_ombre_bas_gauche form_ombre form_ombre_coin">&nbsp;</td>' +
					'<td class="form_ombre_bas form_ombre">&nbsp;</td>' +
					'<td class="form_ombre_bas_droit form_ombre form_ombre_coin">&nbsp;</td>' +
				'</tr>' +
				'</table>'
	document.writeln(rendu);
}
/*--------------------------- image --------------------------------------*/

/*--------------------------- fond contenu droit (molecule) --------------------------------------*/
// met la molecule en fond pour le contenu droit si la taille de se contenu le permet 
function mettre_fond_contenu_d()
{
	var hauteur_contenu_d = getOb("contenu_d").offsetHeight;
	var hauteur_corps_contenu_d = getOb("image_contenu_g").offsetHeight + getOb("bloc_contenu_d").offsetHeight;
	var marge_haut_molecule = 10;
	var hauteur_molecule = 110;// relatif au decoupage de l'image
	if((hauteur_contenu_d - (hauteur_corps_contenu_d + marge_haut_molecule + hauteur_molecule)) >0)
	{
		getOb('contenu_d').className = "molecule";
	}
}
/*--------------------------- /fond contenu droit (molecule) --------------------------------------*/

/*----- impression ---------------------------*/
function onclickprint()
{
	var height = screen.height-100;
 	var width = 540;
	var top = (screen.height - height-50)/2;
	var left = (screen.width - width)/2;
 	fenetre_print=window.open('print.htm','print','height='+height+'px,width='+width+'px,left='+left+'px,top='+top+'px,toolbar=no,directories=0,status=0,menubar=0,scrollbars=1,resize=0,resizable=0')
	fenetre_print.focus();
 	//fenetre_print=window.open('print.htm','print','toolbar=no,directories=0,status=0,menubar=0,scrollbars=1,resize=1,resizable=1')
}
/*----- /impression ---------------------------*/

//Lance differentes fonctions sur le onload
/*function checkparamonload()
//{
	if(getOb('contenu_d')!=null)
	{
		mettre_fond_contenu_d();
	}
	/* a enlever */
//	if(getOb("bandeau").offsetWidth>763)
//	{
//		alert('Le site éclate en largeur.')
//	}
//}

//window.onload=checkparamonload
