/**
 * 
 * @param selectObject - Make SelectHtmlobject to fill out
 * @param firstOption - First option to display
 * @param noOption - Option to display in case there's no options available
 */
function fillMakes(selectObject, firstOption, noOption)
{
    if(selectObject && getMakes)
    {
        var makes = getMakes();
        if(makes != "")
        {
            addDelimetedStringToSelect(selectObject, makes, ",", "|", firstOption);
        }
        else
        {
            if(noOption)
            {
                addDelimetedStringToSelect(selectObject,"-1|" + noOption , ",", "|");
            }
            else
            {
                clearSelectOptions(selectObject);
            }
            return true;
        }
        return true;
    }
    return false;
}

/**
 * 
 * @param selectObject - Object in which to add options
 * @param makeObject - Object that's making the call to add the options (for selection of make)
 * @param firstOption -  Text to display in the begginning of the list
 * @param noOption - Text to display if no list is found
 */
function getModelByMake(selectObject, makeObject, firstOption, noOption)
{
    if(document.forms)
    {
        if(document.forms["automall"][selectObject])
        {
            selectObject = document.forms[0][selectObject];
            //Selected make
            var make = makeObject.options[makeObject.selectedIndex].value;
        
            if(make == "-1")
            {
                if(noOption)
                {
                    addDelimetedStringToSelect(selectObject,"-1|" + noOption , ",", "|");
                }
                else
                {
                    clearSelectOptions(selectObject);
                }
                return true;
            }
            else
            {
                if(selectObject && getModelsString)
                {
                    var models = getModelsString(make);
                    addDelimetedStringToSelect(selectObject, models, ",", "|", firstOption);
                    return true;
                }
            }
        }

    }
    return false;
}

/**
 * 
 * @param selectObject - Object in which to add options
 * @param makeObject - Object that's making the call to add the options (for selection of make)
 * @param firstOption -  Text to display in the begginning of the list
 * @param noOption - Text to display if no list is found
 */
function getModelByMake(selectObject, makeObject, firstOption, noOption)
{
    if(document.forms)
    {
        if(document.forms["automall"][selectObject])
        {
            selectObject = document.forms[0][selectObject];
            //Selected make
            var make = makeObject.options[makeObject.selectedIndex].value;
        
            if(make == "-1")
            {
                if(noOption)
                {
                    addDelimetedStringToSelect(selectObject,"-1|" + noOption , ",", "|");
                }
                else
                {
                    clearSelectOptions(selectObject);
                }
                return true;
            }
            else
            {
                if(selectObject && getModelsString)
                {
                    var models = getModelsString(make);
                    addDelimetedStringToSelect(selectObject, models, ",", "|", firstOption);
                    return true;
                }
            }
        }

    }
    return false;
}





