




/*
     FILE ARCHIVED ON 14:37:56 Feb 10, 2011 AND RETRIEVED FROM THE
     INTERNET ARCHIVE ON 21:30:24 Dec 15, 2011.
     JAVASCRIPT APPENDED BY WAYBACK MACHINE, COPYRIGHT INTERNET ARCHIVE.

     ALL OTHER CONTENT MAY ALSO BE PROTECTED BY COPYRIGHT (17 U.S.C.
     SECTION 108(a)(3)).
*/
// Onload Stacker Function
var onloadHandlers = [];
window.onload = function(){
	for(var i=0;i<onloadHandlers.length;i++){
		// loop through the entire onloadHandlers array
		// and execute each array item
		eval(onloadHandlers[i]);
	}
}

function homePageAdClicked() {
    window.location = document.getElementById("flash-homepage-right-link").href;
}

function homePageAdClickedTargetNewWindow() {
	window.open(document.getElementById("flash-homepage-right-link").href, '_blank', document.getElementById("flash-homepage-right-link").windowoptions);
}

function homePageBucketLinkTargetNewWindow(url, options) {
	window.open(url, '_blank', options);
}

function showCurrentNavItem(nav_type,current_item) {
	if ((nav_type != 'null') && (current_item != 'null')) {
		// which div needs to be affected?
		var nav = document.getElementById(nav_type);
		if(nav != null) {
			// inside the div, get all the <a> elements
			var items = nav.getElementsByTagName("a");
			for(var c=0;c<items.length;c++){
				// if this <a> element's id or class corresponds 
				// to the one we want to highlight
				if ((items[c].id == current_item || items[c].className == current_item)) {
					// if this is the persistent nav, change the text colour
					if (nav_type=='persistent-nav') {
						items[c].style.color = "#0072bc";
					} else {
						// if this is not the persistent nav, remove the 
						// background image so that the rollover state 
						// shows through
						items[c].style.background = "transparent";
					}
				} else {
					// if this is the console-tabs, make sure that every non-highlighted
					// tab is restored to its initial state
					// we have to do this because we can't rely on a page refresh to restore
					// tabs to their initial states
					if (nav_type=='console-tabs') {
						items[c].style.backgroundImage = "url(<c:url value='/images/homepage/' />tab-"+items[c].id+"_0.gif)";
					}
				}
			}
		}
	}
}



function clearString(obj,stringVal){
	if(obj.value==stringVal)
		obj.value="";
}

function showCurrentSectionSubnavItem(nav_item_selected, subnav_item_selected) {
	if ((nav_item_selected != 'null') && (subnav_item_selected != 'null')) {
		
		var nav = document.getElementById('section-nav');
		var items = nav.getElementsByTagName("li");
		nav_items = new Array();
		for(c=0;c<items.length;c++){
			if (items[c].className == 'nav-item') {
				nav_items.push(items[c]);
			}
		}
		
		for(n=0;n<nav_items.length;n++){
			if (nav_items[n].id == nav_item_selected) {
				nav_items[n].className = 'nav-item here';
				spans = nav_items[n].getElementsByTagName("span");
				spans[0].className = 'here';
				subnav_items = nav_items[n].getElementsByTagName("li");
				for(s=0;s<subnav_items.length;s++){
					if (subnav_items[s].id == subnav_item_selected) {
						subnav_items[s].className = 'subnav-item here';
					}
				}
			}else{
				node = nav_items[n];
				node.onmouseover=function() {
					this.className+="-over";
				}
				node.onmouseout=function() {
					this.className=this.className.replace("-over", "");
				}
			}
		}
	}
}


			
function showConsoleForm(obj) {
	if (obj && obj != 'null') {
		obj.style.background = "transparent";
        showConsoleFormNamed(obj.id);
	}
}


function showConsoleFormNamed(form_name) {
	if (form_name && form_name != 'null') {
		var full_form_name = form_name + '-console';
		var console = document.getElementById('console');
		var items = console.getElementsByTagName("div");
		for(i=0;i<items.length;i++){
			var form_obj = items[i];
			if (form_obj.className == "console-form-container") {
				if (form_obj.id == full_form_name) {
					form_obj.style.display = "block";
					form_obj.style.visibility = "visible";
				} else {
					form_obj.style.display = "none";
					form_obj.style.visibility = "hidden";
				}
			}
		}
	}
}

function resizeIframe(frameid) {}

function readjustIframe(loadevt) {}



// Deprecated. These rely on content.css for defining the images.
function setButtonHover(butt) {
	if(butt && (butt.id).indexOf("-hover")>0)
		butt.id = (butt.id).substring(0, (butt.id).indexOf("-down")) + "-hover";
	if(butt && (butt.id).indexOf("-hover")==-1 )
		butt.id += "-hover";
}
function setButtonUp(butt){
	if(butt && (butt.id).indexOf("-down")>0)
		butt.id = (butt.id).substring(0, (butt.id).indexOf("-down"));
	else if(butt && (butt.id).indexOf("-hover")>0)
		butt.id = (butt.id).substring(0, (butt.id).indexOf("-hover"));
}
function setButtonDown(butt){
	if(butt && (butt.id).indexOf("-down")>0)
		butt.id = (butt.id).substring(0, (butt.id).indexOf("-down"));
	else if(butt && (butt.id).indexOf("-hover")>0)
		butt.id = (butt.id).substring(0, (butt.id).indexOf("-hover"));
	butt.id += "-down";
}
function swapImage(elem,img) { 
	elem.src=img;
}

function swapCalendarImage(elem,img) { 
	elem.src=img;
}

function swapClassName(elem,gnu){
	elem.className=gnu;
}

/*
Open a new window with URL, width and height.
The additional properties are always constant.
*/
function openWindow(url,width,height){
	window.open(url,"win","width="+width+",height="+height+",location=0,menubar=0,resizable=1,scrollbars=0,status=0,toolbar=0,modal=0");
}	

/** New Button Handler */
function setButton(elem,source){
	if(null != elem)
		elem.src=source;
}


/** Show/Hide Div Element */
function showHideElement(id, show) {
    if(document.getElementById(id)) {
        if(show)
            document.getElementById(id).style.display = 'block'; 
        else
            document.getElementById(id).style.display = 'none'; 
    } else {
        if (document.layers) { // Netscape 4
            if(show)
                document.id.display = 'block';
            else
                document.id.display = 'none';
        } else { // IE 4
            if(show)
                document.all.id.style.display = 'block';
            else
                document.all.id.style.display = 'none';
        }
    }
}


