// decrypt hidden email-adress and open mailer function cmailto( cryptedaddr ) { var str = unescape( cryptedaddr ); var url = "mailto:"; for ( var i=0; i < str.length; i++ ) { var char = str.charCodeAt(i) + i + 1; url = url.concat( unescape( "%" + char.toString( 16 ) ) ); } location.href = url; } // show/hidde item. toggles // name: name of element to be shown/hidden // value (optional): value to be set (block, inline, none etc) // // if these values are given, the caption of the button is altered // buttonname (opt): name of button element to be altered // bscaption (opt): innerHTML to show when element is shown // bhcaption (opt): innerHTML when it is hidden function show( element, value, button, bscaption, bhcaption, savecookie ) { // get list of elements to be passed var elist = getElements( element ); var blist = button ? getElements( button ) : new Array(); // value to be set var value = value ? value : (elist.length ? ((elist[0].style.display=='none') ? 'block' : 'none' ) : false ); // now hide / show buttons for ( var i=0; i < elist.length; i++ ) { showElement( elist[i], value ); } // modify caption of hide/show button for ( var i=0; i < blist.length; i++ ) { var bvalue = toggleButton( blist[i], value, bscaption, bhcaption ); } // save cookie if needed if ( savecookie ) { document.cookie = "display_" + savecookie + "=" + value; if ( blist.length ) { document.cookie = "button_x" + savecookie + "=" + ((value=='none') ? bvalue : "") + ";"; } } return value; } function remove_element( element ) { elm = getElements( element )[0]; elm.parentNode.removeChild( elm ); } // determine element(s) to be handled // return an array of element(s) // hook may be: // an html element with style property // an id of an element // a name of such element(s) function getElements( hook ) { if ( hook && hook.style ) { var elist = new Array( hook ); } else { // otherwise lets see if there are elemnts with that name var elist = document.getElementsByName( hook ); if ( elist.length == 0 ) { // maybe there is one with that ID elm = document.getElementById( hook ); var elist = elm ? new Array( elm ) : new Array(); } } return elist; } function showElement( element, value ) { if (element.style) { return element.style.display = value ? value : ((element.style.display == 'none') ? 'block' : 'none' ); } else { return false; } } function toggleButton( button, value, buttonscaption, buttonhcaption ) { return button.innerHTML = ( !(value) || (value == 'none') ) ? buttonscaption : buttonhcaption; } // load display status from cookie function loadDisplayCookies() { var cookies = document.cookie.split('; '); for (var i=cookies.length - 1; i>= 0; i--) { if ( cookies[i].match( /^display_/ ) ) { var sline = cookies[i].split( "=" ); show( sline[0].replace( /^display_/, "" ), sline[1] ); } if ( cookies[i].match( /^button_/ ) ) { var sline = cookies[i].split( "=" ); var blist = getElements( sline[0].replace( /^button_/, "" ) ); if ( blist.length && sline[1]) { blist[0].innerHTML = sline[1]; } } } return 0; } /* This file is part of wili-cms wili-cms - wiki like content-managament system (http://wili-cms.sourceforge.net) Copyright (C) 2004-2007 Patrick Michaelis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ // used by select links function GoURL (select) { var val = select.options[select.options.selectedIndex].value; if (val == "") { select.form.reset(); } else { top.location.href = val; } } // include a HTML page from URL // returns the content of the page function readURL( url ) { if ('undefined' == typeof(url)) return false; var p,rnd; if (document.all){ // For IE, create an ActiveX Object instance p = new ActiveXObject("Microsoft.XMLHTTP"); } else { // For mozilla, create an instance of XMLHttpRequest. p = new XMLHttpRequest(); } // Prevent browsers from caching the included page // by appending a random number rnd = Math.random().toString().substring(2); url = url.indexOf('?')>-1 ? url+'&rnd='+rnd : url+'?rnd='+rnd; // Open the url and write out the response p.open("GET",url,false); p.send(null); return p.responseText; }