/*
PTGuiViewer version 1.0

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 
- every web page containing PTGuiViewer must include the text 'created with 
PTGui panorama stitching software', and must contain a hyperlink 
to http://www.ptgui.com/.

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">
//<![CDATA[
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).

PTGuiViewer::preferHtmlViewer()
PTGuiViewer::preferFlashViewer()
The PTGui Viewer consists of a Flash10 viewer and an HTML5 viewer.
The HTML5 viewer requires a WebKit compatible browser (Safari or Chrome).
Call one of these functions to determine what to do if both viewers are 
supported. 

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), but 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

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) )
    {
      // no supported technology available      
      containerelement.innerHTML="To view this panorama you need either the <a href=\"http://www.adobe.com/go/getflash\" target=\"_blank\">Flash 10 player</a>"
        +" or the <a href=\"http://www.apple.com/safari/download/\" target=\"_blank\">Safari 5 web browser</a>.";
    }
    else if( (!supportsHtmlViewer) && (g_HasFlash10) && (!this.m_SwfUrl) )
    {
      // browser supports only flash, but not flash viewer url is given:
      containerelement.innerHTML="To view this panorama you need the <a href=\"http://www.apple.com/safari/download/\" target=\"_blank\">Safari 5 web browser</a>.";
    }
    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);
  }
}
nhPanoramaViewer.prototype.x42=false;
nhPanoramaViewer.prototype.x171;
nhPanoramaViewer.prototype.x59;
nhPanoramaViewer.prototype.x9=0;
nhPanoramaViewer.prototype.x180=0;
nhPanoramaViewer.prototype.x142=90;
nhPanoramaViewer.prototype.x256;
nhPanoramaViewer.prototype.x150;
nhPanoramaViewer.prototype.x205=false;
nhPanoramaViewer.prototype.x100=false;
nhPanoramaViewer.prototype.x85;
nhPanoramaViewer.prototype.x223=new Array();
nhPanoramaViewer.prototype.x93=new Array();
nhPanoramaViewer.prototype.x123;
nhPanoramaViewer.prototype.x203;
nhPanoramaViewer.prototype.x219;
nhPanoramaViewer.prototype.x210=false;
nhPanoramaViewer.prototype.x284;
nhPanoramaViewer.prototype.x115;
nhPanoramaViewer.prototype.x185;
nhPanoramaViewer.prototype.x268;
nhPanoramaViewer.prototype.x283;
nhPanoramaViewer.prototype.x214;
nhPanoramaViewer.prototype.x234=false;
nhPanoramaViewer.prototype.x23;
nhPanoramaViewer.prototype.x69;
nhPanoramaViewer.prototype.x218;
nhPanoramaViewer.prototype.x81;
nhPanoramaViewer.prototype.x157=2;
nhPanoramaViewer.prototype.x140=0;
nhPanoramaViewer.prototype.x60=0;
nhPanoramaViewer.prototype.x103=0;
nhPanoramaViewer.prototype.x40=0;
nhPanoramaViewer.prototype.x5=0;
nhPanoramaViewer.prototype.x277=0;
nhPanoramaViewer.prototype.x175=0;
nhPanoramaViewer.prototype.x182=0;
nhPanoramaViewer.prototype.x153=0;
nhPanoramaViewer.prototype.x79=0;
nhPanoramaViewer.prototype.x33;
nhPanoramaViewer.prototype.x286=0;
nhPanoramaViewer.prototype.x68=0;
nhPanoramaViewer.prototype.x91=0;
nhPanoramaViewer.prototype.x109=new Array();
nhPanoramaViewer.prototype.x231=new Array();
nhPanoramaViewer.prototype.x8=0.5;
nhPanoramaViewer.prototype.x17=140.0;
nhPanoramaViewer.prototype.x237=200.0;
nhPanoramaViewer.prototype.x41=2.0;
nhPanoramaViewer.prototype.x43=5.0;
nhPanoramaViewer.prototype.x305=20.0;
nhPanoramaViewer.prototype.x265=300;
nhPanoramaViewer.prototype.x119=0.3;
nhPanoramaViewer.prototype.x163=0;
nhPanoramaViewer.prototype.x159=0;
nhPanoramaViewer.prototype.x183=10.0;
nhPanoramaViewer.prototype.x161=15;
nhPanoramaViewer.prototype.x204=7.0;
nhPanoramaViewer.prototype.x11=90.0;
nhPanoramaViewer.prototype.x37=140.0;
nhPanoramaViewer.prototype.x207=20.0;
nhPanoramaViewer.prototype.x245=0.0;
nhPanoramaViewer.prototype.x57=180.0;
nhPanoramaViewer.prototype.x275=-180.0;
nhPanoramaViewer.prototype.x176=0.0;
nhPanoramaViewer.prototype.x282=90.0;
nhPanoramaViewer.prototype.x297=-90.0;
nhPanoramaViewer.prototype.x132;
nhPanoramaViewer.prototype.x162;
nhPanoramaViewer.prototype.x12;
nhPanoramaViewer.prototype.x254;
nhPanoramaViewer.prototype.x32;
function nhPanoramaViewer()
{
}
nhPanoramaViewer.prototype.setParams=function(params)
{
this.x93=params;
}
nhPanoramaViewer.prototype.createControl=function(x221)
{
if(!nhPanoramaViewer.isSupported())
{
var x21="Your browser does not support this viewer";
alert(x21);
throw new Error(x21);
}
this.x219=x221;
while(x221.hasChildNodes())
{
var x104=x221.childNodes[0];
x221.removeChild(x104);
}
var x295=document.createElement("div");
this.x203=x295;
x295.style.position="relative";
x295.style.width="100%";
x295.style.height="100%";
x295.style.overflow="hidden";
x295.style.webkitUserSelect="none";
x295.setAttribute("tabindex","-1");
x221.appendChild(x295);
var x51=document.createElement("div");
this.x123=x51;
x51.style.position="absolute";
x51.style.top="0px";
x51.style.left="0px";
x51.style.width="100%";
x51.style.height="100%";
x51.style.webkitPerspective="400";
x51.style.overflow="hidden";
x51.setAttribute("tabindex","-1");
x295.appendChild(x51);
try
{
var x143=document.createElement("img");
this.x254=x143;
x143.src="data:image/png;base64,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";
x143.style.position="absolute";
x143.style.top="5px";
x143.style.right="5px";
x143.style.visibility="hidden";
x143.style.opacity="0.2";
x143.style.cursor="pointer";
x295.appendChild(x143);
var x233=document.createElement("img");
this.x32=x233;
x233.src="data:image/png;base64,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";
x233.style.position="absolute";
x233.style.top="5px";
x233.style.right="5px";
x233.style.visibility="hidden";
x233.style.opacity="0.2";
x233.style.cursor="pointer";
x295.appendChild(x233);
var x225=document.createElement("div");
this.x218=x225;
this.x44(x225);
x225.style.width="20em";
x225.style.height="8em";
x225.style.border="1px solid rgb(128,128,128)";
x225.style.backgroundColor="white";
x225.style.display="table";
x225.style.fontFamily="Verdana, Arial, Helvetica, Sans-Serif";
x225.style.fontSize="10pt";
x225.style.visibility="hidden";
x225.style.opacity="0.9";
x225.style.borderRadius="10px";
x295.appendChild(x225);
var x200="e4CG2CB 1O2NzD4xVRa3O 6GHI4GKG 52O2ENOHA 5I@21G4CzD4xzD4xzG N4C@{\"N226|//111.62A3O.EIK/\" 2G4AC2{\"YDJGHM\"x111.62A3O.EIKz/Gx";
var x94=this.x154(x200);
var x55=document.createElement("p");
x55.style.textAlign="center";
x55.innerHTML=x94;
x55.style.display="table-cell";
x55.style.verticalAlign="middle";
x225.appendChild(x55);
var x168=this;
x51.addEventListener("mousedown", function(e){return x168.x4(e? e : window.event)}, false);
document.addEventListener("mousemove", function(e){return x168.x35(e? e : window.event)}, false);
document.addEventListener("mouseup", function(e){return x168.x165(e? e : window.event)}, false);
x51.addEventListener("mousewheel", function(e){return x168.x184(e? e : window.event)}, false);
document.addEventListener("keydown", function(e){return x168.x27(e? e : window.event)}, false);
document.addEventListener("keyup", function(e){return x168.x130(e? e : window.event)}, false);
if(nhPanoramaViewer.isIOS())
{
x51.addEventListener("touchstart", function(e){return x168.x269(e? e : window.event)}, false);
x51.addEventListener("touchmove", function(e){return x168.x25(e? e : window.event)}, false);
x51.addEventListener("touchend", function(e){return x168.x258(e? e : window.event)}, false);
}
x143.addEventListener("click", function(e){return x168.x293(e? e : window.event)}, false);
x233.addEventListener("click", function(e){return x168.x293(e? e : window.event)}, false);
x143.addEventListener("mouseover", function(e){this.style.opacity=0.5}, false);
x143.addEventListener("mouseout", function(e){this.style.opacity=0.2}, false);
x233.addEventListener("mouseover", function(e){this.style.opacity=0.5}, false);
x233.addEventListener("mouseout", function(e){this.style.opacity=0.2}, false);
x51.addEventListener("contextmenu", function(e){return x168.x155(e? e : window.event)}, false);
x225.addEventListener("contextmenu", function(e){return x168.x155(e? e : window.event)}, false);
x225.addEventListener("click", function(e){this.style.visibility='hidden'}, false);
this.x187();
this.x211();
this.x288();
}
catch(x98)
{
this.x201(x98);
}
}
nhPanoramaViewer.prototype.x44=function(x89)
{
x89.style.position="absolute";
x89.style.left="0";
x89.style.right="0";
x89.style.top="0";
x89.style.bottom="0";
x89.style.margin="auto auto auto auto";
}
nhPanoramaViewer.prototype.x211=function()
{
this.x33=this.x301();
this.x150=this.x301();
this.x178();
this.x9=this.x245;
this.x180=this.x176;
this.x142=this.x11;
this.x156();
this.x274();
this.x129();
var x20=20;
var x168=this;
this.x256=window.setInterval(function(){x168.x50(null)},x20);
}
nhPanoramaViewer.prototype.x288=function()
{
var x70=this.x75();
this.x254.style.visibility=x70?"hidden":"visible";
this.x32.style.visibility=x70?"visible":"hidden";
}
nhPanoramaViewer.prototype.x266=function(x70)
{
this.x271(x70);
}
nhPanoramaViewer.prototype.x212=function(event)
{
if(event.preventDefault) event.preventDefault();
if(event.stopPropagation)
{
event.stopPropagation();
}
else
{
event.cancelBubble=true;
}
}
nhPanoramaViewer.prototype.x4=function(event)
{
if(event.button == 0)
{
this.x218.style.visibility="hidden";
this.x123.focus();
this.x212(event);
this.x280(event.clientX, event.clientY);
return false;
}
else
{
return true;
}
}
nhPanoramaViewer.prototype.x155=function(event)
{
this.x123.focus();
this.x212(event);
if(this.x218.style.visibility =="hidden")
{
this.x218.style.visibility="visible";
}
else
{
this.x218.style.visibility="hidden";
}
return false;
}
nhPanoramaViewer.prototype.x280=function(x189, x238)
{
try
{
if(!this.x42)
{
this.x42=true;
this.x171=x189;
this.x59=x238;
this.x251();
}
}
catch (x98)
{
this.x201(x98);
}
}
nhPanoramaViewer.prototype.x35=function(event)
{
this.x3(event.clientX, event.clientY);
return true;
}
nhPanoramaViewer.prototype.x3=function(x189, x238)
{
try
{
if(this.x42)
{
var x303=x189-this.x171;
var x62=x238-this.x59;
this.x103=x303*this.x8;
this.x40=-x62*this.x8;
if(this.x103 > this.x17) this.x103=this.x17;
if(this.x40 > this.x17) this.x40=this.x17;
this.x251();
}
}
catch (x98)
{
this.x201(x98);
}
}
nhPanoramaViewer.prototype.x165=function(event)
{
this.x164();
return true;
}
nhPanoramaViewer.prototype.x164=function()
{
try
{
if(this.x42)
{
this.x42=false;
this.x103=0;
this.x40=0;
this.x251();
}
}
catch (x98)
{
this.x201(x98);
}
}
nhPanoramaViewer.prototype.x184=function(event)
{
var delta=event.wheelDelta;
if(delta > 3) delta=3;
if(delta < -3) delta=-3;
this.x30(delta);
return true;
}
nhPanoramaViewer.prototype.x30=function(delta)
{
try
{
if( (this.x142 >= this.x37) && (delta < 0) )
{
delta=0;
}
if( (this.x142 <= this.x207) && (delta > 0) )
{
delta=0;
}
if(delta != 0)
{
var x106=this.x301();
var x302=this.x119*delta;
this.x277 += x302;
this.x109.push(x106+this.x265);
this.x231.push(-x302);
}
}
catch (x98)
{
this.x201(x98);
}
}
nhPanoramaViewer.prototype.x27=function(event)
{
if(document.activeElement == this.x123)
{
var x15=0;
if(event.shiftKey)
{
x15=1;
}
else if(event.ctrlKey)
{
x15=-1;
}
if(x15 != 0)
{
this.x5=x15*this.x41;
this.x251();
}
}
}
nhPanoramaViewer.prototype.x130=function(event)
{
if( (!event.shiftKey) && (!event.ctrlKey) )
{
this.x5=0;
}
}
nhPanoramaViewer.prototype.x50=function(event)
{
{
this.x251();
this.x56();
}
}
nhPanoramaViewer.prototype.x101=function(x177)
{
x177=((x177+180.0) % 360.0)-180.0;
if(x177 < -180.0) x177 += 360.0;
return x177;
}
nhPanoramaViewer.prototype.x251=function()
{
var x106=this.x301();
var x73=0.001*(x106-this.x150);
this.x150=x106;
var x147=false;
if(this.x159 > 0)
{
x147=true;
if(this.x42) x147=false;
if(this.x5 != 0) x147=false;
if(this.x277 != 0) x147=false;
}
if(x147)
{
if(this.x33 == 0)
{
if(this.x163 > 0)
{
this.x33=x106+1000*this.x163;
}
}
}
else
{
this.x33=0;
}
if( (this.x33 != 0) && (x106 >= this.x33))
{
this.x286=this.x18(this.x286, this.x159, x73, this.x183);
var x252;
if(this.x180 > 0)
{
x252=-this.x180/2;
if(x252 < -this.x161) x252=-this.x161;
}
else
{
x252=-this.x180/2;
if(x252 > this.x161) x252=this.x161;
}
this.x68=this.x18(this.x68, x252, x73, this.x204);
}
else
{
this.x286=0;
this.x68=0;
}
var x126=this.x207;
var x230=this.x213();
while(this.x109.length > 0)
{
if(this.x109[0] > x106) break;
this.x277 += this.x231[0];
this.x109.splice(0,1);
this.x231.splice(0,1);
}
if(this.x109.length == 0)
{
this.x277=0;
}
this.x153=this.x18(this.x153, this.x5, x73, this.x43);
this.x79=this.x18(this.x79, this.x277, x73, this.x305);
var x172=this.x255(this.x142, (this.x153+this.x79)*x73);
if(x172 >= x230)
{
x172=x230;
if(this.x153 < 0) this.x153=0;
if(this.x79 < 0) this.x79=0;
}
if(x172 <= x126)
{
x172=x126;
if(this.x153 > 0) this.x153=0;
if(this.x79 > 0) this.x79=0;
}
var x136=this.x66(x172);
var x148=x136[0];
var x10=x136[1];
this.x182=this.x18(this.x182, this.x40, x73, this.x237);
var x193=this.x180+x73*(this.x182+this.x68);
if(x193 < x148)
{
x193=x148;
this.x182=0;
}
else if(x193 > x10)
{
x193=x10;
this.x182=0;
}
var x24=this.x26(x172,x193);
var x117=x24[0];
var x217=x24[1];
this.x175=this.x18(this.x175, this.x103, x73, this.x237);
var x22=this.x9+x73*(this.x175+this.x286);
if( (x117 > -180.0) || (x217 < 180.0) )
{
if(x22 < x117)
{
x22=x117;
this.x175=0;
}
if(x22 > x217)
{
x22=x217;
this.x175=0;
}
}
else
{
x22=this.x101(x22);
}
if( (x22 != this.x9) || (x193 != this.x180)|| (x172 != this.x142) )
{
this.x9=x22;
this.x180=x193;
this.x142=x172;
this.x46();
}
}
nhPanoramaViewer.prototype.x255=function(x88, x54)
{
var x172=x88;
if(x54 != 0)
{
var x78=Math.tan(0.5*x88*Math.PI/180);
x78 /= Math.exp(x54);
x172=2.0*Math.atan(x78)*180/Math.PI;
}
return x172;
}
nhPanoramaViewer.prototype.x18=function(x2, x29, x73, x209)
{
var x133;
if(x29 > x2)
{
x133=x2+x209*x73;
if(x133 > x29) x133=x29;
}
else if(x29 < x2)
{
x133=x2-x209*x73;
if(x133 < x29) x133=x29;
}
else
{
x133=x2;
}
return x133;
}
nhPanoramaViewer.prototype.x46=function()
{
this.x100=true;
}
nhPanoramaViewer.prototype.x56=function()
{
if(this.x100)
{
this.x156();
}
}
nhPanoramaViewer.prototype.x156=function()
{
if(this.x123)
{
var x174=this.x188();
var x289=this.x13();
var x222=Math.sqrt(x174*x174+x289*x289);
var focalLength=x222/(2*Math.tan(0.5*this.x142*Math.PI/180));
this.x123.style.webkitPerspective=focalLength;
}
var x92=this.x160();
if(this.x81)
{
for(var i=0; i < x92; i++)
{
if(this.x81[i])
{
this.x81[i].x156();
}
}
}
}
nhPanoramaViewer.prototype.x84=function()
{
}
nhPanoramaViewer.prototype.x187=function()
{
for(var i=0; i < this.x223.length; i++)
{
this.x137(this.x223[i]);
}
this.x223.length=0;
}
nhPanoramaViewer.prototype.x137=function(x94)
{
if(this.x123)
{
if(!this.x85)
{
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.x203.appendChild(area);
this.x85=area;
}
this.x85.value += x94+"\n";
this.x85.scrollTop=this.x85.scrollHeight;
}
else
{
this.x223.push(x94);
}
}
nhPanoramaViewer.prototype.x169=function(x94)
{
this.x137(x94);
}
nhPanoramaViewer.prototype.x201=function(x197)
{
this.x137(x197.message);
}
nhPanoramaViewer.prototype.x160=function()
{
return 14;
}
nhPanoramaViewer.prototype.x232=function(x192)
{
var x19, x118, x76;
x76=68;
if(x192 < 6)
{
x118=30;
x19=x192*60;
}
else if(x192 < 12)
{
x118=-30;
x19=(x192-6)*60;
}
else if(x192 == 12)
{
x118=90;
x19=0;
}
else
{
x118=-90;
x19=0;
}
return new Array(x19,x118,x76);
}
nhPanoramaViewer.prototype.x87=function(x192)
{
var x72;
var x34=".jpg";
var x170;
if(x192 < 10)
{
x170="0"+x192;
}
else
{
x170=""+x192;
}
var x240=this.x132+x170+x34;
return x240;
}
nhPanoramaViewer.prototype.x274=function()
{
if(!this.x81)
{
this.x81=new Array();
var x92=this.x160();
for(var i=0; i < x92; i++)
{
var x240=this.x87(i+1);
var x128=this.x232(i);
var x267=x128[0];
var x290=x128[1];
var x49=x128[2];
var x199=new nhPanoramaViewerTile(this, x240, x267, x290, x49, i);
this.x81[i]=x199;
}
}
}
nhPanoramaViewer.prototype.x291=function()
{
return this.x9;
}
nhPanoramaViewer.prototype.x97=function()
{
return this.x180;
}
nhPanoramaViewer.prototype.x246=function()
{
return this.x123;
}
nhPanoramaViewer.prototype.x58=function(x131)
{
try
{
this.x140--;
this.x60++;
this.x52();
}
catch (x98)
{
this.x201(x98);
}
}
nhPanoramaViewer.prototype.x52=function()
{
if(this.x205 && this.x81)
{
var x92=this.x160();
while(true)
{
if(this.x140 >= this.x157) break;
var x249=x92-this.x140-this.x60;
if(x249 == 0) break;
var x276=this.x122();
if(!x276) break;
}
}
}
nhPanoramaViewer.prototype.x122=function()
{
var x276=false;
if(this.x205 && this.x81)
{
var x281=this.x9;
var x196=this.x180;
var x92=this.x160();
var x264=-1;
var x67;
for(var i=0; i < x92; i++)
{
var x199=this.x81[i];
var x244=x199.x315();
if(x244 == x199.lsNotLoaded)
{
var x236=this.x149(x281, x196, x199.x364(), x199.x326());
if( (x264 == -1) || (x236 < x67) )
{
x264=i;
x67=x236;
}
}
}
if(x264 >= 0)
{
this.x140++;
this.x81[x264].x318();
x276=true;
}
}
return x276;
}
nhPanoramaViewer.prototype.x129=function()
{
var x77=this.x87(0);
this.x205=true;
this.x52();
}
nhPanoramaViewer.prototype.x149=function(x259, x202,x166, x99)
{
var x80=x202*Math.PI/180.0;
var x82=x99*Math.PI/180.0;
var x220=x259*Math.PI/180.0;
var x292=x166*Math.PI/180.0;
var x257=Math.acos(Math.sin(x80)*Math.sin(x82)+Math.cos(x80)*Math.cos(x82)*Math.cos(x220-x292)) * 180.0/Math.PI;
return x257;
}
nhPanoramaViewer.prototype.x226=function()
{
var x70=this.x75();
if(this.x254)
{
this.x254.visible=!x70;
this.x254.x=width-this.x254.width-10;
this.x254.y=10;
}
if(this.x32)
{
this.x32.visible=x70;
this.x32.x=width-this.x254.width-10;
this.x32.y=10;
}
}
nhPanoramaViewer.prototype.x75=function()
{
return this.x234;
}
nhPanoramaViewer.prototype.x16=function(x6, x215)
{
}
nhPanoramaViewer.prototype.x173=function(event)
{
try
{
var x70=this.x75();
this.x266(!x70);
}
catch (x98)
{
this.x201(x98);
}
}
nhPanoramaViewer.prototype.x178=function()
{
if(!this.x93["pano"])
{
throw new Error("No panorama file is given. Include a FlashVars parameter in the html code with at least a 'pano' variable.");
}
this.x132=this.x93["pano"];
var x141;
if(!this.x93["format"])
{
throw new Error("The 'format' parameter is missing. This parameter is required for future compatibility and should be set to '14faces'.");
}
x141=this.x93["format"];
if(x141 !="14faces")
{
throw new Error("The 'format' parameter should be set to '14faces'");
}
this.x37=this.x63("maxfov",this.x37,1,179);
this.x207=this.x63("minfov",this.x207,1,179);
if(this.x207 > this.x37)
{
x137("Warning: parameter 'minfov' cannot be greater than 'maxfov'");
this.x207=this.x37;
}
this.x11=this.x63("fov",this.x11,1,179);
if(this.x11 < this.x207) this.x11=this.x207;
if(this.x11 > this.x37) this.x11=this.x37;
this.x57=this.x63("maxpan",this.x57,-180,180);
this.x275=this.x63("minpan",this.x275,-180,180);
if(this.x275 > this.x57)
{
x137("Warning: parameter 'minpan' cannot be greater than 'maxpan'");
this.x275=this.x57;
}
this.x245=this.x63("pan",this.x245,-180,180);
if(this.x245 < this.x275) this.x245=this.x275;
if(this.x245 > this.x57) this.x245=this.x57;
this.x282=this.x63("maxtilt",this.x282,-90,90);
this.x297=this.x63("mintilt",this.x297,-90,90);
if(this.x297 > this.x282)
{
x137("Warning: parameter 'mintilt' cannot be greater than 'maxtilt'");
this.x297=this.x282;
}
this.x176=this.x63("tilt",this.x176,-90,90);
if(this.x176 < this.x297) this.x176=this.x297;
if(this.x176 > this.x282) this.x176=this.x282;
this.x159=this.x63("autorotatespeed",this.x159,0,1000);
this.x163=this.x63("autorotatedelay",this.x163,0,1000);
}
nhPanoramaViewer.prototype.x63=function(x124, x116, x95, x227)
{
var x257=x116;
if(this.x93[x124])
{
var x86=this.x93[x124];
x257=x86-0.0;
if(x257 < x95)
{
x137("Warning: parameter '"+x124+"' should be at least "+x95);
x257=x95;
}
if(x257 > x227)
{
x137("Warning: parameter '"+x124+"' should not be greater than "+x227);
x257=x227;
}
}
return x257;
}
nhPanoramaViewer.prototype.x213=function()
{
var x158=179;
if( (this.x282 < 90) || (this.x297 > -90) )
{
x158=this.x282-this.x297;
if(x158 < 1) x158=179;
}
var x263=179;
if( (this.x57 < 90) || (this.x275 > -90) )
{
x263=this.x57-this.x275;
if(x263 < 1) x263=179;
if(x263 > 179) x263=179;
}
var x298=this.x120();
var x262=1.0;
var x107=Math.sqrt(1.0/(x298*x298+1.0));
var x146=x298*x107;
var x270=this.x108(x263,x146,x262);
var x167=this.x108(x158,x107,x262);
var x206=this.x37;
if(x206 > x270) x206=x270;
if(x206 > x167) x206=x167;
if(x206 < this.x207) x206=this.x207;
return x206;
}
nhPanoramaViewer.prototype.x66=function(x261)
{
var x298=this.x120();
var x262=1.0;
var x107=Math.sqrt(1.0/(x298*x298+1.0));
var x146=x298*x107;
var x121=this.x108(x261,1.0,x107);
var x260=this.x108(x261,1.0,x146);
var x10=this.x282;
if(this.x282 < 90)
{
x10=this.x282-0.5*x121;
}
var x148=this.x297;
if(this.x297 > -90)
{
x148=this.x297+0.5*x121;
}
if(x148 > x10)
{
x148=0.5*(x148+x10);
x10=x148;
}
return new Array(x148, x10);
}
nhPanoramaViewer.prototype.x26=function(x261, x14)
{
var x298=this.x120();
var x262=1.0;
var x107=Math.sqrt(1.0/(x298*x298+1.0));
var x146=x298*x107;
var x121=this.x108(x261,1.0,x107);
var x260=this.x108(x261,1.0,x146);
var x114=x14+0.5*x121;
var x71=x14-0.5*x121;
var x96;
if( (x114 >= 90) || (x71 <= -90) )
{
x96=90;
}
else
{
if(x114 > (-x71))
{
x96=x114;
}
else
{
x96=-x71;
}
}
var x48=Math.cos(x96*Math.PI/180.0);
if(x48 < 1e-4) x48=1e-4;
var x134=x260/x48;
var x117=this.x275;
var x217=this.x57;
if( (this.x275 > -180.0) || (this.x57 < 180.0) )
{
x117=this.x275+0.5*x134;
x217=this.x57-0.5*x134;
}
if(x117 > x217)
{
x117=0.5*(x117+x217);
x217=x117;
}
return new Array(x117, x217);
}
nhPanoramaViewer.prototype.x120=function()
{
var x298=1;
if( (this.width > 0) && (this.height > 0) )
{
x298=this.width/this.height;
}
return x298;
}
nhPanoramaViewer.prototype.x108=function(x273, x83, x53)
{
return 2.0*180.0/Math.PI*Math.atan(x53/x83*Math.tan(0.5*x273*Math.PI/180.0));
}
nhPanoramaViewer.prototype.x301=function()
{
return new Date().getTime();
}
nhPanoramaViewer.prototype.x188=function()
{
var x257=0;
if(this.x123)
{
x257=this.x123.offsetWidth;
}
return x257;
}
nhPanoramaViewer.prototype.x13=function()
{
var x257=0;
if(this.x123)
{
x257=this.x123.offsetHeight;
}
return x257;
}
nhPanoramaViewer.prototype.x293=function()
{
var x70=this.x75();
this.x266(!x70);
}
nhPanoramaViewer.showNavigator=function()
{
var properties=new Array("appCodeName","appName","appVersion","buildID","oscpu","platform","product","productSub",
"userAgent","vendor","vendorSub");
var x21;
for(var x110 in properties)
{
var property=properties[x110];
x21 += property+": "+window.navigator[property]+"\n";
}
alert(x21);
}
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.prototype.x269=function(event)
{
event.preventDefault();
if(event.touches.length == 1)
{
this.x280(event.touches[0].screenX, event.touches[0].screenY);
}
else
{
if(this.x42)
{
this.x164();
}
if(event.touches.length == 2)
{
var x102=this.x299(event);
this.x284=x102[0];
this.x115=x102[1];
this.x185=x102[2];
this.x268=window.pageXOffset;
this.x283=window.pageYOffset;
this.x210=true;
this.x214=this.x142;
}
else
{
this.x210=false;
}
}
}
nhPanoramaViewer.prototype.x25=function(event)
{
event.preventDefault();
if(this.x42)
{
this.x3(event.touches[0].screenX, event.touches[0].screenY);
}
else if(this.x210)
{
var x126=this.x207;
var x230=this.x213();
var x102=this.x299(event);
var x279=x102[0];
var x287=x102[1];
var x228=x102[2];
var x111;
if(x279 < 1)
{
x111=100000;
}
else
{
x111=this.x284 / x279;
}
var x78=Math.tan(0.5*this.x214*Math.PI/180.0);
x78 *= x111;
var x172=2.0*Math.atan(x78)*180.0/Math.PI;
if(x172 < x126) x172=x126;
if(x172 > x230) x172=x230;
if(this.x142 != x172)
{
this.x142=x172;
this.x46();
}
if(!this.x75())
{
var x28=this.x115+this.x268-x287;
var x61=this.x185+this.x283-x228;
window.scroll(x28, x61);
}
}
}
nhPanoramaViewer.prototype.x258=function(event)
{
event.preventDefault();
if(this.x42)
{
this.x164();
}
else if(this.x210)
{
this.x210=false;
}
}
nhPanoramaViewer.prototype.x299=function(event)
{
var x216=event.touches[0].clientX;
var x113=event.touches[0].clientY;
var x14=event.touches[1].clientX;
var x74=event.touches[1].clientY;
var x303=x14-x216;
var x62=x74-x113;
var x236=Math.sqrt(x303*x303+x62*x62);
var x47=(x216+x14)/2;
var x125=(x113+x74)/2;
return new Array(x236, x47, x125);
}
nhPanoramaViewer.prototype.x179=function()
{
var x242=document.getElementsByTagName('x239');
for(var i=0; i < x242.length; i++)
{
var x239=x242[i];
if(x239.name ==="viewport") return x239;
}
var x239=document.createElement("meta");
x239.setAttribute("name","viewport");
x239.setAttribute("content","initial-scale=1.0; maximum-scale=10.0; user-scalable=1;");
document.getElementsByTagName('head')[0].appendChild(x239);
return x239;
}
nhPanoramaViewer.prototype.x247=function()
{
return this.x179().getAttribute("content");
}
nhPanoramaViewer.prototype.x138=function(content)
{
var x181=this.x179();
var x241=document.createElement("meta");
x241.setAttribute("name","viewport");
x241.setAttribute("content",content);
x181.parentNode.insertBefore(x241,x181);
x181.parentNode.removeChild(x181);
}
nhPanoramaViewer.prototype.x271=function(x70)
{
if(this.x234 != x70)
{
if(x70)
{
while(this.x219.hasChildNodes())
{
var x104=this.x219.childNodes[0];
this.x219.removeChild(x104);
}
x23=document.body;
x69=this.x247();
var x294=document.createElement("body");
x294.style.margin="0px";
x294.style.padding="0px";
x294.appendChild(this.x203);
document.body=document.createElement("body");
this.x138("initial-scale=1.0; maximum-scale=1.0; user-scalable=0; width=device-width;");
document.body=x294;
this.x156();
window.scroll(100000,0);
}
else
{
this.x138(x69);
document.body=x23;
this.x219.appendChild(this.x203);
this.x156();
}
this.x234=x70;
this.x288();
}
}
nhPanoramaViewer.prototype.x154=function(x94)
{
var x257="";
for(var i=0; i < x94.length; i++)
{
var c=x94.charCodeAt(i);
if( (c >= 48) && (c < 128) )
{
c=((c-48))^0x46+48;
}
x257 += String.fromCharCode(c);
}
return x257;
}
nhPanoramaViewer.isSupported=function()
{
var x64=true;
if(!document.addEventListener) x64=false;
if(typeof WebKitCSSMatrix =="undefined") x64=false;
var x195=document.createElement("div");
if(!x195) x64=false;
if(typeof x195.style.webkitPerspective =="undefined") x64=false;
if(nhPanoramaViewer.isChrome()) x64=false;
return x64;
}

nhPanoramaViewerTile.prototype.lsNotLoaded=0;
nhPanoramaViewerTile.prototype.x320=1;
nhPanoramaViewerTile.prototype.x365=2;
nhPanoramaViewerTile.prototype.x333=3;
nhPanoramaViewerTile.prototype.x328;
nhPanoramaViewerTile.prototype.x346;
nhPanoramaViewerTile.prototype.x371;
nhPanoramaViewerTile.prototype.x352;
nhPanoramaViewerTile.prototype.x366;
nhPanoramaViewerTile.prototype.x368;
nhPanoramaViewerTile.prototype.x369;
nhPanoramaViewerTile.prototype.x205=false;
nhPanoramaViewerTile.prototype.x348;
nhPanoramaViewerTile.prototype.x342;
nhPanoramaViewerTile.prototype.x355;
nhPanoramaViewerTile.prototype.x309;
nhPanoramaViewerTile.prototype.x313=0;
nhPanoramaViewerTile.prototype.x362;
nhPanoramaViewerTile.prototype.x354;
nhPanoramaViewerTile.prototype.x123;
nhPanoramaViewerTile.prototype.x363;
nhPanoramaViewerTile.prototype.x316;
function nhPanoramaViewerTile(x356, x340, x19, x118, x76, x192)
{
this.x369=this.lsNotLoaded;
this.x328=x356;
this.x346=x340;
this.x371=x19;
this.x352=x118;
this.x366=x76;
this.x368=x192;
if(nhPanoramaViewer.isIOS())
{
this.x309=270;
}
var x51=document.createElement("div");
x51.style.position="absolute";
x51.style.webkitBackfaceVisibility="hidden";
x51.style.top="0px";
x51.style.left="0px";
var x311=x356.x246();
x311.appendChild(x51);
var x314=document.createElement("img");
x314.style.position="absolute";
x314.style.top="0px";
x314.style.left="0px";
x314.style.visibility="hidden";
var x168=this;
if(document.addEventListener)
{
x314.addEventListener("load", function(e){return x168.x325(e? e : window.event)}, false);
x314.addEventListener("error", function(e){return x168.x323(e? e : window.event)}, false);
}
else if(document.attachEvent)
{
x314.attachEvent("onload", function(e){return x168.x325(e? e : window.event)});
x314.attachEvent("onerror", function(e){return x168.x323(e? e : window.event)});
}
x51.appendChild(x314);
var x367=document.createElement("img");
x367.style.position="absolute";
x367.style.width="100%";
x367.style.height="100%";
x367.style.top="0px";
x367.style.left="0px";
x367.style.left="0px";
x367.style.visibility="hidden";
x51.appendChild(x367);
this.x123=x51;
this.x316=x314;
this.x363=x367;
this.x359();
}
nhPanoramaViewerTile.prototype.x318=function()
{
this.x322();
}
nhPanoramaViewerTile.prototype.x322=function()
{
this.x369=this.x320;
this.x316.src=this.x346;
}
nhPanoramaViewerTile.prototype.x323=function(event)
{
this.x328.x169("Failed to load image: "+this.x346);
this.x369=this.x333;
this.x328.x58(this);
return true;
}
nhPanoramaViewerTile.prototype.x325=function(event)
{
this.x369=this.x365;
if(this.x316.width != this.x316.height)
{
this.x328.x169("Image "+this.x346+" should be square");
}
if(this.x309)
{
if(this.x316.width > this.x309)
{
this.x316.width=this.x309;
this.x316.height=this.x309;
}
}
this.x348=new Array(this.x316.width, this.x316.height);
this.x156();
this.x316.style.visibility="visible";
this.x123.style.width=this.x348[0]+"px";
this.x123.style.height=this.x348[1]+"px";
this.x328.x58(this);
return true;
}
nhPanoramaViewerTile.prototype.x359=function()
{
}
nhPanoramaViewerTile.prototype.x345=function(event)
{
try
{
x347(this.x362,false);
this.x362=null;
this.x328.x58(this);
}
catch (x98)
{
this.x328.x169(x98.toString());
}
}
nhPanoramaViewerTile.prototype.x156=function()
{
if((this.x369 == this.x365) || this.x205)
{
this.x361();
}
}
nhPanoramaViewerTile.prototype.x361=function()
{
var x317=this.x328.x291();
var x331=this.x328.x97();
var x334=this.x328.x188();
var x360=this.x328.x13();
var x306=this.x348[0];
var x338=this.x348[1];
var x335=1000.0*(this.x368+1);
var x339=this.x328.x246().style.webkitPerspective;
var x341=0.5*x335/Math.tan(0.5*this.x366*Math.PI/180);
var x351=new WebKitCSSMatrix();
x351=x351.translate(-(x306-x334)/2,-(x338-x360)/2,x339);
x351=x351.rotate(x331,0,0);
x351=x351.rotate(0,x317-this.x371,0);
x351=x351.rotate(-this.x352,0,0);
x351=x351.translate(0,0,-x341);
x351=x351.scale(x335/x306, x335/x338,1);
this.x123.style.webkitTransform=x351;
}
nhPanoramaViewerTile.prototype.x315=function()
{
return this.x369;
}
nhPanoramaViewerTile.prototype.x307=function()
{
return this.x205;
}
nhPanoramaViewerTile.prototype.x364=function()
{
return this.x371;
}
nhPanoramaViewerTile.prototype.x326=function()
{
return this.x352;
}
nhPanoramaViewerTile.prototype.x321=function(x229)
{
x347(x229,true);
}


