jQuery.easing.easeOutExpo = function (x, t, b, c, d) {
	return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b;
}
Cufon.replace('h1,h2,#menu li a');
if(!(navigator.userAgent.match(/Android/i) || navigator.userAgent.match(/webOS/i) || navigator.userAgent.match(/iPhone/i) || navigator.userAgent.match(/iPod/i))) {
	Cufon.replace('span.phone'); 
}
;(function($) {
$(document).ready(function() {
	$('#menu ul').lavaLamp({
		fx: 'easeOutExpo',
		speed: 1200 ,
		returnDelay: 1000,
		click: function() {

		}
	});
	if($('#quick-links').length) {
		$('#quick-links').hoverIntent({
			over: function() {
				$('#quick-links a.handle').css('backgroundPosition','0 -35px');
				$(this).children('ul.hover').stop(true,true).show('fold',{horizFirst: true, size: 280},500);
			},
			out: function() {
				$(this).children('ul.hover').stop(true,true).hide('drop', {direction: 'down'},function() {
					$('#quick-links a.handle').css('backgroundPosition','0 0'); 
				},500);
			},
			timeout: 500
		});
	}
	
	if($('#sidebar').length) {
		/*
		var stop = false;
		$('#sidebar h3' ).click(function( event ) {
			if ( stop ) {
				event.stopImmediatePropagation();
				event.preventDefault();
				stop = false;
			}
		});
		*/
		$('#sidebar').accordion({
			autoHeight: false,
			animated: 'bounceslide'
		});
		/*.sortable({ 
			axis: 'y',
			handle: 'h3',
			stop: function() {
				stop = true;
			}
		});
		*/
		
		$('#sidebar li.newsletter label').inFieldLabels({
			fadeOpacity: 0.2,
			fadeDuration: 500
		});
	}
	if($('#testimonials').length) {
		$.post('/ZoneProcess.aspx?ZoneID=-1', { Username: 'Anonymous', Password: 'User' });
		$('#CAT_Custom_216254').change(function() {
			$('#ItemName').val($(this).val());
		}); 
	}
	if($('ul#buttons').length) {
		//$('ul#buttons li:nth-child(even)').addClass('even');
	}
	if($('#staff').length) {
		$('#staff ul li:nth-child(3n)').addClass('nomargin');
	}
	if($('#slider').length) {  
		$.getScript('/js/jquery.nivo.slider.pack.js', function(data, textStatus){
			$('#slider').nivoSlider({
				effect: 'slideInRight', // Specify sets like: 'fold,fade,sliceDown'
				slices: 15, // For slice animations
				boxCols: 8, // For box animations
				boxRows: 4, // For box animations
				animSpeed: 500, // Slide transition speed 
				pauseTime: 6000, // How long each slide will show
				startSlide: 0, // Set starting Slide (0 index)
				directionNav: true, // Next & Prev navigation
				directionNavHide: true, // Only show on hover
				controlNav: true, // 1,2,3... navigation
				controlNavThumbs: false, // Use thumbnails for Control Nav
				controlNavThumbsFromRel: false, // Use image rel for thumbs
				controlNavThumbsSearch: '.jpg', // Replace this with...
				controlNavThumbsReplace: '_thumb.jpg', // ...this in thumb Image src
				keyboardNav: true, // Use left & right arrows
				pauseOnHover: true, // Stop animation while hovering
				manualAdvance: false, // Force manual transitions
				captionOpacity: 0.8, // Universal caption opacity
				prevText: 'Prev', // Prev directionNav text
				nextText: 'Next', // Next directionNav text
				beforeChange: function(){}, // Triggers before a slide transition
				afterChange: function(){}, // Triggers after a slide transition
				slideshowEnd: function(){}, // Triggers after all slides have been shown
				lastSlide: function(){}, // Triggers when last slide is shown
				afterLoad: function(){} // Triggers when slider has loaded
			});
		});
	}
	
})
})(jQuery);
