function myprintln(s) { document.writeln(s); }

//gets unit number used in photo link
function getPhotoLink(unitNumber){
document.write("<a href='http://216.128.16.129/beachclubal/UnitTours/"+ unitNumber +"/default.asp?dir="+ unitNumber +"Album&prv=y'>");
}


//Album Scripts
var status_info=new Array(
"Go to previous picture","Go to next picture",
"Go back to album list","Go to the first picture in this album",
"Go to the last picture in this album","Go to specified picture in this album",
"Go back to thumbnail preview", "Switch to normal view", "Switch to thumbnail view", "Switch to Slide Show");

function jump_uri(main_dir, current_pic, dir_name, maxid) {
	var id;
	id=parseInt(window.prompt("Enter Picture ID: ",current_pic)); 

	if(id>0) {
		id=parseInt(id);
		id--; // match index
		if(id < 0 || id >= parseInt(maxid)) {
			alert("Image Id: " + (id+1) + " not within boundary limits");
		}
		else return(main_dir + "default.asp?dir=" + dir_name + "&id=" + parseInt(id));
	}
	return 'javascript://';
}
function confirmChecked() {
	if(document.thumbnail.rand.checked) {
		document.thumbnail.prv[2].checked=true;
		return;
	}
	document.thumbnail.prv[0].checked=true;
}
function status_window(context) {
	window.status=status_info[context];
}
function change_status(with_this) {
	window.status=with_this;
}
function AlbumClicked(name) {
	document.thumbnail.dir.value=name;
	document.thumbnail.submit();
}
function over() {
    window.event.srcElement.style.filter = "alpha(opacity=100)";
}
function out() {
    window.event.srcElement.style.filter = "alpha(opacity=100)";
}
function runSlideShow(){
	if (document.all) {
		document.images.SlideShow.style.filter=rand_anim[(Math.round(Math.random()*10)%rand_anim_len)];
		document.images.SlideShow.filters[0].Apply();
	}
	document.images.SlideShow.src = preLoad[j].src
	if (document.all) {
		document.images.SlideShow.filters[0].Play();
	}
	j = ((j+1)%(length))?j+1:0;
	t = setTimeout('runSlideShow()', slideShowSpeed);
}





//*** PTViewer built-in functions ***/
function mousehs(n)
{
  if( n== -1 )
  {
    parent.frameCNTL1.document.frmSliders.valHSNum.value = "---" ;
  }
  Else
  {
    parent.frameCNTL1.document.frmSliders.valHSNum.value = n ;
  }
}


function DisplayPan()
{
  status = document.ptviewer.pan().toString() ;
}
function DisplayTilt()
{
  status = document.ptviewer.tilt().toString() ;
}
function DisplayFov()
{
  status = document.ptviewer.fov().toString() ;
}


function PtvUp()
{
  document.ptviewer.panUp();
}
function PtvDown()
{
  document.ptviewer.panDown();
}
function PtvLeft()
{
  document.ptviewer.panLeft();
}
function PtvRight()
{
  document.ptviewer.panRight();
}
function PtvZoomOut()
{
  document.ptviewer.ZoomIn();
}
function PtvZoomIn()
{
  document.ptviewer.ZoomOut();
}


function getview(p,t,f)
{
  rp=round2dec(p);
  rt=round2dec(t);
  rf=round2dec(f);
  parent.frameCNTL1.mySliderPAN.setValue(rp,true);
  parent.frameCNTL1.document.frmSliders.ValPAN.value=rp;
  parent.frameCNTL1.mySliderTILT.setValue(rt,true);
  parent.frameCNTL1.document.frmSliders.ValTILT.value=rt;
  parent.frameCNTL1.mySliderFOV.setValue(rf,true);
  parent.frameCNTL1.document.frmSliders.ValFOV.value=rf;
}

function setPano()
{
  p = parent.frameCNTL1.document.frmSliders.ValPAN.value;
  t = parent.frameCNTL1.document.frmSliders.ValTILT.value;
  f = parent.frameCNTL1.document.frmSliders.ValFOV.value;
  document.ptviewer.gotoView(p,t,f);
}



function DoReset()
{
  document.ptviewer.gotoView(0,0,70);
  parent.frameCNTL1.mySliderPAN.setValue(0,true);
  parent.frameCNTL1.document.frmSliders.ValPAN.value=0;
  parent.frameCNTL1.mySliderTILT.setValue(0,true);
  parent.frameCNTL1.document.frmSliders.ValTILT.value=0;
  parent.frameCNTL1.mySliderFOV.setValue(70,true);
  parent.frameCNTL1.document.frmSliders.ValFOV.value=70;
}


// rounds off to 2 decimal pts.
function round2dec(value)
{
  return ((Math.round( 100 * value ))/100);
}






function DoAuto()
{
  document.ptviewer.startAutoPan( 0.5, 0.0, 1.0 );
}
function DoUp()
{
  document.ptviewer.startAutoPan( 0.0, 0.1, 1.0 );
}
function DoDown()
{
  document.ptviewer.startAutoPan( 0.0, -0.1, 1.0 );
}
function DoLeft()
{
  document.ptviewer.startAutoPan( -1, 0.0, 1.0 );
}
function DoRight()
{
  document.ptviewer.startAutoPan( 1, 0.0, 1.0 );
}
function DoLeftAuto()
{
  document.ptviewer.startAutoPan( -0.1, 0.0, 1.0 );
}
function DoRightAuto()
{
  document.ptviewer.startAutoPan( 0.1, 0.0, 1.0 );
}
function DoZoomIn()
{
   document.ptviewer.startAutoPan( 0.0, 0.0, 1.025 );
}
function DoZoomOut()
{
  document.ptviewer.startAutoPan( 0.0, 0.0, 1.0/1.025 );
}
function DoStop()
{
  document.ptviewer.stopAutoPan();
}
