$(function(){

	// animated jump to
  $('a[href*=#]').click(function() {
		$(this).blur();
		if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) {
		  var $target = $(this.hash);
		  $target = $target.length && $target || $('[name=' + this.hash.slice(1) +']');
		  if ($target.length) {
				var targetOffset = $target.offset().top - 30;
				$('html,body').animate({scrollTop: targetOffset}, 1000);
				return false;
		  }
		}
  });

	// jump to top
	/*
	$('#content').append('<p class="nav"><a href="#" class="gore">Skoči gore</a></p>');
	$('.nav .gore').click(function() { 
		this.blur();
		$('html').animate({scrollTop: 0}, '400');
		return false;
	});
	*/

	// rel="external" otvori u novom prozoru
	$('a[rel="external"]').click(function() {
     window.open($(this).attr('href'));
     return false;
   });

	// prettyOverlay
	$("a[rel^='prettyOverlay'], a[rel^='prettyPhoto']").prettyPhoto({
		animationSpeed: 'normal', /* fast/slow/normal */
		padding: 40, /* padding for each side of the picture */
		opacity: 0.35, /* Value betwee 0 and 1 */
		showTitle: true, /* true/false */
		allowresize: true, /* true/false */
		counter_separator_label: '/' /* The separator for the gallery counter 1 "of" 2 */
	});

	// PDF ikonice
	$('a').each(function() {
		if ($(this).attr('href').match(/\.pdf$/)) {
			if (!$(this).find("img")[0]) $(this).addClass('pdf');
		}
	});

	// tooltipovi
	$("*[title]").tooltip({
	    //bodyHandler: function() { 
			//	return 'bla';
	    //}, 
	    track: true,
	    delay: 0,
	    showURL: false,
	    showBody: " - "
	    //opacity: 0.85
	});
	
});

