Interactive
Link
Embed Code
HTML snippet
HTML full page
The link feature passes QnA content via GET (as part of the URL). Consequently, there is a limit to how much data a QnA link can handle (how long the URL can be). This QnA is too big to share via the link feature. However, you could copy or save one of the HTML outputs and serve an interactive version on your own.
The link feature passes QnA content via GET (as part of the URL). Consequently, there is a limit to how much data a QnA link can handle (how long the URL can be). This QnA is too big to share via the link feature. However, you could copy or save one of the HTML outputs and serve an interactive version on your own.
HTML snippet suitable for placement in an existing webpage.
Or cut-and-paste the text below.
<style>
body {
font-family: 'Palatino Linotype', 'Book Antiqua', Palatino, serif;
}
#rawmarkup{
display:none;
}
#QandA img{
width:100%;
}
div.main{
min-width:300px;
max-width:650px;
margin: 0 auto;
padding:0 5px 0 5px;
}
div.frame{
float:left;
width:100%;
margin:5px 0 5px 0;
}
div.full{
float:left;
width:100%;
}
.button{
padding:8px;
margin:8px 0 0px 0;
width:100%;
}
div.question_text{
float:left;
font-family: Verdana, Geneva, sans-serif;
font-size: 14px;
line-height: 20px;
color:#ffffff;
min-width:30px;
background:#5489eb;
border-radius: 15px;
padding:10px 15px 14px 15px;
margin-right:45px;
}
div.question_text a:link, div.question_text a:hover, div.question_text a:active, div.question_text a:visited{ color:#e3fbfc; }
div.question_arrow{
float:left;
width: 0;
height: 0;
border-left: 5px solid transparent;
border-right: 10px solid transparent;
border-top: 15px solid #5489eb;
margin:0 20px;
}
div.ans_text{
float:right;
font-family: Verdana, Geneva, sans-serif;
font-size: 14px;
line-height: 20px;
color:#000000;
min-width:30px;
background:#eeeeee;
border-radius: 15px;
padding:10px 15px 14px 15px;
margin-left:45px;
}
div.ans_arrow{
float:right;
width: 0;
height: 0;
border-left: 10px solid transparent;
border-right: 5px solid transparent;
border-top: 15px solid #eeeeee;
margin:0 20px;
}
div.choices{
float:left;
width:100%;
margin:15px 0 0 0;
}
div.standard_buttons{
float:left;
width:100%;
margin-top:5px;
border-top: 1px solid #ddd;
padding-top:12px;
}
div.credits{
float:left;
dispaly:none;
width:100%;
background:#eee;
margin:0px 0 15px 0;
}
div.credit_text{
font-family: Verdana, Geneva, sans-serif;
font-size: 14px;
line-height: 20px;
padding:4px 15px 10px 15px;
}
li.error{
list-style-type: none;
background:#ffdddd;
margin: 10px 0 0 0;
padding: 5px;
}
.qpad {
float:left;
padding:0 15px;
}
a.sbutton {
float:left;
font-family: Verdana, Geneva, sans-serif;
font-size: 14px;
line-height: 20px;
width:48%;
background: #eee;
border-radius: 8px;
padding:10px 0px 12px 0;
margin: 0 0 3px 0;
border: solid 1px #888;
text-align:center;
color: #000000;
text-decoration: none;
}
a.sbutton:hover, a.sbutton:active {
float:left;
font-family: Verdana, Geneva, sans-serif;
font-size: 14px;
line-height: 20px;
width:48%;
background: #ddd;
border-radius: 8px;
padding:10px 0px 12px 0;
margin: 0 0 3px 0;
border: solid 1px #888;
text-align:center;
color: #000000;
text-decoration: none;
}
a.qabutton {
float:left;
font-family: Verdana, Geneva, sans-serif;
font-size: 14px;
line-height: 20px;
width:100%;
background: #eee;
border-radius: 8px;
padding:10px 0px 12px 0;
margin: 0 0 8px 0;
border: solid 1px #888;
text-align:left;
color: #000000;
text-decoration: none;
}
a.qabutton:hover, a.qabutton:active {
float:left;
font-family: Verdana, Geneva, sans-serif;
font-size: 14px;
line-height: 20px;
width:100%;
background: #ddd;
border-radius: 8px;
padding:10px 0px 12px 0;
margin: 0 0 8px 0;
border: solid 1px #888;
text-align:left;
color: #000000;
text-decoration: none;
}
div.xdiv {
float:left;
width:100%;
margin: 0 0 8px 0;
background: #eee;
border: solid 1px #888;
border-radius: 8px;
}
input.xinput {
-webkit-box-sizing: border-box; /* Safari/Chrome, other WebKit */
-moz-box-sizing: border-box; /* Firefox, other Gecko */
box-sizing: border-box; /* Opera/IE 8+ */
float:left;
width:100%;
font-family: Verdana, Geneva, sans-serif;
font-size: 14px;
line-height: 20px;
background: #fff;
border-top-left-radius: 8px;
border-top-right-radius: 8px;
padding:10px 10px 12px 10px;
border: solid 0px #888;
border-bottom: solid 1px #888;
text-align:left;
color: #000000;
text-decoration: none;
}
a.xbutton {
float:left;
width:100%;
text-align:left;
font-family: Verdana, Geneva, sans-serif;
font-size: 14px;
line-height: 20px;
background: #eee;
border-radius: 8px;
padding:10px 0px 12px 0px;
color: #000000;
text-decoration: none;
}
a.xbutton:hover, a.xbutton:active {
border-top-left-radius: 0px;
border-top-right-radius: 0px;
background: #ddd;
}
</style>
<FORM name="FORM" id="FORM"><div id="conversation" style="margin:15px auto 0 auto;padding:0 15px;max-width:500px"> <link rel="stylesheet" type="text/css" href="https://projects.suffolklitlab.org/howto/qna/style/style.css">
<div id="icon" style="background-size: 110px 99px;background-image: url('https://projects.suffolklitlab.org/howto/qna/images/maxheadroom.gif');"></div>
<h2 style="text-align:center;">Massachusetts Indigency Calculator</h2>
<p><b>This is a <a href="https://www.codingthelaw.org/Fall_2023/level/2/#mission_p2">class project</a>. You should not rely on it as a source of legal information. It is likely incomplete.</b></p>
<p>Answer the following questions to see if you qualify for an appointment of counsel or fee waiver.</p>
<div id='QandA' class='QandA'><div style='padding:15px;background:#ddffdd;text-align:center;'>Loading QnA...</div></div><div id='Choices' class='choices'></div><div id="rawmarkup" style="display:none;">Title%3A+Massachusetts+Indigency+Calculator%0AAuthor%3A+David+Colarusso%0ABefore%3A+%3Clink+rel%3D%22stylesheet%22+type%3D%22text%2Fcss%22+href%3D%22https%3A%2F%2Fprojects.suffolklitlab.org%2Fhowto%2Fqna%2Fstyle%2Fstyle.css%22%3E%0A%3Cdiv+id%3D%22icon%22+style%3D%22background-size%3A+110px+99px%3Bbackground-image%3A+url%28%27https%3A%2F%2Fprojects.suffolklitlab.org%2Fhowto%2Fqna%2Fimages%2Fmaxheadroom.gif%27%29%3B%22%3E%3C%2Fdiv%3E%0A%3Ch2+style%3D%22text-align%3Acenter%3B%22%3EMassachusetts+Indigency+Calculator%3C%2Fh2%3E%0A%3Cp%3E%3Cb%3EThis+is+a+%3Ca+href%3D%22https%3A%2F%2Fwww.codingthelaw.org%2FFall_2023%2Flevel%2F2%2F%23mission_p2%22%3Eclass+project%3C%2Fa%3E.+You+should+not+rely+on+it+as+a+source+of+legal+information.+It+is+likely+incomplete.%3C%2Fb%3E%3C%2Fp%3E%0A%3Cp%3EAnswer+the+following+questions+to+see+if+you+qualify+for+an+appointment+of+counsel+or+fee+waiver.%3C%2Fp%3E%0AAfter%3A%0A%3Cscript%3E%0Afunction+fedpov%28house%2Cincome%2Cpercentage%29%7B%0A%09%2F%2F+Determines+if+your+income+is+less+than+or+equal+to%0A%09%2F%2F+a+percentage+of+the+2023+federal+poverty+guidelines%0A%09%2F%2F+for+the+contiguous+United+States.+See%0A%09%2F%2F+https%3A%2F%2Faspe.hhs.gov%2Fpoverty-guidelines%0A%0A%09%09var+line+%3D+NaN%3B%0A%0A%09%09if+%28house+%3D%3D+1%29+%7B%0A%09%09%09line+%3D+14580%3B%0A%09%09%7D+else+if+%28house+%3D%3D+2%29+%7B%0A%09%09%09line+%3D+19720%3B%0A%09%09%7D+else+if+%28house+%3D%3D+3%29+%7B%0A%09%09%09line+%3D+24860%3B%0A%09%09%7D+else+if+%28house+%3D%3D+4%29+%7B%0A%09%09%09line+%3D+30000%3B%0A%09%09%7D+else+if+%28house+%3D%3D+5%29+%7B%0A%09%09%09line+%3D+35140%3B%0A%09%09%7D+else+if+%28house+%3D%3D+6%29+%7B%0A%09%09%09line+%3D+40280%3B%0A%09%09%7D+else+if+%28house+%3D%3D+7%29+%7B%0A%09%09%09line+%3D+45420%3B%0A%09%09%7D+else+if+%28house+%3D%3D+8%29+%7B%0A%09%09%09line+%3D+50560%3B%0A%09%09%7D+else+if+%28house+%3E+8%29+%7B%0A%09%09%09line+%3D+50560+%2B+%28house-8%29%2A5140%3B%0A%09%09%7D%0A%0A%09%09if+%28income+%3C%3D+%28line%2A%28percentage%2F100%29%29%29+%7B%0A%09%09%09return+true%3B%0A%09%09%7D+else+%7B%0A%09%09%09return+false%3B%0A%09%09%7D%0A%09%7D%0A%3C%2Fscript%3E%0A%0AQ%281%29%3A+Do+your+receive+public+assistance%3F%0AA%3A+Yes%0A%09Q%281.1%29%3AGOTO%3Aqualaid%0AA%3A+No%0A%09Q%28house%29%3A+How+many+people+are+in+your+household%3F%0A%09X%3Anumber%0A%09%09Q%28income%29%3A+How+much+income+does+your+household+bring+in+per+year+in+after+tax+dollars%3F%0A%09%09X%3Anumber%0A%09%09%09Q%281.2.1.1%29%3A+Are+you+facing+a+civil+or+criminal+matter%3F%0A%09%09%09A%5Bjavascript%3Aif+%28fedpov%28getvar%28%27house%27%29%2Cgetvar%28%27income%27%29%2C125%29%29%7B+goto%28%27qualciv%27%29+%7D+else+%7B+goto%28%27noqualciv%27%29+%7D+%5D%3A+Civil%0A%09%09%09A%5Bjavascript%3Aif+%28fedpov%28getvar%28%27house%27%29%2Cgetvar%28%27income%27%29%2C125%29%29%7B+goto%28%27qualcrim%27%29+%7D+else+if+%28fedpov%28getvar%28%27house%27%29%2Cgetvar%28%27income%27%29%2C250%29%29+%7B+goto%28%27noqualbut%27%29+%7D+else+%7B+goto%28%27noqualcrim%27%29+%7D+%5D%3A+Criminal%0A%0AQ%28qualaid%29%3A+You+probably+qualify+as+indigent+because+you+receive+public+assistance.+See+%3Ca+href%3D%22http%3A%2F%2Fwww.mass.gov%2Fcourts%2Fcase-legal-res%2Frules-of-court%2Fsjc%2Fsjc310.html%22+target%3D_new%3ESJC+Rule+3%3A10%3C%2Fa%3E+and+%3Ca+href%3D%22https%3A%2F%2Fmalegislature.gov%2FLaws%2FGeneralLaws%2FPartIII%2FTitleVI%2FChapter261%2FSection27A%22+target%3D_new%3EM.G.L.+Chapter+261+MA+Sec.+27A%3C%2Fa%3E.%0A%0AQ%28qualciv%29%3A+You+probably+qualify+as+indigent+since+you+earn+less+than+125%25+of+the+poverty+line.+See+%3Ca+href%3D%22https%3A%2F%2Fmalegislature.gov%2FLaws%2FGeneralLaws%2FPartIII%2FTitleVI%2FChapter261%2FSection27A%22+target%3D_new%3EM.G.L.+Chapter+261+MA+%15+27A%3C%2Fa%3E.+Consequently%2C+you+may+be+eligible+to+have+your+court+fees+waived.+Would+you+like+me+to+open+up+a+fee+waiver+for+you+to+file%3F%0AA%3A%5Bhttps%3A%2F%2Fapps.suffolklitlab.org%2Fstart%2Findigency%5D+Yes%0A%09Q%283.1%29%3A+If+the+affidavit+of+indigency+didn%27t+open+in+a+new+window%2Ftab%2C+you+can+find+it+%3Ca+href%3D%22https%3A%2F%2Fapps.suffolklitlab.org%2Fstart%2Findigency%22%3Ehere%3C%2Fa%3E.%0AA%3A+No%0A%09Q%283.2%29%3AGOTO%3Anomore%0A%0AQ%28qualcrim%29%3A+You+probably+qualify+as+indigent+since+you+earn+less+than+125%25+of+the+poverty+line.+So+you%27ll+likely+be+assigned+a+lawyer+by+the+judge.+See+%3Ca+href%3D%22http%3A%2F%2Fwww.mass.gov%2Fcourts%2Fcase-legal-res%2Frules-of-court%2Fsjc%2Fsjc310.html%22+target%3D_new%3ESJC+Rule+3%3A10%3C%2Fa%3E.%0A%0AQ%28qualbut%29%3A+You+probably+qualify+as+indigent+but+able+to+contribute+since+you+earn+between+125%25+and+250%25+of+the+poverty+line.+So+you%27ll+likely+be+assigned+a+lawyer+and+asked+to+pay+a+small+fee.+See+%3Ca+href%3D%22http%3A%2F%2Fwww.mass.gov%2Fcourts%2Fcase-legal-res%2Frules-of-court%2Fsjc%2Fsjc310.html%22+target%3D_new%3ESJC+Rule+3%3A10%3C%2Fa%3E.%0A%0AQ%28noqualciv%29%3A+You+probably+won%27t+qualify+as+indigent+since+you+earn+more+than+125%25+of+the+poverty+line.+See+%3Ca+href%3D%22https%3A%2F%2Fmalegislature.gov%2FLaws%2FGeneralLaws%2FPartIII%2FTitleVI%2FChapter261%2FSection27A%22+target%3D_new%3EM.G.L.+Chapter+261+MA+Sec.+27A%3C%2Fa%3E.+So+you%27ll+probably+need+to+hire+an+attorney.+Would+you+like+to+search+for+one+near+you%3F%0AA%3A%5Bhttps%3A%2F%2Fwww.avvo.com%2Ffind-a-lawyer%5D+Yes.%0A%09Q%286.1%29%3AGOTO%3Anomore%0AA%3A+No%0A%09Q%286.2%29%3AGOTO%3Anomore%0A%0AQ%28noqualcrim%29%3A+You+probably+won%27t+qualify+as+indigent+or+indigent+but+able+to+contribute+since+you+earn+more+than+250%25+of+the+poverty+line.+So+you%27ll+probably+need+to+hire+an+attorney.+Would+you+like+to+search+for+one+near+you%3F%0AA%3A%5Bhttps%3A%2F%2Fwww.avvo.com%2Ffind-a-lawyer%5D+Yes.%0A%09Q%287.1%29%3AGOTO%3Anomore%0AA%3A+No%0A%09Q%287.2%29%3AGOTO%3Anomore%0A%0AQ%28nomore%29%3A+I%27m+afraid+there%27s+nothing+else+I+can+help+you+with.+I+hope+you+have+a+nice+day.%0A</div><div id="ondeck" name="ondeck"><div id='Q-1' name='Q-1' style='display:none;'> Do your receive public assistance?</div><div id='Q-1.1' name='Q-1.1' style='display:none;'>GOTO:2</div><div id='Q-1.2' name='Q-1.2' style='display:none;'> How many people are in your household?</div><div id='Q-1.2.1' name='Q-1.2.1' style='display:none;'> How much income does your household bring in per year in after tax dollars?</div><div id='Q-1.2.1.1' name='Q-1.2.1.1' style='display:none;'> Are you facing a civil or criminal matter?</div><div id='Q-2' name='Q-2' style='display:none;'> You probably qualify as indigent because you receive public assistance. See <a href="http://www.mass.gov/courts/case-legal-res/rules-of-court/sjc/sjc310.html" target=_new>SJC Rule 3:10</a> and <a href="https://malegislature.gov/Laws/GeneralLaws/PartIII/TitleVI/Chapter261/Section27A" target=_new>M.G.L. Chapter 261 MA Sec. 27A</a>.
</div><div id='Q-3' name='Q-3' style='display:none;'> You probably qualify as indigent since you earn less than 125% of the poverty line. See <a href="https://malegislature.gov/Laws/GeneralLaws/PartIII/TitleVI/Chapter261/Section27A" target=_new>M.G.L. Chapter 261 MA 27A</a>. Consequently, you may be eligible to have your court fees waived. Would you like me to open up a fee waiver for you to file?</div><div id='Q-3.1' name='Q-3.1' style='display:none;'> If the affidavit of indigency didn't open in a new window/tab, you can find it <a href="https://apps.suffolklitlab.org/start/indigency">here</a>.</div><div id='Q-3.2' name='Q-3.2' style='display:none;'>GOTO:8</div><div id='Q-4' name='Q-4' style='display:none;'> You probably qualify as indigent since you earn less than 125% of the poverty line. So you'll likely be assigned a lawyer by the judge. See <a href="http://www.mass.gov/courts/case-legal-res/rules-of-court/sjc/sjc310.html" target=_new>SJC Rule 3:10</a>.
</div><div id='Q-5' name='Q-5' style='display:none;'> You probably qualify as indigent but able to contribute since you earn between 125% and 250% of the poverty line. So you'll likely be assigned a lawyer and asked to pay a small fee. See <a href="http://www.mass.gov/courts/case-legal-res/rules-of-court/sjc/sjc310.html" target=_new>SJC Rule 3:10</a>.
</div><div id='Q-6' name='Q-6' style='display:none;'> You probably won't qualify as indigent since you earn more than 125% of the poverty line. See <a href="https://malegislature.gov/Laws/GeneralLaws/PartIII/TitleVI/Chapter261/Section27A" target=_new>M.G.L. Chapter 261 MA Sec. 27A</a>. So you'll probably need to hire an attorney. Would you like to search for one near you?</div><div id='Q-6.1' name='Q-6.1' style='display:none;'>GOTO:8</div><div id='Q-6.2' name='Q-6.2' style='display:none;'>GOTO:8</div><div id='Q-7' name='Q-7' style='display:none;'> You probably won't qualify as indigent or indigent but able to contribute since you earn more than 250% of the poverty line. So you'll probably need to hire an attorney. Would you like to search for one near you?</div><div id='Q-7.1' name='Q-7.1' style='display:none;'>GOTO:8</div><div id='Q-7.2' name='Q-7.2' style='display:none;'>GOTO:8</div><div id='Q-8' name='Q-8' style='display:none;'> I'm afraid there's nothing else I can help you with. I hope you have a nice day.
</div><div id='A-1.1' name='A-1.1' style='display:none;'> Yes</div><div id='A-href-1.1' name='A-href-1.1' style='display:none;'>javascript:void('');</div><div id='A-target-1.1' name='A-target-1.1' style='display:none;'></div><div id='X-1.1' name='X-1.1' style='display:none;'>Yes</div><div id='A-1.2' name='A-1.2' style='display:none;'> No</div><div id='A-href-1.2' name='A-href-1.2' style='display:none;'>javascript:void('');</div><div id='A-target-1.2' name='A-target-1.2' style='display:none;'></div><div id='X-1.2' name='X-1.2' style='display:none;'>No</div><div id='A-1.2.1' name='A-1.2.1' style='display:none;'><variable></div><div id='A-href-1.2.1' name='A-href-1.2.1' style='display:none;'>javascript:void('');</div><div id='A-target-1.2.1' name='A-target-1.2.1' style='display:none;'>number</div><div id='X-1.2.1' name='X-1.2.1' style='display:none;'>1.2.1</div><div id='A-1.2.1.1' name='A-1.2.1.1' style='display:none;'><variable></div><div id='A-href-1.2.1.1' name='A-href-1.2.1.1' style='display:none;'>javascript:void('');</div><div id='A-target-1.2.1.1' name='A-target-1.2.1.1' style='display:none;'>number</div><div id='X-1.2.1.1' name='X-1.2.1.1' style='display:none;'>1.2.1.1</div><div id='A-1.2.1.1.1' name='A-1.2.1.1.1' style='display:none;'> Civil</div><div id='A-href-1.2.1.1.1' name='A-href-1.2.1.1.1' style='display:none;'>javascript:if (fedpov(getvar('house'),getvar('income'),125)){ goto('qualciv') } else { goto('noqualciv') } </div><div id='A-target-1.2.1.1.1' name='A-target-1.2.1.1.1' style='display:none;'></div><div id='X-1.2.1.1.1' name='X-1.2.1.1.1' style='display:none;'>Civil</div><div id='A-1.2.1.1.2' name='A-1.2.1.1.2' style='display:none;'> Criminal
</div><div id='A-href-1.2.1.1.2' name='A-href-1.2.1.1.2' style='display:none;'>javascript:if (fedpov(getvar('house'),getvar('income'),125)){ goto('qualcrim') } else if (fedpov(getvar('house'),getvar('income'),250)) { goto('noqualbut') } else { goto('noqualcrim') } </div><div id='A-target-1.2.1.1.2' name='A-target-1.2.1.1.2' style='display:none;'></div><div id='X-1.2.1.1.2' name='X-1.2.1.1.2' style='display:none;'>Criminal</div><div id='A-3.1' name='A-3.1' style='display:none;'> Yes</div><div id='A-href-3.1' name='A-href-3.1' style='display:none;'>https://apps.suffolklitlab.org/start/indigency</div><div id='A-target-3.1' name='A-target-3.1' style='display:none;'>target="_blank" i="https://apps.suffolklitlab.org/start/indigency"</div><div id='X-3.1' name='X-3.1' style='display:none;'>Yes</div><div id='A-3.2' name='A-3.2' style='display:none;'> No</div><div id='A-href-3.2' name='A-href-3.2' style='display:none;'>javascript:void('');</div><div id='A-target-3.2' name='A-target-3.2' style='display:none;'></div><div id='X-3.2' name='X-3.2' style='display:none;'>No</div><div id='A-6.1' name='A-6.1' style='display:none;'> Yes.</div><div id='A-href-6.1' name='A-href-6.1' style='display:none;'>https://www.avvo.com/find-a-lawyer</div><div id='A-target-6.1' name='A-target-6.1' style='display:none;'>target="_blank" i="https://www.avvo.com/find-a-lawyer"</div><div id='X-6.1' name='X-6.1' style='display:none;'>Yes.</div><div id='A-6.2' name='A-6.2' style='display:none;'> No</div><div id='A-href-6.2' name='A-href-6.2' style='display:none;'>javascript:void('');</div><div id='A-target-6.2' name='A-target-6.2' style='display:none;'></div><div id='X-6.2' name='X-6.2' style='display:none;'>No</div><div id='A-7.1' name='A-7.1' style='display:none;'> Yes.</div><div id='A-href-7.1' name='A-href-7.1' style='display:none;'>https://www.avvo.com/find-a-lawyer</div><div id='A-target-7.1' name='A-target-7.1' style='display:none;'>target="_blank" i="https://www.avvo.com/find-a-lawyer"</div><div id='X-7.1' name='X-7.1' style='display:none;'>Yes.</div><div id='A-7.2' name='A-7.2' style='display:none;'> No</div><div id='A-href-7.2' name='A-href-7.2' style='display:none;'>javascript:void('');</div><div id='A-target-7.2' name='A-target-7.2' style='display:none;'></div><div id='X-7.2' name='X-7.2' style='display:none;'>No</div>
<script>
var QVnames = [['1','1'],['1.1','1.1'],['1.2','house'],['1.2.1','income'],['1.2.1.1','1.2.1.1'],['2','qualaid'],['3','qualciv'],['3.1','3.1'],['3.2','3.2'],['4','qualcrim'],['5','qualbut'],['6','noqualciv'],['6.1','6.1'],['6.2','6.2'],['7','noqualcrim'],['7.1','7.1'],['7.2','7.2'],['8','nomore']];
</script>
</div><textarea id="original" name="original" style="display:none;" disabled="disabled"><div id='Q-1' name='Q-1' style='display:none;'> Do your receive public assistance?</div><div id='Q-1.1' name='Q-1.1' style='display:none;'>GOTO:2</div><div id='Q-1.2' name='Q-1.2' style='display:none;'> How many people are in your household?</div><div id='Q-1.2.1' name='Q-1.2.1' style='display:none;'> How much income does your household bring in per year in after tax dollars?</div><div id='Q-1.2.1.1' name='Q-1.2.1.1' style='display:none;'> Are you facing a civil or criminal matter?</div><div id='Q-2' name='Q-2' style='display:none;'> You probably qualify as indigent because you receive public assistance. See <a href="http://www.mass.gov/courts/case-legal-res/rules-of-court/sjc/sjc310.html" target=_new>SJC Rule 3:10</a> and <a href="https://malegislature.gov/Laws/GeneralLaws/PartIII/TitleVI/Chapter261/Section27A" target=_new>M.G.L. Chapter 261 MA Sec. 27A</a>.
</div><div id='Q-3' name='Q-3' style='display:none;'> You probably qualify as indigent since you earn less than 125% of the poverty line. See <a href="https://malegislature.gov/Laws/GeneralLaws/PartIII/TitleVI/Chapter261/Section27A" target=_new>M.G.L. Chapter 261 MA 27A</a>. Consequently, you may be eligible to have your court fees waived. Would you like me to open up a fee waiver for you to file?</div><div id='Q-3.1' name='Q-3.1' style='display:none;'> If the affidavit of indigency didn't open in a new window/tab, you can find it <a href="https://apps.suffolklitlab.org/start/indigency">here</a>.</div><div id='Q-3.2' name='Q-3.2' style='display:none;'>GOTO:8</div><div id='Q-4' name='Q-4' style='display:none;'> You probably qualify as indigent since you earn less than 125% of the poverty line. So you'll likely be assigned a lawyer by the judge. See <a href="http://www.mass.gov/courts/case-legal-res/rules-of-court/sjc/sjc310.html" target=_new>SJC Rule 3:10</a>.
</div><div id='Q-5' name='Q-5' style='display:none;'> You probably qualify as indigent but able to contribute since you earn between 125% and 250% of the poverty line. So you'll likely be assigned a lawyer and asked to pay a small fee. See <a href="http://www.mass.gov/courts/case-legal-res/rules-of-court/sjc/sjc310.html" target=_new>SJC Rule 3:10</a>.
</div><div id='Q-6' name='Q-6' style='display:none;'> You probably won't qualify as indigent since you earn more than 125% of the poverty line. See <a href="https://malegislature.gov/Laws/GeneralLaws/PartIII/TitleVI/Chapter261/Section27A" target=_new>M.G.L. Chapter 261 MA Sec. 27A</a>. So you'll probably need to hire an attorney. Would you like to search for one near you?</div><div id='Q-6.1' name='Q-6.1' style='display:none;'>GOTO:8</div><div id='Q-6.2' name='Q-6.2' style='display:none;'>GOTO:8</div><div id='Q-7' name='Q-7' style='display:none;'> You probably won't qualify as indigent or indigent but able to contribute since you earn more than 250% of the poverty line. So you'll probably need to hire an attorney. Would you like to search for one near you?</div><div id='Q-7.1' name='Q-7.1' style='display:none;'>GOTO:8</div><div id='Q-7.2' name='Q-7.2' style='display:none;'>GOTO:8</div><div id='Q-8' name='Q-8' style='display:none;'> I'm afraid there's nothing else I can help you with. I hope you have a nice day.
</div><div id='A-1.1' name='A-1.1' style='display:none;'> Yes</div><div id='A-href-1.1' name='A-href-1.1' style='display:none;'>javascript:void('');</div><div id='A-target-1.1' name='A-target-1.1' style='display:none;'></div><div id='X-1.1' name='X-1.1' style='display:none;'>Yes</div><div id='A-1.2' name='A-1.2' style='display:none;'> No</div><div id='A-href-1.2' name='A-href-1.2' style='display:none;'>javascript:void('');</div><div id='A-target-1.2' name='A-target-1.2' style='display:none;'></div><div id='X-1.2' name='X-1.2' style='display:none;'>No</div><div id='A-1.2.1' name='A-1.2.1' style='display:none;'><variable></div><div id='A-href-1.2.1' name='A-href-1.2.1' style='display:none;'>javascript:void('');</div><div id='A-target-1.2.1' name='A-target-1.2.1' style='display:none;'>number</div><div id='X-1.2.1' name='X-1.2.1' style='display:none;'>1.2.1</div><div id='A-1.2.1.1' name='A-1.2.1.1' style='display:none;'><variable></div><div id='A-href-1.2.1.1' name='A-href-1.2.1.1' style='display:none;'>javascript:void('');</div><div id='A-target-1.2.1.1' name='A-target-1.2.1.1' style='display:none;'>number</div><div id='X-1.2.1.1' name='X-1.2.1.1' style='display:none;'>1.2.1.1</div><div id='A-1.2.1.1.1' name='A-1.2.1.1.1' style='display:none;'> Civil</div><div id='A-href-1.2.1.1.1' name='A-href-1.2.1.1.1' style='display:none;'>javascript:if (fedpov(getvar('house'),getvar('income'),125)){ goto('qualciv') } else { goto('noqualciv') } </div><div id='A-target-1.2.1.1.1' name='A-target-1.2.1.1.1' style='display:none;'></div><div id='X-1.2.1.1.1' name='X-1.2.1.1.1' style='display:none;'>Civil</div><div id='A-1.2.1.1.2' name='A-1.2.1.1.2' style='display:none;'> Criminal
</div><div id='A-href-1.2.1.1.2' name='A-href-1.2.1.1.2' style='display:none;'>javascript:if (fedpov(getvar('house'),getvar('income'),125)){ goto('qualcrim') } else if (fedpov(getvar('house'),getvar('income'),250)) { goto('noqualbut') } else { goto('noqualcrim') } </div><div id='A-target-1.2.1.1.2' name='A-target-1.2.1.1.2' style='display:none;'></div><div id='X-1.2.1.1.2' name='X-1.2.1.1.2' style='display:none;'>Criminal</div><div id='A-3.1' name='A-3.1' style='display:none;'> Yes</div><div id='A-href-3.1' name='A-href-3.1' style='display:none;'>https://apps.suffolklitlab.org/start/indigency</div><div id='A-target-3.1' name='A-target-3.1' style='display:none;'>target="_blank" i="https://apps.suffolklitlab.org/start/indigency"</div><div id='X-3.1' name='X-3.1' style='display:none;'>Yes</div><div id='A-3.2' name='A-3.2' style='display:none;'> No</div><div id='A-href-3.2' name='A-href-3.2' style='display:none;'>javascript:void('');</div><div id='A-target-3.2' name='A-target-3.2' style='display:none;'></div><div id='X-3.2' name='X-3.2' style='display:none;'>No</div><div id='A-6.1' name='A-6.1' style='display:none;'> Yes.</div><div id='A-href-6.1' name='A-href-6.1' style='display:none;'>https://www.avvo.com/find-a-lawyer</div><div id='A-target-6.1' name='A-target-6.1' style='display:none;'>target="_blank" i="https://www.avvo.com/find-a-lawyer"</div><div id='X-6.1' name='X-6.1' style='display:none;'>Yes.</div><div id='A-6.2' name='A-6.2' style='display:none;'> No</div><div id='A-href-6.2' name='A-href-6.2' style='display:none;'>javascript:void('');</div><div id='A-target-6.2' name='A-target-6.2' style='display:none;'></div><div id='X-6.2' name='X-6.2' style='display:none;'>No</div><div id='A-7.1' name='A-7.1' style='display:none;'> Yes.</div><div id='A-href-7.1' name='A-href-7.1' style='display:none;'>https://www.avvo.com/find-a-lawyer</div><div id='A-target-7.1' name='A-target-7.1' style='display:none;'>target="_blank" i="https://www.avvo.com/find-a-lawyer"</div><div id='X-7.1' name='X-7.1' style='display:none;'>Yes.</div><div id='A-7.2' name='A-7.2' style='display:none;'> No</div><div id='A-href-7.2' name='A-href-7.2' style='display:none;'>javascript:void('');</div><div id='A-target-7.2' name='A-target-7.2' style='display:none;'></div><div id='X-7.2' name='X-7.2' style='display:none;'>No</div>
<script>
var QVnames = [['1','1'],['1.1','1.1'],['1.2','house'],['1.2.1','income'],['1.2.1.1','1.2.1.1'],['2','qualaid'],['3','qualciv'],['3.1','3.1'],['3.2','3.2'],['4','qualcrim'],['5','qualbut'],['6','noqualciv'],['6.1','6.1'],['6.2','6.2'],['7','noqualcrim'],['7.1','7.1'],['7.2','7.2'],['8','nomore']];
</script>
</textarea><textarea id="transcript" name="transcript" style="display:none;" disabled="disabled"></textarea><div style="float:left;width:100%;margin:15px 0 0px 0;border-top: solid 1px #ddd;"><div id=credits class=credits style="display:none;"><div class=credit_text><p><b> Massachusetts Indigency Calculator</b></p><p>By David Colarusso</p></div></div><p align=center><a href="javascript:void('');" onClick="shoh('credits');">credits</a> | <a href="https://www.qnamarkup.org/" target=_top>code your own</a></p></div></FORM>
<script>
function fedpov(house,income,percentage){
// Determines if your income is less than or equal to
// a percentage of the 2023 federal poverty guidelines
// for the contiguous United States. See
// https://aspe.hhs.gov/poverty-guidelines
var line = NaN;
if (house == 1) {
line = 14580;
} else if (house == 2) {
line = 19720;
} else if (house == 3) {
line = 24860;
} else if (house == 4) {
line = 30000;
} else if (house == 5) {
line = 35140;
} else if (house == 6) {
line = 40280;
} else if (house == 7) {
line = 45420;
} else if (house == 8) {
line = 50560;
} else if (house > 8) {
line = 50560 + (house-8)*5140;
}
if (income <= (line*(percentage/100))) {
return true;
} else {
return false;
}
}
</script>
</div></div>
<script type="text/javascript">
var QNum = 0;
var Qhtml = "";
var Dhtml = "";
var label = "";
var GOTOfired = 0;
var path = [];
var doc_bin = [];
var convo_bin = [];
var freetext = 0;
var goingback = 0;
$("#conversation input").on("keypress", 'form', function (e) {
var code = e.keyCode || e.which;
if (code == 13) {
e.preventDefault();
return false;
}
});
$('#FORM').on('keyup keypress', function(e) {
var keyCode = e.keyCode || e.which;
if (keyCode === 13) {
e.preventDefault();
return false;
}
});
function answerQ(lb,restart) {
currentQ = label;
label = lb;
Dhtml = 'D-'+label;
Qhtml = 'Q-'+label;
var Ahtml = 'A-'+label;
var Jhtml = 'J-'+QNum;
var Xhtml = 'X-'+label;
var Xihtml = 'Xi-'+label;
var input_error = 0;
if (restart == undefined) {
var regexp = new RegExp("\<variable\>");
//if (document.getElementById(Xihtml)) {
// console.log("document.getElementById("+Xihtml+").value: "+document.getElementById(Xihtml).value);
//} else {
// console.log("NO document.getElementById("+Xihtml+").value: ");
//}
if (document.getElementById(Ahtml).innerHTML.match(regexp)) {
document.getElementById(Xihtml).value = document.getElementById(Xihtml).value.replace(/(^\s*|\s*$)/,"");
if (document.getElementById(Xihtml).value == "") {
input_error = "Your answer appears to be empty.";
label = currentQ;
} else {
document.getElementById(Xihtml).value = document.getElementById(Xihtml).value.replace(/</g,"<");
document.getElementById(Xihtml).value = document.getElementById(Xihtml).value.replace(/>/g,">");
}
}
}
if (input_error != 0) {
alert(input_error);
document.getElementById(Xihtml).focus();
} else {
if (restart == undefined) {
//if (document.getElementById(Ahtml).innerHTML!="") {
document.getElementById('QandA').innerHTML += "<div id=\"break-at-"+QNum+"\" class='frame'><div class='full'><div class='ans_text'>"+document.getElementById(Ahtml).innerHTML+"</div></div><div class='ans_arrow'></div></div></div></div>";
//}
// insert answer from button
if (document.getElementById(valueis(currentQ))) {
document.getElementById(valueis(currentQ)).outerHTML='';
}
if (document.getElementById(Xihtml)) {
document.getElementById('QandA').innerHTML = "<textarea style=\"display:none;\" id=\""+valueis(currentQ)+"\" name=\""+valueis(currentQ)+"\">"+document.getElementById(Xihtml).value+"</textarea>\n" + document.getElementById('QandA').innerHTML
} else {
document.getElementById('QandA').innerHTML = "<textarea style=\"display:none;\" id=\""+valueis(currentQ)+"\" name=\""+valueis(currentQ)+"\">"+document.getElementById(Xhtml).innerHTML+"</textarea>\n" + document.getElementById('QandA').innerHTML
}
if (document.getElementById('QandA').innerHTML.match(regexp)) {
var duplicatevars = new RegExp("id=\""+document.getElementById(Xhtml).innerHTML+"(.)*"+document.getElementById(Xhtml).innerHTML+"\"","g");
document.getElementById('QandA').innerHTML = document.getElementById('QandA').innerHTML.replace(duplicatevars, "");
document.getElementById('QandA').innerHTML = document.getElementById('QandA').innerHTML.replace(/\<variable\>(\<\/variable\>)?/, "<input type=hidden id=\""+document.getElementById(Xhtml).innerHTML+"\" name=\""+document.getElementById(Xhtml).innerHTML+"\" value=\""+document.getElementById(Xihtml).value+"\"/>"+document.getElementById(Xihtml).value);
//document.getElementById('transcript').value = document.getElementById('transcript').value.replace(/\<variable\>(\<\/variable\>)?/, document.getElementById(Xihtml).value+"\n");
var thisvariable = new RegExp("<(X|x)>"+document.getElementById(Xhtml).innerHTML+"<\/(X|x)>","g");
//document.getElementById('doc').innerHTML = document.getElementById('doc').innerHTML.replace(thisvariable, document.getElementById(document.getElementById(Xhtml).innerHTML).innerHTML);
//document.getElementById('ondeck').innerHTML = document.getElementById('ondeck').innerHTML.replace(thisvariable, document.getElementById(valueis(currentQ)).innerHTML);
//console.log("thisvariable: "+thisvariable);
//console.log("Variable name: "+valueis(currentQ));
//console.log("Variable value: "+document.getElementById(valueis(currentQ)).innerHTML);
if(document.getElementById(Ahtml).innerHTML != "") {
//document.getElementById('transcript').value += "USER: "+document.getElementById(Xihtml).value+"\n";
convo_bin.push("USER: "+document.getElementById(Xihtml).value+"\n");
}
} else {
//document.getElementById('transcript').value += "USER: "+document.getElementById(Ahtml).innerHTML+"\n";
convo_bin.push("USER: "+document.getElementById(Ahtml).innerHTML+"\n");
}
document.getElementById('Choices').innerHTML = '';
if (goingback == 0) {
setTimeout(function() {renderQnA(Qhtml,Jhtml,Dhtml,restart)}, 300);
} else {
renderQnA(Qhtml,Jhtml,Dhtml,restart);
}
} else {
document.getElementById('Choices').innerHTML = '';
path = [];
renderQnA(Qhtml,Jhtml,Dhtml,restart);
}
}
}
function renderQnA(Qht,Jht,Dht,restar) {
Dhtml = Dht;
GOTOfired = 0;
path.push(label);
swapGOTO(Qht,Jht);
console.log("After swap: "+GOTOfired);
if (GOTOfired == 0) {
document.getElementById('QandA').innerHTML += "<div id="+Jht+" style=\"float:left;width:100%;height:1px;\"> </div>";
}
document.getElementById('QandA').innerHTML += "<div class='frame'><div class='full'><div class='question_text'>"+swapvar(document.getElementById(Qhtml).innerHTML)+"</div></div><div class='question_arrow'></div></div>";
document.getElementById('QandA').innerHTML = document.getElementById('QandA').innerHTML.replace(/(\<br\>){2}/gi,"</div></div><div class='question_arrow'></div></div></div></div><div class='frame'><div class='full'><div class='question_text'>");
document.getElementById('QandA').innerHTML = document.getElementById('QandA').innerHTML.replace(/(\<br\> \<br\>)/gi,"<br><br>");
// add question
//document.getElementById('transcript').value += swapvar("BOT: "+ document.getElementById(Qhtml).innerHTML);
//document.getElementById('transcript').value = document.getElementById('transcript').value.replace(/(\<br\>){2}/gi,"\nBOT: ");
this_text = swapvar("BOT: "+ document.getElementById(Qhtml).innerHTML);
this_text = this_text.replace(/(\<br\>){2}/gi,"\nBOT: ");
convo_bin.push(this_text);
// make push doc into array in doc() cycle through array and put into output
// maybe remove doc div
if (document.getElementById(Dhtml)) {
doc_bin.push([document.getElementById(Dhtml).innerHTML,currentQ]);
console.log("Add to Doc ("+Dhtml+"): "+document.getElementById(Dhtml).innerHTML);
//document.getElementById('doc').innerHTML += document.getElementById(Dhtml).innerHTML;
}
tmp = getElementsByIdRegExp("div", "A-"+label+"(\\.{1}\\d){1}$");
a_href = getElementsByIdRegExp("div", "A-href-"+label+"(\\.{1}\\d){1}$");
a_target = getElementsByIdRegExp("div", "A-target-"+label+"(\\.{1}\\d){1}$");
tmp_x = getElementsByIdRegExp("div", "X-"+label+"(\\.{1}\\d){1}$");
var Xishere = 0;
for ( var i = 0; i < tmp.length; i++ ) {
var nextlabel = tmp[i].id.substr(2);
var Xihtml = 'Xi-'+nextlabel;
var regexp = "\<variable\>";
var regexp_js = "^javascript:";
var regexp_load_js = "loadQnA";
var script_call = "";
if (tmp[i].innerHTML.match(regexp)) {
if (a_href[i].innerHTML.match('^(_blank:)?javascript:')) {
script_call = a_href[i].innerHTML.replace(/^(_blank:)?javascript:/gi,"");
} else {
if (a_href[i].innerHTML.match('^_blank:')) {
script_call = "window.open('"+a_href[i].innerHTML.replace(/^_blank:/,"")+"','_blank');";
} else {
script_call = "location.href = '"+a_href[i].innerHTML+"';";
}
}
if(a_href[i].innerHTML.match(regexp_load_js)){
//script_call = "xv = document.getElementById('"+Xihtml+"').value;" + script_call.replace(/this\.innerHTML/gi,"xv")
script_call = script_call.replace(/this\.innerHTML/gi,"document.getElementById('"+Xihtml+"').value")
document.getElementById('Choices').innerHTML += "<div class=\"xdiv\"><input type=\""+a_target[i].innerHTML+"\" id=\""+Xihtml+"\" name=\""+Xihtml+"\" class=\"xinput\" onkeypress=\"if (event.keyCode==13){"+script_call+"}\"/><a href=\"javascript:void('');\" class=\"xbutton\" onClick=\""+script_call+"\"><span class=\"qpad\">Send</span></a></div>";
} else {
script_call = script_call.replace(/this\.innerHTML/gi,"document.getElementById('"+Xihtml+"').value")
document.getElementById('Choices').innerHTML += "<div class=\"xdiv\"><input type=\""+a_target[i].innerHTML+"\" id=\""+Xihtml+"\" name=\""+Xihtml+"\" class=\"xinput\" onkeypress=\"if (event.keyCode==13){answerQ('"+nextlabel+"');"+script_call+"}\"/><a href=\"javascript:void('');\" class=\"xbutton\" onClick=\"answerQ('"+nextlabel+"');"+script_call+"\"><span class=\"qpad\">Send</span></a></div>";
}
Xishere = Xihtml;
freetext = Xihtml;
} else if (a_href[i].innerHTML.match(regexp_js) && a_href[i].innerHTML != "javascript:void('');") {
tmp[i].innerHTML = tmp[i].innerHTML.replace(/(\<br\>){2}/gi,"<br> <br>");
var script_call = a_href[i].innerHTML.replace(/^javascript:/gi,"");
if(a_href[i].innerHTML.match(regexp_load_js)){
document.getElementById('Choices').innerHTML += "<a href=\"javascript:void('');\" class=\"qabutton\" onClick=\""+script_call+"\" "+a_target[i].innerHTML+"><span class=\"qpad\">"+tmp[i].innerHTML+"</span></a>";
} else {
document.getElementById('Choices').innerHTML += "<a href=\"javascript:void('');\" class=\"qabutton\" onClick=\"answerQ('"+nextlabel+"');"+script_call+"\" "+a_target[i].innerHTML+"><span class=\"qpad\">"+tmp[i].innerHTML+"</span></a>";
}
freetext = 0;
} else {
tmp[i].innerHTML = tmp[i].innerHTML.replace(/(\<br\>){2}/gi,"<br> <br>");
document.getElementById('Choices').innerHTML += "<a href=\""+a_href[i].innerHTML+"\" class=\"qabutton\" onClick=\"answerQ('"+nextlabel+"');\" "+a_target[i].innerHTML+"><span class=\"qpad\">"+tmp[i].innerHTML+"</span></a>";
freetext = 0;
}
}
if (restar == undefined) {
document.getElementById('Choices').innerHTML += "<div class=\"standard_buttons\">";
if (QNum > 1) {
document.getElementById('Choices').innerHTML += "<a href=\"javascript:void('');\" class=\"sbutton\" onClick=\"goback(QNum);\">GO BACK ONE</a>";
document.getElementById('Choices').innerHTML += "<a href=\"javascript:void('');\" class=\"sbutton\" style=\"float:right\" onClick=\"startAT('1');\">START OVER</a>";
} else if (QNum == 1) {
document.getElementById('Choices').innerHTML += "<a href=\"javascript:void('');\" class=\"sbutton\" onClick=\"startAT('1');\">GO BACK ONE</a>";
document.getElementById('Choices').innerHTML += "<a href=\"javascript:void('');\" class=\"sbutton\" style=\"float:right\" onClick=\"startAT('1');\">START OVER</a>";
}
document.getElementById('Choices').innerHTML += "</div>"
}
if (QNum != 0) {
if (goingback == 0) {
scroll2Q(Jht,800);
} else {
window.scrollTo(0, document.getElementById(Jht).offsetTop);
}
} else if (restar != undefined) {
window.scrollTo(0,0);
}
if (Xishere != 0 && window.self == window.top) {
console.log("Set focus for: "+Xishere);
document.getElementById(Xishere).focus();
}
console.log("Q#: "+QNum);
console.log("New Path: "+path);
QNum++;
goingback = 0;
}
function swapGOTO(QH,JH) {
var regex = new RegExp("GOTO:(\d*)(\.\d+)*");
if (regex.test(document.getElementById(QH).innerHTML)) {
var Qtext = document.getElementById(QH).innerHTML.match(/(GOTO:(\d*)(.\s*\d+)*)/);
document.getElementById('QandA').innerHTML += "<div id="+JH+" style=\"float:left;width:100%;height:1px;\"> </div>";
// Add question
// note I added () around the < to avoid a < followed by a ? which causes problems in php
var Qtexttrans = document.getElementById(QH).innerHTML.replace(/(<)?GOTO:(\d*)(.\s*\d+)*>?/,"");
Qtexttrans = Qtexttrans.replace(/\s*$/,"");
if (Qtexttrans != "") {
//document.getElementById('transcript').value += swapvar("BOT: "+Qtexttrans+"\n");
convo_bin.push(swapvar("BOT: "+Qtexttrans+"\n"));
}
if (document.getElementById(QH).innerHTML.match(/^GOTO:(\d*)(.\s*\d+)*/)) {
document.getElementById('QandA').innerHTML += document.getElementById(QH).innerHTML.replace(/(<)?GOTO:(\d*)(.\s*\d+)*>?/,"<"+Qtext+">");
} else {
document.getElementById('QandA').innerHTML += "<div class='frame'><div class='full'><div class='question_text'>"+ swapvar(document.getElementById(QH).innerHTML.replace(/(<)?GOTO:(\d*)(.\s*\d+)*>?/,"<"+Qtext+">"))+"</div></div><div class='question_arrow'></div></div>";
}
// replace GOTO with text
label = Qtext[0].replace("GOTO:","");
Qhtml = 'Q-'+label;
if (document.getElementById(Dhtml)) {
doc_bin.push([document.getElementById(Dhtml).innerHTML,currentQ]);
console.log("Add to Doc ("+Dhtml+"): "+document.getElementById(Dhtml).innerHTML);
//document.getElementById('doc').innerHTML += document.getElementById(Dhtml).innerHTML;
}
Dhtml = 'D-'+label;
GOTOfired = 1;
console.log("In swap: "+GOTOfired);
swapGOTO(Qhtml,JH);
}
}
function scroll2Q(id,speed) {
var top = document.getElementById(id).offsetTop; //Getting Y of target element
console.log("Jump to Y for ("+id+"): "+top);
//adapted from https://github.com/Yappli/smooth-scroll
var moving_frequency = 5; // Affects performance !
var hop_count = speed/moving_frequency
var getScrollTopDocumentAtBegin = document.documentElement.scrollTop + document.body.scrollTop;
var gap = (top - getScrollTopDocumentAtBegin) / hop_count;
for(var i = 1; i <= hop_count; i++)
{
(function()
{
var hop_top_position = gap*i;
setTimeout(function(){ window.scrollTo(0, hop_top_position + getScrollTopDocumentAtBegin); }, moving_frequency*i);
})();
}
}
function getElementsByIdIs(selectorTag, name) {
var items = [];
var myPosts = document.getElementsByTagName(selectorTag);
//omitting undefined null check for brevity
if (myPosts[0].id == name) {
items.push(myPosts[0]);
}
return items;
}
function getElementsByIdRegExp(selectorTag, expression) {
// note you need to escape \ in the expression with \, i.e., \\ = \
var regex = new RegExp(expression);
var items = [];
var myPosts = document.getElementsByTagName(selectorTag);
for (var i = 0; i < myPosts.length; i++) {
if (regex.test(myPosts[i].id)) {
items.push(myPosts[i]);
}
}
return items;
}
// startAT QnA
function startAT(id) {
document.getElementById('ondeck').innerHTML = document.getElementById('original').value;
document.getElementById('QandA').innerHTML = "";
//document.getElementById('transcript').value = "";
doc_bin = [];
convo_bin = [];
QNum = 0;
answerQ(id,'1');
}
//show funtion
function show(id) {
if (document.getElementById) { // DOM3 = IE5, NS6
document.getElementById(id).style.display = 'block';
} else {
if (document.layers) {
document.id.display = 'block';
} else {
document.all.id.style.display = 'block';
}
}
}
//hide funtion
function hide(id) {
if (document.getElementById) { // DOM3 = IE5, NS6
document.getElementById(id).style.display = 'none';
} else {
if (document.layers) {
document.id.display = 'none';
} else {
document.all.id.style.display = 'none';
}
}
}
//show OR hide funtion depends on if element is shown or hidden
function shoh(id) {
if (document.getElementById) { // DOM3 = IE5, NS6
if (document.getElementById(id).style.display == "none"){
document.getElementById(id).style.display = 'block';
} else {
document.getElementById(id).style.display = 'none';
}
} else {
if (document.layers) {
if (document.id.display == "none"){
document.id.display = 'block';
} else {
document.id.display = 'none';
}
} else {
if (document.all.id.style.visibility == "none"){
document.all.id.style.display = 'block';
} else {
document.all.id.style.display = 'none';
}
}
}
}
function swapvar(input) {
var output;
for(var i = 0; i < QVnames.length; i++) {
if (document.getElementById(QVnames[i][1])) {
var item = QVnames[i][1].replace(/\./g,"\\.");
var varegx = new RegExp("<x>"+item+"<\/x>","gi");
//console.log(QVnames[i][1]);
input = input.replace(varegx,document.getElementById(QVnames[i][1]).innerHTML);
}
}
output = input
return output
}
function docforindex(indexID) {
for(var i = 0; i < doc_bin.length; i++) {
if(doc_bin[i][1] == indexID) {
return true;
}
}
}
function indexis(variablename) {
for(var i = 0; i < QVnames.length; i++) {
if(QVnames[i][1] == variablename) {
return QVnames[i][0];
}
}
}
function valueis(variablekey) {
for(var i = 0; i < QVnames.length; i++) {
if(QVnames[i][0] == variablekey) {
return QVnames[i][1];
}
}
}
function look4goto(qn,id) {
console.log("GOTO SEARCH: "+id);
var qID = "Q-"+id;
// If there's a doc in the XXXXXXXXXXXXXXXX, remove it.
if (docforindex(path.indexOf(id))) {
console.log("DOC FOUND "+id);
doc_bin.splice(doc_bin.length-1,1);
}
convo_bin.splice(-2,2);
var re = new RegExp("GOTO:(([a-z0-9\._-]*)\s*)$","gi");
if (document.getElementById(qID).innerHTML.match(re)) {
convo_bin.splice(-1,1);
console.log("GOTO FOUND: "+id);
textinput = re.exec(document.getElementById(qID).innerHTML)[2]+"";
if (docforindex(indexis(textinput))) {
document.getElementById("Xi-"+path[qn]).value = document.getElementById(valueis(textinput)).innerHTML;
console.log("DOC FOUND "+textinput);
doc_bin.splice(doc_bin.length-1,1);
}
look4goto(qn,textinput);
}
}
function goback(qn) {
Qlast = qn - 3
qn = qn - 2;
label = path[qn];
goingback = 1;
console.log("GO BACK TO:"+qn);
var re = new RegExp('(((^|\\n).*)*)<div id="break-at-'+qn+'" class="frame">((.*)(\\W.*))*', 'g');
document.getElementById("QandA").innerHTML = document.getElementById("QandA").innerHTML.replace(re, '$1');
document.getElementById('Choices').innerHTML += "<input type=\"hidden\" id=\"Xi-"+path[qn]+"\" name=\"Xi-"+path[qn]+"\" value=\"\">";
console.log("####################: "+path[path.length-1]);
//look4goto(qn,path[path.length-1]);
path.splice(-1,1);
convo_bin.splice(-4,4);
//convo_bin.splice(-2,2);
// If there's a doc in the last Q that you're removing, hold on to it.
// And put it back after you've removed it. When you rerender the Q.
if (document.getElementById("X-"+path[qn]) && document.getElementById(valueis(path[Qlast]))) {
document.getElementById("Xi-"+path[qn]).value = document.getElementById(valueis(path[Qlast])).innerHTML;
doc_bin.splice(doc_bin.length-1,1);
}
// If there's a doc in the current Q, remove it.
if (docforindex(currentQ)) {
console.log("DOC FOUND (current) "+currentQ);
doc_bin.splice(doc_bin.length-1,1);
}
// If there's a doc in the queued up Q, remove it.
if (document.getElementById(Dhtml)) {
console.log("DOC FOUND (ondeck)"+Dhtml);
doc_bin.splice(doc_bin.length-1,1);
}
look4goto(qn,path[path.length-1]);
if (freetext != 0) {
document.getElementById(freetext).value = "";
}
QNum = qn;
loadQ = path[path.length-1];
path.splice(-1,1);
console.log("Reload ans for: "+loadQ);
answerQ(loadQ);
}
function transcript(output) {
var convo_output = "";
for (var i = 0, len = convo_bin.length; i < len; i++) {
convo_output += convo_bin[i];
}
if (output == 1) {
return convo_output;
} else {
return convo_output.replace(/<[^>]*>/g,"");
}
}
function doc() {
var doc_output = "";
for (var i = 0, len = doc_bin.length; i < len; i++) {
doc_output += doc_bin[i][0];
}
return swapvar(doc_output);
}
function json_str() {
var json_list = "{";
for(var i = 0; i < QVnames.length; i++) {
if (!document.getElementById("Q-"+QVnames[i][0]).innerHTML.match(/(GOTO:(\d*)(.\s*\d+)*)/)) {
if (document.getElementById(QVnames[i][1])) {
json_list = json_list+'"'+QVnames[i][1]+'":"'+document.getElementById(QVnames[i][1]).innerHTML+'"';
} else {
json_list = json_list+'"'+QVnames[i][1]+'":"'+'"';
}
json_list = json_list+",";
}
if (i+1 == QVnames.length) {
json_list = json_list.replace(/,$/, '');
json_list = json_list+"}";
}
}
return json_list;
}
function mail2(to,subject,body) {
to = encodeURIComponent(to);
subject = encodeURIComponent(subject);
body = encodeURIComponent(body);
window.location.href = "mailto:"+to+"?subject="+subject+"&body="+body;
}
function submit2(action,method,docAs,instructions,transcriptAs,jsonAs,target) {
document.FORM.action = action;
document.FORM.method = method;
if (target) {
document.FORM.target = target;
} else {
document.FORM.target = "_self";
}
if (docAs) {
if (document.getElementsByName(docAs).length == 0) {
var doctext = document.createElement("textarea");
doctext.style.display ='none';
doctext.name= docAs;
doctext.value= doc();
document.getElementById('FORM').appendChild(doctext);
} else {
$('textarea[name='+docAs+']').val(json_str())
}
if (instructions) {
if (document.getElementsByName('i').length == 0) {
var instructtext = document.createElement("textarea");
instructtext.type='hidden';
instructtext.style.display ='none';
instructtext.name= 'i';
instructtext.value= instructions;
document.getElementById('FORM').appendChild(instructtext);
} else {
$('textarea[name=i]').val(json_str())
}
}
}
if (transcriptAs) {
if (document.getElementsByName(transcriptAs).length == 0) {
var ttext = document.createElement("textarea");
ttext.type='hidden';
ttext.style.display ='none';
ttext.name= transcriptAs;
ttext.value= transcript();
document.getElementById('FORM').appendChild(ttext);
} else {
$('textarea[name='+transcriptAs+']').val(json_str())
}
}
if (jsonAs) {
if (document.getElementsByName(jsonAs).length == 0) {
var json = document.createElement("textarea");
json.type='hidden';
json.style.display ='none';
json.name= jsonAs;
json.value= json_str();
document.getElementById('FORM').appendChild(json);
} else {
$('textarea[name='+jsonAs+']').val(json_str())
}
}
var ondeckdiv = document.getElementById('ondeck').innerHTML;
var rawmarkupdiv = document.getElementById('rawmarkup').innerHTML;
document.getElementById('ondeck').innerHTML = "";
document.getElementById('rawmarkup').innerHTML = "";
document.FORM.submit();
document.getElementById('ondeck').innerHTML = ondeckdiv;
document.getElementById('rawmarkup').innerHTML = rawmarkupdiv;
}
function csv() {
var csv_list = "";
for(var i = 0; i < QVnames.length; i++) {
if (!document.getElementById("Q-"+QVnames[i][0]).innerHTML.match(/(GOTO:(\d*)(.\s*\d+)*)/)) {
csv_list = csv_list+'"'+QVnames[i][1]+'"';
csv_list = csv_list+",";
}
if (i+1 == QVnames.length) {
csv_list = csv_list.replace(/,$/, '');
csv_list = csv_list+"\n";
}
}
for(var i = 0; i < QVnames.length; i++) {
if (!document.getElementById("Q-"+QVnames[i][0]).innerHTML.match(/(GOTO:(\d*)(.\s*\d+)*)/)) {
if (document.getElementById(QVnames[i][1])) {
csv_list = csv_list+'"'+document.getElementById(QVnames[i][1]).innerHTML+'"';
} else {
csv_list = csv_list+'""';
}
csv_list = csv_list+",";
}
if (i+1 == QVnames.length) {
csv_list = csv_list.replace(/,$/, '');
csv_list = csv_list+"\n";
}
}
return csv_list;
}
function getvar(val) {
return document.getElementById(val).value;
}
function goto(val) {
answerQ(indexis(val));
}
// h/t http://runnable.com/U5HC9xtufQpsu5aj/use-javascript-to-save-textarea-as-a-txt-file
function save2(filename,content)
{
// I'm using file system support as a proxy for support for this feature.
// Check based on one found at: http://blog.teamtreehouse.com/building-an-html5-text-editor-with-the-filesystem-apis
// Handle vendor prefixes.
window.requestFileSystem = window.requestFileSystem ||
window.webkitRequestFileSystem;
// Check for support.
if (window.requestFileSystem) {
// content = ID of textarea to save
// name = name to save file as, including file extension
// grab the content of the form field and place it into a variable
// var textToWrite = document.getElementById(content).value;
// create a new Blob (html5 magic) that conatins the data from your form feild
var textFileAsBlob = new Blob([content], {type:'text/plain'});
// Specify the name of the file to be saved
var fileNamecontentAs = filename;
// Optionally allow the user to choose a file name by providing
// an imput field in the HTML and using the collected data here
// var fileNamecontentAs = txtFileName.text;
// create a link for our script to 'click'
var downloadLink = document.createElement("a");
// supply the name of the file (from the var above).
// you could create the name here but using a var
// allows more flexability later.
downloadLink.download = fileNamecontentAs;
// provide text for the link. This will be hidden so you
// can actually use anything you want.
downloadLink.innerHTML = "My Hidden Link";
// allow our code to work in webkit & Gecko based browsers
// without the need for a if / else block.
window.URL = window.URL || window.webkitURL;
// Create the link Object.
downloadLink.href = window.URL.createObjectURL(textFileAsBlob);
// when link is clicked call a function to remove it from
// the DOM in case user wants to save a second file.
downloadLink.onclick = destroyClickedElement;
// make sure the link is hidden.
downloadLink.style.display = "none";
// add the link to the DOM
document.body.appendChild(downloadLink);
// click the new link
downloadLink.click();
} else {
alert('This feature is not supported by your browser.');
}
}
function destroyClickedElement(event)
{
// remove the link from the DOM
document.body.removeChild(event.target);
}
// EOF
</script>
Note: in order to render correctly in Internet Explorer, the following needs to be added to the page's header <meta http-equiv="X-UA-Compatible" content="IE=edge" />
HTML, full-page text.
Or cut-and-paste the text below.
Massachusetts Indigency Calculator
<style>
body {
font-family: 'Palatino Linotype', 'Book Antiqua', Palatino, serif;
}
#rawmarkup{
display:none;
}
#QandA img{
width:100%;
}
div.main{
min-width:300px;
max-width:650px;
margin: 0 auto;
padding:0 5px 0 5px;
}
div.frame{
float:left;
width:100%;
margin:5px 0 5px 0;
}
div.full{
float:left;
width:100%;
}
.button{
padding:8px;
margin:8px 0 0px 0;
width:100%;
}
div.question_text{
float:left;
font-family: Verdana, Geneva, sans-serif;
font-size: 14px;
line-height: 20px;
color:#ffffff;
min-width:30px;
background:#5489eb;
border-radius: 15px;
padding:10px 15px 14px 15px;
margin-right:45px;
}
div.question_text a:link, div.question_text a:hover, div.question_text a:active, div.question_text a:visited{ color:#e3fbfc; }
div.question_arrow{
float:left;
width: 0;
height: 0;
border-left: 5px solid transparent;
border-right: 10px solid transparent;
border-top: 15px solid #5489eb;
margin:0 20px;
}
div.ans_text{
float:right;
font-family: Verdana, Geneva, sans-serif;
font-size: 14px;
line-height: 20px;
color:#000000;
min-width:30px;
background:#eeeeee;
border-radius: 15px;
padding:10px 15px 14px 15px;
margin-left:45px;
}
div.ans_arrow{
float:right;
width: 0;
height: 0;
border-left: 10px solid transparent;
border-right: 5px solid transparent;
border-top: 15px solid #eeeeee;
margin:0 20px;
}
div.choices{
float:left;
width:100%;
margin:15px 0 0 0;
}
div.standard_buttons{
float:left;
width:100%;
margin-top:5px;
border-top: 1px solid #ddd;
padding-top:12px;
}
div.credits{
float:left;
dispaly:none;
width:100%;
background:#eee;
margin:0px 0 15px 0;
}
div.credit_text{
font-family: Verdana, Geneva, sans-serif;
font-size: 14px;
line-height: 20px;
padding:4px 15px 10px 15px;
}
li.error{
list-style-type: none;
background:#ffdddd;
margin: 10px 0 0 0;
padding: 5px;
}
.qpad {
float:left;
padding:0 15px;
}
a.sbutton {
float:left;
font-family: Verdana, Geneva, sans-serif;
font-size: 14px;
line-height: 20px;
width:48%;
background: #eee;
border-radius: 8px;
padding:10px 0px 12px 0;
margin: 0 0 3px 0;
border: solid 1px #888;
text-align:center;
color: #000000;
text-decoration: none;
}
a.sbutton:hover, a.sbutton:active {
float:left;
font-family: Verdana, Geneva, sans-serif;
font-size: 14px;
line-height: 20px;
width:48%;
background: #ddd;
border-radius: 8px;
padding:10px 0px 12px 0;
margin: 0 0 3px 0;
border: solid 1px #888;
text-align:center;
color: #000000;
text-decoration: none;
}
a.qabutton {
float:left;
font-family: Verdana, Geneva, sans-serif;
font-size: 14px;
line-height: 20px;
width:100%;
background: #eee;
border-radius: 8px;
padding:10px 0px 12px 0;
margin: 0 0 8px 0;
border: solid 1px #888;
text-align:left;
color: #000000;
text-decoration: none;
}
a.qabutton:hover, a.qabutton:active {
float:left;
font-family: Verdana, Geneva, sans-serif;
font-size: 14px;
line-height: 20px;
width:100%;
background: #ddd;
border-radius: 8px;
padding:10px 0px 12px 0;
margin: 0 0 8px 0;
border: solid 1px #888;
text-align:left;
color: #000000;
text-decoration: none;
}
div.xdiv {
float:left;
width:100%;
margin: 0 0 8px 0;
background: #eee;
border: solid 1px #888;
border-radius: 8px;
}
input.xinput {
-webkit-box-sizing: border-box; /* Safari/Chrome, other WebKit */
-moz-box-sizing: border-box; /* Firefox, other Gecko */
box-sizing: border-box; /* Opera/IE 8+ */
float:left;
width:100%;
font-family: Verdana, Geneva, sans-serif;
font-size: 14px;
line-height: 20px;
background: #fff;
border-top-left-radius: 8px;
border-top-right-radius: 8px;
padding:10px 10px 12px 10px;
border: solid 0px #888;
border-bottom: solid 1px #888;
text-align:left;
color: #000000;
text-decoration: none;
}
a.xbutton {
float:left;
width:100%;
text-align:left;
font-family: Verdana, Geneva, sans-serif;
font-size: 14px;
line-height: 20px;
background: #eee;
border-radius: 8px;
padding:10px 0px 12px 0px;
color: #000000;
text-decoration: none;
}
a.xbutton:hover, a.xbutton:active {
border-top-left-radius: 0px;
border-top-right-radius: 0px;
background: #ddd;
}
</style>
<FORM name="FORM" id="FORM"><div id="conversation" style="margin:15px auto 0 auto;padding:0 15px;max-width:500px"> <link rel="stylesheet" type="text/css" href="https://projects.suffolklitlab.org/howto/qna/style/style.css">
<div id="icon" style="background-size: 110px 99px;background-image: url('https://projects.suffolklitlab.org/howto/qna/images/maxheadroom.gif');"></div>
<h2 style="text-align:center;">Massachusetts Indigency Calculator</h2>
<p><b>This is a <a href="https://www.codingthelaw.org/Fall_2023/level/2/#mission_p2">class project</a>. You should not rely on it as a source of legal information. It is likely incomplete.</b></p>
<p>Answer the following questions to see if you qualify for an appointment of counsel or fee waiver.</p>
<div id='QandA' class='QandA'><div style='padding:15px;background:#ddffdd;text-align:center;'>Loading QnA...</div></div><div id='Choices' class='choices'></div><div id="rawmarkup" style="display:none;">Title%3A+Massachusetts+Indigency+Calculator%0AAuthor%3A+David+Colarusso%0ABefore%3A+%3Clink+rel%3D%22stylesheet%22+type%3D%22text%2Fcss%22+href%3D%22https%3A%2F%2Fprojects.suffolklitlab.org%2Fhowto%2Fqna%2Fstyle%2Fstyle.css%22%3E%0A%3Cdiv+id%3D%22icon%22+style%3D%22background-size%3A+110px+99px%3Bbackground-image%3A+url%28%27https%3A%2F%2Fprojects.suffolklitlab.org%2Fhowto%2Fqna%2Fimages%2Fmaxheadroom.gif%27%29%3B%22%3E%3C%2Fdiv%3E%0A%3Ch2+style%3D%22text-align%3Acenter%3B%22%3EMassachusetts+Indigency+Calculator%3C%2Fh2%3E%0A%3Cp%3E%3Cb%3EThis+is+a+%3Ca+href%3D%22https%3A%2F%2Fwww.codingthelaw.org%2FFall_2023%2Flevel%2F2%2F%23mission_p2%22%3Eclass+project%3C%2Fa%3E.+You+should+not+rely+on+it+as+a+source+of+legal+information.+It+is+likely+incomplete.%3C%2Fb%3E%3C%2Fp%3E%0A%3Cp%3EAnswer+the+following+questions+to+see+if+you+qualify+for+an+appointment+of+counsel+or+fee+waiver.%3C%2Fp%3E%0AAfter%3A%0A%3Cscript%3E%0Afunction+fedpov%28house%2Cincome%2Cpercentage%29%7B%0A%09%2F%2F+Determines+if+your+income+is+less+than+or+equal+to%0A%09%2F%2F+a+percentage+of+the+2023+federal+poverty+guidelines%0A%09%2F%2F+for+the+contiguous+United+States.+See%0A%09%2F%2F+https%3A%2F%2Faspe.hhs.gov%2Fpoverty-guidelines%0A%0A%09%09var+line+%3D+NaN%3B%0A%0A%09%09if+%28house+%3D%3D+1%29+%7B%0A%09%09%09line+%3D+14580%3B%0A%09%09%7D+else+if+%28house+%3D%3D+2%29+%7B%0A%09%09%09line+%3D+19720%3B%0A%09%09%7D+else+if+%28house+%3D%3D+3%29+%7B%0A%09%09%09line+%3D+24860%3B%0A%09%09%7D+else+if+%28house+%3D%3D+4%29+%7B%0A%09%09%09line+%3D+30000%3B%0A%09%09%7D+else+if+%28house+%3D%3D+5%29+%7B%0A%09%09%09line+%3D+35140%3B%0A%09%09%7D+else+if+%28house+%3D%3D+6%29+%7B%0A%09%09%09line+%3D+40280%3B%0A%09%09%7D+else+if+%28house+%3D%3D+7%29+%7B%0A%09%09%09line+%3D+45420%3B%0A%09%09%7D+else+if+%28house+%3D%3D+8%29+%7B%0A%09%09%09line+%3D+50560%3B%0A%09%09%7D+else+if+%28house+%3E+8%29+%7B%0A%09%09%09line+%3D+50560+%2B+%28house-8%29%2A5140%3B%0A%09%09%7D%0A%0A%09%09if+%28income+%3C%3D+%28line%2A%28percentage%2F100%29%29%29+%7B%0A%09%09%09return+true%3B%0A%09%09%7D+else+%7B%0A%09%09%09return+false%3B%0A%09%09%7D%0A%09%7D%0A%3C%2Fscript%3E%0A%0AQ%281%29%3A+Do+your+receive+public+assistance%3F%0AA%3A+Yes%0A%09Q%281.1%29%3AGOTO%3Aqualaid%0AA%3A+No%0A%09Q%28house%29%3A+How+many+people+are+in+your+household%3F%0A%09X%3Anumber%0A%09%09Q%28income%29%3A+How+much+income+does+your+household+bring+in+per+year+in+after+tax+dollars%3F%0A%09%09X%3Anumber%0A%09%09%09Q%281.2.1.1%29%3A+Are+you+facing+a+civil+or+criminal+matter%3F%0A%09%09%09A%5Bjavascript%3Aif+%28fedpov%28getvar%28%27house%27%29%2Cgetvar%28%27income%27%29%2C125%29%29%7B+goto%28%27qualciv%27%29+%7D+else+%7B+goto%28%27noqualciv%27%29+%7D+%5D%3A+Civil%0A%09%09%09A%5Bjavascript%3Aif+%28fedpov%28getvar%28%27house%27%29%2Cgetvar%28%27income%27%29%2C125%29%29%7B+goto%28%27qualcrim%27%29+%7D+else+if+%28fedpov%28getvar%28%27house%27%29%2Cgetvar%28%27income%27%29%2C250%29%29+%7B+goto%28%27noqualbut%27%29+%7D+else+%7B+goto%28%27noqualcrim%27%29+%7D+%5D%3A+Criminal%0A%0AQ%28qualaid%29%3A+You+probably+qualify+as+indigent+because+you+receive+public+assistance.+See+%3Ca+href%3D%22http%3A%2F%2Fwww.mass.gov%2Fcourts%2Fcase-legal-res%2Frules-of-court%2Fsjc%2Fsjc310.html%22+target%3D_new%3ESJC+Rule+3%3A10%3C%2Fa%3E+and+%3Ca+href%3D%22https%3A%2F%2Fmalegislature.gov%2FLaws%2FGeneralLaws%2FPartIII%2FTitleVI%2FChapter261%2FSection27A%22+target%3D_new%3EM.G.L.+Chapter+261+MA+Sec.+27A%3C%2Fa%3E.%0A%0AQ%28qualciv%29%3A+You+probably+qualify+as+indigent+since+you+earn+less+than+125%25+of+the+poverty+line.+See+%3Ca+href%3D%22https%3A%2F%2Fmalegislature.gov%2FLaws%2FGeneralLaws%2FPartIII%2FTitleVI%2FChapter261%2FSection27A%22+target%3D_new%3EM.G.L.+Chapter+261+MA+%15+27A%3C%2Fa%3E.+Consequently%2C+you+may+be+eligible+to+have+your+court+fees+waived.+Would+you+like+me+to+open+up+a+fee+waiver+for+you+to+file%3F%0AA%3A%5Bhttps%3A%2F%2Fapps.suffolklitlab.org%2Fstart%2Findigency%5D+Yes%0A%09Q%283.1%29%3A+If+the+affidavit+of+indigency+didn%27t+open+in+a+new+window%2Ftab%2C+you+can+find+it+%3Ca+href%3D%22https%3A%2F%2Fapps.suffolklitlab.org%2Fstart%2Findigency%22%3Ehere%3C%2Fa%3E.%0AA%3A+No%0A%09Q%283.2%29%3AGOTO%3Anomore%0A%0AQ%28qualcrim%29%3A+You+probably+qualify+as+indigent+since+you+earn+less+than+125%25+of+the+poverty+line.+So+you%27ll+likely+be+assigned+a+lawyer+by+the+judge.+See+%3Ca+href%3D%22http%3A%2F%2Fwww.mass.gov%2Fcourts%2Fcase-legal-res%2Frules-of-court%2Fsjc%2Fsjc310.html%22+target%3D_new%3ESJC+Rule+3%3A10%3C%2Fa%3E.%0A%0AQ%28qualbut%29%3A+You+probably+qualify+as+indigent+but+able+to+contribute+since+you+earn+between+125%25+and+250%25+of+the+poverty+line.+So+you%27ll+likely+be+assigned+a+lawyer+and+asked+to+pay+a+small+fee.+See+%3Ca+href%3D%22http%3A%2F%2Fwww.mass.gov%2Fcourts%2Fcase-legal-res%2Frules-of-court%2Fsjc%2Fsjc310.html%22+target%3D_new%3ESJC+Rule+3%3A10%3C%2Fa%3E.%0A%0AQ%28noqualciv%29%3A+You+probably+won%27t+qualify+as+indigent+since+you+earn+more+than+125%25+of+the+poverty+line.+See+%3Ca+href%3D%22https%3A%2F%2Fmalegislature.gov%2FLaws%2FGeneralLaws%2FPartIII%2FTitleVI%2FChapter261%2FSection27A%22+target%3D_new%3EM.G.L.+Chapter+261+MA+Sec.+27A%3C%2Fa%3E.+So+you%27ll+probably+need+to+hire+an+attorney.+Would+you+like+to+search+for+one+near+you%3F%0AA%3A%5Bhttps%3A%2F%2Fwww.avvo.com%2Ffind-a-lawyer%5D+Yes.%0A%09Q%286.1%29%3AGOTO%3Anomore%0AA%3A+No%0A%09Q%286.2%29%3AGOTO%3Anomore%0A%0AQ%28noqualcrim%29%3A+You+probably+won%27t+qualify+as+indigent+or+indigent+but+able+to+contribute+since+you+earn+more+than+250%25+of+the+poverty+line.+So+you%27ll+probably+need+to+hire+an+attorney.+Would+you+like+to+search+for+one+near+you%3F%0AA%3A%5Bhttps%3A%2F%2Fwww.avvo.com%2Ffind-a-lawyer%5D+Yes.%0A%09Q%287.1%29%3AGOTO%3Anomore%0AA%3A+No%0A%09Q%287.2%29%3AGOTO%3Anomore%0A%0AQ%28nomore%29%3A+I%27m+afraid+there%27s+nothing+else+I+can+help+you+with.+I+hope+you+have+a+nice+day.%0A</div><div id="ondeck" name="ondeck"><div id='Q-1' name='Q-1' style='display:none;'> Do your receive public assistance?</div><div id='Q-1.1' name='Q-1.1' style='display:none;'>GOTO:2</div><div id='Q-1.2' name='Q-1.2' style='display:none;'> How many people are in your household?</div><div id='Q-1.2.1' name='Q-1.2.1' style='display:none;'> How much income does your household bring in per year in after tax dollars?</div><div id='Q-1.2.1.1' name='Q-1.2.1.1' style='display:none;'> Are you facing a civil or criminal matter?</div><div id='Q-2' name='Q-2' style='display:none;'> You probably qualify as indigent because you receive public assistance. See <a href="http://www.mass.gov/courts/case-legal-res/rules-of-court/sjc/sjc310.html" target=_new>SJC Rule 3:10</a> and <a href="https://malegislature.gov/Laws/GeneralLaws/PartIII/TitleVI/Chapter261/Section27A" target=_new>M.G.L. Chapter 261 MA Sec. 27A</a>.
</div><div id='Q-3' name='Q-3' style='display:none;'> You probably qualify as indigent since you earn less than 125% of the poverty line. See <a href="https://malegislature.gov/Laws/GeneralLaws/PartIII/TitleVI/Chapter261/Section27A" target=_new>M.G.L. Chapter 261 MA 27A</a>. Consequently, you may be eligible to have your court fees waived. Would you like me to open up a fee waiver for you to file?</div><div id='Q-3.1' name='Q-3.1' style='display:none;'> If the affidavit of indigency didn't open in a new window/tab, you can find it <a href="https://apps.suffolklitlab.org/start/indigency">here</a>.</div><div id='Q-3.2' name='Q-3.2' style='display:none;'>GOTO:8</div><div id='Q-4' name='Q-4' style='display:none;'> You probably qualify as indigent since you earn less than 125% of the poverty line. So you'll likely be assigned a lawyer by the judge. See <a href="http://www.mass.gov/courts/case-legal-res/rules-of-court/sjc/sjc310.html" target=_new>SJC Rule 3:10</a>.
</div><div id='Q-5' name='Q-5' style='display:none;'> You probably qualify as indigent but able to contribute since you earn between 125% and 250% of the poverty line. So you'll likely be assigned a lawyer and asked to pay a small fee. See <a href="http://www.mass.gov/courts/case-legal-res/rules-of-court/sjc/sjc310.html" target=_new>SJC Rule 3:10</a>.
</div><div id='Q-6' name='Q-6' style='display:none;'> You probably won't qualify as indigent since you earn more than 125% of the poverty line. See <a href="https://malegislature.gov/Laws/GeneralLaws/PartIII/TitleVI/Chapter261/Section27A" target=_new>M.G.L. Chapter 261 MA Sec. 27A</a>. So you'll probably need to hire an attorney. Would you like to search for one near you?</div><div id='Q-6.1' name='Q-6.1' style='display:none;'>GOTO:8</div><div id='Q-6.2' name='Q-6.2' style='display:none;'>GOTO:8</div><div id='Q-7' name='Q-7' style='display:none;'> You probably won't qualify as indigent or indigent but able to contribute since you earn more than 250% of the poverty line. So you'll probably need to hire an attorney. Would you like to search for one near you?</div><div id='Q-7.1' name='Q-7.1' style='display:none;'>GOTO:8</div><div id='Q-7.2' name='Q-7.2' style='display:none;'>GOTO:8</div><div id='Q-8' name='Q-8' style='display:none;'> I'm afraid there's nothing else I can help you with. I hope you have a nice day.
</div><div id='A-1.1' name='A-1.1' style='display:none;'> Yes</div><div id='A-href-1.1' name='A-href-1.1' style='display:none;'>javascript:void('');</div><div id='A-target-1.1' name='A-target-1.1' style='display:none;'></div><div id='X-1.1' name='X-1.1' style='display:none;'>Yes</div><div id='A-1.2' name='A-1.2' style='display:none;'> No</div><div id='A-href-1.2' name='A-href-1.2' style='display:none;'>javascript:void('');</div><div id='A-target-1.2' name='A-target-1.2' style='display:none;'></div><div id='X-1.2' name='X-1.2' style='display:none;'>No</div><div id='A-1.2.1' name='A-1.2.1' style='display:none;'><variable></div><div id='A-href-1.2.1' name='A-href-1.2.1' style='display:none;'>javascript:void('');</div><div id='A-target-1.2.1' name='A-target-1.2.1' style='display:none;'>number</div><div id='X-1.2.1' name='X-1.2.1' style='display:none;'>1.2.1</div><div id='A-1.2.1.1' name='A-1.2.1.1' style='display:none;'><variable></div><div id='A-href-1.2.1.1' name='A-href-1.2.1.1' style='display:none;'>javascript:void('');</div><div id='A-target-1.2.1.1' name='A-target-1.2.1.1' style='display:none;'>number</div><div id='X-1.2.1.1' name='X-1.2.1.1' style='display:none;'>1.2.1.1</div><div id='A-1.2.1.1.1' name='A-1.2.1.1.1' style='display:none;'> Civil</div><div id='A-href-1.2.1.1.1' name='A-href-1.2.1.1.1' style='display:none;'>javascript:if (fedpov(getvar('house'),getvar('income'),125)){ goto('qualciv') } else { goto('noqualciv') } </div><div id='A-target-1.2.1.1.1' name='A-target-1.2.1.1.1' style='display:none;'></div><div id='X-1.2.1.1.1' name='X-1.2.1.1.1' style='display:none;'>Civil</div><div id='A-1.2.1.1.2' name='A-1.2.1.1.2' style='display:none;'> Criminal
</div><div id='A-href-1.2.1.1.2' name='A-href-1.2.1.1.2' style='display:none;'>javascript:if (fedpov(getvar('house'),getvar('income'),125)){ goto('qualcrim') } else if (fedpov(getvar('house'),getvar('income'),250)) { goto('noqualbut') } else { goto('noqualcrim') } </div><div id='A-target-1.2.1.1.2' name='A-target-1.2.1.1.2' style='display:none;'></div><div id='X-1.2.1.1.2' name='X-1.2.1.1.2' style='display:none;'>Criminal</div><div id='A-3.1' name='A-3.1' style='display:none;'> Yes</div><div id='A-href-3.1' name='A-href-3.1' style='display:none;'>https://apps.suffolklitlab.org/start/indigency</div><div id='A-target-3.1' name='A-target-3.1' style='display:none;'>target="_blank" i="https://apps.suffolklitlab.org/start/indigency"</div><div id='X-3.1' name='X-3.1' style='display:none;'>Yes</div><div id='A-3.2' name='A-3.2' style='display:none;'> No</div><div id='A-href-3.2' name='A-href-3.2' style='display:none;'>javascript:void('');</div><div id='A-target-3.2' name='A-target-3.2' style='display:none;'></div><div id='X-3.2' name='X-3.2' style='display:none;'>No</div><div id='A-6.1' name='A-6.1' style='display:none;'> Yes.</div><div id='A-href-6.1' name='A-href-6.1' style='display:none;'>https://www.avvo.com/find-a-lawyer</div><div id='A-target-6.1' name='A-target-6.1' style='display:none;'>target="_blank" i="https://www.avvo.com/find-a-lawyer"</div><div id='X-6.1' name='X-6.1' style='display:none;'>Yes.</div><div id='A-6.2' name='A-6.2' style='display:none;'> No</div><div id='A-href-6.2' name='A-href-6.2' style='display:none;'>javascript:void('');</div><div id='A-target-6.2' name='A-target-6.2' style='display:none;'></div><div id='X-6.2' name='X-6.2' style='display:none;'>No</div><div id='A-7.1' name='A-7.1' style='display:none;'> Yes.</div><div id='A-href-7.1' name='A-href-7.1' style='display:none;'>https://www.avvo.com/find-a-lawyer</div><div id='A-target-7.1' name='A-target-7.1' style='display:none;'>target="_blank" i="https://www.avvo.com/find-a-lawyer"</div><div id='X-7.1' name='X-7.1' style='display:none;'>Yes.</div><div id='A-7.2' name='A-7.2' style='display:none;'> No</div><div id='A-href-7.2' name='A-href-7.2' style='display:none;'>javascript:void('');</div><div id='A-target-7.2' name='A-target-7.2' style='display:none;'></div><div id='X-7.2' name='X-7.2' style='display:none;'>No</div>
<script>
var QVnames = [['1','1'],['1.1','1.1'],['1.2','house'],['1.2.1','income'],['1.2.1.1','1.2.1.1'],['2','qualaid'],['3','qualciv'],['3.1','3.1'],['3.2','3.2'],['4','qualcrim'],['5','qualbut'],['6','noqualciv'],['6.1','6.1'],['6.2','6.2'],['7','noqualcrim'],['7.1','7.1'],['7.2','7.2'],['8','nomore']];
</script>
</div><textarea id="original" name="original" style="display:none;" disabled="disabled"><div id='Q-1' name='Q-1' style='display:none;'> Do your receive public assistance?</div><div id='Q-1.1' name='Q-1.1' style='display:none;'>GOTO:2</div><div id='Q-1.2' name='Q-1.2' style='display:none;'> How many people are in your household?</div><div id='Q-1.2.1' name='Q-1.2.1' style='display:none;'> How much income does your household bring in per year in after tax dollars?</div><div id='Q-1.2.1.1' name='Q-1.2.1.1' style='display:none;'> Are you facing a civil or criminal matter?</div><div id='Q-2' name='Q-2' style='display:none;'> You probably qualify as indigent because you receive public assistance. See <a href="http://www.mass.gov/courts/case-legal-res/rules-of-court/sjc/sjc310.html" target=_new>SJC Rule 3:10</a> and <a href="https://malegislature.gov/Laws/GeneralLaws/PartIII/TitleVI/Chapter261/Section27A" target=_new>M.G.L. Chapter 261 MA Sec. 27A</a>.
</div><div id='Q-3' name='Q-3' style='display:none;'> You probably qualify as indigent since you earn less than 125% of the poverty line. See <a href="https://malegislature.gov/Laws/GeneralLaws/PartIII/TitleVI/Chapter261/Section27A" target=_new>M.G.L. Chapter 261 MA 27A</a>. Consequently, you may be eligible to have your court fees waived. Would you like me to open up a fee waiver for you to file?</div><div id='Q-3.1' name='Q-3.1' style='display:none;'> If the affidavit of indigency didn't open in a new window/tab, you can find it <a href="https://apps.suffolklitlab.org/start/indigency">here</a>.</div><div id='Q-3.2' name='Q-3.2' style='display:none;'>GOTO:8</div><div id='Q-4' name='Q-4' style='display:none;'> You probably qualify as indigent since you earn less than 125% of the poverty line. So you'll likely be assigned a lawyer by the judge. See <a href="http://www.mass.gov/courts/case-legal-res/rules-of-court/sjc/sjc310.html" target=_new>SJC Rule 3:10</a>.
</div><div id='Q-5' name='Q-5' style='display:none;'> You probably qualify as indigent but able to contribute since you earn between 125% and 250% of the poverty line. So you'll likely be assigned a lawyer and asked to pay a small fee. See <a href="http://www.mass.gov/courts/case-legal-res/rules-of-court/sjc/sjc310.html" target=_new>SJC Rule 3:10</a>.
</div><div id='Q-6' name='Q-6' style='display:none;'> You probably won't qualify as indigent since you earn more than 125% of the poverty line. See <a href="https://malegislature.gov/Laws/GeneralLaws/PartIII/TitleVI/Chapter261/Section27A" target=_new>M.G.L. Chapter 261 MA Sec. 27A</a>. So you'll probably need to hire an attorney. Would you like to search for one near you?</div><div id='Q-6.1' name='Q-6.1' style='display:none;'>GOTO:8</div><div id='Q-6.2' name='Q-6.2' style='display:none;'>GOTO:8</div><div id='Q-7' name='Q-7' style='display:none;'> You probably won't qualify as indigent or indigent but able to contribute since you earn more than 250% of the poverty line. So you'll probably need to hire an attorney. Would you like to search for one near you?</div><div id='Q-7.1' name='Q-7.1' style='display:none;'>GOTO:8</div><div id='Q-7.2' name='Q-7.2' style='display:none;'>GOTO:8</div><div id='Q-8' name='Q-8' style='display:none;'> I'm afraid there's nothing else I can help you with. I hope you have a nice day.
</div><div id='A-1.1' name='A-1.1' style='display:none;'> Yes</div><div id='A-href-1.1' name='A-href-1.1' style='display:none;'>javascript:void('');</div><div id='A-target-1.1' name='A-target-1.1' style='display:none;'></div><div id='X-1.1' name='X-1.1' style='display:none;'>Yes</div><div id='A-1.2' name='A-1.2' style='display:none;'> No</div><div id='A-href-1.2' name='A-href-1.2' style='display:none;'>javascript:void('');</div><div id='A-target-1.2' name='A-target-1.2' style='display:none;'></div><div id='X-1.2' name='X-1.2' style='display:none;'>No</div><div id='A-1.2.1' name='A-1.2.1' style='display:none;'><variable></div><div id='A-href-1.2.1' name='A-href-1.2.1' style='display:none;'>javascript:void('');</div><div id='A-target-1.2.1' name='A-target-1.2.1' style='display:none;'>number</div><div id='X-1.2.1' name='X-1.2.1' style='display:none;'>1.2.1</div><div id='A-1.2.1.1' name='A-1.2.1.1' style='display:none;'><variable></div><div id='A-href-1.2.1.1' name='A-href-1.2.1.1' style='display:none;'>javascript:void('');</div><div id='A-target-1.2.1.1' name='A-target-1.2.1.1' style='display:none;'>number</div><div id='X-1.2.1.1' name='X-1.2.1.1' style='display:none;'>1.2.1.1</div><div id='A-1.2.1.1.1' name='A-1.2.1.1.1' style='display:none;'> Civil</div><div id='A-href-1.2.1.1.1' name='A-href-1.2.1.1.1' style='display:none;'>javascript:if (fedpov(getvar('house'),getvar('income'),125)){ goto('qualciv') } else { goto('noqualciv') } </div><div id='A-target-1.2.1.1.1' name='A-target-1.2.1.1.1' style='display:none;'></div><div id='X-1.2.1.1.1' name='X-1.2.1.1.1' style='display:none;'>Civil</div><div id='A-1.2.1.1.2' name='A-1.2.1.1.2' style='display:none;'> Criminal
</div><div id='A-href-1.2.1.1.2' name='A-href-1.2.1.1.2' style='display:none;'>javascript:if (fedpov(getvar('house'),getvar('income'),125)){ goto('qualcrim') } else if (fedpov(getvar('house'),getvar('income'),250)) { goto('noqualbut') } else { goto('noqualcrim') } </div><div id='A-target-1.2.1.1.2' name='A-target-1.2.1.1.2' style='display:none;'></div><div id='X-1.2.1.1.2' name='X-1.2.1.1.2' style='display:none;'>Criminal</div><div id='A-3.1' name='A-3.1' style='display:none;'> Yes</div><div id='A-href-3.1' name='A-href-3.1' style='display:none;'>https://apps.suffolklitlab.org/start/indigency</div><div id='A-target-3.1' name='A-target-3.1' style='display:none;'>target="_blank" i="https://apps.suffolklitlab.org/start/indigency"</div><div id='X-3.1' name='X-3.1' style='display:none;'>Yes</div><div id='A-3.2' name='A-3.2' style='display:none;'> No</div><div id='A-href-3.2' name='A-href-3.2' style='display:none;'>javascript:void('');</div><div id='A-target-3.2' name='A-target-3.2' style='display:none;'></div><div id='X-3.2' name='X-3.2' style='display:none;'>No</div><div id='A-6.1' name='A-6.1' style='display:none;'> Yes.</div><div id='A-href-6.1' name='A-href-6.1' style='display:none;'>https://www.avvo.com/find-a-lawyer</div><div id='A-target-6.1' name='A-target-6.1' style='display:none;'>target="_blank" i="https://www.avvo.com/find-a-lawyer"</div><div id='X-6.1' name='X-6.1' style='display:none;'>Yes.</div><div id='A-6.2' name='A-6.2' style='display:none;'> No</div><div id='A-href-6.2' name='A-href-6.2' style='display:none;'>javascript:void('');</div><div id='A-target-6.2' name='A-target-6.2' style='display:none;'></div><div id='X-6.2' name='X-6.2' style='display:none;'>No</div><div id='A-7.1' name='A-7.1' style='display:none;'> Yes.</div><div id='A-href-7.1' name='A-href-7.1' style='display:none;'>https://www.avvo.com/find-a-lawyer</div><div id='A-target-7.1' name='A-target-7.1' style='display:none;'>target="_blank" i="https://www.avvo.com/find-a-lawyer"</div><div id='X-7.1' name='X-7.1' style='display:none;'>Yes.</div><div id='A-7.2' name='A-7.2' style='display:none;'> No</div><div id='A-href-7.2' name='A-href-7.2' style='display:none;'>javascript:void('');</div><div id='A-target-7.2' name='A-target-7.2' style='display:none;'></div><div id='X-7.2' name='X-7.2' style='display:none;'>No</div>
<script>
var QVnames = [['1','1'],['1.1','1.1'],['1.2','house'],['1.2.1','income'],['1.2.1.1','1.2.1.1'],['2','qualaid'],['3','qualciv'],['3.1','3.1'],['3.2','3.2'],['4','qualcrim'],['5','qualbut'],['6','noqualciv'],['6.1','6.1'],['6.2','6.2'],['7','noqualcrim'],['7.1','7.1'],['7.2','7.2'],['8','nomore']];
</script>
</textarea><textarea id="transcript" name="transcript" style="display:none;" disabled="disabled"></textarea><div style="float:left;width:100%;margin:15px 0 0px 0;border-top: solid 1px #ddd;"><div id=credits class=credits style="display:none;"><div class=credit_text><p><b> Massachusetts Indigency Calculator</b></p><p>By David Colarusso</p></div></div><p align=center><a href="javascript:void('');" onClick="shoh('credits');">credits</a> | <a href="https://www.qnamarkup.org/" target=_top>code your own</a></p></div></FORM>
<script>
function fedpov(house,income,percentage){
// Determines if your income is less than or equal to
// a percentage of the 2023 federal poverty guidelines
// for the contiguous United States. See
// https://aspe.hhs.gov/poverty-guidelines
var line = NaN;
if (house == 1) {
line = 14580;
} else if (house == 2) {
line = 19720;
} else if (house == 3) {
line = 24860;
} else if (house == 4) {
line = 30000;
} else if (house == 5) {
line = 35140;
} else if (house == 6) {
line = 40280;
} else if (house == 7) {
line = 45420;
} else if (house == 8) {
line = 50560;
} else if (house > 8) {
line = 50560 + (house-8)*5140;
}
if (income <= (line*(percentage/100))) {
return true;
} else {
return false;
}
}
</script>
</div></div>
<script type="text/javascript">
var QNum = 0;
var Qhtml = "";
var Dhtml = "";
var label = "";
var GOTOfired = 0;
var path = [];
var doc_bin = [];
var convo_bin = [];
var freetext = 0;
var goingback = 0;
$("#conversation input").on("keypress", 'form', function (e) {
var code = e.keyCode || e.which;
if (code == 13) {
e.preventDefault();
return false;
}
});
$('#FORM').on('keyup keypress', function(e) {
var keyCode = e.keyCode || e.which;
if (keyCode === 13) {
e.preventDefault();
return false;
}
});
function answerQ(lb,restart) {
currentQ = label;
label = lb;
Dhtml = 'D-'+label;
Qhtml = 'Q-'+label;
var Ahtml = 'A-'+label;
var Jhtml = 'J-'+QNum;
var Xhtml = 'X-'+label;
var Xihtml = 'Xi-'+label;
var input_error = 0;
if (restart == undefined) {
var regexp = new RegExp("\<variable\>");
//if (document.getElementById(Xihtml)) {
// console.log("document.getElementById("+Xihtml+").value: "+document.getElementById(Xihtml).value);
//} else {
// console.log("NO document.getElementById("+Xihtml+").value: ");
//}
if (document.getElementById(Ahtml).innerHTML.match(regexp)) {
document.getElementById(Xihtml).value = document.getElementById(Xihtml).value.replace(/(^\s*|\s*$)/,"");
if (document.getElementById(Xihtml).value == "") {
input_error = "Your answer appears to be empty.";
label = currentQ;
} else {
document.getElementById(Xihtml).value = document.getElementById(Xihtml).value.replace(/</g,"<");
document.getElementById(Xihtml).value = document.getElementById(Xihtml).value.replace(/>/g,">");
}
}
}
if (input_error != 0) {
alert(input_error);
document.getElementById(Xihtml).focus();
} else {
if (restart == undefined) {
//if (document.getElementById(Ahtml).innerHTML!="") {
document.getElementById('QandA').innerHTML += "<div id=\"break-at-"+QNum+"\" class='frame'><div class='full'><div class='ans_text'>"+document.getElementById(Ahtml).innerHTML+"</div></div><div class='ans_arrow'></div></div></div></div>";
//}
// insert answer from button
if (document.getElementById(valueis(currentQ))) {
document.getElementById(valueis(currentQ)).outerHTML='';
}
if (document.getElementById(Xihtml)) {
document.getElementById('QandA').innerHTML = "<textarea style=\"display:none;\" id=\""+valueis(currentQ)+"\" name=\""+valueis(currentQ)+"\">"+document.getElementById(Xihtml).value+"</textarea>\n" + document.getElementById('QandA').innerHTML
} else {
document.getElementById('QandA').innerHTML = "<textarea style=\"display:none;\" id=\""+valueis(currentQ)+"\" name=\""+valueis(currentQ)+"\">"+document.getElementById(Xhtml).innerHTML+"</textarea>\n" + document.getElementById('QandA').innerHTML
}
if (document.getElementById('QandA').innerHTML.match(regexp)) {
var duplicatevars = new RegExp("id=\""+document.getElementById(Xhtml).innerHTML+"(.)*"+document.getElementById(Xhtml).innerHTML+"\"","g");
document.getElementById('QandA').innerHTML = document.getElementById('QandA').innerHTML.replace(duplicatevars, "");
document.getElementById('QandA').innerHTML = document.getElementById('QandA').innerHTML.replace(/\<variable\>(\<\/variable\>)?/, "<input type=hidden id=\""+document.getElementById(Xhtml).innerHTML+"\" name=\""+document.getElementById(Xhtml).innerHTML+"\" value=\""+document.getElementById(Xihtml).value+"\"/>"+document.getElementById(Xihtml).value);
//document.getElementById('transcript').value = document.getElementById('transcript').value.replace(/\<variable\>(\<\/variable\>)?/, document.getElementById(Xihtml).value+"\n");
var thisvariable = new RegExp("<(X|x)>"+document.getElementById(Xhtml).innerHTML+"<\/(X|x)>","g");
//document.getElementById('doc').innerHTML = document.getElementById('doc').innerHTML.replace(thisvariable, document.getElementById(document.getElementById(Xhtml).innerHTML).innerHTML);
//document.getElementById('ondeck').innerHTML = document.getElementById('ondeck').innerHTML.replace(thisvariable, document.getElementById(valueis(currentQ)).innerHTML);
//console.log("thisvariable: "+thisvariable);
//console.log("Variable name: "+valueis(currentQ));
//console.log("Variable value: "+document.getElementById(valueis(currentQ)).innerHTML);
if(document.getElementById(Ahtml).innerHTML != "") {
//document.getElementById('transcript').value += "USER: "+document.getElementById(Xihtml).value+"\n";
convo_bin.push("USER: "+document.getElementById(Xihtml).value+"\n");
}
} else {
//document.getElementById('transcript').value += "USER: "+document.getElementById(Ahtml).innerHTML+"\n";
convo_bin.push("USER: "+document.getElementById(Ahtml).innerHTML+"\n");
}
document.getElementById('Choices').innerHTML = '';
if (goingback == 0) {
setTimeout(function() {renderQnA(Qhtml,Jhtml,Dhtml,restart)}, 300);
} else {
renderQnA(Qhtml,Jhtml,Dhtml,restart);
}
} else {
document.getElementById('Choices').innerHTML = '';
path = [];
renderQnA(Qhtml,Jhtml,Dhtml,restart);
}
}
}
function renderQnA(Qht,Jht,Dht,restar) {
Dhtml = Dht;
GOTOfired = 0;
path.push(label);
swapGOTO(Qht,Jht);
console.log("After swap: "+GOTOfired);
if (GOTOfired == 0) {
document.getElementById('QandA').innerHTML += "<div id="+Jht+" style=\"float:left;width:100%;height:1px;\"> </div>";
}
document.getElementById('QandA').innerHTML += "<div class='frame'><div class='full'><div class='question_text'>"+swapvar(document.getElementById(Qhtml).innerHTML)+"</div></div><div class='question_arrow'></div></div>";
document.getElementById('QandA').innerHTML = document.getElementById('QandA').innerHTML.replace(/(\<br\>){2}/gi,"</div></div><div class='question_arrow'></div></div></div></div><div class='frame'><div class='full'><div class='question_text'>");
document.getElementById('QandA').innerHTML = document.getElementById('QandA').innerHTML.replace(/(\<br\> \<br\>)/gi,"<br><br>");
// add question
//document.getElementById('transcript').value += swapvar("BOT: "+ document.getElementById(Qhtml).innerHTML);
//document.getElementById('transcript').value = document.getElementById('transcript').value.replace(/(\<br\>){2}/gi,"\nBOT: ");
this_text = swapvar("BOT: "+ document.getElementById(Qhtml).innerHTML);
this_text = this_text.replace(/(\<br\>){2}/gi,"\nBOT: ");
convo_bin.push(this_text);
// make push doc into array in doc() cycle through array and put into output
// maybe remove doc div
if (document.getElementById(Dhtml)) {
doc_bin.push([document.getElementById(Dhtml).innerHTML,currentQ]);
console.log("Add to Doc ("+Dhtml+"): "+document.getElementById(Dhtml).innerHTML);
//document.getElementById('doc').innerHTML += document.getElementById(Dhtml).innerHTML;
}
tmp = getElementsByIdRegExp("div", "A-"+label+"(\\.{1}\\d){1}$");
a_href = getElementsByIdRegExp("div", "A-href-"+label+"(\\.{1}\\d){1}$");
a_target = getElementsByIdRegExp("div", "A-target-"+label+"(\\.{1}\\d){1}$");
tmp_x = getElementsByIdRegExp("div", "X-"+label+"(\\.{1}\\d){1}$");
var Xishere = 0;
for ( var i = 0; i < tmp.length; i++ ) {
var nextlabel = tmp[i].id.substr(2);
var Xihtml = 'Xi-'+nextlabel;
var regexp = "\<variable\>";
var regexp_js = "^javascript:";
var regexp_load_js = "loadQnA";
var script_call = "";
if (tmp[i].innerHTML.match(regexp)) {
if (a_href[i].innerHTML.match('^(_blank:)?javascript:')) {
script_call = a_href[i].innerHTML.replace(/^(_blank:)?javascript:/gi,"");
} else {
if (a_href[i].innerHTML.match('^_blank:')) {
script_call = "window.open('"+a_href[i].innerHTML.replace(/^_blank:/,"")+"','_blank');";
} else {
script_call = "location.href = '"+a_href[i].innerHTML+"';";
}
}
if(a_href[i].innerHTML.match(regexp_load_js)){
//script_call = "xv = document.getElementById('"+Xihtml+"').value;" + script_call.replace(/this\.innerHTML/gi,"xv")
script_call = script_call.replace(/this\.innerHTML/gi,"document.getElementById('"+Xihtml+"').value")
document.getElementById('Choices').innerHTML += "<div class=\"xdiv\"><input type=\""+a_target[i].innerHTML+"\" id=\""+Xihtml+"\" name=\""+Xihtml+"\" class=\"xinput\" onkeypress=\"if (event.keyCode==13){"+script_call+"}\"/><a href=\"javascript:void('');\" class=\"xbutton\" onClick=\""+script_call+"\"><span class=\"qpad\">Send</span></a></div>";
} else {
script_call = script_call.replace(/this\.innerHTML/gi,"document.getElementById('"+Xihtml+"').value")
document.getElementById('Choices').innerHTML += "<div class=\"xdiv\"><input type=\""+a_target[i].innerHTML+"\" id=\""+Xihtml+"\" name=\""+Xihtml+"\" class=\"xinput\" onkeypress=\"if (event.keyCode==13){answerQ('"+nextlabel+"');"+script_call+"}\"/><a href=\"javascript:void('');\" class=\"xbutton\" onClick=\"answerQ('"+nextlabel+"');"+script_call+"\"><span class=\"qpad\">Send</span></a></div>";
}
Xishere = Xihtml;
freetext = Xihtml;
} else if (a_href[i].innerHTML.match(regexp_js) && a_href[i].innerHTML != "javascript:void('');") {
tmp[i].innerHTML = tmp[i].innerHTML.replace(/(\<br\>){2}/gi,"<br> <br>");
var script_call = a_href[i].innerHTML.replace(/^javascript:/gi,"");
if(a_href[i].innerHTML.match(regexp_load_js)){
document.getElementById('Choices').innerHTML += "<a href=\"javascript:void('');\" class=\"qabutton\" onClick=\""+script_call+"\" "+a_target[i].innerHTML+"><span class=\"qpad\">"+tmp[i].innerHTML+"</span></a>";
} else {
document.getElementById('Choices').innerHTML += "<a href=\"javascript:void('');\" class=\"qabutton\" onClick=\"answerQ('"+nextlabel+"');"+script_call+"\" "+a_target[i].innerHTML+"><span class=\"qpad\">"+tmp[i].innerHTML+"</span></a>";
}
freetext = 0;
} else {
tmp[i].innerHTML = tmp[i].innerHTML.replace(/(\<br\>){2}/gi,"<br> <br>");
document.getElementById('Choices').innerHTML += "<a href=\""+a_href[i].innerHTML+"\" class=\"qabutton\" onClick=\"answerQ('"+nextlabel+"');\" "+a_target[i].innerHTML+"><span class=\"qpad\">"+tmp[i].innerHTML+"</span></a>";
freetext = 0;
}
}
if (restar == undefined) {
document.getElementById('Choices').innerHTML += "<div class=\"standard_buttons\">";
if (QNum > 1) {
document.getElementById('Choices').innerHTML += "<a href=\"javascript:void('');\" class=\"sbutton\" onClick=\"goback(QNum);\">GO BACK ONE</a>";
document.getElementById('Choices').innerHTML += "<a href=\"javascript:void('');\" class=\"sbutton\" style=\"float:right\" onClick=\"startAT('1');\">START OVER</a>";
} else if (QNum == 1) {
document.getElementById('Choices').innerHTML += "<a href=\"javascript:void('');\" class=\"sbutton\" onClick=\"startAT('1');\">GO BACK ONE</a>";
document.getElementById('Choices').innerHTML += "<a href=\"javascript:void('');\" class=\"sbutton\" style=\"float:right\" onClick=\"startAT('1');\">START OVER</a>";
}
document.getElementById('Choices').innerHTML += "</div>"
}
if (QNum != 0) {
if (goingback == 0) {
scroll2Q(Jht,800);
} else {
window.scrollTo(0, document.getElementById(Jht).offsetTop);
}
} else if (restar != undefined) {
window.scrollTo(0,0);
}
if (Xishere != 0 && window.self == window.top) {
console.log("Set focus for: "+Xishere);
document.getElementById(Xishere).focus();
}
console.log("Q#: "+QNum);
console.log("New Path: "+path);
QNum++;
goingback = 0;
}
function swapGOTO(QH,JH) {
var regex = new RegExp("GOTO:(\d*)(\.\d+)*");
if (regex.test(document.getElementById(QH).innerHTML)) {
var Qtext = document.getElementById(QH).innerHTML.match(/(GOTO:(\d*)(.\s*\d+)*)/);
document.getElementById('QandA').innerHTML += "<div id="+JH+" style=\"float:left;width:100%;height:1px;\"> </div>";
// Add question
// note I added () around the < to avoid a < followed by a ? which causes problems in php
var Qtexttrans = document.getElementById(QH).innerHTML.replace(/(<)?GOTO:(\d*)(.\s*\d+)*>?/,"");
Qtexttrans = Qtexttrans.replace(/\s*$/,"");
if (Qtexttrans != "") {
//document.getElementById('transcript').value += swapvar("BOT: "+Qtexttrans+"\n");
convo_bin.push(swapvar("BOT: "+Qtexttrans+"\n"));
}
if (document.getElementById(QH).innerHTML.match(/^GOTO:(\d*)(.\s*\d+)*/)) {
document.getElementById('QandA').innerHTML += document.getElementById(QH).innerHTML.replace(/(<)?GOTO:(\d*)(.\s*\d+)*>?/,"<"+Qtext+">");
} else {
document.getElementById('QandA').innerHTML += "<div class='frame'><div class='full'><div class='question_text'>"+ swapvar(document.getElementById(QH).innerHTML.replace(/(<)?GOTO:(\d*)(.\s*\d+)*>?/,"<"+Qtext+">"))+"</div></div><div class='question_arrow'></div></div>";
}
// replace GOTO with text
label = Qtext[0].replace("GOTO:","");
Qhtml = 'Q-'+label;
if (document.getElementById(Dhtml)) {
doc_bin.push([document.getElementById(Dhtml).innerHTML,currentQ]);
console.log("Add to Doc ("+Dhtml+"): "+document.getElementById(Dhtml).innerHTML);
//document.getElementById('doc').innerHTML += document.getElementById(Dhtml).innerHTML;
}
Dhtml = 'D-'+label;
GOTOfired = 1;
console.log("In swap: "+GOTOfired);
swapGOTO(Qhtml,JH);
}
}
function scroll2Q(id,speed) {
var top = document.getElementById(id).offsetTop; //Getting Y of target element
console.log("Jump to Y for ("+id+"): "+top);
//adapted from https://github.com/Yappli/smooth-scroll
var moving_frequency = 5; // Affects performance !
var hop_count = speed/moving_frequency
var getScrollTopDocumentAtBegin = document.documentElement.scrollTop + document.body.scrollTop;
var gap = (top - getScrollTopDocumentAtBegin) / hop_count;
for(var i = 1; i <= hop_count; i++)
{
(function()
{
var hop_top_position = gap*i;
setTimeout(function(){ window.scrollTo(0, hop_top_position + getScrollTopDocumentAtBegin); }, moving_frequency*i);
})();
}
}
function getElementsByIdIs(selectorTag, name) {
var items = [];
var myPosts = document.getElementsByTagName(selectorTag);
//omitting undefined null check for brevity
if (myPosts[0].id == name) {
items.push(myPosts[0]);
}
return items;
}
function getElementsByIdRegExp(selectorTag, expression) {
// note you need to escape \ in the expression with \, i.e., \\ = \
var regex = new RegExp(expression);
var items = [];
var myPosts = document.getElementsByTagName(selectorTag);
for (var i = 0; i < myPosts.length; i++) {
if (regex.test(myPosts[i].id)) {
items.push(myPosts[i]);
}
}
return items;
}
// startAT QnA
function startAT(id) {
document.getElementById('ondeck').innerHTML = document.getElementById('original').value;
document.getElementById('QandA').innerHTML = "";
//document.getElementById('transcript').value = "";
doc_bin = [];
convo_bin = [];
QNum = 0;
answerQ(id,'1');
}
//show funtion
function show(id) {
if (document.getElementById) { // DOM3 = IE5, NS6
document.getElementById(id).style.display = 'block';
} else {
if (document.layers) {
document.id.display = 'block';
} else {
document.all.id.style.display = 'block';
}
}
}
//hide funtion
function hide(id) {
if (document.getElementById) { // DOM3 = IE5, NS6
document.getElementById(id).style.display = 'none';
} else {
if (document.layers) {
document.id.display = 'none';
} else {
document.all.id.style.display = 'none';
}
}
}
//show OR hide funtion depends on if element is shown or hidden
function shoh(id) {
if (document.getElementById) { // DOM3 = IE5, NS6
if (document.getElementById(id).style.display == "none"){
document.getElementById(id).style.display = 'block';
} else {
document.getElementById(id).style.display = 'none';
}
} else {
if (document.layers) {
if (document.id.display == "none"){
document.id.display = 'block';
} else {
document.id.display = 'none';
}
} else {
if (document.all.id.style.visibility == "none"){
document.all.id.style.display = 'block';
} else {
document.all.id.style.display = 'none';
}
}
}
}
function swapvar(input) {
var output;
for(var i = 0; i < QVnames.length; i++) {
if (document.getElementById(QVnames[i][1])) {
var item = QVnames[i][1].replace(/\./g,"\\.");
var varegx = new RegExp("<x>"+item+"<\/x>","gi");
//console.log(QVnames[i][1]);
input = input.replace(varegx,document.getElementById(QVnames[i][1]).innerHTML);
}
}
output = input
return output
}
function docforindex(indexID) {
for(var i = 0; i < doc_bin.length; i++) {
if(doc_bin[i][1] == indexID) {
return true;
}
}
}
function indexis(variablename) {
for(var i = 0; i < QVnames.length; i++) {
if(QVnames[i][1] == variablename) {
return QVnames[i][0];
}
}
}
function valueis(variablekey) {
for(var i = 0; i < QVnames.length; i++) {
if(QVnames[i][0] == variablekey) {
return QVnames[i][1];
}
}
}
function look4goto(qn,id) {
console.log("GOTO SEARCH: "+id);
var qID = "Q-"+id;
// If there's a doc in the XXXXXXXXXXXXXXXX, remove it.
if (docforindex(path.indexOf(id))) {
console.log("DOC FOUND "+id);
doc_bin.splice(doc_bin.length-1,1);
}
convo_bin.splice(-2,2);
var re = new RegExp("GOTO:(([a-z0-9\._-]*)\s*)$","gi");
if (document.getElementById(qID).innerHTML.match(re)) {
convo_bin.splice(-1,1);
console.log("GOTO FOUND: "+id);
textinput = re.exec(document.getElementById(qID).innerHTML)[2]+"";
if (docforindex(indexis(textinput))) {
document.getElementById("Xi-"+path[qn]).value = document.getElementById(valueis(textinput)).innerHTML;
console.log("DOC FOUND "+textinput);
doc_bin.splice(doc_bin.length-1,1);
}
look4goto(qn,textinput);
}
}
function goback(qn) {
Qlast = qn - 3
qn = qn - 2;
label = path[qn];
goingback = 1;
console.log("GO BACK TO:"+qn);
var re = new RegExp('(((^|\\n).*)*)<div id="break-at-'+qn+'" class="frame">((.*)(\\W.*))*', 'g');
document.getElementById("QandA").innerHTML = document.getElementById("QandA").innerHTML.replace(re, '$1');
document.getElementById('Choices').innerHTML += "<input type=\"hidden\" id=\"Xi-"+path[qn]+"\" name=\"Xi-"+path[qn]+"\" value=\"\">";
console.log("####################: "+path[path.length-1]);
//look4goto(qn,path[path.length-1]);
path.splice(-1,1);
convo_bin.splice(-4,4);
//convo_bin.splice(-2,2);
// If there's a doc in the last Q that you're removing, hold on to it.
// And put it back after you've removed it. When you rerender the Q.
if (document.getElementById("X-"+path[qn]) && document.getElementById(valueis(path[Qlast]))) {
document.getElementById("Xi-"+path[qn]).value = document.getElementById(valueis(path[Qlast])).innerHTML;
doc_bin.splice(doc_bin.length-1,1);
}
// If there's a doc in the current Q, remove it.
if (docforindex(currentQ)) {
console.log("DOC FOUND (current) "+currentQ);
doc_bin.splice(doc_bin.length-1,1);
}
// If there's a doc in the queued up Q, remove it.
if (document.getElementById(Dhtml)) {
console.log("DOC FOUND (ondeck)"+Dhtml);
doc_bin.splice(doc_bin.length-1,1);
}
look4goto(qn,path[path.length-1]);
if (freetext != 0) {
document.getElementById(freetext).value = "";
}
QNum = qn;
loadQ = path[path.length-1];
path.splice(-1,1);
console.log("Reload ans for: "+loadQ);
answerQ(loadQ);
}
function transcript(output) {
var convo_output = "";
for (var i = 0, len = convo_bin.length; i < len; i++) {
convo_output += convo_bin[i];
}
if (output == 1) {
return convo_output;
} else {
return convo_output.replace(/<[^>]*>/g,"");
}
}
function doc() {
var doc_output = "";
for (var i = 0, len = doc_bin.length; i < len; i++) {
doc_output += doc_bin[i][0];
}
return swapvar(doc_output);
}
function json_str() {
var json_list = "{";
for(var i = 0; i < QVnames.length; i++) {
if (!document.getElementById("Q-"+QVnames[i][0]).innerHTML.match(/(GOTO:(\d*)(.\s*\d+)*)/)) {
if (document.getElementById(QVnames[i][1])) {
json_list = json_list+'"'+QVnames[i][1]+'":"'+document.getElementById(QVnames[i][1]).innerHTML+'"';
} else {
json_list = json_list+'"'+QVnames[i][1]+'":"'+'"';
}
json_list = json_list+",";
}
if (i+1 == QVnames.length) {
json_list = json_list.replace(/,$/, '');
json_list = json_list+"}";
}
}
return json_list;
}
function mail2(to,subject,body) {
to = encodeURIComponent(to);
subject = encodeURIComponent(subject);
body = encodeURIComponent(body);
window.location.href = "mailto:"+to+"?subject="+subject+"&body="+body;
}
function submit2(action,method,docAs,instructions,transcriptAs,jsonAs,target) {
document.FORM.action = action;
document.FORM.method = method;
if (target) {
document.FORM.target = target;
} else {
document.FORM.target = "_self";
}
if (docAs) {
if (document.getElementsByName(docAs).length == 0) {
var doctext = document.createElement("textarea");
doctext.style.display ='none';
doctext.name= docAs;
doctext.value= doc();
document.getElementById('FORM').appendChild(doctext);
} else {
$('textarea[name='+docAs+']').val(json_str())
}
if (instructions) {
if (document.getElementsByName('i').length == 0) {
var instructtext = document.createElement("textarea");
instructtext.type='hidden';
instructtext.style.display ='none';
instructtext.name= 'i';
instructtext.value= instructions;
document.getElementById('FORM').appendChild(instructtext);
} else {
$('textarea[name=i]').val(json_str())
}
}
}
if (transcriptAs) {
if (document.getElementsByName(transcriptAs).length == 0) {
var ttext = document.createElement("textarea");
ttext.type='hidden';
ttext.style.display ='none';
ttext.name= transcriptAs;
ttext.value= transcript();
document.getElementById('FORM').appendChild(ttext);
} else {
$('textarea[name='+transcriptAs+']').val(json_str())
}
}
if (jsonAs) {
if (document.getElementsByName(jsonAs).length == 0) {
var json = document.createElement("textarea");
json.type='hidden';
json.style.display ='none';
json.name= jsonAs;
json.value= json_str();
document.getElementById('FORM').appendChild(json);
} else {
$('textarea[name='+jsonAs+']').val(json_str())
}
}
var ondeckdiv = document.getElementById('ondeck').innerHTML;
var rawmarkupdiv = document.getElementById('rawmarkup').innerHTML;
document.getElementById('ondeck').innerHTML = "";
document.getElementById('rawmarkup').innerHTML = "";
document.FORM.submit();
document.getElementById('ondeck').innerHTML = ondeckdiv;
document.getElementById('rawmarkup').innerHTML = rawmarkupdiv;
}
function csv() {
var csv_list = "";
for(var i = 0; i < QVnames.length; i++) {
if (!document.getElementById("Q-"+QVnames[i][0]).innerHTML.match(/(GOTO:(\d*)(.\s*\d+)*)/)) {
csv_list = csv_list+'"'+QVnames[i][1]+'"';
csv_list = csv_list+",";
}
if (i+1 == QVnames.length) {
csv_list = csv_list.replace(/,$/, '');
csv_list = csv_list+"\n";
}
}
for(var i = 0; i < QVnames.length; i++) {
if (!document.getElementById("Q-"+QVnames[i][0]).innerHTML.match(/(GOTO:(\d*)(.\s*\d+)*)/)) {
if (document.getElementById(QVnames[i][1])) {
csv_list = csv_list+'"'+document.getElementById(QVnames[i][1]).innerHTML+'"';
} else {
csv_list = csv_list+'""';
}
csv_list = csv_list+",";
}
if (i+1 == QVnames.length) {
csv_list = csv_list.replace(/,$/, '');
csv_list = csv_list+"\n";
}
}
return csv_list;
}
function getvar(val) {
return document.getElementById(val).value;
}
function goto(val) {
answerQ(indexis(val));
}
// h/t http://runnable.com/U5HC9xtufQpsu5aj/use-javascript-to-save-textarea-as-a-txt-file
function save2(filename,content)
{
// I'm using file system support as a proxy for support for this feature.
// Check based on one found at: http://blog.teamtreehouse.com/building-an-html5-text-editor-with-the-filesystem-apis
// Handle vendor prefixes.
window.requestFileSystem = window.requestFileSystem ||
window.webkitRequestFileSystem;
// Check for support.
if (window.requestFileSystem) {
// content = ID of textarea to save
// name = name to save file as, including file extension
// grab the content of the form field and place it into a variable
// var textToWrite = document.getElementById(content).value;
// create a new Blob (html5 magic) that conatins the data from your form feild
var textFileAsBlob = new Blob([content], {type:'text/plain'});
// Specify the name of the file to be saved
var fileNamecontentAs = filename;
// Optionally allow the user to choose a file name by providing
// an imput field in the HTML and using the collected data here
// var fileNamecontentAs = txtFileName.text;
// create a link for our script to 'click'
var downloadLink = document.createElement("a");
// supply the name of the file (from the var above).
// you could create the name here but using a var
// allows more flexability later.
downloadLink.download = fileNamecontentAs;
// provide text for the link. This will be hidden so you
// can actually use anything you want.
downloadLink.innerHTML = "My Hidden Link";
// allow our code to work in webkit & Gecko based browsers
// without the need for a if / else block.
window.URL = window.URL || window.webkitURL;
// Create the link Object.
downloadLink.href = window.URL.createObjectURL(textFileAsBlob);
// when link is clicked call a function to remove it from
// the DOM in case user wants to save a second file.
downloadLink.onclick = destroyClickedElement;
// make sure the link is hidden.
downloadLink.style.display = "none";
// add the link to the DOM
document.body.appendChild(downloadLink);
// click the new link
downloadLink.click();
} else {
alert('This feature is not supported by your browser.');
}
}
function destroyClickedElement(event)
{
// remove the link from the DOM
document.body.removeChild(event.target);
}
// EOF
</script>