$(function() {

// Cycle through slides
$.extend({
	nextSlide: function(){
		if ( document.hasFocus() ) {
			var current = $('.slide_link.current');
			$(current).removeClass('current');
			if ( $(current).parent('li').next('li').length > 0 ) {
				// Jump next
				$(current).parent('li').next('li').children('a').addClass('current');
			}
			else {
				// Jump first
				$('.slide_link').first().addClass('current');
			}
			// Change slide effect
			$('.slide:visible').last().fadeOut('slow', 'easeOutSine', function() {
				var move = $(this).detach();
				$('#slides').prepend(move);
				$(move).show();
			});
		}
	},
	changeSlide: function(target){
		$('#slides').stopTime('nextSlide');
		$('.slide').stop(true, true);
		while ( $('.slide:visible').last().data('target') != target ) {
			var move = $('.slide:visible').last().detach();
			$('#slides').prepend(move);
			$(move).show();
		}
		// Restart automatic changes
		$('#slides').everyTime(4000, 'nextSlide', function() {
			$.nextSlide();
		});
	}
});
	
if ( $('.slide').length > 1 ) {
	// Revert slides order
	var last_slide = $('div.slide').last();
	while ( $(last_slide).prev('div.slide').length > 0 ) {
		var move = $(last_slide).prev('div.slide').detach();
		$('div.slide').last().after(move);
	}
  
	$('.slide_link').first().addClass('current');

	// Show them
	$('div.slide').show();

	$('#slides').everyTime(8000, 'nextSlide', function() {
		$.nextSlide();
	});
}

$('.slide_link').click(function(event){
	event.preventDefault();
	if ( $(this).hasClass('current') ) {
		return;
	}
	$('.slide_link').removeClass('current');
	$(this).addClass('current');
;	$.changeSlide($(this).data('target'));
});

// Hide slides controls?
/*
$('#slide').mouseenter(function(event){
	$('#slides_links').stop(true, true);
	$('#slides_links').stopTime('hideSlidesLinks');
	$('#slides_links').fadeIn('fast', 'easeOutSine');
});

$('#slides_links').mouseenter(function(event){
	$(this).stop(true, true);
	$(this).stopTime('hideSlidesLinks');
	$(this).fadeIn('fast', 'easeOutSine');
});

$('#slides_links').mouseleave(function(event){
	$(this).stopTime('hideSlidesLinks');
	$(this).oneTime(1000, 'hideSlidesLinks', function() {
		$(this).fadeOut('slow', 'easeOutSine');
	});
});
*/

});

var sc_project=9690581; 
var sc_invisible=1; 
var sc_security="e45f1aa3"; 
var scJsHost = (("https:" == document.location.protocol) ?
"https://secure." : "http://www.");
document.write("<sc"+"ript type='text/javascript' src='" +
scJsHost+
"statcounter.com/counter/counter.js'></"+"script>");