// decrypt hidden email-adress and open mailer function cmailto( cryptedaddr ) { var str = unescape( cryptedaddr ); url = "mailto:" + str_xor( str, "asdkfj13290c93id" ); location.href = url; } function str_xor( a, b ) { var j=0; var c=""; for (i=0;i= b.length) { j=0; } c = c + String.fromCharCode( a.charCodeAt(i) ^ b.charCodeAt(j) ); j++; } return c; } // return list of elements by class function getElementsByClass( searchClass, domNode, tagName) { if (domNode == null) domNode = document; if (tagName == null) tagName = '*'; var el = new Array(); var tags = domNode.getElementsByTagName(tagName); var tcl = " "+searchClass+" "; for(i=0,j=0; i < tags.length; i++) { var test = " " + tags[i].className + " "; if (test.indexOf(tcl) != -1) el[j++] = tags[i]; } return el; } function hasClass(elm,classname) { return elm.className.match(new RegExp('(\\s|^)'+classname+'(\\s|$)')); } function addClass(elm,classname) { if (!this.hasClass(elm,classname)) elm.className += " "+classname; } function removeClass(elm,classname) { if (hasClass(elm,classname)) { var reg = new RegExp('(\\s|^)'+classname+'(\\s|$)'); elm.className=elm.className.replace(reg,' '); } } function getStyle(elm,styleProp) { if (elm.currentStyle) var y = elm.currentStyle[styleProp]; else if (window.getComputedStyle) var y = document.defaultView.getComputedStyle(elm,null).getPropertyValue(styleProp); return y; } /* return the first element found at an absolute position */ function getByPosition( elements, left, top, skipelm ) { for (i=0; i < elements.length; i++) { if ((!skipelm) || (skipelm.id != elements[i].id)) { dimensions = absPosition( elements[i] ); if ( (dimensions['left'] < left) && (dimensions['right'] > left) && (dimensions['top'] < top ) && (dimensions['bottom']> top ) ) { return elements[i]; } } } return false; } /* determine the absolute position of an element */ function absPosition( element ) { var result = new Array(); result['left'] = 0; result['top'] = 0; result['width'] = element.offsetWidth; result['height']= element.offsetHeight; while( element != null ) { result['left'] += element.offsetLeft; result['top'] += element.offsetTop; element = element.offsetParent; } result['right'] = result['left'] + result['width']; result['bottom']= result['top'] + result['height']; return result; } function str_cutlength( text, length, falign, fillin ) { if (!length) var length = 32; if (!falign) var falign = "right"; if (!fillin) var fillin = "..."; if ( text.length > length ) { var cutlength = length - fillin.length; switch (falign) { case "right" : return text.substr( 0, cutlength ) + fillin; case "left" : return fillin + text.substr( 0, cutlegnth ); case "center": return text.substr( 0, Math.floor(cutlength / 2) ) + fillin + text.substr( text.length - Math.floor( cutlength / 2), text.length ); default: return text.substr( 0, length ); } } else return text; } // show/hidde item. toggles // name: name of element to be shown/none // 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 // bsclass (opt): class of button when element is shown // bhclass (opt): class of button when element is hidden function show( elementid, value, buttonid, bsclass, bhclass ) { // get elements to be altered var element = document.getElementById( elementid ); // if no value is given, we toggle between block and none var value = value ? value : ((getStyle( element, 'display') == 'none') ? 'block' : 'none' ); // now hide / show buttons element.style.display = value; // if a button element was provided, set new style if ( buttonid ) { var button = document.getElementById( buttonid ); addClass( button, (value == 'block') ? bsclass : bhclass ); removeClass( button, (value == 'block') ? bhclass : bsclass ); } return value; } function hide( elementid ) { return show( elementid, 'none' ); } function removeElement( element ) { if ( typeof(element) == 'string' ) { element = document.getElementById( element ); } element.parentNode.removeChild( element ); } // 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; } // (re-)loads an elements content by issueing an HTTP request // element: id of html element to be filled // url: url to request // add: if set, content of element will be added, if not, it will be emptied first // if you need to call a js function just after content has been added // give function nyme by "postfunc", and argments as array to postFuncArgs // this might be the case, because writing "