/**
 * 
 */
function updateClub(){

	var UID = $('#clubUID').val();
	var url = "/ajax/ajGW.php?action=updateClub&UID=" + UID;
	if(confirm('You are about to MODIFY ' + $('#clubName').val() + ' . Are you sure?')){

		$.ajax({
			url: url,
			dataType: 'json',
			success: function(response){
			
				if(response.userError)			alert(response.userError);
				else if(response.userMessage){
					alert(response.userMessage);
					window.location.reload(false);
				}
				else							alert('An Expat Server error has occured (malformed network traffic)');
			
			}
		});
	
	}
	
}

function updateExpo(){
	
	var UID = $('#expoUID').val();
	var url = "/ajax/ajGW.php?action=updateExpo&UID=" + UID;
	if(confirm('You are about to MODIFY ' + $('#expoName').val() + ' . Are you sure?')){
		
		$.ajax({
			url: url,
			dataType: 'json',
			success: function(response){
			
				if(response.userError)			alert(response.userError);
				else if(response.userMessage){
					alert(response.userMessage);
					window.location.reload(false);
				}
				else							alert('An Expat Server error has occured (malformed network traffic)');
			
			}
		});
		
	}
	
}

function updateFreight(){
	
	var UID = $('#freightUID').val();
	var url = "/ajax/ajGW.php?action=updateFreight&UID=" + UID;
	
	if(confirm('You are about to MODIFY ' + $('#freightName').val() + ' . Are you sure?')){
		
		$.ajax({
			url: url,
			dataType: 'json',
			success: function(response){
			
				if(response.userError)			alert(response.userError);
				else if(response.userMessage){
					alert(response.userMessage);
					window.location.reload(false);
				}
				else							alert('An Expat Server error has occured (malformed network traffic)');
			
			}
		});
		
	}
	
}

function updateStockist(){
	

	var UID = $('#stockistUID').val();
	var url = "/ajax/ajGW.php?action=updateStockist&UID=" + UID;

	if(confirm('You are about to MODIFY ' + $('#stockistName').val() + ' . Are you sure?')){
		
		$.ajax({
			url: url,
			dataType: 'json',
			success: function(response){
			
				if(response.userError)			alert(response.userError);
				
				else if(response.userMessage){
					
					alert(response.userMessage);
					window.location.reload(false);
				
				}
				else
					alert('An Expat Server error has occured (malformed network traffic)');
			
			}
		});
		
	}
	
}

function updateCategory(){
	
	var UID = $('#categoryUID').val();
	var url = "/ajax/ajGW.php?action=updateCategory&UID=" + UID;

	if(confirm('You are about to MODIFY ' + $('#categoryName').val() + ' . Are you sure?')){
		
		$.ajax({
			url: url,
			dataType: 'json',
			success: function(response){
			
				if(response.userError)				alert(response.userError);
				else if(response.userMessage){
					
					alert(response.userMessage);
					window.location.reload(false);
				
				}
				else								alert('An Expat Server error has occured (malformed network traffic)');
			
			}
		});
		
	}
	
}

function updateOrganisation(){
	
	var UID = $('#organisationUID').val();
	var name = $('#name').val();
	var regionUID = $('#regionUID').val();
	var countryUID = $('#countryUID').val();
	var phone = $('#phone').val();
	var email = $('#email').val();
	var address = $('#address').val();
	var stateUID = $('#stateUID').val();
	var subRegionUID = $('#subRegionUID').val();
	var primaryContact = $('#primaryContact').val();
	var clientNote = $('#clientNote').val();
	var latitude = $('#latitude').val();
	var longitude = $('#longitude').val();
	
	
	
	
	
	var url = "/ajax/ajGW.php?action=updateOrganisation&UID=" + UID +
														"&name=" + name +
														"&regionUID=" + regionUID +
														"&countryUID=" + countryUID +
														"&phone=" + phone +
														"&email=" + email +
														"&address=" + address +
														"&stateUID=" + stateUID +
														"&primaryContact=" + primaryContact +
														"&clientNote=" + clientNote +
														"&latitude=" + latitude +
														"&longitude=" + longitude +
														"&subregion=" + subRegionUID;
	
	
	if(confirm('You are about to MODIFY ' + $('#name').val() + ' . Are you sure?')){
		
		$.ajax({
			url: url,
			dataType: 'json',
			success: function(response){
			
				if(response.userError)				alert(response.userError);
				else if(response.userMessage){
					
					alert(response.userMessage);
					window.location.reload(false);
				
				}
				else								alert('An Expat Server error has occured (malformed network traffic)');
			
			}
		});
		
	}	
	
}
