(function(){var e=[{bad:"'",rex:new RegExp("'","g")},{bad:'"',rex:new RegExp('"',"g")}];if(!u8.Base.Html){u8.Base.Html=function(){}}$.extend(u8.Base.Html.prototype,{image:function(e,t){return u8.images.html(e,t)},imageUrl:function(e){return u8.images.url(e,this._page)},imageButton:function(e){var t="<button type='button' class='"+(e.className||"u8-imagebutton")+"' "+(e.buttonAttr?e.buttonAttr:"")+(e.onClick?"onclick='"+e.onClick+";'":"")+" title='"+(e.text||"")+"'"+">";if(e.image){t+=u8.images.html(e.image,null,{attr:"style='border:none; vertical-align:middle;'"+(e.attr||"")})}if(e.sprite){t+=u8.images.sprites.html(e.sprite)}if(e.showText){t+=e.text?u8.Base.Html.escape(e.text):""}t+="</button>";return t},format:function(e,t,i){if(!e){return e}var r=null,n=this._page,l=null;e.format(t,function(e){if(l){if(n._isDisposed){return}n.$("#"+l).replaceWith(n.elWindow.document.createTextNode(e))}else{r=e}if(i){i(e)}});if(r){return u8.Base.Html.escape(r)}l=u8.Base.Dom.uniqueId();return"<span id='"+l+"'></span>"}});$.extend(u8.Base.Html,{decorateImage:function(e,t){return u8.images.decorateName(e,t)},imageSize:function(e){return u8.images.sizeToPixels(e)},spriteClass:function(e,t,i){return u8.images.sprites.toClassName(e,t,i)},sprite:function(e,t,i){return u8.images.sprites.html(e,t,i)},escapeAttribute:function(t){if("string"!=typeof t){if(!t){return t}t=t.toString()}var i=e;for(var r=0;r<i.length;r++){if(t.indexOf(i[r].bad)>=0){t=t.replace(i[r].rex,"&#"+i[r].bad.charCodeAt(0)+";")}}return t},formatColor:function(e){if(!e||!e.length){return""}if("#"==e.substring(0,1)){return e}return"#"+e},parseAttributes:function(e,t){if(!e){return}var i=null;var r=null;var n;var l=null;var s=false;var u=false;var a=0;function f(){if(t){i=$.trim(i);t(i,r)}i=null;r=null;l=null;s=false;a=0}for(var o=0;o<e.length;o++){n=e.charAt(o);if(a==0){if(n=="="){a=1}else if(u8.Base.String.isWhitespace(n)){if(null!==i){a=1}}else if(null===i){i=n}else{i+=n}}if(a==1){if(n=="="){s=true}else if(!u8.Base.String.isWhitespace(n)){if(s){a=2}else{f();i=n}}}if(a==2){if(n=="'"||n=='"'){if(l){if(l!=n||u){if(null===r){r=n}else{r+=n}u=false}else{f()}}else{l=n}}else if(n=="\\"){if(u){if(null===r){r=n}else{r+=n}u=false}else{u=true}}else{if(u){n="\\"+n;u=false}if(null===r){r=n}else{r+=n}}}}if(null!==i){f()}},parseStyle:function(e,t){if(!e){return}var i=null;var r=null;var n;var l=false;var s=0;function u(){if(t){i=$.trim(i);while(true){var e=i.indexOf("-");if(e<0){break}else if(e==0){i=i.substr(0,1).toUpperCase()+i.substr(1)}else{i=i.substr(0,e)+i.substr(e+1,1).toUpperCase()+i.substr(e+2)}}t(i,r)}i=null;r=null;s=0;l=false}for(var a=0;a<e.length;a++){n=e.charAt(a);if(s==0){if(n==":"){s=1}else if(u8.Base.String.isWhitespace(n)){if(null!==i){s=1}}else if(null===i){i=n}else{i+=n}}if(s==1){if(n==":"){l=true}else if(!u8.Base.String.isWhitespace(n)){if(l){s=2}else{u();i=n}}}if(s==2){if(n==";"){u()}else if(null===r){r=n}else{r+=n}}}if(null!==i){u()}},attributeStringFormatter:function(e,t){t(u8.Base.Html.escapeAttribute(e))},encodeHtml:function(e){var t={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;","`":"&#x60;","=":"&#x3D;"};return String(e).replace(/[&<>"'`=\/]/g,function(e){return t[e]})}});u8.Base.String.formatters["attr"]=u8.Base.Html.attributeStringFormatter})();