/*
Author : Fedmich

Modification History...
14:06 2006/09/15
5:33 PM 9/14/2006

*/
		
var pops = null;
function show_popup(url, winname, width, height, modal)
{	
	var w = null;
	if (!pops)	pops = new Object();
	
	if (pops[winname])
		if (! pops[winname].closed){
			w = pops[winname];
			try {
				//todo... compare if the same url or need to refresh the pop page...
				/*
				alert(w.location)
				alert(url)
				*/

				w.focus();
				return w;
			}catch(e){ }
		}
	
	if ( typeof(winname) == 'undefined' )
		winname = 'newpopup';
	
	if ( typeof(showModalDialog) != 'undefined' )
		if (modal)
			w = showModalDialog(url,window,'status:false;dialogWidth:'+width+'px;dialogHeight:'+height+'px');
	
	if  (!w)
		w = window.open(url, winname, 'width='+width+',height='+height+',dependent=1' + 
			'status=0,toolbar=0,scrollbars=1,resizable=1');
	
	if (!w)
		return;
	else
		try {
			w.focus();
			pops[winname] = w;
		}
		catch(e){	
			pops[winname] = null;
		}
	return w;
}