// 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 display_show(ob) {getOb(ob).style.display = "block" }
function display_hide(ob) {getOb(ob).style.display = "none" }
function enx(ob,px) { if (document.all) {getOb(ob).style.pixelLeft = px;}else {getOb(ob).style.left = px+'px'} }
function eny(ob,px) {if (document.all) {getOb(ob).style.pixelTop = px} else {getOb(ob).style.top = px+'px'; } }
function getx(ob) { return (document.all)?getOb(ob).style.pixelLeft:parseInt(getOb(ob).style.left) }
function gety(ob) { return (document.all)?getOb(ob).style.pixelTop:parseInt(getOb(ob).style.top) }
function getHt(ob){return getOb(ob).offsetHeight}
function getLg(ob){return getOb(ob).offsetWidth}
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) }

/*-------- phototheque ------------------*/
/*panoramic*/
largeur_panoramic = null;
defilement_pano=false;
nb_pixel_defil = 5;

function init_panoramic()
{
	largeur_panoramic =  getLg('contenu_panoramic')
}

function defilement(sens)
{
	defilement_pano = true;
	if(sens=='r')
	{
		pano_r()
	}
	if(sens=='l')
	{
		pano_l()
	}
}

function arret_defilement()
{
	defilement_pano = false;
}

function pano_r()
{
	if (defilement_pano)
	{
		if (getx('contenu_panoramic')>=-(largeur_panoramic-getLg('panoramic')))
			enx('contenu_panoramic',getx('contenu_panoramic')- nb_pixel_defil);
	
		if (getx('contenu_panoramic')<-(largeur_panoramic-getLg('panoramic')))
			return;
		setTimeout('pano_r()', 1);
	}
}

function pano_l()
{
	if (defilement_pano)
	{
		if (getx('contenu_panoramic')<0)
			enx('contenu_panoramic',getx('contenu_panoramic')+ nb_pixel_defil);
	
		if (getx('contenu_panoramic')>(largeur_panoramic-getLg('panoramic')))
			return;
		setTimeout('pano_l()', 1);
	}
}
/* /panoramic*/
// permet d'ouvrir la pop up avec l'image en taille réel
function open_img_phototheque(id,l_image,h_image)
{
	var left = (screen.width-h_image)/2;
	var top = (screen.height-h_image)/2;
	var popup = window.open("pg_popup.php?id="+id,"MiniSite","height="+l_image+"px,width="+h_image+"px,left="+left+"px,top="+top+"px,resizable=0,menubar=0,scrollbars=0");
	popup.focus();
}
/*-------- /phototheque ------------------*/

/*-------- implantation ------------------*/
// permet d'ouvrir la pop_up implantation()
function ouvrir_implantation(url)
{
	var hauteurFenetre = 600;
	var largeurFenetre = 522;
	var top = (screen.height-hauteurFenetre)/2;
	//titre fenetre
	hauteurFenetre -= 36;
	var left = (screen.width-largeurFenetre)/2;
	var nouvelleFenetre=open(url,"popup_implantation","width="+largeurFenetre+"px,height="+hauteurFenetre+"px,top="+top+"px,left="+left+"px,menubar=no,resizable=no,scrollbars=no");
	nouvelleFenetre.focus();
}
/*-------- implantation ------------------*/
