function getInfoForCookie(){
	cartCookie = ""
	for (var c = 1; c <= 4; c++){
		cartCookie +=  "Row" + c + ","
		cartCookie += document.orderform["itemDsp" + c].options[document.orderform["itemDsp" + c].selectedIndex].value  + ","
		cartCookie += document.orderform["quan" + c].value + ","
		cartCookie += document.orderform["itemFabric" + c].value + ","
		cartCookie += document.orderform["itemLace" + c].value + ","
		cartCookie += document.orderform["itemSize" + c].value + ","
		cartCookie += document.orderform["itemCost" + c].value + ","
		cartCookie += document.orderform["total" + c].value
		cartCookie += "|"
	}
		setCookie("cartCookies",cartCookie,1);
}

function getCookie(){
	var readCookie = document.cookie;
	readCookie = readCookie.replace("cartCookies=", "")
	readCookie = readCookie.replace("%2C%20", "%2C")
	readCookieFirstSplit = (unescape(readCookie).split("|"))
	for (var rcf = 0; rcf < readCookieFirstSplit.length - 1; rcf++){
		readCookieSecondSplit = (readCookieFirstSplit[rcf].split(","))
		for (var i = 0; i < document.orderform["itemDsp" + (rcf + 1)].options.length; i++){
			if (document.orderform["itemDsp" + (rcf + 1)].options[i].value == readCookieSecondSplit[1]){
				document.orderform["itemDsp" + (rcf + 1)].options[i].selected = true;
   		}
		}
		change((rcf +1 ));
		document.orderform["quan" + (rcf + 1)].value = readCookieSecondSplit[2]
		document.orderform["itemFabric" + (rcf + 1)].value= readCookieSecondSplit[3]
		document.orderform["itemLace" + (rcf + 1)].value = readCookieSecondSplit[4]
		document.orderform["itemSize" + (rcf + 1)].value = readCookieSecondSplit[5]
		document.orderform["itemCost" + (rcf + 1)].value = readCookieSecondSplit[6]
		document.orderform["total" + (rcf + 1)].value = readCookieSecondSplit[7]
		updateTotal((rcf + 1));
	}
}

function setCookie(NameOfCookie, value, expiredays){
	var ExpireDate = new Date ();
	ExpireDate.setTime(ExpireDate.getTime() + (expiredays * 24 * 3600 * 1000));
	document.cookie = NameOfCookie + "=" + escape(value) + ((expiredays == null) ? "" : "; expires=" + ExpireDate.toGMTString());
}


function decodeSearchString() {
   var nameValue = new Array();
   var searchStr = unescape(location.search.substring(1));
   if (searchStr) {
       var formElement = searchStr.split("&");
       var tmpArray = new Array();
       for (k = 0; k < formElement.length; k++) {
            tmpArray = formElement[k].split("=");
            nameValue[tmpArray[0]] = tmpArray[1];
       }
   }
   return nameValue
}

var srchData = decodeSearchString();

function Items(name, styleName, fabricColors, laceColors, sizes, prices){
	this.name = name
	this.styleName = styleName
	this.fabricColors = fabricColors
	this.laceColors = laceColors
	this.sizes = sizes
	this.prices = prices
}

var itemArray = new Array();
itemArray[0] = new Items("Byars","(Christening Gown) -- Byars", "White", "Ecru:White", "NB-9mths", "1500.00")
itemArray[1] = new Items("Laney","(Christening Gown) -- Laney", "White", "Ecru", "NB-9mths", "850.00")
itemArray[2] = new Items("Taylor","(Christening Gown) -- Taylor", "White", "White", "NB-9mths", "650.00")
itemArray[3] = new Items("Peggy","(Christening Gown) -- Peggy", "White", "White", "NB-9mths", "398.00")
itemArray[4] = new Items("Liza Robbins","(Portrait Dress) -- Liza Robbins", "White:Ecru:Pink:Blue", "Ecru:White", "2-4:6-8", "700.00:800.00")
itemArray[5] = new Items("Sally","(Portrait Dress) -- Sally", "White:Ecru:Pink:Blue", "Ecru:White", "2-3:4-5", "550.00:575.00")
itemArray[6] = new Items("Elizabeth","(Heirloom Dress) -- Elizabeth", "White:Ecru:Pink:Blue:Yellow", "Ecru:White", "1-4:4-8", "450.00:500.00")
itemArray[7] = new Items("Laurie","(Flower Girl Dress) -- Laurie", "Blue:White:Pink:Ecru:Yellow", "Ecru:White", "1-3:4-8", "380.00:450.00")
itemArray[8] = new Items("Sealy","(Ruffle and Lace Gown) -- Sealy", "Pink Ruffle:Blue Ruffle:White Ruffle:Ecru Ruffle", "White", "NB-6mths", "125.00")
itemArray[9] = new Items("MarciaG","(Smocked Day Gown) -- Marcia", "Pink:Blue:White:Yellow", "Ecru:White", "NB-6mths", "125.00")
itemArray[10] = new Items("MarciaS","(Smocked Day Gown Slip) -- Marcia", "Pink:Blue:White:Yellow", "None", "NB-6mths", "23.00")
itemArray[11] = new Items("AshleyG","(Smocked Day Gown) -- Ashley", "White:Pink:Blue:Yellow", "Ecru:White", "NB-6mths", "125.00")
itemArray[12] = new Items("AshleyS","(Smocked Day Gown Slip) -- Ashley", "White:Pink:Blue:Yellow", "None", "NB-6mths", "23.00")
itemArray[13] = new Items("Monogram Curley","(Babys Toy Bag) -- Monogram Curley", "Pink:Blue:Yellow:Red:Royal", "Gingham", "Monogram Curley", "59.00")
itemArray[14] = new Items("Monogram Cursive","(Babys Toy Bag) -- Monogram Cursive", "Pink:Blue:Yellow:Red:Royal", "Gingham", "Monogram Cursive", "59.00")
itemArray[15] = new Items("CJ400","(Beauty Pins) -- CJ400", "Gold Plated", "None", "CJ400", "12.00")
itemArray[16] = new Items("CJ407","(Beauty Pins) -- CJ407", "Gold Plated", "None", "CJ407", "12.00")
itemArray[17] = new Items("CJ413","(Beauty Pins) -- CJ413", "Gold Plated", "None", "CJ413", "12.00")
itemArray[18] = new Items("BlanketSealy","(Blanket) -- Sealy", "White", "None", " Infants - 6 months", "45.00")
itemArray[19] = new Items("BonnetByars", "(Bonnet) -- Byars", "White:Swiss", "Ecru:White", "NB-9mths", "150.00")
itemArray[20] = new Items("BonnetLaney","(Bonnet) -- Laney", "White", "Ecru", "NB-9mths", "65.00")
itemArray[21] = new Items("BonnetTalyor","(Bonnet) -- Talyor", "White", "White", "NB-9mths", "60.00")
itemArray[22] = new Items("BonnetSealy","(Bonnet) -- Sealy", "White", "None", " Infants - 6 months", "55.00")
itemArray[23] = new Items("BurpPadByars", "(Burp Pad) -- Byars", "White:Swiss", "Ecru:White", "NB-9mths", "45.00")
itemArray[24] = new Items("BurpPadLaney","(Burp Pad) -- Laney", "White", "Ecru", "NB-9mths", "35.00")
itemArray[25] = new Items("BurpPadTalyor","(Burp Pad) -- Talyor", "White", "White", "NB-9mths", "30.00")
itemArray[26] = new Items("DiaperCoverByars", "(Diaper Cover) -- Byars", "White:Swiss", "Ecru:White", "NB-9mths", "35.00")
itemArray[27] = new Items("DiaperCoverLaney","(Diaper Cover) -- Laney", "White", "Ecru", "NB-9mths", "35.00")
itemArray[28] = new Items("DiaperCoverTalyor","(Diaper Cover) -- Talyor", "White", "White", "NB-9mths", "35.00")

function fabricColors(i ,rowNum){
	if(itemArray[i].fabricColors.indexOf(":")== -1){
		ClearOptions(document.orderform["itemFabric" + rowNum]);
		AddToOptionList(document.orderform["itemFabric" + rowNum], itemArray[i].fabricColors, itemArray[i].fabricColors);
	}else{
		var fabricColorSplit = (itemArray[i].fabricColors.split(":"))
		ClearOptions(document.orderform["itemFabric" + rowNum]);
		for (var f = 0; f < fabricColorSplit.length; f++){
			AddToOptionList(document.orderform["itemFabric" + rowNum], fabricColorSplit[f], fabricColorSplit[f]);
		}
	}
}

function laceColors(i, rowNum){
	if(itemArray[i].laceColors.indexOf(":")== -1){
		ClearOptions(document.orderform["itemLace" + rowNum]);
		AddToOptionList(document.orderform["itemLace" + rowNum], itemArray[i].laceColors, itemArray[i].laceColors);
	}else{
		var laceColorSplit = (itemArray[i].laceColors.split(":"))
		ClearOptions(document.orderform["itemLace" + rowNum]);
		for (var l = 0; l < laceColorSplit.length; l++){
			AddToOptionList(document.orderform["itemLace" + rowNum], laceColorSplit[l], laceColorSplit[l]);
		}
	}
}

function size(i, rowNum){
	if(itemArray[i].sizes.indexOf(":")== -1){
	ClearOptions(document.orderform["itemSize" + rowNum]);
	AddToOptionList(document.orderform["itemSize" + rowNum], itemArray[i].prices, itemArray[i].sizes);
	document.orderform["itemSize" + rowNum].options[1].selected = true
	document.orderform["itemCost" + rowNum].value = itemArray[i].prices
	}else{
		var sizeSplit = (itemArray[i].sizes.split(":"))
		var priceSplit = (itemArray[i].prices.split(":"))
		ClearOptions(document.orderform["itemSize" + rowNum]);
		for (var s = 0; s < sizeSplit.length; s++){
			AddToOptionList(document.orderform["itemSize" + rowNum], priceSplit[s], sizeSplit[s]);
			document.orderform["itemSize" + rowNum].options[1].selected = true
			document.orderform["itemCost" + rowNum].value = priceSplit[1]
		}
	}
	checkForMono();
}

function checkForMono(){
	for (var csz = 1; csz <= 4; csz++){
		if (document.orderform["itemSize" + csz].options[document.orderform["itemSize" + csz].selectedIndex].text.substr(0,8) == "Monogram"){
			document.getElementById("monogram").style.visibility = "visible";
			break;
		}
	document.getElementById("monogram").style.visibility = "hidden";
	document.orderform.monogramInfo.value = "";
	}
}

function displayItems(){
	for (var i = 0; i < itemArray.length; i++){
		document.write(
		"Item no " + (i+1) + ":<br>"+
		"Style Name: " + itemArray[i].styleName + "<br>"
		);
		fabricColors(i);
		laceColors(i);
		size(i);		
		price(i);
		document.write("<br><br>");
	}
}


function AddToOptionList(OptionList, OptionValue, OptionText) {
	OptionList[OptionList.length] = new Option(OptionText, OptionValue);
}

function ClearOptions(OptionList) {
   for (x = OptionList.length; x >= 0; x = x - 1) {
		OptionList[(x + 1)] = null;
   }
}

function changePrice(rowNum){
	sizeInfo = document.orderform["itemSize" + rowNum].value
	document.orderform["itemCost" + rowNum].value = sizeInfo
	cost1 = document.orderform["quan" + rowNum].value * document.orderform["itemCost" + rowNum].value
	document.orderform["total" + rowNum].value = cost1 + ".00"
	var sTotal = document.orderform.total1.value + "+" + document.orderform.total2.value + "+" + document.orderform.total3.value + "+" + document.orderform.total4.value
	sTotal = eval(sTotal)
	var total = sTotal + ".00"
	document.orderform.subTotal.value = total
	GRandTotal = total + ".00"
	GRandTotal = parseInt(GRandTotal)
	if(GRandTotal > 50.00 && GRandTotal < 99.00 ){
		document.orderform.shipping.value = "12.00"
		GRandTotal = GRandTotal + 12.00
	}
	if(GRandTotal > 100.00 && GRandTotal < 200.00 ){
		document.orderform.shipping.value = "14.00"
		GRandTotal = GRandTotal + 14.00
	}
	if(GRandTotal > 200.00){
		document.orderform.shipping.value = "25.00"
		GRandTotal = GRandTotal + 25.00
	}
	if (GRandTotal < 50.00){
		document.orderform.shipping.value = "0.00"
	}
	document.orderform.grandTotal.value = (GRandTotal + ".00")
}

function change(rowNum){
	itemInfo = document.orderform["itemDsp" + rowNum].options[document.orderform["itemDsp" + rowNum].selectedIndex].value
	if(document.orderform["itemDsp" + rowNum].options[document.orderform["itemDsp" + rowNum].selectedIndex].text == "Select an Item"){
		document.orderform["quan" + rowNum].value = "0"
		ClearOptions(document.orderform["itemFabric" + rowNum]);
		ClearOptions(document.orderform["itemLace" + rowNum]);
		ClearOptions(document.orderform["itemSize" + rowNum]);
		document.orderform["itemFabric" + rowNum].selectedIndex = 0
		document.orderform["itemLace" + rowNum].selectedIndex = 0
		document.orderform["itemSize" + rowNum].selectedIndex = 0
		document.orderform.shipping.value = "0.00"
		checkForMono();
		
	}else{
		document.orderform["quan" + rowNum].value = "1"
	}
		
	for(var i = 0; i < itemArray.length; i++){
		if (itemArray[i].styleName == itemInfo){
			fabricColors(i,rowNum);
			laceColors(i, rowNum);
			size(i, rowNum);
		}
	}
	if (document.orderform["itemDsp" + rowNum].options[document.orderform["itemDsp" + rowNum].selectedIndex].text.substr(0,15) == "(Babys Toy Bag)"){
		document.orderform["itemLace" + rowNum].selectedIndex = 1
	}
	if (document.orderform["itemDsp" + rowNum].options[document.orderform["itemDsp" + rowNum].selectedIndex].text.substr(0,13) == "(Beauty Pins)"){
		document.orderform["itemFabric" + rowNum].selectedIndex = 1
		document.orderform["itemLace" + rowNum].selectedIndex = 1
	}
	if (document.orderform["itemDsp" + rowNum].options[document.orderform["itemDsp" + rowNum].selectedIndex].text == "(Smocked Day Gown Slip) -- Ashley"){
		document.orderform["itemLace" + rowNum].selectedIndex = 1
	}
	if (document.orderform["itemDsp" + rowNum].options[document.orderform["itemDsp" + rowNum].selectedIndex].text == "(Smocked Day Gown Slip) -- Marcia"){
		document.orderform["itemLace" + rowNum].selectedIndex = 1
	}
	if (document.orderform["itemDsp" + rowNum].options[document.orderform["itemDsp" + rowNum].selectedIndex].text == "(Bonnet) -- Sealy"){
		document.orderform["itemLace" + rowNum].selectedIndex = 1
	}
	if (document.orderform["itemDsp" + rowNum].options[document.orderform["itemDsp" + rowNum].selectedIndex].text == "(Blanket) -- Sealy"){
		document.orderform["itemLace" + rowNum].selectedIndex = 1
	}
	changePrice(rowNum);
}

function updateTotal(rowNum){
	cost1 = document.orderform["quan" + rowNum].value * document.orderform["itemCost" + rowNum].value
	document.orderform["total" + rowNum].value = cost1 + ".00"
	var sTotal = document.orderform.total1.value + "+" + document.orderform.total2.value + "+" + document.orderform.total3.value + "+" + document.orderform.total4.value
	sTotal = eval(sTotal)
	total = sTotal + ".00"
	document.orderform.subTotal.value = total
	GRandTotal = total + ".00"
	GRandTotal = parseInt(GRandTotal)
	if(GRandTotal > 50.00 && GRandTotal < 99.00 ){
		document.orderform.shipping.value = "12.00"
		GRandTotal = GRandTotal + 12.00
	}
	if(GRandTotal > 100.00 && GRandTotal < 200.00 ){
		document.orderform.shipping.value = "14.00"
		GRandTotal = GRandTotal + 14.00
	}
	if(GRandTotal > 200.00){
		document.orderform.shipping.value = "25.00"
		GRandTotal = GRandTotal + 25.00
	}
	if (GRandTotal < 50.00){
		document.orderform.shipping.value = "0.00"
	}
	document.orderform.grandTotal.value = (GRandTotal + ".00")
}


function printOf(){
	window.print()
}


function loadOrder(){
	document.getElementById("monogram").style.visibility = "hidden";
	for (var nl = 1; nl <= 4; nl++){
		for (var no = 0; no < itemArray.length; no++){
			AddToOptionList(document.orderform["itemDsp" + nl], itemArray[no].styleName, itemArray[no].styleName)
		}
	}
	getCookie();
	if (location.search){
		newItem = srchData.items.replace("+"," ")
		if (newItem){
		outerloop:
			for (var rowNum = 1; rowNum <= 4; rowNum++){
				itemInfo = document.orderform["itemDsp" + rowNum].options[document.orderform["itemDsp" + rowNum].selectedIndex].text
				if (itemInfo == "Select an Item"){
					for(var i = 0; i < itemArray.length; i++){
						if (itemArray[i].name == newItem){
							alert ("Liza Robbins " + i)
							document.orderform["itemDsp" + rowNum].value = itemArray[i].styleName
							document.orderform["quan" + rowNum].value = 1
							fabricColors(i,rowNum);
							laceColors(i,rowNum);
							size(i, rowNum);
							changePrice(rowNum);
							getInfoForCookie();
							location.replace("order.html")
							break outerloop;
						}
					}
				}else{
					if (rowNum == 4){
						alert("Your Shopping Cart is full.")
						location.replace("order.html")
						break;
					}
				}
			}
		}
	}
}

function restAll(){
	for(var i = 1; i <= 4; i++){
		ClearOptions(document.orderform["itemFabric" + i]);
		ClearOptions(document.orderform["itemLace" + i]);
		ClearOptions(document.orderform["itemSize" + i]);
	}
	document.orderform.shipping.value = "0.00"
}

function printForm(){
			this.Person = printPersonOrder;
			this.Order = printOrder;
}

function printPersonOrder(){
	if (srchData.Name){
		document.write("Name: " + srchData.Name.replace("+", " ") + "<br/>");
		document.write("<input name=\"Name\" type=\"hidden\" value=\"Name: "+ srchData.Name.replace("+", " ") + "\">");
	}else{
		document.write("<font color=\"Red\">Name is Missing</font><br/>")
	}
	if (srchData.Address){
		if (srchData.AptNumber){
			address = srchData.Address.split("+")
			document.write("Address1: ")
			complete_address = ""
			for (var a1 = 0 ; a1 < address.length; a1++){
				document.write(address[a1] + " " )
				complete_address += address[a1] + " "
			}
			document.write("<input name=\"Address\" type=\"hidden\" value=\"Address: "+ complete_address + "\">");
			document.write("Apt No#: " + srchData.AptNumber + "<br/>");			
			document.write("<input name=\"AptNumber\" type=\"hidden\" value=\"Apt#: "+ srchData.AptNumber.replace("+", " ") + "\">");
		}else{
			address = srchData.Address.split("+")
			document.write("Address1: ")
			complete_address = ""
			for (var a2 = 0 ; a2 < address.length; a2++){
				document.write(address[a2] + " " )
				complete_address += address[a2] + " "
			}
			document.write("<br/>")
			document.write("<input name=\"Address\" type=\"hidden\" value=\"Address: "+ complete_address + "\">");
		}
	}else{
		document.write("<font color=\"Red\">Street Name is Missing</font><br/>");
	}
	if (srchData.City && srchData.State && srchData.Zip){
		document.write("Address2: ")
		document.write("<input name=\"City\" type=\"hidden\" value=\"City: "+ srchData.City.replace("+", " ") + "\">");
		city = srchData.City.split("+")
		for (var c = 0; c < city.length; c++){
			document.write(city[c] + " ")
		}
		document.write(srchData.State + ", "  + srchData.Zip + "<br/>");
		document.write("<input name=\"State\" type=\"hidden\" value=\"State: "+ srchData.State.replace("+", " ") + "\">");
		document.write("<input name=\"Zip\" type=\"hidden\" value=\"Zip: "+ srchData.Zip.replace("+", " ") + "\">");
	}else{
		document.write("<font color=\"Red\">Full Address is required</font><br/>");
	}
	if (srchData.PhoneNumber){
		document.write("Phone Number:  (" + srchData.PhoneNumber.substr(0,3) + ") " + srchData.PhoneNumber.substr(3,3) + "-" + srchData.PhoneNumber.substr(6) + "<br/>");
		document.write("<input name=\"PhoneNumber\" type=\"hidden\" value=\"Phone: (" + srchData.PhoneNumber.substr(0,3) + ") " + srchData.PhoneNumber.substr(3,3) + "-" + srchData.PhoneNumber.substr(6) + "\">");
	}else{
		document.write("<font color=\"Red\">Phone Number is Missing</font><br/>");
	}
	if (srchData.Email){
		var RegExp = /^.+\@[A-Za-z0-9\-\.]+\.[A-Za-z]{2,3}$/;
 		if(!RegExp.test(srchData.Email)) {
  			document.write("<font color=\"Red\">Invalid Email Address!</font><br/>");
		}else{
			document.write("Email: " + srchData.Email + "<br/>")
			document.write("<input name=\"Email\" type=\"hidden\" value=\"" + srchData.Email + "\">");
		}
	}else{
		document.write("<font color=\"Red\">Email Address is Missing</font><br/><br/>");
	}
	document.write("<input name=\"Name_Divider\" type=\"hidden\" value=\"-------------------------------\">");
}

function printOrder(){
	for (var i = 1; i <= 4; i++){
		if ((srchData["itemDsp" + i]) !== "0"){
			document.write("Item Description: ")
			dsp = srchData["itemDsp" + i].split("+");
			itemDsp = "";
			for (var d = 0; d < dsp.length; d++){
				itemDsp += dsp[d] + " "	
			}
			itemDsp = itemDsp.substr(0,(itemDsp.length - 1))
			document.write(itemDsp + " ")
			document.write("<br/>");
			document.write("<input name=\"Item" + i + "\" type=\"hidden\" value=\"Item: "+ itemDsp + "\">");
			document.write("Quantity: " + (srchData["quan" + i]) + "<br/>");
			document.write("<input name=\"Quantity" + i + "\" type=\"hidden\" value=\"Quantity: "+ (srchData["quan" + i]) + "\">");
			if (itemDsp.substr(0,15) == "(Babys Toy Bag)"){
				document.write("Fabric Color: " + (srchData["itemFabric" + i]).replace("+", " " ) + " (Gingham)<br/>");
				document.write("<input name=\"Fabric_Color" + i + "\" type=\"hidden\" value=\"Fabric Color: "+ (srchData["itemFabric" + i]).replace("+", " " ) + "(Gingham)\">");
			}else{
				if (itemDsp.substr(0,13) == "(Beauty Pins)"){
					document.write("Style Color : " + (srchData["itemFabric" + i]).replace("+", " " ) + "<br/>");
					document.write("<input name=\"Style_Color" + i + "\" type=\"hidden\" value=\"Style Color: "+ (srchData["itemFabric" + i]).replace("+", " " ) + "\">");
				}else{
					if ((srchData["itemFabric" + i])!== "Fabric+Color"){
						document.write("Fabric Color: " + (srchData["itemFabric" + i]).replace("+", " " ) + "<br/>");
						document.write("<input name=\"Fabric_Color" + i + "\" type=\"hidden\" value=\"Fabric Color: "+ (srchData["itemFabric" + i]).replace("+", " " ) + "\">");
					}else{
						document.write("<font color=\"Red\">No Fabric Color Specified </font><br/>");
					}
				}
			}
			if (itemDsp.substr(0,15) == "(Babys Toy Bag)"){
				//nothing
			}else{
				if (itemDsp.substr(0,13) == "(Beauty Pins)"){
					//nothing
				}else{	
					if ((srchData["itemLace" + i]) !== "Lace+Color"){
						document.write("Lace Color: " + (srchData["itemLace" + i]).replace("+", " " ) + "<br/>");
						document.write("<input name=\"Lace_Color" + i + "\" type=\"hidden\" value=\"Lace Color:  "+ (srchData["itemLace" + i]).replace("+", " " ) + "\">");
					}else{
						document.write("<font color=\"Red\">No Lace Color Specified</font><br/>");
					}
				}
			}
			
			if (itemDsp.substr(0,13) == "(Beauty Pins)"){
			//nothing
			}else{	
				for (var s = 0; s < itemArray.length; s++){
					dsp = srchData["itemDsp" + i].split("+");
					itemDsp = "";
					for (var d = 0; d < dsp.length; d++){
						itemDsp += dsp[d] + " "	
					}
					itemDsp = itemDsp.substr(0,(itemDsp.length - 1))
					//alert (itemDsp.length)
					if (itemArray[s].styleName == itemDsp){
						var sSplit = itemArray[s].sizes.split(":")
						var pSplit = itemArray[s].prices.split(":")
						for (var ps = 0; ps < pSplit.length; ps++){
							if (pSplit[ps] == (srchData["itemSize" + i])){
								if (itemDsp.substr(0,15) == "(Babys Toy Bag)"){
									document.write("Style: " + sSplit[ps] + "<br/>");
									document.write("<input name=\"Style" + i + "\" type=\"hidden\" value=\"Style: "+ sSplit[ps] + "\">");
								}else{
									document.write("Size: " + sSplit[ps] + "<br/>");
									document.write("<input name=\"Size" + i + "\" type=\"hidden\" value=\"Size: "+ sSplit[ps] + "\">");
								}
							}
						}
					}
				}
			}
			document.write("Total:  $" + currency((srchData["total" + i])) + "<br/><br/>");
			document.write("<input name=\"Total" + i + "\" type=\"hidden\" value=\"Total: $"+  currency((srchData["total" + i])) + "\">");
			document.write("<input name=\"Divider" + i + "\" type=\"hidden\" value=\"-------------------------------\">");
		}
	}
	if (srchData.monogramInfo){
	document.write("-----------------------------------------------------------------------------------------------<br/>")
		mono = srchData.monogramInfo.split("+");
		if(mono){
			complete_monogram = ""
			for (var i = 0; i < mono.length; i++){
				complete_monogram += mono[i] + " "	
			}
			document.write("Monogram Info: " + complete_monogram+ "<br/>");
			document.write("<input name=\"Monogram\" type=\"hidden\" value=\"Monogram: "+ complete_monogram + "\">");
			document.write("<input name=\"Monogram_Divider\" type=\"hidden\" value=\"-------------------------------\">");			
		}else{
			document.write("Monogram Info: " + srchData.monogramInfo + "<br/>");
			document.write("<input name=\"Monogram\" type=\"hidden\" value=\"Monogram: "+ srchData.monogramInfo + "\">");
			document.write("<input name=\"Monogram_Divider\" type=\"hidden\" value=\"-------------------------------\">");	
		}
	}
	document.write("-----------------------------------------------------------------------------------------------")
}

function infoTop(){
	var p = new printForm();
	if (location.search){
		var printP = p.Person();
	}
}

function infoMid(){
	var p = new printForm();
	if (location.search){
		var printF = p.Order();
	}else{
		document.write("<br/><br/><a href=\"http://www.elegantheirloomsbymattie.com\"><input type=\"button\" value=\"You have reach this page by error click here to goto Elegant Heirlooms by Mattie\"></a>")
	}
}

function infoBot(){
	if (location.search){
		if (srchData.grandTotal !== "0.00"){
			document.write("SUBTOTAL: $" + currency(srchData.subTotal) + "<br/>");
			document.write("<input name=\"SubTotal\" type=\"hidden\" value=\"SubTotal: $"+ currency(srchData.subTotal) + "\">");
			document.write("+ SHIPPING: $" + srchData.shipping + "<br/>");
			document.write("<input name=\"Shipping\" type=\"hidden\" value=\"Shipping: $"+ currency(srchData.shipping) + "\">");
			document.write("----------------------------------<br/>");
			document.write("<font size=\"6\" color=\"Red\">TOTAL:  $" + currency(srchData.grandTotal) + "</font><br/>");
			document.write("<input name=\"Grand_Total\" type=\"hidden\" value=\"GrandTotal: $"+ currency(srchData.grandTotal) + "\">");
		}
		document.write("<input type=\"button\" value=\"Back\" onclick=\"javascript:location.replace('order.html')\"><input type=\"button\" name=\"Button\" value=\"Print Order\" onClick=\"printOf()\"><input type=\"Submit\" name=\"Send Order\" value=\"Send Order\"  onClick=\"return confirm(\'Are you sure?\')\">");
	}
}

function continueShopping (){
		location.replace("index.html")

}

function removeTotal(rowNum){
	document.orderform["itemDsp" + rowNum].options[0].selected = true
	document.orderform["quan" + rowNum].value = "0"
	ClearOptions(document.orderform["itemFabric" + rowNum]);
	ClearOptions(document.orderform["itemLace" + rowNum]);
	ClearOptions(document.orderform["itemSize" + rowNum]);
	document.orderform["itemFabric" + rowNum].selectedIndex = 0
	document.orderform["itemLace" + rowNum].selectedIndex = 0
	document.orderform["itemSize" + rowNum].selectedIndex = 0
	changePrice(rowNum);
}

function currency(anynum){
   anynum=eval(anynum)
   workNum=Math.abs((Math.round(anynum*100)/100));workStr=""+workNum
   if (workStr.indexOf(".")==-1){workStr+=".00"}
   dStr=workStr.substr(0,workStr.indexOf("."));dNum=dStr-0
   pStr=workStr.substr(workStr.indexOf("."))
   while (pStr.length<3){pStr+="0"}

   if (dNum>=1000) {
      dLen=dStr.length
      dStr=parseInt(""+(dNum/1000))+","+dStr.substring(dLen-3,dLen)
   }

   if (dNum>=1000000) {
      dLen=dStr.length
      dStr=parseInt(""+(dNum/1000000))+","+dStr.substring(dLen-7,dLen)
   }
   retval = dStr + pStr 
   if (anynum<0) {retval="("+retval+")"}
   return retval
}