﻿// JScript 文件
function $(s){
    return document.getElementById(s);
}
function trim(s) { 
    return s.replace( /^ */, "" ).replace( / *$/, "" );
}
var odiv;
function pl(){
    odiv = $("topFill"); 
    odiv.style.display = "none";
    $("tdMove").onmousedown=function(e)   
    {   
      if(!e) e = window.event; //如果是IE   
      posX = e.clientX - parseInt($("alertBox").style.left);   
      posY = e.clientY - parseInt($("alertBox").style.top);   
      document.onmousemove = mousemove;     
    } 
}
window.onscroll=function(){
    if(odiv!=null && odiv.style.display == 'block'){
    odiv.style.height = document.body.scrollHeight +'px'; 
     odiv.style.width = document.body.scrollWidth +'px';
        $("alertBox").style.top = (document.documentElement.clientHeight/2+document.documentElement.scrollTop-50)+ 'px';
        var width = document.documentElement.clientWidth;
     $("alertBox").style.left = (width-285)/2+document.documentElement.scrollLeft +'px';
    }
}
window.onresize=function(){
    if(odiv!=null && odiv.style.display == 'block'){
    odiv.style.height = document.body.scrollHeight +'px'; 
     odiv.style.width = document.body.scrollWidth +'px';
        $("alertBox").style.top = (document.documentElement.clientHeight/2+document.documentElement.scrollTop-50)+ 'px';
        var width = document.documentElement.clientWidth;
     $("alertBox").style.left = (width-285)/2+document.documentElement.scrollLeft +'px';
    }
}
//增加
function CreateMenu(id){
        odiv = $("topFill"); 
    odiv.style.display = "none";
     odiv.style.display = 'block';
     $("alertBox").style.top = ((document.documentElement.clientHeight)/2+document.documentElement.scrollTop-50)+ 'px'; 
     $("alertBox").style.display = 'block';
     var width = document.documentElement.clientWidth;
     $("alertBox").style.left = (width-285)/2+document.documentElement.scrollLeft +'px';
     
     odiv.style.top = 0 + 'px'; 
     odiv.style.height = document.body.scrollHeight +'px'; 
     odiv.style.width = document.body.scrollWidth +'px';
     $('txtID').value=id;
     $('txtPwd').value='';
}
//取消
function Cancel(){
     document.body.style.overflow = ''; 
     odiv.style.display = 'none'; 
     $("alertBox").style.display = 'none';
}


//拖动层
var posX;   
var posY;
  
document.onmouseup = function()   
{   
  document.onmousemove = null;   
}   
function mousemove(ev)   
{   
  if(ev==null) ev = window.event;//如果是IE   
  $("alertBox").style.left = (ev.clientX - posX) + "px";   
  $("alertBox").style.top = (ev.clientY - posY) + "px";   
} 
//

function Sub()
{
    var guid = $('txtID');
    if(guid.value=='')
    {
        alert("请输入编号!");
        guid.focus();
        return false;
    }
    var pwd = $('txtPwd');
    if(pwd.value=='')
    {
        alert("请输入密码!");
        pwd.focus();
        return false;
    }

var Action='action=rep&id='+guid.value+'&pwd='+pwd.value;
      var options={ 
                  method:'post', 
                  parameters:Action, 
                  onComplete:function(transport) 
                  { 
                      var returnvalue=transport.responseText;
                      if(returnvalue == "ok")
                      {
                       Cancel();
                        window.open("yzxxXX.aspx?id="+guid.value+"&pid=10");
                      }
                      else if(returnvalue=="1")
                      {
                        alert("编号有误！");
                      }
                      else if(returnvalue == "2")
                      {
                        alert("密码有误！");
                      }
                      else if(returnvalue == "3")
                      {
                        alert("编号或密码有误！");
                      }
                      else
                      {
                        alert("未知错误！");
                      }
                   } 
                   }; 
      new  Ajax.Request('ajzxYzxx.aspx?no-cache='+Math.random(),options);
}
function Sub1()
{
    var guid = $('txtID1');
    if(guid.value=='')
    {
        alert("请输入编号!");
        guid.focus();
        return false;
    }
    var pwd = $('txtPwd1');
    if(pwd.value=='')
    {
        alert("请输入密码!");
        pwd.focus();
        return false;
    }

var Action='action=rep&id='+guid.value+'&pwd='+pwd.value;
      var options={ 
                  method:'post', 
                  parameters:Action, 
                  onComplete:function(transport) 
                  { 
                      var returnvalue=transport.responseText;
                      if(returnvalue == "ok")
                      {
                       Cancel();
                        window.open("yzxxXX.aspx?id="+guid.value+"&pid=10");
                      }
                      else if(returnvalue=="1")
                      {
                        alert("编号有误！");
                      }
                      else if(returnvalue == "2")
                      {
                        alert("密码有误！");
                      }
                      else if(returnvalue == "3")
                      {
                        alert("编号或密码有误！");
                      }
                      else
                      {
                        alert("未知错误！");
                      }
                   } 
                   }; 
      new  Ajax.Request('ajzxYzxx.aspx?no-cache='+Math.random(),options);
}

