/*

popups.

popuptextarea

*/

function getpopuptextareas()
	{
	var formelements = $$('*').filterByAttribute('popuptextarea');
	return formelements;
	}

function loadPopUps()
	{
	var popupeles=getpopuptextareas();

	var len=popupeles.length;
	for (x=0; x < len; x++)
		{
		// Is there a comment?  if so change img src
		var hid=popupeles[x].getAttribute("popuptextarea");
		var cvalue=$(hid).value;
		var scvalue = cvalue.replace(/<\/?[^>]+(>|$)/g, "");
		if(scvalue.length > 2)
			{
			$(popupeles[x]).src="/img/comment_edit.png";
			}
		$(popupeles[x]).addEvent('click', function(evt)
			{
			// open window.  pass the id of the hidden input
			var hid=this.getAttribute("popuptextarea");
			var buttonid=this.getAttribute("id");
			var winele=window.open('/scripts/popup.php?hid='+hid+'&buttonid='+buttonid,'childW','width=750,height=300');
			});
		}	
	
	}



window.addEvent('domready', loadPopUps);

