// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - function gotoField(fieldname){ //move focus to specified field if (fieldname != "") { form=document.forms[0]; form[fieldname].focus(); }; }; // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - function trim(inputString) { // Removes leading and trailing spaces from the passed string. Also removes // consecutive spaces and replaces it with one space. If something besides // a string is passed in (null, custom object, etc.) then return the input. if (typeof inputString != "string") { return inputString; } var retValue = inputString; var ch = retValue.substring(0, 1); while (ch == " ") { // Check for spaces at the beginning of the string retValue = retValue.substring(1, retValue.length); ch = retValue.substring(0, 1); }; ch = retValue.substring(retValue.length-1, retValue.length); while (ch == " ") { // Check for spaces at the end of the string retValue = retValue.substring(0, retValue.length-1); ch = retValue.substring(retValue.length-1, retValue.length); }; while (retValue.indexOf(" ") != -1) { // Note that there are two spaces in the string - look for multiple spaces within the string retValue = retValue.substring(0, retValue.indexOf(" ")) + retValue.substring(retValue.indexOf(" ")+1, retValue.length); // Again, there are two spaces in each of the strings }; return retValue; // Return the trimmed string back to the user } // Ends the "trim" function // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - function startSearch(pathDBPortal, language) { // preparing language strings var msg_rus_SpecifySearchCriteria = 'Укажите критерий поиска'; var msg_eng_SpecifySearchCriteria = 'Please specify a search criteria'; var searchFieldName="fl_SearchQuery"; var msg_SpecifySearchCriteria; var viewForSearch; if (language=="Rus") { msg_SpecifySearchCriteria = msg_rus_SpecifySearchCriteria; } else { msg_SpecifySearchCriteria = msg_eng_SpecifySearchCriteria; } var field = document.getElementById(searchFieldName); var value = trim(field.value); if (value=="") { field.focus(); alert(msg_SpecifySearchCriteria); return false; } if (language=="Rus") { viewForSearch = "va_RusNotesPages4SimpleSearch"; } else { viewForSearch = "va_EngNotesPages4SimpleSearch"; } var newLocation=location.protocol+"//"+location.host + pathDBPortal + viewForSearch +'?SearchView&SearchMax=0&sr=hide&start=1&count=20&lang='+language+'&Query=' + compareQueryStrForSimpleSearch(value); location.href = newLocation; } //- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - function compareQueryStrForSimpleSearch_old(query){ var strarray = new Array(); strarray = query.split(" "); var result=""; for (var i = 0; i < strarray.length; i++) { if (i == strarray.length - 1) { result = result + strarray[i]+'*'; } else if (result != "") { result = result + strarray[i]+'*' +' OR '; } else { result = strarray[i]+'*' + ' OR '; } } return result; } function compareQueryStrForSimpleSearch(query){ var strarray = new Array(); strarray = query.split(" "); var result=""; for (var i = 0; i < strarray.length; i++) { if (i == strarray.length - 1) { result = result + strarray[i]; } else if (result != "") { result = result + strarray[i] +' OR '; } else { result = strarray[i] + ' OR '; } } return result; } //- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - function onFieldPressEnter(ev,pathDBPortal,language) { var keynum; var keychar; var numcheck; if(window.event) // IE { keynum = ev.keyCode //alert('Cod: ' + keynum + '\n'+ev.ctrlKey); if (keynum == 13) { startSearch(pathDBPortal,language) } } else if(ev.which) // Netscape/Firefox/Opera { keynum = ev.which //alert('Cod: ' + keynum + '\n'+ev.ctrlKey); if (keynum == 13) { //openErrorDialog(PageTitle, Theme, SubTheme) startSearch(pathDBPortal,language) } } }