/* Copyright 2009, Avenza Systems Inc. */
"use strict";var AVENZA=(function(){var i="attributes";var o="LOCAL_SANDBOX";var j="NETWORK_SANDBOX";var e="AUTO_SANDBOX";function f(){return(/^file\:/).test(location.href)}function g(p){if(null===p.viewer&&swfobject){p.viewer=swfobject.getObjectById(p.id)}return(null!==p.viewer)}function a(p,q){if(typeof(p.viewer[q])!="undefined"){return true}if(f()){alert("The AVENZA API is not enabled for untrusted local files.  To use the API, first add this address to the list of trusted sites in your Flash Player security panel.")}return false}function l(p){this.id=p;this.viewer=null}l.prototype.panRight=function(){if(g(this)&&a(this,"panRight")){this.viewer.panRight()}};l.prototype.panLeft=function(){if(g(this)&&a(this,"panLeft")){this.viewer.panLeft()}};l.prototype.panUp=function(){if(g(this)&&a(this,"panUp")){this.viewer.panUp()}};l.prototype.panDown=function(){if(g(this)&&a(this,"panDown")){this.viewer.panDown()}};l.prototype.panHome=function(){if(g(this)&&a(this,"panHome")){this.viewer.panHome()}};l.prototype.zoomIn=function(){if(g(this)&&a(this,"zoomIn")){this.viewer.zoomIn()}};l.prototype.zoomOut=function(){if(g(this)&&a(this,"zoomOut")){this.viewer.zoomOut()}};l.prototype.setVisible=function(p,q){if(g(this)&&a(this,"swfLayerToggle")){this.viewer.swfLayerToggle(p,q)}};l.prototype.setAlpha=function(p,q){if(g(this)&&a(this,"setAlpha")){this.viewer.setAlpha(p,q)}};l.prototype.subscribe=function(p,q){if(g(this)&&a(this,"addAttributeObserver")){if(i==p){this.viewer.addAttributeObserver(q)}}};l.prototype.unsubscribe=function(q,p){if(g(this)&&a(this,"removeAttributeObserver")){if(i==q){this.viewer.removeAttributeObserver(p)}}};l.prototype.retrieve=function(p){if(g(this)&&a(this,"getCurrentAttributes")){if(i==p){return this.viewer.getCurrentAttributes()}}else{return{}}};l.prototype.element=function(){if(g(this)){return this.viewer}else{return null}};l.prototype.tween=function(s,q,p,r){if(g(this)&&a(this,"tween")){this.viewer.tween(s,q,p,r)}};var c;function n(){if(c){c()}}function k(p){if(window&&window.getComputedStyle){return window.getComputedStyle(p,null)}else{if(p.currentStyle){return p.currentStyle}}return null}function m(r,s){if(f()&&(j!=s)){return false}var t=r.parentNode;var q=k(t).position.toLowerCase();if(q&&(q!="static")){q=k(r).position.toLowerCase();if(!q||(q=="static")){return true}}return false}function b(p){if(p.length>0&&"/"!=p.substring(p.length-1)){p+="/"}return p}function d(q,t,C,u){if(!q){return null}t=t||"100%";C=C||"100%";u=u||{};var A=document.getElementById(q);if(A){var B=u.flashSecuritySandbox||j;if(!u.disableBackgroundImageElement&&m(A,B)&&!(t.substr(-1)=="%"||C.substr(-1)=="%")){var s=A.parentNode;var w=u.imageBaseURL||u.baseURL||"";w=b(w);w+="map.png";var z=document.createElement("img");z.src=w;z.style.height=C;z.style.width=t;z.style.position="absolute";z.style.top=0;z.style.left=0;var v=document.createElement("div");v.style.position="relative";v.style.top=0;v.style.left=0;s.insertBefore(z,A);s.insertBefore(v,A);v.appendChild(A)}var r=u.loadedCB||null;var x=u.viewerBaseURL||u.baseURL||"";x=b(x);var y=x;if(u.viewerFileName){y+=u.viewerFileName}else{if(B==e){y+=f()?"map-viewer-local.swf":"map-viewer.swf"}else{if(B==o){y+="map-viewer-local.swf"}else{y+="map-viewer.swf"}}}c=function(){if(s){s.removeChild(z)}if(r){r()}};u.loadedCB="AVENZA.private_cb";swfobject.embedSWF(y,q,t,C,"9.0.115",x+"expressInstall.swf",u,{wmode:"transparent",AllowScriptAccess:"always"})}}function h(s,q,p,r){swfobject.addDomLoadEvent(function(){d(s,q,p,r)});return new l(s)}return{ATTRIBUTES:i,LOCAL_SANDBOX:o,NETWORK_SANDBOX:j,AUTO_SANDBOX:e,Viewer:l,embedViewer:h,private_cb:n}}());
