/**
 * @author Adam McIntyre
 * Builds the Media Bar / Carousel / Lightbox combo on the product detail page.
 * Also contains the "client" awesomebox uses to process images.
 */
/* 
    The following information must not be removed:
    Awesome Box v2
    Written by: Paul Armstrong, Paul Armstrong Designs
    Site: http://paularmstrongdesigns.com
    Idea and some functions from "LightBox" http://www.huddletogether.com
    Example & Documentation: http://paularmstrongdesigns.com/awesome/box/
    Last Updated: Friday, February 2, 2007 at 12:31:10

    This work is licensed under a Creative Commons Attribution-ShareAlike 2.5 License
    http://creativecommons.org/licenses/by-sa/2.5/

    Required Yahoo! UI Files:
        * yahoo.js
        * dom.js
        * event.js
        * [ or: yahoo-dom-event.js ]
        * animation.js
        * [ or: animation-min.js ]

    Modified for NikonUSA.com by Adam McIntyre -- adam.mcintyre@molecular.com 

    Merged from production - 02 JUL 2010
*/

var aClient={};aClient.photos=[];aClient.allAssets={};aClient.groups={};aClient.noDisplayaltTerms={"Enlarge Image":true};aClient.addItem=function(lbItem){var aTypes={jpg:true,gif:true,png:true,bmp:true,flv:true,mp3:true,wav:true};if(lbItem.href.substr(lbItem.href.lastIndexOf(".")+1) in aTypes){this.photos.push(lbItem);this.addToGroup(lbItem);YAHOO.awesomebox.setClickAction(lbItem,YAHOO.awesomebox);}};aClient.addToGroup=function(lbItem){if(!(lbItem.rel in this.groups)){this.groups[lbItem.rel]=[];this.groups[lbItem.rel].items=[];}var grp=this.groups[lbItem.rel];grp.items.push(lbItem);grp[lbItem.href]=grp.items.length-1;};aClient.getGroup=function(groupName){if(this.groups[groupName]){return this.groups[groupName];}return[];};aClient.isInGroup=function(groupName,value){if(value in this.getGroup(groupName)){return this.groups[groupName][value];}return null;};aClient.pageWidth=function(){var xScroll;if(window.innerHeight&&window.scrollMaxY){xScroll=document.body.scrollWidth;}else{if(document.body.scrollHeight>document.body.offsetHeight){xScroll=document.body.scrollWidth;}else{xScroll=document.body.offsetWidth;}}if(xScroll<$D.getViewportWidth()){pageWidth=$D.getViewportWidth();}else{pageWidth=xScroll;}return pageWidth;};aClient.pageHeight=function(){var yScroll;if(window.innerHeight&&window.scrollMaxY){yScroll=window.innerHeight+window.scrollMaxY;}else{if(document.body.scrollHeight>document.body.offsetHeight){yScroll=document.body.scrollHeight;}else{yScroll=document.body.offsetHeight;}}if(yScroll<=$D.getViewportHeight()){pageHeight=$D.getViewportHeight();}else{pageHeight=yScroll;}return pageHeight;};aClient.xScroll=function(){var xScroll=window.scrollX||document.documentElement.scrollLeft;return xScroll;};aClient.yScroll=function(){var yScroll=window.scrollY||document.documentElement.scrollTop;return yScroll;};function CarouselWidget(cId,replaceImgId,size,numVisible,scrollInc){var configOpts={numVisible:numVisible||2,animationSpeed:0.35,scrollInc:scrollInc||numVisible||2,navMargin:0,revealAmount:0,firstVisible:1,size:size||4,prevElement:cId+"-prev",nextElement:cId+"-next"};var carousel=new YAHOO.extension.Carousel(cId,configOpts);var navId=cId+"-navigation";var obj=this;var mousedOver=false;this.replaceImgId=replaceImgId;this.getCarouselEl=function(){return carousel._carouselElemID;};this.getNav=function(){return document.getElementById(navId);};this.setMousedOver=function(){mousedOver=!mousedOver;};this.getCarousel=function(){return carousel;};this.scrollable=(size>numVisible)?true:false;var _wireChildActions=function(){var anchors=YAHOO.util.Selector.query("ul.carousel-list li a",cId);YAHOO.util.Dom.batch(anchors,function(o){if(o.getAttribute("rel")&&o.getAttribute("rel").toLowerCase().indexOf("product views")!=-1){YAHOO.util.Event.addListener(o,"click",function(e){YAHOO.util.Event.preventDefault(e);var curEl=this;fadeSwap("loader","swapTarget");setTimeout(function(){obj.swapImages(obj,curEl);obj.swapEnlargeButtons(obj,curEl);obj.setHighlighted(curEl);var im=new Image();im.onload=function(){setTimeout(function(){fadeSwap("swapTarget","loader");},10);};im.src=curEl.href;},100);OmnitureHelper.setMBProdView();});var enlargeEl=document.getElementById(o.id.substr(o.id.indexOf("_")+1));if(enlargeEl){var oId=document.getElementById(o.id.substr(o.id.indexOf("_")+1));aClient.addItem(oId);new $A(oId,{opacity:{to:0.99}},0.15).animate();}}else{YAHOO.util.Event.addListener(o,"click",function(e){obj.setHighlighted(this);});aClient.addItem(o);}});};var init=function(){_wireChildActions();obj._configureNav();};init();YAHOO.util.Event.onDOMReady(function(){var els=YAHOO.util.Selector.query("div#carousel_ProductViews ul.carousel-list li:first-child");if(els.length>0){YAHOO.util.Dom.addClass(els[0],"selected");YAHOO.util.Dom.addClass(els[0].parentNode,"selected");setTimeout(function(){Carousels.highlighted=els[0];Carousels.current=els[0].parentNode;},100);}});}CarouselWidget.prototype.swapImages=function(obj,linkObj){YAHOO.util.Dom.get(obj.replaceImgId).src=linkObj.href;};CarouselWidget.prototype.swapEnlargeButtons=function(obj,linkObj){if(Carousels.highlighted){var oldIdStr="enlargeImage_"+Carousels.highlighted.id.substr(27);YAHOO.util.Dom.addClass(oldIdStr,"noD");var newIdStr="enlargeImage_"+linkObj.id.substr(18);YAHOO.util.Dom.removeClass(newIdStr,"noD");}else{YAHOO.util.Dom.addClass("enlargeImage_1","noD");var newIdStr="enlargeImage_"+linkObj.id.substr(18);YAHOO.util.Dom.removeClass(newIdStr,"noD");}};CarouselWidget.prototype.setHighlighted=function(obj){YAHOO.util.Dom.removeClass(Carousels.highlighted,"selected");YAHOO.util.Dom.removeClass(Carousels.current,"selected");YAHOO.util.Dom.addClass(obj.parentNode,"selected");YAHOO.util.Dom.addClass(this.getCarousel().carouselList,"selected");Carousels.highlighted=obj.parentNode;Carousels.current=this.getCarousel().carouselList;var id=obj.parentNode.id;var num=id.substr(id.indexOf("item-")+5);this._setCurrentNumber(num);};CarouselWidget.prototype._configureNav=function(){if(this.scrollable){this._setCurrentNumber(1);}else{var cn=this.getNav().childNodes;for(var i=0;i<cn.length;i++){if(cn[i].className&&cn[i].className.indexOf("rnd")<0){cn[i].style.display="none";}}}};CarouselWidget.prototype._setCurrentNumber=function(curNumber){YAHOO.util.Dom.get(this.getCarouselEl()+"-curNum").innerHTML=curNumber;YAHOO.util.Dom.get(this.getCarouselEl()+"-maxNum").innerHTML=this.getCarousel().cfg.getProperty("size");};CarouselWidget.prototype._getNavInfo=function(){var rt={};rt.xy=YAHOO.util.Dom.getXY(this.getNav());rt.h=this.getNav().offsetHeight;return rt;};CarouselWidget.prototype._setShowNavEvent=function(){YAHOO.util.Event.addListener(this.getNav(),"mousemove",this.handleShowNavigation,this);};CarouselWidget.prototype.handleShowNavigation=function(e,o){YAHOO.util.Event.removeListener(o.getNav(),"mousemove");o._fadeInNav();o._setHideNavEvent();};CarouselWidget.prototype._fadeInNav=function(e,o){var anim=new YAHOO.util.Anim(this.getNav(),{opacity:{to:1}},0.25,YAHOO.util.Easing.easeOut);anim.animate();};CarouselWidget.prototype._showNavigation=function(){var coordInfo=this._getNavInfo();var top=coordInfo.xy[1]+coordInfo.h;var anim=new YAHOO.util.Motion(this.getNav(),{points:{to:[coordInfo.xy[0],top]}},0.25,YAHOO.util.Easing.easeOut);anim.animate();};CarouselWidget.prototype._setHideNavEvent=function(){YAHOO.util.Event.addListener(this.getNav(),"mouseout",this.handleHideNavigation,this);};CarouselWidget.prototype.handleHideNavigation=function(e,o){if(e.explicitOriginalTarget.tagName&&e.explicitOriginalTarget.tagName.toLowerCase()=="html"){YAHOO.util.Event.removeListener(o.getCarouselEl()+"-container","mouseout");o._fadeOutNav();o._setShowNavEvent();}};CarouselWidget.prototype._fadeOutNav=function(e,o){var anim=new YAHOO.util.Anim(this.getNav(),{opacity:{to:0.35}},0.25,YAHOO.util.Easing.easeOut);anim.animate();};CarouselWidget.prototype._hideNavigation=function(){var coordInfo=this._getNavInfo();var top=coordInfo.xy[1]-coordInfo.h;var anim=new YAHOO.util.Motion(this.getNav(),{points:{to:[coordInfo.xy[0],top]}},0.25,YAHOO.util.Easing.easeOut);anim.animate();};var isSafari=false;if(YAHOO.env.ua.webkit>0){isSafari=YAHOO.env.ua.webkit<525.19;}var $D=YAHOO.util.Dom;var $E=YAHOO.util.Event;var $A=YAHOO.util.Anim;var $M=YAHOO.util.Motion;var $S=YAHOO.util.Scroll;var $Ease=YAHOO.util.Easing;var $=$D.get;YAHOO.util.AnimMgr.fps=500;YAHOO.widget.aEffect=function(el){this.oEl=YAHOO.util.Dom.get(el);};YAHOO.widget.aEffect.prototype.aShowLoad=function(){var showLoad=new $A("aLoadImg",{opacity:{to:1}},0.2);showLoad.onStart.subscribe(function(){$D.setStyle("aLoadImg","display","block");$D.setXY("aLoadImg",[($D.getViewportWidth()/2)-16+aClient.xScroll(),($D.getViewportHeight()/2)-16+aClient.yScroll()]);if($D.hasClass("aBoxMeta","aOpen")){var hideMeta=new $A("aBoxMeta",{opacity:{to:0},height:{to:0}},0.2);$D.setStyle("aCloseButton","visibility","hidden");hideMeta.onStart.subscribe(function(){$D.setStyle("aImg","opacity","0");$D.setStyle("aImg","visibility","hidden");});hideMeta.animate();}});showLoad.animate();};YAHOO.widget.aEffect.prototype.aShowOverlay=function(){selects=document.getElementsByTagName("select");for(i=0;i!=selects.length;i++){$D.setStyle(selects[i],"visibility","hidden");}var fadeOverlay=new $A("aOverlay",{opacity:{to:0.55}},0.3);fadeOverlay.onStart.subscribe(function(){$D.setStyle("aOverlay","display","block");$D.setStyle("aOverlay","height",aClient.pageHeight()+"px");});var showBox=new $A("aBox",{opacity:{to:1}},0.3);showBox.onStart.subscribe(function(){$D.setStyle("aBox","display","block");var showLoad=new YAHOO.widget.aEffect();showLoad.aShowLoad();});showBox.animate();fadeOverlay.animate();};YAHOO.widget.aEffect.prototype.aResizeBox=function(aPreload){if(isSafari){$D.setStyle("aDiv","visibility","hidden");$D.setStyle("aDiv","display","none");$D.setStyle("aDiv","opacity","0");}var metaHeight=40;if(document.getElementById("container_colors")){ColorVariantManager.setSelectedEl(this.oEl);if($D.hasClass(this.oEl,"enlargeImg")){$D.addClass("aBoxMeta","variant");metaHeight=62;if(!document.getElementById("container_lbVariants")){var colors=$D.getElementsByClassName("color","div","container_colors");var lb_variantBlock=document.createElement("div");lb_variantBlock.id="container_lbVariants";lb_variantBlock.className="container_colors";var selectedColor="";for(var i=0;i<colors.length;i++){var el=colors[i];var swatchImg=$D.getNextSibling($D.getFirstChild(el)).cloneNode(false);swatchImg.id="lightbox_"+swatchImg.id;var tmp=el.cloneNode(false);tmp.id=el.id.replace("swatch_container","swatch_lb");tmp.removeAttribute("onmouseover");tmp.removeAttribute("onmouseout");tmp.onclick=function(){ColorVariantManager.lightboxClick(this.id.substr(this.id.lastIndexOf("_")+1));};if($D.hasClass(el,"selected")){tmp.className="color selected";selectedColor=swatchImg.alt;ColorVariantManager.setOriginalColor(el.id.substr(el.id.lastIndexOf("_")+1));}else{tmp.className="color";}var sp=document.createElement("span");sp.className="sm_border";tmp.appendChild(sp);tmp.appendChild(swatchImg);lb_variantBlock.appendChild(tmp);}var colorInfo=document.createElement("span");colorInfo.className="color_info";colorInfo.innerHTML=nikonLabel.selectColor+': <strong id="label_colorName">'+selectedColor+"</strong>";lb_variantBlock.appendChild(colorInfo);document.getElementById("variant_label").innerHTML=selectedColor+"&nbsp;";document.getElementById("variant_label").style.display="inline";document.getElementById("aBoxMeta").insertBefore(lb_variantBlock,document.getElementById("aBoxMeta").firstChild);}}}var imgScale=YAHOO.awesomebox.scaleImage(aPreload);var moveBox=new $M("aBox",{width:{to:(imgScale[0]+20)},height:{to:(imgScale[1]+70)},points:{to:[($D.getViewportWidth()/2)-(imgScale[0]/2)+aClient.xScroll()-10,($D.getViewportHeight()/2)-(imgScale[1]/2)+aClient.yScroll()-60]}},0.3);moveBox.onStart.subscribe(function(){$D.setStyle("aBox","display","block");var hideLoad=new $A("aLoadImg",{opacity:{to:0}},0.3);var sizeImage=new $A("aImg",{width:{to:imgScale[0]},height:{to:imgScale[1]}},0.3);hideLoad.onComplete.subscribe(function(){$D.setStyle("aLoadImg","display","none");});hideLoad.animate();sizeImage.animate();});moveBox.onComplete.subscribe(function(){$D.setStyle("aBox","height",imgScale[1]+130+"px");$D.setStyle("aBoxMeta","width",imgScale[0]+"px");$D.addClass("aBoxMeta","aOpen");$("aImg").setAttribute("width",imgScale[0]);$("aImg").setAttribute("height",imgScale[1]);$D.setStyle("aImg","visibility","visible");var fadeImg=new $A("aImg",{opacity:{from:0,to:1}},0.3);fadeImg.onComplete.subscribe(function(){var showMeta=new $A("aBoxMeta",{opacity:{from:0,to:1},height:{to:metaHeight}},0.2);showMeta.onComplete.subscribe(function(){YAHOO.util.Dom.setStyle("aCount","filter","");});showMeta.animate();$D.setStyle("aCloseButton","visibility","visible");});fadeImg.animate();});if($D.hasClass("aBoxMeta","aOpen")){setTimeout(function(){$("aImg").setAttribute("src",aPreload.src);setTimeout(function(){moveBox.animate();},10);},300);}else{$("aImg").setAttribute("src",aPreload.src);setTimeout(function(){moveBox.animate();},10);}};YAHOO.widget.aEffect.prototype.aResizeBoxEl=function(aPreload,anEl){var moveBox=new $M("aBox",{width:{to:(aPreload.width+30)},height:{to:(aPreload.height+85)},points:{to:[($D.getViewportWidth()/2)-(aPreload.width/2)+aClient.xScroll()-10,($D.getViewportHeight()/2)-(aPreload.height/2)+aClient.yScroll()-10]}},0.3);moveBox.onStart.subscribe(function(){$D.setStyle("aBox","display","block");var hideLoad=new $A("aLoadImg",{opacity:{to:0}},0.3);var sizeBox=new $A("aDiv",{width:{to:aPreload.width},height:{to:aPreload.height}},0.3);hideLoad.onComplete.subscribe(function(){$D.setStyle("aLoadImg","display","none");});hideLoad.animate();sizeBox.animate();});moveBox.onComplete.subscribe(function(){var prHeight=aPreload.height;var prWidth=aPreload.width;$D.setStyle("aDiv","width",prWidth+30+"px");$D.setStyle("aDiv","height",prHeight+30+"px");$D.setStyle("aDiv","opacity","1");$D.setStyle("aImg","width","0");$D.setStyle("aImg","height","0");$D.setStyle("aBoxMeta","width",prWidth+30+"px");$D.addClass("aBoxMeta","aOpen");$D.setStyle("aDiv","visibility","visible");$D.setStyle("aDiv","display","block");var showMeta=new $A("aBoxMeta",{opacity:{from:0,to:1},height:{to:40}},0.2);showMeta.onComplete.subscribe(function(){setTimeout(function(){var fo=new FlashObject("/static/flash/mediabar/nikonvideo.swf?"+Math.round(Math.random()*100000),anEl.rel+""+Math.round(Math.random()),prWidth+30,prHeight+45,"#FFF");fo.addParam("allowScriptAccess","sameDomain");fo.addVariable("path",anEl.href);fo.addVariable("title","");fo.addVariable("closeButton","/static/images/"+nikonLabel.locale+"/buttons/btn_flash_close_on.png");fo.addVariable("closeButtonHover","/static/images/"+nikonLabel.locale+"/buttons/btn_flash_close_off.png");fo.addVariable("volLabel","/static/images/"+nikonLabel.locale+"/icons/icon_flash_sound.png");fo.addVariable("close","YAHOO.awesomebox.close");fo.addVariable("showClose",true);fo.write("aDiv");},10);});showMeta.animate();});moveBox.animate();};YAHOO.widget.aEffect.prototype.aClose=function(){var that=$("aImg");$D.removeClass("aBoxMeta","variant");if(document.getElementById("container_lbVariants")){document.getElementById("container_lbVariants").parentNode.removeChild(document.getElementById("container_lbVariants"));document.getElementById("variant_label").style.display="none";ColorVariantManager.resetEnlargeImg();}var hideMeta=new $A("aBoxMeta",{height:{to:0},opacity:{to:0}},0.2);var fadeBox=new $M("aBox",{opacity:{to:0}},0.3);fadeBox.onComplete.subscribe(function(){var hideOverlay=new $A("aOverlay",{opacity:{to:0}},0.3);hideOverlay.onStart.subscribe(function(){selects=document.getElementsByTagName("select");for(i=0;i!=selects.length;i++){$D.setStyle(selects[i],"visibility","visible");}$D.removeClass("aBoxMeta","aOpen");$D.setStyle("aBox","display","none");$D.setStyle("aImg","opacity","0");$D.setStyle("aImg","visibility","hidden");$D.setStyle("aDiv","visibility","hidden");$D.setStyle("aDiv","display","none");$D.setStyle("aDiv","opacity","0");$D.setStyle("aDiv","width","0");$D.setStyle("aDiv","height","0");$D.setStyle("aOverlay","display","none");$D.setStyle("aOverlay","height","0px");$D.setStyle("aLoadImg","display","none");$D.setStyle("aCloseButton","visibility","hidden");});hideOverlay.onComplete.subscribe(function(){$("aDiv").innerHTML="";});hideOverlay.animate();});hideMeta.animate();fadeBox.animate();$E.removeListener("aNextButton","click");$E.removeListener("aPrevButton","click");$E.removeListener(document,"keypress");};YAHOO.widget.aEffect.prototype.aAwesome=function(){return true;};YAHOO.awesomebox=function(){return{init:function(){if(!document.getElementsByTagName){return;}var aBody=document.getElementsByTagName("body").item(0);var aOverlay=document.createElement("div");$(aOverlay).setAttribute("id","aOverlay");$(aOverlay).setAttribute("title","Click to Close");aBody.appendChild(aOverlay);$D.setStyle("aOverlay","opacity","0");var aBox=document.createElement("div");$(aBox).setAttribute("id","aBox");if(typeof nikonLabel==="undefined"){$(aBox).className="en_US";}else{$(aBox).className=nikonLabel.cssClass;}aBody.appendChild(aBox);$D.setStyle("aBox","opacity","0");$D.setXY("aBox",[($D.getViewportWidth()/2)-21,($D.getViewportHeight()/2)-21]);$D.setStyle("aBox","display","none");var aCloseButton=document.createElement("a");$(aCloseButton).setAttribute("id","aCloseButton");$(aCloseButton).setAttribute("href","javascript:void(0);");aBox.appendChild(aCloseButton);$D.addClass(aCloseButton,"aButton");var aInfoTitle=document.createElement("h5");$(aInfoTitle).setAttribute("id","aInfoTitle");aBox.appendChild(aInfoTitle);var aImgHolder=document.createElement("div");$(aImgHolder).setAttribute("id","aImgHolder");aBox.appendChild(aImgHolder);var aImg=document.createElement("img");$(aImg).setAttribute("id","aImg");aImgHolder.appendChild(aImg);$D.setStyle("aImg","opacity","0");$D.setStyle("aImg","visibility","hidden");var aDiv=document.createElement("div");$(aDiv).setAttribute("id","aDiv");aImgHolder.appendChild(aDiv);$D.setStyle("aDiv","opacity","0");$D.setStyle("aDiv","visibility","hidden");var aBoxMeta=document.createElement("div");$(aBoxMeta).setAttribute("id","aBoxMeta");aBox.appendChild(aBoxMeta);var aNextButton=document.createElement("a");$(aNextButton).setAttribute("id","aNextButton");aBoxMeta.appendChild(aNextButton);$(aNextButton).setAttribute("href","#next");$D.addClass(aNextButton,"aButton");var aPrevButton=document.createElement("a");$(aPrevButton).setAttribute("id","aPrevButton");aBoxMeta.appendChild(aPrevButton);$(aPrevButton).setAttribute("href","#prev");$D.addClass(aPrevButton,"aButton");var aCountContainer=document.createElement("div");$(aCountContainer).setAttribute("id","aCountContainer");var variantLabel=document.createElement("label");$(variantLabel).setAttribute("id","variant_label");aCountContainer.appendChild(variantLabel);var aCount=document.createElement("label");$(aCount).setAttribute("id","aCount");aCountContainer.appendChild(aCount);aBoxMeta.appendChild(aCountContainer);$D.setStyle(aCount,"opacity","0");var aInfo=document.createElement("p");$(aInfo).setAttribute("id","aInfo");aBoxMeta.appendChild(aInfo);var preloadLoading=new Image();preloadLoading.src=aLoadImgSrc;var aLoadImg=document.createElement("img");$(aLoadImg).setAttribute("id","aLoadImg");aBody.appendChild(aLoadImg);$(aLoadImg).setAttribute("src",preloadLoading.src);$D.setStyle("aLoadImg","opacity","0");if(window.location.href.indexOf("showAsset")!=-1){var asset=window.location.href.match(/showAsset=([^&]*)&?/)[1];if(document.body.id!=""||document.body.id!=null){var body=$D.generateId(document.body);}else{var body=document.body.id;}var allMBItems=aClient.photos;for(var i=0;i<allMBItems.length;i++){if(allMBItems[i].href.indexOf(asset)>-1){if(asset.indexOf("swf")>0||asset.indexOf("mp3")>0||asset.indexOf("flv")>0){if(!isSafari){this.initLoadSwf(allMBItems[i]);}else{this.initLoadSafari(allMBItems[i]);}}else{this.initLoadImg(allMBItems[i]);}}}}$E.on(aOverlay,"click",this.close);$E.on(aCloseButton,"click",this.close);},setClickAction:function(o,obj){var fileType=o.href.substr(o.href.lastIndexOf(".")+1).toLowerCase();if(fileType=="swf"||fileType=="mp3"||fileType=="flv"){if(!isSafari){$E.addListener(o,"click",function(e){YAHOO.util.Event.preventDefault(e);obj.loadSwf(e,this);});}else{$E.addListener(o,"click",function(e){YAHOO.util.Event.preventDefault(e);obj.loadSafari(e,this);});}}else{$E.addListener(o,"click",function(e){YAHOO.util.Event.preventDefault(e);obj.loadImg(e,this);var ttl=o.title?o.title.replace(" ","-"):"";OmnitureHelper.setMediaBarThumbClickEvents(fileType,o.href,ttl);});}},loadSafari:function(e,newSwf){$E.stopEvent(e);var sz;if(e.target.parentNode.getAttribute("size")){sz=e.target.parentNode.getAttribute("size");}else{var m=e.target.parentNode.className.match(/\bsize_(\d\d\d\d?x\d\d\d\d?)\b/);if(m){sz=m[1];}else{sz=null;}}if(sz==null||sz=="undefined"){sz="480x360";}var dim=sz.split("x");window.open("/static/flash/mediabar/video_frame.html?file="+newSwf.href+"&sz="+sz,"nMedia","resizable=1,width="+parseInt(parseInt(dim[0])+50)+",height="+parseInt(parseInt(dim[1])+55));},initLoadSafari:function(el){if(el.getAttribute("size")){sz=el.getAttribute("size");}else{var m=el.className.match(/\bsize_(\d\d\d\d?x\d\d\d\d?)\b/);if(m){sz=m[1];}else{sz=null;}}if(sz==null||sz=="undefined"){sz="480x360";}var dim=sz.split("x");window.open("/static/flash/mediabar/video_frame.html?file="+el.href+"&sz="+sz,"nMedia","resizable=1,width="+parseInt(parseInt(dim[0])+50)+",height="+parseInt(parseInt(dim[1])+55));},loadSwf:function(e,newSwf){var sz;if(e.srcElement){if(e.srcElement.parentNode.getAttribute("size")){sz=e.srcElement.parentNode.getAttribute("size");}else{var m=e.srcElement.parentNode.className.match(/\bsize_(\d\d\d\d?x\d\d\d\d?)\b/);if(m){sz=m[1];}else{sz=null;}}}else{if(e.target.parentNode.getAttribute("size")){sz=e.target.parentNode.getAttribute("size");}else{var m=e.target.parentNode.className.match(/\bsize_(\d\d\d\d?x\d\d\d\d?)\b/);if(m){sz=m[1];}else{sz=null;}}}if(sz==null||sz=="undefined"){sz="480x360";}$E.stopEvent(e);$E.removeListener(document,"keypress");aPreload=new Image();aPreload.width=sz.split("x")[0];aPreload.height=sz.split("x")[1];if(newSwf){var that=newSwf;}else{var that=this;}var resizeBox=new YAHOO.widget.aEffect(that);resizeBox.aResizeBoxEl(aPreload,that);var fadeOverlayIn=new YAHOO.widget.aEffect();fadeOverlayIn.aShowOverlay();$D.setStyle("aNextButton","visibility","hidden");$D.setStyle("aPrevButton","visibility","hidden");$D.setStyle("aCount","opacity","0");var aInfoTitle="";var aInfo="";if(that.getAttribute("title")!=null){var aInfoTitle=that.getAttribute("title");}if($D.hasClass("aBoxMeta","aOpen")){setTimeout(function(){$("aInfoTitle").innerHTML=aInfoTitle;$("aInfo").innerHTML=aInfo;},250);}else{$("aInfoTitle").innerHTML=aInfoTitle;$("aInfo").innerHTML=aInfo;}$E.addListener(document,"keypress",function(e){$E.stopEvent(e);switch($E.getCharCode(e)){case (120):YAHOO.awesomebox.close();break;case (97):YAHOO.awesomebox.awesome();break;}});},initLoadSwf:function(el){var sz;if(el.getAttribute("size")){sz=el.getAttribute("size");}else{var m=el.className.match(/\bsize_(\d\d\d\d?x\d\d\d\d?)\b/);if(m){sz=m[1];}else{sz=null;}}if(sz==null||sz=="undefined"){sz="480x360";}aPreload=new Image();aPreload.width=sz.split("x")[0];aPreload.height=sz.split("x")[1];var resizeBox=new YAHOO.widget.aEffect(el);resizeBox.aResizeBoxEl(aPreload,el);var fadeOverlayIn=new YAHOO.widget.aEffect();fadeOverlayIn.aShowOverlay();$D.setStyle("aNextButton","visibility","hidden");$D.setStyle("aPrevButton","visibility","hidden");$D.setStyle("aCount","opacity","0");var aInfoTitle="";var aInfo="";if(el.getAttribute("title")!=null){var aInfoTitle=el.getAttribute("title");}if($D.hasClass("aBoxMeta","aOpen")){setTimeout(function(){$("aInfoTitle").innerHTML=aInfoTitle;$("aInfo").innerHTML=aInfo;},250);}else{$("aInfoTitle").innerHTML=aInfoTitle;$("aInfo").innerHTML=aInfo;}$E.addListener(document,"keypress",function(e){$E.stopEvent(e);switch($E.getCharCode(e)){case (120):YAHOO.awesomebox.close();break;case (97):YAHOO.awesomebox.awesome();break;}});},loadImg:function(e,newImg){var fadeOverlayIn=new YAHOO.widget.aEffect();fadeOverlayIn.aShowOverlay();if(newImg){var that=newImg;}else{var that=this;}$E.stopEvent(e);$E.removeListener(document,"keypress");aPreload=new Image();aPreload.onload=function(){setTimeout(function(){var resizeBox=new YAHOO.widget.aEffect(that);resizeBox.aResizeBox(aPreload);if(!that.getAttribute("rel")){$D.setStyle("aNextButton","visibility","hidden");$D.setStyle("aPrevButton","visibility","hidden");$D.setStyle("aCount","opacity","0");}else{$D.setStyle("aCount","opacity","1");$E.removeListener("aNextButton","click");$E.removeListener("aPrevButton","click");}var aInfoTitle="";var aInfo="";if(that.getAttribute("title")!=null){var aInfoTitle=that.getAttribute("title");}if(that.getElementsByTagName("img")[0]&&that.getElementsByTagName("img")[0].getAttribute("title")!=null){var aInfoTitle=that.getElementsByTagName("img")[0].getAttribute("title");}if(that.getElementsByTagName("img")[0]&&that.getElementsByTagName("img")[0].getAttribute("alt")!=null&&!(that.getElementsByTagName("img")[0].getAttribute("alt") in aClient.noDisplayaltTerms)){var aInfo=that.getElementsByTagName("img")[0].getAttribute("alt");}if($D.hasClass("aBoxMeta","aOpen")){setTimeout(function(){$("aInfoTitle").innerHTML=aInfoTitle;$("aInfo").innerHTML=aInfo;},250);}else{$("aInfoTitle").innerHTML=aInfoTitle;$("aInfo").innerHTML=aInfo;}if(that.getAttribute("rel")){YAHOO.awesomebox.loadNeighbors(that);}$E.addListener(document,"keypress",function(e){$E.stopEvent(e);switch($E.getCharCode(e)){case (120):YAHOO.awesomebox.close();break;case (97):YAHOO.awesomebox.awesome();break;}});},10);};aPreload.src=that.getAttribute("href");},initLoadImg:function(el){var fadeOverlayIn=new YAHOO.widget.aEffect();fadeOverlayIn.aShowOverlay();aPreload=new Image();aPreload.onload=function(){var resizeBox=new YAHOO.widget.aEffect(el);resizeBox.aResizeBox(aPreload);if(!el.getAttribute("rel")){$D.setStyle("aNextButton","visibility","hidden");$D.setStyle("aPrevButton","visibility","hidden");$D.setStyle("aCount","opacity","0");}else{$D.setStyle("aCount","opacity","1");$E.removeListener("aNextButton","click");$E.removeListener("aPrevButton","click");}var aInfoTitle="";var aInfo="";if(el.getAttribute("title")!=null){var aInfoTitle=el.getAttribute("title");}if(el.getElementsByTagName("img")[0]&&el.getElementsByTagName("img")[0].getAttribute("title")!=null){var aInfoTitle=el.getElementsByTagName("img")[0].getAttribute("title");}if(el.getElementsByTagName("img")[0]&&el.getElementsByTagName("img")[0].getAttribute("alt")!=null&&!(that.getElementsByTagName("img")[0].getAttribute("alt") in aClient.noDisplayaltTerms)){var aInfo=el.getElementsByTagName("img")[0].getAttribute("alt");}if($D.hasClass("aBoxMeta","aOpen")){setTimeout(function(){$("aInfoTitle").innerHTML=aInfoTitle;$("aInfo").innerHTML=aInfo;},250);}else{$("aInfoTitle").innerHTML=aInfoTitle;$("aInfo").innerHTML=aInfo;}if(el.getAttribute("rel")){YAHOO.awesomebox.loadNeighbors(el);}$E.addListener(document,"keypress",function(e){$E.stopEvent(e);switch($E.getCharCode(e)){case (120):YAHOO.awesomebox.close();break;case (97):YAHOO.awesomebox.awesome();break;}});};aPreload.src=el.getAttribute("href");},loadNeighbors:function(that){var imgRefs=aClient.photos;var photoSet=aClient.getGroup(that.rel).items;var key=aClient.isInGroup(that.rel,that.href);setTimeout(function(){$("aCount").innerHTML=nikonLabel.image+" "+(key+1)+" "+nikonLabel.of+" "+photoSet.length;},300);if(key!=photoSet.length-1){var next=new Image();next.src=photoSet[key+1].getAttribute("href");$D.setStyle("aNextButton","visibility","visible");}else{$D.setStyle("aNextButton","visibility","hidden");}if(key!=0){var prev=new Image();prev.src=photoSet[key-1].getAttribute("href");$D.setStyle("aPrevButton","visibility","visible");}else{$D.setStyle("aPrevButton","visibility","hidden");}$E.addListener("aNextButton","click",this.loadImg,photoSet[key+1],true);$E.addListener("aPrevButton","click",this.loadImg,photoSet[key-1],true);$E.addListener(document,"keypress",function(e){$E.stopEvent(e);switch($E.getCharCode(e)){case (110):if(key!=photoSet.length-1){YAHOO.awesomebox.loadImg("",photoSet[key+1]);}break;case (112):if(key!=0){YAHOO.awesomebox.loadImg("",photoSet[key-1]);}break;}});},showOverlay:function(el){el=YAHOO.util.Dom.get(el);var w=el.getAttribute("data-width");var h=el.getAttribute("data-height");if(!document.getElementById("mb_overlay")){var d=document.createElement("div");d.id="mb_overlay";d.className="liquidPop pop singleCol";d.innerHTML='<div class="hd"><span class="l"> </span> <div class="m"><a id="mb_overlay_close" class="closeIcon" href="javascript:void(0)"> </a><h3 class="nkYellow">{popupTitle}</h3></div> <span class="r"> </span></div><div class="container_bd"><div class="l"><div class="r"><div class="bd">{popupContent}</div></div></div></div><div class="ft"><span class="l"> </span><div class="m"> </div><span class="r"> </span></div>';document.body.insertBefore(d,document.body.firstChild);}var overlay=document.getElementById("mb_overlay");if(YAHOO.util.Dom.getStyle(overlay,"display")=="block"){this._resetOverlay();}YAHOO.util.Dom.setStyle(overlay,"opacity","0");YAHOO.util.Dom.setStyle(overlay,"display","block");overlay.innerHTML=overlay.innerHTML.replace("{popupTitle}",el.title).replace("{popupContent}",document.getElementById(el.id+"_content").innerHTML);var bd=YAHOO.util.Selector.query("div.container_bd div.bd",overlay,true);if(w){bd.style.width=w+"px";overlay.style.width=bd.offsetWidth+"px";}else{if(bd.firstChild.offsetWidth>357){bd.style.width=bd.firstChild.offsetWidth+"px";overlay.style.width=bd.offsetWidth+"px";}}if(h){bd.style.height=h+"px";}YAHOO.util.Dom.setXY(overlay,[($D.getViewportWidth()/2)-(overlay.offsetWidth/2),($D.getViewportHeight()/2)-(overlay.offsetHeight/2)]);overlay.style.display="none";YAHOO.util.Event.addListener("mb_overlay_close","click",this.hideOverlay,this);this._animOverlay(overlay);},_animOverlay:function(overlay){overlay.style.display="block";var anim=new YAHOO.util.Anim(overlay,{opacity:{to:0.99}},0.25,YAHOO.util.Easing.easeIn);anim.animate();},_resetOverlay:function(){var overlay=document.getElementById("mb_overlay");YAHOO.util.Dom.setStyle("mb_overlay","display","none");YAHOO.util.Selector.query("div.hd h3",overlay,true).innerHTML="{popupTitle}";YAHOO.util.Selector.query("div.container_bd div.bd",overlay,true).innerHTML="{popupContent}";},hideOverlay:function(e,obj){var anim=new YAHOO.util.Anim("mb_overlay",{opacity:{to:0}},0.25,YAHOO.util.Easing.easeIn);anim.onComplete.subscribe(function(){obj._resetOverlay();});anim.animate();},scaleImage:function(aImage){var sHeight=aImage.height;var sWidth=aImage.width;if(aImage.width>$D.getViewportWidth()){sWidth=$D.getViewportWidth()-20;sHeight=aImage.height*(sWidth/aImage.width);if(sHeight+100>($D.getViewportHeight()-20)){sHeight=$D.getViewportHeight()-120;sWidth=aImage.width*(sHeight/aImage.height);}}else{if(aImage.height+100>$D.getViewportHeight()){sWidth=aImage.width*(($D.getViewportHeight()-120)/aImage.height);sHeight=$D.getViewportHeight()-120;if(sWidth>($D.getViewportWidth()-20)){sWidth=aImage.width*(sHeight/aImage.height);sHeight=aImage.height*(sWidth/aImage.width);}}}var scaleAtts=new Array(Math.floor(sWidth),Math.floor(sHeight));return scaleAtts;},close:function(){var aClose=new YAHOO.widget.aEffect();aClose.aClose();},awesome:function(){var aAwesome=new YAHOO.widget.aEffect();aAwesome.aAwesome();}};}();window.onload=function(){YAHOO.awesomebox.init();if(document.getElementById("mediaBar")){var mb_fc=YAHOO.util.Dom.getFirstChild(document.getElementById("mediaBar"));var mb_container=YAHOO.util.Dom.getNextSibling(mb_fc);YAHOO.util.Dom.setStyle(mb_container,"visibility","visible");YAHOO.util.Dom.setStyle(mb_container,"opacity","0");var anim=new YAHOO.util.Anim(mb_container,{opacity:{to:1}},0.2,YAHOO.util.Easing.easeIn);var f=function(){new YAHOO.util.Anim("loader_mediaBar",{opacity:{to:0}},0.15,YAHOO.util.Easing.easeOut).animate();var colorEls=YAHOO.util.Dom.getElementsByClassName("color");if(colorEls.length>0){YAHOO.util.Event.addListener(colorEls,"click",function(){ColorVariantManager.detailClick(this);});YAHOO.util.Dom.setStyle("container_colors","filter","");}};anim.onStart.subscribe(f);anim.onComplete.subscribe(function(){YAHOO.util.Dom.setStyle("loader_mediaBar","visibility","hidden");var el=document.getElementById("loader_mediaBar");el.parentNode.removeChild(el);if(document.getElementById("container_colors")){YAHOO.util.Dom.setStyle("container_colors","display","block");new YAHOO.util.Anim("container_colors",{opacity:{to:0.99}},0.15,YAHOO.util.Easing.easeIn).animate();}});anim.animate();}else{if(document.getElementById("container_colors")){var colorEls=YAHOO.util.Dom.getElementsByClassName("color");if(colorEls.length>0){YAHOO.util.Event.addListener(colorEls,"click",function(){ColorVariantManager.detailClick(this);});YAHOO.util.Dom.setStyle("container_colors","filter","");}YAHOO.util.Dom.setStyle("container_colors","display","block");var anim=new YAHOO.util.Anim("container_colors",{opacity:{to:0.99}},0.15,YAHOO.util.Easing.easeIn).animate();}}};ColorVariantManager=function(){var currentEl=selectedEl=originalVariantId="";var variants=templates=[];return{categoryClick:function(el){var els=YAHOO.util.Dom.getElementsByClassName("color","div",el.parentNode,function(o){if(o==el){YAHOO.util.Dom.addClass(o,"selected");var dataEl=YAHOO.util.Dom.getLastChild(el);var flyoutId=dataEl.getAttribute("data-parentId");var variantId=dataEl.id.substr(dataEl.id.lastIndexOf("_")+1);document.getElementById("item_"+flyoutId+"_img").src="/static/images/icons/blank.gif";var im=new Image();im.onload=function(){document.getElementById("item_"+flyoutId+"_img").src=im.src;};im.src=dataEl.getAttribute("data-image");document.getElementById("data_price_"+flyoutId).innerHTML=dataEl.getAttribute("data-price");document.getElementById("data_color_"+flyoutId).innerHTML=dataEl.getAttribute("data-label");document.getElementById("data_url_"+flyoutId).href=dataEl.getAttribute("data-href");document.getElementById("data_url_ft_"+flyoutId).href=dataEl.getAttribute("data-href");}else{YAHOO.util.Dom.removeClass(o,"selected");}});},detailClick:function(el){YAHOO.util.Dom.removeClass(currentEl,"selected");YAHOO.util.Dom.addClass(el,"selected");currentEl=el;var v=this.getVariant(el.id.substr(el.id.lastIndexOf("_")+1));var fo=new YAHOO.util.Anim("swapTarget",{opacity:{to:0}},0.1);fo.onStart.subscribe(function(){YAHOO.util.Dom.setStyle("loader","opacity","0.99");});fo.animate();var idx=Carousels.highlighted.id.substr(Carousels.highlighted.id.lastIndexOf("-")+1);idx--;var currentPv=v.ViewFront;var enlargeEls=YAHOO.util.Dom.getElementsByClassName("enlargeImg","a","hero");var mbEls=YAHOO.util.Dom.getElementsByClassName("ProductViews","li","mediaBar");var count=0;var grp=aClient.getGroup("Product Views");for(var i in v.productViews){var portStr="";if(document.location.port){portStr=":"+document.location.port;}enlargeEls[count].href=document.location.protocol+"//"+document.location.hostname+portStr+v.productViews[i].large;grp[document.location.protocol+"//"+document.location.hostname+portStr+v.productViews[i].large]=count;grp.items[count]=enlargeEls[count];var mbEl=YAHOO.util.Dom.getFirstChild(mbEls[count]);mbEl.href=v.productViews[i].view;YAHOO.util.Dom.getFirstChild(mbEl).src=v.productViews[i].thumb;if(count==idx){currentPv=v.productViews[i].view;}count++;}var im=new Image();im.onload=function(){var tg=document.getElementById("swapTarget");tg.src=currentPv;var fi=new YAHOO.util.Anim("swapTarget",{opacity:{to:0.99}},0.1);fi.onStart.subscribe(function(){YAHOO.util.Dom.setStyle("loader","opacity","0");});fi.animate();};im.src=currentPv;if(document.getElementById("label_price")){document.getElementById("label_price").innerHTML=v.price;}document.getElementById("label_productNumber").innerHTML=nikonLabel.productNumber+" "+v.productNumber;if(v.nikonMall){document.getElementById("buttons_wtb").innerHTML=this.processTemplate("mall",v);}else{if(v.wtbUrl){document.getElementById("buttons_wtb").innerHTML=this.processTemplate("wtb",v);}else{document.getElementById("buttons_wtb").innerHTML="";}}},detailMouseover:function(el){var v=this.getVariant(el.id.substr(el.id.lastIndexOf("_")+1));document.getElementById("color_label").innerHTML=v.name;document.getElementById("lg_swatch").innerHTML='<img src="'+v.swatchUrl+'" alt="'+v.name+'">';},detailMouseout:function(el){var v=this.getVariant(el.id.substr(el.id.lastIndexOf("_")+1));document.getElementById("color_label").innerHTML="";document.getElementById("lg_swatch").innerHTML="";},lightboxClick:function(variantId){var v=this.getVariant(variantId);this.swapEnlargeImg(v);var els=YAHOO.util.Dom.getElementsByClassName("color","div","container_lbVariants");for(var i=0;i<els.length;i++){if(els[i].id.indexOf(variantId)>-1){YAHOO.util.Dom.addClass(els[i],"selected");}else{YAHOO.util.Dom.removeClass(els[i],"selected");}}document.getElementById("aImg").src=selectedEl.href;document.getElementById("label_colorName").innerHTML=v.name;document.getElementById("variant_label").innerHTML=v.name+"&nbsp;";},swapEnlargeImg:function(variant){if(typeof variant!="object"){variant=this.getVariant(variant);}var enlargeEls=YAHOO.util.Dom.getElementsByClassName("enlargeImg","a","hero");var count=0;var grp=aClient.getGroup("Product Views");for(var i in variant.productViews){var portStr="";if(document.location.port){portStr=":"+document.location.port;}enlargeEls[count].href=document.location.protocol+"//"+document.location.hostname+portStr+variant.productViews[i].large;grp[document.location.protocol+"//"+document.location.hostname+portStr+variant.productViews[i].large]=count;grp.items[count]=enlargeEls[count];count++;}},resetEnlargeImg:function(){this.swapEnlargeImg(originalVariantId);},setOriginalColor:function(id){originalVariantId=id;},setSelectedEl:function(el){selectedEl=el;},addVariant:function(id,o){variants[id]=o;return this;},getVariant:function(id){return variants[id]||null;},getAllVariants:function(){return variants;},setCurrentEl:function(id){currentEl=id;},addTemplate:function(id,html){templates[id]=html;},getTemplate:function(id){return templates[id];},processTemplate:function(tId,variant){var html=this.getTemplate(tId);for(var i in variant){html=html.replace("["+i+"]",variant[i]).replace("&amp;","&");}return html;}};}();(GlossaryWidget=function(){var sUrl="";var conn=null;var glossary=null;var termsArray=[];var targetID="";return{_genError:"We encountered an error. Please try again.",_buildGlossary:function(o){var terms=o.responseXML.getElementsByTagName("GlossaryTerm");glossary={};for(var i=0;i<terms.length;i++){var t=terms[i].getElementsByTagName("Title")[0];var s=terms[i].getElementsByTagName("Summary")[0];var u=terms[i].getElementsByTagName("URL")[0];var sUrl="";if(u.text){sUrl=u.text;}else{sUrl=u.textContent;}var articleName=sUrl.substr(sUrl.lastIndexOf("/")+1);var tmpTitle=t.text?t.text:t.textContent;if(window.location.href.indexOf(articleName)<0&&!(window.blacklist&&window.blacklist==tmpTitle)){if(t.text){glossary[t.text.toLowerCase()]={term:t.text,summary:s.text,url:sUrl};}else{glossary[t.textContent.toLowerCase()]={term:t.textContent,summary:s.textContent,url:sUrl};}}}return this;},_getGlossaryXML:function(){var obj=this;conn=YAHOO.util.Connect.asyncRequest("GET",sUrl,{success:function(o){obj._buildGlossary(o)._parseContent();},failure:function(o){alert(obj._genError);},error:function(o){alert(obj._genError);}});},_preg_quote:function(str){return(str+"").replace(/([\\\.\+\*\?\[\^\]\$\(\)\{\}\=\!\<\>\|\:])/g,"\\$1");},_parseContent:function(){var bcEls=YAHOO.util.Dom.getElementsByClassName("in-context-glossary");for(var bc=0;bc<bcEls.length;bc++){var bodyContent=bcEls[bc].innerHTML;var combinedRegex="(<dfn [^>]*>)?(<img*?)?\\b(";var index=0;for(var i in glossary){if(index>0){combinedRegex+="|";}combinedRegex+="(?:"+this._preg_quote(i)+")";index++;}combinedRegex+=")\\b([^<]*?>)?(<\\/dfn>)?";var regex=new RegExp(combinedRegex,"ig");bodyContent=bodyContent.replace(regex,function($0){return arguments[1]||arguments[2]||arguments[4]||arguments[5]?$0:'<dfn onclick="GlossaryWidget.showOverlay(event,this)" data-term="'+arguments[3].replace(/\s/g,"_").toLowerCase()+'">'+arguments[3]+"</dfn>";});bcEls[bc].innerHTML=bodyContent;}},showGlossary:function(e,o){if(glossary==null){o._getGlossaryXML();}else{o._parseContent();}o.enableGlossaryOff();YAHOO.util.Cookie.set("showInPageGlossary","true",{expires:new Date("January 12, 2025"),path:"/"});return o;},hideGlossary:function(e,o){var dfns=YAHOO.util.Selector.query("dfn");for(var i=0;i<dfns.length;i++){var dfn=dfns[i];dfn.parentNode.insertBefore(dfn.childNodes[0],dfn);dfn.parentNode.removeChild(dfn);}YAHOO.util.Cookie.remove("showInPageGlossary",{path:"/"});o.enableGlossaryOn();},showOverlay:function(e,el){var xy=YAHOO.util.Dom.getXY(el);var currentTerm=el.getAttribute("data-term").replace(/_/g," ");var ov=document.getElementById("overlay_glossaryPop");if(ov==null){ov=document.createElement("div");ov.id="overlay_glossaryPop";ov.className="pop_glossary";var tmpHtml='<div class="hd"><div class="rnd le_bg"></div><h3 class="nkYellow">&nbsp;</h3><a class="close" href="javascript:GlossaryWidget.hideOverlay()">Close</a></div>';tmpHtml+='<div class="bd"><div class="definition">&nbsp;</div><a href="#" class="link_definition">&nbsp;</a></div>';tmpHtml+='<div class="ft le_bg">&nbsp;</div><div class="corner le_bg tl">&nbsp;</div>';ov.innerHTML=tmpHtml;document.body.appendChild(ov);}ov.getElementsByTagName("h3")[0].innerHTML=glossary[currentTerm].term;YAHOO.util.Selector.query("div.definition",ov,true).innerHTML=glossary[currentTerm].summary;var termLinkEl=YAHOO.util.Selector.query("a.link_definition",ov,true);var tmpUrl=glossary[currentTerm].url;if(tmpUrl.indexOf("index.page?appendix="+glossary[currentTerm].term.substring(0,1).toUpperCase())<0){termLinkEl.innerHTML=nikonLabel.learnAbout+" "+glossary[currentTerm].term;}else{termLinkEl.innerHTML=nikonLabel.photoGlossary;}termLinkEl.href=tmpUrl;YAHOO.util.Event.addListener(termLinkEl,"click",function(){OmnitureHelper.setIPGTermClickEvents(currentTerm);});var shiftLeft=(xy[0]+ov.offsetWidth)>YAHOO.util.Dom.getViewportWidth();var shiftTop=(xy[1]+ov.offsetHeight)>YAHOO.util.Dom.getViewportHeight();var cEl=YAHOO.util.Selector.query("div.corner",ov,true);if(shiftLeft&&shiftTop){cEl.className="corner le_bg br";var newX=xy[0]-ov.offsetWidth-el.offsetWidth+cEl.offsetWidth;var newY=xy[1]-ov.offsetHeight-el.offsetHeight+(cEl.offsetWidth/2);YAHOO.util.Dom.setXY(ov,[newX,newY]);}else{if(!shiftLeft&&shiftTop){cEl.className="corner le_bg bl";var newX=xy[0]+el.offsetWidth+cEl.offsetWidth;var newY=xy[1]-ov.offsetHeight-el.offsetHeight+(cEl.offsetWidth/2);YAHOO.util.Dom.setXY(ov,[newX,newY]);}else{if(shiftLeft&&!shiftTop){cEl.className="corner le_bg tr";var newX=xy[0]-ov.offsetWidth-el.offsetWidth+cEl.offsetWidth;var newY=xy[1]+el.offsetHeight+(cEl.offsetWidth/2);YAHOO.util.Dom.setXY(ov,[newX,newY]);}else{cEl.className="corner le_bg tl";var newX=xy[0]+el.offsetWidth+cEl.offsetWidth;var newY=xy[1]+el.offsetHeight+(cEl.offsetWidth/2);YAHOO.util.Dom.setXY(ov,[newX,newY]);}}}YAHOO.util.Event.stopEvent(e);YAHOO.util.Event.addListener(document.body,"click",GlossaryWidget.maybeHideOverlay,el,this);},hideOverlay:function(e,el){var ov=document.getElementById("overlay_glossaryPop");ov.style.left="-5000px";YAHOO.util.Event.removeListener(document.body,"click",GlossaryWidget.maybeHideOverlay,el,this);},maybeHideOverlay:function(e,el){var ov=document.getElementById("overlay_glossaryPop");var targetNode=e.srcElement?e.srcElement:e.explicitOriginalTarget;if(targetNode.nodeType==3){targetNode=targetNode.parentNode;}if(!(targetNode.tagName=="dfn")&&!YAHOO.util.Dom.isAncestor(el,e.explicitOriginalTarget)&&!YAHOO.util.Dom.isAncestor(ov,e.explicitOriginalTarget)){this.hideOverlay(e,el);}},enableGlossaryOff:function(){var obj=this;var pEl=YAHOO.util.Dom.get("glossary_widget");var aEl=YAHOO.util.Selector.query("a",pEl,true);var bEl=YAHOO.util.Dom.get("glossary_body");YAHOO.util.Event.removeListener(aEl,"click");YAHOO.util.Event.removeListener(pEl,"mouseover");YAHOO.util.Event.removeListener(pEl,"mouseout");new YAHOO.util.Anim(bEl,{height:{to:0}},0.25,YAHOO.util.Easing.easeOut).animate();YAHOO.util.Dom.replaceClass(bEl,"open","closed");YAHOO.util.Event.addListener(aEl,"click",function(e){GlossaryWidget.hideGlossary(e,obj);OmnitureHelper.setIPGStateEvent(false);},obj);aEl.innerHTML="Turn off";YAHOO.util.Dom.addClass(pEl,"on");},enableGlossaryOn:function(){var obj=this;var aEl=YAHOO.util.Selector.query("a","glossary_widget",true);YAHOO.util.Event.removeListener(aEl,"click");YAHOO.util.Event.addListener(aEl,"click",function(e){GlossaryWidget.showGlossary(e,obj);OmnitureHelper.setIPGStateEvent(true);},obj);this.addWidgetMouseEvents();aEl.innerHTML="Turn on";YAHOO.util.Dom.removeClass("glossary_widget","on");},addWidgetMouseEvents:function(){var pEl=YAHOO.util.Dom.get("glossary_widget");var bEl=YAHOO.util.Dom.get("glossary_body");YAHOO.util.Event.addListener(pEl,"mouseover",function(){if(!YAHOO.util.Dom.hasClass(bEl),"open"){new YAHOO.util.Anim(bEl,{height:{to:YAHOO.util.Dom.getFirstChild(bEl).offsetHeight}},0.25,YAHOO.util.Easing.easeIn).animate();YAHOO.util.Dom.replaceClass(bEl,"closed","open");}});YAHOO.util.Event.addListener(pEl,"mouseout",function(e){if(!YAHOO.util.Dom.isAncestor(pEl,e.relatedTarget)){new YAHOO.util.Anim(bEl,{height:{to:0}},0.25,YAHOO.util.Easing.easeOut).animate();YAHOO.util.Dom.replaceClass(bEl,"open","closed");}});},setTargetID:function(t){targetID=t;},init:function(){var obj=this;YAHOO.util.Event.addListener(window,"load",function(){if(document.getElementById("glossary_widget")){sUrl=GLOSSARY_TERM_URL;if(YAHOO.util.Cookie.get("showInPageGlossary",Boolean)){GlossaryWidget.showGlossary(null,obj);}else{GlossaryWidget.enableGlossaryOn();}}});}};}()).init();
