// (c) Link-Systems International, Inc. (1999)
var butld=false;var curr_ytstep=0;var stepanswerlist=new Array();var check_off=new Image();check_off.src="gifs/buttons/check1.gif";var check_on=new Image();check_on.src="gifs/buttons/check2.gif";var tryanother_off=new Image();tryanother_off.src="gifs/buttons/tryanother1.gif";var tryanother_on=new Image();tryanother_on.src="gifs/buttons/tryanother2.gif";
var curr_check_off=new Image();curr_check_off.src="gifs/buttons/check1.gif";var curr_check_on=new Image();curr_check_on.src="gifs/buttons/check2.gif";var bookmarked=new Image();bookmarked.src="gifs/header/paperclip.gif";var unbookmarked=new Image();unbookmarked.src="gifs/header/trans.gif";
var book_off=new Image();book_off.src="gifs/buttons/book1.gif";var book_on=new Image();book_on.src="gifs/buttons/book2.gif";var unbook_off=new Image();unbook_off.src="gifs/buttons/unbook1.gif";var unbook_on=new Image();unbook_on.src="gifs/buttons/unbook2.gif";
var currbook_off=new Image();currbook_off.src="gifs/buttons/book1.gif";var currbook_on=new Image();currbook_on.src="gifs/buttons/book2.gif";var viewbms_off=new Image();viewbms_off.src="gifs/buttons/viewbms1.gif";var viewbms_on=new Image();viewbms_on.src="gifs/buttons/viewbms2.gif";
var exitviewbms_off=new Image();exitviewbms_off.src="gifs/buttons/exitviewbms1.gif";var exitviewbms_on=new Image();exitviewbms_on.src="gifs/buttons/exitviewbms2.gif";var selftest_off=new Image();selftest_off.src="gifs/buttons/selftest1.gif";var selftest_on=new Image();selftest_on.src="gifs/buttons/selftest2.gif";
var exitselftest_off=new Image();exitselftest_off.src="gifs/buttons/exitselftest1.gif";var exitselftest_on=new Image();exitselftest_on.src="gifs/buttons/exitselftest2.gif";var currselftest_off=new Image();currselftest_off.src="gifs/buttons/selftest1.gif";var currselftest_on=new Image();currselftest_on.src="gifs/buttons/selftest2.gif";
var calc_off=new Image();calc_off.src="gifs/buttons/calc1.gif";var calc_on=new Image();calc_on.src="gifs/buttons/calc2.gif";var chapter_off=new Image();chapter_off.src="gifs/buttons/chapter1.gif";var chapter_on=new Image();chapter_on.src="gifs/buttons/chapter2.gif";
var final_off=new Image();final_off.src="gifs/buttons/final1.gif";var final_on=new Image();final_on.src="gifs/buttons/final2.gif";var help_off=new Image();help_off.src="gifs/buttons/help1.gif";var help_on=new Image();help_on.src="gifs/buttons/help2.gif";var hint_off=new Image();hint_off.src="gifs/buttons/hint1.gif";var hint_on=new Image();hint_on.src="gifs/buttons/hint2.gif";
var next_off=new Image();next_off.src="gifs/buttons/next1.gif";var next_on=new Image();next_on.src="gifs/buttons/next2.gif";var prev_off=new Image();prev_off.src="gifs/buttons/prev1.gif";var prev_on=new Image();prev_on.src="gifs/buttons/prev2.gif";var print_off=new Image();print_off.src="gifs/buttons/print1.gif";var print_on=new Image();print_on.src="gifs/buttons/print2.gif";
var report_off=new Image();report_off.src="gifs/buttons/report1.gif";var report_on=new Image();report_on.src="gifs/buttons/report2.gif";var section_off=new Image();section_off.src="gifs/buttons/section1.gif";var section_on=new Image();section_on.src="gifs/buttons/section2.gif";
var showme_off=new Image();showme_off.src="gifs/buttons/showme1.gif";var showme_on=new Image();showme_on.src="gifs/buttons/showme2.gif";var soundon_off=new Image();soundon_off.src="gifs/buttons/soundon1.gif";var soundon_on=new Image();soundon_on.src="gifs/buttons/soundon2.gif";
var soundoff_off=new Image();soundoff_off.src="gifs/buttons/soundoff1.gif";var soundoff_on=new Image();soundoff_on.src="gifs/buttons/soundoff2.gif";var currsound_off=new Image();currsound_off.src="gifs/buttons/soundoff1.gif";var currsound_on=new Image();currsound_on.src="gifs/buttons/soundoff2.gif";
var tables_off=new Image();tables_off.src="gifs/buttons/tables1.gif";var tables_on=new Image();tables_on.src="gifs/buttons/tables2.gif";var video_off=new Image();video_off.src="gifs/buttons/video1.gif";var video_on=new Image();video_on.src="gifs/buttons/video2.gif";
var yourturn_off=new Image();yourturn_off.src="gifs/buttons/yourturn1.gif";var yourturn_on=new Image();yourturn_on.src="gifs/buttons/yourturn2.gif";function display_buttons(button_list,screen,orientation,where)
{var buttonarr=new Array();var buttonhtml;var bfront,btail;var startset="";var endset="";var sbuttonwidth=119;var butwid,linkurl;if(standalone){button_list=button_list.replace(/section/,"");button_list=button_list.replace(/chapter/,"");button_list=button_list.replace(/final/,"");}
button_list=button_list.replace(/\s+/," ");button_list=button_list.replace(/^\s+/,"");button_list=button_list.replace(/\s$/,"");buttonarr=button_list.split(" ");if(orientation.toLowerCase()=="vertical"){butwid="width="+sbuttonwidth;linkurl="";bfront="<tr>"+"<td bgcolor='#ff9900' width=5>"+"<img src='gifs/blank.gif' width=5 border=0'><\/td>"+"<td valign=top "+butwid+" align=left nowrap bgcolor='#ffffff'>";btail="<\/td><\/tr>";if(where=="separate")
startset+="<body bgcolor="+botbgndclr+" marginheight=0 marginwidth=0 "+"topmargin=0 leftmargin=0 rightmargin=0>"+nl;startset+="<table width=100% border=0 cellpadding=0 cellspacing=0>";endset="<tr><td colspan=2>"+"<img src='gifs/header/curve_ltblue.gif' width=124><\/td><\/tr><\/table>";}else{butwid="";linkurl=" ";bfront="<td valign=top align=center bgcolor='#ffffff'>";btail="<\/td>";if(where=="separate")
startset+="<body bgcolor="+botbgndclr+" marginheight=0 marginwidth=0 "+"topmargin=0 leftmargin=0 rightmargin=0>"+nl;startset+="<center>"+"<table border=0 cellpadding=0 cellspacing=0>"+"<tr><td align=center>"+"<table border=0 cellpadding=0 cellspacing=3><tr>";endset="<\/tr><\/table><\/td><\/tr><\/table><\/center>";}
buttonshtml="";for(i=0;i<buttonarr.length;i++){switch(buttonarr[i]){case"prev":buttonshtml+=bfront+
"<a href='javascript:void(parent.close_popups(false));"+"parent.prev();' "+"title='View the Previous Problem' "+"onMouseOver='window.status=\"View the Previous Problem\";"+"document.prevB.src=parent.prev_on.src;return true;' "+"onMouseOut='window.status=\"\";"+"document.prevB.src=parent.prev_off.src;return true;'>"+"<img src='gifs/buttons/prev1.gif' alt='View the Previous Problem' "+butwid+" name='prevB' border=0>"+"<\/a>"+btail;break;
case"next":buttonshtml+=bfront+
"<a href='javascript:void(parent.close_popups(false));"+"parent.next();' "+"title='View the Next Problem' "+"onMouseOver='window.status=\"View the Next Problem\";"+"document.nextB.src=parent.next_on.src;return true;' "+"onMouseOut='window.status=\"\";"+"document.nextB.src=parent.next_off.src;return true;'>"+"<img src='gifs/buttons/next1.gif' alt='View the Next Problem' "+butwid+" name='nextB' border=0>"+"<\/a>"+btail;break;
case"calc":buttonshtml+=bfront+
"<a href='javascript:void(parent.show_calc());'"+"onMouseOver='window.status=\"NetCalculatorTM\";"+"document.calcB.src=parent.calc_on.src;return true;' "+"onMouseOut='window.status=\"\";"+"document.calcB.src=parent.calc_off.src;return true;'>"+"<img src='gifs/buttons/calc1.gif' alt='NetCalculatorTM' "+butwid+" name='calcB' border=0><\/a>"+btail;break;
case"tables":buttonshtml+=bfront+
"<a href='javascript:void(parent.show_tables());'"+"onMouseOver='window.status=\"Tables\";"+"document.tablesB.src=parent.tables_on.src;return true;' "+"onMouseOut='window.status=\"\";"+"document.tablesB.src=parent.tables_off.src;return true;'>"+"<img src='gifs/buttons/tables1.gif' alt='Tables' "+butwid+" name='tablesB' border=0><\/a>"+btail;break;
case"help":buttonshtml+=bfront+
"<a href='javascript:void(parent.close_popups(false));void(parent.show_help(\""+screen+"\"));' "+"onMouseOver='window.status=\""+screen+" Help\";"+"document.helpB.src=parent.help_on.src;return true;' "+"onMouseOut='window.status=\"\";"+"document.helpB.src=parent.help_off.src;return true;'>"+"<img src='gifs/buttons/help1.gif' alt='"+screen+" Help' "+butwid+" name='helpB' border=0><\/a>"+btail;break;
case"hint":buttonshtml+=bfront+
"<a href='javascript:void(parent.close_popups(false));void(parent.loadmsg(\"hint(\"+parent.curr_instance+\")\"));' "+"onMouseOver='window.status=\"Hint\";"+"document.hintB.src=parent.hint_on.src;return true;' "+"onMouseOut='window.status=\"\";"+"document.hintB.src=parent.hint_off.src;return true;'>"+"<img src='gifs/buttons/hint1.gif' alt='Give Me a Hint' "+butwid+" name='hintB' border=0><\/a>"+btail;break;
case"showme":buttonshtml+=bfront+
"<a href='javascript:void(parent.close_popups(false));void(parent.loadmsg(\"showme_solution(\"+parent.curr_instance+\",\\\"showme\\\")\"));' "+"title='Show Me the Solution' "+"onMouseOver='window.status=\"Show Me\";"+"document.showmeB.src=parent.showme_on.src;return true;' "+"onMouseOut='window.status=\"\";"+"document.showmeB.src=parent.showme_off.src;return true;'>"+"<img src='gifs/buttons/showme1.gif' alt='Show Me the Solution' "+butwid+" name='showmeB' border=0><\/a>"+btail;break;
case"report":buttonshtml+=bfront+
"<a href='javascript:void(parent.close_popups(false));void(parent.get_progree_report());' "+"title='Progress Report' "+"onMouseOver='window.status=\"Progress Report\";"+"document.reportB.src=parent.report_on.src;return true;' "+"onMouseOut='window.status=\"\";"+"document.reportB.src=parent.report_off.src;return true;'>"+"<img src='gifs/buttons/report1.gif' alt='Progress Report' "+butwid+" name='reportB' border=0><\/a>"+btail;break;
case"selftest":var currbut,currstat;if(parent.selftestview){currselftest_on.src=exitselftest_on.src;currselftest_off.src=exitselftest_off.src;currbut=exitselftest_off.src;currstat="Exit Self-Test";}else{currselftest_on.src=selftest_on.src;currselftest_off.src=selftest_off.src;currbut=selftest_off.src;currstat="Self-Test";}buttonshtml+=bfront+
"<a href='javascript:void(parent.close_popups(false));void(parent.selftesttoggle());' "+"title='Self Test' "+"onMouseOver='window.status=\"Self Test\";"+"document.selftestB.src=parent.currselftest_on.src;return true;' "+"onMouseOut='window.status=\"\";"+"document.selftestB.src=parent.currselftest_off.src;return true;'>"+"<img src='"+currbut+"' alt='Self Test' "+butwid+" name='selftestB' border=0><\/a>"+btail;break;
case"yourturn":buttonshtml+=bfront+
"<a href='javascript:void(parent.close_popups(false));void(parent.loadmsg(\"n2(\"+parent.curr_instance+\")\"));' "+
"title='Step by Step' "+"onMouseOver='window.status=\"Step by Step\";"+"document.yourturnB.src=parent.yourturn_on.src;return true;' "+"onMouseOut='window.status=\"\";"+"document.yourturnB.src=parent.yourturn_off.src;return true;'>"+"<img "+butwid+" name='yourturnB' src='gifs/buttons/yourturn1.gif' alt='Step by Step' "+"border=0><\/a>"+btail;break;
case"final":buttonshtml+=bfront+
"<a href='javascript:void(parent.close_popups(false));void(parent.mktest(0,0,\"T-FIN\"));void(parent.n71(parent.template_list.template_files[0]));' "+"onMouseOver='window.status=\"Final Exam\";"+"document.finalB.src=parent.final_on.src;return true;' "+"onMouseOut='window.status=\"\";"+"document.finalB.src=parent.final_off.src;return true;'>"+"<img src='gifs/buttons/final1.gif' alt='Final Exam' "+butwid+" name='finalB' "+"border=0><\/a>"+btail;break;
case"chapter":buttonshtml+=bfront+
"<a href='javascript:"+"void(parent.mkchapmenu(false));' "+"onMouseOver='window.status=\"Chapter List\";"+"document.mainB.src=parent.chapter_on.src;return true;' "+"onMouseOut='window.status=\"\";"+"document.mainB.src=parent.chapter_off.src;return true;' "+"onClick='parent.close_popups(false);'>"+"<img src='gifs/buttons/chapter1.gif' alt='Chapter Index' "+butwid+" name='mainB' "+"border=0><\/a>"+btail;break;
case"section":buttonshtml+=bfront+
"<a href='javascript:void(parent.close_popups(true));void(parent.Sec_disp());' "+"onMouseOver='window.status=\"Section List\";"+"document.sectionB.src=parent.section_on.src;return true;' "+"onMouseOut='window.status=\"\";"+"document.sectionB.src=parent.section_off.src;return true;'>"+"<img src='gifs/buttons/section1.gif' alt='Change Section' "+butwid+" name='sectionB' border=0><\/a>"+btail;break;
case"sound":var currbut,currstat;if(parent.sound){currsound_on.src=soundoff_on.src;currsound_off.src=soundoff_off.src;currbut=soundoff_off.src;currstat="Turn Sound Off";}else{currsound_on.src=soundon_on.src;currsound_off.src=soundon_off.src;currbut=soundon_off.src;currstat="Turn Sound On";}buttonshtml+=bfront+
"<a href='javascript:void(parent.n27());' "+"onMouseOver='window.status=\""+currstat+"\";"+"document.soundB.src=parent.currsound_on.src;return true;' "+"onMouseOut='window.status=\"\";"+"document.soundB.src=parent.currsound_off.src;return true;'>"+"<img src='"+currbut+"' alt='Toggle Sound' "+butwid+" name='soundB' border=0><\/a>"+btail;break;
case"audio":buttonshtml+=bfront+
btail;break;case"video":buttonshtml+=bfront+
btail;break;case"bookmark":case"unbookmark":var currbut,currstat;if(test.questions[curr_instance].bookmarked){currbook_on.src=unbook_on.src;currbook_off.src=unbook_off.src;currbut=unbook_off.src;currstat="Unbookmark";}else{currbook_on.src=book_on.src;currbook_off.src=book_off.src;currbut=book_off.src;currstat="Bookmark";}buttonshtml+=bfront+
"<a href='javascript:void(parent.n146());' "+"onMouseOver='window.status=\""+currstat+" This Problem\";"+"document.bookB.src=parent.currbook_on.src;return true;' "+"onMouseOut='window.status=\"\";"+"document.bookB.src=parent.currbook_off.src;return true;' >"+"<img src='"+currbut+"' "+butwid+" name='bookB' alt='"+currstat+" This Problem' border='0'></a>"+btail;break;
case"enterviewbookmarks":buttonshtml+=bfront+
"<a href='javascript:void(parent.close_popups(false));void(parent.n103());' "+"onMouseOver='window.status=\"View Bookmarked Problems\";"+"document.bookBV.src=parent.viewbms_on.src;return true;' "+"onMouseOut='window.status=\"\";"+"document.bookBV.src=parent.viewbms_off.src;return true;' >"+"<img src='gifs/buttons/viewbms1.gif' "+butwid+" name='bookBV' alt='View Bookmarked Problems' border='0'></a>"+btail;break;
case"exitviewbookmarks":buttonshtml+=bfront+
"<a href='javascript:void(parent.close_popups(false));void(parent.n101());' "+"onMouseOver='window.status=\"Exit Boomark Viewing Mode\";"+"document.bookEBV.src=parent.exitviewbms_on.src;return true;' "+"onMouseOut='window.status=\"\";"+"document.bookEBV.src=parent.exitviewbms_off.src;return false;' >"+"<img src='gifs/buttons/exitviewbms1.gif' "+butwid+" name='bookEBV' alt='Exit Bookmark Viewing' border='0'></a>"+btail;break;
case"print":buttonshtml+=bfront+
"<a href='javascript:void(parent.close_popups(false));"+"void(parent.n45());' "+"title='Print Page' "+"onMouseOver='window.status=\"Print\";"+"document.printB.src=parent.print_on.src;return true;' "+"onMouseOut='window.status=\"\";"+"document.printB.src=parent.print_off.src;return true;'>"+"<img src='gifs/buttons/print1.gif' alt='Print This Problem' "+butwid+" name='printB' border=0><\/a>"+btail;break;
default:buttonshtml+="";}}if(where=="separate")
buttonshtml="<head>"+nl+"<base href='"+topURL+"'>"+nl+linkurl+nl+"<\/head>"+nl+startset+buttonshtml+endset+nl+"<\/body>";else
buttonshtml=startset+buttonshtml+endset;return buttonshtml;}function n146()
{if(test.questions[curr_instance].bookmarked)
{test.questions[parent.curr_instance].bookmarked=false;subtitle.document.paperclip.src=parent.unbookmarked.src;currbook_on.src=book_on.src;currbook_off.src=book_off.src;buttons.document.bookB.src=book_on.src;}else{test.questions[parent.curr_instance].bookmarked=true;subtitle.document.paperclip.src=parent.bookmarked.src;currbook_on.src=unbook_on.src;currbook_off.src=unbook_off.src;buttons.document.bookB.src=unbook_on.src;}}
function n27()
{if(sound)
{sound=false;currsound_on.src=soundon_on.src;currsound_off.src=soundon_off.src;extras.document.soundB.src=soundon_on.src;}else{sound=true;currsound_on.src=soundoff_on.src;currsound_off.src=soundoff_off.src;extras.document.soundB.src=soundoff_on.src;}}function selftesttoggle()
{if(selftestview)
{selftestview=false;currselftest_on.src=selftest_on.src;currselftest_off.src=selftest_off.src;buttons.document.selftestB.src=selftest_on.src;if(template_list.ntemplates>0)
{loadmsg("get_report()");question.document.close();}else
{mkchapmenu(1);}}else{selftestview=true;template_list.ntemplates=0;template_list.templates=null;test.questions=null;currselftest_on.src=exitselftest_on.src;currselftest_off.src=exitselftest_off.src;buttons.document.selftestB.src=exitselftest_on.src;mkselftest();}}
function checker(from)
{var probt=template_list.templates[test.questions[curr_instance].template_index];var qtype=probt.type;var ttype=(qtype=="M")?"I": probt.solution.type;if((qtype=='S')&&!test.questions[curr_instance].done&&!test.questions.seen_solution)
test.questions[curr_instance].response=escape(question.document.studresp.resp.value);var probi=test.questions[curr_instance];var correctfl=false;var tsol=unescape(probi.solution);tsol=tsol.toLowerCase();tsol=tsol.replace(/\s+/g,'');var tresp=unescape(probi.response);tresp=tresp.toLowerCase();tresp=tresp.replace(/\s+/g,'');from=from.toLowerCase();var retval=(from=='next'||from=='exit')?true:false;changed_since_checked=false;
if(probi.done||probi.seen_solution&&!(from=='next'||from=='exit'))
{n12();}else if(!(probi.done||probi.seen_solution)&&((qtype=='M'&&parseInt(tresp)<0)||(tresp==null||tresp=="null"||tresp==""||typeof(tresp)=="undefined"))&&from!='exit')
{if(from=='next')
{retval=confirm("You have not yet answered the question.\n"+"Do you really want to move on ? \n\n");}else
{alert("Please answer the question before checking.");if(qtype!="M")
question.document.studresp.resp.focus();}}else
{if(ttype.substring(0,1)=="I"||ttype.substring(0,1)=="R")
{var valid_val_char=".+-0123456789";tresp=tresp.replace(/,/g,'');for(i=0;i<tresp.length;i++)
{if(valid_val_char.indexOf(tresp.charAt(i))>=0)
{tresp=tresp.substring(i);break;}}if(parseFloat(tresp)==parseFloat(tsol))
correctfl=true;}else if(tresp==tsol)
correctfl=true;if(correctfl)
{test.questions[curr_instance].correct=true;if(test.type=="S-SELF")
self_test_score++;if(test.type.charAt(0)=='S')
{test.questions[curr_instance].seen_solution=true;test.questions[curr_instance].done=true;if(from!='exit')
yesnoresp(true);}retval=true;}else if(from=='exit'){test.questions[curr_instance].correct=false;test.questions[curr_instance].done=true;retval=true;}else if(test.type.charAt(0)=='T'){test.questions[curr_instance].correct=false;retval=true;}else{test.questions[curr_instance].correct=false;mretries=number_of_retries;if(qtype=="M")
{mretries=Math.min(mretries,Math.floor(probt.nchoices/2));mretries=Math.max(mretries,0);}if(probi.retries>=mretries)
{test.questions[curr_instance].seen_solution=true;test.questions[curr_instance].retries=-1;loadmsg('showme_solution('+curr_instance+',"outofretries")');retval=false;}else{test.questions[curr_instance].retries++;if(from=='next')
retval=true;yesnoresp(false);if(qtype!="M")
{question.document.studresp.resp.focus();question.document.studresp.resp.select();}}}}return retval;}function n12()
{var iparent=curr_instance;var tnext=test.questions[curr_instance].next;var tprob=test.questions[curr_instance].problemnumber;if(tnext!=null)
test.questions[tnext].prev=test.questions.length;test.questions[curr_instance].next=test.questions.length;test.questions[curr_instance].done=true;curr_instance=test.questions.length;n76(curr_template,curr_instance);test.questions[curr_instance].next=tnext;test.questions[curr_instance].prev=iparent;test.questions[curr_instance].problemnumber=tprob;n44();return;}
function hint(iindex)
{var winname="hint";var features="menubar=no,location=no,scrollbars=yes,width=720,height=500"+",resizable=yes,left=0,top=0,screenX=0,screenY=0";var title="Hint";var tindex=test.questions[iindex].template_index;var hinthtml="<p><center><img src='"+template_list.templates[tindex].hint+"'>"+"</center><p>";
refline=n88(template_list.templates[tindex].ref);refline=refline.replace(/\.0/g,'.');refline=refline.replace(/ 0/g,' ');hinthtml+="<center>"+refline+"</center>";hinthtml=n80(title)+hinthtml+"<p>"+n79();hinthtml=escape(hinthtml);window_list[winname]=window.open("",winname,features);with(window_list[winname])
{document.open();document.write(qpopup("blank.html"));document.close();focus();}popup_content(winname,hinthtml);}function show_help(screen)
{var winname="help";var features="menubar=no,location=no,scrollbars=yes,width=720,height=500"+",resizable=no,left=0,top=0,screenX=0,screenY=0";var title="Help";var frameset_string="";var helpfile="help/none.html"
switch(screen){case"Chapters": helpfile="help/chapter_list_help.html";break;case"Sections": helpfile="help/section_list_help.html";break;case"Problem": helpfile="help/problem_help.html";break;case"default": helpfile="help/none.html";}window_list[winname]=window.open("",winname,features);with(window_list[winname])
{document.open();document.write(qpopup(helpfile));document.close();}window_list[winname].focus();}function show_tables()
{var winname="tables";var features="menubar=no,location=no,scrollbars=yes,width=720,height=600"+",resizable=yes,left=0,top=0,screenX=0,screenY=0";var title="Tables";var tablesfile="tables/index.htm";window_list[winname]=window.open("",winname,features);with(window_list[winname])
{document.open();document.write(qpopup(tablesfile));document.close();}window_list[winname].focus();}function show_calc()
{var winname="calculator";var features="menubar=no,location=no,scrollbars=yes,width=800,height=625,resizable=yes,left=0,top=0,screenX=0,screenY=0";var title="NetCalculatorTM";var calcfile="grcalc/index.html";window_list[winname]=window.open(calcfile,winname,features);window_list[winname].focus();}
function n45()
{if(browserVer<5&&MSIE)
{parent.question.focus();alert('Right click in the white area above to print.');}else if(isMac)
{parent.question.focus();alert('Press the apple and P keys down together to print.');}else
{parent.question.focus();parent.question.print();}}function prev()
{var checkval;if(!test.questions[curr_instance].done&&!test.questions[curr_instance].seen_solution&&((check_on_next&&changed_since_checked)||test.type.charAt(0)=='T'))
{checkval=checker('next');var qtype=template_list.templates[curr_template].type;var cresp=(qtype=='S')?escape(question.document.studresp.resp.value):'';changed_since_checked=changed_since_checked||(qtype=='S'&&cresp!=test.questions[curr_instance].response);
if(!checkval)
return;}if(bookmarkview)
{prev_bookmark();}else if(test.questions[curr_instance].prev!=null)
{curr_instance=test.questions[curr_instance].prev;curr_template=test.questions[curr_instance].template_index;n44();}else
{alert("You are at the beginning of the test.");}}function next(flag)
{var nonewprob=false;var moveon=false;var sametemplate=false;var checkval=true;var qtype=template_list.templates[curr_template].type;var cresp=(qtype=='S')?escape(question.document.studresp.resp.value):'';changed_since_checked=changed_since_checked||(qtype=='S'&&
cresp!=test.questions[curr_instance].response);if(!flag)flag=0;if(test.questions[curr_instance].problemnumber>=nquests-1)
nonewprob=true;if(!test.questions[curr_instance].done&&!test.questions[curr_instance].seen_solution&&((check_on_next&&changed_since_checked)||test.type.charAt(0)=='T'))
{if(!flag)checkval=checker('next');if(!checkval)
return;else if((NS||isMac)&&checkval&&!bookmarkview&&nonewprob&&test.questions[curr_instance].next==null&&!flag)
{setTimeout("next(1)",1500);return
}}if(!bookmarkview&&nonewprob&&((test.questions[curr_instance].done||checkval)&&test.questions[curr_instance].next==null))
{var firstbmquest=-1;for(i=0;i<test.questions.length;i++)
{if(test.questions[i].bookmarked&&firstbmquest<0)
{firstbmquest=i;break;}}if(firstbmquest>=0)
{bmvq=confirm("You have reached the end of the test but there "+"are still bookmarked questions. Do you wish to review them? \n\n");if(bmvq)
{n103(-1);return;}}subtitle.document.href="title.html";loadmsg("get_report()");return;}else
{if(bookmarkview)
{if((NS||isMac)&&checkval)
setTimeout('next_bookmark();',1500);else
n59();}else if(test.questions[curr_instance].next==null)
{curr_template++;if(curr_template>=template_list.ntemplates)
curr_template=0;iparent=curr_instance;test.questions[curr_instance].next=curr_instance+1;curr_instance++;n71(template_list.template_files[curr_template],iparent);}else
{curr_instance=test.questions[curr_instance].next;curr_template=test.questions[curr_instance].template_index;n44();}}}function n103(pos)
{var first_bmq=-1;var currq;bmv_curr_instance=typeof(pos)=='undefined'?curr_instance:pos;bookmarkview=true;for(currq=0;currq!=null;currq=test.questions[currq].next)
{if(test.questions[currq].bookmarked)
{first_bmq=currq;curr_instance=currq;curr_template=test.questions[currq].template_index;break;}}if(first_bmq<0)
{alert("There are no bookmarked questions.");n101();}else
{n44();}}function n101()
{curr_instance=bmv_curr_instance;bmv_cur_instance=0;bookmarkview=false;if(curr_instance<0)
{loadmsg("get_report()");}else
{curr_template=test.questions[curr_instance].template_index;n44();}}function n59()
{var last_bmq=curr_instance;var next_bmq=-1;var currq;for(currq=test.questions[last_bmq].next;currq!=null;currq=test.questions[currq].next)
{if(test.questions[currq].bookmarked)
{next_bmq=currq;curr_instance=currq;curr_template=test.questions[currq].template_index;break;}}if(next_bmq<0)
{var exitfl=confirm("There are no more bookmarked questions. "+"Do you wish to exit bookmarkview mode? "+"\n"+"\n");if(exitfl)
n101();else
n44();}else
{n44();}}function prev_bookmark()
{var last_bmq=curr_instance;var next_bmq=-1;var currq;for(currq=test.questions[last_bmq].prev;currq!=null;currq=test.questions[currq].prev)
{if(test.questions[currq].bookmarked)
{next_bmq=currq;curr_instance=currq;curr_template=test.questions[currq].template_index;break;}}if(next_bmq<0)
{alert("You are at the first bookmarked question.");}else
{n44();}}function n90()
{alert("This feature is not available at this time.");}function mkselftest()
{var boxname;question.document.open();question.document.write("<html><head>"+nl+"<title>Self Test</title>"+nl+"<script language='Javascript'>"+nl+"function updateallchap(chapn) {"+nl+"var chboxname = 'c'+chapn;"+nl+"var chsboxname;"+nl+"for (i = 1; i <=parent.NSECTIONS[chapn] ; i++)"+nl+"{"+nl+"chsboxname = 'c'+chapn+'s'+i;"+nl+"document.forms[0].elements[chsboxname].checked =  document.forms[0].elements[chboxname].checked;"+nl+
"}"+nl+"}"+nl+"<\/script>"+nl+"<link rel=stylesheet href='cd_styles.css' type='text/css'>"+nl+"<\/head>"+nl);question.document.write("<body bgcolor=white>"+nl+"<form name='stform' onSubmit='return false;'>"+nl+"<center><h2>Self Test</h2></center>"+nl+"<p>"+nl+"Select the chapters and sections you wish your self test to cover."+nl+"Next click the <b>Start Test</b> button at the bottom of the page to"+nl+"create the test.<p>"+nl);for(c=1;c<=parent.NCHAPTERS;c++)
{boxname="c"+c;question.document.write("<input name=\""+boxname+"\" type=checkbox"+" onClick=\"updateallchap("+c+")\"> &nbsp;<b>"+CHAPTITLES[c]+"</b>"+nl);question.document.write("<blockquote>"+nl);for(s=1;s<=NSECTIONS[c];s++)
{boxname="c"+c+"s"+s;question.document.write("<input name=\""+boxname+"\" type=checkbox> "+"&nbsp;"+SECTITLES[c][s]+"<br>"+nl);}question.document.write("<\/blockquote><p>"+nl);}question.document.write("<p><center><input name='crtest' "+"value=' Create Test ' type=button onClick='parent.selftestbuild()'>"+nl+"</center>"+nl+"</form>"+nl+"</body><\/html>");question.document.close();
var selftest_buttons=sec_buttons.replace(/section/,"");if(selftest_buttons.indexOf("|")>=0)
{var buttarr=new Array();buttarr=selftest_buttons.split("|");buttons.document.open("text/html","replace");buttons.document.write(display_buttons(buttarr[1],"Sections","horizontal"));buttons.document.close();extras.document.open("text/html","replace");extras.document.write(display_buttons(buttarr[0],"Sections","vertical"));extras.document.close();}
else
{buttons.document.open("text/html","replace");buttons.document.write(display_buttons(selftest_buttons,"Sections","horizontal"));buttons.document.close();}}function selftestbuild()
{var boxname;var count=0;template_list.templates=new Array();test.questions=new Array();test.title=selftestname;test.type="S-SELF";self_test_score=0;for(c=1;c<=NCHAPTERS;c++)
{for(s=1;s<=NSECTIONS[c];s++)
{boxname="c"+c+"s"+s;if(question.document.forms[0].elements[boxname].checked)
{for(p=1;p<=SECTEMPLATES[c][s];p++)
{template_list.template_files[count]="chap"+c+"/sect"+s+"/prob"+p+"/prob"+c+"_"+s+"_"+p+".js";count++;}}}}for(i=0;i<count;i++)
{i1=Math.floor(Math.random()*count);i2=Math.floor(Math.random()*count);if(i<5)
temp=template_list.template_files[i1];template_list.template_files[i1]=template_list.template_files[i2];template_list.template_files[i2]=temp;}nquests=100000000;template_list.ntemplates=count;if(template_list.ntemplates>0)
n71(template_list.template_files[0],null);}function showme_solution(iindex,stype)
{var winname="showme";var features="menubar=no,location=no,scrollbars=yes,width=720,height=500"+",resizable=yes,left=0,top=0,screenX=0,screenY=0";var title="Show Me the Solution";if(stype=="outofretries")
title="You Are Out of Retries. The Complete Solution Is:";var tindex=test.questions[iindex].template_index;var rawshowme=new Array();rawshowme[0]=template_list.templates[tindex].worked;var showmeval=new n8("S",rawshowme);var showmehtml=evaluate(showmeval,template_list.templates[tindex].nvars,test.questions[iindex].varvals);var ts=showmehtml.toLowerCase();
if((ts.indexOf("<table")>=0)||(ts.indexOf("<innertable")>=0))
showmehtml=n115(showmehtml,true);else
showmehtml=n115(showmehtml);refline=n88(template_list.templates[tindex].ref);refline=refline.replace(/\.0/g,'.');refline=refline.replace(/ 0/g,' ');showmehtml+=refline;showmehtml=n80(title)+showmehtml+"<p>"+n79();showmehtml=escape(showmehtml);window_list[winname]=window.open("",winname,features);with(window_list[winname])
{document.open();document.write(qpopup("blank.html"));document.close();focus();}test.questions[iindex].seen_solution=true;n44();popup_content(winname,showmehtml)
}function n2()
{var features="menubar=no,scrollbars=auto,width=800,height=450,"+"resizable=no,left=0,top=0,screenX=0,screenY=0";var winname="yourturn";var frameset_string="";curr_ytstep=0;stepanswerlist.length=0;frameset_string+="<HTML>"+nl+"<HEAD>"+nl+"<SCRIPT language='Javascript'>"+nl+"var NS = "+NS+";"+nl+"var isMac = "+isMac+";"+nl+"<\/SCRIPT>"+nl+"</HEAD>"+nl+"<frameset rows=\"83,*,60\" framespacing=0 frameborder=0 border=0>"+nl+"  <frame src= \"popup_title.html\" name=\"popuptitle\""+"     marginwidth=0 marginheight=0 frameborder=0 scrolling=no>"+nl+"<frameset frameborder=0 framespacing=0 marginheight=0 marginwidth=0 "+" border=0 cols=\"4,*\">"+nl+"<frame src= \"popup_side.html\" name=\"popupside\""+"marginwidth=0 marginheight=0 frameborder=0 scrolling=no>"+nl+"<frameset rows=\"60,*\" framespacing=0 frameborder=0 border=0>"+nl+"  <frame name=\"top_frame\" src=\"blank.html\" scrolling=\"no\""+"     marginheight=0 marginwidth=0 valign=\"top\">"+nl+"  <frame name=\"bottom_frame\" src=\"blank.html\" scrolling=\"auto\""+"     marginheight=0 marginwidth=0 valign=\"top\">"+nl+"</frameset>"+nl+"</frameset>"+nl+"  <frame src= \"copyright.html\" name=\"popupbottom\""+"  marginwidth=0 marginheight=0 frameborder=0 scrolling=no>"+nl+"</frameset>"+nl+"</HTML>";
window_list[winname]=window.open("","yourturn",features);with(window_list[winname])
{document.open();document.write(frameset_string);document.close();focus();}yourturn_content();}function yourturn_content()
{if(!window_list["yourturn"].top_frame.document||typeof window_list["yourturn"].top_frame.document=="undefined"||!window_list["yourturn"].bottom_frame.document||typeof window_list["yourturn"].bottom_frame.document=="undefined")
nexttm=setTimeout("yourturn_content()",100);else
{clearTimeout(nexttm);n3();n58();}}function n89(instance_idx)
{var ques_string="";var prob=test.questions[instance_idx];var template=template_list.templates[prob.template_index];var ques_string=template.question;var tspec,tvar;var indent_html="";if(template.nvars>0)
{tspec=new Array(ques_string,"");tvar=new n8("S",tspec);ques_string=evaluate(tvar,template.nvars,prob.varvals);}tmpquest_string=ques_string.toLowerCase();if(tmpquest_string.indexOf("<table")>=0||tmpquest_string.indexOf("<innertable")>=0)
{ques_string=n116(ques_string,true,true);}ques_string="<table cellpadding=0 cellspacing=0 border=0><tr>"+indent_html+"<td><b>"+ques_string+"</b></td>"+indent_html+"</tr></table>";return ques_string;}function n91(instance_idx)
{var prob=test.questions[instance_idx];var choices_string="";var chlen,chlen2,temp,temp2,rows,cols,tc,ts;var nopts=prob.ichoices.length;var choices_string="";chlen=5;chlen2=chlen;rows=Math.min(MAXCHOICES,nopts)/2;cols=2;for(i=0;i<Math.min(MAXCHOICES,nopts);i++)
{temp=new String(prob.ichoices[i].val);temp=temp.toLowerCase();temp=temp.replace(/<img[^>]*chars[^>]*>/gi,":");temp=temp.replace(/<img[^>]*dot\.gif[^>]*>/gi,":");temp=temp.replace(/<img[^>]*blank\.gif[^>]*>/gi,":");temp=temp.replace(/<img[^>]*spacer\.gif[^>]*>/gi,":");temp=temp.replace(/<img[^>]*space\.gif[^>]*>/gi,":");temp=temp.replace(/<img[^>]*>/gi,"12345678901234567890");temp=temp.replace(/<\/*table[^>]*>/gi,"");temp=temp.replace(/<\/*innertable[^>]*>/gi,"");temp=temp.replace(/<\/*.>/gi,"");
temp2=temp.split(/<tr/gi);temp=temp.replace(/<\/*td[^>]*>/gi,"");temp=temp.replace(/<\/*tr[^>]*>/gi,"");temp=temp.replace(/<\/*sup[^>]*>/gi,"");temp=temp.replace(/<\/*sub[^>]*>/gi,"");temp=temp.replace(/<\/*font[^>]*>/gi,"");temp=temp.replace(/\&nbsp;/gi," ");if(temp.length>20)
{rows=Math.min(MAXCHOICES,nopts);cols=1;break;}}for(i=0;i<Math.min(MAXCHOICES,nopts);i++)
{tc=new String(prob.ichoices[i].val);ts=tc.toLowerCase();if((ts.indexOf("<table")>=0)||(ts.indexOf("<innertable")>=0))
{tc=n116(tc,false,false);choices_string+=tc;}else
{choices_string+="<table cellspacing=0 cellpadding=0 border=0>"+"<tr>"+"<td><table cellspacing=0 cellpadding=0 border=0><tr><td nowrap>"+tc+"<\/td><\/tr><\/table></td>"+"</tr></table>";}}return choices_string;}function n115(worked_string,has_tables)
{var html_string="";var table_start="<table cellpadding=0 cellspacing=10 border=0 width=600>"+"\n";var tr_start="<tr>"+"\n";var td_right_start="  <td align=\"right\" nowrap>";var td_center_start="  <td align=\"center\" nowrap>";var td_left_start="  <td nowrap>";var td_span_start="  <td colspan=4>";
var td_end="<\/td>"+"\n";var tr_end="<\/tr>"+"\n";var table_end="<\/table>"+"\n";var steplist=new Array();steplist=n99(worked_string);if(steplist.length>0)
{html_string+=table_start;for(var i=0;i<steplist.length;i++)
{var step=steplist[i];if(step.indexOf("<box>")!=-1)
{step=step.replace(/<box>/gi,"");step=step.replace(/<\/box>/gi,"");}if(step.indexOf("<box>")!=-1)
{step=step.replace(/<hide>/gi,"");step=step.replace(/<\/hide>/gi,"");}if(step.indexOf("::")>0)
{var parsed_list=step.split("::");if(has_tables)
{parsed_list[0]=n116(parsed_list[0],false,false);parsed_list[1]=n116(parsed_list[1],false,false);parsed_list[2]=n116(parsed_list[2],false,false);parsed_list[3]=n116(parsed_list[3],false,false);}html_string+=tr_start;html_string+=td_right_start+parsed_list[0]+td_end;html_string+=td_center_start+parsed_list[1]+td_end;html_string+=td_left_start+parsed_list[2]+td_end;html_string+="<td>"+parsed_list[3]+td_end;html_string+=tr_end;}else
{if(has_tables)
html_string+=tr_start+td_span_start+n116(steplist[i],false,true)+td_end+tr_end;else
html_string+=tr_start+td_span_start+steplist[i]+td_end+tr_end;}}html_string+=table_end;}else
{if(has_tables)
html_string=n116(worked_string,false,true);else
html_string=worked_string;}return html_string;}function n114(step_string,has_tables,fillAnswer)
{var html_string="";var step=step_string;var td_right_start="  <td align=\"right\" nowrap>";var td_center_start="  <td align=\"center\" nowrap>";var td_left_start="  <td nowrap>";var td_span_start="  <td colspan=4 width=520>";var td_end="<\/td>"+nl;if(step.indexOf("<box>")!=-1)
step=n78(step,fillAnswer);if(step.indexOf("<hide>")!=-1)
step=n77(step,fillAnswer);if(step.indexOf("::")>0)
{var parsed_list=step.split("::");if(has_tables)
{parsed_list[0]=n116(parsed_list[0],false,false);parsed_list[1]=n116(parsed_list[1],false,false);parsed_list[2]=n116(parsed_list[2],false,false);parsed_list[3]=n116(parsed_list[3],false,false);}html_string+=td_right_start+parsed_list[0]+td_end;html_string+=td_center_start+parsed_list[1]+td_end;html_string+=td_left_start+parsed_list[2]+td_end;html_string+="<td>"+parsed_list[3]+td_end;}else
{if(has_tables)
html_string+=td_span_start+n116(step,false,false)+td_end;else
html_string+=td_span_start+step+td_end;}return html_string;}function n99(worked_string)
{var steps=new Array();var startstep_idx=-1;var endstep_idx=-1;var origws=new String(worked_string);var ws=new String(worked_string.toLowerCase());if(ws.indexOf("<step>")!=-1)
{var loopflag=1;while(loopflag)
{startstep_idx=ws.indexOf("<step>")+6;endstep_idx=ws.indexOf("<\/step>");steps[steps.length]=origws.substring(startstep_idx,endstep_idx);ws=ws.substring(endstep_idx+7,ws.length);origws=origws.substring(endstep_idx+7,origws.length);if(ws=="")
loopflag=0;}}return steps;}var boxval=null;function n78(boxed_string,fillAnswer)
{var bs=new String(boxed_string);var boxpos=bs.indexOf("<box>");var prebox=bs.substring(0,boxpos);var postbox=bs.substring(bs.indexOf("</box>")+6,bs.length);boxval=bs.substring(boxpos+5,bs.indexOf("</box>"));bs=bs.replace(/<box>/gi,"");bs=bs.replace(/<\/box>/gi,"");if(fillAnswer)
bs=prebox+"<font color=\"green\"><b>"+boxval+"</b></font>"+postbox;else
bs=prebox+"<input type=\"text\" name=\"txtBox\" size=8>"+postbox;return bs;}var hideval=null;function n77(hidden_string,fillAnswer)
{var hs=new String(hidden_string);var hidepos=hs.indexOf("<hide>");var prehide=hs.substring(0,hidepos);var posthide=hs.substring(hs.indexOf("</hide>")+7,hs.length);hideval=hs.substring(hidepos+6,hs.indexOf("</hide>"));hs=hs.replace(/<hide>/gi,"");hs=hs.replace(/<\/hide>/gi,"");if(fillAnswer)
hs=prehide+hideval+posthide;else
hs=prehide+"&nbsp;"+posthide;return hs;}function n58()
{var CHECKIMG_HTML="  <td width=152 align=\"center\" nowrap>"+"<img src=\"gifs/buttons/checksbs.gif\" alt=\"Correct! Good job!\" border=0 align=\"abstop\">"+"</td></tr>"+nl;var EYEBALLIMG_HTML="  <td width=152 align=\"center\" nowrap>"+"<img src=\"gifs/buttons/watchstep.gif\" alt=\"Watch this step\" border=0 align=\"abstop\">"+"</td></tr>"+nl;var html_string="";html_string+="<html>"+nl;html_string+="<head>"+nl;html_string+="  <title>Your Turn</title>"+nl+nl;html_string+="</head>"+nl;html_string+="<body bgcolor=\"#FFFFFF\" onLoad='self.scrollTo(0,10000);parent.opener.popupld=true;'>"+nl;html_string+="<form name=\"frmStep\" onSubmit=\"return false;\">"+nl;
var theques=test.questions[curr_instance];var tindex=theques.template_index;var rawyourturn=new Array();rawyourturn[0]=template_list.templates[tindex].worked;var yourturnval=new n8("S",rawyourturn);var worked_string=evaluate(yourturnval,template_list.templates[tindex].nvars,theques.varvals);var steps=new Array;steps=n99(worked_string);
html_string+="<table cellpadding=2 border=0>"+nl;html_string+="<tr><td colspan=7 align=\"center\"><b>"+n89(curr_instance)+"</b></td></tr>"+nl;html_string+="<tr><td width=60><p>&nbsp;<br></td>"+"<td width=8><p>&nbsp;<br></td>"+"<td width=150>&nbsp;</td>"+"<td width=30>&nbsp;</td>"+"<td width=150>&nbsp;</td>"+"<td>&nbsp;</td>"+"<td width=152><p>&nbsp;<br></td></tr>"+nl;
var shownsteps=curr_ytstep<=steps.length-1? curr_ytstep: steps.length;for(var i=0;i<shownsteps;i++)
{var istep=steps[i];var lc_step=istep.toLowerCase();var hasbox=lc_step.indexOf("<box>")!=-1;var laststep=i==(steps.length-1);html_string+="<tr>"+nl;html_string+="  <td align=\"right\" width=60 nowrap><b>Step "+(i+1)+": </b></td>"+nl;html_string+="  <td width=8>&nbsp;</td>"+nl;if((lc_step.indexOf("<table")>=0)||(lc_step.indexOf("<innertable")>=0))
html_string+=n114(istep,true,true)+nl;else
html_string+=n114(istep,false,true)+nl;if(hasbox)
if(stepanswerlist[i]==true)
html_string+=CHECKIMG_HTML;else
html_string+=EYEBALLIMG_HTML;else
html_string+="  <td align=\"center\" height=33 width=152>&nbsp;</td></tr>"+nl;}if(curr_ytstep<=steps.length-1)
{var currstep=steps[curr_ytstep];var lc_currstep=currstep.toLowerCase();var hasbox=lc_currstep.indexOf("<box>")!=-1;var laststep=curr_ytstep==steps.length-1;html_string+="<tr>"+nl;html_string+="  <td align=\"right\" width=60 nowrap><b>Step "+(curr_ytstep+1)+": </b></td>"+nl;html_string+="  <td width=8>&nbsp;</td>"+nl;
if((lc_currstep.indexOf("<table")>=0)||(lc_currstep.indexOf("<innertable")>=0))
html_string+=n114(currstep,true,false)+nl;else
html_string+=n114(currstep,false,false)+nl;html_string+="  <td width=152 align=\"center\" nowrap>";if(hasbox)
{html_string+="<input type=\"button\" value=\"Check\" "+"onClick=\"if(parent.opener) "+"parent.opener.n138(document.frmStep.txtBox)\">&nbsp;";html_string+="<input type=\"button\" value=\"Next Step\" "+"onClick=\"if(parent.opener) "+"parent.opener.n138(document.frmStep.txtBox,true)\">"+"</td></tr>"+nl;}else
html_string+="<input type=\"button\" value=\"Next Step\" "+"onClick=\"if(parent.opener) "+"parent.opener.n58()\">"+"</td></tr>"+nl;}if(curr_ytstep==steps.length)
{html_string+="<tr><td colspan=7><hr></td></tr>"+nl+"<tr><td colspan=7 align=\"center\">"+"<input type=\"button\" value=\"Close\" onClick=\"parent.window.close(self)\"></td></tr>"+nl;theques.seen_solution=true;n44();curr_ytstep=0;stepanswerlist.length=0;}else
curr_ytstep++;html_string+="</table>"+nl;html_string+="</form>"+nl+"<script language='JavaScript'>"+nl+"if(typeof(parent.opener.pgld)!=\"undefined\")"+nl+"parent.opener.pgld=true;"+nl+"<\/script>"+nl+"</body>"+nl+"</html>"+nl;n4(html_string);}function n138(txtbox,fromNextStep)
{var fillAnswer=false;var users_answer;var topframe_html="<html><head></head><body bgColor=\"#FFFFFF\">"+"\n";var correct_message=" is correct! Good job!";var incorrect_message=fromNextStep?" is incorrect. The correct answer is ":" is incorrect.";var isCorrect=false;topframe_html+="<table bgColor=\"#FFFFFF\" bgColor=\"#FFFFFF\""+" cellpadding=0 cellspacing=0 width=\"100%\" height=\"60\" border=0><tr>"+"\n"+"  <td><br>&nbsp;<b>Your Turn</b></td>"+"\n";
users_answer=txtbox.value;users_answer=users_answer.toLowerCase();users_answer=users_answer.replace(/\s+/g,'');users_answer=users_answer.replace(/^[,\?;:]+/,"");users_answer=users_answer.replace(/[,\.\?;:]+$/,"");var valid_prefix_chars=" ~#$%&";var valid_non_digit=".+-";var valid_num_chars="0123456789";var isNumType=false;var valindex=-1;var tvnd=valid_non_digit;
for(var i=0;i<users_answer.length;i++)
{var thechar=users_answer.charAt(i);if(!(valid_num_chars.indexOf(thechar)>=0||((tvnd.length>0)&&tvnd.indexOf(thechar)>=0)||valid_prefix_chars.indexOf(thechar)>=0))
{break;}else if((tvnd.length>0)&&tvnd.indexOf(thechar)>=0)
{if(valindex<0)
valindex=i;if(thechar=='.')
tvnd='';else
tvnd='.';}else if(valid_num_chars.indexOf(thechar)>=0)
{valindex=valindex>=0?valindex:i;users_answer=users_answer.substring(valindex);users_answer=users_answer.replace(/,/g,'');users_answer=parseFloat(users_answer);isNumType=true;break;}}if(users_answer==""&&users_answer.length==0)
{if(fromNextStep)
n58();else
topframe_html+="  <td align=\"right\"><font color=\"red\">"+"<b>Please enter a value in the textbox.</b></font></td>"+"\n";}else
{var boxanswer=boxval.toLowerCase();boxanswer=boxanswer.replace(/\s+/g,"");boxanswer=boxanswer.replace(/^[,\?;:]+/,"");boxanswer=boxanswer.replace(/[,\.\?;:]+$/,"");if(!((isNumType&&parseFloat(users_answer)==parseFloat(boxanswer))||users_answer==boxanswer))
{if(!fromNextStep)
topframe_html+="  <td align=\"right\"><br>Sorry, "+"<font color=\"red\"><b>"+users_answer+"</b></font>"+incorrect_message+"</font>"+"&nbsp;</td>"+"\n";else
{topframe_html+="  <td align=\"right\"><br>Sorry, "+"<font color=\"red\"><b>"+users_answer+"</b></font>"+incorrect_message+"<font color=\"green\"><b>"+boxval+"</b></font>"+".&nbsp;</td>"+"\n";}}else
{topframe_html+="  <td align=\"right\"><br><font color=\"green\"><b>"+users_answer+"</b></font>"+correct_message+"&nbsp;</td>"+"\n";isCorrect=true;}stepanswerlist[curr_ytstep-1]=isCorrect;if(fromNextStep||(!fromNextStep&&isCorrect))
n58();}topframe_html+="</tr><tr><td align=\"center\" colspan=2><hr></td></table>"+"\n";topframe_html+="</body>"+"\n";topframe_html+="</html>";n3(topframe_html);}function n3(content)
{var topframe_string="<html><head></head><body bgColor=\"#FFFFFF\">"+nl+"<table bgColor=\"#FFFFFF\" cellpadding=0 cellspacing=0 width=\"100%\" height=\"60\">"+nl+"<tr><td><br>&nbsp;<b>Step by Step</b></td></tr>"+nl+"<tr><td><hr></td></tr>"+nl+"</table>"+nl+"</body></html>";if(content)
topframe_string=content;if(window_list["yourturn"])
{with(window_list["yourturn"].top_frame.document)
{open();write(topframe_string);close();}}}function n4(content)
{if(window_list["yourturn"])
{with(window_list["yourturn"].bottom_frame.document)
{open();write(content);close();}if(document.frmStep)
if(document.frmStep.txtBox)
document.frmStep.txtBox.focus();}}function qpopup(fname)
{var frameset_string="";frameset_string+="<HTML>"+nl+"<HEAD>"+nl+"<SCRIPT language='Javascript'>"+nl+"var NS = "+NS+";"+nl+"var isMac = "+isMac+";"+nl+"<\/SCRIPT>"+nl+"<BASE href=\""+topURL+"\">"+nl+"</HEAD>"+nl+"<frameset frameborder=0 framespacing=0 marginheight=0 marginwidth=0 "+" border=0 rows=\"83,*,60\">"+nl+"<frame src= \"popup_title.html\" name=\"popuptitle\""+"marginwidth=0 marginheight=0 frameborder=0 scrolling=no>"+nl+"<frameset frameborder=0 framespacing=0 marginheight=0 marginwidth=0 "+" border=0 cols=\"4,*\">"+nl+"<frame src= \"popup_side.html\" name=\"popupside\""+"marginwidth=0 marginheight=0 frameborder=0 scrolling=no>"+nl+"<frame src= \""+fname+"\" name=\"popupcontent\""+"marginwidth=0 marginheight=0 frameborder=0 scrolling=auto>"+nl+"</frameset>"+nl+"<frame src= \"copyright.html\" name=\"popupbottom\""+"marginwidth=0 marginheight=0 frameborder=0 scrolling=no>"+nl+"</frameset>"+nl+"</HTML>";
return frameset_string;}function popup_content(windownm,content)
{if((!window_list[windownm].popupcontent||typeof window_list[windownm].popupcontent=="undefined")||!window_list[windownm].popupcontent.document||typeof window_list[windownm].popupcontent.document=="undefined")
{nexttm=setTimeout("popup_content('"+windownm+"','"+content+"')",100);}else
{clearTimeout(nexttm);content=unescape(content);window_list[windownm].popupcontent.document.open();window_list[windownm].popupcontent.document.write(content);window_list[windownm].popupcontent.document.close();}}var butld=true;
