﻿var cycler=(function(){var a=false;var e=false;var c=function(){clearInterval(a);$("#JA_testimonials").data("autoCycle",false);a=false};var h=function(){clearInterval(e);$("#JA_expertProfiles").data("autoCycle",false);e=false};var b=function(){if(!e){h();clearInterval(window.profInt);if($("#JA_expertProfilesAll").children().length>1){e=setInterval(function(){f(1,1)},10000)}}$("#JA_expertProfiles").data("autoCycle",true)};var g=function(){if(!a){c();if($("#JA_simpleTestimonialsOthers").children().length>1){a=setInterval(function(){i(1,1)},10000)}}$("#JA_testimonials").data("autoCycle",true)};var d=function(l){var p=$("#"+l.showing);if(p.data("idx")==null){p.data("idx",0)}var n=$("#"+l.hidden);var j=p.children("li");var k=n.children();var o=l.direction||1;var m=l.replace||function(r,q){r.html(q.clone(true).html())};j.each(function(q){var r=(p.data("idx")+o)%(k.length);if(r==-1){r=(k.length-1)}var s=k.eq(r);if(l.fade){j.fadeOut(500,function(){m($(this),s);j.fadeIn(500)})}else{m($(this),s)}p.data("idx",r)})};var i=function(j,k){j=j||1;d({direction:j,showing:"JA_simpleTestimonialsShowing",hidden:"JA_simpleTestimonialsOthers",fade:k,replace:function(m,l){m.find(".JA_testimonialName").text(l.find(".JA_testimonialName").text());m.find(".JA_testimonialQuote").text(l.find(".JA_testimonialQuote").text());m.find(".JA_testimonialLocation").text(l.find(".JA_testimonialLocation").text())}})};var f=function(j,k){j=j||1;d({direction:j,showing:"JA_expertProfilesShowing",hidden:"JA_expertProfilesAll",fade:k,replace:function(n,m){var l=n.find(".JA_avatarHolder img");l.attr("src",m.find(".JA_avatarURI").text());l.attr("title",m.find(".JA_avatarTitle").text());l.attr("alt",m.find(".JA_avatarTitle").text());l.show();n.find(".JA_profileInfo").html(m.find(".JA_profileInfo").html())}})};return{nextTestimonial:function(j){i(1,j)},nextProfile:function(j){f(1,j)},lastTestimonial:function(){i(-1,fade)},lastProfile:function(j){f(-1,j)},startTestimonials:function(){g()},startProfiles:function(){b()},start:function(){b();g()},stop:function(){h();c()},startStaggered:function(){b();setTimeout(g,5000)},bindControls:function(){$(".JA_cycleControls").show();$(".JA_lastCycler, .JA_nextCycler").css("display","inline");$("#JA_nextTestimonial").click(function(j){if($("#JA_testimonials").data("autoCycle")){g()}i(1,0)});$("#JA_lastTestimonial").click(function(j){if($("#JA_testimonials").data("autoCycle")){g()}i(-1,0)});$("#JA_nextProfile").click(function(j){if($("#JA_expertProfiles").data("autoCycle")){b()}f(1,0)});$("#JA_lastProfile").click(function(j){if($("#JA_expertProfiles").data("autoCycle")){b()}f(-1,0)})}}})();var forumSelector=(function(){var d=function(k){$("a.JA_forum.JA_selected").parents("ul").addClass("JA_selected");$("ul.JA_selected").parents("li.JA_category").addClass("JA_selectedCategory");var l=$("a.JA_forum.JA_selected:last").text();if(l.length>0){l=(l.indexOf("Expert")>0)?l:"General "+l+" Expert";l=l.replace("General General","General");$("#JA_selectedExpertTitle").text(l)}b($("a.JA_forum.JA_selected:last"),k)};var h=function(){$(".JA_arrow").hide();var m=$("ul.JA_subCategories.JA_selected");if(m.length){var l=m.clone(true);var k=$("#JA_forumList").offset();$("#JA_forumList").prepend(l);m.show();l.css({position:"absolute",top:(m.offset().top-k.top)+"px",left:(m.offset().left-k.left)+"px"});l.attr("id","JA_activeSubCats");m.hide();l.show();if($("li.JA_selectedCategory").children("ul").length){var n=$("li.JA_selectedCategory");n.addClass("JA_selectedParent");n.find(".JA_arrow").show()}}};var c={};var a=function(l,k){if($("#JA_activeSubCats").length>0){$("#JA_activeSubCats").remove();$(".JA_selectedCategory").removeClass("JA_selectedParent")}var m=l[0].id;c[m]={};c[m].i=setInterval(function(n){var o=l.scrollTop()||0;l.scrollTop(o+k*2);e(l)},10)};var g=function(k){var l=k[0].id;clearInterval(c[l].i)};var e=function(l){$(".JA_scroller").removeClass("JA_disabledScroller");var k=l.scrollTop();if(k<=0){$("#JA_upCategories").addClass("JA_disabledScroller")}else{if(k>=(l[0].scrollHeight-l.outerHeight())){$("#JA_downCategories").addClass("JA_disabledScroller")}}};var j=function(){$("html").unbind("click.hide");$("#JA_forumList").hide();$("#JA_activeSubCats").remove()};var b=function(l,m){var n=l.attr("fid");var k=$("#JA_askQuestionSelectExpert select option");k.removeAttr("selected");k.filter("[value="+n+"]").attr("selected","selected");if(m){if(typeof(n)!="undefined"){i(n)}}};var i=function(o){var l="/processes/home-page-info.aspx";var k=!!$("#JA_forumNameContainer").data("fnl");var n=$(".JA_RichExpertSelector.JA_controlOn").length;var m=!$("#JA_forumNameContainer").data("staticTagline");$.ajax({type:"GET",url:l,data:{fid:o,fnl:k?1:0,expertSelect:n},dataType:"html",success:function(p){var t=$(p);document.title=t.find("#JA_title").text().trim();var q=$(p).find("#JA_header");if($("#JA_peekingLogo").length){$("#JA_peekingLogo").replaceWith(q.find("#JA_peekingLogo"))}else{if($("body").hasClass("css_i18n")){$("#JA_siteLogo").before(q.find("#JA_peekingLogoContainer"))}else{$("#JA_forumNameContainer").after(q.find("#JA_peekingLogoContainer"))}}$("#JA_siteLogo").replaceWith(q.find("#JA_siteLogo"));$("#JA_forumNameContainer").html(q.find("#JA_forumNameContainer").html());if(m){$("#JA_tagLineText").text(q.find("#JA_tagLineText").text())}$("#JA_notThisLink").html(q.find("#JA_notThisLink").html());$("#JA_askQuestionInstructions").text(t.find("#JA_instructions").text()).hide().show();$("#JA_askQuestionExpertsOnline").text(t.find("#JA_count").text());var u=t.find("#JA_expertProfilesAll");if(u.children("li").length){$("#JA_expertProfilesAll").replaceWith(u);if($("#JA_expertProfiles").is(":hidden")){cycler.nextProfile();cycler.startProfiles()}$("#JA_expertProfiles").show()}else{$("#JA_expertProfiles").hide()}var s=t.find("#JA_questions dl");if(s.children(".JA_recentQuestion").length){$("#JA_recentQuestions").show()}else{$("#JA_recentQuestions").hide()}$("#JA_recentQuestions dl").replaceWith(s);var r=t.find("#JA_verifiedExperts");$("#JA_verifiedExperts").remove();if(typeof(jsVars)!="undefined"&&jsVars&&jsVars.ShowVerification){$(".JA_verified").remove();$(".JA_verifiedProfile").before(jsVars.VerificationIcon);r.appendTo("#JA_sideBar .JA_moduleContainer:eq(0)");jaUtils.setupHtmlTooltips()}if(n){var v=$(p).find("#JA_selectExpert");v.find(".JA_RichExpertSelector").html();$(".JA_RichExpertSelector").html(v.find(".JA_RichExpertSelector").html());$("#JA_selectInstruction").html("Select an Expert");$("input[name=RequestedExpertUpsellID]").val("-1");if($(".JA_expert_list li").length>0){$("#JA_jsExpertSelectControl").show()}else{$("#JA_jsExpertSelectControl").hide()}}}})};var f=function(){$("#JA_jsExpertSelect").hover(function(l){$("#JA_selectArrow img").attr("src",$("#JA_selectArrow img").attr("src").replace("_off","_on"))},function(l){$("#JA_selectArrow img").attr("src",$("#JA_selectArrow img").attr("src").replace("_on","_off"))});$(".JA_category").mouseover(function(l){$("#JA_activeSubCats").remove();$("ul.JA_subCategories, a.JA_forum").removeClass("JA_selected");$("li.JA_category").removeClass("JA_selectedParent").removeClass("JA_selectedCategory");$(this).addClass("JA_selectedCategory");$(this).children("ul.JA_subCategories").addClass("JA_selected");h()});var k=$("#JA_categories");$("#JA_upCategories").mouseover(function(l){a(k,-1)});$("#JA_downCategories").mouseover(function(l){a(k,1.5);l.preventDefault();return false});$(".JA_scroller").mouseout(function(l){g(k);$(this).blur();l.preventDefault();return false});$("#JA_jsExpertSelect").click(function(n){pageTracker._trackEvent("CategorySelect","HomePageAdams","ClickDropDown");var l=$("#JA_forumList");var m=$(this).outerHeight()+$("#JA_forumList").outerHeight();var o=$(window).height()-($(this).offset().top+m-$(window).scrollTop());if(o<0){l.css("top","-"+(m+8)+"px");l.addClass("JA_floatTop")}else{l.css("top","-5px");l.addClass("JA_floatBottom")}if(l.is(":visible")){j()}else{l.show();var p=$("li.JA_selectedCategory");if(p.length){$("#JA_categories").scrollTop($("li.JA_selectedCategory").position().top);h()}else{$("#JA_categories").scrollTop(0);$(".JA_arrow").hide()}$("html").unbind("click.hide");$("html").bind("click.hide",function(r){try{if($(r.srcElement||r.originalTarget).is("li, strong")){q.stopPropagation()}else{j()}}catch(q){j()}});n.stopPropagation()}e(k)});$(".JA_forum").click(function(l){pageTracker._trackEvent("CategorySelect","HomePageAdams","SelectAnotherForum");$(this).addClass("JA_selected");d(true);j();l.preventDefault();return false})};return{setup:function(){d(false);f()},updateForum:function(k){i(k)}}})();$(document).ready(function(a){jaUtils.toggleJSElements();jaUtils.bindButtonHovers();jaUtils.setupHtmlTooltips();forumSelector.setup();cycler.bindControls();cycler.startStaggered();$("#JA_mediaCoverage .JA_mediaLogo").bind("mouseenter",function(b){var c=$(this);$("#JA_mediaCoverage .JA_mediaQuote").removeClass("JA_active");$("#JA_mediaCoverage .JA_mediaLogo").removeClass("JA_active");c.next("dd").addClass("JA_active");c.addClass("JA_active")});$("#JA_noJsExpertSelectContainer select").removeAttr("tabindex");$("#JA_submitQuestionButtonHolder input").attr("tabindex","2");$("#JA_questionBox").focus();$("#JA_questionBox").keyup(function(c){var d=$(this);var f=d.val();var b=f.length;if(b>d.attr("maxlength")){d.val(f.substr(0,d.attr("maxlength")));d.scrollTop(d[0].scrollHeight);$("#JA_maxCharWarning").show();$("#JA_charCount").text(0)}else{if(d.attr("maxlength")-b<=d.attr("showcountat")){$("#JA_maxCharWarning").show();$("#JA_charCount").text(d.attr("maxlength")-b)}else{$("#JA_maxCharWarning").hide()}}});$("#JA_addToFavs").click(function(b){pageTracker._trackEvent("HomePage","AddToFavorites");jaUtils.addBookmark(window.location.href,"JustAnswer - "+document.title)});$("#catList").hide();$("#archList").hide();$("#archLink").click(function(){if($("#archList").length){$("#catList").hide();$("#archList").toggle();return false}});$("#catLink").click(function(){$("#archList").hide();$("#catList").toggle();return false});$("#archList, #catList").mouseout(function(){var b=$(this);clearTimeout(parseInt(b.data("to")));b.data("to",setTimeout(function(){b.hide()},200))});$("#archList, #catList").mouseover(function(){var b=$(this);clearTimeout(parseInt(b.data("to")))});$(".JA_requestLink").click(function(b){jaUtils.openPopWindow(this.href,600,600,"toolbar=0,location=0,directories=0,status=0,menuBar=0,scrollBars=1,resizable=yes","RequestedQuestionActions");b.preventDefault();return false});$("#JA_asSeenOnTVLogo").click(function(b){jaUtils.openPopWindow("/view-video.aspx?size=525x600&url="+$(this).attr("href"),650,550,null,"JustAnswerOnTV");b.preventDefault();return false});$(".JA_videoLink").click(function(b){jaUtils.openPopWindow("/view-video.aspx?size=525x600&url="+$(this).attr("href"),650,550,null,"JustAnswerOnTV");b.preventDefault();return false})});