// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 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 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // validates the form and submits it to the server to complete advanced search action function startAdvancedSearch(language) { form = document.forms['AdvSearch']; // do not do any checking if result is built if (form.cacheRecordUNID.value!="") { return true; } //query string for hilite search results var queryString; // preparing language strings var msg_rus_SpecifyAtLeastOneSearchCriteria = 'Укажите хотя бы один критерий поиска'; var msg_eng_SpecifyAtLeastOneSearchCriteria = 'Please specify at least one search criteria'; var msg_SpecifyAtLeastOneSearchCriteria; var msg_rus_SpecifySearchCriteria = 'Укажите критерий поиска'; var msg_eng_SpecifySearchCriteria = 'Please specify a search criteria'; var msg_SpecifySearchCriteria; var msg_rus_SpecifyAttribute = "Укажите атрибут поиска"; var msg_eng_SpecifyAttribute = "Please select an attribute"; var msg_SpecifyAttribute; if (language=="Rus") { msg_SpecifyAtLeastOneSearchCriteria = msg_rus_SpecifyAtLeastOneSearchCriteria; msg_SpecifySearchCriteria = msg_rus_SpecifySearchCriteria; msg_SpecifyAttribute = msg_rus_SpecifyAttribute; } else { msg_SpecifyAtLeastOneSearchCriteria = msg_eng_SpecifyAtLeastOneSearchCriteria; msg_SpecifySearchCriteria = msg_eng_SpecifySearchCriteria; msg_SpecifyAttribute = msg_eng_SpecifyAttribute; } if (form.incl[0].checked) { // Including ISTC databases - OFF // processing input form.as_q.value = trim(form.as_q.value); form.as_epq.value = trim(form.as_epq.value); form.as_oq.value = trim(form.as_oq.value); form.as_eq.value = trim(form.as_eq.value); // if there is no search criteria set var searchStringDigest = form.as_q.value + form.as_epq.value + form.as_oq.value + form.as_eq.value; if (searchStringDigest=="") { form['as_q'].focus(); alert(msg_SpecifyAtLeastOneSearchCriteria); return false; } //set queryString to cookie queryString = form.as_q.value + " " + form.as_epq.value + " " + form.as_oq.value + " " + form.as_eq.value; } else { // Including ISTC databases - ON // processing input form.search_area_input.value = trim(form.search_area_input.value); if (form.search_area_input.value=="") { form.search_area_input.focus(); alert(msg_SpecifySearchCriteria); return false; } var searchAreaValue = document.getElementById('searchArea').value; if (searchAreaValue=="Projects") { if (form.kwsAttrib.selectedIndex==0) { form.kwsAttrib.focus(); alert(msg_SpecifyAttribute); return false; } } else { if (searchAreaValue=="Institutions") { if (form.kwsInst.selectedIndex==0) { form.kwsInst.focus(); alert(msg_SpecifyAttribute); return false; } } } //set queryString to cookie queryString = form.search_area_input.value; } //write to cookies SetCookie("queryString",queryString,1); return true; }; // goes to the page specified function gotoPage(pageNumber) { form = document.forms['AdvSearch']; form.PageNumber2Display.value = pageNumber; form.submit(); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - function SetCookie(cookieName,cookieValue,nDays) { var today = new Date(); var expire = new Date(); if (nDays==null || nDays==0) nDays=1; expire.setTime(today.getTime() + 3600000*24*nDays); document.cookie = cookieName+"="+escape(cookieValue) + ";expires="+expire.toGMTString() + ";path=/"; return; }