$(document).ready(function(){
	/*
	$('#header img').hover(function() {
		$(this).stop().animate({opacity: '0'}, 300);
	}, function() {
		$(this).stop().animate({opacity: '1.0'}, 300);
	});
	*/

	$(window).scroll(function (event) {
		var y = $(this).scrollTop();
		if (y >= 80) {
			$('h2.ftitle_top, #searchform').css({'position':'fixed','top':'0'});
			$('.up_arrow').fadeIn();
		} else {
			$('h2.ftitle_top, #searchform').css({'position':'absolute','top':'-45px'});
			$('.up_arrow').fadeOut();
		}
	});
	$('.up_arrow').click(function () {
		$('body,html').animate({
			scrollTop: 0
		}, 500);
		return false;
	});

	$(".recent").click(function () { 
		$(".poprec").hide(); 
		$("#recent").show(); 
		$(".recent").addClass("bold"); 
		$(".popular").removeClass("bold");  
		$(".featured").removeClass("bold");  
	});
	
	$(".popular").click(function () { 
		$(".poprec").hide(); 
		$("#popular").show();
		$(".popular").addClass("bold"); 
		$(".recent").removeClass("bold"); 
		$(".featured").removeClass("bold"); 
	});
	
	$(".featured").click(function () { 
		$(".poprec").hide();  
		$("#featured").show();  
		$(".popular").removeClass("bold"); 
		$(".recent").removeClass("bold"); 
		$(".featured").addClass("bold"); 
	});

	
	
	$("#black").css('opacity',0.7);
	

	
	$("#black").click(function () { closemodal(); });
	
									
	$(".bot-nav-links a.stbutton").click(function () { 
		$("#stwrapper.stwrapper").addClass("fromBot");
		$("#stwrapper.stwrapper.fromBot iframe").before('<a class="closemodal" href="javascript:closemodal();"><img src="http://w.sharethis.com/images/pic3.gif" border=0 height=8 width=8></a>');
		$("#black").show();
		$("div#close_button img").hide();
	});
	
	$("#stwrapper.stwrapper.fromBot img.stclose").click(function () { 
		$("#black").hide();
	});
	

	$(".bot-nav-links span.stbuttontext").html("share");
	
	$('#recent_featured p').css({
		'overflow':'hidden',
		'height':'107px'
	})
	$('#recent_featured a.more').click( function() {
		$("#recent_featured p").animate({
			height: 312
		});
		$(this).fadeOut("fast");
	});
	
	
});

function closemodal() {
		$("#black").hide();
		$("#stwrapper.stwrapper").css('visibility','hidden').css('top','-999px').css('left','-999px');
		$("#stframe.stframe").css('visibility','hidden');
		$("#stwrapper.stwrapper").removeClass("fromBot");
		$("a.closemodal").remove();
}
