﻿var timer1;
var first=true;
$(document).ready(function(){
if(typeof msg=="undefined"){
gettable();
$("#min").text("20");
$("#sec").text("00");
timer1=window.setInterval("RefreshData()",1000);
}else{
$("#msgtbl").show();
$("#msglist").hide();
getmsg();
}
});
function RefreshData(){
if($("#min").text()=="00"&&$("#sec").text()=="00"){
clearInterval(timer1);
destruct();
return;
}else{
if($("#sec").text()=="00"){
if(!first){
gettable();
}
$("#min").text(checkTime($("#min").text()-1));
$("#sec").text(59);
first=false;
}else{
$("#sec").text(checkTime($("#sec").text()-1));
}
}
};
function checkTime(i){
if(i<10){
i="0"+i;
}
return i;
};
function getmsg(){
$.ajax({type:"POST",data:msg,url:"msg.aspx",success:goodSubmit,error:failedSubmit});
};
function gettable(){
var _1="";
$.ajax({type:"POST",data:_1,url:"msgtable.aspx",success:goodSubmit,error:failedSubmit});
};
function failedSubmit(_2,_3,_4){
};
function goodSubmit(_5,_6){
if(_5.length==0){
return;
}
if(_5.indexOf("refresh")==0){
clearInterval(timer1);
destruct();
return;
}
if(typeof msg=="undefined"){
$("#tbody1").html(_5);
}else{
$("#tbody2").html(_5);
}
};
function destruct(){
$("#msgexpire").show();
$("#msglist").hide();
};
function refreshbox(){
window.location.href=window.location.href;
};
function viewmsg(id){
document.getElementById("hdnfield").value=id;
document.form1.submit();
};
