﻿function getQty(theForm)
{
    var length 	= theForm.length;
    var text	= "";
    var objects	= "";
    
    var elements = theForm.elements;     
    
    for(i=0; i<elements.length; i++)
    {
        if(elements.item(i) != null)
        {
            if(elements.item(i).type == "text")
            {
                if(elements.item(i).value)
                {
                    text += elements.item(i).value + ";";
                    objects += elements.item(i).name + ";";
                }
            }
        }      
    }    
    

	document.aspnetForm.items.value = objects;
	document.aspnetForm.values.value = text;
	
	theForm.submit();
}

function addLine(theItem, theConfig, theQty, theForm)
{
    var configElement = document.getElementById(theConfig);
    var qtyElement = document.getElementById(theQty);
    
    document.aspnetForm.items.value = theItem;
	document.aspnetForm.values.value = qtyElement.value;
	
	if(configElement != null)
	{
		document.aspnetForm.configs.value = configElement.value;
	}
	
	theForm.submit();
	
	//location.href = window.location + "&config=" + configElement.value + "&qty=" + qtyElement.value + "&itemId=" + theItem;
}

function getConfigQty(theForm)
{
    var length 	= theForm.length;
    var text	= "";
    var objects	= "";
    
    var elements = theForm.elements;     
    
    for(i=0; i<elements.length; i++)
    {
        if(elements.item(i) != null)
        {
            if(elements.item(i).type == "text")
            {
                if(elements.item(i).value)
                {
                    text += elements.item(i).value + ";";                    
                }
            }
        }      
    }    
    
	document.aspnetForm.items.value = objects;
	
	theForm.submit();
}