﻿// JScript 文件
//document.oncontextmenu=new Function("event.returnValue=false;");
//document.onselectstart=new Function("event.returnValue=false;"); 
function checkLogin()
{
    if (document.getElementById("name").value == "" || 
        document.getElementById("pwd").value == "" )
    {
        alert("用户名或密码不能为空！");
        return false;
    }
    return true;
}
function showChild(div)
{
    var show = document.getElementById(div).style.display;
    if (show == "none")
    {
        document.getElementById(div).style.display = "block";
    }
    else
    {
        document.getElementById(div).style.display = "none";
    }
}

function pageNum(div1,div2,div3,div4)
{
    div1.style.display="block";				
    div2.style.display="none"; 
    div3.style.display="none";
    div4.style.display="none";
}

function closeChild(div)
{
   document.getElementById(div).style.display = "none";
}

function ShowPicture(url)
{
    var targeturl = url;
    newwin = window.open("","","scrollbars");
    if (document.all)
    {
	    newwin.moveTo(screen.width/2-512,0);
	    newwin.resizeTo(1024,screen.height);
	}
	newwin.location = targeturl;
}

/*首页浮动的图片*/

var brOK=false;
var mie=false;
var aver=parseInt(navigator.appVersion.substring(0,1));
var aname=navigator.appName;

function checkbrOK()
{
    if(aname.indexOf("Internet Explorer")!=-1)
    {
        if(aver>=4)
             brOK=navigator.javaEnabled();
        mie=true;
    }
    if(aname.indexOf("Netscape")!=-1)  
    {
        if(aver>=4) 
            brOK=navigator.javaEnabled();
    }
}

var vmin=2;
var vmax=5;
var vr=2;
var timer1;

function Chip(chipname,width,height)
{
    this.named=chipname;
    this.vx=vmin+vmax*Math.random();
    this.vy=vmin+vmax*Math.random();
    this.w=width;
    this.h=height;
    this.xx=0;
    this.yy=0;
    this.timer1=null;
}

function movechip(chipname)
{
    if(brOK)
    {
        eval("chip="+chipname);
        if(!mie)
        {
            pageX=window.pageXOffset;
            pageW=window.innerWidth;
            pageY=window.pageYOffset;
            pageH=window.innerHeight;
        }
        else
        {
            pageX=window.document.body.scrollLeft;
            pageW=window.document.body.offsetWidth-8;
            pageY=window.document.body.scrollTop;
            pageH=window.document.body.offsetHeight;
        } 

        chip.xx=chip.xx+chip.vx;
        chip.yy=chip.yy+chip.vy;
   
        chip.vx+=vr*(Math.random()-0.5);
        chip.vy+=vr*(Math.random()-0.5);
        if(chip.vx>(vmax+vmin))  chip.vx=(vmax+vmin)*2-chip.vx;
        if(chip.vx<(-vmax-vmin)) chip.vx=(-vmax-vmin)*2-chip.vx;
        if(chip.vy>(vmax+vmin))  chip.vy=(vmax+vmin)*2-chip.vy;
        if(chip.vy<(-vmax-vmin)) chip.vy=(-vmax-vmin)*2-chip.vy;


        if(chip.xx<=pageX)
        {
            chip.xx=pageX;
            chip.vx=vmin+vmax*Math.random();
        }
        if(chip.xx>=pageX+pageW-chip.w)
        {
            chip.xx=pageX+pageW-chip.w;
            chip.vx=-vmin-vmax*Math.random();
        }
        if(chip.yy<=pageY)
        {
            chip.yy=pageY;
            chip.vy=vmin+vmax*Math.random();
        }
        if(chip.yy>=pageY+pageH-chip.h)
        {
            chip.yy=pageY+pageH-chip.h;
            chip.vy=-vmin-vmax*Math.random();
        }

        if(!mie)
        {
            eval('document.'+chip.named+'.top ='+chip.yy);
            eval('document.'+chip.named+'.left='+chip.xx);
        } 
        else
        {
            eval('document.all.'+chip.named+'.style.pixelLeft='+chip.xx);
            eval('document.all.'+chip.named+'.style.pixelTop ='+chip.yy); 
        }
        chip.timer1=setTimeout("movechip('"+chip.named+"')",100);
    }
}

function stopme(chipname)
{
    if(brOK)
    {//alert(chipname)
        eval("chip="+chipname);
        if(chip.timer1!=null)
        {
            clearTimeout(chip.timer1)
        }
    }
}

var mm;
function mm()
{
    checkbrOK(); 
    mm=new Chip("mm",60,80);
    if(brOK) 
    {
         movechip("mm");
    }
}

/*首页浮动的图片*/

/*机构设置右侧鼠标事件*/
function mouseOver(obj)
{
    obj.style.backgroundImage = "url(SysImages/bgjg.gif)";
}
function mouseOut(obj)
{
    obj.style.backgroundImage = "none";
}

/*用户登录按钮*/
function btnSubmit()
{
    var user = document.getElementById('txt_User').value;
    var pwd = document.getElementById('txt_PWD').value;
    var code = document.getElementById('txt_Code').value;
    if (user == '')
    {
        alert('用户不能为空！');
    }
    else if (pwd == '')
    {
        alert('密码不能为空！');
    }
    else if (code == '')
    {
        alert('验证码不能为空！');
    }
    else
    {
        window.location.href="UserLogin.aspx?user=" + escape(user) + "&pwd=" + escape(pwd) + "&code=" + escape(code);
    }
}
function btnReset()
{
    document.getElementById('txt_User').value = '';
    document.getElementById('txt_PWD').value = '';
    document.getElementById('txt_Code').value = '';
}