// Saimon Lovell
// -------------
// My way of ajax
///////////////////////
// AJAX SETUP
var ajax_action = function(data) {}
var ajax_error = function() {alert("Network Error");}
$.ajaxSetup({
   	url: "scripts/php/ajax/index.php",
   	type: "POST",
   	dataType: "json",
	complete: function (data) {ajax_action(jQuery.parseJSON(data.responseText));},
	error: function(){ajax_error();}
});


// Example ajax
/*

ajax_action = 
function (data)
{
	if (data.status)
		// Data is here	
	else
		// status of data that came in is false
}
		
		
ajax_error = function() {alert("Network Error");}

$.ajax({data:{action: "login", email: "s@s.com", password: "bla bla"}});
*/

//////////////////////////////////


	$(function() {
		$( "input:submit, button", ".mybutton" ).button();
		$( "a", ".mybutton" ).click(function() { return false; });
		
		$( "#dialog:ui-dialog" ).dialog( "destroy" );
		
	});
	
	
	
	
	
	$.fx.speeds._default = 1000;
	$(function() {
		$( "#ajax_error" ).dialog({
			autoOpen: false,
			show: "fade",
			hide: "explode"
		});
	});
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	

	
	
	
	
	
	/////////////////////////////////////////////////////////////////////////////////////////////////////////
	// Post Load
	
	var image_post_load = document.createElement("img");
	image_post_load.src = "images/loading.gif";
	//$(image_post_load).load(function() 	{	});
	
