var intCurrentStep = new Number(1);
var arrAlbumNotComplite = new Array();
window.onload = function() {
	for (var i=0; i < document.getElementsByTagName('table').length; i++) {
		if (document.getElementsByTagName('table')[i].className.toString().indexOf('classTextTable') != -1) {
			for (var j=0; j < document.getElementsByTagName('table')[i].getElementsByTagName('tr').length; j++) {
				if (j==0) {
					document.getElementsByTagName('table')[i].getElementsByTagName('tr')[j].className += ' classTextTableRowIndex';
				} else if (Math.ceil(j/2) == j/2) {
					document.getElementsByTagName('table')[i].getElementsByTagName('tr')[j].className += ' classTextTableRowGray';
				} else {
					document.getElementsByTagName('table')[i].getElementsByTagName('tr')[j].className += ' classTextTableRowWhite';
				}
				if (j==document.getElementsByTagName('table')[i].getElementsByTagName('tr').length-1) {
					document.getElementsByTagName('table')[i].getElementsByTagName('tr')[j].className += ' classTextTableBorder';
				}
			}
		}
		if (document.getElementsByTagName('table')[i].className.toString().indexOf('classTextTableSmall') != -1) {
			for (var j=0; j < document.getElementsByTagName('table')[i].getElementsByTagName('tr').length; j++) {
				if (j==0) {
					document.getElementsByTagName('table')[i].getElementsByTagName('tr')[j].className += ' classTextTableSmallRowIndex';
				} else if (Math.ceil(j/2) == j/2) {
					document.getElementsByTagName('table')[i].getElementsByTagName('tr')[j].className += ' classTextTableSmallRowGray';
				} else {
					document.getElementsByTagName('table')[i].getElementsByTagName('tr')[j].className += ' classTextTableSmallRowWhite';
				}
				if (j==document.getElementsByTagName('table')[i].getElementsByTagName('tr').length-1) {
					document.getElementsByTagName('table')[i].getElementsByTagName('tr')[j].className += ' classTextTableBorder';
				}
			}
		}
	}
	if (document.getElementById('idnFolderList')) {
		for (var i=0; i < document.getElementById('idnFolderList').getElementsByTagName('div').length; i++) {
			if (document.getElementById('idnFolderList').getElementsByTagName('div')[i].className.toString().indexOf('classFolderEnable') != -1) {
				document.getElementById('idnFolderList').getElementsByTagName('div')[i].onmouseover = fncFolderChangeImage;
				document.getElementById('idnFolderList').getElementsByTagName('div')[i].onmouseout = fncFolderChangeImage;
			} else if (document.getElementById('idnFolderList').getElementsByTagName('div')[i].className.toString().indexOf('classFolderDisable') != -1) {
				document.getElementById('idnFolderList').getElementsByTagName('div')[i].style.opacity = 0.5;
				document.getElementById('idnFolderList').getElementsByTagName('div')[i].style.filter = "alpha(opacity:50)";
			}
		}
	}

	if (document.getElementById('idnProductTable')) {
		for (var i=0; i < document.getElementById('idnProductTable').getElementsByTagName('div').length; i++) {
			document.getElementById('idnProductTable').getElementsByTagName('div')[i].onmouseover = fncMouseOver;
			document.getElementById('idnProductTable').getElementsByTagName('div')[i].onmouseout = fncMouseOut;
		}
	}

	for (var i=0; i < document.getElementsByTagName('img').length; i++) {
		if (document.getElementsByTagName('img')[i].getAttribute('hover')) {
			document.getElementsByTagName('img')[i].onmouseover = fncMenuChangeImage;
			document.getElementsByTagName('img')[i].onmouseout = fncMenuChangeImage;
		}
	}
	for (var i=0; i < document.getElementsByTagName('input').length; i++) {
		if (document.getElementsByTagName('input')[i].getAttribute('hover')) {
			document.getElementsByTagName('input')[i].onmouseover = fncMenuChangeImage;
			document.getElementsByTagName('input')[i].onmouseout = fncMenuChangeImage;
		}
	}
}
function fncFolderChangeImage(evnt) {
	for (var i=0; i < this.parentNode.getElementsByTagName('div').length; i++) {
		if (this != this.parentNode.getElementsByTagName('div')[i] && this.parentNode.getElementsByTagName('div')[i].innerHTML.toString().indexOf('spacer') == -1) {
			this.parentNode.getElementsByTagName('div')[i].getElementsByTagName('img')[0].src = this.parentNode.getElementsByTagName('div')[i].getElementsByTagName('img')[0].src.toString().replace('folders/bg','spacer');
		}
	}
	if (this.innerHTML.toString().indexOf('spacer') != -1) {
		this.getElementsByTagName('img')[0].src = this.getElementsByTagName('img')[0].src.toString().replace('spacer','folders/bg');
	} else {
		this.getElementsByTagName('img')[0].src = this.getElementsByTagName('img')[0].src.toString().replace('folders/bg','spacer');
	}
}
function fncMouseOver(evnt) {
	if (this.className.toString().indexOf('classProductBorder') == -1) {
		this.className += ' classProductBorder';
	}
}
function fncMouseOut(evnt) {
	while (this.className.toString().indexOf('classProductBorder') != -1) {
		this.className = this.className.toString().replace('classProductBorder','');
	}
}
function fncMenuChangeImage(evnt) {
	if (this.src.toString().indexOf(this.getAttribute('hover')) != -1) {
		this.src = this.src.toString().replace(this.getAttribute('hover'),'');
	} else {
		this.src = this.src.toString().replace(".gif",this.getAttribute('hover')+".gif");
	}
}
function fncSelectFile(strMode) {
	switch(strMode) {
		case 'select':
			for (var i=0; i < document.getElementById('idnFileList').getElementsByTagName('input').length; i++) {
				document.getElementById('idnFileList').getElementsByTagName('input')[i].checked = true;
			}
		break;
		case 'move':
			var blnFlag = new Boolean(false);
			for (var i=0; i < document.getElementById('idnFileList').getElementsByTagName('input').length; i++) {
				if (document.getElementById('idnFileList').getElementsByTagName('input')[i].checked) {
					blnFlag = new Boolean(true);
				}
			}
			if (blnFlag == false) {
				alert('Please. Select any photo(s).');
				return;
			}
			document.getElementById('idnFileListDiv').style.display = 'none';
			document.getElementById('idnFolderList').style.display = 'block';
		break;
		case 'delete':
			if (window.confirm('Are you sure you want to delete?')) {
				document.getElementById('idnFolderMode').value = 'delete';
				document.getElementById('idnFormFolder').submit();
			}
		break;
		default:
			for (var i=0; i < document.getElementById('idnFileList').getElementsByTagName('input').length; i++) {
				document.getElementById('idnFileList').getElementsByTagName('input')[i].checked = false;
			}
		break;
	}
}
function fncMoveFolder(strFolder) {
	document.getElementById('idnFolderName').value = strFolder;
	document.getElementById('idnFormFolder').submit();
}
function PreparePriceList(strPaymantType, arrPaymantData) {
	switch (strPaymantType) {
		case 'PaymentType17':
			var arrDataSetList = document.getElementById('cell'+strPaymantType).getElementsByTagName('div');
			for (var i=0; i < arrDataSetList.length; i++) {
				if (arrDataSetList[i].getAttribute('name') && arrDataSetList[i].getAttribute('name') == 'dataSet') {
					if (!arrDataSetList[i].getAttribute('param3')) {
						arrAlbumNotComplite[arrAlbumNotComplite.length] = arrDataSetList[i];
					}

					var objPriceSetting = document.createElement('div');
					objPriceSetting.className = 'classDataSet';
					var objPriceTable = document.createElement('table');

					for (var j=0; j<arrPaymantData.length; j++) {
						var objRow = objPriceTable.insertRow(j);

						var objCell = objRow.insertCell(0);
						var objinput = document.createElement('input');
						objinput.setAttribute('type', 'radio');
						objinput.setAttribute('name', arrDataSetList[i].getAttribute('id').toString().replace('dataSetID','type'));
						objinput.setAttribute('value', arrPaymantData[j]['PAPERTYPEID']);
						if (
								arrDataSetList[i].getAttribute('param1') && arrDataSetList[i].getAttribute('param1') == arrPaymantData[j]['PAPERTYPEID'] ||
								(!arrDataSetList[i].getAttribute('param1') || arrDataSetList[i].getAttribute('param1') && arrDataSetList[i].getAttribute('param1') == '') && j == 0
						) {
							objinput.setAttribute('checked', 'true');
						}
						Event.observe(objinput, 'click', DrawSize);
						objCell.appendChild(objinput);

						var objCell = objRow.insertCell(1);
						var objText = document.createTextNode(arrPaymantData[j]['PAPERNAME']);
						objCell.appendChild(objText);

						if (
								arrDataSetList[i].getAttribute('param1') && arrDataSetList[i].getAttribute('param1') == arrPaymantData[j]['PAPERTYPEID'] ||
								(!arrDataSetList[i].getAttribute('param1') || arrDataSetList[i].getAttribute('param1') && arrDataSetList[i].getAttribute('param1') == '') && j == 0
						) {
							var objCell = objRow.insertCell(2);
							objCell.className = 'classPaddingLeft20 classCellDataSet';
							var objSizeSelect = document.createElement('select');
							objSizeSelect.setAttribute('name', arrDataSetList[i].getAttribute('id').toString().replace('dataSetID','size'));
							objSizeSelect.className = 'classSelectDataSet';
							for (var k=0; k<arrPaymantData[j]['SIZEPARAM'].length; k++) {
								var objOption = document.createElement('option');
								objOption.setAttribute('value', arrPaymantData[j]['SIZEPARAM'][k][0]);
								var objText = document.createTextNode(arrPaymantData[j]['SIZEPARAM'][k][1]);
								objOption.appendChild(objText);
								if (
										arrDataSetList[i].getAttribute('param2') && arrDataSetList[i].getAttribute('param2') == arrPaymantData[j]['SIZEPARAM'][k][0] ||
										(!arrDataSetList[i].getAttribute('param2') || arrDataSetList[i].getAttribute('param2') && arrDataSetList[i].getAttribute('param2') == '') && k == 0
								) {
									objOption.setAttribute('selected', 'true');
								}
								objOption.setAttribute('price', arrPaymantData[j]['SIZEPARAM'][k][2]);
								objSizeSelect.appendChild(objOption);
							}
							Event.observe(objSizeSelect, 'change', ChangePrice);
							objCell.appendChild(objSizeSelect);
						}
					}

					var objRow = objPriceTable.insertRow(j);
					var objCell = objRow.insertCell(0);
					objCell.colSpan = 3;
					objCell.className = 'classEvent';
					Event.observe(objCell, 'click', ChangeAlbumSettings);

					if (arrDataSetList[i].getAttribute('param3')) {
						objTextNode = document.createTextNode('Edit Your Album Order');
						objCell.className += ' classColorGreen';
					} else {
						objTextNode = document.createTextNode('Make the album');
						objCell.className += ' classColorRed';
					}
					objCell.appendChild(objTextNode);

					objPriceSetting.appendChild(objPriceTable);
					arrDataSetList[i].appendChild(objPriceSetting);
				}			
			}			
		break;
		case 'PaymentType15':
			var arrDataSetList = document.getElementById('cell'+strPaymantType).getElementsByTagName('div');
			for (var i=0; i < arrDataSetList.length; i++) {
				if (arrDataSetList[i].getAttribute('name') && arrDataSetList[i].getAttribute('name') == 'dataSet') {
					var objInput = document.createElement('input');
					objInput.setAttribute('type', 'hidden');
					objInput.setAttribute('name', arrDataSetList[i].getAttribute('id').toString().replace('dataSetID','type'));
					objInput.setAttribute('id', arrDataSetList[i].getAttribute('id').toString()+'PackagePriceID');
					arrDataSetList[i].appendChild(objInput);

					for (var k=0; k<arrPaymantData.length; k++) {
						var objPaymentDiv = document.createElement('div');
						objPaymentDiv.className = 'classPaymentType15';

						var objSubPaymentImg = new Image(70, 160);
						objSubPaymentImg.src = '/images/paymenttype15/'+arrPaymantData[k]['TYPEID'].toString().split(' ')[0]+'.jpg';
						objSubPaymentImg.alt = arrPaymantData[k]['TYPENAME'];
						objSubPaymentImg.className = 'classPaymentTypeImg15';
						objSubPaymentImg.setAttribute('price', arrPaymantData[k]['TYPEPRICE']);
						objSubPaymentImg.setAttribute('id', arrPaymantData[k]['TYPEID']);
						Event.observe(objSubPaymentImg, 'click', ChangePackage);
						
						if (
								arrDataSetList[i].getAttribute('param1') && arrDataSetList[i].getAttribute('param1') == arrPaymantData[k]['TYPEID'] ||
								(!arrDataSetList[i].getAttribute('param1') || arrDataSetList[i].getAttribute('param1') && arrDataSetList[i].getAttribute('param1') == '') && k == 0
						) {
							objSubPaymentImg.className = 'classPaymentType15Selected';

							if (document.getElementById(arrDataSetList[i].getAttribute('id').toString()+'PackagePriceID')) {
								document.getElementById(arrDataSetList[i].getAttribute('id').toString()+'PackagePriceID').value = arrPaymantData[k]['TYPEID'];
							}

							document.getElementById('COUNTPACKAGEPRINTENG'+arrDataSetList[i].getAttribute('id').toString().replace('dataSetID','')).setAttribute('price', arrPaymantData[k]['TYPEPRICE']);
						}
						objPaymentDiv.appendChild(objSubPaymentImg);
						arrDataSetList[i].appendChild(objPaymentDiv);
					}
					var objPaymentDiv = document.createElement('div');
					objPaymentDiv.className = 'classPaymentType15End';
					arrDataSetList[i].appendChild(objPaymentDiv);
				}
			}
		break;
		case 'PaymentType16':
			var arrDataSetList = document.getElementById('cell'+strPaymantType).getElementsByTagName('div');
			for (var i=0; i < arrDataSetList.length; i++) {
				if (arrDataSetList[i].getAttribute('name') && arrDataSetList[i].getAttribute('name') == 'dataSet') {
					var objInput = document.createElement('input');
					objInput.setAttribute('type', 'hidden');
					objInput.setAttribute('name', arrDataSetList[i].getAttribute('id').toString().replace('dataSetID','size'));
					objInput.setAttribute('id', arrDataSetList[i].getAttribute('id').toString()+'PriceID');
					arrDataSetList[i].appendChild(objInput);

					var objPhotoTable = arrDataSetList[i].getElementsByTagName('table')[0];
					var arrPhotoTableRow = objPhotoTable.getElementsByTagName('tr');
					for (var j=0; j<arrPhotoTableRow.length; j++) {
						arrPhotoTableRow[j].deleteCell(2);
						arrPhotoTableRow[j].deleteCell(1);
					}
					var objRow = objPhotoTable.insertRow(j);
					var objCell = objRow.insertCell(0);
					objCell.className = 'classPadding10';

					var objRow = objPhotoTable.insertRow(j+1);
					var objCell = objRow.insertCell(0);
					objCell.setAttribute('colspan', '2');
					var objText = document.createTextNode('Price $');
					objCell.appendChild(objText);

					var objCell = objRow.insertCell(1);
					objCell.className = 'classFileName classTotalSubPrice';
					objCell.setAttribute('name', 'TotalSubPrice');
					objCell.innerHTML = new Number(1000).toFixed(2);

					var strSelectedPrice = new String('0');
					var objPriceSetting = document.createElement('div');
					objPriceSetting.className = 'classDataSet';
					var objPriceTable = document.createElement('table');
	
					for (var j=0, intRowIndex=0; j<arrPaymantData.length; j++) {
						var objRow = objPriceTable.insertRow(intRowIndex);

						var objCell = objRow.insertCell(0);
						var objinput = document.createElement('input');
						objinput.setAttribute('type', 'radio');
						objinput.setAttribute('name', arrDataSetList[i].getAttribute('id').toString().replace('dataSetID','type'));
						objinput.setAttribute('value', arrPaymantData[j]['PAPERTYPEID']);
						if (
								arrDataSetList[i].getAttribute('param1') && arrDataSetList[i].getAttribute('param1') == arrPaymantData[j]['PAPERTYPEID'] ||
								(!arrDataSetList[i].getAttribute('param1') || arrDataSetList[i].getAttribute('param1') && arrDataSetList[i].getAttribute('param1') == '') && j == 0
						) {
							objinput.setAttribute('checked', 'true');
						}
						Event.observe(objinput, 'click', DrawSubPartfolios);
						objCell.appendChild(objinput);

						var objCell = objRow.insertCell(1);
						var objText = document.createTextNode(arrPaymantData[j]['PAPERNAME']);
						objCell.appendChild(objText);

						if (
								arrDataSetList[i].getAttribute('param1') && arrDataSetList[i].getAttribute('param1') == arrPaymantData[j]['PAPERTYPEID'] ||
								(!arrDataSetList[i].getAttribute('param1') || arrDataSetList[i].getAttribute('param1') && arrDataSetList[i].getAttribute('param1') == '') && j == 0
						) {
							intRowIndex++;

							var objRow = objPriceTable.insertRow(intRowIndex);
							var objCell = objRow.insertCell(0);
							objCell.setAttribute('colspan', '2');

							var objSubPaymentTable = document.createElement('table');
							var objSubPaymentRow = objSubPaymentTable.insertRow(0);
							for (var k=0; k<arrPaymantData[j]['SIZEPARAM'].length; k++) {
								var objSubPaymentCell = objSubPaymentRow.insertCell(k);

								var objSubPaymentImg = new Image(70, 86);
								objSubPaymentImg.src = '/images/paymenttype16/'+arrPaymantData[j]['SIZEPARAM'][k][1].toString().split(' ')[0]+'.jpg';
								objSubPaymentImg.alt = arrPaymantData[j]['SIZEPARAM'][k][1];
								objSubPaymentImg.className = 'classPaymentType16';
								objSubPaymentImg.setAttribute('price', arrPaymentType16[intRowIndex-1]['SIZEPARAM'][k][2]);
								objSubPaymentImg.setAttribute('id', arrPaymentType16[intRowIndex-1]['SIZEPARAM'][k][0]);
								objSubPaymentImg.setAttribute('photoonpage', arrPaymantData[j]['SIZEPARAM'][k][1].toString().split(' ')[0]);
								Event.observe(objSubPaymentImg, 'click', ChangeProofPartfolios);
								objSubPaymentCell.appendChild(objSubPaymentImg);
								
								if (
										arrDataSetList[i].getAttribute('param2') && arrDataSetList[i].getAttribute('param2') == arrPaymantData[j]['SIZEPARAM'][k][0] ||
										(!arrDataSetList[i].getAttribute('param2') || arrDataSetList[i].getAttribute('param2') && arrDataSetList[i].getAttribute('param2') == '') && k == 0
								) {
									objSubPaymentImg.className = 'classPaymentType16Selected';
									strSelectedPrice = arrPaymentType16[intRowIndex-1]['SIZEPARAM'][k][2];

									if (document.getElementById(arrDataSetList[i].getAttribute('id').toString()+'PriceID')) {
										document.getElementById(arrDataSetList[i].getAttribute('id').toString()+'PriceID').value = arrPaymentType16[intRowIndex-1]['SIZEPARAM'][k][0];
									}
								}
							}

							var objSubPaymentRow = objSubPaymentTable.insertRow(1);
							for (var k=0; k<arrPaymantData[j]['SIZEPARAM'].length; k++) {
								var objSubPaymentCell = objSubPaymentRow.insertCell(k);
								objSubPaymentCell.setAttribute('align', 'center');
								switch (k) {
									case 0:
										var objText = document.createTextNode('4UP');
										objSubPaymentCell.appendChild(objText);
									break;
									case 1:
										var objText = document.createTextNode('6UP');
										objSubPaymentCell.appendChild(objText);
									break;
									case 2:
										var objText = document.createTextNode('9UP');
										objSubPaymentCell.appendChild(objText);
									break;
									case 3:
										var objText = document.createTextNode('12UP');
										objSubPaymentCell.appendChild(objText);
									break;
								}
							}
//							Event.observe(objSizeSelect, 'change', ChangePrice);
							objCell.appendChild(objSubPaymentTable);
							
						}
						intRowIndex++;
					}
	
					objPriceSetting.appendChild(objPriceTable);
					arrDataSetList[i].appendChild(objPriceSetting);
					CalclProofPartfolios(null, arrDataSetList[i], strSelectedPrice);
				}			
			}
		break;
		default:
			var arrDataSetList = document.getElementById('cell'+strPaymantType).getElementsByTagName('div');
			for (var i=0; i < arrDataSetList.length; i++) {
				if (arrDataSetList[i].getAttribute('name') && arrDataSetList[i].getAttribute('name') == 'dataSet') {
					var objPriceSetting = document.createElement('div');
					objPriceSetting.className = 'classDataSet';
					var objPriceTable = document.createElement('table');
	
					var objRow = objPriceTable.insertRow(0);
					var objCell = objRow.insertCell(0);

					if (strPaymantType == 'PaymentType14') {
						var objText = document.createTextNode('Canvas');
					} else {
						var objText = document.createTextNode('Paper');
					}
					objCell.appendChild(objText);

					var objCell = objRow.insertCell(1);

					var objCell = objRow.insertCell(2);
					objCell.className = 'classPaddingLeft20 classCellDataSet';
					var objText = document.createTextNode('Size');
					objCell.appendChild(objText);
					
					for (var j=0; j<arrPaymantData.length; j++) {
						var objRow = objPriceTable.insertRow(j+1);
	
						var objCell = objRow.insertCell(0);
						var objinput = document.createElement('input');
						objinput.setAttribute('type', 'radio');
						objinput.setAttribute('name', arrDataSetList[i].getAttribute('id').toString().replace('dataSetID','type'));
						objinput.setAttribute('value', arrPaymantData[j]['PAPERTYPEID']);
						if (
								arrDataSetList[i].getAttribute('param1') && arrDataSetList[i].getAttribute('param1') == arrPaymantData[j]['PAPERTYPEID'] ||
								(!arrDataSetList[i].getAttribute('param1') || arrDataSetList[i].getAttribute('param1') && arrDataSetList[i].getAttribute('param1') == '') && j == 0
						) {
							objinput.setAttribute('checked', 'true');
						}
						Event.observe(objinput, 'click', DrawSize);
	//					Event.observe(objinput, 'change', DrawSize);
						objCell.appendChild(objinput);
	
						var objCell = objRow.insertCell(1);
						var objText = document.createTextNode(arrPaymantData[j]['PAPERNAME']);
						objCell.appendChild(objText);
	
						if (
								arrDataSetList[i].getAttribute('param1') && arrDataSetList[i].getAttribute('param1') == arrPaymantData[j]['PAPERTYPEID'] ||
								(!arrDataSetList[i].getAttribute('param1') || arrDataSetList[i].getAttribute('param1') && arrDataSetList[i].getAttribute('param1') == '') && j == 0
						) {
							var objCell = objRow.insertCell(2);
							objCell.className = 'classPaddingLeft20 classCellDataSet';
							var objSizeSelect = document.createElement('select');
							objSizeSelect.setAttribute('name', arrDataSetList[i].getAttribute('id').toString().replace('dataSetID','size'));
							objSizeSelect.className = 'classSelectDataSet';
							for (var k=0; k<arrPaymantData[j]['SIZEPARAM'].length; k++) {
								var objOption = document.createElement('option');
								objOption.setAttribute('value', arrPaymantData[j]['SIZEPARAM'][k][0]);
								var objText = document.createTextNode(arrPaymantData[j]['SIZEPARAM'][k][1]);
								objOption.appendChild(objText);
								if (
										arrDataSetList[i].getAttribute('param2') && arrDataSetList[i].getAttribute('param2') == arrPaymantData[j]['SIZEPARAM'][k][0] ||
										(!arrDataSetList[i].getAttribute('param2') || arrDataSetList[i].getAttribute('param2') && arrDataSetList[i].getAttribute('param2') == '') && k == 0
								) {
									objOption.setAttribute('selected', 'true');
								}
								objOption.setAttribute('price', arrPaymantData[j]['SIZEPARAM'][k][2]);
								objSizeSelect.appendChild(objOption);
							}
							Event.observe(objSizeSelect, 'change', ChangePrice);
							objCell.appendChild(objSizeSelect);
						}
	
					}
	
					objPriceSetting.appendChild(objPriceTable);

					if (strPaymantType == 'PaymentType10') {
						var objPriceTable = document.createElement('table');

						var objRow = objPriceTable.insertRow(0);
						var objCell = objRow.insertCell(0);

						
						var objRow = objPriceTable.insertRow(1);
						var objCell = objRow.insertCell(0);
						
						var objCell = objRow.insertCell(0);
						var objText = document.createTextNode('no border');
						objCell.appendChild(objText);

						var objCell = objRow.insertCell(1);
						var objinput = document.createElement('input');
						objinput.setAttribute('type', 'radio');
						objinput.setAttribute('name', 'prm4'+arrDataSetList[i].getAttribute('id').toString().replace('dataSetID', ''));
						objinput.setAttribute('value', 'noborder');
						if (
								arrDataSetList[i].getAttribute('param4') != 'withwhiteborder'
						) {
							objinput.setAttribute('checked', 'true');
						}
						objCell.appendChild(objinput);


						var objRow = objPriceTable.insertRow(2);
						var objCell = objRow.insertCell(0);
						
						var objCell = objRow.insertCell(0);
						var objText = document.createTextNode('with white border');
						objCell.appendChild(objText);

						var objCell = objRow.insertCell(1);
						var objinput = document.createElement('input');
						objinput.setAttribute('type', 'radio');
						objinput.setAttribute('name', 'prm4'+arrDataSetList[i].getAttribute('id').toString().replace('dataSetID', ''));
						objinput.setAttribute('value', 'withwhiteborder');
						if (
								arrDataSetList[i].getAttribute('param4') == 'withwhiteborder'
						) {
							objinput.setAttribute('checked', 'true');
						}
						objCell.appendChild(objinput);


						objPriceSetting.appendChild(objPriceTable);
					}

					arrDataSetList[i].appendChild(objPriceSetting);
				}			
			}
		break;
	}
}
function DrawSize(evn) {
	var intSelectedIndex = new Number(0);
	var objDataSetDiv = this;
	var objParentTable = this;
	var objParentRow = this;
	while (objDataSetDiv.nodeName.toString().toLowerCase() != 'div' || !objDataSetDiv.getAttribute('name') || objDataSetDiv.getAttribute('name') && objDataSetDiv.getAttribute('name') != 'dataSet') {
		objDataSetDiv = objDataSetDiv.parentNode;
	}
	while (objParentTable.nodeName.toString().toLowerCase() != 'table') {
		objParentTable = objParentTable.parentNode;
	}
	while (objParentRow.nodeName.toString().toLowerCase() != 'tr') {
		objParentRow = objParentRow.parentNode;
	}
	var arrRowList = objParentTable.getElementsByTagName('tr');
	for (var i=0; i<arrRowList.length; i++) {
		if (arrRowList[i].getElementsByTagName('td').length > 2 && arrRowList[i].getElementsByTagName('select').length > 0) {
			if (arrRowList[i].getElementsByTagName('select').length > 0) {
				intSelectedIndex = arrRowList[i].getElementsByTagName('select')[0].options.selectedIndex;
			}
			arrRowList[i].deleteCell(2);
		}
	}

	var objCell = objParentRow.insertCell(2);
	objCell.className = 'classPaddingLeft20 classCellDataSet';
	var objSizeSelect = document.createElement('select');
	objSizeSelect.setAttribute('name', objDataSetDiv.getAttribute('id').toString().replace('dataSetID','size'));
	objSizeSelect.className = 'classSelectDataSet';

	var objPaymentCell = objParentTable;
	while (objPaymentCell.nodeName.toString().toLowerCase() != 'td') {
		objPaymentCell = objPaymentCell.parentNode;
	}
	var strArrayName = objPaymentCell.id.toString().replace('cell', 'arr');
	var objPaymentArray = eval(strArrayName);

	j = 0;
	for (var k=0; k<objPaymentArray.length; k++) {
		if (objPaymentArray[k]['PAPERTYPEID'] == this.value) {
			j = k;
		}
	}
	for (var k=0; k<objPaymentArray[j]['SIZEPARAM'].length; k++) {
		var objOption = document.createElement('option');
		objOption.setAttribute('value', objPaymentArray[j]['SIZEPARAM'][k][0]);
		var objText = document.createTextNode(objPaymentArray[j]['SIZEPARAM'][k][1]);
		objOption.appendChild(objText);
		if ( intSelectedIndex < objPaymentArray[j]['SIZEPARAM'].length && intSelectedIndex == k || intSelectedIndex > objPaymentArray[j]['SIZEPARAM'].length && k == 0) {
			objOption.setAttribute('selected', 'true');
		}
		objOption.setAttribute('price', objPaymentArray[j]['SIZEPARAM'][k][2]);
		objSizeSelect.appendChild(objOption);
	}

	Event.observe(objSizeSelect, 'change', ChangePrice);
	objCell.appendChild(objSizeSelect);

	ChangePrice.call(objSizeSelect);
}
function ChangePrice(evn) {
	var objDataSetDiv = this;
	var objParentTable = this;
	var objParentRow = this;
	while (objDataSetDiv.nodeName.toString().toLowerCase() != 'div' || !objDataSetDiv.getAttribute('name') || objDataSetDiv.getAttribute('name') && objDataSetDiv.getAttribute('name') != 'dataSet') {
		objDataSetDiv = objDataSetDiv.parentNode;
	}
	while (objParentTable.nodeName.toString().toLowerCase() != 'table') {
		objParentTable = objParentTable.parentNode;
	}
	while (objParentRow.nodeName.toString().toLowerCase() != 'tr') {
		objParentRow = objParentRow.parentNode;
	}

	if (objParentRow.getElementsByTagName('select').length == 0) {
		alert('Error');
		return;
	}
	var objSizeSelect = objParentRow.getElementsByTagName('select')[0];

	var dblPrice = new Number(objSizeSelect.options[objSizeSelect.options.selectedIndex].getAttribute('price'));
	var objItemRowList = objDataSetDiv.getElementsByTagName('table')[0].getElementsByTagName('tr');
	for (var i=1; i<objItemRowList.length; i++) {
		objItemRowList[i].getElementsByTagName('td')[2].innerHTML = (dblPrice * objItemRowList[i].getElementsByTagName('input')[0].value).toFixed(2);
		objItemRowList[i].getElementsByTagName('input')[0].setAttribute('price', dblPrice.toFixed(2));
	}
	CalculateTotal();
}
function ChangePhotoPrice(objInput, strPaymentType) {
	switch(strPaymentType) {
		case 'PaymentType15':
			document.getElementById('idTotalPrice').innerHTML = (objInput.value * objInput.getAttribute('price')).toFixed(2);
			return;
		break;
		case 'PaymentType16':
			
		break;
		default:
			var objParentRow = objInput;
			while (objParentRow.nodeName.toString().toLowerCase() != 'tr') {
				objParentRow = objParentRow.parentNode;
			}
			if (Number(objInput.value) < 0) {
				objInput.value = 1;
			}
			objParentRow.getElementsByTagName('td')[2].innerHTML = (objInput.getAttribute('price') * objInput.value).toFixed(2);
		break;
	}

	CalculateTotal();
}
function CalculateTotal() {
	if (document.getElementById('idTotalPrice')) {
		var dblTotal = new Number(0);
		var arrCellList = document.getElementsByTagName('td');
		for (var i=0; i<arrCellList.length; i++) {
			if (arrCellList[i].getAttribute('name') && arrCellList[i].getAttribute('name') == 'TotalSubPrice') {
				dblTotal += new Number(arrCellList[i].innerHTML);
			}
		}
		document.getElementById('idTotalPrice').innerHTML = dblTotal.toFixed(2);
	}
}
function EraseSubPayment14(evn) {
	var objParentTable = this;
	while (objParentTable.nodeName.toString().toLowerCase() != 'table') {
		objParentTable = objParentTable.parentNode;
	}

	var arrRowList = objParentTable.getElementsByTagName('tr');
	for (var i = arrRowList.length - 1; i>0; i--) {
		if (arrRowList[i].getElementsByTagName('table').length > 0) {
			objParentTable.deleteRow(i);
		}
	}
}
function DrawSubPayment14(evn) {
	AttachSubPayment(this.getAttribute('datasetid'), this.getAttribute('paymenttype'), arrSubPayment14);
}
function AttachSubPayment(strDataSetID, strPaymentType, arrSubPaymentList) {
	var objPaymentTable = document.getElementById(strDataSetID).getElementsByTagName('table')[1];

	var objPaymentRows = objPaymentTable.getElementsByTagName('tr');
	for (var i=0; i<objPaymentRows.length; i++) {
		var objInput = objPaymentRows[i].getElementsByTagName('input')[0];
		if (objPaymentRows[i].getElementsByTagName('td')[1].innerHTML.toString().toLowerCase() == strPaymentType) {
			if (!objInput.getAttribute('ready')) {
				objInput.setAttribute('ready', 'true');
				objInput.setAttribute('datasetid', strDataSetID);
				objInput.setAttribute('paymenttype', strPaymentType);

				Event.observe(objInput, 'click', DrawSubPayment14);
			}
			if (objPaymentRows[i].getElementsByTagName('input')[0].checked) {
				var objRow = objPaymentTable.insertRow(i+1);
				var objCell = objRow.insertCell(0);
				objCell.setAttribute('colspan', '3');
				objCell.className = 'ClassSubPaymentList';
	
				var objPriceTable = document.createElement('table');
				for (var j=0; j<arrSubPaymentList.length; j++) {
					var objRow = objPriceTable.insertRow(j);
	
					var objSubCell = objRow.insertCell(0);
					var objInput = document.createElement('input');
					objInput.setAttribute('type', 'radio');
					objInput.setAttribute('name', 'prm3'+strDataSetID.toString().replace('dataSetID',''));
					objInput.setAttribute('value', arrSubPaymentList[j]);
					if (
							document.getElementById(strDataSetID).getAttribute('param3') && document.getElementById(strDataSetID).getAttribute('param3') == arrSubPaymentList[j] ||
							(!document.getElementById(strDataSetID).getAttribute('param3') || document.getElementById(strDataSetID).getAttribute('param3') && document.getElementById(strDataSetID).getAttribute('param3') == '') && j == 0
					) {
						objInput.setAttribute('checked', 'true');
					}
					objSubCell.appendChild(objInput);
	
					var objSubCell = objRow.insertCell(1);
					var objText = document.createTextNode(arrSubPaymentList[j]);
					objSubCell.appendChild(objText);
				}
				objCell.appendChild(objPriceTable);
			}
		} else {
			if (objInput && !objInput.getAttribute('ready')) {
				objInput.setAttribute('ready', 'true');

				Event.observe(objInput, 'click', EraseSubPayment14);
			}
		}
	}
}
function DrawSubPartfolios(evn) {
	var objParentDataSet = this;
	var objParentTable = this;
	var objParentRow = this;
	while (objParentDataSet.nodeName.toString().toLowerCase() != 'div' || !objParentDataSet.getAttribute('name') || objParentDataSet.getAttribute('name') && objParentDataSet.getAttribute('name') != 'dataSet') {
		objParentDataSet = objParentDataSet.parentNode;
	}
	while (objParentTable.nodeName.toString().toLowerCase() != 'table') {
		objParentTable = objParentTable.parentNode;
	}
	while (objParentRow.nodeName.toString().toLowerCase() != 'tr') {
		objParentRow = objParentRow.parentNode;
	}

	var intCheckedIndex = new Number(0);
	var arrRowList = objParentTable.getElementsByTagName('tr');
	for (var i = arrRowList.length - 1; i>0; i--) {
		if (arrRowList[i].getElementsByTagName('table').length > 0) {
			var arrImages = arrRowList[i].getElementsByTagName('img');
			for (var j=0; j<arrImages.length; j++) {
				if (arrImages[j].className.toString().indexOf('classPaymentType16Selected') != -1) {
					intCheckedIndex = j;
				}
			}
			objParentTable.deleteRow(i);
		}
	}

	var arrRowList = objParentTable.getElementsByTagName('tr');
	for (var i = 0; i < arrRowList.length; i++) {
		if (arrRowList[i] == objParentRow) {
			intRowIndex = i+1;
		}
	}

	var objRow = objParentTable.insertRow(intRowIndex);
	var objCell = objRow.insertCell(0);
	objCell.setAttribute('colspan', '2');

	var strSelectedPrice = new String('');
	var objSubPaymentTable = document.createElement('table');
	var objSubPaymentRow = objSubPaymentTable.insertRow(0);
	for (var k=0; k<arrPaymentType16[intRowIndex-1]['SIZEPARAM'].length; k++) {
		var objSubPaymentCell = objSubPaymentRow.insertCell(k);

		var objSubPaymentImg = new Image(70, 86);
		objSubPaymentImg.src = '/images/paymenttype16/'+arrPaymentType16[intRowIndex-1]['SIZEPARAM'][k][1].toString().split(' ')[0]+'.jpg';
		objSubPaymentImg.alt = arrPaymentType16[intRowIndex-1]['SIZEPARAM'][k][1];
		objSubPaymentImg.setAttribute('price', arrPaymentType16[intRowIndex-1]['SIZEPARAM'][k][2]);
		objSubPaymentImg.setAttribute('id', arrPaymentType16[intRowIndex-1]['SIZEPARAM'][k][0]);
		objSubPaymentImg.setAttribute('photoonpage', arrPaymentType16[intRowIndex-1]['SIZEPARAM'][k][1].toString().split(' ')[0]);
		objSubPaymentImg.className = 'classPaymentType16';
		Event.observe(objSubPaymentImg, 'click', ChangeProofPartfolios);
		objSubPaymentCell.appendChild(objSubPaymentImg);

		if (
			k == intCheckedIndex
		) {
			objSubPaymentImg.className = 'classPaymentType16Selected';
			strSelectedPrice = arrPaymentType16[intRowIndex-1]['SIZEPARAM'][k][2];
		}
	}

	var objSubPaymentRow = objSubPaymentTable.insertRow(1);
	for (var k=0; k<arrPaymentType16[intRowIndex-1]['SIZEPARAM'].length; k++) {
		var objSubPaymentCell = objSubPaymentRow.insertCell(k);
		objSubPaymentCell.setAttribute('align', 'center');
		switch (k) {
			case 0:
				var objText = document.createTextNode('4UP');
				objSubPaymentCell.appendChild(objText);
			break;
			case 1:
				var objText = document.createTextNode('6UP');
				objSubPaymentCell.appendChild(objText);
			break;
			case 2:
				var objText = document.createTextNode('9UP');
				objSubPaymentCell.appendChild(objText);
			break;
			case 3:
				var objText = document.createTextNode('12UP');
				objSubPaymentCell.appendChild(objText);
			break;
		}
	}

//	Event.observe(objSizeSelect, 'change', ChangePrice);
	objCell.appendChild(objSubPaymentTable);

	CalclProofPartfolios(null, objParentDataSet, strSelectedPrice);
}

function ChangeProofPartfolios(evn) {
	var objParentDataSet = this;
	var objParentRow = this;
	while (objParentDataSet.nodeName.toString().toLowerCase() != 'div' || !objParentDataSet.getAttribute('name') || objParentDataSet.getAttribute('name') && objParentDataSet.getAttribute('name') != 'dataSet') {
		objParentDataSet = objParentDataSet.parentNode;
	}
	while (objParentRow.nodeName.toString().toLowerCase() != 'tr') {
		objParentRow = objParentRow.parentNode;
	}

	var arrImages = objParentRow.getElementsByTagName('img');
	for (var i=0; i<arrImages.length; i++) {
		arrImages[i].className = 'classPaymentType16';
	}
	this.className = 'classPaymentType16Selected';

	if (document.getElementById(objParentDataSet.getAttribute('id').toString()+'PriceID')) {
		document.getElementById(objParentDataSet.getAttribute('id').toString()+'PriceID').value = this.getAttribute('id');
	}

	CalclProofPartfolios.call(this);
}
function CalclProofPartfolios(evn, objDataSet, strPrice) {
	var objParentDataSet = null;
	var dblPrice = new Number(0);
	if (objDataSet) {
		objParentDataSet = objDataSet;
		dblPrice = new Number(strPrice);
	} else {
		objParentDataSet = this;
		while (objParentDataSet.nodeName.toString().toLowerCase() != 'div' || !objParentDataSet.getAttribute('name') || objParentDataSet.getAttribute('name') && objParentDataSet.getAttribute('name') != 'dataSet') {
			objParentDataSet = objParentDataSet.parentNode;
		}
		dblPrice = new Number(this.getAttribute('price'));
	}

	var intCount = new Number(0);
	var arrInputList = objParentDataSet.getElementsByTagName('input');
	for (var i=0; i<arrInputList.length; i++) {
		if (arrInputList[i].getAttribute('name') && arrInputList[i].getAttribute('name').toString().indexOf('COUNT') != -1) {
			intCount += Number(arrInputList[i].value);
		}
	}

	var arrCellList = objParentDataSet.getElementsByTagName('td');
	for (var i=0; i<arrCellList.length; i++) {
		if (arrCellList[i].getAttribute('name') && arrCellList[i].getAttribute('name').toString().indexOf('TotalSubPrice') != -1) {

			var intPhotoOnPage = new Number(4);
			var arrImages = objParentDataSet.getElementsByTagName('img');
			for (var j=0; j<arrImages.length; j++) {
				if (arrImages[j].className.toString().indexOf('classPaymentType16Selected') != -1) {
					intPhotoOnPage = new Number(arrImages[j].getAttribute('photoonpage').toString());
					dblPrice = new Number(arrImages[j].getAttribute('price'));
				}
			}

			var intPages = new Number(((intCount / intPhotoOnPage)).ceil());
			arrCellList[i].innerHTML = (dblPrice * intPages).toFixed(2);
		}
	}

	CalculateTotal();
}

function ChangePackage(evn) {
	var objParentDataSet = this;
	while (objParentDataSet.nodeName.toString().toLowerCase() != 'div' || !objParentDataSet.getAttribute('name') || objParentDataSet.getAttribute('name') && objParentDataSet.getAttribute('name') != 'dataSet') {
		objParentDataSet = objParentDataSet.parentNode;
	}

	var strDataSetID = objParentDataSet.getAttribute('id').toString().replace('dataSetID', '');
	document.getElementById('COUNTPACKAGEPRINTENG'+strDataSetID).setAttribute('price', this.getAttribute('price'));

	document.getElementById('idTotalPrice').innerHTML = (document.getElementById('COUNTPACKAGEPRINTENG'+strDataSetID).value * document.getElementById('COUNTPACKAGEPRINTENG'+strDataSetID).getAttribute('price')).toFixed(2);

//	var arrInputList = objParentDataSet.getElementsByTagName('input');
//	for (var i=0; i<arrInputList.length; i++) {
//		if (arrInputList[i].getAttribute('name').indexOf('COUNT') != -1) {
//			arrInputList[i].setAttribute('price', this.getAttribute('price'));
//
//			var objParentRow = arrInputList[i];
//			while (objParentRow.nodeName.toString().toLowerCase() != 'tr') {
//				objParentRow = objParentRow.parentNode;
//			}
//
//			arrCellList = objParentRow.getElementsByTagName('td');
//			for (var k=0; k<arrCellList.length; k++) {
//				if (arrCellList[k].getAttribute('name') && arrCellList[k].getAttribute('name') == 'TotalSubPrice') {
//					arrCellList[k].innerHTML = (new Number(arrInputList[i].value) * new Number(this.getAttribute('price'))).toFixed(2); 
//				}
//			}
//		}
//	}

	var arrImageList = objParentDataSet.getElementsByTagName('img');
	for (var i=0; i<arrImageList.length; i++) {
		if (arrImageList[i].className.toString().indexOf('classPaymentType15Selected') != -1) {
			arrImageList[i].className = 'classPaymentTypeImg15';
		}
	}

	if (document.getElementById(objParentDataSet.getAttribute('id').toString()+'PackagePriceID')) {
		document.getElementById(objParentDataSet.getAttribute('id').toString()+'PackagePriceID').value = this.getAttribute('id');
	}

	this.className = 'classPaymentType15Selected';
//	CalculateTotal();
}

var idTrans = 'idTrans';
function ChangeAlbumSettings(evn) {
	if (document.getElementById('idAlbumOrderInfoSetting')) {
		document.getElementById('idAlbumOrderInfoSetting').style.display = 'none';
	}
	var objDataSetDiv = this;
	while (objDataSetDiv.nodeName.toString().toLowerCase() != 'div' || !objDataSetDiv.getAttribute('name') || objDataSetDiv.getAttribute('name') && objDataSetDiv.getAttribute('name') != 'dataSet') {
		objDataSetDiv = objDataSetDiv.parentNode;
	}

	var objImageLoading = new Image(120, 40);
	objImageLoading.src = '/images/loading.gif';
	objImageLoading.alt = 'Loading...';

	if (!document.getElementById(idTrans)) {
		var objDiv = document.createElement('div');
		objDiv.setAttribute('id',idTrans);
		objDiv.setAttribute('align','center');
		objDiv.style.position = 'absolute';
		objDiv.style.background = '#eff0f1';
		objDiv.style.opacity = '0.5';
		objDiv.style.left = 0;
		objDiv.style.top = 0;
		objDiv.style.width = 0;
		objDiv.style.height = 0;
		document.body.appendChild(objDiv);
	}

	if (document.getElementById(idTrans)) {
//		document.getElementById(idTrans).style.width = document.body.clientWidth+'px'
		document.getElementById(idTrans).style.width = '100%';
		document.getElementById(idTrans).style.height = document.body.clientHeight+'px'
		document.getElementById(idTrans).style.display = 'block'
		if (document.all && document.body.filters) { //IE syntax
			document.getElementById(idTrans).style.filter= 'alpha(opacity=50)'
		}

		
		var objDiv = document.createElement('div');
		objDiv.setAttribute('id',idTrans+'Table');
		objDiv.setAttribute('dataSetId', objDataSetDiv.getAttribute('id'));
		objDiv.setAttribute('align','center');
		objDiv.style.position = 'absolute';
		objDiv.style.left = 0;
		objDiv.style.top = 0;
		objDiv.style.width = '100%';

		var objTable = document.createElement('table');
		objTable.className = 'classTable';
		objTable.setAttribute('cellpadding', 0);
		objTable.setAttribute('cellspacing', 0);
		objTable.setAttribute('border', 0);
		objTable.style.height = '500px';
		objTable.style.marginTop = '20px';
		window.scrollTo(0, 0);

		var objRow = objTable.insertRow(0);

		var objCell = objRow.insertCell(0);
		objCell.className = 'classLeftUpCorner';
		var objImage = new Image(1, 1);
		objImage.src = '/images/spacer.gif';
		objCell.appendChild(objImage);

		var objCell = objRow.insertCell(1);
		objCell.className = 'classUpProduct';
		var objImage = new Image(1, 1);
		objImage.src = '/images/spacer.gif';
		objCell.appendChild(objImage);

		var objCell = objRow.insertCell(2);
		objCell.className = 'classRightUpCorner';
		var objImage = new Image(1, 1);
		objImage.src = '/images/spacer.gif';
		objCell.appendChild(objImage);

		var objRow = objTable.insertRow(1);

		var objCell = objRow.insertCell(0);
		objCell.className = 'classLeftProduct';
		var objImage = new Image(15, 1);
		objImage.src = '/images/spacer.gif';
		objCell.appendChild(objImage);

		var objCell = objRow.insertCell(1);
		objCell.className = 'classProductBody';
//		objCell.setAttribute('id',idTrans+'Body');


		var objTableGray = document.createElement('table');
		objTableGray.className = 'classTable';
		objTableGray.setAttribute('cellpadding', 0);
		objTableGray.setAttribute('cellspacing', 0);
		objTableGray.setAttribute('border', 0);
		objTableGray.setAttribute('width', '100%');

//	ROW
		var intRowIndex = 0;
		var objRowGray = objTableGray.insertRow(intRowIndex);

		var objCellGray = objRowGray.insertCell(0);
		objCellGray.className = 'classLeftUpGray';
		var objImage = new Image(1, 1);
		objImage.src = '/images/spacer.gif';
		objCellGray.appendChild(objImage);

		var objCellGray = objRowGray.insertCell(1);
		objCellGray.className = 'classUpGray';
		var objImage = new Image(1, 1);
		objImage.src = '/images/spacer.gif';
		objCellGray.appendChild(objImage);

		var objCellGray = objRowGray.insertCell(2);
		objCellGray.className = 'classRightUpGray';
		var objImage = new Image(1, 1);
		objImage.src = '/images/spacer.gif';
		objCellGray.appendChild(objImage);
		intRowIndex++;

//	ROW
		var objRowGray = objTableGray.insertRow(intRowIndex);

		var objCellGray = objRowGray.insertCell(0);
		objCellGray.className = 'classLeftGray';
		var objImage = new Image(15, 1);
		objImage.src = '/images/spacer.gif';
		objCellGray.appendChild(objImage);

		var objCellGray = objRowGray.insertCell(1);
		objCellGray.className = 'classCenterGray';
		objCellGray.setAttribute('align','left');

		var objImage = new Image(79, 20);
		objImage.src = '/images/folders/back.gif';
		objImage.className = 'classEvent';
		objImage.setAttribute('id', 'idBackHistoryImg');
		objImage.setAttribute('style', 'padding: 5px;');
		objImage.setAttribute('align', 'left');
		objImage.onclick = backHistory;
		objCellGray.appendChild(objImage);

		var objImage = new Image(24, 24);
		objImage.src = '/images/exit.png';
		objImage.className = 'classEvent';
		objImage.setAttribute('style', 'padding: 5px;');
		objImage.setAttribute('align', 'right');
		objImage.onclick = function() {
			window.location.href = window.location.href.toString().replace('list', 'checkalbum');
			return true;
	        while (document.getElementById(idTrans+'Table').firstChild) {
	    		document.getElementById(idTrans+'Table').removeChild(document.getElementById(idTrans+'Table').firstChild);
	    	}
	
	    	document.getElementById(idTrans+'Table').parentNode.removeChild(document.getElementById(idTrans+'Table'));
	    	document.getElementById(idTrans).parentNode.removeChild(document.getElementById(idTrans));
//	    	document.getElementById('addToCart').style.display = 'block';
	    	if (document.getElementById('addToCart')) {
	    		showAddOrder();
	    	} else {
	    		Event.observe(window, 'load', showAddOrder);
	    	}
		}
		objCellGray.appendChild(objImage);

		var objCellGray = objRowGray.insertCell(2);
		objCellGray.className = 'classRightGray';
		var objImage = new Image(15, 1);
		objImage.src = '/images/spacer.gif';
		objCellGray.appendChild(objImage);
		intRowIndex++;

//	ROW
		var objRowGray = objTableGray.insertRow(intRowIndex);
		var objCellGray = objRowGray.insertCell(0);
		objCellGray.colSpan = 3;
		objCellGray.setAttribute('style', 'background-color: rgb(206, 212, 217);');
		var objImage = new Image(1, 1);
		objImage.src = '/images/spacer.gif';
		objCellGray.appendChild(objImage);
		intRowIndex++;

//	ROW
		var objRowGray = objTableGray.insertRow(intRowIndex);

		var objCellGray = objRowGray.insertCell(0);
		objCellGray.className = 'classLeftGray';
		var objImage = new Image(15, 1);
		objImage.src = '/images/spacer.gif';
		objCellGray.appendChild(objImage);

		var objCellGray = objRowGray.insertCell(1);
		objCellGray.className = 'classCenterGray';
		objCellGray.setAttribute('id',idTrans+'Body');
		objCellGray.setAttribute('align','left');

		var objDivBody = document.createElement('div');
		objDivBody.className = 'classMarginCenter';
		objCellGray.appendChild(objDivBody);

		var objCellGray = objRowGray.insertCell(2);
		objCellGray.className = 'classRightGray';
		var objImage = new Image(15, 1);
		objImage.src = '/images/spacer.gif';
		objCellGray.appendChild(objImage);
		intRowIndex++;

//	ROW
		var objRowGray = objTableGray.insertRow(intRowIndex);

		var objCellGray = objRowGray.insertCell(0);
		objCellGray.className = 'classLeftDownGray';
		var objImage = new Image(1, 1);
		objImage.src = '/images/spacer.gif';
		objCellGray.appendChild(objImage);

		var objCellGray = objRowGray.insertCell(1);
		objCellGray.className = 'classDownGray';
		var objImage = new Image(1, 1);
		objImage.src = '/images/spacer.gif';
		objCellGray.appendChild(objImage);

		var objCellGray = objRowGray.insertCell(2);
		objCellGray.className = 'classRightDownGray';
		var objImage = new Image(1, 1);
		objImage.src = '/images/spacer.gif';
		objCellGray.appendChild(objImage);


		objCell.appendChild(objTableGray);

		var objCell = objRow.insertCell(2);
		objCell.className = 'classRightProduct';
		var objImage = new Image(15, 1);
		objImage.src = '/images/spacer.gif';
		objCell.appendChild(objImage);

		var objRow = objTable.insertRow(2);

		var objCell = objRow.insertCell(0);
		objCell.className = 'classLeftDownCorner';
		var objImage = new Image(1, 1);
		objImage.src = '/images/spacer.gif';
		objCell.appendChild(objImage);

		var objCell = objRow.insertCell(1);
		objCell.className = 'classDownProduct';
		var objImage = new Image(1, 1);
		objImage.src = '/images/spacer.gif';
		objCell.appendChild(objImage);

		var objCell = objRow.insertCell(2);
		objCell.className = 'classRightDownCorner';
		var objImage = new Image(1, 1);
		objImage.src = '/images/spacer.gif';
		objCell.appendChild(objImage);

		objDiv.appendChild(objTable);
		document.body.appendChild(objDiv);

		DrawStep(1);
	}
}

function DrawStep(intStep) {
//	document.getElementById('addToCart').style.display = 'none';
	if (document.getElementById('addToCart')) {
		hideAddOrder();
	} else {
		Event.observe(window, 'load', hideAddOrder);
	}
	switch(intStep) {
//	===
//	BEGIN STEP 1
//	===
		case 1:
/*
			while (document.getElementById(idTrans+'Body').firstChild) {
				document.getElementById(idTrans+'Body').removeChild(document.getElementById(idTrans+'Body').firstChild);
			}

			if (document.getElementById('idBackHistoryImg')) {
				document.getElementById('idBackHistoryImg').src = '/images/spacer.gif';
				document.getElementById('idBackHistoryImg').setAttribute('width', '1');
				document.getElementById('idBackHistoryImg').setAttribute('height', '1');
			}

			var objImage = new Image(204, 17);
			objImage.src = '/images/personalization.jpg';
			objImage.setAttribute('alt', 'Personalization');
			objImage.style.paddingTop = '10px';
			objImage.style.paddingBottom = '30px';
			document.getElementById(idTrans+'Body').appendChild(objImage);

//	Data Table
			var objTable = document.createElement('table');
			objTable.setAttribute('cellpadding', 0);
			objTable.setAttribute('cellspacing', 0);
			objTable.setAttribute('border', 0);

			var objRow = objTable.insertRow(0);

			var objCell = objRow.insertCell(0);
			objCell.className = 'classPersonalisation';
			var objText = document.createTextNode('Bride name');
			objCell.appendChild(objText);

			var objCell = objRow.insertCell(1);
			objCell.className = 'classPersonalisation';
			var objSpan = document.createElement('span');
			objSpan.className = 'classColorRed classFontSize20';
			var objText = document.createTextNode('*');
			objSpan.appendChild(objText);
			objCell.appendChild(objSpan);

			var objCell = objRow.insertCell(2);
			objCell.className = 'classPersonalisation';
			var objInput = document.createElement('input');
			objInput.className = 'classWidth150 classMarginRight20';
			objInput.setAttribute('name', 'BrideEventName');
			objInput.setAttribute('id', 'idBrideEventName');
			objInput.onchange = ChangeTitlePreview;
			objCell.appendChild(objInput);

			var objCell = objRow.insertCell(3);
			objCell.className = 'classPersonalisation';
			var objText = document.createTextNode('Conjunction');
			objCell.appendChild(objText);

			var objCell = objRow.insertCell(4);
			var objSelect = document.createElement('select');
			objSelect.className = 'classMarginRight20';
			objSelect.setAttribute('name', 'Conjunction');
			objSelect.setAttribute('id', 'idConjunction');
			objSelect.onchange = ChangeTitlePreview;
			var objOption = document.createElement("option");
			objOption.value = '';
			objOption.text = '';
			objSelect.appendChild(objOption);
			var objOption = document.createElement("option");
			objOption.value = '&';
			var objTextNode = document.createTextNode('&');
			objOption.appendChild(objTextNode);
			objSelect.appendChild(objOption);
			var objOption = document.createElement("option");
			objOption.value = 'and';
			var objTextNode = document.createTextNode('and');
			objOption.appendChild(objTextNode);
			objSelect.appendChild(objOption);
			objCell.appendChild(objSelect);

			var objCell = objRow.insertCell(5);
			objCell.className = 'classPersonalisation';
			var objText = document.createTextNode('Groom name');
			objCell.appendChild(objText);

			var objCell = objRow.insertCell(6);
			objCell.className = 'classPersonalisation';
			var objInput = document.createElement('input');
			objInput.className = 'classWidth150 classMarginRight20';
			objInput.setAttribute('name', 'GroomEventName');
			objInput.setAttribute('id', 'idGroomEventName');
			objInput.onchange = ChangeTitlePreview;
			objCell.appendChild(objInput);

//	Row 1
			var objRow = objTable.insertRow(1);

			var objCell = objRow.insertCell(0);
			objCell.className = 'classPersonalisation';
			var objText = document.createTextNode('Wedding/Event Date');
			objCell.appendChild(objText);

			var objCell = objRow.insertCell(1);
			objCell.className = 'classPersonalisation';

			var objCell = objRow.insertCell(2);
			objCell.className = 'classPersonalisation';
			var objInput = document.createElement('input');
			objInput.className = 'classWidth150 classMarginRight20';
			objInput.setAttribute('name', 'WeddingEventDate');
			objInput.setAttribute('id', 'idWeddingEventDate');
			objInput.onchange = ChangeTitlePreview;
			objCell.appendChild(objInput);

//	Row 2
			var objRow = objTable.insertRow(2);

			var objCell = objRow.insertCell(0);
			objCell.className = 'classPersonalisation';
			var objText = document.createTextNode('Note(s)');
			objCell.appendChild(objText);

			var objCell = objRow.insertCell(1);
			objCell.className = 'classPersonalisation';

			var objCell = objRow.insertCell(2);
			objCell.className = 'classPersonalisation';
			objCell.colSpan = 5;
			var objTextArea = document.createElement('textarea');
			objTextArea.className = 'classPersonalisationTextArea classMarginRight20';
			objTextArea.setAttribute('name', 'Notes');
			objTextArea.setAttribute('id', 'idNotes');
			objCell.appendChild(objTextArea);

//	Row 3
			var objRow = objTable.insertRow(3);

			var objCell = objRow.insertCell(0);
			objCell.className = 'classPersonalisationLine';
			objCell.colSpan = 7;
			var objSpan = document.createElement('span');
			var objText = document.createTextNode('');
			objSpan.appendChild(objText);
			objCell.appendChild(objSpan);

//			Row 4
			var objRow = objTable.insertRow(4);

			var objCell = objRow.insertCell(0);
			objCell.className = 'classPersonalisation';
			objCell.setAttribute('align', 'center');
			objCell.colSpan = 7;
			var objSpan = document.createElement('span');
			var objText = document.createTextNode('Title Preview:');
			objSpan.appendChild(objText);
			objCell.appendChild(objSpan);

//			Row 5
			var objRow = objTable.insertRow(5);

			var objCell = objRow.insertCell(0);
			objCell.className = 'classPersonalisation';
			objCell.setAttribute('align', 'center');
			objCell.colSpan = 7;

//	Preview Table Begin			
			var objTablePreview = document.createElement('table');
			objTablePreview.className = 'classTable';
			objTablePreview.setAttribute('cellpadding', 0);
			objTablePreview.setAttribute('cellspacing', 0);
			objTablePreview.setAttribute('border', 0);
			objTablePreview.style.height = '100px';

			var objRowPreview = objTablePreview.insertRow(0);

			var objCellPreview = objRowPreview.insertCell(0);
			objCellPreview.className = 'classLeftUpCorner';
			var objImage = new Image(1, 1);
			objImage.src = '/images/spacer.gif';
			objCellPreview.appendChild(objImage);

			var objCellPreview = objRowPreview.insertCell(1);
			objCellPreview.className = 'classUpProduct';
			var objImage = new Image(1, 1);
			objImage.src = '/images/spacer.gif';
			objCellPreview.appendChild(objImage);

			var objCellPreview = objRowPreview.insertCell(2);
			objCellPreview.className = 'classRightUpCorner';
			var objImage = new Image(1, 1);
			objImage.src = '/images/spacer.gif';
			objCellPreview.appendChild(objImage);

			var objRowPreview = objTablePreview.insertRow(1);

			var objCellPreview = objRowPreview.insertCell(0);
			objCellPreview.className = 'classLeftProduct';
			var objImage = new Image(15, 1);
			objImage.src = '/images/spacer.gif';
			objCellPreview.appendChild(objImage);

			var objCellPreview = objRowPreview.insertCell(1);
			objCellPreview.className = 'classProductBody';
			objCellPreview.setAttribute('align', 'center');
			objCellPreview.setAttribute('id','idTitlePreviewBody');

			var objCellPreview = objRowPreview.insertCell(2);
			objCellPreview.className = 'classRightProduct';
			var objImage = new Image(15, 1);
			objImage.src = '/images/spacer.gif';
			objCellPreview.appendChild(objImage);

			var objRowPreview = objTablePreview.insertRow(2);

			var objCellPreview = objRowPreview.insertCell(0);
			objCellPreview.className = 'classLeftDownCorner';
			var objImage = new Image(1, 1);
			objImage.src = '/images/spacer.gif';
			objCellPreview.appendChild(objImage);

			var objCellPreview = objRowPreview.insertCell(1);
			objCellPreview.className = 'classDownProduct';
			var objImage = new Image(1, 1);
			objImage.src = '/images/spacer.gif';
			objCellPreview.appendChild(objImage);

			var objCellPreview = objRowPreview.insertCell(2);
			objCellPreview.className = 'classRightDownCorner';
			var objImage = new Image(1, 1);
			objImage.src = '/images/spacer.gif';
			objCellPreview.appendChild(objImage);
//	Preview Table End
			objCell.appendChild(objTablePreview);

//			Row 6
			var objRow = objTable.insertRow(6);

			var objCell = objRow.insertCell(0);
			objCell.className = 'classPersonalisationLine';
			objCell.colSpan = 7;
			var objSpan = document.createElement('span');
			var objText = document.createTextNode('');
			objSpan.appendChild(objText);
			objCell.appendChild(objSpan);

//			Row 7
			var objRow = objTable.insertRow(7);

			var objCell = objRow.insertCell(0);
			objCell.className = 'classPersonalisation';
			objCell.setAttribute('align', 'center');
			objCell.colSpan = 7;
			var objSpan = document.createElement('span');
			objSpan.className = 'classEvent';
			var objImage = new Image(209, 61);
			objImage.src = '/images/next.gif';
			objImage.setAttribute('alt', 'Next step');
			objSpan.appendChild(objImage);
//			var objText = document.createTextNode('Next step');
//			objSpan.appendChild(objText);
			objSpan.onclick = ShowStep2;
			objCell.appendChild(objSpan);

			document.getElementById(idTrans+'Body').appendChild(objTable);

			setDefaultParams(1);
		break;
*/
//	===
//	BEGIN STEP 2
//	===
		case 2:
			while (document.getElementById(idTrans+'Body').firstChild) {
				document.getElementById(idTrans+'Body').removeChild(document.getElementById(idTrans+'Body').firstChild);
			}

			if (document.getElementById('idBackHistoryImg')) {
				document.getElementById('idBackHistoryImg').src = '/images/spacer.gif';
				document.getElementById('idBackHistoryImg').setAttribute('width', '1');
				document.getElementById('idBackHistoryImg').setAttribute('height', '1');
			}

			var objImage = new Image(59, 17);
			objImage.src = '/images/book.jpg';
			objImage.setAttribute('alt', 'Book');
			objImage.style.paddingTop = '10px';
			objImage.style.paddingBottom = '30px';
			document.getElementById(idTrans+'Body').appendChild(objImage);

//	Data Table
			var objTable = document.createElement('table');
			objTable.setAttribute('cellpadding', 0);
			objTable.setAttribute('cellspacing', 0);
			objTable.setAttribute('border', 0);

//	Row 0
			var inrRowCounter = 0;
			var objRow = objTable.insertRow(inrRowCounter);

			var objCell = objRow.insertCell(0);
			objCell.className = 'classTextHeader';
			objCell.colSpan = 2;
			var objText = document.createTextNode('Primary Book Sizes:');
			objCell.appendChild(objText);

//	Row 1
			inrRowCounter++;
			var objRow = objTable.insertRow(inrRowCounter);

			var objCell = objRow.insertCell(0);
			objCell.rowSpan = 2;
			objCell.className = 'classPersonalisationImage';
			objCell.setAttribute('align', 'center');
			objImage = new Image();
			objImage.src = '/images/horizontal.jpg';
			objCell.appendChild(objImage);

			var objCell = objRow.insertCell(1);
			objCell.className = 'classPersonalisation classPersonalisationSizeName';
			var objText = document.createTextNode('Horizontal');
			objCell.appendChild(objText);

			inrRowCounter++;
			var objRow = objTable.insertRow(inrRowCounter);

			var objCell = objRow.insertCell(0);
			objCell.className = 'classPersonalisation classPersonalisationSizeList';

			var objDiv = document.createElement('div');
			objDiv.className = 'classBookDiv';
			var objText = document.createTextNode('10x8');
			objDiv.appendChild(objText);
			objCell.appendChild(objDiv);
			var objDiv = document.createElement('div');
			objDiv.className = 'classBookDivInput';
			var objInput = document.createElement('input');
			objInput.className = 'classBookInput';
			objInput.setAttribute('type', 'radio')
			objInput.setAttribute('name', 'PrimaryBookSizes')
			objInput.setAttribute('value', '10x8');
			objDiv.appendChild(objInput);
			objCell.appendChild(objDiv);

			var objDiv = document.createElement('div');
			objDiv.className = 'classBookDiv';
			var objText = document.createTextNode('16x12');
			objDiv.appendChild(objText);
			objCell.appendChild(objDiv);
			var objDiv = document.createElement('div');
			objDiv.className = 'classBookDivInput';
			var objInput = document.createElement('input');
			objInput.className = 'classBookInput';
			objInput.setAttribute('type', 'radio')
			objInput.setAttribute('name', 'PrimaryBookSizes')
			objInput.setAttribute('value', '16x12');
			objDiv.appendChild(objInput);
			objCell.appendChild(objDiv);

//	Row 2
			inrRowCounter++;
			var objRow = objTable.insertRow(inrRowCounter);

			var objCell = objRow.insertCell(0);
			objCell.rowSpan = 2;
			objCell.className = 'classPersonalisationImage';
			objCell.setAttribute('align', 'center');
			objImage = new Image();
			objImage.src = '/images/vertical.jpg';
			objCell.appendChild(objImage);

			var objCell = objRow.insertCell(1);
			objCell.className = 'classPersonalisation classPersonalisationSizeName';
			var objText = document.createTextNode('Vertical');
			objCell.appendChild(objText);

			inrRowCounter++;
			var objRow = objTable.insertRow(inrRowCounter);

			var objCell = objRow.insertCell(0);
			objCell.className = 'classPersonalisation classPersonalisationSizeList';

			var objDiv = document.createElement('div');
			objDiv.className = 'classBookDiv';
			var objText = document.createTextNode('4x6');
			objDiv.appendChild(objText);
			objCell.appendChild(objDiv);
			var objDiv = document.createElement('div');
			objDiv.className = 'classBookDivInput';
			var objInput = document.createElement('input');
			objInput.className = 'classBookInput';
			objInput.setAttribute('type', 'radio');
			objInput.setAttribute('name', 'PrimaryBookSizes');
			objInput.setAttribute('value', '4x6');
			objDiv.appendChild(objInput);
			objCell.appendChild(objDiv);

			var objDiv = document.createElement('div');
			objDiv.className = 'classBookDiv';
			var objText = document.createTextNode('5x7');
			objDiv.appendChild(objText);
			objCell.appendChild(objDiv);
			var objDiv = document.createElement('div');
			objDiv.className = 'classBookDivInput';
			var objInput = document.createElement('input');
			objInput.className = 'classBookInput';
			objInput.setAttribute('type', 'radio');
			objInput.setAttribute('name', 'PrimaryBookSizes');
			objInput.setAttribute('value', '5x7');
			objDiv.appendChild(objInput);
			objCell.appendChild(objDiv);

			var objDiv = document.createElement('div');
			objDiv.className = 'classBookDiv';
			var objText = document.createTextNode('8x10');
			objDiv.appendChild(objText);
			objCell.appendChild(objDiv);
			var objDiv = document.createElement('div');
			objDiv.className = 'classBookDivInput';
			var objInput = document.createElement('input');
			objInput.className = 'classBookInput';
			objInput.setAttribute('type', 'radio');
			objInput.setAttribute('name', 'PrimaryBookSizes');
			objInput.setAttribute('value', '8x10');
			objDiv.appendChild(objInput);
			objCell.appendChild(objDiv);

			var objDiv = document.createElement('div');
			objDiv.className = 'classBookDiv';
			var objText = document.createTextNode('9x12');
			objDiv.appendChild(objText);
			objCell.appendChild(objDiv);
			var objDiv = document.createElement('div');
			objDiv.className = 'classBookDivInput';
			var objInput = document.createElement('input');
			objInput.className = 'classBookInput';
			objInput.setAttribute('type', 'radio');
			objInput.setAttribute('name', 'PrimaryBookSizes');
			objInput.setAttribute('value', '9x12');
			objDiv.appendChild(objInput);
			objCell.appendChild(objDiv);

			var objDiv = document.createElement('div');
			objDiv.className = 'classBookDiv';
			var objText = document.createTextNode('10x15');
			objDiv.appendChild(objText);
			objCell.appendChild(objDiv);
			var objDiv = document.createElement('div');
			objDiv.className = 'classBookDivInput';
			var objInput = document.createElement('input');
			objInput.className = 'classBookInput';
			objInput.setAttribute('type', 'radio');
			objInput.setAttribute('name', 'PrimaryBookSizes');
			objInput.setAttribute('value', '10x15');
			objDiv.appendChild(objInput);
			objCell.appendChild(objDiv);

			var objDiv = document.createElement('div');
			objDiv.className = 'classBookDiv';
			var objText = document.createTextNode('11x14');
			objDiv.appendChild(objText);
			objCell.appendChild(objDiv);
			var objDiv = document.createElement('div');
			objDiv.className = 'classBookDivInput';
			var objInput = document.createElement('input');
			objInput.className = 'classBookInput';
			objInput.setAttribute('type', 'radio');
			objInput.setAttribute('name', 'PrimaryBookSizes');
			objInput.setAttribute('value', '11x14');
			objDiv.appendChild(objInput);
			objCell.appendChild(objDiv);

//	Row 3
			inrRowCounter++;
			var objRow = objTable.insertRow(inrRowCounter);

			var objCell = objRow.insertCell(0);
			objCell.rowSpan = 2;
			objCell.className = 'classPersonalisationImage classPersonalisationBorder';
			objCell.setAttribute('align', 'center');
			objImage = new Image();
			objImage.src = '/images/square.jpg';
			objCell.appendChild(objImage);

			var objCell = objRow.insertCell(1);
			objCell.className = 'classPersonalisation classPersonalisationSizeName';
			var objText = document.createTextNode('Square');
			objCell.appendChild(objText);

			inrRowCounter++;
			var objRow = objTable.insertRow(inrRowCounter);

			var objCell = objRow.insertCell(0);
			objCell.className = 'classPersonalisation classPersonalisationSizeList classPersonalisationBorder';

			var objDiv = document.createElement('div');
			objDiv.className = 'classBookDiv';
			var objText = document.createTextNode('5x5');
			objDiv.appendChild(objText);
			objCell.appendChild(objDiv);
			var objDiv = document.createElement('div');
			objDiv.className = 'classBookDivInput';
			var objInput = document.createElement('input');
			objInput.className = 'classBookInput';
			objInput.setAttribute('type', 'radio');
			objInput.setAttribute('name', 'PrimaryBookSizes');
			objInput.setAttribute('value', '5x5');
			objDiv.appendChild(objInput);
			objCell.appendChild(objDiv);

			var objDiv = document.createElement('div');
			objDiv.className = 'classBookDiv';
			var objText = document.createTextNode('8x8');
			objDiv.appendChild(objText);
			objCell.appendChild(objDiv);
			var objDiv = document.createElement('div');
			objDiv.className = 'classBookDivInput';
			var objInput = document.createElement('input');
			objInput.className = 'classBookInput';
			objInput.setAttribute('type', 'radio');
			objInput.setAttribute('name', 'PrimaryBookSizes');
			objInput.setAttribute('value', '8x8');
			objDiv.appendChild(objInput);
			objCell.appendChild(objDiv);

			var objDiv = document.createElement('div');
			objDiv.className = 'classBookDiv';
			var objText = document.createTextNode('10x10');
			objDiv.appendChild(objText);
			objCell.appendChild(objDiv);
			var objDiv = document.createElement('div');
			objDiv.className = 'classBookDivInput';
			var objInput = document.createElement('input');
			objInput.className = 'classBookInput';
			objInput.setAttribute('type', 'radio');
			objInput.setAttribute('name', 'PrimaryBookSizes');
			objInput.setAttribute('value', '10x10');
			objDiv.appendChild(objInput);
			objCell.appendChild(objDiv);

			var objDiv = document.createElement('div');
			objDiv.className = 'classBookDiv';
			var objText = document.createTextNode('12x12');
			objDiv.appendChild(objText);
			objCell.appendChild(objDiv);
			var objDiv = document.createElement('div');
			objDiv.className = 'classBookDivInput';
			var objInput = document.createElement('input');
			objInput.className = 'classBookInput';
			objInput.setAttribute('type', 'radio');
			objInput.setAttribute('name', 'PrimaryBookSizes');
			objInput.setAttribute('value', '12x12');
			objDiv.appendChild(objInput);
			objCell.appendChild(objDiv);

//	Row 4
			inrRowCounter++;
			var objRow = objTable.insertRow(inrRowCounter);

			var objCell = objRow.insertCell(0);
			objCell.className = 'classPersonalisation';
			objCell.setAttribute('align', 'center');
			objCell.colSpan = 2;

//	Row 5
			inrRowCounter++;
			var objRow = objTable.insertRow(inrRowCounter);

			var objCell = objRow.insertCell(0);
			objCell.className = 'classTextHeader classPaddingHeader';
			objCell.colSpan = 2;
			var objText = document.createTextNode('Paper & Pages:');
			objCell.appendChild(objText);

//	Row 6
			inrRowCounter++;
			var objRow = objTable.insertRow(inrRowCounter);

			var objCell = objRow.insertCell(0);
			objCell.className = 'classPersonalisation classPaddingRow';
			var objText = document.createTextNode('Paper:');
			objCell.appendChild(objText);

			var objCell = objRow.insertCell(1);
			objCell.className = 'classPersonalisation classBookPaper';

			var objText = document.createTextNode('Lustre');
			var objDiv = document.createElement('div');
			objDiv.className = 'classPaperPageDivText';
			objDiv.setAttribute('align', 'right');
			objDiv.appendChild(objText);
			objCell.appendChild(objDiv);

			var objInput = document.createElement('input');
			objInput.className = 'classBookInput';
			objInput.setAttribute('type', 'radio')
			objInput.setAttribute('name', 'BookPaper')
			objInput.setAttribute('value', 'Lustre');
			var objDiv = document.createElement('div');
			objDiv.className = 'classPaperPageDivInput';
			objDiv.setAttribute('align', 'right');
			objDiv.appendChild(objInput);
			objCell.appendChild(objDiv);

			var objDiv = document.createElement('div');
			objDiv.className = 'classPaperPageDivText';
			objDiv.setAttribute('align', 'right');
			var objText = document.createTextNode('Metallic (add 25%)');
			objDiv.appendChild(objText);
			objCell.appendChild(objDiv);

			var objInput = document.createElement('input');
			objInput.className = 'classBookInput';
			objInput.setAttribute('type', 'radio')
			objInput.setAttribute('name', 'BookPaper')
			objInput.setAttribute('value', 'Metallic');
			var objDiv = document.createElement('div');
			objDiv.className = 'classPaperPageDivInput';
			objDiv.setAttribute('align', 'right');
			objDiv.appendChild(objInput);
			objCell.appendChild(objDiv);
//	Row 6
			inrRowCounter++;
			var objRow = objTable.insertRow(inrRowCounter);

			var objCell = objRow.insertCell(0);
			objCell.className = 'classPersonalisation classPaddingRow';
			var objText = document.createTextNode('Number of sides:');
			objCell.appendChild(objText);

			var objCell = objRow.insertCell(1);
			objCell.className = 'classPersonalisation classPaddingRow';

			var objInput = document.createElement('input');
			objInput.className = 'classBookInputQuantity';
			objInput.setAttribute('type', 'text');
			objInput.setAttribute('name', 'NumberOfSides');
			objInput.setAttribute('value', '20');
			Event.observe(objInput, 'change', CheckNumberOfSides);
			objInput.setAttribute('id', 'idNumberOfSides')
			var objDiv = document.createElement('div');
			objDiv.className = 'classPaperPageNS';
			objDiv.setAttribute('align', 'right');
			objDiv.appendChild(objInput);
			objCell.appendChild(objDiv);

			
			var objText = document.createTextNode('Number of prints:');
			var objDiv = document.createElement('div');
			objDiv.className = 'classPaperPageNP';
			objDiv.setAttribute('align', 'right');
			objDiv.appendChild(objText);
			objCell.appendChild(objDiv);

			var objInput = document.createElement('input');
			objInput.className = 'classBookInputQuantity';
			objInput.setAttribute('type', 'text')
			objInput.setAttribute('name', 'PageQuantity')
			objInput.setAttribute('id', 'idPageQuantity')
			var objDiv = document.createElement('div');
			objDiv.className = 'classPaperPageNPI';
			objDiv.setAttribute('align', 'right');
			objDiv.appendChild(objInput);
			objCell.appendChild(objDiv);


//	Row 7
			inrRowCounter++;
			var objRow = objTable.insertRow(inrRowCounter);

//			var objCell = objRow.insertCell(0);
//			objCell.className = 'classPersonalisation classPaddingRow';
//			var objText = document.createTextNode('Number of prints:');
//			objCell.appendChild(objText);
//
//			var objCell = objRow.insertCell(1);
//			objCell.className = 'classPersonalisation classPaddingRow';
//
//			var objInput = document.createElement('input');
//			objInput.className = 'classBookInputQuantity';
//			objInput.setAttribute('type', 'text')
//			objInput.setAttribute('name', 'PageQuantity')
//			objInput.setAttribute('id', 'idPageQuantity')
//			objCell.appendChild(objInput);

//	Row 6
			inrRowCounter++;
			var objRow = objTable.insertRow(inrRowCounter);

			var objCell = objRow.insertCell(0);
			objCell.className = 'classPersonalisation classPaddingRow';
			var objText = document.createTextNode('Spine:');
			objCell.appendChild(objText);

			var objText = document.createTextNode('(');
			objCell.appendChild(objText);
			var objLink = document.createElement('a');
			objLink.setAttribute('href', '/images/spine.jpg');
			objLink.setAttribute('target', '_blanck');
			objLink.setAttribute('style', 'color: black;');
			var objText = document.createTextNode('example');
			objLink.onclick = function() {window.open('/images/spine.jpg','','width=625,height=385,scrollbars,resizable,toolbar,');  return false;}
			objLink.appendChild(objText);
			objCell.appendChild(objLink);
			var objText = document.createTextNode(') ');
			objCell.appendChild(objText);

			
			var objCell = objRow.insertCell(1);
			objCell.className = 'classPersonalisation classBookPaper';

			var objText = document.createTextNode('Round');
			var objDiv = document.createElement('div');
			objDiv.className = 'classPaperPageDivText';
			objDiv.setAttribute('align', 'right');
			objDiv.appendChild(objText);
			objCell.appendChild(objDiv);

			var objInput = document.createElement('input');
			objInput.className = 'classBookInput';
			objInput.setAttribute('type', 'radio')
			objInput.setAttribute('name', 'Spine')
			objInput.setAttribute('value', 'Round');
			var objDiv = document.createElement('div');
			objDiv.className = 'classPaperPageDivInput';
			objDiv.setAttribute('align', 'right');
			objDiv.appendChild(objInput);
			objCell.appendChild(objDiv);

			var objText = document.createTextNode('Flat');
			var objDiv = document.createElement('div');
			objDiv.className = 'classPaperPageDivText';
			objDiv.setAttribute('align', 'right');
			objDiv.appendChild(objText);
			objCell.appendChild(objDiv);

			var objInput = document.createElement('input');
			objInput.className = 'classBookInput';
			objInput.setAttribute('type', 'radio')
			objInput.setAttribute('name', 'Spine')
			objInput.setAttribute('value', 'Flat');
			var objDiv = document.createElement('div');
			objDiv.className = 'classPaperPageDivInput';
			objDiv.setAttribute('align', 'right');
			objDiv.appendChild(objInput);
			objCell.appendChild(objDiv);

//	Row 6
			inrRowCounter++;
			var objRow = objTable.insertRow(inrRowCounter);

			var objCell = objRow.insertCell(0);
			objCell.className = 'classPersonalisation classPaddingRow';
			var objText = document.createTextNode('Gilding:');
			objCell.appendChild(objText);

			var objCell = objRow.insertCell(1);
			objCell.className = 'classPersonalisation classBookPaper';


			var objText = document.createTextNode('Ungilded');
			var objDiv = document.createElement('div');
			objDiv.className = 'classPaperPageDivText';
			objDiv.setAttribute('align', 'right');
			objDiv.appendChild(objText);
			objCell.appendChild(objDiv);

			var objInput = document.createElement('input');
			objInput.className = 'classBookInput';
			objInput.setAttribute('type', 'radio')
			objInput.setAttribute('name', 'Gilding')
			objInput.setAttribute('value', 'Ungilded');
			var objDiv = document.createElement('div');
			objDiv.className = 'classPaperPageDivInput';
			objDiv.setAttribute('align', 'right');
			objDiv.appendChild(objInput);
			objCell.appendChild(objDiv);


			var objText = document.createTextNode('Gold (add $25)');
			var objDiv = document.createElement('div');
			objDiv.className = 'classPaperPageDivText';
			objDiv.setAttribute('align', 'right');
			objDiv.appendChild(objText);
			objCell.appendChild(objDiv);

			var objInput = document.createElement('input');
			objInput.className = 'classBookInput';
			objInput.setAttribute('type', 'radio')
			objInput.setAttribute('name', 'Gilding')
			objInput.setAttribute('value', 'Gold');
			var objDiv = document.createElement('div');
			objDiv.className = 'classPaperPageDivInput';
			objDiv.setAttribute('align', 'right');
			objDiv.appendChild(objInput);
			objCell.appendChild(objDiv);


			var objText = document.createTextNode('Silver (add $25)');
			var objDiv = document.createElement('div');
			objDiv.className = 'classPaperPageDivText';
			objDiv.setAttribute('align', 'right');
			objDiv.appendChild(objText);
			objCell.appendChild(objDiv);

			var objInput = document.createElement('input');
			objInput.className = 'classBookInput';
			objInput.setAttribute('type', 'radio')
			objInput.setAttribute('name', 'Gilding')
			objInput.setAttribute('value', 'Silver');
			var objDiv = document.createElement('div');
			objDiv.className = 'classPaperPageDivInput';
			objDiv.setAttribute('align', 'right');
			objDiv.appendChild(objInput);
			objCell.appendChild(objDiv);


			var objText = document.createTextNode('Black (add $25)');
			var objDiv = document.createElement('div');
			objDiv.className = 'classPaperPageDivText';
			objDiv.setAttribute('align', 'right');
			objDiv.appendChild(objText);
			objCell.appendChild(objDiv);

			var objInput = document.createElement('input');
			objInput.className = 'classBookInput';
			objInput.setAttribute('type', 'radio')
			objInput.setAttribute('name', 'Gilding')
			objInput.setAttribute('value', 'Black');
			var objDiv = document.createElement('div');
			objDiv.className = 'classPaperPageDivInput';
			objDiv.setAttribute('align', 'right');
			objDiv.appendChild(objInput);
			objCell.appendChild(objDiv);



//	Row 6
			inrRowCounter++;
			var objRow = objTable.insertRow(inrRowCounter);

			var objCell = objRow.insertCell(0);
			objCell.className = 'classPersonalisation classPaddingRow classPersonalisationBorder';
			var objText = document.createTextNode('Corners: ');
			objCell.appendChild(objText);

			var objCell = objRow.insertCell(1);
			objCell.className = 'classPersonalisation classBookPaper classPersonalisationBorder';

			var objText = document.createTextNode('Round');
			var objDiv = document.createElement('div');
			objDiv.className = 'classPaperPageDivText';
			objDiv.setAttribute('align', 'right');
			objDiv.appendChild(objText);
			objCell.appendChild(objDiv);

			var objInput = document.createElement('input');
			objInput.className = 'classBookInput';
			objInput.setAttribute('type', 'radio')
			objInput.setAttribute('name', 'Corners')
			objInput.setAttribute('value', 'Round');
			var objDiv = document.createElement('div');
			objDiv.className = 'classPaperPageDivInput';
			objDiv.setAttribute('align', 'right');
			objDiv.appendChild(objInput);
			objCell.appendChild(objDiv);

			var objText = document.createTextNode('Square');
			var objDiv = document.createElement('div');
			objDiv.className = 'classPaperPageDivText';
			objDiv.setAttribute('align', 'right');
			objDiv.appendChild(objText);
			objCell.appendChild(objDiv);

			var objInput = document.createElement('input');
			objInput.className = 'classBookInput';
			objInput.setAttribute('type', 'radio')
			objInput.setAttribute('name', 'Corners')
			objInput.setAttribute('value', 'Square');
			var objDiv = document.createElement('div');
			objDiv.className = 'classPaperPageDivInput';
			objDiv.setAttribute('align', 'right');
			objDiv.appendChild(objInput);
			objCell.appendChild(objDiv);

//	Row 8
//			inrRowCounter++;
//			var objRow = objTable.insertRow(inrRowCounter);

//			var objCell = objRow.insertCell(0);
//			objCell.className = 'classPersonalisation classPaddingRow';
//			var objText = document.createTextNode('Book Quantity:');
//			objCell.appendChild(objText);
//
//			var objCell = objRow.insertCell(1);
//			objCell.className = 'classPersonalisation classPaddingRow';
//
//			var objInput = document.createElement('input');
//			objInput.className = 'classBookInputQuantity';
//			objInput.setAttribute('type', 'text')
//			objInput.setAttribute('name', 'BookQuantity')
//			objInput.setAttribute('id', 'idBookQuantity');
//			objCell.appendChild(objInput);


//	Row YY
			inrRowCounter++;
			var objRow = objTable.insertRow(inrRowCounter);

			var objCell = objRow.insertCell(0);
			objCell.className = 'classPersonalisation classPaddingRow';
			objCell.setAttribute('colspan', '2');
			objCell.setAttribute('align', 'center');
			objCell.setAttribute('style', 'font-weight: bold;');
			var objText = document.createTextNode('Instamping Not Available For Designer Collection Leather');
			objCell.appendChild(objText);

//	Row YY
			inrRowCounter++;
			var objRow = objTable.insertRow(inrRowCounter);

			var objCell = objRow.insertCell(0);
			objCell.className = 'classPersonalisation classPaddingRow';
			var objText = document.createTextNode('Instamping color:');
			objCell.appendChild(objText);

			var objCell = objRow.insertCell(1);
			objCell.className = 'classPersonalisation classBookPaper';

			var objText = document.createTextNode('Gold');
			var objDiv = document.createElement('div');
			objDiv.className = 'classPaperPageDivText';
			objDiv.setAttribute('align', 'right');
			objDiv.appendChild(objText);
			objCell.appendChild(objDiv);

			var objInput = document.createElement('input');
			objInput.className = 'classBookInput';
			objInput.setAttribute('type', 'radio')
			objInput.setAttribute('name', 'Instampingcolor')
			objInput.setAttribute('value', 'Gold');
			var objDiv = document.createElement('div');
			objDiv.className = 'classPaperPageDivInput';
			objDiv.setAttribute('align', 'right');
			objDiv.appendChild(objInput);
			objCell.appendChild(objDiv);

			var objText = document.createTextNode('Silver');
			var objDiv = document.createElement('div');
			objDiv.className = 'classPaperPageDivText';
			objDiv.setAttribute('align', 'right');
			objDiv.appendChild(objText);
			objCell.appendChild(objDiv);

			var objInput = document.createElement('input');
			objInput.className = 'classBookInput';
			objInput.setAttribute('type', 'radio')
			objInput.setAttribute('name', 'Instampingcolor')
			objInput.setAttribute('value', 'Silver');
			var objDiv = document.createElement('div');
			objDiv.className = 'classPaperPageDivInput';
			objDiv.setAttribute('align', 'right');
			objDiv.appendChild(objInput);
			objCell.appendChild(objDiv);

			var objText = document.createTextNode('Black');
			var objDiv = document.createElement('div');
			objDiv.className = 'classPaperPageDivText';
			objDiv.setAttribute('align', 'right');
			objDiv.appendChild(objText);
			objCell.appendChild(objDiv);

			var objInput = document.createElement('input');
			objInput.className = 'classBookInput';
			objInput.setAttribute('type', 'radio')
			objInput.setAttribute('name', 'Instampingcolor')
			objInput.setAttribute('value', 'Black');
			var objDiv = document.createElement('div');
			objDiv.className = 'classPaperPageDivInput';
			objDiv.setAttribute('align', 'right');
			objDiv.appendChild(objInput);
			objCell.appendChild(objDiv);

//	Row Y
			inrRowCounter++;
			var objRow = objTable.insertRow(inrRowCounter);

			var objCell = objRow.insertCell(0);
			objCell.className = 'classPersonalisation classPaddingRow';
			var objText = document.createTextNode('Instamping fonts:');
			objCell.appendChild(objText);

			var objText = document.createTextNode('(');
			objCell.appendChild(objText);
			var objLink = document.createElement('a');
			objLink.setAttribute('href', '/images/fonts.jpg');
			objLink.setAttribute('target', '_blanck');
			objLink.setAttribute('style', 'color: black;');
			var objText = document.createTextNode('example');
			objLink.onclick = function() {window.open('/images/fonts.jpg','','width=625,height=225,scrollbars,resizable,toolbar,');  return false;}
			objLink.appendChild(objText);
			objCell.appendChild(objLink);
			var objText = document.createTextNode(') ');
			objCell.appendChild(objText);

			var objCell = objRow.insertCell(1);
			objCell.className = 'classPersonalisation classBookPaper';

			var objText = document.createTextNode('Bold font');
			var objDiv = document.createElement('div');
			objDiv.className = 'classPaperPageDivText';
			objDiv.setAttribute('align', 'right');
			objDiv.appendChild(objText);
			objCell.appendChild(objDiv);

			var objInput = document.createElement('input');
			objInput.className = 'classBookInput';
			objInput.setAttribute('type', 'radio')
			objInput.setAttribute('name', 'Instampingfonts')
			objInput.setAttribute('value', 'Boldfont');
			var objDiv = document.createElement('div');
			objDiv.className = 'classPaperPageDivInput';
			objDiv.setAttribute('align', 'right');
			objDiv.appendChild(objInput);
			objCell.appendChild(objDiv);

			var objText = document.createTextNode('Park avenue font');
			var objDiv = document.createElement('div');
			objDiv.className = 'classPaperPageDivText';
			objDiv.setAttribute('align', 'right');
			objDiv.appendChild(objText);
			objCell.appendChild(objDiv);

			var objInput = document.createElement('input');
			objInput.className = 'classBookInput';
			objInput.setAttribute('type', 'radio')
			objInput.setAttribute('name', 'Instampingfonts')
			objInput.setAttribute('value', 'Avenuefont');
			var objDiv = document.createElement('div');
			objDiv.className = 'classPaperPageDivInput';
			objDiv.setAttribute('align', 'right');
			objDiv.appendChild(objInput);
			objCell.appendChild(objDiv);
			
//	Row Y
			inrRowCounter++;
			var objRow = objTable.insertRow(inrRowCounter);

			var objCell = objRow.insertCell(0);
			objCell.className = 'classPersonalisation classPaddingRow';
			var objText = document.createTextNode('Liner color:');
			objCell.appendChild(objText);

			var objCell = objRow.insertCell(1);
			objCell.className = 'classPersonalisation classBookPaper';

			var objText = document.createTextNode('Black silk moire');
			var objDiv = document.createElement('div');
			objDiv.className = 'classPaperPageDivText';
			objDiv.setAttribute('align', 'right');
			objDiv.appendChild(objText);
			objCell.appendChild(objDiv);

			var objInput = document.createElement('input');
			objInput.className = 'classBookInput';
			objInput.setAttribute('type', 'radio')
			objInput.setAttribute('name', 'Linercolor')
			objInput.setAttribute('value', 'Blacksilkmoire');
			var objDiv = document.createElement('div');
			objDiv.className = 'classPaperPageDivInput';
			objDiv.setAttribute('align', 'right');
			objDiv.appendChild(objInput);
			objCell.appendChild(objDiv);

			var objText = document.createTextNode('Ivory silk moire');
			var objDiv = document.createElement('div');
			objDiv.className = 'classPaperPageDivText';
			objDiv.setAttribute('align', 'right');
			objDiv.appendChild(objText);
			objCell.appendChild(objDiv);

			var objInput = document.createElement('input');
			objInput.className = 'classBookInput';
			objInput.setAttribute('type', 'radio')
			objInput.setAttribute('name', 'Linercolor')
			objInput.setAttribute('value', 'Ivorysilkmoire');
			var objDiv = document.createElement('div');
			objDiv.className = 'classPaperPageDivInput';
			objDiv.setAttribute('align', 'right');
			objDiv.appendChild(objInput);
			objCell.appendChild(objDiv);

//	Row X
			inrRowCounter++;
			var objRow = objTable.insertRow(inrRowCounter);

			var objCell = objRow.insertCell(0);
			objCell.className = 'classPersonalisation classPaddingRow1';
			var objText = document.createTextNode('Imprinting in the center of the cover:');
			objCell.appendChild(objText);

			var objBr = document.createElement('br');
			objCell.appendChild(objBr);
			var objText = document.createTextNode('(');
			objCell.appendChild(objText);
			var objLink = document.createElement('a');
			objLink.setAttribute('href', '/images/center.jpg');
			objLink.setAttribute('target', '_blanck');
			objLink.setAttribute('style', 'color: black;');
			var objText = document.createTextNode('example');
			objLink.onclick = function() {window.open('/images/center.jpg','','width=360,height=625,scrollbars,resizable,toolbar,');  return false;}
			objLink.appendChild(objText);
			objCell.appendChild(objLink);
			var objText = document.createTextNode(')');
			objCell.appendChild(objText);

			var objCell = objRow.insertCell(1);
			objCell.className = 'classPersonalisation classPaddingRow1';
			var objTextArea = document.createElement('textarea');
			objTextArea.className = 'classPersonalisationTextArea classMarginRight20';
			objTextArea.setAttribute('name', 'CustomCenteredImprinting');
			objTextArea.setAttribute('id', 'idCustomCenteredImprinting');
			objCell.appendChild(objTextArea);

//	Row XY
			inrRowCounter++;
			var objRow = objTable.insertRow(inrRowCounter);

			var objCell = objRow.insertCell(0);
			objCell.className = 'classPersonalisation classPaddingRow classPersonalisationBorder';
			var objText = document.createTextNode('Imprinting in the lower right corner of the cover:');
			objCell.appendChild(objText);

			var objCell = objRow.insertCell(1);
			objCell.className = 'classPersonalisation classPaddingRow classPersonalisationBorder';
			var objTextArea = document.createElement('textarea');
			objTextArea.className = 'classPersonalisationTextArea classMarginRight20';
			objTextArea.setAttribute('name', 'CustomLowerRightImprinting');
			objTextArea.setAttribute('id', 'idCustomLowerRightImprinting');
			objCell.appendChild(objTextArea);

//	Row 9
			inrRowCounter++;
			var objRow = objTable.insertRow(inrRowCounter);

			var objCell = objRow.insertCell(0);
			objCell.className = 'classPersonalisation classPaddingRow';
			var objText = document.createTextNode('Special instructions:');
			objCell.appendChild(objText);

			var objCell = objRow.insertCell(1);
			objCell.className = 'classPersonalisation classPaddingRow';
			var objTextArea = document.createElement('textarea');
			objTextArea.className = 'classPersonalisationTextArea classMarginRight20';
			objTextArea.setAttribute('name', 'Notes');
			objTextArea.setAttribute('id', 'idNotes');
			objCell.appendChild(objTextArea);

//			Row 10
			inrRowCounter++;
			var objRow = objTable.insertRow(inrRowCounter);

			var objCell = objRow.insertCell(0);
			objCell.className = 'classPersonalisation classPaddingRow1';
			var objText = document.createTextNode('Book Quantity:');
			objCell.appendChild(objText);

			var objCell = objRow.insertCell(1);
			objCell.className = 'classPersonalisation classPaddingRow1';

			var objInput = document.createElement('input');
			objInput.className = 'classBookInputQuantity';
			objInput.setAttribute('type', 'text')
			objInput.setAttribute('name', 'BookQuantity')
			objInput.setAttribute('id', 'idBookQuantity');
			objCell.appendChild(objInput);

//	Row 10x
			inrRowCounter++;
			var objRow = objTable.insertRow(inrRowCounter);
			var objCell = objRow.insertCell(0);

			objCell.className = 'classPersonalisationLine';
			objCell.colSpan = 7;
			var objSpan = document.createElement('span');
			var objText = document.createTextNode('');
			objSpan.appendChild(objText);
			objCell.appendChild(objSpan);

//	Row 11
			inrRowCounter++;
			var objRow = objTable.insertRow(inrRowCounter);

			var objCell = objRow.insertCell(0);
			objCell.className = 'classPersonalisation';
			objCell.setAttribute('align', 'center');
			objCell.colSpan = 7;
			var objSpan = document.createElement('span');
			objSpan.className = 'classEvent';
			var objImage = new Image(209, 61);
			objImage.src = '/images/next.gif';
			objImage.setAttribute('alt', 'Next step');
			objSpan.appendChild(objImage);
//			var objText = document.createTextNode('Next step');
//			objSpan.appendChild(objText);
			Event.observe(objSpan, 'click', ShowStep3);
			objCell.appendChild(objSpan);

			document.getElementById(idTrans+'Body').appendChild(objTable);

			setDefaultParams(2);
		break;
//		===
//		BEGIN STEP 3
//		===
		case 3:
			while (document.getElementById(idTrans+'Body').firstChild) {
				document.getElementById(idTrans+'Body').removeChild(document.getElementById(idTrans+'Body').firstChild);
			}


			if (document.getElementById('idBackHistoryImg')) {
				document.getElementById('idBackHistoryImg').src = '/images/folders/back.gif';
				document.getElementById('idBackHistoryImg').setAttribute('width', '79');
				document.getElementById('idBackHistoryImg').setAttribute('height', '20');
			}

			var objImage = new Image(70, 17);
			objImage.src = '/images/cover.jpg';
			objImage.setAttribute('alt', 'Cover');
			objImage.style.paddingTop = '10px';
			objImage.style.paddingBottom = '10px';
			document.getElementById(idTrans+'Body').appendChild(objImage);

			var objBr = document.createElement('br');
			document.getElementById(idTrans+'Body').appendChild(objBr);

			var objImage = new Image(389, 17);
			objImage.src = '/images/coverpls.jpg';
			objImage.setAttribute('alt', 'Please select your book cover type');
			objImage.style.paddingTop = '10px';
			objImage.style.paddingBottom = '10px';
			document.getElementById(idTrans+'Body').appendChild(objImage);


			var objDiv = document.createElement('div');
			var objBr = document.createElement('br');
			objDiv.appendChild(objBr);
			document.getElementById(idTrans+'Body').appendChild(objDiv);

//	Data Table 3
			var objDiv = document.createElement('div');
			objDiv.setAttribute('align', 'cener');
			var objTable = document.createElement('table');
			objTable.setAttribute('cellpadding', 0);
			objTable.setAttribute('cellspacing', 0);
			objTable.setAttribute('border', 0);
//			objTable.setAttribute('width', '100%');

			var objRow = objTable.insertRow(0);

			var objCell = objRow.insertCell(0);
			objCell.className = 'classPersonalisation';
//			var objText = document.createTextNode('Cameo');
//			objCell.appendChild(objText);

			var objCell = objRow.insertCell(1);
			objCell.className = 'classPersonalisation';
			objCell.setAttribute('align', 'center');
//			var objInput = document.createElement('input');
//			objInput.setAttribute('type', 'radio');
//			objInput.setAttribute('name', 'Cover');
//			objInput.setAttribute('value', 'Cameo');
//			objInput.onchange = ChangeTitlePreview;
//			objCell.appendChild(objInput);
			var objImage = new Image(150, 150);
			objImage.src = '/images/cameo.jpg';
			objImage.className = 'classEvent classHideImageBackground';
			objImage.setAttribute('type', 'album');
			objImage.setAttribute('current', 'false');
			Event.observe(objImage, 'mouseover', imageShow);
			Event.observe(objImage, 'mouseout', imageHide);
			Event.observe(objImage, 'click', selectAlbum);
			objCell.appendChild(objImage);
			var objText = document.createTextNode('Cameo');
			objCell.appendChild(objText);

			var objCell = objRow.insertCell(2);
			objCell.className = 'classPersonalisation';
//			var objText = document.createTextNode('Leather');
//			objCell.appendChild(objText);

			var objCell = objRow.insertCell(3);
			objCell.className = 'classPersonalisation';
			objCell.setAttribute('align', 'center');
//			var objInput = document.createElement('input');
//			objInput.setAttribute('type', 'radio');
//			objInput.setAttribute('name', 'Cover');
//			objInput.setAttribute('value', 'Leather');
//			objInput.onchange = ChangeTitlePreview;
//			objCell.appendChild(objInput);
			var objImage = new Image(150, 150);
			objImage.src = '/images/leather.jpg';
			objImage.className = 'classEvent classHideImageBackground';
			objImage.setAttribute('type', 'album');
			objImage.setAttribute('current', 'false');
			Event.observe(objImage, 'mouseover', imageShow);
			Event.observe(objImage, 'mouseout', imageHide);
			Event.observe(objImage, 'click', selectAlbum);
			objCell.appendChild(objImage);
			var objText = document.createTextNode('Leather');
			objCell.appendChild(objText);


			var objCell = objRow.insertCell(4);
			objCell.className = 'classPersonalisation';
//			var objText = document.createTextNode('Acrylic');
//			objCell.appendChild(objText);

			var objCell = objRow.insertCell(5);
			objCell.className = 'classPersonalisation';
			objCell.setAttribute('align', 'center');
//			var objInput = document.createElement('input');
//			objInput.setAttribute('type', 'radio');
//			objInput.setAttribute('name', 'Cover');
//			objInput.setAttribute('value', 'Acrylic');
//			objInput.onchange = ChangeTitlePreview;
//			objCell.appendChild(objInput);
			var objImage = new Image(150, 150);
			objImage.src = '/images/acrylic.jpg';
			objImage.className = 'classEvent classHideImageBackground';
			objImage.setAttribute('type', 'album');
			objImage.setAttribute('current', 'false');
			Event.observe(objImage, 'mouseover', imageShow);
			Event.observe(objImage, 'mouseout', imageHide);
			Event.observe(objImage, 'click', selectAlbum);
			objCell.appendChild(objImage);
			var objText = document.createTextNode('Acrylic');
			objCell.appendChild(objText);


			var objCell = objRow.insertCell(6);
			objCell.className = 'classPersonalisation';
//			var objText = document.createTextNode('Aluminum');
//			objCell.appendChild(objText);

			var objCell = objRow.insertCell(7);
			objCell.className = 'classPersonalisation';
			objCell.setAttribute('align', 'center');
//			var objInput = document.createElement('input');
//			objInput.setAttribute('type', 'radio');
//			objInput.setAttribute('name', 'Cover');
//			objInput.setAttribute('value', 'Aluminum');
//			objInput.onchange = ChangeTitlePreview;
//			objCell.appendChild(objInput);
			var objImage = new Image(150, 150);
			objImage.src = '/images/aluminium.jpg';
			objImage.className = 'classEvent classHideImageBackground';
			objImage.setAttribute('type', 'album');
			objImage.setAttribute('current', 'false');
			Event.observe(objImage, 'mouseover', imageShow);
			Event.observe(objImage, 'mouseout', imageHide);
			Event.observe(objImage, 'click', selectAlbum);
			objCell.appendChild(objImage);
			var objText = document.createTextNode('Aluminium');
			objCell.appendChild(objText);

			var objCell = objRow.insertCell(8);
			objCell.className = 'classPersonalisation';
//			var objText = document.createTextNode('Canvas');
//			objCell.appendChild(objText);

			var objCell = objRow.insertCell(9);
			objCell.className = 'classPersonalisation';
			objCell.setAttribute('align', 'center');
//			var objInput = document.createElement('input');
//			objInput.setAttribute('type', 'radio');
//			objInput.setAttribute('name', 'Cover');
//			objInput.setAttribute('value', 'Canvas');
//			objInput.onchange = ChangeTitlePreview;
//			objCell.appendChild(objInput);
			var objImage = new Image(150, 150);
			objImage.src = '/images/canvas.jpg';
			objImage.className = 'classEvent classHideImageBackground';
			objImage.setAttribute('type', 'album');
			objImage.setAttribute('current', 'false');
			Event.observe(objImage, 'mouseover', imageShow);
			Event.observe(objImage, 'mouseout', imageHide);
			Event.observe(objImage, 'click', selectAlbum);
			objCell.appendChild(objImage);
			var objText = document.createTextNode('Canvas');
			objCell.appendChild(objText);

//			Row 0
			var objRow = objTable.insertRow(1);

			var objCell = objRow.insertCell(0);
			objCell.className = 'classPersonalisationLine classMessageBody';
			objCell.colSpan = 10;
			objCell.setAttribute('id', 'idMessageBody');
			objCell.setAttribute('align', 'center');

//			Row 1
			var objRow = objTable.insertRow(2);

			var objCell = objRow.insertCell(0);
			objCell.className = 'classPersonalisationLine';
			objCell.colSpan = 10;
			objCell.setAttribute('id', 'idSubAlbumSample');

//			Row 2
			var objRow = objTable.insertRow(3);

			var objCell = objRow.insertCell(0);
			objCell.className = 'classPersonalisationLine';
			objCell.colSpan = 10;
			var objSpan = document.createElement('span');
			var objText = document.createTextNode('');
			objSpan.appendChild(objText);
			objCell.appendChild(objSpan);

//			Row 3
			var objRow = objTable.insertRow(4);

			var objCell = objRow.insertCell(0);
			objCell.className = 'classPersonalisation';
			objCell.setAttribute('align', 'center');
			objCell.colSpan = 10;
			var objSpan = document.createElement('span');
			objSpan.className = 'classEvent';
			var objImage = new Image(209, 61);
			objImage.setAttribute('id', 'finishAlbumImage');
			objImage.src = '/images/finish.jpg';
			objImage.setAttribute('alt', 'Finish');
			objSpan.appendChild(objImage);
			objImage.style.display = 'none';
//			var objText = document.createTextNode('Finish');
//			objSpan.appendChild(objText);
			objSpan.onclick = ShowStep4;
			objCell.appendChild(objSpan);

			objDiv.appendChild(objTable);
			document.getElementById(idTrans+'Body').appendChild(objDiv);

//alert(document.body.style.top);
//alert(document.body.scrollTop);
//alert(1);
//alert(document.getElementById(idTrans+'Table').scrollTop);
//alert(window.pageYOffset);

//			document.body.style.top = 0;
//alert(window.pageYOffset);
//window.pageYOffset = 0;
			if (window.location.href.toString().indexOf('#top') == -1) {
				window.location.href = window.location.href+'#top';
			} else {
				window.location.href = window.location.href;
			}
			setDefaultParams(3);
		break;
	}
}
function ChangeTitlePreview() {
	document.getElementById('idTitlePreviewBody').innerHTML = document.getElementById('idBrideEventName').value + ' ' + document.getElementById('idConjunction').value + ' ' + document.getElementById('idGroomEventName').value + '<br/>' + document.getElementById('idWeddingEventDate').value;
}
function ShowStep2() {
	if (!document.getElementById('idBrideEventName').value) {
		var objRow = document.getElementById('idBrideEventName');
		while (objRow.nodeName.toString().toLowerCase() != 'tr') {
			objRow = objRow.parentNode;
		}
		if (objRow.getElementsByTagName('td') && objRow.getElementsByTagName('td').length > 0 && objRow.getElementsByTagName('td')[0].className.toString().indexOf('classColorRed') == -1) {
			objRow.getElementsByTagName('td')[0].className += ' classColorRed';
		}
		alert('Please. Enter the "Bride/Event name".');
		return false;
	}

	var strPost = new String('');
	strPost += 'SUBMIT=SaveAlbumStep';
	strPost += '&Step=1';
	strPost += '&dataSetId='+encodeURIComponent(document.getElementById(idTrans+'Table').getAttribute('dataSetId'));
	strPost += '&BrideEventName='+encodeURIComponent(document.getElementById('idBrideEventName').value);
	strPost += '&Conjunction='+encodeURIComponent(document.getElementById('idConjunction').value);
	strPost += '&GroomEventName='+encodeURIComponent(document.getElementById('idGroomEventName').value);
	strPost += '&WeddingEventDate='+encodeURIComponent(document.getElementById('idWeddingEventDate').value);
	strPost += '&Notes='+encodeURIComponent(document.getElementById('idNotes').value);

	var strUrl = new String('/');

    new Ajax.Request(strUrl, {
		method: 'post',
        asynchronous: false,
        parameters: strPost,
		onSuccess: function(transport) {
    		DrawStep(2);
		}
	});
}
function ShowStep3() {
	var strPost = new String('');
	strPost += 'SUBMIT=SaveAlbumStep';
	strPost += '&Step=2';
	strPost += '&dataSetId='+encodeURIComponent(document.getElementById(idTrans+'Table').getAttribute('dataSetId'));
	var arrInput = document.getElementById(idTrans+'Table').getElementsByTagName('input');
	for (var i=0; i<arrInput.length; i++) {
		if ((arrInput[i].name == 'PrimaryBookSizes' || arrInput[i].name == 'BookPaper' || arrInput[i].name == 'Spine' || arrInput[i].name == 'Gilding' || arrInput[i].name == 'Corners' || arrInput[i].name == 'Instampingcolor' || arrInput[i].name == 'Linercolor' || arrInput[i].name == 'Instampingfonts') && arrInput[i].checked) {
			strPost += '&'+arrInput[i].name+'='+encodeURIComponent(arrInput[i].value);
		}
	}
	strPost += '&NumberOfSides='+encodeURIComponent(document.getElementById('idNumberOfSides').value);
	strPost += '&PageQuantity='+encodeURIComponent(document.getElementById('idPageQuantity').value);
	strPost += '&BookQuantity='+encodeURIComponent(document.getElementById('idBookQuantity').value);
	strPost += '&CustomCenteredImprinting='+encodeURIComponent(document.getElementById('idCustomCenteredImprinting').value);
	strPost += '&CustomLowerRightImprinting='+encodeURIComponent(document.getElementById('idCustomLowerRightImprinting').value);
	strPost += '&Notes='+encodeURIComponent(document.getElementById('idNotes').value);

	var strUrl = new String('/');

    new Ajax.Request(strUrl, {
		method: 'post',
        asynchronous: false,
        parameters: strPost,
		onSuccess: function(transport) {
    		DrawStep(3);
		}
	});
}
function ShowStep4() {
	var strPost = new String('');
	strPost += 'SUBMIT=SaveAlbumStep';
	strPost += '&Step=3';
	strPost += '&dataSetId='+encodeURIComponent(document.getElementById(idTrans+'Table').getAttribute('dataSetId'));
	var arrImage = document.getElementsByTagName('img');
	for (var i=0; i<arrImage.length; i++) {
		if (arrImage[i].className.toString().indexOf('classShowImageBackground') != -1 && arrImage[i].getAttribute('type')) {
			strPost += '&'+arrImage[i].getAttribute('type')+'='+encodeURIComponent(arrImage[i].src);
		}
		if (arrImage[i].getAttribute('type') == 'subalbum') {
			strPost += '&'+arrImage[i].getAttribute('type')+'[]='+encodeURIComponent(arrImage[i].src);
		}
	}
	if (document.getElementById('idSpecialInstructionsCover')) {
		strPost += '&SpecialInstructionsCover='+encodeURIComponent(document.getElementById('idSpecialInstructionsCover').value);
	}
	if (document.getElementById('addToCart')) {
		showAddOrder();
	} else {
		Event.observe(window, 'load', showAddOrder);
	}
//	var arrInput = document.getElementsByTagName('input');
//	for (var i=0; i<arrInput.length; i++) {
//		if (arrInput[i].name == 'CameoSurface' && arrInput[i].checked) {
//			strPost += '&'+arrInput[i].name+'='+encodeURIComponent(arrInput[i].value);
//		}
//	}

	var strUrl = new String('/');

    new Ajax.Request(strUrl, {
		method: 'post',
        asynchronous: false,
        parameters: strPost,
		onSuccess: function(transport) {
//	        while (document.getElementById(idTrans+'Table').firstChild) {
//	    		document.getElementById(idTrans+'Table').removeChild(document.getElementById(idTrans+'Table').firstChild);
//	    	}
//	
//	    	document.getElementById(idTrans+'Table').parentNode.removeChild(document.getElementById(idTrans+'Table'));
//	    	document.getElementById(idTrans).parentNode.removeChild(document.getElementById(idTrans));
	    	checkAlbums();
	    	if (window.location.href.toString().indexOf('#') != -1) {
	    		arrHref = window.location.href.toString().split('#');
	    		window.location.href = arrHref[0];
	    	}
			window.location.href = window.location.href;
		}
	});

}
function checkAlbums() {
	if (arrAlbumNotComplite.length > 0) {
		var objDataSet = arrAlbumNotComplite[arrAlbumNotComplite.length - 1];
		arrAlbumNotComplite.splice(arrAlbumNotComplite.length - 1, 1);

		ChangeAlbumSettings.call(objDataSet.firstChild);
	}
}
Event.observe(window, 'load', checkAlbums);
function checkPhotoCount(intMin) {
	return true;
	var intCount = new Number(0);
	var objInput = document.getElementsByTagName('input');
	for (var i=0; i<objInput.length; i++ ) {
		if (objInput[i].type == 'checkbox' && objInput[i].name.toString().indexOf('file[]') != -1 && objInput[i].checked) {
			intCount++;
		}
	}
	if (intCount < intMin) {
		alert('You need to choose more than '+intMin+' photos');
		return false;
	}
	return true;
}
function selectAlbum() {
	var objImages = document.getElementsByTagName('img');
	for (var i=0; i<objImages.length; i++) {
		if(objImages[i].getAttribute('type') && objImages[i].getAttribute('type') == 'album') {
			objImages[i].className = 'classEvent classHideImageBackground';
			objImages[i].setAttribute('current', 'false');
		}
	}
	this.setAttribute('current', 'true');
	this.className = 'classEvent classShowImageBackground';

	DrawMessageText(this);

	var strUrl = new String('/index.php');
	var strPost = new String('');
	strPost += 'getTemplate=true&';
	strPost += 'sType=order&';
	strPost += 'sAction=getAlbumSample&';
	strPost += 'sTemplate=';

	if (this.src.toString().indexOf('leather') != -1) {
		strPost += 'leather';
	} else if (this.src.toString().indexOf('canvas') != -1) {
		strPost += 'canvas';
	} else if (this.src.toString().indexOf('aluminium') != -1) {
		strPost += 'aluminium';
	} else if (this.src.toString().indexOf('acrylic') != -1) {
		strPost += 'acrylic';
	} else if (this.src.toString().indexOf('cameo') != -1) {
		strPost += 'cameo';
	} else {
		strPost += 'default';
	}

	new Ajax.Request(strUrl, {
		method: 'post',
        asynchronous: false,
        parameters: strPost,
		onSuccess: function(transport) {
			if (document.getElementById('idSubAlbumSample')) {
				document.getElementById('idSubAlbumSample').innerHTML = transport.responseText;
				var objImages = document.getElementById('idSubAlbumSample').getElementsByTagName('img');
				for (var i=0; i<objImages.length; i++) {
					if (objImages[i].src.toString().indexOf('COLLECTIONIMAGE') != -1) {
						objImages[i].className = 'classEvent classHideImageBackground';
						objImages[i].setAttribute('current', 'false');
						Event.observe(objImages[i], 'mouseover', imageShow);
						Event.observe(objImages[i], 'mouseout', imageHide);
						Event.observe(objImages[i], 'click', imageSelect);
					}
				}
			}
			if (document.getElementById('finishAlbumImage'))
			document.getElementById('finishAlbumImage').style.display = 'block';
		}
	});
}
function showSubMaterialList(strMaterialListID) {
	var strUrl = new String('/index.php');
	var strPost = new String('');
	strPost += 'getTemplate=true&';
	strPost += 'sType=order&';
	strPost += 'sAction=getAlbumSample&';
	strPost += 'sTemplate=default';

	new Ajax.Request(strUrl, {
		method: 'post',
        asynchronous: false,
        parameters: strPost,
		onSuccess: function(transport) {
			if (document.getElementById('idSubAlbumSample')) {
				document.getElementById(strMaterialListID).innerHTML = transport.responseText;
				var objImages = document.getElementById(strMaterialListID).getElementsByTagName('img');
				for (var i=0; i<objImages.length; i++) {
					if (objImages[i].src.toString().indexOf('COLLECTIONIMAGE') != -1) {
						objImages[i].className = 'classEvent classHideImageBackground';
						objImages[i].setAttribute('current', 'false');
						Event.observe(objImages[i], 'mouseover', imageShow);
						Event.observe(objImages[i], 'mouseout', imageHide);
						Event.observe(objImages[i], 'click', materialSelect);
					}
				}
			}
		}
	});
}
function materialSelect() {
	var objCell = this;
	while (objCell.nodeName.toString().toLowerCase() != 'td') {
		objCell = objCell.parentNode;
	}
	objCell = objCell.parentNode;
	while (objCell.nodeName.toString().toLowerCase() != 'td') {
		objCell = objCell.parentNode;
	}

	if (objCell.getAttribute('id')) {
		document.getElementById(objCell.getAttribute('id')+'Image').src = this.src;
		document.getElementById(objCell.getAttribute('id')).innerHTML = '';
	}
}
function DrawMessageText(objImage) {
	if (objImage.src.toString().indexOf('leather') != -1) {
		document.getElementById('idMessageBody').innerHTML = '&nbsp;';
	} else if (objImage.src.toString().indexOf('canvas') != -1 || objImage.src.toString().indexOf('aluminium') != -1 || objImage.src.toString().indexOf('acrylic') != -1) {
		document.getElementById('idMessageBody').innerHTML = '&nbsp;';		
	} else {
		document.getElementById('idMessageBody').innerHTML = '&nbsp;';
	}
}
function imageShow() {
	if (this.className.toString().indexOf('classShowImageBackground') == -1) {
		this.className = 'classEvent classShowImageBackground';
	}
}
function imageHide() {
	if (this.getAttribute('current') && this.getAttribute('current') != 'true') {
		this.className = 'classEvent classHideImageBackground';
	}
}
function imageSelect() {
	var objImages = document.getElementById('idSubAlbumSample').getElementsByTagName('img');
	for (var i=0; i<objImages.length; i++) {
		objImages[i].className = 'classEvent classHideImageBackground';
		objImages[i].setAttribute('current', 'false');
	}
	this.setAttribute('current', 'true');
	this.className = 'classEvent classShowImageBackground';
}
function setDefaultParams(intStep) {
	intCurrentStep = intStep;
	var strPost = new String('');
	strPost += 'dataSetId='+encodeURIComponent(document.getElementById(idTrans+'Table').getAttribute('dataSetId'));
	strPost += '&SUBMIT=GetAlbumStep';
	strPost += '&Step='+intStep;
	var strUrl = new String('/');

    new Ajax.Request(strUrl, {
		method: 'post',
        asynchronous: false,
        parameters: strPost,
		onSuccess: function(transport) {
    		eval(transport.responseText);

	    	switch(intStep) {
	    		case 1:
	    			if (arrStepData && arrStepData['BrideEventName']) {
		    			document.getElementById('idBrideEventName').value = arrStepData['BrideEventName'];
		    			document.getElementById('idGroomEventName').value = arrStepData['GroomEventName'];
		    			document.getElementById('idWeddingEventDate').value = arrStepData['WeddingEventDate'];
	
		    			if (arrStepData['Conjunction']) {
		    				if (arrStepData['Conjunction'] == 'and') {
		    					document.getElementById('idConjunction').selectedIndex = 2;
		    				} else if (arrStepData['Conjunction'] == '&') {
		    					document.getElementById('idConjunction').selectedIndex = 1;
		    				}
		    			}
		    			document.getElementById('idNotes').value = arrStepData['Notes'];
		    			ChangeTitlePreview();
	    			}
	    		break;
	    		case 2:
	    			if (arrStepData && arrStepData['PrimaryBookSizes']) {
	    				if (arrStepData['NumberOfSides']) {
	    					document.getElementById('idNumberOfSides').value = arrStepData['NumberOfSides'];
	    				}
		    			document.getElementById('idPageQuantity').value = arrStepData['PageQuantity'];
		    			document.getElementById('idBookQuantity').value = arrStepData['BookQuantity'];
		    			document.getElementById('idNotes').value = arrStepData['Notes'];
		    			if (arrStepData['CustomCenteredImprinting']) {
		    				document.getElementById('idCustomCenteredImprinting').value = arrStepData['CustomCenteredImprinting'];
		    			}
		    			if (arrStepData['CustomLowerRightImprinting']) {
		    				document.getElementById('idCustomLowerRightImprinting').value = arrStepData['CustomLowerRightImprinting'];
		    			}		    			
		    			var arrInput = document.getElementById(idTrans+'Table').getElementsByTagName('input');
		    			for (var i=0; i<arrInput.length; i++) {
		    				if (arrInput[i].name == 'PrimaryBookSizes' && arrInput[i].value == arrStepData['PrimaryBookSizes'] || arrInput[i].name == 'BookPaper' && arrInput[i].value == arrStepData['BookPaper'] || arrInput[i].name == 'Spine' && arrInput[i].value == arrStepData['Spine'] || arrInput[i].name == 'Gilding' && arrInput[i].value == arrStepData['Gilding'] || arrInput[i].name == 'Corners' && arrInput[i].value == arrStepData['Corners'] || arrInput[i].name == 'Instampingcolor' && arrInput[i].value == arrStepData['Instampingcolor'] || arrInput[i].name == 'Linercolor' && arrInput[i].value == arrStepData['Linercolor'] || arrInput[i].name == 'Instampingfonts' && arrInput[i].value == arrStepData['Instampingfonts']) {
		    					arrInput[i].checked = true;
		    				}
		    			}
	    			} else {
		    			var arrInput = document.getElementById(idTrans+'Table').getElementsByTagName('input');
		    			for (var i=0; i<arrInput.length; i++) {
		    				if (arrInput[i].name == 'BookPaper') {
		    					arrInput[i].checked = true;
		    					i = arrInput.length;
		    				}
		    			}	    				
		    			for (var i=0; i<arrInput.length; i++) {
		    				if (arrInput[i].name == 'PrimaryBookSizes') {
		    					arrInput[i].checked = true;
		    					i = arrInput.length;
		    				}
		    			}	    				
		    			for (var i=0; i<arrInput.length; i++) {
		    				if (arrInput[i].name == 'Spine') {
		    					arrInput[i].checked = true;
		    					i = arrInput.length;
		    				}
		    			}
		    			for (var i=0; i<arrInput.length; i++) {
		    				if (arrInput[i].name == 'Gilding') {
		    					arrInput[i].checked = true;
		    					i = arrInput.length;
		    				}
		    			}
		    			for (var i=0; i<arrInput.length; i++) {
		    				if (arrInput[i].name == 'Corners') {
		    					arrInput[i].checked = true;
		    					i = arrInput.length;
		    				}
		    			}
		    			for (var i=0; i<arrInput.length; i++) {
		    				if (arrInput[i].name == 'Instampingcolor') {
		    					arrInput[i].checked = true;
		    					i = arrInput.length;
		    				}
		    			}
		    			for (var i=0; i<arrInput.length; i++) {
		    				if (arrInput[i].name == 'Linercolor') {
		    					arrInput[i].checked = true;
		    					i = arrInput.length;
		    				}
		    			}
		    			for (var i=0; i<arrInput.length; i++) {
		    				if (arrInput[i].name == 'Instampingfonts') {
		    					arrInput[i].checked = true;
		    					i = arrInput.length;
		    				}
		    			}
		    			
	    			}
	    		break;
	    		case 3:
	    			if (arrStepData && arrStepData['album']) {
	    				var arrImage = document.getElementById(idTrans+'Table').getElementsByTagName('img');
	    				for (var i=0; i<arrImage.length; i++) {
	    					if (arrImage[i].src == arrStepData['album']) {
	    						arrImage[i].className += ' classShowImageBackground';
	    						arrImage[i].setAttribute('current', 'true');

								DrawMessageText(arrImage[i]);
	    					}
	    				}
	    			}
	    			if (arrStepData) {
						var strUrl = new String('/index.php');
	    				var strPost = new String('');
	    				strPost += 'getTemplate=true&';
	    				strPost += 'sType=order&';
	    				strPost += 'sAction=getAlbumSample&';
	    				strPost += 'sTemplate=';

	    				if (arrStepData['album'].toString().indexOf('leather') != -1) {
	    					strPost += 'leather';
	    				} else if (arrStepData['album'].toString().indexOf('canvas') != -1) {
	    					strPost += 'canvas';
	    				} else if (arrStepData['album'].toString().indexOf('aluminium') != -1) {
	    					strPost += 'aluminium';
	    				} else if (arrStepData['album'].toString().indexOf('acrylic') != -1) {
	    					strPost += 'acrylic';
	    				} else if (arrStepData['album'].toString().indexOf('cameo') != -1) {
	    					strPost += 'cameo';
	    				} else {
	    					strPost += 'default';
	    				}

	    				new Ajax.Request(strUrl, {
	    					method: 'post',
	    			        asynchronous: false,
	    			        parameters: strPost,
	    					onSuccess: function(transport) {
	    						if (document.getElementById('idSubAlbumSample')) {
	    							if (document.getElementById('finishAlbumImage'))
	    							document.getElementById('finishAlbumImage').style.display = 'block';
	    							document.getElementById('idSubAlbumSample').innerHTML = transport.responseText;
	    			    			//if (arrStepData['CameoSurface']) {
	    			    			//	var arrInput = document.getElementsByTagName('input');
		    			    		//	for (var i=0; i<arrInput.length; i++) {
		    			    		//		if (arrInput[i].name == 'CameoSurface') {
		    			    		//			alert(arrInput[i].value);
			    			    	//			if (arrInput[i].value == arrStepData['CameoSurface']) {
			    			    	//				arrInput[i].checked = true;
			    			    	//			} else {
			    			    	//				arrInput[i].checked = false;
			    			    	//			}
		    			    		//		}
		    			    		//	}
	    			    			//}
	    							if (arrStepData['SpecialInstructionsCover'] && document.getElementById('idSpecialInstructionsCover')) {
	    								document.getElementById('idSpecialInstructionsCover').value = arrStepData['SpecialInstructionsCover'];
	    							}
	    							var objImages = document.getElementsByTagName('img');
	    							var intSubAlbum=0;
	    							for (var i=0; i<objImages.length; i++) {
	    								if (arrImage[i].getAttribute('type') && arrImage[i].getAttribute('type') == 'subalbum' && arrStepData['subalbum'+intSubAlbum]) {
	    									arrImage[i].src = arrStepData['subalbum'+intSubAlbum];
	    									intSubAlbum++;
	    								}
	    								if (arrImage[i].getAttribute('type') && arrImage[i].getAttribute('type') == 'subalbum' && arrStepData['subalbum']) {
	    									arrImage[i].src = arrStepData['subalbum'];
	    								}
	    							}
	    						}
	    					}
	    				});	    				
	    			}
	    		break;
	    	}
		}
	});
    CheckNumberOfSides();
}
function backHistory() {
	if (intCurrentStep > 1) {
		DrawStep(intCurrentStep-1);
	}
}
function showSubSizeList(strSizelListID) {
	var strUrl = new String('/index.php');
	var strPost = new String('');
	strPost += 'getTemplate=true&';
	strPost += 'sType=order&';
	strPost += 'sAction=getAlbumSample&';
	strPost += 'sTemplate=size&';
	strPost += 'dataSetId='+encodeURIComponent(document.getElementById(idTrans+'Table').getAttribute('dataSetId'));

	new Ajax.Request(strUrl, {
		method: 'post',
        asynchronous: false,
        parameters: strPost,
		onSuccess: function(transport) {
			if (document.getElementById('idSubAlbumSample')) {
				document.getElementById(strSizelListID).innerHTML = transport.responseText;
				var objImages = document.getElementById(strSizelListID).getElementsByTagName('img');
				for (var i=0; i<objImages.length; i++) {
					if (objImages[i].src.toString().indexOf('sizefolder') != -1) {
						objImages[i].className = 'classEvent classHideImageBackground';
						objImages[i].setAttribute('current', 'false');
						Event.observe(objImages[i], 'mouseover', imageShow);
						Event.observe(objImages[i], 'mouseout', imageHide);
						Event.observe(objImages[i], 'click', materialSelect);
					}
				}
			}
		}
	});
}
function hideAddOrder() {
	document.getElementById('addToCart').style.display = 'none';
}
function showAddOrder() {
	document.getElementById('addToCart').style.display = 'block';
}
function CheckNumberOfSides() {
	if (document.getElementById('idNumberOfSides')) {
		if (document.getElementById('idNumberOfSides').value < 20 || document.getElementById('idNumberOfSides').value > 60 || Number(document.getElementById('idNumberOfSides').value) / 2 != Math.ceil(Number(document.getElementById('idNumberOfSides').value) / 2)) {
			document.getElementById('idNumberOfSides').value = 20;
			alert('Albums should have from 20 to 60 sides. Even numbers.');
		}
	}
}
