var MenuOn=0, MenuSH = new Array, TimeId, MainDivs=new Array('menu1','menu2','menu3','menu4','menu5');


browser_name = navigator.appName;
browser_version = parseFloat(navigator.appVersion);

if (browser_name == "Netscape" && browser_version >= 3.0) { roll = 'true'; }
else if (browser_name == "Microsoft Internet Explorer" && browser_version >= 3.0) { roll = 'true'; }
else { roll = 'false'; }

function over(img,ref) { if (roll == 'true') { document.images[img].src = ref; } }
function out(img,ref)  { if (roll == 'true') { document.images[img].src = ref; } }


function preloadImg(file){
  image = new Image();
  image.src = file;
}

function rol_img() {
preloadImg('img/menu/pose_on.gif');
preloadImg('img/menu/materiel_on.gif');
preloadImg('img/menu/lartisan_on.gif');
preloadImg('img/menu/devis_gratuit_on.gif');
preloadImg('img/menu/depannage_on.gif');
preloadImg('img/menu/altualites_on.gif');
preloadImg('img/menu/accueil_on.gif');
}




function navig_d (par,type,nIdDiv,source) {
var lay=document.getElementById(par);


if (type==0) {
MenuSH[par]=1;
MenuOn=1;
clearTimeout(TimeId);
//lay.style.visibility="visible";
lay.style.display="block";
lay.style.visibility="visible";
} //end if type=0

if (type==1) {
MenuSH[par]=0;
if (source=="div") {
	MenuOn=0;
	clearTimeout(TimeId);
	TimeId=setTimeout('HideAllDivs()',500);
} else {
	if (MenuOn) {
		clearTimeout(TimeId);
		TimeId=setTimeout('MenuOff("'+par+'")',500);
	}

}
}//end if type==1

}
function hideChild(arr) {
		for (i=0; i < arr.length; i++) {	
			document.getElementById(arr[i]).style.display="none";
			document.getElementById(arr[i]).style.visibility="hidden";
		}
}

function HideAllDivs () {
	if (!MenuOn) {
		for (i=0; i < MainDivs.length; i++) {
			document.getElementById(MainDivs[i]).style.display="none";
			document.getElementById(MainDivs[i]).style.visibility="hidden";
		}
	}
}

function MenuOff (lid) {
	if ( (!MenuSH[lid]) ) {	
		document.getElementById(lid).style.display="none";
		document.getElementById(lid).style.visibility="hidden";
	}
}

function HideShow (par,t) {
var lay=document.getElementById(par);
if (t==0) { 
	lay.style.display="block";
	lay.style.visibility="visible"; 
	}
if (t==1) {
	lay.style.display="none"; 
	lay.style.visibility="hidden";
	}
}


function menu (td,p,color,colorf,img)
{
if (p==1) {
document.getElementById(td).style.background=color; 
document.getElementById(td).style.color=colorf;
document.getElementById(td).style.textDecoration="none";
}
if (p==2) {
document.getElementById(td).style.background=color+' url(img/'+img+') no-repeat right'; 
document.getElementById(td).style.color=colorf; 
document.getElementById(td).style.textDecoration="underline"; 
}
if (p==3) {
document.getElementById(td).style.background=color+' url(img/'+img+') no-repeat center'; 
document.getElementById(td).style.color=colorf; 
document.getElementById(td).style.textDecoration="underline"; 
}

}
function menuIns (td,p,color,colorf,img)
{
if (p==1) {
document.getElementById(td).style.background=color+' url(img/'+img+') no-repeat left'; 
//document.getElementById(td).style.color=colorf;
//document.getElementById(td).style.textDecoration="underline"; 
}
if (p==2) {
document.getElementById(td).style.background=color+' url(img/'+img+') no-repeat center top'; 
//document.getElementById(td).style.color=colorf;
document.getElementById(td).style.textDecoration="none"; 
}

}

function menuImg (td,p,color,colorf)
{
if (p==1) {
document.getElementById(td).style.backgroundImage='url(img/'+color+')'; 
document.getElementById(td).style.color=colorf;
}
if (p==2) {
document.getElementById(td).style.backgroundImage='url(img/'+color+')';
document.getElementById(td).style.color=colorf; 
}

}

function add_click (url,target) {
if (url) {
//alert("Debug:"+url);
//alert("Debug:"+target);
if (target=="_parent") {
parent.location.href=url;
}
if (target=="_blank") {
window.open(url);
}
if (target=="_self") {
location.href=url;
}
if (target=="_top") {
top.location.href=url;
}
}//end if !url
}

function createTarget(form)
       {
          _target = form.target; _colon = _target.indexOf(":");

        if(_colon != -1)
          {
          form.target = _target.substring(0, _colon);
          form.args   = _target.substring(_colon+1);
          }
        
        else if(typeof(form.args) == "undefined")
               {
               form.args = "";
               }

        if(form.args.indexOf("{")!=-1)
          {
           _args     = form.args.split("{");
           form.args = _args[0];
           
           for(var i = 1; i < _args.length;i++)
              {
                _args[i] = _args[i].split("}");
                form.args += eval(_args[i][0]) + _args[i][1];
               }
           }
           
           form.args = form.args.replace(/ /g,"");
           _win = window.open('',form.target,form.args);
          
          if(typeof(focus)== "function")
                _win.focus();
                return true;
        } 

