/* Author: Citrus Design Group

*/
var homeGalTime;
var homeQuoteTime;
function homeRotate(liIndex){
	clearTimeout(homeGalTime);
	var $currImg = $('div.currentImg');
	var $currInfo = $('div.currentInfo');
	var $newImg;
	var $newInfo;
	$('div').removeClass('currentImg');
	$('div').removeClass('currentInfo');
	$('ul#galNav a').removeClass('currGal');
	$currImg.fadeOut();
	$currInfo.hide();
	if (liIndex > 2){liIndex = 0;}
	$newImg = $('div#hero'+(liIndex+1));
	$newInfo = $('div#info'+(liIndex+1));	
	$newImg.fadeIn().addClass('currentImg');
	$newInfo.fadeIn().addClass('currentInfo');
	$('ul#galNav li:eq('+liIndex+') a').addClass('currGal');
	homeGalTime = setTimeout(function(){homeRotate(liIndex+1)}, 5500)
}
function quoteRotate(dir){
	var count = $('div#theQuotes').children('div.quoteHolder').size();
	var $currQuote = $('div.currQuote');
	var $nextQuote;
	var index = $('div#theQuotes div.quoteHolder').index($currQuote);
	$('div').removeClass('currQuote');
	$currQuote.fadeOut();
	if (dir == 'next'){
		if ((index + 1) == count){
			$nextQuote = $('div#theQuotes div.quoteHolder:eq(0)');
		}
		else
		{
			$nextQuote = $currQuote.next('div.quoteHolder');
		}
	}
	else
	{
		if (index == 0){
			$nextQuote = $('div#theQuotes div.quoteHolder:eq('+(count-1)+')');
		}
		else
		{
			$nextQuote = $currQuote.prev('div.quoteHolder');
		}
	}
	$nextQuote.fadeIn().addClass('currQuote');
}
function doYox(){
	$('#portfolio').yoxview();
	$('#viewDemo').yoxview();
}
function doTweets(){
	$("#tweets").tweet({
		username: "wearecitrus",
		time: true,
		count: 3
	});
}
$(function(){
	homeGalTime = setTimeout(function(){homeRotate(1)}, 5500);
	$('a#prevQuote').click(function(){quoteRotate('prev');return false;});
	$('a#nextQuote').click(function(){quoteRotate('next');return false;});
});
























