function addLoadEvent(func) {
	var oldonload = window.onload;
	if (typeof window.onload != 'function') {
		window.onload = func;
	}else {
		window.onload = function() {
			if (oldonload) {
				oldonload();
			}
			func();
		}
	}
};

function adminConnect(){
	 window.scrollTo(0,0);
	xhrConnect = new XMLHttpRequest();
	xhrConnect.onreadystatechange = function(){
		if(xhrConnect.readyState == 4 && xhrConnect.status==200){
			var getFileContent = xhrConnect.responseText;
			var connDiv = document.createElement('div');
			connDiv.id = "connect";
			document.body.appendChild(connDiv);
			document.getElementById('connect').innerHTML = getFileContent;
			document.getElementById('connect').style.display = "block";
		}
	}
	xhrConnect.open("GET","xhr.connexion.php");
	xhrConnect.send(null);
};

function adminConnectExit(){
	document.body.removeChild(document.getElementById('connect'));
};

function setmenushadow(id,mt,ml,cls){
	var src = typeof id == 'string' ? document.getElementById(id) : id;
	src.parentNode.style.position = 'relative';
	src.style.zIndex = '100';
	var cl = src.cloneNode(true);
		cl.style.position = 'absolute';
		cl.style.top = mt+'px';
		cl.style.left = ml+'px';
		cl.setAttribute('style','position:absolute;color:#402208;z-index:-1;border-color:#77440B;');
		if(document.all) cl.style.setAttribute('cssText','position:absolute;color:#402208;z-index:-1;border-color:#77440B;');
		cl.style.top = mt+'px';
		cl.style.left = ml+'px';
		cl.style.width = src.offsetWidth+'px';
	src.parentNode.appendChild(cl);
};

function textShadowCss(css,mt,ml,cls){

}

function removeOldUrl(){
	var a = document.getElementById('contenu').getElementsByTagName('a');
	for(var i=0;i<a.length;i++){
		if(a[i].getAttribute('href')) a[i].href = a[i].href.replace(/\/old/gi,'');
	}
}

var shadow = {
	init : function(container){
		this.container = typeof container == 'string' 
			? document.getElementById(container)
			: container ;
		this.img = this.container.getElementsByTagName('img');
		this.setImgArray();
		this.set();
	},
	setImgArray : function(){
		this.imgArray = [];
		for(var i=0;i<this.img.length; i++){
			if(this.img[i].className == 'insertedImg'){
				var	img = this.img[i],
					w = img.offsetWidth,
					h = img.offsetHeight,
					pLeft = getPosition.findPosX(img),
					pTop = getPosition.findPosY(img);
				this.imgArray.push([
					[img,w,h,pLeft,pTop]
				]);
			}
		}
	},
	set : function(){
		for(var i=0;i<this.imgArray.length;i++){
			this.imgArray[i][0][0].title = "";
			this.imgArray[i][0][0].style.position = "relative";
			this.imgArray[i][0][0].style.zIndex = "1000";
			if(window.XMLHttpRequest){
				var img = document.createElement('img');
					img.src = "old/__image/ombre.png";
					img.style.width = "100%";
					img.style.height = "100%";
			}
			var	shd = document.createElement('div');
				shd.style.width = (this.imgArray[i][0][1]+7)+"px";
				shd.style.height = (this.imgArray[i][0][2]+7)+"px";
				shd.style.position = "absolute";
				shd.style.zIndex = "1";
				shd.style.left = this.imgArray[i][0][3]+"px";
				shd.style.top = this.imgArray[i][0][4]+"px";
				if(window.XMLHttpRequest) 
					shd.appendChild(img);
				else{
					shd.style.filter = 
						'progid:DXImageTransform.Microsoft.AlphaImageLoader'+
						'(src="old/__image/ombre.png",sizingMethod="scale");'
				}
			document.body.appendChild(shd);
		}
	}
};