$(document).ready(function() {

	// #################################
	// MENU ANIMATING
	// #################################
	$(" #navigation ul ul ").css({display: "none"});
	
	$(" #navigation li").hover(function(){
		$(this).find('ul:first').css({visibility: "visible",display: "none"}).show(200);
		
		},function(){
		
			$(this).find('ul:first').css({visibility: "hidden"});
	});

	// #################################
	// MENU ACTIVE ON SUBMENU HOVER
	// #################################
	$("#nav ul ul").hover(function () {
		$(this).parent().addClass("hover");
		},
		function() {
			$("#nav ul li").removeClass("hover");
		});

	// #################################
	// CONTENT TOGGLE
	// #################################
	$(".toggle_div").hide(); 
			
	$("h6.toggle").toggle(function(){
		$(this).addClass("active");
		}, function () {
		$(this).removeClass("active");
	});

	$("h6.toggle").click(function(){
		$(this).next(".toggle_div").slideToggle();
	});
  
	// #################################
	// TO TOP BUTTON
	// #################################
	jQuery('.backtotop').click(function(){
		jQuery('html, body').animate({scrollTop:0}, 'slow');
	});
	
    // ON MOUSE OVER
    $(".btn").hover(function () {

        // SET OPACITY TO 100%
        $(this).stop().animate({
        opacity: 0.6
        }, "fast");
    },

    // ON MOUSE OUT
    function () {

        // SET OPACITY BACK TO 100%
        $(this).stop().animate({
        opacity: 1
        }, "fast");
    });
    
    // #################################
	// BOOKMARK
	// #################################
    
    $('a.icon.bookmark').jBrowserBookmark({
        language : {
            'en' : ['Press [key] + ', ' to bookmark this page.']
        },
        defaultLanguage : 'en',
    }, 'en' );
	
    // #################################
	// BACK TO TOP BUTTON
	// #################################
    
    $(window).scroll(function() {
		if($(this).scrollTop() != 0) {
			$('#btn_backtotop').fadeIn();	
		} else {
			$('#btn_backtotop').fadeOut();
		}
	});
 
	$('#btn_backtotop').click(function() {
		$('body,html').animate({scrollTop:0},800);
	});
		
}); // END OF DOCUMENT READY
