$(document).ready(function() {
						   
	// profile img/tabs toggling
	$("#divProfile > ul li > a").click(function() {
		index = $("#divProfile > ul li a").index(this);
		if(this.className != "selected") {
			$("#divProfile > img").hide();
			$("#divProfile > img:eq(" + index + ")").fadeIn("slow");
			$("#divProfile > ul li a").removeClass("selected");
			$("#divProfile > ul li a:eq(" + index + ")").addClass("selected");
		}
		return false;
	});
	
	// twitter feed
	$("#divTweets").tweet({
			join_text: "auto",
            username: "kaseyacorp",
			query: "%23Kaseya09+OR+KaseyaConnect+OR+Kaseya09+OR+%40kaseyacorp",
            join_text: "auto",
            avatar_size: 32,
            count: 20,
            auto_join_text_default: "",
            auto_join_text_ed: "",
            auto_join_text_ing: "",
            auto_join_text_reply: "",
            auto_join_text_url: "",
            loading_text: "loading tweets..."
        });
	
	// rss feed
	$.getFeed({
        url: '/2009/rss.xml',
        success: function(feed) {
            var html = '';
            for(var i = 0; i < feed.items.length && i < 5; i++) {
                var item = feed.items[i];
                html += '<h5>'
                + '<a href="'
                + item.link
                + '" target="_blank">'
                + item.title
                + '</a>'
                + '</h5>';
                html += '<div class="updated">'
                + item.updated
                + '</div>';
            }
            $('#divRss').append(html);
        }    
    });

	// tab toggle
	$("#divSocial ul:eq(0) li a").click(function() {
		if(this.className != 'selected')
		{
			tabIndex = $("#divSocial li > a").index(this);
			$("#divSocial > div:visible").hide();
			$("#divSocial > div:eq(" + tabIndex + "):hidden").fadeIn("slow");
			$("#divSocial li > a").removeClass("selected");
			$("#divSocial li > a:eq(" + tabIndex + ")").addClass("selected");
			return false;
		}
		else
			return false;
	});
	
	// lightbox calls
	$("a.fancybox").fancybox({ 'frameWidth': 780, 'frameHeight': 600, 'hideOnContentClick': false }); 
});