function SetModelOptions(make_selector, for_make, first_option, second_option) {
	var options;
	
	if ( second_option ) {
		options = { action: "GetModelOptions", make: for_make, first: first_option, second: second_option}
	} else {
		options = { action: "GetModelOptions", make: for_make, first: first_option }
	}
	
	$.post("/ajax/makemodelyear.php", options,
        function(data){
            $(make_selector).html(data);
        });
}

function SetUsedCarModelOptions(make_selector, for_make, first_option, second_option) {
    var options;
    
    if ( second_option ) {
        options = { action: "GetUsedCarModelOptions", make: for_make, first: first_option, second: second_option}
    } else {
        options = { action: "GetUsedCarModelOptions", make: for_make, first: first_option }
    }
    
    $.post("/ajax/makemodelyear.php", options,
        function(data){
            $(make_selector).html(data);
        });    
}

function SetCommonUsedCarModelOptions(make_selector, for_make, first_option, second_option) {
    var options;
    
    if ( second_option ) {
        options = { action: "GetCommonUsedCarModelOptions", make: for_make, first: first_option, second: second_option}
    } else {
        options = { action: "GetCommonUsedCarModelOptions", make: for_make, first: first_option }
    }
    
    $.post("/ajax/makemodelyear.php", options,
        function(data){
            $(make_selector).html(data);
        });    
}

function SetCommonUsedCarModelOptionsByJquery(model, for_make, first_option, second_option) {
    var options;
    
    if ( second_option ) {
        options = { action: "GetCommonUsedCarModelOptions", make: for_make, first: first_option, second: second_option}
    } else {
        options = { action: "GetCommonUsedCarModelOptions", make: for_make, first: first_option }
    }
    
    $.post("/ajax/makemodelyear.php", options,
        function(data){
            model.html(data);
        });        
}

function SetIndexNewCarModelsByJquery(model, for_make, first_option) {
    var options;

    options = { action: "GetIndexNewCarModels", make: for_make, first: first_option }
    
    $.post("/ajax/makemodelyear.php", options,
        function(data){
            model.html(data);
        });
}

function SetYearOptions(year_selector, for_make, for_model, first_option) {
    $.post("/ajax/makemodelyear.php", { action: "GetYearOptions", make: for_make, model: for_model, first: first_option},
        function(data){
            $(year_selector).html(data);
        });    
}

function SetUsedCarYearOptions(year_selector, for_make, for_model, first_option) {
    $.post("/ajax/makemodelyear.php", { action: "GetUsedCarYearOptions", make: for_make, model: for_model, first: first_option},
        function(data){
            $(year_selector).html(data);
        });    
}

function SetVastCarModelOptionsByJquery(model, for_make, first_option, second_option) {
    var options;
    
    if ( second_option ) {
        options = { action: "VastGetModelsByMake", make: for_make, first: first_option, second: second_option}
    } else {
        options = { action: "VastGetModelsByMake", make: for_make, first: first_option }
    }
    
    $.post("/ajax/makemodelyear.php", options,
        function(data){
            model.html(data);
        });        
}

function SetChromeBYOCarModelOptionsByJquery(model, for_make, first_option, second_option) {
    var options;
    
    if ( second_option ) {
        options = { action: "ChromeGetBYOModelsByMake", make: for_make, first: first_option, second: second_option}
    } else {
        options = { action: "ChromeGetBYOModelsByMake", make: for_make, first: first_option }
    }
    
    $.post("/ajax/makemodelyear.php", options,
        function(data){
            model.html(data);
        });        
}

$(document).ready(function(){	
	$('#_article_make').change(function(){
		$.post(
			'/ajax/makemodelyear.php',
			{              
				action: 'VastGetModelsByMake',
				make: $(this).val(),
				first: 'Select Model'	
			},
			function(data) {
				$('#_article_model').html(data)
			}
		) ;
	});
});
