function TBtoggle(theEl)
{
	if(document.getElementById(theEl).style.display == 'none') {
		document.getElementById(theEl).style.display = 'block';
	}
	else {
		document.getElementById(theEl).style.display = 'none';
	}
}

function switchIt(theElOn, theElOff)
{
	document.getElementById(theElOn).style.display = 'block';
	document.getElementById(theElOff).style.display = 'none';
	
}

function TBtoggleReadonly(theEl)
{
	if(document.getElementById(theEl).disabled) {
		document.getElementById(theEl).disabled = false;
	}
	else {
		document.getElementById(theEl).disabled = true;
	}
}

/*
	* Create a popup window with specified height and width
	* @p = the page to open
	* @framewidth = the width of the window
	* @frameheight = the height of the window
*/
function p(page,framewidth,frameheight){
	window.open(page,'_blank','scrollbars=1,status=0,menubar=0,resizable=0,location=0,left='+((screen.width-framewidth)/2)+',top='+((screen.height-frameheight)/2)+',toolbar=0,height='+frameheight+',width='+framewidth);
}

/*
	* Change the content of an input text
	* @theEl = the element id of the input box
	* @theContent = the content to add
*/
function copyto(theEl, theContent)
{
	document.getElementById(theEl).value = "";
	document.getElementById(theEl).value = theContent;
}

/*
	* Reload the parent opener page
	* This function may only be called from out of a popup
*/
function reloadParent()
{
	window.opener.location.reload();
	window.opener.focus();
}

/*
	* Return confirmation dialog
	* @msg = the message to be displayed
*/
function msg(m)
{
	if (confirm(m)) { 
		return true;
	}
	else {
		return false;
	}
}

function restoreRow(theEl)
{
	if(document.getElementById(theEl).className == 'grey') {
		document.getElementById(theEl).style.backgroundColor = '#f0f0f0';
	}
	else {
		document.getElementById(theEl).style.backgroundColor = '#ffffff';
	}
}

function activeRow(theEl)
{
	document.getElementById(theEl).style.backgroundColor = '#80D4FF';
}

function reloadAfterTime() {
  window.location.reload(true);
}

function redirectLogin(p)
{	
	t=setTimeout("window.location.href='main.php'", p);
}