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

").addClass("label").text("Flag as:")).append(f("").append(p)).append(f("

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