//New tabscript

tabs={

	init:function (){
		if(!document.getElementById || !document.createTextNode){return;}
		tabs.links = $('a[href^=#]');
			for(var i=0; i<tabs.links.length; i++){
				var location = tabs.links[i].getAttribute('href', 2);
				location=location.slice(1,location.length);
				if(location != 'top'){
					var content = $('div#'+location);
					$(tabs.links[i]).click(function(event){
							tabs.getContent(event);
						});
					var listItem=$(tabs.links[i]).parent();
					if(i==0){
						tabs.currentTabContent=content;				
						tabs.currentTab=listItem;
						tabs.currentTab.addClass('here');
						tabs.currentTabContent.addClass('here');
					}//end if
					else{
						tabs.temp=content;
						tabs.temp.addClass('hide');
					}//end else
				}
			}//end for
	},
	
	getContent:function(e){
		var t=tabs.getTarget(e); 
		  tabs.showContent(t);
		  e.preventDefault();
		  return false;
	},

	getTarget:function(e){
		var target = window.event ? window.event.srcElement : e ? e.target : null;
		if (!target){return false;}
		while(target.nodeType!=1 && target.nodeName.toLowerCase()!='body'){
			target=target.parentNode;
		}//end if
		return target;
	},	
	
	showContent:function(t){
		var location=t.getAttribute('href',2).replace(/.*#/,'');
		for(var i=0;i<tabs.links.length;i++){
			if(tabs.links[i].getAttribute('href',2).replace(/.*#/,'')==location){
				var listItem=$(tabs.links[i]).parent();
				break;
			}//end if
		}//end for
		var content=$('div#'+location);
		tabs.currentTabContent.addClass('hide');
		tabs.currentTabContent.removeClass('here');
		content.removeClass('hide');
		tabs.currentTab.removeClass('here');
		listItem.addClass('here');
		content.addClass('here');
		tabs.currentTab=listItem;
		tabs.currentTabContent=content;
		  return false;
	}

};

$().ready(function(){
	tabs.init();
});