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









if(typeof(vp)=="undefined")
{
var vp={};
}

if(!vp.caricatures)
{
vp.caricatures={};
}



var Caricature=null;


vp.caricatures.editor={};


vp.caricatures.editor.isPageLoadedFlag=false;





vp.caricatures.editor.getCaricatureHash=function $vpfn_DXID7IGZNED1pNuZ6Le33Q35$42()
{if(!window.__noTrace){__td[__ti]=arguments;__ti=__ti>=__MT?0:__ti+1;}
var val='';

var iptCaricature=vp.ui.get('iptCaricature');
if(iptCaricature)
{
val=iptCaricature.value;
}

return val;
};





vp.caricatures.editor.setCaricatureHash=function $vpfn_dpG97dGNiGufMGAd1Yd1tQ52$42(hash)
{if(!window.__noTrace){__td[__ti]=arguments;__ti=__ti>=__MT?0:__ti+1;}
var iptCaricature=vp.ui.get('iptCaricature');
if(iptCaricature)
{
iptCaricature.value=hash;
}
};





vp.caricatures.editor.activeGridButton=null;






vp.caricatures.editor.gridButtonClick=function $vpfn_Bg141jrgXyyAIzNGYqQGeQ72$40(oButton,notDirty)
{if(!window.__noTrace){__td[__ti]=arguments;__ti=__ti>=__MT?0:__ti+1;}
if(!vp.caricatures.editor.isPageLoadedFlag)
{
return true;
}
var activeClass="preview-button-active";

if(vp.caricatures.editor.activeGridButton)
{
vp.ui.removeClass(vp.caricatures.editor.activeGridButton,activeClass);
}

vp.ui.addClass(oButton,activeClass);
vp.caricatures.editor.activeGridButton=oButton;

if(!notDirty)
{
vp.caricatures.editor.gridsAreDirty();
}


VS_logEvent('User Action','CaricaturePreviewButtonClicked');
VS_logEvent('Class Name',oButton.className);
VS_logEvent('Button Text',oButton.textContent);

return false;
};


vp.caricatures.editor.PreviewButtonBorderHighlight=function $vpfn_V30I8U88l2m71udddmKI3w102$53(oButton,bHighlight)
{if(!window.__noTrace){__td[__ti]=arguments;__ti=__ti>=__MT?0:__ti+1;}
if(!vp.caricatures.editor.isPageLoadedFlag)
{
return true;
}

var activeClass="preview-button-active";

if(bHighlight)
{
vp.ui.addClass(oButton,activeClass);
}
else
{
if(oButton!=vp.caricatures.editor.activeGridButton)
{
vp.ui.removeClass(oButton,activeClass);
}
}

return false;
};





vp.caricatures.editor.activeColorButton={};






vp.caricatures.editor.colorButtonClicked=function $vpfn_l5zMr8srSr3e7WQeg99u4g137$43(oButton,componentTypeId,colorSchemeTypeId,notDirty)
{if(!window.__noTrace){__td[__ti]=arguments;__ti=__ti>=__MT?0:__ti+1;}
if(!vp.caricatures.editor.isPageLoadedFlag)
{
return true;
}

var activeClass="color-button-active";

if(vp.caricatures.editor.activeColorButton[componentTypeId])
{
if(vp.caricatures.editor.activeColorButton[componentTypeId][colorSchemeTypeId])
{
vp.ui.removeClass(vp.caricatures.editor.activeColorButton[componentTypeId][colorSchemeTypeId],activeClass);
}
}
else
{
vp.caricatures.editor.activeColorButton[componentTypeId]={};
}

vp.ui.addClass(oButton,activeClass);
vp.caricatures.editor.activeColorButton[componentTypeId][colorSchemeTypeId]=oButton;

if(!notDirty)
{
vp.caricatures.editor.gridsAreDirty();
}


VS_logEvent('User Action','CaricatureColorButtonClicked');
VS_logEvent('id',oButton.id);
VS_logEvent('Class Name',oButton.className);
VS_logEvent('componentTypeId',componentTypeId);
VS_logEvent('colorSchemeTypeId',colorSchemeTypeId);

return false;
};






vp.caricatures.editor.multiGridCurrent={grid:null,palette:null,tab:null};
vp.caricatures.editor.gridRevision={};
vp.caricatures.editor.gridRevision['Current']=0;





vp.caricatures.editor.gridsAreDirty=function $vpfn_sxjgQVQ0e604zkQqZJ1xLA189$38()
{if(!window.__noTrace){__td[__ti]=arguments;__ti=__ti>=__MT?0:__ti+1;}
vp.caricatures.editor.gridRevision['Current']+=1;
};







vp.caricatures.editor.changeMultiGridTab=function $vpfn_PyReznnzJeSO4o_zP4QiwA200$43(tab,gridId,paletteId)
{if(!window.__noTrace){__td[__ti]=arguments;__ti=__ti>=__MT?0:__ti+1;}
if(!vp.caricatures.editor.isPageLoadedFlag)
{
return true;
}

var activeTab=null;

if(null!==vp.caricatures.editor.multiGridCurrent)
{
activeTab=vp.caricatures.editor.multiGridCurrent.tab;

if(tab===activeTab)
{
return false;
}
}

var spotTrackName='caricature_tab_'+gridId;
vp.spot.track(spotTrackName);






if(activeTab!==null)
{
activeTab.className='tab';
}
tab.className='activetab tab';

vp.caricatures.editor.multiGridCurrent.tab=tab;




var gridTblId=gridId.replace("div","tbl").replace("GridContainer","PermutationGrid");

if(!vp.caricatures.editor.gridRevision[gridTblId]||
vp.caricatures.editor.gridRevision[gridTblId]<vp.caricatures.editor.gridRevision['Current'])
{
vp.caricatures.editor.refreshGridPage(gridTblId);
vp.caricatures.editor.gridRevision[gridTblId]=vp.caricatures.editor.gridRevision['Current'];
}



var oldGrid=document.getElementById(vp.caricatures.editor.multiGridCurrent.grid);
var newGrid=document.getElementById(gridId);

if(newGrid)
{
newGrid.style.display='';
if(oldGrid)
{
oldGrid.style.display='none';
}
vp.caricatures.editor.multiGridCurrent.grid=gridId;
}



var oldPalette=document.getElementById(vp.caricatures.editor.multiGridCurrent.palette);
var newPalette=document.getElementById(paletteId);

if(newPalette)
{
newPalette.style.display='';
if(oldPalette)
{
oldPalette.style.display='none';
}
vp.caricatures.editor.multiGridCurrent.palette=paletteId;
}

return false;
};

vp.caricatures.editor.refreshGrids=function $vpfn_OidPr5IKxmpBZimOGV7ljQ280$37()
{if(!window.__noTrace){__td[__ti]=arguments;__ti=__ti>=__MT?0:__ti+1;}
if(!vp.caricatures.editor.isPageLoadedFlag)
{
return true;
}

var previewGrids=document.getElementsByName("divPreviewGrid");
for(var i=0;i<previewGrids.length;i++)
{
vp.caricatures.editor.refreshGridPage(previewGrids[i].firstChild.id);
}

return false;
};

vp.caricatures.editor.refreshGridPage=function $vpfn_XHxzWgj2wNTqf4JDUFlCIw296$40(gridTableElementName)
{if(!window.__noTrace){__td[__ti]=arguments;__ti=__ti>=__MT?0:__ti+1;}
var startPageElement=vp.ui.get(gridTableElementName+'.startPage');
var startPage=1;
if(startPageElement!==null)
{
startPage=startPageElement.innerHTML;
}
vp.caricatures.editor.setGridPage(gridTableElementName,startPage);
};

vp.caricatures.editor.setGridPage=function $vpfn_xzUrTvw42keHKUy_QAFD6g307$36(gridTableElementName,newStartPage,viewAll,componentTypeIds,useAnimalGrid)
{if(!window.__noTrace){__td[__ti]=arguments;__ti=__ti>=__MT?0:__ti+1;}
var httpRequest=vp.http.createRequest();

var url='/vp/ns/caricatures/editor/preview_grid_update.aspx?caricature='+Caricature.toCaricatureHash()+'&startPage='+newStartPage;

var oCurUrl=new vp.web.URL(document.location);
if(oCurUrl.getItem("popmode"))
{
url+="&popmode="+oCurUrl.getItem("popmode");
}

if(componentTypeIds)
{
url+='&componentTypeIds='+componentTypeIds;
}
else
{
var componentTypeIdsElement=vp.ui.get(gridTableElementName+'.componentTypeIds');
if(componentTypeIdsElement!==null)
{
url+='&componentTypeIds='+componentTypeIdsElement.innerHTML.replace(/\<\/?span\>/gi,'');
}
}

useAnimalGrid=useAnimalGrid||vp.ui.get(gridTableElementName+'.useAnimalGrid')!==null;
if(useAnimalGrid)
{
url+='&useAnimalGrid=1';
}

if(viewAll)
{
url+='&viewAll=true';
}

if(vp.web.getQueryString('debugcaricature'))
{
url+='&debugcaricature=1';
}

var responseCallback=function $vpfn_ESGxi1hmPwnVRqubpor2AQ348$27(responseXML)
{if(!window.__noTrace){__td[__ti]=arguments;__ti=__ti>=__MT?0:__ti+1;}
var grid=vp.ui.get(gridTableElementName);

grid.parentNode.parentNode.innerHTML=responseXML;

vp.caricatures.editor.selectFirstSelection(gridTableElementName);

vp.caricatures.editor.ChangePreviewGridHeight();

vp.caricatures.editor.UpdateRemoveAddOnJS('AddonRemovalHiddenInput'+gridTableElementName);
vp.caricatures.editor.UpdateRemoveAddonName();

vp.caricatures.editor.gridRevision[gridTableElementName]=vp.caricatures.editor.gridRevision['Current'];
};

vp.http.getAsync(url,responseCallback);


};

vp.caricatures.editor.PermuteOverComponentsOnly=false;

vp.caricatures.editor.selectFirstSelection=function $vpfn_yAi0kfe7LfruoIGdGpz7Ng371$45(gridName)
{if(!window.__noTrace){__td[__ti]=arguments;__ti=__ti>=__MT?0:__ti+1;}



var previewsGrid=vp.ui.get(gridName);
if(previewsGrid===null)
{


return false;
}
if(gridName=='CaricatureTypeSelectionGrid')
{

var selectedPreview=vp.ui.get('aGridSelected');
if(selectedPreview&&vp.ui.isChildOf(selectedPreview,previewsGrid)&&selectedPreview.parentElement)
{
vp.caricatures.editor.gridButtonClick(selectedPreview.parentElement);
}
return true;
}

var previewLinks=previewsGrid.getElementsByTagName('div');
for(var i=0;i<previewLinks.length;i++)
{
if(vp.ui.hasClass(previewLinks[i],'preview-button'))
{
var previewCaricatureElements=previewLinks[i].getAttribute('rel');
var activeClass="preview-button-active";
var selected=false;
if(vp.caricatures.editor.PermuteOverComponentsOnly)
{
selected=vp.caricatures.editor.CompareComponentPreviewToCurrentCaricature(previewCaricatureElements);
}
else
{
selected=vp.caricatures.editor.ComparePreviewToCurrentCaricature(previewCaricatureElements);
}
if(selected)
{
vp.caricatures.editor.gridButtonClick(previewLinks[i],true);
break;
}
else
{
if(previewLinks[i]==vp.caricatures.editor.activeGridButton)
{
vp.ui.removeClass(vp.caricatures.editor.activeGridButton,activeClass);
vp.caricatures.editor.activeGridButton=null;
}

}
}
}

return false;
};

vp.caricatures.editor.ConvertComponentStringToObject=function $vpfn_4aBBZm6xHJC2ik0$Wrvzuw430$55(componentString)
{if(!window.__noTrace){__td[__ti]=arguments;__ti=__ti>=__MT?0:__ti+1;}
if(!componentString)
{
return null;
}
var objComponents={};
var property=0;
var value=0;
var componentEndIndex=componentString.indexOf('~');
var componentStringSet=componentString.substr(1,componentEndIndex-2);
var splitedPrevElem=componentStringSet.split(',');
for(var i=0;i<splitedPrevElem.length;i++)
{
var pairSeperatorIndex=splitedPrevElem[i].indexOf(':');
property=splitedPrevElem[i].substr(1,pairSeperatorIndex-2);
value=parseInt(splitedPrevElem[i].substr(pairSeperatorIndex+1,splitedPrevElem[i].length-pairSeperatorIndex-1));
objComponents[property]=value;
}
return objComponents;
};

vp.caricatures.editor.ComparePreviewToCurrentCaricature=function $vpfn_rtrS3DQxNRHoG3Z6MzxtKQ452$58(prevElem)
{if(!window.__noTrace){__td[__ti]=arguments;__ti=__ti>=__MT?0:__ti+1;}
var curCariComponent=null;
if(Caricature)
{
curCariComponent=Caricature.components;
}
if(!(prevElem&&Caricature))
{
return false;
}

var previewComponent=vp.caricatures.editor.ConvertComponentStringToObject(prevElem);

if(!previewComponent)
{
return false;
}

var bResult=true;
for(var key in previewComponent)
{
if(!curCariComponent[key]||
curCariComponent[key]!=previewComponent[key])
{
bResult=false;
break;
}
}

return bResult;
};

vp.caricatures.editor.CompareComponentPreviewToCurrentCaricature=function $vpfn_zsXPwWrcpVaFmzit2WdI7w485$67(prevElem)
{if(!window.__noTrace){__td[__ti]=arguments;__ti=__ti>=__MT?0:__ti+1;}
var curCariComponent=null;
if(Caricature)
{
curCariComponent=Caricature.components;
}
if(!(prevElem&&Caricature))
{
return false;
}


var prevComponents=vp.caricatures.editor.ConvertComponentStringToObject(prevElem);

if(!prevComponents)
{
return false;
}



for(var key1 in prevComponents)
{
for(var key2 in curCariComponent)
{
if((key1==key2)&&(prevComponents[key1]==curCariComponent[key2]))
{
return true;
}
}
}

return false;
};

vp.caricatures.editor.InitializeColorPaletteSelection=function $vpfn_TsqmdfkJxaLYowSPTSKpnw521$56()
{if(!window.__noTrace){__td[__ti]=arguments;__ti=__ti>=__MT?0:__ti+1;}
if(Caricature)
{
for(var componentTypeId in Caricature.colorSchemes)
{
for(var colorSchemeTypeId in Caricature.colorSchemes[componentTypeId])
{
vp.caricatures.editor.selectColorPalette(Caricature.colorSchemes[componentTypeId][colorSchemeTypeId],componentTypeId,colorSchemeTypeId,true);
}
}
}
};

vp.caricatures.editor.selectColorPalette=function $vpfn_0TWPwibcIq2VCOXferd1Nw535$43(colorSchemeId,componentTypeId,colorSchemeTypeId,notDirty)
{if(!window.__noTrace){__td[__ti]=arguments;__ti=__ti>=__MT?0:__ti+1;}
var palette=vp.ui.get("divColorPalette"+componentTypeId+":"+colorSchemeTypeId);
if(palette)
{
var colorButton=vp.ui.get("aColorButton"+componentTypeId+":"+colorSchemeId);
if(colorButton&&vp.ui.isChildOf(colorButton,palette))
{
vp.caricatures.editor.colorButtonClicked(colorButton,componentTypeId,colorSchemeTypeId,notDirty);
}
}
};







vp.caricatures.editor.verifyTypeSelected=function $vpfn_pmDkBm5y$87HLuiq4CrfEQ554$43(alertText)
{if(!window.__noTrace){__td[__ti]=arguments;__ti=__ti>=__MT?0:__ti+1;}
var isSelected=(''!==vp.caricatures.editor.getCaricatureHash());

if(!isSelected)
{
alert(alertText);
}

return isSelected;
};

vp.caricatures.editor.ensureNumericOrdinal=function $vpfn_7xxW9EfdshI9B1bqez6zUw566$45(input,e)
{if(!window.__noTrace){__td[__ti]=arguments;__ti=__ti>=__MT?0:__ti+1;}
var keynum;
var keychar;
var numcheck;
if(window.event)
{
keynum=e.keyCode;
}
else if(e.which)
{
keynum=e.which;
}
keychar=String.fromCharCode(keynum);
if(/\d/.test(keychar))
{
input.value=keychar;
}
else if(keynum>95&&keynum<106)
{

input.value=String.fromCharCode(keynum-48);
}
else if(keynum==8||keynum==46)
{
input.value='';
}
else if(keynum==13)
{
vp.ui.get('btnRearrange').onclick();
}
else if(keynum==9)
{
var currentOrdinal=parseInt(input.id.replace(/iptOrdinal/,''));
if(e.shiftKey)
{
currentOrdinal-=1;
}
else
{
currentOrdinal+=1;
}
var target=vp.ui.get('iptOrdinal'+currentOrdinal);
if(target)
{
target.focus();
target.select();
}
}
return false;
};

vp.caricatures.editor.focusFirstOrdinalOrName=function $vpfn_jhiQ9_2Py4UXs$VIpUYgdw618$48()
{if(!window.__noTrace){__td[__ti]=arguments;__ti=__ti>=__MT?0:__ti+1;}
var target=vp.ui.get('iptOrdinal1');
if(target)
{
target.focus();
target.select();
}
else
{
target=vp.ui.get('iptCaricatureName');
if(target)
{
target.focus();
}
}
};

vp.caricatures.editor.submitOnEnter=function $vpfn_Pk0v2VjuprqJJSlMCBraCA636$38(e,urlArgs)
{if(!window.__noTrace){__td[__ti]=arguments;__ti=__ti>=__MT?0:__ti+1;}
var keynum;
var keychar;
var numcheck;
if(window.event)
{
keynum=e.keyCode;
}
else if(e.which)
{
keynum=e.which;
}
if(keynum==13)
{
submitAndRedirectTo(location.href.replace(/\?.*/g,'')+'?'+urlArgs);
return false;
}
return true;
};


vp.caricatures.editor.PageLoaded=function $vpfn_MXY7KWyKkFuml$JmmpiLfg658$35()
{if(!window.__noTrace){__td[__ti]=arguments;__ti=__ti>=__MT?0:__ti+1;}
vp.caricatures.editor.isPageLoadedFlag=true;
vp.caricatures.editor.focusFirstOrdinalOrName();
};

vp.caricatures.editor.PreviewButtonAfterClickActive=true;

vp.caricatures.editor.TypeChosen=function $vpfn_U9jf4A5GA_qkCiUsOKk2nQ666$35(targetUrl,disableAfterClick,oButton)
{if(!window.__noTrace){__td[__ti]=arguments;__ti=__ti>=__MT?0:__ti+1;}
if(vp.caricatures.editor.PreviewButtonAfterClickActive)
{
vp.caricatures.editor.gridButtonClick(oButton);
submitAndRedirectTo(targetUrl);
}
if(disableAfterClick)
{
vp.caricatures.editor.PreviewButtonAfterClickActive=false;
}
};





vp.caricatures.editor.ChangePreviewGridHeight=function $vpfn_cPdRx1itvC8VwV3FgTSShA683$48(previewPermutationGridID)
{if(!window.__noTrace){__td[__ti]=arguments;__ti=__ti>=__MT?0:__ti+1;}
var currentPreviewContainer=vp.ui.get('currentCaricatureContainer');
var previewPermutationGrid=null;
if(previewPermutationGridID)
{
previewPermutationGrid=vp.ui.get(previewPermutationGridID);
}
var multiGridTab=vp.ui.get('AddOnTabTable');
var CONSTANT_PREVIEW_OUTER_CONTAINER_HEIGHT=40;
var newCurCaricatureHeight;

if(currentPreviewContainer!==null)
{
var curCaricatureHeight=vp.ui.getHeight(currentPreviewContainer);

if(previewPermutationGrid!==null)
{

var previewGridHeight=vp.ui.getHeight(previewPermutationGrid);
vp.ui.setHeight(currentPreviewContainer,previewGridHeight);



newCurCaricatureHeight=vp.ui.getHeight(currentPreviewContainer);
if(newCurCaricatureHeight>previewGridHeight)
{



vp.ui.setHeight(previewPermutationGrid,newCurCaricatureHeight);
}
}
else if(multiGridTab!==null)
{


if(vp.caricatures.editor.multiGridCurrent&&vp.caricatures.editor.multiGridCurrent.grid)
{

var multiGridHeight=vp.ui.getHeight(vp.caricatures.editor.multiGridCurrent.grid);

var multiGridTabHeight=20;

if(multiGridTab!==null)
{
multiGridTabHeight=vp.ui.getHeight(multiGridTab);
}
vp.ui.setHeight(currentPreviewContainer,multiGridHeight+multiGridTabHeight);

newCurCaricatureHeight=vp.ui.getHeight(currentPreviewContainer);
if(newCurCaricatureHeight>multiGridHeight+multiGridTabHeight)
{



vp.ui.setHeight(vp.caricatures.editor.multiGridCurrent.grid,newCurCaricatureHeight-multiGridTabHeight);
}
}
}
else
{



previewPermutationGrid=vp.ui.get('preview-grid-container-inner');
if(previewPermutationGrid)
{
var previewsGridHeight=vp.ui.getHeight(previewPermutationGrid);
vp.ui.setHeight(currentPreviewContainer,previewsGridHeight+CONSTANT_PREVIEW_OUTER_CONTAINER_HEIGHT);
newCurCaricatureHeight=vp.ui.getHeight(currentPreviewContainer);
if(newCurCaricatureHeight>(previewsGridHeight+CONSTANT_PREVIEW_OUTER_CONTAINER_HEIGHT))
{
vp.ui.setHeight(previewPermutationGrid,(newCurCaricatureHeight-CONSTANT_PREVIEW_OUTER_CONTAINER_HEIGHT));
}
}
}
}
};



vp.caricatures.editor.UpdateRemoveAddOnJS=function $vpfn_T7J3zJ3DwaEIWBfh4vtV6Q765$44(hiddenInputId)
{if(!window.__noTrace){__td[__ti]=arguments;__ti=__ti>=__MT?0:__ti+1;}
var hiddenInput=vp.ui.get(hiddenInputId);
if(hiddenInput)
{
var jsString=hiddenInput.value;
var divRemoveAddonLink=vp.ui.get('AddonRemovalLink');
if(divRemoveAddonLink!==null)
{
var linkHtml=divRemoveAddonLink.innerHTML;
var onclickPos=linkHtml.indexOf('onclick');
var onclickBegin=linkHtml.indexOf('"',onclickPos);
var onclickFinish=linkHtml.indexOf('"',onclickBegin+1);
divRemoveAddonLink.innerHTML=linkHtml.substr(0,onclickBegin+1)+
jsString+linkHtml.substr(onclickFinish,linkHtml.length-onclickFinish);

}
}
};

vp.caricatures.editor.UpdateRemoveAddonName=function $vpfn_SdQ6Wmr5S6U3dZpUY3PGeg785$46()
{if(!window.__noTrace){__td[__ti]=arguments;__ti=__ti>=__MT?0:__ti+1;}
var activeTab=vp.caricatures.editor.multiGridCurrent.tab;
if(!activeTab)
{


return;
}


var divRemoveAddonLink=vp.ui.get('AddonRemovalLink');
if(divRemoveAddonLink!==null)
{
var RemoveAddonElements=divRemoveAddonLink.getElementsByTagName('a');
if(RemoveAddonElements!==null&&RemoveAddonElements.length>0)
{
var aRemoveAddonLink=RemoveAddonElements[0];

var wordRemove=null;
if(document.all)
{

wordRemove=aRemoveAddonLink.innerText.slice(0,aRemoveAddonLink.innerText.indexOf(' '));
aRemoveAddonLink.innerText=wordRemove+' '+activeTab.innerText;
}
else
{
wordRemove=aRemoveAddonLink.textContent.slice(0,aRemoveAddonLink.textContent.indexOf(' '));
aRemoveAddonLink.textContent=wordRemove+' '+activeTab.textContent;
}

}

}
};




vp.caricatures.editor.ReviewPageFormSubmit=function $vpfn_VYQ6prQi7pxViBPOT12_2g825$45(formId1,formValue1,formId2,formValue2){if(!window.__noTrace){__td[__ti]=arguments;__ti=__ti>=__MT?0:__ti+1;}
if(formId1&&formValue1){
document.getElementById(formId1).value=formValue1;

if(formId2&&formValue2){
document.getElementById(formId2).value=formValue2;
VS_logEvent(formId2,formValue2);
}

var formElement=document.getElementById(formId1).form;
vp.caricatures.editor.RemoveRedirectTag(formElement);
formElement.submit();
VS_logEvent(formId1,formValue1);
}
};

vp.caricatures.editor.RemoveRedirectTag=function $vpfn_mHPzPO$q15h3KC8HsIjQiQ841$42(formElement){if(!window.__noTrace){__td[__ti]=arguments;__ti=__ti>=__MT?0:__ti+1;}

var redirectIndex=formElement.action.indexOf('&rd=');
if(redirectIndex>-1)
{
formElement.action=formElement.action.substring(0,redirectIndex);
}
};

vp.caricatures.editor.subtabFlow={};

vp.caricatures.editor.stepMultiGridTab=function $vpfn_eBK$xgb1DCY_nhaRPrYUaQ852$41(currentTab)
{if(!window.__noTrace){__td[__ti]=arguments;__ti=__ti>=__MT?0:__ti+1;}
if(currentTab!==null&&vp.caricatures.editor.subtabFlow[currentTab.id])
{
eval(vp.caricatures.editor.subtabFlow[currentTab.id]);
}
else
{
eval(vp.caricatures.editor.subtabFlow['Last']);
}
};


vp.caricatures.editor.animationPlaying=false;
vp.caricatures.editor.PlayAnimatedCaricatureClicked=function $vpfn_MZI$2hLSgnz_X28vDbljng866$54(pvParamId,containerId,dropDownIds)
{if(!window.__noTrace){__td[__ti]=arguments;__ti=__ti>=__MT?0:__ti+1;}

var stopLink=vp.ui.get('stopButton');
var playLink=vp.ui.get('playButton');
var pvParam=vp.ui.get(pvParamId);
var container=vp.ui.get(containerId);
if(playLink&&stopLink)
{
if(!vp.caricatures.editor.animationPlaying)
{
vp.ui.expandAndCollapse(stopLink,playLink);
vp.caricatures.editor.animationPlaying=!vp.caricatures.editor.animationPlaying;
if(pvParam)
{
var updatedSrc=pvParam.value;
updatedSrc+="&full=1";
var newHTML=vp.caricatures.editor.GetNewFlashObjectHTML(updatedSrc);
container.innerHTML=newHTML;
vp.caricatures.editor.ToggleDropDown(dropDownIds,true);
}
}
else
{
vp.ui.expandAndCollapse(playLink,stopLink);
vp.caricatures.editor.animationPlaying=!vp.caricatures.editor.animationPlaying;
if(pvParam)
{
var updatedSrcStop=pvParam.value;
var targetIndex=updatedSrcStop.indexOf('full');
if(targetIndex>0)
{
updatedSrcStop=updatedSrcStop.substr(0,targetIndex-1);
}
var newHTMLStop=vp.caricatures.editor.GetNewFlashObjectHTML(updatedSrcStop);
container.innerHTML=newHTMLStop;
vp.caricatures.editor.ToggleDropDown(dropDownIds,false);
}
}
}
};

vp.caricatures.editor.ToggleDropDown=function $vpfn_iwAr_MBGHBnZwlG93PqNBg908$39(dropDownIds,value)
{if(!window.__noTrace){__td[__ti]=arguments;__ti=__ti>=__MT?0:__ti+1;}
for(var i=0;i<dropDownIds.length;i++)
{
var dropDown=vp.ui.get(dropDownIds[i]);
if(dropDown.disable!==null)
{
dropDown.disable=value;
}
if(dropDown.disabled!==null)
{
dropDown.disabled=value;
}
}
};


vp.caricatures.editor.updateColor=function $vpfn_q6QLvkLktHfLOHndYljItg925$36(colorToSet,messageId,colorSelectedId)
{if(!window.__noTrace){__td[__ti]=arguments;__ti=__ti>=__MT?0:__ti+1;}
var messageContainer=vp.ui.get(messageId);
var colorSelectedInput=vp.ui.get(colorSelectedId);
if(messageContainer)
{
messageContainer.style.color=colorToSet;
}
if(colorSelectedInput)
{
colorSelectedInput.value=colorToSet;
}
};

vp.caricatures.editor.updateMessage=function $vpfn_jr44Y9MWsZ3NSKzZsoNmzQ939$38(messageId,messageInputBoxId)
{if(!window.__noTrace){__td[__ti]=arguments;__ti=__ti>=__MT?0:__ti+1;}
var me=this;
var _messageContainer=vp.ui.get(messageId);
var _messageInput=vp.ui.get(messageInputBoxId);

var KEYDOWN_TIMER_INTERVAL=50;

var _iKeyTimer=null;

var ondelaychange=function $vpfn_tAaEciBj4Egmnm2MkZsRdA949$24(e)
{if(!window.__noTrace){__td[__ti]=arguments;__ti=__ti>=__MT?0:__ti+1;}
var messageText='';
if(_messageInput)
{
messageText=vp.web.htmlDecode(_messageInput.value);
}
if(_messageContainer)
{
_messageContainer.innerHTML=vp.web.htmlEncode(messageText);
}
};




this.startUpdateTimer=function $vpfn_gtPAPxCGOaiHllXlh68I9Q965$28()
{if(!window.__noTrace){__td[__ti]=arguments;__ti=__ti>=__MT?0:__ti+1;}
if(_iKeyTimer)
{
window.clearTimeout(_iKeyTimer);
}

_iKeyTimer=window.setTimeout(ondelaychange,KEYDOWN_TIMER_INTERVAL);
};

vp.events.add(_messageInput,"keydown",me.startUpdateTimer);
vp.events.add(_messageInput,"keydown",me.startUpdateTimer);

};


vp.caricatures.editor.encryptMessage=function $vpfn_7KBIDfDjPRVWh8XFijMmtw981$39(messageId,encryptContainerId)
{if(!window.__noTrace){__td[__ti]=arguments;__ti=__ti>=__MT?0:__ti+1;}
var messageDiv=vp.ui.get(messageId);
var messageRaw='';
if(messageDiv)
{
messageRaw=messageDiv.innerHTML;
}
var encryptMessageInput=vp.ui.get(encryptContainerId);
if(encryptMessageInput)
{

encryptMessageInput.innerHTML=encryptMessage(messageRaw);
alert(decryptMessage(encryptMessageInput.innerHTML));
}

};


vp.caricatures.editor.ECardPageData='';

vp.caricatures.editor.comboUpdated=function $vpfn_c$3FG$41FZALYd4uXUwzjA1002$37(comboBoxId,containerId,previewParamId,qsName)
{if(!window.__noTrace){__td[__ti]=arguments;__ti=__ti>=__MT?0:__ti+1;}
var me=this;
var _comboBox=vp.ui.get(comboBoxId);
var _previewParam=vp.ui.get(previewParamId);
var _queryStringName=qsName;
var _container=vp.ui.get(containerId);

this.comboBoxChanged=function $vpfn_CRNvtzHtB875xMYr6eEKwQ1010$27(e)
{if(!window.__noTrace){__td[__ti]=arguments;__ti=__ti>=__MT?0:__ti+1;}
var comboValue;
if(_comboBox)
{
comboValue=_comboBox.value;
}
if(_previewParam)
{
var oldSrc=_previewParam.value.substr(0,_previewParam.value.indexOf('?')+1)+
vp.caricatures.editor.ECardPageData;
var qsPosition=oldSrc.indexOf(_queryStringName);
var qsEndPosition=oldSrc.indexOf('&',qsPosition);
if(qsEndPosition<0)
{
qsEndPosition=oldSrc.length;
}
var firstPart=oldSrc.substr(0,qsPosition);
var secondPart=qsName+'='+comboValue;
var thirdPart=oldSrc.substr(qsEndPosition);
var newSrc=firstPart+secondPart+thirdPart;
vp.caricatures.editor.ECardPageData=newSrc.substr(newSrc.indexOf('?')+1);
if(vp.caricatures.editor.animationPlaying&&newSrc.indexOf('full')<0)
{
newSrc=newSrc+'&full=1';
}


_container.innerHTML=vp.caricatures.editor.GetNewFlashObjectHTML(newSrc);
}
};

vp.events.add(_comboBox,"change",me.comboBoxChanged);

};

vp.caricatures.editor.GetNewFlashObjectHTML=function $vpfn_pSI8jif$snFHvkvUvAq3xA1046$46(newSrc)
{if(!window.__noTrace){__td[__ti]=arguments;__ti=__ti>=__MT?0:__ti+1;}
var newHTML='<object id=\"previewObject\" height=\"300\"  width=\"629\" type=\"application/x-shockwave-flash\" classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\">'+
'<param id=\"previewParam\" value=\"'+newSrc+'\" name=\"movie\"/>'+'<param value=\"opaque\" name=\"wmode\"/>'+
'<embed id=\"previewEmbed\" height=\"300\" width=\"629\" type=\"application/x-shockwave-flash\" name=\"movie\" quality=\"height\" src=\"'+newSrc+'\" wmode=\"opaque"/>'+
'</object>';
return newHTML;
};

vp.caricatures.editor.maximuMessageLength=100;

vp.caricatures.editor.GetECardPageData=function $vpfn_ehHV_MiRoEGVO$TTTuYzkA1057$41()
{if(!window.__noTrace){__td[__ti]=arguments;__ti=__ti>=__MT?0:__ti+1;}
var messageContainer=vp.ui.get('messages');
var retString=vp.caricatures.editor.ECardPageData;
if(messageContainer)
{
var messageCorrectLength=messageContainer.innerHTML;

if(messageCorrectLength.length>vp.caricatures.editor.maximuMessageLength)
{
messageCorrectLength=
messageCorrectLength.substring(0,vp.caricatures.editor.maximuMessageLength);
}

retString+='&MessageText='+vp.web.urlEncode(messageCorrectLength);
var colorString=messageContainer.style.color;
if(colorString==='')
{
colorString='rgb(0, 0, 0)';
}
retString+='&color='+colorString;
}
return retString;
};

vp.caricatures.editor.emailSuccess=function $vpfn_uSjKD2BptXAf$xmkLPTvfg1082$37(xmlResults){if(!window.__noTrace){__td[__ti]=arguments;__ti=__ti>=__MT?0:__ti+1;}

var results=eval('('+xmlResults+')');

var swr='';
if(results.error){

swr='&swr=1';
}


document.location='ecard.aspx?cnfmshow=1&alt_group_id='+document.getElementById('iptGroupId').getAttribute('value')+'&emailUrl='+results.emailUrl+'&shareUrl='+results.shareUrl+'&swfUrl='+results.swfUrl+swr;
};

vp.caricatures.editor.emailError=function $vpfn_J2JWZmbH2JFb2inPwQFnZw1096$35(xmlResults){if(!window.__noTrace){__td[__ti]=arguments;__ti=__ti>=__MT?0:__ti+1;}
alert('failure : '+xmlResults);
};






vp.caricatures.editor.showEcardWarning=function $vpfn_4Sl3GCDhUhhi4sxdhxowgg1105$41(sDialogName,sDialogTitle,sDialogNodeId,iDialogWidth,iDialogHeight,sSendButtonId,sEmailButtonId)
{if(!window.__noTrace){__td[__ti]=arguments;__ti=__ti>=__MT?0:__ti+1;}
var oDialog=
vp.dialog.NodeDialog.open(
sDialogName,
sDialogTitle,
sDialogNodeId,
vp.dialog.chrome.Primary,
iDialogWidth,
iDialogHeight);

vp.events.add(sSendButtonId,'click',oDialog.close);
};

vp.caricatures.editor.ECardConfirmAddMessage=function $vpfn_ubcwGvHLO6630mAvClKKcQ1119$47(urlElemId,messageDivId)
{if(!window.__noTrace){__td[__ti]=arguments;__ti=__ti>=__MT?0:__ti+1;}
var messageDiv=vp.ui.get(messageDivId);
var linkElem=vp.ui.get(urlElemId);
if(linkElem)
{
var oUrl=new vp.web.URL(linkElem.href);
var sView=oUrl.getItem("view");

sView=decryptMessage(sView);
var aView=sView.split(/[|]/g);

if(messageDiv&&aView[3])
{
messageDiv.innerHTML=aView[3];
messageDiv.style.color=aView[2];
}
}
};

vp.caricatures.editor.setDefaultSubjectIfEmpty=function $vpfn_b6zuDv4nM_rdHucpr2xnmA1139$49(sNameFieldId,sSubjectFieldId,sDefaultSubject)
{if(!window.__noTrace){__td[__ti]=arguments;__ti=__ti>=__MT?0:__ti+1;}
vp.events.add(
sNameFieldId,
'blur',
function $vpfn_K_XbIA5m9CqHDT8xFwcHtA1144$8()
{if(!window.__noTrace){__td[__ti]=arguments;__ti=__ti>=__MT?0:__ti+1;}
var sCurrentSubject=vp.forms.getValue(sSubjectFieldId);
var sCurrentName=vp.forms.getValue(sNameFieldId);

if(sCurrentName&&!sCurrentSubject)
{
var sNewSubject=sDefaultSubject.replace("{0}",sCurrentName);
vp.forms.setValue(sSubjectFieldId,sNewSubject);
}
}
);
};

vp.caricatures.editor.addMessageValidator=function $vpfn_80KiSVxieFfj8wPuhLLQ0w1158$44(sTextareaId)
{if(!window.__noTrace){__td[__ti]=arguments;__ti=__ti>=__MT?0:__ti+1;}
vp.events.add(
sTextareaId,
"blur",
function $vpfn_K_XbIA5m9CqHDT8xFwcHtA1163$8()
{if(!window.__noTrace){__td[__ti]=arguments;__ti=__ti>=__MT?0:__ti+1;}
vp.caricatures.editor.validateEcardMessage(sTextareaId);
}
);
};

vp.caricatures.editor.validateEcardMessage=function $vpfn_Ntdrt5$ZzB5F9ZkDBE7tsQ1170$45(sTextareaId)
{if(!window.__noTrace){__td[__ti]=arguments;__ti=__ti>=__MT?0:__ti+1;}
var currentMessage=vp.forms.getValue(sTextareaId);

if(currentMessage.length>vp.caricatures.editor.maximuMessageLength)
{
alert("Your message exceeds the maximum "+
vp.caricatures.editor.maximuMessageLength+
" characters.");

vp.forms.setValue(
sTextareaId,
currentMessage.substring(0,vp.caricatures.editor.maximuMessageLength));

var oTextarea=vp.ui.get(sTextareaId);

vp.events.fireEvent(oTextarea,"keydown");
}
};

vp.caricatures.editor.executeCallback=function $vpfn_zjDADtn5xfDA9NXj51QBEA1190$40()
{if(!window.__noTrace){__td[__ti]=arguments;__ti=__ti>=__MT?0:__ti+1;}
var sCallbackUrl=vp.web.getQueryString("callback");
if(sCallbackUrl&&sCallbackUrl.length>0)
{
var oIframe=document.createElement("iframe");
oIframe.style.visibility="hidden";

var oUrl=new vp.web.URL(sCallbackUrl);
oUrl.setItem("ts",new Date().valueOf());
oUrl.setItem("alt_group_id",vp.ui.get("iptGroupId").value);

oIframe.src=oUrl.toString();
document.body.appendChild(oIframe);
}
};