/*
<!--- AUTHOR: Davin Leier --->
<!--- DATE CREATED: 2006.08.09 --->
<!--- PURPOSE: Common Javascript functions and methods used throughout the site --->
<!--- REVISIONS: 
--->
*/
function openWindow(winURL, winName, winWidth, winHeight, winX, winY, boolScrollBars) 
{
	if (!winURL) winURL = '/';
	if (!winName) winName = 'newWin';
	if (!winWidth) winWidth = 100;
	if (!winHeight) winHeight = 100;
	if (!winX) winX = 0;
	if (!winY) winY = 0;		
	if (!boolScrollBars) boolScrollBars = 1;
    
	newWinObject = window.open(winURL, winName,'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=' + boolScrollBars + ',resizable=1,width=' + winWidth + ',height=' + winHeight + ',left=' +  winX + ',top=' + winY);

	if (newWinObject)	{
    // popup successfully created
		newWinObject.focus();
	} else {
	// popup was not created.
		//showPopupNotice();
	}
	return newWinObject;
}

// expands a page element so that the footer is at the bottom of the page
function expandPage(heightElement,ieDifference,navDifference){
	if (document.getElementById(heightElement)){
		 if (navigator.appName == "Microsoft Internet Explorer"){
			
			var intScreenHeight = screen.height;
			var intDocumentHeight = document.getElementById(heightElement).height;
			var intBrowserHeight = document.body.clientHeight;
			
			if (intDocumentHeight > intBrowserHeight) {
				var setDocumentHeight = (intScreenHeight - ieDifference);				
			}
			else {
				var setDocumentHeight = (intBrowserHeight - ieDifference);
			}	
			document.getElementById(heightElement).height = setDocumentHeight;	
		}
		else if (navigator.appName == "Netscape"){
				
			var intInnerHeight = window.innerHeight;
			var intDocumentHeight = document.height;
		
			if (intInnerHeight > intDocumentHeight) {
				var setDocumentHeight = (intInnerHeight - navDifference);		
			}
			else {
				var setDocumentHeight = (intDocumentHeight - navDifference);
			}
			document.getElementById(heightElement).height = setDocumentHeight;	
		}	
	}
}

// Display a DHTML div notice that popups are being blocked
function showPopupNotice()	{
	if (!document.createElement)	{
		return;
	}
    var elmDiv = document.createElement('div');
	if (typeof(elmDiv.innerHTML) != 'string')	{
		return;
	}
	elmDiv.id  = 'popupnotice';
	
	elmDiv.style.cssText = 
         'position: absolute; left: 200px; top: 200px;' +
         'width: 400px;' +
         'color: black; ' +
         'background-color: white; ' +
         'font-weight: bold; ' +
         'border: solid #cecfce 3px; ' +
         'padding: 1em;';

	var html = '<p>You are blocking popups'
         	 + '<div><a href="#" onclick="hidePopupNotice(); return false;">Close this message</a></div></p>';
			 
    document.body.appendChild(elmDiv);
    elmDiv.innerHTML = html;
}

// Hide the popup notice after it has appeared
function hidePopupNotice()	{
	var elmDiv = document.getElementById('popupnotice');
	if (elmDiv)	
		{
     elmDiv.parentNode.removeChild(elmDiv);
    }
}