                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                if(!window.__td){window.__MT=100;window.__ti=0;window.__td=[];window.__td.length=window.__MT;window.__noTrace=false;


}
vp.eoe.AsynchronousOfferManager=function $vpfn_kmXJD$ueISlh3YGf2sIiww5$34()
{if(!window.__noTrace){__td[__ti]=arguments;__ti=__ti>=__MT?0:__ti+1;}
var me=this;
this.offers=new Array();
this.offerInitialized=new Array();
this.paginators=new Array();
this.numberOfOffersPerRow;
this.rxSellPage;
this.itemId;
this.offersPerPage;
this.debugMode;
this.prand;
this.mforce;
this.pageName="oeOfferNavigation";
this.currentOffer=2;
this.totalOffers;
this.products=new Array();
this.loadingText;
this.matrixId=-1;
this.primaryControlId;
this.incomingDocument;
this.invocationId;
this.rforce;

this.RegisterDisplayedOffers=function $vpfn_0CRgoEniFJgrVLZ3UDUrMA29$35(startIndex,endIndex)
{if(!window.__noTrace){__td[__ti]=arguments;__ti=__ti>=__MT?0:__ti+1;}
for(var i=startIndex;i<endIndex&&i<me.offers.length;i++)
{
me.offerInitialized[i]=true;
}

if(vp.ui.get("oeListItem_"+me.currentOffer))
{
me.offerInitialized[me.currentOffer]=true;
me.ResizeNav();
}

for(var j=0;vp.ui.get('lblCurrentlyDisplayed'+j);j++)
{
var startOffer=(startIndex+1);
var endOffer=endIndex;
if(endOffer>me.offers.length)
{
endOffer=me.offers.length;
}
vp.ui.get('lblCurrentlyDisplayed'+j).innerHTML=startOffer+"-"+endOffer+" ";
vp.ui.get('lblTotalOffers'+j).innerHTML=me.offers.length+" ";
}
};

this.FetchRequest=function $vpfn_kbkQPU$cKymKFIEXgActwA55$24()
{if(!window.__noTrace){__td[__ti]=arguments;__ti=__ti>=__MT?0:__ti+1;}
var me;
this.cell;
this.offerIndex;
};

this.FetchQueue=new Array();

this.AddToFetchQueue=function $vpfn_1cwTEBf$85kOlEnFMIGEKg64$27(cell,offerIndex)
{if(!window.__noTrace){__td[__ti]=arguments;__ti=__ti>=__MT?0:__ti+1;}
if(!me.offerInitialized[offerIndex])
{

for(var index in me.paginators)
{
if(me.paginators[index].selectedPageNumber)
{
if(offerIndex>=this.offers.length)
{
return;
}

break;
}
}

var newRequest=new me.FetchRequest();
newRequest.cell=cell;
newRequest.offerIndex=offerIndex;
me.FetchQueue.push(newRequest);
}
};

this.FetchNewOffers=function $vpfn_TPfr2xutucCoRFtq0thsdg89$26()
{if(!window.__noTrace){__td[__ti]=arguments;__ti=__ti>=__MT?0:__ti+1;}
if(!me.FetchQueue.length)
{
return;
}

vp.widget.showLoadingBox(me.loadingText);

var startIndex=null;
var endIndex=null;

for(var request=0;request<me.FetchQueue.length;request++)
{
if(startIndex===null||me.FetchQueue[request].offerIndex<startIndex)
{
startIndex=me.FetchQueue[request].offerIndex;
}
if(endIndex===null||me.FetchQueue[request].offerIndex>endIndex)
{
endIndex=me.FetchQueue[request].offerIndex;
}
}

endIndex++;

var fnCallBack=function $vpfn_SIvB8F2Uli2XB2ZvgjDx5g115$25(sResponse)
{if(!window.__noTrace){__td[__ti]=arguments;__ti=__ti>=__MT?0:__ti+1;}
var oResponse=vp.http.parseJSON(sResponse);


var matrixText="";

var matrixId=oResponse["matrixId"];
if(matrixId!=-1)
{
matrixText="_"+matrixId;
}

var maxIndex=startIndex;
for(var request=0;request<me.FetchQueue.length;request++)
{
var requestHtml=oResponse["offer_"+me.FetchQueue[request].offerIndex];
var requestId=oResponse["offer_"+me.FetchQueue[request].offerIndex+"_id"];

if(requestHtml)
{
me.UpdateOfferWithHtml(me.FetchQueue[request].cell,me.FetchQueue[request].offerIndex,requestId,requestHtml);
maxIndex=me.FetchQueue[request].offerIndex;
}
else
{
break;
}
}


var rowId=parseInt(maxIndex/me.numberOfOffersPerRow)+1;

while(vp.ui.get("divMatrixRowBreak"+rowId+matrixText)&&maxIndex<endIndex)
{

vp.ui.collapse(vp.ui.get("divMatrixRowBreak"+rowId+matrixText));

for(var tempIdx=0;tempIdx<me.numberOfOffersPerRow;tempIdx++)
{
var cell=vp.ui.get("oeMatrixCell_"+rowId+"_"+tempIdx+matrixText);
if(cell)
{
vp.ui.collapse(cell);
}
maxIndex++;
}
rowId++;
}

me.AppendJavascript(oResponse["javascript"]);

me.FetchQueue=new Array();

vp.widget.hideLoadingBox(me.loadingText);
};

var i;
var postData=new vp.web.QueryString();
var oExclude="";
for(i=0;i<me.offers.length;i++)
{
if(me.offerInitialized[i])
{
if(oExclude)
{
oExclude=oExclude+",";
}
oExclude=oExclude+me.offers[i];
}
}

var pForce="";
for(i=startIndex;i<endIndex;i++)
{
if(!me.offerInitialized[i]&&me.products[i])
{
if(pForce)
{
pForce=pForce+",";
}

pForce=pForce+me.products[i];
}
}



postData.setItem("oexclude",oExclude);
postData.setItem("start_index",startIndex);
postData.setItem("end_index",endIndex);
postData.setItem("rxsellpage",me.rxSellPage);
postData.setItem("item_id",me.itemId);
postData.setItem("debugxs",me.debugMode);
postData.setItem("matrixId",me.matrixId);

postData.setItem("mforce",me.mforce);
postData.setItem("prand",me.prand);

if(me.incomingDocument&&me.rxSellPage==76)
{
postData.setItem("documentId",me.incomingDocument);
}

if(me.rforce===1)
{
postData.setItem("ts",new Date().valueOf());
}

var url="/vp/ns/cart/select_options/offer_web_service.aspx?"+postData.toString();

vp.http.getAsync(url,fnCallBack);
};

this.AppendJavascript=function $vpfn_o$Rh0TjAi7wcY49pAMdq9g229$28(sScript)
{if(!window.__noTrace){__td[__ti]=arguments;__ti=__ti>=__MT?0:__ti+1;}
var head=document.getElementsByTagName("head")[0];
var scriptElement=document.createElement("DIV");
scriptElement.innerHTML="<br>"+sScript;
var scripts=scriptElement.getElementsByTagName("SCRIPT");
for(var i=0;i<scripts.length;i++)
{
var script;
if(document.all)
{
script=document.createElement('script');
script.type='text/javascript';
script.src=scripts[i].src;
script.text=scripts[i].text;
head.appendChild(script);
}
else
{
script=scripts[i].cloneNode(true);
head.appendChild(script);
}
}
};

this.UpdateOfferWithHtml=function $vpfn_$9lfQHsLS6hEdjSk9LB6Og254$31(cell,offerIndex,offerId,sHtml)
{if(!window.__noTrace){__td[__ti]=arguments;__ti=__ti>=__MT?0:__ti+1;}
var i;
var offerElement=document.createElement("DIV");
offerElement.innerHTML=sHtml;

if(document.all)
{
var scripts=offerElement.getElementsByTagName("SCRIPT");
for(i=0;i<scripts.length;i++)
{
scripts[i].defer="defer";
}
cell.innerHTML=offerElement.innerHTML;
}
else
{
cell.appendChild(offerElement);
}

me.offerInitialized[offerIndex]=true;

me.offers[offerIndex]=offerId;

if(vp.ui.get(me.primaryControlId))
{
vp.ui.get(me.primaryControlId).value=
vp.ui.get(me.primaryControlId).value+
me.offers[offerIndex]+",";
}

if(vp.ui.get('oeListNav'))
{
var images=offerElement.getElementsByTagName("IMG");
for(i=0;i<images.length;i++)
{
images[i].onload=me.ResizeNav;
}
}

me.ResizeNav();
};


this.UpdateOfferElement=function $vpfn_1p2PF269LwB5j2wGK$WbQA298$30(cell,offerIndex)
{if(!window.__noTrace){__td[__ti]=arguments;__ti=__ti>=__MT?0:__ti+1;}

if(!me.offerInitialized[offerIndex])
{
vp.widget.showLoadingBox(me.loadingText);

var fnCallBack=function $vpfn_SIvB8F2Uli2XB2ZvgjDx5g305$29(sResponse)
{if(!window.__noTrace){__td[__ti]=arguments;__ti=__ti>=__MT?0:__ti+1;}
var oResponse=vp.http.parseJSON(sResponse);
var requestHtml=oResponse["offer_"+offerIndex];
var requestId=oResponse["offer_"+offerIndex+"_id"];
if(requestHtml)
{
me.UpdateOfferWithHtml(cell,offerIndex,requestId,requestHtml);
}

me.AppendJavascript(oResponse["javascript"]);

vp.widget.hideLoadingBox(me.loadingText);
};

var postData=new vp.web.QueryString();

postData.setItem("pforce",me.products[offerIndex]);
postData.setItem("start_index",offerIndex);
postData.setItem("end_index",offerIndex+1);
postData.setItem("rxsellpage",me.rxSellPage);
postData.setItem("item_id",me.itemId);
postData.setItem("debugxs",me.debugMode);


if(vp.eoe.incomingDocumentId)
{
postData.setItem("documentId",vp.eoe.incomingDocumentId);
}

var url="/vp/ns/cart/select_options/offer_web_service.aspx?"+postData.toString();

vp.http.getAsync(url,fnCallBack);
}
};

this.ShowAllOffers=function $vpfn_pF1cBTb2fj47xjxZZ_SxJA341$25()
{if(!window.__noTrace){__td[__ti]=arguments;__ti=__ti>=__MT?0:__ti+1;}

if(me.pageName)
{
var logMessage=me.pageName+":ShowAllOffers";
vp.spot.track(logMessage);
}

me.ShowOffers(0,me.totalOffers);
me.HideNavigation();

};

this.ShowOffers=function $vpfn_Kb1Abfcpb7nblvPorDhk2w355$22(startIndex,endIndex)
{if(!window.__noTrace){__td[__ti]=arguments;__ti=__ti>=__MT?0:__ti+1;}

var rowRenderingId=0;
for(var i=0;i<me.totalOffers;rowRenderingId++)
{
var rowBreak;

if(this.matrixId!=-1)
{
rowBreak=vp.ui.get("divMatrixRowBreak"+rowRenderingId+"_"+this.matrixId);
}
else
{
rowBreak=vp.ui.get("divMatrixRowBreak"+rowRenderingId);
}

if(rowBreak)
{
if(i<=startIndex||i>=endIndex)
{
vp.ui.collapse(rowBreak);
}
else
{
vp.ui.expand(rowBreak);
}
}


for(var colRenderingId=0;colRenderingId<this.numberOfOffersPerRow;colRenderingId++)
{
var cell;
if(this.matrixId!=-1)
{
cell=vp.ui.get("oeMatrixCell_"+rowRenderingId+"_"+colRenderingId+"_"+this.matrixId);
}
else
{
cell=vp.ui.get("oeMatrixCell_"+rowRenderingId+"_"+colRenderingId);
}
if(cell)
{
if(i<startIndex||i>=endIndex)
{
vp.ui.collapse(cell);
}
else
{
me.AddToFetchQueue(cell,i);
vp.ui.expand(cell);
}
}

i++;
}
}

this.FetchNewOffers();

for(var j=0;vp.ui.get('lblCurrentlyDisplayed'+j);j++)
{
var startOffer=(startIndex+1);
var endOffer=endIndex;
if(endOffer>me.offers.length)
{
endOffer=me.offers.length;
}
vp.ui.get('lblCurrentlyDisplayed'+j).innerHTML=startOffer+"-"+endOffer+" ";
}
};

this.ResizeNav=function $vpfn_RhXPB6Ggdk5$tBivuvUssQ427$21()
{if(!window.__noTrace){__td[__ti]=arguments;__ti=__ti>=__MT?0:__ti+1;}
if(vp.ui.get('oeListNav'))
{
vp.ui.setHeight('oeListNav',330);
vp.ui.setHeight('oeListNav',vp.ui.getHeight('oeListContainer')-1);
vp.ui.setWidth('oeListNav',vp.ui.getWidth('oeListNav'));
}
};

this.ShowSingleOffer=function $vpfn_tWlOwQNN878SGWjbEn5L_w437$27(offerIndex,startIndex)
{if(!window.__noTrace){__td[__ti]=arguments;__ti=__ti>=__MT?0:__ti+1;}
if(me.currentOffer!=offerIndex)
{
vp.ui.get('oeListNavLink_'+offerIndex).className='oe-list-nav-item-link-selected';
vp.ui.get('oeListNavLink_'+me.currentOffer).className='oe-list-nav-item-link';

me.currentOffer=offerIndex;

for(var i=startIndex;i<me.offers.length;i++)
{
var cell=vp.ui.get("oeListItem_"+i);

if(i!=offerIndex)
{
vp.ui.collapse(cell);
}
else if(i==offerIndex)
{
me.UpdateOfferElement(cell,i);

vp.ui.expand(cell);
}
}

me.ResizeNav();
}
};

this.GoToPage=function $vpfn_YbS1PhfTglB0VhetWR8KVQ466$20(pageNum)
{if(!window.__noTrace){__td[__ti]=arguments;__ti=__ti>=__MT?0:__ti+1;}
if(me.pageName)
{
var logMessage=me.pageName+":ChangePage";
vp.spot.track(logMessage);
}

var startIndex=me.offersPerPage*(pageNum-1);
var endIndex=me.offersPerPage*pageNum;
me.ShowOffers(startIndex,endIndex);

for(var index in me.paginators)
{
if(me.paginators[index].selectedPageNumber)
{
me.paginators[index].selectedPageNumber=pageNum;
me.paginators[index].render();
}
}
};

this.InitializePaginator=function $vpfn_dGITep0vn4$UtrIbMkdHLQ488$31(paginatorId)
{if(!window.__noTrace){__td[__ti]=arguments;__ti=__ti>=__MT?0:__ti+1;}
if(me.offers.length>me.offersPerPage)
{
var pages=Math.ceil(me.offers.length/me.offersPerPage);

var oPaginator=new vp.widget.Paginator(
document.getElementById(paginatorId),
pages,
me.GoToPage);

oPaginator.render();

me.paginators[paginatorId]=oPaginator;
}
else
{
me.HideNavigation();
}
};

this.HideNavigation=function $vpfn_khH5q6GtdS3fL$CMisLKKA509$26()
{if(!window.__noTrace){__td[__ti]=arguments;__ti=__ti>=__MT?0:__ti+1;}
for(var i=0;vp.ui.get("tblOENavigation"+i);i++)
{
vp.ui.collapse("tblOENavigation"+i);
}

var matrixText="";

if(this.matrixId!=-1)
{
matrixText=this.matrixId;
}


if(vp.ui.get("divSeeMoreMatchingLink"+matrixText))
{
vp.ui.collapse("divSeeMoreMatchingLink"+matrixText);
}
};

};