dojo.require ("dojo.lfx.*"); dojo.require ("dojo.event.*"); dojo.require ("dojo.lfx.extras"); function connectCheckboxOnchangeShowHideHandler (checkboxId, elementId) { var checkbox = dojo.byId (checkboxId); dojo.event.connect (checkbox, "onclick", function () { if (checkbox.checked) { fadeWipeShow (elementId, 500); } else { fadeWipeHide (elementId, 500); } }); if (!checkbox.checked) { dojo.lfx.toggle.plain.hide (elementId); } } function connectSubmitAndReplaceButton (containerId, callback) { dojo.event.connect (dojo.byId (containerId + "SubmitButton"), "onclick", function (event) { event.stopPropagation (); submitAndReplaceForm (containerId, callback); }); } function submitAndReplaceForm (containerId, callback) { dojo.io.bind ({ formNode: dojo.byId (containerId + "Form"), mimetype: "text/html", transport: "IframeTransport", load: function (type, data, event) { var container = data.getElementById (containerId); if (!container) { var content = data.getElementsByTagName ("body"); if (!content) { dojo.debug ("no " + containerId + " found, no body found, just printng a generic error message"); dojo.byId (containerId).innerHTML = "There was a system error while processing your request. Try again later and if you continue to have problems contact the site administrator."; } else { dojo.debug ("body found, using that"); dojo.byId (containerId).innerHTML = content[0].innerHTML; } } else { dojo.debug ("new " + containerId + " section found, using it"); dojo.byId (containerId).innerHTML = container.innerHTML; connectSubmitAndReplaceButton (containerId); if (callback) { callback (); } } } }); } function getAndReplace (containerId, url) { dojo.io.bind ({ url: url, mimetype: "text/html", transport: "IframeTransport", load: function (type, data, event) { var container = data.getElementById (containerId); if (!container) { var content = data.getElementsByTagName ("body"); if (!content) { dojo.debug ("no " + containerId + " found, no body found, just printng a generic error message"); dojo.byId (containerId).innerHTML = "There was a system error while processing your request. Try again later and if you continue to have problems contact the site administrator."; } else { dojo.debug ("body found, using that"); dojo.byId (containerId).innerHTML = content[0].innerHTML; } } else { dojo.debug ("new " + containerId + " section found, using it"); dojo.byId (containerId).innerHTML = container.innerHTML; connectSubmitAndReplaceButton (containerId); } } }); } function fadeWipeShow (nodes, duration) { nodes = dojo.lfx.html._byId (nodes); var anim = dojo.lfx.combine ( dojo.lfx.fadeIn (nodes, duration), dojo.lfx.wipeIn (nodes, duration) ); anim.play (); } function fadeWipeHide (nodes, duration) { nodes = dojo.lfx.html._byId (nodes); var anim = dojo.lfx.combine ( dojo.lfx.fadeOut (nodes, duration), dojo.lfx.wipeOut (nodes, duration) ); anim.play (); }