/* --- Tab switching functions --- */ var hasmoved = false; function morphFeatured() { var csection = section; var ss = section.split("-"); if (ss.length > 1) csection = ss[0]; $(csection + '_tab').morph('color: #FFFFFF;background-color: #1e3046;'); $('featured_tab').morph('color: #1e3046;background-color: #FFFFFF;'); new Effect.Fade('pageheader', { duration: 0.5, afterFinish: function() { $('pageheader').innerHTML = "Sold Real Estate - Featured Auctions"; new Effect.Appear('pageheader', { duration: 0.5 }); } }); } function morphBrokerage() { var csection = section; var ss = section.split("-"); if (ss.length > 1) csection = ss[0]; $(csection + '_tab').morph('color: #FFFFFF;background-color: #1e3046;'); $('brokerage_tab').morph('color: #1e3046;background-color: #FFFFFF;'); new Effect.Fade('pageheader', { duration: 0.5, afterFinish: function() { $('pageheader').innerHTML = "Sold Real Estate - Brokerage"; new Effect.Appear('pageheader', { duration: 0.5 }); } }); } function morphForeclosures() { var csection = section; var ss = section.split("-"); if (ss.length > 1) csection = ss[0]; $(csection + '_tab').morph('color: #FFFFFF;background-color: #1e3046;'); $('foreclosures_tab').morph('color: #1e3046;background-color: #FFFFFF;'); new Effect.Fade('pageheader', { duration: 0.5, afterFinish: function() { $('pageheader').innerHTML = "Sold Real Estate - Foreclosures"; new Effect.Appear('pageheader', { duration: 0.5 }); } }); } function switchFeatured() { if (section == "featured") return; morphFeatured(); // Switch to Sold Auctions section = "featured"; reloadProperties(1,"true"); } function switchBrokerage() { if (section == "brokerage") return; morphBrokerage(); // Switch to Sold Brokerage section = "brokerage"; reloadProperties(1,"true"); } function switchForeclosures() { if (section == "foreclosures") return; morphForeclosures(); // Switch to Sold Foreclosures section = "foreclosures"; reloadProperties(1,"true"); } /* -- Page Loading Functions -- */ function reloadProperties(page,isnew) { var perpage = globalperpage; var sort = globalsort; if (isnew == "true") { historyid = parseInt(currenthistoryid) + 1; browserHistory.put(section + "|" + page + "|" + perpage + "|" + globalsort + "|" + historyid); currenthistoryid = historyid; } if (section == "featured") datapage = "__getsoldfeatured.php"; if (section == "brokerage") datapage = "__getsoldbrokerage.php"; if (section == "foreclosures") datapage = "__getsoldforeclosures.php"; busy = true; if (carea == "main") { carea = "scroll"; oarea = "main"; } else { carea = "main"; oarea = "scroll"; } try { $('piccol').style.overflow = "hidden"; } catch (e) { } if (!hasmoved) { $('scontent').setStyle({ height: $('maincontent').getHeight() + "px" }); hasmoved = true; } else $('scontent').setStyle({ height: $('scontent').getHeight() + "px" }); new Ajax.Updater('testarea','http://realestate.alexcooper.com/data/' + datapage + '?area=' + section + '&page=' + page + '&perpage=' + perpage + '&sort=' + sort, { onComplete: function() { $('scontent').style.overflow = "hidden"; new Effect.Morph('scontent', { duration: 0.5, style: 'height: ' + (parseInt($('testarea').getHeight())) + 'px', afterFinish: function() { $(carea + 'content').innerHTML = $('testarea').innerHTML; new Effect.Parallel( [ new Effect.Fade(oarea + 'content', { from: 1.00, to: 0.01 }), new Effect.Appear(carea + 'content', { from: 0.00, to: 1.00 }) ], { duration: 1, afterFinish: function() { $(oarea + 'content').innerHTML = " "; $('scontent').setStyle({ height: "auto" }); $('testarea').innerHTML = ""; busy = false; } }); } }); } }); } function loadFeatured(id) { if (busy == true) return; section = 'featured-details'; historyid = parseInt(currenthistoryid) + 1; browserHistory.put(section + "|" + id + "|" + historyid); currenthistoryid = historyid; handleHistory(section + "|" + id + "|" + historyid); } function loadBrokerage(id) { if (busy == true) return; section = "brokerage-details"; historyid = parseInt(currenthistoryid) + 1; browserHistory.put(section + "|" + id + "|" + historyid); currenthistoryid = historyid; handleHistory(section + "|" + id + "|" + historyid); } function loadForeclosure(id) { if (busy == true) return; section = "foreclosures-details"; historyid = parseInt(currenthistoryid) + 1; browserHistory.put(section + "|" + id + "|" + historyid); currenthistoryid = historyid; handleHistory(section + "|" + id + "|" + historyid); } function loadDetails(page,direction) { if (section == "featured-details") datapage = "__getsoldfeatureddetails.php"; if (section == "brokerage-details") datapage = "__getsoldbrokeragedetails.php"; if (section == "foreclosures-details") datapage = "__getsoldforeclosuredetails.php"; busy = true; if (carea == "main") { carea = "scroll"; oarea = "main"; } else { carea = "main"; oarea = "scroll"; } try { $('piccol').style.overflow = "hidden"; } catch (e) { } if (!hasmoved) { $('scontent').setStyle({ height: $('maincontent').getHeight() + "px" }); hasmoved = true; } else $('scontent').setStyle({ height: $('scontent').getHeight() + "px" }); new Ajax.Updater('testarea','http://realestate.alexcooper.com/data/' + datapage + '?id=' + page, { onComplete: function() { $('scontent').style.overflow = "hidden"; new Effect.Morph('scontent', { duration: 0.5, style: 'height: ' + (parseInt($('testarea').getHeight())) + 'px', afterFinish: function() { window.scrollTo(0, 1); $(carea + 'content').innerHTML = $('testarea').innerHTML; new Effect.Parallel( [ new Effect.Fade(oarea + 'content', { from: 1.00, to: 0.01 }), new Effect.Appear(carea + 'content', { from: 0.00, to: 1.00 }) ], { duration: 1, afterFinish: function() { $(oarea + 'content').innerHTML = " "; $('scontent').setStyle({ height: "auto" }); $('testarea').innerHTML = ""; busy = false; } }); } }); } }); }