<!-- Begin

var blnReportModuleLoaded = false;

function hideReportModule()
{
	var link = document.getElementById('ReportModuleHideShowLink');
	link.href = 'javascript:showReportModule()';
	link.innerHTML = '(show options)';
	
	var reportTable = document.getElementById('ReportOptionsTable');

	reportTable.style.display = 'none';
	reportTable.style.position = 'absolute';
	
}

function showReportModule()
{
	var link = document.getElementById('ReportModuleHideShowLink');
	link.href = 'javascript:hideReportModule()';
	link.innerHTML = '(hide options)';
	
	var reportTable = document.getElementById('ReportOptionsTable');

	reportTable.style.display = 'inline';
	reportTable.style.position = 'static';
	
	/********************
	*  Report Options   *
	*********************/
	if (!blnReportModuleLoaded)
	{
		var ddlFoundation = document.getElementById('RMFoundation');
		var ddlFunction = document.getElementById('RMFunction');
		var ddlIndustry = document.getElementById('RMIndustry');
		var ddlSegment = document.getElementById('RMSegment');
		var ddlCompanySize = document.getElementById('RMCompanySize');
		var ddlGroup = document.getElementById('RMGroup');
		
		// foundation
		ddlFoundation.selectedIndex = 1;
		if (intFoundation)
		{
			for (var i=0; i<ddlFoundation.length; i++)
			{
				if (ddlFoundation.options[i].value == intFoundation)
				{
					ddlFoundation.selectedIndex = i;
					loadFunctions();
					break;
				}
			}

			// function
			ddlFunction.selectedIndex = 1;
			if (intFunction)
			{
				for (var i=0; i<ddlFunction.length; i++)
				{
					if (ddlFunction.options[i].value == intFunction)
					{
						ddlFunction.selectedIndex = i;
						break;
					}
				}
			}
		}
		else
		{
			disableDropDown(document.getElementById('RMFunction'));
		}
		
		
		// type
		switch (intType)
		{
			case 1:
				document.getElementById('RMType_1').checked = true;
				break;
			case 2:
				document.getElementById('RMType_2').checked = true;
				break;
			case 3:
				document.getElementById('RMType_3').checked = true;
				break;
			default:
				document.getElementById('RMType_3').checked = true;
				break;
		}
		
		// point scale
		switch (intPointScale)
		{
			case 1:
				document.getElementById('RMPointScale_1').checked = true;
				break;
			case 2:
				document.getElementById('RMPointScale_2').checked = true;
				break;
			default:
				document.getElementById('RMPointScale_2').checked = true;
				break;
		}
		
		// period
		switch (intPeriod)
		{
			case 1:
				document.getElementById('RMPeriod_1').checked = true;
				break;
			case 2:
				document.getElementById('RMPeriod_2').checked = true;
				break;
			default:
				document.getElementById('RMPeriod_1').checked = true;
				break;
		}
		
		// peer comparison
		switch (intPeer)
		{
			case 1:
				document.getElementById('RMPeer_1').checked = true;
				break;
			case 2:
				document.getElementById('RMPeer_2').checked = true;
				break;
			case 3:
				document.getElementById('RMPeer_3').checked = true;
				break;
			case 4:
				document.getElementById('RMPeer_4').checked = true;
				break;
			case 5:
				document.getElementById('RMPeer_5').checked = true;
				break;
			default:
				document.getElementById('RMPeer_1').checked = true;
				break;
		}
		
		// filter options
		enableFilterOptions();
	
		// Industry
		if (intFilterIndustry != null)
		{
			for (var i=0; i<=ddlIndustry.length; i++)
			{
				if (intFilterIndustry == ddlIndustry.options[i].value)
				{
					ddlIndustry.selectedIndex = i;
					break;
				}
			}
		}

		// Segment
		if (intFilterSegment != null)
		{
			for (var i=0; i<=ddlSegment.length; i++)
			{
				if (intFilterSegment == ddlSegment.options[i].value)
				{
					ddlSegment.selectedIndex = i;
					break;
				}
			}
		}

		// Company Size
		if (intFilterCompanySize != null)
		{
			for (var i=0; i<=ddlCompanySize.length; i++)
			{
				if (intFilterCompanySize == ddlCompanySize.options[i].value)
				{
					ddlCompanySize.selectedIndex = i;
					break;
				}
			}
		}

		// Group
		if (intFilterGroup != null)
		{
			for (var i=0; i<=ddlGroup.length; i++)
			{
				if (intFilterGroup == ddlGroup.options[i].value)
				{
					ddlGroup.selectedIndex = i;
					break;
				}
			}
		}

		blnReportModuleLoaded = true;
	}
	
}

function hideReportModule_()
{
	var link = document.getElementById('ReportModuleHideShowLink');
	link.href = 'javascript:createReportModule()';
	link.innerHTML = '(show options)';
	
	var reportTable = document.getElementById('ReportTableBody');
	if (!reportTable)
	{
		reportTable = document.getElementById('ReportTable');
		var tbody = document.createElement('tbody');
		tbody.id = 'ReportTableBody';
		reportTable.appendChild(tbody);
		reportTable = document.getElementById('ReportTableBody');
	}

		
	var tr = reportTable.lastChild;
	while (tr.firstChild.id != 'ReportModuleTitleCell')
	{
		reportTable.removeChild(tr);
		tr = reportTable.lastChild;
	}
	
}

function createReportModule()
{
	var link = document.getElementById('ReportModuleHideShowLink');
	link.href = 'javascript:hideReportModule()';
	link.innerHTML = '(hide options)';
	
	var reportTable = document.getElementById('ReportTableBody');
	if (!reportTable)
	{
		reportTable = document.getElementById('ReportTable');
		var tbody = document.createElement('tbody');
		tbody.id = 'ReportTableBody';
		reportTable.appendChild(tbody);
		reportTable = document.getElementById('ReportTableBody');
	}
	
	// header row
	//var tr = document.createElement('tr');
	
	// header cell
	//var td = document.createElement('td');
	//td.colSpan = 2;
	//td.className = 'ReportModuleTitle';
	//td.innerHTML = 'Select Assessment Report Options';
	//tr.appendChild(td);
	//reportTable.appendChild(tr);
	
	// focus row
	var tr = document.createElement('tr');
	
	// focus category cell
	var td = document.createElement('td');
	td.className = 'ReportModuleCategory';
	td.innerHTML = 'Focus';
	td.style.verticalAlign = 'top';
	td.style.paddingTop = '5px';
	td.width = '120px';
	tr.appendChild(td);
	
	// focus option cell
	td = document.createElement('td');
	td.className = 'ReportModuleOption';

	/*******************************/
	// focus option table
	var table = document.createElement('table');
	var tbody = document.createElement('tbody');
	var tr2 = document.createElement('tr');
	var td2 = document.createElement('td');
	
	// foundation
	td2.className = 'ReportModuleOptionCell';
	td2.innerHTML = 'Foundation:';
	tr2.appendChild(td2);
	
	// level select cell
	td2 = document.createElement('td');
	td2.className = 'ReportModuleOptionCell';
	td2.style.paddingLeft = '10px';
	
	// foundation select
	var ddl = document.createElement('select');
	ddl.id = 'RMFoundation';
	ddl.name = 'RMFoundation';
	ddl.className = 'ReportModuleSelect';
	ddl.options[0] = new Option('Please Select','');
	ddl.options[1] = new Option('All','');
	
	for (var i=0; i<intRMFoundationCount; i++)
		ddl.options[i+2] = new Option(arrRMFoundations[i][1],arrRMFoundations[i][0]);

	if (navigator.appName.indexOf('Netscape') != -1)
		ddl.setAttribute('onchange',('loadFunctions();'));
	else
		ddl.onchange = Function('loadFunctions();');
	td2.appendChild(ddl);
	tr2.appendChild(td2);
	tbody.appendChild(tr2);

	// function cell
	tr2 = document.createElement('tr');
	td2 = document.createElement('td');
	td2.className = 'ReportModuleOptionCell';
	td2.innerHTML = 'Function:';
	tr2.appendChild(td2);
	
	// function select cell
	td2 = document.createElement('td');
	td2.className = 'ReportModuleOptionCell';
	td2.style.paddingLeft = '10px';
	
	//function select
	var ddl = document.createElement('select');
	ddl.id = 'RMFunction';
	ddl.name = 'RMFunction';
	ddl.className = 'ReportModuleSelect';
	ddl.options[0] = new Option('Please Select','');
	ddl.options[1] = new Option('All','');
	td2.appendChild(ddl);
	tr2.appendChild(td2);
	tbody.appendChild(tr2);
	table.appendChild(tbody);
	/*******************************/

	td.appendChild(table);
	tr.appendChild(td);
	reportTable.appendChild(tr);
	
	// type row
	tr = document.createElement('tr');
	
	// type category cell
	td = document.createElement('td');
	td.className = 'ReportModuleCategory';
	td.innerHTML = 'Type';
	tr.appendChild(td);
	
	// focus option cell
	td = document.createElement('td');
	td.className = 'ReportModuleOption';

	/*******************************/
	// type option table
	var table = document.createElement('table');
	var tbody = document.createElement('tbody');
	var tr2 = document.createElement('tr');
	var td2 = document.createElement('td');
	
	// process cell
	td2.className = 'ReportModuleOptionCellUnavailable';
	td2.width = 85;
	td2.innerHTML = 'Process';
	tr2.appendChild(td2);
	
	// process radio cell
	td2 = document.createElement('td');
	td2.className = 'ReportModuleOptionCellUnavailable';
	td2.width = 45;
	
	// process radio
	var input = document.createElement('input');
	input.type = 'radio';
	input.name = 'RMType';
	input.id = 'RMType_1';
	input.value = 1;
	input.disabled = true;
	td2.appendChild(input);
	tr2.appendChild(td2);
	
	// performance cell
	td2 = document.createElement('td');
	td2.className = 'ReportModuleOptionCellUnavailable';
	td2.width = 115;
	td2.innerHTML = 'Performance';
	tr2.appendChild(td2);
	
	// performance radio cell
	td2 = document.createElement('td');
	td2.className = 'ReportModuleOptionCell';
	td2.width = 45;
	
	// performance radio
	input = document.createElement('input');
	input.type = 'radio';
	input.name = 'RMType';
	input.id = 'RMType_2';
	input.value = 2;
	input.disabled = true;
	td2.appendChild(input);
	tr2.appendChild(td2);
	
	// combined cell
	td2 = document.createElement('td');
	td2.className = 'ReportModuleOptionCell';
	td2.width = 70;
	td2.innerHTML = 'Combined';
	tr2.appendChild(td2);
	
	// combined radio cell
	td2 = document.createElement('td');
	td2.className = 'ReportModuleOptionCell';
	td2.width = 45;
	
	// combined radio
	input = document.createElement('input');
	input.type = 'radio';
	input.name = 'RMType';
	input.id = 'RMType_3';
	input.value = 3;
	input.checked = true;
	td2.appendChild(input);
	tr2.appendChild(td2);

	tbody.appendChild(tr2);
	table.appendChild(tbody);
	/*******************************/
	
	td.appendChild(table);
	tr.appendChild(td);
	reportTable.appendChild(tr);
	
	// point scale row
	tr = document.createElement('tr');
	
	// point scale category cell
	td = document.createElement('td');
	td.className = 'ReportModuleCategory';
	td.innerHTML = 'Point Scale';
	tr.appendChild(td);
	
	// point scale option cell
	td = document.createElement('td');
	td.className = 'ReportModuleOption';

	/*******************************/
	// point scale option table
	var table = document.createElement('table');
	var tbody = document.createElement('tbody');
	var tr2 = document.createElement('tr');
	var td2 = document.createElement('td');
	
	// base cell
	td2.className = 'ReportModuleOptionCell';
	td2.width = 85;
	td2.innerHTML = 'Base';
	tr2.appendChild(td2);
	
	// base radio cell
	td2 = document.createElement('td');
	td2.className = 'ReportModuleOptionCell';
	td2.width = 45;
	
	// base radio
	var input = document.createElement('input');
	input.type = 'radio';
	input.name = 'RMPointScale';
	input.id = 'RMPointScale_1';
	input.value = 1;
	input.checked = true;
	td2.appendChild(input);
	tr2.appendChild(td2);
	
	// base + overrides cell
	td2 = document.createElement('td');
	td2.className = 'ReportModuleOptionCellUnavailable';
	td2.width = 115;
	td2.innerHTML = 'Base + Overrides';
	tr2.appendChild(td2);
	
	// base + overrides radio cell
	td2 = document.createElement('td');
	td2.className = 'ReportModuleOptionCell';
	td2.width = 45;
	
	// base + overrides radio
	input = document.createElement('input');
	input.type = 'radio';
	input.name = 'RMPointScale';
	input.id = 'RMPointScale_2';
	input.value = 2;
	input.disabled = true;
	td2.appendChild(input);
	tr2.appendChild(td2);
	
	tbody.appendChild(tr2);
	table.appendChild(tbody);
	/*******************************/
	
	td.appendChild(table);
	tr.appendChild(td);
	reportTable.appendChild(tr);

	// period row
	tr = document.createElement('tr');
	
	// period category cell
	td = document.createElement('td');
	td.className = 'ReportModuleCategory';
	td.innerHTML = 'Period';
	tr.appendChild(td);
	
	// period option cell
	td = document.createElement('td');
	td.className = 'ReportModuleOption';

	/*******************************/
	// period option table
	var table = document.createElement('table');
	var tbody = document.createElement('tbody');
	var tr2 = document.createElement('tr');
	var td2 = document.createElement('td');
	
	// current year cell
	td2.className = 'ReportModuleOptionCell';
	td2.width = 85;
	td2.innerHTML = 'Current Year';
	tr2.appendChild(td2);
	
	// current year radio cell
	td2 = document.createElement('td');
	td2.className = 'ReportModuleOptionCell';
	td2.width = 45;
	
	// current year radio
	var input = document.createElement('input');
	input.type = 'radio';
	input.name = 'RMPeriod';
	input.id = 'RMPeriod_1';
	input.value = 1;
	input.checked = true;
	td2.appendChild(input);
	tr2.appendChild(td2);
	
	// three year trend cell
	td2 = document.createElement('td');
	td2.className = 'ReportModuleOptionCellUnavailable';
	td2.width = 115;
	td2.innerHTML = 'Three Year Trend';
	tr2.appendChild(td2);
	
	// three year trend radio cell
	td2 = document.createElement('td');
	td2.className = 'ReportModuleOptionCell';
	td2.width = 45;
	
	// three year trend radio
	input = document.createElement('input');
	input.type = 'radio';
	input.name = 'RMPeriod';
	input.id = 'RMPeriod_2';
	input.value = 2;
	input.disabled = true;
	td2.appendChild(input);
	tr2.appendChild(td2);
	
	tbody.appendChild(tr2);
	table.appendChild(tbody);
	/*******************************/
	
	td.appendChild(table);
	tr.appendChild(td);
	reportTable.appendChild(tr);

	// peer comparison row
	tr = document.createElement('tr');
	
	// peer comparison category cell
	td = document.createElement('td');
	td.className = 'ReportModuleCategory';
	if (navigator.appName.indexOf('Netscape') == -1)
		td.style.paddingTop = '7px';
	else
		td.style.paddingTop = '5px';
	td.style.verticalAlign = 'top';
	td.innerHTML = 'Peer Comparison';
	tr.appendChild(td);
	
	// peer comparison option cell
	td = document.createElement('td');
	td.className = 'ReportModuleOption';

	/*******************************/
	// peer comparison option table
	var table = document.createElement('table');
	table.style.width = '100%';
	var tbody = document.createElement('tbody');
	
	// best practice row
	var tr2 = document.createElement('tr');
	var td2 = document.createElement('td');
	
	// best practice cell
	td2.className = 'ReportModuleOptionCell';
	td2.width = 200;
	td2.innerHTML = 'Best Practice (Max Points)';
	tr2.appendChild(td2);
	
	// best practice radio cell
	td2 = document.createElement('td');
	td2.className = 'ReportModuleOptionCell';
	
	// best practice radio
	var input = document.createElement('input');
	input.type = 'radio';
	input.name = 'RMPeer';
	input.id = 'RMPeer_1';
	input.value = 1;
	input.checked = true;
	if (navigator.appName.indexOf('Netscape') != -1)
		input.setAttribute('onclick',('enableFilterOptions();'));
	else
		input.onclick = Function('enableFilterOptions();');

	td2.appendChild(input);
	tr2.appendChild(td2);
	tbody.appendChild(tr2);
	
	// top quartile row
	tr2 = document.createElement('tr');
	td2 = document.createElement('td');
	
	// top quartile cell
	td2.className = 'ReportModuleOptionCellUnavailable';
	td2.width = 200;
	td2.innerHTML = 'Top Quartile Participants';
	tr2.appendChild(td2);
	
	// top quartile radio cell
	td2 = document.createElement('td');
	td2.className = 'ReportModuleOptionCell';
	
	// top quartile radio
	var input = document.createElement('input');
	input.type = 'radio';
	input.name = 'RMPeer';
	input.id = 'RMPeer_2';
	input.value = 2;
	input.disabled = true;
	if (navigator.appName.indexOf('Netscape') != -1)
		input.setAttribute('onclick',('enableFilterOptions();'));
	else
		input.onclick = Function('enableFilterOptions();');

	td2.appendChild(input);
	tr2.appendChild(td2);
	tbody.appendChild(tr2);
	
	// all row
	tr2 = document.createElement('tr');
	td2 = document.createElement('td');
	
	// all cell
	td2.className = 'ReportModuleOptionCell';
	td2.width = 200;
	td2.innerHTML = 'All Participants';
	tr2.appendChild(td2);
	
	// all radio cell
	td2 = document.createElement('td');
	td2.className = 'ReportModuleOptionCell';
	
	// all radio
	var input = document.createElement('input');
	input.type = 'radio';
	input.name = 'RMPeer';
	input.id = 'RMPeer_3';
	input.value = 3;
	if (navigator.appName.indexOf('Netscape') != -1)
		input.setAttribute('onclick',('enableFilterOptions();'));
	else
		input.onclick = Function('enableFilterOptions();');

	td2.appendChild(input);
	tr2.appendChild(td2);
	tbody.appendChild(tr2);
	
	// filtered row
	tr2 = document.createElement('tr');
	td2 = document.createElement('td');
	
	// filtered cell
	td2.className = 'ReportModuleOptionCell';
	td2.width = 200;
	td2.innerHTML = 'Filtered Participants';
	tr2.appendChild(td2);
	
	// filtered radio cell
	td2 = document.createElement('td');
	td2.className = 'ReportModuleOptionCell';
	
	// filtered radio
	var input = document.createElement('input');
	input.type = 'radio';
	input.name = 'RMPeer';
	input.id = 'RMPeer_4';
	input.value = 4;
	//input.disabled = true;
	if (navigator.appName.indexOf('Netscape') != -1)
		input.setAttribute('onclick',('enableFilterOptions();'));
	else
		input.onclick = Function('enableFilterOptions();');

	td2.appendChild(input);
	tr2.appendChild(td2);
	
	tbody.appendChild(tr2);
	
	table.appendChild(tbody);
	
	td.appendChild(table);
	tr.appendChild(td);
	reportTable.appendChild(tr);
	
	
	// filter options row
	tr = document.createElement('tr');
	
	// filter options category cell
	td = document.createElement('td');
	td.className = 'ReportModuleCategory';
	if (navigator.appName.indexOf('Netscape') == -1)
		td.style.paddingTop = '7px';
	else
		td.style.paddingTop = '5px';
	td.style.verticalAlign = 'top';
	td.innerHTML = 'Filter Options *';
	tr.appendChild(td);
	
	// filter options option cell
	td = document.createElement('td');
	td.className = 'ReportModuleOption';

	/*******************************/
	// filter options option table
	var table = document.createElement('table');
	table.style.width = '100%';
	var tbody = document.createElement('tbody');
	
	// industry row
	var tr2 = document.createElement('tr');
	var td2 = document.createElement('td');
	
	// industry cell
	td2.className = 'ReportModuleOptionCellUnavailable';
	//td2.width = 200;
	td2.innerHTML = 'Industry:';
	tr2.appendChild(td2);
	
	// industry select cell
	td2 = document.createElement('td');
	td2.className = 'ReportModuleOptionCellUnavailable';
	td2.colSpan = 2;
	
	//industry select
	var ddl = document.createElement('select');
	ddl.id = 'RMIndustry';
	ddl.name = 'RMIndustry';
	ddl.className = 'ReportModuleSelect';
	ddl.options[0] = new Option('Please Select','');
	ddl.options[1] = new Option('All','');
	ddl.style.width = '250px';
	ddl.disabled = true;
	if (navigator.appName.indexOf('Netscape') != -1)
		ddl.setAttribute('onchange',('setRMIndustry();'));
	else
		ddl.onchange = Function('setRMIndustry();');
	td2.appendChild(ddl);
	tr2.appendChild(td2);
	tbody.appendChild(tr2);
	
	// segment row
	tr2 = document.createElement('tr');
	td2 = document.createElement('td');
	
	// segment cell
	td2.className = 'ReportModuleOptionCellUnavailable';
	//td2.width = 200;
	td2.innerHTML = 'Segment:';
	tr2.appendChild(td2);
	
	// segment select cell
	td2 = document.createElement('td');
	td2.className = 'ReportModuleOptionCell';
	td2.colSpan = 2;
	
	// segment select
	var ddl = document.createElement('select');
	ddl.id = 'RMSegment';
	ddl.name = 'RMSegment';
	ddl.className = 'ReportModuleSelect';
	ddl.options[0] = new Option('Please Select','');
	ddl.options[1] = new Option('All','');
	ddl.style.width = '250px';
	ddl.disabled = true;
	if (navigator.appName.indexOf('Netscape') != -1)
		ddl.setAttribute('onchange',('setRMSegment();'));
	else
		ddl.onchange = Function('setRMSegment();');
	td2.appendChild(ddl);
	tr2.appendChild(td2);
	tbody.appendChild(tr2);
	
	// company size row
	tr2 = document.createElement('tr');
	td2 = document.createElement('td');
	
	// company size cell
	td2.className = 'ReportModuleOptionCellUnavailable';
	//td2.width = 200;
	td2.innerHTML = 'Company Size:';
	tr2.appendChild(td2);
	
	// company size select cell
	td2 = document.createElement('td');
	td2.className = 'ReportModuleOptionCell';
	
	// company size select
	var ddl = document.createElement('select');
	ddl.id = 'RMCompanySize';
	ddl.name = 'RMCompanySize';
	ddl.className = 'ReportModuleSelect';
	ddl.options[0] = new Option('Please Select','');
	ddl.options[1] = new Option('All','');
	ddl.options[2] = new Option('Less Than $1B','1');
	ddl.options[3] = new Option('Between $1B and $3B','2');
	ddl.options[4] = new Option('Between $3B and $10B','3');
	ddl.options[5] = new Option('Greater Than $10B','4');
	ddl.style.width = '180px';
	ddl.disabled = true;
	if (navigator.appName.indexOf('Netscape') != -1)
		ddl.setAttribute('onchange',('setRMCompanySize();'));
	else
		ddl.onchange = Function('setRMCompanySize();');
	td2.appendChild(ddl);
	tr2.appendChild(td2);
	
	// generate button cell
	td2 = document.createElement('td');
	td2.className = 'ReportModuleOptionCell';
	td2.align = 'right';
	
	// generate button
	var input = document.createElement('input');
	input.type = 'button';
	input.id = 'btnSubReport';
	input.value = 'Generate';
	input.style.fontSize = '8pt';
	
	if (navigator.appName.indexOf('Netscape') != -1)
		input.setAttribute('onclick',('generateReport();'));
	else
		input.onclick = Function('generateReport();');
	
	td2.appendChild(input);
	tr2.appendChild(td2);
		
	tbody.appendChild(tr2);
	
	table.appendChild(tbody);
	
	td.appendChild(table);
	tr.appendChild(td);
	reportTable.appendChild(tr);
	
	// footnote row
	tr = document.createElement('tr');
	td = document.createElement('td');
	
	// footnote cell
	td.colSpan = 2;
	td.style.textAlign = 'left';
	td.style.fontSize = '8pt';
	td.innerHTML = '* The filter options allow members to compare their scores to the scores of sub-groups within the &quot;All Participants&quot;<br>&nbsp;&nbsp; group.&nbsp; Filters are not available to subset the Best Practice or Top Quartile scores.';
	tr.appendChild(td);
	reportTable.appendChild(tr);

	
	/********************
	*  Report Options   *
	*********************/
	var ddlFoundation = document.getElementById('RMFoundation');
	var ddlFunction = document.getElementById('RMFunction');
	var ddlIndustry = document.getElementById('RMIndustry');
	var ddlSegment = document.getElementById('RMSegment');
	var ddlCompanySize = document.getElementById('RMCompanySize');
	var ddlGroup = document.getElementById('RMGroup');
	
	// foundation
	ddlFoundation.selectedIndex = 1;
	if (intFoundation)
	{
		for (var i=0; i<ddlFoundation.length; i++)
		{
			if (ddlFoundation.options[i].value == intFoundation)
			{
				ddlFoundation.selectedIndex = i;
				loadFunctions();
				break;
			}
		}

		// function
		ddlFunction.selectedIndex = 1;
		if (intFunction)
		{
			for (var i=0; i<ddlFunction.length; i++)
			{
				if (ddlFunction.options[i].value == intFunction)
				{
					ddlFunction.selectedIndex = i;
					break;
				}
			}
		}
	}
	else
	{
		disableDropDown(document.getElementById('RMFunction'));
	}
	
	
	// type
	switch (intType)
	{
		case 1:
			document.getElementById('RMType_1').checked = true;
			break;
		case 2:
			document.getElementById('RMType_2').checked = true;
			break;
		case 3:
			document.getElementById('RMType_3').checked = true;
			break;
		default:
			document.getElementById('RMType_3').checked = true;
			break;
	}
	
	// point scale
	switch (intPointScale)
	{
		case 1:
			document.getElementById('RMPointScale_1').checked = true;
			break;
		case 2:
			document.getElementById('RMPointScale_2').checked = true;
			break;
		default:
			document.getElementById('RMPointScale_1').checked = true;
			break;
	}
	
	// period
	switch (intPeriod)
	{
		case 1:
			document.getElementById('RMPeriod_1').checked = true;
			break;
		case 2:
			document.getElementById('RMPeriod_2').checked = true;
			break;
		default:
			document.getElementById('RMPeriod_1').checked = true;
			break;
	}
	
	// peer comparison
	switch (intPeer)
	{
		case 1:
			document.getElementById('RMPeer_1').checked = true;
			break;
		case 2:
			document.getElementById('RMPeer_2').checked = true;
			break;
		case 3:
			document.getElementById('RMPeer_3').checked = true;
			break;
		case 4:
			document.getElementById('RMPeer_4').checked = true;
			break;
		case 5:
			document.getElementById('RMPeer_5').checked = true;
			break;
		default:
			document.getElementById('RMPeer_1').checked = true;
			break;
	}
	
	// filter options
	enableFilterOptions();
}

function enableFilterOptions()
{
	var radFiltered = document.getElementById('RMPeer_4');
	var radGroup = document.getElementById('RMPeer_5');
	var ddlIndustry = document.getElementById('RMIndustry');
	var ddlSegment = document.getElementById('RMSegment');
	var ddlCompanySize = document.getElementById('RMCompanySize');
	var ddlGroup = document.getElementById('RMGroup');
	
	if (radFiltered.checked)
	{
		enableDropDown(ddlIndustry);
		enableDropDown(ddlSegment);
		enableDropDown(ddlCompanySize);
		
		disableDropDown(ddlGroup);
	}
	else if (radGroup.checked)
	{
		enableDropDown(ddlIndustry);
		enableDropDown(ddlSegment);
		enableDropDown(ddlCompanySize);
		enableDropDown(ddlGroup);
	}
	else
	{
		disableDropDown(ddlIndustry);
		disableDropDown(ddlSegment);
		disableDropDown(ddlCompanySize);
		disableDropDown(ddlGroup);
	}
	
	setType();
	checkFilterOptions();
	
	if (ddlIndustry.length < 2)
	{
		loadIndustries();
		loadSegments();
	}
}

function setType()
{
	var radBest = document.getElementById('RMPeer_1');
	var radTop = document.getElementById('RMPeer_2');
	var radAll = document.getElementById('RMPeer_3');
	var radFiltered = document.getElementById('RMPeer_4');
	var radGroup = document.getElementById('RMPeer_5');
	
	if (radBest.checked)
		intPeer = 1;
	else if (radTop.checked)
		intPeer = 2;
	else if (radAll.checked)
		intPeer = 3;
	else if (radFiltered.checked)
		intPeer = 4;
	else if (radGroup.checked)
		intPeer = 5;
	else
		intPeer = 1;
}

function checkFilterOptions()
{
	var radFiltered = document.getElementById('RMPeer_4');
	var radGroup = document.getElementById('RMPeer_5');
	
	if (!radFiltered.checked && !radGroup.checked)
	{
		intFilterIndustry = null;
		intFilterSegment = null;
		intFilterCompanySize = null;
		intFilterGroup = null;
		
		intRMIndustry = null;
		intRMSegment = null;
		intRMCompanySize = null;
		intRMGroup = null;
	}
	else if (radFiltered.checked)
	{
		intFilterGroup = null;
		
		intRMGroup = null;
	}
	else if (radGroup.checked)
	{
	}
}

function setRMIndustry()
{
	var ddl = document.getElementById('RMIndustry');
	
	if (ddl.selectedIndex > 0)
		intRMIndustry = ddl.options[ddl.selectedIndex].value;
}

function setRMSegment()
{
	var ddl = document.getElementById('RMSegment');
	
	if (ddl.selectedIndex > 0)
		intRMSegment = ddl.options[ddl.selectedIndex].value;
}

function setRMCompanySize()
{
	var ddl = document.getElementById('RMCompanySize');
	
	if (ddl.selectedIndex > 0)
		intRMCompanySize = ddl.options[ddl.selectedIndex].value;
}

function setRMGroup()
{
	var ddl = document.getElementById('RMGroup');
	
	if (ddl.selectedIndex > 0)
		intRMGroup = ddl.options[ddl.selectedIndex].value;
}

function enableConsortia()
{
	var chkAllConsortia = document.getElementById('consortium-all');
	for (var i=0; i<intConsortiaCount; i++)
	{
		if (chkAllConsortia.checked)
			document.getElementById('consortium-' + i).checked = true;
		else
			document.getElementById('consortium-' + i).checked = false;
	}
}

function showReportWindow(intLevel,intID,intReportType,blnFromOptions,blnReload)
{
	var strUrl = '/Survey/SAD/Generate_SAD_Report.asp';
	var blnAmp = false;
	
	if (blnReload)
	{
		strUrl += '?RMIndustry=' + intFilterIndustry + '&RMSegment=' + intFilterSegment + '&RMCompanySize=' + intFilterCompanySize + '&RMGroup=' + intFilterGroup;
		for (var i=0; i<intConsortiaCount; i++)
		{
			strUrl += '&Consortium-' + i + '=';
			
			if (arrFilterConsortium[i])
				strUrl += 't';
		}
	}
	else
	{
		strUrl += '?RMIndustry=' + intRMIndustry + '&RMSegment=' + intRMSegment + '&RMCompanySize=' + intRMCompanySize + '&RMGroup=' + intRMGroup;
		for (var i=0; i<intConsortiaCount; i++)
		{
			strUrl += '&Consortium-' + i + '=';
			
			if (arrRMConsortium[i])
				strUrl += 't';
		}
	}
	
	
	if (blnFromOptions)
	{
		strUrl += '&type=' + intPeer + '&redirect=Report_';
		switch (intPeer)
		{
			case 1: // Best
				// add nothing
				break;
			case 2: // Top
				strUrl += 'Top_';
				break;
			case 3: // All
				strUrl += 'All_';
				break;
			case 4: // Filtered
				strUrl += 'Filtered_';
				break;
			case 5: // Group
				strUrl += 'Group_';
				break;
			default:
				// add nothing
				break;
		}
	}
	else
	{
		strUrl += '&type=' + intReportType + '&redirect=Report_';
		switch (intReportType)
		{
			case 1: // Best
				// add nothing
				break;
			case 2: // Top
				strUrl += 'Top_';
				break;
			case 3: // All
				strUrl += 'All_';
				break;
			case 4: // Filtered
				strUrl += 'Filtered_';
				break;
			case 5: // Group
				strUrl += 'Group_';
				break;
			default:
				// add nothing
				break;
		}
	}
	
	switch (intLevel)
	{
		case 1:
			strUrl += 'Foundation';
			break;
		case 2:
			strUrl += 'Function';
			break;
		case 3:
			strUrl += 'Tactic';
			break;
		default:
			strUrl += 'Tactic';
			break;
	}
	strUrl += '_CurrentYear.asp?ID=' + intID;
	openWindow(strUrl, 'SAD_Report_' + intLevel, 'resizable=yes,menubar=yes,toolbar=yes,location=no,directories=no,scrollbars=1,width=800,height=600');
	//alert(strUrl);
	//openWindow(strUrl, 'SAD_Report_' + intLevel, 'resizable=yes,menubar=yes,toolbar=yes,location=yes,directories=yes,scrollbars=1,width=800,height=600');
}

function showDirectReportWindow(intLevel,intID,intReportType,blnFromOptions)
{
	var strUrl;
	
	
	if (blnFromOptions)
	{
		strUrl = '/Survey/SAD/Generate_SAD_Report.asp?type=' + intPeer + '&redirect=Report_';
		switch (intPeer)
		{
			case 1: // Best
				// add nothing
				break;
			case 2: // Top
				strUrl += 'Top_';
				break;
			case 3: // All
				strUrl += 'All_';
				break;
			case 4: // Filtered
				strUrl += 'Filtered_';
				break;
			case 5: // Group
				strUrl += 'Group_';
				break;
			default:
				// add nothing
				break;
		}
	}
	else
	{
		strUrl = 'Report_';
		switch (intReportType)
		{
			case 1: // Best
				// add nothing
				break;
			case 2: // Top
				strUrl += 'Top_';
				break;
			case 3: // All
				strUrl += 'All_';
				break;
			case 4: // Filtered
				strUrl += 'Filtered_';
				break;
			case 5: // Group
				strUrl += 'Group_';
				break;
			default:
				// add nothing
				break;
		}
	}
	
	switch (intLevel)
	{
		case 1:
			strUrl += 'Foundation';
			break;
		case 2:
			strUrl += 'Function';
			break;
		case 3:
			strUrl += 'Tactic';
			break;
		default:
			strUrl += 'Tactic';
			break;
	}
	strUrl += '_CurrentYear.asp?ID=' + intID;
	
	if (blnFromOptions)
	{
		for (var i=0; i<intConsortiaCount; i++)
		{
			strUrl += '&Consortium-' + i + '=';
			
			if (arrRMConsortium[i])
				strUrl += 't';
		}
	}
	else
	{
		for (var i=0; i<intConsortiaCount; i++)
		{
			strUrl += '&Consortium-' + i + '=';
			
			if (arrFilterConsortium[i])
				strUrl += 't';
		}
	}
	
	openWindow(strUrl, 'SAD_Report_' + intLevel, 'resizable=yes,menubar=yes,toolbar=yes,location=no,directories=no,scrollbars=1,width=800,height=600');
	//alert(strUrl);
	//openWindow(strUrl, 'SAD_Report_' + intLevel, 'resizable=yes,menubar=yes,toolbar=yes,location=yes,directories=yes,scrollbars=1,width=800,height=600');
}

function showMaintenanceWindow(intID,intType,blnInt)
{
	var strUrl;
	
	switch (intType)
	{
		case 1:
			break;
		case 2:
			strUrl = '/Survey/SAD/opp_scor_maintenance';
			break;
		case 3:
			strUrl = '/Survey/SAD/cap_scor_maintenance';
			break;
		default:
			break;
	}
	
	if (blnInt)
		strUrl += 'i';
	
	strUrl += '.asp?ID=' + intID
	openWindow(strUrl, 'SAD_Maintenance' + (blnInt ? '_i' : ''),'resizable=yes,menubar=no,toolbar=no,location=no,directories=no,scrollbars=1,width=' + (blnInt && (intType == 3) ? '1000' : '800') + ',height=600');
}

function showTopQuartileWindow(intID,intType)
{
	var strUrl = '/Survey/SAD/Top_Quartile_Companies.asp?Type=' + intType + '&ID=' + intID;
	
	openWindow(strUrl, 'SAD_TopQuartile','resizable=yes,menubar=yes,toolbar=yes,location=no,directories=no,scrollbars=1,width=800,height=600');
}

function showSurveyWindow(intID,intType)
{
	var strUrl = '/Survey/SAD/SAD_Load_Survey.asp?Type=' + intType + '&ID=' + intID;
	
	openWindow(strUrl, 'SAD_Survey','resizable=yes,menubar=yes,toolbar=yes,location=yes,directories=yes,scrollbars=2');
}

function loadFunctions()
{
	var ddlFoundation = document.getElementById('RMFoundation');
	var ddlFunction = document.getElementById('RMFunction');
	var blnFound = false;
	
	if (ddlFoundation.selectedIndex > 1)
	{
		// remove all the options in the drop down
		removeAllOptions(ddlFunction);
		
		// add the options for this foundation
		ddlFunction.options[0] = new Option('Please Select','');
		ddlFunction.options[1] = new Option('All','');
		var j=2;
		for (var i=0; i<intRMFunctionCount; i++)
		{
			if (arrRMFunctions[i][0] == parseInt(ddlFoundation.options[ddlFoundation.selectedIndex].value))
			{
				ddlFunction.options[j++] = new Option(arrRMFunctions[i][2],arrRMFunctions[i][1]);
				blnFound = true;
			}
		}
		
		if (blnFound)
			enableDropDown(ddlFunction);
	}
	else
	{
		disableDropDown(ddlFunction);
	}

}

function removeAllOptions(selectbox)
{
	var i;
	for(i=selectbox.options.length-1;i>=0;i--)
	{
		selectbox.remove(i);
	}
}

function generateReport()
{
	var ddlFoundation = document.getElementById('RMFoundation');
	var ddlFunction = document.getElementById('RMFunction');
	var ddlGroup = document.getElementById('RMGroup');
	var chkAllConsortia = document.getElementById('consortium-all');
	var blnConsortia = false;
	
	if (!chkAllConsortia.checked)
	{
		for (var i=0; i<intConsortiaCount; i++)
		{
			if (document.getElementById('consortium-' + i).checked)
			{
				blnConsortia = true;
				break;
			}
		}
	}
	else
		blnConsortia = true;
	
	if (blnConsortia)
	{
		if (ddlFunction.selectedIndex > 1) // Function report
		{
			showReportWindow(2,ddlFunction.options[ddlFunction.selectedIndex].value,null,true);
		}
		else if (ddlFoundation.selectedIndex > 1) // Foundation report
		{
			showReportWindow(1,ddlFoundation.options[ddlFoundation.selectedIndex].value,null,true);
		}
		else // All Foundation report
		{
			if (ddlGroup.value == '' && ddlGroup.selectedIndex != 0)
			{
				alert('Please select a valid group');
				ddlGroup.focus();
				return false;
			}
			else
				showReportWindow(1,null,null,true);
		}
	}
	else
	{
		alert('Please select at least one consortium to compare against.');
		return false;
	}

}

function loadFoundations()
{
	var ddlFoundation = document.getElementById('RMFoundation');

	// add the foundation options
	for (var i=0; i<intRMFoundationCount; i++)
		ddlFoundation.options[i+2] = new Option(arrRMFoundations[i][1],arrRMFoundations[i][0]);
	
	loadFunctions();
}

function updateConsortia(intID)
{
	
	arrRMConsortium[intID] = document.getElementById('consortium-' + intID).checked;
	
	var blnAllConsortia = true;
	for (var i=0; i<intConsortiaCount; i++)
	{
		if (!document.getElementById('consortium-' + i).checked)
		{
			blnAllConsortia = false;
			break;
		}
	}
	
	document.getElementById('consortium-all').checked = blnAllConsortia;
}

function setDisregard(intID,intType,blnDisregard,blnForced,blnAvailable)
{
	var strURL;
	var strParameters;
	
	strURL = '/Survey/SAD/SAD_Update_Disregard_Box.asp';
	
	strParameters = 'ID=' + intID + '&Type=' + intType;
	
	if (blnDisregard)
		strParameters += '&Disregard=true';
	
	if (blnForced)
		strParameters += '&Forced=true';
	
	if (blnAvailable)
		strParameters += '&Available=true';
	
	sendAJAXRequest(strURL,strParameters);
}

function updateTacticCache(intID,intType,strRedirect)
{
	var strURL;
	var strParameters;
	
	strURL = '/Survey/SAD/SAD_Update_Tactic_Cache.asp';
	
	strParameters = 'ID=' + intID + '&Type=' + intType;
	
	sendAJAXRequest(strURL,strParameters);

	location.href = strRedirect;
}

function updateItemCache(intItemID,strRedirect)
{
	var strURL;
	var strParameters;
	
	strURL = '/Survey/SAD/SAD_Update_Item_Cache.asp';
	
	strParameters = 'ID=' + intItemID;
	
	sendAJAXRequest(strURL,strParameters);

	//location.href = strRedirect;
}

function invalidateTacticCache(intTacticID,strRedirect)
{
	var strURL;
	var strParameters;
	
	strURL = '/Survey/SAD/SAD_Invalidate_Tactic_Cache.asp';
	
	strParameters = 'TID=' + intTacticID;
	
	sendAJAXRequest(strURL,strParameters);

	location.href = strRedirect;
}

function updateCompanyItemCache(intTopicID,intCompanyID,strRedirect)
{
	var strURL;
	var strParameters;
	
	strURL = '/Survey/SAD/SAD_Item_Company_Cache.asp';
	
	strParameters = 'TID=' + intTopicID + '&CID=' + intCompanyID;
	
	sendAJAXRequest(strURL,strParameters);

	//location.href = strURL + '?' + strParameters
	//location.href = strRedirect;
}

function checkDisregardBox(strID,intLevelID,intType,blnChecked,blnStarred,blnAvailable)
{
	var chk;
	var strUrlOn, strUrlOff;
	
	chk = document.getElementById(strID);
	
	strUrlOn = '/Survey/Images/checkbox_';
	
	if (blnChecked)
		strUrlOn += 'unchecked_';
	else
		strUrlOn += 'checked_b_';
		
	strUrlOff = strUrlOn;
	strUrlOn += 'on.gif';
	strUrlOff += 'off.gif';

	if (!blnStarred && !blnAvailable)
	{
		setDisregard(intLevelID,intType,!blnChecked,false,false,false); 
		chk.src = strUrlOn;
		
		// onmouseout
		if (navigator.appName.indexOf('Netscape') != -1)
			chk.setAttribute('onmouseout','setDisregardMouseOut(\'' + strID + '\',\'' + strUrlOff + '\');');
		else
			chk.onmouseout = Function('setDisregardMouseOut(\'' + strID + '\',\'' + strUrlOff + '\');');
			
		// onmouseover
		if (navigator.appName.indexOf('Netscape') != -1)
			chk.setAttribute('onmouseover','setDisregardMouseOver(\'' + strID + '\',\'' + strUrlOn + '\');');
		else
			chk.onmouseover = Function('setDisregardMouseOver(\'' + strID + '\',\'' + strUrlOn + '\');');
			
		// onclick
		if (navigator.appName.indexOf('Netscape') != -1)
			chk.setAttribute('onclick','checkDisregardBox(\'' + strID + '\',' + intLevelID + ',' + intType + ',' + !blnChecked + ',false);');
		else
			chk.onclick = Function('checkDisregardBox(\'' + strID + '\',' + intLevelID + ',' + intType + ',' + !blnChecked + ',false);');
	}
}

function setDisregardMouseOver(strID,url)
{
	var chk = document.getElementById(strID);
	chk.src = url;
}

function setDisregardMouseOut(strID,url)
{
	var chk = document.getElementById(strID);
	chk.src = url;
}

function loadIndustries()
{
	var ddl = document.getElementById('RMIndustry');
	
	//ddl.options[0] = new Option('Please Select','');
	for (var i=0; i<intIndustryCount; i++)
	{
		ddl.options[ddl.length] = new Option(arrIndustries[i][1],arrIndustries[i][0]);
		if (arrIndustries[i][0] == intRMIndustry)
			ddl.selectedIndex = i+1;
	}
}

function loadGroups()
{
	var ddl = document.getElementById('RMGroup');
	var blnPrivate = false;
	var blnPublic = false;
	
	for (var i=0; i<intGroupCount; i++)
	{
		if (arrGroups[i][2] && !blnPrivate)
		{
			ddl.options[ddl.length] = new Option(' ','');
			ddl.options[ddl.length] = new Option('--- Private Groups ---','');
			//ddl.options[ddl.length] = new Option(' ','');
			blnPrivate = true;
		}

		if (!arrGroups[i][2] && !blnPublic)
		{
			ddl.options[ddl.length] = new Option(' ','');
			ddl.options[ddl.length] = new Option('--- Public Groups ---','');
			//ddl.options[ddl.length] = new Option(' ','');
			blnPublic = true;
		}

		ddl.options[ddl.length] = new Option(arrGroups[i][1],arrGroups[i][0]);
		if (arrGroups[i][0] == intRMGroup)
			ddl.selectedIndex = i+1;
	}
	
}

function loadSegments()
{
	var ddl = document.getElementById('RMSegment');
	
	//ddl.options[0] = new Option('Please Select','');
	for (var i=0; i<intSegmentCount; i++)
	{
		ddl.options[ddl.length] = new Option(arrSegments[i][2],arrSegments[i][0]);
		if (arrSegments[i][0] == intRMSegment)
			ddl.selectedIndex = i+1;
	}
}

function loadConsortia()
{
	var blnAllConsortia = true;
	for (var i=0; i<intConsortiaCount; i++)
	{
		if (arrRMConsortium[i])
		{
			document.getElementById('consortium-' + i).checked = true;
		}
		else
		{
			document.getElementById('consortium-' + i).checked = false;
			blnAllConsortia = false;
		}
	}
	
	document.getElementById('consortium-all').checked = blnAllConsortia;
}

function exportExcel()
{
	var frm = document.getElementById('exportExcel');
	var txtName = document.getElementById('name');
	var txtCon = document.getElementById('con');
	
	txtName.value = document.title;
	txtCon.value = getReportHTML();
	frm.submit();
}

function getBodyHTML()
{
	return document.body.innerHTML;
}

function getReportHTML()
{
	var txtCon = document.getElementById('con');
	var strMatch1 = '<!-- Print Table -->';
	var strMatch2 = '<div id="PrintOptionPageBreakLabel"';
	var strMatch3 = '<TABLE class=PrintOnly id=PrintOptionTable';
	var strPage;
	var intStart, intEnd;
	
	txtCon.value = '';
	strPage = document.body.innerHTML;
	intStart = strPage.indexOf(strMatch1);
	intEnd = strPage.indexOf(strMatch2,intStart);
	
	if (intEnd == -1)
		intEnd = strPage.indexOf(strMatch3,intStart);
	
	return strPage.substring(intStart,intEnd);
}

function openScorecard(intID)
{
	openWindow('/Survey/Utilities/DisplayScorecard.asp?ID=' + intID, 'SC_Report_' + intID, 'resizable=yes,menubar=yes,toolbar=yes,location=no,directories=no,scrollbars=1,width=800,height=600');
}
//-->