version=0; if (navigator.appVersion.indexOf("MSIE")!=-1){ temp=navigator.appVersion.split("MSIE"); version=parseFloat(temp[1]); } function addLoadEvent(func) { var oldonload = window.onload; if (typeof window.onload != 'function') { window.onload = func; } else { window.onload = function() { if (oldonload) { oldonload(); } func(); } } } // preload images function preload() { if (document.images) { preload_image_object = new Image(); var images = new Array(); images.push("/images/SubNav.bottomcap.png"); images.push("/images/SubNav.bg.png"); images.push("/images/SubNav.bg.hover.png"); images.push("/images/InfoWindow-Map.btm.png"); images.push("/images/InfoWindow-Map-Area.btm.png"); images.push("/images/infoWindow.Map-top.png"); images.push("/images/InfoWindow-Map-Area.png"); images.push("/images/InfoWindow-Map.top.png"); images.push("/images/InfoWindow-Map-Area.top.png"); images.push("/images/loading.gif"); for(i=0; i< images.length; i++) { preload_image_object.src = images[i]; } } } // basic functions for general use function rand ( n ) { return ( Math.floor ( Math.random ( ) * n + 1 ) ); } function byte2Hex(n) { var nybHexString = "0123456789ABCDEF"; return String(nybHexString.substr((n >> 4) & 0x0F,1)) + nybHexString.substr(n & 0x0F,1); } function RGB2Color(r,g,b) { return '#' + byte2Hex(r) + byte2Hex(g) + byte2Hex(b); } // function to strip slashes function stripslashes( str ) { return str.replace('/\0/g', '0').replace('/\(.)/g', '$1'); } // function to add commas function addCommas(nStr) { nStr += ''; x = nStr.split('.'); x1 = x[0]; x2 = x.length > 1 ? '.' + x[1] : ''; var rgx = /(\d+)(\d{3})/; while (rgx.test(x1)) { x1 = x1.replace(rgx, '$1' + ',' + '$2'); } return x1 + x2; } function addSelectOption(field,text,value,id,selected) { var elOptNew = document.createElement('option'); elOptNew.text = text; elOptNew.value = value; elOptNew.id = id; if(selected) { elOptNew.selected = selected; } try { document.getElementById(field).add(elOptNew, null); } catch(ex) { document.getElementById(field).add(elOptNew); } } // Feature Property Scroller functions for movement. var Timer = []; function stopScroll() { if(Timer) { for(var i = 0; i < Timer.length; i++) { clearInterval(Timer[i]); } } } function featureScrollLeft() { Timer.push(setInterval("$('FeatureScroller').scrollLeft -= 2", 15)); } function featureScrollRight() { Timer.push(setInterval("$('FeatureScroller').scrollLeft += 2", 15)); } // filter subdivision / city dropdowns function filterDiv(subdiv,formID,CommunityDropdown) { if(subdiv == 'undefined') { var subdiv = false; } if(formID) { var subdivField = formID + "_subdiv"; var id = document.getElementById(formID + "_city").value; } else if(document.getElementById("Content-Residential").style.display != 'none') { var subdivField = "Residential_Search_subdiv"; var id = document.getElementById("Residential_Search_city").value; } else if(document.getElementById("Content-Land").style.display != 'none') { var subdivField = "Land_Search_subdiv"; var id = document.getElementById("Land_Search_city").value; } if(subdiv) { var subdivFields = ['Residential_Search_subdiv','Land_Search_subdiv']; } var opt = { method: 'post', postBody: "id=" + id, onSuccess: function(t) { if(subdiv) { for(var i = 0; i < subdivFields.length; i++) { populateSubdivFields(subdivFields[i],t.responseText,subdiv); } } else { populateSubdivFields(subdivField,t.responseText,'',CommunityDropdown);} if(subdiv) { trackChanges(); } } } if(id != '') { new Ajax.Request('/call/dropdown.php', opt); } else { if(subdiv) { for(var i = 0; i < subdivFields.length; i++) { populateSubdivFields(subdivFields[i],"clear"); } } else { populateSubdivFields(subdivField,"clear"); } } } function populateSubdivFields(subdivField,data,subdiv,CommunityDropdown) { if(data != 'clear') { var fetchedValues = eval(data); } if(fetchedValues && fetchedValues.length > 0) { if(CommunityDropdown!=null) { var LIList = '
  • -- Any --
  • '; for(var si = 0; si < fetchedValues.length;si++) { var selValue = fetchedValues[si]; LIList += '
  • '+selValue.Title+'
  • '; } document.getElementById('Home-Community_Search_community').value = 'Select Community'; document.getElementById('InputCommunity').value= 'Select Community'; document.getElementById(CommunityDropdown).innerHTML = LIList; } else { $(subdivField).length = 0; addSelectOption(subdivField,"-- Any --","","",true) for(var si = 0; si < fetchedValues.length;si++) { var selValue = fetchedValues[si]; if(subdiv && subdiv == selValue.Name) { var selected = true; } else { var selected = false; } addSelectOption(subdivField,selValue.Title,selValue.Name,selValue.ID,selected) } } } else if(data == "clear") { $(subdivField).length = 0; addSelectOption(subdivField,"-- Any --","","",true) } else { $(subdivField).length = 0; addSelectOption(subdivField,"-- None Found --","","",true) } } function switchTab(id) { var e = $('li-' + id).parentNode.childNodes; var liCount = 0; var liCountlength = 0; for (var i = 0; i < e.length; i++) { if(e[i].nodeName == 'LI') { liCountlength++; } } for (var i = 0; i < e.length; i++) { var el = e[i]; if(el.nodeName == 'LI') { if(el.id == "li-" + id) { if(liCount == 0) { var extraClass = " first-child"; } else if(liCount == liCountlength-1) { var extraClass = " last-child"; } else { var extraClass = ""; } } if (el.className == 'SelectedTab' || el.className == "SelectedTab first-child" || el.className == "SelectedTab last-child") { el.className = ''; if(liCount == 0) { el.className = "first"; } var name = el.id.replace("li-",""); $('Content-' + name).style.display = 'none'; } liCount++; } } $('li-' + id).className = 'SelectedTab' + extraClass; $('Content-' + id).style.display = ''; } function getObUpperLeft(obj) { var curLeft = curTop = 0; if (obj.offsetParent) { curLeft = obj.offsetLeft curTop = obj.offsetTop while (obj = obj.offsetParent) { curLeft += obj.offsetLeft curTop += obj.offsetTop } } return [curLeft,curTop]; } function wWidth() { var windowWidth= 0; if( typeof( window.innerWidth ) == 'number' ) { windowWidth = window.innerWidth; } else if( document.documentElement && ( document.documentElement.clientWidth ) ) { windowWidth = document.documentElement.clientWidth; } else if( document.body && ( document.body.clientWidth ) ) { windowWidth = document.body.clientWidth; } return windowWidth; } function wHeight() { var windowHeight = 0; if( typeof( window.innerWidth ) == 'number' ) { windowHeight = window.innerHeight; } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) { windowHeight = document.documentElement.clientHeight; } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) { windowHeight = document.body.clientHeight; } return windowHeight; } function getYOffset() { var pageY; if(typeof(window.pageYOffset)=='number') { pageY=window.pageYOffset; } else { pageY=document.documentElement.scrollTop; } return pageY; } // login & signup screen function to show hide var openScreen = ''; function showScreen(div,id,gray,width,title,message) { if(openScreen) { var div = openScreen; } else { openScreen = div; } if(width) { $(div).setStyle({ 'width': width + "px"}); } if(div) { $(div).cleanWhitespace(); } if(message) { //$(div).insert( {after: 'test'}); MessageElement = new Insertion.After( $(div).firstChild, message ); if( !MessageElement ) { alert('Error with popup. Please contact tg@gallaudet.com'); } } var windowWidth = wWidth(); var divLeft = (windowWidth / 2) - (Element.getWidth(div) / 2); var divTop = (wHeight() / 2) - (Element.getHeight(div) / 2) + getYOffset(); $(div).setStyle({ 'left': divLeft + "px", 'top': divTop + "px", 'display': 'block' }); $('GrayScreen').setStyle({ 'height': '100%', 'top': getYOffset() + "px", 'display': 'block' }); if(document.getElementById(div + "-iFrame")) { var divTag = document.getElementById(div); var iFrameTag = document.getElementById(div + "-iFrame"); iFrameTag.style.left = 0; iFrameTag.style.top = 0; iFrameTag.style.width = Element.getWidth(div); iFrameTag.style.height = Element.getHeight(div); iFrameTag.style.zIndex = divTag.style.zIndex-1; } if(title) { $(div).firstChild.innerHTML=title; } Event.observe(window,'scroll', showScreen); } function hideScreen(div,gray) { document.getElementById(div).style.display = 'none'; var gray = true; if(gray) { document.getElementById("GrayScreen").style.display = 'none'; } Event.stopObserving(window, "scroll", showScreen); openScreen = null; } // signup form validation function echeck(str) { var at="@" var dot="." var lat=str.indexOf(at) var lstr=str.length var ldot=str.indexOf(dot) if (str.indexOf(at)==-1){ return false } if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){ return false } if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){ return false } if (str.indexOf(at,(lat+1))!=-1){ return false } if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){ return false } if (str.indexOf(dot,(lat+2))==-1){ return false } if (str.indexOf(" ")!=-1){ return false } return true } function verifyAccountForm(id,notRequired) { var errors = 0; if ((document.getElementById(id + '-email').value != '' || notRequired != true) && echeck(document.getElementById(id + '-email').value) == false){ addError(id + '-email','Email Address'); errors = 1; } else { removeError(id + '-email'); } if (notRequired != true && document.getElementById(id + '-pass').value == ''){ addError(id + '-pass','Password'); errors = 1; } else if(document.getElementById(id + '-pass').value != '' && document.getElementById(id + '-pass').value.length < 4){ addError(id + '-pass','Password',null,1); errors = 1; } else { removeError(id + '-pass'); } if (document.getElementById(id + '-pass').value != '' && document.getElementById(id + '-verifyPass').value !== document.getElementById(id + '-pass').value){ addError(id + '-verifyPass','Password',1); errors = 1; } else { removeError(id + '-verifyPass','Password'); } if(notRequired != true) { if (document.getElementById(id + '-user').value == ''){ addError(id + '-user','Username'); errors = 1; } else if(document.getElementById(id + '-user').value.length < 3){ addError(id + '-user','Username',null,1); errors = 1; } else { removeError(id + '-user'); } } else { if (document.getElementById(id + '-oldPass').value== '' && document.getElementById(id + '-pass').value != ''){ addError(id + '-oldPass','Password'); errors = 1; } } if(errors == 0) { return true; } else { return false; } } function addError(id,value,passVerify,length) { document.getElementById("Error-" + id).style.display = 'block'; if(passVerify) { var text = "Your passwords do not match."; } else if(length) { var text = value + " must be 3 characters or more."; } else { var text = "Please enter a valid " + value; } Element.update("Error-" + id,text); } function removeError(id) { document.getElementById("Error-" + id).style.display = 'none'; } // function to show hide lists function showHideList(id) { if(document.getElementById(id).style.display != 'none') { document.getElementById(id).style.display = 'none'; Element.update("SH-" + id,"[+]"); } else { document.getElementById(id).style.display = 'block'; Element.update("SH-" + id,"[-]"); } } // Account functions function deleteSearch(id) { var opt = { method: 'post', postBody: "ID=" + id, onSuccess: function(t) { eval(t.responseText); Element.remove("Search-" + id); } } new Ajax.Request('/call/deleteSearch.php', opt); } function deleteProp(id) { var opt = { method: 'post', postBody: "ID=" + id, onSuccess: function(t) { eval(t.responseText); Element.remove("Prop-" + id); } } new Ajax.Request('/call/deleteProperty.php', opt); } // Zestimate API Call function getZestimate() { var street = document.getElementById("zestimate_street").value; var citystatezip = ''; if(document.getElementById("zestimate_city").value != '' && document.getElementById("zestimate_state").value != '') { citystatezip += document.getElementById("zestimate_city").value + ", " + document.getElementById("zestimate_state").value; } if(document.getElementById("zestimate_zip").value != '') { citystatezip += ", " + document.getElementById("zestimate_zip").value; } if(street != '' && citystatezip != '') { var opt = { method: 'post', postBody: "address=" + encodeURI(street) + "&citystatezip=" + encodeURI(citystatezip), asynchronous:true } new Ajax.Updater("ZestimateContent", '/call/getZestimate.php', opt); } else { Element.update("ZestimateContent","You must enter at least an Address & City to search for."); } } // Property List functions function switchPage(ListIdentifier,Page,Direction,Sort,Paginate,Content,ListCount,UpdateResultsNumberText,LoadImages) { if(!Paginate || Paginate == null || Paginate == undefined) { var Paginate = true; } var ListContent = 'ListContent_' + ListIdentifier; var Paginator = 'ListPaginator_' + ListIdentifier; var PaginatorPages = 'Pages_' + ListIdentifier; var PaginatorForm = 'PageList_' + ListIdentifier; var ListSortableHeader = 'PropertyListHead_' + ListIdentifier; var ListPopulated = document.getElementById('PropertyListPopulated_' + ListIdentifier).value; var ListOffset = document.getElementById('PropertyListOffset_' + ListIdentifier).value; var ListResults = document.getElementById('PropertyListResults_' + ListIdentifier).value; var ListPage = document.getElementById('PropertyListPages_' + ListIdentifier).value; var SortBy = document.getElementById('PropertyListSortBy_' + ListIdentifier).value; var Query = document.getElementById('PropertyListQuery_' + ListIdentifier).value; var OrderBy = document.getElementById('PropertyListOrderBy_' + ListIdentifier).value; document.getElementById(ListContent).scrollTop = 0; if(!ListResults) { var ListNumResults = 100; } else { var ListNumResults = ListResults; } var MaximumResultsPerPage = 100; if(ListPopulated == '1') { var ListResult = ''; if(!Page) { Page = 0; } if(Page == 0 && ListResults > MaximumResultsPerPage) { PageBegin = 0; PageLength = MaximumResultsPerPage; } else if(ListResults < 100) { PageBegin = 0; PageLength = ListResults; } else { PageBegin = Page * 100; if((PageBegin + 100) > ListResults) { PageLength = ListResults; } else { PageLength = PageBegin + 100; } } if(Direction) { var PageValue = parseFloat(document.getElementById(PaginatorPages).value); if(Direction == 1) { if((PageValue * MaximumResultsPerPage) > ListResults) { var NewPage = 0; } else { var NewPage = PageValue + 1; } } else if(Direction == 2) { if((PageValue - 1) >= 0) { var NewPage = PageValue - 1; } else { var NewPage = document.getElementById(PaginatorPages).length - 1; } } } else if(ListPopulated == '1' && Page) { var PageValue = Page; if((PageValue * MaximumResultsPerPage) > ListResults) { var select = document.PaginatorForm.page; var NewPage = select.options[select.length - 1].value; } else { NewPage = PageValue; } } document.getElementById('PropertyListPages_' + ListIdentifier).value = NewPage; document.getElementById('PropertyListOffset_' + ListIdentifier).value = NewPage * MaximumResultsPerPage; ListPages = NewPage; ListOffset = NewPage * MaximumResultsPerPage; document.getElementById(PaginatorPages).value = NewPage; } else if(!ListOffset) { ListOffset = '0'; } if(Sort) { document.getElementById('PropertyListPopulated_' + ListIdentifier).value = '0'; document.getElementById('PropertyListSortBy_' + ListIdentifier).value = Sort; if(SortBy == Sort && OrderBy == 'ASC') { var NewOrder = 'DESC'; } else { var NewOrder = 'ASC'; } SortBy = Sort; var sortables = document.getElementById(ListSortableHeader).lastChild.firstChild.childNodes; for(var i = 0; i < sortables.length; i++) { if(sortables[i].nodeName == "TD" && document.getElementById(sortables[i].id).getAttribute('class') == 'Sorted' && sortables[i].id != Sort) { sortables[i].className = ''; } else if(sortables[i].id == Sort) { sortables[i].className = 'Sorted';} } document.getElementById('PropertyListOrderBy_' + ListIdentifier).value = NewOrder; OrderBy = NewOrder; } if(!Content) { Element.update(ListContent,'
    Loading Property Listings...
    '); var opt = { method: 'post', postBody: eval(Query) + "&offset=" + ListOffset + "&numResults=" + ListResults + "&sort=" + SortBy + "&order=" + OrderBy + (LoadImages && LoadImages == true ? '&loadImages=1' : ''), onSuccess: function(t) { if(t.responseText !== "0") { eval(t.responseText); Element.update(ListContent,listings); totalListings = json[0].listResults; document.getElementById('PropertyListResults_' + ListIdentifier).value = json[0].listResults; if(UpdateResultsNumberText) { Element.update(UpdateResultsNumberText,(json[0].listResults > 15 ? 15 : json[0].listResults)); } createPaginator(ListIdentifier,Paginate); if(!LoadImages || LoadImages != true) { loadListImages(); } } } } new Ajax.Request('/call/getData.php', opt); } else { Element.update(ListContent,Content); document.getElementById('PropertyListResults_' + ListIdentifier).value = ListCount; totalListings = ListCount; createPaginator(ListIdentifier,Paginate); if(!LoadImages || LoadImages != true) { loadListImages(); } } } function createPaginator(ListIdentifier,Paginate) { var ListContent = 'ListContent_' + ListIdentifier; var Paginator = 'ListPaginator_' + ListIdentifier; var PaginatorPages = 'Pages_' + ListIdentifier; var PaginatorForm = 'PageList_' + ListIdentifier; var ListSortableHeader = 'PropertyListHead_' + ListIdentifier; var ListPopulated = document.getElementById('PropertyListPopulated_' + ListIdentifier).value; var ListOffset = document.getElementById('PropertyListOffset_' + ListIdentifier).value; var ListResults = document.getElementById('PropertyListResults_' + ListIdentifier).value; var ListPage = document.getElementById('PropertyListPages_' + ListIdentifier).value; var MaximumResultsPerPage = 100; if(Paginate != false) { if(ListPopulated == '0' || !ListPopulated) { document.getElementById('PropertyListPopulated_' + ListIdentifier).value = '1'; if(ListResults > MaximumResultsPerPage) { // show paginator divs document.getElementById(Paginator).style.display = ''; // remove all pages document.getElementById(PaginatorPages).length = 0; var MaximumResultsPerPage = 100; var NumberPages = Math.ceil(ListResults / MaximumResultsPerPage); // addSelectOption(PaginatorPages,'Show 0 - ' + MaximumResultsPerPage,'0'); var CurrOffset = 0; var NextOffset = 0; for(var np = 0; np < NumberPages; np++) { CurrOffset = np * MaximumResultsPerPage; NextOffset = (np + 1) * MaximumResultsPerPage; if(NextOffset > ListResults) { NextOffset = ListResults; } if(CurrOffset < ListResults) { addSelectOption(PaginatorPages,'Show ' + CurrOffset + ' - ' + NextOffset,np,(np == 0 ? true : false)); } } } } if(ListResults > MaximumResultsPerPage) { document.getElementById(Paginator).style.display = ''; } else { document.getElementById(Paginator).style.display = 'none';} } else { document.getElementById(Paginator).style.display = 'none'; } } function showPropertyNotes(id) { showScreen('PropertyNotesScreen'); for(var i = 0; i < propertyComments.length; i++) { if(propertyComments[i].PropertyID == id) { document.getElementById('PropertyNotesTitle').innerHTML = propertyComments[i].StreetAddress + "
    " + propertyComments[i].City + ", " + propertyComments[i].ZipCode; document.getElementById('PropertyNotesImage').src = propertyComments[i].ImageURL; if(propertyComments[i].Notes.length > 0) { var PropertyNote = ''; for(var ci = 0; ci < propertyComments[i].Notes.length; ci++) { var Note = propertyComments[i].Notes[ci]; PropertyNote += '
    '; PropertyNote += '
    ' + Note.Message + '<\/div>'; PropertyNote += '
    '; PropertyNote += '
    ' + Note.Date + '- ' + Note.Time + (Note.Name != '' ? ' by ' + Note.Name + (Note.Agent == true ? ' (agent)<\/font>' : '') : '') + '<\/div>'; if(!Note.Agent && !Note.Guest) { PropertyNote += '
    delete<\/a><\/div>'; } PropertyNote += '<\/div>'; PropertyNote += '<\/div>'; } Element.update("PropertyNotes",'
    ' + PropertyNote + '<\/div>'); } break; } } } function deletePropertyComment(id,propID,PropertyArrayID,PropertyNoteArrayID) { var opt = { method: 'post', postBody: "ID=" + id, onSuccess: function(t) { eval(t.responseText); Element.remove("Comment-" + id); } } new Ajax.Request('/call/deletePropertyComment.php', opt); if(PropertyArrayID && PropertyNoteArrayID && propertyComments) { var tempArray = []; for(var i = 0; i < propertyComments[PropertyArrayID].Notes.length; i++) { var Note = propertyComments[PropertyArrayID].Notes[i]; if(Note.CommentID != id) { tempArray.push(Note); } } propertyComments[PropertyArrayID].Notes = tempArray; } } function showDropdownMenu(id) { if(version == 6 && !document.getElementById(id + "-iFrame") && document.getElementById("Dropdown-" + id)) { var menu = document.getElementById("Navigation-" + id); var menuiFrame = document.createElement("iframe"); menuiFrame.setAttribute("id",id + "-iFrame"); menuiFrame.setAttribute("class","iFrameCover"); menuiFrame.setAttribute("scrolling","no"); menuiFrame.setAttribute("src","about:blank"); menuiFrame.style.position = "absolute"; menuiFrame.style.left = 0; menuiFrame.style.top = Element.getHeight('Navigation'); menuiFrame.style.width = Element.getWidth("Dropdown-" + id); menuiFrame.style.height = Element.getHeight("Dropdown-" + id) -3; menuiFrame.style.zIndex = menu.style.zIndex-1; menu.insertBefore(menuiFrame,document.getElementById("Dropdown-" + id)); } else if(document.getElementById(id + "-iFrame")) { var menuiFrame = document.getElementById(id + "-iFrame"); menuiFrame.style.display = 'block'; } } function hideDropdownMenu(id) { if(version == 6 && document.getElementById(id + "-iFrame")) { var menuiFrame = document.getElementById(id + "-iFrame"); menuiFrame.style.display = "none"; } } // add onload events addLoadEvent(preload); if(document.getElementById('PropertySlideshow')) { addLoadEvent(populateFeatureProperties); } addLoadEvent(function() { if(document.getElementById("Residential_Search") && document.getElementById("Residential_Search")) { if(isMap) { Event.observe("Residential_Search", "change", clearValues); if(document.getElementById("Residential_Search_subdiv")) { Event.observe("Residential_Search_subdiv", "change", resetPolygonSnap); } if(document.getElementById("Residential_AdditionalOptions")) { Event.observe("Residential_AdditionalOptions", "change", loadSearchOption); } if(document.getElementById("Residential_SavedSearch")) { Event.observe("Residential_SavedSearch", "change", updateSavedSearch); } } if(document.getElementById("Residential_Search_city")) { if(isMap) { Event.observe("Residential_Search_city", "change", resetPolygonSnap); } Event.observe("Residential_Search_city", "change", function() { if(isMap) { filterDiv(null,"Residential_Search"); } else { filterDiv(); } }); } } if(document.getElementById("Land_Search") && document.getElementById("Land_Search")) { if(isMap) { Event.observe("Land_Search", "change", clearValues); if(document.getElementById("Land_Search_subdiv")) { Event.observe("Land_Search_subdiv", "change", resetPolygonSnap); } if(document.getElementById("Land_AdditionalOptions")) { Event.observe("Land_AdditionalOptions", "change", loadSearchOption); } if(document.getElementById("Land_SavedSearch")) { Event.observe("Land_SavedSearch", "change", updateSavedSearch); } } if(document.getElementById("Land_Search_city")) { if(isMap) { Event.observe("Land_Search_city", "change", resetPolygonSnap); } Event.observe("Land_Search_city", "change", function() { if(isMap) { filterDiv(null,"Land_Search"); } else { filterDiv(); } }); } } if(document.getElementById("Home-Community_Search_city")) { Event.observe("Home-Community_Search_city", "change", function() { filterDiv(null,'Home-Community_Search'); }); } });