$(document).ready(function() {
//top navig
//$("#top_navig").find("ul").hide(); //init the 0 level
$("#top_navig .main").hover(
	function(){
		$(this).find('a:first').stop().animate({
            'top':'0px'
        },{queue:false,duration:200});
//	    $(this).find('a:first').addClass('current2');
//		$(this).find("ul:first").fadeIn(200);
	},
	function(){
	    $(this).find('a:first').stop().animate({
            'top':'-28px'
        },{queue:false,duration:300});
//	    $(this).find('a:first').removeClass('current2');
//		$(this).find("ul:first").fadeOut(200);
});
	
// left navig
  $(".navigation #left_navig li").each(function(){
    var item;
    if ( $(this).find("ul").length ) {
      item = $("<span class='button'></span>").click(function(e){
        $(this)
          .parent().toggleClass("selected")
          .parent().find("ul:first").toggle("slow");
        return false;
      });
      $(this).find(".children").hide();
    } 
    $(this).children("a").prepend( item );
  });
  $(".navigation #left_navig").find("ul").hide(); //init the 0 level
  $(".navigation #left_navig .active").show();
  $(".navigation #left_navig .current").toggleClass("selected");
// left navig dodatak
$("#left_navig .main_parent").click(
    function () {
        $(this)
        .toggleClass("selected")
        .parent().find("ul:first").toggle("slow");
    }
);
//  search results toggle
$('.toggle').live('click',
  function () {
    x = $(this).parent().hasClass('closed');
    if (x==true) {
    $('.results .opened').toggleClass('opened').toggleClass('closed').find('.cont').slideToggle('slow');
    $(this).parent().toggleClass('closed');
    $(this).parent().toggleClass('opened');
    $(this).parent().find('.cont').slideToggle('fast');
//    $('html,body').animate({scrollTop: 590}, 500);
    }
});

// hover efekt za rezultate
$('.rez').live('mouseover', function() { $(this).addClass('rez_a'); })
         .live('mouseout', function() { $(this).removeClass('rez_a'); });
/* hover efekt za stavke 
$('.content_short_text').hover(	
    function(){ $(this).addClass('cst_hov');},
	function(){	$(this).removeClass('cst_hov');}
);
*/
// hover efekt za justInfo  (foto galerija - galleryCycle)
$('.justInfo').hover(
	function(){	$(this).addClass('hovered');
	$(this).find('.ji_opis').fadeIn(200);
	},
	function(){	$(this).removeClass('hovered');
	$(this).find('.ji_opis').fadeOut(200);
    }
);

// hover efekt za slideshow
$('.content-cycle .trig')
.live('mouseover',function(){ 
    $(this).parent().find('.ss-toolbar').show(); 
})
.live('mouseout',function(){ 
    $(this).parent().find('.ss-toolbar').hide(); 
});

// enlarge gumb ya slideshow
$('.ss-toolbar .enlarge').live('click', function() {
	$href= $(this).attr("rel");
	$title= $(this).attr("alt");
	Shadowbox.open({player:'img', title: $title, content: $href});
});	



}); //end
