// Votes 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)); } }); } // Home 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; } // Follow function follow(box, linktable, linkid) { $.get(handler, { 'method': 'follow', 'linktable': linktable, 'linkid': linkid }, function(reply) { if (reply.error) { alert(reply.error); } else { if (linktable == 'users') { if (box.src.indexOf(3) != -1) { box.src = box.src.replace(3, 4); box.title = 'Following'; } else { box.src = box.src.replace(4, 3); box.title = 'Follow'; } } else { if (box.src.indexOf(1) != -1) { box.src = box.src.replace(1, 2); box.title = 'Following'; } else { box.src = box.src.replace(2, 1); box.title = 'Follow'; } } } }); } function showFollowers() { $.get(handler, { 'method': 'listFollowers', 'id': ID('id').value }, function(reply) { if (! reply) { alert('There was no response from the server.'); } else if (reply.error) { alert(reply.error); } else { if (window.profile == null || ! window.profile.length) window.profile = ID('rightPane').innerHTML; ID('rightPane').innerHTML = reply.html; } }); } function showFollowing() { $.get(handler, { 'method': 'listFollowing', 'id': ID('id').value }, function(reply) { if (! reply) { alert('There was no response from the server.'); } else if (reply.error) { alert(reply.error); } else { if (window.profile == null || ! window.profile.length) window.profile = ID('rightPane').innerHTML; ID('rightPane').innerHTML = reply.html; } }); } function showProfile() { ID('rightPane').innerHTML = window.profile; window.profile = ''; } // Cases function toggleAttorneyTable(index) { var id = 'attorneys' + index; if (ID(id).style.display == 'block' || ID(id).style.display == '') { ID('toggleSwitch' + index).innerHTML = '▶'; hideID(id); } else { ID('toggleSwitch' + index).innerHTML = '▼'; 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, 'status': document.forms['summary'].elements['status'].value, '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 = 'Loading 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\n'; o += '\n'; o += '\n'; o += '\n'; if (attachments) { o += "\n"; o += "\n"; } o += 'SpaceUpload\n\n'; o += '
'; box.innerHTML = o; showTR(rowid); } function uploadEntry(rowid, docketid, entry) { if (! document.forms['upload' + entry].elements['file' + entry].files.length) { alert('Please choose a file to upload.'); return; } var oldIcon = ID('icon' + entry).src; ID('icon' + entry).src = 'http://s.thinklink.com/images/loading2.gif'; var data = new FormData(document.forms['upload' + entry]); $.ajax({ 'type': 'POST', 'url': handler + '?method=uploadDocketFile', 'data': data, 'processData': false, 'contentType': false, 'success': function(reply) { if (! reply) { alert('There was no response from the server.'); ID('icon' + entry).src = oldIcon; } else if (reply.error) { alert(reply.error); ID('icon' + entry).src = oldIcon; } else { if (reply.attachments) { for (var i = 0; i < reply.attachments; i++) { var attachmentNumber = reply.attachments == 1 ? ID('attachmentnumber' + entry).value : i + 1; ID('attachments' + entry).innerHTML += "\n"; ID('attachments' + entry).innerHTML += '
  • Attachment ' + attachmentNumber + "
  • "; } ID('icon' + entry).src = oldIcon; if (reply.attachments == 1 && ! isNaN(ID('attachmentnumber' + entry).value + 0)) ID('attachmentnumber' + entry).value++; } else if (reply.entryid) { ID('icon' + entry).src = shared + 'icons/pdf.gif'; ID('iconLink' + entry).href = '/dockets/download.html?id=' + reply.entryid + '&z=' + reply.hash; ID('textLink' + entry).href = '/dockets/download.html?id=' + reply.entryid + '&z=' + reply.hash; if (reply.requests) ID('flag' + entry).src = ID('flag' + entry).src.replace('_red', '_green'); } ID('file' + entry).value = ''; } }, 'error': function(reply) { alert(reply); ID('icon' + entry).src = oldIcon; } }); } function setEntryStatus(entryid, status, icon) { $.get(handler, { 'method': 'setEntryStatus', 'entryid': entryid, 'status': status }, function(reply) { if (! reply) { alert('There was no response from the server.'); } else if (reply.error) { alert(reply.error); } else { icon.parentNode.parentNode.previousElementSibling.previousElementSibling.children[0].innerHTML = icon.outerHTML; } }); } // Law function refreshIssues(numberLinks, type) { for (var i = 0; i < numberLinks; i++) { ID('link' + i).style.fontWeight = ''; } ID('link' + (type == 'top' ? 0 : 1)).style.fontWeight = 'bold'; var data = { 'method': 'getIssues', 'type': type }; $.get(handler, data, function(reply) { if (reply.error) { alert(reply.error); } else { ID('issues').innerHTML = reply; } }); } function displayStatute(issueid) { var data = { method: 'getClause', corpusid: document.forms[0].elements['corpusid'].value, title: ID('title').value, section: ID('section').value }; if (issueid) data.issueid = issueid; $.get(handler, data, function(reply) { if (reply.error) { alert(reply.error); } else { ID('clause').className = 'statute'; var o = ''; if (reply.heading) { o += '

    \n'; o += '' + reply.heading + '

    \n\n'; } o += '

    \n'; o += reply.detail + '

    \n\n'; ID('clause').innerHTML = o; // For solve.html 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 postPost(contactid) { var text = ID('text').value; if (text.length == 0) { alert('Please type a message to post.') return false; } if (text.length > 1048576 * 16) { alert('Please type a shorter message to post.') return false; } if (document.forms['contacts'].elements['file'].files.length) uploadChatFile(document.forms['contacts'].elements['file']); var tagIDs = ''; if (document.forms['contacts'].elements['postsTags[]'] != null) { if (document.forms['contacts'].elements['postsTags[]'].length > 1) { for (var i = 0; i < document.forms['contacts'].elements['postsTags[]'].length; i++) { if (i) tagIDs += ','; tagIDs += document.forms['contacts'].elements['postsTags[]'][i].value; } } else { tagIDs = document.forms['contacts'].elements['postsTags[]'].value; } } else { if (ID('postsTag').value.replace('/\s/', '').length) { digestTag(ID('postsTag'), { 'keyCode': 13 }); tagIDs = document.forms['contacts'].elements['postsTags[]'].value; } else { alert('Please tag your post with at least one tag.'); return false; } } var replytoid = 0; var data = { method: 'postPost', contactid: contactid, replytoid: replytoid, text: text, tags: tagIDs }; $.post(handler, data, function(reply) { if (reply.error) { alert(reply.error); } else { if (document.getElementById('noposts') != null) hideID('noposts'); var postsTable = document.getElementById('posts'); if (postsTable != null) { postsTable.getElementsByTagName('tbody')[0].innerHTML = reply.html + postsTable.innerHTML; $('#post' + reply.postid).show(500); $('#timestamp' + reply.postid).show(500); } else { $('#mostRecentPost').fadeOut(500, function() { ID('mostRecentPost').innerHTML = text; }); $('#mostRecentPost').fadeIn(500); } ID('text').value = ''; ID('attachments').childNodes[3].innerHTML = ''; ID('post' + reply.postid + 'Tags').innerHTML = ID('postsTagResults').innerHTML; ID('postsTagResults').innerHTML = ''; } }); } 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 = data.link; break; case 'request': window.location = '/control/requests.html?id=' + data.id; break; default: window.location = '/' + data.type + '/index.html?id=' + data.id; break; } } // Companies function linkEntities(data, li, input, autoPost) { var o = ''; o += ''; o += '' + data.value.replace(' ', ' ') + ''; o += 'Delete'; o += ''; ID('tagResults').innerHTML += o; ID('tag').value = ''; $.get(handler, { 'method': 'linkEntities', 'parentid': document.forms[0].elements['id'].value, 'childid': data.id }, function(reply) { if (reply.error) { alert(reply.error); } else if (! reply.connectionid) { alert('There was a problem adding your link.'); } else { alert('Thanks! As soon as an administrator confirms your link it will appear on PlainSite.'); } }); } // Pro function proContent(module) { $.get(handler, { 'method': 'proContent', 'module': module }, function(reply) { if (reply.error) { alert(reply.error); } else { ID('proContent').vAlign = 'top'; ID('proContent').innerHTML = reply.html; $('#proContent input.auto-complete').autoComplete({ ajax: shared + 'javascript/handler.js', minChars: 2, postVar: 'q', maxItems: 10, delay: 200, preventEnterSubmit: true }); } }); } function setAttorneyContactID(attorneyid) { $.get(handler, { 'method': 'setAttorneyContactID', 'attorneyid': attorneyid }, function(reply) { if (reply.error) { alert(reply.error); } else { proContent('cases'); } }); } function filterDocket(box) { var numberEntries = ID('numberEntries').value; // Refresh entries on change (or turn off the filter) for (var i = 0; i < numberEntries; i++) { showTR('entry' + i + 'primary'); showTR('entry' + i + 'secondary'); showTR('entry' + i + 'tools'); if (! box.value) { showID('commentNotice' + i); hideID('comment' + i); } if (i < numberEntries - 1) showTR('entry' + i + 'line'); } // If the filter isn't off, do the filtering if (box.value != '') { for (var i = 0; i < numberEntries; i++) { if (box.value != ID('entry' + i + 'primary').children[2].children[0].innerHTML) { hideTR('entry' + i + 'primary'); hideTR('entry' + i + 'secondary'); hideTR('entry' + i + 'upload'); hideTR('entry' + i + 'tools'); hideTR('comment' + i); hideTR('upload' + i); if (i < numberEntries - 1) hideTR('entry' + i + 'line'); } } } } function jump(entry) { filterDocket({ 'value': false }); document.location.href = '#entry' + entry; } function uploadDocument(linktable, linkid) { if (! document.forms['upload'].elements['file'].files.length) { alert('Please choose a file to upload.'); return; } var page = document.forms['upload'].elements['linktable'].value; var oldIcon = ID('uploadIcon').src; ID('uploadIcon').src = 'http://s.thinklink.com/images/loading2.gif'; var data = new FormData(document.forms['upload']); $.ajax({ 'type': 'POST', 'url': handler + '?method=uploadDocument', 'data': data, 'processData': false, 'contentType': false, 'success': function(reply) { var page = document.forms['upload'].elements['linktable'].value; if (! reply) { alert('There was no response from the server.'); if (page == 'dockets') ID('icon' + entry).src = oldIcon; } else if (reply.error) { alert(reply.error); if (page == 'dockets') ID('icon' + entry).src = oldIcon; } else { if (reply.documentid) { if (page == 'dockets') { ID('uploadIcon').src = shared + 'icons/pdf.gif'; zoomIn(linktable, linkid); } else { ID('uploadIcon').src = oldIcon; updateDocumentGrid(linkid); $('#addDocument').slideUp('fast'); document.forms['upload'].elements['description'].value = ''; document.forms['upload'].elements['summary'].value = ''; document.forms['upload'].elements['type'].value = 'Public Domain'; document.forms['upload'].elements['date'].value = ''; document.forms['upload'].elements['sourceentityid'].value = ''; document.forms['upload'].elements['sourceentityidDisplay'].value = ''; document.forms['upload'].elements['url'].value = ''; document.forms['upload'].elements['file'].value = ''; } } else if (reply.html) { ID('uploadIcon').src = oldIcon; ID('addDocument').outerHTML = reply.html; } } }, 'error': function(reply) { var page = document.forms['upload'].elements['linktable'].value; alert(reply); ID('uploadIcon').src = oldIcon; } }); } function updateDocumentGrid(entityid) { $.get(handler, { 'method': 'getDocumentGrid', 'entityid': entityid }, function(reply) { if (! reply) { alert('There was no response from the server.'); } else if (reply.error) { alert(reply.error); } else { ID('documentgrid').innerHTML = reply.html; } }); } function updateDocket(docketid) { ID('docketUpdateLink').outerHTML = 'Request Pending...'; $.get(handler, { 'method': 'updateDocket', 'docketid': docketid }, function(reply) { if (reply.message) { alert(reply.message); } else if (reply.error) { alert(reply.error); } }); } // GOLD & LREF Standards function getDocketEntries(docketid, entryUpdateJS) { showTR('entryRow'); $.get(handler, { 'method': 'getDocketEntries', 'docketid': docketid, 'entryUpdateJS': entryUpdateJS }, function(reply) { if (reply.error) { ID('entryRow').children[1].innerHTML = reply.error; } else { ID('entryRow').children[1].innerHTML = reply; } }); } function updateLREF(docketid) { getDocketEntries(docketid, 'lref'); $.get(handler, { 'method': 'getLREFData', 'docketid': docketid }, function(reply) { if (reply.error) { alert(reply.error); } else { showID('lrefContainer'); ID('lref').innerHTML = 'docket://' + reply.domain + '.' + reply.docket; } }); } function updateLREFEntry(box) { ID('lrefEntry').innerHTML = (box.value.length ? '.' : '') + box.value; } // RECAP Detection function detectRECAP() { var image = document.createElement("img"); if (navigator.userAgent.match('Chrome') != null) { image.addEventListener("load", function(e) { window.recap = 'RECAP for Chrome'; }, false); image.addEventListener("error", function(e) { window.recap = 'None'; }, false); image.setAttribute("src", "chrome-extension://oiillickanjlaeghobeeknbddaonmjnc/icon-32.png"); } else if (navigator.userAgent.match('Firefox') != null) { // There appears to be no way to detect whether RECAP for Firefox is actually installed window.recap = 'None'; } else { window.recap = 'IE'; } } function downloadLink(link) { if (window.recap == 'RECAP for Chrome' || window.recap == 'RECAP for Firefox' || window.recap == 'IE') { window.location.href = link; } else if (navigator.userAgent.match('Chrome') != null) { ID('recapLink').href = 'https://chrome.google.com/webstore/detail/recap/oiillickanjlaeghobeeknbddaonmjnc'; recapModal(link); } else if (navigator.userAgent.match('Firefox') != null) { ID('recapLink').href = 'https://addons.mozilla.org/firefox/downloads/file/201452/recap-0.9.1-fx.xpi'; recapModal(link); } } function recapModal(link, browser) { var image = ID('recapLogo'); image.setAttribute("src", shared + "images/recap.png"); $(function() { ID('pacerLink').href = link; $("#getRECAP").dialog({ width: 480, height: 300, modal: true, position: { my: "center", at: "center", of: window } }); $("#getRECAP").dialog('open'); }); } // Chat function filterPosts(accountid, year, month) { $.get(handler, { 'method': 'filterPosts', 'accountid': accountid, 'year': year, 'month': month }, function(reply) { if (reply.error) { alert(reply.error); } else { ID('posts').childNodes[2].innerHTML = reply.html; } }); } function uploadChatFile(box) { if (! document.forms['contacts'].elements['file'].files.length) { alert('Please choose a file to upload.'); return; } var data = new FormData(document.forms['contacts']); $.ajax({ 'type': 'POST', 'url': handler + '?method=uploadChatFile', 'data': data, 'processData': false, 'contentType': false, 'success': function(reply) { if (! reply) { alert('There was no response from the server.'); } else if (reply.error) { alert(reply.error); ID('file').value = ''; } else { ID('file').value = ''; if (reply.photoid) { ID('attachments').childNodes[3].innerHTML += 'Attachment'; $('#attachments').show(500); } else if (reply.documentid) { ID('attachments').childNodes[3].innerHTML += 'Attachment'; } } }, 'error': function(reply) { alert(reply); } }); } function deletePhoto(photoid, source) { $.get(handler, { 'method': 'deletePhoto', 'photoid': photoid, 'source': source }, function(reply) { if (reply.error) { alert(reply.error); } else { ID('thumbnail-' + photoid).src = 'https://s.thinklink.com/images/nophotosmb.gif'; hideID('deletePhotoButton'); } }); } // Zoom function initDialogue(shade, level) { document.getElementById('zoomcontainer').style.cssText = 'width: 800px; left: ' + (window.innerWidth - 800) / 2 + 'px; top: ' + (window.innerHeight - 520) / 2 + 'px; z-index: 10;'; $('.dialogue .fullpage').width($(document).width()); $('.dialogue .fullpage').height($(document).height()); if (shade == 'light') $('.dialogue .lightshade').css({opacity: level}); if (shade == 'dark') $('.dialogue .darkshade').css({opacity: level}); } function zoomIn() { initDialogue('dark', 0.6); // initDialogue('light', 0.9); showID('zoom'); } function zoomOut() { hideID('zoom'); }