/**********************************************************************

	videosocialmarketing.net
	version: 	functions.js
	owner:		james cooke
	handcoded by robots for ewebbed.co.uk

**********************************************************************/
var currentQuote = 1;
var numberQuotes;
var addthis_config = {services_compact: "digg, delicious, myspace, google, facebook, reddit, live"};

Cufon.replace('h1, h2, h3, #nav a, .quote-scroll li, blockquote h3, blockquote p', { fontFamily: 'Myriad Pro', hover: true});

$(document).ready(function(){
	
	// find number of quotes
	numberQuotes = $('.quote-scroll li').length;
	
	setQuoteTimer();

	$(".instant-training").validate({
		meta: "validate"
		/*submitHandler: function(form) {
			jQuery(form).ajaxSubmit({
				//target: "#content"
				success: showFreeConfirm
			});
		}*/

	});
	
	$("a[rel=external]").click(function(){
		window.open(this.href);
		
		return false;
	});
	
	// Alternate Row Colors
	$('table tr:odd').addClass("alternate");

});

function showFreeConfirm(){
	$('.col-three form.instant-training').replaceWith("<div class='instant-thanks'><h3>Thankyou</h3><p>You will receive an email shortly with instructions to access your free video</p><a href='/?page_id=83' class='button button-meet' title='Meet Meredith'>Meet Meredith</a></div>");
}

function setQuoteTimer(){
	timer = window.setInterval(nextQuote,5000);
}

function nextQuote(){
	if(numberQuotes > currentQuote){
		$(".quote-scroll .overflow").animate({"left": "-=420px"}, "slow");
		currentQuote++;
     } else {
     	$(".quote-scroll .overflow").animate({"left": "0px"}, "slow");
		currentQuote = 1;
     }
      
}