if(typeof JV=="undefined"||!JV){var JV={}}$(function(a){JV.search.init(a)});JV.search=function(){var b="#search";var a=["what","where","show"];return{form:null,url:null,params:a,init:function(d){var c=$(b).bind("submit",JV.search.submit);this.url=$(b).attr("action");if(c.length){this.form=c[0]}},what:function(){if(!this.form){return null}var c="what" in this.form?this.form.what.value:"";if(c){c=c.replace(/(^\s+|\s+$)/g,"");c=c.replace(/(\s+)/g," ");c=c.replace(/\//g,"|");c=encodeURIComponent(c);c=c.replace(/%2F/g,"|");c=c.replace(/%20/g,"+")}return c},where:function(){if(!this.form){return null}var c="where" in this.form?this.form.where.value:"";if(c){c=c.replace(/(^\s+|\s+$)/g,"");c=c.replace(/(\s+)/g," ");c=encodeURIComponent(c);c=c.replace(/%2F/g,"|");c=c.replace(/%20/g,"+")}return c},show:function(){if(!this.form){return null}var c="show" in this.form?this.form.show.value:"";if(c){c=c.replace(/(^\s+|\s+$)/g,"");c=c.replace(/(\s+)/g," ");c=encodeURIComponent(c);c=c.replace(/%20/g,"+")}return c},rows:function(){if(!this.form.rows){return null}var c="where" in this.form?this.form.rows.value:"";if(c){c=c.replace(/(^\s+|\s+$)/g,"");c=c.replace(/(\s+)/g," ");c=encodeURIComponent(c);c=c.replace(/%20/g,"+")}return c},sort:function(){if(!this.form.sort){return null}var c="where" in this.form?this.form.sort.value:"";if(c){c=c.replace(/(^\s+|\s+$)/g,"");c=c.replace(/(\s+)/g," ");c=encodeURIComponent(c);c=c.replace(/%20/g,"+")}return c},submit:function(j){j.preventDefault();var i=JV.search.what();var d=JV.search.where();var c=JV.search.show();var g=JV.search.sort();var h=JV.search.rows();var f=[JV.search.url];if(i){f.push("per/"+i)}if(d){f.push("in/"+d)}if(c){f.push("show/"+c)}if(g){f.push("sort/"+g)}if(h){f.push("rows/"+h)}document.location=f.join("/")}}}();