$(document).ready(function() {
        $('#panels .tabs span[rel]').click(function() {
            var rel = ($(this).attr('rel'));
            showPanel(rel);
        });
        $('#panels table td.next[rel]').click(function() {
            var rel = ($(this).attr('rel'));
            showPanel(rel);
        });
        $('#panels table td.prev[rel]').click(function() {
            var rel = ($(this).attr('rel'));
            showPanel(rel);
        });

        function showPanel(rel) {
            for(var i = 1; i <= 4; i++) {
                if(i == rel) 
                    $('#panels .tab'+i).css('display','block');
                else
                    $('#panels .tab'+i).css('display','none');
            }
        }

       $('#panels a.pkamera').each(function() {
            var rel = ($(this).attr('rel'));
            if ($.browser.msie)  {
               in_iframe(this,555,360,'cont_pkamera'+rel,'#panels');
            } else {
               in_iframe(this,555,340,'cont_pkamera'+rel,'#panels');
            }
       });

       $('#panels a.pimage').each(function() {
            var rel = ($(this).attr('rel'));
            if ($.browser.msie)  {
               in_border(this,'cont_pkamera'+rel,'#panels');
            } else {
               in_border(this,'cont_pkamera'+rel,'#panels');
            }
       });
});

function in_border(id,cont_id,after,contcss)
{
    $(id).click(function() {
        var t = this.title || this.name || null;
        TB_show(t,this.href+'&outw=1500&_type=.jpg',false, this); // _type je kvuli thickboxu
    	id.blur();
        return false;
    });
}

