//-- springen naar een stuk tekst function goTo(q) { for(i=0; i < document.anchors.length; i++){ a = document.anchors[i].name; if( a == q ){ window.location.hash = a; return; } } } //-- Popup openen function winopen(url, width, height) { if(!width) { width=450; } if(!height) { height=550; } window.open(url, "_blank","toolbar=no,location=no,menubar=no,scrollbars=yes,width="+width+",height="+height+",resizeable=no,status=no"); } //-- Windowopen function bigwinopen(location) { if(location!="") { window.open(location, "_blank"); } } //-- Sluiten function closewin(){ window.close(); } //-- Filechooser: var lastFilechooseOpener = null; var lastFileopenerType = 0; //0 = standaard, 1 = tumbnailchooser, 2 = editor function openFileChooser(name,type,small){ lastFilechooseOpener = name; lastFileopenerType = 0; //standaard var url = 'index.php?action=filemanager&subaction=filechooser'; if(type) url += '&type='+type; if(small) url += '&size='+small; winopen(url,500,300); } function openThumbnailChooser(name){ lastFilechooseOpener = name; lastFileopenerType = 1; //thumbnailchooser var url = 'index.php?action=filemanager&subaction=filechooser&type=image&size=small'; winopen(url,500,300); } function clearFileChooser(name){ eval("window.document.form."+name+"_id.value = '';"); eval("window.document.form."+name+"_text.value = '';"); eval("window.document.form."+name+"_resetbtn.disabled = true;"); } function clearThumbnailChooser(name){ eval("window.document.form."+name+"_id.value = '';"); eval("window.document.images."+name+"_img.src = 'gfx/empty.gif';"); eval("window.document.form."+name+"_resetbtn.disabled = true;"); } function viewfile(name){ var id = eval("window.document.form."+name+"_id.value"); winopen("?action=filemanager&subaction=view&id="+id,640,480); } function setFile(id,name,size){ if(lastFilechooseOpener == null) return; if(lastFileopenerType == 0){ //standaard eval("window.document.form."+lastFilechooseOpener+"_id.value = "+id+";"); eval("window.document.form."+lastFilechooseOpener+"_text.value = '"+name+"';"); eval("window.document.form."+lastFilechooseOpener+"_resetbtn.disabled = false;"); eval("window.document.form."+lastFilechooseOpener+"_view.disabled = false;"); } else if(lastFileopenerType == 1){ //thumbnail chooser: eval("window.document.form."+lastFilechooseOpener+"_id.value = "+id+";"); eval("window.document.images."+lastFilechooseOpener+"_img.src = 'http://www.heren2be.nl/beheer/viewfile.php?id="+id+"&size=small';"); eval("window.document.form."+lastFilechooseOpener+"_resetbtn.disabled = false;"); } else if(lastFileopenerType == 2){ //editor: var url = "http://www.heren2be.nl/beheer/viewfile.php?id="+id+"&size="+size; setImage(url); // addImage(url); } lastFilechooseOpener = null; lastFileopenerType = 0; } //----------------------------------Browser Detect Lite--------------------------------------/// function BrowserDetectLite() { var ua = navigator.userAgent.toLowerCase(); // browser name this.isGecko = (ua.indexOf('gecko') != -1 && ua.indexOf('safari') == -1); this.isMozilla = (this.isGecko && ua.indexOf('gecko/') + 14 == ua.length); this.isNS = ( (this.isGecko) ? (ua.indexOf('netscape') != -1) : ( (ua.indexOf('mozilla') != -1) && (ua.indexOf('spoofer') == -1) && (ua.indexOf('compatible') == -1) && (ua.indexOf('opera') == -1) && (ua.indexOf('webtv') == -1) && (ua.indexOf('hotjava') == -1) ) ); this.isIE = ( (ua.indexOf('msie') != -1) && (ua.indexOf('opera') == -1) && (ua.indexOf('webtv') == -1) ); this.isSafari = (ua.indexOf('safari') != - 1); this.isOpera = (ua.indexOf('opera') != -1); this.isKonqueror = (ua.indexOf('konqueror') != -1 && !this.isSafari); this.isIcab = (ua.indexOf('icab') != -1); this.isAol = (ua.indexOf('aol') != -1); // spoofing and compatible browsers this.isIECompatible = ( (ua.indexOf('msie') != -1) && !this.isIE); this.isNSCompatible = ( (ua.indexOf('mozilla') != -1) && !this.isNS && !this.isMozilla); // browser version this.versionMinor = parseFloat(navigator.appVersion); // correct version number if (this.isNS && this.isGecko) { this.versionMinor = parseFloat( ua.substring( ua.lastIndexOf('/') + 1 ) ); } else if (this.isIE && this.versionMinor >= 4) { this.versionMinor = parseFloat( ua.substring( ua.indexOf('msie ') + 5 ) ); } else if (this.isMozilla) { this.versionMinor = parseFloat( ua.substring( ua.indexOf('rv:') + 3 ) ); } else if (this.isSafari) { this.versionMinor = parseFloat( ua.substring( ua.lastIndexOf('/') + 1 ) ); } else if (this.isOpera) { if (ua.indexOf('opera/') != -1) { this.versionMinor = parseFloat( ua.substring( ua.indexOf('opera/') + 6 ) ); } else { this.versionMinor = parseFloat( ua.substring( ua.indexOf('opera ') + 6 ) ); } } else if (this.isKonqueror) { this.versionMinor = parseFloat( ua.substring( ua.indexOf('konqueror/') + 10 ) ); } else if (this.isIcab) { if (ua.indexOf('icab/') != -1) { this.versionMinor = parseFloat( ua.substring( ua.indexOf('icab/') + 6 ) ); } else { this.versionMinor = parseFloat( ua.substring( ua.indexOf('icab ') + 6 ) ); } } this.versionMajor = parseInt(this.versionMinor); this.geckoVersion = ( (this.isGecko) ? ua.substring( (ua.lastIndexOf('gecko/') + 6), (ua.lastIndexOf('gecko/') + 14) ) : -1 ); // dom support this.isDOM1 = (document.getElementById); this.isDOM2Event = (document.addEventListener && document.removeEventListener); // css compatibility mode this.mode = document.compatMode ? document.compatMode : 'BackCompat'; // platform this.isWin = (ua.indexOf('win') != -1); this.isWin32 = (this.isWin && ( ua.indexOf('95') != -1 || ua.indexOf('98') != -1 || ua.indexOf('nt') != -1 || ua.indexOf('win32') != -1 || ua.indexOf('32bit') != -1 || ua.indexOf('xp') != -1) ); this.isMac = (ua.indexOf('mac') != -1); this.isUnix = (ua.indexOf('unix') != -1 || ua.indexOf('sunos') != -1 || ua.indexOf('bsd') != -1 || ua.indexOf('x11') != -1) this.isLinux = (ua.indexOf('linux') != -1); // specific browser shortcuts this.isNS4x = (this.isNS && this.versionMajor == 4); this.isNS40x = (this.isNS4x && this.versionMinor < 4.5); this.isNS47x = (this.isNS4x && this.versionMinor >= 4.7); this.isNS4up = (this.isNS && this.versionMinor >= 4); this.isNS6x = (this.isNS && this.versionMajor == 6); this.isNS6up = (this.isNS && this.versionMajor >= 6); this.isNS7x = (this.isNS && this.versionMajor == 7); this.isNS7up = (this.isNS && this.versionMajor >= 7); this.isIE4x = (this.isIE && this.versionMajor == 4); this.isIE4up = (this.isIE && this.versionMajor >= 4); this.isIE5x = (this.isIE && this.versionMajor == 5); this.isIE55 = (this.isIE && this.versionMinor == 5.5); this.isIE5up = (this.isIE && this.versionMajor >= 5); this.isIE6x = (this.isIE && this.versionMajor == 6); this.isIE6up = (this.isIE && this.versionMajor >= 6); this.isIE4xMac = (this.isIE4x && this.isMac); } var browser = new BrowserDetectLite(); //---------------------------------- end //---------------------------------- Sortable table functions -------------------------///// function SortableTable(oTable, oSortTypes) { this.element = oTable; this.tHead = oTable.tHead; this.tBody = oTable.tBodies[0]; this.document = oTable.ownerDocument || oTable.document; this.sortColumn = null; this.descending = null; var oThis = this; this._headerOnclick = function (e) { oThis.headerOnclick(e); }; // only IE needs this var win = this.document.defaultView || this.document.parentWindow; this._onunload = function () { oThis.destroy(); }; if (win && typeof win.attachEvent != "undefined") { win.attachEvent("onunload", this._onunload); } this.initHeader(oSortTypes || []); } SortableTable.gecko = navigator.product == "Gecko"; SortableTable.msie = /msie/i.test(navigator.userAgent); // Mozilla is faster when doing the DOM manipulations on // an orphaned element. MSIE is not SortableTable.removeBeforeSort = SortableTable.gecko; function addClassName(el, sClassName) { var s = el.className; var p = s.split(" "); var l = p.length; for (var i = 0; i < l; i++) { if (p[i] == sClassName) return; } p[p.length] = sClassName; el.className = p.join(" "); } function removeClassName(el, sClassName) { var s = el.className; var p = s.split(" "); var np = []; var l = p.length; var j = 0; for (var i = 0; i < l; i++) { if (p[i] != sClassName) np[j++] = p[i]; } el.className = np.join(" "); } SortableTable.prototype.onsort = function () { var rows = st.tBody.rows; var l = rows.length; for (var i = 0; i < l; i++) { removeClassName(rows[i], i % 2 ? "row0" : "row1"); addClassName(rows[i], i % 2 ? "row1" : "row0"); } }; // adds arrow containers and events // also binds sort type to the header cells so that reordering columns does // not break the sort types SortableTable.prototype.initHeader = function (oSortTypes) { var cells = this.tHead.rows[0].cells; var l = cells.length; var img, c; for (var i = 0; i < l; i++) { c = cells[i]; img = this.document.createElement("IMG"); img.src = "gfx/blank.png"; c.appendChild(img); if (oSortTypes[i] != null) { c._sortType = oSortTypes[i]; } if (typeof c.addEventListener != "undefined") c.addEventListener("click", this._headerOnclick, false); else if (typeof c.attachEvent != "undefined") c.attachEvent("onclick", this._headerOnclick); } this.updateHeaderArrows(); }; // remove arrows and events SortableTable.prototype.uninitHeader = function () { var cells = this.tHead.rows[0].cells; var l = cells.length; var c; for (var i = 0; i < l; i++) { c = cells[i]; c.removeChild(c.lastChild); if (typeof c.removeEventListener != "undefined") c.removeEventListener("click", this._headerOnclick, false); else if (typeof c.detachEvent != "undefined") c.detachEvent("onclick", this._headerOnclick); } }; SortableTable.prototype.updateHeaderArrows = function () { var cells = this.tHead.rows[0].cells; var l = cells.length; var img; for (var i = 0; i < l; i++) { img = cells[i].lastChild; if (i == this.sortColumn) img.className = "sort-arrow " + (this.descending ? "descending" : "ascending"); else img.className = "sort-arrow"; } }; SortableTable.prototype.headerOnclick = function (e) { // find TD element var el = e.target || e.srcElement; while (el.tagName != "TD") el = el.parentNode; this.sort(el.cellIndex); }; SortableTable.prototype.getSortType = function (nColumn) { var cell = this.tHead.rows[0].cells[nColumn]; var val = cell._sortType; if (val != "") return val; return "String"; }; // only nColumn is required // if bDescending is left out the old value is taken into account // if sSortType is left out the sort type is found from the sortTypes array SortableTable.prototype.sort = function (nColumn, bDescending, sSortType) { if (sSortType == null) sSortType = this.getSortType(nColumn); // exit if None if (sSortType == "None") return; if (bDescending == null) { if (this.sortColumn != nColumn) this.descending = true; else this.descending = !this.descending; } else{ if(this.sortColumn != nColumn) this.descending = true; else if(this.descending) this.descending = false; else this.descending = true; } this.sortColumn = nColumn; if (typeof this.onbeforesort == "function") this.onbeforesort(); var f = this.getSortFunction(sSortType, nColumn); var a = this.getCache(sSortType, nColumn); var tBody = this.tBody; a.sort(f); if (this.descending) a.reverse(); if (SortableTable.removeBeforeSort) { // remove from doc var nextSibling = tBody.nextSibling; var p = tBody.parentNode; p.removeChild(tBody); } // insert in the new order var l = a.length; for (var i = 0; i < l; i++) tBody.appendChild(a[i].element); if (SortableTable.removeBeforeSort) { // insert into doc p.insertBefore(tBody, nextSibling); } this.updateHeaderArrows(); this.destroyCache(a); if (typeof this.onsort == "function") this.onsort(); }; SortableTable.prototype.asyncSort = function (nColumn, bDescending, sSortType) { var oThis = this; this._asyncsort = function () { oThis.sort(nColumn, bDescending, sSortType); }; window.setTimeout(this._asyncsort, 1); }; SortableTable.prototype.getCache = function (sType, nColumn) { var rows = this.tBody.rows; var l = rows.length; var a = new Array(l); var r; for (var i = 0; i < l; i++) { r = rows[i]; a[i] = { value: this.getRowValue(r, sType, nColumn), element: r }; }; return a; }; SortableTable.prototype.destroyCache = function (oArray) { var l = oArray.length; for (var i = 0; i < l; i++) { oArray[i].value = null; oArray[i].element = null; oArray[i] = null; } } SortableTable.prototype.getRowValue = function (oRow, sType, nColumn) { var s; var c = oRow.cells[nColumn]; if (typeof c.innerText != "undefined") s = c.innerText; else s = SortableTable.getInnerText(c); return this.getValueFromString(s, sType); }; SortableTable.getInnerText = function (oNode) { var s = ""; var cs = oNode.childNodes; var l = cs.length; for (var i = 0; i < l; i++) { switch (cs[i].nodeType) { case 1: //ELEMENT_NODE s += SortableTable.getInnerText(cs[i]); break; case 3: //TEXT_NODE s += cs[i].nodeValue; break; } } return s; } SortableTable.prototype.getValueFromString = function (sText, sType) { switch (sType) { case "Number": return Number(sText); case "CaseInsensitiveString": return sText.toUpperCase(); case "Date": var parts = sText.split("-"); var d = new Date(0); d.setFullYear(parts[0]); d.setDate(parts[2]); d.setMonth(parts[1] - 1); return d.valueOf(); } return sText; }; SortableTable.prototype.getSortFunction = function (sType, nColumn) { return function compare(n1, n2) { if (n1.value < n2.value) return -1; if (n2.value < n1.value) return 1; return 0; }; }; SortableTable.prototype.destroy = function () { this.uninitHeader(); var win = this.document.parentWindow; if (win && typeof win.detachEvent != "undefined") {//only IE needs this win.detachEvent("onunload", this._onunload); } this._onunload = null; this.element = null; this.tHead = null; this.tBody = null; this.document = null; this._headerOnclick = null; this.sortTypes = null; this._asyncsort = null; this.onsort = null; };