function showNextQuote(speed){

	var quotes = $('#main-quotes'),
		item = '.item',
		current = $('.item:visible', quotes),
		currentIndex = $(item, quotes).index(current),
		numQuotes = $(item, quotes).length
	
	nextIndex = (currentIndex == numQuotes-1) ? 0 : currentIndex + 1
	
	$(item, quotes).hide().removeClass("current")
	
	$($(item, quotes).get(nextIndex)).slideDown(speed).addClass('current')
	
	
		resizeSidebar()
	
}


function resizeSidebar() {
    $('#sidebar').height(
    		Math.max(Math.max($('#center').height()- $('#header-container').height(), $(window).height())  - $('#header-container').height(), 400) 
    		
    )
};


$(document).ready(function(){
	
	
	
	showNextQuote(0)
	
	$('#main-quotes a.next').click(function(e){
		e.preventDefault()
		showNextQuote(300)
	})
	
	
	
	$(".tweet").tweet({
        username: "steweandboogee",
        join_text: "auto",
        avatar_size: 32,
        count: 3,
        auto_join_text_default: "mondtuk:", 
        auto_join_text_ed: "we",
        auto_join_text_ing: "we were",
        auto_join_text_reply: "we replied to",
        auto_join_text_url: "we were checking out",
        loading_text: "Csipogásaink épp jönnek..."
    });
	
	
	
	var resizeTimer = null;
	$(window).bind('resize', function() {
	    if (resizeTimer) clearTimeout(resizeTimer);
	    resizeTimer = setTimeout(resizeSidebar, 10);
	    resizeSidebar()
	});
	
	
		$('.sb-strip, .tweet').hide()
	
	
})


$(window).load(function(){
	resizeSidebar()
	$('.sb-strip, .tweet').fadeIn()
})
