
var top_position	= 520;
var base_position	= 291;
var sectioncellpadding	= 2;
var sectioncellspacing	= 1;
var sectioncell_width	= 33;
var section_textbox_width = 400;

if (typeof(checkNavigation)!="undefined") checkNavigation(false);

//
// UI Functions
//
function showSectionText(sectionNo)
{
	if (typeof(sectionText[sectionNo-1])=="undefined") return;
	window.status = sectionNo+". "+sectionText[sectionNo-1];

	var obj = document.getElementById("sectionText");
	obj.className = 'display_sectiontext';

	if (navigator.userAgent.indexOf("MSIE")!=-1)
		base_position	= 292;

	obj.style.left = base_position+((sectioncell_width+sectioncellpadding+sectioncellspacing)*(sectionNo-1))+"px";
	obj.style.top = top_position+"px";
	obj.style.width = section_textbox_width+"px";
	
	obj.innerHTML = sectionText[sectionNo-1];
	if (sectionNo>1)
	if ((typeof(sectionState)!="undefined")&&(sectionNo<section_code.length))
		obj.innerHTML +=" ("+sectionState[sectionNo-1]+")";
}
function hideSectionText()
{
	window.status = "";
	var obj = document.getElementById("sectionText");
	obj.className='hidden_sectiontext';
	obj.innerHTML = "";
}
function drawSection(sectionNo, currentSection)
{
	var status_str = "sectioncell_incomplete";
	
	if (typeof(sectionState)!="undefined")
	{
		if (sectionState[sectionNo].indexOf("100%")!=-1) status_str = "sectioncell_complete";
		if (sectionState[sectionNo].indexOf("N/A")!=-1) status_str = "sectioncell_na";
	}
	if (currentSection == (sectionNo))
		status_str += "_current";
	if ((sectionNo==0)||(sectionNo==(sectionText.length-1)))
	{
		document.write("<td onmouseover='showSectionText("+(sectionNo+1)+")' onmouseout='hideSectionText()' class='"+status_str+"' onclick='gotoSection("+(sectionNo+1)+")'>"+section_code[sectionNo]+"</td>");
	}
	else
		document.write("<td onmouseover='showSectionText("+(sectionNo+1)+")' onmouseout='hideSectionText()' class='"+status_str+"' onclick='gotoSection("+(sectionNo+1)+")'>&nbsp;"+sectionNo+"&nbsp;</td>");
}
function drawSectionList(sectionText, bookmark)
{
	document.write("<table class='sectionbar' border=0 cellpadding="+(sectioncellpadding)+" cellspacing="+(sectioncellspacing)+"><tr valign=middle id='sectonlist' height=35>");
	for (var id=0;id<sectionText.length;id++)
	{
		drawSection((id), bookmark);
	}
	document.write("</tr></table>");
}
function drawSectionTextPanel()
{
	document.write("<div class='hidden_sectiontext' id='sectionText'>&nbsp;</div>");
	document.write("<div class='eazysafe' id='eazysafe' onclick=\"window.open('http://www.eazysafe.com', 'eazysafe')\">&nbsp;</div>");
	if (typeof(fetchIntoHTML)!="undefined")
	{
			fetchIntoHTML("username", "", "../safety/getUser.php", new Array(), "GET", true, "", false);
	}	
}
