 var newWindow = null;

function closeWin(){
	if (newWindow != null){
		if(!newWindow.closed)
			newWindow.close();
	}
}

function popUpWin(url, or, modwh, strWidth, strHeight){

	var fixw = screen.width;
	var fixh = screen.height;

var modwh = (fixw<=832&&fixh<=624)?'832v624':(fixw>832&&fixw<=1152&&fixh>624&&fixh<=870)?'1024v768':(fixw>1152&&fixw<=1360&&fixh>=720&&fixh<=768)?'1280v720':(fixw>=1280&&fixw<1400&&fixh>768&&fixh<=1024)?'1280v1024':(fixw>=1400&&fixw<1680&&fixh>=900&&fixh<=1050)?'1400v1050':(fixw>=1680&&fixw<=1920&&fixh>=1050&&fixh<=1080)?'1680v1050':(fixw>=1600&&fixw<=1920&&fixh>1080&&fixh<1440)?'1600v1200':(fixw<=1920&&fixh>=1440)?'1920v1440':'1280v1024';

	closeWin();		
	modwh = modwh.toLowerCase();
	
if (or == "hz"){
	if (modwh == "832v624"){strWidth = screen.width;
	strHeight = screen.height;}	
	if (modwh == "1024v768" ){strWidth = screen.availWidth - 150;
	strHeight = screen.availHeight;}
	if (modwh == "1280v720" ){strWidth = screen.availWidth - 230;
	strHeight = screen.availHeight;}
	if (modwh == "1400v1050" ){strWidth = screen.availWidth - 250;
	strHeight = screen.availHeight-104;}
	if (modwh == "1280v1024" ){strWidth = screen.availWidth - 230;
	strHeight = screen.availHeight-104;}
	if (modwh == "1600v1200" ){strWidth = screen.availWidth - 270;
	strHeight = screen.availHeight-144;}	
	if (modwh == "1680v1050" ){strWidth = screen.availWidth - 290;
	strHeight = screen.availHeight-104;}	
	if (modwh == "1920v1440" ){strWidth = screen.availWidth - 380;
	strHeight = screen.availHeight-304;}
	}
if (or == "vr"){
	if (modwh == "832v624"){strWidth = screen.width;
	strHeight = screen.height;}	
	if (modwh == "1024v768" ){strWidth = screen.availWidth - 250;
	strHeight = screen.availHeight;}
	if (modwh == "1280v720" ){strWidth = screen.availWidth - 350;
	strHeight = screen.availHeight;}
	if (modwh == "1400v1050" ){strWidth = screen.availWidth - 400;
	strHeight = screen.availHeight-104;}
	if (modwh == "1280v1024" ){strWidth = screen.availWidth - 350;
	strHeight = screen.availHeight-104;}
	if (modwh == "1600v1200" ){strWidth = screen.availWidth - 450;
	strHeight = screen.availHeight-144;}	
	if (modwh == "1680v1050" ){strWidth = screen.availWidth - 490;
	strHeight = screen.availHeight-104;}	
	if (modwh == "1920v1440" ){strWidth = screen.availWidth - 550;
	strHeight = screen.availHeight-304;}
	}

if (or == "vertiscroll"){
	if (modwh == "832v624"){strWidth = screen.width;
	strHeight = screen.height;}	
	if (modwh == "1024v768" ){strWidth = screen.availWidth - 60;
	strHeight = screen.availHeight;}
	if (modwh == "1280v720" ){strWidth = screen.availWidth - 100;
	strHeight = screen.availHeight;}
	if (modwh == "1400v1050" ){strWidth = screen.availWidth - 140;
	strHeight = screen.availHeight;}
	if (modwh == "1280v1024" ){strWidth = screen.availWidth - 100;
	strHeight = screen.availHeight;}
	if (modwh == "1600v1200" ){strWidth = screen.availWidth - 200;
	strHeight = screen.availHeight;}	
	if (modwh == "1680v1050" ){strWidth = screen.availWidth - 220;
	strHeight = screen.availHeight;}	
	if (modwh == "1920v1440" ){strWidth = screen.availWidth - 280;
	strHeight = screen.availHeight;}
	}

	var rightpos=(screen.availWidth - strWidth)-7; // - 7 de base / position droite
	var rightpos1=(screen.availWidth - strWidth)-67;
	var rightpos2=(screen.availWidth - strWidth)-47;
	var rightpos3=(screen.availWidth - strWidth)-87;
	var rightpos4=(screen.availWidth - strWidth)-107;

	var H = (screen.height - (strHeight)) / 2; // centre
	var L = (screen.width - (strWidth)) / 2; // centre
	
	var tools="";
if ((or == "hz") || (or == "vr")) {
		if (modwh == "832v624") tools = "type=fullWindow,fullscreen,resizable=no,toolbar=no,location=no,menubar=no,scrollbars=no,status=no,width="+strWidth+",height="+strHeight+",left=0,top=0";
		if (modwh == "1024v768") tools = "resizable=no,toolbar=no,location=no,menubar=no,scrollbars=no,status=no,width="+strWidth+",height="+strHeight+",top=0,left="+rightpos+"";
		if (modwh == "1280v720") tools = "resizable=no,toolbar=no,location=no,menubar=no,scrollbars=no,status=no,width="+strWidth+",height="+strHeight+",top=0,left="+rightpos2+"";
		if (modwh == "1400v1050") tools = "resizable=no,toolbar=no,location=no,menubar=no,scrollbars=no,status=no,width="+strWidth+",height="+strHeight+",top=20,left="+rightpos1+"";
		if (modwh == "1280v1024") tools = "resizable=no,toolbar=no,location=no,menubar=no,scrollbars=no,status=no,width="+strWidth+",height="+strHeight+",top=20,left="+rightpos2+"";
		if (modwh == "1600v1200") tools = "resizable=no,toolbar=no,location=no,menubar=no,scrollbars=no,status=no,width="+strWidth+",height="+strHeight+",top=40,left="+rightpos3+"";
		if (modwh == "1680v1050") tools = "resizable=no,toolbar=no,location=no,menubar=no,scrollbars=no,status=no,width="+strWidth+",height="+strHeight+",top=60,left="+rightpos4+"";
		if (modwh == "1920v1440") tools = "resizable=no,toolbar=no,location=no,menubar=no,scrollbars=no,status=no,width="+strWidth+",height="+strHeight+",top="+H+",left="+L+"";
		}
	else if (or == "vertiscroll") {
		if (modwh == "832v624") tools = "type=fullWindow,fullscreen,resizable=no,toolbar=yes,location=yes,menubar=yes,scrollbars=yes,status=yes,width="+strWidth+",height="+strHeight+",left=0,top=0";
		if (modwh == "1024v768") tools = "resizable=no,toolbar=yes,location=yes,menubar=yes,scrollbars=yes,status=yes,width="+strWidth+",height="+strHeight+",top=0,left="+L+"";
		if (modwh == "1280v720") tools = "resizable=no,toolbar=yes,location=yes,menubar=yes,scrollbars=yes,status=yes,width="+strWidth+",height="+strHeight+",top=0,left="+L+"";
		if (modwh == "1400v1050") tools = "resizable=no,toolbar=yes,location=yes,menubar=yes,scrollbars=yes,status=yes,width="+strWidth+",height="+strHeight+",top=0,left="+L+"";
		if (modwh == "1280v1024") tools = "resizable=no,toolbar=yes,location=yes,menubar=yes,scrollbars=yes,status=yes,width="+strWidth+",height="+strHeight+",top=0,left="+L+"";
		if (modwh == "1600v1200") tools = "resizable=no,toolbar=yes,location=yes,menubar=yes,scrollbars=yes,status=yes,width="+strWidth+",height="+strHeight+",top=0,left="+L+"";
		if (modwh == "1680v1050") tools = "resizable=no,toolbar=yes,location=yes,menubar=yes,scrollbars=yes,status=yes,width="+strWidth+",height="+strHeight+",top=0,left="+L+"";
		if (modwh == "1920v1440") tools = "resizable=no,toolbar=yes,location=yes,menubar=yes,scrollbars=yes,status=yes,width="+strWidth+",height="+strHeight+",top=0,left="+L+"";
	}

	newWindow = window.open(url, 'newWin', tools);
	newWindow.focus();
}

function findPopUps()
{
var popups = document.getElementsByTagName("tr");
for (i=0;i<popups.length;i++)
	{
		if (popups[i].title)

		popups[i].title = popups[i].title + " Cliquer pour afficher ce plan [Ouverture dans une popup]";
	}
}

// function ppuvoir(){document.getElementById('ppu').style.visibility='visible';}

// function ppucache(){document.getElementById('ppu').style.visibility='hidden';}


addEvent(window, 'load', findPopUps, false);
