﻿// Design by wuyonghui QQ:481074
// search input
var dwsSearch = {
	hoverBtn	: function(o,s){
		dwsElement.addClassName(o,s);
		o.onmouseout = function(){
			dwsElement.delClassName(this,s);
		}
	},
	doInput	: function(o){
		if (o.value==o.defaultValue) {
			o.value="";
		}
		o.onblur = function(){
			o.value==""?o.value=o.defaultValue:"";
		}
	}
}
//tab
var aNum=1;
var aTemp=1;
function menu1(aNum){
	document.getElementById('a_menu_'+aTemp).className='menuoff';
	document.getElementById('a_con_'+aTemp).style.display='none';
	document.getElementById('a_com_'+aTemp).style.display='none';
	document.getElementById('a_menu_'+aNum).className='menuon';
	document.getElementById('a_con_'+aNum).style.display='block';
	document.getElementById('a_com_'+aNum).style.display='block';
	aTemp=aNum;
}
var bNum=1;
var bTemp=1;
function menu2(bNum){
	document.getElementById('b_menu_'+bTemp).className='menuoff';
	document.getElementById('b_con_'+bTemp).style.display='none';
	document.getElementById('b_menu_'+bNum).className='menuon';
	document.getElementById('b_con_'+bNum).style.display='block';
	bTemp=bNum;
}
var cNum=1;
var cTemp=1;
function menu3(cNum){
	document.getElementById('c_menu_'+cTemp).className='menuoff';
	document.getElementById('c_con_'+cTemp).style.display='none';
	document.getElementById('c_menu_'+cNum).className='menuon';
	document.getElementById('c_con_'+cNum).style.display='block';
	cTemp=cNum;
}
//
var tab = {
	speet: 1,
	initInt: null,
	min: 5,   // 速度  单位:秒
	$: function( e ) {
		if( typeof e == "object" ) {
			return e;
		}
		return document.getElementById( e );
	},
	init: function() {
		tab.initInt = setInterval( function() {
			tab.roll();
			if( tab.speet > 2 ) {
				tab.speet = 1;
				return;
			}else {
				tab.speet ++;
			}
		} , 1000 * tab.min );
		return tab.initInt;
	},
	tit: function( speet , cl ) {
		tab.$( "wu_news_tit_" + speet ).className = cl;
	},
	body: function( speet , di ) {
		di = di || "none";
		tab.$( "wu_news_body_" + speet ).style.display = di;
	},
	roll: function( speet ) {
		speet = speet || tab.speet;
		speet = speet > 3 ? 3 : speet;

		switch( speet ) {
			case 1:
				tab.tit( 1 , "titaon" );
				tab.tit( 2 , "titboff" );
				tab.tit( 3 , "titcoff" );
				tab.tit( 4 , "titabutton" );
				tab.body( 1 , "block" );
				tab.body( 2 );
				tab.body( 3 );
				break;
			case 2:
				tab.tit( 1 , "titaoff" );
				tab.tit( 2 , "titbon" );
				tab.tit( 3 , "titcoff" );
				tab.tit( 4 , "titbbutton" );
				tab.body( 1 );
				tab.body( 2 , "block" );
				tab.body( 3 );
				break;
			case 3:
				tab.tit( 1 , "titaoff" );
				tab.tit( 2 , "titboff" );
				tab.tit( 3 , "titcon" );
				tab.tit( 4 , "titcbutton" );
				tab.body( 1 );
				tab.body( 2 );
				tab.body( 3 , "block" );
				break;
		}

		if( tab.speet != speet ) {
			tab.speet = speet;
		}
	},
	prve: function() {
		tab.speet = tab.speet > 1 ? tab.speet - 1 : 3;
		clearInterval( tab.initInt );
		tab.roll( tab.speet );
		tab.initInt = tab.init();
	},
	next: function() {
		tab.speet = tab.speet > 2 ? 1 : tab.speet + 1;
		clearInterval( tab.initInt );
		tab.roll( tab.speet );
		tab.initInt = tab.init();
	}
};
//tab.init();

