//auto generates by the storecreator and templates
var savedLoad=0;
var floatQuantity=0;
var currencyUnit ='US$';
var orderInfoFile ='info.html';
var introFile ='intro.html';
var storeName='CBT Software';
var searchFile = 'search.html';
var accountID = '2238';
var subDirID= '28';
var submitEmail= 'bnaylor@salesautomationgroup.com';
var encryptEmail= '0';
var noDecimal= 0;
var storeContactAddress='<strong>CBT Software</strong>,<br>1900 West Chandler Blvd #15 Suite 323, Chandler, AZ 85224, USA.<br><strong>Tel</strong>:480 917 0106.<br><strong>EMail</strong>:webmaster@cbtsoftware.com.<br><strong>Homepage</strong>:www.cbtsoftware.com';
var EMailSubject = 'New Order';
var serverURL= 'http://www.zilron.com/cgi-bin/storecreator/v3/checkout.cgi';
shipMethod = new Array();shipMethod[0]='U.S.P.S. $6.95';shipMethod[1]='Federal Express-Accural Charge';shipMethod[2]='Airborne-Accural Charge';billMethod = new Array();billMethod[0]='Visa';billMethod[1]='Personal Check';billMethod[2]='Money Order';billMethod[3]='MasterCard';billMethod[4]='Company Check';billMethod[5]='American Express';
var shipCalVer='1';
var mDCountryMinCharge='35.95';
var mDCountryPercentCharge='5.50';
var mDStateMinCharge='6.95';
var mDStatePercentCharge='5.50';
var mSStateMinCharge='6.95';
var mSStatePercentCharge='3.50';
var mCShipingTax=0;
var mSShippingTax=0;
var mCurrencyAfter =0;
var mPaymentCard=1;
var mPaymentCheck=0;
var mPaymentFax=0;
var mCartALink='#aaaa00';
var mAlignStr='<Left>';
var mCartBGColor='#ffffff';
var mCartBGImage='';
var mCartTableBodyColor='#000000';
var mCartTableBodyBGColor='#d8d8d8';
var mCartTableHeaderBGColor='#808080';
var mCartTableHeaderColor='#ffffff';
var mCartText='#000000';
var mCartLink='#0000aa';
var mCartVLink='#0000aa';
var mServerALink='#aaaa00';
var mServerBGColor='#ffffff';
var mServerBGImage='';
var mServerTableBodyColor='#000000';
var mServerTableBodyBGColor='#d8d8d8';
var mServerTableHeader='#ffffff';
var mServerTableHeaderBGColor='#808080';
var mServerCheckoutMesg='Shipping charge will be added to your order. For details, please see the Order Info page.';
var mServerLink='#0000aa';
var mServerText='#000000';
var mServerThankYouMesg='<strong>Thank you,<br>Your order has been placed successfully.<br>We will process your order soon.<br></strong>';
var mServerVLink='#0000aa';
var mServerLanguageStr='English';
var mServerEmailStyleStr='PlainText';
var MinimunInvoiceNumber='5000';
var FieldEmptyCheck='12222222200000000000000000000000000000000000000000';
var FieldShow='22222222200000000000000000000000000000000000000000';
var fHasCountryTax=0;
var countryTaxName='';
var countryTaxRate=0.00;
var storeCountry='USA';
var fHasStateTax=1;
var stateTaxName='Arizona';
var stateTaxRate=0.05;
var storeState='Arizona';
stateName = new Array();stateName[0]='Alabama'; stateName[1]='Alaska'; stateName[2]='Arizona'; stateName[3]='Arkansas'; stateName[4]='California'; stateName[5]='Colorado'; stateName[6]='Connecticut'; stateName[7]='Delaware'; stateName[8]='Florida'; stateName[9]='Georgia'; stateName[10]='Hawaii'; stateName[11]='Idaho'; stateName[12]='Illinois'; stateName[13]='Indiana'; stateName[14]='Iowa'; stateName[15]='Kansas'; stateName[16]='Kentucky'; stateName[17]='Louisiana'; stateName[18]='Maine'; stateName[19]='Maryland'; stateName[20]='Massachusetts'; stateName[21]='Michigan'; stateName[22]='Minnesota'; stateName[23]='Mississippi'; stateName[24]='Missouri'; stateName[25]='Montana'; stateName[26]='Nebraska'; stateName[27]='Nevada'; stateName[28]='New Hampshire'; stateName[29]='New Jersey'; stateName[30]='New Mexico'; stateName[31]='New York'; stateName[32]='North Carolina'; stateName[33]='North Dakota'; stateName[34]='Ohio'; stateName[35]='Oklahoma'; stateName[36]='Oregon'; stateName[37]='Pennsylvania'; stateName[38]='Rhode Island'; stateName[39]='South Carolina'; stateName[40]='South Dakota'; stateName[41]='Tennessee'; stateName[42]='Texas'; stateName[43]='Utah'; stateName[44]='Vermont'; stateName[45]='Virginia'; stateName[46]='Washington'; stateName[47]='Washington D.C.'; stateName[48]='West Virginia'; stateName[49]='Wisconsin'; stateName[50]='Wyoming'; 
function SelectCatalog(pageName, formName, selectName) 
{
   var i = eval("parent.frames['"+pageName+"'].document."+formName+"."+selectName+".selectedIndex");
   var url =  eval("parent.frames['"+pageName+"'].document."+formName+"."+selectName+".options["+i+"].value");
   parent.frames['shop'].window.location.href=url;
}
function Display(buttonName, picture){	eval( buttonName+".src = \"" + picture + "\";");}
function PrintSubmitField(cWin)
{
  cWin.write("<input type=hidden name=mAlignStr value='"+mAlignStr+"'>");
  cWin.write("<input type=hidden name=mCurrencyAfter value='"+mCurrencyAfter+"'>");
}
var returnHtmlPath=introFile;
function MakeArray(n) {
      this.length = n;
      for(var i = 0; i < n; i++){
            this[i] = 0;
      }
      return this;
}
function Currency(money)
{
	money =  parseFloat(money);
	money += 0.005;
	money +=  ""; 
	var monLen = money.length;
	var digPos = money.indexOf(".");
	if (noDecimal) {
		if(digPos != -1) {
			money = money.substring(0, digPos);
		}
		return money;
	}
	if(digPos == -1) {
		if (money <=0) {
			money ="0.00";
		} else {
			money += ".00";
		}
		return money;
	} else {
		if (digPos + 3 > monLen) {
			money += "0";
		} else if (digPos + 3 != monLen) {
			money = money.substring(0, digPos+3);
		} 
		return money;
	}     
}

function RECORD(n)
{
	this.length = n;
	this.curLength = 0;
	this.itemName=new MakeArray(n);
	this.price=new MakeArray(n);
	this.quantity=new MakeArray(n);
	this.itemID=new MakeArray(n);
	this.weight=new MakeArray(n);
	this.fTaxable=new MakeArray(n);
	return this;
}
var orderRecord = new RECORD(250);
function AddRecord(itemName, unitPrice, qty, itemID, weight, fTaxable)
{
	var i;
	for (i=0;i<orderRecord.curLength;i++) {
		if (orderRecord.itemName[i] == itemName) {
			orderRecord.quantity[i] += qty;
			return;
		}
	}

	if (orderRecord.curLength < orderRecord.length) {
		orderRecord.itemName[orderRecord.curLength] =itemName;
		orderRecord.quantity[orderRecord.curLength] = qty;
		orderRecord.price[orderRecord.curLength] = unitPrice;
		orderRecord.itemID[orderRecord.curLength] = itemID;
		orderRecord.weight[orderRecord.curLength] = weight;
		orderRecord.fTaxable[orderRecord.curLength] = fTaxable;
		orderRecord.curLength++;
	} else {
		alert("This order was not placed in your shopping cart because your shopping cart has been filled up.\nPlease check out to empty it before continue with next order");
	}
}

function GetSelection(theForm, fieldNum)
{
	var ft=eval("theForm.sft"+fieldNum+".value");
	var ftmp="";
	var subField = eval("theForm.subfield"+fieldNum);
	var i;
	if (ft == 1) {
		for (i = 0; i < subField.length; i++) {
				if (subField.options[i].selected) {
					return subField.options[i].value;
				}
		}
	} else {
		var subFieldName = eval("theForm.subfield"+fieldNum+"name");
		var tmp="0::"+subFieldName.value+"("+subField.value+")";
		var n=tmp.length;
		for (i=0; i <n; i++) {
			  if (tmp.charAt(i) =='\'') {
				  ftmp=ftmp+'`';
			  } else {
				   ftmp=ftmp+tmp.charAt(i);
			  }
		}
	}
     return ftmp;

}

function CalUnitPrice(theForm)
{
	var totalPrice = parseFloat(theForm.basePrice.value);
	var totalSubField = parseInt(theForm.totalSubField.value);
	var i;
	for (i=0;i<totalSubField;i++) {
		var tmpStr = GetSelection(theForm, i);
		totalPrice += parseFloat(tmpStr);
	}
	theForm.unit.value = Currency(totalPrice) ;
}

function CheckQty(theForm)
{
	var qty;
	if (floatQuantity) {
		qty=parseFloat(theForm.Qty.value);
		if (qty<=0) qty=1.00;
		qty +="";
		theForm.Qty.value = qty;
	} else {
		qty=parseInt(theForm.Qty.value);
		if (qty<=0) qty=1;
		qty +="";
		theForm.Qty.value = qty;
	}
	
}

function ReturnPath(n1, n2)
{
	if (n1 >= 0) {
		returnHtmlPath = "catalog"+n1+"_" +n2+".html";
	} else if (n1 == -1) {
		returnHtmlPath = orderInfoFile;
	} else if (n1 == -2) {
		returnHtmlPath = introFile;
	} else if (n1 == -3) {
		returnHtmlPath = "item"+n2+".html";
	}
}

function Add(theForm)
{
	var cWin= parent.frames["shop"].document;
	var itemName = theForm.itemName.value;
	var basePrice = parseFloat(theForm.basePrice.value);
	var totalPrice = basePrice;
	var totalSubField = parseInt(theForm.totalSubField.value);
	var itemID=theForm.itemID.value;
	var weight=parseFloat(theForm.itemWeight.value);
	var fTaxable=parseInt(theForm.itemTaxable.value);
	
	var i;
	var tmpStr;
	for (i=0;i<totalSubField;i++) {
		tmpStr = GetSelection(theForm, i);
		totalPrice += parseFloat(tmpStr);
		var n= tmpStr.indexOf("::");
		n+=2;
		itemName += ", " + tmpStr.substr(n);
			
	}
	var str="Add this item?\n"+itemName + "\n";
	var unitPrice= totalPrice;
	if (mCurrencyAfter) {
		str += "Unit Price "+ Currency(totalPrice )+ currencyUnit  +"\n";
	} else {
		str += "Unit Price "+currencyUnit + Currency(totalPrice ) +"\n";
	}
	var qty;
	if (floatQuantity) {
		qty=parseFloat(theForm.Qty.value);
	} else {
		qty=parseInt(theForm.Qty.value);
	}
	str += "Quantity " + qty +"\n";
	if (mCurrencyAfter) {
		str += "Total Price:"+Currency(totalPrice*qty)+currencyUnit;	
	} else {
		str += "Total Price:"+currencyUnit+Currency(totalPrice*qty);
	}
	if (confirm(str)) {
		AddRecord(itemName, unitPrice, qty, itemID, weight, fTaxable);
	} else {
		alert("This item was not placed in your shopping cart.");
		return;
	}
	ViewCart();
	PrintCartTotal();
}

function Delete(n)
{
	if (n >= orderRecord.curLength) {
		alert("Can not remove this item");
		return;
	}
	var i;
	var totalSum=orderRecord.price[n]*orderRecord.quantity[n];
	for (i=n; i<orderRecord.curLength-1; i++) {
		orderRecord.itemName[i]=orderRecord.itemName[i+1];
		orderRecord.price[i]=orderRecord.price[i+1];
		orderRecord.quantity[i]=orderRecord.quantity[i+1];
		orderRecord.itemID[i]=orderRecord.itemID[i+1];
		orderRecord.weight[i]=orderRecord.weight[i+1];
		orderRecord.fTaxable[i]=orderRecord.fTaxable[i+1];
	}
	orderRecord.curLength--;
	if (orderRecord.curLength==0) {
		var cWin = parent.frames["shop"].document;
		cWin.open();
		cWin.write("<HTML><HEAD><TITLE> Zilron Store Creator Shopping Cart Viewer</TITLE></HEAD>");
		cWin.write("<BODY  BACKGROUND='"+mCartBGImage+"' Text='"+mCartText+"' BGCOLOR='"+mCartBGColor+"' LINK='"+mCartALink+"' VLINK='"+mCartLink+"'  ALINK='"+mCartALink+"' valign=top><form><center>");
		cWin.write("<TABLE width=630 border=0 CELLSPACING=0 CELLPADDING=0><tr><td align=center>");
		cWin.write("<font size=+3><strong>Your shopping cart is empty</strong></font><hr>");
		cWin.write("</td></tr></table></form><br><center><a href='"+returnHtmlPath+"'>Back</a>");
		cWin.write("</body></html>");
		cWin.close();
		PrintCartTotal();
		return;
	}
	ViewCart();
	PrintCartTotal();
}


function RemoveAll()
{
	if( confirm("Ready to empty your shopping cart?")){
		orderRecord.curLength=0;
		var cWin = parent.frames["shop"].document;
		cWin.open();
		cWin.write("<HTML><HEAD><TITLE> Zilron StoreCreator Shopping Cart Viewer</TITLE></HEAD>");
		cWin.write("<BODY  BACKGROUND='"+mCartBGImage+"' Text='"+mCartText+"' BGCOLOR='"+mCartBGColor+"' LINK='"+mCartALink+"' VLINK='"+mCartLink+"'  ALINK='"+mCartALink+"' valign=top><form><center>");
		cWin.write("<TABLE width=630 border=0 CELLSPACING=0 CELLPADDING=0>");
		cWin.write("<font size=+3><strong>Your shopping cart is empty</strong></font><hr>");
		cWin.write("</table></form><br><center><a href='"+returnHtmlPath+"'>Back</a>");
		cWin.write("</body></html>");
		cWin.close();
	} 
	PrintCartTotal();
	return;
}


function ViewCart()
{
	var cWin= parent.frames["shop"].document;
	if (orderRecord.curLength<=0) {
		alert("Your Shopping cart is empty");
		return;
	}
	cWin.open();
	cWin.write("<HTML><HEAD><TITLE> Zilron StoreCreator v3.0 Shopping Cart Viewer</TITLE></HEAD>");
	cWin.write("<BODY BACKGROUND='"+mCartBGImage+"' Text='"+mCartText+"' BGCOLOR='"+mCartBGColor+"' LINK='"+mCartALink+"' VLINK='"+mCartLink+"'  ALINK='"+mCartALink+"' valign=top><form method=post action='"+serverURL+"' >");
	cWin.write(" "+mAlignStr+"<TABLE width=600 border=1 CELLSPACING=0 CELLPADDING=0>");
	cWin.write("<tr><td width=600 bgcolor=#666699 height=24><p align='center'><big><font color=#FFFFFF size=6><strong>"+storeName+"</strong></font></big></td></tr>");
	cWin.write("<tr><td width=600 bgcolor=#ffffff><font color=#333333 size=2><strong>Contact Address:</strong><BLOCKQUOTE><font color=#333333 size=2>"+storeContactAddress+"</font></td></tr>");
	cWin.write("<tr><td width=600 bgcolor=#ffffff><p align='center'><font color=#333333 size=2><i>"+mServerCheckoutMesg+"</i></font></td></tr>");
	cWin.write("<tr><td width=600 bgcolor=#666699><center><Strong><font color=#ffffff>Your current shopping cart</td></tr>");
	cWin.write("<tr><td width=600>");





	PrintSubmitField(cWin);

	cWin.write("<input type=hidden name=shipCalVer value='"+shipCalVer+"'>");
	cWin.write("<input type=hidden name=mDCountryMinCharge value='"+mDCountryMinCharge+"'>");
	cWin.write("<input type=hidden name=mDCountryPercentCharge value='"+mDCountryPercentCharge+"'>");
	cWin.write("<input type=hidden name=mDStateMinCharge value='"+mDStateMinCharge+"'>");
	cWin.write("<input type=hidden name=mDStatePercentCharge value='"+mDStatePercentCharge+"'>");
	cWin.write("<input type=hidden name=mSStateMinCharge value='"+mSStateMinCharge+"'>");
	cWin.write("<input type=hidden name=mSStatePercentCharge value='"+mSStatePercentCharge+"'>");
	cWin.write("<input type=hidden name=mCShipingTax value='"+mCShipingTax+"'>");
	cWin.write("<input type=hidden name=mSShippingTax value='"+mSShippingTax+"'>");

	cWin.write("<input type=hidden name=returnPath value='"+document.URL+"'>");
	cWin.write("<input type=hidden name=currencyUnit value='"+currencyUnit+"'>");
	cWin.write("<input type=hidden name=EMailSubject  value='"+EMailSubject+"'>");
	cWin.write("<input type=hidden name=encryptEmail value='"+encryptEmail+"'>");
	cWin.write("<input type=hidden name=noDecimal value='"+noDecimal+"'>");
	cWin.write("<input type=hidden name=totalShipMethod value="+shipMethod.length+">");
	for (i=0;i<shipMethod.length;i++) {
		cWin.write("<input type=hidden name=shipMethod"+i+" value='"+shipMethod[i]+"'>");
	}
	cWin.write("<input type=hidden name=totalBillMethod value="+billMethod.length+">");
	for (i=0;i<billMethod.length;i++) {
		cWin.write("<input type=hidden name=billMethod"+i+" value='"+billMethod[i]+"'>");
	}
	cWin.write("<input type=hidden name=UserID value="+accountID+">");
	cWin.write("<input type=hidden name=SubDirID value="+subDirID+">");
	cWin.write("<input type=hidden name=StoreName value='"+storeName+"'>");
	cWin.write("<input type=hidden name=storeContactAddress value='"+storeContactAddress+"'>");
	cWin.write("<input type=hidden name=mServerALink value='"+mServerALink+"'>");
	cWin.write("<input type=hidden name=mServerBGColor value='"+mServerBGColor+"'>");
	cWin.write("<input type=hidden name=mServerBGImage value='"+mServerBGImage+"'>");
	cWin.write("<input type=hidden name=mServerTableBodyColor value='"+mServerTableBodyColor+"'>");
	cWin.write("<input type=hidden name=mServerTableBodyBGColor value='"+mServerTableBodyBGColor+"'>");
	cWin.write("<input type=hidden name=mServerTableHeader value='"+mServerTableHeader+"'>");
	cWin.write("<input type=hidden name=mServerTableHeaderBGColor value='"+mServerTableHeaderBGColor+"'>");
	cWin.write("<input type=hidden name=mServerCheckoutMesg value='"+mServerCheckoutMesg+"'>");
	cWin.write("<input type=hidden name=mServerLink value='"+mServerLink+"'>");
	cWin.write("<input type=hidden name=mServerText value='"+mServerText+"'>");
	cWin.write("<input type=hidden name=mServerThankYouMesg value='"+mServerThankYouMesg+"'>");
	cWin.write("<input type=hidden name=mServerVLink value='"+mServerVLink+"'>");
	cWin.write("<input type=hidden name=mServerLanguageStr value='"+mServerLanguageStr+"'>");
	cWin.write("<input type=hidden name=mServerEmailStyleStr value='"+mServerEmailStyleStr+"'>");
	cWin.write("<input type=hidden name=FieldEmptyCheck value='"+FieldEmptyCheck+"'>");
	cWin.write("<input type=hidden name=FieldShow value='"+FieldShow+"'>");
	cWin.write("<input type=hidden name=MinimunInvoiceNumber value='"+MinimunInvoiceNumber+"'>");
	cWin.write("<input type=hidden name=mPaymentCard value='"+mPaymentCard+"'>");
	cWin.write("<input type=hidden name=mPaymentCheck value='"+mPaymentCheck+"'>");
	cWin.write("<input type=hidden name=mPaymentFax value='"+mPaymentFax+"'>");
	
	

	cWin.write("<input type=hidden name=fHasCountryTax value='"+fHasCountryTax+"'>");
	cWin.write("<input type=hidden name=countryTaxName value='"+countryTaxName+"'>");
	cWin.write("<input type=hidden name=countryTaxRate value='"+countryTaxRate+"'>");
	cWin.write("<input type=hidden name=storeCountry value='"+storeCountry+"'>");
	cWin.write("<input type=hidden name=fHasStateTax value='"+fHasStateTax+"'>");
	cWin.write("<input type=hidden name=stateTaxName value='"+stateTaxName+"'>");
	cWin.write("<input type=hidden name=stateTaxRate value='"+stateTaxRate+"'>");
	cWin.write("<input type=hidden name=storeState value='"+storeState+"'>");

	cWin.write("<input type=hidden name=totalState  value="+stateName.length+">");
	for (i=0;i<stateName.length;i++) {
		cWin.write("<input type=hidden name=stateName"+i+" value='"+stateName[i]+"'>");
	}
	

	cWin.write("<TABLE width=600 border=2 CELLSPACING=0 CELLPADDING=0>");
	cWin.write("<tr bgcolor='"+mCartTableHeaderBGColor+"'><td width=10%><b><strong><font size=2 color='"+mCartTableHeaderColor+"'><center>ItemID</center></td><td width=50%><b><strong><font size=2 color='"+mCartTableHeaderColor+"'><center>Products</center></td><td width=10%><b><strong><font size=2 color='"+mCartTableHeaderColor+"'><center>Quantity</td><td width=10%><b><strong><font size=2 color='"+mCartTableHeaderColor+"'><center>Price("+currencyUnit+")</td><td width=10%><b><strong><font size=2 color='"+mCartTableHeaderColor+"'><center>Total Price</td><td width=10%><b><strong><font size=2 color='"+mCartTableHeaderColor+"'><center>Delete</td></tr>");
	var totalPrice=0;
	cWin.write("<input type=hidden name=totalOrder value="+orderRecord.curLength+">");
	for (var i=0;i<orderRecord.curLength; i++) {
		var itemPrice=orderRecord.price[i]*orderRecord.quantity[i];
		totalPrice+=itemPrice;
		cWin.write("<tr bgcolor='"+mCartTableBodyBGColor+"'><td valign=top><font size=2 color='"+mCartTableBodyColor+"'><strong><center>"+orderRecord.itemID[i]+"</strong></td><td><font size=2 color='"+mCartTableBodyColor+"'>"+orderRecord.itemName[i]+"</td> <td><center><font size=2 color='"+mCartTableBodyColor+"'><input text=text size=4 name=qty"+i+" value='"+orderRecord.quantity[i]+"'  onBlur=parent.ModifyQty("+i+")></center></td><td align=right><font size=2 color='"+mCartTableBodyColor+"'>"+Currency(orderRecord.price[i])+"</center></td><td align=right><font size=2 color='"+mCartTableBodyColor+"'><input type=text size=7 name=itemPrice"+i+"  onBlur=parent.ModifyQty("+i+") value='"+Currency(itemPrice)+"'></td><td><font size=2 color='"+mCartTableBodyColor+"'><input type='checkbox' Name=checkbox1 onclick=parent.Delete("+i+")>Delete</td></tr>");
		cWin.write("<input type=hidden name=iname"+i+" value='"+orderRecord.itemName[i]+"'>");
		cWin.write("<input type=hidden name=p"+i+" value='"+orderRecord.price[i]+"'>");
		cWin.write("<input type=hidden name=itemID"+i+" value='"+orderRecord.itemID[i]+"'>");
		cWin.write("<input type=hidden name=itemWeight"+i+" value='"+orderRecord.weight[i]+"'>");
		cWin.write("<input type=hidden name=itemTaxable"+i+" value='"+orderRecord.fTaxable[i]+"'>");
	}
	if (mCurrencyAfter) {
		cWin.write("<tr bgcolor='"+mCartTableHeaderBGColor+"'><td colspan=4 align=right><right><font size=2 color='"+mCartTableHeaderColor+"'><b>Total</td><td align=right><center><font size=2 color='"+mCartTableHeaderColor+"'><b><input type=text size=7 name=totalPrice onBlur=parent.ModifyQty(0) value='"+Currency(totalPrice)+"'>"+currencyUnit+"</td><td></td></tr>");
	} else {
		cWin.write("<tr bgcolor='"+mCartTableHeaderBGColor+"'><td colspan=4 align=right><right><font size=2 color='"+mCartTableHeaderColor+"'><b>Total</td><td align=right><center><font size=2 color='"+mCartTableHeaderColor+"'><b>"+currencyUnit+"<input type=text size=7 name=totalPrice onBlur=parent.ModifyQty(0) value='"+Currency(totalPrice)+"'></td><td></td></tr>");
	}
	
						 
	cWin.write("</table><br><center>[<a href='"+returnHtmlPath+"'>Keep Shopping</a>|<A HREF = \"javascript:parent.RemoveAll()\" onmouseover = \"window.status='Delete All items in your shopping cart.';return true;\">Empty Shopping Cart</a>|<input type=submit value='Submit'>]</form>");
	cWin.write("<hr size=1 width=50%><font size=-1 color=#444444>If you can not submit your order form via the above button, please <A HREF = \"javascript:parent.ManualSubmit()\" onmouseover = \"window.status='Submit order manually.';return true;\">click here</a>.</font><br><br>");
	cWin.write("</td></tr></table></body></html>");
	cWin.close();
}


function  ModifyQty(n)
{
	if (n >= orderRecord.curLength) {
		return;
	}

	var qty = eval("parent.frames['shop'].document.forms[0].qty"+n+".value");
	if (qty<=0) qty=1;
	if (floatQuantity) {
		qty=parseFloat(qty)
		eval("parent.frames['shop'].document.forms[0].qty"+n+".value=parseFloat(qty)");
		orderRecord.quantity[n]=parseFloat(qty);
	} else {
		qty=parseInt(qty)
		eval("parent.frames['shop'].document.forms[0].qty"+n+".value=parseInt(qty)");
		orderRecord.quantity[n]=parseInt(qty);
	}
	var subTotalPrice=qty*orderRecord.price[n];
	eval("parent.frames['shop'].document.forms[0].itemPrice"+n+".value=Currency(subTotalPrice)");
	var totalPrice=0;
	for (var i=0;i<orderRecord.curLength; i++) {
		var itemPrice=orderRecord.price[i]*orderRecord.quantity[i];
		totalPrice+=itemPrice;
	}
	eval("parent.frames['shop'].document.forms[0].totalPrice.value=Currency(totalPrice)");
	PrintCartTotal();
}


function PrintCartTotal()
{
	var totalPrice=0;
	for (var i=0;i<orderRecord.curLength; i++) {
		var itemPrice=orderRecord.price[i]*orderRecord.quantity[i];
		totalPrice+=itemPrice;
	}
	parent.frames['cart'].document.forms[0].CartTotal.value=Currency(totalPrice);
}


function ManualSubmit()
{
	alert("Please use this manual order submission form only when you can not submit your order via the normal submit button.");
	var cWin= parent.frames["shop"].document;
	cWin.open();
	cWin.write("<HTML><HEAD><TITLE> Zilron StoreCreator v3.0 Shopping Cart Viewer</TITLE></HEAD>");
	cWin.write("<BODY Text=#000000 BGCOLOR=#ffffff LINK=#ff0000 VLINK=#aaaa00 alink=#222222 valign=top>");
	cWin.write("<center><font size=+3><strong>"+parent.storeName+"<br>Manual Order Form Submission</strong></font><hr></center><left>");
	cWin.write("Please copy and paste the following order form into your email program and send it to us.  Our email address is <strong><a href='mailto:"+parent.submitEmail+"'>"+parent.submitEmail+"</a></strong><br><a href='"+returnHtmlPath+"'>Keep Shopping</a><hr>");
	var totalPrice=0;
	for (var i=0;i<orderRecord.curLength; i++) {
		var itemPrice=orderRecord.price[i]*orderRecord.quantity[i];
		totalPrice+=itemPrice;
		cWin.write("====================<br>Item number:"+i+"<br>");
		cWin.write("<strong>"+orderRecord.itemName[i]+"</strong><br>");
		cWin.write("Qty:"+orderRecord.quantity[i]+"<br>");
		cWin.write("Unit Price:"+parent.currencyUnit+orderRecord.price[i]+"<br>");
		cWin.write("SubTotal:"+parent.currencyUnit+Currency(itemPrice)+"<br>");
	}
	cWin.write("========================================<br>Total Price "+parent.currencyUnit+Currency(totalPrice)+"<br><br>");
	cWin.write("1. Please enter the shipping address. <br>");
	cWin.write("Name:______________________________<br>");
	cWin.write("Street Address:______________________________<br>");
	cWin.write("City:______________________________<br>");
	cWin.write("State/Province:______________________________<br>");
	cWin.write("Zip/Postal Code:______________________________<br>");
	cWin.write("Country:______________________________<br>");
	cWin.write("Phone:______________________________<br>");
	cWin.write("Shipping method:______________________________<br><br><Br>");
	cWin.write("2. Please enter the billing address. <br>");
	cWin.write("Name:______________________________<br>");
	cWin.write("Street Address:______________________________<br>");
	cWin.write("City:______________________________<br>");
	cWin.write("State/Province:______________________________<br>");
	cWin.write("Zip/Postal Code:______________________________<br>");
	cWin.write("Country:______________________________<br>");
	cWin.write("Phone:______________________________<br><br><Br>");
	cWin.write("3. Please enter the paying method. <br>");
	cWin.write("Credit card type:______________________________<br>");
	cWin.write("Credit card Number:______________________________<br>");
	cWin.write("Credit card expired Month:______________________________<br>");
	cWin.write("Credit card expired Year:______________________________<br><br><BR>");
	cWin.write("4. Please enter the tax rate of your area, if any. ______________<br><br><BR><br><BR><br><BR>");
	cWin.write("</body></html>");
	cWin.close();	
}