                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                

if(!window.__td){window.__MT=100;window.__ti=0;window.__td=[];window.__td.length=__MT;window.__noTrace=false;}
function selectEnvelope(docId,pfid)
{if(!window.__noTrace){__td[__ti]=arguments;__ti=__ti>=__MT?0:__ti+1;}
window.opener.document.getElementById('hdnEnvDocId'+pfid).value=docId;window.opener.document.getElementById('envOption'+pfid).checked=true;window.opener.setDestinationTabTypeAndSubmitForm('EnvelopesCustomize');window.close();}
if(typeof vp=="undefined"){var vp={};}
vp.matchingset=function matchingset(){if(!window.__noTrace){__td[__ti]=arguments;__ti=__ti>=__MT?0:__ti+1;}};vp.matchingset.selectEnvelopeCurrentTab=function matchingset_selectEnvelopeCurrentTab(docId,pfid)
{if(!window.__noTrace){__td[__ti]=arguments;__ti=__ti>=__MT?0:__ti+1;}
var parent=vp.dialog.getParent();vp.matchingset.selectEnvelopeModal(docId,pfid);parent.setDestinationTabTypeAndSubmitForm('Envelopes');};vp.matchingset.selectEnvelopeNextTab=function matchingset_selectEnvelopeNextTab(docId,pfid)
{if(!window.__noTrace){__td[__ti]=arguments;__ti=__ti>=__MT?0:__ti+1;}
var parent=vp.dialog.getParent();vp.matchingset.selectEnvelopeModal(docId,pfid);parent.setDestinationTabTypeAndSubmitForm('EnvelopesCustomize');};vp.matchingset.selectEnvelopeModal=function matchingset_selectEnvelopeModal(docId,pfid)
{if(!window.__noTrace){__td[__ti]=arguments;__ti=__ti>=__MT?0:__ti+1;}
var parent=vp.dialog.getParent();parent.document.getElementById('hdnEnvDocId'+pfid).value=docId;parent.document.getElementById('envOption'+pfid).checked=true;vp.dialog.closeCurrent();};vp.matchingset.currentSourceComboId=0;vp.matchingset.currentSourceComboPfId='';vp.matchingset.populateMatchingSetContent=function matchingset_populateMatchingSetContent(popUpId)
{if(!window.__noTrace){__td[__ti]=arguments;__ti=__ti>=__MT?0:__ti+1;}
var oPopUpContainer=vp.ui.get(popUpId);var rndNumber;rndNumber=Math.round(Math.random()*10000);var matchingSetUrl=new vp.web.URL("/vp/gallery/matching_set_popup.aspx");matchingSetUrl.setItem("combo_id",vp.matchingset.currentSourceComboId);matchingSetUrl.setItem("match_to",vp.matchingset.currentSourceComboPfId);matchingSetUrl.setItem("rand",rndNumber);oPopUpContainer.innerHTML=vp.http.get(matchingSetUrl.toString());};vp.matchingset.createMatchingSet=function matchingset_createMatchingSet(){if(!window.__noTrace){__td[__ti]=arguments;__ti=__ti>=__MT?0:__ti+1;}
var cInputs=document.getElementsByTagName("input");var selectedPfIds='';var matchingSetUrl=new vp.web.URL("/vp/ns/add_matching_set.aspx");for(var i=0;i<cInputs.length;i++){var oCheckBox;oCheckBox=cInputs[i];if(oCheckBox.getAttribute('type')&&oCheckBox.getAttribute('type')=="checkbox"&&oCheckBox.checked&&oCheckBox.name&&oCheckBox.name.indexOf('mstile')>-1){selectedPfIds=selectedPfIds+oCheckBox.value+",";}
else if(oCheckBox.getAttribute('type')&&oCheckBox.getAttribute('type')=="hidden"&&oCheckBox.name&&oCheckBox.name.indexOf('olid')>-1){matchingSetUrl.setItem("olid",vp.web.urlEncode(oCheckBox.value));}}
if(selectedPfIds.length===0){alert('You must select at least one document to be in your matching set.');vp.ui.reactivateClickableButton('msset');return;}
if(vp.ui.get("hdnDocId")){matchingSetUrl.setItem("doc_id",vp.ui.get("hdnDocId").value);}
matchingSetUrl.setItem("pf_ids",selectedPfIds);matchingSetUrl.setItem("combo_pf_id",vp.ui.get("combo_pf_id").value);matchingSetUrl.setItem("combo",vp.ui.get("combo").value);if(vp.dialog.getCurrent()){parent.window.location=matchingSetUrl.toString();}
else{window.location=matchingSetUrl.toString();}};vp.matchingset.goBack=function matchingset_goBack()
{if(!window.__noTrace){__td[__ti]=arguments;__ti=__ti>=__MT?0:__ti+1;}
if(window.location.pathname.indexOf("_pop.aspx")>0)
{vp.dialog.cancelCurrent();}
else
{window.history.go(-1);}};vp.matchingset.activateComboPalette=function matchingset_activateComboPalette()
{if(!window.__noTrace){__td[__ti]=arguments;__ti=__ti>=__MT?0:__ti+1;}
var paletteContainer=vp.ui.get('divOuterComboContainer');var largePreview=vp.ui.get('imgLargeComboPreview');paletteContainer.style.top=vp.ui.getTop(largePreview)+largePreview.height-100;paletteContainer.style.display='block';};vp.combopreview=function combopreview(){if(!window.__noTrace){__td[__ti]=arguments;__ti=__ti>=__MT?0:__ti+1;}};vp.combopreview.currentPage=-1;vp.combopreview.rowsPerPage=2;vp.combopreview.totalPages=1;vp.combopreview.previewsPerRow=5;vp.combopreview.expandPalette=function combopreview_expandPalette()
{if(!window.__noTrace){__td[__ti]=arguments;__ti=__ti>=__MT?0:__ti+1;}
vp.ui.get('spanCloseMatchingSet').style.display='block';vp.ui.get('spanSeeMatchingSet').style.display='none';vp.ui.get('imgExpandButton').style.display='none';vp.ui.get('imgCollapseButton').style.display='block';vp.ui.get('divComboPaletteInnerContent').style.display='block';vp.ui.get('tdActionButton').style.width='20px';vp.ui.get('tblOpenAndCloseButtons').width='650px';vp.ui.get('tdButtonDescription').width='630px';vp.ui.get('tdButtonDescription').style.textAlign='right';};vp.combopreview.closePalette=function combopreview_closePalette()
{if(!window.__noTrace){__td[__ti]=arguments;__ti=__ti>=__MT?0:__ti+1;}
vp.ui.get('spanCloseMatchingSet').style.display='none';vp.ui.get('spanSeeMatchingSet').style.display='block';vp.ui.get('imgExpandButton').style.display='block';vp.ui.get('imgCollapseButton').style.display='none';vp.ui.get('divComboPaletteInnerContent').style.display='none';vp.ui.get('tblOpenAndCloseButtons').width='';vp.ui.get('tdButtonDescription').width='';};vp.combopreview.setPage=function combopreview_setPage(pageNumber)
{if(!window.__noTrace){__td[__ti]=arguments;__ti=__ti>=__MT?0:__ti+1;}
if(vp.combopreview.currentPage==pageNumber||pageNumber>vp.combopreview.totalPages||pageNumber<1)
{return;}
var currentRow=vp.ui.get('trComboPreviewRow1');var i=1;var minRow=(pageNumber-1)*vp.combopreview.rowsPerPage;var maxRow=minRow+vp.combopreview.rowsPerPage+1;var previewsPerPage=vp.combopreview.rowsPerPage*vp.combopreview.previewsPerRow;var startIndex=previewsPerPage*(pageNumber-1);var endIndex=startIndex+previewsPerPage;while(currentRow)
{if(i>minRow&&i<maxRow)
{if(vp.browser.isIE)
{currentRow.style.display='block';}
else
{currentRow.style.display='table-row';}}
else
{currentRow.style.display='none';}
i=i+1;currentRow=vp.ui.get('trComboPreviewRow'+i);}
if(endIndex>comboUrlArray.length)
{endIndex=comboUrlArray.length;}
for(i=startIndex;i<endIndex;i++)
{var imgPreview=vp.ui.get('comboPreview'+i);if(imgPreview&&imgPreview.src.indexOf('c.gif')>0)
{imgPreview.src=comboUrlArray[i];}}
var previousPageLink=vp.ui.get('aPageNumber'+vp.combopreview.currentPage);var currentPageLink=vp.ui.get('aPageNumber'+pageNumber);currentPageLink.className='active-page-link';if(previousPageLink)
{previousPageLink.className='inactive-page-link';}
vp.combopreview.currentPage=pageNumber;};vp.combopreview.nextPage=function combopreview_nextPage()
{if(!window.__noTrace){__td[__ti]=arguments;__ti=__ti>=__MT?0:__ti+1;}
vp.combopreview.setPage(vp.combopreview.currentPage+1);};vp.combopreview.previousPage=function combopreview_previousPage()
{if(!window.__noTrace){__td[__ti]=arguments;__ti=__ti>=__MT?0:__ti+1;}
vp.combopreview.setPage(vp.combopreview.currentPage-1);};var originalWidth=0;var originalHeight=0;var FRAME_COUNT=10;var ZOOM_SIZE=1.25;vp.combopreview.enlargeComboPreview=function combopreview_enlargeComboPreview(elementId)
{if(!window.__noTrace){__td[__ti]=arguments;__ti=__ti>=__MT?0:__ti+1;}
if(vp.browser.isIE)
{vp.combopreview.adjustImageSize(elementId,true,0);}};vp.combopreview.shrinkComboPreview=function combopreview_shrinkComboPreview(elementId)
{if(!window.__noTrace){__td[__ti]=arguments;__ti=__ti>=__MT?0:__ti+1;}
if(vp.browser.isIE)
{vp.combopreview.adjustImageSize(elementId,false,0);}};vp.combopreview.adjustImageSize=function combopreview_adjustImageSize(elementId,enlarge,callCount)
{if(!window.__noTrace){__td[__ti]=arguments;__ti=__ti>=__MT?0:__ti+1;}
var image=vp.ui.get(elementId);image.style.zindex=100;if(originalHeight===0)
{originalWidth=image.width;originalHeight=image.height;}
if(callCount<FRAME_COUNT)
{var heightIncrement=((originalHeight*ZOOM_SIZE)-originalHeight)/FRAME_COUNT;var widthIncrement=((originalWidth*ZOOM_SIZE)-originalWidth)/FRAME_COUNT;if(!enlarge)
{heightIncrement=heightIncrement*-1;widthIncrement=widthIncrement*-1;}
if(callCount==(FRAME_COUNT-1)&&!enlarge)
{image.height=originalHeight;image.width=originalWidth;}
else if(callCount==(FRAME_COUNT-1)&&enlarge)
{image.height=originalHeight*ZOOM_SIZE;image.width=originalWidth*ZOOM_SIZE;}
else
{image.height=image.height+heightIncrement;image.width=image.width+widthIncrement;var nextHeight=image.height+heightIncrement;if(nextHeight<originalHeight||nextHeight>originalHeight*ZOOM_SIZE)
{callCount=FRAME_COUNT-1;}}
callCount=callCount+1;setTimeout("vp.combopreview.adjustImageSize('"+elementId+"',"+enlarge+","+callCount+")",10);}
else
{callCount=0;}};vp.combopreview.setComboId=function combopreview_setComboId(comboId)
{if(!window.__noTrace){__td[__ti]=arguments;__ti=__ti>=__MT?0:__ti+1;}
vp.ui.get('hdnComboId').value=comboId.toString();document.forms[0].submit();};vp.matchingset.openViewLargerPop=function matchingset_openViewLargerPop(sLivePreviewUrl,nWidth,sTitle)
{if(!window.__noTrace){__td[__ti]=arguments;__ti=__ti>=__MT?0:__ti+1;}
var oUrl=new vp.web.URL(sLivePreviewUrl);oUrl.setItem("width",nWidth);var myDialog=vp.dialog.IFrameDialog.open("viewLargerPop",sTitle,oUrl.toString(),vp.dialog.chrome.Message,690,500);return true;};vp.matchingset.KitMatchingSetManager=function matchingset_KitMatchingSetManager(strRedirectUrl,strDialogId,strSpotlight)
{if(!window.__noTrace){__td[__ti]=arguments;__ti=__ti>=__MT?0:__ti+1;}
var products=new Array();var me=this;var combo;var RedirectUrl=strRedirectUrl;var ErrorMessageId=strDialogId;var SpotlightMessage=strSpotlight;var nonDocumentProducts=[];this.CreateCheckBoxResponder=function pb_this_CreateCheckBoxResponder(chbxElementId)
{if(!window.__noTrace){__td[__ti]=arguments;__ti=__ti>=__MT?0:__ti+1;}
var element=document.getElementById(chbxElementId);if(element)
{this.ToggleProductSelection=function pb_this_ToggleProductSelection()
{if(!window.__noTrace){__td[__ti]=arguments;__ti=__ti>=__MT?0:__ti+1;}
var pfid;if(this.event)
{pfid=this.event.srcElement.value;}
else
{pfid=this.value;}
me.ToggleProduct(pfid);};vp.events.add(element,'click',this.ToggleProductSelection);}};var HasOnlyNonDocumentProducts=function pv_HasOnlyNonDocumentProducts()
{if(!window.__noTrace){__td[__ti]=arguments;__ti=__ti>=__MT?0:__ti+1;}
if(nonDocumentProducts.length)
{var aLookup={};for(var i in nonDocumentProducts)
{aLookup[nonDocumentProducts[i]]=nonDocumentProducts[i];}
for(i in products)
{if(products[i]&&typeof aLookup[products[i]]=='undefined')
{return false;}}
return true;}
return false;};this.CreateMatchingSetButtonResponder=function pb_this_CreateMatchingSetButtonResponder(btnElementId)
{if(!window.__noTrace){__td[__ti]=arguments;__ti=__ti>=__MT?0:__ti+1;}
var element=document.getElementById(btnElementId);if(element)
{this.SubmitMatchingSetSelection=function pb_this_SubmitMatchingSetSelection()
{if(!window.__noTrace){__td[__ti]=arguments;__ti=__ti>=__MT?0:__ti+1;}
if(!products.length)
{var oDialog=vp.dialog.get(ErrorMessageId);oDialog.open();oDialog.resizeToFitContent(true);return false;}
if(HasOnlyNonDocumentProducts())
{var oAddItemUrl=new vp.web.URL("/vp/ns/cart/xt_orderform_additem.aspx");oAddItemUrl.setItem("standalone",1);oAddItemUrl.setItem("ts",new Date().valueOf());if(products.length>1)
{oAddItemUrl.setItem("ag",1);oAddItemUrl.setItem("async",1);for(var i=0;i<products.length;i++)
{if(products[i])
{oAddItemUrl.setItem("pf_id",products[i]);vp.http.get(oAddItemUrl.toString());}}
window.location="/vp/ns/cart/display_cart.aspx";}
else
{oAddItemUrl.setItem("pf_id",products[0]);window.location=oAddItemUrl.toString();}
return false;}
var pfidList="";for(i=0;i<products.length;i++)
{if(products[i])
{if(pfidList)
{pfidList=pfidList+',';}
pfidList=pfidList+products[i];}}
if(me.combo)
{var studioUrl=new vp.web.URL(strRedirectUrl);studioUrl.setItem("kit_pfids",pfidList);studioUrl.setItem("combo_pf_id",products[0]);studioUrl.setItem("kit_pf_id",products[0]);vp.spot.trackWithQueryString("MatchingSet:"+SpotlightMessage,studioUrl.queryString);window.location=studioUrl;return false;}
else
{var galleryUrl=new vp.web.URL(strRedirectUrl);galleryUrl.setItem("kit_pfids",pfidList);vp.spot.trackWithQueryString("MatchingSet:"+SpotlightMessage,galleryUrl.queryString);window.location=galleryUrl;return false;}};vp.events.add(element,'click',this.SubmitMatchingSetSelection);}};this.ToggleProduct=function pb_this_ToggleProduct(pfid)
{if(!window.__noTrace){__td[__ti]=arguments;__ti=__ti>=__MT?0:__ti+1;}
if(products.contains(pfid))
{products.removeValue(pfid);}
else
{products.add(pfid);}};this.AddNonDocumentProduct=function pb_this_AddNonDocumentProduct(pfid)
{if(!window.__noTrace){__td[__ti]=arguments;__ti=__ti>=__MT?0:__ti+1;}
nonDocumentProducts[nonDocumentProducts.length]=pfid;};};