var attachment_types = ["word", "excel", "powerpoint", "pdf", "compressed", "text", "odf", "vcard", "image", "audio", "video", "flash", "other"]; var count = 0; var expsrc = 0; var current_message_serial = 1; var current_messages = new Array(); function getXMLHttp() { var XMLHttp = null; if(window.XMLHttpRequest) { try { XMLHttp = new XMLHttpRequest(); } catch(e) { } } else if(window.ActiveXObject) { try { XMLHttp = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { XMLHttp = new ActiveXObject("Microsoft.XMLHTTP"); } catch(e) { } } } return XMLHttp; } function loadHealth() { var http = getXMLHttp(); if(http == null) { alert("Error creating XMLHttpRequest"); return; } http.onreadystatechange = function() { if(http.readyState == 4) { if(http.status == 200) document.getElementById('A1').innerHTML = http.responseText; else alert("Problem retrieving XML data:" + http.statusText); } } http.open("GET", health_worker_url, true); http.send(null); document.body.style.cursor = 'default'; } function load_ajax_url(url) { var http = getXMLHttp(); if(http == null) { alert("Error creating XMLHttpRequest"); return; } http.onreadystatechange = function() { if(http.readyState == 4) { if(http.status == 200) document.getElementById('A1').innerHTML = http.responseText; else alert("Problem retrieving XML data:" + http.statusText); } } http.open("GET", url, true); http.send(null); document.body.style.cursor = 'default'; } function load_search_results(url, params, page) { current_message_serial = 0; current_messages = new Array(); document.getElementById('messagelistcontainer').innerHTML = 'spinner'; var http = getXMLHttp(); if(http == null) { alert("Error creating XMLHttpRequest"); return; } http.open("POST", url, true); params = params + "&page=" + page; http.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); http.setRequestHeader("Content-length", params.length); http.setRequestHeader("Connection", "close"); http.onreadystatechange = function() { if(http.readyState == 4) { if(http.status == 200) { document.getElementById('mailcontframe').innerHTML = http.responseText; fill_current_messages_array(); } else { alert("Problem retrieving XML data:" + http.statusText); } } } http.send(params); } function load_saved_search_terms(url) { var http = getXMLHttp(); if(http == null) { alert("Error creating XMLHttpRequest"); return; } http.onreadystatechange = function() { if(http.readyState == 4) { if(http.status == 200) document.getElementById('mailcontframe').innerHTML = http.responseText; else alert("Problem retrieving XML data:" + http.statusText); } } http.open("GET", url, true); http.send(null); document.body.style.cursor = 'default'; } function load_audit_results(url, params, page) { document.getElementById('AS').innerHTML = 'spinner'; var http = getXMLHttp(); if(http == null) { alert("Error creating XMLHttpRequest"); return; } http.open("POST", url, true); params = params + "&page=" + page; http.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); http.setRequestHeader("Content-length", params.length); http.setRequestHeader("Connection", "close"); http.onreadystatechange = function() { if(http.readyState == 4) { if(http.status == 200) { document.getElementById('AS').innerHTML = http.responseText; } else { alert("Problem retrieving XML data:" + http.statusText); } } } http.send(params); } function load_url_with_get(url, id) { var http = getXMLHttp(); if(http == null) { alert("Error creating XMLHttpRequest"); return; } http.onreadystatechange = function() { if(http.readyState == 4) { if(http.status == 200){ document.getElementById(id).innerHTML = http.responseText; } else alert("Problem retrieving XML data:" + http.statusText); } } http.open("GET", url, true); http.send(null); document.body.style.cursor = 'default'; } function send_ajax_post_request(url, params) { var http = getXMLHttp(); if(http == null) { alert("Error creating XMLHttpRequest"); return; } http.open("POST", url, true); http.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); http.setRequestHeader("Content-length", params.length); http.setRequestHeader("Connection", "close"); http.onreadystatechange = function() { if(http.readyState == 4) { if(http.status == 200) { } else { alert("Problem retrieving XML data:" + http.statusText); } } } http.send(params); } function add_message_reference_to_form(s) { e = document.getElementById('ref'); if(e) e.value = s; } function assemble_search_term(n, prefix) { var data = ''; var attachment_type = ''; var e; var folders = ''; var extra_folders = ''; var childNodeArray = new Array(); e = document.getElementById(prefix + 'searchtype'); if(e && e.value) { data = data + "searchtype=" + e.value; } e = document.getElementById(prefix + '_search'); if(e && e.value) { data = data + "&search=" + e.value; } e = document.getElementById(prefix + 'from'); if(e && e.value) { data = data + "&from=" + e.value; } e = document.getElementById(prefix + 'to'); if(e && e.value) { data = data + "&to=" + e.value; } e = document.getElementById(prefix + 'subject'); if(e && e.value) { data = data + "&subject=" + e.value; } e = document.getElementById(prefix + 'body'); if(e && e.value) { data = data + "&body=" + e.value; } for(i=0; i<=n; i++) { var a = 'key' + i; var b = 'val' + i; e = document.getElementById(b); if(e && document.getElementById(b).value) { if(data) data = data + "&f%5B%5D=" + document.getElementById(a).value + "&v%5B%5D=" + encodeURI(document.getElementById(b).value); else data = "f%5B%5D=" + document.getElementById(a).value + "&v%5B%5D=" + encodeURI(document.getElementById(b).value); } } e = document.getElementById('date1'); if(e && e.value) { data = data + "&date1=" + e.value; } e = document.getElementById('date2'); if(e && e.value) { data = data + "&date2=" + e.value; } e = document.getElementById(prefix + 'direction'); if(e && e.value) { data = data + "&direction=" + e.value; } e = document.getElementById(prefix + 'action'); if(e && e.value) { data = data + "&action=" + e.value; } for(i=0; i0;i--) { removeme('myid' + i); } a = document.getElementById('date1'); a.value = ''; a = document.getElementById('date2'); a.value = ''; for(i=0; i' + '
' + ' ' + '
' + '
' + ' ' + ' ' + '
' + ''; var a = document.getElementById('myid'); a.appendChild(newdiv); } function addauditblock(key, val, t_user, t_ipaddr, t_ref) { var user_selected = ipaddr_selected = ref_selected = ''; if(key == 'user') { user_selected = ' selected="selected"'; } if(key == 'ipaddr') { ipaddr_selected = ' selected="selected"'; } if(key == 'ref') { ref_selected = ' selected="selected"'; } count++; var divid = 'myid' + count; var newdiv = document.createElement('div'); newdiv.setAttribute('id', divid); newdiv.innerHTML = '
' + '
' + ' ' + '
' + '
' + ' ' + ' ' + '
' + '
'; var a = document.getElementById('myid'); a.appendChild(newdiv); } function removeme(id) { var a = document.getElementById('myid'); if(a.childNodes.length <= 3) return; var ele = document.getElementById(id); if(ele) ele.parentNode.removeChild(ele); } function tag_search_results(url){ var idlist = assemble_idlist(); var tag_value = document.getElementById('tag_value').value; if(idlist) { params = "idlist=" + idlist + "&tag=" + encodeURI(tag_value); var http = getXMLHttp(); if(http == null) { alert("Error creating XMLHttpRequest"); return; } http.onreadystatechange = function() { if(http.readyState == 4) { if(http.status != 200) alert("Problem retrieving XML data:" + http.statusText); } } http.open("POST", url, true); http.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); http.setRequestHeader("Content-length", params.length); http.setRequestHeader("Connection", "close"); http.send(params); } } function assemble_idlist() { var a = document.getElementById('results'); var idlist = ""; len = a.childNodes.length; for(i=0; i 1) current_message_serial--; } highlight_message_by_position(current_message_serial); } function copy_message_to_folder(folder_id, id, copied) { if(id <= 0) { return 0; } params = "folder_id=" + folder_id + "&id=" + id; send_ajax_post_request(folder_copy_url, params); show_message('messagebox1', '

' + copied + '

', 0.85); current_message_id = 0; } function open_folder(id) { var a; a = document.getElementById('fldr_' + id); a.style.display = ''; a = document.getElementById('fldr_collapse_' + id); a.style.display = ''; a = document.getElementById('fldr_open_' + id); a.style.display = 'none'; } function close_folder(id) { var a; a = document.getElementById('fldr_' + id); a.style.display = 'none'; a = document.getElementById('fldr_collapse_' + id); a.style.display = 'none'; a = document.getElementById('fldr_open_' + id); a.style.display = ''; }