function ServerTypeTabs(serverType) {
	this.serverType = serverType;
	YAHOO.ext.EventManager.onDocumentReady(this.initialize, this, true);
}

ServerTypeTabs.prototype = {
	
	tabs : null,
	
	serverType : null,
	
	allLink : null,
	
	toaLink : null,
	
	classicLink : null,
	
	pvpLink : null,
	
	coopLink : null,
	
	initialize : function() {
		this.tabs = new YAHOO.ext.TabPanel('templatesContainer');
		this.tabs.addTab('allTab', "All");
		this.tabs.addTab('toaTab', "ToA");
		this.tabs.addTab('classicTab', "Classic");
		this.tabs.addTab('pvpTab', "PvP");
		this.tabs.addTab('coopTab', "Coop");
		this.setActiveTab();
		this.setTabLinks();
	},
	
	setTabLinks : function() {
		this.tabs.getTab('allTab').addListener('activate', this.processLink, this, true);
		this.tabs.getTab('toaTab').addListener('activate', this.processLink, this, true);
		this.tabs.getTab('classicTab').addListener('activate', this.processLink, this, true);
		this.tabs.getTab('pvpTab').addListener('activate', this.processLink, this, true);
		this.tabs.getTab('coopTab').addListener('activate', this.processLink, this, true);
	},
	
	setActiveTab : function() {
		if(this.serverType == 0) {
			this.tabs.activate('allTab');
		}else if(this.serverType == 1) {
			this.tabs.activate('toaTab');
		}else if(this.serverType == 2) {
			this.tabs.activate('classicTab');
		}else if(this.serverType == 3) {
			this.tabs.activate('pvpTab');
		}else if(this.serverType == 4) {
			this.tabs.activate('coopTab');
		}
		this.tabs.getActiveTab().setContent(document.getElementById('templatesTab').innerHTML);
	},
	
	processLink : function() {
		this.tabs.getActiveTab().setContent(document.getElementById('templatesTab').innerHTML);
		if(this.tabs.getActiveTab().id == 'allTab') {
			document.location = this.allLink;
		}
		if(this.tabs.getActiveTab().id == 'toaTab') {
			document.location = this.toaLink;
		}
		if(this.tabs.getActiveTab().id == 'classicTab') {
			document.location = this.classicLink;
		}
		if(this.tabs.getActiveTab().id == 'pvpTab') {
			document.location = this.pvpLink;
		}
		if(this.tabs.getActiveTab().id == 'coopTab') {
			document.location = this.coopLink;
		}
	}
}