var TEMPLATE_NAME = false;
var SEARCH_MODE = false;
var NET_TOTAL = 0;
var WEEK_SETTLEMENT_DISCOUNT = 0;
var MONTH_SETTLEMENT_DISCOUNT = 0;
var SUBSTITUTE = false;
var ADDING = false;
var GLOBAL_DATA;
if(top.opener){
if(top.opener.SUBSTITUTE){
SUBSTITUTE = true;
}
if(top.opener.ADDING){
ADDING = true;
}
}
function RemoveFavourites(PRODUCT_ID){
Customer_Favourites = Customer_Favourites.replace(PRODUCT_ID + ",", "");
SaveFavourites();
}
function ShowNew(){
var URL = "/admin/functions/getproducts.asp?SiteID=" + AutoID + "&Category=New"
URL += "&OrderBy=" + escape(document.theForm.OrderBy.options[document.theForm.OrderBy.selectedIndex].value);
MakeRequest(URL);
}
function ShowOffers(){
for(var i = 0; i < FORM.Categories.length;i++){
if(FORM.Categories.options[i].text == "Special Offers"){
FORM.Categories.options[i].selected = true;
FORM.Categories.onchange();
}
}
}
function AddFavourites(PRODUCT_ID){
var arrFavourites = Customer_Favourites.split(",");
for(var iAF=0; iAF < arrFavourites.length-1;iAF++){
if(arrFavourites[iAF] == PRODUCT_ID){
alert("This item already exists in your favourites");
return;
}
}
Customer_Favourites += PRODUCT_ID + ",";
SaveFavourites();
}
function SaveFavourites(){
var FFORM = "
";
var RDO = parent.rdo;
//RDO = window.open();
RDO.document.open();
RDO.document.write(FFORM);
RDO.document.forms[0].submit();
}
function AddTax(mTAX){
mTAX = parseFloat(mTAX);
var myTAX = ((mTAX * TAX_RATE)/100);
mTAX += myTAX;
return mTAX;
}
var strTempDesc = "";
function WriteProductOptions(strPOData,CURRENT_POS,THE_PRICE,CATEGORY,SOP){
var strCONTROLS = "";
return strCONTROLS;
} //End Function
function Show_Details(INT,BG,WIDTH,HEIGHT){
if(!WIDTH){
WIDTH=600;
}
if(!HEIGHT){
HEIGHT=400;
}
Products = GLOBAL_DATA.split(rcd);
var WIN_FEATURES = "width=" + WIDTH + ",height=" + HEIGHT + ",scrollbars=yes,resizable=yes";
var RECORD = Products[INT];
var FIELDS = RECORD.split(fld);
var IMAGE = FIELDS[14];
var BLURB = FIELDS[13];
var strDETAILS = "Product Details";
strDETAILS += "";
strDETAILS += "";
if(IMAGE!="" && IMAGE.toString()!="undefined"){
var THE_LOCATION = "/admin/product_images/" + IMAGE;
strDETAILS += " | ![](" + THE_LOCATION + ") | ";
}
if(BLURB!="" && BLURB.toString()!="undefined"){
strDETAILS += "" + BLURB + " | ";
}
strDETAILS += " ";
strDETAILS += " | ";
var WinDetail = OpenCentredWindow("",1,WIDTH,HEIGHT,WIN_FEATURES);
WinDetail.document.open();
WinDetail.document.write(strDETAILS);
WinDetail.document.close();
WinDetail = null;
}
for(var i = 0; i < arrCompanyHeader.length;i++){
var strCode = "var " + arrCompanyHeader[i] + " = " + i
eval(strCode);
}
var MODE="Viewing";
var rcd = String.fromCharCode(2);
var fld = String.fromCharCode(1);
var Products;
var Currency = arrGeneralData[0];
var strCartHeader;
var strCartFooter;
var strShopping = "";
var arrShopping
var strCart = "";
var strDataHeader = "Order|ItemName|ShortName|Price|DiscountThreshold|DiscountedPrice|TaxApplies|ImageURL|ProductRef|Description|Sizes|Colors";
var BlueButtonStyle = "cursor:pointer;" + arrFontStyles[6] + "background-color:" + CartPageBGColor + ";border:"
var AYT = arrFonts[6].split(fld);
BlueButtonStyle += AYT[3] + " solid 1px;"
var strButtonStyle = "cursor:pointer;font-family:arial;font-size:9pt;color:" + AYT[3] + ";font-weight:600;border: black solid 1px;"
var strCompanyNameStyle = "font-family:arial;font-size:12pt;color:black;font-weight:600;"
var strCompanyDetailsStyle = "font-family:arial;font-size:10pt;color:black;font-weight:600;"
var QUANTITY = 0;
var ROW_TOTAL = 1;
var ITEM_NAME = 2;
var ITEM_PRICE = 3;
var DISCOUNT_THRESHOLD = 4;
var DISCOUNTED_PRICE = 5;
var TAX_APPLIES = 6;
var SIZE = 8;
var COLOR = 9;
var ITEM_DC = 10;
var ItemDelivery = 12;
var EstimatedDelivery= 11;
var TAX_LABEL = arrGeneralData[1];
var TAX_RATE = parseFloat(arrGeneralData[2]);
var TAX_RULE = parseInt(arrGeneralData[3]);
var DELIVERY_CHARGE = arrGeneralData[4];
var DELIVERY_CHARGE_THRESHOLD = arrGeneralData[5];
var DELIVERY_CHARGE_RULE = parseInt(arrGeneralData[6]);
var DELIVERY_CHARGE_PRICE = arrGeneralData[7];
var REDUCED_DELIVERY_CHARGE = arrGeneralData[7];
var DELIVERY_CHARGE_HTML = "";
var arrDataHeader = strDataHeader.split("|");
var strSubmitForm = "";
var CR = String.fromCharCode(13) + String.fromCharCode(10);
var TAB = String.fromCharCode(9);
var strDescription = "";
var strHTMLDescription = "";
var strTextDescription = "";
var CartID = new String("")
var mDate = new Date()
mDate.getDate();
CartID += new String(mDate.getYear());
CartID += new String(mDate.getMonth());
CartID += new String(mDate.getDay());
CartID += new String(mDate.getHours());
CartID += new String(mDate.getMinutes());
CartID += new String(mDate.getSeconds());
CartID += new String(mDate.getMilliseconds());
CartID += new String(Math.floor(Math.random() * (1 + 2000000 - 1000000) + 1000000));
for(var i = 0; i < arrDataHeader.length;i++){
var strCode = "var " + arrDataHeader[i] + " = " + i;
eval(strCode);
}
function SetADO(iIndex){
if(iIndex==0){
alert("Please Select a location");
}
else{
iIndex += -1;
var arrADOFields = arrADO[iIndex].split(fld);
TAX_RATE = Round(arrADOFields[2])
TAX_RATE = parseFloat(TAX_RATE);
if(TAX_RATE=="0"){
TAX_RATE="0.00";
}
DELIVERY_CHARGE_PRICE = Round(arrADOFields[1]);
if(DELIVERY_CHARGE_PRICE=="0"){
DELIVERY_CHARGE_PRICE="";
DELIVERY_CHARGE_RULE = 0;
}
else{
DELIVERY_CHARGE_PRICE = parseFloat(arrADOFields[1]);
DELIVERY_CHARGE_RULE = 1;
DELIVERY_CHARGE = DELIVERY_CHARGE_PRICE
DELIVERY_CHARGE_THRESHOLD = DELIVERY_CHARGE;
}
}
}
function WriteSubEmpty(HTML_STRING){
var strHTML = ""
parent.main.document.open();
parent.main.document.write(strHTML);
parent.main.document.close();
if(document.theForm.QS){
EmptySelect(document.theForm.QS);
}
}
function WriteLeftMenu(){
if(strLeftMenu==""){
return;
}
var arrLeftMenu = strLeftMenu.split(rcd);
var mCartHeader = "" + CR;
var LeftMenu = mCartHeader + "Site Menu
";
LeftMenu += ""
LeftMenu += "";
for(var iWLM = 0;iWLM < arrLeftMenu.length-1;iWLM ++){
var arrLeftFields = arrLeftMenu[iWLM].split(fld);
if(arrLeftFields[1] != "Special Offers" && arrLeftFields[1] != "Signs & Engraving"){
if((arrLeftFields[1] == "Site Registration" || arrLeftFields[1] == "Customer Login") && Customer_CustomerID){
}
else{
LeftMenu += "" + arrLeftFields[1] + " | ";
}
}
if(arrLeftFields[1] == "Signs & Engraving" && Customer_CustomerID){
LeftMenu += "" + arrLeftFields[1] + " | ";
}
if(arrLeftFields[1] == "Special Offers" && Customer_CustomerID){
LeftMenu += "" + arrLeftFields[1] + " | ";
}
}
LeftMenu += "NEW Products | ";
LeftMenu += " |
| ";
LeftMenu += " ";
parent.cart.document.open();
parent.cart.document.write(LeftMenu);
parent.cart.document.close();
}
function WriteEmpty(){
WriteLeftMenu();
return;
}
var arrProductDiscounts = new Array();
if(Customer_Product_Discounts){
arrProductDiscounts = Customer_Product_Discounts.split("@");
}
function CheckDiscount(CURRENT_CAT,PRODUCTID){
for(var p=0; p < arrProductDiscounts.length-1;p++){
var arrPD = arrProductDiscounts[p].split("#");
if(arrPD[0] == PRODUCTID){
return arrPD[2];
}
}
if(Customer_Category_Discounts=="" && Customer_Discount_All_Products != '-1'){
return 0;
}
if(Customer_Discount_All_Products == '-1'){
return Customer_Discount_All_Percentage;
}
var arrDISCOUNTS = Customer_Category_Discounts.split("~");
for(var iCat=0;iCat < arrDISCOUNTS.length-1; iCat++){
var arrCATEGORY = arrDISCOUNTS[iCat].split("^");
if(arrCATEGORY[0].indexOf("/") > -1){
if(Trim(arrCATEGORY[0]) == Trim(CURRENT_CAT)){
return arrCATEGORY[1];
}
}
if(arrCATEGORY[0].indexOf("/") == -1){
var arrMAIN_CAT = CURRENT_CAT.split("/")
if(Trim(arrCATEGORY[0]) == Trim(arrMAIN_CAT[0])){
return arrCATEGORY[1];
}
}
} //End For
return 0;
} //End Function
var ALL_PRODUCTS;
var TOTAL_PAGES;
var ITEMS_PER_PAGE;
function InitProducts(ALL_DATA){
strCURRENT_PRODUCTS = ALL_DATA;
var arrTEMP = ALL_DATA.split(String.fromCharCode(18));
var STRAP = "";
ALL_DATA = ReturnChars(arrTEMP[0]);
ITEMS_PER_PAGE = parseInt(document.theForm.IPP.options[document.theForm.IPP.selectedIndex].value);
ALL_PRODUCTS = ALL_DATA.split(rcd);
TOTAL_PAGES = ((ALL_PRODUCTS.length -1) / ITEMS_PER_PAGE);
TOTAL_PAGES = parseInt(TOTAL_PAGES);
TOTAL_PAGES += 1;
if(ALL_PRODUCTS.length > ITEMS_PER_PAGE){
WriteProducts(1);
}
else{
WriteProducts();
}
return;
}
function WriteProducts(CURRENT_PAGE){
if(document.theForm.QS){
EmptySelect(document.theForm.QS);
document.theForm.QS.options[0] = new Option("Quick Product Select","");
}
if(!CURRENT_PAGE){
Products = ALL_PRODUCTS;
P_START =0;
P_END = ALL_PRODUCTS.length;
Products = ALL_PRODUCTS.slice(P_START,P_END);
}
else{
CURRENT_PAGE = (parseInt(CURRENT_PAGE) -1);
P_START = CURRENT_PAGE * ITEMS_PER_PAGE;
P_END = parseInt(P_START + ITEMS_PER_PAGE);
P_END += 1;
if(P_END > ALL_PRODUCTS.length){
P_END = ALL_PRODUCTS.length
}
Products = ALL_PRODUCTS.slice(P_START,P_END);
}
GLOBAL_DATA = Products.join(rcd);
StartMode = "Shop";
var ES = "<" + "/" + "script>";
var strProducts_HTML = "";
var strHTML = "";
strHTML += " |