// JavaScript Document


var newWin = null;
var newGWin = null;
function popGWindow(url) {
	var xPos, yPos;

	winFeatures='height=480,width=640,menubar=no,resizable=yes,scrollbars=yes,toolbar=no';
	xPos = 50; yPos = 50;
	
	newGWin=window.open(url, 'Glossary', winFeatures);
	newGWin.moveTo(xPos, yPos);
	newGWin.focus();
}
function popWindow(url,windowname) {
	var xPos, yPos;

	winFeatures='height=600,width=800,menubar=no,resizable=yes,scrollbars=yes,toolbar=no';
	xPos = 50; yPos = 50;
	
	newWin=window.open(url, windowname, winFeatures);
	newWin.moveTo(xPos, yPos);
	newWin.focus();
}
function popStoryWindow(url,windowname) {
	var xPos, yPos;

	winFeatures='height=502,width=600,menubar=no,resizable=yes,scrollbars=no,toolbar=no';
	xPos = 50; yPos = 50;
	
	newWin=window.open(url, windowname, winFeatures);
	newWin.moveTo(xPos, yPos);
	newWin.focus();
}
function popDDWindow(url,windowname) {
	var xPos, yPos;

	winFeatures='height=402,width=600,menubar=no,resizable=yes,scrollbars=no,toolbar=no';
	xPos = 50; yPos = 50;
	
	newWin=window.open(url, windowname, winFeatures);
	newWin.moveTo(xPos, yPos);
	newWin.focus();
}

function displayFeedback(who){
	
	theform = who.parentNode.name;
	thenum = theform.charAt(4);
	numresponses = document.forms[theform]["radiobutton"+thenum].length;
	thevalue = 'noresponse';
	for (i=0;i<numresponses;i++){
		if (document.forms[theform]["radiobutton"+thenum][i].checked){
			thevalue = document.forms[theform]["radiobutton"+thenum][i].value;		
		}
	}
	
	if(thevalue == 'a'){
		return "panel"+thenum+"1";
	}
	if(thevalue == 'b'){
		return "panel"+thenum+"2";
	}
	if(thevalue == 'c'){
		return "panel"+thenum+"3";
	}
	if(thevalue == 'd'){
		return "panel"+thenum+"4";
	}
	if(thevalue == 'e'){
		return "panel"+thenum+"5";
	}
	if(thevalue == 'f'){
		return "panel"+thenum+"6";
	}
	if(thevalue == 'g'){
		return "panel"+thenum+"7";
	}
	if(thevalue == 'h'){
		return "panel"+thenum+"8";
	}
	if(thevalue == 'j'){
		return "panel"+thenum+"9";
	}
	
	if(thevalue == 'noresponse'){
		alert("Please answer the question.");
		return;
	}
	
}



function displayCBFeedback(who){
	
	theform = who.parentNode.name;
	thenum = theform.charAt(4);
	var theArray = new Array();
	numresponses = document.forms[theform].length;
	for (i=0;i<numresponses;i++){
		if (document.forms[theform][i].type == 'checkbox'){
			theelement = escape('panel'+thenum+(i+1));
			
			elup = 'panel'+thenum+(i+1)+'-body';
			
			new Effect.SlideUp(elup, {duration:0});
			Element.removeClassName(elup,'visible');
    		Element.addClassName(elup,'invisible');

			if (document.forms[theform][i].checked){
				theArray.push(document.forms[theform][i].value);
			}
		}
	}

	if (theArray.length >0){
		for (j=0;j<theArray.length;j++){
			if (theArray[j] == 'a'){
				accordionNew(who,'panel'+thenum+'1');
			}
			if (theArray[j] == 'b'){
				accordionNew(who,'panel'+thenum+'2');
			}
			if (theArray[j] == 'c'){
				accordionNew(who,'panel'+thenum+'3');
			}
			if (theArray[j] == 'd'){
				accordionNew(who,'panel'+thenum+'4');
			}
			if (theArray[j] == 'e'){
				accordionNew(who,'panel'+thenum+'5');
			}
			if (theArray[j] == 'f'){
				accordionNew(who,'panel'+thenum+'6');
			}
			if (theArray[j] == 'g'){
				accordionNew(who,'panel'+thenum+'7');
			}
			if (theArray[j] == 'h'){
				accordionNew(who,'panel'+thenum+'8');
			}
			if (theArray[j] == 'i'){
				accordionNew(who,'panel'+thenum+'9');
			}
		}
		
	} else {
		alert("Please answer the question.");	
		return;
	}
	
	
}

