
// update this variable with the location of the get_data.php file
// so that AJAX calls can function correctly
var ROOT_PATH = 'http://www.mydieselbox.co.uk/switch/';

function confirmDelete(l) {
 var input_box=confirm('Are you sure you want to delete this record?');
 if (input_box==true)
  {
     window.location=l;
  }
}


function doManufacturer(obj) {
   jQuery.getJSON(ROOT_PATH+'get_data.php',{ manufacturer: obj.value }, function(json) {
	   if (json.status=='ok' && json.objects[0].model != undefined) {
		   var options = '<option value="">Select Model</option>';
		   for (var i=0; i < json.objects.length; i++) {
			   options += '<option value="'+json.objects[i].model+'">'+json.objects[i].model+'</option>';
		   }
		   jQuery('#inputid_box_model').html(options);
	   }
     });
}

function doModel(obj) {
	
	var manufacturer =  jQuery('#inputid_box_manufacturer').val();
	jQuery.getJSON(ROOT_PATH+'get_data.php',{ manufacturer: manufacturer, model: obj.value }, function(json) {
		if (json.status=='ok' && json.objects[0].engine != undefined) {
			var options = '<option value="">Select Engine</option>';
			for (var i=0; i < json.objects.length; i++) {
				options += '<option value="'+json.objects[i].engine+'">'+json.objects[i].engine+'</option>';
			}
			jQuery('#inputid_box_engine').html(options);
		}
	});
}