﻿function menuSunken(elementName) {
    $(elementName).animate({ 'backgroundColor': '#400202' });
}
function menuNormal(elementName) {
    $(elementName).animate({ 'backgroundColor': '#A21414' });
}
$.easing.bouncy = function (x, t, b, c, d) {
    var s = 1.70158;
    if ((t /= d / 2) < 1) return c / 2 * (t * t * (((s *= (1.525)) + 1) * t - s)) + b;
    return c / 2 * ((t -= 2) * t * (((s *= (1.525)) + 1) * t + s) + 2) + b;
}

// create custom tooltip effect for jQuery Tooltip
$.tools.tooltip.addEffect("bouncy",
	    function (done) {
	        this.getTip().animate({ top: '+=5' }, 1500, 'bouncy', done).show();
	    },
	    function (done) {
	        this.getTip().animate({ top: '-=20' }, 1500, 'bouncy', function () {
	            $(this).hide();
	            done.call();
	        });
	    });



	    $(document).ready(function () {
	        $('.CurrentPage').parent().css('background-color', '#400204');

	        $.clock.locale.ro = {
	            "weekdays":["Duminica", "Luni", "Marti", "Miercuri", "Joi", "Vineri", "Sambata"],
	            "months": ["Ianuarie", "Februarie", "Martie", "Aprilie", "Mai", "Iunie", "Iulie", "August", "Septembrie", "Octombrie", "Noiembrie", "Decembrie"]
	        };

	        $("div#clock").clock({ "langSet": "ro" });

	        /*$('#menu').hide();
	        $('#newsband').hide();
	        $('#wrapper').hide();
	        $('#footer').hide();

	        $('#wrapper').delay(1000).fadeIn(400);
	        $('#footer').delay(1000).fadeIn(400);
	        $('#menu').delay(2000).slideToggle(400);
	        $('#newsband').delay(3000).slideToggle(400);*/

	        //Image Thumbnails opacity trigger
	        $('ul.thumbnails li').hover(function () {
	            $('img', this).stop().animate({ opacity: 1 });
	        }, function () {
	            $('img', this).stop().animate({ opacity: 0.5 });
	        });

	        $('#lava>ul>li').hover(function () {
	            $(this).stop().animate({ 'backgroundColor': '#400202' });
	        }, function () {
	            $(this).stop().animate({ 'backgroundColor': '#A21414' });
	        });

	        /*$("#slide1").tooltip({ position: 'bottom center', effect: 'slide', predelay: '1000' });
	        $("#slide2").tooltip({ position: 'bottom center', effect: 'slide', predelay: '1000' });
	        $("#slide3").tooltip({ position: 'bottom center', effect: 'slide', predelay: '1000' });
	        $("#slide4").tooltip({ position: 'bottom center', effect: 'slide', predelay: '1000' });
	        $("#slide5").tooltip({ position: 'bottom center', effect: 'slide', predelay: '1000' });*/

	        $(".scrollable").scrollable({ circular: true });

	        //transitions
	        //for more transition, goto http://gsgd.co.uk/sandbox/jquery/easing/
	        var style = 'jswing';

	        //Retrieve the selected item position and width
	        var default_left = Math.round($('#lava>ul>li.selected').offset().left - $('#lava').offset().left);
	        var default_width = $('#lava>ul>li.selected').width();

	        //Set the floating bar position and width
	        $('#box').css({ left: default_left });
	        $('#box .head').css({ width: default_width });

	        //if mouseover the menu item
	        $('#lava>ul>li').hover(function () {

	            //Get the position and width of the menu item
	            left = Math.round($(this).offset().left - $('#lava').offset().left);
	            width = $(this).width();

	            //Set the floating bar position, width and transition
	            $('#box').stop(false, true).animate({ left: left }, { duration: 1000, easing: style });
	            $('#box .head').stop(false, true).animate({ width: width }, { duration: 1000, easing: style });


	            //if user click on the menu
	        }).click(function () {

	            //reset the selected item
	            $('#lava>ul>li').removeClass('selected');

	            //select the current item
	            $(this).addClass('selected');

	        });

	        //If the mouse leave the menu, reset the floating bar to the selected item
	        $('#lava').mouseleave(function () {

	            //Retrieve the selected item position and width
	            default_left = Math.round($('#lava>ul>li.selected').offset().left - $('#lava').offset().left);
	            default_width = $('#lava>ul>li.selected').width();

	            //Set the floating bar position, width and transition
	            $('#box').stop(false, true).animate({ left: default_left }, { duration: 1500, easing: style });
	            $('#box .head').stop(false, true).animate({ width: default_width }, { duration: 1500, easing: style });

	        });

	    });
