function popup() {
	// check to see that the browser supports the getElementsByTagName method
	// if not, exit the loop
	if (!document.getElementsByTagName) {
		return false; 
	} 
	// create an array of objects of each link in the document 
	var popuplinks = document.getElementsByTagName("a");
	// loop through each anchor tag
	for (var i=0; i < popuplinks.length; i++) {	
		// if the link has a class of "popup"
		if (popuplinks[i].className == "popup") {
			// add an onclick event on the fly to pass the href attribute	
			// of the link to our second function, openPopUp 	
			popuplinks[i].onclick = function() {	
				openPopUp(this.getAttribute("href"));
				return false; 	
			} 	
		}
	} 
}
function openPopUp(linkURL) {
	window.open(linkURL,'popup');
}

function hideems(div,status) {
	if (status == 1) {
		status = "block";
	} else {
		status = "none";	
	}
	if (document.all) {
		document.getElementById(div).style.display = status;
	} else if (document.getElementById) {
		document.getElementById(div).style.display = status;
	}
}

function showems(div,status) {
	if (status == 1) {
		status = "none";
	} else {
		status = "block";	
	}
	if (document.all) {
		document.getElementById(div).style.display = status;
	} else if (document.getElementById) {
		document.getElementById(div).style.display = status;
	}
}

function emailCloak() {
	if (document.getElementById) {
		var alltags = document.all? document.all : document.getElementsByTagName("*");
		for (i=0; i < alltags.length; i++) {
		  if (alltags[i].className == "emailCloak") {
			var oldText = alltags[i].firstChild;
			if(oldText) {
			    var emailAddress = alltags[i].firstChild.nodeValue;
			    var user = emailAddress.substring(0, emailAddress.indexOf("("));
			    var website = emailAddress.substring(emailAddress.indexOf(")")+1, emailAddress.length);
			    var newText = user+"@"+website;
			    var a = document.createElement("a");
			    a.href = "mailto:"+newText;
			    var address = document.createTextNode(newText);
			    a.appendChild(address);
			    alltags[i].replaceChild(a,oldText);
		    }
		  }
		}
	}
}
window.onload = emailCloak;


function Homepage() {
	DocURL = document.URL;
	protocolIndex=DocURL.indexOf("://",4);
	serverIndex=DocURL.indexOf("/",protocolIndex + 3);
	
	BeginURL=DocURL.indexOf("#",1) + 1;
	urlresult=DocURL.substring(BeginURL,serverIndex);
	displayresult=DocURL.substring(protocolIndex + 3 ,serverIndex);
	InsertElementAnchor(urlresult, displayresult);
}
function HtmlEncode(text) {
	return text.replace(/&/g, '&amp').replace(/'/g, '&quot;').replace(/</g, '&lt;').replace(/>/g, '&gt;');
}
function TagAttrib(name, value) {
	return ' '+name+'="'+HtmlEncode(value)+'"';
}
function PrintTag(tagName, needCloseTag, attrib, inner) {
	document.write( '<' + tagName + attrib + '>' + HtmlEncode(inner) );
	if (needCloseTag) document.write( '</' + tagName +'>' );
}
function URI(href) {
	IEVer = window.navigator.appVersion;
	IEVer = IEVer.substr( IEVer.indexOf('MSIE') + 5, 3 );

	return (IEVer.charAt(1)=='.' && IEVer >= '5.5') ?
		encodeURI(href) :
		escape(href).replace(/%3A/g, ':').replace(/%3B/g, ';');
}
function InsertElementAnchor(href, text) {
	PrintTag('A', true, TagAttrib('HREF', URI(href)), text);
}
function hasSearchTerms(frm)
{
    var val;
    for(var i=0; i<frm.elements.length; i++)
    {
        switch(frm.elements[i].type)
        {
            case "text":
                val = frm.elements[i].value;
                break;
            case "select-one":
                val = frm.elements[i].options[frm.elements[i].selectedIndex].value;
                break;
            default:
                val = "";
        }
        if(val.length > 0) return true;
    }
    alert("Please enter some search criteria.");
    return false;
}

function flashDetect9() {
    var flashDiv;
    var flashPrompt = "<div class=\"centered tac\">Download <a href=http://www.adobe.com/go/getflash/>Adobe Flash Player version 9</a> now to see enhanced content!</div>";
    if(!DetectFlashVer(9, 0, 0)) {
           
        if((flashDiv = document.getElementById("flash_graph1")) != null)
            flashDiv.innerHTML = flashPrompt; 

        if((flashDiv = document.getElementById("flash_graph2")) != null)
            flashDiv.innerHTML = flashPrompt;

        if((flashDiv = document.getElementById("flash_graph3")) != null)
            flashDiv.innerHTML = flashPrompt;
            
	if((flashDiv = document.getElementById("flash_video_small")) != null)
            flashDiv.innerHTML = '<a href="http://www.adobe.com/go/getflash/" target="_blank" rel="nofollow"><img src="/FLVPlayer/images/NoFlash-small.gif" /></a>'

	if((flashDiv = document.getElementById("flash_video_large")) != null)
            flashDiv.innerHTML = '<a href="http://www.adobe.com/go/getflash/" target="_blank" rel="nofollow"><img src="/FLVPlayer/images/NoFlash-large.gif" /></a>'
    }
}

function latestFlashVerDetected(){
    var result = true;
    if(!DetectFlashVer(9, 0, 0)) {
        result = false;
    }
    
    return result;
}

try {
    AddEventHandler(window,"load","flashDetect9");
} catch(e) {
    void(0);
}
