function inCell(cell, newcolor) {
	if (!cell.contains(event.fromElement)) {
		cell.bgColor = newcolor;
	}
}

function outCell(cell, newcolor) {
	if (!cell.contains(event.toElement)) {
		cell.bgColor = newcolor;
	}
}

function popup(img,w,h) { 
	window.open(img,'','width='+w+',height='+h+', top=20, left=20');
}

function sur_ssmenu(moi,n,htligne) {
   if (moi.id!=menu + "-" +ssmenu) {
       moi.style.backgroundImage='url('+ds+'F'+n+'L'+htligne+'.gif)';
       //moi.style.backgroundImage='url('+ds+'F'+n+'L1.gif)';
       //alert(ds+'F'+n+'L1.gif');
   }
}

function sort_ssmenu(moi,htligne) {
   if (moi.id!=menu + "-" +ssmenu) {
       moi.style.backgroundImage='url('+ds+'inter.gif)';
   } else {
       moi.style.backgroundImage='url('+ds+'F'+menu+'H'+htligne+'.gif)';
       //moi.style.backgroundImage='url('+ds+'F'+menu+'H1.gif)';
   }
}
function sur_menu(num) {
   n=1;
   while (document.getElementById('aff'+n)) {
	if ((n==num)||(n==menu)) { document.getElementById('aff'+n).style.display='block';}  
	else                     { document.getElementById('aff'+n).style.display='none'; }
	n++;
   }
}

function sort_menu() {
   n=1;
   while (document.getElementById('aff'+n)) {
 	if (n==menu) { document.getElementById('aff'+n).style.display='block';}  
	else         { document.getElementById('aff'+n).style.display='none'; }
	n++;
   }   
}


function sur_page(moi) {
   moi.style.backgroundImage = 'url('+ds+'B1.gif)';
   moi.style.backgroundRepeat  = 'no-repeat';
   moi.style.backgroundPositionX = "left";
   moi.style.backgroundPositionY = "top";
   moi.style.color = '#ffffff';
}

function sort_page(moi) {
   moi.style.backgroundImage = '';
   moi.style.color = '#0094D6';
}


window.onload = Init;


function info(moi) {
   alert(document.getElementById(moi).name);
}

function Init() {
	//alert(menu + "-" +ssmenu + "-" + page);
	//pour le positionnement correct du menu et sous menu
	//alert('aff'+menu);		
	if ((menu!=0) && (ssmenu!=0)) {
	        //alert(menu + "-" +ssmenu + "-" + page);
		//alert(menu+"-"+ssmenu);
		//alert(ds+'F'+menu+'H1.gif');
		document.getElementById('aff'+menu).style.display='block';
		if (document.getElementById(menu+"-"+ssmenu).className=="menu1l"){
			document.getElementById(menu+"-"+ssmenu).style.backgroundImage='url('+ds+'F'+menu+'H1.gif)'; 
		}else{
			document.getElementById(menu+"-"+ssmenu).style.backgroundImage='url('+ds+'F'+menu+'H2.gif)'; 
		}
		//alert("mm");
		//alert('aff'+menu);		
	}
	//Traitement des evenements pour revenir au menu correct en cas de sortie quelconque
	if (document.addEventListener) {
		document.getElementById("id").addEventListener("mouseover", traceEvent, false);
	} else {
		document.getElementById("id").onmouseover = traceEvent;
	}
}

function traceEvent(event) {
	var phase, source;

	if (window.event) {
		target = window.event.srcElement.id;
		current = this.id;
		//if (this == window.event.srcElement) phase = "AT TARGET"; else phase = "BUBBLE";
	} else {
		if (event.target.tagName) target = event.target.id;
		else			  target = "[Text]";
		current = event.currentTarget.id;
		//if (event.eventPhase == Event.CAPTURING_PHASE) phase = "CAPTURE"; else if (event.eventPhase == Event.BUBBLING_PHASE) phase = "BUBBLE"; else if (event.eventPhase == Event.AT_TARGET) phase = "AT TARGET";
	}
	//alert("Target = " + target + "; Phase = " + phase + "; Current = " + current);
	//alert("Target = " + target + "; Current = " + current);
	targ=target.substring(0,2);
	if ( ((target =="id") && (current=="id")) ||
	     ((target =="ligne_breve") && (current=="id")) ||
	     ((target =="deb_menu") && (current=="id")) ||
	     ((target =="inner") && (current=="id")) ||
	     ((targ   =="Id") && (current=="id")) ||
	     ((target =="menu_meteo") && (current=="id")) ) {
	     //if (document.getElementById('aff'+menu).style.display!='block') 
	     sort_menu(); 
	}
}
