var Builder={NODEMAP:{AREA:'map',CAPTION:'table',COL:'table',COLGROUP:'table',LEGEND:'fieldset',OPTGROUP:'select',OPTION:'select',PARAM:'object',TBODY:'table',TD:'table',TFOOT:'table',TH:'table',THEAD:'table',TR:'table'},node:function(i){var c=this;i=i.toUpperCase();var o=c.NODEMAP[i]||'div',l=document.createElement(o);try{l.innerHTML="<"+i+"></"+i+">"} catch(e){}
var I=l.firstChild||null;if(I&&(I.tagName!=i))I=I.getElementsByTagName(i)[0];if(!I)I=document.createElement(i);if(!I)return;if(arguments[1])if(c._isStringOrNumber(arguments[1])||(arguments[1] instanceof Array)){c._children(I,arguments[1])}else{var O=c._attributes(arguments[1]);if(O.length){try{l.innerHTML="<"+i+" "+O+"></"+i+">"} catch(e){}
I=l.firstChild||null;if(!I){I=document.createElement(i);for(attr in arguments[1])I[attr=='class'?'className':attr]=arguments[1][attr]}
if(I.tagName!=i)I=l.getElementsByTagName(i)[0]}}
if(arguments[2])c._children(I,arguments[2]);return I},_text:function(i){return document.createTextNode(i)},_attributes:function(i){var I=[];for(attribute in i)I.push((attribute=='className'?'class':attribute)+'="'+i[attribute].toString().escapeHTML()+'"');return I.join(" ")},_children:function(I,i){if(typeof i=='object'){i.flatten().each(function(i){if(typeof i=='object')I.appendChild(i)
else
if(Builder._isStringOrNumber(i))I.appendChild(Builder._text(i))})}else
if(Builder._isStringOrNumber(i))I.appendChild(Builder._text(i))},_isStringOrNumber:function(i){return(typeof i=='string'||typeof i=='number')}}
