function getBrowserWidth()
{
	if (window.innerWidth)
	{
		return window.innerWidth;
	}
	else if (document.documentElement && document.documentElement.clientWidth != 0)
	{
		return document.documentElement.clientWidth;
	}
	else if (document.body)
	{
		return document.body.clientWidth;
	}
	
	return 0;
}

function checkBrowserWidth()
{
	var theWidth = getBrowserWidth();
	var featureSection = document.getElementById("featureSecInner");
	var listSection = document.getElementById("listSection");

	if (theWidth > 975 && featureSection && listSection)
	{
		setStylesheet("Features 1024 x 768");
		
		setColumnHeights();
	}
	else
	{
		setStylesheet("Features");
		
		setColumnHeights("auto");
	}
	
	return true;
}


function setColumnHeights(auto)
{
	/*var theFeature2 = document.getElementById("urgentSecInner");*/
	var theFeature3 = document.getElementById("featureSecInner");
	var theFeature4 = document.getElementById("leftWrapInner");
	var theFeatureHeight = "auto";
	

	var theLeftMenu = document.getElementById("leftNav");
	var theContent = document.getElementById("contentInner");
	var theContentHeight = "auto";
	
	if (!auto)
	{
		/*
		if ( theFeature2 ) 
		{
		theHeight = parseInt(theFeature2.scrollHeight);
		}

		if (theFeature3 && theFeature3.scrollHeight > theHeight)
		{
			theHeight = parseInt(theFeature3.scrollHeight);
		}
		*/
		theFeatureHeight = parseInt(theFeature3.scrollHeight);
	
		if (theFeature4 && theFeature4.scrollHeight > theFeatureHeight)
		{
			theFeatureHeight = parseInt(theFeature4.scrollHeight);
		}
			
		theFeatureHeight += "px";

	}

	
	/*
	if ( theFeature2 ) 
	{
		theFeature2.style.height = theHeight;
	}
	*/
	if ( theFeature3 ) 
	{
		theFeature3.style.height = theFeatureHeight;
	}
	if ( theFeature4 )
	{
		theFeature4.style.height = theFeatureHeight;
	}
	
	/*
	theMenuHeight = parseInt(theLeftMenu.scrollHeight);
	if ( theMenuHeight < theContent.scrollHeight)
	{
		theMenuHeight = parseInt(theContent.scrollHeight);
	}
		
	theMenuHeight += "px";
	theLeftMenu.style.height = theMenuHeight;
	*/
	return true;
}




function setStylesheet(styleTitle)
{
	var currTag;

	if (document.getElementsByTagName)
	{
		for (var i = 0; (currTag = document.getElementsByTagName("link")[i]); i++)
		{
			if (currTag.getAttribute("rel").indexOf("style") != -1 && currTag.getAttribute("title"))
			{
				currTag.disabled = true;

				if(currTag.getAttribute("title") == styleTitle)
				{
					currTag.disabled = false;
				}
			}
		}
	}
	
	return true;
}

/* this function writes in the show weather text. It also hides the weather.
  the showWeatherText div is set to display by default so that non-JS browsers
  can see it. */

function showWeatherText()
{
	var showWeatherText = document.getElementById("showWeatherText");
	var theWeatherDiv = document.getElementById("weather_showhide");
	
	showWeatherText.innerHTML = "Click to show";
	theWeatherDiv.style.display = "none";
}

/* this function toggles the div#weather_showhide's display status & 
changes the showWeatherText */
function toggleWeather()
{
	var theWeatherDiv = document.getElementById("weather_showhide");
	var showWeatherText = document.getElementById("showWeatherText");

	if (!theWeatherDiv.style.display) {
		theWeatherDiv.style.display = "none";
	}

	if ( theWeatherDiv.style.display == "none" ) {
		theWeatherDiv.style.display = "block";
		showWeatherText.innerHTML = "Click to hide";
	}
	else {
		if ( theWeatherDiv.style.display == "block" ) {
			theWeatherDiv.style.display = "none";
			showWeatherText.innerHTML = "Click to show";
		}
	}

}

