function windowLinks() {                      // create a new function called windowLink(); 
    if(!document.getElementsByTagName) {      // Only run the function on browsers that
         return;                              // understand 'getElementsByTagName' - new browsers
    }
    var anchors = document.getElementsByTagName("a"); // grab all links and pop them in an array called 'anchors'
    for (var i = 0; i < anchors.length; i++) {        // start a loop to work our way through 
        var anchor = anchors[i];                     // grab the next link & copy it to 'anchor' for working
        
        hrefSplit = anchor.href.split("."); //we're looking for the URL extension
        t = hrefSplit.length - 1; //number select for last array node
        
        if ( hrefSplit[t] == "pdf" ) {            
            anchor.target = "_blank";              
			anchor.title = "PDF File";
			anchor.innerHTML += " (PDF)";
			anchor.className += " pdf";		
		} 
    }
}

function clearText(thefield) {
	thefield.typing = true;
	if (thefield.defaultValue==thefield.value)
	  thefield.value = "";
	thefield.style.color = "#000";
	thefield.style.backgroundColor = "#fff";
}

function unclearText(thefield){
	thefield.typing = false;
	if (thefield.value=="") {
	  thefield.value = thefield.defaultValue;
	  thefield.style.color = "#186ab1";
	  thefield.style.backgroundColor = "#d6f5ff";
	}
}

function highLight(thefield){
	if (thefield.defaultValue==thefield.value)
	thefield.style.backgroundColor = "#fdffcf";
}

function unhighLight(thefield) {
	if (!thefield.typing) {
	  if (thefield.value=="" || thefield.defaultValue==thefield.value)
	     thefield.style.backgroundColor = "#d6f5ff";
	}
}

function moveIn(name,prefixPath) {
    var prefixPath = (prefixPath == null) ? "" : prefixPath+"/";
	newSrc=prefixPath+'images/home/'+name+'_over.gif';
	document.getElementById(name).src=newSrc;
}	

function moveOut(name,prefixPath) {
    var prefixPath = (prefixPath == null) ? "" : prefixPath+"/";
    var newSrc=prefixPath+'images/home/'+name+'.gif';
	document.getElementById(name).src=newSrc;
}

function addLoadListener(fn) {
 if (typeof window.addEventListener != 'undefined'){
   window.addEventListener('load', fn, false);
 } else if (typeof document.addEventListener != 'undefined'){
   document.addEventListener('load', fn, false);
 } else if (typeof window.attachEvent != 'undefined') {
   window.attachEvent('onload', fn);
 } else {
   var oldfn = window.onload;
   if (typeof window.onload != 'function')
   {
     window.onload = fn;
   } else {
     window.onload = function()
     {
       oldfn();
       fn();
     };
   }
 }
}

function initPage() {
	var si = document.getElementById('siteSearch');
	si.onfocus = function() { clearText(this); };
	si.onblur = function() { unclearText(this); };
	si.onmouseover = function() { highLight(this); };
	si.onmouseout = function() { unhighLight(this); };
	
	windowLinks();
	
	var dm = document.getElementById('downloadmessage');
	dm.style.display = 'block';
	
	var fg = document.getElementById('footer_gfx');
	fg.style.display = 'block';
}

addLoadListener(initPage);