$(document).ready(function () {
  $('.JSbutton').bind('click', function () {
    return buttonClicked(this);
  });
});


var sOpenedContentId = '';

function buttonClicked(elm)
{
  var obj = elm;
  var id;
  id = $(obj).attr('id');
  if (sOpenedContentId != '')
  {
    $('#JScontent'+sOpenedContentId).hide('slow');
    $('#'+sOpenedContentId).removeClass('btn-selected');
  }

  if (sOpenedContentId == id)
  {
    sOpenedContentId = '';
    return false;
  }

  sOpenedContentId = id;

  $('#JScontent'+id).show('slow');
  $(obj).addClass('btn-selected');
  

  return false;
}


$(document).ready(function() {
    $("a[rel=fotogalery]").fancybox({
            'transitionIn'		: 'none',
            'transitionOut'		: 'none',
            'titlePosition' 	: 'over',
            'titleFormat'		: function(title, currentArray, currentIndex, currentOpts) {
                    return '<span id="fancybox-title-over">Image ' + (currentIndex + 1) + ' / ' + currentArray.length + (title.length ? ' &nbsp; ' + title : '') + '</span>';
            }
    });
});



