$(document).ready(function(){

  /* Text input behaviour   */
  var textInputs = $('input.text, textarea');
  textInputs
    // Store default values
    .each (function () {
      $(this).data ('default', {value: $(this).val()});
    })
    // Clear element on focus if default value
    .focus (function () {
      if ($(this).val () === $(this).data ('default').value) {
        $(this).val ('');
      }
    })
    // Restore element on blur if empty
    .blur (function () {
      if ($(this).val () === '') {
        $(this).val ($(this).data ('default').value);
      }
    });
	
	timer = 0;
    var _timer = setInterval(function() {
		timer++;
        if (timer == 50) {
			clearInterval(_timer);
			tmp=parseInt($('#navigation5 ul').height());
			if(tmp>290) {
				tmp+=200;
				$('#navigation5').css("height",tmp+"px");
			}
			tmp=parseInt($('#navigation4 ul').height());
			if(tmp>290) {
				tmp+=200;
				$('#navigation4').css("height",tmp+"px");
			}
			tmp=parseInt($('#navigation2 ul').height());
			if(tmp>290) {
				tmp+=200;
				$('#navigation2').css("height",tmp+"px");
			}
			tmp=parseInt($('#navigation3 ul').height());
			if(tmp>290) {
				tmp+=200;
				$('#navigation3').css("height",tmp+"px");
			}
			tmp=parseInt($('#navigation ul').height());
			if(tmp>290) {
				tmp+=200;
				$('#navigation').css("height",tmp+"px");
			}
			/*if ($(window).height() > $("#content").height()+199+$("#footer").height()-$("#footer2").height()-$("#footer3").height()) {
				$("#content").height($(window).height()-238-$("#footer").height()-$("#footer2").height()-$("#footer3").height());
			}*/
			$("#forma").show();			
        }
    }, 10);
	
	$("div#content a[rel^='prettyPhoto']").prettyPhoto({theme:'dark_rounded'});
	

});

function checkMe(ulaz) {
	var filter = /^([a-zA-Z0-9_.-])+@(([a-zA-Z0-9-])+.)+([a-zA-Z0-9]{2,4})+$/;
	if (!filter.test(ulaz)) {
		alert('Molimo upišite ispravnu email adresu!');
		return false;
	}
	else {
		return true;
	}
}