//
// START browser check
	var userAgent = navigator.userAgent;
	var IE4 = (document.all && !document.getElementById) ? true : false;
	var IE5 = (document.all && document.getElementById) ? true : false;
	var NS4 = (document.layers) ? true : false;
	var NS6 = (document.getElementById && !document.all) ? true : false;
	var doAll = ((IE4) || (IE5)) ? true : false;
// END browser check

//
// START date/time script
function bitime(year,month,day,hours,minutes,seconds) {
	var bimonths=new Array(12);
	bimonths[1]="January";
	bimonths[2]="February";
	bimonths[3]="March";
	bimonths[4]="April";
	bimonths[5]="May";
	bimonths[6]="June";
	bimonths[7]="July";
	bimonths[8]="August";
	bimonths[9]="September";
	bimonths[10]="October";
	bimonths[11]="November";
	bimonths[12]="December";

	var bidays= new Array(7);
	bidays[0]="Sunday";
	bidays[1]="Monday";
	bidays[2]="Tuesday";
	bidays[3]="Wednesday";
	bidays[4]="Thursday";
	bidays[5]="Friday";
	bidays[6]="Saturday";


	var bitimezone='';
	var bilocaltime=new Date();
	var bioffsetmills=(bilocaltime.getTimezoneOffset()*60*1000);
	var biservertimemills=(Date.UTC(year,month-1,day,hours,minutes,seconds));
	var biadjustedtime=new Date();
	biadjustedtime.setMilliseconds(-biadjustedtime);
	biadjustedtime.setMilliseconds(biservertimemills);	

	// start section to adjust for Netscape
	var biadjustedtimestring=biadjustedtime.toString();
	// check for time zone spelled out
	if (biadjustedtimestring.indexOf('Time') !=-1) {
		//remove anything after 'Time'
		biadjustedtimestring=biadjustedtimestring.substring(0,biadjustedtimestring.indexOf('Time')+4);
		//get index of space before 'Time'
		var bitemptimestring=biadjustedtimestring.substring(0,biadjustedtimestring.lastIndexOf(' '));
		//get index of space before word before 'Time'
		bitemptimestring=bitemptimestring.substring(0,bitemptimestring.lastIndexOf(' '));
		// get index of second space before 'Time' to get to start of time zone
		var bistartindex=bitemptimestring.lastIndexOf(' ');
		// we have the start, so get the time zone from the date string
		bitemptimestring=biadjustedtimestring.substring(bistartindex,biadjustedtimestring.length);
		// see if we need to remove a '('
		if (bitemptimestring.indexOf('(')==1) {
			// remove the '('
			bitemptimestring=bitemptimestring.substring(2,bitemptimestring.length);
		}
		bitimezone=bitemptimestring;
	// end section to adjust for Netscape.	
	} else {
		bitimezone=biadjustedtime.toString();
		bitimezone=bitimezone.substring(0,bitimezone.lastIndexOf(' '));
		bitimezone=bitimezone.substring(bitimezone.lastIndexOf(' ')+1,bitimezone.length);
		// make sure the time zone is 3 characters, else make it blank because it hasn't matched our cases
		if (bitimezone.length>3) {
			bitimezone='';
		}
	}
	if (navigator.userAgent.indexOf("Safari") != -1) {
		biadjustedtime=new Date();
	}

	var bimonth=bimonths[biadjustedtime.getMonth() + 1];
	var bidate=biadjustedtime.getDate();
	var biday = bidays[biadjustedtime.getDay()];
	var biyear=biadjustedtime.getFullYear();
	var bihours=biadjustedtime.getHours();
	var biminutes=biadjustedtime.getMinutes();

//  RL -040130 - Removed this section, not needed now
//	if (day==31) {
//		var lastdaybug=1;
//	}
//	
//	if (lastdaybug == 1) {
//		if (bidate == 1) {
//			bidate = 31;
//			bimonth=bimonths[biadjustedtime.getMonth()]
//		} else {
//			bidate = 31;
//		bidate = bidate - 1;
//		}
//
//		if (biadjustedtime.getDay() > 0) {
//			biday = bidays[biadjustedtime.getDay()-1];
//		} else if (biadjustedtime.getDay()==0) {
//			biday = bidays[6];
//		}
//	}	
	
	var biampm='a.m.';
	//change from 24h to 12h clock
	if (bihours==12){
		biampm='p.m.';
	} else if (bihours==0) {
		biampm='a.m.';
		bihours=12;
	} else if (bihours>12) {
		bihours=(bihours-12);
		biampm='p.m.';
	}

	//add a zero in front of the minutes if it's a single digit
	if (biminutes<10) {
		biminutes=('0' + biminutes);
	}

	//write out the date
	document.write(biday + ' ' + bimonth + ' ' + bidate +', ' + biyear + ' ' + bihours + ':' + biminutes + ' ' + biampm + ' ' + bitimezone);	
}
// END date/time script


//
// START membermessage script
function message(cookiename,membermessage,visitormessage) {
if (document.cookie.length > 0) { // if there are any cookies
	memberstatus = document.cookie.indexOf(cookiename)
	begin = document.cookie.indexOf(cookiename+"="); 
	if (begin != -1) // Note: != means "is not equal to"
	{ 
		begin += cookiename.length+1; 
		end = document.cookie.indexOf(";", begin);
		if (end == -1) end = document.cookie.length;
		cookiedata = document.cookie.substring(begin, end);
	}
	if (memberstatus != -1) { // if cookie exists				
		var regEx = new RegExp("|","g");
		//check for a member name
		var checkforname = regEx.exec(cookiedata);
		if (checkforname){
			var userArray = cookiedata.split("|");
			var usersname = userArray[1];
			//var mmregexp = new RegExp("Member");
			if (usersname){
				membermessage = membermessage.replace("Member", usersname)
				//var not = '</a> | <a href="#">Not ' + usersname + '?</a></p>';
				//membermessage = membermessage.replace("</a></p>", not)
				}
			document.write(membermessage);
			} else{
			document.write(membermessage);
			}	
	}else{
		document.write(visitormessage);
	}
}
}
// END membermessage script

//
// START crumbtrail script
function bicrumbtrail(anchorid, divname, tagname, nametomatch, newstylename) {
	var vColl, vNSCollGrp;

	if(doAll) {
		vColl = document.all.item(anchorid); //collection of all anchors with id= ICE2menuitem
	}

	if(NS6) {
		vNSCollGrp = document.getElementById(divname);
		vColl = vNSCollGrp.getElementsByTagName(tagname); //collection of all anchors within left div.
	}		
	if (vColl != null) {
		//NS6 is super-sensitive, so all numbers are parseInt.
	   	for (i=parseInt(0); i<vColl.length; i++) {
		    if (vColl.item(i).className == nametomatch) {
				vColl.item(i).className=newstylename;
			}
		} //end for-next
	} //End if !null
}
// END end crumbtrail script

//
//START cascading menu script
// Adapted by Jay Small, smallinitiatives.com
// from "Javascript + CSS + DOM Magic" by Makiko Itoh (good book!).
// For efficiency, SI version removes image rollover functions,
// color switcher functions (handled in CSS instead)
// and functions for menu positioning based on window size.

// define variables for "if n4 (Netscape 4), if IE (IE 4.x), 
// and if n6 (if Netscape 6/W3C-DOM compliant)"

var bin4, biie, bin6;

// detecting browser support for certain key objects/methods and 
// assembling a custom document object

var doc,doc2,doc3,sty;

if (document.layers) {
	doc = "document.";
	doc2 = ".document.";
	doc3 = "";
	sty = "";
	bin4 = true;
} else if (document.all) {
	doc = "document.all.";
	doc2 = "";
	doc3 = "";
	sty = ".style";
	biie = true;
} else if (document.getElementById) {
	doc = "document.getElementById('";
	doc2 ="')";
	doc3 ="')";
	sty = "').style";
	bin6 = true;
}

// show or hide DIV element

function showhide(divname,state) {
	if (bin4) {
		divObj = eval (doc + divname);
	}
	else {
		divObj = eval (doc + divname + sty);
	}
	divObj.visibility = state;
}

// variables that hold the value of the currently active (open) menu

var active_submenu1 = null;
var active_submenu2 = null;
var active_menuelem = null;
var active_topelem = null;

// variable to flag whether there is an active tertnav menu

var active_tertnavmenu = null;


// function closes all active menus and turns back to 'off' state

function closeallmenus() {
	if (active_submenu1 != null) {
		showhide(active_submenu1,'hidden');
	}
	if (active_submenu2 != null) {
		showhide(active_submenu2,'hidden');
	}
}




// the menu close timeout variable

var menu_close_timeout = 0;

// delay in milliseconds until the open menus are closed

var bidelay = 400;

// function calls the closeallmenus() function after a delay

function closeall() {
	menu_close_timeout = setTimeout('closeallmenus()',bidelay);
}

// stop all timeout functions (stops menus from closing)

function stopall(tertmenuflag) {
	clearTimeout(menu_close_timeout);
// if tertmenuflag has a value, it's tertnav menu and should not execute next part
	if ((tertmenuflag == null) && (active_tertnavmenu != null)) {
		showhide(active_tertnavmenu,'hidden');
		active_tertnavmenu = null;
	}
}

// function controls submenus

function controlsubmenu(submenu1,submenu2) {
//alert('Start controlsubmenu-active_submenu1=' + submenu1 + '-active_submenu2=' + submenu2);
	stopall();
	closeallmenus();
	if (submenu1 != null) {
		showhide(submenu1,'visible');
		active_submenu1 = submenu1;
	}
	if (submenu2 != null) {
		showhide(submenu2,'visible');
		active_submenu2 = submenu2;
		active_tertnavmenu = submenu2;
	} 
}
//END cascading menu script

//
//START styleswitcher script
// This script based on Paul Sowden's work described on A List Apart
//  <http://www.alistapart.com/stories/alternate/>
// Certain modifications (setFontSize and related) by Eric Meyer
//  <http://www.meyerweb.com/eric/>

function setActiveStyleSheet(title) {
  var i, a, main;
    for(i=0; (a = document.getElementsByTagName('link')[i]); i++) {
      if(a.getAttribute('rel').indexOf('style') != -1 && a.getAttribute('title')) {
        a.disabled = true;
        if(a.getAttribute('title') == title) {
								a.disabled = false;
								createCookie('themeName', title, 365)
				}
    }
  }
}

function getActiveStyleSheet() {
    var i, a;
    for(i=0; (a = document.getElementsByTagName('link')[i]); i++) {
      if(a.getAttribute('rel').indexOf('style') != -1 && a.getAttribute('title') && !a.disabled) return a.getAttribute('title');
    }
    return null;
}

function getPreferredStyleSheet() {
  var i, a;
  for(i=0; (a = document.getElementsByTagName('link')[i]); i++) {
    if(a.getAttribute('rel').indexOf('style') != -1
       && a.getAttribute('rel').indexOf('alt') == -1
       && a.getAttribute('title')
       ) return a.getAttribute('title');
  }
  return null;
}

function createCookie(name,value,days) {
  if (days) {
    var date = new Date();
    date.setTime(date.getTime()+(days*24*60*60*1000));
    var expires = '; expires='+date.toGMTString();
  }
  else expires = '';
  document.cookie = name+'='+value+expires+'; path=/; domain=' + getRootDomain() + ';';
}

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;
}

function setFontSize(fontVal) {
	var fontSet = document.getElementById('fontSet');
	var docBase = new Array(); 
	docBase = document.getElementsByTagName('body');
	if (!fontVal) {
	fontVal = document.getElementById('fontSet').value;
	}
	var docSize = fontVal+'px';
	createCookie('baseTextSize', fontVal, 3650);
	docBase[0].style.fontSize = docSize;
	if (fontSet) {
	fontSet.value = fontVal;
	}
}

 window.onload = function(e) {
/*
  var cookie = readCookie('themeName');
  var title = cookie ? cookie : getPreferredStyleSheet();
  setActiveStyleSheet(title);
*/
  var cookie2 = readCookie('baseTextSize');
  if (cookie2) {
  setFontSize(cookie2);
  }
}
/*
window.onunload = function(e) {
  var title = getActiveStyleSheet();
  createCookie('themeName', title, 365);
}
*/

//END styleswitcher script

//START Tacoda head script
var Tacoda_AMS_DDC_snippet_version = "1.2";
var Tacoda_AMS_DDC_clist = new Array("TID", "RMID", "img");
var Tacoda_AMS_DDC_clist_notset = null;
var Tacoda_AMS_DDC_keys = new Array();
var Tacoda_AMS_DDC_values = new Array();
var Tacoda_AMS_DDC_vars_num = 0;
function Tacoda_AMS_DDC_getCookie(name) {
var cname = name + "=";
var dc = document.cookie;
if (dc.length > 0) {
for(var begin = dc.indexOf(cname); begin != -1; begin = dc.indexOf(cname, begin)) {
if((begin != 0) && (dc.charAt(begin - 1) != ' ')) {
begin++;
continue;
}
begin += cname.length;
var end = dc.indexOf(";", begin);
if (end == -1)
end = dc.length;
return unescape(dc.substring(begin, end));
}
}
return Tacoda_AMS_DDC_clist_notset;
}
function Tacoda_AMS_DDC_addPair(key, value) {
Tacoda_AMS_DDC_keys[Tacoda_AMS_DDC_vars_num] = key;
Tacoda_AMS_DDC_values[Tacoda_AMS_DDC_vars_num] = value;
Tacoda_AMS_DDC_vars_num++;
}
function Tacoda_AMS_DDC_collect_vars() {
var Tacoda_AMS_DDC_vars_as_string = "";
for(var i = 0; i < Tacoda_AMS_DDC_vars_num; i++) {
Tacoda_AMS_DDC_vars_as_string += "&var_" + escape( Tacoda_AMS_DDC_keys[i] ) + "=" + escape( Tacoda_AMS_DDC_values[i] ) ;
}
return Tacoda_AMS_DDC_vars_as_string;
}
function Tacoda_AMS_DDC(Tacoda_AMS_DDC_img_url, Tacoda_AMS_DDC_js) {
Tacoda_AMS_DDC_js = parseFloat(Tacoda_AMS_DDC_js);
Tacoda_AMS_DDC_args = "?" + Math.random() + "&snippet_version=" + Tacoda_AMS_DDC_snippet_version + "&referrer=" + escape(document.referrer) + "&page=" + escape(window.location.href);
Tacoda_AMS_DDC_args += "&timezone=" + (new Date()).getTimezoneOffset();
for(var i = 0; i < Tacoda_AMS_DDC_clist.length; i++) {
var clist_name = Tacoda_AMS_DDC_clist[i];
var clist_value = Tacoda_AMS_DDC_getCookie(clist_name);
if(clist_value != null) {
Tacoda_AMS_DDC_args += "&clist_" + escape(clist_name) + "=" + escape(clist_value);
}
}
Tacoda_AMS_DDC_args += Tacoda_AMS_DDC_collect_vars();
var Tacoda_AMS_DDC_fake_image = new Image();
Tacoda_AMS_DDC_fake_image.src = Tacoda_AMS_DDC_img_url + Tacoda_AMS_DDC_args;
}
//END Tacoda head script

//START bipoll script
function OpenPopup(url) {
openpopup = 
window.open(url,"poll","width=520,height=450,left=0,top=50,scrollbars,resizable");
         openpopup.opener.name = "opener";
         }
function MM_displayStatusMsg(msgStr) { //v2.0
  status=msgStr;
  document.MM_returnValue = true;
}

//END bipoll script
//START popup script used for trivia, slideshows etc.
function openWin(html,winname,ht,wd,mb,lb,tb,sb)
{
 // convert all characters to lowercase to simplify testing
    var agt=navigator.userAgent.toLowerCase();

    // *** BROWSER VERSION ***
    // Note: On IE5, these return 4, so use is_ie5up to detect IE5.
    var is_major = parseInt(navigator.appVersion);
    var is_minor = parseFloat(navigator.appVersion);

    // Note: Opera and WebTV spoof Navigator.  We do strict client detection.
    // If you want to allow spoofing, take out the tests for opera and webtv.
    var is_nav  = ((agt.indexOf('mozilla')!=-1) && (agt.indexOf('spoofer')==-1)
                && (agt.indexOf('compatible') == -1) && (agt.indexOf('opera')==-1)
                && (agt.indexOf('webtv')==-1));
    var is_nav3 = (is_nav && (is_major == 3));
    var is_nav4up = (is_nav && (is_major >= 4));
    var is_navonly      = (is_nav && ((agt.indexOf(";nav") != -1) ||
                          (agt.indexOf("; nav") != -1)) );

    var is_ie   = (agt.indexOf("msie") != -1);
    var is_ie3  = (is_ie && (is_major < 4));
    var is_ie4  = (is_ie && (is_major == 4) && (agt.indexOf("msie 5.0")==-1) );
    var is_ie4up  = (is_ie  && (is_major >= 4));
    var is_ie5  = (is_ie && (is_major == 4) && (agt.indexOf("msie 5.0")!=-1) );
    var is_ie5up  = (is_ie  && !is_ie3 && !is_ie4);

    // KNOWN BUG: On AOL4, returns false if IE3 is embedded browser
    // or if this is the first browser window opened.  Thus the
    // variables is_aol, is_aol3, and is_aol4 aren't 100% reliable.
    var is_aol   = (agt.indexOf("aol") != -1);
    var is_aol3  = (is_aol && is_ie3);
    var is_aol4  = (is_aol && is_ie4);

var attr = "scrollbars,resizable,height=" + ht + ",width=" + wd + ",menubar=" + mb + ",locationbar=" + lb + ",toolbar=" + tb + ",statusbar=" + sb

      if (is_nav3 || is_nav4up)
           {
            win1 = window.open(html,winname,attr)
                win1.focus()
      }
      else if (is_ie4up)
                {
            win1 = window.open(html,winname,attr)
                win1.focus()
      }
      else{
                        window.open(html,winname,attr);
     }

}
function MM_displayStatusMsg(msgStr) { //v2.0
  status=msgStr;
  document.MM_returnValue = true;
}

// tristan's function
function getRootDomain() {
	var hostname = window.location.hostname;
	var firstDot = hostname.indexOf(".");
	// not in use currently, would only apply to domains with multiple sub-domains in the url string
	// var lastDot = hostname.lastIndexOf("."); 
	var rootdomain = hostname.substring(firstDot + 1);
	return(rootdomain);
}

//END popup script
