﻿$(function() {

    $(function() {
        $('#gallery a').lightBox({ fixedNavigation: false });
    });

    $(function() {
        $("#gallery").draggable({ containment: '#wrapper' });
    });

    $("#gallery img").mouseover(function() {
        $(this).stop();
        $(this).animate({
            width: "75px"
        }, 300);
    });

    $("#gallery img").mouseout(function() {
        $(this).stop();
        $(this).animate({
            width: "35px"
        }, 100);
    });

    $("#btnfood").click(function() {
        $('.food').toggle('blind');
    });
    $("#btnshop").click(function() {
        $('.shop').toggle('blind');
    });
    $("#btnall").click(function() {
        $('.food , .shop').toggle('blind');
    });

    $('#btnfood').toggle(
                function() { $(this).attr("value", "foodを表示"); },
	            function() { $(this).attr("value", "foodを非表示"); }
	        );

    $('#btnshop').toggle(
                function() { $(this).attr("value", "shopを表示"); },
                function() { $(this).attr("value", "shopを非表示"); }
           );

    $('#btnall').toggle(
                function() { $(this).attr("value", "すべてを表示"); },
                function() { $(this).attr("value", "すべてを非表示"); }
           );

    $('#up').click(function() {
        var top = $('#gallery').css("top");

        top = parseInt(top.replace("px", ""));
        top = top + 200;
        if (top >= 0) { top = 0 };

        $('#gallery').animate({ top: top + "px" }, 200)
    });

    $('#down').click(function() {
        var top = $('#gallery').css("top");

        top = parseInt(top.replace("px", ""));
        top = top - 200;
        if (top <= -1092) { top = -1092 };

        $('#gallery').animate({ top: top + "px" }, 200)
    });

    $('#right').click(function() {
        var leftValue = $('#gallery').css("left");
        if (leftValue != "auto") {
            $('#gallery').animate({ left: "-250px" }, 200);
        };
    });

    $('#left').click(function() {
        $('#gallery').animate({ left: "0px" }, 200)
    });
});        
