/* Copyright (C) YOOtheme GmbH, YOOtheme Proprietary Use License (http://www.yootheme.com/license) */

(function(b,f,g){function d(h){e.innerHTML='&shy;<style media="'+h+'"> #mq-test-1 { width: 42px; }</style>';a.insertBefore(j,m);l=42==e.offsetWidth;a.removeChild(j);return l}function k(h){var a=d(h.media);if(h._listeners&&h.matches!=a){h.matches=a;for(var a=0,c=h._listeners.length;a<c;a++)h._listeners[a](h)}}function c(a,c,d){var b;return function(){var f=this,g=arguments,e=d&&!b;clearTimeout(b);b=setTimeout(function(){b=null;d||a.apply(f,g)},c);e&&a.apply(f,g)}}if(!f.matchMedia||b.userAgent.match(/(iPhone|iPod|iPad)/i)){var l,
a=g.documentElement,m=a.firstElementChild||a.firstChild,j=g.createElement("body"),e=g.createElement("div");e.id="mq-test-1";e.style.cssText="position:absolute;top:-100em";j.style.background="none";j.appendChild(e);f.matchMedia=function(a){var b,e=[];b={matches:d(a),media:a,_listeners:e,addListener:function(a){"function"===typeof a&&e.push(a)},removeListener:function(a){for(var b=0,c=e.length;b<c;b++)e[b]===a&&delete e[b]}};f.addEventListener&&f.addEventListener("resize",c(function(){k(b)},150),!1);
g.addEventListener&&g.addEventListener("orientationchange",function(){k(b)},!1);return b}}})(navigator,window,document);
(function(b,f,g){if(!b.onMediaQuery){var d={},k=f.matchMedia&&f.matchMedia("only all").matches;b(g).ready(function(){for(var c in d)b(d[c]).trigger("init"),d[c].matches&&b(d[c]).trigger("valid")});b(f).bind("load",function(){for(var c in d)d[c].matches&&b(d[c]).trigger("valid")});b.onMediaQuery=function(c,g){var a=c&&d[c];a||(a=d[c]=f.matchMedia(c),a.supported=k,a.addListener(function(){b(a).trigger(a.matches?"valid":"invalid")}));b(a).bind(g);return a}}})(jQuery,window,document);
