﻿/**
Head JS		The only script in your <HEAD>
Copyright	Tero Piirainen (tipiirai)
License		MIT / http://bit.ly/mit-license
Version		0.8
	
http://headjs.com
*/
(function(a) { var b = a.documentElement, c = { screens: [320, 480, 640, 768, 1024, 1280, 1440, 1680, 1920], section: "-section", page: "-page", head: "head" }, d = []; if (window.head_conf) for (var e in head_conf) head_conf[e] && (c[e] = head_conf[e]); function f(a) { d.push(a) } function g(a) { var c = new RegExp("\\b" + a + "\\b"); b.className = b.className.replace(c, "") } function h(a, b) { for (var c = 0; c < a.length; c++) b.call(a, a[c], c) } var i = window[c.head] = function() { i.ready.apply(null, arguments) }; i.feature = function(a, c, e) { { if (a) { Object.prototype.toString.call(c) == "[object Function]" && (c = c.call()), f((c ? "" : "no-") + a), i[a] = !!c, e || (g("no-" + a), g(a), i.feature()); return i } b.className += " " + d.join(" "), d = [] } }; var j = navigator.userAgent.toLowerCase(); j = /(webkit)[ \/]([\w.]+)/.exec(j) || /(opera)(?:.*version)?[ \/]([\w.]+)/.exec(j) || /(msie) ([\w.]+)/.exec(j) || !/compatible/.test(j) && /(mozilla)(?:.*? rv:([\w.]+))?/.exec(j) || [], j[1] == "msie" && (j[1] = "ie"), f(j[1]), i.browser = { version: j[2] }, i.browser[j[1]] = true; if (i.browser.ie) for (var k = 3; k < 11; k++) parseFloat(j[2]) < k && f("lt-ie" + k); h("abbr|article|aside|audio|canvas|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video".split("|"), function(b) { a.createElement(b) }), h(location.pathname.split("/"), function(a, d) { if (this.length > 2 && this[d + 1] !== undefined) d && f(this.slice(1, d + 1).join("-") + c.section); else { var e = a || "index", g = e.indexOf("."); g > 0 && (e = e.substring(0, g)), b.id = e + c.page, d || f("root" + c.section) } }); function l() { var a = window.outerWidth || b.clientWidth; b.className = b.className.replace(/ (w|lt)-\d+/g, ""), f("w-" + Math.round(a / 100) * 100), h(c.screens, function(b) { a <= b && f("lt-" + b) }), i.feature() } l(), window.onresize = l, i.feature("js", true).feature() })(document), function() { var a = document.createElement("i"), b = a.style, c = " -o- -moz- -ms- -webkit- -khtml- ".split(" "), d = "Webkit Moz O ms Khtml".split(" "), e = window.head_conf && head_conf.head || "head", f = window[e]; function g(a) { for (var c in a) if (b[a[c]] !== undefined) return true } function h(a) { var b = a.charAt(0).toUpperCase() + a.substr(1), c = (a + " " + d.join(b + " ") + b).split(" "); return !!g(c) } var i = { gradient: function() { var a = "background-image:", d = "gradient(linear,left top,right bottom,from(#9f9),to(#fff));", e = "linear-gradient(left top,#eee,#fff);"; b.cssText = (a + c.join(d + a) + c.join(e + a)).slice(0, -a.length); return !!b.backgroundImage }, rgba: function() { b.cssText = "background-color:rgba(0,0,0,0.5)"; return !!b.backgroundColor }, opacity: function() { return a.style.opacity === "" }, textshadow: function() { return b.textShadow === "" }, multiplebgs: function() { b.cssText = "background:url(//:),url(//:),red url(//:)"; return (new RegExp("(url\\s*\\(.*?){3}")).test(b.background) }, boxshadow: function() { return h("boxShadow") }, borderimage: function() { return h("borderImage") }, borderradius: function() { return h("borderRadius") }, reflections: function() { return h("boxReflect") }, transforms: function() { return h("transform") }, transitions: function() { return h("transition") } }; for (var j in i) i[j] && f.feature(j, i[j].call(), true); f.feature() } (), function(a) { var b = a.documentElement, c = navigator.userAgent.toLowerCase().indexOf("msie") != -1, d = false, e = [], f = {}, g = {}, h = a.createElement("script").async === true || "MozAppearance" in a.documentElement.style || window.opera; var i = window.head_conf && head_conf.head || "head", j = window[i] = window[i] || function() { j.ready.apply(null, arguments) }; var k = 0, l = 1, m = 2, n = 3; h ? j.js = function() { var a = arguments, b = a[a.length - 1], c = []; r(b) || (b = null), q(a, function(d, e) { d != b && (d = p(d), c.push(d), u(d, b && e == a.length - 2 ? function() { var a = true; q(c, function(b) { b.state != n && (a = false) }), a && b() } : null)) }); return j } : j.js = function() { var a = arguments, b = [].slice.call(a, 1), c = b[0]; if (!d) { e.push(function() { j.js.apply(null, a) }); return j } c ? (q(b, function(a) { r(a) || t(p(a)) }), u(p(a[0]), r(c) ? c : function() { j.js.apply(null, b) })) : u(p(a[0])); return j }, j.ready = function(a, b) { var c = g[a]; if (c && c.state == n) { b.call(); return j } r(a) && (b = a, a = "ALL"); var d = f[a]; d ? d.push(b) : d = f[a] = [b]; return j }; function o(a) { var b = a.split("/"), c = b[b.length - 1], d = c.indexOf("?"); return d != -1 ? c.substring(0, d) : c } function p(a) { var b; if (typeof a == "object") for (var c in a) a[c] && (b = { name: c, url: a[c] }); else b = { name: o(a), url: a }; var d = g[b.name]; if (d) return d; for (var e in g) if (g[e].url == b.url) return g[e]; g[b.name] = b; return b } function q(a, b) { if (a) { typeof a == "object" && (a = [].slice.call(a)); for (var c = 0; c < a.length; c++) b.call(a, a[c], c) } } function r(a) { return Object.prototype.toString.call(a) == "[object Function]" } function s(a) { a.state = k, q(a.onpreload, function(a) { a.call() }) } function t(a, b) { a.state || (a.state = l, a.onpreload = [], v({ src: a.url, type: "cache" }, function() { s(a) })) } function u(a, b) { if (a.state == n && b) return b(); if (a.state == m) return j.ready(a.name, b); if (a.state == l) return a.onpreload.push(function() { u(a, b) }); a.state = m, v(a.url, function() { a.state = n, b && b(), q(f[a.name], function(a) { a.call() }); var c = true; for (var d in g) g[d].state != n && (c = false); c && q(f.ALL, function(a) { a.done || a.call(), a.done = true }) }) } function v(c, d) { var e = a.createElement("script"); e.type = "text/" + (c.type || "javascript"), e.src = c.src || c, e.async = false, e.onreadystatechange = e.onload = function() { var a = e.readyState; !d.done && (!a || /loaded|complete/.test(a)) && (d(), d.done = true) }, b.appendChild(e) } setTimeout(function() { d = true, q(e, function(a) { a.call() }) }, 200), !a.readyState && a.addEventListener && (a.readyState = "loading", a.addEventListener("DOMContentLoaded", handler = function() { a.removeEventListener("DOMContentLoaded", handler, false), a.readyState = "complete" }, false)) } (document)
