/* unobtrusive javascript input rollovers from http://www.onlinetools.org/articles/unobtrusivejavascript/chapter2.html */


function findinputs() {
	if ((window.location.href).indexOf("print=true")!=-1){return;}
	var inputs, i;
	// loop through all inputs of the document 
	//if(document.getElementsByTagName()) {
	inputs=document.getElementsByTagName('input');
		
		for(i=0;i<inputs.length;i++) {
			
			// test if the class 'submit' exists 
			if(/submit/.test(inputs[i].className)) {
				// add the function roll to the image onmouseover and onmouseout and send 
				// the image itself as the argument 
				inputs[i].onmouseover=function(){roll(this);};
				inputs[i].onmouseout=function(){roll(this);};	
				
			}
		}
		
		/*if(document.getElementById("searchKey")){
			document.getElementById("searchKey").focus();
		}*/
		
		
	//}
}

function roll(o) {
	// change the hover state of inputs
	if (/hover/.test(o.style.backgroundImage)) { //ON STATE
	
		if ((document.all) && (navigator.userAgent.indexOf('Opera')== -1)) {  //IE
			
			o.style.backgroundImage = "url(../../images/btn_background_t.gif)";
			
			
			if(o.id != "submitSearch") {
				o.style.backgroundColor = "#B5AEAD";
				o.style.borderColor = "#B5AEAD";
				o.style.borderWidth = "1px";
				o.style.borderStyle = "solid";
			} 
		
			
			
			if(o.id == "submitSearch") {
				o.style.borderStyle = "none";
				o.style.bottom = "0px";// for IE
				o.style.right = "0px"; // for IE
			}
			
			
		} else { //other
			
			if(o.id != "submitSearch") {
				o.style.backgroundColor = "#B5AEAD";
				o.style.borderColor = "#B5AEAD";
				o.style.borderWidth = "1px";
				o.style.borderStyle = "solid";
			} 
			
			
		
			o.style.backgroundImage = "url(../../images/btn_background_t.gif)";
			
		}
		
		
		
		
	} else {//OFF STATE
	
		if ((document.all) && (navigator.userAgent.indexOf('Opera')== -1)) {  //IE
			
			o.style.backgroundImage = "url(../../images/btn_background_hover_t.gif)";
			
			if(o.id != "submitSearch") {
				o.style.backgroundColor = "#E10000";
				o.style.borderColor = "#E10000";
				o.style.borderWidth = "1px";
				o.style.borderStyle = "solid";
			
			}
			
			if(o.id == "submitSearch") {
				o.style.borderStyle = "none";
				o.style.bottom = "0px";// for IE
				o.style.right = "0px"; // for IE
			}
			
			//o.style.bottom = "2px";// for IE
			//o.style.right = "2px"; // for IE
			
		} else { //other
			//if(o.id == "submitSearch") return; //ignore global search for now
			
			o.style.backgroundImage = "url(../../images/btn_background_hover_t.gif)";
			
			
			if(o.id != "submitSearch") {
				o.style.backgroundColor = "#E10000";
				o.style.borderColor = "#E10000";
				o.style.borderWidth = "1px";
				o.style.borderStyle = "solid";
			}
			
		}
		
	}
	
}


addLoadEvent(findinputs);



function findImageLinks() {
	// hack to stop image links from displaying global blue slash
	var links;
	links = document.getElementsByTagName("A");
	
	for(i=0;i<links.length;i++){ 
		
		if((document.body.id == "t9") || (document.body.id == "t21")) { return; } // exception for #t9 & #t21 download areas
		
		if((links[i].hasChildNodes()) && (links[i].firstChild.nodeName == "IMG")) {
			links[i].style.background = "none";	
		}
	}
}

addLoadEvent(findImageLinks);

function findExtIcons() {
	
	// correctly positions external icons on links
	var icons;
	icons = document.getElementsByTagName("IMG");
	
	for(i=0;i<icons.length;i++){ 
	
		if(icons[i].src.match("icon_link_external.gif")) { // img is ext link icon
			if((icons[i].parentNode.nodeType == 1) && (icons[i].parentNode.nodeName == "A")) { // parent is A elemt (to be floated)
				
				// style the A
				icons[i].parentNode.style.float = "left";
				icons[i].parentNode.style.display = "inline";
				icons[i].parentNode.style.paddingLeft = "7px";
				icons[i].parentNode.style.backgroundPosition = "2px 0px";
				
				//style the IMG
				icons[i].style.float = "left";
				icons[i].style.display = "inline";
				icons[i].style.margin = "0";
				icons[i].style.marginLeft = "3px";
				icons[i].style.padding = "0";
			}
		}
	}
}

addLoadEvent(findExtIcons);

function homeSlash()	{
	var el=document.getElementById("calloutBox");
	if (el)	{
		var anch=el.getElementsByTagName("a");
		if (anch.length>0)	{
			var iel=anch[0].getElementsByTagName("p");
			if (iel.length>0)	{
				var use=iel[0];
			}	else	{
				var use=anch[0];
			}
			use.innerHTML='<img src="/images/link_indicator_lrg_wht.gif" class="homeSlash" alt=""/>'+use.innerHTML;
		}
	}
}

addLoadEvent(homeSlash);


















