$('html').addClass('js');


//************************ GLOBAL ***/
$(function(){

//************************ Flash header ***/
var flashvars = false;
var params = {
  wmode: "transparent"
};
var attributes = false;

swfobject.embedSWF($("#flash-header").attr("rel"), "flash-header", "948", "333", "9.0.0", "", flashvars, params, attributes);


//************************ Cufon ***/
Cufon.replace('#page-home .box h2, #nav-section h2, #content-supp h3');


//************************ Lightbox ***/
$("#content-supp .fancybox").lightBox();
$("#list-t01 li").each(function(){
    $(this).find(".fancybox").lightBox();
});




//************************ Block link ***/
$('#slider li').click(function(){
  window.location = $('h3 a', $(this)).attr('href');
});

});


//************************ References slideshow ***/
$(function(){

var slide = $('#slider li').outerWidth(true);
var slideAmount = $('#slider li').length;
var slideContainer = $('#slider ul');

slideContainer.css({ 'width':slide*slideAmount });
$('#slider li:first-child').addClass('first-visible');
$('#slider li:nth-child(3)').addClass('last-visible');
$('#slider').append('<div class="ctrl"><a class="prev">Prethodna</a><a class="next">Sljedeća</a></div>');
$('#slider .ctrl a').click(function(){ sliderControls( $(this).attr('class') ) });

function sliderControls(sliderControl){
  if (sliderControl === 'next') {
    if ( $('#slider .last-visible').nextAll().length === 0 ) {
      $('#slider li:first-child').addClass('first-visible').siblings().removeClass('first-visible');
      $('#slider li:nth-child(3)').addClass('last-visible').siblings().removeClass('last-visible');
      slideContainer.animate({ marginLeft: 0 });
    } else {
      $('#slider .last-visible').removeClass('last-visible').next().addClass('last-visible');
      $('#slider .first-visible').removeClass('first-visible').next().addClass('first-visible');
      slideContainer.animate({ marginLeft: -(slide-parseInt(slideContainer.css('margin-left'))) });
    }
  } else if (sliderControl === 'prev') {
    if ( $('#slider .first-visible').prevAll().length === 0 ) {
       $('#slider li:last-child').addClass('last-visible').siblings().removeClass('last-visible');
       $('#slider li:eq('+($('#slider li').prevAll().length-(3-1))+')').addClass('first-visible').siblings().removeClass('first-visible');
       slideContainer.animate({ marginLeft: -(slide*($('#slider li:last-child').prevAll().length-(3-1))) });
    } else {
       $('#slider .first-visible').removeClass('first-visible').prev().addClass('first-visible');
       $('#slider .last-visible').removeClass('last-visible').prev().addClass('last-visible');
       slideContainer.animate({ marginLeft: parseInt(slideContainer.css('margin-left'))+slide });
    }
  }
}

});


//************************ IE6 ***/
$(function(){

if(typeof document.body.style.maxHeight === 'undefined') {
  
  
  DD_belatedPNG.fix('#nav-section, #nav-section div, .thumb span');
  
  
  $('#nav-main li, #slider li, .box-t01 .gallery li').hover(function(){
    $(this).addClass('hover');
  }, function(){
    $(this).removeClass('hover');
  });
  
  
}

});

