function opacity(id, opacStart, opacEnd, millisec) { //speed for each frame var speed = Math.round(millisec / 100); var timer = 0; //determine the direction for the blending, if start and end are the same nothing happens if(opacStart > opacEnd) { for(i = opacStart; i >= opacEnd; i--) { setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed)); timer++; } } else if(opacStart < opacEnd) { for(i = opacStart; i <= opacEnd; i++) { setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed)); timer++; } } } //change the opacity for different browsers function changeOpac(opacity, id) { var object = document.getElementById(id).style; object.opacity = (opacity / 100); object.MozOpacity = (opacity / 100); object.KhtmlOpacity = (opacity / 100); object.filter = "alpha(opacity=" + opacity + ")"; } function shiftOpacity(id, millisec) { //if an element is invisible, make it visible, else make it ivisible if(document.getElementById(id).style.opacity == 0) { opacity(id, 0, 100, millisec); } else { opacity(id, 100, 0, millisec); } } function GetLeft(ele) { if (ele.offsetParent) return ele.offsetLeft + GetLeft(ele.offsetParent); else return ele.offsetLeft; } function GetTop(ele) { if (ele.offsetParent) return (ele.offsetTop + GetTop(ele.offsetParent)); else return (ele.offsetTop); } function moveSlideshowDivs(){ //Moves the two DIVS into position overtop the denoted spot where the slideshow is to take place //These commands work for every browser (except IE) ffLeftMargin = 520; //Allows you to push the iframe farther from the left ffTopMargin = 0; //Allows you to push the iframe farther from the top document.getElementById('divFeaturedUnits_true').style.top = document.getElementById('featuredUnitsSlideshow').offsetTop + 0 + 'px'; document.getElementById('divFeaturedUnits_false').style.top = document.getElementById('featuredUnitsSlideshow').offsetTop + 0 + 'px'; document.getElementById('divFeaturedUnits_true').style.left = document.getElementById('featuredUnitsSlideshow').offsetLeft + 520 + 'px'; document.getElementById('divFeaturedUnits_false').style.left = document.getElementById('featuredUnitsSlideshow').offsetLeft + 520 + 'px'; //These commands only work for IE ieLeftMargin = 520; //Allows you to push the iframe farther from the left ieTopMargin = 0; //Allows you to push the iframe farther from the top document.getElementById('divFeaturedUnits_true').style.left = GetLeft(document.getElementById('featuredUnitsSlideshow')) + ieLeftMargin; document.getElementById('divFeaturedUnits_true').style.top = GetTop(document.getElementById('featuredUnitsSlideshow')) + ieTopMargin; document.getElementById('divFeaturedUnits_false').style.left = GetLeft(document.getElementById('featuredUnitsSlideshow')) + ieLeftMargin; document.getElementById('divFeaturedUnits_false').style.top = GetTop(document.getElementById('featuredUnitsSlideshow')) + ieTopMargin; } function switchUnits(){ shiftOpacity('iframeFeaturedUnits_' + unitBoolean, 1000); shiftOpacity('iframeFeaturedUnits_' + !unitBoolean, 1000); }//end function function unitSlideShow(){ if ((imageComplete('iframeFeaturedUnits_' + unitBoolean)) && (cycleCounter >= 5)){ cycleCounter = 0; unitBoolean = !unitBoolean; //Swaps the order in which the iframes are loaded/faded switchUnits(); //Fade the units in/out if (unitCounter >= (highestUnit-1)) { //highestUnit is zero based unitCounter = 0; }else{ unitCounter++; } //Begin loading this iframe, now that it has been faded out eval("window.iframeFeaturedUnits_" + unitBoolean + ".location = '/featuredUnitsSlideshowAgent.aspx?scriptAddress=" + scriptAddress + "&corpid=" + corpID +"&start=" + unitCounter +"&limit=1" + "&locations=" + locations + "'"); }else{ cycleCounter++; }//end if }//end function function imageComplete(windowName){ //Will be able to tell if iframeX has finished loading the unit image and is ready to be faded in if (eval("window.iframeFeaturedUnits_" + unitBoolean)){//Window exists if(eval("window.iframeFeaturedUnits_" + unitBoolean + ".document.getElementById('rowcnt')")){//Div containing the row count exists //Go ahead and grab the highest featured unit number highestUnit = eval("window.iframeFeaturedUnits_" + unitBoolean + ".document.getElementById('rowcnt').innerHTML"); if(eval("window.iframeFeaturedUnits_" + unitBoolean + ".document.images[0].complete")){//Image has finished loading return true; }else{ return false; }//end if }//end if }//end if }//end function function unitSlideShowSetup(){ //Write the DIV, that will later be tracked and triangulated, so that the two iframes can be stacked on that spot document.write("
"); //Write the two DIVS containing the two Iframes that make up the slideshow document.write(""); document.write(""); moveSlideshowDivs(); // Move the DIVS that make up the "featured units" slideshow - into place. // These DIVS have an absolute position because they need to occupy the same spot unitCounter = 0; // Keeps track of how many units we have cycled through unitBoolean = true; // Controls which iframe we show/hide/reload/test cycleCounter = 0; // Keeps track of the "checkup" intervals scriptAddress = "http://unitavailability.rentmanager.com/FeaturedUnits.aspx"; //Using a vairable with a compact name to build the full URL corpID = "birchman"; //Using a vairable with a compact name to build the full URL locations = "default"; //Load this iframe immediately eval("window.iframeFeaturedUnits_" + unitBoolean + ".location = '/featuredUnitsSlideshowAgent.aspx?scriptAddress=" + scriptAddress + "&corpid=" + corpID +"&start=" + unitCounter +"&limit=1" + "&locations=" + locations + "'"); unitCounter++; // Prepare the next iframe to load the next featured unit //Load this iframe immediately also eval("window.iframeFeaturedUnits_" + !unitBoolean + ".location = '/featuredUnitsSlideshowAgent.aspx?scriptAddress=" + scriptAddress + "&corpid=" + corpID +"&start=" + unitCounter +"&limit=1" + "&locations=" + locations + "'"); //Fade out one of the iframes to begin the cycle shiftOpacity('iframeFeaturedUnits_' + !unitBoolean, 1000); unitSlideShow(); //Start the slideshow immediately waitInterval = setInterval("unitSlideShow()",1000); //Run a "checkup" interval once every second } unitSlideShowSetup();