// The OpenWindow script
// ---------------------
// This code is made by Silvester Erdeg (slipszi@yunord.net)
// Use it freely :)
// Note: this code depends on browser_sniffer.js
image_window=null;
function OpenWindow(image,width,height,data,force_scrollbars)
{
	// Determine the features
	var features='channelmode=0,directories=0,fullscreen=0,location=0,menubar=0,personalbar=0,status=0,toolbar=0,left=0,top=0,screenX=0,screenY=0';
	// Close the image window if it was previously opened
	if(is_ie4up||is_nav3up)
	{
		if(image_window!=null)
		{
			if(!image_window.closed)
				image_window.close();
			image_window=null;
		}
	}
	// Add the margins
	var hmargin=8;
	var vmargin=8;
	if(is_ie4up)
	{
		hmargin=8;
		vmargin=8;
	}
	width+=2*hmargin;
	height+=2*vmargin;
	// Determine the parent window size
	var window_width,window_height,scrollbar_size;
	if(is_nav5up||is_ie4up)
	{
		window_width=document.body.offsetWidth;
		window_height=document.body.offsetHeight;
		scrollbar_size=20;
	}
	else if(is_nav4up)
	{
		window_width=window.innerWidth;
		window_height=window.innerHeight;
		scrollbar_size=16;
	}
	// Clip the child window size
	var resizeable=1,scrollbars=1;
	if(width>window_width&&height>window_height)
	{
		width=window_width;
		height=window_height;
	}
	else if(width>window_width)
	{
		width=window_width;
		height+=scrollbar_size;
	}
	else if(width>window_width||height>window_height)
	{
		width+=scrollbar_size;
		height=window_height;
	}
	else
		resizeable=0,scrollbars=1;
	if(force_scrollbars!=null)
		scrollbars=1;
	features+=',width='+width+',height='+height;
	features+=',resizable='+resizeable+',scrollbars='+scrollbars;
	// Open the window
	url=(data==null?image:'');
	if(image_window!=null)
		image_window.open(url,'',features);
	else
		image_window=window.open(url,'',features);
	if(data!=null)
	{
		var color;
		var caption;
		if(data.substring(0,1)=='#'&&data.length==7)
			color=data;
		else
			caption=data;
		image_window.document.write("<html>\n");
		image_window.document.write("	<head>\n");
		image_window.document.write("		<meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-2\">\n");
		image_window.document.write("		<link rel=\"stylesheet\" href=\"../styles/slike.css\" type=\"text/css\">\n");
		image_window.document.write("		<title>PRIJATELJ - drustvo prijatelja zivotinja Subotica</title>\n");
		image_window.document.write("	</head>\n");
		if(color==null)
			image_window.document.write("	<body  leftmargin=\"0\" topmargin=\"8\" marginwidth=\"0\" marginheight=\"0\" bgcolor=#AAACB2>\n");
		else
			image_window.document.write("	<body bgcolor=\"",data,"\">\n");
		image_window.document.write("		<div align=\"center\">\n");
		image_window.document.write("			<img src=\"",image,"\" /><br />\n");
		if(caption!=null)
			image_window.document.write("			<br />",caption,"\n");
		image_window.document.write("		</div>\n");
		if(caption!=null)
		{
			image_window.document.write("		<div align=\"center\">\n");
			image_window.document.write("			<a href=\"#\" onclick=\"window.close()\">Zatvori prozor</a>\n");
			image_window.document.write("		</div>\n");
		}
		image_window.document.write("	</body>\n");
		image_window.document.write("</html>\n");
		image_window.document.close();
	}
	return(false);
}
window.onUnload=WindowClose;
function WindowClose()
{
	if(image_window!=null&&!image_window.closed)
		image_window.close();
	return(true);
}