


/* returns box coordinates for an element */
BoxCoords = function (x1,y1,x2,y2) {
    this.x1 = x1 || 0;
    this.y1 = y1 || 0;
    this.x2 = x2 || 0;
    this.y2 = y2 || 0;
    return this;
}

function getBoxCoords(elemId) {
    var elemObj = document.getElementById(elemId);
    var elemLeft = 0, elemTop = 0;
    var elemWidth = elemObj.offsetWidth;
    var elemHeight = elemObj.offsetHeight;
    if (elemObj.offsetParent) {
        while (elemObj.offsetParent) {
            elemLeft += elemObj.offsetLeft;     
            elemTop += elemObj.offsetTop;           
            elemObj = elemObj.offsetParent;
        }
    } else if (elemObj.y) {
        elemLeft += elemObj.x;
        elemTop += elemObj.y;   
    }
        
    var coords = new BoxCoords();
    coords.x1 = elemLeft;
    coords.y1 = elemTop;
    coords.x2 = coords.x1 + elemWidth;
    coords.y2 = coords.y1 + elemHeight;
    return coords; 
}
/* end box coordinates */


	
function loadCoords() {
    //check and see if there are both the related links and feature photo boxes
		if(document.getElementById("related_links") && document.getElementById("feature_photo")) {
			//get the coordinates of both boxes
			var featurephotoCoords = getBoxCoords("feature_photo");
			var relatedlinksCoords = getBoxCoords("related_links");
			//if the top of the related links box is higher than the bottom of the feature photo box
			//increase the right margin of the related links box
			if(relatedlinksCoords["y1"] <= (featurephotoCoords["y2"] + 1)) {
				document.getElementById("related_links").style.marginRight = (document.getElementById("feature_photo").offsetWidth + 10) + "px";
			    //Resize related links box
			    document.getElementById("related_links").style.pixelHeight = 0 + "px";
			} 
		} 
			
		if (document.getElementById("related_links") && document.getElementById("columnad")) {
		        //get the coordinates of both boxes
		        var rightcolCoords = getBoxCoords("columnad");
		        var relatedlinksCoords = getBoxCoords("related_links");
		        //if the top of the related links box is higher than the bottom of the right column box
			    //increase the right margin of the related links box
		        if(relatedlinksCoords["y1"] <= (rightcolCoords["y2"] + 1)) {
				document.getElementById("related_links").style.marginRight = (document.getElementById("columnad").offsetWidth + 0) + "px";
			    //Resize related links box
			    document.getElementById("related_links").style.pixelHeight = 0 + "px";
			} 
		
		}
	
            
		


}


// Add the functions into the window.onload event
addOnLoad(loadCoords);

var hasFlash = function(){
	var nRequiredVersion = 6;	
	
	if ((navigator.platform.toLowerCase().indexOf("win") == -1 && navigator.platform.toLowerCase().indexOf("mac") == -1) || navigator.userAgent.toLowerCase().indexOf('opera') > -1 || (navigator.userAgent.toLowerCase().indexOf('msie') > -1 && navigator.appVersion.toLowerCase().indexOf("mac") > -1)) {
	    return false;    
	}
	
	if(navigator.appVersion.indexOf("MSIE") != -1 && navigator.appVersion.indexOf("Windows") > -1){
		document.write('<script language="VBScript"\> \n');
		document.write('on error resume next \n');
		document.write('hasFlash = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash." & ' + nRequiredVersion + '))) \n');  
		document.write('<'+'/script\> \n');
		/*	If executed, the VBScript above checks for Flash and sets the hasFlash variable. 
			If VBScript is not supported it's value will still be undefined, so we'll run it though another test
			This will make sure even Opera identified as IE will be tested */
		if(window.hasFlash != null){
			return window.hasFlash;
		};
	};
	
	if(navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"] && navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin){
		var flashDescription = (navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"]).description;
		var flashVersion = parseInt(flashDescription.charAt(flashDescription.indexOf(".") - 1));
		return flashVersion >= nRequiredVersion;
	};
	
	return false;
}();

String.prototype.normalize = function(){
	return this.replace(/\s+/g, " ");
};

/* IE 5.0 does not support the push method, so here goes */
if(Array.prototype.push == null){
	Array.prototype.push = function(item){
		this[this.length] = item;
		return this.length;
	};
};

if (!Function.prototype.apply){
	Function.prototype.apply = function(oScope, args) {
		var sarg = [];
		var rtrn, call;

		if (!oScope) oScope = window;
		if (!args) args = [];

		for (var i = 0; i < args.length; i++) {
			sarg[i] = "args["+i+"]";
		};

		call = "oScope.__applyTemp__(" + sarg.join(",") + ");";

		oScope.__applyTemp__ = this;
		rtrn = eval(call);
		oScope.__applyTemp__ = null;
		return rtrn;
	};
};

/*	The following code parses CSS selectors.
	This script however is not the right place to explain it,
	please visit the documentation for more information. */
var parseSelector = function(){
	var reParseSelector = /^([^#\.>\`]*)(#|\.|\>|\`)(.+)$/;
	function parseSelector(sSelector, oParentNode, sMode){
		sSelector = sSelector.replace(" ", "`");
		var selector = sSelector.match(reParseSelector);
		var node, listNodes, listSubNodes, subselector;
		var listReturn = [];

		if(selector == null){ selector = [sSelector, sSelector]	};
		if(selector[1] == ""){ selector[1] = "*" };
		if(sMode == null){ sMode = "`" };
		
		switch(selector[2]){
			case "#":
				subselector = selector[3].match(reParseSelector);
				if(subselector == null){ subselector = [null, selector[3]] };
				node = 	document.getElementById(subselector[1]);
				if(node == null || (selector[1] != "*" && node.nodeName.toLowerCase() != selector[1].toLowerCase())){
					return listReturn;
				};
				if(subselector.length == 2){
					listReturn.push(node);
					return listReturn;	
				};
				return parseSelector(subselector[3], node, "#");
			case ".":
				if(sMode == "`"){
					listNodes = getElementsByTagName(oParentNode, selector[1]);
				} else {
					listNodes = oParentNode.childNodes;
				};
				
				for(var i = 0; i < listNodes.length; i++){
					node = listNodes[i];
					if(node.nodeType != 1){
						continue;	
					};

					subselector = selector[3].match(reParseSelector);
					if(subselector != null){
						if(node.className.match("\\b" + subselector[1] + "\\b") == null){
							continue;
						};
						listSubNodes = parseSelector(subselector[3], node, subselector[2]);
						listReturn = listReturn.concat(listSubNodes);	
					} else if(node.className.match("\\b" + selector[3] + "\\b") != null){
						listReturn.push(node);
					};
				};
				return listReturn;
			case ">":
				if(sMode == "`"){
					listNodes = getElementsByTagName(oParentNode, selector[1]);
				} else {
					listNodes = oParentNode.childNodes;
				};
				for(var i = 0; i < listNodes.length; i++){
					node = listNodes[i];
					if(node.nodeType != 1){
						continue;	
					};
					if(node.nodeName.toLowerCase() != selector[1].toLowerCase()){
						continue;
					};
					listSubNodes = parseSelector(selector[3], node, ">");
					listReturn = listReturn.concat(listSubNodes);	
				};
				return listReturn;
			case "`":
				listNodes = getElementsByTagName(oParentNode, selector[1]);
				for(var i = 0; i < listNodes.length; i++){
					node = listNodes[i];
					listSubNodes = parseSelector(selector[3], node, "`");
					listReturn = listReturn.concat(listSubNodes);	
				};
				return listReturn;
			default:
				listNodes = getElementsByTagName(oParentNode, selector[0]);
				for(var i = 0; i < listNodes.length; i++){
					listReturn.push(listNodes[i]);
				};
				return listReturn;
		};
	};
	
	function getElementsByTagName(oParentNode, sTagName){
		/*	IE5.x does not support document.getElementsByTagName("*")
			therefore we're resorting to element.all */
		if(sTagName == "*" && oParentNode.all != null){
			return oParentNode.all;
		};
		return oParentNode.getElementsByTagName(sTagName);
	};
	
	return parseSelector;
}();

/*	Executes an anonymous function which returns the function sIFR (defined inside the function).
	You can replace elements using sIFR.replaceElement()
	All other variables and methods you see are private. If you want to understand how this works you should
	learn more about the variable-scope in JavaScript. */
var sIFR = function(){
	if(window.hasFlash == false || !document.createElement || !document.getElementById){ return function(){return false} };

	/* Providing a hook for you to hide certain elements if Flash has been detected */
	if(document.documentElement){
		document.documentElement.className = document.documentElement.className.normalize() + (document.documentElement.className == "" ? "" : " ") + "sIFR-hasFlash";
	};

	/* Opera and Mozilla require a namespace when creating elements in an XML page */
	var sNameSpaceURI = "http://www.w3.org/1999/xhtml";
	var UA = function(){ 
		var sUA = navigator.userAgent.toLowerCase();
		var oReturn =  {
			bIsKHTML: sUA.indexOf('safari') > -1 || sUA.indexOf('konqueror') > -1 || sUA.indexOf('omniweb') > -1,
			bIsOpera : sUA.indexOf('opera') > -1,
			bIsGecko : navigator.product != null && navigator.product.toLowerCase() == 'gecko',
			bIsXML : document.contentType != null && document.contentType.indexOf('xml') > -1
		};
		oReturn.bIsIE = sUA.indexOf('msie') > -1 && ! oReturn.bIsOpera && !oReturn.bIsKHTML && !oReturn.bIsGecko;
		return oReturn;
	}();

	var bIsInitialized = false;
	var stackReplaceElementArguments = [];
	
	function fetchContent(oNode, oNewNode, sCase){
		var sContent = "";
		var oSearch = oNode.firstChild;
		var oRemove, oRemovedNode, oTarget;

		while(oSearch){
			if(oSearch.nodeType == 3){
				switch(sCase){
					case "lower":
						sContent += oSearch.nodeValue.toLowerCase();
						break;
					case "upper":
						sContent += oSearch.nodeValue.toUpperCase();
						break;
					default:
						sContent += oSearch.nodeValue;
				};
			} else if(oSearch.nodeType == 1){
				if(oSearch.nodeName.toLowerCase() == "a"){
					if(oSearch.getAttribute("target")){
						oTarget = oSearch.getAttribute("target");
					} else {
						oTarget = "";
					};
					sContent += '<a href="' + oSearch.getAttribute("href") + '" target="' + oTarget + '">';
				};				
				if(oSearch.hasChildNodes){
					sContent += fetchContent(oSearch, null, sCase);
				};
				if(oSearch.nodeName.toLowerCase() == "a"){
					sContent += "</a>";
				};
			};
			oRemove = oSearch;
			oSearch = oSearch.nextSibling;
			if(oNewNode != null){
				oRemovedNode = oRemove.parentNode.removeChild(oRemove);
				oNewNode.appendChild(oRemovedNode);	
			};
		};
		return sContent;
	};
	
	function createElement(sTagName){
		if(document.createElementNS){
			return document.createElementNS(sNameSpaceURI, sTagName);	
		} else {
			return document.createElement(sTagName);
		};
	};

	function createObjectParameter(nodeObject, sName, sValue){
		var node = createElement("param");
		node.setAttribute("name", sName);	
		node.setAttribute("value", sValue);
		nodeObject.appendChild(node);
	};
	
	function replaceElement(sSelector, sFlashSrc, sColor, sLinkColor, sHoverColor, sBgColor, nPaddingTop, nPaddingRight, nPaddingBottom, nPaddingLeft, sFlashVars, sCase){
		if(!mayReplace()){
			return stackReplaceElementArguments.push(arguments);	
		};
		
		if(sFlashVars != null){
			sFlashVars = "&" + sFlashVars.normalize();
		} else {
			sFlashVars = "";	
		};
		
		var sWmode = (sBgColor == "transparent") ? "transparent" : "opaque";
		var node, sWidth, sHeight, sMargin, sPadding, sText, sVars, nodeAlternate, nodeFlash;
		var listNodes = parseSelector(sSelector, document);
		if(listNodes.length == 0){ return false };

		for(var i = 0; i < listNodes.length; i++){
			node = listNodes[i];
			
			/* Prevents elements from being replaced multiple times. */
			if(node.className.match(/\bsIFR\-replaced\b/) != null){ continue; };

			sWidth = node.offsetWidth - nPaddingLeft - nPaddingRight-12;
			// The negative 3 is to account for the well-known IE three-pixel bug
			sHeight = node.offsetHeight - nPaddingTop - nPaddingBottom;

			//alert(sWidth);
			//alert(sHeight);
			
			nodeAlternate = createElement("span");
			nodeAlternate.className = "sIFR-alternate";

			sText = fetchContent(node, nodeAlternate, sCase);
			sText = sText.replace(/%\d{0}/g, "%25");
			sText = sText.replace(/\+/g, "%2B");
			sText = sText.replace(/&/g, "%26");
			sText = sText.replace(/\"/g, "%22");
			sText = sText.normalize();

			sVars = "txt=" + sText + sFlashVars + "&w=" + sWidth + "&h=" + sHeight;
			if (sColor != null){sVars += "&textcolor=" + sColor};
			if (sLinkColor != null){sVars += "&linkcolor=" + sLinkColor}; 
			if (sHoverColor != null){sVars += "&hovercolor=" + sHoverColor};
			
			node.className = node.className.normalize() + (node.className == ""  ? "" : " ") + "sIFR-replaced";

			/*	Opera only supports the object element, other browsers are given the embed element,
				for backwards compatibility reasons between different browser versions. */
			if(UA.bIsOpera){
				nodeFlash = createElement("object");
				nodeFlash.setAttribute("type", "application/x-shockwave-flash");
				nodeFlash.setAttribute("data", sFlashSrc);
				createObjectParameter(nodeFlash, "quality", "high");
				createObjectParameter(nodeFlash, "wmode", sWmode);
				createObjectParameter(nodeFlash, "bgcolor", sBgColor);
				createObjectParameter(nodeFlash, "flashvars", sVars);
			} else {
				nodeFlash = createElement("embed");
				nodeFlash.setAttribute("src", sFlashSrc);
				nodeFlash.setAttribute("flashvars", sVars);
				nodeFlash.setAttribute("type", "application/x-shockwave-flash");
				nodeFlash.setAttribute("pluginspage", "http://www.macromedia.com/go/getflashplayer");
				nodeFlash.setAttribute("wmode", sWmode);
				nodeFlash.setAttribute("bgcolor", sBgColor);
			};
			nodeFlash.className = "sIFR-flash";
			nodeFlash.setAttribute("width", sWidth);
			nodeFlash.setAttribute("height", sHeight);
			nodeFlash.style.width = sWidth + "px";
			nodeFlash.style.height = sHeight + "px";
			node.appendChild(nodeFlash);
							
			node.appendChild(nodeAlternate);
			
			/*	Workaround to force KHTML-browsers to repaint the document. 
				Additionally, IE for both Mac and PC need this.
				See: http://neo.dzygn.com/archive/2004/09/forcing-safari-to-repaint */

			if(UA.bIsKHTML || UA.bIsIE){
				node.innerHTML += "";
			};
		};
	};
	
	function mayReplace(e){
		if(((UA.bIsXML && UA.bIsGecko || UA.bIsKHTML) && e == null && bIsInitialized == false) || document.getElementsByTagName("body").length == 0){
			return false;
		};
		return true;
	};
	
	function sIFR(e){
		if((!sIFR.bAutoInit && (window.event || e) != null) || !mayReplace(e)){
			return;	
		};
		bIsInitialized = true;

		for(var i = 0; i < stackReplaceElementArguments.length; i++){
			replaceElement.apply(null, stackReplaceElementArguments[i]);
		};
		stackReplaceElementArguments = [];
	};

	sIFR.replaceElement = replaceElement;
	sIFR.UA = UA;
	sIFR.bAutoInit = true;
	
	if(window.attachEvent){
		window.attachEvent("onload", sIFR);
	} else if(document.addEventListener || window.addEventListener){
		if(document.addEventListener){
			document.addEventListener("load", sIFR, false);	
		};
		if(window.addEventListener){
			window.addEventListener("load", sIFR, false);	
		};
	} else {
		if(typeof window.onload == "function"){
			var fOld = window.onload;
			window.onload = function(){ fOld(); sIFR(); };
		} else {
			window.onload = sIFR;
		};
	};

	return sIFR;
}();

Cookie = function(name, expiration, path, domain, secure) {
    this._name = name;
    this._expiration = (expiration) ? new Date(expiration) : null;
    this._path = (path) ? path : null;
    this._domain = (domain) ? domain : null;
    this._secure = (secure) ? secure : false;
}

// Value and pair separators
Cookie.VALSEP = ":";
Cookie.PAIRSEP = "|";

Cookie.prototype.save = function() {
    var nameValuePairs = new Array();
    for (var prop in this) {
        if (prop.charAt(0) != "_" && typeof this[prop] != "function") {
            nameValuePairs.push(prop + Cookie.VALSEP + escape(this[prop]));
        }
    }

    var cookie = this._name + "=" + nameValuePairs.join(Cookie.PAIRSEP);
    if (this._expiration) {
        cookie += "; expires=" + this._expiration.toGMTString();
    }
    if (this._path) {
        cookie += "; path=" + this._path;
    }
    if (this._domain) {
        cookie += "; domain=" + this._domain;
    }
    if (this._secure) {
        cookie += "; secure";
    }

    // Write the cookie
    document.cookie = cookie;
}

Cookie.prototype.load = function() {
    var allCookies = document.cookie;
    if (allCookies != "" && allCookies.indexOf(this._name) != -1) {
        var startPos = allCookies.indexOf(this._name) + (this._name.length + 1);
        var endPos = (allCookies.indexOf(";", startPos) != -1) ? allCookies.indexOf(";", startPos) : allCookies.length;
        var cookie = allCookies.substring(startPos, endPos);

        var nameValuePairs = cookie.split(Cookie.PAIRSEP);
        for (var i = 0; i < nameValuePairs.length; i++) {
            nameValuePairs[i] = nameValuePairs[i].split(Cookie.VALSEP);
            this[nameValuePairs[i][0]] = unescape(nameValuePairs[i][1]);
        }

        return true;
    }
    else {
        return false;
    }
}

Cookie.prototype.remove = function() {
    var expiration = new Date("1/1/1970");
    var cookie = this._name + "=; expires=" + expiration.toGMTString();
    if (this._path) {
        cookie += "; path=" + this._path;
    }
    if (this._domain) {
        cookie += "; domain=" + this._domain;
    }
    document.cookie = cookie;
}

//Js hover code for drop down menu
sfHover = function() {
	var sfEls = document.getElementById("dropdownnav").getElementsByTagName("LI");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" sfhover";
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", sfHover);

// BEGIN FONT SELECTOR FUNCTIONS

function setFont(fontsize) {
    var font_i, font_a, font_main;
    for (font_i=0; (font_a = document.getElementsByTagName("link")[font_i]); font_i++) {   
        if(font_a.getAttribute("rel").indexOf("style") > -1 && font_a.getAttribute("title")) {
            font_a.disabled = true;
            if (font_a.getAttribute("title") == fontsize) {
                font_a.disabled = false;
            }
        }  
    }
    var fontCookie = new Cookie('fontsize', '01/01/2010', '/', 'go.com');
    fontCookie.valueName = fontsize;
    fontCookie.save();
    fontsetting = fontCookie.valueName;
    document.getElementById('fontid_small').className = 'fontsize_small';
    document.getElementById('fontid_medium').className = 'fontsize_medium'; 
    document.getElementById('fontid_large').className = 'fontsize_large'; 
    document.getElementById('fontid_xlarge').className = 'fontsize_xlarge';                     
    document.getElementById('fontid_'+fontsize).className = 'fontsize_'+fontsetting+'_active';
}

var fontCookie = new Cookie('fontsize');
fontCookie.load(); 
fontsetting = fontCookie.valueName;
    
fontsmall = "alternate ";
fontmedium = "alternate ";
fontlarge = "alternate ";
fontxlarge = "alternate ";
    

    if (fontsetting == "small") {
        fontsmall = "";
    } else if (fontsetting == "medium") {
        fontmedium = "";
    } else if (fontsetting == "large") {
        fontlarge = "";
    } else if (fontsetting == "xlarge") {
        fontxlarge = "";
	} else {
		fontmedium = "";
	}
  
    
document.write('<link rel="'+fontsmall+'stylesheet" type="text/css" href="/css/font_small.css" title="small" media="screen" />');    
document.write('<link rel="'+fontmedium+'stylesheet" type="text/css" href="/css/font_medium.css" title="medium" media="screen" />'); 
document.write('<link rel="'+fontlarge+'stylesheet" type="text/css" href="/css/font_large.css" title="large" media="screen" />'); 
document.write('<link rel="'+fontxlarge+'stylesheet" type="text/css" href="/css/font_xlarge.css" title="xlarge" media="screen" />'); 

function renderReadability() {
    document.write('<div id="feature_fontsize">');
    document.write('<h6><img src="/images/site/_t.gif" class="txtimg" alt="Font Size"/><span class="alt">Font Size</span></h6>');
    document.write('<div id="feature_fontsize_container">');
    document.write('<ul>');
    document.write('<li id="fontid_small" class="fontsize_small"><a href="#" onclick="setFont(\'small\'); return false;"><img src="/images/site/_t.gif" class="txtimg" alt="Small"/><span class="alt">Small</span></a></li>');
    document.write('<li id="fontid_medium" class="fontsize_medium"><a href="#" onclick="setFont(\'medium\'); return false;"><img src="/images/site/_t.gif" class="txtimg" alt="Medium"/><span class="alt">Medium</span></a></li>');
    document.write('<li id="fontid_large" class="fontsize_large"><a href="#" onclick="setFont(\'large\'); return false;"><img src="/images/site/_t.gif" class="txtimg" alt="Large"/><span class="alt">Large</span></a></li>');
    document.write('<li id="fontid_xlarge" class="fontsize_xlarge"><a href="#" onclick="setFont(\'xlarge\'); return false;"><img src="/images/site/_t.gif" class="txtimg" alt="Extra Large"/><span class="alt">Extra Large</span></a></li>');
    document.write('</ul>');
    document.write('</div>');
    document.write('</div>');
    if (fontsetting) { 
    document.getElementById('fontid_'+fontsetting).className = 'fontsize_'+fontsetting+'_active'; 
    } else {
    document.getElementById('fontid_'+'medium').className = 'fontsize_medium_active';       
    }      
}

// END FONT SELECTOR FUNCTIONS