function navhelper(ajqarr, selclassname, normalclassname, options) { var settings = { selectedhandler: null, normalhandler: null ,ismodifynormal:false }; settings = jquery.extend(settings, options); var browserurl = location.pathname + location.search; if (browserurl == "/") browserurl = "index.html"; for (var i = 0; i < ajqarr.length; i++) { var ajq = ajqarr.eq(i); var ahref = ajq.attr("href"); if (/^\//.test(browserurl)) { browserurl = browserurl.replace(/^\/[^\/]+\//,"").replace(/^\//, ""); } if (/^\//.test(ahref)) { ahref = ahref.replace(/^\//, ""); } if (browserurl == ahref) { if (settings.selectedhandler != null) { settings.selectedhandler(ajq, selclassname); } else { ajq.attr("class", selclassname); } } else { if (settings.ismodifynormal) { if (settings.normalhandler != null) { settings.normalhandler(ajq, normalclassname); } else { ajq.attr("class", normalclassname); } } } } }