var hasmoved = false; /* --- Tab switching functions --- */ function morphActive() { var csection = section; var ss = section.split("-"); if (ss.length > 1) csection = ss[0]; $(csection + '_tab').morph('color: #FFFFFF;background-color: #1e3046;'); $('active_tab').morph('color: #1e3046;background-color: #FFFFFF;'); new Effect.Fade('pageheader', { duration: 0.5, afterFinish: function() { $('pageheader').innerHTML = "Active Brokerage"; new Effect.Appear('pageheader', { duration: 0.5 }); } }); } function morphUnder() { var csection = section; var ss = section.split("-"); if (ss.length > 1) csection = ss[0]; $(csection + '_tab').morph('color: #FFFFFF;background-color: #1e3046;'); $('under_tab').morph('color: #1e3046;background-color: #FFFFFF;'); new Effect.Fade('pageheader', { duration: 0.5, afterFinish: function() { $('pageheader').innerHTML = "Brokerage Under Contract"; new Effect.Appear('pageheader', { duration: 0.5 }); } }); } function morphSold() { var csection = section; var ss = section.split("-"); if (ss.length > 1) csection = ss[0]; $(csection + '_tab').morph('color: #FFFFFF;background-color: #1e3046;'); $('sold_tab').morph('color: #1e3046;background-color: #FFFFFF;'); new Effect.Fade('pageheader', { duration: 0.5, afterFinish: function() { $('pageheader').innerHTML = "Sold Brokerage"; new Effect.Appear('pageheader', { duration: 0.5 }); } }); } function switchActive() { if (section == "active") return; morphActive(); // Switch to Active Brokerage Here section = "active"; reloadProperties(1,"left","true"); } function switchUnder() { if (section == "under") return; morphUnder(); // Switch to Under Contract Here section = "under"; reloadProperties(1,"left","true"); } function switchSold() { if (section == "sold") return; morphSold(); // Switch to Sold Here section = "sold"; reloadProperties(1,"left","true"); } /* Page Loading Functions */ function reloadProperties(page,direction,isnew) { var perpage = globalperpage; if (isnew == "true") { historyid = parseInt(currenthistoryid) + 1; browserHistory.put(section + "|" + page + "|" + perpage + "|" + historyid); currenthistoryid = historyid; } if (section == "active" || section == "under") datapage = "__getbrokerage.php"; if (section == "sold") datapage = "__getsoldbrokerage.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, { evalScripts: true, onComplete: function() { $('scontent').style.overflow = "hidden"; new Effect.Morph('scontent', { duration: 0.5, style: 'height: ' + $('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 loadBrokerage(id) { if (busy == true) return; if (section == "active") section = "active-details"; if (section == "under") section = "under-details"; if (section == "sold") section = "sold-details"; historyid = parseInt(currenthistoryid) + 1; browserHistory.put(section + "|" + id + "|" + historyid); currenthistoryid = historyid; handleHistory(section + "|" + id + "|" + historyid); } function loadSold(id) { if (busy == true) return; section = "sold-details"; historyid = parseInt(currenthistoryid) + 1; browserHistory.put(section + "|" + id + "|" + historyid); currenthistoryid = historyid; handleHistory(section + "|" + id + "|" + historyid); } function loadDetails(page,direction) { if (section == "active-details" || section == "under-details") datapage = "__getbrokeragedetails.php"; if (section == "sold-details") datapage = "__getsoldbrokeragedetails.php"; busy = true; if (carea == "main") { carea = "scroll"; oarea = "main"; } else { carea = "main"; oarea = "scroll"; } 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, { evalScripts: true, onComplete: function() { $('scontent').style.overflow = "hidden"; new Effect.Morph('scontent', { duration: 0.5, style: 'height: ' + $('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; } }); } }); } }); }