function sync()
{
    var url = "http://" + document.domain;
    url += "/ajax/car";
    var brand = $('brand')[$('brand').selectedIndex].value;
    if($('tipus')[$('tipus').selectedIndex]== undefined)var tipus = 0;else var tipus = $('tipus')[$('tipus').selectedIndex].value;
	
	var req = new Request.HTML({  
	url:url,  
	method:'post',  
	autoCancel:true,  
	data:'brand=' + brand + '&tipus=' + tipus,  
	update: $('keresoDiv'),  
	onRequest: function() {  
	//$('message-box').set('text','Updating the sort order in the database.');
			   },  
	onSuccess: function() {//$('message-box').set('text','Database has been updated.');
	}  
	}).send();  

	
}

function get_model()
{    
    var url = "http://" + document.domain;
    url += "/ajax/car";
    var brand = jQuery('#brand').val();
    jQuery('motor').val('');
    jQuery.post(url,{brand:brand}, function(data){
       jQuery('#tipus').html(data).attr('disabled',false)
    });
}
function get_motor()
{    
    var url = "http://" + document.domain;
    url += "/ajax/motor";
    var brand = jQuery('#brand').val();
    var tipus = jQuery('#tipus').val();
    jQuery('motor').val('');
    jQuery.post(url,{brand:brand,tipus:tipus}, function(data){
       jQuery('#motor').html(data).attr('disabled',false)
    });
}
