
String.prototype.startsWith=function(prefix){return(this.substr(0,prefix.length)==prefix);}
String.prototype.trim=function(){return this.trimRight().trimLeft();}
String.format=function(format){for(var i=1;i<arguments.length;i++){format=format.replace("{"+(i-1)+"}",arguments[i]);}return format;}
String.prototype.HTMLEntities=[["&","&amp;"],["<","&lt;"],[">","&gt;"],["'","&#039;"],['"',"&quot;"]];String.prototype.HTMLEncode=function(){var i,a,s,re;s=this;a="".HTMLEntities;for(i=0;i<a.length;i++){re=new RegExp(a[i][0],"g");s=s.replace(re,a[i][1]);}return s;}
String.prototype.HTMLDecode=function(){var i,a,s,re;s=this;a="".HTMLEntities;for(i=0;i<a.length;i++){re=new RegExp(a[i][1],"g");s=s.replace(re,a[i][0]);}return s;}
Array.prototype.clear=function(){if(this.length>0){this.splice(0,this.length);}}
Array.prototype.clone=function(){var clonedArray=[];var length=this.length;for(var index=0;index<length;index++){clonedArray[index]=this[index];}return clonedArray;}
Array.prototype.contains=function(item){var index=this.indexOf(item);return(index>=0);}
Array.prototype.indexOf=function(item){var length=this.length;if(length!=0){for(var index=0;index<length;index++){if(this[index]==item){return index;}}}return-1;}
Array.prototype.insert=function(index,item){this.splice(index,0,item);}
Array.prototype.queue=function(item){this.push(item);}
Array.prototype.remove=function(item){var index=this.indexOf(item);if(index>=0){this.splice(index,1);}}
Array.prototype.removeAt=function(index){this.splice(index,1);}
if(!Array.prototype.push){Array.prototype.push=function(elem){this[this.length]=elem;}};if(!Array.prototype.erase){Array.prototype.erase=function erase(pos){if(pos>=0)this.splice(pos,1);else this.splice(0,this.length);return this;}};if(!Array.prototype.contains){Array.prototype.contains=function(val){for(var i=0;i<this.length;i++){if(this[i]===val)return true;}return false;}};if(!Array.prototype.removeDuplicates){Array.prototype.removeDuplicates=function(){for(i=1;i<this.length;i++){if(this[i][0]==this[i-1][0]){this.splice(i,1);}}};};if(!Array.prototype.empty){Array.prototype.empty=function(){for(i=0;i<=this.length;i++){this.shift();}};};Function.prototype.sliceArguments=function(from,to){var args=[];to=(to)?to:this.arguments.length;for(var i=0;i<this.arguments.length;i++){if(i>=from&&i<=to)args.push(this.arguments[i]);}return args;}
var support={version:"1.5.2",getReal:function(el,type,value)
{var tmp=el;while((tmp!=null)&&(tmp.tagName.toLowerCase()!="body"))
{if((eval("tmp."+type)==value)||(eval("tmp."+type+".indexOf('"+value+"')")>-1)){el=tmp;return el;}
tmp=tmp.parentNode;};return el;},getElementsByName:function(node,name)
{var a=[];node=(node)?node:document;var els=node.getElementsByTagName("*");for(var i=0,j=els.length;i<j;i++)
{if(els[i].name==name)a.push(els[i]);};return a;},getElementsByType:function(node,types)
{node=(node)?node:document;var aReturn=new Array();var els=node.getElementsByTagName("*");var aTypes=types.split(",");for(var i=0;i<els.length;i++)
{for(var ii=0;ii<aTypes.length;ii++)
{if(els[i].nodeName.toLowerCase()==aTypes[ii].toLowerCase())
{aReturn.push(els[i]);}}};return aReturn;},getElementsByClassName:function(node,cname)
{var a=new Array();node=(node)?node:document;var re=(typeof(cname)=="object")?cname:new RegExp('(?:^| )'+cname+'(?: |$)');var els=node.getElementsByTagName("*");for(var i=0;i<els.length;i++)
{if(re.test(els[i].className))
{a.push(els[i]);}};return a;},getElementByClassName:function(node,classname)
{node=(node)?node:document;var re=(typeof(classname)=="object")?classname:new RegExp('(^| )'+classname+'( |$)');var els=node.getElementsByTagName("*");for(var i=0,j=els.length;i<j;i++)
{if(re.test(els[i].className))
{return els[i]}};},getPos:function(el)
{var x=0,y=0,w=0,h=0;if(document.getBoxObjectFor)
{var bo=document.getBoxObjectFor(el);return{x:bo.x,y:bo.y,w:bo.width,h:bo.height}}
else if(el.getBoundingClientRect)
{var rect=el.getBoundingClientRect();return{x:rect.left+support.viewport().scrollX,y:rect.top+support.viewport().scrollY,w:(rect.right-rect.left),h:(rect.bottom-rect.top)}}
else
{w=el.offsetWidth;h=el.offsetHeight;do{x+=el.offsetLeft||0;y+=el.offsetTop||0;el=el.offsetParent;}while(el);return{x:x,y:y,w:w,h:h}}},contains:function(a,b)
{while((a!=b)&&(b.tagName.toLowerCase()!="body")&&(b!=null))b=b.parentNode;return(a==b);},getElementsByAttribute:function(sProperty,sValue)
{var aReturn=[];var els=document.getElementsByTagName("*");for(var i=0;i<els.length;i++)
{if(els[i].attributes)
{for(var ii=0;ii<els[i].attributes.length;ii++)
{if((els[i].attributes[ii].nodeName==sProperty)&&(els[i].attributes[ii].nodeValue==sValue))
{aReturn.push(els[i]);}}}}
return aReturn;},createElement:function(parent,name,attrs,style,text)
{var e=document.createElement(name);if(attrs)
{for(key in attrs)
{if(key=="class")e.className=attrs[key];else if(key=="id")e.id=attrs[key];else e.setAttribute(key,attrs[key]);}}
if(style)
{for(key in style)e.style[key]=style[key];}
if(text)e.appendChild(document.createTextNode(text));if(parent)parent.appendChild(e);return e;},viewport:function()
{return{height:(self.innerHeight||document.body.clientHeight||document.documentElement.clientHeight),width:(self.innerWidth||document.body.clientWidth||document.documentElement.clientWidth),scrollX:(document.body.scrollLeft||document.documentElement.scrollLeft||self.pageXOffset||0),scrollY:(document.body.scrollTop||document.documentElement.scrollTop||self.pageYOffset||0)};},$:function()
{var els=new Array();for(var i=0;i<arguments.length;i++)
{var element=arguments[i];if(typeof element=='string')element=document.getElementById(element);if(arguments.length==1)return element;els.push(element);}
return els;},previousSibling:function(n)
{var x=(n)?n.previousSibling:null;while((x)&&(x.nodeType!=1))
{x=x.previousSibling;}
return x;},nextSibling:function(n)
{var x=(n)?n.nextSibling:null;while((x)&&(x.nodeType!=1))
{x=x.nextSibling;}
return x;},getStyle:function(el,style)
{if(el.currentStyle)
{return el.currentStyle[style];}
else if(window.getComputedStyle)
{var elstyle=window.getComputedStyle(el,"");return elstyle.getPropertyValue(style);}
return"auto";},addStyleRule:function(selector,styles,index)
{index=(!index)?0:index;ss=document.styleSheets[index];if(ss.insertRule)
{ss.insertRule(selector+' {'+styles+'}',ss.cssRules.length);}
else if(ss.addRule)
{ss.addRule(selector,styles);}
else return false;return true;},swapNode:function(n1,n2)
{if(n1.swapNode)n1.swapNode(n2);else
{var p=n2.parentNode;var s=n2.nextSibling;n1.parentNode.replaceChild(n2,n1);p.insertBefore(n1,s);}
return n1;},insertAfter:function(el,ref)
{ref.parentNode.insertBefore(el,ref.nextSibling);},insertBefore:function(el,ref)
{ref.parentNode.insertBefore(el,ref);},text:function(el)
{return(el)?el.innerText||el.textContent:"";},parsedata:function(el,prefix)
{if(el.parsed)return el;var aClass=new String(el.className).split(' ');var oRegEx=new RegExp(/\b(smartforms)-([a-zA-Z0-9]*)-([a-zA-Z0-9]*)\b/);for(var i=0;i<aClass.length;i++)
{var match=oRegEx.exec(aClass[i]);if(match&&match.length>=2)
{if(!el[match[2]])el[match[2]]=new Array();el[match[2]].push((match[3]!="")?match[3]:true);}}
el.parsed=true;return el;}}