function readCookie(name)
{
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++)
	{
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}
function openNewWindow(fileName,theWidth,theHeight)
{
  	window.open(fileName,"Explanation","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,width="+theWidth+",height="+theHeight);
}
function checklogin()
{
	var x = readCookie('ID');
	if (x)
		{
			hideCellContent('table0', 0, 0);
			hideCellContent('table0', 0, 1);
			hideCellContent('table0', 0, 2);
			hideCellContent('table0', 1, 0);
			mdiv = document.getElementById("loginmsg");
			mdiv.innerHTML = "<a href='http://w2.certegrity.com/plogini.nsf/paccess?OpenAgent&ID="+x+"'>Click to enter your Training Portal</a>";
			mdiv = document.getElementById("logoutmsg");
			mdiv.innerHTML = "<a href='http://w2.certegrity.com/plogini.nsf/hlogout?OpenForm'>Click to Logout</a>";
		}
	else
		{ 
			showCellContent('table0', 0, 0);
			showCellContent('table0', 0, 1);
			showCellContent('table0', 0, 2);
			showCellContent('table0', 1, 0);
			showCellContent('table1', 0, 2);
			mdiv = document.getElementById("loginmsg");
			mdiv.innerHTML = "&nbsp; Login to access your<br>&nbsp; <a href='support.shtml' class='revlink'>Personal Training Portal</a>";
		}
}
function hideCellContent (tableID, rowIndex, cellIndex)
{
  	if (document.layers) {
    	if (typeof rowIndex != undefined)
      	var cell = document[tableID + 'CellR' + rowIndex + 'C' + cellIndex];
	    cell.visibility = 'hide';
  	}
  	else if (window.opera)
	{
    	var cell = document.getElementById(tableID + 'CellR' + rowIndex + 'C' + cellIndex);
	    cell.style.visibility = 'hidden';
  	}
  	else if (document.all)
    
	document.all[tableID].rows[rowIndex].cells[cellIndex].style.visibility = 'hidden';
	  else if (document.getElementById)
    
	document.getElementById(tableID).rows[rowIndex].cells[cellIndex].style.visibility = 'hidden';
}
function showCellContent (tableID, rowIndex, cellIndex) {
  if (document.layers) {
    if (typeof rowIndex != undefined)
      var cell = document[tableID + 'CellR' + rowIndex + 'C' + cellIndex];
    cell.visibility = 'show';
  }
  else if (window.opera) {
    var cell = document.getElementById(tableID + 'CellR' + rowIndex + 'C' + cellIndex);
    cell.style.visibility = 'visible';
  }
  else if (document.all)
    
document.all[tableID].rows[rowIndex].cells[cellIndex].style.visibility = 
'visible';
  else if (document.getElementById)
    
document.getElementById(tableID).rows[rowIndex].cells[cellIndex].style.visibility = 'visible';
}
