// JavaScript Document

// Used to decide which page type to view, plain or image rich.
//
// return	String		
function getpagetype()
{
	var pagetype = "full";
	return pagetype;
}

// Used to open a new browser window to a chosen location from a drop down list on the html page
//
// param 	String		
function newPage( menu ) 
{
	var url = menu.options[menu.selectedIndex].value;
	windowproperties = "location=yes," + "scrollbars=yes,menubars=yes,toolbars=yes" + "resizable=yes";
	window.open( url, menu.options[menu.selectedIndex].index, windowproperties );
}

// writes a cookie with a value of the name of the page
//
// param 	String		the name of the page 
function writeCookie( pageType ) 
{
	var the_cookie = "pageType=" + pageType;
	document.cookie = the_cookie;
	return document.cookie;
}

// Reads the cookie
//
// param	String		reads the specified cookie value
function readCookie( name )
{
	var nameEQ = name + "=";
	var ca = document.cookie.split( ';' );
	for( var i=0; i < ca.length; i++ )
	{
		var c = ca[i];
		while ( c.charAt(0)==' ' ) c = c.substring( 1, c.length );
		if ( c.indexOf( nameEQ ) == 0 ) 
			return c.substring( nameEQ.length, c.length );
	}
	return null;
}

// Swaps the cookie values around.
//
function changePageType()
{
	if ( readCookie( "pageType" ) == "Text Only" )
		writeCookie( "Graphic Version" );
	else
		writeCookie( "Text Only" );
}

// reloads the page with the same page
//
function checkpagetype()
{
	this.document.location.href = this.document.URL;
}