// JavaScript Document
$(document).ready(function(){
    if($('.gallery').height()<$('#inside_contents').height())
        $('.gallery').height($('#inside_contents').height()+10);
    ///////////////////////////////////////////////////////////////
    if($('.gallery').height()<$('#inside_contents_contact').height())
        $('.gallery').height($('#inside_contents_contact').height());
    ///////////////////////////////////////////////////////////////
    $('#mycarousel').jcarousel({
        auto: 2,
        wrap: 'last',
        easing:'swing',
        animation:1500,
        initCallback: mycarousel_initCallback
    });	 
    
    $(".bounceEaseIn").hover(function(){
        $(this).stop();
        $(this).animate({
            "top": "-=10px"
        },{
            queue:false,
            duration:800,
            easing:"easeOutElastic"
        })
    },
    function () {
        $(this).stop();
        $(this).animate({
            "top": "0"
        },{
            queue:false,
            duration:800,
            easing:"easeOutElastic"
        });
    });

    
    $(".elasticEaseIn").hover(function(){
        $(this).stop();
        $(this).animate({
            "left": "+=10px"
        },{
            queue:false,
            duration:800,
            easing:"easeOutElastic"
        })
    },
    function(){
        $(this).stop();
        $(this).animate({
            "left": "0"
        },{
            queue:false,
            duration:800,
            easing:"easeOutElastic"
        });
    });

    ///////////////////////////////////////////////////////////////////////////////////////////////
    $("div#menu .top a.top-par").hover(function () {        
        /*var cssObj = {
            'background' : 'url(images/menu_item_bg.png)0px 0px no-repeat',
            'color':'#fff'
        };*/
        //$(this).css(cssObj);
        /*cssObj = {
            'color':'#99211f'
        };*/
        //$('a.top-par span').css(cssObj);
        //$('a.top-par').addClass("top-par-menu_add");
        }, function () {
        /*var cssObj = {
            'background' : 'url(images/menu_item_bg.png)0px 0px no-repeat',
            'font-weight' : 'bolder'
        }*/
        //$(this).css(cssObj);
        /*cssObj = {
            'color' : '#fff'
        };*/
        //$('a.top-par span').css(cssObj);
        //$('a.top-par').removeClass("top-par-menu_remove");
        });
    ///////////////////////////////////////////////////////////////////////////////////////////////////////////////
    $(".menu_item").hover(function () {
        //var par=$(this).parents('.top');
        /*var par=$('div#menu .top');
        var cssObj = {
            'background' : 'url(images/menu_item_bg.png)0px 0px no-repeat'
        };
        $('a.top-par',par).css(cssObj);
        cssObj = {
            'color':'#99211f'
        };*/
        //$('a.top-par span',par).addClass("top-par-menu_add");
        }, function () {
        /* var cssObj = {
            'background' : 'url(images/menu_item_bg.png)0px 0px no-repeat',
            'font-weight' : 'bolder'
        }
        //	  var par=$(this).parents('.top a')
        var par=$('div#menu .top');
        $('a.top-par',par).css(cssObj);
        cssObj = {
            'color' : '#fff'
        };*/
        //$('a.top-par span',par).removeClass("top-par-menu_remove");
        });
    /////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    $("input,textarea").not('input[type=submit]').each(function() {
        var default_value = this.value;
        $(this).focus(function() {
            if(this.value == default_value) {
                this.value = '';
            }
        });
        $(this).blur(function() {
            if(this.value == '') {
                this.value = default_value;
            }
        });
    });
    //////////////////////////////////////////////////////////////////////////////////////////////////////////////
    $(".up_down").hover(function(){
        $(this).stop();
        $(this).animate({
            "top": "-=50px"
        },{
            queue:false,
            duration:500,
            easing:"easeInSine"
        });
    },function(){
        $(this).stop();
        $(this).animate({
            "top": "0"
        },{
            queue:false,
            duration:500,
            easing:"easeInSine"
        });
    });
    ///////////////////////////////////////////////////////////////////////////////////////////////////////////////
    function mycarousel_initCallback(carousel)
    {
        // Disable autoscrolling if the user clicks the prev or next button.
        carousel.buttonNext.bind('click', function() {
            carousel.startAuto(1);
        });

        carousel.buttonPrev.bind('click', function() {
            carousel.startAuto(1);
        });

        // Pause autoscrolling if the user moves with the cursor over the clip.
        carousel.clip.hover(function() {
            carousel.stopAuto();
        }, function() {
            carousel.startAuto();
        });
    }
    //////////////////////////////////////////////////////////////////////////////////////////////////
    $("#btn_next").hover(function(){
        $(".slider_text").stop();
        $(".slider_text").animate({
            "left": "+=10px"
        },{
            queue:false,
            duration:800,
            easing:"easeOutElastic"
        })
    },
    function () {
        $(".slider_text").stop();
        $(".slider_text").animate({
            "left": "0"
        },{
            queue:false,
            duration:800,
            easing:"easeOutElastic"
        });
    });
    /////////////////////////////////////////////////////////////////////////////////////////////////
    /*$("li.bottom_menu_child").hide();
	$("bottom_menu_parent").click(function () {
      $(this).children("ul").show();
    });*/
    $("#bottom_menu_parent li ul").hide();
    $("#bottom_menu_parent li").hover(
        function () {
            $(this).children("ul").show("slow");
        },function(){
            $(this).children("ul").hide("slow");
        });
    //////////////////////////////////////////////////////////////////////////////////////////////////////
    $('#search_icon').click(function(){
        $(this).parent().submit();
    })
    //////////////////////////////////////////////////////////////////////////////////////////////////////
    $('#submit').click(function() {
        
        });
//////////////////////////////////////////////
//$('.menu ul').css('opacity',0.9);
///////////////////////////////////////////
    $("div#menu ul ul a").last().addClass('last');
//////////////////////////////////////////////////////////
    $("div#menu ul ul ul a").last().addClass('last');
//////////////////////////////////////////////////////////
});
