function addOnloadEvent(fct){
	var oldonload = window.onload;
	if (typeof window.onload != 'function') {
		window.onload = fct;
	}
	else {
		window.onload = function() {
			oldonload();
			fct();
		}
	}
}

function setPngForIE(){
	var IEversion = navigator.appVersion.split("MSIE ");
	if(IEversion[1] && parseInt(IEversion[1].substr(0,1))<7){
		var dImgs = document.getElementsByTagName("img");
		for(var i=0;i<dImgs.length;i++){
			if(dImgs[i].src.indexOf(".png")==dImgs[i].src.length-4){
				var imgSrc = dImgs[i].src;
				var imgW = dImgs[i].offsetWidth;
				var imgH = dImgs[i].offsetHeight;
				dImgs[i].src="images/IE6.png";
				dImgs[i].style.width = imgW+'px';
				dImgs[i].style.height = imgH+'px';
				dImgs[i].style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+imgSrc+"', sizingMethod=crop)";
			}
		}
	}
}

VerifyClick = function(e){
	if (e.element().tagName=='IMG') e.stop();
}

function DisableContextMenuForImages(){
	Event.observe(document.body, 'contextmenu', VerifyClick, 1);
}

RewriteGetForms = function(e){
	var form = e.element();
	var separator = (form.action.indexOf("?" > -1))?"&":"?";
	var url = form.action + '/' + Form.serialize(form).replace(/[=&]/g, '/').replace(/\/\//g, '/*/').replace(/\/$/,'/*');
	e.stop();
	self.location = url;
}
RewriteGetFormsOnLoad = function(e){
	var forms = $A(document.forms);
	forms.each(function(f){
		if (f.method=='get'){
			Event.observe(f, 'submit', RewriteGetForms, 0);
		}
	});
}

addOnloadEvent(function(){
	setPngForIE();
	//RewriteGetFormsOnLoad();
	//DisableContextMenuForImages();
});

/* DNA: A quoi �a sert ? emp�che la toolbar de s'afficher en ie et on voit pas l'int�r�t... fonctionne nickel sans ds ie et firefox */
/*
var initNavAsapTO;
function initNavAsap(){
	var navTop=document.getElementById("JSmainNavigation");
	if(navTop){
		var LIlst = new Array();
		for(var i=0;i<navTop.childNodes.length;i++){if(navTop.childNodes[i].tagName=="LI")LIlst.push(navTop.childNodes[i]);}
		LIlst[0].className+=" firstNavElement";
		LIlst[LIlst.length-1].className+=" lastNavElement";

		var checkIfMaxWidth = navTop.className=="maxWidth";
		for(var i = navTop;i;i=i.parentNode){
			if(i.className)checkIfMaxWidth = checkIfMaxWidth && (i.className.indexOf("navigationV")==-1);
		}

		if(checkIfMaxWidth){
			var LIwidth=0;
			for(var i=0;i<LIlst.length;i++){LIwidth+=LIlst[i].offsetWidth;}
			var padH = Math.floor((navTop.parentNode.offsetWidth-LIwidth)/LIlst.length);
			var lastPadH = (navTop.parentNode.offsetWidth-LIwidth)%LIlst.length;
		
			for(var i=0;i<LIlst.length;i++){
				LIlst[i].style.paddingLeft=(Math.ceil(padH/2))+"px";
				try{
					LIlst[i].style.paddingRight=(Math.floor(padH/2)+(i==LIlst.length-1?lastPadH:0))+"px";
				}catch(e){
					LIlst[i].style.paddingRight="0px";
				}
			}
		}
		navTop.style.visibility="visible";
	}else{initNavAsapTO = setTimeout("initNavAsap()",20);}
}
setTimeout(function(){if(initNavAsapTO)clearTimeout(initNavAsapTO);},5000);
initNavAsap();
*/
/* used to let the different elements accessible even if javascript is disabled 
document.write("<style>\n"+
	"#JSmainNavigation{visibility:hidden;}\n"+
"</style>");*/
/* used to let the different elements accessible even if javascript is disabled */