
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function owPopUp(p_owUrl, p_owName, p_owWidth, p_owHeight)
{
	var v_owLeft = (self.screen.width - p_owWidth) / 2;
	var v_owTop = (self.screen.height - p_owHeight) / 2;
	var v_options = 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width=' + p_owWidth + ', innerWidth=' + p_owWidth + ', height=' + p_owHeight + ', innerHeight=' + p_owHeight + ', top=' + v_owTop + ', left=' + v_owLeft;
	var v_popup = window.open(p_owUrl, 'BO_OW_' + p_owName, v_options);
	if (!v_popup) {
		alert('L\'ouverture de la fenêtre a été bloquée par un logiciel. Désactivez votre bloqueur de popup et réessayez.');
	} else {
		v_popup.focus();
	}
	return v_popup;
}

function clickViewDetail(pDirectory)
{
	owPopUp('/Frontoffice/Players/PopupPlayerImage.aspx?directory=' + pDirectory + '&pageFrom=encyclo', 'Zoom', 730, 710);
}


function old_setPopupSize(W, H) {
	window.moveTo(0,0);

	// it is important to resize the window to the
	// wanted values first, even if we won't get them.
	window.resizeTo(W, H);

	// create the checkpoint element
	var cp = document.createElement("div");
	cp.style.position = "absolute";
	cp.style.width = "0px";
	cp.style.height = "0px";
	cp.style.right = "0px";
	cp.style.bottom = "0px";

	// we can only read it's position after we
	// insert it into the document
	document.body.appendChild(cp);

	// here we get the actual client size
	var current_width = cp.offsetLeft;
	var current_height = cp.offsetTop;

	// here we find out how much more we need
	// in order to get to the needed W x H size
	// (or in other words, we compute the size of
	// window decorations: border, scroll bars, title)
	var dw = W - current_width;
	var dh = H - current_height;

	// and _finally_ we get what we need
	window.resizeBy(dw, dh);

	// we can safely delete the checkpoint now
	document.body.removeChild(cp);

	var v_owTop = (screen.width -  document.body.clientWidth) / 2;
	var v_owLeft = (screen.height -  document.body.clientHeight) / 2;
	window.moveTo(v_owTop,v_owLeft);
	
}

function setPopupSize(W, H) {
	if (self.innerWidth)
	{
		frameWidth = self.innerWidth;
		frameHeight = self.innerHeight;
	}
	else if (document.documentElement && document.documentElement.clientWidth)
	{
		frameWidth = document.documentElement.clientWidth;
		frameHeight = document.documentElement.clientHeight;
	}
	else if (document.body)
	{
		frameWidth = document.body.clientWidth;
		frameHeight = document.body.clientHeight;
	}
	else return;

	if (frameWidth != W || frameHeight != H)
	{
		newWidth = W;
		newHeight = H;
		if (document.layers)
		{
			tmp1 = parent.outerWidth - parent.innerWidth;
			tmp2 = parent.outerHeight - parent.innerHeight;
			newWidth -= tmp1;
			newHeight -= tmp2;
		}
		
		//parent.window.moveTo(0,0);
		parent.window.resizeTo(newWidth,newHeight);
		parent.window.moveTo((self.screen.width - W)/2, (self.screen.height - H)/2);
		//alert('resized=' + newWidth + '/' + newHeight);
	}
}

