var web; function tomAdd2Load(func, useCaption) { AttachEvent(window,"load",func); } function AttachEvent(obj,evt,fnc,useCapture) { if (!useCapture) useCapture=false; if (obj.addEventListener){ obj.addEventListener(evt,fnc,useCapture); return true; } else if (obj.attachEvent) return obj.attachEvent("on"+evt,fnc); else{ MyAttachEvent(obj,evt,fnc); obj['on'+evt]=function(){ MyFireEvent(obj,evt) }; } } function tomWeb(webname) { this.webname = webname; this.sandclock=""; } function init_web(webname,ortNr,tvbWeb,pageID,lang) { web = new tomWeb(webname); web.ortNr = ortNr; web.tvb = tvbWeb; web.pageID = pageID; web.lang = lang; var div = gEL("tomMain"); initGuis("tomMain"); } function initGuis(contID,par1) { var div = gEL(contID); if(!div) var div = gEL("content2"); var el = div.getElementsByTagName("div"); for (var i = 0; i < el.length; i++) { var gui = getWert(el[i].getAttribute("gui")); if(gui) { initGui(el[i],par1); } } } function initGui(div,par1) { var guiName = getWert(div.getAttribute("gui")); if(typeof(window[guiName])=="function") { var gui = new window[guiName](div); web[guiName] = gui; gui.divCont = div; } var divs = div.getElementsByTagName("div"); for (var i = 0; i < divs.length; i++) { var frm = getWert(divs[i].getAttribute("tomForm")); if(frm!=="") { var frm = initForm(divs[i]); var id2 = divs[i].getAttribute("id2"); //attach form if(gui) { frm.gui = gui; gui[id2] = frm; web[id2] = frm; }else{ web[id2] = frm; } } var typ = getWert(divs[i].getAttribute("typ")); if(!typ=="") { var ctl = initCTL(divs[i],gui,div); } } if(gui) { var fn = gui["init"]; if (fn) { if(par1) gui.loaded(par1); gui.init(); } } } function initCTL(ctldiv,gui,contDiv) { var guiID = contDiv.id; var ctl = ctldiv; while(!ctl.getAttribute("gui") && ctl.getAttribute("typ") != "tomForm" ) { ctl = ctl.parentNode; } //var parent = ctl.getAttribute("id2"); var parent = ctl.id; if(parent !== guiID) return; var typ = getWert(ctldiv.getAttribute("typ")); if(typ=="tomHtmEd") { return; } if(typeof(window[typ])=="function") { var ctl = new window[typ](ctldiv,contDiv); ctl.gui = gui; var ctlID = ctldiv.getAttribute("id2"); if(gui) gui[ctlID] = ctl; var fn = ctl["init"]; if (fn) { ctl.init(); } }else{ alert("ctl not loaded: "+typ); } } function initForm(div) { var frm = new tomForm(div); var el = div.getElementsByTagName("div"); for (var i = 0; i < el.length; i++) { var typ = getWert(el[i].getAttribute("typ")); if(typ!=="") { if(typeof(window[typ])=="function") { var ctl = new window[typ](el[i]); ctl.gui = frm; var ctlID = el[i].getAttribute("id2"); frm[ctlID] = ctl; var fn = ctl["init"]; if (fn) { //fn(); ctl.init(); } }else{ alert("ctl not loaded: "+typ); } } } return frm; } function tomDummy(){}; function getWert(wert) { if(typeof(wert) != "undefined" && wert != null) { return wert; }else{ return ""; } }