jQuery.extend( jQuery.easing,
{
    def: 'easeOutExpo',
    easeInExpo: function (x, t, b, c, d) {
        return (t==0) ? b : c * Math.pow(2, 10 * (t/d - 1)) + b;
    },
    easeOutExpo: function (x, t, b, c, d) {
        return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b;
    },
    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;
    }
});



$(function(){
	$('#gallary-list').galleria({
	
            history   : false,
            clickNext : true,
            onImage   : function(image,caption,thumb) {
                image.css( 'opacity',0).animate({ opacity: 1 },3500,'easeOutExpo');
                caption.css('display','none');
                var _li = thumb.parents('li');
                _li.siblings().children('img.selected').fadeTo(500,0.7);
                thumb.fadeTo('fast',1).addClass('selected');
            },
            onThumb : function(thumb) {
                var _li = thumb.parents('li');
                var _fadeTo = _li.is('.active') ? '1' : '0.7';
                thumb.css({ opacity:_fadeTo}).fadeIn(1500);
                thumb.hover(
                    function() { thumb.fadeTo('fast',1); },
                    function() { _li.not('.active').children('img').fadeTo('fast',0.7); }
                )
            }
	
	
	});

	if(!$("#home").length) {
		var child = $("#child").innerHeight();
		if($("#event").length) {
			$("#child").css("display", "block");
			var flag  = 1;
		} else {
			$("#child").css("height", "0px");
			var flag  = 0;
		}
		$("#side-nav-03").click(function(){
			if(!flag) {
				$(this).next().animate({ height: child + "px" }, 800,'easeOutExpo');
				flag = 1;
			} else {
				$(this).next().animate({ height: "0px" }, {duration: 800, easing:'easeOutExpo', complete: function(){ $(this).css("display", "none");}});
				flag = 0;
			}
			return false;
		});
	}
	
});



