function popup(sUrl, iHeight)
{
	var options = "width=600,height="+iHeight+",";
	
	options += "resizable=yes,scrollbars=yes,status=no,";
	options += "menubar=no,toolbar=no,location=no,directories=no";
	
	popupwin = window.open(sUrl, "campdenPopup", options);
	
	popupwin.focus();
	
	return false;
}


function toggleVisibility(sDivId)
{
		var div = document.getElementById(sDivId);
		div.style.display = (div.style.display == 'none') ? 'block' : 'none';
}

function setVisibility(sDivId, bVisible)
{
		setVisibilityEx(sDivId, (bVisible) ? 'block' : 'none');
}

function setVisibilityEx(sDivId, sValue)
{
		var div = document.getElementById(sDivId);
		div.style.display = sValue;
}


function popupCentredWindow(sMyPage,nWidth,nHeight,bScroll)
{
	var nLeftPosition = (screen.width) ? (screen.width-nWidth)/2 : 0;
	var nTopPosition = (screen.height) ? (screen.height-nHeight)/2 : 0;
	var sSettings = 'height='+nHeight+',width='+nWidth+',top='+nTopPosition+',left='+nLeftPosition+',scrollbars='+bScroll+',resizable';
	
	var centredWindow = window.open(sMyPage,"campdenCentredPopup",sSettings);
	// centredWindow.focus();
	
	return centredWindow;
}

/***********************************************
* Bookmark site script- © Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
***********************************************/

/* Modified to support Opera */
function bookmarkSite(title,url)
{
	if (window.sidebar)
	{
		// firefox
		window.sidebar.addPanel(title, url, "");
	}
	else if(window.opera && window.print)
	{
		// opera
		var elem = document.createElement('a');
		elem.setAttribute('href',url);
		elem.setAttribute('title',title);
		elem.setAttribute('rel','sidebar');
		elem.click();
	} 
	else if(document.all)
	{
		// ie
		window.external.AddFavorite(url, title);
	}
}

function addCommas(nStr)
{
	nStr += '';
	x = nStr.split('.');
	x1 = x[0];
	x2 = x.length > 1 ? '.' + x[1] : '';
	var rgx = /(\d+)(\d{3})/;
	while (rgx.test(x1)) {
		x1 = x1.replace(rgx, '$1' + ',' + '$2');
	}
	return x1 + x2;
}