    $(document).ready(function(){ 

// Drop down menu (multi level)	
        $("ul.superfish").superfish(); 
// End of menu
// Control visible stories
		$('ul.more_stories').each(function(index) {
			$(this).children('li').slice(5).hide();
		});

		$('.minus').click(function() {
			$(this).parent().next('ul').children('li:visible:last').hide();
		});

		$('.plus').click(function() {
			$(this).parent().next('ul').children('li:hidden:first').show();
		});
		// End of stories section
		// Control minimize
			$('.minimizesidebar').click(function() {
			$(this).parent('h2').next().toggle();
		});
			$('.minimizedynwidget').click(function() {
			$(this).parent('h2').next().toggle();
		});
			$('.minimizecat').click(function() {
			$(this).parent('h3').next().toggle();
		});
		// End of control minimize function
		
    });

$(function() {
	$("ul.tabs").tabs("div.panes > div",{effect:"fade",fadeInSpeed: "slow"}); 
});
	
$(function() {
$(".slidetabs").tabs(".images > div", {
	effect: 'fade',
	fadeOutSpeed: "slow",
	rotate: true
}).slideshow({
	autoplay: true,
	interval: 6000
	});
});

//plugin
jQuery.fn.topLink = function(settings) {
	settings = jQuery.extend({
		min: 1,
		fadeSpeed: 200
	}, settings);
	return this.each(function() {
		//listen for scroll
		var el = $(this);
		el.hide(); //in case the user forgot
		$(window).scroll(function() {
			if($(window).scrollTop() >= settings.min)
			{
				el.fadeIn(settings.fadeSpeed);
			}
			else
			{
				el.fadeOut(settings.fadeSpeed);
			}
		});
	});
};

//usage w/ smoothscroll
$(document).ready(function() {
	//set the link
	$('#top-link').topLink({
		min: 400,
		fadeSpeed: 500
	});
	//smoothscroll
	$('#top-link').click(function(e) {
		e.preventDefault();
		$.scrollTo(0,300);
	});
});

