﻿function LoadFlash(url,wmode,width,Height)
{ 
document.write(
  '<embed src="' + url + '" wmode=' + wmode +
  ' quality="high" pluginspage=http://www.macromedia.com/go/getflashplayer type="application/x-shockwave-flash" width="' + width + 
  '" height="' + Height + '"></embed>');   
}

function OverImage(obj, filename)
{
    obj.src=filename;
}

function OutImage(obj, filename)
{
    obj.src=filename;
}

var xPos = 20;
var yPos = 60;
var step = 1;
var delay = 30; 
var height = 0;
var Hoffset = 0;
var Woffset = 0;
var yon = 0;
var xon = 0;
var pause = true;
var interval;
function changePos() 
{
    width = document.body.clientWidth;
    height = document.body.clientHeight;
    var img = document.getElementById("imgFlow");
    Hoffset = img.offsetHeight;
    Woffset = img.offsetWidth;
    img.style.left = xPos + document.body.scrollLeft;
    img.style.top = yPos + document.body.scrollTop;
    if (yon) {
    yPos = yPos + step;
    }
    else {
    yPos = yPos - step;
    }
    if (yPos < 0) {
    yon = 1;
    yPos = 0;
    }
    if (yPos >= (height - Hoffset)) {
    yon = 0;
    yPos = (height - Hoffset);
    }
    if (xon) {
    xPos = xPos + step;
    }
    else {
    xPos = xPos - step;
    }
    if (xPos < 0) {
    xon = 1;
    xPos = 0;
    }
    if (xPos >= (width - Woffset)) {
    xon = 0;
    xPos = (width - Woffset);
    }
}

function startFlow() {
yPos = window.screen.availheight - 200;
yPos = 500;
var img = document.getElementById("imgFlow");
if (img.style.display == "none") return;
img.style.top = yPos;

interval = setInterval('changePos()', delay);
}

function CheckSearch(field)
{
    var e = document.getElementById(field);  
    var patrn=/^[^`~!@#$%^&*()+=|\\\][\]\{\}:;'\,.<>/?]{1}[^`~!@$%^&()+=|\\\][\]\{\}:;'\,.<>?]{0,29}$/;   
    if (!patrn.exec(e.value))
    {
        alert("您输入的查询条件含有不允许使用的字符,请重新输入！");
        e.focus();
        return false;
    }  
    return true; 
}

function CheckSearchADV()
{
    if (!CheckSearch("tbSearch_name")) return false;
    if (!CheckSearch("tbSearch_unit")) return false;
    return true;
    
}

function CheckLogin()
{
    var e = document.getElementById("tbEUName");  
    var patrn=/^[^`~!@#$%^&*()+=|\\\][\]\{\}:;'\,.<>/?]{1}[^`~!@$%^&()+=|\\\][\]\{\}:;'\,.<>?]{0,19}$/;   
    if (!patrn.exec(e.value))
    {
        alert("无效的用户名称！");
        e.focus();
        return false;
    }  
    return true; 
}

