function InitToggleState(SectionID, bDefaultOpen)
{
	//var chk = eval("document.all." + SectionID + 'State')
	var chk = document.getElementById(SectionID + 'State')
	if(chk!=null){
		if(chk.checked==bDefaultOpen){
			ToggleSection(SectionID);
		}
	}
}

function ToggleState(SectionID)
{
	//var chk = eval("document.all." + SectionID + 'State');
	var chk = document.getElementById(SectionID + 'State');
	if (chk != null){
		if (chk.checked == true)
		{
			chk.checked = false;
		}
		else
		{
			chk.checked = true;
		}
	}
}

function ToggleSection(SectionID)
{
	//ToggleState(SectionID);
	var obj = document.getElementById(SectionID);
	if (obj != null){
		OpenSection(SectionID, obj.style.display.length);
		//OpenSection(SectionID, eval("document.all." + SectionID).style.display.length);
	}
}

function OpenSection(SectionID, Open)
{
	//var stlSection = eval("document.all." + SectionID).style;
	//var stlOpen = eval("document.all." + SectionID + "Open").style;
	//var stlClose = eval("document.all." + SectionID + "Close").style;
	var obj = document.getElementById(SectionID);
	var stlSection;
	if (obj != null){
		stlSection = obj.style;
	}
	var objOpen = document.getElementById(SectionID + "Open");
	var objClose = document.getElementById(SectionID + "Close");
	var stlOpen;
	var stlClose;

	if (Open)
	{
		stlSection.display = "";
		if (objOpen != null){
			stlOpen = objOpen.style;
			stlOpen.display = "none";
		}
		if (objClose != null){
			stlClose = objClose.style;
			stlClose.display = "";
		}
	}
	else
	{
		stlSection.display = "none";
		if (objOpen != null){
			stlOpen = objOpen.style;
			stlOpen.display = "";
		}
		if (objClose != null){
			stlClose = objClose.style;
			stlClose.display = "none";
		}
	}
}
				
function OpenAllSections(Open)
{
	var objSource = document.all.Sections;
	var objCurrent;
	var x;
			
	// Loop through all table elements
	for (x = 0; x < objSource.all.length; x++)
	{
		// Get current object
		objCurrent = objSource.all(x);

		// See if this is a table row with an ID (i.e., a section)
		if (objCurrent.tagName == "TR" && objCurrent.id.length)
			OpenSection(objCurrent.id, Open)
	}
}

var winHelp;
function openhelp(strURL){
	if (winHelp == null) {
		winHelp = window.open(strURL,"OPISHelp","height=530,width=700,resizable,scrollbars");
	}
	else {
		if (winHelp.closed == true) {
			winHelp = window.open(strURL,"OPISHelp","height=530,width=700,resizable,scrollbars");
		}
		else
		{
			winHelp.location.replace(strURL)
		}
		winHelp.focus();
	}
}

var winHelpTopicItem;
function openhelpitem(strURL){
	var iTop = ((window.screen.height-250)/2);
	var iLeft = ((window.screen.width-400)/2);		
	if ((winHelpTopicItem == null)) {
		winHelpTopicItem = window.open(strURL,"OPISHelpTopicItem","height=250,width=400,resizable,scrollbars,top=" + iTop + ",left=" + iLeft);
	}
	else {
		if (winHelpTopicItem.closed == true) {
			winHelpTopicItem = window.open(strURL,"OPISHelpTopicItem","height=250,width=400,resizable,scrollbars,top=" + iTop + ",left=" + iLeft);
		}
		else
		{
			winHelpTopicItem.location.replace(strURL)
		}
		winHelpTopicItem.focus(); 
	}
}

function IEOpenModalDialog(strContentURL, strTitle, bResizable, strHeight, strWidth)
{
	var arrArguments = new Array;
	arrArguments[0] = window;
	arrArguments[1] = strTitle;
	arrArguments[2] = strContentURL;
	var strFeatures;
	strFeatures = 'dialogHeight: ' + strHeight + '; dialogWidth: ' + strWidth + '; dialogTop: px; dialogLeft: px; edge: Raised; center: Yes; help: No; status: No;';
	if (bResizable == true) 
	{
		strFeatures = strFeatures + 'resizable: Yes; scroll: Yes;'
	}
	else
	{
		strFeatures = strFeatures + 'resizable: No; scroll: No;'
	}
	window.showModalDialog("dialog/dialogfs.htm", arrArguments, strFeatures);
}
//Netscape Method
var strDialogTitle = 'OPIS Dialog';
var strDialogContentPath = '';
var winDialog = null;
function OpenModalDialog(strContentURL, strTitle, bResizable, strHeight, strWidth)
{
	strDialogTitle = strTitle;
	strDialogContentPath = strContentURL;
	var strNS;
	strNS = 'height=' + strHeight + ',width=' + strWidth + ',location=0,menubar=0,status=0,titlebar=0,toolbar=0';
	if (bResizable == true) 
	{
		strNS = strNS + ',resizable=1,scrollbars=1';
	}
	else
	{
		strNS = strNS + ',resizable=0,scrollbars=0';
	}
	//Center
	if (window.screen) {
    var ah = screen.availHeight - 30;
    var aw = screen.availWidth - 10;
		var ww = strWidth;
		var wh = strHeight;
    var xc = (aw - ww) / 2;
    var yc = (ah - wh) / 2;
    strNS += ",left=" + xc + ",screenX=" + xc;
    strNS += ",top=" + yc + ",screenY=" + yc;
  }
  //Open
	if (winDialog && winDialog.open && !winDialog.closed) {
		winDialog.close();
	}
	winDialog = window.open("dialog/dialogfs.htm","OPISDialog",strNS);
}
function SwitchToDialog() {
	if (winDialog && winDialog.open && !winDialog.closed) {
		winDialog.focus();
	}
}
function CausePostback() {
	window.frmDesktop.submit();
}
