﻿function search_da()
{
    var txt = $.trim($("#searchDangAn").val());
    if(txt.length <= 0 || txt=="请输入档案号")
    {
        alert("请输入档案号码！");
        $("#searchDangAn").focus();
        return ;
    }
    location.href='/fangwei/search.aspx?action=dangan&classid='+txt;
}

function searchNews()
{
    var txt = $.trim($("#txtSearchKeys").val());
    var type = $.trim($("#searchNewsType option:selected").val());
    if(txt.length <=0 || txt=="请输入关键字")
    {
        alert("请输入要搜索的关键字！");
        $("#txtSearchKeys").focus();
        return ;
    }
    if(type == "0")
        location.href='/public/search.aspx?keys='+escape(txt);
    else
        location.href='users/users.aspx?keys='+escape(txt);
}

function search_fw()
{
    var txt = $.trim($("#searchFangWei").val());
    if(txt.length <= 0 || txt =="请输入16位仿伪码")
    {
        alert("请输入16位仿伪码！");
        $("#searchFangWei").focus();
        return ;
    }
    
    location.href='/fangwei/search.aspx?action=fangwei&classid='+txt;
}

//login/default.aspx登录验证
function login()
{
    var uname = $.trim($("#txtUserName").val());
    var upass = $.trim($("#txtUserPass").val());
    var codes = $.trim($("#txtUserCodes").val());

    
    if(uname.length == 0)
    {
        $("#lblLoginErrors").html("用户名必须填写！");
        $("#txtUserName").focus();
        return false;
    }
    
    if(upass.length == 0)
    {
        $("#lblLoginErrors").html("用户密码必须填写！");
        $("#txtUserPass").focus();
        return false;
    }
    
    if(codes.length <= 0)
    {
        $("#lblLoginErrors").html("验证码必须填写！");
        $("#txtUserCodes").focus();
        return false;
    }
    
    return true;
}

function codes()
{
    var url = $("#imgCodes").attr("src")+ "?t="+new Date();
    $("#imgCodes").attr("src",url);
}




function slideAd(id,nStayTime,sState,nMaxHth,nMinHth){ 
  this.stayTime=nStayTime*4000 || 3000; 
  this.maxHeigth=nMaxHth || 365; 
  this.minHeigth=nMinHth || 1; 
  this.state=sState || "down" ; 
  var obj = document.getElementById(id); 
  if(intervalId != null)window.clearInterval(intervalId); 
  function openBox(){ 
   var h = obj.offsetHeight; 
   obj.style.height = ((this.state == "down") ? (h + 5) : (h - 5))+"px"; 
    if(obj.offsetHeight>this.maxHeigth){ 
    window.clearInterval(intervalId); 
    intervalId=window.setInterval(closeBox,this.stayTime); 
    } 
    if (obj.offsetHeight<this.minHeigth){ 
    window.clearInterval(intervalId); 
//    obj.style.display="none"; 
    } 
  } 
  var intervalId = null; 
  function closeBox(){ 
   slideAd(id,this.stayTime,"up",this.maxHeigth,this.minHeigth); 
  } 
//  setTimeout("slideAd('MyMoveAd',2)",3000);
  intervalId = window.setInterval(openBox,1); 
}


