//Copyright (c) 2005 Service First Webmasters, Inc. All Rights Reserved.
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}
//to use the following function, add to the page's body tag: onkeypress="sendForm(event);"
function sendForm(evt){//submits the one form on the page upon pressing Enter
	var key = (evt) ? evt.which : evt.keyCode;
	if ( key == 13 || evt.keyCode==13){
		if (document.getElementById('c2_keywords').value != ""){
			__doPostBack('c2$goButton','');
		}
	}
}
function sendFormRootLogin(evt){//submits the login form upon pressing Enter
	var key = (evt) ? evt.which : evt.keyCode;
	if ( key == 13 || evt.keyCode==13){
			__doPostBack('c2$LoginAction','');
	}
}
function testObject(objectID){
	return document.getElementById(objectID);
}
function changeFont(copyId, textClass, toggleId, doWhat) {
	if (testObject(copyId)) {
		document.getElementById(copyId).className = textClass;
		
		if (textClass == "smallText"){
		document.getElementById('textToLarge').className = "textSizeLink";
		document.getElementById('textToMedium').className = "textSizeLink";	
		}
		if (textClass == "mediumText"){
		document.getElementById('textToLarge').className = "textSizeLink";
		document.getElementById('textToSmall').className = "textSizeLink";	
		}
		if (textClass == "largeText"){
		document.getElementById('textToMedium').className = "textSizeLink";
		document.getElementById('textToSmall').className = "textSizeLink";	
		}
		//set the style of the one just clicked to the YAH
		if (toggleId) { 
		document.getElementById(toggleId).className = doWhat;
		}
	}
}
function changeFontBase(pageName, copyId, textClass, toggleId, doWhat) {
	//for type size and other mods on the CakewalkBlogs.com home site only

	if (testObject(copyId)) {
		document.getElementById(copyId).className = textClass + pageName;
		
		if (textClass == "smallText"){
			document.getElementById('textToLarge').className = "textSizeLink";
			document.getElementById('textToMedium').className = "textSizeLink";	
			if (testObject('homeSideBar')) {
			document.getElementById('homeSideBar').className = 'smallSidebarHome';
			}
			if (testObject('computerCake')) {
			document.getElementById('computerCake').className = 'smallCC';
			}
		}
		if (textClass == "mediumText"){
			document.getElementById('textToLarge').className = "textSizeLink";
			document.getElementById('textToSmall').className = "textSizeLink";	
			if (testObject('homeSideBar')) {
			document.getElementById('homeSideBar').className = 'mediumSidebarHome';
			}
			if (testObject('computerCake')) {
			document.getElementById('computerCake').className = 'mediumCC';
			}
		}
		if (textClass == "largeText"){
			document.getElementById('textToMedium').className = "textSizeLink";
			document.getElementById('textToSmall').className = "textSizeLink";	
			if (testObject('homeSideBar')) {
			document.getElementById('homeSideBar').className = 'largeSidebarHome';
			}
			if (testObject('computerCake')) {
			document.getElementById('computerCake').className = 'largeCC';
			}
		}
		//set the style of the one just clicked to the YAH
		if (toggleId) { 
		document.getElementById(toggleId).className = doWhat;
		}
	}
}
function sendCookie(textClass){
	//alert("textClass is " + textClass);
	var expdate = new Date ();
    FixCookieDate (expdate); // Correct for Mac date bug - call only once for given Date object!
    expdate.setTime (expdate.getTime() + (24*60*60*1000*365*5)); // 5 years from now 
	SetCookie('textSize', textClass, expdate, "/", null, false);
}
function findSetCookieBase(pageName){
var savedTextSize = GetCookie("textSize");
var savedSizeButton;
	if (savedTextSize!=null) {		
	//set the style of the button so we can use changeFont()
		if (savedTextSize == "smallText"){
			savedSizeButton = "textToSmall";
			} else if (savedTextSize == "mediumText"){
			savedSizeButton = "textToMedium";
			} else {
			savedSizeButton = "textToLarge";
		}
	//set the text size according to the saved value in the cookie
	    if (testObject('bodyCopy')){
	        changeFontBase(pageName,'bodyCopy',savedTextSize,savedSizeButton,'textSizeLinkYAH');
	    }
	    if (testObject('c2_GridView2')){
	        changeFontBase(pageName,'c2_GridView2',savedTextSize,savedSizeButton,'textSizeLinkYAH');
	    }
	} else {
	//set the text size to medium
	    if (testObject('bodyCopy')){
		    document.getElementById('bodyCopy').className = "mediumText" + pageName;
	    }
	    if (testObject('c2_GridView2')){
		    document.getElementById('c2_GridView2').className = "mediumText" + pageName;
	    }
	}
}
function setClass(objectID,newClass){
	var object = document.getElementById(objectID);
	object.className = newClass;
}
<!-- begin script
//
//  Cookie Functions -- "Night of the Living Cookie" Version (25-Jul-96)
//
//  Written by:  Bill Dortch, hIdaho Design <bdortch@hidaho.com>
//  The following functions are released to the public domain.
//
//  This version takes a more aggressive approach to deleting
//  cookies.  Previous versions set the expiration date to one
//  millisecond prior to the current time; however, this method
//  did not work in Netscape 2.02 (though it does in earlier and
//  later versions), resulting in "zombie" cookies that would not
//  die.  DeleteCookie now sets the expiration date to the earliest
//  usable date (one second into 1970), and sets the cookie's value
//  to null for good measure.
//
//  Also, this version adds optional path and domain parameters to
//  the DeleteCookie function.  If you specify a path and/or domain
//  when creating (setting) a cookie**, you must specify the same
//  path/domain when deleting it, or deletion will not occur.
//
//  The FixCookieDate function must now be called explicitly to
//  correct for the 2.x Mac date bug.  This function should be
//  called *once* after a Date object is created and before it
//  is passed (as an expiration date) to SetCookie.  Because the
//  Mac date bug affects all dates, not just those passed to
//  SetCookie, you might want to make it a habit to call
//  FixCookieDate any time you create a new Date object:
//
//    var theDate = new Date();
//    FixCookieDate (theDate);
//
//  Calling FixCookieDate has no effect on platforms other than
//  the Mac, so there is no need to determine the user's platform
//  prior to calling it.
//
//  This version also incorporates several minor coding improvements.
//
//  **Note that it is possible to set multiple cookies with the same
//  name but different (nested) paths.  For example:
//
//    SetCookie ("color","red",null,"/outer");
//    SetCookie ("color","blue",null,"/outer/inner");
//
//  However, GetCookie cannot distinguish between these and will return
//  the first cookie that matches a given name.  It is therefore
//  recommended that you *not* use the same name for cookies with
//  different paths.  (Bear in mind that there is *always* a path
//  associated with a cookie; if you don't explicitly specify one,
//  the path of the setting document is used.)
//  
//  Revision History:
//
//    "Toss Your Cookies" Version (22-Mar-96)
//      - Added FixCookieDate() function to correct for Mac date bug
//
//    "Second Helping" Version (21-Jan-96)
//      - Added path, domain and secure parameters to SetCookie
//      - Replaced home-rolled encode/decode functions with Netscape's
//        new (then) escape and unescape functions
//
//    "Free Cookies" Version (December 95)
//
//
//  For information on the significance of cookie parameters, and
//  and on cookies in general, please refer to the official cookie
//  spec, at:
//
//      http://www.netscape.com/newsref/std/cookie_spec.html    
//
//******************************************************************
//
// "Internal" function to return the decoded value of a cookie
//
function getCookieVal (offset) {
  var endstr = document.cookie.indexOf (";", offset);
  if (endstr == -1)
    endstr = document.cookie.length;
  return unescape(document.cookie.substring(offset, endstr));
}
//
//  Function to correct for 2.x Mac date bug.  Call this function to
//  fix a date object prior to passing it to SetCookie.
//  IMPORTANT:  This function should only be called *once* for
//  any given date object!  See example at the end of this document.
//
function FixCookieDate (date) {
  var base = new Date(0);
  var skew = base.getTime(); // dawn of (Unix) time - should be 0
  if (skew > 0)  // Except on the Mac - ahead of its time
    date.setTime (date.getTime() - skew);
}
//
//  Function to return the value of the cookie specified by "name".
//    name - String object containing the cookie name.
//    returns - String object containing the cookie value, or null if
//      the cookie does not exist.
//
function GetCookie (name) {
  var arg = name + "=";
  var alen = arg.length;
  var clen = document.cookie.length;
  var i = 0;
  while (i < clen) {
    var j = i + alen;
    if (document.cookie.substring(i, j) == arg)
      return getCookieVal (j);
    i = document.cookie.indexOf(" ", i) + 1;
    if (i == 0) break; 
  }
  return null;
}
//
//  Function to create or update a cookie.
//    name - String object containing the cookie name.
//    value - String object containing the cookie value.  May contain
//      any valid string characters.
//    [expires] - Date object containing the expiration data of the cookie.  If
//      omitted or null, expires the cookie at the end of the current session.
//    [path] - String object indicating the path for which the cookie is valid.
//      If omitted or null, uses the path of the calling document.
//    [domain] - String object indicating the domain for which the cookie is
//      valid.  If omitted or null, uses the domain of the calling document.
//    [secure] - Boolean (true/false) value indicating whether cookie transmission
//      requires a secure channel (HTTPS).  
//
//  The first two parameters are required.  The others, if supplied, must
//  be passed in the order listed above.  To omit an unused optional field,
//  use null as a place holder.  For example, to call SetCookie using name,
//  value and path, you would code:
//
//      SetCookie ("myCookieName", "myCookieValue", null, "/");
//
//  Note that trailing omitted parameters do not require a placeholder.
//
//  To set a secure cookie for path "/myPath", that expires after the
//  current session, you might code:
//
//      SetCookie (myCookieVar, cookieValueVar, null, "/myPath", null, true);
//
function SetCookie (name,value,expires,path,domain,secure) {
  document.cookie = name + "=" + escape (value) +
    ((expires) ? "; expires=" + expires.toGMTString() : "") +
    ((path) ? "; path=" + path : "") +
    ((domain) ? "; domain=" + domain : "") +
    ((secure) ? "; secure" : "");
}

//  Function to delete a cookie. (Sets expiration date to start of epoch)
//    name -   String object containing the cookie name
//    path -   String object containing the path of the cookie to delete.  This MUST
//             be the same as the path used to create the cookie, or null/omitted if
//             no path was specified when creating the cookie.
//    domain - String object containing the domain of the cookie to delete.  This MUST
//             be the same as the domain used to create the cookie, or null/omitted if
//             no domain was specified when creating the cookie.
//
function DeleteCookie (name,path,domain) {
  if (GetCookie(name)) {
    document.cookie = name + "=" +
      ((path) ? "; path=" + path : "") +
      ((domain) ? "; domain=" + domain : "") +
      "; expires=Thu, 01-Jan-70 00:00:01 GMT";
  }
}

//
//  Examples
//
//var expdate = new Date ();
//FixCookieDate (expdate); // Correct for Mac date bug - call only once for given Date object!
//expdate.setTime (expdate.getTime() + (24*60*60*1000*365)); // one year from now 
//SetCookie ("ccpath", "http://www.hidaho.com/colorcenter/", expdate);
//SetCookie ("login", "kirk", expdate);
//SetCookie ("tempvar", "This is a temporary cookie.");
//SetCookie ("ubiquitous", "This cookie will work anywhere in this domain",null,"/");
//SetCookie ("paranoid", "This cookie requires secure communications",expdate,"/",null,true);
//SetCookie ("goner", "This cookie must die!");
//document.write (document.cookie + "<br>");
//DeleteCookie ("login");
//document.write ("ccpath = " + GetCookie("ccpath") + "<br>");
//document.write ("login = " + GetCookie("login") + "<br>");
//document.write ("tempvar = " + GetCookie("tempvar") + "<br>");
// end script -->

function setYAH(){
	var numLinks = 50; //the total count of links for which to check if YAH should be applied
	var navObject = null;
	var bNavObject = null;
	var hNavObject = null;
	var here = self.location + "";
	var theQ = here.indexOf("?");
	var simpleHere = here;
	if (theQ >0 ){
		simpleHere = here.substring(0,theQ);
	} 
	var navLinkID = "";
	var bNavLinkID = "";
	var hNavLinkID = "";
	
	//set YAH on the logo div
	navLinkID = "logo";
	if (testObject(navLinkID)) {
			navObject = document.getElementById(navLinkID);
			if (simpleHere.indexOf("index") > 0){//we are at the home page
				setClass(navLinkID,'logoDivYAH');
			}
	}
	
	for (var i = 1; i <= numLinks; i++) {
		navLinkID = "nav" + i;
		bNavLinkID = "bnav" + i;
		hNavLinkID ="hnav" + i;
		if (testObject(navLinkID)) {
			navObject = document.getElementById(navLinkID);
			if (simpleHere == navObject.href){
				setClass(navLinkID,'YAH');
			}
		}
		if (testObject(bNavLinkID)) {
			bNavObject = document.getElementById(bNavLinkID);
			if (simpleHere == bNavObject.href){
				setClass(bNavLinkID,'YAH');
			}
		}
		if (testObject(hNavLinkID)) {
			hNavObject = document.getElementById(hNavLinkID);
			if (simpleHere == hNavObject.href){
				setClass(hNavLinkID,'YAH');
			}
		}
	}
}

function setClass(objectID,newClass){
	var object = document.getElementById(objectID);
	object.className = newClass;
}

function testObject(objectID){
	return document.getElementById(objectID);
}

function newImage(arg) {
	if (document.images) {
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
}
//start of code that allows menus to click on and off
//if you do not have dropdowns or flyouts, delete from here down
var level1On = "";
var level2On = "";
var stopper = false;

function setStopper(){
	stopper = true;// prevents clicks on second and third levels from having an effect on the first level
}
function clearStopper(){
	stopper = false;
}

function setVisible(id, visible){// expects id and either yes or no
	if (testObject(id)){
		var el = document.getElementById(id);
		if (visible == "yes") {
			el.style.display = 'block';
			el.style.visibility = 'visible';
			//WCH.Apply(id);
			//uncomment if you have flyouts that go over dropdowns, checkboxes or radio buttons. Be sure to add the WCH.js link to the head of each page.
		} else {
			el.style.display = 'none';
			el.style.visibility = 'hidden';
			//WCH.Discard(id);
			//uncomment if you have flyouts that go over dropdowns, checkboxes or radio buttons. Be sure to add the WCH.js link to the head of each page.
		}
	}
}

function toggleTopLevel(list) {
//prevent this function from working if stopper is set
//alert("level1On is " + level1On + "; level2On is " + level2On);
	if (!stopper) {
	// turn off the open menus
		if (level1On != "") {
			setVisible(level1On,'no');
			level1On = "";
		}
		if (level2On != "") {
			setVisible(level2On,'no');
			level2On = "";
		}
	//save the incoming list
		level1On = list;
	//turn on the incoming
		setVisible(list,'yes');
	}
//alert("level1On is " + level1On + "; level2On is " + level2On);
}

function toggle2ndLevel(list) {
//prevent this function from working if stopper is set
	if (!stopper) {
	// turn off the open menus
		if (level2On != "") {
			setVisible(level2On,'no');
			level2On = "";
		}
	//save the incoming list
		level2On = list;
	//turn on the incoming
		setVisible(list,'yes');
	// prevent the next click (automatically generated on top level) from doing anything for 1/10 sec.
		setStopper();
		timerID = setTimeout("clearStopper()",100);
	}
}

function hideLists() {
		//alert("level1On is " + level1On + "; level2On is " + level2On);
		if (level1On != "") {
			setVisible(level1On,'no');
			level1On = "";
		}
		if (level2On != "") {
			setVisible(level2On,'no');
			level2On = "";
		}
		//alert("level1On is " + level1On + "; level2On is " + level2On);
}
// level 1 menus and level 2 menus get ids
// click top level and it: 1.) checks to see if any saved menus are open; closes them 2.) saves the new level1 that is now being opened 3.) opens the new level1.
// click second level and it 1.) checks for level 2 saved open and closes it if any 2.) saves new level 2 and opens new level 2
// a settimeout function prevents the click on level 2 from triggering on level 1.
// mouseover level 3 and the stopper flag is set to true, preventing any clicks from happening at level 2 or 1.
// mouseout level 3 and the stopper flag is cleared, allowing clicks to happen. 
// or click level 3 and go to a page.
// or if you have moused out of level 3, you can click the content area and close the 2 saved menus.
// it all happens in js without any hovers.
