function showFriends(numFriendsToShow) {
			$('friendsArea').innerHTML = '<img align="center" src="http://images.hi5.com/images/progress_med2.gif"/>';
			var friendURL = "/friend/message/displayFriendsForShoutAJAX.do?numFriendsToShow=" + numFriendsToShow;

		 	var friendUpdates = new Ajax.Updater({success: 'friendsArea'}, friendURL, {asynchronous: true, onFailure: function(request, obj){
				$('friendsArea').innerHTML = "Sorry, your request could not be completed at this time. Please try again later.";
				},evalScripts: true});
		}

		function showMoreFriends(numFriendsToShow) {
			$('friendsArea').innerHTML = '<img align="center" src="http://images.hi5.com/images/progress_med2.gif"/>';
			var friendURL = "/friend/message/displayFriendsForShoutAJAX.do?numFriendsToShow=" + numFriendsToShow;
			var friendIds = document.shoutForm.friendIds;

			var params = "";
			for (var i = 0; i < friendIds.length; i++) {
				if (friendIds[i].checked) {
					params += "&friendIds=" + friendIds[i].value;
				}
			}

			var friendUpdates = new Ajax.Updater({success: 'friendsArea'}, friendURL, {method: 'post', parameters: params, asynchronous: true, onFailure: function(request, obj){
				$('friendsArea').innerHTML = "Sorry, your request could not be completed at this time. Please try again later.";
				},evalScripts: true});
		}



		var userImageTimer;

		var mouseX, mouseY;

		document.onmousemove = function(event) {
			var event = event || window.event;
			mouseX = event.clientX;
			mouseY = event.clientY;
		}

		function latentShowFriendInfo(imageURL) {
			new Ajax.Updater("friend_info", imageURL);
			//var scrollTop = window.scrollTop ? window.scrollTop : window.pageYOffset;
			var scrollTop = document.body.scrollTop;

			$("friend_info").style.display = "block";
			$("friend_info").style.left = mouseX + 20 + "px";
			$("friend_info").style.top = mouseY + scrollTop + 20 + "px";
		}

		function showFriendInfo(event,imageURL) {
			document.getElementById("friend_info").innerHTML = "<fmt:message key='message.photoshare.sharealbum.loadpic' />";
			clearTimeout(userImageTimer);
			userImageTimer = setTimeout("latentShowFriendInfo('" + imageURL + "')", 500);
		}

		function hideFriendInfo(event) {
			clearTimeout(userImageTimer);
			document.getElementById("friend_info").style.display = "none";
		}
		
		function closeDiv (blockId) {
			document.getElementById(blockId).style.visibility = 'hidden';
		}
		
		function hideMessages() {
			document.getElementById("ajaxMessages").style.display = 'none';
			document.getElementById("ajaxMessages").innerHTML='';
		}
		

		function ajaxSubmit () {
			var url = '/friend/message/shoutContentAjax.do';
			var pars = 'message=' + document.shoutForm.message.value + '&contentId=' + document.shoutForm.contentId.value + '&contentType=' + document.shoutForm.contentType.value  + '&contentMeta=' + document.shoutForm.contentMeta.value + '&timestamp=' + document.shoutForm.timestamp.value;
			for (var i=0; i < document.shoutForm.circleIds.length ;i++) {
				if (document.shoutForm.circleIds[i].checked==true) {
					pars = pars + "&circleIds=" + document.shoutForm.circleIds[i].value;
				}
			}
			
			if (document.shoutForm.friendIds != null) {
				if (document.shoutForm.friendIds.length > 0) {
					for (var j=0; j < document.shoutForm.friendIds.length; j++) {
						if (document.shoutForm.friendIds[j].checked==true) {
							pars = pars + "&friendIds=" + document.shoutForm.friendIds[j].value;
						}
					}
				} else {
					if (document.shoutForm.friendIds.checked == true) {
						pars = pars + "&friendIds=" + document.shoutForm.friendIds.value;
					}
				}
			}

			new Ajax.Updater({success: 'ajaxMessages'}, url, {method: 'post',
			parameters: pars,
			asynchronous:true});
			
			document.getElementById('ajaxMessages').style.display = "block";
		}
		
		function showContentShout1(blockId, topPx, leftPx, contentType, contentId, contentMetadata, messageDefault) {
			document.getElementById(blockId).style.visibility="visible";
			document.getElementById(blockId).style.top=topPx;
			document.getElementById(blockId).style.left=leftPx;
			var contentShoutUrl = "/friend/message/displayContentShoutAJAX.do"
			var params = "&blockId=" + blockId + "&contentType=" + contentType + "&contentId=" + contentId + "&contentMetadata=" + contentMetadata + "&messageDefault=" + messageDefault;
			var contentShout = new Ajax.Updater({success: blockId}, contentShoutUrl, 
			{method: 'post', asyncronous: true, evalscripts: true, parameters: params});
		}

		function showContentShout2(blockId, contentType, contentId, contentMetadata, messageDefault) {
		    showContentShout3(blockId, contentType, contentId, contentMetadata, messageDefault, 0);
        }

		function showContentShout3(blockId, contentType, contentId, contentMetadata, messageDefault, xOffset) {
			showContentShout3WithSelectedCircle(blockId, contentType, contentId, contentMetadata, messageDefault, xOffset, 0);
		}
		
		function showContentShout3WithSelectedCircle(blockId, contentType, contentId, contentMetadata, messageDefault, xOffset, circleId) {
			document.getElementById(blockId).style.visibility="visible";
			document.getElementById(blockId).style.top= mouseY + "px"
			var shareX = mouseX + xOffset;
            document.getElementById(blockId).style.left= shareX + "px"
			var contentShoutUrl = "/friend/message/displayContentShoutAJAX.do"
			var params = "";
			if (circleId > 0) {
				params = params + "&circleIds=" + circleId;
			}
			params = params + "&blockId=" + blockId + "&contentType=" + contentType + "&contentId=" + contentId + "&contentMetadata=" + contentMetadata + "&messageDefault=" + messageDefault;
			
			var contentShout = new Ajax.Updater({success: blockId}, contentShoutUrl,
			{method: 'post', asyncronous: true, evalscripts: true, parameters: params});
		}
