// main.js
// onload="document.body.scrollTop=GetScroll('scroll')" onunload="SetScroll('scroll',document.body.scrollTop)"
var funcStop;
function OverParent(sub,left,top){
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 showmenu(menuid,p_top,p_left)
{
	document.all['navdiv'].style.display = '';
	document.all['navdiv'].style.top = p_top;
	document.all['navdiv'].style.left = p_left;
	if(menuid == 01) document.all['navdiv'].innerHTML = '<div style="background:url(/yytax/images/yytax_navbg.gif);width:123;height:315">01</div>';
	if(menuid == 02) document.all['navdiv'].innerHTML = '<div style="background:url(/yytax/images/yytax_navbg.gif);width:123;height:315"">02</div>';
	if(menuid == 03) document.all['navdiv'].innerHTML = '<div style="background:url(/yytax/images/yytax_navbg.gif);width:123;height:315"">03</div>';
	if(menuid == 04) document.all['navdiv'].innerHTML = '<div style="background:url(/yytax/images/yytax_navbg.gif);width:123;height:315"">04</div>';
}

function hidemenu(menuid)
{
	document.all['navdiv'].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 GetScroll (name) 
{
var arg = name + "=";
var alen = arg.length;
var clen = document.cookie.length;
var i = 0;
while (i < clen)
{
    var j = i + alen;
    if (document.cookie.substring(i, j) == arg)
    return getScrollVal (j);
    i = document.cookie.indexOf(" ", i) + 1;
    if (i == 0) break; 
}
return null;
}

function SetScroll (name, value) 
{
    document.cookie = name + "=" + escape (value)
}
function getScrollVal (offset) 
{
var endstr = document.cookie.indexOf (";", offset);
if (endstr == -1)
    endstr = document.cookie.length;
    return unescape(document.cookie.substring(offset, endstr));
}

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 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;
    }
}