function custom_gettotal_screens()
{
	elementcounter = 1;
	notatend = true;
	while (notatend)
	{
		if (document.getElementById('screen'+elementcounter))
		{
			notatend = true;
			elementcounter = elementcounter + 1;
		}
		else
		{
			notatend = false;
		}
	}
//	alert('helo');
	return elementcounter - 1;
}
function custom_show_gallery_next()
{
	//loop through all the divs to see wich is active
	getflag = false;
	stopflag = false;
	totalscreens = custom_gettotal_screens();
	for (i=0;i<=totalscreens;i++)
	{
		if (stopflag==false)
		{
			if (document.getElementById('screen'+i))
			{
				if (getflag)
				{
//						alert('found next screen: screen'+i);
						document.getElementById('screen'+i).style.display="";
						stopflag = true;					
				}
				else
				{
					
					if (document.getElementById('screen'+i).style.display=="")
					{
//						alert('found active screen: screen'+i);
						getflag = true;
						if (document.getElementById('screen'+(i+1)))
							{ document.getElementById('screen'+i).style.display="none"; }
					}
				}
			}
		}
	}
	return 0;
}
function custom_show_gallery_previous()
{
	//loop through all the divs to see wich is active
	getflag = false;
	stopflag = false;
	totalscreens = custom_gettotal_screens();
	for (i=totalscreens;i>=1;i--)
	{
		if (stopflag==false)
		{
			if (document.getElementById('screen'+i))
			{
				if (getflag)
				{
//						alert('found next screen: screen'+i);
						document.getElementById('screen'+i).style.display="";
						stopflag = true;					
				}
				else
				{
					
					if (document.getElementById('screen'+i).style.display=="")
					{
//						alert('found active screen: screen'+i);
						getflag = true;
						if (document.getElementById('screen'+(i-1)))
							{ document.getElementById('screen'+i).style.display="none"; }
					}
				}
			}
		}
	}
	return 0;
}
function confirmDelete(delUrl)
{
	if (confirm("Are you sure you want to delete this agent?"))
	{
		document.location = delUrl;
	}
}
// Added by Fred Macedo 28 April 2009 - to confirm approve of agent
function confirmApprove(approveUrl) {
	
	if (confirm("Are you sure you want to approve this agent?")) {
		document.location = approveUrl;
	}
}
//End of Add - Fred Macedo