/*change log: xmlhttp document loading 17082005 new */ /*prereq */ /*function list for forms suche subOpen(unid) doc nextOpen(myid) prevOpen(myid) toSearch(myid) */ var dynDoc = top.document; var docLinks; var httpreq = false; var useHttp = true; var waiting = false; var bittewar = 'Bitte warten, Edikt wird geladen!'; var msgbookmark = 'Diese Funktion ist hier nicht verfügbar!'; var title2src,thisdocnum; /*native (bookmarked) edi doc w/o search:*/ function subOpen() {}; function nextOpen() {alert(msgbookmark);}; function prevOpen() {alert(msgbookmark);}; function toSearch() {alert(msgbookmark);}; function checkSession(doc){/*entry point, called by initForm, suche31.js*/ var elem = doc.forms['_suche'].elements; if (elem['Hits']==null) return;/*not search form*/ var sel = elem['Hits'].value; if (sel==''||sel=='0') {/*before search|0 found*/ return; } if (useHttp) { subOpen = subOpenXML; nextOpen = nextOpenXML; prevOpen = prevOpenXML; toSearch = toSearchXML; initXML(doc); } else { } // alert('checkSession with useHttp='+useHttp); var wState = dynDoc.getElementById('windowState'); wState.value = 'R';/*result*/ docLinks = ''; var j = 0; for (var i=0;i0) { if (j==0) { j++; doc.links[i].focus(); } else docLinks += '-'; docLinks += href.substr(ix+9,32); } }/*for*/ docLinks = docLinks.split('-'); //alert(docLinks.length); hideId( 'divedikt', dynDoc); showId( 'divsuche', dynDoc); }/*checkSession*/ /*xmlhttp functions*/ function initXML(doc) { if (self.XMLHttpRequest) { // native object: Mozilla,Safari httpreq = new XMLHttpRequest(); } else if (self.ActiveXObject) { // IE httpreq = new ActiveXObject("Msxml2.XMLHTTP"); //Msxml2.XMLHTTP } else { // no xmlhttp alert('Old browser, XMLHTTP not available'); return false; } return true; } function subOpenXML(unid) {/*open found doc from search view*/ if (waiting) return alert(bittewar); var wState = dynDoc.getElementById('windowState'); wState.value = 'H';/*httpreq pending*/ var last = ''; if (unid==docLinks[0]) {last += '&f=1'; thisdocnum = 1;} if (unid==docLinks[docLinks.length-1]) { last += '&l=1'; thisdocnum = docLinks.length; } else { for (var i=1;i0) { doc.links[i].focus(); return; } }/*for*/ }/*setFocus2myLink*/ function onreadystatechange() { if (httpreq.readyState!=4) return; // alert('onreadystatechange\nreadyState='+httpreq.readyState); waiting = false; var trc = 'readyState=' + httpreq.readyState + '\nstatus=' + httpreq.status + '\nstatusText=' + httpreq.statusText; // alert(trc); var resp = httpreq.responseText; // alert(resp); var ix1 = resp.search(/\/i,''); var ix2 = resp.search(/\<\/title\>/i,''); var title2edi = resp.substring(ix1+7,ix2); var ix1 = resp.search(/\
/i); var ix2 = resp.search(/\<\/div\>\<\!\-\-diveddoc/i); resp = resp.substring(ix1+19,ix2); // alert(resp.substring(resp.length-50,resp.length)); // alert(httpreq.responseXML); // alert(httpreq.getAllResponseHeaders()); // var str1 = domParse(httpreq.responseXML,'',true); // alert (str1); var xmldiv = dynDoc.getElementById('divedikt'); xmldiv.innerHTML = resp; var wState = dynDoc.getElementById('windowState'); wState.value = 'D';/*document*/ /*set second title bar text*/ firstTextChild(dynDoc.getElementById('title2')).nodeValue = title2edi; ix1 = docLinks.length; resp = thisdocnum + ' von ' + ix1; dynDoc.getElementById('tosearchh').title= resp; /*set search lnk hdr title test*/ dynDoc.getElementById('tosearchf').title= resp; /*set search lnk ftr title test*/ resp = '<< ' + (thisdocnum-1) + ' von ' + ix1; if (dynDoc.getElementById('prevh')) /*set prev hdr text*/ firstTextChild(dynDoc.getElementById('prevh')).nodeValue = resp; if (dynDoc.getElementById('prevf')) /*set prev ftr text*/ firstTextChild(dynDoc.getElementById('prevf')).nodeValue = resp; resp = (thisdocnum+1) + ' von ' + ix1 + ' >>'; if (dynDoc.getElementById('nexth')) /*set next hdr text*/ firstTextChild(dynDoc.getElementById('nexth')).nodeValue = resp; if (dynDoc.getElementById('nextf')) /*set next ftr text*/ firstTextChild(dynDoc.getElementById('nextf')).nodeValue = resp; hideId( 'divsuche', dynDoc); showId( 'divedikt', dynDoc); window.top.defaultStatus = dynDoc.title; dynDoc.getElementById('tosearchh').focus(); /*set focus for FF*/ }/*onreadystatechange*/ /*low-level and test functions*/ function removeAllChildren(node) { if (node==null) return; var child1 = node.firstChild; while (child1!=null) { var child2 = child1.nextSibling; node.removeChild(child1); child1 = child2; }/*while*/ }/*removeAllChildren*/ function firstTextChild(node) { if (node==null) return null; var child1 = node.firstChild; while (child1!=null) { if (child1.nodeType==3) return child1; child1 = child1.nextSibling; }/*while*/ return null; }/*firstTextChild*/ function domTest(attr) {/*true/false; with-w/o all attribs*/ /*form prereq:

*/ // var body = document.getElementsByTagName('BODY');/*node list*/ // body = body[0]; var str1 = prompt('Id to be parsed:','divedikt'); var body = dynDoc.getElementById(str1); if (body==null) str1 = 'Id to be parsed: '+str1+' not found.'; else str1 = domParse(body,'',attr); var tgt = dynDoc.getElementById('domTest'); if (tgt==null) return alert(str1); removeAllChildren(tgt); str1 = str1.split(/\/); var br = dynDoc.createElement( 'BR' ); for (var i=0;i