// <![CDATA[

var swich = {
	init: function(){
		var swichs = this.setup.swichs;
		var pages = this.setup.pages;
		
		for(i=0; i<pages.length; i++) {
			if(i !== 0) pages[i].style.display = 'none';
			swichs[i].onclick = function(){ swich.showpage(this); return false; };
		}
		this.dive();
	},
	
	showpage: function(obj){
		var swichs = this.setup.swichs;
		var pages = this.setup.pages;
		var num;
		
		for(num=0; num<swichs.length; num++) {
			if(swichs[num] === obj) break;
		}
		
		for(var i=0; i<pages.length; i++) {
			if(i == num) {
				pages[num].style.display = 'block';
				swichs[num].className = 'active';
			}
			else{
				pages[i].style.display = 'none';
				swichs[i].className = null;
			}
		}
	},

	dive: function(){
		var hash = window.location.hash;
		hash = hash.split("?");
		hash = hash[0].split("#");

		var swichs = this.setup.swichs;
		var pages = this.setup.pages;
		for(i=0; i<pages.length; i++) {
			if(pages[i] == document.getElementById(hash[1])) this.showpage(swichs[i]);
		}
	}
}

// ]]>
