
// normal search for model request
function sendWcModelRequest(wcType) {

    var whatCarMakeId = $('whatcar_' + wcType + '_make_id').value;
    var whatCarModelDiv = 'wc_' + wcType + '_model_div';
    var whatCarEditionSelect = 'whatcar_' + wcType + '_edition_id';

    var target = 'whatCar.php';
    var params = 'type=model&whatcar_make_id=' + whatCarMakeId + '&whatCarType=' + wcType;
    var myAjax = new Ajax.Updater(whatCarModelDiv, target,
    {
        method: 'get',
        parameters: params
    });


    if (wcType == 'new') {
        $(wcType + 'ReviewButton').hide();
        // clear the Edition list so wrong editions don't display
        $(whatCarEditionSelect).options.length = 0;
    } else {
        $(wcType + 'ReviewButton').show();
    }

}

// normal search for edition request
function sendWcEditionRequest(wcType) {

    var whatCarMakeId = $('whatcar_' + wcType + '_make_id').value;
    var whatCarModelId = $('whatcar_' + wcType + '_model_id').value;
    var whatCarEditionlDiv = 'wc_' + wcType + '_edition_div';

	var target = 'whatCar.php';
	var params = 'type=edition&whatcar_make_id=' + whatCarMakeId + '&whatcar_model_id=' + whatCarModelId + '&whatCarType=' + wcType;
	var myAjax = new Ajax.Updater(whatCarEditionlDiv, target,
	{
	    method: 'get',
	    parameters: params
	});

    $(wcType + 'ReviewButton').show();

}



