var detector = {
	hasWebAudio: !1,
	hasWebGL: !1,
	hasBrowser: !1,
	isDesktop: !1,
	browsername: "unknown",
	isuptodate: !1,
	tested: !1,
	get_browser_version: function() {
		var e, t = navigator.appName,
			s = navigator.userAgent,
			r = s.match(/(opera|chrome|safari|firefox|msie)\/?\s*(\.?\d+(\.\d+)*)/i);
		return r && null != (e = s.match(/version\/([\.\d]+)/i)) && (r[2] = e[1]), r = r ? [r[1], r[2]] : [t, navigator.appVersion, "-?"], r[1]
	},
	testDesktop: function() {
		var e = navigator.appVersion.indexOf("Mobile");
		return !(e > -1)
	},
	testBrowser: function() {
		var e = "undefined" != typeof InstallTrigger,
			t = Object.prototype.toString.call(window.HTMLElement).indexOf("Constructor") > 0,
			s = navigator.userAgent.toLowerCase().indexOf("chrome") > -1;
		s && (this.browsername = "chrome"), e && (this.browsername = "firefox"), t && (this.browsername = "safari");
		var r = this.get_browser_version().split(".")[0];
		return this.browsername += " " + r + " (" + this.get_browser_version() + ")", e && r >= 27 && (this.isuptodate = !0), s && r >= 32 && (this.isuptodate = !0), t && r >= 6 && (this.isuptodate = !0), e || t || s
	},
	testWebAudio: function() {
		return "undefined" != typeof webkitAudioContext ? !0 : "undefined" != typeof AudioContext ? !0 : !1
	},
	testWebGL: function() {
		if (!window.WebGLRenderingContext) return !1;
		var e = document.createElement("canvas"),
			t = e.getContext("webgl") || e.getContext("experimental-webgl");
		return t ? !0 : !1
	},
	detect: function() {
		this.tested = !0, this.hasBrowser = this.testBrowser(), this.hasWebGL = this.testWebGL(), this.hasWebAudio = this.testWebAudio(), this.isDesktop = this.testDesktop()
	},
	allowedZoetrope: function() {
		return this.tested || this.detect(), this.hasWebAudio && this.hasWebGL && this.hasBrowser && this.isDesktop && this.isuptodate ? !0 : !1
	},
	getWarning: function() {
		var e = "";
		return this.allowedZoetrope() ? (e += "<h2>Your browser can show the full experience</h2>", e += '<h3>click <a href="../index.html">here</a> to see the 3d Zoetrope!</h3>') : this.isDesktop ? this.hasBrowser && !this.isuptodate ? (e += "<h2>Your browser is not up-to-date</h2>", e += "<h3>To get the full experience, please update your Browser to the Newest Version and try again.</h3>") : this.hasWebGL ? (e += "<h2>Your browser cannot show the Nike Zoetrope</h2>", e += "<h3>To get the full experience, please download a newer browser, like Chrome, Safari or Firefox. Your browser needs to support WebGL and WebAudio technologies.</h3>") : (e += "<h2>Your browser can not display WebGL Content</h2>", e += "<h3>Please enable WebGL in your browser.</h3>") : (e += "<h2>Your mobile device cannot show the Nike Zoetrope</h2>", e += "<h3>To get the full experience, use a desktop machine with an uptodate browser!</h3>")
	},
	print: function() {
		$("#result").append("<hr/>"), $("#result").append("<br/> has webaudio: " + this.hasWebAudio), $("#result").append("<br/> has web GL: " + this.hasWebGL), $("#result").append("<br/> browser is ok: " + this.hasBrowser + " (" + this.browsername + ")"), $("#result").append("<br/> is desktop: " + this.isDesktop), $("#result").append("<br/> browser is up-to-date: " + this.isuptodate), this.allowedZoetrope() ? $("#result").append("<h2>YES, 3D ZOETROPE FOR YOU!</h2>") : $("#result").append("<h2>NOPE, FALLBACK SITE FOR YOU</h2>"), $("#result").append("<hr/>")
	}
};