//Remove the ALT and Title Attribute from hero images
$('#heroContainer img').removeAttr('title').removeAttr('alt');

//Rotate the images on the home page
$(function() {
	var timer = setInterval(rotateHero, 5000);			
	var counter = 2;
	var rotate = true;
	
	//If the mouse is hovering over the hero, don't rotate
	$('#heroContainer').hover(
		function () {
			rotate = false;
		},
		function () {
			rotate = true;
		}
	);
	
	function rotateHero() {
		if (counter == 0) {counter++; return;}
		if (!rotate) {return;} 
		
		$('#heroContainer .hero')
		.stop()
		.fadeOut(1000)
		.filter( function() { return this.id.match('hero' + counter); })   
		.fadeIn(1000);
		(counter == $('#heroContainer .hero').length) ? counter = 1 : counter++;
	}			
});
