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

function openImg(img)
{
	var X = screen.width / 2 - 250;
	var Y = screen.height / 2 - 250;
	myWin= open("", "displayWindow", "width=1,height=1,status=no,toolbar=no,menubar=no,resizable=no,left="+X+",top="+Y+"");
	myWin.document.open();
	myWin.document.write("<html><head><title></title></head>");
	myWin.document.write("<body topmargin=0 leftmargin=0>");
	myWin.document.write("<a href='javascript:close()'><center><img src="+img+" border=\"0\" name=\"fff\"></center></a>");
	myWin.document.write ("<script language=JavaScript>function resize(){ var xxx = document.fff.width; var yyy = document.fff.height+50; parent.window.resizeTo(xxx, yyy); setTimeout('resize()', 500);}; resize(); </script>")

	myWin.document.write("</body></html>");
	myWin.document.close();
}

function openWin( url, wd, ht)
{
   	var X = screen.width / 2 - wd/2;
	var Y = screen.height / 2 - ht/2;
    window.open( url , 'Print',"width="+wd+",height="+ht+",toolbar=no,menubar=yes,resizable=yes,scrollbars=yes,left="+X+",top="+Y+"");
}



function externalLinks()
{
	if (!document.getElementsByTagName) 
		return;

	var anchors = document.getElementsByTagName("*");
	for (var i=0; i<anchors.length; i++)
	{
		var anchor = anchors[i];
		if (anchor.getAttribute("rel") == "external")
			anchor.target = "_blank";
	}
}          
                           
addLoadEvent (externalLinks);
