/*
PTGuiViewer version 2.6
See below for usage instructions!
PTGui Panorama Viewer, a combined Flash10 / CSS3 / WebGL viewer for spherical panoramas.
(C) Copyright New House Internet Services BV 2010 - 2019
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 you ("Licensee") a non-exclusive,
non-transferable Limited License ("License"). 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 created with
PTGui panoramic stitching software ("PTGui") by a licensee of PTGui,
and
- PTGuiViewer.js and PTGuiViewer.swf may only be published unmodified, as
released by NHIS
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
of your HTML file:
And in the include:
The viewer will be embedded as child of the above , and it will use the
images myimage00.jpg ... myimage14.jpg.
Details:
viewer.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.
viewer.preferHtmlViewer()
viewer.preferFlashViewer()
These functions determine which technology will be used if the browser supports
both the native (CSS3D or WebGL) viewer and Flash10.
viewer.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
- autorotatetohorizon: true or false (default is true)
If true, when autorotation is started the viewer navigates to the horizon. If
false, the viewer will stay at the current tilt angle when autorotation starts.
- 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.
- enablemactouchpad: true or false (default is true)
On a mac, enable navigating the panorama by swiping with two fingers on the
touchpad, or swiping with one finger on the magic mouse. Zooming on a touchpad
is done by clicking with two fingers on the touchpad, holding down and dragging.
With the magic mouse zooming is done by clicking on the right half of the mouse
button, holding down and dragging.
If this is set to false, swiping with two fingers on the touchpad, or swiping with
one finger on the magic mouse, performs zooming.
- mousemode: 'drag' or 'moveto'
Controls the navigation mode on non-mobile devices. If 'drag' is selected, the
panorama is navigated by click&dragging (swiping). 'moveto' will contiuously move
the panorama while holding down the mouse. On mobile devices the panorama is always
navigated by dragging/swiping, regardless of this setting.
viewer.setFlashObjectParams()
Allows adding custom parameters for the Flash object/embed tag. For example:
viewer.setFlashObjectParams({
wmode: "opaque"
});
will add a
to the Flash
tag
and a parameter in the Flash tag:
Only used for the Flash viewer, ignored when using CSS3D or WebGL.
viewer.embed(container)
Embeds the viewer as a child of the given container. All contents of the
container element is cleared, and the viewer will make itself a child element
of the container.
The container can be either an html element object (as returned by
document.getElementById) or a string representing the id of the container
element.
If embed() is called before the page has finished loading, the embedding
will be done as soon as the page has finished loading. So it is safe to call
embed() in a script in the of the HTML page, passing the id of a container
element that has not yet been created.
viewer.showInLightbox()
Pops up a 'lightbox' (a black window overlaying the entire browser window)
showing the panorama. The user can close the panorama and return to the page by
pressing the red close button at the top left corner. This method is to be used
instead of embed(), in response to a user action, for example:
view panorama
In Internet Explorer the lightbox is shown correctly only when the page is
rendered in HTML Strict mode. For compatibility with IE the following line
should therefore be inserted at the top of the HTML page:
-----------------------------------------------------------
*/
// static properties:
var g_ObjectsForOnLoad=new Array();
var g_HasFlash10=false;
var g_FlashVersion=null;
// instance properties:
PTGuiViewer.prototype.m_ViewerVars;
PTGuiViewer.prototype.m_FlashObjectParams;
PTGuiViewer.prototype.m_SwfUrl;
PTGuiViewer.prototype.m_ContainerForEmbedOnLoad=null;
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_FlashObjectParams=new Array();
//this.m_FlashObjectParams["wmode"]="transparent";
this.m_FlashObjectParams["wmode"]="direct"; // for mouse wheel under firefox
this.m_SwfUrl=null;
this.m_ContainerForEmbedOnLoad=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_ContainerForEmbedOnLoad)
{
this.embedNow(this.m_ContainerForEmbedOnLoad);
this.m_ContainerForEmbedOnLoad=null;
}
}
PTGuiViewer.prototype.preferFlashViewer = function()
{
this.m_preferFlash=true;
}
PTGuiViewer.prototype.preferHtmlViewer = function()
{
this.m_preferFlash=false;
}
PTGuiViewer.prototype.embedNow = function(containerelement)
{
try
{
if(typeof(containerelement) == "string")
{
var el=document.getElementById(containerelement);
if(!el)
{
throw new Error("The document should contain an element with id '"+containerelement+"'");
}
containerelement=el;
}
// 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 Flash 10 plugin , or the ";
}
else
{
errtxt="To view this panorama you need the ";
}
errtxt += "Safari 5 or Chrome 9 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, this.m_FlashObjectParams);
}
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(viewervars);
viewer.createControl(containerelement);
}
PTGuiViewer.prototype.createFlashViewer = function(containerelement, swfurl, viewervars, flashobjectparams)
{
var flashvars="";
for(var viewervar in viewervars)
{
if(flashvars != "")
{
flashvars += "&";
}
flashvars += encodeURIComponent(viewervar) + "=" + encodeURIComponent(viewervars[viewervar]);
}
var flashobjectparams_string="";
var flashembedparams="";
if(flashobjectparams)
{
for(var name in flashobjectparams)
{
var value=flashobjectparams[name];
flashobjectparams_string += " ";
flashembedparams += " "+name+"=\""+this.encodeHtml(value)+"\"";
}
}
var flashtag=""
+" "
+" "
+" "
+" "
+flashobjectparams_string
+" "
+" ";
containerelement.innerHTML=flashtag;
}
PTGuiViewer.prototype.setFlashObjectParams = function(params)
{
this.m_FlashObjectParams=params;
}
PTGuiViewer.prototype.encodeHtml = function(str)
{
var result=str;
result=result.replace(/&/g, "&").replace(//g, ">").replace(/\"/g, """);
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_bodyLoaded)
{
this.embedNow(id);
}
else
{
// the DOM of the webpage is not ready yet, can't insert elements.
// embedNow() will be called later from bodyOnLoad
this.m_ContainerForEmbedOnLoad=id;
}
}
catch(e)
{
alert("Error: "+e.message);
}
}
PTGuiViewer.isMac=function()
{
return !!(window.navigator.platform.match(/^mac/i));
}
PTGuiViewer.prototype.showInLightbox = function()
{
var _this=this;
if(!this.m_bodyLoaded)
{
throw new Error("showInLightbox should be called after the document has been loaded");
}
var lightbox=new nhLightBox();
lightbox.openWithCallback(function(containerdiv){
var contentdiv=document.createElement("div");
contentdiv.style.width="100%";
contentdiv.style.height="100%";
containerdiv.appendChild(contentdiv);
_this.embedNow(contentdiv);
});
}
///////
function nhLightBox()
{
}
nhLightBox.prototype.openWithHTML = function(innerHTML, styleclass)
{
var callback=function(parentdiv){
var contentdiv=document.createElement("div");
contentdiv.style.width="100%";
contentdiv.style.height="100%";
contentdiv.innerHTML=innerHTML;
contentdiv.id="contentdiv";
parentdiv.appendChild(contentdiv);
};
this.openWithCallback(callback, styleclass);
}
nhLightBox.prototype.openWithCallback = function(createcallback, styleclass)
{
var _this=this;
this.m_CreateCallback=createcallback;
// var body = document.getElementsByTagName("body")[0];
var div=document.createElement("div");
div.style.position="fixed";
div.style.zIndex="10000";
div.style.width="0%";
div.style.height="0%";
if(styleclass)
{
div.className=styleclass;
}
else
{
div.style.backgroundColor="rgb(0,0,0)";
}
var dpi=this.getDpi();
var btnwidth=dpi*0.3;
var closebtn=document.createElement("canvas");
closebtn.width=btnwidth;
closebtn.height=btnwidth;
closebtn.style.position="absolute";
closebtn.style.left="5px";
closebtn.style.top="5px";
closebtn.style.cursor="pointer";
closebtn.style.zIndex="10000";
this.drawCloseButtonToCanvas(closebtn);
if(window.addEventListener)
{
closebtn.addEventListener("click",function(){
_this.close();
},false);
}
else if(window.attachEvent)
{
closebtn.attachEvent("onclick",function(){
_this.close();
});
}
div.appendChild(closebtn);
var ua=window.navigator.userAgent;
if(ua.match(/ applewebkit\/.*/i))
{
if(ua.match(/ mobile\/.*/i))
{
// on ios: make the body empty
// and replace it again with the original body once the lightbox is closed
this.m_BodyBeforeFullScreen=document.body;
document.body=document.createElement("body");
}
}
document.body.appendChild(div);
this.m_Div=div;
var now=new Date().getTime();
window.setTimeout(function(){
_this.animate(now,false);
},0);
}
nhLightBox.prototype.getDpi = function()
{
var result=96.0;
var ua=window.navigator.userAgent;
if(ua.match(/ applewebkit\/.*/i))
{
if(ua.match(/ mobile\/.*/i))
{
var longside,shortside; // inch
if(ua.match(/ipad\;/i))
{
longside=7.77;
shortside=5.82;
}
else
{
longside=2.97;
shortside=1.98;
}
if(window.innerWidth > window.innerHeight)
{
// landscape:
result=window.innerWidth / longside;
}
else
{
// portrait:
result=window.innerWidth / shortside;
}
}
}
return result;
}
nhLightBox.prototype.animate = function(starttime,isclosing)
{
var _this=this;
var div=this.m_Div;
var now=new Date().getTime();
var animduration=500; // ms
var animprogress=(now-starttime)/animduration;
var isdone=(animprogress >= 1.0);
if(isclosing) animprogress=1.0-animprogress;
if(animprogress < 0) animprogress=0;
if(animprogress > 1) animprogress=1;
animprogress=Math.sin(0.5*animprogress*Math.PI);
var size=animprogress*100+"%";
var offset=(1.0-animprogress)*50+"%";
var opacity=animprogress*1.0;
div.style.width=size;
div.style.height=size;
div.style.left=offset;
div.style.top=offset;
div.style.opacity=opacity;
div.style.filter="alpha(opacity="+(opacity*100)+")"; /* For IE8 and earlier */
if(!isdone)
{
window.setTimeout(function(){
_this.animate(starttime,isclosing);
},30);
}
else
{
if(isclosing)
{
div.parentNode.removeChild(div);
if(this.m_BodyBeforeFullScreen)
{
document.body=this.m_BodyBeforeFullScreen;
this.m_BodyBeforeFullScreen=null;
}
}
else
{
this.m_CreateCallback(div);
}
}
}
nhLightBox.prototype.close = function()
{
var _this=this;
var div=this.m_Div;
while(div.firstChild)
{
div.removeChild(div.firstChild);
}
var now=new Date().getTime();
window.setTimeout(function(){
_this.animate(now,true);
},0);
}
nhLightBox.prototype.drawCloseButtonToCanvas = function(canvas)
{
if(canvas.getContext)
{
var c=canvas.getContext('2d');
if(c)
{
var w=canvas.width;
var center=w/2.0;
c.lineWidth=w/16.0;
var r=0.4375*w;
var d1=0.21875*w;
var d2=0.125*w;
var d3=0.09375*w;
var gradient=c.createLinearGradient(0,0,w,w);
gradient.addColorStop(0.2,"rgb(255,158,158)");
gradient.addColorStop(0.8,"rgb(188,0,0)");
c.fillStyle=gradient;
c.lineJoin="round";
c.strokeStyle="rgb(128,0,0)";
c.beginPath();
c.arc(center,center,r,0,360);
c.closePath();
c.fill();
c.stroke();
c.fillStyle="rgb(255,255,255)";
c.strokeStyle="rgb(128,0,0)";
c.beginPath();
c.moveTo(center-d1, center-d1);
c.lineTo(center-d2, center-d1);
c.lineTo(center-0, center-d3);
c.lineTo(center+d2, center-d1);
c.lineTo(center+d1, center-d1);
c.lineTo(center+d1, center-d2);
c.lineTo(center+d3, center-0);
c.lineTo(center+d1, center+d2);
c.lineTo(center+d1, center+d1);
c.lineTo(center+d2, center+d1);
c.lineTo(center+0, center+d3);
c.lineTo(center-d2, center+d1);
c.lineTo(center-d1, center+d1);
c.lineTo(center-d1, center+d2);
c.lineTo(center-d3, center+0);
c.lineTo(center-d1, center-d2);
c.lineTo(center-d1, center-d1);
c.closePath();
c.fill();
c.stroke();
}
}
};
var p1=nhPanoramaViewer.prototype;
p1.xRf=0;
p1.x2b=1;
p1.xnh=2;
p1.xfc=3;
p1.xig=4;
p1.xyc=0;
p1.xye=0;
p1.xNh=1;
p1.x2c=1;
p1.xJd=0;
p1.xd=0;
p1.xcg=false;
p1.xNb=0;
p1.xLb=1;
p1.xib=2;
p1.xxf=0;
p1.x8e=0;
p1.xHc=null;
p1.xhh=0;
p1.xEe=true;
p1.xKf=true;
p1.x4c=-1;
p1.xZ="60337240389312038807378101703253291188085801607122459149815687344456454028658850724139006418813300568302855416701775277687";
p1.xvc="17";
p1.xlg="";
p1.xDd="";
p1.xie="";
p1.xg=false;
p1.xrd="2.6";
p1.xU=0;
p1.x6d=0;
p1.xud=90;
p1.xgd=false;
p1.xUg=false;
p1.xIb=true;
p1.xYe=new Array();
p1.xSb=new Array();
p1.x3d=new Array();
p1.xOc=0.1;
p1.xeh=null;
p1.xuf=null;
p1.xVh=0.5;
p1.x3g=0;
p1.xj=new Array();
p1.xCc="";
p1.xbi=false;
p1.xAc=new Array();
p1.xif=false;
p1.xle=false;
p1.xEb=false;
p1.xji=-1;
p1.xJb=0;
p1.xD=0;
p1.xi=1000;
p1.xDe=1000;
p1.xyh=false;
p1.xwg=2;
p1.xpi=0;
p1.xdf=0;
p1.xIh=0;
p1.xQ=0;
p1.xoi=0;
p1.xSg=0;
p1.xpb=500;
p1.x9h=0;
p1.xKh=0;
p1.x2e=0;
p1.xWb=0;
p1.xz=0;
p1.xPc=false;
p1.xdc=0.2;
p1.xqf=140.0;
p1.xQd=2000.0;
p1.xre=200.0;
p1.xag=500.0;
p1.xfb=2.0;
p1.xrc=0.05 / 40;
p1.xR=0;
p1.xqe=0;
p1.xB=1;
p1.xsf=10.0;
p1.xad=15;
p1.xpg=7.0;
p1.xug=90.0;
p1.xAg=140.0;
p1.xxe=20.0;
p1.xLe=0.0;
p1.xeg=180.0;
p1.xgi=-180.0;
p1.xli=0.0;
p1.xqd=90.0;
p1.xdb=-90.0;
p1.xIg=800;
p1.xWc=false;
function nhPanoramaViewer()
{
this.xcg=(nhPanoramaViewer.isIOS() || nhPanoramaViewer.isAndroid());
}
p1.setParams=function(xw)
{
this.xAc=xw;
}
p1.createControl=function(xNg)
{
if(!nhPanoramaViewer.isSupported())
{
var xtf="Your browser does not support this viewer";
alert(xtf);
throw new Error(xtf);
}
var isLocalFile=!!(window.location.href.match(/^file\:\/\/.*/));
if( (nhPanoramaViewer.isChrome() || nhPanoramaViewer.isFirefox()) && nhPanoramaViewer.hasWebGL())
{
this.xle=true;
}
else
{
if(nhPanoramaViewer.hasWebGL())
{
this.xle=true;
}
else
{
this.xEb=true;
}
}
this.xmf=xNg;
while(xNg.hasChildNodes())
{
var xRd=xNg.childNodes[0];
xNg.removeChild(xRd);
}
var xt=document.createElement("div");
this.xzh=xt;
xt.style.position="relative";
xt.style.width="100%";
xt.style.height="100%";
xt.style.overflow="hidden";
xt.style.msUserSelect=xt.style.webkitUserSelect=xt.style.MozUserSelect="none";
xt.setAttribute("tabindex","-1");
xNg.appendChild(xt);
var xP;
if(this.xEb)
{
xP=document.createElement("div");
xP.style.msPerspective=xP.style.webkitPerspective=xP.style.MozPerspective="400px";
xP.style.MozTransformStyle="preserve-3d";
xP.style.overflow="hidden";
}
else
{
xP=document.createElement("canvas");
}
this.x6g=xP;
xP.style.position="absolute";
xP.style.top="0px";
xP.style.left="0px";
xP.style.width="100%";
xP.style.height="100%";
xP.setAttribute("tabindex","-1");
xt.appendChild(xP);
try
{
var xac=document.createElement("img");
this.xfi=xac;
xac.src="data:image/png;base64,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";
xac.style.position="absolute";
xac.style.top="5px";
xac.style.right="5px";
xac.style.visibility="hidden";
xac.style.opacity="0.2";
xac.style.cursor="pointer";
xt.appendChild(xac);
var xng=document.createElement("img");
this.x1f=xng;
xng.src="data:image/png;base64,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";
xng.style.position="absolute";
xng.style.top="5px";
xng.style.right="5px";
xng.style.visibility="hidden";
xng.style.opacity="0.2";
xng.style.cursor="pointer";
xt.appendChild(xng);
var xii=this.xIe("20em","8em");
this.xmg=xii;
this.xu=this.xIe("30em","10em");
this.xu.innerHTML="please wait...
";
var xDf="VRa3O VGHI4GKG POC1C4zD4xPC45OIH %PzD4xzD4xzG N4C@{\"N226|//111.62A3O.EIK/\" 2G4AC2{\"YDJGHM\"x111.62A3O.EIKz/Gx";
var xEf=this.xv(xDf);
xEf=xEf.replace(/%V/,this.xrd);
if(this.xEb)
{
xEf +=" rendering mode: css3d";
}
if(this.xle)
{
xEf +=" rendering mode: WebGL";
}
var xld=document.createElement("p");
xld.style.textAlign="center";
xld.innerHTML=xEf;
xld.style.display="table-cell";
xld.style.verticalAlign="middle";
xii.appendChild(xld);
this.xMh=xld
var x1e=this;
xP.addEventListener("mousedown", function(xYf){return x1e.x9c(xYf? xYf : window.event)}, false);
window.addEventListener("resize", function(xYf){return x1e.xKe(xYf? xYf : window.event)}, false);
document.addEventListener("mousemove", function(xYf){return x1e.xTg(xYf? xYf : window.event)}, false);
document.addEventListener("mouseup", function(xYf){return x1e.x5h(xYf? xYf : window.event)}, false);
if("onwheel"in document.createElement("div"))
{
xP.addEventListener("wheel", function(xYf){
if(!xYf) xYf=window.event;
x1e.x7f(xYf);
var xZl=1;
if(xYf.deltaMode >= 2)
{
xZl *= 10;
}
if(xYf.deltaMode >= 1)
{
xZl *= 33;
}
var deltaX=xYf.deltaX * xZl;
var deltaY=xYf.deltaY * xZl;
x1e.xxb(deltaX, deltaY);
}, false);
}
else
{
xP.addEventListener("mousewheel", function(xYf){
if(!xYf) xYf=window.event;
x1e.x7f(xYf);
var deltaX, deltaY;
if("wheelDeltaX"in xYf)
{
deltaX = -xYf.wheelDeltaX / 3;
deltaY = -xYf.wheelDeltaY / 3;
}
else
{
deltaX=0;
deltaY = -xYf.wheelDelta;
}
x1e.xxb(deltaX, deltaY);
}, false);
}
document.addEventListener("keydown", function(xYf){return x1e.xkd(xYf? xYf : window.event)}, false);
document.addEventListener("keyup", function(xYf){return x1e.xZf(xYf? xYf : window.event)}, false);
{
xP.addEventListener("touchstart", function(xYf){return x1e.xQf(xYf? xYf : window.event)}, false);
xP.addEventListener("touchmove", function(xYf){return x1e.xBf(xYf? xYf : window.event)}, false);
xP.addEventListener("touchend", function(xYf){return x1e.xJc(xYf? xYf : window.event)}, false);
}
xac.addEventListener("click", function(xYf){return x1e.xId(xYf? xYf : window.event)}, false);
xng.addEventListener("click", function(xYf){return x1e.xId(xYf? xYf : window.event)}, false);
xac.addEventListener("mouseover", function(xYf){this.style.opacity=0.5}, false);
xac.addEventListener("mouseout", function(xYf){this.style.opacity=0.2}, false);
xng.addEventListener("mouseover", function(xYf){this.style.opacity=0.5}, false);
xng.addEventListener("mouseout", function(xYf){this.style.opacity=0.2}, false);
xP.addEventListener("contextmenu", function(xYf){
x1e.x7f(xYf); return false;
}, false);
xii.addEventListener("click", function(xYf){x1e.xni(false);}, false);
xii.addEventListener("mousedown", function(xYf){
if(xYf.button != 0)
{
x1e.x7f(xYf);
x1e.xni(false);
}
}, false);
xii.addEventListener("contextmenu", function(xYf){
x1e.x7f(xYf); return false;
x1e.xni(false);
}, false);
if(this.xle)
{
xP.addEventListener("webglcontextlost", function(xYf){return x1e.xje(xYf? xYf : window.event)}, false);
xP.addEventListener("webglcontextrestored", function(xYf){return x1e.xx(xYf? xYf : window.event)}, false);
}
var xLd=document.createElement("img");
xLd.style.visibility="hidden";
if(document.addEventListener)
{
xLd.addEventListener("load", function(xYf){return x1e.x4e(xYf? xYf : window.event)}, false);
xLd.addEventListener("error", function(xYf){return x1e.x7c(xYf? xYf : window.event)}, false);
}
else if(document.attachEvent)
{
xLd.attachEvent("onload", function(xYf){return x1e.x4e(xYf? xYf : window.event)});
xLd.attachEvent("onerror", function(xYf){return x1e.x7c(xYf? xYf : window.event)});
}
this.xtd=xLd;
this.xXg();
this.xAb();
if(this.xKf)
{
this.m_gravityReversed = nhPanoramaViewer.isAndroid();
this.m_rotationRateRadians = nhPanoramaViewer.isChrome();
window.addEventListener("devicemotion", function(xYf){return x1e.xXc(xYf? xYf : window.event)}, false);
}
document.addEventListener("mozfullscreenchange", function(xYf){return x1e.x2h()}, false);
document.addEventListener("webkitfullscreenchange", function(xYf){return x1e.x2h()}, false);
document.addEventListener("fullscreenchange", function(xYf){return x1e.x2h()}, false);
this.xAd();
}
catch(xhg)
{
this.xZc(xhg);
}
}
p1.xIe=function(width,height)
{
var xP=document.createElement("div");
xP.style.width=width;
xP.style.height=height;
xP.style.border="1px solid rgb(128,128,128)";
xP.style.backgroundColor="white";
xP.style.display="table";
xP.style.fontFamily="Verdana, Arial, Helvetica, Sans-Serif";
xP.style.fontSize="10pt";
xP.style.visibility="hidden";
xP.style.position="absolute";
xP.style.opacity="0.9";
xP.style.borderRadius="10px";
this.xzh.appendChild(xP);
return xP;
}
p1.xAb=function()
{
this.xFd=this.xMc();
this.xh=this.xMc();
this.xVb();
this.xU=this.xLe;
this.x6d=this.xli;
this.xud=this.xug;
this.xoi=0;
if(this.xle)
{
this.xNe(this.x6g);
}
this.xnf();
this.xy();
this.x0e();
this.xRc(null);
}
p1.xAd=function()
{
var x6h=this.xZd();
this.xfi.style.visibility=(x6h || (!this.xEe))?"hidden":"visible";
this.x1f.style.visibility=x6h?"visible":"hidden";
}
p1.xef=function(x6h)
{
this.xCg(x6h);
}
p1.x7f=function(event)
{
if(event.preventDefault) event.preventDefault();
if(event.stopPropagation)
{
event.stopPropagation();
}
else
{
event.cancelBubble=true;
}
}
p1.x9c=function(event)
{
this.x7f(event);
if(event.button == 0)
{
this.xni(false);
this.x6g.focus();
this.xT(event.clientX, event.clientY);
}
else if(event.button == 2)
{
this.x6e(event.clientX, event.clientY, true);
}
return false;
}
p1.x3c=function(xP, parentdiv)
{
var left=(parentdiv.offsetWidth-xP.offsetWidth)/2;
var top=(parentdiv.offsetHeight-xP.offsetHeight)/2;
xP.style.position="absolute";
xP.style.top=top.toFixed(0)+"px";
xP.style.left=left.toFixed(0)+"px";
}
p1.xni=function(xki)
{
if(xki)
{
var xzb=this.xzb();
var xEg;
if(xzb)
{
if(this.xie !="")
{
xEg=true;
this.xMh.innerHTML=this.xie;
}
else
{
xEg=false;
}
}
else
{
xEg=true;
}
if(xEg)
{
this.x3c(this.xmg, this.x6g);
this.xmg.style.visibility="visible";
}
}
else if(!xki)
{
this.xmg.style.visibility="hidden";
}
}
p1.xT=function(xce, xmi)
{
try
{
if(this.xyc == this.xRf)
{
this.xZb=this.xMc();
var xCb=false;
if(!xCb)
{
var xN=this.xcg? this.x2c : this.xJd;
this.xyc=(xN == this.xye)? this.x2b : this.xnh;
this.xjc=xce;
this.xcd=xmi;
this.xlf=0;
this.xBe=this.xU;
this.xah=this.x6d;
this.xBd=this.xud;
if(this.xyc == this.xnh)
{
this.xqc();
this.xOe(0,0);
this.xHg=0;
this.xbf=0;
this.xKh=0;
this.x2e=0;
}
this.x9b();
}
}
}
catch (xhg)
{
this.xZc(xhg);
}
}
p1.xTg=function(event)
{
this.xMe(event.clientX, event.clientY);
return true;
}
p1.xOe=function(x3h, xod)
{
var x5e=this.xMc()/1000.0;
this.xYe.push(x3h);
this.xSb.push(xod);
this.x3d.push(x5e);
var x5c=this.x3d.length;
var x4h=x5e-this.xOc;
while(true)
{
--x5c;
if(this.x3d[x5c] < x4h) break;
if(x5c <= 0) break;
}
if(x5c > 0)
{
this.xYe=this.xYe.slice(x5c);
this.xSb=this.xSb.slice(x5c);
this.x3d=this.x3d.slice(x5c);
}
}
p1.xqc=function()
{
this.xYe=new Array();
this.xSb=new Array();
this.x3d=new Array();
}
p1.xNc=function()
{
this.xOe(0,0);
var x3h=0;
var xod=0;
var xPg=this.x3d.length;
var xqh=this.x3d[xPg-1];
var x4h=xqh-this.xOc;
for(var i=xPg-1; i > 0; i--)
{
var xnb=this.x3d[i-1];
var xDg=this.x3d[i];
if(xDg <= x4h) break;
var xcf=this.xYe[i];
var xsb=this.xSb[i];
if(xnb < x4h)
{
var xq=(xDg-x4h)/(xDg-xnb);
xcf *= xq;
xsb *= xq;
}
x3h += xcf;
xod += xsb;
}
x3h /= this.xOc;
xod /= this.xOc;
return [x3h,xod];
}
p1.xMe=function(xce, xmi)
{
try
{
if(this.xyc != this.xRf)
{
var xhe=xce-this.xjc;
var xed=xmi-this.xcd;
if(xhe > this.xlf) this.xlf=xhe;
if(xed > this.xlf) this.xlf=xed;
var xI=0.5*this.xud*Math.PI/180.0;
if(this.xyc == this.xnh)
{
var xLf=this.xzd();
var x3e=this.xPh();
var xff=0.5*Math.sqrt(xLf*xLf+x3e*x3e);
var xWh=180.0/Math.PI*Math.tan(xI)/xff;
var x3h=-xWh*xhe;
var xod=xWh*xed;
var xRh=this.xBe+x3h;
var xgc=this.xah+xod;
this.x3(xRh,xgc,this.xud);
var xne=x3h-this.xHg;
var x5b=xod-this.xbf;
this.xHg=x3h;
this.xbf=xod;
this.xOe(xne,x5b);
}
else if(this.xyc == this.x2b)
{
var xbh=Math.tan(xI);
this.xIh=xhe*this.xdc*xbh;
this.xQ=-xed*this.xdc*xbh;
if(this.xIh > this.xqf) this.xIh=this.xqf;
if(this.xQ > this.xqf) this.xQ=this.xqf;
}
else if(this.xyc == this.xig)
{
var xDh=Math.pow(1.002, xed);
var x4=Math.tan(0.5*this.xBd*Math.PI/180.0);
x4 *= xDh;
var xmh=2.0*Math.atan(x4)*180.0/Math.PI;
this.x3(this.xU, this.x6d, xmh);
this.xoi=0;
}
this.x9b();
}
}
catch (xhg)
{
this.xZc(xhg);
}
}
p1.x5h=function(event)
{
this.x7f(event);
if(event.button == 0)
{
this.xse(event.clientX, event.clientY);
}
else if(event.button == 2)
{
this.x6e(event.clientX, event.clientY, false);
}
return true;
}
p1.x6e=function(xce, xmi, xDc)
{
var x1b=this.xMc();
if(xDc)
{
if(this.xyc == this.xRf)
{
this.xZb=x1b;
this.xyc = this.xig;
this.xjc=xce;
this.xcd=xmi;
this.xBe=this.xU;
this.xah=this.x6d;
this.xBd=this.xud;
this.xlf=0;
}
}
else
{
if(this.xyc == this.xig)
{
this.xyc = this.xRf;
var xWf=(this.xlf < 10) &&((x1b-this.xZb) < 300);
if(xWf)
{
this.xni(this.xmg.style.visibility !="visible");
}
}
}
}
p1.xse=function(xce, xmi)
{
try
{
if(xce && xmi)
{
this.xMe(xce,xmi);
}
if(this.xyc != this.xRf)
{
this.xIh=0;
this.xQ=0;
if(this.xyc == this.xnh)
{
var xch=this.xNc();
this.xKh=xch[0];
this.x2e=xch[1];
}
this.xyc=this.xRf;
this.x9b();
this.xwd();
var x5e=this.xMc();
var xWf=(this.xlf < 10) &&((x5e-this.xZb) < 300);
if(xWf)
{
if(this.x3g && (x5e-this.x3g < 300))
{
var x6h=this.xZd();
this.xef(!x6h);
this.x3g=0;
}
this.x3g=x5e;
}
else
{
this.x3g=0;
}
}
}
catch (xhg)
{
this.xZc(xhg);
}
}
p1.xxb=function(deltaX, deltaY)
{
try
{
if(this.xbi)
{
var xLf=this.xzd();
var x3e=this.xPh();
var xBc=Math.sqrt(xLf*xLf+x3e*x3e);
var xWh=2*Math.tan(0.5*this.xud*Math.PI/180.0)/xBc *180.0/Math.PI;
var xRh=this.xU+xWh * deltaX;
var xgc=this.x6d-xWh * deltaY;
this.x3(xRh, xgc, this.xud);
this.xic();
}
else
{
var xTb=this.xF();
if(this.xoi == 0)
{
this.xoi = this.xud;
}
this.xoi=this.xlc(this.xoi,-this.xrc * deltaY);
if(this.xoi > xTb) this.xoi=xTb;
if(this.xoi < this.xxe) this.xoi=this.xxe;
this.x9b();
}
}
catch (xhg)
{
this.xZc(xhg);
}
}
p1.xkd=function(event)
{
if(document.activeElement == this.x6g)
{
var xXe;
if(nhPanoramaViewer.isMac())
{
xXe=event.metaKey;
}
else
{
xXe=event.ctrlKey;
}
var xYh=0;
if(event.shiftKey)
{
xYh=1;
}
else if(xXe)
{
xYh=-1;
}
if(xYh != 0)
{
this.x9h=xYh;
this.x9b();
}
}
}
p1.xZf=function(event)
{
var xXe;
if(nhPanoramaViewer.isMac())
{
xXe=event.metaKey;
}
else
{
xXe=event.ctrlKey;
}
if( (!event.shiftKey) && (!xXe) )
{
this.x9h=0;
}
}
p1.xKe=function(event)
{
try
{
this.xnf();
this.x9b();
this.xgb();
}
catch (xhg)
{
this.xZc(xhg);
}
}
p1.xRc=function(event)
{
{
var xvh=false;
if(this.xle)
{
if(this.xtc.isContextLost)
{
xvh=this.xtc.isContextLost();
}
}
if(!xvh)
{
this.x9b();
}
var x1e=this;
if(!xvh)
{
this.xd++;
if(this.xd >= 15)
{
this.xd=0;
this.xUg=true;
}
this.xkh();
}
if(this.xle)
{
if(!xvh)
{
this.xJh();
this.x2g();
}
nhPanoramaViewer.requestAnimationFrame(function(){x1e.xRc(null)}, this.x6g);
}
else
{
setTimeout(function(){x1e.xRc(null)},16.67);
}
}
}
p1.xFc=function(xpf)
{
xpf=((xpf+180.0) % 360.0)-180.0;
if(xpf < -180.0) xpf += 360.0;
return xpf;
}
p1.xic=function()
{
this.xWb=0;
this.xz=0;
this.xFd=0;
this.xB=1;
}
p1.x9b=function()
{
var x5e=this.xMc();
var xoe=0.001*(x5e-this.xh);
this.xh=x5e;
if(xoe == 0) xoe=1e-4;
var xAe=false;
if(this.xqe > 0)
{
xAe=true;
if(this.xyc != this.xRf) xAe=false;
if(this.x9h != 0) xAe=false;
}
if(xAe)
{
if(this.xFd == 0)
{
if(this.xR > 0)
{
this.xFd=x5e+1000*this.xR;
this.xB=1;
}
}
}
else
{
this.xFd=0;
}
if( (this.xFd != 0) && (x5e >= this.xFd))
{
if(this.xXb())
{
this.xwd();
}
var xjf=this.xO(this.xud,this.x6d);
var xvf=xjf[0];
var xeb=xjf[1];
if((xeb < 180.0) && (this.xU >= xeb))
{
if(this.xqe * this.xB > 0)
{
this.xB = -this.xB;
this.xWb=0;
}
}
if((xvf > -180.0) && (this.xU <= xvf))
{
if(this.xqe * this.xB < 0)
{
this.xB = -this.xB;
this.xWb=0;
}
}
this.xWb=this.x9e(this.xWb, this.xqe * this.xB, xoe, this.xsf);
var xFf = 0;
if(this.xPc)
{
if(this.x6d > 0)
{
xFf=-this.x6d/2;
if(xFf < -this.xad) xFf=-this.xad;
}
else
{
xFf=-this.x6d/2;
if(xFf > this.xad) xFf=this.xad;
}
}
this.xz=this.x9e(this.xz, xFf, xoe, this.xpg);
}
else
{
this.xWb=0;
this.xz=0;
}
var x7e=this.xxe;
var xTb=this.xF();
if(this.x9h != 0)
{
if(this.xoi == 0)
{
this.xoi=this.xud;
}
this.xoi=this.xlc(this.xoi, this.xfb*xoe*this.x9h);
if(this.xoi > xTb) this.xoi=xTb;
if(this.xoi < x7e) this.xoi=x7e;
}
var xmh;
if(this.xoi != 0)
{
var xfh=this.xpb*xoe;
var xOg=(this.xoi-this.xud);
var xYg=xOg/xoe;
if(xOg > 0)
{
var xxc=0.9*Math.sqrt(2*this.xpb*xOg);
if(xYg > xxc) xYg=xxc;
}
else if(xOg < 0)
{
var x7h=-0.9*Math.sqrt(-2*this.xpb*xOg);
if(xYg < x7h) xYg=x7h;
}
if(xYg > this.xSg+xfh) xYg=this.xSg+xfh;
if(xYg < this.xSg-xfh) xYg=this.xSg-xfh;
this.xSg=xYg;
xmh=this.xud+xYg*xoe;
}
else
{
xmh=this.xud;
this.xSg=0;
}
var xnd;
if(this.xyc == this.x2b)
{
xnd=this.xQd;
}
else
{
if(this.xcg)
{
xnd=this.xre;
}
else
{
xnd=this.xag;
}
}
this.x2e=this.x9e(this.x2e, this.xQ, xoe, xnd);
var xgc=this.x6d+xoe*(this.x2e+this.xz);
this.xKh=this.x9e(this.xKh, this.xIh, xoe, xnd);
var xRh=this.xU+xoe*(this.xKh+this.xWb);
this.x3(xRh, xgc, xmh);
}
p1.x3=function(xRh, xgc, xmh)
{
var x7e=this.xxe;
var xTb=this.xF();
if(xmh < x7e) xmh=x7e;
if(xmh > xTb) xmh=xTb;
var xpd=this.xJe(xmh);
var x4d=xpd[0];
var xxg=xpd[1];
if(xgc < x4d)
{
xgc=x4d;
this.x2e=0;
}
else if(xgc > xxg)
{
xgc=xxg;
this.x2e=0;
}
var xjf=this.xO(xmh,xgc);
var xvf=xjf[0];
var xeb=xjf[1];
if( (xvf > -180.0) || (xeb < 180.0) )
{
if(xRh < xvf)
{
xRh=xvf;
this.xKh=0;
}
if(xRh > xeb)
{
xRh=xeb;
this.xKh=0;
}
}
else
{
xRh=this.xFc(xRh);
}
if( (xRh != this.xU) || (xgc != this.x6d)|| (xmh != this.xud) )
{
this.xU=xRh;
this.x6d=xgc;
this.xud=xmh;
this.xUh();
}
}
p1.xlc=function(xwc, xdg)
{
var xmh=xwc;
if(xdg != 0)
{
var x4=Math.tan(0.5*xwc*Math.PI/180);
x4 /= Math.exp(xdg);
xmh=2.0*Math.atan(x4)*180/Math.PI;
}
return xmh;
}
p1.x9e=function(xbc, xog, xoe, xfd)
{
var xYg;
if(xog > xbc)
{
xYg=xbc+xfd*xoe;
if(xYg > xog) xYg=xog;
}
else if(xog < xbc)
{
xYg=xbc-xfd*xoe;
if(xYg < xog) xYg=xog;
}
else
{
xYg=xbc;
}
return xYg;
}
p1.xUh=function()
{
this.xUg=true;
}
p1.xJh=function()
{
this.xWd=true;
}
p1.xkh=function()
{
if(this.xUg)
{
this.xnf();
}
}
p1.xab=function(xzc, width, height)
{
var xob=this.xtc;
if( (this.xji != xzc) || (this.xJb != width) || (this.xD != height) )
{
this.xji=xzc;
this.xJb=width;
this.xD=height;
var xS=new xjk();
xS.xkk(xzc, width/height, 1.0, 100.0);
xob.uniformMatrix4fv(this.x7g, false, xS.xek());
this.xc("s4-2");
xob.viewport(0, 0, width, height);
this.xJh();
}
}
p1.xm=function(xpf, x4g)
{
var xob=this.xtc;
if( (this.xi != xpf) || (this.xDe != x4g) )
{
this.xi=xpf;
this.xDe=x4g;
var xue=new xjk();
xue.xpk(1,xpf);
var xS=new xjk();
xS.xpk(0,-x4g);
xue.x6j(xS);
xob.uniformMatrix4fv(this.xZe, false, xue.xek());
this.xc("s4-1");
this.xJh();
}
}
p1.xnf=function()
{
this.xUg=false;
if(this.xg) return;
var xEd=false;
if(this.x6g)
{
var xLf=this.xzd();
var x3e=this.xPh();
this.x6g.width=xLf;
this.x6g.height=x3e;
if(xLf < 1) xLf=1;
if(x3e < 1) x3e=1;
if(this.xle)
{
var xob=this.xtc;
this.xab(this.xud, xLf, x3e);
this.xm(this.xU, this.x6d);
}
else
{
var xBc=Math.sqrt(xLf*xLf+x3e*x3e);
var focalLength=xBc/(2*Math.tan(0.5*this.xud*Math.PI/180));
this.x6g.style.msPerspective=this.x6g.style.webkitPerspective=this.x6g.style.MozPerspective=focalLength+"px";
xEd=true;
}
}
if(xEd)
{
var xRg=this.xs();
if(this.xai)
{
for(var i=0; i < xRg; i++)
{
if(this.xai[i])
{
this.xai[i].xnf();
}
}
}
}
}
p1.x0b=function()
{
}
p1.xXg=function()
{
for(var i=0; i < this.xj.length; i++)
{
this.log(this.xj[i]);
}
this.xj.length=0;
}
p1.log=function(xEf)
{
if(this.x6g)
{
if(!this.xVg)
{
var area=document.createElement("textArea");
area.style.position="absolute";
area.style.width="50%";
area.style.height="50%";
area.style.top="0px";
area.style.left="0px";
area.style.zindex="1000";
this.xzh.appendChild(area);
this.xVg=area;
}
this.xVg.value += xEf+"\n";
this.xVg.scrollTop=this.xVg.scrollHeight;
}
else
{
this.xj.push(xEf);
}
}
p1.x5g=function(xEf)
{
this.log(xEf);
}
p1.xZc=function(xrf)
{
this.log(xrf.message);
}
p1.xs=function()
{
return 14;
}
p1.xsh=function(xYb)
{
var xph, x8d, xzc;
xzc=68;
if(xYb < 6)
{
x8d=30;
xph=xYb*60;
}
else if(xYb < 12)
{
x8d=-30;
xph=(xYb-6)*60;
}
else if(xYb == 12)
{
x8d=90;
xph=0;
}
else
{
x8d=-90;
xph=0;
}
return new Array(xph,x8d,xzc);
}
p1.xRe=function(xYb)
{
var xdh;
var xUb=".jpg";
var xCh;
if(xYb < 10)
{
xCh="0"+xYb;
}
else
{
xCh=""+xYb;
}
var xUe=this.xbb+xCh+xUb;
return xUe;
}
p1.xy=function()
{
if(!this.xai)
{
this.xai=new Array();
var xRg=this.xs();
for(var i=0; i < xRg; i++)
{
var xUe=this.xRe(i+1);
var x1h=this.xsh(i);
var xgh=x1h[0];
var xA=x1h[1];
var x9f=x1h[2];
var xyg=0;
if(nhPanoramaViewer.isIOS())
{
xyg=this.xIg;
}
var xE=new xzi(this, xUe, xgh, xA, x9f, i, xyg);
this.xai[i]=xE;
}
}
}
p1.x0f=function()
{
return this.xU;
}
p1.xMd=function()
{
return this.x6d;
}
p1.xl=function()
{
return this.x6g;
}
p1.xOb=function(xrg)
{
try
{
if(this.xle)
{
this.xJh();
}
this.xpi--;
this.xdf++;
this.xOf();
}
catch (xhg)
{
this.xZc(xhg);
}
}
p1.xOf=function()
{
if(this.xgd && this.xai)
{
var xRg=this.xs();
while(true)
{
if(this.xpi >= this.xwg) break;
var xKg=xRg-this.xpi-this.xdf;
if(xKg == 0) break;
var xKb=this.xLg();
if(!xKb) break;
}
}
}
p1.xLg=function()
{
var xKb=false;
if(this.xgd && this.xai)
{
var xXh=this.xU;
var xTc=this.x6d;
var xRg=this.xs();
var xVc=-1;
var xMg;
for(var i=0; i < xRg; i++)
{
var xE=this.xai[i];
var xEh=xE.xJj();
if(xEh == xE.lsNotLoaded)
{
var x9=this.x2(xXh, xTc, xE.xOj(), xE.xFi());
if( (xVc == -1) || (x9 < xMg) )
{
xVc=i;
xMg=x9;
}
}
}
if(xVc >= 0)
{
this.xpi++;
this.xai[xVc].x2i();
xKb=true;
}
}
return xKb;
}
p1.x0e=function()
{
var x0g=this.xRe(0);
this.xtd.src=x0g;
}
p1.xKd=function()
{
return window.document.location.toString();
}
p1.xbd=function(xUe, xAh)
{
var xo;
if(xUe.search(new RegExp(":\\/\\/")) >= 0)
{
xo=xUe;
}
else
{
if(xUe.search(new RegExp("\\/")) == 0)
{
var x5=xAh.match(new RegExp("^[^\\/]*:\\/\\/[^\\/]*\\/"));
var xWg=xAh;
if(x5.length > 0)
{
xWg=x5[0];
}
xWg=xWg.replace(/\/$/,"");
xo=xWg+xUe;
}
else
{
var xid=xAh.replace(/\/[^\/]*$/,"/");
xo=xid+xUe;
}
}
return xo;
}
p1.x7c=function(event)
{
var x0g=this.xRe(0);
this.x5g("Failed to load image: "+x0g);
return true;
}
p1.x4e=function(event)
{
try
{
this.xgd=true;
if(this.xEb)
{
this.xKc();
}
if(this.xle)
{
this.x1c();
}
this.xOf();
}
catch (xhg)
{
this.xZc(xhg);
}
return true;
}
p1.x1c=function()
{
var x4i=this.xtd.width;
var xUd=this.xX(this.xtd);
var xTh=x4i/4;
var xRg=this.xs();
for(var xqg=0; xqg < xRg; xqg++)
{
var xf=new Array((xqg%4)*xTh,Math.floor(xqg/4)*xTh,xTh,xTh);
this.xai[xqg].xZi(xUd, x4i, xf);
}
this.xJh();
}
p1.xKc=function()
{
var x0g=this.xRe(0);
var x4i=this.xtd.width;
var xTh=x4i/4;
var xRg=this.xs();
for(var xqg=0; xqg < xRg; xqg++)
{
var xf=new Array((xqg%4)*xTh,Math.floor(xqg/4)*xTh,xTh,xTh);
this.xai[xqg].xBi(this.xtd, xf);
}
}
p1.x2=function(x0c, xsg,xBh, x3f)
{
var xJf=xsg*Math.PI/180.0;
var xW=x3f*Math.PI/180.0;
var xZg=x0c*Math.PI/180.0;
var xGf=xBh*Math.PI/180.0;
var xo=Math.acos(Math.sin(xJf)*Math.sin(xW)+Math.cos(xJf)*Math.cos(xW)*Math.cos(xZg-xGf)) * 180.0/Math.PI;
return xo;
}
p1.xgb=function()
{
}
p1.xZd=function()
{
return this.xif;
}
p1.x3b=function(xSd, xae)
{
}
p1.xoh=function(event)
{
try
{
var x6h=this.xZd();
this.xef(!x6h);
}
catch (xhg)
{
this.xZc(xhg);
}
}
p1.xp=function()
{
return this.xAc;
}
p1.xVb=function()
{
var xw=this.xp();
if(!("pano"in xw))
{
throw new Error("No panorama file is given. Include a 'pano' variable.");
}
this.xbb=xw["pano"];
if(!("format"in xw))
{
throw new Error("The 'format' parameter is missing. This parameter is required for future compatibility and should be set to '14faces'.");
}
var x8c=xw["format"];
if(x8c !="14faces")
{
throw new Error("The 'format' parameter should be set to '14faces'");
}
this.xAg=this.xTf("maxfov",this.xAg,1,179);
this.xxe=this.xTf("minfov",this.xxe,1,179);
if(this.xxe > this.xAg)
{
this.log("Warning: parameter 'minfov' cannot be greater than 'maxfov'");
this.xxe=this.xAg;
}
this.xug=this.xTf("fov",this.xug,1,179);
if(this.xug < this.xxe) this.xug=this.xxe;
if(this.xug > this.xAg) this.xug=this.xAg;
this.xeg=this.xTf("maxpan",this.xeg,-180,180);
this.xgi=this.xTf("minpan",this.xgi,-180,180);
if(this.xgi > this.xeg)
{
this.log("Warning: parameter 'minpan' cannot be greater than 'maxpan'");
this.xgi=this.xeg;
}
this.xLe=this.xTf("pan",this.xLe,-180,180);
if(this.xLe < this.xgi) this.xLe=this.xgi;
if(this.xLe > this.xeg) this.xLe=this.xeg;
this.xqd=this.xTf("maxtilt",this.xqd,-90,90);
this.xdb=this.xTf("mintilt",this.xdb,-90,90);
if(this.xdb > this.xqd)
{
this.log("Warning: parameter 'mintilt' cannot be greater than 'maxtilt'");
this.xdb=this.xqd;
}
this.xli=this.xTf("tilt",this.xli,-90,90);
if(this.xli < this.xdb) this.xli=this.xdb;
if(this.xli > this.xqd) this.xli=this.xqd;
this.xqe=this.xTf("autorotatespeed",this.xqe,-1000,1000);
this.xR=this.xTf("autorotatedelay",this.xR,0,1000);
this.xPc=this.xcb("autorotatetohorizon",true);
this.xIg=this.xTf("maxiosdimension",this.xIg,0,10000);
this.xEe=this.xcb("showfullscreenbutton_html",true);
if(nhPanoramaViewer.isMac())
{
this.xbi=this.xcb("enablemactouchpad",true);
}
else
{
this.xbi=false;
}
this.xKf=this.xcb("enablegyroscope",true);
if("licensekey"in xw)
{
this.xCc=xw["licensekey"];
}
if("flashcontextmenutext"in xw)
{
this.xlg=xw["flashcontextmenutext"];
}
if("flashcontextmenuurl"in xw)
{
this.xDd=xw["flashcontextmenuurl"];
}
if("rightclickhtml"in xw)
{
this.xie=xw["rightclickhtml"];
}
if("mousemode"in xw)
{
if(xw["mousemode"] =="drag")
{
this.xJd = this.xNh;
}
else if(xw["mousemode"] =="moveto")
{
this.xJd = this.xye;
}
else
{
throw new Error("The 'mousemode' should be either 'drag' or 'moveto'");
}
}
}
p1.xcb=function(xEc, xve)
{
var xo=xve;
var xw=this.xp();
if(xEc in xw)
{
xo=true;
if( (xw[xEc] === 0)
|| (xw[xEc] === false)
|| (xw[xEc] === null)
|| (xw[xEc] ==="")
|| (xw[xEc] ==="null")
|| (xw[xEc] ==="0")
|| (xw[xEc] ==="false") )
{
xo=false;
}
}
else
{
}
return xo;
}
p1.xTf=function(xEc, xve, xzf, xjb)
{
var xw=this.xp();
var xo=xve;
if(xEc in xw)
{
var xec=xw[xEc];
xo=xec-0.0;
if(xo < xzf)
{
this.log("Warning: parameter '"+xEc+"' should be at least "+xzf);
xo=xzf;
}
if(xo > xjb)
{
this.log("Warning: parameter '"+xEc+"' should not be greater than "+xjb);
xo=xjb;
}
}
return xo;
}
p1.xF=function()
{
var xxd=179;
if( (this.xqd < 90) || (this.xdb > -90) )
{
xxd=this.xqd-this.xdb;
if(xxd < 1) xxd=179;
}
var xyf=179;
if( (this.xeg < 90) || (this.xgi > -90) )
{
xyf=this.xeg-this.xgi;
if(xyf < 1) xyf=179;
if(xyf > 179) xyf=179;
}
var xge=this.xde();
var xwh=1.0;
var xfg=Math.sqrt(1.0/(xge*xge+1.0));
var xwb=xge*xfg;
var xee=this.xM(xyf,xwb,xwh);
var xkc=this.xM(xxd,xfg,xwh);
var xZh=this.xAg;
if(xZh > xee) xZh=xee;
if(xZh > xkc) xZh=xkc;
if(xZh < this.xxe) xZh=this.xxe;
return xZh;
}
p1.xJe=function(xsc)
{
var xge=this.xde();
var xwh=1.0;
var xfg=Math.sqrt(1.0/(xge*xge+1.0));
var xwb=xge*xfg;
var xme=this.xM(xsc,1.0,xfg);
var x9d=this.xM(xsc,1.0,xwb);
var xxg=this.xqd;
if(this.xqd < 90)
{
xxg=this.xqd-0.5*xme;
}
var x4d=this.xdb;
if(this.xdb > -90)
{
x4d=this.xdb+0.5*xme;
}
if(x4d > xxg)
{
x4d=0.5*(x4d+xxg);
xxg=x4d;
}
return new Array(x4d, xxg);
}
p1.xO=function(xsc, x4g)
{
var xge=this.xde();
var xwh=1.0;
var xfg=Math.sqrt(1.0/(xge*xge+1.0));
var xwb=xge*xfg;
var xme=this.xM(xsc,1.0,xfg);
var x9d=this.xM(xsc,1.0,xwb);
var xVd=x4g+0.5*xme;
var xPd=x4g-0.5*xme;
var xmd;
if( (xVd >= 90) || (xPd <= -90) )
{
xmd=90;
}
else
{
if(xVd > (-xPd))
{
xmd=xVd;
}
else
{
xmd=-xPd;
}
}
var xOh=Math.cos(xmd*Math.PI/180.0);
if(xOh < 1e-4) xOh=1e-4;
var xhf=x9d/xOh;
var xvf=this.xgi;
var xeb=this.xeg;
if( (this.xgi > -180.0) || (this.xeg < 180.0) )
{
xvf=this.xgi+0.5*xhf;
xeb=this.xeg-0.5*xhf;
}
if(xvf > xeb)
{
xvf=0.5*(xvf+xeb);
xeb=xvf;
}
return new Array(xvf, xeb);
}
p1.xde=function()
{
var xge=1;
if( (this.width > 0) && (this.height > 0) )
{
xge=this.width/this.height;
}
return xge;
}
p1.xM=function(xQg, x0h, x7b)
{
return 2.0*180.0/Math.PI*Math.atan(x7b/x0h*Math.tan(0.5*xQg*Math.PI/180.0));
}
p1.xMc=function()
{
return new Date().getTime();
}
p1.xzd=function()
{
var xo=0;
if(this.x6g)
{
xo=this.x6g.offsetWidth;
}
return xo;
}
p1.xPh=function()
{
var xo=0;
if(this.x6g)
{
xo=this.x6g.offsetHeight;
}
return xo;
}
p1.xId=function()
{
var x6h=this.xZd();
this.xef(!x6h);
}
nhPanoramaViewer.showNavigator=function()
{
var properties=new Array("appCodeName","appName","appVersion","buildID","oscpu","platform","product","productSub",
"userAgent","vendor","vendorSub");
var xtf;
for(var xBg in properties)
{
var property=properties[xBg];
xtf += property+": "+window.navigator[property]+"\n";
}
alert(xtf);
}
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.isFirefox=function()
{
return !!(window.navigator.userAgent.match(/ firefox\/.*/i));
}
nhPanoramaViewer.getChromeVersion=function()
{
var x5=window.navigator.userAgent.match(/ Chrome\/([0-9]+)\.([0-9]+)\./);
var version=[0,0];
if(x5 !== null)
{
version=x5.slice(1,3).map(function(xBl){
return xBl-0;
});
}
return version;
}
nhPanoramaViewer.isAndroid=function()
{
var xo=false;
if(window.navigator.userAgent.match(/ android /i)) xo=true;
if(window.navigator.userAgent.match(/\(android;/i)) xo=true;
return xo;
}
nhPanoramaViewer.isMac=function()
{
return !!(window.navigator.platform.match(/^mac/i));
}
p1.xQf=function(event)
{
this.xcg = true;
var touch=event.touches[0];
event.preventDefault();
if(event.touches.length == 1)
{
this.xT(event.touches[0].clientX, event.touches[0].clientY);
}
else
{
if(this.xyc != this.xRf)
{
this.xse();
}
if(event.touches.length == 2)
{
var xze=this.xJg(event);
this.xQh=xze[0];
this.xdi=xze[1];
this.xBb=xze[2];
this.xTe=window.pageXOffset;
this.xQe=window.pageYOffset;
this.xyc=this.xfc;
this.xGe=this.xud;
}
else
{
this.xyc=this.xRf;
}
}
}
p1.xBf=function(event)
{
event.preventDefault();
if( (this.xyc == this.x2b) || (this.xyc == this.xnh))
{
this.xMe(event.touches[0].clientX, event.touches[0].clientY);
}
else if(this.xyc == this.xfc)
{
var x7e=this.xxe;
var xTb=this.xF();
var xze=this.xJg(event);
var xwf=xze[0];
var x8b=xze[1];
var xvd=xze[2];
var xDh;
if(xwf < 1)
{
xDh=100000;
}
else
{
xDh=this.xQh / xwf;
}
var x4=Math.tan(0.5*this.xGe*Math.PI/180.0);
x4 *= xDh;
var xmh=2.0*Math.atan(x4)*180.0/Math.PI;
if(xmh < x7e) xmh=x7e;
if(xmh > xTb) xmh=xTb;
if(this.xud != xmh)
{
this.xud=xmh;
this.xoi=0;
this.xUh();
}
if(!this.xZd())
{
var xpc=this.xdi+this.xTe-x8b;
var xV=this.xBb+this.xQe-xvd;
window.scroll(xpc, xV);
}
}
}
p1.xJc=function(event)
{
event.preventDefault();
if( (this.xyc == this.x2b) || (this.xyc == this.xnh))
{
this.xse();
}
else if(this.xyc == this.xfc)
{
this.xyc=this.xRf;
}
}
p1.xJg=function(event)
{
var xDg=event.touches[0].clientX;
var xOd=event.touches[0].clientY;
var xRg=event.touches[1].clientX;
var xyd=event.touches[1].clientY;
var xhe=xRg-xDg;
var xed=xyd-xOd;
var x9=Math.sqrt(xhe*xhe+xed*xed);
var xtb=(xDg+xRg)/2;
var xGg=(xOd+xyd)/2;
return new Array(x9, xtb, xGg);
}
p1.xth=function()
{
var xte=document.getElementsByTagName("meta");
for(var i=0; i < xte.length; i++)
{
var xDb=xte[i];
if(xDb.name ==="viewport") return xDb;
}
return null;
}
p1.xsd=function()
{
var xo="";
var xDb=this.xth();
if(xDb)
{
xo=xDb.getAttribute("content");
}
return xo;
}
p1.xxh=function(content)
{
var xDb=this.xth();
if(!xDb)
{
xDb=document.createElement("meta");
xDb.setAttribute("name","viewport");
document.head.appendChild(xDb);
}
xDb.setAttribute("content",content);
}
p1.x2h=function()
{
var isfullscreen=(document.fullscreenElement || document.mozFullScreenElement || document.webkitFullscreenElement);
this.xif=isfullscreen;
if(isfullscreen) this.m_TrueFullScreen=true;
this.xAd();
}
p1.xCg=function(x6h)
{
if(this.xif != x6h)
{
var done=false;
if(x6h)
{
if(document.fullscreenEnabled || document.mozFullScreenEnabled || document.webkitFullscreenEnabled)
{
var xqb = this.xzh;
if (xqb.requestFullscreen) {
xqb.requestFullscreen();
done=true;
}else if (xqb.mozRequestFullScreen) {
xqb.mozRequestFullScreen();
done=true;
}else if (xqb.webkitRequestFullscreen) {
xqb.webkitRequestFullscreen();
done=true;
}
}
}
else
{
if(this.m_TrueFullScreen)
{
if (document.cancelFullScreen) {
document.cancelFullScreen();
}else if (document.mozCancelFullScreen) {
document.mozCancelFullScreen();
}else if (document.webkitCancelFullScreen) {
document.webkitCancelFullScreen();
}
done=true;
}
}
if(done)
{
this.xUh();
}
else
{
this.m_TrueFullScreen=false;
var x1e=this;
if(nhPanoramaViewer.isIOS())
{
x1e.xg=true;
x1e.x3c(x1e.xu, x1e.x6g);
x1e.xu.style.visibility="visible";
setTimeout(function(){
x1e.xg=false;
x1e.xFb(x6h);
x1e.xu.style.visibility="hidden";
},100);
}
else
{
x1e.xFb(x6h);
}
}
}
}
p1.xFb=function(x6h)
{
if(this.xif != x6h)
{
if(x6h)
{
this.xLh=document.body;
this.xG=document.documentElement.style.cssText;
var x1e=this;
var xFe=document.createElement("body");
xFe.appendChild(x1e.xzh);
xFe.style.margin="0px";
xFe.style.padding="0px";
xFe.style.width="100%";
xFe.style.height="100%";
document.body=xFe;
document.documentElement.style.cssText="width:100%;height:100%";
window.scroll(100000,0);
x1e.xzh.style.visibility="hidden";
setTimeout(function(){
x1e.xzh.style.visibility="visible";
},1);
x1e.xnf();
}
else
{
document.body=this.xLh;
document.documentElement.style.cssText=this.xG;
this.xmf.appendChild(this.xzh);
this.xnf();
}
this.xif=x6h;
this.xAd();
}
}
p1.xv=function(xEf)
{
var xo="";
for(var i=0; i < xEf.length; i++)
{
var xXj=xEf.charCodeAt(i);
if( (xXj >= 48) && (xXj < 128) )
{
xXj=((xXj-48))^0x46+48;
}
xo += String.fromCharCode(xXj);
}
return xo;
}
nhPanoramaViewer.isSupported=function()
{
if(!document.addEventListener) return false;
if(nhPanoramaViewer.has3dCss()) return true;
if(nhPanoramaViewer.hasWebGL()) return true;
return false;
}
nhPanoramaViewer.has3dCss=function()
{
var xNd=document.createElement("div");
if(!xNd) return false;
if(typeof xNd.style.webkitPerspective =="string") {}
else if(typeof xNd.style.MozPerspective =="string") {}
else return false;
if(nhPanoramaViewer.isChrome())
{
var chromeversion=nhPanoramaViewer.getChromeVersion();
if(chromeversion[0]-0 < 22) return false;
}
if(window.navigator.userAgent.match(/ firefox\/.*/i))
{
if(window.navigator.userAgent.match(/[^xik-zA-Z]linux[^xik-zA-Z]/i))
{
return false;
}
}
return true;
}
nhPanoramaViewer.hasWebGL=function()
{
var xob=null;
var xub=document.createElement("canvas");
try
{
xob = xub.getContext("webgl");
}
catch(xYf) {}
if(!xob)
{
try
{
xob = xub.getContext("experimental-webgl");
}
catch(xYf) {}
}
return (xob != null);
}
p1.xNe=function(xXd)
{
var xob;
try
{
xob = xXd.getContext("webgl");
}
catch(xYf) {}
if(!xob)
{
try
{
xob = xXd.getContext("experimental-webgl");
}
catch(xYf) {}
}
if(!xob)
{
throw new Error("Could not initialize WebGL");
}
this.xtc=xob;
xob.clearColor(0.0, 0.0, 0.0, 1.0);
this.xc("s1-1a");
xob.enable(xob.DEPTH_TEST);
this.xc("s1-1b");
xob.depthFunc(xob.LEQUAL);
this.xc("s1-1c");
xob.clearDepth(1.0)
this.xc("s1-1d");
var xaf="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 xPe="uniform sampler2D sampler2d; varying mediump vec2 v_texCoord;void main(void){gl_FragColor = texture2D(sampler2d, v_texCoord);}";
this.xjh=this.xHd(xaf,xPe);
this.xK=new xjk();
this.xkb=new xjk();
this.xZe=xob.getUniformLocation(this.xjh,"modelViewMatrix");
this.xc("s1-2");
this.x7g=xob.getUniformLocation(this.xjh,"perspectiveMatrix");
this.xc("s1-3");
this.xjd = xob.getAttribLocation(this.xjh,"vertexPosition");
this.xc("s1-4");
xob.enableVertexAttribArray(this.xjd);
this.xc("s1-5");
this.xvg = xob.getAttribLocation(this.xjh,"vTexCoord");
this.xc("s1-6");
xob.enableVertexAttribArray(this.xvg);
this.xc("s1-7");
var loc=xob.getUniformLocation(this.xjh,"sampler2d");
this.xc("s1-10");
xob.uniform1i(loc, 0);
this.xc("s1-11");
}
p1.xc=function(xSh)
{
var xrf=this.xtc.getError();
if(xrf != this.xtc.NO_ERROR)
{
throw new Error("webGL error: "+xSh+": "+xrf);
}
}
p1.x8=function(xGh, x6b)
{
var xob=this.xtc;
var xuh=xob.createShader(xGh);
this.xc("s2-1");
xob.shaderSource(xuh, x6b);
this.xc("s2-2");
xob.compileShader(xuh);
this.xc("s2-3");
if(!xob.getShaderParameter(xuh, xob.COMPILE_STATUS))
{
var xjg=xob.getShaderInfoLog(xuh);
xob.deleteShader(xuh);
throw new Error("Couldn't compile shader:\n"+xjg);
}
return xuh;
}
p1.xHd=function(xrb, xPe)
{
var xob=this.xtc;
var xPf=null;
var x8g=null;
var xpe=null;
try
{
x8g=this.x8(xob.VERTEX_SHADER, xrb);
xpe=this.x8(xob.FRAGMENT_SHADER, xPe);
var xPf = xob.createProgram();
this.xc("s3-1");
xob.attachShader(xPf, x8g);
this.xc("s3-2");
xob.attachShader(xPf, xpe);
this.xc("s3-3");
xob.linkProgram(xPf);
this.xc("s3-4");
if(!xob.getProgramParameter(xPf, xob.LINK_STATUS))
{
var xjg=xob.getProgramInfoLog(xPf);
throw new Error("Couldn't link program:\n"+xjg);
}
xob.useProgram(xPf);
this.xc("s3-5");
}
catch(xYf)
{
try
{
if(x8g) xob.deleteShader(x8g);
if(xpe) xob.deleteShader(xpe);
if(xPf) xob.deleteProgram(xPf);
}catch(x5k) {}
throw xYf;
}
return xPf;
}
p1.x2g=function()
{
if(this.xWd)
{
this.xWd=false;
var xob=this.xtc;
xob.clear(xob.COLOR_BUFFER_BIT | xob.DEPTH_BUFFER_BIT);
var xRg=this.xs();
if(this.xai)
{
for(var i=0; i < xRg; i++)
{
var xE=this.xai[i];
if(xE)
{
var xYd=xE.xCj();
if(xYd)
{
xob.bindTexture(xob.TEXTURE_2D, xYd[0]);
xob.bindBuffer(xob.ARRAY_BUFFER, xYd[1]);
xob.vertexAttribPointer(this.xjd, 3.0, xob.FLOAT, false, 0, 0);
xob.bindBuffer(xob.ARRAY_BUFFER, xYd[2]);
xob.vertexAttribPointer(this.xvg, 2.0, xob.FLOAT, false, 0, 0);
xob.drawArrays(xob.TRIANGLE_STRIP, 0, 4);
}
}
}
}
xob.flush();
this.xc("s5-6");
xob.finish();
this.xc("s5-7");
}
}
p1.xGd=function(xn)
{
var xob=this.xtc;
var xAf = xob.createBuffer();
this.xc("s5-1");
xob.bindBuffer(xob.ARRAY_BUFFER, xAf);
this.xc("s5-2");
xob.bufferData(xob.ARRAY_BUFFER, new Float32Array(xn), xob.STATIC_DRAW);
this.xc("s5-3");
return xAf;
}
p1.xX=function(x4f)
{
var xob=this.xtc;
var xUd=xob.createTexture();
this.xc("s7-1");
xob.bindTexture(xob.TEXTURE_2D, xUd);
this.xc("s7-2");
xob.pixelStorei(xob.UNPACK_FLIP_Y_WEBGL, true);
xob.texParameteri(xob.TEXTURE_2D, xob.TEXTURE_MIN_FILTER, xob.LINEAR);
xob.texParameteri(xob.TEXTURE_2D, xob.TEXTURE_MAG_FILTER, xob.LINEAR);
xob.texParameteri(xob.TEXTURE_2D, xob.TEXTURE_WRAP_S, xob.CLAMP_TO_EDGE);
xob.texParameteri(xob.TEXTURE_2D, xob.TEXTURE_WRAP_T, xob.CLAMP_TO_EDGE);
this.xc("s7-3");
try
{
xob.texImage2D(xob.TEXTURE_2D, 0, xob.RGBA, xob.RGBA, xob.UNSIGNED_BYTE, x4f);
}
catch(xYf)
{
if( (xYf.name =="SecurityError")
&& (nhPanoramaViewer.isChrome())
&& window.location.href.match(/^file\:\/\/.*/)
&& x4f.src.match(/^file\:\/\/.*/) )
{
throw new Error("Failed to load panorama. Due to security restrictions in Chrome the panorama viewer cannot access images stored locally on your computer."
+" To resolve the problem, upload the panorama to a web server and access it over the web. Or launch Chrome with the --allow-file-access-from-files flag"
+" (google for more information) to disable this security restriction.\n\n"
+"Note that this error will not appear when the panorama is viewed on the web."
+"\n\nDetails: "+xYf.message
);
}
else
{
throw xYf;
}
}
this.xc("s7-4");
return xUd;
}
nhPanoramaViewer.requestAnimationFrameFunc=null;
nhPanoramaViewer.requestAnimationFrame=function(callback, element)
{
if(!nhPanoramaViewer.requestAnimationFrameFunc)
{
var xCe = [
"mozRequestAnimationFrame",
"oRequestAnimationFrame",
"requestAnimationFrame",
"webkitRequestAnimationFrame",
"msRequestAnimationFrame"
];
for (var i = 0; i < xCe.length; ++i)
{
if(window[xCe[i]])
{
var thefunc=window[xCe[i]];
nhPanoramaViewer.requestAnimationFrameFunc=function(callback,element) {
thefunc.call(window, callback, element);
};
break;
}
}
if(!nhPanoramaViewer.requestAnimationFrameFunc)
{
nhPanoramaViewer.requestAnimationFrameFunc=function(callback,element) {
window.setTimeout(callback,16.67);
};
}
}
nhPanoramaViewer.requestAnimationFrameFunc(callback,element);
}
p1.xXc=function(xYf)
{
var x5e=this.xMc() / 1000.0;
var deltanow=0.01;
if(this.m_PrevDeviceMotionTime)
{
deltanow=x5e-this.m_PrevDeviceMotionTime;
}
this.m_PrevDeviceMotionTime=x5e;
if(xYf.rotationRate && xYf.accelerationIncludingGravity)
{
var x2f=xYf.rotationRate;
var xXf=xYf.accelerationIncludingGravity;
var interval=deltanow;
if( (!isNaN(xXf.x)) && (!isNaN(xXf.y)) && (!isNaN(xXf.z))
&& (!isNaN(x2f.alpha)) && (!isNaN(x2f.beta)) && (!isNaN(x2f.gamma))
&& (!isNaN(interval)) )
{
if(this.xhh == 0)
{
this.xhh=x5e+1.0;
}
if(x5e >= this.xhh)
{
var xcc=[xXf.x, xXf.y, xXf.z];
if(this.m_gravityReversed)
{
xcc[0]=-xcc[0];
xcc[1]=-xcc[1];
xcc[2]=-xcc[2];
}
if(this.xeh != null)
{
var x0d=this.xVh;
x0d=Math.pow(x0d,interval);
var x7=1.0-x0d;
xcc[0]=x7*xcc[0]+x0d*this.xeh[0];
xcc[1]=x7*xcc[1]+x0d*this.xeh[1];
xcc[2]=x7*xcc[2]+x0d*this.xeh[2];
}
this.xeh=xcc;
var xL=Math.sqrt(xcc[0]*xcc[0]+xcc[1]*xcc[1]+xcc[2]*xcc[2]);
if(xL > 0)
{
var x6c=1.0/xL;
xcc[0] *= x6c;
xcc[1] *= x6c;
xcc[2] *= x6c;
}
this.xuf=xcc;
var x8d=Math.asin(xcc[2]);
var xSe=0;
if( (xcc[0] != 0) || (xcc[1] != 0) )
{
xSe=Math.atan2(xcc[0],-xcc[1]);
}
xSe *= 180.0/Math.PI;
x8d *= 180.0/Math.PI;
if(this.xyc == this.xRf)
{
if(this.xxf == this.xib)
{
var xC=xcc[0]-this.xHc[0];
var xnc=xcc[1]-this.xHc[1];
var xVe=xcc[2]-this.xHc[2];
var xCf=xC*xC+xnc*xnc+xVe*xVe;
if(xCf > 0.1)
{
this.x4b(x8d);
}
}
else if(this.xxf == this.xNb)
{
if(x8d > -60)
{
this.x4b(x8d);
}
}
}
if(this.xxf == this.xLb)
{
if( (Math.abs(x2f.alpha) > 20)
|| (Math.abs(x2f.beta) > 20)
|| (Math.abs(x2f.gamma) > 20) )
{
this.xic();
}
}
var xei=x2f.alpha;
var xfe=x2f.beta;
var xk=x2f.gamma;
xei *= interval;
xfe *= interval;
xk *= interval;
if(this.m_rotationRateRadians)
{
xei *= 180.0/Math.PI;
xfe *= 180.0/Math.PI;
xk *= 180.0/Math.PI;
}
var x6f=new xjk();
var xuc=new xjk();
xuc.xpk(2,xk);
x6f.x6j(xuc);
xuc.xpk(1,xfe);
x6f.x6j(xuc);
xuc.xpk(0,xei);
x6f.x6j(xuc);
var xLc=new xjk();
xuc.xpk(2,-xSe);
xLc.x6j(xuc);
xuc.xpk(0,x8d);
xLc.x6j(xuc);
var xdd=new xjk(xLc);
xdd.xmk();
var xFg=new xjk();
xFg.x6j(xdd);
xFg.x6j(x6f);
xFg.x6j(xLc);
var xih=xFg.x8j([1,0,0]);
var xVf=Math.atan2(xih[2],xih[0]);
xVf *= 180.0/Math.PI;
var xRh=this.xU;
if(this.xWb == 0)
{
xRh += xVf;
}
var xgc;
if( (this.xyc == this.xRf)
&& (this.xxf == this.xLb)
)
{
var xY=interval*180;
if(this.x8e > 0)
{
this.x8e -= xY;
if(this.x8e < 0) this.x8e=0;
}
else if(this.x8e < 0)
{
this.x8e += xY;
if(this.x8e > 0) this.x8e=0;
}
xgc=x8d+this.x8e;
if(xgc < -90) xgc=-90;
if(xgc > 90) xgc=90;
}
else
{
xgc=this.x6d;
}
if( (!isNaN(xRh)) && (!isNaN(xgc)))
{
this.x3(xRh,xgc,this.xud);
}
}
}
}
}
p1.xje=function(xYf)
{
this.log("Error: WebGL context lost");
}
p1.xx=function(xYf)
{
this.log("WebGL context restored");
}
p1.xXb=function()
{
return (this.xxf == this.xLb);
}
p1.xwd=function()
{
if(this.xxf != this.xNb)
{
this.xHc=this.xuf;
this.xxf=this.xib;
}
}
p1.x4b=function(xGb)
{
if(xGb < -60)
{
this.xxf=this.xNb;
}
else
{
this.xxf=this.xLb;
this.x8e=this.x6d-xGb;
this.xic();
}
}
p1.xzb=function()
{
var x1g="The publisher of this panorama should check the contents of the 'licensekey' field in the parameters for this panorama.";
if(this.x4c < 0)
{
this.x4c=0;
if(this.xCc !="")
{
var xhc=this.xHh(this.xCc);
if(xhc.valid)
{
var xke=this.xbg();
if(xke =="")
{
this.log("License key ('licensekey' field) ignored since the panorama is viewed on the local computer.");
}
else
{
var xr=false;
if(xke == xhc.host)
{
xr=true;
}
else
{
var xwe="."+xhc.host;
var xlh=xke.lastIndexOf(xwe);
if( (xlh >= 0) && (xlh == (xke.length-xwe.length)) )
{
xr=true;
}
}
if(xr)
{
this.x4c=1;
}
else
{
this.log("Invalid license: the license is valid for '"+xhc.host+"' but the panorama is stored on '"+xke+"'. "+x1g);
}
}
}
else
{
this.log("Invalid license key. "+x1g);
}
}
}
return (this.x4c > 0);
}
p1.xbe=function(xCd)
{
var valid=false;
var xlh=xCd.lastIndexOf(":");
if(xlh >= 0)
{
var xtf=xCd.substr(0,xlh);
var xSf=xCd.substr(xlh+1,xCd.length-xlh-1);
var xHe=new x7k(this.xvc);
var xMf=new x7k(this.xZ);
var x2d=new xcp();
x2d.xBn(xHe, xMf);
valid=x2d.xvp(xtf, xSf);
}
return valid;
}
p1.xHh=function(xCd)
{
var xo=new Object();
try
{
xo.valid=this.xbe(xCd);
}
catch(xYf)
{
xo.valid=false;
}
if(xo.valid)
{
var components=xCd.split(":");
if(components.length < 3)
{
xo.valid=false;
}
else
{
xo.host=components[0];
xo.version=components[1];
}
}
return xo;
}
p1.xx8944hjkxx7jk=function(xkf, xof)
{
xkf=xkf.toLowerCase();
var xtf=xkf.toLowerCase()+":1";
var xMf=new x7k(this.xZ);
var xQb=new x7k(xof);
var xHe=new x7k(this.xvc);
var x2d=new xcp();
x2d.xNn(xQb, xMf);
x2d.xBn(xHe, xMf);
var xSf=x2d.xwp(xtf,true);
var xIc=xtf+":"+xSf;
var xWe=this.xHh(xIc);
if(!xWe.valid)
{
xWe=this.xHh(xIc);
throw new Error("Check failed");
}
return xIc;
}
p1.xbg=function()
{
var xtg=this.xRe(0);
var xAh=this.xKd();
xtg=this.xbd(xtg,xAh);
var host="";
if(xtg.indexOf("://") >= 0)
{
host=xtg.replace(new RegExp("^.*:\\/\\/"),"");
host=host.replace(new RegExp("\\/.*$"),"");
host=host.replace(new RegExp(":.*$"),"");
}
host=host.toLowerCase();
return host;
}
var p2=xzi.prototype;
p2.lsNotLoaded=0;
p2.xGj=1;
p2.xzj=2;
p2.xIi=3;
p2.xgd=false;
p2.xjj=0;
function xzi(xri, xgj, xph, x8d, xzc, xYb, xyg)
{
this.xoj=this.lsNotLoaded;
this.x7i=xri;
this.xLi=xgj;
this.xti=xph;
this.xej=x8d;
this.xUi=xzc;
this.xdj=xYb;
this.xSj=xyg;
if(this.x7i.xEb)
{
var xP=document.createElement("div");
xP.style.position="absolute";
xP.style.msBackfaceVisibility=xP.style.webkitBackfaceVisibility=xP.style.MozBackfaceVisibility="hidden";
xP.style.MozTransformStyle="preserve-3d";
xP.style.top="0px";
xP.style.left="0px";
var xvj=xri.xl();
xvj.appendChild(xP);
this.x6g=xP;
}
if(this.x7i.xle)
{
this.xHi();
}
var xLd=document.createElement("img");
xLd.style.position="absolute";
xLd.style.top="0px";
xLd.style.left="0px";
xLd.style.visibility="hidden";
this.xDi=xLd;
var x1e=this;
if(document.addEventListener)
{
xLd.addEventListener("load", function(xYf){return x1e.xtj(xYf? xYf : window.event)}, false);
xLd.addEventListener("error", function(xYf){return x1e.xPj(xYf? xYf : window.event)}, false);
}
else if(document.attachEvent)
{
xLd.attachEvent("onload", function(xYf){return x1e.xtj(xYf? xYf : window.event)});
xLd.attachEvent("onerror", function(xYf){return x1e.xPj(xYf? xYf : window.event)});
}
if(this.x7i.xEb)
{
this.x6g.appendChild(this.xDi);
var xwi=document.createElement("canvas");
xwi.style.position="absolute";
xwi.style.top="0px";
xwi.style.left="0px";
xwi.style.visibility="hidden";
xP.appendChild(xwi);
this.xhj=xwi;
}
this.xij();
}
p2.xHi=function()
{
var x9=10;
var width=x9*Math.tan(0.5*this.xUi*Math.PI/180);
var xOi=new xjk();
xOi.xpk(0,this.xej);
var xS=new xjk();
xS.xpk(1,-this.xti);
xOi.x6j(xS);
var xmj=[];
for(var xxj=0; xxj < 4; xxj++)
{
var xKi=[];
xKi[0]=(xxj & 1)? -width : width;
xKi[1]=(xxj & 2)? -width : width;
xKi[2]=-x9;
xKi=xOi.x8j(xKi);
xmj=xmj.concat(xKi);
}
this.xFj=this.x7i.xGd(xmj);
}
p2.x2i=function()
{
this.xqi();
}
p2.xqi=function()
{
this.xoj=this.xGj;
if(this.xjj > 0)
{
var x1e=this;
window.setTimeout(function(){x1e.xDi.src=x1e.xLi}, this.xjj*1000);
}
else
{
this.xDi.src=this.xLi;
}
}
p2.xPj=function(event)
{
this.x7i.x5g("Failed to load image: "+this.xLi);
this.xoj=this.xIi;
this.x7i.xOb(this);
return true;
}
p2.xtj=function(event)
{
this.xoj=this.xzj;
if(this.xDi.width != this.xDi.height)
{
this.x7i.x5g("Image "+this.xLi+" should be square");
}
var xAj=this.xDi.width;
if(this.xSj && (this.xDi.width > this.xSj))
{
this.xDi.width=this.xSj;
this.xDi.height=this.xSj;
var x1e=this;
}
this.xlj=new Array(this.xDi.width, this.xDi.height);
if(this.x7i.xEb)
{
this.xnf();
this.xhj.style.visibility="hidden";
this.xDi.style.visibility="visible";
this.x6g.style.width=this.xlj[0]+"px";
this.x6g.style.height=this.xlj[1]+"px";
}
else
{
this.xAi=this.x7i.xX(this.xDi);
this.x6i(0.0, 0.0, 1.0, 1.0);
}
if(nhPanoramaViewer.isIOS())
{
var x1e=this;
setTimeout(function(){
x1e.x7i.xOb(this);
},100);
}
else
{
this.x7i.xOb(this);
}
return true;
}
p2.xij=function()
{
}
p2.xQj=function(event)
{
try
{
xsi(this.xyj,false);
this.xyj=null;
this.x7i.xOb(this);
}
catch (xhg)
{
this.x7i.x5g(xhg.toString());
}
}
p2.xnf=function()
{
if((this.xoj == this.xzj) || this.xgd)
{
this.xpj();
}
}
p2.xpj=function()
{
if(this.x7i.xEb)
{
var x8i=this.x7i.x0f();
var xbj=this.x7i.xMd();
var x5i=this.x7i.xzd();
var xUj=this.x7i.xPh();
var x4i=this.xlj[0];
var xNj=this.xlj[1];
var xvi=1000.0*(this.xdj+1);
var ownerstyle=this.x7i.xl().style;
var xQi=1;
if(typeof ownerstyle.webkitPerspective =="string")
{
xQi=ownerstyle.webkitPerspective;
}
else if(typeof ownerstyle.MozPerspective =="string")
{
xQi=ownerstyle.MozPerspective;
}
else
{
xQi=ownerstyle.msPerspective;
}
xQi=xQi.replace(/\s*px\s*$/,"");
xQi=xQi-0;
var xHj=0.5*xvi/Math.tan(0.5*this.xUi*Math.PI/180);
var xqj="translate3d("+(-(x4i-x5i)/2).toFixed(4)+"px,"+(-(xNj-xUj)/2).toFixed(4)+"px,"+xQi.toFixed(4)+"px)"
+" rotateX("+xbj.toFixed(4)+"deg)"
+" rotateY("+(x8i-this.xti).toFixed(4)+"deg)"
+" rotateX("+(-this.xej).toFixed(4)+"deg)"
+" translate3d(0px,0px,"+(-xHj).toFixed(4)+"px)"
+" scale3d("+(xvi/x4i).toFixed(4)+","+(xvi/xNj).toFixed(4)+",1)";
this.x6g.style.msTransform=this.x6g.style.webkitTransform=this.x6g.style.MozTransform=xqj;
}
}
p2.xJj=function()
{
return this.xoj;
}
p2.xTi=function()
{
return this.xgd;
}
p2.xOj=function()
{
return this.xti;
}
p2.xFi=function()
{
return this.xej;
}
p2.xBi=function(xwi, xf)
{
this.xgd=true;
if(this.xoj != this.xGj) this.xoj=this.lsNotLoaded;
var xTh=xf[2];
var xGi=xf[3];
var previewimage=this.xhj;
previewimage.width=xTh;
previewimage.height=xGi;
var xEi = previewimage.getContext('2d');
xEi.drawImage(xwi, xf[0], xf[1], xTh, xGi, 0, 0, xTh, xGi);
previewimage.style.visibility="visible";
this.x6g.style.width=previewimage.width+"px";
this.x6g.style.height=previewimage.height+"px";
this.xlj=new Array(previewimage.width,previewimage.height);
this.xnf();
}
p2.xZi=function(xrj, x4i, xf)
{
this.xAi=xrj;
var xIj=xf[0]/x4i;
var xkj=(xf[0]+xf[2])/x4i;
var x9i=1.0-(xf[1]+xf[3])/x4i;
var xMi=1.0-xf[1]/x4i;
this.x6i(xIj, x9i, xkj, xMi);
this.xgd=true;
if(this.xoj != this.xGj) this.xoj=this.lsNotLoaded;
}
p2.x6i=function(xIj, x9i, xkj, xMi)
{
this.xKj=this.x7i.xGd([xkj, xMi, xIj, xMi, xkj, x9i, xIj, x9i]);
}
p2.xCj=function()
{
if(this.xAi)
{
return [this.xAi, this.xFj, this.xKj];
}
else
{
return null;
}
}
var p3=xjk.prototype;
p3.xhk=[1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1];
function xjk(src)
{
if(src)
{
this.xhk=src.xhk.slice(0);
}
}
p3.x6j=function(x9j)
{
var xlk=[];
var x1j=0;
var xfk=0;
var xik;
var xdk;
var xak;
while(true)
{
xik=0;
xdk=x1j;
xak=xfk;
while(true)
{
xik += this.xhk[xdk++]*x9j.xhk[xak];
xak += 4;
if(xak >= 16) break;
}
xlk.push(xik);
xfk++;
if(xfk == 4)
{
x1j += 4;
if(x1j == 16) break;
xfk=0;
}
}
this.xhk=xlk;
return this;
}
p3.xkk=function(xsc, xge, x5j, xYj)
{
var xI=0.5 * xsc * Math.PI / 180.0;
var x9i=x5j * Math.tan(xI) / Math.sqrt(1+xge*xge);
var xkj=x9i*xge;
var x2j=1.0/(xYj-x5j);
this.xhk = [
x5j/xkj, 0, 0, 0,
0, x5j/x9i, 0, 0,
0, 0, -(x5j+xYj)*x2j, -1,
0, 0, -2*xYj*x5j*x2j, 0
];
return this;
}
p3.xpk=function(xWj,xZj)
{
var x3j=Math.PI * xZj / 180.0;
var xXj=Math.cos(x3j);
var s=Math.sin(x3j);
if(xWj == 0)
{
this.xhk = [
1, 0, 0, 0,
0, xXj, s, 0,
0, -s, xXj, 0,
0, 0, 0, 1
];
}
else if(xWj == 1)
{
this.xhk = [
xXj, 0, -s, 0,
0, 1, 0, 0,
s, 0, xXj, 0,
0, 0, 0, 1
];
}
else
{
this.xhk = [
xXj, s, 0, 0,
-s, xXj, 0, 0,
0, 0, 1, 0,
0, 0, 0, 1
];
}
return this;
}
p3.xek=function()
{
return new Float32Array(this.xhk);
}
p3.x8j=function(x0j)
{
var xlk=this.xhk;
var x=xlk[0]*x0j[0]+xlk[4]*x0j[1]+xlk[8]*x0j[2]+xlk[12];
var y=xlk[1]*x0j[0]+xlk[5]*x0j[1]+xlk[9]*x0j[2]+xlk[13];
var z=xlk[2]*x0j[0]+xlk[6]*x0j[1]+xlk[10]*x0j[2]+xlk[14];
var xLf=xlk[3]*x0j[0]+xlk[7]*x0j[1]+xlk[11]*x0j[2]+xlk[15];
if(xLf != 1.0)
{
var xnk=1.0/xLf;
x *= xnk;
y *= xnk;
z *= xnk;
}
return [x,y,z];
}
p3.xmk=function()
{
var xlk=this.xhk;
this.xhk=[
xlk[0], xlk[4], xlk[8], xlk[12],
xlk[1], xlk[5], xlk[9], xlk[13],
xlk[2], xlk[6], xlk[10], xlk[14],
xlk[3], xlk[7], xlk[11], xlk[15]
];
return this;
}
var p4=x7k.prototype;
p4.xAl="";
p4.x5m=false;
p4.xcm=14;
function x7k(value)
{
this.xxl=Math.floor(Math.pow(10,this.xcm-1)+0.1);
var x9k=typeof value;
if( (x9k =="undefined") || (value === null) )
{
}
else if(x9k =="number")
{
this.xyl(value);
}
else if(x9k =="string")
{
this.xPk(value);
}
else if(x9k =="object")
{
if(value instanceof x7k)
{
this.xom(value);
}
else
{
var xam="(unknown)";
if(value && value.constructor && value.constructor.toString)
{
xam=value.constructor.toString();
}
throw new Error("Invalid type: "+xam);
}
}
else
{
throw new Error("Invalid type: "+x9k);
}
}
p4.xom=function(xBl)
{
this.xAl=xBl.xAl;
this.x5m=xBl.x5m;
}
p4.toString=function()
{
if(this.x5m)
{
return"-"+this.xAl;
}
else
{
return this.xAl;
}
}
p4.xNm=function()
{
return (this.xAl =="");
}
p4.xMm=function(value, xOl)
{
this.xAl=this.xvk(value);
if(this.xNm()) xOl=false;
this.x5m=xOl;
}
p4.xPk=function(value)
{
var xOl=false;
if(value.charAt(0) =="-")
{
xOl=true;
value=value.substr(1);
}
if(! value.match(/^[0-9]*$/))
{
throw new Error("Invalid value");
}
value=this.xvk(value);
if(value =="")
{
xOl=false;
}
this.xAl=value;
this.x5m=xOl;
}
p4.xPm=function(xwl, x3l, length)
{
var xOm=xwl.length-x3l;
if(xOm <= 0)
{
return 0;
}
else
{
var xol=xOm-length;
if(xol < 0) xol=0;
var substr=xwl.substring(xol,xOm);
substr=substr.replace(/^0+/,"");
if(substr.length == 0) return 0;
return parseInt(substr);
}
}
p4.x8m=function(i, length)
{
var xo=""+i;
xo=this.xTk(length-xo.length)+xo;
return xo;
}
p4.xRk=function(x1m, xsl)
{
x1m=this.xvk(x1m);
xsl=this.xvk(xsl);
if(x1m.length > xsl.length) return 1;
if(x1m.length < xsl.length) return -1;
var xLk=x1m.length;
var xLl, xJk;
for(var i=0; i < xLk; i++)
{
xLl=x1m.charCodeAt(i);
xJk=xsl.charCodeAt(i);
if(xLl > xJk) return 1;
if(xLl < xJk) return -1;
}
return 0;
}
p4.xQm=function(s)
{
var xNk=s.length;
var xan=0;
var xjm;
while(xNk > 0)
{
xjm=xNk-1;
if(s.charAt(xjm) !="0") break;
xan++;
xNk--;
}
if(xan > 0)
{
s=s.substr(0,xNk);
}
return [s,xan];
}
p4.xvk=function(s)
{
var xAm=0;
while(xAm < s.length)
{
if(s.charAt(xAm) !="0") break;
xAm++;
}
if(xAm > 0)
{
return s.substr(xAm);
}
else
{
return s;
}
}
p4.x1k=function(xZm,xLk)
{
if(xZm.length < xLk)
{
xZm=this.xTk(xLk-xZm.length)+xZm;
}
return xZm;
}
p4.xTk=function(xnl)
{
var s="000000000000000000000000000000000000000000000000000000000";
var xo="";
while(xo.length < xnl)
{
xo += s.substr(0,xnl-xo.length);
}
return xo;
}
p4.xqk=function(x1m)
{
if(x1m < 0.0)
{
throw new Error("Negative");
}
if(x1m < 1.0)
{
return"";
}
var xel=""+x1m;
if(/^[0-9]+$/.test(xel))
{
return xel;
}
else
{
var exp=Math.floor(Math.log(x1m)/Math.log(10))+1;
x1m *= Math.pow(10,-exp);
if(x1m >= 1.0)
{
exp += 1;
x1m *= 0.1;
}
else if(x1m < 0.1)
{
exp -= 1;
x1m *= 10;
}
var xdm=""+x1m;
if(xdm.substr(0,2) !="0.")
{
throw new Error("Internal error");
}
xdm=xdm.substr(2);
if(xdm.length < exp)
{
xdm += this.xTk(exp-xdm.length);
}
else
{
xdm=xdm.substr(0,exp);
}
return xdm;
}
}
p4.xgm=function(s)
{
s=this.xvk(s);
if(s =="")
{
return 0.0;
}
else
{
var xfm=17;
if(s.length > xfm)
{
return parseFloat(s.substr(0,xfm))*Math.pow(10,s.length-xfm);
}
else
{
return parseFloat(s);
}
}
}
p4.xFk=function()
{
var x1m=this.xAl;
var xo="";
var xdl=this.xcm-1;
var x1l=this.xxl;
var xfl=Math.floor(1+(x1m.length-1)/xdl);
var x3l=(xfl-1)*xdl;
var xum;
var xDm=0;
for(var xpl=0; xpl < xfl; xpl++)
{
xum=this.xPm(x1m,x3l,xdl);
xum += xDm;
xDm=(xum & 1)? x1l : 0;
xum=Math.floor(0.5*xum);
xo += this.x8m(xum, xdl);
x3l -= xdl;
}
var xKm=new x7k();
if(xDm != 0)
{
xKm.xAl="1";
xKm.x5m=this.x5m;
}
this.xAl=this.xvk(xo);
return xKm;
}
p4.xMl=function(xKl, xHm)
{
var xbm=17;
var xZl=1e17;
var xtk=0;
var x1m=new x7k(xKl);
var xsl=new x7k(xHm);
if(x1m.xAl.length > xbm)
{
xtk += x1m.xAl.length-xbm;
x1m.xAl=x1m.xAl.substr(0,xbm);
}
if(xsl.xAl.length > xbm)
{
xtk -= xsl.xAl.length-xbm;
xsl.xAl=xsl.xAl.substr(0,xbm);
}
var xCl=x1m.xbn();
var xVm=xsl.xbn();
var xFl=xCl/xVm;
xFl *= xZl;
xtk -= xbm;
var xcl=new x7k(xFl);
if(xtk > 0)
{
xcl.xAl += this.xTk(xtk);
}
else
{
var xLk=xcl.xAl.length;
if(xLk <= -xtk)
{
xcl.xyl(0);
}
else
{
xcl.xAl=xcl.xAl.substr(0,xLk+xtk);
}
}
return xcl;
}
p4.xMk=function(xxk)
{
if(xxk.xNm())
{
throw new Error("Divide by zero");
}
if( (xxk.xAl =="2") && (xxk.x5m == false) )
{
return this.xFk();
}
var xcl=new x7k();
var xKm=new x7k(this);
var xDk;
while(true)
{
if(xKm.xNm())
{
break;
}
xDk=this.xMl(xKm,xxk);
if(xDk.xNm())
{
if(this.x5m != xKm.x5m)
{
if(xKm.x5m == xxk.x5m)
{
xDk.xyl(1);
}
else
{
xDk.xyl(-1);
}
}
else
{
break;
}
}
xcl=xcl.xrk(xDk);
xKm=xKm.xZk(xDk.x6k(xxk));
}
this.xom(xcl);
return xKm;
}
p4.xIk=function(x1m, xsl)
{
x1m=this.xvk(x1m);
xsl=this.xvk(xsl);
var x6m=this.xRk(x1m,xsl);
if(x6m == 0) return ["",false];
var xOl=false;
if(x6m < 0)
{
var x9k=xsl;
xsl=x1m;
x1m=x9k;
xOl=true;
}
var xo="";
var xYd=this.xQm(xsl);
var xLm=xYd[1];
if(xLm > 0)
{
xsl=xYd[0];
var xJm=x1m.length-xLm;
xYd=this.xWm(x1m,xJm);
xo=xYd[1]+xo;
x1m=xYd[0];
}
var xdl=this.xcm-1;
var x0m=this.xxl;
var xym=x1m.length;
var xsk=xsl.length;
var x3l=0;
var xDm=0;
var xml, xwm, xvl;
while(x3l < xym)
{
if( (x3l >= xsk) && (xDm == 0) )
{
xo=x1m.substr(0,xym-x3l)+xo;
break;
}
xml=this.xPm(x1m,x3l,xdl);
xwm=this.xPm(xsl,x3l,xdl);
xvl=xml-xwm+xDm;
if(xvl >= 0)
{
xDm=0;
}
else
{
xDm=-1;
xvl += x0m;
}
xo=this.x8m(xvl, xdl)+xo;
x3l += xdl;
}
return [xo,xOl];
}
p4.x9m=function(s, xdl)
{
var xo=[];
var x3m=s.length;
var xHl;
var xSm;
while(true)
{
if(x3m <= 0) break;
xHl=x3m-xdl;
if(xHl < 0) xHl=0;
xSm=s.substring(xHl,x3m);
xSm=xSm.replace(/^0+/,"");
xo.push(parseInt(xSm));
x3m -= xdl;
}
return xo;
}
p4.xCk=function(x1m, xsl)
{
x1m=this.xvk(x1m);
xsl=this.xvk(xsl);
var x7m=0;
var xYd=this.xQm(x1m);
x1m=xYd[0];
x7m += xYd[1];
xYd=this.xQm(xsl);
xsl=xYd[0];
x7m += xYd[1];
var xo="";
var xdl=Math.floor((this.xcm-3)/2);
if(xdl < 1) xdl=1;
var xKk=Math.floor(1+(x1m.length-1)/xdl);
var xll=Math.floor(1+(xsl.length-1)/xdl);
var xSk=xKk+xll-1;
var xYm, xlm, xem, xrl, xzm, xXk, xYl;
var xDm=0;
var xwk;
var xXl=this.x9m(x1m,xdl);
var xGm=this.x9m(xsl,xdl);
for(xwk=0; xwk < xSk; xwk++)
{
xlm=xwk-xll+1;
if(xlm < 0) xlm=0;
xem=xwk+1;
if(xem > xKk) xem=xKk;
xzm=0;
xrl=xwk-xlm;
for(xYm=xlm; xYm < xem; xYm++)
{
var xEl=xXl[xYm];
var xuk=xGm[xrl];
xzm += xEl*xuk;
xrl--;
}
xzm += xDm;
xXk=this.x8m(xzm, xdl);
if(xXk.length > xdl)
{
xYl=xXk.length-xdl;
xDm=parseInt(xXk.substr(0, xYl));
xXk=xXk.substr(xYl);
}
else
{
xDm=0;
}
xo=xXk+xo;
}
if(xDm != 0)
{
xo=(""+xDm)+xo;
}
if(x7m != 0)
{
xo += this.xTk(x7m);
}
return xo;
}
p4.xWm=function(s, xJm)
{
var xWl, x4m;
if(xJm < 0)
{
xWl="";
x4m=this.xTk(-xJm)+s;
}
else if(xJm > s.length)
{
xWl=s+this.xTk(xJm-s.length);
x4m="";
}
else
{
xWl=s.substr(0,xJm);
x4m=s.substr(xJm);
}
return [xWl,x4m];
}
p4.xRl=function(x1m, xsl)
{
x1m=this.xvk(x1m);
xsl=this.xvk(xsl);
if(x1m.length < xsl.length)
{
var xim=x1m;
x1m=xsl;
xsl=xim;
}
var xo="";
var xYd=this.xQm(x1m);
var xLm=xYd[1];
var xJm;
if(xLm > 0)
{
x1m=xYd[0];
xJm=xsl.length-xLm;
xYd=this.xWm(xsl,xJm);
xo=xYd[1]+xo;
xsl=xYd[0];
}
xYd=this.xQm(xsl);
xLm=xYd[1];
if(xLm > 0)
{
xsl=xYd[0];
xJm=x1m.length-xLm;
xYd=this.xWm(x1m,xJm);
xo=xYd[1]+xo;
x1m=xYd[0];
}
var xdl=this.xcm;
var xym=x1m.length;
var xsk=xsl.length;
var x3l=0;
var xDm=0;
var xml, xwm, xXk, xYl;
while(x3l < xym)
{
if( (x3l >= xsk) && (xDm == 0) )
{
xo=x1m.substr(0,xym-x3l)+xo;
break;
}
xml=this.xPm(x1m,x3l,xdl);
xwm=this.xPm(xsl,x3l,xdl);
xXk=this.x8m(xml+xwm+xDm, xdl);
if(xXk.length > xdl)
{
xYl=xXk.length-xdl;
xDm=parseInt(xXk.substr(0, xYl));
xXk=xXk.substr(xYl);
}
else
{
xDm=0;
}
xo=xXk+xo;
x3l += xdl;
}
if(xDm != 0)
{
xo=(""+xDm)+xo;
}
return xo;
}
p4.xyk=function(x1m, x0l, xsl, xzk)
{
var xRm, xOl;
if(x0l == xzk)
{
xRm=this.xRl(x1m,xsl);
xOl=x0l;
}
else
{
var xo=this.xIk(x1m,xsl);
xRm=xo[0];
xOl=x0l;
if(xo[1])
{
xOl=!xOl;
}
}
return [xRm,xOl];
}
p4.xrk=function(xsl)
{
var xRm=this.xyk(this.xAl, this.x5m, xsl.xAl, xsl.x5m);
var xo=new x7k();
xo.xMm(xRm[0],xRm[1]);
return xo;
}
p4.xZk=function(xsl)
{
var xRm=this.xyk(this.xAl, this.x5m, xsl.xAl, !xsl.x5m);
var xo=new x7k();
xo.xMm(xRm[0],xRm[1]);
return xo;
}
p4.xHk=function(xsl)
{
if(this.x5m && (!xsl.x5m)) return -1;
if(xsl.x5m && (!this.x5m)) return 1;
var xo=this.xRk(this.xAl, xsl.xAl);
if(this.x5m) xo=-xo;
return xo;
}
p4.x6k=function(xsl)
{
var xOl=this.x5m;
if(xsl.x5m) xOl=!xOl;
var xQl=this.xCk(this.xAl, xsl.xAl);
var xo=new x7k();
xo.xMm(xQl,xOl);
return xo;
}
p4.xDl=function(xsl)
{
var xcl=new x7k(this);
var xKm=xcl.xMk(xsl);
return [xcl,xKm];
}
p4.xjl=function(xsl)
{
var xo=this.xDl(xsl);
return xo[0];
}
p4.xil=function(xsl)
{
var xo=this.xDl(xsl);
return xo[1];
}
p4.xvm=function(xsl)
{
return ((this.xAl == xsl.xAl) && (this.x5m == xsl.x5m));
}
p4.xyl=function(x5k)
{
this.x5m=(x5k < 0.0);
if(this.x5m)
{
x5k=-x5k;
}
this.xAl=this.xqk(x5k);
}
p4.xbn=function()
{
var xo=this.xgm(this.xAl);
if( (!this.xNm()) && (this.x5m) )
{
xo=-xo;
}
return xo;
}
p4.x8k=function()
{
if(this.x5m)
{
throw new Error("Not supported");
}
var xnl=new x7k(this);
var xYd;
var xo=[];
var xxk=new x7k("4294967296");
while(true)
{
xYd=xnl.xDl(xxk);
xnl=xYd[0];
var xmm=xnl.xNm();
var xSl=xYd[1].xbn();
for(var i=0; i < 4; i++)
{
if(xmm && (xSl == 0)) break;
xo.push(xSl & 0xff);
xSl >>= 8;
}
if(xmm) break;
}
xo.reverse();
return xo;
}
p4.x7l=function(xnm)
{
var x8l=3-((xnm.length+3)&3);
var xYd=[];
while(x8l-- > 0)
{
xYd.push(0);
}
xYd=xYd.concat(xnm);
var xo=new x7k();
var xZl=new x7k("4294967296");
for(var xqm=0; xqm < xYd.length; xqm += 4)
{
xo=xo.x6k(xZl);
var xSl=(xYd[xqm]<<24) | (xYd[xqm+1]<<16) | (xYd[xqm+2]<<8) | (xYd[xqm+3]);
if(xSl < 0)
{
xSl += 0x100000000;
}
var xrk=new x7k(xSl);
xo=xo.xrk(xrk);
}
this.xom(xo);
}
p4.xUk=function(xJl, xNl)
{
if(this.x5m || xJl.x5m || xNl.x5m)
{
throw new Error("Negative");
}
var xIm=new x7k(this);
var xtm=new x7k("2");
var xFm=new x7k(xJl);
var xCm;
var xo=new x7k("1");
while(true)
{
xCm=xFm.xMk(xtm);
if(!xCm.xNm())
{
xo=xo.x6k(xIm);
xo=xo.xil(xNl);
}
if(xFm.xNm())
{
break;
}
xIm=xIm.x6k(xIm);
xIm=xIm.xil(xNl);
}
return xo;
}
p4.xsm=function()
{
return this.x5m;
}
var p5=xzn.prototype;
p5.xRn=null;
p5.xDn=null;
p5.xrn=null;
function xzn()
{
}
p5.xnn=function(xxn, xfn)
{
var xJn=new x7k("1");
var xMf=xxn.x6k(xfn);
var xHn=xxn.xZk(xJn).x6k(xfn.xZk(xJn));
var xHe=new x7k(17);
var xAn=this.xin(xHe,xHn);
var xGn=xAn[2];
if(!xGn.xvm(xJn))
{
if(!xHn.xil(xGn).xNm())
{
throw new Error("internal error");
}
throw new Error("not coprime");
}
var xQb=xAn[0];
if(xQb.xsm())
{
xQb=xQb.xrk(xHn);
}
if(xQb.xsm())
{
throw new Error("negative");
}
if(xQb.xHk(xHn) >= 0)
{
throw new Error("too large");
}
var xWe=xQb.x6k(xHe).xil(xHn);
if(!xWe.xvm(xJn))
{
throw new Error("failed2");
}
return [xHe,xQb,xMf];
}
p5.xBn=function(x3l, xMf)
{
this.xDn=new x7k(x3l);
this.xRn=new x7k(xMf);
}
p5.xNn=function(x3l, xMf)
{
this.xrn=new x7k(x3l);
this.xRn=new x7k(xMf);
}
p5.xwn=function()
{
return this.xDn;
}
p5.xEn=function()
{
return this.xrn;
}
p5.xln=function()
{
return this.xRn;
}
p5.xen=function()
{
if( (!this.xRn) || (!this.xrn) )
{
throw new Error("Need private key");
}
}
p5.xQn=function()
{
if( (!this.xRn) || (!this.xDn) )
{
throw new Error("Need public key");
}
}
p5.xjn=function(message)
{
this.xen();
if(message.xHk(this.xRn) >= 0)
{
throw new Error("Message too large");
}
return message.xUk(this.xrn,this.xRn);
}
p5.xvn=function(message)
{
this.xQn();
if(message.xHk(this.xRn) >= 0)
{
throw new Error("Message too large");
}
return message.xUk(this.xDn,this.xRn);
}
p5.xin=function(xSn, xgn)
{
var xik=new x7k(xSn);
var xQk=new x7k(xgn);
var x=new x7k();
var y=new x7k("1");
var xqn=new x7k("1");
var xpn=new x7k();
while(!xQk.xNm())
{
var xFn=xik.xDl(xQk);
var xcl=xFn[0];
xik.xom(xQk);
xQk=xFn[1];
var xkn=xqn.xZk(xcl.x6k(x));
var xhn=xpn.xZk(xcl.x6k(y));
xqn=x;
xpn=y;
x=xkn;
y=xhn;
}
var xWe=xqn.x6k(xSn).xrk(xpn.x6k(xgn));
if(!xWe.xvm(xik))
{
throw new Error("Failed3");
}
if(!xSn.xil(xik).xNm())
{
throw new Error("Failed4");
}
if(!xgn.xil(xik).xNm())
{
throw new Error("Failed5");
}
return [xqn, xpn, xik];
}
var p6=xho.prototype;
function xho()
{
}
p6.x1n=function(xAo)
{
this.xjo();
var xoo=xAo.length;
var xqm=0;
var xuo=xoo;
while(true)
{
if(xuo >= 64)
{
this.xio(xAo.slice(xqm,xqm+64));
xuo -= 64;
xqm += 64;
}
else
{
this.xbo(xAo.slice(xqm,xqm+xuo),xoo);
break;
}
}
return this.xWn(this.xwo);
}
p6.xgo=function(s)
{
var xBo=this.x7n(s);
this.x1n(xBo);
}
p6.x4n=function()
{
return this.xWn(this.xwo);
}
p6.xGo=function()
{
var xBo=this.xWn(this.xwo);
return this.xDo(xBo);
}
p6.xDo=function(xik)
{
var xo="";
for(var i=0; i < xik.length; i++)
{
var xQk=xik[i];
for(var xwk=0; xwk < 2; xwk++)
{
var x3n=(xQk >> 4)&0x0f;
if(x3n < 10)
{
xo += String.fromCharCode(48+x3n);
}
else
{
xo += String.fromCharCode(87+x3n);
}
xQk <<= 4;
}
}
return xo;
}
//////////// private: ///////////////
p6.xjo=function()
{
this.xwo=[0x67452301, 0xEFCDAB89, 0x98BADCFE, 0x10325476, 0xC3D2E1F0];
}
p6.xXn=function(xxo)
{
if(xxo.length != 16)
{
throw new Error("Should be 16");
}
var xLf=[];
var i;
for(i=0; i < 16; i++)
{
xLf[i]=xxo[i];
}
for(i=16; i < 80; i++)
{
xLf[i] = this.xpo(xLf[i-3] ^ xLf[i-8] ^ xLf[i-14] ^ xLf[i-16], 1);
}
var xyo=this.xwo.slice(0);
var x5k, xao, xeo;
for(i=0; i < 80; i++)
{
if(i < 20)
{
x5k = (xyo[1] & xyo[2]) | ((xyo[1]^0xffffffff) & xyo[3]);
xao = 0x5A827999;
}
else if(i < 40)
{
x5k = xyo[1] ^ xyo[2] ^ xyo[3];
xao = 0x6ED9EBA1;
}
else if(i < 60)
{
x5k = (xyo[1] & xyo[2]) | (xyo[1] & xyo[3]) | (xyo[2] & xyo[3]);
xao = 0x8F1BBCDC;
}
else
{
x5k = xyo[1] ^ xyo[2] ^ xyo[3];
xao = 0xCA62C1D6;
}
xeo = (this.xpo(xyo[0], 5)+x5k+xyo[4]+xao+xLf[i]) & 0xffffffff;
xyo[4] = xyo[3];
xyo[3] = xyo[2];
xyo[2] = this.xpo(xyo[1], 30);
xyo[1] = xyo[0];
xyo[0] = xeo;
}
for(i=0; i < 5; i++)
{
xeo=this.xwo[i]+xyo[i];
xeo &= 0xffffffff;
this.xwo[i]=xeo;
}
}
p6.xio=function(xAo)
{
if(xAo.length != 64)
{
throw new Error("Should be 64");
}
var xzo=this.xco(xAo);
this.xXn(xzo);
}
p6.xbo=function(xAo, xro)
{
var xto=xro & 63;
var xno=xAo.slice(0,xto);
xno.push(128);
if(xno.length < 56)
{
while(xno.length < 56)
{
xno.push(0);
}
}
else
{
while(xno.length < 120)
{
xno.push(0);
}
}
xro *= 8;
var xqo=this.xWn([Math.floor(xro/0x100000000), xro&0xffffffff]);
xno=xno.concat(xqo);
if(xno.length == 64)
{
this.xio(xno);
}
else
{
this.xio(xno.slice(0,64));
this.xio(xno.slice(64,128));
}
}
p6.xpo=function(xQk, xko)
{
xQk &= 0xffffffff;
var xo=this.xUn(xQk, xko);
var xWe=this.xUn(xo, -xko);
if(xQk != xWe)
{
throw new Error("Failed");
}
return xo;
}
p6.xUn=function(xQk, xko)
{
xko &= 31;
if(xko == 0) return xQk;
var xo=(xQk << xko)&0xffffffff;
var x8n=32-xko;
var xFo=0x7fffffff >> (x8n-1);
var xlo=(xQk >> x8n)&xFo;
xo |= xlo;
return xo;
}
p6.xco=function(xAo)
{
if(xAo.length & 3)
{
throw new Error("Should be multiple of 4");
}
var xzo=[];
var xBl=0;
var i=0;
while(i < xAo.length)
{
xBl <<= 8;
xBl |= (xAo[i] & 0xff);
i++;
if( (i & 3) == 0)
{
xzo.push(xBl);
xBl=0;
}
}
return xzo;
}
p6.xWn=function(xxo)
{
var xBo=[];
var xLf, i, xmo;
for(i=0; i < xxo.length; i++)
{
xLf=xxo[i];
xBo.push((xLf >> 24)&0xff);
xBo.push((xLf >> 16)&0xff);
xBo.push((xLf >> 8)&0xff);
xBo.push((xLf)&0xff);
}
return xBo;
}
p6.x7n=function(s)
{
var xo=[];
for(var i=0; i < s.length; i++)
{
xo=xo.concat(this.xZn(s.charCodeAt(i)));
}
return xo;
}
p6.xZn=function(xXj)
{
var xo;
if(xXj <= 0x7f)
{
xo=[xXj];
}
else if(xXj <= 0x07ff)
{
xo=[0xc0|((xXj>>6)&0x1f), 0x80|(xXj&0x3f)];
}
else if(xXj <= 0xffff)
{
xo=[0xc0|((xXj>>12)&0x0f), 0x80|((xXj>>6)&0x3f), 0x80|(xXj&0x3f)];
}
else if(xXj <= 0x1fffff)
{
xo=[0xc0|((xXj>>18)&0x07), 0x80|((xXj>>12)&0x3f), 0x80|((xXj>>6)&0x3f), 0x80|(xXj&0x3f)];
}
else if(xXj <= 0x3ffffff)
{
xo=[0xc0|((xXj>>24)&0x03), 0x80|((xXj>>18)&0x3f), 0x80|((xXj>>12)&0x3f), 0x80|((xXj>>6)&0x3f), 0x80|(xXj&0x3f)];
}
else
{
xo=[0xc0|((xXj>>30)&0x01), 0x80|((xXj>>24)&0x3f), 0x80|((xXj>>18)&0x3f), 0x80|((xXj>>12)&0x3f), 0x80|((xXj>>6)&0x3f), 0x80|(xXj&0x3f)];
}
return xo;
}
var p7=xHo.prototype;
function xHo()
{
this.xPo="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
}
p7.xIo=function(xBo)
{
var xo="";
var xoo=xBo.length;
var xYb=0;
var x3m;
while(xYb < xoo)
{
x3m=xYb+3;
if(x3m > xoo) x3m=xoo;
xo += this.xVo(xBo.slice(xYb,x3m));
xYb=x3m;
}
return xo;
}
p7.xJo=function(xZm)
{
var xo=[];
if( (xZm.length % 4) != 0)
{
this.xSo();
}
var xYb=0;
var xXo;
while(xYb < xZm.length)
{
xXo=this.xQo(xZm.substr(xYb,4));
xo=xo.concat(xXo);
xYb += 4;
}
return xo;
}
p7.xVo=function(xBo)
{
var xo="";
var x3n=xBo[0] >> 2;
xo += this.xPo.substr(x3n,1);
var xQk;
if(xBo.length < 2)
{
xQk=0;
}
else
{
xQk=xBo[1];
}
x3n=((xBo[0] & 0x03) << 4) | (xQk >> 4);
xo += this.xPo.substr(x3n,1);
if(xBo.length < 2)
{
xo +="==";
}
else
{
if(xBo.length < 3)
{
xQk=0;
}
else
{
xQk=xBo[2];
}
x3n=((xBo[1] & 0x0f) << 2) | (xQk >> 6);
xo += this.xPo.substr(x3n,1);
if(xBo.length < 3)
{
xo +="=";
}
else
{
x3n=xQk & 0x3f;
xo += this.xPo.substr(x3n,1);
}
}
return xo;
}
p7.xQo=function(xZm)
{
if(xZm.length != 4)
{
this.xSo();
}
var xo=[];
var x1o=this.xRo(xZm.charCodeAt(0));
var xYo=this.xRo(xZm.charCodeAt(1));
xo[0]=(x1o << 2) | (xYo >> 4);
var i=xZm.charCodeAt(2);
if(i != 61)
{
x1o=xYo;
xYo=this.xRo(i);
xo[1]=((x1o & 0x0f) << 4) | (xYo >> 2);
i=xZm.charCodeAt(3);
if(i != 61)
{
x1o=xYo;
xYo=this.xRo(i);
xo[2]=((x1o & 0x03) << 6) | xYo;
}
}
return xo;
}
p7.xRo=function(xTo)
{
if( (xTo >= 65) && (xTo <= 90))
{
return xTo-65;
}
else if( (xTo >= 97) && (xTo <= 122))
{
return xTo-71;
}
else if( (xTo >= 48) && (xTo <= 57))
{
return xTo+4;
}
else if(xTo == 43)
{
return 62;
}
else if(xTo == 47)
{
return 63;
}
this.xSo();
return 0;
}
p7.xSo=function()
{
throw new Error("Faulty Base64 data");
}
var p8=xcp.prototype;
function xcp()
{
this.xup=new xzn();
this.xlp=new xho();
this.xsp=new xHo();
}
p8.xwp=function(message, xvp)
{
this.xup.xen();
if(xvp)
{
this.xup.xQn();
}
this.xlp.xgo(message);
var x6n=this.xlp.x4n();
var xMf=this.xup.xln();
var xpp=xMf.x8k();
var xnp=xpp.length-1;
if(x6n.length > xnp)
{
throw new Error("Key too short");
}
var xtp="";
while(x6n.length < xnp)
{
var xlh=Math.floor(Math.random()*255);
x6n[x6n.length]=xlh;
xtp += xlh+",";
}
var xrp=new x7k();
xrp.x7l(x6n);
var xPn=this.xup.xjn(xrp);
if(xvp)
{
var xop=this.xup.xvn(xPn);
if(! xop.xvm(xrp))
{
throw new Error("Internal error");
}
}
var x8o=xPn.x8k();
var xmp=this.xsp.xIo(x8o);
return xmp;
}
p8.xvp=function(message, xSf)
{
this.xup.xQn();
var xkp=this.xsp.xJo(xSf);
var xip=new x7k();
xip.x7l(xkp);
var xop=this.xup.xvn(xip);
var x7o=xop.x8k();
this.xlp.xgo(message);
var x6n=this.xlp.x4n();
if(x7o.length < x6n.length) return false;
for(var i=0; i < x6n.length; i++)
{
if(x7o[i] != x6n[i]) return false;
}
return true;
}
p8.xBn=function(x3l, xMf)
{
this.xup.xBn(x3l, xMf);
}
p8.xNn=function(x3l, xMf)
{
this.xup.xNn(x3l, xMf);
}