// JQuery URL Parser plugin - https://github.com/allmarkedup/jQuery-URL-Parser
// Written by Mark Perkins, mark@allmarkedup.com
// License: http://unlicense.org/ (i.e. do what you want with it!)
(function(a,b){function i(a,b){var c=decodeURI(a),e=f[b||!1?"strict":"loose"].exec(c),i={attr:{},param:{},seg:{}},j=14;while(j--)i.attr[d[j]]=e[j]||"";return i.param.query={},i.param.fragment={},i.attr.query.replace(g,function(a,b,c){b&&(i.param.query[b]=c)}),i.attr.fragment.replace(h,function(a,b,c){b&&(i.param.fragment[b]=c)}),i.seg.path=i.attr.path.replace(/^\/+|\/+$/g,"").split("/"),i.seg.fragment=i.attr.fragment.replace(/^\/+|\/+$/g,"").split("/"),i.attr.base=i.attr.host?i.attr.protocol+"://"+i.attr.host+(i.attr.port?":"+i.attr.port:""):"",i}function j(a){var d=a.tagName;return d!==b?c[d.toLowerCase()]:d}var c={a:"href",img:"src",form:"action",base:"href",script:"src",iframe:"src",link:"href"},d=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"],e={anchor:"fragment"},f={strict:/^(?:([^:\/?#]+):)?(?:\/\/((?:(([^:@]*):?([^:@]*))?@)?([^:\/?#]*)(?::(\d*))?))?((((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/,loose:/^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*):?([^:@]*))?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/},g=/(?:^|&|;)([^&=;]*)=?([^&;]*)/g,h=/(?:^|&|;)([^&=;]*)=?([^&;]*)/g;a.fn.url=function(b){var c="";return this.length&&(c=a(this).attr(j(this[0]))||""),a.url({url:c,strict:b})},a.url=function(a){var c="",d=!1;return typeof a=="string"?c=a:(a=a||{},d=a.strict||d,c=a.url===b?window.location.toString():a.url),{data:i(c,d),attr:function(a){return a=e[a]||a,a!==b?this.data.attr[a]:this.data.attr},param:function(a){return a!==b?this.data.param.query[a]:this.data.param.query},fparam:function(a){return a!==b?this.data.param.fragment[a]:this.data.param.fragment},segment:function(a){return a===b?this.data.seg.path:(a=a<0?this.data.seg.path.length+a:a-1,this.data.seg.path[a])},fsegment:function(a){return a===b?this.data.seg.fragment:(a=a<0?this.data.seg.fragment.length+a:a-1,this.data.seg.fragment[a])}}}})(jQuery),$(document).ready(function(){$("#sort_by").change(function(){var a=window.location.href,b=$.url(a),c=b.attr("source");b.attr("path")=="/"&&(a+="recipes"),c.search(/[\?|&]sort/)!=-1?a=c.replace(/sort=[^\f\n\r\t&]*/,"sort="+$(this).val()):c.search(/\?/)!=-1?a+="&sort="+$(this).val():a+="?sort="+$(this).val(),window.location.href=a})}),$(document).ready(function(){$(".avatar-small").live("mouseover",function(){var a=$(this),b=$("#popup-user-info");b.html("<span class='name'>"+$("img",a).attr("alt")+"</span><span class='title'>"+$(".title",a).text()+"</span><span class='cur'></span><img src="+$("img",a).attr("src")+" alt="+$("img",a).attr("alt")+"height ='100%' width='100%'  > "),b.attr("href",a.attr("href")),b.css("top",a.offset().top-(b.height()-a.height())/2).css("left",a.offset().left-(b.width()-a.height())/2).fadeIn(200)}),$("#popup-user-info").live("mouseleave",function(){$(".avatar-small").clearQueue(),$(this).hide(),$("*",$(this)).remove()})}),jQuery.fn.oneRowSlider=function(a,b){var c=this,d=$(a+":first-child",c).outerWidth(!0),e=$(a,c).length;if(e<=b)$(".larr, .rarr",c).css({display:"none"});else{var f=$(".scroll",c);$(a+":lt("+b+")",c).clone().first().addClass("break").end().appendTo(f),$("#best-users .avatar-big:first-child").addClass("first-child").addClass("current"),$(a+":first-child",c).addClass("first-child").addClass("current"),f.css("width",d*(e+b)),$(".rarr",c).click(function(){return f.animate({marginLeft:"-="+d},300,function(){f.clearQueue().stop(),$(a+".current",c).removeClass("current").next(a).addClass("current"),$(a+".current",c).hasClass("break")&&($(a+".current",c).removeClass("current"),$(a+":first-child",c).addClass("current"),f.css("margin-left",0))}),!1}),$(".larr",c).click(function(){return $(a+".current",c).hasClass("first-child")&&($(a+".current",c).removeClass("current"),$(a+".break",c).addClass("current"),f.css("margin-left",-d*e)),f.animate({marginLeft:"+="+d},300,function(){f.clearQueue().stop(),$(a+".current",c).removeClass("current").prev(a).addClass("current")}),!1})}}
