
function opt_ajax_request(loading,results,opt_action,opt_args) {
	
	jQuery(document).ready(function($) {	
	
			$('#'+loading).show();
			
		  data = {
			action: opt_action,
			args: opt_args
		  };
		  	
			$.post(opt_ajaxurl, data, function (response) {
				$('#'+results).html(response);
				$('#'+loading).hide();
			});	
			
	});
	
	
}

function opt_ajax_send_data(opt_action,opt_data_to_submit) {
	
	jQuery(document).ready(function($) {
				
		  data = {
			'action': opt_action,
			'd': opt_data_to_submit
		  };
	
			$.post(opt_ajaxurl, data, function (response) {  });	
			
	});
	
	
  }

//do something with a load box, with special response function
function opt_ajax_send_data_with_response(id_to_hide,data,callback) {
	
	//jQuery(document).ready(function($) {
		  
		  if(typeof(callback) == 'undefined'){
			  callback = function(){
				jQuery('#'+id_to_hide+'_load_box').hide();
				jQuery('#'+id_to_hide).fadeIn(100);  
			  }
		  }
		  error = function(jqXHR,textStatus,errorThrown){
			  	var error_text = 'Ajax request failed with status: ' + text_status + ':' + error_thrown;
			  	jQuery('#'+id_to_hide+'_load_box').text(error_text);
			  }
		  
		  //set settings
		  var settings = {
		    'data': data,
			'dataType' : 'json',
			'error': error,
			'success':callback
		  };
			
			//hide the thing and show load box
			jQuery('#'+id_to_hide).hide();
			jQuery('#'+id_to_hide+'_load_box').slideDown();
			  
			jQuery.ajax(opt_ajaxurl, settings);	
			
	//});
	
	
  }

function opt_ajax_send_help(opt_data)
{
	jQuery(document).ready(function($) {
		
		data = {
			'action':'opthlp',
			'd':opt_data	
		};
		
			$.post(opt_ajaxurl,data,function(response){});
			
	});
	
	
}