$(document).ready(function() {
	if($(window).scrollTop() < 340) {
		$("#bannerSpacer").css('height', '0').animate({'height' : "250"}, 1000);
		$("#banner").hide().wait(750).fadeIn(500);
	}
	$("a").each(function(i){
		$(this).click(function(e) {
			e.preventDefault();
			var href = $(this).attr("href");
			if(href.indexOf("#") == 0) {
				var anchor = $("a[name='"+href.split("#",2)[1]+"']");
				$('html, body').animate({
					scrollTop: $(anchor[0]).offset().top
				}, 1000);
			}
			else {
				if($(window).scrollTop() < 340) {
					$("#banner").fadeOut(500);
					$("#bannerSpacer").wait(150).slideUp(750);
					setTimeout(function() {
						window.location = href;
					}, 1000);
				}
				else
					window.location = href;
			}
			return false;
		});
	});
	setPadding();
	$(window).resize(function() {
		setPadding();
	});
	if(jQuery.browser.msie) {
		$("#bannerSpacer").remove();//.css({'bottom': "250", "position": "relative"});
		// $("#banner").css({'bottom': "250", "position": "relative"});
		// $("#content > P").css({'bottom': "250", "position": "relative"});
		// $("#scroller").remove();
	}
});
$.fn.wait = function(time, type) {
	time = time || 1000;
	type = type || "fx";
	return this.queue(type, function() {
		var self = this;
		setTimeout(function() {
			$(self).dequeue();
		}, time);
	});
};
function setPadding() {
	var paddingHeight = $(window).height() - 175 - $("#content > *:not(#footer):last").height();
	if(jQuery.browser.msie)
		return;
	if (paddingHeight > 0)
		$("#centerBlock").css('padding-bottom', paddingHeight);
}