jQuery.noConflict();var $j=jQuery;var isIE6=false;var isSafari=false;var Global={jOEModalPreloader:null,utilBrowserTests:function(){if(typeof document.body.style.maxHeight=="undefined"){isIE6=true;try{document.execCommand("BackgroundImageCache",false,true)}catch(a){}}if($j.browser.safari){isSafari=true;$j("div#Container").addClass("safari")}},utilExternalLinks:function(){$j("a.external").each(function(){var a=$j(this);a.click(function(){return !window.open(a.attr("href"))})})},renderCufon:function(){var a=this;Cufon.replace(".c-content p",{fontSize:"22px"});Cufon.replace(".c-content p.intro",{fontSize:"28px"});Cufon.replace(".c-content p.intro strong",{fontSize:"42px"});Cufon.replace(".c-content p.cite",{fontSize:"17px"});Cufon.replace(".c-content ul",{fontSize:"14px"});Cufon.replace("#Footer p",{fontSize:"20px"});Cufon.replace("#ShareThis",{fontSize:"18px"});Cufon.replace("sup",{fontSize:"14px",lineHeight:"8px"});Cufon.replace(".c-diary",{fontSize:"17px"});Cufon.replace(".c-modal .c-h p",{fontSize:"20px"});Cufon.replace(".c-modal h2",{fontSize:"36px"});Cufon.replace(".c-modal h3",{fontSize:"36px"});Cufon.replace(".c-modal h4 strong",{fontSize:"52px"});Cufon.replace("#Diary .c-b li p",{fontSize:"16px"});Cufon.replace("#Diary .c-f",{fontSize:"22px"});Cufon.replace("#Twitter .c-b h4",{fontSize:"24px"});Cufon.replace(".c-products p strong",{fontSize:"25px"});Cufon.replace(".c-playlist h2",{fontSize:"24px"});Cufon.replace(".c-playlist ul li a",{fontSize:"20px"});Cufon.replace(".c-player-actions a",{fontSize:"20px"});Cufon.replace(".c-testimonials .c-b p",{fontSize:"16px"});Cufon.replace(".c-testimonials .c-b p.cite",{fontSize:"18px"});Cufon.replace(".error-404 .c-content li",{fontSize:"24px"});Cufon.replace(".error-404 #goog-fixurl",{fontSize:"24px"});Cufon.now()},bindAddThis:function(){var a=true;$j.getScript("http://s7.addthis.com/js/250/addthis_widget.js?pub=xa-4a40ff3259ed0f7f",true,function(){$j("#ShareThis a").mouseover(function(){return addthis_open(this,"","[URL]","[TITLE]")}).mouseout(function(){addthis_close()}).click(function(){return addthis_sendto()})})},init:function(){var a=this;a.utilBrowserTests();a.renderCufon();a.bindAddThis()}};var Modals={cModalExpose:null,jOEModalRetail:null,jOEModalRetailCTA:null,jOEModalRetailModal:null,jOEModalTwitter:null,jOEModalTwitterCTA:null,jOEModalTwitterModal:null,jOEModalSignup:null,jOEModalSignupCTA:null,jOEModalSignupModal:null,jOEModalDiary:null,jOEModalDiaryCTA:null,jOEModalDiaryModal:null,jOEModalProduct1:null,jOEModalProduct1CTA:null,jOEModalProduct1Modal:null,jOEModalProduct2:null,jOEModalProduct2CTA:null,jOEModalProduct2Modal:null,jOEModalUploadTest:null,jOEModalUploadTestCTA:null,jOEModalUploadTestModal:null,jOEModalHow:null,jOEModalHowCTA:null,jOEModalHowModal:null,jOEModalComments:null,jOEModalCommentsCTA:null,jOEModalCommentsModal:null,modalRetail:function(){var a=this;a.jOEModalRetailModal=a.jOEModalRetail.overlay({start:{top:0},finish:{top:0,absolute:true},expose:a.cModalExpose,onBeforeLoad:function(){$j("#VideoPlayerWrapper").hide()},onLoad:function(){window.location.href="#Retail"},onClose:function(){$j("#VideoPlayerWrapper").show()},preload:false,api:true});a.jOEModalRetailCTA.click(function(){a.jOEModalRetailModal.load();return false})},modalTwitter:function(){var a=this;a.jOEModalTwitterModal=a.jOEModalTwitter.overlay({start:{top:0},finish:{top:0,absolute:true},expose:a.cModalExpose,onBeforeLoad:function(){$j("#VideoPlayerWrapper").hide()},onLoad:function(){window.location.href="#Twitter"},onClose:function(){$j("#VideoPlayerWrapper").show()},preload:false,api:true});a.jOEModalTwitterCTA.click(function(){a.jOEModalTwitterModal.load();return false})},modalSignup:function(){var a=this;a.jOEModalSignupModal=a.jOEModalSignup.overlay({start:{top:0},finish:{top:0,absolute:true},expose:a.cModalExpose,onBeforeLoad:function(){$j("#VideoPlayerWrapper").hide()},onLoad:function(){window.location.href="#Signup";Signup.init()},onClose:function(){$j("#VideoPlayerWrapper").show()},preload:false,api:true});a.jOEModalSignupCTA.click(function(){a.jOEModalSignupModal.load();return false})},modalDiary:function(){var a=this;a.jOEModalDiaryModal=a.jOEModalDiary.overlay({finish:{top:60,absolute:true},expose:a.cModalExpose,onBeforeLoad:function(){$j("#VideoPlayerWrapper").hide()},onLoad:function(){window.location.href="#Diary";Diary.init()},onClose:function(){$j("#DiaryAjax").html("");$j("#VideoPlayerWrapper").show()},ajaxLoad:function(b){},preload:false,api:true});a.jOEModalDiaryCTA.click(function(){a.jOEModalDiaryModal.load();return false})},modalProduct1:function(){var a=this;a.jOEModalProduct1Modal=a.jOEModalProduct1.overlay({start:{top:0},finish:{top:0,absolute:true},expose:a.cModalExpose,onLoad:function(){window.location.href="#Product1Detail"},preload:false,api:true});a.jOEModalProduct1CTA.click(function(){a.jOEModalProduct1Modal.load();return false})},modalProduct2:function(){var a=this;a.jOEModalProduct2Modal=a.jOEModalProduct2.overlay({start:{top:0},finish:{top:0,absolute:true},expose:a.cModalExpose,onLoad:function(){window.location.href="#Product2Detail"},preload:false,api:true});a.jOEModalProduct2CTA.click(function(){a.jOEModalProduct2Modal.load();return false})},modalHow:function(){var a=this;a.jOEModalHowModal=a.jOEModalHow.overlay({start:{top:0},finish:{top:0,absolute:true},expose:a.cModalExpose,onLoad:function(){window.location.href="#How"},preload:false,api:true});a.jOEModalHowCTA.click(function(){a.jOEModalHowModal.load();return false})},modalUploadTest:function(){var a=this;a.jOEModalUploadTestModal=a.jOEModalUploadTest.overlay({start:{top:0},finish:{top:0,absolute:true},expose:a.cModalExpose,onBeforeLoad:function(){$j("#VideoPlayerWrapper").hide()},onLoad:function(){window.location.href="#UploadTest"},onClose:function(){$j("#VideoPlayerWrapper").show()},preload:false,api:true});a.jOEModalUploadTestCTA.click(function(){a.jOEModalUploadTestModal.load();return false})},modalComments:function(){var a=this;a.jOEModalCommentsModal=a.jOEModalComments.overlay({start:{top:0},finish:{top:0,absolute:true},expose:a.cModalExpose,onLoad:function(){window.location.href="#Comments"},preload:false,api:true});a.jOEModalCommentsCTA.click(function(){a.jOEModalCommentsModal.load();return false})},init:function(){var a=this;if(isIE6){a.cModalExpose=null}else{a.cModalExpose="#504B46"}a.jOEModalTwitter=$j("#Twitter");a.jOEModalTwitterCTA=$j(".modal-twitter");a.jOEModalRetail=$j("#Retail");a.jOEModalRetailCTA=$j(".modal-retail");a.jOEModalSignup=$j("#Signup");a.jOEModalSignupCTA=$j(".modal-signup");a.jOEModalDiary=$j("#Diary");a.jOEModalDiaryCTA=$j(".modal-diary");a.jOEModalProduct1=$j("#Product1Detail");a.jOEModalProduct1CTA=$j(".modal-product-1");a.jOEModalProduct2=$j("#Product2Detail");a.jOEModalProduct2CTA=$j(".modal-product-2");a.jOEModalUploadTest=$j("#UploadTest");a.jOEModalUploadTestCTA=$j(".modal-uploadtest");a.jOEModalHow=$j("#How");a.jOEModalHowCTA=$j(".modal-how");a.jOEModalComments=$j("#Comments");a.jOEModalCommentsCTA=$j(".modal-comments");if(a.jOEModalRetail.length){a.modalRetail()}if(a.jOEModalTwitter.length){a.modalTwitter()}if(a.jOEModalSignup.length){a.modalSignup()}if(a.jOEModalDiary.length){a.modalDiary()}if(a.jOEModalProduct1.length){a.modalProduct1()}if(a.jOEModalProduct2.length){a.modalProduct2()}if(a.jOEModalUploadTest.length){a.modalUploadTest()}if(a.jOEModalHow.length){a.modalHow()}if(a.jOEModalComments.length){a.modalComments()}}};var Preloader={jOEModalPreloaderOverlay:null,jOEModalPreloader:null,showOverlay:function(){var a=this;$j(".inner").css("visibility","hidden");$j("#Preloader").show();$j.preloadCssImages()},removeOverlay:function(){var a=this;$j("#Preloader").hide();$j("#Container").removeClass("isPreloading").addClass("isLoaded");$j(".inner").css("visibility","visible")},init:function(){var a=this;a.showOverlay()}};var Tests={jOETestVideoLinks:null,jOETestVideoPlayer:null,jOETestForm:null,jOETestVideoInput:null,jOETestVideoPreview:null,videoLinks:function(){var a=this;a.jOETestVideoLinks.live("click",function(){var b=this.href;$j.ajax({type:"POST",data:"data[url]="+escape(b),url:"/tests/view",success:function(c){a.jOETestVideoPlayer.html(c)}});return false})},init:function(){var a=this;a.jOETestVideoLinks=$j("div.c-playlist a.youtube");a.jOETestVideoPlayer=$j("#VideoPlayer");a.jOETestVideoPreview=$j("#VideoPreview");a.jOETestVideoInput=$j("#TestYoutubeUrl");a.jOETestVideoPreview.hide();a.jOETestVideoInput.keyup(function(){a.videoPreview()});a.jOETestVideoInput.focus(function(){a.videoPreview()});a.jOETestVideoInput.blur(function(){a.jOETestVideoPreview.hide()});if(a.jOETestVideoLinks.length){a.videoLinks()}a.jOETestForm=$j("#TestAddForm");a.jOETestForm.validate({submitHandler:function(){a.jOETestForm.ajaxSubmit({beforeSubmit:function(){},success:function(b,c){a.jOETestForm.html(b)}});return false},errorElement:"div",errorPlacement:function(b,c){b.appendTo(c.parent().parent())}})},videoPreview:function(){var b=this;var a=b.jOETestVideoInput.val();results=a.match("[\\?&]v=([^&#]*)");if(results){b.jOETestVideoPreview.html('<img src="http://img.youtube.com/vi/0YnowiZ18tk/1.jpg" >');b.jOETestVideoPreview.show()}else{b.jOETestVideoPreview.hide()}}};var Testimonials={jOETestimonialForm:null,jOEAddCommentModeLinks:null,jOETestimonialVideoInput:null,jOETestimonialVideoPreview:null,modeLinks:function(){var a=this;a.jOEAddCommentModeLinks.live("click",function(){a.jOETestimonialVideoPreview.hide();var b=$j(this).attr("rel");a.jOETestimonialForm.resetForm();a.modeLinksSetup(b);a.jOEAddCommentModeLinks.removeClass("active");$j(this).addClass("active")})},modeLinksSetup:function(a){if(a=="text"){$j("#TestimonialYoutubeUrl").parent().parent().hide();$j("#TestimonialYoutubeUrl").removeClass("error required url");$j("#TestimonialContent").parent().parent().show();$j("#TestimonialContent").addClass("required");$j("#TestimonialImage").parent().parent().show();$j("#TestimonialTestimonialTypeId").val("1")}else{$j("#TestimonialContent").parent().parent().hide();$j("#TestimonialContent").removeClass("error required");$j("#TestimonialImage").parent().parent().hide();$j("#TestimonialYoutubeUrl").addClass("required url");$j("#TestimonialYoutubeUrl").parent().parent().show();$j("#TestimonialTestimonialTypeId").val("2")}},videoPreview:function(){var b=this;var a=b.jOETestimonialVideoInput.val();results=a.match("[\\?&]v=([^&#]*)");if(results){b.jOETestimonialVideoPreview.html('<img src="http://img.youtube.com/vi/0YnowiZ18tk/1.jpg" >');b.jOETestimonialVideoPreview.show()}else{b.jOETestimonialVideoPreview.hide()}},init:function(){var a=this;a.jOETestimonialForm=$j("#TestimonialAddForm");a.jOEAddCommentModeLinks=$j("#AddCommentModeLinks a");a.jOETestimonialForm.validate({submitHandler:function(){a.jOETestimonialForm.ajaxSubmit({beforeSubmit:function(){},success:function(b,c){a.jOETestimonialForm.html(b)}});return false},errorElement:"div",errorPlacement:function(b,c){b.appendTo(c.parent().parent())}});a.modeLinks();a.modeLinksSetup("text");a.jOETestimonialVideoPreview=$j("#VideoPreview");a.jOETestimonialVideoInput=$j("#TestimonialYoutubeUrl");a.jOETestimonialVideoPreview.hide();a.jOETestimonialVideoInput.keyup(function(){a.videoPreview()});a.jOETestimonialVideoInput.focus(function(){a.videoPreview()});a.jOETestimonialVideoInput.blur(function(){a.jOETestVideoPreview.hide()})}};var Signup={jQESignupForm:null,init:function(){var a=this;a.jQESignupForm=$j("#SignupAddForm");a.jQESignupForm.validate({submitHandler:function(){a.jQESignupForm.ajaxSubmit({beforeSubmit:function(){},success:function(b,c){a.jQESignupForm.html(b)}});return false},errorElement:"div",errorPlacement:function(b,c){b.appendTo(c.parent().parent())}})}};var Diary={jQEDiary:null,jQEDiaryAjax:null,jQEDiaryPreloader:null,init:function(){var a=this;a.jQEDiary=$j("#Diary");a.jQEDiaryAjax=$j("#DiaryAjax");a.jQEDiaryPreload=$j("#Diary .preloader");a.jQEDiaryPreload.show();$j.ajax({url:"/diaries",cache:false,success:function(b){a.jQEDiaryAjax.html(b);a.cufonReplace();a.jQEDiaryPreload.hide();a.jQEDiaryAjax.find("a.ajax").live("click",function(){a.ajaxLoad(this.href);return false})}})},ajaxLoad:function(a){var b=this;b.jQEDiaryPreload.show();$j.ajax({url:a,cache:false,success:function(c){b.jQEDiaryAjax.html(c);b.jQEDiaryAjax.removeClass("loading");b.cufonReplace();b.jQEDiaryPreload.hide()}})},cufonReplace:function(){Cufon.replace(".c-modal .c-h p",{fontSize:"20px"});Cufon.replace("#Diary .c-b li p",{fontSize:"16px",hover:true});Cufon.replace("#Diary .c-f",{fontSize:"22px",hover:true})}};var Products={init:function(){var a=this;a.swapImagery()},swapImagery:function(){$j(".images div.thumb").hover(function(){var a=$j(this).parent();if($j(this).hasClass("thumb-1")){a.css("backgroundPosition","-500px 0")}else{a.css("backgroundPosition","-1000px 0")}},function(){var a=$j(this).parent();a.css("backgroundPosition","0 0")})}};$j(function(){Global.init();Preloader.init();Modals.init();if($j("body.tests").length){Tests.init()}if($j("body.testimonials").length){Testimonials.init()}if($j("body.products").length){Products.init()}if(typeof initPage=="function"){initPage()}});