function focusOnQty() {
  var qtyObj = getEl("txtfldQty");
	if (qtyObj != null) {	
    qtyObj.style.backgroundColor = getFocusRowColour();  
	  qtyObj.focus();
	}
}

function clearBGColor() {  
  var qtyObj = getEl("txtfldQty");
	if (qtyObj != null) {
    qtyObj.style.backgroundColor = "#FFFFFF";
	}
}

function setOrderRowFocus(row) {
  if (historyOrderRowObj != null) {
	  oriOrderObject = document.getElementById("txtfldQty")
    if (oriOrderObject != null && oriOrderObject.value != null && oriOrderObject.value.length > 0)
      if (!constructAddToShoppingCartAJAX(oriOrderObject))
        return;
    
    historyOrderRowObj.style.backgroundColor = "#FFFFFF";
  }
  
  var qtyOrderObj = document.getElementById("txtfldQty");
  if (qtyOrderObj != null)
    qtyOrderObj.value = "";
    
  rowOrderID = row;  
  currentOrderRowObj = document.getElementById("orderrow_" + rowOrderID);
  if (currentOrderRowObj != null) {
	  currentOrderRowObj.style.backgroundColor = getFocusRowColour();
	  historyOrderRowObj = currentOrderRowObj;		
  }
	
	focusOnQty();
}

function moveOrderRowFocus(step) {    
  if (rowOrderID == 1 && step < 0)
    return;
  
  if (rowOrderID == document.getElementById("labelsintheorder").value && step > 0)
    return;
  
  if (historyOrderRowObj != null) {
	  oriOrderObject = document.getElementById("txtfldQty")    
    if (oriOrderObject != null && oriOrderObject.value != null && oriOrderObject.value.length > 0)
      if (!constructAddToShoppingCartAJAX(oriOrderObject))
        return;      
    
    historyOrderRowObj.style.backgroundColor = "#FFFFFF";        
  }
  
  var qtyOrderObj = document.getElementById("txtfldQty");
  if (qtyOrderObj != null)
    qtyOrderObj.value = "";
    
  rowOrderID += step;
  currentOrderRowObj = document.getElementById("orderrow_" + rowOrderID);
  if (currentOrderRowObj != null) {
	  currentOrderRowObj.style.backgroundColor = getFocusRowColour();
	  historyOrderRowObj = currentOrderRowObj;		
  }
  else {
	  rowID -= step;
  }
  
  var labellist = document.getElementById("labellist");
  var quickfindtbl = document.getElementById("quickfindtbl");
  if (labellist != null && quickfindtbl != null) {
    rowHeight = 20;
    if (step > 0) {
      labellist.scrollTop += rowHeight;
    }
    else if (step < 0) {
      labellist.scrollTop -= rowHeight;
    }
  }
	
	focusOnQty();
}
