function vote(id,direction,anonymous)
{if(anonymous){document.location='/signup/index.html?attempt=vote';return;}
$.get(handler,{'method':'vote','id':id,'d':direction},function(reply){if(!reply){alert('There was no response from the server.');}else if(reply.error){alert(reply.error);}else{var directions=new Array('Down','Up');var button=id+'-vote'+directions[direction];var active=ID(button).src.search('2')!==-1;var otherDirection=1-direction;var otherPressed=ID(id+'-vote'+directions[otherDirection]).src.search('2')!==-1;if(direction==0)
direction=-1;if(otherPressed)
ID(id+'-votes').innerHTML=forceNumber(ID(id+'-votes').innerHTML)+(forceNumber(direction));if(!active){ID(button).src=ID(button).src.replace('1','2');}else{ID(button).src=ID(button).src.replace('2','1');}
ID(id+'-vote'+directions[otherDirection]).src=ID(id+'-vote'+directions[otherDirection]).src.replace('2','1');ID(id+'-votes').innerHTML=forceNumber(ID(id+'-votes').innerHTML)+(forceNumber(direction)*(ID(button).src.search('2')===-1?-1:1));}});}
function updateTip(index)
{if(index==0){var string=' ';}else if(index==1){var string='Tie problems and solutions in society to the law, court cases, articles, and organizations.';}else if(index==2){var string='Investigate the law and how it relates to court cases and societal issues.';}else if(index==3){var string='View over 16 million court and agency dockets, documents and opinions free of charge.';}else if(index==4){var string='Access additional features for attorneys, including data analytics, with PlainSite Pro.';}else if(index==5){var string='Create useful neighborhood reports for prospective home buyers.';}else if(index==6){var string='Access additional features for pro se litigants, including helpful guides, with PlainSite Pro Se.';}else if(index==7){var string='Read about government, the law, and how it affects you.';}else if(index==8){var string='Investigate law firms, attorneys, their clients, and job opportunties.';}else if(index==9){var string='Investigate companies, non-profits and PACs, their donations, and their legal histories.';}
ID('tip').innerHTML=string;}
function follow(box,linktable,linkid)
{$.get(handler,{'method':'follow','linktable':linktable,'linkid':linkid},function(reply){if(reply.error){alert(reply.error);}else{if(box.src.indexOf(1)!=-1){box.src=box.src.replace(1,2);box.title='Followed';}else{box.src=box.src.replace(2,1);box.title='Click to Follow';}}});}
function toggleAttorneyTable(index)
{var id='attorneys'+index;if(ID(id).style.display=='block'||ID(id).style.display==''){ID('toggleSwitch'+index).src=ID('toggleSwitch'+index).src.replace('down','right');hideID(id);}else{ID('toggleSwitch'+index).src=ID('toggleSwitch'+index).src.replace('right','down');showID(id);}}
function noteFiler(box,color,entryid,partyid)
{$.get(handler,{'method':'noteFiler','partyid':partyid,'entryid':entryid},function(reply){if(reply.error){alert(reply.error);}else{if(box.style.backgroundColor==''){box.style.backgroundColor=color;}else{box.style.backgroundColor='';}}});}
function saveComment(linktable,linkid,boxid)
{$.get(handler,{'method':'saveComment','linktable':linktable,'linkid':linkid,'memo':document.forms['comment'+boxid].elements['comment'+boxid].value},function(reply){if(!reply){alert('There was no response from the server.');}else if(reply.error){alert(reply.error);}else{ID('commentBox'+boxid).innerHTML=reply.html;}});}
function saveCaseSummary(id)
{$.post(handler,{'method':'saveCaseSummary','docketid':id,'summary':document.forms['summary'].elements['summary'].value},function(reply){if(!reply){alert('There was no response from the server.');}else if(reply.error){alert(reply.error);}else{ID('caseSummary').innerHTML=document.forms['summary'].elements['summary'].value.replace(/(\r\n|\n|\r)/gm,"
\n");hideID('caseSummaryDetails');showID('caseSummaryLabel');}});}
function requestDocument(entryid,boxid)
{ID('requestNotice'+boxid).innerHTML='
Requesting...';ID('requestNotice'+boxid).style.cssText='padding-right: 16px;';$.get(handler,{'method':'requestDocument','entryid':entryid},function(reply){if(!reply){alert('There was no response from the server.');}else if(reply.error){alert(reply.error);}else{alert(reply.message);hideID('requestNotice'+boxid);}});}
function showUploadEntry(rowid,docketid,entry,attachments)
{box=ID(rowid).children[1];var o='
\n';o+=reply.detail+'
\n\n';ID('clause').innerHTML=o;if(!issueid){document.forms['issues'].elements['statuteid'].value=reply.statuteid;document.forms['issues'].elements['editheading'].value=reply.heading;document.forms['issues'].elements['editdetail'].value=reply.ascii;}}});} function jumpToStatute() {var data={method:'getClause',corpusid:document.forms['jumper'].elements['corpusid'].value,title:ID('title').value,section:ID('section').value};$.get(handler,data,function(reply){if(reply.error){alert(reply.error);}else{document.location='index.html?id='+reply.statuteid;}});} function switchIssueLawView(toView) {hideID('current');hideID('changes');hideID('proposed');showID(toView);if(toView=='current'){ID('detail').style.backgroundColor='#F0F0FF';ID('law').innerHTML='Current Law';}else if(toView=='changes'){ID('detail').style.backgroundColor='#F0F0F0';ID('law').innerHTML='Changes';}else if(toView=='proposed'){ID('detail').style.backgroundColor='#F0FFF0';ID('law').innerHTML='Proposed Law';}} function postNews(issueid) {var data={method:'postNews',issueid:issueid,title:ID('newstitle').value,hyperlink:ID('newslink').value};$.get(handler,data,function(reply){if(reply.error){alert(reply.error);}else{var o='\n';o+=''+ID('newstitle').value+'
\n\n';ID('news').innerHTML+=o;showTR('newsRow');if(!issueid) document.forms[0].elements['statuteid'].value=reply.statuteid;}});} function postEntity(linktable,linkid) {var data={'method':'postEntity','linktable':linktable,'linkid':linkid,'entityid':document.forms[linktable].elements['entityid'].value,'role':(ID('entityrole')!=null?ID('entityrole').value:'-1')};$.get(handler,data,function(reply){if(reply.error){alert(reply.error);}else if(reply.html){ID('entities').innerHTML+=reply.html;if(!linkid&&linktable=='issues') document.forms[0].elements['statuteid'].value=reply.statuteid;}});} function linkEntityPeople(formName,parentid,childid) {var data={method:'linkEntityPeople',parentid:parentid,childid:ID('entityid').value,role:ID('entityrole').value};$.get(handler,data,function(reply){if(reply.error){alert(reply.error);}else{var o='\n';o+=''+ID('entityidDisplay').value+'
\n\n';ID('entities').innerHTML+=o;}});} function postCourtCase(issueid) {var data={method:'postCourtCase',issueid:issueid,docketid:ID('docketid').value};$.get(handler,data,function(reply){if(reply.error){alert(reply.error);}else{var o='\n';o+=ID('docketidDisplay').value+'
\n\n';ID('cases').innerHTML+=o;showTR('casesRow');}});} function updateDivider1(box) {if(box.value==1){ID('divider1').innerHTML='Article';return;}else if(box.value==2){ID('divider1').innerHTML='Amendment';return;} ID('divider1').innerHTML='Title';return;} function whichLaw(value) {if(value==0){hideTR('lawpicker');hideTR('editinstructions');hideTR('editheading');hideTR('editdetail');ID('clause').innerHTML='';ID('clause').className='';}else{showTR('lawpicker');if(document.forms['issues'].elements['next'][2].checked){showTR('editinstructions');showTR('editheading');showTR('editdetail');}}} function thirdPartySolution() {hideTR('solution');hideTR('solutionexample');hideTR('solutiondetail');hideTR('solutioninstructions');hideTR('solutionanonymous');hideTR('solutiondiv');hideTR('editinstructions');hideTR('editheading');hideTR('editdetail');ID('existingsolution').style.display='none';} function getSolutions() {hideTR('solution');hideTR('solutionexample');hideTR('solutiondetail');hideTR('solutioninstructions');hideTR('solutionanonymous');hideTR('solutiondiv');hideTR('editinstructions');hideTR('editheading');hideTR('editdetail');ID('existingsolution').style.display='';} function mySolution() {showTR('solution');showTR('solutionexample');showTR('solutiondetail');showTR('solutioninstructions');showTR('solutionanonymous');showTR('solutiondiv');if(document.forms['issues'].elements['whichlaw'][1].checked){showTR('editinstructions');showTR('editheading');showTR('editdetail');} ID('existingsolution').style.display='none';} function setScope(value,signedIn) {hideID('country');hideID('stateprovince');hideID('postalcode');if(signedIn) hideID('entityid');if(value==0){ID('scopeLabel').children[0].innerHTML='Country';showID('country');showTR('whichlawQuestionRow');showTR('whichlawRow');if(document.forms[0].elements['whichlaw'][1].checked) showTR('lawpicker');}else if(value==1){ID('scopeLabel').children[0].innerHTML='State / Province';showID('stateprovince');showTR('whichlawQuestionRow');showTR('whichlawRow');if(document.forms[0].elements['whichlaw'][1].checked) showTR('lawpicker');}else if(value==2){ID('scopeLabel').children[0].innerHTML='Postal Code';showID('postalcode');showTR('whichlawQuestionRow');showTR('whichlawRow');if(document.forms[0].elements['whichlaw'][1].checked) showTR('lawpicker');}else if(signedIn&&value==3){ID('scopeLabel').children[0].innerHTML='Organization';showID('entityid');hideTR('whichlawQuestionRow');hideTR('whichlawRow');if(document.forms[0].elements['whichlaw'][1].checked) hideTR('lawpicker');document.forms[0].elements['whichlaw'][0].checked=true;}} function selectTopSearch(data) {if(!data||!data.type||!data.id) return false;switch(data.type){case'tags':window.location=data.link;break;case'problems':window.location='/issues/index.html?id='+data.id;break;case'solutions':window.location='/issues/index.html?id='+data.id;break;case'statutes':window.location='/laws/index.html?id='+data.id;break;case'dockets':window.location=data.link;break;case'judges':window.location=data.link;break;case'attorneys':window.location=data.link;break;case'entities':window.location=data.link;break;case'patentapplications':window.location='/patents/application.html?id='+data.id;break;case'trademarkapplications':window.location='/trademarks/application.html?id='+data.id;break;case'diagrams':window.location='/pro/diagrams/draw.html?focus='+data.id+'&level=1';break;case'homemap':window.location='/homemap/report.html?id='+data.id;break;case'notice':window.location='/pro/index.html';break;case'request':window.location='/control/requests.html?id='+data.id;break;default:window.location='/'+data.type+'/index.html?id='+data.id;break;}} function linkEntities(data,li,input,autoPost) {var o='';o+='';o+=''+data.value.replace(' ',' ')+'';o+='