/* ********************************************************************************************
	INPUTS HOVER CLASS CHANGER
******************************************************************************************** */

/*function windowload() {
	//this function gets called when the window loads. put all onload stuff in here.
	
	//setup inputs
	var result = setup_inputs();
	return null;
}
*/

/* ********************************************************************************************
	Useful functions
******************************************************************************************** */
function jumppage(newloc) {
	newpage = newloc.options[newloc.selectedIndex].value;
	if (newpage != "") {
		window.location.href = newpage;
	}
	return null;
}



/*function smartClassName(existing_classname,new_class,replaced_class) {
	//check if browser is capable
	if (!document.getElementsByTagName) {
		return null;
	}
	//check if vars defined
	if (!existing_classname || !new_class || typeof existing_classname != "string" || typeof new_class != "string") {
		alert("Incorrect number of parameters for smartClassName function, or parameters are not strings");
		return null;
	}
	
	//code to change and replace strings
	existing_classname = ' ' + existing_classname.replace(/^\s*|\s*$/g,'') + ' ';
	new_class = new_class.replace(/^\s*|\s*$/g,'');
	
	var new_classname = existing_classname;
	if (replaced_class && existing_classname.indexOf(' ' + replaced_class + ' ') != -1 && typeof replaced_class == "string") {
		//found something to replace! or in this case, remove.
		new_classname = existing_classname.replace(' ' + replaced_class.replace(/^\s*|\s*$/g,'') + ' ',' ');
	}
	//add class
	//check if not already there
	if (new_classname.indexOf(' ' + new_class + ' ') == -1) {
		//not found, add it
		new_classname = new_classname + new_class;
	}
	//return the changed text!
	return new_classname.replace(/^\s*|\s*$/g,''); //trimmed whitespace
}


function addEvent (elm, evtype, fn, usecapture) {
	if (elm.addEventListener) {
		elm.addEventListener(evtype, fn, usecapture);
		return true;
	} else if (elm.attachEvent) {
		var r = elm.attachEvent("on" + evtype, fn);
		return r;
	} else {
		elm["on" + evtype] = fn;
	}
}

/* ********************************************************************************************
	INPUTS HOVER CLASS CHANGER
******************************************************************************************** */

/*function setup_inputs() {
	//check if compatible
	if (document.getElementsByTagName) {
		var inputs = document.getElementsByTagName("input");
		for(i=0; i < inputs.length; i++) {
			if (inputs[i].type != 'hidden') {
				addEvent(inputs[i], "mouseover", input_hover_on, false);
				addEvent(inputs[i], "mouseout", input_hover_off, false);
				var theclass = inputs[i].className;
				if (theclass.length == 0) {
					theclass = ' ';
				}
				inputs[i].className = smartClassName(theclass,inputs[i].type + '_hover_off');
			}
		}
		var textareas = document.getElementsByTagName("textarea");
		for(i=0; i < textareas.length; i++) {
			addEvent(textareas[i], "mouseover", input_hover_on, false);
			addEvent(textareas[i], "mouseout", input_hover_off, false);
			var theclass = textareas[i].className;
			if (theclass.length == 0) {
				theclass = ' ';
			}
			textareas[i].className = smartClassName(theclass,textareas[i].type + '_hover_off');
		}
	}	
	return;
}

function input_hover_on (e) {
	var target;
	if (window.event && window.event.srcElement) {
		target = window.event.srcElement;
	} else if (e && e.target) {
		target = e.target;
	}
	if (!target) {
		return null;
	}
	target.className = smartClassName(target.className,target.type + '_hover_on',target.type + '_hover_off');
	return null;
}

function input_hover_off (e) {
	var target;
	if (window.event && window.event.srcElement) {
		target = window.event.srcElement;
	} else if (e && e.target) {
		target = e.target;
	}
	if (!target) {
		return null;
	}
	target.className = smartClassName(target.className,target.type + '_hover_off',target.type + '_hover_on');
}



function AskQuestion(question,onyes,onno) {

	var where_to= confirm(question);
	if (where_to== true) {
		if (onyes != "") {
			window.location=onyes;
		}
	} else {
		if (onno != "") {
			window.location=onno;
		}
	}

}

/* ********************************************************************************************
	UNFUNCTIONAL CODE - gets run asap.
******************************************************************************************** */
/*var crap= addEvent(window, "load", windowload, false);*/