
	// All scripts are copyright (c) 2002 to current date MMC Interactive
	

/* ################################################################ */

// default scripts that enable others in page to run

/* ################################################################ */
	
	
// function to attach other named functions to the window.onload event
	
	
	function addLoadEvent(func)
	{
		var oldOnLoad = window.onload;
		if(typeof window.onload != 'function')
			{
			window.onload = func;
			}
		else
			{
			window.onload = function()
				{
				oldOnLoad();
				func();
				}
			}
	}

	

/* ################################################################ */

// list of functions that need to run at window.onload

/* ################################################################ */
	

	addLoadEvent(winOpenByClassName);
	addLoadEvent(winCloseByClassName);
	// addLoadEvent(showFullWeather); we don't want this to run on page load
	
	
	
	
	

/* ################################################################ */

// end of default scripts

/* ################################################################ */
	




// function to open new window where class is 'externalLink'
	
	function multipleWinOpen(pageName)
		{
		window.open(pageName);
		}
		
	
	function winOpenByClassName()
	{
	// alert('open');
	if (!document.getElementsByTagName) return false;
	var docLinks = document.getElementsByTagName("a");
	for (var i=0; i<docLinks.length; i++)
		{
		if (docLinks[i].getAttribute("class") === "externalLink")
		// if (docLinks[i].getAttribute("class").indexOf("externalLink") != -1)
			{
			 if (docLinks[i].getAttribute("title"))
			 	{
				 var currentText = docLinks[i].getAttribute("title");
				docLinks[i].setAttribute("title", currentText + ". This link opens in a new tab or window");
				}
			else
			 	{
				docLinks[i].setAttribute("title", ". This link opens in a new tab or window");
				}
			 
			 docLinks[i].onclick = function() 
				{
				multipleWinOpen(this.getAttribute("href"));
				return false;
				}
			}
		}
	}


// function to close a window where class is 'closeWindow'
	
	function closeWindow()
		{
		window.close(this)
		}
		
	
	function winCloseByClassName()
	{
	// alert('close');
	if (!document.getElementsByTagName) return false;
	var docLinks = document.getElementsByTagName("a");
	for (var i=0; i<docLinks.length; i++)
		{
		if (docLinks[i].getAttribute("class") === "closeWindow")
		// if (docLinks[i].getAttribute("class").indexOf("closeWindow") != -1)
			{
			 docLinks[i].onclick = function() 
				{
				closeWindow(this);
				return false;
				}
			}
		}
	}
	
	


// function to show the full weather forecast on the home page
	
	function showFullWeather()
		{
		// alert('works');
		if (!document.getElementById) return false;
		var minWeatherDiv = document.getElementById("sidebarMinWeatherReport");
		var fullWeatherDiv = document.getElementById("sidebarFullWeatherReport");		
		
		minWeatherDiv.style.position = 'relative';
		minWeatherDiv.style.left = '-2000px';
		minWeatherDiv.style.height = '1px';
			
		fullWeatherDiv.style.position = 'relative';
		fullWeatherDiv.style.top = '-2em';
		fullWeatherDiv.style.left = '0';
		fullWeatherDiv.style.height = '100%';
		}
