  $(document).ready(function() {
  /*
  $('#addressInput').focus(function() {
	if($(this).val()=="Enter Zip or Address"){
		$(this).val("");
	}
    }).blur(function(){
		if($(this).val()==""){
		$(this).val("Enter Zip or Address");
	}
	});
	*/
});

function filter(){
	$("#filter, #entries").slideDown('fast');
}
function results(){
	var n = $("#sidebar").children().length;
	$(".numresults").html("Au fost gasite <span class='bright'>" + n + "</span> rezultate.");
}

function offon(){
	$("#sidebar li").each(function(){
	        $(this).html($(this).html().replace("MF", "Magazin "));
			$(this).html($(this).html().replace("MM", "MIC.RO Mobil "));
		});
}

function paginate(){
   var page = 1;
   var itemsPerPage = 3;
   var prev = "inapoi";
   var next = "inainte";

   var $entries = $("#entries");
   var $list = $entries.children("ul:first");
   $list.children().eq(itemsPerPage).nextAll().andSelf().hide();
  $(".paginationMap").remove();
   var $pagination = $("<ul class='paginationMap'></ul>").each(function () {
       var itemsTotal = $list.children().size();
       var pages = Math.ceil(itemsTotal / itemsPerPage);
       $(this).append("<li class='prev'>" + prev + "</li>");
       $(this).append("<li class='more'>" + next + "</li>");
   }).appendTo($entries);
   $pagination.children("li:first").hide();
   $pagination.children().click(function () {

       if ($(this).text() == prev)
           page = page - 1;
       else if ($(this).text() == next)
           page = page + 1;

       var firstToShow = (page - 1) * itemsPerPage;
       var lastToShow = page * itemsPerPage;
       $list.children().hide().slice(firstToShow, lastToShow).slideDown('slow');

       if (page == 1)
           $(this).parent().find("li:first").hide();
       else
           $(this).parent().find("li:first").show();
       if (page == Math.ceil($list.children().size() / itemsPerPage))
           $(this).parent().find("li:last").hide();
       else
           $(this).parent().find("li:last").show();
   });
	}

