/*
DashBoard.js
By WM  - ISITE Design


*/

//start the jQuery functions
$(document).ready(function() {
	
	
	
	function cl(logit){
		if(window.console&&window.console.firebug){
			console.log(logit)
		}
	};//cl()   cl("If you use cl() instead of console.log(), it won't break IE when you forget to take it out.");



		$(".widen").toggle(function(){
			$("#secondary").css("clear","left");
			$("#primary").css("width","960px");
			$("#content").css("backgroundImage","none")
			$(this).text("Narrow!")
			},
			function(){
				$("#primary").css("width","690px");
				$("#secondary").css("clear","none");
				$("#content").css("backgroundImage","_resources/img/css/bg_body.gif")
				$(this).text("Wide!")

			}
		)// wide




	//set up for table filter
	t = $('table')
	/*apply automatic input clearing to the search input - add as needed*/
	$("#searchform input").inputClear();

	
});// 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;
			}
		});
	};



//table filter function 
$(function() { 
  var theTable = $('table.filterTable')

  theTable.find("tbody > tr").find("td:eq(1)").mousedown(function(){
    $(this).prev().find(":checkbox").click()
  });

  $("#filter").keyup(function() {
    $.uiTableFilter( theTable, this.value );
  })

  $('#filter-form').submit(function(){
    theTable.find("tbody > tr:visible > td:eq(1)").mousedown();
    return false;
  }).focus(); //Give focus to input field
});  

$(function()
{
   
//  Developed by Roshan Bhattarai 
//  Visit http://roshanbh.com.np for this script and more.
//  This notice MUST stay intact for legal use

	//these two line adds the color to each different row
   $("#mytable tr:even").addClass("eventr");;
   $("#mytable tr:odd").addClass("oddtr");;
   //handle the mouseover , mouseout and click event
   $("#mytable tr").mouseover(function() {$(this).addClass("trover");}).mouseout(function() {$(this).removeClass("trover");}).click(function() {$(this).toggleClass("trclick");}); 
   });