$(function(){globalEvents();activateTabs();$("body").removeClass("noJS").addClass("JS");tb_detectMacXFF()&&$("body").addClass("macff");if($("#nav ul.sf-menu").length>0){centerNav();if($.browser.msie){$("#nav ul.sf-menu").superfish({autoArrows:false,speed:0});$.browser.version.substr(0,1)<7&&$("#nav li li:first-child").css("padding-top","10px");$("#nav li li:last-child").css({"padding-bottom":"10px","border-width":"0px 1px 1px"})}else $("#nav ul.sf-menu").superfish({autoArrows:false,speed:400})}imgSwapper();if($("div#whereToBuy").length>0){$("#whereToBuy #col1, #whereToBuy #col2").equalHeights();$("#whereToBuy #col1 .innercol ul, #whereToBuy #col2 .innercol ul").equalHeights()}setupFAQs();createPrintLinks("External Website Addresses in the Document")});function globalEvents(){$("a[rel='ext']").attr("target","_blank");$("a.videoLink").click(function(b){b.preventDefault();cancelTheaterAutoRotation();var a=$(this).attr("rel").split("::")[1].split("|");playVideo($(this).attr("href"),"lbVideo",a[0],a[1],a[2],flashPrefix+"FlashVideoPlayer_scale.swf","")});$("a.top").length>0&&$("a.top").hoverIntent(function(){$(this).parent("li").css("z-index",199).siblings("li").css("z-index",99);$(this).parent("li").parent("ul").css("z-index",199).siblings("ul").css("z-index",99)},function(){$(this).parent("li").siblings("li").css("z-index",99);$(this).parent("li").parent("ul").siblings("ul").css("z-index",99)});$(".print_button").click(function(a){a.preventDefault();window.print()});$(".productCallout, .productCallout .imgWrap").length>0&&$(".productCallout, .productCallout .imgWrap").equalHeights();$(".productUsed, .productUsed .imgWrap").length>0&&$(".productUsed, .productUsed .imgWrap").equalHeights()}function activateTabs(){if($("#productDetail").length>0){tabs=$("#productDetail");tabs.tabs();SWFAddress.onChange=function(){handleChange(tabs)};tabs.tabs({select:function(c,b){var a=b.tab.hash;a=a.replace("#","/")+"/";SWFAddress.setValue(a)}})}}function handleChange(a){var b=SWFAddress.getPath();switch(b){case"/"+tabIDs[0]+"/":a.tabs("select",0);break;case"/"+tabIDs[1]+"/":a.tabs("select",1);break;case"/"+tabIDs[2]+"/":a.tabs("select",2);break;case"/"+tabIDs[3]+"/":a.tabs("select",3);break;case"/"+tabIDs[4]+"/":a.tabs("select",4);break;default:a.tabs("select",0)}if($("#productDetail").find(".last").hasClass("ui-tabs-selected")){$("#shareBuyLinks").hide();$("#productDetail .imgWrapper").hide();$("#productDetail h3").hide()}else if($("#productDetail").find(".reviews").parent().hasClass("ui-tabs-selected")){$("#shareBuyLinks").hide();$("#productDetail .imgWrapper").hide();$("#productDetail h3").show()}else{$("#shareBuyLinks").show();$("#productDetail .imgWrapper").show();$("#productDetail h3").show()}if($.browser.msie&&$.browser.version.substr(0,1)<7&&$("#productDetail").length>0&&$(".imgWrapper").length>0)$("#productDetail").height()<$(".imgWrapper img").first().height()+95&&$("#productDetail").height($(".imgWrapper img").first().height()+95)}function parentWidth(a){var b=0;if(a.children().length>0)a.children().each(function(){b+=$(this).outerWidth()});else b=a.outerWidth();return b}function makeAnotherNav(b,c){var d=parentWidth(b),a;a=$("<ul class='navline'></ul>");while(d>c){var e=b.children("li").eq(-1).prependTo(a);d=parentWidth(b)}a.insertAfter(b);b.children("li").add(a.children("li")).children("a").removeClass("top").removeClass("topLast").addClass("top");b.children("li").eq(-1).add(a.children("li").eq(-1)).children("a.top").removeClass("top").addClass("topLast");if(!($.browser.msie&&$.browser.version.substr(0,1)<7))parentWidth(a)>c&&makeAnotherNav(a,c)}function centerNav(){var c=$("#nav ul:first-child"),b=885;parentWidth(c)>b&&makeAnotherNav(c,b);$("#nav").children("ul").length>1&&$("#nav").children("ul").addClass($("#nav > ul:first-child").attr("class"));for(var a=1;a<=$("#nav").children("ul").length;a++)$("#nav").children("ul").eq(-a).css("z-index",a*100).children("li").css("z-index",a*100);$("#nav > ul").each(function(){var a=$(this).outerWidth();if(a<b+1)$(this).css({width:a+"px","float":"none"});else $(this).css({width:b+"px","float":"none"})})}function replaceDropdown(a){for(var c=a.substring(1)+"LinkList",f=a.substring(1)+"Link",b=$(a+" option"),e='<div id="'+c+'" class="ddlist">\n<a href="#" id="'+f+'">'+b.eq(0).text()+"</a>\n<ul>\n",d=1;d<b.length;d++)e+='<li><a href="'+b.eq(d).val()+'">'+b.eq(d).text()+"</a></li>\n";e+="</ul>\n</div>\n";$(a).next("button").remove();$(a).after(e);$(a).remove();var g,h=$("#"+c);$("#"+f).click(function(a){a.preventDefault();if(!$("#"+c+" ul").is(":visible")){$("#"+c+" ul").slideDown("fast");$(this).toggleClass("open");g=setTimeout(function(){$("body").click(function(){$(this).unbind("click");closeDropdown(h)})},200)}})}function closeDropdown(a){if(a.children("ul").is(":visible")){a.children("ul").slideUp("fast");a.children("a").toggleClass("open")}}function playVideo(k,d,b,a,i,f,t){if(k=="")return false;var l=f;if(f==null||f=="")l=flashPrefix+"FlashVideoPlayer_scale.swf";var v=k,p="9.0.115",r=22,u="532",s="420";if(d=="")d="lbVideo";if(b=="")b=u;if(a=="")a=s;if(i=="")i="9999";if(f==null||f=="")f=flashPrefix+"FlashVideoPlayer_scale.swf";var j=$(window).height(),m=$(window).width(),q=false;b=parseInt(b);a=parseInt(a);if(b+20>m||a+20>j){q=true;var e=b/a,o=b,n=a;if(a+20>j){a=j*.75;b=o>n?a*e:a/e;if(b+20>m){b=m*.75;a=o>n?b/e:b*e}}else{b=m*.75;a=o>n?b/e:b*e;if(a+20>j){a=j*.75;b=o>n?a*e:a/e}}}var h=parseInt(b),g=parseInt(a)+r,c=$("#"+d);if(c.length==0)c=createLBdiv(d,"body");if(!t)if(!q)$.fn.colorbox({innerWidth:h,innerHeight:g,inline:true,href:"#"+d,onOpen:function(){$.browser.mozilla&&ScrollFreeze.on();$("html").css({overflow:"hidden"})},onComplete:function(){createVideoObject(p,d,k,b,a,i,l,h,g,c)},onCleanup:function(){c.hide();$("html").css({overflow:"auto"})},onClosed:function(){c.remove();$.browser.mozilla&&ScrollFreeze.off()},opacity:.5});else $.fn.colorbox({innerWidth:h,innerHeight:g,inline:true,href:"#"+d,onOpen:function(){},onComplete:function(){createVideoObject(p,d,k,b,a,i,l,h,g,c)},onCleanup:function(){c.hide()},onClosed:function(){c.remove()},opacity:.5});else createVideoObject(p,d,k,b,a,i,l,h,g,c);detectAndroid()&&$("video").live("click",function(){this.play()})}function supports_html5_h264_video(){if(detectAndroid())return true;if(!document.createElement("video").canPlayType)return false;else{var a=document.createElement("video");return!!a.canPlayType("video/mp4")}}function createLBdiv(d,f){var a=$("<div></div>").attr({id:d}),b=$("<div></div>").attr("id",d+"noflash").addClass("no-flash"),g=$("<p></p>").text(nonflashVideoContentPart1).attr("style","padding-top:30px"),e=$("<a></a>").attr({href:nonflashVideoContentPart2LinkUrl,target:"_blank"}).text(nonflashVideoContentPart2LinkText),c=$("<p></p>").text(nonflashVideoContentPart2Text);c.prepend(e);b.append(g).append(c);a.append(b);$(f).append(a);return a}function createVideoObject(d,p,g,h,f,l,m,k,j,e){if(swfobject.hasFlashPlayerVersion(d)){var n=p+"noflash",c={};c.videoUrl=g;c.videoWidth=h;c.videoHeight=f;c.videoDuration=l;var b={};b.menu="false";b.quality="high";b.wmode="opaque";b.bgcolor="#3E3C3C";var i={};swfobject.embedSWF(m,n,k,j,d,null,c,b,i)}else if(supports_html5_h264_video()){var a={};a.src=g;a.width=h;a.height=f;a.controls="true";a.autoplay="true";var o=$("<video></video>").attr(a);e.html("");e.append(o)}}ScrollFreeze={propFlag:true,Ydisp:0,Xdisp:0,on:function(){this.getProp()&&$(window).bind("scroll",function(){ScrollFreeze.setXY()})},off:function(){$(window).unbind("scroll");$(window).scrollTop()!=$(window).data("yOffset")&&setTimeout(this.setXY,5)},getProp:function(){this.Ydisp=$(window).scrollTop();$(window).data("yOffset",this.Ydisp);return this.propFlag},setXY:function(){$(window).scrollTop($(window).data("yOffset"))}};function detectiOSDevice(){for(var b=["ipod","itouch","ipad","iphone"],c=navigator.userAgent.toLowerCase(),a=0;a<b.length;a++)if(c.indexOf(b[a])!=-1)return true;return false}function detectAndroid(){for(var b=["android"],c=navigator.userAgent.toLowerCase(),a=0;a<b.length;a++)if(c.indexOf(b[a])!=-1)return true;return false}function setupGTLCarousel(){var d=false,a=false,b=6;if($("#gtlSlider ul li").length>b){var f=$("<p>Prev</p>").attr("id","sliderPrev").insertAfter("#gtlSlider"),e=$("<p>Next</p>").attr("id","sliderNext").insertAfter("#gtlSlider");a=true;d=true}var c=1;if($("#gtlSlider a.current").length>0)c=$("#gtlSlider a.current").parent("li").index();$("#gtlSlider").jCarouselLite({btnPrev:a?"#"+f.attr("id"):"",btnNext:a?"#"+e.attr("id"):"",mouseWheel:true,circular:d,visible:b,auto:0,speed:300,start:c});$("#gtlSlider li a").click(function(){if($(this).hasClass("current"))return false;$(this).parent("li").siblings().children("a").removeClass("current");$(this).addClass("current")})}var homepageTheaterCurrentIndex=-1,homepageTheaterAutoRotationIntervalId=0,homepageTheaterAutoRotationWaitTime=8e3,homepageJCarouselliteShownElements=5;function setupHomepageTheater(){var e=false,a=false,b=homepageJCarouselliteShownElements;if($("#theaterNavSlider ul li").length>b){var d=$("<p>Prev</p>").attr("id","sliderPrev").insertAfter("#theaterNavSlider"),c=$("<p>Next</p>").attr("id","sliderNext").insertAfter("#theaterNavSlider");a=true}$("#sliderPrev").click(function(){cancelTheaterAutoRotation()});$("#sliderNext").click(function(){cancelTheaterAutoRotation()});$("#theaterNavSlider").jCarouselLite({btnPrev:a?"#"+d.attr("id"):"",btnNext:a?"#"+c.attr("id"):"",mouseWheel:true,circular:e,visible:b,auto:0,speed:300});$(".theaterDiv").hide();$("#theaterDefault").show();$("#theaterNavSlider li a").hoverIntent(function(){cancelTheaterAutoRotation();showTheaterNavItem(this,true)},function(){startHomepageTheaterAutorotation($(this).parent("li").index(),homepageTheaterAutoRotationWaitTime)});$("a#navSliderClose").click(function(a){a.preventDefault();if($(this).hasClass("open")){$("#sliderWrap").animate({bottom:-80},1250,"easeOutBack");$("#theaterNavSlider ul li a img").animate({top:-66},1250);$(this).css({"background-position":"top right"}).toggleClass("open")}else{$("#sliderWrap").animate({bottom:-1},1250,"easeInBack");$("#theaterNavSlider ul li a img").animate({top:0},1250);$(this).css({"background-position":"top left"}).toggleClass("open")}cancelTheaterAutoRotation()})}function callJCarouselLiteGoFunction(b){var a=0;if(b>=homepageJCarouselliteShownElements){a=b-homepageJCarouselliteShownElements+1;parent.jcarousellitegofunction(a)}}function startHomepageTheaterAutorotation(b,a){homepageTheaterAutoRotationIntervalId=setTimeout(function(){autoRotationShowNextHomepageTheaterIndex(b)},a)}function autoRotationShowNextHomepageTheaterIndex(a){if(a!=homepageTheaterCurrentIndex)homepageTheaterCurrentIndex=a+1;else homepageTheaterCurrentIndex++;if(homepageTheaterCurrentIndex>$("#theaterNavSlider ul li").length-1)showDefaultImageAndCancelAutoRotation();else{showTheaterNavIndex(homepageTheaterCurrentIndex);callJCarouselLiteGoFunction(homepageTheaterCurrentIndex)}homepageTheaterAutoRotationIntervalId=setTimeout(function(){autoRotationShowNextHomepageTheaterIndex(homepageTheaterCurrentIndex)},homepageTheaterAutoRotationWaitTime)}function showDefaultImageAndCancelAutoRotation(){cancelTheaterAutoRotation();homepageTheaterCurrentIndex=-1;$(".theaterDiv").fadeOut(1200);$("#theaterDefault").fadeIn(1200);$("#theaterNavSlider ul li a").each(function(b,a){$(a).removeClass("current")});$("#theaterNavSlider ul li").length>homepageJCarouselliteShownElements&&parent.jcarousellitegofunction(0)}function cancelTheaterAutoRotation(){if(homepageTheaterAutoRotationIntervalId!=undefined&&homepageTheaterAutoRotationIntervalId!=0){clearTimeout(homepageTheaterAutoRotationIntervalId);homepageTheaterAutoRotationIntervalId=0}}function showTheaterNavIndex(a){showTheaterNavItem($("#ctl00_ContentPlaceHolder1_lvFilmStrip_ctrl"+a+"_hlFilmStripLink"),false)}function showTheaterNavItem(b){if($(b).hasClass("current"))return;$(b).parent("li").siblings().children("a").removeClass("current");var d="#theater",a=$(b).attr("className").split(" ");if(a.length>=1){for(var c=0;c<a.length;c++)if(a[c].match(/sNav/i)){d+=a[c].replace(/sNav/i,"");break}}else d+="Default";$(b).addClass("current");$(".theaterDiv").fadeOut(1200);$(d).fadeIn(1200)}function theaterTakeover(c,a,b){setTimeout(function(){animateTheaterTakeover(a,b)},c)}function animateTheaterTakeover(c,b){var a=-1;switch(b){case 920:a=-6;break;case 444:switch(c){case 0:a=-6;break;case 1:a=470}break;case 286:switch(c){case 0:a=-6;break;case 1:a=311;break;case 2:a=629}}if(a!=-1){$(".homepageTakeover").parents("#hpTheater").css("overflow","visible").end().animate({height:[106,"swing"],top:[389,"linear"],width:[b,"swing"],left:[a,"easeOutSine"],opacity:[.5,"easeInQuint"]},1500,function(){$(this).parents("#hpTheater").css("overflow","hidden").end().hide("slow",function(){startHomepageTheaterAutorotation(homepageTheaterCurrentIndex,homepageTheaterAutoRotationWaitTime)})});$(".homepageTakeover img").animate({height:[106,"swing"],width:[b,"swing"]},1500)}else $("#homepageTakeover").fadeOut("slow",function(){startHomepageTheaterAutorotation(homepageTheaterCurrentIndex,homepageTheaterAutoRotationWaitTime)})}var prodHairCareLandingPageAutoRotationCurrentIndex=0,prodHairCareLandingPageAutoRotationIntervalId=0,prodHairCareLandingPageAutoRotationWaitTime=4e3,channelBrandingImgObjs=[],prodFamImgObjs=[];function imgSwapper(){if(typeof prodFamFileNames!="undefined"&&typeof channelBrandingFileNames!="undefined"){var b=prodFamFileNames.length,c=channelBrandingFileNames.length;if(b==c){for(var a=0;a<b;a++){channelBrandingImgObjs[a]=$("<img />").attr({src:channelBrandingFileNames[a],"class":"channelBrandingImg"}).appendTo("#col1").hide();prodFamImgObjs[a]=$("<img />").attr({src:prodFamFileNames[a],"class":"productLineup",width:"229",height:"204"}).appendTo("#innerPLcol1").hide()}$("#productLinks li").eq(0).addClass("current");channelBrandingImgObjs[0].add(prodFamImgObjs[0]).show();$("#productLinks a").hoverIntent(function(){cancelProdHairCareLandingPageAutoRotation();var a=$(this).parent("li").index();$(this).parent("li").addClass("current").siblings().removeClass("current");$(".productLineup,.channelBrandingImg").fadeOut("slow");channelBrandingImgObjs[a].add(prodFamImgObjs[a]).fadeIn("slow")},function(){});startProdHairCareLandingPageAutoRotation(prodHairCareLandingPageAutoRotationWaitTime)}}if(typeof ourExpertsImageAutoRotation!="undefined"&&ourExpertsImageAutoRotation==true){$(".landing #col2 #contentWrap #innerCol1 #imageBlock a").eq(0).siblings().hide();startOurExpertsLandingPageAutoRotation(ourExpertsLandingPageAutoRotationWaitTime)}}function startProdHairCareLandingPageAutoRotation(a){prodHairCareLandingPageAutoRotationIntervalId=setInterval("prodHairCareLandingPageAutoRotationShowNextImgs()",a)}function prodHairCareLandingPageAutoRotationShowNextImgs(){prodHairCareLandingPageAutoRotationCurrentIndex++;if(prodHairCareLandingPageAutoRotationCurrentIndex>=$("#productLinks #innerPLcol2 ul li").length){cancelProdHairCareLandingPageAutoRotation();$("#productLinks li").removeClass("current");$("#col1 img").last().siblings().add($("#innerPLcol1 img").last().siblings()).hide();$("#col1 img").last().add($("#innerPLcol1 img").last()).fadeOut("slow");$("#col1 img").first().add($("#innerPLcol1 img").first()).fadeIn("slow");prodHairCareLandingPageAutoRotationCurrentIndex=-1}else{$("#productLinks li").eq(prodHairCareLandingPageAutoRotationCurrentIndex).addClass("current").siblings().removeClass("current");channelBrandingImgObjs[prodHairCareLandingPageAutoRotationCurrentIndex].add(prodFamImgObjs[prodHairCareLandingPageAutoRotationCurrentIndex]).fadeIn("slow")}}function cancelProdHairCareLandingPageAutoRotation(){if(prodHairCareLandingPageAutoRotationIntervalId!=undefined&&prodHairCareLandingPageAutoRotationIntervalId!=0){clearInterval(prodHairCareLandingPageAutoRotationIntervalId);prodHairCareLandingPageAutoRotationIntervalId=0}}var ourExpertsLandingPageAutoRotationCurrentIndex=0,ourExpertsLandingPageAutoRotationIntervalId=0,ourExpertsLandingPageAutoRotationWaitTime=4e3,ourExpertsRotatingImgObjs=[];function startOurExpertsLandingPageAutoRotation(a){ourExpertsLandingPageAutoRotationIntervalId=setInterval("ourExpertsLandingPageAutoRotationShowNextImgs()",a)}function ourExpertsLandingPageAutoRotationShowNextImgs(){ourExpertsLandingPageAutoRotationCurrentIndex++;if(ourExpertsLandingPageAutoRotationCurrentIndex>=$(".landing #col2 #contentWrap #innerCol1 #imageBlock a").length)ourExpertsLandingPageAutoRotationCurrentIndex=0;$(".landing #col2 #contentWrap #innerCol1 #imageBlock a").eq(ourExpertsLandingPageAutoRotationCurrentIndex).fadeIn("slow").siblings().fadeOut("slow")}function setupFAQs(){if($("#faqContent").length>0){$("dl dd").hide();$("dl dt").addClass("closedFAQ");$("<a href='#' />").addClass("faqToggle").appendTo("dl dt").click(function(a){a.preventDefault();if($(this).hasClass("open")){$(this).parents("dt").next("dd").slideUp();!$(this).parents("dt").prevAll("dt").first().children("a").hasClass("open")&&$(this).parents("dt").addClass("closedFAQ").removeClass("openFAQ");!$(this).parents("dt").nextAll("dt").first().children("a").hasClass("open")&&$(this).parents("dt").nextAll("dt").first().addClass("closedFAQ").removeClass("openFAQ")}else $(this).parent("dt").addClass("openFAQ").removeClass("closedFAQ").next("dd").slideDown().next("dt").addClass("openFAQ").removeClass("closedFAQ");$(this).toggleClass("open")})}}function getQueryVariable(e){var a=window.location.search.substring(1);a=a.replace("&amp;",";AMP;");for(var d=a.split("&"),b=0;b<d.length;b++){var c=d[b].split("=");if(c[0]==e)return c[1]}return"none"}function moveBTTLink(){var a=$("a#backToTop").click(function(){$("html, body").animate({scrollTop:"0px"},700);return false});a.hide();if($(window).scrollTop()>$(window).height()){a.show();$("html, body").animate({scrollTop:$(window).scrollTop()+1},1)}var b=$("#discProdContent").offset().top+$("#discProdContent").height()+5+"px",c="10px";a.css({position:"absolute",top:b,left:c});$(window).bind("scroll",function(){$(".discProdItem").each(function(){if($(window).scrollTop()+$(window).height()-$(this).height()>$(this).offset().top&&$(window).scrollTop()>$(window).height()/2){a.show();var c=0;if($.browser.msie&&$.browser.version.substr(0,1)<7)c=10;b=$(this).offset().top-$(this).height()+35-c+"px";a.stop().animate({top:b})}})})}(function(a){a.fn.equalHeights=function(c,b){tallest=c?c:0;this.each(function(){a(this).height("auto")});this.each(function(){if(a(this).height()>tallest)tallest=a(this).height()});if(b&&tallest>b)tallest=b;return this.each(function(){a(this).height(tallest)})}})(jQuery);function validateOnBlur(b,c){for(var a=0;a<b.length;a++)if(b[a].id.indexOf(c.attr("id"))!=-1)if(!b[a].isvalid){var d=b[a].id.substring(b[a].id.length-1)-1;c.siblings("span").eq(d).css("display","block");c.siblings("span:visible").css("display","block")}}function tb_detectMacXFF(){var a=navigator.userAgent.toLowerCase();if(a.indexOf("mac")!=-1&&a.indexOf("firefox")!=-1)return true}function createPrintLinks(f){var d=$('a[target="_blank"]');if($(d).length){var b=$("<fieldset>",{css:{clear:"both"}}).addClass("print_only"),g=$("<legend>",{text:f}).appendTo(b),e=$("<ol>").appendTo(b),a=[],c=0;$.each(d,function(h){var k=$(this).text(),b=$(this).attr("href");if(b.substring(0,7)!="http://")if(b.substring(0,1)!="/")b="http://"+document.location.host+b;else b="http://"+document.location.host+"/"+b;a[h]=b;var g=false,f=0,d=-1;for(var i in a)if(a[i]==a[h]){f++;d++;if(f>1){g=true;break}}if(d<=0)c++;$("<span>",{text:" ["+c+"]"}).appendTo($(this)).addClass("print_only");if(!g)var j=$("<li>",{text:b}).appendTo(e)});$("body").append(b)}}function riaTrack(a){goToPage(a)}function goToPage(a){dcsMultiTrack("DCS.dcsuri",a,"DCS.dcsqry","","WT.ti",a);firstTracker._trackPageview(a);secondTracker._trackPageview(a)}function getQuerystring(b,a){if(a==null)a="";b=b.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");var d=new RegExp("[\\?&]"+b+"=([^&#]*)"),c=d.exec(window.location.href);return c==null?a:c[1]};
