 function prodOptionChange(fName,value)
{
   var f = document.getElementById(fName);
   if (f) 
	{
	    for (var i = 0; i < f.elements.length; i++)
	    {
		    if (f.elements[i].name == "action") 
           {             
			    f.elements[i].value = "-1";
    		    break;
	        }
        }
	 }
	f.submit();

 }


			function submitForm(fName, a) {
				if (a == lockerAction && !isValidUser) {
					//alert("Please log in or register before adding products to your locker.");
					window.location = "/login.aspx";
					return;
				}
                
				var f = document.getElementById(fName);
				
				if (f) {
					for (var i = 0; i < f.elements.length; i++){
						if (f.elements[i].name == "action") {
							f.elements[i].value = a;
							break;
						}
					}

				    // HOTFIX - AWOOD - 20071218 instock helper function
				    
				    if (itemIsInStock(f.product.value))
				    {


					    if (parseInt(a) != lockerAction) {
						    var s = '<form action="/cart.aspx" method="post" id="toBag">'
							    + '<input type="hidden" name="action" value="' + a + '" />'
							    + '<input type="hidden" name="quantity" value="' + f.quantity.value + '" />'
							    + '<input type="hidden" name="product" value="' + f.product.value + '" />'
							    + '<input type="hidden" name="frequency" value="' + f.frequency.value + '" />';
						    var d = document.createElement("div");
						    d.innerHTML = s;
						    document.getElementsByTagName("body")[0].appendChild(d);
						    document.getElementById("toBag").submit();
				    } else f.submit();
				    }
				    else
				    {
				        alert('Sorry but this product option is currently out of stock');
				    }

					/* ORIGINAL CODE HERE commented out and replaced above for HOTFIX - AWOOD - 20071218 instock helper function
					if (parseInt(a) != lockerAction) {
						var s = '<form action="cart.aspx" method="post" id="toBag">'
							+ '<input type="hidden" name="action" value="' + a + '" />'
							+ '<input type="hidden" name="quantity" value="' + f.quantity.value + '" />'
							+ '<input type="hidden" name="product" value="' + f.product.value + '" />';
						var d = document.createElement("div");
						d.innerHTML = s;
						document.getElementsByTagName("body")[0].appendChild(d);
						document.getElementById("toBag").submit();
					} else f.submit();
					*/	
				}
			}
