Floorplanner.VERSION=4;Floorplanner.STATE_SHOW="show";Floorplanner.STATE_EDIT="edit";Floorplanner.STATE_ZOOM="zoom";Floorplanner.STATE_EMBED="embed";Floorplanner.STATE_NONE="none";Floorplanner.STATE_START="start_edit";Floorplanner.STATE_DEMO="edit";Floorplanner.STATE_PUBLISHED="published";Floorplanner.DEFAULT_AMFPHP_ROOT="http://localhost/fp/2d/services/";Floorplanner.DEFAULT_WEBSERVICE_ROOT="http://localhost/fp/";Floorplanner.DEFAULT_CONTENT_SERVER="http://localhost/fp/";Floorplanner.DEFAULT_SERVICE="object_remoting";Floorplanner.APP_2D_ROOT="/apps/2d/";Floorplanner.APP_3D_ROOT="/apps/3d/";Floorplanner.PREVIEW_APP_SUFFIX="/apps/preview/preview.swf";Floorplanner.EXPRESS_FLASH_INSTALL="/flash/expressInstall.swf";Floorplanner.ASSET_ROOT_SUFFIX="/assets/";Floorplanner.APP_2D_FLASH_VERSION="8";Floorplanner.APP_3D_FLASH_VERSION="9.0.0";Floorplanner.APP_2D_VERSION=135;Floorplanner.APP_3D_VERSION=66;Floorplanner.loadedInstances={};function Floorplanner(b){this.fOptions=(b==null)?{}:b;this.f2dVersion=(b.fp2d_version==null)?Floorplanner.APP_2D_VERSION:b.fp2d_version;this.f3dVersion=(b.fp3d_version==null)?Floorplanner.APP_3D_VERSION:b.fp3d_version;var a=null;do{a="instance_"+Math.round(Math.random()*10000000).toString()}while(Floorplanner.loadedInstances[a]!=null);this.fOptions.instance=a;Floorplanner.loadedInstances[a]=this;this.fOptions.language=(this.fOptions.language==null)?"en":this.fOptions.language;this.fOptions.state=(this.fOptions.state==null)?Floorplanner.STATE_SHOW:this.fOptions.state;if(this.fOptions.service==null){this.fOptions.service=Floorplanner.DEFAULT_SERVICE}if(this.fOptions.amfphp_root==null){this.fOptions.amfphp_root=Floorplanner.DEFAULT_AMFPHP_ROOT}if(this.fOptions.webservice_root==null){this.fOptions.webservice_root=Floorplanner.DEFAULT_WEBSERVICE_ROOT}if(this.fOptions.content_server==null){this.fOptions.content_server=Floorplanner.DEFAULT_CONTENT_SERVER}if(this.fOptions.assets_root==null){this.fOptions.assets_root=this.fOptions.content_server+Floorplanner.ASSET_ROOT_SUFFIX}this.f2dLoaded=false;this.f3dLoaded=false;this.fHolderDiv="";this.f2dDiv="";this.f3dDiv="";this.fCurrentView=null;this.fCurrentUserId=null;this.fFeedbackOn=false;this.fEventHandlers={};this.observe("LOADED",function(){this.f2dLoaded=true})}Floorplanner.prototype.observe=function(b,a){if(this.fEventHandlers[b]==null){this.fEventHandlers[b]=new Array()}this.fEventHandlers[b][this.fEventHandlers[b].length]=a};Floorplanner.prototype.handleFlashEvent=function(b,c){if(this.fEventHandlers[b]!=null){for(var a=0;a<this.fEventHandlers[b].length;a++){try{this.fEventHandlers[b][a].call(this,c)}catch(d){if(console){console.info(d)}}}}};Floorplanner.prototype.embed=function(b,a){this.fHolderDiv=b;this.f2dDiv=this.fHolderDiv+"_2d";this.f3dDiv=this.fHolderDiv+"_3d";var d=document.getElementById(this.fHolderDiv);var c=document.createElement("div");c.id=this.f2dDiv;c.innerHTML='<div id="flash-warning"><p>Floorplanner requires Adobe Flash version 9 or higher.<br /> Please visit <a href="http://get.adobe.com/flashplayer/">the Adobe Flash website</a> to install it.</p></div>';d.appendChild(c);this.observe("SHOW3D",function(e){this.toggleView()});this.observe("SHOW2D",function(e){this.toggleView()});this.observe("READY_FOR_JSON",function(e){this.loadSavedJSONExport()});if(this.fOptions.standalone_3d==true){this.runStandalone3d(this.f3dDiv,a);this.fCurrentView="3d"}else{this.run2d(c.id,a);this.fCurrentView="2d"}};Floorplanner.prototype.run2d=function(d,f,i){if(f==null){f={}}if(f.width==null){f.width="100%"}if(f.height==null){f.height="100%"}this.f2dDiv=d;var a={allowscriptaccess:"always",bgcolor:"#FFFFFF"};var h=(i==null)?{}:i;var b={app_root:this.fOptions.content_server+Floorplanner.APP_2D_ROOT+this.f2dVersion+"/"};var g=b.app_root+"loader.swf?movie="+b.app_root+"application.swf";for(var c in this.fOptions){if(typeof this.fOptions[c]!="function"){b[c]=this.fOptions[c]}}swfobject.embedSWF(g,this.f2dDiv,f.width,f.height,Floorplanner.APP_2D_FLASH_VERSION,Floorplanner.EXPRESS_FLASH_INSTALL,b,a,h);var e=navigator.appVersion.toLowerCase().indexOf("mac")!=-1;if(e){this.initMouseWheel()}};Floorplanner.prototype.runStandalone3d=function(c,a){var e=document.getElementById(this.fHolderDiv);var b=document.createElement("div");b.id=this.f3dDiv;e.appendChild(b);var d=document.getElementById(this.f2dDiv);d.innerHTML="";d.style.height="0px";d.style.width="0px";this.run3d(this.f3dDiv)};Floorplanner.prototype.run3d=function(d,a){this.f3dDiv=d;if(a==null){a={}}if(a.width==null){a.width="100%"}if(a.height==null){a.height="100%"}var e=this.fOptions.content_server+Floorplanner.APP_3D_ROOT+this.f3dVersion+"/";var c={allowscriptaccess:"always",bgcolor:"#FFFFFF",allowFullScreen:"true"};var b={};if(this.fOptions.standalone_3d!=true){var g={app_root:e,designXml:this.fXML}}else{var g={app_root:e}}for(var f in this.fOptions){if(typeof this.fOptions[f]!="function"){g[f]=this.fOptions[f]}}swfobject.embedSWF(e+"floorplanner.swf",this.f3dDiv,a.width,a.height,Floorplanner.APP_3D_FLASH_VERSION,Floorplanner.EXPRESS_FLASH_INSTALL,g,c,b);this.f3dLoaded=true};Floorplanner.prototype.toggleView=function(){var c=document.getElementById(this.f2dDiv);if(this.fCurrentView=="2d"){this.enableResize(false);this.saveXMLExport();c.style.width="0px";c.style.height="0px";var b=document.getElementById(this.fHolderDiv);var a=document.createElement("div");a.id=this.f3dDiv;b.appendChild(a);this.run3d(this.f3dDiv);this.fCurrentView="3d"}else{var b=document.getElementById(this.fHolderDiv);b.removeChild(document.getElementById(this.f3dDiv));this.f3dLoaded=false;if(this.fOptions.standalone_3d){this.run2d(c.id,this.fOptions);this.fOptions.standalone_3d=false}else{this.enableResize(false);c.blur();c.style.width="100%";c.style.height="100%";this.enableResize(true)}this.fCurrentView="2d"}};Floorplanner.prototype.toggleFeedback=function(){var c=document.getElementById(this.f2dDiv);var a=document.getElementById(this.f3dDiv);var b=document.getElementById(this.fHolderDiv);if(this.fFeedbackOn==false){if(this.fCurrentView=="2d"){c.style.width="0px";c.style.height="0px"}else{b.removeChild(document.getElementById(this.f3dDiv));this.f3dLoaded=false}this.enableResize(false);this.fFeedbackOn=true}else{if(this.fCurrentView=="2d"){c.style.width="100%";c.style.height="100%"}else{var a=document.createElement("div");a.id=this.f3dDiv;b.appendChild(a);this.run3d(this.f3dDiv)}this.enableResize(true);this.fFeedbackOn=false}};Floorplanner.prototype.ensure2d=function(){if(this.fCurrentView=="3d"){this.toggleView()}};Floorplanner.prototype.initMouseWheel=function(){var b=this;var a=document.getElementById(this.f2dDiv);if(a.addEventListener){a.addEventListener("DOMMouseScroll",function(c){b.handleWheelEvent.apply(b,[c])},false)}a.onmousewheel=function(c){b.handleWheelEvent.apply(b,[c])}},Floorplanner.prototype.handleWheelEvent=function(b){var c=0;if(b.wheelDelta){c=b.wheelDelta/120;if(window.opera){c=-c}}else{if(b.detail){c=-b.detail/3}}if(/AppleWebKit/.test(navigator.userAgent)){c/=3}if(c){var a=this.get2dMovie();a.apiExternalMouseWheelEvent(c)}if(b.preventDefault){b.preventDefault()}b.returnValue=false};Floorplanner.prototype.instance=function(){return this.fOptions.instance};Floorplanner.prototype.loadFloor=function(a){this.get2dMovie().loadFloor(a)};Floorplanner.prototype.loadDesign=function(a){this.get2dMovie().loadDesign(a)};Floorplanner.prototype.loadDesignByName=function(a,b){this.get2dMovie().loadDesignByName(a,b)};Floorplanner.prototype.saveDesign=function(a){this.get2dMovie().saveDesign(a)};Floorplanner.prototype.printDesign=function(){this.ensure2d();this.get2dMovie().printDesign()};Floorplanner.prototype.resetDesign=function(){this.ensure2d();this.get2dMovie().resetDesign()};Floorplanner.prototype.isModified=function(){return this.get2dMovie().isModified()};Floorplanner.prototype.showForm=function(a,b){if(this.fCurrentView=="3d"){if(a=="EXPORT_IMAGE"||a=="PRINT"){this.get3dMovie().showForm(a,b);return}else{this.ensure2d()}}this.get2dMovie().showForm(a,b)};Floorplanner.prototype.get2dMovie=function(){if(!this.f2dLoaded){throw new Error("The Flash application is not yet fully loaded! Wait for the LOADED event before calling functions.")}return document.getElementById(this.f2dDiv)};Floorplanner.prototype.get3dMovie=function(){if(!this.f3dLoaded){throw new Error("The 3D viewer is not yet fully loaded!")}return document.getElementById(this.f3dDiv)};Floorplanner.prototype.enableResize=function(a){this.get2dMovie().enableResize(a)};Floorplanner.prototype.previewElement=function(d,c,a,f,e){var b={allowscriptaccess:"always",bgcolor:"#FFFFFF"};var g={url:c};if(e==null){e={}}if(a==null){a="100%"}if(f==null){f="100%"}swfobject.embedSWF(this.getPreviewURL(),d,a,f,"8",Floorplanner.EXPRESS_FLASH_INSTALL,g,b,e)};Floorplanner.prototype.getPreviewURL=function(){return this.fOptions.content_server+Floorplanner.PREVIEW_APP_SUFFIX};Floorplanner.prototype.setCurrentUserId=function(a){this.fCurrentUserId=a};Floorplanner.prototype.getCurrentUserId=function(){return this.fCurrentUserId};Floorplanner.prototype.getMeasurementSystem=function(){return this.get2dMovie().getMeasurementSystem()};Floorplanner.prototype.setMeasurementSystem=function(a){return this.get2dMovie().setMeasurementSystem(a)};Floorplanner.prototype.getCurrentView=function(){return this.fCurrentView};Floorplanner.prototype.getState=function(){return this.fOptions.state};Floorplanner.prototype.setState=function(a){this.fOptions.state=a};Floorplanner.prototype.getProject=function(){return this.get2dMovie().getProject()};Floorplanner.prototype.isDemoProject=function(){return(this.fOptions.demo_project&&this.fOptions.demo_project==1)};Floorplanner.prototype.isEmptyProject=function(){return(this.fOptions.empty_project&&this.fOptions.empty_project==1)};Floorplanner.prototype.getShapes=function(a){if(a==null){a=false}return this.get2dMovie().getShapes(a)};Floorplanner.prototype.getDesignExport=function(a){return this.get2dMovie().getDesignExport(a)};Floorplanner.prototype.loadJSON3D=function(a){this.get3dMovie().parseProject(a)};Floorplanner.prototype.saveXMLExport=function(){this.fXML=escape(this.getDesignExport("XML"))};Floorplanner.prototype.is3dExportReady=function(){if(this.fJSON!=null){this.f3dLoaded=true;this.loadJSON3D(this.fJSON);return true}else{return false}};