function $(obj)
{
    if (typeof(obj) == 'object')
    {
        return obj;
    }
    else
    {
        return document.getElementById(obj);
    }
}

/*导航条菜单*/
function InitBitMenu(id){
var ul = $(id);
li = ul.getElementsByTagName("li");
var page = document.URL.substr(document.domain.length + 7).toLowerCase();
var fined = false;
for(i=0;i<li.length;i++)
{
    if(li[i].innerHTML.toLowerCase().indexOf(page)>-1)
    {
        if(li[i].parentNode!=ul)
        {
            continue;
        }
        if (!fined) {
            li[i].className = "mhover";
            li[i].getElementsByTagName("ul")[0].style.display = "block";
            fined = true;
        }
    }
    if(li[i].parentNode!=ul)
    {
        continue;
    }
    li[i].onmouseover = function()
    {
        try
        {
            if(this.innerHTML)
            {
                for(var j=0;j<li.length;j++)
                {
                    try
                    {
                        if(li[j].parentNode!=ul || !li[j].innerHTML)
                        {
                             continue;
                        }
                        li[j].getElementsByTagName("ul")[0].style.display="none";
                    }
                    catch(e){}
                }
                this.className="mhover";
                try{this.getElementsByTagName("ul")[0].style.display="block";}catch(e){}
            }
        }
        catch(e){}}
        li[i].onmouseout = function()
        {
            try
            {
                //this.getElementsByTagName("ul")[0].style.display="none";
                for(j=0;j<li.length;j++)
                {
                    if(li[j].parentNode!=ul || !li[j].innerHTML)
                    {
                        continue;
                    }
                    try{li[j].className=="s"?void(0):li[j].className="";}catch(e){}
                }
                if(this.innerHTML)
                {
                    this.className="mhover";
                }
            }catch(e){}
        }
    }
}

/*flash图片新闻*/
function flash(pic,text,links){
var focus_width=500;
var focus_height=300;
var text_height=20;
var swf_height = focus_height+text_height;
var pics=pic;
var texts=text;
var links=links;
document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="'+ focus_width +'" height="'+ swf_height +'">');
document.write('<param name="allowscriptAccess" value="sameDomain"><param name="movie" value="flash/news_pic.swf"><param name="quality" value="high"><param name="bgcolor" value="FFFBF7">');
document.write('<param name="menu" value="false"><param name=wmode value="opaque">');
document.write('<param name="FlashVars" value="pics='+pics+'&links='+links+'&texts='+texts+'&borderwidth='+focus_width+'&borderheight='+focus_height+'&textheight='+text_height+'">');
document.write('<embed src="flash/pic.swf" wmode="opaque" FlashVars="pics='+pics+'&links='+links+'&texts='+texts+'&borderwidth='+focus_width+'&borderheight='+focus_height+'&textheight='+text_height+'" menu="false" bgcolor="#ffeabb" quality="high" width="'+ focus_width +'" height="'+ swf_height +'" allowscriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');
document.write('</object>');
}

function pict(pic,text,links){
var focus_width=205;
var focus_height=150;
var text_height=20;
var swf_height = focus_height+text_height;
var pics=pic;
var texts="";
var links=links;
document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="'+ focus_width +'" height="'+ swf_height +'">');
document.write('<param name="allowscriptAccess" value="sameDomain"><param name="movie" value="../flash/news_pic.swf"><param name="quality" value="high"><param name="bgcolor" value="FFFBF7">');
document.write('<param name="menu" value="false"><param name=wmode value="opaque">');
document.write('<param name="FlashVars" value="pics='+pics+'&links='+links+'&texts='+texts+'&borderwidth='+focus_width+'&borderheight='+focus_height+'&textheight='+text_height+'">');
document.write('<embed src="../flash/pic.swf" wmode="opaque" FlashVars="pics='+pics+'&links='+links+'&texts='+texts+'&borderwidth='+focus_width+'&borderheight='+focus_height+'&textheight='+text_height+'" menu="false" bgcolor="#ffeabb" quality="high" width="'+ focus_width +'" height="'+ swf_height +'" allowscriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');
document.write('</object>');
}
/*iframe自适应高度*/
var iframeids=["test"]
 var iframehide="yes"
 function dyniframesize() 
 {
  var dyniframe=new Array()
  for (i=0; i<iframeids.length; i++)
  {
   if (document.getElementById)
   {
    dyniframe[dyniframe.length] = document.getElementById(iframeids[i]);
    if (dyniframe[i] && !window.opera)
    {
     dyniframe[i].style.display="block"
     if (dyniframe[i].contentDocument && dyniframe[i].contentDocument.body.offsetHeight)
      dyniframe[i].height = dyniframe[i].contentDocument.body.offsetHeight; 
     else if (dyniframe[i].Document && dyniframe[i].Document.body.scrollHeight)
      dyniframe[i].height = dyniframe[i].Document.body.scrollHeight;
    }
   }
   if ((document.all || document.getElementById) && iframehide=="no")
   {
    var tempobj=document.all? document.all[iframeids[i]] : document.getElementById(iframeids[i])
    tempobj.style.display="block"
   }
  }
 }

 if (window.addEventListener)
 window.addEventListener("load", dyniframesize, false)
 else if (window.attachEvent)
 window.attachEvent("onload", dyniframesize)
 else
 window.onload=dyniframesize
/* log*/
function login(form)
{
	if(form.username.value==""){
	alert("请填写用户名称！");return false;
	}
	if(form.password.value==""){
	alert("请输入密码！"); 	return false;
	}
   fbl= screen.width + '@' + screen.height;
   form.fbl.value=fbl
   form.submit();
   return true;
}
