var helper={log:function(a){if(window.console){window.console.log(a)}},format:function(e){var d=e;for(var b=1;b<arguments.length;b++){var a=b-1;var c=new RegExp("\\{"+a+"\\}","gi");d=d.replace(c,arguments[b])}return d},setHTML:function(b,a){document.getElementById(b).innerHTML=a},bindToClass:function(b,a,c){window.addEventListener(b,function(e){var g=e.srcElement;if(g.getAttribute){var f=g.getAttribute("class");if(f){var d=f.split(/ +/);if(d.indexOf(a)>-1){c(g,e)}}}},true)},bindToId:function(a,d,c){var b=document.getElementById(d);if(b){b.addEventListener(a,function(e){var f=e.srcElement;c(f,e)},true)}else{this.log(this.format("bindToId() element with id[{0}] does not exist!",d))}},bind:function(b,a,g){var f=a.charAt(0);var e=(f=="#");var d=(f==".");var c=a.substring(1);if(e){this.bindToId(b,c,g)}else{if(d){this.bindToClass(b,c,g)}else{this.log("bind() invalid selector: "+a)}}},createXHR:function(){var b=["MSXML2.XMLHTTP.3.0","MSXML2.XMLHTTP","Microsoft.XMLHTTP"];var d;if(typeof window.XMLHttpRequest==="function"){d=new XMLHttpRequest()}else{for(var a=0;a<b.length;a++){try{d=new ActiveXObject(b[a]);break}catch(c){alert(c)}}}return d},doXHR:function(d,c){var e=this.createXHR();var b=(c==undefined)?true:!c;e.open(d.method,d.url,b);if(d.headers!=undefined){for(var a in d.headers){e.setRequestHeader(a,d.headers[a])}}e.onreadystatechange=function(){if(e.readyState==4){var f;if(e.status<400){f=d.onsuccess}else{f=d.onerror}if(f!=undefined){f(e)}}};e.send(d.body||"")},_encodeParameterHash:function(c){var b="";for(var a in c){if(b.length>0){b+="&"}b+=this.format("{0}={1}",a,encodeURI(c[a]))}return b},doGet:function(b,c,a){b.method="GET";b.url+="?"+this._encodeParameterHash(c);return this.doXHR(b,a)},doPost:function(b,c,a){b.method="POST";b.headers=b.headers||{};b.headers["Content-Type"]="application/x-www-form-urlencoded";b.body=this._encodeParameterHash(c);return this.doXHR(b,a)},selectEnd:function(c){var b=document.getElementById(c);if(b){b.focus();if(b.setSelectionRange){var a=b.value.length*2;b.setSelectionRange(a,a)}else{b.value=b.value;b.scrollTop=999999}}}};
var helper={log:function(a){if(window.console){window.console.log(a)}},format:function(e){var d=e;for(var b=1;b<arguments.length;b++){var a=b-1;var c=new RegExp("\\{"+a+"\\}","gi");d=d.replace(c,arguments[b])}return d},setHTML:function(b,a){document.getElementById(b).innerHTML=a},bindToClass:function(b,a,c){window.addEventListener(b,function(e){var g=e.srcElement;if(g.getAttribute){var f=g.getAttribute("class");if(f){var d=f.split(/ +/);if(d.indexOf(a)>-1){c(g,e)}}}},true)},bindToId:function(a,d,c){var b=document.getElementById(d);if(b){b.addEventListener(a,function(e){var f=e.srcElement;c(f,e)},true)}else{this.log(this.format("bindToId() element with id[{0}] does not exist!",d))}},bind:function(b,a,g){var f=a.charAt(0);var e=(f=="#");var d=(f==".");var c=a.substring(1);if(e){this.bindToId(b,c,g)}else{if(d){this.bindToClass(b,c,g)}else{this.log("bind() invalid selector: "+a)}}},createXHR:function(){var b=["MSXML2.XMLHTTP.3.0","MSXML2.XMLHTTP","Microsoft.XMLHTTP"];var d;if(typeof window.XMLHttpRequest==="function"){d=new XMLHttpRequest()}else{for(var a=0;a<b.length;a++){try{d=new ActiveXObject(b[a]);break}catch(c){alert(c)}}}return d},doXHR:function(d,c){var e=this.createXHR();var b=(c==undefined)?true:!c;e.open(d.method,d.url,b);if(d.headers!=undefined){for(var a in d.headers){e.setRequestHeader(a,d.headers[a])}}e.onreadystatechange=function(){if(e.readyState==4){var f;if(e.status<400){f=d.onsuccess}else{f=d.onerror}if(f!=undefined){f(e)}}};e.send(d.body||"")},_encodeParameterHash:function(c){var b="";for(var a in c){if(b.length>0){b+="&"}b+=this.format("{0}={1}",a,encodeURI(c[a]))}return b},doGet:function(b,c,a){b.method="GET";b.url+="?"+this._encodeParameterHash(c);return this.doXHR(b,a)},doPost:function(b,c,a){b.method="POST";b.headers=b.headers||{};b.headers["Content-Type"]="application/x-www-form-urlencoded";b.body=this._encodeParameterHash(c);return this.doXHR(b,a)},selectInputEnd:function(c){var b=document.getElementById(c);if(b){b.focus();if(b.tagName.toUpperCase()=="TEXTAREA"){b.scrollTop=999999}if(b.setSelectionRange){this.log("using selection range");var a=b.value.length*2;b.setSelectionRange(a,a)}else{this.log("using self-replace");b.value=b.value}}}};
update minified version: