// JavaScript Document

//Setting some Globals
userCPState = 'hideCP';


//This handles the toggleing of the CP states
function toggleCPState(){
	if(userCPState == 'hideCP')
	{
		userCPState = 'showCP'
	}
	else
	{
		userCPState = 'hideCP';	
	}
		var id = document.getElementById('userCP');
		setTimeout(userCPState+"("+id.clientHeight+")", 10);	
}


//This hides the Control Panel
function hideCP(height){
	id = document.getElementById('userCP');
	if(id.clientHeight > 0 && (id.clientHeight - 3)> 0)
	{
		id.style.height = height - 3+'px';
		setTimeout(userCPState+"("+id.clientHeight+")", 5);		

	}
	else
	{
		id.style.height = 1+'px';
	}
	
	
}

//This shows the Control Panel
function showCP(height){
	var	id = document.getElementById('userCP');
	var	totalHeight = document.getElementById('userCPHeightTD').clientHeight;
	if(id.clientHeight < totalHeight)
	{
		id.style.height = height + 3+'px';
		setTimeout(userCPState+"("+id.clientHeight+")", 10);	
	}
	else
	{
		id.style.height = totalHeight+'px';
	}
	
	
}