tpc.user=undefined;
tpc.getUser=function(){if(tpc.user==undefined){jQuery.ajax({async:false,url:"/components/account/user/jsonProfile",dataType:"json",success:function(data){tpc.user=data
}})
}return tpc.user
};
tpc.handleAlert=function(){var a;
if(_displayAlert){a=_displayAlert
}else{return
}if(a.level==1){var alertURL="/components/content/alert/?id="+a.id;
jQuery.fn.colorbox({width:"35%",href:alertURL,onClosed:function(){jQuery.ajax({url:"/components/content/alert/ignore/?id="+a.id})
}})
}else{if(a.level==2){jQuery.ajax({url:"/components/content/alert/?id="+a.id,success:function(data){jQuery("#udr-user-msg").html(data);
jQuery("#udr-user-msg a").each(function(item){var _href=jQuery(this).attr("href");
if(_href.indexOf("ajax:")===0){jQuery(this).bind("click",function(){jQuery(".msg-level-two ul").remove();
jQuery(".msg-level-two h2").append(jQuery("<img/>").attr("src","/universal/images/loading-12.gif").attr("border","0").css("vertical-align","middle").css("margin","0 10px"));
jQuery.ajax({url:_href.substring(5,_href.length),dataType:"json",success:function(bean){jQuery(".msg-level-two h2").html(bean.message);
setTimeout("hideLevelTwoMessage()","5000")
}})
});
jQuery(this).attr("href","javascript:;")
}else{alert("Normal anchor")
}});
jQuery("#udr-user-msg").fadeIn("slow").css("float","left").effect("highlight",{})
}})
}else{if(a.level==3){jQuery.ajax({url:"/components/content/alert/?id="+a.id,success:function(data){jQuery("body").prepend(data);
setTimeout("showLevelThreeMessage()","2000")
}})
}else{alert("MESSAGE LEVEL: "+a.level);
if(confirm(a.message)){document.location.href=a.url
}}}}};
function sendEmailVerification(){jQuery("#verification-ajax-response").html('<img src="/components/resources/images/ajax_blue_on_white.gif" alt="" border="0" style="vertical-align: middle;" /> Working...').show();
jQuery.ajax({url:"/components/account/user/sendVerifyEmail",success:function(data){if(data.messageType=="error"){jQuery("#verification-ajax-response").addClass("ajax-response-error")
}jQuery("#verification-ajax-response").html(data.message).show()
}})
}function verifyAccount(){var _code=jQuery("#verificationCode").val();
if(_code==""){jQuery("#verificationCode-error").html("Please enter a verification code").show()
}else{jQuery("#verify-account-submit").val("Working...").attr("disabled","disabled");
jQuery.post("/components/account/user/verifyAccount?code="+escape(_code),function(data){if(data.messageType=="error"){jQuery("#verify-account-submit").val("Verify my account").removeAttr("disabled");
jQuery("#verificationCode-error").html(data.message).show()
}else{jQuery("#verificationCode-error").html("").hide();
jQuery("#verify-account-submit").hide();
jQuery("#verification-send-email").hide();
jQuery("#verification-profile-message").html('<div class="success">'+data.message+"</div>").fadeIn();
setTimeout("hideVerificationPanel()","20000")
}})
}}function hideVerificationPanel(){jQuery("#tpcp-verify-account").fadeOut()
}function hideLevelTwoMessage(){jQuery("#udr-user-msg").fadeOut("slow")
}function showLevelThreeMessage(){jQuery(".msg-level-three").show()
}var _displayAlert;
function udrInitUser(){jQuery("body").prepend(jQuery("<div/>").attr("style","margin: 0 auto; width: 1000px;").addClass("tbcom-comment-div").append(jQuery("<div/>").attr("id","user-top-tab").html('<img src="/universal/images/loading-fb-666.gif" alt="Loading..." border="0" style="vertical-align: middle;" />')).append(jQuery("<br />").attr("clear","all"))).prepend(jQuery("<div/>").attr("style","height:3px;background-color:#f7f8ea; border-bottom: 1px solid #bbbda1;"));
var _user=tpc.getUser();
jQuery("#user-top-tab").find("img:first").fadeOut().remove();
jQuery("#user-top-tab").append(jQuery("<span/>").attr("id","udr-user-msg").attr("style","margin-right: 10px;").html("").hide());
if(_user.id>0){jQuery("#user-top-tab").append(jQuery("<span/>").addClass("username").html("").append(jQuery("<a/>").attr("href","/components/account/user/getprofile").html(_user.loginName))).append(jQuery("<span/>").addClass("sep").html("|")).append(jQuery("<a/>").attr("href","/components/account/logout").html("Log out"));
if(_user.alerts){for(var i=0;
i<_user.alerts.length;
i++){if(_user.alerts[i].level==1){_displayAlert=_user.alerts[i];
break
}else{if(!_displayAlert){_displayAlert=_user.alerts[i]
}}}if(_displayAlert){setTimeout("tpc.handleAlert()","50")
}}}else{jQuery("#user-top-tab").append(jQuery("<a/>").attr("href","/components/account/login").html("Login")).append(jQuery("<span/>").addClass("sep").html("|")).append(jQuery("<a/>").attr("href","/components/account/registration").html("Register"))
}}function udrInitMobileUser(){var _user=tpc.getUser();
if(_user.id>0){jQuery(".login-block").append(jQuery("<a/>").attr("class","view").attr("href","/components/account/user/getprofile").html(_user.loginName)).append(jQuery("<span/>").addClass("sep").html("|")).append(jQuery("<a/>").attr("href","/components/account/logout").html("Log out"))
}else{jQuery(".login-block").append('<a id="loginToggle" class="view" href="/components/account/login">Login</a>').append(jQuery("<span/>").addClass("sep").html("|")).append('<a id="registerToggle" class="view" href="/components/account/registration">Register</a>')
}};
function tpcc_hideReportedMessage(cid){jQuery("#c-report-msg-"+cid).fadeOut("slow")
}function tpcc_vote(cid,score,currentScore){jQuery.getJSON("/components/content/comment/vote?cid="+cid+"&score="+score,function(res){var _elem=(score>0)?"#c-thumb-up-"+cid:"#c-thumb-down-"+cid;
jQuery(_elem).html((res.data)?++currentScore:currentScore);
jQuery("#c-report-msg-"+cid).hide();
jQuery("#loginToVoteTip").html(res.message);
jQuery(_elem).tooltip({opacity:1,tip:"#loginToVoteTip",position:"top center",events:{def:"focus,mouseleave"},offset:[-5,0]}).focus()
})
}var tpccd={objectId:38079};
var tpccanchor="#comments";
function tpsc_load(data){if(data.anchorPoint!==undefined){tpccanchor=data.anchorPoint
}if(tpccanchor.indexOf("#")!=0){tpccanchor="#"+tpccanchor
}if(data.start===undefined){data.start=0
}if(data.sort===undefined){data.sort=""
}if(data.format===undefined){data.format="html"
}if(data.tpl===undefined){data.tpl=""
}if(data.cardinality===undefined){data.cardinality=""
}if(data.elements===undefined){data.elements="both"
}if(data.paged===undefined){data.paged=false
}jQuery.ajaxSettings.cache=false;
if(data.resort||data.paged){if(data.elements=="both"||data.elements=="list"){jQuery(tpccanchor).after(jQuery("<div/>").attr("id","tpcc-comment-list-container").html('<div class="c-loading-comments"><img src="/universal/images/loading-16.gif" style="margin-right:5px;vertical-align:middle;" />Loading...</div>'));
tpcc_call_list(data,"#tpcc-comment-list-container")
}}else{if(data.elements=="both"||data.elements=="form"){jQuery(tpccanchor).after(jQuery("<div/>").attr("id","tpcc-comment-form-container").load("/components/content/comment/new?objectId="+escape(data.objectId)+"&objectType="+escape(data.objectType)+"&source="+escape(data.objectSource)+"&tpl="+escape(data.tpl)+"&cardinality="+escape(data.cardinality)))
}if(data.elements=="both"||data.elements=="list"){jQuery(tpccanchor).after(jQuery("<div/>").attr("id","tpcc-comment-list-container").html('<div class="c-loading-comments"><img src="/universal/images/loading-16.gif" style="margin-right:5px;vertical-align:middle;" />Loading...</div>'));
tpcc_call_list(data,"#tpcc-comment-list-container")
}}tpccd=data
}function tpcc_load(data){if(data.anchorPoint!==undefined){tpccanchor=data.anchorPoint
}if(tpccanchor.indexOf("#")!=0){tpccanchor="#"+tpccanchor
}if(data.start===undefined){data.start=0
}if(data.sort===undefined){data.sort=""
}if(data.format===undefined){data.format="html"
}if(data.tpl===undefined){data.tpl=""
}if(data.cardinality===undefined){data.cardinality=""
}if(data.elements===undefined){data.elements="both"
}if(data.paged===undefined){data.paged=false
}jQuery.ajaxSettings.cache=false;
if(data.resort||data.start===undefined||data.start==0){if(data.resort){if(data.elements=="both"||data.elements=="list"){jQuery(tpccanchor).after(jQuery("<div/>").attr("id","tpcc-comment-list-container").html('<div class="c-loading-comments"><img src="/universal/images/loading-16.gif" style="margin-right:5px;vertical-align:middle;" />Loading...</div>'));
tpcc_call_list(data,"#tpcc-comment-list-container")
}}else{if(data.elements=="both"||data.elements=="form"){jQuery(tpccanchor).after(jQuery("<div/>").attr("id","tpcc-comment-form-container").load("/components/content/comment/new?objectId="+escape(data.objectId)+"&objectType="+escape(data.objectType)+"&source="+escape(data.objectSource)+"&tpl="+escape(data.tpl)+"&cardinality="+escape(data.cardinality)))
}if(data.elements=="both"||data.elements=="list"){jQuery(tpccanchor).after(jQuery("<div/>").attr("id","tpcc-comment-list-container").html('<div class="c-loading-comments"><img src="/universal/images/loading-16.gif" style="margin-right:5px;vertical-align:middle;" />Loading...</div>'));
tpcc_call_list(data,"#tpcc-comment-list-container")
}}}else{if(data.elements=="both"||data.elements=="list"){jQuery("#c-load-more-comments").remove();
if(jQuery("#c-user-ajax-comments").length){jQuery("#c-user-ajax-comments").before(jQuery("<div/>").attr("id","tpcc-comment-list-container-"+data.start).html('<div class="c-loading-comments"><img src="/universal/images/loading-16.gif" style="margin-right:5px;vertical-align:middle;" />Loading comments</div>'))
}else{jQuery("#c-list").append(jQuery("<div/>").attr("id","tpcc-comment-list-container-"+data.start).html('<div class="c-loading-comments"><img src="/universal/images/loading-16.gif" style="margin-right:5px;vertical-align:middle;" />Loading comments</div>'))
}tpcc_call_list(data,"#tpcc-comment-list-container-"+data.start)
}}tpccd=data
}function getCommentDataObject(){return tpccd
}function tpcc_call_list(d,eid){jQuery.ajax({cache:false,url:"/components/content/comment/list",data:{objectId:d.objectId,objectType:d.objectType,source:d.objectSource,sort:d.sort,start:d.start,format:d.format,tpl:d.tpl,cardinality:d.cardinality},success:function(res){jQuery(eid).html(res)
}})
}function tpcc_init_form(){jQuery("#c-publish").bind("click",function(){jQuery("#c-publish").hide().after(jQuery("<span/>").css("float","right").html('<img src="/universal/images/loading-16.gif" style="margin-right:5px;vertical-align:middle;" />Communicating with server...'));
jQuery.post("/components/content/comment/new",{comment:jQuery("#c-text").val(),objectId:tpccd.objectId,objectType:tpccd.objectType,source:tpccd.objectSource,format:tpccd.format,tpl:tpccd.tpl,templateKey:tpccd.tpl,moderated:jQuery("#c-moderated").val()},function(res){jQuery("#tpcc-comment-form-container").html(res)
},"html")
});
jQuery("#c-chars").html('You have <span id="c-char-count" style="color: #0000cc">1000 characters</span> remaining!');
jQuery("#c-text").keyup(function(evt){var _comment=jQuery("#c-text").val(),_len=_comment.length,_charsLeft,_color="#00c";
if(_len>=1000){jQuery("#c-text").val(_comment.substring(0,1000));
jQuery("#c-char-count").html("no more characters").css("color","#c00")
}else{_charsLeft=1000-_len;
if(_charsLeft<200){_color="#c00"
}else{if(_charsLeft<400){_color="#903"
}else{if(_charsLeft<600){_color="#606"
}else{if(_charsLeft<800){_color="#309"
}}}}jQuery("#c-char-count").html(_charsLeft+" character"+((_charsLeft!=1)?"s":"")).css("color",_color)
}});
try{jQuery(".c-post-comment-anchor").fadeIn()
}catch(error){}}function tpcc_init(){jQuery(".c-thumb-up-1, .c-thumb-down-1").bind("click",function(){var _cv=jQuery(this).html(),_strlen="c-thumb-up-".length,_dir=1;
if(jQuery(this).hasClass("c-thumb-down-1")){_strlen="c-thumb-down-".length;
_dir=-1
}var _id=jQuery(this).attr("id").substring(_strlen,jQuery(this).attr("id").length);
jQuery(this).html('<img src="/universal/images/loading-12.gif" alt="Loading" border="0" />');
tpcc_vote(_id,_dir,_cv)
});
jQuery(".c-thumb-up-0, .c-thumb-down-0").mouseover(function(){jQuery(this).find("span").toggle()
}).mouseout(function(){jQuery(this).find("span").toggle()
});
jQuery(".comment-report-abuse").bind("click",function(){var _id=jQuery(this).attr("id");
_id=_id.substr("c-abuse-".length,_id.length);
tpcc_report(_id)
});
jQuery("#c-sort").change(function(){jQuery("#tpcc-comment-list-container").remove();
tpcc_load({sort:jQuery(this).val(),start:0,objectId:tpccd.objectId,objectType:tpccd.objectType,objectSource:tpccd.objectSource,format:tpccd.format,anchorPoint:tpccd.anchorPoint,tpl:tpccd.tpl,elements:tpccd.elements,cardinality:tpccd.cardinality,resort:true})
})
}var _sendingReport=false;
function tpcc_report(cid){jQuery("#report-abuse-"+cid).attr("href","javascript:void(0);").removeClass("sc-report").addClass("sc-pleasewait");
jQuery.getJSON("/components/content/comment/report?cid="+cid,function(res){if(!res.data){var _msg=res.message;
jQuery("#c-"+cid).after(jQuery("<div/>").addClass("c-reported-message sc-reported-message").attr("id","c-report-msg-"+cid).html(_msg));
jQuery("#c-"+cid).hide("slow");
setTimeout("tpcc_hideReportedMessage("+cid+")",15000)
}else{jQuery("#c-"+cid).after(jQuery("<div/>").addClass("c-reported-message sc-reported-message").attr("id","c-report-msg-"+cid).html("Thank you for reporting this comment."));
jQuery("#c-"+cid).hide("slow");
setTimeout("tpcc_hideReportedMessage("+cid+")",15000)
}jQuery("#c-abuse-"+cid).html("Report Abuse")
})
}function tpcc_post_comment(cid,moderated){var _listContainer=jQuery("#c-list");
if(_listContainer&&_listContainer.length){jQuery("#c-list").append(jQuery("<div/>").addClass("c-reported-message sc-reported-message").attr("id","c-report-msg-"+cid).html('<img src="/universal/images/loading-16.gif" style="margin-right:5px;vertical-align:middle;" />Formatting your comment...'));
if(!jQuery("#c-user-ajax-comments").length){jQuery("#c-list").append(jQuery("<a/>").attr("id","c-user-ajax-comments").attr("name","ugc"))
}if(!moderated){jQuery.get("/components/content/comment/fetch",{cid:cid},function(res){jQuery("#c-list").append(res);
jQuery("#c-report-msg-"+cid).fadeOut("slow");
jQuery("#c-text").val("")
},"html");
var _commentCountStr=jQuery("#c-live").html();
var _re=/(\d+)/i;
if(_commentCountStr.search(_re)){var result=_re.exec(_commentCountStr);
var _cc=result[1];
_cc++;
jQuery("#c-live").html("There "+((_cc==1)?"is ":"are ")+_cc+" comment"+((_cc==1)?"":"s"))
}}}else{alert("[DEBUG] first comment?")
}}function tpcc_admrm(cid){jQuery.getJSON("/components/content/comment/admrm?cid="+cid,function(res){var _msg=(res.message)?res.message:"No response from server. Please try again";
jQuery("#c-"+cid).after(jQuery("<div/>").addClass("c-reported-message sc-reported-message").attr("id","c-report-msg-"+cid).html(_msg));
if(res.message){jQuery("#c-"+cid).hide("slow")
}setTimeout("tpcc_hideReportedMessage("+cid+")",15000)
})
}function tpcc_admfc(cid){var _val=jQuery("#c-toggle-feature-"+cid).html();
jQuery.getJSON("/components/content/comment/admfc?cid="+cid,function(res){jQuery("#c-toggle-feature-"+cid).html("Working...");
var _msg=(res.message)?res.message:"No response from server. Please try again";
jQuery("#c-"+cid).after(jQuery("<div/>").addClass("c-reported-message").attr("id","c-report-msg-"+cid).html(_msg));
setTimeout("tpcc_hideReportedMessage("+cid+")",15000);
jQuery("#c-toggle-feature-"+cid).html((_val=="Feature")?"Unfeature":"Feature")
})
}function tpcc_clear_dupes(){jQuery(".tb-ugc").each(function(){var _id=jQuery(this).attr("id");
_id=_id.substring(4);
if(jQuery("#c-"+_id).length){if(tpccd.format=="html"){jQuery(this).effect("transfer",{to:"#c-"+_id,className:"c-effects-transfer"},500);
jQuery("#c-"+_id).effect("highlight",{},500)
}jQuery(this).fadeOut().remove()
}})
}function tpcc_replyTo(cid){var _data=getCommentDataObject(),_item=jQuery("#c-"+cid);
if(jQuery("#reply-"+cid).length==0){jQuery(".sc-reply-container").remove();
var _url="/components/content/comment/new?objectId="+escape(_data.objectId)+"&objectType="+escape(_data.objectType)+"&source="+escape(_data.objectSource)+"&tpl="+escape(_data.tpl)+"&cardinality="+escape(_data.cardinality)+"&parentId="+cid+"&depth=0";
var _replyContainer=jQuery("<div/>").attr("id","reply-"+cid).addClass("sc-reply-container").html('<img src="/universal/images/loading-16.gif" style="margin-right:5px;vertical-align:middle;" />Communicating with server...');
jQuery.get(_url,function(data){_replyContainer.html(data);
jQuery("#c-"+cid).after(_replyContainer);
tpcc_init_reply(cid)
})
}else{jQuery("#reply-"+cid).remove()
}}function tpcc_init_reply(cid){var _el=(cid=="nc")?jQuery("#post-new-comment"):jQuery("#reply-"+cid);
if(_el.find("textarea").length>0){_el.find("textarea").keypress(function(evt){var _comment=jQuery(this).val(),_len=_comment.length,_charsLeft;
if(_len>=1000){jQuery(this).val(_comment.substring(0,1000));
jQuery("#sc-char-count-"+cid).html("1000/1000")
}else{_charsLeft=_len;
jQuery("#sc-char-count-"+cid).html(_charsLeft+"/1000")
}}).focus()
}_el.find("a.sc-policy").overlay({effect:"apple",onBeforeLoad:function(){var wrap=this.getOverlay().find(".contentWrap");
wrap.load(this.getTrigger().attr("href"))
}});
if(cid!="nc"){_el.find("a.sc-cancel").bind("click",function(){_el.remove()
})
}var _jqFindPublish=(cid=="nc")?"a.sc-publish-comment":"a.sc-publish-reply";
_el.find(_jqFindPublish).bind("click",function(){var _btnContainer=_el.find("td:eq(1)");
var _oldHtml=_btnContainer.html();
_btnContainer.html('<img src="/universal/images/loading-16.gif" style="margin-right:5px;vertical-align:middle;" />Posting...');
var _f=_el.find("form");
var _d=getCommentDataObject();
jQuery.post("/components/content/comment/new",{comment:_f.find("textarea").val(),objectId:_d.objectId,objectType:_d.objectType,source:_d.objectSource,format:_d.format,tpl:_d.tpl,templateKey:_d.tpl,moderated:jQuery("#c-moderated").val(),parentId:(cid=="nc")?0:_f.find('input[name="parentId"]').val()},function(res){if(res.messageType!==undefined&&res.messageType==="debug"){alert(res.message)
}else{if(cid=="nc"){tpsc_post_comment(res,jQuery("#c-moderated").val())
}else{var _parentListItem=jQuery("#c-"+cid);
if(_parentListItem.find("ul").length>0){_parentListItem.find("ul:first").append(res)
}else{_parentListItem.append(jQuery("<ul/>").addClass("sc-comment-list sc-comment-list-indent").html(res))
}var _newId=_parentListItem.find("ul:first li:last").attr("id");
jQuery(".sc-reply-container").remove();
jQuery("#"+_newId).tooltip({position:"center right",offset:[-2,10],effect:"fade",opacity:0.7,events:{def:"focus,mouseleave"},tipClass:"sc-tooltip"}).focus()
}}},"html")
})
}function tpsc_post_comment(res,moderated){var data=getCommentDataObject();
jQuery("#sc-thread-parent").append(res);
var _newId=jQuery("#sc-thread-parent li:last").attr("id");
jQuery("#"+_newId).tooltip({position:"center right",offset:[-2,10],effect:"fade",opacity:0.7,events:{def:"focus,mouseleave"},tipClass:"sc-tooltip"}).focus();
jQuery("#tpcc-comment-form-container").fadeOut().html("").load("/components/content/comment/new?objectId="+escape(data.objectId)+"&objectType="+escape(data.objectType)+"&source="+escape(data.objectSource)+"&tpl="+escape(data.tpl)+"&cardinality="+escape(data.cardinality)).fadeIn();
jQuery(".sc-new-comment").removeClass("sc-new-comment");
if(jQuery(".sc-live").html().indexOf("no comments")!=-1){jQuery(".sc-live").remove()
}}function tpcc_init_list(){jQuery(".sc-comment-date").bind("click",function(){if(jQuery(this).hasClass("sc-comment-date-formatted")){jQuery(".sc-comment-date-formatted").hide();
jQuery(".sc-comment-date-since").show()
}else{if(jQuery(this).hasClass("sc-comment-date-since")){jQuery(".sc-comment-date-since").hide();
jQuery(".sc-comment-date-formatted").show()
}}});
jQuery(".c-thumb-up-1, .c-thumb-down-1").bind("click",function(){var _cv=jQuery(this).html(),_strlen="c-thumb-up-".length,_dir=1;
if(jQuery(this).hasClass("c-thumb-down-1")){_strlen="c-thumb-down-".length;
_dir=-1
}var _id=jQuery(this).attr("id").substring(_strlen,jQuery(this).attr("id").length);
jQuery(this).html('<img src="/universal/images/loading-12.gif" alt="Loading" border="0" />');
tpcc_vote(_id,_dir,_cv)
});
jQuery(".c-thumb-up-0, .c-thumb-down-0").tooltip({opacity:0.8,tip:"#loginToVoteTip",position:"top center",offset:[-5,0]});
jQuery(".sc-feature, .sc-delete").mouseover(function(){var _color=jQuery(this).hasClass("sc-feature")?"AliceBlue":"#ff6";
jQuery(this).closest("li").css("background",_color)
}).mouseout(function(){jQuery(this).closest("li").css("background","White")
});
try{jQuery(".c-post-comment-anchor").fadeIn()
}catch(error){}}function tpsc_admrm(cid){jQuery("#sc-admin-message-"+cid).html('<img src="/universal/images/loading-16.gif" style="margin-right:5px;vertical-align:middle;" />').show();
if(confirm("Are you sure you want to delete this comment and all associated replies?")){jQuery.getJSON("/components/content/comment/admrm?cid="+cid,function(res){var _msg=(res.message)?res.message:"No response from server. Please try again";
jQuery("#sc-admin-message-"+cid).html(_msg).show();
if(res.messageType!="error"&&res.messageType!="warn"){setTimeout("tpcc_admrmComment("+cid+")",5000)
}})
}else{jQuery("#sc-admin-message-"+cid).html("Delete cancelled")
}}function tpsc_admthrst(_state){var _d=getCommentDataObject();
jQuery.getJSON("/components/content/comment/admthrst?objectId="+_d.objectId+"&objectType="+escape(_d.objectType)+"&source="+escape(_d.objectSource)+"&state="+escape(_state),function(res){var _msg=(res.message)?res.message:"No response from server. Please try again";
if(res.messageType=="success"){if(confirm(_msg+"\n\nWould you like to reload the thread?")){jQuery("#tpcc-comment-list-container *").remove();
jQuery("#tpcc-comment-form-container").remove();
tpsc_load(getCommentDataObject())
}}else{alert("Error: "+_msg)
}})
}function tpcc_admrmComment(cid){jQuery("#c-"+cid).fadeOut("slow")
}function tpsc_admfc(cid){jQuery("#sc-admin-message-"+cid).html('<img src="/universal/images/loading-16.gif" style="margin-right:5px;vertical-align:middle;" />').show();
jQuery.getJSON("/components/content/comment/admfc?cid="+cid,function(res){var _msg=(res.message)?res.message:"No response from server. Please try again";
jQuery("#sc-admin-message-"+cid).html(_msg).show();
if(res.messageType!="error"&&res.messageType!="warn"){if(jQuery("#c-"+cid).find(".sc-feature").is(":visible")){jQuery("#c-"+cid).find(".sc-feature").hide();
jQuery("#c-"+cid).find(".sc-unfeature").show()
}else{jQuery("#c-"+cid).find(".sc-feature").show();
jQuery("#c-"+cid).find(".sc-unfeature").hide()
}}})
}function tpsc_sort(_sort){var _d=getCommentDataObject();
jQuery("#tpcc-comment-list-container *").remove();
jQuery(".sc-info-panel-btn").removeClass("sc-info-panel-btn-selected");
jQuery("#sc-info-panel-btn-"+_sort).addClass("sc-info-panel-btn-selected");
tpsc_load({sort:_sort,start:0,objectId:_d.objectId,objectType:_d.objectType,objectSource:_d.objectSource,format:_d.format,anchorPoint:_d.anchorPoint,tpl:_d.tpl,elements:_d.elements,cardinality:_d.cardinality,resort:true})
}function tpsc_page(_start){var _d=getCommentDataObject();
jQuery("#tpcc-comment-list-container *").remove();
tpsc_load({sort:_d.sort,start:_start,objectId:_d.objectId,objectType:_d.objectType,objectSource:_d.objectSource,format:_d.format,anchorPoint:_d.anchorPoint,tpl:_d.tpl,elements:_d.elements,cardinality:_d.cardinality,paged:true})
}function tpsc_lcc(id,src,tpl,cls){try{jQuery.get("/components/content/comment/count",{objectId:id,source:src,tpl:tpl},function(res){var _cc=(res==undefined||res.commentCount==undefined)?0:res.commentCount;
jQuery("."+cls).html("("+_cc+")")
})
}catch(error){}}function tpsc_admtovr(cid,typ){jQuery("#sc-admin-message-"+cid).html('<img src="/universal/images/loading-16.gif" style="margin-right:5px;vertical-align:middle;" />').show();
jQuery.getJSON("/components/content/comment/admtovr?id="+cid+"&t="+typ,function(res){var _msg=(res.message)?res.message:"No response from server. Please try again";
if(typ=="comment"){jQuery("#sc-admin-message-"+cid).html(_msg).show();
if(res.messageType!="error"&&res.messageType!="warn"){if(res.message.indexOf("enabled")>-1){$("#sc-img-star-"+cid).attr("src","/universal/images/woo/star_16.png")
}else{$("#sc-img-star-"+cid).attr("src","/universal/images/woo/star_off16.png")
}}}else{if(typ=="thread"){if(res.messageType!="error"&&res.messageType!="warn"){var _img=(res.message.indexOf("enabled")==-1)?"star_off16.png":"star_16.png";
$("#sc-admin-thread-staff-override").html('<img src="/universal/images/woo/'+_img+'" border="0" style="vertical-align: middle;margin-right:5px;"/>'+res.message+". Click to toggle.")
}}}})
};
function tpc(){}tpc.param=function(key,_def){if(_def==null){_def=""
}key=key.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");
var regex=new RegExp("[\\?&]"+key+"=([^&#]*)");
var qs=regex.exec(window.location.href);
return(qs==null)?_def:qs[1]
};
tpc.trim=function(s){try{return s.replace(/^\s*|\s*jQuery/g,"")
}catch(error){return s
}};
tpc.emailArticle=function(){tpc_e_init();
jQuery("#email-article").modal()
};
function tpcjsonreq(url){this.url=url;
this.noCacheIE="&noCacheIE="+(new Date()).getTime();
this.head=document.getElementsByTagName("head").item(0);
this.scriptId="JScriptID"+tpcjsonreq.scriptCounter++
}tpcjsonreq.scriptCounter=1;
tpcjsonreq.prototype.buildScriptTag=function(){this.scriptObj=document.createElement("script");
this.scriptObj.setAttribute("type","text/javascript");
this.scriptObj.setAttribute("charset","utf-8");
this.scriptObj.setAttribute("src",this.url+this.noCacheIE);
this.scriptObj.setAttribute("id",this.scriptId)
};
tpcjsonreq.prototype.removeScriptTag=function(){this.head.removeChild(this.scriptObj)
};
tpcjsonreq.prototype.addScriptTag=function(){this.head.appendChild(this.scriptObj)
};
function trim(_str){return tpc.trim(_str)
}function isNumeric(strString){if(strString.length==0){return false
}var strValidChars="0123456789.-";
var strChar;
var _result=true;
for(i=0;
i<strString.length&&_result;
i++){strChar=strString.charAt(i);
if(strValidChars.indexOf(strChar)==-1){_result=false
}}return _result
}(function(jQuery){jQuery.fn.newsTicker=function(settings){settings=jQuery.extend({travelocity:0.07},settings);
return this.each(function(){var jQuerystrip=jQuery(this);
jQuerystrip.addClass("newsticker");
var stripWidth=0;
var jQuerymask=jQuerystrip.wrap("<div class='mask'></div>");
var jQuerytickercontainer=jQuerystrip.parent().wrap("<div class='tickercontainer'></div>");
var containerWidth=jQuerystrip.parent().parent().width();
jQuerystrip.find("li").each(function(i){stripWidth+=jQuery(this,i).outerWidth(true)
});
jQuerystrip.width(stripWidth);
var totalTravel=stripWidth+containerWidth;
var defTiming=totalTravel/settings.travelocity;
function scrollnews(spazio,tempo){jQuerystrip.animate({left:"-="+spazio},tempo,"linear",function(){jQuerystrip.css("left",containerWidth);
scrollnews(totalTravel,defTiming)
})
}scrollnews(totalTravel,defTiming);
jQuerystrip.hover(function(){jQuery(this).stop()
},function(){var offset=jQuery(this).offset();
var residualSpace=offset.left+stripWidth;
var residualTime=residualSpace/settings.travelocity;
scrollnews(residualSpace,residualTime)
})
})
}
})(jQuery);
function TPCDateFormat(){this.debug=false;
this.d=new Date();
this.tpc_dt_month=new Array("January","Febuary","March","April","May","June","July","Auguest","September","October","November","December");
this.tpc_dt_millis=1;
this.tpc_dt_second=this.tpc_dt_millis*1000;
this.tpc_dt_minute=this.tpc_dt_second*60;
this.tpc_dt_hour=this.tpc_dt_minute*60;
this.tpc_dt_day=this.tpc_dt_hour*24;
this.setTime=function(unixTime){this.d.setTime(unixTime)
};
this.translateMilliseconds=function(t){return Math.round(t)
};
this.translateSeconds=function(t){return Math.round(t/this.tpc_dt_second)
};
this.translateMinutes=function(t){return Math.round(t/this.tpc_dt_minute)
};
this.translateHours=function(t){return Math.round(t/this.tpc_dt_hour)
};
this.format=function(fmt){if(fmt==null||fmt==""){return this.d.toString()
}if(this.debug){alert("Format is: "+fmt)
}var _str="";
var _arr=this.compile(fmt);
if(this.debug){alert("Compiled Array: "+_arr)
}for(var i=0;
i<_arr.length;
i++){_str+=this.tpc_dt_translate(_arr[i])
}return _str
};
this.compile=function(fmt){var _arr=new Array();
var _idx=0;
var _strStart=-1;
var _strEnd=-1;
var _key=null;
var _keyLiteral=null;
for(var i=0;
i<fmt.length;
i++){_strStart=i;
_strEnd=i+1;
_key=fmt.substring(_strStart,_strEnd);
_keyLiteral=_key;
while(true){_strStart++;
_strEnd++;
_arr[_idx]=_keyLiteral;
if(_strEnd>fmt.length){break
}var _tmpKey=fmt.substring(_strStart,_strEnd);
if(_tmpKey==_key){_keyLiteral+=_key;
i++
}else{_idx++;
break
}}}return _arr
};
this.tpc_dt_translate=function(fmt){var t=null;
if(fmt.length<1){return fmt
}else{if(fmt.substring(0,1)=="M"){if(this.debug){alert("Formatting the month ("+fmt+")")
}t=this.d.getMonth();
if(fmt.length<3){var _month=t+1;
return(parseInt(_month)<10&&fmt.length==2)?"0"+_month.toString():_month.toString()
}else{if(fmt.length==3){return this.tpc_dt_month[t].substring(0,3)
}else{return this.tpc_dt_month[t]
}}}else{if(fmt.substring(0,1)=="d"){t=this.d.getDate();
return(fmt.length>1&&parseInt(t<10))?"0"+t.toString():t.toString()
}else{if(fmt.substring(0,1)=="x"){t=this.d.getDate();
var _suffix="th";
if(t!=11&&t!=12&&t!=13){var _tmod=t%10;
if(_tmod==1){_suffix="st"
}else{if(_tmod==2){_suffix="nd"
}else{if(_tmod==3){_suffix="rd"
}}}}return _suffix
}else{if(fmt.substring(0,1)=="y"){t=this.d.getFullYear();
t=""+t;
return(fmt.length<4)?t.substring(2,4):t
}else{if(fmt.substring(0,1)=="i"){t=this.d.getMinutes();
return(fmt.length>1&&t<10)?"0"+t.toString():t.toString()
}else{if(fmt.substring(0,1)=="h"){t=this.d.getHours();
if(parseInt(t)==0){t=12
}else{if(t>12){t-=12
}}return(fmt.length>1&&t<10)?"0"+t.toString():t.toString()
}else{if(fmt.substring(0,1)=="H"){t=this.d.getHours();
return(fmt.length>1&&t<10)?"0"+t.toString():t.toString()
}else{if(fmt.substring(0,1)=="A"||fmt.substring(0,1)=="a"){t=this.d.getHours();
if(t<12){return(fmt[0]=="a")?"am":"AM"
}else{return(fmt[0]=="a")?"pm":"PM"
}}else{if(fmt.substring(0,1)=="s"){t=this.d.getSeconds();
return(fmt.length>1&&t<10)?"0"+t.toString():t.toString()
}else{if(fmt.substring(0,1)=="S"){t=this.d.getMilliseconds();
return t
}else{return fmt
}}}}}}}}}}}};
this.since=function(fmt){var _now=new Date().getTime();
var _diff=_now-this.d.getTime();
if(_diff<0){return this.format(fmt)
}else{if(_diff<this.tpc_dt_second){return this.translateMilliseconds(_diff)+" milliseconds "
}else{if(_diff<this.tpc_dt_minute){var _diffSeconds=this.translateSeconds(_diff);
return _diffSeconds+" second"+((_diffSeconds>1)?"s":"")
}else{if(_diff<this.tpc_dt_hour){var _diffMinutes=this.translateMinutes(_diff);
return _diffMinutes+" minute"+((_diffMinutes>1)?"s":"")
}else{if(_diff<this.tpc_dt_day){var _diffHours=this.translateHours(_diff);
var _diffMinutesMod=this.translateMinutes(_diff%this.tpc_dt_hour);
var _formattedStr=_diffHours+" hour"+((_diffHours>1)?"s":"");
if(_diffMinutesMod>0){_formattedStr+=", "+_diffMinutesMod+" minute"+((_diffMinutesMod>1)?"s":"")
}return _formattedStr
}else{return this.format(fmt)
}}}}}}
};

