		// Set slideShowSpeed (milliseconds)
		var slideShowSpeed = 3500;

		// Duration of crossfade (seconds)
		var crossFadeDuration = 3;

		// Specify the image files
		var Pic = new Array(); // don't touch this
		var PicCaption = new Array(); // don't touch this
		var strSlideShowID = 'REMSSlideShowViewer1_SlideShow'; // get the new client ID from the user control
		
		<? 
		mysql_data_seek($sqlItemResult,0);
		$i=0;
		While($myImage=mysql_fetch_object($sqlItemResult)):?>
		Pic[<?=$i?>] = 'pictures/large/<?echo $myImage->ImageFile?>';
		PicCaption[<?=$i?>] = "<?echo $myImage->ImageName?>";
		<?$i++?>
		<?endwhile;?>

		var m_intTimeOut;
		var m_intCurrentIndex = -1;
		var m_intArrayLen = Pic.length;
		var preLoad = new Array();
		
		for (i = 0; i < m_intArrayLen; i++)	{
			preLoad[i] = new Image();
			preLoad[i].src = Pic[i];
		}// end for
		
		window.onload = runSlideShow; //sets up to run the actual slide show
		
		function adjustImageSize() {
			var intStandardWidth = <?echo $ImageWidth?>;
			var intWidth = 0;
			var intHeight = 0;
			var intPercentDif = 0;
			var intCurrentHeight = 0;
			var intTallestHeight = 0;
			var intCurrentHeight = 0;		
			var objImageArea = document.getElementById('ImageArea');
			
			for (i = 0; i < preLoad.length; i++) {//loop through images
				intHeight = preLoad[i].height; //get unaltered height
				intWidth = preLoad[i].width; //get unaltered width
				intPercentDif = intStandardWidth / intWidth; // make it the right size
				intHeight = intHeight * intPercentDif;
																	
				if (intTallestHeight < intHeight) {					
					intTallestHeight = intHeight;
				}//end if				
			}//end for
			
			if (intTallestHeight > objImageArea.height) {
				objImageArea.height = intTallestHeight + 5;	 //add 5 to avoid popping					
			}//end if					
		}//end adjustImageSize()

		function runSlideShow() {		
			if (m_intArrayLen > 1) {//if there is more than one pic
				adjustImageSize();
			}//end if
			
			if (m_intArrayLen > 0) { // if there is a SLIDE SHOW				
				m_intCurrentIndex = m_intCurrentIndex + 1;
				
				if (m_intCurrentIndex > (m_intArrayLen-1)) { // reset back
					m_intCurrentIndex=0
				}// end if
								
				displaySlide();	
				
				clearTimeout(m_intTimeOut); // reset first
				m_intTimeOut = setTimeout('runSlideShow()', slideShowSpeed);
			}// end if
		}// end runSlideShow()

		function showPrevSlide() {			
			m_intCurrentIndex = m_intCurrentIndex - 1;
			
			if (m_intCurrentIndex < 0) { // reset back
				m_intCurrentIndex=(m_intArrayLen-1)
			}// end if
			
			displaySlide();	
		}// end showPrevSlide()

		function showNextSlide() {
			m_intCurrentIndex = m_intCurrentIndex + 1;
			
			if (m_intCurrentIndex > (m_intArrayLen-1)) { // reset back
				m_intCurrentIndex=0
			}// end if
			
			displaySlide();	
		}//end showNextSlide()

		function displaySlide() {
			if (document.all) {
				document.images(strSlideShowID).style.filter="blendTrans(duration=2)";
				document.images(strSlideShowID).style.filter="blendTrans(duration=crossFadeDuration)";
				document.images(strSlideShowID).filters.blendTrans.Apply();      
			}// end if
			
			document.images(strSlideShowID).src = preLoad[m_intCurrentIndex].src;
			//document.all.SlideShowCaption.InnerText= PicCaption[m_intCurrentIndex];
							
			document.getElementById("SlideShowCaption").innerHTML = PicCaption[m_intCurrentIndex];
			//window.status= PicCaption[m_intCurrentIndex];
			
			if (document.all) {
				document.images(strSlideShowID).filters.blendTrans.Play();
			}//end if
		}// end displaySlide()

		function showVirtualTour() {
			javascript:void window.open('http://www.reelestates.com/listing-images/wvwmv/3694wv.wmv')			
		}// end showVirtualTour()

		function showAllPictures() {
			var boolShowAllPics = 'True'
			
			if (boolShowAllPics == 'True'){
				window.open('../Listings/AllPictures.aspx?ETID=100&PID=2855756','','left=200,top=100,width=600,height=400,scrollbars=yes menubar=no toolbar=no');
			}//end if
		}// end showAllPictures()


