text: (function(n){var i="gx-label",s="control-label Label",h="Label",r="form-control",a=/(col-(?:xs|sm|md|lg)-\d{1,2})/g,c=function(t,i){var u=n(t).parent().find("span"),f;gx.lang.gxBoolean(i)?u.parent("p").hide():(u.removeClass(r),f=u.parent("p"),f.length==0?gx.plugdesign.applyTemplateOnElement("readonly-atts-vars",u[0]):f.show())},t=function(t,i,r){r=r||5;for(var f,e=r,u=t;e;)u=u.parentNode,e--;(f=gx.html.getFieldLabel(t,u),f)&&n(t).parent().closest(".gx-form-group",u).toggle(gx.lang.gxBoolean(i))},l=function(n,t){var r=gx.html.getFieldLabel(n),e=t.split(" ").join(h+" ")+(t?h:""),f,u;r&&(u=r.className.match(a),f=u?u.join(" "):"",r.className=[i,f,e,s].join(" "))},u,f,e,o;new gx.plugdesign.Template({name:"labels",selector:"div.gx-attribute:has(label."+i+":not([data-gx-sr-only]))",template:'<div class="form-group gx-form-group">{{$labelEl$}}{{$el$}}<\/div>',setContext:function(t,r){var u=n(r).find("label."+i).addClass(s);return t.labelEl=u[0],t},listeners:{control:function(t){return n(t.labelEl).attr("for")},after:{Class:l}}});new gx.plugdesign.Template({name:"atts-vars",selector:".gx-attribute > input:not(.GeoLocOption), .gx-attribute > select, .gx-attribute > textarea, .gx-attribute > img:first-child",initialize:function(i){var u=n("#"+i.id)[0],e=n("#span_"+u.id)[0],f=gx.fn.isVisible(u,0);u.tagName!="IMG"&&e&&(f=f||gx.fn.isVisible(e,0));t(u,f);l(u,u.className.replace(r,""))},listeners:{control:function(n){return n.id},after:{Enabled:c,Visible:t}}});u=function(i,r){n(i).parent("p").toggle(gx.lang.gxBoolean(r));t(i,r)};new gx.plugdesign.Template({name:"readonly-atts-vars",selector:'.gx-attribute span[class^="Readonly"]:not(:has(input[type="checkbox"]))',template:'<p class="form-control-static">{{{outerHTML}}}<\/p>',outerHTML:!0,initialize:function(t){var i=n("#"+t.id)[0];i&&u(i,gx.fn.isVisible(i,0))},listeners:{control:function(n){return n.id},after:{Visible:u}}});f=function(i,r){var u=n(i).parent().closest(".checkbox");gx.lang.gxBoolean(r)?(u.show(),u.children().show()):u.hide();t(i,r)};new gx.plugdesign.Template({name:"checkbox",selector:'.gx-attribute input[type="checkbox"]',setContext:function(t,i){return t.id=n(i)[0].id,t},initialize:function(t){var u=n("#"+t.id),i=u.get(0),r=n(i).closest("label");r.wrap("<div class='checkbox'><\/div>");f(i,gx.fn.isVisible(r[0],0))},listeners:{control:function(n){return n.id},after:{Visible:f}}});e=function(i,r){this.visible=r;var u=n(i).parent().find(".input-group-btn");gx.lang.gxBoolean(r)&&gx.fn.isVisible(i,0)?(this.enabled||this.enabled===undefined)&&u.show():u.hide();t(i,r)};new gx.plugdesign.Template({name:"datepicker",selector:".dp_container:has(img):has(input)",template:'<div class="dp_container {{alignClass}}" id="{{datePickerCt.id}}"><div class="input-group">{{{inputEl.outerHTML}}}{{{spaneElHtml}}}<span class="input-group-btn"><a class="btn btn-default">{{{imgEl.outerHTML}}}<\/a><\/span><\/div><\/div>',outerHTML:!0,setContext:function(t,i){var f=n(i),e=f.attr("data-align"),u,r;return t.datePickerCt=i,t.inputEl=f.find("input")[0],t.imgEl=f.find("img")[0],t.inputElId=t.inputEl.id,t.alignClass=e?"pull-"+e:"",u=n("#span_"+t.inputEl.id),u.length>0&&(r=u.parent("p")[0],t.spaneElHtml=r?r.outerHTML:u[0].outerHTML,r&&n(r).remove()),t},initialize:function(t){var r=n("#"+t.inputElId),f=r.parent().closest(".dp_container"),i,u;f.find("a").click(function(n){try{if(n.target.nodeName!="IMG")return f.find("img")[0].click(),!1}catch(t){return!1}});i=gx.fn.isVisible(r[0],0);u=n("#span_"+t.inputEl.id);u.length>0&&(i=i||gx.fn.isVisible(u[0],0));e.call(this,r[0],i)},listeners:{control:function(n){return n.inputEl.id},after:{Enabled:function(t,i){this.enabled=gx.lang.gxBoolean(i);var r=n(t).parent().find(".input-group-btn");gx.lang.gxBoolean(i)?(this.visible||this.visible==undefined)&&r.show():r.hide();c(t,i)},Visible:e}}});new gx.plugdesign.Template({name:"vertical-radio-button",selector:'.gx-attribute table td:has(input[type="radio"])',template:'<td><div class="radio">{{{innerHTML}}}<\/div><\/td>',innerHTML:!0,setContext:function(t,i){return t.id=n(i).find('input[type="radio"]')[0].name,t.tableEl=n(i).parent().closest("table.gx-radio-button")[0],t},initialize:function(n){t(n.tableEl,gx.fn.isVisible(n.tableEl,0))},listeners:{control:function(n){return n.id},after:{Visible:t}}});new gx.plugdesign.Template({name:"horizontal-radio-button",selector:'.gx-attribute span input[type="radio"]',template:"{{{outerHTML}}}{{labelText}}",outerHTML:!0,setContext:function(t,i){var r=!1,u;return i&&(n(i).parent().contents().each(function(){if(r&&this.nodeType==3)return u=this,!1;this==i&&(r=!0)}),t.labelText=n(u).remove().text().trim(),n(i).parent().contents("script").remove(),n(i).parent("label").addClass("radio-inline")),t.spanEl=n(i).parent().closest("span.gx-radio-button")[0],t},initialize:function(n){t(n.spanEl,gx.fn.isVisible(n.spanEl,0))},listeners:{control:function(n){return n.name},after:{Visible:t}}});new gx.plugdesign.Template({name:"prompt",selector:function(t){return n(t+' input + a img[id*="PROMPT"]').parent().prev().filter(function(n,t){return gx.fn.isVisible(t,0)})},template:'<div class="input-group">{{{inputEl.outerHTML}}}<span class="input-group-btn">{{{promptEl}}}<\/span><\/div>',setContext:function(t,i){return t.inputEl=i,t.promptEl=n(i).next().addClass("btn btn-default").remove()[0].outerHTML,t},listeners:{control:function(n){return n.inputEl.id},before:{Visible:function(t,i){var r=n(t).parent();gx.lang.gxBoolean(i)?r.show():r.hide()},Enabled:function(t,i){var r=n(t).parent().find(".input-group-btn");gx.lang.gxBoolean(i)?r.show():r.hide()}}}});o=function(t,i){var r=n(t).parent();gx.lang.gxBoolean(i)?r.show():r.hide()};new gx.plugdesign.Template({name:"geolocation",selector:"input + input.GeoLocOption",template:'<div class="input-group"><div id="{{inputEl.id}}_hook"><\/div><span class="input-group-btn"><a class="btn btn-default"><div id="{{inputEl.id}}_trigger_hook"><\/div><\/a><\/span><\/div>',setContext:function(t,i){return t.inputEl=n(i).prev()[0],t.triggerEl=n(i)[0],t},initialize:function(t){n("#"+t.inputEl.id+"_hook").replaceWith(t.inputEl);n("#"+t.inputEl.id+"_trigger_hook").replaceWith(t.triggerEl);o.call(this,t.inputEl,gx.fn.isVisible(t.inputEl,0))},listeners:{control:function(n){return n.inputEl.id},before:{Visible:o,Enabled:function(t,i){var r=n(t).parent().find(".input-group-btn");gx.lang.gxBoolean(i)?r.show():r.hide()}}}});new gx.plugdesign.Template({name:"multimedia-upload",selector:".gx-multimedia-upload .fields-ct",template:'<div class="row"><div class="col-sm-4"><div class="row"><div class="col-sm-12"><div id="{{fileField.id}}_fileOption_hook"><\/div><\/div><div class="col-sm-12"><div id="{{fileField.id}}_uriOption_hook"><\/div><\/div><\/div><\/div><div class="col-sm-8"><div id="{{fileField.id}}_uriField_hook"><\/div><div id="{{fileField.id}}_fileField_hook"><\/div><\/div><\/div><div class="row"><div class="col-sm-12"><div id="{{fileField.id}}_button_hook"><\/div><\/div><\/div>',applyTo:"inner",setContext:function(t,i){var u=n(i).parent().closest(".gx-multimedia-upload")[0],r=gx.html.multimediaUpload.getElements(u);return r.fileOptionLbl=r.fileOption.parentNode.cloneNode(!0),r.uriOptionLbl=r.uriOption.parentNode.cloneNode(!0),gx.lang.apply(t,r),t.container=u,t},initialize:function(t){n("#"+t.fileField.id+"_fileOption_hook").replaceWith(t.fileOptionLbl);n("#"+t.fileField.id+"_uriOption_hook").replaceWith(t.uriOptionLbl);n("#"+t.fileField.id+"_uriField_hook").replaceWith(t.uriField);n("#"+t.fileField.id+"_fileField_hook").replaceWith(t.fileField);var i=n(t.container).find('input[type="button"]');n("#"+t.fileField.id+"_button_hook").replaceWith(i[0]);i.attr("class","btn btn-default Button");n(t.uriField).addClass(r)}})})(gx.$)