﻿// JScript File

function ParagraphViewer()
{
    
    this.iframe = document.getElementById(PARAGRAPH_FRM);
    this.button = document.getElementById(BTN_PARAGRAPH);
    this.visible = false;
    this.onClick = onClick;
    this.requestShutDown = requestShutDown;
    
    function requestShutDown()
    {
        
        try
        {
	        var frame = top[this.iframe.name];
	        
	        //CR: move below
	        if (typeof(frame.frmFlashPlayer) == "object")
	        {
	            var flashObj = frame.frmFlashPlayer.document.getElementById("flashObj");
	            if (flashObj != null)
	            {
	                
	                try
	                {
	                  flashObj.pauseScene();
	                  //alert('pause called');
	                  //getControllerVersion
	                }
	                catch(e)
	                {
	                
	                //getControllerVersion
	                  flashObj.Stop();
	                }
	            }
	        }
	        
            var response = frame.Paragraph.RequestShutDown();
            return response.value;
        }
        catch(err)
        {
	        return false;
        }
    }
    
    function onClick(id)
    {
        
        var request = new Request(REQ_PARAGRAPH_TYPE);
        request.id = id;
        top.uiCtrl.sendData(request);
    } 
}   