var Holder=Holder||{};!function(f,t){var m=!1,l=!1,u=document.createElement("canvas");function p(t){t=t.match(/^(\W)?(.*)/);var e=document["getElement"+(t[1]?"#"==t[1]?"ById":"sByClassName":"sByTagName")](t[2]),n=[];return null!=e&&(n=e.length?e:0==e.length?e:[e]),n}function x(t,e){var n={};for(var a in t)n[a]=t[a];for(var i in e)n[i]=e[i];return n}function d(t,e,n,a){var i=function(t,e,n){e=parseInt(e,10),t=parseInt(t,10);var a=Math.max(e,t),i=Math.min(e,t),o=Math.min(.75*i,.75*a*(1/12));return{height:Math.round(Math.max(n.size,o))}}(e.width,e.height,n).height,o=e.width*a,r=e.height*a,s=n.font?n.font:"sans-serif";u.width=o,u.height=r,t.textAlign="center",t.textBaseline="middle",t.fillStyle=n.background,t.fillRect(0,0,o,r),t.fillStyle=n.foreground,t.font="bold "+i+"px "+s;var l=n.text?n.text:Math.floor(e.width)+"x"+Math.floor(e.height),d=t.measureText(l).width;return.75<=d/o&&(i=Math.floor(.75*i*(o/d))),t.font="bold "+i*a+"px "+s,t.fillText(l,o/2,r/2,o),u.toDataURL("image/png")}function y(t,e,n,a){var i=n.dimensions,o=n.theme,r=n.text?decodeURIComponent(n.text):n.text,s=i.width+"x"+i.height;o=r?x(o,{text:r}):o,o=n.font?x(o,{font:n.font}):o,"image"==t?(e.setAttribute("data-src",a),e.setAttribute("alt",r||(o.text?o.text+" ["+s+"]":s)),!l&&n.auto||(e.style.width=i.width+"px",e.style.height=i.height+"px"),l?e.style.backgroundColor=o.background:e.setAttribute("src",d(g,i,o,h))):"background"==t?l||(e.style.backgroundImage="url("+d(g,i,o,h)+")",e.style.backgroundSize=i.width+"px "+i.height+"px"):"fluid"==t&&(e.setAttribute("data-src",a),e.setAttribute("alt",r||(o.text?o.text+" ["+s+"]":s)),"%"==i.height.substr(-1)?e.style.height=i.height:e.style.height=i.height+"px","%"==i.width.substr(-1)?e.style.width=i.width:e.style.width=i.width+"px","inline"!=e.style.display&&""!=e.style.display||(e.style.display="block"),l?e.style.backgroundColor=o.background:(e.holderData=n,v.push(e),c(e)))}function c(t){var e;for(i in e=null==t.nodeType?v:[t]){var n=e[i];if(n.holderData){var a=n.holderData;n.setAttribute("src",d(g,{height:n.clientHeight,width:n.clientWidth},a.theme,h))}}}function w(t,e){var n={theme:b.themes.gray},a=!1;for(sl=t.length,j=0;j<sl;j++){var i=t[j];f.flags.dimensions.match(i)?(a=!0,n.dimensions=f.flags.dimensions.output(i)):f.flags.fluid.match(i)?(a=!0,n.dimensions=f.flags.fluid.output(i),n.fluid=!0):f.flags.colors.match(i)?n.theme=f.flags.colors.output(i):e.themes[i]?n.theme=e.themes[i]:f.flags.text.match(i)?n.text=f.flags.text.output(i):f.flags.font.match(i)?n.font=f.flags.font.output(i):f.flags.auto.match(i)&&(n.auto=!0)}return!!a&&n}if(document.getElementsByClassName||(document.getElementsByClassName=function(t){var e,n,a,i=document,o=[];if(i.querySelectorAll)return i.querySelectorAll("."+t);if(i.evaluate)for(n=".//*[contains(concat(' ', @class, ' '), ' "+t+" ')]",e=i.evaluate(n,i,null,0,null);a=e.iterateNext();)o.push(a);else for(e=i.getElementsByTagName("*"),n=new RegExp("(^|\\s)"+t+"(\\s|$)"),a=0;a<e.length;a++)n.test(e[a].className)&&o.push(e[a]);return o}),window.getComputedStyle||(window.getComputedStyle=function(n,t){return this.el=n,this.getPropertyValue=function(t){var e=/(\-([a-z]){1})/g;return"float"==t&&(t="styleFloat"),e.test(t)&&(t=t.replace(e,function(){return arguments[2].toUpperCase()})),n.currentStyle[t]?n.currentStyle[t]:null},this}),Object.prototype.hasOwnProperty||(Object.prototype.hasOwnProperty=function(t){var e=this.__proto__||this.constructor.prototype;return t in this&&(!(t in e)||e[t]!==this[t])}),u.getContext)if(u.toDataURL("image/png").indexOf("data:image/png")<0)l=!0;else var g=u.getContext("2d");else l=!0;var e=1,n=1;l||(e=window.devicePixelRatio||1,n=g.webkitBackingStorePixelRatio||g.mozBackingStorePixelRatio||g.msBackingStorePixelRatio||g.oBackingStorePixelRatio||g.backingStorePixelRatio||1);var h=e/n,v=[],b={domain:"holder.js",images:"img",bgnodes:".holderjs",themes:{gray:{background:"#eee",foreground:"#aaa",size:12},social:{background:"#3a5a97",foreground:"#fff",size:12},industrial:{background:"#434A52",foreground:"#C2F200",size:12}},stylesheet:".holderjs-fluid {font-size:16px;font-weight:bold;text-align:center;font-family:sans-serif;margin:0}"};for(var a in f.flags={dimensions:{regex:/^(\d+)x(\d+)$/,output:function(t){var e=this.regex.exec(t);return{width:+e[1],height:+e[2]}}},fluid:{regex:/^([0-9%]+)x([0-9%]+)$/,output:function(t){var e=this.regex.exec(t);return{width:e[1],height:e[2]}}},colors:{regex:/#([0-9a-f]{3,})\:#([0-9a-f]{3,})/i,output:function(t){var e=this.regex.exec(t);return{size:b.themes.gray.size,foreground:"#"+e[2],background:"#"+e[1]}}},text:{regex:/text\:(.*)/,output:function(t){return this.regex.exec(t)[1]}},font:{regex:/font\:(.*)/,output:function(t){return this.regex.exec(t)[1]}},auto:{regex:/^auto$/}},f.flags)f.flags.hasOwnProperty(a)&&(f.flags[a].match=function(t){return t.match(this.regex)});f.add_theme=function(t,e){return null!=t&&null!=e&&(b.themes[t]=e),f},f.add_image=function(t,e){var n=p(e);if(n.length)for(var a=0,i=n.length;a<i;a++){var o=document.createElement("img");o.setAttribute("data-src",t),n[a].appendChild(o)}return f},f.run=function(t){var e=x(b,t),n=[],a=[],i=[];for("string"==typeof e.images?a=p(e.images):window.NodeList&&e.images instanceof window.NodeList?a=e.images:window.Node&&e.images instanceof window.Node&&(a=[e.images]),"string"==typeof e.bgnodes?i=p(e.bgnodes):window.NodeList&&e.elements instanceof window.NodeList?i=e.bgnodes:window.Node&&e.bgnodes instanceof window.Node&&(i=[e.bgnodes]),m=!0,l=0,s=a.length;l<s;l++)n.push(a[l]);var o=document.getElementById("holderjs-style");o||((o=document.createElement("style")).setAttribute("id","holderjs-style"),o.type="text/css",document.getElementsByTagName("head")[0].appendChild(o)),e.nocss||(o.styleSheet?o.styleSheet.cssText+=e.stylesheet:o.appendChild(document.createTextNode(e.stylesheet)));for(var r=new RegExp(e.domain+'/(.*?)"?\\)'),s=i.length,l=0;l<s;l++){var d=window.getComputedStyle(i[l],null).getPropertyValue("background-image"),u=d.match(r),c=i[l].getAttribute("data-background-src");if(u)(g=w(u[1].split("/"),e))&&y("background",i[l],g,d);else if(null!=c){(g=w(c.substr(c.lastIndexOf(e.domain)+e.domain.length+1).split("/"),e))&&y("background",i[l],g,d)}}for(s=n.length,l=0;l<s;l++){var g,h=attr_data_src=d=null;try{h=n[l].getAttribute("src"),attr_datasrc=n[l].getAttribute("data-src")}catch(t){}if(null==attr_datasrc&&h&&0<=h.indexOf(e.domain)?d=h:attr_datasrc&&0<=attr_datasrc.indexOf(e.domain)&&(d=attr_datasrc),d)(g=w(d.substr(d.lastIndexOf(e.domain)+e.domain.length+1).split("/"),e))&&(g.fluid?y("fluid",n[l],g,d):y("image",n[l],g,d))}return f},function(e,n){var a="complete",i="readystatechange",o=!1,t=!0,r=e.document,s=r.documentElement,l=r.addEventListener?"addEventListener":"attachEvent",d=r.addEventListener?"removeEventListener":"detachEvent",u=r.addEventListener?"":"on",c=function(t){(t.type!=i||r.readyState==a)&&(("load"==t.type?e:r)[d](u+t.type,c,!1),!o&&(o=!0)&&n.call(e,null))},g=function(){try{s.doScroll("left")}catch(t){return void setTimeout(g,50)}c("poll")};if(r.readyState==a)n.call(e,"lazy");else{if(r.createEventObject&&s.doScroll){try{t=!e.frameElement}catch(t){}t&&g()}r[l](u+"DOMContentLoaded",c,!1),r[l](u+i,c,!1),e[l](u+"load",c,!1)}}(t,function(){window.addEventListener?(window.addEventListener("resize",c,!1),window.addEventListener("orientationchange",c,!1)):window.attachEvent("onresize",c),m||f.run()}),"function"==typeof define&&define.amd&&define("Holder",[],function(){return f})}(Holder,window);