//Copyright (c) 2000-2005 EIBS Ltd. All Rights Reserved. function validateFields(form, recordCount,StockID, PID, CID) { var valStatus = true; if (valStatus) { if (!validateNumber(form, "Qty" + recordCount)) { alert("Please include a valid Quantity"); valStatus = false; } var reqQty = parseInt(document.forms[form]["Qty" + recordCount].value); var maxQty = parseInt(document.forms[form]["MaxQty" + recordCount].value); var itemID = document.forms[form]["AddToCart" + recordCount].value; var existingCartItem = parseInt(document.forms[form]["ExistingCart" + recordCount].value); var CapQuantity = 10 if (maxQty > CapQuantity) { maxQty = CapQuantity; } else { if (document.forms[form]["NonStockItem" + recordCount].value == 'True') { maxQty = CapQuantity } } if (reqQty > maxQty && maxQty >= 0) { var Msg = "Sorry, there are only " + maxQty + " items of this type in stock.\nPlease reduce your quantity \n or \nIf you would like notification when more become available then click ok.\n"; if (confirm(Msg)) { document.location = '/EmailNotify.asp?PID='+ PID +'&CID='+ CID +'&stockID=' + StockID valStatus = false; } else { valStatus = false; } } else { if ((reqQty + existingCartItem) > maxQty && maxQty >= 0) { var Msg = "Sorry, adding " + reqQty + " items to your shopping cart would give you " + (reqQty + existingCartItem) + " items of this type.\n\nThere are only " + maxQty + " items of this type in stock.\n\n If you would like notification when more become available then click ok.\n"; if (confirm(Msg)) { PopupNotify('/InStockNotify.asp?ID=' + StockID, 250, 300) //document.location = '/EmailNotify.asp?PID='+ PID +'&CID='+ CID +'&stockID=' + StockID valStatus = false; } else { valStatus = false; } } } } if (valStatus) { document.forms[form].submit(); } }