// FCT Génériques

// 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) {ob.style.display = "block" }
function display_hide(ob) {ob.style.display = "none" }
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(mn,mx,bi,ind,bs) { return (((mx-mn)*ind)/(bs-bi)) }
/*changer le contenu d'un div*/
function inner(idob,contenu){getOb(idob).innerHTML=contenu;}

if (document.ondragstart==null) document.ondragstart=new Function("","return false")

/*positionment de la camera*/
function pos_camera()
{
le_body=document.getElementsByTagName("BODY")[0]
le_td=document.getElementsByTagName("TD")
for (i=0;i<le_td.length;i++)
{

	if (le_td[i].getAttributeNode("class").value=="contenant")
	{
	ob_td=le_td[i];
	break;
	}
	else{ob_td="null"}
}
if (ob_td!="null")
{
var taille_fenetre=getLg(le_body)
pos=(((taille_fenetre-778)/2)+700)

ob_td.style.backgroundImage="url(/public/septembre/html/toolkit/img/find_img_droite.jpg)"
ob_td.style.backgroundPosition=pos+"px 54%"
ob_td.style.backgroundRepeat="no-repeat"
}
}


function openpop(url,w,h)
{
/*
posy =(screen.height/2)-(h/2)
posx =(screen.width/2)-(w/2)
fenetre=window.open(url,'pop',"'resizable=yes,scrollbars=yes,top="+posy+",left="+posx+",width="+w+",height="+h+"'");*/
fenetre=window.open(url,'pop','resizable=yes,scrollbars=yes');
fenetre.focus()
}


/*les selection*/
	function style_selection(_ob,lequel,action){
		if(lequel=="cinema"){
			if (action==0)
			{
				_ob.style.background="none"
				_ob.style.color="black"
				_ob.style.fontWeight="normal"
				_ob.onmouseover=function(){_ob.style.background="url('/public/septembre/html/toolkit/img/puce_camera.gif') no-repeat";}
				_ob.onmouseout=function(){_ob.style.background="url('/public/septembre/html/toolkit/img/e.gif') no-repeat ";}
			}
			else
			{
			_ob.onmouseover=function(){void(0);}
			_ob.onmouseout=function(){void(0);}
			_ob.style.background="url('/public/septembre/html/toolkit/img/puce_camera.gif') no-repeat #B61B22"
			_ob.style.color="white"
			_ob.style.fontWeight="bold"
			}
		}
	}

//declaration de la variable qui contiendra l'ibjet a des templates selection
var a_ob=null
timer=null;
/*montre la selection onmousseover*/
function montre_selection(ob,lestyle) {
	clearTimeout(timer)
	//si un objet et sotcker alors on le remet a sont etat initial
	if (a_ob!=null){
	
	style_selection(a_ob,lestyle,0)
	

	}
	//text-decoration:underline;background:url('../img/puce_camera.gif') no-repeat #B61B22;color:white;font-weight:bold;
	//*//on stocke le nouvel objet 
	ob_entre=ob.childNodes[0]
	a_ob=ob_entre
	//*//on lui applique un nouveau background

		style_selection(a_ob,lestyle,1)

	// on cache le contenu et on montre le boon contenu
	getOb('contenu_sans_rollover').style.display='none';
	getOb('fond_contenu_sans_rollover').style.display='block';
	// on recupere le contenu a afficher
	le_contenu=ob.lastChild.innerHTML;
	// on chnage le contenu et on montre
	getOb('select_change').innerHTML=le_contenu
	show_selection();
	
	if(animation_encours == 1){	
	setTimeout('init_2()',2000);
	}
	else{
	init_2()
	}
	
	
	
	 //cette fonction est dévellopper de cette maniere opour permettre a IE d'afficher le flash
}


function show_selection(){
	//si cette fonction est applele on arrete le timer
	clearTimeout(timer)
}
function hidden_selection(){
	//on attend un certain temps avant de rmettre a l'etat initial
	timer=setTimeout('hidden_selection_bis()',1500)
}

function hidden_selection_bis()
{
	//on remet le A a l'etat inital
	if (a_ob!=null){
	style_selection(a_ob,lestyle,0)
	}
	  getOb('fond_contenu_sans_rollover').style.display='none';
	  getOb('contenu_sans_rollover').style.display='block';
}


//initialise les scrolls
//scroll1 
var scroll1, barscroll, lasouris, scrollbar;

function init() {
	scroll1 = new c_txtscroll('txt_scroll_out','txt_scroll_in',0,1,50)
	barscroll = new c_barscroll('scrollbar','carre',0,4,'fhs','fbs')
	lasouris = new c_souris("maj_scroll","'barscroll','scroll1'")

	scrollbar = new c_bartxtscroll('scrollbar','barscroll','scroll1')
	scrollbar.fctmajOtxt(1)
	scrollbar.majObar()

	// Affiche le scroll si utile
	if (scroll1.depasse()) {
	barscroll.montre(); 
	scroll1.activatewhell();
	}
	else {barscroll.cache()}
}
//scroll2
var scroll2, barscroll2, lasouris2, scrollbar2;
function init_2() {
	clearTimeout(animation)
	getOb("txt_scroll_out2").style.overflow="hidden"
	scroll2 = new c_txtscroll('txt_scroll_out2','txt_scroll_in2',0,1,50)
	barscroll2 = new c_barscroll('scrollbar2','carre2',0,4,'fhs2','fbs2')
	lasouris2 = new c_souris("maj_scroll","'barscroll2','scroll2'")

	scrollbar2 = new c_bartxtscroll('scrollbar2','barscroll2','scroll2')
	scrollbar2.fctmajOtxt(1)
	scrollbar2.majObar()
	// Affiche le scroll si utile
	if (scroll2.depasse()) {barscroll2.montre();scroll2.activatewhell();getOb('haut_scroll2').style.visibility="visible"}else {barscroll2.cache();getOb('haut_scroll2').style.visibility="hidden"}
}
//Lance differnetes fonction sur le onload
function checkparamonload(){
pos_camera();
window.onresize=pos_camera;
	if (getOb('scrollbar')!= null) 
	{
		init();
	}
	if (getOb('selection')!= null) 
	{
		montre_selection(getOb('selection'),'cinema');show_selection();
	}
	if (getOb('selectionactu')!= null) 
	{
		montre_selection(getOb('selectionactu'));show_selection();
	}


}

window.onload=checkparamonload
