// JavaScript Document

if (navigator.platform == "Win32" && navigator.appName == "Microsoft Internet Explorer" && window.attachEvent)
{
	document.writeln('<style type="text/css">img { visibility:hidden; } </style>');
	window.attachEvent("onload", fnLoadPngs);
}

function fnLoadPngs() 
{
	var rslt = navigator.appVersion.match(/MSIE (\d+\.\d+)/, '');
	var itsAllGood = (rslt != null && Number(rslt[1]) >= 5.5);

	for (var i = document.images.length - 1, img = null; (img = document.images[i]); i--) {
		if (itsAllGood && img.src.match(/\.png$/i) != null) 
		{
			var src = img.src;
			img.style.width = img.width + "px";
			img.style.height = img.height + "px";
			img.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + src + "', sizingMethod='scale')"
			img.src = "images/blank.gif";
		}
		
		img.style.visibility = "visible";
	}
}

/*PositionX = 100;
PositionY = 100;
defaultWidth  = 500;
defaultHeight = 500;*/

//if (parseInt(navigator.appVersion.charAt(0))>=4){
//	var isNN=(navigator.appName=="Netscape")?1:0;
//	var isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;
//}

//var optNN='scrollbars=no,width='+defaultWidth+',height='+defaultHeight+',left='+PositionX+',top='+PositionY;
//var optIE='scrollbars=no,width=150,height=100,left='+PositionX+',top='+PositionY;

//function popImage(imageURL,imageTitle)
//function PopupPic(imageURL, imageTitle) 
//{ 
// // Old Method
// //window.open( "imagepop.html?"+imageURL, "", "resizable=1,HEIGHT=400,WIDTH=300");
//	if (isNN)
//	{
//		imgWin=window.open('about:blank','',optNN);
//	}
//	if (isIE)
//	{
//		imgWin=window.open('about:blank','',optIE);
//	}
//	with (imgWin.document)
//	{
//		writeln('<html><head><title>Loading...</title><style>body{margin:0px;}</style>');
//		writeln('<sc'+'ript>');
//		writeln('var isNN,isIE;');
//		writeln('if (parseInt(navigator.appVersion.charAt(0))>=4){');
//		writeln('isNN=(navigator.appName=="Netscape")?1:0;');
//		writeln('isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;}');
//		writeln('function reSizeToImage(){');
//		writeln('if (isIE){');
//		writeln('window.resizeTo(100,100);');
//		writeln('width=250-(document.body.clientWidth-document.images[0].width);');
//		writeln('height=100-(document.body.clientHeight-document.images[0].height);');
//		writeln('window.resizeTo(width,height);}');
//		writeln('if (isNN){');       
//		writeln('window.innerWidth=document.images["George"].width;');
//		writeln('window.innerHeight=document.images["George"].height;}}');
//		writeln('function doTitle(){document.title="'+imageTitle+'";}');
//		writeln('</sc'+'ript>');
//		
//		if (!AutoClose)
//		{
//			writeln('</head><body bgcolor=000000 scroll="no" onload="reSizeToImage();doTitle();self.focus()">')
//		}
//		else
//		{
//			writeln('</head><body bgcolor=000000 scroll="no" onload="reSizeToImage();doTitle();self.focus()" onblur="self.close()">');
//		}
//		
//		writeln('<img name="George" src='+imageURL+' style="display:block"></body></html>');
//		close();		
//	}
//} 

PositionX = 10;
PositionY = 10;
defaultWidth  = 200;
defaultHeight = 200;
var AutoClose = true;

function PopupPic(imageURL, imageTitle)
{
	var obj = window.open('about:blank','','scrollbars=no,resizable=1,width='+defaultWidth+',height='+defaultHeight+',left='+PositionX+',top='+PositionY);
	
	if( !obj ) { return true; }
	
	with(obj.document)
	{
		writeln('<html><head><title>Loading...</title><style>body{margin:0px;}</style>');
		writeln('<sc'+'ript>');
		writeln('function reSizeToImage(){');
		writeln('if( !document.images.length ) { document.images[0] = document.layers[0].images[0]; }');
		writeln('var oH = document.images[0].height, oW = document.images[0].width;');
		writeln( 'if( !oH || window.doneAlready ) { return; }'); //in case images are disabled
		writeln('window.doneAlready = true;'); //for Safari and Opera
		writeln('var x = window; x.resizeTo( oW + 0, oH + 0 );');
		writeln('var myW = 0, myH = 0, d = x.document.documentElement, b = x.document.body;');
		writeln('if( x.innerWidth ) { myW = x.innerWidth; myH = x.innerHeight; }');
		writeln('else if( d && d.clientWidth ) { myW = d.clientWidth; myH = d.clientHeight; }');
		writeln('else if( b && b.clientWidth ) { myW = b.clientWidth; myH = b.clientHeight; }');
		writeln('if( window.opera && !document.childNodes ) { myW += 16; }');
		writeln('x.resizeTo( oW = oW + ( ( oW + 0 ) - myW ), oH = oH + ( (oH + 0 ) - myH ) );');
		writeln('var scW = screen.availWidth ? screen.availWidth : screen.width;');
		writeln('var scH = screen.availHeight ? screen.availHeight : screen.height;');
		writeln('if( !window.opera ) { x.moveTo(Math.round((scW-oW)/2),Math.round((scH-oH)/2)); }');
		writeln('}');
		//writeln('window.innerWidth=document.divImage.width;');
		//writeln('window.innerHeight=document.divImage.height;}');
		writeln('function doTitle(){document.title="'+imageTitle+'";}');
		writeln('</sc'+'ript>');
		
		writeln('</head>');
		writeln('<body onload="reSizeToImage(); doTitle(); self.focus();"' + (AutoClose ? ' onblur="self.close();" ' : '' ) + '>');
		writeln((document.layers?('<layer left="0" top="0">'):('<div style="position:absolute;left:0px;top:0px;display:table;">')));
		writeln('<img src='+imageURL+' alt="Loading image ..." title="" onload="reSizeToImage();">');
   		writeln((document.layers?'<\/layer>':'<\/div>') +' <\/body><\/html>');
		close();
	}
}




