$(document).ready(function(){
 
	//table js
	//$("#table2").tablesorter({ sortList: [[0,0],[2,0]],headers: { 1: { sorter: false},3: {sorter: false} } });

	$("#showtable").hide();
	$("tr:even").addClass('myhide');
	$("tr:odd").addClass('myodd');
	$("tr:has(th)").css({"background-color":"#666666",color:"white","font-size":" 0.9em"}).removeClass('myhide');


$("tr:not(:has(th))").hover(
  function () {
    $(this).addClass("mytr");
  },
  function () {
    $(this).removeClass("mytr");
  }
);/*
	$("td").hover(
  function () {
    $(this).addClass("mytd");
  },
  function () {
    $(this).removeClass("mytd");
  }
);
*/

$("tr a").click(function(){
	//var a=$("tr").index(this);
	
	var a=this.name;
	var b=parseInt(a)+1;
	var tt=this.id;
	//alert(b);
	 
	//$("#test").html(b);
	
	
	$.ajax({
   type: "POST",
   url: "msg_process.php",
   data: 'action=read&iId='+tt,
   beforeSend: function(){
	     $('#wait_'+tt).show();
   },
   success: function(msg){
	    
	  $('#wait_'+tt).show();
	 
     
   },
   complete:function(){
	   
	   $('#wait_'+tt).hide(); 
	   $("tr:even:not(:has(th))").addClass('myhide');
	$('tr:eq('+b+')').removeClass('myhide').addClass('myeven'); 
   }
 });


 
});


  });

function delmsg(iId){
	var iId=iId;
	var nex='n_'+iId;

	
	$.ajax({
   type: "POST",
   url: "msg_process.php",
   data: 'action=del&iId='+iId,
     beforeSend: function(){
	       $('#wait_'+iId).show();
   },
   success: function(msg){
	    
	  $('#wait_'+iId).show();
	 
     
   },
   complete:function(){
	   
	  
//	$('tr:eq('+b+')').removeClass('myhide').addClass('myeven');
  $('#wait_'+iId).hide(); 
	  $('tr[@id='+iId+']').addClass('myhide');
		   $('tr[@id='+nex+']').addClass('myhide');
	
	
	}
	 }); 
	
	    
}

function hide_msg(trid){
	var trid=trid;
	//alert(trid);
		  $('tr[@name='+trid+']').addClass('myhide');
	
	
	
	
	
	}