9066a985a55871b82358217958e5a078100df4dc7f6c5ed6b8b26945dde67080

Source Code:


// twister-dpf.js, 


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


function TwisterCore(){this.NO_SELECTION='-1';this.IGNORE_SELECTION='*';var oParSelLook=new Object();var dpState=DetailPage.StateController.getState();this.selectionItems=new Array();var oVarKeys=new Array();this.populateTree=function(item,parentNode,ignoreKey,depth){if(oVarKeys[depth]==ignoreKey){if(parentNode[this.IGNORE_SELECTION]==null){parentNode[this.IGNORE_SELECTION]=new Object();}
if(depth==(oVarKeys.length-1)){parentNode[this.IGNORE_SELECTION][item[ignoreKey]]=1;}else{this.populateTree(item,parentNode[this.IGNORE_SELECTION],ignoreKey,depth+1);}
return;}
if(depth==(oVarKeys.length-1)){if(parentNode[this.NO_SELECTION]==null){parentNode[this.NO_SELECTION]=new Object();}
parentNode[this.NO_SELECTION][item[ignoreKey]]=1;if(parentNode[item[oVarKeys[depth]]]==null){parentNode[item[oVarKeys[depth]]]=new Object();}
parentNode[item[oVarKeys[depth]]][item[ignoreKey]]=1;return;}
if(parentNode[this.NO_SELECTION]==null){parentNode[this.NO_SELECTION]=new Object();}
this.populateTree(item,parentNode[this.NO_SELECTION],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 DetailPage.StateController.getState()['selected_variation_values']){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 DetailPage.StateController.getState()['selected_variation_values']){this.insertLookupKey('',oParSelLook[sKey],0);}}
this.insertLookupKey=function(sPartKey,parentNode,depth){if(depth==oVarKeys.length-1){for(var val in parentNode){this.selectionItems[sPartKey+val+' ']=parentNode[val];}
return;}
for(var val in parentNode){this.insertLookupKey(sPartKey+val+' ',parentNode[val],depth+1);}}
this.getLookupString=function(IgnoreVarKey){var sLookup='';for(var sVarKey in DetailPage.StateController.getState()['selected_variation_values']){if(sVarKey!=sIgnoreVarKey){if(DetailPage.StateController.getState()['selected_variation_values'][sVarKey]!=-1){sLookup+=(DetailPage.StateController.getState()['selected_variation_values'][sVarKey]+" ");}else{sLookup=null;break;}}else{sLookup+="-1 ";}}
return sLookup;};this.getReachableAsins=function(dimensionsWithRestrictedFetchRanges){var aAsinList=new Array();var count=0;for(var sIgnoreVarKey in DetailPage.StateController.getState()['selected_variation_values']){var sLookup='';for(var sVarKey in DetailPage.StateController.getState()['selected_variation_values']){if(sVarKey!=sIgnoreVarKey){if(DetailPage.StateController.getState()['selected_variation_values'][sVarKey]!=-1){sLookup+=(DetailPage.StateController.getState()['selected_variation_values'][sVarKey]+" ");}else{sLookup=null;break;}}else{sLookup+="-1 ";}}
if(sLookup!=null){var oItems=this.selectionItems[sLookup];if(dimensionsWithRestrictedFetchRanges&&dimensionsWithRestrictedFetchRanges[sIgnoreVarKey]){var prefetchRange=dimensionsWithRestrictedFetchRanges[sIgnoreVarKey];var pos=parseInt(DetailPage.StateController.getState()['selected_variation_values'][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.getReachableVariationDimensionValues=function(){var reachableVariationValues={};for(var sVarKey in DetailPage.StateController.getState()['selected_variation_values']){reachableVariationValues[sVarKey]={};}
for(var sVarKey in DetailPage.StateController.getState()['selected_variation_values']){var sLookup='';var oItems=null;for(var sCurVarKey in DetailPage.StateController.getState()['selected_variation_values']){if(sCurVarKey!=sVarKey){if(DetailPage.StateController.getState()['selected_variation_values'][sCurVarKey]!=-1){sLookup+=(DetailPage.StateController.getState()['selected_variation_values'][sCurVarKey]+" ");}else{sLookup+="-1 ";}}else{sLookup+="* ";}}
if(sLookup!=null){oItems=this.selectionItems[sLookup];}
for(var nVarValue in DetailPage.StateController.getState()['variation_values'][sVarKey]){reachableVariationValues[sVarKey][nVarValue]=!(oItems&&(typeof oItems[nVarValue]=='undefined')&&!reachableVariationValues[sVarKey][nVarValue]);}}
return reachableVariationValues;}
this.getBlockedVariationDimensionValues=function(){var dpState=DetailPage.StateController.getState();if(typeof dpState['master_variation_dimension']!='undefined'){var masterDim=dpState['master_variation_dimension'];var nonBlockedVariationValues={};for(var asin in dpState['asin_variation_values']){for(var varDim in dpState['asin_variation_values'][asin]){if(dpState['asin_variation_values'][asin][masterDim]==dpState['selected_variation_values'][masterDim]||varDim==masterDim){if(!nonBlockedVariationValues[varDim]){nonBlockedVariationValues[varDim]=new Array();}
nonBlockedVariationValues[varDim][dpState['asin_variation_values'][asin][varDim]]=1;}}}
var blockedVariationValues={};for(var varDim in dpState['variation_values']){blockedVariationValues[varDim]=new Array();for(var index=0;index<dpState['variation_values'][varDim].length;index++){if((typeof nonBlockedVariationValues[varDim]=='undefined')||(typeof nonBlockedVariationValues[varDim][index]=='undefined')){blockedVariationValues[varDim][index]=1;}}}
return blockedVariationValues;}
return null;}
{var nVariationsTotal=0;for(var sVarKey in DetailPage.StateController.getState()['selected_variation_values']){oVarKeys[nVariationsTotal]=sVarKey;nVariationsTotal++;}
for(var sVarKey in DetailPage.StateController.getState()['selected_variation_values']){if(DetailPage.StateController.getState()['selected_variation_values'][sVarKey]!=-1){dpState['selected_variations'][dpState['variation_display_labels'][sVarKey]]=dpState['variation_values'][sVarKey][DetailPage.StateController.getState()['selected_variation_values'][sVarKey]];}else{dpState['selected_variations'][dpState['variation_display_labels'][sVarKey]]=null;}}
for(var asin in dpState['asin_variation_values']){var oChildItem=dpState['asin_variation_values'][asin];oChildItem['ASIN']=asin;var sLookup;var oItems;sLookup='';for(var sVarKey in DetailPage.StateController.getState()['selected_variation_values']){sLookup+=(oChildItem[sVarKey]+" ");}
oItems=this.selectionItems[sLookup];if(oItems==undefined){oItems=new Array();}
oItems[0]=oChildItem['ASIN'];this.selectionItems[sLookup]=oItems;if(oVarKeys.length>1){this.insertIntoLookupTree(oChildItem);}
for(var sIgnoreVarKey in DetailPage.StateController.getState()['selected_variation_values']){sLookup='';for(var sVarKey in DetailPage.StateController.getState()['selected_variation_values']){if(sVarKey!=sIgnoreVarKey){sLookup+=(oChildItem[sVarKey]+" ");}else{sLookup+="-1 ";}}
oItems=this.selectionItems[sLookup];if(oItems==undefined){oItems=new Array();}
oItems[oChildItem[sIgnoreVarKey]]=oChildItem['ASIN'];this.selectionItems[sLookup]=oItems;}}
if(oVarKeys.length>1){this.initLookup();}}
this.getSelectedVariations=function(){var oEventVarValues=new Object();var nEventVariationsSelected=0;for(var sVarKey in DetailPage.StateController.getState()['selected_variation_values']){if(DetailPage.StateController.getState()['selected_variation_values'][sVarKey]!=-1){oEventVarValues[DetailPage.StateController.getState()['variation_display_labels'][sVarKey]]=DetailPage.StateController.getState()['variation_values'][sVarKey][DetailPage.StateController.getState()['selected_variation_values'][sVarKey]];nEventVariationsSelected++;}else{oEventVarValues[DetailPage.StateController.getState()['variation_display_labels'][sVarKey]]=null;}}
return oEventVarValues;}
this.getNumberOfDimensionsSelected=function(){var nDimsSelected=0;for(var key in DetailPage.StateController.getState()['selected_variation_values']){if(DetailPage.StateController.getState()['selected_variation_values'][key]>=0){nDimsSelected++;}}
return nDimsSelected;}
this.getSelectedASIN=function(){var selectedASIN=null;var nVariationsSelected=this.getNumberOfDimensionsSelected();if(nVariationsSelected==DetailPage.StateController.getState()['num_variation_dimensions']){var sLookup='';for(var sVarKey in DetailPage.StateController.getState()['selected_variation_values']){if(DetailPage.StateController.getState()['selected_variation_values'][sVarKey]!=-1){sLookup+=(DetailPage.StateController.getState()['selected_variation_values'][sVarKey]+" ");}else{sLookup=null;break;}}
if(sLookup!=null){var oItems=this.selectionItems[sLookup];if(oItems!=null){selectedASIN=this.selectionItems[sLookup][0];}}}
return selectedASIN;};this.prefetchOffers=function(){if(typeof DetailPage!="undefined"){var asinList=this.getReachableAsins();for(var i=0;i<asinList.length;i++){if(asinList[i]==DetailPage.StateController.getState()['current_asin']){var temp=asinList[0];asinList[0]=asinList[i];asinList[i]=temp;}}
if(asinList.length>0){asinList[asinList.length]=DetailPage.StateController.getState()['parent_asin'];}
DetailPage.Model.prefetch(asinList,'offers');}};this.onSelect=function(VarKey,nVarVal,suppressEventPropogation){DetailPage.StateController.getState()['selected_variation_values'][VarKey]=nVarVal;DetailPage.StateController.setState('current_asin',this.getSelectedASIN());this.prefetchOffers();var selectedVars=this.getSelectedVariations();DetailPage.StateController.setState('selected_variations',selectedVars);var event=DetailPage.StateController.getState()['current_asin']?'child_select':'child_deselect';if(!suppressEventPropogation){DetailPage.StateController.notify(event,{current_asin:DetailPage.StateController.getState()['current_asin'],num_dimensions_selected:this.getNumberOfDimensionsSelected(),selected_variations:this.getSelectedVariations(),asin_list:this.getReachableAsins()});}};this.onDeselect=function(VarKey,suppressEventPropogation){DetailPage.StateController.getState()['selected_variation_values'][VarKey]=-1;this.prefetchOffers();var selectedVars=this.getSelectedVariations();DetailPage.StateController.setState('selected_variations',selectedVars);if(!suppressEventPropogation){DetailPage.StateController.notify('child_deselect',{current_asin:null,num_dimensions_selected:this.getNumberOfDimensionsSelected(),selected_variations:selectedVars,asin_list:this.getReachableAsins()});}};this.performManualSelect=function(VarKey,nVarVal){var twisterUIObj=DetailPage.StateController.getState()['TwisterUIObj'];if(typeof twisterUIObj=='object'&&typeof twisterUIObj.selectVarDimVal=='function'){twisterUIObj.selectVarDimVal(VarKey,nVarVal);}};}
// (FILE: /detail-page-features/twister-enhanced-variations-drop-down/DonsBox.js) 


function DonsBox(args){this.id=args["id"];if(!DonsBox.prototype.DonsBoxes){DonsBox.prototype.DonsBoxes={};}
if(this.id in DonsBox.prototype.DonsBoxes)return;DonsBox.prototype.DonsBoxes[this.id]=this;this.locationElement=args["locationElement"];this.width=args["width"];this.minWidth=args["minWidth"];this.singleRowBehavior=args["singleRowBehavior"];if(typeof DonsBox.prototype.defaultValues=="undefined"){DonsBox.prototype.defaultValues=new Object();}
DonsBox.prototype.defaultValues["fadedRowsCSSClass"]="DonsBoxFadedRow";DonsBox.prototype.defaultValues["defaultMessage"]="Please select";DonsBox.prototype.defaultValues["disabledMessage"]="Disabled";this.fadedRows=args["fadedRows"];this.fadedRowsCSSClass=typeof args["fadedRowsCSSClass"]!="undefined"?args["fadedRowsCSSClass"]:DonsBox.prototype.defaultValues["fadedRowsCSSClass"];this.defaultMessage=typeof args["defaultMessage"]!="undefined"?args["defaultMessage"]:DonsBox.prototype.defaultValues["defaultMessage"];this.disabledMessage=typeof args["disabledMessage"]!="undefined"?args["disabledMessage"]:DonsBox.prototype.defaultValues["disabledMessage"];this.disabledPopoverMessage=args["disabledPopoverMessage"];this.headerArray=args["headerArray"];this.hiddenRows=args["hiddenRows"];this.dropDownRowsMatrix={};this.previewRowsMatrix={};this.onSelectCallback=args["onSelect"];DonsBox.prototype.onSelectCallbackWrapper=function(donsBox,index){if(donsBox.onSelectCallback){donsBox.onSelectCallback(donsBox,index);}};this.onClearSelectionCallback=args["onClearSelection"];DonsBox.prototype.onClearSelectionCallbackWrapper=function(donsBox){if(donsBox.onClearSelectionCallback){donsBox.onClearSelectionCallback(donsBox);}};this.onOpenCallback=args["onOpen"];DonsBox.prototype.onOpenCallbackWrapper=function(){if(typeof this.attr("id")=='undefined'||this.attr("id")==null)return;var id=this.attr("id").substring(0,this.attr("id").lastIndexOf("_DonsBox"));if(!(id in DonsBox.prototype.DonsBoxes))return;var donsBox=DonsBox.prototype.DonsBoxes[id];var donsBoxWidth=jQuery('#'+donsBox.id+'_DonsBox').width();if(jQuery.browser.msie){jQuery("#"+id+"_DonsBoxRowsIESpacer").css("width",jQuery("#"+id+"_DonsBox").width());jQuery("#"+id+"_DonsBoxRows table").width("100%");jQuery("#"+id+"_DonsBoxRows table").width("auto");}else{jQuery('#'+donsBox.id+'_DonsBoxRows').css("min-width",donsBoxWidth);jQuery('#'+donsBox.id+'_DonsBoxRows table').css("min-width",donsBoxWidth);jQuery('#'+donsBox.id+'_DonsBoxRows table').width("100%");}
if(donsBox.drawSelectedRowOverlayOnClick){donsBox.drawSelectedRowOverlay();donsBox.drawSelectedRowOverlayOnClick=0;}
jQuery('#'+id+'_DonsBoxRows').css('display','block');if(donsBox.onOpenCallback){donsBox.onOpenCallback(donsBox);}
donsBox.isDropDownOpen=1;};this.onCloseCallback=args["onClose"];DonsBox.prototype.onCloseCallbackWrapper=function(){DonsBox.prototype.clearRowHoverOverlays();if(typeof this.attr("id")=='undefined'||this.attr("id")==null)return;var id=this.attr("id").substring(0,this.attr("id").lastIndexOf("_DonsBox"));if(!(id in DonsBox.prototype.DonsBoxes))return;var donsBox=DonsBox.prototype.DonsBoxes[id];jQuery('#'+id+'_DonsBoxRows').css('display','none');if(donsBox.onCloseCallback){donsBox.onCloseCallback(donsBox);}
donsBox.isDropDownOpen=0;};this.onHoverInRowCallback=args["onHoverInRow"];DonsBox.prototype.onHoverInRowCallbackWrapper=function(donsBox,index){donsBox.currentHoveredRow=index;if(donsBox.lastHoverEvent=="IN")return;if(donsBox.onHoverInRowCallback){donsBox.onHoverInRowCallback(donsBox,index);}
donsBox.lastHoverEvent="IN";};this.onHoverOutRowCallback=args["onHoverOutRow"];DonsBox.prototype.onHoverOutRowCallbackWrapper=function(donsBox,index){donsBox.lastHoveredRow=index;if(donsBox.lastHoverEvent=="OUT")return;if(donsBox.onHoverOutRowCallback){donsBox.onHoverOutRowCallback(donsBox,index);}
donsBox.lastHoverEvent="OUT";}
DonsBox.prototype.onRowQuantityChangeCallback=function(donsBox){var availableIndex=-1;for(var i=0;i<donsBox.dropDownRowsMatrix.length;i++){var classes="DonsBoxSelectableRow";if((donsBox.hiddenRows&&!donsBox.hiddenRows[i])||!donsBox.hiddenRows){if(availableIndex!=-1){jQuery('#'+donsBox.id+'_DonsBox').show();jQuery('#'+donsBox.id+'_DonsBoxSelectedRowPreviewLabel').hide();return;}
availableIndex=i;}}
if(availableIndex==-1){jQuery('#'+donsBox.id+'_DonsBox').hide();}else{if(donsBox.singleRowBehavior=="LABEL"){if(donsBox.selectedRow!=availableIndex){donsBox.selectRow(availableIndex);}
jQuery('#'+donsBox.id+'_DonsBox').hide();jQuery('#'+donsBox.id+'_DonsBoxSelectedRowPreviewLabel').show();}else if(donsBox.singleRowBehavior=="AUTO_SELECT"){if(donsBox.selectedRow!=availableIndex){donsBox.selectRow(availableIndex);}
jQuery('#'+donsBox.id+'_DonsBox').show();jQuery('#'+donsBox.id+'_DonsBoxSelectedRowPreviewLabel').hide();}else{jQuery('#'+donsBox.id+'_DonsBox').show();jQuery('#'+donsBox.id+'_DonsBoxSelectedRowPreviewLabel').hide();}}}
this.isDropDownEnabled=0;this.selectedRow=-1;this.longestRowSize=0;this.drawSelectedRowOverlayOnClick=0;this.isDropDownOpen=0;this.lastHoverEvent="OUT";this.lastRowHovered=-1;this.currentRowHovered=-1;DonsBox.prototype.onClickRowEventHandler=function(e,obj){var index=obj.id.substring(obj.id.lastIndexOf('_')+1);var id=obj.id.substring(0,obj.id.lastIndexOf('_DonsBoxRow'));DonsBox.prototype.clearRowHoverOverlays(id);DonsBox.prototype.selectRow(index,id);e.stopPropagation();};DonsBox.prototype.onHoverInRowEventHandler=function(e,obj){var index=obj.id.substring(obj.id.lastIndexOf('_')+1);var id=obj.id.substring(0,obj.id.lastIndexOf('_DonsBoxRow'));if(!(id in DonsBox.prototype.DonsBoxes))return;var donsBox=DonsBox.prototype.DonsBoxes[id];donsBox.clearRowHoverOverlays();var rowDimPos=donsBox.getRowDimPos(index);var overlayDiv=jQuery('<div id ="'+id+'_DonsBoxRow_HoverOverlay_'+index+'" class="'+id+'_DonsBoxRow_HoverOverlay DonsBoxHoverOverlay" style="width:'+rowDimPos.width+'px;height:'+rowDimPos.height+'px;top:'+rowDimPos.top+'px;left:'+rowDimPos.left+'px;">');overlayDiv.click(function(e){DonsBox.prototype.onClickRowEventHandler(e,this);});overlayDiv.hover(function(e){var id=this.id.substring(0,this.id.lastIndexOf("_DonsBoxRow"));var index=this.id.substring(this.id.lastIndexOf('_')+1);if(!(id in DonsBox.prototype.DonsBoxes))return;var donsBox=DonsBox.prototype.DonsBoxes[id];donsBox.onHoverInRowCallbackWrapper(donsBox,index);e.stopPropagation();},function(e){var id=this.id.substring(0,this.id.lastIndexOf("_DonsBoxRow"));DonsBox.prototype.clearRowHoverOverlays(id);var index=this.id.substring(this.id.lastIndexOf('_')+1);if(!(id in DonsBox.prototype.DonsBoxes))return;var donsBox=DonsBox.prototype.DonsBoxes[id];donsBox.onHoverOutRowCallbackWrapper(donsBox,index);e.stopPropagation();});donsBox.onHoverInRowCallbackWrapper(donsBox,index);jQuery("#"+id+"_DonsBoxRows").append(overlayDiv);e.stopPropagation();}
DonsBox.prototype.getScrollbarWidth=function(){if(typeof DonsBox.prototype.scrollbarWidth!="undefined")return DonsBox.prototype.scrollbarWidth;var scr=null;var inn=null;var wNoScroll=0;var wScroll=0;scr=document.createElement('div');scr.style.position='absolute';scr.style.top='-1000px';scr.style.left='-1000px';scr.style.width='100px';scr.style.height='50px';scr.style.overflow='hidden';inn=document.createElement('div');inn.style.width='100%';inn.style.height='200px';scr.appendChild(inn);document.body.appendChild(scr);wNoScroll=inn.offsetWidth;scr.style.overflow='auto';wScroll=inn.offsetWidth;document.body.removeChild(document.body.lastChild);DonsBox.prototype.scrollbarWidth=(wNoScroll-wScroll);return DonsBox.prototype.scrollbarWidth;}
this.getScrollbarWidth=function(){return DonsBox.prototype.getScrollbarWidth();};DonsBox.prototype.getRowDimPos=function(id,rowIndex){var row=jQuery('#'+id+'_DonsBoxRow_'+rowIndex);var rows=jQuery('#'+id+'_DonsBoxRows');if(typeof row.position()=='undefined')return;return new function(){this.height=row.height();this.width=row.width();this.top=row.position().top+rows.scrollTop();this.left=0;};};this.getRowDimPos=function(rowIndex){return DonsBox.prototype.getRowDimPos(this.id,rowIndex);};DonsBox.prototype.clearSelection=function(id){if(!(id in DonsBox.prototype.DonsBoxes))return;var donsBox=DonsBox.prototype.DonsBoxes[id];var index=donsBox.selectedRow;if(index>=0){jQuery("#"+id+"_DonsBoxRow_"+index).removeClass("DonsBoxSelectedRow");}
donsBox.selectedRow=-1;DonsBox.prototype.drawPreview(id);donsBox.onClearSelectionCallbackWrapper(donsBox);};this.clearSelection=function(){DonsBox.prototype.clearSelection(this.id);};DonsBox.prototype.selectRow=function(index,id){if(!(id in DonsBox.prototype.DonsBoxes))return;var donsBox=DonsBox.prototype.DonsBoxes[id];if((donsBox.hiddenRows&&donsBox.hiddenRows[index])||!donsBox.isEnabled())return;if(donsBox.isDropDownOpen){jQuery("#"+id+"_DonsBox").click();}
donsBox.clearSelection();jQuery("#"+id).val(index);donsBox.selectedRow=index;donsBox.drawSelectedRowOverlay();DonsBox.prototype.drawPreview(id);donsBox.onSelectCallbackWrapper(donsBox,index);};this.selectRow=function(index){DonsBox.prototype.selectRow(index,this.id);};DonsBox.prototype.drawSelectedRowOverlay=function(id){if(!(id in DonsBox.prototype.DonsBoxes))return;var donsBox=DonsBox.prototype.DonsBoxes[id];if(donsBox.selectedRow<0)return;if(jQuery('#'+id+'_DonsBoxRows').css('display')=='none'){donsBox.drawSelectedRowOverlayOnClick=1;return;}
donsBox.clearSelectedRowOverlay();var rowDimPos=DonsBox.prototype.getRowDimPos(id,donsBox.selectedRow);if(typeof rowDimPos=='undefined')return;var overlayDiv=jQuery('<div id ="'+id+'_DonsBoxRow_SelectedOverlay_'+donsBox.selectedRow+'" '+'class="'+id+'_DonsBoxRow_SelectedOverlay DonsBoxSelectedOverlay" '+'style="width:'+rowDimPos.width+'px;height:'+rowDimPos.height+'px;top:'+rowDimPos.top+'px;left:'+rowDimPos.left+'px;">');overlayDiv.hover(function(){var id=this.id.substring(0,this.id.lastIndexOf("_DonsBoxRow"));DonsBox.prototype.clearRowHoverOverlays(id);var index=this.id.substring(this.id.lastIndexOf('_')+1);if(!(id in DonsBox.prototype.DonsBoxes))return;var donsBox=DonsBox.prototype.DonsBoxes[id];donsBox.onHoverInRowCallbackWrapper(donsBox,index);},function(){var id=this.id.substring(0,this.id.lastIndexOf("_DonsBoxRow"));DonsBox.prototype.clearRowHoverOverlays(id);var index=this.id.substring(this.id.lastIndexOf('_')+1);if(!(id in DonsBox.prototype.DonsBoxes))return;var donsBox=DonsBox.prototype.DonsBoxes[id];donsBox.onHoverOutRowCallbackWrapper(donsBox,index);});jQuery("#"+id+"_DonsBoxRows").append(overlayDiv);};this.drawSelectedRowOverlay=function(){DonsBox.prototype.drawSelectedRowOverlay(this.id);};DonsBox.prototype.drawPreview=function(id){if(!(id in DonsBox.prototype.DonsBoxes))return;var donsBox=DonsBox.prototype.DonsBoxes[id];var content='<table border="0" cellspacing="0"><tbody><tr>';if(donsBox.selectedRow>=0&&donsBox.isDropDownEnabled){for(var i=0;i<donsBox.previewRowsMatrix[donsBox.selectedRow].length;i++){content+="<td>"+donsBox.previewRowsMatrix[donsBox.selectedRow][i]+"</td>";}}else{if(donsBox.isDropDownEnabled){content+="<td>"+donsBox.defaultMessage+"</td>";}else{content+="<td>"+donsBox.disabledMessage+"</td>";}}
content+="</tr></tbody></table>";jQuery("#"+id+"_DonsBoxSelectedRowPreview").html(content);jQuery("#"+id+"_DonsBoxSelectedRowPreviewLabel").html(content);if(!donsBox.width&&donsBox.minWidth>0){jQuery("#"+id+"_DonsBox").width("auto");if(jQuery("#"+id+"_DonsBox").width()<donsBox.minWidth){jQuery("#"+id+"_DonsBox").width(donsBox.minWidth);}}};this.drawPreview=function(){DonsBox.prototype.drawPreview(this.id);};DonsBox.prototype.drawRows=function(id){if(!(id in DonsBox.prototype.DonsBoxes))return;var donsBox=DonsBox.prototype.DonsBoxes[id];var rows='<table cellspacing="0" cellpadding="4" border="0" style="white-space:nowrap">';if(donsBox.headerArray){rows+='<tr id="'+id+'_DonsBoxHeader" class="DonsBoxHeaderRow">';for(var i=0;i<donsBox.headerArray.length;i++){if((i+1)>=donsBox.headerArray.length){rows+='<td colspan="'+(donsBox.longestRowSize-i)+'">';}else{rows+="<td>"}
rows+=donsBox.headerArray[i]+"</td>";}
rows+="</tr>";}
for(var i=0;i<donsBox.dropDownRowsMatrix.length;i++){var classes="DonsBoxSelectableRow";if(donsBox.hiddenRows&&donsBox.hiddenRows[i]){continue;}
if(i==donsBox.selectedRow){classes+=" DonsBoxSelectedRow";}else if(donsBox.fadedRows&&donsBox.fadedRows[i]){classes+=" "+donsBox.fadedRowsCSSClass;}
rows+='<tr id="'+id+'_DonsBoxRow_'+i+'" class="'+classes+'" valign="center">';for(var j=0;j<donsBox.dropDownRowsMatrix[i].length;j++){var cell=donsBox.dropDownRowsMatrix[i][j];if(!cell||cell==""){cell=" ";}
if((j+1)==donsBox.dropDownRowsMatrix[i].length){rows+='<td colspan="'+(donsBox.longestRowSize-j)+'">'+cell+'</td>';}else{rows+='<td>'+cell+'</td>';}}
rows+='</tr>';}
if(jQuery.browser.msie){rows+='<div id="'+id+'_DonsBoxRowsIESpacer" class="DonsBoxRowsIESpacer"><!-- --></div>';}
rows+="</table>";jQuery('#'+donsBox.id+'_DonsBoxRows').html(rows);jQuery('#'+donsBox.id+'_DonsBoxRows').css("height","auto");if(jQuery('#'+donsBox.id+'_DonsBoxRows').innerHeight()>300){jQuery('#'+donsBox.id+'_DonsBoxRows').css("height",300);if(!donsBox.width&&!jQuery.browser.msie){jQuery('#'+donsBox.id+'_DonsBoxRows').css("padding-right",donsBox.getScrollbarWidth());}}else{jQuery('#'+donsBox.id+'_DonsBoxRows').css("padding-right",0);}
jQuery("#"+donsBox.id+"_DonsBoxRows tr").click(function(e){DonsBox.prototype.onClickRowEventHandler(e,this);}).hover(function(e){DonsBox.prototype.onHoverInRowEventHandler(e,this);},function(e){e.stopPropagation();}).bind('touchstart',function(e){DonsBox.prototype.onHoverInRowEventHandler(e,this);}).bind('touchend',function(e){DonsBox.prototype.onClickRowEventHandler(e,this);});jQuery("tr."+DonsBox.prototype.defaultValues["fadedRowsCSSClass"]+" td *").fadeTo(0,0.25);donsBox.drawSelectedRowOverlay();};this.drawRows=function(){DonsBox.prototype.drawRows(this.id);};DonsBox.prototype.clearRowHoverOverlays=function(id){if(!id){for(var key in DonsBox.prototype.DonsBoxes){jQuery("."+key+"_DonsBoxRow_HoverOverlay").remove();}}else{jQuery("."+id+"_DonsBoxRow_HoverOverlay").remove();}}
this.clearRowHoverOverlays=function(){DonsBox.prototype.clearRowHoverOverlays(this.id);};DonsBox.prototype.clearSelectedRowOverlay=function(id){if(!id||typeof id=='undefined')return;jQuery("."+id+"_DonsBoxRow_SelectedOverlay").remove();};this.clearSelectedRowOverlay=function(){DonsBox.prototype.clearSelectedRowOverlay(this.id);};DonsBox.prototype.clearFadedRows=function(id){DonsBox.prototype.setFadedRows(id,null);};this.clearFadedRows=function(){DonsBox.prototype.setFadedRows(this.id,null);};DonsBox.prototype.clearHiddenRows=function(id){DonsBox.prototype.setHiddenRows(id,null);};this.clearHiddenRows=function(){DonsBox.prototype.setHiddenRows(this.id,null);};DonsBox.prototype.setRows=function(id,dropDownRowsMatrix,previewRowsMatrix){if(!(id in DonsBox.prototype.DonsBoxes))return;var donsBox=DonsBox.prototype.DonsBoxes[id];donsBox.dropDownRowsMatrix=dropDownRowsMatrix;for(var i=0;i<dropDownRowsMatrix.length;i++){donsBox.longestRowSize=(donsBox.longestRowSize<dropDownRowsMatrix[i].length)?dropDownRowsMatrix[i].length:donsBox.longestRowSize;}
DonsBox.prototype.drawRows(id);donsBox.onRowQuantityChangeCallback(donsBox);if(!previewRowsMatrix){previewRowsMatrix=dropDownRowsMatrix;}
donsBox.previewRowsMatrix=previewRowsMatrix;DonsBox.prototype.drawPreview(id);}
this.setRows=function(dropDownRowsMatrix,previewRowsMatrix){DonsBox.prototype.setRows(this.id,dropDownRowsMatrix,previewRowsMatrix);};DonsBox.prototype.setHeaderArray=function(id,headerArray){if(!(id in DonsBox.prototype.DonsBoxes))return;var donsBox=DonsBox.prototype.DonsBoxes[id];donsBox.headerArray=headerArray;DonsBox.prototype.drawRows(id);}
this.setHeaderArray=function(headerArray){DonsBox.prototype.setHeaderArray(this.id,headerArray)};DonsBox.prototype.removeHeaderArray=function(id){DonsBox.prototype.setHeaderArray(id,null);}
this.removeHeaderArray=function(headerArray){DonsBox.prototype.setHeaderArray(this.id,null)};DonsBox.prototype.setFadedRows=function(id,fadedRows){if(!(id in DonsBox.prototype.DonsBoxes))return;var donsBox=DonsBox.prototype.DonsBoxes[id];donsBox.fadedRows=fadedRows;DonsBox.prototype.drawRows(id);}
this.setFadedRows=function(fadedRows){DonsBox.prototype.setFadedRows(this.id,fadedRows)};DonsBox.prototype.setHiddenRows=function(id,hiddenRows){if(!(id in DonsBox.prototype.DonsBoxes))return;var donsBox=DonsBox.prototype.DonsBoxes[id];donsBox.hiddenRows=hiddenRows;DonsBox.prototype.drawRows(id);donsBox.onRowQuantityChangeCallback(donsBox);}
this.setHiddenRows=function(hiddenRows){DonsBox.prototype.setHiddenRows(this.id,hiddenRows);};DonsBox.prototype.setEnabled=function(id,isEnabled){if(!(id in DonsBox.prototype.DonsBoxes))return;var donsBox=DonsBox.prototype.DonsBoxes[id];var donsBoxElements=donsBox.locationElement+" div.DonsBox";var locationFunc=function(popover,settings){var triggerElement=jQuery('#'+donsBox.id+'_DonsBox');var offset=triggerElement.offsetIPadFix();return{top:offset.top+triggerElement.height(),left:offset.left};};if(isEnabled&&!donsBox.isDropDownEnabled){amznJQ.available("popover",function(){jQuery(donsBoxElements).removeAmazonPopoverTrigger().amazonPopoverTrigger({localContent:'#'+donsBox.id+'_DonsBoxRows',location:"bottom",showOnHover:false,showCloseButton:false,location:locationFunc,skin:null,onShow:donsBox.onOpenCallbackWrapper,onHide:donsBox.onCloseCallbackWrapper,closeEventInclude:"CLICK_OUTSIDE",forceAlignment:true,group:"DonsBoxDropDowns",width:null}).css("cursor","pointer");});jQuery('#'+donsBox.id+'_DonsBoxSelectedRowPreview').html(donsBox.defaultMessage);}else if(!isEnabled&&donsBox.isDropDownEnabled){amznJQ.available("popover",function(){jQuery(donsBoxElements).removeAmazonPopoverTrigger();if(donsBox.disabledPopoverMessage){jQuery(donsBoxElements).amazonPopoverTrigger({localContent:'#'+donsBox.id+'_DonsBoxDisabledPopover',location:locationFunc,showOnHover:true,showCloseButton:false,locationOffset:[-100,-20],skin:null,closeEventInclude:"MOUSE_LEAVE",group:"DonsBoxDisabledPopovers",forceAlignment:true}).css("cursor","not-allowed");}});if(donsBox.disabledPopoverMessage){jQuery('#'+donsBox.id+'_DonsBoxSelectedRowPreview').html(donsBox.disabledMessage);}}
donsBox.isDropDownEnabled=isEnabled;};this.setEnabled=function(isEnabled,message){DonsBox.prototype.setEnabled(this.id,isEnabled,message);};this.getId=function(){return this.id;};DonsBox.prototype.isRowFaded=function(id,index){if(!(id in DonsBox.prototype.DonsBoxes))return;var donsBox=DonsBox.prototype.DonsBoxes[id];return(index>=0&&donsBox.fadedRows&&donsBox.fadedRows[index]);};this.isRowFaded=function(index){return DonsBox.prototype.isRowFaded(this.id,index);};DonsBox.prototype.isRowHidden=function(id,index){if(!(id in DonsBox.prototype.DonsBoxes))return;var donsBox=DonsBox.prototype.DonsBoxes[id];return(index>=0&&donsBox.hiddenRows&&donsBox.hiddenRows[index]);};this.isRowHidden=function(index){return DonsBox.prototype.isRowHidden(this.id,index);};DonsBox.prototype.isEnabled=function(id){if(!(id in DonsBox.prototype.DonsBoxes))return;var donsBox=DonsBox.prototype.DonsBoxes[id];return donsBox.isDropDownEnabled;};this.isEnabled=function(index){return DonsBox.prototype.isEnabled(this.id);};DonsBox.prototype.getLastHoveredRowIndex=function(id){if(!(id in DonsBox.prototype.DonsBoxes))return;var donsBox=DonsBox.prototype.DonsBoxes[id];return donsBox.lastHoveredRow;};this.getLastHoveredRowIndex=function(){return DonsBox.prototype.getLastHoveredRowIndex(this.id);};DonsBox.prototype.getCurrentHoveredRowIndex=function(id){if(!(id in DonsBox.prototype.DonsBoxes))return;var donsBox=DonsBox.prototype.DonsBoxes[id];return donsBox.currentHoveredRow;};this.getCurrentHoveredRowIndex=function(){return DonsBox.prototype.getLastHoveredRowIndex(this.id);};DonsBox.prototype.initialize=function(id){if(!(id in DonsBox.prototype.DonsBoxes))return;var donsBox=DonsBox.prototype.DonsBoxes[id];var style=(donsBox.width&&donsBox.width>0)?donsBox.width:'auto';if(donsBox.locationElement){jQuery(donsBox.locationElement).html('<div id="'+donsBox.id+'_DonsBoxRows" style="width:'+style+'" class="DonsBoxRows"/>'+'<div id="'+donsBox.id+'_DonsBoxDisabledPopover" class="DonsBoxDisabledPopover">'+
donsBox.disabledPopoverMessage+'</div>'+'<div id="'+donsBox.id+'_DonsBox" style="width:'+style+'" class="DonsBox"/>'+'<input type="hidden" id="'+donsBox.id+'" name="'+donsBox.id+'"/>'+'<div id="'+donsBox.id+'_DonsBoxSelectedRowPreviewLabel" class="DonsBoxSelectedRowPreviewLabel"></div>');jQuery('#'+donsBox.id+'_DonsBox').html('<div id="'+donsBox.id+'_DonsBoxSelectedRowPreview" class="DonsBoxSelectedRowPreview"/>'+'<div id="'+donsBox.id+'_DonsBoxButton" class="DonsBoxButton"/>');jQuery('#'+donsBox.id+'_DonsBoxSelectedRowPreview').html(donsBox.defaultMessage);if(donsBox.width){jQuery('#'+donsBox.id+'_DonsBox').width(donsBox.width);}}
donsBox.setRows(args["dropDownRowsMatrix"],args["previewRowsMatrix"]);donsBox.setEnabled(1);donsBox.drawRows(donsBox.id);jQuery('#'+donsBox.id+'_DonsBoxRows').css("visibility","visible");};this.initialize=function(){DonsBox.prototype.initialize(this.id);};this.initialize();amznJQ.declareAvailable("donsBox");}
// (FILE: /detail-page-features/twister-variations/twister-swatches.js) 


var AjaxScope=function(scopeName,time){this.scopeName=scopeName;this.featureAF=false;this.featureCF=false;this.imageLoaded=false;var dpState=DetailPage.StateController.getState();var isFlushingParam="";if(typeof window.isFlushing!='undefined'&&window.isFlushing){isFlushingParam="&isFlushing="+window.isFlushing;}
this.url="/gp/twister/dynamic-update/ajax-measurement.html/?s="+dpState['store_id']+"&pgid="+dpState['product_group_id']+isFlushingParam;this.atfCond=1;if(window.twisterMarkImageLoad){this.atfCond++;}
this.cfCond=2;ues("t0",scopeName,time);ues("ctb",scopeName,"1");this.signalAtfMarker=function(){if(this.featureAF){return;}
this.featureAF=true;this.signalATF();}
this.signalCfMarker=function(){if(this.featureCF){return;}
this.featureCF=true;this.signalCF();}
this.signalImageLoad=function(){if(this.imageLoaded){return;}
this.imageLoaded=true;this.signalATF();}
this.signalATF=function(){if(this.atfCond==0){return;}
this.atfCond--;if(!this.atfCond){uet("af",this.scopeName);this.signalCF();}}
this.signalCF=function(){if(this.cfCond==0){return;}
this.cfCond--;if(!this.cfCond){uet("cf",this.scopeName);this.postData();}}
this.postData=function(){var lScopeName=this.scopeName;jQuery.ajax({url:this.url,dataType:'text',timeout:40000,error:function(){},success:function(data,status,xhr){ues("id",lScopeName,data);uex("ld",lScopeName);}});}}
var TwisterMeasurement=function(){this.scopeCount={};this.ajaxScopes={};this.start=function(ASIN,time){if(window.ue){if(!this.scopeCount[ASIN]){this.scopeCount[ASIN]=0;}
var scopeName=this.makeScopeName(ASIN);this.ajaxScopes[ASIN]=new AjaxScope(scopeName,time);}}
this.stampImageLoad=function(ASIN){if(!this.ajaxScopes[ASIN]){return;}
this.ajaxScopes[ASIN].signalImageLoad();}
this.stampCF=function(ASIN){if(!this.ajaxScopes[ASIN]){return;}
this.ajaxScopes[ASIN].signalCfMarker();}
this.stampATF=function(ASIN){if(!this.ajaxScopes[ASIN]){return;}
this.ajaxScopes[ASIN].signalAtfMarker();}
this.makeScopeName=function(ASIN){var scopeName='refreshScope';if(window.twisterCorrectInstrumentation){scopeName=ASIN+(this.scopeCount[ASIN]+1);this.scopeCount[ASIN]++;}
return scopeName;}}
window.twisterMeasurement=new TwisterMeasurement();function TwisterVariations(oSwatchVariationKeys,oDropdownVariationKeys){window.scope="refreshScope";this.dpState=DetailPage.StateController.getState();DetailPage.StateController.setState('TwisterUIObj',this);var nVariationsTotal=0;var oHoveredVarValues=new Array();var oVariationDisplayTypes=new Array();var oSwatchElements=new Array();var oSwatchStateCache=new Array();var oDropdownLookupState=new Array();var additionalTextList={};var oDimensionsWithRestrictedFetchRanges={};var oDropDownFetchRange=20;var availColor="#006699";var notAvailColor="#BBBBBB";var oInitialSelection;goTwisterCore=new TwisterCore();this.getSelectedDisplayVariationValues=function(){return DetailPage.StateController.getState()['selected_variations'];}
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 DetailPage.StateController.getState()['selected_variation_values']){if(oVariationDisplayTypes[sVarKey]!='d')
continue
var dropdown=document.getElementById(sVarKey);if(dropdown){var index=parseInt(DetailPage.StateController.getState()['selected_variation_values'][sVarKey]);if(index>=0&&dropdown.options[index]&&!DetailPage.StateController.getState()['is_dpm']&&nVariationsTotal==1){dropdown.options[index].selected=true;}else if(index>=0&&dropdown.options[index+1]){dropdown.options[index+1].selected=true;}}}}
{for(var sVarKey in DetailPage.StateController.getState()['selected_variation_values']){oHoveredVarValues[sVarKey]=-1;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 this.dpState['variation_values'][sVarKey]){var sDivId=sVarKey+'_'+nVarValue;oSwatchElements[sVarKey][nVarValue]=document.getElementById(sDivId);oSwatchStateCache[sVarKey][nVarValue]=oSwatchElements[sVarKey][nVarValue].className;}}
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';oDimensionsWithRestrictedFetchRanges[oDropdownVariationKeys[i]]=oDropDownFetchRange;}
this.getVariationDisplayTypes=function(){return oVariationDisplayTypes;}}
this.onLoad=function(){this.resetDropdowns();this.updateLabels();this.updateSwatches();this.prefetchOffers();if(typeof DetailPage!='undefined'){if(this.dpState['current_asin']!=null){if(typeof window.isFlushing!='undefined'&&window.isFlushing){DetailPage.Model.fetch(this.dpState['current_asin'],'offers',this.labelCallback(),null,'asin');}else{DetailPage.Model.fetch(this.dpState['current_asin'],'offers',this.labelCallback());}}}else{var nVariationsSelected=0;for(var sVarKey in DetailPage.StateController.getState()['selected_variation_values']){if(DetailPage.StateController.getState()['selected_variation_values'][sVarKey]!=-1){nVariationsSelected++;}}
if((nVariationsSelected>0)||(nVariationsTotal==1)){this.triggerEvent('loadSelectedChildData');}}}
this.labelCallback=function(){var obj=this;return function(asin,asinData){if(asin==DetailPage.StateController.getState()['current_asin']){asinData['asin']=asin;obj.updateLabels(asinData);}}}
this.getNumberOfSelectedVariations=function(){var nVariationsSelected=0;for(var sVarKey in DetailPage.StateController.getState()['selected_variation_values']){if(DetailPage.StateController.getState()['selected_variation_values'][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 DetailPage.StateController.getState()['selected_variation_values']){if(sCurVarKey!=sVarKey){if(oHoveredVarValues[sCurVarKey]!=-1){sLookup+=(oHoveredVarValues[sCurVarKey]+" ");}else if(DetailPage.StateController.getState()['selected_variation_values'][sCurVarKey]!=-1){sLookup+=(DetailPage.StateController.getState()['selected_variation_values'][sCurVarKey]+" ");}else{sLookup+="-1 ";}}else{sLookup+="* ";}}
if(sLookup!=null){oItems=goTwisterCore.selectionItems[sLookup];}
for(var nVarValue in oSwatchElements[sVarKey]){var sSwatchState='swatchAvailable';if(DetailPage.StateController.getState()['selected_variation_values'][sVarKey]==nVarValue){if(oItems&&(oItems[nVarValue]==undefined)){sSwatchState='swatchSelectGray';}else{sSwatchState='swatchSelect';}
sSwatchState='swatchSelect';updateSwatchTitle(sVarKey,nVarValue,false);}else if(oHoveredVarValues[sVarKey]==nVarValue){if(oItems&&(oItems[nVarValue]==undefined)){sSwatchState='swatchUnavailableHover';}else{sSwatchState='swatchHover';}
updateSwatchTitle(sVarKey,nVarValue,true);}else{if(oItems&&(oItems[nVarValue]==undefined)){sSwatchState='swatchUnavailable';}else{sSwatchState='swatchAvailable';}
updateSwatchTitle(sVarKey,nVarValue,true);}
if(sSwatchState!=oSwatchStateCache[sVarKey][nVarValue]){oSwatchElements[sVarKey][nVarValue].className=sSwatchState;oSwatchStateCache[sVarKey][nVarValue]=sSwatchState;}}}}
function updateSwatchTitle(sVarKey,nVarValue,enable){amznJQ.available("jQuery",function(){var swatch=jQuery('#'+sVarKey+"_"+nVarValue).parent();var title=enable?swatch.attr("tooltip"):swatch.attr("title");if(title&&title.length>0){if(enable){swatch.attr("title",title);}else{swatch.attr("tooltip",title);swatch.attr("title","");}}});}
this.updateDropdowns=function(sChangedVarKey){for(var sVarKey in DetailPage.StateController.getState()['selected_variation_values']){if((oVariationDisplayTypes[sVarKey]!='d')||(sVarKey==sChangedVarKey)){continue;}
var oDropdown=document.getElementById(sVarKey);var sLookup='';for(var sCurVarKey in DetailPage.StateController.getState()['selected_variation_values']){if(sCurVarKey!=sVarKey){if(DetailPage.StateController.getState()['selected_variation_values'][sCurVarKey]!=-1){sLookup+=(DetailPage.StateController.getState()['selected_variation_values'][sCurVarKey]+" ");}else{sLookup+="-1 ";}}else{sLookup+="* ";}}
if((oDropdownLookupState[sVarKey]!=undefined)&&(oDropdownLookupState[sVarKey]==sLookup)){continue;}
oDropdownLookupState[sVarKey]=sLookup;var nVarValueOrig=DetailPage.StateController.getState()['selected_variation_values'][sVarKey];var aOptions=new Array();var count=0;if(sLookup!=''){var oItems=goTwisterCore.selectionItems[sLookup];var dpfStateVariationValues=DetailPage.StateController.getState()['variation_values'];for(var val in dpfStateVariationValues[sVarKey]){var option={nVal:val,sVal:this.dpState['variation_values'][sVarKey][val],sAvail:0};for(var nVarValue in oItems){if(dpfStateVariationValues[sVarKey][val]==this.dpState['variation_values'][sVarKey][nVarValue]){option.sAvail=1;break;}}
aOptions[count]=option;count++;}}else{for(var nVarValue in this.dpState['variation_values'][sVarKey]){aOptions[count]={nVal:nVarValue,sVal:this.dpState['variation_values'][sVarKey][nVarValue]};count++;}}
function sortDropdown(a,b){return(b.sVal<a.sVal)-(a.sVal<b.sVal);}
if(goVariationStrings['defaultParent']){if(oDropdown.options[0]!=null){oDropdown.options[0].selected=true;oDropdown.options[0].defaultSelected=true;}
else{oDropdown.options[0]=new Option(goTwisterSwatchStrings['select'],-1,true,true);}}
var index=0;for(var i=0;i<aOptions.length;i++){if(aOptions[i].nVal==nVarValueOrig){index=i+1;}
oDropdown.options[i+1].style.color=notAvailColor;oDropdown.options[i+1].isAvail=0;if(aOptions[i].sAvail){oDropdown.options[i+1].style.color=availColor;oDropdown.options[i+1].isAvail=1;}}
if(index>0){oDropdown.options[index].selected=true;}}}
this.updateLabels=function(oOfferData){if(typeof oOfferData=='string'){if(typeof DetailPage!='undefined'){if(typeof window.isFlushing!='undefined'&&window.isFlushing){DetailPage.Model.fetch(oOfferData,'offers',this.labelCallback(),null,'asin');}else{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 DetailPage.StateController.getState()['selected_variation_values']){if(DetailPage.StateController.getState()['selected_variation_values'][sVarKey]==-1){bFirst=0;notLast=last;last=DetailPage.StateController.getState()['variation_display_labels'][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 DetailPage.StateController.getState()['selected_variation_values']){var labelDiv=document.getElementById("selected_"+sVarKey);var sHTML="";if(this.dpState['variation_display_labels'][sVarKey]!=undefined){sHTML='<b class=variationDefault>'+this.dpState['variation_display_labels'][sVarKey]+': </b>';}
if(window.isBBButtonHoveredOnce&&(this.dpState['selected_variation_values'][sVarKey]==-1)&&window.scrunchDPMStoreWeblab){sHTML='<span id="warnImageLabel">'+warnImage+' '+'<b class=variationDefault>'+this.dpState['variation_display_labels'][sVarKey]+': </b>'+'</span>';}
if(!additionalTextList[sVarKey]){additionalTextList[sVarKey]=new Array();}
if(oOfferData&&!additionalTextList[sVarKey][oOfferData['asin']]&&extraStringHash[sVarKey]){additionalTextList[sVarKey][oOfferData['asin']]=' ('+extraStringHash[sVarKey]+')';}
if(oHoveredVarValues[sVarKey]!=undefined){if((oHoveredVarValues[sVarKey]!=-1)&&(oHoveredVarValues[sVarKey]!=DetailPage.StateController.getState()['selected_variation_values'][sVarKey])){if(nVariationsTotal==1){sHTML+='<b class=variationDefault></b>';}
sHTML+='<b class=variationLabelHovered>'+this.dpState['variation_values'][sVarKey][oHoveredVarValues[sVarKey]]+(oOfferData&&additionalTextList[sVarKey][oOfferData['asin']]&&extraStringHash[sVarKey]!=this.dpState['variation_values'][sVarKey][oHoveredVarValues[sVarKey]]?additionalTextList[sVarKey][oOfferData['asin']]:'')+'</b>';}else if(DetailPage.StateController.getState()['selected_variation_values'][sVarKey]!=-1){if(nVariationsTotal>1){if(this.dpState['variation_values'][sVarKey].length==1){sHTML+=this.dpState['variation_values'][sVarKey][DetailPage.StateController.getState()['selected_variation_values'][sVarKey]]+(oOfferData&&additionalTextList[sVarKey][oOfferData['asin']]&&extraStringHash[sVarKey]!=this.dpState['variation_values'][sVarKey][DetailPage.StateController.getState()['selected_variation_values'][sVarKey]]?additionalTextList[sVarKey][oOfferData['asin']]:'');}else{sHTML+='<b class=variationLabel>'+this.dpState['variation_values'][sVarKey][DetailPage.StateController.getState()['selected_variation_values'][sVarKey]]+(oOfferData&&additionalTextList[sVarKey][oOfferData['asin']]&&extraStringHash[sVarKey]!=this.dpState['variation_values'][sVarKey][DetailPage.StateController.getState()['selected_variation_values'][sVarKey]]?additionalTextList[sVarKey][oOfferData['asin']]:'')+'</b>';}}else{sHTML+='<b class=variationDefault></b>';if(this.dpState['variation_values'][sVarKey].length==1){sHTML+=this.dpState['variation_values'][sVarKey][DetailPage.StateController.getState()['selected_variation_values'][sVarKey]]+(oOfferData&&additionalTextList[sVarKey][oOfferData['asin']]&&extraStringHash[sVarKey]!=this.dpState['variation_values'][sVarKey][DetailPage.StateController.getState()['selected_variation_values'][sVarKey]]?additionalTextList[sVarKey][oOfferData['asin']]:'');}else{sHTML+='<b class=variationLabel>'+this.dpState['variation_values'][sVarKey][DetailPage.StateController.getState()['selected_variation_values'][sVarKey]]+(oOfferData&&additionalTextList[sVarKey][oOfferData['asin']]&&extraStringHash[sVarKey]!=this.dpState['variation_values'][sVarKey][DetailPage.StateController.getState()['selected_variation_values'][sVarKey]]?additionalTextList[sVarKey][oOfferData['asin']]:'')+'</b>';}}}else{sHTML+='<b class=variationDefault></b><span class="swatchUnselectedSelectPromptText">'+goVariationStrings['pleaseSelect']+'</span>';}}
if(labelDiv!=undefined&&sHTML.length>0){labelDiv.innerHTML=sHTML;}}}
this.onHoverOverSwatch=function(sVarKey,nVarValue,isHoverOff){oHoveredVarValues[sVarKey]=nVarValue;this.updateSwatches();if(isHoverOff&&!touchDeviceDetected){return;}
this.updateLabels();if(touchDeviceDetected){this.onClickSwatch(sVarKey,nVarValue);}else{this.triggerEvent('preview');}}
this.onHoverOffSwatch=function(isHoverOff){for(var sVarKey in oHoveredVarValues){oHoveredVarValues[sVarKey]=-1;}
if(touchDeviceDetected){return;}
this.updateSwatches();if(isHoverOff){return;}
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,performingPreselect){if(oVariationDisplayTypes[sVarKey]=='f'){return false;}
if(window.twisterCorrectInstrumentation==2){window.twisterInteractionStartTime=new Date();}
if(DetailPage.StateController.getState()['selected_variation_values'][sVarKey]==nVarValue&&!performingPreselect){return;}else{if((oSwatchStateCache[sVarKey][nVarValue]=='swatchUnavailableHover')||(window.isIvWeblab&&(oSwatchStateCache[sVarKey][nVarValue]=='swatchUnavailable'))){for(var sCurVarKey in DetailPage.StateController.getState()['selected_variation_values']){if(oVariationDisplayTypes[sCurVarKey]!='f'){if(!window.isDVDOEnabled||DetailPage.StateController.getState()['variation_values'][sCurVarKey].length!=1){DetailPage.StateController.getState()['selected_variation_values'][sCurVarKey]=-1;}}}}
DetailPage.StateController.getState()['selected_variation_values'][sVarKey]=nVarValue;}
this.updateSwatches();this.updateDropdowns(sVarKey);this.updateLabels();this.triggerEvent('select',bSuppressEventPropagation);return false;}
this.onChangeDropdown=function(sVarKey,oOfferData,bSuppressEventPropagation,performingPreselect){if(window.twisterCorrectInstrumentation==2){window.twisterInteractionStartTime=new Date();}
var oDropdown=document.getElementById(sVarKey);var option=oDropdown.options[oDropdown.selectedIndex];var nVarValue=option.value;if(nVarValue!=-1&&!option.isAvail&&!performingPreselect){var numberOfDims=0;for(var sCurVarKey in DetailPage.StateController.getState()['selected_variation_values']){if(oVariationDisplayTypes[sCurVarKey]!='f'){if(!window.isDVDOEnabled||DetailPage.StateController.getState()['variation_values'][sCurVarKey].length!=1){DetailPage.StateController.getState()['selected_variation_values'][sCurVarKey]=-1;}
numberOfDims++;}}
if(!option.isAvail){DetailPage.StateController.getState()['selected_variation_values'][sVarKey]=nVarValue;}
if(numberOfDims>1)
sVarKey='';}else if(nVarValue==-1){for(var sCurVarKey in DetailPage.StateController.getState()['selected_variation_values']){if(sCurVarKey==sVarKey){DetailPage.StateController.getState()['selected_variation_values'][sVarKey]=-1;}}}else{DetailPage.StateController.getState()['selected_variation_values'][sVarKey]=nVarValue;}
this.updateSwatches();this.updateDropdowns(sVarKey);this.updateLabels(oOfferData);this.triggerEvent('select',bSuppressEventPropagation);}
var eventActionId=0;var lastEvent;this.triggerEvent=function(sEventType,bSuppressEventPropagation){var oEventVarValues=new Object();var nEventVariationsSelected=0;for(var sVarKey in DetailPage.StateController.getState()['selected_variation_values']){if((sEventType=='preview')&&(oHoveredVarValues[sVarKey]!=-1)){oEventVarValues[this.dpState['variation_display_labels'][sVarKey]]=this.dpState['variation_values'][sVarKey][oHoveredVarValues[sVarKey]];nEventVariationsSelected++;}else if(DetailPage.StateController.getState()['selected_variation_values'][sVarKey]!=-1){oEventVarValues[this.dpState['variation_display_labels'][sVarKey]]=this.dpState['variation_values'][sVarKey][DetailPage.StateController.getState()['selected_variation_values'][sVarKey]];nEventVariationsSelected++;}else{oEventVarValues[this.dpState['variation_display_labels'][sVarKey]]=null;}}
if(sEventType!='preview')
DetailPage.StateController.setState('selected_variations',oEventVarValues);var sBuyableASIN=null;if(nEventVariationsSelected==nVariationsTotal){var sLookup='';for(var sVarKey in DetailPage.StateController.getState()['selected_variation_values']){if((sEventType=='preview')&&(oHoveredVarValues[sVarKey]!=-1)){sLookup+=(oHoveredVarValues[sVarKey]+" ");}else if(DetailPage.StateController.getState()['selected_variation_values'][sVarKey]!=-1){sLookup+=(DetailPage.StateController.getState()['selected_variation_values'][sVarKey]+" ");}else{sLookup=null;break;}}
if(sLookup!=null){var oItems=goTwisterCore.selectionItems[sLookup];if(oItems!=null){sBuyableASIN=goTwisterCore.selectionItems[sLookup][0];}}}
if(sEventType=='select'&&sBuyableASIN){if(window.ue&&window.twisterCorrectInstrumentation){var new_t0=(window.twisterCorrectInstrumentation==2)?window.twisterInteractionStartTime:new Date();window.twisterMeasurement.start(sBuyableASIN,new_t0);}}
if((sEventType=='preview'||sEventType=='select')&&typeof DetailPage!='undefined'){this.updateLabels(sBuyableASIN);}
var aAsinList=[];if(sEventType=='select'||sEventType=='loadSelectedChildData'){aAsinList=goTwisterCore.getReachableAsins(oDimensionsWithRestrictedFetchRanges);}
if(typeof DetailPage!='undefined'&&!bSuppressEventPropagation){if(sEventType=='select'){this.prefetchOffers();if(sBuyableASIN){if(window.ue&&!window.twisterCorrectInstrumentation){var new_t0=new Date();window.twisterMeasurement.start(sBuyableASIN,new_t0);}
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=this.dpState['variation_display_labels'];oEventData.aAsinList=aAsinList;oEventData.sBuyableASIN=sBuyableASIN;if(sEventType=='preview'){lastEvent=oEventData;eventActionId++;setTimeout('delayPreviewEvent('+eventActionId+', '+bSuppressEventPropagation+');',100);}}
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});}}}
this.prefetchOffers=function(){if(typeof DetailPage!="undefined"){var asinList=goTwisterCore.getReachableAsins(oDimensionsWithRestrictedFetchRanges);for(var i=0;i<asinList.length;i++){if(asinList[i]==this.dpState['current_asin']){var temp=asinList[0];asinList[0]=asinList[i];asinList[i]=temp;}}
if(asinList.length>0){asinList[asinList.length]=this.dpState['parent_asin'];}
DetailPage.Model.prefetch(asinList,'offers');}};this.selectChild=function(oChildVariations,sObjName){var time=0;for(var sVarKey in oChildVariations){var sVarValue=oChildVariations[sVarKey];var nVarValue=-1;for(var nCurVarValue in this.dpState['variation_values'][sVarKey]){if(sVarValue==this.dpState['variation_values'][sVarKey][nCurVarValue]){nVarValue=nCurVarValue;break;}}
if(DetailPage.StateController.getState()['selected_variation_values'][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(!this.dpState['variation_args']['merchSizeChartLink']||!this.dpState['variation_args']['merchSizeText']||!this.dpState['variation_args']['divID']||!oOfferData['ASIN']||!oOfferData['merchantID']){return;}
var div=document.getElementById(this.dpState['variation_args']['divID']);if(!div){return;}
var link=this.dpState['variation_args']['merchSizeChartLink']+'?asin='+oOfferData['ASIN']+'&seller='+oOfferData['merchantID'];var sHTML='<a href="'+link+'" target="_blank">'+this.dpState['variation_args']['merchSizeText']+'</a>';div.innerHTML=sHTML;}
this.clearSizeChart=function(){if(!this.dpState['variation_args']['divID']){return;}
var div=document.getElementById(this.dpState['variation_args']['divID']);if(!div){return;}
div.innerHTML=this.dpState['variation_args']['twisterDefaultSizingChartLink'];}
this.selectVarDimVal=function(VarKey,nVarVal){if(oVariationDisplayTypes[VarKey]=='s'){this.onClickSwatch(VarKey,nVarVal);}else if(oVariationDisplayTypes[VarKey]=='d'){jQuery('#'+VarKey).val(nVarVal);this.onChangeDropdown(VarKey);}};}
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 oMagnifier;var registeredImages=new Object();var selectedImageID="none";var prevSelectedImageID="none";var hiResPreloadDone=false;var isPendingPreload=false;var hoverCount=0;var hiResCount=0;var currentMediaID=null;var hoverZoomUrls='';var sDefaultImageCaption='';var spinnerDimensions=[23,23];var sPrevNonCustImage=null;var sPrevImage=null;var sDefaultVideoStopCaption='';var sDefaultVideoPlayCaption='';var sProductGroupID='';var parentTitle;var hoverzoomEnabled=false;var isSupportedTablets=0;var hoverZoomImgUrls='';this.setIsSupportTabletsAndHoverImgUrls=function(isSupportedTabsFormalPara,hoverZoomImageUrls){isSupportedTablets=isSupportedTabsFormalPara?1:0;hoverZoomImgUrls=hoverZoomImageUrls;}
this.registerImage=function(id,src,imageHTML,hiResImage,captionHTML){if(registeredImages[id]==null){registeredImages[id]=new Object();registeredImages[id].imageHTML=imageHTML;registeredImages[id].hiResImage=hiResImage;registeredImages[id].captionHTML=captionHTML;registeredImages[id].src=src;registeredImages[id].hasSticker=false;registeredImages[id].hiResPreloaded=0;if(hiResImage){hiResCount++;}}}
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();if(window.isHoverZoom){this.preloadHiResImage(id);}}
this.displayNotBuyable=function(id,oSelectedVariations){this.showImage(id);this.showNotBuyableOverlay(oSelectedVariations);}
this.displayImageNotAvail=function(id,oTwisterVariationData){if(window.isHoverZoom&&oMagnifier){oMagnifier.changeImage('','');}
this.showImage(id);this.showImageNotAvailOverlay(oTwisterVariationData);}
this.clearSelectedImageID=function()
{selectedImageID="none";}
this.setCurrentMediaID=function(mediaID)
{currentMediaID=mediaID;}
this.getCurrentMediaID=function()
{return currentMediaID;}
this.setParentTitle=function(title)
{parentTitle=title;}
this.enableHoverZoom=function()
{hoverzoomEnabled=true;}
this.isHoverZoomEnabled=function()
{return hoverzoomEnabled;}
this.showImage=function(id){if(id!=selectedImageID){if(registeredImages[selectedImageID]&&registeredImages[selectedImageID].ciuAnnoContainer){registeredImages[selectedImageID].ciuAnnoContainer.hide();}
var bIsSwatchImageChange=false;if(window.isHoverZoom&&hoverzoomEnabled&&window.isIvWeblab&&selectedImageID&&selectedImageID!="none"&&id&&((selectedImageID.split("-",2)[0]!=id.split("-",2)[0])||(selectedImageID.split("-",2)[1]!=id.split("-",2)[1]))){bIsSwatchImageChange=true;}
selectedImageID=id;if(id!=null){document.getElementById('prodImageCell').innerHTML=registeredImages[id].imageHTML;if(!bIsSwatchImageChange&&(!window.isHoverZoom||hoverzoomEnabled)){document.getElementById('prodImageCaption').innerHTML=registeredImages[id].captionHTML;}}}
if(id&&id.match("^x-cust")&&sPrevImage&&!sPrevImage.match("^x-cust")){sPrevNonCustImage=sPrevImage;}
sPrevImage=id;if(registeredImages[selectedImageID]&&registeredImages[selectedImageID].ciuAnnoContainer){registeredImages[selectedImageID].ciuAnnoContainer.show();ciuAnnotationsMouseover(selectedImageID);}
this.createIVTrigger();}
this.showVideo=function(id,mediaID)
{if(id!=selectedImageID)
{if(registeredImages[selectedImageID]&&registeredImages[selectedImageID].ciuAnnoContainer){registeredImages[selectedImageID].ciuAnnoContainer.hide();}
AmznVideoPlayer.hideAll();if(AmznVideoPlayer.lastPlayedId==mediaID){AmznVideoPlayer.players[mediaID].showFlash();}else{if(AmznVideoPlayer.players[AmznVideoPlayer.lastPlayedId]){AmznVideoPlayer.players[AmznVideoPlayer.lastPlayedId].pause();}
AmznVideoPlayer.players[mediaID].resizeVideo(300,300);AmznVideoPlayer.players[mediaID].showPreplay();}
selectedImageID=id;this.setCurrentMediaID(mediaID);}}
this.pauseCurrentVideo=function()
{var lastVideo=AmznVideoPlayer.players[AmznVideoPlayer.lastPlayedId];if(lastVideo){lastVideo.pause();}
AmznVideoPlayer.hideAll();goTwisterProductImage.setCurrentMediaID(null);}
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;}
this.setMagnifier=function(magnifier){oMagnifier=magnifier;}
this.preloadHiResImage=function(id){if(!oMagnifier){return;}
if(!registeredImages[id].hiResImage){oMagnifier.changeImage(registeredImages[id].src,'');return;}
if(registeredImages[id]&&!registeredImages[id].hiResPreloaded){if(registeredImages[id].hiRes){delete registeredImages[id].hiRes;}
registeredImages[id].hiRes=new Image();registeredImages[id].hiRes.src=registeredImages[id].hiResImage;oMagnifier.changeImage(registeredImages[id].src,registeredImages[id].hiResImage);registeredImages[id].hiRes.onload=function(){registeredImages[id].hiResPreloaded=1;};registeredImages[id].hiRes.onerror=function(){oMagnifier.changeImage(registeredImages[id].src,'');};registeredImages[id].hiRes.onabort=function(){oMagnifier.changeImage(registeredImages[id].src,'');};}else if(registeredImages[id].hiResPreloaded){if(oMagnifier){oMagnifier.changeImage(registeredImages[id].src,registeredImages[id].hiResImage);}}}
this.incHoverCount=function(){hoverCount++;}
this.getHoverCount=function(){return hoverCount;}
this.setHoverZoomURLs=function(argHoverZoomURLs){if(argHoverZoomURLs){hoverZoomUrls=argHoverZoomURLs;}}
var isLoaded=false;var clientX;var clientY;var hiResImageLoadState={};this.showHoverZoom=function(event,hiResUrl,isHoverZoom,spinnerURL,imageUrl){if(!hoverzoomEnabled)
return;if(hiResUrl&&hiResImageLoadState[hiResUrl]!=undefined&&hiResImageLoadState[hiResUrl]==0){isLoaded=false;}else if(hiResUrl&&hiResImageLoadState[hiResUrl]==undefined){hiResImageLoadState[hiResUrl]=0;isLoaded=false;var imgObj=jQuery("<img>").attr("src",hiResUrl);imgObj.load(function(){isLoaded=true;jQuery("#hoverZoomSpinner").remove();hiResImageLoadState[hiResUrl]=1;});}
this.incHoverCount();if(isHoverZoom!=2&&jQuery('#hover-zoom-end').length){var prodImgHeight=jQuery('#handleBuy .productImageGrid').height();var htTillHZEnd=jQuery('#hover-zoom-end').show().position().top-jQuery('#btAsinTitle').position().top;jQuery('#hover-zoom-end').hide();var hzHeight=prodImgHeight>htTillHZEnd?prodImgHeight:htTillHZEnd;jQuery('#hover-zoom-end').height(hzHeight);}
if(!isLoaded){if(!jQuery("#hoverZoomSpinner").length&&spinnerURL){var parent=jQuery("#prodImageCell");var offset={top:(parent.height()-spinnerDimensions[1])/2,left:(parent.width()-spinnerDimensions[0])/2};parent.css("position","relative").append("<div id='hoverZoomSpinner' style='height:0px; width:0px;'><span style='display: block; overflow: hidden; text-indent: -99999px; border: 1px solid rgb(150, 183, 205); -moz-border-radius: 6px 6px 6px 6px; width: 20px; height: 20px; position:absolute; top:"+offset.top+"px; left:"+offset.left+"px; background: url("+spinnerURL+") no-repeat scroll center center rgb(255, 255, 255); z-index:100'></span></div>");}}
if(!oMagnifier){var minHeightElem=null;var adjustment=[0,0,0,0];if(isHoverZoom!=2){minHeightElem='#handleBuy .productImageGrid';adjustment=[0,0,2,10];if(jQuery('#hover-zoom-end').length){minHeightElem='#hover-zoom-end';adjustment=[0,0,2,0];}}
clientX=event.clientX;clientY=event.clientY;jQuery("#prodImageCell").mousemove(function(event){clientX=event.clientX;clientY=event.clientY;});jQuery("#prodImageCell").mouseout(function(){clientX=-1;clientY=-1;});amznJQ.available(isSupportedTablets?"picMagnifier":"imageMagnifier",function(){var title=jQuery('#btAsinTitle').text();oMagnifier=jQuery("#prodImageCell").amazonMagnifier({location:"over",locationElement:isHoverZoom==2?"#prodImageCell":"#btAsinTitle, #product-title-divider, .hoverZoom",adjustment:adjustment,minHeightElement:minHeightElem,preload:"",clickForFullscreen:false,zIndex:15,title:title,generalImageUrls:isSupportedTablets?hoverZoomImgUrls:hoverZoomUrls,hoverZoomTablets:isSupportedTablets});oMagnifier.changeImage((imageUrl?imageUrl:""),hiResUrl);if(clientX!=-1&&clientY!=-1){var modifiedEvent=event;modifiedEvent={pageX:clientX+jQuery('body').scrollLeft(),pageY:clientY+jQuery('body').scrollTop()};oMagnifier.engageMagnifier(modifiedEvent);}});}else if(oMagnifier&&hiResUrl){oMagnifier.changeImage((imageUrl?imageUrl:""),hiResUrl);}}
this.getHiResCount=function(){return hiResCount;}
this.registerIVImages=function(imgSet,swatchImages,visualKeys){if(!window.isIvWeblab)
return;if(imgSet){oIVImgSet=imgSet;}
if(swatchImages){oIVSwatchImages=swatchImages;}
if(visualKeys){oIVVisualKeys=visualKeys;}}
this.setInitialID=function(id){selectedImageID=id;}
this.getSelectedImageID=function(){return selectedImageID;}
var immersiveView;var isIVConstructed=false;this.createIVTrigger=function(){if(isIVConstructed&&immersiveView){immersiveView.createIVTrigger();}}
this.openImmersiveView=function(e){if(!window.isIvWeblab||!isIVable())
return;if(jQuery('#prodImageOverlay').css('visibility')=='visible'){return;}
if(isIVConstructed){if(!jQuery.browser.mozilla){jQuery(document.body).css("overflow","hidden");}
return;}
if(e){e.cancelBubble=true;}
var endIndex=selectedImageID.lastIndexOf('-');var mediaID=selectedImageID.substring(endIndex+1,selectedImageID.length);var remainStr=selectedImageID.substring(0,endIndex);var endIndex=remainStr.lastIndexOf('-');var type='';if(endIndex!=-1){type=remainStr.substring(endIndex+1,remainStr.length);}
if(!window.dynamicImages){if(oIVImgSet&&oIVImgSet[remainStr]&&oIVImgSet[remainStr].images.zoomImages[goTwisterAltImages.currentThumbID()]){jQuery("<img>").attr("src",oIVImgSet[remainStr].images.zoomImages[goTwisterAltImages.currentThumbID()]);}}
if(!jQuery.browser.mozilla){jQuery(document.body).css("overflow","hidden");}
jQuery(document.body).css("opacity","0.4");jQuery('#loadingImage').css({"left":function(){return(jQuery(window).width()-jQuery('#loadingImage').width())/2+jQuery(window).scrollLeft()+"px";},"margin-top":function(){return(jQuery(window).height()-jQuery('#loadingImage').height())/2-200+jQuery(window).scrollTop()+"px";},"display":"block"});isIVConstructed=true;if(window.dynamicImages){var imageSet=new Object();var imagesLoaded=0;var parentASIN=DetailPage.StateController.getState()&&DetailPage.StateController.getState().parent_asin;var imgURL="/gp/twister/dynamic-update/images.html?parentASIN="+parentASIN;jQuery.ajax({url:imgURL,dataType:'json',timeout:40000,async:false,success:function(data,status,xhr){for(var i=0;i<data.length;i++){var id=data[i].imageID;var thumbSrc=data[i].thumbSrc;var hiResSrc=data[i].hiResSrc;if(imageSet[id]==null){imageSet[id]=new Object();}
if(imageSet[id].images==null){imageSet[id].images={thumbnails:[],zoomImages:[]};}
var currId=imageSet[id].images.thumbnails.length;imageSet[id].images.thumbnails[currId]=thumbSrc;imageSet[id].images.zoomImages[currId]=hiResSrc;}
imagesLoaded=1;}});if(!imagesLoaded){return;}
this.registerIVImages(imageSet);if(oIVImgSet&&oIVImgSet[remainStr]&&oIVImgSet[remainStr].images.zoomImages[goTwisterAltImages.currentThumbID()]){jQuery("<img>").attr("src",oIVImgSet[remainStr].images.zoomImages[goTwisterAltImages.currentThumbID()]);}}
var DonsBoxCSS='<style type="text/css">';var isCSSLoaded=0;jQuery.ajax({url:"/gp/twister/dynamic-update/DonsBox-css.html",dataType:'html',timeout:40000,async:false,success:function(data,status,xhr){DonsBoxCSS+=data+'</style>';jQuery(DonsBoxCSS).appendTo("head");isCSSLoaded=1;}});if(!isCSSLoaded){return;}
setTimeout(function(){amznJQ.available("immersiveView",function(){jQuery('#loadingImage').css("display","none");var isImage=true;var setID='';immersiveView=jQuery.fn.amazonImmersiveView();var title=parentTitle;if(!title||title.length==0){title=jQuery('#btAsinTitle').text();}
immersiveView.setIsSupportedTablets(isSupportedTablets);immersiveView.setTitle(title);immersiveView.setProductGroupID(DetailPage.StateController.getState()&&DetailPage.StateController.getState().product_group_id);immersiveView.setMediaUrls(ivMediaUrls);immersiveView.changeImageSet(oIVImgSet);immersiveView.setVariationProperties(oIVVisualKeys,oIVSwatchImages);var isTwisterDP=true;try{immersiveView.setItems(goTwisterCore.selectionItems);}
catch(e){isTwisterDP=false;}
if(type==='video'){setID=remainStr.substring(0,endIndex);isImage=false;immersiveView.setInitialIDs(setID,mediaID,isImage);}else{setID=remainStr;var imageID=(mediaID.substring(0,4)==='cust')?0:goTwisterAltImages.currentThumbID();if(mediaID.substring(0,4)==='cust'&&sPrevNonCustImage){setID=sPrevNonCustImage.substring(0,sPrevNonCustImage.lastIndexOf('-'));}
immersiveView.setInitialIDs(setID,imageID,isImage);}
immersiveView.createImmersiveView(e,isTwisterDP);triggerImmersiveView();});},50);setTimeout(function(){if(!immersiveView){jQuery('#loadingImage').css("display","none");jQuery(document.body).css("overflow","auto");jQuery(document.body).css("opacity","");}},30000);jQuery.get('/gp/product/ajax-handlers/reftag.html?ref=dp_iv');}
this.setIVContext=function(e){if(!window.isIvWeblab)
return;var isImage=true;var setID='';var endIndex=selectedImageID.lastIndexOf('-');var mediaID=selectedImageID.substring(endIndex+1,selectedImageID.length);var remainStr=selectedImageID.substring(0,endIndex);endIndex=remainStr.lastIndexOf('-');var type='';if(oIVImgSet&&oIVImgSet[remainStr]&&oIVImgSet[remainStr].images.zoomImages[goTwisterAltImages.currentThumbID()]){jQuery("<img>").attr("src",oIVImgSet[remainStr].images.zoomImages[goTwisterAltImages.currentThumbID()]);}
if(endIndex!=-1){type=remainStr.substring(endIndex+1,remainStr.length);}
if(type==='video'){setID=remainStr.substring(0,endIndex);isImage=false;immersiveView.setInitialIDs(setID,mediaID,isImage);}else{setID=remainStr;var imageID=(mediaID.substring(0,4)==='cust')?0:goTwisterAltImages.currentThumbID();if(mediaID.substring(0,4)==='cust'&&sPrevNonCustImage){setID=sPrevNonCustImage.substring(0,sPrevNonCustImage.lastIndexOf('-'));}
immersiveView.setInitialIDs(setID,imageID,isImage);}}
function triggerImmersiveView(){if(isIVConstructed){if(immersiveView&&!immersiveView.isIVOpen()){jQuery.AmazonPopover.displayPopover(immersiveView.getIVPopoverOptions());}}else{openImmersiveView();}}
this.triggerIV=function(){triggerImmersiveView();}
this.handleVideoClick=function(){this.triggerIV();}
this.setDefaultImageCaption=function(caption){if(caption){sDefaultImageCaption=caption;}}
this.setDefaultVideoPlayCaption=function(caption){if(caption){sDefaultVideoPlayCaption=caption;}}
this.setDefaultVideoStopCaption=function(caption){if(caption){sDefaultVideoStopCaption=caption;}}
this.setProductGroupID=function(pg){if(pg){sProductGroupID=pg;}}
this.videoStateChange=function(state){if(this.getCurrentMediaID()==null){return;}
if(state=="playing"){jQuery('#prodImageCaption').html(sDefaultVideoPlayCaption);goTwisterAltImages.setIsVideoPlayingFlag(true);}else{jQuery('#prodImageCaption').html(sDefaultVideoStopCaption);goTwisterAltImages.setIsVideoPlayingFlag(false);}}
this.registerProductImgClickEvents=function(isHoverZoom){if(isHoverZoom!=2){amznJQ.available('jQuery',function(){jQuery(document).bind('engaged.magnifier',function(){jQuery('#magnifierLens').click(function(event){event.stopPropagation();goTwisterProductImage.triggerIV();});});});}else{amznJQ.available('jQuery',function(){jQuery(document).bind('updated.magnifier',function(){jQuery('#detailImg').click(function(event){event.stopPropagation();goTwisterProductImage.triggerIV();});});});}}
this.registerProductImgHoverEvents=function(isHoverZoom,isIvWeblab){if(isHoverZoom&&isIvWeblab){amznJQ.available("jQuery",function(){jQuery('#prodImageOuter').mouseover(function(){goTwisterAltImages.setCaption(-1);});jQuery('#prodImageOuter').mouseout(function(){var curImageID=goTwisterProductImage.getSelectedImageID();var regImages=goTwisterProductImage.getRegisteredImages();if((!(regImages&&regImages[curImageID]&&regImages[curImageID].hiResImage)&&isHoverZoom==2)||isHoverZoom!=2){goTwisterAltImages.resetCaption(-1);}});jQuery(document).bind("engaged.magnifier",function(){jQuery('#detailImg').mouseout(function(){goTwisterAltImages.resetCaption(-1);});});});}}
this.triggerInitialDownloads=function(hiResUrl){amznJQ.available("jQuery",function(){jQuery(window).load(function(){amznJQ.onReady("immersiveView",function(){});});amznJQ.onCompletion('amznJQ.criticalFeature',function(){if(window.isHoverZoom){amznJQ.onReady(isSupportedTablets?"picMagnifier":"imageMagnifier",function(){goTwisterProductImage.enableHoverZoom();goTwisterAltImages.resetCaption(-1);});}});});}
this.flushClientLog=function(){if(window.clientLogger){var params={};if(window.isHoverZoom){params['hoverCount']=this.getHoverCount();params['hiResCount']=this.getHiResCount();params['productGroup']=sProductGroupID;params['isTwister']=1;params['weblab']="HZ";clientLogger.sendCLOGEntry("bxindiahoverzoom","hoverZoom",params);}}}}
// (FILE: /detail-page-features/twister-alt-images/twister-alt-images.js) 


function TwisterAltImages(sInitialColor,nInitialNumThumbs,oLookupHash,useChildCustomerImages,stickerType,quantity){var oImageDataSets={};var oCustomerImageDataSets={};var oImageSets={};var oCustomerImageDataSet={};var oMergedImageDataSets={};var oNumCustomerImages={};var oImageStickers={};var nImageDataSets=0;var oVideoDataSets={};var nVideoDataSets=0;var oDimensionLookup=oLookupHash;var nVisualDimensions=0;var sPrevCaption=null;var sDefaultImageCaption='';var sDefaultVideoStopCaption='';var sDefaultVideoPlayCaption='';var bIsVideoPlaying=false;var isSupportedTablets=0;this.setIsSupportTablets=function(isSupportedTabsFormalPara){isSupportedTablets=isSupportedTabsFormalPara?1: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=window.isIvWeblab?8:7;var nMinAltImages=window.isIvWeblab?7:4;var nMaxCustomerImages=4;var nMinVideos=1;var nMaxVideos=3;var nThumbs=nInitialNumThumbs;var nHighlightThumb=0;var aImageIDs=[];var nAltImages=nInitialNumThumbs;var nCustImages=-1;var nVideos=0;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){if(window.dynamicImages){var images=goTwisterProductImage.getRegisteredImages();if(!images[imageData.regImgArgs[0]]){goTwisterProductImage.registerImage(imageData.regImgArgs[0],imageData.regImgArgs[1],imageData.regImgArgs[2],imageData.hiResImage,imageData.regImgArgs[3]);}}else{goTwisterProductImage.registerImage(imageData.regImgArgs[0],imageData.regImgArgs[1],imageData.regImgArgs[2],imageData.hiResImage,imageData.regImgArgs[3]);}}
this.getCustomerImages=function(){return oCustomerImageDataSet;}
this.initCustomerImages=function(selectedColor,start){var images;if(useChildCustomerImages){if(window.dynamicImages){images=oCustomerImageDataSets[selectedColor];}else{images=oImageDataSets[selectedColor];}}else{if(window.dynamicImages){images=oCustomerImageDataSets['x'];}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,hiResImage,isCustomerImage){var oImageData={};oImageData.sImageID=sImageID;oImageData.regImgArgs=registerJSArgs;oImageData.sImageHTML=sImageHTML;oImageData.hiResImage=hiResImage;oImageData.hasSticker=false;oImageData.isCustomerImage=isCustomerImage;if(oImageDataSets[sColor]==null){oImageDataSets[sColor]=[];oMergedImageDataSets[sColor]=[];nImageDataSets++;if(!window.dynamicImages){oNumCustomerImages[sColor]=0;}}
if(window.dynamicImages&&oImageSets[sColor]==null){oImageSets[sColor]=[];}
if(window.dynamicImages&&oCustomerImageDataSets[sColor]==null){oCustomerImageDataSets[sColor]=[];oNumCustomerImages[sColor]=0;}
if(!window.dynamicImages){oImageDataSets[sColor][oImageDataSets[sColor].length]=oImageData;}else if(!oImageSets[sColor][sImageID]){if(isCustomerImage){oCustomerImageDataSets[sColor][oCustomerImageDataSets[sColor].length]=oImageData;}else{oImageDataSets[sColor][oImageDataSets[sColor].length]=oImageData;oMergedImageDataSets[sColor][oMergedImageDataSets[sColor].length]=oImageData;}
oImageSets[sColor][sImageID]=1;}
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]]){if(!window.dynamicImages){oImageDataSets[partialIndexes[i]]=oImageDataSets[sColor];}else{oImageDataSets[partialIndexes[i]]=oMergedImageDataSets[sColor];}}}
this.callRegJS(oImageData);if(isCustomerImage){var custImageId=sImageID;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.mergeImages=function(){if(!window.dynamicImages){return;}
for(var color in oMergedImageDataSets){if(oCustomerImageDataSets[color]){for(var i=0;i<oCustomerImageDataSets[color].length;i++){oMergedImageDataSets[color][oMergedImageDataSets[color].length]=oCustomerImageDataSets[color][i];}}}}
var videoExists=false;this.addVideos=function(videoData,sColor){if(!window.isIvWeblab)
return false;if(!videoData)
return false;if(oVideoDataSets[sColor]==null){oVideoDataSets[sColor]=[];for(var i=0;i<videoData.length;i++){var oVideoData={};oVideoData.sImage=videoData[i].image;oVideoData.sMediaID=videoData[i].mediaID;oVideoData.sImageHTML=videoData[i].thumbHtml;oVideoData.caption=videoData[i].caption;var holderID='holder'+videoData[i].mediaID;var placeHolderHtml="<div onclick='event.stopPropagation();' style='position:absolute;' id='holder"+videoData[i].mediaID+"'></div>";amznJQ.available("jQuery",function(){var placeHolder=jQuery(placeHolderHtml);if(jQuery.browser.msie){var imageGridCount=jQuery('#handleBuy').find('.productImageGrid').length;if(imageGridCount==1){placeHolder.css({"margin-left":"-315px"});}else{placeHolder.css({"margin-left":"-330px"});}}
jQuery('#prodImageCell').parents('table:first').before(placeHolder);});var mediaObject={mediaObjectId:videoData[i].mediaID,slateImageUrl:videoData[i].image};oVideoData.player=new AmznVideoPlayer(mediaObject,holderID,300,300);videoExists=true;nVideoDataSets++;oVideoDataSets[sColor][oVideoDataSets[sColor].length]=oVideoData;}
return true;}
return false;}
this.setColor=function(sNewSelectedColor,renderAgain){if(nVisualDimensions<1)return;if(renderAgain||sNewSelectedColor!=sCurrentSelectedColor){sCurrentSelectedColor=sNewSelectedColor;if(oImageDataSets[sCurrentSelectedColor]!=undefined){sCurrentDisplayedColor=sCurrentSelectedColor;}
var oImageDataSet;if(oImageDataSets[sCurrentDisplayedColor]!=undefined){oImageDataSet=oImageDataSets[sCurrentDisplayedColor];}else{oImageDataSet=[];}
if(window.isIvWeblab){var oVideoDataSet;if(oVideoDataSets[sCurrentDisplayedColor]!=undefined){oVideoDataSet=oVideoDataSets[sCurrentDisplayedColor];nVideos=oVideoDataSet.length;}else{oVideoDataSet=[];nVideos=0;}
if(useChildCustomerImages){nCustImages=oNumCustomerImages[sNewSelectedColor]||0;if(window.dynamicImages){nAltImages=oImageDataSet.length;}else{nAltImages=oImageDataSet.length-nCustImages;}}else{nCustImages=oNumCustomerImages['x'];nAltImages=oImageDataSet.length;}
if(!nCustImages||nCustImages=='undefined'){nCustImages=0;}
var totalMedia=nVideos+nAltImages;var minVideos=(nVideos==0?0:nMinVideos);var minAltImages=nAltImages<nMinAltImages?nAltImages:nMinAltImages;nThumbs=nAltImages+nCustImages+minVideos;var nAllowedVideos=minVideos;if(nThumbs>nMaxThumbs){nThumbs=nMaxThumbs;nAltImages=nMaxThumbs-nCustImages-minVideos;if(nAltImages<minAltImages){nAltImages=minAltImages;nCustImages=nMaxThumbs-nAltImages-minVideos;}}else if(nThumbs<nMaxThumbs){nAllowedVideos=nMaxThumbs-nThumbs+minVideos;nAllowedVideos=nAllowedVideos>nMaxVideos?nMaxVideos:nAllowedVideos;}
nVideos=nVideos<nAllowedVideos?nVideos:nAllowedVideos;nCustImages=nCustImages>nMaxCustomerImages?nMaxCustomerImages:nCustImages;nThumbs=nAltImages+nCustImages+nVideos;var shownMedia=nAltImages+nVideos;if(totalMedia>shownMedia){var dispStr;if(nVideos<=0){dispStr=ivStrings['seeXmoreImages'];}else{dispStr=ivStrings['seeXmore'];}
var wrapperDiv=document.getElementById('see-x-more');var content=totalMedia-shownMedia;dispStr=dispStr.replace('####',content);wrapperDiv.innerHTML="<a href='' onclick='return false;'>"+dispStr+"</a>";jQuery('#see-x-more').css("display","block");}else{jQuery('#see-x-more').css("display","none");}
for(var nThumb=nThumbs;nThumb<nMaxThumbs;nThumb++){document.getElementById("thumb_"+nThumb).style.display='none';}
var stripSize=(window.isHoverZoom)?(nThumbs*36+2):(nThumbs*36);document.getElementById("thumb_strip").style.width=stripSize+'px';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);for(var nThumb=0;nThumb<nVideos;nThumb++){var counter=nAltImages+nCustImages+nThumb;if(oVideoDataSet[nThumb]){this.setThumb(counter,oVideoDataSet[nThumb].sImageID,oVideoDataSet[nThumb].sImageHTML);}
document.getElementById("thumb_"+counter).style.display='inline';}
this.setVideoTag();goTwisterProductImage.createIVTrigger();}else{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';}
var stripSize=(window.isHoverZoom)?(nThumbs*36+2):(nThumbs*36);document.getElementById("thumb_strip").style.width=stripSize;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);}
this.handleThumbStrip();if(nThumbs>0){this.viewThumb(0);if(window.isHoverZoom&&window.isIvWeblab){this.resetCaption(0);}}}}
this.setVideoTag=function(){jQuery(document).ready(function(){if(jQuery.browser.msie){jQuery(".alt_images_thumb_inner .videoTag").each(function(){jQuery(this).css("bottom","12px");jQuery(this).css("left","-17px");});jQuery(".alt_images_thumb_tall_inner .videoTag").each(function(){jQuery(this).css("bottom","21px");jQuery(this).css("left","-17px");});}});}
this.setThumb=function(nThumb,sImageID,sImageHTML){var sInnerID="thumb_"+nThumb+"_inner";document.getElementById(sInnerID).innerHTML=sImageHTML;aImageIDs[nThumb]=sImageID;}
this.viewThumb=function(nThumb){if(nThumb!=nHighlightThumb){var sThumbID;sThumbID="thumb_"+nHighlightThumb;document.getElementById(sThumbID).style.border='1px solid #999999';if(window.isHoverZoom){document.getElementById(sThumbID).style.padding='1px';document.getElementById(sThumbID).className='alt_images_thumb';}
sThumbID="thumb_"+nThumb;if(window.isHoverZoom){document.getElementById(sThumbID).style.border='2px solid #E47911';document.getElementById(sThumbID).style.padding='0px';document.getElementById(sThumbID).className+=' swatchSelect';}else{document.getElementById(sThumbID).style.border='1px solid #990000';}
nHighlightThumb=nThumb;}
if(window.isIvWeblab){var firstVideoId=nThumbs-nVideos;if(nThumb>=firstVideoId){this.viewVideo(nThumb);return;}
if(videoExists)
{goTwisterProductImage.pauseCurrentVideo();}
jQuery('#prodImageOuter').css('visibility','visible');}
if((nImageDataSets>1)&&(sCurrentDisplayedColor!=sCurrentSelectedColor)){goTwisterProductImage.displayImageNotAvail(aImageIDs[nThumb],sCurrentSelectionData);}else{goTwisterProductImage.displayImage(aImageIDs[nThumb]);}}
this.viewVideo=function(nThumb)
{if(!window.isIvWeblab){return;}
var firstVideoId=nThumbs-nVideos;if(oVideoDataSets[sCurrentDisplayedColor]!=undefined){var oVideoDataSet=oVideoDataSets[sCurrentDisplayedColor];var oVideoData=oVideoDataSet[nThumb-firstVideoId];var mediaID=oVideoData.sMediaID;var vidID=sCurrentDisplayedColor+'-video-'+(nThumb-firstVideoId);jQuery('#prodImageOuter').css('visibility','hidden');if(window.isHoverZoom&&bIsVideoPlaying){jQuery('#prodImageCaption').html(sDefaultVideoPlayCaption);}else{jQuery('#prodImageCaption').html(oVideoData.caption);}
goTwisterProductImage.showVideo(vidID,mediaID);}}
this.preloadThumbs=function(){for(var nThumb=0;nThumb<nThumbs;nThumb++){goTwisterProductImage.preloadImage(aImageIDs[nThumb]);}}
this.onMouseOver=function(nThumb){if(window.isIvWeblab&&window.isHoverZoom){this.setCaption(nThumb);}
this.viewThumb(nThumb);this.preloadThumbs();}
this.onMouseOut=function(nThumb){var id=aImageIDs[nThumb];if(typeof ciuAnnotationsMouseout=="function"){ciuAnnotationsMouseout(id);}
if(window.isIvWeblab&&window.isHoverZoom){this.resetCaption(nThumb);}}
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;}}
if(window.isIvWeblab){if(sPreviewImageID)
{if(videoExists)
{AmznVideoPlayer.hideAll();}
jQuery('#prodImageOuter').css('visibility','visible');}
else
{this.viewThumb(nHighlightThumb);return;}}
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){if(oTwisterVariationData!=undefined){sCurrentSelectionData=oTwisterVariationData;}
this.updateCurrentSelectedBucket(oTwisterVariationData);var renderAgain=this.addVideos(oTwisterVariationData.videoData,this.getBucketString(sCurrentSelectedBucket));this.setColor(this.getBucketString(sCurrentSelectedBucket),renderAgain);this.updateShareYourOwnLink(oTwisterVariationData.sBuyableASIN);if(window.dynamicImages&&window.fadeImgSection){window.updateImgSection=1;amznJQ.available("jQuery",function(){jQuery('#thumb_strip').css('opacity','0.4');});}}
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);}}}
this.showHoverZoom=function(hiResImage,event,isHoverZoom,spinnerURL,imageUrl){if(isHoverZoom&&hiResImage){goTwisterProductImage.showHoverZoom(event,hiResImage,isHoverZoom,spinnerURL,imageUrl);}}
this.setDefaultImageCaption=function(caption){if(caption){sDefaultImageCaption=caption;}}
this.setDefaultVideoPlayCaption=function(caption){if(caption){sDefaultVideoPlayCaption=caption;}}
this.setDefaultVideoStopCaption=function(caption){if(caption){sDefaultVideoStopCaption=caption;}}
this.resetCaption=function(thumbID){if(!(window.isHoverZoom&&window.isIvWeblab))
return;if(thumbID<0){if(this.currentThumbID()>=0)
this.resetCaption(this.currentThumbID());return;}
var firstVideoId=nThumbs-nVideos;if(nThumbs&&thumbID>=firstVideoId){if(bIsVideoPlaying){document.getElementById('prodImageCaption').innerHTML=sDefaultVideoPlayCaption;}else{document.getElementById('prodImageCaption').innerHTML=sDefaultVideoStopCaption;}}else{var isCustImage=false;if(aImageIDs[thumbID]){isCustImage=aImageIDs[thumbID].search("cust")==-1?false:true;}
if(isCustImage){this.setCaption(thumbID);}else{images=goTwisterProductImage.getRegisteredImages();if(goTwisterProductImage.isHoverZoomEnabled()&&images&&aImageIDs[thumbID]&&images[aImageIDs[thumbID]]&&images[aImageIDs[thumbID]].hiResImage){document.getElementById('prodImageCaption').innerHTML=sDefaultImageCaption;}else{var selColor=this.getBucketString(sCurrentSelectedBucket);amznJQ.available("jQuery",function(){var isAnyCustImage=useChildCustomerImages?oNumCustomerImages[selColor]:oNumCustomerImages['x'];if(jQuery.browser.msie&&!isAnyCustImage){document.getElementById('prodImageCaption').innerHTML="<br style='line-height:0;' />";}else{document.getElementById('prodImageCaption').innerHTML="<br />";}});}}}}
this.setCaption=function(thumbID){if(thumbID<0){if(this.currentThumbID()>=0)
this.setCaption(this.currentThumbID());return;}
var firstVideoId=nThumbs-nVideos;if(nThumbs&&thumbID>=firstVideoId){if(bIsVideoPlaying){document.getElementById('prodImageCaption').innerHTML=sDefaultVideoPlayCaption;}else{document.getElementById('prodImageCaption').innerHTML=sDefaultVideoStopCaption;}}else{var imageID=aImageIDs[thumbID];var regImages=goTwisterProductImage.getRegisteredImages();var isCustImage=false;if(aImageIDs[thumbID]){isCustImage=aImageIDs[thumbID].search("cust")==-1?false:true;}
if(isCustImage){if(imageID&&regImages&&regImages[imageID].captionHTML&&regImages[imageID].captionHTML.length){document.getElementById('prodImageCaption').innerHTML=regImages[imageID].captionHTML;}else{var selColor=this.getBucketString(sCurrentSelectedBucket);amznJQ.available("jQuery",function(){var isAnyCustImage=useChildCustomerImages?oNumCustomerImages[selColor]:oNumCustomerImages['x'];if(jQuery.browser.msie&&!isAnyCustImage){document.getElementById('prodImageCaption').innerHTML="<br style='line-height:0;'/>";}else{document.getElementById('prodImageCaption').innerHTML="<br />";}});}}else{if((!window.isHoverZoom||goTwisterProductImage.isHoverZoomEnabled())&&regImages&&imageID&&regImages[imageID]&&isIVable()&&regImages[imageID].captionHTML&&regImages[imageID].captionHTML.length){document.getElementById('prodImageCaption').innerHTML=regImages[imageID].captionHTML;}else{var selColor=this.getBucketString(sCurrentSelectedBucket);amznJQ.available("jQuery",function(){var isAnyCustImage=useChildCustomerImages?oNumCustomerImages[selColor]:oNumCustomerImages['x'];if(jQuery.browser.msie&&!isAnyCustImage){document.getElementById('prodImageCaption').innerHTML="<br style='line-height:0;'/>";}else{document.getElementById('prodImageCaption').innerHTML="<br />";}});}}}}
this.handleThumbStrip=function(){if(window.isIvWeblab&&!isIVable()){amznJQ.available('jQuery',function(){if(nThumbs<=1){jQuery('#thumb_strip').hide();}else{jQuery('#thumb_strip').show();}});}}
this.setIsVideoPlayingFlag=function(flag){bIsVideoPlaying=flag;}
this.currentThumbID=function(){return nHighlightThumb;}
this.changeProdImage=function(caption){if(!window.isIvWeblab&&!isIVable())
return;document.getElementById('prodImageCaption').innerHTML=caption;amznJQ.available('jQuery',function(){jQuery('#prodImageCell').find('img').css('cursor','pointer');jQuery('#prodImageCell').find('img').addClass('prod_image_selector');if(!isSupportedTablets){jQuery('#prodImageCell').find('img').click(openImmersiveView);}});}
this.addAltImagesEvents=function(){if(window.isIvWeblab&&isIVable()){amznJQ.available('jQuery',function(){jQuery('.selectedArrow').click(function(event){event.stopPropagation();if(jQuery(this).parent().find('.alt_image_selector').length>0){goTwisterProductImage.triggerIV();}});});}}}
// (FILE: /detail-page-features/twister-availability/twister-availability.js) 


var FastTrackMsgDiv,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 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 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);}}}
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)+"  ";if(isPurchase==0){starsHTML+=amz_js_showIsOwnedString(asin,isOwned)+" ";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)+"  ";if(isPurchase==0){starsHTML+=amz_js_showIsOwnedString(asin,isOwned)+" ";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: /detail-page-features/twister-dual-drop-down/dual-drop-down.js) 


var DualDropdown={items:undefined,container:undefined,ddwindow:undefined,menu:undefined,ddwindowItem:undefined,selected:undefined,selectedItem:undefined,key1:undefined,key2:undefined,id:undefined,goTwisterCore:undefined,menuCloseTimeout:0,reachable:undefined,key3:undefined,onSelect:function(e){var item=jQuery(this);DualDropdown.setSelected(item);DualDropdown.updateTwister();DualDropdown.updateOtherControls();setTimeout(function(){DualDropdown.collapse();},DualDropdown.menuCloseTimeout);},setSelected:function(item){var val=item.children().eq(0).html()+" "+item.children().eq(1).html();ddwindowItem.html(val);if(typeof this.selectedItem!=='undefined'&&this.selectedItem){this.selectedItem.removeClass("dual-dropdown-menu-selected");}
this.selectedItem=jQuery(item);this.selected=this.selectedItem.attr("id").substring(this.id.length).split("_");this.selectedItem.addClass("dual-dropdown-menu-selected");},getSelected:function(){return this.selected;},onMouseEnter:function(){jQuery(this).addClass("dual-dropdown-menu-hover");},onMouseLeave:function(){jQuery(this).removeClass("dual-dropdown-menu-hover");},collapse:function(){menu.hide();ddwindow.css("visibility","");jQuery(document).unbind('click touchend',DualDropdown.onClickOutside);},expand:function(e){var ddposn=ddwindow.position();menu.show();menu.css({top:ddposn.top,left:ddposn.left});menu.scrollTop(0);ddwindow.css("visibility","hidden");ddwindow.css("width",menu.width());if(jQuery.browser.msie){var maxHeight=0.58*jQuery(window).height();if(menu.height()>maxHeight)
menu.height(0.58*jQuery(window).height());setTimeout(function(){ddwindow.css("width",menu.width());},0);}
jQuery(document).bind('click touchend',DualDropdown.onClickOutside);},reset:function(){this.setSelected(jQuery(items[0]));},resize:function(){DualDropdown.collapse();},onClickOutside:function(e){if(jQuery(e.target).parents("div.dual-dropdown-menu").length==0){DualDropdown.collapse();}},initialize:function(key1,key2,preselect){var id=key1+"-"+key2;this.id=id;this.key1=key1;this.key2=key2;var key3=this.getKey3();this.key3=key3;container=jQuery("#"+id);this.container=container;this.selected=["",-1,-1];if(preselect){this.selected[1]=DetailPage.StateController.getState()['selected_variation_values'][this.key1];this.selected[2]=DetailPage.StateController.getState()['selected_variation_values'][this.key2];}
ddwindow=container.find(".dual-dropdown-window");ddwindow.click(this.expand);ddwindow.click(function(e){e.stopPropagation();});this.ddwindow=ddwindow;ddwindowItem=ddwindow.find("span").eq(0);menu=container.find(".dual-dropdown-menu");this.menu=menu;items=menu.find("tr");items.click(this.onSelect);if(typeof(touchDeviceDetected)!="undefined"&&touchDeviceDetected){if(navigator.userAgent.indexOf("Silk")!=-1){this.menu.css("max-height","none");}
this.menuCloseTimeout=500;}else{items.hover(this.onMouseEnter,this.onMouseLeave);jQuery(document).keyup(function(e){if(e.keyCode==27){DualDropdown.collapse();}});}
if(items.length==2){this.setSelected(jQuery(items[1]));this.updateTwister();}
this.reachable=this.computeReachabililtyMatrix();this.greyOutUnavailable();jQuery(window).resize(this.resize);jQuery(document).bind("engaged.magnifier",DualDropdown.collapse);},isGreyedOut:function(val1,val2){var item=jQuery("#"+this.id+"_"+val1+"_"+val2);return item.hasClass("dual-dropdown-unavailable");},greyOutUnavailable:function(){var key1=DualDropdown.key1;var key2=DualDropdown.key2;var key3=DualDropdown.key3;var id=DualDropdown.id;var reachable=DualDropdown.reachable;var otherVal=DetailPage.StateController.getState()['selected_variation_values'][key3];items.each(function(){dimVals=jQuery(this).attr("id").substring(id.length+1);if(dimVals!="-1_-1"){if(otherVal!=-1&&!reachable[otherVal][dimVals]){jQuery(this).addClass("dual-dropdown-unavailable");}else{jQuery(this).removeClass("dual-dropdown-unavailable");}}});},getKey3:function(){var i=0;var allDims=DetailPage.StateController.getState()['variation_label_order'];for(i in allDims){var dim=allDims[i];if(dim!=this.key1&&dim!=this.key2){return dim;}}},updateTwister:function(){var selected=DualDropdown.getSelected();if(selected[1]==-1){DetailPage.StateController.getState()['selected_variation_values'][this.key1]=-1;DualDropdown.goTwisterCore.onDeselect(this.key2,false);return;}
if(DualDropdown.isGreyedOut(selected[1],selected[2])){DetailPage.StateController.getState()['selected_variation_values'][this.key3]=-1;}
DetailPage.StateController.getState()['selected_variation_values'][this.key1]=selected[1];DualDropdown.goTwisterCore.onSelect(this.key2,selected[2],false);},updateOtherControls:function(){var twisterUiObj=DetailPage.StateController.getState()['TwisterUIObj'];var varDisplayTypes=twisterUiObj.getVariationDisplayTypes();var dim="";twisterUiObj.updateLabels();for(dim in varDisplayTypes){if(varDisplayTypes[dim]=='d'){twisterUiObj.updateDropdowns(this.key1);twisterUiObj.updateDropdowns(this.key2);}else{twisterUiObj.updateSwatches();}}},computeReachabililtyMatrix:function(){var asins=DetailPage.StateController.getState()['asin_variation_values'];var reachable={};var otherVal=DetailPage.StateController.getState()['selected_variation_values'][this.key3];for(var asin in asins){var dims=DetailPage.StateController.getState()['asin_variation_values'][asin];if(typeof reachable[dims[this.key3]]=="undefined"){reachable[dims[this.key3]]={};}
reachable[dims[this.key3]][dims[this.key1]+"_"+dims[this.key2]]=true;}
return reachable;},reactToUpdate:function(){var selected=DualDropdown.getSelected();var key1=DualDropdown.key1;var key2=DualDropdown.key2;DualDropdown.greyOutUnavailable();if(DetailPage.StateController.getState()['selected_variation_values'][key1]==selected[1]&&DetailPage.StateController.getState()['selected_variation_values'][key2]==selected[2])
return;DualDropdown.reset();DualDropdown.updateTwister();}}
// (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) 


var dpf_stateController=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=['1click_address','asin_variation_values','current_asin','current_offer','current_hovered_asin','exclusive_merchant_id','hovered_variations','is_dpm','is_shadow_singleton','only_unqualified_offers','num_dimensions_hovered','num_dimensions_selected','num_total_variations','num_variation_dimensions','parent_asin','preselected_variation_dimension','preselected_variation_index','preselected_variation_value','product_group_id','qid','rid','selected_variation_values','selected_variations','sid','sr','preselected_merchant_id','store_id','variation_args','variation_dimensions','variation_display_labels','variation_label_order','variation_strings','variation_values','view','display_shoe_size_system','softlines_detail_page'];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;if(feature.name==='Magnifiable Image Block'&&window.twisterMarkImageLoad){var featureNotify=feature.notify;var currentASIN;var mainImage;var func=function(dpEvent,dpState){if(dpEvent==='child_select'){currentASIN=DetailPage.StateController.getState()['current_asin'];mainImage=document.getElementById('main-image');if(mainImage&&currentASIN){mainImage.onload=function(){window.twisterMeasurement.stampImageLoad(currentASIN)};}}
featureNotify(dpEvent,dpState);var isChrome=navigator.userAgent.toLowerCase().indexOf('chrome')>-1;if(isChrome&&currentASIN&&mainImage&&mainImage.complete){window.twisterMeasurement.stampImageLoad(currentASIN);}}
feature.notify=func;}
if(feature.name==='Image Block'&&window.twisterMarkImageLoad){var featureNotify=feature.notify;var func=function(dpEvent,dpState){var currentASIN;var mainImage;featureNotify(dpEvent,dpState);if(dpEvent==='child_select'){currentASIN=dpState['current_asin'];var mainImageDiv=document.getElementById('main_image_0');if(mainImageDiv){var mainImages=mainImageDiv.getElementsByTagName('img');mainImage=mainImages?mainImages[0]:null;}
if(mainImage&&currentASIN){mainImage.onload=function(){window.twisterMeasurement.stampImageLoad(currentASIN)};}}
if(mainImage&&mainImage.complete&&currentASIN){window.twisterMeasurement.stampImageLoad(currentASIN);}}
feature.notify=func;}
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;};};};
// (FILE: /dp-framework/DetailPageFramework.Model.js) 


var dpf_model=function($){DetailPageFramework.Model=function(handlers){var ajaxHandlers=handlers;var data={};var pendingCallbacks={};var pendingCallbacksHash={};var hashFunctions={};var prefetchQueues={};var jsonCache={};var ajaxFailures=0;var FETCH_MAX=10;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 setFeatureData=function(hashKey,dataType,featureName,newData){if(hashKey&&dataType&&featureName&&newData){if(!data[hashKey]){data[hashKey]={};}
if(!data[hashKey][dataType]||data[hashKey][dataType]=='pending'){data[hashKey][dataType]={};}
data[hashKey][dataType][featureName]=newData;}};var requestData=function(keys,dataType,onSuccess){if(ajaxFailures>=AJAX_FAILURE_MAX){return false;}
var handler=ajaxHandlers[dataType];if(handler&&handler.url){var args;var doFlushing=typeof window.isFlushing!='undefined'&&window.isFlushing&&(keys.length==1);if(handler.argHandler&&typeof handler.argHandler=='function'){args=handler.argHandler(keys,doFlushing);}else{args=getRequestArgs(keys);}
var ajaxURL;if(typeof handler.url=='function'){ajaxURL=handler.url(doFlushing);}else{ajaxURL=handler.url;}
DetailPage.StateController.notify("ajax_start",{ajax_data_type:dataType,ajax_keys:keys});if(doFlushing){var useIframe=window.isFlushing==1||jQuery.browser.msie?true:false;DetailPage.ajaxRenderManager.makeAjaxCall(useIframe,ajaxURL+args,location.href,keys[0],dataType);return true;}else{$.ajax({cache:false,dataType:window.jqupgrade?'text':'json',url:ajaxURL+args,timeout:40000,success:function(d){if(window.jqupgrade){var data=eval("("+d+")");setData(dataType,data);}else{setData(dataType,d);}
DetailPage.StateController.notify("ajax_success",{ajax_data_type:dataType,ajax_keys:keys});runPendingCallbacks(keys,dataType);if(onSuccess){onSuccess();}},error:function(jqXHR,error){if(error=='timeout'){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,featureID){var hashKey=hash(key,dataType);if(!pendingCallbacks[hashKey])
pendingCallbacks[hashKey]={};if(!pendingCallbacksHash[hashKey]){pendingCallbacksHash[hashKey]={};}
if(callback&&typeof callback=='function'){if(pendingCallbacks[hashKey][dataType]){pendingCallbacks[hashKey][dataType].push(callback);}else{pendingCallbacks[hashKey][dataType]=[callback];}
if(typeof window.isFlushing!='undefined'&&window.isFlushing){if(!pendingCallbacksHash[hashKey][dataType]){pendingCallbacksHash[hashKey][dataType]={};}
if(typeof featureID=='undefined'){featureID="complete_"+dataType;}
if(!pendingCallbacksHash[hashKey][dataType][featureID]){pendingCallbacksHash[hashKey][dataType][featureID]=[];}
pendingCallbacksHash[hashKey][dataType][featureID].push(callback);}}};var runPendingCallbacks=function(keys,dataType,feature){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(feature){keyData=keyData[feature];callbacks=getFeatureCallbacks(key,dataType,feature);}
if(!keyData&&!feature){continue;}
if(callbacks){var timer=0;for(var j=0;j<callbacks.length;j++){var callbackFunc=function(callback){var localKey=key;return function(){if(feature){DetailPage.Model.fetch(localKey,dataType,callback,null,feature);}else{DetailPage.Model.fetch(localKey,dataType,callback);}};}(callbacks[j]);setTimeout(callbackFunc,timer);timer+=50;}
pendingCallbacks[hashKey][dataType]=[];if(feature){deleteFeatureCallbacks(key,dataType,feature);}}}};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;};var getFeatureCallbacks=function(key,dataType,featureID){var hashKey=hash(key,dataType);return pendingCallbacksHash[hashKey]?(pendingCallbacksHash[hashKey][dataType]?pendingCallbacksHash[hashKey][dataType][featureID]:null):null;};var deleteFeatureCallbacks=function(key,dataType,featureID){var hashKey=hash(key,dataType);if(pendingCallbacksHash[hashKey]&&pendingCallbacksHash[hashKey][dataType]){delete pendingCallbacksHash[hashKey][dataType][featureID];}};this.getHash=function(key,dataType){return hash(key,dataType);}
this.getData=getData;this.setData=setData;var inPrefetchQueue=function(key,dataType){if(prefetchQueues&&prefetchQueues[dataType]){for(var i in prefetchQueues[dataType]){if(prefetchQueues[dataType][i]==key){return 1;}}}
return 0;}
this.fetch=function(key,dataType,callback,waitForPrefetch,featureID){if(key&&key!=''&&dataType&&dataType!=''){var hashKey=hash(key,dataType);var requestedData=getData(key,dataType);if(waitForPrefetch&&requestedData!='pending'){waitForPrefetch=inPrefetchQueue(key,dataType);}
if(requestedData=='pending'||waitForPrefetch){addPendingCallback(key,dataType,callback,featureID);}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,featureID);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.clearCache=function(key,dataType){if(this.loaded(key,dataType)){clearData(key,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;};this.flushFeatureData=function(asin,dataType,feature,dataStr){var hashKey=hash(asin,dataType);setFeatureData(hashKey,dataType,feature,dataStr);runPendingCallbacks([hashKey],dataType,feature);};this.ajaxSuccessHandler=function(asin,dataType){var hashKey=hash(asin,dataType);if(pendingCallbacksHash[hashKey]&&pendingCallbacksHash[hashKey][dataType]){for(var feature in pendingCallbacksHash[hashKey][dataType]){runPendingCallbacks([hashKey],dataType,feature);}}};};};
// (FILE: /dp-framework/DetailPageFramework.Adapter.js) 


var dpf_adapter=function($){var cfStamped=0;var afStamped=0;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']);}
if(typeof window.isFlushing!='undefined'&&window.isFlushing){DetailPage.Model.fetch(dpState['parent_asin'],this.data_type,this.getUpdater(isCached),null,this.feature_id);}else{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']);}
if(typeof window.isFlushing!='undefined'&&window.isFlushing){DetailPage.Model.fetch(dpState['current_asin'],this.data_type,this.getUpdater(isCached),null,this.feature_id);}else{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);}
if(typeof window.isFlushing!='undefined'&&window.isFlushing){DetailPage.Model.fetch(asin,this.data_type,this.getUpdater(isCached,true),null,this.feature_id);}else{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 cfPlaced=0;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();var currentASIN=dpState['current_asin'];if(obj.feature_id=='atf-marker-feature'){window.twisterMeasurement.stampATF(currentASIN);}
if(obj.feature_id=='cf-marker-feature'){window.twisterMeasurement.stampCF(currentASIN);}
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();}}};};
// (FILE: /dp-framework/DetailPageFramework.AltImageAdapter.js) 


var dpf_altImages=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(window.isIvWeblab){var currentAsin=dpState['current_asin'];var parentAsin=dpState['parent_asin'];if(currentAsin){if(typeof window.isFlushing!='undefined'&&window.isFlushing){DetailPage.Model.fetch(currentAsin,"offers",updateAltImages,null,'alt-videos');}else{DetailPage.Model.fetch(currentAsin,"offers",updateAltImages);}}else if(parentAsin){if(typeof window.isFlushing!='undefined'&&window.isFlushing){DetailPage.Model.fetch(parentAsin,"offers",updateAltImages,null,'alt-videos');}else{DetailPage.Model.fetch(parentAsin,"offers",updateAltImages);}}}
else
{if(typeof goTwisterAltImages!='undefined'){goTwisterAltImages.selectVariationValues(getAltImageVariationData(dpState,false));}
attachOnloadEvent(dpState['current_asin']);}});DetailPageFramework.registerCallback("asin_deselect","_alt_images",function(dpState){if(window.isIvWeblab){var currentAsin=dpState['current_asin'];var parentAsin=dpState['parent_asin'];if(currentAsin){if(typeof window.isFlushing!='undefined'&&window.isFlushing){DetailPage.Model.fetch(currentAsin,"offers",updateAltImages,null,'alt-videos');}else{DetailPage.Model.fetch(currentAsin,"offers",updateAltImages);}}else if(parentAsin){if(typeof window.isFlushing!='undefined'&&window.isFlushing){DetailPage.Model.fetch(parentAsin,"offers",updateAltImages,null,'alt-videos');}else{DetailPage.Model.fetch(parentAsin,"offers",updateAltImages);}}}
else
{if(typeof goTwisterAltImages!='undefined'){goTwisterAltImages.selectVariationValues(getAltImageVariationData(dpState,false));}
attachOnloadEvent(dpState['current_asin']);}});DetailPageFramework.registerCallback("document_ready","_alt_images",function(dpState){if(window.isIvWeblab)
{var currentAsin=dpState['current_asin'];var parentAsin=dpState['parent_asin'];if(currentAsin){if(typeof window.isFlushing!='undefined'&&window.isFlushing){DetailPage.Model.fetch(currentAsin,"offers",updateAltImages,null,'alt-videos');}else{DetailPage.Model.fetch(currentAsin,"offers",updateAltImages);}}else if(parentAsin){if(typeof window.isFlushing!='undefined'&&window.isFlushing){DetailPage.Model.fetch(parentAsin,"offers",updateAltImages,null,'alt-videos');}else{DetailPage.Model.fetch(parentAsin,"offers",updateAltImages);}}}});function attachOnloadEvent(currentASIN){if(!window.twisterMarkImageLoad){return;}
var mainImage;var mainImageDiv=document.getElementById('prodImageCell');if(mainImageDiv){var mainImages=mainImageDiv.getElementsByTagName('img');mainImage=mainImages?mainImages[0]:null;}
if(currentASIN&&mainImage){mainImage.onload=function(){window.twisterMeasurement.stampImageLoad(currentASIN)};}
if(currentASIN&&mainImage&&mainImage.complete){window.twisterMeasurement.stampImageLoad(currentASIN);}}
function updateAltImages(asin,asinData)
{if(!window.isIvWeblab)
return;var videoData;var dpState=DetailPage.StateController.getState();try{var altVideosJsonProp='twister-alt-videos';if(typeof window.altVideosJsonPropName!='undefined'&&window.altVideosJsonPropName){altVideosJsonProp=window.altVideosJsonPropName;}
var data=asinData[altVideosJsonProp];var videoData=DetailPage.Model.getJSONObj(asin,"offers","alt-videos",data);if(!videoData&&dpState['parent_asin']!=asin){if(typeof window.isFlushing!='undefined'&&window.isFlushing){DetailPage.Model.fetch(dpState['parent_asin'],"offers",updateAltImages,null,'alt-videos');}else{DetailPage.Model.fetch(dpState['parent_asin'],"offers",updateAltImages);}
return;}}catch(e){}
if(typeof goTwisterAltImages!='undefined'){goTwisterAltImages.selectVariationValues(getAltImageVariationData(dpState,false,videoData));}
attachOnloadEvent(dpState['current_asin']);}
function getAltImageVariationData(dpState,isHover,videoData){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'],videoData:videoData};};};
// (FILE: /dp-framework/DetailPageFramework.BuyBoxAdapter.js) 


var dpf_buyBoxAdapter=function($){TwisterBuybox=function(headerDivID,mainDivID,oBuyboxStrings){};DetailPageFramework.BuyBoxAdapter=function(){this.name="Buy Box";this.data_type="offers";this.feature_id='buy-box-json';this.oStrings=goTwisterBuyboxStrings;this.buyboxStateObj;this.atcState=-1;this.quantity=-1;this.isOfferRetail=false;this.isBowserFeatureCleanup=window.isBowserFeatureCleanup?1:0;this.cnFontIncrease=window.cnFontIncrease?1:0;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;}
$("#buyBoxContent").show();if(this.isBowserFeatureCleanup){$("#dsv-buy-box-feature-div").hide();}
var updateStr='';updateStr+=this.printBuyBoxHeader(selectedVariations,dpState);if(dpState['softlines_detail_page']!=1){updateStr+='<br />';}
$('#buyboxTwisterJS').html(updateStr);$('#BBPricePlusShipID').empty();$('#BBAvailPlusMerchID').empty();$('#bb-provided-by').empty();if(window.tfxOneClickWeblab){$('div.tfxOneClickPricing').hide();$("#quantityDropdownDiv select").attr('value','1');}
$('#standardDeliveryInputButton').click();$('#buyingOptionsSelection').empty();if(window.getItByWeblab){$('#buyboxAddresSelectionDropDown').attr('disabled',true);$('#oneClickSwatchContainer').empty();$('#BBPrimeBadge').hide();$('#giftWrapMessage').hide();}else{$('#parentOneClickDivId').show();$('#oneClickDivId').hide().empty();}
$('#goldBoxBuyBoxDivId').hide().empty();if(window.scrunchDPMStoreWeblab){this.updateVariationMatrix();}else{if(window.tfxOneClickWeblab){$('div.tfxOneClickPricing').empty().hide();}
$('.handleBuyButton input, div.tfxOneClickButton').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();$('#prime-rcx-subs-checkbox-outer').hide();$('#bbop_checkbox_outer_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){$('#buyboxTwisterJS').empty();this.determineAndDisplayBuyBoxContentDiv(buyboxStateObj);$('#BBPricePlusShipID').html(buyboxStateObj['priceStr']);if($('#addonBuyboxID').length>0){$('#addonBuyboxID').html(buyboxStateObj['addonStr']);if(buyboxStateObj['addonStr']==''){$('#buyboxDivId .buyTopBox .cBoxTL').show();$('#buyboxDivId .buyTopBox .cBoxTR').show();}
else{$('#buyboxDivId .buyTopBox .cBoxTL').hide();$('#buyboxDivId .buyTopBox .cBoxTR').hide();}}
var myBuyNewStrV2=buyboxStateObj['buyNewStr'];if(!myBuyNewStrV2||$.trim(myBuyNewStrV2)==''){$('#buyNewDiv').hide();}
else{$('#buyNewDiv > b').html(myBuyNewStrV2);$('#buyNewDiv').show();}
$('#BBAvailPlusMerchID').html(buyboxStateObj['availabilityStr']);$('#bb-provided-by').html(buyboxStateObj['vasProvidedByStr']);$('#abbBox').html(buyboxStateObj['accBBStr']);if(typeof(ScheduledDeliveryBuyBoxUpdater)!="undefined"&&ScheduledDeliveryBuyBoxUpdater.updateBuyBoxObject){var sdInfo=buyboxStateObj.otherFields.sdInfo;var sdTwisterOnChildSelect=sdInfo!==undefined;if(sdTwisterOnChildSelect){var scheduledDeliveryUpdateObject;if(sdInfo.isSDAvailable){scheduledDeliveryUpdateObject={asin:buyboxStateObj.fields.ASIN,mSku:buyboxStateObj.otherFields.merchantSku,fmID:buyboxStateObj.otherFields.fulfillmentManagerID,merchantID:buyboxStateObj.fields.merchantID,offerListingID:buyboxStateObj.fields.offerListingID,quantity:1,sdInfo:sdInfo};}
ScheduledDeliveryBuyBoxUpdater.updateBuyBoxObject(scheduledDeliveryUpdateObject);}else{var scheduledDeliveryUpdateObject={asin:buyboxStateObj.fields.ASIN,mSku:buyboxStateObj.otherFields.merchantSku,fmID:buyboxStateObj.otherFields.fulfillmentManagerID,merchantID:buyboxStateObj.fields.merchantID,marketplaceID:buyboxStateObj.otherFields.marketplaceID,offerListingID:buyboxStateObj.fields.offerListingID,quantity:1};ScheduledDeliveryBuyBoxUpdater.updateBuyBoxObject(scheduledDeliveryUpdateObject);}}
if(window.getItByWeblab){if(buyboxStateObj['1clickStatus']=='enabled'||buyboxStateObj['1clickStatus']=='prime'){$('#oneClickDivId').show();if(buyboxStateObj['canBeGiftwrapped']==1){$('#giftWrapMessage').show();}else{$('#giftWrapMessage').hide();}
if(buyboxStateObj['1clickStatus']=='prime'){amznJQ.available('BXPrimeSwatchFuncs',function(){window.BXPrimeSwatchFuncs.refreshSwatches(buyboxStateObj.fields.ASIN,buyboxStateObj.fields.merchantID);});$('#BBPrimeBadge').css("display","inline");}else{$('#oneClickSwatchContainer').empty();$('#BBPrimeBadge').hide();}}else{$('#oneClickDivId').hide();$('#giftWrapMessage').hide();$('#oneClickSwatchContainer').empty();}}else{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(jQuery('#bbop_checkbox_outer_div').length>0){if(buyboxStateObj['primeButton']&&!buyboxStateObj['snsEligible']){$('#bbop_checkbox_outer_div').html(buyboxStateObj['primeButton']).show();$('#prime-rcx-subs-checkbox-outer').show();}else{$('#bbop_checkbox_outer_div').hide();$('#prime-rcx-subs-checkbox-outer').hide();}}else if(jQuery('#prime-rcx-subs-checkbox-outer').length>0){if(buyboxStateObj['primeButton']&&!buyboxStateObj['snsEligible']){$('#prime-rcx-subs-checkbox-outer').show();}else{$('#prime-rcx-subs-checkbox-outer').hide();}}else{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']);$('#twisterOneClickOrig').html(buyboxStateObj['isPreOrder']?goTwisterBuyboxImages['oneclick_preorder']:goTwisterBuyboxImages['oneclick']);if(window.tfxOneClickWeblab){$("#twisterOneClickOrig input[name='submit.one-click-order']").click(function(){return $(this).tfxDisplayPopover();});}
this.atcState=buyboxStateObj['isPreOrder'];if($('#canPreorder').length>0){$('#canPreorder').val(buyboxStateObj['isPreorder']);}}
if(buyboxStateObj['storeTag']){var form=document.handleBuy;var impressionASIN=buyboxStateObj.fields.ASIN;var storeTag=buyboxStateObj['storeTag'];if(form['ASIN'].value!=impressionASIN){if(buyboxStateObj['isPreOrder']){jQuery.ajax({url:"/gp/product/utility/ajax/impression-tracking.html",data:{a:impressionASIN,ref:"dp_preo_"+storeTag+"_1"}});if(buyboxStateObj['customerHas1Click']&&(buyboxStateObj['1clickStatus']=='enabled'||buyboxStateObj['1clickStatus']=='prime')){jQuery.ajax({url:"/gp/product/utility/ajax/impression-tracking.html",data:{a:impressionASIN,ref:"dp_preo1c_"+storeTag+"_1"}});}}else{jQuery.ajax({url:"/gp/product/utility/ajax/impression-tracking.html",data:{a:impressionASIN,ref:"dp_atc_"+storeTag+"_1"}});if(buyboxStateObj['customerHas1Click']&&(buyboxStateObj['1clickStatus']=='enabled'||buyboxStateObj['1clickStatus']=='prime')){jQuery.ajax({url:"/gp/product/utility/ajax/impression-tracking.html",data:{a:impressionASIN,ref:"dp_1c_"+storeTag+"_1"}});}}}}
if(buyboxStateObj['snsEligible']){$('#buyingOptionsSelection').html(buyboxStateObj['snsStr']).show();if(window.snsDefaultWeblab){$('#snsDeliveryInputButton').click();}}else{$('#buyingOptionsSelection').hide();if(window.snsDefaultWeblab){$('#standardDeliveryInputButton').click();}}
if(!window.snsDefaultWeblab){if($('#standardDeliveryInputButton').length){$('#standardDeliveryInputButton').click();}}
if(window.tfxOneClickWeblab){var context=$("div#buyboxDivId");if(buyboxStateObj['tfxOneClickButton']){$("div#twisterOneClickOrig input[name='submit.one-click-order']").setButtonContent(buyboxStateObj['tfxOneClickButton'],context);}
if(buyboxStateObj['tfxOneClickPricing']){$('div.tfxOneClickPricing').setPricingContent(buyboxStateObj['tfxOneClickPricing'],context);}
if(buyboxStateObj['tfxButtonData']){$('div#twisterOneClickOrig').setButtonData(buyboxStateObj['tfxButtonData'],context);}}
if(window.tfxOneClickWeblab){$('.handleBuyButton input, div.tfxOneClickButton').css('cursor','').removeAmazonPopoverTrigger();$('div.tfxOneClickPricing').show();}
else{$('.handleBuyButton input').css('cursor','').removeAmazonPopoverTrigger();}
$('#bbop-check-box').trigger('onHideOrShow');$('#rslButtonOrig').hide();$('#wishlistAddButtonInactive, #wishlistDownButtonInactive, #rslButtonJsInactive, #weddingButtonInactive, #babyButtonInactive').hide();$('#wishlistAddButtonActive, #wishlistDownButtonActive, #rslButtonJsActive, #weddingButtonActive, #babyButtonActive').show();var isNewOfferRetail=buyboxStateObj.fields.merchantID==buyboxStateObj.otherFields.marketplaceID;if(this.quantity!=buyboxStateObj['maxQuantity']||this.isOfferRetail!=isNewOfferRetail){this.updateDropdown(buyboxStateObj['maxQuantity'],isNewOfferRetail,buyboxStateObj['isQuantityRestricted']);this.quantity=buyboxStateObj['maxQuantity'];this.isOfferRetail=isNewOfferRetail;}
$("#quantityDropdownDiv select").attr('value','1');$('#quantityDropdownDiv select').attr('disabled',false);if(window.getItByWeblab){$('#buyboxAddresSelectionDropDown').attr('disabled',false);}
$("#ddmMessage").trigger("twisterBuyBoxReady");}
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;if(form!=undefined){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){var dpState=DetailPage.StateController.getState();var buyboxStateObj=DetailPage.Model.getJSONObj(asin,this.data_type,this.feature_id,asinData[this.feature_id]);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);if(this.isBowserFeatureCleanup){if(buyboxStateObj['isDigital']!=1){$('#buyboxDivId').show();}}else{$('#buyboxDivId').show();}}else{$('#buyboxDivId').hide();this.updatePayphraseState(dpState,asin,buyboxStateObj);if(this.isBowserFeatureCleanup){if(buyboxStateObj['isDigital']==1){$("#dsv-buy-box-feature-div").html(buyboxStateObj['digital-buy-box']);$("#dsv-buy-box-feature-div").show();}else{$("#dsv-buy-box-feature-div").hide();}}}
return;};DetailPageFramework.BuyBoxAdapter.prototype.notify=function(eventType,dpState){if(dpState['current_asin']){var me=this;if(typeof window.isFlushing!='undefined'&&window.isFlushing){DetailPage.Model.fetch(dpState['current_asin'],this.data_type,function(){DetailPageFramework.BuyBoxAdapter.prototype.update.apply(me,arguments)},null,this.feature_id);}else{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);}
if(window.tfxOneClickWeblab){if(eventType=='window_onload'){DetailPage.StateController.setState('1click_address',$('#buyboxAddresSelectionDropDown').val());}
else if(eventType=='child_select'){$("div#twisterOneClickOrig").data("tfxButtonData",{"ASIN":dpState['current_asin'],"merchantID":dpState['exclusive_merchant_id'],"buttonName":$("input#oneClickBuyButton").attr("name")});}}
return;};DetailPageFramework.BuyBoxAdapter.prototype.updateVariationMatrix=function(){var dpState=DetailPage.StateController.getState();selectedVariations=dpState['selected_variations'];var hasWarnIcon=new Array();var contentAddToCart=this.buyBoxPopoverContent(selectedVariations,'AddToCart');var contentOneClick=this.buyBoxPopoverContent(selectedVariations,'OneClick');contentAddToCart="<table> <tr> <td width=15 valign=top>"+warnImage+"</td><td>"+contentAddToCart+"</td></tr></table>";contentOneClick="<table> <tr> <td width=15 valign=top>"+warnImage+"</td><td>"+contentOneClick+"</td></tr></table>";if(!contentAddToCart){contentAddToCart='Please select options from the left';}
if(!contentOneClick){contentOneClick='Please select options from the left';}
$('.handleBuyButton input, div.tfxOneClickButton').each(function(){$(this).css('cursor','not-allowed');$(this).attr('title','');$(this).removeAmazonPopoverTrigger();$(this).amazonPopoverTrigger({location:['left','auto'],locationAlign:'middle',locationMargin:15,width:250,hoverHideDelay:0,hoverShowDelay:0,showOnHover:true,showCloseButton:false,literalContent:($(this.parentNode).attr('id')=="twisterOneClickOrig")?contentOneClick:(($(this.parentNode).attr('id')=="twisterAddToCartOrig")?contentAddToCart:content),attached:true,onShow:function(){if(!dpState['current_asin']){window.isBBButtonHoveredOnce=1;var varDispLabel=dpState['variation_display_labels'];for(var rawDim in varDispLabel){var selectDivLabel="#selected_"+rawDim;var isWarnIconPresent=$(selectDivLabel+" #warnImageLabel").get(0);if(!selectedVariations[varDispLabel[rawDim]]&&!hasWarnIcon[rawDim]&&!isWarnIconPresent){$(selectDivLabel).each(function(){var x=$(this).html();var t='<span id="warnImageLabel">'+warnImage+' '+x+'</span>';$(this).html(t);hasWarnIcon[rawDim]=1;});}}}}});});};DetailPageFramework.BuyBoxAdapter.prototype.array2String=function(arr,connectorStr,useAll){var str='';var nextVariationName,variationName,separator='';for(variationLabel in arr){if((!arr[variationLabel])||useAll){variationName=nextVariationName;if(useAll){nextVariationName=arr[variationLabel];}else{nextVariationName=variationLabel;}
if(variationName){str+=(separator+variationName);separator=', ';}}}
if(str==''){return nextVariationName;}else if(nextVariationName){return str+connectorStr+nextVariationName;}else{return str;}};DetailPageFramework.BuyBoxAdapter.prototype.getStrOptions=function(selectedVariations){var dpState=DetailPage.StateController.getState();var hasVariationNames=0;for(var x in dpState['variation_display_labels']){hasVariationNames=1;break;}
var strOptions='';if(hasVariationNames){if(selectedVariations){if(dpState['softlines_detail_page']==1){strOptions=this.array2String(selectedVariations,' '+'<span style=font-weight:normal;>'+this.oStrings['and']+'</span>'+' ',false);}else{strOptions=this.array2String(selectedVariations,' '+this.oStrings['and']+' ',false);}}else{if(dpState['softlines_detail_page']==1){strOptions=this.array2String(dpState['variation_display_labels'],' '+'<span style=font-weight:normal;>'+this.oStrings['and']+'</span>'+' ',true);}else{strOptions=this.array2String(dpState['variation_display_labels'],' '+this.oStrings['and']+' ',true);}}}
return strOptions;};DetailPageFramework.BuyBoxAdapter.prototype.buyBoxPopoverContent=function(selectedVariations,contentType){var popContent='';var strOptions=this.getStrOptions(selectedVariations);if(strOptions){strOptions="<b>"+strOptions+"</b>";if(contentType=='AddToCart'){popContent+=this.oStrings['ToAddToCart'].replace(/###/,strOptions);}else if(contentType=='OneClick'){popContent+=this.oStrings['ToBuyNow'].replace(/###/,strOptions);}}
return popContent;};DetailPageFramework.BuyBoxAdapter.prototype.printBuyBoxHeader=function(selectedVariations,dpState){var headerString='';var strOptions=this.getStrOptions(selectedVariations);if(dpState['softlines_detail_page']==1){if(strOptions){headerString+='<span style="font-size: 12px; color: #333; font-family:arial;">'+this.oStrings['toBuy'].replace(/###/,'')+'</span> <b class="twisterNonSelectedState" style="font-family:Arial;font-size:12px; color:#333">'+strOptions+'</b> <div style="font-family:Arial; font-size:12px; color:#666"> ('+this.oStrings['NoVariationSubheader']+') </div>';}}else{if(strOptions){if(this.cnFontIncrease){headerString+='<h2 style="font-size: 14px; color: #000;">'+this.oStrings['toBuy'].replace(/###/,strOptions)+'</h2>'+'('+this.oStrings['NoVariationSubheader']+')';}else{headerString+='<h2 style="font-size: 11px; color: #000;">'+this.oStrings['toBuy'].replace(/###/,strOptions)+'</h2>'+'('+this.oStrings['NoVariationSubheader']+')';}}}
return headerString;};DetailPageFramework.BuyBoxAdapter.prototype.updateDropdown=function(maxQuantity,isNewOfferRetail,isQuantityRestricted){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='';dropdown.options.length=0;for(var i=1;i<=maxQuantity;i++){dropdown.options[i-1]=new Option(i,i);}
if(typeof jQuery.fn.quantityDropDown=='function'){if(isNewOfferRetail&&isQuantityRestricted){var qdd=new jQuery.fn.quantityDropDown();qdd.setMaxQuantity(maxQuantity);}}}}}};DetailPageFramework.BuyBoxAdapter.prototype.determineAndDisplayBuyBoxContentDiv=function(buyboxStateObj){var gbBuyBox=null;var digitalBuyBox=null;if(buyboxStateObj!=null){gbBuyBox=buyboxStateObj['gb-buy-box'];if(this.isBowserFeatureCleanup){digitalBuyBox=buyboxStateObj['isDigital'];}}
if(this.isBowserFeatureCleanup&&digitalBuyBox==1){$("#buyboxDivId").hide();$("#prime_outer_div").hide();$("#dsv-buy-box-feature-div").html(buyboxStateObj['digital-buy-box']);$("#dsv-buy-box-feature-div").show();}else{if(this.isBowserFeatureCleanup){$("#buyboxDivId").show();$("#prime_outer_div").show();$("#dsv-buy-box-feature-div").hide();}
if(gbBuyBox!=null){$("#buyBoxContent").hide();$('#goldBoxBuyBoxDivId').html(buyboxStateObj['gb-buy-box']);$('#goldBoxBuyBoxDivId').show();}else{$('#goldBoxBuyBoxDivId').hide().empty();$("#buyBoxContent").show();}}};};
// (FILE: /dp-framework/DetailPageFramework.CLogAdapter.js) 


var dpf_cLogAdapter=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"));}}}}};
// (FILE: /dp-framework/DetailPageFramework.EMWAAdapter.js) 


var dpf_EMWAAdapter=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.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 buyboxStateObj=DetailPage.Model.getJSONObj(asin,'offers','buy-box-json',asinData['buy-box-json']);isEMWA=buyboxStateObj?buyboxStateObj['isEMWA']:0;if(isEMWA){if(!DetailPage.Model.loaded(asin,'atf')){EMWA.showGenericEMWA(asin);}
if(typeof window.isFlushing!='undefined'&&window.isFlushing){DetailPage.Model.fetch(asin,'atf',EMWA.atfUpdater,null,EMWA.atf_feature_id);}else{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){var dpState=DetailPage.StateController.getState();if(!asin||typeof dpState['asin_variation_values']=='undefined'||typeof dpState['variation_display_labels']=='undefined'||typeof dpState['variation_label_order']=='undefined'||typeof dpState['variation_values']=='undefined'){return"";}
var asinData=dpState['asin_variation_values'];if(typeof asinData=='undefined')return"";var html='<div class="disclaim">';for(var i=0;i<dpState['variation_label_order'].length;i++){var key=dpState['variation_label_order'][i];var label=dpState['variation_display_labels'][key];if(typeof label=='undefined')continue;var values=dpState['variation_values'][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+=' | ';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);if(window.location.protocol.toLowerCase()=='https:'){element.replaceWith('<img src="https://images-na.ssl-images-amazon.com/images/G/01/x-locale/communities/tags/snake.gif" width="16" height="16" align="absmiddle" style="display: inline; padding-bottom: 6px;">');}else{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();}
if(typeof window.isFlushing!='undefined'&&window.isFlushing){DetailPage.Model.fetch(dpState['current_asin'],'offers',EMWA.offersUpdater,null,'buy-box-json');}else{DetailPage.Model.fetch(dpState['current_asin'],'offers',EMWA.offersUpdater);}}else{EMWA.hideEMWA();}});};
// (FILE: /dp-framework/DetailPageFramework.FeatureStringMap.js) 


var dpf_featureStringMap=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';};};};
// (FILE: /dp-framework/flushAjax.js) 


var flushAjaxJS=function($){window.PageAjax=function(oParams){var oPageAJAX={};var delimiter;var reload=0;var scripttokenreg=new RegExp("<<<SCRIPT_END>>>",'g');var requestLog=[];function requestEntry(reqKey){return requestLog[reqKey];}
var cleanUpRequest=function(requestKey,tryInx,xhrTimeoutId){oPageAJAX.removeRequest(requestKey,tryInx);clearTimeout(xhrTimeoutId);};var retry=function(ajaxLoad,useIframe,ajaxUrl,pageUrl,ok,err,requestKey,status,streamingXhr){if(oPageAJAX.getRequestTries(requestKey)<oPageAJAX.options.retries){if(streamingXhr){status=status?status:AJAXFlushUtils.ajaxHandlerCode.RETRY;streamingXhr.abort(status);}
oPageAJAX.resetDataInx(requestKey);if(typeof ajaxLoad=='function'){ajaxLoad(useIframe,ajaxUrl,pageUrl,ok,err,requestKey,oPageAJAX.getRequestTries(requestKey)+1);}}else if(streamingXhr){streamingXhr.abort(AJAXFlushUtils.ajaxHandlerCode.ABORT);}};var StreamingXhr=function(ajaxUrl,pageUrl,useIFrame,requestKey,tryInx){var requestKey=requestKey,tryInx=tryInx,abortCode,xhr,iframe,iFrameElem,eos;if(useIFrame){var frmUrl=ajaxUrl+'&asScript=1'+'&reqKey='+encodeURIComponent(requestKey)+'&try='+tryInx;iFrameElem='<iframe style="width:0px; height:0px; border: 0px" src="'+frmUrl+'"></iframe>';}else{if(window.XMLHttpRequest){xhr=new XMLHttpRequest();}else{xhr=new ActiveXObject("Microsoft.XMLHTTP");}}
this.getAbortCode=function(){return abortCode;};this.usingXhr=function(){return xhr?true:false;};this.getXhrImpl=function(){return xhr?xhr:iframe;};this.open=function(){if(xhr){xhr.open("GET",ajaxUrl,true);}};this.send=function(){if(xhr){xhr.send(null);}else if(iFrameElem){iframe=$(iFrameElem).appendTo("body")[0];}};this.abort=function(code){abortCode=code;if(xhr){xhr.abort();}else if(iframe){$(iframe).remove();}
var callbacks=oPageAJAX.getCallbacks(requestKey,tryInx);callComplete=callbacks['callComplete'],success_callback=callbacks['onSuccess'],error_callback=callbacks['onError'],statusHandler=callbacks['statusHandler'],appStatus=callComplete(success_callback,error_callback,{},AJAXFlushUtils.ajaxReadyState.LOADING,abortCode?abortCode:AJAXFlushUtils.serverCode.ERROR);statusHandler(appStatus,AJAXFlushUtils.ajaxReadyState.LOADING);};this.errorReload=function(){oPageAJAX.resetRequestLoading(requestKey,tryInx);retry(null,!this.usingXhr,null,pageUrl,null,null,requestKey,AJAXFlushUtils.ajaxHandlerCode.FATAL);};this.isRunning=function(){return oPageAJAX.isRequestLoading(requestKey,ajaxUrl,tryInx);};};var chunkNewData=function(responseText,requestKey){var startInx=oPageAJAX.getDataInx(requestKey),lastDelimInx=responseText.lastIndexOf(delimiter),chunks=[];if(lastDelimInx>startInx){chunks=responseText.substr(startInx,lastDelimInx-startInx);oPageAJAX.putDataInx(requestKey,lastDelimInx+delimiter.length);}else{return chunks;}
if(chunks.length>0){chunks=chunks.split(delimiter);}
return chunks;};$.extend(oPageAJAX,{defaultOptions:{'timeout':40000,'retries':1},options:{},initialize:function(oParams){oPageAJAX.options=$.extend(oPageAJAX.defaultOptions,oParams);delimiter=oPageAJAX.options.streamDelimiter.replace(/-/g,'');},update:function(oParams){$.extend(oPageAJAX.options,oParams);},printStats:function(){},newRequest:function(reqKey,url){requestLog[reqKey]={loading:[url],tryCount:1,dataInx:0,xhrs:[],callbacks:[]};},removeRequest:function(reqKey,tryInx){if(requestEntry(reqKey)){var outstandingTry=0,rl=requestLog[reqKey];for(var i in rl.loading){if(i!=tryInx&&rl.loading[i]){outstandingTry=1;break;}}
if(!outstandingTry){var xhr=rl.xhrs[tryInx];if(xhr&&!xhr.usingXhr()){$(xhr.getXhrImpl()).remove();}
delete requestLog[reqKey];}}},isRequestLoading:function(reqKey,url,tryInx){var e=requestEntry(reqKey);return e&&e.loading[tryInx]==url;},resetRequestLoading:function(reqKey,tryInx){var e=requestEntry(reqKey);if(e){e.loading[tryInx]=0;}},incrRequestTries:function(reqKey,url){var e=requestEntry(reqKey);if(e){e.loading[e.tryCount++]=url;}},getRequestTries:function(reqKey){var e=requestEntry(reqKey);return e?e.tryCount:0;},resetDataInx:function(reqKey){var e=requestEntry(reqKey);if(e){e.dataInx=0;}},getDataInx:function(reqKey){var e=requestEntry(reqKey);return e?e.dataInx:0;},putDataInx:function(reqKey,inx){var e=requestEntry(reqKey);if(e){e.dataInx=inx;}},putXhr:function(reqKey,xhr,tryInx){var e=requestEntry(reqKey);if(e){e.xhrs[tryInx]=xhr;}},getXhr:function(reqKey,tryInx){var e=requestEntry(reqKey);if(e){return e.xhrs[tryInx];}},putCallbacks:function(reqKey,tryInx,callbackMap){var e=requestEntry(reqKey);if(e){e.callbacks[tryInx]=callbackMap;}},getCallbacks:function(reqKey,tryInx){var e=requestEntry(reqKey);return e?e.callbacks[tryInx]:[];},pageReload:function(url,status){window.location=url;},handleDataChunk:function(data,encodedReqKey,tryInx){if(data){var reqKey=decodeURIComponent(encodedReqKey),callbacks=oPageAJAX.getCallbacks(reqKey,tryInx);if(!callbacks||callbacks.length==0){return;}
var callComplete=callbacks['callComplete'],success_callback=callbacks['onSuccess'],error_callback=callbacks['onError'],statusHandler=callbacks['statusHandler'],dataName=data.FeatureName,loadingStatus=AJAXFlushUtils.ajaxReadyState.LOADING;if(dataName=='EOS'){loadingStatus=AJAXFlushUtils.ajaxReadyState.DONE;}
var d=data,v;v=d.Value;if(v&&d.Type=="HTML"){d.Value=v.replace(scripttokenreg,"</script>");}
var appStatus=callComplete(success_callback,error_callback,d,loadingStatus,AJAXFlushUtils.serverCode.OK);statusHandler(appStatus,loadingStatus);}},loadStreaming:function(useIframe,ajaxUrl,pageUrl,success_callback,error_callback,requestKey,tryCount){var startTime=new Date(),tryInx=tryCount===undefined?0:tryCount-1;if(requestEntry(requestKey)){oPageAJAX.incrRequestTries(requestKey,ajaxUrl);}else{oPageAJAX.newRequest(requestKey,ajaxUrl);}
var callComplete=function(success_callback,error_callback,data,xhrReadyState,xhrStatus,streamingXhr){var timeElapsed=new Date()-startTime;clearTimeout(xhrTimeoutId);if(oPageAJAX.isRequestLoading(requestKey,ajaxUrl,tryInx)){var callBackContext={timeElapsed:timeElapsed,xhrStatus:xhrStatus,requestKey:requestKey},dataObj={};if(xhrStatus==AJAXFlushUtils.serverCode.OK){if((typeof data)=='string'){try{dataObj=eval('('+data+')');}catch(e){return error_callback(callBackContext,data,AJAXFlushUtils.ajaxHandlerCode.INVALID_RESP);};}else{dataObj=data;}
if(streamingXhr&&"EOS"==dataObj.ContentId){streamingXhr.eos=1;}
if(oPageAJAX.options.enforceEOS&&xhrReadyState==AJAXFlushUtils.ajaxReadyState.DONE&&streamingXhr&&!streamingXhr.eos){return error_callback(callBackContext,dataObj,AJAXFlushUtils.ajaxHandlerCode.INCOMPLETE_RESP);}
return success_callback(callBackContext,dataObj,xhrReadyState);}else{var errStat=AJAXFlushUtils.ajaxHandlerCode.FATAL;if(xhrStatus==AJAXFlushUtils.serverCode.TIMEOUT){errStat=AJAXFlushUtils.ajaxHandlerCode.TIMEOUT;}
return error_callback(callBackContext,{},errStat);}}else{oPageAJAX.resetDataInx(requestKey);return AJAXFlushUtils.ajaxHandlerCode.IGNORE;}};var statusHandler=function(appStatus,xhrReadyState){if(AJAXFlushUtils.shouldReload(appStatus)||appStatus==AJAXFlushUtils.ajaxHandlerCode.RETRY){retry(oPageAJAX.loadStreaming,useIframe,ajaxUrl,pageUrl,success_callback,error_callback,requestKey,appStatus);}else if(appStatus==AJAXFlushUtils.ajaxHandlerCode.ABORT){cleanUpRequest(requestKey,tryInx,xhrTimeoutId);}else if(appStatus==AJAXFlushUtils.ajaxHandlerCode.OK||appStatus==AJAXFlushUtils.ajaxHandlerCode.IGNORE){if(xhrReadyState==AJAXFlushUtils.ajaxReadyState.DONE){cleanUpRequest(requestKey,tryInx,xhrTimeoutId);}}};var streamingXhr=new StreamingXhr(ajaxUrl,pageUrl,useIframe,requestKey,tryInx);oPageAJAX.putXhr(requestKey,streamingXhr,tryInx);oPageAJAX.putCallbacks(requestKey,tryInx,{"callComplete":callComplete,"statusHandler":statusHandler,"onSuccess":success_callback,"onError":error_callback});if(streamingXhr.usingXhr()){var xhr=streamingXhr.getXhrImpl();xhr.onreadystatechange=function(){if(xhr.readyState==AJAXFlushUtils.ajaxReadyState.LOADING||xhr.readyState==AJAXFlushUtils.ajaxReadyState.DONE){var firstChunkTime=new Date().getTime();var appStatus=AJAXFlushUtils.ajaxHandlerCode.OK,responseText,status;try{status=xhr.status;if(!status)return;responseText=xhr.responseText;}catch(e){if(xhr.readyState==AJAXFlushUtils.ajaxReadyState.LOADING){return;}else{status=AJAXFlushUtils.serverCode.ERROR;}}
if(status==AJAXFlushUtils.serverCode.OK){var chunks=chunkNewData(responseText,requestKey);if(chunks.length>0){for(var i=0;i<chunks.length;i++){var loadingStatus=AJAXFlushUtils.ajaxReadyState.LOADING;if(xhr.readyState==AJAXFlushUtils.ajaxReadyState.DONE&&i==chunks.length-1){loadingStatus=AJAXFlushUtils.ajaxReadyState.DONE;}
try{appStatus=callComplete(success_callback,error_callback,chunks[i],loadingStatus,status,streamingXhr);}catch(e){}
if(appStatus!=AJAXFlushUtils.ajaxHandlerCode.OK){break;}}}else if(xhr.readyState==AJAXFlushUtils.ajaxReadyState.DONE){appStatus=callComplete(success_callback,error_callback,"{}",AJAXFlushUtils.ajaxReadyState.DONE,status,streamingXhr);}}else{var abortCode=streamingXhr.getAbortCode();appStatus=callComplete(success_callback,error_callback,responseText,xhr.readyState,abortCode||status);}
statusHandler(appStatus,xhr.readyState);}};}
streamingXhr.open();streamingXhr.send();var streamingXhrTimeout=function(){retry(oPageAJAX.loadStreaming,useIframe,ajaxUrl,pageUrl,success_callback,error_callback,requestKey,AJAXFlushUtils.serverCode.TIMEOUT,streamingXhr);};var xhrTimeoutId=setTimeout(streamingXhrTimeout,oPageAJAX.options.pageTimeout);return streamingXhr;}});oPageAJAX.initialize(oParams);return oPageAJAX;};};
// (FILE: /dp-framework/ajaxFlushManager.js) 


var ajaxFlushManagerJS=function($){window.AjaxFlushManager=function(oParams){var oFlushManager={};$.extend(oFlushManager,{initialize:function(oParams){oFlushManager.pageAjax=oParams.pageAjax;oFlushManager.pageletChunkHandlers={};oFlushManager.chunkHandlersForNoPageletID=[];oFlushManager.errorHandlers=[];oFlushManager.successHandlers=[];},subscribe:function(subscribeID,fHandler){if(typeof subscribeID=="string"){if(typeof fHandler=='function'){if(!oFlushManager.pageletChunkHandlers[subscribeID]){oFlushManager.pageletChunkHandlers[subscribeID]=[];}
oFlushManager.pageletChunkHandlers[subscribeID].push(fHandler);}}else if(typeof subscribeID=="object"){var oSubscribeHandlers=subscribeID;for(var pageletID in oSubscribeHandlers){oFlushManager.subscribe(pageletID,oSubscribeHandlers[pageletID]);}}else if(typeof subscribeID=="function"&&typeof fHandler=="undefined"){if(!oFlushManager.chunkHandlersForNoPageletID){oFlushManager.chunkHandlersForNoPageletID=[];}
oFlushManager.chunkHandlersForNoPageletID.push(subscribeID);}},subscribeErrorHandler:function(fHandler){if(typeof fHandler=="function"){if(!oFlushManager.errorHandlers){oFlushManager.errorHandlers=[];}
oFlushManager.errorHandlers.push(fHandler);}},subscribeSuccessHandler:function(fHandler){if(typeof fHandler=="function"){if(!oFlushManager.successHandlers){oFlushManager.successHandlers=[];}
oFlushManager.successHandlers.push(fHandler);}},handleDataChunk:function(pageletID,oChunk){for(var i=0;i<oFlushManager.pageletChunkHandlers[pageletID].length;i++){oFlushManager.pageletChunkHandlers[pageletID][i].call(window,oChunk);}},successCallback:function(callContext,oChunk,loadingStatus){if(!oChunk.ContentId){for(var i=0;i<oFlushManager.chunkHandlersForNoPageletID.length;i++){oFlushManager.chunkHandlersForNoPageletID[i].call(window,oChunk);}}else{var pageletID=oChunk.ContentId;if(oFlushManager.pageletChunkHandlers[pageletID]!=undefined){oFlushManager.handleDataChunk(pageletID,oChunk);}}
if(loadingStatus==AJAXFlushUtils.ajaxReadyState.DONE){for(var i=0;i<oFlushManager.errorHandlers.length;i++){oFlushManager.successHandlers[i].call(window,callContext,loadingStatus);}}
return AJAXFlushUtils.ajaxHandlerCode.OK;},errorCallback:function(callContext,data,handlerCode){for(var i=0;i<oFlushManager.errorHandlers.length;i++){oFlushManager.errorHandlers[i].call(window,callContext,data,handlerCode);}
return handlerCode;},callFlushingAjax:function(useIframe,url,pageUrl,requestKey){var returnContext={};returnContext.streamingXhr=this.pageAjax.loadStreaming(useIframe,url,pageUrl,this.successCallback,this.errorCallback,requestKey);return returnContext;},cancelRequest:function(context){if(context&&context.streamingXhr){context.streamingXhr.abort();}}});oFlushManager.initialize(oParams);return oFlushManager;};};
// (FILE: /dp-framework/flushUtils.js) 


var flushUtilsJS=function($){var oAJAXFlushUtils={};$.extend(oAJAXFlushUtils,{ajaxReadyState:{"NONE":-1,"UNSENT":0,"OPENED":1,"HEADERS_RECEIVED":2,"LOADING":3,"DONE":4},ajaxHandlerCode:{"OK":0,"IGNORE":1,"RETRY":2,"RELOAD":3,"TIMEOUT":4,"ABORT":5,"FATAL":6,"INVALID_RESP":7,"INCOMPLETE_RESP":8,"PAGELET_FATAL":9,"DEBUG_NOAJAX":10},serverCode:{"ERROR":-1,"OK":200,"TIMEOUT":408},shouldReload:function(status){return false;}});window.AJAXFlushUtils=oAJAXFlushUtils;};
// (FILE: /dp-framework/DetailPageFramework.AjaxRenderManager.js) 


var dpf_ajaxRenderManager=function($){window.AjaxRenderManager=function(oParams){var oRenderManager={};$.extend(oRenderManager,{oAjaxDefaultOptions:{pageTimeout:40000,streamDelimiter:'&&&',retries:5},oAjaxChunkHandler:function(oChunk){if(oChunk&&oChunk.FeatureName){DetailPage.Model.flushFeatureData(oChunk.ASIN,oChunk.RequestType,oChunk.FeatureName,oChunk.Value);}},oAjaxErrorHandler:function(callContext,data,handlerCode){var requestContext=oRenderManager.requests[callContext.requestKey];if(handlerCode==AJAXFlushUtils.ajaxHandlerCode.TIMEOUT){}else{}},oAjaxSuccessHandler:function(callContext,loadingStatus){var requestContext=oRenderManager.requests[callContext.requestKey];DetailPage.Model.ajaxSuccessHandler(requestContext.key,requestContext.dataType);},initialize:function(){flushAjaxJS($);ajaxFlushManagerJS($);flushUtilsJS($);oRenderManager.requests=[];window.oPageAjax=window.PageAjax(oRenderManager.oAjaxDefaultOptions);oRenderManager.oAjaxFlushManager=window.AjaxFlushManager({pageAjax:window.oPageAjax});oRenderManager.oAjaxFlushManager.subscribe(oRenderManager.oAjaxChunkHandler);oRenderManager.oAjaxFlushManager.subscribeErrorHandler(oRenderManager.oAjaxErrorHandler);oRenderManager.oAjaxFlushManager.subscribeSuccessHandler(oRenderManager.oAjaxSuccessHandler);},makeAjaxCall:function(useIframe,url,pageUrl,key,dataType){var requestKey=oRenderManager.requests.length;var context={};if(useIframe){url+="&isFlushing=1";}else{url+="&isFlushing=2";}
context.key=key;context.dataType=dataType;context.ajaxRequestContext=oRenderManager.oAjaxFlushManager.callFlushingAjax(useIframe,url,pageUrl,requestKey);oRenderManager.requests.push(context);}});oRenderManager.initialize(oParams);return oRenderManager;};};
// (FILE: /dp-framework/twister_init.js) 


var twister_init=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'],smid:dpState['preselected_merchant_id'],requestType:type,state:dpState['state'],city:dpState['city'],district:dpState['district'],isDvdo:window.isDVDOEnabled,"dropdown-selection":dpState['1click_address'],"rps":dpState['rps']};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(typeof dpState['preselected_merchant_id']!=='undefined'&&dpState['preselected_merchant_id']!==''){argString+="&smid="+dpState['preselected_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'];}
argString+="&rps="+dpState['rps'];return argString;};DetailPageFramework.initialize=function(collectMetrics){if(typeof DetailPage=='undefined'){window.DetailPage={};}
var prefetchURL='/gp/twister/ajax/prefetch/';DetailPage.Model=new DetailPageFramework.Model({offers:{url:function(isFlushing){return isFlushing?'/gp/product/twister-update/':prefetchURL;},argHandler:function(asins,isFlushing){return isFlushing?getTwisterUpdateArgs(asins,'offers'):getOffersArgs(asins);}},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');}}});if(typeof window.isFlushing!='undefined'&&window.isFlushing){dpf_ajaxRenderManager(jQuery);DetailPage.ajaxRenderManager=window.AjaxRenderManager({});}
DetailPage.StateController=new DetailPageFramework.StateController;DetailPage.adapters={};if(collectMetrics){DetailPage.adapters["_first"]=new DetailPageFramework.UpdateStartAdapter;DetailPage.adapters["_clog"]=new DetailPageFramework.CLogAdapter;}
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.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);});var ajaxTriggeredSpinWheel=function(feature_div){if(feature_div.length>0){if(!feature_div.attr('loadingBarSet')){feature_div.attr('loadingBarSet','1');feature_div.html(loadingBarHTML2Line);}}else{}};DetailPageFramework.registerCallback("ajax_request",'more-buying-choices',function(){var feature_div=$('#more-buying-choice-content-div');ajaxTriggeredSpinWheel(feature_div);});DetailPageFramework.registerCallback("ajax_request",'sell-box',function(){var feature_div=$('#sell-your-content-div');ajaxTriggeredSpinWheel(feature_div);});DetailPageFramework.registerCallback("asin_deselect",'prime',function(dpState){var parent=dpState["parent_asin"];if(parent){var updatePrime=function(asin,asinData){var html=asinData["prime"];var element=$("#prime_feature_div");if($.trim(html).length>0){element.get(0).innerHTML=html;}else{element.hide();}};if(typeof window.isFlushing!=undefined&&window.isFlushing){DetailPage.Model.fetch(parent,"offers",updatePrime,null,'prime');}else{DetailPage.Model.fetch(parent,"offers",updatePrime);}}});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'){var twisterPriceOuter;var twisterPriceInner;var dpPriceOuter;var dpPriceInner;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";}}
if(typeof DetailPage.StateController.getState()['set-price-block-height']=='undefined'||DetailPage.StateController.getState()['set-price-block-height']){$(twisterPriceOuter).css('height',''+$(twisterPriceOuter).height()+'px');}}
swapOutPriceAfter=function(key,requestedData){if(typeof DetailPage.StateController.getState()['set-price-block-height']=='undefined'||DetailPage.StateController.getState()['set-price-block-height']){if($(twisterPriceOuter).height()<$(twisterPriceInner).height()){$(twisterPriceOuter).css('height',$(twisterPriceInner).height()+'px');}}}
switchPriceBefore=function(key,requestedData){if(!dpPriceOuter){dpPriceOuter="#price-and-olp-condition-link-outer";dpPriceInner="#price-and-olp-condition-link-inner";if($(dpPriceOuter).length==0){dpPriceOuter="#detail-page-price_feature_div";dpPriceInner="#detail-page-price_inner_div";}}
if(typeof DetailPage.StateController.getState()['set-price-block-height']=='undefined'||DetailPage.StateController.getState()['set-price-block-height']){$(dpPriceOuter).css('height',''+$(dpPriceOuter).height()+'px');}}
switchPriceAfter=function(key,requestedData){if(typeof DetailPage.StateController.getState()['set-price-block-height']=='undefined'||DetailPage.StateController.getState()['set-price-block-height']){if($(dpPriceOuter).height()<$(dpPriceInner).height()){$(dpPriceOuter).css('height',$(dpPriceInner).height()+'px');}}}
var titleHeight=$("#product-title_feature_div").height();adjustProductTitle=function(){var currentTitleHeight=$("#product-title_feature_div").height();var variationTitle='';var dpState=DetailPage.StateController.getState();var asinToUse=dpState['current_hovered_asin'];if(!asinToUse){asinToUse=dpState['current_asin'];}
var values=dpState['asin_variation_values'][asinToUse];for(var value in values){if(value!='ASIN'){variationTitle+=dpState['variation_values'][value][dpState['asin_variation_values'][asinToUse][value]]+", ";}}
if(variationTitle.length>0){variationTitle=variationTitle.substring(0,variationTitle.length-2);}
$("#variationProductTitle").html(variationTitle);if(currentTitleHeight>titleHeight){$("#product-title_feature_div").css('height',''+currentTitleHeight+'px');titleHeight=currentTitleHeight;}}
var featureHeight={};featureHeight['#availability_feature_div']=$("#availability_feature_div").height();featureHeight['#olp-condition-link_feature_div']=$("#olp-condition-link_feature_div").height();featureHeight['#product-title_feature_div']=$("#product-title_feature_div").height();adjustOfferRelatedFeaturesAfter=function(div_id){return function(){var currentFeatureHeight=$(div_id).height();if(currentFeatureHeight>featureHeight[div_id]){if(jQuery.browser.msie){$(div_id).css('height',''+currentFeatureHeight+'px');}else{$(div_id).css('min-height',''+currentFeatureHeight+'px');}}
$(div_id).show();}}
adjustOfferRelatedFeaturesBefore=function(div_id){return function(){featureHeight[div_id]=$(div_id).height();if(!jQuery.browser.msie){$(div_id).css('min-height',''+featureHeight[div_id]+'px');}
if(div_id=="#olp-condition-link_feature_div"){$(div_id).addClass('pdClearfix');}}}
DetailPageFramework.registerCallback('before_redraw','product-title',adjustOfferRelatedFeaturesBefore("#product-title_feature_div"));DetailPageFramework.registerCallback('after_redraw','product-title',adjustOfferRelatedFeaturesAfter("#product-title_feature_div"));DetailPageFramework.registerCallback('before_redraw','availability',adjustOfferRelatedFeaturesBefore("#availability_feature_div"));DetailPageFramework.registerCallback('after_redraw','availability',adjustOfferRelatedFeaturesAfter("#availability_feature_div"));DetailPageFramework.registerCallback('document_ready','detail-page-price',switchPriceBefore);DetailPageFramework.registerCallback('before_redraw','detail-page-price',switchPriceBefore);DetailPageFramework.registerCallback('after_redraw','detail-page-price',switchPriceAfter);DetailPageFramework.registerCallback('document_ready','price',swapOutPriceBefore);DetailPageFramework.registerCallback('before_redraw','price',swapOutPriceBefore);DetailPageFramework.registerCallback('after_redraw','price',swapOutPriceAfter);if(window.isAdjustProductTitleWeblab){DetailPageFramework.registerCallback('after_redraw','detail-page-price',adjustProductTitle);DetailPageFramework.registerCallback('after_redraw','price',adjustProductTitle);}
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.registerCallback('before_redraw','olp-condition-link',switchPriceBefore);DetailPageFramework.registerCallback('after_redraw','olp-condition-link',switchPriceAfter);}}};};
// (FILE: /dp-framework/DetailPageFramework.DeclareAvailable.js) 


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