!function(){Cocoon=window.Cocoon?window.Cocoon:{},Cocoon.version="1.0",Cocoon.extend=function(o,t){var n=o.prototype,e=function(){};e.prototype=t.prototype,o.prototype=new e,o.superclass=t.prototype,o.prototype.constructor=o,t.prototype.constructor===Object.prototype.constructor&&(t.prototype.constructor=t);for(var r in n)n.hasOwnProperty(r)&&(o.prototype[r]=n[r])},Cocoon.clone=function(o,t){if(null===o||"object"!=typeof o)return o;var n=[];for(var e in o)n.push(t.hasOwnProperty(e)?t[e]:o[e]);return n},Cocoon.callNative=function(o,t,n,e,r){window.cordova?window.cordova.exec(e,r,o,t,n):console.error("window.cordova not found")},Cocoon.getObjectFromPath=function(o,t){for(var n=t.split("."),e=o,r=0,i=n.length;i>r;++r)e[n[r]]=e[n[r]]||void 0,e=e[n[r]];return e},Cocoon.define=function(o,t){for(var n="Cocoon."==o.substring(0,7)?o.substr(7):o,e=window.Cocoon,r=n.split("."),i=e,a=0;a<r.length;a++){var s=r[a];if(console.log(i[s]?"Updated namespace: - "+o:"Created namespace: "+o),i=i[s]=a==r.length-1?t(i[s]||{}):{},!i)throw"Unable to create class "+o}return!0},Cocoon.Signal=function(){this.signals={}},Cocoon.Signal.prototype={on:function(o,t){if(!o||!t)throw new Error("Can't create signal "+(o||""));var n=this.signals[o];n||(n=[],this.signals[o]=n),n.push(t)},emit:function(o,t,n){var e=this.signals[o];if(e)for(var r=0;r<e.length;++r){var i=e[r];t&&(i=i[t]),i&&i.apply(null,n||[])}},remove:function(o,t){var n=this.signals[o];if(n)if(t)for(var e=0;e<n.lenght;++e)n[e]===t&&(n.splice(e,1),--e);else n.lenght=0},expose:function(){return this.on.bind(this)}},Cocoon.PlatformType={ANDROID:"android",IOS:"ios",AMAZON:"amazon",WINDOWS_PHONE:"wp",BLACKBERRY:"blackberry",OTHER:"other"};var o;Cocoon.getPlatform=function(){if(o)return o;var t=navigator.userAgent;return o=navigator.isCocoonJS?/ios/gi.test(t)?Cocoon.PlatformType.IOS:Cocoon.PlatformType.ANDROID:/(iPad|iPhone|iPod)/g.test(t)?Cocoon.PlatformType.IOS:/Kindle/i.test(t)||/Silk/i.test(t)||/KFTT/i.test(t)||/KFOT/i.test(t)||/KFJWA/i.test(t)||/KFJWI/i.test(t)||/KFSOWI/i.test(t)||/KFTHWA/i.test(t)||/KFTHWI/i.test(t)||/KFAPWA/i.test(t)||/KFAPWI/i.test(t)?Cocoon.PlatformType.AMAZON:/Android/i.test(t)?Cocoon.PlatformType.ANDROID:/BlackBerry/i.test(navigator.userAgent)?Cocoon.PlatformType.BLACKBERRY:/IEMobile/i.test(navigator.userAgent)?Cocoon.PlatformType.WINDOWS_PHONE:Cocoon.PlatformType.OTHER},console.log("Created namespace: Cocoon")}();