// JavaScript Document

function insertIt0() 
{ 
	var _y = document.getElementById('frame0'); 
	var _x = window.frames[0].document.body.innerHTML; 
	_y.innerHTML = _x;
} 

function insertIt1() 
{ 
	var _y = document.getElementById('frame1'); 
	var _x = window.frames[0].document.body.innerHTML; 
	_y.innerHTML = _x;
} 

function switch_page() {
  if (document.form_2.site.selectedIndex == 0) location =   'help_index.php';
  else if (document.form_2.site.selectedIndex == 1) location = 'help_topic1.php';
  else if (document.form_2.site.selectedIndex == 2) location = 'help_topic2.php';
  else if (document.form_2.site.selectedIndex == 3) location = 'help_topic3.php';
  else if (document.form_2.site.selectedIndex == 4) location = 'help_topic4.php';
	else if (document.form_2.site.selectedIndex == 5) location = 'help_topic5.php';
}

function anchorHandler(anchor_index) {
var anchors = new Array() // extremely simple two dem array even index = subject, odd = URL
  anchors[0]="help"
  anchors[1]="help_index.php"
  anchors[2]="about"
  anchors[3]="vision.php"
  anchors[4]="glossary"
  anchors[5]="glossary.php"
	if (anchor_index.length > 7) {
			if (anchor_index.slice(0,8) == "glossary") {
			str = anchor_index.slice(0,8)
			} else {
			str = anchor_index 
			}
	} else {
			str = anchor_index 
	}
for (var i = 0; i < anchors.length; i++) {

	if (anchors[i] == str) {
		var prog , name;
		prog = anchors[i + 1];
		name = anchors[i];
			if (anchors[i] == "help" || anchors[i] == "glossary") {
				if (anchors[i] == "glossary") {
					pattern = /#/
nameList = anchor_index .split (pattern);
var xx = "#" + nameList[1];
prog = "glossary.php" + xx;
					
				}
				popUp(prog, name, 500, 500, 0, 1)
		//		if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
			} else {
				location = prog;
			}
}
}
}

function popUp(page, name, w, h, scroll) { 
	name = "foo";
	page = page.split(" ").join("%20");
	var winl = (screen.width - w) / 2;
	var wint = (screen.height - h) / 2;
	//var resizable = false;
	if ((navigator.appName).indexOf("Microsoft")!=-1) { 
		winprop  = 'height=500,width=528,top='+wint+',left='+winl+',scrollbars='+scroll+',resizable=no'; 
	} 
	else { 
		winprop  = 'height=500,width=529,top='+wint+',left='+winl+',scrollbars='+scroll+',resizable=no'; 
	}
	win = window.open(page, name, winprop);
	if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
 }

function ShowTab(n) {
	var menu, tabStyleLeft, tabStyleMid, tabStyleRight;
	
	// Hide all layers first.
	var divs = document.getElementsByTagName("div");
		 
	for (var i = 0; i < divs.length; i++)
		if (divs[i].id.indexOf("qContent") >= 0)
				divs[i].style.display = 'none';
	 
	// Reset the images.
	for (var j = 0; j < document.images.length; j++)
		if (document.images[j].src.indexOf("comp_tabon_lt") > 0)
				document.images[j].src = "images/survey/comp_taboff_lt.gif";
	for (var k = 0; k < document.images.length; k++)
		if (document.images[k].src.indexOf("comp_tabon_rt") > 0)
				document.images[k].src = "images/survey/comp_taboff_rt.gif";
	for (var l = 0; l < divs.length; l++)
		if (divs[l].id.indexOf("qTabMid") >= 0)
				divs[l].className = 'tabNotSelected';
		 
	// Show the menus and update their twisty images.
	menu = document.getElementById("qContent" + n);
	tabStyleMid = document.getElementById("qTabMid" + n);
	tabStyleLeft = document.images["l" + n];
	tabStyleRight = document.images['r' + n];
	menu.style.display = "block";
	menu.style.display = "";
	tabStyleLeft.src = "images/survey/comp_tabon_lt.gif";
	tabStyleRight.src = "images/survey/comp_tabon_rt.gif";
	tabStyleMid.className = 'tabSelected';

}

//	Used for updating the domain location selected and the 
//	component location selected when the user clicks a domain tab.
function setLocation(val)
{
	document.Survey.currentDomain.value=document.Survey.domainSelected.value;
    document.Survey.domainSelected.value=val;
	document.Survey.componentSelected.value=1;
    document.Survey.submit();
}

//	Used for updating the component location selected when the user
//	click next or a number in the number nav.
function selectComponent(val)
{
    document.Survey.componentSelected.value=val;
    document.Survey.submit();
}

//	Used for placing links in the pages to allow the user to go to a
//	specific domain and location.
function goToComponent(domainLocation,componentLocation)
{
	document.Survey.domainSelected.value = domainLocation;
	document.Survey.componentSelected.value = componentLocation;
    document.Survey.submit();
}

//	This function takes a domain and a component in a string 'dc'
//	delimited by a comma.  Then sets the hidden fields then does a submit
function goToComponent2(dc)
{
    var domainComponent = new String();
	var dc_array = new Array();
	
	domainComponent = dc;
    dc_array = dc.split(",");
	document.Survey.domainSelected.value = dc_array[0];
	document.Survey.componentSelected.value = dc_array[1];
    document.Survey.submit();
}

function SaveConfirm()
{
	document.Survey.saveAndExit.value = 1;
	document.Survey.submit();
}

function checkRememberID()
{
    if (document.auth.rememberID)
        document.auth.rememberID.value = "true";
    else
        document.auth.rememberID.value = "false";
}

function search_cases()
{
		document.case_frame.submit();
}