Chris@76: var cur_topic_id, cur_msg_id, buff_subject, cur_subject_div, in_edit_mode = 0; Chris@76: var hide_prefixes = Array(); Chris@76: Chris@76: function modify_topic(topic_id, first_msg_id) Chris@76: { Chris@76: if (!('XMLHttpRequest' in window)) Chris@76: return; Chris@76: Chris@76: if ('opera' in window) Chris@76: { Chris@76: var oTest = new XMLHttpRequest(); Chris@76: if (!('setRequestHeader' in oTest)) Chris@76: return; Chris@76: } Chris@76: Chris@76: // Add backwards compatibility with old themes. Chris@76: if (typeof(cur_session_var) == 'undefined') Chris@76: cur_session_var = 'sesc'; Chris@76: Chris@76: if (in_edit_mode == 1) Chris@76: { Chris@76: if (cur_topic_id == topic_id) Chris@76: return; Chris@76: else Chris@76: modify_topic_cancel(); Chris@76: } Chris@76: Chris@76: in_edit_mode = 1; Chris@76: mouse_on_div = 1; Chris@76: cur_topic_id = topic_id; Chris@76: Chris@76: if (typeof window.ajax_indicator == "function") Chris@76: ajax_indicator(true); Chris@76: getXMLDocument(smf_prepareScriptUrl(smf_scripturl) + "action=quotefast;quote=" + first_msg_id + ";modify;xml", onDocReceived_modify_topic); Chris@76: } Chris@76: Chris@76: function onDocReceived_modify_topic(XMLDoc) Chris@76: { Chris@76: cur_msg_id = XMLDoc.getElementsByTagName("message")[0].getAttribute("id"); Chris@76: Chris@76: cur_subject_div = document.getElementById('msg_' + cur_msg_id.substr(4)); Chris@76: buff_subject = getInnerHTML(cur_subject_div); Chris@76: Chris@76: // Here we hide any other things they want hiding on edit. Chris@76: set_hidden_topic_areas('none'); Chris@76: Chris@76: modify_topic_show_edit(XMLDoc.getElementsByTagName("subject")[0].childNodes[0].nodeValue); Chris@76: if (typeof window.ajax_indicator == "function") Chris@76: ajax_indicator(false); Chris@76: } Chris@76: Chris@76: function modify_topic_cancel() Chris@76: { Chris@76: setInnerHTML(cur_subject_div, buff_subject); Chris@76: set_hidden_topic_areas(''); Chris@76: Chris@76: in_edit_mode = 0; Chris@76: return false; Chris@76: } Chris@76: Chris@76: function modify_topic_save(cur_session_id, cur_session_var) Chris@76: { Chris@76: if (!in_edit_mode) Chris@76: return true; Chris@76: Chris@76: // Add backwards compatibility with old themes. Chris@76: if (typeof(cur_session_var) == 'undefined') Chris@76: cur_session_var = 'sesc'; Chris@76: Chris@76: var i, x = new Array(); Chris@76: x[x.length] = 'subject=' + document.forms.quickModForm['subject'].value.replace(/&#/g, "&#").php_to8bit().php_urlencode(); Chris@76: x[x.length] = 'topic=' + parseInt(document.forms.quickModForm.elements['topic'].value); Chris@76: x[x.length] = 'msg=' + parseInt(document.forms.quickModForm.elements['msg'].value); Chris@76: Chris@76: if (typeof window.ajax_indicator == "function") Chris@76: ajax_indicator(true); Chris@76: sendXMLDocument(smf_prepareScriptUrl(smf_scripturl) + "action=jsmodify;topic=" + parseInt(document.forms.quickModForm.elements['topic'].value) + ";" + cur_session_var + "=" + cur_session_id + ";xml", x.join("&"), modify_topic_done); Chris@76: Chris@76: return false; Chris@76: } Chris@76: Chris@76: function modify_topic_done(XMLDoc) Chris@76: { Chris@76: if (!XMLDoc) Chris@76: { Chris@76: modify_topic_cancel(); Chris@76: return true; Chris@76: } Chris@76: Chris@76: var message = XMLDoc.getElementsByTagName("smf")[0].getElementsByTagName("message")[0]; Chris@76: var subject = message.getElementsByTagName("subject")[0]; Chris@76: var error = message.getElementsByTagName("error")[0]; Chris@76: Chris@76: if (typeof window.ajax_indicator == "function") Chris@76: ajax_indicator(false); Chris@76: Chris@76: if (!subject || error) Chris@76: return false; Chris@76: Chris@76: subjectText = subject.childNodes[0].nodeValue; Chris@76: Chris@76: modify_topic_hide_edit(subjectText); Chris@76: Chris@76: set_hidden_topic_areas(''); Chris@76: Chris@76: in_edit_mode = 0; Chris@76: Chris@76: return false; Chris@76: } Chris@76: Chris@76: // Simply restore any hidden bits during topic editing. Chris@76: function set_hidden_topic_areas(set_style) Chris@76: { Chris@76: for (var i = 0; i < hide_prefixes.length; i++) Chris@76: { Chris@76: if (document.getElementById(hide_prefixes[i] + cur_msg_id.substr(4)) != null) Chris@76: document.getElementById(hide_prefixes[i] + cur_msg_id.substr(4)).style.display = set_style; Chris@76: } Chris@76: } Chris@76: Chris@76: // *** QuickReply object. Chris@76: function QuickReply(oOptions) Chris@76: { Chris@76: this.opt = oOptions; Chris@76: this.bCollapsed = this.opt.bDefaultCollapsed; Chris@76: } Chris@76: Chris@76: // When a user presses quote, put it in the quick reply box (if expanded). Chris@76: QuickReply.prototype.quote = function (iMessageId, xDeprecated) Chris@76: { Chris@76: // Compatibility with older templates. Chris@76: if (typeof(xDeprecated) != 'undefined') Chris@76: return true; Chris@76: Chris@76: if (this.bCollapsed) Chris@76: { Chris@76: window.location.href = smf_prepareScriptUrl(this.opt.sScriptUrl) + 'action=post;quote=' + iMessageId + ';topic=' + this.opt.iTopicId + '.' + this.opt.iStart; Chris@76: return false; Chris@76: } Chris@76: else Chris@76: { Chris@76: // Doing it the XMLhttp way? Chris@76: if (window.XMLHttpRequest) Chris@76: { Chris@76: ajax_indicator(true); Chris@76: getXMLDocument(smf_prepareScriptUrl(this.opt.sScriptUrl) + 'action=quotefast;quote=' + iMessageId + ';xml', this.onQuoteReceived); Chris@76: } Chris@76: // Or with a smart popup! Chris@76: else Chris@76: reqWin(smf_prepareScriptUrl(this.opt.sScriptUrl) + 'action=quotefast;quote=' + iMessageId, 240, 90); Chris@76: Chris@76: // Move the view to the quick reply box. Chris@76: if (navigator.appName == 'Microsoft Internet Explorer') Chris@76: window.location.hash = this.opt.sJumpAnchor; Chris@76: else Chris@76: window.location.hash = '#' + this.opt.sJumpAnchor; Chris@76: Chris@76: return false; Chris@76: } Chris@76: } Chris@76: Chris@76: // This is the callback function used after the XMLhttp request. Chris@76: QuickReply.prototype.onQuoteReceived = function (oXMLDoc) Chris@76: { Chris@76: var sQuoteText = ''; Chris@76: Chris@76: for (var i = 0; i < oXMLDoc.getElementsByTagName('quote')[0].childNodes.length; i++) Chris@76: sQuoteText += oXMLDoc.getElementsByTagName('quote')[0].childNodes[i].nodeValue; Chris@76: Chris@76: replaceText(sQuoteText, document.forms.postmodify.message); Chris@76: Chris@76: ajax_indicator(false); Chris@76: } Chris@76: Chris@76: // The function handling the swapping of the quick reply. Chris@76: QuickReply.prototype.swap = function () Chris@76: { Chris@76: document.getElementById(this.opt.sImageId).src = this.opt.sImagesUrl + "/" + (this.bCollapsed ? this.opt.sImageCollapsed : this.opt.sImageExpanded); Chris@76: document.getElementById(this.opt.sContainerId).style.display = this.bCollapsed ? '' : 'none'; Chris@76: Chris@76: this.bCollapsed = !this.bCollapsed; Chris@76: } Chris@76: Chris@76: // *** QuickModify object. Chris@76: function QuickModify(oOptions) Chris@76: { Chris@76: this.opt = oOptions; Chris@76: this.bInEditMode = false; Chris@76: this.sCurMessageId = ''; Chris@76: this.oCurMessageDiv = null; Chris@76: this.oCurSubjectDiv = null; Chris@76: this.sMessageBuffer = ''; Chris@76: this.sSubjectBuffer = ''; Chris@76: this.bXmlHttpCapable = this.isXmlHttpCapable(); Chris@76: Chris@76: // Show the edit buttons Chris@76: if (this.bXmlHttpCapable) Chris@76: { Chris@76: for (var i = document.images.length - 1; i >= 0; i--) Chris@76: if (document.images[i].id.substr(0, 14) == 'modify_button_') Chris@76: document.images[i].style.display = ''; Chris@76: } Chris@76: } Chris@76: Chris@76: // Determine whether the quick modify can actually be used. Chris@76: QuickModify.prototype.isXmlHttpCapable = function () Chris@76: { Chris@76: if (typeof(window.XMLHttpRequest) == 'undefined') Chris@76: return false; Chris@76: Chris@76: // Opera didn't always support POST requests. So test it first. Chris@76: if ('opera' in window) Chris@76: { Chris@76: var oTest = new XMLHttpRequest(); Chris@76: if (!('setRequestHeader' in oTest)) Chris@76: return false; Chris@76: } Chris@76: Chris@76: return true; Chris@76: } Chris@76: Chris@76: // Function called when a user presses the edit button. Chris@76: QuickModify.prototype.modifyMsg = function (iMessageId) Chris@76: { Chris@76: if (!this.bXmlHttpCapable) Chris@76: return; Chris@76: Chris@76: // Add backwards compatibility with old themes. Chris@76: if (typeof(sSessionVar) == 'undefined') Chris@76: sSessionVar = 'sesc'; Chris@76: Chris@76: // First cancel if there's another message still being edited. Chris@76: if (this.bInEditMode) Chris@76: this.modifyCancel(); Chris@76: Chris@76: // At least NOW we're in edit mode Chris@76: this.bInEditMode = true; Chris@76: Chris@76: // Send out the XMLhttp request to get more info Chris@76: ajax_indicator(true); Chris@76: Chris@76: // For IE 5.0 support, 'call' is not yet used. Chris@76: this.tmpMethod = getXMLDocument; Chris@76: this.tmpMethod(smf_prepareScriptUrl(this.opt.sScriptUrl) + 'action=quotefast;quote=' + iMessageId + ';modify;xml', this.onMessageReceived); Chris@76: delete this.tmpMethod; Chris@76: } Chris@76: Chris@76: // The callback function used for the XMLhttp request retrieving the message. Chris@76: QuickModify.prototype.onMessageReceived = function (XMLDoc) Chris@76: { Chris@76: var sBodyText = '', sSubjectText = ''; Chris@76: Chris@76: // No longer show the 'loading...' sign. Chris@76: ajax_indicator(false); Chris@76: Chris@76: // Grab the message ID. Chris@76: this.sCurMessageId = XMLDoc.getElementsByTagName('message')[0].getAttribute('id'); Chris@76: Chris@76: // If this is not valid then simply give up. Chris@76: if (!document.getElementById(this.sCurMessageId)) Chris@76: return this.modifyCancel(); Chris@76: Chris@76: // Replace the body part. Chris@76: for (var i = 0; i < XMLDoc.getElementsByTagName("message")[0].childNodes.length; i++) Chris@76: sBodyText += XMLDoc.getElementsByTagName("message")[0].childNodes[i].nodeValue; Chris@76: this.oCurMessageDiv = document.getElementById(this.sCurMessageId); Chris@76: this.sMessageBuffer = getInnerHTML(this.oCurMessageDiv); Chris@76: Chris@76: // We have to force the body to lose its dollar signs thanks to IE. Chris@76: sBodyText = sBodyText.replace(/\$/g, '{&dollarfix;$}'); Chris@76: Chris@76: // Actually create the content, with a bodge for disappearing dollar signs. Chris@76: setInnerHTML(this.oCurMessageDiv, this.opt.sTemplateBodyEdit.replace(/%msg_id%/g, this.sCurMessageId.substr(4)).replace(/%body%/, sBodyText).replace(/\{&dollarfix;\$\}/g, '$')); Chris@76: Chris@76: // Replace the subject part. Chris@76: this.oCurSubjectDiv = document.getElementById('subject_' + this.sCurMessageId.substr(4)); Chris@76: this.sSubjectBuffer = getInnerHTML(this.oCurSubjectDiv); Chris@76: Chris@76: sSubjectText = XMLDoc.getElementsByTagName('subject')[0].childNodes[0].nodeValue.replace(/\$/g, '{&dollarfix;$}'); Chris@76: setInnerHTML(this.oCurSubjectDiv, this.opt.sTemplateSubjectEdit.replace(/%subject%/, sSubjectText).replace(/\{&dollarfix;\$\}/g, '$')); Chris@76: Chris@76: return true; Chris@76: } Chris@76: Chris@76: // Function in case the user presses cancel (or other circumstances cause it). Chris@76: QuickModify.prototype.modifyCancel = function () Chris@76: { Chris@76: // Roll back the HTML to its original state. Chris@76: if (this.oCurMessageDiv) Chris@76: { Chris@76: setInnerHTML(this.oCurMessageDiv, this.sMessageBuffer); Chris@76: setInnerHTML(this.oCurSubjectDiv, this.sSubjectBuffer); Chris@76: } Chris@76: Chris@76: // No longer in edit mode, that's right. Chris@76: this.bInEditMode = false; Chris@76: Chris@76: return false; Chris@76: } Chris@76: Chris@76: // The function called after a user wants to save his precious message. Chris@76: QuickModify.prototype.modifySave = function (sSessionId, sSessionVar) Chris@76: { Chris@76: // We cannot save if we weren't in edit mode. Chris@76: if (!this.bInEditMode) Chris@76: return true; Chris@76: Chris@76: // Add backwards compatibility with old themes. Chris@76: if (typeof(sSessionVar) == 'undefined') Chris@76: sSessionVar = 'sesc'; Chris@76: Chris@76: var i, x = new Array(); Chris@76: x[x.length] = 'subject=' + escape(document.forms.quickModForm['subject'].value.replace(/&#/g, "&#").php_to8bit()).replace(/\+/g, "%2B"); Chris@76: x[x.length] = 'message=' + escape(document.forms.quickModForm['message'].value.replace(/&#/g, "&#").php_to8bit()).replace(/\+/g, "%2B"); Chris@76: x[x.length] = 'topic=' + parseInt(document.forms.quickModForm.elements['topic'].value); Chris@76: x[x.length] = 'msg=' + parseInt(document.forms.quickModForm.elements['msg'].value); Chris@76: Chris@76: // Send in the XMLhttp request and let's hope for the best. Chris@76: ajax_indicator(true); Chris@76: sendXMLDocument.call(this, smf_prepareScriptUrl(this.opt.sScriptUrl) + "action=jsmodify;topic=" + this.opt.iTopicId + ";" + sSessionVar + "=" + sSessionId + ";xml", x.join("&"), this.onModifyDone); Chris@76: Chris@76: return false; Chris@76: } Chris@76: Chris@76: // Callback function of the XMLhttp request sending the modified message. Chris@76: QuickModify.prototype.onModifyDone = function (XMLDoc) Chris@76: { Chris@76: // We've finished the loading stuff. Chris@76: ajax_indicator(false); Chris@76: Chris@76: // If we didn't get a valid document, just cancel. Chris@76: if (!XMLDoc || !XMLDoc.getElementsByTagName('smf')[0]) Chris@76: { Chris@76: // Mozilla will nicely tell us what's wrong. Chris@76: if (XMLDoc.childNodes.length > 0 && XMLDoc.firstChild.nodeName == 'parsererror') Chris@76: setInnerHTML(document.getElementById('error_box'), XMLDoc.firstChild.textContent); Chris@76: else Chris@76: this.modifyCancel(); Chris@76: return; Chris@76: } Chris@76: Chris@76: var message = XMLDoc.getElementsByTagName('smf')[0].getElementsByTagName('message')[0]; Chris@76: var body = message.getElementsByTagName('body')[0]; Chris@76: var error = message.getElementsByTagName('error')[0]; Chris@76: Chris@76: if (body) Chris@76: { Chris@76: // Show new body. Chris@76: var bodyText = ''; Chris@76: for (var i = 0; i < body.childNodes.length; i++) Chris@76: bodyText += body.childNodes[i].nodeValue; Chris@76: Chris@76: this.sMessageBuffer = this.opt.sTemplateBodyNormal.replace(/%body%/, bodyText.replace(/\$/g, '{&dollarfix;$}')).replace(/\{&dollarfix;\$\}/g,'$'); Chris@76: setInnerHTML(this.oCurMessageDiv, this.sMessageBuffer); Chris@76: Chris@76: // Show new subject. Chris@76: var oSubject = message.getElementsByTagName('subject')[0]; Chris@76: var sSubjectText = oSubject.childNodes[0].nodeValue.replace(/\$/g, '{&dollarfix;$}'); Chris@76: this.sSubjectBuffer = this.opt.sTemplateSubjectNormal.replace(/%msg_id%/g, this.sCurMessageId.substr(4)).replace(/%subject%/, sSubjectText).replace(/\{&dollarfix;\$\}/g,'$'); Chris@76: setInnerHTML(this.oCurSubjectDiv, this.sSubjectBuffer); Chris@76: Chris@76: // If this is the first message, also update the topic subject. Chris@76: if (oSubject.getAttribute('is_first') == '1') Chris@76: setInnerHTML(document.getElementById('top_subject'), this.opt.sTemplateTopSubject.replace(/%subject%/, sSubjectText).replace(/\{&dollarfix;\$\}/g, '$')); Chris@76: Chris@76: // Show this message as 'modified on x by y'. Chris@76: if (this.opt.bShowModify) Chris@76: setInnerHTML(document.getElementById('modified_' + this.sCurMessageId.substr(4)), message.getElementsByTagName('modified')[0].childNodes[0].nodeValue); Chris@76: } Chris@76: else if (error) Chris@76: { Chris@76: setInnerHTML(document.getElementById('error_box'), error.childNodes[0].nodeValue); Chris@76: document.forms.quickModForm.message.style.border = error.getAttribute('in_body') == '1' ? this.opt.sErrorBorderStyle : ''; Chris@76: document.forms.quickModForm.subject.style.border = error.getAttribute('in_subject') == '1' ? this.opt.sErrorBorderStyle : ''; Chris@76: } Chris@76: } Chris@76: Chris@76: function InTopicModeration(oOptions) Chris@76: { Chris@76: this.opt = oOptions; Chris@76: this.bButtonsShown = false; Chris@76: this.iNumSelected = 0; Chris@76: Chris@76: // Add backwards compatibility with old themes. Chris@76: if (typeof(this.opt.sSessionVar) == 'undefined') Chris@76: this.opt.sSessionVar = 'sesc'; Chris@76: Chris@76: this.init(); Chris@76: } Chris@76: Chris@76: InTopicModeration.prototype.init = function() Chris@76: { Chris@76: // Add checkboxes to all the messages. Chris@76: for (var i = 0, n = this.opt.aMessageIds.length; i < n; i++) Chris@76: { Chris@76: // Create the checkbox. Chris@76: var oCheckbox = document.createElement('input'); Chris@76: oCheckbox.type = 'checkbox'; Chris@76: oCheckbox.className = 'input_check'; Chris@76: oCheckbox.name = 'msgs[]'; Chris@76: oCheckbox.value = this.opt.aMessageIds[i]; Chris@76: oCheckbox.instanceRef = this; Chris@76: oCheckbox.onclick = function () { Chris@76: this.instanceRef.handleClick(this); Chris@76: } Chris@76: Chris@76: // Append it to the container Chris@76: var oCheckboxContainer = document.getElementById(this.opt.sCheckboxContainerMask + this.opt.aMessageIds[i]); Chris@76: oCheckboxContainer.appendChild(oCheckbox); Chris@76: oCheckboxContainer.style.display = ''; Chris@76: } Chris@76: } Chris@76: Chris@76: InTopicModeration.prototype.handleClick = function(oCheckbox) Chris@76: { Chris@76: if (!this.bButtonsShown && this.opt.sButtonStripDisplay) Chris@76: { Chris@76: var oButtonStrip = document.getElementById(this.opt.sButtonStrip); Chris@76: var oButtonStripDisplay = document.getElementById(this.opt.sButtonStripDisplay); Chris@76: Chris@76: // Make sure it can go somewhere. Chris@76: if (typeof(oButtonStripDisplay) == 'object' && oButtonStripDisplay != null) Chris@76: oButtonStripDisplay.style.display = ""; Chris@76: else Chris@76: { Chris@76: var oNewDiv = document.createElement('div'); Chris@76: var oNewList = document.createElement('ul'); Chris@76: Chris@76: oNewDiv.id = this.opt.sButtonStripDisplay; Chris@76: oNewDiv.className = this.opt.sButtonStripClass ? this.opt.sButtonStripClass : 'buttonlist floatbottom'; Chris@76: Chris@76: oNewDiv.appendChild(oNewList); Chris@76: oButtonStrip.appendChild(oNewDiv); Chris@76: } Chris@76: Chris@76: // Add the 'remove selected items' button. Chris@76: if (this.opt.bCanRemove) Chris@76: smf_addButton(this.opt.sButtonStrip, this.opt.bUseImageButton, { Chris@76: sId: this.opt.sSelf + '_remove_button', Chris@76: sText: this.opt.sRemoveButtonLabel, Chris@76: sImage: this.opt.sRemoveButtonImage, Chris@76: sUrl: '#', Chris@76: sCustom: ' onclick="return ' + this.opt.sSelf + '.handleSubmit(\'remove\')"' Chris@76: }); Chris@76: Chris@76: // Add the 'restore selected items' button. Chris@76: if (this.opt.bCanRestore) Chris@76: smf_addButton(this.opt.sButtonStrip, this.opt.bUseImageButton, { Chris@76: sId: this.opt.sSelf + '_restore_button', Chris@76: sText: this.opt.sRestoreButtonLabel, Chris@76: sImage: this.opt.sRestoreButtonImage, Chris@76: sUrl: '#', Chris@76: sCustom: ' onclick="return ' + this.opt.sSelf + '.handleSubmit(\'restore\')"' Chris@76: }); Chris@76: Chris@76: // Adding these buttons once should be enough. Chris@76: this.bButtonsShown = true; Chris@76: } Chris@76: Chris@76: // Keep stats on how many items were selected. Chris@76: this.iNumSelected += oCheckbox.checked ? 1 : -1; Chris@76: Chris@76: // Show the number of messages selected in the button. Chris@76: if (this.opt.bCanRemove && !this.opt.bUseImageButton) Chris@76: { Chris@76: setInnerHTML(document.getElementById(this.opt.sSelf + '_remove_button'), this.opt.sRemoveButtonLabel + ' [' + this.iNumSelected + ']'); Chris@76: document.getElementById(this.opt.sSelf + '_remove_button').style.display = this.iNumSelected < 1 ? "none" : ""; Chris@76: } Chris@76: Chris@76: if (this.opt.bCanRestore && !this.opt.bUseImageButton) Chris@76: { Chris@76: setInnerHTML(document.getElementById(this.opt.sSelf + '_restore_button'), this.opt.sRestoreButtonLabel + ' [' + this.iNumSelected + ']'); Chris@76: document.getElementById(this.opt.sSelf + '_restore_button').style.display = this.iNumSelected < 1 ? "none" : ""; Chris@76: } Chris@76: Chris@76: // Try to restore the correct position. Chris@76: var aItems = document.getElementById(this.opt.sButtonStrip).getElementsByTagName('span'); Chris@76: if (aItems.length > 3) Chris@76: { Chris@76: if (this.iNumSelected < 1) Chris@76: { Chris@76: aItems[aItems.length - 3].className = aItems[aItems.length - 3].className.replace(/\s*position_holder/, 'last'); Chris@76: aItems[aItems.length - 2].className = aItems[aItems.length - 2].className.replace(/\s*position_holder/, 'last'); Chris@76: } Chris@76: else Chris@76: { Chris@76: aItems[aItems.length - 2].className = aItems[aItems.length - 2].className.replace(/\s*last/, 'position_holder'); Chris@76: aItems[aItems.length - 3].className = aItems[aItems.length - 3].className.replace(/\s*last/, 'position_holder'); Chris@76: } Chris@76: } Chris@76: } Chris@76: Chris@76: InTopicModeration.prototype.handleSubmit = function (sSubmitType) Chris@76: { Chris@76: var oForm = document.getElementById(this.opt.sFormId); Chris@76: Chris@76: // Make sure this form isn't submitted in another way than this function. Chris@76: var oInput = document.createElement('input'); Chris@76: oInput.type = 'hidden'; Chris@76: oInput.name = this.opt.sSessionVar; Chris@76: oInput.value = this.opt.sSessionId; Chris@76: oForm.appendChild(oInput); Chris@76: Chris@76: switch (sSubmitType) Chris@76: { Chris@76: case 'remove': Chris@76: if (!confirm(this.opt.sRemoveButtonConfirm)) Chris@76: return false; Chris@76: Chris@76: oForm.action = oForm.action.replace(/;restore_selected=1/, ''); Chris@76: break; Chris@76: Chris@76: case 'restore': Chris@76: if (!confirm(this.opt.sRestoreButtonConfirm)) Chris@76: return false; Chris@76: Chris@76: oForm.action = oForm.action + ';restore_selected=1'; Chris@76: break; Chris@76: Chris@76: default: Chris@76: return false; Chris@76: break; Chris@76: } Chris@76: Chris@76: oForm.submit(); Chris@76: return true; Chris@76: } Chris@76: Chris@76: Chris@76: // *** Other functions... Chris@76: function expandThumb(thumbID) Chris@76: { Chris@76: var img = document.getElementById('thumb_' + thumbID); Chris@76: var link = document.getElementById('link_' + thumbID); Chris@76: var tmp = img.src; Chris@76: img.src = link.href; Chris@76: link.href = tmp; Chris@76: img.style.width = ''; Chris@76: img.style.height = ''; Chris@76: return false; Chris@76: }