// Galéria linkek kigyűjtése
$().ready(function() {
    $( '.galeria_kapcsolo img' ).each( function(i) {
       $( this ).addClass( 'galeria_link' );
    } )
   $('.galeria_kapcsolo').each( function(i){
        var show = $(this);
        var hide = $(this);
        var url = $('base').attr('href');
        url = url.substring(0, url.length-1);
        url += $(this).attr('href');
        var target = $('#galeria');
        $(this).attr('href', 'javascript:;');
        $( this ).children('img').click( function() {
            $('#galeria_kontener').empty();
            $('#galeria_kontener').html('<div class="jqmWindow" id="galeria"></div>');
            $('#galeria').jqm({
                ajax: url
            }).jqmShow();
            $('#thumbs').jcarousel();
        });
   });
});

$(document).ready( function() {
    $('#desc img').not( '.freestyler' ).not( '.post_sablon_ikon' ).not( '.kovetkezo_lepes' ).each( function(i) {
        if ( $(this).attr('align') == 'left' && $( this ).attr( 'class' ) == 'galeria_link' ) {
            $(this).css('margin', '5px 10px 5px 0px');
            $(this).css('padding-bottom', '20px');
        }
        else if ( $(this).attr('align') == 'left' ) {
            $(this).css('margin', '5px 10px 5px 0px');
        }
        else if ( $(this).attr('align') == 'right' && $( this ).attr( 'class' ) == 'galeria_link' ) {
            $(this).css('margin', '5px 0px 5px 10px');
            $(this).css('padding-bottom', '20px');
        }
        else if ( $(this).attr('align') == 'right' ) {
            $(this).css('margin', '5px 0px 5px 10px');
        }
        else if ( $( this ).attr( 'class' ) == 'galeria_link' ) {
            $(this).css('margin', '5px 0px 5px 0px');
            $(this).css('padding-bottom', '20px');
        }
        else {
            $(this).css('margin', '5px 0px 5px 0px');
        }
    });
});

function setNewImage(filename, caption) {
    $('#galeria_big img').attr('src', filename);
    $('#galeria_big img').attr('alt', caption);
    $('#galeria_big img').attr('title', caption);
    $('#galeria_szoveg').text(caption);
}

