
$(document).ready(function() {

	var liWidth = 0;
	var velocity = 0.08;
	$(".content_postwidget_horizontal_wrap li").each( function() {
		liWidth += $(this).get(0).offsetWidth + 1;

	});

	$(".content_postwidget_horizontal_wrap").width(liWidth);


        $(".postwidget_navigator_bottom").mouseover( function() {
		var offset = $(this).parent().find(".content_postwidget_vertical_wrap").get(0).offsetHeight - $(this).parent().find(".content_postwidget_vertical_mask").get(0).offsetHeight;
		var scrolls = $(this).parent().find(".content_postwidget_vertical_mask").scrollTop();
		var H = offset - scrolls;
		var V = velocity
		var T = H/V;
                $(this).parent().find(".content_postwidget_vertical_mask").scrollTo({top:"100%",left: 0}, T,{easing:'linear'});
        });

        $(".postwidget_navigator_bottom").mouseleave( function() {
                $(this).parent().find(".content_postwidget_vertical_mask").stop();
        });

        $(".postwidget_navigator_top").mouseover( function() {
		//var H = $(this).parent().find(".content_postwidget_vertical_wrap").get(0).offsetHeight;
		var offset = $(this).parent().find(".content_postwidget_vertical_wrap").get(0).offsetHeight - $(this).parent().find(".content_postwidget_vertical_mask").get(0).offsetHeight;
		var scrolls = $(this).parent().find(".content_postwidget_vertical_mask").scrollTop();
		var H = scrolls;
		var V = velocity
		var T = H/V;
		console.log(T);

                $(this).parent().find(".content_postwidget_vertical_mask").scrollTo({top:"0px",left: 0}, T,{easing:'linear'});
        });

        $(".postwidget_navigator_top").mouseleave( function() {
                $(this).parent().find(".content_postwidget_vertical_mask").stop();
        });

        $(".postwidget_navigator_left").mouseover( function() {
		//var H = $(this).parent().find(".content_postwidget_horizontal_wrap").get(0).offsetHeight;
		var scrolls = $(this).parent().find(".content_postwidget_horizontal_mask").scrollLeft();
		var H = scrolls;
		var V = velocity
		var T = H/V;

                $(this).parent().find(".content_postwidget_horizontal_mask").scrollTo({top:"0",left: "0px"}, T,{easing:'linear'});
        });

        $(".postwidget_navigator_left").mouseleave( function() {
                $(this).parent().find(".content_postwidget_horizontal_mask").stop();
        });

        $(".postwidget_navigator_right").mouseover( function() {
		//var H = $(this).parent().find(".content_postwidget_horizontal_wrap").get(0).offsetHeight;
		var offset = $(this).parent().find(".content_postwidget_horizontal_wrap").get(0).offsetWidth - $(this).parent().find(".content_postwidget_horizontal_mask").get(0).offsetWidth;
		var scrolls = $(this).parent().find(".content_postwidget_horizontal_mask").scrollLeft();
		var H = offset - scrolls;
		var V = velocity
		var T = H/V;
                
		$(this).parent().find(".content_postwidget_horizontal_mask").scrollTo({top:"0px",left: "100%"}, T,{easing:'linear'});
        });

        $(".postwidget_navigator_right").mouseleave( function() {
                $(this).parent().find(".content_postwidget_horizontal_mask").stop();
        });
});

