
/*****************************
**   P o p u p s
**   standard methods
******************************/

function popupImg( src, title )
{
	var html = { title: title, style:'', body:'' };	
	html.style = 'BODY {padding:0; margin:0; background-color: #fbf9f6; }';
	html.body = '<A HREF="/" onClick="opener.focus(); self.close(); return false;">' + 
		'<IMG SRC="'+ src +'" BORDER="0" TITLE="Закрыть" ID="resizeBy" hspace="5" vspace="5"/>' + 
		'</A>';			
	popupPro( html, null );
}

function popupPro( html, args ) 
{    	
    args = (args && args.length == 7) ? args : ['no','no','no','no','no','no','no'];	
	try	{ if ( popup ) popup.close(); } catch ( e ) {}
	var win;	
	popup = window.open( '','popup','top=0,left=0,toobar='+args[0]+',location='+args[1]+',directories='+args[2]+',status='+args[3]+',resizable='+args[4]+',scrollbars='+args[5]+',copyhistory='+args[6]+',width=1,height=1' );			
	doc = popup.document;
	var str ='<HTML><HEAD><TITLE>' + html.title + '</TITLE>' +    
	'<STYLE>'+html.style+'</STYLE><SCRIPT>function resize() {var resizeByObj = document.getElementById( "resizeBy" ); if ( resizeByObj ) { resizeTo( resizeByObj.width+20, resizeByObj.height+90); var top = parseInt( (window.screen.height  - ( window.screen.height - window.screen.availHeight ) - resizeByObj.height) / 2); var left = parseInt( (window.screen.width - ( window.screen.width - window.screen.availWidth ) - resizeByObj.width) / 2); moveTo( left, top );}	window.focus();}</SCRIPT></HEAD>' +
	'<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=windows-1251">' + 
    '<BODY onLoad="resize(); self.focus();">' + html.body + '</BODY></HTML>';
	doc.write(str);
	doc.close();	
	self.win = popup;
}

/*

юзать так :

<A onclick="popupImg( this.href, 'title', null ); return false;" 
href="page_big.jpg" target=_blank><IMG src="page_tn.jpg"></A> 

*/