Resultado da buscaLocalizamos ' + _markerList.length + ' ' + strImoveis + ' do tipo ' + mySuitedFor + ' em ' + myRegion + '.
Navegue pelo mapa para localizar os empreendimentos. Clique no empreendimento desejado para acessar as informações e opções de cada produto.
Utilize o menu superior para mudar a visualização do mapa e alterar ou refinar a sua busca.
Clique para fechar este box');
WebMix.SetLoadingStatus(false);
}
}
WebMix.SearchComplete = function(searcher) {
// registra evento
//this.webMixReport.Register(WebMixReport.MAP_CONTEXT_SEARCH, {});
}
WebMix.ShowWizardStep = function(step) {
this.webMixUI.ShowWizardStep(step);
WebMixUIResize();
}
WebMix.QueryServices = function(id) {
//WebMix.SetLoadingStatus(true);
this.webMixMap.QueryServices(id);
//WebMix.SetLoadingStatus(false);
WebMixUIResize();
}
WebMix.ShowServices = function(id) {
this.webMixUI.ShowServices();
WebMixUIResize();
}
WebMix.HideDirections = function() {
this.webMixUI.HideDirections();
WebMixUIResize();
}
WebMix.HideWindow = function() {
this.webMixUI.HidePopupLayer();
WebMixUIDOM.HideMessageBox();
}
WebMix.MinimizeWindow = function() {
this.webMixUI.MinimizePopupLayer();
}
WebMix.AddFavorite = function(marker) {
this.webMixDataStore.AddFavorite(marker);
this.webMixUI.UpdateFavoriteList();
this.webMixUI.ShowFavorites();
WebMixUIResize();
}
WebMix.GetFavoriteList = function() {
return this.webMixDataStore.GetFavoriteList();
}
WebMix.GetMarkerList = function() {
return this.webMixDataStore.GetMarkerList();
}
WebMix.SetMarkerList = function(list) {
return this.webMixDataStore.SetMarkerList(list);
}
WebMix.RemoveFavorite = function(id) {
this.webMixDataStore.RemoveFavorite(id);
this.webMixUI.UpdateFavoriteList();
}
WebMix.GetDirections = function(markerID) {
WebMix.SetLoadingStatus(true);
var markerInfo = this.webMixDataStore.GetMarkerByID(markerID);
var fromDir = this.webMixUI.GetDirectionsFrom();
if (fromDir !=null) {
var from = fromDir;
var to = markerInfo.getGeocodeAddress();
this.webMixMap.ShowDirections(from, to, markerID);
}
WebMix.SetLoadingStatus(false);
}
WebMix.ZoomUp= function() {
WebMix.SetLoadingStatus(true);
this.webMixMap.ZoomUp();
this.webMixUI.ShowZoomLevel();
WebMix.SetLoadingStatus(false);
}
WebMix.ZoomDown= function() {
WebMix.SetLoadingStatus(true);
this.webMixMap.ZoomDown();
this.webMixUI.ShowZoomLevel();
WebMix.SetLoadingStatus(false);
}
WebMix.GetZoomLevel = function() {
return this.webMixMap.GetZoomLevel();
}
WebMix.Unload = function() {
}
addEvent(window, 'load', function() {
WebMix.Load();
if (typeof(WebMix_Load) != "undefined") {
WebMix_Load();
}
});
addEvent(window, 'unload', function() { WebMix.Unload(); });
WebMix.CheckResize = function() {
this.webMixMap.CheckResize();
}
WebMix.SetLoadingStatus = function(st) {
if (document.getElementById('divLoading') != null) {
document.getElementById('divLoading').style['display'] = st ? 'block' : 'none';
}
}
WebMix.Alert = function(msg) {
WebMixUIDOM.ShowMessageBox('Alerta', msg);
}
function include(file) {
var newFile = document.createElement('script');
newFile.setAttribute('type', 'text/javascript');
if (file.indexOf('http://') > -1) {
newFile.setAttribute('src', file);
} else {
newFile.setAttribute('src', WebMix.PATH + file);
}
document.getElementsByTagName('head')[0].appendChild(newFile);
}
function includeCss(file) {
var newFile = document.createElement('link');
newFile.setAttribute('rel', 'Stylesheet');
newFile.setAttribute('href', WebMix.PATH + file);
document.getElementsByTagName('head')[0].appendChild(newFile);
}
function addEvent( obj, type, fn ) {
if ( obj.attachEvent ) {
obj["e"+type+fn] = fn;
obj[type+fn] = function() { obj["e"+type+fn]( window.event ) };
obj.attachEvent( "on"+type, obj[type+fn] );
}
else{
obj.addEventListener( type, fn, false );
}
}
function getElementsByClassName(strClass, strTag, objContElm) {
strTag = strTag || "*";
objContElm = objContElm || document;
var objColl = objContElm.getElementsByTagName(strTag);
if (!objColl.length && strTag == "*" && objContElm.all) objColl = objContElm.all;
var arr = new Array();
var delim = strClass.indexOf('|') != -1 ? '|' : ' ';
var arrClass = strClass.split(delim);
for (var i = 0, j = objColl.length; i < j; i++) {
var arrObjClass = objColl[i].className.split(' ');
if (delim == ' ' && arrClass.length > arrObjClass.length) continue;
var c = 0;
comparisonLoop:
for (var k = 0, l = arrObjClass.length; k < l; k++) {
for (var m = 0, n = arrClass.length; m < n; m++) {
if (arrClass[m] == arrObjClass[k]) c++;
if (( delim == '|' && c == 1) || (delim == ' ' && c == arrClass.length)) {
arr.push(objColl[i]);
break comparisonLoop;
}
}
}
}
return arr;
}
function WebMixDataStore() {
var self = this;
var _favoriteList = [];
var _markerList = [];
this.AddFavorite = function(mkrID) {
if (self.GetFavorite(mkrID) == null) {
_favoriteList.push(mkrID);
}
}
this.GetFavoriteList = function() {
var tmpList = [];
for (var i = 0;i < _favoriteList.length; i++) {
var mkr = self.GetMarkerByID(_favoriteList[i]);
tmpList.push(mkr);
}
return tmpList;
}
this.GetFavorite = function(mkrID) {
for (var i = 0; i < _favoriteList.length; i++) {
var favoriteID = _favoriteList[i];
if (favoriteID == mkrID) {
return self.GetMarkerByID(favoriteID);
}
}
return null;
}
this.RemoveFavorite = function(id){
for (var i = 0;i < _favoriteList.length; i++) {
var f = _favoriteList[i];
if (f == id) {
_favoriteList.splice(i, 1);
return;
}
}
}
this.SetMarkerList = function(list) {
_markerList = list;
}
this.GetMarkerList = function() {
return _markerList;
}
this.GetMarkerByID = function(id){
for (var i = 0; i < _markerList.length; i++) {
var mkr = _markerList[i];
if (mkr.id == id) return mkr;
}
return null;
}
}
/*
WebMixMap.js
Contém funções internas relacionadas com mapa
Copyright 2008 - Inspira Tecnologia e Marketing
*/
function WebMixMap(_mapDiv) {
var self = this;
this.mapDiv = _mapDiv;
this.LoadMap = function() {
if (!this.isLoaded) {
google.load("maps", "2.x", {"callback" : self.initialize });
isLoaded = true;
}
}
this.UnloadMap = function() {
GUnload();
}
this.initialize = function() {
if (GBrowserIsCompatible()) {
var options = {
listingTypes : "blended",
suppressInitialResultSelection: true,
onMarkersSetCallback : function(markers) {
var iconUrl = WebMixUIDOM.GetImagePath('img/' + WebMixMap.CurrentService + '.jpg');
for (var i = 0; i < markers.length; i++) {
var marker = markers[i].marker;
var barnIcon = marker.getIcon();
barnIcon.iconSize = new GSize(32, 32);
barnIcon.iconAnchor = new GPoint(8, 28);
barnIcon.infoWindowAnchor = new GPoint(8, 0);
barnIcon.transparent = WebMixUIDOM.GetImagePath("img/trans.gif");
marker.setImage(iconUrl);
}
},
searchFormHint : "Ex: natação",
showOnLoad : true
};
var map = new google.maps.Map2(document.getElementById("divMap"), {googleBarOptions:options});
map.addMapType(G_SATELLITE_3D_MAP);
map.enableGoogleBar();
map.setCenter(new GLatLng(-23.55, -46.64), WebMixMap.DEFAULT_ZOOM_LEVEL);
map.addControl(new GMapTypeControl());
self.GMap = map;
var gdir = new GDirections(map, document.getElementById("divMapDirectionsSteps"));
GEvent.addListener(gdir, "error", self.handleErrors);
self.GDir = gdir;
var geocoder = new GClientGeocoder();
geocoder.setBaseCountryCode("br");
self.GGeocoder = geocoder;
}
}
this.ZoomUp = function() {
if (self.GMap) self.GMap.zoomOut();
}
this.ZoomDown = function() {
if (self.GMap) self.GMap.zoomIn();
}
this.GetZoomLevel = function() {
if (typeof(self.GMap) != "undefined") {
return self.GMap.getZoom();
} else {
return WebMixMap.DEFAULT_ZOOM_LEVEL;
}
}
this.ClearMarkers = function() {
if (self.GMap != null) {
self.GMap.clearOverlays();
// remove rota do painel e esconde painel de rotas
this.ClearDirectionsDiv();
WebMix.webMixUI.HideDirections();
WebMix.webMixUI.ShowDirectionsHelp();
WebMixUIResize();
}
}
this.FitMap = function(points) {
var bounds = new GLatLngBounds();
for (var i=0; i< points.length; i++) {
bounds.extend(points[i]);
}
var map = self.GMap;
map.setZoom(map.getBoundsZoomLevel(bounds));
map.setCenter(bounds.getCenter());
}
this.DisplayMarkerList = function(markerList) {
if (self.GMap == null) return;
WebMix.SetMarkerList(markerList);
// lista de todos os marcadores no mapa
var gMarkerList = [];
var gLatLngList = [];
for (i = 0; i < markerList.length; i++) {
var markerInfo = markerList[i];
var icon = new GIcon(G_DEFAULT_ICON, markerInfo.iconUrl);
icon.iconSize = new GSize(markerInfo.iconWidth, markerInfo.iconHeight);
icon.shadowSize = new GSize(markerInfo.iconWidth, markerInfo.iconHeight);
icon.imageMap = [0,0, markerInfo.iconWidth,0, markerInfo.iconWidth,markerInfo.iconHeight, 0,markerInfo.iconHeight];
var myLatLng = new GLatLng(markerInfo.latitude, markerInfo.longitude);
gLatLngList.push(myLatLng);
var marker = new GMarker(myLatLng, { title: markerInfo.name, icon: icon });
// gambiarra pq tem o menu superior preto por cima do mapa :(
//GEvent.addListener(marker, "click", function() { window.setTimeout(function(){self.GMap.panBy(new GSize(0,60))},1000) });
if (markerInfo.infoWindowTabs.length == 1) {
// has only one tab... using tabless window
var iwt = markerInfo.infoWindowTabs[0];
var moreInfo = "";
if (markerInfo.siteUrl != null && markerInfo.siteUrl.length > 0) {
moreInfo = ' [ver site]';
}
marker.bindInfoWindowHtml('
'+iwt.title +'
'+iwt.description + ' ');
} else if (markerInfo.infoWindowTabs.length > 1) {
var tabArray = new Array(markerInfo.infoWindowTabs.count);
for (j = 0; j < markerInfo.infoWindowTabs.length; j++) {
var t = markerInfo.infoWindowTabs[j];
tabArray[j] = new GInfoWindowTab(t.title, t.description);
}
marker.bindInfoWindowTabsHtml(tabArray);
}
self.GMap.addOverlay(marker);
gMarkerList.push(marker);
}
this.gMarkerList = gMarkerList;
this.FitMap(gLatLngList);
}
this.QueryServices = function(service) {
WebMixMap.CurrentService = service;
var inputSearch = getElementsByClassName('gsc-input', 'input');
inputSearch[0].value = service;
inputSearch[0].parentNode.parentNode.childNodes[1].firstChild.onclick();
}
this.PositionMap = function(address) {
var geocoder = self.GGeocoder;
if (geocoder) {
geocoder.getLatLng(
address,
function(point) {
if (point) {
self.GMap.setCenter(point, WebMixMap.DEFAULT_ZOOM_LEVEL);
}
}
);
}
}
this.ShowDirections = function(from, to, markerID) {
WebMix.SetLoadingStatus(true);
var query = "from: " + from + " to: " + to;
var divMapDirectionsSteps = document.getElementById("divMapDirectionsSteps");
// procura pelo endereco
self.GGeocoder.getLocations(from, function(response) {
if (!response || response.Status.code != 200) {
WebMix.Alert("Endereço não encontrado. Por favor tente novamente.");
WebMix.SetLoadingStatus(false);
} else {
// mostra guia só se há resultados
WebMix.webMixUI.ShowDirections();
WebMix.webMixUI.HideDirectionsHelp();
WebMixUIResize();
// acidiona info do empreendimento na aba
var child;
var divMapDirectionsSource = document.getElementById('divMapDirectionsSource');
while(child=divMapDirectionsSource.firstChild)
divMapDirectionsSource.removeChild(child);
var markerInfo = WebMix.webMixDataStore.GetMarkerByID(markerID);
var iwt = markerInfo.infoWindowTabs[0];
var h1 = document.createElement('h1');
h1.appendChild(document.createTextNode(iwt.title));
divMapDirectionsSource.appendChild(h1);
var img = document.createElement('img');
img.src = WebMix.PATH + 'img/markers/map' + markerInfo.map.id + '/'+ markerInfo.id + '.jpg';
divMapDirectionsSource.appendChild(img);
var divdesc = document.createElement('div');
divMapDirectionsSource.appendChild(divdesc);
divdesc.innerHTML = iwt.description + '
';
if (markerInfo.siteUrl != null && markerInfo.siteUrl.length > 0) {
var a = document.createElement('a');
a.href = markerInfo.siteUrl;
a.target = '_blank';
a.appendChild(document.createTextNode('Mais detalhes'));
divdesc.appendChild(a);
}
// limpa divMapDirectionsSteps
var child;
while(child=divMapDirectionsSteps.firstChild)
divMapDirectionsSteps.removeChild(child);
// apenas um endereco encontrado, tracar rota
if(response.Placemark.length==1) {
self.GDir.load(query ,{ "locale": "pt_BR" });
WebMix.SetLoadingStatus(false);
// varios enderecos encontrados, coloca pontos no mapa e avisa usuario
} else {
divMapDirectionsSteps.appendChild(document.createTextNode("Mais de um endereço foi encontrado:"));
var ul = document.createElement('ul');
divMapDirectionsSteps.appendChild(ul);
for(var i=0; i < response.Placemark.length; i++) {
// adiciona lugar
li = document.createElement('li');
a = document.createElement('a');
a.href = "javascript:void(0)";
a._from = response.Placemark[i].address;
a._to = to;
a._markerID = markerID;
a.onclick = function() {
WebMix.webMixMap.ShowDirections(this._from, this._to, this._markerID);
}
a.appendChild(document.createTextNode(response.Placemark[i].address));
li.appendChild(a);
ul.appendChild(li);
}
WebMix.SetLoadingStatus(false);
}
}
});
}
this.ClearDirectionsDiv = function() {
document.getElementById('divMapDirectionsText').style['display'] = 'block';
document.getElementById('divMapDirectionsContainer').style['display'] = 'none';
}
this.handleErrors = function(){
if (self.GDir.getStatus().code == G_GEO_UNKNOWN_ADDRESS)
WebMix.Alert("Endereço não encontrado. Por favor tente novamente.");
else if(self.GDir.getStatus().code == G_GEO_UNAVAILABLE_ADDRESS)
WebMix.Alert("G_GEO_UNAVAILABLE_ADDRESS");
else if(self.GDir.getStatus().code == G_GEO_UNKNOWN_DIRECTIONS )
WebMix.Alert("Impossível traçar rota partindo da origem especificada. Por favor tente novamente.");
else
WebMix.Alert("Um erro não esperado ocorreu.");
WebMix.HideDirections();
WebMixUIResize();
}
this.CheckResize = function() {
if (self.GMap) self.GMap.checkResize();
}
this.GetGoogleMapsPrintUrl = function(from, to) {
return "http://maps.google.com.br/maps?hl=pt-BR&saddr={0}&daddr={1}&z=10&pw=2".replace("{0}",from).replace("{1}",to);
}
}
WebMixMap.DEFAULT_ZOOM_LEVEL = 13;
/*
WebMixReport.js
Armazena informações no Google Analytics
Copyright 2008 - Inspira Tecnologia e Marketing
*/
function WebMixReport(_pageTracker) {
this.Register = function(msg, info) {
if (typeof(_pageTracker) == "undefined") return;
var strInfo = '';
var i = 0;
for (var c in info) {
if (i > 0) strInfo += ',';
strInfo += info[c].name + ':' + info[c].value;
i++;
}
switch (msg) {
case WebMixReport.MAP_LOADED:
_pageTracker._trackPageview("MAP_LOADED");
break;
case WebMixReport.MAP_OPENED:
_pageTracker._trackPageview("MAP_OPENED");
break;
case WebMixReport.MAP_MARKER_SEARCH:
_pageTracker._trackPageview("MAP_MARKER_SEARCH(" + strInfo + ")");
break;
case WebMixReport.MAP_CONTEXT_SEARCH:
_pageTracker._trackPageview("MAP_CONTEXT_SEARCH(" + info + ")");
break;
case WebMixReport.MAP_ROUTE_VIEW:
_pageTracker._trackPageview("MAP_ROUTE_VIEW(" + strInfo + ")");
break;
case WebMixReport.MAP_ROUTE_PRINT:
_pageTracker._trackPageview("MAP_ROUTE_PRINT(" + strInfo + ")");
break;
case WebMixReport.MAP_MARKER_CLICK:
_pageTracker._trackPageview("MAP_MARKER_CLICK(" + info + ")");
break;
case WebMixReport.MAP_INFOWINDOW_VIEW:
_pageTracker._trackPageview("MAP_MARKER_CLICK(" + strInfo + ")");
break;
case WebMixReport.MAP_GOOGLEEARTH:
_pageTracker._trackPageview("MAP_GOOGLEEARTH");
break;
case WebMixReport.MAP_CLOSED:
_pageTracker._trackPageview("MAP_CLOSED");
break;
}
}
}
WebMixReport.MAP_LOADED = 1;
WebMixReport.MAP_OPENED = 2;
WebMixReport.MAP_MARKER_SEARCH = 3;
WebMixReport.MAP_CONTEXT_SEARCH = 4;
WebMixReport.MAP_ROUTE_VIEW = 5;
WebMixReport.MAP_ROUTE_PRINT = 6;
WebMixReport.MAP_MARKER_CLICK = 7;
WebMixReport.MAP_INFOWINDOW_VIEW = 8;
WebMixReport.MAP_GOOGLEEARTH = 9;
WebMixReport.MAP_CLOSED = 10;
/*
WebMixSearchJSON.js
Chama os webservices que fazem a usca de imóveis no banco de dados
Usando JSON no lugar de XML
Copyright 2008 - Inspira Tecnologia e Marketing
*/
function WebMixInfoWindowTab(title, description) {
this.title = title;
this.description = description;
}
function WebMixMarker(i, n) {
this.id = i;
this.name = n;
this.map = new WebMixMap();
this.toString = function() {
var x = '';
for (var i in this) {
x += i + ':' + this[i] + '\n';
}
return x;
}
this.infoWindowTabs = [];
this.addInfoWindowTab = function(title, description) {
this.infoWindowTabs.push(new WebMixInfoWindowTab(title, description));
}
this.getGeocodeAddress = function() {
var addr;
if (this.geocodeStreet == null || this.geocodeStreet.length == 0) {
var strNumber = "";
if (typeof(this.number) != "undefined") {
strNumber = this.number + ",";
}
addr = this.street + "," + strNumber + this.city + "," + this.state + "," + this.country;
} else {
addr = this.geocodeStreet + "," + this.city + "," + this.state + "," + this.country;
}
return addr;
}
}
function WebMixSearchJSON() {
}
WebMixSearchJSON.GetMarkerCount = function(searchParameters, mapID, callback) {
WebMixSearchJSON.JSONCallback = callback;
var extraParams = "";
if (typeof(searchParameters) != "undefined") {
for (p in searchParameters) {
var key = p;
var value = searchParameters[p];
if (key == 'city') continue;
extraParams += "&" + key + "=" + value;
}
}
var requestUrl = "http://app.inspira.com.br/WebMixRealty/DataSources/MarkerJSON.aspx?action=GetCount&Map.ID="+mapID + "&rnd=" + Math.random() + extraParams;
//prompt(requestUrl, requestUrl);
include(requestUrl);
}
WebMixSearchJSON.GetMarkerCountCallback = function(count) {
// alert("Chamando count callback:" + count.MarkerCount);
WebMixSearchJSON.JSONCallback(count.MarkerCount);
}
WebMixSearchJSON.SearchMarkers = function(searchParameters, mapID, callback) {
WebMixSearchJSON.JSONGetListCallback = callback;
var extraParams = "";
if (typeof(searchParameters) != "undefined") {
for (p in searchParameters) {
var key = p;
var value = searchParameters[p];
if (key == 'city') continue;
extraParams += "&" + key + "=" + value;
}
}
var requestUrl = "http://app.inspira.com.br/WebMixRealty/DataSources/MarkerJSON.aspx?action=List&Map.ID="+mapID + "&rnd=" + Math.random() + extraParams;
// prompt(requestUrl, extraParams);
include(requestUrl);
}
WebMixSearchJSON.GetListCallback = function(list) {
var mapList = [];
if (list != null) {
if (typeof(list.Markers.Marker.length) == "undefined") {
mapList.push(getMarker(list.Markers.Marker));
}
for (var i = 0; i < list.Markers.Marker.length; i++) {
var jsonMarker = list.Markers.Marker[i];
mapList.push(getMarker(jsonMarker));
}
}
WebMixSearchJSON.JSONGetListCallback(mapList);
}
function getMarker(jsonMarker) {
var marker = new WebMixMarker();
marker.id = jsonMarker["ID"];
marker.map.id = jsonMarker["Map.ID"];
marker.name = jsonMarker["Name"];
marker.latitude = jsonMarker["Latitude"];
marker.longitude = jsonMarker["Longitude"];
marker.street = jsonMarker["Street"];
marker.geocodeStreet = jsonMarker["GeocodeStreet"];
if (jsonMarker["Number"] != null)
marker.number = jsonMarker["Number"];
if (jsonMarker["Complement"] != null)
marker.complement = jsonMarker["Complement"];
marker.city = jsonMarker["City"];
if (jsonMarker["State"] != null)
marker.state = jsonMarker["State"];
marker.country = jsonMarker["Country"];
if (jsonMarker["IconUrl"] != null)
marker.iconUrl = jsonMarker["IconUrl"];
marker.iconWidth = jsonMarker["IconWidth"];
marker.iconHeight = jsonMarker["IconHeight"];
marker.price = jsonMarker["Price"];
if (jsonMarker["Dorms"] != null)
marker.dorms = jsonMarker["Dorms"];
marker.garages = jsonMarker["Garages"];
marker.area = jsonMarker["Area"];
marker.type = jsonMarker["Type"];
marker.stage = jsonMarker["Stage"];
marker.siteUrl = jsonMarker["SiteUrl"];
marker.suitedFor = jsonMarker["SuitedFor"];
var xmlInfoWindowTabList = jsonMarker["InfoWindowTabs"];
if (typeof(xmlInfoWindowTabList) != "undefined") {
if (typeof(xmlInfoWindowTabList.length) == "undefined") {
marker.addInfoWindowTab(
xmlInfoWindowTabList["Title"],
xmlInfoWindowTabList["Description"]
);
}
for (var j = 0; j < xmlInfoWindowTabList.length; j++) {
marker.addInfoWindowTab(
xmlInfoWindowTabList[j]["Title"],
xmlInfoWindowTabList[j]["Description"]
);
}
}
return marker;
}
/*
WebMixSearchParameters.js
Entidade que armazena os parâmetros de busca, passando da interface com o usuário até a função de busca
Copyright 2008 - Inspira Tecnologia e Marketing
*/
function WebMixSearchParameters(type) {
var self = this;
}
/*
WebMixUI.js
Funções relacionadas a interface com o usuário
Copyright 2008 - Inspira Tecnologia e Marketing
*/
function WebMixUI(type) {
var self = this;
this.Load = function() {
self.IsLoaded = false;
}
this.ShowPopupLayer = function() {
this.ShowGeneric();
}
this.ShowOnDiv = function(divID) {
this.ShowGeneric(divID);
}
/*
Display UI elements
*/
this.ShowGeneric = function(divID) {
if (self.IsLoaded == false) {
WebMixUIDOM.LoadDom(self, divID);
self.IsLoaded = true;
document.getElementById('divMapOverlay').style['display'] = 'block';
document.getElementById('divMapBox').style['display'] = 'block';
document.getElementById('divMapInfo').style['display'] = 'none';
document.body.style['overflow'] = 'hidden';
this.HideFavorites();
this.HideServices();
this.HideDirections();
document.getElementById('icoFavorites').style['display'] = 'none';
document.getElementById('icoServices').style['display'] = 'none';
document.getElementById('icoDirections').style['display'] = 'none';
if (document.style != null) {
document.style['overflow'] = 'hidden';
}
// Mostra wizard no centro da tela
self.ShowWizard();
if (document.all) {
addEvent(window, "resize", WebMixUIResize);
} else {
window.onresize = WebMixUIResize;
}
} else {
document.getElementById('divMapBox').style['display'] = 'block';
WebMixUIResize();
}
}
this.ShowWizard = function() {
// divMapWizard: contém os elementos de busca do mapa (beta 1)
var divMapWizard = document.getElementById("divMapWizard");
/* var divMapWizardClone = divMapWizard.cloneNode(true);
divMapWizard.parentNode.removeChild(divMapWizard);*/
divMapWizard.style['display'] = 'inline';
// padrão:
document.getElementById('City1').selectedIndex = 0;
/*
// adiciona wizard no mapa
document.getElementById('divMapBox').appendChild(divMapWizardClone);*/
// mostra passo 1 do wizard
this.ShowWizardStep(1);
}
/*
Hide UI elements
*/
this.HidePopupLayer = function() {
document.getElementById('divMapInfo').style.display = 'none';
document.getElementById('divMapFavorites').style.display = 'none';
document.getElementById('divMapServices').style.display = 'none';
document.getElementById('divMapDirections').style.display = 'none';
document.getElementById('divMapBox').style.display = 'none';
document.body.style.overflow='auto';
//window.onresize = self.oldOnResize;
}
/*
Hide UI elements
*/
this.MinimizePopupLayer = function() {
document.getElementById('divMapBox').style.display = 'none';
document.body.style.overflow='auto';
}
/*
Expose the map div container in order to insert the GMap2 object into it (WebMixMap.js)
*/
this.GetMapDiv = function() {
return document.getElementById('divMap');
}
/*
Controls the wizard steps flow
*/
this.ShowWizardStep = function(step) {
var nextStep = step + 1;
var prevStep = step - 1;
var divWizardPrev = document.getElementById("divMapWizardStep" + prevStep);
var divWizardNext = document.getElementById("divMapWizardStep" + nextStep);
if (divWizardPrev != null) divWizardPrev.style['display'] = 'none';
if (divWizardNext != null) divWizardNext.style['display'] = 'none';
var divWizardStep = document.getElementById("divMapWizardStep" + step);
if (typeof(divWizardStep) != "undefined" && divWizardStep != null) {
divWizardStep.style['display'] = 'inline';
var btnWizardNext = document.getElementById("btnMapWizard" + step + "_Next");
var btnWizardPrev = document.getElementById("btnMapWizard" + step + "_Prev");
var btnWizardFinish = document.getElementById("btnMapWizardFinish");
if (btnWizardNext != null) {
btnWizardNext.onclick = function() { self.ShowWizardStep(nextStep); }
}
if (btnWizardPrev != null) {
btnWizardPrev.onclick = function() { self.ShowWizardStep(prevStep); }
}
if (btnWizardFinish != null) {
btnWizardFinish.onclick = function() {
alert(divWizardStep);
divWizardStep.style['display'] = 'none';
WebMix.DoSearchInternal(self.GetMapParameters(), self.EndSearch);
}
}
}
}
this.GetMapParameters = function() {
// Get search parameters
var divMapWizard = document.getElementById('divMapWizard');
var mapParameters = [];
self.FindMapParameters(divMapWizard, mapParameters);
return mapParameters;
}
/*
Get the marker list and pass it to the map
*/
this.EndSearch = function(_markerList) {
// Search has ended. Now the map can be shown
document.getElementById('divMapWizard').style['display'] = 'none';
document.getElementById('divMapOverlay').style['display'] = 'none';
document.getElementById('divMapInfo').style['display'] = 'block';
document.getElementById('icoFavorites').style['display'] = 'block';
document.getElementById('icoServices').style['display'] = 'block';
document.getElementById('icoDirections').style['display'] = 'block';
WebMix.ReloadMap(_markerList);
self.ShowZoomLevel();
WebMixUI.Loading(false, 'search');
WebMixUIResize();
}
this.FindMapParameters = function(domElement, mapParameters) {
for (var i = 0; i < domElement.childNodes.length; i++) {
var childNode = domElement.childNodes[i];
if (childNode.type != null && childNode.type != 'button' && childNode.type != 'submit') {
mapParameters.push( { name: childNode.id, value: childNode.value } );
} else {
self.FindMapParameters(childNode, mapParameters);
}
}
}
this.UpdateFavoriteList = function() {
var divMapFavorites = document.getElementById('divMapFavoritesContainer');
divMapFavorites.innerHTML = '';
var favoriteList = WebMix.GetFavoriteList();
document.getElementById('divMapFavoritesText').style['display'] = (favoriteList.length > 0) ? 'none' : 'block';
document.getElementById('divMapFavoritesContainer').style['display'] = (favoriteList.length > 0) ? 'block' : 'none';
for (var i = 0; i < favoriteList.length; i++) {
var mkr = favoriteList[i];
var divMapFavoritesItem = document.createElement('div');
divMapFavoritesItem.className = 'divMapFavoritesItem';
var spnMapFavoritesItem = document.createElement('span');
spnMapFavoritesItem.className = 'spnMapFavoritesItem';
// adiciona imagem
var img = document.createElement('img');
img.src = WebMix.PATH + 'img/markers/map' + mkr.map.id + '/'+ mkr.id + '.jpg';
spnMapFavoritesItem.appendChild(document.createTextNode(mkr.name));
divMapFavoritesItem.appendChild(spnMapFavoritesItem);
divMapFavoritesItem.appendChild(document.createElement('br'));
divMapFavoritesItem.appendChild(img);
divMapFavoritesItem.appendChild(document.createElement('br'));
divMapFavoritesItem.appendChild(document.createTextNode(mkr.dorms + ' dormitórios'));
divMapFavoritesItem.appendChild(document.createElement('br'));
divMapFavoritesItem.appendChild(document.createTextNode(mkr.city));
divMapFavoritesItem.appendChild(document.createElement('br'));
if (mkr.siteUrl != null && mkr.siteUrl.length > 0) {
lnkMaisDetalhes = document.createElement('a');
lnkMaisDetalhes.className = 'lnkMaisDetalhes';
lnkMaisDetalhes.href = mkr.siteUrl;
lnkMaisDetalhes.target = '_blank';
lnkMaisDetalhes.appendChild(document.createTextNode('Mais detalhes'));
divMapFavoritesItem.appendChild(lnkMaisDetalhes);
divMapFavoritesItem.appendChild(document.createTextNode(' '));
}
lnkApagar = document.createElement('a');
lnkApagar.className = 'lnkApagar';
lnkApagar.href = 'javascript: WebMix.RemoveFavorite(' + mkr.id + '); void(0);';
lnkApagar.appendChild(document.createTextNode('Apagar'));
divMapFavoritesItem.appendChild(lnkApagar);
divMapFavorites.appendChild(divMapFavoritesItem);
}
}
this.GetDirectionsFrom = function() {
var end = prompt('Digite o endereço de origem:', '');
return end;
}
this.SetVisibility = function(id, disp) {
var div = document.getElementById('divMap' + id);
var ico = document.getElementById('ico' + id);
var icoOn = document.getElementById('ico' + id + 'On');
div.style['display'] = disp ? 'block' : 'none';
ico.style['display'] = disp ? 'none' : 'block';
icoOn.style['display'] = disp ? 'block' : 'none';
}
this.ShowFavorites = function() {
self.SetVisibility('Favorites', true);
self.SetVisibility('Services', false);
self.SetVisibility('Directions',false);
}
this.ShowServices = function() {
self.SetVisibility('Favorites', false);
self.SetVisibility('Services', true);
self.SetVisibility('Directions',false);
}
this.ShowDirections = function() {
self.SetVisibility('Favorites', false);
self.SetVisibility('Services', false);
self.SetVisibility('Directions',true);
}
this.ShowDirectionsHelp = function() {
document.getElementById('divMapDirectionsText').style['display'] = 'block';
document.getElementById('divMapDirectionsContainer').style['display'] = 'none';
}
this.HideDirectionsHelp = function() {
document.getElementById('divMapDirectionsText').style['display'] = 'none';
document.getElementById('divMapDirectionsContainer').style['display'] = 'block';
}
this.HideFavorites = function() {
self.SetVisibility('Favorites', false);
}
this.HideServices = function() {
self.SetVisibility('Services', false);
}
this.HideDirections = function() {
self.SetVisibility('Directions',false);
}
this.ShowZoomLevel = function() {
var zoomLevel = WebMix.GetZoomLevel();
document.getElementById('divZoomLevelText').innerHTML = 'Zoom';
}
this.SetDefaultState = function() {
}
}
WebMixUI.POPUP = 1;
/* Habilita / desabilita o overlay "carregando".
*
* Antes de iniciar a carregar algum elemento, chamar a função com parâmetro true. Ao terminar de carregar o elemento, chamar com parâmetro false.
*/
WebMixUI.NumLoadingElements = 0;
WebMixUI.Loading = function (status, elem) {
//if (WebMix.IsIE6) return;
printHash(elem);
enxalog('>>> START');
if(status) {
enxalog('one more to load');
WebMixUI.NumLoadingElements++;
enxalog('added: ' + WebMixUI.NumLoadingElements + ' total');
// enable loading canvas
if(WebMixUI.NumLoadingElements==1) {
enxalog('Enabling loading canvas...');
if (document.getElementById('divLoading') != null) {
enxalog('...really enabling it');
document.getElementById('divLoading').style['display'] = 'block';
// dirty trick exclusive for IE6
var selectList = document.getElementsByTagName('select');
for (var i = 0; i < selectList.length; i++) {
var s = selectList[i];
s.style.display = 'none';
}
}
}
} else {
enxalog('one less to load');
if(WebMixUI.NumLoadingElements>0) {
WebMixUI.NumLoadingElements--;
}
enxalog('removed: ' + WebMixUI.NumLoadingElements + ' total');
// disable loading canvas
if(WebMixUI.NumLoadingElements==0) {
enxalog('Disabling loading canvas...');
if (document.getElementById('divLoading') != null) {
enxalog('...really disabling it');
document.getElementById('divLoading').style['display'] = 'none';
// dirty trick exclusive for IE6
var selectList = document.getElementsByTagName('select');
for (var i = 0; i < selectList.length; i++) {
var s = selectList[i];
s.style.display = 'block';
}
}
}
}
enxalog('<<< END');
}
/* hack do enxaqueca */
loadlogdiv = false;
function enxalog(msg) {
return;
if(loadlogdiv) {
loadlogdiv = false;
var divlog = document.createElement('div');
divlog.id = 'divlog';
document.body.appendChild(divlog);
}
var divlog = document.getElementById('divlog');
var spanmsg = document.createElement('span');
spanmsg.appendChild(document.createTextNode(msg));
divlog.appendChild(spanmsg);
var br = document.createElement('br');
divlog.appendChild(br);
}
WebMixUI.Hash = new Object();
function printHash(elem) {
if (WebMixUI.Hash[elem] != 1) {
//enxalog('>>> start load:' + elem);
WebMixUI.Hash[elem] = 1;
} else {
//enxalog('>>> finish load:' + elem);
WebMixUI.Hash[elem] = 0;
}
//Debug: imprime hash
for (var i in WebMixUI.Hash)
{
enxalog(' *** WebMixUI.Hash[\''+i+'\'] is ' + WebMixUI.Hash[i]);
}
}
/* hack do enxaqueca */
function WebMixUIResize() {
// valores iguais a WebMixUIDOM.LoadDom em WebMixUIDOM.js
var w = document.body.offsetWidth - 40;
if(w<933) { w=933; };
var h = document.body.offsetHeight - 40;
if(h<350) { h=350; };
var divMapBox = document.getElementById('divMapBox');
divMapBox.style.width = w + 'px';
divMapBox.style.height = h + 'px';
var divMapOverlay = document.getElementById('divMapOverlay');
divMapOverlay.style.width = w - 20 + 'px';
divMapOverlay.style.height = h - 20 + 'px';
var divMapInfo = document.getElementById('divMapInfo');
divMapInfo.style.width = w - 20 + 'px';
var divMapFavorites = document.getElementById('divMapFavorites');
divMapFavorites.style.height = h - 20 + 'px';
var divMapFavoritesContainer = document.getElementById('divMapFavoritesContainer');
divMapFavoritesContainer.style.height = h - 140 + 'px';
var divMapServices = document.getElementById('divMapServices');
divMapServices.style.width = w - 20 + 'px';
var divMapDirections = document.getElementById('divMapDirections');
divMapDirections.style.height = h - 20 + 'px';
var divMapDirectionsContainer = document.getElementById('divMapDirectionsContainer');
divMapDirectionsContainer.style.height = h - 135 + 'px';
var imgInspiraLogoLink = document.getElementById('imgInspiraLogoLink');
if(divMapDirections.style.display=='block') {
imgInspiraLogoLink.style.right = '287px';
} else {
imgInspiraLogoLink.style.right = '12px';
}
if(divMapServices.style.display=='block') {
imgInspiraLogoLink.style.bottom = '112px';
} else {
imgInspiraLogoLink.style.bottom = '25px';
}
var divMap = document.getElementById('divMap');
var mw = w - 20;
if(divMapFavorites.style.display=='block') {
divMap.style.left = '160px';
divMap.style.width = mw - 150 + 'px';
} else {
if(divMapDirections.style.display=='block') {
divMap.style.left = '10px';
divMap.style.width = mw - 275 + 'px';
} else {
divMap.style.left = '10px';
divMap.style.width = mw + 'px';
};
};
var mh = h - 20;
if(divMapInfo.style.display=='block') {
if(divMapServices.style.display=='block') {
divMap.style.height = mh - 47 - 87 + 'px';
} else {
divMap.style.height = mh - 47 + 'px';
};
divMap.style.top = '57px';
} else {
divMap.style.height = mh + 'px';
divMap.style.top = '10px';
}
WebMix.CheckResize();
}
/*
WebMixUIDOM.js
Funções relacionadas a interface com o usuário
Copyright 2008 - Inspira Tecnologia e Marketing
*/
function WebMixUIDOM() {
}
WebMixUIDOM.GetRegion = function(idx) {
return WebMixUIDOM.GetRegionList()[idx];
}
WebMixUIDOM.GetRegionList = function() {
// TODO: criar WebMixConfig.js e colocar essas e outras configs lá
var regions = [
['', 'Escolha uma região'],
['Praça da Sé, São Paulo - SP', 'São Paulo - Centro', 'CENTRO'],
['Penha, São Paulo - SP', 'São Paulo - Zona Leste', 'LESTE'],
['Tucuruvi, São Paulo - SP', 'São Paulo - Zona Norte', 'NORTE'],
['Jaguaré, São Paulo - SP ', 'São Paulo - Zona Oeste', 'OESTE'],
['Jabaquara, São Paulo - SP', 'São Paulo - Zona Sul', 'SUL'],
['Cotia, SP, Brasil', 'Cotia', 'COTIA'],
['Guarulhos, SP, Brasil', 'Guarulhos', 'GUARULHOS'],
['Jundiaí, SP, Brasil', 'Jundiaí', 'JUNDIAI'],
['Cajamar, SP, Brasil', 'Cajamar', 'CAJAMAR']
];
return regions;
}
WebMixUIDOM.GetTypeList = function(suitedFor) {
var types = [];
types.push(['', 'Todos os subtipos', '']);
if (!suitedFor || suitedFor == 'R') {
types.push(['A', 'Apartamento', 'R']);
types.push(['R', 'Casa (Condomínio)', 'R']);
types.push(['L', 'Casa (Avulsa)', 'R']);
}
if (!suitedFor || suitedFor == 'C') {
types.push(['C', 'Conjunto comercial', 'C']);
}
return types;
}
WebMixUIDOM.GetSuitedForList = function() {
var types = [
['', 'Todos os tipos'],
['R', 'Residencial'],
['C', 'Comercial']
];
return types;
}
WebMixUIDOM.GetAreaList = function() {
var areas = [
['', 'Todas as áreas'],
['30,45', 'de 30 a 45 m²'],
['45,60', 'de 45 a 60 m²'],
['60,90', 'de 60 a 90 m²'],
['90,120', 'de 90 a 120 m²'],
['120,200', 'de 120 a 200 m²'],
['200', '200 m² ou mais']
];
return areas;
}
WebMixUIDOM.GetDormsList = function() {
var dorms = [
['', 'Dormitórios'],
['1,2', '1 ou 2 dormitórios'],
['2,3', '2 ou 3 dormitórios'],
['3,4', '3 ou mais dormitórios']
];
return dorms;
}
/*
Preload UI elements
*/
WebMixUIDOM.LoadDom = function(webMixUI, divID) {
// valores iguais a WebMixUIResize() WebMixUI.js
var w = document.body.offsetWidth - 40;
if(w<933) { w=933; };
var h = document.body.offsetHeight - 40;
if(h<350) { h=350; };
// divMapBox: "moldura" que contém o mapa
var divMapBox = document.createElement('div');
divMapBox.id = 'divMapBox';
divMapBox.style.width = w + 'px';
divMapBox.style.height = h + 'px';
// se foi passado um DIV, monta o WEbMix no DIV
if (typeof(divID) != "undefined") {
document.getElementById(divID).appendChild(divMapBox);
} else {
document.body.appendChild(divMapBox);
}
// div que aparece quando algo está sendo processado
var divLoading = document.createElement('div');
divLoading.id = 'divLoading';
divMapBox.appendChild(divLoading);
// divMap: div que contém o mapa propriamente dito (GMap2)
var divMap = document.createElement('div');
divMap.id = 'divMap';
divMap.style.width = w - 20 + 'px';
divMap.style.height = h - 20 + 'px';
// divMapOverlay: camada cinza com opacidade por cima do mapa
var divMapOverlay = document.createElement('div');
divMapOverlay.id = 'divMapOverlay';
divMapOverlay.style.width = w - 20 + 'px';
divMapOverlay.style.height = h - 20 + 'px';
var imgWebMixLogo = document.createElement('img');
imgWebMixLogo.id = 'imgWebMixLogo';
WebMixUI.Loading(true,'imgWebMixLogo');
imgWebMixLogo.onload = function () { WebMixUI.Loading(false,'imgWebMixLogo'); };
imgWebMixLogo.src = WebMixUIDOM.GetImagePath('img/imgWebMixLogo.png');
var imgTrans = document.createElement('img');
WebMixUI.Loading(true, 'imgTrans');
imgTrans.onload = function () { WebMixUI.Loading(false, 'imgTrans'); };
imgTrans.src = WebMixUIDOM.GetImagePath('img/trans.gif');
var imgInspiraLogoLink = document.createElement('a');
imgInspiraLogoLink.href = 'http://www.inspira.com.br/';
imgInspiraLogoLink.id = 'imgInspiraLogoLink';
imgInspiraLogoLink.target = '_blank';
imgInspiraLogoLink.style.bottom = '25px';
imgInspiraLogoLink.style.right = '12px';
var imgInspiraLogo = document.createElement('img');
imgInspiraLogo.id = 'imgInspiraLogo';
//WebMixUI.Loading(true, 'imgInspiraLogo');
//imgInspiraLogo.onload = function () { WebMixUI.Loading(false, 'imgInspiraLogo'); };
imgInspiraLogo.src = WebMixUIDOM.GetImagePath('img/inspira.png');
var imgHelp = document.createElement('img');
WebMixUI.Loading(true, 'imgHelp');
imgHelp.onload = function () { WebMixUI.Loading(false, 'imgHelp'); };
imgHelp.src = WebMixUIDOM.GetImagePath('img/imgHelp.gif');
imgHelp.id = 'imgHelp';
imgHelp.onclick = function() {
WebMixUIDOM.ShowHelpBox();
}
// divMapInfo: contém área de informações do mapa
var divMapInfo = document.createElement('div');
divMapInfo.id = 'divMapInfo';
// imgWebMixLogo
divMapInfo.appendChild(imgWebMixLogo);
// divMapZoom: controle de zoom
var divMapZoom = document.createElement('div');
divMapZoom.id = 'divMapZoom';
divMapInfo.appendChild(divMapZoom);
// imgZoomDown
var imgZoomDown = document.createElement('img');
imgZoomDown.id = 'imgZoomDown';
imgZoomDown.src = WebMixUIDOM.GetImagePath('img/imgZoomDown.gif');
imgZoomDown.onclick = function() {
WebMix.ZoomUp();
}
divMapZoom.appendChild(imgZoomDown);
// divZoomLevelText
var divZoomLevelText = document.createElement('div');
divZoomLevelText.id = 'divZoomLevelText';
divZoomLevelText.appendChild(document.createTextNode('...'));
divMapZoom.appendChild(divZoomLevelText);
// imgZoomUp
var imgZoomUp = document.createElement('img');
imgZoomUp.id = 'imgZoomDown';
imgZoomUp.src = WebMixUIDOM.GetImagePath('img/imgZoomUp.gif');
imgZoomUp.onclick = function() {
WebMix.ZoomDown();
}
divMapZoom.appendChild(imgZoomUp);
var selType = new WebMixUIMenu('selType');
var selArea = new WebMixUIMenu('selArea');
var selDorms = new WebMixUIMenu('selDorms');
var selSuitedFor = new WebMixUIMenu('selSuitedFor');
var selRegion = new WebMixUIMenu('selRegion');
WebMixUIDOM.SelType = selType;
WebMixUIDOM.SelArea = selArea;
WebMixUIDOM.SelDorms = selDorms;
WebMixUIDOM.SelSuitedFor = selSuitedFor;
WebMixUIDOM.SelRegion = selRegion;
// divMapInfo.appendChild(selRegion);
selRegion.DataSource = WebMixUIDOM.GetRegionList();
selRegion.Show(divMapInfo);
selRegion.OnChange = WebMixUIDOM.UpdateMarkers;
//divMapInfo.appendChild(selSuitedFor);
selSuitedFor.DataSource = WebMixUIDOM.GetSuitedForList();
selSuitedFor.Show(divMapInfo);
selSuitedFor.OnChange = WebMixUIDOM.UpdateMarkers;
//divMapInfo.appendChild(selType);
selType.DataSource = WebMixUIDOM.GetTypeList();
selType.Show(divMapInfo);
selType.OnChange = WebMixUIDOM.UpdateMarkers;
//divMapInfo.appendChild(selArea);
selArea.DataSource = WebMixUIDOM.GetAreaList();
selArea.Show(divMapInfo);
selArea.OnChange = WebMixUIDOM.UpdateMarkers;
//divMapInfo.appendChild(selDorms);
selDorms.DataSource = WebMixUIDOM.GetDormsList();
selDorms.Show(divMapInfo);
selDorms.OnChange = WebMixUIDOM.UpdateMarkers;
// botao minimizar nao deve aparecer quando webmix nao for aberto como layer
if (typeof(divID) == "undefined") {
var imgMinimize = document.createElement('img');
WebMixUI.Loading(true, 'imgMinimize');
imgMinimize.onload = function () { WebMixUI.Loading(false, 'imgMinimize'); };
imgMinimize.src = WebMixUIDOM.GetImagePath('img/imgMinimize.gif');
imgMinimize.id = 'imgMinimize';
imgMinimize.title = 'Minimizar o mapa e voltar ao site';
imgMinimize.alt = imgMinimize.title;
imgMinimize.onclick = function() {
WebMix.MinimizeWindow();
}
divMapInfo.appendChild(imgMinimize);
}
divMapInfo.appendChild(imgHelp);
divMapInfo.style.width = w - 20 + 'px';
var divMapFavorites = document.createElement('div');
divMapFavorites.id = 'divMapFavorites';
divMapFavorites.style.height = h - 20 + 'px';
var divMapFavoritesText = document.createElement('div');
divMapFavoritesText.id = 'divMapFavoritesText';
divMapFavoritesText.innerHTML = 'Não há nenhum imóvel selecionado.
Para adicionar um favorito, escolha um imóvel no mapa e clique na opção "[+ favoritos]"';
var divMapFavoritesContainer = document.createElement('div');
divMapFavoritesContainer.id = 'divMapFavoritesContainer';
var imgFavorites = document.createElement('img');
imgFavorites.id = 'imgFavorites';
imgFavorites.alternateText = 'Aqui você reserva os imóveis que vocë mais gostou, para consultá-los quando quiser';
WebMixUI.Loading(true, 'imgFavorites');
imgFavorites.onload = function () { WebMixUI.Loading(false, 'imgFavorites'); };
imgFavorites.src = WebMixUIDOM.GetImagePath('img/favoritos.png');
var icoFavorites = document.createElement('img');
icoFavorites.id = 'icoFavorites';
icoFavorites.alternateText = 'Aqui você reserva os imóveis que vocë mais gostou, para consultá-los quando quiser';
WebMixUI.Loading(true, 'icoFavorites');
icoFavorites.onload = function () { WebMixUI.Loading(false, 'icoFavorites'); };
icoFavorites.src = WebMixUIDOM.GetImagePath('img/iconefavoritos.png');
icoFavorites.onclick = function() {
webMixUI.ShowFavorites();
webMixUI.UpdateFavoriteList();
WebMixUIResize();
}
var icoFavoritesOn = document.createElement('img');
icoFavoritesOn.id = 'icoFavoritesOn';
WebMixUI.Loading(true, 'icoFavoritesOn');
icoFavoritesOn.onload = function () { WebMixUI.Loading(false, 'icoFavoritesOn'); };
icoFavoritesOn.src = WebMixUIDOM.GetImagePath('img/icoFavoritesOn.png');
icoFavoritesOn.onclick = function() {
webMixUI.HideFavorites();
WebMixUIResize();
}
var divMapServices = document.createElement('div');
divMapServices.id = 'divMapServices';
divMapServices.style.width = w - 20 + 'px';
var divAllServices = document.createElement('div');
divAllServices.id = 'divAllServices';
divMapServices.appendChild(divAllServices);
var imgHospitals = imgTrans.cloneNode(true);
imgHospitals.id = 'imgHospitals';
imgHospitals.onclick = function() { WebMix.QueryServices("hospital"); }
var imgSupermarkets = imgTrans.cloneNode(true);
imgSupermarkets.id = 'imgSupermarkets';
imgSupermarkets.onclick = function() { WebMix.QueryServices("supermercado"); }
var imgShoppings = imgTrans.cloneNode(true);
imgShoppings.id = 'imgShoppings';
imgShoppings.onclick = function() { WebMix.QueryServices("shopping"); }
var imgTransport = imgTrans.cloneNode(true);
imgTransport.id = 'imgTransport';
imgTransport.onclick = function() { WebMix.QueryServices("transporte"); }
var imgBanks = imgTrans.cloneNode(true);
imgBanks.id = 'imgBanks';
imgBanks.onclick = function() { WebMix.QueryServices("banco"); }
divAllServices.appendChild(imgHospitals);
divAllServices.appendChild(imgSupermarkets);
divAllServices.appendChild(imgTransport);
divAllServices.appendChild(imgBanks);
divAllServices.appendChild(imgShoppings);
var icoServices = document.createElement('img');
icoServices.id = 'icoServices';
icoServices.alternateText = 'Aqui você reserva os serviços e atrativos de cada bairro, direto no mapa';
WebMixUI.Loading(true, 'icoServices');
icoServices.onload = function () { WebMixUI.Loading(false, 'icoServices'); };
icoServices.src = WebMixUIDOM.GetImagePath('img/iconeservicos.png');
icoServices.onclick = function() {
webMixUI.ShowServices();
WebMixUIResize();
}
var icoServicesOn = document.createElement('img');
icoServicesOn.id = 'icoServicesOn';
WebMixUI.Loading(true, 'icoServicesOn');
icoServicesOn.onload = function () { WebMixUI.Loading(false, 'icoServicesOn'); };
icoServicesOn.src = WebMixUIDOM.GetImagePath('img/icoServicesOn.png');
icoServicesOn.onclick = function() {
webMixUI.HideServices();
WebMixUIResize();
}
var divMapDirections = document.createElement('div');
divMapDirections.id = 'divMapDirections';
divMapDirections.style.height = h - 20 + 'px';
var imgComoChegar = document.createElement('img');
imgComoChegar.id = 'imgComoChegar';
WebMixUI.Loading(true, 'imgComoChegar');
imgComoChegar.onload = function () { WebMixUI.Loading(false, 'imgComoChegar'); };
imgComoChegar.src = WebMixUIDOM.GetImagePath('img/comochegar.png');
divMapDirections.appendChild(imgComoChegar);
var divMapDirectionsText = document.createElement('div');
divMapDirectionsText.id = 'divMapDirectionsText';
divMapDirectionsText.innerHTML = 'Para traçar rotas para algum imóvel, escolha-o no mapa e utilize a opção "como chegar".
Você precisará informar apenas o endereço de origem.';
divMapDirections.appendChild(divMapDirectionsText);
var divMapDirectionsContainer = document.createElement('div');
divMapDirectionsContainer.id = 'divMapDirectionsContainer';
divMapDirections.appendChild(divMapDirectionsContainer);
var divMapDirectionsSource = document.createElement('div');
divMapDirectionsSource.id = 'divMapDirectionsSource';
divMapDirectionsContainer.appendChild(divMapDirectionsSource);
var divMapDirectionsSteps = document.createElement('div');
divMapDirectionsSteps.id = 'divMapDirectionsSteps';
divMapDirectionsContainer.appendChild(divMapDirectionsSteps);
var icoDirections = document.createElement('img');
icoDirections.id = 'icoDirections';
icoDirections.alternateText = 'Trace rotas para onde você quiser, facilitando a vida';
WebMixUI.Loading(true, 'icoDirections');
icoDirections.onload = function () { WebMixUI.Loading(false, 'icoDirections'); };
icoDirections.src = WebMixUIDOM.GetImagePath('img/iconerotas.png');
icoDirections.onclick = function() {
webMixUI.ShowDirections(false);
WebMixUIResize();
}
var icoDirectionsOn = document.createElement('img');
icoDirectionsOn.id = 'icoDirectionsOn';
WebMixUI.Loading(true, 'icoDirectionsOn');
icoDirectionsOn.onload = function () { WebMixUI.Loading(false, 'icoDirectionsOn'); };
icoDirectionsOn.src = WebMixUIDOM.GetImagePath('img/icoDirectionsOn.png');
icoDirectionsOn.onclick = function() {
webMixUI.HideDirections();
WebMixUIResize();
}
// divMapContainer: contém o mapa e a área de informações
var divMapContainer = document.createElement('div');
divMapContainer.id = 'divMapContainer';
// logo Inspira
divMapBox.appendChild(imgInspiraLogoLink);
imgInspiraLogoLink.appendChild(imgInspiraLogo);
// adiciona mapa no container
divMapBox.appendChild(divMap);
divMapBox.appendChild(divMapOverlay);
divMapBox.appendChild(WebMixUIDOM.GetMapWizard(webMixUI));
// adiciona área de informações no container
divMapBox.appendChild(divMapInfo);
// fechar janela nao deve aparecer quando o webmix nao for um layer
if (!divID) {
var divCloseWindow = document.createElement('div');
divCloseWindow.id = 'divCloseWindow';
divCloseWindow.onclick = function() { WebMix.HideWindow() };
divCloseWindow.appendChild(document.createTextNode('X'));
divMapBox.appendChild(divCloseWindow);
}
divMapFavorites.appendChild(imgFavorites);
divMapFavorites.appendChild(divMapFavoritesText);
divMapFavorites.appendChild(divMapFavoritesContainer);
divMapBox.appendChild(icoFavorites);
divMapBox.appendChild(icoFavoritesOn);
divMapBox.appendChild(divMapFavorites);
//divMapFavorites.appendChild(imgServiceos);
divMapBox.appendChild(icoServices);
divMapBox.appendChild(icoServicesOn);
divMapBox.appendChild(divMapServices);
divMapBox.appendChild(icoDirections);
divMapBox.appendChild(icoDirectionsOn);
divMapBox.appendChild(divMapDirections);
// adiciona container dentro da moldura
// divMapBox.appendChild(divMapContainer);
// map overlay para escurecer / proteger mapa quando inativo
divMapBox.appendChild(divMapOverlay);
/*var imgLoading = document.createElement('img');
imgLoading.id = 'imgLoading';
imgLoading.alt = 'Carregando...';
imgLoading.src = 'img/carregando2.gif';
divLoading.appendChild(imgLoading);*/
}
WebMixUIDOM.GetMapWizard = function(webMixUI) {
var imgTrans = document.createElement('img');
WebMixUI.Loading(true, 'imgTrans');
imgTrans.onload = function () { WebMixUI.Loading(false, 'imgTrans'); };
imgTrans.src = WebMixUIDOM.GetImagePath('img/trans.gif');
var divMapWizard = document.createElement('div');
divMapWizard.id = 'divMapWizard';
divMapWizard.style['display'] = 'none';
var divMapWizardStep1 = document.createElement('div');
divMapWizardStep1.id = 'divMapWizardStep1';
divMapWizardStep1.className = 'clsMapWizardStep';
divMapWizard.appendChild(divMapWizardStep1);
var alImg1 = document.createElement('span');
alImg1.id = 'alImg1';
divMapWizardStep1.appendChild(alImg1);
var imgMapWizardStep1 = document.createElement('img');
imgMapWizardStep1.id = 'imgMapWizardStep1';
WebMixUI.Loading(true, 'imgMapWizardStep1');
imgMapWizardStep1.onload = function () { WebMixUI.Loading(false, 'imgMapWizardStep1'); };
imgMapWizardStep1.src = WebMixUIDOM.GetImagePath('img/wizard1_24.png');
imgMapWizardStep1.alt = 'Encontre seu imóvel ideal com o WebMix';
alImg1.appendChild(imgMapWizardStep1);
var City1 = document.createElement('select');
City1.id = 'City1';
//City1.style.display = 'none'; // avoud nasty show over everything at IE6
City1.onchange = function() {
document.getElementById('City2').selectedIndex = document.getElementById('City1').selectedIndex-1;
var myRegion = WebMixUIDOM.GetRegionList()[document.getElementById('City1').selectedIndex][2];
WebMix.GetMarkerCount( { region: myRegion, suitedFor: 'R' }, function(count) { SearchResult2.innerHTML = count; });
WebMix.ShowWizardStep(2);
WebMix.LoadMap();
};
divMapWizardStep1.appendChild(City1);
var regions = WebMixUIDOM.GetRegionList();
var suitedForList = WebMixUIDOM.GetSuitedForList();
var areas = WebMixUIDOM.GetAreaList();
for (var i = 0; i < regions.length; i++) {
var r = regions[i];
var myOption = document.createElement('option');
myOption.value = r[0];
myOption.appendChild(document.createTextNode(r[1]));
City1.appendChild(myOption);
}
var divMapWizardStep2 = document.createElement('div');
divMapWizardStep2.id = 'divMapWizardStep2';
divMapWizardStep2.className = 'clsMapWizardStep';
divMapWizard.appendChild(divMapWizardStep2);
var alImg2 = document.createElement('span');
alImg2.id = 'alImg2';
divMapWizardStep2.appendChild(alImg2);
var imgMapWizardStep2 = document.createElement('img');
imgMapWizardStep2.id = 'imgMapWizardStep2';
WebMixUI.Loading(true, 'imgMapWizardStep2');
imgMapWizardStep2.onload = function () { WebMixUI.Loading(false, 'imgMapWizardStep2'); };
imgMapWizardStep2.src = WebMixUIDOM.GetImagePath('img/wizard2_24.png');
imgMapWizardStep2.alt = 'Encontre seu imóvel ideal com o WebMix';
alImg2.appendChild(imgMapWizardStep2);
var City2 = document.createElement('select');
City2.id = 'City2';
City2.onchange = function() {
//WebMix.ApplyFilter( { city: City2.selectedIndex, type: Type2.value } );
var myRegion = WebMixUIDOM.GetRegionList()[document.getElementById('City2').selectedIndex + 1][2];
WebMix.GetMarkerCount( { region: myRegion, suitedFor: Type2.value }, function(count) { SearchResult2.innerHTML = count.toString(); });
WebMix.PositionMap(this.value);
}
divMapWizardStep2.appendChild(City2);
for (var i = 1; i < regions.length; i++) {
var r = regions[i];
var myOption = document.createElement('option');
myOption.value = r[0];
myOption.appendChild(document.createTextNode(r[1]));
City2.appendChild(myOption);
}
var Type2 = document.createElement('select');
Type2.id = 'Type2';
Type2.onchange = function() {
var myRegion = WebMixUIDOM.GetRegionList()[document.getElementById('City2').selectedIndex + 1][2];
WebMix.GetMarkerCount( { region: myRegion, suitedFor: Type2.value }, function(count) { SearchResult2.innerHTML = count.toString(); });
}
divMapWizardStep2.appendChild(Type2);
for (var i = 1; i < suitedForList.length; i++) {
var t = suitedForList[i];
var myOption = document.createElement('option');
myOption.value = t[0];
myOption.appendChild(document.createTextNode(t[1]));
Type2.appendChild(myOption);
}
var SearchResult2 = document.createElement('span');
SearchResult2.id = 'SearchResult2';
divMapWizardStep2.appendChild(SearchResult2);
var imgGotoStep3 = imgTrans.cloneNode(true);
imgGotoStep3.id = 'imgGotoStep3';
imgGotoStep3.alt = 'Continuar';
imgGotoStep3.width = "150";
imgGotoStep3.height="180";
imgGotoStep3.onclick = function() {
document.getElementById('City3').selectedIndex = document.getElementById('City2').selectedIndex;
document.getElementById('Type3').selectedIndex = document.getElementById('Type2').selectedIndex;
decideStep3(Type2.value);
// WebMix.ApplyFilter( { suitedFor: Type2.value }, function() { SearchResult3.innerHTML = WebMix.GetMarkerList().length.toString(); });
var myRegion = WebMixUIDOM.GetRegionList()[document.getElementById('City2').selectedIndex + 1][2];
WebMix.GetMarkerCount( { region: myRegion, suitedFor: Type2.value }, function(count) { SearchResult3.innerHTML = count.toString(); });
WebMix.ShowWizardStep(3);
}
divMapWizardStep2.appendChild(imgGotoStep3);
var divMapWizardStep3 = document.createElement('div');
divMapWizardStep3.id = 'divMapWizardStep3';
divMapWizardStep3.className = 'clsMapWizardStep';
divMapWizard.appendChild(divMapWizardStep3);
var SearchResult3 = document.createElement('span');
SearchResult3.id = 'SearchResult3';
var alImg3 = document.createElement('span');
alImg3.id = 'alImg3';
divMapWizardStep3.appendChild(alImg3);
var imgMapWizardStep3 = document.createElement('img');
imgMapWizardStep3.id = 'imgMapWizardStep3';
WebMixUI.Loading(true, 'imgMapWizardStep3');
imgMapWizardStep3.onload = function () { WebMixUI.Loading(false, 'imgMapWizardStep3'); };
imgMapWizardStep3.src = WebMixUIDOM.GetImagePath('img/wizard3_24.png');
imgMapWizardStep3.alt = 'Encontre seu imóvel ideal com o WebMix';
alImg3.appendChild(imgMapWizardStep3);
var City3 = document.createElement('select');
City3.id = 'City3';
City3.onchange = function() {
var myRegion = WebMixUIDOM.GetRegionList()[document.getElementById('City3').selectedIndex + 1][2];
WebMix.GetMarkerCount( { region: myRegion, suitedFor: Type3.value, area: Area3.value, dorms: Dorms3.value }, function(count) { SearchResult3.innerHTML = count.toString(); });
WebMix.PositionMap(this.value);
}
divMapWizardStep3.appendChild(City3);
for (var i = 1; i < regions.length; i++) {
var r = regions[i];
var myOption = document.createElement('option');
myOption.value = r[0];
myOption.appendChild(document.createTextNode(r[1]));
City3.appendChild(myOption);
}
var decideStep3 = function(v) {
if (v == 'R') { // residencial
alImg3.id = 'alImg3';
imgMapWizardStep3.id = 'imgMapWizardStep3';
imgMapWizardStep3.src = WebMixUIDOM.GetImagePath('img/wizard3_24.png');
if (hasChild(divMapWizardStep3, Area3)) {
divMapWizardStep3.removeChild(Area3);
}
if (!hasChild(divMapWizardStep3, Dorms3)) {
divMapWizardStep3.appendChild(Dorms3);
}
} else {
alImg3.id = 'alImg3b';
imgMapWizardStep3.src = WebMixUIDOM.GetImagePath('img/wizard3b_24.png');
if (hasChild(divMapWizardStep3, Dorms3)) {
divMapWizardStep3.removeChild(Dorms3);
}
if (!hasChild(divMapWizardStep3, Area3)) {
divMapWizardStep3.appendChild(Area3);
}
}
}
var Type3 = document.createElement('select');
Type3.id = 'Type3';
Type3.onchange = function() {
decideStep3(this.value);
// WebMix.ApplyFilter( { suitedFor: Type3.value }, function() { SearchResult3.innerHTML = WebMix.GetMarkerList().length.toString(); });
var myRegion = WebMixUIDOM.GetRegionList()[document.getElementById('City3').selectedIndex + 1][2];
if (Type3.value == 'R') {
WebMix.GetMarkerCount( { region: myRegion, suitedFor: Type3.value, dorms: Dorms3.value }, function(count) { SearchResult3.innerHTML = count.toString(); });
} else {
WebMix.GetMarkerCount( { region: myRegion, suitedFor: Type3.value, area: Area3.value }, function(count) { SearchResult3.innerHTML = count.toString(); });
}
}
divMapWizardStep3.appendChild(Type3);
for (var i = 1; i < suitedForList.length; i++) {
var t = suitedForList[i];
var myOption = document.createElement('option');
myOption.value = t[0];
myOption.appendChild(document.createTextNode(t[1]));
Type3.appendChild(myOption);
}
var Dorms3 = document.createElement('select');
Dorms3.id = 'Dorms3';
Dorms3.onchange = function() {
// WebMix.ApplyFilter( { suitedFor: Type3.value, dorms: Dorms3.value }, function() { SearchResult3.innerHTML = WebMix.GetMarkerList().length.toString(); });
var myRegion = WebMixUIDOM.GetRegionList()[document.getElementById('City3').selectedIndex + 1][2];
WebMix.GetMarkerCount( { region: myRegion, suitedFor: Type3.value, dorms: Dorms3.value }, function(count) { SearchResult3.innerHTML = count.toString(); });
}
var dormsList = WebMixUIDOM.GetDormsList();
for (var i = 0; i < dormsList.length; i++) {
var myOption = document.createElement('option');
myOption.value = dormsList[i][0];
var txt;
if (i == 0) txt = 'Indiferente';
else txt = dormsList[i][1];
myOption.appendChild(document.createTextNode(txt));
Dorms3.appendChild(myOption);
}
divMapWizardStep3.appendChild(Dorms3);
var Area3 = document.createElement('select');
Area3.id = 'Area3';
Area3.onchange = function() {
var myRegion = WebMixUIDOM.GetRegionList()[document.getElementById('City3').selectedIndex + 1][2];
WebMix.GetMarkerCount( { region: myRegion, suitedFor: Type3.value, area: Area3.value }, function(count) { SearchResult3.innerHTML = count.toString(); });
}
for (var i = 0; i < areas.length; i++) {
var a = areas[i];
var myOption = document.createElement('option');
myOption.value = a[0];
var txt;
if (i == 0) txt = 'Indiferente';
else txt = a[1];
myOption.appendChild(document.createTextNode(txt));
Area3.appendChild(myOption);
}
divMapWizardStep3.appendChild(Area3);
divMapWizardStep3.appendChild(SearchResult3);
var imgWizardFinish = imgTrans.cloneNode(true);
imgWizardFinish.id = 'imgWizardFinish';
imgWizardFinish.alt = 'Finalizar';
imgWizardFinish.width = "150";
imgWizardFinish.height="180";
imgWizardFinish.onclick = function() {
WebMixUI.Loading(true, 'search');
WebMixUIDOM.SelRegion.setSelectedIndex(City3.selectedIndex + 1);
WebMixUIDOM.SelSuitedFor.setSelectedIndex(Type3.selectedIndex + 1);
WebMixUIDOM.SelArea.setSelectedIndex(Area3.selectedIndex + 1);
WebMixUIDOM.SelDorms.setSelectedIndex(Dorms3.selectedIndex);
var myRegion = WebMixUIDOM.GetRegionList()[document.getElementById('City3').selectedIndex + 1][2];
var mySuitedFor = Type3.value;
if (mySuitedFor == "R") {
WebMix.DoSearch( { region: myRegion, suitedFor: Type3.value, dorms: Dorms3.value } );
} else {
WebMix.DoSearch( { region: myRegion, suitedFor: Type3.value, area: Area3.value } );
}
document.getElementById('divMapWizardStep3').style['display']='none';
if (WebMixUIDOM.SelSuitedFor.value == "R") {
document.getElementById('selDorms').style['display'] = 'block';
}/* else if (document.getElementById('selSuitedFor').value == "C") {
//document.getElementById('selArea').style['display'] = 'inline';
}*/
}
divMapWizardStep3.appendChild(imgWizardFinish);
return divMapWizard;
};
WebMixUIDOM.LoadHelpBox = true;
WebMixUIDOM.ShowHelpBox = function() {
WebMixUIDOM.ShowMessageBox('Ajuda', 'Como faço para achar meu imóvel ideal através do mapa?
Você escolhe as características desejadas e aparecerão todos os imóveis que se enquadram no seu perfil.
Como faço para iniciar uma nova busca?
É só utilizar a aba de filtros e fazer uma nova pesquisa. A partir daí o mapa identificará todos os imóveis que atendam os critérios selecionados.
Como faço para conhecer mais sobre a região?
Clique na aba serviços localizada no centro-inferior do mapa. Lá você conhecerá as proximidades de shoppings, hospitais, escolas entre outros.
Como faço para adicionar aos meus favoritos?
Para adicionar um favorito, escolha um imóvel no mapa e clique na opção "[+ favoritos]"
Como faço para chegar até o imóvel desejado?
Escolha o imóvel que deseja conhecer e clique na opção [como chegar]. Em seguida digite o endereço de origem e aguarde.
');
}
WebMixUIDOM.ShowMessageBox = function(title, message) {
if (WebMixUIDOM.LoadHelpBox) {
var divHelpBox = document.createElement('div');
divHelpBox.id = 'divHelpBox';
var divMapBox = document.getElementById('divMapBox');
divMapBox.appendChild(divHelpBox);
var SpanHelpCloseButton = document.createElement('span');
SpanHelpCloseButton.id = 'SpanHelpCloseButton';
divHelpBox.appendChild(SpanHelpCloseButton);
SpanHelpCloseButton.innerHTML = 'X';
SpanHelpCloseButton.onclick = WebMixUIDOM.HideMessageBox;
var h2 = document.createElement('h2');
h2.id = 'h2HelpTitle';
divHelpBox.appendChild(h2);
h2.appendChild(document.createTextNode(title));
var SpanHelpText = document.createElement('span');
SpanHelpText.id = 'SpanHelpText';
divHelpBox.appendChild(SpanHelpText);
SpanHelpText.innerHTML = message;
WebMixUIDOM.LoadHelpBox = false;
} else {
document.getElementById('SpanHelpText').innerHTML = message;
document.getElementById('h2HelpTitle').innerHTML = title;
document.getElementById('divHelpBox').style['display']='block';
}
}
WebMixUIDOM.HideMessageBox = function() {
var divHelpBox = document.getElementById('divHelpBox');
if (divHelpBox) {
divHelpBox.style['display']='none';
}
}
WebMixUIDOM.UpdateMarkers = function() {
var selRegion = WebMixUIDOM.SelRegion;
var selType = WebMixUIDOM.SelType;
var selSuitedFor = WebMixUIDOM.SelSuitedFor;
var selDorms = WebMixUIDOM.SelDorms;
var myRegion = WebMixUIDOM.GetRegion(selRegion.selectedIndex)[2];
var debug = '';
debug += 'Region: ' + myRegion;
debug += '\nType: ' + selType.value;
debug += '\nSuited For: ' + selSuitedFor.value;
debug += '\nDorms: ' + selDorms.value;
if(selSuitedFor.value == 'R') {
document.getElementById('selDorms').style['display'] = 'inline';
selType.DataSource = WebMixUIDOM.GetTypeList('R');
debug += '\nApplying filter: (Region:' + myRegion + ', Suited For:' + selSuitedFor.value + ', Dorms: ' + selDorms.value + ')';
WebMix.ApplyFilter({
region: myRegion,
suitedFor: selSuitedFor.value,
dorms: selDorms.value
});
} else if (selSuitedFor.value == 'C') {
document.getElementById('selDorms').style['display'] = 'none';
selType.DataSource = WebMixUIDOM.GetTypeList('C');
var myRegion = WebMixUIDOM.GetRegion(selRegion.selectedIndex)[2];
debug += '\nApplying filter: (Region:' + myRegion + ', Suited For:' + selSuitedFor.value + ')';
WebMix.ApplyFilter({
region: myRegion,
suitedFor: selSuitedFor.value
});
} else {
document.getElementById('selDorms').style['display'] = 'none';
selType.DataSource = WebMixUIDOM.GetTypeList();
var myRegion = WebMixUIDOM.GetRegion(selRegion.selectedIndex)[2];
debug += '\nApplying filter: (Region:' + myRegion + ')';
WebMix.ApplyFilter({
region: myRegion
});
}
//alert(debug);
selType.Show();
}
WebMixUIDOM.ImageIndex = 1;
WebMixUIDOM.GetImagePath = function(path) {
var absPath
switch (WebMixUIDOM.ImageIndex) {
case 1:
absPath = "http://inspira.com.br/app/WebMixRealty/";
break;
case 2:
absPath = "http://www.inspira.com.br/app/WebMixRealty/";
break;
case 3:
absPath = "http://app.inspira.com.br/WebMixRealty/";
break;
}
if (WebMixUIDOM.ImageIndex == 3) {
WebMixUIDOM.ImageIndex = 1;
} else {
WebMixUIDOM.ImageIndex++;
}
if(DEV_ENV)
absPath = "";
return absPath + path;
}
WebMixImageManager = function() {
}
function hasChild(parent, child) {
for (node in parent.ChildNodes) {
if (node == child) {
return true;
}
}
return false;
}
function WebMixUIMenu(id, onchangeCallback) {
var self = this;
self._id = id;
self._onchangeCallback = onchangeCallback;
this.DataSource = [];
this.selectedIndex = -1;
this.value = '';
self.IsLoaded = false;
this.setSelectedIndex = function(idx) {
self.selectedIndex = idx;
self.value = self.DataSource[idx][0];
self.text = self.DataSource[idx][1];
if (self.LiMenuItemDisabled) self.LiMenuItemDisabled.innerHTML = self.DataSource[idx][1];
}
this.Load = function(parent) {
// cria div que contem o menu selecionado e o nao selecionado
var divMenu = document.createElement('div');
parent.appendChild(divMenu);
divMenu.id = id;
divMenu.className = "clsMenu";
// menu nao selecionado... com opcao para selecionar
var divMenuDisabled = document.createElement('div');
divMenu.appendChild(divMenuDisabled);
divMenuDisabled.className = "clsMenuDisabled";
divMenuDisabled.onclick = function () {
var y = this;
for (var i = 0; i < y.parentNode.childNodes.length; i++) {
var k = y.parentNode.childNodes[i];
if (k.className == 'clsMenuEnabled') {
k.style['display'] = 'block';
}
}
}
// lista de elementos nao selecionados (contem apenas 1)
var ulMenuListDisabled = document.createElement('ul');
divMenuDisabled.appendChild(ulMenuListDisabled);
ulMenuListDisabled.className = 'clsMenuListDisabled';
// elemento nao selecionado
var liMenuItemDisabled = null;
if (self.DataSource.length > 0) {
liMenuItemDisabled = document.createElement('li');
ulMenuListDisabled.appendChild(liMenuItemDisabled);
liMenuItemDisabled.appendChild(document.createTextNode(self.DataSource[0][1]));
self.LiMenuItemDisabled = liMenuItemDisabled;
}
// div selecionado, que exibe todas as opcoes
var divMenuEnabled = document.createElement('div');
divMenu.appendChild(divMenuEnabled);
divMenuEnabled.className = "clsMenuEnabled";
self.DivMenuEnabled = divMenuEnabled;
// lista de opcoes
var ulMenuListEnabled = document.createElement('ul');
divMenuEnabled.appendChild(ulMenuListEnabled);
ulMenuListEnabled.className = 'clsMenuListEnabled';
self.UlMenuListEnabled = ulMenuListEnabled;
}
this.Show = function(parent) {
if (!self.IsLoaded) {
self.Load(parent);
self.IsLoaded = true;
}
self.UlMenuListEnabled.innerHTML = '';
var dataSource = self.DataSource;
for (var i = 0; i < dataSource.length; i++) {
var _dataItem = dataSource[i];
var liMenuItemEnabled = document.createElement('li');
self.UlMenuListEnabled.appendChild(liMenuItemEnabled);
liMenuItemEnabled._value = _dataItem[0];
liMenuItemEnabled._text = _dataItem[1];
liMenuItemEnabled._selectedIndex = i;
liMenuItemEnabled.appendChild(document.createTextNode(_dataItem[1]));
liMenuItemEnabled.onclick = function() {
self.selectedIndex = this._selectedIndex;
self.value = this._value;
self.text = this._text;
if (self.LiMenuItemDisabled) self.LiMenuItemDisabled.innerHTML = this._text;
if (typeof(self.OnChange) == "function") {
self.OnChange();
}
self.DivMenuEnabled.style['display'] = 'none';
}
}
}
}
function WebMixDataStore() {
var self = this;
var _favoriteList = [];
var _markerList = [];
this.AddFavorite = function(mkrID) {
if (self.GetFavorite(mkrID) == null) {
_favoriteList.push(mkrID);
}
}
this.GetFavoriteList = function() {
var tmpList = [];
for (var i = 0;i < _favoriteList.length; i++) {
var mkr = self.GetMarkerByID(_favoriteList[i]);
tmpList.push(mkr);
}
return tmpList;
}
this.GetFavorite = function(mkrID) {
for (var i = 0; i < _favoriteList.length; i++) {
var favoriteID = _favoriteList[i];
if (favoriteID == mkrID) {
return self.GetMarkerByID(favoriteID);
}
}
return null;
}
this.RemoveFavorite = function(id){
for (var i = 0;i < _favoriteList.length; i++) {
var f = _favoriteList[i];
if (f == id) {
_favoriteList.splice(i, 1);
return;
}
}
}
this.SetMarkerList = function(list) {
_markerList = list;
}
this.GetMarkerList = function() {
return _markerList;
}
this.GetMarkerByID = function(id){
for (var i = 0; i < _markerList.length; i++) {
var mkr = _markerList[i];
if (mkr.id == id) return mkr;
}
return null;
}
}
/*
WebMixMap.js
Contém funções internas relacionadas com mapa
Copyright 2008 - Inspira Tecnologia e Marketing
*/
function WebMixMap(_mapDiv) {
var self = this;
this.mapDiv = _mapDiv;
this.LoadMap = function() {
if (!this.isLoaded) {
google.load("maps", "2.x", {"callback" : self.initialize });
isLoaded = true;
}
}
this.UnloadMap = function() {
GUnload();
}
this.initialize = function() {
if (GBrowserIsCompatible()) {
var options = {
listingTypes : "blended",
onMarkersSetCallback : function(markers) {
var iconUrl = WebMixUIDOM.GetImagePath('img/' + WebMixMap.CurrentService + '.jpg');
for (var i = 0; i < markers.length; i++) {
var marker = markers[i].marker;
var barnIcon = marker.getIcon();
barnIcon.iconSize = new GSize(32, 32);
barnIcon.iconAnchor = new GPoint(8, 28);
barnIcon.infoWindowAnchor = new GPoint(8, 0);
barnIcon.transparent = WebMixUIDOM.GetImagePath("img/trans.gif");
marker.setImage(iconUrl);
}
},
searchFormHint : "Ex: natação",
showOnLoad : true
};
var map = new google.maps.Map2(document.getElementById("divMap"), {googleBarOptions:options});
map.enableGoogleBar();
map.setCenter(new GLatLng(-23.55, -46.64), WebMixMap.DEFAULT_ZOOM_LEVEL);
map.addControl(new GMapTypeControl());
self.GMap = map;
var gdir = new GDirections(map, document.getElementById("divMapDirectionsContainer"));
GEvent.addListener(gdir, "error", self.handleErrors);
self.GDir = gdir;
var geocoder = new GClientGeocoder();
geocoder.setBaseCountryCode("br");
self.GGeocoder = geocoder;
}
}
this.ZoomUp = function() {
if (self.GMap) self.GMap.zoomOut();
}
this.ZoomDown = function() {
if (self.GMap) self.GMap.zoomIn();
}
this.GetZoomLevel = function() {
if (typeof(self.GMap) != "undefined") {
return self.GMap.getZoom();
} else {
return WebMixMap.DEFAULT_ZOOM_LEVEL;
}
}
this.ClearMarkers = function() {
if (self.GMap != null) {
self.GMap.clearOverlays();
}
}
this.FitMap = function(points) {
var bounds = new GLatLngBounds();
for (var i=0; i< points.length; i++) {
bounds.extend(points[i]);
}
var map = self.GMap;
map.setZoom(map.getBoundsZoomLevel(bounds));
map.setCenter(bounds.getCenter());
}
this.DisplayMarkerList = function(markerList) {
if (self.GMap == null) return;
WebMix.SetMarkerList(markerList);
// lista de todos os marcadores no mapa
var gMarkerList = [];
var gLatLngList = [];
for (i = 0; i < markerList.length; i++) {
var markerInfo = markerList[i];
var icon = new GIcon(G_DEFAULT_ICON, markerInfo.iconUrl);
icon.iconSize = new GSize(markerInfo.iconWidth, markerInfo.iconHeight);
icon.shadowSize = new GSize(markerInfo.iconWidth, markerInfo.iconHeight);
icon.imageMap = [0,0, markerInfo.iconWidth,0, markerInfo.iconWidth,markerInfo.iconHeight, 0,markerInfo.iconHeight];
var myLatLng = new GLatLng(markerInfo.latitude, markerInfo.longitude);
gLatLngList.push(myLatLng);
var marker = new GMarker(myLatLng, { title: markerInfo.name, icon: icon });
// gambiarra pq tem o menu superior preto por cima do mapa :(
//GEvent.addListener(marker, "click", function() { window.setTimeout(function(){self.GMap.panBy(new GSize(0,60))},1000) });
if (markerInfo.infoWindowTabs.length == 1) {
// has only one tab... using tabless window
var iwt = markerInfo.infoWindowTabs[0];
var moreInfo = "";
if (markerInfo.siteUrl != null && markerInfo.siteUrl.length > 0) {
moreInfo = ' [ver site]';
}
marker.bindInfoWindowHtml('
'+iwt.title +'
'+iwt.description + ' ');
} else if (markerInfo.infoWindowTabs.length > 1) {
var tabArray = new Array(markerInfo.infoWindowTabs.count);
for (j = 0; j < markerInfo.infoWindowTabs.length; j++) {
var t = markerInfo.infoWindowTabs[j];
tabArray[j] = new GInfoWindowTab(t.title, t.description);
}
marker.bindInfoWindowTabsHtml(tabArray);
}
self.GMap.addOverlay(marker);
gMarkerList.push(marker);
}
this.gMarkerList = gMarkerList;
this.FitMap(gLatLngList);
}
this.QueryServices = function(service) {
WebMixMap.CurrentService = service;
var inputSearch = getElementsByClassName('gsc-input', 'input');
inputSearch[0].value = service;
inputSearch[0].parentNode.parentNode.childNodes[1].firstChild.onclick();
}
this.PositionMap = function(address) {
var geocoder = self.GGeocoder;
if (geocoder) {
geocoder.getLatLng(
address,
function(point) {
if (point) {
self.GMap.setCenter(point, WebMixMap.DEFAULT_ZOOM_LEVEL);
}
}
);
}
}
this.ShowDirections = function(from, to) {
var query = "from: " + from + " to: " + to;
//prompt(query, query);
self.GDir.load(query ,{ "locale": "pt_BR" });
}
this.handleErrors = function(){
if (self.GDir.getStatus().code == G_GEO_UNKNOWN_ADDRESS)
WebMix.Alert("Erro", "Endereço não encontrado. Por favor tente novamente.");
else
WebMix.Alert("Erro", "Um erro não esperado ocorreu.");
WebMix.HideDirections();
WebMixUIResize();
}
this.CheckResize = function() {
if (self.GMap) self.GMap.checkResize();
}
}
WebMixMap.DEFAULT_ZOOM_LEVEL = 13;
/*
WebMixReport.js
Armazena informações no Google Analytics
Copyright 2008 - Inspira Tecnologia e Marketing
*/
function WebMixReport(_pageTracker) {
this.Register = function(msg, info) {
if (typeof(_pageTracker) == "undefined") return;
var strInfo = '';
var i = 0;
for (var c in info) {
if (i > 0) strInfo += ',';
strInfo += info[c].name + ':' + info[c].value;
i++;
}
switch (msg) {
case WebMixReport.MAP_LOADED:
_pageTracker._trackPageview("MAP_LOADED");
break;
case WebMixReport.MAP_OPENED:
_pageTracker._trackPageview("MAP_OPENED");
break;
case WebMixReport.MAP_MARKER_SEARCH:
_pageTracker._trackPageview("MAP_MARKER_SEARCH(" + strInfo + ")");
break;
case WebMixReport.MAP_CONTEXT_SEARCH:
_pageTracker._trackPageview("MAP_CONTEXT_SEARCH(" + info + ")");
break;
case WebMixReport.MAP_ROUTE_VIEW:
_pageTracker._trackPageview("MAP_ROUTE_VIEW(" + strInfo + ")");
break;
case WebMixReport.MAP_ROUTE_PRINT:
_pageTracker._trackPageview("MAP_ROUTE_PRINT(" + strInfo + ")");
break;
case WebMixReport.MAP_MARKER_CLICK:
_pageTracker._trackPageview("MAP_MARKER_CLICK(" + info + ")");
break;
case WebMixReport.MAP_INFOWINDOW_VIEW:
_pageTracker._trackPageview("MAP_MARKER_CLICK(" + strInfo + ")");
break;
case WebMixReport.MAP_GOOGLEEARTH:
_pageTracker._trackPageview("MAP_GOOGLEEARTH");
break;
case WebMixReport.MAP_CLOSED:
_pageTracker._trackPageview("MAP_CLOSED");
break;
}
}
}
WebMixReport.MAP_LOADED = 1;
WebMixReport.MAP_OPENED = 2;
WebMixReport.MAP_MARKER_SEARCH = 3;
WebMixReport.MAP_CONTEXT_SEARCH = 4;
WebMixReport.MAP_ROUTE_VIEW = 5;
WebMixReport.MAP_ROUTE_PRINT = 6;
WebMixReport.MAP_MARKER_CLICK = 7;
WebMixReport.MAP_INFOWINDOW_VIEW = 8;
WebMixReport.MAP_GOOGLEEARTH = 9;
WebMixReport.MAP_CLOSED = 10;
/*
WebMixSearchJSON.js
Chama os webservices que fazem a usca de imóveis no banco de dados
Usando JSON no lugar de XML
Copyright 2008 - Inspira Tecnologia e Marketing
*/
function WebMixInfoWindowTab(title, description) {
this.title = title;
this.description = description;
}
function WebMixMarker(i, n) {
this.id = i;
this.name = n;
this.map = new WebMixMap();
this.toString = function() {
var x = '';
for (var i in this) {
x += i + ':' + this[i] + '\n';
}
return x;
}
this.infoWindowTabs = [];
this.addInfoWindowTab = function(title, description) {
this.infoWindowTabs.push(new WebMixInfoWindowTab(title, description));
}
this.getGeocodeAddress = function() {
var addr;
if (this.geocodeStreet == null || this.geocodeStreet.length == 0) {
var strNumber = "";
if (typeof(this.number) != "undefined") {
strNumber = this.number + ",";
}
addr = this.street + "," + strNumber + this.city + "," + this.state + "," + this.country;
} else {
addr = this.geocodeStreet + "," + this.city + "," + this.state + "," + this.country;
}
return addr;
}
}
function WebMixSearchJSON() {
}
WebMixSearchJSON.GetMarkerCount = function(searchParameters, mapID, callback) {
WebMixSearchJSON.JSONCallback = callback;
var extraParams = "";
if (typeof(searchParameters) != "undefined") {
for (p in searchParameters) {
var key = p;
var value = searchParameters[p];
if (key == 'city') continue;
extraParams += "&" + key + "=" + value;
}
}
var requestUrl = "http://app.inspira.com.br/WebMixRealty/DataSources/MarkerJSON.aspx?action=GetCount&Map.ID="+mapID + "&rnd=" + Math.random() + extraParams;
//prompt(requestUrl, requestUrl);
include(requestUrl);
}
WebMixSearchJSON.GetMarkerCountCallback = function(count) {
// alert("Chamando count callback:" + count.MarkerCount);
WebMixSearchJSON.JSONCallback(count.MarkerCount);
}
WebMixSearchJSON.SearchMarkers = function(searchParameters, mapID, callback) {
WebMixSearchJSON.JSONGetListCallback = callback;
var extraParams = "";
if (typeof(searchParameters) != "undefined") {
for (p in searchParameters) {
var key = p;
var value = searchParameters[p];
if (key == 'city') continue;
extraParams += "&" + key + "=" + value;
}
}
var requestUrl = "http://app.inspira.com.br/WebMixRealty/DataSources/MarkerJSON.aspx?action=List&Map.ID="+mapID + "&rnd=" + Math.random() + extraParams;
// prompt(requestUrl, extraParams);
include(requestUrl);
}
WebMixSearchJSON.GetListCallback = function(list) {
var mapList = [];
if (list != null) {
if (typeof(list.Markers.Marker.length) == "undefined") {
mapList.push(getMarker(list.Markers.Marker));
}
for (var i = 0; i < list.Markers.Marker.length; i++) {
var jsonMarker = list.Markers.Marker[i];
mapList.push(getMarker(jsonMarker));
}
}
WebMixSearchJSON.JSONGetListCallback(mapList);
}
function getMarker(jsonMarker) {
var marker = new WebMixMarker();
marker.id = jsonMarker["ID"];
marker.map.id = jsonMarker["Map.ID"];
marker.name = jsonMarker["Name"];
marker.latitude = jsonMarker["Latitude"];
marker.longitude = jsonMarker["Longitude"];
marker.street = jsonMarker["Street"];
marker.geocodeStreet = jsonMarker["GeocodeStreet"];
if (jsonMarker["Number"] != null)
marker.number = jsonMarker["Number"];
if (jsonMarker["Complement"] != null)
marker.complement = jsonMarker["Complement"];
marker.city = jsonMarker["City"];
if (jsonMarker["State"] != null)
marker.state = jsonMarker["State"];
marker.country = jsonMarker["Country"];
if (jsonMarker["IconUrl"] != null)
marker.iconUrl = jsonMarker["IconUrl"];
marker.iconWidth = jsonMarker["IconWidth"];
marker.iconHeight = jsonMarker["IconHeight"];
marker.price = jsonMarker["Price"];
if (jsonMarker["Dorms"] != null)
marker.dorms = jsonMarker["Dorms"];
marker.garages = jsonMarker["Garages"];
marker.area = jsonMarker["Area"];
marker.type = jsonMarker["Type"];
marker.stage = jsonMarker["Stage"];
marker.siteUrl = jsonMarker["SiteUrl"];
marker.suitedFor = jsonMarker["SuitedFor"];
var xmlInfoWindowTabList = jsonMarker["InfoWindowTabs"];
if (typeof(xmlInfoWindowTabList.length) == "undefined") {
marker.addInfoWindowTab(
xmlInfoWindowTabList["Title"],
xmlInfoWindowTabList["Description"]
);
}
for (var j = 0; j < xmlInfoWindowTabList.length; j++) {
marker.addInfoWindowTab(
xmlInfoWindowTabList[j]["Title"],
xmlInfoWindowTabList[j]["Description"]
);
}
return marker;
}
/*
WebMixSearchParameters.js
Entidade que armazena os parâmetros de busca, passando da interface com o usuário até a função de busca
Copyright 2008 - Inspira Tecnologia e Marketing
*/
function WebMixSearchParameters(type) {
var self = this;
}
/*
WebMixUI.js
Funções relacionadas a interface com o usuário
Copyright 2008 - Inspira Tecnologia e Marketing
*/
function WebMixUI(type) {
var self = this;
this.Load = function() {
self.IsLoaded = false;
}
this.ShowPopupLayer = function() {
this.ShowGeneric();
}
this.ShowOnDiv = function(divID) {
this.ShowGeneric(divID);
}
/*
Display UI elements
*/
this.ShowGeneric = function(divID) {
if (self.IsLoaded == false) {
WebMixUIDOM.LoadDom(self, divID);
self.IsLoaded = true;
document.getElementById('divOverflow').style['display'] = 'block';
document.getElementById('divMapOverlay').style['display'] = 'block';
document.getElementById('divMapBox').style['display'] = 'block';
document.getElementById('divMapInfo').style['display'] = 'none';
document.body.style['overflow'] = 'hidden';
this.HideFavorites();
this.HideServices();
this.HideDirections();
document.getElementById('icoFavorites').style['display'] = 'none';
document.getElementById('icoServices').style['display'] = 'none';
document.getElementById('icoDirections').style['display'] = 'none';
if (document.style != null) {
document.style['overflow'] = 'hidden';
}
// Mostra wizard no centro da tela
self.ShowWizard();
if (document.all) {
addEvent(window, "resize", WebMixUIResize);
} else {
window.onresize = WebMixUIResize;
}
} else {
document.getElementById('divOverflow').style['display'] = 'block';
document.getElementById('divMapBox').style['display'] = 'block';
WebMixUIResize();
}
}
this.ShowWizard = function() {
// divMapWizard: contém os elementos de busca do mapa (beta 1)
var divMapWizard = document.getElementById("divMapWizard");
/* var divMapWizardClone = divMapWizard.cloneNode(true);
divMapWizard.parentNode.removeChild(divMapWizard);*/
divMapWizard.style['display'] = 'inline';
// padrão:
document.getElementById('City1').selectedIndex = 0;
/*
// adiciona wizard no mapa
document.getElementById('divMapBox').appendChild(divMapWizardClone);*/
// mostra passo 1 do wizard
this.ShowWizardStep(1);
}
/*
Hide UI elements
*/
this.HidePopupLayer = function() {
document.getElementById('divMapInfo').style.display = 'none';
document.getElementById('divMapFavorites').style.display = 'none';
document.getElementById('divMapServices').style.display = 'none';
document.getElementById('divMapDirections').style.display = 'none';
document.getElementById('divOverflow').style.display = 'none';
document.getElementById('divMapBox').style.display = 'none';
document.body.style.overflow='auto';
//window.onresize = self.oldOnResize;
}
/*
Hide UI elements
*/
this.MinimizePopupLayer = function() {
document.getElementById('divOverflow').style.display = 'none';
document.getElementById('divMapBox').style.display = 'none';
document.body.style.overflow='auto';
}
/*
Expose the map div container in order to insert the GMap2 object into it (WebMixMap.js)
*/
this.GetMapDiv = function() {
return document.getElementById('divMap');
}
/*
Controls the wizard steps flow
*/
this.ShowWizardStep = function(step) {
var nextStep = step + 1;
var prevStep = step - 1;
var divWizardPrev = document.getElementById("divMapWizardStep" + prevStep);
var divWizardNext = document.getElementById("divMapWizardStep" + nextStep);
if (divWizardPrev != null) divWizardPrev.style['display'] = 'none';
if (divWizardNext != null) divWizardNext.style['display'] = 'none';
var divWizardStep = document.getElementById("divMapWizardStep" + step);
if (typeof(divWizardStep) != "undefined" && divWizardStep != null) {
divWizardStep.style['display'] = 'inline';
var btnWizardNext = document.getElementById("btnMapWizard" + step + "_Next");
var btnWizardPrev = document.getElementById("btnMapWizard" + step + "_Prev");
var btnWizardFinish = document.getElementById("btnMapWizardFinish");
if (btnWizardNext != null) {
btnWizardNext.onclick = function() { self.ShowWizardStep(nextStep); }
}
if (btnWizardPrev != null) {
btnWizardPrev.onclick = function() { self.ShowWizardStep(prevStep); }
}
if (btnWizardFinish != null) {
btnWizardFinish.onclick = function() {
alert(divWizardStep);
divWizardStep.style['display'] = 'none';
WebMix.DoSearchInternal(self.GetMapParameters(), self.EndSearch);
}
}
}
}
this.GetMapParameters = function() {
// Get search parameters
var divMapWizard = document.getElementById('divMapWizard');
var mapParameters = [];
self.FindMapParameters(divMapWizard, mapParameters);
return mapParameters;
}
/*
Get the marker list and pass it to the map
*/
this.EndSearch = function(_markerList) {
// Search has ended. Now the map can be shown
document.getElementById('divMapWizard').style['display'] = 'none';
document.getElementById('divMapOverlay').style['display'] = 'none';
document.getElementById('divMapInfo').style['display'] = 'block';
document.getElementById('icoFavorites').style['display'] = 'block';
document.getElementById('icoServices').style['display'] = 'block';
document.getElementById('icoDirections').style['display'] = 'block';
WebMix.ReloadMap(_markerList);
self.ShowZoomLevel();
WebMixUI.Loading(false, 'search');
WebMixUIResize();
}
this.FindMapParameters = function(domElement, mapParameters) {
for (var i = 0; i < domElement.childNodes.length; i++) {
var childNode = domElement.childNodes[i];
if (childNode.type != null && childNode.type != 'button' && childNode.type != 'submit') {
mapParameters.push( { name: childNode.id, value: childNode.value } );
} else {
self.FindMapParameters(childNode, mapParameters);
}
}
}
this.UpdateFavoriteList = function() {
var divMapFavorites = document.getElementById('divMapFavoritesContainer');
divMapFavorites.innerHTML = '';
var favoriteList = WebMix.GetFavoriteList();
document.getElementById('divMapFavoritesText').style['display'] = (favoriteList.length > 0) ? 'none' : 'block';
document.getElementById('divMapFavoritesContainer').style['display'] = (favoriteList.length > 0) ? 'block' : 'none';
for (var i = 0; i < favoriteList.length; i++) {
var mkr = favoriteList[i];
var divMapFavoritesItem = document.createElement('div');
divMapFavoritesItem.className = 'divMapFavoritesItem';
var spnMapFavoritesItem = document.createElement('span');
spnMapFavoritesItem.className = 'spnMapFavoritesItem';
spnMapFavoritesItem.appendChild(document.createTextNode(mkr.name));
divMapFavoritesItem.appendChild(spnMapFavoritesItem);
divMapFavoritesItem.appendChild(document.createElement('br'));
divMapFavoritesItem.appendChild(document.createTextNode(mkr.dorms + ' dormitórios'));
divMapFavoritesItem.appendChild(document.createElement('br'));
divMapFavoritesItem.appendChild(document.createTextNode(mkr.city));
divMapFavoritesItem.appendChild(document.createElement('br'));
if (mkr.siteUrl != null && mkr.siteUrl.length > 0) {
lnkMaisDetalhes = document.createElement('a');
lnkMaisDetalhes.className = 'lnkMaisDetalhes';
lnkMaisDetalhes.href = mkr.siteUrl;
lnkMaisDetalhes.target = '_blank';
lnkMaisDetalhes.appendChild(document.createTextNode('Mais detalhes'));
divMapFavoritesItem.appendChild(lnkMaisDetalhes);
divMapFavoritesItem.appendChild(document.createTextNode(' '));
}
lnkApagar = document.createElement('a');
lnkApagar.className = 'lnkApagar';
lnkApagar.href = 'javascript: WebMix.RemoveFavorite(' + mkr.id + '); void(0);';
lnkApagar.appendChild(document.createTextNode('Apagar'));
divMapFavoritesItem.appendChild(lnkApagar);
divMapFavorites.appendChild(divMapFavoritesItem);
}
}
this.GetDirectionsFrom = function() {
var end = prompt('Digite o endereço de origem', 'Av. Paulista, 1000');
return end;
}
this.SetVisibility = function(id, disp) {
var div = document.getElementById('divMap' + id);
var ico = document.getElementById('ico' + id);
var icoOn = document.getElementById('ico' + id + 'On');
div.style['display'] = disp ? 'block' : 'none';
ico.style['display'] = disp ? 'none' : 'block';
icoOn.style['display'] = disp ? 'block' : 'none';
}
this.ShowFavorites = function() {
self.SetVisibility('Favorites', true);
self.SetVisibility('Services', false);
self.SetVisibility('Directions',false);
}
this.ShowServices = function() {
self.SetVisibility('Favorites', false);
self.SetVisibility('Services', true);
self.SetVisibility('Directions',false);
}
this.ShowDirections = function(firstTime) {
document.getElementById('divMapDirectionsText').style['display'] = firstTime ? 'none' : 'block';
document.getElementById('divMapDirectionsContainer').style['display'] = firstTime ? 'block' : 'none';
self.SetVisibility('Favorites', false);
self.SetVisibility('Services', false);
self.SetVisibility('Directions',true);
}
this.HideFavorites = function() {
self.SetVisibility('Favorites', false);
}
this.HideServices = function() {
self.SetVisibility('Services', false);
}
this.HideDirections = function() {
self.SetVisibility('Directions',false);
}
this.ShowZoomLevel = function() {
var zoomLevel = WebMix.GetZoomLevel();
document.getElementById('divZoomLevelText').innerHTML = 'Zoom';
}
this.SetDefaultState = function() {
}
}
WebMixUI.POPUP = 1;
/* Habilita / desabilita o overlay "carregando".
*
* Antes de iniciar a carregar algum elemento, chamar a função com parâmetro true. Ao terminar de carregar o elemento, chamar com parâmetro false.
*/
WebMixUI.NumLoadingElements = 0;
WebMixUI.Loading = function (status, elem) {
//if (WebMix.IsIE6) return;
printHash(elem);
enxalog('>>> START');
if(status) {
enxalog('one more to load');
WebMixUI.NumLoadingElements++;
enxalog('added: ' + WebMixUI.NumLoadingElements + ' total');
// enable loading canvas
if(WebMixUI.NumLoadingElements==1) {
enxalog('Enabling loading canvas...');
if (document.getElementById('divLoading') != null) {
enxalog('...really enabling it');
document.getElementById('divLoading').style['display'] = 'block';
// dirty trick exclusive for IE6
var selectList = document.getElementsByTagName('select');
for (var i = 0; i < selectList.length; i++) {
var s = selectList[i];
s.style.display = 'none';
}
}
}
} else {
enxalog('one less to load');
if(WebMixUI.NumLoadingElements>0) {
WebMixUI.NumLoadingElements--;
}
enxalog('removed: ' + WebMixUI.NumLoadingElements + ' total');
// disable loading canvas
if(WebMixUI.NumLoadingElements==0) {
enxalog('Disabling loading canvas...');
if (document.getElementById('divLoading') != null) {
enxalog('...really disabling it');
document.getElementById('divLoading').style['display'] = 'none';
// dirty trick exclusive for IE6
var selectList = document.getElementsByTagName('select');
for (var i = 0; i < selectList.length; i++) {
var s = selectList[i];
s.style.display = 'block';
}
}
}
}
enxalog('<<< END');
}
/* hack do enxaqueca */
loadlogdiv = false;
function enxalog(msg) {
return;
if(loadlogdiv) {
loadlogdiv = false;
var divlog = document.createElement('div');
divlog.id = 'divlog';
document.body.appendChild(divlog);
}
var divlog = document.getElementById('divlog');
var spanmsg = document.createElement('span');
spanmsg.appendChild(document.createTextNode(msg));
divlog.appendChild(spanmsg);
var br = document.createElement('br');
divlog.appendChild(br);
}
WebMixUI.Hash = new Object();
function printHash(elem) {
if (WebMixUI.Hash[elem] != 1) {
//enxalog('>>> start load:' + elem);
WebMixUI.Hash[elem] = 1;
} else {
//enxalog('>>> finish load:' + elem);
WebMixUI.Hash[elem] = 0;
}
//Debug: imprime hash
for (var i in WebMixUI.Hash)
{
enxalog(' *** WebMixUI.Hash[\''+i+'\'] is ' + WebMixUI.Hash[i]);
}
}
/* hack do enxaqueca */
function WebMixUIResize() {
var w = document.body.offsetWidth - 40;
if(w<705) { w=705; };
var h = document.body.offsetHeight - 40;
if(h<350) { h=350; };
var divMapBox = document.getElementById('divMapBox');
divMapBox.style.width = w + 'px';
divMapBox.style.height = h + 'px';
var divMapOverlay = document.getElementById('divMapOverlay');
divMapOverlay.style.width = w - 20 + 'px';
divMapOverlay.style.height = h - 20 + 'px';
var divMapInfo = document.getElementById('divMapInfo');
divMapInfo.style.width = w - 20 + 'px';
var divMapFavorites = document.getElementById('divMapFavorites');
divMapFavorites.style.height = h - 20 + 'px';
var divMapFavoritesContainer = document.getElementById('divMapFavoritesContainer');
divMapFavoritesContainer.style.height = h - 140 + 'px';
var divMapServices = document.getElementById('divMapServices');
divMapServices.style.width = w - 20 + 'px';
var divMapDirections = document.getElementById('divMapDirections');
divMapDirections.style.height = h - 20 + 'px';
var imgInspiraLogoLink = document.getElementById('imgInspiraLogoLink');
if(divMapDirections.style.display=='block') {
imgInspiraLogoLink.style.right = '287px';
} else {
imgInspiraLogoLink.style.right = '12px';
}
if(divMapServices.style.display=='block') {
imgInspiraLogoLink.style.bottom = '112px';
} else {
imgInspiraLogoLink.style.bottom = '25px';
}
var divMap = document.getElementById('divMap');
var mw = w - 20;
if(divMapFavorites.style.display=='block') {
divMap.style.left = '160px';
divMap.style.width = mw - 150 + 'px';
} else {
if(divMapDirections.style.display=='block') {
divMap.style.left = '10px';
divMap.style.width = mw - 275 + 'px';
} else {
divMap.style.left = '10px';
divMap.style.width = mw + 'px';
};
};
var mh = h - 20;
if(divMapInfo.style.display=='block') {
if(divMapServices.style.display=='block') {
divMap.style.height = mh - 47 - 87 + 'px';
} else {
divMap.style.height = mh - 47 + 'px';
};
divMap.style.top = '57px';
} else {
divMap.style.height = mh + 'px';
divMap.style.top = '10px';
}
WebMix.CheckResize();
}
/*
WebMixUIDOM.js
Funções relacionadas a interface com o usuário
Copyright 2008 - Inspira Tecnologia e Marketing
*/
function WebMixUIDOM() {
}
WebMixUIDOM.GetRegion = function(idx) {
return WebMixUIDOM.GetRegionList()[idx];
}
WebMixUIDOM.GetRegionList = function() {
// TODO: criar WebMixConfig.js e colocar essas e outras configs lá
var regions = [
['', 'Escolha uma região'],
['Praça da Sé, São Paulo - SP', 'São Paulo - Centro', 'CENTRO'],
['Penha, São Paulo - SP', 'São Paulo - Zona Leste', 'LESTE'],
['Tucuruvi, São Paulo - SP', 'São Paulo - Zona Norte', 'NORTE'],
['Jaguaré, São Paulo - SP ', 'São Paulo - Zona Oeste', 'OESTE'],
['Jabaquara, São Paulo - SP', 'São Paulo - Zona Sul', 'SUL'],
['Cotia, SP, Brasil', 'Cotia', 'COTIA'],
['Guarulhos, SP, Brasil', 'Guarulhos', 'GUARULHOS'],
['Jundiaí, SP, Brasil', 'Jundiaí', 'JUNDIAI'],
['Cajamar, SP, Brasil', 'Cajamar', 'CAJAMAR']
];
return regions;
}
WebMixUIDOM.GetTypeList = function(suitedFor) {
var types = [];
types.push(['', 'Todos os subtipos', '']);
if (!suitedFor || suitedFor == 'R') {
types.push(['A', 'Apartamento', 'R']);
types.push(['R', 'Casa (Condomínio)', 'R']);
types.push(['L', 'Casa (Avulsa)', 'R']);
}
if (!suitedFor || suitedFor == 'C') {
types.push(['C', 'Conjunto comercial', 'C']);
}
return types;
}
WebMixUIDOM.GetSuitedForList = function() {
var types = [
['', 'Todos os tipos'],
['R', 'Residencial'],
['C', 'Comercial']
];
return types;
}
WebMixUIDOM.GetAreaList = function() {
var areas = [
['', 'Todas as áreas'],
['30,45', 'de 30 a 45 m²'],
['45,60', 'de 45 a 60 m²'],
['60,90', 'de 60 a 90 m²'],
['90,120', 'de 90 a 120 m²'],
['120,200', 'de 120 a 200 m²'],
['200', '200 m² ou mais']
];
return areas;
}
WebMixUIDOM.GetDormsList = function() {
var dorms = [
['', 'Dormitórios'],
['1,2', '1 ou 2 dormitórios'],
['2,3', '2 ou 3 dormitórios'],
['3,4', '3 ou mais dormitórios']
];
return dorms;
}
/*
Preload UI elements
*/
WebMixUIDOM.LoadDom = function(webMixUI, divID) {
var w = document.body.offsetWidth - 40;
if(w<705) { w=705; };
var h = document.body.offsetHeight - 40;
if(h<350) { h=350; };
// divMapBox: "moldura" que contém o mapa
var divMapBox = document.createElement('div');
divMapBox.id = 'divMapBox';
divMapBox.style.width = w + 'px';
divMapBox.style.height = h + 'px';
// se foi passado um DIV, monta o WEbMix no DIV
if (typeof(divID) != "undefined") {
document.getElementById(divID).appendChild(divMapBox);
} else {
document.body.appendChild(divMapBox);
}
// divOverflow: efeito fundo cinza transparente (nao tem quando eh popup)
var divOverflow = document.createElement('div');
divOverflow.id = 'divOverflow';
document.body.appendChild(divOverflow);
// div que aparece quando algo está sendo processado
var divLoading = document.createElement('div');
divLoading.id = 'divLoading';
divMapBox.appendChild(divLoading);
// divMap: div que contém o mapa propriamente dito (GMap2)
var divMap = document.createElement('div');
divMap.id = 'divMap';
divMap.style.width = w - 20 + 'px';
divMap.style.height = h - 20 + 'px';
// divMapOverlay: camada cinza com opacidade por cima do mapa
var divMapOverlay = document.createElement('div');
divMapOverlay.id = 'divMapOverlay';
divMapOverlay.style.width = w - 20 + 'px';
divMapOverlay.style.height = h - 20 + 'px';
var imgWebMixLogo = document.createElement('img');
imgWebMixLogo.id = 'imgWebMixLogo';
WebMixUI.Loading(true,'imgWebMixLogo');
imgWebMixLogo.onload = function () { WebMixUI.Loading(false,'imgWebMixLogo'); };
imgWebMixLogo.src = WebMixUIDOM.GetImagePath('img/imgWebMixLogo.png');
var imgTrans = document.createElement('img');
WebMixUI.Loading(true, 'imgTrans');
imgTrans.onload = function () { WebMixUI.Loading(false, 'imgTrans'); };
imgTrans.src = WebMixUIDOM.GetImagePath('img/trans.gif');
var imgInspiraLogoLink = document.createElement('a');
imgInspiraLogoLink.href = 'http://www.inspira.com.br/';
imgInspiraLogoLink.id = 'imgInspiraLogoLink';
imgInspiraLogoLink.target = '_blank';
imgInspiraLogoLink.style.bottom = '25px';
imgInspiraLogoLink.style.right = '12px';
var imgInspiraLogo = document.createElement('img');
imgInspiraLogo.id = 'imgInspiraLogo';
//WebMixUI.Loading(true, 'imgInspiraLogo');
//imgInspiraLogo.onload = function () { WebMixUI.Loading(false, 'imgInspiraLogo'); };
imgInspiraLogo.src = WebMixUIDOM.GetImagePath('img/inspira.png');
var imgHelp = document.createElement('img');
WebMixUI.Loading(true, 'imgHelp');
imgHelp.onload = function () { WebMixUI.Loading(false, 'imgHelp'); };
imgHelp.src = WebMixUIDOM.GetImagePath('img/imgHelp.gif');
imgHelp.id = 'imgHelp';
imgHelp.onclick = function() {
WebMixUIDOM.ShowHelpBox();
}
// divMapInfo: contém área de informações do mapa
var divMapInfo = document.createElement('div');
divMapInfo.id = 'divMapInfo';
// imgWebMixLogo
divMapInfo.appendChild(imgWebMixLogo);
// divMapZoom: controle de zoom
var divMapZoom = document.createElement('div');
divMapZoom.id = 'divMapZoom';
divMapInfo.appendChild(divMapZoom);
// imgZoomDown
var imgZoomDown = document.createElement('img');
imgZoomDown.id = 'imgZoomDown';
imgZoomDown.src = WebMixUIDOM.GetImagePath('img/imgZoomDown.gif');
imgZoomDown.onclick = function() {
WebMix.ZoomUp();
}
divMapZoom.appendChild(imgZoomDown);
// divZoomLevelText
var divZoomLevelText = document.createElement('div');
divZoomLevelText.id = 'divZoomLevelText';
divZoomLevelText.appendChild(document.createTextNode('...'));
divMapZoom.appendChild(divZoomLevelText);
// imgZoomUp
var imgZoomUp = document.createElement('img');
imgZoomUp.id = 'imgZoomDown';
imgZoomUp.src = WebMixUIDOM.GetImagePath('img/imgZoomUp.gif');
imgZoomUp.onclick = function() {
WebMix.ZoomDown();
}
divMapZoom.appendChild(imgZoomUp);
var selType = new WebMixUIMenu('selType');
var selArea = new WebMixUIMenu('selArea');
var selDorms = new WebMixUIMenu('selDorms');
var selSuitedFor = new WebMixUIMenu('selSuitedFor');
var selRegion = new WebMixUIMenu('selRegion');
WebMixUIDOM.SelType = selType;
WebMixUIDOM.SelArea = selArea;
WebMixUIDOM.SelDorms = selDorms;
WebMixUIDOM.SelSuitedFor = selSuitedFor;
WebMixUIDOM.SelRegion = selRegion;
// divMapInfo.appendChild(selRegion);
selRegion.DataSource = WebMixUIDOM.GetRegionList();
selRegion.Show(divMapInfo);
selRegion.OnChange = WebMixUIDOM.UpdateMarkers;
//divMapInfo.appendChild(selSuitedFor);
selSuitedFor.DataSource = WebMixUIDOM.GetSuitedForList();
selSuitedFor.Show(divMapInfo);
selSuitedFor.OnChange = WebMixUIDOM.UpdateMarkers;
//divMapInfo.appendChild(selType);
selType.DataSource = WebMixUIDOM.GetTypeList();
selType.Show(divMapInfo);
selType.OnChange = WebMixUIDOM.UpdateMarkers;
//divMapInfo.appendChild(selArea);
selArea.DataSource = WebMixUIDOM.GetAreaList();
selArea.Show(divMapInfo);
selArea.OnChange = WebMixUIDOM.UpdateMarkers;
//divMapInfo.appendChild(selDorms);
selDorms.DataSource = WebMixUIDOM.GetDormsList();
selDorms.Show(divMapInfo);
selDorms.OnChange = WebMixUIDOM.UpdateMarkers;
// botao minimizar nao deve aparecer quando webmix nao for aberto como layer
if (typeof(divID) == "undefined") {
var imgMinimize = document.createElement('img');
WebMixUI.Loading(true, 'imgMinimize');
imgMinimize.onload = function () { WebMixUI.Loading(false, 'imgMinimize'); };
imgMinimize.src = WebMixUIDOM.GetImagePath('img/imgMinimize.gif');
imgMinimize.id = 'imgMinimize';
imgMinimize.title = 'Minimizar o mapa e voltar ao site';
imgMinimize.alt = imgMinimize.title;
imgMinimize.onclick = function() {
WebMix.MinimizeWindow();
}
divMapInfo.appendChild(imgMinimize);
}
divMapInfo.appendChild(imgHelp);
divMapInfo.style.width = w - 20 + 'px';
var divMapFavorites = document.createElement('div');
divMapFavorites.id = 'divMapFavorites';
divMapFavorites.style.height = h - 20 + 'px';
var divMapFavoritesText = document.createElement('div');
divMapFavoritesText.id = 'divMapFavoritesText';
divMapFavoritesText.innerHTML = 'Não há nenhum imóvel selecionado.
Para adicionar um favorito, escolha um imóvel no mapa e clique na opção "[+ favoritos]"';
var divMapFavoritesContainer = document.createElement('div');
divMapFavoritesContainer.id = 'divMapFavoritesContainer';
var imgFavorites = document.createElement('img');
imgFavorites.id = 'imgFavorites';
imgFavorites.alternateText = 'Aqui você reserva os imóveis que vocë mais gostou, para consultá-los quando quiser';
WebMixUI.Loading(true, 'imgFavorites');
imgFavorites.onload = function () { WebMixUI.Loading(false, 'imgFavorites'); };
imgFavorites.src = WebMixUIDOM.GetImagePath('img/favoritos.png');
var icoFavorites = document.createElement('img');
icoFavorites.id = 'icoFavorites';
icoFavorites.alternateText = 'Aqui você reserva os imóveis que vocë mais gostou, para consultá-los quando quiser';
WebMixUI.Loading(true, 'icoFavorites');
icoFavorites.onload = function () { WebMixUI.Loading(false, 'icoFavorites'); };
icoFavorites.src = WebMixUIDOM.GetImagePath('img/iconefavoritos.png');
icoFavorites.onclick = function() {
webMixUI.ShowFavorites();
webMixUI.UpdateFavoriteList();
WebMixUIResize();
}
var icoFavoritesOn = document.createElement('img');
icoFavoritesOn.id = 'icoFavoritesOn';
WebMixUI.Loading(true, 'icoFavoritesOn');
icoFavoritesOn.onload = function () { WebMixUI.Loading(false, 'icoFavoritesOn'); };
icoFavoritesOn.src = WebMixUIDOM.GetImagePath('img/icoFavoritesOn.png');
icoFavoritesOn.onclick = function() {
webMixUI.HideFavorites();
WebMixUIResize();
}
var divMapServices = document.createElement('div');
divMapServices.id = 'divMapServices';
divMapServices.style.width = w - 20 + 'px';
var divAllServices = document.createElement('div');
divAllServices.id = 'divAllServices';
divMapServices.appendChild(divAllServices);
var imgHospitals = imgTrans.cloneNode(true);
imgHospitals.id = 'imgHospitals';
imgHospitals.onclick = function() { WebMix.QueryServices("hospital"); }
var imgSupermarkets = imgTrans.cloneNode(true);
imgSupermarkets.id = 'imgSupermarkets';
imgSupermarkets.onclick = function() { WebMix.QueryServices("supermercado"); }
var imgShoppings = imgTrans.cloneNode(true);
imgShoppings.id = 'imgShoppings';
imgShoppings.onclick = function() { WebMix.QueryServices("shopping"); }
var imgTransport = imgTrans.cloneNode(true);
imgTransport.id = 'imgTransport';
imgTransport.onclick = function() { WebMix.QueryServices("transporte"); }
var imgBanks = imgTrans.cloneNode(true);
imgBanks.id = 'imgBanks';
imgBanks.onclick = function() { WebMix.QueryServices("banco"); }
divAllServices.appendChild(imgHospitals);
divAllServices.appendChild(imgSupermarkets);
divAllServices.appendChild(imgTransport);
divAllServices.appendChild(imgBanks);
divAllServices.appendChild(imgShoppings);
var icoServices = document.createElement('img');
icoServices.id = 'icoServices';
icoServices.alternateText = 'Aqui você reserva os serviços e atrativos de cada bairro, direto no mapa';
WebMixUI.Loading(true, 'icoServices');
icoServices.onload = function () { WebMixUI.Loading(false, 'icoServices'); };
icoServices.src = WebMixUIDOM.GetImagePath('img/iconeservicos.png');
icoServices.onclick = function() {
webMixUI.ShowServices();
WebMixUIResize();
}
var icoServicesOn = document.createElement('img');
icoServicesOn.id = 'icoServicesOn';
WebMixUI.Loading(true, 'icoServicesOn');
icoServicesOn.onload = function () { WebMixUI.Loading(false, 'icoServicesOn'); };
icoServicesOn.src = WebMixUIDOM.GetImagePath('img/icoServicesOn.png');
icoServicesOn.onclick = function() {
webMixUI.HideServices();
WebMixUIResize();
}
var divMapDirections = document.createElement('div');
divMapDirections.id = 'divMapDirections';
divMapDirections.style.height = h - 20 + 'px';
var divMapDirectionsText = document.createElement('div');
divMapDirectionsText.id = 'divMapDirectionsText';
divMapDirectionsText.innerHTML = 'Para traçar rotas para algum imóvel, escolha-o no mapa e utilize a opção "como chegar".
Você precisará informar apenas o endereço de origem.';
divMapDirections.appendChild(divMapDirectionsText);
var divMapDirectionsContainer = document.createElement('div');
divMapDirectionsContainer.id = 'divMapDirectionsContainer';
divMapDirections.appendChild(divMapDirectionsContainer);
var icoDirections = document.createElement('img');
icoDirections.id = 'icoDirections';
icoDirections.alternateText = 'Trace rotas para onde você quiser, facilitando a vida';
WebMixUI.Loading(true, 'icoDirections');
icoDirections.onload = function () { WebMixUI.Loading(false, 'icoDirections'); };
icoDirections.src = WebMixUIDOM.GetImagePath('img/iconerotas.png');
icoDirections.onclick = function() {
webMixUI.ShowDirections();
WebMixUIResize();
}
var icoDirectionsOn = document.createElement('img');
icoDirectionsOn.id = 'icoDirectionsOn';
WebMixUI.Loading(true, 'icoDirectionsOn');
icoDirectionsOn.onload = function () { WebMixUI.Loading(false, 'icoDirectionsOn'); };
icoDirectionsOn.src = WebMixUIDOM.GetImagePath('img/icoDirectionsOn.png');
icoDirectionsOn.onclick = function() {
webMixUI.HideDirections();
WebMixUIResize();
}
// divMapContainer: contém o mapa e a área de informações
var divMapContainer = document.createElement('div');
divMapContainer.id = 'divMapContainer';
// logo Inspira
divMapBox.appendChild(imgInspiraLogoLink);
imgInspiraLogoLink.appendChild(imgInspiraLogo);
// adiciona mapa no container
divMapBox.appendChild(divMap);
divMapBox.appendChild(divMapOverlay);
divMapBox.appendChild(WebMixUIDOM.GetMapWizard(webMixUI));
// adiciona área de informações no container
divMapBox.appendChild(divMapInfo);
// fechar janela nao deve aparecer quando o webmix nao for um layer
if (!divID) {
var divCloseWindow = document.createElement('div');
divCloseWindow.id = 'divCloseWindow';
divCloseWindow.onclick = function() { WebMix.HideWindow() };
divCloseWindow.appendChild(document.createTextNode('X'));
divMapBox.appendChild(divCloseWindow);
}
divMapFavorites.appendChild(imgFavorites);
divMapFavorites.appendChild(divMapFavoritesText);
divMapFavorites.appendChild(divMapFavoritesContainer);
divMapBox.appendChild(icoFavorites);
divMapBox.appendChild(icoFavoritesOn);
divMapBox.appendChild(divMapFavorites);
//divMapFavorites.appendChild(imgServiceos);
divMapBox.appendChild(icoServices);
divMapBox.appendChild(icoServicesOn);
divMapBox.appendChild(divMapServices);
divMapBox.appendChild(icoDirections);
divMapBox.appendChild(icoDirectionsOn);
divMapBox.appendChild(divMapDirections);
// adiciona container dentro da moldura
// divMapBox.appendChild(divMapContainer);
// map overlay para escurecer / proteger mapa quando inativo
divMapBox.appendChild(divMapOverlay);
/*var imgLoading = document.createElement('img');
imgLoading.id = 'imgLoading';
imgLoading.alt = 'Carregando...';
imgLoading.src = 'img/carregando2.gif';
divLoading.appendChild(imgLoading);*/
}
WebMixUIDOM.GetMapWizard = function(webMixUI) {
var imgTrans = document.createElement('img');
WebMixUI.Loading(true, 'imgTrans');
imgTrans.onload = function () { WebMixUI.Loading(false, 'imgTrans'); };
imgTrans.src = WebMixUIDOM.GetImagePath('img/trans.gif');
var divMapWizard = document.createElement('div');
divMapWizard.id = 'divMapWizard';
divMapWizard.style['display'] = 'none';
var divMapWizardStep1 = document.createElement('div');
divMapWizardStep1.id = 'divMapWizardStep1';
divMapWizardStep1.className = 'clsMapWizardStep';
divMapWizard.appendChild(divMapWizardStep1);
var alImg1 = document.createElement('span');
alImg1.id = 'alImg1';
divMapWizardStep1.appendChild(alImg1);
var imgMapWizardStep1 = document.createElement('img');
imgMapWizardStep1.id = 'imgMapWizardStep1';
WebMixUI.Loading(true, 'imgMapWizardStep1');
imgMapWizardStep1.onload = function () { WebMixUI.Loading(false, 'imgMapWizardStep1'); };
imgMapWizardStep1.src = WebMixUIDOM.GetImagePath('img/wizard1_24.png');
imgMapWizardStep1.alt = 'Encontre seu imóvel ideal com o WebMix';
alImg1.appendChild(imgMapWizardStep1);
var City1 = document.createElement('select');
City1.id = 'City1';
//City1.style.display = 'none'; // avoud nasty show over everything at IE6
City1.onchange = function() {
document.getElementById('City2').selectedIndex = document.getElementById('City1').selectedIndex-1;
var myRegion = WebMixUIDOM.GetRegionList()[document.getElementById('City1').selectedIndex][2];
WebMix.GetMarkerCount( { region: myRegion, suitedFor: 'R' }, function(count) { SearchResult2.innerHTML = count; });
WebMix.ShowWizardStep(2);
WebMix.LoadMap();
};
divMapWizardStep1.appendChild(City1);
var regions = WebMixUIDOM.GetRegionList();
var suitedForList = WebMixUIDOM.GetSuitedForList();
var areas = WebMixUIDOM.GetAreaList();
for (var i = 0; i < regions.length; i++) {
var r = regions[i];
var myOption = document.createElement('option');
myOption.value = r[0];
myOption.appendChild(document.createTextNode(r[1]));
City1.appendChild(myOption);
}
var divMapWizardStep2 = document.createElement('div');
divMapWizardStep2.id = 'divMapWizardStep2';
divMapWizardStep2.className = 'clsMapWizardStep';
divMapWizard.appendChild(divMapWizardStep2);
var alImg2 = document.createElement('span');
alImg2.id = 'alImg2';
divMapWizardStep2.appendChild(alImg2);
var imgMapWizardStep2 = document.createElement('img');
imgMapWizardStep2.id = 'imgMapWizardStep2';
WebMixUI.Loading(true, 'imgMapWizardStep2');
imgMapWizardStep2.onload = function () { WebMixUI.Loading(false, 'imgMapWizardStep2'); };
imgMapWizardStep2.src = WebMixUIDOM.GetImagePath('img/wizard2_24.png');
imgMapWizardStep2.alt = 'Encontre seu imóvel ideal com o WebMix';
alImg2.appendChild(imgMapWizardStep2);
var City2 = document.createElement('select');
City2.id = 'City2';
City2.onchange = function() {
//WebMix.ApplyFilter( { city: City2.selectedIndex, type: Type2.value } );
var myRegion = WebMixUIDOM.GetRegionList()[document.getElementById('City2').selectedIndex + 1][2];
WebMix.GetMarkerCount( { region: myRegion, suitedFor: Type2.value }, function(count) { SearchResult2.innerHTML = count.toString(); });
WebMix.PositionMap(this.value);
}
divMapWizardStep2.appendChild(City2);
for (var i = 1; i < regions.length; i++) {
var r = regions[i];
var myOption = document.createElement('option');
myOption.value = r[0];
myOption.appendChild(document.createTextNode(r[1]));
City2.appendChild(myOption);
}
var Type2 = document.createElement('select');
Type2.id = 'Type2';
Type2.onchange = function() {
var myRegion = WebMixUIDOM.GetRegionList()[document.getElementById('City2').selectedIndex + 1][2];
WebMix.GetMarkerCount( { region: myRegion, suitedFor: Type2.value }, function(count) { SearchResult2.innerHTML = count.toString(); });
}
divMapWizardStep2.appendChild(Type2);
for (var i = 1; i < suitedForList.length; i++) {
var t = suitedForList[i];
var myOption = document.createElement('option');
myOption.value = t[0];
myOption.appendChild(document.createTextNode(t[1]));
Type2.appendChild(myOption);
}
var SearchResult2 = document.createElement('span');
SearchResult2.id = 'SearchResult2';
divMapWizardStep2.appendChild(SearchResult2);
var imgGotoStep3 = imgTrans.cloneNode(true);
imgGotoStep3.id = 'imgGotoStep3';
imgGotoStep3.alt = 'Continuar';
imgGotoStep3.width = "150";
imgGotoStep3.height="180";
imgGotoStep3.onclick = function() {
document.getElementById('City3').selectedIndex = document.getElementById('City2').selectedIndex;
document.getElementById('Type3').selectedIndex = document.getElementById('Type2').selectedIndex;
decideStep3(Type2.value);
// WebMix.ApplyFilter( { suitedFor: Type2.value }, function() { SearchResult3.innerHTML = WebMix.GetMarkerList().length.toString(); });
var myRegion = WebMixUIDOM.GetRegionList()[document.getElementById('City2').selectedIndex + 1][2];
WebMix.GetMarkerCount( { region: myRegion, suitedFor: Type2.value }, function(count) { SearchResult3.innerHTML = count.toString(); });
WebMix.ShowWizardStep(3);
}
divMapWizardStep2.appendChild(imgGotoStep3);
var divMapWizardStep3 = document.createElement('div');
divMapWizardStep3.id = 'divMapWizardStep3';
divMapWizardStep3.className = 'clsMapWizardStep';
divMapWizard.appendChild(divMapWizardStep3);
var SearchResult3 = document.createElement('span');
SearchResult3.id = 'SearchResult3';
var alImg3 = document.createElement('span');
alImg3.id = 'alImg3';
divMapWizardStep3.appendChild(alImg3);
var imgMapWizardStep3 = document.createElement('img');
imgMapWizardStep3.id = 'imgMapWizardStep3';
WebMixUI.Loading(true, 'imgMapWizardStep3');
imgMapWizardStep3.onload = function () { WebMixUI.Loading(false, 'imgMapWizardStep3'); };
imgMapWizardStep3.src = WebMixUIDOM.GetImagePath('img/wizard3_24.png');
imgMapWizardStep3.alt = 'Encontre seu imóvel ideal com o WebMix';
alImg3.appendChild(imgMapWizardStep3);
var City3 = document.createElement('select');
City3.id = 'City3';
City3.onchange = function() {
var myRegion = WebMixUIDOM.GetRegionList()[document.getElementById('City3').selectedIndex + 1][2];
WebMix.GetMarkerCount( { region: myRegion, suitedFor: Type3.value, area: Area3.value, dorms: Dorms3.value }, function(count) { SearchResult3.innerHTML = count.toString(); });
WebMix.PositionMap(this.value);
}
divMapWizardStep3.appendChild(City3);
for (var i = 1; i < regions.length; i++) {
var r = regions[i];
var myOption = document.createElement('option');
myOption.value = r[0];
myOption.appendChild(document.createTextNode(r[1]));
City3.appendChild(myOption);
}
var decideStep3 = function(v) {
if (v == 'R') { // residencial
alImg3.id = 'alImg3';
imgMapWizardStep3.id = 'imgMapWizardStep3';
imgMapWizardStep3.src = WebMixUIDOM.GetImagePath('img/wizard3_24.png');
if (hasChild(divMapWizardStep3, Area3)) {
divMapWizardStep3.removeChild(Area3);
}
if (!hasChild(divMapWizardStep3, Dorms3)) {
divMapWizardStep3.appendChild(Dorms3);
}
} else {
alImg3.id = 'alImg3b';
imgMapWizardStep3.src = WebMixUIDOM.GetImagePath('img/wizard3b_24.png');
if (hasChild(divMapWizardStep3, Dorms3)) {
divMapWizardStep3.removeChild(Dorms3);
}
if (!hasChild(divMapWizardStep3, Area3)) {
divMapWizardStep3.appendChild(Area3);
}
}
}
var Type3 = document.createElement('select');
Type3.id = 'Type3';
Type3.onchange = function() {
decideStep3(this.value);
// WebMix.ApplyFilter( { suitedFor: Type3.value }, function() { SearchResult3.innerHTML = WebMix.GetMarkerList().length.toString(); });
var myRegion = WebMixUIDOM.GetRegionList()[document.getElementById('City3').selectedIndex + 1][2];
if (Type3.value == 'R') {
WebMix.GetMarkerCount( { region: myRegion, suitedFor: Type3.value, dorms: Dorms3.value }, function(count) { SearchResult3.innerHTML = count.toString(); });
} else {
WebMix.GetMarkerCount( { region: myRegion, suitedFor: Type3.value, area: Area3.value }, function(count) { SearchResult3.innerHTML = count.toString(); });
}
}
divMapWizardStep3.appendChild(Type3);
for (var i = 1; i < suitedForList.length; i++) {
var t = suitedForList[i];
var myOption = document.createElement('option');
myOption.value = t[0];
myOption.appendChild(document.createTextNode(t[1]));
Type3.appendChild(myOption);
}
var Dorms3 = document.createElement('select');
Dorms3.id = 'Dorms3';
Dorms3.onchange = function() {
// WebMix.ApplyFilter( { suitedFor: Type3.value, dorms: Dorms3.value }, function() { SearchResult3.innerHTML = WebMix.GetMarkerList().length.toString(); });
var myRegion = WebMixUIDOM.GetRegionList()[document.getElementById('City3').selectedIndex + 1][2];
WebMix.GetMarkerCount( { region: myRegion, suitedFor: Type3.value, dorms: Dorms3.value }, function(count) { SearchResult3.innerHTML = count.toString(); });
}
var dormsList = WebMixUIDOM.GetDormsList();
for (var i = 0; i < dormsList.length; i++) {
var myOption = document.createElement('option');
myOption.value = dormsList[i][0];
var txt;
if (i == 0) txt = 'Indiferente';
else txt = dormsList[i][1];
myOption.appendChild(document.createTextNode(txt));
Dorms3.appendChild(myOption);
}
divMapWizardStep3.appendChild(Dorms3);
var Area3 = document.createElement('select');
Area3.id = 'Area3';
Area3.onchange = function() {
var myRegion = WebMixUIDOM.GetRegionList()[document.getElementById('City3').selectedIndex + 1][2];
WebMix.GetMarkerCount( { region: myRegion, suitedFor: Type3.value, area: Area3.value }, function(count) { SearchResult3.innerHTML = count.toString(); });
}
for (var i = 0; i < areas.length; i++) {
var a = areas[i];
var myOption = document.createElement('option');
myOption.value = a[0];
var txt;
if (i == 0) txt = 'Indiferente';
else txt = a[1];
myOption.appendChild(document.createTextNode(txt));
Area3.appendChild(myOption);
}
divMapWizardStep3.appendChild(Area3);
divMapWizardStep3.appendChild(SearchResult3);
var imgWizardFinish = imgTrans.cloneNode(true);
imgWizardFinish.id = 'imgWizardFinish';
imgWizardFinish.alt = 'Finalizar';
imgWizardFinish.width = "150";
imgWizardFinish.height="180";
imgWizardFinish.onclick = function() {
WebMixUI.Loading(true, 'search');
WebMixUIDOM.SelRegion.setSelectedIndex(City3.selectedIndex + 1);
WebMixUIDOM.SelSuitedFor.setSelectedIndex(Type3.selectedIndex + 1);
WebMixUIDOM.SelArea.setSelectedIndex(Area3.selectedIndex + 1);
WebMixUIDOM.SelDorms.setSelectedIndex(Dorms3.selectedIndex);
var myRegion = WebMixUIDOM.GetRegionList()[document.getElementById('City3').selectedIndex + 1][2];
var mySuitedFor = Type3.value;
if (mySuitedFor == "R") {
WebMix.DoSearch( { region: myRegion, suitedFor: Type3.value, dorms: Dorms3.value } );
} else {
WebMix.DoSearch( { region: myRegion, suitedFor: Type3.value, area: Area3.value } );
}
document.getElementById('divMapWizardStep3').style['display']='none';
if (WebMixUIDOM.SelSuitedFor.value == "R") {
document.getElementById('selDorms').style['display'] = 'block';
}/* else if (document.getElementById('selSuitedFor').value == "C") {
//document.getElementById('selArea').style['display'] = 'inline';
}*/
}
divMapWizardStep3.appendChild(imgWizardFinish);
return divMapWizard;
};
WebMixUIDOM.LoadHelpBox = true;
WebMixUIDOM.ShowHelpBox = function() {
WebMixUIDOM.ShowMessageBox('Ajuda', 'Como faço para achar meu imóvel ideal através do mapa?
Você escolhe as características desejadas e aparecerão todos os imóveis que se enquadram no seu perfil.
Como faço para iniciar uma nova busca?
É só utilizar a aba de filtros e fazer uma nova pesquisa. A partir daí o mapa identificará todos os imóveis que atendam os critérios selecionados.
Como faço para conhecer mais sobre a região?
Clique na aba serviços localizada no centro-inferior do mapa. Lá você conhecerá as proximidades de shoppings, hospitais, escolas entre outros.
Como faço para adicionar aos meus favoritos?
Para adicionar um favorito, escolha um imóvel no mapa e clique na opção "[+ favoritos]"
Como faço para chegar até o imóvel desejado?
Escolha o imóvel que deseja conhecer e clique na opção [como chegar]. Em seguida digite o endereço de origem e aguarde.
');
}
WebMixUIDOM.ShowMessageBox = function(title, message) {
if (WebMixUIDOM.LoadHelpBox) {
var divHelpBox = document.createElement('div');
divHelpBox.id = 'divHelpBox';
var divMapBox = document.getElementById('divMapBox');
divMapBox.appendChild(divHelpBox);
var SpanHelpCloseButton = document.createElement('span');
SpanHelpCloseButton.id = 'SpanHelpCloseButton';
divHelpBox.appendChild(SpanHelpCloseButton);
SpanHelpCloseButton.innerHTML = 'X';
SpanHelpCloseButton.onclick = WebMixUIDOM.HideMessageBox;
var h2 = document.createElement('h2');
h2.id = 'h2HelpTitle';
divHelpBox.appendChild(h2);
h2.appendChild(document.createTextNode(title));
var SpanHelpText = document.createElement('span');
SpanHelpText.id = 'SpanHelpText';
divHelpBox.appendChild(SpanHelpText);
SpanHelpText.innerHTML = message;
WebMixUIDOM.LoadHelpBox = false;
} else {
document.getElementById('SpanHelpText').innerHTML = message;
document.getElementById('h2HelpTitle').innerHTML = title;
document.getElementById('divHelpBox').style['display']='block';
}
}
WebMixUIDOM.HideMessageBox = function() {
var divHelpBox = document.getElementById('divHelpBox');
if (divHelpBox) {
divHelpBox.style['display']='none';
}
}
WebMixUIDOM.UpdateMarkers = function() {
var selRegion = WebMixUIDOM.SelRegion;
var selType = WebMixUIDOM.SelType;
var selSuitedFor = WebMixUIDOM.SelSuitedFor;
var selDorms = WebMixUIDOM.SelDorms;
var myRegion = WebMixUIDOM.GetRegion(selRegion.selectedIndex)[2];
var debug = '';
debug += 'Region: ' + myRegion;
debug += '\nType: ' + selType.value;
debug += '\nSuited For: ' + selSuitedFor.value;
debug += '\nDorms: ' + selDorms.value;
if(selSuitedFor.value == 'R') {
document.getElementById('selDorms').style['display'] = 'inline';
selType.DataSource = WebMixUIDOM.GetTypeList('R');
debug += '\nApplying filter: (Region:' + myRegion + ', Suited For:' + selSuitedFor.value + ', Dorms: ' + selDorms.value + ')';
WebMix.ApplyFilter({
region: myRegion,
suitedFor: selSuitedFor.value,
dorms: selDorms.value
});
} else if (selSuitedFor.value == 'C') {
document.getElementById('selDorms').style['display'] = 'none';
selType.DataSource = WebMixUIDOM.GetTypeList('C');
var myRegion = WebMixUIDOM.GetRegion(selRegion.selectedIndex)[2];
debug += '\nApplying filter: (Region:' + myRegion + ', Suited For:' + selSuitedFor.value + ')';
WebMix.ApplyFilter({
region: myRegion,
suitedFor: selSuitedFor.value
});
} else {
document.getElementById('selDorms').style['display'] = 'none';
selType.DataSource = WebMixUIDOM.GetTypeList();
var myRegion = WebMixUIDOM.GetRegion(selRegion.selectedIndex)[2];
debug += '\nApplying filter: (Region:' + myRegion + ')';
WebMix.ApplyFilter({
region: myRegion
});
}
//alert(debug);
selType.Show();
}
WebMixUIDOM.ImageIndex = 1;
WebMixUIDOM.GetImagePath = function(path) {
var absPath
switch (WebMixUIDOM.ImageIndex) {
case 1:
absPath = "http://inspira.com.br/app/WebMixRealty/";
break;
case 2:
absPath = "http://www.inspira.com.br/app/WebMixRealty/";
break;
case 3:
absPath = "http://www2.inspira.com.br/app/WebMixRealty/";
break;
case 4:
absPath = "http://www3.inspira.com.br/app/WebMixRealty/";
break;
case 5:
absPath = "http://www4.inspira.com.br/app/WebMixRealty/";
break;
case 6:
absPath = "http://app.inspira.com.br/WebMixRealty/";
break;
}
if (WebMixUIDOM.ImageIndex == 6) {
WebMixUIDOM.ImageIndex = 1;
} else {
WebMixUIDOM.ImageIndex++;
}
return absPath + path;
}
WebMixImageManager = function() {
}
function hasChild(parent, child) {
for (node in parent.ChildNodes) {
if (node == child) {
return true;
}
}
return false;
}
function WebMixUIMenu(id, onchangeCallback) {
var self = this;
self._id = id;
self._onchangeCallback = onchangeCallback;
this.DataSource = [];
this.selectedIndex = -1;
this.value = '';
self.IsLoaded = false;
this.setSelectedIndex = function(idx) {
self.selectedIndex = idx;
self.value = self.DataSource[idx][0];
self.text = self.DataSource[idx][1];
if (self.LiMenuItemDisabled) self.LiMenuItemDisabled.innerHTML = self.DataSource[idx][1];
}
this.Load = function(parent) {
// cria div que contem o menu selecionado e o nao selecionado
var divMenu = document.createElement('div');
parent.appendChild(divMenu);
divMenu.id = id;
divMenu.className = "clsMenu";
// menu nao selecionado... com opcao para selecionar
var divMenuDisabled = document.createElement('div');
divMenu.appendChild(divMenuDisabled);
divMenuDisabled.className = "clsMenuDisabled";
divMenuDisabled.onclick = function () {
var y = this;
for (var i = 0; i < y.parentNode.childNodes.length; i++) {
var k = y.parentNode.childNodes[i];
if (k.className == 'clsMenuEnabled') {
k.style['display'] = 'block';
}
}
}
// lista de elementos nao selecionados (contem apenas 1)
var ulMenuListDisabled = document.createElement('ul');
divMenuDisabled.appendChild(ulMenuListDisabled);
ulMenuListDisabled.className = 'clsMenuListDisabled';
// elemento nao selecionado
var liMenuItemDisabled = null;
if (self.DataSource.length > 0) {
liMenuItemDisabled = document.createElement('li');
ulMenuListDisabled.appendChild(liMenuItemDisabled);
liMenuItemDisabled.appendChild(document.createTextNode(self.DataSource[0][1]));
self.LiMenuItemDisabled = liMenuItemDisabled;
}
// div selecionado, que exibe todas as opcoes
var divMenuEnabled = document.createElement('div');
divMenu.appendChild(divMenuEnabled);
divMenuEnabled.className = "clsMenuEnabled";
self.DivMenuEnabled = divMenuEnabled;
// lista de opcoes
var ulMenuListEnabled = document.createElement('ul');
divMenuEnabled.appendChild(ulMenuListEnabled);
ulMenuListEnabled.className = 'clsMenuListEnabled';
self.UlMenuListEnabled = ulMenuListEnabled;
}
this.Show = function(parent) {
if (!self.IsLoaded) {
self.Load(parent);
self.IsLoaded = true;
}
self.UlMenuListEnabled.innerHTML = '';
var dataSource = self.DataSource;
for (var i = 0; i < dataSource.length; i++) {
var _dataItem = dataSource[i];
var liMenuItemEnabled = document.createElement('li');
self.UlMenuListEnabled.appendChild(liMenuItemEnabled);
liMenuItemEnabled._value = _dataItem[0];
liMenuItemEnabled._text = _dataItem[1];
liMenuItemEnabled._selectedIndex = i;
liMenuItemEnabled.appendChild(document.createTextNode(_dataItem[1]));
liMenuItemEnabled.onclick = function() {
self.selectedIndex = this._selectedIndex;
self.value = this._value;
self.text = this._text;
if (self.LiMenuItemDisabled) self.LiMenuItemDisabled.innerHTML = this._text;
if (typeof(self.OnChange) == "function") {
self.OnChange();
}
self.DivMenuEnabled.style['display'] = 'none';
}
}
}
}