$(document).ready(function() {
    $("a[rel='gallery']").colorbox({
        transition:"fade"
    });
});

function doLogin() {
    var login_input = $('#login_input');
    var pass_input = $('#pass_input');

    if (login_input.val() == '' || pass_input.val() == '') {
        return false;
    } else {
        return true;
    }
}

function viewTownInfo() {
    var selected = $("#viewTownInfo :selected").val();
    if (selected) {
        window.location = '/pl/galeria/'+selected;
    }
}
function viewPromotion(promo_url) {
    window.location = '/pl/promocje/'+promo_url;
}

function toggle(id) {
    $("#"+id).toggle();
}

function ad_gallery_int(gWidth, gHeight) {
    var ad_Width    = (gWidth != undefined) ? gWidth : 775;
    var ad_Height   = (gHeight != undefined) ? gHeight : 550;
    
    $('.ad-gallery').adGallery({
        width: ad_Width,
        height: ad_Height,
        animate_first_image: true, // Should first image just be displayed, or animated in?
        animation_speed: 700, // Which ever effect is used to switch images, how long should it take?
        display_next_and_prev: true, // Can you navigate by clicking on the left/right on the image?
        display_back_and_forward: true, // Are you allowed to scroll the thumb list?
        scroll_jump: 0, // If 0, it jumps the width of the container
        slideshow: {
            enable: true,
            autostart: true,
            speed: 4000,
            start_label: 'Start',
            stop_label: 'Stop',
            stop_on_scroll: true, // Should the slideshow stop if the user scrolls the thumb list?
            countdown_prefix: '(', // Wrap around the countdown
            countdown_sufix: ')',
            onStart: function() {
              // Do something wild when the slideshow starts
            },
            onStop: function() {
              // Do something wild when the slideshow stops
            }
        },
        effect: 'fade', // or 'slide-vert', 'resize', 'fade', 'none' or false
        enable_keyboard_move: true, // Move to next/previous image with keyboard arrows?
        cycle: true // If set to false, you can't go from the last image to the first, and vice versa
        // All callbacks has the AdGallery objects as 'this' reference
    });
}
