/* Copyright (C) YOOtheme GmbH, http://www.gnu.org/licenses/gpl.html GNU/GPL */

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