function DoAutorotationStart(){
	document.ptviewer.startAutoPan( 0.058, 0.0, 1.0 );
}
function DoAutorotationStop(){
	document.ptviewer.stopAutoPan();
}
function DoZoomIn(){
	document.ptviewer.startAutoPan( 0.0, 0.0, 1.0/1.01 );
}
function DoZoomOut(){
	document.ptviewer.startAutoPan( 0.0, 0.0, 1.03 );
}
function DoShowHideHotspots(){
	document.ptviewer.toggleHS();
}
function DoReset(){
	document.ptviewer.gotoView( -45, 0, 80 );
}
function DisplayPan(){
	status = document.ptviewer.pan().toString();
}
function DisplayTilt(){
	status = document.ptviewer.tilt().toString();
}
function DisplayFov(){
	status = document.ptviewer.fov().toString();
}
function mousehs(n){
	if( n== -1 )
		document.cn.hsnum.value = "---";
	else
		document.cn.hsnum.value = n;
}
function getview(p,t,f){
document.cn.pan.value = p;
document.cn.tilt.value = t;
document.cn.fov.value = f;
}
function SetCurrentImageSize(imageWidth, imageHeight)
{
	var namedItem = document.createAttribute("imageWidth");
	namedItem.value = imageWidth;
	document.ptviewer.attributes.setNamedItem(namedItem);
	
	namedItem = document.createAttribute("imageHeight");
	namedItem.value = imageHeight;
	document.ptviewer.attributes.setNamedItem(namedItem);
}
function LoadNewPano(fileName, bar_x, bar_y)
{
	var namedItem = document.createAttribute("currentImage");
	namedItem.value = fileName;
	document.ptviewer.attributes.setNamedItem(namedItem);
	
	if ((typeof(bar_x) == 'undefined') || (typeof(bar_y) == 'undefined'))
		document.ptviewer.newPano('{file=' + fileName + '}');
	else 
	document.ptviewer.newPano('{file=' + fileName + '}{bar_x=' + bar_x + '}{bar_y=' + bar_y + '}');
	DoAutorotationStart();
}

function LoadNewPanoEx(fileName, bar_x, bar_y, fov, fovmin, fovmax, speed)
{
	var namedItem = document.createAttribute("currentImage");
	namedItem.value = fileName;
	document.ptviewer.attributes.setNamedItem(namedItem);
	
	if ((typeof(bar_x) == 'undefined') || (typeof(bar_y) == 'undefined') || (typeof(bar_y) == 'undefined')
		|| (typeof(fov) == 'undefined') || (typeof(fovmin) == 'undefined') || (typeof(fovmax) == 'undefined')
		|| (typeof(speed) == 'undefined'))
		document.ptviewer.newPano('{file=' + fileName + '}');
	else 
	document.ptviewer.newPano('{file=' + fileName + '}{bar_x=' + bar_x + '}{bar_y=' + bar_y + '}{fov=' + fov + '}{fovmin=' + fovmin + '}{fovmax=' + fovmax + '}');
	StartWithNewSpeed(speed);
}

function LoadNewPanoWithFovAndSpeed(fileName, fov, fovmin, fovmax, speed)
{
	var namedItem = document.createAttribute("currentImage");
	namedItem.value = fileName;
	document.ptviewer.attributes.setNamedItem(namedItem);
	
	if ((typeof(bar_x) == 'undefined') || (typeof(bar_y) == 'undefined'))
	{
		document.ptviewer.newPano('{file=' + fileName + '}{fov=' + fov + '}{fovmin=' + fovmin + '}{fovmax=' + fovmax + '}');
	}
	else
	{
		document.ptviewer.newPano('{file=' + fileName + '}{fov=' + fov + '}{fovmin=' + fovmin + '}{fovmax=' + fovmax + '}');
	}
	
	StartWithNewSpeed(speed);
}

function NewPano(){
	document.ptviewer.newPanoFromList(0);
}


function StartWithNewSpeed(newSpeed)
{
	document.ptviewer.startAutoPan( newSpeed, 0.0, 1.0 );
}