function FlagTip($t)
{if(!confirm('This comment will be flagged as offensive.  Are you sure?'))
return;var requester;try{requester=new XMLHttpRequest();}
catch(error){try{requester=new ActiveXObject("Microsoft.XMLHTTP");}
catch(error){return false;}}
requester.open("GET","/Support/Flag.aspx?tipid="+$t);requester.send(null);y=document.getElementById("spanTipFlagHref"+$t);y.visible=false;y.style.display="none";y=document.getElementById("spanTipFlagged"+$t);y.style.display="inline";y.textContent="This comment has been flagged.";}
function r($t,$r){$.getJSON("/Support/SetRating.aspx",{TipID:$t,Value:$r},function(data){$('#'+$t+'_'+$r).parent().fadeOut(300,function(){$(this).html(data.image).fadeIn();});});return false;}
function rA($t,$r){$.getJSON("/Support/SetRating.aspx",{t:4,ArticleID:$t,Value:$r},function(data){$('#'+$t+'_'+$r).parent().fadeOut(300,function(){$(this).html(data.image).fadeIn();});var star=document.getElementById('RatingCount');star.innerHTML=data.count;});return false;}
function ratingsOver($a,$n){for($i=1;$i<6;$i++)
document.getElementById($a+"_"+$i).src=($i<=$n)?"/images/stars/star-hover.gif":"/images/stars/star-nohover.gif";}
function ratingsOut($a,$p1,$p2,$p3,$p4,$p5){var y=document.getElementById($a+"_1");y.src="/images/stars/star-1-"+$p1+".gif";y=document.getElementById($a+"_2");y.src="/images/stars/star-1-"+$p2+".gif";y=document.getElementById($a+"_3");y.src="/images/stars/star-1-"+$p3+".gif";y=document.getElementById($a+"_4");y.src="/images/stars/star-1-"+$p4+".gif";y=document.getElementById($a+"_5");y.src="/images/stars/star-1-"+$p5+".gif";}
function ismaxlength(obj)
{var mlength=obj.getAttribute?parseInt(obj.getAttribute("maxlength")):"";if(obj.getAttribute&&obj.value.length>mlength)
obj.value=obj.value.substring(0,mlength);}
function bindPostCommentLink(articleID)
{var self=this;this.articleID=articleID;$("#postComment").bind("click",function(){$(this).unbind("click");if($(this).hasClass("Button2a")){$(this).removeClass("Button2a").addClass("Button1a").find(".text").html("Posting Comment");}else if($(this).hasClass("Button2Size1")){$(this).removeClass("Button2Size1").addClass("Button1Size1").html("Posting Comment");}
self.postComment($(this));})
this.postComment=function(button){if(validateComment()){$.getJSON('ajax/Common.aspx',{method:"PostComment",articleID:self.articleID,comment:$("#MemberComment").val(),captchaInput:$("#captchaInput").val(),captchaText:$("#captchaText").val()},function(response){if(response.Html){document.getElementById("MemberComment").value=String.empty;var totalCount=$("#TotalComments");if(totalCount)
{totalCount=parseInt(totalCount.html());$("#TotalComments").html(totalCount+1)}
if($(".Comment").length>0)
$(".Comment:first").before(response.Html);else
$(".Main.PostComment.Section").before("<div id=\"comments\" class=\"Main Comments Section\">"+response.Html+"</div>");$("#captchaText").attr("value","");$("#captchaImage").attr("src","/ui/images/misc/pixel.gif").hide();$("#WordVerification").slideUp("fast");$('#captchaInput').val('');}else if(response.error){$("#MemberComment").after('<div class="error-msg"></div>');$(".PostComment .error-msg").hide().html(response.error).fadeIn();if(response.Captcha==true){$("#captchaText").attr("value",response.CaptchaText);$("#captchaImage").attr("src",response.CaptchaImage).show();$("#WordVerification").slideDown();}else{document.getElementById("MemberComment").value=String.empty;}}
button.bind("click",function(){button.unbind("click").removeClass("Button2a").addClass("Button1a");self.postComment(button);});if(button.hasClass("Button1a")){button.removeClass("Button1a").addClass("Button2a").find(".text").html("Post a Comment");}else if(button.hasClass("Button1Size1")){button.removeClass("Button1Size1").addClass("Button2Size1").html("Post a Comment");}
if($("#postToFacebook:checked").val()!=null)
{var images=[];if(response.ItemThumbnailUrl!=null&&response.ItemThumbnailUrl!=undefined&&response.ItemThumbnailUrl!="")
images=[{"src":response.ItemThumbnailUrl,"href":document.location.href}]
var variables={'Title':response.Title,'URL':document.location.href,'Excerpt':response.ArticleIntroduction,'Comment_Body':response.Text,'images':images};FB.Connect.showFeedDialog("63205862906",variables,null,null,FB.FeedStorySize.shortStory,FB.RequireConnect.promptConnect);}})}}}
function validateComment()
{if($("#MemberComment").val()=="")
{if($(".error-msg").length==0)
$("#MemberComment").before("<span class=\"error-msg\">There was an error in your request, please try again.</span>");return false;}
else
{$(".error-msg").remove();return true;}}
$.ux.behavior("CitySearch",{initialize:function(){this.getResults(true);},showLoading:function(){this.element.html("");this.element.css("background","url(/ui/images/legacy/ticker1.gif) no-repeat center center").css("height","40px");},hideLoading:function(){this.element.css("background","none").css("height","auto");},getResults:function(isFirstLoad){var self=this;this.showLoading();$.getJSON("/api/citysearch.aspx",{search:this.options.search,where:this.options.location,max:this.options.maxResults},function(data){self.options.location=data.location;if(isFirstLoad&&data.ads.length==0)
self.element.parent().hide();else
self.populateResults(data);});},changeLocation:function(location){this.options.location=location;this.getResults();},populateResults:function(response){this.hideLoading();this.element.template(this.options.jsTemplateId,{loc:response.location,results:response.ads});},onclick:$.delegate({'a.jsChangeLocation':function(element,event){this.changeLocation(this.element.find("input").val());},'input':function(element,event){element.select();}}),onkeydown:$.delegate({'input':function(element,event){if(event.keyCode==13){this.changeLocation(element.val());}}})},{jsTemplateId:"tmpCitySearch",search:"",location:"",maxResults:5});(function($){$.extend($.fn,{livequery:function(type,fn,fn2){var self=this,q;if($.isFunction(type))
fn2=fn,fn=type,type=undefined;$.each($.livequery.queries,function(i,query){if(self.selector==query.selector&&self.context==query.context&&type==query.type&&(!fn||fn.$lqguid==query.fn.$lqguid)&&(!fn2||fn2.$lqguid==query.fn2.$lqguid))
return(q=query)&&false;});q=q||new $.livequery(this.selector,this.context,type,fn,fn2);q.stopped=false;q.run();return this;},expire:function(type,fn,fn2){var self=this;if($.isFunction(type))
fn2=fn,fn=type,type=undefined;$.each($.livequery.queries,function(i,query){if(self.selector==query.selector&&self.context==query.context&&(!type||type==query.type)&&(!fn||fn.$lqguid==query.fn.$lqguid)&&(!fn2||fn2.$lqguid==query.fn2.$lqguid)&&!this.stopped)
$.livequery.stop(query.id);});return this;}});$.livequery=function(selector,context,type,fn,fn2){this.selector=selector;this.context=context;this.type=type;this.fn=fn;this.fn2=fn2;this.elements=[];this.stopped=false;this.id=$.livequery.queries.push(this)-1;fn.$lqguid=fn.$lqguid||$.livequery.guid++;if(fn2)fn2.$lqguid=fn2.$lqguid||$.livequery.guid++;return this;};$.livequery.prototype={stop:function(){var query=this;if(this.type)
this.elements.unbind(this.type,this.fn);else if(this.fn2)
this.elements.each(function(i,el){query.fn2.apply(el);});this.elements=[];this.stopped=true;},run:function(){if(this.stopped)return;var query=this;var oEls=this.elements,els=$(this.selector,this.context),nEls=els.not(oEls);this.elements=els;if(this.type){nEls.bind(this.type,this.fn);if(oEls.length>0)
$.each(oEls,function(i,el){if($.inArray(el,els)<0)
$.event.remove(el,query.type,query.fn);});}
else{nEls.each(function(){query.fn.apply(this);});if(this.fn2&&oEls.length>0)
$.each(oEls,function(i,el){if($.inArray(el,els)<0)
query.fn2.apply(el);});}}};$.extend($.livequery,{guid:0,queries:[],queue:[],running:false,timeout:null,checkQueue:function(){if($.livequery.running&&$.livequery.queue.length){var length=$.livequery.queue.length;while(length--)
$.livequery.queries[$.livequery.queue.shift()].run();}},pause:function(){$.livequery.running=false;},play:function(){$.livequery.running=true;$.livequery.run();},registerPlugin:function(){$.each(arguments,function(i,n){if(!$.fn[n])return;var old=$.fn[n];$.fn[n]=function(){var r=old.apply(this,arguments);$.livequery.run();return r;}});},run:function(id){if(id!=undefined){if($.inArray(id,$.livequery.queue)<0)
$.livequery.queue.push(id);}
else
$.each($.livequery.queries,function(id){if($.inArray(id,$.livequery.queue)<0)
$.livequery.queue.push(id);});if($.livequery.timeout)clearTimeout($.livequery.timeout);$.livequery.timeout=setTimeout($.livequery.checkQueue,20);},stop:function(id){if(id!=undefined)
$.livequery.queries[id].stop();else
$.each($.livequery.queries,function(id){$.livequery.queries[id].stop();});}});$.livequery.registerPlugin('append','prepend','after','before','wrap','attr','removeAttr','addClass','removeClass','toggleClass','empty','remove','html');$(function(){$.livequery.play();});})(jQuery);(function($){var useAjax=true;var ajaxResults=null;$.ux.behavior("iWantToDoThisInline",{initialize:function(){this.init();},init:function(){$this=this;if(this.options.username!=""&&ajaxResults==null){if(useAjax){useAjax=false;$.get(this.options.api,{action:"get",username:this.options.username,article:this.options.article},function(data){ajaxResults=data;$this.setupActions(data);},"json");}else{setTimeout(function(){$this.init();},1000);return;}}else if(ajaxResults!=null){$this.setupActions(ajaxResults);}},setupActions:function(data){if(data.length>0){if(data[0].StatusId==1){$('.jsIWantToDoThis .alreadyAdded').show();}else if(data[0].StatusId==2){$('.jsIWantToDoThis .completed').show();}else{$('.jsIWantToDoThis .notAdded').show();}}else{$('.jsIWantToDoThis .notAdded').show();}},onclick:$.delegate({'.notAdded .button':function(){var $this=this;$.get(this.options.api,{action:"create",username:this.options.username,article:this.options.article},function(data){$('.jsIWantToDoThis .notAdded').animate({opacity:0},function(){$(this).hide();$('.jsIWantToDoThis .justAdded').css({opacity:0,display:'block'}).animate({opacity:1});});},"json");},'.alreadyAdded .button':function(){var $this=this;$.get(this.options.api,{action:"update",username:this.options.username,article:this.options.article,status:2},function(data){$('.jsIWantToDoThis .alreadyAdded').animate({opacity:0},function(){$(this).hide();$('.jsIWantToDoThis .justDid').css({opacity:0,display:'block'}).animate({opacity:1});});},"json");}})},{api:"/api/projects.ashx",username:"",article:""});$.ux.behavior("iWantToDoThisProjects",{initialize:function(){var $this=this;},onclick:$.delegate({'.jsDelete':function(e){var articleID=e.attr('rel');var parentRow=e.parent().parent();var parentTable=parentRow.parent().parent();parentRow.fadeOut();$.get(this.options.api,{action:"delete",username:this.options.username,article:articleID},function(data){parentRow.remove();if($('tbody tr',parentTable).length==0){parentTable.fadeOut();}});return false;},'.jsNotInterested':function(e){var articleID=e.attr('rel');var parentRow=e.parent().parent();var parentTable=parentRow.parent().parent();parentRow.fadeOut();$.get(this.options.api,{action:"update",username:this.options.username,article:articleID,status:3},function(data){parentRow.remove();if($('tbody tr',parentTable).length==0){parentTable.fadeOut();}});return false;},'.button':function(e){var articleID=e.attr('rel');$.get(this.options.api,{action:"update",username:this.options.username,article:articleID,status:2},function(data){window.location.reload();});return false;},'.jsWantToDo':function(e){var articleID=e.attr('rel');$.get(this.options.api,{action:"create",username:this.options.username,article:articleID,status:1},function(data){window.location.reload();});return false;}})},{api:"/api/projects.ashx",username:""});})(jQuery);