﻿function beforeTwitterCall()
{
	$('.twitter-content').hide();
	$('.twitter-loading').show();
}

function twitterCallBack(data)
{
	var obj = eval(data.d);
	twitterCallback2(obj);
	$('.twitter-loading').hide();
	$('.twitter-content').fadeIn('slow');
}

function errorCallback()
{
	$('.twitter-loading').hide();
	$('.twitter-content').fadeIn('slow');
}

$(function()
{
	// Setup the content rotation
	$("#slides").after('<div id="slidecontrols">').cycle(
	{
		fx: 'scrollLeft',
		pager: '#slidecontrols',
		pauseOnPagerHover: true,
		pause: true,
		speed: 500,
		autostop: true,
		autostopCount: 7
	});

	$.ajax(
	{
		type: 'POST',
		url: '/services/social.asmx/GetTwitterFeed',
		data: '{}',
		dataType: 'json',
		contentType: 'application/json; charset=utf-8',
		success: twitterCallBack,
		beforeSend: beforeTwitterCall,
		error: errorCallback
	});
});