function terraform_textarea_counter(a,c,b){if(a.value.length>b)a.value=a.value.substring(0,b);else c.value=b-a.value.length}var terraFormApi={};terraFormApi.fields={};terraFormApi.forms={};terraFormApi.formatPrototypes={};function getDisabled(){return document.getElementById(this.id).disabled}function getValue(){return document.getElementById(this.id).value}function setDisabled(c){var a=this;document.getElementById(a.id).disabled=c;if(a.suffixes){var b=a.suffixes.split(",");if(b.length)for(var d in b)if(document.getElementById(a.id+"_"+b[d]))document.getElementById(a.id+"_"+b[d]).disabled=c}return c}function setValue(a){document.getElementById(this.id).value=a;return a}function toggleDisabled(){return this.setDisabled(!this.getDisabled())}function doNothing(){}function booleanGetValue(){return document.getElementById(this.id).checked}terraFormApi.formatPrototypes["boolean"]=function(b){var a=this;a.id=b;a.suffixes="label";a.getDisabled=getDisabled;a.getValue=booleanGetValue;a.setDisabled=setDisabled;a.setValue=setValue;a.toggleDisabled=toggleDisabled};terraFormApi.formatPrototypes.button=function(b){var a=this;a.id=b;a.suffixes="";a.getDisabled=getDisabled;a.getValue=getValue;a.setDisabled=setDisabled;a.setValue=setValue;a.toggleDisabled=toggleDisabled};terraFormApi.formatPrototypes.calendar=function(b){var a=this;a.id=b;a.suffixes="anchor";a.getDisabled=getDisabled;a.getValue=getValue;a.setDisabled=setDisabled;a.setValue=setValue;a.toggleDisabled=toggleDisabled};function checkboxGetValue(){for(var d=document.getElementById(this.id).title,c=[],a,b=0;b<d;b++){a=document.getElementById(this.id+"_value_"+b);a.checked&&c.push(a.value)}return c}function checkboxSetDisabled(a){var b=this;for(var d=document.getElementById(b.id).title,c=0;c<d;c++){document.getElementById(b.id+"_value_"+c).disabled=a;document.getElementById(b.id+"_label_"+c).disabled=a}document.getElementById(b.id+"_fieldset").disabled=a;return a}terraFormApi.formatPrototypes.checkbox=function(b){var a=this;a.id=b;a.getDisabled=getDisabled;a.getValue=checkboxGetValue;a.setDisabled=checkboxSetDisabled;a.setValue=setValue;a.toggleDisabled=toggleDisabled};terraFormApi.formatPrototypes.colorpicker=function(b){var a=this;a.id=b;a.suffixes="anchor";a.getDisabled=getDisabled;a.getValue=getValue;a.setDisabled=setDisabled;a.setValue=setValue;a.toggleDisabled=toggleDisabled};terraFormApi.formatPrototypes.combo=function(b){var a=this;a.id=b;a.suffixes="select";a.getDisabled=getDisabled;a.getValue=getValue;a.setDisabled=setDisabled;a.setValue=setValue;a.toggleDisabled=toggleDisabled};function datepickerGetValue(){var c=document.getElementById(this.id+"_year").value,b=document.getElementById(this.id+"_month").value,a=document.getElementById(this.id+"_day").value;if(c>0&&b>0&&a>0)return new Date(c,b-1,a);else return null}function datepickerSetValue(a){document.getElementById(this.id+"_year").value=a.getFullYear();document.getElementById(this.id+"_month").value=a.getMonth()+1;document.getElementById(this.id+"_day").value=a.getDate()}terraFormApi.formatPrototypes.datepicker=function(b){var a=this;a.id=b;a.suffixes="day,month,year";a.getDisabled=getDisabled;a.getValue=datepickerGetValue;a.setDisabled=setDisabled;a.setValue=datepickerSetValue;a.toggleDisabled=toggleDisabled};function divSelectChoose(a,e,h){var g="_wrapper",f="divSelectSelected",c="_option_";if(h){var d="";if(document.getElementById(a+c+e).className==f)document.getElementById(a+c+e).className="";else document.getElementById(a+c+e).className=f;for(var b=1;b<=document.getElementById(a+g).childNodes.length;b++)if(document.getElementById(a+c+b).className==f)d=d+","+document.getElementById(a+"_value_"+b).innerHTML;if(d.length>0)d=d.substr(1);document.getElementById(a).value=d}else{document.getElementById(a).value=document.getElementById(a+"_value_"+e).innerHTML;for(var b=1;b<=document.getElementById(a+g).childNodes.length;b++)document.getElementById(a+c+b).className="";document.getElementById(a+c+e).className=f}}terraFormApi.formatPrototypes.divselect=terraFormApi.formatPrototypes.button;terraFormApi.formatPrototypes.enhancedfile=terraFormApi.formatPrototypes.button;terraFormApi.formatPrototypes.fckeditor=terraFormApi.formatPrototypes.button;terraFormApi.formatPrototypes.file=terraFormApi.formatPrototypes.button;terraFormApi.formatPrototypes.hidden=terraFormApi.formatPrototypes.button;terraFormApi.formatPrototypes.htmlarea=function(b){var a=this;a.id=b;a.suffixes="";a.getDisabled=getDisabled;a.getValue=getValue;a.setDisabled=doNothing;a.setValue=setValue;a.toggleDisabled=doNothing};terraFormApi.formatPrototypes.image=terraFormApi.formatPrototypes.button;terraFormApi.formatPrototypes.moveselect=function(b){var a=this;a.id=b;a.suffixes="left,right,heading1,heading2,button1,button2,button3,button4";a.getDisabled=getDisabled;a.getValue=getValue;a.setDisabled=setDisabled;a.setValue=setValue;a.toggleDisabled=toggleDisabled};terraFormApi.formatPrototypes.msslider=terraFormApi.formatPrototypes.button;terraFormApi.formatPrototypes["null"]=function(b){var a=this;a.id=b;a.suffixes="";a.getDisabled=doNothing;a.getValue=doNothing;a.setDisabled=doNothing;a.setValue=doNothing;a.toggleDisabled=doNothing};terraFormApi.formatPrototypes.numeric=terraFormApi.formatPrototypes.button;terraFormApi.formatPrototypes.password=terraFormApi.formatPrototypes.button;terraFormApi.formatPrototypes.radio=terraFormApi.formatPrototypes.checkbox;function selectSetDisabled(c){var a=this;document.getElementById(a.id).disabled=c;if(a.suffixes){var b=a.suffixes.split(",");if(b.length)for(var d in b)if(document.getElementById(a.id+"_"+b[d]))document.getElementById(a.id+"_"+b[d]).disabled=c}return c}terraFormApi.formatPrototypes.select=function(b){var a=this;a.id=b;a.suffixes="";a.getDisabled=getDisabled;a.getValue=getValue;a.setDisabled=selectSetDisabled;a.setValue=setValue;a.toggleDisabled=toggleDisabled};function spineditSetDisabled(d){var f="_downDisabled",c="inline",e="_upDisabled",b="none",a=this;document.getElementById(a.id).disabled=d;if(d){document.getElementById(a.id+"_up").style.display=b;document.getElementById(a.id+"_down").style.display=b;document.getElementById(a.id+e).style.display=c;document.getElementById(a.id+f).style.display=c}else{document.getElementById(a.id+"_up").style.display=c;document.getElementById(a.id+"_down").style.display=c;document.getElementById(a.id+e).style.display=b;document.getElementById(a.id+f).style.display=b}return d}terraFormApi.formatPrototypes.spinedit=function(b){var a=this;a.id=b;a.suffixes="";a.getDisabled=getDisabled;a.getValue=getValue;a.setDisabled=spineditSetDisabled;a.setValue=setValue;a.toggleDisabled=toggleDisabled};function starsSetDisabled(b){var d="_enabledStars",c="_disabledStars",a=this;document.getElementById(a.id).disabled=b;if(b){document.getElementById(a.id+c).style.display="inline";document.getElementById(a.id+d).style.display="none"}else{document.getElementById(a.id+c).style.display="none";document.getElementById(a.id+d).style.display="inline"}return b}terraFormApi.formatPrototypes.stars=function(b){var a=this;a.id=b;a.suffixes="";a.getDisabled=getDisabled;a.getValue=getValue;a.setDisabled=starsSetDisabled;a.setValue=setValue;a.toggleDisabled=toggleDisabled};function submitSetDisabled(a){document.getElementById(this.id).disabled=a;return a}terraFormApi.formatPrototypes.submit=function(b){var a=this;a.id=b;a.suffixes="";a.getDisabled=getDisabled;a.getValue=getValue;a.setDisabled=submitSetDisabled;a.setValue=setValue;a.toggleDisabled=toggleDisabled};terraFormApi.formatPrototypes.submitbutton=terraFormApi.formatPrototypes.submit;terraFormApi.formatPrototypes.text=terraFormApi.formatPrototypes.button;terraFormApi.formatPrototypes.textarea=terraFormApi.formatPrototypes.button;function timepickerGetValue(){var d="_seconds",c="_minutes",b=this,a=document.getElementById(b.id+"_hours").value;if(document.getElementById(b.id+c))a=a+":"+document.getElementById(b.id+c).value;if(document.getElementById(b.id+d))a=a+":"+document.getElementById(b.id+d).value;if(document.getElementById(b.id+"_ampm"))a=a+" "+document.getElementById(b.id+"_ampm").value;return a}terraFormApi.formatPrototypes.timepicker=function(b){var a=this;a.id=b;a.suffixes="hours,minutes,seconds,ampm";a.getDisabled=getDisabled;a.getValue=timepickerGetValue;a.setDisabled=setDisabled;a.setValue=setValue;a.toggleDisabled=toggleDisabled};function timespanpickerGetValue(){var d="_seconds",c="_minutes",a=this,b=0,e=document.getElementById(a.id+"_baseUnit").value;if(document.getElementById(a.id+"_days"))b+=parseInt(document.getElementById(a.id+"_days").value*86400);if(document.getElementById(a.id+"_hours"))b+=parseInt(document.getElementById(a.id+"_hours").value*3600);if(document.getElementById(a.id+c))b+=parseInt(document.getElementById(a.id+c).value*60);if(document.getElementById(a.id+d))b+=parseInt(document.getElementById(a.id+d).value);switch(e){case "d":return b/86400;case "h":return b/3600;case "n":return b/60;case "s":return b}}terraFormApi.formatPrototypes.timespanpicker=function(b){var a=this;a.id=b;a.suffixes="days,hours,minutes,seconds";a.getDisabled=getDisabled;a.getValue=timespanpickerGetValue;a.setDisabled=setDisabled;a.setValue=setValue;a.toggleDisabled=toggleDisabled};terraFormApi.formatPrototypes.url=function(b){var a=this;a.id=b;a.suffixes="button";a.getDisabled=getDisabled;a.getValue=getValue;a.setDisabled=setDisabled;a.setValue=setValue;a.toggleDisabled=toggleDisabled};function terraFormRefresh(b){var a=b.target?b.target.form:b.srcElement.form;a.elements[a.name].value="refresh";a.submit()}isMac=navigator.appVersion.indexOf("Mac")!=-1?true:false;NS4=document.layers?true:false;IEmac=document.all&&isMac?true:false;IE4plus=document.all?true:false;IE4=document.all&&navigator.appVersion.indexOf("MSIE 4.")!=-1?true:false;IE5=document.all&&navigator.appVersion.indexOf("MSIE 5.")!=-1?true:false;ver4=NS4||IE4plus?true:false;NS6=!document.layers&&navigator.userAgent.indexOf("Netscape")!=-1?true:false;var gSafeOnload=[];function SafeAddOnload(a){if(IEmac&&IE4){window.onload=SafeOnload;gSafeOnload[gSafeOnload.length]=a}else if(window.onload){if(window.onload!=SafeOnload){gSafeOnload[0]=window.onload;window.onload=SafeOnload}gSafeOnload[gSafeOnload.length]=a}else window.onload=a}function SafeOnload(){for(var a=0;a<gSafeOnload.length;a++)gSafeOnload[a]()}function hidebuttons(b){document.body.style.cursor="wait";if(document.all||document.getElementById)for(i=0;i<b.length;i++){var a=b.elements[i];try{if(a.type.toLowerCase()=="submit"||a.type.toLowerCase()=="button"){var d=a.name.match(/_hidden$/);if(d)a.style.display="inline";else a.style.display="none"}}catch(c){}}}function comboLookup(g){var f="character",c=document.getElementById(g),b=document.getElementById(g+"_select");b.selectedIndex=-1;if(c.createTextRange){var h=window.event;if(h.keyCode!=8&&h.keyCode!=46){var d=c.value.toLowerCase();if(d.length)for(var a=0;a<b.options.length;a++)if(d==b.options[a].innerHTML.substr(0,d.length).toLowerCase()){b.selectedIndex=a;c.value=b.options[a].innerHTML;var e=c.createTextRange();e.moveStart(f,d.length);e.select()}}else{var d=c.value.toLowerCase();if(d.length)for(var a=0;a<b.options.length;a++)if(d==b.options[a].innerHTML.toLowerCase()){b.selectedIndex=a;c.value=b.options[a].innerHTML;var e=c.createTextRange();e.moveStart(f,d.length);e.select()}}}}terraFormApi.formatPrototypes.soeditor=terraFormApi.formatPrototypes.button;terraFormApi.formatPrototypes.tinymce=terraFormApi.formatPrototypes.button