jQuery(document).ready(function(){jQuery("#spinner").bind("ajaxStart",function(){jQuery(this).fadeIn()});jQuery("#spinner").bind("ajaxStop",function(){jQuery(this).fadeOut()});correctMissingStoreImages();jQuery(".actionPlayVideo").click(playlistClickHandler);jQuery(".actionScrollToContent").click(scrollToContentDiv);sendPlayListsToPlayer()});function sendPlayListsToPlayer(A){var B="microsite";if(typeof (embeddedType)!="undefined"&&embeddedType.length>0){B=embeddedType}if(typeof (window.Invodo)!="undefined"&&typeof (playList)!="undefined"){if(typeof (readyPlayers)!="undefined"){while(readyPlayers.length>0){var C=readyPlayers.pop();Invodo().getInvodoPlayer(C.id).setEmbedded(false,B);Invodo().getInvodoPlayer(C.id).sendEvent("LOAD",playList);if(A){Invodo().getInvodoPlayer(C.id).sendEvent("PLAY",true)}}}}}function playlistClickHandler(D){var C=jQuery.grep(jQuery(this).attr("class").split(" "),function(F){return F.match(/actionPlayVideo_\w+/)});if(C.length>0){var B=C[0].split("_");var E=B[1];var A=B[2];Invodo().getInvodoPlayer(E).sendEvent("ITEM",A);selectVideo(A)}return false}function scrollToContentDiv(A){jQuery("html, body").animate({scrollTop:jQuery("#content").offset().top},1000);return false}function clearCookie(C){var A=document.domain;var B=A.indexOf("www.")==0?A.substring(4):A;document.cookie=C+"=;expires=Thu, 01-Jan-1970 00:00:01 GMT; path=/; domain="+B}function setProductDivHeights(){var B=jQuery("#selectAProduct div.leftProduct");var D=jQuery("#selectAProduct div.rightProduct");for(var H=0;H<B.length;++H){var J=B.eq(H);var K=D.eq(H);var A=J.css("padding-top")?J.css("padding-top").replace(/px/i,""):0;var F=J.find(".productInfo").eq(0);var I=parseInt(A)+F.height();var E=K.css("padding-top")?K.css("padding-top").replace(/px/i,""):0;var G=K.find(".productInfo").eq(0);var C=parseInt(E)+(G?G.height():80);I=I<80?80:I;if(I>C){J.height(I);K.height(I)}else{J.height(C);K.height(C)}}}function getProductIdsBySubCategoryId(subCategoryId){return eval("subCategoryProductMap['_"+subCategoryId+"']")}function filterSubCategory(G){G.stopPropagation();var F=G.target.id;var A=F.substring(2,F.length);var E=jQuery("div#selectAProduct .categoryProductDiv");E.each(function(){var I=jQuery(this);I.hide();I.removeClass("leftProduct");I.removeClass("rightProduct")});jQuery("a.selectedCategoryListItem").removeClass("selectedCategoryListItem");jQuery("#s_"+A).addClass("selectedCategoryListItem");var D=0;if(A=="ALL"){E.each(function(){if(this.id=="emptyRightProductDiv"){return }var I=jQuery(this);I.addClass(D++%2==0?"leftProduct":"rightProduct");I.show()})}else{var C=getProductIdsBySubCategoryId(A);jQuery.each(C,function(I,J){var K=jQuery("#div_"+J);K.addClass(D++%2==0?"leftProduct":"rightProduct");K.show()})}if(D==0){var H=jQuery("#emptyLeftProductDiv");if(H==null){H=jQuery("#emptyRightProductDiv").clone();H.id="emptyLeftProductDiv";H.text("No product videos available.")}H.addClass("leftProduct");H.show()}if(D%2==1){var B=jQuery("#emptyRightProductDiv");B.addClass("rightProduct");B.show()}setProductDivHeights()}function selectVideo(B){var A=jQuery("#videoListItem_"+B);if(A.length==0||A.hasClass("active")){return }jQuery(".vidSingle.active").removeClass("active");jQuery("#videoListItem_"+B).addClass("active")}function playingVideo(C){var B=jQuery("#videoListItem_"+C);if(B.length==0||B.hasClass("active")){return }jQuery(".vidSingle.active").removeClass("active");jQuery("#videoListItem_"+C).addClass("active");var A=jQuery(".vidLibrary").get(0).scrollTop;jQuery.timer(10,function(H){var F=jQuery("#videoListItem_"+C).get(0).offsetTop;var D=jQuery(".vidLibrary").get(0).offsetTop;var E=jQuery(".vidLibrary").get(0).scrollTop;var G=E-(F-D-1);if(G>0){jQuery(".vidLibrary").get(0).scrollTop=(E-1)}else{if(G<0){jQuery(".vidLibrary").get(0).scrollTop=(E+1)}else{H.stop()}}if(A==jQuery(".vidLibrary").get(0).scrollTop){H.stop()}A=jQuery(".vidLibrary").get(0).scrollTop})}function correctMissingStoreImages(){jQuery(".storeImage").each(function(){var A=jQuery(this);if(A.height()==1&&A.width()==1){jQuery(this).replaceWith(this.alt)}})}function showProductByCatOrSubCat(A){jQuery("."+A).show();jQuery(".thumbnail").not("."+A).hide();return false}function tooltip(){var A=10;var B=20;$("a.tooltip").hover(function(C){this.t=this.title;this.title="";$("body").append("<p id='tooltip'>"+this.t+"</p>");$("#tooltip").css("top",(C.pageY-A)+"px").css("left",(C.pageX+B)+"px").fadeIn("fast")},function(){this.title=this.t;$("#tooltip").remove()});$("a.tooltip").mousemove(function(C){$("#tooltip").css("top",(C.pageY-A)+"px").css("left",(C.pageX+B)+"px")})}$(document).ready(function(){tooltip()});function checkForValue(){var A=jQuery("#headerSearchText");if(!A.val()){A.get(0).focus();return false}else{return true}};