	// IDX Broker Slideshow version 2.0
	// Copyright ©2009 All rights reserved.
	// This script exists soley for the purposes of allowing real estate professionals to display
	// their property information easily on their own web site. All other use prohibited.
	
	var c;
		
	var timeForSaleout = 4000;
	var cForSalewi = 0;
	
	// iForSalesf1.11 :: Image swap-fade 
	// *****************************************************
	// DOM scripting by brothercake -- http://www.brothercake.com/
	//******************************************************
	//global object
	var iForSalesf = { 'clock' : null, 'fade' : true, 'count' : 1 }
	
	
	//swapForSalefade setup function
	function swapForSalefade()
	{
		//if the timer is not already going
		if(iForSalesf.clock == null)
		{
			//copy the image object 
			iForSalesf.obj = arguments[0];
			
			//copy the image src argument 
			iForSalesf.src = arguments[1];
			
			//store the supported form of opacity
			if(typeof iForSalesf.obj.style.opacity != 'undefined')
			{
				iForSalesf.type = 'w3c';
			}
			else if(typeof iForSalesf.obj.style.MozOpacity != 'undefined')
			{
				iForSalesf.type = 'moz';
			}
			else if(typeof iForSalesf.obj.style.KhtmlOpacity != 'undefined')
			{
				iForSalesf.type = 'khtml';
			}
			else if(typeof iForSalesf.obj.filters == 'object')
			{
				//weed out win/ie5.0 by testing the length of the filters collection (where filters is an object with no data)
				//then weed out mac/ie5 by testing first the existence of the alpha object (to prevent errors in win/ie5.0)
				//then the returned value type, which should be a number, but in mac/ie5 is an empty string
				iForSalesf.type = (iForSalesf.obj.filters.length > 0 && typeof iForSalesf.obj.filters.alpha == 'object' && typeof iForSalesf.obj.filters.alpha.opacity == 'number') ? 'ie' : 'none';
			}
			else
			{
				iForSalesf.type = 'none';
			}
			
			//change the image alt text if defined
			if(typeof arguments[3] != 'undefined' && arguments[3] != '')
			{
				iForSalesf.obj.alt = arguments[3];
			}
			
			//if any kind of opacity is supported
			if(iForSalesf.type != 'none')
			{
				//copy and convert fade duration argument 
				//the duration specifies the whole transition
				//but the swapForSalefade is two distinct transitions
				iForSalesf.length = parseInt(arguments[2], 10) * 500;
				
				//create fade resolution argument as 20 steps per transition
				//again, split for the two distrinct transitions
				iForSalesf.resolution = parseInt(arguments[2], 10) * 10;
				
				//start the timer
				iForSalesf.clock = setInterval('iForSalesf.swapForSalefade()', iForSalesf.length/iForSalesf.resolution);
			}
			
			//otherwise if opacity is not supported
			else
			{
				//just do the image swap
				iForSalesf.obj.src = iForSalesf.src;
			}
			
		}
	};
	
	
	//swapForSalefade timer function
	iForSalesf.swapForSalefade = function()
	{
		//increase or reduce the counter on an exponential scale
		iForSalesf.count = (iForSalesf.fade) ? iForSalesf.count * 0.9 : (iForSalesf.count * (1/0.9)); 
		
		//if the counter has reached the bottom
		if(iForSalesf.count < (1 / iForSalesf.resolution))
		{
			//clear the timer
			clearInterval(iForSalesf.clock);
			iForSalesf.clock = null;
	
			//do the image swap
			iForSalesf.obj.src = iForSalesf.src;
	
			//reverse the fade direction flag
			iForSalesf.fade = false;
			
			//restart the timer
			iForSalesf.clock = setInterval('iForSalesf.swapForSalefade()', iForSalesf.length/iForSalesf.resolution);
	
		}
		
		//if the counter has reached the top
		if(iForSalesf.count > (1 - (1 / iForSalesf.resolution)))
		{
			//clear the timer
			clearInterval(iForSalesf.clock);
			iForSalesf.clock = null;
	
			//reset the fade direction flag
			iForSalesf.fade = true;
			
			//reset the counter
			iForSalesf.count = 1;
		}
	
		//set new opacity value on element
		//using whatever method is supported
		switch(iForSalesf.type)
		{
			case 'ie' :
				iForSalesf.obj.filters.alpha.opacity = iForSalesf.count * 100;
				break;
				
			case 'khtml' :
				iForSalesf.obj.style.KhtmlOpacity = iForSalesf.count;
				break;
				
			case 'moz' : 
				//restrict max opacity to prevent a visual popping effect in firefox
				iForSalesf.obj.style.MozOpacity = (iForSalesf.count == 1 ? 0.9999999 : iForSalesf.count);
				break;
				
			default : 
				//restrict max opacity to prevent a visual popping effect in firefox
				iForSalesf.obj.style.opacity = (iForSalesf.count == 1 ? 0.9999999 : iForSalesf.count);
		}
	};



	
	document.writeln('<style type="text/css" media="all">');
	document.writeln('a.IDX-ForSale-ssLinkText, a.IDX-ForSale-ssLinkText:active, a.IDX-ForSale-ssLinkText:link, a.IDX-ForSale-ssLinkText:visited, a.IDX-ForSale-ssLinkText:hover { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10px; font-weight: normal; font-style: normal; color: #ffffff;  }');
	document.writeln('#IDX-ForSale-slideshow { text-align: center; background-color: #000000; border-width: 5px; border-style: solid; border-color: #3B52A0; width: 144px;  }');
	document.writeln('.IDX-ForSale-image { width: 144px; height: 108px;  }');
	document.writeln('#IDX-ForSale-slideshowImage span { text-align: center; }');
	document.writeln('</style>');
	var nextForSale = 1;
	prevForSale = 2 - 1;

	document.writeln('<div id="IDX-ForSale-slideshow">');
	document.writeln('<div id="IDX-ForSale-slideshowImage">');
	document.writeln('<span><a href="" id="IDX-ForSale-ssImageURL" class="IDX-ForSale-ssLinkText"><img id="IDX-ForSale-ssImage" name="ForSale-ssImage" alt="Slideshow image" border="0"  class="IDX-ForSale-image" src="http://photos-6.idxco.com/117e22c3e23535b7f923128916a747f43b090053720" ></a></span>');
	document.writeln('</div>');
	document.writeln('<div id="IDX-ForSale-priceLine"></div>');
	document.writeln('<div id="IDX-ForSale-addressLine"></div>');
	document.writeln('<div id="IDX-ForSale-cszLine"></div>');
	document.writeln('<div id="IDX-ForSale-bedLine" style="display:none;"></div>');
	document.writeln('<div id="IDX-ForSale-bathLine" style="display:none;"></div>');
	document.writeln('<div id="IDX-ForSale-remarkLine" style="display:none;"></div>');
	
	document.writeln('</div>');

	function playForSale()
	{
		
		
		urlVarForSale = '<a href="'+propertiesForSale[cForSalewi][6]+'" class="IDX-ForSale-ssLinkText">';
		swapForSalefade(document.getElementById('IDX-ForSale-ssImage'), preLoadForSale.src, '1', ' ');
		document.getElementById('IDX-ForSale-ssImageURL').href = propertiesForSale[cForSalewi][6];
		document.getElementById('IDX-ForSale-priceLine').innerHTML = urlVarForSale+'$'+propertiesForSale[cForSalewi][0]+'</a>';
		document.getElementById('IDX-ForSale-addressLine').innerHTML =  urlVarForSale+propertiesForSale[cForSalewi][1]+'</a>';
		document.getElementById('IDX-ForSale-cszLine').innerHTML = urlVarForSale+propertiesForSale[cForSalewi][2]+'</a>';
		document.getElementById('IDX-ForSale-bedLine').innerHTML = urlVarForSale+'Beds: '+propertiesForSale[cForSalewi][7]+'</a>';
		document.getElementById('IDX-ForSale-bathLine').innerHTML = urlVarForSale+'Baths: '+propertiesForSale[cForSalewi][8]+'</a>';
		document.getElementById('IDX-ForSale-remarkLine').innerHTML = urlVarForSale+propertiesForSale[cForSalewi][9]+'</a>';
		
		preLoadForSale = new Image();
		preLoadForSale.src = propertiesForSale[nextForSale][3];
		
		updateForSale();
		
		cForSale = setTimeout('playForSale()', timeForSaleout);	
		
		
	} // end play()
	function updateForSale()
	{		
		cForSalewi = nextForSale;		
		genNextForSale();
		genPrevForSale();
		
	}
	function genNextForSale()
	{
		nextForSale = cForSalewi + 1;
		if (nextForSale >= 2)
			nextForSale = 0;
	} // end genNext
	function genPrevForSale()
	{
		prevForSale = cForSalewi - 1;
		if (prevForSale < 0)
			prevForSale = 2 - 1;
	} // end genPrev

	var propertiesForSale = new Array(2);
	propertiesForSale[0] = new Array('14,000','3306 South 18th St','St Louis, MO 63118 ','http://photos-6.idxco.com/117e22c3e23535b7f923128916a747f43b090053720','90053720','117','http://thresholdstl.idxco.com/idx/4549/details.php?listingID=90053720&idxID=117','','','MAKE AN OFFER - This Benton Park shell is perfect for a reha...');
	propertiesForSale[1] = new Array('105,000','4037 Walsh St','St Louis, MO 63116 ','http://photos-6.idxco.com/117b2f9f51cc2dd328e73058740eccd553490039691','90039691','117','http://thresholdstl.idxco.com/idx/4549/details.php?listingID=90039691&idxID=117','2','1.5','Enjoy all the convence of city living without all the noise....');
	var urlVarForSale;
	var preLoadForSale = new Image();
	preLoadForSale.src = propertiesForSale[cForSalewi][3];
	onLoad = playForSale();
