function showPopup(id, countPopups)
{
	var element = document.getElementById('popup-' + id);
	var countPopups = document.getElementsByTagName("div").length;
	var number_of_popups = 0;
	
	for(i = 0; i < countPopups; i++)
	{
		if(document.getElementsByTagName("div")[i].className.indexOf("popup")!=-1)
			number_of_popups++;
	}
	
	countPopups = number_of_popups;
	if(element.style.display == "none")
	{	

		for(i=1; i<=countPopups; i++)
		{
			if(document.getElementById('popup-' + i) != null)
			{
				hidePopup(i);				
			}
			
		}
	
		element.style.display = "";
	}
	else
	{
		hidePopup(id);
	}
}
function hidePopup(id)
{
	var element = document.getElementById('popup-' + id);
	element.style.display = "none";
}

function showhide(element)
{
	var obj = document.getElementById(element);
	if(obj) 
	{
		if(obj.style.display == "none") obj.style.display = "block";
		else obj.style.display = "none";
	}
}

function wristband(obj)
{
	var element = obj.value;
	if(element == "1")
	{
		show("myself");
		hide("three");
	}
	else if(element == "3")
	{
		show("three");
		show("myself");		
	}
	else
	{
		hide("three");
		hide("myself");		
	}
}

function showmonthly(obj)
{
	var element = obj.value;
	
	if(element == "1" && obj.checked)
	{
		show("directdebit");
		document.getElementById("payment_error").className = "box-round green";
	}
	else
	{
		hide("directdebit");
	}
}

function show(obj)
{
	document.getElementById(obj).style.display = "block";	
}
function hide(obj)
{
	document.getElementById(obj).style.display = "none";	
}
