function SetFocus(objID)
{
	obj = document.getElementById(objID);
	if(obj != null) obj.focus();
}

// Properties Variables
// ==============================

// Set the 'Close' button's css classes for 'onMouseOver' and 'onMouseOut' events
// and set the path to a '.css' file that contains these classes' definition

var cssPath = '/css/style.css';
var cssClassButton = 'Button1';
var cssClassButtonOver = 'Button2';

// Script Source: CodeLifter.com
// Copyright 2003
// Do not remove this notice.

// SETUPS:
// ===============================

// Set the horizontal and vertical position for the popup

PositionX = 0;
PositionY = 0;

// Set these value approximately 20 pixels greater than the size of the largest image to be used
// (needed for Netscape)

defaultWidth  = 500;
defaultHeight = 500;

// Set autoclose true to have the window close automatically
// Set autoclose false to allow multiple popup windows

var AutoClose = false;

// Do not edit below this line...
// ================================

var isNN=(navigator.appName=="Netscape")?1:0;
var isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;
var isMZ=(navigator.appName.indexOf("Mozilla")!=-1)?1:0;

var optNN='scrollbars=no,resizable=no,width='+defaultWidth+',height='+defaultHeight+',left='+PositionX+',top='+PositionY;
var optIE='scrollbars=yes,width=150,height=100,left='+PositionX+',top='+PositionY;
var optMZ='scrollbars=no,resizable=no,width='+defaultWidth+',height='+defaultHeight+',left='+PositionX+',top='+PositionY;
var optDefault='scrollbars=no,resizable=no,width='+defaultWidth+',height='+defaultHeight+',left='+PositionX+',top='+PositionY;


function PopImage(imageURL, imageTitle)
{
	pupup = window.open('about:blank','',isIE?optIE:optNN);

	with(pupup.document)
	{
		writeln('<html>');
		writeln('\t<head>');
		writeln('\t\t<title>Loading...</title>');
		writeln('\t\t<style>body{margin:0px;}</style>');
		writeln('\t\t'+'<link href="' + cssPath + '" rel="stylesheet" type="text/css">');
		writeln('\t\t'+'<sc'+'ript>');

		writeln('\t\t\t'+'var isIE;');
		writeln('\t\t\t'+'if(parseInt(navigator.appVersion.charAt(0)) >= 4)');
		writeln('\t\t\t\t'+'isIE = (navigator.appName.indexOf("Microsoft")!=-1)?1:0;');

		writeln('\n');
		writeln('\t\t\t'+'function reSizeToImage()');
		writeln('\t\t\t'+'{');
		writeln('\t\t\t\t'+'var top, left, width, height;');
		writeln('\t\t\t\t'+'if(isIE){');
		writeln('\t\t\t\t\t'+'window.resizeTo(100, 100);');
		writeln('\t\t\t\t\t'+'width  = 150 - (document.body.clientWidth  - document.images[0].width);');
		writeln('\t\t\t\t\t'+'height = 150 - (document.body.clientHeight - document.images[0].height);');
		writeln('\t\t\t\t\t'+'window.resizeTo(width, height);');
		writeln('\t\t\t\t\t'+'left = (screen.availWidth -width )/2;');
		writeln('\t\t\t\t\t'+'top  = (screen.availHeight-height)/2;');
		writeln('\t\t\t\t'+'}else{');
		writeln('\t\t\t\t\t'+'window.innerWidth  = document.images["Image"].width +50;');
		writeln('\t\t\t\t\t'+'window.innerHeight = document.images["Image"].height+60;');
		writeln('\t\t\t\t\t'+'left = (screen.availWidth -window.innerWidth )/2;');
		writeln('\t\t\t\t\t'+'top  = (screen.availHeight-window.innerHeight)/2;');
		writeln('\t\t\t\t'+'}');       
		writeln('\t\t\t\t'+'window.moveTo(left<0?0:left, top<0?0:top);');
		writeln('\t\t\t'+'}');

		writeln('\n');
		writeln('\t\t\t'+'function doTitle()');
		writeln('\t\t\t'+'{');
		writeln('\t\t\t\t'+'document.title = "'+imageTitle+'";');
		writeln('\t\t\t'+'}');

		writeln('\t\t'+'</sc'+'ript>');
		writeln('\t'+'</head>');
		writeln('\t'+'<body scroll="auto" onload="reSizeToImage();doTitle();self.focus()" ' + (AutoClose?'onblur="self.close()':'bgcolor=white') + '>')
		writeln('\t\t'+'<p align=center><img name="Image" src='+imageURL+' style="display:block" /></p>');
		writeln('\t\t'+'<p align=center><input type=button value="Close" OnClick="window.close();" class="'+cssClassButton+'" onmouseover="this.className=\''+cssClassButtonOver+'\';" onmouseout="this.className=\''+cssClassButton+'\';"></p>');
		writeln('\t'+'</body>');
		writeln('</html>');

		close();		
	}
}
