function openPopupWindow(theURL, height, width) {
	if (height == undefined && width == undefined){ 
		var newWind = window.open(theURL,'popupwin','width=850,height=600,scrollbars=yes,resizable=no');
	} 
	else {
		var newWind = window.open(theURL,'popupwin','width="+width+",height="+height+",scrollbars=yes,resizable=yes,toolbar=no,menubar=no');
	}
}

function openPopupWindow2(theURL, height, width) {
	if (height == undefined && width == undefined){ 
		var newWind2 = window.open(theURL,'popupwin2','width=850,height=600,scrollbars=yes,resizable=no');
	} 
	else {
		var newWind2 = window.open(theURL,'popupwin2','width="+width+",height="+height+",scrollbars=yes,resizable=yes,toolbar=no,menubar=no');
	}
}

function revealanswer() {	
	var answerarray = getElementsByClass('answer');
	var arrayLength = answerarray.length;
	//alert ('arrayLength = ' + arrayLength);
	for (i = 0; i < arrayLength; i++) {
		answerarray[i].style.display = "inline";
	}
}

function hideanswer() {	
	var answerarray = getElementsByClass('answer');
	var arrayLength = answerarray.length;
	//alert ('arrayLength = ' + arrayLength);
	for (i = 0; i < arrayLength; i++) {
		answerarray[i].style.display = "none";
	}
}

function getElementsByClass(searchClass,node,tag) {
	var classElements = new Array();
	if ( node == null )
		node = document;
	if ( tag == null )
		tag = '*';
	var els = node.getElementsByTagName(tag);
	var elsLen = els.length;
	var pattern = new RegExp("(^|\\\\s)"+searchClass+"(\\\\s|$)");
	for (i = 0, j = 0; i < elsLen; i++) {
		if ( pattern.test(els[i].className) ) {
			classElements[j] = els[i];
			j++;
		}
	}
	return classElements;
}

function resetForm1() {
	uncheckAll(document.kc_form.checklist);
	uncheckAll(document.kc_form2.radiolist);
	hideanswer();
}

function resetForm2() {
	uncheckAll(document.kc_form.radiolist1);
	uncheckAll(document.kc_form.radiolist2);
	uncheckAll(document.kc_form.radiolist3);
	uncheckAll(document.kc_form.radiolist4);
	uncheckAll(document.kc_form.radiolist5);
	uncheckAll(document.kc_form.radiolist6);
	uncheckAll(document.kc_form2.radiolist7);
	hideanswer();
}

function uncheckAll(field)	{
	for (i = 0; i < field.length; i++)
	field[i].checked = false ;
}

