
$(document).ready(function(){

	$("a[href^='http://']").attr("rel", "nofollow").attr('target', '_blank');
	
	$("a.fancybox").fancybox({
		'zoomOpacity' : true,
		'zoomSpeedIn': 300,
		'zoomSpeedOut': 300,
		'overlayShow': false
	});

	$("form").each(function(){
		var $that = $(this);
		$that.submit(function(){
			$that.find("input[type='image'],input[type='submit']").attr("disabled", "disabled")
		});
	});

	$("#header .message").ajaxStart(function(){
		$(this).stop(true, true).text("Molim sačekajte.").fadeIn("fast")
	});

	$("#header .message").ajaxStop(function(){
		$(this).stop(true, true).fadeOut("normal")
	});

	
	$("a, span").hover(function(){
		$("#header .message").text($(this).attr("alt"));
		$("#header .message").stop(true, true).fadeIn("fast")
	}, function(){
		$("#header .message").text("");
		$("#header .message").stop(true, true).fadeOut("normal")
	});

	$("#header").data("up", 0);

	$("div.toggle-header").click(function () {
		var $header = $("#header")
		var $body_title = $("#body_title")
		if ($header.data("up") == 0) {
			$header.stop(true, true).animate({top: "-130px"}).data("up", 1);
			$body_title.stop(true, true).animate({marginTop: "10px"});
			$(this).css("background-position", "top center");
		} else {
			$header.stop(true, true).animate({top: "0px"}, "fast").data("up", 0);
			$body_title.stop(true, true).animate({marginTop: "110px"}, "fast");
			$(this).css("background-position", "bottom center");
		}
	});

});
