// useful javascript functions

// create a popup window - 21/03/09 - gavin taylor
function popup(link, windowname, width, height, scrollbars, status, resizable, location, toolbar, menubar)
{	
	if(!window.focus) { return true; }
	
	//check if additional options are set
	if(scrollbars	== null) 	{ scrollbars 	= 'no'; }
	if(status			== null) 	{ status 			= 'no'; }
	if(resizable 	== null) 	{ resizable 	= 'no'; }
	if(location 	== null) 	{ location 		= 'no'; }
	if(toolbar 		== null) 	{ toolbar 		= 'no'; }
	if(menubar 		== null) 	{ menubar 		= 'no'; }
	
	var href;
	if(typeof(link) == 'string') { href=link; }
	else { href=link.href; }
	
	//window position
	var posleft = (screen.width - width) / 2;
	var postop = (screen.height - height) / 2;
	
	newwindow = window.open(href, windowname, 'width=' + width + ', height=' + height + ',left=' + posleft + ',top=' + postop + ',scrollbars=' + scrollbars + ',status=' + status + ',resizable=' + resizable + ',location=' + location + ',toolbar=' + toolbar + ',menubar=' + menubar + '');
	if(window.focus) {newwindow.focus()}
	return false;
}

//display flash banner
function show_banner(banner_src, banner_width, banner_height)
{
	document.write('  		  <object width="' + banner_width + '" height="' + banner_height + '" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="' + window.parent.document.location.protocol + 'download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0">');
	document.write('            <param name="movie" value="' + banner_src + '" ');
	document.write('            <param name="quality" value="high" />');
	document.write('            <param name="wmode" value="opaque"/>');
	document.write('            <embed wmode="opaque" src="' + banner_src + '" quality="high" type="application/x-shockwave-flash" pluginspage="' + window.parent.document.location.protocol + 'www.macromedia.com/go/getflashplayer" width="' + banner_width + '" height="' + banner_height + '"></embed>');
	document.write('          </object>');
}
