function flashingLogo()
{
   $img = $('#kud-culture-logo img:visible');
   $hiddenImg = $('#kud-culture-logo img:hidden');
   $img.hide();
   $hiddenImg.show();
}

$(document).ready(function(){

    /*new scroll stuff*/
	$('.all.scroll>table').each(function(index){
		if ($(this).innerWidth() > 560)	{
			$(this).parent().after('<div class="scrollbar"></div>');
		}
	});
	
	$('.scrollbar').append("<div class='rightScroll'>more <img src='/images/right.png' /></div>");
	
    $('.leftScroll').live('click',function(){
        $(this).parent().prev('.scroll').scrollTo({top:'+=0',left:'-=250'},400);
    })
    
    $('.rightScroll').live('click',function(){
    	if ($(this).parent().has('.leftScroll').length < 1)
    		$(this).parent().append("<div class='leftScroll'><img src='/images/left.png' /> back</div>");
    		
        $(this).parent().prev('.scroll').scrollTo({top:'+=0',left:'+=250'},300);
    })
    /*end new scroll stuff*/


    window.setInterval(function(){flashingLogo()}, 1000);

    //autoscroll
    window.onfleXcrollRun=function(){
        if($('#page-name').val() == "publication" || $('#page-name').val() == "awards" || ($('#page-name').val() == "projects" && $('#page-param2').val() != "")){
            function stopAutoScroll(){
                window.clearInterval(autoScroll);
            }

            var center = $('#center')[0];
            var autoScroll = window.setInterval(
                function(){
                    center.fleXcroll.scrollContent("2px");
                }, 80
            )

            $('#center').mousewheel(function(){
                stopAutoScroll();
            }).click(function(){
                stopAutoScroll();
            })
        }
    }

    //debug toggle
    $('.debug-toggle').remove();
    $('.debug-toggle').toggle(
        function(){
            $('#debug').show();
            $('#debug-title').show();
        },
        function(){
            $('#debug').hide();
            $('#debug-title').hide();
        }
    )
})



