﻿
var flashPanoramaPlayer;

function initialize() 
{
    /* Check if the browser is IE. If so, flashPanoramaPlayer is window.PanoramaPlayer. Otherwise, it's window.document.PanoramaPlayer. The PanoramaPlayer is the id assigned to <object> and <embed> tags. */
    var ie = navigator.appName.indexOf("Microsoft") != -1;
    
    flashPanoramaPlayer = (ie) ? window['PanoramaPlayer'] : document['PanoramaPlayer'];
    
    // for IE7
    if (!flashPanoramaPlayer)
    {
        flashPanoramaPlayer = document['PanoramaPlayer'];
    }
}
/* old
function SetViewDirection(TgtYaw,TgtPitch) 
{
    initialize(); 
    flashPanoramaPlayer.set_viewdirection(TgtYaw, TgtPitch);
}

function SetVideoPos(TgtPos) 
{
    initialize(); 
    flashPanoramaPlayer.set_videopos(TgtPos);
}


function PlayVideo() 
{
    initialize();
    flashPanoramaPlayer.play_video();
}

function PauseVideo() 
{
    initialize(); 
    flashPanoramaPlayer.pause_video();
}


function RewindVideo() 
{
    initialize(); 
    flashPanoramaPlayer.rewind_video();
}
function GetStatus() 
{
    initialize(); 
    var my_status = flashPanoramaPlayer.get_status();
    document.interfaceform.length2.value = my_status[0];
    document.interfaceform.curr_pos2.value = my_status[1];
    document.interfaceform.curr_yaw2.value = my_status[2];
    document.interfaceform.curr_pitch2.value = my_status[3];
}

function ConveyStatus(length, play_pos, yaw, pitch)
{
    document.interfaceform.length.value = length;
    document.interfaceform.curr_pos.value = play_pos;
    document.interfaceform.curr_yaw.value = yaw;
    document.interfaceform.curr_pitch.value = pitch;
} 

function SelectVideo(video) 
{
    initialize(); 
    if (flashPanoramaPlayer && flashPanoramaPlayer.loadVideo)
    {
        flashPanoramaPlayer.loadVideo(video);
    }
} */



//////

/* 
var flashPanoramaPlayer;

function initialize() {
		// Check if the browser is IE. If so, flashPanoramaPlayer is window.PanoramaPlayer. Otherwise, it's window.document.PanoramaPlayer. The PanoramaPlayer is the id assigned to <object> and <embed> tags.
		var ie = navigator.appName.indexOf("Microsoft") != -1;
		flashPanoramaPlayer = (ie) ? window['PanoramaPlayer'] : document['PanoramaPlayer'];
}
*/

function SetViewDirection(TgtYaw,TgtPitch) {
		initialize(); 
		flashPanoramaPlayer.set_viewdirection(TgtYaw, TgtPitch);
}

function SetVideoPos(TgtPos) {
		initialize(); 
		if (flashPanoramaPlayer && flashPanoramaPlayer.set_videopos)
		{
		    flashPanoramaPlayer.set_videopos(TgtPos);
		}
}


function PressStartButton() {
		initialize(); 
		flashPanoramaPlayer.press_start_button();
}


function PlayVideo() {
		initialize(); 
		flashPanoramaPlayer.play_video();
}


function PauseVideo() {
		initialize(); 
		
		if (flashPanoramaPlayer && flashPanoramaPlayer.pause_video)
		{
		    flashPanoramaPlayer.pause_video();
		}
}


function RewindVideo() {
		initialize(); 
		flashPanoramaPlayer.rewind_video();
}
function GetStatus() {
		initialize(); 
		var my_status = flashPanoramaPlayer.get_status();
		document.interfaceform.length2.value = my_status[0];
		document.interfaceform.curr_pos2.value = my_status[1];
		document.interfaceform.curr_yaw2.value = my_status[2];
		document.interfaceform.curr_pitch2.value = my_status[3];
}

function ConveyStatus(length, play_pos, yaw, pitch) {
  document.interfaceform.length.value = length;
  document.interfaceform.curr_pos.value = play_pos;
  document.interfaceform.curr_yaw.value = yaw;
  document.interfaceform.curr_pitch.value = pitch;
} 
function SelectVideo(video) {
	initialize(); 
	flashPanoramaPlayer.loadVideo(video);
}
function EnableVideoRepeat() {
	initialize(); 
	flashPanoramaPlayer.enable_video_repeat();
}
function DisableVideoRepeat() {
	initialize(); 
	flashPanoramaPlayer.disable_video_repeat();
}


