$(document).ready(function(){
			
			//Lightbox
			$(".lightbox").colorbox({innerWidth:800, innerHeight:475});
			
			//Tabs
			$("#gameTabs").tabs();
			
			
			
});
$(window).load(function(){
$(".equalHeight").equalHeight();	

if($.browser.msie && $.browser.version < 8){

 var theWindow        = $(window),
            $bg              = $("#bg img"),
            aspectRatio      = $bg.width() / $bg.height();

        function resizeBg() {

                if ( (theWindow.width() / theWindow.height()) < aspectRatio ) {
                    $bg
                        .removeClass()
                        .addClass('bgheight');
                } else {
                    $bg
                        .removeClass()
                        .addClass('bgwidth');
                }

        }

        theWindow.resize(function() {
                resizeBg();
        }).trigger("resize");

}
});		
		
$.fn.tabs = function () {
	
			this.contents().find(".textArea").hide(); 
			this.contents().find(".textArea.active").show(); 
			
			this.children("ul.nav").children("li").children("a").click(function() {
				var clicked = $(this);
				var activeTab = clicked.attr("href"); 
				activeTab = activeTab.replace('#', ".")
				
				clicked.parent('li').siblings().children('a').removeClass("active");
				clicked.addClass("active"); 
				
				clicked.parent('li').parent('ul').siblings('.content').children(".textArea").removeClass('active').hide();
				clicked.parent('li').parent('ul').siblings('.content').children(activeTab).addClass('active').fadeIn();
					
				return false;
				
			});
		
};
		
	
$.fn.equalHeight = function () {

			var height		= 0;
			var maxHeight	= 0;
		
			// Store the tallest element's height
			this.each(function () {
				height		= $(this).outerHeight();
				maxHeight	= (height > maxHeight) ? height : maxHeight;
			});
		
			// Set element's min-height to tallest element's height
			return this.each(function () {
				var t			= $(this);
				var minHeight	= maxHeight - (t.outerHeight() - t.height());
				var property	= $.browser.msie && $.browser.version < 7 ? 'height' : 'min-height';
		
				t.css(property, minHeight + 'px');
			});

};

