/*
OHSU Global Javascript Functions
By  Will Moore - ISITE Design
*/

//start the jQuery functions
jQuery(function($){
// ONLY jquery functions in this block.  Prototype functions will not work.


	/*apply to the header search input - add as needed*/
	$("#search, .searchform input, #searchname").inputClear();


	/*add class to drop downs for IE <6*/
	if(document.all){
	    $("#mainNav li, button").hover(
	            function() {
					$(this).addClass("over");
				},
	            function() {
					$(this).removeClass("over");
				}
	    );
	}// if document.all


if ($(".toggle_subcontent").length>0){  //make sure there's a toggler before we hide it.
	$("#subcontent").hide();

	$(".toggle_subcontent").toggle(
		function(){
			$("#subcontent").show(200);
			$(this).addClass("toggle_on");
		},
		function(){
			$("#subcontent").hide(200);
			$(this).removeClass("toggle_on");
		}
	);//toggle
};// if toggle_subcontent


//make the site map a tree
/*
if ($("#sitemap").length>0){
	$("#sitemap").treeview();
};
*/
if ($("table.listing").length>0){
	$("table.listing").tablesorter({
			sortColumn: 'name',					// Integer or String of the name of the column to sort by.
			sortClassAsc: 'headerSortUp',		// Class name for ascending sorting action to header
			sortClassDesc: 'headerSortDown',	// Class name for descending sorting action to header
			headerClass: 'header_cell',			// Class name for headers (th's)
			widgets: ['zebra'],
			stripeRowsOnStartUp: true			// Strip rows on tableSorter init.
	}); //table sorters
};




});// document ready / end jquery functions

jQuery.fn.inputClear = function() {
	return this.focus(function() {
		if( this.value == this.defaultValue ) {
			this.value = "";
			$(this).addClass("focus");
		}
	}).blur(function() {
		if( !this.value.length ) {
			this.value = this.defaultValue;
			$(this).removeClass("focus");
		}
	});
}; //inputClear