function checkKey (e, pattern) { var kcode = (e.keyCode) ? e.keyCode : e.charCode; var result = pattern.test(String.fromCharCode(kcode)); return result; } function validate(frm) { var s = trim(frm.fld_Title.value); if (s == "") { alert ('Field [Názov] mandatory'); return false; } else { frm.submit(); return true; } } function trim (s) { var b_wasnotblank = false, b_wasblank = false, s_currentchar, s_tmpstring = ''; for ( var i=0; i < (s.length); i++ ) { s_currentchar = s.charAt(i); if (s_currentchar == ' ') { if ( b_wasnotblank ) { b_wasblank = true; } } else { if ( b_wasblank ) { b_wasblank = false; s_tmpstring += ' '; } b_wasnotblank = true; s_tmpstring += s_currentchar; } } // end of for return (s_tmpstring); } function sw(sKey) { elem = document.getElementById(sKey); st = elem.className; elem.className = (st == 'col') ? 'exp' : 'col'; } function getDbPath (sLocation) { var l = sLocation.indexOf('.nsf'); if (l > 0) { return sLocation.substring(0, l + 4); } else { return false; } } function openTopic () { var db = getDbPath (window.location.href); var se = document.getElementById('themes'); if (se.selectedIndex < 0) { se.selectedIndex = 0; } var key = se.options[se.selectedIndex].value; window.location.href = db + '/wtopics?OpenView&Restricttocategory=' + key; } function createTopic () { var db = getDbPath (window.location.href); var se = document.getElementById('themes'); if (se.selectedIndex < 0) { se.selectedIndex = 0; } var unid = se.options[se.selectedIndex].value; unid = unid.split('~'); window.location.href = db + '/frm_Topic?Openform&parentunid=' + unid[unid.length - 1]; } function showCategory () { var db = getDbPath (window.location.href); var se = document.getElementById('manufacturer'); if (se.selectedIndex < 0) { se.selectedIndex = 0; } var category = se.options[se.selectedIndex].value; window.location.href = db + '/wccatalimg?OpenView&restricttocategory=' + category; } function dialogBox (sType) { var db = getDbPath (window.location.href); var sURL = ''; var sParam = ''; var sTitle = ''; switch (sType) { case 'VIC': sURL = db + '/sys/vic.html'; sParam = 'resizable=yes,scrollbars=yes,status=yes,width=720,height=620'; sTitle = 'VIC'; break; case 'KATALOG_HELP': sURL = db + '/sys/katalog_help.html'; sParam = 'resizable=yes,scrollbars=yes,status=yes,width=700,height=420'; sTitle = 'KATALOG'; break; case 'PRODUCER': sURL = db + '/pickmanufacturers?OpenView&count=1000'; sParam = 'resizable=yes,scrollbars=yes,status=yes,width=320,height=640'; sTitle = 'PRODUCERS'; break; } var w = window.open(sURL, sTitle, sParam); }