//auto generates by the storecreator and templates
var savedLoad=0;
var mKeepShopping=0;
var floatQuantity=0;
var showCart=1;
var showPopUp=1;
var currencyUnit ='US$';
var orderInfoFile ='info.html';
var introFile ='intro.html';
var storeName='ButterCut Shear Company';
var searchFile = 'search.html';
var accountID = '4948';
var subDirID= '51';
var submitEmail= 'sales@buttercut.com';
var encryptEmail= '1';
var noDecimal= 0;
var storeContactAddress='<strong>ButterCut Shear Company</strong>,<br>4700 Hall Road, Orlando, Florida 32817, USA.<br><strong>Tel</strong>:407-678-8023.<br><strong>Fax</strong>:407-678-4122.<br><strong>EMail</strong>:sales@buttercut.com.<br><strong>Homepage</strong>:http://www.buttercut.com';
var EMailSubject = 'New WEB Order';
var mCharSet = 'iso-8859-1';
var serverURL= 'http://www.zilron.com/cgi-bin/storecreator/v4/list.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]='UPS Ground ($9.50-up to 1 lb)';shipMethodType[0]='2';SMmDCountryMinCharge[0]='9.50';
SMmDCountryPercentCharge[0]='0.00';
SMmDStateMinCharge[0]='9.50';
SMmDStatePercentCharge[0]='0.00';
SMmSStateMinCharge[0]='9.50';
SMmSStatePercentCharge[0]='0.00';
SMmSSShipCharge[0]='9.50';
SMmDSShipCharge[0]='9.50';
SMmDCShipCharge[0]='9.50';
SMmDCTotal[0]='0.00';
SMmDSTotal[0]='0.00';
SMmSSTotal[0]='0.00';
SMmDCMacCharge[0]='0.00';
SMmDSMaxCharge[0]='0.00';
SMmSSMaxCharge[0]='0.00';
SMmHasMaxCharge[0]='0';
SMmHasConCharge[0]='0';
SMmSSmAdd[0]='0';
SMmShipCalMethod[0]='0';
shipMethod[1]='UPS 3rd Day ($12.00-up to 1 lb)';shipMethodType[1]='2';SMmDCountryMinCharge[1]='12.00';
SMmDCountryPercentCharge[1]='0.00';
SMmDStateMinCharge[1]='12.00';
SMmDStatePercentCharge[1]='0.00';
SMmSStateMinCharge[1]='12.00';
SMmSStatePercentCharge[1]='0.00';
SMmSSShipCharge[1]='12.00';
SMmDSShipCharge[1]='12.00';
SMmDCShipCharge[1]='12.00';
SMmDCTotal[1]='0.00';
SMmDSTotal[1]='0.00';
SMmSSTotal[1]='0.00';
SMmDCMacCharge[1]='0.00';
SMmDSMaxCharge[1]='0.00';
SMmSSMaxCharge[1]='0.00';
SMmHasMaxCharge[1]='0';
SMmHasConCharge[1]='0';
SMmSSmAdd[1]='0';
SMmShipCalMethod[1]='0';
shipMethod[2]='UPS 2nd Day ($17.00-up to 1 lb)';shipMethodType[2]='2';SMmDCountryMinCharge[2]='17.00';
SMmDCountryPercentCharge[2]='0.00';
SMmDStateMinCharge[2]='17.00';
SMmDStatePercentCharge[2]='0.00';
SMmSStateMinCharge[2]='17.00';
SMmSStatePercentCharge[2]='0.00';
SMmSSShipCharge[2]='17.00';
SMmDSShipCharge[2]='17.00';
SMmDCShipCharge[2]='17.00';
SMmDCTotal[2]='0.00';
SMmDSTotal[2]='0.00';
SMmSSTotal[2]='0.00';
SMmDCMacCharge[2]='0.00';
SMmDSMaxCharge[2]='0.00';
SMmSSMaxCharge[2]='0.00';
SMmHasMaxCharge[2]='0';
SMmHasConCharge[2]='0';
SMmSSmAdd[2]='0';
SMmShipCalMethod[2]='0';
shipMethod[3]='UPS 2nd Day am ($22.00-up to 1 lb)';shipMethodType[3]='2';SMmDCountryMinCharge[3]='22.00';
SMmDCountryPercentCharge[3]='0.00';
SMmDStateMinCharge[3]='22.00';
SMmDStatePercentCharge[3]='0.00';
SMmSStateMinCharge[3]='22.00';
SMmSStatePercentCharge[3]='0.00';
SMmSSShipCharge[3]='22.00';
SMmDSShipCharge[3]='22.00';
SMmDCShipCharge[3]='22.00';
SMmDCTotal[3]='0.00';
SMmDSTotal[3]='0.00';
SMmSSTotal[3]='0.00';
SMmDCMacCharge[3]='0.00';
SMmDSMaxCharge[3]='0.00';
SMmSSMaxCharge[3]='0.00';
SMmHasMaxCharge[3]='0';
SMmHasConCharge[3]='0';
SMmSSmAdd[3]='0';
SMmShipCalMethod[3]='0';
shipMethod[4]='UPS Next Day ($35.00-up to 1 lb)';shipMethodType[4]='2';SMmDCountryMinCharge[4]='35.00';
SMmDCountryPercentCharge[4]='0.00';
SMmDStateMinCharge[4]='35.00';
SMmDStatePercentCharge[4]='0.00';
SMmSStateMinCharge[4]='35.00';
SMmSStatePercentCharge[4]='0.00';
SMmSSShipCharge[4]='35.00';
SMmDSShipCharge[4]='35.00';
SMmDCShipCharge[4]='35.00';
SMmDCTotal[4]='0.00';
SMmDSTotal[4]='0.00';
SMmSSTotal[4]='0.00';
SMmDCMacCharge[4]='0.00';
SMmDSMaxCharge[4]='0.00';
SMmSSMaxCharge[4]='0.00';
SMmHasMaxCharge[4]='0';
SMmHasConCharge[4]='0';
SMmSSmAdd[4]='0';
SMmShipCalMethod[4]='0';
shipMethod[5]='UPS Next Day am ($61.00-up to 1 lb)';shipMethodType[5]='2';SMmDCountryMinCharge[5]='61.00';
SMmDCountryPercentCharge[5]='0.00';
SMmDStateMinCharge[5]='61.00';
SMmDStatePercentCharge[5]='0.00';
SMmSStateMinCharge[5]='61.00';
SMmSStatePercentCharge[5]='0.00';
SMmSSShipCharge[5]='61.00';
SMmDSShipCharge[5]='61.00';
SMmDCShipCharge[5]='61.00';
SMmDCTotal[5]='0.00';
SMmDSTotal[5]='0.00';
SMmSSTotal[5]='0.00';
SMmDCMacCharge[5]='0.00';
SMmDSMaxCharge[5]='0.00';
SMmSSMaxCharge[5]='0.00';
SMmHasMaxCharge[5]='0';
SMmHasConCharge[5]='0';
SMmSSmAdd[5]='0';
SMmShipCalMethod[5]='0';

shipMethod[6]='Canada Global priority mail ($10.00-up to 1 lb)';shipMethodType[6]='2';SMmDCountryMinCharge[6]='10.00';
SMmDCountryPercentCharge[6]='0.00';
SMmDStateMinCharge[6]='10.00';
SMmDStatePercentCharge[6]='0.00';
SMmSStateMinCharge[6]='10.00';
SMmSStatePercentCharge[6]='0.00';
SMmSSShipCharge[6]='10.00';
SMmDSShipCharge[6]='10.00';
SMmDCShipCharge[6]='10.00';
SMmDCTotal[6]='0.00';
SMmDSTotal[6]='0.00';
SMmSSTotal[6]='0.00';
SMmDCMacCharge[6]='0.00';
SMmDSMaxCharge[6]='0.00';
SMmSSMaxCharge[6]='0.00';
SMmHasMaxCharge[6]='0';
SMmHasConCharge[6]='0';
SMmSSmAdd[6]='0';
SMmShipCalMethod[6]='0';

shipMethod[7]='International Global priority mail ($13.00-up to 1 lb)';shipMethodType[7]='2';SMmDCountryMinCharge[7]='13.00';
SMmDCountryPercentCharge[7]='0.00';
SMmDStateMinCharge[7]='13.00';
SMmDStatePercentCharge[7]='0.00';
SMmSStateMinCharge[7]='13.00';
SMmSStatePercentCharge[7]='0.00';
SMmSSShipCharge[7]='13.00';
SMmDSShipCharge[7]='13.00';
SMmDCShipCharge[7]='13.00';
SMmDCTotal[7]='0.00';
SMmDSTotal[7]='0.00';
SMmSSTotal[7]='0.00';
SMmDCMacCharge[7]='0.00';
SMmDSMaxCharge[7]='0.00';
SMmSSMaxCharge[7]='0.00';
SMmHasMaxCharge[7]='0';
SMmHasConCharge[7]='0';
SMmSSmAdd[7]='0';
SMmShipCalMethod[7]='0';

billMethod = new Array();
billMethodType = new Array();
billMethod[0]='Visa';billMethodType[0]='Credit Card';
billMethod[1]='Discover';billMethodType[1]='Credit Card';
billMethod[2]='American Express';billMethodType[2]='Credit Card';
billMethod[3]='MasterCard';billMethodType[3]='Credit Card';
billMethod[4]='Visa';billMethodType[4]='Credit Card';


var shipCalVer='4';
var mDCountryPercentCharge='0.00';
var mSStatePercentCharge='0.00';
var mDStatePercentCharge='0.00';
var mDStateMinCharge='11.50';
var mDCountryMinCharge='13.50';
var mSStateMinCharge='11.50';
var mShipCalMethod='2';
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=0;
var mCurrencyAfter =0;
var mCCVerify=0;
var mPaymentCard=1;
var mPaymentCheck=0;
var mPurchaseOrder=0;
var mGenderOff=0;
var mEncryptOff=0;
var mCVV2Off=0;
var mBankNameOff=0;
var mBankPhoneOff=0;
var mPaymentFax=0;
var mCartALink='#aaaa00';
var mAlignStr='<Left>';
var mCartBGColor='#FFFFFF';
var mCartBGImage='background.jpg';
var mCartTableBodyColor='#000000';
var mCartTableBodyBGColor='#d8d8d8';
var mCartTableHeaderBGColor='#808080';
var mEUTax='0';
var mShowTax=0;
var mTaxShipA=1;
var sfname='';
var mAdd='0';
var mCartTableHeaderColor='#ffffff';
var mCartText='#000000';
var mCartLink='#0000aa';
var mCartVLink='#0000aa';
var mSpecCode='';
var mServerALink='#aaaa00';
var mServerBGColor='#FF0000';
var mServerBGImage='background.jpg';
var mServerTableBodyColor='#000000';
var mServerTableBodyBGColor='#d8d8d8';
var mServerTableHeader='#ffffff';
var mServerTableHeaderBGColor='#808080';
var mServerCheckoutMesg='Thank you for shopping with us. Your credit account will not be charged until we are ready to ship your order.';
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 mServerPrivacy='Your information is being collected on a secure web page.  Your information will only be used for the processing of your order.';
var mEmailMsg='Your order will be processed soon (depending on availbility of stock on hand).  Your credit account will not be charged until we are ready to ship your order.';
var mServerVLink='#0000aa';
var mServerLanguageStr='English';
var mServerEmailStyleStr='PlainText';
var MinimunInvoiceNumber='5000';
var FieldEmptyCheck='12221112200000000000000000000000000000000000000000';
var FieldShow='22222222200000000000000000000000000000000000000000';
var fHasCountryTax=0;
var countryTaxName='';
var countryTaxRate=0.00;
var storeCountry='USA';
var fHasStateTax=1;
var stateTaxName='Florida State Sales Tax';
var stateTaxRate=0.00;
var storeState='Florida';
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=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='Additional Fields';
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=trs8 value='7.000000'>");
}
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=1;
var maxQty=1000;





//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);

	//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;

		//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::"+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 (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)
{
	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;
	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;
	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=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];

		
		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=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><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 (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 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].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);
		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("We're sorry, secure checkout is currently disabled by our provider.   Anything typed in an order form would not be encrypted across the internet.  	Meanwhile, please print this page and finish filling it out,  Then and send it to us by FAX: 407-678-4122 until further notice.  Please do not send your private information by email, hackers can steal your identity, please use fax. We appreciate your understanding.  We hope to return to normal operation very soon<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();	
}
