$(document).ready(function(){
//PADAJUCE ZASTAVE I IZBOR JEZIKA
	$(".dropdown dt a").click(function() {
		$(".dropdown dd ul").toggle();
	});
	
	$(".dropdown dd ul li a").click(function() {
		var text = $(this).html();
		$(".dropdown dt a span").html(text);
		$(".dropdown dd ul").hide();
	
	});
	
	function getSelectedValue(id) {
		return $("#" + id).find("dt a span.value").html();
	}
	
	$(document).bind('click', function(e) {
		var $clicked = $(e.target);
		if (! $clicked.parents().hasClass("dropdown"))
			$(".dropdown dd ul").hide();
	});

});



//---------------------------------PROZOR ZA DETALJE
function modal_info(arg,h,w) {
$("#div_info").dialog({
		height: h,
		width: w,
		modal: true,
		title: arg,
		buttons: {
			Ok: function() {
				$( this ).dialog("close");
			}
		}
	});
}

function modal_details(arg,action,h,w){
	$.ajax({
	type: "POST",
	encoding:"UTF-8",
	url: "includes/ajax/ajax_sistem.php",
	async: false,
	//cache: false,
	data: "action="+action+"&id="+arg,
	timeout: 2000,
    	error: function(){
        $("#div_info").html('<i>Ne postoje dodatne informacije vezane za upit.</i>');
		},
		success: function(msg) {
		var ms=msg.split("#x#");
		$("#div_info").html(ms[1]);
		modal_info(ms[0],h,w);
}
});
}//kraj funkcije

//PRAZAN LINK OD FAVORITESA
function no_compare(b,t){
		$("#div_info").html('<div class="modal_body">'+b+'</div>');
		modal_info(t,180,350);
}
//LOGIN APARTMANA
function pop_user() {
	$("#div_info").html("");
	$("#div_info").load('../includes/pop-ups/pop-users.php');
	modal_info("Log-in vlasnika apartmana",260,380);
}
