/* ***************************************
* Javascript File: styleCookie.js
* Purpose: Style switcher.
* Updated: 2005-04-03
* Authors: David McCracken
* .............. notes ..........................
* All of the uberCookie.js code can serve any cookie purpose. The code in this 
* file serves the specific very common purpose of style sheet switching. It 
* hard-wires a number of names and relationships to allow a pages to include 
* this file without having to embed any javascript code other than
* anchors' hrefs, e.g. <a href="javascript:setStyle( 'red' )">RED</a>
* Assumptions are:
* - The cookie is called "style".
* - The value is the root name of the style sheet, e.g. 'red' -> red.css.
* - The lifetime is 30 days, after which time the browser may delete the cookie.
* - The page is reloaded if the style sheet selection changes.
* 
* ******************************************/

/*****************************************************
* Function: setStyle
* Description: Set the style cookie.
* Returns: nothing
* Arguments: val is the root name of the css style sheet to be loaded. If this 
* is 0, the style cookie is in effect deleted. 
* ............................................... */
function setStyle( val )
{
  setCookie( "style", val, 30, 3, true );
}

/**** Automatic statements. These execute as the file is loaded. *******/

var styleVal = getCookie( "style" );  

/* The following must be located at the end of a script block. It will screw
* up any subsequent script code in the same block because it writes HTML code 
* immediately into the page. */
if( styleVal ) 
  document.write( '<link rel="stylesheet" type="text/css" href="' + styleVal + '.css" >'); 


