	$(document).ready(function () {
		var altura =  $(window).height();
		var valor = window.document.body.clientHeight;
		var largura = $(window).width();

		if(document.getElementById('tracar-rota').style.display == "block"){
			$('#map').height(altura - valor -3);
			$('#tracar-rota').height(altura - valor + 22);
			$('#all').height(altura - valor + 22);
			$('#map').width(largura - 383  );
			$('#sub-topo').width(largura -383);
			$('#all').width(largura - 388 );
				$('#btns').css({"display" : "none"})
		}else{
			$('#map').height(altura - valor -3);
			$('#tracar-rota').height(altura - valor + 22);
			$('#all').height(altura - valor + 22);
			$('#map').width(largura);
			$('#sub-topo').width(largura);
			$('#all').width(largura);
			$('#btns').css({"display" : "block"})
		}


	    $('.menu-lojas').click(function () {
			$('ul.menu-slide').slideToggle('medium');

	    });

	    $("#txtDe").focus(function () {
	    	if($("#txtDe").attr("value")=="Onde estou ?"){
	    		$("#txtDe").attr("value","");
	    	}
	    });
	    $("#txtDe").blur(function () {
	    	if($("#txtDe").attr("value")==""){
	    		$("#txtDe").attr("value","Onde estou ?");
	    	}
	    });

	    $("#txtBuscar").focus(function () {
	    	if($("#txtBuscar").attr("value")=="Buscar"){
	    		$("#txtBuscar").attr("value","");
	    	}
	    });

	    $("#txtBuscar").blur(function () {
	    	if($("#txtBuscar").attr("value")==""){
	    		$("#txtBuscar").attr("value","Buscar");
	    	}
	    });

	    $("#btnOkDe").click(function () {
	    	validaPosicaoAtual();
	    });

	    $("#btnOkBuscar").click(function () {
	    	buscaLojas();
	    });

	    initialize();

	});

	/* funcao para ocultar a div#tracar-rota */

	function divOn(){

		$('#tracar-rota').animate({"left":"+=383px"},"slow" , function(){
			$('#map').width($(window).width() - 383);
			$('#sub-topo').width($(window).width() - 383);
			$('#all').width($(window).width() - 383);
			$('#btns').css({"display" : "none"});
			$('#tracar-rota').css({"display":"block"});
		});
	}

	/* funcao para ocultar a div#tracar-rota */

	function divOut(){
		$('#tracar-rota').animate({"left":"-=383px"},"slow", function(){
				$('#map').width($(window).width());
				$('#sub-topo').width($(window).width());
				$('#all').width($(window).width());
				$('#btns').css({"display" : "Block"});
				$('#tracar-rota').css({"display":"none"});
			});
	}

	function screenTela(){
		var altura =  $(window).height();
		var valor = window.document.body.clientHeight;
		var largura = $(window).width();

		$('#map').height(altura -115);
		$('#tracar-rota').height(altura -90);
		$('#all').height(altura - 90);

		var divTracar = document.getElementById('tracar-rota').style.width;

		if(document.getElementById('tracar-rota').style.display == "block"){
			$('#map').width(largura - 398);
			$('#sub-topo').width(largura - 398);
			$('#all').width(largura - 398);
		}else{
			$('#map').width(largura);
			$('#sub-topo').width(largura);
			$('#all').width(largura);
		}
	}