(function($){
})(jQuery);
var _CRP_LAST_GENERATED_ID=100000;
function crp_generateId(){
return "tmpid_" + (++_CRP_LAST_GENERATED_ID).toString();
}
function crp_showSpinner(){
jQuery("#crp-spinner").css('display', 'block');
jQuery("#crp-spinner-background").css('display', 'block');
}
function crp_hideSpinner(){
setTimeout(function(){
jQuery("#crp-spinner").css('display', 'none');
jQuery("#crp-spinner-background").css('display', 'none');
}, 1000);
}
function crp_openMediaUploader(callback, multipleSelection){
'use strict';
multipleSelection=typeof multipleSelection!=='undefined' ? multipleSelection:false;
var uploader, imgData, json;
if(undefined!==uploader){
uploader.open();
return;
}
uploader=wp.media.frames.file_frame=wp.media({
frame: 'post',
state: 'insert',
multiple: multipleSelection
});
uploader.on('insert', function(){
var selections=uploader.state().get('selection').toJSON();
var picInfos=[];
for(var sIdx=0; sIdx < selections.length; sIdx++){
var json=selections[sIdx];
if(0 > jQuery.trim(json.url.length)){
continue;
}
var picInfo={};
picInfo.id=json.id;
picInfo.src=json.sizes.full.url;
if(json.sizes.medium){
picInfo.src=json.sizes.medium.url;
}
picInfos.push(picInfo);
}
if(multipleSelection){
callback(picInfos);
}else{
callback(picInfos.length > 0 ? picInfos[0]:null);
}});
uploader.open();
}
function crp_isJSArray(obj){
return (Object.prototype.toString.call(obj)==='[object Array]')
}
function crp_truncateIfNeeded(text, maxLength){
if(text){
if(text.length > 3&&text.length > maxLength - 3){
text=text.substring(0,maxLength - 3);
text +="..."
}}
return text;
}
function crp_loadHref(href, blank){
if(!blank){
window.location.href=href;
}else{
window.open(href, '_blank');
}}
function crp_mgfCloseButtonMarkup(){
var html="";
html +=""
return html;
}
var CrpBase64={
_keyStr:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",
encode:function (input){
var output="";
var chr1, chr2, chr3, enc1, enc2, enc3, enc4;
var i=0;
if(!input) return output;
input=CrpBase64._utf8_encode(input);
while (i < input.length){
chr1=input.charCodeAt(i++);
chr2=input.charCodeAt(i++);
chr3=input.charCodeAt(i++);
enc1=chr1 >> 2;
enc2=((chr1 & 3) << 4) | (chr2 >> 4);
enc3=((chr2 & 15) << 2) | (chr3 >> 6);
enc4=chr3 & 63;
if(isNaN(chr2)){
enc3=enc4=64;
}else if(isNaN(chr3)){
enc4=64;
}
output=output +
this._keyStr.charAt(enc1) + this._keyStr.charAt(enc2) +
this._keyStr.charAt(enc3) + this._keyStr.charAt(enc4);
}
return output;
},
decode:function (input){
var output="";
var chr1, chr2, chr3;
var enc1, enc2, enc3, enc4;
var i=0;
if(!input) return output;
input=input.replace(/[^A-Za-z0-9\+\/\=]/g, "");
while (i < input.length){
enc1=this._keyStr.indexOf(input.charAt(i++));
enc2=this._keyStr.indexOf(input.charAt(i++));
enc3=this._keyStr.indexOf(input.charAt(i++));
enc4=this._keyStr.indexOf(input.charAt(i++));
chr1=(enc1 << 2) | (enc2 >> 4);
chr2=((enc2 & 15) << 4) | (enc3 >> 2);
chr3=((enc3 & 3) << 6) | enc4;
output=output + String.fromCharCode(chr1);
if(enc3!=64){
output=output + String.fromCharCode(chr2);
}
if(enc4!=64){
output=output + String.fromCharCode(chr3);
}}
output=CrpBase64._utf8_decode(output);
return output;
},
_utf8_encode:function (string){
string=string.replace(/\r\n/g,"\n");
var utftext="";
for (var n=0; n < string.length; n++){
var c=string.charCodeAt(n);
if(c < 128){
utftext +=String.fromCharCode(c);
}
else if((c > 127)&&(c < 2048)){
utftext +=String.fromCharCode((c >> 6) | 192);
utftext +=String.fromCharCode((c & 63) | 128);
}else{
utftext +=String.fromCharCode((c >> 12) | 224);
utftext +=String.fromCharCode(((c >> 6) & 63) | 128);
utftext +=String.fromCharCode((c & 63) | 128);
}}
return utftext;
},
_utf8_decode:function (utftext){
var string="";
var i=0;
var c=c1=c2=0;
while(i < utftext.length){
c=utftext.charCodeAt(i);
if(c < 128){
string +=String.fromCharCode(c);
i++;
}
else if((c > 191)&&(c < 224)){
c2=utftext.charCodeAt(i+1);
string +=String.fromCharCode(((c & 31) << 6) | (c2 & 63));
i +=2;
}else{
c2=utftext.charCodeAt(i+1);
c3=utftext.charCodeAt(i+2);
string +=String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
i +=3;
}}
return string;
}};
;window.Modernizr=function(a,b,c){function D(a){j.cssText=a}function E(a,b){return D(n.join(a+";")+(b||""))}function F(a,b){return typeof a===b}function G(a,b){return!!~(""+a).indexOf(b)}function H(a,b){for(var d in a){var e=a[d];if(!G(e,"-")&&j[e]!==c)return b=="pfx"?e:!0}return!1}function I(a,b,d){for(var e in a){var f=b[a[e]];if(f!==c)return d===!1?a[e]:F(f,"function")?f.bind(d||b):f}return!1}function J(a,b,c){var d=a.charAt(0).toUpperCase()+a.slice(1),e=(a+" "+p.join(d+" ")+d).split(" ");return F(b,"string")||F(b,"undefined")?H(e,b):(e=(a+" "+q.join(d+" ")+d).split(" "),I(e,b,c))}function K(){e.input=function(c){for(var d=0,e=c.length;d',a,""].join(""),l.id=h,(m?l:n).innerHTML+=f,n.appendChild(l),m||(n.style.background="",n.style.overflow="hidden",k=g.style.overflow,g.style.overflow="hidden",g.appendChild(n)),i=c(l,a),m?l.parentNode.removeChild(l):(n.parentNode.removeChild(n),g.style.overflow=k),!!i},z=function(b){var c=a.matchMedia||a.msMatchMedia;if(c)return c(b).matches;var d;return y("@media "+b+" { #"+h+" { position: absolute; }}",function(b){d=(a.getComputedStyle?getComputedStyle(b,null):b.currentStyle)["position"]=="absolute"}),d},A=function(){function d(d,e){e=e||b.createElement(a[d]||"div"),d="on"+d;var f=d in e;return f||(e.setAttribute||(e=b.createElement("div")),e.setAttribute&&e.removeAttribute&&(e.setAttribute(d,""),f=F(e[d],"function"),F(e[d],"undefined")||(e[d]=c),e.removeAttribute(d))),e=null,f}var a={select:"input",change:"input",submit:"form",reset:"form",error:"img",load:"img",abort:"img"};return d}(),B={}.hasOwnProperty,C;!F(B,"undefined")&&!F(B.call,"undefined")?C=function(a,b){return B.call(a,b)}:C=function(a,b){return b in a&&F(a.constructor.prototype[b],"undefined")},Function.prototype.bind||(Function.prototype.bind=function(b){var c=this;if(typeof c!="function")throw new TypeError;var d=w.call(arguments,1),e=function(){if(this instanceof e){var a=function(){};a.prototype=c.prototype;var f=new a,g=c.apply(f,d.concat(w.call(arguments)));return Object(g)===g?g:f}return c.apply(b,d.concat(w.call(arguments)))};return e}),s.flexbox=function(){return J("flexWrap")},s.canvas=function(){var a=b.createElement("canvas");return!!a.getContext&&!!a.getContext("2d")},s.canvastext=function(){return!!e.canvas&&!!F(b.createElement("canvas").getContext("2d").fillText,"function")},s.webgl=function(){return!!a.WebGLRenderingContext},s.touch=function(){var c;return"ontouchstart"in a||a.DocumentTouch&&b instanceof DocumentTouch?c=!0:y(["@media (",n.join("touch-enabled),("),h,")","{#modernizr{top:9px;position:absolute}}"].join(""),function(a){c=a.offsetTop===9}),c},s.geolocation=function(){return"geolocation"in navigator},s.postmessage=function(){return!!a.postMessage},s.websqldatabase=function(){return!!a.openDatabase},s.indexedDB=function(){return!!J("indexedDB",a)},s.hashchange=function(){return A("hashchange",a)&&(b.documentMode===c||b.documentMode>7)},s.history=function(){return!!a.history&&!!history.pushState},s.draganddrop=function(){var a=b.createElement("div");return"draggable"in a||"ondragstart"in a&&"ondrop"in a},s.websockets=function(){return"WebSocket"in a||"MozWebSocket"in a},s.rgba=function(){return D("background-color:rgba(150,255,150,.5)"),G(j.backgroundColor,"rgba")},s.hsla=function(){return D("background-color:hsla(120,40%,100%,.5)"),G(j.backgroundColor,"rgba")||G(j.backgroundColor,"hsla")},s.multiplebgs=function(){return D("background:url(https://),url(https://),red url(https://)"),/(url\s*\(.*?){3}/.test(j.background)},s.backgroundsize=function(){return J("backgroundSize")},s.borderimage=function(){return J("borderImage")},s.borderradius=function(){return J("borderRadius")},s.boxshadow=function(){return J("boxShadow")},s.textshadow=function(){return b.createElement("div").style.textShadow===""},s.opacity=function(){return E("opacity:.55"),/^0.55$/.test(j.opacity)},s.cssanimations=function(){return J("animationName")},s.csscolumns=function(){return J("columnCount")},s.cssgradients=function(){var a="background-image:",b="gradient(linear,left top,right bottom,from(#9f9),to(white));",c="linear-gradient(left top,#9f9, white);";return D((a+"-webkit- ".split(" ").join(b+a)+n.join(c+a)).slice(0,-a.length)),G(j.backgroundImage,"gradient")},s.cssreflections=function(){return J("boxReflect")},s.csstransforms=function(){return!!J("transform")},s.csstransforms3d=function(){var a=!!J("perspective");return a&&"webkitPerspective"in g.style&&y("@media (transform-3d),(-webkit-transform-3d){#modernizr{left:9px;position:absolute;height:3px;}}",function(b,c){a=b.offsetLeft===9&&b.offsetHeight===3}),a},s.csstransitions=function(){return J("transition")},s.fontface=function(){var a;return y('@font-face {font-family:"font";src:url("https://")}',function(c,d){var e=b.getElementById("smodernizr"),f=e.sheet||e.styleSheet,g=f?f.cssRules&&f.cssRules[0]?f.cssRules[0].cssText:f.cssText||"":"";a=/src/i.test(g)&&g.indexOf(d.split(" ")[0])===0}),a},s.generatedcontent=function(){var a;return y(["#",h,"{font:0/0 a}#",h,':after{content:"',l,'";visibility:hidden;font:3px/1 a}'].join(""),function(b){a=b.offsetHeight>=3}),a},s.video=function(){var a=b.createElement("video"),c=!1;try{if(c=!!a.canPlayType)c=new Boolean(c),c.ogg=a.canPlayType('video/ogg; codecs="theora"').replace(/^no$/,""),c.h264=a.canPlayType('video/mp4; codecs="avc1.42E01E"').replace(/^no$/,""),c.webm=a.canPlayType('video/webm; codecs="vp8, vorbis"').replace(/^no$/,"")}catch(d){}return c},s.audio=function(){var a=b.createElement("audio"),c=!1;try{if(c=!!a.canPlayType)c=new Boolean(c),c.ogg=a.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/,""),c.mp3=a.canPlayType("audio/mpeg;").replace(/^no$/,""),c.wav=a.canPlayType('audio/wav; codecs="1"').replace(/^no$/,""),c.m4a=(a.canPlayType("audio/x-m4a;")||a.canPlayType("audio/aac;")).replace(/^no$/,"")}catch(d){}return c},s.localstorage=function(){try{return localStorage.setItem(h,h),localStorage.removeItem(h),!0}catch(a){return!1}},s.sessionstorage=function(){try{return sessionStorage.setItem(h,h),sessionStorage.removeItem(h),!0}catch(a){return!1}},s.webworkers=function(){return!!a.Worker},s.applicationcache=function(){return!!a.applicationCache},s.svg=function(){return!!b.createElementNS&&!!b.createElementNS(r.svg,"svg").createSVGRect},s.inlinesvg=function(){var a=b.createElement("div");return a.innerHTML="",(a.firstChild&&a.firstChild.namespaceURI)==r.svg},s.smil=function(){return!!b.createElementNS&&/SVGAnimate/.test(m.call(b.createElementNS(r.svg,"animate")))},s.svgclippaths=function(){return!!b.createElementNS&&/SVGClipPath/.test(m.call(b.createElementNS(r.svg,"clipPath")))};for(var L in s)C(s,L)&&(x=L.toLowerCase(),e[x]=s[L](),v.push((e[x]?"":"no-")+x));return e.input||K(),e.addTest=function(a,b){if(typeof a=="object")for(var d in a)C(a,d)&&e.addTest(d,a[d]);else{a=a.toLowerCase();if(e[a]!==c)return e;b=typeof b=="function"?b():b,typeof f!="undefined"&&f&&(g.className+=" "+(b?"":"no-")+a),e[a]=b}return e},D(""),i=k=null,function(a,b){function k(a,b){var c=a.createElement("p"),d=a.getElementsByTagName("head")[0]||a.documentElement;return c.innerHTML="x",d.insertBefore(c.lastChild,d.firstChild)}function l(){var a=r.elements;return typeof a=="string"?a.split(" "):a}function m(a){var b=i[a[g]];return b||(b={},h++,a[g]=h,i[h]=b),b}function n(a,c,f){c||(c=b);if(j)return c.createElement(a);f||(f=m(c));var g;return f.cache[a]?g=f.cache[a].cloneNode():e.test(a)?g=(f.cache[a]=f.createElem(a)).cloneNode():g=f.createElem(a),g.canHaveChildren&&!d.test(a)?f.frag.appendChild(g):g}function o(a,c){a||(a=b);if(j)return a.createDocumentFragment();c=c||m(a);var d=c.frag.cloneNode(),e=0,f=l(),g=f.length;for(;e",f="hidden"in a,j=a.childNodes.length==1||function(){b.createElement("a");var a=b.createDocumentFragment();return typeof a.cloneNode=="undefined"||typeof a.createDocumentFragment=="undefined"||typeof a.createElement=="undefined"}()}catch(c){f=!0,j=!0}})();var r={elements:c.elements||"abbr article aside audio bdi canvas data datalist details figcaption figure footer header hgroup mark meter nav output progress section summary time video",shivCSS:c.shivCSS!==!1,supportsUnknownElements:j,shivMethods:c.shivMethods!==!1,type:"default",shivDocument:q,createElement:n,createDocumentFragment:o};a.html5=r,q(b)}(this,b),e._version=d,e._prefixes=n,e._domPrefixes=q,e._cssomPrefixes=p,e.mq=z,e.hasEvent=A,e.testProp=function(a){return H([a])},e.testAllProps=J,e.testStyles=y,e.prefixed=function(a,b,c){return b?J(a,b,c):J(a,"pfx")},g.className=g.className.replace(/(^|\s)no-js(\s|$)/,"$1$2")+(f?" js "+v.join(" "):""),e}(this,this.document),function(a,b,c){function d(a){return"[object Function]"==o.call(a)}function e(a){return"string"==typeof a}function f(){}function g(a){return!a||"loaded"==a||"complete"==a||"uninitialized"==a}function h(){var a=p.shift();q=1,a?a.t?m(function(){("c"==a.t?B.injectCss:B.injectJs)(a.s,0,a.a,a.x,a.e,1)},0):(a(),h()):q=0}function i(a,c,d,e,f,i,j){function k(b){if(!o&&g(l.readyState)&&(u.r=o=1,!q&&h(),l.onload=l.onreadystatechange=null,b)){"img"!=a&&m(function(){t.removeChild(l)},50);for(var d in y[c])y[c].hasOwnProperty(d)&&y[c][d].onload()}}var j=j||B.errorTimeout,l=b.createElement(a),o=0,r=0,u={t:d,s:c,e:f,a:i,x:j};1===y[c]&&(r=1,y[c]=[]),"object"==a?l.data=c:(l.src=c,l.type=a),l.width=l.height="0",l.onerror=l.onload=l.onreadystatechange=function(){k.call(this,r)},p.splice(e,0,u),"img"!=a&&(r||2===y[c]?(t.insertBefore(l,s?null:n),m(k,j)):y[c].push(l))}function j(a,b,c,d,f){return q=0,b=b||"j",e(a)?i("c"==b?v:u,a,b,this.i++,c,d,f):(p.splice(this.i++,0,a),1==p.length&&h()),this}function k(){var a=B;return a.loader={load:j,i:0},a}var l=b.documentElement,m=a.setTimeout,n=b.getElementsByTagName("script")[0],o={}.toString,p=[],q=0,r="MozAppearance"in l.style,s=r&&!!b.createRange().compareNode,t=s?l:n.parentNode,l=a.opera&&"[object Opera]"==o.call(a.opera),l=!!b.attachEvent&&!l,u=r?"object":l?"script":"img",v=l?"script":u,w=Array.isArray||function(a){return"[object Array]"==o.call(a)},x=[],y={},z={timeout:function(a,b){return b.length&&(a.timeout=b[0]),a}},A,B;B=function(a){function b(a){var a=a.split("!"),b=x.length,c=a.pop(),d=a.length,c={url:c,origUrl:c,prefixes:a},e,f,g;for(f=0;f _wrapperWidth - plugin.settings.margin){
_slotWidth=_wrapperWidth - plugin.settings.margin;
}
var _itemsPerRow=parseInt(_wrapperWidth / _slotWidth);
var _delta=_wrapperWidth - _itemsPerRow * _slotWidth;
var _deltaPerCell=Math.floor(_delta / _itemsPerRow);
_slotWidth +=_deltaPerCell;
sW=_slotWidth;
var _ratio=plugin.settings.approxTileHeight / plugin.settings.approxTileWidth;
if(plugin.settings.layoutType==CRPTiledLayerType.Masonry){
_ratio=height / width;
}
sH=Math.ceil(sW * _ratio);
}else{
var _wrapperWidth=$element.width() + plugin.settings.margin;
var step=parseInt(_wrapperWidth / 4);
var ratios=[
{w: 1, h:1},
{w: 2, h:2},
];
var ratio=ratios[(Math.floor(Math.random() * (ratios.length - 0)) + 0)];
sW=ratio.w * step;
sH=ratio.h * step;
}
var newsH=sH;
if(plugin.settings.addBlock1Height!=false){
newsH +=plugin.settings.addBlock1Height;
}
if(plugin.settings.addBlock2Height!=false){
newsH +=plugin.settings.addBlock2Height;
}
var slot=new Slot(sW, newsH);
var av_blocks=0;
var free_cell=0;
var line=0;
if(this.slots.length==0){
av_blocks=this.hor_size;
slot.position.x=0;
slot.position.y=0;
}else{
var exit=false;
for (; free_cell < this.cells.length; free_cell++){
if(this.cells[free_cell]==0){
line=Math.floor(free_cell / this.hor_size);
var line_end=(line + 1) * this.hor_size;
av_blocks=0;
for (var k=0; k <=line_end - free_cell; k++){
av_blocks=k;
if(this.cells[free_cell + k]==1){
break;
}}
break;
}}
}
if(av_blocks < slot.blocks.h){
slot.resize(av_blocks);
}else{
var free_on_right=this.count_free_cells_on_right(free_cell + slot.blocks.h);
if(free_on_right - plugin.settings.margin < this.min_tile_width &&
free_on_right > 0){
slot.resize(av_blocks, !allowEnlargement);
slot.enlarged=true;
}
if(free_on_right==0)
slot.edge_right=true;
}
slot.position.x=free_cell % this.hor_size;
slot.position.y=Math.floor(free_cell / this.hor_size);
this.add_slot(slot);
return slot;
}
var defaults={
layoutType: CRPTiledLayerType.Square,
approxTileWidth: 200,
approxTileHeight: 200,
minTileWidth: 200,
margin: 10,
addBlock1Height: false,
addBlock2Height: false,
allowEnlargement: false,
onComplete: function (){ },
onUpdate: function (){ },
}
var plugin=this;
var grid=null;
var maxHeight=0;
plugin.settings={}
var $element=$(element),
element=element;
var currentWidth=$element.width();
var completed=false;
var busy=false;
var tilesForFilter=function(ft){
$tiles=$element.find(".tile");
return $tiles;
}
var doFiltration=function(){
busy=true;
var $tiles=tilesForFilter(null);
maxHeight=0;
grid=null;
$tiles.css({visibility: 'invisible'});
entile($tiles);
$tiles.css({visibility: 'visible'});
busy=false;
}
plugin.init=function (){
plugin.settings=$.extend({}, defaults, options);
$element.find(".ftg-items").css({
position: "relative",
minWidth: plugin.settings.minTileWidth,
});
var $tiles=$element.find(".tile");
styleTiles($tiles);
assignImagesSize($tiles);
var category=window.location.hash;
if(category!=''&&category!='#'){
var current=jQuery(".ftg-filters a[href='" + category + "']");
if(current.length!=0){
jQuery("a", current.closest(".ftg-filters")).removeClass('selected');
current.addClass('selected');
}}
doFiltration();
$(window).resize(function (){
if(busy) return;
if(currentWidth!=$element.width()){
busy=true;
currentWidth=$element.width();
resTo=setTimeout(function (){
grid=null;
maxHeight=0;
var $filteredTiles=tilesForFilter(null);
entile($filteredTiles);
busy=false;
}, 700);
}});
}
var styleTiles=function ($tiles){
$tiles.css({
position: "absolute",
visibility: 'hidden',
});
$tiles.find('.tile-inner').css({
position: "relative",
display: "block",
overflow: "hidden",
});
$tiles.find('.crp-item').css({
position: "relative",
display: "block",
fontSize: 10,
maxWidth: "9999em",
});
}
var assignImagesSize=function ($tiles){
$tiles.each(function (){
var $item=$(this).find(".crp-item");
var size={
width: $item.data("width"),
height: $item.data("height")
};
$item.data("size", size);
});
}
var entile=function ($tiles){
if(!grid)
grid=new Grid(plugin.settings.margin, plugin.settings.minTileWidth, $element.width() + plugin.settings.margin);
$tiles.each(function (){
if($(this).hasClass("ftg-hidden"))
return;
var size=$(this).find(".crp-item").data("size");
var slot=grid.insert(size.width + plugin.settings.margin,
size.height + plugin.settings.margin,
plugin.settings.allowEnlargement);
$(this).data("enlarged", slot.enlarged);
var top=slot.position.y;
var height=slot.blocks.v;
var tileWidth=slot.blocks.h - plugin.settings.margin;
var tileHeight=slot.blocks.v - plugin.settings.margin;
if(top + tileHeight > maxHeight)
maxHeight=top + height + plugin.settings.margin;
if(plugin.settings.addBlock1Height!=false){
tileHeight -=plugin.settings.addBlock1Height;
}
if(plugin.settings.addBlock2Height!=false){
tileHeight -=plugin.settings.addBlock2Height;
}
$(this).css({
top: top,
left: slot.position.x,
width: slot.blocks.h,
height: height
});
$(this).find('.tile-inner').css({
width: tileWidth,
height: tileHeight
})
.data("width", tileWidth)
.data("height", tileHeight);
if(plugin.settings.addBlock1Height!=false){
$(this).find('.tile-inner').css({
top: plugin.settings.addBlock1Height
});
$(this).find('.crp-additional-block1').css({
width: tileWidth,
height: plugin.settings.addBlock1Height
});
}
if(plugin.settings.addBlock2Height!=false){
$(this).find('.crp-additional-block2').css({
bottom: plugin.settings.margin,
width: tileWidth,
height: plugin.settings.addBlock2Height
});
}
$element.find(".ftg-items").height(maxHeight);
});
$tiles.find("img.crp-item").each(function (i, item){
var $item=$(item);
var size=$item.data("size");
var ratioImg=size.width / size.height;
var ratioTile=$item.parent().data("width") / $item.parent().data("height");
var bugFixDiff=0;
if(ratioImg >=ratioTile){
$item.attr("case", "2");
var $h=$item.parent().data("height") + bugFixDiff;
var $w=ratioImg * $h;
$item.css({
width: $w,
height: $h
});
var diff=$w - $item.parent().data("width");
$item.css({
"margin-left": diff / -2,
"margin-top": bugFixDiff / -2,
});
}else{
$item.attr("case", "4");
var $w=$item.parent().data("width") + bugFixDiff;
var $h=$w / ratioImg;
$item.css({
width: $w,
height: $h
});
var diff=$h - $item.parent().data("height");
$item.css({
"margin-top": diff / -2,
"margin-left": bugFixDiff / -2,
});
}});
if(!completed){
completed=true;
plugin.settings.onComplete.call(plugin);
}else{
plugin.settings.onUpdate.call(plugin);
}}
plugin.init();
}
$.fn.crpTiledLayer=function (options){
return this.each(function (){
if(undefined==$(this).data('crpTiledLayer')){
var plugin=new $.crpTiledLayer(this, options);
$(this).data('crpTiledLayer', plugin);
}});
}})(jQuery);
(function($){
var crpFullScreenViewer=function(element, options){
var target="#" + $(element).attr("id");
var plugin=this;
var $defaultViewMode="normal";
var $tsMargin=30;
var $scrollEasing=600;
var $scrollEasingType="easeOutCirc";
var $thumbnailsContainerOpacity=0;
var $thumbnailsContainerMouseOutOpacity=0;
var $thumbnailsOpacity=0.6;
var $nextPrevBtnsInitState="show";
var $keyboardNavigation="on";
var $thumbnails_wrapper=$(target + " #thumbnails_wrapper");
var $outer_container=$(target + " #outer_container");
var $thumbScroller=$(target + " .thumbScroller");
var $thumbScroller_container=$(target + " .thumbScroller .container");
var $thumbScroller_content=$(target + " .thumbScroller .content");
var $thumbScroller_thumb=$(target + " .thumbScroller .thumb");
var $preloader=$(target + " #preloader");
var $toolbar=$(target + " #toolbar");
var $toolbar_a=$(target + " #toolbar a");
var $bgimg=$(target + " #bgimg");
var $img_title=$(target + " #img_title");
var $nextImageBtn=$(target + " .nextImageBtn");
var $prevImageBtn=$(target + " .prevImageBtn");
var $viewModeBtn=$(target + " .viewModeBtn");
var $nextViewMode="normal";
var $totalContent=0;
var $fadeSpeed=200;
var the1stImg=null;
var the1stImgSrc="";
if(options.bgsrc){
the1stImgSrc=options.bgsrc;
}
$(window).load(function(){
$toolbar.data("imageViewMode",$defaultViewMode);
if($defaultViewMode=="full"){
$nextViewMode="normal";
$viewModeBtn.removeClass("maximize");
$viewModeBtn.addClass("minimize");
$viewModeBtn.attr("title", "Restore");
}else{
$nextViewMode="full";
$viewModeBtn.removeClass("minimize");
$viewModeBtn.addClass("maximize");
$viewModeBtn.attr("title", "Maximize");
}
ShowHideNextPrev($nextPrevBtnsInitState);
$thumbScroller_container.css("marginLeft",$tsMargin+"px");
var sliderLeft=$thumbScroller_container.position().left;
var sliderWidth=$outer_container.width();
$thumbScroller.css("width",sliderWidth);
var $the_outer_container=$(target + " #outer_container").get(0); //document.getElementById("outer_container");
var $placement=findPos($the_outer_container);
calcScrollerWidth();
var idleTimer=null;
var idleState=false;
var idleWait=600;
$thumbScroller.mousemove(function(e){
if($thumbScroller_container.width()>sliderWidth){
var mouseCoords=(e.pageX - $placement[1]);
var mousePercentX=mouseCoords/sliderWidth;
var destX=-(((($totalContent+($tsMargin*2))-(sliderWidth))-sliderWidth)*(mousePercentX));
var thePosA=mouseCoords-destX;
var thePosB=destX-mouseCoords;
if(mouseCoords>destX){
$thumbScroller_container.stop().animate({left: -thePosA}, $scrollEasing,$scrollEasingType);
}else if(mouseCoords picHeight){
$(theItem).attr("width",winWidth);
$(theItem).attr("height",picHeight*winWidth);
}else{
$(theItem).attr("height",winHeight);
$(theItem).attr("width",picWidth*winHeight);
};}
$(theItem).css("margin-left",(winWidth-$(theItem).width())/2);
$(theItem).css("margin-top",(winHeight-$(theItem).height())/2);
}else{
$(theItem).attr("width",imageWidth);
$(theItem).attr("height",imageHeight);
$(theItem).css("margin-left",(winWidth-imageWidth)/2);
$(theItem).css("margin-top",(winHeight-imageHeight)/2);
}}
function ImageViewMode(theMode){
$toolbar.data("imageViewMode", theMode);
FullScreenBackground($bgimg,$bgimg.data("newImageW"),$bgimg.data("newImageH"));
if(theMode=="full"){
$nextViewMode="normal";
$viewModeBtn.removeClass("maximize");
$viewModeBtn.addClass("minimize");
$viewModeBtn.attr("title", "Restore");
}else{
$nextViewMode="full";
$viewModeBtn.removeClass("minimize");
$viewModeBtn.addClass("maximize");
$viewModeBtn.attr("title", "Maximize");
}}
function findPos(obj){
var curleft=curtop=0;
if(obj.offsetParent){
curleft=obj.offsetLeft
curtop=obj.offsetTop
while (obj=obj.offsetParent){
curleft +=obj.offsetLeft
curtop +=obj.offsetTop
}}
return [curtop, curleft];
}
return {
prepareToShow: function(){
if(!the1stImg.src){
the1stImg.src=the1stImgSrc;
}else{
$($bgimg).fadeOut(0,0);
$($bgimg).fadeIn("slow");
}
plugin.loadThumbnails();
jQuery(window).trigger("resize");
}}
}
$.fn.crpFullScreenViewer=function (options){
var plugin=$(this).data('crpFullScreenViewer');
if(undefined==plugin){
plugin=new crpFullScreenViewer(this, options);
$(this).data('crpFullScreenViewer', plugin);
}
return plugin;
}})(jQuery);
!function(){"use strict";function e(e){function t(t,n){var s,h,k=t==window,y=n&&n.message!==undefined?n.message:undefined;if(!(n=e.extend({},e.blockUI.defaults,n||{})).ignoreIfBlocked||!e(t).data("blockUI.isBlocked")){if(n.overlayCSS=e.extend({},e.blockUI.defaults.overlayCSS,n.overlayCSS||{}),s=e.extend({},e.blockUI.defaults.css,n.css||{}),n.onOverlayClick&&(n.overlayCSS.cursor="pointer"),h=e.extend({},e.blockUI.defaults.themedCSS,n.themedCSS||{}),y=y===undefined?n.message:y,k&&p&&o(window,{fadeOut:0}),y&&"string"!=typeof y&&(y.parentNode||y.jquery)){var m=y.jquery?y[0]:y,g={};e(t).data("blockUI.history",g),g.el=m,g.parent=m.parentNode,g.display=m.style.display,g.position=m.style.position,g.parent&&g.parent.removeChild(m)}e(t).data("blockUI.onUnblock",n.onUnblock);var v,I,w,U,x=n.baseZ;v=e(r||n.forceIframe?'':''),I=e(n.theme?'':''),n.theme&&k?(U='',n.title&&(U+='"),U+='
',U+="
"):n.theme?(U='"):U=k?'':'',w=e(U),y&&(n.theme?(w.css(h),w.addClass("ui-widget-content")):w.css(s)),n.theme||I.css(n.overlayCSS),I.css("position",k?"fixed":"absolute"),(r||n.forceIframe)&&v.css("opacity",0);var C=[v,I,w],S=e(k?"body":t);e.each(C,function(){this.appendTo(S)}),n.theme&&n.draggable&&e.fn.draggable&&w.draggable({handle:".ui-dialog-titlebar",cancel:"li"});var O=f&&(!e.support.boxModel||e("object,embed",k?null:t).length>0);if(u||O){if(k&&n.allowBodyStretch&&e.support.boxModel&&e("html,body").css("height","100%"),(u||!e.support.boxModel)&&!k)var E=a(t,"borderTopWidth"),T=a(t,"borderLeftWidth"),M=E?"(0 - "+E+")":0,B=T?"(0 - "+T+")":0;e.each(C,function(e,t){var o=t[0].style;if(o.position="absolute",e<2)k?o.setExpression("height","Math.max(document.body.scrollHeight, document.body.offsetHeight) - (jQuery.support.boxModel?0:"+n.quirksmodeOffsetHack+') + "px"'):o.setExpression("height",'this.parentNode.offsetHeight + "px"'),k?o.setExpression("width",'jQuery.support.boxModel&&document.documentElement.clientWidth||document.body.clientWidth + "px"'):o.setExpression("width",'this.parentNode.offsetWidth + "px"'),B&&o.setExpression("left",B),M&&o.setExpression("top",M);else if(n.centerY)k&&o.setExpression("top",'(document.documentElement.clientHeight||document.body.clientHeight) / 2 - (this.offsetHeight / 2) + (blah=document.documentElement.scrollTop ? document.documentElement.scrollTop:document.body.scrollTop) + "px"'),o.marginTop=0;else if(!n.centerY&&k){var i="((document.documentElement.scrollTop ? document.documentElement.scrollTop:document.body.scrollTop) + "+(n.css&&n.css.top?parseInt(n.css.top,10):0)+') + "px"';o.setExpression("top",i)}})}if(y&&(n.theme?w.find(".ui-widget-content").append(y):w.append(y),(y.jquery||y.nodeType)&&e(y).show()),(r||n.forceIframe)&&n.showOverlay&&v.show(),n.fadeIn){var j=n.onBlock?n.onBlock:c,H=n.showOverlay&&!y?j:c,z=y?j:c;n.showOverlay&&I._fadeIn(n.fadeIn,H),y&&w._fadeIn(n.fadeIn,z)}else n.showOverlay&&I.show(),y&&w.show(),n.onBlock&&n.onBlock.bind(w)();if(i(1,t,n),k?(p=w[0],b=e(n.focusableElements,p),n.focusInput&&setTimeout(l,20)):d(w[0],n.centerX,n.centerY),n.timeout){var W=setTimeout(function(){k?e.unblockUI(n):e(t).unblock(n)},n.timeout);e(t).data("blockUI.timeout",W)}}}function o(t,o){var s,l=t==window,d=e(t),a=d.data("blockUI.history"),c=d.data("blockUI.timeout");c&&(clearTimeout(c),d.removeData("blockUI.timeout")),o=e.extend({},e.blockUI.defaults,o||{}),i(0,t,o),null===o.onUnblock&&(o.onUnblock=d.data("blockUI.onUnblock"),d.removeData("blockUI.onUnblock"));var r;r=l?e(document.body).children().filter(".blockUI").add("body > .blockUI"):d.find(">.blockUI"),o.cursorReset&&(r.length>1&&(r[1].style.cursor=o.cursorReset),r.length>2&&(r[2].style.cursor=o.cursorReset)),l&&(p=b=null),o.fadeOut?(s=r.length,r.stop().fadeOut(o.fadeOut,function(){0==--s&&n(r,a,o,t)})):n(r,a,o,t)}function n(t,o,n,i){var s=e(i);if(!s.data("blockUI.isBlocked")){t.each(function(e,t){this.parentNode&&this.parentNode.removeChild(this)}),o&&o.el&&(o.el.style.display=o.display,o.el.style.position=o.position,o.el.style.cursor="default",o.parent&&o.parent.appendChild(o.el),s.removeData("blockUI.history")),s.data("blockUI.static")&&s.css("position","static"),"function"==typeof n.onUnblock&&n.onUnblock(i,n);var l=e(document.body),d=l.width(),a=l[0].style.width;l.width(d-1).width(d),l[0].style.width=a}}function i(t,o,n){var i=o==window,l=e(o);if((t||(!i||p)&&(i||l.data("blockUI.isBlocked")))&&(l.data("blockUI.isBlocked",t),i&&n.bindEvents&&(!t||n.showOverlay))){var d="mousedown mouseup keydown keypress keyup touchstart touchend touchmove";t?e(document).bind(d,n,s):e(document).unbind(d,s)}}function s(t){if("keydown"===t.type&&t.keyCode&&9==t.keyCode&&p&&t.data.constrainTabKey){var o=b,n=!t.shiftKey&&t.target===o[o.length-1],i=t.shiftKey&&t.target===o[0];if(n||i)return setTimeout(function(){l(i)},10),!1}var s=t.data,d=e(t.target);return d.hasClass("blockOverlay")&&s.onOverlayClick&&s.onOverlayClick(t),d.parents("div."+s.blockMsgClass).length>0||0===d.parents().children().filter("div.blockUI").length}function l(e){if(b){var t=b[!0===e?b.length-1:0];t&&t.focus()}}function d(e,t,o){var n=e.parentNode,i=e.style,s=(n.offsetWidth-e.offsetWidth)/2-a(n,"borderLeftWidth"),l=(n.offsetHeight-e.offsetHeight)/2-a(n,"borderTopWidth");t&&(i.left=s>0?s+"px":"0"),o&&(i.top=l>0?l+"px":"0")}function a(t,o){return parseInt(e.css(t,o),10)||0}e.fn._fadeIn=e.fn.fadeIn;var c=e.noop||function(){},r=/MSIE/.test(navigator.userAgent),u=/MSIE 6.0/.test(navigator.userAgent)&&!/MSIE 8.0/.test(navigator.userAgent),f=(document.documentMode,e.isFunction(document.createElement("div").style.setExpression));e.blockUI=function(e){t(window,e)},e.unblockUI=function(e){o(window,e)},e.growlUI=function(t,o,n,i){var s=e('');t&&s.append(""+t+"
"),o&&s.append(""+o+"
"),n===undefined&&(n=3e3);var l=function(t){t=t||{},e.blockUI({message:s,fadeIn:"undefined"!=typeof t.fadeIn?t.fadeIn:700,fadeOut:"undefined"!=typeof t.fadeOut?t.fadeOut:1e3,timeout:"undefined"!=typeof t.timeout?t.timeout:n,centerY:!1,showOverlay:!1,onUnblock:i,css:e.blockUI.defaults.growlCSS})};l();s.css("opacity");s.mouseover(function(){l({fadeIn:0,timeout:3e4});var t=e(".blockMsg");t.stop(),t.fadeTo(300,1)}).mouseout(function(){e(".blockMsg").fadeOut(1e3)})},e.fn.block=function(o){if(this[0]===window)return e.blockUI(o),this;var n=e.extend({},e.blockUI.defaults,o||{});return this.each(function(){var t=e(this);n.ignoreIfBlocked&&t.data("blockUI.isBlocked")||t.unblock({fadeOut:0})}),this.each(function(){"static"==e.css(this,"position")&&(this.style.position="relative",e(this).data("blockUI.static",!0)),this.style.zoom=1,t(this,o)})},e.fn.unblock=function(t){return this[0]===window?(e.unblockUI(t),this):this.each(function(){o(this,t)})},e.blockUI.version=2.7,e.blockUI.defaults={message:"Please wait...
",title:null,draggable:!0,theme:!1,css:{padding:0,margin:0,width:"30%",top:"40%",left:"35%",textAlign:"center",color:"#000",border:"3px solid #aaa",backgroundColor:"#fff",cursor:"wait"},themedCSS:{width:"30%",top:"40%",left:"35%"},overlayCSS:{backgroundColor:"#000",opacity:.6,cursor:"wait"},cursorReset:"default",growlCSS:{width:"350px",top:"10px",left:"",right:"10px",border:"none",padding:"5px",opacity:.6,cursor:"default",color:"#fff",backgroundColor:"#000","-webkit-border-radius":"10px","-moz-border-radius":"10px","border-radius":"10px"},iframeSrc:/^https/i.test(window.location.href||"")?"javascript:false":"about:blank",forceIframe:!1,baseZ:1e3,centerX:!0,centerY:!0,allowBodyStretch:!0,bindEvents:!0,constrainTabKey:!0,fadeIn:200,fadeOut:400,timeout:0,showOverlay:!0,focusInput:!0,focusableElements:":input:enabled:visible",onBlock:null,onUnblock:null,onOverlayClick:null,quirksmodeOffsetHack:4,blockMsgClass:"blockMsg",ignoreIfBlocked:!1};var p=null,b=[]}"function"==typeof define&&define.amd&&define.amd.jQuery?define(["jquery"],e):e(jQuery)}();
jQuery(function(e){if("undefined"==typeof wc_add_to_cart_params)return!1;function t(){e(document.body).on("click",".add_to_cart_button",this.onAddToCart).on("click",".remove_from_cart_button",this.onRemoveFromCart).on("added_to_cart",this.updateButton).on("added_to_cart",this.updateCartPage).on("added_to_cart removed_from_cart",this.updateFragments)}t.prototype.onAddToCart=function(t){var a=e(this);if(a.is(".ajax_add_to_cart")){if(!a.attr("data-product_id"))return!0;t.preventDefault(),a.removeClass("added"),a.addClass("loading");var r={};e.each(a.data(),function(t,a){r[t]=a}),e(document.body).trigger("adding_to_cart",[a,r]),e.post(wc_add_to_cart_params.wc_ajax_url.toString().replace("%%endpoint%%","add_to_cart"),r,function(t){t&&(t.error&&t.product_url?window.location=t.product_url:"yes"!==wc_add_to_cart_params.cart_redirect_after_add?e(document.body).trigger("added_to_cart",[t.fragments,t.cart_hash,a]):window.location=wc_add_to_cart_params.cart_url)})}},t.prototype.onRemoveFromCart=function(t){var a=e(this),r=a.closest(".woocommerce-mini-cart-item");t.preventDefault(),r.block({message:null,overlayCSS:{opacity:.6}}),e.post(wc_add_to_cart_params.wc_ajax_url.toString().replace("%%endpoint%%","remove_from_cart"),{cart_item_key:a.data("cart_item_key")},function(t){t&&t.fragments?e(document.body).trigger("removed_from_cart",[t.fragments,t.cart_hash,a]):window.location=a.attr("href")}).fail(function(){window.location=a.attr("href")})},t.prototype.updateButton=function(t,a,r,o){(o=void 0!==o&&o)&&(o.removeClass("loading"),o.addClass("added"),wc_add_to_cart_params.is_cart||0!==o.parent().find(".added_to_cart").length||o.after(' '+wc_add_to_cart_params.i18n_view_cart+""),e(document.body).trigger("wc_cart_button_updated",[o]))},t.prototype.updateCartPage=function(){var t=window.location.toString().replace("add-to-cart","added-to-cart");e.get(t,function(t){e(".shop_table.cart:eq(0)").replaceWith(e(t).find(".shop_table.cart:eq(0)")),e(".cart_totals:eq(0)").replaceWith(e(t).find(".cart_totals:eq(0)")),e(".cart_totals, .shop_table.cart").stop(!0).css("opacity","1").unblock(),e(document.body).trigger("cart_page_refreshed"),e(document.body).trigger("cart_totals_refreshed")})},t.prototype.updateFragments=function(t,a){a&&(e.each(a,function(t){e(t).addClass("updating").fadeTo("400","0.6").block({message:null,overlayCSS:{opacity:.6}})}),e.each(a,function(t,a){e(t).replaceWith(a),e(t).stop(!0).css("opacity","1").unblock()}),e(document.body).trigger("wc_fragments_loaded"))},new t});
jQuery(function(){
jQuery(":input")
.on("focus", function(){
var input=jQuery(this);
var inputID=input.attr("id")||"(no input ID)";
var inputName=input.attr("name")||"(no input name)";
var inputClass=input.attr("class")||"(no input class)";
var form=jQuery(this.form);
var formID=form.attr("id")||"(no form ID)";
var formName=form.attr("name")||"(no form name)";
var formClass=form.attr("class")||"(no form class)";
window[ gtm4wp_datalayer_name ].push({
'event':'gtm4wp.formElementEnter',
'inputID':inputID,
'inputName':inputName,
'inputClass': inputClass,
'formID':formID,
'formName':formName,
'formClass': formClass
});
})
.on("blur", function(){
var input=jQuery(this);
var inputID=input.attr("id")||"(no input ID)";
var inputName=input.attr("name")||"(no input name)";
var inputClass=input.attr("class")||"(no input class)";
var form=jQuery(this.form);
var formID=form.attr("id")||"(no form ID)";
var formName=form.attr("name")||"(no form name)";
var formClass=form.attr("class")||"(no form class)";
window[ gtm4wp_datalayer_name ].push({
'event':'gtm4wp.formElementLeave',
'inputID':inputID,
'inputName':inputName,
'inputClass': inputClass,
'formID':formID,
'formName':formName,
'formClass': formClass
});
});
});
window.jQuery(document).ready(function($){
$('body').on('adding_to_cart', function(event, $button, data){
$button&&$button.hasClass('vc_gitem-link')&&$button
.addClass('vc-gitem-add-to-cart-loading-btn')
.parents('.vc_grid-item-mini')
.addClass('vc-woocommerce-add-to-cart-loading')
.append($(''));
}).on('added_to_cart', function(event, fragments, cart_hash, $button){
if('undefined'===typeof($button)){
$button=$('.vc-gitem-add-to-cart-loading-btn');
}
$button&&$button.hasClass('vc_gitem-link')&&$button
.removeClass('vc-gitem-add-to-cart-loading-btn')
.parents('.vc_grid-item-mini')
.removeClass('vc-woocommerce-add-to-cart-loading')
.find('.vc_wc-load-add-to-loader-wrapper').remove();
});
});
(function (){
'use strict';
if(window&&window.addEventListener){
var cache=Object.create(null);
var checkUseElems;
var tid;
var debouncedCheck=function (){
clearTimeout(tid);
tid=setTimeout(checkUseElems, 100);
};
var unobserveChanges=function (){
return;
};
var observeChanges=function (){
var observer;
window.addEventListener('resize', debouncedCheck, false);
window.addEventListener('orientationchange', debouncedCheck, false);
if(window.MutationObserver){
observer=new MutationObserver(debouncedCheck);
observer.observe(document.documentElement, {
childList: true,
subtree: true,
attributes: true
});
unobserveChanges=function (){
try {
observer.disconnect();
window.removeEventListener('resize', debouncedCheck, false);
window.removeEventListener('orientationchange', debouncedCheck, false);
} catch (ignore){}};}else{
document.documentElement.addEventListener('DOMSubtreeModified', debouncedCheck, false);
unobserveChanges=function (){
document.documentElement.removeEventListener('DOMSubtreeModified', debouncedCheck, false);
window.removeEventListener('resize', debouncedCheck, false);
window.removeEventListener('orientationchange', debouncedCheck, false);
};}};
var createRequest=function (url){
function getHostname(href){
var a=document.createElement('a');
a.href=href;
return a.hostname;
}
var Request;
var hname=location.hostname;
var hname2;
if(window.XMLHttpRequest){
Request=new XMLHttpRequest();
hname2=getHostname(url);
if(Request.withCredentials===undefined&&hname2!==''&&hname2!==hname){
Request=XDomainRequest||undefined;
}else{
Request=XMLHttpRequest;
}}
return Request;
};
var xlinkNS='http://www.w3.org/1999/xlink';
checkUseElems=function (){
var base;
var bcr;
var fallback='';
var hash;
var href;
var i;
var inProgressCount=0;
var isHidden;
var Request;
var url;
var uses;
var xhr;
function observeIfDone(){
inProgressCount -=1;
if(inProgressCount===0){
unobserveChanges();
observeChanges();
}}
function attrUpdateFunc(spec){
return function (){
if(cache[spec.base]!==true){
spec.useEl.setAttributeNS(xlinkNS, 'xlink:href', '#' + spec.hash);
}};}
function onloadFunc(xhr){
return function (){
var body=document.body;
var x=document.createElement('x');
var svg;
xhr.onload=null;
x.innerHTML=xhr.responseText;
svg=x.getElementsByTagName('svg')[0];
if(svg){
svg.setAttribute('aria-hidden', 'true');
svg.style.position='absolute';
svg.style.width=0;
svg.style.height=0;
svg.style.overflow='hidden';
body.insertBefore(svg, body.firstChild);
}
observeIfDone();
};}
function onErrorTimeout(xhr){
return function (){
xhr.onerror=null;
xhr.ontimeout=null;
observeIfDone();
};}
unobserveChanges();
uses=document.getElementsByTagName('use');
for (i=0; i < uses.length; i +=1){
try {
bcr=uses[i].getBoundingClientRect();
} catch (ignore){
bcr=false;
}
href=uses[i].getAttributeNS(xlinkNS, 'href');
if(href&&href.split){
url=href.split('#');
}else{
url=["", ""];
}
base=url[0];
hash=url[1];
isHidden=bcr&&bcr.left===0&&bcr.right===0&&bcr.top===0&&bcr.bottom===0;
if(bcr&&bcr.width===0&&bcr.height===0&&!isHidden){
if(fallback&&!base.length&&hash&&!document.getElementById(hash)){
base=fallback;
}
if(base.length){
xhr=cache[base];
if(xhr!==true){
setTimeout(attrUpdateFunc({
useEl: uses[i],
base: base,
hash: hash
}), 0);
}
if(xhr===undefined){
Request=createRequest(base);
if(Request!==undefined){
xhr=new Request();
cache[base]=xhr;
xhr.onload=onloadFunc(xhr);
xhr.onerror=onErrorTimeout(xhr);
xhr.ontimeout=onErrorTimeout(xhr);
xhr.open('GET', base);
xhr.send();
inProgressCount +=1;
}}
}}else{
if(!isHidden){
if(cache[base]===undefined){
cache[base]=true;
}else if(cache[base].onload){
cache[base].abort();
delete cache[base].onload;
cache[base]=true;
}}else if(base.length&&cache[base]){
attrUpdateFunc({
useEl: uses[i],
base: base,
hash: hash
})();
}}
}
uses='';
inProgressCount +=1;
observeIfDone();
};
window.addEventListener('load', function winLoad(){
window.removeEventListener('load', winLoad, false);
tid=setTimeout(checkUseElems, 0);
}, false);
}}());