// JavaScript Document

/********************************************************
*  POPUP CENTREE
********************************************************/
function popupcentree(page,largeur,hauteur,options) {
	var top=(screen.height-hauteur)/2;
	var left=(screen.width-largeur)/2;
	window.open(page,"","top="+top+",left="+left+",width="+largeur+",height="+hauteur+","+options);
} 

/********************************************************
*  AJAX CONN
********************************************************/
function createAC(url_, target_, pars_, method_){
	
	var url 	= url_;
	var pars 	= pars_;
	var target 	= target_;
	var meth 	= method_;
		
	var myAjax 	= new Ajax.Updater(
		target, 
		url, 
		{
			method: meth, 
			parameters:pars
		});		
}

/********************************************************
*  EXTERNAL LINK
********************************************************/
function externalLinks() {
	
 if (!document.getElementsByTagName) return;
 var anchors = document.getElementsByTagName("a");
 for (var i=0; i<anchors.length; i++) {
   var anchor = anchors[i];
   if (anchor.getAttribute("href") &&
       anchor.getAttribute("rel") == "external")
     anchor.target = "_blank";
 }
 
}

/********************************************************
*  NAVIGATION IE
********************************************************/

function navHover() {
	var lis = document.getElementById("navmenu-h").getElementsByTagName("LI");
	for (var i=0; i<lis.length; i++) {
		lis[i].onmouseover=function() {
			this.className+=" iehover";
		}
		lis[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" iehover\\b"), "");
		}
	}
}


/********************************************************
*  SIDEBAR SLIDE
********************************************************/

function initSidebar(){
	
	var d = 0.5

	$$('.opmenu').each(function(s,index){
		var elmt = $('opmenu'+index);
		if(elmt){
			if(elmt.visible()) {
				elmt.hide();
			}
			$(s.id).observe('click', function(){
				if(elmt.visible()){
					//do nothing
				}else{
					$$('.opmenu').each(function(s,index){
						var elmtUp = $('opmenu'+index);
						if(elmtUp){
							if(elmtUp.visible()){
								Effect.BlindUp(elmtUp, {duration:d});
							}
						}
					});
					Effect.BlindDown(elmt, {duration:d});
				}
			});
		}
	});
}

Event.observe(window, 'load', externalLinks, false);
//Event.observe(window, 'load', initSidebar, false);

if(navigator.userAgent.indexOf("MSIE 6") != -1)
	Event.observe(window, 'load', navHover, false);



