// Script for the Sort By Functionality function pageFilter(form) { //Retrieve form values var mainBranch=form.mainbranch.value; var controlId=form.control_id.value; // the year is supplied as the value of select control var subBranch = getControlValueById(controlId); if (subBranch != '') { gotoPage(mainBranch, subBranch); } return false; } function gotoPage(mainBranch, subBranch) { // if we're already at the search page, then just stay there - otherwise go for // the search page below the current url. var newUrl = location.protocol + '//' + location.host + '/'; if (mainBranch != '') { newUrl += mainBranch + '/'; } newUrl += subBranch; location.href=newUrl; } function getControlValueById(controlId) { var control = document.getElementById(controlId); return getControlValue(control); } function getControlValueByName(controlName, controlTag) { var elements = document.getElementsByName(controlName); if (elements == null || elements.length == 0) { return ''; } if (controlTag == null || controlTag == '') { return getControlValue(elements[0]); } var tagPattern = new RegExp(controlTag, "i"); for (var i=0; i= 0) { controlValue = control.options[control.options.selectedIndex].value; } break; case 'input' : // need to add code to add different input types. controlValue = control.value; break; } return controlValue; }