// JavaScript Document

// wait for the DOM to be loaded 
$(document).ready(function() { 
	// hide response
	$('#response').hide();
	// bind 'myForm' and provide a simple callback function 
	$('#addressForm').ajaxForm({ 
		// target identifies the element(s) to update with the server response 
		target: '#response', 
		
		// success identifies the function to invoke when the server response 
		// has been received; here we apply a fade-in effect to the new content 
		success: function(data) {
			// Split the data into code and message on | character
			var splitdata = data.split('\|');
			if (splitdata[0] == "1") {
				$('#response').addClass('regsuccess');
			} else {
				$('#response').addClass('regerror');
			}
			$('#response').html(splitdata[1]);
			$('#response').hide().fadeIn('slow'); 
		} 
	}); 
}); 
