

	/****************************************************
	Current Date Code
	****************************************************/
	function isnArray() {
		argnr=isnArray.arguments.length
		for (var i=0;i<argnr;i++) {
			this[i+1] = isnArray.arguments[i];
		}
	}
	
	function getFullYear(d) {
		var y = d.getYear();
		if (y < 1000) y += 1900;
		return y;
	}
	
	function getStdHour(S) {
		var sh = S.getHours();
		if (sh <= 12)
			return sh;
		else 
			return sh - 12;
	}

	function getStdMinutes(M) {
		var min = M.getMinutes();
		var x = "";
		if (min <= 9){
			x = '0' + min;
			return x;
		}
		else { return min;
		}
	}
	
	function getMeridiem(H) {
		var th = H.getHours();
		var m = "";
		if (th >= 12)
			m = "PM";
		else {
			m = "AM";
		}
		 return m;
	}
	
	function printDate(){
		var isnMonths=new isnArray("January","February","March","April","May","June","July","August","September","October","November","December");
		today=new Date();
		document.write(isnMonths[today.getMonth()+1]+" "+
		today.getDate()+", "+" "+getFullYear(today)+" "+
		getStdHour(today)+":"+getStdMinutes(today)+" "
		+getMeridiem(today));
	}

	/****************************************************
	Open window code
	****************************************************/
	function popster(sUrl){
		openWindow(sUrl,'_blank','width=468,height=470,top=30,left=30,screenY=30,screenX=30');
	}
	
	function openWindow(sUrl,sTarget,sOptions){
		window.open(sUrl, sTarget, sOptions);
	}
	
	function openPopup(sUrl,sTarget, sHeight, sWidth){
		window.open(sUrl, sTarget, "titlebar=0,width=" + sWidth + ",innerWidth=" + sWidth + ",height=" + sHeight + ",innerHeight=" + sHeight);
	}
	
	
	/****************************************************
	Image Position
	****************************************************/
	function docjslib_getRealLeft(imgElem) {
		var oRef = getRef(imgElem);
		if(oRef){
			xPos = oRef.offsetLeft;
			tempEl = oRef.offsetParent;
	  	  	while (tempEl != null) {
	  	  		xPos += tempEl.offsetLeft;
	  	  		tempEl = tempEl.offsetParent;
	  	  	}
	  		return xPos;
	  	}else{
	  		alert('Unable to find ' + imgElem);
	  	}
	}

	function docjslib_getRealTop(imgElem) {
		var oRef = getRef(imgElem);
		if(oRef){
			yPos = oRef.offsetTop;
			tempEl = oRef.offsetParent;
			while (tempEl != null) {
		  		yPos += tempEl.offsetTop;
		  		tempEl = tempEl.offsetParent;
		  	}
			return yPos;
		}else{
			alert('Unable to find ' + imgElem);
		}
	}

	/****************************************************
	Java Menu code - horizontal nav with dynamic positioning
	****************************************************/
	var isDOM = (document.getElementById ? true : false);
	var isIE4 = ((document.all && !isDOM) ? true : false);
	var isNS4 = (document.layers ? true : false);
	var isDyn = (isDOM || isIE4 || isNS4);
	
	function getRef(id)
	{
	 return document.getElementById(id);
	}
	function getSty(id)
	{
	 return (isNS4 ? getRef(id) : getRef(id).style);
	}
	var popTimer = 0;
	var litNow = new Array();
	function popOver(menuNum, itemNum)
	{
	 clearTimeout(popTimer);
	 hideAllBut(menuNum);
	 litNow = getTree(menuNum, itemNum);
	 changeCol(true);
	 targetNum = menu[menuNum][itemNum].target;
	 if (targetNum > 0)
	 {
		if(menu[menuNum][0].ref){
			thisX = parseInt(menu[menuNum][0].ref.left) + parseInt(menu[menuNum][itemNum].ref.left);
			thisY = parseInt(menu[menuNum][0].ref.top) + parseInt(menu[menuNum][itemNum].ref.top);
			with (menu[targetNum][0].ref)
			{
				left = thisX + menu[targetNum][0].x;
				top = thisY + menu[targetNum][0].y;
				visibility = 'visible';
			}
		}
	 }
	}
	function popMenu(menuNum){
		if(window.event){
			if(window.event.srcElement){
				if(window.event.srcElement.style){
					window.event.srcElement.style.cursor = 'hand';
				}
			}
		}
		if(menu[menuNum]==null) return true;
		if(menu[menuNum][0]==null) return true;
		if(menu[menuNum][0].ref){
			if(menu[0][0]!=null){
				if(menu[0][0].ref){
					clearTimeout(popTimer);
					hideAllBut(menuNum);
					
					thisX = parseInt(docjslib_getRealLeft('nav_top_' + menuNum));
					thisY = 2 + parseInt(docjslib_getRealTop('nav_top_' + menuNum)) + parseInt(menu[menuNum][1].ref.top);
					with (menu[menuNum][0].ref)
					{
						left = thisX;
						top = thisY;
						visibility = 'visible';
					}
				}
			}
		}
		return true;
	}
	function outMenu(menuNum){
		//alert('here');
		if(window.event){
			if(window.event.srcElement){
				if(window.event.srcElement.style){
					window.event.srcElement.style.cursor = 'default';
				}
			}
		}
		if(menu[menuNum]==null) return true;
		if(menu[menuNum][0]==null) return true;
		if(menu[menuNum][0].ref){
			popTimer = setTimeout('menu[' + menuNum + '][0].ref.visibility = \'hidden\'', 500);
		}
		return true;
	}
	
	function popOut(menuNum, itemNum){
		//alert('here');
		if ((menuNum == 0) && !menu[menuNum][itemNum].target){
			popTimer = setTimeout('hideAllMenus()', 1000);
		}else{
			popTimer = setTimeout('hideAllBut(0)', 1000);
		}
	}
	function popClick(menuNum, itemNum)
	{
	 with (menu[menuNum][itemNum])
	 {
	  switch (type)
	  {
	   case 'js:': { eval(href); break }
	   case '': type = 'window';
	   default: if (href) eval(type + '.location.href = "' + href + '"');
	  }
	 }
	 hideAllBut(0);
	}
	function getTree(menuNum, itemNum)
	{
	 itemArray = new Array(menu.length);
	 while(1)
	 {
	  itemArray[menuNum] = itemNum;
	  if (menuNum == 0) break;
	  itemNum = menu[menuNum][0].parentItem;
	  menuNum = menu[menuNum][0].parentMenu;
	 }
	 return itemArray;
	}
	function changeCol(isOver)
	{
	 for (count = 0; count < litNow.length; count++)
	 {
	  if (litNow[count])
	  {
	   with (menu[count][0]) with (menu[count][litNow[count]])
	   {
	    newCol = isOver ? overCol : backCol;
	    if (isNS4) ref.bgColor = newCol;
	    else ref.backgroundColor = newCol;
	   }
	  }
	 }
	}
	function hideAllBut(menuNum)
	{
	  var keepMenus = getTree(menuNum, 1);
	 for (count = 0; count < menu.length; count++){
	  if (!keepMenus[count] && menu[count]){
		if(menu[count][0].ref)
			menu[count][0].ref.visibility = 'hidden';
	  }
	 }
	 changeCol(false);
	}
	function hideAllMenus()
	{
	 for (count = 0; count < menu.length; count++){
	  if(menu[count]!=null){
		if(menu[count][0]){
			if(menu[count][0].ref){
				menu[count][0].ref.visibility = 'hidden';
			}
		  }
	  }
	 }
	}
	function addProps(obj, data, names, addNull)
	{
	 for (i = 0; i < names.length; i++)
	  if(i < data.length || addNull) obj[names[i]] = data[i];
	}
	function Menu()
	{
	 var names = ['isVert', 'popInd', 'x','y', 'width', 'pad', 'overCol', 'backCol',
	  'borderClass', 'textClass', 'parentMenu', 'parentItem', 'ref'];
	 addProps(this, arguments, names, true);
	}
	function Item()
	{
	 var names = ['text', 'href', 'type', 'length', 'spacing', 'target', 'ref'];
	 addProps(this, arguments, names, true);
	}
	function createMenus()
	{
		if (!isDyn) return;
	 	if(!menu[0][0]) return;
		for (currMenu = 0; currMenu < menu.length; currMenu++)
			if (menu[currMenu]) with (menu[currMenu][0]){
				var str = '', itemX = 0, itemY = 0;
			  	if (isNS4) pad++;
				for (currItem = 1; currItem < menu[currMenu].length; currItem++) with (menu[currMenu][currItem])
				{
					var itemID = 'menu' + currMenu + 'item' + currItem;
					var shrink = (borderClass && isDOM && !document.all ? 2 : 0);
					var w = (isVert ? width : length) - shrink;
					var h = (isVert ? length : width) - shrink;
					if(itemY!=0)
						itemY = itemY - 2;
					if (isDOM || isIE4)
					{
						str += '<div id="' + itemID + '" style="position: absolute; left: ' + itemX +
							'; top: ' + itemY + '; width: ' + w + '; height: ' + h + '; visibility: inherit; ';
					
						if (backCol) str += 'background: ' + backCol;
						str += '" ';
					}
					if (isNS4)
					{
						str += '<layer id="' + itemID + '" left="' + itemX + '" top="' + itemY + '" width="' +
							     w + '" height="' + h + '" visibility="inherit" ';
						if (backCol) str += 'bgcolor="' + backCol + '" ';
					}
					if (borderClass) str += 'class="' + borderClass + '" ';
					str += 'onMouseOver="popOver(' + currMenu + ',' + currItem + ')" onMouseOut="popOut(' +
						     currMenu + ',' + currItem + ')" onClick="popClick(' + currMenu + ',' + currItem + ')">';
					if (target > 0)
					{
						menu[target][0].parentMenu = currMenu;
						menu[target][0].parentItem = currItem;
						if (popInd)
						{
						     if (isNS4) str += '<layer class="' + textClass + '" left="'+ (w - 15) + '" top="' +
								      pad + '">' + popInd + '</layer>';
						     else str += '<div class="' + textClass + '" style="position: absolute; left: ' + (w - 15) +
								      '; top: ' + pad + '">' + popInd + '</div>';
						}
					}
					if (isNS4) str += (borderClass ? '<spacer type="block" width="' + (w - 8) + '" height="' +
							    (h - 8) + '">' : '') +
							    '<layer left="' + pad + '" top="' + pad + '" width="' + (w - (2 * pad)) + '" height="' +
							    (h - (2 * pad)) + '"><a class="' + textClass + '" href="#" ' +
							    'onClick="popClick(' + currMenu + ',' + currItem + '); return false" ' +
							    'onMouseOver="status=\'\'; return true;">' + text + '</a></layer>';
					else str += '<div class="' + textClass + '" style="position: absolute; left: ' + pad +
						    '; top: ' + pad + '; width: ' + (w - (2 * pad)) + '; height: ' + (h - (2 * pad)) +
						    '">' + text + '</div>';
					str += (isNS4 ? '</layer>' : '</div>');
	   				if (isVert) itemY += length + spacing - 1;
					else itemX += length + spacing - 1;
				}
	  			//alert(str);
				if (document.all)
				{
					document.body.insertAdjacentHTML('beforeEnd', '<div id="menu' + currMenu + 'div" ' +
							'style="position: absolute; width: 3; height: 3; visibility: hidden; z-index: 1000">' +
							str + '</div>');
					ref = getSty('menu' + currMenu + 'div');
	  			}
	  			else if (isDOM)
				{
					var newDiv = document.createElement('div');
					document.body.appendChild(newDiv);
					newDiv.innerHTML = str;
					ref = newDiv.style;
					ref.position = 'absolute';
					ref.visibility = 'hidden';
				}
				else if (isNS4)
	  			{
					ref = new Layer(0);
					ref.document.write(str);
					ref.document.close();
				}
				ref.left = x;
				ref.top = y==null? parseInt(docjslib_getRealTop('nav_top_0')):y;
				
				if (!isNS4) ref.cursor = (document.all ? 'hand' : 'pointer');
				if (!document.all) ref.zIndex = 1000;
				for (currItem = 1; currItem < menu[currMenu].length; currItem++)
				{
					itemName = 'menu' + currMenu + 'item' + currItem;
					if (isDOM || isIE4) menu[currMenu][currItem].ref = getSty(itemName);
					if (isNS4)
					{
						menu[currMenu][currItem].ref = ref.document[itemName];
						with (ref.document[itemName])
						{
							document.captureEvents(Event.CLICK);
							document.onclick = new Function('popClick(' + currMenu + ', ' + currItem + ')');
						}
					}
				}
			}
		// end for
		menu[0][0].ref.visibility = 'hidden';
	}
	
	function resizeHandler()
	{
		if (!menu[0][0]) return;
		if (!menu[0][0].ref) return;
		if (isNS4 && popOldWidth != window.innerWidth) location.reload()
	}
	function positionMenu()
	{
	}
	function colItem()
	{
		var names = ['text', 'href', 'type', 'length', 'spacing', 'overCol', 'backCol', 'target',
					'ref'];
		addProps(this, arguments, names, true);
	}
	
	/****************************************************
	Cookie code
	****************************************************/
	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 SetCookie (name, value) {  
		var argv = SetCookie.arguments;  
		var argc = SetCookie.arguments.length;  
		var expires = (argc > 2) ? argv[2] : null;  
		var path = (argc > 3) ? argv[3] : null;  
		var domain = (argc > 4) ? argv[4] : null;  
		var secure = (argc > 5) ? argv[5] : false;  
		document.cookie = name + "=" + escape (value) + 
			((expires == null) ? "" : ("; expires=" + expires.toGMTString())) + 
			((path == null) ? "" : ("; path=" + path)) +  
			((domain == null) ? "" : ("; domain=" + domain)) +    
			((secure == true) ? "; secure" : "");
	}
	function DeleteCookie (name) {  
		var exp = new Date();  
		exp.setTime (exp.getTime() - 1);  
		var cval = GetCookie (name);  
		document.cookie = name + "=" + cval + "; expires=" + exp.toGMTString();
	}
	
	function getCookieVal(offset) {
		var endstr = document.cookie.indexOf (";", offset);
		if (endstr == -1)
			endstr = document.cookie.length;
		return unescape(document.cookie.substring(offset, endstr));
	}

	/****************************************************
	popup once code
	****************************************************/
	
	function popupOnce(popupUrl, windowProps, cookieName, expDays ){
		var count = GetCookie(cookieName);
		var exp = new Date(); 
		exp.setTime(exp.getTime() + (expDays*24*60*60*1000));
		if (count == null) {
			count=1;
			SetCookie(cookieName, count, exp);
			window.open(popupUrl, "", windowProps);
		}
		/*
		else {
			count++;
			SetCookie(cookieName, count, exp);
	   }
	   */
	}

	/****************************************************
	Zipcode forecast code
	****************************************************/
	var accuZipCookieName = 'weather-accu-zip';
	var accuZipCookieDays = 90;
	var accuCountCookieName = 'weather-accu-zip-count';
	var accuCountCookieDays = 1;
	var accuPopupWindowProps = '';
	
	function printZipCodeForm(sUrl){
		var zip = GetCookie(accuZipCookieName);
		document.write('<form name="accu-zip-form" class="accu-zip">\n');
		if(zip==null){
			document.write('<input type="text" name="zipcode" size="5" maxlength="5" value="">\n');
			document.write('<input type="button" name="getzip" value="Submit" onclick="javascript:submitZipCodeForm(\'' + sUrl.replace('\'','\\\'') + '\')">\n');
			document.write('<br><input type="checkbox" name="rememberzip" value="1" > Remember my zipcode');
		}else{
			document.write('<input type="text" name="zipcode" size="5" maxlength="5" value="' + zip + '">\n');
			document.write('<input type="button" name="getzip" value="Submit" onclick="javascript:submitZipCodeForm(\'' + sUrl.replace('\'','\\\'') + '\')">\n');
			document.write('<br><input type="checkbox" name="rememberzip" value="1" checked > Remember my zipcode');
		}
		document.write('</form>\n');
	}
	function submitZipCodeForm(sUrl){
		// check the zipcode
		var zip = document.forms['accu-zip-form'].zipcode.value;
		var zipPattern = /^(\d{5})$/;
		var zipArray = zip.match(zipPattern); 
		if(zipArray == null){
			alert('Invalid zip code \'' + zip + '\'.');
			return;
		}
		
		// check for the check box
		if(document.forms['accu-zip-form'].rememberzip.checked){
			//alert('setting cookies');
			var exp = new Date(); 
			exp.setTime(exp.getTime() + (accuZipCookieDays*24*60*60*1000));
			SetCookie(accuZipCookieName,zip,exp);
		}
		openWindow(sUrl + '?zip=' + zip,'',accuPopupWindowProps);
	}
	
	function popupZipCode(always, sUrl){
		var zip = GetCookie(accuZipCookieName);
		if(zip!=null){
			if(always)
				openWindow(sUrl + '?zip=' + zip,'',accuPopupWindowProps);
			else
				popupOnce(sUrl + '?zip=' + zip, accuPopupWindowProps, accuCountCookieName, accuCountCookieDays);
		}
	}
	function cancelZipCode(){
		DeleteCookie(accuZipCookieName);
		DeleteCookie(accuCountCookieName);
		alert('Weather pop-up cancelled');
	}

	function printZipCodeForm(){
		var zip = GetCookie(accuZipCookieName);
		document.write('<form name="accu-zip-form" class="accu-zip">\n');
		if(zip==null){
			document.write('<input type="text" name="zipcode" size="5" maxlength="5" value="">\n');
			document.write('<input type="button" name="getzip" value="Submit" onclick="javascript:submitZipCodeForm()">\n');
			document.write('<br><input type="checkbox" name="rememberzip" value="1" > Remember my zipcode');
		}else{
			document.write('<input type="text" name="zipcode" maxlength="5" value="' + zip + '" size="20">\n');
			document.write('<input type="button" name="getzip" value="Submit" onclick="javascript:submitZipCodeForm()">\n');
			document.write('<br><input type="checkbox" name="rememberzip" value="1" checked > Remember my zipcode');
		}
		document.write('</form>\n');
	}
	
	function submitZipCodeForm(){
		// check the zipcode
		var zip = document.forms['accu-zip-form'].zipcode.value;
		var zipPattern = /^(\d{5})$/;
		var zipArray = zip.match(zipPattern); 
		if(zipArray == null){
			alert('Invalid zip code \'' + zip + '\'.');
			return;
		}
		
		// check for the check box
		if(document.forms['accu-zip-form'].rememberzip.checked){
			//alert('setting cookies');
			var exp = new Date(); 
			exp.setTime(exp.getTime() + (accuZipCookieDays*24*60*60*1000));
			SetCookie(accuZipCookieName,zip,exp);
		}
		openWindow('/common/weather/zipforecast.aspx?zip=' + zip,'',accuPopupWindowProps);
	}
	
	function printZipCodeFormCustom(sUrl){
		var zip = GetCookie(accuZipCookieName);
		document.write('<form name="accu-zip-form" class="accu-zip">\n');
		if(zip==null){
			document.write('<input type="text" name="zipcode" size="5" maxlength="5" value="">\n');
			document.write('<input type="button" name="getzip" value="Submit" onclick="javascript:submitZipCodeFormCustom(\'' + sUrl.replace('\'','\\\'') + '\')">\n');
			document.write('<br><input type="checkbox" name="rememberzip" value="1" > Remember my zipcode');
		}else{
			document.write('<input type="text" name="zipcode" size="5" maxlength="5" value="' + zip + '">\n');
			document.write('<input type="button" name="getzip" value="Submit" onclick="javascript:submitZipCodeFormCustom(\'' + sUrl.replace('\'','\\\'') + '\')">\n');
			document.write('<br><input type="checkbox" name="rememberzip" value="1" checked > Remember my zipcode');
		}
		document.write('</form>\n');
	}
	function submitZipCodeFormCustom(sUrl){
		// check the zipcode
		var zip = document.forms['accu-zip-form'].zipcode.value;
		var zipPattern = /^(\d{5})$/;
		var zipArray = zip.match(zipPattern); 
		if(zipArray == null){
			alert('Invalid zip code \'' + zip + '\'.');
			return;
		}
		
		// check for the check box
		if(document.forms['accu-zip-form'].rememberzip.checked){
			//alert('setting cookies');
			var exp = new Date(); 
			exp.setTime(exp.getTime() + (accuZipCookieDays*24*60*60*1000));
			SetCookie(accuZipCookieName,zip,exp);
		}
		openWindow(sUrl + '?zip=' + zip,'',accuPopupWindowProps);
	}
	
	function popupZipCode(always){
		var zip = GetCookie(accuZipCookieName);
		if(zip!=null){
			if(always)
				openWindow('/common/weather/zipforecast.aspx?zip=' + zip,'',accuPopupWindowProps);
			else
				popupOnce('/common/weather/zipforecast.aspx?zip=' + zip, accuPopupWindowProps, accuCountCookieName, accuCountCookieDays);
		}
	}
	
	/****************************************************
	Send and print story
	****************************************************/
	function sendStory(sTarget, sHeight, sWidth){
		var sUrl = '/common/sendstory/default.aspx?url=' + escape(document.location.href);
		openPopup(sUrl,sTarget, sHeight, sWidth);
	}
	
	function printStory(sContentId, sTarget, sHeight, sWidth){
		var sUrl = '/common/printstory/default.aspx?content_id=' + sContentId;
		openWindow(sUrl,sTarget, "titlebar=yes,toolbar=yes,menubar=yes,scrollbars=yes,resizable=yes,innerWidth=" + sWidth + ",innerHeight=" + sHeight + ",width=" + sWidth + ",height=" + sHeight);
	}
	
		/****************************************************
	Querystring Reader
	****************************************************/
	function PageQuery(q) {
		if(q.length > 1) 
			this.q = q.substring(1, q.length);
		else 
			this.q = null;
		this.keyValuePairs = new Array();
		if(q) {
			for(var i=0; i < this.q.split("&").length; i++) {
				this.keyValuePairs[i] = this.q.split("&")[i];
			}
		}
		this.getKeyValuePairs = function() { return this.keyValuePairs; }
		this.getValue = function(s) {
			for(var j=0; j < this.keyValuePairs.length; j++) {
				if(this.keyValuePairs[j].split("=")[0] == s)
					return this.keyValuePairs[j].split("=")[1];
			}
			return false;
		}
		this.getParameters = function() {
			var a = new Array(this.getLength());
			for(var j=0; j < this.keyValuePairs.length; j++) {
				a[j] = this.keyValuePairs[j].split("=")[0];
			}
			return a;
		}
		this.getLength = function() { return this.keyValuePairs.length; } 
	}

	function queryString(key){
		var page = new PageQuery(window.location.search); 
		return unescape(page.getValue(key)); 
	}
	/* example querystring usage
	function displayItem(key){
		if(queryString(key)=='false') {
			document.write("you didn't enter a ?name=value querystring item.");
		}else{
			document.write(queryString(key));
		}
	}
	*/
	
	
	/****************************************************
	Browser Detection
	****************************************************/

    // 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) && (agt.indexOf('hotjava')==-1));
    var is_nav2 = (is_nav && (is_major == 2));
    var is_nav3 = (is_nav && (is_major == 3));
    var is_nav4 = (is_nav && (is_major == 4));
    var is_nav4up = (is_nav && (is_major >= 4));
    var is_navonly      = (is_nav && ((agt.indexOf(";nav") != -1) ||
                          (agt.indexOf("; nav") != -1)) );
    var is_nav6 = (is_nav && (is_major == 5));
    var is_nav6up = (is_nav && (is_major >= 5));
    var is_gecko = (agt.indexOf('gecko') != -1);


    var is_ie     = ((agt.indexOf("msie") != -1) && (agt.indexOf("opera") == -1));
    var is_ie3    = (is_ie && (is_major < 4));
    var is_ie4    = (is_ie && (is_major == 4) && (agt.indexOf("msie 4")!=-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_ie5_5  = (is_ie && (is_major == 4) && (agt.indexOf("msie 5.5") !=-1));
    var is_ie5up  = (is_ie && !is_ie3 && !is_ie4);
    var is_ie5_5up =(is_ie && !is_ie3 && !is_ie4 && !is_ie5);
    var is_ie6    = (is_ie && (is_major == 4) && (agt.indexOf("msie 6.")!=-1) );
    var is_ie6up  = (is_ie && !is_ie3 && !is_ie4 && !is_ie5 && !is_ie5_5);

    // 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 is_aol5  = (agt.indexOf("aol 5") != -1);
    var is_aol6  = (agt.indexOf("aol 6") != -1);

    var is_opera = (agt.indexOf("opera") != -1);
    var is_opera2 = (agt.indexOf("opera 2") != -1 || agt.indexOf("opera/2") != -1);
    var is_opera3 = (agt.indexOf("opera 3") != -1 || agt.indexOf("opera/3") != -1);
    var is_opera4 = (agt.indexOf("opera 4") != -1 || agt.indexOf("opera/4") != -1);
    var is_opera5 = (agt.indexOf("opera 5") != -1 || agt.indexOf("opera/5") != -1);
    var is_opera5up = (is_opera && !is_opera2 && !is_opera3 && !is_opera4);

    var is_webtv = (agt.indexOf("webtv") != -1); 

    var is_TVNavigator = ((agt.indexOf("navio") != -1) || (agt.indexOf("navio_aoltv") != -1)); 
    var is_AOLTV = is_TVNavigator;

    var is_hotjava = (agt.indexOf("hotjava") != -1);
    var is_hotjava3 = (is_hotjava && (is_major == 3));
    var is_hotjava3up = (is_hotjava && (is_major >= 3));

    // *** JAVASCRIPT VERSION CHECK ***
    var is_js;
    if (is_nav2 || is_ie3) is_js = 1.0;
    else if (is_nav3) is_js = 1.1;
    else if (is_opera5up) is_js = 1.3;
    else if (is_opera) is_js = 1.1;
    else if ((is_nav4 && (is_minor <= 4.05)) || is_ie4) is_js = 1.2;
    else if ((is_nav4 && (is_minor > 4.05)) || is_ie5) is_js = 1.3;
    else if (is_hotjava3up) is_js = 1.4;
    else if (is_nav6 || is_gecko) is_js = 1.5;
    // NOTE: In the future, update this code when newer versions of JS
    // are released. For now, we try to provide some upward compatibility
    // so that future versions of Nav and IE will show they are at
    // *least* JS 1.x capable. Always check for JS version compatibility
    // with > or >=.
    else if (is_nav6up) is_js = 1.5;
    // NOTE: ie5up on mac is 1.4
    else if (is_ie5up) is_js = 1.3

    // HACK: no idea for other browsers; always check for JS version with > or >=
    else is_js = 0.0;

    // *** PLATFORM ***
    var is_win   = ( (agt.indexOf("win")!=-1) || (agt.indexOf("16bit")!=-1) );
    // NOTE: On Opera 3.0, the userAgent string includes "Windows 95/NT4" on all
    //        Win32, so you can't distinguish between Win95 and WinNT.
    var is_win95 = ((agt.indexOf("win95")!=-1) || (agt.indexOf("windows 95")!=-1));

    // is this a 16 bit compiled version?
    var is_win16 = ((agt.indexOf("win16")!=-1) || 
               (agt.indexOf("16bit")!=-1) || (agt.indexOf("windows 3.1")!=-1) || 
               (agt.indexOf("windows 16-bit")!=-1) );  

    var is_win31 = ((agt.indexOf("windows 3.1")!=-1) || (agt.indexOf("win16")!=-1) ||
                    (agt.indexOf("windows 16-bit")!=-1));

    var is_winme = ((agt.indexOf("win 9x 4.90")!=-1));
    var is_win2k = ((agt.indexOf("windows nt 5.0")!=-1));

    // NOTE: Reliable detection of Win98 may not be possible. It appears that:
    //       - On Nav 4.x and before you'll get plain "Windows" in userAgent.
    //       - On Mercury client, the 32-bit version will return "Win98", but
    //         the 16-bit version running on Win98 will still return "Win95".
    var is_win98 = ((agt.indexOf("win98")!=-1) || (agt.indexOf("windows 98")!=-1));
    var is_winnt = ((agt.indexOf("winnt")!=-1) || (agt.indexOf("windows nt")!=-1));
    var is_win32 = (is_win95 || is_winnt || is_win98 || 
                    ((is_major >= 4) && (navigator.platform == "Win32")) ||
                    (agt.indexOf("win32")!=-1) || (agt.indexOf("32bit")!=-1));

    var is_os2   = ((agt.indexOf("os/2")!=-1) || 
                    (navigator.appVersion.indexOf("OS/2")!=-1) ||   
                    (agt.indexOf("ibm-webexplorer")!=-1));

    var is_mac    = (agt.indexOf("mac")!=-1);
    // hack ie5 js version for mac
    if (is_mac && is_ie5up) is_js = 1.4;
    var is_mac68k = (is_mac && ((agt.indexOf("68k")!=-1) || 
                               (agt.indexOf("68000")!=-1)));
    var is_macppc = (is_mac && ((agt.indexOf("ppc")!=-1) || 
                                (agt.indexOf("powerpc")!=-1)));

    var is_sun   = (agt.indexOf("sunos")!=-1);
    var is_sun4  = (agt.indexOf("sunos 4")!=-1);
    var is_sun5  = (agt.indexOf("sunos 5")!=-1);
    var is_suni86= (is_sun && (agt.indexOf("i86")!=-1));
    var is_irix  = (agt.indexOf("irix") !=-1);    // SGI
    var is_irix5 = (agt.indexOf("irix 5") !=-1);
    var is_irix6 = ((agt.indexOf("irix 6") !=-1) || (agt.indexOf("irix6") !=-1));
    var is_hpux  = (agt.indexOf("hp-ux")!=-1);
    var is_hpux9 = (is_hpux && (agt.indexOf("09.")!=-1));
    var is_hpux10= (is_hpux && (agt.indexOf("10.")!=-1));
    var is_aix   = (agt.indexOf("aix") !=-1);      // IBM
    var is_aix1  = (agt.indexOf("aix 1") !=-1);    
    var is_aix2  = (agt.indexOf("aix 2") !=-1);    
    var is_aix3  = (agt.indexOf("aix 3") !=-1);    
    var is_aix4  = (agt.indexOf("aix 4") !=-1);    
    var is_linux = (agt.indexOf("inux")!=-1);
    var is_sco   = (agt.indexOf("sco")!=-1) || (agt.indexOf("unix_sv")!=-1);
    var is_unixware = (agt.indexOf("unix_system_v")!=-1); 
    var is_mpras    = (agt.indexOf("ncr")!=-1); 
    var is_reliant  = (agt.indexOf("reliantunix")!=-1);
    var is_dec   = ((agt.indexOf("dec")!=-1) || (agt.indexOf("osf1")!=-1) || 
           (agt.indexOf("dec_alpha")!=-1) || (agt.indexOf("alphaserver")!=-1) || 
           (agt.indexOf("ultrix")!=-1) || (agt.indexOf("alphastation")!=-1)); 
    var is_sinix = (agt.indexOf("sinix")!=-1);
    var is_freebsd = (agt.indexOf("freebsd")!=-1);
    var is_bsd = (agt.indexOf("bsd")!=-1);
    var is_unix  = ((agt.indexOf("x11")!=-1) || is_sun || is_irix || is_hpux || 
                 is_sco ||is_unixware || is_mpras || is_reliant || 
                 is_dec || is_sinix || is_aix || is_linux || is_bsd || is_freebsd);

    var is_vms   = ((agt.indexOf("vax")!=-1) || (agt.indexOf("openvms")!=-1));

