function toggleChildMenu(id)
{
	var maxLinks = 101;

	if(id != -1)
		var displayType = document.getElementById('smenu'+id).style.display;

	/*
	Hide all child menus, and reset all links back to default values.
	*/
	for(i=0; i<maxLinks;i++)
	{
		if(document.getElementById('smenu'+i))
		{
			document.getElementById('smenu'+i).style.display='none';
			document.getElementById('smenuh'+i).style.color='#9b9b9b';
			document.getElementById('smenuh'+i).style.background='none';
                }	
	}
	
	/*
	Show the child menu and change the link colour
	*/
	if(id != -1)
	{
		if(displayType == "none" || displayType == "")
		{
			document.getElementById('smenu'+id).style.display='block';
			document.getElementById('smenuh'+id).style.color='#f2be1f';
			document.getElementById('smenuh'+id).style.background='url(images/menu_bgdots.png) no-repeat';
		}
	}
}

function confirmInvoiceIssue()
{
	return confirm("Are you sure you want to issue the invoice?");
}

function confirmOrderCancel()
{
	return confirm("Are you sure you want to cancel your order?");
}

function confirmCancelOrder()
{
	return confirm("Are you sure you want to cancel this order?\nThis can not be undone.");
}

function disableButton(btn)
{
	if(btn.disabled == true)
		btn.disabled = false;
	else
		btn.disabled = true;
	
	return true;
}

function updateItem(url)
{
	window.open(url,'Update Item','toolbar=0,scrollbars=0,location=0,status=0,menubar=0,resizable=1,width=500,height=300,left=200,top=200');
}


function toggleSpecificStateClient(specCountry)
{
	country = document.getElementById('country').value;
	
	if(specCountry != "")
		country = specCountry;

	if(country == "Australia")
	{
		document.getElementById('state_specific').style.display = 'none';
		document.getElementById('state').style.display = 'block';
	}
	else
	{
		document.getElementById('state_specific').style.display = 'block';
		document.getElementById('state').style.display = 'none';
	}
}

function toggleSpecificStateRegister(specCountry)
{
	country = document.registerForm.country.value;
	
	if(specCountry != "")
		country = specCountry;

	if(country == "Australia")
	{
		document.getElementById('state_specific').style.display = 'none';
		document.getElementById('state').style.display = 'block';
	}
	else
	{
		document.getElementById('state_specific').style.display = 'block';
		document.getElementById('state').style.display = 'none';
	}
}