//auto generates by the storecreator and templates
var savedLoad=0;
var mKeepShopping=0;
var floatQuantity=0;
var showCart=1;
var showPopUp=1;
var currencyUnit ='USD';
var orderInfoFile ='info.html';
var introFile ='intro.html';
var storeName='M.R. Boots';
var searchFile = 'search.html';
var accountID = '2356';
var subDirID= '30';
var submitEmail= 'purchase@mrboots.com';
var encryptEmail= '1';
var noDecimal= 0;
var storeContactAddress='<strong>M.R. Boots</strong>,<br>500 Garden City Drive Suite 4D, Monroeville, PA 15146, USA.<br><strong>Tel</strong>:412-823-3210.<br><strong>Fax</strong>:412-824-8890.<br><strong>EMail</strong>:purchase@mrboots.com.<br><strong>Homepage</strong>:http://www.mrboots.com';
var EMailSubject = 'New Order from M.R. Boots';
var mCharSet = 'iso-8859-1';
var serverURL= 'http://www.zilron.com/cgi-bin/storecreator/v4/checkout.cgi';
shipMethod = new Array();
shipMethodType = new Array();
SMmDCountryMinCharge= new Array();
SMmDStateMinCharge= new Array();
SMmSStateMinCharge= new Array();
SMmDCountryPercentCharge= new Array();
SMmDStatePercentCharge= new Array();
SMmSStatePercentCharge= new Array();
SMmDCShipCharge= new Array();
SMmDSShipCharge= new Array();
SMmSSShipCharge= new Array();
SMmDCTotal= new Array();
SMmDSTotal= new Array();
SMmSSTotal= new Array();
SMmDCMacCharge= new Array();
SMmDSMaxCharge= new Array();
SMmSSMaxCharge= new Array();
SMmHasMaxCharge= new Array();
SMmHasConCharge= new Array();
SMmSSmAdd= new Array();
SMmShipCalMethod= new Array();
SMSCCode= new Array();
var scu=0;
var scun=0;
shipMethod[0]='U.S. Mail';shipMethodType[0]='1';billMethod = new Array();
billMethodType = new Array();
billMethod[0]='Visa';billMethodType[0]='Credit Card';
billMethod[1]='MasterCard';billMethodType[1]='Credit Card';
billMethod[2]='American Express';billMethodType[2]='Credit Card';
billMethod[3]='Discover';billMethodType[3]='Credit Card';


var shipCalVer='4';
var mDCountryPercentCharge='7.00';
var mSStatePercentCharge='6.00';
var mDStatePercentCharge='6.00';
var mDStateMinCharge='5.95';
var mDCountryMinCharge='30.00';
var mSStateMinCharge='5.95';
var mShipCalMethod='0';
var mHasMaxCharge='0';
var mHasConCharge='0';
var mDSShipCharge='0.00';
var mDCShipCharge='0.00';
var mSSShipCharge='0.00';
var mDCTotal='0.00';
var mDSTotal='0.00';
var mSSTotal='0.00';
var mDCMacCharge='0.00';
var mDSMaxCharge='0.00';
var mSSMaxCharge='0.00';
var mCShipingTax=0;
var mSShippingTax=1;
var mCurrencyAfter =0;
var mCCVerify=1;
var mPaymentCard=1;
var mPaymentCheck=0;
var mPurchaseOrder=0;
var mGenderOff=1;
var mEncryptOff=0;
var mCVV2Off=0;
var mBankNameOff=1;
var mBankPhoneOff=1;
var mPaymentFax=0;
var mCartALink='#FF9900';
var mAlignStr='<Center>';
var mCartBGColor='#ffffff';
var mCartBGImage='';
var mCartTableBodyColor='#000000';
var mCartTableBodyBGColor='#d8d8d8';
var mCartTableHeaderBGColor='#808080';
var mEUTax='0';
var mShowTax=1;
var mTaxShipA=0;
var mApplyCountry=0;
var sfname='';
var mAdd='1';
var mCartTableHeaderColor='#ffffff';
var mCartText='#000000';
var mCartLink='#530000';
var mCartVLink='#008080';
var mSpecCode='';
var mServerALink='#FF9900';
var mServerBGColor='#ffffff';
var mServerBGImage='';
var mServerTableBodyColor='#000000';
var mServerTableBodyBGColor='#d8d8d8';
var mServerTableHeader='#ffffff';
var mServerTableHeaderBGColor='#808080';
var mServerCheckoutMesg='<p align="center"><font face="Arial"><b><font color="#FF0000">IMPORTANT MESSAGE</font></b></font></p><p align="left"><font face="Arial" size="2">We do carry a good variety of items in stock, but we do not carry all items. </font></p><p align="left"><font face="Arial" size="2">If we do have the item(s) in stock that you ordered then we will ship within 7-10 business days. If we do not have the item(s) in stock then use the Delivery Info chart as a guideline found on our webpage: &nbsp;<a href="http://www.mrboots.com/general_store/info.html">www.mrboots.com/general_store/info.html</a>.</font></p><p align="left"><font face="Arial" size="2">All U.S. Shipments are via Insured U.S. Priority Mail with Delivery Confirmation.&nbsp;Transit time via U.S. Priority Mail is between 2-3 business days after we ship.</font></p>';
var mServerLink='#530000';
var mServerText='#000000';
var mServerThankYouMesg='<p align="center"><font face="Arial"><b><font color="#FF0000">IMPORTANT MESSAGE</font></b></font></p><p align="left"><font face="Arial" size="2">We do carry a good variety of items in stock, but we do not carry all items. </font></p><p align="left"><font face="Arial" size="2">If we do have the item(s) in stock that you ordered then we will ship within 7-10 business days. If we do not have the item(s) in stock then use the Delivery Info chart as a guideline found on our webpage: <a href="http://www.mrboots.com/general_store/info.html">www.mrboots.com/general_store/info.html</a>.</font></p><p align="left"><font face="Arial" size="2">All U.S. Shipments are via Insured U.S. Priority Mail with Delivery confirmation. Transit time via U.S. Priority Mail is between 2-3 business days after we ship.&nbsp; </font></p><p align="left"><b><font face="Arial" size="2" color="#FF0000">Please Note: If you need an item quickly or for a specific date then please add this information in the Comments or Special Instruction section while checking out. We will then get back to you via e-mail to inform you of the delivery status.<br></font></b></p><p align="left"><font face="Arial" size="2">When checking on an order make sure that you indicate to us your Full Name and Invoice Number. If you do not give us this information it is next to impossible for us to determine who you are, when or what you ordered. If you send us an e-mail without this information it may take up to 48 - 72 hours for us to respond.</font></p>';
var mServerPrivacy='<p align="center"><b><font face="Arial" size="2" color="#FF0000">PLEASE ONLY CLICK THE &quot;YES: SEND ORDER&quot; BUTTON ONCE.&nbsp; IF YOU CLICK THE BUTTON MULTIPLE TIMES IT MAY RESULT IN AN ERROR. </font></b></p><p align="center"><b><font face="Arial" size="2" color="#FF0000">AFTER A SLIGHT TIME DELAY YOU WILL SEE A CONFIRMATION PAGE. </font></b></p><p align="center"><b><font color="#333333" size="2" face="Arial">We respect your privacy. We will not sell or share your e-mail address with any other party. We will only send an e-mail to you to inform you of information regarding the status of your order.</p>';
var mEmailMsg='M.R. Boots Online Order Confirmation    ***********   You may receive this e-mail even though your credit card was declined or you received an "Error Message" at the time that you had checked out and submitted your order.  Please contact us if you have any questions  **********    Duplicate orders will only be processed once.    **********    Please check our Order Information webpage for standard  information on delivery.';
var mServerVLink='#008080';
var mServerLanguageStr='English';
var mServerEmailStyleStr='PlainText';
var MinimunInvoiceNumber='201030001';
var FieldEmptyCheck='22221222200000000000000000000000000000000000000000';
var FieldShow='22222222200000000000000000000000000000000000000000';
var fHasCountryTax=0;
var countryTaxName='';
var countryTaxRate=0.00;
var storeCountry='USA';
var fHasStateTax=1;
var stateTaxName='Pennsylvania Sales Tax';
var stateTaxRate=0.00;
var storeState='Pennsylvania';
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=mSpecCode value='"+escape(mSpecCode)+"'>");
  cWin.write("<input type=hidden name=floatQuantity value='"+escape(floatQuantity)+"'>");
  cWin.write("<input type=hidden name=mPurchaseOrder value='"+escape(mPurchaseOrder)+"'>");
  cWin.write("<input type=hidden name=cof1 value='"+escape(mEncryptOff)+"'>");
  cWin.write("<input type=hidden name=cof2 value='"+escape(mCVV2Off)+"'>");
  cWin.write("<input type=hidden name=cof3 value='"+escape(mBankNameOff)+"'>");
  cWin.write("<input type=hidden name=cof4 value='"+escape(mBankPhoneOff)+"'>");
  cWin.write("<input type=hidden name=cof5 value='"+escape(mGenderOff)+"'>");
  cWin.write("<input type=hidden name=mAlignStr value='"+escape(mAlignStr)+"'>");
  cWin.write("<input type=hidden name=mCurrencyAfter value='"+escape(mCurrencyAfter)+"'>");
  cWin.write("<input type=hidden name=mCCVerify value='"+escape(mCCVerify)+"'>");
  cWin.write("<input type=hidden name=mEUTax value='"+escape(mEUTax)+"'>");
  cWin.write("<input type=hidden name=mShowTax value='"+escape(mShowTax)+"'>");
  cWin.write("<input type=hidden name=mTaxShipA value='"+escape(mTaxShipA)+"'>");
  cWin.write("<input type=hidden name=mApplyCountry value='"+escape(mApplyCountry)+"'>");
  cWin.write("<input type=hidden name=mAdd value='"+escape(mAdd)+"'>");
  cWin.write("<input type=hidden name=mServerPrivacy value='"+escape(mServerPrivacy)+"'>");
  cWin.write("<input type=hidden name=mEmailMsg value='"+escape(mEmailMsg)+"'>");
  cWin.write("<input type=hidden name=mShipCalMethod value='"+escape(mShipCalMethod)+"'>");
  cWin.write("<input type=hidden name=mHasMaxCharge value='"+escape(mHasMaxCharge)+"'>");
  cWin.write("<input type=hidden name=mHasConCharge value='"+escape(mHasConCharge)+"'>");
  cWin.write("<input type=hidden name=mDSShipCharge value='"+escape(mDSShipCharge)+"'>");
  cWin.write("<input type=hidden name=mDCShipCharge value='"+escape(mDCShipCharge)+"'>");
  cWin.write("<input type=hidden name=mSSShipCharge value='"+escape(mSSShipCharge)+"'>");
  cWin.write("<input type=hidden name=mDCTotal value='"+escape(mDCTotal)+"'>");
  cWin.write("<input type=hidden name=mDSTotal value='"+escape(mDSTotal)+"'>");
  cWin.write("<input type=hidden name=mSSTotal value='"+escape(mSSTotal)+"'>");
  cWin.write("<input type=hidden name=mDCMacCharge value='"+escape(mDCMacCharge)+"'>");
  cWin.write("<input type=hidden name=mDSMaxCharge value='"+escape(mDSMaxCharge)+"'>");
  cWin.write("<input type=hidden name=mCharSet value='"+escape(mCharSet)+"'>");
  cWin.write("<input type=hidden name=mSSMaxCharge value='"+escape(mSSMaxCharge)+"'>");
for (i=0;i<billMethod.length;i++) {cWin.write("<input type=hidden name=billMethodType"+i+" value='"+escape(billMethodType[i])+"'>");}
cWin.write("<input type=hidden name=scu value='"+scu+"'>");
cWin.write("<input type=hidden name=scun value='"+scun+"'>");
for (i=0;i<scun;i++) {cWin.write("<input type=hidden name=scu"+i+" value='"+scud[i]+"'>");
}cWin.write("<input type=hidden name=sft value='0'>");
sfname='';
cWin.write("<input type=hidden name=sfm value='"+escape(sfname)+"'>");
for (i=0;i<shipMethod.length;i++) {cWin.write("<input type=hidden name=shipMethodType"+i+" value='"+escape(shipMethodType[i])+"'>");if (shipMethodType[i]==2) {cWin.write("<input type=hidden name=SMmDCountryMinCharge"+i+" value='"+escape(SMmDCountryMinCharge[i])+"'>");cWin.write("<input type=hidden name=SMmDStateMinCharge"+i+" value='"+escape(SMmDStateMinCharge[i])+"'>");cWin.write("<input type=hidden name=SMmSStateMinCharge"+i+" value='"+escape(SMmSStateMinCharge[i])+"'>");cWin.write("<input type=hidden name=SMmDCountryPercentCharge"+i+" value='"+escape(SMmDCountryPercentCharge[i])+"'>");
cWin.write("<input type=hidden name=SMmDStatePercentCharge"+i+" value='"+escape(SMmDStatePercentCharge[i])+"'>");cWin.write("<input type=hidden name=SMmSStatePercentCharge"+i+" value='"+escape(SMmSStatePercentCharge[i])+"'>");cWin.write("<input type=hidden name=SMmDSShipCharge"+i+" value='"+escape(SMmDSShipCharge[i])+"'>");cWin.write("<input type=hidden name=SMmDCShipCharge"+i+" value='"+escape(SMmDCShipCharge[i])+"'>");cWin.write("<input type=hidden name=SMmSSShipCharge"+i+" value='"+escape(SMmSSShipCharge[i])+"'>");		cWin.write("<input type=hidden name=SMmDCTotal"+i+" value='"+escape(SMmDCTotal[i])+"'>");		cWin.write("<input type=hidden name=SMmDSTotal"+i+" value='"+escape(SMmDSTotal[i])+"'>");		cWin.write("<input type=hidden name=SMmSSTotal"+i+" value='"+escape(SMmSSTotal[i])+"'>");		cWin.write("<input type=hidden name=SMmDCMacCharge"+i+" value='"+escape(SMmDCMacCharge[i])+"'>");		cWin.write("<input type=hidden name=SMmDSMaxCharge"+i+" value='"+escape(SMmDSMaxCharge[i])+"'>");cWin.write("<input type=hidden name=SMmSSMaxCharge"+i+" value='"+escape(SMmSSMaxCharge[i])+"'>");cWin.write("<input type=hidden name=SMmHasMaxCharge"+i+" value='"+escape(SMmHasMaxCharge[i])+"'>");cWin.write("<input type=hidden name=SMmHasConCharge"+i+" value='"+escape(SMmHasConCharge[i])+"'>");cWin.write("<input type=hidden name=SMmSSmAdd"+i+" value='"+escape(SMmSSmAdd[i])+"'>");cWin.write("<input type=hidden name=SMmShipCalMethod"+i+" value='"+escape(SMmShipCalMethod[i])+"'>");} else if (shipMethodType[i]==3) {cWin.write("<input type=hidden name=SMSCCode"+i+" value='"+escape(SMSCCode[i])+"'>");}}
cWin.write("<input type=hidden name=newTax value='1'>");
cWin.write("<input type=hidden name=CST value='2'>");
cWin.write("<input type=hidden name=CS0 value='Indonesia'>");
cWin.write("<input type=hidden name=CS1 value='Niger'>");
cWin.write("<input type=hidden name=CS2 value='Nigeria'>");
cWin.write("<input type=hidden name=CS3 value=''>");
cWin.write("<input type=hidden name=CS4 value=''>");
cWin.write("<input type=hidden name=CS5 value=''>");
cWin.write("<input type=hidden name=CS6 value=''>");
cWin.write("<input type=hidden name=CS7 value=''>");
cWin.write("<input type=hidden name=CS8 value=''>");
cWin.write("<input type=hidden name=CS9 value=''>");
cWin.write("<input type=hidden name=trs37 value='6.000000'>");
}
//ZSCVer has the version number
var returnHtmlPath=introFile;
var manualReturnPath="";
var formatCurrency=1;
var currencySeperator = ',';
var showWeight=0;
var showTAXTotal=0; //disable this if you don't want to show the item price with tax on the total box!


//max and min items per order!
var fHasMinQty=0;
var fHasMaxQty=0;
var minQty=5;
var maxQty=100000;


//User Login information!
var userLogin=0;








//a reference id or code that you give it to your partner for reference.
var referenceCode = '';
var referURL=''; //referer url
//will check is we need to add advertising partner
//to use send your advertising partner or reference partner with the following url
//eg, if your online store url is http://www.zilron.com/order
//and assign your reference partner id to your partner, say 5
//then ask your partner to use:
//http://www.zilron.com/order?refner=5

{
	curhtml = parent.location.search;
	curhtml = curhtml.substring(1,curhtml.length);
	if (curhtml.length>0) {
		//now we need to check if we need to load the link
		var ss=curhtml.split("::");
		var i;
		for (i=0;i<ss.length;i++) {
			var sss=ss[i].split("=");
			if (sss[0] == "refner")
				referenceCode=sss[1];
		}
	}
}

//now we need to check the cookie and set the cookie for advertising partner


function GetCookieVal(offset)
{
	var endstr = document.cookie.indexOf (";", offset);
	if (endstr == -1) {
		endstr = document.cookie.length;
	}
	return unescape(document.cookie.substring(offset, endstr));
}

function GetCookie(name)
{
	var arg = name + "=";
	var alen = arg.length;
	var clen = document.cookie.length;
	var i = 0;
	while (i < clen) {
		var j = i + alen;
		if (document.cookie.substring(i, j) == arg) {
			return GetCookieVal(j);
		}
		i = document.cookie.indexOf(" ", i) + 1;

		if (i == 0) break;
	}
	return '';
}

function SetCookie(name, value)
{
	var argv = SetCookie.arguments;
	var argc = SetCookie.arguments.length;
	var expires = (argc > 2) ? argv[2] : null;
	var path = (argc > 3) ? argv[3] : null;
	var domain = (argc > 4) ? argv[4] : null;
	var secure = (argc > 5) ? argv[5] : false;
	document.cookie = name + "=" + escape (value) + ((expires == null) ? "" : ("; expires=" + expires.toGMTString())) + ((path == null) ? "" : ("; path=" + path)) +  ((domain == null) ? "" : ("; domain=" + domain)) +    ((secure == true) ? "; secure" : "");
}




if (referenceCode.length > 0) {
	//set cookie here
	SetCookie('refner', referenceCode);
} else {
	referenceCode=''+GetCookie('refner');
}



//now we check for refer
//document.referrer
referURL= GetCookie('referURL');

if (referURL.length <= 0) {
	//check if it is a re-loaded page?
	referURL= GetCookie('referURLr');
	if (referURL.length <= 0) {
		SetCookie('referURL', document.referrer);
		referURL=document.referrer;
	} else {
		SetCookie('referURL', referURL);
	}
}


function MakeArray(n) {
      this.length = n;
      for(var i = 0; i < n; i++){
            this[i] = 0;
      }
      return this;
}
function Currency(money1)
{
	var money;

	money1 += ""; //convert to string

	money = "";
	var i;

	for (i=0; i<money1.length; i++) {
		if (money1.charAt(i) != currencySeperator) money += money1.substr(i,1);
	}

	//now money as the float value;
	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";
		}
	} else {
		if (digPos + 3 > monLen) {
			money += "0";
		} else if (digPos + 3 != monLen) {
			money = money.substring(0, digPos+3);
		}
	}

	if (formatCurrency) {
		//now we will convert the money to has , for more than 1000
		digPos = money.indexOf(".");
		monLen = money.length;
		if (digPos >3) {
			money = money.substr(0, digPos-3) + currencySeperator+ money.substr(digPos-3, monLen-digPos+3);
		}
	}
	return money;
}

function RECORD(n)
{
	this.length = n;
	this.curLength = 0;
	this.itemName=new MakeArray(n);
	this.price=new MakeArray(n);
	this.basePrice=new MakeArray(n);
	this.quantity=new MakeArray(n);
	this.itemID=new MakeArray(n);
	this.weight=new MakeArray(n);
	this.fTaxable=new MakeArray(n);
	this.noShippingCharge=new MakeArray(n);
	this.minQty = new MakeArray(n);

	//volume discount
	this.fpb=new MakeArray(n);
	this.fpbt=new MakeArray(n);
	this.fpbq=new MakeArray(n);
	this.fpbd=new MakeArray(n);
	return this;
}
var orderRecord = new RECORD(250);
function AddRecord(itemName, unitPrice, basePrice, qty, itemID, weight, fTaxable, noShippingCharge, theForm)
{
	var i;
	for (i=0;i<orderRecord.curLength;i++) {
		if (orderRecord.itemID[i] == itemID)
		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.basePrice[orderRecord.curLength] = basePrice;

		orderRecord.itemID[orderRecord.curLength] = itemID;
		orderRecord.weight[orderRecord.curLength] = weight;
		orderRecord.fTaxable[orderRecord.curLength] = fTaxable;
		orderRecord.noShippingCharge[orderRecord.curLength] = noShippingCharge;
		orderRecord.minQty[orderRecord.curLength] = parseInt(theForm.minQty.value)

		//volume discount!
		orderRecord.fpb[orderRecord.curLength]=parseInt(theForm.fpb.value);
		orderRecord.fpbt[orderRecord.curLength]=parseInt(theForm.fpbt.value);
		if (orderRecord.fpb[orderRecord.curLength]) {
			var n;
			n=orderRecord.fpbt[orderRecord.curLength];
			orderRecord.fpbd[orderRecord.curLength]= new MakeArray(n);
			orderRecord.fpbq[orderRecord.curLength]=new MakeArray(n);
			for (i=0; i<n; i++) {
				orderRecord.fpbd[orderRecord.curLength][i]=parseFloat(eval("theForm.fpbd"+i+".value"));
				orderRecord.fpbq[orderRecord.curLength][i]=parseFloat(eval("theForm.fpbq"+i+".value"));
			}

		}
		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::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;
	var mq=parseInt(theForm.minQty.value);
	if (floatQuantity) {
		qty=parseFloat(theForm.Qty.value);
		if (qty < mq) qty = mq;
		qty +="";
		theForm.Qty.value = qty;
	} else {
		qty=parseInt(theForm.Qty.value);
		if (qty < mq) qty = mq;
		qty +="";
		theForm.Qty.value = qty;
	}

}

function ReturnPath(n1, n2)
{
	if (mKeepShopping) {
		return;
	}
	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)
{
	CheckQty(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 noShippingCharge=parseInt(theForm.noShippingCharge.value);

	var i;
	var tmpStr;
  var totalAddweight=0.00;
	for (i=0;i<totalSubField;i++) {
		tmpStr = GetSelection(theForm, i);
		totalPrice += parseFloat(tmpStr);
    //alert(tmpStr);
    var sss=tmpStr.split("::");
    totalAddweight += parseFloat(sss[1]);
    //alert(sss[0]);
    //alert(sss[1]);
    //alert(sss[2]);
    //alert(totalAddweight);



		itemName += ", " + sss[2];

	}
  weight+=totalAddweight;
	var str="Add this item?\n"+itemName + "\n";
	var unitPrice= totalPrice;
	var totalPrice1=totalPrice;
	if (mShowTax) {
		if (showTAXTotal) {
			totalPrice1 = totalPrice1 * (1 +(countryTaxRate/100));
		}
	}
	if (mCurrencyAfter) {
		str += "Unit Price "+ Currency(totalPrice1)+ currencyUnit  +"\n";
	} else {
		str += "Unit Price "+currencyUnit + Currency(totalPrice1) +"\n";
	}
	var qty;
	if (floatQuantity) {
		qty=parseFloat(theForm.Qty.value);
	} else {
		qty=parseInt(theForm.Qty.value);
	}
	str += "Quantity " + qty +"\n";


	if (showPopUp) {
		if (confirm(str)) {
			AddRecord(itemName, unitPrice, basePrice, qty, itemID, weight, fTaxable, noShippingCharge, theForm);
		} else {
			alert("This item was not placed in your shopping cart.");
			return;
		}
	} else {
		AddRecord(itemName, unitPrice, basePrice, qty, itemID, weight, fTaxable, noShippingCharge,theForm);
	}
	if (showCart) {
		ViewCart();
	}
	PrintCartTotal();
}

function Delete(n)
{
	if (n >= orderRecord.curLength) {
		alert("Can not remove this item");
		return;
	}
	var i;

	for (i=n; i<orderRecord.curLength-1; i++) {
		orderRecord.itemName[i]=orderRecord.itemName[i+1];
		orderRecord.price[i]=orderRecord.price[i+1];
		orderRecord.basePrice[i]=orderRecord.basePrice[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.noShippingCharge[i]=orderRecord.noShippingCharge[i+1];


		orderRecord.fpb[i]=orderRecord.fpb[i+1];
		orderRecord.fpbt[i]=orderRecord.fpbt[i+1];
		if (orderRecord.fpb[i]) {
			var n;
			n=orderRecord.fpbt[i];
			orderRecord.fpbd[i]= new MakeArray(n);
			orderRecord.fpbq[i]=new MakeArray(n);
			var j;
			for (j=0; j<n; j++) {
				orderRecord.fpbd[i][j]=orderRecord.fpbd[i+1][j];
				orderRecord.fpbq[i][j]=orderRecord.fpbq[i+1][j];
			}

		}

	}
	orderRecord.curLength--;
	if (orderRecord.curLength==0) {
		var cWin = parent.frames["shop"].document;
		cWin.open();
          cWin.write("<HTML><HEAD><META HTTP-EQUIV='Content-Type' CONTENT='"+mCharSet+"'><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><META HTTP-EQUIV='Content-Type' CONTENT='"+mCharSet+"'><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><META HTTP-EQUIV='Content-Type' CONTENT='"+mCharSet+"'><TITLE> Zilron StoreCreator v5.x Shopping Cart Viewer</TITLE>");

	cWin.write("<SCRIPT LANGUAGE='JavaScript'>");

	cWin.write("function CheckQty() {parent.ModifyQty(0);var totalQty=document.sForm.totalQuantity.value;");

	if (fHasMinQty || fHasMaxQty) {  //only when we need to check the value we print the checking function, else just return 1
		//now we do the calculation of totalQty
		if (fHasMinQty) {
			cWin.write("if (totalQty < "+minQty+") {");
				cWin.write("alert('Min. Order required!! At least "+minQty+"['+totalQty+'] items must be ordered');return 0;");
			cWin.write("}");
		}
		if (fHasMaxQty) {
			cWin.write("if (totalQty > "+maxQty+") {");
				cWin.write("alert('Max. Order reached!! At most "+maxQty+" items can be ordered');return 0;");
			cWin.write("}");
		}

	}

	cWin.write("return 1;");
	cWin.write("}");


	cWin.write("</SCRIPT>");



	cWin.write("</HEAD>");


	cWin.write("<BODY BACKGROUND='"+mCartBGImage+"' Text='"+mCartText+"' BGCOLOR='"+mCartBGColor+"' LINK='"+mCartALink+"' VLINK='"+mCartLink+"'  ALINK='"+mCartALink+"' valign=top><form name=sForm method=post action='"+serverURL+"' OnSubmit='if (CheckQty()) return true; else return false;'>");
	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='"+escape(shipCalVer)+"'>");
	cWin.write("<input type=hidden name=mDCountryMinCharge value='"+escape(mDCountryMinCharge)+"'>");
	cWin.write("<input type=hidden name=mDCountryPercentCharge value='"+escape(mDCountryPercentCharge)+"'>");
	cWin.write("<input type=hidden name=mDStateMinCharge value='"+escape(mDStateMinCharge)+"'>");
	cWin.write("<input type=hidden name=mDStatePercentCharge value='"+escape(mDStatePercentCharge)+"'>");
	cWin.write("<input type=hidden name=mSStateMinCharge value='"+escape(mSStateMinCharge)+"'>");
	cWin.write("<input type=hidden name=mSStatePercentCharge value='"+escape(mSStatePercentCharge)+"'>");
	cWin.write("<input type=hidden name=mCShipingTax value='"+escape(mCShipingTax)+"'>");
	cWin.write("<input type=hidden name=mSShippingTax value='"+escape(mSShippingTax)+"'>");

	if (manualReturnPath.length > 0) {
		cWin.write("<input type=hidden name=returnPath value='"+escape(manualReturnPath)+"'>");
	} else {
		cWin.write("<input type=hidden name=returnPath value='"+escape(document.URL)+"'>");
	}


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



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

	cWin.write("<input type=hidden name=totalState  value="+escape(stateName.length)+">");
	for (i=0;i<stateName.length;i++) {
		cWin.write("<input type=hidden name=stateName"+i+" value='"+escape(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=300><b><strong><font size=2 color='"+mCartTableHeaderColor+"'><center>Products</center></td><td width=3%><b><strong><font size=2 color='"+mCartTableHeaderColor+"'><center>Qty</td><td width=10%><b><strong><font size=2 color='"+mCartTableHeaderColor+"'><center>Price</td>");

	if (mShowTax) {
		cWin.write("<td width=10%><b><strong><font size=2 color='"+mCartTableHeaderColor+"'><center>Include("+countryTaxRate+"%)"+countryTaxName+"</td>");
	}
	cWin.write("<td width=10%><b><strong><font size=2 color='"+mCartTableHeaderColor+"'><center>Total Price</td>");
	if (mShowTax) {
		cWin.write("<td width=10%><b><strong><font size=2 color='"+mCartTableHeaderColor+"'><center>Total Price inc. "+countryTaxName+"</td>");
	}

	if (showWeight) {
		cWin.write("<td width=10% align=center><b><strong><font size=2 color='"+mCartTableHeaderColor+"'><center>Weight</td>");
	}
	cWin.write("<td><b><strong><font size=2 color='"+mCartTableHeaderColor+"'><center>Del</td></tr>");


	var totalPrice=0;
	cWin.write("<input type=hidden name=totalOrder value="+orderRecord.curLength+">");

	cWin.write("<input type=hidden name=referenceCode value='"+escape(referenceCode)+"'>");
	cWin.write("<input type=hidden name=referURL value='"+escape(referURL)+"'>");



	var totalweight=0;
	var totalQuantity=0;
	for (var i=0;i<orderRecord.curLength; i++) {

		var itemUnitPrice=GetItemUnitPrice(i);
		var itemPrice=itemUnitPrice*orderRecord.quantity[i];

		//cWin.write("<input type=hidden name=iu"+i+" value='"+itemUnitPrice+"'>");

		totalPrice+=itemPrice;
		var itemIDLowCase=orderRecord.itemID[i];

		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+"'><a href='item"+itemIDLowCase.toLowerCase()+".html'>"+orderRecord.itemName[i]+"</a></td> <td><center><font size=2 color='"+mCartTableBodyColor+"'><input text=text size=2 name=qty"+i+" value='"+orderRecord.quantity[i]+"'  onBlur=parent.ModifyQty("+i+")></center></td><td align=right><font size=2 color='"+mCartTableBodyColor+"'><input type=text size=7 name=p"+i+"  onBlur=parent.ModifyQty("+i+") value='"+Currency(itemUnitPrice)+"'></center></td>");
		totalQuantity+=orderRecord.quantity[i];
		if (mShowTax) {
			cWin.write("<td align=right><font size=2 color='"+mCartTableBodyColor+"'><input type=text size=7 name=pt"+i+"  onBlur=parent.ModifyQty("+i+") value='"+Currency(itemUnitPrice*(1 +(countryTaxRate/100)))+"'></center></td>");
		}
		cWin.write("<td align=right><font size=2 color='"+mCartTableBodyColor+"'><input type=text size=7 name=itemPrice"+i+"  onBlur=parent.ModifyQty("+i+") value='"+Currency(itemPrice)+"'></td>");
		if (mShowTax) {
			cWin.write("<td align=right><font size=2 color='"+mCartTableBodyColor+"'><input type=text size=7 name=ptt"+i+"  onBlur=parent.ModifyQty("+i+") value='"+Currency(itemPrice*(1 +(countryTaxRate/100)))+"'></td>");
		}

		if (showWeight) {
			var stw=orderRecord.weight[i]*orderRecord.quantity[i];
			totalweight+=stw;
			cWin.write("<td align=right><font size=2 color='"+mCartTableBodyColor+"'><input type=text size=3 name=iw"+i+"  onBlur=parent.ModifyQty("+i+") value='"+stw+"'></td>");
		}
		cWin.write("<td><font size=2 color='"+mCartTableBodyColor+"'><input type='checkbox' Name=checkbox1 onclick=parent.Delete("+i+")>Del</td></tr>");
		cWin.write("<input type=hidden name=iname"+i+" value='"+escape(orderRecord.itemName[i])+"'>");
		cWin.write("<input type=hidden name=up"+i+" value='"+Currency(itemUnitPrice)+"'>");

		cWin.write("<input type=hidden name=itemID"+i+" value='"+escape(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]+"'>");
		cWin.write("<input type=hidden name=noShippingCharge"+i+" value='"+orderRecord.noShippingCharge[i]+"'>");

	}
	cWin.write("<input type=hidden name=totalQuantity value="+totalQuantity+">");
	if (mCurrencyAfter) {
		cWin.write("<tr bgcolor='"+mCartTableHeaderBGColor+"'>");
		if (mShowTax) {
			cWin.write("<td colspan=5 align=right>");
		} else {
			cWin.write("<td colspan=4 align=right>");
		}
		cWin.write("<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>");
		if (mShowTax) {
			cWin.write("<td align=right><input type=text size=7 name=totalTaxPrice onBlur=parent.ModifyQty(0) value='"+Currency(totalPrice*(1 +(countryTaxRate/100)))+"'>"+currencyUnit+"</td>");
		}
		if (showWeight) {
			cWin.write("<td align=right><input type=text size=4 name=tiw onBlur=parent.ModifyQty(0) value='"+totalweight+"'></td>");
		}
		cWin.write("<td>&nbsp;</td></tr>");
	} else {
		cWin.write("<tr bgcolor='"+mCartTableHeaderBGColor+"'>");
		if (mShowTax) {
			cWin.write("<td colspan=5 align=right>");
		} else {
			cWin.write("<td colspan=4 align=right>");
		}
		cWin.write("<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>");
		if (mShowTax) {
			cWin.write("<td align=right><center><font size=2 color='"+mCartTableHeaderColor+"'><b>"+currencyUnit+"<input type=text size=7 name=totalTaxPrice onBlur=parent.ModifyQty(0) value='"+Currency(totalPrice*(1 +(countryTaxRate/100)))+"'></td>");
		}
		if (showWeight) {
			cWin.write("<td align=right><input type=text size=4 name=tiw onBlur=parent.ModifyQty(0) value='"+totalweight+"'></td>");
		}
		cWin.write("<td>&nbsp;</td></tr>");
	}


	cWin.write("</table>");
	if (userLogin) {
		cWin.write("<input type=hidden name=userLogin value=1>");
		cWin.write("<TABLE width=600 border=0 CELLSPACING=0 CELLPADDING=0>");
		cWin.write("<tr><td align=center><strong><i>Please enter your login name and password if you are our existing customer.</i></strong><br>");
		cWin.write("Login:<input type=text name=login>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Password:<input type=password name=upass>");
		cWin.write("</td></tr>");
		cWin.write("</table>");
	}

	cWin.write("<br><center>[<a href='"+returnHtmlPath+"'>Keep Shopping</a>|<A HREF = \"javascript:parent.RemoveAll()\" onmouseout=\" window.status='';return true;\" onmouseover = \"window.status='Delete All items in your shopping cart.';return true;\">Empty Shopping Cart</a>|<input type=submit value='Submit' onmouseout=\" window.status='';return true;\" onmouseover = \"window.status='Checkout Now!!';return true;\">]</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;\" onmouseout=\" window.status='';return true;\">click here</a>.</font><br><br>");
	cWin.write("</td></tr></table>");


	cWin.write("</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 (floatQuantity) {
		qty=parseFloat(qty);
		if (qty<orderRecord.minQty[n]) qty=orderRecord.minQty[n];
		eval("parent.frames['shop'].document.forms[0].qty"+n+".value=parseFloat(qty)");
		orderRecord.quantity[n]=parseFloat(qty);
	} else {
		qty=parseInt(qty);
		if (qty<orderRecord.minQty[n]) qty=orderRecord.minQty[n];
		eval("parent.frames['shop'].document.forms[0].qty"+n+".value=parseInt(qty)");
		orderRecord.quantity[n]=parseInt(qty);
	}
	var iunitp=GetItemUnitPrice(n);
	var subTotalPrice=qty*iunitp;
	eval("parent.frames['shop'].document.forms[0].p"+n+".value=Currency(iunitp)");
	eval("parent.frames['shop'].document.forms[0].up"+n+".value=Currency(iunitp)");
	eval("parent.frames['shop'].document.forms[0].itemPrice"+n+".value=Currency(subTotalPrice)");

	if (mShowTax) {
		eval("parent.frames['shop'].document.forms[0].pt"+n+".value=Currency(iunitp*(1 +(countryTaxRate/100)))");
		eval("parent.frames['shop'].document.forms[0].ptt"+n+".value=Currency(subTotalPrice*(1 +(countryTaxRate/100)))");
	}

	if (showWeight) {
		var stw=qty*orderRecord.weight[n];
		eval("parent.frames['shop'].document.forms[0].iw"+n+".value=stw");
	}

	var totalPrice=0;
	var totalWeight=0;
	var totalQuantity=0;
	for (var i=0;i<orderRecord.curLength; i++) {
		var itemUnitPrice=GetItemUnitPrice(i);

		//eval("parent.frames['shop'].document.forms[0].iu"+n+".value=itemUnitPrice");

		var itemPrice=itemUnitPrice*orderRecord.quantity[i];
		totalQuantity+=orderRecord.quantity[i];
		totalPrice+=itemPrice;
		totalWeight+=orderRecord.quantity[i]*orderRecord.weight[i];
	}
	eval("parent.frames['shop'].document.forms[0].totalPrice.value=Currency(totalPrice)");

	eval("parent.frames['shop'].document.forms[0].totalQuantity.value=totalQuantity");

	if (showWeight) {
		eval("parent.frames['shop'].document.forms[0].tiw.value=totalWeight");
	}

	if (mShowTax) {
		eval("parent.frames['shop'].document.forms[0].totalTaxPrice.value=Currency(totalPrice*(1 +(countryTaxRate/100)))");
	}

	PrintCartTotal();
}


function GetItemUnitPrice(n)
{
	var i;
	var itemPrice=orderRecord.price[n];
	if (orderRecord.fpb[n]) {
		for (i=0;i<orderRecord.fpbt[n]; i++) {
			if (orderRecord.quantity[n] <= orderRecord.fpbq[n][i]) {
				if (orderRecord.fpb[n] == 2) {
					itemPrice = itemPrice - itemPrice*orderRecord.fpbd[n][i]/100;
				} else {
					var difP=orderRecord.price[n] - orderRecord.basePrice[n];
					itemPrice = orderRecord.basePrice[n] - orderRecord.basePrice[n]*orderRecord.fpbd[n][i]/100;
					itemPrice +=difP;

				}
				return itemPrice;
			}
		}
		if (i>0) {
			if (orderRecord.fpb[n] == 2) {
				itemPrice = itemPrice - itemPrice*orderRecord.fpbd[n][i-1]/100;
			} else {
				var difP=orderRecord.price[n] - orderRecord.basePrice[n];
				itemPrice = orderRecord.basePrice[n] - orderRecord.basePrice[n]*orderRecord.fpbd[n][i-1]/100;
				itemPrice +=difP;
			}
		}
		return itemPrice;
	} else {
		return itemPrice;
	}
}


function PrintCartTotal()
{
	var totalPrice=0;
	for (var i=0;i<orderRecord.curLength; i++) {
		var itemUnitPrice=GetItemUnitPrice(i);
		var itemPrice=itemUnitPrice*orderRecord.quantity[i];
		if (mShowTax) {
			if (showTAXTotal) {
				itemPrice = itemPrice * (1 +(countryTaxRate/100));
			}
		}
		totalPrice+=itemPrice;
	}
	if (parent.frames['cart'].document.forms[0].CartTotal)
		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><META HTTP-EQUIV='Content-Type' CONTENT='"+mCharSet+"'><TITLE> Zilron StoreCreator v5.x 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 itemUnitPrice=GetItemUnitPrice(i);
		var itemPrice=itemUnitPrice*orderRecord.quantity[i];
		totalPrice+=itemPrice;
		cWin.write("====================<br>Item number:"+i+"<br>");
		cWin.write("Item ID:"+orderRecord.itemID[i]+"<br>");
		cWin.write("<strong>"+orderRecord.itemName[i]+"</strong><br>");
		cWin.write("Qty:"+orderRecord.quantity[i]+"<br>");
		cWin.write("Unit Price:"+parent.currencyUnit+itemUnitPrice+"<br>");
		cWin.write("SubTotal:"+parent.currencyUnit+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();
}
