//**********************************************************************
// 	functions.js - COntains all JavaScript functions
//**********************************************************************
//	Copyright - by K Y Chohdry - 2005
//**********************************************************************

screenLocationX = 100;
screenLocationY = 100;

NNWidth  = 500;
NNHeight = 500;

var CloseAfterShow = true;

if (parseInt(navigator.appVersion.charAt(0))>=4){
	var isNetscape=(navigator.appName=="Netscape")?1:0;
	var isIExterminator=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;
}
var textNN='scrollbars=no,width='+NNWidth+',height='+NNHeight+',left='+screenLocationX+',top='+screenLocationY;
var textIE='scrollbars=no,width=150,height=100,left='+screenLocationX+',top='+screenLocationY;
function showImageWindow(image_file,image_title){
	if (isNetscape){ImageWindow=window.open('about:blank','',textNN);}
	if (isIExterminator){ImageWindow=window.open('about:blank','',textIE);}
	with (ImageWindow.document){
		writeln('<html><head><title>Opening Image...</title><style>body{margin:0px;}</style>');
		writeln('<sc'+'ript>');
		writeln('var isNetscape,isIExterminator;');
		writeln('if (parseInt(navigator.appVersion.charAt(0))>=4){');
		writeln('isNetscape=(navigator.appName=="Netscape")?1:0;');
		writeln('isIExterminator=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;}');
		writeln('function reSizeToImage(){');
		writeln('if (isIExterminator){');
		writeln('window.resizeTo(100,100);');
		writeln('width=100-(document.body.clientWidth-document.images[0].width);');
		writeln('height=100-(document.body.clientHeight-document.images[0].height);');
		writeln('window.resizeTo(width,height);}');
		writeln('if (isNetscape){');       
		writeln('window.innerWidth=document.images["imgObject"].width;');
		writeln('window.innerHeight=document.images["imgObject"].height;}}');
		writeln('function doTitle(){document.title="'+image_title+'";}');
		writeln('</sc'+'ript>');
		if (!CloseAfterShow) 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="imgObject" src='+image_file+' style="display:block"></body></html>');
		close();		
	}
}
