(function(){var a={getSelection:function(){var b=(this.jquery)?this[0]:this;return(("selectionStart" in b&&function(){var c=b.selectionEnd-b.selectionStart;return{start:b.selectionStart,end:b.selectionEnd,length:c,text:b.value.substr(b.selectionStart,c)}})||(document.selection&&function(){b.focus();var d=document.selection.createRange();if(d===null){return{start:0,end:b.value.length,length:0}}var c=b.createTextRange();var e=c.duplicate();c.moveToBookmark(d.getBookmark());e.setEndPoint("EndToStart",c);return{start:e.text.length,end:e.text.length+d.text.length,length:d.text.length,text:d.text}})||function(){return null})()},replaceSelection:function(){var b=(typeof this.id=="function")?this.get(0):this;var c=arguments[0]||"";return(("selectionStart" in b&&function(){b.value=b.value.substr(0,b.selectionStart)+c+b.value.substr(b.selectionEnd,b.value.length);return this})||(document.selection&&function(){b.focus();document.selection.createRange().text=c;return this})||function(){b.value+=c;return jQuery(b)})()}};jQuery.each(a,function(b){jQuery.fn[b]=this})})();(function(a){a.fn.extend({autocomplete:function(b,c){var d=typeof b=="string";c=a.extend({},a.Autocompleter.defaults,{url:d?b:null,data:d?null:b,delay:d?a.Autocompleter.defaults.delay:10,max:c&&!c.scroll?10:150},c);c.highlight=c.highlight||function(e){return e};c.formatMatch=c.formatMatch||c.formatItem;return this.each(function(){new a.Autocompleter(this,c)})},result:function(b){return this.bind("result",b)},flushCache:function(){return this.trigger("flushCache")},setOptions:function(b){return this.trigger("setOptions",[b])},unautocomplete:function(){return this.trigger("unautocomplete")}});a.Autocompleter=function(l,i){var c={UP:38,DOWN:40,DEL:46,TAB:9,RETURN:13,ESC:27,COMMA:188,PAGEUP:33,PAGEDOWN:34,BACKSPACE:8};var b=a(l).attr("autocomplete","off").addClass(i.inputClass);var s={words:[],index:0,start:0,value:"",fullValue:""};var j;var n=a.Autocompleter.Cache(i);var f=0;var v;var z={mouseDownOnSelect:false};var r=a.Autocompleter.Select(i,l,e,z);var y;a.browser.opera&&a(l.form).bind("submit.autocomplete",function(){if(y){y=false;return false}});b.bind((a.browser.opera?"keypress":"keydown")+".autocomplete",function(A){v=A.keyCode;switch(A.keyCode){case c.UP:A.preventDefault();if(r.visible()){r.prev()}else{u(0,true)}break;case c.DOWN:A.preventDefault();if(r.visible()){r.next()}else{u(0,true)}break;case c.PAGEUP:A.preventDefault();if(r.visible()){r.pageUp()}else{u(0,true)}break;case c.PAGEDOWN:A.preventDefault();if(r.visible()){r.pageDown()}else{u(0,true)}break;case i.multiple&&a.trim(i.multipleSeparator)==","&&c.COMMA:case c.TAB:case c.RETURN:if(e()){A.preventDefault();y=true;return false}break;case c.ESC:r.hide();break;default:clearTimeout(j);j=setTimeout(u,i.delay);break}}).focus(function(){f++}).blur(function(){f=0;if(!z.mouseDownOnSelect){t()}}).click(function(){if(f++>1&&!r.visible()){u(0,true)}}).bind("flushCache",function(){n.flush()}).bind("setOptions",function(){a.extend(i,arguments[1]);if("data" in arguments[1]){n.populate()}}).bind("unautocomplete",function(){r.unbind();b.unbind();a(l.form).unbind(".autocomplete");x()});function m(G){var D=a(l).getSelection();var F=0;var B=0;var A=G.split(i.multipleSeparator);if(a.trim(A[A.length-1])==""){A.pop()}if(A.length>1){var I=false;var H=0;var E=0;for(var C=0;C<A.length;C++){if(D.start<E-1){F=C-1;B=H?H-1:0;I=true;break}H=E;E+=(A[C].length+i.multipleSeparator.length)}if(!I){F=A.length-1;B=H?H-1:0}}a.each(A,function(J,K){if(a.trim(K)){A[J]=a.trim(K)}});return{words:A,index:F,start:B,value:A[F],fullValue:G}}function d(B,D){var C="";var A=false;if(B.length){if(s.value.toLowerCase()==B.toLowerCase()){C=s.value+D.substring(B.length)}}else{C=D}if(C.length){trailingSeparator=false;if(i.multiple){currWords=s.words;currWords[s.index]=C;newInputText=currWords.join(i.multipleSeparator);if(s.index==currWords.length-1){newInputText+=i.multipleSeparator;trailingSeparator=true}}else{newInputText=C}b.val(newInputText);if(B.length){startPos=(s.start?s.start+i.multipleSeparator.length-1:0)+s.value.length;selectedValue=D.substring(B.length);endPos=startPos+selectedValue.length;if(trailingSeparator){endPos+=i.multipleSeparator.length}a.Autocompleter.Selection(l,startPos,endPos)}else{s=m(newInputText)}}}function e(){var A=r.selected();if(!A){return false}d("",A.result);x();b.trigger("result",[A.data,A.value]);return true}function u(D,C){if(v==c.DEL){r.hide();return}var A=m(b.val());var B=A.value;if(!C&&B==s.value){return}s=A;if(B.length>=i.minChars){b.addClass(i.loadingClass);if(!i.matchCase){B=B.toLowerCase()}g(B,k,x)}else{o();r.hide()}}function q(A,B){if(i.autoFill&&v!=c.BACKSPACE){d(A,B)}}function t(){clearTimeout(j);j=setTimeout(x,200)}function x(){var A=r.visible();r.hide();clearTimeout(j);o();if(A){startPos=s.start?s.start+i.multipleSeparator.length:0;endPos=startPos+s.value.length;if(i.multiple&&(s.index==s.words.length-1)){endPos+=i.multipleSeparator.length}a.Autocompleter.Selection(l,endPos,endPos)}}function k(B,A){if(A&&A.length&&f){o();
r.display(A,B);q(B,A[0].value);r.show()}else{x()}}function g(B,D,A){if(!i.matchCase){B=B.toLowerCase()}var C=n.load(B);if(C&&C.length){D(B,C)}else{if((typeof i.url=="string")&&(i.url.length>0)){var E={timestamp:+new Date()};if(i.multiple){E.full=s.fullValue;E.index=s.index}a.each(i.extraParams,function(F,G){E[F]=typeof G=="function"?G():G});a.ajax({mode:"abort",port:"autocomplete"+l.name,dataType:i.dataType,url:i.url,data:a.extend({q:B,limit:i.max},E),success:function(G){var F=i.parse&&i.parse(G)||p(G);n.add(B,F);D(B,F)}})}else{r.emptyList();A(B)}}}function p(D){var A=[];var C=D.split("\n");for(var B=0;B<C.length;B++){var E=a.trim(C[B]);if(E){E=E.split("|");A[A.length]={data:E,value:E[0],result:i.formatResult&&i.formatResult(E,E[0])||E[0]}}}return A}function o(){b.removeClass(i.loadingClass)}};a.Autocompleter.defaults={inputClass:"ac_input",resultsClass:"ac_results",loadingClass:"ac_loading",minChars:1,delay:400,matchCase:false,matchSubset:true,matchContains:false,cacheLength:10,max:100,extraParams:{},selectFirst:true,formatItem:function(b){return b[0]},formatMatch:null,autoFill:false,width:0,multiple:false,multipleSeparator:", ",highlight:function(c,b){return c.replace(new RegExp("(?![^&;]+;)(?!<[^<>]*)("+b.replace(/([\^\$\(\)\[\]\{\}\*\.\+\?\|\\])/gi,"\\$1")+")(?![^<>]*>)(?![^&;]+;)","gi"),"<strong>$1</strong>")},scroll:true,scrollHeight:180};a.Autocompleter.Cache=function(c){var f={};var d=0;function i(l,k){if(!c.matchCase){l=l.toLowerCase()}var j=l.indexOf(k);if(j==-1){return false}return j==0||c.matchContains}function g(k,j){if(d>c.cacheLength){b()}if(!f[k]){d++}f[k]=j}function e(){if(!c.data){return false}var k={},j=0;if(!c.url){c.cacheLength=1}k[""]=[];for(var m=0,l=c.data.length;m<l;m++){var p=c.data[m];p=(typeof p=="string")?[p]:p;var o=c.formatMatch(p,m+1,c.data.length);if(o===false){continue}var n=o.charAt(0).toLowerCase();if(!k[n]){k[n]=[]}var q={value:o,data:p,result:c.formatResult&&c.formatResult(p)||o};k[n].push(q);if(j++<c.max){k[""].push(q)}}a.each(k,function(r,s){c.cacheLength++;g(r,s)})}setTimeout(e,25);function b(){f={};d=0}return{flush:b,add:g,populate:e,load:function(n){if(!c.cacheLength||!d){return null}if(!c.url&&c.matchContains){var m=[];for(var j in f){if(j.length>0){var o=f[j];a.each(o,function(p,k){if(i(k.value,n)){m.push(k)}})}}return m}else{if(f[n]){return f[n]}else{if(c.matchSubset){for(var l=n.length-1;l>=c.minChars;l--){var o=f[n.substr(0,l)];if(o){var m=[];a.each(o,function(p,k){if(i(k.value,n)){m[m.length]=k}});return m}}}}}return null}}};a.Autocompleter.Select=function(e,k,m,q){var j={ACTIVE:"ac_over"};var l,f=-1,s,n="",t=true,c,p;function o(){if(!t){return}c=a("<div/>").hide().addClass(e.resultsClass).css("position","absolute").appendTo(document.body);p=a("<ul/>").appendTo(c).mouseover(function(u){if(r(u).nodeName&&r(u).nodeName.toUpperCase()=="LI"){f=a("li",p).removeClass(j.ACTIVE).index(r(u));a(r(u)).addClass(j.ACTIVE)}}).click(function(u){a(r(u)).addClass(j.ACTIVE);m();k.focus();return false}).mousedown(function(){q.mouseDownOnSelect=true}).mouseup(function(){q.mouseDownOnSelect=false});if(e.width>0){c.css("width",e.width)}t=false}function r(v){var u=v.target;while(u&&u.tagName!="LI"){u=u.parentNode}if(!u){return[]}return u}function i(u){l.slice(f,f+1).removeClass(j.ACTIVE);g(u);var x=l.slice(f,f+1).addClass(j.ACTIVE);if(e.scroll){var v=0;l.slice(0,f).each(function(){v+=this.offsetHeight});if((v+x[0].offsetHeight-p.scrollTop())>p[0].clientHeight){p.scrollTop(v+x[0].offsetHeight-p.innerHeight())}else{if(v<p.scrollTop()){p.scrollTop(v)}}}}function g(u){f+=u;if(f<0){f=l.size()-1}else{if(f>=l.size()){f=0}}}function b(u){return e.max&&e.max<u?e.max:u}function d(){p.empty();var v=b(s.length);for(var x=0;x<v;x++){if(!s[x]){continue}var y=e.formatItem(s[x].data,x+1,v,s[x].value,n);if(y===false){continue}var u=a("<li/>").html(e.highlight(y,n)).addClass(x%2==0?"ac_even":"ac_odd").appendTo(p)[0];a.data(u,"ac_data",s[x])}l=p.find("li");if(e.selectFirst){l.slice(0,1).addClass(j.ACTIVE);f=0}if(a.fn.bgiframe){p.bgiframe()}}return{display:function(v,u){o();s=v;n=u;d()},next:function(){i(1)},prev:function(){i(-1)},pageUp:function(){if(f!=0&&f-8<0){i(-f)}else{i(-8)}},pageDown:function(){if(f!=l.size()-1&&f+8>l.size()){i(l.size()-1-f)}else{i(8)}},hide:function(){c&&c.hide();l&&l.removeClass(j.ACTIVE);f=-1},visible:function(){return c&&c.is(":visible")},current:function(){return this.visible()&&(l.filter("."+j.ACTIVE)[0]||e.selectFirst&&l[0])},show:function(){var x=a(k).offset();c.css({width:typeof e.width=="string"||e.width>0?e.width:a(k).width(),top:x.top+k.offsetHeight,left:x.left}).show();if(e.scroll){p.scrollTop(0);p.css({maxHeight:e.scrollHeight,overflow:"auto"});if(a.browser.msie&&typeof document.body.style.maxHeight==="undefined"){var u=0;l.each(function(){u+=this.offsetHeight});var v=u>e.scrollHeight;p.css("height",v?e.scrollHeight:u);if(!v){l.width(p.width()-parseInt(l.css("padding-left"))-parseInt(l.css("padding-right")))}}}},selected:function(){var u=l&&l.filter("."+j.ACTIVE).removeClass(j.ACTIVE);
return u&&u.length&&a.data(u[0],"ac_data")},emptyList:function(){p&&p.empty()},unbind:function(){c&&c.remove()}}};a.Autocompleter.Selection=function(d,e,c){if(d.createTextRange){var b=d.createTextRange();b.collapse(true);b.moveStart("character",e);b.moveEnd("character",c);b.select()}else{if(d.setSelectionRange){d.setSelectionRange(e,c)}else{if(d.selectionStart){d.selectionStart=e;d.selectionEnd=c}}}d.focus()}})(jQuery);(function(j){if(/1\.(0|1|2)\.(0|1|2)/.test(j.fn.jquery)||/^1.1/.test(j.fn.jquery)){alert("blockUI requires jQuery v1.2.3 or later!  You are using v"+j.fn.jquery);return}j.fn._fadeIn=j.fn.fadeIn;var c=function(){};var k=document.documentMode||0;var e=j.browser.msie&&((j.browser.version<8&&!k)||k<8);var f=j.browser.msie&&/MSIE 6.0/.test(navigator.userAgent)&&!k;j.blockUI=function(q){d(window,q)};j.unblockUI=function(q){i(window,q)};j.growlUI=function(u,s,t,q){var r=j('<div class="growlUI"></div>');if(u){r.append("<h1>"+u+"</h1>")}if(s){r.append("<h2>"+s+"</h2>")}if(t==undefined){t=3000}j.blockUI({message:r,fadeIn:700,fadeOut:1000,centerY:false,timeout:t,showOverlay:false,onUnblock:q,css:j.blockUI.defaults.growlCSS})};j.fn.block=function(q){return this.unblock({fadeOut:0}).each(function(){if(j.css(this,"position")=="static"){this.style.position="relative"}if(j.browser.msie){this.style.zoom=1}d(this,q)})};j.fn.unblock=function(q){return this.each(function(){i(this,q)})};j.blockUI.version=2.31;j.blockUI.defaults={message:"<h1>Please wait...</h1>",title:null,draggable:true,theme:false,css:{padding:0,margin:0,width:"30%",top:"40%",left:"35%",textAlign:"center",color:"#000",border:"3px solid #aaa",backgroundColor:"#fff",cursor:"wait"},themedCSS:{width:"30%",top:"40%",left:"35%"},overlayCSS:{backgroundColor:"#000",opacity:0.6,cursor:"wait"},growlCSS:{width:"350px",top:"10px",left:"",right:"10px",border:"none",padding:"5px",opacity:0.6,cursor:"default",color:"#fff",backgroundColor:"#000","-webkit-border-radius":"10px","-moz-border-radius":"10px"},iframeSrc:/^https/i.test(window.location.href||"")?"javascript:false":"about:blank",forceIframe:false,baseZ:1000,centerX:true,centerY:true,allowBodyStretch:true,bindEvents:true,constrainTabKey:true,fadeIn:200,fadeOut:400,timeout:0,showOverlay:true,focusInput:true,applyPlatformOpacityRules:true,onBlock:null,onUnblock:null,quirksmodeOffsetHack:4};var b=null;var g=[];function d(u,H){var C=(u==window);var y=H&&H.message!==undefined?H.message:undefined;H=j.extend({},j.blockUI.defaults,H||{});H.overlayCSS=j.extend({},j.blockUI.defaults.overlayCSS,H.overlayCSS||{});var E=j.extend({},j.blockUI.defaults.css,H.css||{});var P=j.extend({},j.blockUI.defaults.themedCSS,H.themedCSS||{});y=y===undefined?H.message:y;if(C&&b){i(window,{fadeOut:0})}if(y&&typeof y!="string"&&(y.parentNode||y.jquery)){var K=y.jquery?y[0]:y;var R={};j(u).data("blockUI.history",R);R.el=K;R.parent=K.parentNode;R.display=K.style.display;R.position=K.style.position;if(R.parent){R.parent.removeChild(K)}}var D=H.baseZ;var O=(j.browser.msie||H.forceIframe)?j('<iframe class="blockUI" style="z-index:'+(D++)+';display:none;border:none;margin:0;padding:0;position:absolute;width:100%;height:100%;top:0;left:0" src="'+H.iframeSrc+'"></iframe>'):j('<div class="blockUI" style="display:none"></div>');var N=j('<div class="blockUI blockOverlay" style="z-index:'+(D++)+';display:none;border:none;margin:0;padding:0;width:100%;height:100%;top:0;left:0"></div>');var M;if(H.theme&&C){var I='<div class="blockUI blockMsg blockPage ui-dialog ui-widget ui-corner-all" style="z-index:'+D+';display:none;position:fixed"><div class="ui-widget-header ui-dialog-titlebar blockTitle">'+(H.title||"&nbsp;")+'</div><div class="ui-widget-content ui-dialog-content"></div></div>';M=j(I)}else{M=C?j('<div class="blockUI blockMsg blockPage" style="z-index:'+D+';display:none;position:fixed"></div>'):j('<div class="blockUI blockMsg blockElement" style="z-index:'+D+';display:none;position:absolute"></div>')}if(y){if(H.theme){M.css(P);M.addClass("ui-widget-content")}else{M.css(E)}}if(!H.applyPlatformOpacityRules||!(j.browser.mozilla&&/Linux/.test(navigator.platform))){N.css(H.overlayCSS)}N.css("position",C?"fixed":"absolute");if(j.browser.msie||H.forceIframe){O.css("opacity",0)}var B=[O,N,M],Q=C?j("body"):j(u);j.each(B,function(){this.appendTo(Q)});if(H.theme&&H.draggable&&j.fn.draggable){M.draggable({handle:".ui-dialog-titlebar",cancel:"li"})}var x=e&&(!j.boxModel||j("object,embed",C?null:u).length>0);if(f||x){if(C&&H.allowBodyStretch&&j.boxModel){j("html,body").css("height","100%")}if((f||!j.boxModel)&&!C){var G=n(u,"borderTopWidth"),L=n(u,"borderLeftWidth");var A=G?"(0 - "+G+")":0;var F=L?"(0 - "+L+")":0}j.each([O,N,M],function(t,U){var z=U[0].style;z.position="absolute";if(t<2){C?z.setExpression("height","Math.max(document.body.scrollHeight, document.body.offsetHeight) - (jQuery.boxModel?0:"+H.quirksmodeOffsetHack+') + "px"'):z.setExpression("height",'this.parentNode.offsetHeight + "px"');C?z.setExpression("width",'jQuery.boxModel && document.documentElement.clientWidth || document.body.clientWidth + "px"'):z.setExpression("width",'this.parentNode.offsetWidth + "px"');
if(F){z.setExpression("left",F)}if(A){z.setExpression("top",A)}}else{if(H.centerY){if(C){z.setExpression("top",'(document.documentElement.clientHeight || document.body.clientHeight) / 2 - (this.offsetHeight / 2) + (blah = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + "px"')}z.marginTop=0}else{if(!H.centerY&&C){var S=(H.css&&H.css.top)?parseInt(H.css.top):0;var T="((document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + "+S+') + "px"';z.setExpression("top",T)}}}})}if(y){if(H.theme){M.find(".ui-widget-content").append(y)}else{M.append(y)}if(y.jquery||y.nodeType){j(y).show()}}if((j.browser.msie||H.forceIframe)&&H.showOverlay){O.show()}if(H.fadeIn){var J=H.onBlock?H.onBlock:c;var r=(H.showOverlay&&!y)?J:c;var q=y?J:c;if(H.showOverlay){N._fadeIn(H.fadeIn,r)}if(y){M._fadeIn(H.fadeIn,q)}}else{if(H.showOverlay){N.show()}if(y){M.show()}if(H.onBlock){H.onBlock()}}m(1,u,H);if(C){b=M[0];g=j(":input:enabled:visible",b);if(H.focusInput){setTimeout(p,20)}}else{a(M[0],H.centerX,H.centerY)}if(H.timeout){var v=setTimeout(function(){C?j.unblockUI(H):j(u).unblock(H)},H.timeout);j(u).data("blockUI.timeout",v)}}function i(t,u){var s=(t==window);var r=j(t);var v=r.data("blockUI.history");var x=r.data("blockUI.timeout");if(x){clearTimeout(x);r.removeData("blockUI.timeout")}u=j.extend({},j.blockUI.defaults,u||{});m(0,t,u);var q;if(s){q=j("body").children().filter(".blockUI").add("body > .blockUI")}else{q=j(".blockUI",t)}if(s){b=g=null}if(u.fadeOut){q.fadeOut(u.fadeOut);setTimeout(function(){l(q,v,u,t)},u.fadeOut)}else{l(q,v,u,t)}}function l(q,t,s,r){q.each(function(u,v){if(this.parentNode){this.parentNode.removeChild(this)}});if(t&&t.el){t.el.style.display=t.display;t.el.style.position=t.position;if(t.parent){t.parent.appendChild(t.el)}j(r).removeData("blockUI.history")}if(typeof s.onUnblock=="function"){s.onUnblock(r,s)}}function m(q,u,v){var t=u==window,s=j(u);if(!q&&(t&&!b||!t&&!s.data("blockUI.isBlocked"))){return}if(!t){s.data("blockUI.isBlocked",q)}if(!v.bindEvents||(q&&!v.showOverlay)){return}var r="mousedown mouseup keydown keypress";q?j(document).bind(r,v,o):j(document).unbind(r,o)}function o(t){if(t.keyCode&&t.keyCode==9){if(b&&t.data.constrainTabKey){var s=g;var r=!t.shiftKey&&t.target==s[s.length-1];var q=t.shiftKey&&t.target==s[0];if(r||q){setTimeout(function(){p(q)},10);return false}}}if(j(t.target).parents("div.blockMsg").length>0){return true}return j(t.target).parents().children().filter("div.blockUI").length==0}function p(q){if(!g){return}var r=g[q===true?g.length-1:0];if(r){r.focus()}}function a(z,q,B){var A=z.parentNode,v=z.style;var r=((A.offsetWidth-z.offsetWidth)/2)-n(A,"borderLeftWidth");var u=((A.offsetHeight-z.offsetHeight)/2)-n(A,"borderTopWidth");if(q){v.left=r>0?(r+"px"):"0"}if(B){v.top=u>0?(u+"px"):"0"}}function n(q,r){return parseInt(j.css(q,r))||0}})(jQuery);$().ready(function(){function u(M){var L=$(M).attr("comment_id");$.ajax({url:"/internal/deletecomment",data:"comment_id="+L,dataType:"json",success:function(N){$("#c-"+L).html(N.deleted);$("#num_comments").html(N.numcomment)},error:checkAuth})}function e(M){var N=$(M).attr("username");var L=$(M).attr("subs");if($(M).text()=="more"){$.ajax({url:"/internal/showmoresubs",data:"uname="+N+"&subs="+L,dataType:"json",success:function(O){$("#hidesubs"+L).html(O.subs_str);$(M).text("less")},error:checkAuth})}else{$(M).text("more");$("#hidesubs"+L).html("")}}function p(M){var L=$(M).attr("comment_id");var N="mc-"+L;if($(M).text()=="... read more"){$(M).hide();$("#"+N).show()}else{$("#"+N).hide();$("#mcl-"+L).show()}}function E(L){$(L).parent().siblings().show();$(L).parent().hide();return false}function k(L){$("#commentloadingdiv_"+L).show()}function r(M,O){var L=$(M).attr("reco_id");var N=$(M).attr("show_thumbs");$.ajax({beforeSend:function(){$("#commentloadingdiv_"+L).show()},url:"/internal/processcomment",data:{comment:$("#comment_"+L).val(),reco_id:L,show_thumbs_bool:N},dataType:"json",success:function(P){$("#commentloadingdiv_"+L).hide();$("#comments_message").html(P.numcomment);$("#comments_"+L).append(P.commenthtml);$("#comment_"+L).val("");if(O=="Y"){$("#postcommentform_"+L).hide()}},error:checkAuth})}function o(P){var O=$(P).attr("reco_id");var M=$(P).attr("newreco_id");var Q=$(P).attr("item");var R=[];var L=["twitter","ff","fb"];for(var N in L){if($("#"+L[N]+"_checkbox_"+O).attr("checked")){R.push(L[N])}}$.ajax({beforeSend:function(){$("#likeformloadingdiv_"+O).show();$("#reco_comment_"+O).attr("disabled","disabled")},url:"/internal/processlikereco",data:{reco_comment:$("#reco_comment_"+O).val(),publish_dests:R.join(","),newreco_id:M,item:Q,oldreco_id:O},dataType:"json",success:function(S){$("#likeformloadingdiv_"+O).hide();$("#likeform_"+O).html('<div class="submitmessage" style="float:right; padding:5px; margin-right:20px; background-color:#f2f2f2">Submitted</div>');setTimeout(function(){$(".submitmessage").hide()},1000);$("#viewrecoc_"+O).show();
$("#comments_"+O).append(S.commenthtml);$("#likeform_"+O).css("background-color","#ffffff")},error:checkAuth})}function z(N){var L=$(N).attr("reco_id");var M=$(N).parent();$.ajax({url:"/internal/processstarreco",data:{reco_id:L},dataType:"json",success:function(O){M.html('Bookmarked <a reco_id= "'+L+'" class="undostarlink" href="#">undo</a>')}})}function K(N){var L=$(N).attr("reco_id");var M=$(N).parent();$.ajax({url:"/internal/processunstarreco",data:{reco_id:L},dataType:"json",success:function(O){M.html('<a href ="#" reco_id= "'+L+'" class="starlink">Bookmark</a>')}})}function H(L){var N=$(L).attr("reco_id");var M=$(L).parent();$.ajax({url:"/internal/processmarkreco",data:{reco_id:N,type:"spam"},dataType:"json",success:function(O){M.html('Marked Generic <a reco_id= "'+N+'" class="undospamlink" href="#">undo</a>')}})}function j(L){var N=$(L).attr("reco_id");var M=$(L).parent();$.ajax({url:"/internal/processunmarkreco",data:{reco_id:N,type:"spam"},dataType:"json",success:function(O){M.html('<a href ="#" reco_id= "'+N+'" class="spamlink">Generic</a>')}})}function I(N){var L=$(N).attr("reco_id");var M=$(N).parent();$.ajax({url:"/internal/processmarkreco",data:{reco_id:L,type:"interested"},dataType:"json",success:function(O){M.html('Marked Interesting <a reco_id= "'+L+'" class="undointlink" href="#">undo</a>')}})}function f(N){var L=$(N).attr("reco_id");var M=$(N).parent();$.ajax({url:"/internal/processunmarkreco",data:{reco_id:L,type:"interested"},dataType:"json",success:function(O){M.html('<a href ="#" reco_id= "'+L+'" class="intlink">Interesting</a>')}})}function y(L){options={delay:10,selectFirst:true,scroll:false,multiple:true,autoFill:false,cacheLength:0,extraParams:{topics:1},formatItem:function(M){if(M[1].length){return M[0]+" (<i>"+M[1]+"</i>)"}else{return M[0]}},formatResult:function(M){return M[0]}};$("#topics_"+L).autocomplete("/internal/autocomplete",options)}function t(M,L){$.ajax({url:"/internal/edittopics",beforeSend:function(){$("#edittopicform_"+M+" input[type=button]").attr("disabled","disabled");$("##edittopicform_"+M+" .edittopicloading").show()},data:{reco_id:M,topics:L},dataType:"json",success:function(N){rid=N.reco_id;$("#topics_"+rid).unautocomplete();$("#edittopicform_"+rid+" input[type=button]").removeAttr("disabled");$("##edittopicform_"+rid+" .edittopicloading").hide();$("#edittopicform_"+rid).hide()},error:checkAuth})}function b(L){var M=$(L).attr("reco_id");var N=$("#edittopicform_"+M).css("display");if(N=="none"){$("#edittopicform_"+M).show();$("#edittopicform_"+M+" input[type=button]").click(function(){t(M,$("#topics_"+M).val())});y(M)}else{$("#topics_"+M).unautocomplete();$("#edittopicform_"+M).hide()}}function J(){var L=new Array();$("input[name=merge_candidate]").each(function(){if($(this).attr("checked")){L.push($(this).attr("eid"))}});if(L.length){$.ajax({url:"/internal/processmerge",data:{entity_ids:L.join(",")},dataType:"json",success:function(M){window.location.reload(true)},error:checkAuth})}}function D(L){var M=$(L).attr("reco_id");$("#picklistform_"+M).hide()}function i(N){var M=$(N).attr("reco_id");var O=$("#select_list_"+M).val();var L=$("#listname_"+M).val();$.ajax({beforeSend:function(){},url:"/internal/processlistreco",data:{list_id:O,list_name:L,reco_id:M},dataType:"json",success:function(P){var Q=P.list_id;$("#picklistform_"+M).html('<div class="submitmessage" style="float:right; padding:5px; margin-right:20px; background-color:#f2f2f2">Added to List - View your list <a href="/list?id='+Q+'">here</a></div>');setTimeout(function(){$(".submitmessage").hide()},10000)},error:checkAuth})}function s(N){var L=$(N).attr("reco_id");var M=$("#picklistform_"+L).css("display");if(M=="none"){$("#picklistform_"+L).show();$.ajax({url:"/internal/picklist",data:"reco_id="+L,dataType:"json",success:function(O){$("#picklistform_"+L).html(O.picklist);$("#listname_"+L).focus();$(".choose_list_submit").click(function(){i(this)});$(".closecreatelist").click(function(){D(this)});$("#select_list_"+L).change(function(){var P=$("option:selected",this).val();if(P=="create new"){$("#clistinput_"+L).show()}else{$("#clistinput_"+L).hide()}})},error:checkAuth})}else{$("#picklistform_"+L).hide()}}function g(M){var L=$(M).attr("reco_id");var O=$(M).attr("user_name");var N=$("#postcommentform_"+L).css("display");if(N=="none"){$("#postcommentform_"+L).show();$("#postcommentform_"+L).html('<div id="addcomment"><form name="commentform" id="commentform_'+L+'"><textarea cols="60" rows="6" name="comment" id="comment_'+L+'"></textarea> <INPUT TYPE="hidden" id="reco_id" value="'+L+'"> <div style="padding:3px"><font class="greyfont">Use @'+O+' to address the user</font> </div><input type="button" reco_id="'+L+'" class="submitbutton"  name="Submit" value="Submit"></form></div>');$("#comment_"+L).focus();$(".submitbutton").click(function(){r(this,"Y")})}else{$("#postcommentform_"+L).hide()}}function G(L){var M=$(L).attr("reco_id");$.ajax({url:"/internal/deletereco",data:"divid=r-"+M,dataType:"html",success:function(N){$("#r-"+M).html(N)
},error:checkAuth})}function d(M){var N=$(M).attr("reco_id");var L=$(M).attr("entity_id");$.ajax({url:"/internal/hidereco",data:"divid=r-"+N+"&entity_id="+L,dataType:"html",success:function(O){$("#r-"+N).html(O)},error:checkAuth})}function m(L){if($(L).text()=="undo"){$(L).parent().siblings(".linktext").html("");$(L).text("");var M=$(L).attr("thumbsid");$("#image_"+M).find("img").attr("src","/images/likethissmall.png");$.ajax({url:"/internal/thumbsupreco",data:"divid="+M+"&done=c",dataType:"json",success:function(O){if(O.count==1){var N=" Like"}else{var N=" Likes"}if(O.count>0){$("#"+M).html('<a href="'+O.entity_url+'">'+O.count+N+"</a>")}else{$("#"+M).html("")}$("#s"+M).html(O.thumbsupstring);console.log(O.newreco_id);$("#c-"+O.newreco_id).html("")},error:checkAuth})}}function v(U){var R=$(U).attr("thumbsid");var M=$(U).attr("t");var N=$(U).attr("f");var O=$(U).attr("fb");var Q=$(U).attr("user_name");var S=$(U).attr("click");if((/likethissmall.png$/.test($(U).attr("src")))||(/likethisbig.png$/.test($(U).attr("src")))){if(/likethisbig.png$/.test($(U).attr("src"))){var T=1}else{var T=0}$(U).attr("src","/images/1px.gif");$(U).attr("click","c");$(U).attr("ho","n");var L=R.split("-")[1];$("#likeform_"+L).show();$("#viewrecoc_"+L).hide();if((M==1)||(N==1)||(O==1)){var P='<div class="reallysmalltext" style="padding-bottom:10px; width:300px;">Publish to:&nbsp;';if(M==1){P+='<input id="twitter_checkbox_'+L+'" type="checkbox" value="yes" name="publish_twitter" checked>&nbsp;Twitter'}if(O==1){P+='&nbsp;<input id="fb_checkbox_'+L+'" type="checkbox" value="yes" name="publish_facebook" checked>&nbsp;Facebook'}if(N==1){P+='&nbsp;<input id="ff_checkbox_'+L+'" type="checkbox" value="yes" name="publish_friendfeed" checked>&nbsp;Friendfeed'}P+="</div>"}else{var P=""}$("#likeform_"+L).html('<div class="addrecolike" ">Say something about why you like this <br/><form name="recolikeform" id="recolikeform_'+L+'"><textarea cols="40" rows="6" name="reco_comment" id="reco_comment_'+L+'"></textarea> <div style="padding:3px"><font class="smallgreyfont">Use @'+Q+' to address the user</font> </div><div style="padding:5px">'+P+' <input type="button" id="likesubmitbutton_'+L+'" class="likesubmitbutton"   item = "'+T+'"name="Submit"  reco_id="'+L+'"   value="Submit"> &nbsp; <a href="#" class="cancellink">Cancel</a>&nbsp; <span id ="likeformloadingdiv_'+L+'" style="display:none;" ><img src="/images/loading2.gif"></span></form><div></div>');$("#reco_comment_"+L).focus();$(".cancellink").click(function(){$("#likeform_"+L).hide();$("#viewrecoc_"+L).show();$("#likeform_"+L).html("")});$(".likesubmitbutton").click(function(){o(this)});$.ajax({url:"/internal/thumbsupreco",data:"divid="+R+"&done=nc",dataType:"json",success:function(W){if(W.count==1){var V=" Like"}else{var V=" Likes"}$("#"+R).html('<a href="'+W.entity_url+'">'+W.count+V+"</a>");$("#s"+R).html(W.thumbsupstring);$("#linktext_"+R).html("Liked");$("#text-"+R).find("a").text("undo");$("#likesubmitbutton_"+L).attr("newreco_id",W.newreco_id)},error:checkAuth})}}function x(L){var M=$(L).attr("clikeid");$.ajax({url:"/internal/setcurrentlike",data:"divid="+M,dataType:"json",success:function(N){$("#cmesg").html(N.clike_box_html);$("#r-"+N.id).remove();$("#clike_reco").html(N.clike_reco_html);if(N.existing_clike_id){$("#getrecos .tablediv").prepend(N.existing_clike_reco_html)}},error:checkAuth})}function c(L){$("#rssfeed").attr("href",$("#rssfeed").attr("href")+"&t="+L);$("#rssfeedimage").attr("href",$("#rssfeedimage").attr("href")+"&t="+L);$("#ig_feedimage").attr("href",$("#ig_feedimage").attr("href")+"%26t="+L);$("#yahoo_feedimage").attr("href",$("#yahoo_feedimage").attr("href")+"%26t="+L)}function n(O){var N="";if($(O).attr("u")!=undefined){N=N+"u="+$(O).attr("u")}if($(O).attr("t")!=undefined){N=N+"&t="+$(O).attr("t")}if($(O).attr("p")!=undefined){N=N+"&p="+$(O).attr("p")}if($(O).attr("m")!=undefined){N=N+"&m="+$(O).attr("m");var M=$(O).attr("m")}if(M=="add"){var L='<font class="smalltext">Followed</font>'}else{}$.ajax({url:"/internal/processaddsubs",data:N,dataType:"json",success:function(P){$(O).parent().html(L);$(".addsubstopic a").click(function(){n(this)})},error:checkAuth})}function C(M){var N="";if($(M).attr("t")!=undefined){N=N+"t="+$(M).attr("t")+"&";var L=$(M).attr("t")}if($(M).attr("n")!=undefined){N=N+"n="+$(M).attr("n");var P=$(M).attr("n")}if($(M).attr("t1")!=undefined){N=N+"t1="+$(M).attr("t1")}if($(M).attr("r")!=undefined){N=N+"r="+$(M).attr("r")}if($(M).attr("raw")!=undefined){var O=$(M).attr("raw")}$(".topics").css("background-color","#000000");$(".topics a").css("text-decoration","none");$(".topics a").css("color","#ffffff");$(M).parent().css("background-color","#000000");$(M).css("text-decoration","underline");$(M).css("color","#ffffff");$.ajax({url:"/internal/processgetrecos",beforeSend:function(){$("#getrecos").html('<br/><br/><img src="/images/loading2.gif"> &nbsp; &nbsp; Loading <br/><br/>');$("#pagination").html("")},data:N,dataType:"json",success:function(Q){$("#getrecos").html(Q.getrecos);
$("#addsubsstring").html(Q.subs);$("#pagination").html(Q.pagination);F();c(L);if(O!=undefined){$("#tagname").html(" > "+O)}else{$("#tagname").html("")}}})}function A(O){var N="";if($(O).attr("u")!=undefined){N=N+"u="+$(O).attr("u")}if($(O).attr("t")!=undefined){N=N+"&t="+$(O).attr("t")}if($(O).attr("p")!=undefined){N=N+"&p="+$(O).attr("p")}if($(O).attr("m")!=undefined){N=N+"&m="+$(O).attr("m");var L=$(O).attr("m")}var M=$(O).parent();$.ajax({url:"/internal/processaddsubs",data:N,dataType:"json",success:function(P){$("#addtorecommend").html(P.confirm_subs);$(".addsubsimage a").click(function(){A(this)})},error:checkAuth})}function a(){var L="r=r";var N=window.location.pathname;var M=window.location.search;if(((N=="/")||(N=="/recommended"))&&(!M||!M.match(/p=[0-9]+/))){$.ajax({url:"/internal/processgetrecos",beforeSend:function(){$("#getrecos").html('<br/><br/><img src="/images/loading2.gif"> &nbsp; &nbsp; Loading <br/><br/>')},data:L,dataType:"json",success:function(O){$("#getrecos").html(O.getrecos);$("#addsubsstring").html(O.subs);$("#pagination").html(O.pagination);$("#topic-bar").html(O.topic_histo);F();l()}})}}$("#tm-profile img").hover(function(){$("#tm-overlay").show()},function(){$("#tm-overlay").hide()});$("#tm-app").fadeOut(4000);function B(){var L=false;if($("#use_loc").attr("checked")){loc_txt=$.trim($("#loc_box input").val());if(!loc_txt){loc_txt=$.trim($("#loc_text").text())}if(loc_txt){if(!$("#search_form_loc_str").length){$('<input id="search_form_loc_str" type="hidden" name="loc" value="">').appendTo("#search_form")}$("#search_form_loc_str").val(loc_txt);L=true}}else{$("#search_form_loc_str").remove();L=true}if(L){$("#search_form").submit()}}function l(){$(".addsubstopic a").live("click",function(){n(this);return false});$(".topics a").live("click",function(){C(this);return false});$(".morecomment").live("click",function(){p(this);return false});$(".addsubsimage a").live("click",function(){A(this);return false});$('.thumbsdiv a[href="#"]').live("click",function(){m(this);return false});$('.thumbsdiv a[href="#"] img').live("click",function(){v(this);return false});$(".topiclink").live("click",function(){b(this);return false});$("#merge").live("click",function(){J();return false});$(".moresubs").live("click",function(){e(this);return false});$(".commentlink").live("click",function(){g(this);return false});$(".starlink").live("click",function(){z(this);return false});$(".undostarlink").live("click",function(){K(this);return false});$(".intlink").live("click",function(){I(this);return false});$(".undointlink").live("click",function(){f(this);return false});$(".spamlink").live("click",function(){H(this);return false});$(".undospamlink").live("click",function(){j(this);return false});$(".deletecomment").live("click",function(){u(this);return false});$(".clike").live("click",function(){x(this);return false});$(".llike").live("click",function(){s(this);return false});$(".deletelink").live("click",function(){G(this);return false});$(".hidelink").live("click",function(){d(this);return false});$(".expandcommentlink").live("click",function(){E(this);return false});$("#loc_input_cancel").live("click",function(){$("#loc_box").hide();$("#loc_text").show();return false});$("#loc_input_change").live("click",function(){$("#loc_text").hide();$("#loc_box").show();return false});$("#use_loc").live("click",function(){B();return true});$("#remove_loc").live("click",function(){window.location=noLocationUrl();return false});$("#loc_box input[type=text]").keypress(function(L){if(L.which==13){$(this).blur();$("#loc_save").focus().click()}});$("#loc_save").live("click",function(){$("#use_loc").attr("checked",true);B();return false})}function F(){$(".submitbutton").click(function(){r(this,"");return false})}var q=$("#num_likes").attr("num_likes");if(q>4){a()}l();F()});$().ready(function(){$("#rightpanel .imagecelldiv .smallimagediv").hover(function(){h=parseInt($(this).attr("h"));w=parseInt($(this).attr("w"));$("#bigimagediv img").attr("src",$(this).attr("big_url"));if(h>w){$("#bigimagediv img").removeAttr("width");$("#bigimagediv img").attr("height",200)}else{$("#bigimagediv img").removeAttr("height");$("#bigimagediv img").attr("width",200)}$("#bigimagediv #imgattr a").attr("href",$(this).attr("source_url"));$("#bigimagediv #imgattr a").text($(this).attr("source_host"))});$(".vidthumbnail").click(function(){var d=$(this).attr("vidid");var c=$(this).attr("vidname");var a=$(this).attr("vidd");var b='<div id="bigvideodivhover"><div style="width:445px"><div style="float:right; padding-top:0px; padding-bottom:6px;"><a href=#><img src="/images/close.png" class="closedialog" value="Close"></a></div><div><object style="padding-left:10px;" width="425" height="344" ><param name="movie" value="'+d+'&hl=en&fs=1"></param><param name="allowFullScreen" value="true"></param><embed src="'+d+'&hl=en&fs=1&showsearch=0&autoplay=1 " type="application/x-shockwave-flash" allowfullscreen="true" width="425" height="344"></embed></object><br/>&nbsp; '+c+' &nbsp;<span class="smallgreyfont">'+a+' secs </span> <br/> <a href=# class="closedialog">Close window</a></div>';
$.blockUI({message:b,css:$.getDialogCss(404,450)})});$(".closedialog").live("click",function(){$.unblockUI()});$(".sharelink").live("click",function(){var a=$(this).attr("reco_id");$.showPopup("/internal/sharedialog",$(this).attr("type"),{reco_id:a});return false});$("#sharetoblogger").live("click",function(){$.ajax({beforeSend:function(){$("#sharetoblogger").attr("disabled","true");$("#loadingdiv").show()},url:"/internal/exporttoblogger",data:"reco_id="+$("#sharetoblogger").attr("reco_id"),dataType:"json",success:function(a){result=a.error?"<font color=red>Error posting to blogger</font>":"Like posted <a class='sharemessage' href='"+a.posted_url+"'>here</a>";$.unblockUI();$("#sharebloggertext").html(result)}});return false});$(".twsharelink").live("click",function(){var a=$("#twitter_dialog").css("display");if(a=="none"){$("#twitter_dialog").show();$("#twitter_input").focus()}else{$("#twitter_dialog").hide()}return false});$("#twitter_input").live("keyup",function(){currText=$(this).val();maxLen=$("input[name=msg_len]").val();var a=maxLen-currText.length;if(a<0){$(this).val(currText.substr(0,maxLen));a=0;return false}$("#twitter_dialog #counter").html(a);return true});$("#tw_button input").live("click",function(){$.ajax({beforeSend:function(){$("#loadingdiv").show();$("#tw_button input").attr("disabled","true")},url:"/internal/exporttotwitter",type:"POST",data:$("#twittermesgform").serialize(),dataType:"json",success:function(a){new_html="<font class='sharemessage'>Shared on Twitter</font>&nbsp; | &nbsp;";$("#sharetwittertext").html(new_html);$("#twitter_dialog").hide()}});return false});$("#tw_button #cancel").live("click",function(){$("#twitter_dialog").hide();return false});$("#comment").focus()});$().ready(function(){function a(d){var c=$(d).attr("entity_id");$.ajax({url:"/internal/morelikesprocess",data:"entity_id="+c,dataType:"json",success:function(e){$("#morelikehtml").html(e.likestring)},error:checkAuth})}function b(d){var c=$(d).attr("entity_id");$("#morelikehtml").html('<b><a id = "morelikes" entity_id = "'+c+'"  href="#">More >></a></b>')}$("#morelikes").live("click",function(){a(this);return false});$("#lesslikes").live("click",function(){b(this);return false})});function checkAuth(c,a,b){if(c.status==401){window.location="/login?lo"}};
