function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function changeDiv(the_div,the_change) {
  var the_style = getStyleObject(the_div);
  if (the_style != false) {
    the_style.display = the_change; }
}

function getStyleObject(objectId) {
  if (document.getElementById && document.getElementById(objectId)) {
    return document.getElementById(objectId).style;
  } else if (document.all && document.all(objectId)) {
    return document.all(objectId).style;
  } else {
    return false; }
}

function declareDesigns() {
/* called by both Mix 'n Match and CM */
	FFF = Array();
	FFF["colorScheme"] = "1";
	FFF["descr"] = "fuckfuckfuck";
	FFF["extraCharge"] = 0;
	FFF["designNote"] = "";
	
	FOF = Array();
	FOF["colorScheme"] = "1";
	FOF["descr"] = "Fuck Off";
	FOF["extraCharge"] = 0;
	FOF["designNote"] = "";
	
	FON = Array();
	FON["colorScheme"] = "1";
	FON["descr"] = "Fuck On";
	FON["extraCharge"] = 0;
	FON["designNote"] = "";
	
	FSL = Array();
	FSL["colorScheme"] = "1";
	FSL["descr"] = "fuck sleep";
	FSL["extraCharge"] = 0;
	FSL["designNote"] = "";
	
	HEN = Array();
	HEN["colorScheme"] = "2";
	HEN["descr"] = "Hearts entwined";
	HEN["extraCharge"] = 0;
	HEN["designNote"] = "";
	
	HSL = Array();
	HSL["colorScheme"] = "2";
	HSL["descr"] = "Hearts sleeping";
	HSL["extraCharge"] = 0;
	HSL["designNote"] = "";
	
	SLP = Array();
	SLP["colorScheme"] = "1";
	SLP["descr"] = "Sleep";
	SLP["extraCharge"] = 0;
	SLP["designNote"] = "";
	
	SSS = Array();
	SSS["colorScheme"] = "1";
	SSS["descr"] = "sleepsleepsleep";
	SSS["extraCharge"] = 0;
	SSS["designNote"] = "";
	
	SME = Array();
	SME["colorScheme"] = "1";
	SME["descr"] = "Screw me, silly";
	SME["extraCharge"] = 0;
	SME["designNote"] = "";
	
	SMS = Array();
	SMS["colorScheme"] = "1";
	SMS["descr"] = "Screw me silly";
	SMS["extraCharge"] = 0;
	SMS["designNote"] = "";
	
	CUS = Array();
	CUS["colorScheme"] = "1";
	CUS["descr"] = "your message here";
	CUS["extraCharge"] = 10;
/*	CUS["designNote"] = "custom note"; */
	CUS["designNote"] = "The image above won't reflect your custom message but your new pillowcase will!"; 

	pcase = Array();
	pcase["FFF"] = FFF;
	pcase["FOF"] = FOF;
	pcase["FON"] = FON;
	pcase["FSL"] = FSL;
	pcase["HEN"] = HEN;
	pcase["HSL"] = HSL;
	pcase["SLP"] = SLP;
	pcase["SSS"] = SSS;
	pcase["SME"] = SME;
	pcase["SMS"] = SMS;
	pcase["CUS"] = CUS;
	pcase["baseCharge"] = 29.00;

	product = Array();
	product["pcases"] = pcase; /* product["pcases"][designAbbr]["colorScheme" | "descr"] */

}

function declareColors() {
/* called by both Mix 'n Match and CM */

	metallicCharge = 4.00;
	glowinthedarkCharge = 4.00;

	colorNotes = Array();
	colorNotes["regular"] = "";
	colorNotes["metallic"] = "";
	colorNotes["glowinthedark"] = "Visible in the dark! ";
	colorNotes["white"] = "White on white - very tactile. ";
	
	colorArray = Array();
	colorArray["magenta"] = Array();
	colorArray["magenta"]["num"] = "001";
	colorArray["magenta"]["displayString"] = "magenta";
	colorArray["magenta"]["extraCharge"] = 0;
	colorArray["magenta"]["colorNote"] = colorNotes["regular"];
	
	colorArray["hotpink"] = Array();
	colorArray["hotpink"]["num"] = "012";
	colorArray["hotpink"]["displayString"] = "hot pink";
	colorArray["hotpink"]["extraCharge"] = 0;
	colorArray["hotpink"]["colorNote"] = colorNotes["regular"];
	
	colorArray["red"] = Array();
	colorArray["red"]["num"] = "002";
	colorArray["red"]["displayString"] = "red";
	colorArray["red"]["extraCharge"] = 0;
	colorArray["red"]["colorNote"] = colorNotes["regular"];
	
	colorArray["neonorange"] = Array();
	colorArray["neonorange"]["num"] = "011";
	colorArray["neonorange"]["displayString"] = "neon orange";
	colorArray["neonorange"]["extraCharge"] = 0;
	colorArray["neonorange"]["colorNote"] = colorNotes["regular"];
	
	colorArray["redorange"] = Array();
	colorArray["redorange"]["num"] = "009";
	colorArray["redorange"]["displayString"] = "red orange";
	colorArray["redorange"]["extraCharge"] = 0;
	colorArray["redorange"]["colorNote"] = colorNotes["regular"];
	
	colorArray["goldenyellow"] = Array();
	colorArray["goldenyellow"]["num"] = "006";
	colorArray["goldenyellow"]["displayString"] = "golden yellow";
	colorArray["goldenyellow"]["extraCharge"] = 0;
	colorArray["goldenyellow"]["colorNote"] = colorNotes["regular"];
	
	colorArray["green"] = Array();
	colorArray["green"]["num"] = "005";
	colorArray["green"]["displayString"] = "green";
	colorArray["green"]["extraCharge"] = 0;
	colorArray["green"]["colorNote"] = colorNotes["regular"];
	
	colorArray["blue"] = Array();
	colorArray["blue"]["num"] = "003";
	colorArray["blue"]["displayString"] = "blue";
	colorArray["blue"]["extraCharge"] = 0;
	colorArray["blue"]["colorNote"] = colorNotes["regular"];
	
	colorArray["periwinkle"] = Array();
	colorArray["periwinkle"]["num"] = "010";
	colorArray["periwinkle"]["displayString"] = "periwinkle";
	colorArray["periwinkle"]["extraCharge"] = 0;
	colorArray["periwinkle"]["colorNote"] = colorNotes["regular"];
	
	colorArray["purple"] = Array();
	colorArray["purple"]["num"] = "004";
	colorArray["purple"]["displayString"] = "purple";
	colorArray["purple"]["extraCharge"] = 0;
	colorArray["purple"]["colorNote"] = colorNotes["regular"];
	
	colorArray["black"] = Array();
	colorArray["black"]["num"] = "013";
	colorArray["black"]["displayString"] = "black";
	colorArray["black"]["extraCharge"] = 0;
	colorArray["black"]["colorNote"] = colorNotes["regular"];
	
	colorArray["white"] = Array();
	colorArray["white"]["num"] = "014";
	colorArray["white"]["displayString"] = "tactile white";
	colorArray["white"]["extraCharge"] = 0;
	colorArray["white"]["colorNote"] = colorNotes["regular"] + colorNotes["white"];
	
	colorArray["goldmetallic"] = Array();
	colorArray["goldmetallic"]["num"] = "007";
	colorArray["goldmetallic"]["displayString"] = "gold metallic";
	colorArray["goldmetallic"]["extraCharge"] = metallicCharge;
	colorArray["goldmetallic"]["colorNote"] = colorNotes["metallic"];
	
	colorArray["whitemetallic"] = Array();
	colorArray["whitemetallic"]["num"] = "015";
	colorArray["whitemetallic"]["displayString"] = "tactile white metallic";
	colorArray["whitemetallic"]["extraCharge"] = metallicCharge;
	colorArray["whitemetallic"]["colorNote"] = colorNotes["metallic"] + colorNotes["white"];
	
	colorArray["glowinthedarkyellow"] = Array();
	colorArray["glowinthedarkyellow"]["num"] = "008";
	colorArray["glowinthedarkyellow"]["displayString"] = "glow-in-the-dark yellow";
	colorArray["glowinthedarkyellow"]["extraCharge"] = glowinthedarkCharge;
	colorArray["glowinthedarkyellow"]["colorNote"] = colorNotes["glowinthedark"];
	
	colorArray["magentapurple"] = Array();
	colorArray["magentapurple"]["num"] = "902";
	colorArray["magentapurple"]["displayString"] = "magenta/purple";
	colorArray["magentapurple"]["extraCharge"] = 0;
	colorArray["magentapurple"]["colorNote"] = colorNotes["regular"];
	
	colorArray["redblue"] = Array();
	colorArray["redblue"]["num"] = "901";
	colorArray["redblue"]["displayString"] = "red/blue";
	colorArray["redblue"]["extraCharge"] = 0;
	colorArray["redblue"]["colorNote"] = colorNotes["regular"];
	
	colorArray["goldpurple"] = Array();
	colorArray["goldpurple"]["num"] = "903";
	colorArray["goldpurple"]["displayString"] = "gold/purple";
	colorArray["goldpurple"]["extraCharge"] = 0;
	colorArray["goldpurple"]["colorNote"] = colorNotes["regular"];
	
	dualColor = Array();
	dualColor["magentapurple"] = Array();
	dualColor["magentapurple"]["displayString"]          = "magenta/purple";
	dualColor["magentapurple"]["color1"]                 = colorArray["magenta"]["num"];
	dualColor["magentapurple"]["color1displayString"]    = colorArray["magenta"]["displayString"];
	dualColor["magentapurple"]["color2"]                 = colorArray["purple"]["num"];
	dualColor["magentapurple"]["color2displayString"]    = colorArray["purple"]["displayString"];
	dualColor["magentapurple"]["colorNum"]               = "902";
	dualColor["redblue"] = Array();
	dualColor["redblue"]      ["displayString"]          = "red/blue";
	dualColor["redblue"]      ["color1"]                 = colorArray["red"]["num"];
	dualColor["redblue"]      ["color1displayString"]    = colorArray["red"]["displayString"];
	dualColor["redblue"]      ["color2"]                 = colorArray["blue"]["num"];
	dualColor["redblue"]      ["color2displayString"]    = colorArray["blue"]["displayString"];
	dualColor["redblue"]      ["colorNum"]               = "901";
	dualColor["goldpurple"] = Array();
	dualColor["goldpurple"]   ["displayString"]          = "gold/purple";
	dualColor["goldpurple"]   ["color1"]                 = colorArray["goldenyellow"]["num"];
	dualColor["goldpurple"]   ["color1displayString"]    = colorArray["goldenyellow"]["displayString"];
	dualColor["goldpurple"]   ["color2"]                 = colorArray["purple"]["num"];
	dualColor["goldpurple"]   ["color2displayString"]    = colorArray["purple"]["displayString"];
	dualColor["goldpurple"]   ["colorNum"]               = "903";

}



function initGlobals() {
/* alert("in initGlobals"); */
	declareDesigns();

	/* M I X   ' n   M A T C H */
	/* set design1 to "FON" for default */
	/* set design2 to "FOF" for default */
	/* set design1Color1 to "magenta" for default */
	/* set design1Color2 to "magentapurple" for default */
	/* set design2Color1 to "purple" for default */
	/* set design2Color2 to "magentapurple" for default */
	document.formDesign1.design.value = document.formDesign1.design.options[0].value; /*design1 default */
	document.formDesign2.design.value = document.formDesign1.design.options[9].value; /*design2 default */
	document.formDesign1Color1.color.value = document.formDesign1Color1.color.options[1].value; /* d1c1 default */
/* alert(document.formDesign1Color1.color.value); */
	document.formDesign1Color2.color.value = document.formDesign1Color2.color.options[1].value; /* d1c2 default */
	document.formDesign2Color1.color.value = document.formDesign2Color1.color.options[7].value; /* d1c1 default */
	document.formDesign2Color2.color.value = document.formDesign2Color2.color.options[1].value; /* d1c2 default */
	var xxcurrPrice = document.getElementById("currPrice");
/* alert(xxcurrPrice); */
	xxcurrPrice.firstChild.nodeValue = "Your price: $" + "29.00";
/* alert(xxcurrPrice.firstChild.nodeValue); */

	/* set div color1 choices visible, color2 choices hidden for default */
	changeDiv("design1Color1","block");
/* alert("done with first changeDiv"); */
	changeDiv("design1Color2","none");
	changeDiv("design2Color1","block");
	changeDiv("design2Color2","none");
/* alert("done with changeDivs"); */

	declareColors();

	/* M I X   ' n   M A T C H */
	/* initialize final choice array with default values */
	/* colorNum is string of color number(s) for Product ID */
	/* colorImage is string of color number(s) used in image filename */
	/* for dual color products, these are the same: "004006" */
	/* for single color products, these differ: "004000" vs "004" */
	pcXSide1 = Array();
	pcXSide1["designAbbr"]  =                   document.formDesign1.design.value;
	pcXSide1["designName"]  = product["pcases"][document.formDesign1.design.value]["descr"];
	pcXSide1["colorScheme"] = product["pcases"][document.formDesign1.design.value]["colorScheme"];
	pcXSide1["color1Name"]  =                   document.formDesign1Color1.color.value;
	pcXSide1["color1displayString"]  =          colorArray[pcXSide1["color1Name"]]["displayString"];
	pcXSide1["color1Num"]   =        colorArray[document.formDesign1Color1.color.value]["num"] + "000";
	pcXSide1["color1Image"] =        colorArray[document.formDesign1Color1.color.value]["num"];
	pcXSide1["color2Name"]  =                   document.formDesign1Color2.color.value;
	pcXSide1["color2displayString"] = dualColor[document.formDesign1Color2.color.value]["displayString"]
	pcXSide1["color2Num"]   =         dualColor[document.formDesign1Color2.color.value]["color1"] + 
	                                  dualColor[document.formDesign1Color2.color.value]["color2"];
	pcXSide1["color2Image"] = pcXSide1["color2Num"];
	pcXSide1["customText"] = CUS["descr"];

	pcXSide2 = Array();
	pcXSide2["designAbbr"]  =                   document.formDesign2.design.value;
	pcXSide2["designName"]  = product["pcases"][document.formDesign2.design.value]["descr"];
	pcXSide2["colorScheme"] = product["pcases"][document.formDesign2.design.value]["colorScheme"];
	pcXSide2["color1Name"]  =                   document.formDesign2Color1.color.value;
	pcXSide2["color1displayString"]  =          colorArray[pcXSide2["color1Name"]]["displayString"];
	pcXSide2["color1Num"]   =        colorArray[document.formDesign2Color1.color.value]["num"] + "000";
	pcXSide2["color1Image"] =        colorArray[document.formDesign2Color1.color.value]["num"];
	pcXSide2["color2Name"]  =                   document.formDesign2Color2.color.value;
	pcXSide2["color2displayString"] = dualColor[document.formDesign2Color2.color.value]["displayString"];
	pcXSide2["color2Num"]   =         dualColor[document.formDesign2Color2.color.value]["color1"] + 
	                                  dualColor[document.formDesign2Color2.color.value]["color2"];
	pcXSide2["color2Image"] = pcXSide2["color2Num"];
	pcXSide2["customText"] = CUS["descr"];
	
	finalChoice = Array();
	finalChoice["pcSide1"] = pcXSide1;
	finalChoice["pcSide2"] = pcXSide2;

	/* set images after all other default values have been established */
	/* M I X   ' n   M A T C H */
	displayDesign(1);  displayDesign(2);

/* END of initGlobals */
}



function initGlobalsCM() {
/* alert("in initGlobalsCM"); */
	declareDesigns();

	/* C U S T O M   M E S S A G E */
	/* set design1 to "CUS" for default */
	/* set design2 to "CUS" for default */
	/*   - hard code to "CUS" instead of mix'nmatch variable scheme */
	/* set design1Color1 to "magenta" for default */
	/* set design2Color1 to "purple" for default */
/* alert("before doc sets"); */
	document.formDesign1CM.design.value = pcase["CUS"]; /*design1 default */
	document.formDesign2CM.design.value = pcase["CUS"]; /*design2 default */
	document.formDesign1Color1CM.color.value = document.formDesign1Color1CM.color.options[1].value; /* d1c1 default */
/* alert(document.formDesign1Color1CM.color.value); */
	document.formDesign2Color1CM.color.value = document.formDesign2Color1CM.color.options[9].value; /* d1c1 default */
	document.formCUS1CM.customText.value = CUS["descr"];
	document.formCUS2CM.customText.value = CUS["descr"];
	var xxcurrPriceCM = document.getElementById("currPriceCM");
	xxcurrPriceCM.firstChild.nodeValue = "Your price: $" + "29.00";

	/* set div color1 choices visible, color2 choices hidden for default */
	changeDiv("design1Color1CM","block");
	changeDiv("design2Color1CM","block");
	changeDiv("side1CUSCM","block");
	changeDiv("side2CUSCM","block");
/* alert("done with CM changeDivs"); */

	declareColors();

	/* C U S T O M   M E S S A G E */
	/* initialize final choice CM (custom msg) array with default values */
	/* colorNum is string of color number(s) for Product ID */
	/* colorImage is string of color number(s) used in image filename */
	/* for dual color products, these are the same: "004006" */
	/* for single color products, these differ: "004000" vs "004" */
	pcXCMSide1 = Array();
	pcXCMSide1["designAbbr"]  = "CUS";
/* alert("starting pcXCMSide1"); */
/* alert(pcXCMSide1["designAbbr"]); */
	pcXCMSide1["designName"]  = product["pcases"]["CUS"]["descr"];
	pcXCMSide1["colorScheme"] = product["pcases"]["CUS"]["colorScheme"];
	pcXCMSide1["color1Name"]  =                   document.formDesign1Color1CM.color.value;
	pcXCMSide1["color1displayString"] = colorArray[pcXCMSide1["color1Name"]]["displayString"];
	pcXCMSide1["color1Num"]   =         colorArray[document.formDesign1Color1CM.color.value]["num"] + "000";
	pcXCMSide1["color1Image"] =         colorArray[document.formDesign1Color1CM.color.value]["num"];
	pcXCMSide1["color2Name"]  =         "magentapurple";
	pcXCMSide1["color2displayString"] = colorArray[pcXCMSide1["color2Name"]]["displayString"];
	pcXCMSide1["color2Num"]   =         dualColor[pcXCMSide1["color2Name"]]["color1"] + 
	                                    dualColor[pcXCMSide1["color2Name"]]["color2"];
	pcXCMSide1["color2Image"] = pcXCMSide1["color2Num"];
	pcXCMSide1["customText"]  = CUS["descr"];

	pcXCMSide2 = Array();
	pcXCMSide2["designAbbr"]  = "CUS";
	pcXCMSide2["designName"]  = product["pcases"]["CUS"]["descr"];
	pcXCMSide2["colorScheme"] = product["pcases"]["CUS"]["colorScheme"];
	pcXCMSide2["color1Name"]  =                   document.formDesign2Color1CM.color.value;
	pcXCMSide2["color1displayString"] = colorArray[pcXCMSide2["color1Name"]]["displayString"];
	pcXCMSide2["color1Num"]   =         colorArray[document.formDesign2Color1CM.color.value]["num"] + "000";
	pcXCMSide2["color1Image"] =         colorArray[document.formDesign2Color1CM.color.value]["num"];
	pcXCMSide2["color2Name"]  =         "magentapurple";
	pcXCMSide2["color2displayString"] = colorArray[pcXCMSide2["color2Name"]]["displayString"];
	pcXCMSide2["color2Num"]   =         dualColor[pcXCMSide2["color2Name"]]["color1"] + 
	                                    dualColor[pcXCMSide2["color2Name"]]["color2"];
	pcXCMSide2["color2Image"] = pcXCMSide2["color2Num"];
	pcXCMSide2["customText"]  = CUS["descr"];

	finalChoiceCM = Array();
	finalChoiceCM["pcSide1"] = pcXCMSide1;
	finalChoiceCM["pcSide2"] = pcXCMSide2;

	/* set images after all other default values have been established */
	/* C U S T O M   M E S S A G E */
	displayDesignCM(1);  displayDesignCM(2);

/* END of initGlobalsCM */
}



	/* M I X   ' n   M A T C H */
function setupColor(whichSide) {
	var xxdesignAbbr = document.getElementById("formDesign" + whichSide).design.value;
	finalChoice["pcSide" + whichSide]["designAbbr"] = xxdesignAbbr;
	finalChoice["pcSide" + whichSide]["designName"] = product["pcases"][xxdesignAbbr]["descr"];
	finalChoice["pcSide" + whichSide]["colorScheme"] = product["pcases"][xxdesignAbbr]["colorScheme"];
/* alert("front of setupColor"); alert(finalChoice["pcSide" + whichSide]["designAbbr"]); alert(finalChoice["pcSide" + whichSide]["designName"]); alert(finalChoice["pcSide" + whichSide]["colorScheme"]); */
	var whichColorDiv = product["pcases"][xxdesignAbbr]["colorScheme"];
	document.getElementById("design" + whichSide + "Color1").style.display = "none";
	document.getElementById("design" + whichSide + "Color2").style.display = "none";
	if (whichColorDiv == "1" || whichColorDiv == "2") {
		document.getElementById("design" + whichSide + "Color" + whichColorDiv).style.display = "block";
	}
	displayDesign(whichSide);
}


	/* C U S T O M   M E S S A G E */
function setupColorCM(whichSide) {
	var xxdesignAbbr = document.getElementById("formDesign" + whichSide + "CM").design.value;
	finalChoiceCM["pcSide" + whichSide]["designAbbr"] = xxdesignAbbr;
	finalChoiceCM["pcSide" + whichSide]["designName"] = product["pcases"][xxdesignAbbr]["descr"];
	finalChoiceCM["pcSide" + whichSide]["colorScheme"] = product["pcases"][xxdesignAbbr]["colorScheme"];
/* alert("front of setupColor"); alert(finalChoice["pcSide" + whichSide]["designAbbr"]); alert(finalChoice["pcSide" + whichSide]["designName"]); alert(finalChoice["pcSide" + whichSide]["colorScheme"]); */
	var whichColorDiv = product["pcases"][xxdesignAbbr]["colorScheme"];
	document.getElementById("design" + whichSide + "Color1CM").style.display = "none";
	document.getElementById("design" + whichSide + "Color2CM").style.display = "none";
	if (whichColorDiv == "1" || whichColorDiv == "2") {
		document.getElementById("design" + whichSide + "Color" + whichColorDiv + "CM").style.display = "block";
	}
	displayDesignCM(whichSide);
}



	/* M I X   ' n   M A T C H */
function displayDesign(whichSide) {
	/* we have finalChoice designAbbr, designName, colorScheme */
	/* let's set finalChoice color1Name or color2Name based on */
	/*     the color that was just set right before this routine was called */
	var xxColorScheme = finalChoice["pcSide" + whichSide]["colorScheme"];
	var xxColorName = document.getElementById("formDesign" + whichSide + "Color" + xxColorScheme).color.value;
	finalChoice["pcSide" + whichSide]["color" + xxColorScheme + "Name"] = xxColorName;

	/* if CUS design is chosen,				*/
	/* 		save custom text in finalChoice	*/
	/*		show custom text form 			*/
	if (finalChoice["pcSide" + whichSide]["designAbbr"] == "CUS") {
		finalChoice["pcSide" + whichSide]["customText"] = document.getElementById("formCUS" + whichSide).customText.value;
		finalChoice["pcSide" + whichSide]["designName"] = document.getElementById("formCUS" + whichSide).customText.value;
		changeDiv("side" + whichSide + "CUS","block");
	}
	/* else hide custom text form */
	else {changeDiv("side" + whichSide + "CUS","none");
	}

	if (xxColorScheme == "1") {
		var xxColorImage = colorArray[xxColorName]["num"];
		var xxColorNum = xxColorImage + "000";
		finalChoice["pcSide" + whichSide]["color" + xxColorScheme + "displayString"] = colorArray[xxColorName]["displayString"];
	}
	if (xxColorScheme == "2") {
		var xxColorImage = dualColor[xxColorName]["color1"] + dualColor[xxColorName]["color2"];
		var xxColorNum = xxColorImage;
		finalChoice["pcSide" + whichSide]["color" + xxColorScheme + "displayString"] = dualColor[xxColorName]["displayString"];
	}
	finalChoice["pcSide" + whichSide]["color" + xxColorScheme + "Name"] = xxColorName;
	finalChoice["pcSide" + whichSide]["color" + xxColorScheme + "Num"] = xxColorNum;
	finalChoice["pcSide" + whichSide]["color" + xxColorScheme + "Image"] = xxColorImage;

	/* setup PayPal order info before image is displayed */
	buildPayPalStrings();

	/* display image & description */
	var imageString = finalChoice["pcSide" + whichSide]["designAbbr"] + xxColorImage + ".jpg";
/* alert(imageString); */
	var fullImageString = "../productImages/" + imageString;
/* alert(fullImageString); */
	var placeholder = document.getElementById("placeholder" + whichSide);
	
	/* set image and description string */
	placeholder.setAttribute("src",fullImageString);

/*	append colorNote and designNote if they're not blank */
/*     if colorNote not blank, then display       */
/*         if designNote not blank, then display  */
/*     else if designNote not blank, then display */
/* alert("MnM pcase stuff"); */
/* alert(colorArray[xxColorName]["colorNote"]); */
/* alert(pcase[finalChoice["pcSide" + whichSide]["designAbbr"]]["designNote"]); */

	/* initialize Note */
	document.getElementById("description" + whichSide).firstChild.nodeValue = "";

	if (colorArray[xxColorName]["colorNote"] != "") {
/* alert("arrived 1"); alert(colorArray[xxColorName]["colorNote"]); */
		document.getElementById("description" + whichSide).firstChild.nodeValue = colorArray[xxColorName]["colorNote"] + "  ";
		if (pcase[finalChoice["pcSide" + whichSide]["designAbbr"]]["designNote"] != "") {
/* alert("arrived 2"); alert(pcase[finalChoice["pcSide" + whichSide]["designAbbr"]]["designNote"]); */
			document.getElementById("description" + whichSide).firstChild.nodeValue = document.getElementById("description" + whichSide).firstChild.nodeValue + pcase[finalChoice["pcSide" + whichSide]["designAbbr"]]["designNote"];
		}

/* changing from:   else if (pcase["designAbbr"]["designNote"] != null) */
/* to:              else if (pcase[finalChoice["pcSide" + whichSide]["designAbbr"]]["designNote"] != null) */
	} else if (pcase[finalChoice["pcSide" + whichSide]["designAbbr"]]["designNote"] != "") {
/* alert("arrived 3"); alert(pcase[finalChoice["pcSide" + whichSide]["designAbbr"]]["designNote"]); */
		document.getElementById("description" + whichSide).firstChild.nodeValue = pcase[finalChoice["pcSide" + whichSide]["designAbbr"]]["designNote"];
	}

}



	/* C U S T O M   M E S S A G E */
function displayDesignCM(whichSide) {
/* alert("in displayDesignCM"); */
	/* we have finalChoiceCM designAbbr, designName, colorScheme */
	/* let's set finalChoiceCM color1Name or color2Name based on */
	/*     the color that was just set right before this routine was called */
	var xxColorScheme = finalChoiceCM["pcSide" + whichSide]["colorScheme"];
	var xxColorName = document.getElementById("formDesign" + whichSide + "Color" + xxColorScheme + "CM").color.value;
	finalChoiceCM["pcSide" + whichSide]["color" + xxColorScheme + "Name"] = xxColorName;

	/* if CUS design is chosen,				*/
	/* 		save custom text in finalChoice	*/
	/*		show custom text form 			*/
	if (finalChoiceCM["pcSide" + whichSide]["designAbbr"] == "CUS") {
		finalChoiceCM["pcSide" + whichSide]["customText"] = document.getElementById("formCUS" + whichSide + "CM").customText.value;
		finalChoiceCM["pcSide" + whichSide]["designName"] = document.getElementById("formCUS" + whichSide + "CM").customText.value;
/* alert("after designName"); */
		changeDiv("side" + whichSide + "CUSCM","block");
	}
	/* else hide custom text form */
	else {changeDiv("side" + whichSide + "CUSCM","none");
	}

	if (xxColorScheme == "1") {
		var xxColorImage = colorArray[xxColorName]["num"];
		var xxColorNum = xxColorImage + "000";
		finalChoiceCM["pcSide" + whichSide]["color" + xxColorScheme + "displayString"] = colorArray[xxColorName]["displayString"];
/* alert("in if xxColorScheme is 1"); */
	}
	if (xxColorScheme == "2") {
		var xxColorImage = dualColor[xxColorName]["color1"] + dualColor[xxColorName]["color2"];
		var xxColorNum = xxColorImage;
		finalChoiceCM["pcSide" + whichSide]["color" + xxColorScheme + "displayString"] = dualColor[xxColorName]["displayString"];
	}
	finalChoiceCM["pcSide" + whichSide]["color" + xxColorScheme + "Name"] = xxColorName;
	finalChoiceCM["pcSide" + whichSide]["color" + xxColorScheme + "Num"] = xxColorNum;
	finalChoiceCM["pcSide" + whichSide]["color" + xxColorScheme + "Image"] = xxColorImage;
/* alert("after setting finalChoiceCM stuff"); */

	/* setup PayPal order info before image is displayed */
	buildPayPalStringsCM();

/* alert("after PayPalStrings"); */

	/* display image & description */
	var imageString = finalChoiceCM["pcSide" + whichSide]["designAbbr"] + xxColorImage + ".jpg";
/* alert(imageString); */
	var fullImageString = "../productImages/" + imageString;
/* alert(fullImageString); */
	var placeholderCM = document.getElementById("placeholder" + whichSide + "CM");
	
	/* set image and description string */
	placeholderCM.setAttribute("src",fullImageString);

/*	append colorNote and designNote if they're not blank */
/*     if colorNote not blank, then display       */
/*         if designNote not blank, then display  */
/*     else if designNote not blank, then display */
/* alert("in stuck place"); */
/* alert(colorArray[xxColorName]["colorNote"]); */
/* alert(pcase[finalChoiceCM["pcSide" + whichSide]["designAbbr"]]["designNote"]); */
/* alert(pcase[finalChoice["pcSide" + whichSide]["designAbbr"]]["designNote"]); */

	/* initialize Note */
	document.getElementById("descriptionCM" + whichSide).firstChild.nodeValue = "";

	if (colorArray[xxColorName]["colorNote"] != "") {
/* alert("arrived 1"); alert(colorArray[xxColorName]["colorNote"]); */
		document.getElementById("descriptionCM" + whichSide).firstChild.nodeValue = colorArray[xxColorName]["colorNote"] + "  ";
		if (pcase[finalChoiceCM["pcSide" + whichSide]["designAbbr"]]["designNote"] != "") {
/* alert("arrived 2"); alert(pcase[finalChoiceCM["pcSide" + whichSide]["designAbbr"]]["designNote"]); */
			document.getElementById("descriptionCM" + whichSide).firstChild.nodeValue = document.getElementById("descriptionCM" + whichSide).firstChild.nodeValue + pcase[finalChoiceCM["pcSide" + whichSide]["designAbbr"]]["designNote"];
		}

/* changing from:   else if (pcase["designAbbr"]["designNote"] != null) */
/* to:              else if (pcase[finalChoice["pcSide" + whichSide]["designAbbr"]]["designNote"] != null) */
	} else if (pcase[finalChoiceCM["pcSide" + whichSide]["designAbbr"]]["designNote"] != "") {
/* alert("arrived 3"); alert(pcase[finalChoiceCM["pcSide" + whichSide]["designAbbr"]]["designNote"]); */
		document.getElementById("descriptionCM" + whichSide).firstChild.nodeValue = pcase[finalChoiceCM["pcSide" + whichSide]["designAbbr"]]["designNote"];
	}

/* alert("exiting displayDesignCM"); */
}



	/* M I X   ' n   M A T C H */
function buildPayPalStrings() {
/* alert("entering buildPayPalStrings"); */

	var xxdesign1Abbr = finalChoice["pcSide1"]["designAbbr"];
	var xxdesign2Abbr = finalChoice["pcSide2"]["designAbbr"];
	var xxdesign1Name = finalChoice["pcSide1"]["designName"];
	var xxdesign2Name = finalChoice["pcSide2"]["designName"];
	/* use colorScheme to access correct color setting */
	var xxdesign1ColorScheme = finalChoice["pcSide1"]["colorScheme"];
	var xxdesign2ColorScheme = finalChoice["pcSide2"]["colorScheme"];
	/* use the right color Name depending on the design's colorScheme */
	var xxrightdesign1ColorDisplayString = finalChoice["pcSide1"]["color" + xxdesign1ColorScheme + "displayString"];
	var xxrightdesign2ColorDisplayString = finalChoice["pcSide2"]["color" + xxdesign2ColorScheme + "displayString"];
	document.formPayPalOrder.item_name.value = "Pcase:" + "\"" + xxdesign1Name + "\"" + " in " + xxrightdesign1ColorDisplayString + " and " + "\"" + xxdesign2Name + "\"" + " in " + xxrightdesign2ColorDisplayString;

/*  should be design1Abbr + design1ColorString + design2Abbr + design2ColorString */
/*    something like HEN004006FSL001000 */
	var xxcolor1Num = finalChoice["pcSide1"]["color" + xxdesign1ColorScheme + "Num"];
	var xxcolor2Num = finalChoice["pcSide2"]["color" + xxdesign2ColorScheme + "Num"];
	document.formPayPalOrder.item_number.value = "Pc" + xxdesign1Abbr + xxcolor1Num + xxdesign2Abbr + xxcolor2Num;

/*	document.formPayPalOrder.amount.value = "00.00"; */
	document.formPayPalOrder.amount.value = pcase["baseCharge"] +
		colorArray[finalChoice["pcSide1"]["color" + xxdesign1ColorScheme + "Name"]]["extraCharge"] + 
		colorArray[finalChoice["pcSide2"]["color" + xxdesign2ColorScheme + "Name"]]["extraCharge"] +
		pcase[xxdesign1Abbr]["extraCharge"] +
		pcase[xxdesign2Abbr]["extraCharge"];

	document.getElementById("currPrice" ).firstChild.nodeValue = "Your price: $" + document.formPayPalOrder.amount.value;
	document.getElementById("itemName"  ).firstChild.nodeValue = "Item Name: "   + document.formPayPalOrder.item_name.value;
/*	document.getElementById("itemNumber").firstChild.nodeValue = "Item Number: " + document.formPayPalOrder.item_number.value; */
}



	/* C U S T O M   M E S S A G E */
function buildPayPalStringsCM() {
/* alert("entering buildPayPalStringsCM"); */

	var xxdesign1Abbr = finalChoiceCM["pcSide1"]["designAbbr"];
	var xxdesign2Abbr = finalChoiceCM["pcSide2"]["designAbbr"];
	var xxdesign1Name = finalChoiceCM["pcSide1"]["designName"];
	var xxdesign2Name = finalChoiceCM["pcSide2"]["designName"];
	/* use colorScheme to access correct color setting */
	var xxdesign1ColorScheme = finalChoiceCM["pcSide1"]["colorScheme"];
	var xxdesign2ColorScheme = finalChoiceCM["pcSide2"]["colorScheme"];
	/* use the right color Name depending on the design's colorScheme */
	var xxrightdesign1ColorDisplayStringCM = finalChoiceCM["pcSide1"]["color" + xxdesign1ColorScheme + "displayString"];
	var xxrightdesign2ColorDisplayStringCM = finalChoiceCM["pcSide2"]["color" + xxdesign2ColorScheme + "displayString"];
	document.formPayPalOrderCM.item_name.value = "Pcase:" + "\"" + xxdesign1Name + "\"" + " in " + xxrightdesign1ColorDisplayStringCM + " and " + "\"" + xxdesign2Name + "\"" + " in " + xxrightdesign2ColorDisplayStringCM;
/* alert(document.formPayPalOrderCM.item_name.value); */

/*  should be design1Abbr + design1ColorString + design2Abbr + design2ColorString */
/*    something like HEN004006FSL001000 */
	var xxcolor1Num = finalChoiceCM["pcSide1"]["color" + xxdesign1ColorScheme + "Num"];
	var xxcolor2Num = finalChoiceCM["pcSide2"]["color" + xxdesign2ColorScheme + "Num"];
	document.formPayPalOrderCM.item_number.value = "Pc" + xxdesign1Abbr + xxcolor1Num + xxdesign2Abbr + xxcolor2Num;

/*	document.formPayPalOrder.amount.value = "00.00"; */
	document.formPayPalOrderCM.amount.value = pcase["baseCharge"] +
		colorArray[finalChoiceCM["pcSide1"]["color" + xxdesign1ColorScheme + "Name"]]["extraCharge"] + 
		colorArray[finalChoiceCM["pcSide2"]["color" + xxdesign2ColorScheme + "Name"]]["extraCharge"] +
		pcase[xxdesign1Abbr]["extraCharge"] +
		pcase[xxdesign2Abbr]["extraCharge"];

/* alert("before setting currPriceCM and itemNameCM"); */
	document.getElementById("currPriceCM").firstChild.nodeValue = "Your price: $" + document.formPayPalOrderCM.amount.value;
/* alert(document.getElementById("currPriceCM").firstChild.nodeValue); */
	document.getElementById("itemNameCM").firstChild.nodeValue = "Item Name: "   + document.formPayPalOrderCM.item_name.value;
/* alert(document.getElementById("itemNameCM").firstChild.nodeValue); */
/*	document.getElementById("itemNumber").firstChild.nodeValue = "Item Number: " + document.formPayPalOrder.item_number.value; */
/* alert("exiting buildPayPalStringsCM"); */
}

