function bigImage(path, name, num) {
    if (num > 1)
      $('#iphoto_l').show();
    if (num < $("#maxPic").val())
      $('#iphoto_r').show();
    
    if (num == 1) {
      $('#iphoto_l').hide();
    }
    if (num == $("#maxPic").val())
      $('#iphoto_r').hide();
    $('#innphoto_photo').load('/inc/gallery/ajaxBigImage.php',{ p:path, n:name, number:num});
}

function mycarousel_initCallback(carousel) {
    $('#prev_next').show();
    $('.jcarousel-scroll select').bind('change', function() {
        carousel.options.scroll = $.jcarousel.intval(this.options[this.selectedIndex].value);
        return false;
    });

    $('#nextArr').bind('click', function() {
        carousel.next();        
        return false;
    });

    $('#prevArr').bind('click', function() {        
        carousel.prev();
        return false;
    });
    
    $('#iphoto_r').bind('click', function() {
            var num = $('#pictureNum').text();
            num++;
            $('#iphoto_l').show();
            if (num == $("#maxPic").val()) {
                $('#iphoto_r').hide();
            } else {
                $('#iphoto_r').show();
            }
            var imagePass = $("#imageNum_"+num).val();
            $('#innphoto_photo').load('/inc/gallery/ajaxBigImageButton.php',{ p:imagePass, number:num});
        carousel.scroll($.jcarousel.intval(num));
        return false;
    });
    
    $('#iphoto_l').bind('click', function() {
            var num = $('#pictureNum').text();
            num--;
            $('#iphoto_r').show();
            if (num == 1) {
                $('#iphoto_l').hide();
            } else {
                $('#iphoto_l').show();
            }
            var imagePass = $("#imageNum_"+num).val();
            $('#innphoto_photo').load('/inc/gallery/ajaxBigImageButton.php',{ p:imagePass, number:num});
        carousel.scroll($.jcarousel.intval(num));
        return false;
    });
};

$(document).ready(function() {
    $('#iphoto_l').hide();
    $("#mycarousel").jcarousel({
        scroll: 5,
        visible: 5,
        initCallback: mycarousel_initCallback,
        buttonNextHTML: null,
        buttonPrevHTML: null
    });
});

$(function(){
    $('.scroll-pane').jScrollPane({showArrows:true, scrollbarWidth:7, dragMaxHeight:32});
});
$(function() {
    $(".drag").draggable({
        stack: { group: '.drag', min: 1000 },
        containment: '#main', scroll: false
    });
});
