/*** 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 PtvZoomIn()
{
  document.ptviewer.ZoomIn();
}
function PtvZoomOut()
{
  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();
}

