$(document).ready(function(){

    $('.firma').each(function() {
        txt = $(this).find('img').attr('tit');
        $(this).parent().next().html(txt);
  });
    $('.gallery').each(function() {
        txt = $(this).find('img').attr('tit');
        $(this).next().html(txt);
  });

    /* ****** o firme ******* */
    $('a.firma').live('click', function(){
        url = $(this).find('img').attr('src');
        ind1 = (url.indexOf('-'))+1;
        ind2 = url.indexOf('.');
        iName = url.substr(ind1,(ind2-ind1));
        txt = $(this).find('img').attr('tit');

        $('img#photo').attr('src','images/firma/'+iName+'.jpg');
        $('span#text').html(txt);
        $('div#photoWin').removeClass('noDisplay');
        return false;
    });

    /* ****** o firme - spodna galeria ******* */
    $('div.bottomGallery a').live('click', function(){
        //alert('');
        $('img#photo').attr('src',$(this).find('img').attr('src'));
        $('span#text').html('Produkčné záhony vo firme');
        $('div#photoWin').removeClass('noDisplay');
        return false;
    });

    /* ****** sasikova ******* */
    $('a.direct').live('click', function(){
        //alert('');
        txt = $(this).find('img').attr('tit');
        $('img#photo').attr('src',$(this).find('img').attr('src'));
        $('span#text').html(txt);
        $('div#photoWin').removeClass('noDisplay');
        return false;
    });

    /* ****** uplatnenie trvaliek ******* */
    $('a.gallery').live('click', function(){
        url = $(this).find('img').attr('src');
        ind1 = (url.indexOf('-'))+1;
        ind2 = url.indexOf('.');
        iName = url.substr(ind1,(ind2-ind1));
        txt = $(this).find('img').attr('tit');

        $('img#photo').attr('src','images/uplatnenie/'+iName+'.jpg');
        $('span#text').html(txt);
        $('div#photoWin').removeClass('noDisplay');
        return false;
    });

    /* ****** vsetky galerie ******* */
    $('div#photoWin').live('click', function(){
        $(this).addClass('noDisplay');
        $('img#photo').attr('src','images/spacer.gif');
        $('span#text').html('');
    });



 });












