

//////////////////////////////////////////////////////////
//
//									Tab Function (ver.2)
//									@Update 2007.10.26
//
//////////////////////////////////////////////////////////



// ↓↓コンストラクター ___________________________________
/**
 * @param：Tab表示するブロックレベル要素のID一覧。配列形式。
 * @param：setIntervalの実行間隔(ミリ秒)。省略可。
 **/
function f_newTab(cntList,speed){
	this._cntList = cntList;
	
	if(speed != undefined) this._speed = speed;
	else this._speed = 80;
	
	this._disp = null;
	this._transparent = 0;
}


// ↓↓表示するElementを切り替える ________________________
/**
 * @param：表示するブロックレベル要素のID
 **/
f_newTab.prototype.f_change = function(disp){
	
	for(i=0; i<this._cntList.length; i++){
		
		// 表示しないブロックレベル要素
		if(this._cntList[i] != disp){
			document.getElementById(this._cntList[i]).style.display = 'none';
		}
		// 表示するブロックレベル要素
		else{
			this._disp = document.getElementById(disp);
			this._disp.style.display = 'block';
			this._disp.style.filter = 'alpha(opacity=0)';  	// IE
		  this._disp.style.mozOpacity = 0;								// FireFox
		  this._disp.style.opacity = 0;										// Safari
		}
	}
	
	this._transparent = 0;
	
	_scope = this;
	clearInterval(this.fadeTimer);
	this.fadeTimer = setInterval( "_scope.f_fadeIN();", this._speed);
};


// ↓↓フェードインスタート _______________________________
f_newTab.prototype.f_fadeIN = function(){
	this._transparent += 10;
	
	// フェードイン終了
	if(this._transparent >= 100) {
  	clearInterval(this.fadeTimer);
    this._transparent = 100;
  }
  
  // フェードイン開始
  this._disp.style.filter = 'alpha(opacity=' + this._transparent + ')';	// IE
  this._disp.style.mozOpacity = this._transparent/100;									// FireFox
  this._disp.style.opacity = this._transparent/100;											// Safari
};
