rei_months = ["januari", "februari", "mars", "april", "maj", "juni", "juli", "augusti", "september", "oktober", "november", "december"]; rei_marketingTypes = {"OneFamilyDetachedHouse" : "1-familjs friliggande villa","TwoFamilyDetachedHouse" : "2-familjs friliggande villa","Townhouse" : "Radhus","TerraceHouse" : "Kedjehus","TwinHouse" : "Parhus","Cottage" : "Fritidshus","Apartment" : "Bostadsrättslägenhet","Plot" : "Tomt","Farm" : "Gård","ParceledFarm" : "Avstyckad gård","Other " : "Övrig bostad","Project " : "Projekt","HorseFarm " : "Hästgård","Agriculture " : "Jordbruk","Forestry " : "Skogsbruk","ResidentialProperty " : "Bostadsfastight","OfficeProperty " : "Kontorsfastighet","RetailProperty " : "Butiksfastighet","IndustrialProperty " : "Industrifastighet","WarehouseProperty " : "Lagerfastighet","PremisesProperty " : "Lokalfastighet","Condominium " : "Ägarlägenhet","House " : "Friliggande villa","IngetBruk " : "Inget bruk "}; function rei_buildVitecLayout(callback = null) { if (typeof rei_vitecapi_property == 'undefined') { console.log("No data"); return;} let prop = rei_vitecapi_property; if (prop.type == 'utlandsfastigheter') return rei_buildVitecOverseasLayout(callback); prop.dateChangedEpoch = Date.parse(prop.dateChanged); let propertyContainer = document.getElementById("rei-property-container"); if (propertyContainer == null) { console.log("No element to insert property data!"); return;} let interestFormContainer = document.getElementById("rei-interestform-container"); propContact = document.createElement('div'); propContact.className = 'rei-property-contact'; propContact.innerHTML = ''; propContact.appendChild(interestFormContainer); var rei_vitecapi_hasMap = false; if (prop.baseInformation.objectAddress && prop.baseInformation.objectAddress.coordinate != undefined && prop.baseInformation.objectAddress.coordinate != null ) rei_vitecapi_hasMap = true; propTop = document.createElement('div'); propTop.className = 'rei-property-top'; htmlToAdd = ''; if (prop.viewings != undefined && prop.viewings != null ) { htmlToAdd += '

Visning

'; htmlToAdd += '
'; for (viewNo = 0; viewNo < prop.viewings.length; viewNo++) { let viewDate = new Date(prop.viewings[viewNo].startTime); let viewEnd = (prop.viewings[viewNo].endTime != undefined && prop.viewings[viewNo].endTime != null) ? new Date(prop.viewings[viewNo].endTime) : false; htmlToAdd += '
'+viewDate.getDate()+' '+rei_months[viewDate.getMonth()]+' '+viewDate.getHours()+':'+(''+viewDate.getMinutes()).padStart(2, '0')+(!viewEnd ? '' : (' - '+viewEnd.getHours()+':'+(''+viewEnd.getMinutes()).padStart(2, '0')))+"
"; htmlToAdd += '
'+((prop.viewings[viewNo].commentary != undefined && prop.viewings[viewNo].commentary != null ) ? prop.viewings[viewNo].commentary : '')+'
'; htmlToAdd += '
'+((prop.viewings[viewNo].bookableFromInternet != undefined && prop.viewings[viewNo].bookableFromInternet == true && prop.viewings[viewNo].bookingUrl != undefined && prop.viewings[viewNo].bookingUrl != null) ? ('Boka') : '')+'
'; } htmlToAdd += '
'; // htmlToAdd += ''; htmlToAdd += '
'; } htmlToAdd += '
'+ '
'+(prop.baseInformation.objectAddress.area != undefined && prop.baseInformation.objectAddress.area != null ? prop.baseInformation.objectAddress.area : " ")+"
"+ (prop.baseInformation.objectAddress.streetAddress != undefined && prop.baseInformation.objectAddress.streetAddress != null ? prop.baseInformation.objectAddress.streetAddress : " ")+'
'+ '
'+ '
'; propTop.innerHTML = htmlToAdd; propertyContainer.appendChild(propTop); propViewingsBids = document.createElement('div'); propViewingsBids.className = 'rei-property-viewingsbids'; htmlToAdd = ''; if (prop.viewings != undefined && prop.viewings != null ) { for (viewNo = prop.viewings.length-1; viewNo >= 0; viewNo--) { let viewEnd = (prop.viewings[viewNo].endTime != undefined && prop.viewings[viewNo].endTime != null) ? new Date(prop.viewings[viewNo].endTime) : false; if (!viewEnd || viewEnd.getTime() <= Date.now()) prop.viewings.splice(viewNo, 1); } if (prop.viewings.length == 0) prop.viewings = null; } if (prop.viewings != undefined && prop.viewings != null ) { htmlToAdd += '

Visning

'; htmlToAdd += '
'; for (viewNo = 0; viewNo < prop.viewings.length; viewNo++) { let viewDate = new Date(prop.viewings[viewNo].startTime); let viewEnd = (prop.viewings[viewNo].endTime != undefined && prop.viewings[viewNo].endTime != null) ? new Date(prop.viewings[viewNo].endTime) : false; htmlToAdd += '
'+viewDate.getDate()+' '+rei_months[viewDate.getMonth()]+' '+viewDate.getHours()+':'+(''+viewDate.getMinutes()).padStart(2, '0')+(!viewEnd ? '' : (' - '+viewEnd.getHours()+':'+(''+viewEnd.getMinutes()).padStart(2, '0')))+"
"; htmlToAdd += '
'+((prop.viewings[viewNo].commentary != undefined && prop.viewings[viewNo].commentary != null ) ? prop.viewings[viewNo].commentary : '')+'
'; htmlToAdd += '
'+((prop.viewings[viewNo].bookableFromInternet != undefined && prop.viewings[viewNo].bookableFromInternet == true && prop.viewings[viewNo].bookingUrl != undefined && prop.viewings[viewNo].bookingUrl != null) ? ('Boka') : '')+'
'; } htmlToAdd += '
'; // htmlToAdd += ''; htmlToAdd += '
'; } htmlToAdd += '
'; htmlToAdd += '

Typ: '+rei_marketingTypes[prop.marketedAs]+'

'; htmlToAdd += '

Objekt id: '+prop.assignment.estatenumber+'

'; // htmlToAdd += '

Upplåtelseform: '+prop.baseInformation.disposalForm+'

'; if (prop.houseInterior != undefined && prop.houseInterior != null && prop.houseInterior != 0) htmlToAdd += '

Antal rum: '+prop.houseInterior.numberOfRooms+(prop.houseInterior.numberOffBedroom != undefined ? (' varav '+prop.houseInterior.numberOffBedroom+' sovrum') : '')+'

'; if (prop.interior != undefined && prop.interior != null && prop.interior != 0) htmlToAdd += '

Antal rum: '+prop.interior.numberOfRooms+(prop.interior.numberOffBedroom != undefined ? (' varav '+prop.interior.numberOffBedroom+' sovrum') : '')+'

'; if (prop.baseInformation.livingSpace != undefined && prop.baseInformation.livingSpace != null && prop.baseInformation.livingSpace != 0) htmlToAdd += '

Boarea: '+prop.baseInformation.livingSpace+' m²'+'

'; if (prop.plot != undefined && prop.plot.area != undefined && prop.plot.area != null && prop.plot.area != 0) htmlToAdd += '

Tomtarea: '+prop.plot.area+' m²'+'

'; if (prop.baseInformation.otherSpace != undefined && prop.baseInformation.otherSpace != null && prop.baseInformation.otherSpace != 0) htmlToAdd += '

Biarea: '+prop.baseInformation.otherSpace+' m²'+'

'; if (prop.balconyPatio != undefined && prop.balconyPatio.balcony != undefined && prop.balconyPatio.balcony != null) htmlToAdd += '

Balkong: '+(prop.balconyPatio.balcony=="1" ? "Ja" : "Nej")+'

'; if (prop.floorAndElevator != undefined && prop.floorAndElevator.elevator != undefined && prop.floorAndElevator.elevator != null && (prop.floorAndElevator.elevator == "Yes" || prop.floorAndElevator.elevator == "No")) htmlToAdd += '

Hiss: '+(prop.floorAndElevator.elevator=="Yes" ? "Ja" : "Nej")+'

'; if (prop.floorAndElevator != undefined && prop.floorAndElevator.floor != undefined && prop.floorAndElevator.floor != null) { htmlToAdd += '

Våning: '+prop.floorAndElevator.floor; if (prop.floorAndElevator.totalNumberFloors != undefined && prop.floorAndElevator.totalNumberFloors != null) htmlToAdd += ' av '+prop.floorAndElevator.totalNumberFloors; htmlToAdd += '

'; } if (prop.assignment.status.name == "Till salu") { if (prop.price.startingPrice != undefined && prop.price.startingPrice != null && prop.price.startingPrice != 0) htmlToAdd += '

Pris: '+rei_vitec_priceFormat(prop.price.startingPrice)+' kr '+(prop.price.text != undefined && prop.price.text != null && prop.price.text != "" ? prop.price.text : '')+'

'; } else if (prop.price.finalPrice != undefined && prop.price.finalPrice != null && prop.price.finalPrice != 0) htmlToAdd += '

Pris: '+rei_vitec_priceFormat(prop.price.finalPrice)+' kr '+(prop.price.text != undefined && prop.price.text != null && prop.price.text != "" ? prop.price.text : '')+'

'; if (prop.baseInformation.monthlyFee != undefined && prop.baseInformation.monthlyFee != null && prop.baseInformation.monthlyFee != 0) { htmlToAdd += '

Avgift: '+prop.baseInformation.monthlyFee+' kr/mån'; if (prop.baseInformation.commentary != undefined && prop.baseInformation.commentary != null && prop.baseInformation.commentary.length > 0) htmlToAdd += ' '+prop.baseInformation.commentary; htmlToAdd += '

'; } htmlToAdd += '
'; if (prop.bids != undefined && prop.bids != null) { htmlToAdd += '

Budgivning pågår

'; if (Array.isArray(prop.bids) && prop.bids.length > 0) { htmlToAdd += '

Högsta bud: '+rei_vitec_priceFormat(prop.bids[0].amount)+' kr'; } htmlToAdd += 'Lägg ett bud'; if (Array.isArray(prop.bids) && prop.internetSettings != undefined && prop.internetSettings != null && prop.internetSettings.bidSetting != undefined && prop.internetSettings.bidSetting == "ShowBiddhistory") { htmlToAdd += '

Se budhistorik

'; for (bidNo = 0; bidNo < prop.bids.length; bidNo++) { let bidTime = ""; if (prop.bids[bidNo].dateAndTime != undefined) bidTime = prop.bids[bidNo].dateAndTime.substr(8,2).replace(/^0/, " ")+"/"+prop.bids[bidNo].dateAndTime.substr(5,2).replace(/^0/, " ")+", "+prop.bids[bidNo].dateAndTime.substr(11,5).replace(/^0/, " "); htmlToAdd += ""; } htmlToAdd += '
"+bidTime+"Budgivare "+prop.bids[bidNo].alias+""+(prop.bids[bidNo].cancelled ? '' : '')+ rei_vitec_priceFormat(prop.bids[bidNo].amount)+' kr'+(prop.bids[bidNo].cancelled ? '' : '')+"
'; } htmlToAdd += '
' } if (prop.description != undefined && prop.description.shortSellingDescription != undefined && prop.description.shortSellingDescription != null) htmlToAdd += '
'+ prop.description.shortSellingDescription + '
'; propViewingsBids.innerHTML = htmlToAdd; propertyContainer.appendChild(propViewingsBids); let rei_bidToggler = document.getElementById("rei-view-bids"); if (rei_bidToggler != null) rei_bidToggler.addEventListener('click', function(evt) { document.getElementById("rei-bid-history").className += " rei-active"; evt.target.style.display = "none"; }) descNAgentHolder = document.createElement('div'); descNAgentHolder.className = 'rei-descnagent-holder'; propertyContainer.appendChild(descNAgentHolder); descNAgentInner = document.createElement('div'); descNAgentHolder.appendChild(descNAgentInner); propDescription = document.createElement('div'); propDescription.className = 'rei-property-description'; // let abbrTxt = rei_vitec_niceLimitText(prop.description.longSellingDescription, 300); let propDesc = ((prop.houseInterior != undefined && prop.houseInterior != null && prop.houseInterior.generealDescription != undefined && prop.houseInterior.generealDescription != null) ? (prop.houseInterior.generealDescription) : ((prop.interior != undefined && prop.interior != null && prop.interior.generealDescription != undefined && prop.interior.generealDescription != null) ? prop.interior.generealDescription : "")); propDesc = propDesc.replace(/\r?\n|\r/g, "
"); let abbrTxt = rei_vitec_niceLimitText(propDesc, 300); propDescription.innerHTML = '

Beskrivning

'+abbrTxt+'

'+(propDesc.length > abbrTxt.length ? '' : ''); if (propDesc.length > abbrTxt.length) propDescription.innerHTML += '

'+propDesc+'

'; descNAgentInner.appendChild(propDescription); let rei_descToggler = document.getElementById("rei-more-desc"); if (rei_descToggler != null) rei_descToggler.addEventListener('click', function(evt) { document.getElementById("rei-long-description").className += " rei-active";document.getElementById("rei-pre-description").className += " rei-hide"; evt.target.style.display = "none"; }) propAgents = document.createElement('div'); propAgents.className = 'rei-property-agents'; propAgents.innerHTML = ''; if (prop.assignment != undefined && prop.assignment.responsibleBroker != undefined && prop.assignment.responsibleBroker.userName != undefined && prop.assignment.responsibleBroker.userName != null ) { propAgents.innerHTML += '

Ansvarig mäklare
'+prop.assignment.responsibleBroker.userName+''+ '
'+prop.assignment.responsibleBroker.title+'

'+prop.assignment.responsibleBroker.emailAddress+''+ '
'+(prop.assignment.responsibleBroker.telePhone != null ? (''+prop.assignment.responsibleBroker.telePhone+'') : '') + ((prop.assignment.responsibleBroker.telePhone != null && prop.assignment.responsibleBroker.cellPhone != null) ? ' / ' : '') + (prop.assignment.responsibleBroker.cellPhone != null ? ''+(prop.assignment.responsibleBroker.cellPhone+'') : '')+'

'; } if (prop.assignment != undefined && prop.assignment.additionalContact != undefined && prop.assignment.additionalContact.userName != undefined && prop.assignment.additionalContact.userName != null ) { propAgents.innerHTML += '

Assisterande mäklare
'+prop.assignment.additionalContact.userName+''+ '
'+prop.assignment.additionalContact.title+'

'+prop.assignment.additionalContact.emailAddress+''+ '
'+(prop.assignment.additionalContact.telePhone != null ? (''+prop.assignment.additionalContact.telePhone+'') : '') + ((prop.assignment.additionalContact.telePhone != null && prop.assignment.additionalContact.cellPhone != null) ? ' / ' : '') + (prop.assignment.additionalContact.cellPhone != null ? (''+prop.assignment.additionalContact.cellPhone+'') : '')+'

'; } propAgents.innerHTML += '
'+ ''+ ''+ '
Tipsa någon om
'+prop.baseInformation.objectAddress.streetAddress+'
' descNAgentInner.appendChild(propAgents); propImages = document.createElement('div'); propImages.className = 'rei-property-images'; propImages.innerHTML = '

Bilder

'; imagesBox = document.createElement('div'); imagesBox.className = 'rei-images'; imagesBox.id = 'rei-images-container'; for (imgNo = 0; imgNo < 10 && imgNo < prop.images.length; imgNo++) { imagesBox.innerHTML += '
'; } propImages.appendChild(imagesBox) propImages.innerHTML += ''; propertyContainer.appendChild(propImages); let els = document.getElementById("rei-images-container").children; for (elNo = 0; elNo < els.length; elNo++) { els.item(elNo).setAttribute("rei-image-no", elNo); els.item(elNo).addEventListener('click', (e) => { let t = e.target; if(t.tagName.toUpperCase() == "IMG") { t = t.parentElement;} rei_vitec_startSlideshow(parseInt(t.getAttribute("rei-image-no"))+1); return false;} ); } document.getElementById("rei-more-imgs").addEventListener('click', () => { rei_vitec_startSlideshow(1); return false;}); propFacts = document.createElement('div'); propFacts.className = 'rei-property-facts'; propFacts.innerHTML = '

Bostadsfakta

'; propFactsInner = document.createElement('div'); propFacts.appendChild(propFactsInner); tmpHtml = '
'; if (prop.houseInterior != undefined && prop.houseInterior != null && prop.houseInterior != 0) tmpHtml += '

Antal rum: '+prop.houseInterior.numberOfRooms+(prop.houseInterior.numberOffBedroom != undefined ? (' varav '+prop.houseInterior.numberOffBedroom+' sovrum') : '')+'

'; if (prop.interior != undefined && prop.interior.numberOfRooms != undefined && prop.interior.numberOfRooms != null && prop.interior.numberOfRooms != 0) { tmpHtml += '

Antal rum: '+prop.interior.numberOfRooms; if (prop.interior.numberOfBedroom != undefined && prop.interior.numberOfBedroom != null) tmpHtml += ' varav '+prop.interior.numberOfBedroom+' sovrum'; if (prop.interior.kitchenType != undefined && prop.interior.kitchenType != null) tmpHtml += ' och '+prop.interior.kitchenType; tmpHtml += '

'; } if (prop.baseInformation.livingSpace != undefined && prop.baseInformation.livingSpace != null && prop.baseInformation.livingSpace != 0) { tmpHtml += '

Boarea: '+prop.baseInformation.livingSpace+' m²'; if (prop.baseInformation.areaSource != undefined && prop.baseInformation.areaSource != null) { tmpHtml += ', '+prop.baseInformation.areaSource; if (prop.baseInformation.areaSourceComment != undefined && prop.baseInformation.areaSourceComment != null) tmpHtml += ' '+prop.baseInformation.areaSourceComment; } tmpHtml += '

'; } if (prop.baseInformation.otherSpace != undefined && prop.baseInformation.otherSpace != null && prop.baseInformation.otherSpace != 0) tmpHtml += '

Biarea: '+prop.baseInformation.otherSpace+' m²'+'

'; tmpHtml += '

Byggnadstyp: '+prop.building.buildingType+'

'; if (prop.building.buildingYear != undefined && prop.building.buildingYear != null && prop.building.buildingYear != 0) tmpHtml += '

Byggnadsår: '+prop.building.buildingYear+((prop.building.commentaryForBuildingYear != undefined && prop.building.commentaryForBuildingYear != null) ? (' '+prop.building.commentaryForBuildingYear) : '')+'

'; if (prop.building.foundation != undefined && prop.building.foundation != null) tmpHtml += '

Grundläggning: '+prop.building.foundation+'

'; if (prop.building.foundationWall != undefined && prop.building.foundationWall != null) tmpHtml += '

Grundmur: '+prop.building.foundationWall+'

'; // if (prop.building.foundationWall != undefined && prop.building.foundationWall != null) tmpHtml += '

Grundmur: '+prop.building.foundationWall+'

'; if (prop.building.frame != undefined && prop.building.frame != null) tmpHtml += '

Stomme: '+prop.building.frame+'

'; if (prop.building.facade != undefined && prop.building.facade != null) tmpHtml += '

Fasad: '+prop.building.facade+'

'; if (prop.building.windows != undefined && prop.building.windows != null) tmpHtml += '

Fönster: '+prop.building.windows+'

'; if (prop.building.beam != undefined && prop.building.beam != null) tmpHtml += '

Bjälklag: '+prop.building.beam+'

'; if (prop.building.externallySheetMetalWork != undefined && prop.building.externallySheetMetalWork != null) tmpHtml += '

Utvändigt plåtarbete: '+prop.building.externallySheetMetalWork+'

'; if (prop.building.heating != undefined && prop.building.heating != null) tmpHtml += '

Uppvärmning: '+prop.building.heating+'

'; if (prop.ventilation != undefined && prop.ventilation != null && prop.ventilation.type != undefined && prop.ventilation.type != null && prop.ventilation.type != "") { tmpHtml += '

Ventilation: '+prop.ventilation.type+'

'; if (prop.ventilation.inspection != undefined && prop.ventilation.inspection != null && prop.ventilation.inspection != "") tmpHtml += '

Ventilation inspektion: '+prop.ventilation.inspection+'

'; } tmpHtml += '
'; propFactsInner.innerHTML += tmpHtml; tmpHtml = '
'; if (prop.building.otherAboutTheBuildning != undefined && prop.building.otherAboutTheBuildning != null && prop.building.otherAboutTheBuildning != "") tmpHtml += '


Övrigt:
'+prop.building.otherAboutTheBuildning.replace(/\r?\n|\r/g, "
")+'

'; if (prop.building.otherBuildings != undefined && prop.building.otherBuildings != null && prop.building.otherBuildings != "") tmpHtml += '


Övriga byggnader:
'+prop.building.otherBuildings+'

'; if (prop.advertiseOn.documents != undefined && prop.advertiseOn.documents != null && prop.advertiseOn.documents.length > 0) { let innerToAdd = '


Dokument:
'; for (docNo = 0; docNo < prop.advertiseOn.documents.length-1; docNo++) { if (prop.advertiseOn.documents[docNo+1].name < prop.advertiseOn.documents[docNo].name) { let tmp = prop.advertiseOn.documents[docNo].name; prop.advertiseOn.documents[docNo].name = prop.advertiseOn.documents[docNo+1].name; prop.advertiseOn.documents[docNo+1].name = tmp; docNo = 0; } } for (docNo = 0; docNo < prop.advertiseOn.documents.length; docNo++) { innerToAdd += ''+prop.advertiseOn.documents[docNo].name+''; } tmpHtml += innerToAdd + '

'; } tmpHtml += '
'; propFactsInner.innerHTML += tmpHtml; propertyContainer.appendChild(propFacts); econInner = ''; if (prop.baseInformation.monthlyFee != undefined && prop.baseInformation.monthlyFee != null && prop.baseInformation.monthlyFee != 0) { econInner += '

Avgift: '+prop.baseInformation.monthlyFee+' kr/mån'; if (prop.baseInformation.commentary != undefined && prop.baseInformation.commentary != null && prop.baseInformation.commentary.length > 0) econInner += ' '+prop.baseInformation.commentary; econInner += '

'; } if (prop.operation.personsInTheHousehold != undefined && prop.operation.personsInTheHousehold != null && prop.operation.personsInTheHousehold != 0) econInner += '

Antal personer i hushållet: '+prop.operation.personsInTheHousehold+'

'; if (prop.operation.heating != undefined && prop.operation.heating != null && prop.operation.heating != 0) econInner += '

Uppvärmningskostnad: '+rei_vitec_priceFormat(prop.operation.heating)+' kr/år

'; if (prop.operation.electricity != undefined && prop.operation.electricity != null && prop.operation.electricity != 0) econInner += '

Elkostnad: '+rei_vitec_priceFormat(prop.operation.electricity)+' kr/år

'; if (prop.operation.waterAndDrain != undefined && prop.operation.waterAndDrain != null && prop.operation.waterAndDrain != 0) econInner += '

Vatten & avlopp: '+rei_vitec_priceFormat(prop.operation.waterAndDrain)+' kr/år

'; if (prop.operation.chimneySweeping != undefined && prop.operation.chimneySweeping != null && prop.operation.chimneySweeping != 0) econInner += '

Sotning: '+rei_vitec_priceFormat(prop.operation.chimneySweeping)+' kr/år

'; if (prop.operation.roadCommunity != undefined && prop.operation.roadCommunity != null && prop.operation.roadCommunity != 0) econInner += '

Vägsamfällighet: '+rei_vitec_priceFormat(prop.operation.roadCommunity)+' kr/år

'; if (prop.operation.roadCharge != undefined && prop.operation.roadCharge != null && prop.operation.roadCharge != 0) econInner += '

Vägavgift/snöröjning: '+rei_vitec_priceFormat(prop.operation.roadCharge)+' kr/år

'; if (prop.operation.sanitation != undefined && prop.operation.sanitation != null && prop.operation.sanitation != 0) econInner += '

Renhållning: '+rei_vitec_priceFormat(prop.operation.sanitation)+' kr/år

'; if (prop.operation.insurance != undefined && prop.operation.insurance != null && prop.operation.insurance != 0) econInner += '

Försäkring: '+rei_vitec_priceFormat(prop.operation.insurance)+' kr/år

'; if (prop.operation.other != undefined && prop.operation.other != null && prop.operation.other != 0) econInner += '

Övrigt: '+rei_vitec_priceFormat(prop.operation.other)+' kr/år

'; if (prop.operation.sum != undefined && prop.operation.sum != null && prop.operation.sum != 0) econInner += '

Total driftkostnad: '+rei_vitec_priceFormat(prop.operation.sum)+' kr/år

'; if (prop.operation.commentary != undefined && prop.operation.commentary != null && prop.operation.commentary != 0) econInner += '

Kommentar: '+rei_vitec_priceFormat(prop.operation.commentary)+'

'; if (prop.electricity != undefined && prop.electricity != null && rei_has_intval(prop.electricity, "powerConsumptionKWH")) econInner += '

Elförbrukning: '+rei_vitec_priceFormat(prop.electricity.powerConsumptionKWH)+' kWh/år

'; if (rei_has_intval(prop.operation, "electricity")) econInner += '

Elkostnad: '+rei_vitec_priceFormat(prop.operation.electricity)+'

'; if (prop.energyDeclaration != undefined && prop.energyDeclaration != null) { if (prop.energyDeclaration.energyClass != undefined && prop.energyDeclaration.energyClass != null && prop.energyDeclaration.energyClass != "None" && prop.energyDeclaration.energyClass != "") econInner += '

Energiklass: '+prop.energyDeclaration.energyClass+'

'; if (prop.energyDeclaration.energyConsumption != undefined && prop.energyDeclaration.energyConsumption != null && prop.energyDeclaration.energyConsumption != "" && prop.energyDeclaration.energyConsumption != 0) econInner += '

Energiprestanda: '+prop.energyDeclaration.energyConsumption+' kWh/m²/år

'; } if (econInner.length > 0) { propEconomy = document.createElement('div'); propEconomy.className = 'rei-property-economy'; propEconomy.innerHTML = '

Ekonomi

'; propEconomyInner = document.createElement('div'); propEconomyInner.innerHTML = econInner; propEconomy.appendChild(propEconomyInner); propertyContainer.appendChild(propEconomy); } if (rei_vitecapi_hasMap) { propMap = document.createElement('div'); propMap.className = 'rei-property-map'; propMap.innerHTML = '
'+ 'Öppna i Google Maps'; propertyContainer.appendChild(propMap); } if ((prop.surrounding != undefined && prop.surrounding != null && (prop.surrounding.communication != null || prop.surrounding.generalAboutArea != null || prop.surrounding.nearService != null || prop.surrounding.other != null || prop.surrounding.parking != null)) || (prop.assess != undefined && prop.assess != null && (prop.assess.buildingValue != null || prop.assess.landValue != null || prop.assess.leaseholdFee != null || prop.assess.leaseholdUntil != null || prop.assess.preliminaryAssessedValue != null || prop.assess.taxAssessmentYear != null || prop.assess.taxFee != null || prop.assess.totalAssessedValue != null || prop.assess.typeCode != null || prop.assess.valueYear != null ))) { propIdSurroundings = document.createElement('div'); propIdSurroundings.className = 'rei-property-idsurroundings'; propIdSurroundings.innerHTML += ''; propIdSurroundings.innerHTML += '

Fastighet och omgivning

'; tmpHtml = '
'; if (prop.baseInformation.propertyUnitDesignation != undefined && prop.baseInformation.propertyUnitDesignation != null) tmpHtml += '

Fastighetsbeteckning: '+prop.baseInformation.propertyUnitDesignation+'

'; // if (prop.association != undefined && prop.association != null) { // if (prop.association.name != undefined && prop.association.name != null) tmpHtml += '

Namn: '+prop.association.name+'

'; // if (prop.association.publicContact != undefined && prop.association.publicContact != null) tmpHtml += '

Kontaktperson: '+prop.association.publicContact+'

'; // if (prop.association.phonePublicContact != undefined && prop.association.phonePublicContact != null) tmpHtml += '

Kontakttelefon: '+prop.association.phonePublicContact+'

'; // if (prop.association.email != undefined && prop.association.email != null && prop.association.email.emailAddress != undefined && prop.association.email.emailAddress != null) tmpHtml += '

Kontaktemail: '+prop.association.email.emailAddress+'

'; // if (prop.association.generalAboutAssociation != undefined && prop.association.generalAboutAssociation != null) tmpHtml += '

Allmänt om föreningen: '+prop.association.generalAboutAssociation.replace(/\r?\n|\r/g, "
")+'

'; // if (prop.association.parking != undefined && prop.association.parking != null) tmpHtml += '

Parkering/garage: '+prop.association.parking.replace(/\r?\n|\r/g, "
")+'

'; // if (prop.association.tvAndBroadband != undefined && prop.association.tvAndBroadband != null) tmpHtml += '

Bredband/TV: '+prop.association.tvAndBroadband.replace(/\r?\n|\r/g, "
")+'

'; // if (prop.association.renovations != undefined && prop.association.renovations != null) tmpHtml += '

Renoveringar: '+prop.association.renovations.replace(/\r?\n|\r/g, "
")+'

'; // if (prop.association.finances != undefined && prop.association.finances != null) tmpHtml += '

Ekonomi: '+prop.association.finances.replace(/\r?\n|\r/g, "
")+'

'; // if (prop.association.other != undefined && prop.association.other != null) tmpHtml += '

Övrigt: '+prop.association.other.replace(/\r?\n|\r/g, "
")+'

'; // } if (prop.assess != undefined && prop.assess != null && prop.assess.typeCode != undefined && prop.assess.typeCode != null) tmpHtml += '

Taxeringskod: '+prop.assess.typeCode+'

'; if (prop.assess != undefined && prop.assess != null && prop.assess.totalAssessedValue != undefined && prop.assess.totalAssessedValue != null) tmpHtml += '

Taxeringsvärde: '+rei_vitec_priceFormat(prop.assess.totalAssessedValue)+' kr

'; if (prop.assess != undefined && prop.assess != null && prop.assess.taxAssessmentYear != undefined && prop.assess.taxAssessmentYear != null) tmpHtml += '

Taxeringsår: '+prop.assess.taxAssessmentYear+'

'; if (prop.waterAndDrain != undefined && prop.waterAndDrain != null && prop.waterAndDrain.info != undefined && prop.waterAndDrain.info != null && prop.waterAndDrain.info != "") tmpHtml += '

Vatten/Avlopp: '+prop.waterAndDrain.info+'

'; if (prop.enrollments != undefined && prop.enrollments != null && rei_has_strval(prop.enrollments, "preferentialAndCommunity")) tmpHtml += '


Servitut etc:
'+prop.enrollments.preferentialAndCommunity+'

'; if (prop.plot != undefined && prop.plot != null && prop.plot.otherPlot != undefined && prop.plot.otherPlot != null && prop.plot.otherPlot != "") tmpHtml += '


Övrigt tomt:
'+prop.plot.otherPlot+'

'; tmpHtml += '


'; if (prop.surrounding != undefined && prop.surrounding != null) { if (prop.surrounding.generalAboutArea != undefined && prop.surrounding.generalAboutArea != null) tmpHtml += '


Allmänt om området:
'+prop.surrounding.generalAboutArea+'

'; if (prop.surrounding.nearService != undefined && prop.surrounding.nearService != null) tmpHtml += '


Närservice:
'+prop.surrounding.nearService+'

'; if (prop.surrounding.communication != undefined && prop.surrounding.communication != null) tmpHtml += '


Kommunikation:
'+prop.surrounding.communication+'

'; if (prop.surrounding.parking != undefined && prop.surrounding.parking != null) tmpHtml += '


Parkering:
'+prop.surrounding.parking+'

'; } tmpHtml += '
'; propIdSurroundings.innerHTML += tmpHtml; propertyContainer.appendChild(propIdSurroundings); } if (prop.association != undefined && prop.association != null) { propIdSurroundings = document.createElement('div'); propIdSurroundings.className = 'rei-property-association'; propIdSurroundings.innerHTML += ''; propIdSurroundings.innerHTML += '

Förening

'; tmpHtml = '
'; if (prop.baseInformation.propertyUnitDesignation != undefined && prop.baseInformation.propertyUnitDesignation != null) tmpHtml += '

Fastighetsbeteckning: '+prop.baseInformation.propertyUnitDesignation+'

'; if (prop.association != undefined && prop.association != null) { if (prop.association.name != undefined && prop.association.name != null) tmpHtml += '

Namn: '+prop.association.name+'

'; if (prop.association.publicContact != undefined && prop.association.publicContact != null) tmpHtml += '

Kontaktperson: '+prop.association.publicContact+'

'; if (prop.association.phonePublicContact != undefined && prop.association.phonePublicContact != null) tmpHtml += '

Kontakttelefon: '+prop.association.phonePublicContact+'

'; if (prop.association.email != undefined && prop.association.email != null && prop.association.email.emailAddress != undefined && prop.association.email.emailAddress != null) tmpHtml += '

Kontaktemail: '+prop.association.email.emailAddress+'

'; if (prop.association.generalAboutAssociation != undefined && prop.association.generalAboutAssociation != null) tmpHtml += '

Allmänt om föreningen: '+prop.association.generalAboutAssociation.replace(/\r?\n|\r/g, "
")+'

'; if (prop.association.parking != undefined && prop.association.parking != null) tmpHtml += '

Parkering/garage: '+prop.association.parking.replace(/\r?\n|\r/g, "
")+'

'; if (prop.association.tvAndBroadband != undefined && prop.association.tvAndBroadband != null) tmpHtml += '

Bredband/TV: '+prop.association.tvAndBroadband.replace(/\r?\n|\r/g, "
")+'

'; if (prop.association.renovations != undefined && prop.association.renovations != null) tmpHtml += '

Renoveringar: '+prop.association.renovations.replace(/\r?\n|\r/g, "
")+'

'; if (prop.association.finances != undefined && prop.association.finances != null) tmpHtml += '

Ekonomi: '+prop.association.finances.replace(/\r?\n|\r/g, "
")+'

'; if (prop.participationAndRepairFund != undefined && prop.participationAndRepairFund != null) { if (prop.participationAndRepairFund.indirectNetDebt != undefined && prop.participationAndRepairFund.indirectNetDebt != null) tmpHtml += '

Indirekt nettoskuldsättning: '+rei_vitec_priceFormat(prop.participationAndRepairFund.indirectNetDebt)+'

'; if (prop.participationAndRepairFund.indirectNetDebtComment != undefined && prop.participationAndRepairFund.indirectNetDebtComment != null) tmpHtml += '

Kommentar till indirekt nettoskuldsättning: '+prop.participationAndRepairFund.indirectNetDebtComment.replace(/\r?\n|\r/g, "
")+'

'; } if (prop.association.other != undefined && prop.association.other != null) tmpHtml += '

Övrigt: '+prop.association.other.replace(/\r?\n|\r/g, "
")+'

'; } if (prop.assess != undefined && prop.assess != null && prop.assess.typeCode != undefined && prop.assess.typeCode != null) tmpHtml += '

Taxeringskod: '+prop.assess.typeCode+'

'; if (prop.assess != undefined && prop.assess != null && prop.assess.totalAssessedValue != undefined && prop.assess.totalAssessedValue != null) tmpHtml += '

Taxeringsvärde: '+rei_vitec_priceFormat(prop.assess.totalAssessedValue)+' kr

'; if (prop.assess != undefined && prop.assess != null && prop.assess.taxAssessmentYear != undefined && prop.assess.taxAssessmentYear != null) tmpHtml += '

Taxeringsår: '+prop.assess.taxAssessmentYear+'

'; if (prop.waterAndDrain != undefined && prop.waterAndDrain != null && prop.waterAndDrain.info != undefined && prop.waterAndDrain.info != null && prop.waterAndDrain.info != "") tmpHtml += '

Vatten/Avlopp: '+prop.waterAndDrain.info+'

'; if (prop.enrollments != undefined && prop.enrollments != null && rei_has_strval(prop.enrollments, "preferentialAndCommunity")) tmpHtml += '


Servitut etc:
'+prop.enrollments.preferentialAndCommunity+'

'; if (prop.plot != undefined && prop.plot != null && prop.plot.otherPlot != undefined && prop.plot.otherPlot != null && prop.plot.otherPlot != "") tmpHtml += '


Övrigt tomt:
'+prop.plot.otherPlot+'

'; tmpHtml += '
'; propIdSurroundings.innerHTML += tmpHtml; propertyContainer.appendChild(propIdSurroundings); } propertyContainer.appendChild(propContact); if (rei_vitecapi_hasMap) { // Load Google Map! var script = document.createElement("script") script.type = "text/javascript"; // script.onload = function(){ callback(); }; script.src = "https://maps.googleapis.com/maps/api/js?key=AIzaSyABy2P55H03kBbE_6KewCv1qDUtY9Jup8k&callback=rei_vitec_initMap"; // script.src = "https://maps.googleapis.com/maps/api/js?key=AIzaSyCaSEpkjhPIGzV84UPpAygSfkfE-KNYVTI&callback=rei_vitec_initMap"; document.getElementsByTagName("head")[0].appendChild(script); } propMenuToggler = document.getElementById("rei-property-hamburger"); propMenuToggler.addEventListener('click', function(evt) { rei_togglePropMenu(evt.target); }) let menuDescendants = document.getElementById("rei-property-menu").getElementsByTagName("*"); for (elNo = 0; elNo < menuDescendants.length; elNo++) { if (menuDescendants[elNo].tagName == "A") menuDescendants[elNo].addEventListener('click', function(evt) { rei_togglePropMenu(evt.target); }); } let refnrInput = document.getElementById("rei-form-refnr"); if (refnrInput !== null && prop.assignment != undefined && prop.assignment.estatenumber != undefined && prop.assignment.estatenumber != null) refnrInput.value = prop.assignment.estatenumber; let addressInput = document.getElementById("rei-form-address"); if (addressInput !== null && prop.baseInformation.objectAddress != undefined && prop.baseInformation.objectAddress.streetAddress != undefined && prop.baseInformation.objectAddress.streetAddress != null) addressInput.value = prop.baseInformation.objectAddress.streetAddress; let linkInput = document.getElementById("rei-form-link"); if (linkInput !== null) linkInput.value = location.href; let bookViewingButton = document.getElementById("rei-book-viewing"); if (bookViewingButton != null) bookViewingButton.addEventListener('click', function(evt) { location.href=location.href.replace(/#.*$/, "")+"#contact";return false;}) } rei_buildVitecLayout(estate_insertShortContact); function rei_buildVitecOverseasLayout(callback = null) { if (typeof rei_vitecapi_property == 'undefined') { console.log("No data"); return;} let prop = rei_vitecapi_property; prop.dateChangedEpoch = Date.parse(prop.dateChanged); let propertyContainer = document.getElementById("rei-property-container"); propertyContainer.className += " rei-overseas-property"; if (propertyContainer == null) { console.log("No element to insert property data!"); return;} var rei_vitecapi_hasMap = false; if (prop.baseInformation.objectAddress && prop.baseInformation.objectAddress.coordinate != undefined && prop.baseInformation.objectAddress.coordinate != null ) rei_vitecapi_hasMap = true; let interestFormContainer = document.getElementById("rei-interestform-container"); propContact = document.createElement('div'); propContact.className = 'rei-property-contact'; propContact.innerHTML = ''; propContact.appendChild(interestFormContainer); propTop = document.createElement('div'); propTop.className = 'rei-property-top'; propTop.innerHTML = ''+ '
'+ '
'+prop.baseInformation.propertyType+", "+prop.baseInformation.address.city+'
'+ '
'+ 'INTRESSEANMÄLAN' + '
'; propertyContainer.appendChild(propTop); propViewingsBids = document.createElement('div'); propViewingsBids.className = 'rei-property-viewingsbids'; htmlToAdd = ''; htmlToAdd += '
'; htmlToAdd += '

Typ: '+rei_marketingTypes[prop.marketedAs]+'

'; htmlToAdd += '

Ort: '+prop.baseInformation.address.city+'

'; if (prop.baseInformation.address.area != undefined && prop.baseInformation.address.area != null && typeof prop.baseInformation.address.area == "string") htmlToAdd += '

Område: '+prop.baseInformation.address.area+'

'; htmlToAdd += '

Objekt id: '+prop.assignment.estatenumber+'

'; if (prop.houseInterior != undefined && prop.houseInterior != null && prop.houseInterior != 0) htmlToAdd += '

Antal rum: '+prop.houseInterior.numberOfRooms+(prop.houseInterior.numberOffBedroom != undefined ? (' varav '+prop.houseInterior.numberOffBedroom+' sovrum') : '')+'

'; if (prop.interior != undefined && prop.interior != null && prop.interior != 0) htmlToAdd += '

Antal rum: '+prop.interior.numberOfRooms+(prop.interior.numberOfBedrooms != undefined ? (' varav '+prop.interior.numberOfBedrooms+' sovrum') : '')+'

'; if (prop.houseInterior != undefined && prop.houseInterior != null && prop.houseInterior != 0) htmlToAdd += '

Antal badrum: '+prop.houseInterior.numberOfBathrooms+'

'; if (prop.interior != undefined && prop.interior != null && prop.interior != 0) htmlToAdd += '

Antal badrum: '+prop.interior.numberOfBathrooms+'

'; if (prop.baseInformation.livingSpace != undefined && prop.baseInformation.livingSpace != null && prop.baseInformation.livingSpace != 0) htmlToAdd += '

Boarea: '+prop.baseInformation.livingSpace+' m²'+'

'; else if (prop.baseInformation.buildingArea != undefined && prop.baseInformation.buildingArea != null && prop.baseInformation.buildingArea != 0) htmlToAdd += '

Byggyta: '+prop.baseInformation.buildingArea+' m²'+'

'; if (prop.plot != undefined && prop.plot.area != undefined && prop.plot.area != null && prop.plot.area != 0) htmlToAdd += '

Tomtarea: '+prop.plot.area+' m²'+'

'; if (prop.exterior.pool != undefined && prop.exterior.pool) htmlToAdd += '

Pool: Ja'+'

'; if (prop.exterior.terrace != undefined && prop.exterior.terrace) htmlToAdd += '

Terrass: Ja'+'

'; if (prop.price.startingPrice != undefined && prop.price.startingPrice != null && prop.price.startingPrice != 0) htmlToAdd += '

Pris: '+rei_vitec_priceFormat(prop.price.startingPrice)+' € '+(prop.price.text != undefined && prop.price.text != null && prop.price.text != "" ? prop.price.text : '')+'

'; htmlToAdd += '
'; propViewingsBids.innerHTML = htmlToAdd; propertyContainer.appendChild(propViewingsBids); descNAgentHolder = document.createElement('div'); descNAgentHolder.className = 'rei-descnagent-holder'; propertyContainer.appendChild(descNAgentHolder); descNAgentInner = document.createElement('div'); descNAgentHolder.appendChild(descNAgentInner); propDescription = document.createElement('div'); propDescription.className = 'rei-property-description'; let propDesc = ((prop.description != undefined && prop.description != null && prop.description.longSellingDescription != undefined && prop.description.longSellingDescription != null) ? (prop.description.longSellingDescription) : ""); propDesc = propDesc.replace(/\r?\n|\r/g, "
"); let abbrTxt = rei_vitec_niceLimitText(propDesc, 300); propDescription.innerHTML = '

Beskrivning

'+abbrTxt+'

'+(propDesc.length > abbrTxt.length ? '' : ''); if (propDesc.length > abbrTxt.length) propDescription.innerHTML += '

'+propDesc+'

'; descNAgentInner.appendChild(propDescription); let rei_descToggler = document.getElementById("rei-more-desc"); if (rei_descToggler != null) rei_descToggler.addEventListener('click', function(evt) { document.getElementById("rei-long-description").className += " rei-active";document.getElementById("rei-pre-description").className += " rei-hide"; evt.target.style.display = "none"; }) propImages = document.createElement('div'); propImages.className = 'rei-property-images'; propImages.innerHTML = '

Bilder

'; imagesBox = document.createElement('div'); imagesBox.className = 'rei-images'; imagesBox.id = 'rei-images-container'; for (imgNo = 0; imgNo < 10 && imgNo < prop.images.length; imgNo++) { imagesBox.innerHTML += '
'; } propImages.appendChild(imagesBox) propImages.innerHTML += ''; propertyContainer.appendChild(propImages); let els = document.getElementById("rei-images-container").children; for (elNo = 0; elNo < els.length; elNo++) { els.item(elNo).setAttribute("rei-image-no", elNo); els.item(elNo).addEventListener('click', (e) => { let t = e.target; if(t.tagName.toUpperCase() == "IMG") { t = t.parentElement;} rei_vitec_startSlideshow(parseInt(t.getAttribute("rei-image-no"))+1); return false;} ); } document.getElementById("rei-more-imgs").addEventListener('click', () => { rei_vitec_startSlideshow(1); return false;}); propAgents = document.createElement('div'); propAgents.className = 'rei-property-agents'; propAgents.innerHTML = ''; let responsibleUsername = ""; if (prop.assignment != undefined && prop.assignment.responsibleBroker != undefined && prop.assignment.responsibleBroker.userName != undefined && prop.assignment.responsibleBroker.userName != null ) { propAgents.innerHTML += '

Ansvarig mäklare
'+prop.assignment.responsibleBroker.userName+''+ '
'+prop.assignment.responsibleBroker.title+'

'+prop.assignment.responsibleBroker.emailAddress+''+ '
'+(prop.assignment.responsibleBroker.telePhone != null ? (''+prop.assignment.responsibleBroker.telePhone+'') : '') + ((prop.assignment.responsibleBroker.telePhone != null && prop.assignment.responsibleBroker.cellPhone != null) ? ' / ' : '') + (prop.assignment.responsibleBroker.cellPhone != null ? ''+(prop.assignment.responsibleBroker.cellPhone+'') : '')+'

'; responsibleUsername = prop.assignment.responsibleBroker.userName; } if (prop.assignment != undefined && prop.assignment.additionalContact != undefined && prop.assignment.additionalContact.userName != undefined && prop.assignment.additionalContact.userName != null && (prop.assignment.additionalContact.userName != responsibleUsername)) { propAgents.innerHTML += '

Assisterande mäklare
'+prop.assignment.additionalContact.userName+''+ '
'+prop.assignment.additionalContact.title+'

'+prop.assignment.additionalContact.emailAddress+''+ '
'+(prop.assignment.additionalContact.telePhone != null ? (''+prop.assignment.additionalContact.telePhone+'') : '') + ((prop.assignment.additionalContact.telePhone != null && prop.assignment.additionalContact.cellPhone != null) ? ' / ' : '') + (prop.assignment.additionalContact.cellPhone != null ? (''+prop.assignment.additionalContact.cellPhone+'') : '')+'

'; } propAgents.innerHTML += '
'+ ''+ ''+ '
Tipsa någon om
'+rei_marketingTypes[prop.marketedAs]+" i "+prop.baseInformation.address.city+'
' descNAgentInner.appendChild(propAgents); if (rei_vitecapi_hasMap) { propMap = document.createElement('div'); propMap.className = 'rei-property-map'; propMap.innerHTML = '
'+ 'Öppna i Google Maps'; propertyContainer.appendChild(propMap); } propertyContainer.appendChild(propContact); if (rei_vitecapi_hasMap) { // Load Google Map! var script = document.createElement("script") script.type = "text/javascript"; // script.onload = function(){ callback(); }; script.src = "https://maps.googleapis.com/maps/api/js?key=AIzaSyCaSEpkjhPIGzV84UPpAygSfkfE-KNYVTI&callback=rei_vitec_initMap"; document.getElementsByTagName("head")[0].appendChild(script); } propMenuToggler = document.getElementById("rei-property-hamburger"); propMenuToggler.addEventListener('click', function(evt) { rei_togglePropMenu(evt.target); }) let menuDescendants = document.getElementById("rei-property-menu").getElementsByTagName("*"); for (elNo = 0; elNo < menuDescendants.length; elNo++) { if (menuDescendants[elNo].tagName == "A") menuDescendants[elNo].addEventListener('click', function(evt) { rei_togglePropMenu(evt.target); }); } let refnrInput = document.getElementById("rei-form-refnr"); if (refnrInput !== null && prop.baseInformation != undefined && prop.baseInformation.referenceId != undefined && prop.baseInformation.referenceId != null) refnrInput.value = prop.baseInformation.referenceId; let addressInput = document.getElementById("rei-form-address"); if (addressInput !== null && prop.baseInformation.address != undefined && prop.baseInformation.address.city != undefined && prop.baseInformation.address.city != null) addressInput.value = prop.baseInformation.address.city; let linkInput = document.getElementById("rei-form-link"); if (linkInput !== null) linkInput.value = location.href; document.querySelector(".estate-bidding-active").innerHTML = ""; document.querySelector(".estate-partake-bidding").remove(); } var rei_map; function rei_vitec_initMap() { let mapholder = document.getElementById('rei-map-box'); rei_map = new google.maps.Map(mapholder, { center: {lat: parseFloat(mapholder.getAttribute('rei-map-lat')), lng: parseFloat(mapholder.getAttribute('rei-map-lng'))}, zoom: 15, disableDefaultUI: true, styles: [ {"featureType": "all", "stylers": [{ "color": "#f5f5f5" }]}, {"elementType": 'labels.text.fill', "stylers": [{"color": '#9c9c9c'}]}, {"featureType": "poi","stylers": [{ "visibility": "off" }]}, {"featureType": "water","elementType": "geometry", "stylers": [{ "color": "#dadada" }]}, {"featureType": "transit","elementType": "geometry", "stylers": [{ "color": "#cccccc" }]}, { "featureType": "road", "elementType": "geometry", "stylers": [ { "color": "#ffffff" } ] }, { "featureType": 'road', "elementType": 'geometry.stroke', "stylers": [{"color": '#ffffff'}] }, { "featureType": "landscape", "elementType": "labels", "stylers": [ { "visibility": "off" } ] } ] }); console.log("premarker"); console.log({ position: {lat: parseFloat(mapholder.getAttribute('rei-map-lat')), lng: parseFloat(mapholder.getAttribute('rei-map-lng'))}, map: rei_map, icon: '//'+location.href.replace(/^https?:\/\/([^\/]*)\/.*$/, "$1")+'/wp-content/themes/estatefast/assets/images/estate-pin.png', title: '' }); var marker = new google.maps.Marker({ position: {lat: parseFloat(mapholder.getAttribute('rei-map-lat')), lng: parseFloat(mapholder.getAttribute('rei-map-lng'))}, map: rei_map, icon: '//'+location.href.replace(/^https?:\/\/([^\/]*)\/.*$/, "$1")+'/wp-content/themes/estatefast/assets/images/estate-pin.png', title: '' }); console.log("postmarker"); } function rei_has_intval(obj, name) { return (obj[name] != undefined && obj[name] != null && obj[name] != 0); } function rei_has_strval(obj, name) { return (obj[name] != undefined && obj[name] != null && obj[name] != ""); } function rei_vitec_startSlideshow(imgNoToShow) { let slideshowOverlay = document.getElementById("rei-slideshow-overlay"); let currentImg = false; if (slideshowOverlay == null) { // Create slideshow if (typeof rei_vitecapi_property == 'undefined') { console.log("No data"); return;} let imgs = rei_vitecapi_property.images; // console.log(slideshowOverlay.innerHTML); slideshowImagesSlider = document.createElement('div'); slideshowImagesSlider.className = 'rei-slideshow-imagesslider'; slideshowImagelist = document.createElement('div'); slideshowImagelist.className = 'rei-slideshow-imagelist'; slideshowImagelist.setAttribute("id", "rei-slideshow-imagelist"); let onScreen = imgs[0]; for (imgNo = 0; imgNo < imgs.length; imgNo++) { let i = document.createElement('img'); i.setAttribute("src", imgs[imgNo]); i.setAttribute("rei-img-no", imgNo+1); i.addEventListener("click", (e) => { rei_vitecapi_moveto(parseInt(e.target.getAttribute("rei-img-no"))); }); slideshowImagelist.appendChild(i); } slideshowOverlay = document.createElement('div'); slideshowOverlay.setAttribute("id", 'rei-slideshow-overlay'); slideshowOverlay.innerHTML = '

'+imgNoToShow+'/'+imgs.length+'

'; slideshowImagesSlider.appendChild(slideshowImagelist); slideshowOverlay.appendChild(slideshowImagesSlider); document.body.appendChild(slideshowOverlay); document.getElementById("rei-slideshow-next").addEventListener("click", (e) => { let t = e.target; while(!t.tagName.match(/^p$/i)) { t=t.parentElement; } rei_vitecapi_moveto(parseInt(t.getAttribute("rei-next-no"))); return false; }, false); document.getElementById("rei-slideshow-previous").addEventListener("click", (e) => {let t = e.target; while(!t.tagName.match(/^p$/i)) { t=t.parentElement; } rei_vitecapi_moveto(parseInt(t.getAttribute("rei-prev-no"))); return false; }, false); document.getElementById("rei-img-close").addEventListener("click", () => { document.getElementById("rei-slideshow-overlay").className = ""; }); } rei_vitecapi_moveto(imgNoToShow); slideshowOverlay.className = "rei-active"; } function rei_vitecapi_moveto(imageNo) { let imgs = document.getElementById("rei-slideshow-imagelist").children; if (imageNo < 1 || imageNo > imgs.length) return false; let offset = 0; for (imgNo = 0; imgNo < imgs.length; imgNo++) { imgs[imgNo].className = ""; if (imgNo < imageNo-2) offset += 6+imgs[imgNo].getBoundingClientRect().width; } offset = Math.max(0, offset); let onScreen = document.getElementById("rei-onscreen"); onScreen.setAttribute("src", imgs[imageNo-1].getAttribute("src")); imgs[imageNo-1].className = "rei-active"; let counter = document.getElementById("rei-img-counter"); counter.innerHTML = counter.innerHTML.replace(/^([0-9]+)\//, ""+imgs[imageNo-1].getAttribute("rei-img-no")+"/"); document.getElementById("rei-slideshow-next").setAttribute("rei-next-no", imageNo+1); document.getElementById("rei-slideshow-previous").setAttribute("rei-prev-no", imageNo-1); document.getElementById("rei-slideshow-previous").className = (imageNo <= 1) ? "rei-inactive" : ""; document.getElementById("rei-slideshow-next").className = (imageNo > imgs.length) ? "rei-inactive" : ""; if (imageNo <= 1) document.getElementById("rei-slideshow-previous").className = "rei-inactive"; if (imageNo >= imgs.length) document.getElementById("rei-slideshow-next").className = "rei-inactive"; document.getElementById("rei-slideshow-imagelist").style.marginLeft = "-"+offset+"px"; } function estate_insertShortContact() { console.log("Callback"); let propertiesContainer = document.querySelector("#rei-properties-container"); let formContainer = document.querySelector("#rei-insert-in-listings"); if (formContainer != null) propertiesContainer.appendChild(formContainer); } function rei_vitec_priceFormat(price) { price = (""+price).trim(); price = price.replace(/([0-9])([0-9][0-9][0-9])$/, "$1 $2"); while (price.match(/[0-9][0-9][0-9][0-9] /)) { price = price.replace(/([0-9])([0-9][0-9][0-9]) /, "$1 $2 "); } return price; } function rei_vitec_niceLimitText(txt, len) { if (txt.length < 320) return txt; let patt = new RegExp("^(.{300}[^.]*\. )", "gm"); let matches = txt.match(patt); if (matches == null) return txt; if (matches[0] == undefined || matches[0] == null || matches[0].length < 150) return txt; return matches[0]; } function rei_togglePropMenu(elmt) { if (elmt.parentElement == null) return; while (elmt.className.indexOf("rei-property-nav") < 0) { if (elmt.parentElement == null) return; elmt = elmt.parentElement; } for (childNo = 0; childNo < elmt.children.length; childNo++) { if (elmt.children[childNo].className.indexOf("rei-property-menu") >= 0) { elmt = elmt.children[childNo]; break; } } if (elmt.className.indexOf("rei-active") < 0) elmt.className += " rei-active"; else elmt.className = elmt.className.replace("rei-active", "").replace(" ", " "); }