function testSQL(id) {
	$.ajax({
		   type: "POST",
		   url: "components/data_selectsql/ajax/testSQL.php",
		   data: "database="+$('#database').val()+"&sql="+$('#'+id).val(),
		   success: function(json){
			try {
				 var jsonObject = json_parse(json);
				 if(typeof jsonObject.success != "undefined" && jsonObject.success == "true" && jsonObject.html !== undefined) {
					 
					 jQuery.facebox(jsonObject.html, '');
				 }
				 else {
					 showAjaxMessages(json);
				 }
			}
			catch(e) {
				showAjaxMessages(json);
			}
		   },
		   error: function(XMLHttpRequest, textStatus, errorThrown) {
			 showMessage(lang("ajax_error"), "error");
		   }
	 });
}

function testSQLFormElement(id, form_id) {
	$.ajax({
		   type: "POST",
		   url: "components/data_selectsql/ajax/testSQL.php",
		   data: "database="+$('#database_'+form_id).val()+"&sql="+$('#'+id).val(),
		   success: function(json){
			try {
				 var jsonObject = json_parse(json);
				 if(typeof jsonObject.success != "undefined" && jsonObject.success == "true" && jsonObject.html !== undefined) {
					 
					 jQuery.facebox(jsonObject.html, '');
				 }
				 else {
					 showAjaxMessages(json);
				 }
			}
			catch(e) {
				showAjaxMessages(json);
			}
		   },
		   error: function(XMLHttpRequest, textStatus, errorThrown) {
			 showMessage(lang("ajax_error"), "error");
		   }
	 });
}