var orderBy = "price"; var orderDir = "DESC"; var currentPage = 1; var listing_source = ""; var selected_home_features= ""; var selected_comm_features= ""; var img_arr; function Listing(property_id,agent_id){ this.property_id = property_id; this.agent_id = agent_id; this.city = ""; this.neighborhood = ""; this.subdivision = ""; this.prop_type = ""; this.bedroom = ""; this.bathroom = ""; this.garage = ""; this.footage = ""; this.pool = ""; this.spa = ""; this.price = ""; this.brokerlogo_sm = ""; this.listing_photo = ""; this.keyword = ""; this.title = ""; this.all_photos = ""; this.clear_data = function() { this.property_id = ""; this.agent_id = ""; this.city = ""; this.neighborhood = ""; this.subdivision = ""; this.prop_type = ""; this.bedroom = ""; this.bathroom = ""; this.garage = ""; this.footage = ""; this.pool = ""; this.spa = ""; this.price = ""; this.brokerlogo_sm = ""; this.listing_photo = ""; this.keyword = ""; } this.copy_data = function(obj) { this.property_id = obj.property_id; this.agent_id = obj.agent_id; this.city = obj.city; this.neighborhood = obj.neighborhood; this.subdivision = obj.subdivision; this.prop_type = obj.prop_type; this.bedroom = obj.bedroom; this.bathroom = obj.bathroom; this.garage = obj.garage; this.footage = obj.footage; this.pool = obj.pool; this.spa = obj.spa; this.price = obj.price; this.brokerlogo_sm = obj.brokerlogo_sm; this.listing_photo = obj.listing_photo; this.keyword = obj.keyword; } } var listingArrayIndex = 0; var listingArray = new Array(10); for(var i=0; i<11; i++) { listingArray[i] = new Listing("",""); } var seletedListingArrayIndex = 0; var selectedListingArray = new Array(20); for(var i=0; i<20; i++) { selectedListingArray[i] = new Listing("",""); } function ImageLoadFailed(obj) { obj.src = "http://www.househunt.org/images/no-photo-01.jpg"; //window.event.srcElement.style.display = "None"; } function resize_logo() { if(img_brokerlogo.height>80) img_brokerlogo.height = 80; } function getStyleObject(objectId) { // checkW3C DOM, then MSIE 4, then NN 4. // if(document.getElementById && document.getElementById(objectId)) { return document.getElementById(objectId).style; } else if (document.all && document.all(objectId)) { return document.all(objectId).style; } else if (document.layers && document.layers[objectId]) { return document.layers[objectId]; } else { return false; } } function genSearchOption(home_feature,comm_feature) { var sch_opt_content = ''; sch_opt_content += ''; if(home_feature != "--") { sch_opt_content += ''; sch_opt_content += ''; var arr_home_feature = home_feature.split(","); cnt_cell =0; for(var i = 0; i < arr_home_feature.length; i++){ if(home_feat[arr_home_feature[i]] == undefined) continue; if(cnt_cell==0) sch_opt_content += '\n' ; cnt_cell++; sch_opt_content += ''; if(cnt_cell==5) cnt_cell=0 ; } sch_opt_content += '\n'; } sch_opt_content += ''; if(comm_feature != "--") { sch_opt_content += ''; sch_opt_content += ''; var arr_comm_feature = comm_feature.split(","); cnt_cell =0; for(var i = 0; i < arr_comm_feature.length; i++){ if(comm_feat[arr_comm_feature[i]] == undefined) continue; if(cnt_cell==0) sch_opt_content += '\n' ; cnt_cell++; sch_opt_content += ''; if(cnt_cell==5) cnt_cell=0 ; } sch_opt_content += '\n'; } sch_opt_content += ''; sch_opt_content += '
Home Features
=0) sch_opt_content += ' CHECKED '; sch_opt_content += '>' + home_feat[arr_home_feature[i]]+'
Community Features
=0) sch_opt_content += ' CHECKED '; sch_opt_content += '>' + comm_feat[arr_comm_feature[i]]+'
'; document.getElementById("search_option2").innerHTML = sch_opt_content; } function setOrder(str) { //alert(str); var order_str = str.split(" "); orderBy = order_str[0]; orderDir = order_str[1]; goToPage(currentPage); } function setOrderBy(str) { if(orderBy != str) { orderBy = str; } else { if(orderDir == 'ASC') orderDir = 'DESC'; else orderDir = 'ASC'; } goToPage(currentPage); } function genListingHeader(str) { var list_rec= str.split("\t"); var listingTemplate; getStyleObject('listing_header').visibility = 'visible'; listingTemplate = ''+ ''+ ''+ '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '
Unique Prop.'+list_rec[4]+''+list_rec[19]+' / '+list_rec[20]+''+list_rec[5]+''+list_rec[6]+''+list_rec[7]+''+list_rec[8]+''+list_rec[9]+''+list_rec[12]+''+list_rec[13]+'
'; listingTemplate += ''; listingTemplate += ''; return listingTemplate; } function genListingRow(i,obj) { var listingRow = '
'+ '' + '' + '' + '' + ''+ '' + '' + '' + '' + '' + '' + '' + '
'+ '' + '
'+ '' + '
'+obj.keyword+''+obj.city+''+obj.neighborhood+' / '+obj.subdivision+''+obj.prop_type+''+obj.bedroom +''+obj.bathroom+''+obj.garage+''+obj.footage+''+obj.price+''+obj.brokerlogo_sm+'
'; return listingRow; } function genFeatureListingRow(i,obj) { var arrPhotos = obj.all_photos.split(","); var marqueePhotos = ""; // for(var k = 0; k < arrPhotos.length; k++) { // marqueePhotos = marqueePhotos +''; // } // if(k>1) { // marqueePhotos = ''+marqueePhotos+''; // } else { marqueePhotos = ''; // } var listingRow = '
'+ ''+ ''+ '' + '' + //'' + '' + '' + '' + //'' + '' + '' + ''+ //'' + '
'+ '' + '
'+ marqueePhotos + '
Featured "'+obj.keyword+'" Property
'+obj.title+'
' + ''+ '' + ''+ '' + '' + '' + '' + '' + '' + '' + '
'+obj.city+''+obj.neighborhood+' / '+obj.subdivision+''+obj.prop_type+''+obj.bedroom +''+obj.bathroom+''+obj.garage+''+obj.footage+''+obj.price+''+obj.brokerlogo_sm+'
' + '
'; return listingRow; } function toggleAddListing(i,chkbox) { var cnt=0; var is_removed = false; var myobj; if(document.all) { chkbox_obj = document.all['prop_chkbox'+i]; row_obj = document.all['prop_row'+i]; } else { chkbox_obj = document.getElementById('prop_chkbox'+i); row_obj = document.getElementById('prop_row'+i); } if(chkbox==0) { if(chkbox_obj.checked) chkbox_obj.checked=false; else chkbox_obj.checked=true; return; } if(chkbox_obj.checked) { chkbox_obj.checked = false; row_obj.style.backgroundColor = rowColor; removeListing(listingArray[i].property_id, listingArray[i].agent_id); } else { if(addListing(listingArray[i])== 1) { chkbox_obj.checked = true; row_obj.style.backgroundColor = rowHiColor; } } } function addListing(obj) { if(seletedListingArrayIndex>=maxSelected) { alert("You have reached the limit of " + maxSelected+ " selections.\n\nPlease complete the form below, in order to view detials of selected properties."); return 0; } selectedListingArray[seletedListingArrayIndex].copy_data(obj); seletedListingArrayIndex++; isListingRemove = false; updateListing(); return 1; } function removeListing(property_id,agent_id) { //alert(property_id+','+agent_id); var removedListingIndex = 100; for(var j=0; j0) mn_slistings += ','; mn_slistings += selectedListingArray[i].agent_id+':'+selectedListingArray[i].property_id; //showSelectedListing(i); } if(isListingRemove) selectedListingArray[seletedListingArrayIndex].clear_data; document.frm_visitor.mn_slistings.value = mn_slistings; if (document.all){ // IE CODE objCount = document.getElementById('listing_count'); objCount.innerText = "Please Fill Out the Above Form to View Details of Your Selected " + seletedListingArrayIndex + " Listing(s)."; }else{ // MOZILLA & NETSCAPE CODE document.getElementById("listing_count").childNodes[0].nodeValue = "Please Fill Out the Above Form to View Details of Your Selected " + seletedListingArrayIndex + " Listing(s)."; } //alert(document.frm_visitor.mn_slistings.value); } function updateSelectedRows() { for (i=0; i-1) { document.getElementById("prop_chkbox"+i).checked = true; document.getElementById("prop_row"+i).style.backgroundColor = rowHiColor; } else { document.getElementById("prop_chkbox"+i).checked = false; document.getElementById("prop_row"+i).style.backgroundColor = rowColor; } } } function clearSelection() { for(var i=0; i' + ''+ '' + '' + '
'+selectedListingArray[i].city+''+selectedListingArray[i].price+'
'+ ''+ '' + ''+ '
'+selectedListingArray[i].bedroom+' bd, '+selectedListingArray[i].bathroom+' ba, '+selectedListingArray[i].footage+' sfremove
' + ''; } function showPhoto(n) { var prop_wininfo = '
' + '
' + ''+ ''+ '' + '' + ''+ ''+ '' + ''+ ''+ '
'+listingArray[n].city+''+listingArray[n].price+'
'+listingArray[n].bedroom+' beds, '+listingArray[n].bathroom+' baths, '+listingArray[n].footage+' sqft
'; document.getElementById("popup_photo").innerHTML = prop_wininfo; if(document.body.clientWidth) { var winW = document.body.clientWidth; var winH = document.body.clientHeight; winW = parseInt(winW)/2 - 160; getStyleObject('popup_photo').left = winW+'px'; } getStyleObject('popup_photo').top = '300'; getStyleObject('popup_photo').visibility = 'visible'; } function hidePhoto() { getStyleObject('popup_photo').visibility = 'hidden'; } function m_over(obj,i) { obj.style.border = '#FF9900 1px solid'; } function m_leave(obj,i) { obj.style.border = '#ffffff 1px solid'; } function showFeatureListing() { if(hasFeatureListing && showFeatureListingWindow) { img_arr = featureListing.all_photos.split(","); var prop_wininfo = '
' + ''+ '
Featured \''+uniqueProperty+'\' PropertyX
'+ '
' + '' if(img_arr.length>1) { prop_wininfo = prop_wininfo + ''+ ''+ '' } prop_wininfo = prop_wininfo + ''+ '' + '' + ''+ ''+ '' + ''+ ''+ ''+ '' + ''+ '
'+ 'previous  '+ '    out of '+ img_arr.length + '      next'+ '
'+featureListing.address+', '+featureListing.city+', '+featureListing.state+''+featureListing.price+'
'+featureListing.bedroom+' beds, '+featureListing.bathroom+' baths, '+featureListing.footage+' sqft
'+featureListing.description+'
'; if(totalListings>1) { prop_wininfo += ''+ '
'+ 'There are '+(totalListings-1)+' more "'+uniqueProperty+'" properties found in this area. At the top of this screen, you can change search critetia to meet your needs, and click the button, "Search".' + '
'+ 'To view details of more properties, please check off the boxes next to thumbnail photos of other listings to be selected on this screen, and click "View Details of Selected Properties with Photos"
' + '
'; } else { prop_wininfo += '
'+ 'Please check off box(es) next to thumbnail photos and click "View Details of Selected Properties with Photos".
' + '
'; } prop_wininfo += '
'+ 'close window' + '
'; prop_wininfo += '
'; document.getElementById("popup_featured").innerHTML = prop_wininfo; if(document.body.clientWidth) { var winW = document.body.clientWidth; var winH = document.body.clientHeight; winW = parseInt(winW)/2 - 190; getStyleObject('popup_featured').left = winW+'px'; getStyleObject('popup_featured').top = '200'; } getStyleObject('popup_featured').visibility = 'visible'; showFeatureListingWindow = false; } } function hideFeatureListing() { getStyleObject('popup_featured').visibility = 'hidden'; } function showPageNav(num_records,rec_no) { var page_no=0; var page_nav_html = ""; var max_nav = 11; var page_max = 0; var page_list = new Array("","","","","","","","","","","","","","",""); var mid_pos = (max_nav+1)/2; page_no = (rec_no/10)+1; page_max = Math.ceil(num_records/10); document.getElementById("total_listings").innerHTML = 'Your search found '+ num_records +' homes'; if(page_maxmax_nav) { page_list[max_nav-2] = '...'; page_list[max_nav-1] = createPageLnk(page_max,1); } if(page_no>=6) { page_list[0] = createPageLnk(1,1); page_list[1] = '...'; for(i=2; i= (page_max-4) && page_max>max_nav) { for(i=max_nav; i>1; i--) { var page_idx = page_max-max_nav+i; if(page_no == page_idx) { page_list[i-1] = createPageLnk(page_idx,0); } else { page_list[i-1] = createPageLnk(page_idx,1); } } page_list[1] = '...'; } for(var i=0; i1) { previous_page = ' « Previous   '; } var next_page = ""; if(page_no Next » '; } page_nav_html = previous_page + page_nav_html + next_page; document.getElementById("page_number").innerHTML = 'Page '+ currentPage + ' of '+ page_max + '   ' +previous_page + next_page; document.getElementById("page_nav_bot").innerHTML = page_nav_html; getStyleObject('top_listing_header').visibility = 'visible'; getStyleObject('page_nav_bot').visibility = 'visible'; } function createPageLnk(page_no,status) { var page_lnk = ""; if(status == 1) { page_lnk = ''+page_no+''; } else { page_lnk = '' + page_no + ''; } return page_lnk; } function handleHttpResponse() { if (http.readyState == 4) { var keyword = ""; hideLoadingMsg() totalListings = parseInt(http.responseXML.getElementsByTagName("listing_summary")[0].getAttribute("num_records")); if(totalListings==0 && hasFeatureListing) totalListings = 1; showPageNav(totalListings,parseInt(http.responseXML.getElementsByTagName("listing_summary")[0].getAttribute("rec_no"))); //document.getElementById('debug2').innerText = http.responseXML.getElementsByTagName("debug")[0].getAttribute("sql"); //alert(http.responseXML.getElementsByTagName("debug")[0].getAttribute("sql")); column_header = http.responseXML.getElementsByTagName("column_header"); listings = http.responseXML.getElementsByTagName("listing"); var cur_listing_source = http.responseXML.getElementsByTagName("listing_source")[0].firstChild.data if(listing_source != cur_listing_source && cur_listing_source !="--") { listing_source = cur_listing_source; document.getElementById("disclaimer").innerHTML = http.responseXML.getElementsByTagName("disclaimer")[0].firstChild.data; genSearchOption(http.responseXML.getElementsByTagName("home_feature")[0].firstChild.data,http.responseXML.getElementsByTagName("comm_feature")[0].firstChild.data); } if(listings.length>0 || hasFeatureListing) { var listing_content= ''; document.getElementById("listing_header").innerHTML = genListingHeader(column_header[0].firstChild.data); var listingIndex =0; keyword = document.searchform.keyword[document.searchform.keyword.selectedIndex].value; if(currentPage==1) { if(hasFeatureListing) { var uniquePropertyWithQuote = ''; if(uniqueProperty != '') uniquePropertyWithQuote = '"' + uniqueProperty + '"'; //listing_content = '
  Featured '+uniquePropertyWithQuote+' Property
'; listing_content = ''; listingArray[listingIndex].copy_data(featureListing); //listingRow = genFeatureListingRow(listingIndex,listingArray[listingIndex]); listingRow = genFeatureListingRow(listingIndex,featureListing); listing_content += listingRow; listingIndex++; if(uniqueProperty != '') { //alert(keyword); if(listings.length>0) { if(uniqueProperty == keyword) { //alert(listings.length); if(listings.length>1) listing_content += '
  More result on "'+keyword+'" Properties
'; } else { listing_content += '
  Search result on "'+keyword+'" Properties
'; } } else { listing_content += '
  No listing found for "'+keyword+'" Properties
'; } } else { if(listings.length>0) { listing_content += '
  Search result from your search criteria above
'; } else { listing_content += '
  No listing found from your search criteria
'; } } } } for (var i = 0; i < listings.length; i++) { var list_rec= listings[i].firstChild.data.split("\t"); if(hasFeatureListing) { if(featureListing.agent_id==list_rec[2] && featureListing.property_id==list_rec[1]) continue; } listingArray[listingIndex].property_id = list_rec[1]; listingArray[listingIndex].agent_id = list_rec[2]; listingArray[listingIndex].city = list_rec[4]; listingArray[listingIndex].neighborhood = list_rec[19]; listingArray[listingIndex].subdivision = list_rec[20]; listingArray[listingIndex].prop_type = list_rec[5]; listingArray[listingIndex].bedroom = list_rec[6]; listingArray[listingIndex].bathroom = list_rec[7]; listingArray[listingIndex].garage = list_rec[8]; listingArray[listingIndex].footage = list_rec[9]; listingArray[listingIndex].pool = list_rec[10]; listingArray[listingIndex].spa = list_rec[11]; listingArray[listingIndex].price = list_rec[12]; listingArray[listingIndex].brokerlogo_sm = list_rec[13]; listingArray[listingIndex].listing_photo = list_rec[3]; listingArray[listingIndex].keyword = keyword; if(!listingArray[listingIndex].neighborhood) listingArray[listingIndex].neighborhood = '-'; if(!listingArray[listingIndex].subdivision) listingArray[listingIndex].subdivision = '-'; listingRow = genListingRow(listingIndex,listingArray[listingIndex]); listing_content += listingRow; listingIndex++; } totalListingsCurPage = listingIndex; document.getElementById("listing_content").innerHTML = listing_content; updateListing(); updateSelectedRows(); showFeatureListing(); } else { getStyleObject('top_listing_header').visibility = 'hidden'; getStyleObject('listing_header').visibility = 'hidden'; getStyleObject('page_nav_bot').visibility = 'hidden'; document.getElementById("listing_content").innerHTML = '
'+ '

No properties found. Please change your criteria.


'+ 'Even though no properties matched my criteria,'+ '
'+ 'please send listings on homes/condos in the surrounding areas.

'+ ' '+ 'Yes, I am entering my information below.    Thank you!'+ '


'+ '
'; } isNewSearch = false; } } function readData(url) { http.open("GET", url, true); http.onreadystatechange = handleHttpResponse; http.send(null); } function goToPage(page_no) { showLoadingMsg(); currentPage = page_no; var rec_no = (page_no-1)*10; //document.getElementById('debug1').innerText = query_url + '&rec=' + rec_no; if(isNewSearch) { readData(query_url + '&rec=' + rec_no + '&order_by='+ orderBy + '&order_dir='+ orderDir); //document.getElementById('debug2').innerText = query_url + '&rec=' + rec_no + '&order_by='+ orderBy + '&order_dir='+ orderDir; } else { readData(query_url + '&rec=' + rec_no + '&cnt_recs=' +totalListings + '&order_by='+ orderBy + '&order_dir='+ orderDir); //document.getElementById('debug2').innerText = query_url + '&rec=' + rec_no + '&cnt_recs=' +totalListings + '&order_by='+ orderBy + '&order_dir='+ orderDir; } } function showLoadingMsg() { if(document.body.clientWidth) { var winW = document.body.clientWidth; var winH = document.body.clientHeight; winW = parseInt(winW*0.4); getStyleObject('loader_msg').width = winW+'px'; } getStyleObject('loader_msg').visibility = 'visible'; } function hideLoadingMsg() { getStyleObject('loader_msg').visibility = 'hidden'; } function submitSearch() { showLoadingMsg(); isNewSearch = true; selected_home_features = ''; if(document.searchform.home_feature != null) { for(var i=0; is function doSwap() { if(c == 'vis'){ c = 'invis' document.getElementById('search_option_lnk').innerHTML = '» Show More Search Options'; } else { c = 'vis'; document.getElementById('search_option_lnk').innerHTML = '« Hide More Search Options'; } //c == 'vis' ? c = 'invis' : c = 'vis'; document.getElementById('search_option').className = c; } function showAllCities() { var otherCitiesUrl = 'http://www.househunt.org/cgi-bin/househunt/ultimate_search_popup.cgi?' +'&terr_d='+ document.searchform.terr_d.value +'&st='+ document.searchform.state.value +'&keyword='+ document.searchform.keyword.value +'&bedroom1=' + document.searchform.bedroom1.value +'&bathroom1=' + document.searchform.bathroom1.value +'&price_min=' + document.searchform.price1.value +'&price_max=' + document.searchform.price2.value +'&tmp=34'; var ulWin = window.open(otherCitiesUrl, 'HH_UltimateSearch','toolbar=no,scrollbars=yes,status=yes,resizable=yes,width=500,height=320') if (ulWin != null) ulWin.focus(); } function init() { showLoadingMsg(); submitSearch(); } function newSearch() { if(c == 'vis'){ self.location='#ol_result'; } if(document.searchform.state.value == agentState) { var arrAgentTerritories = agentTerritories.split(","); for(var i = 0; i < arrAgentTerritories.length; i++) { if(arrAgentTerritories[i] == document.searchform.terr_d.value) { isAgentTerr = true; break; } } } submitSearch(); } function checkForm() { if(totalListings>0 && document.frm_visitor.mn_slistings.value == '') { alert('Plase select at least one property.'); return false; } else { return true; } } function show_user_agreement(listing_source) { if(checkForm()) { var accept=true; confirmWin=open('http://househunt.org/user_agreement/'+listing_source+'.html','confirmWindow','scrollbars=yes,toolbar=no,location=no'); confirmWin.focus(); return accept; } else { return false; } } var current=1; function next() { //alert(img_arr.length); if (current < img_arr.length) { //alert(current); document.images.propimg.src = img_arr[current]; current++; document.getElementById("img_idx").innerHTML = current; } else first(); } function previous() { //alert(current); if (current-1 > 0) { document.images.propimg.src = img_arr[current-2]; current--; document.getElementById("img_idx").innerHTML = current; } else last(); } function first() { current = 1; document.images.propimg.src = img_arr[0]; document.getElementById("img_idx").innerHTML = 1; } function last() { current = img_arr.length; document.images.propimg.src = img_arr[current-1]; document.getElementById("img_idx").innerHTML = current; }