$(document).ready(function () {	
	
	// Twitter Feed
	TwitterLoader('#alerts');
	// Image Slideshow
	SlideShow('.home #primary .slideshow', 3000);
	
});


function TwitterLoader (container) {
	$(container).tweet({
		username: 'rebarnyc',
        join_text: 'auto',
		auto_join_text_default: "", 
        auto_join_text_ed: "we",
        auto_join_text_ing: "we were",
        auto_join_text_reply: "we replied to",
        avatar_size: 0,
        count: 1,
        loading_text: "loading..."
	});
}

function SlideShow(container, speed) {
	var image_height = $(container).find('img').eq(0).outerHeight(true);
	
	$(container).css('height', image_height);
	$(container).children('br').remove(); // This removes any Wordpress WYSIWYG added garbage
	
	$(container).cycle({
			fx: 'fade',
			speed: speed
	});
}


function SWFLoader () {
	var params = {quality: 'high'};
	swfobject.embedSWF('/blog/wp-content/themes/rebar-v2/media/rebar_updatedhomepage.swf', 'gallery', '600', '500', '9.0.0', params);
}