(function(){'use strict';var f=function(a){return"gwd-page"==a.tagName.toLowerCase()||"gwd-page"==a.getAttribute("is")},h=function(a){if(f(a))return a;for(;a&&9!=a.nodeType;)if((a=a.parentElement)&&f(a))return a;return null},k=function(a,b){return b!=a.getAttribute("source")?(a.setAttribute("source",b),!0):!1};var l=function(a,b){var c=document.createEvent("Event");c.initEvent(a,!0,!0);b.dispatchEvent(c)},m=function(a,b,c){var d=function(e){a.removeEventListener(b,d);c(e)};a.addEventListener(b,d)};var n=function(a){a||(a="");return/^[\s\xa0]*$/.test(a)},p=function(){};goog.inherits(p,HTMLElement);p.prototype.createdCallback=function(){for(var a;a=this.firstChild;)this.removeChild(a);this.c="gwd_imagebutton_"+(2147483648*Math.random()|0);this.a=document.createElement("div");this.a.className=this.c;this.appendChild(this.a);this.h=null;this.m=this.b=!1;this.i=document.createElement("gwd-image");this.g=document.createElement("gwd-image");this.f=document.createElement("gwd-image");this.j=document.createElement("gwd-page");this.l=this.o.bind(this);this.u=this.s.bind(this);this.style.display="inline-block";this.style.padding=0;this.a.style.backgroundRepeat="no-repeat";this.a.style.width="100%";this.a.style.height="100%"};p.prototype.attachedCallback=function(){this.a.addEventListener("click",this.l,!1);if("function"==typeof this.gwdLoad&&"function"==typeof this.gwdIsLoaded&&!this.gwdIsLoaded()){var a=h(this),b=a&&"function"==typeof a.gwdIsLoaded;(!a||b&&a.gwdIsLoaded())&&this.gwdLoad()}};p.prototype.detachedCallback=function(){this.a.removeEventListener("click",this.l,!1)};p.prototype.attributeChangedCallback=function(a){var b=this.getAttribute(a);switch(a){case "alignment":b?this.a.style.backgroundPosition=b:this.setAttribute(a,"center");break;case "scaling":b?this.a.style.backgroundSize=b:this.setAttribute(a,"auto");break;case "up-image":q(this,this.i,b);break;case "over-image":q(this,this.g,b);break;case "down-image":q(this,this.f,b);break;case "disabled":this.b=this.hasAttribute("disabled")&&"false"!=this.getAttribute("disabled");r(this);this.a.style.cursor=this.b?"default":"pointer";break;case "bgcolor":this.a.style.backgroundColor=n(b)?"":b}};var q=function(a,b,c){n(c)?r(a):(b.setAttribute("source",c),t(a))};p.prototype.gwdIsLoaded=function(){return this.m};p.prototype.gwdLoad=function(){for(var a=["bgcolor","alignment","scaling","disabled"],b=0;b