
(function($){G4TV.ui.mod.TipTheFeed=function(el){$(el+' form').bind('submit',function(){return false;});$(el+' input[type="submit"]').click(function(){if(!$(el).hasClass('open')){$(el).addClass('open');$(el+' .bd').animate({'height':'320px'},1200,null,function(){$(this).css('min-height','320px').css('height','auto');$(el+' fieldset').show().fadeTo('normal',1);});}else{$.ajax({type:"POST",url:'http://g4tv.com/thefeed/submittip/index.html',data:'tip='+urlencode($(el+' #tip-tf-tip').val())+'&name='+urlencode($(el+' #tip-tf-name').val())+'&email='+urlencode($(el+' #tip-tf-email').val()),success:function(response){if(response.toLowerCase()=="true"){if($(el+' p.success').length<1){$(el+' p:first').after('<p class="success">Thanks for the tip!</p>');}
$(el+' fieldset').fadeTo('fast',0).hide();$(el+' .bd').css('min-height','0px');$(el+' #tip-tf-tip').val('')
$(el+' #tip-tf-email').val('');$(el+' #tip-tf-name').val('');$(el).removeClass('open');setTimeout(function(){$(el+' .success, '+el+' .error').fadeTo('normal',0).remove();},3500);}else{if($(el+' p.error').length<1){$(el+' p:first').after('<p class="error">'+response+'</p>');}else{$(el+' p.error').text(response);}}}});}
return false;});};})(jQuery);jQuery(document).ready(function(){var test2=new G4TV.ui.mod.TipTheFeed('#tip-feed');});(function($){G4TV.ui.mod.BlogTags=function(el){$('.content-expand',el).hide().removeClass("hidden");$('.ft a',el).toggle(function(){$(el+' .tag-content.selected .selected .content-expand').slideDown('slow');$(this).html("Minimize").removeClass("closed").addClass("open");},function(){$(el+' .tag-content.selected .selected .content-expand').slideUp('slow');$(this).html("Expand").removeClass("open").addClass("closed");});$(el+' .nav a').click(function(){var display=$(this).attr('rel');$(el+' .nav a').removeClass('selected');$(this).addClass('selected');if(display=="tag-cloud"){$(el+' .tag-list').removeClass('selected');$(el+' .tag-cloud').addClass('selected');}else{$(el+' .tag-list').addClass('selected');$(el+' .tag-cloud').removeClass('selected');}
return false;});$(el+' .tabs, '+el+' .tabs a, '+el+' .tabs *').unbind('click');$(el+' .tabs a').click(function(){var tagId=$(this).attr('href');$(el+' .tabs li').removeClass('selected');$(this).parents('li').addClass('selected');$(el+' .tag-content').removeClass('selected');$(tagId).addClass('selected');return false;});};})(jQuery);(function($){G4TV.ui.mod.Multiplex=function(el,config){var self=this;this.initEvents=function(){var oContentList=$(this.el).find(this.superclass.MODULE_ELEMENTS.CONTENT_LIST);$(self.el).find('.header-nav li').bind('click',function(){var section=$(this).find('a').attr('rel');$(self.el).find('.header-nav li.selected').removeClass('selected');$(this).addClass('selected');$(self.el).find('div.bd div.content').removeClass('selected');$(self.el).find('div.bd #'+section).addClass('selected');return false;});$(self.el).find('.side-nav').find('li').bind('click',function(){try{$(self.el).find('#multiplex-podcasts').find('.podcast.selected').removeClass('selected');$(self.el).find($(this).find('a').attr('href')).addClass('selected');}catch(e){console.warn(e);}
$(this).closest('.side-nav').find('.selected').removeClass('selected');$(this).addClass('selected');return false;});};$(self.el).find('form').bind('submit',function(){var parentElem=$(self.el).find('form');var inputs=[];parentElem.find("input, textarea, select").each(function(i,item){var input=jQuery(item);if(input.attr('type')!='submit'){inputs.push(input.attr('name')+'='+input.val());}});$.ajax({type:"POST",url:'http://g4tv.com/newsletter/subscribe/index.html',data:inputs.join('&'),success:function(data){if(data=='true'){alert('true');}else{alert('false');}}});return false;});this.superclass.apply(this,arguments);};jQuery.Class.extend(G4TV.ui.mod.Multiplex,G4TV.ui.Module);})(jQuery);(function($){G4TV.ui.AjaxPoll={Vote:function(pollKey){var pollDiv="mod_poll_"+pollKey;var pollDivArea="mod_poll_area_"+pollKey;var choiceKey=jQuery("#"+pollDiv+" input[@name='rdoChoice']:checked").val();if(choiceKey=='undefined'){alert("Please select at poll choice before voting");}else{var url='/poll/ajaxvote/{0}/{1}/index.html'.format(pollKey,choiceKey);$.ajax({url:url,dataType:'html',success:function(data){jQuery("#"+pollDivArea).html(data);}});}}}})(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 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+"&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);var google_ad_client='';var google_ad_channel='';var google_ad_output='';var google_max_num_ads=4;var google_ad_type='';var google_image_size='';var google_feedback='';(function($){G4TV.ui.CustomGoogleAds={AdsenseUrl:'http://pagead2.googlesyndication.com/pagead/show_ads.js',Item:function(){var NumberOfAds;var AdType;var AdSize;var PartnerId;var AdOutput;var DebugMode;var AdChannel;var DivId;var Feedback;var Active='false';},Clear:function(){var self=this;this.Item.PartnerId='';this.Item.AdChannel='';this.Item.AdOutput='';this.Item.NumberOfAds='';this.Item.AdType='';this.Item.AdSize='';this.Item.Feedback='';this.Item.Active='';google_ad_client=this.Item.PartnerId;google_ad_channel=this.Item.AdChannel;google_ad_output=this.Item.AdOutput;google_max_num_ads=this.Item.NumberOfAds;google_ad_type=this.Item.AdType;google_image_size=this.Item.AdSize;google_feedback=this.Item.Feedback;},Run:function(){var self=this;if(this.Item.Active=='true'){google_ad_client=this.Item.PartnerId;google_ad_channel=this.Item.AdChannel;google_ad_output=this.Item.AdOutput;google_max_num_ads=this.Item.NumberOfAds;google_ad_type=this.Item.AdType;google_image_size=this.Item.AdSize;google_feedback=this.Item.Feedback;document.write('<script src="',this.AdsenseUrl,'" type="text/JavaScript"><\/script>');}},DoTextAd:function(objItem,objAds){var self=this;var strDivId=objItem.DivId;var objContent=$('#'+strDivId);var strTemplate=$('#'+strDivId+'_TextAdTemplate').html().replaceAll('%5B%5B','[[').replaceAll('%5D%5D',']]');objContent.html('');objContent.append('<ul>');for(i=0;i<objAds.length;++i){var strHtml=strTemplate;strHtml=strHtml.replaceAll('[[Url]]',objAds[i].url);strHtml=strHtml.replaceAll('[[TitleText]]',objAds[i].line1.titleCase());strHtml=strHtml.replaceAll('[[Description]]',objAds[i].line2+' '+objAds[i].line3+'<br/>');strHtml=strHtml.replaceAll('[[VisibleUrl]]',objAds[i].visible_url);objContent.find('ul').append(strHtml);}
objContent.append('</ul>');},DoImageAd:function(objItem,objAds){var self=this;var strDivId=objItem.DivId;var objContent=$('#'+strDivId);objContent.html('');objContent.append('<ul>');var strHtml='';strHtml+='<a href="'+objAds[0].url+'" target="_top" title="Go To '+objAds[0].visible_url+'"><img border="0" src="'+objAds[0].image_url+'"width="'+objAds[0].image_width+'"height="'+objAds[0].image_height+'"></a>';objContent.find('ul').append(strHtml);objContent.append('</ul>');},DoFlashAd:function(objItem,objAds){var self=this;var strDivId=objItem.DivId;var objContent=$('#'+strDivId);objContent.html('');objContent.append('<ul>');var strHtml='';strHtml+='<li><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" ';strHtml+='codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" ';strHtml+='WIDTH="'+objAds[0].image_width+'" HEIGHT="'+objAds[0].image_height+'"> <PARAM NAME="movie" VALUE="'+objAds[0].image_url+'">';strHtml+='<PARAM NAME="quality" VALUE="high">'+'<PARAM NAME="AllowScriptAccess" VALUE="never">'+'<EMBED src="'
strHtml+=objAds[0].image_url+'" WIDTH="'+objAds[0].image_width+'" HEIGHT="'+objAds[0].image_height+'" TYPE="application/x-shockwave-flash"';strHtml+=' AllowScriptAccess="never" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer"></EMBED></OBJECT></li>';objContent.find('ul').append(strHtml);objContent.append('</ul>');}}})(jQuery);function google_ad_request_done(google_ads){if(typeof(G4TV.ui.CustomGoogleAds=='undefined')&&G4TV.ui.CustomGoogleAds.Item.Active!='true')
return false;var objItem=G4TV.ui.CustomGoogleAds.Item;if(objItem.Active=='true'){if(objItem.AdType=='text'&&google_ads.length>0)
G4TV.ui.CustomGoogleAds.DoTextAd(objItem,google_ads);else if(objItem.AdType=='image'&&google_ads.length>0)
G4TV.ui.CustomGoogleAds.DoImageAd(objItem,google_ads);else if(objItem.AdType=='flash+image+html'&&google_ads.length>0)
G4TV.ui.CustomGoogleAds.DoFlashAd(objItem,google_ads);if(typeof(google_info.feedback_url)!='undefined'){var strParentDiv=objItem.DivId.substring(objItem.DivId.indexOf('_')+1);jQuery('#'+strParentDiv).find('h3 a').attr('href',google_info.feedback_url).attr('target','_blank');}}}