
// ADN : Fonction Is_Cookie_ID

// verifie la presence d un identifiant de cookie (nom, path...)

// s'il existe retourne 1 si Field est a 0, sinon la valeur de get_Cookie_Field
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function Is_Cookie_ID( ID , Field ) {

var Looking   = ID + "=";

var Long_Look = Looking.length;

var Cook = document.cookie; 
//alert(Cook);
// var Compteur=0;

if(Cook.length > 0 ) 
	{ 
	if (Cook.indexOf(Looking,0) != -1)
		{
		// 
		return(1);
		}
	}
return( 0 );
}

// ADN : Fonction Go_On_Id_ALRUS
// aiguille suivant la presence d'un cookie 1 si present, 0 si absent
// necessite Is_Cookie_ID
// Location_To_Call1 : URL de destination, si le cookies est present au va directement sur cette URL.
// sinon cette URL est passee a l'URL code ?urlgo=information/information.htm 

function Go_On_Id( Cookie_ID, Location_To_Call1,Location_To_Call2)
{
var ID = Is_Cookie_ID(Cookie_ID, 0 );

if ( ID == 0)
	{        
	//MM_openBrWindow(Location_To_Call2+Location_To_Call1,'code','scrollbars=no,resizable=yes,width=310,height=200')
	Centrer(Location_To_Call2+Location_To_Call1,'code',300,380,'scrollbars=no,resizable=yes');
	return(false);
	}
return(true);
}

function MM_callJS(jsStr) { //v2.0
  return eval(jsStr)
}



///////////////////
// (C) ADN 2003 //
// AV          //
////////////////


var clicked_name=""
var obj_name=null;

function mouseOUT(td_obj){
if (clicked_name != td_obj.id)
 td_obj.style.background='#BDD5EC';
}

function mouseOVER(td_obj){
td_obj.style.background='#FFCC00';
}

function putCLICK(td_obj){
if (obj_name != null){
 obj_name.style.background='#BDD5EC';

 }
  clicked_name=td_obj.id;
  obj_name=td_obj;
  pos_cookie(td_obj.id);
  eteintbtnframe('index');
}

function pos_cookie(nom_img)
{
destroy_cookie('left');
destroy_cookie('index');
document.cookie='haut='+nom_img+'#;path=/';
document.cookie='left=#;path=/';
document.cookie='index=#;path=/';
}

function destroy_cookie(nom_cookie)
{
/*
cookies=document.cookie;
pos=cookies.indexOf(nom_cookie);
	if (pos!=-1)
	{
	
	pos1=cookies.indexOf("=",pos);
	pos2=cookies.indexOf("#",pos1);
	nom_b=cookies.substring(pos1+1,pos2);
	}
	*/
	ladate=new Date(71,10,02);
	document.cookie=nom_cookie+"=;expires="+ladate.toGMTString();
}


function maj_cookie(){
cook = document.cookie;
//alert(cook);
var p = cook.indexOf("haut=");
var p2 = cook.indexOf("#",p);
var value = cook.substring(p+5,p2);
if (value!=""){
nav_name = navigator.appName.toString();
var n = nav_name.toLowerCase().indexOf("netscape");
if (n==-1){
		for (i=0;i<document.all.length;i++){
 			if(document.all[i].id==value){
				clicked_name=value;
				document.all[i].style.background='#FFCC00';
				obj_name=document.all[i];
			}
		}
 }else{
 			if(parseInt(navigator.appVersion) > 4){
 				document.getElementById(value).style.background='#FFCC00';
 				obj_name=document.getElementById(value);
 				clicked_name=value;
			}
 }	
}
}
function eteintbtnframe(nom_frame){
 
nb = window.parent.frames.length;
//alert("eteintbtnframe "+nb);
            for (var i=0;i<nb;i++){
			//alert(window.parent.frames[i].name);
			
           			   if(window.parent.frames[i].name==nom_frame){
					  
			 			 if(window.parent.frames[i].clicked_name!=""){
							 nav_name = navigator.appName.toString();
							 var n = nav_name.toLowerCase().indexOf("netscape");
							if (n==-1){			
			  					for (j=0;j<window.parent.frames[i].document.all.length;j++){
					
										   if(window.parent.frames[i].document.all[j].id!=""){
																if(window.parent.frames[i].document.all[j].id==window.parent.frames[i].clicked_name)
																{
																     //  alert(window.top.frames[i].document.all[j].id+"    "+window.top.frames[i].clicked_name);
																		window.parent.frames[i].clicked_name="";
																		window.parent.frames[i].obj_name=null;
																		window.parent.frames[i].document.all[j].style.background='#4788C9';
																		
																}
											}
								}
							}else{
							// pour netscape
											if(parseInt(navigator.appVersion) > 4){
							 				window.parent.frames[i].document.getElementById(window.parent.frames[i].clicked_name).style.background='#4788C9'; 
											 window.parent.frames[i].clicked_name="";
							 				window.parent.frames[i].obj_name=null;
									   }
							}// fin du else
							
						}
              		 }
					 
            }
}



function Centrer(page,name,largeur,hauteur,options) {
  var haut=(screen.height-hauteur)/2;
  var gauche=(screen.width-largeur)/2;
  window.open(page,name,"top="+haut+",left="+gauche+",width="+largeur+",height="+hauteur+","+options);
}

