function xHTML(){this.canEnter=false;this.lastObject;};xHTML.prototype.table=function(parent,name,cellpadding,cellspacing){var el=document.createElement('table');if(this.isParam(name))this.setNameId(el,name);el.setAttribute('width','100%');el.setAttribute('cellPadding',cellpadding);el.setAttribute('cellSpacing',cellspacing);var tblBody=document.createElement('tbody');el.appendChild(tblBody);this.appendChild(parent,el);return el;};xHTML.prototype.th=function(parent,name,txt,colspan){var el=document.createElement('th');if(this.isParam(name))this.setNameId(el,name);if(this.isParam(colspan))el.colSpan=colspan;if(this.isParam(txt))el.appendChild(document.createTextNode(txt));this.appendChild(parent,el);return el;};xHTML.prototype.tr=function(parent,name){var el=document.createElement('tr');if(this.isParam(name))this.setNameId(el,name);if(parent==null)this.lastObject.getElementsByTagName("tbody")[0].appendChild(el);else if(typeof(parent)=='object'){if(parent.getElementsByTagName("tbody")[0])parent.getElementsByTagName("tbody")[0].appendChild(el);else parent.appendChild(el);}else document.getElementById(parent).getElementsByTagName("tbody")[0].appendChild(el);this.lastObject=el;return el;};xHTML.prototype.td=function(parent,name,txt,width){var el=document.createElement('td');if(this.isParam(name))this.setNameId(el,name);if(this.isParam(txt)){if(document.all)el.innerText=txt;else el.textContent=txt;}
if(this.isParam(width))el.setAttribute('width',width);this.appendChild(parent,el);return el;};xHTML.prototype.div=function(parent,name,txt,border){var el=document.createElement('div');if(this.isParam(name))this.setNameId(el,name);if(this.isParam(txt))el.innerHTML=txt;if(this.isParam(border))el.style.border=border;this.appendChild(parent,el);return el;};xHTML.prototype.span=function(parent,name,txt,border){var el=document.createElement('span');if(this.isParam(name))this.setNameId(el,name);el.innerHTML=txt;el.style.border=border;this.appendChild(parent,el);return el;};xHTML.prototype.form=function(parent,name,formMethod,autocomplete){var el=document.createElement('form');if(this.isParam(name))this.setNameId(el,name);if(this.isParam(formMethod))el.setAttribute('method',formMethod);if(this.isParam(autocomplete))el.setAttribute('autocomplete',autocomplete);eval("el.onkeypress=function(theEvent){return enterKey(theEvent?theEvent:event)}");this.appendChild(parent,el);return el;};xHTML.prototype.input=function(parent,name,type,value,width){var el=document.createElement('input');if(this.isParam(name))this.setNameId(el,name);if(!this.isParam(type))type="text";el.setAttribute('type',type);el.setAttribute('value',value);if(this.isParam(width))el.style.width=width;this.appendChild(parent,el);return el;};xHTML.prototype.textarea=function(parent,name,value,cols,rows){var el=document.createElement('textarea');if(this.isParam(name))this.setNameId(el,name);el.setAttribute('cols',cols);el.setAttribute('rows',rows);eval("el.onfocus=function(){return xHTML.enableEnterKey()}");eval("el.onblur=function(){return xHTML.enableEnterKey()}");el.appendChild(document.createTextNode(value));function resize(){el.setAttribute('rows',el.rows+5);}
eval("el.ondblclick = function(){resize();}");this.appendChild(parent,el);return el;};xHTML.prototype.select=function(parent,name,multidimension,selected){var el=document.createElement('select');if(this.isParam(name))this.setNameId(el,name);if(multidimension!=null){for(var i=0;i<multidimension.length;i++){if(selected==multidimension[i][0]){el.options[i]=new Option(multidimension[i][1],multidimension[i][0],true,true);el.options[i].selected=true;}else{el.options[i]=new Option(multidimension[i][1],multidimension[i][0],false,false);}}}
this.appendChild(parent,el);return el;};xHTML.prototype.removeOptions=function(parent){var elSel=parent;if(typeof(parent)!='object')elSel=document.getElementById(parent);if(elSel.length>0){for(var i=elSel.length-1;i>=0;i--)elSel.remove(i);}};xHTML.prototype.appendOption=function(parent,text,value,selected){var elSel=parent;if(typeof(parent)!='object')elSel=document.getElementById(parent);var elOptNew=document.createElement('option');elOptNew.text=text;elOptNew.value=value;if(selected==1){elOptNew.selected=true;}
try{elSel.add(elOptNew,null);}
catch(ex){elSel.add(elOptNew);}};xHTML.prototype.setOptionSelected=function(parent,selected){var elSel=parent;if(typeof(parent)!='object')elSel=document.getElementById(parent);if(elSel.length>0){for(var i=elSel.length-1;i>=0;i--){if(elSel.options[i].value==selected)elSel.options[i].selected=true;}}};xHTML.prototype.radio=function(parent,name,value,txt,checked){return xHTML.radioCheck('radio',parent,name,value,txt,checked);};xHTML.prototype.checkbox=function(parent,name,value,txt,checked){return xHTML.radioCheck('checkbox',parent,name,value,txt,checked);};xHTML.prototype.radioCheck=function(type,parent,name,value,txt,checked){var el;var txtNode=document.createTextNode(txt);if(document.all)el=document.createElement('<input type="'+type+'" id="'+name+'" value="'+value+'"" name="'+name+'""/>');else{el=document.createElement('input');if(this.isParam(name))this.setNameId(el,name);el.setAttribute('value',value);el.setAttribute('type',type);}
if(checked=='checked'||checked==1){el.setAttribute('checked','checked');el.defaultChecked=true;}
this.appendChild(parent,el,0);this.appendChild(parent,txtNode,0);this.lastObject=el;return el;};xHTML.prototype.a=function(parent,name,href,txt,classname,action,funct){var el=document.createElement('a');if(this.isParam(href))el.setAttribute('href',href);if(this.isParam(classname)){this.setClass(el,classname);}
if(this.isParam(name))this.setNameId(el,name);if(this.isParam(action))eval("el."+action+"="+funct);if(this.isParam(txt))el.appendChild(document.createTextNode(txt));this.appendChild(parent,el);return el;};xHTML.prototype.img=function(parent,name,src,width,height,classname,alt,border){var el=document.createElement('img');if(this.isParam(name))this.setNameId(el,name);el.setAttribute("src",src);if(this.isParam(width)){el.setAttribute('width',width);el.style.width=width;}
if(this.isParam(height)){el.setAttribute('height',height);el.style.height=height;}
if(this.isParam(classname)){this.setClass(el,classname);}
if(this.isParam(alt))el.setAttribute("alt",alt);if(this.isParam(border))el.setAttribute("border",border);this.appendChild(parent,el);return el;};xHTML.prototype.br=function(parent){var el=document.createElement('br');this.appendChild(parent,el);return el;};xHTML.prototype.text=function(parent,txt){var el=document.createTextNode(txt);this.appendChild(parent,el);return el;};xHTML.prototype.hr=function(parent){var el=document.createElement('HR');this.appendChild(parent,el);return el;};xHTML.prototype.ul=function(parent,name,classname){var el=document.createElement('ul');if (this.isParam(classname)) this.setClass(el,classname);if (this.isParam(name)) this.setNameId(el,name);this.appendChild(parent,el);return el;};xHTML.prototype.li=function(parent,html,classname,name){var el=document.createElement('li');if(this.isParam(html))el.innerHTML=html;if(this.isParam(classname)){this.setClass(el,classname);}
if(this.isParam(name))this.setNameId(el,name);this.appendChild(parent,el);return el;};xHTML.prototype.dateCombo=function(parent,name,format,datum,startjaar,stopjaar){var el;if(parent==null)el=this.lastObject;else if(typeof(parent)=='object')el=parent;else el=document.getElementById(parent);var combos=format.split('-');var selected=datum.split('-');populateArray=function(start,stop,step){var m=new Array();t=0;for(var j=start;j<=stop;j=j+step){var a=new Array();a[1]=a[0]=j;m[t]=a;t++;}
return m;};for(var i=0;i<combos.length;i++){if(combos[i]=="yyyy"){Now=new Date();if(typeof startjaar=='undefined')startjaar=Now.getFullYear()-50;if(typeof stopjaar=='undefined')stopjaar=Now.getFullYear()+10;xHTML.select(el,name+'jaar',populateArray(startjaar,stopjaar,1),selected[i]);}else if(combos[i]=="MM"){var multidimension=new Array();var maanden=new Array();maanden[0]="Januari";maanden[1]="Februari";maanden[2]="Maart";maanden[3]="April";maanden[4]="Mei";maanden[5]="Juni";maanden[6]="Juli";maanden[7]="Augustus";maanden[8]="September";maanden[9]="Oktober";maanden[10]="November";maanden[11]="December";for(var j=0;j<12;j++){var maand=new Array();maand[1]=maanden[j];maand[0]=j;multidimension[j]=maand;}
xHTML.select(el,name+'maand',multidimension,selected[i]-1);}else if(combos[i]=="dd"){xHTML.select(el,name+'dag',populateArray(1,32,1),selected[i]);}else if(combos[i]=="HH"){xHTML.select(el,name+'uur',populateArray(0,23,1),selected[i]);}else if(combos[i]=="mm"){xHTML.select(el,name+'min',populateArray(0,59,1),selected[i]);}else if(combos[i]=="mm5"){xHTML.select(el,name+'min',populateArray(0,59,5),selected[i]);}else if(combos[i]=="mm15"){xHTML.select(el,name+'min',populateArray(0,59,15),selected[i]);}}};xHTML.prototype.enterKey=function(e){var key;if(window.event)key=window.event.keyCode;else key=e.which;if(key==13&&canEnter==false)return false;else return true;};xHTML.prototype.enableEnterKey=function(){this.canEnter=true;};xHTML.prototype.disableEnterKey=function(){this.canEnter=false;};xHTML.prototype.appendChild=function(parent,obj,setLast){if(parent==null)this.lastObject.appendChild(obj);else if(typeof(parent)=='object')parent.appendChild(obj);else document.getElementById(parent).appendChild(obj);if(!setLast||setLast==null)this.lastObject=obj;};xHTML.prototype.isParam=function(param){if(param!=null&&typeof(param)!='undefined'&&param!='')return true;else return false;};xHTML.prototype.setNameId=function(e,name){if(e){e.setAttribute("id",name);e.setAttribute("name",name);}};xHTML.prototype.setClass=function(e,c,o){if(e){if(!this.isParam(o))o=false;if(!o&&e.className!=""){e.className+=" "+c;}else{e.className=c;}}};xHTML.prototype.removeClass=function(e,c){if(e){var newClass=new String(e.className);var result="";newClass=newClass.split(' ');for(var i in newClass){if(newClass[i]!=c){result+=newClass[i]+' ';}}
e.className=result;}};
