
(function($){G4TV.ui.Rating=function(){var ratingKeys=new Array();var ratingKeyScores=new Array();var ratingAction=String;var getRatingUrl=String;var ratingAction='/ratings/set/index.html';var getRatingUrl='/ratings/get/index.html';var self=this;this.pushRatingKey=function(ratingKey){ratingKeys.push(ratingKey);};this.getKeyScore=function(ratingKey){return typeof(ratingKeyScores[ratingKey])!=='undefined'?ratingKeyScores[ratingKey]:0;};this.renderStars=function(){$('.rating-controls').each(function(){var jSelector=$(this);var ratingKey=jSelector.find('input[name=key]').val();var setScore=0;if(jSelector.find('input[type=radio]:checked').length>0){setScore=parseInt(jSelector.find('input[type=radio]:checked').val());}
jSelector.find('form').replaceWith('<div class="rating rating-'+setScore+' disabled" id="rating_'+ratingKey+'">'+'<span class="star-1">1</span><span class="star-2">2</span><span class="star-3">3</span>'+'<span class="star-4">4</span><span class="star-5">5</span>'+'<span class="set-score">'+setScore+'</span>'+'<span class="msg">Login to rate</span>'+'</div>');jSelector.find('div.rating span:not(.set-score .msg)').mouseover(function(){if(!$(this).parent('div.rating').hasClass('disabled')&&!$(this).parent('div.rating').hasClass('successful-rating')){jSelector.find('div.rating').attr('class','rating').addClass('rating-'+$(this).text()).addClass('hover');}}).bind('click',function(){if(G4TV.ui.User.isLoggedIn()){var score=parseInt($(this).text());$.ajax({type:"POST",url:ratingAction,data:"score="+score+"&key="+ratingKey+"&ajax=true",success:function(response){if(response.toLowerCase()==='true'){jSelector.find('span.set-score').text(score);jSelector.find('div.rating').addClass('successful-rating').addClass('rated');jSelector.find('span.msg').text('Thanks for rating!');setTimeout(function(){jSelector.find('div.rating').removeClass('successful-rating');},5000);}}});}else{G4TV.ui.User.loginDialog('You must be logged in to rate content.');}});jSelector.find('div.rating').mouseleave(function(){setTimeout(function(){var score=parseInt(jSelector.find('span.set-score').text());if(!jSelector.find('div.rating').hasClass('disabled')&&!jSelector.find('div.rating').hasClass('successful-rating')){jSelector.find('div.rating').attr('class','rating').addClass('rating-'+score).removeClass('hover');}},100);});if(!G4TV.ui.User.isLoggedIn()){G4TV.ui.User.addOnLoginCallback(function(){setTimeout(function(){var G4Ratings=new G4TV.ui.Rating();},500);jSelector.find('div.rating').removeClass('disabled');});}else{jSelector.find('div.rating').removeClass('disabled');}});};if(G4TV.ui.User.isLoggedIn()){if($('.rating-controls').length===1){var ratingKey=$('.rating-controls').find('input[name=key]').length>0?$('.rating-controls').find('input[name=key]').val():$('.rating-controls div.rating').attr('id').replace('rating_','');$.ajax({type:"GET",url:getRatingUrl,data:"key="+ratingKey+"&ajax=true",ascync:true,cache:false,success:function(score){if(score.toLowerCase()!=="false"){intScore=parseInt(score);if(intScore>0){$('.rating-controls').addClass('rated');$('#rating-form-'+ratingKey+' input[value="'+score+'"]').attr('checked',true);$('#rating_'+ratingKey+' span.set-score').text(score);}
self.renderStars();}}});}else if($('.rating-controls').length>1){var ratingKeys=new Array();$('.rating-controls').each(function(){ratingKeys.push($(this).find('input[name=key]').length>0?$(this).find('input[name=key]').val():$(this).find('div.rating').attr('id').replace('rating_',''));});$.ajax({type:"GET",url:getRatingUrl,data:"key="+ratingKeys.join(',')+"&ajax=true",ascync:true,success:function(response){scoreResponses=response.split(',');var iCount=0;for(var i=0;i<ratingKeys.length;i++){userScore=parseInt(scoreResponses[i]);if(userScore>0&&$('#rating-form-'+ratingKeys[i]).length>0){$('#rating-form-'+ratingKeys[i]).parent('div.rating-controls').addClass('rated');$('#rating-form-'+ratingKeys[i]+' input[value="'+userScore+'"]').attr('checked',true);$('#rating_'+ratingKeys[i]+' span.set-score').text(parseInt(scoreResponses[i]));}
iCount++;if(iCount>=ratingKeys.length){self.renderStars();}}}});}}else{self.renderStars();}};})(jQuery);G4TV.Dom.ready(function(){G4Ratings=new G4TV.ui.Rating();delete G4Ratings;});(function($){$.fn.jCarouselLite=function(o){o=$.extend({btnPrev:null,btnNext:null,btnGo:null,mouseWheel:false,auto:null,speed:200,easing:null,vertical:false,circular:true,visible:3,start:0,scroll:1,beforeStart:null,afterEnd:null},o||{});return this.each(function(){var self=this;self.running=false;var animCss=o.vertical?"top":"left",sizeCss=o.vertical?"height":"width";var div=$(this),ul=$(this).find("ul.carousel:visible",div),tLi=$(this).find("li.carousel-item",ul),tl=tLi.size(),v=o.visible;if(o.circular){ul.prepend(tLi.slice(tl-v-1+1).clone()).append(tLi.slice(0,v).clone());o.start+=v;}
var li=$(ul).find("li.carousel-item",ul),itemLength=li.size(),curr=o.start;div.css("visibility","visible");li.css({overflow:"hidden",float:o.vertical?"none":"left"});ul.css({margin:"0",padding:"0",position:"relative","list-style-type":"none","z-index":"1"});div.css({overflow:"hidden",position:"relative","z-index":"2",left:"0px"});var liSize=o.vertical?height(li):width(li);var ulSize=liSize*itemLength;var divSize=liSize*v;li.css({width:li.width(),height:li.height()});ul.css(sizeCss,ulSize+"px").css(animCss,-(curr*liSize));div.css(sizeCss,divSize+"px");if(o.btnPrev)
$(o.btnPrev).click(function(){if(!$(this).hasClass('disabled')){return go(curr-o.scroll);}});if(o.btnNext)
$(o.btnNext).click(function(){if(!$(this).hasClass('disabled')){return go(curr+o.scroll);}});if(o.btnGo)
$.each(o.btnGo,function(i,val){$(val).click(function(){if(!$(this).parent().hasClass('disabled')){return go(o.circular?o.visible+i:i);}else{return false;}});});if(o.mouseWheel&&div.mousewheel)
div.mousewheel(function(e,d){return d>0?go(curr-o.scroll):go(curr+o.scroll);});if(o.auto)
setInterval(function(){go(curr+o.scroll);},o.auto+o.speed);function vis(){return li.slice(curr).slice(0,v);};function go(to){if(!self.running){if(o.beforeStart)
o.beforeStart.call(this,vis());if(o.circular){if(to<=o.start-v-1){ul.css(animCss,-((itemLength-(v*2))*liSize)+"px");curr=to==o.start-v-1?itemLength-(v*2)-1:itemLength-(v*2)-o.scroll;}else if(to>=itemLength-v+1){ul.css(animCss,-((v)*liSize)+"px");curr=to==itemLength-v+1?v+1:v+o.scroll;}else curr=to;}else{if(to<0||to>itemLength-v)return;else curr=to;}
if(ul.is(':visible')){self.running=true;$(self).addClass("active");ul.animate(animCss=="left"?{left:-(curr*liSize)}:{top:-(curr*liSize)},o.speed,o.easing,function(){if(o.afterEnd)
o.afterEnd.call(this,vis());self.running=false;$(self).removeClass("active");});}
if(!o.circular){$(o.btnPrev+","+o.btnNext).removeClass("disabled");$((curr-o.scroll<0&&o.btnPrev)||(curr+o.scroll>itemLength-v&&o.btnNext)||[]).addClass("disabled");}}
return false;};});};function css(el,prop){return parseInt($.css(el[0],prop))||0;};function width(el){return el[0].offsetWidth+css(el,'marginLeft')+css(el,'marginRight');};function height(el){return el[0].offsetHeight+css(el,'marginTop')+css(el,'marginBottom');};})(jQuery);(function($){G4TV.ui.Playlist={playListTriggers:null,init:function(){this.initEvents();},initEvents:function(){var self=this;$('.icn-plylst').bind('click',function(event){self.add();event.preventDefault();})},add:function(){},remove:function(){}};})(jQuery);(function($){G4TV.ui.mod.Videos=function(el,config){var VID_ELEMENTS={'PLAYER':'.video-player','DIMMER':'.dimmer','CLOSE_BTN':'.close','VIDEO_TITLE':'.video-info'};var vidUrl;var vidId;var nextVideo;var allowHide=false;var self=this;var interval;this.initEvents=function(){$(self.el).find('ul.tabs li a').bind('click',function(){self.hidePlayer();});this.playedVids=[];self.superclass.prototype.initEvents.apply(self);self.oVidContainer=$(self.el).parents('div.vid-mod-wrap').find('.video-player');self.oDimmer=$(self.el).find(VID_ELEMENTS.DIMMER);$(self.el).find('.carousel-item-wrap').live('click',function(event){if(event.button!==2){if(!$(event.target).hasClass('icn-plylst')){aElem=$(this).find('a');self.vidUrl=aElem.attr('href');self.vidId=aElem.attr('rel').replace('video-','');self.allowHide=false;self.showPlayer();event.preventDefault();return false;}}});$(self.el).find(VID_ELEMENTS.CLOSE_BTN).unbind().bind('click',function(){$(this).hide();self.hidePlayer();G4TV.ui.gbl.overlay.hide();return false;});};this.showPlayer=function(){self.allowHide=false;$(self.el).find('.carousel-pagination').fadeTo('fast','.20');$(self.el).find(VID_ELEMENTS.CLOSE_BTN).show();self.oDimmer.show().fadeTo('fast','.85',function(){self.oVidContainer.addClass('open');$(self.el).find(VID_ELEMENTS.CLOSE_BTN).show();setTimeout(function(){$(self.el+'_video-player')[0].showPlayer();},250);self.attachVideo();});$(self.el).find(self.superclass.MODULE_ELEMENTS.CAROUSEL_PAGINATION).addClass('disabled');$(self.el).find(self.superclass.MODULE_ELEMENTS.CAROUSEL_PREV).addClass('disabled');$(self.el).find(self.superclass.MODULE_ELEMENTS.CAROUSEL_NEXT).addClass('disabled');return false;};this.hidePlayer=function(){var self=this;$(self.el).find('.carousel-pagination').fadeTo('fast','100');if(self.allowHide){$(self.el+'_video-player')[0].stopVideo();$(self.el+'_video-player')[0].hidePlayer();self.oVidContainer.removeClass('open');self.oDimmer.fadeTo('normal',0,function(){$(this).hide();});$(self.el).find(self.superclass.MODULE_ELEMENTS.CAROUSEL_PAGINATION).removeClass('disabled');$(self.el).find(self.superclass.MODULE_ELEMENTS.CAROUSEL_PREV).removeClass('disabled');$(self.el).find(self.superclass.MODULE_ELEMENTS.CAROUSEL_NEXT).removeClass('disabled');}};this.attachVideo=function(){var self=this;self.oVidContainer.addClass('open');$(self.el+'_video-player')[0].changeVideo(self.vidId);setTimeout(function(){self.allowHide=true;},100);this.playedVids[self.vidId]=true;var videos=[];$(this.el+' ul.selected div.carousel-item-wrap a.video-cell').each(function(i,vid){videos[$(this).attr('rel').replace('video-','')]=true;});var nextVid=false;for(var vid in videos){if(nextVid&&typeof(this.playedVids[vid])=='undefined'){this.nextVideo=vid;break;}
else if(nextVid){this.hidePlayer();break;}
if(vid==this.vidId){nextVid=true;}}};this.playNextVideo=function(){this.vidId=self.nextVideo;this.attachVideo();};this.attachTitleEvents=function(){var vids=$(self.el).find('div.carousel-item-wrap');var vidTitles=$(self.el).find(VID_ELEMENTS.VIDEO_TITLE);var grow=function(){var oLink=$(this).find('h4'+VID_ELEMENTS.VIDEO_TITLE+' a')[0];var linkHeight=oLink.offsetHeight;if(linkHeight>34){$(oLink).parent().animate({height:51},'fast',function(){$(this).css('overflow','visible');});}};var shrink=function(){var oLink=$(this).find('h4'+VID_ELEMENTS.VIDEO_TITLE+' a')[0];$(oLink).parent().animate({height:38},'fast',function(){$(this).css('overflow','hidden');});};var hoverConfig={sensitivity:2,interval:100,over:grow,timeout:100,out:shrink};$(vids).hoverIntent(hoverConfig);}
this.attachTitleEvents();this.superclass.apply(this,arguments);};jQuery.Class.extend(G4TV.ui.mod.Videos,G4TV.ui.Module);})(jQuery);(function($){G4TV.ui.mod.Screenshots=function(el,config){var self=this;this.initEvents=function(){this.superclass.prototype.initEvents.apply(this);var isReviewMod=$('body').hasClass('review');var isDetailMod=$('body').hasClass('detail');var isBlog=$('body').hasClass('blog');$(this.el).find('.carousel-item-wrap').each(function(){var screenshotWrap=$(this).find('.screenshot-wrap');var imgLink=screenshotWrap.html();var imgTitle=$(this).find('h4');var platforms=$(this).find('ul.platforms');platforms=platforms.length>0?platforms.html():'';var metaInfo=$(this).find('p.meta-info');metaInfo=metaInfo.length>0?'<p class="meta-info">'+metaInfo.html()+'</p>':'';strHtml='<div class="screenshot-large">'+imgLink;if(imgTitle.length>0){strHtml+="<h4>"+imgTitle.html()+"</h4>";}
if(metaInfo.length>0){strHtml+=metaInfo;}
if(platforms.length>0){strHtml+=platforms;}
screenshotWrap.append(strHtml+"</div>");});if(typeof(this.config.imagesGallery)!=='undefined'){$(this.el).find('.screenshot-large a').click(function(){$(self.el).find('.carousel-item-wrap').removeClass('selected');$(this).parents('.carousel-item-wrap').addClass('selected');var newTitle=$(this).parents('div.screenshot-large').find('h4').text();self.config.imagesGallery.config.vars.gallery=$(this).attr('rel').replace('gallery-','');self.config.imagesGallery.config.page=1;self.config.imagesGallery.update(function(){$(self.config.imagesGallery.el).find('.hd h3').text(newTitle);self.config.imagesGallery.resetSortMenus();});return false;});}
var itemWraps=$(self.el).find('.screenshot-container');var rows=$(self.el).find('.carousel-row');var grow=function(){var screenshot=$(this).find('.screenshot-large');if(jQuery.browser.safari){var leftPos=$(screenshot).closest('.carousel-item-wrap').attr('offsetLeft');var rowLeftPos=$(screenshot).closest('.carousel-row').attr('offsetLeft');if(leftPos==rowLeftPos){$(screenshot).css('left',0);}
if(leftPos-rowLeftPos==453){if(isReviewMod||isDetailMod)
$(screenshot).css('left','-69px');else
$(screenshot).css('left','-93px');}}else{var parentLeftPos=$(screenshot).closest('li')[0].getBoundingClientRect().left;var leftPos=$(this).closest('.carousel-item-wrap')[0].getBoundingClientRect().left
var parentRightPos=$(screenshot).closest('li')[0].getBoundingClientRect().right;var rightPos=$(this).closest('.carousel-item-wrap')[0].getBoundingClientRect().right
var diff=(isReviewMod||isDetailMod)?9:10;if(isBlog)diff=5;if(leftPos==parentLeftPos){$(screenshot).css('left',0);}
if(parentRightPos-diff==rightPos){if(isReviewMod||isDetailMod||isBlog)
$(screenshot).css('left','-78px');else
$(screenshot).css('left','-69px');}}
$(this).closest('.carousel-item-wrap').addClass('on');$(screenshot).show();};var shrink=function(){$(this).find('.screenshot-large').hide();$(this).closest('.carousel-item-wrap').removeClass('on');};var hoverConfig={sensitivity:2,interval:0,over:grow,timeout:0,out:shrink}
if(typeof(this.config.omitHovers)==='undefined'||(typeof(this.config.omitHovers)!=='undefined'&&this.config.omitHovers!=true)){$(itemWraps).hoverIntent(hoverConfig);}}
this.superclass.apply(this,arguments);};jQuery.Class.extend(G4TV.ui.mod.Screenshots,G4TV.ui.Module);})(jQuery);(function(jQuery){var self=null;jQuery.fn.autogrow=function(o)
{return this.each(function(){new jQuery.autogrow(this,o);});};jQuery.autogrow=function(e,o)
{this.options=o||{};this.dummy=null;this.interval=null;this.line_height=this.options.lineHeight||parseInt(jQuery(e).css('line-height'));this.min_height=this.options.minHeight||parseInt(jQuery(e).css('min-height'));this.max_height=this.options.maxHeight||parseInt(jQuery(e).css('max-height'));;this.textarea=jQuery(e);if(this.line_height==NaN)
this.line_height=0;this.init();};jQuery.autogrow.fn=jQuery.autogrow.prototype={autogrow:'1.2.2'};jQuery.autogrow.fn.extend=jQuery.autogrow.extend=jQuery.extend;jQuery.autogrow.fn.extend({init:function(){var self=this;this.textarea.css({overflow:'hidden',display:'block'});this.textarea.bind('focus',function(){self.startExpand()}).bind('blur',function(){self.stopExpand()});this.checkExpand();},startExpand:function(){var self=this;this.interval=window.setInterval(function(){self.checkExpand()},400);},stopExpand:function(){clearInterval(this.interval);},checkExpand:function(){if(this.dummy==null)
{this.dummy=jQuery('<div></div>');this.dummy.css({'font-size':this.textarea.css('font-size'),'font-family':this.textarea.css('font-family'),'width':this.textarea.css('width'),'padding':this.textarea.css('padding'),'line-height':this.line_height+'px','overflow-x':'hidden','position':'absolute','top':0,'left':-9999}).appendTo('body');}
var html=this.textarea.val().replace(/(<|>)/g,'');if(jQuery.browser.msie)
{html=html.replace(/\n/g,'<BR>new');}
else
{html=html.replace(/\n/g,'<br>new');}
if(this.dummy.html()!=html)
{this.dummy.html(html);if(this.max_height>0&&(this.dummy.height()+this.line_height>this.max_height))
{this.textarea.css('overflow-y','auto');}
else
{this.textarea.css('overflow-y','hidden');if(this.textarea.height()<this.dummy.height()+this.line_height||(this.dummy.height()<this.textarea.height()))
{this.textarea.animate({height:(this.dummy.height()+this.line_height)+'px'},100);}}}}});})(jQuery);(function($){G4TV.ui.mod.Comments=function(el,config){var ratingUrl='http://g4tv.com/ratings/vote/index.html';var repliesUrl='http://g4tv.com/comments/replies/index.html';var postUrl='http://g4tv.com/comments/post/index.html';var postReplyUrl='http://g4tv.com/comments/postreply/index.html';var reportUrl='http://g4tv.com/comments/report/index.html';var scoreThresholds={buried:-10,negative:0,positive:10,highlighted:50};var iMaxChars=5000;var self=this;this.origPostBox=$('#top-level-reply').clone();$('.comments .buried .show-comment').live('click',function(){$(this).parents('li.content-item').removeClass('closed');return false;});$('.comments .buried .hide-comment').live('click',function(){$(this).parents('li.content-item').addClass('closed');return false;});$('#comments .sort-content ul.opts li a').bind('click',function(){G4TV.Cookie.set('CommentSort',$(this).text());});$('.comments .replies-count').live('click',function(){var parentElem=$(this).parents('li.content-item');var repliesWrap=parentElem.find('.replies')
var replies=repliesWrap.find('ul.content-list');if(replies.length<1){repliesWrap.addClass('loading');$.ajax({type:"GET",url:repliesUrl,data:"key="+parentElem.attr('id').replace('comment-',''),ascync:true,success:function(response){if(response.toLowerCase()!=="false"){repliesWrap.addClass('open');repliesWrap.removeClass('loading');repliesWrap.append(response);}}});}else{repliesWrap.toggleClass('open');}
return false;});$('.comments a.thumbs-down').live('click',function(){if(G4TV.ui.User.isLoggedIn()){self.updateRatingScore(this,'down');}else{G4TV.ui.User.loginDialog('Please login to rate comments');}
return false;});$('.comments a.thumbs-up').live('click',function(){if(G4TV.ui.User.isLoggedIn()){self.updateRatingScore(this,'up');}else{G4TV.ui.User.loginDialog('Please login to rate comments');}
return false;});$('.comments a.reply').live('click',function(){if(G4TV.ui.User.isLoggedIn()){if(!$(this).hasClass('to-thread')){var parentElem=$(this).parents('li.content-item');}else{var parentElem=$(this).parents('li').parent('ul').parents('li.content-item');}
var commentKey=parentElem.attr('id').replace('comment-','');var sIdPrefix=!$(this).hasClass('to-thread')?"reply-to-":"reply-to-thread-";if($('#'+sIdPrefix+commentKey).length<1){if(!$(this).hasClass('to-thread')){parentElem.find('.comment-info').each(function(i,item){if(i===0){$(this).after(self.injectPostBox(commentKey,sIdPrefix));}});}else{$(this).after(self.injectPostBox(commentKey,sIdPrefix));}
$('#'+sIdPrefix+commentKey+' textarea').focus();if(!$.browser.msie){setTimeout(function(){$('#'+sIdPrefix+commentKey+' textarea').autogrow().focus();},100);}}else{if($('#'+sIdPrefix+commentKey).hasClass('open')){$('#'+sIdPrefix+commentKey).removeClass('open');}else{$('#'+sIdPrefix+commentKey).addClass('open');$('#'+sIdPrefix+commentKey+' textarea').focus();}}}else{G4TV.ui.User.loginDialog('Please login to add your comment');}
return false;});$('.comments a.report').live('click',function(){var elem=$(this);if(!$(this).hasClass('reported')){if(G4TV.ui.User.isLoggedIn()){var parentElem=$(this).parents('li.content-item');$.ajax({type:"POST",url:reportUrl,data:"key="+parentElem.attr('id').replace('comment-',''),success:function(){elem.addClass('reported').fadeTo('slow',.4).css('cursor','default').attr('title','This comment has been reported').blur();alert('Thanks for reporting an inappropriate comment, we\'ll have someone from our mod squad investigate it.');}});}else{G4TV.ui.User.loginDialog('Please login to report a comment');}}
return false;});$('.comments textarea').live('keyup',function(e){var sComment=$(this).val();$(this).parents('div.add-comment').find('.char-count em').text(addCommas(iMaxChars-sComment.length));});$('#top-level-reply textarea').bind('focus click change select submit keydown keypress keyup',function(){if(!G4TV.ui.User.isLoggedIn()){G4TV.ui.User.loginDialog('Please login to add your commment');}});$('#top-level-reply div.avatar img').attr('src',G4TV.ui.User.avatarUrl);if(!$.browser.msie){$('#top-level-reply textarea').addClass('autogrow');jQuery('#top-level-reply textarea').autogrow();}
jQuery('#top-level-reply form').bind('submit',function(){if(G4TV.ui.User.isLoggedIn()){self.postComment($(this),'top');}else{if($.trim($(this).find('textarea').val()).length>0){G4TV.ui.User.loginDialog('Whoa! Slow down there, skippy! We\'d love to post your comment, we just need you to login first. Thanks!');}else{G4TV.ui.User.loginDialog('First: you\'re not logged in, and second: you didn\'t even type anything in the comment box. Do you think we have mind readers on staff here? *SHAZAM*... Uh...nope. Just login in and type some stuff in the pretty box, will ya?');}}
return false;});this.injectPostBox=function(sCommentKey,sIdPrefix){var newPostBox=this.origPostBox.clone();newPostBox.addClass('nested-reply');newPostBox.find('form').attr('action',postReplyUrl);newPostBox.attr('id',sIdPrefix+sCommentKey);newPostBox.find('input[name="key"]').val(sCommentKey);newPostBox.find('div.char-count em').val('5,000');newPostBox.find('form').bind('submit',function(){self.postComment($(this),'reply');return false;});return newPostBox;};this.postComment=function(formElem,level){var commentVal=$.trim(formElem.find('textarea').val());if(commentVal.length>0){formElem.find('.post-button-wrap').addClass('loading');formElem.find('textarea, input.submit').attr('disabled',true);var commentKey=formElem.find('input[name="key"]').val();var objectType=formElem.find('input[name="type"]').val();var replies=level=="top"?formElem.parents('div.mod-wrap-3').find('div.bd'):formElem.parents('li.content-item').find('.replies');var requestReplies=replies.find('ul').length>0?false:true;var formAction=formElem.attr('action');$.ajax({type:"POST",url:formAction,data:"key="+commentKey+"&type="+objectType+"&body="+urlencode(commentVal)+"&replies="+requestReplies+"&ajax=true",ascync:true,success:function(response){if(response.toLowerCase()!=="false"&&$.trim(response)!==""&&$(response).find('h5').length>0){if(level=="top"){if(!requestReplies){var ulElem=$('.comments .bd ul:first');var liPost;if(G4TV.Cookie.get("CommentSort","Oldest First")!="Newest First"){ulElem.append(response);}else{ulElem.prepend(response);ulElem.find('li:first').removeClass('last-item');jQuery('html,body').animate({scrollTop:jQuery('.comments .bd ul:first').offset().top},500);}}else{$('.comments div.bd').prepend(response);}
formElem.find('textarea').val('').attr('disabled',false);$('#top-level-reply').find('.char-count em').text('5,000');}else{if(!requestReplies){if(!replies.hasClass('open')){replies.addClass('open');replies.removeClass('no-replies');}
replies.find('ul li.reply-to-thread').before(response);}else{replies.append(response);replies.addClass('open');replies.removeClass('no-replies');}
var repliesCount=replies.find('a.replies-count');var currentReplies=repliesCount.text().split(' ')[0];var newReplyCount=parseInt(currentReplies)+1;repliesCount.text(newReplyCount>1?newReplyCount+' Replies':'1 Reply');formElem.parents('div.add-comment').remove();}
formElem.find('.post-button-wrap').removeClass('loading');}else{if(response!==""){alert(response);}else{alert('Ack! There was an unexpected error -- our Internets are broken! Please try to post your comment again.');}
formElem.find('textarea').attr('disabled',false);}},error:function(){}});}else{alert('Oh, we can\' this let you post a comment with nothing in it. We need some words, some flavor, some spice -- get to typing and make the magic happen!');}};this.getComments=function(itemKey){$.get('http://g4tv.com/comments/get/index.html?key='+itemKey+'&page=1&ajax=true',null,function(response){$(".comments .content-list").replaceWith($(response).find('.response-content.content-list ul'));$(".comments .hd").replaceWith($(response).find('.response-content.hd div.hd'));$(".comments .pagination").replaceWith($(response).find('.response-content.pagination div.pagination'));$('#top-level-reply').find('.char-count em').text('5,000');$('#top-level-reply').find('input[name="key"]').val(itemKey);$('#top-level-reply').find('textarea').val('');});};this.updateRatingScore=function(oRatingEl,sVoteAction){var userRatingsWrap=$(oRatingEl).parents('.user-rating');if(!userRatingsWrap.hasClass('voted')){userRatingsWrap.addClass('voted');userRatingsWrap.find((sVoteAction=="up"?'a.thumbs-up':'a.thumbs-down')).addClass('voted');userRatingsWrap.find((sVoteAction=="up"?'a.thumbs-down':'a.thumbs-up')).fadeTo('slow',.3);var commentKey=$(oRatingEl).parents('li.content-item').attr('id').replace('comment-','');var scoreWrap=$(oRatingEl).parents('.user-rating').find('span.score');var currentScore=parseInt(scoreWrap.text().replace(/\,/g,''));var newScore=parseInt(sVoteAction=="up"?(currentScore+1):(currentScore-1));$.ajax({type:"POST",url:ratingUrl,data:"key="+commentKey+"&action="+sVoteAction+"&nickname="+G4TV.ui.User.screenName+"&ajax=true",ascync:true,success:function(response){if(response.toLowerCase()=="true"){scoreWrap.text(addCommas(newScore>0?'+'+newScore:newScore));if(newScore<scoreThresholds.negative){scoreWrap.attr('class','score negative');}
else if(newScore>=scoreThresholds.highlighted){scoreWrap.attr('class','score highlighted');}
else if(newScore>=scoreThresholds.positive){scoreWrap.attr('class','score positive');}else{scoreWrap.attr('class','score');}}else{userRatingsWrap.removeClass('voted');userRatingsWrap.find('a.thumbs-up, a.thumbs-down').fadeTo('fast',1).removeClass('voted');if(response.toLowerCase()!=="false"){alert(response);}else{alert('Oops! Something went wrong -- your vote has not been counted. Please try again later.');}}},error:function(){userRatingsWrap.removeClass('voted');userRatingsWrap.find('a.thumbs-up, a.thumbs-down').fadeTo('fast',1).removeClass('voted');alert('Oops! Something went wrong -- your vote has not been counted. Please try again later.');}});}};this.superclass.apply(this,arguments);};jQuery.Class.extend(G4TV.ui.mod.Comments,G4TV.ui.Module);})(jQuery);(function($){G4TV.ui.GameToolTips={init:function(toolTipParentClass){var tipLinks=$('a.game');var settings=G4TV.gbl.defaults[0]['simpleTipSettings'];settings.parentClass=typeof(toolTipParentClass)!=="undefined"?toolTipParentClass:'tooltip game';$.each(tipLinks,function(){var content=$(this).closest('li').find('.tooltip-content:first');if(content.length>0){var tooltip=$(this).simpletip(content.html(),settings);}});$('.tooltip.game').each(function(){if($(this).find('arrow').length===0){$('.tooltip.game').append('<div class="arrow"></div><div class="btm"></div><div class="rt"></div><div class="crnr"></div>');}});},remove:function(selector){$(selector).remove();}}})(jQuery);G4TV.ui.ThemeManager.darkThemeFlashColors='0x0077C1,0x0077C1,0xff620e,0xffc46f';G4TV.ui.ThemeManager.lightThemeFlashColors='0x1963BE,0x1963BE,0x083f6f,0x67b0cc';