// windowlauncher.js
// the couch design studio

// This is a simple JavaScript function to launch a browser window without
// a toolbar, status bar etc, and with the dimentions that are specified.


var	stripHeight		= 34;	// Number of pixels of black strip below image
var cropPixels		= 16;	// Number of pixels to ÒcropÓ the window, see
							// comment in function

function	OpenImageWindow( imageWidth, imageHeight, url )
{
	var	windowParams;
	var windowWidth;
	var windowHeight;
	
	// The browser adds 16 pixels (maybe for a scroll bar)
	// to whatever you specify for the width of the window,
	// we need to reduce our windowWidth by that much

	windowWidth = imageWidth - cropPixels;
	windowHeight = imageHeight + stripHeight;
	
	// Internet explorer does the same thing for the height
	// of the window too
	
	if (BrowserIsExplorer())
	{
		windowHeight -= cropPixels;
	}
	
	windowParams =	"width=" + windowWidth;
	windowParams += ",height=" + windowHeight;
	window.open( url, "", windowParams );
}

// This function returns boolean indicating if the browser is Microsoft
// Internet Explorer

function	BrowserIsExplorer()
{
	if (navigator.appName == "Microsoft Internet Explorer")
		return true;
	else
		return false;
}

