
//	XtraLib (php edition)
//	(c)Copyright 2004 Stra Software
//	All Rights Reserved.

//////////////////////////////////////////////
//											//
//	 Target="_blank" compliant with XHTML	//
//											//
//////////////////////////////////////////////
function SetupExternalLinks()
{
	if(document.getElementsByTagName)
	{
		var	AnchorsList=document.getElementsByTagName("a");

		for(var AnchorIndex=0;AnchorIndex<AnchorsList.length;AnchorIndex++)
		{
			var Anchor=AnchorsList[AnchorIndex];

			if(Anchor.getAttribute("href")&&Anchor.getAttribute("rel")=="external")
			{
				Anchor.target="_blank";
			}
		}
	}
}

window.onload=SetupExternalLinks;

//////////////////////////////////////////////
//											//
// Open A Popup Wich Fit Displayed Picture	//
//											//
//////////////////////////////////////////////
function PopupPicture($File,$Comment,$Width,$Height)
{

///	Create Popup Window ///

	var PopupWindow=window.open('','_blank','resizable=1,scrollbars=0,menubar=0,status=0');

	if(!PopupWindow)
	{
		return true;	// Popup blocked (then use failsafe code)
	}

///	Setup HTML Header ///

	PopupWindow.document.write
	(
		'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">\n'+
		'<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" lang="fr">\n'+
		'<head>\n'+
		'<title>\n'+
		$Comment+
		'</title>\n'+
		'<script type="text/javascript">\n'+
		'function FitToContent()'+
		'{'+

'var ClientWidth=0,ClientHeight=0,de=window.document.documentElement,db=window.document.body;'+
'window.resizeTo('+($Width+64)+','+($Height+64)+');'+

'if(window.innerWidth)'+
'{'+
'	ClientWidth=window.innerWidth;'+
'	ClientHeight=window.innerHeight;'+
'}'+
'else if(de&&de.clientWidth)'+
'{'+
'	ClientWidth=de.clientWidth;'+
'	ClientHeight=de.clientHeight;'+
'}'+
'else if(db&&db.clientWidth)'+
'{'+
'	ClientWidth=db.clientWidth;'+
'	ClientHeight=db.clientHeight;'+
'}'+

'if(window.opera&&!document.childNodes)'+
'{'+
'	ClientWidth+=16;'+
'}'+

'window.resizeTo(2*'+$Width+'+64-ClientWidth,2*'+$Height+'+64-ClientHeight);'+

		'} FitToContent();\n'+
		'</script>\n'+
		'</head>\n'+
		'<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" style="overflow: hidden">\n'+
		'<a onclick="window.close()"><img src="'+
		$File+
		'" alt="'+
		$Comment+
		'" width="'+
		$Width+
		'" height="'+
		$Height+
		'" border="0" /></a>\n'+
		'</body>\n'+
		'</html>'
	);

///	Set Window HTML Footer ///

	PopupWindow.document.close();

///	Brind Popup To The Top ///

	if(PopupWindow.focus)
	{
		PopupWindow.focus();
	}

///	Success ///

	return false;
}
