jQuery.extend(jQuery.easing,{
	easeInOutExpo: function(x,t,b,c,d){
		if (t==0) return b;
		if (t==d) return b+c;
		if ((t/=d/2) < 1) return c/2 * Math.pow(2, 10 * (t - 1)) + b;
		return c/2 * (-Math.pow(2, -10 * --t) + 2) + b;
	},
	easeOutExpo: function (x, t, b, c, d) {
		return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b;
	},
	easeInExpo: function (x, t, b, c, d) {
		return (t==0) ? b : c * Math.pow(2, 10 * (t/d - 1)) + b;
	}
});

$(document).ready(function(){
	
	if($('#slides').length) {
		$('#slides').cycle({
			fx: 'scrollLeft',
			speedIn: 750,
			speedOut: 750,
			timeout:  4500,
			easeIn: 'easeInOutExpo',
			easeOut: 'easeInOutExpo'
		});
	}
	
	if($("a[rel='popup']").length) {
		$("a[rel='popup']").colorbox();	
	}

	if($('form#contact').length) {
		$('form#contact').validate();
	}
	
	$('.read-more a').toggle(function() {
		var href = $(this).attr('href');
	  	$(this).text('Hide');
		$(this).parents('ul').before('<div class="more" style="display: none;"></div>');
		$(this).parents('div').find('.more').load(href).fadeIn('slow');
		
	}, function() {
	  	$(this).text('Read more');
		$(this).parents('div').find('.more').fadeOut('slow', function(){
			$(this).remove();
		})
	});
	
	//If the canvas element exists load the google map
	if ($('#canvas').length) {
	  loadGoogleMap();
	}
});
