/* BEGIN: UTILS */
function check(e){
   if(typeof e == "string"){elm = getElm(e);}else{elm = e;}
   if(elm == null || typeof elm != "object") throw Error("Element "+e+" does not exist. It is type "+typeof elm);
   return elm;
}
function getElm(e,f){
   if (f == null) f = self;
   return f.document.getElementById(e);
}
function createE(t,id){
   var elm = document.createElement(t);
   if (id != null && id != "") {
      elm.id = id;
   }
   return elm;
}
function createElm(t,id,p){
   if (p == null){
      p = document.body;
   }
   p = check(p);
   var elm = document.createElement(t);
   if (id != null && id != "") {
      elm.id = id;
   }
   p.appendChild(elm);
   return elm;
}
function getE(id){
   var elm = document.getElementById(id);
   return elm;
}
function writeTo(e,c){
   e = check(e);
   if(c == null){
      c = " ";
   }
   var tNode = document.createTextNode(c);
   e.appendChild(tNode);
}
/* END: UTILS */