function hideButton(submit_button, upload_form, text)
{
	var Sbutton = document.getElementById(submit_button);
	var Uform = document.getElementById(upload_form);
	var textarea = document.getElementById(text);
	if (Sbutton && Uform)
	{
		Uform.submit();
		Sbutton.style.display = 'none';
		textarea.style.display = 'block';

	}
}


function closePhotoBox(id)
{
	if (document.getElementById('photo'+id))
	{
		document['register_form'].elements['image'+id+'title'].value='';	
		document.getElementById('photo'+id).style.display = 'none';
			
		var h = how_many();
	
		if (h<8)
		{
			showLinks();
		}
	
	}
}

function how_many()
{
	h_many = 0;
	
	for (i=1; i<=8; i++)
	{
		if (document.getElementById('photo'+i))
		{
			if (document.getElementById('photo'+i).style.display == 'block')
			{
				h_many++;
			}
		}
	}
	
	return h_many;
}

function addNewPhotoBox()
{
	var h = how_many();
	if (h<8)
	{
		for (i=1; i<=8; i++)
		{
			if (document.getElementById('photo'+i))
			{
				if (document.getElementById('photo'+i).style.display == 'none')
				{
					document.getElementById('photo'+i).style.display='block';
					break;
				}
			}
		}
	

		var h = how_many();
		if (h==8)
		{
			hideLinks();
		}	
	}
}

function showLinks()
{
	for (i=1; i<=7; i++)
	{
		if (document.getElementById('link_add_another_image'+i))
		{
			document.getElementById('link_add_another_image'+i).style.display = 'block';			
		}
	}
}

function hideLinks()
{
	for (i=1; i<=7; i++)
	{
		if (document.getElementById('link_add_another_image'+i))
		{
			document.getElementById('link_add_another_image'+i).style.display = 'none';			
		}
	}
}


function showPhotoBox(id)
{
	if (document.getElementById('photo'+id))
	{
		document.getElementById('photo'+id).style.display = 'block';
	}
	
	var h = how_many();
	if (h==8)
	{
		hideLinks();
	}
}

<!--
// copyright 1999 Idocs, Inc. http://www.idocs.com
// Distribute this script freely but keep this notice in place
function letternumber(e)
{
var key;
var keychar;

if (window.event)
   key = window.event.keyCode;
else if (e)
   key = e.which;
else
   return true;
keychar = String.fromCharCode(key);
keychar = keychar.toLowerCase();

// control keys
if ((key==null) || (key==0) || (key==8) || 
	(key==9) || (key==13) || (key==27) )
	return true;

// alphas and numbers
else if ((("abcdefghijklmnopqrstuvwxyz0123456789-").indexOf(keychar) > -1))
	return true;
else
	return false;
}