// twister-dpf.js, 2010-01-19-1754 


// (FILE: /utility/twister-utilities.js) 


var twIsIE=false,twIsMozilla=false;var objID=1;TwisterXHRFactory=function(){var objID;var oXHR=false;if(!oXHR&&typeof XMLHttpRequest!='undefined'){try{twIsMozilla=true;oXHR=new XMLHttpRequest();}catch(e){}}else if(window.ActiveXObject){twIsIE=true;try{oXHR=new ActiveXObject("Msxml2.XMLHTTP");}catch(e){try{oXHR=new ActiveXObject("Microsoft.XMLHTTP");}catch(e){oXHR=false;}}}
return oXHR;}
TwisterAjaxFactory=function(server,sessionId,requestId){var server=server;var sessionId=sessionId;var requestId=requestId;this.getAjaxObject=function(){var ajaxObj=new TwisterXHRFactory();var oAjaxObj=new TwisterAjaxObject(ajaxObj,server,sessionId,requestId);oAjaxObj.objID=objID;objID++;return oAjaxObj;}}
TwisterAjaxObject=function(oXHR,server,sessionId,requestId){var oXHR=oXHR;var server=server;var sessionId=sessionId;var requestId=requestId;var asin='';var myURL='';var oLastArgs;var fnLastOnAbort;var inProcess=false;var rType='ajax';var rStart=null;var rCount=0;var self=this;var evalFn=function(){self.TwisterEvalResults();};this.getAsin=function(){return asin;}
this.setAsin=function(inAsin){asin=inAsin;}
this.setRequestType=function(r){rType=r;}
this.setURL=function(url){myURL=server+url+'/'+sessionId;}
this.request=function(oArgs,onAbort,noTimeOut){setTimeout(function(){self.asyncRequest(oArgs,onAbort);},0);rCount=rCount+1;}
this.asyncRequest=function(oArgs,onAbort){try{if(inProcess){oXHR.onreadystatechange=doNothing;oXHR.abort();if(onAbort){onAbort(oLastArgs);}
inProcess=false;if(shouldLogTwister()){var params={};params['reqAbort:'+rType+':'+rCount+':'+asin]=1;addClientLog(params);}
setTimeout(function(){self.request(oArgs,onAbort);},0);return;}
else if(twIsIE){oXHR.abort();inProcess=false;}
var thisUrl=myURL+'?'+'sid='+sessionId+'&rid='+requestId+'&';for(var i in oArgs){thisUrl+=i+'='+oArgs[i]+'&';}
if(shouldLogTwister()){rStart=new Date();}
oXHR.open('GET',thisUrl,true);oXHR.onreadystatechange=function(){self.TwisterEvalResults();};oXHR.send(null);oLastArgs=oArgs;fnLastOnAbort=onAbort;inProcess=true;}catch(e){inProcess=false;if(onAbort){onAbort(oArgs);}}}
this.TwisterEvalResults=function(){if(oXHR.readyState==4){inProcess=false;try{if(oXHR.status==200){var params={};if(shouldLogTwister()){params['ajaxTime:'+rType+':'+rCount+':'+asin]=new Date().getTime()-rStart.getTime();rStart=new Date();}
eval(oXHR.responseText);if(shouldLogTwister()){params['evalTime:'+rType+':'+rCount+':'+asin]=new Date().getTime()-rStart.getTime();addClientLog(params);}}else{}}catch(e){if(fnLastOnAbort){fnLastOnAbort(oLastArgs);}}}}
this.getObjInfo=function(){return'TwisterAjaxObject:('+oXHR.objID+')'+myURL+':';}}
function doNothing()
{}
function formatString(templateString,argumentsObject)
{var outStr=templateString;for(var i in argumentsObject)
{outStr=outStr.replace(i,argumentsObject[i]);}
return outStr;}
function executeScripts(divId)
{var div=document.getElementById(divId);var x=div.getElementsByTagName("script");for(var i=0;i<x.length;i++)
{eval(x[i].text);}}
function dumpObj(obj){var str='[';for(var att in obj){str+=att+'='+obj[att]+', ';}
str+=']';return str;}
function unfadeDiv(divObj)
{fadeDiv(divObj,100);}
function fadeDiv(divObj,fadePercent)
{if(fadePercent==null)
fadePercent=50;divObj.style.opacity=fadePercent/100;divObj.style.filter="alpha(opacity='"+fadePercent+"')";}
function setLoadingBar2Line(div)
{if(div!=null&&window.loadingBarHTML2Line)
{if(div.getAttribute('loadingBarSet')==1)
{return;}
else
div.setAttribute('loadingBarSet',1);div.innerHTML=loadingBarHTML2Line;}}
function getFeatureHeaderRow(featureDiv)
{var headerRow;var candidateRows=new Array("h2","h1","b");if(featureDiv.id=='fast-track_feature_div'||featureDiv.id=='platform-information-and-esrb-rating_feature_div'||featureDiv.id=='view-wia-rich-media_feature_div'||featureDiv.id=='fma-seller-messages_feature_div'){return headerRow;}
for(var i in candidateRows){var candidates=featureDiv.getElementsByTagName(candidateRows[i]);for(var j in candidates){if(candidates[j]&&candidates[j].tagName){headerRow=candidates[j];return headerRow;}}}
return headerRow;}
function setFeatureLoadingBar(div,theContentDiv,pickContentDiv)
{if(div==null)return;if(div.getAttribute('loadingBarSet')==1)
{return;}
else
div.setAttribute('loadingBarSet',1);var headerRow,contentDiv=theContentDiv,headerDiv;var currObj;headerRow=getFeatureHeaderRow(div);if(headerRow==null){if(div.id&&div.id=='platform-information-and-esrb-rating_feature_div'){fadeDiv(div,25);}
return;}
var divsColl=div.getElementsByTagName('div');for(var i in divsColl)
{if(contentDiv!=null&&headerDiv!=null)
break;currObj=divsColl[i];if(contentDiv==null&&currObj!=null&&currObj.className=='content')
{contentDiv=currObj;}
else if(headerDiv==null&&currObj!=null&&currObj.className=='disclaim')
{headerDiv=currObj;}}
var nextSib=headerRow.nextSibling;while(pickContentDiv==true)
{if(nextSib.nodeName=='DIV')
{contentDiv=nextSib;break;}
nextSib=nextSib.nextSibling;}
var headerHTML=headerRow.innerHTML;var newDiv=document.createElement('DIV');headerRow.innerHTML='';if(div.id&&div.id=="ob-replacement_feature_div"){var tempHTML='<b>'+headerHTML+'</b>';if(typeof(DetailPage)!='undefined'||(typeof goTwisterReplacement!='undefined'&&goTwisterReplacement.canShowLoadingBar())){tempHTML+=featureLoadingBarHTML;}
newDiv.innerHTML=tempHTML;}else{newDiv.innerHTML='<b class="h1">'+headerHTML+'</b>'+featureLoadingBarHTML;}
headerRow.parentNode.insertBefore(newDiv,headerRow);if(contentDiv!=null)
{contentDiv.style.width='100%';fadeDiv(contentDiv,25);}
if(headerDiv!=null)
{headerDiv.style.width='100%';fadeDiv(headerDiv,25);}}
var logTwister=false;var twisterLogs={}
var productGroup='unknown';var hoverCount=0;var asinCount=0;var prevOnUnload;function flushClientLog(event){if(window.clientLogger){twisterLogs['hoverCount']=hoverCount;twisterLogs['asinCount']=asinCount;clientLogger.sendCLOGEntry("twister","detail_ajax",twisterLogs);}
if(prevOnUnload){prevOnUnload(event);}}
function enableTwisterLogging(prodGroup){try{if(prodGroup){productGroup=prodGroup;}
logTwister=true;twisterLogs['prodGroup']=productGroup;prevOnUnload=window.onbeforeunload;window.onbeforeunload=flushClientLog;}catch(e){}}
function shouldLogTwister(){return logTwister;}
var logCount=0;function addClientLog(params){if(!logTwister){return;}
for(var l in params){twisterLogs[l]=params[l];}
logCount=logCount+1;if(logCount>=10){if(window.clientLogger){clientLogger.sendCLOGEntry("twister","detail_ajax",twisterLogs);}
twisterLogs={};twisterLogs['prodGroup']=productGroup;logCount=0;}}
function incrementHoverCount(){hoverCount=hoverCount+1;}
function setTotalASINCount(nCount){asinCount=nCount;}
// (FILE: /detail-page-features/twister-manager/twister-manager.js) 


function TwisterManager(oEventManager,oTwisterVariations,oTwisterPriceBlock,oTwisterAvailability,oTwisterAltImages,oTwisterBuyBox,oTwisterPrime,oTwisterManagerArgs,oOnlyUnqualifiedOffers,oTwisterReplacementTeaser,oTwisterReplacement){var oEventManager=oEventManager;var oTwisterVariations=oTwisterVariations;var oTwisterPriceBlock=oTwisterPriceBlock;var oTwisterAvailability=oTwisterAvailability;var oTwisterAltImages=oTwisterAltImages;var oTwisterBuyBox=oTwisterBuyBox;var oTwisterPrime=oTwisterPrime;var oTwisterManagerArgs=oTwisterManagerArgs;var oOnlyUnqualifiedOffers=oOnlyUnqualifiedOffers;var oTwisterReplacementTeaser=oTwisterReplacementTeaser;var oTwisterReplacement=oTwisterReplacement;if(oTwisterManagerArgs['oTMAjaxObj']){oTwisterManagerArgs['oTMAjaxObj'].setURL('/gp/twister/dynamic-update/offers-item.html');}
if(oTwisterManagerArgs['oDUAjaxObj']){oTwisterManagerArgs['oDUAjaxObj'].setURL('/gp/product/twister-update/'+oTwisterManagerArgs['oDUAjaxObj'].getAsin());}
var oTMAjaxObj=oTwisterManagerArgs['oTMAjaxObj'];var oDUAjaxObj=oTwisterManagerArgs['oDUAjaxObj'];var sTwisterManagerName=oTwisterManagerArgs['sTwisterManagerName'];var oOfferData={};var oOfferDataState={};var oOfferDataTries={};var REQUEST_PENDING=1;var REQUEST_SENT=2;var REQUEST_RECEIVED=3;var NOT_BUYABLE=4;var oAjaxQueue=new Array();var oAjaxTimeout=null;var sLastPreviewASIN=null;var sLastSelectASIN=null;var oLastSelectData={};var sDynFeatureASIN=null;var sCurrentSelectedASIN=null;if(oTwisterManagerArgs['sChildASIN']){sDynFeatureASIN=oTwisterManagerArgs['sChildASIN'];}
var oDynFeatureCache={};var oDynFeatureDiv={};var sParentASIN=oTwisterManagerArgs['sParentASIN'];var sTwisterView=oTwisterManagerArgs['sourceView'];var sMerchantID=oTwisterManagerArgs['merchantID'];var sDropdownSelection=oTwisterManagerArgs['dropdown-selection'];var sStoreID=null;if(oTwisterManagerArgs['storeID']){sStoreID=oTwisterManagerArgs['storeID'];}
var oFeatureAjaxUpdateFns=new Object();var oFeatureCachedUpdateFns=new Object();var parentCallbacksMap=new Object();var cacheReselectCallbackMap=new Object();var AJAX_UPDATE=1;var CACHE_UPDATE=2;var NO_FUNC=-1;var inOnLoad=false;var oPrimeDiv=-1;var oMBCDiv=-1;var oFeatureDivsWithLoadingBar=new Object();if(oTwisterVariations){var aEvents=[gsTwisterVariationsEventName_PreviewVariations,gsTwisterVariationsEventName_SelectVariations,];goEventManager.subscribe(this,aEvents);}
this.getOfferData=function(){return oOfferData;}
this.onEvent=function(oSrcWidget,sEvent,oData){var oTwisterVariationData=oData;var aAsinList=oTwisterVariationData.aAsinList;var hSelectedVariations=oTwisterVariationData.oSelectedVariations;var numOfVariations=oTwisterVariationData.nVariationsSelected;var totalNumOfVariations=oTwisterVariationData.nVariationsTotal;var oDisplayableNames=oTwisterVariationData.oVariationTypeDisplayLabels;var sBuyableASIN=oTwisterVariationData.sBuyableASIN;var updateFeatures=true;if(oData.bUpdateFeatures)
updateFeatures=oData.bUpdateFeatures.value;if(sEvent==gsTwisterVariationsEventName_PreviewVariations)
{if(sBuyableASIN&&!oOfferData[sBuyableASIN]){sLastPreviewASIN=sBuyableASIN;}
if(oTwisterPriceBlock){if(sBuyableASIN&&oOfferData[sBuyableASIN]){oTwisterPriceBlock.update(sBuyableASIN,oOfferData[sBuyableASIN],oOnlyUnqualifiedOffers);}else{oTwisterPriceBlock.update(null,null,oOnlyUnqualifiedOffers);}}
if(oTwisterAvailability){if(sBuyableASIN&&oOfferData[sBuyableASIN]){oTwisterAvailability.update(sBuyableASIN,oOfferData[sBuyableASIN],oOnlyUnqualifiedOffers);}else{oTwisterAvailability.update(null,null,oOnlyUnqualifiedOffers);}
var anyVariationSelected=(numOfVariations!=null&&numOfVariations>0);oTwisterAvailability.onPreviewEvent(sBuyableASIN,oOfferData[sBuyableASIN],anyVariationSelected);}
oTwisterAvailability.handlePlatformInformationAndESRBRating(sBuyableASIN,anyVariationSelected);if(oTwisterReplacementTeaser&&sBuyableASIN){oTwisterReplacementTeaser.onPreviewEvent(sBuyableASIN);}
if(oTwisterReplacement&&sBuyableASIN){oTwisterReplacement.onPreviewEvent(sBuyableASIN);}
if(oTwisterBuyBox){oTwisterBuyBox.updateSubscribeInfo(oOfferData[sBuyableASIN]);}
if(oTwisterAltImages){oTwisterAltImages.previewVariationValues(oTwisterVariationData);}
if(oTwisterVariations){oTwisterVariations.updateLabels(oOfferData[sBuyableASIN]);}
if(shouldLogTwister()){incrementHoverCount();}}
else if(sEvent==gsTwisterVariationsEventName_SelectVariations)
{if(updateFeatures&&sBuyableASIN==null){setTimeout(sTwisterManagerName+".triggerParentCallbacks()",0);}
if(oMBCDiv==-1){oMBCDiv=document.getElementById('more-buying-choices_feature_div');}
if(oPrimeDiv==-1){oPrimeDiv=document.getElementById('prime_feature_div');}
if(numOfVariations>=(totalNumOfVariations-1)){this.preloadOfferData(oTwisterVariationData);}
if(sBuyableASIN&&!oOfferData[sBuyableASIN]){sLastSelectASIN=sBuyableASIN;oLastSelectData.nVariationsSelected=oTwisterVariationData.nVariationsSelected;oLastSelectData.nVariationsTotal=oTwisterVariationData.nVariationsTotal;oLastSelectData.oSelectedVariations=oTwisterVariationData.oSelectedVariations;oLastSelectData.oDisplayableNames=oTwisterVariationData.oVariationTypeDisplayLabels;}else{sLastSelectASIN=null;oLastSelectData={};}
if(!updateFeatures){if(!sBuyableASIN&&oTwisterBuyBox){oTwisterBuyBox.update(null,null,numOfVariations,totalNumOfVariations,hSelectedVariations,oDisplayableNames,oOnlyUnqualifiedOffers);}
return;}
if(oTwisterPriceBlock){if(sBuyableASIN&&oOfferData[sBuyableASIN]){oTwisterPriceBlock.update(sBuyableASIN,oOfferData[sBuyableASIN],oOnlyUnqualifiedOffers);}else{oTwisterPriceBlock.update(null,null,oOnlyUnqualifiedOffers);}}
if(oTwisterAvailability){if(sBuyableASIN&&oOfferData[sBuyableASIN]){oTwisterAvailability.update(sBuyableASIN,oOfferData[sBuyableASIN],oOnlyUnqualifiedOffers);}else{oTwisterAvailability.update(null,null,oOnlyUnqualifiedOffers);}
oTwisterAvailability.onSelectEvent(sBuyableASIN,oOfferData[sBuyableASIN]);}
if(oTwisterReplacementTeaser&&sBuyableASIN){oTwisterReplacementTeaser.onSelectEvent(sBuyableASIN);}
if(oTwisterReplacement&&sBuyableASIN){oTwisterReplacement.onSelectEvent(sBuyableASIN);}
if(oTwisterVariations){if(sBuyableASIN&&oOfferData[sBuyableASIN]){oTwisterVariations.updateSizeChart(oOfferData[sBuyableASIN]);oTwisterVariations.updateLabels(oOfferData[sBuyableASIN]);}else{oTwisterVariations.clearSizeChart();}}
if(oTwisterBuyBox){if(sBuyableASIN){oTwisterBuyBox.update(sBuyableASIN,oOfferData[sBuyableASIN],numOfVariations,totalNumOfVariations,hSelectedVariations,oDisplayableNames,oOnlyUnqualifiedOffers);}else{oTwisterBuyBox.update(null,null,numOfVariations,totalNumOfVariations,hSelectedVariations,oDisplayableNames,oOnlyUnqualifiedOffers);}}
if(!sBuyableASIN){if(oMBCDiv){oMBCDiv.innerHTML='';}
if(oPrimeDiv){oPrimeDiv.innerHTML=oTwisterPrime.getParentContent();}}
if(oTwisterAltImages){oTwisterAltImages.selectVariationValues(oTwisterVariationData);}
sCurrentSelectedASIN=sBuyableASIN;if(sBuyableASIN){if(sBuyableASIN!=sDynFeatureASIN){if(!inOnLoad){sDynFeatureASIN=sBuyableASIN;}
if(!inOnLoad){if(oDynFeatureCache[sDynFeatureASIN]){if(oDynFeatureCache[sDynFeatureASIN]['status']=='complete'){this.showChildContent(sDynFeatureASIN,CACHE_UPDATE);}}else{var oArgs=new Object();oArgs['childASIN']=sDynFeatureASIN;oArgs['twisterView']=sTwisterView;oArgs['PowerBar']=0;if(sMerchantID&&sMerchantID!=''){oArgs['m']=sMerchantID;}
if(sStoreID&&sStoreID!=''){oArgs['s']=sStoreID;}
if(sDropdownSelection&&sDropdownSelection!=''){oArgs['dropdown-selection']=sDropdownSelection;}
oDynFeatureCache[sDynFeatureASIN]=new Object();oDynFeatureCache[sDynFeatureASIN]['status']='waiting';oDUAjaxObj.request(oArgs,this.onDUAbort,sDynFeatureASIN);this.setLoadingIndicators();}}}else{setTimeout(sTwisterManagerName+".triggerCacheReselectCallback('"+sBuyableASIN+"')",0);if(oDynFeatureCache[sDynFeatureASIN]){if(oDynFeatureCache[sDynFeatureASIN]['status']=='complete'){if(oMBCDiv){oMBCDiv.innerHTML=oDynFeatureCache[sDynFeatureASIN]['more-buying-choices'];}
if(oPrimeDiv){oPrimeDiv.innerHTML=oDynFeatureCache[sDynFeatureASIN]['prime'];}}}}}
if(shouldLogTwister()){incrementHoverCount();}}}
this.triggerParentCallbacks=function(){for(var i in oFeatureDivsWithLoadingBar){var feature_name=(i.split("_feature_div"))[0];var callbackfunc;if(!(callbackfunc=parentCallbacksMap[feature_name])){callbackfunc=window['onParentUpdate_'+feature_name.replace(/-/g,"_")];parentCallbacksMap[feature_name]=callbackfunc?callbackfunc:NO_FUNC;}
if(callbackfunc!=null&&callbackfunc!=NO_FUNC){callbackfunc();}}}
this.triggerCacheReselectCallback=function(asin){for(var i in oFeatureDivsWithLoadingBar){var feature_name=(i.split("_feature_div"))[0];var callbackfunc;var callbackfuncName;if(!(callbackfunc=cacheReselectCallbackMap[feature_name])){callbackfuncName='onCacheUpdateReselect_'+feature_name.replace(/-/g,"_");callbackfunc=window[callbackfuncName];cacheReselectCallbackMap[feature_name]=callbackfunc?callbackfunc:NO_FUNC;}
if(callbackfunc!=null&&callbackfunc!=NO_FUNC){callbackfunc(asin);}}}
this.onDUAbort=function(oArgs){var sChildASIN=oArgs['childASIN'];if(!sChildASIN)return;var childAsinCache=oDynFeatureCache[sChildASIN];if(oDynFeatureCache[sChildASIN]){if(oDynFeatureCache[sChildASIN]['status']!='complete'){oDynFeatureCache[sChildASIN]=null;}}}
this.setLoadingIndicators=function()
{setLoadingBar2Line(document.getElementById('more-buying-choice-content-div'));for(featId in oFeatureDivsWithLoadingBar){var featDiv=oFeatureDivsWithLoadingBar[featId];if(featId.indexOf('more-buying-choices')>-1||featId.indexOf('ob-replacement-teaser')>-1||featId.indexOf('holiday-availability-messaging')>-1)
continue;else if(featId.indexOf('accessories-and-compatible-products')>-1)
setFeatureLoadingBar(featDiv,null,true);else
setFeatureLoadingBar(featDiv);}}
this.initFeatureDivsWithLoadingBar=function()
{var divColl=document.getElementsByTagName('div');var aDiv,divId;for(var i in divColl)
{aDiv=divColl[i];divId=aDiv.id;if((divId!=null)&&divId.indexOf('_feature_div')>-1)
{oFeatureDivsWithLoadingBar[divId]=aDiv;}}}
this.setFeatureHTML=function(featureDiv,featHTML)
{if(twIsIE)
{var newDiv=document.createElement('div');newDiv.innerHTML=featHTML;featureDiv.innerHTML="";featureDiv.appendChild(newDiv);}
else
featureDiv.innerHTML=featHTML;if(featureDiv.id=='more-buying-choices_feature_div'){if(shovelerMain&&typeof shovelerMain=='function'){shovelerMain(1);}}}
this.onOfferDataUpdate=function(){if(sLastSelectASIN&&oOfferData[sLastSelectASIN]){if(oTwisterPriceBlock){oTwisterPriceBlock.update(sLastSelectASIN,oOfferData[sLastSelectASIN],oOnlyUnqualifiedOffers);}
if(oTwisterAvailability){oTwisterAvailability.update(sLastSelectASIN,oOfferData[sLastSelectASIN],oOnlyUnqualifiedOffers);}
if(oTwisterVariations){oTwisterVariations.updateSizeChart(oOfferData[sLastSelectASIN]);oTwisterVariations.updateLabels(oOfferData[sLastSelectASIN]);}
if(oTwisterBuyBox){oTwisterBuyBox.update(sLastSelectASIN,oOfferData[sLastSelectASIN],oLastSelectData.nVariationsSelected,oLastSelectData.nVariationsTotal,oLastSelectData.oSelectedVariations,oLastSelectData.oDisplayableNames,oOnlyUnqualifiedOffers);}
sLastSelectASIN=null;oLastSelectData={};}
if(sLastPreviewASIN&&oOfferData[sLastPreviewASIN]){if(oTwisterPriceBlock){oTwisterPriceBlock.update(sLastPreviewASIN,oOfferData[sLastPreviewASIN],oOnlyUnqualifiedOffers);}
if(oTwisterAvailability){oTwisterAvailability.update(sLastPreviewASIN,oOfferData[sLastPreviewASIN],oOnlyUnqualifiedOffers);}
sLastPreviewASIN=null;}}
this.onLoad=function(){inOnLoad=true;var numSelected=0;if(oTwisterVariations)
numSelected=oTwisterVariations.getNumberOfSelectedVariations();if(numSelected==0&&oTwisterBuyBox){oTwisterBuyBox.onLoad();}
if(oTwisterVariations){oTwisterVariations.onLoad();}
var func="goTwisterManager.initFeatureDivsWithLoadingBar()";setTimeout(func,0);inOnLoad=false;var selection=goTwisterVariations.getInitialSelection();if(selection&&selection['type']=='swatch'){goTwisterVariations.onClickSwatch(selection['key'],selection['value']);}else if(selection&&selection['type']=='dropdown'){goTwisterVariations.onChangeDropdown(selection['key']);}
if(shouldLogTwister()&&oTwisterVariations){setTotalASINCount(oTwisterVariations.getChildCount());}}
this.preloadOfferData=function(oTwisterVariationData){var aAsinList=oTwisterVariationData.aAsinList;var nCount=0;for(var i=0;i<aAsinList.length;i++){var sASIN=aAsinList[i];if(oOfferDataState[sASIN]==null){oOfferDataState[sASIN]=REQUEST_PENDING;nCount++;}}
this.processAjax();}
this.processAjax=function(){if(oAjaxTimeout!=null){return;}
var sRequestList='';var nCount=0;if(sLastSelectASIN){var nState=oOfferDataState[sLastSelectASIN];if((nState==null)||(nState==REQUEST_PENDING)){oOfferDataState[sLastSelectASIN]=REQUEST_SENT;sRequestList+=(sLastSelectASIN+',');nCount++;}}
for(var sASIN in oOfferDataState){if(oOfferDataState[sASIN]==REQUEST_PENDING){oOfferDataState[sASIN]=REQUEST_SENT;sRequestList+=(sASIN+',');nCount++;}
if(nCount==20){break;}}
if(nCount){var oArgs=new Object;if(sMerchantID&&sMerchantID!=''){oArgs['merchantID']=sMerchantID;}
if(sStoreID&&sStoreID!=''){oArgs['storeID']=sStoreID;}
if(sDropdownSelection&&sDropdownSelection!=''){oArgs['dropdown-selection']=sDropdownSelection;}
oArgs['asinList']=sRequestList;oArgs['productGroupID']=oTwisterManagerArgs['productGroupID'];oArgs['PowerBar']=0;oTMAjaxObj.request(oArgs);oAjaxTimeout=setTimeout(sTwisterManagerName+".offerDataTimeout();",10000);}}
this.resetPending=function(){for(var sASIN in oOfferDataState){if(oOfferDataState[sASIN]!=REQUEST_RECEIVED&&oOfferDataState[sASIN]==REQUEST_SENT){oOfferDataState[sASIN]=REQUEST_PENDING;if(oOfferDataTries[sASIN]){oOfferDataTries[sASIN]+=1;if(oOfferDataTries[sASIN]==4){oOfferDataState[sASIN]=NOT_BUYABLE;}}else{oOfferDataTries[sASIN]=1;}}}}
this.setOfferingData=function(sASIN,oOffering){if(oOffering){oOfferData[sASIN]=oOffering;oOfferDataState[sASIN]=REQUEST_RECEIVED;}}
this.offerDataReceived=function(){clearTimeout(oAjaxTimeout);oAjaxTimeout=null;this.resetPending();setTimeout(sTwisterManagerName+".processAjax();",0);setTimeout(sTwisterManagerName+".onOfferDataUpdate();",0);}
this.offerDataTimeout=function(){clearTimeout(oAjaxTimeout);oAjaxTimeout=null;this.resetPending();this.processAjax();}
this.setDeferredFeatureContent=function(sChildASIN,sFeatureName,sContent){var featureDiv=oDynFeatureDiv[sFeatureName];if(!featureDiv){featureDiv=document.getElementById(sFeatureName+'_feature_div');if(featureDiv){oDynFeatureDiv[sFeatureName]=featureDiv;}}
if(!oDynFeatureCache[sChildASIN]){oDynFeatureCache[sChildASIN]=new Object();}
oDynFeatureCache[sChildASIN][sFeatureName]=sContent;var func="goTwisterManager.renderContent('"+sChildASIN+"','"+sFeatureName+"')";setTimeout(func,0);oDynFeatureCache[sChildASIN]['status']='complete';}
this.renderContent=function(sChildASIN,sFeatureName){if(!sCurrentSelectedASIN){if(sFeatureName=='prime'||sFeatureName=='more-buying-choices'||sFeatureName=='fast-track')
return;}else if(sCurrentSelectedASIN!=sChildASIN){return;}
var featureDiv=oDynFeatureDiv[sFeatureName];try{if(featureDiv){this.setFeatureHTML(featureDiv,oDynFeatureCache[sChildASIN][sFeatureName]);featureDiv.setAttribute('loadingBarSet',0);}
callbackFunc=oFeatureAjaxUpdateFns[sFeatureName];if(callbackFunc==null){callbackFunc=window['onAjaxUpdate_'+sFeatureName.replace(/-/g,"_")];if(callbackFunc==null)
callbackFunc=NO_FUNC;else
callbackFunc(sChildASIN);oFeatureAjaxUpdateFns[sFeatureName]=callbackFunc;}else if(callbackFunc!=NO_FUNC){callbackFunc(sChildASIN);}}catch(e){}}
this.callAjaxUpdate=function(sFeatureName,sChildASIN){var callbackFunc=oFeatureAjaxUpdateFns[sFeatureName];if(callbackFunc==null){callbackFunc=window['onAjaxUpdate_'+sFeatureName.replace(/-/g,"_")];if(callbackFunc==null)
callbackFunc=NO_FUNC;else
callbackFunc(sChildASIN);oFeatureAjaxUpdateFns[sFeatureName]=callbackFunc;}else if(callbackFunc!=NO_FUNC){callbackFunc(sChildASIN);}}
this.callCacheUpdate=function(fName,sChildASIN){var callbackFunc=oFeatureCachedUpdateFns[fName];if(callbackFunc==null)
{callbackFunc=window['onCacheUpdate_'+fName.replace(/-/g,"_")];if(callbackFunc==null)
callbackFunc=NO_FUNC;else
callbackFunc(sChildASIN);}
else if(callbackFunc!=NO_FUNC)
callbackFunc(sChildASIN);oFeatureCachedUpdateFns[fName]=callbackFunc;}
this.callCacheReselectUpdate=function(feature_name,asin){var feature_name=(i.split("_feature_div"))[0];var callbackfunc;var callbackfuncName;if(!(callbackfunc=cacheReselectCallbackMap[feature_name])){callbackfuncName='onCacheUpdateReselect_'+feature_name.replace(/-/g,"_");callbackfunc=window[callbackfuncName];cacheReselectCallbackMap[feature_name]=callbackfunc?callbackfunc:NO_FUNC;}
if(callbackfunc!=null&&callbackfunc!=NO_FUNC){callbackfunc(asin);}}
this.showChildContent=function(sChildASIN,showStatus){if(!oDynFeatureCache[sChildASIN]||oDynFeatureCache[sChildASIN]['status']!='complete'){return;}
var sDate=new Date();for(fName in oDynFeatureDiv){try{if(oDynFeatureCache[sChildASIN][fName]!=undefined){var featureDiv=oDynFeatureDiv[fName];this.setFeatureHTML(featureDiv,oDynFeatureCache[sChildASIN][fName]);featureDiv.setAttribute('loadingBarSet',0);}
if(showStatus!=null)
{if(showStatus==AJAX_UPDATE)
{callbackFunc=oFeatureAjaxUpdateFns[fName];if(callbackFunc==null)
{callbackFunc=window['onAjaxUpdate_'+fName.replace(/-/g,"_")];if(callbackFunc==null)
callbackFunc=NO_FUNC;else
callbackFunc(sChildASIN);oFeatureAjaxUpdateFns[fName]=callbackFunc;}
else if(callbackFunc!=NO_FUNC){callbackFunc(sChildASIN);}}
else if(showStatus==CACHE_UPDATE)
{callbackFunc=oFeatureCachedUpdateFns[fName];if(callbackFunc==null)
{callbackFunc=window['onCacheUpdate_'+fName.replace(/-/g,"_")];if(callbackFunc==null)
callbackFunc=NO_FUNC;else
callbackFunc(sChildASIN);}
else if(callbackFunc!=NO_FUNC)
callbackFunc(sChildASIN);oFeatureCachedUpdateFns[fName]=callbackFunc;}}}catch(e){}}
if(shouldLogTwister()){var func="logCacheUpdateTime( '"+sChildASIN+"',"+(new Date().getTime()-sDate.getTime())+");";setTimeout(func,0);}}}
function logCacheUpdateTime(asin,time){var params={};params['cacheTime:'+asin]=time;addClientLog(params);}
function log(s)
{}
// (FILE: /detail-page-features/twister-variations/twister-variations-events.js) 


var gsTwisterVariationsEventName_PreviewVariations="TWISTER_VARIATIONS_PREVIEW_VARIATIONS";var gsTwisterVariationsEventName_SelectVariations="TWISTER_VARIATIONS_SELECT_VARIATIONS";var gsTwisterVariationsEventName_StartTimer="TWISTER_VARIATIONS_START_TIMER";var gsTwisterVariationsEventName_EndTimer="TWISTER_VARIATIONS_END_TIMER";
// (FILE: /detail-page-features/twister-variations/twister-swatches.js) 


function TwisterVariations(oEventManager,oVariationLabels,oVariationValues,oSelectedVariationValues,oChildItems,oSwatchVariationKeys,oDropdownVariationKeys,oVariationArgs){var oEventManager=oEventManager;var oVariationLabels=oVariationLabels;var oVariationValues=oVariationValues;var oChildItems=oChildItems;var oVariationArgs=oVariationArgs;var oSelectionItems=new Array();var nVariationsTotal=0;var oSelectedVarValues=oSelectedVariationValues;var oHoveredVarValues=new Array();var oSelectedDisplayVariationValues={};var oVariationDisplayTypes=new Array();var oSwatchElements=new Array();var oSwatchStateCache=new Array();var oDropdownLookupState=new Array();var additionalTextList={};var oParSelLook=new Object();var oVarKeys=new Array();var oNewLookup=new Object();var availColor="#006699";var notAvailColor="#BBBBBB";var oInitialSelection;this.getSelectedDisplayVariationValues=function(){return oSelectedDisplayVariationValues;}
this.setInitialSelection=function(type,key,value){oInitialSelection=new Object();oInitialSelection['type']=type;oInitialSelection['key']=key;oInitialSelection['value']=value;}
this.getInitialSelection=function(){return oInitialSelection;}
this.resetDropdowns=function(){for(sVarKey in oSelectedVarValues){if(oVariationDisplayTypes[sVarKey]!='d')
continue
var dropdown=document.getElementById(sVarKey);if(dropdown){var index=parseInt(oSelectedVarValues[sVarKey]);if(index>=0&&nVariationsTotal>1&&dropdown.options[index+1]){dropdown.options[index+1].selected=true;}else if(index>=0&&dropdown.options[index]){dropdown.options[index].selected=true;}}}}
this.populateTree=function(item,parentNode,ignoreKey,depth){if(oVarKeys[depth]==ignoreKey){if(parentNode['*']==null){parentNode['*']=new Array();}
if(depth==(oVarKeys.length-1)){parentNode['*'][item[ignoreKey]]=1;}else{this.populateTree(item,parentNode['*'],ignoreKey,depth+1);}
return;}
if(depth==(oVarKeys.length-1)){if(parentNode['-1']==null){parentNode['-1']=new Array();}
parentNode['-1'][item[ignoreKey]]=1;if(parentNode[item[oVarKeys[depth]]]==null){parentNode[item[oVarKeys[depth]]]=new Array();}
parentNode[item[oVarKeys[depth]]][item[ignoreKey]]=1;return;}
if(parentNode['-1']==null){parentNode['-1']=new Object();}
this.populateTree(item,parentNode['-1'],ignoreKey,depth+1);if(parentNode[item[oVarKeys[depth]]]==null){parentNode[item[oVarKeys[depth]]]=new Object();}
this.populateTree(item,parentNode[item[oVarKeys[depth]]],ignoreKey,depth+1);}
this.insertIntoLookupTree=function(item){for(var sKey in oSelectedVarValues){var dimSubSet=oParSelLook[sKey];if(dimSubSet==null){dimSubSet=new Object();oParSelLook[sKey]=dimSubSet;}
this.populateTree(item,dimSubSet,sKey,0);}}
this.initLookup=function(){for(var sKey in oSelectedVarValues){this.insertLookupKey('',oParSelLook[sKey],0);}}
this.insertLookupKey=function(sPartKey,parentNode,depth){if(depth==oVarKeys.length-1){for(var val in parentNode){oSelectionItems[sPartKey+val+' ']=parentNode[val];}
return;}
for(var val in parentNode){for(var val in parentNode){this.insertLookupKey(sPartKey+val+' ',parentNode[val],depth+1);}}}
{for(var sVarKey in oSelectedVarValues){oHoveredVarValues[sVarKey]=-1;oVarKeys[nVariationsTotal]=sVarKey;nVariationsTotal++;}
for(var i=0;i<oSwatchVariationKeys.length;i++){var sVarKey=oSwatchVariationKeys[i];oSwatchElements[sVarKey]=new Array();oSwatchStateCache[sVarKey]=new Array();for(var nVarValue in oVariationValues[sVarKey]){var sDivId=sVarKey+'_'+nVarValue;oSwatchElements[sVarKey][nVarValue]=document.getElementById(sDivId);oSwatchStateCache[sVarKey][nVarValue]=oSwatchElements[sVarKey][nVarValue].className;}}
for(var sVarKey in oSelectedVarValues){if(oSelectedVarValues[sVarKey]!=-1){oSelectedDisplayVariationValues[oVariationLabels[sVarKey]]=oVariationValues[sVarKey][oSelectedVarValues[sVarKey]];}else{oSelectedDisplayVariationValues[oVariationLabels[sVarKey]]=null;}}
var oVariationDisplayTypes=new Array();for(var i in oSwatchVariationKeys){var sVarKey=oSwatchVariationKeys[i];if(oSwatchStateCache[sVarKey][0]=='swatchPreSelect'){oVariationDisplayTypes[oSwatchVariationKeys[i]]='f';}else{oVariationDisplayTypes[oSwatchVariationKeys[i]]='s';}}
for(var i in oDropdownVariationKeys){oVariationDisplayTypes[oDropdownVariationKeys[i]]='d';}
for(var i=0;i<oChildItems.length;i++){var oChildItem=oChildItems[i];var sLookup;var oItems;sLookup='';for(var sVarKey in oSelectedVarValues){sLookup+=(oChildItem[sVarKey]+" ");}
oItems=oSelectionItems[sLookup];if(oItems==undefined){oItems=new Array();}
oItems[0]=oChildItem['ASIN'];oSelectionItems[sLookup]=oItems;if(oVarKeys.length>1){this.insertIntoLookupTree(oChildItem);}
for(var sIgnoreVarKey in oSelectedVarValues){sLookup='';for(var sVarKey in oSelectedVarValues){if(sVarKey!=sIgnoreVarKey){sLookup+=(oChildItem[sVarKey]+" ");}else{sLookup+="-1 ";}}
oItems=oSelectionItems[sLookup];if(oItems==undefined){oItems=new Array();}
oItems[oChildItem[sIgnoreVarKey]]=oChildItem['ASIN'];oSelectionItems[sLookup]=oItems;}}
if(oVarKeys.length>1){this.initLookup();}}
this.onLoad=function(){this.resetDropdowns();this.updateLabels();this.updateSwatches();this.prefetchOffers();if(typeof DetailPage!='undefined'){var dpState=DetailPage.StateController.getState();if(dpState['current_asin']!=null){DetailPage.Model.fetch(dpState['current_asin'],'offers',this.labelCallback());}}else{var nVariationsSelected=0;for(var sVarKey in oSelectedVarValues){if(oSelectedVarValues[sVarKey]!=-1){nVariationsSelected++;}}
if((nVariationsSelected>0)||(nVariationsTotal==1)){this.triggerEvent('loadSelectedChildData');}}}
this.labelCallback=function(){var obj=this;return function(asin,asinData){asinData['asin']=asin;obj.updateLabels(asinData);}}
this.getNumberOfSelectedVariations=function(){var nVariationsSelected=0;for(var sVarKey in oSelectedVarValues){if(oSelectedVarValues[sVarKey]!=-1){nVariationsSelected++;}}
return nVariationsSelected;}
this.updateSwatches=function(){for(var sVarKey in oSwatchElements){if(oVariationDisplayTypes[sVarKey]=='f'){continue;}
var sLookup='';var oItems=null;for(var sCurVarKey in oSelectedVarValues){if(sCurVarKey!=sVarKey){if(oHoveredVarValues[sCurVarKey]!=-1){sLookup+=(oHoveredVarValues[sCurVarKey]+" ");}else if(oSelectedVarValues[sCurVarKey]!=-1){sLookup+=(oSelectedVarValues[sCurVarKey]+" ");}else{sLookup+="-1 ";}}else{sLookup+="* ";}}
if(sLookup!=null){oItems=oSelectionItems[sLookup];}
for(var nVarValue in oSwatchElements[sVarKey]){var sSwatchState='swatchAvailable';if(oSelectedVarValues[sVarKey]==nVarValue){if(oItems&&(oItems[nVarValue]==undefined)){sSwatchState='swatchSelectGray';}else{sSwatchState='swatchSelect';}
sSwatchState='swatchSelect';}else if(oHoveredVarValues[sVarKey]==nVarValue){if(oItems&&(oItems[nVarValue]==undefined)){sSwatchState='swatchUnavailableHover';}else{sSwatchState='swatchHover';}}else{if(oItems&&(oItems[nVarValue]==undefined)){sSwatchState='swatchUnavailable';}else{sSwatchState='swatchAvailable';}}
if(sSwatchState!=oSwatchStateCache[sVarKey][nVarValue]){oSwatchElements[sVarKey][nVarValue].className=sSwatchState;oSwatchStateCache[sVarKey][nVarValue]=sSwatchState;}}}}
this.updateDropdowns=function(sChangedVarKey){for(var sVarKey in oSelectedVarValues){if((oVariationDisplayTypes[sVarKey]!='d')||(sVarKey==sChangedVarKey)){continue;}
var oDropdown=document.getElementById(sVarKey);var sLookup='';for(var sCurVarKey in oSelectedVarValues){if(sCurVarKey!=sVarKey){if(oSelectedVarValues[sCurVarKey]!=-1){sLookup+=(oSelectedVarValues[sCurVarKey]+" ");}else{sLookup+="-1 ";}}else{sLookup+="* ";}}
if((oDropdownLookupState[sVarKey]!=undefined)&&(oDropdownLookupState[sVarKey]==sLookup)){continue;}
oDropdownLookupState[sVarKey]=sLookup;var nVarValueOrig=oSelectedVarValues[sVarKey];var aOptions=new Array();var count=0;if(sLookup!=''){var oItems=oSelectionItems[sLookup];for(var val in goVariationValues[sVarKey]){var option={nVal:val,sVal:oVariationValues[sVarKey][val],sAvail:0};for(var nVarValue in oItems){if(goVariationValues[sVarKey][val]==oVariationValues[sVarKey][nVarValue]){option.sAvail=1;break;}}
aOptions[count]=option;count++;}}else{for(var nVarValue in oVariationValues[sVarKey]){aOptions[count]={nVal:nVarValue,sVal:oVariationValues[sVarKey][nVarValue]};count++;}}
function sortDropdown(a,b){return(b.sVal<a.sVal)-(a.sVal<b.sVal);}
oDropdown.options.length=0;if(goVariationStrings['defaultParent']){oDropdown.options[0]=new Option(goTwisterSwatchStrings['select'],-1,true);}
var index=0;for(var i=0;i<aOptions.length;i++){if(aOptions[i].nVal==nVarValueOrig){index=i+1;}
var child=new Option(aOptions[i].sVal,aOptions[i].nVal);child.title=aOptions[i].sVal;child.style.color=notAvailColor;child.isAvail=0;if(aOptions[i].sAvail){child.style.color=availColor;child.isAvail=1;}
oDropdown.options[i+1]=child;}
if(index>0){oDropdown.options[index].selected=true;}}}
this.updateLabels=function(oOfferData){if(typeof oOfferData=='string'){if(typeof DetailPage!='undefined'){DetailPage.Model.fetch(oOfferData,'offers',this.labelCallback());return;}else{oOfferData=undefined;}}
var headerDiv=document.getElementById("swatchHeader");var sHeader='';var bFirst=1;var last,notLast,f='';for(var sVarKey in oSelectedVarValues){if(oSelectedVarValues[sVarKey]==-1){bFirst=0;notLast=last;last=goVariationLabels[sVarKey];if(notLast){sHeader+=(f+notLast);f=', ';}}}
if(last&&notLast){sHeader+=(' '+goVariationStrings['and']+' '+last);}else if(last){sHeader+=last;}
sHeader=goVariationStrings['select'].replace(/###/,sHeader);if(bFirst){sHeader=goVariationStrings['toBuy'];}
if(headerDiv!=null)
headerDiv.innerHTML=sHeader;var extraStringHash={};if(oOfferData&&oOfferData['variation-additional-text']){var textStringList=oOfferData['variation-additional-text'].split("|");for(var i=0;i<textStringList.length;i=i+2){extraStringHash[textStringList[i]]=textStringList[i+1];}}
for(var sVarKey in oSelectedVarValues){var labelDiv=document.getElementById("selected_"+sVarKey);var sHTML='';if(nVariationsTotal>1){sHTML+='<b class=variationDefault>'+oVariationLabels[sVarKey]+': </b>';}else{sHTML+='<b class=variationDefault>'+oVariationLabels[sVarKey]+': </b>';}
if(!additionalTextList[sVarKey]){additionalTextList[sVarKey]=new Array();}
if(oOfferData&&!additionalTextList[sVarKey][oOfferData['asin']]&&extraStringHash[sVarKey]){additionalTextList[sVarKey][oOfferData['asin']]=' ('+extraStringHash[sVarKey]+')';}
if((oHoveredVarValues[sVarKey]!=-1)&&(oHoveredVarValues[sVarKey]!=oSelectedVarValues[sVarKey])){if(nVariationsTotal==1){sHTML+='<b class=variationDefault></b>';}
sHTML+='<b class=variationLabelHovered>'+oVariationValues[sVarKey][oHoveredVarValues[sVarKey]]+(oOfferData&&additionalTextList[sVarKey][oOfferData['asin']]&&extraStringHash[sVarKey]!=oVariationValues[sVarKey][oHoveredVarValues[sVarKey]]?additionalTextList[sVarKey][oOfferData['asin']]:'')+'</b>';}else if(oSelectedVarValues[sVarKey]!=-1){if(nVariationsTotal>1){if(oVariationValues[sVarKey].length==1){sHTML+=oVariationValues[sVarKey][oSelectedVarValues[sVarKey]]+(oOfferData&&additionalTextList[sVarKey][oOfferData['asin']]&&extraStringHash[sVarKey]!=oVariationValues[sVarKey][oSelectedVarValues[sVarKey]]?additionalTextList[sVarKey][oOfferData['asin']]:'');}else{sHTML+='<b class=variationLabel>'+oVariationValues[sVarKey][oSelectedVarValues[sVarKey]]+(oOfferData&&additionalTextList[sVarKey][oOfferData['asin']]&&extraStringHash[sVarKey]!=oVariationValues[sVarKey][oSelectedVarValues[sVarKey]]?additionalTextList[sVarKey][oOfferData['asin']]:'')+'</b>';}}else{sHTML+='<b class=variationDefault></b>';if(oVariationValues[sVarKey].length==1){sHTML+=oVariationValues[sVarKey][oSelectedVarValues[sVarKey]]+(oOfferData&&additionalTextList[sVarKey][oOfferData['asin']]&&extraStringHash[sVarKey]!=oVariationValues[sVarKey][oSelectedVarValues[sVarKey]]?additionalTextList[sVarKey][oOfferData['asin']]:'');}else{sHTML+='<b class=variationLabel>'+oVariationValues[sVarKey][oSelectedVarValues[sVarKey]]+(oOfferData&&additionalTextList[sVarKey][oOfferData['asin']]&&extraStringHash[sVarKey]!=oVariationValues[sVarKey][oSelectedVarValues[sVarKey]]?additionalTextList[sVarKey][oOfferData['asin']]:'')+'</b>';}}}else{sHTML+='<b class=variationDefault></b><span class="swatchUnselectedSelectPromptText">'+goVariationStrings['pleaseSelect']+'</span>';}
labelDiv.innerHTML=sHTML;}}
this.onHoverOverSwatch=function(sVarKey,nVarValue){oHoveredVarValues[sVarKey]=nVarValue;this.updateSwatches();this.updateLabels();this.triggerEvent('preview');}
this.onHoverOffSwatch=function(){for(var sVarKey in oHoveredVarValues){oHoveredVarValues[sVarKey]=-1;}
this.updateSwatches();this.updateLabels();this.triggerEvent('preview');}
this.onKeypressSwatch=function(sVarKey,nVarValue,e){if(e){if(e.keyCode==13||e.keyCode==32||e.charCode==32){this.onClickSwatch(sVarKey,nVarValue);}}
return(e.keyCode==9);}
this.onClickSwatch=function(sVarKey,nVarValue,bSuppressEventPropagation){if(oVariationDisplayTypes[sVarKey]=='f'){return false;}
if(oSelectedVarValues[sVarKey]==nVarValue){return;}else{if(oSwatchStateCache[sVarKey][nVarValue]=='swatchUnavailableHover'){for(var sCurVarKey in oSelectedVarValues){if(oVariationDisplayTypes[sCurVarKey]!='f'){oSelectedVarValues[sCurVarKey]=-1;}}}
oSelectedVarValues[sVarKey]=nVarValue;}
this.updateSwatches();this.updateDropdowns(sVarKey);this.updateLabels();this.triggerEvent('select',bSuppressEventPropagation);return false;}
this.onChangeDropdown=function(sVarKey,oOfferData){var oDropdown=document.getElementById(sVarKey);var option=oDropdown.options[oDropdown.selectedIndex];var nVarValue=option.value;if(nVarValue!=-1&&!option.isAvail){var numberOfDims=0;for(var sCurVarKey in oSelectedVarValues){if(oVariationDisplayTypes[sCurVarKey]!='f'){oSelectedVarValues[sCurVarKey]=-1;numberOfDims++;}}
if(!option.isAvail){oSelectedVarValues[sVarKey]=nVarValue;}
if(numberOfDims>1)
sVarKey='';}else if(nVarValue==-1){for(var sCurVarKey in oSelectedVarValues){if(sCurVarKey==sVarKey){oSelectedVarValues[sVarKey]=-1;}}}else{oSelectedVarValues[sVarKey]=nVarValue;}
this.updateSwatches();this.updateDropdowns(sVarKey);this.updateLabels(oOfferData);this.triggerEvent('select');}
var eventActionId=0;var lastEvent;this.triggerEvent=function(sEventType,bSuppressEventPropagation){var oEventVarValues=new Object();var nEventVariationsSelected=0;for(var sVarKey in oSelectedVarValues){if((sEventType=='preview')&&(oHoveredVarValues[sVarKey]!=-1)){oEventVarValues[oVariationLabels[sVarKey]]=oVariationValues[sVarKey][oHoveredVarValues[sVarKey]];nEventVariationsSelected++;}else if(oSelectedVarValues[sVarKey]!=-1){oEventVarValues[oVariationLabels[sVarKey]]=oVariationValues[sVarKey][oSelectedVarValues[sVarKey]];nEventVariationsSelected++;}else{oEventVarValues[oVariationLabels[sVarKey]]=null;}}
if(sEventType!='preview')
oSelectedDisplayVariationValues=oEventVarValues;var sBuyableASIN=null;if(nEventVariationsSelected==nVariationsTotal){var sLookup='';for(var sVarKey in oSelectedVarValues){if((sEventType=='preview')&&(oHoveredVarValues[sVarKey]!=-1)){sLookup+=(oHoveredVarValues[sVarKey]+" ");}else if(oSelectedVarValues[sVarKey]!=-1){sLookup+=(oSelectedVarValues[sVarKey]+" ");}else{sLookup=null;break;}}
if(sLookup!=null){var oItems=oSelectionItems[sLookup];if(oItems!=null){sBuyableASIN=oSelectionItems[sLookup][0];}}}
if((sEventType=='preview'||sEventType=='select')&&typeof DetailPage!='undefined'){this.updateLabels(sBuyableASIN);}
var aAsinList=[];if(sEventType=='select'||sEventType=='loadSelectedChildData'){aAsinList=this.getReachableAsins();}
if(typeof DetailPage!='undefined'&&!bSuppressEventPropagation){var dpState=DetailPage.StateController.getState();if(sEventType=='select'){this.prefetchOffers();if(sBuyableASIN){DetailPage.StateController.notify('child_select',{current_asin:sBuyableASIN,num_dimensions_selected:nEventVariationsSelected,selected_variations:oEventVarValues,asin_list:aAsinList});}else{DetailPage.StateController.notify('child_deselect',{current_asin:null,num_dimensions_selected:nEventVariationsSelected,selected_variations:oEventVarValues,asin_list:aAsinList});}}}
var oEventData=new VariationData();oEventData.oSelectedVariations=oEventVarValues;oEventData.nVariationsTotal=nVariationsTotal;oEventData.nVariationsSelected=nEventVariationsSelected;oEventData.oVariationTypeDisplayLabels=oVariationLabels;oEventData.aAsinList=aAsinList;oEventData.sBuyableASIN=sBuyableASIN;if(sEventType=='preview'){lastEvent=oEventData;eventActionId++;setTimeout('delayPreviewEvent('+eventActionId+', '+bSuppressEventPropagation+');',100);}else if(sEventType=='select'&&typeof oEventManager!='undefined'&&oEventManager!=null){oEventManager.publish(this,gsTwisterVariationsEventName_SelectVariations,oEventData);}
else if(sEventType=='loadSelectedChildData'&&typeof oEventManager!='undefined'&&oEventManager!=null){oEventData.bUpdateFeatures=new Object();oEventData.bUpdateFeatures.value=false;oEventManager.publish(this,gsTwisterVariationsEventName_SelectVariations,oEventData);}}
delayPreviewEvent=function(action,bSuppressEventPropagation){if(action==eventActionId){if(!bSuppressEventPropagation&&typeof DetailPage!='undefined'){DetailPage.StateController.notify('swatch_hover',{current_hovered_asin:lastEvent.sBuyableASIN,num_dimensions_hovered:lastEvent.nVariationsSelected,hovered_variations:lastEvent.oSelectedVariations,asin_list:lastEvent.aAsinList});}
if(typeof oEventManager!=undefined&&oEventManager!=null){oEventManager.publish(goTwisterVariations,gsTwisterVariationsEventName_PreviewVariations,lastEvent);}}}
this.prefetchOffers=function(){if(typeof DetailPage!="undefined"){var dpState=DetailPage.StateController.getState();var asinList=this.getReachableAsins();for(var i=0;i<asinList.length;i++){if(asinList[i]==dpState['current_asin']){var temp=asinList[0];asinList[0]=asinList[i];asinList[i]=temp;}}
if(asinList.length>0){asinList[asinList.length]=dpState['parent_asin'];}
DetailPage.Model.prefetch(asinList,'offers');}};this.getReachableAsins=function(){var aAsinList=new Array();var count=0;for(var sIgnoreVarKey in oSelectedVarValues){var sLookup='';for(var sVarKey in oSelectedVarValues){if(sVarKey!=sIgnoreVarKey){if(oSelectedVarValues[sVarKey]!=-1){sLookup+=(oSelectedVarValues[sVarKey]+" ");}else{sLookup=null;break;}}else{sLookup+="-1 ";}}
if(sLookup!=null){var oItems=oSelectionItems[sLookup];if(oVariationDisplayTypes[sIgnoreVarKey]=='d'){var prefetchRange=20;var pos=parseInt(oSelectedVarValues[sIgnoreVarKey]);if(pos<0){pos=prefetchRange;}
var start=Math.max(pos-prefetchRange,0);var end=pos+prefetchRange;oItems=oItems.slice(start,end);}
for(var nVarValue in oItems){aAsinList[count]=oItems[nVarValue];count++;}}}
return aAsinList;};this.selectChild=function(oChildVariations,sObjName){var time=0;for(var sVarKey in oChildVariations){var sVarValue=oChildVariations[sVarKey];var nVarValue=-1;for(var nCurVarValue in oVariationValues[sVarKey]){if(sVarValue==oVariationValues[sVarKey][nCurVarValue]){nVarValue=nCurVarValue;break;}}
if(oSelectedVarValues[sVarKey]==nVarValue){continue;}
if(oVariationDisplayTypes[sVarKey]=='s'){setTimeout(sObjName+".onClickSwatch('"+sVarKey+"', "+nVarValue+')',time*500);}else if(oVariationDisplayTypes[sVarKey]=='d'){var ddList=document.getElementById(sVarKey);for(var i=1;ddList.options[i]!=null;i++){if(ddList.options[i].value==nVarValue){ddList.options[i].selected=true;break;}}
setTimeout(sObjName+".onChangeDropdown('"+sVarKey+"')",time*500);}
time++;}}
this.updateSizeChart=function(oOfferData){if(!oVariationArgs['merchSizeChartLink']||!oVariationArgs['merchSizeText']||!oVariationArgs['divID']||!oOfferData['ASIN']||!oOfferData['merchantID']){return;}
var div=document.getElementById(oVariationArgs['divID']);if(!div){return;}
var link=oVariationArgs['merchSizeChartLink']+'?asin='+oOfferData['ASIN']+'&seller='+oOfferData['merchantID'];var sHTML='<a href="'+link+'" target="_blank">'+oVariationArgs['merchSizeText']+'</a>';div.innerHTML=sHTML;}
this.clearSizeChart=function(){if(!oVariationArgs['divID']){return;}
var div=document.getElementById(oVariationArgs['divID']);if(!div){return;}
div.innerHTML=oVariationArgs['twisterDefaultSizingChartLink'];}
this.getChildCount=function(){if(oChildItems){return(oChildItems.length);}
return 0;}}
function VariationData(){this.aAsinList=new Array();this.oSelectedVariations=new Array();this.nVariationsSelected=0;this.nVariationsTotal=0;this.sBuyableASIN=null;this.oVariationTypeDisplayLabels=new Array();}
window.isChildElement=function(oParent,oChild){var isChild=false;for(var i=0;i<4;i++){if(oChild==null)break;if(oChild==oParent){isChild=true;break;}
oChild=oChild.parentNode;}
return isChild;}
window.isMouseOver=function(oElement,e){if(!e)var e=window.event;var tg=(window.event)?e.srcElement:e.target;var reltg=(e.relatedTarget)?e.relatedTarget:e.fromElement;if(isChildElement(oElement,tg)&&!isChildElement(oElement,reltg)){if(oElement.getAttribute("mouseOver")!="1"){oElement.setAttribute("mouseOver","1");return 1;}}
return 0;}
window.isMouseOut=function(oElement,e){if(!e)var e=window.event;var tg=(window.event)?e.srcElement:e.target;var reltg=(e.relatedTarget)?e.relatedTarget:e.toElement;if(isChildElement(oElement,tg)&&!isChildElement(oElement,reltg)){if(oElement.getAttribute("mouseOver")=="1"){oElement.setAttribute("mouseOver","0");return 1;}}
return 0;}
// (FILE: /detail-page-features/twister-product-image/twister-product-image.js) 


function TwisterProductImage(oStrings){var oStrings=oStrings;var registeredImages=new Object();var selectedImageID="none";var isPendingPreload=false;this.registerImage=function(id,src,imageHTML,captionHTML){if(registeredImages[id]==null){registeredImages[id]=new Object();registeredImages[id].imageHTML=imageHTML;registeredImages[id].captionHTML=captionHTML;registeredImages[id].src=src;registeredImages[id].hasSticker=false;}}
this.preloadImage=function(id){if(registeredImages[id]&&!registeredImages[id].image){registeredImages[id].image=new Image();registeredImages[id].image.src=registeredImages[id].src;}}
this.displayImage=function(id){this.preloadImage(id);this.showImage(id);this.hideOverlay();}
this.displayNotBuyable=function(id,oSelectedVariations){this.showImage(id);this.showNotBuyableOverlay(oSelectedVariations);}
this.displayImageNotAvail=function(id,oTwisterVariationData){this.showImage(id);this.showImageNotAvailOverlay(oTwisterVariationData);}
this.showImage=function(id){if(id!=selectedImageID){if(registeredImages[selectedImageID]&&registeredImages[selectedImageID].ciuAnnoContainer){registeredImages[selectedImageID].ciuAnnoContainer.hide();}
selectedImageID=id;if(id!=null){document.getElementById('prodImageCell').innerHTML=registeredImages[id].imageHTML;document.getElementById('prodImageCaption').innerHTML=registeredImages[id].captionHTML;}}
if(registeredImages[selectedImageID]&&registeredImages[selectedImageID].ciuAnnoContainer){registeredImages[selectedImageID].ciuAnnoContainer.show();ciuAnnotationsMouseover(selectedImageID);}}
this.hideOverlay=function(){document.getElementById('prodImageOverlay').style.visibility="hidden";}
this.showOverlay=function(sHTML,sClass){document.getElementById('prodImageOverlayHiddenText').innerHTML=sHTML;document.getElementById('prodImageOverlayVisibleText').innerHTML=sHTML;document.getElementById('prodImageOverlay').style.visibility="visible";document.getElementById('prodImageOverlayBox').className=sClass;document.getElementById('prodImageOverlayVisibleText').className=sClass;}
this.showNotBuyableOverlay=function(oSelectedVariations){var sHTML;sHTML="<b>"+oStrings['prodImageNotBuyableText']+"<br>";var nKeys=0;for(var sKey in oSelectedVariations){if(nKeys){sHTML+="<br>";}
sHTML+=(sKey+": <b class='prodImageNotBuyableOverlayHighlight'>"+oSelectedVariations[sKey]+"</b>");nKeys++;}
sHTML+="</b>";this.showOverlay(sHTML,"prodImageNotBuyable");}
this.showImageNotAvailOverlay=function(oTwisterVariationData){var sHTML;if(oTwisterVariationData!=null){var oSelectedVariations=oTwisterVariationData.oSelectedVariations;var oVariationLabels=oTwisterVariationData.oVariationTypeDisplayLabels;sHTML=oStrings['prodImageNotAvailTextColorBefore'];var nKeys=0;for(var sKey in oVariationLabels){var displayName=oVariationLabels[sKey];var value=oSelectedVariations[displayName];if(value!=null&&dimensionLookupHash[sKey]&&dimensionLookupHash[sKey][value]){if(nKeys){sHTML+="<br>";}
sHTML+=(displayName+": <b class='prodImageNotAvailOverlayHighlight'>"+value+"</b>");nKeys++;}}
if(nKeys){sHTML+=oStrings['prodImageNotAvailTextColorAfter'];}else{sHTML=oStrings['prodImageNotAvailTextNoColor'];}
this.showOverlay(sHTML,"prodImageNotAvail");}}
this.updateImageSticker=function(id,stickerType,quantity){if(!registeredImages[id].hasSticker){var styleCode='_PI'+stickerType+'-'+quantity+',TopRight,0,0_AA280_SH20';var html=registeredImages[id].imageHTML;var splitPoint=html.lastIndexOf('_.');var first=html.substr(0,splitPoint);var last=html.slice(splitPoint+1);registeredImages[id].imageHTML=first+styleCode+last;registeredImages[id].hasSticker=true;}}
this.getRegisteredImages=function(){return registeredImages;}}
// (FILE: /detail-page-features/twister-alt-images/twister-alt-images.js) 


function TwisterAltImages(sInitialColor,nInitialNumThumbs,oLookupHash,useChildCustomerImages,stickerType,quantity){var oImageDataSets={};var oCustomerImageDataSet={};var oNumCustomerImages={};var oImageStickers={};var nImageDataSets=0;var oDimensionLookup=oLookupHash;var nVisualDimensions=0;for(var dim in oDimensionLookup){nVisualDimensions++;}
var sCurrentSelectedColor=sInitialColor;var defaultIndex=sInitialColor;while(defaultIndex.search(/[0-9]+/)>=0){defaultIndex=defaultIndex.replace(/[0-9]+/,'x');}
var parentIndex=defaultIndex;var sCurrentDisplayedColor=defaultIndex;var sCurrentSelectionData;var nMaxThumbs=7;var nMinAltImages=4;var nThumbs=nInitialNumThumbs;var nHighlightThumb=0;var aImageIDs=[];var nAltImages=nInitialNumThumbs;var nCustImages=-1;var sStickerType=stickerType;var nStickerQuantity=quantity;this.getBucketArray=function(bucketId){var bucketString=''+bucketId;var bucketArray=bucketString.split('-');for(var i=0;i<bucketArray.length;i++){bucketArray[i]=parseInt(bucketArray[i]);}
return bucketArray;}
var sCurrentSelectedBucket=this.getBucketArray(sInitialColor);var shareYourOwnLink;var initialASIN;this.callRegJS=function(imageData){goTwisterProductImage.registerImage(imageData.regImgArgs[0],imageData.regImgArgs[1],imageData.regImgArgs[2],imageData.regImgArgs[3]);}
this.getCustomerImages=function(){return oCustomerImageDataSet;}
this.initCustomerImages=function(selectedColor,start){var images;if(useChildCustomerImages){images=oImageDataSets[selectedColor];}else{images=oImageDataSets['x'];}
if(images){var counter=0;for(var nThumb=0;nThumb<images.length;nThumb++){if(images[nThumb]&&images[nThumb].isCustomerImage){var currentThumb=start+counter;if(currentThumb>=nMaxThumbs)return;this.setThumb(currentThumb,images[nThumb].sImageID,images[nThumb].sImageHTML);document.getElementById("thumb_"+currentThumb).style.display='inline';counter++;}}}}
this.addImage=function(sImageID,sColor,registerJSArgs,sImageHTML,isCustomerImage){var oImageData={};oImageData.sImageID=sImageID;oImageData.regImgArgs=registerJSArgs;oImageData.sImageHTML=sImageHTML;oImageData.hasSticker=false;oImageData.isCustomerImage=isCustomerImage;if(oImageDataSets[sColor]==null){oImageDataSets[sColor]=[];oNumCustomerImages[sColor]=0;nImageDataSets++;}
oImageDataSets[sColor][oImageDataSets[sColor].length]=oImageData;var indexes=this.getBucketArray(sColor);var partialIndexes=[];this.getPartialIndexes(false,'',indexes,0,partialIndexes);for(var i=1;i<partialIndexes.length;i++){if(!oImageDataSets[partialIndexes[i]]){oImageDataSets[partialIndexes[i]]=oImageDataSets[sColor];}}
this.callRegJS(oImageData);if(isCustomerImage){var custImageId=sImageID.split('-');custImageId=custImageId[custImageId.length-1];var images=goTwisterProductImage.getRegisteredImages();if(images&&images[sImageID]){oCustomerImageDataSet[custImageId]=images[sImageID];oNumCustomerImages[sColor]++;}}
if(sColor==sCurrentSelectedColor){aImageIDs[aImageIDs.length]=sImageID;if(sStickerType&&sColor!=parentIndex){oImageStickers[sColor]=1;goTwisterProductImage.updateImageSticker(sImageID,sStickerType,nStickerQuantity);}
sCurrentDisplayedColor=sCurrentSelectedColor;}}
this.setColor=function(sNewSelectedColor){if(nVisualDimensions<1)return;if(sNewSelectedColor!=sCurrentSelectedColor){sCurrentSelectedColor=sNewSelectedColor;if(oImageDataSets[sCurrentSelectedColor]!=undefined){sCurrentDisplayedColor=sCurrentSelectedColor;}
var oImageDataSet;if(oImageDataSets[sCurrentDisplayedColor]!=undefined){oImageDataSet=oImageDataSets[sCurrentDisplayedColor];}else{oImageDataSet=[];}
if(useChildCustomerImages){nCustImages=oNumCustomerImages[sNewSelectedColor]||0;nAltImages=oImageDataSet.length-nCustImages;}else{nCustImages=oNumCustomerImages['x'];nAltImages=oImageDataSet.length;}
if(!nCustImages||nCustImages=='undefined'){nCustImages=0;}
nThumbs=nAltImages+nCustImages;if(nThumbs>nMaxThumbs){nThumbs=nMaxThumbs;nAltImages=nMaxThumbs-nCustImages;if(nAltImages<nMinAltImages){nAltImages=nMinAltImages;nCustImages=nMaxThumbs-nAltImages;}}
for(var nThumb=nThumbs;nThumb<nMaxThumbs;nThumb++){document.getElementById("thumb_"+nThumb).style.display='none';}
document.getElementById("thumb_strip").style.width=(nThumbs*36);for(var nThumb=0;nThumb<nAltImages;nThumb++){this.setThumb(nThumb,oImageDataSet[nThumb].sImageID,oImageDataSet[nThumb].sImageHTML);document.getElementById("thumb_"+nThumb).style.display='inline';}
this.initCustomerImages(sNewSelectedColor,nAltImages);if(nThumbs>0){this.viewThumb(0);}}}
this.setThumb=function(nThumb,sImageID,sImageHTML){var sInnerID="thumb_"+nThumb+"_inner";document.getElementById(sInnerID).innerHTML=sImageHTML;aImageIDs[nThumb]=sImageID;}
this.viewThumb=function(nThumb){if((nImageDataSets>1)&&(sCurrentDisplayedColor!=sCurrentSelectedColor)){goTwisterProductImage.displayImageNotAvail(aImageIDs[nThumb],sCurrentSelectionData);}else{goTwisterProductImage.displayImage(aImageIDs[nThumb]);}
if(nThumb!=nHighlightThumb){var sThumbID;sThumbID="thumb_"+nHighlightThumb;document.getElementById(sThumbID).style.border='1px solid #999999';sThumbID="thumb_"+nThumb;document.getElementById(sThumbID).style.border='1px solid #990000';nHighlightThumb=nThumb;}}
this.preloadThumbs=function(){for(var nThumb=0;nThumb<nThumbs;nThumb++){goTwisterProductImage.preloadImage(aImageIDs[nThumb]);}}
this.onMouseOver=function(nThumb){this.viewThumb(nThumb);this.preloadThumbs();}
this.onMouseOut=function(nThumb){var id=aImageIDs[nThumb];if(typeof ciuAnnotationsMouseout=="function"){ciuAnnotationsMouseout(id);}}
this.previewVariationValues=function(oTwisterVariationData){sCurrentSelectionData=oTwisterVariationData;this.updateCurrentSelectedBucket(oTwisterVariationData);var sSelectedColor=this.getBucketString(sCurrentSelectedBucket);var sPreviewColor;var bImageNotAvail=0;if(nImageDataSets>0){if(sSelectedColor!=undefined){if(oImageDataSets[sSelectedColor]!=undefined){sPreviewColor=sSelectedColor;}else{sPreviewColor=sCurrentDisplayedColor;if(nImageDataSets>1){bImageNotAvail=1;}}}}else{sSelectedColor=undefined;bImageNotAvail=1;}
var sPreviewImageID=undefined;if(sPreviewColor){if(sPreviewColor==sCurrentDisplayedColor){sPreviewImageID=aImageIDs[nHighlightThumb];}else{sPreviewImageID=oImageDataSets[sPreviewColor][0].sImageID;}}
var bNotBuyable=((oTwisterVariationData.nVariationsSelected==oTwisterVariationData.nVariationsTotal)&&(oTwisterVariationData.sBuyableASIN==undefined))
if(bNotBuyable){goTwisterProductImage.displayNotBuyable(sPreviewImageID,oTwisterVariationData.oSelectedVariations);}else if(bImageNotAvail){goTwisterProductImage.displayImageNotAvail(sPreviewImageID,oTwisterVariationData);}else{goTwisterProductImage.displayImage(sPreviewImageID);}}
this.selectVariationValues=function(oTwisterVariationData){this.updateCurrentSelectedBucket(oTwisterVariationData);this.setColor(this.getBucketString(sCurrentSelectedBucket));this.updateShareYourOwnLink(oTwisterVariationData.sBuyableASIN);}
this.updateShareYourOwnLink=function(asin){if(!shareYourOwnLink){var wrapperDiv=document.getElementById('share-your-own-link');if(wrapperDiv){var childElems=wrapperDiv.childNodes;for(var i=0;i<childElems.length;i++){if(childElems[i].nodeName=='A'){shareYourOwnLink=childElems[i];continue;}}}}
if(!asin||!shareYourOwnLink)return;var url=shareYourOwnLink.href;var matches=eval('url.match(/upload'+String.fromCharCode(92)+'/([A-Z0-9]{10})'+String.fromCharCode(92)+'/ref/)');if(matches&&matches.length>1){var oldASIN=matches[1];shareYourOwnLink.href=url.replace(oldASIN,asin);}}
this.updateCurrentSelectedBucket=function(oTwisterVariationData){var asin=oTwisterVariationData.sBuyableASIN;var asinOfferData;if(typeof DetailPage!='undefined'&&DetailPage.Model.loaded(asin,'offers')){asinOfferData=DetailPage.Model.getData(asin,'offers');}else if(typeof goTwisterManager!='undefined'){var globalOfferData=goTwisterManager.getOfferData();if(globalOfferData[asin]){asinOfferData=globalOfferData[asin];}}
var oSelectedVariations=oTwisterVariationData.oSelectedVariations;var oVariationTypeDisplayLabels=oTwisterVariationData.oVariationTypeDisplayLabels;var sSelectedVariationLabel=undefined;var sSelectedValue;for(var varKey in oVariationTypeDisplayLabels){if(oDimensionLookup[varKey]){sSelectedVariationLabel=oVariationTypeDisplayLabels[varKey];sSelectedValue=oSelectedVariations[sSelectedVariationLabel];if(sSelectedValue!=null){sCurrentSelectedBucket[oDimensionLookup[varKey]['::::']]=oDimensionLookup[varKey][sSelectedValue];}else{sCurrentSelectedBucket[oDimensionLookup[varKey]['::::']]='x';}}}
var bundleCount;var packCount;var bucket;if(asinOfferData){bundleCount=asinOfferData.bundle_count;packCount=asinOfferData.pack_count;var bucket=this.getBucketString(sCurrentSelectedBucket);if((bundleCount||packCount)&&oImageDataSets[bucket]&&!oImageStickers[bucket]){oImageStickers[bucket]=1;for(var i=0;i<oImageDataSets[bucket].length;i++){if(bundleCount&&bundleCount>1){goTwisterProductImage.updateImageSticker(oImageDataSets[bucket][i].sImageID,'bundle',bundleCount);}else if(packCount&&packCount>1){goTwisterProductImage.updateImageSticker(oImageDataSets[bucket][i].sImageID,'countsize',packCount);}}}}}
this.getBucketString=function(bucket){var myResult='';if(bucket.length>0){for(var i=0;i<bucket.length-1;i++){myResult+=bucket[i]+'-';}
myResult+=bucket[bucket.length-1];return myResult;}}
this.getPartialIndexes=function(hasX,current,values,index,result){if(index==values.length-1){result.push(current+'-x');if(hasX){result.push(current+'-'+values[index]);}}else{if(index>0){this.getPartialIndexes(true,current+'-x',values,index+1,result);this.getPartialIndexes(hasX,current+'-'+values[index],values,index+1,result);}else{this.getPartialIndexes(true,'x',values,index+1,result);this.getPartialIndexes(hasX,values[index],values,index+1,result);}}}}
// (FILE: /detail-page-features/twister-buy-box/twister-buy-box.js) 


var subscribeAndSaveHTMLTmpl='<strong>Save  subscribe_discount%  with <br />Subscribe &amp; Save</strong>';function TwisterBuybox(headerDivID,mainDivID,oBuyboxStrings){var oStrings=oBuyboxStrings;var buyBoxForm;var oneClickDiv;var parentOneClickDiv;var parentAddressDropdown;this.onLoad=function(){var sHeaderString=this.printBuyboxHeader(null);if(document.getElementById(headerDivID)){document.getElementById(headerDivID).innerHTML=sHeaderString;}
this.makeButtonsInactive();this.handleOneClick(null);}
this.update=function(sASIN,oOfferData,numVariations,totalVariations,selectedVariations,displayableNames,onlyUnqualifiedOffers){var isSIP=0;if(oOfferData&&oOfferData['is_sip']){isSIP=oOfferData['is_sip'];}
var sTable='<table class="twisterVariations">';if(isSIP){sTable='<table class="twisterVariations" align="center">';}
var sHeaderString='';var sCurrentString='<div id="buyboxPriceBlock" style="padding-top: 0px;">'+sTable;if(onlyUnqualifiedOffers&&sASIN){document.getElementById('buyboxDivId').style.display='none';if(sASIN){this.makeButtonsActive(oOfferData);this.handleOneClick(oOfferData);}
return;}
if(sASIN){sHeaderString='<h2 style="font-size: 11px; color: #000;">'+oStrings['ReadyToBuy']+'</h2>';var sPrice;var sShipCost;if(oOfferData){if(oOfferData['sale_price']){sPrice=oOfferData['sale_price'];}else if(oOfferData['our_price']){sPrice=oOfferData['our_price'];}else{sPrice=oOfferData['list_price'];}
if(isSIP&&oOfferData['shipping_charge']){sShipCost=oOfferData['shipping_charge'];}}else{sPrice=oStrings['loading'];}
var priceValue=oStrings['PriceLabel']+'</b>&nbsp;<b class="price">'+sPrice;if(oOfferData&&oOfferData['price_breaks_map_raw']){priceValue='<span class="price">'+oStrings['priceTooLow']+'</span>';}
sCurrentString+='<tr><td class="twisterProductLabel" valign="top"><b>'+priceValue+'</b>';var ssPrefix='<span class="plusShippingText">&nbsp;';var ssSuffix='</span>';var msgSuffix='';if(oOfferData&&!oOfferData['price_breaks_map_raw']){if(isSIP){if(oOfferData['prime_shipping']){sCurrentString+=ssPrefix+oOfferData['prime_shipping']+ssSuffix;}else if(oOfferData['isEligibleForSuperSaverShipping']){if(oOfferData['isEligibleForSuperSaverShipping']==1){sCurrentString+=ssPrefix+oStrings['SSSEligible'+msgSuffix].replace('#sssThershold#',oOfferData['superSaverShippingThreshold'])+ssSuffix;}else{sCurrentString+=ssPrefix+oStrings['SSSQualifies'+msgSuffix]+ssSuffix;}}else if(oOfferData['isFreeShipping']){sCurrentString+=ssPrefix+'+&nbsp;'+oStrings['FreeShipping']+ssSuffix;}else if(sShipCost){sCurrentString+=ssPrefix+'+ '+sShipCost+' '+oStrings['shipping']+ssSuffix;}}else{if(oOfferData['prime_shipping']){sCurrentString+=ssPrefix+oOfferData['prime_shipping']+ssSuffix;}else if(oOfferData['isEligibleForSuperSaverShipping']&&(oOfferData['merchantID']=='ATVPDKIKX0DER')){sCurrentString+=ssPrefix+oStrings['SSSMessage']+ssSuffix;}}}
sCurrentString+='</td></tr>';if(oOfferData&&oOfferData['amazonPoints']){sCurrentString+='<tr><td class="twisterProductLabel" valign="top">'+oStrings['pointsLabel']+'<span class="tiny">&nbsp;'+oOfferData['amazonPoints']+'</span></td></tr>';}
sCurrentString+=this.printVariationInfo(selectedVariations);if(oOfferData){document.getElementById("twisterBuyboxAvailabilityJS").innerHTML=this.printAvailability(oOfferData);}else{document.getElementById("twisterBuyboxAvailabilityJS").innerHTML='';}
if(oOfferData){if(!buyBoxForm){buyBoxForm=document.handleBuy;}
buyBoxForm.ASIN.value=sASIN;buyBoxForm.merchantID.value=oOfferData['merchantID'];buyBoxForm.offerListingID.value=oOfferData['offer_listing_id'];this.makeButtonsActive(oOfferData);this.handleOneClick(oOfferData);}else{this.makeButtonsInactive();this.handleOneClick(oOfferData);}}else{sHeaderString=this.printBuyboxHeader(selectedVariations);document.getElementById("twisterBuyboxAvailabilityJS").innerHTML='';this.makeButtonsInactive();this.handleOneClick(oOfferData);if(numVariations==0){sCurrentString='';if(totalVariations==0){sHeaderString='';}}else if(numVariations<totalVariations){sCurrentString+=this.printVariationInfo(selectedVariations);}}
sCurrentString+='</table></div>';document.getElementById(headerDivID).innerHTML=sHeaderString;document.getElementById(mainDivID).innerHTML=sCurrentString;if(sASIN&&oOfferData&&(!oOfferData['avail_message']||!oOfferData['availabilityCondition'])){document.getElementById('buyboxDivId').style.display='none';}
else{document.getElementById('buyboxDivId').style.display='block';}
this.setSubscribeDivVisibility(oOfferData);this.setPayPhraseVisibility();var addToCart=document.getElementById('twisterAddToCartActive');var oneClick=document.getElementById('twisterOneClickActive');if(oOfferData&&addToCart&&goTwisterBuyboxImages){if(oOfferData['is_preorder']){if(goTwisterBuyboxImages['preorder']){addToCart.innerHTML=goTwisterBuyboxImages['preorder'];}
if(oneClick&&goTwisterBuyboxImages['oneclick_preorder']){oneClick.innerHTML=goTwisterBuyboxImages['oneclick_preorder'];}}else{if(goTwisterBuyboxImages['addToCart']){addToCart.innerHTML=goTwisterBuyboxImages['addToCart'];}
if(oneClick&&goTwisterBuyboxImages['oneclick']){oneClick.innerHTML=goTwisterBuyboxImages['oneclick'];}}}
if(typeof(gbSecure1Click)!='undefined'&&gbSecure1Click){jQuery("#oneClickBuyButton").click(function(){var hbbAction=jQuery('#handleBuy').attr("action").replace("http:","https:");jQuery('#handleBuy').attr("action",hbbAction);return true;});}
if(oOfferData&&oOfferData['quantity_restriction_raw']){this.updateDropdown(oOfferData['quantity_restriction_raw']);}
(function($){if(oOfferData&&oOfferData['prime_button']){var primeBuyboxLowerDiv=$('#prime_buybox_lower_div');primeBuyboxLowerDiv.html(oOfferData['prime_button']);primeBuyboxLowerDiv.show();}else{$('#prime_buybox_lower_div').hide();}})(jQuery);}
this.setSubscribeDivVisibility=function(oOfferData)
{var showSNSBuyBox=(oOfferData==null)?null:oOfferData['sns_with_amzn_buybox'];var subscribeDiv=document.getElementById('rcx-subs-bb-outer');if(subscribeDiv==null)return;if(showSNSBuyBox){subscribeDiv.style.display='block';}else{subscribeDiv.style.display='none';}}
this.updateSubscribeInfo=function(oOfferData)
{var subDiscnt=(oOfferData==null)?null:oOfferData['subscribe_discount'];if(subDiscnt!=null)
{document.getElementById('subscribe_discount_div').innerHTML=formatString(subscribeAndSaveHTMLTmpl,{'subscribe_discount':subDiscnt});}}
this.array2String=function(arr,aStr,useAll){var str='';var last,notLast,f='';for(v in arr){if((!arr[v])||useAll){notLast=last;if(useAll){last=arr[v];}else{last=v;}
if(notLast){str+=(f+notLast);f=', ';}}}
if(str==''){return last;}
if(last){return str+aStr+last;}
return str;}
this.printBuyboxHeader=function(selectedVariations){var headerString='';var hasVariationNames=0;for(var x in goVariationLabels){hasVariationNames=1;break;}
var strOptions='';if(hasVariationNames){if(selectedVariations){strOptions=this.array2String(selectedVariations,' '+goTwisterBuyboxStrings['and']+' ',false);}else{strOptions=this.array2String(goVariationLabels,' '+goTwisterBuyboxStrings['and']+' ',true);}
headerString+='<h2 style="font-size: 11px; color: #000;">'+goTwisterBuyboxStrings['toBuy'].replace(/###/,strOptions)+'</h2>'+'('+oStrings['NoVariationSubheader']+')';}
return headerString;}
this.printVariationInfo=function(selectedVariations){var counter=0;var variationString='<tr><td class="twisterYourSelectionLabel">';if(goTwisterBuyboxStrings['Realm']=='JPAmazon'){variationString+='<span class="tiny">'}else{variationString+='<span class="tiny">'}
for(var x in selectedVariations){if(selectedVariations[x]){if(counter==0){variationString+='<span class="twisterBold">'+goTwisterBuyboxStrings['yourSelection']+' </span>';counter=1;}
variationString+=selectedVariations[x]+', ';}}
if(selectedVariations)
variationString=variationString.substr(0,variationString.length-2);variationString+='</span></td></tr>';return variationString;}
this.setPayPhraseVisibility=function(){var pphActiveDiv=document.getElementById("twisterPayPhraseWidgetActive");var pphInactiveDiv=document.getElementById("twisterPayPhraseWidgetInactive");var buyBox=document.getElementById("buyboxDivId");var atcActive=document.getElementById("twisterAddToCartActive");var atcInactive=document.getElementById("twisterAddToCartInactive");var PPH_HIDDEN=0,PPH_ACTIVE=1,PPH_INACTIVE=2,pphMode;if(!buyBox||buyBox.style.display=='none'){pphMode=PPH_HIDDEN;}else if(atcInactive&&atcInactive.style.display!='none'){pphMode=PPH_INACTIVE;}else if(atcActive&&atcActive.style.display!='none'){pphMode=PPH_ACTIVE;}else{pphMode=PPH_HIDDEN;}
if(pphActiveDiv){pphActiveDiv.style.display=((pphMode==PPH_ACTIVE)?'block':'none');}
if(pphInactiveDiv){pphInactiveDiv.style.display=((pphMode==PPH_INACTIVE)?'block':'none');}}
this.makeButtonsActive=function(oOfferData){addOrig=document.getElementById("twisterAddToCartOrig");if(addOrig){addOrig.style.display='none';}
addInactive=document.getElementById("twisterAddToCartInactive");if(addInactive){addInactive.style.display='none';}
addActive=document.getElementById("twisterAddToCartActive");if(addActive){addActive.style.display='block';}
this.setPayPhraseVisibility();if(document&&document.handleBuy&&document.handleBuy.quantity){document.handleBuy.quantity.disabled=false;}
w=document.getElementById("twisterOneClickOrig");if(w){w.style.display='none';}
z=document.getElementById("twisterShippingDropdown");if(z){z.disabled=false;}
a=document.getElementById("wishlistAddButtonActive");if(a){a.style.display='inline';}
b=document.getElementById("wishlistAddButtonInactive");if(b){b.style.display='none';}
c=document.getElementById("wishlistDownButtonActive");if(c){c.style.display='inline';}
d=document.getElementById("wishlistDownButtonInactive");if(d){d.style.display='none';}
j=document.getElementById("rslButtonOrig");if(j){j.style.display='none';}
e=document.getElementById("rslButtonJsInactive");if(e){e.style.display='none';}
f=document.getElementById("rslButtonJsActive");if(f){f.style.display='block';}
g=document.getElementById("weddingButtonInactive");if(g){g.style.display='none';}
h=document.getElementById("weddingButtonActive");if(h){h.style.display='block';}
u=document.getElementById("babyButtonActive");if(u){u.style.display='block';}
v=document.getElementById("babyButtonInactive");if(v){v.style.display='none';}
a=document.getElementById("wishlistButtonActive");if(a){a.style.display='block';}
b=document.getElementById("wishlistButtonInactive");if(b){b.style.display='none';}}
this.handleOneClick=function(oOfferData){if(oneClickDiv==null||parentOneClickDiv==null){oneClickDiv=document.getElementById('oneClickDivId');parentOneClickDiv=document.getElementById('parentOneClickDivId');if(oneClickDiv==null||parentOneClickDiv==null){return;}}
if(parentAddressDropdown==null){parentAddressDropdown=document.getElementById('buyboxAddresSelectionDropDown');}
if(oOfferData){if(oOfferData['prime_1click']){parentOneClickDiv.style.display='none';oneClickDiv.innerHTML=oOfferData['prime_1click'];oneClickDiv.style.display='block';if(parentAddressDropdown!=null){parentAddressDropdown.setAttribute('name','parent-dropdown-selection');}}else if(oOfferData['isOneClickable']){oneClickDiv.style.display='none';oneClickDiv.innerHTML='';parentOneClickDiv.style.display='block';x=document.getElementById("twisterOneClickInactive");if(x){x.style.display='none';}
y=document.getElementById("twisterOneClickActive");if(y){y.style.display='block';}
if(parentAddressDropdown!=null){parentAddressDropdown.setAttribute('name','dropdown-selection');}}}else{oneClickDiv.style.display='none';parentOneClickDiv.style.display='block';x=document.getElementById("twisterOneClickInactive");if(x){x.style.display='block';}
y=document.getElementById("twisterOneClickActive");if(y){y.style.display='none';}}}
this.makeButtonsInactive=function(){addOrig=document.getElementById("twisterAddToCartOrig");if(addOrig){addOrig.style.display='none';}
addInactive=document.getElementById("twisterAddToCartInactive");if(addInactive){addInactive.style.display='block';}
addActive=document.getElementById("twisterAddToCartActive");if(addActive){addActive.style.display='none';}
this.setPayPhraseVisibility();if(document&&document.handleBuy&&document.handleBuy.quantity){document.handleBuy.quantity.disabled=true;}
w=document.getElementById("twisterOneClickOrig");if(w){w.style.display='none';}
z=document.getElementById("twisterShippingDropdown");if(z){z.disabled=true;}
a=document.getElementById("wishlistAddButtonActive");if(a){a.style.display='none';}
b=document.getElementById("wishlistAddButtonInactive");if(b){b.style.display='inline';}
c=document.getElementById("wishlistDownButtonActive");if(c){c.style.display='none';}
d=document.getElementById("wishlistDownButtonInactive");if(d){d.style.display='inline';}
j=document.getElementById("rslButtonOrig");if(j){j.style.display='none';}
e=document.getElementById("rslButtonJsInactive");if(e){e.style.display='block';}
f=document.getElementById("rslButtonJsActive");if(f){f.style.display='none';}
g=document.getElementById("weddingButtonInactive");if(g){g.style.display='block';}
h=document.getElementById("weddingButtonActive");if(h){h.style.display='none';}
u=document.getElementById("babyButtonActive");if(u){u.style.display='none';}
v=document.getElementById("babyButtonInactive");if(v){v.style.display='block';}
a=document.getElementById("wishlistButtonActive");if(a){a.style.display='none';}
b=document.getElementById("wishlistButtonInactive");if(b){b.style.display='block';}}
this.printAvailability=function(oOfferData){var sAvail='';var sMerchant=oOfferData['merchantName'];var sMessage=oOfferData['short_avail_message'];if(!sMessage){return sAvail;}
sAvail+=sMessage;if(sMerchant){if(oOfferData['isSSOF']){sAvail+=' '+goTwisterBuyboxStrings['soldShipByAmazon'].replace("defaultMerchant",'<span class="twisterBold">'+sMerchant+'</span>');}else{if(goTwisterBuyboxStrings['Realm']=='JPAmazon'){sAvail+='<span class="tiny">';}else{sAvail+='<span class="tiny">';}
sAvail+=' '+oStrings['ShipsFrom']+' '+'<span class="twisterBold">'+sMerchant+'</span>';sAvail+='</span>';}}
return sAvail;}
this.updateDropdown=function(maxQuantity){var maxQuantityCeiling=999;maxQuantity=maxQuantity>maxQuantityCeiling?maxQuantityCeiling:maxQuantity;if(document.handleBuy){var dropdown=document.handleBuy.quantity;var dropdownDiv=document.getElementById('quantityDropdownDiv');if(dropdownDiv&&dropdown){if(maxQuantity==1){dropdownDiv.style.display='none';}else{dropdownDiv.style.display='';if(dropdown.options.length!=maxQuantity){dropdown.options.length=0;for(var i=1;i<=maxQuantity;i++){dropdown.options[i-1]=new Option(i,i);}}}}}};}
// (FILE: /detail-page-features/twister-prime/twister-prime.js) 


function TwisterPrime(sChildASIN,sDivID,sParentDivID,oTPAjaxObj){var sCurrentASIN=sChildASIN;var oPrimeAjaxObj=oTPAjaxObj;var sParentHTML='';oPrimeAjaxObj.setURL('/gp/twister/dynamic-update/prime.html');var oParentDiv=document.getElementById(sParentDivID);if(oParentDiv==null){var oPrimeDiv=document.getElementById('prime_feature_div');sParentHTML=oPrimeDiv.innerHTML;}else{var oArgs=new Object();oArgs["ASIN"]=sCurrentASIN;oArgs["globalObject"]='goTwisterPrime';oPrimeAjaxObj.request(oArgs);}
this.setChildHTML=function(sASIN,sHTML){sParentHTML=sHTML;}
this.getParentContent=function(){return sParentHTML;}}
// (FILE: /detail-page-features/twister-price-block/twister-price-block.js) 


function TwisterPriceBlock(parentPriceBlockDivID,priceBlockDivID,sAnchorBlockDivID,oPriceBlockStrings,hasPromotions,useJQuery){var sParentPriceBlockDivID=parentPriceBlockDivID;var sPriceBlockDivID=priceBlockDivID;var oStrings=oPriceBlockStrings;var bHasPromotions=hasPromotions;var oHTMLCache=new Array();var sCurrentASIN='';var sPriceBlockLabelClass=gbEnableLarge?'priceBlockLabelPrice':'priceLabel';var sListPriceBlockLabelClass=gbEnableLarge?'priceBlockLabel':'productLabel';var sOurPriceBlockLabelClass=gbEnableLarge?'priceBlockLabel':'productLabel';var sPriceClass=gbEnableLarge?'priceLarge':'price';var sProductLabel=gbEnableLarge?'priceBlockLabelPrice':'productLabel';var sBoldPrice=gbEnableLarge?'':'<b>';var sBoldPriceClose=gbEnableLarge?'':'</b>';var sValignMiddle=gbEnableLarge?'':' valign="middle" ';var sCellspacing='0';var mapContentDiv=document.getElementById('twister_map_content');var priceBlockDiv=document.getElementById('priceBlock');var useJQ=useJQuery;this.update=function(sASIN,oOfferData,onlyUnqualifiedOffers){if(oOfferData&&oOfferData['price_breaks_map_raw']){if(mapContentDiv==null){mapContentDiv=document.createElement('div');mapContentDiv.id='twister_map_content';if(priceBlockDiv){priceBlockDiv.appendChild(mapContentDiv);}
if(!useJQ){goMAPPop_twister=new N2StaticPopover();goN2Events.registerFeature('mappop_twister','goMAPPop_twister',null,null,'n2HotspotClickStatic');goMAPPop_twister.initialize('goMAPPop_twister','goMAPPop_twister',null,null,'auto');}}
if(!useJQ){goMAPPop_twister.setTitle(oOfferData['map_popup_title']);}
mapContentDiv.innerHTML=oOfferData['map_div_content_html'];sPriceClass='price';}else{sPriceClass=gbEnableLarge?'priceLarge':'price';}
if(sASIN==sCurrentASIN){return;}
sCurrentASIN=sASIN;if(sASIN==null){this.clear();return;}
if(oHTMLCache[sASIN]==null){var sHTML='';if(oOfferData['avail_message']&&oOfferData['availabilityCondition']&&!onlyUnqualifiedOffers){if(oOfferData['promo_sticker']){sHTML+=(oOfferData['promo_sticker']);}
sHTML+='<div  class="buying" id="priceBlock"><table class="product" cellpadding="0" cellspacing="'+sCellspacing+'" ><tbody>';sHTML+=this.printImportListPrice(oOfferData);sHTML+=this.printListPrice(oOfferData);sHTML+=this.printOurPrice(oOfferData);sHTML+=this.printSalePrice(oOfferData);sHTML+=this.printYouSaveRow(oOfferData);sHTML+=this.printRebateInfo(sASIN,oOfferData);sHTML+=this.printAmazonPoints(oOfferData);sHTML+=this.printPromotionPriceMessage(oOfferData);sHTML+=this.printSpecialOffers(oOfferData);sHTML+=this.printPriceGuarantee(oOfferData);if(oOfferData['magazines_sub_issues'])
{sHTML+=this.printMagazinesIssueRow(oOfferData);};sHTML+='<tr style="height: 0px; line-height: 0px;"><td style="visibility: hidden;"></td><td style="visibility: hidden;"><span style="line-height: 0px;">o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o</span></td></tr>';sHTML+=this.printTrapdoor(oOfferData,true);sHTML+='</tbody></table>';sHTML+=this.printMailInRebates(oOfferData);sHTML+='</div>';}else{if(oOfferData['unavailableMessage_html']){sHTML+=oOfferData['unavailableMessage_html'];}
sHTML+=this.printTrapdoor(oOfferData,false);}
oHTMLCache[sASIN]=sHTML;}
document.getElementById(sPriceBlockDivID).innerHTML=oHTMLCache[sASIN];var cPriceBlock=document.getElementById(sPriceBlockDivID);var aPriceBlock=document.getElementById(sAnchorBlockDivID);if(cPriceBlock.offsetHeight>aPriceBlock.offsetHeight){aPriceBlock.style.height=cPriceBlock.offsetHeight;}
this.updateSubscribeFeature(oOfferData);if(useJQ){var linkID='#priceBlockTwister #mappop_'+oOfferData['asin']+'_'+oOfferData['merchantID']+'_twister';var contentURL='/gp/product/du/map-popover-update.html?a='+oOfferData['asin']+'&me='+oOfferData['merchantID'];jQuery(linkID).removeAmazonPopoverTrigger();jQuery(linkID).amazonPopoverTrigger({showOnHover:false,title:oOfferData['map_popup_title'],closeText:oOfferData['map_popup_close'],showCloseButton:true,draggable:true,width:430,locationAlign:"center",location:"bottom",destination:contentURL,closeEventInclude:"CLICK_OUTSIDE"});}}
this.clear=function(){document.getElementById(sPriceBlockDivID).innerHTML=document.getElementById(sParentPriceBlockDivID).innerHTML;var pPriceBlock=document.getElementById(sParentPriceBlockDivID);var aPriceBlock=document.getElementById(sAnchorBlockDivID);if(pPriceBlock.offsetHeight>aPriceBlock.offsetHeight){aPriceBlock.style.height=pPriceBlock.offsetHeight;}
this.updateSubscribeFeature(null);}
this.printImportListPrice=function(oOfferData){importListPriceString='';if(oOfferData['import_list_price_raw']){if(oOfferData['list_price_raw']&&oOfferData['list_price']){if(oOfferData['list_price_raw']>oOfferData['our_price_raw']){listPriceString+='<tr><td class="productLabel">'+oStrings['ListPriceLabel']
+'</td><td><b class="listprice">'+oOfferData['list_price']+'</b></td></tr>';}else{listPriceString+='<tr><td class="productLabel">'+oStrings['ListPriceLabel']
+'</td><td><b class="price">'+oOfferData['list_price']+'</b></td></tr>';}}}
return importListPriceString;}
this.printTrapdoor=function(oOfferData,isInTable){if(oOfferData['trapdoor_html']){var prefix='';var suffix='';if(isInTable){prefix='<tr><td></td><td>';suffix='</td></tr>';}
return prefix+oOfferData['trapdoor_html']+suffix;}
return'';}
this.printPriceGuarantee=function(oOfferData){listPriceString='';if(oOfferData['price_guarantee_enabled']&&oOfferData['price_guarantee_text']){listPriceString+=oOfferData['price_guarantee_text'];}
return listPriceString;}
this.printListPrice=function(oOfferData){listPriceString='';if(!oOfferData['list_price_raw']){return listPriceString;}
if((oOfferData['our_price_raw']&&oOfferData['list_price_raw']<=oOfferData['our_price_raw'])||(oOfferData['sale_price_raw']&&oOfferData['list_price_raw']<=oOfferData['sale_price_raw'])){return listPriceString;}
var priceLabel=oStrings['ListPriceLabel'];if((oOfferData['magazines_sub_issues'])&&(oOfferData['magazines_sub_months']))
{priceLabel=oStrings['CoverPriceLabel'];};listPriceString+='<tr><td '+sValignMiddle+' class="'+sListPriceBlockLabelClass+'" >'+priceLabel
+':</td><td class="listprice">'+oOfferData['list_price'];if(oOfferData['list_price_with_tax']){listPriceString+=' '+oStrings['TaxIncluded'];}
listPriceString+='</td></tr>';return listPriceString;}
this.printOurPrice=function(oOfferData){var ourPriceString='';var sSSSMessage='';if(oOfferData['was_price_raw']&&oOfferData['was_price']){if(oOfferData['was_price_breaks_map_raw']){ourPriceString+='<tr><td '+sValignMiddle+'class="'+sProductLabel+'">'+oStrings['WasText']+'</td><td>'
+oStrings['BreaksMap']+'</td></tr>';}else{ourPriceString+='<tr><td '+sValignMiddle+'class="'+sProductLabel+'">'+oStrings['WasText']+'</td><td>'
+oOfferData['was_price']+'</td></tr>';}}
if(!oOfferData['our_price_raw']){return ourPriceString;}
if(oOfferData['sale_price_raw']&&oOfferData['sale_price_raw']>=oOfferData['our_price_raw']){return ourPriceString;}
var priceLabelName=oStrings['ItemDetailPriceLabel'];if(oOfferData['was_price_raw']){priceLabelName=oStrings['NowText'];}
if(oOfferData['list_price_with_tax']&&!oOfferData['surcharge']){priceLabelName=oStrings['OurPrice'];}
var sOurPriceLabelClass=sProductLabel;if(oOfferData['sale_price_raw']){sOurPriceLabelClass=sOurPriceBlockLabelClass;}
ourPriceString+='<tr><td class="'+sOurPriceLabelClass+'">'+sBoldPrice+priceLabelName+sBoldPriceClose+'</td>';if(oOfferData['sale_price_raw']){ourPriceString+='<td><span class="listprice">'+oOfferData['our_price']+'</span>';if(oOfferData['list_price_with_tax']){ourPriceString+=' '+oStrings['TaxIncluded'];}}else{ourPriceString+='<td>'+sBoldPrice+'<span class="'+sPriceClass+'">'+oOfferData['our_price'];if(oOfferData['list_price_with_tax']){ourPriceString+=' '+oStrings['TaxIncluded'];}
ourPriceString+=sBoldPriceClose+'</span>';}
if(oOfferData['our_price_ppu']){ourPriceString+=' '+oOfferData['our_price_ppu'];}
var ssPrefix='&nbsp;';var ssSuffix='';var msgSuffix='';if(oOfferData['price_breaks_map_raw']){ssPrefix='</tr><tr><td /><td>';ssSuffix='<td/>';msgSuffix='_sa';}
if((oOfferData['magazines_sub_price_per_issue'])&&(oOfferData['isEligibleForSuperSaverShipping']))
{ourPriceString+='&nbsp;'+(oStrings['MagazineOurPriceRow'].replace('#sssThershold#',oOfferData['superSaverShippingThreshold'])).replace('#magazinePricePerIssue#',oOfferData['magazines_sub_price_per_issue']);}
else
{if(oOfferData['prime_shipping']){ourPriceString+='&nbsp;'+oOfferData['prime_shipping'];}else if(oOfferData['isEligibleForSuperSaverShipping']){if(oOfferData['isEligibleForSuperSaverShipping']==1){ourPriceString+=ssPrefix+oStrings['SSSEligible'+msgSuffix].replace('#sssThershold#',oOfferData['superSaverShippingThreshold'])+ssSuffix;}else{ourPriceString+=ssPrefix+oStrings['SSSQualifies'+msgSuffix]+ssSuffix;}}else if(oOfferData['isFreeShipping']){ourPriceString+='&nbsp;'+oStrings['freeShippingMsg'];}else if(oOfferData['fixed_shipping_charge']){ourPriceString+='&nbsp;'+oStrings['fixedShipping'].replace('#charge#',oOfferData['fixed_shipping_charge']);}else if(oOfferData['shipping_surcharge']){if(oOfferData['show_prime_shipping_surcharge']){ourPriceString+='&nbsp;'+oStrings['shippingSurchargePrime'];}else{ourPriceString+='&nbsp;'+oStrings['shippingSurcharge'].replace('#charge#',oOfferData['shipping_surcharge']);}}}
ourPriceString+='</td></tr>';return ourPriceString;}
this.printYouSaveRow=function(oOfferData){youSaveString='';if(oOfferData['price_breaks_map_raw']){return youSaveString;}
if(oOfferData['you_save_percentage']&&oOfferData['you_save']){youSaveString+='<tr><td '+sValignMiddle+'class="'+sListPriceBlockLabelClass+'">'+oStrings['PriceYouSave']+'</td>';youSaveString+='<td><span class=price>'+oOfferData['you_save']
+' ('+oOfferData['you_save_percentage']+'%)</span></td></tr>';}
return youSaveString;}
this.printSpecialOffers=function(oOfferData){if(oOfferData['promotions']==undefined){return'';}
var specialOffersString='';specialOffersString+='<tr><td class="productLabel">'
+'</td><td class="tiny">'
+'<span style="font-size: 0.86em;">'+oStrings['SpecialOffers']+'</span>'
+'</td></tr>';return specialOffersString;}
this.printSalePrice=function(oOfferData){salePriceString='';if(oOfferData['price_breaks_map_raw']){return salePriceString;}
if(oOfferData['sale_price_raw']&&oOfferData['sale_price']){salePriceString='<tr><td class="'+sProductLabel+'"><span class="price">'+sBoldPrice+oStrings['SalePriceLabel']
+sBoldPriceClose+'</span></td><td><span class="'+sPriceClass+'">'+sBoldPrice+oOfferData['sale_price']+sBoldPriceClose+'</span></td></tr>';ourPriceString='<tr><td class="'+sProductLabel+'">'+sBoldPrice+oStrings['ItemDetailPriceLabel']
+sBoldPriceClose+'</td><td class="'+sPriceClass+'">'+sBoldPrice+oOfferData['sale_price']+sBoldPriceClose+'</td></tr>';if(oOfferData['our_price_raw']&&oOfferData['our_price_raw']<=oOfferData['sale_price_raw']){return ourPriceString;}}
return salePriceString;}
this.printAmazonPoints=function(oOfferData){if(oOfferData['amazonPoints']==undefined){return'';}
var amazonPointsString='<tr><td class="productLabel">'
+'<span>'+oStrings['pointsLabel']+'</span>'
+'</td><td class="tiny">'
+'<span>'+oOfferData['amazonPoints']+'</span'
+'</td></tr>';return amazonPointsString;}
this.printPromotionPriceMessage=function(oOfferData){if(oOfferData['promotion_price_message']==undefined){return'';}
return oOfferData['promotion_price_message'];}
this.printMailInRebates=function(oOfferData){if(oOfferData['mail_in_rebates']==undefined){return'';}
return oOfferData['mail_in_rebates'];}
var subscribeTemplate=null;var subscribeDiv=null;var subscribeDivNoJS=null;this.updateSubscribeFeature=function(oOfferData){subscribeDivNoJS=document.getElementById('snsPB_noJS');if(subscribeDivNoJS!=null){subscribeDivNoJS.innerHTML='';}
var subscribeDiv=document.getElementById('snsPB');if(subscribeDiv==null)return;if(oOfferData&&((oOfferData['sns_with_amzn_buybox']==1)||(oOfferData['sns_with_amzn_mbc']==1)))
{if(oOfferData['sns_with_amzn_buybox']==1){subscribeTemplateDiv=document.getElementById('subscribe_template_div_amznbb');}else if(oOfferData['sns_with_amzn_mbc']==1){subscribeTemplateDiv=document.getElementById('subscribe_template_div_amznmbc');}
if(subscribeTemplateDiv!=null){if(jQuery&&jQuery(subscribeDiv).hasClass('sns-jq')){jQuery(subscribeDiv).empty();jQuery(subscribeTemplateDiv).children().clone(true).find('.sns-discount').text(oOfferData['subscribe_discount']).end().find('.sns-discounted-price').text(oOfferData['discounted_price']).end().find('.sns-amz-link').each(function(){this.href=this.href.replace(/ASIN/g,oOfferData['ASIN']);}).end().appendTo(subscribeDiv);}
else{var templateHTML=subscribeTemplateDiv.innerHTML;subscribeDiv.innerHTML=formatString(templateHTML,{'subscribe_discount':oOfferData['subscribe_discount'],'discounted_price':oOfferData['discounted_price'],'ASIN':oOfferData['ASIN']});}}}else{subscribeDiv.innerHTML='';}}
this.printRebateInfo=function(asin,oOfferData)
{var rebateAmount=oOfferData['rebate_amount'];var rebateHTML='';if(rebateAmount!=null)
{var numRebates=oOfferData['num_rebates'];var rebateHTMLTemplate;if(numRebates==1)
{rebateHTMLTemplate=rebateHTMLTemplateSingular;priceAfterRebateHTMLTemplate=priceAfterRebateHTMLTemplateSingular;}
else
{rebateHTMLTemplate=rebateHTMLTemplatePlural;priceAfterRebateHTMLTemplate=priceAfterRebateHTMLTemplatePlural;}
rebateHTML=formatString(rebateHTMLTemplate,{'ASIN_VAR':asin,'REBATE_AMOUNT':rebateAmount})
+formatString(priceAfterRebateHTMLTemplate,{'PRICE_AFTER_REBATE':oOfferData['price_after_rebate']});}
return rebateHTML;}
this.printMagazinesIssueRow=function(oOfferData)
{var magRowString='';if(!oOfferData['magazines_sub_issues']){return magRowString;}
if(!oOfferData['magazines_sub_months']){return magRowString;}
magRowString='<tr><td class="priceBlockLabel">'+oStrings['MagIssuesLabel']+'</td><td>'+
(oStrings['MagIssueMonth'].replace('#magIssueCount#',oOfferData['magazines_sub_issues'])).replace('#magIssueMonth#',oOfferData['magazines_sub_months'])+'</td></tr>';return magRowString;}}
// (FILE: /detail-page-features/twister-availability/twister-availability.js) 


var sFastTrackMsgDiv,sFastTrackDivSearched=false,sFastTrackOuterDivSearched=false;var lastSelectedASIN;var isFTLoading=false;var isPlatformLoading=false;var isHolidayLoading=false;function TwisterAvailability(parentAvailabilityDivID,availabilityDivID,hiddenAvailabilityDivID,moreBuyingChoicesDivID,scarcityDivID,oAvailabilityStrings,parentASIN,sessionID,scrunchEnabled){var sParentAvailabilityDivID=parentAvailabilityDivID;var sAvailabilityDivID=availabilityDivID;var sHiddenAvailabilityDivID=hiddenAvailabilityDivID;var sMoreBuyingChoicesDivID=moreBuyingChoicesDivID;var sScarcityDivID=scarcityDivID;var stringHash=oAvailabilityStrings||[];var stringsLoaded=!!(oAvailabilityStrings);var sParentASIN=parentASIN;var sSessionID=sessionID;var oAvailabilityHTMLCache=new Array();var oMoreBuyingChoicesHTMLCache=new Array();var sCurrentASIN='';var improveYourRecsRatings=new Array();var sEnableLargeBR=(gbEnableLarge&&!scrunchEnabled)?'<br>':'';this.loadStrings=function(){if(typeof(DetailPage)!='undefined'&&DetailPage.FeatureStringMap){if(DetailPage.FeatureStringMap.has('twister-availability','availability')){stringHash=DetailPage.FeatureStringMap.getValsForNamespace("twister-availability");stringsLoaded=true;}}}
this.getChildSelectionURLParam=function(){if(sCurrentASIN&&sCurrentASIN!='')
return'childASIN='+sCurrentASIN;else
return null;}
var oFmaMessageDiv;this.isFmaMessageLoading=false;this.setInitialASIN=function(asin){if(!lastSelectedASIN){lastSelectedASIN=asin;}}
this.update=function(sASIN,oOfferData,onlyUnqualifiedOffers){if(sASIN==sCurrentASIN){return;}
sCurrentASIN=sASIN;if(sASIN==null){this.clear();return;}
if(oAvailabilityHTMLCache[sASIN]==null){oAvailabilityHTMLCache[sASIN]=this.printAvailability(oOfferData,onlyUnqualifiedOffers);}
if(oMoreBuyingChoicesHTMLCache[sASIN]==null){oMoreBuyingChoicesHTMLCache[sASIN]=this.printMoreBuyingChoices(oOfferData);}
document.getElementById(sAvailabilityDivID).innerHTML=oAvailabilityHTMLCache[sASIN];if(document.getElementById(sMoreBuyingChoicesDivID)){document.getElementById(sMoreBuyingChoicesDivID).innerHTML=oMoreBuyingChoicesHTMLCache[sASIN];}
document.getElementById(sScarcityDivID).innerHTML=this.printScarcityMsg(oOfferData);var cAvailBlock=document.getElementById(sAvailabilityDivID);var pAvailBlock=document.getElementById(sParentAvailabilityDivID);var hAvailBlock=document.getElementById(sHiddenAvailabilityDivID);if(cAvailBlock.offsetHeight>hAvailBlock.offsetHeight){hAvailBlock.style.height=cAvailBlock.offsetHeight;}
cAvailBlock.style.visibility='visible';pAvailBlock.style.visibility='hidden';this.handleShippingContainerMessaging(sCurrentASIN,oOfferData);}
this.clear=function(){document.getElementById(sAvailabilityDivID).innerHTML=document.getElementById(sParentAvailabilityDivID).innerHTML;if(document.getElementById(sMoreBuyingChoicesDivID)){document.getElementById(sMoreBuyingChoicesDivID).innerHTML='';}
document.getElementById(sScarcityDivID).innerHTML='';this.onPreviewEvent();}
this.printAvailability=function(oOfferData,onlyUnqualifiedOffers){availString='';if(onlyUnqualifiedOffers||!oOfferData['avail_message']||!oOfferData['availabilityCondition']){return availString;}
if(!stringsLoaded){this.loadStrings();}
merchantID=oOfferData['merchantID'];merchantName=oOfferData['merchantName'];if(!gbEnableLarge){availString+='<b>'+stringHash['availability']+'</b> ';}
availString+=oOfferData['avail_message']+sEnableLargeBR;if(gbShowProdAvailChart){availString+=' '+stringHash['see']+' <a href="/gp/product/product-availability/'+sParentASIN+'/ref=dp_availability_1/'+sSessionID+'?%5Fencoding=UTF8&m='+merchantID+'" onClick="return amz_js_PopWin('+"'"+'/gp/product/product-availability/'
+sParentASIN+'/ref=dp_availability_1/'+sSessionID+'?%5Fencoding=UTF8&m='+merchantID
+"','AmazonHelp','width=570,height=600,resizable=1,scrollbars=1,toolbar=0,status=1');"+'"'+' >'+stringHash['price_and_avail']+sEnableLargeBR;}
if(oOfferData['isSSOF']){availString+=' '+goTwisterBuyboxStrings['soldShipByAmazon'].replace("defaultMerchant",'<a href="/gp/help/seller/at-a-glance.html/'+sSessionID+'?%5Fencoding=UTF8&seller='+merchantID+'">'+merchantName+'</a>');}else{availString+=' '+stringHash['ships_from']+' <a href="/gp/help/seller/at-a-glance.html/'+sSessionID+'?%5Fencoding=UTF8&seller='+merchantID+'">'+merchantName+'</a>.';}
if(oOfferData['giftWrapMessage']){availString+=oOfferData['giftWrapMessage'];}
return availString;}
this.printMoreBuyingChoices=function(oOfferData){var sHTML='';var nAvailCond=oOfferData['availabilityCondition'];var nUsedAndNew=oOfferData['usedAndNewCount'];if((nAvailCond&&nUsedAndNew<=1)||(!nAvailCond&&nUsedAndNew<=0)){return sHTML;}
if(!stringsLoaded){this.loadStrings();}
var sPrice=oOfferData['usedAndNewLowestPrice'];if(sPrice){sHTML+='<b><a href="/gp/offer-listing/'+oOfferData['ASIN']+'/'+sSessionID+'">';sHTML+=(nAvailCond)?((nUsedAndNew-1)+' '):((nUsedAndNew)+' ');sHTML+=(nUsedAndNew>=3)?stringHash['more_buying_choices']:stringHash['more_buying_choice'];sHTML+='</a>';if(!oOfferData['usedAndNewLowestPriceBreaksMAP']){sHTML+=' ';sHTML+=(nUsedAndNew>=3)?stringHash['from']:stringHash['at'];sHTML+=' '+'<span class="price">'+sPrice+'</span>';}
sHTML+='</b>';}
return sHTML;}
this.printScarcityMsg=function(oOfferData){if(oOfferData['scarcityMsg']&&!oOfferData['is_preorder']){return oOfferData['scarcityMsg'];}
return'';}
this.onSelectEvent=function(currentSelectedASIN,offerDataNewASIN)
{initializeFma();isPlatformLoading=true;if(lastSelectedASIN!=null&&lastSelectedASIN!=currentSelectedASIN)
{fadeFastTrack();fadeViewWiaRichMedia();fadePlatformInformationAndESRBRating();isFTLoading=true;fadeHolidayMsg();isHolidayLoading=true;this.fadeFmaMessage();this.isFmaMessageLoading=true;}
else
{isFTLoading=false;fadeFastTrack(false);fadeViewWiaRichMedia(false);fadePlatformInformationAndESRBRating(false);this.isFmaMessageLoading=false;this.fadeFmaMessage(false);}
lastSelectedASIN=currentSelectedASIN;var ftTimerDiv=document.getElementById("fast-track_feature_div");if(ftTimerDiv&&ftTimerDiv.style)
{if(currentSelectedASIN==null)
ftTimerDiv.style.display='none';else
ftTimerDiv.style.display='block';}
if(oFmaMessageDiv){if(currentSelectedASIN==null){oFmaMessageDiv.style.display='none';}else{oFmaMessageDiv.style.display='block';}}
var holidayDiv=document.getElementById('holiday-availability-messaging_feature_div');if(holidayDiv){if(currentSelectedASIN==null){holidayDiv.innerHTML='';}}
this.handleShippingContainerMessaging(currentSelectedASIN,offerDataNewASIN);}
this.onPreviewEvent=function(currentSelectedASIN,offerDataNewASIN,anyVariationsSelected)
{this.handleFastTrackMessaging(currentSelectedASIN,anyVariationsSelected);this.handleShippingContainerMessaging(currentSelectedASIN,offerDataNewASIN);this.handlePlatformInformationAndESRBRating(currentSelectedASIN,anyVariationsSelected);this.handleHolidayMsg(currentSelectedASIN,anyVariationsSelected);initializeFma();this.fadeFmaMessage(lastSelectedASIN!=currentSelectedASIN);}
this.handleFastTrackMessaging=function(currentSelectedASIN,anyVariationsSelected)
{if(!sFastTrackDivSearched)
{setFastTrackDivHandle();}
if(sFastTrackMsgDiv==null||lastSelectedASIN==null||(!anyVariationsSelected&&currentSelectedASIN==null))
{return;}
var hoverOtherAsin=(lastSelectedASIN!=currentSelectedASIN);if(sFastTrackMsgDiv.style){fadeFastTrack(hoverOtherAsin);}}
this.handlePlatformInformationAndESRBRating=function(currentSelectedASIN,anyVariationsSelected)
{var hoverOtherAsin=(lastSelectedASIN!=currentSelectedASIN);fadePlatformInformationAndESRBRating(hoverOtherAsin);}
this.handleHolidayMsg=function(currentSelectedASIN,anyVariationsSelected){var hoverOtherAsin=(lastSelectedASIN!=currentSelectedASIN);fadeHolidayMsg(hoverOtherAsin);}
var shippingMsgDivsSearched=false;var shippingCanWrapMsgDiv,shippingNoWrapMsgDiv;var lastShippingStat;this.handleShippingContainerMessaging=function(asin,offerData){if(!shippingMsgDivsSearched){shippingCanWrapMsgDiv=document.getElementById('overwrapContainerMsgDiv');shippingNoWrapMsgDiv=document.getElementById('noOverwrapContainerMsgDiv');shippingMsgDivsSearched=true;}
if(shippingCanWrapMsgDiv==null)
return;if(asin==null||offerData==null){shippingCanWrapMsgDiv.style.display='none';shippingNoWrapMsgDiv.style.display='none';lastShippingStat=null;return;}
var shippingStat=offerData['shipping_status'];if(shippingStat==lastShippingStat){}else if(shippingStat!=null){if(shippingStat==WRAP_CONTAINER_STATUS){shippingCanWrapMsgDiv.style.display='block';shippingNoWrapMsgDiv.style.display='none';}else if(shippingStat==NO_WRAP_CONTAINER_STATUS){shippingNoWrapMsgDiv.style.display='block';shippingCanWrapMsgDiv.style.display='none';}else{shippingNoWrapMsgDiv.style.display='none';shippingCanWrapMsgDiv.style.display='none';}}else{shippingCanWrapMsgDiv.style.display='none';shippingNoWrapMsgDiv.style.display='none';}
lastShippingStat=shippingStat;}
this.fadeFmaMessage=function(val){if(this.isFmaMessageLoading){return;}else if(oFmaMessageDiv){if(val==null||val==true){fadeDiv(oFmaMessageDiv,25);}else{unfadeDiv(oFmaMessageDiv);}}}
var initializeFma=function(){if(!oFmaMessageDiv){oFmaMessageDiv=document.getElementById("fma-seller-messages_feature_div");if(oFmaMessageDiv){oFmaMessageDiv.style.width="100%";}}}}
function setFastTrackDivHandle()
{sFastTrackMsgDiv=document.getElementById("fast-track_feature_div");sFastTrackMsgDiv.style.width="100%";sFastTrackDivSearched=true;}
function fadeViewWiaRichMedia(val,ignoreIsFTLLoading){fadeFeature(val,"view-wia-rich-media_feature_div",ignoreIsFTLLoading);}
function fadePlatformInformationAndESRBRating(val,ignoreIsFTLLoading){fadeFeature(val,"platform-information-and-esrb-rating_feature_div",ignoreIsFTLLoading);}
function fadeHolidayMsg(val){if(isHolidayLoading)
return;var theDiv=document.getElementById('holiday-availability-messaging_feature_div');if(theDiv&&(val==null||val==true)){theDiv.style.width='100%';fadeDiv(theDiv,25);}else if(theDiv&&val==false){unfadeDiv(theDiv);}}
function fadeFeature(val,featurename,ignoreIsFTLLoading)
{if(isPlatformLoading){return;}
var theDiv=document.getElementById(featurename);if(theDiv&&(val==null||val==true)){fadeDiv(theDiv,25);}else if(theDiv&&val==false){unfadeDiv(theDiv);}}
function fadeFastTrack(val)
{if(isFTLoading)
return;if(sFastTrackMsgDiv)
{if(val==null||val==true)
{fadeDiv(sFastTrackMsgDiv,25);}
else if(val==false)
{unfadeDiv(sFastTrackMsgDiv);}}}
var secondsLeft=new Object();var secondsLeftUpdateTime=new Object();function onAjaxUpdate_fast_track(asin,initialLoad)
{var timerDiv=document.getElementById("ftMessageTimer");var cuttOffElems=document.getElementsByName("promise-cutoff-time."+asin);if(!initialLoad)
lastSelectedASIN=asin;if(cuttOffElems==null||cuttOffElems.length==0)
return;FT_CurrentDisplayMin=-1;if(timerDiv&&timerDiv.style)
{timerDiv.style.display='inline';if(initialLoad==null||initialLoad==false)
{timerDiv.style.margin='3px';}}
var cutOffTimeVal=cuttOffElems[0].value;var cutOffTime=parseInt(cutOffTimeVal);var currSecs=new Date().getTime()/1000;var secsLeft=(cutOffTime-currSecs);secondsLeft[asin]=secsLeft;FT_getCountdown(secsLeft);secondsLeftUpdateTime[asin]=currSecs;isFTLoading=false;fadeFastTrack(false);}
function onCacheUpdate_fast_track(asin)
{var timerDiv=document.getElementById("ftMessageTimer");if(timerDiv&&timerDiv.style)
{timerDiv.style.display='inline';timerDiv.style.margin='3px';}
FT_CurrentDisplayMin=-1;var lastUpdTimeSecs=secondsLeftUpdateTime[asin];var elapsedTimeSecs=new Date().getSeconds()-lastUpdTimeSecs;var newSecondsLeft=secondsLeft[asin]-elapsedTimeSecs;lastSelectedASIN=asin;isFTLoading=false;fadeFastTrack(false);}
function onCacheUpdate_improve_your_recs(asin){if(typeof window.improve_your_recs_show_ratings!=='undefined'){improve_your_recs_show_ratings(asin);}
else{var asin='';var rating='';var isOwned='';var isPurchase='';var aDiv=document.getElementById("improve-your-recs-asin");if(aDiv&&aDiv.value){asin=aDiv.value;}
aDiv=document.getElementById("improve-your-recs-rating");if(aDiv&&aDiv.value){rating=aDiv.value;}
aDiv=document.getElementById("improve-your-recs-isOwned");if(aDiv&&aDiv.value){isOwned=aDiv.value;}
aDiv=document.getElementById("improve-your-recs-isPurchase");if(aDiv&&aDiv.value){isPurchase=aDiv.value;}
if(asinRatingMap[asin]){rating=asinRatingMap[asin];}
if(asin&&rating&&isOwned&&isPurchase){aDiv=document.getElementById("improve-your-recs-stars");if(aDiv&&aDiv.innerHTML){var starsHTML=amz_js_showMessagesString(asin,rating)+"<br>";starsHTML+=""+amz_js_showStarsString(asin,rating)+"&nbsp;&nbsp;";if(isPurchase==0){starsHTML+=amz_js_showIsOwnedString(asin,isOwned)+"&nbsp;";starsHTML+=amz_js_showIsOwnedMessagesString(asin);}
aDiv.innerHTML=starsHTML;}}}}
function onAjaxUpdate_improve_your_recs(asin,initialLoad){if(typeof window.improve_your_recs_show_ratings!=='undefined'){improve_your_recs_show_ratings(asin);}
else{var asin='';var rating='';var isOwned='';var isPurchase='';var aDiv=document.getElementById("improve-your-recs-asin");if(aDiv&&aDiv.value){asin=aDiv.value;}
aDiv=document.getElementById("improve-your-recs-rating");if(aDiv&&aDiv.value){rating=aDiv.value;}
aDiv=document.getElementById("improve-your-recs-isOwned");if(aDiv&&aDiv.value){isOwned=aDiv.value;}
aDiv=document.getElementById("improve-your-recs-isPurchase");if(aDiv&&aDiv.value){isPurchase=aDiv.value;}
if(asin&&rating&&isOwned&&isPurchase){aDiv=document.getElementById("improve-your-recs-stars");if(aDiv&&aDiv.innerHTML){var starsHTML=amz_js_showMessagesString(asin,rating)+"<br>";starsHTML+=""+amz_js_showStarsString(asin,rating)+"&nbsp;&nbsp;";if(isPurchase==0){starsHTML+=amz_js_showIsOwnedString(asin,isOwned)+"&nbsp;";starsHTML+=amz_js_showIsOwnedMessagesString(asin);}
aDiv.innerHTML=starsHTML;}}}}
function onAjaxUpdate_fma_seller_messages(asin,initialLoad){goTwisterAvailability.isFmaMessageLoading=false;goTwisterAvailability.fadeFmaMessage(false);}
function onCacheUpdate_fma_seller_messages(asin){goTwisterAvailability.isFmaMessageLoading=false;goTwisterAvailability.fadeFmaMessage(false);}
function onCacheUpdate_view_wia_rich_media(asin,initialLoad){fadeViewWiaRichMedia(false);}
function onAjaxUpdate_view_wia_rich_media(asin,initialLoad){fadeViewWiaRichMedia(false);}
function onCacheUpdate_holiday_availability_messaging(asin,initialLoad){isHolidayLoading=false;fadeHolidayMsg(false);}
function onAjaxUpdate_holiday_availability_messaging(asin,initialLoad){isHolidayLoading=false;fadeHolidayMsg(false);}
function onCacheUpdate_platform_information_and_esrb_rating(asin,initialLoad){if(typeof goTwisterManager!='undefined'){isPlatformLoading=false;fadePlatformInformationAndESRBRating(false,true);goTwisterManager.callCacheUpdate("ias-content-provider-ratings",asin);goTwisterManager.callCacheUpdate("esrb-rating",asin);goTwisterManager.callCacheUpdate("platform-information",asin);goTwisterManager.callCacheUpdate("average-customer-reviews",asin);}else if(typeof DetailPageFramework!='undefined'){DetailPageFramework.executeLegacyCallback("ias-content-provider-ratings","onCacheUpdate",asin);DetailPageFramework.executeLegacyCallback("esrb-rating","onCacheUpdate",asin);DetailPageFramework.executeLegacyCallback("platform-information","onCacheUpdate",asin);DetailPageFramework.executeLegacyCallback("average-customer-reviews","onCacheUpdate",asin);}}
function onAjaxUpdate_platform_information_and_esrb_rating(asin,initialLoad){if(typeof goTwisterManager!='undefined'){isPlatformLoading=false;fadePlatformInformationAndESRBRating(false,true);goTwisterManager.callAjaxUpdate("ias-content-provider-ratings",asin);goTwisterManager.callAjaxUpdate("esrb-rating",asin);goTwisterManager.callAjaxUpdate("platform-information",asin);goTwisterManager.callAjaxUpdate("average-customer-reviews",asin);}else if(typeof DetailPageFramework!='undefined'){DetailPageFramework.executeLegacyCallback("ias-content-provider-ratings","onAjaxUpdate",asin);DetailPageFramework.executeLegacyCallback("esrb-rating","onAjaxUpdate",asin);DetailPageFramework.executeLegacyCallback("platform-information","onAjaxUpdate",asin);DetailPageFramework.executeLegacyCallback("average-customer-reviews","onAjaxUpdate",asin);}}
function onCacheReselectUpdate_platform_information_and_esrb_rating(asin,initialLoad){if(typeof goTwisterManager!='undefined'){goTwisterManager.callCacheReselectUpdate("ias-content-provider-ratings",asin);goTwisterManager.callCacheReselectUpdate("esrb-rating",asin);goTwisterManager.callCacheReselectUpdate("platform-information",asin);goTwisterManager.callCacheReselectUpdate("average-customer-reviews",asin);}else if(typeof DetailPageFramework!='undefined'){DetailPageFramework.executeLegacyCallback("ias-content-provider-ratings","onCacheReselectUpdate",asin);DetailPageFramework.executeLegacyCallback("esrb-rating","onCacheReselectUpdate",asin);DetailPageFramework.executeLegacyCallback("platform-information","onCacheReselectUpdate",asin);DetailPageFramework.executeLegacyCallback("average-customer-reviews","onCacheReselectUpdate",asin);}}
function onAjaxUpdate_instant_order_update(asin,initialLoad){var aDiv=document.getElementById("instant-order-update_feature_div");if(aDiv==null||aDiv.innerHTML==null||aDiv.innerHTML.length<15){aDiv.style.display='none';}else{aDiv.style.display='block';}
unfadeDiv(aDiv,false);}
function onCacheUpdate_instant_order_update(asin,initialLoad){goTwisterManager.callAjaxUpdate("instant-order-update",asin);}
// (FILE: /dp-framework/DetailPageFramework.Namespace.js) 


if(typeof DetailPageFramework=='undefined'){var DetailPageFramework={};DetailPageFramework.registration={};DetailPageFramework.registration.pending={};DetailPageFramework.registration.handlers={};DetailPageFramework.register=function(data_type,key,value){if(DetailPageFramework.registration.handlers[data_type]){DetailPageFramework.registration.handlers[data_type](key,value);return;}
if(!DetailPageFramework.registration.pending[data_type]){DetailPageFramework.registration.pending[data_type]={};}
if(!DetailPageFramework.registration.pending[data_type][key]){DetailPageFramework.registration.pending[data_type][key]=[];}
DetailPageFramework.registration.pending[data_type][key].push(value);}
DetailPageFramework.registerFeatureConfig=function(feature_id,config){DetailPageFramework.register("feature_config",feature_id,config);}
DetailPageFramework.registerCallback=function(callback_name,feature_id,fn){var validCallbacks={'initialize':true,'document_ready':true,'swatch_hover':true,'asin_select':true,'asin_deselect':true,'ajax_request':true,'ajax_success':true,'before_redraw':true,'after_redraw':true,'redraw_ignore':true};if(!validCallbacks[callback_name]){}
DetailPageFramework.register('callbacks-'+feature_id,callback_name,fn);}
DetailPageFramework.registerString=function(namespace,key,value){if(namespace.indexOf("%")>-1||key.indexOf("%")>-1){if(typeof console!='undefined'){console.error("% found in array index in DetailPageFramework.registerString");return;}}
var hashKey=namespace+"%"+key;DetailPageFramework.register("string",hashKey,value);}
DetailPageFramework.registerHandler=function(data_type,fn){DetailPageFramework.registration.handlers[data_type]=fn;if(DetailPageFramework.registration.pending[data_type]){var pending=DetailPageFramework.registration.pending[data_type];for(var key in pending){for(var i=0;i<pending[key].length;i++){fn(key,pending[key][i]);}}
DetailPageFramework.registration.pending[data_type]={};}}}
// (FILE: /dp-framework/DetailPageFramework.StateController.js) 


(function($){DetailPageFramework.featuresToRegister=[];DetailPageFramework.registerFeature=function(feature,eventTypes,highPriority){if(typeof DetailPage!='undefined'&&typeof DetailPage.StateController!='undefined'){DetailPage.StateController.registerFeature(feature,eventTypes,highPriority);}else{DetailPageFramework.featuresToRegister.push({feature:feature,eventTypes:eventTypes,highPriority:highPriority});}};DetailPageFramework.StateController=function(initialState){var EVENT_TYPES={'swatch_hover':false,'swatch_hover_off':false,'swatch_select':false,'child_select':true,'child_deselect':true,'window_onload':false,'ajax_start':false,'ajax_success':false,'ajax_error':false,'update_start':false,'update_finish':false};var STATE_ATTRIBUTES=['is_dpm','parent_asin','current_asin','current_hovered_asin','selected_variations','hovered_variations','num_dimensions_selected','num_dimensions_hovered','current_offer','variation_dimensions','variation_display_labels','store_id','product_group_id','exclusive_merchant_id','sid','rid','view'];var STAGGER_TIME=50;var useStaggeredUpdate=!($.browser.mozilla||$.browser.safari);var notificationQueue=[];var isPageLoaded=false;var dpState=$.extend({},initialState);var registeredFeatures={high:{},low:{}};var featureErrors=[];for(var event in EVENT_TYPES){registeredFeatures.high[event]=[];registeredFeatures.low[event]=[];}
for(var i=0;i<STATE_ATTRIBUTES.length;i++){dpState[STATE_ATTRIBUTES[i]]=null;}
this.getFeatureErrors=function(){return featureErrors;};this.notify=function(eventType,details){if(eventType=='window_onload'){isPageLoaded=true;for(var i=0;i<notificationQueue.length;i++){var notification=notificationQueue[i];this.notify(notification.eventType,notification.details);}}
if(isPageLoaded||!EVENT_TYPES[eventType]){var features=registeredFeatures.high[eventType].concat(registeredFeatures.low[eventType]);if(features){$.extend(dpState,details);var timer=0;for(var i=0;i<features.length;i++){try{var notifyFunc=function(feature){return function(){feature.notify(eventType,dpState);};}(features[i]);if(EVENT_TYPES[eventType]){setTimeout(notifyFunc,timer);if(useStaggeredUpdate){timer+=STAGGER_TIME;}}else{notifyFunc();}}catch(e){featureErrors.push(e);}}}}else if(EVENT_TYPES[eventType]){notificationQueue.push({eventType:eventType,details:details});}};this.registerFeature=function(feature,eventTypes,highPriority){if(!(feature&&feature.notify&&typeof feature.notify=='function'))
return false;var featureQueue=highPriority?registeredFeatures.high:registeredFeatures.low;if(!eventTypes){for(var event in featureQueue){featureQueue[event].push(feature);}}else{for(var i=0;i<eventTypes.length;i++){if(featureQueue[eventTypes[i]]){featureQueue[eventTypes[i]].push(feature);}}}
return true;};for(var i=0;i<DetailPageFramework.featuresToRegister.length;i++){var feature=DetailPageFramework.featuresToRegister[i];this.registerFeature(feature.feature,feature.eventTypes,feature.highPriority);}
this.getState=function(){return dpState;};this.setState=function(attribute,val){dpState[attribute]=val;};};})(jQuery);
// (FILE: /dp-framework/DetailPageFramework.Model.js) 


(function($){DetailPageFramework.Model=function(handlers){var ajaxHandlers=handlers;var data={};var pendingCallbacks={};var hashFunctions={};var prefetchQueues={};var jsonCache={};var ajaxFailures=0;var FETCH_MAX=2;var AJAX_FAILURE_MAX=10;var hash=function(key,dataType){var handler=ajaxHandlers[dataType];if(handler){var hashFunc=handler.hash;if(hashFunc&&typeof hashFunc=='function'){return hashFunc(key);}else if(typeof key=='string'){return key;}}
return null;};var setData=function(dataType,newData){for(var hashKey in newData){if(!data[hashKey]){data[hashKey]={};}
data[hashKey][dataType]=newData[hashKey];}};var requestData=function(keys,dataType,onSuccess){if(ajaxFailures>=AJAX_FAILURE_MAX){return false;}
var handler=ajaxHandlers[dataType];if(handler&&handler.url){var args;if(handler.argHandler&&typeof handler.argHandler=='function'){args=handler.argHandler(keys);}else{args=getRequestArgs(keys);}
DetailPage.StateController.notify("ajax_start",{ajax_data_type:dataType,ajax_keys:keys});$.ajax({cache:false,dataType:'json',url:handler.url+args,timeout:40000,success:function(d){setData(dataType,d);DetailPage.StateController.notify("ajax_success",{ajax_data_type:dataType,ajax_keys:keys});runPendingCallbacks(keys,dataType);if(onSuccess){onSuccess();}},error:function(){ajaxFailures++;DetailPage.StateController.notify("ajax_error",{ajax_data_type:dataType,ajax_keys:keys});for(var key in keys){clearData(key,dataType);}
if(ajaxFailures<AJAX_FAILURE_MAX){requestData(keys,dataType,onSuccess);}else{ajaxFailures=0;}}});return true;}
return false;};var getRequestArgs=function(asins){var argString='?asinList=';for(var i=0;i<asins.length;i++){argString+=asins[i]+',';}
var dpState=DetailPage.StateController.getState();var args={PowerBar:'0',pfWrapFeatures:'0',productGroupID:dpState['product_group_id'],rid:dpState['rid'],sid:dpState['sid'],storeID:dpState['store_id']};for(var attr in args){if(args[attr]){argString+='&'+attr+'='+args[attr];}}
return argString;};var addPendingCallback=function(key,dataType,callback){var hashKey=hash(key,dataType);if(!pendingCallbacks[hashKey])
pendingCallbacks[hashKey]={};if(callback&&typeof callback=='function'){if(pendingCallbacks[hashKey][dataType]){pendingCallbacks[hashKey][dataType].push(callback);}else{pendingCallbacks[hashKey][dataType]=[callback];}}};var runPendingCallbacks=function(keys,dataType){for(var i=0;i<keys.length;i++){var key=keys[i];var hashKey=hash(key,dataType);var callbacks=getCallbacks(key,dataType);var keyData=getData(key,dataType);if(!keyData){continue;}
if(callbacks){var timer=0;for(var j=0;j<callbacks.length;j++){var callbackFunc=function(callback){var localKey=key;return function(){DetailPage.Model.fetch(localKey,dataType,callback);};}(callbacks[j]);setTimeout(callbackFunc,timer);timer+=50;}
pendingCallbacks[hashKey][dataType]=[];}}};var setPending=function(key,dataType){var pendingData={};pendingData[hash(key,dataType)]='pending';setData(dataType,pendingData);};var clearData=function(key,dataType){var clear={};clear[hash(key,dataType)]=null;setData(dataType,clear);};var getData=function(key,dataType){var hashKey=hash(key,dataType);return data[hashKey]?data[hashKey][dataType]:null;};var getCallbacks=function(key,dataType){var hashKey=hash(key,dataType);return pendingCallbacks[hashKey]?pendingCallbacks[hashKey][dataType]:null;};this.getHash=function(key,dataType){return hash(key,dataType);}
this.getData=getData;this.setData=setData;this.fetch=function(key,dataType,callback){if(key&&key!=''&&dataType&&dataType!=''){var hashKey=hash(key,dataType);var requestedData=getData(key,dataType);if(requestedData=='pending'){addPendingCallback(key,dataType,callback);}else if(requestedData){if(typeof callback=='function'){try{callback(key,requestedData);}catch(err){}}
return true;}else{var requestSent=requestData([key],dataType);if(requestSent){addPendingCallback(key,dataType,callback);setPending(key,dataType);}}}else{}
return false;};this.enqueue=function(keys,dataType){if(!prefetchQueues[dataType]){prefetchQueues[dataType]=[];}
prefetchQueues[dataType]=prefetchQueues[dataType].concat(keys);};this.fetchQueue=function(dataType,numFetchesRequired){var keys=prefetchQueues[dataType];if(!keys||keys.length<1){return;}
prefetchQueues[dataType]=[];this.prefetch(keys,dataType,numFetchesRequired);};this.prefetch=function(keys,dataType,numFetchesRequired){var filteredKeys=[];var queuedKeys=[];for(var i=0;i<keys.length;i++){var key=keys[i];var keyData=getData(key,dataType);if(!keyData){if(filteredKeys.length<FETCH_MAX){filteredKeys.push(key);setPending(key,dataType);}else{queuedKeys.push(key);}}}
if(filteredKeys.length>0){if(numFetchesRequired==null){numFetchesRequired=Math.ceil((filteredKeys.length+queuedKeys.length)/FETCH_MAX);}else if(numFetchesRequired<=0){for(var i=0;i<filteredKeys.length;i++){clearData(filteredKeys[i],dataType);}
return;}
var obj=this;requestData(filteredKeys,dataType,function(){obj.fetchQueue(dataType,--numFetchesRequired);});if(queuedKeys.length>0){this.enqueue(queuedKeys,dataType);}}};this.loaded=function(key,dataType){if(key&&key!=''&&dataType&&dataType!=''){var requestedData=getData(key,dataType);return(requestedData&&requestedData!='pending');}else{return false;}};this.pending=function(key,dataType){if(key&&key!=''&&dataType&&dataType!=''){var requestedData=getData(key,dataType);return(requestedData&&requestedData=='pending');}else{return false;}};this.getJSONObj=function(asin,dataType,feature,dataStr){if(jsonCache[asin+dataType+feature]){return jsonCache[asin+dataType+feature];}
if(dataStr){try{var jsonObj=eval('('+dataStr+')');jsonCache[asin+dataType+feature]=jsonObj;return jsonObj;}catch(e){}}
return;}};})(jQuery);
// (FILE: /dp-framework/DetailPageFramework.Adapter.js) 


(function($){DetailPageFramework.Adapter=function(feature_id,options){this.name=feature_id;this.feature_id=feature_id;this.validateOptions(options);this.data_type=(options&&options.dataType)?options.dataType:'';this.div_id=(options&&options.div)?options.div:feature_id+'_feature_div';this.element=false;this.loading_bar=(options&&options.loadingBar);this.fade_on_hover=(options&&options.fadeOnHover);this.update_on_hover=(options&&options.updateOnHover);this.hide_on_deselect=(options&&options.hideOnDeselect);this.run_remote_scripts=(options&&options.runRemoteScripts);this.disable_legacy_callbacks=(options&&options.disableLegacyCallbacks);this.high_priority=(options&&options.priority&&options.priority=='high');this.suppress_default_behavior=(options&&options.suppressDefaultBehavior);this.suppress_fade=(options&&options.suppressFade);this.parent_on_deselect=(options&&options.parentOnDeselect);this.callbacks={};DetailPage.StateController.registerFeature(this,['child_select','child_deselect','swatch_hover','window_onload'],this.high_priority);this.registerCallbackHandler();this.executeCallback('initialize',DetailPage.StateController.getState());};DetailPageFramework.Adapter.prototype.validateOptions=function(options){if(!(options&&(options.dataType||options.suppressDefaultBehavior))){}
if(options&&options.priority&&options.priority!='low'&&options.priority!='high'){}}
DetailPageFramework.Adapter.prototype.registerCallbackHandler=function(){var obj=this;DetailPageFramework.registerHandler("callbacks-"+obj.feature_id,function(name,fn){if(typeof obj.callbacks[name]=='undefined'){obj.callbacks[name]=[];}
obj.callbacks[name].push(fn);});};DetailPageFramework.Adapter.prototype.showLoadingBar=function(){if(!this.loading_bar)return;var feature_div=$('#'+this.div_id);if(feature_div.length>0){if(!feature_div.attr('loadingBarSet')){feature_div.attr('loadingBarSet','1');var headerDiv=feature_div.find('h2, h1, b');if(headerDiv.length>0){headerDiv=$(headerDiv[0]);headerDiv.css({display:'inline',padding:'0px'});headerDiv.after($(featureLoadingBarHTML));}}}else{}};DetailPageFramework.Adapter.prototype.fadeOut=function(){if(!this.suppress_fade&&!(this.element.length==0||this.element.is(':hidden')||$.trim(this.element.get(0).innerHTML).length==0)){this.element.css('opacity','0.5');}};DetailPageFramework.Adapter.prototype.fadeIn=function(){if(!this.suppress_fade){this.element.css({opacity:'',zoom:'0'});}};DetailPageFramework.Adapter.prototype.notify=function(eventType,dpState){if(!this.init()||(this.element.attr('display')=='none'))return false;if(eventType=='child_deselect'){this.executeCallback('asin_deselect',DetailPage.StateController.getState());if(this.suppress_default_behavior){return;}
if(this.hide_on_deselect){this.element.hide();}
if(this.parent_on_deselect){var isCached=DetailPage.Model.loaded(dpState['parent_asin'],this.data_type);if(!isCached){this.executeCallback('ajax_request',dpState['parent_asin']);}
DetailPage.Model.fetch(dpState['parent_asin'],this.data_type,this.getUpdater(isCached));if(!isCached){this.fadeOut();}}}else if(eventType=='child_select'){if(dpState['current_asin']){this.executeCallback('asin_select',DetailPage.StateController.getState());if(this.suppress_default_behavior){return;}
var isCached=DetailPage.Model.loaded(dpState['current_asin'],this.data_type);if(!isCached){this.executeCallback('ajax_request',dpState['current_asin']);}
DetailPage.Model.fetch(dpState['current_asin'],this.data_type,this.getUpdater(isCached));if(!isCached){this.fadeOut();this.showLoadingBar();}}}
else if(eventType=='swatch_hover'){this.executeCallback('swatch_hover',DetailPage.StateController.getState());if(this.suppress_default_behavior){return;}
if(this.update_on_hover){var asin=dpState['current_hovered_asin'];if(asin==null){asin=dpState['parent_asin'];}
var isCached=DetailPage.Model.loaded(asin,this.data_type);if(!isCached){this.executeCallback('ajax_request',asin);}
DetailPage.Model.fetch(asin,this.data_type,this.getUpdater(isCached,true));}else if(this.fade_on_hover){if(dpState['current_hovered_asin']==dpState['current_asin']&&!this.request_pending(dpState['current_asin'])){this.fadeIn();}else{this.fadeOut();}}}
else if(eventType=='window_onload'){this.executeCallback('document_ready',DetailPage.StateController.getState());}};DetailPageFramework.Adapter.prototype.getUpdater=function(isCached,isHover){var obj=this;return function(asin,asinData){var dpState=DetailPage.StateController.getState();if(!isCached){obj.executeCallback('ajax_success',asin,asinData[obj.feature_id]);}
if(!isHover&&dpState['current_asin']&&asin!=dpState['current_asin']){obj.executeCallback('redraw_ignore',dpState,asinData[obj.feature_id]);return;}else if(isHover&&dpState['current_hovered_asin']&&asin!=dpState['current_hovered_asin']){obj.executeCallback('redraw_ignore',dpState,asinData[obj.feature_id]);return;}
if(!obj.init()){return;}
obj.executeCallback('before_redraw',dpState,asinData[obj.feature_id]);if(typeof asinData[obj.feature_id]=='undefined'){obj.element.hide();return;}
if(obj.run_remote_scripts){obj.element.html(asinData[obj.feature_id]);}else{var rawElement=obj.element.get(0);if(rawElement){rawElement.innerHTML=asinData[obj.feature_id];}}
obj.element.removeAttr('loadingBarSet');obj.fadeIn();if($.trim(asinData[obj.feature_id]).length==0){obj.element.hide();}else{obj.element.show();}
obj.executeCallback('after_redraw',dpState,asinData[obj.feature_id]);if(!obj.disable_legacy_callbacks){if(isCached){DetailPageFramework.executeLegacyCallback(obj.feature_id,"onCacheUpdate",asin);}else{DetailPageFramework.executeLegacyCallback(obj.feature_id,"onAjaxUpdate",asin);}}};};DetailPageFramework.Adapter.prototype.request_pending=function(asin){return DetailPage.Model.pending(asin,this.data_type);};DetailPageFramework.Adapter.prototype.init=function(){if(!this.element||this.element.length==0){this.element=$('#'+this.div_id);if(!this.element){}}
return this.element;};DetailPageFramework.Adapter.prototype.executeCallback=function(callback_name,param1,param2){if(!this.callbacks[callback_name]){return;}
for(var i=0;i<this.callbacks[callback_name].length;i++){var func=this.callbacks[callback_name][i];func(param1,param2);}}
DetailPageFramework.executeLegacyCallback=function(feature_id,prefix,asin){var funcName=prefix+'_'+feature_id.replace(/-/g,"_");var func=window[funcName];if(func){if(typeof asin!='undefined'){func(asin);}else{func();}}};})(jQuery);
// (FILE: /dp-framework/DetailPageFramework.LocalAdapter.js) 


(function($){DetailPageFramework.LocalAdapter=function(name,div_id,data_type,high_priority,update_on_page_load){this.name=name;this.div_id=div_id;this.data_type=data_type;this.htmlCache=new Object();this.high_priority=high_priority;this.update_on_page_load=update_on_page_load;if($('#'+div_id).length==0){return;}
var events=['child_select','swatch_hover','child_deselect'];if(this.update_on_page_load){events.push('window_onload');}
DetailPage.StateController.registerFeature(this,events,this.high_priority);};DetailPageFramework.LocalAdapter.prototype.resizeAvailabilityDiv=function(){var cAvailBlock=document.getElementById('availabilityTwister');var pAvailBlock=document.getElementById('parentAvailabilityTwister');var hAvailBlock=document.getElementById('hiddenAvailabilityTwister');if(cAvailBlock.offsetHeight>hAvailBlock.offsetHeight){hAvailBlock.style.height=cAvailBlock.offsetHeight;}
cAvailBlock.style.visibility='visible';pAvailBlock.style.visibility='hidden';}
DetailPageFramework.LocalAdapter.prototype.getUpdater=function(){var obj=this;return function(asin,asinData){var dpState=DetailPage.StateController.getState();if(asin!=dpState['current_asin']&&asin!=dpState['current_hovered_asin']){return;}
obj.htmlCache[asin]=obj.buildHTML(asin,asinData,dpState);if(asin==dpState['current_hovered_asin']||asin==dpState['current_asin']){$('#'+obj.div_id).attr("innerHTML",obj.htmlCache[asin]);obj.resizeAvailabilityDiv();}}};DetailPageFramework.LocalAdapter.prototype.clear=function(){$('#'+this.div_id).empty();};DetailPageFramework.LocalAdapter.prototype.notify=function(eventType,dpState){if(typeof this.buildHTML!='function'){return;}
if(typeof this.clear!='function'){return;}
if(eventType=="child_select"||eventType=="swatch_hover"||eventType=="window_onload"||eventType=="child_deselect"){var asin=(eventType=="swatch_hover")?dpState['current_hovered_asin']:dpState['current_asin'];if(asin==null){this.clear();return;}
if(this.htmlCache[asin]){$('#'+this.div_id).attr("innerHTML",this.htmlCache[asin]);}else{DetailPage.Model.fetch(asin,this.data_type,this.getUpdater());}}};})(jQuery);
// (FILE: /dp-framework/DetailPageFramework.AltImageAdapter.js) 


(function($){DetailPageFramework.registerCallback("swatch_hover","_alt_images",function(dpState){if(typeof goTwisterAltImages!='undefined'){goTwisterAltImages.previewVariationValues(getAltImageVariationData(dpState,true));}});DetailPageFramework.registerCallback("asin_select","_alt_images",function(dpState){if(typeof goTwisterAltImages!='undefined'){goTwisterAltImages.selectVariationValues(getAltImageVariationData(dpState,false));}});DetailPageFramework.registerCallback("asin_deselect","_alt_images",function(dpState){if(typeof goTwisterAltImages!='undefined'){goTwisterAltImages.selectVariationValues(getAltImageVariationData(dpState,false));}});function getAltImageVariationData(dpState,isHover){return{nVariationsSelected:isHover?dpState['num_dimensions_hovered']:dpState['num_dimensions_selected'],nVariationsTotal:dpState['num_variation_dimensions'],oSelectedVariations:isHover?dpState['hovered_variations']:dpState['selected_variations'],oVariationTypeDisplayLabels:dpState['variation_display_labels'],sBuyableASIN:isHover?dpState['current_hovered_asin']:dpState['current_asin']};};})(jQuery);
// (FILE: /dp-framework/DetailPageFramework.BuyBoxAdapter.js) 


(function($){DetailPageFramework.BuyBoxAdapter=function(){this.name="Buy Box";this.data_type="offers";this.oStrings=goTwisterBuyboxStrings;this.buyboxStateObj;this.atcState=-1;this.quantity=-1;DetailPage.StateController.registerFeature(this,['window_onload','child_select','child_deselect'],true);};DetailPageFramework.BuyBoxAdapter.prototype.updateParentStateBuybox=function(selectedVariations){var dpState=DetailPage.StateController.getState();if(dpState['only_unqualified_offers']){$('#buyboxDivId').hide();return;}
var updateStr='';updateStr+=goTwisterBuybox.printBuyboxHeader(selectedVariations)+'<br />';updateStr+=goTwisterBuybox.printVariationInfo(selectedVariations);$('#buyboxTwisterJS').html(updateStr);$('#twisterBuyboxAvailabilityJS').empty();$('#rcx-subs-bb-outer').empty();$('#parentOneClickDivId').show();$('#oneClickDivId').hide().empty();$('.handleBuyButton input').each(function(){$(this).css('cursor','not-allowed');$(this).attr('title','');var content=$(this).parent().siblings('div.hbbBlockedMsg:first').html();if(!content){content='Please select options from the left';}
$(this).amazonPopoverTrigger({location:['left','auto'],locationAlign:'middle',locationMargin:-10,width:null,skin:null,hoverHideDelay:0,hoverShowDelay:0,showOnHover:true,showCloseButton:false,literalContent:content});});$('#prime_buybox_lower_div').hide();$('#rslButtonOrig').hide();$('#wishlistAddButtonActive, #wishlistDownButtonActive, #rslButtonJsActive, #weddingButtonActive, #babyButtonActive').hide();$('#wishlistAddButtonInactive, #wishlistDownButtonInactive, #rslButtonJsInactive, #weddingButtonInactive, #babyButtonInactive').show();$('#quantityDropdownDiv select').attr('disabled',true);$('#buyboxDivId').show();}
DetailPageFramework.BuyBoxAdapter.prototype.updateBuyboxDivs=function(buyboxStateObj,selectedVariations){var updateStr='';updateStr='<h2 style="font-size: 11px; color: #000;">'+this.oStrings['ReadyToBuy']+'</h2>';updateStr+=buyboxStateObj['priceStr']+'<br />';updateStr+=goTwisterBuybox.printVariationInfo(selectedVariations);$('#buyboxTwisterJS').html(updateStr);$('#twisterBuyboxAvailabilityJS').html(buyboxStateObj['availabilityStr']);if(buyboxStateObj['1clickStatus']=='prime'){$('#parentOneClickDivId').hide();$('#oneClickDivId').show().html(buyboxStateObj['prime1click']);$('#buyboxAddresSelectionDropDown').attr('name','parent-dropdown-selection');}else if(buyboxStateObj['1clickStatus']=='enabled'){$('#parentOneClickDivId').show();$('#oneClickDivId').hide().empty();$('#buyboxAddresSelectionDropDown').attr('name','dropdown-selection');}else{$('#parentOneClickDivId').hide();$('#oneClickDivId').hide();}
if(buyboxStateObj['primeButton']){$('#prime_buybox_lower_div').html(buyboxStateObj['primeButton']).show();}else{$('#prime_buybox_lower_div').hide();}
if(this.atcState!=buyboxStateObj['isPreOrder']){$('#twisterAddToCartOrig').html(buyboxStateObj['isPreOrder']?goTwisterBuyboxImages['preorder']:goTwisterBuyboxImages['addToCart']);$('#twisterOnelClickOrig').html(buyboxStateObj['isPreorder']?goTwisterBuyboxImages['oneclick_preorder']:goTwisterBuyboxImages['oneclick']);this.atcState=buyboxStateObj['isPreOrder'];}
$('#rcx-subs-bb-outer').html(buyboxStateObj['snsStr']).show();$('.handleBuyButton input').css('cursor','').removeAmazonPopoverTrigger();$('#rslButtonOrig').hide();$('#wishlistAddButtonInactive, #wishlistDownButtonInactive, #rslButtonJsInactive, #weddingButtonInactive, #babyButtonInactive').hide();$('#wishlistAddButtonActive, #wishlistDownButtonActive, #rslButtonJsActive, #weddingButtonActive, #babyButtonActive').show();if(this.quantity!=buyboxStateObj['maxQuantity']){goTwisterBuybox.updateDropdown(buyboxStateObj['maxQuantity']);this.quantity=buyboxStateObj['maxQuantity'];}
$('#quantityDropdownDiv select').attr('disabled',false);}
DetailPageFramework.BuyBoxAdapter.prototype.updatePayphraseState=function(dpState,asin,buyboxStateObj){var PPH_HIDDEN=0,PPH_ACTIVE=1,PPH_INACTIVE=2,pphMode;if(this.isBuyboxVisible(dpState,asin,buyboxStateObj)){if(this.isBuyboxActive(dpState,asin,buyboxStateObj)){pphMode=PPH_ACTIVE;}else{pphMode=PPH_INACTIVE;}}else{pphMode=PPH_HIDDEN;}
if(pphMode==PPH_HIDDEN||pphMode==PPH_INACTIVE){$('#twisterPayPhraseWidgetActive').hide();}else{$('#twisterPayPhraseWidgetActive').show();}
if(pphMode==PPH_HIDDEN||pphMode==PPH_ACTIVE){$('#twisterPayPhraseWidgetInactive').hide();}else{$('#twisterPayPhraseWidgetInactive').show();}}
DetailPageFramework.BuyBoxAdapter.prototype.updateBuyboxFormFields=function(buyboxStateObj){if(buyboxStateObj['fields']){var fields=buyboxStateObj['fields'];var form=document.handleBuy;for(var field in fields){form[field].value=fields[field];}}}
DetailPageFramework.BuyBoxAdapter.prototype.isBuyboxActive=function(dpState,asin,buyboxStateObj){return buyboxStateObj&&asin&&asin==dpState['current_asin']&&buyboxStateObj['availability'];}
DetailPageFramework.BuyBoxAdapter.prototype.isBuyboxVisible=function(dpState,asin,buyboxStateObj){if(dpState['only_unqualified_offers']){return false;}
if(asin&&buyboxStateObj&&(asin==dpState['current_asin'])&&(buyboxStateObj['availability']!=1)){return false;}
return true;}
DetailPageFramework.BuyBoxAdapter.prototype.update=function(asin,asinData){if(gbEnableSCP){var dpState=DetailPage.StateController.getState();var buyboxStateObj=DetailPage.Model.getJSONObj(asin,this.data_type,'buy-box',asinData['buy-box']);if(!buyboxStateObj){return;}
if(asin!=dpState['current_asin']){return;}
if(this.isBuyboxActive(dpState,asin,buyboxStateObj)){this.updateBuyboxDivs(buyboxStateObj,dpState['selected_variations']);this.updateBuyboxFormFields(buyboxStateObj);this.updatePayphraseState(dpState,asin,buyboxStateObj);$('#buyboxDivId').show();}else{$('#buyboxDivId').hide();this.updatePayphraseState(dpState,asin,buyboxStateObj);}
return;}
if(typeof goTwisterBuybox=='undefined'){return;}
var dpState=DetailPage.StateController.getState();if(asin==dpState['current_asin']){goTwisterBuybox.update(asin,asinData,dpState['num_dimensions_selected'],dpState['num_variation_dimensions'],dpState['selected_variations'],dpState['variation_display_labels'],dpState['only_unqualified_offers']);goTwisterBuybox.updateSubscribeInfo(asinData);}else{}};DetailPageFramework.BuyBoxAdapter.prototype.notify=function(eventType,dpState){if(gbEnableSCP){if(dpState['current_asin']){var me=this;DetailPage.Model.fetch(dpState['current_asin'],this.data_type,function(){DetailPageFramework.BuyBoxAdapter.prototype.update.apply(me,arguments)});}else{this.updateParentStateBuybox(dpState['selected_variations']);this.updatePayphraseState(dpState);}
return;}
if(typeof goTwisterBuybox=='undefined'){return;}
if(eventType=="window_onload"){goTwisterBuybox.onLoad();if(dpState['current_asin']){DetailPage.Model.fetch(dpState['current_asin'],this.data_type,this.update);}else if(typeof goTwisterBuybox!='undefined'){var dpState=DetailPage.StateController.getState();goTwisterBuybox.update(null,null,dpState['num_dimensions_selected'],dpState['num_variation_dimensions'],dpState['selected_variations'],dpState['variation_display_labels'],dpState['only_unqualified_offers']);}}else if(eventType=="child_select"||eventType=='child_deselect'){var asin=dpState['current_asin'];if(asin){var data_loaded=DetailPage.Model.fetch(asin,this.data_type,this.update);}else{goTwisterBuybox.update(null,null,dpState['num_dimensions_selected'],dpState['num_variation_dimensions'],dpState['selected_variations'],dpState['variation_display_labels'],dpState['only_unqualified_offers']);var addToCartDivs=$('#twisterAddToCartOrig, #twisterAddToCartInactive, #twisterAddToCartActive');if(addToCartDivs&&addToCartDivs.length==0){$('#twisterBuyboxHeaderJS').children().filter('h2').hide();$('.oneClickDiv').hide();}}}};})(jQuery);
// (FILE: /dp-framework/DetailPageFramework.CLogAdapter.js) 


(function($){DetailPageFramework.CLogAdapter=function(){this.name='Client-Side Logging';this.startTimes=new Object();this.hoveredAsins={};this.selectedAsins={};this.hoverCount=0;this.selectCount=0;this.logQueue={};this.flushThreshold=3;DetailPage.StateController.registerFeature(this,['ajax_start','ajax_success','ajax_error','update_start','update_finish','child_select','swatch_hover']);}
DetailPageFramework.CLogAdapter.prototype.queueUpdateLog=function(key,value,asin){if(!this.logQueue[key]){this.logQueue[key]=[];}
var queue=this.logQueue[key];queue.push({value:value,asin:asin});this.flushUpdateLogQueue(key,false);};DetailPageFramework.CLogAdapter.prototype.flushUpdateLogQueue=function(key,force){var queue=this.logQueue[key];if(queue.length>=this.flushThreshold||(force&&queue.length>0)){var values=[];var asins=[];for(var i=0;i<queue.length;i++){values.push(queue[i].value);}
for(var i=0;i<queue.length;i++){asins.push(queue[i].asin);}
var params={};params[key]=values;params['asin']=asins;this.logParams(params);this.logQueue[key]=[];}};DetailPageFramework.CLogAdapter.prototype.log=function(key,value,asin){params={};params[key]=value;params['asin']=asin;this.logParams(params);}
DetailPageFramework.CLogAdapter.prototype.logParams=function(params){if(typeof window.clientLogger=='undefined'){return;}
var dpState=DetailPage.StateController.getState();if(typeof dpState['product_group_id']!='undefined'){params['productGroupID']=dpState['product_group_id'];}
var browser=$.browser;if(browser.msie){params['browser']='msie';}else if(browser.mozilla){params['browser']='mozilla';}else if(browser.safari){params['browser']='safari';}else if(browser.opera){params['browser']='opera';}else{params['browser']='unknown';}
params['browser']=params['browser']+':'+browser.version;clientLogger.sendCLOGEntry("twister","detail_ajax",params);}
DetailPageFramework.CLogAdapter.prototype.notify=function(eventType,dpState){if(eventType=="swatch_hover"){this.hoverCount++;if(dpState['current_hovered_asin']){this.hoveredAsins[dpState['current_hovered_asin']]=true;}}else if(eventType=="child_select"){this.selectCount++;if(dpState['current_asin']){this.selectedAsins[dpState['current_asin']]=true;}}else if(eventType=="ajax_start"){var hashKey=this.buildHashKey("ajax",dpState['ajax_data_type'],dpState['ajax_keys']);this.startTimer(hashKey);}else if(eventType=="ajax_success"){var hashKey=this.buildHashKey("ajax",dpState['ajax_data_type'],dpState['ajax_keys']);var elapsedTime=this.endTimer(hashKey);var log_key="ajaxSuccess:"+dpState['ajax_data_type'];this.queueUpdateLog(log_key,elapsedTime,this.getAsins(dpState['ajax_keys']));}else if(eventType=="ajax_error"){var hashKey=this.buildHashKey("ajax",dpState['ajax_data_type'],dpState['ajax_keys']);var elapsedTime=this.endTimer(hashKey);var log_key="ajaxFailure:"+dpState['ajax_data_type'];this.queueUpdateLog(log_key,elapsedTime,this.getAsins(dpState['ajax_keys']));}else if(eventType=="update_start"){this.startTimer("update__atf__"+dpState['update_asin']);this.startTimer("update__btf__"+dpState['update_asin']);this.startTimer("update__cache__"+dpState['update_asin']);}else if(eventType=="update_finish"){var elapsedTime=this.endTimer("update__"+dpState['update_type']+"__"+dpState['update_asin']);this.queueUpdateLog("updateTime:"+dpState['update_type'],elapsedTime,dpState['update_asin']);}};DetailPageFramework.CLogAdapter.prototype.getAsins=function(keys){return keys.join(',');};DetailPageFramework.CLogAdapter.prototype.flushLogs=function(){var dpState=DetailPage.StateController.getState();var hoveredVariationCount=0;var selectedVariationCount=0;for(var i in this.hoveredAsins){hoveredVariationCount++;}
for(var i in this.selectedAsins){selectedVariationCount++;}
var params={};params['hoverCount']=Math.ceil(this.hoverCount/2);params['selectCount']=this.selectCount;params['hoveredVariationCount']=hoveredVariationCount;params['selectedVariationCount']=selectedVariationCount;if(typeof dpState['num_total_variations']!='undefined'){params['totalVariationCount']=dpState['num_total_variations'];}
this.logParams(params);for(var key in this.logQueue){this.flushUpdateLogQueue(key,true);}}
DetailPageFramework.CLogAdapter.prototype.keyToString=function(dataType,key){var str="";if(typeof key=='object'){for(var i in key){str+="__"+DetailPage.Model.getHash(key[i],dataType);}
if(str.length>2){str=str.substring(2);}}else{str=DetailPage.Model.getHash(key,dataType);}
return str;}
DetailPageFramework.CLogAdapter.prototype.buildHashKey=function(eventType,dataType,key){var hashKey=eventType+"__"+dataType+"__"+this.keyToString(dataType,key);return hashKey;};DetailPageFramework.CLogAdapter.prototype.logAjax=function(dataType,key,elapsedTime,success){var log_key=(success?"ajaxSuccess:":"ajaxFailure:")+dataType;this.log(log_key,elapsedTime,this.keyToString(dataType,key));}
DetailPageFramework.CLogAdapter.prototype.startTimer=function(hashKey){this.startTimes[hashKey]=new Date();};DetailPageFramework.CLogAdapter.prototype.endTimer=function(hashKey){if(typeof this.startTimes[hashKey]=='undefined'){return undefined;}
var elapsedTime=new Date()-this.startTimes[hashKey];this.startTimes[hashKey]=undefined;return elapsedTime;};DetailPageFramework.UpdateStartAdapter=function(){this.name="Update Start Adapter";DetailPage.StateController.registerFeature(this,['child_select'],true);}
DetailPageFramework.UpdateStartAdapter.prototype.notify=function(eventType,dpState){if(eventType=="child_select"){DetailPage.StateController.notify("update_start",{update_asin:dpState['current_asin']});}}
DetailPageFramework.UpdateFinishAdapter=function(){this.name="Update Finish Adapter";DetailPage.StateController.registerFeature(this,['child_select']);}
DetailPageFramework.UpdateFinishAdapter.prototype.getUpdater=function(data_type){return function(asin,asinData){DetailPage.StateController.notify("update_finish",{update_type:data_type,update_asin:asin});}}
DetailPageFramework.UpdateFinishAdapter.prototype.notify=function(eventType,dpState){if(eventType=="child_select"){var asin=dpState['current_asin'];if(asin==null){return;}
if(DetailPage.Model.loaded(asin,"atf")&&(dpState['is_dpm']||DetailPage.Model.loaded(asin,"btf"))){DetailPage.StateController.notify("update_finish",{update_type:"cache",update_asin:asin});}else{DetailPage.Model.fetch(asin,"atf",this.getUpdater("atf"));if(!dpState['is_dpm']){DetailPage.Model.fetch(asin,"btf",this.getUpdater("btf"));}}}}})(jQuery);
// (FILE: /dp-framework/DetailPageFramework.EMWAAdapter.js) 


(function($){DetailPageFramework.EMWAAdapter={name:"Email Me When Available",atf_feature_id:"twister-atf-emwa",btf_feature_id:"twister-btf-emwa",atf_div_id:"twister-atf-emwa_feature_div",btf_div_id:"twister-btf-emwa_feature_div",atf_element:false,btf_element:false};DetailPageFramework.EMWAAdapter.getEMWAState=function(asin,asinData){}
DetailPageFramework.EMWAAdapter.init=function(){var EMWA=DetailPageFramework.EMWAAdapter;if(!EMWA.atf_element||EMWA.atf_element.length==0){EMWA.atf_element=$('#'+EMWA.atf_div_id);if(!EMWA.atf_element){}}
if(!EMWA.btf_element||EMWA.btf_element.length==0){EMWA.btf_element=$('#'+EMWA.btf_div_id);if(!EMWA.btf_element){}}
return EMWA.atf_element&&EMWA.btf_element;};DetailPageFramework.EMWAAdapter.offersUpdater=function(asin,asinData){var EMWA=DetailPageFramework.EMWAAdapter;var dpState=DetailPage.StateController.getState();if(asin!=dpState['current_asin']){return;}
var isEMWA=0;if(gbEnableSCP){var buyboxStateObj=DetailPage.Model.getJSONObj(asin,'offers','buy-box',asinData['buy-box']);isEMWA=buyboxStateObj?buyboxStateObj['isEMWA']:0;}else{isEMWA=asinData['isEmailMeWhenAvailable'];}
if(isEMWA){if(!DetailPage.Model.loaded(asin,'atf')){EMWA.showGenericEMWA(asin);}
DetailPage.Model.fetch(asin,'atf',EMWA.atfUpdater);}else{EMWA.hideEMWA();}};DetailPageFramework.EMWAAdapter.atfUpdater=function(asin,asinData){var EMWA=DetailPageFramework.EMWAAdapter;if(!EMWA.init())return;var dpState=DetailPage.StateController.getState();if(asin!=dpState['current_asin']){return;}
if(typeof asinData[EMWA.atf_feature_id]=='undefined'){EMWA.atf_element.hide();return;}
var rawElement=EMWA.atf_element.get(0);if(rawElement){rawElement.innerHTML=asinData[EMWA.atf_feature_id];}
if($.trim(asinData[EMWA.atf_feature_id]).length==0){EMWA.hideEMWA();}else{EMWA.atf_element.show();}};DetailPageFramework.EMWAAdapter.hideEMWA=function(){var EMWA=DetailPageFramework.EMWAAdapter;if(!EMWA.init())return;EMWA.atf_element.hide();};DetailPageFramework.EMWAAdapter.showGenericEMWA=function(asin){var EMWA=DetailPageFramework.EMWAAdapter;if(!EMWA.init())return;var descriptionDiv=$("div#"+EMWA.btf_div_id+" div#ensVariationDescription");descriptionDiv.html(DetailPageFramework.EMWAAdapter.getVariationDescription(asin));EMWA.atf_element.html(EMWA.btf_element.html());EMWA.atf_element.show();};DetailPageFramework.EMWAAdapter.getVariationDescription=function(asin){if(!asin||typeof goChildItems=='undefined'||typeof goVariationLabels=='undefined'||typeof goVariationLabelOrder=='undefined'||typeof goVariationValues=='undefined'){return"";}
var asinData;for(var i=0;i<goChildItems.length;i++){if(goChildItems[i]['ASIN']==asin){asinData=goChildItems[i];break;}}
if(typeof asinData=='undefined')return"";var html='<div class="disclaim">';for(var i=0;i<goVariationLabelOrder.length;i++){var key=goVariationLabelOrder[i];var label=goVariationLabels[key];if(typeof label=='undefined')continue;var values=goVariationValues[key];if(typeof values=='undefined')continue;var index=asinData[key];if(typeof index=='undefined')continue;var value=values[index];if(typeof value=='undefined')continue;if(i>0)html+='&nbsp;|&nbsp;';html+=label+": <strong>"+value+"</strong>";}
html+='</div>';return html;};DetailPageFramework.EMWAAdapter.clickHandler=function(link){var dpState=DetailPage.StateController.getState();var asin=dpState['current_asin'];if(!asin)return false;var emwaURL="/gp/twister/ajax/subscribe-emwa.html?powerBar=0&asin="+asin;if(link){var element=$(link);element.replaceWith('<img src="http://images.amazon.com/images/G/01/x-locale/communities/tags/snake.gif" width="16" height="16" align="absmiddle" style="display: inline; padding-bottom: 6px;">');}
$.ajax({cache:false,dataType:'json',url:emwaURL,success:function(d){var EMWA=DetailPageFramework.EMWAAdapter;if(!EMWA||!EMWA.init())return;if(!d['success']){}
if(!d['emwaHTML']){return;}
var currentDPState=DetailPage.StateController.getState();var currentASIN=dpState['current_asin'];if(currentASIN!=d['asin']){return;}
EMWA.atf_element.html(d['emwaHTML']);var descriptionDiv=$("div#"+EMWA.atf_div_id+" div#ensVariationDescription");descriptionDiv.html(DetailPageFramework.EMWAAdapter.getVariationDescription(currentASIN));EMWA.atf_element.css('opacity','1.0');EMWA.atf_element.show();if(DetailPage.Model.loaded(currentASIN,'atf')){var data=new Object();data[currentASIN]=DetailPage.Model.getData(currentASIN,'atf');data[currentASIN][EMWA.atf_feature_id]=EMWA.atf_element.html();DetailPage.Model.setData('atf',data);}else{}},error:function(){}});return false;}
DetailPageFramework.registerCallback("asin_deselect","twister-atf-emwa",function(){DetailPageFramework.EMWAAdapter.hideEMWA();});DetailPageFramework.registerCallback("asin_select","twister-atf-emwa",function(dpState){var EMWA=DetailPageFramework.EMWAAdapter;if(dpState['current_asin']){if(!DetailPage.Model.loaded(dpState['current_asin'],'offers')){EMWA.hideEMWA();}
DetailPage.Model.fetch(dpState['current_asin'],'offers',EMWA.offersUpdater);}else{EMWA.hideEMWA();}});})(jQuery);
// (FILE: /dp-framework/DetailPageFramework.PriceBlockAdapter.js) 


(function($){DetailPageFramework.PriceBlockAdapter=function(){this.name="Price Block";this.data_type="offers";DetailPage.StateController.registerFeature(this,['swatch_hover','child_select','child_deselect','window_onload'],true);};DetailPageFramework.PriceBlockAdapter.prototype.update=function(asin,asinData){if(typeof goTwisterPriceBlock=='undefined'){return;}
var dpState=DetailPage.StateController.getState();if(asin==dpState['current_hovered_asin']){goTwisterPriceBlock.update(asin,asinData,dpState['only_unqualified_offers']);}else if(asin==dpState['current_asin']){goTwisterPriceBlock.update(asin,asinData,dpState['only_unqualified_offers']);}else{}};DetailPageFramework.PriceBlockAdapter.prototype.notify=function(eventType,dpState){if(typeof goTwisterPriceBlock=='undefined'){return;}
if(eventType=="window_onload"){var asin=dpState['current_asin'];if(asin){DetailPage.Model.fetch(asin,this.data_type,this.update);}else{goTwisterPriceBlock.update(null,null,dpState['only_unqualified_offers']);}}
else if(eventType=="swatch_hover"||eventType=="child_select"||eventType=='child_deselect'){var asin=(eventType=="swatch_hover")?dpState['current_hovered_asin']:dpState['current_asin'];if(asin){if(!DetailPage.Model.loaded(asin,this.data_type)){goTwisterPriceBlock.update(null,null,dpState['only_unqualified_offers']);}
DetailPage.Model.fetch(asin,this.data_type,this.update);}else{goTwisterPriceBlock.update(null,null,dpState['only_unqualified_offers']);}}};})(jQuery);
// (FILE: /dp-framework/DetailPageFramework.ShippingContainerMessagingAdapter.js) 


(function($){DetailPageFramework.ShippingContainerMessagingAdapter=function(){this.name="Shipping Container Messaging";this.data_type="offers";DetailPage.StateController.registerFeature(this,['swatch_hover','child_select','window_onload'],true);};DetailPageFramework.ShippingContainerMessagingAdapter.prototype.update=function(asin,asinData){if(typeof goTwisterAvailability=='undefined'){return;}
goTwisterAvailability.handleShippingContainerMessaging(asin,asinData);};DetailPageFramework.ShippingContainerMessagingAdapter.prototype.notify=function(eventType,dpState){var asin=(eventType=="child_select"||eventType=="window_onload")?dpState['current_asin']:dpState['current_hovered_asin'];if(asin!=null){DetailPage.Model.fetch(asin,this.data_type,this.update);}};})(jQuery);
// (FILE: /dp-framework/DetailPageFramework.AdapterFactory.js) 


(function($){DetailPageFramework.AdapterFactory=function(){};DetailPageFramework.AdapterFactory.prototype.ATF_HANDLER="atf";DetailPageFramework.AdapterFactory.prototype.BTF_HANDLER="btf";DetailPageFramework.AdapterFactory.prototype.buildAvailabilityAdapter=function(){var availabilityAdapter=new DetailPageFramework.LocalAdapter('Availability','availabilityTwister','offers',true);availabilityAdapter.buildHTML=function(asin,asinData,dpState){if(typeof goTwisterAvailability=='undefined'){return;}
return goTwisterAvailability.printAvailability(asinData,dpState['only_unqualified_offers']);};availabilityAdapter.clear=function(){if(typeof goTwisterAvailability=='undefined'){return;}
goTwisterAvailability.clear();};return availabilityAdapter;};DetailPageFramework.AdapterFactory.prototype.buildOLPAdapter=function(){var olpAdapter=new DetailPageFramework.LocalAdapter('OLP','moreBuyingChoicesTwister','offers',true,true);olpAdapter.buildHTML=function(asin,asinData,dpState){if(typeof goTwisterAvailability=='undefined'){return;}
return goTwisterAvailability.printMoreBuyingChoices(asinData);};return olpAdapter;};DetailPageFramework.AdapterFactory.prototype.buildScarcityAdapter=function(){var scarcityAdapter=new DetailPageFramework.LocalAdapter('Scarcity','scarcityTwister','offers',true);scarcityAdapter.buildHTML=function(asin,asinData,dpState){if(typeof goTwisterAvailability=='undefined'){return;}
return goTwisterAvailability.printScarcityMsg(asinData);};return scarcityAdapter;};DetailPageFramework.AdapterFactory.prototype.build=function(feature_id){switch(feature_id){case"more-buying-choices":return new DetailPageFramework.Adapter(feature_id,{dataType:this.ATF_HANDLER,hideOnDeselect:true,priority:'high',suppressFade:true});case"prime":return new DetailPageFramework.Adapter(feature_id,{dataType:this.ATF_HANDLER,priority:'high',div:'PrimeStripe'});case"product-alert-ArText":case"detail-ilm":return new DetailPageFramework.Adapter(feature_id,{dataType:this.ATF_HANDLER,fadeOnHover:true,hideOnDeselect:true,priority:'high'});case"hero-quick-promo":case"fma-seller-messages":case"tradein-used-link-top":case"tradein-used-link":case"holiday-availability-messaging":return new DetailPageFramework.Adapter(feature_id,{dataType:this.ATF_HANDLER,fadeOnHover:true,hideOnDeselect:true,priority:'high'});case"promotions-atf":return new DetailPageFramework.Adapter(feature_id,{dataType:this.ATF_HANDLER,priority:'high'});case"platform-information-and-esrb-rating":return new DetailPageFramework.Adapter(feature_id,{dataType:this.ATF_HANDLER,fadeOnHover:true,priority:'high',runRemoteScripts:true,disableLegacyCallbacks:true});case"instant-order-update":return new DetailPageFramework.Adapter(feature_id,{dataType:this.ATF_HANDLER,priority:'high',disableLegacyCallbacks:true});case"fast-track":if(gbEnableSCP){return new DetailPageFramework.Adapter(feature_id,{dataType:this.ATF_HANDLER,fadeOnHover:true,hideOnDeselect:true,priority:'high',runRemoteScripts:true});}else{return null;}
case"price":if(gbEnableSCP){return new DetailPageFramework.Adapter(feature_id,{dataType:"offers",priority:'high',updateOnHover:true,runRemoteScripts:true,div:"price_inner_div"});}else{return null;}
case"availability":case"original-packaging-message":case"olp-condition-link":case"olp":case"scarcity":case"subscribe-and-save-price":case"subscribe-and-save-alerts":if(gbEnableSCP){return new DetailPageFramework.Adapter(feature_id,{dataType:"offers",priority:'high',updateOnHover:true,runRemoteScripts:true});}else{return null;}
case"average-customer-reviews":case"view-wia-rich-media":case"view-dpv-rich-media":case"white-glove-message":return new DetailPageFramework.Adapter(feature_id,{dataType:this.ATF_HANDLER,priority:'high'});case"ob-replacement":return new DetailPageFramework.Adapter(feature_id,{dataType:this.ATF_HANDLER,fadeOnHover:true,hideOnDeselect:true,disableLegacyCallbacks:true,loadingBar:true,priority:'high'});case"ob-replacement-teaser":return new DetailPageFramework.Adapter(feature_id,{dataType:this.ATF_HANDLER,fadeOnHover:true,hideOnDeselect:true,disableLegacyCallbacks:true,priority:'high'});case"center-41":return new DetailPageFramework.Adapter(feature_id,{dataType:this.BTF_HANDLER,loadingBar:true,div:'cpsims-feature'});case"purchase-similarities":return new DetailPageFramework.Adapter(feature_id,{dataType:this.BTF_HANDLER,loadingBar:true,runRemoteScripts:true,div:'purchase-sims-feature'});case"center-28":return new DetailPageFramework.Adapter(feature_id,{dataType:this.BTF_HANDLER});case"customer-reviews":case"detail-bullets":case"buyxgety":return new DetailPageFramework.Adapter(feature_id,{dataType:this.BTF_HANDLER,loadingBar:true,runRemoteScripts:true});case"twister-atf-emwa":case"twister-btf-emwa":return null;case"accessories-and-compatible-products":case"platform-information":case"product-description":case"nutrition-facts":case"feature-bullets":case"important-information":case"technical-data":case"rebate":case"promotions":case"customer-discussions":case"improve-your-recs":case"content-provider-review":case"listmania-center":case"dp-ads-middle":case"related-ads":case"browse":case"sylt-center":case"system-requirements":case"product-details":case"award-images":case"cpsia-product-safety-warning":return new DetailPageFramework.Adapter(feature_id,{dataType:this.BTF_HANDLER,loadingBar:true});}};})(jQuery);
// (FILE: /dp-framework/DetailPageFramework.FeatureStringMap.js) 


(function($){DetailPageFramework.FeatureStringMap=function(){this.vals={};this.get=function(namespace,key){return(this.has(namespace,key))?this.vals[namespace][key]:"";};this.getValsForNamespace=function(namespace){return(typeof(this.vals[namespace])!='undefined')?this.vals[namespace]:{};};this.set=function(namespace,key,val){if(typeof(namespace)!='undefined'&&typeof(key)!='undefined'){if(typeof(this.vals[namespace])=='undefined'){this.vals[namespace]={};}
this.vals[namespace][key]=val;return this.vals[namespace][key];}};this.has=function(namespace,key){return typeof(this.vals[namespace])!='undefined'&&typeof(this.vals[namespace][key])!='undefined';};};})(jQuery);
// (FILE: /dp-framework/twister_init.js) 


(function($){var getTwisterUpdateArgs=function(asins,type){var dpState=DetailPage.StateController.getState();var parent_asin=dpState['parent_asin'];var argString=parent_asin+'?json=1&childASIN='+asins[0];var dpState=DetailPage.StateController.getState();var args={PowerBar:'0',pfWrapFeatures:'0',productGroupID:dpState['product_group_id'],rid:dpState['rid'],sid:dpState['sid'],qid:dpState['qid'],sr:dpState['sr'],storeID:dpState['store_id'],twisterView:dpState['view'],merchantID:dpState['exclusive_merchant_id'],requestType:type,"dropdown-selection":dpState['1click_address']};for(var attr in args){if(args[attr]){argString+='&'+attr+'='+args[attr];}}
return argString;};var getOffersArgs=function(asins){var dpState=DetailPage.StateController.getState();var argString=dpState['sid'];argString+="?json=1";argString+="&sid="+dpState['sid'];argString+="&rid="+dpState['rid'];argString+="&parentAsin="+dpState['parent_asin'];argString+="&qid="+dpState['qid'];argString+="&sr="+dpState['sr'];argString+="&asinList=";for(var i=0;i<asins.length;i++){argString+=(i>0?",":"")+asins[i];}
argString+="&productGroupID="+dpState['product_group_id'];argString+="&merchantID="+dpState['exclusive_merchant_id'];if(dpState['1click_address']){argString+="&dropdown-selection="+dpState['1click_address'];}
argString+="&PowerBar=0";argString+="&pfWrapFeatures=0";if(dpState['view']&&dpState['view']!='glance'){argString+="&twisterView="+dpState['view'];}
return argString;};DetailPageFramework.initialize=function(collectMetrics){if(typeof DetailPage=='undefined'){window.DetailPage={};}
var prefetchURL='/gp/twister/dynamic-update/offers-item.html/';if(gbEnableSCP){prefetchURL='/gp/twister/ajax/prefetch/';}
DetailPage.Model=new DetailPageFramework.Model({offers:{url:prefetchURL,argHandler:getOffersArgs},atf:{url:'/gp/product/twister-update/',argHandler:function(asins){return getTwisterUpdateArgs(asins,'atf');}},btf:{url:'/gp/product/twister-update/',argHandler:function(asins){return getTwisterUpdateArgs(asins,'btf');}}});DetailPage.StateController=new DetailPageFramework.StateController;DetailPage.AdapterFactory=new DetailPageFramework.AdapterFactory;DetailPage.adapters={};if(goTwisterVariations){var selection=goTwisterVariations.getInitialSelection();if(selection&&selection['type']=='swatch'){goTwisterVariations.onClickSwatch(selection['key'],selection['value']);}else if(selection&&selection['type']=='dropdown'){goTwisterVariations.onChangeDropdown(selection['key']);}}
if(collectMetrics){DetailPage.adapters["_first"]=new DetailPageFramework.UpdateStartAdapter;DetailPage.adapters["_clog"]=new DetailPageFramework.CLogAdapter;}
if(!gbEnableSCP){DetailPage.adapters["_availability"]=DetailPage.AdapterFactory.buildAvailabilityAdapter();DetailPage.adapters["_olp"]=DetailPage.AdapterFactory.buildOLPAdapter();DetailPage.adapters["_scarcity"]=DetailPage.AdapterFactory.buildScarcityAdapter();DetailPage.adapters["_price_block"]=new DetailPageFramework.PriceBlockAdapter;DetailPage.adapters["fast-track"]=new DetailPageFramework.Adapter('fast-track',{dataType:'atf',fadeOnHover:true,hideOnDeselect:true,priority:'high'});DetailPage.adapters["_shipping_container_messaging"]=new DetailPageFramework.ShippingContainerMessagingAdapter;}
DetailPage.adapters["twister-atf-emwa"]=new DetailPageFramework.Adapter('twister-atf-emwa',{suppressDefaultBehavior:true,priority:'high'});DetailPage.adapters["_alt_images"]=new DetailPageFramework.Adapter("_alt_images",{suppressDefaultBehavior:true});DetailPage.adapters["_buy_box"]=new DetailPageFramework.BuyBoxAdapter;DetailPage.adapters["size-chart-url"]=new DetailPageFramework.Adapter('size-chart-url',{dataType:'atf',fadeOnHover:true,priority:'high',div:'size-chart-url'});DetailPage.FeatureStringMap=new DetailPageFramework.FeatureStringMap();DetailPageFramework.registerHandler("string",function(key,val){var keys=key.split("%");DetailPage.FeatureStringMap.set(keys[0],keys[1],val);});DetailPageFramework.registerHandler("feature_config",function(feature_id,config){DetailPage.adapters[feature_id]=new DetailPageFramework.Adapter(feature_id,config);});DetailPageFramework.registerCallback("ajax_request",'more-buying-choices',function(){var feature_div=$('#more-buying-choice-content-div');if(feature_div.length>0){if(!feature_div.attr('loadingBarSet')){feature_div.attr('loadingBarSet','1');feature_div.html(loadingBarHTML2Line);}}else{}});DetailPageFramework.registerCallback("asin_deselect",'prime',function(){var html="";var element=$("#prime_feature_div");if(typeof goTwisterPrime!='undefined'){html=goTwisterPrime.getParentContent();}
if($.trim(html).length>0){element.get(0).innerHTML=html;}else{element.hide();}});DetailPageFramework.registerCallback("after_redraw","platform-information-and-esrb-rating",function(dpState){if(dpState['current_asin']){doInit_average_customer_reviews(dpState['current_asin']);}});DetailPageFramework.registerCallback("before_redraw","platform-information-and-esrb-rating",function(){$('#iaspop0oc').hide();});DetailPageFramework.registerCallback("after_redraw","platform-information-and-esrb-rating",function(){amz_js_iasrev_init();amz_js_iasrev_show();});if(typeof DetailPageFramework!='undefined'&&gbEnableSCP){var twisterPriceOuter;var twisterPriceInner;swapOutPriceBefore=function(key,requestedData){if(!twisterPriceOuter){twisterPriceOuter="#price-and-olp-condition-link-outer";twisterPriceInner="#price-and-olp-condition-link-inner";if($(twisterPriceOuter).length==0){twisterPriceOuter="#price_feature_div";twisterPriceInner="#price_inner_div";}}
$(twisterPriceOuter).css('height',''+$(twisterPriceOuter).height()+'px');}
swapOutPriceAfter=function(key,requestedData){if($(twisterPriceOuter).height()<$(twisterPriceInner).height()){$(twisterPriceOuter).css('height',$(twisterPriceInner).height()+'px');}}
DetailPageFramework.registerCallback('document_ready','price',swapOutPriceBefore);DetailPageFramework.registerCallback('before_redraw','price',swapOutPriceBefore);DetailPageFramework.registerCallback('after_redraw','price',swapOutPriceAfter);if($("#price-and-olp-condition-link-outer").length>0){DetailPageFramework.registerCallback('before_redraw','olp-condition-link',swapOutPriceBefore);DetailPageFramework.registerCallback('after_redraw','olp-condition-link',swapOutPriceAfter);}}};DetailPageFramework.registerDiv=function(){var div_id=this.id;if(div_id.length<=12)return;var feature_id=div_id.substring(0,div_id.length-12);if(typeof DetailPage.adapters[feature_id]=='undefined'){DetailPage.adapters[feature_id]=DetailPage.AdapterFactory.build(feature_id);}else{}};DetailPageFramework.scanForDivs=function(){var divs=$('div[@id$="feature_div"]');divs.each(DetailPageFramework.registerDiv);};})(jQuery);
// (FILE: /dp-framework/DetailPageFramework.DeclareAvailable.js) 


if(typeof amznJQ!="undefined"){amznJQ.declareAvailable("twister");}