(function(){var e=function(e){var t=this;e.require().script("mvc/view.ejs").done(function(){var n=function(){e.extend(e.EJS.Helpers.prototype,{text:function(e,t){return e==null||e===undefined?t||"":e instanceof Date?e.toDateString():e.toString?(e+"").replace(/\n/g,"<br />").replace(/''/g,"'"):""},month_names:["January","February","March","April","May","June","July","August","September","October","November","December"],check_box_tag:function(e,t,n,r){return n=n||{},r&&(n.checked="checked"),this.input_field_tag(e,t,"checkbox",n)},date_tag:function(e,t,n){t instanceof Date||(t=new Date);var r=[],i=[],s=[],o=t.getFullYear(),u=t.getMonth(),a=t.getDate();for(var f=o-15;f<o+15;f++)r.push({value:f,text:f});for(var l=0;l<12;l++)i.push({value:l,text:$View.Helpers.month_names[l]});for(var c=0;c<31;c++)s.push({value:c+1,text:c+1});var h=this.select_tag(e+"[year]",o,r,{id:e+"[year]"}),p=this.select_tag(e+"[month]",u,i,{id:e+"[month]"}),d=this.select_tag(e+"[day]",a,s,{id:e+"[day]"});return h+p+d},time_tag:function(e,t,n,r){var i=[];if(r==null||r==0)r=60;for(var s=0;s<24;s++)for(var o=0;o<60;o+=r){var u=(s<10?"0":"")+s+":"+(o<10?"0":"")+o;i.push({text:u,value:u})}return this.select_tag(e,t,i,n)},file_tag:function(e,t,n){return this.input_field_tag(e+"[file]",t,"file",n)},form_tag:function(e,t){return t=t||{},t.multipart==1&&(t.method="post",t.enctype="multipart/form-data"),t.action=e,this.start_tag_for("form",t)},form_tag_end:function(){return this.tag_end("form")},hidden_field_tag:function(e,t,n){return this.input_field_tag(e,t,"hidden",n)},input_field_tag:function(e,t,n,r){return r=r||{},r.id=r.id||e,r.value=t||"",r.type=n||"text",r.name=e,this.single_tag_for("input",r)},label_tag:function(e,t){return t=t||{},this.start_tag_for("label",t)+e+this.tag_end("label")},link_to:function(e,t,n){if(!e)var e="null";if(!n)var n={};return this.set_confirm(n),n.href=t,this.start_tag_for("a",n)+e+this.tag_end("a")},link_to_if:function(e,t,n,r){return this.link_to_unless(!e,t,n,r)},link_to_unless:function(e,t,n,r){return e?t:this.link_to(t,n,r)},set_confirm:function(e){e.confirm&&(e.onclick=e.onclick||"",e.onclick=e.onclick+'; var ret_confirm = confirm("'+e.confirm+'"); if(!ret_confirm){ return false;} ',e.confirm=null)},submit_link_to:function(e,t,n,r){if(!e)var e="null";return n||(n={}),n.type="submit",n.value=e,this.set_confirm(n),n.onclick=n.onclick+';window.location="'+t+'"; return false;',this.single_tag_for("input",n)},password_field_tag:function(e,t,n){return this.input_field_tag(e,t,"password",n)},select_tag:function(e,t,n,r){r=r||{},r.id=r.id||e,r.name=e;var i="";i+=this.start_tag_for("select",r);for(var s=0;s<n.length;s++){var o=n[s];typeof o=="string"&&(o={value:o}),o.text||(o.text=o.value),o.value||(o.text=o.text);var u={value:o.value};o.value==t&&(u.selected="selected"),i+=this.start_tag_for("option",u)+o.text+this.tag_end("option")}return i+=this.tag_end("select"),i},single_tag_for:function(e,t){return this.tag(e,t,"/>")},start_tag_for:function(e,t){return this.tag(e,t)},submit_tag:function(e,t){return t=t||{},t.type=t.type||"submit",t.value=e||"Submit",this.single_tag_for("input",t)},tag:function(e,t,n){n=n||">";var r=" ";for(var i in t)if(t.hasOwnProperty(i)){value=t[i]!=null?t[i]+"":"";if(i=="Class"||i=="klass")i="class";value.indexOf("'")!=-1?r+=i+'="'+value+'" ':r+=i+"='"+value+"' "}return"<"+e+r+n},tag_end:function(e){return"</"+e+">"},text_area_tag:function(e,t,n){return n=n||{},n.id=n.id||e,n.name=n.name||e,t=t||"",n.size&&(n.cols=n.size.split("x")[0],n.rows=n.size.split("x")[1],delete n.size),n.cols=n.cols||50,n.rows=n.rows||4,this.start_tag_for("textarea",n)+t+this.tag_end("textarea")},text_field_tag:function(e,t,n){return this.input_field_tag(e,t,"text",n)},img_tag:function(e,t){return t=t||{},t.src=steal.root.join("resources/images/"+e)+"",this.single_tag_for("img",t)}}),e.EJS.Helpers.prototype.text_tag=e.EJS.Helpers.prototype.text_area_tag;var t={},n=0;e.EJS.Helpers.link_data=function(e){var r=n++;return t[r]=e,"_data='"+r+"'"},e.EJS.Helpers.get_data=function(e){if(!e)return null;var n=e.getAttribute("_data");return n?t[parseInt(n)]:null},e.EJS.Helpers.prototype.link_data=function(t){return e.EJS.Helpers.link_data(t)},e.EJS.Helpers.prototype.get_data=function(t){return e.EJS.Helpers.get_data(t)}};n(),t.resolveWith(n)})};dispatch("mvc/view.helpers").containing(e).to("Foundry/2.1 Modules")})();