﻿
function switchtab(str){
    if(str=="sub1"){                
        document.getElementById("sub2").style.display="none"
        document.getElementById("sub1").style.display="block"; 
        document.getElementById("b1").style.backgroundPosition="-27px -163px";
        document.getElementById("b2").style.backgroundPosition="-27px -82px";
    }
    if(str=="sub2"){
        document.getElementById("sub1").style.display="none";
        document.getElementById("sub2").style.display="block"; 
        document.getElementById("b1").style.backgroundPosition="-27px -136px";
        document.getElementById("b2").style.backgroundPosition="-27px  -109px";
                       
    }
}



/*****************************
同步学习页面JS控制代码(放在html头部部分)

Version: Ver 1.00
Passed : XHtml 1.0, CSS 2.0, IE5.0+, FF2.0+, IE6.0 IE7.0 Opera8.5+
*****************************/

/*放大缩小功能*/
function zoom(show)
{
   var rightbar=document.getElementById('rightbar');
   var btn_con=document.getElementById('btn_con');
   var exe_head=document.getElementById('exe_head');   
   var big=document.getElementById('big');
   var small=document.getElementById('small');
   var player=document.getElementById('player');
   var iframe=document.getElementById('Iframe1');
   var bodybg=document.getElementById('context');
   var contextbox=document.getElementById('contextbox');
   var bgimg1=document.getElementById('sidebar');
   var bgimg2=document.getElementById('lefttop');
   var bgimg3=document.getElementById('righttop');
   var wrapper=document.getElementById('wrapper');
   var flashID=document.getElementById('Iframe1').contentWindow.document.body;
   var flashbox=document.getElementById('flashbox');
   var path=document.getElementById('path');
   var flashContent = document.getElementById('Iframe1').contentWindow.document.getElementById('flashID');
   var flashdiv=document.getElementById('flashdiv');

   if (show == "1") {
       
        document.getElementById('nextPreNode2').style.display="block";
        document.getElementById('pervNode2').style.display="block";
        document.getElementById('nextNode2').style.display="block";
        document.getElementById('nextParentNode2').style.display="block";
        
        document.getElementById('nextPreNode1').style.display="none";
        document.getElementById('pervNode1').style.display="none";
        document.getElementById('nextNode1').style.display="none";
        document.getElementById('nextParentNode1').style.display="none";
        //document.getElementById('foot').style.display="none";
        document.getElementById('botoom_cor').style.display="none";
        
        bodybg.style.width="797px";//整个容器
        rightbar.style.width="800px";
        btn_con.style.width="800px";
        wrapper.style.width="797px";
        wrapper.style.paddingRight="0px";/*左边距*/
        wrapper.style.paddingLeft="0px";/*左边距*/
        
        
        contextbox.style.marginLeft="0px";/*左边距*/
        contextbox.style.marginRight="0px";/*左边距*/
        contextbox.style.paddingRight="0px";/*左边距*/
        contextbox.style.marginTop="0px";/*上边距*/
        
        
        document.getElementById('rightbar').style.marginLeft="0px";/*右侧边距*/
        document.getElementById('rightbar').style.marginRight="0px";/*左侧边距*/
        
        
        bodybg.style.paddingTop="0px";/*上内距*/
        player.style.left="0px";
        exe_head.style.display="none";       
        bgimg1.style.display="none";  
        bgimg2.style.display="none";  
        bgimg3.style.display="none";  
        //bgimg4.style.display="none"; 
        bodybg.style.border="0"; 
        bodybg.style.backgroundPosition="left -111px"; 
        //sidebar.style.display="none";
        player.style.width="800px";
        btn_con.style.width="800px";  
        flashdiv.style.width="797px"; /*影响右边框线*/ 
        flashdiv.style.height="600px";  
        flashbox.style.width="797px"; /*影响右边框线*/  
        flashbox.style.height="600px"; 
        iframe.style.width="100%";  
        iframe.style.height="100%";
        big.style.display="none";
        small.style.display="block"; 
        if((flashContent != null) || flashContent != undefined)
        {
          //调整flash的宽高
          flashContent.width = 800;
          flashContent.height = 600;
        }
    }
   else {
        document.getElementById('nextPreNode1').style.display="block";
        document.getElementById('pervNode1').style.display="block";
        document.getElementById('nextNode1').style.display="block";
        document.getElementById('nextParentNode1').style.display="block";
        
        document.getElementById('nextPreNode2').style.display="none";
        document.getElementById('pervNode2').style.display="none";
        document.getElementById('nextNode2').style.display="none";
        document.getElementById('nextParentNode2').style.display="none";
        //document.getElementById('foot').style.display="block";
        document.getElementById('botoom_cor').style.display="block";
        
        /*恢复容器的样式设置*/
        bodybg.style.width="930px";//整个容器
        rightbar.style.width="640px";
        btn_con.style.width="480px";
        wrapper.style.width="930px";
        contextbox.style.marginLeft="27px";
        contextbox.style.marginTop="30px";/*左边距*/
        document.getElementById('rightbar').style.marginLeft="-3px";       
                
        bodybg.style.paddingTop="27px";/*上内距*/  
        bodybg.style.borderStyle="solid";
        bodybg.style.borderColor="#d7d7d7";
        bodybg.style.borderWidth="1px";
        bodybg.style.backgroundPosition="left -209px";
	    bodybg.style.borderBottom="none";	    
        player.style.left="10px";
        exe_head.style.display="block";
        exe_head.style.width="640px"; 
        bgimg1.style.display="block";  
        bgimg2.style.display="block";  
        bgimg3.style.display="block";
          
        //bgimg4.style.display="block";                 
        //sidebar.style.display="block";
        
        player.style.width="640px";  
        btn_con.style.width="640px";  
        flashdiv.style.width="637px";  
        flashdiv.style.height="480px";  
        flashbox.style.width="637px";  
        flashbox.style.height="480px"; 
        iframe.style.width="100%";  
        iframe.style.height="100%";
        big.style.display="block";
        small.style.display="none"; 
        if((flashContent != null) || flashContent != undefined)
        {
          //调整flash的宽高
          flashContent.width = 640;
          flashContent.height = 480;
        }
    }
}     

function ZoomWidth()
{

    var width=document.getElementById('flashdiv').style.width; 
    var height=document.getElementById('flashdiv').style.height;
    
    var flashContent = document.getElementById('Iframe1').contentWindow.document.getElementById('flashID');
    flashContent.width = width;
    flashContent.height = height; 
    
}
  


/*三态高亮菜单*/
// 作者:宾勇
// 时间:2008-12-21
// 作用:此脚本用于设置三态导航菜单的高亮显示.
// 原理:与平时实现三态按钮不同,一般的三态菜单用A标签的HOVER伪类就可以轻松实现,但是是不能记录当前选中菜单项高亮的.而这个脚本是用ONMOUSEOUT,ONMOUSEOVER来
//      来代替A标签的翻滚状态.并可以记录选中项菜单亮的.
// 使用说明:本功能是针对每一个菜单项的图片都不相同的情况,如果图片背景不复杂,如都只用一张图片,则实现起来相对容易得多.本功能是在页面一加载时就自动遍历菜单
//      下的所有A标签,并将它加上三种方法,这样做的好处是HTML页面结构分离干净.要注意,如果以后要在一个页面中加载很多个js功能,将可以将window.onload封装在事件中, 
//      一起调用.

function getObj(objName){return(document.getElementById(objName));}

//全局变量,菜单数量和当前选中菜单的序号
var number;/*菜单数量*/
var curid=0;/*记录前一个高亮菜单的ID,默认设为0*/

window.onload =function() {
	var obj=document.getElementById("menu");/*ul的id*/
	var obj_a=obj.getElementsByTagName("a");
	number=obj_a.length;
	for (var i=0,j=obj_a.length;i<j;i++){
		obj_a[i].index=i;
		obj_a[i].onclick=function(){click(this)};
		obj_a[i].onmouseover=function(){overme(this)};
		obj_a[i].onmouseout=function(){outme(this)};
	}
	/*lightmenu("1");默认高亮第一个菜单项*/
	
	
}
//鼠标滑过效果
function overme(obj){
    var menuId=obj.id;
    var menuIndex=menuId.split('_')[1];
    if(curid!=obj.index){      
       obj.className="cur"+menuIndex;/*翻滚色样式*/         
    } 
    else{//首页的加上翻滚
        if(obj.index==0){
            obj.className="cur"+menuIndex;/*翻滚色样式*/
        } 
    }  
}
//鼠标移开后效果
function outme(obj){
    var menuId=obj.id;
    var menuIndex=menuId.split('_')[1];
    if(curid!=obj.index){
        obj.className="normal"+menuIndex;/*翻滚色样式*/    
    }
    else{
        if(obj.index!=0){
            obj.className="cur"+menuIndex;/*当前选中样式*/
        }
        else{
            obj.className="normal"+menuIndex;/*当前选中样式*/
        }
    }
}
//鼠标点击效果
function click(obj){
    var menuId=obj.id;
    var menuIndex=menuId.split('_')[1]; 
    document.getElementById("sub_"+(curid+1)).className="normal"+(curid+1);/*去掉上次点击的选中菜单状态*/
    obj.className="cur"+(obj.index+1);/*当前选中样式*/
    curid=menuIndex-1; /*记录当前点击的状态*/
}
//首次高亮菜单
function lightmenu(id){
    document.getElementById("sub_"+id).className="cur"+id;/*当前选中样式*/
}

/*长字符串在FF下断行*/
function toBreakWord(intLen, id){ 
  var obj=document.getElementById(id);  
  var strContent=obj.innerHTML;  
  var strTemp="";  
  while(strContent.length>intLen){  
  strTemp+=strContent.substr(0,intLen)+"<br>";  
  strContent=strContent.substr(intLen,strContent.length);  
  }  
  strTemp+= strContent;  
  obj.innerHTML=strTemp; 
}


