$(document).ready(function() {
	
	if($('li.active ul').length) {
		$('li.active ul').css('display','block');
		
		$('li.upper').hover(function() {
				$('li.active ul').css('display','none');
			}, 
			function() {
				$('li.active ul').css('display','block');
			}
		 );
		
	}
	
	if($('#thumbs').length) {
		
		
		$(function() {
			setInterval( "slideSwitch()", 8000 );
		});


	}	
	
});

function slideSwitch() {
	var $active = $('#imageNav img.active');

	if ( $active.length == 0 ) $active = $('#imageNav img:last');

	var $next =  $active.next().length ? $active.next()
		: $('#imageNav img:first');

	$active.addClass('last-active');

	$next.css({opacity: 0.0})
		.addClass('active')
		.animate({opacity: 1.0}, 1500, function() {
			$active.removeClass('active last-active');
		});
}

var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-11449116-10']);
  _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';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();


