//************************************************************ //Functions associated with searching: // doSearch(s) // clearVals() // openDbRelativeURL(url, target) // setJudgeChoices(CourtValue) //************************************************************* /***************************************************************************************************** doSearch function to format the query string and activate the required search Arguments: the viewname to be searched Called by: Search Form (Search Button) Author: Debbie Williams, Consultant, Dialog IT (13/4/06) ******************************************************************************************************/ function doSearch(s){ var str = ''; var temp = ''; switch(s) { case "InterJudgments": obj = document.websearch.LastName; temp = obj.value; if (temp != ""){ if (str == ""){ str = "[LastName] CONTAINS " + temp; } else { str += " AND [LastName] CONTAINS " + temp; } } obj = document.websearch.GivenName; temp = obj.value; if (temp != ""){ if (str == ""){ str = "[GivenName] CONTAINS " + temp; } else { str += " AND [GivenName] CONTAINS " + temp; } } obj = document.websearch.Court; temp = obj.options[obj.selectedIndex].text; if (temp != ""){ if (str == ""){ str = "[Court] CONTAINS " + temp; } else { str += " AND [Court] CONTAINS " + temp; } } obj = document.websearch.Judges; var tempstr = ''; for (var i=0; i 0) { if (str == ''){ str = tempstr + ")" ; } else { str += " AND " + tempstr + ")" ; } } obj = document.websearch.Month; temp = obj.options[obj.selectedIndex].text; if (temp != ""){ if (str == ""){ str = "[Month] CONTAINS " + temp; } else { str += " AND [Month] CONTAINS " + temp; } } obj = document.websearch.Year; temp = obj.options[obj.selectedIndex].text; if (temp != ""){ if (str == ""){ str = "[Year] CONTAINS " + temp; } else { str += " AND [Year] CONTAINS " + temp; } } break; case "InterJudgmentsbyDate": temp = document.websearch.ComparisonDate.value; str = "[AmendedDate] >= " + temp; break; } if (str == "") { alert("Please be sure to select search criteria"); } else { openDbRelativeURL(s + "?SearchView&Query=" + str + "&start=1&SearchOrder=4"); } } // end doSearch /***************************************************************************************************** openDbRelativeURL function to open a url relative to this db Arguments: url and target Called by: doSearch function Author: Debbie Williams, Consultant, Dialog IT (13/4/06) ******************************************************************************************************/ function openDbRelativeURL( url, target ){ //Check we have a target window; target = (target == null ) ? window : target; //Work out the path of the database; path = location.pathname.split('.nsf')[0] + '.nsf/'; target.location.href = path + url; } // end openDbRelativeURL /***************************************************************************************************** clearVals function to clear the values in fields in the Search form Arguments: none Called by: Search Form (Clear button) Author: Debbie Williams, Consultant, Dialog IT (13/4/06) ******************************************************************************************************/ function clearVals(){ document.websearch.LastName.value = ""; document.websearch.GivenName.value = ""; document.websearch.Court.selectedIndex = 0; document.websearch.Judges.selectedIndex = 0; document.websearch.Month.selectedIndex = 0; document.websearch.Year.selectedIndex = 0; } // end clearVals /***************************************************************************************************** setJudgeChoices function to set the Judge choices when a Court is chosen Arguments: CourtValue = the value of the Court field Called by: Search Form (Court field, onChange) Author: Debbie Williams, Consultant, Dialog IT (13/4/06) ******************************************************************************************************/ function setJudgeChoices(CourtValue) { var f = document.websearch; var cjField = f.CourtJudges; var allField = f.AllJudges; var cjArray = cjField.value.split(", "); var tempArray = new Array(); var choicesArray = new Array(); var tempval = ''; // If the court value is null, then set judges choices to all judges, // otherwise find judges matching court selected if (CourtValue == '') { choicesArray = allField.value.split(", "); } else { var ctVal = CourtValue.toUpperCase(); for (var i=0; i