function attachEventCallback() {
	//alert("complete");
}

function updateCustomerInfo(customer, address, customerID){

	$('customerName').set('value', customer);
	$('customerID').set('value', customerID);
	$('customerInformation').set('html', address);

	$('customerList').set('styles', {
		'display' :'none'
	});
	$('customerInformation').set('styles', {
		'display' :'block'
	});
	
}

function injectPhoto( filename ) { 

	alert  ("in the injectPhoto");
		
		ajaxURL = 'messaging/injectPhoto.php?filename=' + filename + '&pID=' + $('projectID').get('value');
		
		//alert(ajaxURL);
		
		/*var req = new Request( {

			url : ajaxURL,

			onSuccess : function(txt) {
				$('messagingContent').set('html', txt);
			},
			onComplete :attachEventCallback,

			// Our request will most likely succeed, but just in
			// case, we'll add an
			// onFailure method which will let the user know what
			// happened.
			onFailure : function() {
				$('messagingContent').set('html', 'The request failed.');
			}

		});

		req.send();*/

	}
	

window.addEvent('domready', function() {

	// We can use one Request object many times.

	if($('customerName')){
		$('customerName').addEvent(
				'keyup',
				function() {
					

					$('customerInformation').set('styles', {
						'display' :'none'
					});

					$('customerList').set('styles', {
						'display' :'block'
					});

					var req = new Request( {

						url : thisServer + 'includes/returnCustomerInfo.php?searchText=' + $(
								'customerName').get('value'),

						onSuccess : function(txt) {
							$('customerList').set('html', txt);
						},
						onComplete :attachEventCallback,

						// Our request will most likely succeed, but just in
						// case, we'll add an
						// onFailure method which will let the user know what
						// happened.
						onFailure : function() {
							$('customerList')
									.set('html', 'The request failed.');
						}

					});

					req.send();

				});
		
	}
	});

function deleteRecord( recordID, recordTable, message ) {
	
	if (confirm("Are you sure you want to delete this?\n" + message)){
			
	
		var req = new Request( {
	
			url : thisServer + 'common/includes/deleteRecord.php?recordID=' + recordID + '&recordTable=' + recordTable ,
			
			onSuccess : function(txt) {
				$('itemUpdateStatus' + recordID).set('html', 'Item Has been DELETED');
			},
	
			// Our request will most likely succeed, but just in
			// case, we'll add an
			// onFailure method which will let the user know what
			// happened.
			onFailure : function() {
				$('itemUpdateStatus' + recordID).set('html', 'The request failed.');
			}
	
		});
	
		req.send();
	}
};

