
$(function () {

// get current slide's number
function currentSlide() {
	var hash = window.location.hash || '#!panel-1';
	return parseInt(hash.replace(/[A-Za-z#\-\/!]/g, '') - 1); 
	}
// global vars	
var	cycleSelector = $('#slider'),
	startSlide = currentSlide(),
	hasSlid = 0;
	
$('#slider').cycle({ 
	fx: 'none',
    onPagerEvent: function(idx, slide) { 
   	 	hasSlid = 1;
   	 	window.location.hash = "!panel-"+ (parseInt(idx) + 1) + ""; 
   	 	return false; },
    pager:  '#tabs',
    pagerAnchorBuilder: function(idx,slide) { 
    return '#tabs li:eq(' + (idx+0) + ')'; } 
}).cycle('pause');

// bind to the hashchange event
$(window).bind('hashchange', function () {
	var slideNo = currentSlide();
// we only want to fire the slide change if the next button or the pager hasn't done it for us
	if (hasSlid === 0) { cycleSelector.cycle(slideNo); }
// return it back to zero
	hasSlid = 0;
	}); 
	
// when the page loads, we need to trigger a hashchange
	$(window).trigger( 'hashchange' );

// Menu
$('#nav li ul').hide();
$('#nav li').hover(
	function () {
		$(this).addClass('nav-hl');
		$('ul', this).slideDown(200);
	},
	function () {
		$(this).removeClass('nav-hl');
		$('ul', this).hide();
	}
);
// Expanding tabs
$('#tabs li').hover(
	function() {
		$(this).animate({
			width: "215px" },150);
	},
	function() {
		$(this).animate({
			width: "207px" },50);
	}
);

// Testimonials
$('#quotes').cycle({
		fx: 'fade',
		timeout: 10000
	});

//function
})(jQuery);
