// Easing equation, borrowed from jQuery easing plugin
// http://gsgd.co.uk/sandbox/jquery/easing/
jQuery.easing.easeOutQuart = function (x, t, b, c, d) {
	return -c * ((t=t/d-1)*t*t*t - 1) + b;
};

$(document).ready(function () {

//cufon effect
    Cufon.replace('.cufon', {
        hover: true,
        hoverables: { span: true },
        fontFamily: 'botonpro'
    });
    
    Cufon.replace('#access a', {
        hover: true,
        fontFamily: 'botonpro'
    });
        
    Cufon.replace('.lavi', {
        hover: true,
        hoverables: { span: true },
        fontFamily: 'lavigne'
    });
    
    Cufon.replace('.shows-grid p', {
        hover: true,
        fontFamily: 'botonpro'
    });
    
    Cufon.replace('span.show-title', {
        hover: true,
        textShadow: '1px 1px 1px #000000',
        fontFamily: 'botonpro'
    });
    Cufon.replace('.normal h2', {
        hover: true,
        fontFamily: 'botonpro'
    });
    
    Cufon.replace('.normal h3', {
        hover: true,
        fontFamily: 'botonpro'
    });
    
    Cufon.replace('.normal h4', {
        hover: true,
        fontFamily: 'botonpro'
    });
      
    Cufon.replace('.side-menu ul li a', {
        hover: true,
        fontFamily: 'botonpro'
    });
    
    Cufon.replace('.gform_wrapper .gfield_label', {
        hover: true,
        fontFamily: 'botonpro'
    });
      
//hide scroll arrow if there is only one image

	$('.slidershow').each(function(index) {
		var count = $(this).find(".slides img").length;
		if(count < 2){
	    	$(this).find("span.prev").hide();
	    	$(this).find("span.next").hide();
	    }
	});
    
    
//closed show image opacity
	$("img.closed-show").fadeTo(0, 0.4);

//slide-in the datebox
    $(".box a").hover(function () {   
        $(this).children(".show-dates").animate({
            "left": "1px"
        }, {duration: 200});
	}, function () {
        $(this).children(".show-dates").animate({
            "left": "-70px"
        }, {duration: 200});
    });
    
//fadein more info btn
    $(".thumbnail-box a").hover(function () {   
       $(this).children(".more-info").stop().fadeTo(300, 1);
	}, function () {
       $(this).children(".more-info").stop().fadeTo(300, 0);
    });
    
//calculate the width of scroll panel
	var thumb_counts = $(".thumbnail-box").length;
	var new_width = 162 * thumb_counts;
	$(".srollable-shows .slides").css( "width", new_width);

//slideshow
	$('.slidershow').serialScroll({
		target:'.slides-wrapper',
		items:'img', // Selector to the items ( relative to the matched elements, '#sections' in this case )
		prev:'span.prev',// Selector to the 'prev' button (absolute!, meaning it's relative to the document)
		next:'span.next',// Selector to the 'next' button (absolute too)
		axis:'x',// The default is 'y' scroll on both ways
		duration:700,// Length of the animation (if you scroll 2 axes and use queue, then each axis take half this time)
		force:true, // Force a scroll to the element specified by 'start' (some browsers don't reset on refreshes)
		easing:'easeOutQuart', //use this easing equation for a funny effect
		interval:5000,// It's the number of milliseconds to automatically go to the next
	    lock:false, // Ignore events if already animating (true by default)	
		cycle:true,// Cycle endlessly ( constant velocity, true is the default )
		stop:true// Each click will stop any previous animations of the target. (false by default)		
		//step:1, // How many items to scroll each time ( 1 is the default, no need to specify )
		//jump:false, // If true, items become clickable (or w/e 'event' is, and when activated, the pane scrolls to them)
		//lazy:false,// (default) if true, the plugin looks for the items on each event(allows AJAX or JS content, or reordering)
		//constant:true, // constant speed
	});
	
	$('.scroll-wrapper').serialScroll({
		target:'.srollable-shows',
		items:'.thumbnail-box', // Selector to the items ( relative to the matched elements, '#sections' in this case )
		prev:'span.prev',// Selector to the 'prev' button (absolute!, meaning it's relative to the document)
		next:'span.next',// Selector to the 'next' button (absolute too)
		axis:'x',// The default is 'y' scroll on both ways
		duration:700,// Length of the animation (if you scroll 2 axes and use queue, then each axis take half this time)
		force:true, // Force a scroll to the element specified by 'start' (some browsers don't reset on refreshes)
		easing:'easeOutQuart', //use this easing equation for a funny effect
		interval:5000,// It's the number of milliseconds to automatically go to the next
	    lock:false, // Ignore events if already animating (true by default)	
		cycle:true,// Cycle endlessly ( constant velocity, true is the default )
		stop:true// Each click will stop any previous animations of the target. (false by default)		
		//step:1, // How many items to scroll each time ( 1 is the default, no need to specify )
		//jump:false, // If true, items become clickable (or w/e 'event' is, and when activated, the pane scrolls to them)
		//lazy:false,// (default) if true, the plugin looks for the items on each event(allows AJAX or JS content, or reordering)
		//constant:true, // constant speed
	});
	
//lightbox form
    $("a.sign-up").fancybox({
        'transitionIn': 'fade',
        'transitionOut': 'fade',
        'speedIn': 500,
        'speedOut': 500,
        'padding': 0,
        'margin': 0,
        'autoDimensions': false,
        'width': 569,
        'height': 595,
        'overlayColor': '#000',
        'overlayOpacity': 0.7,
        'scrolling': 'no',
        'titleShow': false,
        'onComplete': function () {
            $("#fancybox-content").css('height', '595px');
            $("#fancybox-content").css('width', '569px');
            
        }
    });
     
}); //document.ready function ends here


$(window).load(function() {
	
    
});
