	function on(id) {
		document.getElementById(id).style.background = 'gainsboro';
	}

	function off(id) {
		document.getElementById(id).style.background = 'transparent';
	}

	function addEmoction(img, textArea) {
		$('#' + textArea).val($('#' + textArea).val() + img);
	}

	function slide(element) {
		if ($(element).get(0).style.display == 'none') {
			$(element).slideDown('fast');
		} else {
			$(element).slideUp('slow');
		}
	}

	function delFriend(drag) {

		pieces = drag.id.split('_divisor_');

		if (drag.id != '') {

			$('#friendsTrash').get(0).src = '/app/webroot/img/icons/trash_full.png';

			if (confirm('Deseja realmente deletar "' + pieces[0] + '" da sua lista de amigos?')) {

				$(function() {
					$('#trashMessage').html('<img src=/img/icons/ajax2.gif  >').load('/users/cancel_friend_invite/' + pieces[1]);
					$('#' + drag.id).get(0).src = '/app/webroot/img/users/avatar/deaduser.png';
					$('#' + drag.id).get(0).id = '';
				});

			}

			$('#friendsTrash').get(0).src = '/app/webroot/img/icons/trash.png';

		} else {
			alert('Este amigo ja foi deletado.');
		}

	}

	$(function(){

		$.blockUI.defaults.growlCSS.right = ((screen.width / 2) - 175) + "px";
		$.blockUI.defaults.growlCSS.top = screen.height / 3 + "px";

		$('.friendAvatar').Draggable({
			ghosting: true,
			opacity: 0.7,
			zIndex: 10,
			revert: true

		});

		$('#friendsTrash').Droppable({
			accept: 'friendAvatar',
			onDrop: delFriend
		});

	});
