/* Project Name Global Javascript Functions

By  - ISITE Design


*/

//start the jQuery functions
$(document).ready(function() {
    //calling functions from this file doesn't work right now.  not sure how to fix it.
    //can still be used to insert a toolbox on the page.  open via keyboard shortcut?
    //$.getScript("_resources/js/dev_utils.js");
    function cl(logit){ if(window.console&&window.console.firebug) { console.log(logit); } };//cl()

	/*apply automatic input clearing to the search input - add as needed*/
	$("#search input").inputClear();

	/* add class to drop downs and buttons for IE <6 */
	if(document.all){
	    $("button, #nav li, dl.tabs dt, li.video h4").hover(
	            function() {
					$(this).addClass("over");
				},
	            function() {
					$(this).removeClass("over");
				}
	    );
	}// if document.all
    

    /* set up default tab behavior */
    $('dl.tabs dt').click(function () {
        tab = $(this).attr('class').match(/tab-(\w+)/);
        $('dl.tabs dt, dl.tabs dd').removeClass('on');
        $('dl.tabs dt.tab-' + tab[1] + ', dl.tabs dd.pane-' + tab[1]).addClass('on');
    });
    /* go through tabs and turn the first one on if there is no other default */
    if(!$('dl.tabs dt').hasClass('on')) $('dl.tabs dt').filter(':first').trigger('click');
	
	// table sorting
	//$("table.listing").tablesorter({ headers: { 0 : { sorter: false } }, sortList: [[1,0]], widgets: ['zebra'] });        
	$("table.listing tr:odd").addClass("even");
	//headerSortUp
	//headerSortDown apply directly on th
    
});// document ready / end jquery functions


	/* clear search field on click - made into plugin so it can easily be used more than once. */
	jQuery.fn.inputClear = function() {
		return this.focus(function() {
			if( this.value == this.defaultValue ) {
				this.value = "";
			}
		}).blur(function() {
			if( !this.value.length ) {
				this.value = this.defaultValue;
			}
		});
	};