/*
** Function to make external or image anchors open in a new window
*/
function setExternalLinks() {
	if (document.getElementsByTagName) {
		var AnchorArray = document.getElementsByTagName("a");

		for (var i = 0; i < AnchorArray.length; i++) {

			if (AnchorArray[i].getAttribute("href") && AnchorArray[i].getAttribute("rel") == "external") {
				AnchorArray[i].target = "_blank";
				AnchorArray[i].className += " externallink";
			}

			if (
				AnchorArray[i].getAttribute("href")
				&& AnchorArray[i].getAttribute("rel")
				&& AnchorArray[i].getAttribute("rel").substring(0,5) == "other"
			)
				if (AnchorArray[i].getAttribute("rel").length > 6)
					AnchorArray[i].target = AnchorArray[i].getAttribute("rel").substring(6,60);
				else
					AnchorArray[i].target = "_blank";

			if (AnchorArray[i].getAttribute("href") && AnchorArray[i].getAttribute("rel") == "image")
				AnchorArray[i].target = "_blank";
		}
	}
}

/*
** IE6 popup menu code from http://www.csscreator.com/menu/multimenu.php
*/
function activateDropDown(ULID) {
	if (document.getElementById(ULID)) {

		if (document.all && document.getElementById(ULID).currentStyle) {  
			var navroot = document.getElementById(ULID);
	
			/* Get all the list items within the menu */
			var lis=navroot.getElementsByTagName("LI");  
			for (i=0; i<lis.length; i++) {
	
				/* If the LI has another menu level */
				if(lis[i].lastChild.tagName=="UL"){
					lis[i].onmouseover=function() {this.lastChild.style.display="block";}
					lis[i].onmouseout=function() {this.lastChild.style.display="none";}
				}
			}
		}

	}
}

/*
** Function to set the focus to the quick search bar when someone clicks one of the radio btns
*/
function quickSearchFocus() {
	SearchForm = document.getElementById("quicksearchform");
	SearchForm.q.focus();
	if (SearchForm.q.value == "SEARCH UWF")
		SearchForm.q.value = "";
	if (SearchForm.q.value == "Search UWF")
		SearchForm.q.value = "";
}

/*
** puts a flash <object> tag in the innerHTML of another element
*/
function putFlash(url,width,height,id,containerElement) {
	var containerObj = document.getElementById(containerElement);
	if (containerObj != null) {
		var tmp="";
		tmp+= "<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\"";
		tmp+= 'codebase="http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab" width="' + width + '" height="' + height + '" id="' + id + '">';
		tmp+= '<param name="movie" value="' + url + '" />';
		tmp+= '<param name="wmode" value="opaque"/>';
		tmp+= '<embed src="' + url + '" width="' + width + '" height="' + height + '" type="application/x-shockwave-flash" "http://www.adobe.com/go/getflashplayer" wmode="opaque"/>';
		tmp+= '</object>';
		containerObj.innerHTML = tmp;
		return true;
	} else 
		return false;
}

