function DoCustomizeCurrentStyle(theLook, theSchemeDir, theScheme, theCustomScheme, customizeURL, cancelURL, isEditPage, submitForm)
{
var action = "CopyAppObject(Name=" + theCustomScheme + "&Target=t3e1m4p15l9o2o6k)";
var redirectURL = customizeURL;
if (theLook == "textoverlay")
{
if (customizeURL.indexOf ("textoverlay") == -1)
{
var regex = new RegExp ("/looks/");
redirectURL = redirectURL.replace (regex,"/looks/textoverlay/");
}
}
redirectURL += ((customizeURL.indexOf("?") == -1) ? "?" : "&");
redirectURL += "name=";
redirectURL += (theCustomScheme == "") ? "" : "t3e1m4p15l9o2o6k&look=" + theCustomScheme + "&state=COPY";
if (cancelURL != "")
{
redirectURL += "&cancel=" + cancelURL;
}
if (theCustomScheme != "")
{
if (!submitForm)
{
nvoPreviewForm.NVORedirect.value = redirectURL;
nvoPreviewForm.NVOAction.value   = action;
nvoPreviewForm.submit ();
return;
}
submitForm.NVORedirect.value = redirectURL;
submitForm.NVOAction.value   = action;
submitForm.submit ();
return;
}
if (theCustomScheme == "")
{
if (theLook != "" && theSchemeDir != "" && theScheme != "")
{
var normalizedName = NormalizeObjectName("Custom Style");
var postNameTitle = PreparePostName("Custom Style");
action = "NewProfile(Name=" + Escape(normalizedName);
action += "&InitProfile=looks/" + theLook + "/" + theSchemeDir + "/" + theScheme + ".data)";
action += ";Save()";
action += ";UseProfile(Name=default)";
action += ";NewRecord(List=CustomSchemes)";
action += ";Set(.CustomSchemes.Title=" + postNameTitle + "&.CustomSchemes.Look=" + theLook + "&.CustomSchemes.SchemeDir=" + theSchemeDir + ")";
action += ";Set(.CustomSchemes.Version=" + "1" + ")";
action += ";ReplaceValueWithTemp(Name=.CustomSchemes.Name&Temp=objectname&value=*)";
action += ";ReplaceValueWithTemp(Name=NewObjectName&Temp=objectname&value=*)";
}
else
{
alert("The current style cannot be customized.\nPlease visit the Styles & Colors page.");
return;
}
if (isEditPage && document.nvoForm)
{
document.nvoForm.NVORedirect.value = redirectURL;
DoButton(action);
}
else if (submitForm)
{
submitForm.NVORedirect.value = redirectURL;
submitForm.NVOAction.value   = action;
submitForm.submit();
}
else
{
alert("The current style cannot be customized from this location.\nPlease visit the Styles & Colors page.");
}
}
}
