+
+function CtdlShowRaw(msgnum) {
+var customnav = document.createElement("span");
+var mode_citadel = document.createElement("a");
+mode_citadel.appendChild(document.createTextNode("Citadel Source"));
+var mode_rfc822 = document.createElement("a");
+mode_rfc822.appendChild(document.createTextNode(" RFC822 Source"));
+mode_citadel.setAttribute("href","#");
+mode_rfc822.setAttribute("href","#");
+mode_rfc822.setAttribute("onclick","rawSwitch822('" + msgnum + "');");
+mode_citadel.setAttribute("onclick","rawSwitchCitadel('" + msgnum + "');");
+customnav.appendChild(mode_citadel);
+customnav.appendChild(mode_rfc822);
+customnav.setAttribute("class","floatcustomnav");
+floatwindow("headerscreen","pre",customnav);
+rawSwitch822(msgnum);
+}
+
+function rawSwitch822(msgnum) {
+CtdlLoadScreen("headerscreen");
+new Ajax.Updater("headerscreen",
+'ajax_servcmd_esc',
+ { method: 'post',parameters: 'g_cmd=MSG2 ' +msgnum } );
+
+}
+
+function rawSwitchCitadel(msgnum) {
+CtdlLoadScreen("headerscreen");
+new Ajax.Updater("headerscreen",
+'ajax_servcmd_esc',
+ { method: 'post',parameters: 'g_cmd=MSG0 ' +msgnum } );
+
+}
+
+function floatwindow(newdivid,contentelementtype,customnav) {
+var windiv = document.createElement("div");
+windiv.setAttribute("class","floatwindow");
+var winid = newdivid+"_window";
+windiv.setAttribute("id",winid);
+var nav = document.createElement("div");
+if (customnav != null) {
+nav.appendChild(customnav);
+}
+var minimizeA = document.createElement("a");
+var minimizeButton = document.createTextNode("Close");
+minimizeA.appendChild(minimizeButton);
+minimizeA.setAttribute("onclick","killFloatWindow(this);");
+minimizeA.setAttribute("href","#");
+nav.appendChild(minimizeA);
+nav.setAttribute("class","floatnav");
+windiv.appendChild(nav);
+var contentarea = document.createElement("pre");
+contentarea.setAttribute("class","floatcontent");
+contentarea.setAttribute("id",newdivid);
+windiv.appendChild(contentarea);
+document.body.appendChild(windiv);
+}
+function killFloatWindow(caller) {
+var span = caller.parentNode;
+var fwindow = span.parentNode;
+fwindow.parentNode.removeChild(fwindow);
+}
+// Place a gradient loadscreen on an element, e.g to use before Ajax.updater
+function CtdlLoadScreen(elementid) {
+var elem = document.getElementById(elementid);
+elem.innerHTML = "<div align=center><br><table border=0 cellpadding=10 bgcolor=\"#ffffff\"><tr><td><img src=\"static/throbber.gif\" /><font color=\"#AAAAAA\"> Loading....</font></td></tr></table><br /></div>";
+}
+
+
+// Show info for a user, basically replaces showuser()
+// matt@comalies is to blame for this poorly coded masterpiece.
+function CtdlShowUserInfoPopup(Element) {
+ try {
+ // hopefully no one needs to use the class attribute... could be better done
+ // with xmlns though..
+ var user = Element.getAttribute("class");
+ var updname = "biospace_"+user;
+ if (document.getElementById(updname) == null) {
+ // insert a space for the bio
+ var pNode = Element.parentNode;
+ var newdiv = document.createElement("div");
+ newdiv.id = updname;
+ newdiv.innerHTML = "Getting user info....";
+ pNode.appendChild(newdiv);
+ CtdlLoadScreen(updname);
+ new Ajax.Updater(updname, 'showuser_ajax?who='+user, { method: 'get' } );
+ }
+ }
+ catch(err) {
+ return true;
+ }
+ return false;
+}
+
+
+
+// Pop open the address book (target_input is the INPUT field to populate)
+
+function PopOpenAddressBook(target_input) {
+ $('address_book_popup').style.display = 'block';
+ p = 'target_input=' + target_input + '&r=' + CtdlRandomString();
+ new Ajax.Updater(
+ 'address_book_popup_middle_div',
+ 'display_address_book_middle_div',
+ {
+ method: 'get',
+ parameters: p,
+ evalScripts: true
+ }
+ );
+}
+
+function PopulateAddressBookInnerDiv(which_addr_book, target_input) {
+ $('address_book_inner_div').innerHTML = "<div align=center><br><table border=0 cellpadding=10 bgcolor=\"#ffffff\"><tr><td><img src=\"static/throbber.gif\" /><font color=\"#AAAAAA\"> Loading....</font></td></tr></table><br /></div>";
+ p = 'which_addr_book=' + which_addr_book
+ + '&target_input=' + target_input
+ + '&r=' + CtdlRandomString();
+ new Ajax.Updater(
+ 'address_book_inner_div',
+ 'display_address_book_inner_div',
+ {
+ method: 'get',
+ parameters: p
+ }
+ );
+}
+
+// What happens when a contact is selected from the address book popup
+// (populate the specified target)
+
+function AddContactsToTarget(target, whichaddr) {
+ while (whichaddr.selectedIndex != -1) {
+ if (target.value.length > 0) {
+ target.value = target.value + ', ';
+ }
+ target.value = target.value + whichaddr.value;
+ whichaddr.options[whichaddr.selectedIndex].selected = false;
+ }
+}
+
+// Respond to a meeting invitation
+function RespondToInvitation(question_divname, title_divname, msgnum, cal_partnum, sc) {
+ p = 'msgnum=' + msgnum + '&cal_partnum=' + cal_partnum + '&sc=' + sc ;
+ new Ajax.Updater(title_divname, 'respond_to_request', { method: 'post', parameters: p } );
+ Effect.Fade(question_divname, { duration: 0.5 });
+}
+
+// Handle a received RSVP
+function HandleRSVP(question_divname, title_divname, msgnum, cal_partnum, sc) {
+ p = 'msgnum=' + msgnum + '&cal_partnum=' + cal_partnum + '&sc=' + sc ;
+ new Ajax.Updater(title_divname, 'handle_rsvp', { method: 'post', parameters: p } );
+ Effect.Fade(question_divname, { duration: 0.5 });
+}
+