$(document).ready(function(){ 

	$('#orders').tablesorter(); 

	$('table.priceTable tr:gt(0)').mouseover(function(){
		if($('a',this).length>0) {
			$(this).css('cursor', 'pointer !important');
		}
		$(this).addClass('hover');
	}).mouseout(function(){
		$(this).css('cursor', 'default');
		$(this).removeClass('hover');
	});


	$("table.priceTable tr:gt(0)").click(function () { 
		if (event.target.type !== 'radio') {
			$(':radio', this).trigger('click');
		}
		location.href=$('a',this).attr('href');
	});

	$('table.ordersList tr:gt(0)').mouseover(function(){
		if($('a',this).length>0) {
			$(this).css('cursor', 'pointer !important');
		}
		$(this).addClass('hover');
	}).mouseout(function(){
		$(this).css('cursor', 'default');
		$(this).removeClass('hover');
	});

	$("table.ordersList tr:gt(0)").click(function () { 
		if($('a',this).length>0) {
			location.href=$('a',this).attr('href');
		}
	});
	
	$('#search').keyup(function () {  
		var str = $(this).attr('value').toLowerCase();
		$("#orders tr:gt(0)").css("display", "none").filter(function (index) {
			return $("td", this).text().toLowerCase().search(str)>-1;
                }).css("display", "table-row");
	});
	$("#reset").click(function() { 
        // set sorting column and direction, this will sort on the first and third column the column index starts at zero 
        var sorting = [[0,0],[2,0]]; 
        // sort on the first column 
        $("#orders").trigger("sorton",[sorting]); 
        // return false to stop default link action 
        return false; 
    });


});
	