﻿$.fn.wait=function(time,type){var _time=time||5000,_type=type||"fx";return this.queue(_type,function(){var self=this;setTimeout(function(){$(self).dequeue();},_time);});};var JRN={menu:{init:function(){var w=$("div#jrn-menu > div.menu"),mnuItem=$("a span",w);mnuItem.each(function(i){$(this).addClass($(this).text().toLowerCase()+" hover");});this.hover(w);},hover:function(w){if($.browser.msie&&$.browser.version<=7){return;}$('a.hover',w).removeClass('hover');$('a > span',w).append('<span class="hover" />').each(function(){var s=$('> span.hover',this).css('opacity',0);$(this).hover(function(){s.stop().fadeTo(350,1);},function(){s.stop().fadeTo(250,0);});});}},hideDisabled:(function(){$("div.pager div#pager a[disabled]","div#jrn-content").hide();}()),fp:{signup:function(){$("div#fp div#pc a.signup").hover(function(){$(this).stop().animate({right:3+'em'});},function(){$(this).stop().animate({right:4+'em'});});}},quotes:function(){var cont=$("div#quotes>div.ww"),initial,i,quotes=[{quote:"I think it’s amazing. It’s so cool that it is free to be a member of the fan club. Thanks Dale Jr!",author:"Luvdalejr72"},{quote:"I love the new site. I can’t wait to see what you have in store for us! Thank you!",author:"lisagilliland88"},{quote:"Your website is great. I’m the biggest fan of Dale Earnhardt Jr! Go 88!!!",author:"dallas88"},{quote:"This page is great. I love the fact that it is all about Dale and his company. Go Jr!",author:"cheyenem"},{quote:"Great job on the new site! It is very easy to navigate!",author:"dearnhardt316"},{quote:"I love the free fan club for Dale Jr. It was long overdue. You shouldn’t have to pay to be a fan of a racecar driver or any other superstar. So THANK YOU!!!",author:"Tricia88fan"},{quote:"I love it!!! Dale Jr is always thinking of his fans. That’s awesome!",author:"88craig"},{quote:"I love JR Nation. It’s a great way to keep up on what’s going on at the track and elsewhere",author:"penny64"},{quote:"This site has a really nice look and feel.",author:"ColeF"},{quote:"I love the new fan club site. Thanks for taking the time and effort to bring the JR Nation fans a new and improved way to show our support for Jr and the 88 team!",author:"shadowkat"},{quote:"The site is looking really good. I love the videos of Dale Jr. The multiple chat rooms are great. Thanks for listening to us!",author:"CECEE"}];i=Math.floor(Math.random()*quotes.length);cont.find(">div.ww-body>p").replaceWith("<q class=\"mark\"></q>"+"<q class=\"quote\">"+quotes[i].quote+"</q>"+"<q class=\"author\">"+quotes[i].author+"</q>");cont.find(".at").remove();},hideLabel:function(){$('.js-label').find('.input-wrapper input[type=text], .input-wrapper input[type=password]').each(function(){var self=$(this),label=self.parents('.input-row').find('label');if(self.val()!=""){label.css({'visibility':'hidden'});};$(this).focus(function(){if(self.val()==""){label.stop().animate({opacity:0.3},350);}}).keydown(function(e){if((self.val()=='')&&(e.which>32)&&(e.which<255)){label.stop().animate({opacity:0},0);}}).blur(function(){if(self.val()==""){label.css({'visibility':'visible'}).animate({opacity:1},500);}});});},initRating:function(){var star=$('div.star-rating > span.starwrap > a.star'),curRating=$('div.star-rating > span.current-rating'),curRate=parseFloat($(curRating).text()),crw;crw=curRate*20;curRating.css({'width':crw});if(star.hasClass('current')){$('div.star-rating').find('a.current').prevAll('a.star').addClass('current');}star.hover(function(){$(this).addClass('hover').prevAll('a.star').addClass('hover');},function(){$(this).removeClass('hover').prevAll('a.star').removeClass('hover');});},forums:{select:function(){$("div#forums table tr td:first-child").hover(function(){$(this).addClass("hover");},function(){$(this).removeClass("hover");}).bind("click",function(e){e.stopPropagation();$(this).find("a").click();});}},tabs:{init:function(){var sl=document.getElementById("slider"),btn=$("ul.tabs li",this.sl),tab=$("ul#window li",this.sl);btn.click(function(){var self=$(this),i=self.index();if(!self.hasClass("selected")){btn.removeClass("selected");self.addClass("selected");tab.hide();tab.eq(i).fadeIn(250);}}).filter(':first').click();}},templates:{modal:"<div class=\"ui-modal small\" style=\"display: block\">"+"<div class=\"ui-modal-head\">"+"<a href=\"#\" class=\"close\">Close</a></div>"+"<div class=\"ui-modal-body\"></div>"+"<div class=\"ui-modal-foot\"></div>"+"</div><div id=\"blackout\"><span>test</span></div>"},modal:{init:function(obj){var m=$(JRN.templates.modal).prependTo("body>form").after("<div id=\"blackout\"></div>"),close=m.find('a.close'),ca=m.find("div.ui-modal-body"),bo=$("div#blackout").css({opacity:0,display:"block"});this.open(m,ca,obj,bo);this.close(m,close,bo);},open:function(modal,ca,obj,bo){bo.animate({opacity:.3},500);obj.appendTo(ca);if(modal.find("input")){modal.find("input:first").focus();}},close:function(modal,btn,bo){$(document).keyup(function(e){if(e.keyCode===27){bo.animate({opacity:0},300,function(){$(this).remove();});modal.remove();}});btn.click(function(){bo.animate({opacity:0},300,function(){$(this).remove();});modal.remove();});}},user:{avatar:{resize:{init:function(){$("div.ww-meta>img, ul.comments>li>div.author>img").click(function(){JRN.modal.init($(this).clone());return false;});}}},login:{init:function(){var link=$("a.login-btn"),login=$("div#ctl00_ascxHolder>div#ctl00_Login_pnlLogin, div#ctl00_ascxHolder>div#ctl00_cphAscxHolder_EditPhoto_pnlUpload");if(login.find("div.error").length>0){JRN.modal.init(login.removeAttr("style"));}if(link.not(':disabled')){link.click(function(){JRN.modal.init(login.removeAttr("style"));return false;});}}}},form:{order:function(){$('div.form').find('input:not(:image)').each(function(i){if(i==0){$(this).focus();}$(this).attr('tabindex',i+1);});}},temp:{contests:{hellmanns:{init:function(){$("#ctl00_cphAscxHolder_RegisterUser_pnlSectionCustom").prepend("<p class=\"helper\">Helping you Eat For Real is important to us. Therefore, from time to time, we may wish to send you information, samples or special offers that we feel may be of interest to you regarding Hellmann's®/Best Foods®, or other complementary brands from UNILEVER or other carefully-selected companies. If you would rather not opt in to receive additional information and offers, please uncheck the box below. For more information, or to remove yourself from future contact please visit our <a href=\"https://secure.unileverus.com/privacy/policy.html?site=www.mayo.com\" target=\"_blank\">Privacy Policy</a>.</p>");$("#ctl00_cphAscxHolder_RegisterUser_cbOption1").attr("checked","checked");this.cb();this.register();},cb:function(){$("#ctl00_cphAscxHolder_RegisterUser_cbOption1").click(function(){$("#ctl00_cphAscxHolder_RegisterUser_cbOption2").removeAttr("checked");});$("#ctl00_cphAscxHolder_RegisterUser_cbOption2").click(function(){$("#ctl00_cphAscxHolder_RegisterUser_cbOption1").removeAttr("checked");});},register:function(){var link=$("a.register-btn"),register=$("div#ctl00_ascxHolder>div#ctl00_cphAscxHolder_RegisterUser_Signup");if(register.find("div.error").length>0){JRN.modal.init(register.removeAttr("style"));}link.click(function(){if($(this).attr("disabled")!=='disabled'){JRN.modal.init(register.removeAttr("style"));return false;}});}}},deleteDownload:function(){$("#dloads li:last","div#downloads").remove();}}};JRN.menu.init();JRN.temp.contests.hellmanns.init();JRN.temp.deleteDownload();if(document.getElementById("quotes")){JRN.quotes();JRN.fp.signup();}if($('.js-label')){JRN.hideLabel();}JRN.initRating();JRN.tabs.init();JRN.user.avatar.resize.init();JRN.user.login.init();JRN.form.order();