function switchImage(imgName, imgSrc) {
	if (document.images) {
		if (imgSrc != "none") {
			document.images[imgName].src = imgSrc;
		}
	}
}

var popUpWin=0;
function popup(URLStr) {
	if(popUpWin) {
		if(!popUpWin.closed) popUpWin.close();
	}
	var width = 600;
	var height = 500;
	var left = (screen.width/2) - width/2;
	var top = (screen.height/2) - height/2;
	popUpWin = open(URLStr, 'popUpWin', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=yes,width='+width+',height='+height+',left='+left+', top='+top+',screenX='+left+',screenY='+top+'');
}

var CustomWindow=0;
function CW(URLStr, width, height) {
	var left = (screen.width/2) - width/2;
	var top = (screen.height/2) - height/2;  
	if(CustomWindow) {
		if(!CustomWindow.closed) CustomWindow.close();
	}
	CustomWindow = open(URLStr, 'CustomWindow', 'toolbar=no,location=no,directories=no,status=no,menub ar=no,scrollbar=no,resizable=no,copyhistory=yes,width='+width+',height='+height+',left='+left+', top='+top+',screenX='+left+',screenY='+top+'');
}

var coin=0;
function show(image, w, h){
	var left = (screen.width/2) - w/2;
	var top = (screen.height/2) - h/2; 
	if(coin && !coin.closed) {
		coin.close();
	}
	coin=window.open('','coin','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width='+w+',height='+h+',left='+left+',top='+top+',screenX='+left+',screenY='+top+'');
	coin.document.writeln('<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">');
	coin.document.writeln('<html>');
	coin.document.writeln('<head>');
	coin.document.writeln('<title>Picture</title>');
	coin.document.writeln('<meta http-equiv="Copyright" content="OrangeLeo">');
	coin.document.writeln('<meta http-equiv="Reply-to" content="lionet@one.lv">');
	coin.document.writeln('</head>');
	coin.document.writeln('<body background="" bgcolor="" marginheight="0" marginwidth="0" leftmargin="0" topmargin="0">');
	coin.document.write('<a href="javascript:window.close();">');
	coin.document.writeln('<img border="0" src="'+image+'" width='+w+' height='+h+'>');
	coin.document.write('</a></body></html>');
	coin.document.close();
}

PositionX = 50;
PositionY = 50;

defaultWidth  = 50;
defaultHeight = 50;

var AutoClose = true;

// ================================
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){
	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('	} ');
		writeln('	function reSizeToImage(){ ');
		writeln('		if( isIE ){ ');
		writeln('			window.resizeTo(100,100); ');
		writeln('			width = 100-(document.body.clientWidth - document.images[0].width) -100; ');
		writeln('			height = 100-(document.body.clientHeight - document.images[0].height) -100; ');
		writeln('			window.resizeBy(width,height); ');
		writeln('		} ');
		writeln('		if( isNN ){ ');       
		writeln('			window.innerWidth = document.images["George"].width; ');
		writeln('			window.innerHeight = document.images["George"].height; ');
		writeln('		} ');
		writeln('	} ');
		
		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('<a href="javascript:window.close();">');
		//writeln('<a href="">');
		writeln('<img border="0" name="George" src='+imageURL+' style="display:block"></a></body></html>');
		close();		
	}
}
