// ts:TabSwitch for switch the tabs
var TabSwitch = Class.create();
TabSwitch.prototype = {
	initialize: function ( controler_id, content_id ) {
		this.controler = controler_id;
		this.content = content_id;
	},
	select: function ( id ) {
		if ( $(this.controler) && $(this.content) ) {
			controlers = $(this.controler).getElementsByTagName('li');
			for (i=0; i<controlers.length; i++) {
				if (controlers[i].id == this.controler+'_'+id) {
					Element.addClassName(controlers[i], 'on');
				} else {
					Element.removeClassName(controlers[i], 'on');
				}
			}
			contents = $(this.content).getElementsByTagName('div');
			for (i=0; i<contents.length; i++) {
				if (contents[i].id.indexOf(this.content+'_')!=0) {
					continue;
				}
				if (contents[i].id == this.content+'_'+id) {
					Element.show(contents[i]);
				} else {
					Element.hide(contents[i]);
				}
			}
			//f;
		}
	}
}

