
var ZeroClipboard={version:"1.0.4",clients:{},moviePath:'ZeroClipboard.swf',nextId:1,$:function(thingy){if(typeof(thingy)=='string')thingy=document.getElementById(thingy);if(!thingy.addClass){thingy.hide=function(){this.style.display='none';};thingy.show=function(){this.style.display='';};thingy.addClass=function(name){this.removeClass(name);this.className+=' '+name;};thingy.removeClass=function(name){this.className=this.className.replace(new RegExp("\\s*"+name+"\\s*")," ").replace(/^\s+/,'').replace(/\s+$/,'');};thingy.hasClass=function(name){return!!this.className.match(new RegExp("\\s*"+name+"\\s*"));}}
return thingy;},setMoviePath:function(path){this.moviePath=path;},dispatch:function(id,eventName,args){var client=this.clients[id];if(client){client.receiveEvent(eventName,args);}},register:function(id,client){this.clients[id]=client;},getDOMObjectPosition:function(obj){var info={left:0,top:0,width:obj.width?obj.width:obj.offsetWidth,height:obj.height?obj.height:obj.offsetHeight};while(obj){info.left+=obj.offsetLeft;info.top+=obj.offsetTop;obj=obj.offsetParent;}
return info;},Client:function(elem){this.handlers={};this.id=ZeroClipboard.nextId++;this.movieId='ZeroClipboardMovie_'+this.id;ZeroClipboard.register(this.id,this);if(elem)this.glue(elem);}};ZeroClipboard.Client.prototype={id:0,ready:false,movie:null,clipText:'',handCursorEnabled:true,cssEffects:true,handlers:null,glue:function(elem){this.domElement=ZeroClipboard.$(elem);var zIndex=99;if(this.domElement.style.zIndex){zIndex=parseInt(this.domElement.style.zIndex)+1;}
var box=ZeroClipboard.getDOMObjectPosition(this.domElement);this.div=document.createElement('div');var style=this.div.style;style.position='absolute';style.left=''+box.left+'px';style.top=''+box.top+'px';style.width=''+box.width+'px';style.height=''+box.height+'px';style.zIndex=zIndex;var body=document.getElementsByTagName('body')[0];body.appendChild(this.div);this.div.innerHTML=this.getHTML(box.width,box.height);},getHTML:function(width,height){var html='';var flashvars='id='+this.id+'&width='+width+'&height='+height;if(navigator.userAgent.match(/MSIE/)){var protocol=location.href.match(/^https/i)?'https://':'http://';html+='<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="'+protocol+'download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" width="'+width+'" height="'+height+'" id="'+this.movieId+'" align="middle"><param name="allowScriptAccess" value="always" /><param name="allowFullScreen" value="false" /><param name="movie" value="'+ZeroClipboard.moviePath+'" /><param name="loop" value="false" /><param name="menu" value="false" /><param name="quality" value="best" /><param name="bgcolor" value="#ffffff" /><param name="flashvars" value="'+flashvars+'"/><param name="wmode" value="transparent"/></object>';}
else{html+='<embed id="'+this.movieId+'" src="'+ZeroClipboard.moviePath+'" loop="false" menu="false" quality="best" bgcolor="#ffffff" width="'+width+'" height="'+height+'" name="'+this.movieId+'" align="middle" allowScriptAccess="always" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" flashvars="'+flashvars+'" wmode="transparent" />';}
return html;},hide:function(){if(this.div){this.div.style.left='-2000px';}},show:function(){this.reposition();},destroy:function(){if(this.domElement&&this.div){this.hide();this.div.innerHTML='';var body=document.getElementsByTagName('body')[0];try{body.removeChild(this.div);}catch(e){;}
this.domElement=null;this.div=null;}},reposition:function(elem){if(elem){this.domElement=ZeroClipboard.$(elem);if(!this.domElement)this.hide();}
if(this.domElement&&this.div){var box=ZeroClipboard.getDOMObjectPosition(this.domElement);var style=this.div.style;style.left=''+box.left+'px';style.top=''+box.top+'px';}},setText:function(newText){this.clipText=newText;if(this.ready)this.movie.setText(newText);},addEventListener:function(eventName,func){eventName=eventName.toString().toLowerCase().replace(/^on/,'');if(!this.handlers[eventName])this.handlers[eventName]=[];this.handlers[eventName].push(func);},setHandCursor:function(enabled){this.handCursorEnabled=enabled;if(this.ready)this.movie.setHandCursor(enabled);},setCSSEffects:function(enabled){this.cssEffects=!!enabled;},receiveEvent:function(eventName,args){eventName=eventName.toString().toLowerCase().replace(/^on/,'');switch(eventName){case'load':this.movie=document.getElementById(this.movieId);if(!this.movie){var self=this;setTimeout(function(){self.receiveEvent('load',null);},1);return;}
if(!this.ready&&navigator.userAgent.match(/Firefox/)&&navigator.userAgent.match(/Windows/)){var self=this;setTimeout(function(){self.receiveEvent('load',null);},100);this.ready=true;return;}
this.ready=true;this.movie.setText(this.clipText);this.movie.setHandCursor(this.handCursorEnabled);break;case'mouseover':if(this.domElement&&this.cssEffects){this.domElement.addClass('hover');if(this.recoverActive)this.domElement.addClass('active');}
break;case'mouseout':if(this.domElement&&this.cssEffects){this.recoverActive=false;if(this.domElement.hasClass('active')){this.domElement.removeClass('active');this.recoverActive=true;}
this.domElement.removeClass('hover');}
break;case'mousedown':if(this.domElement&&this.cssEffects){this.domElement.addClass('active');}
break;case'mouseup':if(this.domElement&&this.cssEffects){this.domElement.removeClass('active');this.recoverActive=false;}
break;}
if(this.handlers[eventName]){for(var idx=0,len=this.handlers[eventName].length;idx<len;idx++){var func=this.handlers[eventName][idx];if(typeof(func)=='function'){func(this,args);}
else if((typeof(func)=='object')&&(func.length==2)){func[0][func[1]](this,args);}
else if(typeof(func)=='string'){window[func](this,args);}}}}};(function($){G4TV.ui.CopyToClipboard=function(el){var self=this;this.el=el;ZeroClipboard.setMoviePath(G4TV.gbl.SWF_DIR+'shared/ZeroClipboard.swf');this.copyInput=function(){var target=this;var oInput=$(this).prev();var inputVal=oInput.attr('value');var clip=new ZeroClipboard.Client();$(window).bind('resize',function(){});clip.setText(inputVal);clip.glue(this);var oMovie=$('#'+clip.movieId);oMovie.bind('click',function(){oInput.focus().select();}).hover(function(){$(target).addClass('on');},function(){$(target).removeClass('on');});};$(this.el).find('.copy').bind('mouseover',function(){self.copyInput.apply(this);});}})(jQuery);(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;});var playerInView=true;(function($){G4TV.ui.mod.ImageDetail=function(el,config){var self=this;var ajaxUrl="http://g4tv.com/images/{gallery_id}/null/{image_id}/index.html?ajax=true";this.init=function(){var self=this;this.el=el;this.config=config;this.self=this;$('#gallery-images div.thumb a').live('click',function(e){if(e.button!==2){var imageInfo=$(this).attr('id').replace('image-','').split('-');var galleryId=imageInfo[0];var imageId=imageInfo[1];self.loadImage(galleryId,imageId,$(this).attr('href'));return false;}});};this.initPage=function(){G4TV.ui.CopyToClipboard('.copy-tools');};this.loadImage=function(galleryId,imageId,imageTrackUrl){var imageAjaxUrl=ajaxUrl.replace('{gallery_id}',galleryId).replace('{image_id}',imageId);$.ajax({type:"GET",url:imageAjaxUrl,success:function(response){G4TV.Track.page(imageTrackUrl);var responseimage=$(response).find('.image').html();$('div.image').css({'min-height':$('div.image').height()});$('div.image').fadeTo("normal",0.50,function(){$('div.image').html(responseimage);});$('div.image').css({'min-height':'10px','height':'auto'});$('div.image').fadeTo("normal",1.00);$('div.image-details').html($(response).find('.image-details').html());$(self.el).find('div.hd h3').replaceWith($(response).find('.hd h3'));var imageName=$(response).find('.add-this-info .name').text();var imageUrl=$(response).find('.add-this-info .url').text();var imageShortUrl=$(response).find('.add-this-info .short-url').text();$('div.vid-details .add-this-wrap').html(showAddThis(imageUrl,imageName,imageShortUrl,true));self.initPage();G4TV.ui.Rating();ModComments.config.vars.key="Photo_"+imageId;ModComments.getComments("Photo_"+imageId);}});};}})(jQuery);(function($){G4TV.ui.mod.Discussions=function(el,config){this._updateVisibleContentLength=function(contentList){this.visibleContentLength=$(contentList).find(this.superclass.MODULE_ELEMENTS.CONTENT_ITEM+':not(".hidden")').length;};this.hideLastContentItem=function(obj){var assocContentList=$(obj).closest(this.superclass.MODULE_ELEMENTS.MOD_OPTS).next(this.superclass.MODULE_ELEMENTS.CONTENT_LIST);if($(assocContentList).find(this.superclass.MODULE_ELEMENTS.CONTENT_ITEM+':not(".hidden")').length>1){var lastShownItem=$(assocContentList).find(this.superclass.MODULE_ELEMENTS.CONTENT_ITEM+':not(".hidden"):last');$(lastShownItem[0]).toggleClass('hidden');}
this._updateVisibleContentLength(assocContentList);var lastShownItem=$(assocContentList).find(this.superclass.MODULE_ELEMENTS.CONTENT_ITEM+':not(".hidden"):last');$(lastShownItem[0]).addClass('last-item');};this.showNextContentItem=function(obj){var assocContentList=$(obj).closest(this.superclass.MODULE_ELEMENTS.MOD_OPTS).next(this.superclass.MODULE_ELEMENTS.CONTENT_LIST);if($(assocContentList).find(this.superclass.MODULE_ELEMENTS.CONTENT_ITEM+'.hidden').length>0){var firstHiddenItem=$(assocContentList).find(this.superclass.MODULE_ELEMENTS.CONTENT_ITEM+'.hidden:first');var lastShownItem=$(assocContentList).find(this.superclass.MODULE_ELEMENTS.CONTENT_ITEM+':not(".hidden"):last');$(firstHiddenItem[0]).addClass('last-item')
$(firstHiddenItem[0]).toggleClass('hidden');$(lastShownItem[0]).removeClass('last-item');}
this._updateVisibleContentLength(assocContentList);};this.superclass.apply(this,arguments);};jQuery.Class.extend(G4TV.ui.mod.Discussions,G4TV.ui.Module);})(jQuery);(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.Carousel3D=function(carousel,config){if(carousel){this.init(carousel,config);}else{console.warn('Element'+carousel+'does not exist on page');}};var Carousel=G4TV.ui.Carousel3D;Carousel.ELS={'BTN_PREV':'.carousel-prev','BTN_NEXT':'.carousel-next'};Carousel.ITEM_PROPS={'ITEM_1':{'DIMS':[71,101],'ABS_POS':["22px","26px"],'ZINDEX':3},'ITEM_2':{'DIMS':[80,114],'ABS_POS':["17px","63px"],'ZINDEX':4},'ITEM_3':{'DIMS':[100,143],'ABS_POS':["0","100px"],'ZINDEX':5},'ITEM_4':{'DIMS':[80,114],'ABS_POS':["17px","153px"],'ZINDEX':4},'ITEM_5':{'DIMS':[71,101],'ABS_POS':["22px","199px"],'ZINDEX':3},'ITEM_6':{'DIMS':[71,101],'ABS_POS':["22px","199px"],'ZINDEX':3}};G4TV.ui.Carousel3D.prototype={constructor:Carousel,userConfig:{},itemsLength:null,visibleItemsLength:5,lastItem:null,lastVisibleItem:null,spotlightedItem:null,scrollInProgress:false,init:function(carousel,config){this.carousel=carousel;this.userConfig=config;},initEvents:function(){var self=this;$(this.carousel).parent().find(Carousel.ELS.BTN_PREV).bind('click',function(){self.scroll.call(self,'scrollLeft')});$(this.carousel).parent().find(Carousel.ELS.BTN_NEXT).bind('click',function(){self.scroll.call(self,'scrollRight')});jQuery.each(this.items(),function(i){$(this).bind('click',function(event){self.handleCoverClicks.apply(self,[$(this),event]);});});},render:function(){var self=this;jQuery.each(this.items(),function(i,item){i=i+1;var pName="ITEM_"+i;if(i<=5){$(item).css('top',Carousel.ITEM_PROPS[pName].ABS_POS[0]).css('left',Carousel.ITEM_PROPS[pName].ABS_POS[1]).css('width',Carousel.ITEM_PROPS[pName].DIMS[0]).css('height',Carousel.ITEM_PROPS[pName].DIMS[1]).css('zIndex',Carousel.ITEM_PROPS[pName].ZINDEX).css('display','block');}else{$(item).css('zIndex',Carousel.ITEM_PROPS.ITEM_5.ZINDEX).css('top',Carousel.ITEM_PROPS.ITEM_5.ABS_POS[0]).css('left',Carousel.ITEM_PROPS.ITEM_5.ABS_POS[1]).css('width',Carousel.ITEM_PROPS.ITEM_5.DIMS[0]).css('height',Carousel.ITEM_PROPS.ITEM_5.DIMS[1]);}
if(i==3){$(item).find('img').css('opacity',100);self.spotlightedItem=item;}});this.itemsLength=this.items().length;this.lastItem=this.items()[this.itemsLength-1];this.lastVisibleItem=this.visibleItems()[this.visibleItems().length-1];this.initEvents();},scroll:function(direction,isCoverScroll,scrollInc){var self=this,opacity;if(self.scrollInProgress)return;self.scrollInProgress=true;var firstItem=this.items()[0];var visibleCnt=0;jQuery.each(this.items(),function(i,item){if(isCoverScroll)
i+=scrollInc;else
i=direction=='scrollLeft'?i+2:i;opacity=i==3?100:.7;var pName="ITEM_"+i;switch(true){case(i<=0):if(self.itemsLength>self.visibleItemsLength){$(item).css('display','none');$(item).hide();pName="ITEM_5";}else{pName="ITEM_"+(self.visibleItemsLength-visibleCnt);visibleCnt+=1;}
$(item).css('zIndex',Carousel.ITEM_PROPS[pName].ZINDEX).css('top',Carousel.ITEM_PROPS[pName].ABS_POS[0]).css('left',Carousel.ITEM_PROPS[pName].ABS_POS[1]).css('width',Carousel.ITEM_PROPS[pName].DIMS[0]).css('height',Carousel.ITEM_PROPS[pName].DIMS[1]);$(item).find('img').css('opacity',opacity);$(item).insertAfter($(self.lastItem));self.lastItem=$(item);break;case(i>=self.visibleItemsLength):if(visibleCnt>=5)break;if(direction=='scrollRight'){visibleCnt+=1;if(visibleCnt==self.visibleItemsLength)
$(item).show(function(){self.setScrollStatus();});else
$(item).show();$(item).find('img').css('opacity',opacity);}else if(direction=='scrollLeft'){if(i>self.visibleItemsLength){pName="ITEM_"+(self.visibleItemsLength-visibleCnt);visibleCnt+=1;if(self.itemsLength>self.visibleItemsLength){$(item).hide();}
var secLast=$(self.lastItem).prev();$(self.lastItem).insertBefore($(firstItem));$(self.lastItem).css('top',Carousel.ITEM_PROPS[pName].ABS_POS[0]).css('left',Carousel.ITEM_PROPS[pName].ABS_POS[1]).css('width',Carousel.ITEM_PROPS[pName].DIMS[0]).css('height',Carousel.ITEM_PROPS[pName].DIMS[1]).css('zIndex',Carousel.ITEM_PROPS[pName].ZINDEX);$(self.lastItem).find('img').css('opacity',opacity);if(visibleCnt==self.visibleItemsLength){$(self.lastItem).show(1,function(){self.setScrollStatus();});}else{$(self.lastItem).show();}
firstItem=$(self.lastItem);self.lastItem=secLast;}else{visibleCnt+=1;self.setAnimation(item,pName,visibleCnt);$(item).find('img').css('opacity',opacity);}}
break;default:try{if(i<self.visibleItemsLength){visibleCnt+=1;if(!$(item).is(':visible'))
$(item).css('display','block');self.setAnimation(item,pName,visibleCnt);$(item).find('img').css('opacity',opacity);}}catch(e){console.warn(e);}
break;}
if(i==3){self.spotlightedItem=item;}});var lastItemIndex=self.itemsLength-1;self.lastItem=self.items()[lastItemIndex];var lastVisibleItemIndex=self.visibleItems().length-1;self.lastVisibleItem=self.visibleItems()[lastVisibleItemIndex];if(jQuery.isFunction(self.userConfig.onScroll)){self.userConfig.onScroll.apply(self);}},handleCoverClicks:function(item,event){var self=this;var itemPosition;var numScroll;for(var i=0;i<this.visibleItems().length;i++){var vImg=$(this.visibleItems()[i]).find("img");var iImg=$(item).find("img");if(vImg.attr("src")==iImg.attr("src")){itemPosition=i;break;}}
if(itemPosition==2)return;event.preventDefault();numScroll=3-itemPosition;if(itemPosition>2){this.scroll('scrollRight',true,numScroll);}else{this.scroll('scrollLeft',true,numScroll);}},setAnimation:function(item,pName,visibleCnt){var speed=($.browser.msie)?1000:600;var self=this;if(visibleCnt==self.visibleItemsLength){$(item).css('zIndex',Carousel.ITEM_PROPS[pName].ZINDEX).animate({'top':Carousel.ITEM_PROPS[pName].ABS_POS[0],'left':Carousel.ITEM_PROPS[pName].ABS_POS[1],'width':Carousel.ITEM_PROPS[pName].DIMS[0],'height':Carousel.ITEM_PROPS[pName].DIMS[1]},{duration:speed,easing:'swing',queue:false,complete:function(){self.setScrollStatus();}});}else{$(item).css('zIndex',Carousel.ITEM_PROPS[pName].ZINDEX).animate({'top':Carousel.ITEM_PROPS[pName].ABS_POS[0],'left':Carousel.ITEM_PROPS[pName].ABS_POS[1],'width':Carousel.ITEM_PROPS[pName].DIMS[0],'height':Carousel.ITEM_PROPS[pName].DIMS[1]},{duration:speed,easing:'swing',queue:false});}},setScrollStatus:function(){var self=this;window.setTimeout(function(){self.scrollInProgress=false;},200);},items:function(){return $(this.carousel).find('li.carousel-item');},visibleItems:function(){return $(this.carousel).find('li.carousel-item:visible');}};})(jQuery);(function($){G4TV.ui.mod.NewReleases=function(el,config){var self=this;var carousel=$(self.el).find('.carousel-3d');this.renderCarousel=function(){var carousel3D=new G4TV.ui.Carousel3D(carousel,{onScroll:function(){$(self.el).find('.carousel-item-details').html($(carousel3D.spotlightedItem).find('.details').html());self.attachCluetip();}});carousel3D.render();self.attachCluetip();};this.updateCarousel=function(){var ajaxRes=$(self.el+' div.ajax-response');curList=$(self.el).find('ul.content-list li.carousel-item');ajaxRes.find('ul.content-list li.carousel-item').each(function(i,item){itemId='#'+$(item).attr('id');$(itemId).html($(item).html());$(itemId).attr('class',$(item).attr('class'));});ajaxRes.remove();items=$.makeArray($(self.el+' ul.content-list li.carousel-item:visible'));if(items.length>0){$(items[2]).find('img').fadeTo('fast',100);$(self.el).find('div.carousel-item-details').html($(items[2]).find('div.details').html());}
self.attachCluetip();};this.attachCluetip=function(){var tipLinks=$(self.el).find('.carousel-item-details').find('.game');var settings=G4TV.gbl.defaults[0]['simpleTipSettings'];settings.parentClass='tooltip game';jQuery.each(tipLinks,function(){var content=$(this).closest('.carousel-item-details').find('.tooltip-content:first');if(content.length>0){var tooltip=$(this).simpletip(content.html(),settings);}});$('.tooltip.game').append('<div class="arrow"></div><div class="btm"></div><div class="rt"></div><div class="crnr"></div>');}
this.functs={};this.functs.renderCarousel=this.renderCarousel;this.functs.attachClueTip=this.attachClueTip;this.functs.updateCarousel=this.updateCarousel;this.superclass.apply(this,arguments);};jQuery.Class.extend(G4TV.ui.mod.NewReleases,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 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');}}}