(function($){var tpifwOutputDiv='tpiilhw-output';var tpiIlhwDULock=1;var tpiIsIE=0;var tpiEdgeLock=0;var tpiTimeoutId;var tpiCornerLeftSelectedImage;var tpiCornerLeftNotSelectedImage;var tpiCornerLeftHoverImage;var tpiCornerRightSelectedImage;var tpiCornerRightNotSelectedImage;var tpiCornerRightHoverImage;var tpiButtonLeftButton=new Image();var tpiButtonLeftDimButtonImage=new Image();var tpiButtonLeftPressedButtonImage=new Image();var tpiButtonLeftCurrentDisplayed='dimmed';var tpiButtonRightButton=new Image();var tpiButtonRightDimButtonImage=new Image();var tpiButtonRightPressedButtonImage=new Image();var tpiButtonRightCurrentDisplayed='default';var tpiStep;var tpiStripLeftMostElement=0;var tpiStripRightMostElement=-10000;var tpiStripSlideTimer;var tpiCurrentSelectedTab=1;var tpiLastSliceNumber;var tpiCurrentOnHoverTab=0;var tpiAnimateSpeed=150;var tpifX=null;var tpicX=null;var tpidX=null;var tpiStepX=null;window.tpiInitGlobals=function(animationStep,crp){tpiStep=animationStep;tpiIlhwDULock=0;crp=crp;};window.tpiSetTotalNumberOfSlices=function(tpiTotalSoS){tpiLastSliceNumber=tpiTotalSoS;}
window.tpiSetLeftButtonImages=function(tpiBtn,tpiDim,tpiPress){tpiButtonLeftButton.src=tpiBtn;tpiButtonLeftDimButtonImage.src=tpiDim;tpiButtonLeftPressedButtonImage.src=tpiPress;}
window.tpiSetRightButtonImages=function(tpiBtn,tpiDim,tpiPress){tpiButtonRightButton.src=tpiBtn;tpiButtonRightDimButtonImage.src=tpiDim;tpiButtonRightPressedButtonImage.src=tpiPress;}
window.tpiSetLeftCornerImages=function(tpiSelect,tpiNotSelect,tpiHover){tpiCornerLeftSelectedImage=tpiSelect;tpiCornerLeftNotSelectedImage=tpiNotSelect;tpiCornerLeftHoverImage=tpiHover;}
window.tpiSetRightCornerImages=function(tpiSelect,tpiNotSelect,tpiHover){tpiCornerRightSelectedImage=tpiSelect;tpiCornerRightNotSelectedImage=tpiNotSelect;tpiCornerRightHoverImage=tpiHover;}
window.tpifwDelayedDU=function(e,sr,crp,index,rpic){if(tpiIlhwDULock)return;if(!e)e=window.event;if(e.fromElement){tnRefObj=e.fromElement;tnRefObj=document.getElementById('tpiilhwref_'+index);tpiIsIE=1;}
if(e.target){tnRefObj=e.target;}
if(!tnRefObj)return;tpiDUObj=new tpiCreateTOObj(tnRefObj.id,sr,crp,index,rpic);tpiTimeoutId=setTimeout("tpiDUObj.tpifwRequestDU()",200);}
window.tpifwDelayDUClear=function(){if(!tpiTimeoutId)return;clearTimeout(tpiTimeoutId);tpiTimeoutId=undefined;}
window.tpiClearEdgeLock=function(){tpiEdgeLock=0;}
window.tpiCreateTOObj=function(tnRefObjId,sr,crp,index,rpic){
	this.tnRefObjId=tnRefObjId;
	this.sr=sr;
	this.crp=crp;
	this.index=index;
	this.rpic=rpic;
	this.tpifwRequestDU=function(){
		if(tpiIlhwDULock)return;
		if(!tnRefObjId)return;
		var tnRefObj=document.getElementById(this.tnRefObjId);
		if(!tnRefObj)return;
		var tnLoadCnt=document.getElementById('tpiilhwimage_'+this.index);
		var edgeOffset=tpiGetEdgeOffset(tnRefObj);
		if(edgeOffset[0]&&tpiEdgeLock)return;
		if(edgeOffset[1]=='hidden')return;
		if(edgeOffset[0]){
			tpiEdgeLock=1;
			setTimeout('tpiClearEdgeLock()',1000);
			tpiAdjustIlhwX(tnRefObj);
		}
		var params={};params.isDynamicUpdate=1;
		params.sr=this.sr;
		params.crp=this.crp;
		params.index=this.index;
		params.rpic=this.rpic;
		params.ie='UTF8';
		tpiMoveIlhw(tnRefObj);
		var loadingMsg=tpiIlhwLoadingMsg(tnLoadCnt);
		$('#'+tpifwOutputDiv).html(loadingMsg);
		$.get('/showerconfig.asp',params,function(data){$('#'+tpifwOutputDiv)[0].innerHTML=loadingMsg+data;document.getElementById('tpianbmainstrip').style.zoom='1';tpiMoveIlhw(tnRefObj);document.getElementById('tpianbmainstrip').style.zoom='0';});
		document.getElementById('tpianbmainstrip').style.zoom='1';
		tpiMoveIlhw(tnRefObj);
		document.getElementById('tpianbmainstrip').style.zoom='1';
		document.getElementById(tpifwOutputDiv).style.visibility="visible";
		document.getElementById('tpianbmainstrip').style.zoom='0';
	}
}
window.tpifwForceClose=function(){document.getElementById('tpianbmainstrip').style.zoom='1';document.getElementById(tpifwOutputDiv).style.visibility="hidden";document.getElementById('tpianbmainstrip').style.zoom='0';}
window.tpiMoveIlhw=function(tpiIlhwRefObj){var tpiilhwRef=tpiGetAbsolutePos(tpiIlhwRefObj);tpiilhwRef[1]=tpiilhwRef[1]-(tpiIsIE?339:175);tpiilhwRef[0]=tpiilhwRef[0]-(tpiIsIE?254:253);document.getElementById(tpifwOutputDiv).style.top=tpiilhwRef[1]+'px';document.getElementById(tpifwOutputDiv).style.left=tpiilhwRef[0]+'px';}
window.tpiIlhwLoadingMsg=function(refObj){return'<div class="tpiilhwimage"><img src="'+refObj.src+'" border="0" /></div>';}
window.tpiAdjustIlhwX=function(tpiRefObj){var edgeOffset=tpiGetEdgeOffset(tpiRefObj);if(edgeOffset[0]){moveAnimateStrip(edgeOffset[1],edgeOffset[2]);}}
window.tpiIlhwOnMouseOut=function(e){if(!e)e=window.event;if(!e.relatedTarget&&e.toElement)
{e.relatedTarget=e.toElement;}
if(!e.relatedTarget){tpifwForceClose();return;}
var isChild=tpiIsChildOf(tpifwOutputDiv,e.relatedTarget);if(!isChild){tpifwForceClose();}}
window.tpiInitMouseEvents=function(){element=document.getElementById(tpifwOutputDiv);if(element.addEventListener){element.addEventListener("mouseout",tpiIlhwOnMouseOut,false);}
else if(element.attachEvent){element.attachEvent("onmouseout",tpiIlhwOnMouseOut);}}
window.tpiIsChildOf=function(oId,oN){var oCN=oN;if(oN&&oN.id==oId)return 1;while(oCN&&oCN.tagName!="BODY"){oCN=oCN.offsetParent;if(oCN&&oCN.id==oId)return 1;}
return 0;}
window.tpiGetEdgeOffset=function(tpiRefObj){var tpiFrame=document.getElementById('tpianbcentercontent');var tpiFrameOffset=tpiGetAbsolutePos(tpiFrame);var tpiFrameLeftBound=tpiFrameOffset[0];var tpiFrameRightBound=tpiFrameLeftBound+tpiFrame.offsetWidth;var tpiRefObjOffset=tpiGetAbsolutePos(tpiRefObj);var tpiRefObjLeftBound=tpiRefObjOffset[0];var tpiRefObjRightBound=tpiRefObjLeftBound+tpiRefObj.offsetWidth;if((tpiRefObjRightBound<tpiFrameLeftBound)||(tpiRefObjLeftBound>tpiFrameRightBound)){return[0,'hidden',0];}
var edgeMargin=45;if(tpiRefObjLeftBound-edgeMargin<tpiFrameLeftBound){return[1,'right',tpiFrameLeftBound-tpiRefObjLeftBound+edgeMargin];}
if(tpiRefObjRightBound+edgeMargin>tpiFrameRightBound){return[1,'left',tpiRefObjRightBound-tpiFrameRightBound+edgeMargin];}
return[0,undefined,0];}
window.tpiGetAbsolutePos=function(oN){var oCN=oN;var iL=0;var iT=0;while(oCN&&oCN.tagName!="BODY"){iL+=oCN.offsetLeft;iT+=oCN.offsetTop;oCN=oCN.offsetParent;}
return[iL,iT];}
window.tpianbStopSlide=function(){clearInterval(tpiStripSlideTimer);updateANBButtons();tpiIlhwDULock=0;}
window.tpianbLeftClicked=function(){tpiIlhwDULock=1;clearInterval(tpiStripSlideTimer);tpiStripSlideTimer=setInterval('updateANBButtons("left")',15);}
window.tpianbRightClicked=function(){tpiIlhwDULock=1;clearInterval(tpiStripSlideTimer);tpiStripSlideTimer=setInterval('updateANBButtons("right")',15);}
window.tpianbTabsClicked=function(tabClicked){clearInterval(tpiStripSlideTimer);changeTabs(tabClicked);}
window.tpianbTabsOnHover=function(tabOnHover){if(tabOnHover==tpiCurrentSelectedTab)return;document.getElementById('tpianbmainstrip').style.zoom='1';tpiCurrentOnHoverTab=tabOnHover;var oldTabHoverObject=$('#tpianbsostab-'+tpiCurrentOnHoverTab)[0];if(oldTabHoverObject.className=='tpianbsosmiddletab')oldTabHoverObject.className='tpianbsosmiddletabhover';else oldTabHoverObject.className='tpianbsostabhover';if(tpiCurrentOnHoverTab==1)$('#tpisanbsosleftcorner')[0].src=tpiCornerLeftHoverImage;else if(tpiCurrentOnHoverTab==tpiLastSliceNumber)$('#tpisanbsosrightcorner')[0].src=tpiCornerRightHoverImage;document.getElementById('tpianbmainstrip').style.zoom='0';}
window.tpianbTabsNotHover=function(){if(tpiCurrentOnHoverTab==tpiCurrentSelectedTab||tpiCurrentOnHoverTab==0)return;document.getElementById('tpianbmainstrip').style.zoom='1';var oldTabHoverObject=$('#tpianbsostab-'+tpiCurrentOnHoverTab)[0];if(oldTabHoverObject.className=='tpianbsosmiddletabhover')oldTabHoverObject.className='tpianbsosmiddletab';else oldTabHoverObject.className='tpianbsostab';if(tpiCurrentOnHoverTab==1)$('#tpisanbsosleftcorner')[0].src=tpiCornerLeftNotSelectedImage;else if(tpiCurrentOnHoverTab==tpiLastSliceNumber)$('#tpisanbsosrightcorner')[0].src=tpiCornerRightNotSelectedImage;tpiCurrentOnHoverTab=0;document.getElementById('tpianbmainstrip').style.zoom='0';}
window.updateANBButtons=function(direction){if($('#tpianbsliceofselection-1')[0])
tpiStripLeftMostElement=-($('#tpianbsliceofselection-1')[0].offsetLeft+$('#tpianbsliceofselection-1').width());if($('#tpianbstripend')[0]&&$('#tpianbcentercontent')[0])
tpiStripRightMostElement=$('#tpianbcentercontent').width()-$('#tpianbstripend')[0].offsetLeft;var currentLeft=$('#tpianbstripcontainer')[0].offsetLeft;var newLeft;tpifwForceClose();if(direction=='left'){if(currentLeft>=tpiStripLeftMostElement){clearInterval(tpiStripSlideTimer);tpiIlhwDULock=0;}else{newLeft=currentLeft+tpiStep;$('#tpianbstripcontainer')[0].style.left=newLeft+"px";var tpiCurrentSelectedTabLeft=-$('#tpianbsliceofselection-'+tpiCurrentSelectedTab)[0].offsetLeft;if(newLeft>tpiCurrentSelectedTabLeft){if(tpiCurrentSelectedTab>1){var newSelectedTab=tpiCurrentSelectedTab-1;changeTabs(newSelectedTab);}}}}else if(direction=='right'){if(currentLeft<=tpiStripRightMostElement){clearInterval(tpiStripSlideTimer);tpiIlhwDULock=0;}else{newLeft=currentLeft-tpiStep;$('#tpianbstripcontainer')[0].style.left=newLeft+"px";if(tpiCurrentSelectedTab<tpiLastSliceNumber){var nextSelectedTab=tpiCurrentSelectedTab+1;var nextSelectedTabLeft=-$('#tpianbsliceofselection-'+nextSelectedTab)[0].offsetLeft;if(newLeft<nextSelectedTabLeft){var newSelectedTab=tpiCurrentSelectedTab+1;changeTabs(newSelectedTab);}}}}else if(direction=='both'){var tpiCurrentSelectedTabLeft=-$('#tpianbsliceofselection-'+tpiCurrentSelectedTab)[0].offsetLeft;if(tpiCurrentSelectedTab<tpiLastSliceNumber){var nextSelectedTab=tpiCurrentSelectedTab+1;var nextSelectedTabLeft=-$('#tpianbsliceofselection-'+nextSelectedTab)[0].offsetLeft;if($('#tpianbstripcontainer')[0].offsetLeft<nextSelectedTabLeft){var newSelectedTab=tpiCurrentSelectedTab+1;changeTabs(newSelectedTab);}}else if($('#tpianbstripcontainer')[0].offsetLeft>tpiCurrentSelectedTabLeft){if(tpiCurrentSelectedTab>1){var newSelectedTab=tpiCurrentSelectedTab-1;changeTabs(newSelectedTab);}}}
var parent=$('#tpianbleftcontent')[0];if($('#tpianbstripcontainer')[0].offsetLeft>=tpiStripLeftMostElement){if(tpiButtonLeftCurrentDisplayed!='dimmed'&&tpiButtonLeftDimButtonImage.complete){parent.innerHTML='<img src="'+tpiButtonLeftDimButtonImage.src+'">';tpiButtonLeftCurrentDisplayed='dimmed';}}else if(direction=='left'){if(tpiButtonLeftCurrentDisplayed!='pressed'&&tpiButtonLeftPressedButtonImage.complete){parent.innerHTML='<img src="'+tpiButtonLeftPressedButtonImage.src+'">';tpiButtonLeftCurrentDisplayed='pressed';}}else{if(tpiButtonLeftCurrentDisplayed!='default'&&tpiButtonLeftButton.complete){parent.innerHTML='<img src="'+tpiButtonLeftButton.src+'">';tpiButtonLeftCurrentDisplayed='default';}}
parent=$('#tpianbrightcontent')[0];if($('#tpianbstripcontainer')[0].offsetLeft<=tpiStripRightMostElement){if(tpiButtonRightCurrentDisplayed!='dimmed'&&tpiButtonRightDimButtonImage.complete){parent.innerHTML='<img src="'+tpiButtonRightDimButtonImage.src+'">';tpiButtonRightCurrentDisplayed='dimmed';}}else if(direction=='right'){if(tpiButtonRightCurrentDisplayed!='pressed'&&tpiButtonRightPressedButtonImage.complete){parent.innerHTML='<img src="'+tpiButtonRightPressedButtonImage.src+'">';tpiButtonRightCurrentDisplayed='pressed';}}else{if(tpiButtonRightCurrentDisplayed!='default'&&tpiButtonRightButton.complete){parent.innerHTML='<img src="'+tpiButtonRightButton.src+'">';tpiButtonRightCurrentDisplayed='default';}}}
window.moveAnimateStrip=function(direction,distance){document.getElementById('tpianbmainstrip').style.zoom='0';tpicX=$('#tpianbstripcontainer')[0].offsetLeft;if(direction=='left')tpifX=tpicX-distance;else if(direction=='right')tpifX=tpicX+distance;tpidX=Math.abs(tpifX-tpicX);if(tpicX<tpifX)tpiStepX=tpiAnimateSpeed;else if(tpicX>tpifX)tpiStepX=-tpiAnimateSpeed;tpiIlhwDULock=1;tpifwForceClose();animateStrip('both');document.getElementById('tpianbmainstrip').style.zoom='1';}
window.initAnimateStrip=function(destObjectID){var object=$('#'+destObjectID)[0];tpifX=-(object.offsetLeft+$('#'+destObjectID).width());tpicX=$('#tpianbstripcontainer')[0].offsetLeft;tpidX=Math.abs(tpifX-tpicX);if(tpicX<tpifX)tpiStepX=tpiAnimateSpeed;else if(tpicX>tpifX)tpiStepX=-tpiAnimateSpeed;tpiIlhwDULock=1;tpifwForceClose();animateStrip('');}
window.animateStrip=function(direction){document.getElementById('tpianbmainstrip').style.zoom='1';if(tpidX>tpiAnimateSpeed){$('#tpianbstripcontainer')[0].style.left=Math.round(tpicX)+'px';tpicX=tpicX+tpiStepX;tpidX=tpidX-Math.abs(tpiStepX);setTimeout('animateStrip('+direction+')',0);}else{$('#tpianbstripcontainer')[0].style.left=tpifX+'px';updateANBButtons(direction);tpiIlhwDULock=0;}
document.getElementById('tpianbmainstrip').style.zoom='0';return;}
window.changeTabs=function(newSelectedTab){if(tpiCurrentSelectedTab){var oldTabObject=$('#tpianbsostab-'+tpiCurrentSelectedTab)[0];if(oldTabObject.className=='tpianbsosmiddletabactive'||oldTabObject.className=='tpianbsosmiddletabhover'||oldTabObject.className=='tpianbsosmiddletab')oldTabObject.className='tpianbsosmiddletab';else oldTabObject.className='tpianbsostab';if(tpiCurrentSelectedTab==1)$('#tpisanbsosleftcorner')[0].src=tpiCornerLeftNotSelectedImage;else if(tpiCurrentSelectedTab==tpiLastSliceNumber)$('#tpisanbsosrightcorner')[0].src=tpiCornerRightNotSelectedImage;if(tpiCurrentSelectedTab>1)
$('#tpianbsostabdivider-'+tpiCurrentSelectedTab)[0].className='tpianbsostabdivider';var tpiCurrentSelectedTabNext=tpiCurrentSelectedTab+1;if(tpiCurrentSelectedTab<tpiLastSliceNumber)
$('#tpianbsostabdivider-'+tpiCurrentSelectedTabNext)[0].className='tpianbsostabdivider';}
var newTabObject=$('#tpianbsostab-'+newSelectedTab)[0];if(newTabObject.className=='tpianbsosmiddletabhover'||newTabObject.className=='tpianbsosmiddletab'||newTabObject.className=='tpianbsosmiddletabactive')newTabObject.className='tpianbsosmiddletabactive';else newTabObject.className='tpianbsostabactive';tpiCurrentSelectedTab=newSelectedTab;if(tpiCurrentSelectedTab==1)$('#tpisanbsosleftcorner')[0].src=tpiCornerLeftSelectedImage;else if(tpiCurrentSelectedTab==tpiLastSliceNumber)$('#tpisanbsosrightcorner')[0].src=tpiCornerRightSelectedImage;if(tpiCurrentSelectedTab>1)$('#tpianbsostabdivider-'+tpiCurrentSelectedTab)[0].className='tpianbsosselectedtabdivider';var tpiCurrentSelectedTabNext=tpiCurrentSelectedTab+1;if(tpiCurrentSelectedTab<tpiLastSliceNumber)$('#tpianbsostabdivider-'+tpiCurrentSelectedTabNext)[0].className='tpianbsosselectedtabdivider';}
window.realignThumbnailStrip=function(){if($.browser.msie){if($('#tpianbrightcontent')[0]&&$('#tpianbcentercontent')[0]){var leftOffsetRight=$('#tpianbleftcontent').width()+$('#tpianbleftcontent')[0].offsetLeft;var gapLeftCenter=$('#tpianbcentercontent')[0].offsetLeft-leftOffsetRight;var centerOffsetRight=$('#tpianbcentercontent').width()+$('#tpianbcentercontent')[0].offsetLeft;var gapCenterRight=$('#tpianbrightcontent')[0].offsetLeft-centerOffsetRight;var marginValue=(gapLeftCenter+gapCenterRight)/2;$('#tpianbcentercontent')[0].style.marginLeft=marginValue;$('#tpianbcentercontent')[0].style.marginRight=marginValue;}
if($('#tpitabs')[0]&&$('#tpisanbsosrightcornercontainer')[0]){var tabsWidth=$('#tpitabs').width();var rightCornerOffSet=$('#tpisanbsosrightcornercontainer')[0].offsetLeft;$('#tpisanbsosrightcornercontainer')[0].style.right=(rightCornerOffSet+$('#tpisanbsosrightcornercontainer').width())-tabsWidth;}}}
window.tpiPreloadImages=function(){if(tpiImagesArray&&tpiImagesArray.length){for(tpiImageCounter=8;tpiImageCounter<tpiImagesArray.length;tpiImageCounter++){$('#tpianbimages-'+tpiImageCounter)[0].innerHTML=tpiImagesArray[tpiImageCounter];}}}
window.resizeWidget=function(){realignThumbnailStrip();updateANBButtons();}})(jQuery)
