if(!YAHOO.lightBox){YAHOO.namespace("YAHOO.lightBox");}
function TIMEOUT_startLightBox(container,index){return YAHOO.lightBox.start.openDisplay(container,index);}
YAHOO.lightBox.start=function(){var config={};var $dom=YAHOO.util.Dom;var containers={};var displays={};var imgs=null;var boxes={};var active={};var request;var loaded={};var events={};var configs={};var configDefault={};return{init:function(){events.onMetaChange=new YAHOO.util.CustomEvent("metaChange",this,true,1);events.onLoad=new YAHOO.util.CustomEvent("load",this,true,1);this.defaultConfig();this.create();},defaultConfig:function(){var containers=null;configDefault={display:{gallery:true,slideshow:false,timer:5000},transitions:{fade:0.6,size:0.6},window:{modal:true,dragable:false},easing:{global:YAHOO.util.Easing.easeBothStrong},position:{placement:"absolute"}};if(!YAHOO.lightBox.config){containers=$dom.getElementsByClassName("lightBoxContainer","div");YAHOO.lightBox.config={};for(var i=0;i<containers.length;i++){containers[i].setAttribute("id","lightBoxContainer_"+i);YAHOO.lightBox.config["lightBoxContainer_"+i]=configDefault;}}},create:function(cont){var box;if(!cont){containers=$dom.getElementsByClassName("lightBoxContainer","div");for(var j=0;j<containers.length;j++){if(containers[j].getElementsByTagName("img").length){this.configImage(containers[j],j);}}}
else{this.configImage($dom.get(cont));}},configImage:function(container,index){active[container.getAttribute("id")]=null;imgs=$dom.getElementsByClassName("lightBox","img",container);loaded[container.getAttribute("id")]={};boxes[container.getAttribute("id")]=[];displays[container.getAttribute("id")]=null;configs[container.getAttribute("id")]=container.getAttribute("id");for(var i in imgs){if(imgs.hasOwnProperty(i)){if(!loaded[container.getAttribute("id")]["lightBoxThumb_"+i]){imgs[i].setAttribute("id","lightBoxThumb_"+i);imgs[i].index=i;box=new YAHOO.lightBox.image(imgs[i]);boxes[container.getAttribute("id")].push(box);loaded[container.getAttribute("id")][imgs[i].getAttribute("id")]=true;}}}},openDisplay:function(cont,index){var index=index?index:0;try{boxes[cont][index].open();}catch(e){}},next:function(id){try{this.getDisplay(id).onnext();}catch(e){}},prev:function(id){try{this.getDisplay(id).onprev();}catch(e){}},close:function(id){try{this.getDisplay(id).onclose();}catch(e){}},load:function(id){var config=YAHOO.lightBox.config[id];var callBack=config.connections.callBack?config.connections.callBack:void(0);var callBack={success:this.readPhotos,failure:this.handleFail,caller:this,callBack:callBack,cont:id};request=YAHOO.util.Connect.asyncRequest('GET',config.connections.url,callBack);},readPhotos:function(data){var photo={};var photoNodes=data.responseXML.getElementsByTagName("photo");for(var i=0;i<photoNodes.length;i++){photo.src=photoNodes[i].getElementsByTagName("src")[0].firstChild.nodeValue;photo.longdesc=photoNodes[i].getElementsByTagName("longdesc")[0].firstChild.nodeValue;if(photoNodes[i].getElementsByTagName("title")[0].firstChild){photo.title=photoNodes[i].getElementsByTagName("title")[0].firstChild.nodeValue;}
else{photo.title="";}
if(photoNodes[i].getElementsByTagName("alt")[0].firstChild){photo.alt=photoNodes[i].getElementsByTagName("alt")[0].firstChild.nodeValue;}
else{photo.alt="";}
this.caller.createPhoto(photo,this.cont);}
this.caller.create(this.cont);this.caller.events("onMetaChange").fire();this.callBack();},createPhoto:function(photo,cont){var anchor=document.createElement("a");var dom=document.createElement("img");var loadContainer=cont?$dom.get(cont):$dom.getElementsByClassName("lightBoxContainer","div")[0];anchor.setAttribute("href","javascript:;");$dom.setStyle(anchor,"display","none");dom.setAttribute("src",photo.src);dom.longdesc=photo.longdesc;dom.setAttribute("title",photo.title);dom.setAttribute("alt",photo.alt);$dom.addClass(dom,"lightBox");anchor.appendChild(dom);loadContainer.appendChild(anchor);},handleFail:function(){alert("fail!");},setActive:function(cont,box){active[cont]=box;},getActive:function(cont){return active[cont];},getDisplay:function(id){return displays[id];},setDisplay:function(id,display){displays[id]=display;},getCont:function(node){return $dom.getAncestorByClassName(node,"lightBoxContainer").getAttribute("id");},events:function(evt){return events[evt];}}}();YAHOO.lightBox.image=function(dom){var config={};var $dom=YAHOO.util.Dom;var $evt=YAHOO.util.Event;init();this.getDom=getDom;function getDom(){return dom;}
this.open=open;function open(){onclick();}
function init(){setEvents();}
function setEvents(){$evt.on(dom,"click",onclick,dom,true);}
function onclick(e){if(!YAHOO.lightBox.start.getActive(YAHOO.lightBox.start.getCont(dom))){YAHOO.lightBox.start.setDisplay(YAHOO.lightBox.start.getCont(dom),new YAHOO.lightBox.display(dom));}
YAHOO.lightBox.start.setActive(YAHOO.lightBox.start.getCont(dom),dom);YAHOO.lightBox.start.getDisplay(YAHOO.lightBox.start.getCont(dom)).load();YAHOO.util.Event.preventDefault(e);}};YAHOO.lightBox.display=function(dom){var config={};var $dom=YAHOO.util.Dom;var $evt=YAHOO.util.Event;var display=null;var center=null;var iframe=null;var header=null;var title=null;var closeBtn=null;var image=null;var details=null;var desc=null;var count=null;var nav=null;var nextBtn=null;var prevBtn=null;var mask=null;var loader=null;var dragObj=null;var pager=null;var hasLoaded=false;var orgBodyOverflow=$dom.getStyle(document.body,"overflow");var pagingBtns=[];var interval=null;init();this.load=load;function load(){var box=YAHOO.lightBox.start.getActive(YAHOO.lightBox.start.getCont(dom));var src;$dom.setStyle(title,"visibility","hidden");$dom.setStyle(details,"visibility","hidden");$dom.setStyle(image,"visibility","hidden");$dom.setStyle(display,"z-index",YAHOO.lightBox.newZ++);setText(title,"title");setText(desc,"alt");displayLoadingOn();if(YAHOO.lightBox.config[YAHOO.lightBox.start.getCont(dom)].window.modal){}
if(box.longdesc==undefined){src=box.getAttribute("longdesc");}
else{src=box.longdesc;}
image.src=src;}
this.onnext=onnext;function onnext(){if(!disabled(nextBtn)){YAHOO.lightBox.start.setActive(YAHOO.lightBox.start.getCont(dom),getNextBox());load();setEvents();updateCount();}}
this.onprev=onprev;function onprev(){if(!disabled(prevBtn)){YAHOO.lightBox.start.setActive(YAHOO.lightBox.start.getCont(dom),getPrevBox());load();setEvents();updateCount();}}
this.onclose=onclose;function onclose(){var anim,attributes;YAHOO.lightBox.start.setActive(YAHOO.lightBox.start.getCont(dom),null);attributes={opacity:{from:1,to:0},height:{to:0}};anim=new YAHOO.util.Anim(display,attributes,YAHOO.lightBox.config[YAHOO.lightBox.start.getCont(dom)].transitions.fade,YAHOO.lightBox.config[YAHOO.lightBox.start.getCont(dom)].easing.global);anim.animate();anim.onComplete.subscribe(function(){$dom.setStyle(display,"display","none");$dom.setStyle(mask,"display","none");if(interval)
stopSlideshow();});}
this.middle=middle;function middle(){}
this.startSlideshow=startSlideshow;function startSlideshow(){var which=YAHOO.lightBox.start.getCont(dom);var intervalStr="YAHOO.lightBox.start.getDisplay('"+which+"').onnext()";interval=setInterval(intervalStr,YAHOO.lightBox.config[YAHOO.lightBox.start.getCont(dom)].display.timer);}
this.stopSlideshow=stopSlideshow;function stopSlideshow(){clearInterval(interval);}
function init(){create();if(YAHOO.lightBox.config[YAHOO.lightBox.start.getCont(dom)].window.dragable){dragObj=new YAHOO.lightBox.DDOnTop(display.getAttribute("id"));dragObj.setHandleElId(title.getAttribute("id"));$dom.setStyle(title,"cursor","move");}
setEvents();}
function create(){display=document.createElement("div");displayInner=document.createElement("div");center=document.createElement("center");iframe=document.createElement("iframe");header=document.createElement("div");title=document.createElement("h5");closeBtn=document.createElement("a");image=document.createElement("img");details=document.createElement("div");desc=document.createElement("div");count=document.createElement("div");nav=document.createElement("div");pager=document.createElement("div");nextBtn=document.createElement("a");prevBtn=document.createElement("a");mask=document.createElement("div");loader=document.createElement("div");display.appendChild(displayInner);center.appendChild(iframe);displayInner.appendChild(center);displayInner.appendChild(header);header.appendChild(title);displayInner.appendChild(image);displayInner.appendChild(details);details.appendChild(desc);details.appendChild(count);displayInner.appendChild(nav);nav.appendChild(pager);nav.appendChild(nextBtn);nav.appendChild(prevBtn);nav.appendChild(closeBtn);document.body.appendChild(mask);document.body.appendChild(loader);if(YAHOO.lightBox.config[YAHOO.lightBox.start.getCont(dom)].position.placement=="absolute"){document.body.appendChild(display);}
else{$dom.get(YAHOO.lightBox.config[YAHOO.lightBox.start.getCont(dom)].position.container).appendChild(display);$dom.setStyle(display,"position","relative");$dom.setStyle(display,"margin-top","0px");$dom.setStyle(display,"margin-left","0px");$dom.setStyle(display,"top","0px");$dom.setStyle(display,"left","0px");$dom.replaceClass(display,"lightBoxShowCase","lightBoxShowCaseRel");}
configDisplay();}
function setEvents(){if(!$evt.getListeners(nextBtn,"click")){$evt.on(image,"load",onload,image,true);$evt.on(nextBtn,"click",onnext,nextBtn,false);$evt.on(prevBtn,"click",onprev,prevBtn,false);$evt.on(closeBtn,"click",onclose,closeBtn,false);$evt.on(mask,"click",onclose,mask,false);if(YAHOO.lightBox.config[YAHOO.lightBox.start.getCont(dom)].window.dragable){$evt.on(display,"mousedown",dragObj.startDrag,dragObj,true);}
$evt.on(nextBtn,"focus",doblur);$evt.on(prevBtn,"focus",doblur);$evt.on(closeBtn,"focus",doblur);$evt.on(window,"resize",middle);$evt.on(document.body,"scroll",middle);YAHOO.lightBox.start.events("onMetaChange").subscribe(metaUpdate);if(YAHOO.lightBox.config[YAHOO.lightBox.start.getCont(dom)].controls){if(YAHOO.lightBox.config[YAHOO.lightBox.start.getCont(dom)].controls.paging){YAHOO.lightBox.start.events("onLoad").subscribe(configPaging);}}
if(YAHOO.lightBox.config[YAHOO.lightBox.start.getCont(dom)].display.slideshow){if(!hasLoaded)
startSlideshow();}}}
function configDisplay(){$dom.setStyle(display,"display","none");$dom.addClass(display,"lightBoxShowCase");$dom.addClass(display,"lightBoxShowCaseInner");display.setAttribute("id",$dom.generateId());title.setAttribute("id",$dom.generateId());$dom.addClass(image,"lightBoxZoom");$dom.addClass(header,"lightBoxHeader");$dom.addClass(details,"lightBoxDetails");$dom.addClass(desc,"lightBoxDesc");$dom.addClass(count,"lightBoxCount");$dom.addClass(nav,"lightBoxNav");$dom.addClass(pager,"lightBoxPager");createBtn("nextBtn",nextBtn);createBtn("prevBtn",prevBtn);createBtn("closeBtn",closeBtn);iframe.setAttribute("width","478");iframe.setAttribute("height","60");iframe.setAttribute("frameborder","0");iframe.setAttribute("scrolling","no");$dom.addClass(mask,"lightBoxMask");$dom.setStyle(mask,"z-index",900);$dom.addClass(loader,"lightBoxLoader");}
function configPaging(){var index=getBoxIndex();var amount=getBoxsAmount();var maxShown=YAHOO.lightBox.config[YAHOO.lightBox.start.getCont(dom)].controls.pagingButtons;var buffer=Math.round(maxShown/2);var shown,cindex;shown=(amount>maxShown)?maxShown:amount;if(index-buffer<=0){buffer=index;}
if(pagingBtns.length==0){for(var i=0;i<shown;i++){cindex=((i+1)+(index-buffer));if(cindex<=amount){pagingBtns.push(document.createElement("a"));pager.appendChild(pagingBtns[i]);$dom.addClass(pagingBtns[i],"pagingBtn");pagingBtns[i].innerHTML=cindex;pagingBtns[i].setAttribute("href","javascript:;");pagingBtns[i].onclick=page;if(cindex==(index+1)){$dom.addClass(pagingBtns[i],"activePage");}}}}
else{for(var i=0;i<shown;i++){cindex=((i+1)+(index-buffer));$dom.setStyle(pagingBtns[i],"display","inline");if(cindex<=amount){pagingBtns[i].innerHTML=cindex;$dom.removeClass(pagingBtns[i],"activePage");if(cindex==(index+1)){$dom.addClass(pagingBtns[i],"activePage");}}
else
$dom.setStyle(pagingBtns[i],"display","none");}}}
function page(){var index=parseInt(this.innerHTML,10);var container=YAHOO.lightBox.start.getCont(dom);var next=$dom.get(container).getElementsByTagName("a")[index-1];YAHOO.lightBox.start.setActive(YAHOO.lightBox.start.getCont(dom),$dom.getFirstChild(next));load();setEvents();updateCount();}
function metaUpdate(){enable(nextBtn);updateCount();}
function loadUpdate(){}
function createBtn(str,el){el.setAttribute("href","javascript:;");if(YAHOO.lightBox.config[YAHOO.lightBox.start.getCont(dom)].display.gallery||str=="closeBtn"){$dom.addClass(el,"lightBox-"+str);}
else{$dom.addClass(el,"lightBox-noNav");}}
function updateCount(){count.innerHTML="Photo: "+(getBoxIndex()+1)+" of "+getBoxsAmount();var iframeString=getText("product")+"/LyteframeAction.do?count="+getBoxIndex()+"&section="+getText("section")+"&img="+getText("longdesc");iframe.setAttribute("src",iframeString);}
function doblur(){this.blur();}
function displayLoadingOn(){$dom.setStyle(loader,"display","block");if(hasLoaded){var top=Number(display.offsetTop);var left=Number(display.offsetLeft);var offsetWidth=(display.offsetWidth/2)-(loader.offsetWidth/2);var offsetHeight=(display.offsetHeight/2)-(loader.offsetHeight/2);}
else{var top=Number((($dom.getViewportHeight()/2)+document.documentElement.scrollTop));var left=Number(($dom.getViewportWidth()/2));var offsetWidth=retNumeric(-Number(loader.offsetWidth))/2;var offsetHeight=retNumeric(-Number(loader.offsetHeight))/2;}
$dom.setStyle(loader,"top",top+offsetHeight+"px");$dom.setStyle(loader,"left",left+offsetWidth+"px");$dom.setStyle(loader,"z-index",YAHOO.lightBox.newZ++);}
function displayLoadingOff(){$dom.setStyle(loader,"display","none");}
function onload(){var imgWidth,imgHeight,headerHeight,detailsHeight,countHeight,navHeight,displayHeight,displayWidth,displayPadding,displayMargins,adjustedWidth,adjustedHeight,marginTop,marginLeft,anim1,anim2,descHeight,displayInnerPadding,displayInnerMargins,displayInnerExtraTB,displayInnerExtraLR;$dom.setStyle(image,"visibility","visible");$dom.setStyle(image,"opacity",0);if(hasLoaded){$dom.setStyle(display,"opacity",1);}
else{$dom.setStyle(display,"opacity",0);}
$dom.setStyle(display,"display","block");if(YAHOO.lightBox.config[YAHOO.lightBox.start.getCont(dom)].window.modal){var maskHeight=document.body.parentNode.offsetHeight;$dom.setStyle(mask,"display","block");$dom.setStyle(mask,"height",maskHeight+"px");}
imgWidth=getElTotalWidth(image);imgHeight=getElTotalHeight(image);headerHeight=getElTotalHeight(header);detailsHeight=getElTotalHeight(details);descHeight=getElTotalHeight(desc);countHeight=getElTotalHeight(count);navHeight=getElTotalHeight(nav);displayHeight=getElTotalHeight(display);displayWidth=getElTotalWidth(display);displayPadding=getPadding(display);displayMargins=getMargins(display);displayInnerPadding=getPadding(displayInner);displayInnerMargins=getMargins(displayInner);displayInnerExtraTB=(displayInnerPadding.top+displayInnerPadding.bottom)+(displayInnerMargins.top+displayInnerMargins.bottom);displayInnerExtraLR=(displayInnerPadding.left+displayInnerPadding.right)+(displayInnerMargins.left+displayInnerMargins.right);adjustedWidth=imgWidth+(displayPadding.left+displayPadding.right)+displayInnerExtraLR;adjustedHeight=imgHeight+(headerHeight+descHeight+countHeight+navHeight)+(displayPadding.top+displayPadding.bottom)+displayInnerExtraTB;if(adjustedWidth<478)adjustedWidth=478;adjustedHeight+=80;marginTop=((adjustedHeight/2)-(document.documentElement.scrollTop))*-1;marginLeft=(adjustedWidth/2)*-1;if(YAHOO.lightBox.config[YAHOO.lightBox.start.getCont(dom)].position.placement=="absolute"){$dom.setStyle(display,"top","50%");var attributes1={"marginTop":{to:marginTop},"marginLeft":{to:marginLeft},"width":{to:adjustedWidth},"height":{to:adjustedHeight}};}
else{var attributes1={"width":{to:adjustedWidth},"height":{to:adjustedHeight}};}
anim1=new YAHOO.util.Anim(display,attributes1,YAHOO.lightBox.config[YAHOO.lightBox.start.getCont(dom)].transitions.size,YAHOO.lightBox.config[YAHOO.lightBox.start.getCont(dom)].easing.global);anim1.animate();anim1.onComplete.subscribe(function(){$dom.setStyle(title,"visibility","visible");$dom.setStyle(details,"visibility","visible");});if(getBoxIndex()==(getBoxsAmount()-1))
disable(nextBtn);else
enable(nextBtn);if(getBoxIndex()<1)
disable(prevBtn);else
enable(prevBtn);attributes2={opacity:{to:1}};anim2=new YAHOO.util.Anim(image,attributes2,YAHOO.lightBox.config[YAHOO.lightBox.start.getCont(dom)].transitions.fade,YAHOO.lightBox.config[YAHOO.lightBox.start.getCont(dom)].easing.global);anim2.animate();if(!hasLoaded){anim1.onComplete.subscribe(function(){var attributes={opacity:{to:1}};var anim=new YAHOO.util.Anim(display,attributes,YAHOO.lightBox.config[YAHOO.lightBox.start.getCont(dom)].transitions.fade,YAHOO.lightBox.config[YAHOO.lightBox.start.getCont(dom)].easing.global);anim.animate();});}
displayLoadingOff();updateCount();hasLoaded=true;YAHOO.lightBox.start.events("onLoad").fire();}
function getElTotalHeight(el){var height=el.offsetHeight;height=height+retNumeric(Number($dom.getStyle(el,"padding-top").replace("px","")));height=height+retNumeric(Number($dom.getStyle(el,"padding-bottom").replace("px","")));height=height+retNumeric(Number($dom.getStyle(el,"margin-top").replace("px","")));height=height+retNumeric(Number($dom.getStyle(el,"margin-bottom").replace("px","")));return height;}
function getElTotalWidth(el){var width=el.offsetWidth;width=width+retNumeric(Number($dom.getStyle(el,"padding-left").replace("px","")));width=width+retNumeric(Number($dom.getStyle(el,"padding-right").replace("px","")));width=width+retNumeric(Number($dom.getStyle(el,"margin-left").replace("px","")));width=width+retNumeric(Number($dom.getStyle(el,"margin-right").replace("px","")));return width;}
function getMargins(el){var margins={};margins.left=retNumeric(Number($dom.getStyle(el,"margin-left").replace("px","")));margins.right=retNumeric(Number($dom.getStyle(el,"margin-right").replace("px","")));margins.top=retNumeric(Number($dom.getStyle(el,"margin-top").replace("px","")));margins.bottom=retNumeric(Number($dom.getStyle(el,"margin-bottom").replace("px","")));return margins;}
function getPadding(el){var padding={};padding.left=retNumeric(Number($dom.getStyle(el,"padding-left").replace("px","")));padding.right=retNumeric(Number($dom.getStyle(el,"padding-right").replace("px","")));padding.top=retNumeric(Number($dom.getStyle(el,"padding-top").replace("px","")));padding.bottom=retNumeric(Number($dom.getStyle(el,"padding-bottom").replace("px","")));return padding;}
function retNumeric(n){if(isFinite(n))
return n;else
return 0;}
function setText(el,att,prefix){var box=YAHOO.lightBox.start.getActive(YAHOO.lightBox.start.getCont(dom));el.innerHTML="";$dom.setStyle(el,"display","none");if(box.getAttribute(att)!=null&&box.getAttribute(att).length){el.innerHTML=box.getAttribute(att);if(prefix!=null){el.innerHTML=prefix+el.innerHTML;}
$dom.setStyle(el,"display","block");}
else{if(el.tagName.toLowerCase()=="h5"){el.innerHTML=" ";$dom.setStyle(el,"display","block");}}}
function getText(att){var box=YAHOO.lightBox.start.getActive(YAHOO.lightBox.start.getCont(dom));if(box.getAttribute(att).length){return box.getAttribute(att);}
return null;}
function getNextBox(){try{var box=YAHOO.lightBox.start.getActive(YAHOO.lightBox.start.getCont(dom));var sibA=$dom.getNextSibling(box.parentNode);return $dom.getFirstChild(sibA);}
catch(e){return null;}}
function getPrevBox(){try{var box=YAHOO.lightBox.start.getActive(YAHOO.lightBox.start.getCont(dom));var sibA=$dom.getPreviousSibling(box.parentNode);return $dom.getFirstChild(sibA);}
catch(e){return null;}}
function disable(btn){$dom.addClass(btn,"disabled");}
function enable(btn){$dom.removeClass(btn,"disabled");}
function disabled(btn){if($dom.hasClass(btn,"disabled"))
return true;else
return false;}
function getBoxIndex(){var box=YAHOO.lightBox.start.getActive(YAHOO.lightBox.start.getCont(dom));return parseInt(box.index);}
function getBoxsAmount(){var box=YAHOO.lightBox.start.getActive(YAHOO.lightBox.start.getCont(dom));return $dom.getAncestorByTagName(box,"div").getElementsByTagName("a").length;}}
YAHOO.lightBox.newZ=999;YAHOO.lightBox.DDOnTop=function(id,sGroup,config){YAHOO.lightBox.DDOnTop.superclass.constructor.apply(this,arguments);};YAHOO.extend(YAHOO.lightBox.DDOnTop,YAHOO.util.DD,{origZ:0,startDrag:function(x,y){var style=this.getEl().style;this.origZ=style.zIndex;style.zIndex=YAHOO.lightBox.newZ++;},endDrag:function(e){}});YAHOO.util.Event.onDOMReady(YAHOO.lightBox.start.init,YAHOO.lightBox.start,YAHOO.lightBox.start);