function sha1 (formId)
{
	var form = $(formId);
	
	form.password.value = hex_sha1(form.passwdDraft.value);
	
	form.passwdDraft.value = '';
	
	form.submit ();
}

function showText (id)
{
	var boxes = new Array ('summary','reasons','goal','methodology','partners','team','comments','schedule');
	
	for (var i = 0 ; i < boxes.length ; i++)
		$('text_' + boxes [i]).style.display = 'none';
	
	$('text_' + id).style.display = 'block';
}

function validate ()
{
	if (document.getElementById ('actor_name').value.length < 1)
	{          
		 alert ("O campo nome não pode ser vazio!");
		 document.getElementById ('actor_name').focus ();
		 return false;
	}
	
	var reTipo = /^[\w-]+(\.[\w-]+)*@(([A-Za-z\d][A-Za-z\d-]{0,61}[A-Za-z\d]\.)+[A-Za-z]{2,6}|\[\d{1,3}(\.\d{1,3}){3}\])$/;
	
	if (!reTipo.test (document.getElementById ('actor_email').value))
	{
		 alert ("O campo email não está preenchido corretamente!");
		 document.getElementById ('actor_email').focus ();
		 return false;	
	}
	
	if (document.getElementById ('actor_subject').value.length < 1)
	{          
		 alert ("O campo assunto não pode ser vazio!");
		 document.getElementById ('actor_subject').focus ();
		 return false;
	}
	
	if (document.getElementById ('actor_message').value.length < 1)
	{          
		 alert ("O campo mensagem não pode ser vazio!");
		 document.getElementById ('actor_message').focus ();
		 return false;
	}

	if (document.getElementById ('actor_spam').value.length < 1)
	{          
		 alert ("O campo de confirmação de imagem não pode ser vazio!");
		 document.getElementById ('actor_spam').focus ();
		 return false;
	}

	return true;
}

function showGallery (id)
{
	var gallery = $('gallery_' + id);
	var photos = $('photos_' + id);
	
	if (photos.style.display == '')
	{
		photos.style.display = 'none';
		gallery.style.border = '#CCCCCC 2px solid';
	}
	else
	{
		eval ('var lids = ids_' + id);
		
		if (lids.length)
		{
			for (var i = 0 ; i < lids.length ; i++)
			{
				var image = document.createElement ('img');
	
				$('thumb_' + lids [i]).appendChild (image);
				
				image.src = 'manager/titan.php?target=script&toSection=gallery&file=thumb&photoId=' + lids [i] + '&size=100x75';
			}
			
			eval ('ids_' + id + ' = new Array ();');
		}
		
		photos.style.display = '';
		gallery.style.border = '#333333 2px solid';
	}
}

function openHelp (id)
{
	var help = window.open ('http://chat.jbtop.com/x/chat?account=' + id,'HelpDesk','width=600,height=470,resizable=1');
	
	help.focus ();
}	
