diff -r 45e887f23282 -r 7152ca0a0ce9 includes/clientside/static/functions.js --- a/includes/clientside/static/functions.js Mon Feb 16 16:04:54 2009 -0500 +++ b/includes/clientside/static/functions.js Mon Feb 16 16:17:25 2009 -0500 @@ -104,6 +104,8 @@ // The user allowed the editor to be closed. Reset flags and knock out the on-close confirmation. editor_open = false; enableUnload(); + // destroy the MCE instance so it can be recreated later + $dynano('ajaxEditArea').destroyMCE(false); } var ajax = ajaxMakeXHR(); if ( !ajax ) @@ -136,6 +138,8 @@ // The user allowed the editor to be closed. Reset flags and knock out the on-close confirmation. editor_open = false; enableUnload(); + // destroy the MCE instance so it can be recreated later + $dynano('ajaxEditArea').destroyMCE(false); } var ajax = ajaxMakeXHR(); if ( !ajax ) @@ -448,17 +452,67 @@ } } +/** + * Return a DOMElement that uses a sprite image. + * @param string Path to sprite image + * @param int Width of resulting image + * @param int Height of resulting image + * @param int X offset + * @param int Y offset + * @return object HTMLImageElement + */ + +function gen_sprite(path, width, height, xpos, ypos) +{ + var image = document.createElement('img'); + image.src = scriptPath + '/images/spacer.gif'; + image.width = String(width); + image.height = String(height); + image.style.backgroundImage = 'url(' + path + ')'; + image.style.backgroundRepeat = 'no-repeat'; + xpos = ( xpos == 0 ) ? '0' : '-' + String(xpos); + ypos = ( ypos == 0 ) ? '0' : '-' + String(ypos); + image.style.backgroundPosition = ypos + 'px ' + xpos + 'px'; + + return image; +} + +/** + * The same as gen_sprite but generates HTML instead of a DOMElement. + * @param string Path to sprite image + * @param int Width of resulting image + * @param int Height of resulting image + * @param int X offset + * @param int Y offset + * @return object HTMLImageElement + */ + +function gen_sprite_html(path, width, height, xpos, ypos) +{ + var html = '