jQuery(function($){
	var $tab_content = $("#tab-content");
	var change_tabs = function(tab_label){
		var $tab_label = $(tab_label).parent(),
			$tab = $("#" + $tab_label.attr('id').replace('-tab',''));
		if($tab_content.find('.tab-content:visible').size() == 0){
			$tab_label.addClass('active');
			$tab.slideDown(200);
		} else {
			var $current = $tab;
			if($current.is(':visible')){
				$current.slideUp(200);
				$tab_label.removeClass('active');
			} else {
				var height = $tab_content.height();
				$tab_content.height(height);
				$tab_label.addClass('active').siblings().removeClass('active');
				$current.siblings('.tab-content').fadeOut(200, function(){
					$tab_content.css({height:'auto'});
					$current.fadeIn(200);
				});
			};
		};
	};
	
	$("#contact-tab a, #credits-tab a").click(function(e){
		e.preventDefault();
		change_tabs(this);
	});
});

function updateOrientation(){
     switch(window.orientation) {
        case 0:case 180: document.body.className = "portrait"; break;
		case -90: case 90: document.body.className = "landscape"; break;
     };
 };