function sendContactEmail( e_name, e_email, e_subject, e_msg )
{
	if ( !e_name.value || !e_email.value || !e_subject.value || !e_msg.value )
		return alert( "Please fill in all fields to submit a comment." ); 
	
	e_name.disabled = true;
	e_email.disabled = true;
	e_subject.disabled = true;
	e_msg.disabled = true;
	
	new Ajax.Request( '/contact/_send',
		{
			method: "post",
			parameters: { "name": e_name.value, "email": e_email.value, "subject": e_subject.value, "msg": e_msg.value },
			onComplete: function( transport )
			{
				// Clear fields
				e_name.value = "";
				e_email.value = "";
				e_subject.value = "";
				e_msg.value = "";
				
				// Disable elements
				e_name.disabled = false;
				e_email.disabled = false;
				e_subject.disabled = false;
				e_msg.disabled = false;
				
				alert( "Your message has been sent!  Thank you for your input." );
			}
		});
}

function showDialog( url, title )
{
	Dialog.alert( {
			url: url,
			options: { method: "get" }},
			{
				width: 540
			} );	
}

function login()
{
	Dialog.info( {
			url: "/login/_view",
			options: { method: "get" }},
			{
				className: "alphacube",
				width: 300,
				height: 150
			} );
}

function addFriend( user_id )
{
	Dialog.confirm( "Are you sure you want to add this user to your connections?", {
			className: "alphacube",
			width: 300,
			okLabel: "Yes",
			cancelLabel: "No",
			cancel: function( win ) { return },
			ok: function( win ) { myAZtln.addFriend( user_id ); return true }});
}

function removeFriend( user_id )
{
	Dialog.confirm( "Are you sure you want to remove this user from your connections?", {
			className: "alphacube",
			width: 300,
			okLabel: "Yes",
			cancelLabel: "No",
			cancel: function( win ) { return },
			ok: function( win ) { myAZtln.removeFriend( user_id ); return true }});
}
