// JScript 文件
function DelNews(id)
{
 var object=admin_newmange_aspx.DeleteNew(id);
 if(object.value==1)
   alert("删除失败");
 else
   alert("删除失败");
}
function $(v) { return(document.getElementById(v)); }
function $S(v) { return($(v).style); }
function agent(v) { return(Math.max(navigator.userAgent.toLowerCase().indexOf(v),0)); }
function isset(v) { return((typeof(v)=='undefined' || v.length==0)?false:true); }
function XYwin(v) { var z=agent('msie')?Array(document.body.clientHeight,document.body.clientWidth):Array(window.innerHeight,window.innerWidth); return(isset(v)?z[v]:z); }

function sexyTOG() { document.onclick=function(){ $S('sexyBG').display='none'; $S('sexyBOX').display='none'; document.onclick=function(){}; }; }
function sexyBOX(b,id) {
var obj=admin_newmange_aspx.ShowOne(id);
var item=obj.value.split(",");
$S('sexyBG').height=XYwin(0)+'px'; 
$S('sexyBG').display='block'; 
$('sexyBOX').innerHTML="<div class=\"sexyT\">  "+item[0]+"<\/div>"+item[1]+"<br/>"+item[2]+"<div class=\"sexyX\" onMouseMove=\"setTimeout('sexyTOG()',1);\" onMouseOut=\"setTimeout('document.onclick=function(){}',1);\" style=\"cursor:pointer;\">(关闭)"+"<\/div>"; 
$S('sexyBOX').left=Math.round((XYwin(1)-b)/2)+'px'; 
$S('sexyBOX').width=b+'px'; 
$S('sexyBOX').display='block'; }

window.onload=function(){
document.body.innerHTML="<div id=\"sexyBG\"></div><div id=\"sexyBOX\"></div>"+document.body.innerHTML;
}

function EditNews(id)
{
 document.getElementById("nifty").style.display="none";
 document.getElementById("Div2").style.display="block";
 var obj=admin_newmange_aspx.ShowOne(id);
 var item=obj.value.split(",");
 document.getElementById("title").value=item[0];
 document.getElementById("context").value=item[1];
 document.getElementById("subNews").onclick=new Function("subEditNew('"+id+"')");
}
function ShowNews()
{
 document.getElementById("nifty").style.display="block";
 document.getElementById("Div2").style.display="none";
}
function subEditNew(id)
{
 var title=document.getElementById("title").value;
 var context=document.getElementById("context").value;
 var obj=admin_newmange_aspx.EditOneNews(id,title,context);
 if(obj.value==1)
  alert("更新成功");
 else
  alert("更新失败");
 ShowNews();
}
function AddNews()
{
  document.getElementById("nifty").style.display="none";
  document.getElementById("Div2").style.display="block";
  document.getElementById("subNews").onclick=new Function("subAddNews()");
}
function subAddNews()
{
  var title=document.getElementById("title").value;
  var context=document.getElementById("context").value;
  document.getElementById("nifty").style.display="none";
  document.getElementById("Div2").style.display="block";
  var obj=admin_newmange_aspx.AddOneNews(title,context);
  if(obj.value==1)
   alert("更新成功");
  else
   alert("更新失败");
  ShowNews();
}