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(j,k){var l=jQuery("#div_"+k);l.addClass(d++%2==0?"leftProduct":"rightProduct");l.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}};
