//var urlAkcija = "akcija.php";//lokalno
var urlAkcija = "/akcija.php";//server


function showSearch(str, jezik) {
	
	var str = str.replace(/ /g, "+")
	$("#saytdisplay").load("/pretragaAjax.php?rec="+ str +"&jezik=" + jezik +"");

}


function pengerSize() {
  var myWidth = 0, myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
	//Non-IE
	myWidth = window.innerWidth;
	myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
	//IE 6+ in 'standards compliant mode'
	myWidth = document.documentElement.clientWidth;
	myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
	//IE 4 compatible
	myWidth = document.body.clientWidth;
	myHeight = document.body.clientHeight;
  }
  
  $("#footer_new").css({'width' : myWidth-50, 'margin-left' : 15});
  $("#footer_new > .hold").css({'width' : myWidth-50-32});
  
  document.cookie = "123_height="+(myHeight-60);
  
}

function lightview_options(pagewidth, page) {

	var d = document.getElementById('okvir-glavni-hold');
  	var dh = d.offsetHeight;
  
  	$("#hold_back").css({'height' : dh+50, 'opacity' : 0.8});	
	
	var margin_left = -pagewidth/2;

	$("#hold").css({'width' : pagewidth-0, 'margin-left' : margin_left});
	$(".close").css({'margin-left' : pagewidth-50});
	
 	$("#hold_back").fadeIn("slow");
	$("#hold").fadeIn("slow");
	
	//$('body').css('overflow', 'hidden');
	
	$("object").fadeOut("fast");
	
	 $.getScript("/java/jquery.ajax.js", function(){										
		$('#load_ajax').load(page);	
	});
  
}


function vote (id, jezik) {
	
	$('.bookmark').html('<div class="hvala" style="background-image:url(/okvir/glasaj'+jezik+'.gif);"></div><div class="text"><a href="/naj/glasovi">rezultate glasanja možete pogledati ovde</a></div>');
	
	$.post(urlAkcija, {strana: 'vote', ID: id, jezik: jezik},
		function(data) {
			
			if (data) {

				//$('#baner-top').html(data);

			} 
			
		}
	);
	
}


function showForm (id, tip) {

	$(id).fadeIn(tip);
	
}


function hideForm (id, tip) {

	$(id).fadeOut(tip);
	
}




$(document).ready(function(){
						  
						   
	//brise ajax cash
	$.ajaxSetup ({
		cache: false
	});

	//za footer_new
	pengerSize();
	
	//zatvara lightview
	$('.close')
	.click(function(){
		$("#hold_back").fadeOut("slow");
		$("#hold").fadeOut("slow");
		//$('body').css('overflow', 'auto');
		$("object").fadeIn("fast");
	});

	//za refleksiju
	Reflection.defaultHeight = .25;
	Reflection.defaultOpacity = .35;
	
	//provera forme
	$("#komentari-formular").validate();
	
	//promena sifre
	$('.promena-sifre')
	.click(function(){
	javascript:ajaxpage('/zamenaSifre.php', 'sifra_slika');
	});
	
	//pravi skroll strane
	$('a')
	.click(function(){
	$("html").animate({scrollTop:0}, 'slow'); 
	});
	
	//dodaje ivice na box
	$(".box10").corner("10px");

	

});