Array.prototype.compare = function(array, sorted) {
if (this.length != array.length) {
return false; 
}
if(sorted) {
this.sort();
array.sort();
}

for (var i = 0, loopCnt = array.length; i < loopCnt; i++) { 
if (this[i].compare) {
if (!this[i].compare(array[i])) {
return false;
}
}
if (this[i] !== array[i]) {
return false;
}
}
return true;
};

Array.prototype.contains = function(value, fnEquals) {
for (var arrayItem in this)
{
if (this[arrayItem].length == value.length)
{
return (typeof(fnEquals) != 'undefined') ? fnEquals(value, this[arrayItem]) : (value == this[arrayItem]);
}
}
return false;
};function GetDOMElement(elemId) {
if (document.all) {
return document.all[elemId];
}
else if (document.getElementById) {
return document.getElementById(elemId);
}
}

function $(elemId) {
return GetDOMElement(elemId);
}

function CopyTextToClipboard(str) {
if (window.clipboardData && window.clipboardData.setData) {
window.clipboardData.setData("Text", str);
}
}

function AttachUnloadHandler() {
if (IE4OrNewer) {
document.body.onbeforeunload = HandleUnload;
}
else {
window.onunload = HandleUnload;
}
}

function GetCheckedValue(elemObj) {
if (elemObj) {
if (elemObj.type == "radio" || elemObj.type == "hidden") {
return elemObj.value;
}
else {
for (var i = 0; i < elemObj.length; i++) {
if (elemObj[i].checked) {
return elemObj[i].value;
}
}
}
}
 return null;
}

function DOMInsertAdjacentHTML(elemObj, sWhere, sText) {
try {
if (IE4OrNewer && !Opera) {
elemObj.insertAdjacentHTML(sWhere, sText);
}
else if (NS6OrNewer) {
var newRange = document.createRange();
newRange.setStartBefore(elemObj);
var newNode = newRange.createContextualFragment(sText);
if (sWhere == 'beforeBegin') {
elemObj.parentNode.insertBefore(newNode, elemObj);
}
else if (sWhere == 'afterBegin') {
elemObj.insertBefore(newNode, elemObj.firstChild);
}
else if (sWhere == 'beforeEnd') {
elemObj.appendChild(newNode);
}
else if (sWhere == 'afterEnd') {
if (elemObj.nextSibling) {
elemObj.parentNode.insertBefore(newNode,elemObj.nextSibling);
}
else {
elemObj.parentNode.appendChild(newNode);
}
}
}
}
catch (e) {
}
}

function AddPrefixToListItem(listItemID, isSelected, prefix, prefixBlank) {
if (typeof(prefix) == 'undefined') {
prefix = '<span class="attention" style="font-family:Courier New; font-size:12px;"><b>*</b></span>';
}
if (typeof(prefixBlank) == 'undefined') {
prefixBlank = prefix.replace('*', '&nbsp;');
}
DOMInsertAdjacentHTML($(listItemID), "beforeBegin", (isSelected) ? prefix : prefixBlank);
}

function Trim(theString, additionalCharacters, trimAllWhiteSpace, specificCharacters) {
if (theString == "") {
return theString;
}
var trimCharacters = " ";
if (additionalCharacters != null && additionalCharacters != "") {
trimCharacters += additionalCharacters;
}
if (trimAllWhiteSpace == true) {
trimCharacters += "\t\n\r\f\v";
}
if (specificCharacters != null && specificCharacters != "") {
trimCharacters = specificCharacters;
}
var newString = theString;
while (trimCharacters.indexOf(newString.substring(0, 1)) >= 0) {
newString = Right(newString, newString.length - 1);
}
while (trimCharacters.indexOf(newString.substring(newString.length - 1, newString.length)) >= 0) {
newString = Left(newString, newString.length - 1);
}
return newString;
}

function TrimSpace(str) {
return( (""+str).replace(/^\s*([\s\S]*\S+)\s*$|^\s*$/,'$1') );
}

function IsInList(strList, strItem, bolCaseSensitive) {
if (strList == "" || strItem == "") {
return false;
}
var tempList;
var tempItem;
if (bolCaseSensitive) {
tempList = strList;
tempItem = strItem;
} else {
tempList = strList.toLowerCase();
tempItem = strItem.toLowerCase();
}
var commaEndedList = "," + Trim(tempList) + ",";
var itemWithCommas = "," + Trim(tempItem) + ",";
var itemWithCommasAndSpace = ", " + Trim(tempItem) + ",";
var itemWithCommasFound = commaEndedList.indexOf(itemWithCommas) >= 0;
var itemWithCommasAndSpaceFound = commaEndedList.indexOf(itemWithCommasAndSpace) >= 0;
if (itemWithCommasFound || itemWithCommasAndSpaceFound) {
return true;
} else {
return false;
}
}

function StripNonNumeric(theString, additionalCharacters, allowNegatives){
var returnString, i, currentCharacter;
var validChars = "0123456789";
if (additionalCharacters != null) {
validChars += additionalCharacters;
}

returnString = "";
for (i = 0; i < theString.length; i++) {
currentCharacter = theString.charAt(i);
if (validChars.indexOf(currentCharacter) >= 0 || (allowNegatives && i == 0 && currentCharacter == "-")) {
returnString += currentCharacter;
}
}
return returnString;
}

function PreloadImages(imgArr, imgDir) {
if (imgArr.length > 0) {
var imgCacheArr = new Array();
for (var i = 0, loopCnt = imgArr.length; i < loopCnt; i++) {
imgCacheArr[i] = new Image();
imgCacheArr[i].src = ((imgDir) ? imgDir + '/' : '') + imgArr[i];
}
}
}

function FormatNum(num, decimalPlaces, appendZeros, insertCommas) {
var powerOfTen = Math.pow(10, decimalPlaces);
num = Math.round(num * powerOfTen) / powerOfTen;
if (!appendZeros && !insertCommas) {
return num;
}
else {
var stringNum = num.toString();
var posDecimal = stringNum.indexOf(".");
 if (appendZeros) {
 var zeroToAppendCnt = 0;
 if (posDecimal < 0) {
 stringNum += ".";
 zeroToAppendCnt = decimalPlaces;
 }
 else {
 zeroToAppendCnt = decimalPlaces - (stringNum.length - posDecimal - 1);
 }
 for (var i = 0; i < zeroToAppendCnt; i++) {
 stringNum += "0";
 }
}
if (insertCommas && (Math.abs(num) >= 1000)) {
var i = stringNum.indexOf(".");
if (i < 0) {
i = stringNum.length;
}
i -= 3;
while (i >= 1) {
stringNum = stringNum.substring(0, i) + ',' + stringNum.substring(i, stringNum.length);
i -= 3;
}
}
return stringNum;
}
}

function FormatPrice(num, precision) {
 if (precision == null || precision == 'undefined') {
 precision = 2;
 }
 return '$' + FormatNum(num, precision, true, true);
}

function FormatDollar(num) {
return parseFloat(FormatNum(num, 2));
}

function ConvertCentsToDollars(num) {
return Math.round(num) / 100;
}

function SetRadioButtonListDisabled(rblName, isDisabled, selIdx) {
var coll = document.getElementsByName(rblName);
for (var i = 0, loopCnt = coll.length; i < loopCnt; i++) {
SetRadioButtonDisabled(coll[i], isDisabled, i);
if (isDisabled && typeof(selIdx) != 'undefined' && i == selIdx) {
coll[i].checked = true;
}
}
}

function SetRadioButtonDisabled(rbElem, isDisabled, rbIndex) {
rbElem.disabled = isDisabled;
var parentElem = rbElem.parentNode;
parentElem.disabled = isDisabled;
if (typeof(rbIndex) == 'undefined' || rbIndex == 0) {
parentElem = parentElem.parentNode;
var parentElemTagName = parentElem.tagName.toLowerCase();
if (parentElemTagName == 'span') {
parentElem.disabled = isDisabled;
}
else if (parentElemTagName == 'td') {
parentElem.parentNode.parentNode.parentNode.disabled = isDisabled;
}
}
}

function SetRadioButtonListChecked(rblName, rblVal) {
var coll = document.getElementsByName(rblName);
if (coll) {
for (var i = 0, loopCnt = coll.length; i < loopCnt; i++) {
coll[i].checked = (coll[i].value == rblVal);
}
}
}

function SetValue(name, setValue) {
 var elem = $(name);
 if (elem) {
 elem.value = setValue;
 }
}

function Left(theString, intLength) {
return theString.substring(0, intLength);
}

function Right(theString, intLength) {
return theString.substring(theString.length - intLength, theString.length);
}

function ReplaceSubstring(wholeString, substringToFind, replacementString) {
// This function is case sensitive
var tempArray = wholeString.split(substringToFind);
return tempArray.join(replacementString);
}

function ParseInt(num) {
return (num) ? parseInt(num) : num;
}

// window.open helper
function windowOpenHelper(sURL, sName, sFeatures, bReplace) {
var hWnd = window.open(sURL, sName, sFeatures, bReplace);
hWnd.focus();// if a window was already open this will bring it to the top
}

//convert string to boolean
function parseBool(value) {
return (value == 'true');
}

//get radio checked value by Name not ID
function GetRadioCheckedValueByName(rblName) {
 var inkElem = document.getElementsByName(rblName); //use name not id
 var ink = "";
 if (typeof (inkElem) != 'undefined' && inkElem.length > 0) {
 for (var i = 0; i < inkElem.length; i++) {
 if (inkElem[i].checked) {
 return inkElem[i].value;
 }
 }
 }
 return ink;
}

//This function is used to check if email address is valid
function ChkEmail(theAddress) 
{
 var checkOK = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_.@";
 var checkStr = TrimSpace(theAddress);
 var allValid = true;
 
 for (i = 0; i < checkStr.length; i++)
 {
 ch = checkStr.charAt(i);
 for (j = 0; j < checkOK.length; j++){
 if (ch == checkOK.charAt(j)) {
 break;
}
 }
 if (j == checkOK.length)
 {
 allValid = false;
 break;
 }
 }
if (theAddress == "")
{alert("Email is a required field!");
return false;
}

if (theAddress.indexOf("@") == -1) 
{alert("Sorry, the email address you entered does not contain an '@' symbol.");
return false;
}

if (theAddress.indexOf(".") == -1) 
{alert("Sorry, the email address you entered does not contain a '.' symbol.");
return false;
}

if (theAddress.indexOf("@.") != -1) 
{
alert("Sorry, the email address you entered is missing a valid character after the '@' sign and before the first period.");
return false;
}

if (theAddress.indexOf("@") == 0) 
{
alert("Sorry, the email address you entered is missing a valid character before the '@' sign.");
return false;
}
if (!allValid)
{
alert("Sorry, the email address you entered contains invalid characters.");
return false;
}
else
{ 
return true;
} 
}

function TrimSpace(str) {
return( (""+str).replace(/^\s*([\s\S]*\S+)\s*$|^\s*$/,'$1') );
}
// Add event handler
function AddEventHandler(obj, eventName, functionNotify) {
if (obj.attachEvent) {
obj.attachEvent('on' + eventName, functionNotify);
}
else if (obj.addEventListener) {
obj.addEventListener(eventName, functionNotify, true);
}
}

// Return the Unicode key code associated with the key that caused the event
function GetEventKeyCode(evnt) {
return evnt.keyCode ? evnt.keyCode : evnt.charCode ? evnt.charCode : evnt.which ? evnt.which : void 0;
}
// Validate max char length in a given string
function ValidateMaxLength(evnt, str, maxLength) {
var evntKeyCode = GetEventKeyCode(evnt);
// Ignore keys such as Delete, Backspace, Shift, Ctrl, Alt, Insert, Delete, Home, End, Page Up, Page Down and arrow keys
 var escChars = ",8,17,18,19,33,34,35,36,37,38,39,40,45,46,";
if (escChars.indexOf(',' + evntKeyCode + ',') == -1) {
 if (str.length >= maxLength) {
 alert("You cannot enter more than " + maxLength + " characters.");
 return false;
 }
 }
 return true;
}
var ValidateFunctionArray = new Array();
var USStateList = "AL,AK,AZ,AR,CA,CO,CT,DE,DC,FL,GA,HI,ID,IL,IN,IA,KS,KY,LA,ME,MD,MA,MI,MN,MS,MO,MT,NE,NV,NH,NJ,NM,NY,NC,ND,OH,OK,OR,PA,RI,SC,SD,TN,TX,UT,VT,VA,WA,WV,WI,WY";
var CanadaProvinceList = "AB,BC,MB,NB,NF,NT,NS,ON,PE,QC,SK,YT";

function ValidateFunctions() {
for (var i = 0, loopCnt = ValidateFunctionArray.length; i < loopCnt; i++) {
if (!(ValidateFunctionArray[i])()) {
return false;
}
}
return true;
}

function IsFilled(fieldID, alertMsg, doNotFocus) {
var fieldElem = $(fieldID);
if (fieldElem && TrimSpace(fieldElem.value) == "") {
if (alertMsg != "") {
alert(alertMsg);
}
if (!fieldElem.disabled && fieldElem.style.display != 'none' && !doNotFocus) {
fieldElem.focus();
}
return false;
}
return true;
}

function IsSelected(fieldID, alertMsg, doNotFocus) {
var fieldElem = $(fieldID);
if (fieldElem && fieldElem.options[fieldElem.selectedIndex].value == "") {
if (alertMsg != "") {
alert(alertMsg);
}
if (!fieldElem.disabled && fieldElem.style.display != 'none' && !doNotFocus) {
fieldElem.focus();
}
return false;
}
return true;
}

function IsRadioChecked(fieldID, alertMsg) {
var fieldList = document.getElementsByName(fieldID);
if (fieldList && fieldList.length > 0) {
for (var i=0;i<fieldList.length;i++){
if (fieldList[i].checked) {
return true;
}
}
if (alertMsg != "") {
alert(alertMsg);
}
return false;
}
return true;
}

function IsRightLength(fieldID, maxLen, alertMsg) {
var fieldElem = $(fieldID);
if (fieldElem && fieldElem.value.length >= maxLen) {
if (alertMsg != "") {
alert(alertMsg);
}
if (!fieldElem.disabled && fieldElem.style.display != 'none') {
fieldElem.focus();
}
return false;
}
return true;
}

function IsValidEmail(fieldID) {
var fieldElem = $(fieldID);
if (fieldElem && !ChkEmail(fieldElem.value)) {
if (!fieldElem.disabled && fieldElem.style.display != 'none') {
fieldElem.focus();
}
return false;
}
return true;
}

function IsValidZipCode(stateFieldID, zipFieldID, alertMsg) {
var stateFieldElem = $(stateFieldID);
var zipFieldElem = $(zipFieldID);
if (stateFieldElem && zipFieldElem) {
var stateValue = stateFieldElem.options[stateFieldElem.selectedIndex].value;
if (IsInList(USStateList, stateValue, false)) {
pattern = "\\d{5}";
}
else if (IsInList(CanadaProvinceList, stateValue, false)) {
pattern = "[A-Z|a-z]\\d[A-Z|a-z]\\d[A-Z|a-z]\\d";
} 
else {
return true;
}
var re = new RegExp(pattern, 'g');
var ZipValue = TrimSpace(zipFieldElem.value);
ZipValue = ZipValue.replace(' ','').replace('-','');
var r = ZipValue.match(re);
if (r != ZipValue) {
if (alertMsg != "") {
alert(alertMsg);
}
if (!zipFieldElem.disabled && zipFieldElem.style.display != 'none') {
 zipFieldElem.focus();
}
return false;
}
}
return true;
}

function IsValidNumber(fieldID, alertMsg, additionalChars) {
var fieldElem = $(fieldID);
if (fieldElem && Trim(fieldElem.value) != StripNonNumeric(fieldElem.value, additionalChars)) {
if (alertMsg != "") {
alert(alertMsg);
}
if (!fieldElem.disabled && fieldElem.style.display != 'none') {
fieldElem.focus();
}
return false;
}
return true;
}

function IsVisible(fieldID, alertMsg) {
var fieldElem = $(fieldID);
if (!fieldElem) {
if (alertMsg != "") {
alert(alertMsg);
}
return false;
}
return true;
}

function IsValidExpDate(monthFieldID, yearFieldID, alertMsg, curMonth, curYear) {
var monthFieldElem = $(monthFieldID);
var yearFieldElem = $(yearFieldID);
if (monthFieldElem && yearFieldElem && (monthFieldElem.value*1) + 12 * (yearFieldElem.value*1) < curMonth + 12 * curYear) {
if (alertMsg != "") {
alert(alertMsg);
}
if (!yearFieldElem.disabled && yearFieldElem.style.display != 'none') {
yearFieldElem.focus();
}
return false;
}
return true;
}

function ValidateRequest(formName) {
var BadChars = false;
if (formName) {
var formElem = document.forms[formName];
if (formElem) {
var formField, tagNameLower, formFieldType, formFieldVal;
for (var i = 0, loopCnt = formElem.elements.length; i < loopCnt; i++) {
formField = formElem.elements[i];
tagNameLower = formField.tagName.toLowerCase();
formFieldType = formField.type;
if ((tagNameLower == 'input' && (formFieldType == 'text' || formFieldType == 'hidden')) || tagNameLower == 'textarea') {
formFieldVal = formField.value;
if (formFieldVal != '' && (formFieldVal.indexOf('<') != -1 || formFieldVal.indexOf('>') != -1)) {
BadChars = true;
formField.value = formFieldVal.replace(/</g, '&lt;').replace(/>/g, '&gt;');
}
}
}
}
}
//if ( BadChars )
//alert('< and > characters are not allowed in this page.');
return true;
}

function HackValidators(validationGroup) {
if (typeof(Page_ClientValidate) == 'function' && !Page_ClientValidate(validationGroup)) {
// Scroll the object so that top of the object is visible at the top of the window
if (typeof(Page_InvalidControlToBeFocused) != 'undefined') {
if (Page_InvalidControlToBeFocused && Page_InvalidControlToBeFocused.scrollIntoView) {
Page_InvalidControlToBeFocused.scrollIntoView(true);
}
else {
var imgColl = document.getElementsByTagName('img');
var imgElem;
for (var i = 0, loopCnt = imgColl.length; i < loopCnt; i++) {
imgElem = imgColl[i];
if (imgElem.src.indexOf('/CommonWeb/images/RedAsteriskArrow.gif') != -1 && imgElem.parentNode && imgElem.parentNode.style.display != 'none' && imgElem.scrollIntoView) {
imgElem.scrollIntoView(true);
break;
}
}
}
}
alert('Please fill in required fields.');
// NOTE: The following is a required, otherwise the buttons have to be clicked twice to submit
if (typeof(Page_BlockSubmit) != 'undefined') {
Page_BlockSubmit = false;
}
return false;
}
return true;
}
var AdjustTypeEnum = {
'AdditionalMarkupPercent':0,
'Aqueous':1,
'Conversion':2,
'Envelope':3,
'DieCut':4,
'DrillHole':5,
'Finishing':6,
'Fold':7,
'HardProof':8,
'Ink':9,
'Mailing':10,
'NumPages':11,
'Padding':12,
'Paper':13,
'Postage':14,
'Product':15,
'Quantity':16,
'RoundCorner':17,
'Seal':18,
'SecondSheet':19,
'Shipping':20,
'SpecialDiscount':21,
'Spot':22,
'Turnaround':23,
'UpgradeDiscount':24,
'VariableData':25
};
var AttributeIDEnum = {
'backing':57,
'band':15,
'binding':58,
'coating':8,
'collate':17,
'collateinsertinto':43,
'collateinsertpieces':52,
'collatestaple':44,
'conversion':59,
'cover':60,
'custom':45,
'deboss':18,
'diecut':19,
'drillholes':20,
'drillpages':46,
'emboss':21,
'envelopes':14,
'envwindowlocation':47,
'envwindowsize':22,
'foilstampsize':23,
'fold':11,
'foldcollatestaple':54,
'form':12,
'hardproof':40,
'height':2,
'imprint':55,
'imprintcolor':61,
'ink':3,
'insert':24,
'padglueedge':25,
'paper':6,
'perfnumber':26,
'pockets':27,
'remitflap':28,
'roundcorners':48,
'roundcornersize':29,
'score':31,
'scoringfold':32,
'seal':33,
'seconds':13,
'sheetsperunit':62,
'shrinkcount':49,
'shrinkpiecesperpack':34,
'slits':35,
'spirallength':50,
'spiralthickness':36,
'spot':56,
'staple':37,
'stitch':30,
'tab':38,
'washup':63,
'width':1,
'wirelength':51,
'wirethickness':39
};
var AttributePlacementEnum = {
'back':2,
'cover':3,
'envelope':5,
'front':1,
'inside':4
};
var AttributeValueIDEnum = {
'backing_chip_board':'392',
'backing_manually_priced':'391',
'binding_glue':'394',
'binding_manually_priced':'395',
'binding_staple':'393',
'coating_gloss_aqueous':'307',
'coating_gloss_flood_varnish':'310',
'coating_gloss_spot_varnish':'350',
'coating_manually_priced':'312',
'coating_matte_aqueous':'308',
'coating_matte_flood_varnish':'311',
'coating_matte_spot_varnish':'349',
'collate_insert_separators':'396',
'collate_manually_priced':'325',
'collateinsertinto_6x9_booklet':'189',
'collateinsertinto_9x12_booklet':'190',
'collateinsertinto_a2_envelopes':'187',
'collateinsertinto_a6_envelopes':'188',
'collateinsertinto_lb10_envelopes':'186',
'collateinsertinto_manually_priced':'191',
'collateinsertpieces_announcement_envelope_1_piece':'196',
'collateinsertpieces_announcement_envelope_2_pieces':'291',
'collateinsertpieces_announcement_envelope_3_pieces':'292',
'collateinsertpieces_announcement_envelope_4_pieces':'293',
'collateinsertpieces_baronial_envelope_1_piece':'294',
'collateinsertpieces_baronial_envelope_2_pieces':'295',
'collateinsertpieces_baronial_envelope_3_pieces':'296',
'collateinsertpieces_baronial_envelope_4_pieces':'297',
'collateinsertpieces_commercial_envelope_1_piece':'192',
'collateinsertpieces_commercial_envelope_2_pieces':'193',
'collateinsertpieces_commercial_envelope_3_pieces':'194',
'collateinsertpieces_commercial_envelope_4_pieces':'195',
'collateinsertpieces_large_booklet_envelope_1_pieces':'302',
'collateinsertpieces_large_booklet_envelope_2_pieces':'303',
'collateinsertpieces_large_booklet_envelope_3_pieces':'304',
'collateinsertpieces_large_booklet_envelope_4_pieces':'305',
'collateinsertpieces_small_booklet_envelope_1_piece':'298',
'collateinsertpieces_small_booklet_envelope_2_pieces':'299',
'collateinsertpieces_small_booklet_envelope_3_pieces':'300',
'collateinsertpieces_small_booklet_envelope_4_pieces':'301',
'collatestaple_1':'197',
'collatestaple_2':'198',
'collatestaple_3':'199',
'collatestaple_4':'200',
'collatestaple_5':'201',
'collatestaple_6':'202',
'collatestaple_manually_priced':'203',
'conversion_brochure_holder':'397',
'conversion_rack_card_holder':'398',
'cover_cover_wrap':'399',
'cover_manually_priced':'400',
'deboss_large':'115',
'deboss_manually_priced':'117',
'deboss_medium':'114',
'deboss_small':'113',
'deboss_x_large':'116',
'deboss_x_small':'112',
'diecut_door_hanger_die_cut':'306',
'diecut_large':'121',
'diecut_manually_priced':'123',
'diecut_medium':'120',
'diecut_small':'119',
'diecut_x_large':'122',
'diecut_x_small':'118',
'drillholes_1_3':'124',
'drillholes_1_4_drill_hole':'370',
'drillholes_1_8_drill_hole':'324',
'drillholes_gt3':'125',
'drillholes_manually_priced':'371',
'drillpages_multi_page':'127',
'drillpages_single_page':'126',
'emboss_large':'131',
'emboss_manually_priced':'133',
'emboss_medium':'130',
'emboss_small':'129',
'emboss_x_large':'132',
'emboss_x_small':'128',
'envelopes_a10':'225',
'envelopes_a2':'220',
'envelopes_a6':'221',
'envelopes_a7':'222',
'envelopes_a8':'223',
'envelopes_a9':'224',
'envelopes_jumbo_11x17':'263',
'envelopes_jumbo_15x20':'264',
'envelopes_jumbo_16x20':'265',
'envelopes_jumbo_17x22':'266',
'envelopes_jumbo_22x27':'267',
'envelopes_lb1_1_2_catalog':'254',
'envelopes_lb1_catalog':'253',
'envelopes_lb10':'237',
'envelopes_lb10_1_2_catalog':'258',
'envelopes_lb10_booklet':'251',
'envelopes_lb11':'238',
'envelopes_lb12':'239',
'envelopes_lb12_1_2_catalog':'259',
'envelopes_lb13_1_2_catalog':'260',
'envelopes_lb13_booklet':'252',
'envelopes_lb14':'240',
'envelopes_lb14_1_2_catalog':'261',
'envelopes_lb15_catalog':'262',
'envelopes_lb3_booklet':'241',
'envelopes_lb3_catalog':'255',
'envelopes_lb4_baronial':'226',
'envelopes_lb5_5_baronial':'228',
'envelopes_lb5_baronial':'227',
'envelopes_lb5_booklet':'242',
'envelopes_lb6_1_2_booklet':'244',
'envelopes_lb6_1_4':'231',
'envelopes_lb6_3_4':'232',
'envelopes_lb6_3_4_booklet':'246',
'envelopes_lb6_5_8_booklet':'245',
'envelopes_lb6_baronial':'229',
'envelopes_lb6_booklet':'243',
'envelopes_lb6_catalog':'256',
'envelopes_lb7':'233',
'envelopes_lb7_1_2_booklet':'248',
'envelopes_lb7_1_4_booklet':'247',
'envelopes_lb7_3_4_monarch':'234',
'envelopes_lb8_5_8':'235',
'envelopes_lb9':'236',
'envelopes_lb9_1_2_booklet':'250',
'envelopes_lb9_3_4_catalog':'257',
'envelopes_lb9_booklet':'249',
'envelopes_lee':'230',
'envelopes_manually_priced':'362',
'envelopes_slimline':'219',
'envwindowlocation_custom':'137',
'envwindowlocation_standard':'136',
'envwindowsize_custom':'135',
'envwindowsize_standard':'134',
'foilstampsize_large':'141',
'foilstampsize_manually_priced':'143',
'foilstampsize_medium':'140',
'foilstampsize_small':'139',
'foilstampsize_x_large':'142',
'foilstampsize_x_small':'138',
'fold_accordion_fold':'97',
'fold_barrel_roll_fold':'98',
'fold_double_parallel_fold':'389',
'fold_four_panel_fold':'101',
'fold_gate_fold':'99',
'fold_half_fold':'103',
'fold_half_then_half':'104',
'fold_half_then_tri_fold':'105',
'fold_manually_priced':'111',
'fold_map_fold':'106',
'fold_open_gate_fold':'107',
'fold_quarter_fold':'108',
'fold_tri_fold':'109',
'fold_tri_then_half_fold':'317',
'fold_z_fold':'110',
'foldcollatestaple_fold_collate_stitch':'319',
'foldcollatestaple_manually_priced':'289',
'hardproof_hard_copy_mock_up':'274',
'imprint_large':'322',
'imprint_manually_priced':'373',
'imprint_medium':'321',
'imprint_numbering':'401',
'imprint_return_address_in_black':'320',
'imprintcolor_black':'402',
'imprintcolor_manually_priced':'404',
'imprintcolor_red':'403',
'ink_4_color':'83',
'ink_black':'85',
'ink_manually_priced':'87',
'insert_1_piece':'144',
'insert_2_pieces':'145',
'insert_3_pieces':'146',
'insert_manually_priced':'147',
'padglueedge_side':'149',
'padglueedge_top':'148',
'paper_10_pt_c1s_cover':'328',
'paper_10_pt_carolina_c1s_cover':'15',
'paper_10_pt_kromekote_c1s_cover':'64',
'paper_10_pt_kromekote_c2s_cover':'73',
'paper_10_pt_nordic_c1s_cover':'436',
'paper_100lb_centura_gloss_cover':'70',
'paper_100lb_centura_gloss_text':'32',
'paper_100lb_centura_silk_cover':'60',
'paper_100lb_centura_silk_text':'31',
'paper_100lb_classic_crest_cover':'78',
'paper_100lb_classic_crest_text':'57',
'paper_100lb_classic_linen_cover':'390',
'paper_100lb_cougar_cover':'54',
'paper_100lb_cougar_text':'26',
'paper_100lb_dull_matte_text':'22',
'paper_100lb_gloss_cover':'23',
'paper_100lb_gloss_text':'12',
'paper_100lb_lustro_dull_cover':'55',
'paper_100lb_lustro_dull_cream_cover':'56',
'paper_100lb_lustro_dull_cream_text':'30',
'paper_100lb_lustro_dull_text':'29',
'paper_100lb_mccoy_silk_text':'434',
'paper_100lb_nekoosa_linen_cover':'72',
'paper_100lb_solutions_cover':'351',
'paper_100lb_starwhite_cover':'385',
'paper_100lb_uncoated_cover':'42',
'paper_110lb_classic_crest_cover':'418',
'paper_110lb_classic_crest_text':'417',
'paper_12_pt_c1s':'332',
'paper_12_pt_c2s':'339',
'paper_12_pt_kromekote_c1s_cover':'68',
'paper_12_pt_kromekote_c2s_cover':'77',
'paper_12_pt_nordic_c1s_cover':'437',
'paper_120lb_centura_gloss_cover':'76',
'paper_120lb_centura_silk_cover':'66',
'paper_120lb_dull_matte_cover':'44',
'paper_120lb_gloss_cover':'43',
'paper_12pt_carolina_c1s_cover':'33',
'paper_13_oz_vinyl_banner':'279',
'paper_13_pt_magnet_stock':'82',
'paper_130lb_centura_gloss_cover':'386',
'paper_20lb_bond':'421',
'paper_24lb_bond':'419',
'paper_24lb_classic_columns_writing':'28',
'paper_24lb_classic_cotton_writing_25':'36',
'paper_24lb_classic_crest_writing':'27',
'paper_24lb_classic_laid':'424',
'paper_24lb_classic_linen_writing':'423',
'paper_24lb_strathmore_writing_25_cotton':'37',
'paper_24lb_uncoated':'277',
'paper_28lb_uncoated':'278',
'paper_32lb_laser':'420',
'paper_4_part_ncr':'388',
'paper_60lb_astrobrights_text':'435',
'paper_60lb_fasson_crack_n_peel_block_out_high_gloss_litho':'383',
'paper_60lb_galaxy_offset_text':'427',
'paper_60lb_mactac_labels':'286',
'paper_60lb_whitehall_text':'432',
'paper_70lb_classic_crest_text_':'387',
'paper_70lb_classic_linen_text':'426',
'paper_70lb_colorsource_text':'13',
'paper_70lb_domtar_colors_text':'428',
'paper_70lb_feltweave_text':'429',
'paper_70lb_nekoosa_linen_text':'430',
'paper_70lb_royal_fiber_text':'25',
'paper_70lb_skytone_text':'431',
'paper_70lb_uncoated_text':'10',
'paper_70lb_whitehall_text':'415',
'paper_75lb_classic_laid_text':'38',
'paper_8_pt_c1s_cover':'326',
'paper_80lb_astrobrights_cover':'53',
'paper_80lb_centura_gloss_cover':'49',
'paper_80lb_centura_gloss_text':'21',
'paper_80lb_centura_silk_cover':'48',
'paper_80lb_centura_silk_text':'20',
'paper_80lb_classic_columns_cover':'75',
'paper_80lb_classic_columns_text':'39',
'paper_80lb_classic_cotton_bristol':'81',
'paper_80lb_classic_crest_cover':'71',
'paper_80lb_classic_crest_text':'50',
'paper_80lb_classic_laid_cover':'69',
'paper_80lb_classic_linen_cover':'74',
'paper_80lb_classic_linen_cover_black':'425',
'paper_80lb_classic_linen_text':'52',
'paper_80lb_cougar_cover':'51',
'paper_80lb_cougar_text':'16',
'paper_80lb_dull_matte_cover':'14',
'paper_80lb_environment_cover':'58',
'paper_80lb_environment_text':'35',
'paper_80lb_evergreen_100_pc_cover':'65',
'paper_80lb_evergreen_100_pc_text':'40',
'paper_80lb_feltweave_cover':'61',
'paper_80lb_feltweave_text':'41',
'paper_80lb_gloss_cover':'17',
'paper_80lb_gloss_text':'9',
'paper_80lb_lustro_dull_cover':'46',
'paper_80lb_lustro_dull_cream_cover':'47',
'paper_80lb_lustro_dull_cream_text':'19',
'paper_80lb_lustro_dull_text':'18',
'paper_80lb_matte_text':'11',
'paper_80lb_mccoy_silk_text':'433',
'paper_80lb_nekoosa_linen_cover':'62',
'paper_80lb_nekoosa_linen_text':'24',
'paper_80lb_royal_fiber_cover':'63',
'paper_80lb_skytone_cover':'59',
'paper_80lb_skytone_text':'34',
'paper_80lb_starwhite_cover':'67',
'paper_80lb_starwhite_text':'45',
'paper_80lb_strathmore_cotton_bristol':'80',
'paper_80lb_uncoated_cover':'333',
'paper_cbsl_bcrd_001':'280',
'paper_cbsl_lh_e_001':'281',
'paper_cbsl_lthd_001':'282',
'paper_cbsl_prez_001':'283',
'paper_environment_80lb_text':'340',
'paper_foam_board':'352',
'paper_joy_red_p_gc_v':'353',
'paper_joy_red_p_nc_v':'354',
'paper_knightkote_matte_100lb_cover':'331',
'paper_lustro_dull_100lb_cover':'330',
'paper_lustro_dull_120lb_cover':'334',
'paper_lustro_dull_cream_100lb_cover':'335',
'paper_lustro_dull_cream_80lb_text':'338',
'paper_lustro_gloss_100lb_cover':'355',
'paper_lustro_gloss_120lb_cover':'329',
'paper_lustro_gloss_80lb_text':'342',
'paper_manually_priced':'348',
'paper_mounted_foamboard':'287',
'paper_ncr_2_part_form':'284',
'paper_ncr_3_part_form':'285',
'paper_nekoosa_70lb_text':'336',
'paper_ornaments_p_gc_h':'356',
'paper_ornaments_p_nc_h':'357',
'paper_peace_letter_blocks_p_gc_h':'358',
'paper_peace_letter_blocks_p_nc_h':'359',
'paper_seasons_greetings_p_gc_v':'360',
'paper_seasons_greetings_p_nc_v':'361',
'paper_topkote_dull_100lb_cover':'341',
'paper_topkote_dull_80lb_text':'337',
'perfnumber_manually_priced':'151',
'perfnumber_multi_page_perf':'323',
'perfnumber_perforation':'150',
'perfnumber_three_perfs':'422',
'pockets_1_pocket_on_left':'152',
'pockets_1_pocket_on_right':'153',
'pockets_2_pockets':'154',
'pockets_manually_priced':'155',
'remitflap_custom':'157',
'remitflap_standard':'156',
'roundcorners_1_corner':'162',
'roundcorners_2_corners':'161',
'roundcorners_all_four_corners':'160',
'roundcorners_manually_priced':'363',
'roundcornersize_1_4':'158',
'roundcornersize_1_8':'368',
'roundcornersize_3_8':'159',
'score_manually_priced':'372',
'score_standard':'318',
'scoringfold_score_for_folding':'290',
'seal_glue':'163',
'seal_manually_priced':'366',
'seal_peel_seel':'164',
'sheetsperunit_100':'407',
'sheetsperunit_25':'405',
'sheetsperunit_50':'406',
'sheetsperunit_manually_priced':'408',
'shrinkcount_approx':'168',
'shrinkcount_exact':'169',
'shrinkpiecesperpack_gt_25':'166',
'shrinkpiecesperpack_single_w_chipboard':'167',
'shrinkpiecesperpack_up_to_25':'165',
'slits_both_sides':'172',
'slits_left_side':'170',
'slits_manually_priced':'173',
'slits_right_side':'171',
'spirallength_long':'178',
'spirallength_short':'176',
'spirallength_standard':'177',
'spiralthickness_extra_thick':'175',
'spiralthickness_standard':'174',
'spot_manually_priced':'381',
'spot_spot_1':'343',
'spot_spot_2':'344',
'spot_spot_3':'345',
'spot_spot_4':'346',
'spot_spot_5':'347',
'staple_corner':'179',
'staple_custom':'180',
'staple_manually_priced':'369',
'tab_manually_priced':'365',
'tab_multi_tab':'182',
'tab_tab':'181',
'washup_manually_priced':'409',
'washup_wash_up_charge_1':'410',
'washup_wash_up_charge_2':'411',
'washup_wash_up_charge_3':'412',
'washup_wash_up_charge_4':'413',
'washup_wash_up_charge_5':'414',
'wirelength_long':'185',
'wirelength_manually_priced':'382',
'wirelength_short':'183',
'wirelength_standard':'184'
};
var AttributeValueNameEnum = {
391:'Manually Priced',// backing_manually_priced
392:'Chip Board',// backing_chip_board
393:'Staple',// binding_staple
394:'Glue',// binding_glue
395:'Manually Priced',// binding_manually_priced
307:'Gloss Aqueous',// coating_gloss_aqueous
308:'Matte Aqueous',// coating_matte_aqueous
310:'Gloss Flood Varnish',// coating_gloss_flood_varnish
311:'Matte Flood Varnish',// coating_matte_flood_varnish
312:'Manually Priced',// coating_manually_priced
349:'Matte Spot Varnish',// coating_matte_spot_varnish
350:'Gloss Spot Varnish',// coating_gloss_spot_varnish
325:'Manually Priced',// collate_manually_priced
396:'Insert Separators',// collate_insert_separators
186:'#10 Envelopes',// collateinsertinto_lb10_envelopes
187:'A2 Envelopes',// collateinsertinto_a2_envelopes
188:'A6 Envelopes',// collateinsertinto_a6_envelopes
189:'6 X 9 Booklet',// collateinsertinto_6x9_booklet
190:'9 X 12 Booklet',// collateinsertinto_9x12_booklet
191:'Manually Priced',// collateinsertinto_manually_priced
192:'Commercial envelope - 1 piece',// collateinsertpieces_commercial_envelope_1_piece
193:'Commercial envelope - 2 pieces',// collateinsertpieces_commercial_envelope_2_pieces
194:'Commercial envelope - 3 pieces',// collateinsertpieces_commercial_envelope_3_pieces
195:'Commercial envelope - 4 pieces',// collateinsertpieces_commercial_envelope_4_pieces
196:'Announcement envelope - 1 piece',// collateinsertpieces_announcement_envelope_1_piece
291:'Announcement envelope - 2 pieces',// collateinsertpieces_announcement_envelope_2_pieces
292:'Announcement envelope - 3 pieces',// collateinsertpieces_announcement_envelope_3_pieces
293:'Announcement envelope - 4 pieces',// collateinsertpieces_announcement_envelope_4_pieces
294:'Baronial envelope - 1 piece',// collateinsertpieces_baronial_envelope_1_piece
295:'Baronial envelope - 2 pieces',// collateinsertpieces_baronial_envelope_2_pieces
296:'Baronial envelope - 3 pieces',// collateinsertpieces_baronial_envelope_3_pieces
297:'Baronial envelope - 4 pieces',// collateinsertpieces_baronial_envelope_4_pieces
298:'Small booklet envelope - 1 piece',// collateinsertpieces_small_booklet_envelope_1_piece
299:'Small booklet envelope - 2 pieces',// collateinsertpieces_small_booklet_envelope_2_pieces
300:'Small booklet envelope - 3 pieces',// collateinsertpieces_small_booklet_envelope_3_pieces
301:'Small booklet envelope - 4 pieces',// collateinsertpieces_small_booklet_envelope_4_pieces
302:'Large booklet envelope - 1 pieces',// collateinsertpieces_large_booklet_envelope_1_pieces
303:'Large booklet envelope - 2 pieces',// collateinsertpieces_large_booklet_envelope_2_pieces
304:'Large booklet envelope - 3 pieces',// collateinsertpieces_large_booklet_envelope_3_pieces
305:'Large booklet envelope - 4 pieces',// collateinsertpieces_large_booklet_envelope_4_pieces
197:'1',// collatestaple_1
198:'2',// collatestaple_2
199:'3',// collatestaple_3
200:'4',// collatestaple_4
201:'5',// collatestaple_5
202:'6',// collatestaple_6
203:'Manually Priced',// collatestaple_manually_priced
397:'Brochure Holder',// conversion_brochure_holder
398:'Rack Card Holder',// conversion_rack_card_holder
399:'Cover Wrap',// cover_cover_wrap
400:'Manually Priced',// cover_manually_priced
112:'Deboss-extra small',// deboss_x_small
113:'Deboss-Small',// deboss_small
114:'Deboss-Medium',// deboss_medium
115:'Deboss-Large',// deboss_large
116:'Deboss-extra large',// deboss_x_large
117:'Manually Priced',// deboss_manually_priced
118:'Diecut-extra small',// diecut_x_small
119:'Diecut-Small',// diecut_small
120:'Diecut-Medium',// diecut_medium
121:'Diecut-Large',// diecut_large
122:'Diecut-extra large',// diecut_x_large
123:'Manually Priced',// diecut_manually_priced
306:'Door hanger die cut',// diecut_door_hanger_die_cut
124:'1-3',// drillholes_1_3
125:'>3',// drillholes_gt3
324:'1/8 drill hole',// drillholes_1_8_drill_hole
370:'1/4 drill hole',// drillholes_1_4_drill_hole
371:'Manually Priced',// drillholes_manually_priced
126:'Single page',// drillpages_single_page
127:'Multi page',// drillpages_multi_page
128:'Emboss - X-small',// emboss_x_small
129:'Emboss - Small ',// emboss_small
130:'Emboss - Medium',// emboss_medium
131:'Emboss - Large ',// emboss_large
132:'Emboss - X-large',// emboss_x_large
133:'Manually Priced Emboss',// emboss_manually_priced
219:'Slimline Envelopes',// envelopes_slimline
220:'A2 Envelopes',// envelopes_a2
221:'A6 Envelopes',// envelopes_a6
222:'A7 Envelopes',// envelopes_a7
223:'A8 Envelope',// envelopes_a8
224:'A9 Envelope',// envelopes_a9
225:'A10 Envelope',// envelopes_a10
226:'#4 Baronial Envelope',// envelopes_lb4_baronial
227:'#5 Baronial Envelope',// envelopes_lb5_baronial
228:'#5.5 Baronial Envelope',// envelopes_lb5_5_baronial
229:'#6 Baronial Envelope',// envelopes_lb6_baronial
230:'Lee Envelope',// envelopes_lee
231:'#6 1/4 Envelopes',// envelopes_lb6_1_4
232:'#6 3/4 Envelope',// envelopes_lb6_3_4
233:'#7 Envelope',// envelopes_lb7
234:'#7 3/4 Monarch Envelope',// envelopes_lb7_3_4_monarch
235:'#8 5/8 Envelope',// envelopes_lb8_5_8
236:'#9 Envelope',// envelopes_lb9
237:'#10 Envelope',// envelopes_lb10
238:'#11 Envelope',// envelopes_lb11
239:'#12 Envelope',// envelopes_lb12
240:'#14 Envelope',// envelopes_lb14
241:'#3 Booklet Envelope',// envelopes_lb3_booklet
242:'#5 Booklet Envelope',// envelopes_lb5_booklet
243:'#6 Booklet Envelope',// envelopes_lb6_booklet
244:'#6 1/2 Booklet Envelope',// envelopes_lb6_1_2_booklet
245:'#6 5/8 Booklet Envelope',// envelopes_lb6_5_8_booklet
246:'#6 3/4 Booklet Envelope',// envelopes_lb6_3_4_booklet
247:'#7 1/4 Booklet Envelope',// envelopes_lb7_1_4_booklet
248:'#7 1/2 Booklet Envelope',// envelopes_lb7_1_2_booklet
249:'#9 Booklet Envelope',// envelopes_lb9_booklet
250:'#9 1/2 Booklet Envelope',// envelopes_lb9_1_2_booklet
251:'#10 Booklet Envelope',// envelopes_lb10_booklet
252:'#13 Booklet Envelope',// envelopes_lb13_booklet
253:'#1 Catalog Envelope',// envelopes_lb1_catalog
254:'#1 1/2 Catalog Envelope',// envelopes_lb1_1_2_catalog
255:'#3 Catalog Envelope',// envelopes_lb3_catalog
256:'#6 Catalog Envelope',// envelopes_lb6_catalog
257:'#9 3/4 Catalog Envelope',// envelopes_lb9_3_4_catalog
258:'#10 1/2 Catalog Envelope',// envelopes_lb10_1_2_catalog
259:'#12 1/2 Catalog Envelope',// envelopes_lb12_1_2_catalog
260:'#13 1/2 Catalog Envelope',// envelopes_lb13_1_2_catalog
261:'#14 1/2 Catalog Envelope',// envelopes_lb14_1_2_catalog
262:'#15 Catalog Envelope',// envelopes_lb15_catalog
263:'Jumbo 11x17 Envelope',// envelopes_jumbo_11x17
264:'Jumbo 15x20 Envelope',// envelopes_jumbo_15x20
265:'Jumbo 16X20 Envelope',// envelopes_jumbo_16x20
266:'Jumbo 17X22 Envelope',// envelopes_jumbo_17x22
267:'Jumbo 22x27 Envelope',// envelopes_jumbo_22x27
362:'Manually Priced Envelope',// envelopes_manually_priced
136:'Standard window',// envwindowlocation_standard
137:'Custom window location',// envwindowlocation_custom
134:'4.5 x 1.125',// envwindowsize_standard
135:'Custom size',// envwindowsize_custom
138:'Foil stamp - X-small',// foilstampsize_x_small
139:'Foil stamp - Small',// foilstampsize_small
140:'Foil stamp - Medium',// foilstampsize_medium
141:'Foil stamp - Large',// foilstampsize_large
142:'Foil stamp - X-large',// foilstampsize_x_large
143:'Manually Priced',// foilstampsize_manually_priced
97:'Accordion Fold',// fold_accordion_fold
98:'Barrel Roll Fold',// fold_barrel_roll_fold
99:'Gate Fold - Closed',// fold_gate_fold
101:'Four Panel Fold',// fold_four_panel_fold
103:'Half Fold',// fold_half_fold
104:'Half/Half Fold',// fold_half_then_half
105:'Half/Tri Fold',// fold_half_then_tri_fold
106:'Map Fold',// fold_map_fold
107:'Gate Fold - Open',// fold_open_gate_fold
108:'Quarter Fold',// fold_quarter_fold
109:'Tri Fold',// fold_tri_fold
110:'Z Fold',// fold_z_fold
111:'Manually Priced',// fold_manually_priced
317:'Tri then Half Fold',// fold_tri_then_half_fold
389:'Double Parallel Fold',// fold_double_parallel_fold
289:'Manually Priced',// foldcollatestaple_manually_priced
319:'Fold, Collate, Stitch',// foldcollatestaple_fold_collate_stitch
274:'Hard Copy Mock-up',// hardproof_hard_copy_mock_up
320:'Return address in black',// imprint_return_address_in_black
321:'Medium',// imprint_medium
322:'Large',// imprint_large
373:'Manually Priced',// imprint_manually_priced
401:'Numbering',// imprint_numbering
402:'Black',// imprintcolor_black
403:'Red',// imprintcolor_red
404:'Manually Priced',// imprintcolor_manually_priced
83:'4-Color',// ink_4_color
85:'Black',// ink_black
87:'Manually Priced',// ink_manually_priced
144:'1 piece',// insert_1_piece
145:'2 pieces',// insert_2_pieces
146:'3 pieces',// insert_3_pieces
147:'Manually Priced',// insert_manually_priced
148:'Top',// padglueedge_top
149:'Side',// padglueedge_side
9:'80# Gloss Text',// paper_80lb_gloss_text
10:'70# Uncoated Text',// paper_70lb_uncoated_text
11:'80# Dull/Matte Text',// paper_80lb_matte_text
12:'100# Gloss Text',// paper_100lb_gloss_text
13:'70# Colorsource Text',// paper_70lb_colorsource_text
14:'80# Dull/Matte Cover',// paper_80lb_dull_matte_cover
15:'10 pt Carolina C1S Cover',// paper_10_pt_carolina_c1s_cover
16:'80# Cougar Text',// paper_80lb_cougar_text
17:'80# Gloss Cover',// paper_80lb_gloss_cover
18:'80# Lustro Dull Text',// paper_80lb_lustro_dull_text
19:'80# Lustro Dull Cream Text',// paper_80lb_lustro_dull_cream_text
20:'80# Centura Silk Text',// paper_80lb_centura_silk_text
21:'80# Centura Gloss Text',// paper_80lb_centura_gloss_text
22:'100# Dull/Matte Text',// paper_100lb_dull_matte_text
23:'100# Gloss Cover',// paper_100lb_gloss_cover
24:'80# Nekoosa Linen Text',// paper_80lb_nekoosa_linen_text
25:'70# Royal Fiber Text',// paper_70lb_royal_fiber_text
26:'100# Cougar Text',// paper_100lb_cougar_text
27:'24# Classic Crest Writing',// paper_24lb_classic_crest_writing
28:'24# Classic Columns Writing',// paper_24lb_classic_columns_writing
29:'100# Lustro Dull Text',// paper_100lb_lustro_dull_text
30:'100# Lustro Dull Cream Text',// paper_100lb_lustro_dull_cream_text
31:'100# Centura Silk Text',// paper_100lb_centura_silk_text
32:'100# Centura Gloss Text',// paper_100lb_centura_gloss_text
33:'12pt. Carolina C1S Cover',// paper_12pt_carolina_c1s_cover
34:'80# Skytone Text',// paper_80lb_skytone_text
35:'80# Environment Text',// paper_80lb_environment_text
36:'24# Classic Cotton Writing 25',// paper_24lb_classic_cotton_writing_25
37:'24# Strathmore Writing 25 - Cotton',// paper_24lb_strathmore_writing_25_cotton
38:'75# Classic Laid Text',// paper_75lb_classic_laid_text
39:'80# Classic Columns Text',// paper_80lb_classic_columns_text
40:'80# Evergreen 100 PC Text',// paper_80lb_evergreen_100_pc_text
41:'80# Feltweave Text',// paper_80lb_feltweave_text
42:'100# Uncoated Cover',// paper_100lb_uncoated_cover
43:'120# Gloss Cover',// paper_120lb_gloss_cover
44:'120# Dull/Matte Cover',// paper_120lb_dull_matte_cover
45:'80# Starwhite Text',// paper_80lb_starwhite_text
46:'80# Lustro Dull Cover',// paper_80lb_lustro_dull_cover
47:'80# Lustro Dull Cream Cover',// paper_80lb_lustro_dull_cream_cover
48:'80# Centura Silk Cover',// paper_80lb_centura_silk_cover
49:'80# Centura Gloss Cover',// paper_80lb_centura_gloss_cover
50:'80# Classic Crest Text',// paper_80lb_classic_crest_text
51:'80# Cougar Cover',// paper_80lb_cougar_cover
52:'80# Classic Linen Text',// paper_80lb_classic_linen_text
53:'80# Astrobrights Cover',// paper_80lb_astrobrights_cover
54:'100# Cougar Cover',// paper_100lb_cougar_cover
55:'100# Lustro Dull Cover',// paper_100lb_lustro_dull_cover
56:'100# Lustro Dull Cream Cover',// paper_100lb_lustro_dull_cream_cover
57:'100# Classic Crest Text',// paper_100lb_classic_crest_text
58:'80# Environment Cover',// paper_80lb_environment_cover
59:'80# Skytone Cover',// paper_80lb_skytone_cover
60:'100# Centura Silk Cover',// paper_100lb_centura_silk_cover
61:'80# Feltweave Cover',// paper_80lb_feltweave_cover
62:'80# Nekoosa Linen Cover',// paper_80lb_nekoosa_linen_cover
63:'80# Royal Fiber Cover',// paper_80lb_royal_fiber_cover
64:'10 pt Kromekote C1S Cover',// paper_10_pt_kromekote_c1s_cover
65:'80# Evergreen 100 PC Cover',// paper_80lb_evergreen_100_pc_cover
66:'120# Centura Silk Cover',// paper_120lb_centura_silk_cover
67:'80# Starwhite Cover',// paper_80lb_starwhite_cover
68:'12 pt Kromekote C1S Cover',// paper_12_pt_kromekote_c1s_cover
69:'80# Classic Laid Cover',// paper_80lb_classic_laid_cover
70:'100# Centura Gloss Cover',// paper_100lb_centura_gloss_cover
71:'80# Classic Crest Cover',// paper_80lb_classic_crest_cover
72:'100# Nekoosa Linen Cover',// paper_100lb_nekoosa_linen_cover
73:'10 pt Kromekote C2S Cover',// paper_10_pt_kromekote_c2s_cover
74:'80# Classic Linen Cover',// paper_80lb_classic_linen_cover
75:'80# Classic Columns Cover',// paper_80lb_classic_columns_cover
76:'120# Centura Gloss Cover',// paper_120lb_centura_gloss_cover
77:'12 pt Kromekote C2S Cover',// paper_12_pt_kromekote_c2s_cover
78:'100# Classic Crest Cover',// paper_100lb_classic_crest_cover
80:'80# Strathmore Cotton Bristol',// paper_80lb_strathmore_cotton_bristol
81:'80# Classic Cotton Bristol',// paper_80lb_classic_cotton_bristol
82:'13 Pt Magnet Stock',// paper_13_pt_magnet_stock
277:'24# Uncoated',// paper_24lb_uncoated
278:'28# Uncoated White Wove',// paper_28lb_uncoated
279:'13 oz Vinyl Banner',// paper_13_oz_vinyl_banner
280:'CBSL-BCrd-001',// paper_cbsl_bcrd_001
281:'CBSL-LH&E-001',// paper_cbsl_lh_e_001
282:'CBSL-Lthd-001',// paper_cbsl_lthd_001
283:'CBSL-Prez-001',// paper_cbsl_prez_001
284:'2-Part NCR',// paper_ncr_2_part_form
285:'3-Part NCR',// paper_ncr_3_part_form
286:'60# MacTac Labels',// paper_60lb_mactac_labels
287:'Mounted Foamboard',// paper_mounted_foamboard
326:'8 PT C1S Cover',// paper_8_pt_c1s_cover
328:'10 PT C1S Cover',// paper_10_pt_c1s_cover
329:'Lustro Gloss 120# Cover',// paper_lustro_gloss_120lb_cover
330:'Lustro Dull 100# Cover',// paper_lustro_dull_100lb_cover
331:'Knightkote Matte 100# Cover',// paper_knightkote_matte_100lb_cover
332:'12 PT C1S',// paper_12_pt_c1s
333:'80# Uncoated Cover',// paper_80lb_uncoated_cover
334:'Lustro Dull 120# Cover',// paper_lustro_dull_120lb_cover
335:'Lustro Dull Cream 100# Cover',// paper_lustro_dull_cream_100lb_cover
336:'Nekoosa 70# Text',// paper_nekoosa_70lb_text
337:'Topkote Dull 80# Text',// paper_topkote_dull_80lb_text
338:'Lustro Dull Cream 80# Text',// paper_lustro_dull_cream_80lb_text
339:'12 pt. C2S',// paper_12_pt_c2s
340:'Environment 80# Text',// paper_environment_80lb_text
341:'Topkote Dull 100# Cover',// paper_topkote_dull_100lb_cover
342:'Lustro Gloss 80# Text',// paper_lustro_gloss_80lb_text
348:'Manually Priced',// paper_manually_priced
351:'100# Solutions Cover',// paper_100lb_solutions_cover
352:'Foam Board',// paper_foam_board
353:'Joy_Red_P_GC_V',// paper_joy_red_p_gc_v
354:'Joy_Red_P_NC_V',// paper_joy_red_p_nc_v
355:'Lustro Gloss 100# Cover',// paper_lustro_gloss_100lb_cover
356:'Ornaments_P_GC_H',// paper_ornaments_p_gc_h
357:'Ornaments_P_NC_H',// paper_ornaments_p_nc_h
358:'Peace_Letter_blocks_P_GC_H',// paper_peace_letter_blocks_p_gc_h
359:'Peace_Letter_blocks_P_NC_H',// paper_peace_letter_blocks_p_nc_h
360:'Seasons_Greetings_P_GC_V',// paper_seasons_greetings_p_gc_v
361:'Seasons_Greetings_P_NC_V',// paper_seasons_greetings_p_nc_v
383:'60# Fasson Crack n Peel',// paper_60lb_fasson_crack_n_peel_block_out_high_gloss_litho
385:'100# Starwhite Cover',// paper_100lb_starwhite_cover
386:'130# Centura Gloss Cover',// paper_130lb_centura_gloss_cover
387:'70# Classic Crest Text ',// paper_70lb_classic_crest_text_
388:'4-Part NCR',// paper_4_part_ncr
390:'100# Classic Linen Cover',// paper_100lb_classic_linen_cover
415:'70# Whitehall Text',// paper_70lb_whitehall_text
417:'110# Classic Crest Text',// paper_110lb_classic_crest_text
418:'110# Classic Crest Cover',// paper_110lb_classic_crest_cover
419:'24# Laser',// paper_24lb_bond
420:'32# Laser',// paper_32lb_laser
421:'20# Bond',// paper_20lb_bond
423:'24# Classic Linen Writing',// paper_24lb_classic_linen_writing
424:'24# Classic Laid Writing',// paper_24lb_classic_laid
425:'80# Classic Linen Cover Black',// paper_80lb_classic_linen_cover_black
426:'70# Classic Linen Text',// paper_70lb_classic_linen_text
427:'60# Galaxy Offset Text',// paper_60lb_galaxy_offset_text
428:'70# Domtar Colors Text',// paper_70lb_domtar_colors_text
429:'70# Feltweave Text',// paper_70lb_feltweave_text
430:'70# Nekoosa Linen Text',// paper_70lb_nekoosa_linen_text
431:'70# Skytone Text',// paper_70lb_skytone_text
432:'60# Whitehall Text',// paper_60lb_whitehall_text
433:'80# McCoy Silk Text',// paper_80lb_mccoy_silk_text
434:'100# McCoy Silk Text',// paper_100lb_mccoy_silk_text
435:'60# Astrobrights Text',// paper_60lb_astrobrights_text
436:'10 pt Nordic C1S Cover',// paper_10_pt_nordic_c1s_cover
437:'12 pt Nordic C1S Cover',// paper_12_pt_nordic_c1s_cover
150:'Perforation',// perfnumber_perforation
151:'Manually Priced',// perfnumber_manually_priced
323:'Two perfs',// perfnumber_multi_page_perf
422:'Three perfs',// perfnumber_three_perfs
152:'1 pocket on left',// pockets_1_pocket_on_left
153:'1 pocket on right',// pockets_1_pocket_on_right
154:'2 pockets',// pockets_2_pockets
155:'Manually Priced',// pockets_manually_priced
156:'Standard remit flap',// remitflap_standard
157:'Custom remit flap',// remitflap_custom
160:'All four corners',// roundcorners_all_four_corners
161:'2 corners',// roundcorners_2_corners
162:'1 corner',// roundcorners_1_corner
363:'Manually Priced',// roundcorners_manually_priced
158:'1/4 round corners',// roundcornersize_1_4
159:'3/8 round corners',// roundcornersize_3_8
368:'1/8',// roundcornersize_1_8
318:'Score',// score_standard
372:'Manually Priced',// score_manually_priced
290:'Score for folding',// scoringfold_score_for_folding
163:'Glue',// seal_glue
164:'Peel & Seel',// seal_peel_seel
366:'Manually Priced',// seal_manually_priced
405:'25',// sheetsperunit_25
406:'50',// sheetsperunit_50
407:'100',// sheetsperunit_100
408:'manually priced',// sheetsperunit_manually_priced
168:'Approx ',// shrinkcount_approx
169:'Exact',// shrinkcount_exact
165:'Up to 25',// shrinkpiecesperpack_up_to_25
166:'> 25',// shrinkpiecesperpack_gt_25
167:'Single w/chipboard',// shrinkpiecesperpack_single_w_chipboard
170:'Slits on left side',// slits_left_side
171:'Slits on right side',// slits_right_side
172:'Slits on both sides',// slits_both_sides
173:'Manually Priced',// slits_manually_priced
176:'Short',// spirallength_short
177:'Standard',// spirallength_standard
178:'Long',// spirallength_long
174:'Standard',// spiralthickness_standard
175:'Extra-thick',// spiralthickness_extra_thick
343:'1 PMS',// spot_spot_1
344:'2 PMS',// spot_spot_2
345:'3 PMS',// spot_spot_3
346:'4 PMS',// spot_spot_4
347:'5 PMS',// spot_spot_5
381:'Manually Priced',// spot_manually_priced
179:'Corner staple',// staple_corner
180:'Custom',// staple_custom
369:'Manually Priced',// staple_manually_priced
181:'Tab',// tab_tab
182:'Multi tab',// tab_multi_tab
365:'Manually Priced',// tab_manually_priced
409:'Manually Priced',// washup_manually_priced
410:'Wash-Up Charge 1',// washup_wash_up_charge_1
411:'Wash-Up Charge 2',// washup_wash_up_charge_2
412:'Wash-Up Charge 3',// washup_wash_up_charge_3
413:'Wash-Up Charge 4',// washup_wash_up_charge_4
414:'Wash-Up Charge 5',// washup_wash_up_charge_5
183:'Short',// wirelength_short
184:'Standard',// wirelength_standard
185:'Long',// wirelength_long
382:'Manually Priced'// wirelength_manually_priced
};
var ChannelIDEnum = {
'OfficeMax':'0',
'LogoWorks':'1',
'VerticalLend':'2',
'PFLGeneral':'5',
'MarkZuckerbrod':'4',
'JohnLScottRealEstate':'6',
'LenderLeadSolutions':'7',
'GetSoloLlc':'8',
'ColdwellBankerBarbaraSueSeal':'9',
'RegencyFireplaceProducts':'10',
'FreshFruitBouquet':'12',
'OldColonyCompany':'13',
'PetroSkills':'14',
'UnitedFirstFinancial':'15',
'LifePathUnlimited':'11',
'Mimeo':'149'
};
var CouponCodeEnum = {
'HiVolDiscount':'HVD',
'ReferralCodePrefix':'RP1',
'ReferralProgramPrefix':'RP5',
'MakeGoodPrefix':'MG',
'FreeBusinessCards':'FBC',
'MarketingCouponFreeBusinessCards1':'MCFBC1',
'BizFilingsFreeBusinessCards':'BFFBC40',
'VISAFreeBusinessCards':'VISABUSINESS'
};
var CoverInsideEnum = {
'ForCover':'C',
'ForInside':'I',
'InkInside':'InkInside',
'PaperInside':'PaperInside',
'SpotInside':'SpotInside'
};
var DiscountTypeEnum = {
'Promotional':0,
'Referral':1,
'HiVol':2,
'SpecialDiscount':3
};
var EnvelopeTypeEnum = {
'YesImageName':'envelope-blank.jpg',
'PrintedImageName':'envelopeFT.jpg'
};
var InkEnum = {
'DelimValue':'/',
'DelimText':' / '
};
var NoValueEnum = {
57:'No',// backing
15:'',// band
58:'No',// binding
8:'No Coating',// coating
17:'No Collation',// collate
43:'No Collation',// collateinsertinto
52:'',// collateinsertpieces
44:'No Collation & Staple',// collatestaple
59:'No Conversion',// conversion
60:'No',// cover
45:'',// custom
18:'',// deboss
19:'No Die Cut',// diecut
20:'No Drill Holes',// drillholes
46:'',// drillpages
21:'No Emboss',// emboss
14:'No Envelopes',// envelopes
47:'No Envelope Window',// envwindowlocation
22:'No Envelope Window',// envwindowsize
23:'No Foil',// foilstampsize
11:'No Fold',// fold
54:'None',// foldcollatestaple
12:'',// form
40:'',// hardproof
2:'',// height
55:'Blank',// imprint
61:'None',// imprintcolor
3:'None',// ink
24:'',// insert
25:'',// padglueedge
6:'No Paper',// paper
26:'No Perforation',// perfnumber
27:'No Pockets',// pockets
28:'',// remitflap
48:'No Round Corners',// roundcorners
29:'No Round Corners',// roundcornersize
31:'No Score',// score
32:'',// scoringfold
33:'No Seal',// seal
13:'No Second Sheets',// seconds
62:'None',// sheetsperunit
49:'',// shrinkcount
34:'',// shrinkpiecesperpack
35:'No Slits',// slits
50:'',// spirallength
36:'',// spiralthickness
56:'No Spot Color',// spot
37:'No Staple',// staple
30:'',// stitch
38:'',// tab
63:'No',// washup
1:'',// width
51:'',// wirelength
39:''// wirethickness
};
var NumPagesEnum = {
'CatalogsFive8Value':0,
'CatalogsFive8Text':8,
'CatalogsFive12Value':0.75,
'CatalogsFive12Text':12,
'CatalogsFive16Value':1,
'CatalogsFive16Text':16,
'CatalogsFive20Value':1.75,
'CatalogsFive20Text':20,
'CatalogsFive24Value':2,
'CatalogsFive24Text':24,
'CatalogsFive28Value':2.75,
'CatalogsFive28Text':28,
'CatalogsFive32Value':3,
'CatalogsFive32Text':32,
'CatalogsFive36Value':3.75,
'CatalogsFive36Text':36,
'CatalogsFive40Value':4,
'CatalogsFive40Text':40,
'CatalogsFive44Value':4.75,
'CatalogsFive44Text':44,
'CatalogsFive48Value':5,
'CatalogsFive48Text':48,
'CatalogsFive52Value':5.75,
'CatalogsFive52Text':52,
'CatalogsFive56Value':6,
'CatalogsFive56Text':56,
'CatalogsFive60Value':6.75,
'CatalogsFive60Text':60,
'CatalogsFive64Value':7,
'CatalogsFive64Text':64,
'CatalogsEight4Value':0,
'CatalogsEight4Text':4,
'CatalogsEight8Value':1,
'CatalogsEight8Text':8,
'CatalogsEight12Value':2,
'CatalogsEight12Text':12,
'CatalogsEight16Value':3,
'CatalogsEight16Text':16,
'CatalogsEight20Value':4,
'CatalogsEight20Text':20,
'CatalogsEight24Value':5,
'CatalogsEight24Text':24,
'CatalogsEight28Value':6,
'CatalogsEight28Text':28,
'CatalogsEight32Value':7,
'CatalogsEight32Text':32,
'CatalogsEight36Value':8,
'CatalogsEight36Text':36,
'CatalogsEight40Value':9,
'CatalogsEight40Text':40,
'CatalogsEight44Value':10,
'CatalogsEight44Text':44,
'CatalogsEight48Value':11,
'CatalogsEight48Text':48,
'CatalogsEight52Value':12,
'CatalogsEight52Text':52,
'CatalogsEight56Value':13,
'CatalogsEight56Text':56,
'CatalogsEight60Value':14,
'CatalogsEight60Text':60,
'CatalogsEight64Value':15,
'CatalogsEight64Text':64
};
var OrderingPageEnum = {
'cardsbookmarks':'cardsbookmarks',
'brochureseleven':'brochureseleven',
'brochureseight':'brochureseight',
'brochuresfourteen':'brochuresfourteen',
'brochurestwentyfive':'brochurestwentyfive',
'brochurerackcardholders':'brochurerackcardholders',
'cardsbusinesscards':'cardsbusinesscards',
'cardssrbusinesscards':'cardssrbusinesscards',
'calendars':'calendars',
'catalogsfive':'catalogsfive',
'catalogseight':'catalogseight',
'cdcovers':'cdcovers',
'cardsdoorhangers':'cardsdoorhangers',
'stationeryenvelopesonly':'stationeryenvelopesonly',
'filefolders':'filefolders',
'cardsgreetingcards':'cardsgreetingcards',
'stationerylrgenvelopes':'stationerylrgenvelopes',
'stationeryletterhead':'stationeryletterhead',
'stationeryletterheadonly':'stationeryletterheadonly',
'newsletterseleven':'newsletterseleven',
'newsletterseight':'newsletterseight',
'newsletterstwentyfive':'newsletterstwentyfive',
'cardspostcards':'cardspostcards',
'brochuresposters':'brochuresposters',
'presentationfolders':'presentationfolders',
'cardsrackcards':'cardsrackcards',
'statementstuffers':'statementstuffers',
'customorders':'customorders',
'greetingcards':'holidaycards',
'channelorder':'channelorder',
'largeposterprinting':'largeposterprinting',
'customproduct':'customproduct',
'customproductnoseconds':'customproductnoseconds',
'notepadprinting':'notepadprinting',
'carbonlessncrprinting':'carbonlessncrprinting'
};
var PriceForEnum = {
'Base':'Base',
'Each':'Each'
};
var PricingPercentTypeEnum = {
'MultiVersion':'0',
'Channel':'1',
'Markup':'2'
};
var ProductIDEnum = {
'bookmarks_2x6':59,
'bookmarks_2x7':60,
'brochures_11x17':3,
'brochures_11x25_5':56,
'brochures_8_5x11':9,
'brochures_8_5x14':10,
'brochures_8_5x4_25':85,
'business_cards':13,
'business_cards_short_run':99,
'calendars_5_5x8_5':65,
'calendars_8_5x11':66,
'card_enclosure':86,
'catalogs_5_5x8_5':6,
'catalogs_8_5x11':11,
'cd_covers':14,
'custom_business_cards':22,
'custom_quote':34,
'door_hangers_3_5x8_5':69,
'door_hangers_4_25x11':68,
'envelopes_9_1_2x12_5_8':62,
'envelopes_9x12':61,
'envelopes_lb10_window':89,
'envelopes_only':43,
'file_folders':67,
'generic_custom_1_1':100,
'generic_custom_1_2':101,
'generic_custom_1_3':102,
'generic_custom_1_4':103,
'generic_custom_2_1':104,
'generic_custom_2_2':105,
'generic_custom_2_3':106,
'generic_custom_2_4':107,
'generic_custom_3_1':108,
'generic_custom_3_2':109,
'generic_custom_3_3':110,
'generic_custom_3_4':111,
'generic_custom_4_1':112,
'generic_custom_4_2':113,
'generic_custom_4_3':114,
'generic_custom_4_4':115,
'greeting_cards':15,
'holiday_deluxe_greeting_card':90,
'holiday_deluxe_note_card':91,
'holiday_premium_greeting_card':92,
'holiday_premium_note_card':93,
'index_cards_3x5':84,
'legal_letterhead':88,
'letterhead_envelopes':18,
'letterhead_only':17,
'literature_holder':116,
'menus_7x12':95,
'ncr_form_5_5x8_5':117,
'ncr_form_8_5x11':118,
'ncr_form_8_5x14':119,
'newsletters_11x17':4,
'newsletters_11x25_5':94,
'newsletters_8_5x11':12,
'note_cards':71,
'notepad_4_25x5_5':120,
'notepad_5_5x8_5':121,
'notepads_8_5x11':96,
'postcards_4_25x5_5':57,
'postcards_4x6':5,
'postcards_5_5x8_5':7,
'postcards_5x7':8,
'postcards_6x11':81,
'postcards_6x9':70,
'posters_11_5x18':20,
'posters_17x24':16,
'posters_22x30':97,
'posters_28x38':98,
'presentation_folders_9x12':52,
'presentation_folders_cbsl_9x12':87,
'rack_cards_4x9':19,
'social_net_card_3_3_8x2_1_8':82,
'social_net_card_basic_3_3_8x2_1_8':83,
'statement_stuffers_10_5x7':78,
'statement_stuffers_10_5x8_5':74,
'statement_stuffers_3_5x7':76,
'statement_stuffers_3_5x8_5':72,
'statement_stuffers_5_5x8_5':75,
'statement_stuffers_7x7':77,
'statement_stuffers_7x8_5':73
};
var ProofTypeEnum = {
'PDFValue':'PDF',
'PDFText':'<nobr>Adobe Acrobat PDF Proof</nobr>',
'JPEGValue':'JPEG',
'JPEGText':'<nobr>JPEG Proof Via Web Page</nobr>',
'DOValue':'DO',
'DOText':'DO',
'DHPValue':'Digital Hard Proof',
'DHPText':'<nobr>Digital Hard Proof</nobr>',
'PPValue':'Press Proof',
'PPText':'<nobr>4 x 6 Press Proof</nobr>'
};
var ShipTypeEnum = {
'FedExGroundValue':'FDXG',
'FedExGroundText':'Ground',
'FedEx3DayValue':'FDX3DA',
'FedEx3DayText':'3 Day',
'FedEx2DayValue':'FDX2DA',
'FedEx2DayText':'2 Day Air',
'FedExOvernightPMValue':'FDXNDA',
'FedExOvernightPMText':'Overnight',
'CPUValue':'CPU',
'CPUText':'Customer Pickup',
'BulkMailValue':'BM',
'BulkMailText':'Bulk Mail',
'FirstClassPresortedValue':'1CP',
'FirstClassPresortedText':'1st Class - Presorted',
'FirstClassValue':'1C',
'FirstClassText':'1st Class'
};
/// <reference path="Enums/AttributeIDEnum.js" />
/// <reference path="Enums/AttributeValueIDEnum.js" />
/// <reference path="Enums/AttributeValueNameEnum.js" />
/// <reference path="Enums/NoValueEnum.js" />
var AqueousPricings;
var VALIDATE_AQUEOUS = 'Aqueous';
var VALIDATE_MUST_NOT_COAT = 'MustNotCoat';

function AqueousPricing(aqueousPricingID, coatingFID, mustNotCoat, coverInside, rblAqueousName, cbMustNotCoatID) {
this.aqueousPricingID = aqueousPricingID;
this.coatingFID = coatingFID;
this.coatingFIDOri = coatingFID;
this.mustNotCoat = mustNotCoat;
this.coverInside = coverInside;
this.rblAqueousName = rblAqueousName;
this.cbMustNotCoatID = cbMustNotCoatID;

this.forCover = (this.coverInside == CoverInsideEnum.ForCover);
this.forInside = (this.coverInside == CoverInsideEnum.ForInside);

this.InsertAqueousPricing();
}

AqueousPricing.prototype.InsertAqueousPricing = function() {
if (typeof(AqueousPricings) == 'undefined') {
AqueousPricings = new Object;
}
AqueousPricings[this.aqueousPricingID] = this;
};

AqueousPricing.prototype.ResetAqueous = function() {
 SetRadioButtonListChecked(this.rblAqueousName, this.coatingFID);
};

AqueousPricing.prototype.ChangeAqueous = function(coatingFID) {
this.ValidateAqueous(((this.productPricingObj) ? this.productPricingObj.GetPaperID() : null), coatingFID, this.mustNotCoat, false);

if (this.productPricingObj) {
this.productPricingObj.AdjustPrices(AdjustTypeEnum.Aqueous);
this.productPricingObj.HandleShowSubmitChanges();
}
};

AqueousPricing.prototype.SetAqueous = function(coatingFID, coatingBID) {
this.coatingFID = coatingFID;
this.coatingBID = coatingBID;
SetRadioButtonListChecked(this.rblAqueousName, coatingFID);
};

AqueousPricing.prototype.ChangeMustNotCoat = function(mustNotCoat) {
this.ValidateAqueous(((this.productPricingObj) ? this.productPricingObj.GetPaperID() : null), this.coatingFID, mustNotCoat, false);
};

AqueousPricing.prototype.SetMustNotCoat = function(mustNotCoat) {
this.mustNotCoat = mustNotCoat;
if ($(this.cbMustNotCoatID)) {
$(this.cbMustNotCoatID).checked = mustNotCoat;
}
};

AqueousPricing.prototype.GetTotalAqueousPrice = function(productID, inkFID, inkBID, spotFID, spotBID, quantity, signatures, paperID, percentCollection) {
var price = 0;
if (typeof (signatures) != 'undefined' && signatures != null) {
for (var i = 0, loopCnt = signatures.length; i < loopCnt; i++) {
price += this.GetAqueousPrice(productID, signatures[s].GetAttributeValueID(AttributeIDEnum.ink, AttributePlacementEnum.front), signatures[s].GetAttributeValueID(AttributeIDEnum.spot, AttributePlacementEnum.front), quantity, signatures[s].GetAttributeValueID(AttributeIDEnum.paper, AttributePlacementEnum.front), signatures[s].TotalSignaturePricingPercent(), percentCollection) +
this.GetAqueousPrice(productID, signatures[s].GetAttributeValueID(AttributeIDEnum.ink, AttributePlacementEnum.back), signatures[s].GetAttributeValueID(AttributeIDEnum.spot, AttributePlacementEnum.back), quantity, signatures[s].GetAttributeValueID(AttributeIDEnum.paper, AttributePlacementEnum.front), signatures[s].TotalSignaturePricingPercent(), percentCollection);
}
}
else {
price = this.GetAqueousPrice(productID, inkFID, spotFID, quantity, paperID, 1, percentCollection) +
this.GetAqueousPrice(productID, inkBID, spotBID, quantity, paperID, 1, percentCollection);
}
return price;
};

AqueousPricing.prototype.GetAqueousPrice = function(productID, inkID, spotID, quantity, paperID, signaturePricingPercent, percentCollection) {
if (this.coatingFID == '' ||
(inkID == '' && spotID == '') ||
(inkID != AttributeValueIDEnum.ink_4_color && this.IsFourColorSideOnlyForAqueous(productID)) ||
((productID == ProductIDEnum.greeting_cards || productID == ProductIDEnum.note_cards) && paperID == AttributeValueIDEnum.paper_120lb_gloss_cover)) {
return 0;
}

var aqueousBase = inkArr[productID][INK_IDX_AQUEOUS_BASE];
var aqueousEach = inkArr[productID][INK_IDX_AQUEOUS_EACH];

percentCollection.SetCanApplyPercentVariables(AdjustTypeEnum.Aqueous, ChannelID);

var price = 0;
// Calculate aqueous price
if (this.productPricingObj && this.productPricingObj.quantityList.length != 0) { //business cards
var quantityList = this.productPricingObj.quantityList;
for (var i = 0, loopCnt = quantityList.length; i < loopCnt; i++) { //loop through version quantities
price += this.CalculateAqueousPrice(quantityList[i], signaturePricingPercent, aqueousBase, aqueousEach, percentCollection);
}
}
else { //one quantity products
price = this.CalculateAqueousPrice(quantity, signaturePricingPercent, aqueousBase, aqueousEach, percentCollection);
}
return price;
};

AqueousPricing.prototype.IsFourColorSideOnlyForAqueous = function(productID) {
return (productID == ProductIDEnum.business_cards || productID == ProductIDEnum.business_cards_short_run ||
 productID == ProductIDEnum.bookmarks_2x6 || productID == ProductIDEnum.bookmarks_2x7 ||
 productID == ProductIDEnum.door_hangers_3_5x8_5 || productID == ProductIDEnum.door_hangers_4_25x11 ||
 productID == ProductIDEnum.rack_cards_4x9 || productID == ProductIDEnum.postcards_4x6 ||
 productID == ProductIDEnum.postcards_4_25x5_5 || productID == ProductIDEnum.postcards_5x7 ||
 productID == ProductIDEnum.postcards_5_5x8_5 || productID == ProductIDEnum.postcards_6x9 ||
 productID == ProductIDEnum.postcards_6x11 || productID == ProductIDEnum.greeting_cards ||
 productID == ProductIDEnum.note_cards || productID == ProductIDEnum.holiday_deluxe_greeting_card ||
 productID == ProductIDEnum.holiday_deluxe_note_card || productID == ProductIDEnum.holiday_premium_greeting_card || 
 productID == ProductIDEnum.holiday_premium_note_card);
};

AqueousPricing.prototype.CalculateAqueousPrice = function(quantity, signaturePricingPercent, aqueousBase, aqueousEach, percentCollection) {
var price;

price = signaturePricingPercent * (aqueousBase + (quantity * aqueousEach));

if (typeof(percentCollection) != 'undefined') {
return percentCollection.ApplyPricingPercents(price);
}
else {
return FormatDollar(price);
}
};

AqueousPricing.prototype.ValidateAqueous = function(paperID, coatingFID, mustNotCoat, forPaperChange) {
 var ret = this.IsValidAqueous(paperID, coatingFID, mustNotCoat, forPaperChange);
 if (!ret.VALIDATE_RESULT) {
 if (ret.VALIDATE_MESSAGE) {
 alert(ret.VALIDATE_MESSAGE);
 }
 this.SetAqueous(ret.VALIDATE_AQUEOUS);
 this.SetMustNotCoat(ret.VALIDATE_MUST_NOT_COAT);
 }
 else {
 this.coatingFID = coatingFID;
 this.mustNotCoat = mustNotCoat;
 }
 return ret.VALIDATE_RESULT;
};

AqueousPricing.prototype.IsValidAqueous = function(paperID, coatingFID, mustNotCoat, forPaperChange) {
if ((paperID == AttributeValueIDEnum.paper_80lb_dull_matte_cover ||
paperID == AttributeValueIDEnum.paper_120lb_dull_matte_cover ||
paperID == AttributeValueIDEnum.paper_100lb_uncoated_cover ||
paperID == AttributeValueIDEnum.paper_70lb_uncoated_text ||
paperID == AttributeValueIDEnum.paper_80lb_matte_text) && coatingFID == AttributeValueIDEnum.coating_gloss_aqueous) {
return this.GetValidationObject(false, 'Aqueous coating is not available on ' + AttributeValueNameEnum[paperID] + ' stock.', (forPaperChange) ? '' : this.coatingFID, this.mustNotCoat);
}
else if (paperID == AttributeValueIDEnum.paper_13_pt_magnet_stock && coatingFID == '') {
return this.GetValidationObject(false, 'Aqueous coating is required on ' + AttributeValueNameEnum[paperID] + '.', AttributeValueIDEnum.coating_gloss_aqueous, false);
}
else if (coatingFID == AttributeValueIDEnum.coating_gloss_aqueous && mustNotCoat) {
return this.GetValidationObject(false, 'Must Not Coat option is not available for Aqueous coating.', coatingFID, false);
}
return this.GetValidationObject(true);
};

AqueousPricing.prototype.GetValidationObject = function(validateResult, validateMessage, coatingFID, mustNotCoat) {
return {
VALIDATE_RESULT : validateResult,
VALIDATE_MESSAGE : validateMessage,
VALIDATE_AQUEOUS : coatingFID,
VALIDATE_MUST_NOT_COAT : mustNotCoat
};
};

AqueousPricing.prototype.IsChanged = function() {
return (this.coatingFIDOri != this.coatingFID);
};
/// <reference path="Enums/AttributeIDEnum.js" />
/// <reference path="Enums/AttributeValueIDEnum.js" />
/// <reference path="Enums/AttributeValueNameEnum.js" />
/// <reference path="Enums/NoValueEnum.js" />
var BackingPricings;

function BackingPricing(finishingPricingID, finishingID, rblName, imageID) {
this.imageID = imageID;
this.finishingPricingObj = new FinishingPricing(finishingPricingID, finishingID, rblName);

this.InsertBackingPricing();
}

BackingPricing.prototype.InsertBackingPricing = function() {
if (typeof (BackingPricings) == 'undefined') {
BackingPricings = new Object;
}
BackingPricings[this.finishingPricingObj.finishingPricingID] = this;
};

BackingPricing.prototype.ResetBacking = function() {
SetRadioButtonListChecked(this.rblName, this.finishingID);
};

BackingPricing.prototype.ChangeBacking = function(finishingID) {
this.finishingPricingObj.finishingID = finishingID;
if (this.productPricingObj) {
this.productPricingObj.HandleAttributePrices(AdjustTypeEnum.Backing);
}
};

BackingPricing.prototype.GetBackingPrice = function(finishingID, quantity, isCoverStock, productID, percentCollection, signatures) {
return this.finishingPricingObj.GetFinishingPrice(finishingID, quantity, productID, percentCollection, signatures, this.productPricingObj.quantityList);
};var BindingPricings;

function BindingPricing(userControlID, bindingID, sheetsPerUnitID, backingID, coverID, rblSheetsPerUnitID, rblPaddingID) {
 this.userControlID = userControlID;
 this.bindingObjID = userControlID.replace(/_/g, "$") + '$' + bindingID;
 this.rblSheetsPerUnitID = rblSheetsPerUnitID;
 this.rblPaddingID = rblPaddingID;
 new FinishingPricing(this.bindingObjID, bindingID, '');
 new FinishingPricing(rblSheetsPerUnitID, sheetsPerUnitID, rblSheetsPerUnitID);
 new FinishingPricing('Backing', backingID, '');
 new FinishingPricing('Cover', coverID, '');
 new FinishingPricing('Collate', this.SetCollateID(), '');
 
 this.InsertBindingPricing();
}

BindingPricing.prototype.InsertBindingPricing = function() {
 if (typeof (BindingPricings) == 'undefined') {
 BindingPricings = new Object;
 }
 BindingPricings[this.userControlID] = this;
};

BindingPricing.prototype.Reset = function() {
SetRadioButtonListChecked(this.rblSheetsPerUnitID, FinishingPricings[this.rblSheetsPerUnitID].finishingID);
if (FinishingPricings['Cover'].finishingID != '') { //set padding radio button cover trumps backing
SetRadioButtonListChecked(this.rblPaddingID, FinishingPricings['Backing'].finishingID);
}
else {
SetRadioButtonListChecked(this.rblPaddingID, FinishingPricings['Cover'].finishingID);
}
};

BindingPricing.prototype.Change = function(control, value) {
 var controlID = control[0].name;
 if (typeof (controlID) == 'undefined') {
 controlID = control;
 }
 var paperID = ((this.productPricingObj) ? this.productPricingObj.GetPaperID() : null);
 var productID = ((this.productPricingObj) ? this.productPricingObj.productID : null);
 if (controlID == this.rblSheetsPerUnitID) {
 this.Validate(value, FinishingPricings['Backing'].finishingID, FinishingPricings['Cover'].finishingID, paperID, productID, false);
 //check that quantity is divisible by sheetsPerUnit for NCR
 if (this.productPricingObj && this.productPricingObj.orderingPage == OrderingPageEnum.carbonlessncrprinting && value != '') {
 this.productPricingObj.HandleSheetsPerUnitChange();
 }
 //check that quantity (number of pads) times sheetsPerUnit is greater than min quantity for Notepads
 else if (this.productPricingObj && this.productPricingObj.orderingPage == OrderingPageEnum.notepadprinting && value != '') {
 this.productPricingObj.HandleSheetsPerUnitChange();
 }
 }
 else if (controlID == this.rblPaddingID) {
 if (value == AttributeValueIDEnum.cover_cover_wrap) { //coverwrap includes chipboard
 this.Validate(FinishingPricings[this.rblSheetsPerUnitID].finishingID, AttributeValueIDEnum.backing_chip_board, value, paperID, productID, false);
 }
 else { //value == AttributeValueIDEnum.backing_chip_board || value == ''
 this.Validate(FinishingPricings[this.rblSheetsPerUnitID].finishingID, value, '', paperID, productID, false);
 }
 }

 //set glue for binding based on sheetsPerUnit
 if (FinishingPricings[this.rblSheetsPerUnitID].finishingID == '') {
 FinishingPricings[this.bindingObjID].finishingID = '';
 }
 else {
 if (FinishingPricings['Cover'].finishingID != '') {
 FinishingPricings[this.bindingObjID].finishingID = AttributeValueIDEnum.binding_staple;
 }
 else {
 FinishingPricings[this.bindingObjID].finishingID = AttributeValueIDEnum.binding_glue;
 }
 }

 //adjust pricing
 if (this.productPricingObj) {
 this.productPricingObj.HandleAttributePrices(AdjustTypeEnum.Padding);
 }
};

BindingPricing.prototype.Validate = function(sheetsPerUnitID, backingID, coverID, paperID, productID, forSizeChange) {
var ret = this.IsValid(sheetsPerUnitID, backingID, coverID, paperID, productID, forSizeChange);
if (!ret.VALIDATE_RESULT) {
if (ret.VALIDATE_MESSAGE) {
alert(ret.VALIDATE_MESSAGE);
}
}
FinishingPricings[this.rblSheetsPerUnitID].SetFinishingID(ret.VALIDATE_SHEETSPERUNITID);
FinishingPricings['Backing'].SetFinishingID(ret.VALIDATE_BACKINGID);
FinishingPricings['Cover'].SetFinishingID(ret.VALIDATE_COVERID);
FinishingPricings['Collate'].SetFinishingID(this.SetCollateID());
this.SetPaddingRadioButton(ret.VALIDATE_BACKINGID, ret.VALIDATE_COVERID);

return ret.VALIDATE_RESULT;
};

BindingPricing.prototype.IsValid = function(sheetsPerUnitID, backingID, coverID, paperID, productID, forSizeChange) {
var returnMsg = '';
var returnState = true;
if (this.productPricingObj && this.productPricingObj.orderingPage == OrderingPageEnum.carbonlessncrprinting) { //validation only for NCR ordering page
if ((paperID == AttributeValueIDEnum.paper_ncr_3_part_form || paperID == AttributeValueIDEnum.paper_4_part_ncr) &&
coverID != '' && sheetsPerUnitID == AttributeValueIDEnum.sheetsperunit_100) {
returnMsg = 'The maximum booklet size for 3-part or 4-part NCR forms is 50 sets';
returnState = false;
sheetsPerUnitID = AttributeValueIDEnum.sheetsperunit_50;
}

if (productID == ProductIDEnum.ncr_form_8_5x14 && coverID != '') {
returnMsg = 'Booklets are not available for 8 1/2 x 14 NCR Forms';
if (forSizeChange) {
returnState = false;
}
else {
returnState = false;
backingID = AttributeValueIDEnum.backing_chip_board;
coverID = '';
}
}

//enable sheetsPerUnit radio buttons based on backingID and coverID
var sheetsPerUnitElem = document.getElementsByName(this.rblSheetsPerUnitID);
if (sheetsPerUnitElem != null && typeof (sheetsPerUnitElem) != 'undefined') {
if (backingID == '' && coverID == '') { //disable sheetsPerUnit
for (var i = 0, loopCnt = sheetsPerUnitElem.length; i < loopCnt; i++) {
sheetsPerUnitElem[i].disabled = true;
}
sheetsPerUnitID = '';
}
else { //enable sheetsPerUnit and select default of 50 if not set
for (var i = 0, loopCnt = sheetsPerUnitElem.length; i < loopCnt; i++) {
sheetsPerUnitElem[i].disabled = false;
}
if (sheetsPerUnitID == '') {
sheetsPerUnitID = AttributeValueIDEnum.sheetsperunit_50;
}
}
}
}
return this.GetValidationObject(returnState, returnMsg, sheetsPerUnitID, backingID, coverID);
};

BindingPricing.prototype.GetValidationObject = function(validateResult, validateMessage, sheetsPerUnitID, backingID, coverID) {
return {
VALIDATE_RESULT : validateResult,
VALIDATE_MESSAGE : validateMessage,
VALIDATE_SHEETSPERUNITID : sheetsPerUnitID,
VALIDATE_BACKINGID : backingID,
VALIDATE_COVERID : coverID
};
};

BindingPricing.prototype.SetCollateID = function() {
if (FinishingPricings['Backing'].finishingID != '' || FinishingPricings['Cover'].finishingID != '') {
 return AttributeValueIDEnum.collate_insert_separators;
 }
 return null;
};

BindingPricing.prototype.SetPaddingRadioButton = function(backingID, coverID) {
 if (this.rblPaddingID != '') {
 var paddingID = backingID;
 if (coverID != '') {
 paddingID = coverID;
 }
 SetRadioButtonListChecked(this.rblPaddingID, paddingID);
 }
};

BindingPricing.prototype.DisableSheetsPerUnit = function() {
var sheetsPerUnitElem = document.getElementsByName(this.rblSheetsPerUnitID);
if (sheetsPerUnitElem != null && typeof (sheetsPerUnitElem) != 'undefined') {
for (var i = 0, loopCnt = sheetsPerUnitElem.length; i < loopCnt; i++) {
sheetsPerUnitElem[i].disabled = true;
}
}
};
/// <reference path="Enums/AttributeIDEnum.js" />
/// <reference path="Enums/AttributeValueIDEnum.js" />
/// <reference path="Enums/AttributeValueNameEnum.js" />
/// <reference path="Enums/NoValueEnum.js" />
/// <reference path="FinishingPricing.js" />
/// <reference path="PrintedEnvelopePricing.js" />
var BlankEnvelopePricings;

function BlankEnvelopePricing(blankEnvelopePricingID, blankEnvelopeSizeID, blankEnvelopeQuantity, blankEnvelopeQuantityInputID, blankEnvelopePaperID) {
this.blankEnvelopePricingID = blankEnvelopePricingID;
this.blankEnvelopeSizeID = blankEnvelopeSizeID;
this.blankEnvelopeQuantity = blankEnvelopeQuantity;
this.blankEnvelopeQuantityInputID = blankEnvelopeQuantityInputID;
this.blankEnvelopePaperID = blankEnvelopePaperID;
if (blankEnvelopePaperID == '') { //set envelope paper if not passed
this.blankEnvelopePaperID = AttributeValueIDEnum.paper_24lb_uncoated;
}
 
this.InsertBlankEnvelopePricing();
}

BlankEnvelopePricing.prototype.InsertBlankEnvelopePricing = function() {
if (typeof(BlankEnvelopePricings) == 'undefined') {
BlankEnvelopePricings = new Object;
}
BlankEnvelopePricings[this.blankEnvelopePricingID] = this;
};

BlankEnvelopePricing.prototype.ResetBlankEnvelopeQuantity = function() {
 SetValue(this.blankEnvelopeQuantityInputID, this.blankEnvelopeQuantity);
};

BlankEnvelopePricing.prototype.ChangeEnvelopeQuantity = function(blankEnvelopeQuantity) {
this.blankEnvelopeQuantity = ParseInt(blankEnvelopeQuantity);

if (this.productPricingObj) {
this.productPricingObj.HandleMailingBlankEnvelopes();
this.productPricingObj.AdjustPrices(AdjustTypeEnum.Envelope);
this.productPricingObj.HandleShowSubmitChanges();
}
};

BlankEnvelopePricing.prototype.SetEnvelopeQuantity = function(envelopeQuantity) {
 this.blankEnvelopeQuantity = envelopeQuantity;
$(this.blankEnvelopeQuantityInputID).value = envelopeQuantity;
};

BlankEnvelopePricing.prototype.IsChanged = function() {
return (this.blankEnvelopeQuantityOri != this.blankEnvelopeQuantity);
};

BlankEnvelopePricing.prototype.GetBlankEnvelopePrice = function(percentCollection) {
if (this.blankEnvelopeSizeID == '' && this.productPricingObj) {
this.productPricingObj.SetBlankEnvelopeSize();
}
if (this.blankEnvelopeSizeID == '' || this.blankEnvelopeQuantity < 0 || this.blankEnvelopePaperID == null) {
return 0;
}
percentCollection.SetCanApplyPercentVariables(AdjustTypeEnum.Envelope, ChannelID);
return this.CalculateBlankEnvelopePrice(blankEnvelopeArr[this.blankEnvelopeSizeID][this.blankEnvelopePaperID][BLANKENVELOPE_IDX_BASE], blankEnvelopeArr[this.blankEnvelopeSizeID][this.blankEnvelopePaperID][BLANKENVELOPE_IDX_EACH], this.blankEnvelopeQuantity, percentCollection);
};

BlankEnvelopePricing.prototype.CalculateBlankEnvelopePrice = function(base, each, quantity, percentCollection) {
 var price = 0;
 if (quantity > 0)
 {
price = base + (each * quantity);
 }
if (typeof(percentCollection) != 'undefined') {
return percentCollection.ApplyPricingPercents(price);
}
else {
return FormatDollar(price);
}
};

BlankEnvelopePricing.prototype.SetBlankEnvelopeType = function(blankEnvelopeTypeID) {
SetRadioButtonListChecked(FinishingPricings[this.productPricingObj.blankEnvelopeImprintID].rblName, blankEnvelopeTypeID);
};var ConfirmAsIss;

function ConfirmAsIs(confirmAsIsID, tblConfirmChangesID, tblConfirmAsIsID, isInternalWeb, SubmitOnly) {
 this.confirmAsIsID = confirmAsIsID;
 this.tblConfirmChangesID = tblConfirmChangesID;
 this.tblConfirmAsIsID = tblConfirmAsIsID;
 this.isInternalWeb = isInternalWeb;
 this.SubmitOnly = SubmitOnly;

 this.ConfirmChanges();
 this.InsertConfirmAsIs();
}

ConfirmAsIs.prototype.InsertConfirmAsIs = function() {
 if (typeof (ConfirmAsIss) == 'undefined') {
 ConfirmAsIss = new Object;
 }
 ConfirmAsIss[this.confirmAsIsID] = this;
};

ConfirmAsIs.prototype.ConfirmChanges = function(anyChangesMade) {
var tblConfirmChangesElem = $(this.tblConfirmChangesID);
if (tblConfirmChangesElem && !this.SubmitOnly) {
tblConfirmChangesElem.style.display = (anyChangesMade) ? '' : 'none';
}
var tblConfirmAsIsElem = $(this.tblConfirmAsIsID);
if (tblConfirmAsIsElem && !this.SubmitOnly) {
tblConfirmAsIsElem.style.display = (anyChangesMade || this.isInternalWeb) ? 'none' : '';
}
};

ConfirmAsIs.prototype.OnDiscardChanges = function() {
 location.replace(window.location.href);
 return true;
};

ConfirmAsIs.prototype.OnSubmitChanges = function() {
 if ('none' == $(this.tblConfirmChangesID).style.display) {
 alert('You have reversed all your changes; there are no changes to submit.');
 return false;
 }
 $(this.tblConfirmChangesID).style.display = 'none';
 return true;
};

ConfirmAsIs.prototype.OnConfirmProductAsIs = function() {
 if ('none' == $(this.tblConfirmAsIsID).style.display) {
 // IE6 hack...
 // The user hit "Confirm Product As Is" but there are multi-version
 // changes. This is because the user hit the button before the focus
 // changed which raises the event that swaps the confirm button with
 // the submit/discard buttons.
 // The button swap event has now been fired, so all we need to do
 // here is abort the submit.
 alert('You have made changes; please click "Submit Changes" or "Discard Changes" below.');
 return false;
 }
 return true; 
};

ConfirmAsIs.prototype.FinalValidation = function() {

/* 4/20/09 MJ - IMPORTANT NOTE: Multi version pricing functionality will be disabled for business cards until CQ Phase 2 per/DK note.
if(this.productPricingObj.hasNameQtyPricing) {
var versionNamesAreValid = true;
var nameQtyPricingObj = NameQtyPricings[this.productPricingObj.nameQtyPricingID];
if (typeof(ProductCt) == 'undefined') {
ProductCt = 1;
}
  
for (i = 0; i < ProductCt; i++) {
for (j = 0; j < VersionCt[i]; j++) {
if (0 != VersionQty[i][j] && InitialNameText(i, j) == VersionName[i][j]) {
if (versionNamesAreValid) {
alert('Please enter a name for each business card.');
NameCtrl(i, j).focus();
versionNamesAreValid = false;
}
}
}
}
if (!versionNamesAreValid) {
return false;
}
}
*/

/*if (this.productPricingObj.hasInstaPrice) {
var instaPriceObj = InstaPrices[this.productPricingObj.instaPriceID];
var minQtyIsValid = true;
if (this.productPricingObj.hasNameQtyPricing) {
var nameQtyPricingObj = NameQtyPricings[this.productPricingObj.nameQtyPricingID];
minQtyIsValid = ((instaPriceObj.minQuantity * nameQtyPricingObj.GetVersionCount()) < nameQtyPricingObj.GetSumNameQuantities());
}
else {
minQtyIsValid = (instaPriceObj.minQuantity < instaPriceObj.quantity);
}

if (!minQtyIsValid) {
var msg = '';
if (this.productPricingObj.hasNameQtyPricing) {
msg = 'with ' + this.productPricingObj.GetVersionCount() + ' versions ';
}
alert('The minimum quantity to order ' + msg + 'is ' + instaPriceObj.minQuantity + '.');

return false;
}
}*/

if (typeof (CtrlStoreEmailID) != 'undefined' && '' != CtrlStoreEmailID) {
var ctrlStoreEmail = document.getElementById(CtrlStoreEmailID);
if (null != ctrlStoreEmail) {
if ('' == ctrlStoreEmail.value) {
alert('Please enter your store email address.');
return false;
}
}
}
return true;
};
/// <reference path="Enums/AttributeIDEnum.js" />
/// <reference path="Enums/AttributeValueIDEnum.js" />
/// <reference path="Enums/AttributeValueNameEnum.js" />
/// <reference path="Enums/NoValueEnum.js" />
var ConversionPricings;

function ConversionPricing(finishingPricingID, finishingID, rblName, imageID) {
this.imageID = imageID;
this.finishingPricingObj = new FinishingPricing(finishingPricingID, finishingID, rblName);

this.InsertConversionPricing();
}

ConversionPricing.prototype.InsertConversionPricing = function() {
if (typeof (ConversionPricings) == 'undefined') {
ConversionPricings = new Object;
}
ConversionPricings[this.finishingPricingObj.finishingPricingID] = this;
};

ConversionPricing.prototype.ResetConversion = function() {
SetRadioButtonListChecked(this.rblName, this.finishingID);
};

ConversionPricing.prototype.ChangeConversion = function(finishingID) {
this.finishingPricingObj.finishingID = finishingID;
if (this.productPricingObj) {
this.productPricingObj.HandleAttributePrices(AdjustTypeEnum.Conversion);
}
};

ConversionPricing.prototype.GetConversionPrice = function(finishingID, quantity, isCoverStock, productID, percentCollection, signatures) {
return this.finishingPricingObj.GetFinishingPrice(finishingID, quantity, productID, percentCollection, signatures, this.productPricingObj.quantityList);
};var Coupons;
var CouponValues;

function Coupon(couponCode, discountType, couponValues) {
this.couponCode = couponCode;
this.discountType = discountType;
this.couponValues = couponValues;

this.InsertCoupon();

this.InitializeCouponValues();
}

Coupon.prototype.InsertCoupon = function() {
if (typeof(Coupons) == 'undefined') {
Coupons = new Object;
}
Coupons[this.couponCode] = this;
};

Coupon.prototype.InitializeCouponValues = function() {
if (this.couponValues) {
for (var i = 0, loopCnt = this.couponValues.length; i < loopCnt; i++) {
this.couponValues[i].couponObj = this;
}
}
};

Coupon.prototype.GetCouponAmount = function(totalPrice) {
var couponValueObj;
for (var i = 0, loopCnt = this.couponValues.length; i < loopCnt; i++) {
couponValueObj = this.couponValues[i];
if (couponValueObj.minOrderAmt <= totalPrice) {
return (couponValueObj.amount) ? couponValueObj.amount : (couponValueObj.percent) ? couponValueObj.percent * totalPrice : 0;
}
}
return 0;
};

function CouponValue(couponValueID, amount, percent, minOrderAmt) {
this.couponValueID = couponValueID;
this.amount = amount;
this.percent = percent;
this.minOrderAmt = minOrderAmt;

this.InsertCouponValue();
}

CouponValue.prototype.InsertCouponValue = function() {
if (typeof(CouponValues) == 'undefined') {
CouponValues = new Object;
}
CouponValues[this.couponValueID] = this;
};
var FinishingAttributes;

function FinishingAttribute(finishingPricingID, finishingID, rblName, adjustTypeEnum) {
this.finishingPricingID = finishingPricingID;
this.finishingPricingObj = new FinishingPricing(finishingPricingID, finishingID, '');
this.rblName = rblName;
this.adjustTypeEnum = adjustTypeEnum;

this.Insert();
}

FinishingAttribute.prototype.Insert = function() {
if (typeof (FinishingAttributes) == 'undefined') {
FinishingAttributes = new Object;
}
FinishingAttributes[this.finishingPricingObj.finishingPricingID] = this;
};

FinishingAttribute.prototype.Reset = function() {
SetRadioButtonListChecked(this.rblName, this.finishingPricingObj.finishingID);
};

FinishingAttribute.prototype.ChangeID = function(finishingID) {
this.finishingPricingObj.SetFinishingID(finishingID);

if (this.productPricingObj) {
this.productPricingObj.HandleAttributePrices(this.adjustTypeEnum);
}
};/// <reference path="Enums/AttributeIDEnum.js" />
/// <reference path="Enums/AttributeValueIDEnum.js" />
/// <reference path="Enums/AttributeValueNameEnum.js" />
/// <reference path="Enums/AdjustTypeEnum.js" />
var FinishingPricings;

function FinishingPricing(finishingPricingID, finishingID, rblName) {
this.finishingPricingID = finishingPricingID;
this.finishingID = finishingID;
this.finishingIDOri = finishingID;
this.rblName = rblName;

this.InsertFinishingPricing();
}

FinishingPricing.prototype.InsertFinishingPricing = function() {
if (typeof(FinishingPricings) == 'undefined') {
FinishingPricings = new Object;
}
FinishingPricings[this.finishingPricingID] = this;
};

FinishingPricing.prototype.SetFinishingID = function(finishingID) {
this.finishingID = finishingID;
if (this.rblName != '') {
SetRadioButtonListChecked(this.rblName, finishingID);
}
};

FinishingPricing.prototype.IsChanged = function() {
 return (this.finishingIDOri != this.finishingID);
};

FinishingPricing.prototype.GetFinishingPrice = function(finishingID, quantity, productID, percentCollection, signatures, quantityList) {
 if (finishingID == '' || finishingID == 'undefined' || finishingID == null || quantity <= 0) { //check for NO value in finishing ID and zero quantity
 return 0;
 }
 var quantityBreak = 0;
 var productIndex;
 if (typeof (finishingArr[finishingID][productID]) != 'undefined') {
 productIndex = productID;
 }
 else { //no product override
 productIndex = '';
 }

 for (quantityBreak in finishingArr[finishingID][productIndex]) {
 if (quantity >= quantityBreak) {
 break;
 }
 }

 var totalWholeSignatures = 1;
 if (typeof (signatures) != 'undefined' && signatures != null) { //signatures exist
 totalWholeSignatures = 0;
 for (var s = 0, loopCnt = signatures.length; s < loopCnt; s++) {
 if (signatures[s].ContainsAttributeValueID(finishingID, null)) {
 totalWholeSignatures += signatures[s].TotalWholeSignatures();
 }
 }
 }

 if (finishingID == AttributeValueIDEnum.tab_tab ||
 finishingID == AttributeValueIDEnum.tab_manually_priced ||
 finishingID == AttributeValueIDEnum.tab_multi_tab) {
 percentCollection.SetCanApplyPercentVariables(AdjustTypeEnum.Mailing, ChannelID);
 }
 else {
 percentCollection.SetCanApplyPercentVariables(AdjustTypeEnum.Finishing, ChannelID);
 }

 var price = 0;
 // Calculate finishing price
 if (typeof (quantityList) != 'undefined' && quantityList.length != 0) { //business cards
 for (var i = 0, loopCnt = quantityList.length; i < loopCnt; i++) {
 price += this.CalculateFinishingPrice(quantityList[i], finishingArr[finishingID][productIndex][quantityBreak][FINISHING_IDX_BASE], finishingArr[finishingID][productIndex][quantityBreak][FINISHING_IDX_EACH], percentCollection, totalWholeSignatures);
 }
 }
 else { //one quantity products
 price = this.CalculateFinishingPrice(quantity, finishingArr[finishingID][productIndex][quantityBreak][FINISHING_IDX_BASE], finishingArr[finishingID][productIndex][quantityBreak][FINISHING_IDX_EACH], percentCollection, totalWholeSignatures);
 }
 return price;
};

FinishingPricing.prototype.CalculateFinishingPrice = function(quantity, finishingBase, finishingEach, percentCollection, totalWholeSignatures) {
var price = 0;

if (quantity > 0) //check that the quantity is greater than zero
{
price = totalWholeSignatures * (finishingBase + (quantity * finishingEach));
}

if (typeof(percentCollection) != 'undefined') {
return percentCollection.ApplyPricingPercents(price);
}
else {
return FormatDollar(price);
}
};

FinishingPricing.prototype.GetValidationObject = function(validateResult, validateMessage, finishingID) {
return {
VALIDATE_RESULT : validateResult,
VALIDATE_MESSAGE : validateMessage,
VALIDATE_FINISHINGID : finishingID
}
};

/// <reference path="Enums/AttributeIDEnum.js" />
/// <reference path="Enums/AttributeValueIDEnum.js" />
/// <reference path="Enums/AttributeValueNameEnum.js" />
/// <reference path="Enums/NoValueEnum.js" />
var FoldPricings;

function FoldPricing(finishingPricingID, finishingID, rblName, coverInside, imageID) {
this.coverInside = coverInside;
this.imageID = imageID;
this.finishingPricingObj = new FinishingPricing(finishingPricingID, finishingID, rblName);

this.InsertFoldPricing();
}

FoldPricing.prototype.InsertFoldPricing = function() {
if (typeof(FoldPricings) == 'undefined') {
FoldPricings = new Object;
}
FoldPricings[this.finishingPricingObj.finishingPricingID] = this;
};

FoldPricing.prototype.ResetFold = function() {
 SetRadioButtonListChecked(this.rblName, this.finishingID);
};

FoldPricing.prototype.ChangeFold = function(finishingID) {
this.ValidateFold(((this.productPricingObj) ? this.productPricingObj.productID : null), finishingID, ((this.productPricingObj) ? this.productPricingObj.IsCoverPaper() : null), false, false);

if (this.productPricingObj) {
LoadImage(this.imageID, foldImageArr[this.productPricingObj.productID][this.finishingPricingObj.finishingID]);
this.productPricingObj.HandleMailingBlankEnvelopes();
this.productPricingObj.HandleAttributePrices(AdjustTypeEnum.Fold);
}
};

FoldPricing.prototype.GetFoldPrice = function(finishingID, quantity, isCoverStock, productID, percentCollection, signatures) {
var foldPrice = 0;
 //check to see if paper is coverstock and there is a finishingID (fold selected)
 if (isCoverStock && finishingID != '')
 {
 //find the score for fold price product
 foldPrice += this.finishingPricingObj.GetFinishingPrice(AttributeValueIDEnum.scoringfold_score_for_folding, quantity, productID, percentCollection, null, this.productPricingObj.quantityList);
 }
 foldPrice += this.finishingPricingObj.GetFinishingPrice(finishingID, quantity, productID, percentCollection, signatures, this.productPricingObj.quantityList);
 return foldPrice;
};

FoldPricing.prototype.ValidateFold = function(productID, finishingID, isCoverPaper, forSizeChange, forPaperChange) {
 var ret = this.IsValidFold(productID, finishingID, isCoverPaper, forSizeChange, forPaperChange);
 if (!ret.VALIDATE_RESULT) {
 if (ret.VALIDATE_MESSAGE) {
 alert(ret.VALIDATE_MESSAGE);
 }
 this.finishingPricingObj.SetFinishingID(ret.VALIDATE_FINISHINGID);
 }
 else {
 this.finishingPricingObj.finishingID = finishingID;
 }
 return ret.VALIDATE_RESULT;
};

FoldPricing.prototype.IsValidFold = function(productID, finishingID, isCoverPaper, forSizeChange, forPaperChange) {
if ((productID == ProductIDEnum.statement_stuffers_3_5x7 || productID == ProductIDEnum.statement_stuffers_3_5x8_5 ||
 productID == ProductIDEnum.statement_stuffers_5_5x8_5) && finishingID && finishingID != null) {
return this.finishingPricingObj.GetValidationObject(false, 'This size statement stuffer cannot be folded.', (forSizeChange) ? finishingID : '');
}
else if (this.productPricingObj && this.productPricingObj.HasMailing() &&
 (productID == ProductIDEnum.newsletters_11x25_5 || productID == ProductIDEnum.brochures_11x25_5) && 
 finishingID == AttributeValueIDEnum.fold_open_gate_fold) {
 return this.finishingPricingObj.GetValidationObject(false, 'Mailing Services are not available for the ' + AttributeValueNameEnum[AttributeValueIDEnum.fold_open_gate_fold] + ' option.', this.finishingPricingObj.finishingID);
}
else if ((productID == ProductIDEnum.statement_stuffers_7x7 || productID == ProductIDEnum.statement_stuffers_7x8_5) && 
 (finishingID == AttributeValueIDEnum.fold_tri_fold || finishingID == AttributeValueIDEnum.fold_z_fold)) {
return this.finishingPricingObj.GetValidationObject(false, 'You cannot select a ' + AttributeValueNameEnum[AttributeValueIDEnum.fold_tri_fold] + ' or ' + AttributeValueNameEnum[AttributeValueIDEnum.fold_z_fold] + ' fold with this size statement stuffer.', this.finishingPricingObj.finishingID);
}
else if (finishingID == AttributeValueIDEnum.fold_tri_then_half_fold && isCoverPaper) {
return this.finishingPricingObj.GetValidationObject(false, AttributeValueNameEnum[AttributeValueIDEnum.fold_tri_then_half_fold] + ' is not available on cover stock.', (forPaperChange) ? AttributeValueIDEnum.fold_tri_fold : this.finishingPricingObj.finishingID);
}
return this.finishingPricingObj.GetValidationObject(true);
};

FoldPricing.prototype.ValidateNumPages = function(productID, numPages) {
this.finishingPricingObj.SetFinishingID((numPages == 4) ? AttributeValueIDEnum.fold_half_fold : AttributeValueIDEnum.foldcollatestaple_fold_collate_stitch);
};
var IMAGES_DIR = "../images";

function PreloadImageArrays() {
var imgArr = new Array();
if (typeof(inkImageArr) != 'undefined') {
for (var i in inkImageArr) {
if (typeof (inkImageArr[i]) != 'function') {
for (var j in inkImageArr[i]) {
if (typeof (inkImageArr[i][j]) != 'function') {
for (var k in inkImageArr[i][j]) {
if (typeof (inkImageArr[i][j][k]) != 'function') {
if (typeof (inkImageArr[i][j][k]) != 'function') {
for (var l in inkImageArr[i][j][k]) {
if (typeof (inkImageArr[i][j][k][l]) != 'function') {
imgArr[imgArr.length] = inkImageArr[i][j][k][l];
}
}
}
}
}
}
}
}
}
}
if (typeof(foldImageArr) != 'undefined') {
for (var i in foldImageArr) {
if (typeof (foldImageArr[i]) != 'function') {
for (var j in foldImageArr[i]) {
if (typeof (foldImageArr[i][j]) != 'function') {
imgArr[imgArr.length] = foldImageArr[i][j];
}
}
}
}
}
PreloadImages(imgArr, IMAGES_DIR);
}

function LoadImage(imageID, imgSrc, noImgDir) {
 var img = $(imageID)
 if (img != null && typeof(img) != 'undefined') {
 img.src = ((!noImgDir) ? IMAGES_DIR + '/' : '') + imgSrc;
 }
}
/// <reference path="Enums/AttributeIDEnum.js" />
/// <reference path="Enums/AttributeValueIDEnum.js" />
/// <reference path="Enums/AttributeValueNameEnum.js" />
/// <reference path="Enums/NoValueEnum.js" />
/// <reference path="Enums/ProductIDEnum.js" />
var InkPricings;
var VALIDATE_INK = 'Ink';

function InkPricing(inkPricingID, inkFID, inkBID, splitInk, inkFImageID, inkBImageID, rblInkFID, rblInkBID, coverInside, rblInkInsideName, txtPMSFront1, txtPMSFront2, txtPMSBack1, txtPMSBack2) {
this.inkPricingID = inkPricingID;
this.inkFID = inkFID;
this.inkFIDOri = inkFID;
this.inkBID = inkBID;
this.inkBIDOri = inkBID;
this.splitInk = splitInk;
this.inkFImageID = inkFImageID;
this.inkBImageID = inkBImageID;
this.rblInkFID = rblInkFID;
this.rblInkBID = rblInkBID;
this.coverInside = coverInside;
this.rblInkInsideName = rblInkInsideName;
this.txtPMSFront1 = txtPMSFront1;
this.txtPMSFront2 = txtPMSFront2;
this.txtPMSBack1 = txtPMSBack1;
this.txtPMSBack2 = txtPMSBack2;
this.txtPMSFront1Ori = txtPMSFront1;
this.txtPMSFront2Ori = txtPMSFront2;
this.txtPMSBack1Ori = txtPMSBack1;
this.txtPMSBack2Ori = txtPMSBack2;

if (typeof(coverInside) != 'undefined') {
this.forCover = (this.coverInside == CoverInsideEnum.ForCover);
this.forInside = (this.coverInside == CoverInsideEnum.ForInside);
}
this.InsertInkPricing();
}

InkPricing.prototype.InsertInkPricing = function() {
if (typeof(InkPricings) == 'undefined') {
InkPricings = new Object;
}
InkPricings[this.inkPricingID] = this;
};

InkPricing.prototype.ResetInk = function(productID) {
if (productID == ProductIDEnum.file_folders) { //ink radio button is combined
SetRadioButtonListChecked(this.rblInkFID, this.inkFID + '/' + this.inkBID);
}
else {
SetRadioButtonListChecked(this.rblInkFID, this.inkFID);
SetRadioButtonListChecked(this.rblInkBID, this.inkBID);
}
};

InkPricing.prototype.ChangeInk = function(side, ink) {
this.ValidateInk(side, ink);

if (this.productPricingObj) {
this.ChangeInkImage(side, ink, this.productPricingObj.GetPaperID());
this.productPricingObj.AdjustPrices(AdjustTypeEnum.Ink, this.inkPricingID);
if (ink.indexOf(InkEnum.DelimValue) > -1 && this.splitInk) { //check for inkID/spotID vs filefolders that are inkFID/inkBID
this.productPricingObj.AdjustPrices(AdjustTypeEnum.Spot, this.productPricingObj.spotPricingID);
this.ShowHidePMSColor(side);
this.ValidatePMSColor(side);
}
this.productPricingObj.HandleShowSubmitChanges();
}
};

InkPricing.prototype.ShowHidePMSColor = function (side) {
 var spotAttributeID;
 var sideName;
 if (side == AttributePlacementEnum.front) {
 spotAttributeID = SpotPricings[this.productPricingObj.spotPricingID].spotFID;
 sideName = 'Front';
 }
 else {
 spotAttributeID = SpotPricings[this.productPricingObj.spotPricingID].spotBID;
 sideName = 'Back';
 }

 switch (spotAttributeID) {
 case AttributeValueIDEnum.spot_spot_1:
 document.getElementById(sideName + 'PMS1').style.display = 'block';
 document.getElementById(sideName + 'PMS2').style.display = 'none';
 break;
 case AttributeValueIDEnum.spot_spot_2:
 document.getElementById(sideName + 'PMS1').style.display = 'block';
 document.getElementById(sideName + 'PMS2').style.display = 'block';
 break;
 default:
 document.getElementById(sideName + 'PMS1').style.display = 'none';
 document.getElementById(sideName + 'PMS2').style.display = 'none';
 }
};

InkPricing.prototype.ChangePMSComment = function(control) {
 var side = "Back";
 if (control.name.indexOf("Front") >= 0) {
 side = "Front"
 }
 var pmsCount = control.name.substring(control.name.length - 1, control.name.length);
 this["txtPMS" + side + pmsCount] = control.value;
 this.ValidatePMSColor(side);
};


InkPricing.prototype.ValidatePMSColor = function(side) {
 // No validation
 if (this.productPricingObj != 'undefined') {
 this.productPricingObj.HandleShowSubmitChanges();
 }
 return true;
};

InkPricing.prototype.ChangeInkImage = function(side, ink, paperID) {
 var inkImageID = (side == AttributePlacementEnum.back) ? this.inkBImageID : this.inkFImageID;

 if (typeof TemplateSelectionArr == "undefined") {
 var imgSrc = (this.splitInk) ? (ink.indexOf(InkEnum.DelimValue) > -1) ? (side == AttributePlacementEnum.front) ? inkImageArr[this.productPricingObj.productID][side][this.inkFID][SpotPricings[this.productPricingObj.spotPricingID].spotFID] : inkImageArr[this.productPricingObj.productID][side][this.inkBID][SpotPricings[this.productPricingObj.spotPricingID].spotBID] : inkImageArr[this.productPricingObj.productID][side][this.GetInk(side)][''] : inkImageArr[this.productPricingObj.productID][side][this.inkFID][this.inkBID];

 //hardcoded exception for Magnet Stock on business cards
 if (side == AttributePlacementEnum.back && this.productPricingObj.productID == ProductIDEnum.business_cards &&
paperID == AttributeValueIDEnum.paper_13_pt_magnet_stock) {
 imgSrc = "businesscardbackmagnet.jpg";
 }

 LoadImage(inkImageID, imgSrc);
 }
};

InkPricing.prototype.GetInk = function(side) {
if (typeof (side) != 'undefined') {
return (side == AttributePlacementEnum.front) ? this.inkFID : (side == AttributePlacementEnum.back) ? this.inkBID : (side == AttributePlacementEnum.inside) ? this.inkFID : this.inkFID + '/' + this.inkBID;
}
else {
if (this.inkFID == 'Custom' && this.inkBID == 'Custom') {
return 'Custom';
}
return this.inkFID + '/' + this.inkBID;
}
};

InkPricing.prototype.SetInk = function(side, ink) {
 var inkObj = this.GetSplitInk(side, ink);
 var inkValue = ink;
 this.inkFID = inkObj.inkFID;
 this.inkBID = inkObj.inkBID;
 if (side == AttributePlacementEnum.front) {
 if (inkObj.hasSpot) {
 SetRadioButtonListChecked(this.rblInkFID, ink);
 }
 else {
 SetRadioButtonListChecked(this.rblInkFID, this.inkFID);
 }
 }
 else if (side == AttributePlacementEnum.back) {
 if (inkObj.hasSpot) {
 SetRadioButtonListChecked(this.rblInkBID, ink);
 }
 else {
 SetRadioButtonListChecked(this.rblInkBID, this.inkBID);
 }
 }
 else if (side == AttributePlacementEnum.inside) {
 SetRadioButtonListChecked(this.rblInkInsideName, this.inkFID);
 }
};

InkPricing.prototype.GetSplitInk = function(side, ink) {
 var inkObj = new Object;
 inkObj.inkFID = this.inkFID;
 inkObj.inkBID = this.inkBID;
 if (this.splitInk) {
 if (ink.indexOf(InkEnum.DelimValue) == -1) {
 if (side == AttributePlacementEnum.front) {
 inkObj.inkFID = ink;
 }
 else if (side == AttributePlacementEnum.back) {
 inkObj.inkBID = ink;
 }
 }
 else {
 var inkArr = ink.split('/');
 inkObj.hasSpot = true;
 if (side == AttributePlacementEnum.front) {
 inkObj.inkFID = inkArr[0];
 }
 else if (side == AttributePlacementEnum.back) {
 inkObj.inkBID = inkArr[0];
 }
 if (typeof (SpotPricings[this.productPricingObj.spotPricingID]) != 'undefined') {
 SpotPricings[this.productPricingObj.spotPricingID].SetSpot(side, inkArr[1]);
 }
 }
 }
 else {
 if (this.forInside) {
 inkObj.inkFID = ink;
 inkObj.inkBID = ink;
 }
 else {
 var inkArr = ink.split('/');
 if (inkArr.length > 1) {
 inkObj.inkFID = inkArr[0];
 inkObj.inkBID = inkArr[1];
 }
 }
 }
 return inkObj;
};

InkPricing.prototype.GetTotalInkPrice = function(productID, quantity, signatures, percentCollection) {
var price = 0;
if (typeof (signatures) != 'undefined' && signatures != null) {
for (var s = 0, loopCnt = signatures.length; s < loopCnt; s++) {
price += this.GetInkPrice(productID, signatures[s].GetAttributeValueID(AttributeIDEnum.ink, AttributePlacementEnum.front), quantity, signatures[s].TotalSignaturePricingPercent(), percentCollection) +
this.GetInkPrice(productID, signatures[s].GetAttributeValueID(AttributeIDEnum.ink, AttributePlacementEnum.back), quantity, signatures[s].TotalSignaturePricingPercent(), percentCollection);
}
}
else {
price = this.GetInkPrice(productID, this.inkFID, quantity, 1, percentCollection) +
this.GetInkPrice(productID, this.inkBID, quantity, 1, percentCollection);
}
return price;
};

InkPricing.prototype.GetInkPrice = function(productID, inkID, quantity, signaturePricingPercent, percentCollection) {
var inkBase = this.GetInkPricing(productID, inkID, PriceForEnum.Base);
var inkEach = this.GetInkPricing(productID, inkID, PriceForEnum.Each);

percentCollection.SetCanApplyPercentVariables(AdjustTypeEnum.Ink, ChannelID);

var price = 0;
// Calculate ink price
if (this.productPricingObj && this.productPricingObj.quantityList.length != 0) { //business cards
var quantityList = this.productPricingObj.quantityList;
for(var i = 0, loopCnt = quantityList.length; i < loopCnt; i++) { //loop through version quantities
price += this.CalculateInkPrice(quantityList[i], signaturePricingPercent, inkBase, inkEach, percentCollection);
}
}
else { //one quantity products
price = this.CalculateInkPrice(quantity, signaturePricingPercent, inkBase, inkEach, percentCollection);
}
return price;
};

InkPricing.prototype.GetInkPricing = function(productID, inkID, priceFor) {
if (inkID == '') {
return 0;
}
return inkArr[productID][eval('INK_IDX_' + this.GetInkName(inkID).replace('-', '').toUpperCase() + '_' + priceFor.toUpperCase())];
};

InkPricing.prototype.GetInkName = function(inkID) {
switch (inkID) {
case AttributeValueIDEnum.ink_4_color:
case AttributeValueIDEnum.ink_black:
return AttributeValueNameEnum[inkID];
case AttributeValueIDEnum.spot_spot_1:
case AttributeValueIDEnum.spot_spot_2:
case AttributeValueIDEnum.spot_spot_3:
case AttributeValueIDEnum.spot_spot_4:
case AttributeValueIDEnum.spot_spot_5:
return AttributeValueNameEnum[inkID].replace(' PMS', 'Spot');
default:
 return NoValueEnum[AttributeIDEnum.ink];
 }
};

InkPricing.prototype.CalculateInkPrice = function(quantity, signaturePricingPercent, inkBase, inkEach, percentCollection) {
var price;

price = signaturePricingPercent * (inkBase + (quantity * inkEach));

if (typeof(percentCollection) != 'undefined') {
return percentCollection.ApplyPricingPercents(price);
}
else {
return FormatDollar(price);
}
};

InkPricing.prototype.ValidateInk = function(side, ink) {
var ret = this.IsValidInk(side, ink);
if (!ret.VALIDATE_RESULT) {
if (ret.VALIDATE_MESSAGE) {
alert(ret.VALIDATE_MESSAGE);
}
this.SetInk(side, ret.VALIDATE_INK);
}
else {
this.SetInk(side, ink);
}
return ret.VALIDATE_RESULT;
};

InkPricing.prototype.IsValidInk = function(side, ink) {
var inkObj = this.GetSplitInk(side, ink);
var retObj = this.productPricingObj.HandleInkChange(inkObj.inkFID, inkObj.inkBID);
if (!retObj.success) {
return this.GetValidationObject(false, '', ((',' + retObj.errorType + ',').indexOf(',' + AdjustTypeEnum.Ink + ',') != -1) ? this.GetInk(side) : ink);
}
else {
return this.GetValidationObject(true);
}
};

InkPricing.prototype.GetValidationObject = function(validateResult, validateMessage, ink) {
return {
VALIDATE_RESULT : validateResult,
VALIDATE_MESSAGE : validateMessage,
VALIDATE_INK : ink
};
};

InkPricing.prototype.ValidateNumPages = function(isDisabled) {
 if (this.forInside) {
if (isDisabled) {
var rblInkInsideElem = $(this.rblInkInsideName);
if (rblInkInsideElem) {
var inkFID = rblInkInsideElem[0].value;
if (this.inkFID != inkFID) {
this.ChangeInk(AttributePlacementEnum.inside, inkFID);
}
}
}
SetRadioButtonListDisabled(this.rblInkInsideName, isDisabled, 0);
}
};

InkPricing.prototype.IsChanged = function() {
 return (this.inkFIDOri != this.inkFID ||
 this.inkBIDOri != this.inkBID ||
 this.txtPMSFront1Ori != this.txtPMSFront1 ||
 this.txtPMSFront2Ori != this.txtPMSFront2 ||
 this.txtPMSBack1Ori != this.txtPMSBack1 ||
 this.txtPMSBack2Ori != this.txtPMSBack2);
};

InkPricing.prototype.SetPMSFocus = function(obj, setString) {
obj.value = setString;
if (obj.createTextRange) {
var range = obj.createTextRange();
range.collapse(true);
range.moveEnd('character', 4);
range.moveStart('character', 4);
range.select();
}
};
var InstaPrices;

function InstaPrice(instaPriceID, isChangeProductOptions, quantity, minQuantity, maxQuantity, quantityInputID, isChangeOrder, couponDiscountPercent, PFLProSettings) {
this.instaPriceID = instaPriceID;
this.isChangeProductOptions = isChangeProductOptions;
this.quantity = quantity;
this.minQuantity = minQuantity;
this.maxQuantity = maxQuantity;
this.quantityInputID = quantityInputID;
this.isChangeOrder = isChangeOrder;
this.upgradeDiscountPrice = 0;
this.couponDiscountPercent = couponDiscountPercent;
this.specialDiscountPrice = 0;
this.PFLProSettings = PFLProSettings;

this.InsertInstaPrice();
}

InstaPrice.prototype.InsertInstaPrice = function() {
if (typeof(InstaPrices) == 'undefined') {
InstaPrices = new Object;
}
InstaPrices[this.instaPriceID] = this;
};

InstaPrice.prototype.ResetQuantity = function() {
 SetValue(this.quantityInputID, this.quantity);
};

InstaPrice.prototype.SetLabelIDs = function(lblBasePrintingPriceID, lblCoverBasePrintingPriceID, lblInsideBasePrintingPriceID, lblAqueousCoatingID, lblCoverGlossVarnishID, lblPaperUpgradeID, lblCoverPaperUpgradeID, lblInsidePaperUpgradeID, lblFoldingID, lblInsideFoldCollateStapleID, lblSealID, lblRoundCornerID, lblEnvelopesID, lblSecondSheetsID, lblRushChargeID, lblShippingHandlingID, lblMailingServicesID, lblPrintingSubtotalID, lblPrintingCostEachID, lblOrderTotalID, lblHiVolDiscountID, lblCouponDiscountID, lblDiscountedTotalID, lblUnitCostID, rowHiVolDiscountID, rowCouponDiscountID, rowDiscountedTotalID, lblPaddingID, lblVariableDataID, lblPFLProDiscount, lblPFLProDiscountSavings, lblPFLProRushSavings, lblPFLProProofSavings, lblPFLProTotalSavings, lblPFLProSavingsPercent) {
 this.lblBasePrintingPriceID = lblBasePrintingPriceID;
 this.lblCoverBasePrintingPriceID = lblCoverBasePrintingPriceID;
 this.lblInsideBasePrintingPriceID = lblInsideBasePrintingPriceID;
 this.lblAqueousCoatingID = lblAqueousCoatingID;
 this.lblCoverGlossVarnishID = lblCoverGlossVarnishID;
 this.lblPaperUpgradeID = lblPaperUpgradeID;
 this.lblCoverPaperUpgradeID = lblCoverPaperUpgradeID;
 this.lblInsidePaperUpgradeID = lblInsidePaperUpgradeID;
 this.lblFoldingID = lblFoldingID;
 this.lblInsideFoldCollateStapleID = lblInsideFoldCollateStapleID;
 this.lblSealID = lblSealID;
 this.lblRoundCornerID = lblRoundCornerID;
 this.lblEnvelopesID = lblEnvelopesID;
 this.lblSecondSheetsID = lblSecondSheetsID;
 this.lblRushChargeID = lblRushChargeID;
 this.lblShippingHandlingID = lblShippingHandlingID;
 this.lblMailingServicesID = lblMailingServicesID;
 this.lblPrintingSubtotalID = lblPrintingSubtotalID;
 this.lblPrintingCostEachID = lblPrintingCostEachID;
 this.lblOrderTotalID = lblOrderTotalID;
 this.lblHiVolDiscountID = lblHiVolDiscountID;
 this.lblCouponDiscountID = lblCouponDiscountID;
 this.lblDiscountedTotalID = lblDiscountedTotalID;
 this.lblUnitCostID = lblUnitCostID;
 this.rowHiVolDiscountID = rowHiVolDiscountID;
 this.rowCouponDiscountID = rowCouponDiscountID;
 this.rowDiscountedTotalID = rowDiscountedTotalID;
 this.lblPaddingID = lblPaddingID;
 this.lblVariableDataID = lblVariableDataID;
 this.lblPFLProDiscount = lblPFLProDiscount;
 this.lblPFLProDiscountSavings = lblPFLProDiscountSavings;
 this.lblPFLProRushSavings = lblPFLProRushSavings;
 this.lblPFLProProofSavings = lblPFLProProofSavings;
 this.lblPFLProTotalSavings = lblPFLProTotalSavings;
 this.lblPFLProSavingsPercent = lblPFLProSavingsPercent;
};

InstaPrice.prototype.SetChangeLabelIDs = function(lblChangePrintingID, lblChangePaperID, lblChangeAqueousID, lblChangeRoundCornersID, lblChangeFoldID, lblChangeEnvelopesID, lblChangeProdSpeedID, lblChangeShipMethodID, lblChangeMailingMethodID, lblPriceChangeSubTotalID, lblUpdatedProdTotalID, lblChangeInsidePrinting, lblChangeInsidePaper, lblPriceChangeUpgradeDiscount, lblPriceChangeCouponDiscount, lblPriceChangeSpecialDiscountID, lblUpdatedCostEachID, lblChangeFoldCollateStaple, lblChangeSecondSheets, lblPriceChangeHiVolDiscount, lblChangeSeal, lblChangePaddingID, lblChangeVariableDataID, lblPriceChangePFLProDiscount) {
 this.lblChangePrintingID = lblChangePrintingID;
 this.lblChangePaperID = lblChangePaperID;
 this.lblChangeAqueousID = lblChangeAqueousID;
 this.lblChangeRoundCornersID = lblChangeRoundCornersID;
 this.lblChangeFoldID = lblChangeFoldID;
 this.lblChangeEnvelopesID = lblChangeEnvelopesID;
 this.lblChangeProdSpeedID = lblChangeProdSpeedID;
 this.lblChangeShipMethodID = lblChangeShipMethodID;
 this.lblChangeMailingMethodID = lblChangeMailingMethodID;
 this.lblPriceChangeSubTotalID = lblPriceChangeSubTotalID;
 this.lblUpdatedProdTotalID = lblUpdatedProdTotalID;
 this.lblChangeInsidePrinting = lblChangeInsidePrinting;
 this.lblChangeInsidePaper = lblChangeInsidePaper;
 this.lblPriceChangeUpgradeDiscount = lblPriceChangeUpgradeDiscount;
 this.lblPriceChangeCouponDiscount = lblPriceChangeCouponDiscount;
 this.lblPriceChangeSpecialDiscountID = lblPriceChangeSpecialDiscountID;
 this.lblUpdatedCostEachID = lblUpdatedCostEachID;
 this.lblChangeFoldCollateStaple = lblChangeFoldCollateStaple;
 this.lblChangeSecondSheets = lblChangeSecondSheets;
 this.lblPriceChangeHiVolDiscount = lblPriceChangeHiVolDiscount;
 this.lblChangeSeal = lblChangeSeal;
 this.lblChangePaddingID = lblChangePaddingID;
 this.lblChangeVariableDataID = lblChangeVariableDataID;
 this.lblPriceChangePFLProDiscount = lblPriceChangePFLProDiscount;
};

InstaPrice.prototype.SetOriginalPrices = function(basePrintingPrice, baseProductPrice, baseDieCutPrice, baseDrillholePrice, insideBaseDrillholePrice, baseInkPrice, coverBaseInkPrice, insideBaseInkPrice, baseSpotPrice, coverBaseSpotPrice, insideBaseSpotPrice, basePaperPrice, coverBasePaperPrice, insideBasePaperPrice, aqueousPrice, coverGlossVarnishPrice, paperUpgradePrice, coverPaperUpgradePrice, insidePaperUpgradePrice, foldPrice, insideFoldCollateStaple, sealPrice, roundCornerPrice, envelopePrice, secondSheetPrice, turnaroundPrice, shipTypePrice, mailingPrice, printingSubtotal, totalPrice, hiVolDiscount, promotionalDiscount, referralDiscount, discountPrice, additionalMarkupPercent, doNotSetOri, insideBasePrintingPrice, couponDiscount, baseConversionPrice, paddingPrice, sheetsPerUnitPrice, backingPrice, coverPrice, bindingPrice, variableDataPrice, imprintPrice, imprintColorPrice, collatePrice, pflProDiscount, pflProRushSavings, pflProProofSavings) {
 this.basePrintingPrice = basePrintingPrice;
 this.baseProductPrice = baseProductPrice;
 this.baseDieCutPrice = baseDieCutPrice;
 this.baseDrillholePrice = baseDrillholePrice;
 this.insideBaseDrillholePrice = insideBaseDrillholePrice;
 this.baseInkPrice = baseInkPrice;
 this.coverBaseInkPrice = coverBaseInkPrice;
 this.insideBaseInkPrice = insideBaseInkPrice;
 this.baseSpotPrice = baseSpotPrice;
 this.coverBaseSpotPrice = coverBaseSpotPrice;
 this.insideBaseSpotPrice = insideBaseSpotPrice;
 this.basePaperPrice = basePaperPrice;
 this.coverBasePaperPrice = coverBasePaperPrice;
 this.insideBasePaperPrice = insideBasePaperPrice;
 this.aqueousPrice = aqueousPrice;
 this.coverGlossVarnishPrice = coverGlossVarnishPrice;
 this.paperUpgradePrice = paperUpgradePrice;
 this.coverPaperUpgradePrice = coverPaperUpgradePrice;
 this.insidePaperUpgradePrice = insidePaperUpgradePrice;
 this.foldPrice = foldPrice;
 this.insideFoldCollateStaple = insideFoldCollateStaple;
 this.sealPrice = sealPrice;
 this.roundCornerPrice = roundCornerPrice;
 this.envelopePrice = envelopePrice;
 this.secondSheetPrice = secondSheetPrice;
 this.turnaroundPrice = turnaroundPrice;
 this.shipTypePrice = shipTypePrice;
 this.mailingPrice = mailingPrice;
 this.printingSubtotal = printingSubtotal;
 this.totalPrice = totalPrice;
 this.hiVolDiscount = hiVolDiscount;
 this.promotionalDiscount = promotionalDiscount;
 this.referralDiscount = referralDiscount;
 this.discountPrice = discountPrice;
 this.additionalMarkupPercent = additionalMarkupPercent;
 this.insideBasePrintingPrice = insideBasePrintingPrice;
 this.couponDiscount = couponDiscount;
 if (typeof (baseConversionPrice) == 'undefined') {
 baseConversionPrice = 0;
 }
 this.baseConversionPrice = baseConversionPrice;
 if (typeof (paddingPrice) == 'undefined') {
 paddingPrice = 0;
 }
 this.paddingPrice = paddingPrice;
 if (typeof (sheetsPerUnitPrice) == 'undefined') {
 sheetsPerUnitPrice = 0;
 }
 this.sheetsPerUnitPrice = sheetsPerUnitPrice;
 if (typeof (backingPrice) == 'undefined') {
 backingPrice = 0;
 }
 this.backingPrice = backingPrice;
 if (typeof (coverPrice) == 'undefined') {
 coverPrice = 0;
 }
 this.coverPrice = coverPrice;
 if (typeof (bindingPrice) == 'undefined') {
 bindingPrice = 0;
 }
 this.bindingPrice = bindingPrice;
 if (typeof (variableDataPrice) == 'undefined') {
 variableDataPrice = 0;
 }
 this.variableDataPrice = variableDataPrice;
 if (typeof (imprintPrice) == 'undefined') {
 imprintPrice = 0;
 }
 this.imprintPrice = imprintPrice;
 if (typeof (imprintColorPrice) == 'undefined') {
 imprintColorPrice = 0;
 }
 this.imprintColorPrice = imprintColorPrice;
 if (typeof (collatePrice) == 'undefined') {
 collatePrice = 0;
 }
 this.collatePrice = collatePrice;
 if (typeof (pflProDiscount) == 'undefined') {
 pflProDiscount = 0;
 }
 this.pflProDiscount = pflProDiscount;
 if (typeof (pflProRushSavings) == 'undefined') {
 pflProRushSavings = 0;
 }
 this.pflProRushSavings = pflProRushSavings;
 if (typeof (pflProProofSavings) == 'undefined') {
 pflProProofSavings = 0;
 }
 this.pflProProofSavings = pflProProofSavings;

 if (this.isChangeProductOptions && !doNotSetOri) {
 this.basePrintingPriceOri = basePrintingPrice;
 this.baseProductPriceOri = baseProductPrice;
 this.baseDieCutPriceOri = baseDieCutPrice;
 this.baseDrillholePriceOri = baseDrillholePrice;
 this.insideBaseDrillholePriceOri = insideBaseDrillholePrice;
 this.baseInkPriceOri = baseInkPrice;
 this.coverBaseInkPriceOri = coverBaseInkPrice;
 this.insideBaseInkPriceOri = insideBaseInkPrice;
 this.baseSpotPriceOri = baseSpotPrice;
 this.coverBaseSpotPriceOri = coverBaseSpotPrice;
 this.insideBaseSpotPriceOri = insideBaseSpotPrice;
 this.basePaperPriceOri = basePaperPrice;
 this.coverBasePaperPriceOri = coverBasePaperPrice;
 this.insideBasePaperPriceOri = insideBasePaperPrice;
 this.aqueousPriceOri = aqueousPrice;
 this.coverGlossVarnishPriceOri = coverGlossVarnishPrice;
 this.paperUpgradePriceOri = paperUpgradePrice;
 this.coverPaperUpgradePriceOri = coverPaperUpgradePrice;
 this.insidePaperUpgradePriceOri = insidePaperUpgradePrice;
 this.foldPriceOri = foldPrice;
 this.insideFoldCollateStapleOri = insideFoldCollateStaple;
 this.sealPriceOri = sealPrice;
 this.roundCornerPriceOri = roundCornerPrice;
 this.envelopePriceOri = envelopePrice;
 this.secondSheetPriceOri = secondSheetPrice;
 this.turnaroundPriceOri = turnaroundPrice;
 this.shipTypePriceOri = shipTypePrice;
 this.mailingPriceOri = mailingPrice;
 this.printingSubtotalOri = printingSubtotal;
 this.totalPriceOri = totalPrice;
 this.hiVolDiscountOri = hiVolDiscount;
 this.promotionalDiscountOri = promotionalDiscount;
 this.referralDiscountOri = referralDiscount;
 this.discountPriceOri = discountPrice;
 this.additionalMarkupPercentOri = additionalMarkupPercent;
 this.insideBasePrintingPriceOri = insideBasePrintingPrice;
 this.couponDiscountOri = couponDiscount;
 this.baseConversionPriceOri = baseConversionPrice;
 this.paddingPriceOri = paddingPrice;
 this.sheetsPerUnitPriceOri = sheetsPerUnitPrice;
 this.backingPriceOri = backingPrice;
 this.coverPriceOri = coverPrice;
 this.bindingPriceOri = bindingPrice;
 this.variableDataPriceOri = variableDataPrice;
 this.imprintPriceOri = imprintPrice;
 this.imprintColorPriceOri = imprintColorPrice;
 this.collatePriceOri = collatePrice;
 this.pflProDiscountOri = pflProDiscount;
 }
};

InstaPrice.prototype.SetCoupons = function(coupons) {
this.coupons = coupons;
this.AdjustCouponPrices();
};

InstaPrice.prototype.ChangeQuantity = function(quantity, loc, confirmMessage) {
 this.ValidateQuantity(ParseInt(quantity), loc, confirmMessage);

 if (this.productPricingObj) {
 this.productPricingObj.HandleQuantityChange(this.quantity);
 this.productPricingObj.HandleShowSubmitChanges();
 }

 if (typeof (this.PFLProSettings) != 'undefined' && this.PFLProSettings != null) {
 this.AdjustTotalPrices();
 this.RenderPercent(this.lblPFLProSavingsPercent, this.GetPFLProSavingsPercent());
 }
};

InstaPrice.prototype.SetQuantity = function(quantity) {
this.quantity = quantity;
if ('undefined' != $(this.quantityInputID).value) {
// For Total Quantity textbox.
$(this.quantityInputID).value = this.quantity;
}
if ('undefined' != $(this.quantityInputID).innerHTML && '' != $(this.quantityInputID).innerHTML) {
// For Total Quantity label.
$(this.quantityInputID).innerHTML = this.quantity;
}
};

InstaPrice.prototype.SetVersionCt = function(versionCt) {
this.versionCt = versionCt;
};

InstaPrice.prototype.ChangeAdditionalMarkupPercent = function(additionalMarkupPercent) {
this.additionalMarkupPercent = additionalMarkupPercent;

if (this.productPricingObj) {
this.productPricingObj.HandleAdditionalMarkupPercentChange(this.additionalMarkupPercent);
}
};

InstaPrice.prototype.ChangeProofType = function(proofType) {
 this.pflProProofSavings = this.GetProofSavings(proofType);
 this.RenderPrice(this.lblPFLProProofSavings, this.pflProProofSavings);
 this.RenderPrice(this.lblPFLProTotalSavings, this.GetPFLProTotalSavings());
 this.RenderPercent(this.lblPFLProSavingsPercent, this.GetPFLProSavingsPercent());
};

InstaPrice.prototype.GetProofSavings = function(proofType) {
 var savings;
 switch (proofType) {
 case ProofTypeEnum.DHPValue:
 savings = 30;
 break;
 case ProofTypeEnum.PPValue:
 savings = 100;
 break;
 default:
 savings = 0;
 break;
 }
 return savings;
};

InstaPrice.prototype.AdjustBasePrintingPrice = function(coverInside) {
 if (coverInside == CoverInsideEnum.ForCover) {
this.coverBasePrintingPrice = this.GetBasePrintingPrice(coverInside);
}
else if (coverInside == CoverInsideEnum.ForInside) {
this.insideBasePrintingPrice = this.GetBasePrintingPrice(coverInside);
}
else {
this.basePrintingPrice = this.GetBasePrintingPrice(coverInside);
}
this.RenderPrice(this.GetLblBasePrintingPriceID(coverInside), this.GetBasePrintingPrice(coverInside));
this.AdjustTotalPrices();
};

InstaPrice.prototype.GetLblBasePrintingPriceID = function(coverInside) {
return (coverInside == CoverInsideEnum.ForCover) ? this.lblCoverBasePrintingPriceID : (coverInside == CoverInsideEnum.ForInside) ? this.lblInsideBasePrintingPriceID : this.lblBasePrintingPriceID;
};

InstaPrice.prototype.AdjustBaseProductPrice = function(price) {
this.baseProductPrice = price;
this.AdjustBasePrintingPrice();
this.AdjustTotalPrices();
};

InstaPrice.prototype.AdjustBaseDieCutPrice = function(price) {
this.baseDieCutPrice = price;
this.AdjustBasePrintingPrice();
this.AdjustTotalPrices();
};

InstaPrice.prototype.AdjustBaseDrillholePrice = function(price, coverInside) {
if (coverInside == CoverInsideEnum.ForInside) {
this.insideBaseDrillholePrice = price;
}
else {
this.baseDrillholePrice = price;
}
this.AdjustBasePrintingPrice(coverInside);
this.AdjustTotalPrices();
};

InstaPrice.prototype.AdjustBaseInkPrice = function(price, coverInside) {
if (coverInside == CoverInsideEnum.ForCover) {
this.coverBaseInkPrice = price;
}
else if (coverInside == CoverInsideEnum.ForInside) {
this.insideBaseInkPrice = price;
}
else {
this.baseInkPrice = price;
}
this.AdjustBasePrintingPrice(coverInside);
this.AdjustTotalPrices();
};

InstaPrice.prototype.AdjustBaseSpotPrice = function(price, coverInside) {
 if (coverInside == CoverInsideEnum.ForCover) {
 this.coverBaseSpotPrice = price;
 }
 else if (coverInside == CoverInsideEnum.ForInside) {
 this.insideBaseSpotPrice = price;
 }
 else {
 this.baseSpotPrice = price;
 }
 this.AdjustBasePrintingPrice(coverInside);
 this.AdjustTotalPrices();
};

InstaPrice.prototype.AdjustAqueousPrice = function(price, coverInside) {
if (coverInside == CoverInsideEnum.ForCover) {
this.coverGlossVarnishPrice = price;
}
else {
this.aqueousPrice = price;
}
this.RenderPrice(this.GetLblAqueousPriceID(coverInside), price);
this.AdjustTotalPrices();
};

InstaPrice.prototype.GetLblAqueousPriceID = function(coverInside) {
return (coverInside == CoverInsideEnum.ForCover) ? this.lblCoverGlossVarnishID : this.lblAqueousCoatingID;
};

InstaPrice.prototype.AdjustPaperBasePrice = function(price, coverInside) {
 if (coverInside == CoverInsideEnum.ForCover) {
 this.coverBasePaperPrice = price;
 }
 else if (coverInside == CoverInsideEnum.ForInside) {
 this.insideBasePaperPrice = price;
 }
 else {
 this.basePaperPrice = price;
 }

 this.AdjustBasePrintingPrice(coverInside);
 this.AdjustTotalPrices();
};

InstaPrice.prototype.AdjustPaperUpgradePrice = function(price, coverInside) {
 if (coverInside == CoverInsideEnum.ForCover) {
 this.coverPaperUpgradePrice = price;
 }
 else if (coverInside == CoverInsideEnum.ForInside) {
 this.insidePaperUpgradePrice = price;
 }
 else {
 this.paperUpgradePrice = price;
 }
 this.RenderPrice(this.GetLblPaperUpgradeID(coverInside), price);
 this.AdjustTotalPrices();
};

InstaPrice.prototype.GetLblPaperUpgradeID = function(coverInside) {
return (coverInside == CoverInsideEnum.ForCover) ? this.lblCoverPaperUpgradeID : (coverInside == CoverInsideEnum.ForInside) ? this.lblInsidePaperUpgradeID : this.lblPaperUpgradeID;
};

InstaPrice.prototype.AdjustFoldPrice = function(price, coverInside) {
if (coverInside == CoverInsideEnum.ForInside) {
this.insideFoldCollateStaple = price;
}
else {
this.foldPrice = price;
}
this.RenderPrice(this.GetLblFoldPriceID(coverInside), price);
this.AdjustTotalPrices();
};

InstaPrice.prototype.GetLblFoldPriceID = function(coverInside) {
return (coverInside == CoverInsideEnum.ForInside) ? this.lblInsideFoldCollateStapleID : this.lblFoldingID;
};

InstaPrice.prototype.AdjustConversionPrice = function(price) {
this.baseConversionPrice = price;
this.AdjustBasePrintingPrice();
this.AdjustTotalPrices();
};

InstaPrice.prototype.AdjustBindingPrice = function(price) {
 this.bindingPrice = price;
 this.AdjustPaddingPrice();
 this.AdjustTotalPrices();
};

InstaPrice.prototype.AdjustSheetsPerUnitPrice = function(price) {
 this.sheetsPerUnitPrice = price;
 this.AdjustPaddingPrice();
 this.AdjustTotalPrices();
};

InstaPrice.prototype.AdjustCollatePrice = function(price) {
 this.collatePrice = price;
 this.AdjustPaddingPrice();
 this.AdjustTotalPrices();
};

InstaPrice.prototype.AdjustBackingPrice = function(price) {
this.backingPrice = price;
this.AdjustPaddingPrice();
this.AdjustTotalPrices();
};

InstaPrice.prototype.AdjustCoverPrice = function(price) {
this.coverPrice = price;
this.AdjustPaddingPrice();
this.AdjustTotalPrices();
};

InstaPrice.prototype.AdjustSealPrice = function(price) {
 this.sealPrice = price;
 this.RenderPrice(this.lblSealID, price);
 this.AdjustTotalPrices();
};

InstaPrice.prototype.AdjustRoundCornerPrice = function(price) {
this.roundCornerPrice = price;
this.RenderPrice(this.lblRoundCornerID, price);
this.AdjustTotalPrices();
};

InstaPrice.prototype.AdjustEnvelopePrice = function(price) {
this.envelopePrice = price;
this.RenderPrice(this.lblEnvelopesID, price);
this.AdjustTotalPrices();
};

InstaPrice.prototype.AdjustSecondSheetPrice = function(price) {
this.secondSheetPrice = price;
this.RenderPrice(this.lblSecondSheetsID, price);
this.AdjustTotalPrices();
};

InstaPrice.prototype.AdjustTurnaroundPrice = function(price, ipPrice) {
 this.turnaroundPrice = price;
 this.RenderPrice(this.lblRushChargeID, price);
 if (typeof (this.PFLProSettings) != 'undefined' && this.PFLProSettings != null) {
 this.pflProRushSavings = ipPrice - price;
 this.RenderPrice(this.lblPFLProRushSavings, this.pflProRushSavings);
 this.RenderPrice(this.lblPFLProTotalSavings, this.GetPFLProTotalSavings());
 this.RenderPercent(this.lblPFLProSavingsPercent, this.GetPFLProSavingsPercent());
 }
 this.AdjustTotalPrices();
};

InstaPrice.prototype.AdjustShipTypePrice = function(price) {
this.shipTypePrice = price;
this.RenderPrice(this.lblShippingHandlingID, price);
this.AdjustTotalPrices();
};

InstaPrice.prototype.AdjustMailingPrice = function(price) {
this.mailingPrice = price;
this.RenderPrice(this.lblMailingServicesID, price);
this.AdjustTotalPrices();
};

InstaPrice.prototype.AdjustImprintPrice = function(price) {
 this.imprintPrice = price;
 this.AdjustVariableDataPrice();
 this.AdjustTotalPrices();
};

InstaPrice.prototype.AdjustImprintColorPrice = function(price) {
 this.imprintColorPrice = price;
 this.AdjustVariableDataPrice();
 this.AdjustTotalPrices();
};

InstaPrice.prototype.AdjustVariableDataPrice = function() {
 this.variableDataPrice = this.GetVariableDataPrice();
 this.RenderPrice(this.lblVariableDataID, this.variableDataPrice);
};

InstaPrice.prototype.AdjustPaddingPrice = function() {
 this.paddingPrice = this.GetPaddingPrice();
 this.RenderPrice(this.lblPaddingID, this.paddingPrice);
};

InstaPrice.prototype.GetVariableDataPrice = function() {
 return this.imprintPrice + this.imprintColorPrice;
};

InstaPrice.prototype.GetPaddingPrice = function() {
 return this.bindingPrice + this.sheetsPerUnitPrice + this.collatePrice + this.backingPrice + this.coverPrice;
};

InstaPrice.prototype.AdjustPFLProDiscount = function() {
 if (typeof (this.PFLProSettings) != 'undefined' && this.PFLProSettings != null) {
 var pflProDiscount = Math.round((this.GetPrintingSubtotal() +
 this.envelopePrice + 
 this.secondSheetPrice) * (this.PFLProSettings.Discount)) * .01;
 this.pflProDiscount = 0;
 if (pflProDiscount >= this.hiVolDiscount) {
 this.pflProDiscount = pflProDiscount;
 }
 this.RenderPrice(this.lblPFLProDiscount, this.pflProDiscount);
 this.RenderPrice(this.lblPFLProDiscountSavings, Math.max(this.hiVolDiscount, this.pflProDiscount));
 this.RenderPrice(this.lblPFLProTotalSavings, this.GetPFLProTotalSavings());
 this.RenderPercent(this.lblPFLProSavingsPercent, this.GetPFLProSavingsPercent());
 }
};

InstaPrice.prototype.AdjustCouponPrices = function() {
this.hiVolDiscount = 0;
this.promotionalDiscount = 0;
this.referralDiscount = 0;

if (this.coupons) {
var couponCode;
var discountType;
var couponAmount;
var totalCouponAmount = 0;
var txtCouponCodeElem;
var hiVolDiscount = 0;

for (var i = 0, loopCnt = this.coupons.length; i < loopCnt; i++) {
couponCode = this.coupons[i].couponCode;
discountType = this.coupons[i].discountType;
if (this.isChangeOrder) {
couponAmount = this.coupons[i].GetCouponAmount(this.GetUpdatedProductTotal());
}
else {
couponAmount = this.coupons[i].GetCouponAmount(this.totalPrice - this.mailingPrice);
}
totalCouponAmount += couponAmount;

if (discountType == DiscountTypeEnum.HiVol) {
hiVolDiscount = couponAmount;
}
else if (discountType == DiscountTypeEnum.Promotional || discountType == DiscountTypeEnum.Referral) {
if (discountType == DiscountTypeEnum.Promotional) {
if (this.productPricingObj && this.productPricingObj.txtCouponCodeID) {
txtCouponCodeElem = $(this.productPricingObj.txtCouponCodeID);
}

if (couponAmount > 0 && hiVolDiscount > 0 && couponCode.toUpperCase().indexOf(CouponCodeEnum.MakeGoodPrefix) != 0) {
if (couponAmount > hiVolDiscount) {
this.promotionalDiscount = couponAmount;
hiVolDiscount = 0;
if (typeof (this.couponAmountHigherAlert) == 'undefined') {
this.couponAmountHigherAlert = "Your order qualifies for our high-volume discount, but the promotional code you entered gives you the best deal! These discounts cannot be combined, so we will apply the higher-value discount.";
alert(this.couponAmountHigherAlert);
}
}
else {
this.promotionalDiscount = 0;
totalCouponAmount -= couponAmount;
if (txtCouponCodeElem && txtCouponCodeElem.value != '') {
txtCouponCodeElem.value = '';
if (typeof (this.hiVolDiscountHigherAlert) == 'undefined') {
this.hiVolDiscountHigherAlert = "Your order qualifies for our high-volume discount! To give you the best deal, we will apply this higher-value discount instead of the promotional code you entered. These discounts cannot be combined.";
alert(this.hiVolDiscountHigherAlert);
}
}
}
}
else {
this.promotionalDiscount = couponAmount;
}

if (txtCouponCodeElem && txtCouponCodeElem.value == '' && this.promotionalDiscount > 0 && hiVolDiscount == 0) {
txtCouponCodeElem.value = couponCode;
}
}
else if (discountType == DiscountTypeEnum.Referral) {
this.referralDiscount = couponAmount;
}
}
}

this.SetDiscountRowVisibility(null, totalCouponAmount);

if (hiVolDiscount > this.pflProDiscount) {
this.hiVolDiscount = hiVolDiscount;
this.SetDiscountRowVisibility(DiscountTypeEnum.HiVol, this.hiVolDiscount);
}

this.RenderPrice(this.lblHiVolDiscountID, this.hiVolDiscount);
var lblCallUsElem = $('lblCallUs');
if (lblCallUsElem) { //hide high volume discount on hard coded ordering pages
lblCallUsElem.style.display = (this.hiVolDiscount > 0) ? '' : 'none'; //show call us when there is a high volume discount
var rowCallUsElem = $('rowCallUs');
if (rowCallUsElem) {
rowCallUsElem.style.display = (this.hiVolDiscount > 0) ? '' : 'none'; //show message when there is a high volume discount
}
$(this.lblOrderTotalID).style.display = (this.hiVolDiscount > 0) ? 'none' : ''; //hide order total when there is a high volume discount
var rowUnitCostElem = $('rowUnitCost');
if (rowUnitCostElem) {
rowUnitCostElem.style.display = (this.hiVolDiscount > 0) ? 'none' : ''; //hide unit cost when there is a high volume discount
}
if (this.hiVolDiscount > 0) {
 this.SetDiscountRowVisibility(null, 0); //hide discounted total
 this.SetDiscountRowVisibility(DiscountTypeEnum.HiVol, 0); //hide HiVol discount
}
}
else {
this.SetDiscountRowVisibility(DiscountTypeEnum.HiVol, this.hiVolDiscount);
}
this.RenderPrice(this.lblCouponDiscountID, this.promotionalDiscount + this.referralDiscount);
this.SetDiscountRowVisibility(DiscountTypeEnum.Promotional, this.promotionalDiscount + this.referralDiscount);
this.AdjustTotalPrices();
}

};

InstaPrice.prototype.AdjustUpgradeDiscount = function(price) {
this.upgradeDiscountPrice = price;
this.AdjustTotalPrices();
};

InstaPrice.prototype.AdjustSpecialDiscount = function(price) {
this.specialDiscountPrice = price;
this.AdjustTotalPrices();
};

InstaPrice.prototype.SetDiscountRowVisibility = function(discountType, couponAmount) {
 var lblID = (discountType == DiscountTypeEnum.HiVol) ? this.rowHiVolDiscountID : (discountType == DiscountTypeEnum.Promotional || discountType == DiscountTypeEnum.Referral) ? this.rowCouponDiscountID : (discountType == null) ? this.rowDiscountedTotalID : null;
 var lblElem = $(lblID);
 if (lblElem) {
 lblElem.style.display = (couponAmount > 0) ? '' : 'none';
 }
};

InstaPrice.prototype.RenderToolTipPrice = function(lblID, price, precision) {
 if (precision == null || precision == 'undefined') {
 precision = 2;
 }
 var lblElem = $(lblID);
 if (lblElem) {
 lblElem.title = FormatPrice(price, precision);
 }
};

InstaPrice.prototype.RenderPrice = function(lblID, price) {
 var lblElem = $(lblID);
 if (lblElem) {
 lblElem.innerHTML = FormatPrice(price);
 }
};

InstaPrice.prototype.RenderPercent = function(lblID, percent) {
 var lblElem = $(lblID);
 if (lblElem) {
 lblElem.innerHTML = Math.round(percent * 100) + "%";
 }
};

InstaPrice.prototype.AdjustTotalPrices = function() {
 this.basePrintingPrice = this.GetBasePrintingPrice();
 this.printingSubtotal = this.GetPrintingSubtotal();
 this.totalPrice = this.GetTotalPrice();
 this.AdjustPFLProDiscount();
 this.discountPrice = this.GetDiscountPrice();
 if (typeof (document.price) != 'undefined' && typeof (document.price.PAYMENTNEEDED) != 'undefined') {
 var paymentNeededGroup = document.price.PAYMENTNEEDED; //cobrand free business card pages
 if (this.discountPrice != 0) {
 paymentNeededGroup[1].checked = true;
 } else {
 paymentNeededGroup[0].checked = true;
 }
 }
 this.RenderTotalPrices();
};

InstaPrice.prototype.GetBasePrintingPrice = function(coverInside) {
 var price = 0;
 if (coverInside == CoverInsideEnum.ForCover) {
 price = this.baseProductPrice +
 this.coverBaseInkPrice +
 this.coverBaseSpotPrice +
 this.coverBasePaperPrice +
 this.baseDrillholePrice;
 }
 else if (coverInside == CoverInsideEnum.ForInside) {
 price = this.insideBaseInkPrice +
 this.insideBaseSpotPrice +
 this.insideBasePaperPrice +
 this.insideBaseDrillholePrice;
 }
 else {
 price = this.baseProductPrice +
 this.baseInkPrice +
 this.coverBaseInkPrice +
 this.baseSpotPrice +
 this.coverBaseSpotPrice +
 this.basePaperPrice +
 this.coverBasePaperPrice +
 this.baseDrillholePrice +
 this.baseDieCutPrice +
 this.baseConversionPrice;
 }
 return price;
};

InstaPrice.prototype.GetPrintingSubtotal = function() {
 return this.GetBasePrintingPrice() +
 this.GetBasePrintingPrice(CoverInsideEnum.ForInside) +
 this.aqueousPrice +
this.coverGlossVarnishPrice +
this.paperUpgradePrice +
this.coverPaperUpgradePrice +
this.insidePaperUpgradePrice +
this.foldPrice +
this.insideFoldCollateStaple +
this.sealPrice +
this.roundCornerPrice +
this.GetPaddingPrice() +
this.variableDataPrice;
};

InstaPrice.prototype.GetTotalPrice = function() {
return this.printingSubtotal +
this.envelopePrice +
this.secondSheetPrice +
this.turnaroundPrice +
this.shipTypePrice +
this.mailingPrice;
};

InstaPrice.prototype.GetDiscountPrice = function() {
 return this.totalPrice -
Math.max(this.pflProDiscount, this.hiVolDiscount) -
this.promotionalDiscount -
this.referralDiscount;
};

InstaPrice.prototype.GetQuantity = function() {
 return this.quantity;
};

InstaPrice.prototype.GetPPSProductTotal = function() {
 return this.discountPrice -
this.turnaroundPrice -
this.shipTypePrice -
this.secondSheetPrice -
this.mailingPrice -
this.envelopePrice;
};

InstaPrice.prototype.GetPPSUnitCost = function() {
 return (this.quantity) ? (this.GetPPSProductTotal() / this.quantity) : '';
};

InstaPrice.prototype.GetTurnaroundPrice = function() {
return this.turnaroundPrice;
};

InstaPrice.prototype.GetShipPrice = function() {
return this.shipTypePrice;
};

InstaPrice.prototype.GetSecondSheetPrice = function() {
return this.secondSheetPrice;
};

InstaPrice.prototype.GetMailingPrice = function() {
return this.mailingPrice;
};

InstaPrice.prototype.GetEnvelopePrice = function() {
return this.envelopePrice;
};

InstaPrice.prototype.GetPFLProTotalSavings = function() {
 return Math.max(this.hiVolDiscount, this.pflProDiscount) + this.pflProRushSavings + this.pflProProofSavings;
};

InstaPrice.prototype.GetPFLProSavingsPercent = function() {
 return this.GetPFLProTotalSavings() / (this.discountPrice + this.GetPFLProTotalSavings() - this.shipTypePrice - this.mailingPrice);
};

InstaPrice.prototype.RenderTotalPrices = function() {
 if (this.isChangeProductOptions) {
 if (this.isChangeOrder) {
 this.RenderPrice(this.lblChangePrintingID, this.GetBasePrintingPriceDiff());
 }
 else {
 this.RenderPrice(this.lblChangePrintingID, this.GetPrintingSubtotalPriceDiff());
 }
 this.RenderPrice(this.lblChangePaperID, this.GetPaperPriceDiff());
 this.RenderPrice(this.lblChangeAqueousID, this.GetAqueousPriceDiff());
 this.RenderPrice(this.lblChangeRoundCornersID, this.GetRoundCornerPriceDiff());
 this.RenderPrice(this.lblChangeFoldID, this.GetFoldPriceDiff());
 this.RenderPrice(this.lblChangeEnvelopesID, this.GetEnvelopePriceDiff());
 this.RenderPrice(this.lblChangeProdSpeedID, this.GetTurnaroundPriceDiff());
 this.RenderPrice(this.lblChangeShipMethodID, this.GetShipTypePriceDiff());
 this.RenderPrice(this.lblChangeMailingMethodID, this.GetMailingPriceDiff());
 this.RenderPrice(this.lblPriceChangeSubTotalID, this.GetTotalPriceDiff());
 this.RenderPrice(this.lblUpdatedProdTotalID, this.GetUpdatedProductTotal());
 this.RenderPrice(this.lblUpdatedCostEachID, this.GetCostEach(this.printingSubtotalOri + this.GetPrintingSubtotalPriceDiff()));
 this.RenderToolTipPrice(this.lblUpdatedCostEachID, this.GetCostEach(this.printingSubtotalOri + this.GetPrintingSubtotalPriceDiff()), 4);
 this.RenderPrice(this.lblChangeInsidePrinting, this.GetInsidePrintingPriceDiff());
 this.RenderPrice(this.lblChangeInsidePaper, this.GetInsidePaperPriceDiff());
 this.RenderPrice(this.lblPriceChangeHiVolDiscount, this.GetHighVolumeDiscountDiff());
 this.RenderPrice(this.lblPriceChangePFLProDiscount, this.GetPFLProDiscountDiff());
 this.RenderPrice(this.lblChangeFoldCollateStaple, this.GetFoldPriceDiff(CoverInsideEnum.ForInside));
 this.RenderPrice(this.lblChangeSecondSheets, this.GetSecondSheetPriceDiff());
 this.RenderPrice(this.lblChangeSeal, this.GetSealPriceDiff());
 this.RenderPrice(this.lblPriceChangeUpgradeDiscount, this.upgradeDiscountPrice);
 this.RenderPrice(this.lblPriceChangeCouponDiscount, this.GetCouponPriceDiff());
 this.RenderPrice(this.lblPriceChangeSpecialDiscountID, this.specialDiscountPrice);
 this.RenderPrice(this.lblChangePaddingID, this.GetPaddingPriceDiff());
 this.RenderPrice(this.lblChangeVariableDataID, this.GetVariableDataPriceDiff());
 }
 else {
 this.RenderPrice(this.lblPrintingSubtotalID, this.printingSubtotal);
 this.RenderPrice(this.lblOrderTotalID, this.totalPrice);
 this.RenderPrice(this.lblDiscountedTotalID, this.discountPrice);
 this.RenderPrice(this.lblPrintingCostEachID, this.GetCostEach(this.totalPrice - this.shipTypePrice - this.mailingPrice - this.pflProDiscount));
 this.RenderToolTipPrice(this.lblPrintingCostEachID, this.GetCostEach(this.totalPrice - this.shipTypePrice - this.mailingPrice - this.pflProDiscount), 4);
 this.RenderPrice(this.lblUnitCostID, this.GetCostEach(this.discountPrice));
 this.RenderToolTipPrice(this.lblUnitCostID, this.GetCostEach(this.discountPrice), 4);
 }
};

InstaPrice.prototype.GetCostEach = function(price) {
return (this.quantity) ? (price / this.quantity) : '';
};

InstaPrice.prototype.GetTotalPriceDiff = function() {
 return this.GetPrintingSubtotalPriceDiff() +
 this.GetEnvelopePriceDiff() +
 this.GetSecondSheetPriceDiff() +
 this.GetTurnaroundPriceDiff() +
 this.GetShipTypePriceDiff() +
 this.GetMailingPriceDiff();
};

InstaPrice.prototype.GetBasePrintingPriceDiff = function() {
 return (this.basePrintingPrice - this.basePrintingPriceOri);
};

InstaPrice.prototype.GetPrintingSubtotalPriceDiff = function() {
 return (this.printingSubtotal - this.printingSubtotalOri);
};

InstaPrice.prototype.GetPaperPriceDiff = function() {
 var price = (this.paperUpgradePrice + this.coverPaperUpgradePrice) - (this.paperUpgradePriceOri + this.coverPaperUpgradePriceOri);
 return price;
};

InstaPrice.prototype.GetAqueousPriceDiff = function() {
 return (this.aqueousPrice + this.coverGlossVarnishPrice) - (this.aqueousPriceOri + this.coverGlossVarnishPriceOri);
};

InstaPrice.prototype.GetRoundCornerPriceDiff = function() {
 return (this.roundCornerPrice - this.roundCornerPriceOri);
};

InstaPrice.prototype.GetFoldPriceDiff = function(coverInside) {
 return (coverInside == CoverInsideEnum.ForInside) ? this.insideFoldCollateStaple - this.insideFoldCollateStapleOri : this.foldPrice - this.foldPriceOri;
};

InstaPrice.prototype.GetEnvelopePriceDiff = function() {
 return (this.envelopePrice - this.envelopePriceOri);
};

InstaPrice.prototype.GetTurnaroundPriceDiff = function() {
 return (this.turnaroundPrice - this.turnaroundPriceOri);
};

InstaPrice.prototype.GetShipTypePriceDiff = function() {
 return (this.shipTypePrice - this.shipTypePriceOri);
};

InstaPrice.prototype.GetMailingPriceDiff = function() {
 return (this.mailingPrice - this.mailingPriceOri);
};

InstaPrice.prototype.GetUpdatedProductTotal = function() {
return (this.totalPriceOri -
 this.upgradeDiscountPrice -
 this.specialDiscountPrice -
 this.GetPFLProDiscountDiff() +
 (this.GetPrintingSubtotalPriceDiff() +
 this.GetShipTypePriceDiff() +
 this.GetTurnaroundPriceDiff() +
 this.GetMailingPriceDiff() +
 this.GetSecondSheetPriceDiff() +
 this.GetEnvelopePriceDiff()));
};

InstaPrice.prototype.GetInsidePrintingPriceDiff = function() {
 return (this.insideBasePrintingPrice - this.insideBasePrintingPriceOri);
};

InstaPrice.prototype.GetInsidePaperPriceDiff = function() {
 return (this.insidePaperUpgradePrice - this.insidePaperUpgradePriceOri);
};

InstaPrice.prototype.GetHighVolumeDiscountDiff = function() {
return (this.hiVolDiscount - this.hiVolDiscountOri);
};

InstaPrice.prototype.GetPFLProDiscountDiff = function() {
 this.AdjustPFLProDiscount();
 return (this.pflProDiscount - this.pflProDiscountOri);
};

InstaPrice.prototype.GetSecondSheetPriceDiff = function() {
 return (this.secondSheetPrice - this.secondSheetPriceOri);
};

InstaPrice.prototype.GetSealPriceDiff = function() {
 return (this.sealPrice - this.sealPriceOri);
};

InstaPrice.prototype.GetPaddingPriceDiff = function() {
 return (this.paddingPrice - this.paddingPriceOri);
};

InstaPrice.prototype.GetVariableDataPriceDiff = function() {
 return (this.variableDataPrice - this.variableDataPriceOri);
};

InstaPrice.prototype.GetCouponPriceDiff = function() {
 return (this.GetPrintingSubtotalPriceDiff() * (this.couponDiscountPercent * .01));
};

InstaPrice.prototype.ValidateQuantity = function(quantity, loc, confirmMessage) {
 var ret = this.IsValidQuantity(quantity, loc, confirmMessage);
 if (!ret.VALIDATE_RESULT) {
 if (ret.VALIDATE_MESSAGE) {
 if (typeof (loc) == 'undefined') {
 alert(ret.VALIDATE_MESSAGE);
 }
 else {
 var confirmation = confirm(ret.VALIDATE_MESSAGE);
 if (confirmation) {
 window.location = ret.VALIDATE_REDIRECT;
 }
 }
 }
 if (ret.VALIDATE_QUANTITY) {
 this.SetQuantity(ret.VALIDATE_QUANTITY);
 }
 }
 else {
 this.quantity = quantity;
 }
 return ret.VALIDATE_RESULT;
};

InstaPrice.prototype.IsValidQuantity = function(quantity, loc, confirmMessage) {
 //update quantity to be number of pads * sheetsPerUnit for notepads
 if (this.productPricingObj && this.productPricingObj.orderingPage == OrderingPageEnum.notepadprinting) {
 var sheetsPerUnitID = FinishingPricings[BindingPricings[this.productPricingObj.bindingPricingID].rblSheetsPerUnitID].finishingID;
 var sheetsPerPad = StripNonNumeric(AttributeValueNameEnum[sheetsPerUnitID]);
 var sheetsQuantity = quantity * sheetsPerPad;
 if (sheetsQuantity < this.minQuantity) {
 var numPads = Math.ceil(this.minQuantity / sheetsPerPad);
 var totalSheets = sheetsPerPad * numPads;
 return this.GetValidationObject(false, 'The minimum quantity for this size pad and number of sheets is ' + numPads + ' pads (for ' + totalSheets + ' total sheets)', numPads);

 }
 }
 //check quantity is divisible by padding for NCR Forms
 else if (this.productPricingObj && this.productPricingObj.orderingPage == OrderingPageEnum.carbonlessncrprinting
&& FinishingPricings[BindingPricings[this.productPricingObj.bindingPricingID].rblSheetsPerUnitID].finishingID != '') {
 var sheetsPerUnitID = FinishingPricings[BindingPricings[this.productPricingObj.bindingPricingID].rblSheetsPerUnitID].finishingID;
 var minQtyMsg = '';
 if (quantity < this.minQuantity) {
 quantity = this.minQuantity;
 minQtyMsg = ' and to meet the minimum quantity of ' + this.minQuantity;
 }
 var sheetsPerPad = StripNonNumeric(AttributeValueNameEnum[sheetsPerUnitID]);
 var padsOfRemainder = quantity % sheetsPerPad;
 if (padsOfRemainder != 0) {
 var newQuantity = Math.ceil(quantity / sheetsPerPad) * sheetsPerPad;
 var retMsg = 'Quantity will be rounded up to give you a full ' + AttributeValueNameEnum[sheetsPerUnitID] + ' NCR sets per pad or booklet ' + minQtyMsg;
 return this.GetValidationObject(false, retMsg, newQuantity);
 }
 else if (minQtyMsg != '') {
 return this.GetValidationObject(false, 'The minimum quantity for this product is ' + this.minQuantity + '.', this.minQuantity);
 }
 }
 else if (typeof (ChangeOptions) != 'undefined' && ChangeOptions && 'undefined' != typeof (IsMultiVersion) && IsMultiVersion[0]) {
 // Skip this validation for multi-version products; it is handled elsewhere.
 return this.GetValidationObject(true);
 }
 else if (quantity == '' || quantity < this.minQuantity) {
 return this.GetValidationObject(false, 'The minimum quantity for this product is ' + this.minQuantity + '.', this.minQuantity);
 }
 else if (this.maxQuantity && quantity > this.maxQuantity) {
 if (this.productPricingObj && this.productPricingObj.orderingPage == OrderingPageEnum.cardsbusinesscards) {
 return this.GetValidationObject(false, 'The maximum number of boxes you are allowed to order is ' + (this.maxQuantity / this.minQuantity) + '.', this.maxQuantity);
 }
 else {
 if (typeof (loc) == 'undefined') {
 return this.GetValidationObject(false, 'The maximum quantity you are allowed to order is ' + this.maxQuantity + '.', this.maxQuantity);
 }
 else {
 var message = 'This product has a maximum quantity of ' + this.maxQuantity + '. \nClick "OK" to choose a product that allows different quantities, \nor click "CANCEL" to change the quantity.';
 if (typeof (confirmMessage) != 'undefined') {
 message = confirmMessage.substring(0, confirmMessage.indexOf('[MAX]')) + this.maxQuantity + confirmMessage.substring(confirmMessage.indexOf('[MAX]') + 5, confirmMessage.length);
 }
 return this.GetValidationObject(false, message, this.maxQuantity, loc);
 }
 }
 }
 // This.minQuantity can't be used for the increment because PPSs may have different minimums.
 else if (this.productPricingObj && this.productPricingObj.orderingPage == OrderingPageEnum.cardsbusinesscards && quantity % 500 != 0) {
 return this.GetValidationObject(false, 'Business Cards must be ordered in increments of ' + 500 + '.', Math.ceil(quantity / 500) * 500);
 }
 return this.GetValidationObject(true);
};

InstaPrice.prototype.GetValidationObject = function(validateResult, validateMessage, quantity, loc) {
return {
VALIDATE_RESULT : validateResult,
VALIDATE_MESSAGE : validateMessage,
VALIDATE_QUANTITY : quantity,
VALIDATE_REDIRECT : loc
};
};

InstaPrice.prototype.IsChanged = function() {
 if (FormatNum(this.GetBasePrintingPriceDiff(), 2) != 0) { return true; }
 if (FormatNum(this.GetPrintingSubtotalPriceDiff(), 2) != 0) { return true;}
 if (FormatNum(this.GetPaperPriceDiff(), 2) != 0) { return true;}
 if (FormatNum(this.GetAqueousPriceDiff(), 2) != 0) { return true;}
 if (FormatNum(this.GetRoundCornerPriceDiff(), 2) != 0) { return true;}
 if (FormatNum(this.GetFoldPriceDiff(), 2) != 0) { return true;}
 if (FormatNum(this.GetEnvelopePriceDiff(), 2) != 0) { return true;}
 if (FormatNum(this.GetTurnaroundPriceDiff(), 2) != 0) { return true;}
 if (FormatNum(this.GetShipTypePriceDiff(), 2) != 0) { return true;}
 if (FormatNum(this.GetMailingPriceDiff(), 2) != 0) { return true;}
 if (FormatNum(this.GetTotalPriceDiff(), 2) != 0) { return true;}
 if (FormatNum(this.GetInsidePrintingPriceDiff(), 2) != 0) { return true;}
 if (FormatNum(this.GetInsidePaperPriceDiff(), 2) != 0) { return true;}
 if (FormatNum(this.GetHighVolumeDiscountDiff(), 2) != 0) { return true;}
 if (FormatNum(this.GetFoldPriceDiff(CoverInsideEnum.ForInside), 2) != 0) { return true;}
 if (FormatNum(this.GetSecondSheetPriceDiff(), 2) != 0) { return true;}
 if (FormatNum(this.GetSealPriceDiff(), 2) != 0) { return true;}
 if (FormatNum(this.GetCouponPriceDiff(), 2) != 0) { return true; }
 if (FormatNum(this.GetPaddingPriceDiff(), 2) != 0) { return true; }
 if (FormatNum(this.GetVariableDataPriceDiff(), 2) != 0) { return true; }
 return false;
};

InstaPrice.prototype.GetMarkupPercent = function() {
 if (typeof(this.additionalMarkupPercent) != 'undefined') {
 return 1.0 * this.GetStandardMarkupPercent() + 1.0 * this.additionalMarkupPercent;
 }
 else {
 return 1.0 * this.GetStandardMarkupPercent();
 }
};

InstaPrice.prototype.GetStandardMarkupPercent = function() {
if (typeof(channelMarkupArr) != 'undefined') {
var printingSubtotal = this.GetPrintingSubtotal();
for (var minOrderAmt in channelMarkupArr) {
if (printingSubtotal >= minOrderAmt) {
return channelMarkupArr[minOrderAmt];
}
}
}
return 0;
};

InstaPrice.prototype.StoreIPPrices = function() {
//capture IP prices for OfficeMax orders
var printingSubtotalIPElem = $('printingSubtotalIP');
if (printingSubtotalIPElem) {
printingSubtotalIPElem.value = this.printingSubtotal;
}

var shipPriceIPElem = $('shipPriceIP');
if (shipPriceIPElem) {
shipPriceIPElem.value = this.shipTypePrice;
}

var rushPriceIPElem = $('rushPriceIP');
if (rushPriceIPElem) {
rushPriceIPElem.value = this.turnaroundPrice;
}

var secondsheetsPriceIPElem = $('secondsheetsPriceIP');
if (secondsheetsPriceIPElem) {
secondsheetsPriceIPElem.value = this.secondSheetPrice;
}

var envelopePriceIPElem = $('envelopePriceIP');
if (envelopePriceIPElem) {
envelopePriceIPElem.value = this.envelopePrice;
}

var totalPriceIPElem = $('totalPriceIP');
if (totalPriceIPElem) {
totalPriceIPElem.value = this.totalPrice;
}

};/// <reference path="Enums/AttributeIDEnum.js" />
/// <reference path="Enums/AttributeValueIDEnum.js" />
/// <reference path="Enums/AttributeValueNameEnum.js" />
/// <reference path="Enums/ProductIDEnum.js" />
/// <reference path="Enums/NoValueEnum.js" />
/// <reference path="FinishingPricing.js" />

var MailingPricings;
var VALIDATE_MAILING_QUANTITY = 'MailingQuantity';
var VALIDATE_MAILING_METHOD = 'MailingMethod';

function MailingPricing(mailingPricingID, mailingQuantity, mailingMethod, mailingQuantityInputID, rblMailingMethodName) {
this.mailingPricingID = mailingPricingID;
this.mailingQuantity = mailingQuantity;
this.mailingQuantityOri = mailingQuantity;
this.mailingMethod = mailingMethod;
this.mailingMethodOri = mailingMethod;
this.mailingQuantityInputID = mailingQuantityInputID;
this.rblMailingMethodName = rblMailingMethodName;

this.InsertMailingPricing();
}

MailingPricing.prototype.InsertMailingPricing = function() {
if (typeof(MailingPricings) == 'undefined') {
MailingPricings = new Object;
}
MailingPricings[this.mailingPricingID] = this;
};

MailingPricing.prototype.ResetMailing = function() {
 SetRadioButtonListChecked(this.rblMailingMethodName, this.mailingMethod);
 SetValue(this.mailingQuantityInputID, this.mailingQuantity);
};

MailingPricing.prototype.ChangeMailingQuantity = function() {
this.ValidateMailing(this.GetMailingQuantity(), this.mailingMethod);

if (this.productPricingObj) {
this.productPricingObj.AdjustPrices(AdjustTypeEnum.Mailing);
this.productPricingObj.HandleShowSubmitChanges();
}
};

MailingPricing.prototype.SetMailingQuantity = function(mailingQuantity) {
 this.mailingQuantity = mailingQuantity;
var mqInput = $(this.mailingQuantityInputID);
if (mqInput != null && typeof (mqInput) != 'undefined') {
$(this.mailingQuantityInputID).value = this.mailingQuantity;
}
};

MailingPricing.prototype.ChangeMailingMethod = function(mailingMethod) {
 if (((this.productPricingObj.productID == 5) || (this.productPricingObj.productID == 57)) && (mailingMethod == "BM")) {
 alert("The product you selected may not be mailed using 'Bulk Mail' due to Postal Service restrictions.");
 this.SetMailingMethod("1C");
 }
this.ValidateMailing(this.GetMailingQuantity(), mailingMethod);

if (this.productPricingObj) {
this.productPricingObj.AdjustPrices(AdjustTypeEnum.Mailing);
this.productPricingObj.HandleShowSubmitChanges();
}
};

MailingPricing.prototype.SetMailingMethod = function(mailingMethod) {
this.mailingMethod = mailingMethod;
SetRadioButtonListChecked(this.rblMailingMethodName, mailingMethod);
};

MailingPricing.prototype.GetMailingQuantity = function() {
return ParseInt($(this.mailingQuantityInputID).value);
};

MailingPricing.prototype.GetMailingMethodDesc = function(mailingMethod) {
switch (mailingMethod) {
case ShipTypeEnum.BulkMailValue: return ShipTypeEnum.BulkMailText;
case ShipTypeEnum.FirstClassPresortedValue: return ShipTypeEnum.FirstClassPresortedText;
case ShipTypeEnum.FirstClassValue: return ShipTypeEnum.FirstClassText;
default: return '';
}
};

//add signatures to end as optional parameter for catalogs used to determine paperWeightID, foldID, forCoverPaper and partCount
MailingPricing.prototype.GetMailingPrice = function(productID, paperWeightID, foldID, forCoverPaper, partCount, percentCollection) {
 if (this.mailingQuantity == '' || this.mailingQuantity == 0 || this.mailingMethod == '') {
 return 0;
 }

 var mailingArrItem = mailingArr[productID][paperWeightID][partCount][this.mailingMethod];
 var surcharge = this.GetFoldSurchargeValue(foldID, mailingArr[productID][paperWeightID][partCount][this.mailingMethod], productID);

 if (forCoverPaper) {
 surcharge += mailingArrItem[MAILING_IDX_COVER_STOCK_SURCHARGE];
 }

 var mailingEach;
 if (this.mailingQuantity >= 10000) {
 mailingEach = mailingArrItem[MAILING_IDX_MUL_EACH_10000];
 }
 else if (this.mailingQuantity >= 5000) {
 mailingEach = mailingArrItem[MAILING_IDX_MUL_EACH_5000];
 }
 else {
 mailingEach = mailingArrItem[MAILING_IDX_MUL_EACH];
 }

 var price = 0;
 if (foldID != '' &&
 productID != ProductIDEnum.note_cards &&
 productID != ProductIDEnum.holiday_deluxe_note_card &&
 productID != ProductIDEnum.holiday_premium_note_card &&
 productID != ProductIDEnum.greeting_cards &&
 productID != ProductIDEnum.holiday_deluxe_greeting_card &&
 productID != ProductIDEnum.holiday_premium_greeting_card ||
 productID == ProductIDEnum.catalogs_5_5x8_5 ||
 productID == ProductIDEnum.catalogs_8_5x11 ||
 productID == ProductIDEnum.calendars_5_5x8_5 ||
 productID == ProductIDEnum.calendars_8_5x11) {
 
 var finishingObj = new FinishingPricing(0, AttributeValueIDEnum.tab_tab, "");
 price += finishingObj.GetFinishingPrice(AttributeValueIDEnum.tab_tab, this.mailingQuantity, productID, percentCollection);
 }
 
 percentCollection.SetCanApplyPercentVariables(AdjustTypeEnum.Mailing, ChannelID);
 return this.CalculateMailingPrice(price, this.mailingQuantity, mailingArrItem[MAILING_IDX_BASE], mailingEach, surcharge, percentCollection);
};

MailingPricing.prototype.CalculateMailingPrice = function(price, quantity, mailingBase, mailingEach, surcharge, percentCollection) {
price += (quantity * (mailingEach + surcharge)) + mailingBase;

if (typeof (percentCollection) != 'undefined') {
return percentCollection.ApplyPricingPercents(price);
}
else {
return FormatDollar(price);
}
};

MailingPricing.prototype.ValidateMailing = function(mailingQuantity, mailingMethod) {
var ret = this.IsValidMailing(mailingQuantity, mailingMethod);
if (!ret.VALIDATE_RESULT) {
if (ret.VALIDATE_MESSAGE) {
alert(ret.VALIDATE_MESSAGE);
}
this.SetMailingQuantity(ret.VALIDATE_MAILING_QUANTITY);
this.SetMailingMethod(ret.VALIDATE_MAILING_METHOD);
if (ret.VALIDATE_QUANTITY) {
if (this.productPricingObj) {
this.productPricingObj.SetQuantity(ret.VALIDATE_QUANTITY);
}
}
}
else {
this.mailingQuantity = mailingQuantity;
this.mailingMethod = mailingMethod;
}

if (this.productPricingObj) {
this.productPricingObj.HandleMailingBlankEnvelopes();

 this.productPricingObj.HandleMailingChange();

var allMailing = (this.mailingMethod && this.mailingQuantity == this.productPricingObj.GetQuantity());
this.productPricingObj.HandleAllMailing(allMailing);
}
return ret.VALIDATE_RESULT;
};

MailingPricing.prototype.IsValidMailing = function(mailingQuantity, mailingMethod) {
if (mailingQuantity < 0) {
return this.GetValidationObject(false, 'Mailing quantity cannot be negative.', '', mailingMethod);
}
else if (mailingQuantity == '' || mailingQuantity == 0) {
return this.GetValidationObject(false, '', '', '');
}
else if (this.productPricingObj) {
var quantity = this.productPricingObj.GetQuantity();
var minMailingQuantity = this.productPricingObj.GetMinMailingQuantity(mailingMethod);
if (minMailingQuantity != null && mailingQuantity < minMailingQuantity) {
var minMailingQuantityBulkMail = this.productPricingObj.GetMinMailingQuantity(ShipTypeEnum.BulkMailValue);
mailingMethod = (mailingMethod == ShipTypeEnum.FirstClassPresortedValue && mailingQuantity >= minMailingQuantityBulkMail && this.IsValidMailingMethod(this.productPricingObj.productID, ShipTypeEnum.BulkMailValue)) ? ShipTypeEnum.BulkMailValue : ShipTypeEnum.FirstClassValue;
return this.GetValidationObject(false, 'Mailing quantity cannot be less than ' + minMailingQuantity + ' for the given mailing method.', mailingQuantity, mailingMethod, null);
}
else if (quantity != null && quantity < mailingQuantity) {
if ((typeof(MailOnly) == 'undefined') || !MailOnly) {
return this.GetValidationObject(false, 'Mailing quantity cannot be greater than the order quantity.', mailingQuantity, mailingMethod, mailingQuantity);
}
}
}
return this.GetValidationObject(true);
};

MailingPricing.prototype.IsValidMailingMethod = function(productID, mailingMethod) {
 if ((productID == ProductIDEnum.postcards_4_25x5_5 || productID == ProductIDEnum.postcards_4x6) && mailingMethod == ShipTypeEnum.BulkMailValue) {
return false;
}
return true;
};

MailingPricing.prototype.GetValidationObject = function(validateResult, validateMessage, mailingQuantity, mailingMethod, quantity) {
return {
VALIDATE_RESULT : validateResult,
VALIDATE_MESSAGE : validateMessage,
VALIDATE_MAILING_QUANTITY : mailingQuantity,
VALIDATE_MAILING_METHOD : mailingMethod,
VALIDATE_QUANTITY : quantity
};
};

MailingPricing.prototype.HandleQuantityChange = function() {
this.ValidateMailing(this.mailingQuantity, this.mailingMethod);
};

MailingPricing.prototype.HandleSizeChange = function(productID) {
var coll = document.getElementsByName(this.rblMailingMethodName);
var isDisabled;
for (var i = 0, loopCnt = coll.length; i < loopCnt; i++) {
isDisabled = !this.IsValidMailingMethod(productID, coll[i].value);
SetRadioButtonDisabled(coll[i], isDisabled);
if (isDisabled && coll[i].checked) {
alert(this.GetMailingMethodDesc(coll[i].value) + ' is not available for this product.');
if (this.mailingQuantity > 0) {
this.SetMailingMethod(ShipTypeEnum.FirstClassValue);
}
}
}
};

MailingPricing.prototype.HasMailing = function() {
return (this.mailingQuantity > 0 && this.mailingMethod != '');
};

MailingPricing.prototype.IsChanged = function() {
 return (this.mailingQuantityOri != this.mailingQuantity || this.mailingMethodOri != this.mailingMethod);
};

MailingPricing.prototype.GetFoldSurchargeValue = function(fold, mailingArrItem, productID) {
switch(fold) {
case '':
return mailingArrItem[MAILING_IDX_NO_FOLD_SURCHARGE];
break;
case AttributeValueIDEnum.fold_half_fold:
return mailingArrItem[MAILING_IDX_HALF_FOLD_SURCHARGE];
break;
case AttributeValueIDEnum.fold_tri_fold:
return mailingArrItem[MAILING_IDX_TRI_FOLD_SURCHARGE];
break;
case AttributeValueIDEnum.fold_tri_then_half_fold:
return mailingArrItem[MAILING_IDX_TRI_THEN_HALF_FOLD_SURCHARGE];
break;
case AttributeValueIDEnum.fold_four_panel_fold:
return mailingArrItem[MAILING_IDX_FOUR_PANEL_FOLD_SURCHARGE];
break;
 case AttributeValueIDEnum.fold_open_gate_fold:
 return mailingArrItem[MAILING_IDX_OPEN_GATE_FOLD_SURCHARGE];
 case AttributeValueIDEnum.fold_gate_fold: //closed gate fold
 return mailingArrItem[MAILING_IDX_CLOSED_GATE_FOLD_SURCHARGE];
default:
return 0;
 }
};var NameQtyPricings;
var MAXIMUM_NAMES = 12;

function NameQtyPricing(nameQtyPricingID, nameIDPrefix, qtyIDSuffix, cardCnt) {
this.nameQtyPricingID = nameQtyPricingID;
this.nameIDPrefix = nameIDPrefix;
this.qtyIDSuffix = qtyIDSuffix;
this.cardCnt = cardCnt;

this.InsertNameQtyPricing();
}

NameQtyPricing.prototype.InsertNameQtyPricing = function() {
if (typeof(NameQtyPricings) == 'undefined') {
NameQtyPricings = new Object;
}
NameQtyPricings[this.nameQtyPricingID] = this;
};

NameQtyPricing.prototype.ResetNameQty = function() {
 for (var i = 1, loopCnt = this.cardCnt; i <= loopCnt; i++) {
 nameQtyElem = $(this.nameIDPrefix + i + this.qtyIDSuffix);
 if (nameQtyElem && nameQtyElem.value != '') {
 nameQtyElem.value = '';
 }
 nameElem = $(this.nameIDPrefix + i);
 if (nameElem && nameElem.value != '') {
 nameElem.value = '';
 }
 }
};

NameQtyPricing.prototype.ChangeName = function(cardIdx, name) {
 var nameElem = $(this.nameIDPrefix + cardIdx);
 var nameQtyElem = $(this.nameIDPrefix + cardIdx + this.qtyIDSuffix);
 if (nameElem.value && !nameQtyElem.value) {
 nameQtyElem.value = 1;
 }
 else if (!nameElem.value && nameQtyElem.value) {
 alert('Please provide a name for card quantity.');
 nameQtyElem.value = '';
 nameElem.focus();
 }
 else if (nameQtyElem.value != '' && (nameQtyElem.value == 0 || isNaN(nameQtyElem.value))) {
 alert('Please provide a number for card quantity.');
 nameQtyElem.value = '';
 nameQtyElem.focus();
 }
 this.HandleNameQuantityChange();
};

NameQtyPricing.prototype.ChangeQty = function(cardIdx, qty) {
 this.ChangeName(cardIdx);
};

NameQtyPricing.prototype.HandleNameQuantityChange = function() {
if (this.productPricingObj) {
this.productPricingObj.HandleNameQuantityChange(this.GetSumNameQuantities());
}
};

NameQtyPricing.prototype.GetSumNameQuantities = function() {
var sumQty = 0;
var nameQtyElem;
for (var i = 1, loopCnt = this.cardCnt; i <= loopCnt; i++) {
nameQtyElem = $(this.nameIDPrefix + i + this.qtyIDSuffix);
if (nameQtyElem && nameQtyElem.value != '') {
sumQty += parseInt(nameQtyElem.value);
}
}
return sumQty;
};

NameQtyPricing.prototype.IsChanged = function() {
 return (false);
};

NameQtyPricing.prototype.GetVersionCount = function() {
var nameQtyElem; //use nameQtyElem because name can be blank
var versionCnt = 0;
for (var i = 1, loopCnt = this.cardCnt; i <= loopCnt; i++) {
nameQtyElem = $(this.nameIDPrefix + i + this.qtyIDSuffix);
if (nameQtyElem && nameQtyElem.value != '') {
versionCnt++;
}
}
if (versionCnt == 0) {
versionCnt++;
}
return versionCnt;
};

NameQtyPricing.prototype.QuantityList = function() {
var nameQtyElem; //use nameQtyElem because name can be blank
var quantityList = new Array();
var instaPriceObj = InstaPrices[this.productPricingObj.instaPriceID];
var boxQuantity = instaPriceObj.minQuantity;
// 3/10/09 DK - IMPORTANT NOTE: Multi version pricing functionality will be disabled for business cards until CQ Phase 2
/*for (var i = 1, loopCnt = this.cardCnt; i <= loopCnt; i++) {
nameQtyElem = $(this.nameIDPrefix + i + this.qtyIDSuffix);
if (nameQtyElem && nameQtyElem.value != '' && !isNaN(nameQtyElem.value) && nameQtyElem.value > 0) {
quantityList.push(nameQtyElem.value * boxQuantity);
}
}*/
if (quantityList.length == 0) {
quantityList.push(instaPriceObj.quantity);
}
return quantityList;
};

NameQtyPricing.prototype.ApplyBoxDiff = function(boxDiff) {
for (var i = 1, loopCnt = this.cardCnt; i <= loopCnt && boxDiff > 0; i++) {
nameQtyElem = $(this.nameIDPrefix + i + this.qtyIDSuffix);
if (nameQtyElem && nameQtyElem.value != '') {
nameQtyElem.value = parseInt(nameQtyElem.value) + 1;
}
boxDiff--;
if (i == loopCnt && boxDiff > 0) {
i = 1;
}
}
this.HandleNameQuantityChange();
};
var NumPagesPricings;

function NumPagesPricing(numPagesPricingID, numPages, numPagesDropdownID) {
this.numPagesPricingID = numPagesPricingID;
this.numPagesOri = numPages;
this.numPages = numPages;
this.numPagesDropdownID = numPagesDropdownID;

this.InsertNumPagesPricing();
}

NumPagesPricing.prototype.InsertNumPagesPricing = function() {
if (typeof(NumPagesPricings) == 'undefined') {
NumPagesPricings = new Object;
}
NumPagesPricings[this.numPagesPricingID] = this;
};

NumPagesPricing.prototype.ResetNumPages = function() {
 SetValue(this.numPagesDropdownID, this.numPages);
};

NumPagesPricing.prototype.ChangeNumPages = function(numPagesElem) {
this.SetNumPages(numPagesElem.options[numPagesElem.selectedIndex].text);

if (this.productPricingObj) {
this.productPricingObj.ValidateNumPages();
this.productPricingObj.AdjustPrices(AdjustTypeEnum.NumPages);
this.productPricingObj.HandleShowSubmitChanges();
}
};

NumPagesPricing.prototype.SetNumPages = function(numPages) {
this.numPages = numPages;
};

NumPagesPricing.prototype.IsChanged = function() {
 return (this.numPagesOri != this.numPages);
};
/// <reference path="Enums/AttributeIDEnum.js" />
/// <reference path="Enums/AttributeValueIDEnum.js" />
/// <reference path="Enums/AttributeValueNameEnum.js" />
/// <reference path="Enums/NoValueEnum.js" />
var PaperPricings;
var VALIDATE_PAPER = 'Paper';


function PaperPricing(paperPricingID, paperID, coverInside, rblPaperName, imageID) {
this.paperPricingID = paperPricingID;
this.paperID = paperID;
this.paperOri = paperID;
this.coverInside = coverInside;
this.rblPaperName = rblPaperName;
this.imageID = imageID;
this.forCover = (this.coverInside == CoverInsideEnum.ForCover);
this.forInside = (this.coverInside == CoverInsideEnum.ForInside);

this.InsertPaperPricing();
}

PaperPricing.prototype.InsertPaperPricing = function() {
if (typeof(PaperPricings) == 'undefined') {
PaperPricings = new Object;
}
PaperPricings[this.paperPricingID] = this;
};

PaperPricing.prototype.ResetPaper = function() {
 SetRadioButtonListChecked(this.rblPaperName, this.paperID);
};

PaperPricing.prototype.ChangePaper = function(paperID) {
this.ValidatePaper(((this.productPricingObj) ? this.productPricingObj.productID : null), paperID, false);
if (this.productPricingObj) {
if (this.imageID != null) {
LoadImage(this.imageID, paperImageArr[this.productPricingObj.productID][this.paperID]);
}
this.productPricingObj.AdjustPrices(AdjustTypeEnum.Paper, this.paperPricingID);
this.productPricingObj.HandleShowSubmitChanges();
}
};

PaperPricing.prototype.SetPaper = function(paperID) {
this.paperID = paperID;
SetRadioButtonListChecked(this.rblPaperName, paperID);
};

PaperPricing.prototype.GetPaperUpgradePrice = function(productID, quantity, percentCollection, coverInside, signatures) {
 return this.GetPaperPrice(productID, quantity, percentCollection, signatures) - this.GetPaperBasePrice(productID, quantity, percentCollection, coverInside, signatures);
};

PaperPricing.prototype.GetPaperBasePrice = function(productID, quantity, percentCollection, coverInside, signatures) {
 var basePaperID = this.GetDefaultPaper(productID, coverInside);
 if (basePaperID != null) {
 return this.GetPaperPrice(productID, quantity, percentCollection, signatures, basePaperID);
 }
 return 0;
};

PaperPricing.prototype.GetDefaultPaper = function(productID, coverInside) {
 if (typeof (this.defaultPaperID) != 'undefined' && this.defaultPaperID) {
 return this.defaultPaperID;
 }
 else if (typeof (IsPPS) != 'undefined') {
 return this.paperOri;
 }
 else if (typeof (productInfoArr[productID][PRODUCTINFO_IDX_DEFAULT_PAPER]) != 'undefined' && productInfoArr[productID][PRODUCTINFO_IDX_DEFAULT_PAPER] != '') {
 var basePaperIDs = String(productInfoArr[productID][PRODUCTINFO_IDX_DEFAULT_PAPER]).split(',');
 if (coverInside == CoverInsideEnum.ForInside) {
 return basePaperIDs[1];
 }
 else {
 return basePaperIDs[0];
 }
 }
 return null;
};

//add signatures to end as optional parameter for catalogs
PaperPricing.prototype.GetPaperPrice = function(productID, quantity, percentCollection, signatures, basePaperID) {
var price = 0;
var paperID = this.paperID;
if(typeof(basePaperID) != 'undefined') {
 paperID = basePaperID;
}
percentCollection.SetCanApplyPercentVariables(AdjustTypeEnum.Paper, ChannelID);
if (typeof (signatures) != 'undefined' && signatures != null) {
for (var s = 0, loopCnt = signatures.length; s < loopCnt; s++) {
 if(typeof(basePaperID) != 'undefined') {
 price += this.CalculatePaperPrice(quantity, this.GetPaperBase(productID, paperID), this.GetPaperEach(productID, paperID), percentCollection, signatures[s].TotalSignaturePricingPercent());
 }
 else {
 price += this.CalculatePaperPrice(quantity, this.GetPaperBase(productID, signatures[s].GetAttributeValueID(AttributeIDEnum.paper)), this.GetPaperEach(productID, signatures[s].GetAttributeValueID(AttributeIDEnum.paper)), percentCollection, signatures[s].TotalSignaturePricingPercent());
 }
}
}
else {
if (this.productPricingObj && this.productPricingObj.quantityList.length != 0) { //business cards
var quantityList = this.productPricingObj.quantityList;
for(var i = 0, loopCnt = quantityList.length; i < loopCnt; i++) { //loop through version quantities
price += this.CalculatePaperPrice(quantityList[i], this.GetPaperBase(productID, paperID), this.GetPaperEach(productID, paperID), percentCollection);
}
}
else { //one quantity products
price = this.CalculatePaperPrice(quantity, this.GetPaperBase(productID, paperID), this.GetPaperEach(productID, paperID), percentCollection);
}
}
return price;
};

PaperPricing.prototype.GetPaperBase = function(productID, paperID) {
 if (typeof (paperID) == 'undefined') {
 paperID = this.paperID;
 }
 if (typeof (paperArr[productID][paperID]) != 'undefined') { //get paperID override pricing
 return paperArr[productID][paperID][''][PAPER_IDX_BASE];
 }
 else { //get tier pricing
 return paperArr[productID][''][this.GetTierID(paperID)][PAPER_IDX_BASE];
 }
};

PaperPricing.prototype.GetPaperEach = function(productID, paperID) {
 if (typeof (paperID) == 'undefined') {
 paperID = this.paperID;
 }
 if (typeof (paperArr[productID][paperID]) != 'undefined') { //get paperID override pricing
 return paperArr[productID][paperID][''][PAPER_IDX_EACH];
 }
 else { //get tier pricing
 return paperArr[productID][''][this.GetTierID(paperID)][PAPER_IDX_EACH];
 }
};

PaperPricing.prototype.CalculatePaperPrice = function(quantity, paperBase, paperEach, percentCollection, signaturePricingPercent) {
 var price = 0;
 if (typeof (signaturePricingPercent) == 'undefined') {
 signaturePricingPercent = 1;
 }

 if (quantity > 0) { //check that the quantity is greater than zero
 price = signaturePricingPercent * (paperBase + (quantity * paperEach));
 }

 if (typeof (percentCollection) != 'undefined') {
 return percentCollection.ApplyPricingPercents(price);
 }
 else {
 return FormatDollar(price);
 }
};


PaperPricing.prototype.IsCoverPaper = function(paperID) {
if (typeof (paperInfoArr[paperID][PAPERINFO_IDX_TYPE]) != 'undefined') {
return (paperInfoArr[paperID][PAPERINFO_IDX_TYPE].toLowerCase() == 'cover');
}
return false;
};

PaperPricing.prototype.ValidateNumPages = function(isDisabled) {
 if (this.forInside) {
if (isDisabled) {
var rblPaperElem = $(this.rblPaperName);
if (rblPaperElem) {
var paperID = rblPaperElem[0].value;
if (this.paperID != paperID) {
this.ChangePaper(paperID);
}
}
}
SetRadioButtonListDisabled(this.rblPaperName, isDisabled, 0);
}
};

PaperPricing.prototype.GetPaperWeight = function() {
if (typeof (paperInfoArr[this.paperID][PAPERINFO_IDX_WEIGHT]) != 'undefined') {
return paperInfoArr[this.paperID][PAPERINFO_IDX_WEIGHT];
}
return 0;
};

PaperPricing.prototype.GetPaperWeightID = function(paperID) {
if (typeof (paperInfoArr[paperID][PAPERINFO_IDX_WEIGHTID]) != 'undefined') {
return paperInfoArr[paperID][PAPERINFO_IDX_WEIGHTID];
}
return null;
};

PaperPricing.prototype.ValidatePaper = function(productID, paperID, forSizeChange) {
var ret = this.IsValidPaper(productID, paperID, forSizeChange);
if (!ret.VALIDATE_RESULT) {
if (ret.VALIDATE_MESSAGE) {
alert(ret.VALIDATE_MESSAGE);
}
this.SetPaper(ret.VALIDATE_PAPER);
}
else {
this.paperID = paperID;
}
return ret.VALIDATE_RESULT;
};

PaperPricing.prototype.IsValidPaper = function(productID, paperID, forSizeChange) {
if (this.productPricingObj) {
 if (productID == ProductIDEnum.envelopes_9_1_2x12_5_8 && paperID == AttributeValueIDEnum.paper_24lb_uncoated) {
return this.GetValidationObject(false, '9 1/2 x 12 5/8 envelopes are not available in 24 lb stock.', (forSizeChange) ? paperID : this.paperID);
}
else {
var retObj = this.productPricingObj.HandlePaperChange(paperID, this.forInside, productID, forSizeChange);
if (!retObj.success) {
return this.GetValidationObject(false, '', ((',' + retObj.errorType + ',').indexOf(',' + AdjustTypeEnum.Ink + ',') != -1) ? this.paperID : paperID);
}
}
}
return this.GetValidationObject(true);
};

PaperPricing.prototype.GetValidationObject = function(validateResult, validateMessage, paperID) {
return {
VALIDATE_RESULT : validateResult,
VALIDATE_MESSAGE : validateMessage,
VALIDATE_PAPER : paperID
};
};

PaperPricing.prototype.IsChanged = function() {
 return (this.paperOri != this.paperID);
};

PaperPricing.prototype.GetTierID = function(paperID) {
 if (typeof (paperInfoArr[paperID][PAPERINFO_IDX_TIERID]) != 'undefined') {
 return paperInfoArr[paperID][PAPERINFO_IDX_TIERID];
 }
 return null;
};

PaperPricing.prototype.GetPaperName = function(paperID) {
if (typeof (paperInfoArr[paperID][PAPERINFO_IDX_NAME]) != 'undefined') {
return paperInfoArr[paperID][PAPERINFO_IDX_NAME];
}
return '';
};

PaperPricing.prototype.SetDefaultPaperID = function(defaultPaperID) {
this.defaultPaperID = defaultPaperID;
};
/// <reference path="Enums/AttributeIDEnum.js" />
/// <reference path="Enums/AttributeValueIDEnum.js" />
/// <reference path="Enums/AttributeValueNameEnum.js" />
/// <reference path="Enums/NoValueEnum.js" />
var PocketSlitPricings;
var VALIDATE_POCKET = 'Pocket';
var VALIDATE_SLIT = 'Slit';

function PocketSlitPricing(pocketSlitPricingID, pocketID, slitID, rblSlitName, rblPocketName) {
this.pocketSlitPricingID = pocketSlitPricingID;
this.pocketID = pocketID;
this.pocketIDOri = pocketID;
this.slitID = slitID;
this.slitIDOri = slitID;
this.rblSlitName = rblSlitName;
this.rblPocketName = rblPocketName;

this.InsertPocketSlitPricing();
}

PocketSlitPricing.prototype.InsertPocketSlitPricing = function() {
if (typeof(PocketSlitPricings) == 'undefined') {
PocketSlitPricings = new Object;
}
PocketSlitPricings[this.pocketSlitPricingID] = this;
};

PocketSlitPricing.prototype.ResetPocketSlit = function() {
 SetRadioButtonListChecked(this.rblSlitName, this.slitID);
 SetRadioButtonListChecked(this.rblPocketName, this.pocketID);
};

PocketSlitPricing.prototype.ChangePocket = function(pocketID) {
this.ValidatePocketSlit(pocketID, this.slitID);

if (this.productPricingObj) {
this.productPricingObj.HandleShowSubmitChanges();
}
};

PocketSlitPricing.prototype.SetPocket = function(pocketID) {
this.pocketID = pocketID;
};

PocketSlitPricing.prototype.ChangeSlit = function(slitID) {
this.ValidatePocketSlit(this.pocketID, slitID);

if (this.productPricingObj) {
this.productPricingObj.HandleShowSubmitChanges();
}
};

PocketSlitPricing.prototype.SetSlit = function(slitID) {
this.slitID = slitID;
SetRadioButtonListChecked(this.rblSlitName, slitID);
};

PocketSlitPricing.prototype.ValidatePocketSlit = function(pocketID, slitID) {
var ret = this.IsValidPocketSlit(pocketID, slitID);
if (!ret.VALIDATE_RESULT) {
if (ret.VALIDATE_MESSAGE) {
alert(ret.VALIDATE_MESSAGE);
}
this.SetPocket(ret.VALIDATE_POCKET);
this.SetSlit(ret.VALIDATE_SLIT);
}
else {
this.pocketID = pocketID;
this.slitID = slitID;
}
return ret.VALIDATE_RESULT;
};

PocketSlitPricing.prototype.IsValidPocketSlit = function(pocketID, slitID) {
var newSlitID = this.slitIDOri;
if ((pocketID == AttributeValueIDEnum.pockets_1_pocket_on_right && (slitID == AttributeValueIDEnum.slits_both_sides || slitID == AttributeValueIDEnum.slits_left_side)) ||
(pocketID == AttributeValueIDEnum.pockets_1_pocket_on_left && (slitID == AttributeValueIDEnum.slits_both_sides || slitID == AttributeValueIDEnum.slits_right_side))) {
//set newSlitID to match pocket choice
if (AttributeValueIDEnum.pockets_1_pocket_on_left == pocketID) {
newSlitID = AttributeValueIDEnum.slits_left_side
}
else if (AttributeValueIDEnum.pockets_1_pocket_on_right == pocketID) {
newSlitID = AttributeValueIDEnum.slits_right_side
}
return this.GetValidationObject(false, 'Please select a slit option to match your pocket choice.', pocketID, newSlitID);
}
return this.GetValidationObject(true);
};

PocketSlitPricing.prototype.GetValidationObject = function(validateResult, validateMessage, pocketID, slitID) {
return {
VALIDATE_RESULT : validateResult,
VALIDATE_MESSAGE : validateMessage,
VALIDATE_POCKET : pocketID,
VALIDATE_SLIT : slitID
};
};

PocketSlitPricing.prototype.IsChanged = function() {
 return (this.pocketIDOri != this.pocketID || this.slitIDOri != this.slitID);
};
if ('undefined' == typeof(inkImageArr)) {
var inkImageArr = new Array();
}
if ('undefined' == typeof(foldImageArr)) {
var foldImageArr = new Array();
}
if ('undefined' == typeof (paperImageArr)) {
var paperImageArr = new Array();
}
if ('undefined' == typeof(productArr)) {
var productArr = new Array();
}
if ('undefined' == typeof(inkArr)) {
var inkArr = new Array();
}
if ('undefined' == typeof(paperArr)) {
var paperArr = new Array();
}
if ('undefined' == typeof(turnaroundArr)) {
var turnaroundArr = new Array();
}
if ('undefined' == typeof(shipTypeArr)) {
var shipTypeArr = new Array();
}
if ('undefined' == typeof(mailingArr)) {
var mailingArr = new Array();
}
if ('undefined' == typeof(blankEnvelopeArr)) {
var blankEnvelopeArr = new Array();
}
if ('undefined' == typeof(hardProofArr)) {
var hardProofArr = new Array();
}
if ('undefined' == typeof(finishingArr)) {
var finishingArr = new Array();
}
if ('undefined' == typeof(productPricingArr)) {
var productPricingArr = new Array();
}
if ('undefined' == typeof(paperInfoArr)) {
var paperInfoArr = new Array();
}
if ('undefined' == typeof(paperWeightInfoArr)) {
var paperWeightInfoArr = new Array();
}
if ('undefined' == typeof(productInfoArr)) {
var productInfoArr = new Array();
}
if ('undefined' == typeof(shippingWeightArr)) {
var shippingWeightArr = new Array();
}
if ('undefined' == typeof(multipleVersionPricingArr)) {
var multipleVersionPricingArr = new Array();
}
if ('undefined' == typeof (pricedPerSignatureArr)) {
 var pricedPerSignatureArr = new Array();
}

var PRODUCT_IDX_BASE = 0;
var PRODUCT_IDX_EACH = 1;
var PRODUCT_IDX_REPRINT_DISCOUNT = 2;

var INK_IDX_4COLOR_BASE = 0;
var INK_IDX_4COLOR_EACH = 1;
var INK_IDX_BLACK_BASE = 2;
var INK_IDX_BLACK_EACH = 3;
var INK_IDX_AQUEOUS_BASE = 4;
var INK_IDX_AQUEOUS_EACH = 5;
var INK_IDX_1SPOT_BASE = 6;
var INK_IDX_1SPOT_EACH = 7;
var INK_IDX_2SPOT_BASE = 8;
var INK_IDX_2SPOT_EACH = 9;
var INK_IDX_3SPOT_BASE = 10;
var INK_IDX_3SPOT_EACH = 11;
var INK_IDX_4SPOT_BASE = 12;
var INK_IDX_4SPOT_EACH = 13;
var INK_IDX_5SPOT_BASE = 14;
var INK_IDX_5SPOT_EACH = 15;

var PAPER_IDX_BASE = 0;
var PAPER_IDX_EACH = 1;
var PAPER_IDX_SECOND_SHEETS_BASE = 2;
var PAPER_IDX_SECOND_SHEETS_EACH = 3;

var MAILING_IDX_BASE = 0;
var MAILING_IDX_MUL_EACH = 1;
var MAILING_IDX_MUL_EACH_5000 = 2;
var MAILING_IDX_MUL_EACH_10000 = 3;
var MAILING_IDX_POSTAGE_COST = 4;
var MAILING_IDX_MIN_QTY = 5;
var MAILING_IDX_HALF_FOLD_SURCHARGE = 6;
var MAILING_IDX_NO_FOLD_SURCHARGE = 7;
var MAILING_IDX_TRI_FOLD_SURCHARGE = 8;
var MAILING_IDX_TRI_THEN_HALF_FOLD_SURCHARGE = 9;
var MAILING_IDX_FOUR_PANEL_FOLD_SURCHARGE = 10;
var MAILING_IDX_COVER_STOCK_SURCHARGE = 11;
var MAILING_IDX_OPEN_GATE_FOLD_SURCHARGE = 12;
var MAILING_IDX_CLOSED_GATE_FOLD_SURCHARGE = 13;

var BLANKENVELOPE_IDX_BASE = 0;
var BLANKENVELOPE_IDX_EACH = 1;

var FINISHING_IDX_BASE = 0;
var FINISHING_IDX_EACH = 1;

var HARDPROOF_IDX_WIDTH = 1;
var HARDPROOF_IDX_HEIGHT = 2;
var HARDPROOF_IDX_FIRST_SHEET = 3;
var HARDPROOF_IDX_EACH_ADDITIONAL_SHEET = 4;

var PAPERINFO_IDX_NAME = 0;
var PAPERINFO_IDX_TYPE = 1;
var PAPERINFO_IDX_TIERID = 2;
var PAPERINFO_IDX_WEIGHTID = 4;
var PAPERINFO_IDX_WEIGHT = 5;

var PAPERWEIGHTINFO_IDX_WEIGHT = 0;
var PAPERWEIGHTINFO_IDX_UNIT = 1;

var PRODUCTINFO_IDX_MINQUANTITY = 0;
var PRODUCTINFO_IDX_FLATWIDTH = 1;
var PRODUCTINFO_IDX_FLATHEIGHT = 2;
var PRODUCTINFO_IDX_DEFAULT_PAPER = 3;
var PRODUCTINFO_IDX_PARTSPERSIGNATURE = 4;

var SHIPPINGWEIGHT_IDX_BASE = 0;
var SHIPPINGWEIGHT_IDX_EACH = 1;

var SHIPTYPE_IDX_MULTIPLIER = 1;

var PRICEDPERSIGNATURE_IDX_BOOL = 0;

var VALIDATE_RESULT = 'Result';
var VALIDATE_MESSAGE = 'Message';
var VALIDATE_PRODUCT_ID = 'ProductID';
var VALIDATE_QUANTITY = 'Quantity';

var ChannelPricingPercent = 1.0;
var ChannelID = null;var PrintedEnvelopePricings;

function PrintedEnvelopePricing(finishingPricingID, finishingID, rblName, imageID) {
this.imageID = imageID;
this.finishingPricingObj = new FinishingPricing(finishingPricingID, finishingID, rblName);

this.InsertPrintedEnvelopePricing();
}

PrintedEnvelopePricing.prototype.InsertPrintedEnvelopePricing = function() {
if (typeof(PrintedEnvelopePricings) == 'undefined') {
PrintedEnvelopePricings = new Object;
}
PrintedEnvelopePricings[this.finishingPricingObj.finishingPricingID] = this;
};

PrintedEnvelopePricing.prototype.ResetPrintedEnvelope = function() {
 SetRadioButtonListChecked(this.rblName, this.finishingID);
};

PrintedEnvelopePricing.prototype.ChangePrintedEnvelope = function(finishingID) {
this.finishingPricingObj.SetFinishingID(finishingID);

if (this.productPricingObj) {
LoadImage(this.imageID, this.GetPrintedEnvelopeImageName());
this.productPricingObj.HandleMailingBlankEnvelopes();
this.productPricingObj.HandleAttributePrices(AdjustTypeEnum.Envelope);
}
};

PrintedEnvelopePricing.prototype.GetPrintedEnvelopeImageName = function() {
return (this.finishingPricingObj.finishingID == AttributeValueIDEnum.imprint_return_address_in_black || this.finishingPricingObj.finishingID == AttributeValueIDEnum.imprint_medium || this.finishingPricingObj.finishingID == AttributeValueIDEnum.imprint_large) ? EnvelopeTypeEnum.PrintedImageName : EnvelopeTypeEnum.YesImageName;
};/// <reference path="Signatures/Part.js" />
/// <reference path="Signatures/SignatureCollectionBuilder.js" />
/// <reference path="Enums/ProductIDEnum.js" />
var ProductPricings;

function ProductPricing(productPricingID, isChangeProductOptions, orderingPage, productID, instaPriceID, inkPricingID, insideInkPricingID, spotPricingID, insideSpotPricingID, numPagesPricingID, aqueousPricingID, paperPricingID, insidePaperPricingID, foldPricingID, sizePricingID, sealPricingID, roundCornerPricingID, blankEnvelopePricingID, secondSheetPricingID, turnaroundPricingID, shipTypePricingID, mailingPricingID, pocketSlitPricingID, nameQtyPricingID, txtCouponCodeID, hasChannelMarkupPercent, confirmAsIsID, blankEnvelopeImprintID, upgradeDiscountPricingID, conversionPricingID, bindingPricingID, variableDataPricingID) {
this.productPricingID = productPricingID;
this.isChangeProductOptions = isChangeProductOptions;
this.orderingPage = orderingPage;
this.productID = productID;
this.instaPriceID = instaPriceID;
this.inkPricingID = inkPricingID;
this.insideInkPricingID = insideInkPricingID;
this.spotPricingID = spotPricingID;
this.insideSpotPricingID = insideSpotPricingID;
this.numPagesPricingID = numPagesPricingID;
this.aqueousPricingID = aqueousPricingID;
this.paperPricingID = paperPricingID;
this.insidePaperPricingID = insidePaperPricingID;
this.foldPricingID = foldPricingID;
this.sizePricingID = sizePricingID;
this.sealPricingID = sealPricingID;
this.roundCornerPricingID = roundCornerPricingID;
this.blankEnvelopePricingID = blankEnvelopePricingID;
this.secondSheetPricingID = secondSheetPricingID;
this.turnaroundPricingID = turnaroundPricingID;
this.shipTypePricingID = shipTypePricingID;
this.mailingPricingID = mailingPricingID;
this.pocketSlitPricingID = pocketSlitPricingID;
this.nameQtyPricingID = nameQtyPricingID;
this.txtCouponCodeID = txtCouponCodeID;
this.hasChannelMarkupPercent = hasChannelMarkupPercent;
this.confirmAsIsID = confirmAsIsID;
this.blankEnvelopeImprintID = blankEnvelopeImprintID;
this.upgradeDiscountPricingID = upgradeDiscountPricingID;
this.conversionPricingID = conversionPricingID;
this.bindingPricingID = bindingPricingID;
this.variableDataPricingID = variableDataPricingID;
this.quantityList = new Array();

this.InsertProductPricing();
}

ProductPricing.prototype.InsertProductPricing = function() {
if (typeof(ProductPricings) == 'undefined') {
ProductPricings = new Object;
}
ProductPricings[this.productPricingID] = this;
};

// BEGIN - Associate collections
// AssociateCollections must be called after the page is loaded using AddEventHandler
ProductPricing.prototype.AssociateCollections = function(resetInputs) {
this.hasInstaPrice = (this.instaPriceID && typeof (InstaPrices) != 'undefined');
if (this.hasInstaPrice) {
this.AssociateProductPricing(InstaPrices, this.instaPriceID);
}
this.hasUpgradeDiscount = (this.upgradeDiscountPricingID && typeof (UpgradeDiscounts) != 'undefined');
if (this.hasUpgradeDiscount) {
this.AssociateProductPricing(UpgradeDiscounts, this.upgradeDiscountPricingID);
}
if (this.confirmAsIsID &&
 typeof (ConfirmAsIss) != 'undefined' &&
 typeof (ConfirmAsIss[this.confirmAsIsID]) != 'undefined') {
this.AssociateProductPricing(ConfirmAsIss, this.confirmAsIsID);
}
this.hasInkPricing = (this.inkPricingID && typeof (InkPricings) != 'undefined' &&
 'undefined' != typeof (InkPricings[this.inkPricingID]));
if (this.hasInkPricing) {
this.AssociateProductPricing(InkPricings, this.inkPricingID);
}
this.hasInsideInkPricing = (this.insideInkPricingID && typeof (InkPricings) != 'undefined' &&
'undefined' != typeof (InkPricings[this.insideInkPricingID]));
if (this.hasInsideInkPricing) {
this.AssociateProductPricing(InkPricings, this.insideInkPricingID);
}
this.hasSpotPricing = (this.spotPricingID && typeof (SpotPricings) != 'undefined' &&
'undefined' != typeof (SpotPricings[this.spotPricingID]));
if (this.hasSpotPricing) {
this.AssociateProductPricing(SpotPricings, this.spotPricingID);
}
this.hasInsideSpotPricing = (this.insideSpotPricingID && typeof (SpotPricings) != 'undefined' &&
'undefined' != typeof (SpotPricings[this.insideSpotPricingID]));
if (this.hasInsideSpotPricing) {
this.AssociateProductPricing(SpotPricings, this.insideSpotPricingID);
}
this.hasNumPagesPricing = (this.numPagesPricingID && typeof (NumPagesPricings) != 'undefined' &&
'undefined' != typeof (NumPagesPricings[this.numPagesPricingID]));
if (this.hasNumPagesPricing) {
this.AssociateProductPricing(NumPagesPricings, this.numPagesPricingID);
}
this.hasAqueousPricing = (this.aqueousPricingID && typeof (AqueousPricings) != 'undefined' &&
'undefined' != typeof (AqueousPricings[this.aqueousPricingID]));
if (this.hasAqueousPricing) {
this.AssociateProductPricing(AqueousPricings, this.aqueousPricingID);
}
this.hasPaperPricing = (this.paperPricingID && typeof (PaperPricings) != 'undefined' &&
'undefined' != typeof (PaperPricings[this.paperPricingID]));
if (this.hasPaperPricing) {
this.AssociateProductPricing(PaperPricings, this.paperPricingID);
}
this.hasInsidePaperPricing = (this.insidePaperPricingID && typeof (PaperPricings) != 'undefined' &&
'undefined' != typeof (PaperPricings[this.insidePaperPricingID]));
if (this.hasInsidePaperPricing) {
this.AssociateProductPricing(PaperPricings, this.insidePaperPricingID);
}
this.hasFoldPricing = (this.foldPricingID && typeof (FoldPricings) != 'undefined' &&
'undefined' != typeof (FoldPricings[this.foldPricingID]));
if (this.hasFoldPricing) {
this.AssociateProductPricing(FoldPricings, this.foldPricingID);
}
this.hasSizePricing = (this.sizePricingID && typeof (SizePricings) != 'undefined' &&
'undefined' != typeof (SizePricings[this.sizePricingID]));
if (this.hasSizePricing) {
this.AssociateProductPricing(SizePricings, this.sizePricingID);
}
this.hasSealPricing = (this.sealPricingID && typeof (SealPricings) != 'undefined' &&
'undefined' != typeof (SealPricings[this.sealPricingID]));
if (this.hasSealPricing) {
this.AssociateProductPricing(SealPricings, this.sealPricingID);
}
this.hasRoundCornerPricing = (this.roundCornerPricingID && typeof (RoundCornerPricings) != 'undefined' &&
'undefined' != typeof (RoundCornerPricings[this.roundCornerPricingID]));
if (this.hasRoundCornerPricing) {
this.AssociateProductPricing(RoundCornerPricings, this.roundCornerPricingID);
}
this.hasBlankEnvelopePricing = (this.blankEnvelopePricingID && typeof (BlankEnvelopePricings) != 'undefined' &&
'undefined' != typeof (BlankEnvelopePricings[this.blankEnvelopePricingID]));
if (this.hasBlankEnvelopePricing) {
this.AssociateProductPricing(BlankEnvelopePricings, this.blankEnvelopePricingID);
}
this.hasEnvelopeImprintPricing = (this.blankEnvelopeImprintID && typeof (PrintedEnvelopePricings) != 'undefined' &&
'undefined' != typeof (PrintedEnvelopePricings[this.blankEnvelopeImprintID]));
if (this.hasEnvelopeImprintPricing) {
this.AssociateProductPricing(PrintedEnvelopePricings, this.blankEnvelopeImprintID);
}
this.hasSecondSheetPricing = (this.secondSheetPricingID && typeof (SecondSheetPricings) != 'undefined' &&
'undefined' != typeof (SecondSheetPricings[this.secondSheetPricingID]));
if (this.hasSecondSheetPricing) {
this.AssociateProductPricing(SecondSheetPricings, this.secondSheetPricingID);
}
this.hasTurnaroundPricing = (this.turnaroundPricingID && typeof (TurnaroundPricings) != 'undefined' &&
'undefined' != typeof (TurnaroundPricings[this.turnaroundPricingID]));
if (this.hasTurnaroundPricing) {
this.AssociateProductPricing(TurnaroundPricings, this.turnaroundPricingID);
}
this.hasShipTypePricing = (this.shipTypePricingID && typeof (ShipTypePricings) != 'undefined' &&
'undefined' != typeof (ShipTypePricings[this.shipTypePricingID]));
if (this.hasShipTypePricing) {
this.AssociateProductPricing(ShipTypePricings, this.shipTypePricingID);
}
this.hasMailingPricing = (this.mailingPricingID && typeof (MailingPricings) != 'undefined' &&
'undefined' != typeof (MailingPricings[this.mailingPricingID]));
if (this.hasMailingPricing) {
this.AssociateProductPricing(MailingPricings, this.mailingPricingID);
MailingPricings[this.mailingPricingID].HandleSizeChange(this.productID); //disable mailing methods onload
}
this.hasPocketSlitPricing = (this.pocketSlitPricingID && typeof (PocketSlitPricings) != 'undefined' &&
'undefined' != typeof (PocketSlitPricings[this.pocketSlitPricingID]));
if (this.hasPocketSlitPricing) {
this.AssociateProductPricing(PocketSlitPricings, this.pocketSlitPricingID);
}
this.hasNameQtyPricing = (this.nameQtyPricingID && typeof (NameQtyPricings) != 'undefined' &&
'undefined' != typeof (NameQtyPricings[this.nameQtyPricingID]));
if (this.hasNameQtyPricing) {
this.AssociateProductPricing(NameQtyPricings, this.nameQtyPricingID);
}
this.hasDieCutPricing = (this.orderingPage == OrderingPageEnum.cardsdoorhangers);
if (this.hasDieCutPricing) {
this.diecutPricingObj = new FinishingPricing('diecut', AttributeValueIDEnum.diecut_door_hanger_die_cut);
}
this.hasDrillholePricing = (this.orderingPage == OrderingPageEnum.calendars);
if (this.hasDrillholePricing) {
this.drillholePricingObj = new FinishingPricing('drillhole', AttributeValueIDEnum.drillholes_1_8_drill_hole);
}
this.hasConversionPricing = (this.conversionPricingID && typeof (ConversionPricings) != 'undefined' &&
'undefined' != typeof (ConversionPricings[this.conversionPricingID]));
if (this.hasConversionPricing) {
this.AssociateProductPricing(ConversionPricings, this.conversionPricingID);
}
this.hasBindingPricing = (this.bindingPricingID && typeof (BindingPricings) != 'undefined' &&
'undefined' != typeof (BindingPricings[this.bindingPricingID]));
if (this.hasBindingPricing) {
this.AssociateProductPricing(BindingPricings, this.bindingPricingID);
}
this.hasVariableDataPricing = (this.variableDataPricingID && typeof (VariableDataPricings) != 'undefined' &&
'undefined' != typeof (VariableDataPricings[this.variableDataPricingID]));
if (this.hasVariableDataPricing) {
this.AssociateProductPricing(VariableDataPricings, this.variableDataPricingID);
}

if (resetInputs) {
var productPricingID = this.productPricingID;
AddEventHandler(window, 'load', function() { ProductPricings[productPricingID].ResetInputs(); });
}
};

ProductPricing.prototype.ResetInputs = function() {
if (this.hasInstaPrice) {
InstaPrices[this.instaPriceID].ResetQuantity();
}
if (this.hasUpgradeDiscount) {
UpgradeDiscounts[this.upgradeDiscountPricingID].ResetUpgradeDiscounts();
}
if (this.hasInkPricing) {
InkPricings[this.inkPricingID].ResetInk(this.productID);
}
if (this.hasNumPagesPricing) {
NumPagesPricings[this.numPagesPricingID].ResetNumPages();
}
if (this.hasAqueousPricing) {
AqueousPricings[this.aqueousPricingID].ResetAqueous();
}
if (this.hasPaperPricing) {
PaperPricings[this.paperPricingID].ResetPaper();
}
if (this.hasInsidePaperPricing) {
PaperPricings[this.insidePaperPricingID].ResetPaper();
}
if (this.hasFoldPricing) {
FoldPricings[this.foldPricingID].ResetFold();
}
if (this.hasSizePricing) {
SizePricings[this.sizePricingID].ResetSize();
}
if (this.hasSealPricing) {
SealPricings[this.sealPricingID].ResetSeal();
}
if (this.hasRoundCornerPricing) {
RoundCornerPricings[this.roundCornerPricingID].ResetRoundCorner();
}
if (this.hasBlankEnvelopePricing) {
BlankEnvelopePricings[this.blankEnvelopePricingID].ResetBlankEnvelopeQuantity();
}
if (this.hasEnvelopeImprintPricing) {
PrintedEnvelopePricings[this.blankEnvelopeImprintID].ResetPrintedEnvelope();
}
if (this.hasSecondSheetPricing) {
SecondSheetPricings[this.secondSheetPricingID].ResetSecondSheetQuantity();
}
if (this.hasTurnaroundPricing) {
TurnaroundPricings[this.turnaroundPricingID].ResetTurnaround();
}
if (this.hasShipTypePricing) {
ShipTypePricings[this.shipTypePricingID].ResetShipType();
}
if (this.hasMailingPricing) {
MailingPricings[this.mailingPricingID].ResetMailing();
}
if (this.hasPocketSlitPricing) {
PocketSlitPricings[this.pocketSlitPricingID].ResetPocketSlit();
}
if (this.hasNameQtyPricing && (window.location.href.toUpperCase().indexOf('DOBCARDS') == -1)) {
NameQtyPricings[this.nameQtyPricingID].ResetNameQty();
}
if (this.hasConversionPricing) {
ConversionPricings[this.conversionPricingID].ResetConversion();
}
if (this.hasBindingPricing) {
BindingPricings[this.bindingPricingID].ResetPadding();
}
if (this.hasVariableDataPricing) {
VariableDataPricings[this.variableDataPricingID].Reset();
}
};

ProductPricing.prototype.AssociateProductPricing = function(coll, itemID) {
if (typeof(coll[itemID]) != 'undefined') {
coll[itemID].productPricingObj = this;
}
};
// END - Associate collections

// BEGIN - Return specific collections
ProductPricing.prototype.GetInkPricingObj = function(coverInside) {
 var inkPricingObj;
 if (typeof (InkPricings) != 'undefined') {
 for (var inkPricingID in InkPricings) {
 inkPricingObj = InkPricings[inkPricingID];
 if (inkPricingObj.productPricingObj == this && (typeof (coverInside) == 'undefined' || inkPricingObj.coverInside == coverInside)) {
 return inkPricingObj;
 }
 }
 }
 return null;
};

ProductPricing.prototype.GetSpotPricingObj = function(coverInside) {
 var spotPricingObj;
 if (typeof (SpotPricings) != 'undefined') {
 for (var spotPricingID in SpotPricings) {
 spotPricingObj = SpotPricings[spotPricingID];
 if (spotPricingObj.productPricingObj == this && (spotPricingObj.coverInside == coverInside || (typeof (coverInside) == 'undefined' && spotPricingObj.coverInside == CoverInsideEnum.ForCover))) {
 return spotPricingObj;
 }
 }
 }
 return null;
};

ProductPricing.prototype.GetPaperPricingObj = function(coverInside) {
 var paperPricingObj;
 if (typeof (PaperPricings) != 'undefined') {
 for (var paperPricingID in PaperPricings) {
 paperPricingObj = PaperPricings[paperPricingID];
 if (paperPricingObj.productPricingObj == this && (typeof (coverInside) == 'undefined' || paperPricingObj.coverInside == coverInside)) {
 return paperPricingObj;
 }
 }
 }
 return null;
};

ProductPricing.prototype.GetNumPagesPricingObj = function() {
 var numPagesPricingObj;
 if (typeof (NumPagesPricings) != 'undefined') {
 for (var numPagesPricingID in NumPagesPricings) {
 numPagesPricingObj = NumPagesPricings[numPagesPricingID];
 if (numPagesPricingObj.productPricingObj == this) {
 return numPagesPricingObj;
 }
 }
 }
 return null;
};
// END - Return specific collections

// BEGIN - Adjust Prices
ProductPricing.prototype.AdjustPrices = function(adjustType, pricingID) {
var markupPercent = 0;
this.AdjustPricesCore(adjustType, pricingID, markupPercent);

if (this.hasInstaPrice) {
markupPercent = InstaPrices[this.instaPriceID].GetMarkupPercent();
if (markupPercent != 0) {
if (ChannelID == ChannelIDEnum.OfficeMax) {
InstaPrices[this.instaPriceID].StoreIPPrices(); //store IP prices
}
this.AdjustPricesCore(adjustType, pricingID, markupPercent);
}
}
};

ProductPricing.prototype.AdjustPricesCore = function(adjustType, pricingID, markupPercent) {
 var adjustTypeUndefined = (typeof (adjustType) == 'undefined' || ChannelID == ChannelIDEnum.OfficeMax); //recalculating all prices for OfficeMax to store the IP pricing 
 var adjustTypeAdditionalMarkupPercent = (adjustType == AdjustTypeEnum.AdditionalMarkupPercent);
 var adjustTypeAqueous = (adjustType == AdjustTypeEnum.Aqueous);
 var adjustTypeEnvelope = (adjustType == AdjustTypeEnum.Envelope);
 var adjustTypeFold = (adjustType == AdjustTypeEnum.Fold);
 var adjustTypeInk = (adjustType == AdjustTypeEnum.Ink);
 var adjustTypeSpot = (adjustType == AdjustTypeEnum.Spot);
 var adjustTypeMailing = (adjustType == AdjustTypeEnum.Mailing);
 var adjustTypeNumPages = (adjustType == AdjustTypeEnum.NumPages);
 var adjustTypePaper = (adjustType == AdjustTypeEnum.Paper);
 var adjustTypeQuantity = ((adjustType == AdjustTypeEnum.Quantity) || (adjustType == AdjustTypeEnum.Padding));
 var adjustTypeRoundCorner = (adjustType == AdjustTypeEnum.RoundCorner);
 var adjustTypeSeal = (adjustType == AdjustTypeEnum.Seal);
 var adjustTypeSecondSheet = (adjustType == AdjustTypeEnum.SecondSheet);
 var adjustTypeShipType = (adjustType == AdjustTypeEnum.ShipType);
 var adjustTypeTurnaround = (adjustType == AdjustTypeEnum.Turnaround);
 var adjustTypeUpgradeDiscount = (adjustType == AdjustTypeEnum.UpgradeDiscount);
 var adjustTypeConversion = (adjustType == AdjustTypeEnum.Conversion);
 var adjustTypePadding = (adjustType == AdjustTypeEnum.Padding);
 var adjustTypeVariableData = (adjustType == AdjustTypeEnum.VariableData);
 var adjustTypePrintingSubtotal = (adjustTypeInk || adjustTypeSpot || adjustTypeNumPages || adjustTypeQuantity || adjustTypeAqueous || adjustTypePaper || adjustTypeFold || adjustTypeSeal || adjustTypeRoundCorner || adjustTypeAdditionalMarkupPercent || adjustTypeConversion || adjustTypePadding || adjustTypeVariableData);

 var multiVersionCount = 1;
 //if (typeof (IsPPS) != 'undefined' && IsPPS && this.quantityList.length > 0) { //PPS business cards
 //multiVersionCount = this.quantityList.length;
 //}
 //else
 if (this.hasNameQtyPricing) { //business cards
 var nameQtyPricingObj = NameQtyPricings[this.nameQtyPricingID];
 // 3/10/09 DK - IMPORTANT NOTE: Multi version pricing functionality will be disabled for business cards until CQ Phase 2
 //multiVersionCount = nameQtyPricingObj.GetVersionCount();
 this.quantityList = nameQtyPricingObj.QuantityList();
 }
 else if (this.hasNumPagesPricing) { //catalogs & calendars
 multiVersionCount = Math.round(NumPagesPricings[this.numPagesPricingID].numPages / 4 / this.GetPartsPerSignature());
 }
 var multiVersionPercent = this.GetMultipleVersionPricingPercent(multiVersionCount);
 var percentCollection = this.GetPercentCollection(markupPercent, multiVersionPercent);

 this.quantity = InstaPrices[this.instaPriceID].quantity;
 if (this.orderingPage == OrderingPageEnum.notepadprinting) {
 this.quantity = this.quantity * StripNonNumeric(AttributeValueNameEnum[FinishingPricings[BindingPricings[this.bindingPricingID].rblSheetsPerUnitID].finishingID])
 }
 if (this.hasChannelMarkupPercent || adjustTypeUndefined || adjustTypeQuantity || adjustTypeNumPages || adjustTypeAdditionalMarkupPercent) {
 this.AdjustBaseProductPrice(percentCollection);
 }
 if (this.hasChannelMarkupPercent || adjustTypeUndefined || adjustTypeQuantity || adjustTypeAdditionalMarkupPercent) {
 this.AdjustBaseDieCutPrice(percentCollection);
 }
 if (this.hasChannelMarkupPercent || adjustTypeUndefined || adjustTypeQuantity || adjustTypeAdditionalMarkupPercent) {
 this.AdjustBaseDrillholePrice(percentCollection);
 }
 if (this.hasChannelMarkupPercent || adjustTypeUndefined || adjustTypeInk || adjustTypeNumPages || adjustTypeQuantity || adjustTypeAdditionalMarkupPercent) {
 this.AdjustBaseInkPrice(percentCollection);
 }
 if (this.hasChannelMarkupPercent || adjustTypeUndefined || adjustTypeSpot || adjustTypeNumPages || adjustTypeQuantity || adjustTypeAdditionalMarkupPercent) {
 this.AdjustBaseSpotPrice(percentCollection);
 }
 if (this.hasChannelMarkupPercent || adjustTypeUndefined || adjustTypePaper || adjustTypeNumPages || adjustTypeQuantity || adjustTypeAdditionalMarkupPercent) {
 this.AdjustPaperUpgradePrice((this.hasChannelMarkupPercent) ? null : pricingID, percentCollection);
 }
 if (this.hasChannelMarkupPercent || adjustTypeUndefined || adjustTypeAqueous || adjustTypeInk || adjustTypeSpot || adjustTypePaper || adjustTypeNumPages || adjustTypeQuantity || adjustTypeAdditionalMarkupPercent) {
 this.AdjustAqueousPrice(percentCollection);
 }
 if (this.hasChannelMarkupPercent || adjustTypeUndefined || adjustTypeFold || adjustTypeMailing || adjustTypePaper || adjustTypeNumPages || adjustTypeQuantity || adjustTypeAdditionalMarkupPercent) {
 this.AdjustFoldPrice(percentCollection);
 }
 if (this.hasChannelMarkupPercent || adjustTypeUndefined || adjustTypeConversion || adjustTypeQuantity || adjustTypeAdditionalMarkupPercent) {
 this.AdjustConversionPrice(percentCollection);
 }
 if (this.hasChannelMarkupPercent || adjustTypeUndefined || adjustTypePadding || adjustTypePaper || adjustTypeQuantity || adjustTypeAdditionalMarkupPercent) {
 this.AdjustPaddingPrice(percentCollection);
 }
 if (this.hasChannelMarkupPercent || adjustTypeUndefined || adjustTypeVariableData || adjustTypeQuantity || adjustTypeAdditionalMarkupPercent) {
 this.AdjustVariableDataPrice(percentCollection);
 }
 if (this.hasChannelMarkupPercent || adjustTypeUndefined || adjustTypeSeal || adjustTypeInk || adjustTypeSpot || adjustTypeQuantity || adjustTypeAdditionalMarkupPercent) {
 this.AdjustSealPrice(percentCollection);
 }
 if (this.hasChannelMarkupPercent || adjustTypeUndefined || adjustTypeRoundCorner || adjustTypeInk || adjustTypeSpot || adjustTypeQuantity || adjustTypeAdditionalMarkupPercent) {
 this.AdjustRoundCornerPrice(percentCollection);
 }
 if (this.hasChannelMarkupPercent || adjustTypeUndefined || adjustTypeEnvelope || adjustTypeMailing || adjustTypeQuantity || adjustTypeAdditionalMarkupPercent) {
 this.AdjustEnvelopePrice(percentCollection);
 }
 if (this.hasChannelMarkupPercent || adjustTypeUndefined || adjustTypeSecondSheet || adjustTypePaper || adjustTypeAdditionalMarkupPercent) {
 this.AdjustSecondSheetPrice(percentCollection);
 }
 if (adjustTypeUndefined || adjustTypeTurnaround || adjustTypePrintingSubtotal || adjustTypeAdditionalMarkupPercent) {
 this.AdjustTurnaroundPrice(percentCollection);
 }
 if (adjustTypeUndefined || adjustTypeShipType || adjustTypeMailing || adjustTypeNumPages || adjustTypeSecondSheet || adjustTypePaper || adjustTypeQuantity) {
 this.AdjustShipTypePrice(percentCollection);
 }
 if (adjustTypeUndefined || adjustTypeShipType || adjustTypeMailing || adjustTypeNumPages || adjustTypePaper || adjustTypeFold || adjustTypeQuantity) {
 this.AdjustMailingPrice(percentCollection);
 }
 if (adjustTypeUpgradeDiscount) {
 this.AdjustUpgradeDiscount();
 }
 this.AdjustCouponPrices();
 this.AdjustPFLProDiscount();
};

ProductPricing.prototype.AdjustBaseProductPrice = function(percentCollection) {
if (this.hasInstaPrice) {
var instaPriceObj = InstaPrices[this.instaPriceID];
 instaPriceObj.AdjustBaseProductPrice(this.GetProductPrice(percentCollection));
}
};

ProductPricing.prototype.AdjustBaseDieCutPrice = function(percentCollection) {
if (this.hasInstaPrice && this.hasDieCutPricing) {
var instaPriceObj = InstaPrices[this.instaPriceID];
instaPriceObj.AdjustBaseDieCutPrice(this.diecutPricingObj.GetFinishingPrice(AttributeValueIDEnum.diecut_door_hanger_die_cut, this.quantity, this.productID, percentCollection, null, this.quantityList));
}
};

ProductPricing.prototype.AdjustBaseDrillholePrice = function(percentCollection) {
if (this.hasInstaPrice && this.hasDrillholePricing) {
var instaPriceObj = InstaPrices[this.instaPriceID];

//hardcoded attribute for calendars
//cover price
 instaPriceObj.AdjustBaseDrillholePrice(this.drillholePricingObj.GetFinishingPrice(AttributeValueIDEnum.drillholes_1_8_drill_hole, this.quantity, this.productID, percentCollection, null, this.quantityList), CoverInsideEnum.ForCover);
//inside price
var signatures = this.CreateSignatures(null, null, null, AttributeValueIDEnum.drillholes_1_8_drill_hole, null, CoverInsideEnum.ForInside);
 instaPriceObj.AdjustBaseDrillholePrice(this.drillholePricingObj.GetFinishingPrice(AttributeValueIDEnum.drillholes_1_8_drill_hole, this.quantity, this.productID, percentCollection, signatures, this.quantityList), CoverInsideEnum.ForInside);
}
};

ProductPricing.prototype.AdjustBaseInkPrice = function(percentCollection) {
 if (this.hasInstaPrice && this.hasInkPricing) {
 var instaPriceObj = InstaPrices[this.instaPriceID];
 var inkPricingObj;
 for (var inkPricingID in InkPricings) {
 inkPricingObj = InkPricings[inkPricingID];
 if (inkPricingObj.productPricingObj == this && (typeof (pricingID) == 'undefined' || pricingID == null || inkPricingObj.inkPricingID == pricingID)) {
 var signatures = this.GetSignatures(inkPricingObj.coverInside, { inkFID: inkPricingObj.GetInk(AttributePlacementEnum.front), inkBID: inkPricingObj.GetInk(AttributePlacementEnum.back), paperID: null });
 if (inkPricingObj.coverInside != CoverInsideEnum.ForInside || this.HasInsidePages()) {
 instaPriceObj.AdjustBaseInkPrice(inkPricingObj.GetTotalInkPrice(this.productID, this.quantity, signatures, percentCollection), inkPricingObj.coverInside);
 }
 else { //price is zero for inside pages when there are no inside pages
 instaPriceObj.AdjustBaseInkPrice(0, inkPricingObj.coverInside);
 }
 }
 }
 }
};

ProductPricing.prototype.AdjustBaseSpotPrice = function(percentCollection) {
 if (this.hasInstaPrice && this.hasSpotPricing) {
 var instaPriceObj = InstaPrices[this.instaPriceID];
 var spotPricingObj;
 for (var spotPricingID in SpotPricings) {
 spotPricingObj = SpotPricings[spotPricingID];
 if (spotPricingObj.productPricingObj == this && (typeof (pricingID) == 'undefined' || pricingID == null || spotPricingObj.spotPricingID == pricingID)) {
 var signatures = this.GetSignatures(spotPricingObj.coverInside, { inkFID: null, inkBID: null, paperID: null, spotFID: spotPricingObj.GetSpot(AttributePlacementEnum.front), spotBID: spotPricingObj.GetSpot(AttributePlacementEnum.back) });
 if (spotPricingObj.coverInside != CoverInsideEnum.ForInside || this.HasInsidePages()) {
 var price = spotPricingObj.GetTotalSpotPrice(this.productID, spotPricingObj.spotFID, spotPricingObj.spotBID, this.quantity, signatures, percentCollection);
 if (typeof (FinishingPricings[spotPricingObj.spotPricingID]) != 'undefined') {
 price += FinishingPricings[spotPricingObj.spotPricingID].GetFinishingPrice(FinishingPricings[spotPricingObj.spotPricingID].finishingID, this.quantity, this.productID, percentCollection, null, this.quantityList);
 }
 instaPriceObj.AdjustBaseSpotPrice(price, spotPricingObj.coverInside);
 }
 else { //price is zero for inside pages when there are no inside pages
 instaPriceObj.AdjustBaseSpotPrice(0, spotPricingObj.coverInside);
 }
 }
 }
 }
};

ProductPricing.prototype.AdjustAqueousPrice = function(percentCollection) {
if (this.hasInstaPrice && (this.hasInkPricing || this.hasSpotPricing) && this.hasAqueousPricing && this.hasPaperPricing) {
var instaPriceObj = InstaPrices[this.instaPriceID];
var inkFID = '';
var inkBID = '';
var spotFID = '';
var spotBID = '';
if (this.hasInkPricing) {
var inkPricingObj = this.GetInkPricingObj();
inkFID = inkPricingObj.GetInk(AttributePlacementEnum.front);
inkBID = inkPricingObj.GetInk(AttributePlacementEnum.back);
}
if (this.hasSpotPricing) {
var spotPricingObj = SpotPricings[this.spotPricingID];
spotFID = spotPricingObj.GetSpot(AttributePlacementEnum.front);
spotBID = spotPricingObj.GetSpot(AttributePlacementEnum.back);
}
var aqueousPricingObj = AqueousPricings[this.aqueousPricingID];
var paperPricingObj = this.GetPaperPricingObj();
instaPriceObj.AdjustAqueousPrice(aqueousPricingObj.GetTotalAqueousPrice(this.productID, inkFID, inkBID, spotFID, spotBID, this.quantity, null, paperPricingObj.paperID, percentCollection), aqueousPricingObj.coverInside);
}
};

ProductPricing.prototype.AdjustPaperUpgradePrice = function(pricingID, percentCollection) {
if (this.hasInstaPrice && this.hasPaperPricing) {
var instaPriceObj = InstaPrices[this.instaPriceID];
var paperPricingObj;
for(var paperPricingID in PaperPricings) {
paperPricingObj = PaperPricings[paperPricingID];
if (paperPricingObj.productPricingObj == this && (typeof (pricingID) == 'undefined' || pricingID == null || paperPricingObj.paperPricingID == pricingID)) {
if(paperPricingObj.coverInside != CoverInsideEnum.ForInside || this.HasInsidePages()) { 
 if(paperPricingObj.coverInside == CoverInsideEnum.ForInside && this.HasInsidePages()) {
 var signatures = this.CreateSignatures(null, null, PaperPricings[paperPricingID].paperID, null, null, paperPricingObj.coverInside);
 }
 instaPriceObj.AdjustPaperUpgradePrice(paperPricingObj.GetPaperUpgradePrice(this.productID, this.quantity, percentCollection, paperPricingObj.coverInside, signatures), paperPricingObj.coverInside);
 instaPriceObj.AdjustPaperBasePrice(paperPricingObj.GetPaperBasePrice(this.productID, this.quantity, percentCollection, paperPricingObj.coverInside, signatures), paperPricingObj.coverInside);
}
else { //price is zero for inside pages when there are no inside pages
 instaPriceObj.AdjustPaperUpgradePrice(0, paperPricingObj.coverInside);
 instaPriceObj.AdjustPaperBasePrice(0, paperPricingObj.coverInside);
}
}
}
}
};

ProductPricing.prototype.GetSignatures = function(coverInside, attributeValueObj) {
if (coverInside == CoverInsideEnum.ForInside) { //checking if insidepaper object0
if (this.HasInsidePages()) {
 return this.CreateSignatures(attributeValueObj.inkFID, attributeValueObj.inkBID, attributeValueObj.paperID, null, null, coverInside, attributeValueObj.spotFID, attributeValueObj.spotBID);
}
}
return null;
};

ProductPricing.prototype.AdjustFoldPrice = function(percentCollection) {
if (this.hasInstaPrice && this.hasFoldPricing && this.hasPaperPricing) {
var instaPriceObj = InstaPrices[this.instaPriceID];
var foldPricingObj = FoldPricings[this.foldPricingID];
var foldPrice = 0;
if (foldPricingObj.coverInside == CoverInsideEnum.ForInside && this.HasInsidePages()) {
var signatures = this.CreateSignatures(null, null, null, null, AttributeValueIDEnum.foldcollatestaple_fold_collate_stitch, foldPricingObj.coverInside);
for (var paperPricingID in PaperPricings) {
paperPricingObj = PaperPricings[paperPricingID];
if (paperPricingObj.productPricingObj == this && paperPricingObj.coverInside == CoverInsideEnum.ForInside && this.HasInsidePages()) {
var paperInsideID = paperPricingObj.paperID;
}
}

foldPrice += foldPricingObj.GetFoldPrice(AttributeValueIDEnum.foldcollatestaple_fold_collate_stitch, this.quantity, this.IsCoverPaper(paperInsideID), this.productID, percentCollection, signatures);
//get fold price for cover
foldPrice += foldPricingObj.GetFoldPrice(AttributeValueIDEnum.foldcollatestaple_fold_collate_stitch, this.quantity, this.IsCoverPaper(), this.productID, percentCollection, null);
}
else {
foldPrice = foldPricingObj.GetFoldPrice(foldPricingObj.finishingPricingObj.finishingID, this.quantity, this.IsCoverPaper(), this.productID, percentCollection, null);
}
instaPriceObj.AdjustFoldPrice(foldPrice, foldPricingObj.coverInside);
}
};

ProductPricing.prototype.AdjustConversionPrice = function(percentCollection) {

if (this.hasInstaPrice && this.hasConversionPricing) {
var instaPriceObj = InstaPrices[this.instaPriceID];
var conversionPricingObj = ConversionPricings[this.conversionPricingID];
instaPriceObj.AdjustConversionPrice(conversionPricingObj.finishingPricingObj.GetFinishingPrice(conversionPricingObj.finishingPricingObj.finishingID, this.quantity, this.productID, percentCollection, null, this.quantityList));
}
};

ProductPricing.prototype.AdjustPaddingPrice = function(percentCollection) {
if (this.hasInstaPrice && this.hasBindingPricing) {
var instaPriceObj = InstaPrices[this.instaPriceID];
var bindingPricingObj = BindingPricings[this.bindingPricingID];
if (FinishingPricings[bindingPricingObj.rblSheetsPerUnitID] && FinishingPricings[bindingPricingObj.rblSheetsPerUnitID].finishingID != '') {
var padsOf = this.quantity / StripNonNumeric(AttributeValueNameEnum[FinishingPricings[bindingPricingObj.rblSheetsPerUnitID].finishingID]);
instaPriceObj.AdjustSheetsPerUnitPrice(FinishingPricings[bindingPricingObj.rblSheetsPerUnitID].GetFinishingPrice(FinishingPricings[bindingPricingObj.rblSheetsPerUnitID].finishingID, this.quantity, this.productID, percentCollection, null, this.quantityList));
instaPriceObj.AdjustCollatePrice(FinishingPricings['Collate'].GetFinishingPrice(FinishingPricings['Collate'].finishingID, padsOf, this.productID, percentCollection, null, this.quantityList));
instaPriceObj.AdjustBackingPrice(FinishingPricings['Backing'].GetFinishingPrice(FinishingPricings['Backing'].finishingID, padsOf, this.productID, percentCollection, null, this.quantityList));
instaPriceObj.AdjustCoverPrice(FinishingPricings['Cover'].GetFinishingPrice(FinishingPricings['Cover'].finishingID, padsOf, this.productID, percentCollection, null, this.quantityList));
instaPriceObj.AdjustBindingPrice(FinishingPricings[bindingPricingObj.bindingObjID].GetFinishingPrice(FinishingPricings[bindingPricingObj.bindingObjID].finishingID, padsOf, this.productID, percentCollection, null, this.quantityList));
}
else {
instaPriceObj.AdjustSheetsPerUnitPrice(0);
instaPriceObj.AdjustCollatePrice(0);
instaPriceObj.AdjustBackingPrice(0);
instaPriceObj.AdjustCoverPrice(0);
instaPriceObj.AdjustBindingPrice(0);
}
}
};

ProductPricing.prototype.AdjustVariableDataPrice = function(percentCollection) {
 if (this.hasInstaPrice && this.hasVariableDataPricing) {
 var instaPriceObj = InstaPrices[this.instaPriceID];
 var variableDataPricingObj = VariableDataPricings[this.variableDataPricingID];
 var price = 0;
 instaPriceObj.AdjustImprintPrice(FinishingPricings[variableDataPricingObj.rblImprintID].GetFinishingPrice(FinishingPricings[variableDataPricingObj.rblImprintID].finishingID, this.quantity, this.productID, percentCollection, null, this.quantityList));
 if (FinishingPricings[variableDataPricingObj.rblImprintID].finishingID != "") {
 instaPriceObj.AdjustImprintColorPrice(FinishingPricings[variableDataPricingObj.ddImprintColorID].GetFinishingPrice(FinishingPricings[variableDataPricingObj.ddImprintColorID].finishingID, this.quantity, this.productID, percentCollection, null, this.quantityList));
 } else {
 instaPriceObj.AdjustImprintColorPrice(0);
 }
 }
};

ProductPricing.prototype.AdjustSealPrice = function(percentCollection) {
 
 if (this.hasInstaPrice && this.hasSealPricing && this.hasInkPricing) {
 var instaPriceObj = InstaPrices[this.instaPriceID];
 var sealPricingObj = SealPricings[this.sealPricingID];
 instaPriceObj.AdjustSealPrice(sealPricingObj.finishingPricingObj.GetFinishingPrice(sealPricingObj.finishingPricingObj.finishingID, this.quantity, this.productID, percentCollection, null, this.quantityList));
 }
};

ProductPricing.prototype.AdjustRoundCornerPrice = function(percentCollection) {
if (this.hasInstaPrice && this.hasRoundCornerPricing) {
var instaPriceObj = InstaPrices[this.instaPriceID];
var roundcornerPricingObj = RoundCornerPricings[this.roundCornerPricingID];
instaPriceObj.AdjustRoundCornerPrice(roundcornerPricingObj.finishingPricingObj.GetFinishingPrice(roundcornerPricingObj.finishingPricingObj.finishingID, this.quantity, this.productID, percentCollection, null, this.quantityList));
}
};

ProductPricing.prototype.AdjustEnvelopePrice = function(percentCollection) {
if (this.hasInstaPrice && this.hasBlankEnvelopePricing) {
var instaPriceObj = InstaPrices[this.instaPriceID];
var blankEnvelopePricingObj = BlankEnvelopePricings[this.blankEnvelopePricingID];
var price = 0;
price = blankEnvelopePricingObj.GetBlankEnvelopePrice(percentCollection);
if (this.hasEnvelopeImprintPricing) {
var printedEnvelopePricingObj = PrintedEnvelopePricings[this.blankEnvelopeImprintID];
price += printedEnvelopePricingObj.finishingPricingObj.GetFinishingPrice(printedEnvelopePricingObj.finishingPricingObj.finishingID, blankEnvelopePricingObj.blankEnvelopeQuantity, this.productID, percentCollection);
}
instaPriceObj.AdjustEnvelopePrice(price);
}
};

ProductPricing.prototype.AdjustSecondSheetPrice = function(percentCollection) {
if (this.hasInstaPrice && this.hasSecondSheetPricing && this.hasPaperPricing) {
var instaPriceObj = InstaPrices[this.instaPriceID];
var secondSheetPricingObj = SecondSheetPricings[this.secondSheetPricingID];
var paperPricingObj = this.GetPaperPricingObj();
instaPriceObj.AdjustSecondSheetPrice(secondSheetPricingObj.GetSecondSheetPrice(this.productID, paperPricingObj.paperID, percentCollection));
}
};

ProductPricing.prototype.AdjustTurnaroundPrice = function(percentCollection) {
 if (this.hasInstaPrice && this.hasTurnaroundPricing) {
 var instaPriceObj = InstaPrices[this.instaPriceID];
 var turnaroundPricingObj = TurnaroundPricings[this.turnaroundPricingID];
 var ipTurnaroundPrice = null;
 if (typeof (instaPriceObj.PFLProSettings) != 'undefined' && instaPriceObj.PFLProSettings != null) {
 ipTurnaroundPrice = turnaroundPricingObj.GetTurnaroundPrice(this.productID, instaPriceObj.printingSubtotal, percentCollection, null);
 }
 instaPriceObj.AdjustTurnaroundPrice(turnaroundPricingObj.GetTurnaroundPrice(this.productID, instaPriceObj.printingSubtotal, percentCollection, instaPriceObj.PFLProSettings), ipTurnaroundPrice);
 }
};

ProductPricing.prototype.AdjustShipTypePrice = function(percentCollection) {
if (this.hasInstaPrice && this.hasShipTypePricing) {
var instaPriceObj = InstaPrices[this.instaPriceID];
var mailingPricingObj = (this.hasMailingPricing) ? MailingPricings[this.mailingPricingID] : null;
var quantity = this.quantity - ((mailingPricingObj && mailingPricingObj.mailingMethod) ? mailingPricingObj.mailingQuantity : 0);
var shipTypePricingObj = ShipTypePricings[this.shipTypePricingID];
var secondSheetQuantity = (this.hasSecondSheetPricing) ? SecondSheetPricings[this.secondSheetPricingID].secondSheetQuantity : 0;
quantity += secondSheetQuantity;

var price = 0;

var paperPricingObj;
for (var paperPricingID in PaperPricings) {
paperPricingObj = PaperPricings[paperPricingID];
if ((paperPricingObj.paperPricingID == this.paperPricingID || paperPricingObj.paperPricingID == this.insidePaperPricingID) && this.HasInsidePages() && paperPricingObj.paperID != '') {
if (typeof (signatures) == 'undefined') {
var signatures = new Array();
}
signatures = signatures.concat(this.CreateSignatures(null, null, PaperPricings[paperPricingID].paperID, null, null, paperPricingObj.coverInside));
}
}

for (var paperPricingID in PaperPricings) {
paperPricingObj = PaperPricings[paperPricingID];
if (paperPricingObj.paperPricingID == this.paperPricingID && paperPricingObj.paperID != '') {
price += shipTypePricingObj.GetShipTypePrice(this.productID, quantity, paperPricingObj.paperID, signatures, percentCollection);
}
}
instaPriceObj.AdjustShipTypePrice(price);
}
};

ProductPricing.prototype.AdjustMailingPrice = function(percentCollection) {
if (this.hasInstaPrice && this.hasMailingPricing) {
var instaPriceObj = InstaPrices[this.instaPriceID];
var mailingPricingObj = MailingPricings[this.mailingPricingID];
var partCount = (this.hasNumPagesPricing) ? this.GetPartCount() : '';
var paperPricingObj = this.GetPaperPricingObj(CoverInsideEnum.ForInside);
var paperWeightID = (partCount != '' && paperPricingObj) ? paperPricingObj.GetPaperWeightID(paperPricingObj.paperID) : '';
var foldID = (this.hasFoldPricing) ? FoldPricings[this.foldPricingID].finishingPricingObj.finishingID : '';
if (foldID == AttributeValueIDEnum.foldcollatestaple_fold_collate_stitch || foldID == AttributeValueIDEnum.foldcollatestaple_manually_priced) {
 foldID = '';
}
var coverStock = this.IsCoverPaper();

instaPriceObj.AdjustMailingPrice(mailingPricingObj.GetMailingPrice(this.productID, paperWeightID, foldID, coverStock, partCount, percentCollection));
}
};

ProductPricing.prototype.AdjustCouponPrices = function() {
if (this.hasInstaPrice) {
var instaPriceObj = InstaPrices[this.instaPriceID];
instaPriceObj.AdjustCouponPrices();
}
};

ProductPricing.prototype.AdjustPFLProDiscount = function() {
 if (this.hasInstaPrice) {
 var instaPriceObj = InstaPrices[this.instaPriceID];
 instaPriceObj.AdjustPFLProDiscount();
 }
};

ProductPricing.prototype.AdjustUpgradeDiscount = function() {
if (this.hasInstaPrice && this.hasUpgradeDiscount) {
var instaPriceObj = InstaPrices[this.instaPriceID];
var upgradeDiscountObj = UpgradeDiscounts[this.upgradeDiscountPricingID];
instaPriceObj.AdjustUpgradeDiscount(upgradeDiscountObj.GetUpgradeDiscountTotal());
}
};
// END - Adjust Prices

// BEGIN - Get/set collection properties
ProductPricing.prototype.GetQuantity = function() {
return (this.hasInstaPrice) ? InstaPrices[this.instaPriceID].quantity : null;
};

ProductPricing.prototype.SetQuantity = function(quantity) {
this.SetEnvelopeQuantity(quantity);

if (this.hasInstaPrice) {
var instaPriceObj = InstaPrices[this.instaPriceID];
instaPriceObj.SetQuantity(quantity);
this.AdjustPrices(AdjustTypeEnum.Quantity);
}
};

ProductPricing.prototype.GetNumPages = function() {
 return (this.productID == ProductIDEnum.calendars_5_5x8_5) ? 28 : (this.hasNumPagesPricing) ? NumPagesPricings[this.numPagesPricingID].numPages : 1;
};

ProductPricing.prototype.GetPaperID = function() {
return (this.hasPaperPricing) ? this.GetPaperPricingObj().paperID : null;
};

ProductPricing.prototype.GetFold = function() {
return (this.hasFoldPricing) ? FoldPricings[this.foldPricingID].finishingPricingObj.finishingID : null;
};

ProductPricing.prototype.SetFold = function(foldID) {
if (this.hasFoldPricing) {
FoldPricings[this.foldPricingID].finishingPricingObj.SetFinishingID(foldID);
}
};

ProductPricing.prototype.SetConversion = function(conversionID) {
if (this.hasConversionPricing) {
ConversionPricings[this.conversionPricingID].finishingPricingObj.SetConversionID(conversionID);
}
};

ProductPricing.prototype.SetPadding = function(paddingID) {
if (this.hasBindingPricing) {
BindingPricings[this.bindingPricingID].finishingPricingObj.SetPaddingID(paddingID);
}
};

ProductPricing.prototype.SetVariableData = function(variableDataID) {
if (this.hasVariableDataPricing) {
VariableDataPricings[this.variableDataPricingID].finishingPricingObj.SetVariableDataID(variableDataID);
}
};

ProductPricing.prototype.SetPrintedEnvelope = function(finishingID) {
 if (this.hasEnvelopeImprintPricing) {
 PrintedEnvelopePricings[this.blankEnvelopeImprintID].finishingPricingObj.SetFinishingID(finishingID);
 }
};

ProductPricing.prototype.SetAqueous = function(coatingFID, coatingBID) {
if (this.hasAqueousPricing) {
AqueousPricings[this.aqueousPricingID].SetAqueous(coatingFID, coatingBID);
}
};

ProductPricing.prototype.SetRoundCorner = function(roundCorner) {
 if (this.hasRoundCornerPricing) {
 RoundCornerPricings[this.roundCornerPricingID].finishingPricingObj.SetRoundCorner(roundCorner);
 }
};

ProductPricing.prototype.SetSealID = function(SealID) {
 if (this.hasSealPricing) {
 SealPricings[this.sealPricingID].ChangeSeal(SealID);
 }
};

ProductPricing.prototype.SetMailing = function(mailingMethod, mailingQty) {
if (this.hasMailingPricing) {
MailingPricings[this.mailingPricingID].SetMailingMethod(mailingMethod);
MailingPricings[this.mailingPricingID].SetMailingQuantity(mailingQty);
}
};

ProductPricing.prototype.SetSecondSheetQuantity = function(secondsQty) {
if (this.hasSecondSheetPricing) {
SecondSheetPricings[this.secondSheetPricingID].SetSecondSheetQuantity(secondsQty);
}
};

ProductPricing.prototype.SetTurnaround = function(turnaround) {
if (this.hasTurnaroundPricing) {
TurnaroundPricings[this.turnaroundPricingID].SetTurnaround(turnaround);
}
};

ProductPricing.prototype.GetShipType = function() {
return (this.hasShipTypePricing) ? ShipTypePricings[this.shipTypePricingID].shipType : null;
};

ProductPricing.prototype.SetShipType = function(shipType) {
if (this.hasShipTypePricing) {
ShipTypePricings[this.shipTypePricingID].SetShipType(shipType);
}
};

ProductPricing.prototype.GetMinMailingQuantity = function(mailingMethod) {
if (this.hasMailingPricing && mailingMethod) {
var paperPricingObj = this.GetPaperPricingObj(CoverInsideEnum.ForInside);
var partCount = (this.hasNumPagesPricing) ? this.GetPartCount() : '';
var paperWeightID = (partCount != '' && paperPricingObj) ? paperPricingObj.GetPaperWeightID(paperPricingObj.paperID) : '';

return mailingArr[this.productID][paperWeightID][partCount][mailingMethod][MAILING_IDX_MIN_QTY];
}
return null;
};

ProductPricing.prototype.GetVersionCount = function() {
if (this.hasNameQtyPricing) {
var nameQtyPricingObj = NameQtyPricings[this.nameQtyPricingID];
nameQtyPricingObj.GetVersionCount();
}
return null;
};
// END - Get/set collection properties

// BEGIN - Validation
ProductPricing.prototype.HandleQuantityChange = function(quantity, versionCt) {
if (this.hasNameQtyPricing && typeof(IsPPSEnterQuantity) != 'undefined' && !IsPPSEnterQuantity) {
var nameQtyPricingObj = NameQtyPricings[this.nameQtyPricingID];
nameQtyPricingObj.HandleNameQuantityChange();
}
this.SetEnvelopeQuantity(quantity);
if (this.hasMailingPricing) {
var mailingPricingObj = MailingPricings[this.mailingPricingID];
mailingPricingObj.HandleQuantityChange();
}

this.AdjustPrices(AdjustTypeEnum.Quantity);
};

ProductPricing.prototype.HandleAdditionalMarkupPercentChange = function(additionalMarkupPercent) {
this.AdjustPrices(AdjustTypeEnum.AdditionalMarkupPercent);
};

ProductPricing.prototype.HandleNameQuantityChange = function(sumNameQuantities) {
if (this.hasInstaPrice) {
if (sumNameQuantities > 0) {
var instaPriceObj = InstaPrices[this.instaPriceID];
instaPriceObj.SetQuantity(sumNameQuantities * instaPriceObj.minQuantity);
instaPriceObj.SetVersionCt(NameQtyPricings[this.nameQtyPricingID].GetVersionCount());
this.AdjustPrices(AdjustTypeEnum.Quantity);
this.HandleShowSubmitChanges();
}
}
};

ProductPricing.prototype.SetEnvelopeQuantity = function(envelopeQuantity) {
if (this.hasBlankEnvelopePricing) {
 var blankEnvelopePricingObj = BlankEnvelopePricings[this.blankEnvelopePricingID];
 if (blankEnvelopePricingObj.blankEnvelopeQuantity) {
 blankEnvelopePricingObj.SetEnvelopeQuantity(envelopeQuantity);
}
}
};

ProductPricing.prototype.ValidateNumPages = function() {
if (this.hasInsideInkPricing) {
InkPricings[this.insideInkPricingID].ValidateNumPages(!this.HasInsidePages());
}
if (this.hasInsidePaperPricing) {
PaperPricings[this.insidePaperPricingID].ValidateNumPages(!this.HasInsidePages());
}
if (this.hasFoldPricing && this.hasNumPagesPricing) {
FoldPricings[this.foldPricingID].ValidateNumPages(this.productID, NumPagesPricings[this.numPagesPricingID].numPages);
}
};

ProductPricing.prototype.HandleSizeChange = function(productID) {
 var ret = true;
 if (this.hasPaperPricing) {
 var paperPricingObj = this.GetPaperPricingObj();
 ret = ret && paperPricingObj.ValidatePaper(productID, paperPricingObj.paperID, true);
 }
 if (this.hasFoldPricing) {
 var foldPricingObj = FoldPricings[this.foldPricingID];
 ret = ret && foldPricingObj.ValidateFold(productID, foldPricingObj.finishingPricingObj.finishingID, this.IsCoverPaper(), true, false);
 }
 var instaPriceObj = InstaPrices[this.instaPriceID];
 instaPriceObj.minQuantity = productInfoArr[productID][PRODUCTINFO_IDX_MINQUANTITY];
 instaPriceObj.ValidateQuantity(instaPriceObj.quantity);

 //blank envelopes settings
 this.SetBlankEnvelopeSize(productID);

 return ret;
};

ProductPricing.prototype.HandleSheetsPerUnitChange = function() {
var instaPriceObj = InstaPrices[this.instaPriceID];
instaPriceObj.ValidateQuantity(instaPriceObj.quantity);
};

ProductPricing.prototype.SetBlankEnvelopeSize = function(productID) {
if (productID == null || productID == '') {
productID = this.productID;
}
//blank envelopes settings
if (this.hasBlankEnvelopePricing) {
var blankEnvelopePricingObj = BlankEnvelopePricings[this.blankEnvelopePricingID];
if (productID == ProductIDEnum.greeting_cards) { //greeting cards envelope size
blankEnvelopePricingObj.blankEnvelopeSizeID = AttributeValueIDEnum.envelopes_a7;
}
else { //notecards envelope size
blankEnvelopePricingObj.blankEnvelopeSizeID = AttributeValueIDEnum.envelopes_a2;
}
}
};

ProductPricing.prototype.SetSize = function(productID) {
this.productID = productID;

if (this.orderingPage == OrderingPageEnum.calendars && this.hasNumPagesPricing) {
NumPagesPricings[this.numPagesPricingID].numPages = this.GetNumPages();
}
else if (this.orderingPage == OrderingPageEnum.cardspostcards && this.hasMailingPricing) {
MailingPricings[this.mailingPricingID].HandleSizeChange(this.productID);
}
};

ProductPricing.prototype.HandlePaperChange = function(paperID, forInside, productID, forSizeChange) {
var retObj = new Object;
retObj.success = true;
retObj.errorType = '';
if (!forInside && this.hasAqueousPricing) {
var aqueousPricingObj = AqueousPricings[this.aqueousPricingID];
if (!aqueousPricingObj.ValidateAqueous(paperID, aqueousPricingObj.coatingFID, aqueousPricingObj.mustNotCoat, true)) {
retObj.success = false;
this.ConcErrorMsg(retObj, AdjustTypeEnum.Aqueous);
}
}
if (this.hasFoldPricing) {
var foldPricingObj = FoldPricings[this.foldPricingID];
if (!foldPricingObj.ValidateFold(this.productID, foldPricingObj.finishingPricingObj.finishingID, this.IsCoverPaper(paperID), false, true)) {
retObj.success = false;
this.ConcErrorMsg(retObj, AdjustTypeEnum.Fold);
}
}
if (this.hasSealPricing) {
var sealPricingObj = SealPricings[this.sealPricingID];
if (!sealPricingObj.ValidateSeal(paperID, sealPricingObj.finishingPricingObj.finishingID, true)) {
retObj.success = false;
this.ConcErrorMsg(retObj, AdjustTypeEnum.Seal);
}
}
if (this.hasInkPricing) {
var inkPricingObj = this.GetInkPricingObj();
if (!this.IsValidInkPaper(inkPricingObj.inkFID, inkPricingObj.inkBID, paperID)) {
retObj.success = false;
this.ConcErrorMsg(retObj, AdjustTypeEnum.Ink);
}
}
if (this.hasBindingPricing) {
var bindingPricingObj = BindingPricings[this.bindingPricingID];
if (!bindingPricingObj.Validate(FinishingPricings[bindingPricingObj.rblSheetsPerUnitID].finishingID, FinishingPricings['Backing'].finishingID, FinishingPricings['Cover'].finishingID, paperID, productID, forSizeChange)) {
retObj.success = false;
this.ConcErrorMsg(retObj, AdjustTypeEnum.Padding);
}
}
return retObj;
};

ProductPricing.prototype.ConcErrorMsg = function(retObj, type) {
if (!retObj.success) {
retObj.errorType += ((retObj.errorType) ? ',' : '') + type;
}
};

ProductPricing.prototype.HandleInkChange = function(inkFID, inkBID) {
var retObj = new Object;
retObj.success = true;
retObj.errorType = '';
if (this.hasPaperPricing) {
var paperPricingObj = this.GetPaperPricingObj();
retObj.success = this.IsValidInkPaper(inkFID, inkBID, paperPricingObj.paperID);
this.ConcErrorMsg(retObj, AdjustTypeEnum.Ink);
}
return retObj;
};

ProductPricing.prototype.HandleMailingBlankEnvelopes = function() {
 if (this.hasMailingPricing && this.hasBlankEnvelopePricing) {
 var mailingPricingObj = MailingPricings[this.mailingPricingID];
 var blackImprinting;
 if (this.productID == ProductIDEnum.greeting_cards ||
 this.productID == ProductIDEnum.holiday_deluxe_greeting_card ||
 this.productID == ProductIDEnum.holiday_premium_greeting_card ||
 this.productID == ProductIDEnum.note_cards ||
 this.productID == ProductIDEnum.holiday_deluxe_note_card ||
 this.productID == ProductIDEnum.holiday_premium_note_card) {

 blackImprinting = AttributeValueIDEnum.imprint_return_address_in_black;
 }

 if (mailingPricingObj.mailingQuantity && mailingPricingObj.mailingMethod) {
 var msg = '';
 var isValidFold = true;
 var isValidEnvelopes = true;
 var isValidMailingQuantity = true;

 var fold = this.GetFold();
 if (fold != AttributeValueIDEnum.fold_half_fold) {
 msg += 'Half fold is required for mailing.\n';
 isValidFold = false;
 }

 if (this.hasEnvelopeImprintPricing) {
 var printedEnvelopePricingObj = PrintedEnvelopePricings[this.blankEnvelopeImprintID];
 if (printedEnvelopePricingObj.finishingPricingObj.finishingID != blackImprinting) {
 printedEnvelopePricingObj.finishingPricingObj.finishingID = blackImprinting;
 msg += 'Printed Envelopes are required for mailing.\n';
 isValidEnvelopes = false;
 }
 }

 if (this.hasBlankEnvelopePricing) {
 var blankEnvelopPricingObj = BlankEnvelopePricings[this.blankEnvelopePricingID];
 if (blankEnvelopPricingObj.blankEnvelopeQuantity == '' || blankEnvelopPricingObj.blankEnvelopeQuantity < mailingPricingObj.mailingQuantity) {
 msg += 'Mailing quantity cannot be greater than the envelope quantity.\n';
 isValidMailingQuantity = false;
 }
 }

 if (msg != "") {
 alert(msg);
 }

 if (!isValidFold) {
 this.SetFold(AttributeValueIDEnum.fold_half_fold);
 }

 if (!isValidEnvelopes) {
 this.SetPrintedEnvelope(blackImprinting);
 }

 if (!isValidMailingQuantity) {
 blankEnvelopPricingObj.SetEnvelopeQuantity(mailingPricingObj.mailingQuantity);
 }
 }
 }
};

ProductPricing.prototype.HandleAllMailing = function(allMailing) {
if (this.hasShipTypePricing) {
ShipTypePricings[this.shipTypePricingID].HandleAllMailing(allMailing);
}
};

ProductPricing.prototype.HandleMailingChange = function() {
var ret = true;
if (this.hasFoldPricing) {
var foldPricingObj = FoldPricings[this.foldPricingID];
ret = ret && foldPricingObj.ValidateFold(this.productID, foldPricingObj.finishingPricingObj.finishingID, this.IsCoverPaper(), false, false);
}
return ret;
};

ProductPricing.prototype.HasMailing = function() {
return (this.hasMailingPricing && MailingPricings[this.mailingPricingID].HasMailing());
};

ProductPricing.prototype.IsCoverPaper = function(paperID) {
var paperPricingObj = this.GetPaperPricingObj();
 if(typeof(paperID) == 'undefined') {
 paperID = paperPricingObj.paperID;
}
return (paperPricingObj && paperPricingObj.IsCoverPaper(paperID));
};

ProductPricing.prototype.GetPaperWeightID = function(paperID) {
var paperPricingObj = this.GetPaperPricingObj();
return (paperPricingObj && paperPricingObj.GetPaperWeightID((typeof(paperID) != 'undefined') ? paperID : paperPricingObj.paperID));
};

ProductPricing.prototype.GetTierID = function(paperID) {
var paperPricingObj = this.GetPaperPricingObj();
return (paperPricingObj && paperPricingObj.GetTierID((typeof(paperID) != 'undefined') ? paperID : paperPricingObj.paperID));
};

ProductPricing.prototype.IsValidInkPaper = function(inkFID, inkBID, paperID) {
 var paperPricingObj = this.GetPaperPricingObj();
 // IMPORTANT: Replace the following hard-coded value by generating a JS Enum file from InkEnum.cs
 if (inkBID != '' && paperID == AttributeValueIDEnum.paper_13_pt_magnet_stock) {
 alert(paperPricingObj.GetPaperName(paperID) + ' cannot be printed on the back side.');
 return false;
 }
 else if (inkBID == '' && this.productID == ProductIDEnum.business_cards) {
 if (this.hasInkPricing) {
 for (var inkPricingID in InkPricings) {
 inkPricingObj = InkPricings[inkPricingID];
 if (inkPricingObj.productPricingObj == this && (typeof (coverInside) == 'undefined')) {
 inkPricingObj.ChangeInkImage(AttributePlacementEnum.back, inkBID, paperID);
 }
 }
 }
 return true;
 }
 return true;
};

ProductPricing.prototype.HandleShowSubmitChanges = function() {
 if (this.isChangeProductOptions) {
 var anyChangesMade = (
(this.hasInstaPrice && typeof (InstaPrices) != 'undefined' && InstaPrices[this.instaPriceID].IsChanged()) ||
(this.hasInkPricing && typeof (InkPricings) != 'undefined' && InkPricings[this.inkPricingID].IsChanged()) ||
(this.hasSpotPricing && typeof (SpotPricings) != 'undefined' && SpotPricings[this.spotPricingID].IsChanged()) ||
(this.hasInsideInkPricing && typeof (InkPricings) != 'undefined' && InkPricings[this.insideInkPricingID] && InkPricings[this.insideInkPricingID].IsChanged()) ||
(this.hasNumPagesPricing && typeof (NumPagesPricings) != 'undefined' && NumPagesPricings[this.numPagesPricingID].IsChanged()) ||
(this.hasAqueousPricing && typeof (AqueousPricings) != 'undefined' && AqueousPricings[this.aqueousPricingID].IsChanged()) ||
(this.hasPaperPricing && typeof (PaperPricings) != 'undefined' && PaperPricings[this.paperPricingID].IsChanged()) ||
(this.hasInsidePaperPricing && typeof (PaperPricings) != 'undefined' && PaperPricings[this.insidePaperPricingID] && PaperPricings[this.insidePaperPricingID].IsChanged()) ||
(this.hasFoldPricing && typeof (FoldPricings) != 'undefined' && FoldPricings[this.foldPricingID].finishingPricingObj.IsChanged()) ||
(this.hasSizePricing && typeof (SizePricings) != 'undefined' && SizePricings[this.sizePricingID].IsChanged()) ||
(this.hasSealPricing && typeof (SealPricings) != 'undefined' && SealPricings[this.sealPricingID].finishingPricingObj.IsChanged()) ||
(this.hasRoundCornerPricing && typeof (RoundCornerPricings) != 'undefined' && (RoundCornerPricings[this.roundCornerPricingID].finishingPricingObj.IsChanged() || RoundCornerPricings[this.roundCornerPricingID].IsChanged())) ||
(this.hasBlankEnvelopePricing && typeof (BlankEnvelopePricings) != 'undefined' && BlankEnvelopePricings[this.blankEnvelopePricingID].IsChanged()) ||
(this.hasSecondSheetPricing && typeof (SecondSheetPricings) != 'undefined' && SecondSheetPricings[this.secondSheetPricingID].IsChanged()) ||
(this.hasTurnaroundPricing && typeof (TurnaroundPricings) != 'undefined' && TurnaroundPricings[this.turnaroundPricingID].IsChanged()) ||
(this.hasShipTypePricing && typeof (ShipTypePricings) != 'undefined' && ShipTypePricings[this.shipTypePricingID].IsChanged()) ||
(this.hasMailingPricing && typeof (MailingPricings) != 'undefined' && MailingPricings[this.mailingPricingID].IsChanged()) ||
(this.hasPocketSlitPricing && typeof (PocketSlitPricings) != 'undefined' && PocketSlitPricings[this.pocketSlitPricingID].IsChanged()) ||
(this.hasNameQtyPricing && typeof (NameQtyPricings) != 'undefined' && NameQtyPricings[this.nameQtyPricingID].IsChanged()) ||
(this.hasConversionPricing && typeof (ConversionPricings) != 'undefined' && ConversionPricings[this.conversionPricingID].finishingPricingObj.IsChanged()) ||
(this.hasBindingPricing && typeof (BindingPricings) != 'undefined' && (FinishingPricings[BindingPricings[this.bindingPricingID].rblSheetsPerUnitID].IsChanged() || FinishingPricings['Cover'].IsChanged() || FinishingPricings['Backing'].IsChanged())) ||
(this.hasVariableDataPricing && typeof (VariableDataPricings) != 'undefined' && FinishingPricings[VariableDataPricings[this.variableDataPricingID].rblImprintID].IsChanged()) ||
(this.hasVariableDataPricing && typeof (VariableDataPricings) != 'undefined' && FinishingPricings[VariableDataPricings[this.variableDataPricingID].ddImprintColorID].IsChanged()) ||
(typeof (VersionChanged) != 'undefined' && VersionChanged())
);
 if (ConfirmAsIss[this.confirmAsIsID]) {
 ConfirmAsIss[this.confirmAsIsID].ConfirmChanges(anyChangesMade);
 }
 }
};

ProductPricing.prototype.HasInsidePages = function() {
 var numPages = this.GetNumPages();
 return (this.productID == ProductIDEnum.catalogs_5_5x8_5 && numPages > 8) || (this.productID == ProductIDEnum.catalogs_8_5x11 && numPages > 4) || this.productID == ProductIDEnum.calendars_5_5x8_5 || this.productID == ProductIDEnum.calendars_8_5x11;
};

ProductPricing.prototype.GetPartsPerSignature = function() {
return productInfoArr[this.productID][PRODUCTINFO_IDX_PARTSPERSIGNATURE];
};

// returns inside signature count when true, otherwise total signature count.
ProductPricing.prototype.GetPartCount = function(inside) {
 if(typeof(inside) == 'undefined') {
 inside = false;
 }
 return inside ? (this.GetNumPages() / 4) - this.GetPartsPerSignature() : (this.GetNumPages() / 4);
};

ProductPricing.prototype.CreateSignatures = function(inkFID, inkBID, paperID, drillholeID, foldCollateStapleID, coverInside, spotFID, spotBID) {
 var partAttributes = new Array();
 this.AddPartAttribute(partAttributes, AttributeIDEnum.ink, inkFID, AttributePlacementEnum.front);
 this.AddPartAttribute(partAttributes, AttributeIDEnum.ink, inkBID, AttributePlacementEnum.back);
 this.AddPartAttribute(partAttributes, AttributeIDEnum.spot, spotFID, AttributePlacementEnum.front);
 this.AddPartAttribute(partAttributes, AttributeIDEnum.spot, spotBID, AttributePlacementEnum.back);
 this.AddPartAttribute(partAttributes, AttributeIDEnum.paper, paperID, null);
 if (drillholeID != null && typeof(pricedPerSignatureArr[drillholeID]) != 'undefined' && pricedPerSignatureArr[drillholeID][PRICEDPERSIGNATURE_IDX_BOOL] == true) {
 this.AddPartAttribute(partAttributes, AttributeIDEnum.drillholes, drillholeID, null);
 }
 if (foldCollateStapleID != null && typeof(pricedPerSignatureArr[foldCollateStapleID]) != 'undefined' && pricedPerSignatureArr[foldCollateStapleID][PRICEDPERSIGNATURE_IDX_BOOL] == true) {
 this.AddPartAttribute(partAttributes, AttributeIDEnum.foldcollatestaple, foldCollateStapleID, null);
 }

 var partsPerSignature = this.GetPartsPerSignature();

 var numParts = partsPerSignature; // we will be creating at least one compelete signature (the cover) for IP.
 if (typeof (coverInside) != 'undefined') {
 numParts = (this.GetNumPages() / 4); // if coverInside is defined, we will be creating all signatures or just inside.
 if (coverInside == CoverInsideEnum.ForInside) {
 numParts -= partsPerSignature; // remove the cover parts (one whole signature 11x17 sheet).
 }
 else if (coverInside == CoverInsideEnum.ForCover) {
 numParts = partsPerSignature;
 }
 }

 var parts = new Array();

 for (var i = 0; i < numParts; i++) {
 parts.push(new Part(i, partAttributes));
 }

 return CreateSignatureCollection(parts, partsPerSignature);
};

ProductPricing.prototype.AddPartAttribute = function(partAttributes, attributeID, attributeValueID, attributePlacement) {
if (attributeValueID != null) {
partAttributes.push(new PartAttribute(attributeID, attributeValueID, attributePlacement));
}
};

ProductPricing.prototype.HandleAttributePrices = function(adjustType) {
this.AdjustPrices(adjustType);
this.HandleShowSubmitChanges();
};

ProductPricing.prototype.GetPercentCollection = function(markupPercent, multiVersionPercent) {
var percentList = new Array();
if (ChannelPricingPercent != 1) {
 percentList.push(new PricingPercent(PricingPercentTypeEnum.Channel, ChannelPricingPercent));
}
if (markupPercent != 0)
{
 percentList.push(new PricingPercent(PricingPercentTypeEnum.Markup, markupPercent));
}
if (multiVersionPercent != 1)
{
 percentList.push(new PricingPercent(PricingPercentTypeEnum.MultiVersion, multiVersionPercent));
}
var percentCollection = new PricingPercentCollection(percentList);
return percentCollection;
};
// END - Validation


//Product Pricing PD_Pricing
ProductPricing.prototype.GetProductPrice = function(percentCollection) {
var instaPriceObj = InstaPrices[this.instaPriceID];
percentCollection.SetCanApplyPercentVariables(AdjustTypeEnum.Product, ChannelID);

var price = 0;
// Calculate product price
if (this.quantityList.length != 0) { //business cards
for(var i = 0, loopCnt = this.quantityList.length; i < loopCnt; i++) { //loop through version quantities
price += this.CalculateProductPrice(this.quantityList[i], productPricingArr[this.productID][PRODUCT_IDX_BASE], productPricingArr[this.productID][PRODUCT_IDX_EACH], percentCollection);
}
}
else { //one quantity products
price = this.CalculateProductPrice(this.quantity, productPricingArr[this.productID][PRODUCT_IDX_BASE], productPricingArr[this.productID][PRODUCT_IDX_EACH], percentCollection);
}
return price;
};

ProductPricing.prototype.CalculateProductPrice = function(quantity, productBase, productEach, percentCollection) {
var price = 0;

if (quantity > 0) //check that the quantity is greater than zero
{
price = productBase + (quantity * productEach);
}

if (typeof(percentCollection) != 'undefined') {
return percentCollection.ApplyPricingPercents(price);
}
else {
return FormatDollar(price);
}
};
//END - PD_Pricing


ProductPricing.prototype.GetMultipleVersionPricingPercent = function(versionNo) {
//check for NO value in versionNo or No multiversion array for given product
var multipleVersionPricingPercent = 1;
if (versionNo != '' && versionNo != null && versionNo > 0 && typeof(multipleVersionPricingArr[this.productID]) != 'undefined') {
for(var i = multipleVersionPricingArr[this.productID].length-1; i >= 0; i--) {
if (i <= versionNo && typeof(multipleVersionPricingArr[this.productID][i]) != 'undefined') {
multipleVersionPricingPercent = multipleVersionPricingArr[this.productID][i];
break;
}
}
}
return multipleVersionPricingPercent;
};

ProductPricing.prototype.GetChangePaperPrice = function() {
if (this.hasInstaPrice) {
var instaPriceObj = InstaPrices[this.instaPriceID];
var paperElem = $(instaPriceObj.lblChangePaperID);
if (typeof (paperElem) != 'undefined') {
return paperElem.innerHTML;
}
}
return 0;
};

ProductPricing.prototype.GetChangeCoatingPrice = function() {
if (this.hasInstaPrice) {
var instaPriceObj = InstaPrices[this.instaPriceID];
var coatingElem = $(instaPriceObj.lblChangeAqueousID);
if (typeof (coatingElem) != 'undefined') {
return coatingElem.innerHTML;
}
}
return 0;
};

ProductPricing.prototype.GetChangeInsidePaperPrice = function() {
if (this.hasInstaPrice) {
var instaPriceObj = InstaPrices[this.instaPriceID];
var insidePaperElem = $(instaPriceObj.lblChangeInsidePaper);
if (typeof (insidePaperElem) != 'undefined') {
return insidePaperElem.innerHTML;
}
}
return 0;
};
var ProofTypePricings;

function ProofTypePricing(proofTypePricingID, lblPFLProTotalSavings, lblPFLProProofSavings, discount) {
 this.proofTypePricingID = proofTypePricingID
 this.lblPFLProTotalSavings = lblPFLProTotalSavings
 this.lblPFLProProofSavings = lblPFLProProofSavings
 this.discount = discount

 this.InsertProofTypePricing();
}

ProofTypePricing.prototype.InsertProofTypePricing = function() {
 if (typeof (ProofTypePricings) == 'undefined') {
 ProofTypePricings = new Object;
 }
 ProofTypePricings[this.proofTypePricingID] = this;
};

ProofTypePricing.prototype.ChangeProofType = function(proofType) {
 this.proofSavings = this.GetProofSavings(proofType);
 this.RenderPrice(this.lblPFLProProofSavings, this.proofSavings);
 this.RenderPrice(this.lblPFLProTotalSavings, this.proofSavings + this.discount);
 return true;
};

ProofTypePricing.prototype.GetProofSavings = function(proofType) {
 var savings;
 switch (proofType) {
 case ProofTypeEnum.PPValue: savings = 100; break;
 case ProofTypeEnum.DHPValue: savings = 30; break;
 default: savings = 0; break;
 }
 return savings;
};

ProofTypePricing.prototype.RenderPrice = function(lblID, price) {
 var lblElem = $(lblID);
 if (lblElem) {
 lblElem.innerHTML = FormatPrice(price);
 }
 return true;
};var RoundCornerPricings;

function RoundCornerPricing(finishingPricingID, finishingID, txtRoundCornerCommentsID, rblName) {
this.finishingPricingID = finishingPricingID;
this.txtRoundCornerCommentsID = txtRoundCornerCommentsID;
var roundCornerElem = $(this.txtRoundCornerCommentsID);
 if (roundCornerElem != null && typeof (roundCornerElem) != 'undefined') {
 this.txtRoundCornerCommentsOri = roundCornerElem.value;
}
this.finishingPricingObj = new FinishingPricing(finishingPricingID, finishingID, '');
this.rblName = rblName;

this.InsertRoundCornerPricing();
}

RoundCornerPricing.prototype.InsertRoundCornerPricing = function() {
if (typeof (RoundCornerPricings) == 'undefined') {
RoundCornerPricings = new Object;
}
RoundCornerPricings[this.finishingPricingObj.finishingPricingID] = this;
};

RoundCornerPricing.prototype.ResetRoundCorner = function() {
SetRadioButtonListChecked(this.rblName, this.finishingPricingObj.finishingID);
};

RoundCornerPricing.prototype.IsChanged = function() {
var roundCornerElem = $(this.txtRoundCornerCommentsID);
if (roundCornerElem != null && typeof (roundCornerElem) != 'undefined' && roundCornerElem.value != this.txtRoundCornerCommentsOri) {
return true;
}
return false;
};

RoundCornerPricing.prototype.ChangeRoundCorner = function(finishingID) {
this.finishingPricingObj.SetFinishingID(finishingID);
this.SetRoundCornerComments();

if (this.productPricingObj) {
this.productPricingObj.HandleAttributePrices(AdjustTypeEnum.RoundCorner);
}
};

RoundCornerPricing.prototype.ChangeRoundCornerComments = function() {
if (this.IsChanged() && this.productPricingObj) {
this.productPricingObj.HandleShowSubmitChanges();
}
};

RoundCornerPricing.prototype.SetRoundCornerComments = function() {
var roundCornerElem = $(this.txtRoundCornerCommentsID);
if (roundCornerElem != null && typeof (roundCornerElem) != 'undefined') {
var roundCornerComments = roundCornerElem.value;
if (this.finishingPricingObj.finishingID != "" && roundCornerComments == "") {
roundCornerElem.value = "All four corners";
}
else if (this.finishingPricingObj.finishingID == "") {
roundCornerElem.value = "";
}
}
};/// <reference path="Enums/AttributeValueIDEnum.js" />
var SealPricings;
var VALIDATE_SEAL = 'Seal';

function SealPricing(finishingPricingID, finishingID, rblName) {
this.finishingPricingObj = new FinishingPricing(finishingPricingID, finishingID, rblName);

this.InsertSealPricing();
}

SealPricing.prototype.InsertSealPricing = function() {
if (typeof(SealPricings) == 'undefined') {
SealPricings = new Object;
}
SealPricings[this.finishingPricingObj.finishingPricingID] = this;
};

SealPricing.prototype.ResetSeal = function() {
 SetRadioButtonListChecked(this.rblName, this.finishingID);
};

SealPricing.prototype.ChangeSeal = function(finishingID) {
this.ValidateSeal(((this.productPricingObj) ? this.productPricingObj.GetPaperID() : null), finishingID, false);

if (this.productPricingObj) {
this.productPricingObj.AdjustPrices(AdjustTypeEnum.Seal);
this.productPricingObj.HandleShowSubmitChanges();
}
};

SealPricing.prototype.ValidateSeal = function(paper, finishingID, forPaperChange) {
var ret = this.IsValidSeal(paper, finishingID, forPaperChange);
if (!ret.VALIDATE_RESULT) {
if (ret.VALIDATE_MESSAGE) {
alert(ret.VALIDATE_MESSAGE);
}
this.finishingPricingObj.SetFinishingID(ret.VALIDATE_FINISHINGID);
}
else {
this.finishingPricingObj.finishingID = finishingID;
}
return ret.VALIDATE_RESULT;
};

SealPricing.prototype.IsValidSeal = function(paper, finishingID, forPaperChange) {
if (paper == AttributeValueIDEnum.paper_24lb_uncoated && finishingID == AttributeValueIDEnum.seal_peel_seel) {
return this.finishingPricingObj.GetValidationObject(false, 'Peel & Seel is not available on 24 lb stock.', (forPaperChange) ? AttributeValueIDEnum.seal_glue : this.finishingPricingObj.finishingID);
}
return this.finishingPricingObj.GetValidationObject(true);
};var SecondSheetPricings;

function SecondSheetPricing(secondSheetPricingID, secondSheetQuantity, secondSheetQuantityInputID) {
this.secondSheetPricingID = secondSheetPricingID;
this.secondSheetQuantity = secondSheetQuantity;
this.secondSheetQuantityOri = secondSheetQuantity;

this.InsertSecondSheetPricing();
}

SecondSheetPricing.prototype.InsertSecondSheetPricing = function() {
if (typeof(SecondSheetPricings) == 'undefined') {
SecondSheetPricings = new Object;
}
SecondSheetPricings[this.secondSheetPricingID] = this;
};

SecondSheetPricing.prototype.ResetSecondSheetQuantity = function() {
 SetValue(this.secondSheetQuantityInputID, this.secondSheetQuantity);
};

SecondSheetPricing.prototype.ChangeSecondSheetQuantity = function(secondSheetQuantity) {
this.secondSheetQuantity = ParseInt(secondSheetQuantity);

if (this.productPricingObj) {
this.productPricingObj.AdjustPrices(AdjustTypeEnum.SecondSheet);
this.productPricingObj.HandleShowSubmitChanges();
}
};

SecondSheetPricing.prototype.SetSecondSheetQuantity = function(secondSheetQuantity) {
this.secondSheetQuantity = secondSheetQuantity;
};

SecondSheetPricing.prototype.GetSecondSheetPrice = function(productID, paperID, percentCollection) {
if (this.secondSheetQuantity == '' || this.secondSheetQuantity <= 0)
return 0;

var secondSheetPrice;
secondSheetPrice = this.GetSecondSheetBase(productID, paperID) + (this.secondSheetQuantity * this.GetSecondSheetEach(productID, paperID));

percentCollection.SetCanApplyPercentVariables(AdjustTypeEnum.SecondSheet, ChannelID);
return this.CalculateSecondSheetPrice(this.secondSheetQuantity, this.GetSecondSheetBase(productID, paperID), this.GetSecondSheetEach(productID, paperID), percentCollection);
};

SecondSheetPricing.prototype.CalculateSecondSheetPrice = function(quantity, secondSheetBase, secondSheetEach, percentCollection) {
var price = 0;

if (quantity > 0) { //check that the quantity is greater than zero
price = (secondSheetBase + (quantity * secondSheetEach));
}

if (typeof(percentCollection) != 'undefined') {
return percentCollection.ApplyPricingPercents(price);
}
else {
return FormatDollar(price);
}
};

SecondSheetPricing.prototype.GetSecondSheetBase = function(productID, paperID) {
 if(typeof(paperID) == 'undefined') {
 paperID = this.paperID;
 }
if (typeof(paperArr[productID][paperID]) != 'undefined') { //get paperID override pricing
return paperArr[productID][paperID][''][PAPER_IDX_SECOND_SHEETS_BASE];
}
else { //get tier pricing
return paperArr[productID][''][this.productPricingObj.GetTierID(paperID)][PAPER_IDX_SECOND_SHEETS_BASE];
}
};

SecondSheetPricing.prototype.GetSecondSheetEach = function(productID, paperID) {
 if(typeof(paperID) == 'undefined') {
 paperID = this.paperID;
 }
if (typeof(paperArr[productID][paperID]) != 'undefined') { //get paperID override pricing
return paperArr[productID][paperID][''][PAPER_IDX_SECOND_SHEETS_EACH];
}
else { //get tier pricing
return paperArr[productID][''][this.productPricingObj.GetTierID(paperID)][PAPER_IDX_SECOND_SHEETS_EACH];
}
};

SecondSheetPricing.prototype.IsChanged = function() {
 return (this.secondSheetQuantityOri != this.secondSheetQuantity);
};
/// <reference path="Enums/AttributeIDEnum.js" />
/// <reference path="Enums/AttributeValueIDEnum.js" />
/// <reference path="Enums/AttributeValueNameEnum.js" />
/// <reference path="Enums/NoValueEnum.js" />
var SheetsPerUnitPricings;

function SheetsPerUnitPricing(finishingPricingID, finishingID, rblName, imageID) {
this.imageID = imageID;
this.finishingPricingObj = new FinishingPricing(finishingPricingID, finishingID, rblName);

this.InsertSheetsPerUnitPricing();
}

SheetsPerUnitPricing.prototype.InsertSheetsPerUnitPricing = function() {
if (typeof (SheetsPerUnitPricings) == 'undefined') {
SheetsPerUnitPricings = new Object;
}
SheetsPerUnitPricings[this.finishingPricingObj.finishingPricingID] = this;
};

SheetsPerUnitPricing.prototype.ResetSheetsPerUnit = function() {
SetRadioButtonListChecked(this.rblName, this.finishingID);
};

SheetsPerUnitPricing.prototype.ChangeSheetsPerUnit = function(finishingID) {
this.finishingPricingObj.finishingID = finishingID;
if (this.productPricingObj) {
this.productPricingObj.HandleAttributePrices(AdjustTypeEnum.SheetsPerUnit);
}
};

SheetsPerUnitPricing.prototype.GetSheetsPerUnitPrice = function(finishingID, quantity, isCoverStock, productID, percentCollection, signatures) {
return this.finishingPricingObj.GetFinishingPrice(finishingID, quantity, productID, percentCollection, signatures, this.productPricingObj.quantityList);
};var ShipTypePricings;

function ShipTypePricing(shipTypePricingID, shipType, rblShipTypeName) {
this.shipTypePricingID = shipTypePricingID;
this.shipType = shipType;
this.shipTypeOri = shipType;
this.rblShipTypeName = rblShipTypeName;

this.InsertShipTypePricing();
}

ShipTypePricing.prototype.InsertShipTypePricing = function() {
if (typeof(ShipTypePricings) == 'undefined') {
ShipTypePricings = new Object;
}
ShipTypePricings[this.shipTypePricingID] = this;
};

ShipTypePricing.prototype.ResetShipType = function() {
 SetRadioButtonListChecked(this.rblShipTypeName, this.shipType);
};

ShipTypePricing.prototype.ChangeShipType = function(shipType) {
this.SetShipType(shipType);

if (this.productPricingObj) {
this.productPricingObj.AdjustPrices(AdjustTypeEnum.ShipType);
this.productPricingObj.HandleShowSubmitChanges();
}
};

ShipTypePricing.prototype.SetShipType = function(shipType) {
this.shipType = shipType;
};

ShipTypePricing.prototype.GetShipTypePrice = function(productID, quantity, paperID, signatures, percentCollection) {
if (this.shipType == '' || quantity <= 0) {
return 0;
}

// Get paper weight per square inch.
var weightPerSquareInch = 0;
if (typeof(signatures) != 'undefined') {
for (var s = 0, loopCnt = signatures.length; s < loopCnt; s++) {
weightPerSquareInch += (signatures[s].parts.length * paperInfoArr[signatures[s].GetAttributeValueID(AttributeIDEnum.paper)][PAPERINFO_IDX_WEIGHT]);
}
}
else {
if (typeof (paperInfoArr[paperID][PAPERINFO_IDX_WEIGHT]) != 'undefined') {
weightPerSquareInch = paperInfoArr[paperID][PAPERINFO_IDX_WEIGHT];
}
else {
weightPerSquareInch = 0;
}
}

// Calculate weight per piece.
var weightPerPiece = weightPerSquareInch * productInfoArr[productID][PRODUCTINFO_IDX_FLATWIDTH] * productInfoArr[productID][PRODUCTINFO_IDX_FLATHEIGHT];

// Get shipping base and each base on weight per piece.
for(var weight in shippingWeightArr) {
if (weightPerPiece <= parseFloat(weight)) {
break;
}
}

var shipBase = shippingWeightArr[weight][SHIPPINGWEIGHT_IDX_BASE];
var shipEach = shippingWeightArr[weight][SHIPPINGWEIGHT_IDX_EACH];
var shippingMuliplier = 1;
if (typeof(shipTypeArr[this.shipType][productID]) != 'undefined') {
shippingMuliplier = shipTypeArr[this.shipType][productID][SHIPTYPE_IDX_MULTIPLIER];
}
else {
shippingMuliplier = shipTypeArr[this.shipType][''][SHIPTYPE_IDX_MULTIPLIER];
}

percentCollection.SetCanApplyPercentVariables(AdjustTypeEnum.Shipping, ChannelID);
return this.CalculateShippingPrice(quantity, shipBase, shipEach, shippingMuliplier, percentCollection);
};

ShipTypePricing.prototype.CalculateShippingPrice = function(quantity, shipBase, shipEach, shippingMultiplier, percentCollection) {
var price = 0;
 price = (shipBase + (shipEach * quantity)) * shippingMultiplier;

if (typeof(percentCollection) != 'undefined') {
return percentCollection.ApplyPricingPercents(price);
}
else {
return FormatDollar(price);
}
};

ShipTypePricing.prototype.HandleAllMailing = function(allMailing) {
SetRadioButtonListDisabled(this.rblShipTypeName, allMailing, 0);
};

ShipTypePricing.prototype.IsChanged = function() {
 return (this.shipTypeOri != this.shipType);
};
var SizePricings;

function SizePricing(sizePricingID, productID, rblSizeName) {
this.sizePricingID = sizePricingID;
this.productID = productID;
this.productIDOri = productID;
this.rblSizeName = rblSizeName;

this.InsertSizePricing();
}

SizePricing.prototype.InsertSizePricing = function() {
if (typeof(SizePricings) == 'undefined') {
SizePricings = new Object;
}
SizePricings[this.sizePricingID] = this;
};

SizePricing.prototype.ResetSize = function() {
 SetRadioButtonListChecked(this.rblSizeName, this.productID);
};

SizePricing.prototype.ChangeSize = function(productID) {
this.ValidateSize(productID);

if (this.productPricingObj) {
this.productPricingObj.SetSize(this.productID);
this.productPricingObj.AdjustPrices();
this.productPricingObj.HandleShowSubmitChanges();
}

 //Update template selection images if a new size is selected!
 if (typeof TemplateSelectionArr != "undefined") {
 TemplateSelections.initSizeChange();
 }
};

SizePricing.prototype.SetSize = function(productID) {
this.productID = productID;
SetRadioButtonListChecked(this.rblSizeName, productID);
};

SizePricing.prototype.ValidateSize = function(productID) {
var ret = this.IsValidSize(productID);
if (!ret.VALIDATE_RESULT) {
if (ret.VALIDATE_MESSAGE) {
alert(ret.VALIDATE_MESSAGE);
}
this.SetSize(ret.VALIDATE_PRODUCT_ID);
}
else {
this.productID = productID;
}
return ret.VALIDATE_RESULT;
};

SizePricing.prototype.IsValidSize = function(productID) {
if (this.productPricingObj) {
if (!this.productPricingObj.HandleSizeChange(productID)) {
return this.GetValidationObject(false, '', this.productID);
}
}
return this.GetValidationObject(true);
};

SizePricing.prototype.GetValidationObject = function(validateResult, validateMessage, productID) {
return {
VALIDATE_RESULT : validateResult,
VALIDATE_MESSAGE : validateMessage,
VALIDATE_PRODUCT_ID : productID
};
};

SizePricing.prototype.IsChanged = function() {
 return (this.productIDOri != this.productID);
};
var SpotPricings;
var VALIDATE_SPOT = 'Spot';

function SpotPricing(spotPricingID, spotFID, spotBID, coverInside) {
this.spotPricingID = spotPricingID;
this.spotFID = spotFID;
this.spotBID = spotBID;
this.spotFIDOri = spotFID;
this.spotBIDOri = spotBID;
this.coverInside = coverInside;
new FinishingPricing(this.spotPricingID, this.GetWashUpID(), '');
this.InsertSpotPricing();
}

SpotPricing.prototype.InsertSpotPricing = function() {
if (typeof(SpotPricings) == 'undefined') {
SpotPricings = new Object;
}
SpotPricings[this.spotPricingID] = this;
};

SpotPricing.prototype.ChangeSpot = function(side, spotID, coverInside) {
this.ValidateSpot(side, spotID, coverInside);

if (this.productPricingObj) {
this.productPricingObj.AdjustPrices(AdjustTypeEnum.Spot, this.spotPricingID);
this.productPricingObj.HandleShowSubmitChanges();
}
};

SpotPricing.prototype.GetSpot = function(side) {
 if (typeof (side) != 'undefined') {
 return (side == AttributePlacementEnum.front) ? this.spotFID : (side == AttributePlacementEnum.back) ? this.spotBID : (side == AttributePlacementEnum.inside) ? this.spotFID : this.spotFID + '/' + this.spotBID;
 }
};

SpotPricing.prototype.SetSpot = function(side, spotID) {
if (side == AttributePlacementEnum.front) {
this.spotFID = spotID;
}
else if (side == AttributePlacementEnum.back) {
this.spotBID = spotID;
}
if (typeof (FinishingPricings[this.spotPricingID]) != 'undefined') {
FinishingPricings[this.spotPricingID].finishingID = this.GetWashUpID();
}
};

SpotPricing.prototype.GetTotalSpotPrice = function(productID, spotFID, spotBID, quantity, signatures, percentCollection) {
var price = 0;
if (typeof (signatures) != 'undefined' && signatures != null) {
for (var s = 0, loopCnt = signatures.length; s < loopCnt; s++) {
price += this.GetSpotPrice(productID, signatures[s].GetAttributeValueID(AttributeIDEnum.spot, AttributePlacementEnum.front), quantity, signatures[s].TotalSignaturePricingPercent(), percentCollection) +
this.GetSpotPrice(productID, signatures[s].GetAttributeValueID(AttributeIDEnum.spot, AttributePlacementEnum.back), quantity, signatures[s].TotalSignaturePricingPercent(), percentCollection);
}
}
else {
price = this.GetSpotPrice(productID, spotFID, quantity, 1, percentCollection) +
this.GetSpotPrice(productID, spotBID, quantity, 1, percentCollection);
}
return price;
};

SpotPricing.prototype.GetSpotPrice = function(productID, spotID, quantity, signaturePricingPercent, percentCollection) {
var spotBase = this.GetSpotPricing(productID, spotID, PriceForEnum.Base);
var spotEach = this.GetSpotPricing(productID, spotID, PriceForEnum.Each);

percentCollection.SetCanApplyPercentVariables(AdjustTypeEnum.Spot, ChannelID);

var price = 0;
// Calculate spot price
if (this.productPricingObj && this.productPricingObj.quantityList.length != 0) { //business cards
var quantityList = this.productPricingObj.quantityList;
for(var i = 0, loopCnt = quantityList.length; i < loopCnt; i++) { //loop through version quantities
price += this.CalculateSpotPrice(quantityList[i], signaturePricingPercent, spotBase, spotEach, percentCollection);
}
}
else { //one quantity products
price = this.CalculateSpotPrice(quantity, signaturePricingPercent, spotBase, spotEach, percentCollection);
}
return price;
};

SpotPricing.prototype.GetSpotPricing = function(productID, spotID, priceFor) {
if (spotID == '' || spotID == 0) {
return 0;
}
return inkArr[productID][eval('INK_IDX_' + this.GetSpotName(spotID) + 'SPOT_' + priceFor.toUpperCase())];
};

SpotPricing.prototype.GetSpotName = function(spotID) {
switch (spotID) {
case AttributeValueIDEnum.spot_spot_1:
return 1;
case AttributeValueIDEnum.spot_spot_2:
return 2;
case AttributeValueIDEnum.spot_spot_3:
return 3;
case AttributeValueIDEnum.spot_spot_4:
return 4;
case AttributeValueIDEnum.spot_spot_5:
return 5;
default:
return null;
}
};

SpotPricing.prototype.GetWashUpID = function() {
 var spotNumber = 0;
 var FrontSpotNumber = this.GetSpotName(this.spotFID);
 var BackSpotNumber = this.GetSpotName(this.spotBID);
 if (!(FrontSpotNumber == null) && !(BackSpotNumber == null)) {
 if (FrontSpotNumber >= BackSpotNumber) {
 spotNumber = FrontSpotNumber;
 } else {
 spotNumber = BackSpotNumber;
 }
 } else if (!(FrontSpotNumber == null)) {
 spotNumber = FrontSpotNumber;
 } else if (!(BackSpotNumber == null)) {
 spotNumber = BackSpotNumber;
 }
 switch (spotNumber) {
 case 1:
 return AttributeValueIDEnum.washup_wash_up_charge_1;
 break;
 case 2:
 return AttributeValueIDEnum.washup_wash_up_charge_2;
 break;
 case 3:
 return AttributeValueIDEnum.washup_wash_up_charge_3;
 break;
 case 4:
 return AttributeValueIDEnum.washup_wash_up_charge_4;
 break;
 case 5:
 return AttributeValueIDEnum.washup_wash_up_charge_5;
 break;
 default:
 return null;
 }
};

SpotPricing.prototype.CalculateSpotPrice = function(quantity, signaturePricingPercent, spotBase, spotEach, percentCollection) {
var price;

price = signaturePricingPercent * (spotBase + (quantity * spotEach));

if (typeof(percentCollection) != 'undefined') {
return percentCollection.ApplyPricingPercents(price);
}
else {
return FormatDollar(price);
}
};

SpotPricing.prototype.ValidateSpot = function(side, spotID, coverInside) {
var ret = this.IsValidSpot(side, spotID, coverInside);
if (!ret.VALIDATE_RESULT) {
if (ret.VALIDATE_MESSAGE) {
alert(ret.VALIDATE_MESSAGE);
}
this.SetSpot(side, ret.VALIDATE_SPOT);
}
else {
this.SetSpot(side, spotID, coverInside);
}
return ret.VALIDATE_RESULT;
};

SpotPricing.prototype.IsValidSpot = function(side, spotID, coverInside) {
return this.GetValidationObject(true);
};

SpotPricing.prototype.GetValidationObject = function(validateResult, validateMessage, spotID) {
return {
VALIDATE_RESULT : validateResult,
VALIDATE_MESSAGE : validateMessage,
VALIDATE_SPOT : spotID
};
};

SpotPricing.prototype.IsChanged = function() {
 return (this.spotFIDOri != this.spotFID || this.spotBIDOri != this.spotBID);
};
var TurnaroundPricings;

function TurnaroundPricing(turnaroundPricingID, turnaround, rblName, turnaroundDaysNormal) {
this.turnaroundPricingID = turnaroundPricingID;
this.turnaround = turnaround;
this.turnaroundOri = turnaround;
this.rblName = rblName;
this.turnaroundDaysNormal = turnaroundDaysNormal;

this.InsertTurnaroundPricing();
}

TurnaroundPricing.prototype.InsertTurnaroundPricing = function() {
if (typeof(TurnaroundPricings) == 'undefined') {
TurnaroundPricings = new Object;
}
TurnaroundPricings[this.turnaroundPricingID] = this;
};

TurnaroundPricing.prototype.ResetTurnaround = function() {
 SetRadioButtonListChecked(this.rblName, this.turnaround);
};

TurnaroundPricing.prototype.ChangeTurnaround = function(turnaround) {
this.SetTurnaround(turnaround);

if (this.productPricingObj) {
this.productPricingObj.AdjustPrices(AdjustTypeEnum.Turnaround);
this.productPricingObj.HandleShowSubmitChanges();
}
};

TurnaroundPricing.prototype.SetTurnaround = function(turnaround) {
this.turnaround = turnaround;
};

TurnaroundPricing.prototype.GetTurnaroundPrice = function(productID, printingSubtotal, percentCollection, pflProSettings, turnaroundCode) {
 if (typeof (turnaroundCode) == 'undefined') {
 var turnaroundCode = this.turnaround;
 }
 if (turnaroundCode == '') {
 return 0;
 }
 percentCollection.SetCanApplyPercentVariables(AdjustTypeEnum.Turnaround, ChannelID);

 // Standard Turnaround Price
 var price = this.CalculateTurnaroundPrice(printingSubtotal, turnaroundArr[productID][turnaroundCode], percentCollection);
 if (typeof (pflProSettings) != 'undefined' && pflProSettings != null) {
 var AdditionalDays = Math.max(0, this.GetTurnaroundLevel(turnaroundCode) - pflProSettings.FreeDaysRush);
 var proPrice = 0;
 var fastPrice = this.GetTurnaroundPrice(productID, printingSubtotal, percentCollection, null, this.GetTurnaroundCode("F", turnaroundCode));
 var rushPrice = this.GetTurnaroundPrice(productID, printingSubtotal, percentCollection, null, this.GetTurnaroundCode("R", turnaroundCode));
 switch (AdditionalDays) {
 case 0:
 break;
 case 1:
 if (this.GetAdditionalDays(pflProSettings).length >= 1) {
 proPrice += Math.min(fastPrice, this.GetAdditionalDays(pflProSettings)[0]);
 }
 else {
 proPrice += fastPrice;
 }
 break;
 case 2:
 switch (this.GetAdditionalDays(pflProSettings).length) {
 case 1:
 proPrice += Math.min(rushPrice, (this.GetAdditionalDays(pflProSettings)[0] + fastPrice));
 break;
 case 2:
 proPrice += Math.min(rushPrice, (this.GetAdditionalDays(pflProSettings)[0] + this.GetAdditionalDays(pflProSettings)[1]));
 break;
 default:
 proPrice += rushPrice;
 break;
 }
 break;
 case 3:
 var superPrice = this.GetTurnaroundPrice(productID, printingSubtotal, percentCollection, null, this.GetTurnaroundCode("SR", turnaroundCode));
 switch (this.GetAdditionalDays(pflProSettings).length)
 {
 case 1:
 proPrice += Math.min(superPrice, (this.GetAdditionalDays(pflProSettings)[0] + rushPrice));
 break;
 case 2:
 proPrice += Math.min(
 Math.min(superPrice, (this.GetAdditionalDays(pflProSettings)[0] + this.GetAdditionalDays(pflProSettings)[1] + fastPrice)),
 (this.GetAdditionalDays(pflProSettings)[0] + fastPrice + rushPrice));
 break;
 default:
 proPrice += superPrice;
 break;
 }
 break;
 default:
 proPrice = price;
 break;
 }

 return Math.min(proPrice, price);
 }
 else {
 return price;
 }
};

TurnaroundPricing.prototype.GetAdditionalDays = function(pflProSettings) {
 var _additionalDays = new Array;
 if (pflProSettings.CostAddlDays1 != null && pflProSettings.CostAddlDays1 > 0) {
 if (pflProSettings.CostAddlDays2 != null && pflProSettings.CostAddlDays2 > 0) {
 _additionalDays[0] = pflProSettings.CostAddlDays1;
 _additionalDays[1] = pflProSettings.CostAddlDays2;
 }
 else {
 _additionalDays[0] = pflProSettings.CostAddlDays1;
 }
 }
 return _additionalDays;
}

TurnaroundPricing.prototype.GetTurnaroundCode = function(Type, CurrentTurnaroundCode) {
 var turnaroundSpeeds = "NFRS";
 var days = turnaroundSpeeds.indexOf(CurrentTurnaroundCode.substring(0,1)) - turnaroundSpeeds.indexOf(Type.substring(0, 1));
 return Type + this.GetTurnaroundDays(CurrentTurnaroundCode, (days * -1)) + "D";
}

TurnaroundPricing.prototype.GetTurnaroundDays = function(TurnaroundCode, FreeDaysRush) {
 return Math.max(0, StripNonNumeric(TurnaroundCode) - FreeDaysRush);
}

TurnaroundPricing.prototype.GetTurnaroundLevel = function(TurnaroundCode) {
 var turnaroundSpeeds = "NFRS";
 return Math.max(0, turnaroundSpeeds.indexOf(TurnaroundCode.substring(0, 1)));
}

TurnaroundPricing.prototype.GetPFLProTurnaroundCode = function(CurrentTurnaroundCode, DaysDiff) {
 var turnaroundSpeeds = "NFRS";
 var SuperRushSillyCodeNormalizationFailure = '';
 if (CurrentTurnaroundCode.substring(1, 1) == 'R') {
 SuperRushSillyCodeNormalizationFailure = "R";
 }
 return this.GetTurnaroundCode(turnaroundSpeeds.substring(Math.max(0, turnaroundSpeeds.indexOf(CurrentTurnaroundCode.substring(0, 1)) - DaysDiff), 1) +
 SuperRushSillyCodeNormalizationFailure, CurrentTurnaroundCode);
}

TurnaroundPricing.prototype.CalculateTurnaroundPrice = function(printingSubTotal, priceMultiplier, percentCollection) {
// NOTE that pricing percent and markup percent are already included in printingSubtotal so do not multiply here
// Added percentCollection for other possible percents in the future
var price = 0;
price = FormatDollar(printingSubTotal * priceMultiplier);

if (typeof (percentCollection) != 'undefined') {
return percentCollection.ApplyPricingPercents(price);
}
else {
return FormatDollar(price);
}
};

TurnaroundPricing.prototype.IsChanged = function() {
 return (this.turnaroundOri != this.turnaround);
};
var UpgradeDiscounts;

function UpgradeDiscount(upgradeDiscountID, paperUpgradeDiscountID, coatingUpgradeDiscountID, insidePaperUpgradeDiscountID) {
this.upgradeDiscountID = upgradeDiscountID;
this.paperUpgradeDiscountID = paperUpgradeDiscountID;
this.coatingUpgradeDiscountID = coatingUpgradeDiscountID;
this.insidePaperUpgradeDiscountID = insidePaperUpgradeDiscountID;

this.InsertUpgradeDiscount();
}

UpgradeDiscount.prototype.InsertUpgradeDiscount = function() {
if (typeof (UpgradeDiscounts) == 'undefined') {
UpgradeDiscounts = new Object;
}
UpgradeDiscounts[this.upgradeDiscountID] = this;
};

UpgradeDiscount.prototype.ResetUpgradeDiscounts = function() {
this.paperUpgradeDiscountID.value = 0;
this.coatingUpgradeDiscountID.value = 0;
this.insidePaperUpgradeDiscountID.value = 0;
};

UpgradeDiscount.prototype.ChangeUpgradeDiscount = function(txtObj) {
if (this.CheckUpgradeDiscountValidity(txtObj)) {
if (this.productPricingObj) {
this.productPricingObj.AdjustPrices(AdjustTypeEnum.UpgradeDiscount);
this.productPricingObj.HandleShowSubmitChanges();
}
}
};

UpgradeDiscount.prototype.GetUpgradeDiscountTotal = function() {
var paperUpgradeDiscountElem = $(this.paperUpgradeDiscountID);
var coatingUpgradeDiscountElem = $(this.coatingUpgradeDiscountID);
var insidePaperUpgradeDiscountElem = $(this.insidePaperUpgradeDiscountID);
var upgradeDiscount = 0;
if (typeof (paperUpgradeDiscountElem) != 'undefined' && paperUpgradeDiscountElem.value != '') {
upgradeDiscount += FormatDollar(StripNonNumeric(paperUpgradeDiscountElem.value, '.', false));
}
if (typeof (coatingUpgradeDiscountElem) != 'undefined' && coatingUpgradeDiscountElem.value != '') {
upgradeDiscount += FormatDollar(StripNonNumeric(coatingUpgradeDiscountElem.value, '.', false));
}
if (typeof (insidePaperUpgradeDiscountElem) != 'undefined' && insidePaperUpgradeDiscountElem.value != '') {
upgradeDiscount += FormatDollar(StripNonNumeric(insidePaperUpgradeDiscountElem.value, '.', false));
}
return upgradeDiscount;
};

UpgradeDiscount.prototype.CheckUpgradeDiscountValidity = function(txtObj) {
if (txtObj.value != "") {
var alertAttrib = "";
var priceDiff = "";
if (txtObj.id == this.paperUpgradeDiscountID) {
priceDiff = this.productPricingObj.GetChangePaperPrice();
alertAttrib = (priceDiff <= 0) ? "Paper" : "";
}
else if (txtObj.id == this.insidePaperUpgradeDiscountID) {
priceDiff = this.productPricingObj.GetChangeInsidePaperPrice();
alertAttrib = (priceDiff <= 0) ? "Inside Paper" : "";
}
else if (txtObj.id == this.coatingUpgradeDiscountID) {
 priceDiff = this.productPricingObj.GetChangeCoatingPrice();
alertAttrib = (priceDiff <= 0) ? "Aqueous" : "";
}
priceDiff = FormatDollar(priceDiff.replace('$', ''));

if (alertAttrib != "") {
alert("You must select " + alertAttrib + " before entering " + alertAttrib + " Upgrade Discount.");
txtObj.value = "";
return false;
}
else if (FormatDollar(txtObj.value) > priceDiff) {
alert("You cannot enter a discount greater than the upgrade amount.");
txtObj.value = "";
return false;
}
}
return true;
};var VariableDataPricings;

function VariableDataPricing(userControlID, imprintID, imprintColorID, txtVariableDataCommentsID, rblImprintID, ddImprintColorID) {
 this.userControlID = userControlID;
 this.txtVariableDataCommentsID = txtVariableDataCommentsID;
 this.rblImprintID = rblImprintID;
 this.ddImprintColorID = ddImprintColorID;
 new FinishingPricing(rblImprintID, imprintID, '');
 new FinishingPricing(ddImprintColorID, imprintColorID, '');

 this.InsertVariableDataPricing();
}

VariableDataPricing.prototype.InsertVariableDataPricing = function() {
 if (typeof (VariableDataPricings) == 'undefined') {
 VariableDataPricings = new Object;
 }
 VariableDataPricings[this.userControlID] = this;
};

VariableDataPricing.prototype.Reset = function() {
 SetRadioButtonListChecked(this.rblImprintID, this.imprintID);
 SetRadioButtonListChecked(this.ddImprintColorID, this.imprintColorID);
};

VariableDataPricing.prototype.Change = function(control, value) {
 var controlID = control[0].name;
 if (typeof (controlID) == 'undefined') { //for dropdowns
 controlID = control.name;
 }

 if (controlID == this.rblImprintID) { //show or hide start number and color
 var elem = document.getElementsByTagName("div");
 if (value != '') {
 for (var i = 0; i < elem.length; i++) {
 if (elem[i].name == "VariableDataDetails") {
 elem[i].style.display = 'block';
 }
 }
 if ($(this.txtVariableDataCommentsID).value == '') {
 //alert('Please provide a Starting #.');
 $(this.txtVariableDataCommentsID).focus();
 }
 }
 else {
 if ($(this.txtVariableDataCommentsID).value != '') {
 $(this.txtVariableDataCommentsID).value = '';
 }
 for (var i = 0; i < elem.length; i++) {
 if (elem[i].name == "VariableDataDetails") {
 elem[i].style.display = 'none';
 }
 }
 }
 }

 FinishingPricings[controlID].SetFinishingID(value)
 if (this.productPricingObj) {
 this.productPricingObj.HandleAttributePrices(AdjustTypeEnum.VariableData);
 }
};


if(typeof(blankEnvelopeArr[220]) == 'undefined') blankEnvelopeArr[220] = new Array();
blankEnvelopeArr[220][277] = new Array(0, 0.08);
if(typeof(blankEnvelopeArr[222]) == 'undefined') blankEnvelopeArr[222] = new Array();
blankEnvelopeArr[222][277] = new Array(0, 0.09);
if(typeof(blankEnvelopeArr[237]) == 'undefined') blankEnvelopeArr[237] = new Array();
blankEnvelopeArr[237][277] = new Array(0, 0.05);
if(typeof(finishingArr[97]) == 'undefined') finishingArr[97] = new Array();
if(typeof(finishingArr[97]['']) == 'undefined') finishingArr[97][''] = new Array();
finishingArr[97][''][0] = new Array(0, 0.01);
if(typeof(finishingArr[98]) == 'undefined') finishingArr[98] = new Array();
if(typeof(finishingArr[98]['']) == 'undefined') finishingArr[98][''] = new Array();
finishingArr[98][''][0] = new Array(0, 0.01);
if(typeof(finishingArr[99]) == 'undefined') finishingArr[99] = new Array();
if(typeof(finishingArr[99]['']) == 'undefined') finishingArr[99][''] = new Array();
finishingArr[99][''][0] = new Array(0, 0.01);
if(typeof(finishingArr[101]) == 'undefined') finishingArr[101] = new Array();
if(typeof(finishingArr[101]['']) == 'undefined') finishingArr[101][''] = new Array();
finishingArr[101][''][0] = new Array(0, 0.01);
if(typeof(finishingArr[103]) == 'undefined') finishingArr[103] = new Array();
if(typeof(finishingArr[103]['']) == 'undefined') finishingArr[103][''] = new Array();
finishingArr[103][''][0] = new Array(0, 0.01);
if(typeof(finishingArr[103][6]) == 'undefined') finishingArr[103][6] = new Array();
finishingArr[103][6][0] = new Array(0, 0.02);
if(typeof(finishingArr[103][11]) == 'undefined') finishingArr[103][11] = new Array();
finishingArr[103][11][0] = new Array(0, 0.01);
if(typeof(finishingArr[103][65]) == 'undefined') finishingArr[103][65] = new Array();
finishingArr[103][65][0] = new Array(0, 0.02);
if(typeof(finishingArr[103][66]) == 'undefined') finishingArr[103][66] = new Array();
finishingArr[103][66][0] = new Array(0, 0.01);
if(typeof(finishingArr[104]) == 'undefined') finishingArr[104] = new Array();
if(typeof(finishingArr[104]['']) == 'undefined') finishingArr[104][''] = new Array();
finishingArr[104][''][0] = new Array(0, 0.01);
if(typeof(finishingArr[105]) == 'undefined') finishingArr[105] = new Array();
if(typeof(finishingArr[105]['']) == 'undefined') finishingArr[105][''] = new Array();
finishingArr[105][''][0] = new Array(0, 0.01);
if(typeof(finishingArr[106]) == 'undefined') finishingArr[106] = new Array();
if(typeof(finishingArr[106]['']) == 'undefined') finishingArr[106][''] = new Array();
finishingArr[106][''][0] = new Array(0, 0.035);
if(typeof(finishingArr[107]) == 'undefined') finishingArr[107] = new Array();
if(typeof(finishingArr[107]['']) == 'undefined') finishingArr[107][''] = new Array();
finishingArr[107][''][0] = new Array(0, 0.01);
if(typeof(finishingArr[108]) == 'undefined') finishingArr[108] = new Array();
if(typeof(finishingArr[108]['']) == 'undefined') finishingArr[108][''] = new Array();
finishingArr[108][''][0] = new Array(0, 0.01);
if(typeof(finishingArr[109]) == 'undefined') finishingArr[109] = new Array();
if(typeof(finishingArr[109]['']) == 'undefined') finishingArr[109][''] = new Array();
finishingArr[109][''][0] = new Array(0, 0.01);
if(typeof(finishingArr[110]) == 'undefined') finishingArr[110] = new Array();
if(typeof(finishingArr[110]['']) == 'undefined') finishingArr[110][''] = new Array();
finishingArr[110][''][0] = new Array(0, 0.01);
if(typeof(finishingArr[112]) == 'undefined') finishingArr[112] = new Array();
if(typeof(finishingArr[112]['']) == 'undefined') finishingArr[112][''] = new Array();
finishingArr[112][''][10000] = new Array(104, 0.07);
finishingArr[112][''][0] = new Array(104, 0.08);
if(typeof(finishingArr[113]) == 'undefined') finishingArr[113] = new Array();
if(typeof(finishingArr[113]['']) == 'undefined') finishingArr[113][''] = new Array();
finishingArr[113][''][10000] = new Array(150, 0.07);
finishingArr[113][''][0] = new Array(150, 0.08);
if(typeof(finishingArr[114]) == 'undefined') finishingArr[114] = new Array();
if(typeof(finishingArr[114]['']) == 'undefined') finishingArr[114][''] = new Array();
finishingArr[114][''][10000] = new Array(193, 0.07);
finishingArr[114][''][0] = new Array(193, 0.08);
if(typeof(finishingArr[115]) == 'undefined') finishingArr[115] = new Array();
if(typeof(finishingArr[115]['']) == 'undefined') finishingArr[115][''] = new Array();
finishingArr[115][''][10000] = new Array(272, 0.07);
finishingArr[115][''][0] = new Array(272, 0.08);
if(typeof(finishingArr[116]) == 'undefined') finishingArr[116] = new Array();
if(typeof(finishingArr[116]['']) == 'undefined') finishingArr[116][''] = new Array();
finishingArr[116][''][10000] = new Array(414, 0.07);
finishingArr[116][''][0] = new Array(414, 0.08);
if(typeof(finishingArr[118]) == 'undefined') finishingArr[118] = new Array();
if(typeof(finishingArr[118]['']) == 'undefined') finishingArr[118][''] = new Array();
finishingArr[118][''][10000] = new Array(107, 0.07);
finishingArr[118][''][0] = new Array(107, 0.08);
if(typeof(finishingArr[119]) == 'undefined') finishingArr[119] = new Array();
if(typeof(finishingArr[119]['']) == 'undefined') finishingArr[119][''] = new Array();
finishingArr[119][''][10000] = new Array(115, 0.07);
finishingArr[119][''][0] = new Array(115, 0.08);
if(typeof(finishingArr[120]) == 'undefined') finishingArr[120] = new Array();
if(typeof(finishingArr[120]['']) == 'undefined') finishingArr[120][''] = new Array();
finishingArr[120][''][10000] = new Array(122, 0.07);
finishingArr[120][''][0] = new Array(122, 0.08);
if(typeof(finishingArr[121]) == 'undefined') finishingArr[121] = new Array();
if(typeof(finishingArr[121]['']) == 'undefined') finishingArr[121][''] = new Array();
finishingArr[121][''][10000] = new Array(145, 0.07);
finishingArr[121][''][0] = new Array(145, 0.08);
if(typeof(finishingArr[122]) == 'undefined') finishingArr[122] = new Array();
if(typeof(finishingArr[122]['']) == 'undefined') finishingArr[122][''] = new Array();
finishingArr[122][''][10000] = new Array(170, 0.07);
finishingArr[122][''][0] = new Array(170, 0.08);
if(typeof(finishingArr[124]) == 'undefined') finishingArr[124] = new Array();
if(typeof(finishingArr[124]['']) == 'undefined') finishingArr[124][''] = new Array();
finishingArr[124][''][0] = new Array(20, 0.01);
if(typeof(finishingArr[125]) == 'undefined') finishingArr[125] = new Array();
if(typeof(finishingArr[125]['']) == 'undefined') finishingArr[125][''] = new Array();
finishingArr[125][''][0] = new Array(0, 0);
if(typeof(finishingArr[126]) == 'undefined') finishingArr[126] = new Array();
if(typeof(finishingArr[126]['']) == 'undefined') finishingArr[126][''] = new Array();
finishingArr[126][''][0] = new Array(0, 0);
if(typeof(finishingArr[127]) == 'undefined') finishingArr[127] = new Array();
if(typeof(finishingArr[127]['']) == 'undefined') finishingArr[127][''] = new Array();
finishingArr[127][''][0] = new Array(0, 0.05);
if(typeof(finishingArr[128]) == 'undefined') finishingArr[128] = new Array();
if(typeof(finishingArr[128]['']) == 'undefined') finishingArr[128][''] = new Array();
finishingArr[128][''][0] = new Array(104, 0.08);
if(typeof(finishingArr[129]) == 'undefined') finishingArr[129] = new Array();
if(typeof(finishingArr[129]['']) == 'undefined') finishingArr[129][''] = new Array();
finishingArr[129][''][10000] = new Array(150, 0.07);
finishingArr[129][''][0] = new Array(150, 0.08);
if(typeof(finishingArr[130]) == 'undefined') finishingArr[130] = new Array();
if(typeof(finishingArr[130]['']) == 'undefined') finishingArr[130][''] = new Array();
finishingArr[130][''][10000] = new Array(193, 0.07);
finishingArr[130][''][0] = new Array(193, 0.08);
if(typeof(finishingArr[131]) == 'undefined') finishingArr[131] = new Array();
if(typeof(finishingArr[131]['']) == 'undefined') finishingArr[131][''] = new Array();
finishingArr[131][''][10000] = new Array(272, 0.07);
finishingArr[131][''][0] = new Array(272, 0.08);
if(typeof(finishingArr[132]) == 'undefined') finishingArr[132] = new Array();
if(typeof(finishingArr[132]['']) == 'undefined') finishingArr[132][''] = new Array();
finishingArr[132][''][10000] = new Array(414, 0.07);
finishingArr[132][''][0] = new Array(414, 0.08);
if(typeof(finishingArr[134]) == 'undefined') finishingArr[134] = new Array();
if(typeof(finishingArr[134]['']) == 'undefined') finishingArr[134][''] = new Array();
finishingArr[134][''][0] = new Array(0, 0);
if(typeof(finishingArr[135]) == 'undefined') finishingArr[135] = new Array();
if(typeof(finishingArr[135]['']) == 'undefined') finishingArr[135][''] = new Array();
finishingArr[135][''][0] = new Array(0, 0);
if(typeof(finishingArr[136]) == 'undefined') finishingArr[136] = new Array();
if(typeof(finishingArr[136]['']) == 'undefined') finishingArr[136][''] = new Array();
finishingArr[136][''][0] = new Array(0, 0.02);
if(typeof(finishingArr[137]) == 'undefined') finishingArr[137] = new Array();
if(typeof(finishingArr[137]['']) == 'undefined') finishingArr[137][''] = new Array();
finishingArr[137][''][0] = new Array(75, 0.02);
if(typeof(finishingArr[138]) == 'undefined') finishingArr[138] = new Array();
if(typeof(finishingArr[138]['']) == 'undefined') finishingArr[138][''] = new Array();
finishingArr[138][''][20000] = new Array(69, 0.08);
finishingArr[138][''][5000] = new Array(69, 0.09);
finishingArr[138][''][0] = new Array(69, 0.1);
if(typeof(finishingArr[139]) == 'undefined') finishingArr[139] = new Array();
if(typeof(finishingArr[139]['']) == 'undefined') finishingArr[139][''] = new Array();
finishingArr[139][''][20000] = new Array(96, 0.08);
finishingArr[139][''][5000] = new Array(96, 0.09);
finishingArr[139][''][0] = new Array(96, 0.1);
if(typeof(finishingArr[140]) == 'undefined') finishingArr[140] = new Array();
if(typeof(finishingArr[140]['']) == 'undefined') finishingArr[140][''] = new Array();
finishingArr[140][''][20000] = new Array(114, 0.08);
finishingArr[140][''][5000] = new Array(114, 0.09);
finishingArr[140][''][0] = new Array(114, 0.1);
if(typeof(finishingArr[141]) == 'undefined') finishingArr[141] = new Array();
if(typeof(finishingArr[141]['']) == 'undefined') finishingArr[141][''] = new Array();
finishingArr[141][''][20000] = new Array(153, 0.08);
finishingArr[141][''][5000] = new Array(153, 0.09);
finishingArr[141][''][0] = new Array(153, 0.1);
if(typeof(finishingArr[142]) == 'undefined') finishingArr[142] = new Array();
if(typeof(finishingArr[142]['']) == 'undefined') finishingArr[142][''] = new Array();
finishingArr[142][''][20000] = new Array(225, 0.08);
finishingArr[142][''][5000] = new Array(225, 0.09);
finishingArr[142][''][0] = new Array(225, 0.1);
if(typeof(finishingArr[148]) == 'undefined') finishingArr[148] = new Array();
if(typeof(finishingArr[148]['']) == 'undefined') finishingArr[148][''] = new Array();
finishingArr[148][''][0] = new Array(0, 0);
if(typeof(finishingArr[149]) == 'undefined') finishingArr[149] = new Array();
if(typeof(finishingArr[149]['']) == 'undefined') finishingArr[149][''] = new Array();
finishingArr[149][''][0] = new Array(0, 0);
if(typeof(finishingArr[150]) == 'undefined') finishingArr[150] = new Array();
if(typeof(finishingArr[150]['']) == 'undefined') finishingArr[150][''] = new Array();
finishingArr[150][''][0] = new Array(10, 0.01);
if(typeof(finishingArr[150][14]) == 'undefined') finishingArr[150][14] = new Array();
finishingArr[150][14][0] = new Array(20, 0.01);
if(typeof(finishingArr[156]) == 'undefined') finishingArr[156] = new Array();
if(typeof(finishingArr[156]['']) == 'undefined') finishingArr[156][''] = new Array();
finishingArr[156][''][0] = new Array(0, 0);
if(typeof(finishingArr[157]) == 'undefined') finishingArr[157] = new Array();
if(typeof(finishingArr[157]['']) == 'undefined') finishingArr[157][''] = new Array();
finishingArr[157][''][0] = new Array(0, 0);
if(typeof(finishingArr[158]) == 'undefined') finishingArr[158] = new Array();
if(typeof(finishingArr[158]['']) == 'undefined') finishingArr[158][''] = new Array();
finishingArr[158][''][0] = new Array(0, 0.02);
if(typeof(finishingArr[159]) == 'undefined') finishingArr[159] = new Array();
if(typeof(finishingArr[159]['']) == 'undefined') finishingArr[159][''] = new Array();
finishingArr[159][''][0] = new Array(0, 0.02);
if(typeof(finishingArr[159][99]) == 'undefined') finishingArr[159][99] = new Array();
finishingArr[159][99][0] = new Array(0, 0.01);
if(typeof(finishingArr[163]) == 'undefined') finishingArr[163] = new Array();
if(typeof(finishingArr[163][61]) == 'undefined') finishingArr[163][61] = new Array();
finishingArr[163][61][0] = new Array(0, 0);
if(typeof(finishingArr[163][62]) == 'undefined') finishingArr[163][62] = new Array();
finishingArr[163][62][0] = new Array(0, 0);
if(typeof(finishingArr[164]) == 'undefined') finishingArr[164] = new Array();
if(typeof(finishingArr[164][61]) == 'undefined') finishingArr[164][61] = new Array();
finishingArr[164][61][0] = new Array(0, 0.09);
if(typeof(finishingArr[164][62]) == 'undefined') finishingArr[164][62] = new Array();
finishingArr[164][62][0] = new Array(0, 0.1);
if(typeof(finishingArr[165]) == 'undefined') finishingArr[165] = new Array();
if(typeof(finishingArr[165]['']) == 'undefined') finishingArr[165][''] = new Array();
finishingArr[165][''][0] = new Array(0, 0);
if(typeof(finishingArr[166]) == 'undefined') finishingArr[166] = new Array();
if(typeof(finishingArr[166]['']) == 'undefined') finishingArr[166][''] = new Array();
finishingArr[166][''][0] = new Array(0, 0);
if(typeof(finishingArr[167]) == 'undefined') finishingArr[167] = new Array();
if(typeof(finishingArr[167]['']) == 'undefined') finishingArr[167][''] = new Array();
finishingArr[167][''][0] = new Array(0, 0);
if(typeof(finishingArr[168]) == 'undefined') finishingArr[168] = new Array();
if(typeof(finishingArr[168]['']) == 'undefined') finishingArr[168][''] = new Array();
finishingArr[168][''][0] = new Array(0, 0);
if(typeof(finishingArr[169]) == 'undefined') finishingArr[169] = new Array();
if(typeof(finishingArr[169]['']) == 'undefined') finishingArr[169][''] = new Array();
finishingArr[169][''][0] = new Array(0, 0);
if(typeof(finishingArr[170]) == 'undefined') finishingArr[170] = new Array();
if(typeof(finishingArr[170][52]) == 'undefined') finishingArr[170][52] = new Array();
finishingArr[170][52][0] = new Array(0, 0);
if(typeof(finishingArr[171]) == 'undefined') finishingArr[171] = new Array();
if(typeof(finishingArr[171][52]) == 'undefined') finishingArr[171][52] = new Array();
finishingArr[171][52][0] = new Array(0, 0);
if(typeof(finishingArr[172]) == 'undefined') finishingArr[172] = new Array();
if(typeof(finishingArr[172][52]) == 'undefined') finishingArr[172][52] = new Array();
finishingArr[172][52][0] = new Array(0, 0);
if(typeof(finishingArr[174]) == 'undefined') finishingArr[174] = new Array();
if(typeof(finishingArr[174]['']) == 'undefined') finishingArr[174][''] = new Array();
finishingArr[174][''][0] = new Array(0, 0);
if(typeof(finishingArr[175]) == 'undefined') finishingArr[175] = new Array();
if(typeof(finishingArr[175]['']) == 'undefined') finishingArr[175][''] = new Array();
finishingArr[175][''][0] = new Array(0, 0);
if(typeof(finishingArr[176]) == 'undefined') finishingArr[176] = new Array();
if(typeof(finishingArr[176]['']) == 'undefined') finishingArr[176][''] = new Array();
finishingArr[176][''][0] = new Array(0, 0);
if(typeof(finishingArr[177]) == 'undefined') finishingArr[177] = new Array();
if(typeof(finishingArr[177]['']) == 'undefined') finishingArr[177][''] = new Array();
finishingArr[177][''][0] = new Array(0, 0);
if(typeof(finishingArr[178]) == 'undefined') finishingArr[178] = new Array();
if(typeof(finishingArr[178]['']) == 'undefined') finishingArr[178][''] = new Array();
finishingArr[178][''][0] = new Array(0, 0);
if(typeof(finishingArr[179]) == 'undefined') finishingArr[179] = new Array();
if(typeof(finishingArr[179]['']) == 'undefined') finishingArr[179][''] = new Array();
finishingArr[179][''][0] = new Array(0, 0);
if(typeof(finishingArr[180]) == 'undefined') finishingArr[180] = new Array();
if(typeof(finishingArr[180]['']) == 'undefined') finishingArr[180][''] = new Array();
finishingArr[180][''][0] = new Array(0, 0);
if(typeof(finishingArr[181]) == 'undefined') finishingArr[181] = new Array();
if(typeof(finishingArr[181]['']) == 'undefined') finishingArr[181][''] = new Array();
finishingArr[181][''][0] = new Array(0, 0.02);
if(typeof(finishingArr[182]) == 'undefined') finishingArr[182] = new Array();
if(typeof(finishingArr[182]['']) == 'undefined') finishingArr[182][''] = new Array();
finishingArr[182][''][0] = new Array(0, 0);
if(typeof(finishingArr[183]) == 'undefined') finishingArr[183] = new Array();
if(typeof(finishingArr[183]['']) == 'undefined') finishingArr[183][''] = new Array();
finishingArr[183][''][0] = new Array(0, 0);
if(typeof(finishingArr[184]) == 'undefined') finishingArr[184] = new Array();
if(typeof(finishingArr[184]['']) == 'undefined') finishingArr[184][''] = new Array();
finishingArr[184][''][0] = new Array(0, 0);
if(typeof(finishingArr[185]) == 'undefined') finishingArr[185] = new Array();
if(typeof(finishingArr[185]['']) == 'undefined') finishingArr[185][''] = new Array();
finishingArr[185][''][0] = new Array(0, 0);
if(typeof(finishingArr[192]) == 'undefined') finishingArr[192] = new Array();
if(typeof(finishingArr[192]['']) == 'undefined') finishingArr[192][''] = new Array();
finishingArr[192][''][10000] = new Array(0, 0.045);
finishingArr[192][''][5000] = new Array(0, 0.055);
finishingArr[192][''][0] = new Array(0, 0.07);
if(typeof(finishingArr[193]) == 'undefined') finishingArr[193] = new Array();
if(typeof(finishingArr[193]['']) == 'undefined') finishingArr[193][''] = new Array();
finishingArr[193][''][10000] = new Array(0, 0.059);
finishingArr[193][''][5000] = new Array(0, 0.069);
finishingArr[193][''][0] = new Array(0, 0.084);
if(typeof(finishingArr[194]) == 'undefined') finishingArr[194] = new Array();
if(typeof(finishingArr[194]['']) == 'undefined') finishingArr[194][''] = new Array();
finishingArr[194][''][10000] = new Array(0, 0.08);
finishingArr[194][''][5000] = new Array(0, 0.09);
finishingArr[194][''][0] = new Array(0, 0.105);
if(typeof(finishingArr[195]) == 'undefined') finishingArr[195] = new Array();
if(typeof(finishingArr[195]['']) == 'undefined') finishingArr[195][''] = new Array();
finishingArr[195][''][10000] = new Array(0, 0.108);
finishingArr[195][''][5000] = new Array(0, 0.118);
finishingArr[195][''][0] = new Array(0, 0.133);
if(typeof(finishingArr[196]) == 'undefined') finishingArr[196] = new Array();
if(typeof(finishingArr[196]['']) == 'undefined') finishingArr[196][''] = new Array();
finishingArr[196][''][10000] = new Array(0, 0.069);
finishingArr[196][''][5000] = new Array(0, 0.076);
finishingArr[196][''][0] = new Array(0, 0.091);
if(typeof(finishingArr[198]) == 'undefined') finishingArr[198] = new Array();
if(typeof(finishingArr[198]['']) == 'undefined') finishingArr[198][''] = new Array();
finishingArr[198][''][10000] = new Array(0, 0.041);
finishingArr[198][''][5000] = new Array(0, 0.053);
finishingArr[198][''][0] = new Array(0, 0.07);
if(typeof(finishingArr[199]) == 'undefined') finishingArr[199] = new Array();
if(typeof(finishingArr[199]['']) == 'undefined') finishingArr[199][''] = new Array();
finishingArr[199][''][10000] = new Array(0, 0.055);
finishingArr[199][''][5000] = new Array(0, 0.067);
finishingArr[199][''][0] = new Array(0, 0.084);
if(typeof(finishingArr[200]) == 'undefined') finishingArr[200] = new Array();
if(typeof(finishingArr[200]['']) == 'undefined') finishingArr[200][''] = new Array();
finishingArr[200][''][10000] = new Array(0, 0.069);
finishingArr[200][''][5000] = new Array(0, 0.078);
finishingArr[200][''][0] = new Array(0, 0.098);
if(typeof(finishingArr[201]) == 'undefined') finishingArr[201] = new Array();
if(typeof(finishingArr[201]['']) == 'undefined') finishingArr[201][''] = new Array();
finishingArr[201][''][10000] = new Array(0, 0.083);
finishingArr[201][''][5000] = new Array(0, 0.095);
finishingArr[201][''][0] = new Array(0, 0.112);
if(typeof(finishingArr[202]) == 'undefined') finishingArr[202] = new Array();
if(typeof(finishingArr[202]['']) == 'undefined') finishingArr[202][''] = new Array();
finishingArr[202][''][10000] = new Array(0, 0.097);
finishingArr[202][''][5000] = new Array(0, 0.109);
finishingArr[202][''][0] = new Array(0, 0.126);
if(typeof(finishingArr[290]) == 'undefined') finishingArr[290] = new Array();
if(typeof(finishingArr[290]['']) == 'undefined') finishingArr[290][''] = new Array();
finishingArr[290][''][0] = new Array(20, 0.01);
if(typeof(finishingArr[290][6]) == 'undefined') finishingArr[290][6] = new Array();
finishingArr[290][6][0] = new Array(15, 0.01);
if(typeof(finishingArr[290][11]) == 'undefined') finishingArr[290][11] = new Array();
finishingArr[290][11][0] = new Array(15, 0.01);
if(typeof(finishingArr[290][15]) == 'undefined') finishingArr[290][15] = new Array();
finishingArr[290][15][0] = new Array(0, 0);
if(typeof(finishingArr[290][71]) == 'undefined') finishingArr[290][71] = new Array();
finishingArr[290][71][0] = new Array(0, 0);
if(typeof(finishingArr[290][90]) == 'undefined') finishingArr[290][90] = new Array();
finishingArr[290][90][0] = new Array(0, 0);
if(typeof(finishingArr[290][91]) == 'undefined') finishingArr[290][91] = new Array();
finishingArr[290][91][0] = new Array(0, 0);
if(typeof(finishingArr[290][92]) == 'undefined') finishingArr[290][92] = new Array();
finishingArr[290][92][0] = new Array(0, 0);
if(typeof(finishingArr[290][93]) == 'undefined') finishingArr[290][93] = new Array();
finishingArr[290][93][0] = new Array(0, 0);
if(typeof(finishingArr[291]) == 'undefined') finishingArr[291] = new Array();
if(typeof(finishingArr[291]['']) == 'undefined') finishingArr[291][''] = new Array();
finishingArr[291][''][10000] = new Array(0, 0.083);
finishingArr[291][''][5000] = new Array(0, 0.09);
finishingArr[291][''][0] = new Array(0, 0.105);
if(typeof(finishingArr[292]) == 'undefined') finishingArr[292] = new Array();
if(typeof(finishingArr[292]['']) == 'undefined') finishingArr[292][''] = new Array();
finishingArr[292][''][10000] = new Array(0, 0.104);
finishingArr[292][''][5000] = new Array(0, 0.111);
finishingArr[292][''][0] = new Array(0, 0.126);
if(typeof(finishingArr[293]) == 'undefined') finishingArr[293] = new Array();
if(typeof(finishingArr[293]['']) == 'undefined') finishingArr[293][''] = new Array();
finishingArr[293][''][10000] = new Array(0, 0.132);
finishingArr[293][''][5000] = new Array(0, 0.139);
finishingArr[293][''][0] = new Array(0, 0.154);
if(typeof(finishingArr[294]) == 'undefined') finishingArr[294] = new Array();
if(typeof(finishingArr[294]['']) == 'undefined') finishingArr[294][''] = new Array();
finishingArr[294][''][10000] = new Array(0, 0.069);
finishingArr[294][''][5000] = new Array(0, 0.076);
finishingArr[294][''][0] = new Array(0, 0.091);
if(typeof(finishingArr[295]) == 'undefined') finishingArr[295] = new Array();
if(typeof(finishingArr[295]['']) == 'undefined') finishingArr[295][''] = new Array();
finishingArr[295][''][10000] = new Array(0, 0.083);
finishingArr[295][''][5000] = new Array(0, 0.09);
finishingArr[295][''][0] = new Array(0, 0.105);
if(typeof(finishingArr[296]) == 'undefined') finishingArr[296] = new Array();
if(typeof(finishingArr[296]['']) == 'undefined') finishingArr[296][''] = new Array();
finishingArr[296][''][10000] = new Array(0, 0.104);
finishingArr[296][''][5000] = new Array(0, 0.111);
finishingArr[296][''][0] = new Array(0, 0.126);
if(typeof(finishingArr[297]) == 'undefined') finishingArr[297] = new Array();
if(typeof(finishingArr[297]['']) == 'undefined') finishingArr[297][''] = new Array();
finishingArr[297][''][10000] = new Array(0, 0.132);
finishingArr[297][''][5000] = new Array(0, 0.139);
finishingArr[297][''][0] = new Array(0, 0.154);
if(typeof(finishingArr[298]) == 'undefined') finishingArr[298] = new Array();
if(typeof(finishingArr[298]['']) == 'undefined') finishingArr[298][''] = new Array();
finishingArr[298][''][10000] = new Array(0, 0.045);
finishingArr[298][''][5000] = new Array(0, 0.055);
finishingArr[298][''][0] = new Array(0, 0.07);
if(typeof(finishingArr[299]) == 'undefined') finishingArr[299] = new Array();
if(typeof(finishingArr[299]['']) == 'undefined') finishingArr[299][''] = new Array();
finishingArr[299][''][10000] = new Array(0, 0.059);
finishingArr[299][''][5000] = new Array(0, 0.069);
finishingArr[299][''][0] = new Array(0, 0.084);
if(typeof(finishingArr[300]) == 'undefined') finishingArr[300] = new Array();
if(typeof(finishingArr[300]['']) == 'undefined') finishingArr[300][''] = new Array();
finishingArr[300][''][10000] = new Array(0, 0.08);
finishingArr[300][''][5000] = new Array(0, 0.09);
finishingArr[300][''][0] = new Array(0, 0.105);
if(typeof(finishingArr[301]) == 'undefined') finishingArr[301] = new Array();
if(typeof(finishingArr[301]['']) == 'undefined') finishingArr[301][''] = new Array();
finishingArr[301][''][10000] = new Array(0, 0.108);
finishingArr[301][''][5000] = new Array(0, 0.118);
finishingArr[301][''][0] = new Array(0, 0.133);
if(typeof(finishingArr[302]) == 'undefined') finishingArr[302] = new Array();
if(typeof(finishingArr[302]['']) == 'undefined') finishingArr[302][''] = new Array();
finishingArr[302][''][10000] = new Array(0, 0.069);
finishingArr[302][''][5000] = new Array(0, 0.083);
finishingArr[302][''][0] = new Array(0, 0.098);
if(typeof(finishingArr[303]) == 'undefined') finishingArr[303] = new Array();
if(typeof(finishingArr[303]['']) == 'undefined') finishingArr[303][''] = new Array();
finishingArr[303][''][10000] = new Array(0, 0.083);
finishingArr[303][''][5000] = new Array(0, 0.097);
finishingArr[303][''][0] = new Array(0, 0.112);
if(typeof(finishingArr[304]) == 'undefined') finishingArr[304] = new Array();
if(typeof(finishingArr[304]['']) == 'undefined') finishingArr[304][''] = new Array();
finishingArr[304][''][10000] = new Array(0, 0.104);
finishingArr[304][''][5000] = new Array(0, 0.118);
finishingArr[304][''][0] = new Array(0, 0.133);
if(typeof(finishingArr[305]) == 'undefined') finishingArr[305] = new Array();
if(typeof(finishingArr[305]['']) == 'undefined') finishingArr[305][''] = new Array();
finishingArr[305][''][10000] = new Array(0, 0.132);
finishingArr[305][''][5000] = new Array(0, 0.146);
finishingArr[305][''][0] = new Array(0, 0.161);
if(typeof(finishingArr[306]) == 'undefined') finishingArr[306] = new Array();
if(typeof(finishingArr[306]['']) == 'undefined') finishingArr[306][''] = new Array();
finishingArr[306][''][20000] = new Array(68, 0.005);
finishingArr[306][''][10000] = new Array(68, 0.01);
finishingArr[306][''][5000] = new Array(68, 0.02);
finishingArr[306][''][2500] = new Array(68, 0.025);
finishingArr[306][''][0] = new Array(68, 0.03);
if(typeof(finishingArr[317]) == 'undefined') finishingArr[317] = new Array();
if(typeof(finishingArr[317]['']) == 'undefined') finishingArr[317][''] = new Array();
finishingArr[317][''][0] = new Array(0, 0.01);
if(typeof(finishingArr[318]) == 'undefined') finishingArr[318] = new Array();
if(typeof(finishingArr[318][15]) == 'undefined') finishingArr[318][15] = new Array();
finishingArr[318][15][0] = new Array(20, 0.01);
if(typeof(finishingArr[318][71]) == 'undefined') finishingArr[318][71] = new Array();
finishingArr[318][71][0] = new Array(0, 0);
if(typeof(finishingArr[318][90]) == 'undefined') finishingArr[318][90] = new Array();
finishingArr[318][90][0] = new Array(0, 0);
if(typeof(finishingArr[318][91]) == 'undefined') finishingArr[318][91] = new Array();
finishingArr[318][91][0] = new Array(0, 0);
if(typeof(finishingArr[319]) == 'undefined') finishingArr[319] = new Array();
if(typeof(finishingArr[319]['']) == 'undefined') finishingArr[319][''] = new Array();
finishingArr[319][''][0] = new Array(5, 0.004);
if(typeof(finishingArr[320]) == 'undefined') finishingArr[320] = new Array();
if(typeof(finishingArr[320]['']) == 'undefined') finishingArr[320][''] = new Array();
finishingArr[320][''][0] = new Array(25, 0.07);
if(typeof(finishingArr[324]) == 'undefined') finishingArr[324] = new Array();
if(typeof(finishingArr[324]['']) == 'undefined') finishingArr[324][''] = new Array();
finishingArr[324][''][0] = new Array(20, 0.02);
if(typeof(finishingArr[324][65]) == 'undefined') finishingArr[324][65] = new Array();
finishingArr[324][65][0] = new Array(0, 0);
if(typeof(finishingArr[324][66]) == 'undefined') finishingArr[324][66] = new Array();
finishingArr[324][66][0] = new Array(0, 0);
if(typeof(finishingArr[389]) == 'undefined') finishingArr[389] = new Array();
if(typeof(finishingArr[389]['']) == 'undefined') finishingArr[389][''] = new Array();
finishingArr[389][''][0] = new Array(0, 0.01);
if(typeof(finishingArr[392]) == 'undefined') finishingArr[392] = new Array();
if(typeof(finishingArr[392][96]) == 'undefined') finishingArr[392][96] = new Array();
finishingArr[392][96][0] = new Array(0, 0.13);
if(typeof(finishingArr[392][117]) == 'undefined') finishingArr[392][117] = new Array();
finishingArr[392][117][0] = new Array(0, 0.1);
if(typeof(finishingArr[392][118]) == 'undefined') finishingArr[392][118] = new Array();
finishingArr[392][118][0] = new Array(0, 0.13);
if(typeof(finishingArr[392][119]) == 'undefined') finishingArr[392][119] = new Array();
finishingArr[392][119][0] = new Array(0, 0.16);
if(typeof(finishingArr[392][120]) == 'undefined') finishingArr[392][120] = new Array();
finishingArr[392][120][0] = new Array(0, 0.065);
if(typeof(finishingArr[392][121]) == 'undefined') finishingArr[392][121] = new Array();
finishingArr[392][121][0] = new Array(0, 0.1);
if(typeof(finishingArr[393]) == 'undefined') finishingArr[393] = new Array();
if(typeof(finishingArr[393][117]) == 'undefined') finishingArr[393][117] = new Array();
finishingArr[393][117][0] = new Array(0, 0.2);
if(typeof(finishingArr[393][118]) == 'undefined') finishingArr[393][118] = new Array();
finishingArr[393][118][0] = new Array(0, 0.2);
if(typeof(finishingArr[394]) == 'undefined') finishingArr[394] = new Array();
if(typeof(finishingArr[394][96]) == 'undefined') finishingArr[394][96] = new Array();
finishingArr[394][96][0] = new Array(5, 0.24);
if(typeof(finishingArr[394][117]) == 'undefined') finishingArr[394][117] = new Array();
finishingArr[394][117][0] = new Array(5, 0.18);
if(typeof(finishingArr[394][118]) == 'undefined') finishingArr[394][118] = new Array();
finishingArr[394][118][0] = new Array(5, 0.24);
if(typeof(finishingArr[394][119]) == 'undefined') finishingArr[394][119] = new Array();
finishingArr[394][119][0] = new Array(5, 0.3);
if(typeof(finishingArr[394][120]) == 'undefined') finishingArr[394][120] = new Array();
finishingArr[394][120][0] = new Array(5, 0.12);
if(typeof(finishingArr[394][121]) == 'undefined') finishingArr[394][121] = new Array();
finishingArr[394][121][0] = new Array(5, 0.18);
if(typeof(finishingArr[396]) == 'undefined') finishingArr[396] = new Array();
if(typeof(finishingArr[396][96]) == 'undefined') finishingArr[396][96] = new Array();
finishingArr[396][96][0] = new Array(0, 0.03);
if(typeof(finishingArr[396][117]) == 'undefined') finishingArr[396][117] = new Array();
finishingArr[396][117][0] = new Array(0, 0.02);
if(typeof(finishingArr[396][118]) == 'undefined') finishingArr[396][118] = new Array();
finishingArr[396][118][0] = new Array(0, 0.03);
if(typeof(finishingArr[396][119]) == 'undefined') finishingArr[396][119] = new Array();
finishingArr[396][119][0] = new Array(0, 0.04);
if(typeof(finishingArr[396][120]) == 'undefined') finishingArr[396][120] = new Array();
finishingArr[396][120][0] = new Array(0, 0.01);
if(typeof(finishingArr[396][121]) == 'undefined') finishingArr[396][121] = new Array();
finishingArr[396][121][0] = new Array(0, 0.02);
if(typeof(finishingArr[397]) == 'undefined') finishingArr[397] = new Array();
if(typeof(finishingArr[397]['']) == 'undefined') finishingArr[397][''] = new Array();
finishingArr[397][''][500] = new Array(0, 3);
finishingArr[397][''][250] = new Array(0, 3.65);
finishingArr[397][''][0] = new Array(0, 4.25);
if(typeof(finishingArr[398]) == 'undefined') finishingArr[398] = new Array();
if(typeof(finishingArr[398]['']) == 'undefined') finishingArr[398][''] = new Array();
finishingArr[398][''][500] = new Array(0, 3);
finishingArr[398][''][250] = new Array(0, 3.65);
finishingArr[398][''][0] = new Array(0, 4.25);
if(typeof(finishingArr[399]) == 'undefined') finishingArr[399] = new Array();
if(typeof(finishingArr[399][117]) == 'undefined') finishingArr[399][117] = new Array();
finishingArr[399][117][0] = new Array(0, 1.43);
if(typeof(finishingArr[399][118]) == 'undefined') finishingArr[399][118] = new Array();
finishingArr[399][118][0] = new Array(0, 1.64);
if(typeof(finishingArr[401]) == 'undefined') finishingArr[401] = new Array();
if(typeof(finishingArr[401]['']) == 'undefined') finishingArr[401][''] = new Array();
finishingArr[401][''][0] = new Array(20, 0.02);
if(typeof(finishingArr[402]) == 'undefined') finishingArr[402] = new Array();
if(typeof(finishingArr[402]['']) == 'undefined') finishingArr[402][''] = new Array();
finishingArr[402][''][0] = new Array(0, 0);
if(typeof(finishingArr[403]) == 'undefined') finishingArr[403] = new Array();
if(typeof(finishingArr[403]['']) == 'undefined') finishingArr[403][''] = new Array();
finishingArr[403][''][0] = new Array(0, 0);
if(typeof(finishingArr[405]) == 'undefined') finishingArr[405] = new Array();
if(typeof(finishingArr[405]['']) == 'undefined') finishingArr[405][''] = new Array();
finishingArr[405][''][0] = new Array(0, 0);
if(typeof(finishingArr[406]) == 'undefined') finishingArr[406] = new Array();
if(typeof(finishingArr[406]['']) == 'undefined') finishingArr[406][''] = new Array();
finishingArr[406][''][0] = new Array(0, 0);
if(typeof(finishingArr[407]) == 'undefined') finishingArr[407] = new Array();
if(typeof(finishingArr[407]['']) == 'undefined') finishingArr[407][''] = new Array();
finishingArr[407][''][0] = new Array(0, 0);
if(typeof(finishingArr[410]) == 'undefined') finishingArr[410] = new Array();
if(typeof(finishingArr[410]['']) == 'undefined') finishingArr[410][''] = new Array();
finishingArr[410][''][0] = new Array(40, 0);
if(typeof(finishingArr[411]) == 'undefined') finishingArr[411] = new Array();
if(typeof(finishingArr[411]['']) == 'undefined') finishingArr[411][''] = new Array();
finishingArr[411][''][0] = new Array(55, 0);
paperInfoArr[9] = new Array('80# Gloss Text', 'Text', 1, 1, 7, 0.000168421052631579);
paperInfoArr[10] = new Array('70# Uncoated Text', 'Text', 1, 1, 4, 0.000147368421052632);
paperInfoArr[11] = new Array('80# Dull/Matte Text', 'Text', 2, 1, 7, 0.000168421052631579);
paperInfoArr[12] = new Array('100# Gloss Text', 'Text', 2, 1, 9, 0.000210526315789474);
paperInfoArr[13] = new Array('70# Colorsource Text', 'Text', 8, 2, 4, 0.000147368421052632);
paperInfoArr[14] = new Array('80# Dull/Matte Cover', 'Cover', 4, 1, 7, 0.000307692307692308);
paperInfoArr[15] = new Array('10 pt Carolina C1S Cover', 'Cover', 5, 2, 14, 0.000313461538461539);
paperInfoArr[16] = new Array('80# Cougar Text', 'Text', 26, 2, 7, 0.000168421052631579);
paperInfoArr[17] = new Array('80# Gloss Cover', 'Cover', 3, 1, 7, 0.000307692307692308);
paperInfoArr[18] = new Array('80# Lustro Dull Text', 'Text', 5, 2, 7, 0.000168421052631579);
paperInfoArr[19] = new Array('80# Lustro Dull Cream Text', 'Text', 5, 2, 7, 0.000168421052631579);
paperInfoArr[20] = new Array('80# Centura Silk Text', 'Text', 27, 2, 7, 0.000168421052631579);
paperInfoArr[21] = new Array('80# Centura Gloss Text', 'Text', 27, 2, 7, 0.000168421052631579);
paperInfoArr[22] = new Array('100# Dull/Matte Text', 'Text', 26, 2, 9, 0.000210526315789474);
paperInfoArr[23] = new Array('100# Gloss Cover', 'Cover', 4, 2, 9, 0.000384615384615385);
paperInfoArr[24] = new Array('80# Nekoosa Linen Text', 'Text', 8, 2, 7, 0.000168421052631579);
paperInfoArr[25] = new Array('70# Royal Fiber Text', 'Text', 28, 2, 4, 0.000147368421052632);
paperInfoArr[26] = new Array('100# Cougar Text', 'Text', 27, 2, 9, 0.000210526315789474);
paperInfoArr[27] = new Array('24# Classic Crest Writing', 'Text', 27, 2, 1, 0.000128342245989305);
paperInfoArr[28] = new Array('24# Classic Columns Writing', 'Text', 26, 2, 1, 0.000128342245989305);
paperInfoArr[29] = new Array('100# Lustro Dull Text', 'Text', 8, 2, 9, 0.000210526315789474);
paperInfoArr[30] = new Array('100# Lustro Dull Cream Text', 'Text', 8, 2, 9, 0.000210526315789474);
paperInfoArr[31] = new Array('100# Centura Silk Text', 'Text', 27, 2, 9, 0.000210526315789474);
paperInfoArr[32] = new Array('100# Centura Gloss Text', 'Text', 27, 2, 9, 0.000210526315789474);
paperInfoArr[33] = new Array('12pt. Carolina C1S Cover', 'Cover', 8, 2, 15, 0.000355769230769231);
paperInfoArr[34] = new Array('80# Skytone Text', 'Text', 8, 2, 7, 0.000168421052631579);
paperInfoArr[35] = new Array('80# Environment Text', 'Text', 29, 2, 7, 0.000168421052631579);
paperInfoArr[36] = new Array('24# Classic Cotton Writing 25', 'Text', 28, 2, 1, 0.000128342245989305);
paperInfoArr[37] = new Array('24# Strathmore Writing 25 - Cotton', 'Text', 33, 2, 1, 0.000128342245989305);
paperInfoArr[38] = new Array('75# Classic Laid Text', 'Text', 28, 2, 5, 0.000157894736842105);
paperInfoArr[39] = new Array('80# Classic Columns Text', 'Text', 30, 2, 7, 0.000168421052631579);
paperInfoArr[40] = new Array('80# Evergreen 100 PC Text', 'Text', 10, 2, 7, 0.000168421052631579);
paperInfoArr[41] = new Array('80# Feltweave Text', 'Text', 10, 2, 7, 0.000168421052631579);
paperInfoArr[42] = new Array('100# Uncoated Cover', 'Cover', 6, 1, 9, 0.000384615384615385);
paperInfoArr[43] = new Array('120# Gloss Cover', 'Cover', 6, 1, 12, 0.000461538461538462);
paperInfoArr[44] = new Array('120# Dull/Matte Cover', 'Cover', 7, 1, 12, 0.000461538461538462);
paperInfoArr[45] = new Array('80# Starwhite Text', 'Text', 33, 2, 7, 0.000168421052631579);
paperInfoArr[46] = new Array('80# Lustro Dull Cover', 'Cover', 10, 2, 7, 0.000307692307692308);
paperInfoArr[47] = new Array('80# Lustro Dull Cream Cover', 'Cover', 10, 2, 7, 0.000307692307692308);
paperInfoArr[48] = new Array('80# Centura Silk Cover', 'Cover', 34, 2, 7, 0.000307692307692308);
paperInfoArr[49] = new Array('80# Centura Gloss Cover', 'Cover', 34, 2, 7, 0.000307692307692308);
paperInfoArr[50] = new Array('80# Classic Crest Text', 'Text', 29, 2, 7, 0.000168421052631579);
paperInfoArr[51] = new Array('80# Cougar Cover', 'Cover', 34, 2, 7, 0.000307692307692308);
paperInfoArr[52] = new Array('80# Classic Linen Text', 'Text', 30, 2, 7, 0.000168421052631579);
paperInfoArr[53] = new Array('80# Astrobrights Cover', 'Cover', 36, 2, 7, 0.000307692307692308);
paperInfoArr[54] = new Array('100# Cougar Cover', 'Cover', 34, 2, 9, 0.000384615384615385);
paperInfoArr[55] = new Array('100# Lustro Dull Cover', 'Cover', 11, 2, 9, 0.000384615384615385);
paperInfoArr[56] = new Array('100# Lustro Dull Cream Cover', 'Cover', 11, 2, 9, 0.000384615384615385);
paperInfoArr[57] = new Array('100# Classic Crest Text', 'Text', 31, 2, 9, 0.000210526315789474);
paperInfoArr[58] = new Array('80# Environment Cover', 'Cover', 36, 2, 7, 0.000307692307692308);
paperInfoArr[59] = new Array('80# Skytone Cover', 'Cover', 11, 2, 7, 0.000307692307692308);
paperInfoArr[60] = new Array('100# Centura Silk Cover', 'Cover', 34, 2, 9, 0.000384615384615385);
paperInfoArr[61] = new Array('80# Feltweave Cover', 'Cover', 36, 2, 7, 0.000307692307692308);
paperInfoArr[62] = new Array('80# Nekoosa Linen Cover', 'Cover', 36, 2, 7, 0.000307692307692308);
paperInfoArr[63] = new Array('80# Royal Fiber Cover', 'Cover', 36, 2, 7, 0.000307692307692308);
paperInfoArr[64] = new Array('10 pt Kromekote C1S Cover', 'Cover', 35, 2, 14, 0.000313461538461539);
paperInfoArr[65] = new Array('80# Evergreen 100 PC Cover', 'Cover', 12, 2, 7, 0.000307692307692308);
paperInfoArr[66] = new Array('120# Centura Silk Cover', 'Cover', 36, 2, 12, 0.000461538461538462);
paperInfoArr[67] = new Array('80# Starwhite Cover', 'Cover', 38, 2, 7, 0.000307692307692308);
paperInfoArr[68] = new Array('12 pt Kromekote C1S Cover', 'Cover', 36, 2, 15, 0.000355769230769231);
paperInfoArr[69] = new Array('80# Classic Laid Cover', 'Cover', 38, 2, 7, 0.000307692307692308);
paperInfoArr[70] = new Array('100# Centura Gloss Cover', 'Cover', 34, 2, 9, 0.000384615384615385);
paperInfoArr[71] = new Array('80# Classic Crest Cover', 'Cover', 37, 2, 7, 0.000307692307692308);
paperInfoArr[72] = new Array('100# Nekoosa Linen Cover', 'Cover', 37, 2, 9, 0.000384615384615385);
paperInfoArr[73] = new Array('10 pt Kromekote C2S Cover', 'Cover', 37, 2, 14, 0.000313461538461539);
paperInfoArr[74] = new Array('80# Classic Linen Cover', 'Cover', 38, 2, 7, 0.000307692307692308);
paperInfoArr[75] = new Array('80# Classic Columns Cover', 'Cover', 39, 2, 7, 0.000307692307692308);
paperInfoArr[76] = new Array('120# Centura Gloss Cover', 'Cover', 35, 2, 12, 0.000461538461538462);
paperInfoArr[77] = new Array('12 pt Kromekote C2S Cover', 'Cover', 38, 2, 15, 0.000355769230769231);
paperInfoArr[78] = new Array('100# Classic Crest Cover', 'Cover', 39, 2, 9, 0.000384615384615385);
paperInfoArr[80] = new Array('80# Strathmore Writing Cover', 'Cover', 39, 2, 7, 0.000307692307692308);
paperInfoArr[81] = new Array('80# Classic Cotton Bristol', 'Cover', 39, 2, 7, 0.000307692307692308);
paperInfoArr[82] = new Array('13 Pt Magnet Stock', 'Magnet', 14, 1, 16, 0.000882142857142857);
paperInfoArr[277] = new Array('24# Uncoated', 'Text', '', 1, 1, 0.000128342245989305);
paperInfoArr[278] = new Array('28# Uncoated White Wove', 'Text', '', 2, 2, 0.000149732620320856);
paperInfoArr[279] = new Array('13 oz Vinyl Banner', 'Vinyl', '', 1, 17, 0.01003086);
paperInfoArr[280] = new Array('CBSL-BCrd-001', 'Cover', '', 2, 13, 0.0005);
paperInfoArr[281] = new Array('CBSL-LH&E-001', 'Text', '', 3, 4, 0.000147368421052632);
paperInfoArr[282] = new Array('CBSL-Lthd-001', 'Text', '', 3, 4, 0.000147368421052632);
paperInfoArr[283] = new Array('CBSL-Prez-001', 'Cover', '', 3, 12, 0.000461538461538462);
paperInfoArr[284] = new Array('2-Part NCR', 'Text', '', 1, 21, 0.0002105);
paperInfoArr[285] = new Array('3-Part NCR', 'Text', '', 1, 22, 0.000308);
paperInfoArr[286] = new Array('60# MacTac Labels', 'Text', 32, 2, 3, 0.000126315789473684);
paperInfoArr[287] = new Array('Mounted Foamboard', 'Foamboard', '', 1, 23, 0.001);
paperInfoArr[383] = new Array('60# Fasson Crack n Peel', 'Label', 15, 2, 3, '');
paperInfoArr[385] = new Array('110# Starwhite Cover', 'Cover', 39, 2, 10, 0.000423076923076923);
paperInfoArr[386] = new Array('130# Centura Gloss Cover', 'Cover', 37, 2, 13, 0.0005);
paperInfoArr[387] = new Array('70# Classic Crest Text ', 'Text', 29, 2, 4, 0.000147368421052632);
paperInfoArr[388] = new Array('4-Part NCR', 'Text', '', 1, 24, 0.000421);
paperInfoArr[390] = new Array('100# Classic Linen Cover', 'Cover', 39, 2, 9, 0.000384615384615385);
paperInfoArr[415] = new Array('70# Whitehall Text', 'Text', 2, 1, 4, 0.000147368421052632);
paperInfoArr[417] = new Array('110# Classic Crest Text', 'Cover', 12, 2, 10, 0.000423076923076923);
paperInfoArr[418] = new Array('110# Classic Crest Cover', 'Cover', 13, 2, 10, 0.000423076923076923);
paperInfoArr[419] = new Array('24# Laser', 'Text', '', 2, 1, 0.000128342245989305);
paperInfoArr[420] = new Array('32# Laser', 'Text', '', 2, 7, 0.000168421052631579);
paperInfoArr[421] = new Array('20# Bond', 'Text', '', 2, 3, 0.000126315789473684);
paperInfoArr[423] = new Array('24# Classic Linen Writing', 'Text', '', 2, 1, 0.000128342245989305);
paperInfoArr[424] = new Array('24# Classic Laid Writing', 'Text', '', 2, 1, 0.000128342245989305);
paperInfoArr[425] = new Array('80# Classic Linen Cover Epic Black', 'Cover', 38, 2, 7, 0.000307692307692308);
paperInfoArr[426] = new Array('70# Classic Linen Text', 'Text', 29, 2, 14, '');
paperInfoArr[427] = new Array('60# Galaxy Offset Text', 'Text', 2, 2, 3, 0.000126315789473684);
paperInfoArr[428] = new Array('70# Domtar Colors Text', 'Text', 27, 2, 4, 0.000147368421052632);
paperInfoArr[429] = new Array('70# Feltweave Text', 'Text', 27, 2, 4, 0.000147368421052632);
paperInfoArr[430] = new Array('70# Nekoosa Linen Text', 'Text', '', 2, 4, 0.000147368421052632);
paperInfoArr[431] = new Array('70# Skytone Text', 'Text', 30, 2, 4, 0.000147368421052632);
paperInfoArr[432] = new Array('60# Whitehall Text', 'Text', 2, 2, 3, 0.000126315789473684);
paperInfoArr[433] = new Array('80# McCoy Silk Text', 'Text', 28, 2, 7, 0.000168421052631579);
paperInfoArr[434] = new Array('100# McCoy Silk Text', 'Text', 29, 2, 9, 0.000210526315789474);
paperInfoArr[435] = new Array('60# Astrobrights Text', 'Text', 28, 2, 3, 0.000126315789473684);
paperInfoArr[436] = new Array('10 pt Nordic C1S Cover', 'Cover', 7, 2, 14, 0.000313461538461539);
paperInfoArr[437] = new Array('12 pt Nordic C1S Cover', 'Cover', 34, 2, 15, 0.000355769230769231);
paperInfoArr[438] = new Array('80# McCoy Silk Cover', 'Cover', 35, 2, 7, 0.000307692307692308);
paperInfoArr[439] = new Array('100# McCoy Silk Cover', 'Cover', 37, 2, 9, 0.000384615384615385);
paperInfoArr[440] = new Array('120# McCoy Silk Cover', 'Cover', '', 2, 12, 0.000461538461538462);
paperInfoArr[441] = new Array('28# UV/Ultra II Translucent', 'Cover', 39, 2, 14, 0.000313461538461539);
paperInfoArr[442] = new Array('36# UV/Ultra II Translucent ', 'Cover', 40, 2, 7, 0.000307692307692308);
paperInfoArr[444] = new Array('130# Classic Crest Cover', 'Cover', 43, 2, 13, 0.0005);
paperInfoArr[445] = new Array('130# Topkote Gloss Cover', 'Cover', 37, 2, 13, 0.0005);
paperInfoArr[446] = new Array('100# Topkote Dull/Matte Cover', 'Cover', 35, 2, 9, 0.000384615384615385);
paperInfoArr[447] = new Array('130# Topkote Dull/Matte Cover', 'Cover', 37, 2, 13, 0.0005);
paperInfoArr[448] = new Array('88# Strathmore Bristol', 'Cover', 40, 2, 27, '');
paperWeightInfoArr[1] = new Array(24, '#');
paperWeightInfoArr[2] = new Array(28, '#');
paperWeightInfoArr[3] = new Array(60, '#');
paperWeightInfoArr[4] = new Array(70, '#');
paperWeightInfoArr[5] = new Array(75, '#');
paperWeightInfoArr[6] = new Array(78, '#');
paperWeightInfoArr[7] = new Array(80, '#');
paperWeightInfoArr[8] = new Array(95, '#');
paperWeightInfoArr[9] = new Array(100, '#');
paperWeightInfoArr[10] = new Array(110, '#');
paperWeightInfoArr[11] = new Array(111, '#');
paperWeightInfoArr[12] = new Array(120, '#');
paperWeightInfoArr[13] = new Array(130, '#');
paperWeightInfoArr[14] = new Array(10, 'pt');
paperWeightInfoArr[15] = new Array(12, 'pt');
paperWeightInfoArr[16] = new Array(13, 'pt');
paperWeightInfoArr[17] = new Array(13, 'oz');
paperWeightInfoArr[18] = new Array(65, '#');
paperWeightInfoArr[21] = new Array(20, '# 2-Part');
paperWeightInfoArr[22] = new Array(20, '# 3-Part');
paperWeightInfoArr[23] = new Array(10, 'oz');
paperWeightInfoArr[24] = new Array(20, '# 4-Part');
paperWeightInfoArr[25] = new Array(14, 'pt');
paperWeightInfoArr[26] = new Array(36, '#');
paperWeightInfoArr[27] = new Array(88, '#');
paperWeightInfoArr[28] = new Array(28, '# UV');
paperWeightInfoArr[29] = new Array(36, '# UV');
pricedPerSignatureArr[9] = new Array(true);
pricedPerSignatureArr[10] = new Array(true);
pricedPerSignatureArr[11] = new Array(true);
pricedPerSignatureArr[12] = new Array(true);
pricedPerSignatureArr[13] = new Array(true);
pricedPerSignatureArr[14] = new Array(true);
pricedPerSignatureArr[15] = new Array(true);
pricedPerSignatureArr[16] = new Array(true);
pricedPerSignatureArr[17] = new Array(true);
pricedPerSignatureArr[18] = new Array(true);
pricedPerSignatureArr[19] = new Array(true);
pricedPerSignatureArr[20] = new Array(true);
pricedPerSignatureArr[21] = new Array(true);
pricedPerSignatureArr[22] = new Array(true);
pricedPerSignatureArr[23] = new Array(true);
pricedPerSignatureArr[24] = new Array(true);
pricedPerSignatureArr[25] = new Array(true);
pricedPerSignatureArr[26] = new Array(true);
pricedPerSignatureArr[27] = new Array(true);
pricedPerSignatureArr[28] = new Array(true);
pricedPerSignatureArr[29] = new Array(true);
pricedPerSignatureArr[30] = new Array(true);
pricedPerSignatureArr[31] = new Array(true);
pricedPerSignatureArr[32] = new Array(true);
pricedPerSignatureArr[33] = new Array(true);
pricedPerSignatureArr[34] = new Array(true);
pricedPerSignatureArr[35] = new Array(true);
pricedPerSignatureArr[36] = new Array(true);
pricedPerSignatureArr[37] = new Array(true);
pricedPerSignatureArr[38] = new Array(true);
pricedPerSignatureArr[39] = new Array(true);
pricedPerSignatureArr[40] = new Array(true);
pricedPerSignatureArr[41] = new Array(true);
pricedPerSignatureArr[42] = new Array(true);
pricedPerSignatureArr[43] = new Array(true);
pricedPerSignatureArr[44] = new Array(true);
pricedPerSignatureArr[45] = new Array(true);
pricedPerSignatureArr[46] = new Array(true);
pricedPerSignatureArr[47] = new Array(true);
pricedPerSignatureArr[48] = new Array(true);
pricedPerSignatureArr[49] = new Array(true);
pricedPerSignatureArr[50] = new Array(true);
pricedPerSignatureArr[51] = new Array(true);
pricedPerSignatureArr[52] = new Array(true);
pricedPerSignatureArr[53] = new Array(true);
pricedPerSignatureArr[54] = new Array(true);
pricedPerSignatureArr[55] = new Array(true);
pricedPerSignatureArr[56] = new Array(true);
pricedPerSignatureArr[57] = new Array(true);
pricedPerSignatureArr[58] = new Array(true);
pricedPerSignatureArr[59] = new Array(true);
pricedPerSignatureArr[60] = new Array(true);
pricedPerSignatureArr[61] = new Array(true);
pricedPerSignatureArr[62] = new Array(true);
pricedPerSignatureArr[63] = new Array(true);
pricedPerSignatureArr[64] = new Array(true);
pricedPerSignatureArr[65] = new Array(true);
pricedPerSignatureArr[66] = new Array(true);
pricedPerSignatureArr[67] = new Array(true);
pricedPerSignatureArr[68] = new Array(true);
pricedPerSignatureArr[69] = new Array(true);
pricedPerSignatureArr[70] = new Array(true);
pricedPerSignatureArr[71] = new Array(true);
pricedPerSignatureArr[72] = new Array(true);
pricedPerSignatureArr[73] = new Array(true);
pricedPerSignatureArr[74] = new Array(true);
pricedPerSignatureArr[75] = new Array(true);
pricedPerSignatureArr[76] = new Array(true);
pricedPerSignatureArr[77] = new Array(true);
pricedPerSignatureArr[78] = new Array(true);
pricedPerSignatureArr[80] = new Array(true);
pricedPerSignatureArr[81] = new Array(true);
pricedPerSignatureArr[82] = new Array(true);
pricedPerSignatureArr[83] = new Array(true);
pricedPerSignatureArr[85] = new Array(true);
pricedPerSignatureArr[87] = new Array(true);
pricedPerSignatureArr[97] = new Array(true);
pricedPerSignatureArr[98] = new Array(true);
pricedPerSignatureArr[99] = new Array(true);
pricedPerSignatureArr[101] = new Array(true);
pricedPerSignatureArr[103] = new Array(true);
pricedPerSignatureArr[104] = new Array(true);
pricedPerSignatureArr[105] = new Array(true);
pricedPerSignatureArr[106] = new Array(true);
pricedPerSignatureArr[107] = new Array(true);
pricedPerSignatureArr[108] = new Array(true);
pricedPerSignatureArr[109] = new Array(true);
pricedPerSignatureArr[110] = new Array(true);
pricedPerSignatureArr[111] = new Array(true);
pricedPerSignatureArr[112] = new Array(true);
pricedPerSignatureArr[113] = new Array(true);
pricedPerSignatureArr[114] = new Array(true);
pricedPerSignatureArr[115] = new Array(true);
pricedPerSignatureArr[116] = new Array(true);
pricedPerSignatureArr[117] = new Array(true);
pricedPerSignatureArr[118] = new Array(true);
pricedPerSignatureArr[119] = new Array(true);
pricedPerSignatureArr[120] = new Array(true);
pricedPerSignatureArr[121] = new Array(true);
pricedPerSignatureArr[122] = new Array(true);
pricedPerSignatureArr[123] = new Array(true);
pricedPerSignatureArr[128] = new Array(true);
pricedPerSignatureArr[129] = new Array(true);
pricedPerSignatureArr[130] = new Array(true);
pricedPerSignatureArr[131] = new Array(true);
pricedPerSignatureArr[132] = new Array(true);
pricedPerSignatureArr[133] = new Array(true);
pricedPerSignatureArr[138] = new Array(true);
pricedPerSignatureArr[139] = new Array(true);
pricedPerSignatureArr[140] = new Array(true);
pricedPerSignatureArr[141] = new Array(true);
pricedPerSignatureArr[142] = new Array(true);
pricedPerSignatureArr[143] = new Array(true);
pricedPerSignatureArr[150] = new Array(true);
pricedPerSignatureArr[151] = new Array(true);
pricedPerSignatureArr[158] = new Array(true);
pricedPerSignatureArr[159] = new Array(true);
pricedPerSignatureArr[160] = new Array(true);
pricedPerSignatureArr[161] = new Array(true);
pricedPerSignatureArr[162] = new Array(true);
pricedPerSignatureArr[170] = new Array(true);
pricedPerSignatureArr[171] = new Array(true);
pricedPerSignatureArr[172] = new Array(true);
pricedPerSignatureArr[173] = new Array(true);
pricedPerSignatureArr[179] = new Array(true);
pricedPerSignatureArr[180] = new Array(true);
pricedPerSignatureArr[197] = new Array(true);
pricedPerSignatureArr[198] = new Array(true);
pricedPerSignatureArr[199] = new Array(true);
pricedPerSignatureArr[200] = new Array(true);
pricedPerSignatureArr[201] = new Array(true);
pricedPerSignatureArr[202] = new Array(true);
pricedPerSignatureArr[203] = new Array(true);
pricedPerSignatureArr[277] = new Array(true);
pricedPerSignatureArr[278] = new Array(true);
pricedPerSignatureArr[279] = new Array(true);
pricedPerSignatureArr[280] = new Array(true);
pricedPerSignatureArr[281] = new Array(true);
pricedPerSignatureArr[282] = new Array(true);
pricedPerSignatureArr[283] = new Array(true);
pricedPerSignatureArr[284] = new Array(true);
pricedPerSignatureArr[285] = new Array(true);
pricedPerSignatureArr[286] = new Array(true);
pricedPerSignatureArr[287] = new Array(true);
pricedPerSignatureArr[289] = new Array(true);
pricedPerSignatureArr[290] = new Array(true);
pricedPerSignatureArr[306] = new Array(true);
pricedPerSignatureArr[307] = new Array(true);
pricedPerSignatureArr[308] = new Array(true);
pricedPerSignatureArr[310] = new Array(true);
pricedPerSignatureArr[311] = new Array(true);
pricedPerSignatureArr[312] = new Array(true);
pricedPerSignatureArr[317] = new Array(true);
pricedPerSignatureArr[318] = new Array(true);
pricedPerSignatureArr[319] = new Array(true);
pricedPerSignatureArr[320] = new Array(true);
pricedPerSignatureArr[321] = new Array(true);
pricedPerSignatureArr[322] = new Array(true);
pricedPerSignatureArr[323] = new Array(true);
pricedPerSignatureArr[326] = new Array(true);
pricedPerSignatureArr[328] = new Array(true);
pricedPerSignatureArr[329] = new Array(true);
pricedPerSignatureArr[330] = new Array(true);
pricedPerSignatureArr[331] = new Array(true);
pricedPerSignatureArr[332] = new Array(true);
pricedPerSignatureArr[333] = new Array(true);
pricedPerSignatureArr[334] = new Array(true);
pricedPerSignatureArr[335] = new Array(true);
pricedPerSignatureArr[336] = new Array(true);
pricedPerSignatureArr[337] = new Array(true);
pricedPerSignatureArr[338] = new Array(true);
pricedPerSignatureArr[339] = new Array(true);
pricedPerSignatureArr[340] = new Array(true);
pricedPerSignatureArr[341] = new Array(true);
pricedPerSignatureArr[342] = new Array(true);
pricedPerSignatureArr[343] = new Array(true);
pricedPerSignatureArr[344] = new Array(true);
pricedPerSignatureArr[345] = new Array(true);
pricedPerSignatureArr[346] = new Array(true);
pricedPerSignatureArr[347] = new Array(true);
pricedPerSignatureArr[348] = new Array(true);
pricedPerSignatureArr[349] = new Array(true);
pricedPerSignatureArr[350] = new Array(true);
pricedPerSignatureArr[351] = new Array(true);
pricedPerSignatureArr[352] = new Array(true);
pricedPerSignatureArr[353] = new Array(true);
pricedPerSignatureArr[354] = new Array(true);
pricedPerSignatureArr[355] = new Array(true);
pricedPerSignatureArr[356] = new Array(true);
pricedPerSignatureArr[357] = new Array(true);
pricedPerSignatureArr[358] = new Array(true);
pricedPerSignatureArr[359] = new Array(true);
pricedPerSignatureArr[360] = new Array(true);
pricedPerSignatureArr[361] = new Array(true);
pricedPerSignatureArr[363] = new Array(true);
pricedPerSignatureArr[368] = new Array(true);
pricedPerSignatureArr[369] = new Array(true);
pricedPerSignatureArr[372] = new Array(true);
pricedPerSignatureArr[373] = new Array(true);
pricedPerSignatureArr[381] = new Array(true);
pricedPerSignatureArr[383] = new Array(true);
pricedPerSignatureArr[385] = new Array(true);
pricedPerSignatureArr[386] = new Array(true);
pricedPerSignatureArr[387] = new Array(true);
pricedPerSignatureArr[388] = new Array(true);
pricedPerSignatureArr[389] = new Array(true);
pricedPerSignatureArr[390] = new Array(true);
pricedPerSignatureArr[401] = new Array(true);
pricedPerSignatureArr[402] = new Array(true);
pricedPerSignatureArr[403] = new Array(true);
pricedPerSignatureArr[404] = new Array(true);
pricedPerSignatureArr[415] = new Array(true);
pricedPerSignatureArr[417] = new Array(true);
pricedPerSignatureArr[418] = new Array(true);
pricedPerSignatureArr[419] = new Array(true);
pricedPerSignatureArr[420] = new Array(true);
pricedPerSignatureArr[421] = new Array(true);
pricedPerSignatureArr[422] = new Array(true);
pricedPerSignatureArr[423] = new Array(true);
pricedPerSignatureArr[424] = new Array(true);
pricedPerSignatureArr[425] = new Array(true);
pricedPerSignatureArr[426] = new Array(true);
pricedPerSignatureArr[427] = new Array(true);
pricedPerSignatureArr[428] = new Array(true);
pricedPerSignatureArr[429] = new Array(true);
pricedPerSignatureArr[430] = new Array(true);
pricedPerSignatureArr[431] = new Array(true);
pricedPerSignatureArr[432] = new Array(true);
pricedPerSignatureArr[433] = new Array(true);
pricedPerSignatureArr[434] = new Array(true);
pricedPerSignatureArr[435] = new Array(true);
pricedPerSignatureArr[436] = new Array(true);
pricedPerSignatureArr[437] = new Array(true);
pricedPerSignatureArr[438] = new Array(true);
pricedPerSignatureArr[439] = new Array(true);
pricedPerSignatureArr[440] = new Array(true);
pricedPerSignatureArr[441] = new Array(true);
pricedPerSignatureArr[442] = new Array(true);
pricedPerSignatureArr[444] = new Array(true);
pricedPerSignatureArr[445] = new Array(true);
pricedPerSignatureArr[446] = new Array(true);
pricedPerSignatureArr[447] = new Array(true);
pricedPerSignatureArr[448] = new Array(true);
pricedPerSignatureArr[449] = new Array(true);
pricedPerSignatureArr[450] = new Array(true);
pricedPerSignatureArr[451] = new Array(true);
pricedPerSignatureArr[452] = new Array(true);
pricedPerSignatureArr[453] = new Array(true);
pricedPerSignatureArr[454] = new Array(true);
pricedPerSignatureArr[455] = new Array(true);
productInfoArr[116] = new Array(25, 6.5, 18.5, 12, '');
productInfoArr[9] = new Array(250, 8.5, 11, 9, '');
productInfoArr[3] = new Array(250, 11, 17, 9, '');
productInfoArr[85] = new Array(500, 8.5, 4.25, '', '');
productInfoArr[10] = new Array(250, 8.5, 14, 9, '');
productInfoArr[20] = new Array(50, 11.5, 18, 12, '');
productInfoArr[16] = new Array(50, 17, 24, 12, '');
productInfoArr[56] = new Array(250, 11, 25.5, 9, '');
productInfoArr[65] = new Array(250, 8.5, 11, '9,9', 2);
productInfoArr[66] = new Array(250, 11, 17, '9,9', 1);
productInfoArr[117] = new Array(250, 5.5, 8.5, 284, '');
productInfoArr[118] = new Array(250, 8.5, 11, 284, '');
productInfoArr[119] = new Array(250, 8.5, 14, 284, '');
productInfoArr[59] = new Array(500, 2, 6, 43, '');
productInfoArr[60] = new Array(500, 2, 7, 43, '');
productInfoArr[13] = new Array(500, 3.5, 2, 43, '');
productInfoArr[68] = new Array(500, 4.25, 11, 12, '');
productInfoArr[69] = new Array(500, 3.5, 8.5, 12, '');
productInfoArr[15] = new Array(250, 7, 10, 44, '');
productInfoArr[71] = new Array(250, 5.5, 8.5, 44, '');
productInfoArr[84] = new Array(500, 3, 5, '', '');
productInfoArr[5] = new Array(500, 4, 6, 43, '');
productInfoArr[8] = new Array(500, 5, 7, 43, '');
productInfoArr[7] = new Array(500, 5.5, 8.5, 43, '');
productInfoArr[57] = new Array(500, 4.25, 5.5, 43, '');
productInfoArr[70] = new Array(500, 6, 9, 43, '');
productInfoArr[81] = new Array(500, 6, 11, 43, '');
productInfoArr[19] = new Array(500, 4, 9, 43, '');
productInfoArr[99] = new Array(250, 3.5, 2, 43, '');
productInfoArr[11] = new Array(250, 11, 17, '9,9', 1);
productInfoArr[6] = new Array(250, 8.5, 11, '9,9', 2);
productInfoArr[87] = new Array(25, 18, 16, '', '');
productInfoArr[14] = new Array(250, 15.35, 4.724, 12, '');
productInfoArr[34] = new Array(500, '', '', '', 1);
productInfoArr[112] = new Array(1, '', '', '', '');
productInfoArr[113] = new Array(1, '', '', '', '');
productInfoArr[114] = new Array(1, '', '', '', '');
productInfoArr[115] = new Array(1, '', '', '', '');
productInfoArr[100] = new Array(1, 3.5, 2.5, '', '');
productInfoArr[101] = new Array(1, 4, 6, '', '');
productInfoArr[102] = new Array(1, 3.5, 8.5, '', '');
productInfoArr[103] = new Array(1, 5.5, 8.5, '', '');
productInfoArr[104] = new Array(1, 7, 10, '', '');
productInfoArr[105] = new Array(1, 8.5, 11, '', '');
productInfoArr[106] = new Array(1, 11, 17, '', '');
productInfoArr[107] = new Array(1, 12, 18, '', '');
productInfoArr[108] = new Array(1, 38, 38, '', '');
productInfoArr[109] = new Array(1, 38, 38, '', '');
productInfoArr[110] = new Array(1, 68, 68, '', '');
productInfoArr[111] = new Array(1, '', '', '', '');
productInfoArr[86] = new Array(500, 4.5, 11, '', '');
productInfoArr[67] = new Array(500, 18, 11.625, 43, '');
productInfoArr[93] = new Array(100, 5.5, 8.5, '', '');
productInfoArr[92] = new Array(100, 7, 10, '', '');
productInfoArr[91] = new Array(250, 5.5, 8.5, '', '');
productInfoArr[90] = new Array(250, 7, 10, '', '');
productInfoArr[97] = new Array(1, 22, 30, 287, '');
productInfoArr[98] = new Array(1, 28, 38, 287, '');
productInfoArr[95] = new Array(250, 7, 12, '', '');
productInfoArr[12] = new Array(250, 8.5, 11, 10, '');
productInfoArr[4] = new Array(250, 11, 17, 10, '');
productInfoArr[94] = new Array(250, 11, 25.5, 10, '');
productInfoArr[120] = new Array(250, 4.25, 5.5, 9, '');
productInfoArr[121] = new Array(250, 5.5, 8.5, 9, '');
productInfoArr[96] = new Array(250, 8.5, 11, 9, '');
productInfoArr[52] = new Array(500, 18, 16, 43, '');
productInfoArr[72] = new Array(500, 3.5, 8.5, 9, '');
productInfoArr[73] = new Array(500, 7, 8.5, 9, '');
productInfoArr[74] = new Array(500, 10.5, 8.5, 9, '');
productInfoArr[75] = new Array(500, 5.5, 8.5, 9, '');
productInfoArr[76] = new Array(500, 3.5, 7, 9, '');
productInfoArr[77] = new Array(500, 7, 7, 9, '');
productInfoArr[78] = new Array(500, 10.5, 7, 9, '');
productInfoArr[43] = new Array(250, 9.5, 9, 10, '');
productInfoArr[88] = new Array(250, 8.5, 14, '', '');
productInfoArr[18] = new Array(250, 17.5, 11, 10, '');
productInfoArr[17] = new Array(250, 8.5, 11, 10, '');
productInfoArr[61] = new Array(500, 18, 12, 278, '');
productInfoArr[62] = new Array(500, 19, 12.625, 278, '');
productInfoArr[89] = new Array(500, 9.5, 9, '', '');
shippingWeightArr['0.0014'] = new Array(7, 0.000666);
shippingWeightArr['0.002'] = new Array(7, 0.001);
shippingWeightArr['0.0025'] = new Array(7, 0.0015);
shippingWeightArr['0.003'] = new Array(7, 0.002);
shippingWeightArr['0.005'] = new Array(7, 0.003);
shippingWeightArr['0.007'] = new Array(7, 0.004);
shippingWeightArr['0.009'] = new Array(7, 0.005);
shippingWeightArr['0.011'] = new Array(7.5, 0.006);
shippingWeightArr['0.015'] = new Array(8, 0.009);
shippingWeightArr['0.02'] = new Array(8.5, 0.012);
shippingWeightArr['0.025'] = new Array(9, 0.015);
shippingWeightArr['0.025315'] = new Array(9.5, 0.018);
shippingWeightArr['0.025316'] = new Array(10, 0.14);
shippingWeightArr['0.03'] = new Array(9.5, 0.018);
shippingWeightArr['0.035'] = new Array(10, 0.021);
shippingWeightArr['0.04'] = new Array(10.5, 0.024);
shippingWeightArr['0.045'] = new Array(11, 0.027);
shippingWeightArr['0.05'] = new Array(11.5, 0.03);
shippingWeightArr['0.055'] = new Array(12, 0.033);
shippingWeightArr['0.06'] = new Array(12.5, 0.036);
shippingWeightArr['0.065'] = new Array(13, 0.043);
shippingWeightArr['0.07'] = new Array(13.5, 0.046);
shippingWeightArr['0.075'] = new Array(14, 0.049);
shippingWeightArr['0.08'] = new Array(14.5, 0.052);
shippingWeightArr['0.085'] = new Array(15, 0.055);
shippingWeightArr['0.09'] = new Array(15.5, 0.058);
shippingWeightArr['0.095'] = new Array(16, 0.061);
shippingWeightArr['0.1'] = new Array(16.5, 0.064);
shippingWeightArr['0.105'] = new Array(17, 0.067);
shippingWeightArr['0.11'] = new Array(17.5, 0.07);
shippingWeightArr['0.115'] = new Array(18, 0.073);
shippingWeightArr['0.12'] = new Array(18.5, 0.076);
shippingWeightArr['0.125'] = new Array(19, 0.079);
shippingWeightArr['0.13'] = new Array(19.5, 0.082);
shippingWeightArr['0.135'] = new Array(20, 0.085);
shippingWeightArr['0.14'] = new Array(20.5, 0.088);
shippingWeightArr['0.145'] = new Array(21, 0.091);
shippingWeightArr['0.15'] = new Array(21.5, 0.094);
shippingWeightArr['0.155'] = new Array(22, 0.097);
shippingWeightArr['0.16'] = new Array(22.5, 0.1);
shippingWeightArr['0.165'] = new Array(23, 0.103);
shippingWeightArr['0.17'] = new Array(23.5, 0.106);
shippingWeightArr['0.175'] = new Array(24, 0.109);
shippingWeightArr['0.18'] = new Array(24.5, 0.112);
shippingWeightArr['0.185'] = new Array(25, 0.115);
shippingWeightArr['0.19'] = new Array(25.5, 0.118);
shippingWeightArr['0.195'] = new Array(26, 0.121);
shippingWeightArr['0.2'] = new Array(26.5, 0.124);
shippingWeightArr['0.21'] = new Array(27.5, 0.13);
shippingWeightArr['0.22'] = new Array(28.5, 0.136);
shippingWeightArr['0.23'] = new Array(29.5, 0.142);
shippingWeightArr['0.24'] = new Array(30.5, 0.148);
shippingWeightArr['0.25'] = new Array(31.5, 0.154);
shippingWeightArr['0.26'] = new Array(32.5, 0.16);
shippingWeightArr['0.27'] = new Array(33.5, 0.166);
shippingWeightArr['0.28'] = new Array(34.5, 0.172);
shippingWeightArr['0.29'] = new Array(35.5, 0.178);
shippingWeightArr['0.3'] = new Array(36.5, 0.184);
shippingWeightArr['0.31'] = new Array(37.5, 0.19);
shippingWeightArr['0.32'] = new Array(38.5, 0.196);
shippingWeightArr['0.33'] = new Array(39.5, 0.202);
shippingWeightArr['0.34'] = new Array(40.5, 0.208);
shippingWeightArr['0.35'] = new Array(41.5, 0.214);
shippingWeightArr['0.36'] = new Array(42.5, 0.22);
shippingWeightArr['0.37'] = new Array(43.5, 0.226);
shippingWeightArr['0.38'] = new Array(44.5, 0.232);
shippingWeightArr['0.39'] = new Array(45.5, 0.238);
shippingWeightArr['0.4'] = new Array(46.5, 0.244);
shippingWeightArr['0.41'] = new Array(47.5, 0.25);
shippingWeightArr['0.42'] = new Array(48.5, 0.256);
shippingWeightArr['0.43'] = new Array(49.5, 0.262);
shippingWeightArr['0.44'] = new Array(50.5, 0.268);
shippingWeightArr['0.45'] = new Array(51.5, 0.274);
shippingWeightArr['0.46'] = new Array(52.5, 0.28);
shippingWeightArr['0.47'] = new Array(53.5, 0.286);
shippingWeightArr['0.48'] = new Array(54.5, 0.292);
shippingWeightArr['0.49'] = new Array(55.5, 0.298);
shippingWeightArr['0.5'] = new Array(56.5, 0.304);
shippingWeightArr['0.51'] = new Array(57.5, 0.31);
shippingWeightArr['0.52'] = new Array(58.5, 0.316);
shippingWeightArr['0.53'] = new Array(59.5, 0.322);
shippingWeightArr['0.54'] = new Array(60.5, 0.328);
shippingWeightArr['0.55'] = new Array(61.5, 0.334);
shippingWeightArr['0.56'] = new Array(62.5, 0.34);
shippingWeightArr['0.57'] = new Array(63.5, 0.346);
shippingWeightArr['0.58'] = new Array(64.5, 0.352);
shippingWeightArr['0.59'] = new Array(65.5, 0.358);
shippingWeightArr['0.6'] = new Array(66.5, 0.364);
shippingWeightArr['0.61'] = new Array(67.5, 0.37);
shippingWeightArr['0.62'] = new Array(68.5, 0.376);
shippingWeightArr['0.63'] = new Array(69.5, 0.382);
shippingWeightArr['0.64'] = new Array(70.5, 0.388);
shippingWeightArr['0.65'] = new Array(71.5, 0.394);
shippingWeightArr['0.7'] = new Array(31.95, 3);
shippingWeightArr['1.5'] = new Array(34.95, 3);
if(typeof(shipTypeArr['CPU']) == 'undefined') shipTypeArr['CPU'] = new Array();
shipTypeArr['CPU'][''] = new Array(6, 0.4, '');
if(typeof(shipTypeArr['DIS']) == 'undefined') shipTypeArr['DIS'] = new Array();
shipTypeArr['DIS'][''] = new Array(30, 0, '');
if(typeof(shipTypeArr['FDX2DA']) == 'undefined') shipTypeArr['FDX2DA'] = new Array();
shipTypeArr['FDX2DA'][''] = new Array(3, 4.5, '');
shipTypeArr['FDX2DA'][59] = new Array(14, 4, 2);
shipTypeArr['FDX2DA'][60] = new Array(17, 4, 2);
shipTypeArr['FDX2DA'][13] = new Array(8, 4, 2);
shipTypeArr['FDX2DA'][99] = new Array(45, 4, 2);
shipTypeArr['FDX2DA'][67] = new Array(187, 3.75, 4);
shipTypeArr['FDX2DA'][52] = new Array(183, 3, 4);
shipTypeArr['FDX2DA'][83] = new Array(37, 4, 2);
shipTypeArr['FDX2DA'][82] = new Array(32, 4, 2);
if(typeof(shipTypeArr['FDX3DA']) == 'undefined') shipTypeArr['FDX3DA'] = new Array();
shipTypeArr['FDX3DA'][''] = new Array(2, 3, '');
shipTypeArr['FDX3DA'][59] = new Array(13, 2.5, 2);
shipTypeArr['FDX3DA'][60] = new Array(16, 2.5, 2);
shipTypeArr['FDX3DA'][13] = new Array(7, 2.5, 2);
shipTypeArr['FDX3DA'][99] = new Array(44, 2.5, 2);
shipTypeArr['FDX3DA'][67] = new Array(186, 2.6, 4);
shipTypeArr['FDX3DA'][52] = new Array(182, 2, 4);
shipTypeArr['FDX3DA'][83] = new Array(36, 2.5, 2);
shipTypeArr['FDX3DA'][82] = new Array(31, 2.5, 2);
if(typeof(shipTypeArr['FDXG']) == 'undefined') shipTypeArr['FDXG'] = new Array();
shipTypeArr['FDXG'][''] = new Array(1, 1, '');
shipTypeArr['FDXG'][67] = new Array(185, 0.85, 4);
shipTypeArr['FDXG'][52] = new Array(181, 0.7, 4);
if(typeof(shipTypeArr['FDXIE']) == 'undefined') shipTypeArr['FDXIE'] = new Array();
shipTypeArr['FDXIE'][''] = new Array(42, 2.25, '');
if(typeof(shipTypeArr['FDXIG']) == 'undefined') shipTypeArr['FDXIG'] = new Array();
shipTypeArr['FDXIG'][''] = new Array(41, 1.67, '');
if(typeof(shipTypeArr['FDXIP']) == 'undefined') shipTypeArr['FDXIP'] = new Array();
shipTypeArr['FDXIP'][''] = new Array(43, 3.34, '');
if(typeof(shipTypeArr['FDXNDA']) == 'undefined') shipTypeArr['FDXNDA'] = new Array();
shipTypeArr['FDXNDA'][''] = new Array(4, 6.5, '');
shipTypeArr['FDXNDA'][59] = new Array(15, 5, 2);
shipTypeArr['FDXNDA'][60] = new Array(18, 5, 2);
shipTypeArr['FDXNDA'][13] = new Array(9, 5, 2);
shipTypeArr['FDXNDA'][99] = new Array(46, 5, 2);
shipTypeArr['FDXNDA'][67] = new Array(188, 5.5, 4);
shipTypeArr['FDXNDA'][52] = new Array(184, 4.5, 4);
shipTypeArr['FDXNDA'][83] = new Array(38, 5, 2);
shipTypeArr['FDXNDA'][82] = new Array(33, 5, 2);
if(typeof(shipTypeArr['FDXNDP']) == 'undefined') shipTypeArr['FDXNDP'] = new Array();
shipTypeArr['FDXNDP'][''] = new Array(26, 7.15, '');
shipTypeArr['FDXNDP'][59] = new Array(28, 5.5, 2);
shipTypeArr['FDXNDP'][60] = new Array(29, 5.5, 2);
shipTypeArr['FDXNDP'][13] = new Array(27, 5.5, 2);
shipTypeArr['FDXNDP'][99] = new Array(48, 5.5, 2);
shipTypeArr['FDXNDP'][83] = new Array(40, 5.5, 2);
shipTypeArr['FDXNDP'][82] = new Array(35, 5.5, 2);
if(typeof(shipTypeArr['FDXS']) == 'undefined') shipTypeArr['FDXS'] = new Array();
shipTypeArr['FDXS'][''] = new Array(19, 7.8, '');
shipTypeArr['FDXS'][59] = new Array(11, 6, 2);
shipTypeArr['FDXS'][60] = new Array(12, 6, 2);
shipTypeArr['FDXS'][13] = new Array(10, 6, 2);
shipTypeArr['FDXS'][99] = new Array(47, 6, 2);
shipTypeArr['FDXS'][83] = new Array(39, 6, 2);
shipTypeArr['FDXS'][82] = new Array(34, 6, 2);
if(typeof(shipTypeArr['SDD']) == 'undefined') shipTypeArr['SDD'] = new Array();
shipTypeArr['SDD'][''] = new Array(5, 1, '');

function PricingPercent(percentType, percent) {
this.percentType = percentType;
this.percent = percent;
}

PricingPercent.prototype.ApplyPricingPercent = function(price) {
switch (this.percentType)
{
case PricingPercentTypeEnum.Channel:
return this.ApplyPercent(price);
case PricingPercentTypeEnum.Markup:
return this.ApplyMarkupPercent(price);
case PricingPercentTypeEnum.MultiVersion:
return this.ApplyPercent(price);
default:
return price;
}
};

PricingPercent.prototype.ApplyPercent = function(price) {
return price * this.percent;
};

PricingPercent.prototype.ApplyMarkupPercent = function(price) {
if (this.percent != 0) {
price *= (1 + this.percent);
}
return price;
};/// <reference path="PricingPercent.js" />

function PricingPercentCollection(percentCollection) {
this.percentCollection = percentCollection;
this.canApplyChannel = false;
this.canApplyMarkup = false;
this.canApplyMultiVersion = false;
}

PricingPercentCollection.prototype.ApplyPricingPercents = function(price) {
if (this.canApplyMultiVersion) {
price = this.ApplyPricingPercent(price, PricingPercentTypeEnum.MultiVersion);
}
if (this.canApplyChannel) {
price = this.ApplyPricingPercent(price, PricingPercentTypeEnum.Channel);
}
if (this.canApplyMarkup) {
price = this.ApplyPricingPercent(price, PricingPercentTypeEnum.Markup);
}
return FormatDollar(price);
};

PricingPercentCollection.prototype.ApplyPricingPercent = function(price, percentType) {
if (this.percentCollection != null) {
for(var i = 0, loopCnt = this.percentCollection.length; i < loopCnt; i++) {
 //for(var pricingPercent in this.percentCollection) {
 if (this.percentCollection[i].percentType == percentType)
 {
 price = this.percentCollection[i].ApplyPricingPercent(price);
 }
 }
 }
return price;
};

PricingPercentCollection.prototype.SetCanApplyPercentVariables = function(adjustType, channelID) {
switch (adjustType) {
case AdjustTypeEnum.Aqueous:
case AdjustTypeEnum.Finishing:
case AdjustTypeEnum.Ink:
case AdjustTypeEnum.Paper:
case AdjustTypeEnum.Product:
case AdjustTypeEnum.Spot:
this.canApplyChannel = true;
this.canApplyMarkup = true;
this.canApplyMultiVersion = true;
break;
case AdjustTypeEnum.Mailing:
case AdjustTypeEnum.Shipping:
this.canApplyChannel = false;
this.canApplyMarkup = (channelID == ChannelIDEnum.OfficeMax);
this.canApplyMultiVersion = false;
break;
case AdjustTypeEnum.Envelope:
case AdjustTypeEnum.SecondSheet:
this.canApplyChannel = true;
this.canApplyMarkup = (channelID == ChannelIDEnum.Mimeo || channelID == ChannelIDEnum.OfficeMax);
this.canApplyMultiVersion = false;
break;
case AdjustTypeEnum.Turnaround:
// Turnaround price is calculated based on printing subtotal, which all percentages were already applied, therefore don't apply any of the percent variables again
this.canApplyChannel = false;
this.canApplyMarkup = false;
this.canApplyMultiVersion = false;
break;
default:
break;
}
};/// <reference path="PartAttribute.js" />
/// <reference path="../../JavaScript/ArrayHelper.js" />

//var Parts;

function Part(partNumber, attributes) {
this.partNumber = partNumber;
this.attributes = attributes;
}

Part.prototype.GetAttributeValueID = function(AttributeID, AttributePlacement) {
 for (var a = 0, loopCnt = this.attributes.length; a < loopCnt; a++) {
if (this.attributes[a].attributeID == AttributeID && (AttributePlacement == null || AttributePlacement == '' || this.attributes[a].attributePlacement == AttributePlacement)){
return this.attributes[a].attributeValueID;
}
}
return null;
};

Part.prototype.Equals = function(partObj) {
//check that both parts have the same number of part attributes
if (this.attributes.length != partObj.attributes.length) {
return false;
}
//sort the part attributes
this.attributes.sort(sortPartAttributes);
partObj.attributes.sort(sortPartAttributes);

//now check that all of the part attributes exist in partObj 
for (var a = 0, loopCnt = this.attributes.length; a < loopCnt; a++) {
if (!this.attributes[a].Equals(partObj.attributes[a])) {
return false;
}
}
return true;
};


// Sorts by attributeValueID and attributePlacement
function sortPartAttributes(a, b) {
if (a.attributeValueID > b.attributeValueID)
{
return 1;
}
else if (a.attributeValueID < b.attributeValueID)
{
return -1;
}
else if (a.attributePlacement > b.attributePlacement)
{
return 1;
}
else if (a.attributePlacement < b.attributePlacement)
{
return -1;
}
return 0;
}function PartAttribute(attributeID, attributeValueID, attributePlacement) {
this.attributeID = attributeID;
this.attributeValueID = attributeValueID;
this.attributePlacement = attributePlacement;
}

PartAttribute.prototype.Equals = function(value, dummy) {
if (typeof(dummy) != 'undefined') {
return (dummy.attributeValueID == value.attributeValueID && dummy.attributePlacement == value.attributePlacement);
}
else {
return (this.attributeValueID == value.attributeValueID && this.attributePlacement == value.attributePlacement);
}
};
/// <reference path="Part.js" />

function Signature(partsPerSignature, parts) {
this.partsPerSignature = partsPerSignature;
this.parts = parts;
}

Signature.prototype.TotalSignatures = function() {
var totalSignatures = 0;
if (this.partsPerSignature > 0) {
totalSignatures = this.parts.length / this.partsPerSignature;
}
return totalSignatures;
};

Signature.prototype.TotalWholeSignatures = function() {
return Math.ceil(this.TotalSignatures());
};

Signature.prototype.TotalSignaturePricingPercent = function() {
var sigPartial = this.TotalSignatures() % 1;
var sigWhole = this.TotalSignatures() - sigPartial;
var sigPricingPercent = GetSignaturePricingPercent(sigPartial);
return sigWhole + sigPricingPercent;
};

Signature.prototype.GetAttributeValueID = function(AttributeID, AttributePlacement) {
return this.parts[0].GetAttributeValueID(AttributeID, AttributePlacement);
};

//ldkfjsdlkfjsdlkfjlsdkfj sdfksdlfkjsl sdkfj flsdjfl
function GetSignaturePricingPercent(signaturePercent) {
if(signaturePercent == 0.5) {
return 0.7;
}
else {
return signaturePercent;
}
}

Signature.prototype.ContainsAttributeValueID = function(attributeValueID, attributePlacement) {
 if (this.parts.length > 0) {
 for (var a = 0, loopCnt = this.parts[0].attributes.length; a < loopCnt; a++) {
 if (this.parts[0].attributes[a].attributeValueID == attributeValueID) {
 if (typeof (attributePlacement) != 'undefined') {
 if (this.parts[0].attributes[a].attributePlacement == attributePlacement) {
 return true;
 }
 }
 else {
 return true;
 }
 }
 }
 return false;
 }
};/// <reference path="Signature.js" />

function CreateSignatureCollection(parts, partsPerSignature) {
var signatures = new Array();
var matchingPartExists = false;
for(var i = 0, loopCnt = parts.length; i < loopCnt; i++)
{
for (var j = 0, loopCnt2 = signatures.length; j < loopCnt2; j++)
{
// Do the parts in this signature have the same attributes as i?
if (typeof(signatures[j].parts) != 'undefined' && typeof(signatures[j].parts[0]) != 'undefined' && parts[i].Equals(signatures[j].parts[0]))
{
// If matched, add the part to this signature.
signatures[j].parts.push(parts[i]);
matchingPartExists = true;
break;
}
}

if (!matchingPartExists)
{
/// Create a new signature, Add the different part to the signature
/// and add the signature to the signature collection.
var partsNew = new Array();
partsNew.push(parts[i]);
var sig = new Signature(partsPerSignature, partsNew);
signatures.push(sig);
}
matchingPartExists = false;
}

return signatures;
}
var IMAGES_DIR = "images";/// <reference path="../../PricingJS/Enums/ProductIDEnum.js" />
/// <reference path="../../PricingJS/Enums/AttributeValueIDEnum.js" />
/// <reference path="../../PricingJS/Enums/AttributeIDEnum.js" />
/// <reference path="../../PricingJS/Enums/NoValueEnum.js" />

// **************************************************************
// This page lives in two locations:
// - local webserver: /CommonWeb/JavaScript/InstPrice/
// - tiera.net webserver: /htdocs/JavaScript/InstaPrice/
// Please distribute in both locations.
// **************************************************************

var url = window.location.href.toUpperCase();
var lHost = window.location.host.toLowerCase();
var isChangeOrderPage = (url.indexOf("CHANGEORDER.ASPX") != -1);

// Determine whether status is PUBLIC, INTERNAL, TRAINING, OR DEVELOPMENT
// DEFAULT IS PUBLIC !!!!!

var DEV01 = url.indexOf("LOCALHOST");
var DEV02 = url.indexOf("COURTNEY");
var DEV03 = url.indexOf("AL-");
var DEV04 = url.indexOf("DENIZ");
var DEV05 = url.indexOf("KATHRYN");
var DEV06 = url.indexOf("MICHAEL");
var DEV07 = url.indexOf("DAVID");
var DEV08 = url.indexOf("MATT");
var DEV09 = url.indexOf("DW-");
var DEV10 = url.indexOf("DWCQ-");
var DEV11 = url.indexOf("JACOB");
var INT01 = url.indexOf("IW-");
var STG01 = url.indexOf("SW-")
var TRN01 = url.indexOf("TW-");
var PROD01 = url.indexOf("PFLNET.NET");
var PROD02 = url.indexOf("PRINTINGFORLESS1.COM");
var PROD03 = url.indexOf("MIMEOPRINTINGCENTER.COM");
var PROD04 = url.indexOf("MYPFL.COM");
var PROD05 = url.indexOf("BART");
var PROD06 = url.indexOf("LISA");
var PROD07 = url.indexOf("192.168.6.214");
var PROD08 = url.indexOf("192.168.6.215");

//Check for Internal framesets
var TrainingFrame = 0;
var OfflineFrame = 0;
for (var i=0;i<parent.frames.length;i++) {
 if (parent.frames[i].name == 'TrainingFrame') {
TrainingFrame = 1;
 }
 if (parent.frames[i].name == 'OfflineFrame') {
OfflineFrame = 1;
 }
 //alert(TrainingFrame);
}
var TrainingDB = url.indexOf("TRAININGDB.PFLNET.NET");
var Internal = url.indexOf("DB.PFLNET.NET");

if ((DEV01 > 0) || (DEV02 > 0) || (DEV03 > 0) || (DEV04 > 0) || (DEV05 > 0) || (DEV06 > 0) || (DEV07 > 0) || (DEV08 > 0) || (DEV09 > 0) || (DEV10 > 0) || (DEV11 > 0)) { var weblocation = "DEVELOPMENT"; }
else if ((INT01 > 0)) { var weblocation = "INTEGRATION"; }
else if ((STG01 > 0)) { var weblocation = "STAGING"; }
else if ((TRN01 > 0)) { var weblocation = "TRAINING"; }
else if ((TrainingFrame > 0) || (TrainingDB > 0)) { var weblocation = "TRAINING"; }
else if (PROD01 > 0 || PROD02 > 0 || PROD03 > 0 || PROD04 > 0 || PROD05 > 0 || PROD06 > 0 || PROD07 > 0 || PROD08 > 0) { var weblocation = "PROD"; }
else { var weblocation = "PUBLIC"; }

function getQuerystring(key, default_){
 if (default_==null) default_="";
 key = key.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
 var regex = new RegExp("[\\?&]"+key+"=([^&#]*)");
 var qs = regex.exec(window.location.href);
 if (qs == null) return default_;
 else return qs[1];
}
var CB = getQuerystring('CB');
var CB = CB.toUpperCase();

//determine site for OfficeMax and DO specific coding
var site;
if (url.indexOf('CHANNEL') != -1 || (isChangeOrderPage && document.price != null && typeof(document.price) != 'undefined' && document.price.channelID.value != '')) { site = "Channel"; }
else if (url.indexOf('DOBCARDS') != -1) { site = "DO"; }
else if (url.indexOf('LOGOWORKS') != -1) { site = "LW"; }
else if (url.indexOf('OFFICEMAX') != -1) { site = "OM"; }
else if (url.indexOf('PDSPRINTINGCENTER') != -1) { site = "PC"; }
else if (url.indexOf('INSTAORDER') != -1) { site = "TO"; }
else if (CB != "") { site = "CB"; }
else { site = "default"; }

var CTIsPlayback=true;
try { //for ClickTail to work when playing back recording (added 11/4/2009 MTM/CB)
 if(!parent || !parent.WebPlayer) // if there is no WebPlayer or if the above frame is not accessible
 throw false;
} 
catch(e) { CTIsPlayback=false; }

if(!CTIsPlayback) {
if ((weblocation == "PUBLIC") && ((site == "default") && !isChangeOrderPage)) {
var protocol = window.location.protocol;
var preferedHost = 'www.printingforless.com';
if (protocol == "http:" || lHost != preferedHost) {
var secureUrl = window.location.href.toLowerCase().replace('http:', 'https:');
secureUrl = secureUrl.replace(lHost, preferedHost);
secureUrl = secureUrl.replace('c/', 'C/');
location.replace(secureUrl); // replace current page in history and redirect
}
}
//added for cobrand system - could be combined with above
if ((weblocation == "PUBLIC") && ((site == "CB") && !isChangeOrderPage)) {
var protocol = window.location.protocol;
var preferedHost = 'www.printingforless.com';
if (protocol == "http:" || lHost != preferedHost) {
var secureUrl = window.location.href.replace('http:', 'https:');
secureUrl = secureUrl.replace(lHost, preferedHost);
location.replace(secureUrl); // replace current page in history and redirect
}
}
}

function buildArray() {
var a = buildArray.arguments;
for (i=0; i<a.length; i++) {
 this[i] = a[i];
}
this.length = a.length;
}
//set prefix for absolute path to other ordering pages for Channel and DO sites
if (site == "Channel") {
var prefix = "http://www.impressprintcenter.com/";
}
else if (site == "DO" || site == "LW") {
var prefix = "https://www.printingforless.com/";
}
else {
var prefix = "";
}

var urls1 = new buildArray(
"",
prefix + "brochureseight.html",
prefix + "brochuresfourteen.html",
prefix + "brochureseleven.html",
prefix + "brochurestwentyfive.html",
prefix + "brochuresposters.html",
prefix + "cardspostcards.html",
prefix + "cardsrackcards.html",
prefix + "cardsbusinesscards.html",
prefix + "cardsgreetingcards.html",
prefix + "cardsbookmarks.html",
prefix + "cardsdoorhangers.html",
prefix + "newsletterseight.html",
prefix + "newsletterseleven.html",
prefix + "newsletterstwentyfive.html",
prefix + "stationeryletterhead.html",
prefix + "stationeryletterheadonly.html",
prefix + "stationeryenvelopesonly.html",
prefix + "stationerylrgenvelopes.html",
prefix + "catalogsfive.html",
prefix + "catalogseight.html",
prefix + "calendars.html",
prefix + "presentationfolders.html",
prefix + "filefolders.html",
prefix + "custompieces.html",
prefix + "statementstuffers.html",
prefix + "cdcovers.html");


function go(which, num, win) {
n = which.selectedIndex;
if (n != 0) {
 var url = eval("urls" + num + "[n]");
if (win) {
openWindow(url);
} else {
if (site == "Channel") {
top.location.href = url;
} else {
location.href = url;
}
}
}
}

function hideLayer(layerid) {
 var layerElement = (document.layers) ? document.layers[layerid] : document.getElementById(layerid);
 layerElement.style.display = "none";
}

function showLayer(layerid) {
 var layerElement = (document.layers) ? document.layers[layerid] : document.getElementById(layerid);
 layerElement.style.display = "";
}

function CopyInfo() {
document.price.SHIPPINGCOMPANYNAME.value = document.price.COMPANYNAME.value;
document.price.SHIPPINGCUSTOMERFIRSTNAME.value = document.price.CUSTOMERFIRSTNAME.value;
document.price.SHIPPINGCUSTOMERLASTNAME.value = document.price.CUSTOMERLASTNAME.value;
document.price.SHIPPINGADDRESS.value = document.price.BILLINGADDRESS.value;
document.price.SHIPPINGADDRESS2.value = document.price.BILLINGADDRESS2.value;
document.price.SHIPPINGCITY.value = document.price.BILLINGCITY.value;
document.price.SHIPPINGSTATE.selectedIndex = document.price.BILLINGSTATE.selectedIndex;
document.price.SHIPPINGZIPCODE.value = document.price.BILLINGZIPCODE.value;
document.price.SHIPPINGCOUNTRY.selectedIndex = document.price.BILLINGCOUNTRY.selectedIndex;
document.price.SHIPPINGAREACODE.value = document.price.BILLINGAREACODE.value;
document.price.SHIPPINGPHONENUMBER.value = document.price.BILLINGPHONENUMBER.value;
if (document.price.SHIPPINGCOUNTRY.selectedIndex != 0) {
 alert('Quoted Shipping prices are only valid for addresses in the USA.\n\nPlease contact customer service for shipping prices to other countries.');
} 
}

function LWCopyInfo() {
document.price.SHIPPINGCOMPANYNAME.value = document.price.ChannelCustomerCompany.value;
document.price.SHIPPINGCUSTOMERFIRSTNAME.value = document.price.ChannelCustomerFirstName.value;
document.price.SHIPPINGCUSTOMERLASTNAME.value = document.price.ChannelCustomerLastName.value;
document.price.SHIPPINGAREACODE.value = document.price.ChannelCustomerAreaCode.value;
document.price.SHIPPINGPHONENUMBER.value = document.price.ChannelCustomerPhone.value;
if (document.price.SHIPPINGCOUNTRY.selectedIndex != 0) {
 alert('Quoted Shipping prices are only valid for addresses in the USA.\n\nPlease contact customer service for shipping prices to other countries.');
} 
}

var markupArray = new Array();
for (var i = 0; i < 100; i++) {
markupArray[i] = new Array(0.3, 0.4, 0.5, 0, 0.1, 0.2);
}
//-----------------------------------------------------------------------------
function MakeCents(value) {
var valueWithCorrectDecimalPosition = value / 100;
return FormatFractionalNumber(valueWithCorrectDecimalPosition, 2);
} 

function FormatFractionalNumber(num, decimalPlaces) {
var powerOfTen = Math.pow(10, decimalPlaces);
var stringNum = (Math.round(num * powerOfTen) / powerOfTen).toString();
var posDecimal = stringNum.indexOf(".");
var zeroToAppendCnt = 0;
if (posDecimal < 0) {
stringNum += ".";
zeroToAppendCnt = decimalPlaces;
} else {
zeroToAppendCnt = decimalPlaces - (stringNum.length - posDecimal - 1);
}
for (var i = 0; i < zeroToAppendCnt; i++) {
stringNum += "0";
}
return stringNum;
}

//-----------------------------------------------------------------------------
// added 8/30/2002 cmb
function checkFileTransfer() {
if (document.price.file1.value !="" || document.price.file2.value !="" || document.price.file3.value !="" || document.price.file4.value !="") {
alert("You have selected a file to upload. You must choose 'Select the File(s) to Upload from Your Computer' as your File Transfter Method");
document.price.filetransfer[0].checked=true;
}
}

//-----------------------------------------------------------------------------
// added 1/14/2004 mtm
// updated 7/8/2004 cmb
// updated and revised 4/29/2005 kar

function CheckCoupon() {
var customerGroup = document.price.CUSTOMER;
var theCoupon = document.price.ctl00$PricingPlaceHolder1$ProductPricing1$txtCouponCode.value.toUpperCase();
var MailingServices = document.price.mailingPrice.value;

//remove leading or trailing whitespace
theCoupon.replace(/^\s*/, '').replace(/\s*$/, ''); 

// NC coupons are only for new customers
if (customerGroup[1].checked && (theCoupon.substring(0, 2) == "NC" || (site == "CB" && GetCBInfo().CouponFirstTimeCustomerOnly))) {
 alert('The coupon you have entered is only valid for new customers.');
 document.price.ctl00$PricingPlaceHolder1$ProductPricing1$txtCouponCode.value = "";
 if (site == "CB") {
 if (GetCBInfo().CouponFirstTimeCustomerOnly) {
 EmptyCoupon();
 return (false);
 }
 else {
 SetCobrandCoupon();
 }
 } 
 return (false);
}
else if (site == "CB" && theCoupon.length != 0) {
//first check for product specific cobrand coupons
if (site == "CB" && (document.price.productTypeInt.value != 13 && (theCoupon == "BFBC" || theCoupon == "BFFBC40" || theCoupon == "VISABUSINESS"))) {
EmptyCoupon();
return (false);
}
if (site == "CB" && document.price.productTypeInt.value != 13 != 99 && theCoupon == "BLSRFBC") {
EmptyCoupon()
return (false);
}
if (theCoupon == GetCBInfo().CouponCode) {
 SetCobrandCoupon();
 }
 else if (theCoupon == "NC20PN" || theCoupon == "NC20PB" || theCoupon == "NC20PC") {
 SetCoupon(theCoupon, 0, .2, 0);
 }
 else if (document.price.productTypeInt.value == 52 && theCoupon == "NC100PF") {
 SetCoupon(theCoupon, 100, 0, 0);
 } 
}
else if ((theCoupon.length != 0) && (theCoupon.indexOf("RP1") >= 0)) {
 alert('The coupon you entered in the Promotional Code field is a Referral Code. Please enter this code in the Referral Code field.');
 return (false);
}
else if (!(isValidCoupon(theCoupon))) {
 alert('The Promotional Code field contains an invalid character.');
 return (false);
}
}

function CheckReferralCode() {

var theRefCoupon = document.price.REFCOUPON.value.toUpperCase();
var customerGroup = document.price.CUSTOMER;

//remove leading or trailing whitespace
theRefCoupon.replace(/^\s*/, '').replace(/\s*$/, ''); 

if ((theRefCoupon.length!=0) && ((theRefCoupon.indexOf("RP1") < 0) && (theRefCoupon.indexOf("RP5") < 0))) {
alert('The coupon you entered in the Referral Code field is a Promotional Code. Please enter this code in the Promotional Code field.');
return (false);
} else if ((theRefCoupon.length!=0) && (theRefCoupon.indexOf("RP1") < 0) && (customerGroup[1].checked)) {
alert('The coupon you have entered is only valid for new customers.');
return (false);
} else if (theRefCoupon.length > 9) {
alert('Only one coupon is allowed in the Referral Code field. Place all other referral code coupons in the Special instructions textbox.');
return (false);
} else if (!(isValidCoupon(theRefCoupon))) {
alert('The Referral Code field contains an invalid character.');
return (false);
}
}

function ChangeMarkupCQ() { //Channel only
var totalPrice;
var wholesaleprice;
var index;
var markupInt, markup, markupPrice;

 for (var i=0; i<document.price.ChannelMarkupPercent.length; i++) {
 if (document.price.ChannelMarkupPercent[i].checked) {
index = i;
 }
 }
markupInt = document.price.ChannelMarkupPercent[index].value;
markup = (markupArray[producttype][markupInt]);

document.price.QUOTEPRICE.value = strip(',',document.price.QUOTEPRICE.value);
wholesaleprice = document.price.QUOTEPRICE.value;

if (((wholesaleprice / wholesaleprice) != 1) && (wholesaleprice != 0)) { 
alert('Please enter currency only');
document.price.QUOTEPRICE.focus();
//exit;
} else {
if (wholesaleprice != "") {
totalPrice = document.price.QUOTEPRICE.value * (markup + 1) * 100;
markupPrice = document.price.QUOTEPRICE.value * markup * 100;
document.price.totalPrice.value = MakeCents( Math.round( totalPrice ) );
document.price.markupPrice.value = MakeCents( Math.round( markupPrice ) );
}
}
}

function shippingValidate() {
 //alert("shippingValidate");

 if(document.price.SHIPPINGCUSTOMERFIRSTNAME.value =="") {
 alert("Please type in your first name (Shipping)");
 document.price.SHIPPINGCUSTOMERFIRSTNAME.focus();
 return (false);
 } else if(document.price.SHIPPINGCUSTOMERLASTNAME.value =="") {
 alert("Please type in your last name (Shipping)");
 document.price.SHIPPINGCUSTOMERLASTNAME.focus();
 return (false);
 } else if(document.price.SHIPPINGADDRESS.value =="") {
 alert("Please type in your address (Shipping)");
 document.price.SHIPPINGADDRESS.focus();
 return (false);
 } else if(document.price.SHIPPINGCITY.value =="") {
 alert("Please type in your city (Shipping)");
 document.price.SHIPPINGCITY.focus();
 return (false);
 } else if(document.price.SHIPPINGSTATE.value =="") {
 alert("Please indicate in your state (Shipping)");
 document.price.SHIPPINGSTATE.focus();
 return (false);
 } else if(document.price.SHIPPINGZIPCODE.value =="") {
 alert("Please type in your zipcode (Shipping)");
 document.price.SHIPPINGZIPCODE.focus();
 return (false);
 } else if (document.price.SHIPPINGCOUNTRY.selectedIndex != 0) {
 alert('Quoted Shipping prices are only valid for addresses in the USA.\n\nPlease contact customer service for shipping prices to other countries.');
 } else if(document.price.SHIPPINGAREACODE.value =="") {
 alert("Please type in your area code (Shipping)");
 document.price.SHIPPINGAREACODE.focus();
 return (false);
 } else if(document.price.SHIPPINGPHONENUMBER.value =="") {
 alert("Please type in your phonenumber (Shipping)");
 document.price.SHIPPINGPHONENUMBER.focus();
 return (false);
 } else if (document.price.shiptype && (document.price.shiptype.value == 'FDXG' || document.price.shiptype.value == 'FDX3DA') &&
 (document.price.SHIPPINGSTATE.value == "HI" || document.price.SHIPPINGSTATE.value == "AK" ||
 document.price.SHIPPINGSTATE.value == "PR" || document.price.SHIPPINGSTATE.value == "VI")) {
 alert('Air Shipping is required for Alaska, Hawaii, Puerto Rico or the Virgin Islands');
 return (false);
 } 
 return (true);
}

function customOrderValidate() {

 //alert("customOrderValidate");

 if(document.price.QUOTENUMBER.value ==""){
 alert("Please enter your quote number");
 document.price.QUOTENUMBER.focus();
 return (false);
 } else if (document.price.QUOTENUMBER.value != "") { 
 //quote number has been entered
 //check for validity of quote number
 var theString;
 theString = document.price.QUOTENUMBER.value;

 if (!(isNumberString(theString))) {
 alert("Please enter Custom Quote Number with numbers only.");
 document.price.QUOTENUMBER.focus();
 return (false);
 }
 }

 document.price.QQUANTITY.value = strip(',',document.price.QQUANTITY.value);
 var quotequantity = document.price.QQUANTITY.value;
 if(quotequantity ==""){
 alert("Please enter a quantity");
 document.price.QQUANTITY.focus();
 return (false);
 } else if (!(isNumberString(quotequantity))) {
 alert("Please enter an amount (no commas).");
 document.price.QQUANTITY.focus();
 return (false);
 }
 document.price.QUOTEPRICE.value = strip(',',document.price.QUOTEPRICE.value);
 var quoteprice = document.price.QUOTEPRICE.value;
 if(quoteprice ==""){
 alert("Please type in your quoted price");
 return (false);
 } else if (!(isCurrency(quoteprice))) {
 alert("Please supply currency for the price");
 return (false);
 } else if (site == "Channel") {
 var wholesaleprice = document.price.QUOTEPRICE.value;
 var markupButton = document.price.ChannelMarkupPercent;
 if (((wholesaleprice / wholesaleprice) != 1) && (wholesaleprice != 0)) {
 alert('Please enter the price without a dollar sign.');
 document.price.QUOTEPRICE.focus();
 return (false);
 } else if (!(markupButton[0].checked || markupButton[1].checked || markupButton[2].checked)){
 alert("Please choose a markup level.");
 return (false);
 }
 }
 return (true);
}

function logoWorksCustomerValidate() {

 //alert("logoWorksCustomerValidate");

if(document.price.CUSTOMERFIRSTNAME.options[document.price.CUSTOMERFIRSTNAME.selectedIndex].value =="") {
 alert("Please select your first name");
 document.price.CUSTOMERFIRSTNAME.focus();
 return (false);
} else if (document.price.ChannelOrderNumber.value == "") {
alert("Please type in the LogoWorks Reference #");
document.price.ChannelOrderNumber.focus();
return (false);
 } else if (document.price.ChannelCustomerCompany.value == "") {
alert("Please type in the LogoWorks Customer Company");
document.price.ChannelCustomerCompany.focus();
return (false);
} else if (document.price.ChannelCustomerFirstName.value == "") {
alert("Please type in the LogoWorks Customer First Name");
document.price.ChannelCustomerFirstName.focus();
return (false);
} else if (document.price.ChannelCustomerLastName.value == "") {
alert("Please type in the LogoWorks Customer Last Name");
document.price.ChannelCustomerLastName.focus();
return (false);
} else if (document.price.ChannelCustomerEmail.value == "") {
alert("Please type in the LogoWorks Customer Email");
document.price.ChannelCustomerEmail.focus();
return (false);
} else if (document.price.ChannelCustomerAreaCode.value == "") {
alert("Please type in the LogoWorks Customer Area Code");
document.price.ChannelCustomerAreaCode.focus();
return (false);
} else if (document.price.ChannelCustomerPhone.value == "") {
alert("Please type in the LogoWorks Customer Phone");
document.price.ChannelCustomerPhone.focus();
return (false);
} else if(document.price.CUSTOMERFIRSTNAME.value == "") {
alert("Please type in your first name");
document.price.CUSTOMERFIRSTNAME.focus();
return (false);
}
return (true);
}

function channelCustomerValidate() {

 //alert("channelCustomerValidate");

if(document.price.ChannelCustomer.value =="") {
alert("Please type in the OfficeMax Customer Name");
document.price.ChannelCustomer.focus();
return (false);
} else if(document.price.PROJECTNAME.value =="") {
 alert("Please type in the Name of the Project");
 document.price.PROJECTNAME.focus();
 return (false);
 } else if(document.price.ChannelStore.value =="") {
alert("Please type in your OfficeMax Store #");
document.price.ChannelStore.focus();
return (false);
} else if(document.price.channel.value == "false"){
alert("Please enter a valid OfficeMax Store #");
document.price.ChannelStore.focus();
return (false);
} else if(document.price.CUSTOMERFIRSTNAME.value =="") {
 alert("Please type in your first name");
 document.price.CUSTOMERFIRSTNAME.focus();
 return (false);
 } else if(document.price.CUSTOMERLASTNAME.value =="") {
 alert("Please type in your last name");
 document.price.CUSTOMERLASTNAME.focus();
 return (false);
 }
 return (true);
}

function standardCustomerValidate(customerIDvalidate) {

 //alert("standardCustomerValidate");
 //this function is not called for LogoWorks
 
 if (!(customerIDvalidate)) { //there is a valid Customer Account Number
 var customerGroup = document.price.CUSTOMER;
 if (!(customerGroup[0].checked || customerGroup[1].checked)) {
 alert("Please indicate your customer status.");
 document.price.CUSTOMER[0].focus();
 return (false);
 }
} // end customerIDvalidate

 if(document.price.CUSTOMERFIRSTNAME.value =="") {
 alert("Please type in your first name");
 document.price.CUSTOMERFIRSTNAME.focus();
 return (false);
 } else if(document.price.CUSTOMERLASTNAME.value =="") {
 alert("Please type in your last name");
 document.price.CUSTOMERLASTNAME.focus();
 return (false);
 } 
 
 if (!(customerIDvalidate)) {
 //Issue #784: 09/07/2006 - KR
 //if customer account number is supplied - do not require billing phone
 if (document.price.BILLINGAREACODE.value =="") {
 alert("Please type in your area code");
 document.price.BILLINGAREACODE.focus();
 return (false);
 } else if (document.price.BILLINGPHONENUMBER.value =="") {
 alert("Please type in your phonenumber");
 document.price.BILLINGPHONENUMBER.focus();
 return (false);
 }
 } 
 
 var the_email = document.price.EMAIL.value;
 var atindex = the_email.indexOf('@');
 if (document.price.EMAIL.value == "") {
 alert("Please type in your email");
 document.price.EMAIL.focus();
 return (false);
 } else if ((atindex == -1) || (atindex == 0) || (atindex == the_email.length-1)) {
 alert("Your email is not formatted correctly.");
 document.price.EMAIL.focus();
 return (false);
 }
return (true);
}

function billingValidate() {
 //alert("billingValidate");
if (typeof (document.price.PAYMENTNEEDED) == 'undefined' || ((typeof (document.price.PAYMENTNEEDED) != 'undefined') && document.price.PAYMENTNEEDED[1].checked)) {
if (document.price.BILLINGADDRESS.value == "") {
alert("Please type in your billing address");
document.price.BILLINGADDRESS.focus();
return (false);
}
else if (document.price.BILLINGCITY.value == "") {
alert("Please type in your billing city");
document.price.BILLINGCITY.focus();
return (false);
}
else if (document.price.BILLINGSTATE.options[document.price.BILLINGSTATE.selectedIndex].value == "") {
alert("Please indicate in your billing state");
document.price.BILLINGSTATE.focus();
return (false);
}
else if (document.price.BILLINGZIPCODE.value == "") {
alert("Please type in your billing zipcode");
document.price.BILLINGZIPCODE.focus();
return (false);
}
}
return (true);
}

function paymentValidate(customerIDvalidate) {
//alert("paymentValidate");
var creditcardGroup = document.price.CREDITCARD;
var creditcardsChecked = (creditcardGroup[0].checked || creditcardGroup[1].checked || creditcardGroup[2].checked || creditcardGroup[3].checked);
var illegalChars = /[^a-zA-Z0-9 \-.]/;
// allow only letters, numbers, and spaces, dashes and periods

if (typeof (document.price.PAYMENTNEEDED) == 'undefined' || ((typeof (document.price.PAYMENTNEEDED) != 'undefined') && document.price.PAYMENTNEEDED[1].checked)) {

var creditcardGroup = document.price.CREDITCARD;
var creditcardsChecked = (creditcardGroup[0].checked || creditcardGroup[1].checked || creditcardGroup[2].checked || creditcardGroup[3].checked );
var illegalChars = /[^a-zA-Z0-9 \-.]/;// allow only letters, numbers, and spaces, dashes and periods

if ((document.price.LAST4DIGITS) && (!(creditcardGroup[4].checked))) document.price.LAST4DIGITS.value = '';

if (creditcardsChecked && document.price.CREDITCARDNUMBER && document.price.CREDITCARDNUMBER.value.length >= 4) {
var start = document.price.CREDITCARDNUMBER.value.length - 4;
document.price.LAST4DIGITS.value = document.price.CREDITCARDNUMBER.value.substring(start);
}

if (creditcardGroup[4].checked) { // card on file
if (document.price.CUSTOMER[0].checked) {
alert("The 'card on file' payment option is only valid for returning customers.");
return (false);
} else if (document.price.LAST4DIGITS.value == "") {
alert("Please supply the last four digits of your credit card.");
document.price.LAST4DIGITS.focus();
return (false);
} else if (!(isNumberString(document.price.LAST4DIGITS.value))) {
alert("Please supply the last four digits of your credit card.");
document.price.LAST4DIGITS.focus();
return (false);
}
}
if ((creditcardsChecked || !customerIDvalidate) && !billingValidate()) { return false; }
}
 return (true);
}

function isValidAccount(){
 //check for validity of customer Account
 var InString;
 InString = document.price.account.value;
 if (InString.length != 9) { //string length = 9
 isInvalidAccountMessage();
 return (false);
 } else {
 var AlphaString;
 var NumericString;
 AlphaString = InString.substring(0,4);
 NumericString = InString.substring(4,9);
 if (!(isAlphabeticString(AlphaString))) 
 {
 isInvalidAccountMessage();
 return (false);
 }
 if (!(isNumberString(NumericString))) 
 {
 isInvalidAccountMessage();
 return (false);
 }
 // valid customer id has been identified
 } //end of string length = 9
 return (true);
}

function validateDesignOnline() {
// Check to see that quantities have been filled in for all cards
for (var i = 1; i <= 12; i++)
{
var currentQtyBox = document.forms["price"].elements["ctl00$PricingPlaceHolder1$ProductPricing1$NameQtyPricing1$txtName" + i + "Qty"];
if (currentQtyBox.type == "text" && currentQtyBox.value == "") { // if this is a text box rather than one of the hidden placeholder form elements, and no value has been entered
alert("Please enter a quantity for each card,\nthen recalculate the price.");
currentQtyBox.focus();
return (false);
}
}

// Determine whether any non-zero quantities have been entered
var nonZeroQuantityEntered = false;
for (var i = 1; i <= 12; i++) {
 var currentQtyBox = document.forms["price"].elements["ctl00$PricingPlaceHolder1$ProductPricing1$NameQtyPricing1$txtName" + i + "Qty"];
 var currentNameElement = document.forms["price"].elements["ctl00$PricingPlaceHolder1$ProductPricing1$NameQtyPricing1$txtName" + i];
if (currentQtyBox.type == "text") { // if this is a text box rather than one of the hidden placeholder form elements
if (currentQtyBox.value != "0" && currentQtyBox.value != "") { // if a value of zero has been entered
 nonZeroQuantityEntered = true;
}
}
}

if (!nonZeroQuantityEntered) {
alert("A quantity other than zero must be entered for at least one card.");
return (false);
}
return (true);
}

function validateMailing()
{
 var MailingText = GetElementByIDOrName('ctl00$PricingPlaceHolder1$ProductPricing1$MailingPricing1$txtMailingQuantity');
 if (MailingText != null && typeof(MailingText) != 'undefined' && MailingText.value != '' && MailingText.value != '0' )
 {
 var MailingType = GetRadioCheckedValueByName('ctl00$PricingPlaceHolder1$ProductPricing1$MailingPricing1$rblMailingMethod');
 return MailingType != '';
 }
 return true;
}

//-----------------------------------------------------------------------------
function isValidCoupon (InString) {
if(InString.length==0) 
 return (true);
var RefString = "ABCDEFGHIJKLMNOPQRSTUVWXYZ 0123456789%-";
for (Count=0; Count < InString.length; Count++) {
TempChar= InString.substring(Count, Count+1);
if (RefString.indexOf(TempChar, 0) == -1) {
return (false);
}
}
return (true);
}

function isAlphabeticString (InString) {
if (InString.length == 0) {
return (false);
}
RefString="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
for (Count=0; Count < InString.length; Count++) {
TempChar= InString.substring(Count, Count+1);
if (RefString.indexOf(TempChar, 0) == -1) {
return (false);
}
}
return (true);
}

function isNumberString (InString) {
if (InString.length == 0) {
return (false);
}
RefString="1234567890";
for (Count=0; Count < InString.length; Count++) {
TempChar= InString.substring (Count, Count+1);
if (RefString.indexOf(TempChar, 0) == -1) {
return (false);
}
}
return (true);
}

function isCurrency (InString) {
if (InString.length == 0) {
return (false);
}
RefString="0123456789.,$";
for (Count=0; Count < InString.length; Count++) {
TempChar= InString.substring (Count, Count+1);
if (RefString.indexOf(TempChar, 0) == -1) {
return (false);
}
}
return (true);
}

function strip(filter,str){
 var i,curChar;
 var retStr = '';
 var len = str.length;
 for(i=0; i<len; i++){
 curChar = str.charAt(i);
 if (filter.indexOf(curChar) < 0) {
 //not in filter, keep it
 retStr += curChar;
 }
 }
 return retStr;
}

function isInvalidAccountMessage() {
alert("The account number you entered is invalid. If you are entering a Promotional Code, please enter the code within the coupon field provided below. If you don't have an account number, please leave the account field blank.");
 document.price.account.value="";
 document.price.account.focus();
}

function macWindow(openWindow) {
if (openWindow) {
 windowHandle = window.open('macfile.html','window3','width=270,height=200');
 if (!windowHandle.opener) windowHandle.opener = self;
 }
else
windowHandle.close();
}

 // Call onclick function for the checked item of a collection
function Click(elem) {
for (var i = 0; i < elem.length; i++) {
if (elem[i].checked) {
elem[i].click();
break;
}
}
}

function newWindow(file,window) {
 msgWindow=open(file,window,'resizable=no,width=500,height=520');
 if (msgWindow.opener == null) msgWindow.opener = self;
 }
//-------------------------------------------------------------------------------
var pfl1status;
var pfl1date;

function CheckSubmit() {
 if (site != "DO" && site != "TO") {
 var filetransferGroup = document.price.filetransfer;
var uploading_files = filetransferGroup[0].checked;
}

 var customerIDvalidate = false; //set to false for channel

 //check for size radio buttons
 if (typeof(document.price.ctl00$PricingPlaceHolder1$ProductPricing1$SizePricing1$rblSize) != 'undefined') {
 SetAttributeDescription('ctl00$PricingPlaceHolder1$ProductPricing1$SizePricing1$rblSize', 'productTypeInt'); //product ID
 }
 var producttype = document.price.productTypeInt.value;

 //set hidden pricing fields from span values (post CQ Phase 1)
 SetInputVal('ctl00_PricingPlaceHolder1_ProductPricing1_InstaPrice1_lblPrintingSubtotal', 'subPrice'); //printing subtotal
 SetInputVal('ctl00_PricingPlaceHolder1_ProductPricing1_InstaPrice1_lblPrintingCostEach', 'ppcopyPrice'); //printing cost each
 SetInputVal('ctl00_PricingPlaceHolder1_ProductPricing1_InstaPrice1_lblRushCharge', 'rushPrice'); //rush price
 SetInputVal('ctl00_PricingPlaceHolder1_ProductPricing1_InstaPrice1_lblShippingHandling', 'shipPrice'); //shipping price
 SetInputVal(($('ctl00_PricingPlaceHolder1_ProductPricing1_InstaPrice1_lblDiscountedTotal') && $('ctl00_PricingPlaceHolder1_ProductPricing1_InstaPrice1_lblHiVolDiscount') && $('ctl00_PricingPlaceHolder1_ProductPricing1_InstaPrice1_lblHiVolDiscount').innerHTML != '$0.00') ? 'ctl00_PricingPlaceHolder1_ProductPricing1_InstaPrice1_lblDiscountedTotal' : 'ctl00_PricingPlaceHolder1_ProductPricing1_InstaPrice1_lblOrderTotal', 'totalPrice'); //order total price
 SetInputVal('ctl00_PricingPlaceHolder1_ProductPricing1_InstaPrice1_lblCouponDiscount', 'couponDiscount'); //coupon discount
 SetInputVal('ctl00_PricingPlaceHolder1_ProductPricing1_InstaPrice1_lblHiVolDiscount', 'highVolumeDiscount'); //high volume discount
 if (document.price.highVolumeDiscount && StripNonNumeric(document.price.highVolumeDiscount.value) > 0) {
 document.price.ctl00$PricingPlaceHolder1$ProductPricing1$txtCouponCode.value = "";
 } 
 SetInputVal('ctl00_PricingPlaceHolder1_ProductPricing1_InstaPrice1_lblUnitCost', 'pp2copyPrice'); //unit cost
 SetInputVal('ctl00_PricingPlaceHolder1_ProductPricing1_InstaPrice1_lblMailingServices', 'mailingPrice'); //mailing price
 SetInputVal('ctl00_PricingPlaceHolder1_ProductPricing1_InstaPrice1_lblEnvelopes', 'envelopePrice'); //envelope price
 SetInputVal('ctl00_PricingPlaceHolder1_ProductPricing1_InstaPrice1_lblSecondSheets', 'secondsheetsPrice'); //second sheets price
 if (producttype == ProductIDEnum.calendars_5_5x8_5 || producttype == ProductIDEnum.calendars_8_5x11 
 || producttype == ProductIDEnum.catalogs_5_5x8_5 || producttype == ProductIDEnum.catalogs_8_5x11) { //catalogs and calendars
 SetInputVal('ctl00_PricingPlaceHolder1_ProductPricing1_InstaPrice1_lblCoverBasePrintingPrice', 'basePrice'); //base printing price
 SetInputVal('ctl00_PricingPlaceHolder1_ProductPricing1_InstaPrice1_lblCoverPaperUpgrade', 'paperPrice'); //paper upgrade price
 SetInputVal('ctl00_PricingPlaceHolder1_ProductPricing1_InstaPrice1_lblCoverGlossVarnish', 'aquaPrice'); //aqueous price
 SetInputVal('ctl00_PricingPlaceHolder1_ProductPricing1_InstaPrice1_lblInsideFoldCollateStaple', 'foldPrice'); //fold price (fold collate staple)
 SetInputVal('ctl00_PricingPlaceHolder1_ProductPricing1_InstaPrice1_lblInsideBasePrintingPrice', 'insidepagesPrice'); //inside pages printing
 SetInputVal('ctl00_PricingPlaceHolder1_ProductPricing1_InstaPrice1_lblInsidePaperUpgrade', 'insidepaperprice'); //inside paper price
 }
 else {
 SetInputVal('ctl00_PricingPlaceHolder1_ProductPricing1_InstaPrice1_lblBasePrintingPrice', 'basePrice'); //base printing price
 SetInputVal('ctl00_PricingPlaceHolder1_ProductPricing1_InstaPrice1_lblPaperUpgrade', 'paperPrice'); //paper upgrade price
 SetInputVal('ctl00_PricingPlaceHolder1_ProductPricing1_InstaPrice1_lblAqueousCoating', 'aquaPrice'); //aqueous price
 SetInputVal('ctl00_PricingPlaceHolder1_ProductPricing1_InstaPrice1_lblFolding', 'foldPrice'); //fold price
}

 if (document.price.cobrand.value == "CopyMax") { //set prices for OfficeMax
 document.price.markupPrice.value = StripNonNumeric(document.price.totalPrice.value, ".") - StripNonNumeric(document.price.totalPriceIP.value, "."); //markup - difference between total price and IP total price
 document.price.subPrice.value = document.price.printingSubtotalIP.value; //printing subtotal
 document.price.shipPrice.value = document.price.shipPriceIP.value; //shipping price
 document.price.rushPrice.value = document.price.rushPriceIP.value; //rush price
 document.price.secondsheetsPrice.value = document.price.secondsheetsPriceIP.value; //second sheets price
 document.price.envelopePrice.value = document.price.envelopePriceIP.value; //envelope price
 }

 //set hidden attribute description fields
 //ink
 if (producttype == ProductIDEnum.file_folders) { //split ink for file folders
 var ink = GetRadioCheckedValueByName('ctl00$PricingPlaceHolder1$ProductPricing1$InkPricing1$rblInk1'); //use name not id
 var inkArr = ink.split('/');
 if (inkArr.length > 1) {
 if (inkArr[0] == '') {
 document.price.front.value = NoValueEnum[AttributeIDEnum.ink];
 }
 else {
 document.price.front.value = AttributeValueNameEnum[inkArr[0]];
 }
 if (inkArr[1] == '') {
 document.price.back.value = NoValueEnum[AttributeIDEnum.ink];
 }
 else {
 document.price.back.value = AttributeValueNameEnum[inkArr[1]];
 } 
}
 }
 else {
 SetAttributeDescription('ctl00$PricingPlaceHolder1$ProductPricing1$InkPricing1$rblInk1', 'front', AttributeIDEnum.ink); //front ink
 SetAttributeDescription('ctl00$PricingPlaceHolder1$ProductPricing1$InkPricing1$rblInk2', 'back', AttributeIDEnum.ink); //back ink
 if (producttype == ProductIDEnum.calendars_5_5x8_5 || producttype == ProductIDEnum.calendars_8_5x11 
|| (producttype == ProductIDEnum.catalogs_5_5x8_5 && document.price.ctl00$PricingPlaceHolder1$ProductPricing1$NumPagesPricing1$ddlNumPages.value > 8)
|| (producttype == ProductIDEnum.catalogs_8_5x11 && document.price.ctl00$PricingPlaceHolder1$ProductPricing1$NumPagesPricing1$ddlNumPages.value > 4)) {
SetAttributeDescription('ctl00$PricingPlaceHolder1$ProductPricing1$InsidePagePricing1$rblInkInside', 'insideink', AttributeIDEnum.ink); //insideink
 }
 }

 //paper
 if (producttype == ProductIDEnum.calendars_5_5x8_5 || producttype == ProductIDEnum.calendars_8_5x11) {
 SetAttributeDescription('ctl00$PricingPlaceHolder1$ProductPricing1$PaperPricing1$rblPaperInside', 'insidepaperType', AttributeIDEnum.paper); //insidepaper calendars
 }
 else if ((producttype == ProductIDEnum.catalogs_5_5x8_5 && document.price.ctl00$PricingPlaceHolder1$ProductPricing1$NumPagesPricing1$ddlNumPages.value > 8)
|| (producttype == ProductIDEnum.catalogs_8_5x11 && document.price.ctl00$PricingPlaceHolder1$ProductPricing1$NumPagesPricing1$ddlNumPages.value > 4)) {
SetAttributeDescription('ctl00$PricingPlaceHolder1$ProductPricing1$InsidePagePricing1$rblPaperInside', 'insidepaperType', AttributeIDEnum.paper); //insidepaper catalogs
 }
 SetAttributeDescription('ctl00$PricingPlaceHolder1$ProductPricing1$PaperPricing1$rblPaper', 'paperType', AttributeIDEnum.paper); //paper
 //fold
 if (producttype == ProductIDEnum.calendars_5_5x8_5 || producttype == ProductIDEnum.calendars_8_5x11
 || producttype == ProductIDEnum.catalogs_5_5x8_5 || producttype == ProductIDEnum.catalogs_8_5x11) { //hard code fold collate stitch for catalogs
 if (document.price.ctl00$PricingPlaceHolder1$ProductPricing1$NumPagesPricing1$ddlNumPages.value == 4) {
 document.price.ctl00$PricingPlaceHolder1$ProductPricing1$FoldPricing1$rblFold.value = AttributeValueIDEnum.fold_half_fold;
 document.price.folds.value = AttributeValueNameEnum[document.price.ctl00$PricingPlaceHolder1$ProductPricing1$FoldPricing1$rblFold.value];
 }
 else {
 document.price.ctl00$PricingPlaceHolder1$ProductPricing1$FoldPricing1$rblFold.value = AttributeValueIDEnum.foldcollatestaple_fold_collate_stitch;
 document.price.folds.value = AttributeValueNameEnum[AttributeValueIDEnum.foldcollatestaple_fold_collate_stitch];
 }
 }
 else {
 SetAttributeDescription('ctl00$PricingPlaceHolder1$ProductPricing1$FoldPricing1$rblFold', 'folds', AttributeIDEnum.fold); //fold
 }

 //aqueous
 if ((producttype == ProductIDEnum.greeting_cards || producttype == ProductIDEnum.note_cards ||
 producttype == ProductIDEnum.holiday_deluxe_greeting_card || producttype == ProductIDEnum.holiday_deluxe_note_card ||
 producttype == ProductIDEnum.holiday_premium_greeting_card || producttype == ProductIDEnum.holiday_premium_note_card) &&
 GetRadioCheckedValueByName('ctl00$PricingPlaceHolder1$ProductPricing1$PaperPricing1$rblPaper') == AttributeValueIDEnum.paper_120lb_gloss_cover) {
 //Hard code free Aqueous for Greeting and Note Cards on 120# Gloss Cover
 document.price.ctl00$PricingPlaceHolder1$ProductPricing1$AqueousPricing1$rblAqueous.value = AttributeValueIDEnum.coating_gloss_aqueous;
 document.price.aqueous.value = AttributeValueNameEnum[document.price.ctl00$PricingPlaceHolder1$ProductPricing1$AqueousPricing1$rblAqueous.value];
 }
 else {
 SetAttributeDescription('ctl00$PricingPlaceHolder1$ProductPricing1$AqueousPricing1$rblAqueous', 'aqueous', AttributeIDEnum.coating); //aqueous
 }

 //imprint
 SetAttributeDescription('ctl00$PricingPlaceHolder1$ProductPricing1$EnvelopePricing1$rblPrintedEnvelope', 'blackimprint', AttributeIDEnum.imprint); //imprint (return address in black)
 //pockets
 SetAttributeDescription('ctl00$PricingPlaceHolder1$ProductPricing1$PocketSlitPricing1$rblPocket', 'PocketType', AttributeIDEnum.pockets); //pockets
 //slits
 SetAttributeDescription('ctl00$PricingPlaceHolder1$ProductPricing1$PocketSlitPricing1$rblSlit', 'SlitType', AttributeIDEnum.slits); //slits
 //seal
 SetAttributeDescription('ctl00$PricingPlaceHolder1$ProductPricing1$SealPricing1$rblSeal', 'sealType', AttributeIDEnum.seal); //seal

 //non PD_AttributeValues (turnaround, shipping, mailing)
 if (producttype != ProductIDEnum.envelopes_only) {
 SetAttributeDescription('ctl00$PricingPlaceHolder1$ProductPricing1$TurnaroundPricing1$rblTurnaround', 'shipspeed'); //turnaround
 }
 SetAttributeDescription('ctl00$PricingPlaceHolder1$ProductPricing1$ShipTypePricing1$rblShipType', 'shiptype'); //shipping method
 SetAttributeDescription('ctl00$PricingPlaceHolder1$ProductPricing1$MailingPricing1$rblMailingMethod', 'mailingtype'); //mailing method
 
 //envelope size and paper
 if (typeof(document.price.ctl00$PricingPlaceHolder1$ProductPricing1$EnvelopePricing1$txtEnvelopeQuantity) != 'undefined' &&
 document.price.ctl00$PricingPlaceHolder1$ProductPricing1$EnvelopePricing1$txtEnvelopeQuantity.value &&
 document.price.ctl00$PricingPlaceHolder1$ProductPricing1$EnvelopePricing1$txtEnvelopeQuantity.value != '' &&
 document.price.ctl00$PricingPlaceHolder1$ProductPricing1$EnvelopePricing1$txtEnvelopeQuantity.value > 0) {
 if (producttype == ProductIDEnum.greeting_cards || producttype == ProductIDEnum.holiday_deluxe_greeting_card || 
 producttype == ProductIDEnum.holiday_deluxe_note_card) {
 document.price.envelopeID.value = AttributeValueIDEnum.envelopes_a7;
 document.price.envelope.value = AttributeValueNameEnum[document.price.envelopeID.value];
 }
 else if (producttype == ProductIDEnum.note_cards || producttype == ProductIDEnum.holiday_premium_greeting_card || 
 producttype == ProductIDEnum.holiday_premium_note_card) {
 document.price.envelopeID.value = AttributeValueIDEnum.envelopes_a2;
 document.price.envelope.value = AttributeValueNameEnum[document.price.envelopeID.value];
 }
 document.price.envelopepaperID.value = AttributeValueIDEnum.paper_24lb_uncoated;
 document.price.envelopepaper.value = AttributeValueNameEnum[document.price.envelopepaperID.value];
 }

 //doorhanger die cut
 if ((producttype == ProductIDEnum.door_hangers_3_5x8_5 || producttype == ProductIDEnum.door_hangers_4_25x11) &&
 typeof (document.price.diecutID) != 'undefined' && typeof (document.price.diecut) != 'undefined') {
 document.price.diecutID.value = AttributeValueIDEnum.diecut_door_hanger_die_cut;
 document.price.diecut.value = AttributeValueNameEnum[document.price.diecutID.value];
 }

 //calendar drill hole
 if ((producttype == ProductIDEnum.calendars_5_5x8_5 || producttype == ProductIDEnum.calendars_8_5x11) &&
 typeof (document.price.drillholeID) != 'undefined' && typeof (document.price.drillhole) != 'undefined') {
 document.price.drillholeID.value = AttributeValueIDEnum.drillholes_1_8_drill_hole;
 document.price.drillhole.value = AttributeValueNameEnum[document.price.drillholeID.value];
 }

 //cd covers perforation
 if (producttype == ProductIDEnum.cd_covers && typeof (document.price.perforationID) != 'undefined'
 && typeof (document.price.perforation) != 'undefined') {
 document.price.perforationID.value = AttributeValueIDEnum.perfnumber_perforation;
 document.price.perforation.value = AttributeValueNameEnum[document.price.perforationID.value];
 }

 //greeting/note cards and presentation folders score (AND no fold)
 if ((producttype == ProductIDEnum.presentation_folders_9x12 || producttype == ProductIDEnum.presentation_folders_cbsl_9x12 ||
 producttype == ProductIDEnum.greeting_cards || producttype == ProductIDEnum.note_cards ||
 producttype == ProductIDEnum.holiday_deluxe_greeting_card || producttype == ProductIDEnum.holiday_deluxe_note_card ||
 producttype == ProductIDEnum.holiday_premium_greeting_card || producttype == ProductIDEnum.holiday_premium_note_card) &&
 typeof(document.price.scoreID) != 'undefined' && typeof(document.price.score) != 'undefined' &&
 typeof (document.price.folds) != 'undefined' && document.price.folds.value == NoValueEnum[AttributeIDEnum.fold]) {
 document.price.scoreID.value = AttributeValueIDEnum.score_standard;
 document.price.score.value = AttributeValueNameEnum[document.price.scoreID.value];
 }

 if ((producttype == 26) && (!(customOrderValidate()))) { return false; } //custom quote
 else if ((site == "DO") && (!(validateDesignOnline()))) { return false; } //design online

 //validate mailing
 if (!validateMailing()) {
 alert('Please select a mailing method.');
 $('ctl00$PricingPlaceHolder1$ProductPricing1$MailingPricing1$txtMailingQuantity').focus();
 return false;
 }

if (uploading_files) {
if(document.price.file1.value =="" && document.price.file2.value =="" && document.price.file3.value =="" && document.price.file4.value =="") {
alert("Please select a file to upload or another file transfer option");
document.price.file1.focus();
return false;
}
}

if (site == "Channel") {
if (!(channelCustomerValidate())) { return false; } //channel validation

} 
 else { // regular customer validation - non-channel
if ((document.price.account.value != "") && (isValidAccount())) { customerIDvalidate = true; }
 
 if (site != "LW") {
 if (!(standardCustomerValidate(customerIDvalidate))) return false; 
 if (!(paymentValidate(customerIDvalidate))) {return false;}
 } 
 else { //logoworks validation
 if (!(logoWorksCustomerValidate())) { return false; }
 }
 }

 if ((!customerIDvalidate) && ((site == "Channel" && document.price.ChannelShipTo[1].checked) || (site != "Channel")) && (!shippingValidate())) {
 return false;
 }

 if ((producttype != 26) && (site == "LW")) { updateGNTables(); }

if (site != "DO") { //no upload progress window for DO orders
// Open upload progress window
var w = window.open( "", "UPLOADWINDOW1", "width=380,height=320,resizable=no");
if (document.price.FBC) { //change page to files for Free Business Card ordering page
if (uploading_files) {
w.location.href = "../statusbarupload.html";
}
else {
w.location.href = "../statusbarorder.html";
}
}
else {
if (uploading_files) {
w.location.href = "statusbarupload.html";
}
else {
w.location.href = "statusbarorder.html";
}
}
}
else if (site == "DO") { //DO specific validation
// Clear the name and quantity form elements if the quantity form element is zero
for (var i = 1; i <= 12; i++) {
 var currentQtyBox = document.forms["price"].elements["ctl00$PricingPlaceHolder1$ProductPricing1$NameQtyPricing1$txtName" + i + "Qty"];
var currentNameElement = document.forms["price"].elements["ctl00$PricingPlaceHolder1$ProductPricing1$NameQtyPricing1$txtName" + i];
if (currentQtyBox.type == "text" && currentQtyBox.value == "0") { // if this is a text box rather than one of the hidden placeholder form elements, and a value of zero has been entered
currentQtyBox.value = "";
currentNameElement.value = "";
}
}
//found in UtilityFunctions.js include file
DeleteCookie("SavedBCardsList");
}

var companyname;
var customername;
var phone;
var email;
var cgiscriptaction;
var customertype;

if (site == "default") { //failed Order only for PFL orders in 'default' sites
if (document.price.CUSTOMER[0].checked) customertype = "new";
else if (document.price.CUSTOMER[1].checked) customertype = "returning"; 
else customertype = "unknown";

companyname = escape(document.price.COMPANYNAME.value);
customername = escape(document.price.CUSTOMERFIRSTNAME.value + "_" + document.price.CUSTOMERLASTNAME.value);
phone = escape(document.price.BILLINGAREACODE.value + "-" + document.price.BILLINGPHONENUMBER.value);
email = escape(document.price.EMAIL.value);
} //end default only

if (producttype == 26) { //custom quote
 cgiscriptaction = "https://www.printingforless.com/cgi-bin/";
 
 if (weblocation == "DEVELOPMENT") {
 cgiscriptaction += "processorderTestingCQ.cgi";
 } 
 else if (weblocation == "TRAINING") {
 cgiscriptaction += "processorderTrainingCQ.cgi";
 } 
 else { //if (weblocation == "PUBLIC") {
 cgiscriptaction += "processorderCQ.cgi";
 }
} else { //default, Channel, DO
cgiscriptaction = "https://www.printingforless.com/cgi-bin/";
 if (weblocation == "DEVELOPMENT" || weblocation == "INTEGRATION" || weblocation == "STAGING") {
cgiscriptaction += "processorderTestingM.cgi";
} 
else if (weblocation == "TRAINING") {
cgiscriptaction += "processorderTrainingM.cgi";
} 
else { //if (weblocation == "PUBLIC") {
cgiscriptaction += "processorderM.cgi";
}
}

if (site == "default") { //no failed Order for Channel and DO
document.price.action = cgiscriptaction + "?" + companyname + "--" + customername + "--" + customertype + "--" + phone + "--" + email + "--" + producttype;
} // default
else if (site == "CB") {
document.price.action = cgiscriptaction + "?" + "CB=" + CB;
}
else { //not default
document.price.action = cgiscriptaction;
 }

// to stop duplicate orders - 9/8/2006 KR
if (document.price.sendorder) {
document.price.sendorder.disabled = true;
document.price.sendorder.value = "Sending Order...";
}

if (document.price.CREDITCARDNUMBER == undefined) {
document.price.submit();
}
else {
var guid = generateGuid();
if (weblocation == "DEVELOPMENT" || weblocation == "INTEGRATION" || weblocation == "STAGING") {
pfl1.document.formCC.action = "https://" + window.location.host + "/Public/ExternalOrder.aspx";
}
else if (weblocation == "TRAINING") {
// Need to update this for training
}
else { //if (weblocation == "PUBLIC") {
pfl1.document.formCC.action = "https://www.printingforless1.com/ExternalOrder.aspx";
}
pfl1.document.formCC.CC.value = document.price.CREDITCARDNUMBER.value;
pfl1.document.formCC.GUID.value = guid;
pfl1.document.formCC.submit();
document.price.CREDITCARDNUMBER.value = guid;
pfl1status = document.getElementById('pfl1status');
if (pfl1status == null || pfl1status == undefined) {
document.price.submit();
}
else {
pfl1date = new Date();
setTimeout('CheckPFL1Status();', 100);
}
}
}

function SetInputVal(spanID, inputID) {
 var spanElem = document.getElementById(spanID);
 if (typeof (spanElem) != 'undefined' && spanElem != null) {
 var inputElem = GetElementByIDOrName(inputID);
 if (typeof (inputElem) != 'undefined' && inputElem != null) {
 inputElem.value = spanElem.innerHTML.replace('$', ''); //strip out the dollar sign on prices

 }
 }
}

function SetAttributeDescription(attributeID, hiddenID, PDA_RID) {
var attributeElem = document.getElementsByName(attributeID); //use name not id
var elemObj = document.getElementById(attributeID); //used for hidden values (not radio buttons
var attributeValue = "";
if (elemObj) {
if (elemObj.type == "radio" || elemObj.type == "hidden") {
if (typeof (attributeElem) != 'undefined' && attributeElem != null && attributeElem.length > 1) {
attributeValue = GetRadioCheckedValueByName(attributeID);
}
else {
attributeValue = elemObj.value;
}
}
}

if (attributeValue == "" && typeof (attributeElem) != 'undefined' && attributeElem != null) {
attributeValue = GetRadioCheckedValueByName(attributeID);
}

 var hiddenElem = GetElementByIDOrName(hiddenID);
 if (typeof (hiddenElem) != 'undefined' && hiddenElem != null) {
 if (PDA_RID != null) {
 if (attributeValue != '') {
 hiddenElem.value = AttributeValueNameEnum[attributeValue];
 }
 else {
 hiddenElem.value = NoValueEnum[PDA_RID];
 }
 }
 else {
 hiddenElem.value = attributeValue;
 }
 }
}

function GetElementByIDOrName(inputID) {
var inputElem = document.getElementById(inputID);
if (inputElem == null) {
inputElem = document.getElementsByName(inputID);
if (inputElem != null) {
inputElem = inputElem[0];
}
}
return inputElem;
}

function generateGuid()
{
var result, i, j;
result = '';
for (j = 0; j < 32; j++) {
if (j == 8 || j == 12 || j == 16 || j == 20) {
 result = result + '-';
}
i = Math.floor(Math.random() * 16).toString(16).toUpperCase();
result = result + i;
}
return '{' + result + '}';
}

function CheckPFL1Status() {
var curDate = new Date();
var newdomain = false;
try {
var l = pfl1.location.host;
}
catch (e) {
// a domain change will cause an access denied error
newdomain = true;
}
if (pfl1status.value == 'complete' || newdomain == true || curDate - pfl1date > 10000) {
// If pfl1 submission is complete or domain in iframe has changed or 10 seconds have elapsed
document.price.submit();
}
else {
// Reset status check
setTimeout('CheckPFL1Status();', 100);
}
}

function CreatePFL1Iframe() {
 // Create the form that will submit to printingforless1.com
 //document.body.innerHTML += '<iframe id="pfl1" name="pfl1" src="pfl1.html" width=0 height=0></iframe>';
 var pfl1 = document.createElement('iframe');
 pfl1.setAttribute('id', 'pfl1');
 pfl1.setAttribute('name', 'pfl1');
 pfl1.setAttribute('width', '0');
 pfl1.setAttribute('height', '0');
 pfl1.setAttribute('src', 'pfl1.html');
 document.body.appendChild(pfl1);
 var pfl1status = document.createElement('input');
 pfl1status.setAttribute('type', 'hidden');
 pfl1status.setAttribute('id', 'pfl1status');
 pfl1status.setAttribute('value', '');
 //document.getElementById('price').appendChild(pfl1status);
 document.price.appendChild(pfl1status);

 // Create hidden var to send server/domain
 var domainprefix = document.domain.substring(0, document.domain.indexOf("-"));
 var domaincode = '';
 if ('dw' == domainprefix) domaincode = 'dev';
 if ('iw' == domainprefix) domaincode = 'int';
 if ('sw' == domainprefix) domaincode = 'stg';
 if ('tw' == domainprefix) domaincode = 'trn';
 var orderdomain = document.createElement('input');
 orderdomain.setAttribute('type', 'hidden');
 orderdomain.setAttribute('id', 'orderdomain');
 orderdomain.setAttribute('name', 'orderdomain');
 orderdomain.setAttribute('value', domaincode);
 document.price.appendChild(orderdomain);
}

var highVolumeCoupon = "new Coupon('HVD', DiscountTypeEnum.HiVol, new Array(new CouponValue(20117, 0.0000, 0.28, 25000), new CouponValue(20116, 0.0000, 0.25, 15000), new CouponValue(20115, 0.0000, 0.2, 12500), new CouponValue(20114, 0.0000, 0.15, 10000), new CouponValue(20113, 0.0000, 0.1, 7500), new CouponValue(20112, 0.0000, 0.05, 5000)))";
function SetCobrandCoupon() {
 if (site == "CB" && typeof (InstaPrices) != 'undefined') {
 var objCBInfo = GetCBInfo();
 if (document.price.coupontype) { //free business cards regular and short run
 if (document.price.coupontype.value == "BCD") {
 InstaPrices['ctl00_PricingPlaceHolder1_ProductPricing1_InstaPrice1'].SetCoupons(new Array(eval(highVolumeCoupon), new Coupon(objCBInfo.FBCCouponCode, DiscountTypeEnum.Promotional, new Array(new CouponValue(objCBInfo.FBCCouponID, objCBInfo.FBCCouponAmount, objCBInfo.FBCCouponPercent, objCBInfo.FBCCouponMiniumn)))));
 document.price.ctl00$PricingPlaceHolder1$ProductPricing1$txtCouponCode.value = objCBInfo.FBCCouponCode;
 }
 else if (document.price.coupontype.value == "BCDSR") {
 InstaPrices['ctl00_PricingPlaceHolder1_ProductPricing1_InstaPrice1'].SetCoupons(new Array(eval(highVolumeCoupon), new Coupon(objCBInfo.SRFBCCouponCode, DiscountTypeEnum.Promotional, new Array(new CouponValue(objCBInfo.SRFBCCouponID, objCBInfo.SRFBCCouponAmount, objCBInfo.SRFBCCouponPercent, objCBInfo.SRFBCCouponMiniumn)))));
 document.price.ctl00$PricingPlaceHolder1$ProductPricing1$txtCouponCode.value = objCBInfo.SRFBCCouponCode;
 }
 }
 else {
 InstaPrices['ctl00_PricingPlaceHolder1_ProductPricing1_InstaPrice1'].SetCoupons(new Array(eval(highVolumeCoupon), new Coupon(objCBInfo.CouponCode, DiscountTypeEnum.Promotional, new Array(new CouponValue(objCBInfo.CouponID, objCBInfo.CouponAmount, objCBInfo.CouponPercent, objCBInfo.CouponMiniumn)))));
 document.price.ctl00$PricingPlaceHolder1$ProductPricing1$txtCouponCode.value = objCBInfo.CouponCode;
 }
 }
}

function SetCoupon(couponCode, couponAmount, couponPercent, couponMinimun) {
 if (site == "CB" && typeof (InstaPrices) != 'undefined') {
 InstaPrices['ctl00_PricingPlaceHolder1_ProductPricing1_InstaPrice1'].SetCoupons(new Array(eval(highVolumeCoupon),new Coupon(couponCode, DiscountTypeEnum.Promotional, new Array(new CouponValue(001, couponAmount, couponPercent, couponMinimun)))));
 }
}

function EmptyCoupon() { //high volume only
 if (site == "CB" && typeof (InstaPrices) != 'undefined') {
 InstaPrices['ctl00_PricingPlaceHolder1_ProductPricing1_InstaPrice1'].SetCoupons(new Array(eval(highVolumeCoupon)));
 document.price.ctl00$PricingPlaceHolder1$ProductPricing1$txtCouponCode.value = "";
 }
}
