(function(namespace){
	if(typeof(window[namespace]) == 'undefined'){
		window[namespace] = {};
	}
	var tab = Class.create();
	tab.prototype = {
		initialize:function(tabId, contentId, defaultIndex)
		{
			/*
			this.tabId = tab;
			this.contentId = contentId;
			*/
			if(!tabId || !contentId) return;
			this.original = defaultIndex || 0;
			this.tabArr = $$('#'+tabId+' div[class^="tab"]') || [];
			this.contentArr = $$('#'+contentId+' [class^="content"]') || [];
			//alert(this.contentArr);
			this.initEvent();
		},
		initEvent:function()
		{
			var len = this.tabArr.length, i= 0 ;
			for(i; i<len; i++){
				this.tabArr[i].observe('mouseover', this.showTab.bind(this, i));
			}
		},
		showTab:function(i)
		{
			if(this.original == i) return;
			if(this.tabArr[i] == undefined || this.contentArr[i] == undefined) return;
			
			this.tabArr[this.original].removeClassName('on');
			this.contentArr[this.original].hide();
			this.tabArr[i].addClassName('on');
			this.contentArr[i].show();
			this.original = i;
		}
	};
	window[namespace]['tab'] = tab;
})('ITLONG');
