/*

	Various window functions

*/

function OpenBrWindow(theURL,winName,features,myWidth,myHeight,isCenter) { 
	if (window.screen)if(isCenter)if(isCenter=="true") {
		var myLeft = (screen.width-myWidth)/2;
		var myTop = (screen.height-myHeight)/2;
		features+=(features!='')?',':'';
		features+=',left='+myLeft+',top='+myTop;
	}
	win=window.open(theURL,winName,features+((features!='')?',':'')+'width='+myWidth+',height='+myHeight);
	win.focus();

	return win;
}

function decorator_popup(src,caption,width,height) {
	var screenx = 0;
	var screeny = 0;

	winheight = height;
	winwidth = width;
	scrollbars = 'no';

	if (window.screen) {
		screenx = (screen.width-winwidth)/2;
		screeny = (screen.height-winheight)/2;
	}

	window.open( src, caption, "width="+winwidth+",height="+winheight+",directories=no,location=no,menubar=no,scrollbars="+scrollbars+",status=no,toolbar=no,resizable=yes,left="+screenx+",top="+screeny );
}

function imagebrowser_popup(src,caption,width,height ) {
	var screenx = 0;
	var screeny = 0;

	winheight = height+20+50;
	winwidth = width+20;
	scrollbars = 'no';

	if (window.screen) {
		if (winheight>(screen.height*0.7)) { winheight=screen.height*0.7; winwidth+=20; scrollbars='yes' }
		if (winwidth>(screen.width)) { winwidth=screen.width; scrollbars='yes' }
		screenx = (screen.width-winwidth)/2;
		screeny = (screen.height-winheight)/2;
	}

	window.open( "./imagebrowserpopup.php?s="+src+"&w="+width+"&h="+height+"&t="+caption, "imagebrowser_popup", "width="+winwidth+",height="+winheight+",directories=no,location=no,menubar=no,scrollbars="+scrollbars+",status=no,toolbar=no,resizable=yes,left="+screenx+",top="+screeny );
}
