<!-- Begin
var win = null;
var mainWindow = null;
var lastMenuIndex;
var lastMenu;
// set the popup window width and height
var windowW=350 // wide
var windowH=350 // high
// set the screen position where the popup should appear
var windowX = 100 // from left
var windowY = 100 // from top
function openMsgPage(url)
{
  //alert(url);
  //alert("win:"+win+"  top:"+top);
  //window.location = url;
 var browser = navigator.appName;
 var undef = ""+win;
 if ( undef == "" ) win = null;
//alert("undef["+undef+"]");
  if ( ( win == null ) ){
//alert("null?");
	var top = window.screen.availHeight - 380;
	var left = window.screen.availWidth - 380;
var windowprops = "toolbar=0,titlebar=0,location=0,directories=0,status=0, " +
"top="+top+",left="+left+", " + "screenY="+top+",screenX="+left+", " +
"menubar=0,scrollbars=0,resizable=1,width=380,height=350, " +
"dependent=1,alwaysRaised=1";
  } else {
//alert("scr"+win.screen.availleft);
	var top = window.screenX;
	var left = win.left;
var windowprops = "toolbar=0,titlebar=0,location=0,directories=0,status=0, " +
"menubar=0,scrollbars=0,resizable=1,width=380,height=350, " +
"dependent=1,alwaysRaised=1";
  }
	win = window.open(url,"HELP",windowprops);
	//if (win != null) {
	//   window.close();
	//   win.focus();
	//}
	if ( win != null ) {
	   window.close();
	   win.focus();
	   //win.resizeTo(windowW,windowH)
	   //win.moveTo(windowX,windowY)
	   if (win.opener == null) win.opener = self;
   }
}
function updateHelp() {
	i = 2;   //bgcolor=#8ea3ad
	parent.helpmain.helpbuttons.document.images[0].src = "images/goal.gif";
	parent.helpmain.helpbuttons.document.images[1].src = "images/known.gif";
	parent.helpmain.helpbuttons.document.images[2].src = "images/tools.gif";
	parent.helpmain.helptext.document.open("text/html");
	parent.helpmain.helptext.document.writeln("<html><head><link rel='stylesheet' type='text/css' href='probsolv.css'></head>");
	parent.helpmain.helptext.document.writeln("<body bgcolor='#D3D8DD' text='#18527B' onResize='top.location.reload()'>");
	parent.helpmain.helptext.document.writeln("<hr noshade width='95%'><br>"+document.helpform2.showme.value);
	//document.writeln("<br><hr><br>"+showme);
	parent.helpmain.helptext.document.writeln("</body></html>");
	parent.helpmain.helptext.document.close();
}
function updateFeedback(response) {
	i = 3;   //bgcolor=#8ea3ad
	top.frames[i].document.open("text/html");
	top.frames[i].document.writeln("<html><head><link rel='stylesheet' type='text/css' href='probsolv.css'></head>");
	top.frames[i].document.writeln("<body bgcolor='#D3D8DD' text='#18527B' onResize='top.location.reload()'>");
	top.frames[i].document.writeln("<br><blockquote><span class='bluetextbold'>"+response+"</span></blockquote>");
	top.frames[i].document.writeln("</body></html>");
	top.frames[i].document.close();
}
function updateFeedback2(response) {
	i = 3;
	top.frames[i].document.open("text/html");
	top.frames[i].document.writeln("<html><body bgcolor='#92a6b2' text='#18527B'>");
	top.frames[i].document.writeln("<br><blockquote><b>"+response+"</b></blockquote>");
	top.frames[i].document.writeln("</body></html>");
	top.frames[i].document.close();
}
function log(page) //,u,time)
{
   //main = window.open(page + "?u=" + u + "&time=" + time);
   main = window.open("login/"+page);
   main.opener = self;
   main.focus();
}
function openwin(page,u,time)
{
   main = window.open(page + "?u=" + u + "&time=" + time);
   main.opener = self;
   main.focus();
}
function formHandler(menu) {
  if ( menu.selectedIndex == 0 ) {
	return false;
  } else {
	var msg = menu.options[menu.selectedIndex].value;
	//window.location.href = msg;
	//showHelp(msg);
	//alert("\r\nYou chose the item about:  " + msg + "\r\n");
	openMsgPage(msg);
	return true;
  }
}
function reset(menu) {
  menu.selectedIndex = 0;
}
function submitAnswer(pf,am) {
   document.ANS.correctAnswer.value = "54321";
   location = "probdesc2new.php?pf=pf&am=am";
}
function getAnswer() {
   return document.ANS.Answer.value;
}
function checkAnswer() {
}
function changeAnsName(ansMode) {
document.menustuff.common.selectedIndex = 2;
alert(document.ANS.SubmitAnswer.value);
alert(document.ANS.SubmitAnswer.name);
alert("comp:"+(document.ANS.SubmitAnswer.value=="Submit Answer"));
   if ( document.ANS.SubmitAnswer.value == "Submit Answer" ) {
	  document.ANS.answerMode.value = "Check Answer";
   } else {
	  document.ANS.answerMode.value = "Submit Answer";
   }
   location = "probdesc2new.php?pf=p107&am=Check+Answer";
}
function changeAnsName2(ansMode) {
document.menustuff.common.selectedIndex = 2;
alert(document.ANS.SubmitAnswer.value);
alert(document.ANS.SubmitAnswer.name);
alert("comp:"+(document.ANS.SubmitAnswer.value=="Submit Answer"));
   theForm = ansMode.form;
alert(theForm);
   submitButton = theForm.SubmitAnswer;
   if ( submitButton.value == "Submit Answer" ) {
	  document.ANS.SubmitAnswer.value = "Check Answer";
   } else {
	  document.ANS.SubmitAnswer.value = "Submit Answer";
   }
   //document.ANS.open();
   //document.ANS.write("<input type='button' name='CheckAnswer' value='Check Answer'>");
   //document.ANS.close();
   /*
   checkButton = theForm.CheckAnswer;
alert(checkButton.type);
   checkButton.type = submitButton.type;
alert(checkButton.type);
*/
   return document.ANS.SubmitAnswer.value;
}
function helpHandler_reset(menu) {
  //var menu = form[form.menuname.value];
  alert("form:"+form+"   menu:"+menu+"   index:"+menu.selectedIndex);
  if ( menu.selectedIndex == 0 ) {
  alert ("1");
	return false;
  } else {
	var n = menu.options[menu.selectedIndex].value;
	if ( n != "" ) {
	alert ("2");
	   var url = ("help_" + n + ".php?fn=" + form.pf.value);
	   openMsgPage(url);
	   menu.selectedIndex = 0;
	   return true;
	} else {
	alert ("3");
	   return false;
	}
  }
}
function helpHandler(form) {
  var menu = form[form.menuname.value];
  //alert("form:"+form+"   menu:"+menu);
  if ( menu.selectedIndex == 0 ) {
	//alert ("0");
	return false;
  } else if ( ( lastMenu == menu ) && ( lastMenuIndex == menu.selectedIndex ) ){
	//alert("win:"+win.open+"  menu:"+lastMenu+"  index:"+lastMenuIndex);
	//alert ("1  win:["+win.open+"]");
	if ( win.open ) {
	  //alert ("2");
	  win.focus();
	  return true;
	} else {
	  //alert ("3");
	  openHelpWin(form);
	  return true;
	}
  } else {
	//alert ("4");
	openHelpWin(form);
	return true;
  }
}
function openHelpWin (form) {
  var menu = form[form.menuname.value];
	var n = menu.options[menu.selectedIndex].value;
	if ( n != "" ) {
	   var url = ("help_" + n + ".php?fn=" + form.pf.value);
	   openMsgPage(url);
	   lastMenu = menu;
	   lastMenuIndex = menu.selectedIndex;
	   return true;
	} else {
	   return false;
	}
}
function showHelpBlank()
{
var windowprops = "toolbar=0,titlebar=0,location=0,directories=0,status=0, " +
"menubar=0,scrollbars=0,resizable=1,width=350,height=350, " +
"dependent=1,alwaysRaised=1";
  win = window.open("","HELP",windowprops);
  if ( win != null ) {
	win.focus();
	win.document.write ("<HTML><HEAD><TITLE>HELP</TITLE></HEAD>");
	win.document.write ("<BODY BGCOLOR='#005587'>");
	win.document.write ("&nbsp;");
	win.document.write ("</BODY></HTML>");
	win.document.close();
  }
}
function showHelp(msg)
{
var windowprops = "toolbar=0,titlebar=0,location=0,directories=0,status=0, " +
"menubar=0,scrollbars=0,resizable=1,width=350,height=350, " +
"dependent=1,alwaysRaised=1";
  win = window.open("","HELP",windowprops);
  if ( win != null ) {
	win.document.open('text/html');
	win.document.write ("<HTML><HEAD><TITLE>HELP</TITLE></HEAD>");
	win.document.write ("<BODY BGCOLOR='#005587' LINK='#CCCC99' VLINK='#CCCC99' ALINK='#CCCC99'>");
	win.document.write ("<CENTER><TABLE width='280' height='230' border='0'>");
	win.document.write ("<TR valign='top' align='left'><TD>");
	win.document.write ("<FONT FACE='Verdana,Arial,Helvetica' COLOR='#CCCC99'><B>"+msg+"</B></FONT>");
	win.document.write ("</TD></TR>");
	//win.document.write ("<TR valign='bottom' align='right'><TD>");
	//win.document.write ("<A HREF='JavaScript:this.close()'>Close</A><BR></FONT></TD></TR>");
	win.document.write ("</TABLE></CENTER>");
	win.document.write ("</BODY></HTML>");
	win.document.close();
	win.focus();
  }
}
function showHelpPict(pictfile)
{
var windowprops = "toolbar=0,titlebar=0,location=0,directories=0,status=0, " +
"menubar=0,scrollbars=0,resizable=0,width=350,height=350";
  win = window.open("","HELP",windowprops);
  if ( win != null ) {
	win.focus();
	win.document.open('text/html');
	win.document.write ("<HTML><HEAD><TITLE>GRAPHIC_LAYOUT</TITLE></HEAD>");
	win.document.write ("<BODY BGCOLOR='#ffffff' LINK='#18527B' VLINK='#18527B' ALINK='#18527B'>");
	win.document.write ("<CENTER><TABLE border='0' height='300'>");
	win.document.write ("<TR valign='center' align='middle'><TD>");
	//win.document.write ("<IMG SRC='problemdatafiles/"+pictfile+"'>");
	win.document.write ("<IMG SRC='problemdatafiles/p103.desc.gif'>");
	win.document.write ("</TD></TR><TR valign='bottom' align='right'><TD>");
	win.document.write ("<A HREF='JavaScript:this.close()'>Close</A><BR></FONT></TD></TR>");
	win.document.write ("</TABLE></CENTER>");
	win.document.write ("</BODY></HTML>");
	win.document.close();
  }
}
function clearHelp()
{
  if ( win != null ) {
	win.document.open('text/html');
	win.document.write ("<HTML><HEAD><TITLE></TITLE></HEAD>");
	win.document.write ("<BODY BGCOLOR='#18527B' LINK='#CCCC99' VLINK='#CCCC99' ALINK='#CCCC99'>");
	win.document.write ("<CENTER><TABLE height='300' border='0'>");
	win.document.write ("<TR valign='top' align='left'><TD>");
	win.document.write ("<FONT FACE='Verdana,Arial,Helvetica' COLOR='#CCCC99'>...waiting...</FONT>");
	win.document.write ("</TD></TR><TR valign='bottom' align='right'><TD>");
	win.document.write ("<A HREF='JavaScript:this.close()'>Close</A><BR></FONT></TD></TR>");
	win.document.write ("</TABLE></CENTER>");
	win.document.write ("</BODY></HTML>");
	win.document.close();
  }
}
function closeHelp()
{
	if (win != null && win.open) win.close();
}
function getBrowser() {
  var bName = navigator.appName;
  var bVer = parseFloat(navigator.appVersion);
  return bName;
}
// End -->
