Cufon.replace('#meni a,h1,h2,h3',{hover: true});
$(document).ready(function(){
//setInterval("slideSwitch()",5000);
$(".prelaz").css("opacity",0.7);

$(".lista a").hover(
function(){$(this).animate({backgroundColor: "#999"}, 100);}, 
function(){$(this).animate({backgroundColor: "#333"}, 400);});

$(".prelaz").hover(
function(){$(this).stop().animate({opacity: 1.0}, 400);},
function(){$(this).stop().animate({opacity: 0.7}, 100);});

$(".jqzoom").jqzoom();
$(".modal").fancybox();

$("#centar img").each(function(){
if($(this).width() > 500){$(this).css("width", 500);}
});

//intro();
});

$(function(){
$('.zamjeni').hover(
function(){$(this).attr('src', $(this).attr('src').replace(/0./, '1.'));},
function(){$(this).attr('src', $(this).attr('src').replace(/1./, '0.'));});
});

function pretrazi(upit){
  	$("#centar").load("/ajax.php?akcija=pretraga&trazi=" + escape(upit));
}

function slideSwitch() {
    var $active = $('#slideshow img.active');
    if ( $active.length == 0 ) $active = $('#slideshow img:last');
    var $next =  $active.next().length ? $active.next()
        : $('#slideshow img:first');
    $active.addClass('last-active');
    $next.css({opacity: 0.0})
        .addClass('active')
        .animate({opacity: 1.0}, 1000, function() {
            $active.removeClass('active last-active');
        });
}

function createCookie(name,value,days) {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}

function eraseCookie(name) {
	createCookie(name,"",-1);
}

function intro(){
    var $kuki = readCookie("intro");
    if(!$kuki){
        delay(3);
        $("#intro").click();
        createCookie("intro","ok",1);
    }
}
