﻿// JavaScript Document

var menu=window.location.href.split("=")[1];
if(menu!=null&&menu!="")
 getmenu(menu);
function getmenu(menu)
{ 


	for( i=1;i<30;i++)
	{
		 if(document.getElementById("menu"+i)!=null)
		{
			for(j=1;j<20;j++)
			 {
			 if(document.getElementById("menu"+i+"_"+j)==null)
			 continue;
				 	if(document.getElementById("menu"+i+"_"+j).innerHTML.indexOf(menu)>0)
				{
					document.getElementById(menu+'_td').style.background="url(../images/menu_2.gif)";
                     document.getElementById(menu+'_td'+"_span").style.color="#ffc04e";
					for(var k=1;;k++)
					{
					if(document.getElementById('menu'+i+"_"+k)==null)
					break;
					document.getElementById('menu'+i+"_"+k).style.display="block";
					}
								break;
				}
				 else
				{ 
				}
			}
		}
	}

}
function clearcookie()
{
  parent.document.cookie="curentpage=nopage";
}
function refreshpage()
{
if(screen.width==1024)
{
    window.document.body.style.width = 1004;
}
else if(screen.width==1280)
{
     window.document.body.style.width = 1255;
}
else if(screen.width >= 1440) 
{
    window.document.body.style.width = 1420;
}
else 
{
    window.document.body.style.width = 780;
}
if(document.getElementById("iframe")==null) return;
var keyvalue=GetCookie("curentpage");
    if(keyvalue!=null&&keyvalue!=""&&keyvalue.substring(0,4)=="menu")
    {
   
     if(document.getElementById(keyvalue)!=null)
     {
		 src=document.getElementById(keyvalue).firstChild.href;
		if(src.substring(0,4)=="http")
          {
			document.getElementById("iframe").src=src;
			lefttree(keyvalue.split('_')[0]);
			 change(keyvalue)
			}
      }
    }
    else
    document.getElementById("iframe").src="yw/index/index.html";
}
function refreshpagesy()
{
if(screen.width==1024)
{
    window.document.body.style.width = 1004;
}
else if(screen.width==1280)
{
     window.document.body.style.width = 1255;
}
else if(screen.width >= 1440) 
{
    window.document.body.style.width = 1420;
}
else 
{
    window.document.body.style.width = 780;
}
 document.getElementById("iframe").src="yw/index/index.html";
}
String.prototype.Trim=function()
{
	return this.replace(/^\s+/g,"").replace(/^s+$/g,"");
}
function GetCookie(key)
{
		var cookie=document.cookie;
		var cookieArray=cookie.split(';');
		var getvalue="";
		for(var i=0;i<cookieArray.length;i++)
		{
			if(cookieArray[i].substr(0,key.length)==key)
			{
				getvalue=cookieArray[i].Trim().substr(key.length+1);
				break;
			}
		}
	return getvalue;
}


   
   
function change(obj)
{
for(var i=1;i<20;i++)
{
if(document.getElementById("menu"+i+"_"+1+"_td")==null)
continue;
for(var j=1;;j++)
{
if(document.getElementById("menu"+i+"_"+j+"_td")==null)
break;
document.getElementById("menu"+i+"_"+j+"_td").style.background="url(../images/menu_3.gif)";
document.getElementById("menu"+i+"_"+j+"_td_span").style.color="#000000";
}
}
document.getElementById(obj).style.background="url(../images/menu_2.gif)";
document.getElementById(obj+"_span").style.color="#ffc04e";
   document.cookie="curentpage="+obj;
}

function reinitIframe(){

var iframe = document.getElementById("iframe");

try{

var bHeight = iframe.contentWindow.document.body.scrollHeight;

var dHeight = iframe.contentWindow.document.documentElement.scrollHeight;

var height = Math.max(bHeight, dHeight);

iframe.height =  height;

}catch (ex){}
}

window.setInterval("reinitIframe()", 5500);
function lefttree(menu)
{
for(var i=1;i<20;i++)
{
if(document.getElementById("menu"+i+"_"+1)==null)
continue;
if("menu"+i!=menu)
{
for(var j=1;;j++)
{
if(document.getElementById("menu"+i+"_"+j)==null)
break;
document.getElementById("menu"+i+"_"+j).style.display="none"
}
}
}
for(var s=1;s<30;s++)
{
if(document.getElementById("menu"+s)==null)
continue;
document.getElementById("menu"+s).style.color="#000000";
}
for(var k=1;k<30;k++)
{
if(document.getElementById(menu+"_"+k)==null)
continue;
if(document.getElementById(menu+"_"+k).style.display=="block")
{document.getElementById(menu+"_"+k).style.display="none";}
else
{document.getElementById(menu+"_"+k).style.display="block";
 document.getElementById(menu).style.color="#ffc04e";
}
}
}
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}