/*
 * setActiveStyleSheet
 *
 * creates a cookie called style that contains the value
 * which is passed to the function; it is used to record
 * whether the user wants to have a Narrow View or a Wide
 * View.
 *
 * It then reloads the page, so that the change takes effect.
 */
function setActiveStyleSheet(title) {
	createCookie("style", title, 365);
	window.location.reload(true);
}

/*
 * getWindowWidth
 *
 * different browsers have different ways of detecting the window's current 
 * width, this breaks the browsers apart by capabilities, and returns a result
 * from one of the supported methods
 *
 */
function getWindowWidth() {
	var x;
	if (self.innerHeight)
	{	// all except Internet Explorer
		x = self.innerWidth;
	}
	else if (document.documentElement && document.documentElement.clientHeight)
	{	// Internet Explorer 6 Strict Mode
		x = document.documentElement.clientWidth;
	}
	else if (document.body) 
	{	// other Internet Explorer versions
		x = document.body.clientWidth;
	}

	return x;
}

/*
 * checkForWide
 *
 * if the window width is greater than 1100 pixels, then display the 
 * wide view as a default, otherwise, default to narrow
 *
 */
function checkForWide() {
	var title;
	
	if (getWindowWidth() > 1100)
	{
		title = "Wide View";
	}
	else
	{
		title = "Narrow View";
	}

	createCookie("style", title, 365);
	return title;
}