jQuery(document).ready(function() {  
slowspeed = 2000; speed = 1000;
jQuery('#quoteBox').css({opacity:.7}); jQuery('#content').css({opacity:0}); 
										   
jQuery('#suckerfishnav a').click(function(){ 

var toLoad = jQuery(this).attr('href')+' #content';  
jQuery('#blind').animate({width:825+'px'}, speed ,function(){
													  jQuery('body').removeClass('home'); jQuery('#content').remove();
													  jQuery('#contentRap').load(toLoad,'', function(){
																								jQuery('.storytitle').css('opacity',0); jQuery('#scroller').height('auto');
																								jQuery('#blind').animate({width:0}, speed, function(){
																								jQuery('.storytitle').animate({opacity:1}, slowspeed);
																								});});});  
return false;});

function getVar (){
	winHeight = jQuery('#storycontent').height();
									 divHeight = jQuery('#scroller').height();
									 sPos = jQuery('#scroller').position();
									 wPos = jQuery('#storycontent').position();}

jQuery('#buttonDown').mousedown(function(){getVar()
									 	 laDifference = (divHeight + sPos.top) - winHeight;
										 if (laDifference > 0){
											 scrollSpeed = (laDifference / .1)
											 newTop = sPos.top - laDifference;
											 jQuery('#scroller').animate({top: newTop +"px"}, scrollSpeed)};
});

jQuery('#buttonDown').mouseup(function(){jQuery('#scroller').stop('clearQueue')});
jQuery('#buttonDown').mouseleave(function(){jQuery('#scroller').stop('clearQueue')});
																	   
										
jQuery('#buttonUp').mousedown(function(){getVar()
								   			 if (sPos.top < 0){
											 scrollSpeed = ((sPos.top*-1) / .2)
											 newTop = 0;
											 jQuery('#scroller').animate({top: newTop +"px"}, scrollSpeed)}})

jQuery('#buttonUp').mouseup(function(){jQuery('#scroller').stop('clearQueue')});
jQuery('#buttonUp').mouseleave(function(){jQuery('#scroller').stop('clearQueue')});

// quotes fader
jQuery('ul#quotes li').hide(); jQuery('ul#quotes li:first').show();
function quotes(){
setTimeout(function() {jQuery('ul#quotes li:first').animate({opacity: 0}, slowspeed, function(){
																			   first = jQuery('ul#quotes li:first').html();
																			   jQuery('ul#quotes li:first').remove();
																			   jQuery('ul#quotes').append('<li>'+first+'</li>');
																			   jQuery('ul#quotes li').hide();
																			   jQuery('ul#quotes li:first').show().css({opacity:0}).animate({opacity: 1}, slowspeed, function (){
																																								 if(jQuery.browser.msie)
																																								 this.style.removeAttribute('filter');
																																								 quotes();});});}, 5000);};
jQuery(window).load(function(){
jQuery('#rollerBlind').animate({opacity:0}, slowspeed, function(){
jQuery('#content').animate({opacity:1}, 2000, function(){
jQuery('#rollerBlind').hide(function(){quotes();
});});});});});
