function ImovelInserir(idImovel){
	var imovel = new DetalhesImovel();
  	imovel.Inserir('conteudoDetalhes',idImovel);
	imovel.Chat('http://videostreaming.com.br/estrelaimoveispraia/livezilla.php');
	imovel.DominioArquivos('www.apartamentopraiagrande.imb.br');
}

function AbreJanela(url, width, height, nome, scrollbars) {
	var top; var left;
	top = ( (screen.height/2) - (height/1.55) )
	left = ( (screen.width/2) - (width/2) )
	window.open(url, nome,'width='+width+',height='+height+',scrollbars='+scrollbars+',toolbar=no,location=no,status=no,menubar=no,resizable=no,left='+left+',top='+top);
}

function navegacao(pag){
	var ind = location.href.indexOf("&pag=");
	var url;
	
	if(ind > -1)	
		url = location.href.substring(0,ind);
	else
		url = location.href;
		
	location.href = url + "&pag=" + pag		
}

function validarRef(ref){
	var vl = $.trim($(ref).val());
			
	if(!isNaN(vl))
		return true;
	else{
		alert('Informe a referência');
		$(ref).focus();
		return false;	
	}			
}

/*function insereLocalizacao(objLoja)
{
	mapa = '';
	switch(parseInt(objLoja.attr('loja'))){
		case 1:
			linkFotos = '<button id="botaoMais" onClick="showDialogGaleria(1,21)" >Veja fotos da unidade</button>';
			mapa = '<iframe width="766" height="273" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="http://maps.google.com.br/maps?f=q&amp;source=s_q&amp;hl=pt-BR&amp;geocode=&amp;q=Av.+Pres.+Castelo+Branco,+3350+-+Guilhermina+-+Praia+Grande&amp;aq=&amp;sll=-14.239424,-53.186502&amp;sspn=41.625826,79.013672&amp;vpsrc=0&amp;ie=UTF8&amp;hq=&amp;hnear=Av.+Pres.+Castelo+Branco,+3350+-+Vila+Guilhermina,+Praia+Grande+-+S%C3%A3o+Paulo,+11702-700&amp;t=m&amp;ll=-24.015891,-46.432428&amp;spn=0.04704,0.051413&amp;z=14&amp;iwloc=A&amp;output=embed"></iframe>';
			break;
		case 2:
			linkFotos = '<button id="botaoMais" onClick="showDialogGaleria(2,11)" >Veja fotos da unidade</button>';
			mapa = '<iframe width="766" height="273" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="http://maps.google.com.br/maps?f=q&amp;source=s_q&amp;hl=pt-BR&amp;geocode=&amp;q=Av.+Pres.+Castelo+Branco,+1626+-+Praia+Grande&amp;aq=&amp;sll=-24.014794,-46.436377&amp;sspn=0.037241,0.077162&amp;vpsrc=0&amp;ie=UTF8&amp;hq=&amp;hnear=Av.+Pres.+Castelo+Branco,+1626+-+Forte,+Praia+Grande+-+S%C3%A3o+Paulo,+11701-750&amp;t=m&amp;ll=-24.013383,-46.416035&amp;spn=0.047041,0.051413&amp;z=14&amp;iwloc=A&amp;output=embed"></iframe>';
			break;
		case 3:
			linkFotos = '<button id="botaoMais" onClick="showDialogGaleria(3,13)" >Veja fotos da unidade</button>';
			mapa = '<iframe width="766" height="273" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="http://maps.google.com.br/maps?f=q&amp;source=s_q&amp;hl=pt-BR&amp;geocode=&amp;q=Av.+Pres.+Castelo+Branco,+7260++Praia+Grande&amp;aq=&amp;sll=-24.013598,-46.416035&amp;sspn=0.009781,0.01929&amp;vpsrc=0&amp;ie=UTF8&amp;hq=&amp;hnear=Av.+Pres.+Castelo+Branco,+7260+-+Cidade+Ocian,+Praia+Grande+-+S%C3%A3o+Paulo,+11704-600&amp;t=m&amp;ll=-24.027651,-46.46925&amp;spn=0.047036,0.051413&amp;z=14&amp;iwloc=A&amp;output=embed"></iframe>';
			break;
		case 4:
			linkFotos = '<button id="botaoMais" onClick="showDialogGaleria(4,6)" >Veja fotos da unidade</button>';
			mapa = '<iframe width="766" height="273" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="http://maps.google.com.br/maps?f=q&amp;source=s_q&amp;hl=pt-BR&amp;geocode=&amp;q=Av.+Pres.+Kennedy,+9986+-+Praia+Grande+&amp;aq=&amp;sll=-24.027654,-46.469284&amp;sspn=0.00978,0.01929&amp;vpsrc=0&amp;ie=UTF8&amp;hq=&amp;hnear=Av.+Pres.+Kennedy,+9986+-+Balne%C3%A1rio+Maracan%C3%A3,+Praia+Grande+-+S%C3%A3o+Paulo,+11705-750&amp;t=m&amp;ll=-24.034549,-46.502466&amp;spn=0.047034,0.051413&amp;z=14&amp;iwloc=A&amp;output=embed"></iframe>';
			break;
	}
	
	//document.getElementById('areaLink').innerHTML = linkFotos;
	$('.mapa-localizacao > h2').html(objLoja.html());
	$('#enderecoMapaVisu').html(objLoja.attr('title') + linkFotos);
	$('#area-mapa').html(mapa);
	//$('#botaoMais').button();
}*/

function insereLocalizacao()
{
			mapa = '';
			linkFotos = '<button id="botaoMais" onClick="showDialogGaleria(3,13)" >Veja fotos da unidade</button>';
			mapa = '<iframe width="766" height="273" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="http://maps.google.com.br/maps?f=q&amp;source=s_q&amp;hl=pt-BR&amp;geocode=&amp;q=Av.+Pres.+Castelo+Branco,+7260++Praia+Grande&amp;aq=&amp;sll=-24.013598,-46.416035&amp;sspn=0.009781,0.01929&amp;vpsrc=0&amp;ie=UTF8&amp;hq=&amp;hnear=Av.+Pres.+Castelo+Branco,+7260+-+Cidade+Ocian,+Praia+Grande+-+S%C3%A3o+Paulo,+11704-600&amp;t=m&amp;ll=-24.027651,-46.46925&amp;spn=0.047036,0.051413&amp;z=14&amp;iwloc=A&amp;output=embed"></iframe>';
	
	//document.getElementById('areaLink').innerHTML = linkFotos;
	$('.mapa-localizacao > h2').html('');
	$('#enderecoMapaVisu').html('Av. Pres. Castelo Branco, 7260 - Cidade Ocian - Praia Grande' + linkFotos);
	$('#area-mapa').html(mapa);
	//$('#botaoMais').button();
}

function showDialogGaleria(loja,qtd){
	AbreJanela('galeriaLocal/index.asp?loja='+loja+'&qtd='+qtd, '1000', '620', '', 'yes');
}

$(document).ready(function () {
	$('.MLBBairroInterno').slimScroll({
		height: '320px'
	});
});
