$(document).ready(function() {


	/* brand message transitions */
	var brandmsgs = $('#home_mainfeature_overlay > li');
	var msgIndex = 1;


	function ChangeMsg()
	{
		brandmsgs.hide();
		$('li#msg'+msgIndex).fadeIn(2000);
		//$('li#msg'+msgIndex).show(1000, 'easeOutBounce');
	
		if(msgIndex == brandmsgs.length)
		{
			msgIndex = 1
		} else {
			msgIndex++;
		}
	}


	if ( $('#home_mainfeature_overlay').length > 0 )
	{ 
		ChangeMsg();
		setInterval(function(){ChangeMsg();}, 5000);
		setInterval(function(){$('#next_testimonial').click();}, 5000);
	}


	/* testimonial and blog sliders */
	$(function ()
	{
		var testContainers = $('#home_testimonials > li');
		var blogContainers = $('#home_blogposts > li');
		var testIndex = 1;
		var blogIndex = 1;
	    
	    $('#next_testimonial').click(function () {
	        
	        testContainers.hide();
	        $('li#test'+testIndex).show('slide');
	       
	        if(testIndex == testContainers.length) {
	        	testIndex = 1
	        } else {
	        	testIndex++;
	        }
	        
			return false;
	    }).click();
	    
	    $('#next_blogpost').click(function () {
	        
	        blogContainers.hide();
	        $('li#blog'+blogIndex).show('slide');
	       
	        if(blogIndex == blogContainers.length) {
	        	blogIndex = 1
	        } else {
	        	blogIndex++;
	        }
	        
	    	return false;
	    }).click();
	});

});
