function validateQuickOrder(theForm){
	
	var oneValidEntry = false;
	
	for(var i = 0; i < 10; i++){
		var atLeastOneCode = false;
		var atLeastOneQty = false;
		var code = document.getElementById('qocode'+i);
		var qty = document.getElementById('qoqty'+i);;
		if(!code || (code.value == "" && qty.value == ""))
			continue;
			
		if(removeLeadingWhiteSpace(code.value) == ""){
			alert("Please enter a product code");
			code.select();
			code.focus();
			return false;
		}
		else
			atLeastOneCode = true;
		
		if(qty.value == "" || parseFloat(qty.value) % 1 != 0 || parseFloat(qty.value) < 1){
			alert("Please enter a whole number into this quantity field");
			qty.select();
			qty.focus();
			return false;
		}
		else
			atLeastOneQty = true;
			
		oneValidEntry = atLeastOneCode && atLeastOneQty;
	}
	
	return oneValidEntry;
}

function addQoLine(maxLines){
	
	if(!document.getElementById('qodiv'))
		return;
	
	var qodiv = document.getElementById('qodiv');
	
	var len = qodiv.getElementsByTagName("label").length / 2;
	if(len >= (maxLines)){
		alert("The maximum number of items your can quick order at once is " + maxLines + ".\nPlease use the quick order function again if you require more.");
		return;	
	}
	
	var labelQ = document.createElement("label");
	var labelC = document.createElement("label");
	var code = document.createElement("input");
	var qty = document.createElement("input");
	
	labelC.innerHTML = "Code";
	labelC.className = "nolabel";
	labelC.htmlFor = "qocode" + (len + 1);
	
	labelQ.innerHTML = "Qty";
	labelQ.className = "nolabel";
	labelQ.htmlFor = "qoqty" + (len + 1);
	
	
	code.type = "text";
	code.name = "qocode" + (len + 1);
	code.className = "code";
	code.tabIndex = "206";
	code.id = "qocode" + (len + 1);
	
	qty.type = "text";
	qty.name = "qoqty" + (len + 1);
	qty.className = "qty";
	qty.tabIndex = "206";
	qty.id = "qoqty" + (len + 1);
	
	qodiv.appendChild(labelC);
	qodiv.appendChild(code);
	qodiv.appendChild(labelQ);
	qodiv.appendChild(qty);
						
	//drawPlusMinus();
}

function removeQoLine(){
	var qodiv = document.getElementById('qodiv');
	var labels = qodiv.getElementsByTagName("label");
	var inputs = qodiv.getElementsByTagName("input");
	
	if(labels.length <= 4)
		return;
		
	var chillun = qodiv.childNodes;
	var removeCount = 0;
	for(var i = chillun.length; i > 0; i--){
		//alert(chillun[i-1].tagName);
		if(chillun[i-1] && chillun[i-1].tagName){
			if(chillun[i-1].tagName.toLowerCase() == "input" || chillun[i-1].tagName.toLowerCase() == "label"){
				qodiv.removeChild(chillun[i-1]);
				removeCount++;
			}
		}
		
		if(removeCount == 4)
			break;
	}
	
	//drawPlusMinus();
}