/*
* Copyright 2013 Afilias Technologies Ltd (dotMobi). All rights reserved.
* http://deviceatlas.com
*/
var DeviceAtlas=DeviceAtlas||{};DeviceAtlas={apiVersion:"1.1",propsCache:"",cookieName:DeviceAtlas.cookieName||"DAPROPS",cookieExpiryDays:DeviceAtlas.cookieExpiryDays||1,cookieDomain:DeviceAtlas.cookieDomain||null,cookiePath:DeviceAtlas.cookiePath||"/",divStyle:null,ns:{svg:"http://www.w3.org/2000/svg"},cssPrfxs:["Webkit","Moz","O","ms","Khtml"],fncPrfxs:["webkit","moz","o","ms","khtml"],properties:{"js.webGl":function(){return !!window.WebGLRenderingContext},"js.geoLocation":function(){return !!navigator.geolocation},"js.webSqlDatabase":function(){return !!window.openDatabase},"js.indexedDB":function(){return DeviceAtlas.testPrexifes(window,"indexedDB")},"js.webSockets":function(){return DeviceAtlas.testPrexifes(window,"WebSocket")},"js.localStorage":function(){try{return !!localStorage.getItem}catch(A){return false}},"js.sessionStorage":function(){try{return !!sessionStorage.getItem}catch(A){return false}},"js.webWorkers":function(){return !!window.Worker},"js.applicationCache":function(){return !!window.applicationCache},"js.supportBasicJavaScript":function(){if((typeof alert!="function")||(typeof confirm!="function")||(typeof setTimeout!="function")||(typeof setInterval!="function")){return false}return !!document.location&&!!document.forms},"js.modifyDom":function(){if(!document.createElement||!document.appendChild){return false}var A,B;A=document.createElement("span");B=document.createElement("div");B.appendChild(A);return(B==A.parentNode)},"js.modifyCss":function(){if(!document.createElement){return false}var A;A=document.createElement("div");if((typeof A.style!="object")||(typeof A.style.display=="undefined")){return false}A.style.display="none";return(A.style.display=="none")},"js.supportEvents":function(){var B={submit:"form",click:"input",change:"input",load:"img",select:"input"};for(var A in B){if(!DeviceAtlas.isEventSupported(A,B[A])){return false}}return true},"js.supportEventListener":function(){return !!window.addEventListener},"js.xhr":function(){return(typeof XMLHttpRequest=="function")||(typeof XMLHttpRequest=="object")},"js.supportConsoleLog":function(){return(typeof console=="object")&&(typeof console.log=="function")},"js.json":function(){return(typeof JSON=="object")&&(typeof JSON.stringify=="function")},"js.deviceOrientation":function(){return false},"js.deviceMotion":function(){return !!window.DeviceMotionEvent},"js.touchEvents":function(){return("ontouchstart" in window)},"js.querySelector":function(){return !!document.querySelector},"html.canvas":function(){if(!document.createElement){return false}var A;A=document.createElement("canvas");return !!(A.getContext&&A.getContext("2d"))},"html.video":function(){if(!document.createElement){return false}var C,A=new Boolean();C=document.createElement("video");try{if(A=!!C.canPlayType){A.ogg=C.canPlayType('video/ogg; codecs="theora"');var B='video/mp4; codecs="avc1.42E01E';A.h264=C.canPlayType(B+'"')||C.canPlayType(B+', mp4a.40.2"');A.webm=C.canPlayType('video/webm; codecs="vp8, vorbis"')}}catch(D){}return A.valueOf()},"html.audio":function(){if(!document.createElement){return false}var B,A=new Boolean();B=document.createElement("audio");try{if(A=!!B.canPlayType){A.ogg=B.canPlayType('audio/ogg; codecs="vorbis"');A.mp3=B.canPlayType("audio/mpeg;");A.wav=B.canPlayType('audio/wav; codecs="1"');A.m4a=B.canPlayType("audio/x-m4a;")||B.canPlayType("audio/aac;")}}catch(C){}return A.valueOf()},"html.svg":function(){return !!document.createElementNS&&!!document.createElementNS(DeviceAtlas.ns.svg,"svg").createSVGRect},"html.inlinesvg":function(){if(!document.createElement){return false}var A;A=document.createElement("div");A.innerHTML="";return(A.firstChild&&A.firstChild.namespaceURI)==DeviceAtlas.ns.svg},"css.animations":function(){return DeviceAtlas.testPropsAll("animationName")},"css.columns":function(){return DeviceAtlas.testPropsAll("columnCount")},"css.transforms":function(){return !!DeviceAtlas.testProps(["transformProperty","WebkitTransform","MozTransform","OTransform","msTransform"])},"css.transitions":function(){return DeviceAtlas.testPropsAll("transitionProperty")},displayColorDepth:function(){return screen.colorDepth},cookieSupport:function(){if(typeof navigator.cookieEnabled=="undefined"&&typeof document.cookie=="string"){return true}return !!navigator.cookieEnabled},orientation:function(){if(typeof window.orientation!="undefined"){return window.orientation}else{return null}},devicePixelRatio:function(){var A=1;try{A=window.devicePixelRatio}catch(B){}return A+""},deviceAspectRatio:function(){var A=["2/3","40/71","3/4","16/9","16/10"];return DeviceAtlas.discoverMediaQueryValue("device-aspect-ratio",A)},flashCapable:function(){try{if(navigator.plugins&&navigator.plugins.length>0&&navigator.mimeTypes){var E="application/x-shockwave-flash";if(navigator.mimeTypes[E]&&navigator.mimeTypes[E].enabledPlugin){return true}}if((typeof ActiveXObject=="function")||(typeof ActiveXObject=="object")){var A=["ShockwaveFlash.ShockwaveFlash.7","ShockwaveFlash.ShockwaveFlash.7","ShockwaveFlash.ShockwaveFlash"];for(var C in A){try{var B=new ActiveXObject(A[C]);return true}catch(D){}}}}catch(D){}return false},accessDom:function(){return !!document.getElementById&&!!document.getElementsByTagName&&!!document.getElementsByName},userMedia:function(){return DeviceAtlas.testPrexifes(navigator,"getUserMedia")}},testProps:function(A){if(!document.createElement){return null}if(this.divStyle==null){this.divStyle=document.createElement("div").style}if(typeof this.divStyle=="undefined"){return null}for(var B in A){if(typeof this.divStyle[A[B]]!="undefined"){return true}}return false},testPropsAll:function(B){var C=B.charAt(0).toUpperCase()+B.substr(1),A=(B+" "+this.cssPrfxs.join(C+" ")+C).split(" ");return this.testProps(A)},testPrexifes:function(D,E){var B=E.charAt(0).toUpperCase()+E.substr(1);for(var C=-1,A=this.fncPrfxs.length;++C1){this.fncPrfxs=[this.fncPrfxs[C]];this.cssPrfxs=[this.cssPrfxs[C]]}return true}}return !!D[E]},isEventSupported:function(A,D){if(!document.createElement){return false}var C,B;C=document.createElement(D);A="on"+A;B=A in C;if(!B){if(!C.setAttribute){C=document.createElement("div")}if(!!C.setAttribute&&!!C.removeAttribute){C.setAttribute(A,"");B=(typeof C[A]=="function")}}return B},discoverMediaQueryValue:function(B,D){if(typeof window.matchMedia=="undefined"){return null}for(var C in D){var A=window.matchMedia("("+B+":"+D[C]+")");if(A.matches){return D[C]+""}}return null},orientationEventTest:function(A){var C=this;if(!!window.addEventListener&&!!window.removeEventListener){var B=function(D){if(D!=null&&D.alpha!=null){A["js.deviceOrientation"]=true;C.exposeProperty("js.deviceOrientation",true);C.propsCache=C.encodeProperties(A);C.setCookie(C.propsCache)}window.removeEventListener("deviceorientation",B,false)};window.addEventListener("deviceorientation",B,false)}},exposeProperties:function(){var C={},A;for(var B in this.properties){A=this.properties[B]();if(A==null||typeof A=="undefined"){continue}this.exposeProperty(B,A);C[B]=A}return C},exposeProperty:function(C,A){var B;if(C.indexOf(".")!=-1){B=C.split(".");if(typeof this[B[0]]=="undefined"){this[B[0]]={}}this[B[0]][B[1]]=A}else{this[C]=A}},getPropertyType:function(A,B){if(typeof B=="boolean"){return"b"}else{if(typeof B=="number"){return"i"}else{return"s"}}},setCookie:function(B){var A=new Date();A.setDate(A.getDate()+this.cookieExpiryDays);var C="";if(this.cookieDomain!=null){C=";domain="+this.cookieDomain}document.cookie=this.cookieName+'="'+B+'";expires='+A.toUTCString()+";path="+this.cookiePath+C},encodeProperties:function(D){var A="",C;for(var B in D){C=this.getPropertyType(B,D[B]);A+=C+B+":"+((C=="b")?D[B]+0:D[B])+"|"}return A.slice(0,-1)},getPropertiesAsString:function(){return this.propsCache},run:function(){var A=this.exposeProperties();this.propsCache=this.encodeProperties(A);if(A.cookieSupport){this.setCookie(this.propsCache)}this.orientationEventTest(A)}};DeviceAtlas.run();