var tab = {
	init: function(){
		var tabs = this.setup.tabs;
		var pages = this.setup.pages;
		
		for(i=0; i<pages.length; i++) {
			if(i !== 0) pages[i].style.display = 'none';
			tabs[i].onclick = function(){ tab.showpage(this); return false; };
		}
		this.dive();
	},
	
	showpage: function(obj){
		var tabs = this.setup.tabs;
		var pages = this.setup.pages;
		var num;
		
		for(num=0; num<tabs.length; num++) {
			if(tabs[num] === obj) break;
		}
		
		for(var i=0; i<pages.length; i++) {
			if(i == num) {
				pages[num].style.display = 'block';
				tabs[num].className = 'present';
			}
			else{
				pages[i].style.display = 'none';
				tabs[i].className = null;
			}
		}
	},
 
	dive: function(){
		var hash = window.location.hash;
		hash = hash.split("?");
		hash = hash[0].split("#");
 
		var tabs = this.setup.tabs;
		var pages = this.setup.pages;
		for(i=0; i<pages.length; i++) {
			if(pages[i] == document.getElementById(hash[1])) this.showpage(tabs[i]);	
		}
		$('#map').show().html('<iframe width="365" height="250" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="http://maps.google.co.jp/maps?f=q&amp;source=s_q&amp;hl=ja&amp;geocode=&amp;q=%E6%84%9B%E7%9F%A5%E7%9C%8C%E8%B1%8A%E5%B7%9D%E5%B8%82%E7%99%BD%E9%9B%B2%E7%94%BA2-17-1&amp;aq=&amp;sll=36.5626,136.362305&amp;sspn=66.157614,71.542969&amp;brcurrent=3,0x6004cbef8f4e3a19:0xc0c7086902a01c0,0&amp;ie=UTF8&amp;hq=&amp;hnear=%E6%84%9B%E7%9F%A5%E7%9C%8C%E8%B1%8A%E5%B7%9D%E5%B8%82%E7%99%BD%E9%9B%B2%E7%94%BA%EF%BC%92%E4%B8%81%E7%9B%AE%EF%BC%91%EF%BC%97&amp;ll=34.83797,137.403688&amp;spn=0.017612,0.025749&amp;z=14&amp;iwloc=A&amp;output=embed&amp;iwloc=B"></iframe><br /><small><a href="http://maps.google.co.jp/maps?f=q&amp;source=embed&amp;hl=ja&amp;geocode=&amp;q=%E6%84%9B%E7%9F%A5%E7%9C%8C%E8%B1%8A%E5%B7%9D%E5%B8%82%E7%99%BD%E9%9B%B2%E7%94%BA2-17-1&amp;aq=&amp;sll=36.5626,136.362305&amp;sspn=66.157614,71.542969&amp;brcurrent=3,0x6004cbef8f4e3a19:0xc0c7086902a01c0,0&amp;ie=UTF8&amp;hq=&amp;hnear=%E6%84%9B%E7%9F%A5%E7%9C%8C%E8%B1%8A%E5%B7%9D%E5%B8%82%E7%99%BD%E9%9B%B2%E7%94%BA%EF%BC%92%E4%B8%81%E7%9B%AE%EF%BC%91%EF%BC%97&amp;ll=34.83797,137.403688&amp;spn=0.017612,0.025749&amp;z=14&amp;iwloc=A" target="_blank">大きな地図で見る</a></small>');
	}
}
