/*

Written by Simon Willison:
http://simon.incutio.com/archive/2004/05/26/addLoadEvent

Queue up a whole series of events to be triggered when the document loads. If you simply use window.onload = func, then you run the risk of overwriting existing functions that are supposed to run when the onload event is triggered.

*/

function addLoadEvent(func) {
	var oldonload = window.onload;
	if (typeof window.onload != 'function') {
		window.onload = func;
	} else {
		window.onload = function() {
			oldonload();
			func();
		}
	}
}


/*

This function loops through all the text inputs on a page and stores their default values.
When a text input is brought into focus, its current value is checked against its default value.
If they are the same, the value is cleared.

This allows you to add placeholder text to inputs (recommended for accessibility) but users don't have to manually delete the placeholder text.

This function is triggered when the page loads.
The addLoadEvent.js file is required for this.

*/



function clearInputs() {
	if (!document.getElementsByTagName) return false;
	var all_inputs = document.getElementsByTagName('input');
	for (var i=0;i<all_inputs.length;i++) {
		var current_input = all_inputs[i];
		if (current_input.getAttribute('type') == 'text' && current_input.getAttribute('value') != '') {
			current_input.default_text = current_input.getAttribute('value');
			current_input.onfocus = function() {
				if (this.getAttribute('value') == this.default_text) {
					this.setAttribute('value','');
				}
			}
		}
	}
}


/*


/* jumpmenu script for 'explore other areas' feature */

function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

/* "more info" elements on form pages */

function showHideHelp (div) 
{
            var elem = document.getElementById(div); 
            var currentStatus = elem.style.display; 

if (currentStatus == 'none' || currentStatus == '')    
            {
            elem.style.display = 'block';
            } 
			else 
            {
            elem.style.display = 'none';
            }
}