/**
 * Vive JS
 *
 * The custom JavaScript used for the added functionality.
 *
 * @author Dan Hensby <dan@betterbrief.co.uk>
 * @author Josh Holloway <josh@betterbrief.co.uk>
 * @author Will Morgan <will@betterbrief.co.uk>
 * @version 1.0
 * @copyright 2010 Better Brief LLP
 *
 */

//Load jQuery
//google.load("jquery", "1.4");

// effectively 'on document ready'
var J = jQuery.noConflict();
J(function($) {
	switch(document.body.id) {
		case 'HomePage':
			var $imgs = $('#Slideshow').find('img'),
				$current = $imgs.filter(':first'),
				$next = $current.next(),
				$others = $imgs.not($current);
			$others.hide();
			window.setInterval(function() {
				$current.fadeOut(1000);
				$next.fadeIn(1000);
				$current = $next;
				$next = $current.next().length ? $current.next() : $current.parent().children(':first');
			}, 5000);
		break;
	}
});

//Google analytics tracking
/*var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-5532417-xx']);
_gaq.push(['_trackPageview']);

(function() {
  var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
  ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
  (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(ga);
})();*/
