// tab_new
function $_(id)
{
	return document.getElementById(id);
}

var waitInterval;
var MDelayTime=140;

function tab_over(num){
clearTimeout(waitInterval);
waitInterval=window.setTimeout("pp_over("+num+");",MDelayTime);
}

var tmpID = 0;
var tmpArr = new Array(0,1,2,3,4,5,6,7,8,9);
function pp_over(num)
{
	clearTimeout(waitInterval);
	var old_show_ID = 't_on_' + tmpID;
	var old_hidden_ID = 't_over_' + tmpID;
	old_show_ID = $_(old_show_ID);
	old_hidden_ID = $_(old_hidden_ID);

	var new_show_ID = 't_on_' + num;
	var new_hidden_ID = 't_over_' + num;
	new_show_ID = $_(new_show_ID);
	new_hidden_ID = $_(new_hidden_ID);
	
	old_show_ID.style.display = 'none';
	old_hidden_ID.style.display = 'block';
	
	new_show_ID.style.display = 'block';
	new_hidden_ID.style.display = 'none';

	tmpID = num;
}

// focus
var _t1 = 2; //打开页面时等待图片载入的时间，单位为秒，可以设置为0
var _t2 = 5; //图片轮转的间隔时间
var _tnum = 5; //焦点图个数
var _tn = 1;//当前焦点
var _tm = 1;
_tt1 = setTimeout('change_img()',_t1*1000);
function stopmove()
{
  clearTimeout(_tt1);
}
function startmove()
{
_tt1 = setTimeout('change_img()',_t2*1000);
}
function change_img(){
setFocus(_tn);
_tt1 = setTimeout('change_img()',_t2*1000);
}
function setFocus(i){
if(i>_tnum){_tn=1;i=1;}
if ( _tm && $_('focusPic'+_tm) ) {
	$_('focusPic'+_tm).style.display='none';
}
else {
    if($_('focusPic'+_tm)){
	   $_('focusPic'+_tm).style.display='';
    }
}
//_tm ? $_('focusPic'+_tm).style.display='none' : '' ;

if($_('focusPic'+i)){
$_('focusPic'+i).style.display='block';
}
_tm=i;
_tn++;
}



// tab_con
function setTab(name,cursel,n){
waitInterval=window.setTimeout("setTab1('"+name+"',"+cursel+","+n+");",160);
}

function setTab1(name,cursel,n){
 for(i=1;i<=n;i++){
  var menu=document.getElementById(name+i);
  var con=document.getElementById("con_"+name+"_"+i);
  menu.className=i==cursel?"on":"";
  con.style.display=i==cursel?"block":"none";
 }
}

// addBookmark
function addBookmarkForBrowser(sTitle, sUrl)
{

    if (window.sidebar && window.sidebar.addPanel) {
        addBookmarkForBrowser = function(sTitle, sUrl) {
            window.sidebar.addPanel(sTitle, sUrl, "");
        }
    } else if (window.external) {
        addBookmarkForBrowser = function(sTitle, sUrl) {
            window.external.AddFavorite(sUrl, sTitle);
        }
    } else {
        addBookmarkForBrowser = function() {
            alert("do it yourself");
        }
    }

    return addBookmarkForBrowser(sTitle, sUrl);
}
