/*********************************************************** // Funktion: showHide(inElement, inState) // Visar/gömmer givet element. Styrs av inState som har // får värdet enable eller disable. /***********************************************************/ function showHide(inElement, inState) { var el = document.getElementById(inElement); if (inState=='enable') { el.style.display = ''; } else { el.style.display = 'none'; } } /** * Highlight active input field when having focus */ function highlightActiveInput(inElement) { currActiveClass = inElement.className; inElement.style.border = "1px solid #ccc"; inElement.style.background = "#f3f3f3"; oldValue = inElement.value; } /** * Blur active input field when focus is lost */ function blurActiveInput(inElement) { inElement.removeAttribute('style'); inElement.className = currActiveClass; if(inElement.className == "timeInput") { if(inElement.value == "") { inElement.value = oldValue; } } if(inElement.value != "") inElement.style.backgroundImage = "none"; } /** * Scroll to active div anchor */ function anchorTo( source, contentID, boxID ) { var header = source; var content = document.getElementById( contentID ); var box = document.getElementById( boxID ); // Get internal top coordinate for header var headerTop = header.offsetTop - box.offsetTop; // Set header height (cannot fetch this dynamically) var headerHeight = 28; // If content is larger than box, align top to top if ( ( headerHeight + content.clientHeight ) > box.clientHeight ) box.scrollTop = headerTop; else // align bottom to bottom box.scrollTop = ( headerTop + headerHeight + content.clientHeight ) - box.clientHeight; ////////////////////////////////// ///// FIX EXPLORER SUPPORT!! ///// ////////////////////////////////// } /** * Key event handling */ function adKeyDown(e, inElement) { var evt=(e)?e:(window.event)?window.event:null; if(evt) { var key=(evt.charCode)?evt.charCode: ((evt.keyCode)?evt.keyCode:((evt.which)?evt.which:0)); switch (key) { case 27: //Escape inElement.value = oldValue; inElement.blur(); checkChars(); break case 13: //Enter if (inElement.nodeName =="INPUT") { inElement.blur(); } if (inElement.nodeName =="TEXTAREA") { inElement.focus(); } break case 9: //Tab break default: break } } }