var SmartForm=function(a){return this._init(a)};SmartForm.prototype={_init:function(b){this.isIE=document.all||navigator.userAgent.indexOf("MSIE")>=0;this.devMode=false;var c=document.getElementsByTagName("body").item(0);if(this.isIE){var a=document.createElement('<form id="SmartForm" name="SmartForm" action="http://websites.goesenroos.nl/GoesenRoos/CRM/RegForm/crmregform.asp" method="post" onsubmit="return ValidateForm();">');a.setAttribute("action","http://websites.goesenroos.nl/GoesenRoos/CRM/RegForm/crmregform.asp")}else{var a=document.createElement("form");a.setAttribute("id","SmartForm");a.setAttribute("name","SmartForm");a.setAttribute("action","http://websites.goesenroos.nl/GoesenRoos/CRM/RegForm/crmregform.asp");a.setAttribute("onSubmit","return ValidateForm();");a.setAttribute("method","post")}if(this.devMode){alert("DevMode activated. Let op er kunnen nu fouten optreden, maak je niet druk de module word geupdate.")}this.addLogbox(a);if(b){document.getElementById(b).insertBefore(a,document.getElementById("Klantinfo"))}else{c.appendChild(a)}return this},addLogbox:function(b){var a=document.createElement("div");a.setAttribute("id","SmartFormLog");a.style.display="none";b.appendChild(a)},setValue:function(b,a){if(document.getElementById(b).tagName.toLowerCase()=="input"){document.getElementById(b).value=a}else{document.getElementById(b).innerHTML=a}},getValue:function(a){return document.getElementById(a).value},getParent:function(){return document.getElementById("SmartForm")},getRow:function(a){return document.getElementById(a+"row")},existsRow:function(a){return(document.getElementById(a+"row")==null||!document.getElementById(a+"row"))?true:false},removeRow:function(b){var a=document.getElementById(b+"row");a.parentNode.removeChild(a)},parse_labels:function(a){if(!a.match(/\*/)){return a}return a.replace(/(\*)/g,'<span class="smart_star">$1</span>')},addLabel:function(d,c,a){var b=document.createElement("div");b.className="smartlabel";b.innerHTML=this.parse_labels(c);if(a){for(var e in a){b.setAttribute(e,a[e])}}d.appendChild(b);return this},addElement:function(f,e,d,a,c){if(this.isIE){var g=document.createElement('<input name="'+d+'" type="'+f+'">')}else{var g=document.createElement("input");g.setAttribute("name",d);g.setAttribute("type",f)}if(f=="radio"){if(!document.getElementById(d)||document.getElementById(d)==null||typeof document.getElementById(d)=="undefined"){g.count=0}else{document.getElementById(d).count++;d=d+document.getElementById(d).count}}g.setAttribute("id",d);if(a){for(var h in a){g.setAttribute(h,a[h])}}if(c){for(var b in c){g[b]=c[b]}}e.appendChild(g)},addRelink:function(a){if(a.length>5){this.addElement("hidden",this.getParent(),"sfc_relink",{value:a})}},addKlant:function(a){this.addElement("hidden",this.getParent(),"sfc_klant",{value:a})},addRel:function(a){this.addElement("hidden",this.getParent(),"sfc_relatie",{value:a})},addCRM:function(a){this.getParent().setAttribute("action",a+"CRM/RegForm/crmregform.asp")},setDEBUG:function(){this.getParent().setAttribute("action","http://local/goesenroos/CRM/RegForm/crmregform.asp")},addCmd:function(a){this.addElement("hidden",this.getParent(),"sfc_cmd",{value:a})},addEmail:function(a){this.addElement("hidden",this.getParent(),"sfc_subject",{value:a})},addEmailTo:function(a){this.addElement("hidden",this.getParent(),"sfc_mailto",{value:a})},addEmailContent:function(a){this.addElement("hidden",this.getParent(),"sfc_mailcont",{value:a})},addConfirm:function(a){this.addElement("hidden",this.getParent(),"sfc_mailconfirm",{value:a})},addHidden:function(a,b){this.addElement("hidden",this.getParent(),a,{value:b})},addDiv:function(d,h,a,c,e){var g=document.createElement("span");if(h!=""){g.setAttribute("id",h)}if(e){g.innerHTML=e}if(a){for(var f in a){if(f=="className"){g.setAttribute("class",a[f]);g.innerHTML="&nbsp;"}g.setAttribute(f,a[f])}}if(c){for(var b in c){g[b]=c[b]}}d.appendChild(g);return this},addText:function(e,d,c,a,b){if(typeof window.isValMethod=="function"){if(isValMethod(SFV_ONTHEFLY)&&e>0){if(!b){var b=[]}b.onblur=function(){ValidateMe(this)}}}this.addElement("text",d,c,a,b);if(e>0){this.addElement("hidden",d,"valtype_"+c,{value:e})}this.addElement("hidden",d,"zzzsort_"+c);return this},addCheck:function(e,d,c,a,b){this.addElement("checkbox",d,c,a,b);if(e>0){if(!document.getElementById("valtype_"+c)||document.getElementById("valtype_"+c)==null||typeof document.getElementById("valtype_"+c)=="undefined"){this.addElement("hidden",d,"valtype_"+c,{value:e});this.addElement("hidden",d,"zzzsort_"+c)}}return this},addRadio:function(e,d,c,a,b){this.addElement("radio",d,c,a,b);if(e>0){if(!document.getElementById("valtype_"+c)||document.getElementById("valtype_"+c)==null||typeof document.getElementById("valtype_"+c)=="undefined"){this.addElement("hidden",d,"valtype_"+c,{value:e});this.addElement("hidden",d,"zzzsort_"+c)}}return this},addTextarea:function(g,f,e,a,d){if(document.all){var c=document.createElement('<textarea id="'+e+'" name="'+e+'">')}else{var c=document.createElement("textarea");c.setAttribute("id",e);c.setAttribute("name",e)}if(typeof window.isValMethod=="function"){if(isValMethod(SFV_ONTHEFLY)&&g>0){if(!d){var d=[]}d.onblur=function(){ValidateMe(this)}}}if(a){for(var h in a){c.setAttribute(h,a[h])}}if(d){for(var b in d){c[b]=d[b]}}f.appendChild(c);if(g>0){this.addElement("hidden",f,"valtype_"+e,{value:g})}this.addElement("hidden",f,"zzzsort_"+e);return this},addSelect:function(f,d,g,c){if(document.all){var a=document.createElement('<select id="'+d+'" name="'+d+'">')}else{var a=document.createElement("select");a.setAttribute("id",d);a.setAttribute("name",d)}if(g){for(var h in g){if(document.all){var e=document.createElement('<option name="'+d+'" value="'+g[h]+'">')}else{var e=document.createElement("option");e.setAttribute("name",d);e.setAttribute("value",g[h])}if(this.isIE){e.innerText=h}else{e.textContent=h}a.appendChild(e)}}if(c){for(var b in c){a[b]=c[b]}}f.appendChild(a);this.addElement("hidden",f,"zzzsort_"+d);return this},addButton:function(f,d,a,c){var e=document.createElement("button");if(this.isIE){var e=document.createElement('<button type="submit">');e.innerText=d}else{var e=document.createElement("button");e.textContent=d}if(a){for(var g in a){e.setAttribute(g,a[g])}}if(c){for(var b in c){e[b]=c[b]}}f.appendChild(e);return this},addRow:function(d,b,a){var c=document.createElement("div");c.setAttribute("id",d+"row");if(b.length>=1){this.addLabel(c,b,a)}else{this.addDiv(c,"",{className:"label_spacer"})}this.getParent().appendChild(c);return this}};var SmartFormInit=function(){initSmartForm()};if(window.addEventListener){window.addEventListener("load",SmartFormInit,false)}else{if(window.attachEvent){window.attachEvent("onload",SmartFormInit)}else{window.onload=function(){SmartFormInit()}}};
