function SetCss(obj)
{
	var a = obj.parentNode.childNodes;
	for(var i=0; i<a.length; i++)
	{
		if (a[i].id!="TabRight")
		{
			a[i].className="";
		}
	}
   obj.className="current";
}

function framebutton()
{
	var obj = $('menuFrame');
	var frameswitch = $('frameswitch');
	var switchbar = $('switchbar');
	if(obj.style.display == 'none'){
		obj.style.display = '';
		switchbar.style.left = '179px';
		frameswitch.style.backgroundPosition = '0px';
	}else{
		obj.style.display = 'none';
		switchbar.style.left = '0px';
		frameswitch.style.backgroundPosition = '-11px';
	}
}

function switchMenu(i)
{	//alert(i);
	$("leftMenuSon"+i).style.display=$("leftMenuSon"+i).style.display=="none"?"":"none";
	iframeAutoFit();
}

function iframeAutoFit()
{
        try {
            if(window!=parent)
            {
                var a = parent.$("bodyframe");
                    if(a.contentWindow==window)
                    {
                        var h1=0, h2=0, d=document, dd=d.documentElement;
                        if(dd && dd.scrollHeight) h1=dd.scrollHeight;
                        if(d.body) h2=d.body.scrollHeight;
                        var h=Math.max(h1, h2);

                        if(document.all) {h += 4;}
                        if(window.opera) {h += 1;}
                        a.style.height =h +"px";
                        //alert(h);

                    }
            }
        }
        catch (ex){}
}
function _iframe_load()
{
	if(window.attachEvent)
	{
		window.attachEvent("onload",  iframeAutoFit);
		//window.attachEvent("onresize",  iframeAutoFit);
	}
	else if(window.addEventListener)
	{
		window.addEventListener('load',  iframeAutoFit,  false);
		//window.addEventListener('resize',  iframeAutoFit,  false);
	}
}
function wlib(){void(0);}

function login(){
	var url=$("bodyframe").contentWindow.getLocation();//+'?
	var weiba='mlog=1&k='+ Math.random();
	if(url.indexOf('?mlog=')>=0 || url.indexOf('&mlog=')>=0)return false;
	
	url+=(url.indexOf('?')>=0)?"&"+weiba:"?"+weiba;
	$("bodyframe").src = url;
	return false;
}
function login2(){
	var url=location.href;//+'?
	var weiba='mlog=1&k='+ Math.random();
	if(url.indexOf('?mlog=')>=0 || url.indexOf('&mlog=')>=0)
	{
		location.href = url;
		return false;
	}
	
	url+=(url.indexOf('?')>=0)?"&"+weiba:"?"+weiba;
	location.href = url;
	return false;
}
function ChangeLanguage(language)
{
	var url=$("bodyframe").contentWindow.getLocation();//+'?
	url='wlib.php?lang='+language+'&u='+escape(url)+'&k='+ Math.random();
	location.href=url;
	return false;
}
function getLocation(){
	return location.href;
}
function setLoginInfo(sign,info){
	$("userInfo").innerHTML=info;
}
function getPageSize() {
  var myWidth = 0, myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
  }
	return new Array(myWidth,myHeight);
}
function setFrameHeight(obj){
	var tmpArr=getPageSize();
	$(obj).style.height=(tmpArr[1]-$("head").offsetHeight-$("foot").offsetHeight)+"px";
	//alert($("headBg").offsetHeight+ $("foot").offsetHeight);
}
function TDOnmouseover(obj,url,realclss)
{	
		obj.className='Gray';
	/*obj.onclick=function(){
		location.href=url;
	}*/
	obj.onmouseout=function(){
		obj.className=realclss;
	}
}

function wlibswf(url)
{
	if(!(navigator.userAgent.indexOf('MSIE 6.')>=0))
	{
	document.write ('<OBJECT codeBase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7" type=application/x-shockwave-flash height=165 width=165 classid=clsid:D27CDB6E-AE6D-11cf-96B8-444553540000><PARAM NAME="_cx" VALUE="15478"><PARAM NAME="_cy" VALUE="1323"><PARAM NAME="FlashVars" VALUE=""><PARAM NAME="Movie" VALUE="http://d1.sina.com.cn/200807/31/146692_jhcjxtl731.swf"><PARAM NAME="Src" VALUE="'+url+'"><PARAM NAME="WMode" VALUE="Opaque"><PARAM NAME="Play" VALUE="-1"><PARAM NAME="Loop" VALUE="-1"><PARAM NAME="Quality" VALUE="High"><PARAM NAME="SAlign" VALUE=""><PARAM NAME="Menu" VALUE="-1"><PARAM NAME="Base" VALUE=""><PARAM NAME="AllowScriptAccess" VALUE=""><PARAM NAME="Scale" VALUE="ShowAll"><PARAM NAME="DeviceFont" VALUE="0"><PARAM NAME="EmbedMovie" VALUE="0"><PARAM NAME="BGColor" VALUE=""><PARAM NAME="SWRemote" VALUE=""><PARAM NAME="MovieData" VALUE=""><PARAM NAME="SeamlessTabbing" VALUE="1"><PARAM NAME="Profile" VALUE="0"><PARAM NAME="ProfileAddress" VALUE=""><PARAM NAME="ProfilePort" VALUE="0"><PARAM NAME="AllowNetworking" VALUE="all"><PARAM NAME="AllowFullScreen" VALUE="false"><embed width="165" height="165" src="'+url+'" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" wmode="opaque" ></embed></OBJECT>')
	}else{
	document.write ('<OBJECT codeBase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7" type=application/x-shockwave-flash height=165 width=165 classid=clsid:D27CDB6E-AE6D-11cf-96B8-444553540000><PARAM NAME="_cx" VALUE="15478"><PARAM NAME="_cy" VALUE="1323"><PARAM NAME="FlashVars" VALUE=""><PARAM NAME="Movie" VALUE="http://d1.sina.com.cn/200807/31/146692_jhcjxtl731.swf"><PARAM NAME="Src" VALUE="'+url+'"><PARAM NAME="WMode" VALUE="Opaque"><PARAM NAME="Play" VALUE="-1"><PARAM NAME="Loop" VALUE="-1"><PARAM NAME="Quality" VALUE="High"><PARAM NAME="SAlign" VALUE=""><PARAM NAME="Menu" VALUE="-1"><PARAM NAME="Base" VALUE=""><PARAM NAME="AllowScriptAccess" VALUE=""><PARAM NAME="Scale" VALUE="ShowAll"><PARAM NAME="DeviceFont" VALUE="0"><PARAM NAME="EmbedMovie" VALUE="0"><PARAM NAME="BGColor" VALUE=""><PARAM NAME="SWRemote" VALUE=""><PARAM NAME="MovieData" VALUE=""><PARAM NAME="SeamlessTabbing" VALUE="1"><PARAM NAME="Profile" VALUE="0"><PARAM NAME="ProfileAddress" VALUE=""><PARAM NAME="ProfilePort" VALUE="0"><PARAM NAME="AllowNetworking" VALUE="all"><PARAM NAME="AllowFullScreen" VALUE="false"><embed width="165" height="165" src="'+url+'" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" wmode="opaque" ></embed></OBJECT>')
	}
}

function GetWindowWidth() //函数：获取尺寸   
{   
	var winWidth=0;
	//获取窗口宽度   
	if (window.innerWidth)   
		winWidth = window.innerWidth;   
	else if ((document.body) && (document.body.clientWidth))   
		winWidth = document.body.clientWidth;   
		
	//通过深入Document内部对body进行检测，获取窗口大小
	if (document.documentElement  && document.documentElement.clientWidth)
	{
		//winHeight = document.documentElement.clientHeight;
		winWidth = document.documentElement.clientWidth;
	} 
	return winWidth;
}
function GetWindowHeight() //函数：获取尺寸   
{   
	var winHeight=0;
	
	//获取窗口高度   
	if (window.innerHeight) 
		winHeight = window.innerHeight;
	else if ((document.body) && (document.body.clientHeight))
		winHeight = document.body.clientHeight;
	
	//通过深入Document内部对body进行检测，获取窗口大小
	if (document.documentElement  && document.documentElement.clientHeight )
	{
		winHeight = document.documentElement.clientHeight;
	} 
	return winHeight;
}
function displayImg(inputObj)
{

     var calenderObj = document.createElement("div");
     calenderObj.innerHTML = "<img src='"+inputObj.href+"'>";
     calenderObj.style.position = "absolute";
     calenderObj.targetObj = inputObj;
     inputObj.parentNode.insertBefore(calenderObj,inputObj.nextSibling);

		calenderObj.style.top= (getTop(inputObj)- calenderObj.offsetHeight)+"px";

	// iframeAutoFit_main();

	inputObj.onmouseout=function(){
				 calenderObj.style.display="none";
			}

}
function BreakWord(id)
{
	var html=document.getElementById(id).innerHTML;
	var c='';
	var p=0;
	var mp=0;
	var i=0;
	var get=false;
	while(i<html.length)
	{
		if(p>64)
		{
			c=c+'-';
			p=0;
		}
		switch(html.substr(i,1))
		{
		case '&':
			mp=0;get=false;
			while(i+mp<html.length && mp<10)
			{
				if(html.substr(i+mp,1)==';')
				{
					p++;
					c=c+html.substr(i,mp+1);
					i=i+mp+1;
					get=true;
					break;
				}
				mp++;
			}
			if(!get)
			{
				c=c+html.substr(i,1);
				p++;
				i++;
			}
			break;
		case '\\':
			if(i<html.length-1)
			{
				c=c+html.substr(i,2);
				i=i+2;
				p++;
			}
			break;
		case '<':			
			if(i<html.length-1)
			{
				next=html.substr(i+1,1);
				if(next>='A' && next<='Z' || next>='a' && next<='z' || next=='/')
				{
					mp=1;get=false;
					while(i+mp<html.length)
					{
						if(html.substr(i+mp,1)=='>')
						{
							c=c+html.substr(i,mp+1);
							i=i+mp+1;
							get=true;
							break;
						}
						mp++;
					}
					if(!get)
					{
						c=c+'<';p++;i++;
					}
				}else{
					c=c+'<';p++;i++;
				}
			}else{
				c=c+'<';p++;i++;
			}
			break;
		default:
			if(html.substr(i,1)>='a' && html.substr(i,1)<='z' || html.substr(i,1)>='A' && html.substr(i,1)<='Z' || html.substr(i,1)=='.' || html.substr(i,1)=='_' || html.substr(i,1)>='0' && html.substr(i,1)<='9' || html.substr(i,1)=='&')
			{
				p++;
				c=c+html.substr(i,1);
			}else if(html.substr(i,1)=='\\'){c=c+html.substr(i,1)+' ';p=0;}
			else{ p=0;c=c+html.substr(i,1);}		
			i++;
		}
	}
	//alert(c);
	document.getElementById(id).innerHTML= c;
}
