var searchOpenFlag = false; var deliveryIndex = 0; var Orders = new Object(); var activeOrderCount = 0; var orderCount = 0; var OrderForm; var updateOrderForm = false; function CloseOrderForm() { var blnConfirm = false; if(OrderForm && OrderForm.open && !OrderForm.closed ) { blnConfirm = confirm("The secure order form window is still open. Press \"OK\" to close this window as well, or press \"Cancel\" to keep open."); if(blnConfirm) { OrderForm.close(); } else { OrderForm.focus(); } } } function AddOrder(productStatus,productId,productItemId,productItemCode,productItemDesc,productItemPrice,productItemQty,productItemTxnQty,productItemSingleStockQty,productCollection,productCollectionName,productCategory,productCategoryName) { var blnItemExists = false; for(var nct in Orders) { if(Orders[nct].productItemId == productItemId) { Orders[nct].productItemQty = Orders[nct].productItemQty + 1; Orders[nct].productLineTotal = format_number(Orders[nct].productItemQty * Orders[nct].productItemPrice,2); blnItemExists = true; break; } } if(!blnItemExists) { Orders[parent.parent.orderCount+1] = new parent.parent.AddToOrder(productStatus,productId,productItemId,productItemCode,productItemDesc,productItemPrice,productItemQty,productItemTxnQty,productItemSingleStockQty,productCollection,productCollectionName,productCategory,productCategoryName); } } function AddToOrder(productStatus,productId,productItemId,productItemCode,productItemDesc,productItemPrice,productItemQty,productItemTxnQty,productItemSingleStockQty,productCollection,productCollectionName,productCategory,productCategoryName) { activeOrderCount++; orderCount++; this.productStatus = productStatus; this.productId = productId; this.productItemId = productItemId; this.productItemCode = productItemCode; this.productItemDesc = productItemDesc; this.productItemPrice = productItemPrice; this.productItemQty = productItemQty; this.productItemTxnQty = productItemTxnQty; this.productItemSingleStockQty = productItemSingleStockQty; this.productLineTotal = productItemQty * productItemPrice; this.productAttribPrices = ""; this.productCollection = productCollection; this.productCollectionName = productCollectionName; this.productCategory = productCategory; this.productCategoryName = productCategoryName; } function DelFromOrders(recNo) { var blnConfirmDelete = false; blnConfirmDelete = confirm("Confirm removing " + Orders[recNo].productItemDesc + " from your shopping basket?"); if(blnConfirmDelete) { activeOrderCount--; Orders[recNo].productStatus = "inactive"; if (activeOrderCount <= 0) { deliveryIndex = 0; } parent.document.getElementById("main").contentDocument.location.replace("shoppingcart.asp"); } } function EmptyShoppingBasket(blnReload) { var blnConfirmEmpty = false; if (activeOrderCount <= 0) { alert("You do not have any products in your basket to empty!"); if(!blnReload) { return false; } } else { blnConfirmEmpty = confirm("Confirm emptying your shopping basket of all items?\n\nThis action cannot be undone!"); if(blnConfirmEmpty) { ClearBasket(); if(blnReload) { parent.document.getElementById("main").contentDocument.location.replace("shoppingcart.asp"); } else { return true; } } else { if(!blnReload) { return false; } } } } function ClearBasket() { deliveryIndex = 0; activeOrderCount = 0; orderCount = 0; Orders = null; Orders = new Object(); } function UpdateProduct(recNo, newQty) { var blnConfirm = false; if(newQty <= 0) { blnConfirm = confirm("You have set the qty to a value less or equal to zero. This product will now be removed from your shopping basket. Continue?") if(blnConfirm) { DelFromOrders(recNo); } } else { Orders[recNo].productItemQty = newQty; Orders[recNo].productLineTotal = format_number(Orders[recNo].productItemQty * Orders[recNo].productItemPrice,2); } parent.document.getElementById("main").contentDocument.location.replace("shoppingcart.asp"); } function shutdown(strValue) { CloseOrderForm(); if (strValue == "login") { window.onunload = new Function("null") parent.location = "login.asp"; } else { } } function SetTableHeight() { var myWidth = 0, myHeight = 0; if( typeof( window.innerWidth ) == 'number' ) { //Non-IE myWidth = window.innerWidth; myHeight = window.innerHeight; } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) { //IE 6+ in 'standards compliant mode' myWidth = document.documentElement.clientWidth; myHeight = document.documentElement.clientHeight; } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) { //IE 4 compatible myWidth = document.body.clientWidth; myHeight = document.body.clientHeight; } document.getElementById("maintable").style.height = myHeight }