$(document).ready(function(){
	
	$("#whatis p").hide();
	
	function externalLinks() {
		if (!document.getElementsByTagName) return;
		var anchors = document.getElementsByTagName("a");
		for (var i=0; i<anchors.length; i++) {
			var anchor = anchors[i];
			if (anchor.getAttribute("href") && anchor.getAttribute("rel") == "external")
				anchor.target = "_blank";
		}
	}
	externalLinks();

	$('.#sponsorstext').hide();

	var test = $("#footer");
	var position = test.offset();
	$("#bgright-bar").css({'top' : position.top, 'background-color' : 'white'});
	//$("p#test").text("The top position is " + position.top + "px.");
	
	
	//Javascript is used to control the heights of several elements to get around  the problems of 100% height in cross browser css - the default height is set to 800px and all pages must be shorter than this or the css must be updated.
	function sortHeights() {
		var docheight = $(document).height();
		$("#bgleft").css({'height' : docheight});
		$("#bgright").css({'height' : docheight});
		$("#contentright").css({'height' : docheight});
		$("#content").css({'height' : docheight});
		$("#middle").css({'height' : docheight});
		$("#container").css({'height' : docheight});
		//$("p#test").text("The height for the Document is " + docheight + "px.");
	}
	
	sortHeights();

	var resizeTimer = null;
	$(window).bind('resize', function() {
		if (resizeTimer) clearTimeout(resizeTimer);
		resizeTimer = setTimeout(sortHeights, 100);
	});
	
	$('.flashfade').cycle({ 
		fx: 'fade'
	});
	
	
	$("#biglink a").fancybox({
		'frameWidth': 400, 
		'frameHeight': 180,
		'overlayOpacity': 0.75
	}); 


	jQuery('#linklist').accordion({
		autoheight: false,
		header: "a.head",
  	    animated: "bounceslide"
	});
	
	$("#whatis p").slideDown('slow');
	


        $(".tweet").tweet({
            username: "HEYSportsAwards",
            count: 1,
            loading_text: "loading tweets..."
        });


});