var kOrientationChangedEvent="OrientationController:OrientationChangedEvent";var OrientationController=Class.create({initialize:function(){var a=this;if(gDevice==kDeviceMobile){debugMessage(kDebugOrientationController_Initialize,"adding event listener for window orientation change events...");window.onorientationchange=function(b){a.handleDeviceOrientationChangeEvent(b)};this.handleDeviceOrientationChangeEvent()}else{debugMessage(kDebugOrientationController_Initialize,"adding event listener for window resize events...");window.addEventListener("resize",function(b){a.handleWindowResizeEvent(b)},false);this.handleWindowResizeEvent()}this.orientation=kOrientationUnknown},handleWindowResizeEvent:function(b){debugMessage(kDebugOrientationController_HandleWindowResizeEvent,"");var a=kOrientationUnknown;if(window.innerWidth<window.innerHeight){a=kOrientationPortrait}else{a=kOrientationLandscape}this.changeOrientation(a)},handleDeviceOrientationChangeEvent:function(b){debugMessage(kDebugOrientationController_HandleDeviceOrientationChangeEvent,"");var c=window.orientation;var a=kOrientationUnknown;if((c==0)||(c==180)){a=kOrientationPortrait}else{a=kOrientationLandscape}this.changeOrientation(a)},changeOrientation:function(a){this.orientation=a;document.fire(kOrientationChangedEvent,{orientation:this.orientation})}});