function addQuantityDiscounts()
{
	document.getElementById('storeQuantityDiscounts').style.display = 'block';
}

function addRoleDiscounts()
{
	document.getElementById('storeRoleDiscounts').style.display = 'block';
}

function addAnotherQuantityDiscount()
{
	var div = document.getElementById('qDiscountFormHolder');
	
	var container = document.createElement("div");
	var startTxt = document.createTextNode("$"), midTxt = document.createTextNode(" / each, if they buy "), 
		endTxt = document.createTextNode(" or more");
	container.appendChild(startTxt);

	//increasing fieldPos (defined in main JS)
	qDiscountFieldPos++;
	
	var elPrice = document.createElement("input");
	elPrice.setAttribute("name", "q_discount_price[" + qDiscountFieldPos + "]");
	elPrice.setAttribute("type", "text");
	elPrice.setAttribute("size", "8");
	elPrice.setAttribute("maxlength", "8");
	container.appendChild(elPrice);
	
	container.appendChild(midTxt)
		
	var elQuant = document.createElement("input");
	elQuant.setAttribute("name", "q_discount_quantity[" + qDiscountFieldPos + "]");
	elQuant.setAttribute("type", "text");
	elQuant.setAttribute("size", "8");
	elQuant.setAttribute("maxlength", "4");
	container.appendChild(elQuant);
	
	container.appendChild(endTxt);
	
	div.appendChild(container);
}

function loadAddCategoryForm()
{
	var div = document.getElementById('addCatLink');
	div.innerHTML = "<form method=\"POST\"><input type=\"text\" name=\"newCat\" size=\"15\" maxlength=\"50\">" +
		"<input type=\"submit\" value=\"Add\"></form>";
}

function selectShippingMethod(f, redirectPath)
{
	var method = -1;
	if(f.shipMethod.length > 1)
	{
		for(i=0; i<f.shipMethod.length; i++)
		{
			if(f.shipMethod[i].checked)
			{
				method = f.shipMethod[i].value;
			}
		}
	}
	else
	{
		if(f.shipMethod.checked) 
		{
			method = f.shipMethod.value;
		}
	}
	if(method == -1)
	{
		alert("Please select your preferred shipping method before continuing.");
	}
	else
	{
		window.location.href = redirectPath + '&shipMethod=' + method;
	}
}