function popup(url,w,h) {
	var newdivfiltre = document.createElement('div');
	newdivfiltre.setAttribute('id','filtre');
	newdivfiltre.setAttribute('class','filtre');
	newdivfiltre.style.height = document.body.scrollHeight;
	document.body.appendChild(newdivfiltre);

	var newdiv = document.createElement('div');
	var divTop;
	var divLeft;
	if (w.toString().indexOf("%") != -1) {
		divWidth = w.substr(0,w.length-1) * (window.innerWidth?window.innerWidth:document.body.clientWidth) / 100;
//		divWidth = 0.96*(window.innerWidth?window.innerWidth:document.body.clientWidth);
//		divLeft = 0.01*(window.innerWidth?window.innerWidth:document.body.clientWidth);
		divLeft = parseInt((window.innerWidth?window.innerWidth:document.body.clientWidth)/2)-(divWidth/2);
	} else {
		if (w==0) {
			divWidth = 560;
		} else {
			divWidth = w;
		}
		divLeft = parseInt((window.innerWidth?window.innerWidth:document.body.clientWidth)/2)-(divWidth/2);
	}
//	divWidth = (w==0)?560:w;
//	alert(divWidth);

//	alert(divLeft);
	if (h.toString().indexOf("%") != -1) {
		divHeight = h.substr(0,h.length-1) * ( (typeof(window.innerHeight)!=="undefined")?window.innerHeight:document.getElementsByTagName('body')[0].clientHeight ) / 100;
//		divHeight = 0.92*( (typeof(window.innerHeight)!=="undefined")?window.innerHeight:document.getElementsByTagName('body')[0].clientHeight );
		divTop = 75 + (window.scrollY?window.scrollY:document.body.scrollTop);
	} else {
		divTop = 75 + (window.scrollY?window.scrollY:document.body.scrollTop);
		if (h==0) {
			divHeight = (typeof(window.innerHeight)!=="undefined")?window.innerHeight:document.getElementsByTagName('body')[0].clientHeight;
			divHeight -= 200;
		} else {
			divHeight = h;
		}
		divHeight += 10;
	}
//	alert("divHeight "+divHeight);
	newdiv.setAttribute('id','popup');
	newdiv.setAttribute('class','popup');
	newdiv.className = "popup";
	newdiv.innerHTML = "<p class=\"d\" id=\"blochaut\"><a href=\"javascript:fermerpopup()\" title=\"Fermer\" class=\"fermer\">Fermer</a></p>";
	newdiv.innerHTML = newdiv.innerHTML + '<iframe src="' + url + '" scrolling="auto" frameborder=\"0\" width=\"' + divWidth + '\" height=\"' + divHeight + '\" />';
	newdiv.style.position = "absolute";
	newdiv.style.top = divTop;
	newdiv.style.left = divLeft;
	newdiv.style.width = divWidth;
	newdiv.style.height = divHeight;
	document.body.appendChild(newdiv);

//	if (window.innerWidth) Drag.init(newdiv);
	Drag.init(newdiv);
	newdiv.style.top = divTop+"px";
	
//	alert("Position : " + document.getElementById("popup").style.position);
//	alert("Left : " + document.getElementById("popup").style.left);
//	alert("Height : " + document.getElementById("popup").style.height);
	return false;
}
function fermerpopup() {
	document.body.removeChild(document.getElementById('filtre'));
	document.body.removeChild(document.getElementById('popup'));
}

function popupPDF(url) {
	var newdivfiltre = document.createElement('div');
	newdivfiltre.setAttribute('id','filtre');
	newdivfiltre.setAttribute('class','filtre');
	newdivfiltre.style.height = document.body.scrollHeight;
	document.body.appendChild(newdivfiltre);

	var newdiv = document.createElement('div');
	divWidth = (typeof( window.innerWidth)!=="undefined")?window.innerWidth:document.getElementsByTagName('body')[0].clientWidth;
	divWidth = parseInt(divWidth*0.9);
	divHeight = (typeof( window.innerHeight)!=="undefined")?window.innerHeight:document.getElementsByTagName('body')[0].clientHeight;
	divHeight = parseInt(divHeight*0.9);
//	alert("divWidth"+divWidth+"\n"+"divHeight"+divHeight);
	var divTop = parseInt((window.innerHeight?window.innerHeight:document.body.clientHeight)/2)-(divHeight/2);
	if (document.body && ( document.body.scrollLeft || document.body.scrollTop )) {
		scrOfY = document.body.scrollTop;
	} else if (document.documentElement && (document.documentElement.scrollLeft || document.documentElement.scrollTop)) {
		scrOfY = document.documentElement.scrollTop;
	} else {
		scrOfY = 0;
	}
	divTop = divTop + scrOfY;
	var divLeft = parseInt((window.innerWidth?window.innerWidth:document.body.clientWidth)/2)-(divWidth/2);
	
	newdiv.setAttribute('id','popup');
	newdiv.setAttribute('class','popup');
	newdiv.className = "popup";
	newdiv.innerHTML = "<p class=\"d\" id=\"blochaut\"><a href=\"" + url + "\" target=\"_blank\" title=\"Ouvrir en plein écran dans une nouvelle fenêtre\">Plein écran</a> | <a href=\"javascript:fermerpopup()\" title=\"Fermer\" class=\"fermer\">Fermer</a></p>";
	newdiv.innerHTML = newdiv.innerHTML + '<iframe src="' + url + '" scrolling="auto" frameborder=\"0\" width=\"' + divWidth + '\" height=\"' + divHeight + '\" id=\"popupiframe\"/>';
	newdiv.style.position = "absolute";
	newdiv.style.top = divTop;
	newdiv.style.left = divLeft;
	newdiv.style.width = divWidth;
	newdiv.style.height = divHeight;
	document.body.appendChild(newdiv);

	if (window.innerWidth) Drag.init(newdiv);
	newdiv.style.top = divTop+"px";
	
//	alert("Position : " + document.getElementById("popup").style.position);
//	alert("Left : " + document.getElementById("popup").style.left);
//	alert("Height : " + document.getElementById("popup").style.height);
	return false;
}
