var rub_on="";
page_active ="";
lapage = "";


var IE6 = false, IE7 = false,IE8 = false,
FIREFOX2 = false, FIREFOX = false,
NETSCAPE7 = false, NETSCAPE = false,
OPERA9 = false, OPERA = false,
AUTRE = false;
var strChUserAgent = navigator.userAgent;
var intSplitStart = strChUserAgent.indexOf("(",0);
var intSplitEnd = strChUserAgent.indexOf(")",0);
var strChStart = strChUserAgent.substring(0,intSplitStart);
var strChMid = strChUserAgent.substring(intSplitStart, intSplitEnd);
var strChEnd = strChUserAgent.substring(strChEnd);

if(strChMid.indexOf("MSIE 8") != -1)
IE8 = true;
if(strChMid.indexOf("MSIE 7") != -1)
IE7 = true;
else if(strChMid.indexOf("MSIE 6") != -1)
IE6 = true;
else if(strChEnd.indexOf("Firefox/2") != -1)
FIREFOX2 = true;
else if(strChEnd.indexOf("Firefox") != -1)
FIREFOX = true;
else if(strChEnd.indexOf("Netscape/7") != -1)
NETSCAPE7 = true;
else if(strChEnd.indexOf("Netscape") != -1)
NETSCAPE = true;
else if(strChStart.indexOf("Opera/9") != -1)
OPERA9 = true;
else if(strChStart.indexOf("Opera") != -1)
OPERA = true;
else
AUTRE = true;
// ******************* //
function start_navigation(){	
	// LEFT MENU //
	this.menu = document.getElementById("nav");	
	this.menu.onmouseover=new Function("rd()");
	this.menu.onmouseout=new Function("d();");
	this.submenus = this.menu.getElementsByTagName("span");
	for (var i = 0; i < this.submenus.length; i++){			
		this.submenus[i].onmouseover =new Function("hm(true);s('"+this.submenus[i].id+"');");			
		if (document.getElementById("ss_"+this.submenus[i].id)) {			
		document.getElementById("ss_"+this.submenus[i].id).onmouseover=new Function("rd()");
		document.getElementById("ss_"+this.submenus[i].id).onmouseout=new Function("d();");					
		}						
	}// FIN BOUCLE 1 //	
	
	if (document.getElementById("bt_retour")) {
	document.getElementById("bt_retour").onclick= function(){
	window.history.back();
	}
	}
}
// ******************* //

function invi(divID,flag){
	if (document.getElementById("ss_"+divID)) {
	letop = getTop(document.getElementById(divID))+232;
	document.getElementById("ss_"+divID).style.top = letop+"px";	
	document.getElementById("ss_"+divID).style.visibility=(flag)?'hidden':'visible';	
	}		
}

function show_plan() {
document.getElementById("mega_plan").style.visibility='visible';	
}

function hide_plan() {
document.getElementById("mega_plan").style.visibility='hidden';	
}


var retd;
var rub_encours="";

function h(i){invi(i,1);}
function s(i){invi(i,0);}
function d(){retd=setTimeout("hm(false)",400);}
function rd(){clearTimeout(retd);
	
}

// ******************* //
function hm(action) {
this.menu = document.getElementById("nav");
this.submenus = this.menu.getElementsByTagName("span");
	for (var i = 0; i < this.submenus.length; i++){
	h(this.submenus[i].id);		
	}		
}
// ******************* //


function getTop(MyObject)  {
    if (MyObject.offsetParent)
        return (MyObject.offsetTop);
    else
        return (MyObject.offsetTop);
}



function GetXmlHttpObject(handler){ 
var objXMLHttp=null
	if (window.XMLHttpRequest){
	objXMLHttp=new XMLHttpRequest()
	}else if (window.ActiveXObject){
	objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP")
	}
return objXMLHttp
}





function get_transp (lay) {
if (document.all) {
document.getElementById(lay).style.setAttribute("filter", "alpha(opacity=80);");
}else {
document.getElementById(lay).style.MozOpacity= 0.8;
document.getElementById(lay).style.filter= "alpha(opacity=0.8)";	
}
}


// ********************* FIN AJAX HOME ACTU ************************//

function setOpacity(obj, opacity) {
  opacity = (opacity == 100)?100:opacity;
  
  // IE/Win
  obj.style.filter = "alpha(opacity:"+opacity+")";
  
  // Safari<1.2, Konqueror
  obj.style.KHTMLOpacity = opacity/100;
  
  // Older Mozilla and Firefox
  obj.style.MozOpacity = opacity/100;
  
  // Safari 1.2, newer Firefox and Mozilla, CSS3
  obj.style.opacity = opacity/100;
}


function fadeIn(objId,opacity) {
  if (document.getElementById) {
    obj = document.getElementById(objId);
    if (opacity <= 100) {
      setOpacity(obj, opacity);
      opacity += 4;
	  fadddddd =  window.setTimeout("fadeIn('"+objId+"',"+opacity+")", 10);
    }else {
	clearTimeout(fadddddd);
	setOpacity(obj, 100);
	}
  }
}

function fadeOut(objId,opacity) {
  if (document.getElementById) {
    obj = document.getElementById(objId);
    if (opacity >0) {
      setOpacity(obj, opacity);
      opacity -= 4;
	  fadddddd =  window.setTimeout("fadeOut('"+objId+"',"+opacity+")", 10);
    }else {
	clearTimeout(fadddddd);
	setOpacity(obj, 0);
	}
  }
}


// Ouvre fenetre //
function OW(theURL,winName,features) {
  window.open(theURL,winName,features);
}





function affiche_departement(num_dep) {
var xmlHttp=GetXmlHttpObject();
if (xmlHttp==null){
alert ("Browser does not support HTTP Request");
return;
} 
var url="_inc/fonc_affiche_departement.php";
xmlHttp.onreadystatechange=function() { 
        if (xmlHttp.readyState==4){
            if (xmlHttp.status==200){
              changed_dep(num_dep,xmlHttp);
			 }
		}
    }
xmlHttp.open("POST",url,true);
xmlHttp.setRequestHeader('Content-type','application/x-www-form-urlencoded'); 
xmlHttp.send("num_dep="+num_dep+"&sid="+Math.random());
}

fadddddd="";

function changed_dep(num_dep,dett) {
	//clearTimeout(fadddddd);
	//clearTimeout(fadddddd);
	nombre_dep = dett.responseText;
	
	if (document.getElementById("lay_dep")) {		
		if(nombre_dep>0) {
		document.getElementById("contenu_recharge").innerHTML= "<span><div class='titre_dep'>"+retourne_departement(num_dep)+"("+num_dep+")</div><strong>"+nombre_dep+"</strong> partenaires dans cette r&eacute;gion</span>"; 
		image = document.getElementById("lay_dep");		
		document.onmousemove = detectMouse;		
		document.getElementById("lay_dep").style.visibility="visible";
		setOpacity(image, 0);
		fadeIn("lay_dep",0);
		}	
	}
}

function cache_departement(){
if (document.getElementById("lay_dep")){
document.getElementById("lay_dep").style.visibility="hidden";
document.getElementById("contenu_recharge").innerHTML= "";
document.onmousemove="";
}
}

function detectMouse(e){
    if(parseInt(navigator.appVersion) >=4){
        if(navigator.appName == 'Netscape'){
		document.getElementById("lay_dep").style.top = (e.pageY)+"px";
		document.getElementById("lay_dep").style.left =(e.pageX+20)+"px";            
        } else{		
			if (IE7 == true || IE6 == true || IE8 == true) {
			coo_y = (window.event.clientY)+(document.documentElement.scrollTop);
			coo_x = (window.event.clientX)+(document.documentElement.scrollLeft)+30;
			document.getElementById("lay_dep").style.top = (coo_y)+"px";
			document.getElementById("lay_dep").style.left =(coo_x)+"px"; 
			} else {	
			
			document.getElementById("lay_dep").style.top = (window.event.y)+"px";
			document.getElementById("lay_dep").style.left =(window.event.x+20)+"px";           
	        }
		}
    }
}

function retourne_departement(num) {
tab_dep = new Array();
tab_dep['01'] = "Ain";
tab_dep['02'] = "Aisne";
tab_dep['03'] = "Allier";
tab_dep['04'] = "Alpes-de-Haute-Provence";
tab_dep['05'] = "Hautes-Alpes";
tab_dep['06'] = "Alpes-Maritimes";
tab_dep['07'] = "Ard&egrave;che";
tab_dep['08'] = "Ardennes";
tab_dep['09'] = "Ari&egrave;ge";
tab_dep['10'] = "Aube";
tab_dep['11'] = "Aude";
tab_dep['12'] = "Aveyron";
tab_dep['13'] = "Bouches-du-Rh&ocirc;ne";
tab_dep['14'] = "Calvados";
tab_dep['15'] = "Cantal";
tab_dep['16'] = "Charente";
tab_dep['17'] = "Charente-Maritime";
tab_dep['18'] = "Cher";
tab_dep['19'] = "Corr&egrave;ze";
tab_dep['21'] = "C&ocirc;te-d'Or";
tab_dep['22'] = "C&ocirc;tes-d'Armor";
tab_dep['23'] = "Creuse";
tab_dep['24'] = "Dordogne";
tab_dep['25'] = "Doubs";
tab_dep['26'] = "Dr&ocirc;me";
tab_dep['27'] = "Eure";
tab_dep['28'] = "Eure-et-Loir";
tab_dep['29'] = "Finist&egrave;re";
tab_dep['2A'] = "Corse-du-Sud";
tab_dep['2B'] = "Haute-Corse";
tab_dep['30'] = "Gard";
tab_dep['31'] = "Haute-Garonne";
tab_dep['32'] = "Gers";
tab_dep['33'] = "Gironde";
tab_dep['34'] = "H&eacute;rault";
tab_dep['35'] = "Ille-et-Vilaine";
tab_dep['36'] = "Indre";
tab_dep['37'] = "Indre-et-Loire";
tab_dep['38'] = "Is&egrave;re";
tab_dep['39'] = "Jura";
tab_dep['40'] = "Landes";
tab_dep['41'] = "Loir-et-Cher";
tab_dep['42'] = "Loire";
tab_dep['43'] = "Haute-Loire";
tab_dep['44'] = "Loire-Atlantique";
tab_dep['45'] = "Loiret";
tab_dep['46'] = "Lot";
tab_dep['47'] = "Lot-et-Garonne";
tab_dep['48'] = "Loz&egrave;re";
tab_dep['49'] = "Maine-et-Loire";
tab_dep['50'] = "Manche";
tab_dep['51'] = "Marne";
tab_dep['52'] = "Haute-Marne";
tab_dep['53'] = "Mayenne";
tab_dep['54'] = "Meurthe-et-Moselle";
tab_dep['55'] = "Meuse";
tab_dep['56'] = "Morbihan";
tab_dep['57'] = "Moselle";
tab_dep['58'] = "Ni&egrave;vre";
tab_dep['59'] = "Nord";
tab_dep['60'] = "Oise";
tab_dep['61'] = "Orne";
tab_dep['62'] = "Pas-de-Calais";
tab_dep['63'] = "Puy-de-D&ocirc;me";
tab_dep['64'] = "Pyr&eacute;n&eacute;es-Atlantiques";
tab_dep['65'] = "Hautes-Pyr&eacute;n&eacute;es";
tab_dep['66'] = "Pyr&eacute;n&eacute;es-Orientales";
tab_dep['67'] = "Bas-Rhin";
tab_dep['68'] = "Haut-Rhin";
tab_dep['69'] = "Rh&ocirc;ne";
tab_dep['70'] = "Haute-Sa&ocirc;ne";
tab_dep['71'] = "Sa&ocirc;ne-et-Loire";
tab_dep['72'] = "Sarthe";
tab_dep['73'] = "Savoie";
tab_dep['74'] = "Haute-Savoie";
tab_dep['75'] = "Paris";
tab_dep['76'] = "Seine-Maritime";
tab_dep['77'] = "Seine-et-Marne";
tab_dep['78'] = "Yvelines";
tab_dep['79'] = "Deux-S&egrave;vres";
tab_dep['80'] = "Somme";
tab_dep['81'] = "Tarn";
tab_dep['82'] = "Tarn-et-Garonne";
tab_dep['83'] = "Var";
tab_dep['84'] = "Vaucluse";
tab_dep['85'] = "Vend&eacute;e";
tab_dep['86'] = "Vienne";
tab_dep['87'] = "Haute-Vienne";
tab_dep['88'] = "Vosges";
tab_dep['89'] = "Yonne";
tab_dep['90'] = "Territoire de Belfort";
tab_dep['91'] = "Essonne";
tab_dep['92'] = "Hauts-de-Seine";
tab_dep['93'] = "Seine-Saint-Denis";
tab_dep['94'] = "Val-de-Marne";
tab_dep['95'] = "Val-d'Oise";
tab_dep['971'] = "Guadeloupe";
tab_dep['972'] = "Martinique";
tab_dep['973'] = "Guyane";
tab_dep['974'] = "La R&eacute;union";
tab_dep['975'] = "Saint-Pierre-et-Miquelon";
tab_dep['976'] = "Mayotte";
tab_dep['984'] = "Terres Australes et Antarctiques";
tab_dep['986'] = "Wallis et Futuna";
tab_dep['987'] = "Polyn&eacute;sie Fran&ccedil;aise";
tab_dep['988'] = "Nouvelle-Cal&eacute;donie";
return tab_dep[num];
}

function vide_form(text,lay) {
if (document.getElementById(lay).value == text){
document.getElementById(lay).value ="";
}
}












