$(document).ready(function() {	
	
	$("#joinPanel").formStep();
	$("#joinPanel").validationEngine();
	
    $("#tweet").tweet({
        username: "2020research",
        join_text: "auto",
        avatar_size: 32,
        count: 5,
        auto_join_text_default: "",
        auto_join_text_ed: "",
        auto_join_text_ing: "",
        auto_join_text_reply: "",
        auto_join_text_url: "",
        loading_text: "Loading Twitter Updates..."
    });

	showChatButton2('panel@workgroup.chat.2020research.com');

});

var twitter_count = 0;

function postTweet()
{
	$("#feed #tweet a").attr("target", "_twitter");
	showTweets();
	setInterval("showTweets();", 10000);
}

function showTweets()
{
	var total_twitters = $("#feed #tweet ul li").size();
	var old_tweet = twitter_count - 1;
	
	if ( old_tweet < 0 ) {
		old_tweet = total_twitters - 1;
	}
	
	$("#feed #tweet ul li").eq(old_tweet).fadeOut("slow", function() {
		$("#feed #tweet ul li").eq(twitter_count).fadeIn("slow");
	});

	twitter_count = twitter_count + 1;
	
	if ( twitter_count >= total_twitters ) {
		twitter_count = 0;
	}
}

function playInterview()
{
	$("#temp_container").html("<a href='/new_includes/misc/interviews.mp4' style='display:block;width:520px;height:330px' id='player'></a>");

	$.fn.colorbox({
		href: '#temp_container',
		open: true,
		inline: true,
		transition: 'elastic',
		close: '',
		scrolling: false,
		title: 'Participant Interview',
		onCleanup: function() {
		},
		onComplete: function() {
			flowplayer("player", "/new_includes/flowplayer/flowplayer-3.1.5.swf");
		}
	});

}