/**************************
*Use for:	union page
*Version:	1.01
*Date:		2010/07/15
*Author:		anli 
 ********************/
//Display or hide div  不包含样式变化 
function OppWin(targetid){
	 var target = document.getElementById(targetid);    
     if (target.style.display == "block" || target.style.display == ""  ) {
         target.style.display = "none";
     }else if  (target.style.display == "none" ) {
         target.style.display = "";
     }     
}

//Display div  
function OppDiv(targetid){
	 var target = document.getElementById(targetid);    
     target.style.display = ""; 
}

//Display or hide div  包含样式变化
function showDiv(clickid, targetid,targetid_cssoff, targetid_csson){	
     var obj = document.getElementById(targetid);
	 var clickobj = document.getElementById(clickid);
     if (obj.style.display == "block" || obj.style.display == "" ) {
         obj.style.display = "none";
		 clickobj.className = targetid_cssoff;
		 
     }else if  (obj.style.display == "none" ) {
         obj.style.display = "block";	
		 clickobj.className = targetid_csson;	 
     }     
}



//Tab : 1.0.0(2009-03-02| S.S.L) modify by anli
function ue_tab( tab_menu,tab_main,cur_tab,mouse,time ){
	var pre_no;
	var timer,autoplay_timer;
	var tab;
	
	function $( id ){ return document.getElementById( id );}
	
	function run( no ){
		if( no != null ){
			if( timer != null )clearInterval( timer );
			timer = setInterval( function(){
				doChange(no);
			},200 );
		}
	}
	
	function addEvent(){
		for( var i = 0; i < tab.length; i++ ){
			tab[i].cur_no = i;
			if( mouse == null ){
				tab[i].onclick = function(){ 
					run( this.cur_no );
					return false;
				}
			} else {
				tab[i].onmouseover = tab[i].onmouseout= function(){
					run( this.cur_no );
					return false;
				}
			}
		}
	}
	
	function doChange( k ){
		if( tab[pre_no] != null && $(tab_main+(pre_no+1)) != null ){
			tab[pre_no].className = "off";
			$(tab_main+(pre_no+1)).style.display = "none";
		}
		
		if( tab[k] != null && $(tab_main+(k+1)) != null ){
			tab[k].className = "on";
			$(tab_main+(k+1)).style.display = "";
		}
		
		pre_no = k;
		
		if( timer != null )clearInterval( timer );
	}
	
	function autoplay(){
		if( pre_no < tab.length ){
			doChange( pre_no+1 );
		} else {
			pre_no = tab.length-1;
			doChange( 0 );
		}
	}
	
	function init(){
		if( tab_menu == null || tab_main == null ) return;
		
		var tabs = tab_menu.split(" ");
		
		if( tabs[0] == null || tabs[1] == null || $( tabs[0] ) == null ) return;
		
		tab = $( tabs[0] ).getElementsByTagName( tabs[1] );

		pre_no = ( cur_tab == null ) ? 0:(cur_tab-1);
		
		doChange( pre_no );
		addEvent();
		
		if( time != null && time > 0 )
			autoplay_timer = setInterval( autoplay,time );
	}
	
	init();

}





