/*
PTGuiViewer version 1.1

See below for usage instructions!

PTGui Panorama Viewer, a combined Flash10 / HTML5 viewer for spherical panoramas. 
(C) Copyright New House Internet Services BV 2010
Website: http://www.ptgui.com/

License Agreement for PTGui Panorama Viewer

The software program PTGui Panorama Viewer ("PTGuiViewer") is licensed, not 
sold. By copying, publishing or distributing PTGuiViewer you agree to be bound 
by the terms of this agreement. If you do not agree to the terms of this 
agreement, you are not permitted to copy, publish or distribute PTGuiViewer.

1. Grant of a Limited License 

New House Internet Services B.V. ("NHIS") grants a non-exclusive, 
non-transferable Limited License ("License") to every licensed user 
("Licensee") of the PTGui and/or PTGui Pro Stitching Software ("PTGui"). The 
License permits Licensee to include the files PTGuiViewer.js and 
PTGuiViewer.swf on any number of websites, provided that all of the following 
conditions are satisfied: 
- PTGuiViewer may only be used to display panoramic images generated by PTGui, 
and 
- PTGuiViewer.js and PTGuiViewer.swf may only be published unmodified, as 
released by NHIS, and 

2. Ownership.

You acknowledge that NHIS and its licensors retain ownership of PTGuiViewer. 
NHIS reserves any rights not expressly granted to you. The rights granted are 
limited to NHIS's and its licensors' intellectual property rights in 
PTGuiViewer and do not include any other patents or intellectual property 
rights.

3. Transfer Restriction

You may not transfer or assign your rights under this License Agreement to 
another party without NHIS's prior written consent.

4. Support

You are welcome to post technical support questions to the PTGui Support 
forum. However, this license does not obligate NHIS to provide technical 
support.

5. Limitations

YOU MAY NOT REVERSE ENGINEER, DECOMPILE OR DISASSEMBLE PTGUIVIEWER, EXCEPT AND 
ONLY TO THE EXTENT EXPRESSLY PERMITTED BY APPLICABLE LAW. YOU MAY NOT MODIFY, 
ADAPT, TRANSLATE, RENT, LEASE, LOAN OR CREATE DERIVATIVE WORKS BASED UPON 
PTGUIVIEWER OR ANY PART THEREOF.

6. Restricted Uses

PTGUIVIEWER IS NOT INTENDED FOR USE IN THE OPERATION OF NUCLEAR FACILITIES, 
AIRCRAFT NAVIGATION OR COMMUNICATION SYSTEMS, AIR TRAFFIC CONTROL SYSTEMS, 
LIFE SUPPORT MACHINES OR OTHER EQUIPMENT IN WHICH THE FAILURE OF PTGUIVIEWER 
COULD LEAD TO DEATH, PERSONAL INJURY, OR SEVERE PHYSICAL OR ENVIRONMENTAL 
DAMAGE.

7. Limited Warranty

NHIS warrants for a period of thirty (30) days from the date of purchase of 
your License that PTGuiViewer as provided by NHIS will perform substantially 
in accordance with the accompanying documentation. NHIS's entire liability and 
your sole and exclusive remedy for any breach of the foregoing limited 
warranty will be, at NHIS's option, replacement of PTGuiViewer, refund of the 
purchase price or repair or replacement of PTGuiViewer which is returned to 
NHIS or an NHIS authorized representative with a copy of the receipt. THIS 
LIMITED WARRANTY IS THE ONLY WARRANTY PROVIDED BY NHIS AND NHIS AND ITS 
LICENSORS EXPRESSLY DISCLAIM ALL OTHER WARRANTIES, CONDITIONS OR OTHER TERMS, 
EITHER EXPRESS OR IMPLIED (WHETHER COLLATERALLY, BY STATUTE OR OTHERWISE), 
INCLUDING BUT NOT LIMITED TO IMPLIED WARRANTIES, CONDITIONS OR OTHER TERMS OF 
MERCHANTABILITY, SATISFACTORY QUALITY AND/OR FITNESS FOR A PARTICULAR PURPOSE 
WITH REGARD TO PTGUIVIEWER AND ACCOMPANYING WRITTEN MATERIALS. FURTHERMORE, 
THERE IS NO WARRANTY AGAINST INTERFERENCE WITH YOUR ENJOYMENT OF PTGUIVIEWER 
OR AGAINST INFRINGEMENT OF THIRD PARTY PROPRIETARY RIGHTS BY PTGUIVIEWER. NHIS 
DOES NOT WARRANT THAT THE OPERATION OF PTGUIVIEWER WILL BE UNINTERRUPTED OR 
ERROR-FREE, OR THAT DEFECTS IN PTGUIVIEWER WILL BE CORRECTED. NO ORAL OR 
WRITTEN INFORMATION OR ADVICE GIVEN BY NHIS OR AN NHIS AUTHORIZED 
REPRESENTATIVE SHALL CREATE A WARRANTY. BECAUSE SOME JURISDICTIONS DO NOT 
ALLOW THE EXCLUSION OR LIMITATION OF IMPLIED WARRANTIES, CONDITIONS OR OTHER 
TERMS THE ABOVE LIMITATION MAY NOT APPLY TO YOU. THE TERMS OF THIS DISCLAIMER 
AND THE LIMITED WARRANTY UNDER THIS SECTION DO NOT AFFECT OR PREJUDICE THE 
STATUTORY RIGHTS OF A CONSUMER ACQUIRING PTGUIVIEWER OTHERWISE THAN IN THE 
COURSE OF A BUSINESS, NEITHER DO THEY LIMIT OR EXCLUDE ANY LIABILITY FOR DEATH 
OR PERSONAL INJURY CAUSED BY NHIS'S NEGLIGENCE.

8. Exclusion and Limitation of Remedies and Damages.

IN NO EVENT WILL NHIS, ITS PARENTS, SUBSIDIARIES, OR ANY OF THEIR LICENSORS, 
DIRECTORS, OFFICERS, EMPLOYEES OR AFFILIATES OF ANY OF THE FOREGOING BE LIABLE 
TO ANY OTHER PARTY FOR ANY CONSEQUENTIAL, INCIDENTAL, INDIRECT OR SPECIAL 
DAMAGES WHATSOEVER (INCLUDING WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS 
PROFITS, BUSINESS INTERRUPTION, LOSS OF DATA, LOSS OF BUSINESS INFORMATION AND 
THE LIKE) OR DIRECT LOSS OF BUSINESS, BUSINESS PROFITS OR REVENUE, WHETHER 
FORESEEABLE OR UNFORESEEABLE, ARISING OUT OF THE USE OF OR INABILITY TO USE 
PTGUIVIEWER OR ACCOMPANYING WRITTEN MATERIALS, REGARDLESS OF THE BASIS OF THE 
CLAIM (WHETHER UNDER CONTRACT, NEGLIGENCE OR OTHER TORT OR UNDER STATUTE OR 
OTHERWISE HOWSOEVER ARISING) AND EVEN IF ADVISED OF THE POSSIBILITY OF SUCH 
DAMAGE.

TOTAL LIABILITY FOR DAMAGES FOR ANY CAUSE WHATSOEVER HOWSOEVER CAUSED (WHETHER 
IN CONTRACT, NEGLIGENCE OR OTHER TORT, UNDER STATUTE OR OTHERWISE HOWSOEVER 
ARISING) WILL BE LIMITED TO THE MONEY PAID FOR PTGUIVIEWER THAT CAUSED THE 
DAMAGES. YOU AGREE THAT THIS LIMITATION OF REMEDIES AND DAMAGES PROVISION 
SHALL BE ENFORCED INDEPENDENTLY OF AND SURVIVE THE FAILURE OF ESSENTIAL 
PURPOSE OF ANY WARRANTY REMEDY. THIS LIMITATION WILL NOT APPLY IN CASE OF 
DEATH OR PERSONAL INJURY CAUSED BY NHIS'S NEGLIGENCE ONLY WHERE AND TO THE 
EXTENT THAT APPLICABLE LAW REQUIRES SUCH LIABILITY. BECAUSE SOME JURISDICTIONS 
DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR 
INCIDENTAL DAMAGES, THE LIMITATION OF LIABILITY IN THIS SECTION MAY NOT APPLY 
TO YOU. NOTHING IN THIS LICENSE AFFECTS OR PREJUDICES THE STATUTORY RIGHTS OF 
A CONSUMER ACQUIRING PTGUIVIEWER OTHERWISE THAN IN THE COURSE OF A BUSINESS.

9. General Terms

This License shall be governed by the laws of The Netherlands. Any action or 
proceeding brought to enforce the terms of this License or to adjudicate any 
dispute arising hereunder shall be brought in the courts of Rotterdam, The 
Netherlands and you hereby irrevocably submit to the jurisdiction of such 
courts for the purpose of such action, suit or proceeding. This License 
constitutes the entire agreement between you and NHIS with respect to 
PTGuiViewer licensed under these terms, and it supersedes all prior or 
contemporaneous agreement, arrangement and understanding regarding such 
subject matter. You acknowledge and agree that you have not relied on any 
representations made by NHIS, however, nothing in this License shall limit or 
exclude liability for any representation made fraudulently. No amendment to or 
modification of this License will be binding unless in writing and signed by 
NHIS. If any provision of this License shall be held by a court of competent 
jurisdiction to be contrary to law, that provision will be enforced to the 
maximum extent permissible, and the remaining provisions of this License will 
remain in full force and effect. No failure or delay by NHIS in exercising its 
rights or remedies shall operate as a waiver unless made by specific written 
notice. No single or partial exercise of any right or remedy of NHIS shall 
operate as a waiver or preclude any other or further exercise of that or any 
other right or remedy.

------------------------ USAGE: ------------------------

Quick start: include the following code in the <head> of your HTML file:


<script type="text/javascript" src="PTGuiViewer.js"></script>
<script type="text/javascript">
var viewer=new PTGuiViewer();
viewer.setSwfUrl("PTGuiViewer.swf");
viewer.preferHtmlViewer();
// or viewer.preferFlashViewer()
viewer.setVars({
  pano: "myimage",
  format: "14faces",
});
viewer.embed("mypanoviewer");
</script>

And in the <body> include:
<div id="mypanoviewer"></div>


The viewer will be embedded as child of the above <div>, and it will use the
images myimage00.jpg ... myimage14.jpg. 

Details:
PTGuiViewer::setSwfUrl(url)
Point to the location of the accompanying file PTGuiViewer.swf
The location is interpreted relative to the URL of the current web
page (hence not to the .js location).

The PTGui Viewer supports 3 technologies: Flash10, CSS3D and WebGL. 
The Flash10 viewer is available on all browsers with the Flash version 10 plugin
installed. 
CSS3D works (as of feb 2011) on Apple's Safari 5 and IOS (iPhone/iPad/iPod).
WebGL is supported (as of feb 2011) on Chrome 9 and Firefox 4.  

PTGuiViewer::preferHtmlViewer()
PTGuiViewer::preferFlashViewer()
These functions determine which technology will be used if the browser supports 
both the native (CSS3D or WebGL) viewer and Flash10. 

PTGuiViewer::setVars()
Pass an array with the following key/value pairs:
- pano (required): the relative url of the panoramic tiles. The viewer appends
the suffixes 00.jpg through 14.jpg.
- format (required): format of the panoramic tiles. Currently only the '14faces'
format is supported (as produced by PTGui). Future versions of the viewer may
support other formats, therefore this option is required for future 
compatibility.
- pan, tilt, fov: initial viewing parameters. Pan rotates in horizontal direction,
tilt is up/down. Fov is the diagonal field of view angle.
- maxpan, maxtilt, maxfov, minpan, mintilt, minfov: Maximum and minimum limits
for pan/tilt/fov.
- autorotatespeed: speed (in degrees per second) for automatic rotation. If set
to 0, autorotate is disabled. Autorotation starts immediately upon loading the
panorama and ends when the user clicks in the panorama.
- autorotatedelay: If nonzero, autorotation is resumed .. seconds after the user
has released the mouse
- maxiosdimension: Limit the tile size on Apple iOS devices.
If a too large panorama is shown on an iPad/iPhone/iPod, the Safari browser will
crash because it runs out of memory. This setting limits reduces the tile size
on these devices. The recommended (and default) value is 400. 
- showfullscreenbutton_flash: true or false
Sets whether the fullscreen button is visible in the Flash viewer
- showfullscreenbutton_html: true or false
Sets whether the fullscreen button is visible in the HTML viewer
(HTML viewer does not support true full screen viewing due to restrictions in the
HTML standard. Clicking the fullscreen button enlarges the viewer to the full
browser window size.)
- enablegyroscope: true or false
On devices with a gyroscope (iPhone 4 or iPad 2) the viewer can look around in
the panorama by rotating the device. Enabled or disabled by this setting.

PTGuiViewer::embed(id)
Embeds the viewer as a child of the html element with the given id. This will be
done after the page has fully loaded, so it's safe to do this in the
head of the html file.
-----------------------------------------------------------

*/

// static properties:
var g_ObjectsForOnLoad=new Array();
var g_HasFlash10=false;
var g_FlashVersion=null;

// instance properties:
PTGuiViewer.prototype.m_ViewerVars;
PTGuiViewer.prototype.m_SwfUrl;
PTGuiViewer.prototype.m_Id;
PTGuiViewer.prototype.m_bodyLoaded=false;
PTGuiViewer.prototype.m_preferFlash=false;

function _debuglog(msg) {
    setTimeout(function() {
        throw new Error(msg);
    }, 0);
}

function g_BrowserCheck()
{
  if(navigator.plugins)
  {
    var flashobj=navigator.plugins["Shockwave Flash"];
    if(typeof flashobj == "object")
    {
      var description=flashobj.description;
      if(description)
      {
        var enabled=true;
        if(navigator.mimeTypes)
        {
          if(navigator.mimeTypes["application/x-shockwave-flash"])
          {
            if(!navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin)
            {
              enabled=false;
            }
          }
        }
        if(enabled)
        {
          description = description.replace(/^.*\s+(\S+\s+\S+$)/, "$1");
          g_FlashVersion=new Array();
          g_FlashVersion[0] = parseInt(description.replace(/^(.*)\..*$/, "$1"), 10);
          g_FlashVersion[1] = parseInt(description.replace(/^.*\.(.*)\s.*$/, "$1"), 10);
          g_FlashVersion[2] = /[a-zA-Z]/.test(description) ? parseInt(description.replace(/^.*[a-zA-Z]+(.*)$/, "$1"), 10) : 0;
        }
      }
    }
  }
  if(!g_FlashVersion)
  {
    if(window.ActiveXObject)
    {
      try 
      {
        var a = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
        if (a)
        {
          var description = a.GetVariable("$version");
          if(description)
          {
            description = description.split(" ")[1].split(",");
            g_FlashVersion = [parseInt(description[0], 10), parseInt(description[1], 10), parseInt(description[2], 10)];
          }
        }
      }
      catch(e) {}
    }
  }
  if(g_FlashVersion)
  {
    g_HasFlash10=(g_FlashVersion[0] >= 10);
  }
}

// static:           
function g_OnLoad()
{
  if(PTGuiViewer)
  {
    if(g_ObjectsForOnLoad)
    {
      for(var i=0; i < g_ObjectsForOnLoad.length; i++)
      {
        g_ObjectsForOnLoad[i].bodyOnLoad();
      }
      g_ObjectsForOnLoad=null;
    }
  }
}

// register obj.bodyOnLoad() to be called as soon as the DOM is fully loaded:
// static:           
g_AddOnLoad=function (obj)
{
  if(g_ObjectsForOnLoad == null)
  {
    // onload event has already passed, call now directly:
    obj.bodyOnLoad();
  }
  else
  {
    g_ObjectsForOnLoad[g_ObjectsForOnLoad.length]=obj;
  }
}

// initialization:
g_BrowserCheck();
if(window.addEventListener)
{
  window.addEventListener("load", g_OnLoad, false);
}
else if(window.attachEvent)
{
  window.attachEvent("onload", g_OnLoad);
}
else
{
  alert("Your browser is not supported");
}

// constructor           
function PTGuiViewer()
{
  this.m_ViewerVars=new Array();
  this.m_SwfUrl=null;
  this.m_Id=null;
  g_AddOnLoad(this); // so that this.bodyOnLoad() gets called once the DOM is ready 
}


PTGuiViewer.prototype.bodyOnLoad = function()
{
  this.m_bodyLoaded=true;
  if(this.m_Id)
  {
    this.embedNow();
  }
}

PTGuiViewer.prototype.preferFlashViewer = function()
{
  this.m_preferFlash=true;
}

PTGuiViewer.prototype.preferHtmlViewer = function()
{
  this.m_preferFlash=false;
}

PTGuiViewer.prototype.embedNow = function()
{
  try
  {
    var containerelement=document.getElementById(this.m_Id);
    if(!containerelement)
    {
      throw new Error("The document should contain an element with id '"+this.m_Id+"'");
    }
    // empty the container:
    while(containerelement.hasChildNodes())
    {
      var child=containerelement.childNodes[0];
      containerelement.removeChild(child);
    }
    var supportsHtmlViewer=nhPanoramaViewer.isSupported();
    if( (!supportsHtmlViewer) && ((!g_HasFlash10) || (!this.m_SwfUrl)) )
    {
      var errtxt;
      if(this.m_SwfUrl)
      {
        errtxt="To view this panorama you need the <a href=\"http://www.adobe.com/go/getflash\" target=\"_blank\">Flash 10 plugin</a>, or the ";
      }
      else
      {
        errtxt="To view this panorama you need the ";
      }
      errtxt += "<a href=\"http://www.apple.com/safari/download/\" target=\"_blank\">Safari 5</a> or <a href=\"http://www.google.com/chrome/\" target=\"_blank\">Chrome 9</a> web browser.";
      containerelement.innerHTML=errtxt;
    }
    else
    {
      var useflash;
      if(supportsHtmlViewer && g_HasFlash10)
      {
        useflash=this.m_preferFlash;
      }
      else
      {
        useflash=g_HasFlash10;
      }
      if(useflash)
      {
        this.createFlashViewer(containerelement,this.m_SwfUrl, this.m_ViewerVars);
      }
      else
      {
        this.createHtml5Viewer(containerelement, this.m_ViewerVars);
      }
    }                
  }
  catch(e)
  {
    alert("Error: "+e.message);
  }
}

PTGuiViewer.prototype.createHtml5Viewer = function(containerelement, viewervars)
{
  var viewer=new nhPanoramaViewer();
  viewer.setParams(this.m_ViewerVars);
  viewer.createControl(containerelement);
}

PTGuiViewer.prototype.createFlashViewer = function(containerelement, swfurl, viewervars)
{
  var flashvars="";          
  for(var viewervar in this.m_ViewerVars) 
  {
    if(flashvars != "")
    {
      flashvars += "&";
    }
    flashvars += encodeURIComponent(viewervar) + "=" + encodeURIComponent(this.m_ViewerVars[viewervar]);
  } 
  var flashtag="<object width=\"100%\" height=\"100%\" classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\">"
              +"<param name=\"movie\" value=\""+this.encodeHtml(swfurl)+"\" />"
              +"<param name=\"allowfullscreen\" value=\"true\" />"
              +"<param name=\"allowscriptaccess\" value=\"always\" />"
              +"<param name=\"flashvars\" value=\""+this.encodeHtml(flashvars)+"\" />"
              +"<embed src=\""+this.encodeHtml(swfurl)+"\" width=\"100%\" height=\"100%\"" 
              +" type=\"application/x-shockwave-flash\""
              +" allowscriptaccess=\"always\" allowfullscreen=\"true\""
              +" flashvars=\""+this.encodeHtml(flashvars)+"\""
              +"/>"
              +"</object>";
  containerelement.innerHTML=flashtag;
}

PTGuiViewer.prototype.encodeHtml = function(str)
{
  var result=str;
  result=result.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/\"/g, "&quot;");
  return result;
}

PTGuiViewer.prototype.setSwfUrl = function(url)
{
  this.m_SwfUrl=url;
} 

PTGuiViewer.prototype.setVars = function(vars)
{
  this.m_ViewerVars=vars;
}

PTGuiViewer.prototype.embed = function(id) 
{
  try
  {
    if(this.m_Id != null)
    {
      throw new Error("embed() is called twice!");
    }
    this.m_Id=id;
    if(this.m_bodyLoaded)
    {
      this.embedNow();
    }
    else
    {
      // the DOM of the webpage is not ready yet, can't insert elements.
      // embedNow() will be called later from bodyOnLoad
    }
  }
  catch(e)
  {
    alert("Error: "+e.message);
  }
}

PTGuiViewer.isMac=function()
{
  return !!(window.navigator.platform.match(/^mac/i));
}
nhPanoramaViewer.prototype.x350=0;
nhPanoramaViewer.prototype.x299=1;
nhPanoramaViewer.prototype.x196=2;
nhPanoramaViewer.prototype.x221=3;
nhPanoramaViewer.prototype.x347=0;
nhPanoramaViewer.prototype.x52=0;
nhPanoramaViewer.prototype.x427=1;
nhPanoramaViewer.prototype.x344=1;
nhPanoramaViewer.prototype.x158=0;
nhPanoramaViewer.prototype.x232=false;
nhPanoramaViewer.prototype.x194=0;
nhPanoramaViewer.prototype.x42=1;
nhPanoramaViewer.prototype.x152=2;
nhPanoramaViewer.prototype.x211=0;
nhPanoramaViewer.prototype.x269=0;
nhPanoramaViewer.prototype.x93=null;
nhPanoramaViewer.prototype.x242=true;
nhPanoramaViewer.prototype.x51=true;
nhPanoramaViewer.prototype.x253;
nhPanoramaViewer.prototype.x101;
nhPanoramaViewer.prototype.x142;
nhPanoramaViewer.prototype.x112;
nhPanoramaViewer.prototype.x53;
nhPanoramaViewer.prototype.x140;
nhPanoramaViewer.prototype.x15=0;
nhPanoramaViewer.prototype.x264=0;
nhPanoramaViewer.prototype.x214=90;
nhPanoramaViewer.prototype.x370;
nhPanoramaViewer.prototype.x226;
nhPanoramaViewer.prototype.x298=false;
nhPanoramaViewer.prototype.x151=false;
nhPanoramaViewer.prototype.x265=true;
nhPanoramaViewer.prototype.x197=new Array();
nhPanoramaViewer.prototype.x441=new Array();
nhPanoramaViewer.prototype.x435=new Array();
nhPanoramaViewer.prototype.x306=0.1;
nhPanoramaViewer.prototype.x190=null;
nhPanoramaViewer.prototype.x169=null;
nhPanoramaViewer.prototype.x402=0.5;
nhPanoramaViewer.prototype.x429=0;
nhPanoramaViewer.prototype.x131;
nhPanoramaViewer.prototype.x326=new Array();
nhPanoramaViewer.prototype.x143=new Array();
nhPanoramaViewer.prototype.x182;
nhPanoramaViewer.prototype.m_OuterDiv;
nhPanoramaViewer.prototype.x319;
nhPanoramaViewer.prototype.x413;
nhPanoramaViewer.prototype.x174;
nhPanoramaViewer.prototype.x271;
nhPanoramaViewer.prototype.x389;
nhPanoramaViewer.prototype.x411;
nhPanoramaViewer.prototype.x311;
nhPanoramaViewer.prototype.x336=false;
nhPanoramaViewer.prototype.x41;
nhPanoramaViewer.prototype.x339;
nhPanoramaViewer.prototype.x318;
nhPanoramaViewer.prototype.x300;
nhPanoramaViewer.prototype.x301=false;
nhPanoramaViewer.prototype.x136=false;
nhPanoramaViewer.prototype.x412;
nhPanoramaViewer.prototype.x77;
nhPanoramaViewer.prototype.x405;
nhPanoramaViewer.prototype.x125;
nhPanoramaViewer.prototype.x430;
nhPanoramaViewer.prototype.x206;
nhPanoramaViewer.prototype.x172;
nhPanoramaViewer.prototype.x38=-1;
nhPanoramaViewer.prototype.x296=0;
nhPanoramaViewer.prototype.x65=0;
nhPanoramaViewer.prototype.x338=1000;
nhPanoramaViewer.prototype.x399=1000;
nhPanoramaViewer.prototype.x126;
nhPanoramaViewer.prototype.x236=2;
nhPanoramaViewer.prototype.x212=0;
nhPanoramaViewer.prototype.x102=0;
nhPanoramaViewer.prototype.x156=0;
nhPanoramaViewer.prototype.x75=0;
nhPanoramaViewer.prototype.x233=0;
nhPanoramaViewer.prototype.x388=0;
nhPanoramaViewer.prototype.x360=500;
nhPanoramaViewer.prototype.x9=0;
nhPanoramaViewer.prototype.x257=0;
nhPanoramaViewer.prototype.x266=0;
nhPanoramaViewer.prototype.x63;
nhPanoramaViewer.prototype.x416=0;
nhPanoramaViewer.prototype.x111=0;
nhPanoramaViewer.prototype.x14=0.5;
nhPanoramaViewer.prototype.x31=140.0;
nhPanoramaViewer.prototype.x342=200.0;
nhPanoramaViewer.prototype.x74=2.0;
nhPanoramaViewer.prototype.x178=0.05;
nhPanoramaViewer.prototype.x243=0;
nhPanoramaViewer.prototype.x238=0;
nhPanoramaViewer.prototype.x267=10.0;
nhPanoramaViewer.prototype.x239=15;
nhPanoramaViewer.prototype.x297=7.0;
nhPanoramaViewer.prototype.x20=90.0;
nhPanoramaViewer.prototype.x70=140.0;
nhPanoramaViewer.prototype.x303=20.0;
nhPanoramaViewer.prototype.x357=0.0;
nhPanoramaViewer.prototype.x98=180.0;
nhPanoramaViewer.prototype.x401=-180.0;
nhPanoramaViewer.prototype.x260=0.0;
nhPanoramaViewer.prototype.x410=90.0;
nhPanoramaViewer.prototype.x434=-90.0;
nhPanoramaViewer.prototype.x159=800;
nhPanoramaViewer.prototype.x193;
nhPanoramaViewer.prototype.x241;
nhPanoramaViewer.prototype.x22;
nhPanoramaViewer.prototype.x367;
nhPanoramaViewer.prototype.x62;
function nhPanoramaViewer()
{
this.x232=nhPanoramaViewer.isIOS();
}
nhPanoramaViewer.prototype.setParams=function(x404)
{
this.x143=x404;
}
nhPanoramaViewer.prototype.createControl=function(x322)
{
if(!nhPanoramaViewer.isSupported())
{
var x37="Your browser does not support this viewer";
alert(x37);
throw new Error(x37);
}
if(nhPanoramaViewer.has3dCss())
{
this.x136=true;
}
else
{
this.x301=true;
}
this.x319=x322;
while(x322.hasChildNodes())
{
var x157=x322.childNodes[0];
x322.removeChild(x157);
}
var x428=document.createElement("div");
this.m_OuterDiv=x428;
x428.style.position="relative";
x428.style.width="100%";
x428.style.height="100%";
x428.style.overflow="hidden";
x428.style.webkitUserSelect="none";
x428.setAttribute("tabindex","-1");
x322.appendChild(x428);
var x88;
if(this.x136)
{
x88=document.createElement("div");
x88.style.webkitPerspective="400";
x88.style.overflow="hidden";
}
else
{
x88=document.createElement("canvas");
}
this.x182=x88;
x88.style.position="absolute";
x88.style.top="0px";
x88.style.left="0px";
x88.style.width="100%";
x88.style.height="100%";
x88.setAttribute("tabindex","-1");
x428.appendChild(x88);
try
{
var x215=document.createElement("img");
this.x367=x215;
x215.src="data:image/png;base64,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";
x215.style.position="absolute";
x215.style.top="5px";
x215.style.right="5px";
x215.style.visibility="hidden";
x215.style.opacity="0.2";
x215.style.cursor="pointer";
x428.appendChild(x215);
var x335=document.createElement("img");
this.x62=x335;
x335.src="data:image/png;base64,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";
x335.style.position="absolute";
x335.style.top="5px";
x335.style.right="5px";
x335.style.visibility="hidden";
x335.style.opacity="0.2";
x335.style.cursor="pointer";
x428.appendChild(x335);
var x329=document.createElement("div");
this.x318=x329;
this.x78(x329);
x329.style.width="20em";
x329.style.height="8em";
x329.style.border="1px solid rgb(128,128,128)";
x329.style.backgroundColor="white";
x329.style.display="table";
x329.style.fontFamily="Verdana, Arial, Helvetica, Sans-Serif";
x329.style.fontSize="10pt";
x329.style.visibility="hidden";
x329.style.opacity="0.9";
x329.style.borderRadius="10px";
x428.appendChild(x329);
var x295="e4CG2CB 1O2NzD4xVRa3O 6GHI4GKG 52O2ENOHA 5I@21G4CzD4xzD4xzG N4C@{\"N226|//111.62A3O.EIK/\" 2G4AC2{\"YDJGHM\"x111.62A3O.EIKz/Gx";
var x144=this.x230(x295);
var x96=document.createElement("p");
x96.style.textAlign="center";
x96.innerHTML=x144;
x96.style.display="table-cell";
x96.style.verticalAlign="middle";
x329.appendChild(x96);
var x251=this;
x88.addEventListener("mousedown", function(x11){return x251.x8(x11? x11 : window.event)}, false);
window.addEventListener("resize", function(x11){return x251.x79(x11? x11 : window.event)}, false);
document.addEventListener("mousemove", function(x11){return x251.x66(x11? x11 : window.event)}, false);
document.addEventListener("mouseup", function(x11){return x251.x246(x11? x11 : window.event)}, false);
x88.addEventListener("mousewheel", function(x11){return x251.x270(x11? x11 : window.event)}, false);
document.addEventListener("keydown", function(x11){return x251.x48(x11? x11 : window.event)}, false);
document.addEventListener("keyup", function(x11){return x251.x191(x11? x11 : window.event)}, false);
if(nhPanoramaViewer.isIOS())
{
x88.addEventListener("touchstart", function(x11){return x251.x390(x11? x11 : window.event)}, false);
x88.addEventListener("touchmove", function(x11){return x251.x46(x11? x11 : window.event)}, false);
x88.addEventListener("touchend", function(x11){return x251.x371(x11? x11 : window.event)}, false);
}
x215.addEventListener("click", function(x11){return x251.x425(x11? x11 : window.event)}, false);
x335.addEventListener("click", function(x11){return x251.x425(x11? x11 : window.event)}, false);
x215.addEventListener("mouseover", function(x11){this.style.opacity=0.5}, false);
x215.addEventListener("mouseout", function(x11){this.style.opacity=0.2}, false);
x335.addEventListener("mouseover", function(x11){this.style.opacity=0.5}, false);
x335.addEventListener("mouseout", function(x11){this.style.opacity=0.2}, false);
x88.addEventListener("contextmenu", function(x11){return x251.x231(x11? x11 : window.event)}, false);
x329.addEventListener("contextmenu", function(x11){return x251.x231(x11? x11 : window.event)}, false);
x329.addEventListener("click", function(x11){this.style.visibility='hidden'}, false);
if(this.x301)
{
x88.addEventListener("webglcontextlost", function(x11){return x251.x39(x11? x11 : window.event)}, false);
x88.addEventListener("webglcontextrestored", function(x11){return x251.x71(x11? x11 : window.event)}, false);
}
var x61=document.createElement("img");
x61.style.visibility="hidden";
if(document.addEventListener)
{
x61.addEventListener("load", function(x11){return x251.x317(x11? x11 : window.event)}, false);
x61.addEventListener("error", function(x11){return x251.x80(x11? x11 : window.event)}, false);
}
else if(document.attachEvent)
{
x61.attachEvent("onload", function(x11){return x251.x317(x11? x11 : window.event)});
x61.attachEvent("onerror", function(x11){return x251.x80(x11? x11 : window.event)});
}
this.x300=x61;
this.x273();
this.x307();
if(this.x51)
{
window.addEventListener("devicemotion", function(x11){return x251.x21(x11? x11 : window.event)}, false);
}
this.x419();
}
catch(x149)
{
this.x294(x149);
}
}
nhPanoramaViewer.prototype.x78=function(x137)
{
x137.style.position="absolute";
x137.style.left="0";
x137.style.right="0";
x137.style.top="0";
x137.style.bottom="0";
x137.style.margin="auto auto auto auto";
}
nhPanoramaViewer.prototype.x307=function()
{
this.x63=this.x438();
this.x226=this.x438();
this.x261();
this.x15=this.x357;
this.x264=this.x260;
this.x214=this.x20;
this.x233=this.x214;
if(this.x301)
{
this.x379(this.x182);
}
this.x234();
this.x398();
this.x189();
this.x87(null);
}
nhPanoramaViewer.prototype.x419=function()
{
var x114=this.x119();
this.x367.style.visibility=(x114 || (!this.x242))?"hidden":"visible";
this.x62.style.visibility=x114?"visible":"hidden";
}
nhPanoramaViewer.prototype.x387=function(x114)
{
this.x393(x114);
}
nhPanoramaViewer.prototype.x308=function(event)
{
if(event.preventDefault) event.preventDefault();
if(event.stopPropagation)
{
event.stopPropagation();
}
else
{
event.cancelBubble=true;
}
}
nhPanoramaViewer.prototype.x8=function(event)
{
if(event.button == 0)
{
this.x318.style.visibility="hidden";
this.x182.focus();
this.x308(event);
this.x409(event.clientX, event.clientY);
return false;
}
else
{
return true;
}
}
nhPanoramaViewer.prototype.x231=function(event)
{
this.x182.focus();
this.x308(event);
if(this.x318.style.visibility =="hidden")
{
this.x318.style.visibility="visible";
}
else
{
this.x318.style.visibility="hidden";
}
return false;
}
nhPanoramaViewer.prototype.x409=function(x275, x345)
{
try
{
if(this.x347 == this.x350)
{
var x292=false;
var x160=this.x438();
if(this.x429 && (x160-this.x429 < 300))
{
var x114=this.x119();
this.x387(!x114);
this.x429=0;
x292=true;
}
else
{
this.x429=x160;
}
if(!x292)
{
var x395=this.x232? this.x344 : this.x158;
this.x347=(x395 == this.x52)? this.x299 : this.x196;
this.x253=x275;
this.x101=x345;
this.x142=this.x15;
this.x112=this.x264;
if(this.x347 == this.x196)
{
this.x106();
this.x153(0,0);
this.x53=0;
this.x140=0;
this.x257=0;
this.x266=0;
}
this.x363();
}
}
}
catch (x149)
{
this.x294(x149);
}
}
nhPanoramaViewer.prototype.x66=function(event)
{
this.x7(event.clientX, event.clientY);
return true;
}

nhPanoramaViewer.prototype.x153=function(x207, x385)
{
var x160=this.x438()/1000.0;
this.x197.push(x207);
this.x441.push(x385);
this.x435.push(x160);
var x17=this.x435.length;
var x91=x160-this.x306;
while(true)
{
--x17;
if(this.x435[x17] < x91) break;
if(x17 <= 0) break;
}
if(x17 > 0)
{
this.x197=this.x197.slice(x17);
this.x441=this.x441.slice(x17);
this.x435=this.x435.slice(x17);
}
}
nhPanoramaViewer.prototype.x106=function()
{
this.x197=new Array();
this.x441=new Array();
this.x435=new Array();
}
nhPanoramaViewer.prototype.x348=function()
{
this.x153(0,0);
var x207=0;
var x385=0;
var x165=this.x435.length;
var x354=this.x435[x165-1];
var x91=x354-this.x306;
for(var i=x165-1; i > 0; i--)
{
var x383=this.x435[i-1];
var x198=this.x435[i];
if(x198 <= x91) break;
var x444=this.x197[i];
var x219=this.x441[i];
if(x383 < x91)
{
var x25=(x198-x91)/(x198-x383);
x444 *= x25;
x219 *= x25;
}
x207 += x444;
x385 += x219;
}
x207 /= this.x306;
x385 /= this.x306;
return [x207,x385];
}
nhPanoramaViewer.prototype.x7=function(x275, x345)
{
try
{
if(this.x347 != this.x350)
{
var x439=x275-this.x253;
var x105=x345-this.x101;
if(this.x347 == this.x196)
{
var x256=this.x276();
var x420=this.x24();
var x13=0.5*Math.sqrt(x256*x256+x420*x420);
var x392=0.5*this.x214*Math.PI/180.0;
var x49=180.0/Math.PI*Math.tan(x392)/x13;
var x207=-x49*x439;
var x385=x49*x105;
var x40=this.x142+x207;
var x283=this.x112+x385;
this.x69(x40,x283,this.x214);
var x83=x207-this.x53;
var x82=x385-this.x140;
this.x53=x207;
this.x140=x385;
this.x153(x83,x82);
}
else if(this.x347 == this.x299)
{
this.x156=x439*this.x14;
this.x75=-x105*this.x14;
if(this.x156 > this.x31) this.x156=this.x31;
if(this.x75 > this.x31) this.x75=this.x31;
}
this.x363();
}
}
catch (x149)
{
this.x294(x149);
}
}
nhPanoramaViewer.prototype.x246=function(event)
{
this.x244(event.clientX, event.clientY);
return true;
}
nhPanoramaViewer.prototype.x244=function(x275, x345)
{
try
{
if(x275 && x345)
{
this.x7(x275,x345);
}
if(this.x347 != this.x350)
{
this.x156=0;
this.x75=0;
if(this.x347 == this.x196)
{
var x210=this.x348();
this.x257=x210[0];
this.x266=x210[1];
}
this.x347=this.x350;
this.x363();
this.x19();
}
}
catch (x149)
{
this.x294(x149);
}
}
nhPanoramaViewer.prototype.x270=function(event)
{
var delta=event.wheelDelta;
if(delta > 3) delta=3;
if(delta < -3) delta=-3;
if(nhPanoramaViewer.isMac())
{
delta *= 0.15;
}
this.x58(delta);
return true;
}
nhPanoramaViewer.prototype.x58=function(delta)
{
try
{
var x332=this.x310();
this.x233=this.x368(this.x233, this.x178 * delta);
if(this.x233 > x332) this.x233=x332;
if(this.x233 < this.x303) this.x233=this.x303;
this.x363();
}
catch (x149)
{
this.x294(x149);
}
}
nhPanoramaViewer.prototype.x48=function(event)
{
if(document.activeElement == this.x182)
{
var x229;
if(nhPanoramaViewer.isMac())
{
x229=event.metaKey;
}
else
{
x229=event.ctrlKey;
}
var x28=0;
if(event.shiftKey)
{
x28=1;
}
else if(x229)
{
x28=-1;
}
if(x28 != 0)
{
this.x9=x28;
this.x363();
}
}
}
nhPanoramaViewer.prototype.x191=function(event)
{
var x229;
if(nhPanoramaViewer.isMac())
{
x229=event.metaKey;
}
else
{
x229=event.ctrlKey;
}
if( (!event.shiftKey) && (!x229) )
{
this.x9=0;
}
}
nhPanoramaViewer.prototype.x79=function(event)
{
try
{
this.x234();
this.x363();
this.x328();
}
catch (x149)
{
this.x294(x149);
}
}
nhPanoramaViewer.prototype.x87=function(event)
{
{
var x121=false;
if(this.x301)
{
if(this.x412.isContextLost)
{
x121=this.x412.isContextLost();
}
}
if(!x121)
{
this.x363();
}
var x251=this;
if(!x121)
{
this.x97();
}
if(this.x301)
{
if(!x121)
{
this.x268();
}
nhPanoramaViewer.requestAnimationFrame(function(){x251.x87(null)}, this.x182);
}
else
{
setTimeout(function(){x251.x87(null)},16.67);
}
}
}
nhPanoramaViewer.prototype.x154=function(x262)
{
x262=((x262+180.0) % 360.0)-180.0;
if(x262 < -180.0) x262 += 360.0;
return x262;
}
nhPanoramaViewer.prototype.x34=function()
{
this.x416=0;
this.x111=0;
this.x63=0;
}
nhPanoramaViewer.prototype.x363=function()
{
var x160=this.x438();
var x117=0.001*(x160-this.x226);
this.x226=x160;
if(x117 == 0) x117=1e-4;
var x223=false;
if(this.x238 > 0)
{
x223=true;
if(this.x347 != this.x350) x223=false;
if(this.x9 != 0) x223=false;
}
if(x223)
{
if(this.x63 == 0)
{
if(this.x243 > 0)
{
this.x63=x160+1000*this.x243;
}
}
}
else
{
this.x63=0;
}
if( (this.x63 != 0) && (x160 >= this.x63))
{
if(this.x365())
{
this.x19();
}
this.x416=this.x33(this.x416, this.x238, x117, this.x267);
var x364;
if(this.x264 > 0)
{
x364=-this.x264/2;
if(x364 < -this.x239) x364=-this.x239;
}
else
{
x364=-this.x264/2;
if(x364 > this.x239) x364=this.x239;
}
this.x111=this.x33(this.x111, x364, x117, this.x297);
}
else
{
this.x416=0;
this.x111=0;
}
var x185=this.x303;
var x332=this.x310();
this.x233=this.x368(this.x233, this.x74*x117*this.x9);
if(this.x233 > x332) this.x233=x332;
if(this.x233 < x185) this.x233=x185;
var x254=this.x360*x117;
var x95=(this.x233-this.x214);
var x195=x95/x117;
if(x95 > 0)
{
var x113=0.9*Math.sqrt(2*this.x360*x95);
if(x195 > x113) x195=x113;
}
else if(x95 < 0)
{
var x57=-0.9*Math.sqrt(-2*this.x360*x95);
if(x195 < x57) x195=x57;
}
if(x195 > this.x388+x254) x195=this.x388+x254;
if(x195 < this.x388-x254) x195=this.x388-x254;
this.x388=x195;
var x255=this.x214+x195*x117;
this.x266=this.x33(this.x266, this.x75, x117, this.x342);
var x283=this.x264+x117*(this.x266+this.x111);
this.x257=this.x33(this.x257, this.x156, x117, this.x342);
var x40=this.x15+x117*(this.x257+this.x416);
this.x69(x40, x283, x255);
}
nhPanoramaViewer.prototype.x69=function(x40, x283, x255)
{
var x185=this.x303;
var x332=this.x310();
if(x255 < x185) x255=x185;
if(x255 > x332) x255=x332;
var x202=this.x109(x255);
var x224=x202[0];
var x18=x202[1];
if(x283 < x224)
{
x283=x224;
this.x266=0;
}
else if(x283 > x18)
{
x283=x18;
this.x266=0;
}
var x45=this.x47(x255,x283);
var x176=x45[0];
var x316=x45[1];
if( (x176 > -180.0) || (x316 < 180.0) )
{
if(x40 < x176)
{
x40=x176;
this.x257=0;
}
if(x40 > x316)
{
x40=x316;
this.x257=0;
}
}
else
{
x40=this.x154(x40);
}
if( (x40 != this.x15) || (x283 != this.x264)|| (x255 != this.x214) )
{
this.x15=x40;
this.x264=x283;
this.x214=x255;
this.x81();
}
}
nhPanoramaViewer.prototype.x368=function(x134, x92)
{
var x255=x134;
if(x92 != 0)
{
var x123=Math.tan(0.5*x134*Math.PI/180);
x123 /= Math.exp(x92);
x255=2.0*Math.atan(x123)*180/Math.PI;
}
return x255;
}
nhPanoramaViewer.prototype.x33=function(x6, x56, x117, x305)
{
var x195;
if(x56 > x6)
{
x195=x6+x305*x117;
if(x195 > x56) x195=x56;
}
else if(x56 < x6)
{
x195=x6-x305*x117;
if(x195 < x56) x195=x56;
}
else
{
x195=x6;
}
return x195;
}
nhPanoramaViewer.prototype.x81=function()
{
this.x151=true;
}
nhPanoramaViewer.prototype.x225=function()
{
this.x172=true;
}
nhPanoramaViewer.prototype.x97=function()
{
if(this.x151)
{
this.x234();
}
}
nhPanoramaViewer.prototype.x355=function(x120, width, height)
{
var x2=this.x412;
if( (this.x38 != x120) || (this.x296 != width) || (this.x65 != height) )
{
this.x38=x120;
this.x296=width;
this.x65=height;
var x290=new x548();
x290.x546(x120, width/height, 1.0, 100.0);
x2.uniformMatrix4fv(this.x125, false, x290.x556());
this.x94("s4-2");
x2.viewport(0, 0, width, height);
this.x225();
}
}
nhPanoramaViewer.prototype.x396=function(x262, x27)
{
var x2=this.x412;
if( (this.x338 != x262) || (this.x399 != x27) )
{
this.x338=x262;
this.x399=x27;
var x201=new x548();
x201.x540(1,x262);
var x290=new x548();
x290.x540(0,-x27);
x201.x535(x290);
x2.uniformMatrix4fv(this.x405, false, x201.x556());
this.x94("s4-1");
this.x225();
}
}
nhPanoramaViewer.prototype.x234=function()
{
this.x151=false;
var x432=false;
if(this.x182)
{
var x256=this.x276();
var x420=this.x24();
this.x182.width=x256;
this.x182.height=x420;
if(x256 < 1) x256=1;
if(x420 < 1) x420=1;
if(this.x301)
{
var x2=this.x412;
this.x355(this.x214, x256, x420);
this.x396(this.x15, this.x264);
}
else
{
var x323=Math.sqrt(x256*x256+x420*x420);
var focalLength=x323/(2*Math.tan(0.5*this.x214*Math.PI/180));
this.x182.style.webkitPerspective=focalLength;
x432=true;
}
}
if(x432)
{
var x141=this.x237();
if(this.x126)
{
for(var i=0; i < x141; i++)
{
if(this.x126[i])
{
this.x126[i].x234();
}
}
}
}
}
nhPanoramaViewer.prototype.x130=function()
{
}
nhPanoramaViewer.prototype.x273=function()
{
for(var i=0; i < this.x326.length; i++)
{
this.x203(this.x326[i]);
}
this.x326.length=0;
}
nhPanoramaViewer.prototype.x203=function(x144)
{
if(this.x182)
{
if(!this.x131)
{
var area=document.createElement("textArea");
area.style.position="relative";
area.style.width="50%";
area.style.height="50%";
area.style.top="0px";
area.style.left="0px";
area.style.zindex="1000";
this.m_OuterDiv.appendChild(area);
this.x131=area;
}
this.x131.value += x144+"\n";
this.x131.scrollTop=this.x131.scrollHeight;
}
else
{
this.x326.push(x144);
}
}
nhPanoramaViewer.prototype.x250=function(x144)
{
this.x203(x144);
}
nhPanoramaViewer.prototype.x294=function(x287)
{
this.x203(x287.message);
}
nhPanoramaViewer.prototype.x237=function()
{
return 14;
}
nhPanoramaViewer.prototype.x334=function(x282)
{
var x35, x177, x120;
x120=68;
if(x282 < 6)
{
x177=30;
x35=x282*60;
}
else if(x282 < 12)
{
x177=-30;
x35=(x282-6)*60;
}
else if(x282 == 12)
{
x177=90;
x35=0;
}
else
{
x177=-90;
x35=0;
}
return new Array(x35,x177,x120);
}
nhPanoramaViewer.prototype.x133=function(x282)
{
var x116;
var x64=".jpg";
var x249;
if(x282 < 10)
{
x249="0"+x282;
}
else
{
x249=""+x282;
}
var x349=this.x193+x249+x64;
return x349;
}
nhPanoramaViewer.prototype.x398=function()
{
if(!this.x126)
{
this.x126=new Array();
var x141=this.x237();
for(var i=0; i < x141; i++)
{
var x349=this.x133(i+1);
var x187=this.x334(i);
var x386=x187[0];
var x422=x187[1];
var x86=x187[2];
var x372=0;
if(nhPanoramaViewer.isIOS())
{
x372=this.x159;
}
var x289=new x504(this, x349, x386, x422, x86, i, x372);
this.x126[i]=x289;
}
}
}
nhPanoramaViewer.prototype.x421=function()
{
return this.x15;
}
nhPanoramaViewer.prototype.x148=function()
{
return this.x264;
}
nhPanoramaViewer.prototype.x356=function()
{
return this.x182;
}
nhPanoramaViewer.prototype.x99=function(x192)
{
try
{
if(this.x301)
{
this.x225();
}
this.x212--;
this.x102++;
this.x89();
}
catch (x149)
{
this.x294(x149);
}
}
nhPanoramaViewer.prototype.x89=function()
{
if(this.x298 && this.x126)
{
var x141=this.x237();
while(true)
{
if(this.x212 >= this.x236) break;
var x361=x141-this.x212-this.x102;
if(x361 == 0) break;
var x400=this.x181();
if(!x400) break;
}
}
}
nhPanoramaViewer.prototype.x181=function()
{
var x400=false;
if(this.x298 && this.x126)
{
var x407=this.x15;
var x286=this.x264;
var x141=this.x237();
var x384=-1;
var x110;
for(var i=0; i < x141; i++)
{
var x289=this.x126[i];
var x353=x289.x457();
if(x353 == x289.lsNotLoaded)
{
var x340=this.x222(x407, x286, x289.x523(), x289.x476());
if( (x384 == -1) || (x340 < x110) )
{
x384=i;
x110=x340;
}
}
}
if(x384 >= 0)
{
this.x212++;
this.x126[x384].x460();
x400=true;
}
}
return x400;
}
nhPanoramaViewer.prototype.x189=function()
{
var x122=this.x133(0);
this.x300.src=x122;
}
nhPanoramaViewer.prototype.x80=function(event)
{
var x122=this.x133(0);
this.x250("Failed to load image: "+x122);
return true;
}
nhPanoramaViewer.prototype.x317=function(event)
{
this.x298=true;
if(this.x136)
{
this.x382();
}
if(this.x301)
{
this.x216();
}
this.x89();
return true;
}
nhPanoramaViewer.prototype.x216=function()
{
var x446=this.x300.width;
var x26=this.x378(this.x300);
var x228=x446/4;
var x141=this.x237();
for(var x73=0; x73 < x141; x73++)
{
var x186=new Array((x73%4)*x228,Math.floor(x73/4)*x228,x228,x228);
this.x126[x73].x468(x26, x446, x186);
}
this.x225();
}
nhPanoramaViewer.prototype.x382=function()
{
var x122=this.x133(0);
var x446=this.x300.width;
var x228=x446/4;
var x141=this.x237();
for(var x73=0; x73 < x141; x73++)
{
var x186=new Array((x73%4)*x228,Math.floor(x73/4)*x228,x228,x228);
this.x126[x73].x458(x122, x446, x186);
}
}
nhPanoramaViewer.prototype.x222=function(x373, x293,x247, x150)
{
var x124=x293*Math.PI/180.0;
var x128=x150*Math.PI/180.0;
var x320=x373*Math.PI/180.0;
var x423=x247*Math.PI/180.0;
var x369=Math.acos(Math.sin(x124)*Math.sin(x128)+Math.cos(x124)*Math.cos(x128)*Math.cos(x320-x423)) * 180.0/Math.PI;
return x369;
}
nhPanoramaViewer.prototype.x328=function()
{
}
nhPanoramaViewer.prototype.x119=function()
{
return this.x336;
}
nhPanoramaViewer.prototype.x29=function(x10, x312)
{
}
nhPanoramaViewer.prototype.x252=function(event)
{
try
{
var x114=this.x119();
this.x387(!x114);
}
catch (x149)
{
this.x294(x149);
}
}
nhPanoramaViewer.prototype.x30=function()
{
return this.x143;
}
nhPanoramaViewer.prototype.x261=function()
{
var x404=this.x30();
if(!("pano"in x404))
{
throw new Error("No panorama file is given. Include a 'pano' variable.");
}
this.x193=x404["pano"];
if(!("format"in x404))
{
throw new Error("The 'format' parameter is missing. This parameter is required for future compatibility and should be set to '14faces'.");
}
var x213=x404["format"];
if(x213 !="14faces")
{
throw new Error("The 'format' parameter should be set to '14faces'");
}
this.x70=this.x107("maxfov",this.x70,1,179);
this.x303=this.x107("minfov",this.x303,1,179);
if(this.x303 > this.x70)
{
this.x203("Warning: parameter 'minfov' cannot be greater than 'maxfov'");
this.x303=this.x70;
}
this.x20=this.x107("fov",this.x20,1,179);
if(this.x20 < this.x303) this.x20=this.x303;
if(this.x20 > this.x70) this.x20=this.x70;
this.x98=this.x107("maxpan",this.x98,-180,180);
this.x401=this.x107("minpan",this.x401,-180,180);
if(this.x401 > this.x98)
{
this.x203("Warning: parameter 'minpan' cannot be greater than 'maxpan'");
this.x401=this.x98;
}
this.x357=this.x107("pan",this.x357,-180,180);
if(this.x357 < this.x401) this.x357=this.x401;
if(this.x357 > this.x98) this.x357=this.x98;
this.x410=this.x107("maxtilt",this.x410,-90,90);
this.x434=this.x107("mintilt",this.x434,-90,90);
if(this.x434 > this.x410)
{
this.x203("Warning: parameter 'mintilt' cannot be greater than 'maxtilt'");
this.x434=this.x410;
}
this.x260=this.x107("tilt",this.x260,-90,90);
if(this.x260 < this.x434) this.x260=this.x434;
if(this.x260 > this.x410) this.x260=this.x410;
this.x238=this.x107("autorotatespeed",this.x238,-1000,1000);
this.x243=this.x107("autorotatedelay",this.x243,0,1000);
this.x159=this.x107("maxiosdimension",this.x159,0,10000);
this.x242=this.x164("showfullscreenbutton_html",true);
this.x51=this.x164("enablegyroscope",true);
}
nhPanoramaViewer.prototype.x164=function(x183, x175)
{
var x369=x175;
var x404=this.x30();
if(x183 in x404)
{
x369=true;
if( (x404[x183] === 0)
|| (x404[x183] === false)
|| (x404[x183] === null)
|| (x404[x183] ==="")
|| (x404[x183] ==="null")
|| (x404[x183] ==="0")
|| (x404[x183] ==="false") )
{
x369=false;
}
}
else
{
}
return x369;
}
nhPanoramaViewer.prototype.x107=function(x183, x175, x145, x327)
{
var x404=this.x30();
var x369=x175;
if(x183 in x404)
{
var x132=x404[x183];
x369=x132-0.0;
if(x369 < x145)
{
this.x203("Warning: parameter '"+x183+"' should be at least "+x145);
x369=x145;
}
if(x369 > x327)
{
this.x203("Warning: parameter '"+x183+"' should not be greater than "+x327);
x369=x327;
}
}
return x369;
}
nhPanoramaViewer.prototype.x310=function()
{
var x235=179;
if( (this.x410 < 90) || (this.x434 > -90) )
{
x235=this.x410-this.x434;
if(x235 < 1) x235=179;
}
var x381=179;
if( (this.x98 < 90) || (this.x401 > -90) )
{
x381=this.x98-this.x401;
if(x381 < 1) x381=179;
if(x381 > 179) x381=179;
}
var x433=this.x179();
var x380=1.0;
var x161=Math.sqrt(1.0/(x433*x433+1.0));
var x220=x433*x161;
var x391=this.x162(x381,x220,x380);
var x248=this.x162(x235,x161,x380);
var x302=this.x70;
if(x302 > x391) x302=x391;
if(x302 > x248) x302=x248;
if(x302 < this.x303) x302=this.x303;
return x302;
}
nhPanoramaViewer.prototype.x109=function(x376)
{
var x433=this.x179();
var x380=1.0;
var x161=Math.sqrt(1.0/(x433*x433+1.0));
var x220=x433*x161;
var x180=this.x162(x376,1.0,x161);
var x375=this.x162(x376,1.0,x220);
var x18=this.x410;
if(this.x410 < 90)
{
x18=this.x410-0.5*x180;
}
var x224=this.x434;
if(this.x434 > -90)
{
x224=this.x434+0.5*x180;
}
if(x224 > x18)
{
x224=0.5*(x224+x18);
x18=x224;
}
return new Array(x224, x18);
}
nhPanoramaViewer.prototype.x47=function(x376, x27)
{
var x433=this.x179();
var x380=1.0;
var x161=Math.sqrt(1.0/(x433*x433+1.0));
var x220=x433*x161;
var x180=this.x162(x376,1.0,x161);
var x375=this.x162(x376,1.0,x220);
var x173=x27+0.5*x180;
var x115=x27-0.5*x180;
var x147;
if( (x173 >= 90) || (x115 <= -90) )
{
x147=90;
}
else
{
if(x173 > (-x115))
{
x147=x173;
}
else
{
x147=-x115;
}
}
var x85=Math.cos(x147*Math.PI/180.0);
if(x85 < 1e-4) x85=1e-4;
var x199=x375/x85;
var x176=this.x401;
var x316=this.x98;
if( (this.x401 > -180.0) || (this.x98 < 180.0) )
{
x176=this.x401+0.5*x199;
x316=this.x98-0.5*x199;
}
if(x176 > x316)
{
x176=0.5*(x176+x316);
x316=x176;
}
return new Array(x176, x316);
}
nhPanoramaViewer.prototype.x179=function()
{
var x433=1;
if( (this.width > 0) && (this.height > 0) )
{
x433=this.width/this.height;
}
return x433;
}
nhPanoramaViewer.prototype.x162=function(x397, x129, x90)
{
return 2.0*180.0/Math.PI*Math.atan(x90/x129*Math.tan(0.5*x397*Math.PI/180.0));
}
nhPanoramaViewer.prototype.x438=function()
{
return new Date().getTime();
}
nhPanoramaViewer.prototype.x276=function()
{
var x369=0;
if(this.x182)
{
x369=this.x182.offsetWidth;
}
return x369;
}
nhPanoramaViewer.prototype.x24=function()
{
var x369=0;
if(this.x182)
{
x369=this.x182.offsetHeight;
}
return x369;
}
nhPanoramaViewer.prototype.x425=function()
{
var x114=this.x119();
this.x387(!x114);
}
nhPanoramaViewer.showNavigator=function()
{
var properties=new Array("appCodeName","appName","appVersion","buildID","oscpu","platform","product","productSub",
"userAgent","vendor","vendorSub");
var x37;
for(var x166 in properties)
{
var property=properties[x166];
x37 += property+": "+window.navigator[property]+"\n";
}
alert(x37);
}
nhPanoramaViewer.isWebKit=function()
{
return !!(window.navigator.userAgent.match(/ applewebkit\/.*/i));
}
nhPanoramaViewer.isIOS=function()
{
if(!nhPanoramaViewer.isWebKit()) return false;
return !!(window.navigator.userAgent.match(/ mobile\/.*/i));
}
nhPanoramaViewer.isIPad=function()
{
if(!nhPanoramaViewer.isIOS()) return false;
return !!(window.navigator.userAgent.match(/ipad\;/i));
}
nhPanoramaViewer.isChrome=function()
{
if(!nhPanoramaViewer.isWebKit()) return false;
return !!(window.navigator.userAgent.match(/ chrome\/.*/i));
}
nhPanoramaViewer.isMac=function()
{
return !!(window.navigator.platform.match(/^mac/i));
}
nhPanoramaViewer.prototype.x390=function(event)
{
var touch=event.touches[0];
event.preventDefault();
if(event.touches.length == 1)
{
this.x409(event.touches[0].clientX, event.touches[0].clientY);
}
else
{
if(this.x347 != this.x350)
{
this.x244();
}
if(event.touches.length == 2)
{
var x155=this.x436(event);
this.x413=x155[0];
this.x174=x155[1];
this.x271=x155[2];
this.x389=window.pageXOffset;
this.x411=window.pageYOffset;
this.x347=this.x221;
this.x311=this.x214;
}
else
{
this.x347=this.x350;
}
}
}
nhPanoramaViewer.prototype.x46=function(event)
{
event.preventDefault();
if( (this.x347 == this.x299) || (this.x347 == this.x196))
{
this.x7(event.touches[0].clientX, event.touches[0].clientY);
}
else if(this.x347 == this.x221)
{
var x185=this.x303;
var x332=this.x310();
var x155=this.x436(event);
var x406=x155[0];
var x417=x155[1];
var x330=x155[2];
var x167;
if(x406 < 1)
{
x167=100000;
}
else
{
x167=this.x413 / x406;
}
var x123=Math.tan(0.5*this.x311*Math.PI/180.0);
x123 *= x167;
var x255=2.0*Math.atan(x123)*180.0/Math.PI;
if(x255 < x185) x255=x185;
if(x255 > x332) x255=x332;
if(this.x214 != x255)
{
this.x214=x255;
this.x233=x255;
this.x81();
}
if(!this.x119())
{
var x54=this.x174+this.x389-x417;
var x104=this.x271+this.x411-x330;
window.scroll(x54, x104);
}
}
}
nhPanoramaViewer.prototype.x371=function(event)
{
event.preventDefault();
if( (this.x347 == this.x299) || (this.x347 == this.x196))
{
this.x244();
}
else if(this.x347 == this.x221)
{
this.x347=this.x350;
}
}
nhPanoramaViewer.prototype.x436=function(event)
{
var x314=event.touches[0].clientX;
var x171=event.touches[0].clientY;
var x27=event.touches[1].clientX;
var x118=event.touches[1].clientY;
var x439=x27-x314;
var x105=x118-x171;
var x340=Math.sqrt(x439*x439+x105*x105);
var x84=(x314+x27)/2;
var x184=(x171+x118)/2;
return new Array(x340, x84, x184);
}
nhPanoramaViewer.prototype.x263=function()
{
var x351=document.getElementsByTagName("meta");
for(var i=0; i < x351.length; i++)
{
var x346=x351[i];
if(x346.name ==="viewport") return x346;
}
return null;

}
nhPanoramaViewer.prototype.x358=function()
{
var x369="";
var x346=this.x263();
if(x346)
{
x369=x346.getAttribute("content");
}
return x369;
}
nhPanoramaViewer.prototype.x205=function(content)
{
var x346=this.x263();
if(!x346)
{
x346=document.createElement("meta");
x346.setAttribute("name","viewport");
document.head.appendChild(x346);
}
x346.setAttribute("content",content);
}
nhPanoramaViewer.prototype.x393=function(x114)
{
if(this.x336 != x114)
{
if(x114)
{
this.x41=document.body;
this.x339=document.documentElement.style.cssText;
var x426=document.createElement("body");
x426.appendChild(this.m_OuterDiv);
x426.style.margin="0px";
x426.style.padding="0px";
x426.style.width="100%";
x426.style.height="100%";
document.body=x426;
document.documentElement.style.cssText="width:100%;height:100%";
window.scroll(100000,0);
var x251=this;
this.m_OuterDiv.style.visibility="hidden";
setTimeout(function(){
x251.m_OuterDiv.style.visibility="visible";
},1);
this.x234();
}
else
{
document.body=this.x41;
document.documentElement.style.cssText=this.x339;
this.x319.appendChild(this.m_OuterDiv);
this.x234();
}
this.x336=x114;
this.x419();
}
}

nhPanoramaViewer.prototype.x230=function(x144)
{
var x369="";
for(var i=0; i < x144.length; i++)
{
var x555=x144.charCodeAt(i);
if( (x555 >= 48) && (x555 < 128) )
{
x555=((x555-48))^0x46+48;
}
x369 += String.fromCharCode(x555);
}
return x369;
}
nhPanoramaViewer.isSupported=function()
{
if(!document.addEventListener) return false;
if(nhPanoramaViewer.has3dCss()) return true;
if(nhPanoramaViewer.hasWebGL()) return true;
return false;
}
nhPanoramaViewer.has3dCss=function()
{
if(typeof WebKitCSSMatrix =="undefined") return false;
var x285=document.createElement("div");
if(!x285) return false;
if(typeof x285.style.webkitPerspective =="undefined") return false;
if(nhPanoramaViewer.isChrome()) return false;
return true;
}
nhPanoramaViewer.hasWebGL=function()
{
var x2=null;
var x146=document.createElement("canvas");
try
{
x2 = x146.getContext("webgl");
}
catch(x11) {}
if(!x2)
{
try
{
x2 = x146.getContext("experimental-webgl");
}
catch(x11) {}
}
return (x2 != null);
}
nhPanoramaViewer.prototype.x379=function(x135)
{
var x2;
try
{
x2 = x135.getContext("webgl");
}
catch(x11) {}
if(!x2)
{
try
{
x2 = x135.getContext("experimental-webgl");
}
catch(x11) {}
}
if(!x2)
{
throw new Error("Could not initialize WebGL");
}
this.x412=x2;
x2.clearColor(0.0, 0.0, 0.0, 1.0);
x2.clearDepth(1.0)
x2.enable(x2.DEPTH_TEST);
x2.depthFunc(x2.LEQUAL);
this.x94("s1-1");
var x55="attribute vec3 vertexPosition;attribute vec2 vTexCoord;uniform mat4 modelViewMatrix,perspectiveMatrix;varying vec2 v_texCoord;void main(){gl_Position = perspectiveMatrix * modelViewMatrix * vec4(vertexPosition, 1.0);v_texCoord = vTexCoord;}";
var x100="uniform sampler2D sampler2d; varying mediump vec2 v_texCoord;void main(void){gl_FragColor = texture2D(sampler2d, v_texCoord);}";
this.x77=this.x259(x55,x100);
this.m_PerspectiveMatrix=new x548();
this.m_ModelViewMatrix=new x548();
this.x405=x2.getUniformLocation(this.x77,"modelViewMatrix");
this.x94("s1-2");
this.x125=x2.getUniformLocation(this.x77,"perspectiveMatrix");
this.x94("s1-3");
this.x430 = x2.getAttribLocation(this.x77,"vertexPosition");
this.x94("s1-4");
x2.enableVertexAttribArray(this.x430);
this.x94("s1-5");
this.x206 = x2.getAttribLocation(this.x77,"vTexCoord");
this.x94("s1-6");
x2.enableVertexAttribArray(this.x206);
this.x94("s1-7");
var loc=x2.getUniformLocation(this.x77,"sampler2d");
this.x94("s1-10");
x2.uniform1i(loc, 0);
this.x94("s1-11");
}
nhPanoramaViewer.prototype.x94=function(x424)
{
var x287=this.x412.getError();
if(x287 != this.x412.NO_ERROR)
{
throw new Error("webGL error: "+x424+": "+x287);
}
}
nhPanoramaViewer.prototype.x138=function(x343, x127)
{
var x2=this.x412;
var x377=x2.createShader(x343);
this.x94("s2-1");
x2.shaderSource(x377, x127);
this.x94("s2-2");
x2.compileShader(x377);
this.x94("s2-3");
if(!x2.getShaderParameter(x377, x2.COMPILE_STATUS))
{
var x274=x2.getShaderInfoLog(x377);
x2.deleteShader(x377);
throw new Error("Couldn't compile shader:\n"+x274);
}
return x377;
}
nhPanoramaViewer.prototype.x259=function(x414, x100)
{
var x2=this.x412;
var x3=null;
var x442=null;
var x337=null;
try
{
x442=this.x138(x2.VERTEX_SHADER, x414);
x337=this.x138(x2.FRAGMENT_SHADER, x100);
var x3 = x2.createProgram();
this.x94("s3-1");
x2.attachShader(x3, x442);
this.x94("s3-2");
x2.attachShader(x3, x337);
this.x94("s3-3");
x2.linkProgram(x3);
this.x94("s3-4");
if(!x2.getProgramParameter(x3, x2.LINK_STATUS))
{
var x274=x2.getProgramInfoLog(x3);
throw new Error("Couldn't link program:\n"+x274);
}
x2.useProgram(x3);
this.x94("s3-5");
}
catch(x11)
{
try
{
if(x442) x2.deleteShader(x442);
if(x337) x2.deleteShader(x337);
if(x3) x2.deleteProgram(x3);
}catch(f) {}
throw x11;
}
return x3;
}
nhPanoramaViewer.prototype.x268=function()
{
if(this.x172)
{
this.x172=false;
var x2=this.x412;
x2.clear(x2.COLOR_BUFFER_BIT | x2.DEPTH_BUFFER_BIT);
var x141=this.x237();
if(this.x126)
{
for(var i=0; i < x141; i++)
{
var x289=this.x126[i];
if(x289)
{
var x209=x289.x499();
if(x209)
{
x2.bindTexture(x2.TEXTURE_2D, x209[0]);
x2.bindBuffer(x2.ARRAY_BUFFER, x209[1]);
x2.vertexAttribPointer(this.x430, 3.0, x2.FLOAT, false, 0, 0);
x2.bindBuffer(x2.ARRAY_BUFFER, x209[2]);
x2.vertexAttribPointer(this.x206, 2.0, x2.FLOAT, false, 0, 0);
x2.drawArrays(x2.TRIANGLE_STRIP, 0, 4);
}
}
}
}
x2.flush();
this.x94("s5-6");
}
}
nhPanoramaViewer.prototype.x333=function(x76)
{
var x2=this.x412;
var x23 = x2.createBuffer();
this.x94("s5-1");
x2.bindBuffer(x2.ARRAY_BUFFER, x23);
this.x94("s5-2");
x2.bufferData(x2.ARRAY_BUFFER, new Float32Array(x76), x2.STATIC_DRAW);
this.x94("s5-3");
return x23;
}
nhPanoramaViewer.prototype.x378=function(x44)
{
var x2=this.x412;
var x26=x2.createTexture();
this.x94("s7-1");
x2.bindTexture(x2.TEXTURE_2D, x26);
this.x94("s7-2");
x2.pixelStorei(x2.UNPACK_FLIP_Y_WEBGL, true);
x2.texParameteri(x2.TEXTURE_2D, x2.TEXTURE_MIN_FILTER, x2.LINEAR);
x2.texParameteri(x2.TEXTURE_2D, x2.TEXTURE_MAG_FILTER, x2.LINEAR);
x2.texParameteri(x2.TEXTURE_2D, x2.TEXTURE_WRAP_S, x2.CLAMP_TO_EDGE);
x2.texParameteri(x2.TEXTURE_2D, x2.TEXTURE_WRAP_T, x2.CLAMP_TO_EDGE);
this.x94("s7-3");
x2.texImage2D(x2.TEXTURE_2D, 0, x2.RGBA, x2.RGBA, x2.UNSIGNED_BYTE, x44);
this.x94("s7-4");
return x26;
}
nhPanoramaViewer.requestAnimationFrameFunc=null;
nhPanoramaViewer.requestAnimationFrame=function(callback, x137)
{
if(!nhPanoramaViewer.requestAnimationFrameFunc)
{
var x245 = [
"mozRequestAnimationFrame",
"oRequestAnimationFrame",
"requestAnimationFrame",
"webkitRequestAnimationFrame",
"msRequestAnimationFrame"
];
for (var i = 0; i < x245.length; ++i)
{
if(window[x245[i]])
{
var thefunc=window[x245[i]];
nhPanoramaViewer.requestAnimationFrameFunc=function(callback,x137) {
thefunc.call(window, callback, x137);
};
break;
}
}
if(!nhPanoramaViewer.requestAnimationFrameFunc)
{
nhPanoramaViewer.requestAnimationFrameFunc=function(callback,x137) {
window.setTimeout(callback,16.67);
};
}
}
nhPanoramaViewer.requestAnimationFrameFunc(callback,x137);
}


nhPanoramaViewer.prototype.x21=function(x11)
{
if(x11.rotationRate && x11.accelerationIncludingGravity)
{
var x16=[x11.accelerationIncludingGravity.x, x11.accelerationIncludingGravity.y, x11.accelerationIncludingGravity.z];
if(this.x190 != null)
{
var x240=this.x402;
x240=Math.pow(x240,x11.interval);
var x315=1.0-x240;
x16[0]=x315*x16[0]+x240*this.x190[0];
x16[1]=x315*x16[1]+x240*this.x190[1];
x16[2]=x315*x16[2]+x240*this.x190[2];
}
this.x190=x16;
var x440=Math.sqrt(x16[0]*x16[0]+x16[1]*x16[1]+x16[2]*x16[2]);
if(x440 > 0)
{
var x4=1.0/x440;
x16[0] *= x4;
x16[1] *= x4;
x16[2] *= x4;
}
this.x169=x16;

var x177=Math.asin(x16[2]);
var x170=0;
if( (x16[0] != 0) || (x16[1] != 0) )
{
x170=Math.atan2(x16[0],-x16[1]);
}
x170 *= 180.0/Math.PI;
x177 *= 180.0/Math.PI;
if(this.x347 == this.x350)
{
if(this.x211 == this.x152)
{
var x60=x16[0]-this.x93[0];
var x418=x16[1]-this.x93[1];
var x321=x16[2]-this.x93[2];
var x281=x60*x60+x418*x418+x321*x321;
if(x281 > 0.1)
{
this.x103(x177);
}
}
else if(this.x211 == this.x194)
{
if(x177 > -60)
{
this.x103(x177);
}
}
}
if(this.x211 == this.x42)
{
if( (Math.abs(x11.rotationRate.alpha) > 20)
|| (Math.abs(x11.rotationRate.beta) > 20)
|| (Math.abs(x11.rotationRate.gamma) > 20) )
{
this.x34();
}
}
var x32=x11.rotationRate.alpha * x11.interval;
var x374=x11.rotationRate.beta * x11.interval;
var x43=x11.rotationRate.gamma * x11.interval;
var x5=new x548();
var x188=new x548();
x188.x540(2,x43);
x5.x535(x188);
x188.x540(1,x374);
x5.x535(x188);
x188.x540(0,x32);
x5.x535(x188);
var x163=new x548();
x188.x540(2,-x170);
x163.x535(x188);
x188.x540(0,x177);
x163.x535(x188);
var x67=new x548(x163);
x67.x552();
var x278=new x548();
x278.x535(x67);
x278.x535(x5);
x278.x535(x163);
var x277=x278.x553([1,0,0]);
var x324=Math.atan2(x277[2],x277[0]);
x324 *= 180.0/Math.PI;
var x40=this.x15;
if(this.x416 == 0)
{
x40 += x324;
}
var x283;
if( (this.x347 == this.x350)
&& (this.x211 == this.x42)
)
{
var x313=x11.interval*180;
if(this.x269 > 0)
{
this.x269 -= x313;
if(this.x269 < 0) this.x269=0;
}
else if(this.x269 < 0)
{
this.x269 += x313;
if(this.x269 > 0) this.x269=0;
}
x283=x177+this.x269;
if(x283 < -90) x283=-90;
if(x283 > 90) x283=90;
}
else
{
x283=this.x264;
}
this.x69(x40,x283,this.x214);
}
}
nhPanoramaViewer.prototype.x39=function(x11)
{
this.x203("Error: WebGL context lost");
}
nhPanoramaViewer.prototype.x71=function(x11)
{
this.x203("WebGL context restored");
}
nhPanoramaViewer.prototype.x365=function()
{
return (this.x211 == this.x42);
}
nhPanoramaViewer.prototype.x19=function()
{
if(this.x211 != this.x194)
{
this.x93=this.x169;
this.x211=this.x152;
}
}
nhPanoramaViewer.prototype.x103=function(x50)
{
if(x50 < -60)
{
this.x211=this.x194;
}
else
{
this.x211=this.x42;
this.x269=this.x264-x50;
this.x34();
}
}

x504.prototype.lsNotLoaded=0;
x504.prototype.x462=1;
x504.prototype.x524=2;
x504.prototype.x484=3;
x504.prototype.m_Owner;
x504.prototype.m_ImageUrl;
x504.prototype.x532;
x504.prototype.x506;
x504.prototype.x525;
x504.prototype.x528;
x504.prototype.x529;
x504.prototype.x298=false;
x504.prototype.x501;
x504.prototype.x495;
x504.prototype.x510;
x504.prototype.x450;
x504.prototype.x455=0;
x504.prototype.x519;
x504.prototype.x509;
x504.prototype.x182;
x504.prototype.x520;
x504.prototype.m_Image;
x504.prototype.x464;
x504.prototype.x507;
x504.prototype.x531;
function x504(x511, x492, x35, x177, x120, x282, x372)
{
this.x529=this.lsNotLoaded;
this.m_Owner=x511;
this.m_ImageUrl=x492;
this.x532=x35;
this.x506=x177;
this.x525=x120;
this.x528=x282;
this.x450=x372;
if(this.m_Owner.x136)
{
var x88=document.createElement("div");
x88.style.position="absolute";
x88.style.webkitBackfaceVisibility="hidden";
x88.style.top="0px";
x88.style.left="0px";
x88.style.overflow="hidden";
var x452=x511.x356();
x452.appendChild(x88);
this.x182=x88;
}
if(this.m_Owner.x301)
{
this.x445();
}
var x61=document.createElement("img");
x61.style.position="absolute";
x61.style.top="0px";
x61.style.left="0px";
x61.style.visibility="hidden";
this.m_Image=x61;
var x251=this;
if(document.addEventListener)
{
x61.addEventListener("load", function(x11){return x251.x475(x11? x11 : window.event)}, false);
x61.addEventListener("error", function(x11){return x251.x470(x11? x11 : window.event)}, false);
}
else if(document.attachEvent)
{
x61.attachEvent("onload", function(x11){return x251.x475(x11? x11 : window.event)});
x61.attachEvent("onerror", function(x11){return x251.x470(x11? x11 : window.event)});
}
if(this.m_Owner.x136)
{
this.x182.appendChild(this.m_Image);
var x526=document.createElement("img");
x526.style.position="absolute";
x526.style.top="0px";
x526.style.left="0px";
x526.style.visibility="hidden";
x88.appendChild(x526);
this.x520=x526;
}
this.x466();
}
x504.prototype.x445=function()
{
var x340=10;
var width=x340*Math.tan(0.5*this.x525*Math.PI/180);
var x522=new x548();
x522.x540(0,this.x506);
var x290=new x548();
x290.x540(1,-this.x532);
x522.x535(x290);
var x449=[];
for(var x478=0; x478 < 4; x478++)
{
var x518=[];
x518[0]=(x478 & 1)? -width : width;
x518[1]=(x478 & 2)? -width : width;
x518[2]=-x340;
x518=x522.x553(x518);
x449=x449.concat(x518);
}
this.x507=this.m_Owner.x333(x449);
}
x504.prototype.x460=function()
{
this.x469();
}
x504.prototype.x469=function()
{
this.x529=this.x462;
if(this.x455 > 0)
{
var x251=this;
window.setTimeout(function(){x251.m_Image.src=x251.m_ImageUrl}, this.x455*1000);
}
else
{
this.m_Image.src=this.m_ImageUrl;
}
}
x504.prototype.x470=function(event)
{
this.m_Owner.x250("Failed to load image: "+this.m_ImageUrl);
this.x529=this.x484;
this.m_Owner.x99(this);
return true;
}
x504.prototype.x475=function(event)
{
this.x529=this.x524;
if(this.m_Image.width != this.m_Image.height)
{
this.m_Owner.x250("Image "+this.m_ImageUrl+" should be square");
}
var x474=this.m_Image.width;
if(this.x450 && (this.m_Image.width > this.x450))
{
this.m_Image.width=this.x450;
this.m_Image.height=this.x450;
var x251=this;
}
this.x501=new Array(this.m_Image.width, this.m_Image.height);
if(this.m_Owner.x136)
{
this.x234();
this.x520.style.visibility="hidden";
this.m_Image.style.visibility="visible";
this.x182.style.width=this.x501[0]+"px";
this.x182.style.height=this.x501[1]+"px";
}
else
{
this.x464=this.m_Owner.x378(this.m_Image);
this.x479(0.0, 0.0, 1.0, 1.0);
}
if(nhPanoramaViewer.isIOS())
{
var x251=this;
setTimeout(function(){
x251.m_Owner.x99(this);
},100);
}
else
{
this.m_Owner.x99(this);
}
return true;
}
x504.prototype.x466=function()
{
}
x504.prototype.x498=function(event)
{
try
{
x500(this.x519,false);
this.x519=null;
this.m_Owner.x99(this);
}
catch (x149)
{
this.m_Owner.x250(x149.toString());
}
}
x504.prototype.x234=function()
{
if((this.x529 == this.x524) || this.x298)
{
this.x517();
}
}
x504.prototype.x517=function()
{
if(this.m_Owner.x136)
{
var x459=this.m_Owner.x421();
var x482=this.m_Owner.x148();
var x486=this.m_Owner.x276();
var x516=this.m_Owner.x24();
var x446=this.x501[0];
var x490=this.x501[1];
var x487=1000.0*(this.x528+1);
var x491=this.m_Owner.x356().style.webkitPerspective;
var x493=0.5*x487/Math.tan(0.5*this.x525*Math.PI/180);
var x290=new WebKitCSSMatrix();
x290=x290.translate(-(x446-x486)/2,-(x490-x516)/2,x491);
x290=x290.rotate(x482,0,0);
x290=x290.rotate(0,x459-this.x532,0);
x290=x290.rotate(-this.x506,0,0);
x290=x290.translate(0,0,-x493);
x290=x290.scale(x487/x446, x487/x490,1);
this.x182.style.webkitTransform=x290;
}
}
x504.prototype.x457=function()
{
return this.x529;
}
x504.prototype.x447=function()
{
return this.x298;
}
x504.prototype.x523=function()
{
return this.x532;
}
x504.prototype.x476=function()
{
return this.x506;
}
x504.prototype.x458=function(x122, x446, x186)
{
this.x298=true;
if(this.x529 != this.x462) this.x529=this.lsNotLoaded;
var x228=x186[2];
var x454=x186[3];
this.x520.src=x122;
this.x520.width=x446;
this.x520.height=x446;
this.x520.style.left=""+(0-x186[0])+"px";
this.x520.style.top=""+(0-x186[1])+"px";
this.x520.style.visibility="visible";
this.x182.style.width=x228+"px";
this.x182.style.height=x454+"px";
this.x501=new Array(x228,x454);
this.x234();
}
x504.prototype.x468=function(x515, x446, x186)
{
this.x464=x515;
var x527=x186[0]/x446;
var x465=(x186[0]+x186[2])/x446;
var x473=1.0-(x186[1]+x186[3])/x446;
var x467=1.0-x186[1]/x446;
this.x479(x527, x473, x465, x467);
this.x298=true;
if(this.x529 != this.x462) this.x529=this.lsNotLoaded;
}
x504.prototype.x479=function(x527, x473, x465, x467)
{
this.x531=this.m_Owner.x333([x465, x467, x527, x467, x465, x473, x527, x473]);
}
x504.prototype.x499=function()
{
if(this.x464)
{
return [this.x464, this.x507, this.x531];
}
else
{
return null;
}
}

x548.prototype.m_Els=[1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1];
function x548(src)
{
if(src)
{
this.m_Els=src.m_Els.slice(0);
}
}
x548.prototype.x535=function(x545)
{
var x551=[];
var x544=0;
var x550=0;
var x536;
var x562;
var x558;
while(true)
{
x536=0;
x562=x544;
x558=x550;
while(true)
{
x536 += this.m_Els[x562++]*x545.m_Els[x558];
x558 += 4;
if(x558 >= 16) break;
}
x551.push(x536);
x550++;
if(x550 == 4)
{
x544 += 4;
if(x544 == 16) break;
x550=0;
}
}
this.m_Els=x551;
return this;
}
x548.prototype.x546=function(x376, x433, x541, x554)
{
var x392=0.5 * x376 * Math.PI / 180.0;
var x473=x541 * Math.tan(x392) / Math.sqrt(1+x433*x433);
var x465=x473*x433;
var x537=1.0/(x554-x541);
this.m_Els = [
x541/x465, 0, 0, 0,
0, x541/x473, 0, 0,
0, 0, -(x541+x554)*x537, -1,
0, 0, -2*x554*x541*x537, 0
];
return this;
}
x548.prototype.x540=function(x543,x547)
{
var x557=Math.PI * x547 / 180.0;
var x555=Math.cos(x557);
var s=Math.sin(x557);
if(x543 == 0)
{
this.m_Els = [
1, 0, 0, 0,
0, x555, s, 0,
0, -s, x555, 0,
0, 0, 0, 1
];
}
else if(x543 == 1)
{
this.m_Els = [
x555, 0, -s, 0,
0, 1, 0, 0,
s, 0, x555, 0,
0, 0, 0, 1
];
}
else
{
this.m_Els = [
x555, s, 0, 0,
-s, x555, 0, 0,
0, 0, 1, 0,
0, 0, 0, 1
];
}
return this;
}
x548.prototype.x556=function()
{
return new Float32Array(this.m_Els);
}
x548.prototype.x553=function(x559)
{
var x=this.m_Els[0]*x559[0]+this.m_Els[4]*x559[1]+this.m_Els[8]*x559[2]+this.m_Els[12];
var y=this.m_Els[1]*x559[0]+this.m_Els[5]*x559[1]+this.m_Els[9]*x559[2]+this.m_Els[13];
var z=this.m_Els[2]*x559[0]+this.m_Els[6]*x559[1]+this.m_Els[10]*x559[2]+this.m_Els[14];
var x256=this.m_Els[3]*x559[0]+this.m_Els[7]*x559[1]+this.m_Els[11]*x559[2]+this.m_Els[15];
if(x256 != 1.0)
{
var x542=1.0/x256;
x *= x542;
y *= x542;
z *= x542;
}
return [x,y,z];
}
x548.prototype.x552=function()
{
var x551=[
this.m_Els[0], this.m_Els[4], this.m_Els[8], this.m_Els[12],
this.m_Els[1], this.m_Els[5], this.m_Els[9], this.m_Els[13],
this.m_Els[2], this.m_Els[6], this.m_Els[10], this.m_Els[14],
this.m_Els[3], this.m_Els[7], this.m_Els[11], this.m_Els[15]
];
this.m_Els=x551;
return this;
}


