// JavaScript Document

var rotate_delay = 5000; // delay in milliseconds (5000 = 5 secs)
current = 0;



function next() {
if (document.slideform.slide[current+1]) {
document.images.show.src = document.slideform.slide[current+1].value;
document.getElementById("linkshow").href= document.slideform.slide[current+1].value;
document.getElementById("linkshow").title = document.slideform.slide[current+1].title;
document.slideform.slide.selectedIndex = ++current;
  }
else first();
}
function previous() {
if (current-1 >= 0) {
document.images.show.src = document.slideform.slide[current-1].value;
document.getElementById("linkshow").href = document.slideform.slide[current-1].value;
document.getElementById("linkshow").title = document.slideform.slide[current-1].title;
document.slideform.slide.selectedIndex = --current;
  }
else last();
}
function first() {
current = 0;
document.images.show.src = document.slideform.slide[0].value;
document.getElementById("linkshow").href = document.slideform.slide[0].value;
document.getElementById("linkshow").title = document.slideform.slide[0].title;
document.slideform.slide.selectedIndex = 0;
}
function last() {
current = document.slideform.slide.length-1;
document.images.show.src = document.slideform.slide[current].value;
document.getElementById("linkshow").href = document.slideform.slide[current].value;
document.getElementById("linkshow").title = document.slideform.slide[current].title;
document.slideform.slide.selectedIndex = current;
}
function ap(text) {
document.slideform.slidebutton.value = (text == "Stop") ? "Start" : "Stop";
rotate();
}
function change() {
current = document.slideform.slide.selectedIndex;
document.images.show.src = document.slideform.slide[current].value;
document.getElementById("linkshow").href = document.slideform.slide[current].value;
document.getElementById("linkshow").title = document.slideform.slide[current].title;
}
function rotate() {
if (document.slideform.slidebutton.value == "Stop") {
current = (current == document.slideform.slide.length-1) ? 0 : current+1;
document.images.show.src = document.slideform.slide[current].value;
document.getElementById("linkshow").href = document.slideform.slide[current].value;
document.getElementById("linkshow").title = document.slideform.slide[current].title;
document.slideform.slide.selectedIndex = current;
window.setTimeout("rotate()", rotate_delay);
  }
}

function ViewFloorplan(FloorplanID)
{	
	window.open("/ViewImage.asp?PropertyID=<%= pID %>&FloorplanID=" + FloorplanID,"ViewImage","toolbar=no,location=yes,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=750,height=400");
}




 function playVid(vidId) {
	 vidPaneID = document.getElementById('vidpane'); 
      if (vidPaneID.style.display=='block') {
         vidPaneID.style.display='none';
         vidPaneID.innerHTML=''; 
      } else {
         

			
            
         
		 vidPaneID.style.marginLeft = "-" + parseInt(vidPaneID.offsetWidth / 2) + "px";
		 vidPaneID.style.marginTop = "-" + parseInt(vidPaneID.offsetHeight / 2) + "px";
		 
		 
         vidPaneID.innerHTML='<a href="javascript:playVid()">CLOSE</a>';
         var vidstring ='<embed enableJavascript="false" allowScriptAccess="never"';
         vidstring+=' allownetworking="internal" type="application/x-shockwave-flash"';
         vidstring+='  src="http://www.youtube.com/v/'+vidId+'&autoplay=1" ';
         vidstring+=' wmode="transparent" height="350" width=425">';
         vidPaneID.innerHTML+=vidstring;
		 vidPaneID.style.display='block';
      }
   }

  	 
	 





//  End -->