// main.js
// onload="document.body.scrollTop=GetScroll('scroll')" onunload="SetScroll('scroll',document.body.scrollTop)"
var funcStop;
function OverParent(sub,top,left){
clearTimeout(funcStop);
document.getElementById('div_menu').style.display = '';
document.getElementById('div_menu').style.top = top;
document.getElementById('div_menu').style.left = left;
BindData(sub);
}
function OverChild(){
clearTimeout(funcStop);
}
function OutArea(){
funcStop = setTimeout("CloseChild()",500);
}
function CloseChild(){
document.getElementById('div_menu').style.display = 'none';
}

function openwin(href,target,status)
{
  if(status == null)
  {
    window.open(href);
  }
  else
  {
    if(status == '')
    {
      status = 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,top=50,left=50,height=400px,width=500px';
    }
    window.open(href,target,status);
  }
  return false;
}

function showsubmenu(sid)
{
    whichel = eval("submenu" + sid);
    if(whichel.style.display == "none")
    {
        eval("submenu" + sid + ".style.display=\"\";");
    }
    else
    {
        eval("submenu" + sid + ".style.display=\"none\";");
    }
}
function openwin(url)
{		window.open(""+url,"","height=500,width=578,left=150,top=20,resizable=no,scrollbars=yes,status=no,toolbar=no,menubar=no,location=no");
}
function openwin_subject(url)
{		window.open(""+url,"","height=200,width=410,left=180,top=180,resizable=no,scrollbars=yes,status=no,toolbar=no,menubar=no,location=no");
}
function openwin_free(url,width,height,left,top,name)
{		var hh=window.open(""+url,name+"",""+"width="+width+",height="+height+",left="+left+",top="+top+",resizable=no,scrollbars=yes,status=no,toolbar=no,menubar=no,location=no,");
hh.focus()
}
function check()
{
    //CheckBox Function For Union
    //<a href=# onclick='check()'>全选</a>
    //<a href=# onclick='check()'>反选</a>
    var obj=event.srcElement;
    var objs=document.all;
    if(obj.innerText=='全选')
    {
        for(i=0;i<objs.length;i++)
        {
            if(objs[i].tagName.toLowerCase()=='input' && objs[i].type.toLowerCase()=='checkbox' && objs[i].id.toLowerCase().indexOf('checkbox1')!=-1)
            {
                objs[i].checked=true;
            }
        }
        obj.innerText='不选';
        return;
    }
    if(obj.innerText=='不选')
    {
        for(i=0;i<objs.length;i++)
        {
            if(objs[i].tagName.toLowerCase()=='input' && objs[i].type.toLowerCase()=='checkbox' && objs[i].id.toLowerCase().indexOf('checkbox1')!=-1)
            {
                objs[i].checked=false;
            }
        }
        obj.innerText='全选';
        return;
    }
    if(obj.innerText=='反选')
    {
        for(i=0;i<objs.length;i++)
        {
            if(objs[i].tagName.toLowerCase()=='input' && objs[i].type.toLowerCase()=='checkbox')
            {
                objs[i].checked=!objs[i].checked;
            }
        }
        return;
    }
}

var isIE=navigator.appVersion.indexOf("MSIE")>-1
var isOpera=navigator.userAgent.indexOf("Opera")>-1
var isFirefox=navigator.userAgent.indexOf("Firefox")>-1
/*对象快捷方式*/
function $(o){return typeof(o)=='string'?document.getElementById(o):o}
/*空函数*/
function f(){}
/*动态执行函数*/
function ev(s){eval(s)}
/*页面事件冒泡{f:函数,o:对象,e:事件}*/
function ae(f,o,e){if(!o)o=window;if(!e)e='load';if(isIE&&(document.all&&!isOpera)){o.attachEvent('on'+e,f)}else{o.addEventListener(e,f,false)}}
/*对象位置、大小*/
function getxy(o){o=$(o);l=o.offsetLeft;t=o.offsetTop;w=o.offsetWidth;h=o.offsetHeight;while(o=o.offsetParent){l+=o.offsetLeft;t+=o.offsetTop}return [l,t,w,h]}
/*取出Cookie*/
function getCookie(name){var arr=document.cookie.match(new RegExp("(^| )"+name+"=([^;]*)(;|$)"));if(arr!=null)return unescape(arr[2]);return ""}
/*设置Cookie*/
function setCookie(name,value){var exp =new Date();exp.setTime(exp.getTime()+30*24*60*60*1000);document.cookie=name+"="+escape(value)+";expires="+ exp.toGMTString()}
/*异步传输{fun:函数,url:页面地址,str:表单序列字符串,xml:XML开关}*/
function ajax(fun,url,str,xml){
  if(typeof(fun)!='function')return
  var o=(function(){try{o=new ActiveXObject("Msxml2.XMLHTTP")}catch(e1){try{o=new ActiveXObject("Microsoft.XMLHTTP")}catch(e2){try{o=new XMLHttpRequest()}catch(e3){}}}return o})()
  if(!o)return;url+="&"+Math.random();o.open(str?"POST":"GET",url,true)
  if(str)o.setRequestHeader("Content-Type","application/x-www-form-urlencoded")
  o.onreadystatechange=function(){if(o.readyState==4)if(o.status==200)fun(xml?o.responseXML:o.responseText)}
  o.send(str)
}
