/** * Switches the search form to basic/advanced */ function switchSearchForm(link, searchFormUrl, layer) { try { var req = new jmAjax(); } catch (e) { alert("Error initializing AJAX request: " + e); return; } // some DOM around the link req.searchFormLink = link; req.formLayer = link.ownerDocument.getElementById(typeof(layer) != "undefined" ? layer : 'searchForm'); var loadingLayer = link.nextSibling; // show "loading..." and hide the link /*if (loadingLayer != null) { req.searchFormLink.style.display = "none"; loadingLayer.innerHTML = "Loading..."; } else { alert("Cannot find layer."); }*/ req.callbackSuccess = function() { this.formLayer.innerHTML = this.responseText; } req.get(searchFormUrl); } /* Section selection changed */ function sfSectionChanged(ss) { var sec = parseInt(ss.value); // show/hide motoring only fields cn = Math.abs(sec) == 9 ? "sfMotorFldShown" : "sfMotorFldHidden"; getObject('sfrmTrade').className = cn; if (getObject('sfrmYear')) { getObject('sfrmYear').className = cn; } // update categories drop down sfSetCategories(sec); } /* Populate categories */ function sfSetCategories(sec) { var cl = getObject('cat').options; cl.length = 0; cl[cl.length] = new Option("All Categories", 0); if (sec > 0) { for (cid in categoryBySection[sec]) { cl[cl.length] = new Option(categoryBySection[sec][cid], cid); } } else if (sec == -9) { cl[0] = new Option("Not Applicable", 0); } }