
$(document).ready(function() {
$('table.quicksearch tbody tr').quicksearch({
  position: 'before',
  attached: 'table.quicksearch',
  stripeRowClass: ['odd', 'even'],
  labelText: 'Search ',
  labelClass: 'quicksearch',
  loaderImg: 'images/jtip/loader.gif'
});
});

$(document).ready(function()
{

	$.tablesorter.addWidget({
	      // give the widget a id
	      id: "sortPersist",
	      // format is called when the on init and when a sorting has finished
	      format: function(table) {

	          var COOKIE_NAME = 'MY_PERSISTENT_TABLE';
	          var cookie = $.cookie(COOKIE_NAME);
	          var options = {path: '/'};

	          var data = [];
	          var sortList = table.config.sortList;
	          var id = $(table).attr('id');
	                   // If the existing sortList isn't empty, set it into the cookie and get out
	          if (sortList.length > 0) {
	              if (typeof(cookie) == "undefined" || cookie == null) {
	                  data = {id: sortList};
	              }
	              else {
	                  data = $.evalJSON(cookie);
	                  data[id] = sortList;
	              }
	              $.cookie(COOKIE_NAME, $.toJSON(data), options);
	          }
	          // Otherwise...
	          else {
	              if (typeof(cookie) != "undefined" && cookie != null) {
	                  // Get the cookie data
	                  var data = $.evalJSON($.cookie(COOKIE_NAME));
	                  // If it exists
	                  if (typeof(data[id]) != "undefined" && data[id] != null) {
	                      // Get the list
	                      sortList = data[id];
	                      // And finally, if the list is NOT empty, trigger the sort with the new list
	                      if (sortList.length > 0) {
	                          //table.config.sortList = sortList;
	                            $(table).trigger("sorton", [sortList]);
	                      }
	                   }
	              }
	          }

	      }
	  });
	
$(".tablesorter").tablesorter({widgets: ['sortPersist']});
   }
);

function verify(msg){
    return confirm(msg);
    }
    
// for toggling show/hide

$(document).ready(function(){
		$('.showhide').toggle();
   		$('a.showhide_button').click(function(){
			$('.showhide').toggle('slow');
		});
		$('a.showhide_link').click(function(){
			$('.showhide').toggle('slow');
   		});
	});
	
// checking radio buttons with link
function radio(id) {
    if (document.getElementById(id).checked == 1) { document.getElementById(id).checked = false; } else { document.getElementById(id).checked = 1; }
}

// usefull for clearing input field on calendar, etc - pass element id then desired text
function changeText2(id,text){
	document.getElementById(id).innerHTML = text;
}
function changeInput2(id,text){
	document.getElementById(id).value = text;
}





