	
$(function() //document loaded
{
     $(".sifr").sifr({font: homeurl+'/fonts/Franklin_Gothic_Medium.swf'});   //SIFR font

	// load tabs
	$('#index-tabs').tabs(
	{
	fx: [{opacity:'toggle', duration:'normal'},   // hide option
      {opacity:'toggle', duration:'fast'}] ,
    show: function(event, ui) {
		if (ui.index==2)
		{
//		var id = ui.panel.attr("id");
		var panel_id = ui.panel.id;
		
			$('#'+panel_id+" .jsd").each(function() 
			{
		    var item =	$(this).next(".auto-button");
			item.	position({
					my: "left top",
					at: "right top",
					of: $(this),
					offset: "-1 0"
				})
			
			});
		//	$(this).removeClass("new_message");
		}
	}
   });		


	$("#j_baza").combobox();
	$("#j_min_stopa").combobox();
	$("#j_godina_proizvodnje").combobox();
	$("#j_marka_model").combobox();

$('#jed_napredno').click(function() {
    $('#search_jedrilice').attr("action",'jedrilice_napredno.php');
    $('#search_jedrilice').submit();
});

});

	$(function() {
		
		$("#a_mjesto").autocomplete({
			source: function(request, response) {
				$.ajax({
					url: "functions/check_cities.php",
					dataType: "json",
					data: {
						maxRows: 4,
						name_startsWith: request.term
					},
					success: function(data) {
						response($.map(data, function(item) {
						
							return {
								label: '<b>'+$.base64Decode(item.name)+'</b><br>'+$.base64Decode(item.zupanija_full)+' županija',
								value: $.base64Decode(item.name)
							}
						}))
					}
				})
			},
			minLength: 2,
			open: function() {
				$(this).removeClass("ui-corner-all").addClass("ui-corner-top");
			},
			close: function() {
				$(this).removeClass("ui-corner-top").addClass("ui-corner-all");
			}
		});
	});

	

$(document).ready(function() {



$("#search_jedrilice").validate({
		rules: {
			j_min_stopa: {
				number: true
			},
			j_godina_proizvodnje: {
				number: true
			}
		},
		messages: {
			j_min_stopa: "<br>Molim upišite minimalnu duljinu jedrilice u stopama (<i>Broj</i>)",
			j_godina_proizvodnje: "<br>Molim upišite minimalnu godinu proizvodnje jedrilice (<i>Broj</i>)"
		}
	});
});





	


