// Smooth Scroll
$(function(){
 
    $('a[href*=#]').click(function() {
 
    if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') 
        && location.hostname == this.hostname) {
 
            var $target = $(this.hash);
 
            $target = $target.length && $target || $('[name=' + this.hash.slice(1) +']');
 
            if ($target.length) {
 
                var targetOffset = $target.offset().top;
 
                $('html,body').animate({scrollTop: targetOffset},{duration:1200, easing: 'easeInOutExpo'});
 
                return false;
 
            }
 
        }
 
    });
 
});

// Images fade animation
$(function(){
	$(".fadeload").hover(function(){
		$(this).stop().animate({opacity: "0.2"}, 350);
	},
	function(){
		$(this).stop().animate({opacity: "1"}, 125);
	});
});

// Remove line on First and Last li
$(function() {	
		$("#sidebar ul").find("li:first").css("border-top", "none");
		$("#sidebar ul").find("li:last").css("border-bottom", "none");
		
		$("#top_menu .sub-menu").find("li:first a").css("border-top", "none");
		$("#top_menu .sub-menu").find("a:last").css("border-bottom", "none");
		
});

// DROPDOWN MENU
$(function(){
	$("#top_menu li > a").addClass("cufon");
	$("#top_menu ul ul li > a").removeClass("cufon");
	Cufon.refresh();
	$("#top_menu ul ul").css({display: "none"});
	$("#top_menu ul ul ul").css({display: "none"});
	$('#top_menu ul li').hover(function(){
		$('.cufon', this).addClass("current");
		$('ul:first', this).slideDown(140);
	},
	function(){
		$('ul:first', this).slideUp(75);
		$('.cufon', this).removeClass("current");
	});
});


// PrettyPhoto Setting
$(function() {	
	$("a[rel^='prettyPhoto']").prettyPhoto({animationSpeed:'slow',theme:'dark_rounded'}); 
});
