var TellAFriend = Class.create({ 

	initialize: function() { 			
		
		if ($("idTellAFriend")) {
			var tellAFriendBox = $("idTellAFriend").up(".clsExtra").down(".clsTellaFriend");
			
			// SHOW
			$("idTellAFriend").observe("click", function(event) {
				event.stop();
				tellAFriendBox.setStyle({left:(event.pointerX()-120)+"px",top:(event.pointerY()-130)+"px"});
				Effect.Appear(tellAFriendBox,{duration:0.6});
			});


			// CLOSE
			$("idTellAFriendClose").observe("click", function(event) {
				event.stop();
				Effect.Fade(tellAFriendBox,{duration:0.6});
			});
			

			// SEND
			$("idTellAFriendSend").observe("click", function(event) {
				event.stop();
				$("idFormTellAFriend").request({
					parameters: {site:window.location.href},
					onComplete: function(response) {
						$(document.body).insert(response.responseText);
						Effect.Fade(tellAFriendBox,{duration:0.6});
					}
				});
			});

		}
		
	}
	
});

$(document).observe("dom:loaded", function() {
	var tellAFriend = new TellAFriend();
});
