(function(b,a){b.cookie=function(m,c,e){if(typeof c!="undefined"){e=e||{};if(c===null){c="";e.expires=-1}var d="";if(e.expires&&(typeof e.expires=="number"||e.expires.toUTCString)){var h;if(typeof e.expires=="number"){h=new Date();h.setTime(h.getTime()+(e.expires*24*60*60*1000))}else{h=e.expires}d="; expires="+h.toUTCString()}var j=e.path?"; path="+(e.path):"";var l=e.domain?"; domain="+(e.domain):"";var o=e.secure?"; secure":"";document.cookie=[m,"=",encodeURIComponent(c),d,j,l,o].join("")}else{var n=null;if(document.cookie&&document.cookie!=""){var k=document.cookie.split(";");for(var f=0;f1){g=a("#"+f)}if(g.length===1){if(g[0].localName==="INPUT"){g.addClass("input-validation-error")}a("").addClass("field-validation-error").append(a("").addClass("error-icon")).append(a("").text(e)).insertAfter(g)}});return this};a.fn.clearModelErrors=function(){this.find(".field-validation-error").remove().end().find(".input-validation-error").removeClass("input-validation-error").end().find(".error-summary").empty().hide();return this}}(jQuery));(function(e,c){var a="jquery.refresh.fragment";var d=function(){var g=c.location.href;var f=g.lastIndexOf("#");if(f>=0){if(f!==g.length-1){e.cookie(a,g.substring(f+1))}g=g.substring(0,f)}c.location.href=g};var b=function(){var f=e.cookie(a);if(f!==null){c.location.href+="#"+f;e.cookie(a,null)}};e(document).ready(b);e.refresh=d}(jQuery,window));(function(e,c,a){e.vgquotes=function(){var h=function(j,i){return function(k){if(typeof(k)==="undefined"||typeof(k.Error)==="undefined"||k.Error!==null){i.call(null,null);return}i.call(null,k.Data.records[0])}};return{parseDate:function(i){return new Date(parseInt(i.substr(6)))},formatDate:function(i){return i.getFullYear()+"-"+(i.getMonth()+1)+"-"+i.getDate()},parseAndFormatDate:function(i){return e.vgquotes.formatDate(e.vgquotes.parseDate(i))},ajaxErrorHandler:function(i){alert("An error occurred ("+i.status+")")},preload:function(i){e.each(i,function(){e("")[0].src=this})},loadingGif:"/media/images/loading.gif",getResourceById:function(j,i,k){i=i.toString();e.ajax("/api/"+j+"/"+i,{type:"GET",success:h(j,k),error:h(j,k)})},createDialog:function(i){e("body").append(e("
").attr("id","modal-background")).append(i);i.center()},closeDialog:function(i){e("#modal-background").remove();i.remove()}}}();var b=function(){var h=function(){var i=e.trim(e("#search-query").val());if(i.length>0){c.location="/search/"+i}return false};e(document).ready(function(){e("#search-query").keypress(function(i){if(i.which===13){h()}});e("#search-submit").click(h)})};var g=function(){var h=false;e(".vote-for, .vote-against").live("click",function(){if(h){alert("Please wait for the current vote to process before voting again");return false}h=true;var l=e(this);var n=l.parents(".quote-container");var k=l.hasClass("vote-for")?1:0;var i=n.find("input.quote-id").val();var m=n.find(".quote-score");var j=m.text();e.ajax("/vote",{type:"POST",data:{QuoteId:i,Direction:k},beforeSend:function(){m.empty().append(e("").attr({src:e.vgquotes.loadingGif,title:"submitting your vote"+String.fromCharCode(8230)}))},success:function(o,p,q){if(o.Error!==null){c.alert(o.Error);return}j=o.Data.score;m.attr("title","+"+o.Data.upVotes+", -"+o.Data.downVotes);l.remove();if(k===1){if(n.find(".vote-against").length===0){e("").addClass("vote-against").attr("title","I hate this quote").text(String.fromCharCode(9660)).appendTo(n.find(".vote-container:last"))}}else{if(n.find(".vote-for").length===0){e("").addClass("vote-for").attr("title","I like this quote").text(String.fromCharCode(9650)).appendTo(n.find(".vote-container:first"))}}},complete:function(){h=false;var o=m.find("img");if(o.length){o.remove()}m.text(j)}});return false})};var f=function(){e("a.quote-flag-icon").click(function(){if(e(".flag-dialog").length>0){return false}var p=e(this).parents(".quote-container");var j=p.find("input.quote-id").val();var o=e("");var n=[[1,"Inaccurate"],[2,"Duplicate"],[3,"Spam"],[4,"Fake"],[0,"Other"]];for(var h=0;h";o.append(e(l))}var m=e("
").addClass("dialog flag-dialog");var k=e("").attr({href:"#",title:"submit"}).addClass("button-link").append(e("").addClass("submit-icon")).append(e("").text("Submit")).click(function(){var i=e(this).find(".submit-icon");i.toggleClass("submit-icon loading-icon");e.ajax("/flag",{type:"POST",data:{QuoteId:j,Comment:m.find("textarea").val(),FlagType:m.find("input[name='flagType']:checked").val()},success:function(r,s,t){if(r.Error!==null){alert(r.Error);return}e.vgquotes.closeDialog(m)},complete:function(){i.toggleClass("submit-icon loading-icon")}});return false});var q=e("").attr({href:"#",title:"cancel"}).addClass("button-link").append(e("").addClass("cancel-icon")).append(e("").text("Cancel")).click(function(){e.vgquotes.closeDialog(m);return false});m.append(e("

").addClass("label").text("Flag as:")).append(e("").append(o)).append(e("

").addClass("label").text("Comment")).append(e("