﻿/* tobin undergrad home page */

$(function() {
    $(".video-container, #plcSideContent2 .eventswrapper, #plcSideContent2 > a, #top_content").shadow();
    // set up scrolling div
    if ($("div.storieswrapper.scrolling").contents().length > 0) {
        $("div.storieswrapper.scrolling .storieslistcontainer").jScrollPane({ scrollbarWidth: 0, scrollbarMargin: 0, animateInterval: 40, maintainPosition: false });
        // scroll with up arrow
        scrollDiv("div.storieswrapper.scrolling .ScrollControls img:eq(0)", "div.storieswrapper.scrolling .storieslistcontainer", -15);
        // scroll with down arrow
        scrollDiv("div.storieswrapper.scrolling .ScrollControls img:eq(1)", "div.storieswrapper.scrolling .storieslistcontainer", 15);
    }
});

function scrollDiv(trigger, div, verticalpixels) {
	var t;
	$(trigger).unbind();
	if ($(div).siblings(".jScrollPaneTrack").length > 0) {
		$(trigger).mouseover(function() {
			t = setInterval(function() {
				$(div)[0].scrollBy(verticalpixels);
			}, 100);
			$(trigger).addClass("hover");
		}).mouseout(function() {
			clearInterval(t);
			$(trigger).removeClass("hover");
		});
	}
}