function myAZtln()
{
}

myAZtln.addFriend = function( user_id )
{
	new Ajax.Request( '/profile/_addFriend/user_id=' + user_id,
		{
			method: "get",
			onComplete: function( transport )
			{
				if ( $('dyn_friend') )
					new Ajax.Updater( "dyn_friend", "/profile/_add_friend/" + user_id );
				else
					window.location.reload();
				
				Dialog.alert( "Connection successfully added!", {
					className: "alphacube",
					width:300, 
					height:100, 
					okLabel: "close"});
			}
		});	
}

myAZtln.removeFriend = function( user_id )
{
	new Ajax.Request( '/profile/_removeFriend/user_id=' + user_id,
		{
			method: "get",
			onComplete: function( transport )
			{
				if ( $('dyn_friend') )
					new Ajax.Updater( "dyn_friend", "/profile/_add_friend/" + user_id );
				else
					window.location.reload();
				
				Dialog.alert( "Connection successfully removed!", {
					className: "alphacube",
					width:300, 
					height:100, 
					okLabel: "close"});
			}
		});	
}

myAZtln.authenticate = function( username, password )
{
	new Ajax.Request( '/login/_authenticate/username=' + username + "&password=" + password,
		{
			method: "get",
			onComplete: function( transport )
			{
				if ( transport.responseText == "1" )
				{
					Windows.closeAll();
					window.location = "/profile/home";
				}
				else
					$('login_msg').innerHTML = 'Invalid login. Please try again';
			}
		});	
}

myAZtln.sendMessage = function()
{
	Dialog.alert( "Message will be delivered.  Thank you!", {
	className: "alphacube",
	width:300, 
	height:100, 
	okLabel: "close"});
}

