diff -x .svn -aruN 0.7.15.src/class2.php 0.7.16.src/class2.php
--- 0.7.15.src/class2.php	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/class2.php	2009-08-15 06:54:05.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/class2.php,v $
-|     $Revision: 1.365 $
-|     $Date: 2008/11/29 13:10:41 $
-|     $Author: e107steved $
+|     $Revision: 1.379 $
+|     $Date: 2009/08/15 11:54:29 $
+|     $Author: marj_nl_fr $
 +----------------------------------------------------------------------------+
 */
 //
@@ -178,9 +178,9 @@
 	if(strlen(e_MENU) == 2) // language code ie. [fr]
 	{
         require_once(e_HANDLER."language_class.php");
-		$lng = new language;
+		$slng = new language;
 		define("e_LANCODE",TRUE);
-		$_GET['elan'] = $lng->convert(e_MENU);
+		$_GET['elan'] = $slng->convert(e_MENU);
 	}
 
 }else {
@@ -362,9 +362,12 @@
 
 // let the subdomain determine the language (when enabled).
 
-if(isset($pref['multilanguage_subdomain']) && $pref['multilanguage_subdomain'] && ($pref['user_tracking'] == "session") && e_DOMAIN && MULTILANG_SUBDOMAIN !== FALSE){
+// Ensure $pref['sitelanguage'] is set if upgrading from 0.6
+$pref['sitelanguage'] = (isset($pref['sitelanguage']) ? $pref['sitelanguage'] : 'English');
 
-		$mtmp = explode("\n",$pref['multilanguage_subdomain']);
+if(varset($pref['multilanguage_subdomain']) && ($pref['user_tracking'] == "session") && e_DOMAIN && MULTILANG_SUBDOMAIN !== FALSE)
+{
+		$mtmp = explode("\n", $pref['multilanguage_subdomain']);
         foreach($mtmp as $val)
 		{
         	if(e_DOMAIN == trim($val))
@@ -375,14 +378,14 @@
 
 		if($domain_active || ($pref['multilanguage_subdomain'] == "1"))
 		{
-			e107_ini_set("session.cookie_domain",".".e_DOMAIN);
+			e107_ini_set("session.cookie_domain", ".".e_DOMAIN);
 			require_once(e_HANDLER."language_class.php");
-			$lng = new language;
+			$slng = new language;
 	        if(!e_SUBDOMAIN)
 			{
 	        	$GLOBALS['elan'] = $pref['sitelanguage'];
 			}
-			elseif($eln = $lng->convert(e_SUBDOMAIN))
+			elseif($eln = $slng->convert(e_SUBDOMAIN))
 			{
 	          	$GLOBALS['elan'] = $eln;
 			}
@@ -396,7 +399,8 @@
 }
 
 // start a session if session based login is enabled
-if ($pref['user_tracking'] == "session") {
+if ($pref['user_tracking'] == "session")
+{
 	session_start();
 }
 
@@ -455,79 +459,123 @@
 define("e_PAGE", $page);
 
 // sort out the users language selection
-if (isset($_POST['setlanguage']) || isset($_GET['elan']) || isset($GLOBALS['elan'])) {
-	if($_GET['elan'])  // query support, for language selection splash pages. etc
+if (isset($_POST['setlanguage']) || isset($_GET['elan']) || isset($GLOBALS['elan']))
+{
+	// query support, for language selection splash pages. etc
+	if($_GET['elan'])
 	{
-		$_POST['sitelanguage'] = str_replace(array(".","/","%"),"",$_GET['elan']);
+		$_POST['sitelanguage'] = str_replace(array(".", "/", "%"), "", $_GET['elan']);
 	}
 	if($GLOBALS['elan'] && !isset($_POST['sitelanguage']))
 	{
-   		$_POST['sitelanguage'] = $GLOBALS['elan'];
+		$_POST['sitelanguage'] = $GLOBALS['elan'];
 	}
 
 	$sql->mySQLlanguage = $_POST['sitelanguage'];
-    $sql2->mySQLlanguage = $_POST['sitelanguage'];
+	$sql2->mySQLlanguage = $_POST['sitelanguage'];
 
-	if ($pref['user_tracking'] == "session") {
+	if ($pref['user_tracking'] == "session")
+	{
 		$_SESSION['e107language_'.$pref['cookie_name']] = $_POST['sitelanguage'];
-	} else {
+	}
+	else
+	{
 		setcookie('e107language_'.$pref['cookie_name'], $_POST['sitelanguage'], time() + 86400, "/");
 		$_COOKIE['e107language_'.$pref['cookie_name']] = $_POST['sitelanguage'];
 		if (strpos(e_SELF, ADMINDIR) === FALSE) 
 		{
-		  $locat = ((!$_GET['elan'] && e_QUERY) || (e_QUERY && e_LANCODE)) ? e_SELF."?".e_QUERY : e_SELF;
-		  header("Location:".$locat);
-		  exit();
+			$locat = ((!$_GET['elan'] && e_QUERY) || (e_QUERY && e_LANCODE)) ? e_SELF."?".e_QUERY : e_SELF;
+			header("Location:".$locat);
+			exit();
 		}
 	}
 }
 
-$user_language='';
 // Multi-language options.
-if (isset($pref['multilanguage']) && $pref['multilanguage']) {
 
-	if ($pref['user_tracking'] == "session") {
-		$user_language=(array_key_exists('e107language_'.$pref['cookie_name'], $_SESSION) ? $_SESSION['e107language_'.$pref['cookie_name']] : "");
-		$sql->mySQLlanguage=($user_language) ? $user_language : "";
-		$sql2->mySQLlanguage = $sql->mySQLlanguage;
-	} else {
-		$user_language= (isset($_COOKIE['e107language_'.$pref['cookie_name']])) ? $_COOKIE['e107language_'.$pref['cookie_name']] : "";
-		$sql->mySQLlanguage=($user_language) ? $user_language : "";
-		$sql2->mySQLlanguage = $sql->mySQLlanguage;
+// Get language list for rights checking.
+if( ! $tmplan = getcachedvars('language-list'))
+{
+	$handle = opendir(e_LANGUAGEDIR);
+	while ($file = readdir($handle))
+	{
+		// add only if e_LANGUAGEDIR.e_LANGUAGE/e_LANGUAGE
+		if ($file != '.' && $file != '..' && is_readable(e_LANGUAGEDIR.$file.'/'.$file.'.php'))
+		{
+			$lanlist[] = $file;
+		}
 	}
+	closedir($handle);
+	$tmplan = implode(',', $lanlist);
+	cachevars('language-list', $tmplan);
+}
+// Save language flat list
+define('e_LANLIST', $tmplan);
 
+// Set $language fallback to $pref['sitelanguage'] for the time being
+$language = $pref['sitelanguage'];
 
-}
+// Get user language choice
+/// Force no multilingual sites to keep there preset languages? if (varset($pref['multilanguage']))
+{
+	if ($pref['user_tracking'] == 'session')
+	{
+		$user_language = (array_key_exists('e107language_'.$pref['cookie_name'], $_SESSION) ? $_SESSION['e107language_'.$pref['cookie_name']] : '');
+	}
+	else
+	{
+		$user_language= (isset($_COOKIE['e107language_'.$pref['cookie_name']])) ? $_COOKIE['e107language_'.$pref['cookie_name']] : '';
+	}
+	// Strip $user_language
+	//TODO allow [a-z][A-Z][0-9]_
+	$user_language = preg_replace('#\W#', '', $user_language);
 
-// Get Language List for rights checking.
-if(!$tmplan = getcachedvars("language-list")){
-	$handle=opendir(e_LANGUAGEDIR);
-	while ($file = readdir($handle)) {
-		if (is_dir(e_LANGUAGEDIR.$file) && $file !="." && $file !=".." && $file !="CVS") {
-				$lanlist[] = $file;
+	// Is user language choice available?
+	if( ! in_array($user_language, $lanlist))
+	{
+		// Reset session
+		if(isset($_SESSION))
+		{
+			unset($_SESSION['e107language_'.$pref['cookie_name']]);
 		}
+		// Reset cookie
+		if(isset($_COOKIE['e107language_'.$pref['cookie_name']]))
+		{
+			unset($_COOKIE['e107language_'.$pref['cookie_name']]);
+		}
+		$user_language = '';
+	}
+	else
+	{
+		$language = $user_language;
 	}
-	closedir($handle);
-	$tmplan = implode(",",$lanlist);
-	cachevars("language-list", $tmplan);
-}
 
-define("e_LANLIST",(isset($tmplan) ? $tmplan : ""));
+	// Ensure db got the proper language - default is empty
+	if (varset($pref['multilanguage']))
+	{
+		$sql->mySQLlanguage  = $user_language;
+		$sql2->mySQLlanguage = $user_language;
+	}
+}
+// We should have the language by now
+define('e_LANGUAGE', $language);
 
-$language=(isset($_COOKIE['e107language_'.$pref['cookie_name']]) ? $_COOKIE['e107language_'.$pref['cookie_name']] : ($pref['sitelanguage'] ? $pref['sitelanguage'] : "English"));
-$language = preg_replace("#\W#", "", $language);
-define("USERLAN", ($user_language && (strpos(e_SELF, $PLUGINS_DIRECTORY) !== FALSE || (strpos(e_SELF, $ADMIN_DIRECTORY) === FALSE && file_exists(e_LANGUAGEDIR.$user_language."/lan_".e_PAGE)) || (strpos(e_SELF, $ADMIN_DIRECTORY) !== FALSE && file_exists(e_LANGUAGEDIR.$user_language."/admin/lan_".e_PAGE)) || file_exists(dirname($_SERVER['SCRIPT_FILENAME'])."/languages/".$user_language."/lan_".e_PAGE)    || (    (strpos(e_SELF, $ADMIN_DIRECTORY) == FALSE) && (strpos(e_SELF, $PLUGINS_DIRECTORY) == FALSE) && file_exists(e_LANGUAGEDIR.$user_language."/".$user_language.".php")  )   ) ? $user_language : FALSE));
-define("e_LANGUAGE", (!USERLAN || !defined("USERLAN") ? $language : USERLAN));
+// Keep USERLAN for backward compatibility
+define('USERLAN', e_LANGUAGE);
 
-e107_include(e_LANGUAGEDIR.e_LANGUAGE."/".e_LANGUAGE.".php");
-e107_include_once(e_LANGUAGEDIR.e_LANGUAGE."/".e_LANGUAGE."_custom.php");
+//TODO do it only once and with the proper function
+include_lan(e_LANGUAGEDIR.e_LANGUAGE."/".e_LANGUAGE.".php");
+include_lan(e_LANGUAGEDIR.e_LANGUAGE."/".e_LANGUAGE."_custom.php");
 
-if($pref['sitelanguage'] != e_LANGUAGE && isset($pref['multilanguage']) && $pref['multilanguage'] && !$pref['multilanguage_subdomain']){
+if($pref['sitelanguage'] != e_LANGUAGE && varset($pref['multilanguage']) && !$pref['multilanguage_subdomain'])
+{
 	list($clc) = explode("_",CORE_LC);
 	define("e_LAN", strtolower($clc));
 	define("e_LANQRY", "[".e_LAN."]");
 	unset($clc);
-}else{
+}
+else
+{
     define("e_LAN", FALSE);
 	define("e_LANQRY", FALSE);
 }
@@ -666,8 +714,10 @@
 $sql->db_Mark_Time('Start: Misc Setup');
 
 //------------------------------------------------------------------------------------------------------------------------------------//
-if (!class_exists('e107_table')) {
-	class e107table {
+if (!class_exists('e107table')) 
+{
+	class e107table 
+	{
 		function tablerender($caption, $text, $mode = "default", $return = false) {
 			/*
 			# Render style table
@@ -740,20 +790,22 @@
 	$usr = new userlogin($_POST['username'], $_POST['userpass'], $_POST['autologin']);
 }
 
-if (e_QUERY == 'logout') {
+if (e_QUERY == 'logout') 
+{
 	$ip = $e107->getip();
 	$udata=(USER === TRUE) ? USERID.".".USERNAME : "0";
 	$sql->db_Update("online", "online_user_id = '0', online_pagecount=online_pagecount+1 WHERE online_user_id = '{$udata}' LIMIT 1");
 
-	if ($pref['user_tracking'] == "session") {
+	if ($pref['user_tracking'] == 'session') 
+	{
 		session_destroy();
-		$_SESSION[$pref['cookie_name']]="";
+		$_SESSION[$pref['cookie_name']]='';
 	}
 
-	cookie($pref['cookie_name'], "", (time() - 2592000));
-	$e_event->trigger("logout");
-	echo "<script type='text/javascript'>document.location.href = '".SITEURL."index.php'</script>\n";
-	exit;
+	cookie($pref['cookie_name'], '', (time() - 2592000));
+	$e_event->trigger('logout');
+	header('location:'.e_BASE.'index.php');      
+	exit();
 }
 
 
@@ -829,7 +881,9 @@
 	  || (varsettrue($eplug_admin))																	// Admin forced
 	)
 {
-  $inAdminDir = TRUE;
+	$inAdminDir = TRUE;
+	// Load admin phrases ASAP
+	include_lan(e_LANGUAGEDIR.e_LANGUAGE.'/admin/lan_admin.php');
 }
 
 
@@ -837,19 +891,19 @@
 {
 	if ($inAdminDir && varsettrue($pref['admintheme'])&& (strpos(e_SELF.'?'.e_QUERY, 'menus.php?configure') === FALSE))
 	{
-/*	  if (strpos(e_SELF, "newspost.php") !== FALSE) 
+/*	  if (strpos(e_SELF, "newspost.php") !== FALSE)
 	  {
 		define("MAINTHEME", e_THEME.$pref['sitetheme']."/");		MAINTHEME no longer used in core distribution
 	  }  */
-	  checkvalidtheme($pref['admintheme']);
+		checkvalidtheme($pref['admintheme']);
 	} 
-	elseif (USERTHEME !== FALSE && USERTHEME != "USERTHEME") 
+	elseif (USERTHEME !== FALSE && USERTHEME != "USERTHEME" && !$inAdminDir)
 	{
-	  checkvalidtheme(USERTHEME);
+		checkvalidtheme(USERTHEME);
 	} 
 	else 
 	{
-	  checkvalidtheme($pref['sitetheme']);
+		checkvalidtheme($pref['sitetheme']);
 	}
 }
 
@@ -879,15 +933,14 @@
 
 $exclude_lan = array("lan_signup.php");  // required for multi-language.
 
+//TODO remove autoload
 if ($inAdminDir)
 {
-  e107_include_once(e_LANGUAGEDIR.e_LANGUAGE."/admin/lan_".e_PAGE);
-  e107_include_once(e_LANGUAGEDIR."English/admin/lan_".e_PAGE);
+  include_lan(e_LANGUAGEDIR.e_LANGUAGE."/admin/lan_".e_PAGE);
 } 
 elseif (!in_array("lan_".e_PAGE,$exclude_lan) && !$isPluginDir) 
 {
-  e107_include_once(e_LANGUAGEDIR.e_LANGUAGE."/lan_".e_PAGE);
-  e107_include_once(e_LANGUAGEDIR."English/lan_".e_PAGE);
+  include_lan(e_LANGUAGEDIR.e_LANGUAGE."/lan_".e_PAGE);
 }
 
 
@@ -1273,14 +1326,16 @@
 				$row['online_pagecount'] = 1;
 			}
 
-			if ($row['online_pagecount'] > $online_bancount && ($row['online_ip'] != "127.0.0.1")) {
-				$sql->db_Insert("banlist", "'{$ip}', '0', 'Hit count exceeded ({$row['online_pagecount']} requests within allotted time)' ");
+			if ($row['online_pagecount'] > $online_bancount && ($row['online_ip'] != "127.0.0.1")) 
+			{
+				include_lan(e_LANGUAGEDIR.e_LANGUAGE.'/admin/lan_banlist.php');
+				$sql->db_Insert('banlist', "'{$ip}', '0', '".str_replace('--HITS--',$row['online_pagecount'],BANLAN_78)."' ");
 				$e_event->trigger("flood", $ip);
-				exit;
+				exit();
 			}
 			if ($row['online_pagecount'] >= $online_warncount && $row['online_ip'] != "127.0.0.1") {
 				echo "<div style='text-align:center; font: 11px verdana, tahoma, arial, helvetica, sans-serif;'><b>".LAN_WARNING."</b><br /><br />".CORE_LAN6."<br /></div>";
-				exit;
+				exit();
 			}
 
 			$sql->db_Delete("online", "`online_timestamp` < ".(time() - $online_timeout));
@@ -1384,6 +1439,7 @@
 			define("USER", FALSE);
 			define('USERID', 0);
 			define("USERCLASS", "");
+			define('USERCLASS_LIST', class_list());
 			define("LOGINMESSAGE",CORE_LAN10."<br /><br />");
 			return (FALSE);
 		}
@@ -1391,7 +1447,6 @@
 		$result = get_user_data($uid);
 		if(is_array($result) && md5($result['user_password']) == $upw)
 		{
-
 			define("USERID", $result['user_id']);
 			define("USERNAME", $result['user_name']);
 			define("USERURL", (isset($result['user_homepage']) ? $result['user_homepage'] : false));
@@ -1423,25 +1478,40 @@
 
 			if ($result['user_ban'] == 1) { exit; }
 
+			if ($result['user_admin']) 
+			{
+				define('ADMIN', TRUE);
+				define('ADMINID', $result['user_id']);
+				define('ADMINNAME', $result['user_name']);
+				define('ADMINPERMS', $result['user_perms']);
+				define('ADMINEMAIL', $result['user_email']);
+				define('ADMINPWCHANGE', $result['user_pwchange']);
+			} 
+			else 
+			{
+				define('ADMIN', FALSE);
+			}
+
 			$user_pref = unserialize($result['user_prefs']);
 
-			if (isset($_POST['settheme'])) {
-				$user_pref['sitetheme'] = ($pref['sitetheme'] == $_POST['sitetheme'] ? "" : $_POST['sitetheme']);
-				save_prefs("user");
+			$tempClasses = class_list();
+			if (check_class(varset($pref['allow_theme_select'],FALSE), $tempClasses))
+			{	// User can set own theme
+				if (isset($_POST['settheme'])) 
+				{
+					$user_pref['sitetheme'] = ($pref['sitetheme'] == $_POST['sitetheme'] ? "" : $_POST['sitetheme']);
+					save_prefs('user');
+				}
+			}
+			elseif (isset($user_pref['sitetheme']))
+			{	// User obviously no longer allowed his own theme - clear it
+				unset($user_pref['sitetheme']);
+				save_prefs('user');
 			}
+			
 
 			define("USERTHEME", (isset($user_pref['sitetheme']) && file_exists(e_THEME.$user_pref['sitetheme']."/theme.php") ? $user_pref['sitetheme'] : FALSE));
-			global $ADMIN_DIRECTORY, $PLUGINS_DIRECTORY;
-			if ($result['user_admin']) {
-				define("ADMIN", TRUE);
-				define("ADMINID", $result['user_id']);
-				define("ADMINNAME", $result['user_name']);
-				define("ADMINPERMS", $result['user_perms']);
-				define("ADMINEMAIL", $result['user_email']);
-				define("ADMINPWCHANGE", $result['user_pwchange']);
-			} else {
-				define("ADMIN", FALSE);
-			}
+//			global $ADMIN_DIRECTORY, $PLUGINS_DIRECTORY;   Don't look very necessary
 		} 
 		else 
 		{
@@ -1581,12 +1651,14 @@
 	return $ret;
 }
 
-function include_lan($path, $force = false) {
-	if (!is_readable($path)) {
+function include_lan($path, $force = false)
+{
+	if ( ! is_readable($path))
+	{
 		$path = str_replace(e_LANGUAGE, 'English', $path);
 	}
-	$ret = ($force) ? include($path) : include_once($path);
-	return (isset($ret)) ? $ret : "";
+	$ret = ($force) ? e107_include($path) : e107_include_once($path);
+	return (isset($ret)) ? $ret : '';
 }
 
 if(!function_exists("print_a")) 
@@ -1705,7 +1777,7 @@
 
 	function return_errors() {
 		$index = 0; $colours[0] = "#C1C1C1"; $colours[1] = "#B6B6B6";
-		$ret = "<table class='fborder'>\n";
+		$ret = "" ;
 		if (E107_DBG_ERRBACKTRACE)
 		{
 			foreach ($this->errors as $key => $value) {
@@ -1719,8 +1791,8 @@
 				$ret .= "<tr class='forumheader3'><td>{$value['short']}</td></tr>\n";
 			}
 		}
-		$ret .= "</table>";
-		return $ret;
+
+		return ($ret) ? "<table class='fborder'>\n".$ret."</table>" : "";
 	}
 
 	function trigger_error($information, $level) {
diff -x .svn -aruN 0.7.15.src/contact.php 0.7.16.src/contact.php
--- 0.7.15.src/contact.php	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/contact.php	2009-07-27 16:07:31.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/contact.php,v $
-|     $Revision: 1.14 $
-|     $Date: 2008/06/27 21:22:19 $
-|     $Author: e107steved $
+|     $Revision: 1.15 $
+|     $Date: 2009/07/27 21:07:55 $
+|     $Author: bugrain $
 +----------------------------------------------------------------------------+
 */
 require_once("class2.php");
@@ -146,7 +146,7 @@
 
 if(SITECONTACTINFO && $CONTACT_INFO)
 {
-	$text = $tp->toHTML($CONTACT_INFO,"","parse_sc");
+	$text = $tp->parseTemplate($CONTACT_INFO, TRUE, $contact_shortcodes);
 	$ns -> tablerender(LANCONTACT_01, $text,"contact");
 }
 
diff -x .svn -aruN 0.7.15.src/download.php 0.7.16.src/download.php
--- 0.7.15.src/download.php	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/download.php	2009-03-19 17:06:38.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/download.php,v $
-|     $Revision: 1.97 $ 
-|     $Date: 2008/10/17 19:19:36 $
-|     $Author: e107steved $
+|     $Revision: 1.100 $
+|     $Date: 2009/03/19 22:07:02 $
+|     $Author: bugrain $
 |
 +----------------------------------------------------------------------------+
 */
@@ -61,94 +61,98 @@
 
 if (!e_QUERY || $_GET['elan'])
 {
-  $action = 'maincats';		// List categories
-  $maincatval = '';			// Show all main categories
+	$action = 'maincats';		// List categories
+	$maincatval = '';			// Show all main categories
 }
 else
 {	// Get parameters from the query
-  $maincatval = '';			// Show all main categories
-  $tmp = explode(".", e_QUERY);
-  if (is_numeric($tmp[0]))			// $tmp[0] at least must be valid
-  {
-	$dl_from = intval($tmp[0]);
-	$action = varset(preg_replace("#\W#", "", $tp -> toDB($tmp[1])),'list');
-	$id = intval($tmp[2]);
-	$view = intval($tmp[3]);
-	$order = preg_replace("#\W#", "", $tp -> toDB($tmp[4]));
-	$sort = preg_replace("#\W#", "", $tp -> toDB($tmp[5]));
-  }
-  else
-  {
-	$action = preg_replace("#\W#", "", $tp -> toDB($tmp[0]));
-	$id = intval($tmp[1]);
-	$errnum = intval(varset($tmp[2],0));
-  }
-  switch ($action)
-  {
-    case 'list' :	// Category-based listing
-	  if (isset($_POST['view'])) 
-	  {
-		$view = intval($_POST['view']);
-		$sort = varset($_POST['sort'],'DESC');
-		$order = varset($_POST['order'],'download_datestamp');
-	  }
-	  if (!isset($dl_from)) $dl_from = 0;
+	$maincatval = '';			// Show all main categories
+	$tmp = explode(".", e_QUERY);
+	if (is_numeric($tmp[0]))			// $tmp[0] at least must be valid
+	{
+		$dl_from = intval($tmp[0]);
+		$action = varset(preg_replace("#\W#", "", $tp -> toDB($tmp[1])),'list');
+		$id = intval($tmp[2]);
+		$view = intval($tmp[3]);
+		$order = preg_replace("#\W#", "", $tp -> toDB($tmp[4]));
+		$sort = preg_replace("#\W#", "", $tp -> toDB($tmp[5]));
+	}
+	else
+	{
+		$action = preg_replace("#\W#", "", $tp -> toDB($tmp[0]));
+		$id = intval($tmp[1]);
+		$errnum = intval(varset($tmp[2],0));
+	}
+	switch ($action)
+	{
+		case 'list' :	// Category-based listing
+			if (isset($_POST['view']))
+			{
+				$view = intval($_POST['view']);
+				$sort = varset($_POST['sort'],'DESC');
+				$order = varset($_POST['order'],'download_datestamp');
+			}
+			if (!isset($dl_from)) $dl_from = 0;
 
-	  // Get category type, page title
-	  if ($sql->db_Select("download_category", "download_category_name,download_category_description,download_category_parent,download_category_class", "(download_category_id='{$id}') AND (download_category_class IN (".USERCLASS_LIST."))") )
-	  {
-		$row = $sql->db_Fetch();
-		extract($row);
-		$type = $download_category_name;
-		$type .= ($download_category_description) ? " [ ".$download_category_description." ]" : "";
-		define("e_PAGETITLE", PAGE_NAME." / ".$download_category_name);
-	  }
-	  else
-	  {  // No access to this category
-		define("e_PAGETITLE", PAGE_NAME);
-		require_once(HEADERF);
-		$ns->tablerender(LAN_dl_18, "<div style='text-align:center'>".LAN_dl_3."</div>");
-		require_once(FOOTERF);
-		exit;
-	  }
-	  if ($download_category_parent == 0)
-	  {  // It's a main category - change the listing type required
-	    $action = 'maincats';
-		$maincatval = $id;
-	  }
-	  break;
-	case 'view' :	// Details of individual download
-	  break;
-	case 'report' :
-	  break;
-	case 'mirror' :
-	  break;
-	case 'error' :		// Errors passed from request.php
-	  define("e_PAGETITLE", PAGE_NAME);
-	  require_once(HEADERF);
-	  switch ($errnum)
-	  {
-	    case 1 : 
-		  $errmsg = LAN_dl_63;			// No permissions
-		  break;
-		case 2 : 
-		  $errmsg = LAN_dl_62;			// Quota exceeded
-		  break;
-		default:
-		  $errmsg = LAN_dl_61." ".$errnum;		// Generic error - shouldn't happen
-	  }
-	  $ns->tablerender(LAN_dl_61, "<div style='text-align:center'>".$errmsg."</div>");
-	  require_once(FOOTERF);
-	  exit;
-  }
+			// Get category type, page title
+			if ($sql->db_Select("download_category", "download_category_name,download_category_description,download_category_parent,download_category_class", "(download_category_id='{$id}') AND (download_category_class IN (".USERCLASS_LIST."))") )
+			{
+				$row = $sql->db_Fetch();
+				extract($row);
+				$type = $download_category_name;
+				$type .= ($download_category_description) ? " [ ".$download_category_description." ]" : "";
+				define("e_PAGETITLE", PAGE_NAME." / ".$download_category_name);
+			}
+			else
+			{  // No access to this category
+				define("e_PAGETITLE", PAGE_NAME);
+				require_once(HEADERF);
+				$ns->tablerender(LAN_dl_18, "<div style='text-align:center'>".LAN_dl_3."</div>");
+				require_once(FOOTERF);
+				exit;
+			}
+			if ($download_category_parent == 0)
+			{  // It's a main category - change the listing type required
+				$action = 'maincats';
+				$maincatval = $id;
+			}
+			break;
+		case 'view' :	// Details of individual download
+			break;
+		case 'report' :
+			break;
+		case 'mirror' :
+			break;
+		case 'error' :		// Errors passed from request.php
+			define("e_PAGETITLE", PAGE_NAME);
+			require_once(HEADERF);
+			switch ($errnum)
+			{
+				case 1 :
+	            if (strlen($pref['download_denied']) > 0) {
+	   	         $errmsg = $tp->toHTML($pref['download_denied'],true);
+	   	      } else {
+	   	         $errmsg = LAN_dl_63;
+	   	      }
+					break;
+				case 2 :
+					$errmsg = LAN_dl_62;			// Quota exceeded
+					break;
+				default:
+					$errmsg = LAN_dl_61." ".$errnum;		// Generic error - shouldn't happen
+			}
+			$ns->tablerender(LAN_dl_61, "<div style='text-align:center'>".$errmsg."</div>");
+			require_once(FOOTERF);
+			exit;
+	}
 }
 
 if (isset($order) && !in_array($order,$order_options)) unset($order);
 if (isset($sort)  && !in_array($sort,$sort_options)) unset($sort);
 
-if (!isset($order))	$order = varset($pref['download_order'],"download_datestamp");
-if (!isset($sort))	$sort =  varset($pref['download_sort'], "DESC");
-if (!isset($view))	$view =  varset($pref['download_view'], "10");
+if (!isset($order))	$order = varset($pref['download_order'],'download_datestamp');
+if (!isset($sort))	$sort =  varset($pref['download_sort'], 'DESC');
+if (!isset($view))	$view =  varset($pref['download_view'], '10');
 
 
 //--------------------------------------------------
@@ -206,7 +210,7 @@
 		</form>";
 
 	$download_cat_table_end = preg_replace("/\{(.*?)\}/e", '$\1', $DOWNLOAD_CAT_TABLE_END);
-	$dl_text = $download_cat_table_start.$download_cat_table_string.$download_cat_table_end; 
+	$dl_text = $download_cat_table_start.$download_cat_table_string.$download_cat_table_end;
 
 	ob_start();
 
@@ -214,7 +218,7 @@
 	{
 	  echo $dl_text;
 	}
-	else 
+	else
 	{
 	  $ns->tablerender(LAN_dl_18, $dl_text);
 	}
@@ -254,11 +258,11 @@
 //====================================================
 //				LIST
 //====================================================
-if ($action == "list") 
+if ($action == "list")
 {
-  $total_downloads = $sql->db_Count("download", "(*)", "WHERE download_category = '{$id}' AND download_active > 0 AND download_visible REGEXP '".e_CLASS_REGEXP."'");
+	$total_downloads = $sql->db_Count("download", "(*)", "WHERE download_category = '{$id}' AND download_active > 0 AND download_visible REGEXP '".e_CLASS_REGEXP."'");
 
-  require_once(HEADERF);
+	require_once(HEADERF);
 
 	/* SHOW SUBCATS ... */
 	if($sql -> db_Select("download_category", "download_category_id", "download_category_parent='{$id}' "))
@@ -307,15 +311,17 @@
 	}  // End of subcategory display
 
 // Now display individual downloads
-	$core_total = $sql->db_Count("download WHERE download_category='{$id}' AND download_active > 0 AND download_visible IN (".USERCLASS_LIST.")");
+	// Next line looks unnecessary
+//	$core_total = $sql->db_Count("download WHERE download_category='{$id}' AND download_active > 0 AND download_visible IN (".USERCLASS_LIST.")");
 	if (!check_class($download_category_class))
 	{
-
 		$ns->tablerender(LAN_dl_18, "<div style='text-align:center'>".LAN_dl_3."</div>");
 		require_once(FOOTERF);
 		exit;
 	}
 
+	if ($total_downloads < $view) { $dl_from = 0; }
+
 	if(strstr($download_category_icon, chr(1)))
 	{
 		list($download_category_icon, $download_category_icon_empty) = explode(chr(1), $download_category_icon);
@@ -334,9 +340,13 @@
 	$rater = new rater;
 	$tdownloads = 0;
 
+	// $dl_from - first entry to show  (note - can get reset due to reuse of query, even if values overridden this time)
+	// $view - number of entries per page
+	// $total_downloads - total number of entries matching search criteria
 	$filetotal = $sql->db_Select("download", "*", "download_category='{$id}' AND download_active > 0 AND download_visible IN (".USERCLASS_LIST.") ORDER BY {$order} {$sort} LIMIT {$dl_from}, {$view}");
 	$ft = ($filetotal < $view ? $filetotal : $view);
-	while ($row = $sql->db_Fetch()) {
+	while ($row = $sql->db_Fetch())
+	{
 		extract($row);
 		$download_list_table_string .= parse_download_list_table($row);
 		$tdownloads += $download_requested;
@@ -352,14 +362,14 @@
 
 	if ($filetotal)
 	{  // Only show list if some files in it
-	  if($DOWNLOAD_LIST_TABLE_RENDERPLAIN) 
-	  {
-		echo $text;
-	  } 
-	  else 
- 	  {
-		$ns->tablerender($type, $text);
-	  }
+		if($DOWNLOAD_LIST_TABLE_RENDERPLAIN)
+		{
+			echo $text;
+		}
+			else
+		{
+			$ns->tablerender($type, $text);
+		}
 	}
 
 	if(!isset($DOWNLOAD_LIST_NEXTPREV))
@@ -384,7 +394,7 @@
 //====================================================
 //				VIEW
 //====================================================
-if ($action == "view") 
+if ($action == "view")
 {
 	$gen = new convert;
 
@@ -472,7 +482,7 @@
 //====================================================
 //				REPORT BROKEN LINKS
 //====================================================
-if ($action == "report" && check_class($pref['download_reportbroken'])) 
+if ($action == "report" && check_class($pref['download_reportbroken']))
 {
 	if (!$sql->db_Select("download", "*", "download_id = {$id} AND download_active > 0")) {
 		require_once(HEADERF);
@@ -562,7 +572,7 @@
 
 		// Shuffle the mirror list into a random order
 		$c = count($array) -1;		// Will always be an empty entry at the end
-		for ($i=1; $i<$c; $i++) 
+		for ($i=1; $i<$c; $i++)
 		{
 			$d = mt_rand(0, $i);
 			$tmp = $array[$i];
@@ -603,7 +613,7 @@
 function parse_download_mirror_table($row, $mirrorstring, $mirrorList)
 {
 
-	global $DOWNLOAD_MIRROR;
+	global $pref, $DOWNLOAD_MIRROR, $tp;
 	list($mirrorHost_id, $mirrorHost_url, $mirrorRequests) = explode(",", $mirrorstring);
 
 	extract($mirrorList[$mirrorHost_id]);
@@ -614,7 +624,12 @@
 	$DOWNLOAD_MIRROR_DESCRIPTION = ($mirror_description ? $mirror_description : "");
 
 	$DOWNLOAD_MIRROR_FILESIZE = parsesize($row['download_filesize']);
-	$DOWNLOAD_MIRROR_LINK = "<a href='".e_BASE."request.php?mirror.{$row['download_id']}.{$mirrorHost_id}' title='".LAN_dl_32."'><img src='".IMAGE_DOWNLOAD."' alt='' style='border:0' /></a>";
+	$agreetext = '';
+	if ($pref['agree_flag'])
+	{
+		$agreetext = " onclick= \"return confirm('".$tp->toJS($tp->toHTML($pref['agree_text'],FALSE,"parse_sc, defs"))."');\"";
+	}
+	$DOWNLOAD_MIRROR_LINK = "<a href='".e_BASE."request.php?mirror.{$row['download_id']}.{$mirrorHost_id}'{$agreetext} title='".LAN_dl_32."'><img src='".IMAGE_DOWNLOAD."' alt='' style='border:0' /></a>";
 
 	$DOWNLOAD_MIRROR_REQUESTS = (ADMIN ? LAN_dl_73.$mirrorRequests : "");
 	$DOWNLOAD_TOTAL_MIRROR_REQUESTS = (ADMIN ? LAN_dl_74.$mirror_count : "");
@@ -650,7 +665,7 @@
 
 
 
-function parse_download_cat_parent_table($row) 
+function parse_download_cat_parent_table($row)
 {
 	global $tp,$current_row,$DOWNLOAD_CAT_PARENT_TABLE;
 	extract($row);
@@ -661,8 +676,8 @@
 	$DOWNLOAD_CAT_MAIN_ICON = '';
 	$DOWNLOAD_CAT_MAIN_NAME = '';
 	$DOWNLOAD_CAT_MAIN_DESCRIPTION = '';
-	
-	if (check_class($download_category_class)) 
+
+	if (check_class($download_category_class))
 	{
 		if(strstr($download_category_icon, chr(1)))
 		{
@@ -683,7 +698,7 @@
 	    if (!$ret[FALSE]) $ret[FALSE] = $ret[TRUE];
 		return 	"<img src='".e_IMAGE."icons/{$ret[($count!=0)]}' alt='' style='float: left' />";
 	  }
-	
+
 	  function check_new_download($last_val)
 	  {
 		if(USER && ($last_val > USERLV))
@@ -703,7 +718,7 @@
 
 	$current_row = ($current_row) ? 0 : 1;  // Alternating CSS for each row.(backwards compatible)
 	$template = ($current_row == 1) ? $DOWNLOAD_CAT_CHILD_TABLE : str_replace("forumheader3","forumheader3 forumheader3_alt",$DOWNLOAD_CAT_CHILD_TABLE);
-	
+
 	$DOWNLOAD_CAT_SUB_ICON = get_cat_icons($row['download_category_icon'],$row['d_count']);
 	$DOWNLOAD_CAT_SUB_NEW_ICON = check_new_download($row['d_last_subs']);
 	$dcatname=$tp->toHTML($row['download_category_name'],FALSE,"emotes_off, no_make_clickable");
@@ -732,7 +747,7 @@
 }
 
 
-function parse_download_list_table($row) 
+function parse_download_list_table($row)
 {
 // ***** $agreetext may not need to be global
 	global $download_shortcodes,$tp,$current_row,$DOWNLOAD_LIST_TABLE, $rater, $pref, $gen, $agreetext;
@@ -755,7 +770,7 @@
   var $cat_tree;			// Initialised with all categories in a tree structure
   var $cat_count;			// Count visible subcats and subsubcats
   var $down_count;			// Counts total downloads
-  
+
   function down_cat_handler($nest_level = 1, $load_class = USERCLASS_LIST, $main_cat_load = '', $accum = FALSE)
   {  // Constructor - make a copy of the tree for re-use
      // $nest_level = 0 merges subsubcats with subcats. >0 creates full tree.
@@ -765,8 +780,8 @@
 	define("SUBSUB_PREFIX","---->");		// Added in front of sub-sub categories
     $this->cat_tree = $this->down_cat_tree($nest_level,$load_class, $main_cat_load, $accum);
   }
-  
-  
+
+
 // Function returns a 'tree' of download categories, subcategories, and sub-sub-categories.
 // Returns empty array if nothing defined
 // Within the 'main category' level of the nesting, array 'subcats' has the next level's info
@@ -787,25 +802,25 @@
 		$temp1 = " WHERE dc.download_category_class IN ({$load_cat_class}) ";
 		$temp2 = "AND d.download_visible IN ({$load_cat_class}) ";
 	  }
-	  
+
 	  $qry = "
-	  SELECT dc.*, 
+	  SELECT dc.*,
 	  dc1.download_category_parent AS d_parent1, dc1.download_category_order,
-	  SUM(d.download_filesize) AS d_size, 
+	  SUM(d.download_filesize) AS d_size,
 	  COUNT(d.download_id) AS d_count,
 	  MAX(d.download_datestamp) as d_last,
 	  SUM(d.download_requested) as d_requests
-	  FROM #download_category as dc 
-	  LEFT JOIN #download_category as dc1 ON dc1.download_category_id=dc.download_category_parent 
-	  LEFT JOIN #download_category as dc2 ON dc2.download_category_id=dc1.download_category_parent 
+	  FROM #download_category as dc
+	  LEFT JOIN #download_category as dc1 ON dc1.download_category_id=dc.download_category_parent
+	  LEFT JOIN #download_category as dc2 ON dc2.download_category_id=dc1.download_category_parent
 	  LEFT JOIN #download AS d on d.download_category = dc.download_category_id AND d.download_active > 0 {$temp2}
 	  {$temp1}
 	  GROUP by dc.download_category_id
 	  ORDER by dc2.download_category_order, dc1.download_category_order, dc.download_category_order";   // This puts main categories first, then sub-cats, then sub-sub cats
 
   	  if (!$sql2->db_Select_gen($qry)) return $catlist;
-	  
-	  while ($row = $sql2->db_Fetch()) 
+
+	  while ($row = $sql2->db_Fetch())
 	  {
 	    $tmp = $row['download_category_parent'];
 	    if ($tmp == '0')
@@ -824,7 +839,7 @@
 			$this->down_count += $row['d_count'];
 		    $catlist[$tmp]['subcats'][$row['download_category_id']] = $row;
 		    $catlist[$tmp]['subcats'][$row['download_category_id']]['subsubcats'] = array();
-		    $catlist[$tmp]['subcats'][$row['download_category_id']]['d_last_subs'] = 
+		    $catlist[$tmp]['subcats'][$row['download_category_id']]['d_last_subs'] =
 					$catlist[$tmp]['subcats'][$row['download_category_id']]['d_last'];
 		  }
 		  else
@@ -858,8 +873,8 @@
 	  return $catlist;
 	}
 
-	
-// Rest of the class isn't actually used normally, but print_tree() might help with debug	
+
+// Rest of the class isn't actually used normally, but print_tree() might help with debug
 
     function print_cat($cat, $prefix,$postfix)
 	{
@@ -871,7 +886,7 @@
 	}
 
 	function print_tree()
-	{ 
+	{
 	  echo "<table><tr><th>ID</th><th>Parent</th><th>Name</th><th>Bytes</th><th>Files</th><th>Requests</th><th>Last Download</th><tr>";
 	  foreach ($this->cat_tree as $thiscat)
 	  {  // Main categories
@@ -890,7 +905,7 @@
 	  echo "</table>";
 	return;
     }
-	
+
 }
 
 
diff -x .svn -aruN 0.7.15.src/e107_admin/admin.php 0.7.16.src/e107_admin/admin.php
--- 0.7.15.src/e107_admin/admin.php	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_admin/admin.php	2009-07-18 10:53:18.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_admin/admin.php,v $
-|     $Revision: 1.41 $
-|     $Date: 2008/07/18 19:50:52 $
-|     $Author: e107coders $
+|     $Revision: 1.42 $
+|     $Date: 2009/07/18 15:53:42 $
+|     $Author: marj_nl_fr $
 +----------------------------------------------------------------------------+
 */
 require_once('../class2.php');
@@ -22,10 +22,11 @@
 require_once(e_HANDLER.'admin_handler.php');
 
 // --- check for htmlarea.
-if (is_dir(e_ADMIN.'htmlarea') || is_dir(e_HANDLER.'htmlarea')) {
+if (is_dir(e_ADMIN.'htmlarea') || is_dir(e_HANDLER.'htmlarea'))
+{
 	$text = ADLAN_ERR_2."<br /><br />
 	<div style='text-align:center'>".$HANDLERS_DIRECTORY."htmlarea/<br />".$ADMIN_DIRECTORY."htmlarea/</div>";
-	$ns -> tablerender(ADLAN_ERR_1, $text);
+	$ns -> tablerender(LAN_WARNING, $text);
 }
 
 // check for old modules.
@@ -92,14 +93,16 @@
 	}
 }
 
-if (isset($potential)) {
+if (isset($potential))
+{
 	$text = ADLAN_ERR_3."<br /><br />";
 
-	foreach ($potential as $p_file) {
+	foreach ($potential as $p_file)
+	{
 		$text .= $p_file.'<br />';
 	}
 
-	$ns -> tablerender(ADLAN_ERR_1, $text);
+	$ns -> tablerender(LAN_WARNING, $text);
 }
 
 // update users using old layout names to their new names
diff -x .svn -aruN 0.7.15.src/e107_admin/auth.php 0.7.16.src/e107_admin/auth.php
--- 0.7.15.src/e107_admin/auth.php	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_admin/auth.php	2009-07-18 05:17:02.000000000 -0500
@@ -11,19 +11,21 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_admin/auth.php,v $
-|     $Revision: 1.16 $
-|     $Date: 2008/07/17 21:53:44 $
-|     $Author: e107steved $
+|     $Revision: 1.17 $
+|     $Date: 2009/07/18 10:17:26 $
+|     $Author: marj_nl_fr $
 +----------------------------------------------------------------------------+
 */
 
 if (!defined('e107_INIT')) { exit; }
 
+/* done in class2
 @include_once(e_LANGUAGEDIR.e_LANGUAGE."/admin/lan_admin.php");
 @include_once(e_LANGUAGEDIR."English/admin/lan_admin.php");
+*/
 if (ADMIN)
 {
-    define("ADMIN_PAGE", true);
+    define("ADMIN_PAGE", TRUE);
     require_once(e_ADMIN."header.php");
 }
 else
diff -x .svn -aruN 0.7.15.src/e107_admin/banner.php 0.7.16.src/e107_admin/banner.php
--- 0.7.15.src/e107_admin/banner.php	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_admin/banner.php	2009-08-15 06:54:06.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_admin/banner.php,v $
-|     $Revision: 1.33 $
-|     $Date: 2008/08/26 19:45:15 $
-|     $Author: e107steved $
+|     $Revision: 1.35 $
+|     $Date: 2009/08/15 11:54:30 $
+|     $Author: marj_nl_fr $
 +----------------------------------------------------------------------------+
 */
 require_once("../class2.php");
@@ -30,8 +30,9 @@
 require_once(e_HANDLER."file_class.php");
 $fl = new e_file;
 
-@include_lan(e_LANGUAGEDIR.e_LANGUAGE."/admin/lan_menus.php");
-@include_lan(e_PLUGIN."banner_menu/languages/".e_LANGUAGE.".php");
+//@FIXME mix up in banner language files
+include_lan(e_LANGUAGEDIR.e_LANGUAGE."/admin/lan_menus.php");
+include_lan(e_PLUGIN."banner_menu/languages/".e_LANGUAGE.".php");
 
 
 if(e_QUERY)
diff -x .svn -aruN 0.7.15.src/e107_admin/check_user.php 0.7.16.src/e107_admin/check_user.php
--- 0.7.15.src/e107_admin/check_user.php	1969-12-31 18:00:00.000000000 -0600
+++ 0.7.16.src/e107_admin/check_user.php	2009-01-06 14:57:38.000000000 -0600
@@ -0,0 +1,195 @@
+<?php
+/*
++ ----------------------------------------------------------------------------+
+|     e107 website system
+|
+|     Steve Dunstan 2001-2002
+|     http://e107.org
+|     jalist@e107.org
+|
+|     Released under the terms and conditions of the
+|     GNU General Public License (http://gnu.org).
+|
+|     $Source: /cvsroot/e107/e107_0.7/e107_admin/check_user.php,v $
+|     $Revision: 1.4 $
+|     $Date: 2009/01/06 20:58:02 $
+|     $Author: e107steved $
++----------------------------------------------------------------------------+
+*/
+
+require_once('../class2.php');
+if (!getperms('0')) 
+{
+	header('location:'.e_BASE.'index.php');
+	exit;
+}
+
+require_once('auth.php');
+
+if (isset($_POST['do_check']))
+{
+	if (isset($_POST['check_duplicates']))
+	{
+		$result = checkDuplicateField('loginname');
+		$ns->tablerender(LAN_CKUSER_07,$result);
+	}
+	if (isset($_POST['check_mixed']))
+	{
+		$result = checkUserLogin();
+		$ns->tablerender(LAN_CKUSER_17,$result);
+	}
+	if (isset($_POST['check_dupdisplay']))
+	{
+		$result = checkDuplicateField('email');
+		$ns->tablerender(LAN_CKUSER_13,$result);
+	}
+}
+
+
+$text = "
+	<form method='post' action='".e_SELF."'>
+	<table style='".ADMIN_WIDTH."' class='fborder'>
+	<colgroup span='2'>
+		<col style='width: 10%'></col>
+		<col style='width: 90%'></col>
+	</colgroup>
+
+	<tr>
+		<td colspan='2' style='text-align:center' class='forumheader2'>".LAN_CKUSER_06."</td>
+	</tr>
+
+	<tr>
+		<td class='forumheader3'>
+			<input class='tbox' type='checkbox' name='check_duplicates' value='1' />
+		</td>
+		<td class='forumheader3'>".LAN_CKUSER_05."</td>
+	</tr>
+
+	<tr>
+		<td class='forumheader3'>
+			<input class='tbox' type='checkbox' name='check_mixed' value='1' />
+		</td>
+		<td class='forumheader3'>".LAN_CKUSER_16."</td>
+	</tr>
+
+	<tr>
+		<td class='forumheader3'>
+			<input class='tbox' type='checkbox' name='check_dupdisplay' value='1' />
+		</td>
+		<td class='forumheader3'>".LAN_CKUSER_12."</td>
+	</tr>
+
+	<tr>
+		<td colspan='2' style='text-align:center' class='forumheader3'><input  class='button' type='submit' name='do_check' value='".LAN_CKUSER_04."'></td>
+	</tr>
+	</table>
+	</form>
+	";
+
+$ns->tablerender(LAN_CKUSER_01, $text);
+
+
+require_once("footer.php");
+
+
+function checkDuplicateField($checkField)
+{
+	global $sql;
+	switch ($checkField)
+	{
+		case 'loginname' :
+			$dupField = 'user_loginname';
+			$otherField = 'user_email';
+			$hdg1 = LAN_CKUSER_09;
+			$hdg2 = LAN_CKUSER_14;
+			break;
+		case 'email' :
+			$dupField = 'user_email';
+			$otherField = 'user_name';
+			$hdg2 = LAN_CKUSER_09;
+			$hdg1 = LAN_CKUSER_14;
+			break;
+		default :
+			return "Error";
+	}
+		$result = '';
+		$qry = "SELECT count({$dupField}) AS u_count, {$dupField} FROM #user GROUP BY {$dupField} HAVING u_count > 1 ";
+		if ($sql->db_Select_gen($qry))
+		{
+			$duplicates = array();
+			while ($row = $sql->db_Fetch(MYSQL_ASSOC))
+			{
+				$duplicates[] = $row[$dupField];
+			}
+			$result .= "<table style='".ADMIN_WIDTH."' class='fborder'>
+					<colgroup>
+					<col style='width:30%' />
+					<col style='width:10%' />
+					<col style='width:30%' />
+					<col style='width:30%' />
+					</colgroup>
+					<tr><td class='fcaption'>".$hdg1."</td><td class='fcaption'>".LAN_CKUSER_10."</td>
+						<td class='fcaption'>".$hdg2."</td><td class='fcaption'>".LAN_CKUSER_11."</td></tr>";
+			foreach ($duplicates as $ul)
+			{
+				$doneName = FALSE;
+				if ($ucount = $sql->db_Select_gen("SELECT user_id, user_name, user_loginname, user_email FROM `#user` WHERE {$dupField}='".$ul."'"))
+				{
+					while ($row = $sql->db_Fetch(MYSQL_ASSOC))
+					{
+						$result .= '<tr>';
+						if (!$doneName)
+						{
+							$result .= "<td class='forumheader3' rowspan='".$ucount."'>".$row[$dupField]."</td>";
+							$doneName = TRUE;
+						}
+						$result .= "<td class='forumheader3'>".$row['user_id']."</td>
+								<td class='forumheader3'>".$row[$otherField]."</td><td class='forumheader3'>".$row['user_name']."</td></tr>";
+					}
+				}
+			}
+			$result .= '</table>';
+		}
+		else
+		{
+			$result = LAN_CKUSER_08;
+		}
+	return $result;
+}
+
+
+function checkUserLogin()
+{
+	global $sql;
+	$result = "<table style='".ADMIN_WIDTH."' class='fborder'>";
+	$query = "SELECT u.user_name AS un1, u.user_loginname AS ul1, u.user_id AS ui1, x.user_id AS ui2, x.user_name AS un2, x.user_loginname AS ul2 FROM `e107_user` as u 
+			LEFT JOIN `e107_user` as x ON u.user_name=x.user_loginname WHERE x.user_id != u.user_id ";
+	if ($sql->db_Select_gen($query))
+	{
+		$result .= "<tr><td colspan='3' class='fcaption' style='text-align:center'>".LAN_CKUSER_18."</td>
+					<td colspan='3' class='fcaption' style='text-align:center'>".LAN_CKUSER_19."</td></tr>
+				<tr><td class='fcaption'>".LAN_CKUSER_10."</td>
+					<td class='fcaption'>".LAN_CKUSER_09."</td>
+					<td class='fcaption'>".LAN_CKUSER_11."</td>
+					<td class='fcaption'>".LAN_CKUSER_10."</td>
+					<td class='fcaption'>".LAN_CKUSER_09."</td>
+					<td class='fcaption'>".LAN_CKUSER_11."</td></tr>";
+		while ($row = $sql->db_Fetch(MYSQL_ASSOC))
+		{
+			$result .= "<tr><td class='forumheader3'>".$row['ui1']."</td>
+						<td class='forumheader3'>".$row['ul1']."</td>
+						<td class='forumheader3'>".$row['un1']."</td>
+						<td class='forumheader3'>".$row['ui2']."</td>
+						<td class='forumheader3'>".$row['ul2']."</td>
+						<td class='forumheader3'>".$row['un2']."</td></tr>";
+		}
+	}
+	else
+	{
+		$result .= "<tr><td style='width:90%; text-align:center' class='forumheader3'>".LAN_CKUSER_15."</td></tr>";
+	}
+	$result .= '</table>';
+	return $result;
+}
+
+?>
diff -x .svn -aruN 0.7.15.src/e107_admin/comment.php 0.7.16.src/e107_admin/comment.php
--- 0.7.15.src/e107_admin/comment.php	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_admin/comment.php	2009-04-19 15:53:55.000000000 -0500
@@ -11,36 +11,53 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_admin/comment.php,v $
-|     $Revision: 1.4 $
-|     $Date: 2005/12/25 01:26:59 $
-|     $Author: sweetas $
+|     $Revision: 1.5 $
+|     $Date: 2009/04/19 20:54:19 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 require_once("../class2.php");
-if (!getperms("B")) {
+if (!getperms("B")) 
+{
 	header("location:".e_BASE."index.php");
 	exit;
 }
 	
-if (e_QUERY) {
+if (e_QUERY) 
+{
 	$temp = explode("-", e_QUERY);
 	$action = $temp[0];
 	$id = intval($temp[1]);
 	$item = $temp[2];
 	$c_item = $temp[3];
-	if ($action == "block") {
-		$sql->db_Update("comments", "comment_blocked='1' WHERE comment_id='$id' ");
-	}
-	if ($action == "unblock") {
-		$sql->db_Update("comments", "comment_blocked='0' WHERE comment_id='$id' ");
-	}
-	if ($action == "delete") {
-		$sql->db_Delete("comments", "comment_id='$id' ");
-	}
-	if (!$e107cache->clear($item)) {
-		$tmp = explode("?", $item);
-		$item = $tmp[0]."?news.".$c_item;
-		$e107cache->clear($item);
+	if ($sql->select('comments','*', 'comment_id='.$id))
+	{
+		$comment = $sql->db_Fetch();
+		if ($action == "block") 
+		{
+			$sql->db_Update("comments", "comment_blocked='1' WHERE comment_id=".$id);
+		}
+		if ($action == "unblock") 
+		{
+			$sql->db_Update("comments", "comment_blocked='0' WHERE comment_id=".$id);
+		}
+		if ($action == "delete") 
+		{
+			$sql->db_Delete("comments", "comment_id=".$id);
+			switch ($comment['comment_type'])
+			{
+				case '0' :
+				case 'news' :		// Need to update count in news record as well
+					$sql2->db_Update('news', 'news_comment_total = CAST(GREATEST(CAST(news_comment_total AS SIGNED) - 1, 0) AS UNSIGNED) WHERE news_id='.$comment['comment_item_id']);
+					break;
+			}
+		}
+		if (!$e107cache->clear($item)) 
+		{
+			$tmp = explode("?", $item);
+			$item = $tmp[0]."?news.".$c_item;
+			$e107cache->clear($item);
+		}
 	}
 }
 echo "<script type='text/javascript'>window.history.go(-1);</script>\n";
diff -x .svn -aruN 0.7.15.src/e107_admin/core_image.php 0.7.16.src/e107_admin/core_image.php
--- 0.7.15.src/e107_admin/core_image.php	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_admin/core_image.php	2009-09-05 10:24:28.000000000 -0500
@@ -11,8 +11,8 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_admin/core_image.php,v $
-|     $Revision: 1.53 $
-|     $Date: 2008/12/10 02:54:48 $
+|     $Revision: 1.54 $
+|     $Date: 2009/09/05 15:24:52 $
 |     $Author: mcfly_e107 $
 +----------------------------------------------------------------------------+
 */
@@ -42,7 +42,7 @@
       'extended_country.php' => '9d6cf4a6e013a60c58d4687076bd187e',
     ),
     'ad_links.php' => 'bc9520a672754b6b283f734f9cbca86c',
-    'admin.php' => '4302912d9f523e63f65f2b81bec237da',
+    'admin.php' => '8d2103f37e0353d51a2b75a5bf5083aa',
     'admin_classis.php' => 'ed861d18477db9ce0bc3620a69443723',
     'admin_combo.php' => '8958300a2a42fd2aa68977d566c1edb9',
     'admin_etalkers.php' => '9d684ef56c54bbf919e3346927cf4509',
@@ -50,48 +50,49 @@
     'adminb.php' => '1e31b2ad3907c7cba29dca04342cee1d',
     'administrator.php' => '196c98e43136789512b1436b881921b5',
     'article.php' => '7b21dc8ef4bc68ceb9ecf4d1c519a645',
-    'auth.php' => 'ff049badda2e090168f61849a496e4bb',
+    'auth.php' => '7dcd0adde42f2770dabc511c5d39e229',
     'banlist.php' => '6ff4252414f390d5080d778e59198a12',
-    'banner.php' => '94365c8703d0baa0a72ca9941650ecd5',
+    'banner.php' => '0a0621d17caf7b6b81feae86c488fa71',
     'cache.php' => '62fc17d1f4c6db977c66642c5a76127a',
     'cascade.php' => '3d70a650778f09e6c85efd91b6ab5e4a',
     'categories.php' => 'cbbed37d26ab602700d46a0cb1955205',
+    'check_user.php' => '52116c815b64c9efbc73c42aabfcfd93',
     'classis.php' => 'ae46c368d41390a44cd6005404d651d7',
     'combo.php' => '6b0f9e175585ef0b42585b444b003678',
-    'comment.php' => '96f04e71003de6b6a6ea3a0f2ede285d',
+    'comment.php' => '240a0a659d78c66c88ccf87341e4a520',
     'compact.php' => '20bccea2ef81cc86a86782fa4841e45f',
     'content.php' => 'bf2239404990afed185913002429e682',
-    'core_image.php' => '7efb17c39a9ab59632b98c99a28026b8',
-    'cpage.php' => '249109943f5bb394b70065596e556ff5',
+    'core_image.php' => '86c0c495be2753928bc01e4dadb51ec2',
+    'cpage.php' => '1df0b5ce8504060f4205abe16a247f63',
     'credits.php' => '273cb301d908936a58a8d38b4e92ba5a',
-    'db.php' => '74e4d75fbafe9a8493fbba384ae6f97f',
+    'db.php' => '1609930adca0aee8d3fe649e729feec9',
     'db_verify.php' => '0699ccfd73686113023ee99cf406e6ce',
     'docs.php' => 'e5ebdd8fd30362636cfe1a3878b3fb18',
-    'download.php' => '19820445103f0c1463a093622c6b8b7f',
+    'download.php' => 'd094564bea2436690612c0e62e872acc',
     'e107_update.php' => 'c23624862e7dc50fab29aa1890c7872a',
     'emoticon.php' => '9403ce6e8c4dc4ab34d32b3d74a1d699',
     'fileinspector.php' => 'e1d831bfb0ca6a9244a4ced5b0d85fc3',
     'filemanager.php' => '7b05edc097aa543f1a29941600134ed3',
     'filetypes_.php' => 'f951037335e993337792606cc1475cec',
-    'fla.php' => '6ddfb114697906ccf582388016f4b523',
-    'footer.php' => '1195647fdeaa996c43c3e58bf9bb86cc',
+    'fla.php' => '397cfd1d0d0d6ad72ea3b495cef4e505',
+    'footer.php' => 'eeadbc6faabd7aa207137ea5979a4e3f',
     'frontpage.php' => '18cdca6033109f4609ce69cf8f0dafb6',
-    'header.php' => '24eed26f8a60cafaefe629d9928472aa',
+    'header.php' => '06b8741f5c0b0efb4f006f014d377891',
     'image.php' => '345b2f94346f1e8b7972b0fe441104c5',
     'index.php' => 'e4e143ee2d34d4ce1f17b3f043cc6cd6',
     'lancheck.php' => '486475f13c553f7337ca5242f7aa27fd',
-    'language.php' => '04c1de82dbf6901aec4804457a2bcf92',
-    'links.php' => 'e2dc3726b76807645c1426aae226b385',
-    'mailout.php' => '3d2a68cb77ceac276bc493dc6d297cca',
+    'language.php' => '77f94a4c7e1731f631b797e378964283',
+    'links.php' => '060e71d55516e87ad3ff4c48da940873',
+    'mailout.php' => 'eef1ef6e921bb8be976b6c183d78b509',
     'menus.php' => '816ba85a06f966b9bbc59c53d31c1bc6',
     'message.php' => 'a598b5e493298500d81b815f1455280b',
-    'meta.php' => 'bf6ed9bf9d938f9618fb1c4e53632323',
-    'modcomment.php' => '46cfd548b5aad18c715cb369d330463f',
-    'newspost.php' => '1bbc94250137d4bb23dc529e7a3718c6',
+    'meta.php' => 'c6daf07f0bd46752bc7b8b294aae3181',
+    'modcomment.php' => 'c18260465735f9f1b433870558e96357',
+    'newspost.php' => 'bf903258e7b5a341e3e8e73972b63d83',
     'notify.php' => 'ddd3d41f0c25db4528c9100c664f8e98',
     'phpinfo.php' => '994ea857810fe5f47ac8612f570aadb1',
-    'plugin.php' => '1132f33453629797febe9dd575a6b55a',
-    'prefs.php' => '18ab0fc931048f841a3dd8018a04293d',
+    'plugin.php' => '61cbb2233ea02ae36ae683aaa256ee45',
+    'prefs.php' => '66788c47a76535afe18e4e518bb5e189',
     'review.php' => '1919d31943803a66cb2d12828bd92db2',
     'search.php' => 'b1239e5af6795205648d8965ec3a1ec9',
     'theme.php' => 'b05f7265501a3e1c5e7c47cb3f891831',
@@ -100,12 +101,12 @@
     'updateadmin.php' => '770fff43134883ea4d502498b28d70d2',
     'upload.php' => '26cedc21eaee3f3719e7a8aa591de10c',
     'userclass.php' => 'cbc4006fb0664fca537a910d2f54d59c',
-    'userclass2.php' => 'cdf66f5a605f42b7ca51d63a1102f7b4',
-    'userinfo.php' => 'fcbb4c620a0a9ed430588ee7539fb2d7',
-    'users.php' => 'ffe9886f91987ecbc08546e6bbc9b433',
+    'userclass2.php' => 'f82e66b1b45901c3c4b5158211086766',
+    'userinfo.php' => 'd82d6eab0ae18e65b39f122193cadd3e',
+    'users.php' => 'bf2451b1d8c88001adb7174e052444e3',
     'users_extended.php' => '016339d4fdaeaac0d7e8bb7f91c46952',
     'users_extended_predefined.php' => '51128e45b6620f7b6ead6fbd8521b43e',
-    'ver.php' => 'f2c35841f7c41b845c7656b7aada79a1',
+    'ver.php' => '4058e237069cf55e650f4d9c493e625b',
     'wmessage.php' => '17afb0f8ef07cfd675cd92e9f7e606a3',
   ),
   $coredir['docs'] => 
@@ -206,7 +207,7 @@
       'import_mapper.php' => '78a98bfedbe66b043e8562bcd6449125',
       'import_readme.txt' => 'a76f8a52208d648e1c9e3afe71929755',
       'index.html' => 'd41d8cd98f00b204e9800998ecf8427e',
-      'mambo.php' => '60c61122c4984adbd94c2be0062c2a29',
+      'mambo.php' => '749a9ec55f9036a54b1938ac9408d0fd',
       'phpbb2.php' => '6dc2cdde92fa97a27d1f5def8c380501',
       'phpnuke.php' => '35203270b9de7506f63b011ac85ab905',
     ),
@@ -236,10 +237,10 @@
         'bbcode_shortcodes.php' => '979de9d7330c0e547d952f1c547d76e1',
         'comment_shortcodes.php' => '97e52cf2411985c27833bbe5010b9e94',
         'contact_shortcodes.php' => 'd593f9dadff312c61eb27e32457d7f95',
-        'download_shortcodes.php' => 'f96d6dc460c4b0e25adadb2c50c1635a',
+        'download_shortcodes.php' => 'cec84de6d1ce12113823adb02e2694d7',
         'index.html' => 'd41d8cd98f00b204e9800998ecf8427e',
-        'news_archives.php' => '1115fe90b0de9f170fce31c94680dabf',
-        'news_shortcodes.php' => '1014d80eb9fa2e3b09efe27adaaf2064',
+        'news_archives.php' => 'b7513e4539e166bd371833f77b2c2434',
+        'news_shortcodes.php' => '6798aae0e58adfc65554dded3220439f',
         'signup_shortcodes.php' => 'fbaad5179aa055dcd04f5bfdc6614782',
         'sitedown_shortcodes.php' => '3ae9199cbae645d23869d517a5f6cef4',
         'user_shortcodes.php' => 'a3b47064debd03115dfb95cb82927438',
@@ -248,9 +249,9 @@
       'admin_alt_nav.sc' => '412e8fb7acac7746ea48b17854decfc4',
       'admin_credits.sc' => '0eb1784fcb76e13c8addd81d9a741074',
       'admin_docs.sc' => 'b010b7ac7618fa669c8777754a8337c6',
-      'admin_help.sc' => 'ba6d4dff807a99eca5be742f259732a9',
+      'admin_help.sc' => '32247c5afa0c6afcd7f58ef51c5f105f',
       'admin_icon.sc' => 'e479849c3b09aae88aae3532b0550a92',
-      'admin_lang.sc' => 'f5bf42455eb337119639528aa7fea705',
+      'admin_lang.sc' => 'c45e891e84c208466768a591644df9e1',
       'admin_latest.sc' => '96a92eb5000eb6e8f120b70734239968',
       'admin_log.sc' => '68d201ee791ca1a72faee5dd643d3578',
       'admin_logged.sc' => 'dec16fb0a9f5485db6ca1b4955753c2e',
@@ -261,16 +262,16 @@
       'admin_plugins.sc' => '67b6ef3a70b37eb92ae585f20334b9ca',
       'admin_preset.sc' => '57769dcbc4c658c8b14fbc0b19b94a28',
       'admin_pword.sc' => 'abbe3f9d2709e86cfb37b378f2b3d13f',
-      'admin_sel_lan.sc' => '6c2dbc4e17bdcc5f5260664ddb8c3280',
-      'admin_siteinfo.sc' => '7a8d2349bb68ce064cfbfb70dc559288',
+      'admin_sel_lan.sc' => 'a71547c6cf41f800a8202b82cd504e64',
+      'admin_siteinfo.sc' => '28e2f558747ecd09ee787b6f46eea3bf',
       'admin_status.sc' => 'dd09c0b576dba2e5e9c710d7a932c9cf',
-      'admin_update.sc' => '8d9dba8124282e7e230b0883b7aed849',
-      'admin_userlan.sc' => 'cbaf3dda959b6a36f6b3f4cf0a6f7536',
+      'admin_update.sc' => '19dcb86c4e80082a4071aea0ce8bc98a',
+      'admin_userlan.sc' => 'd1ced8f4235d221877e47efcaaecc835',
       'banner.sc' => 'b5d2407d670146f95bb3c36edc2ca42d',
       'breadcrumb.sc' => '0591ee7dc26ded7ac9a359dea4b8fdf6',
-      'custom.sc' => 'ea36528652b9aa0bff9bef4e6658c139',
+      'custom.sc' => '0aceab8e9198f1ad243efca346c6ab6e',
       'e_image.sc' => '3819fdf5b9dfc7b189fb4073d33ae0d5',
-      'email.sc' => 'e363b6b54037a8c80b373b76994c8db9',
+      'email.sc' => 'a587a1b51fbefc39f3f267dfabe9d302',
       'email_item.sc' => 'fa6140b7829cb0a32ae04ae4efd24d94',
       'emailto.sc' => '2a090d41cd91744486aa4f74519f3c4b',
       'extended.sc' => '868d45e725d7565a1d9c5b743aba0967',
@@ -279,16 +280,16 @@
       'extended_value.sc' => '1b720e5d3155c6d4a1464fc1e9cac5f1',
       'imageselector.sc' => '5f8b371a8d6cf9f1b538d7bce18e6814',
       'index.html' => 'd41d8cd98f00b204e9800998ecf8427e',
-      'languagelinks.sc' => '9a233913b41de783edaa68c46abadf65',
+      'languagelinks.sc' => '9ae970194272430303850d98e3ec8657',
       'linkstyle.sc' => '5ed64d972bc892a798f80179878f1266',
       'logo.sc' => '7989dac8bea9ec4c0da489fb942ae507',
-      'menu.sc' => 'b327142ca67222cde1a7c3a4f9e142ac',
+      'menu.sc' => 'fcc5325cabd8733f2b13f9406935ed3d',
       'news_alt.sc' => '25596ffed2cf4bed831b80397c77e295',
-      'news_categories.sc' => 'b2ae6f1ca052c9e858d4c2c860e8a5bf',
+      'news_categories.sc' => '5bcd029587b243e7206cb98a5411f286',
       'news_category.sc' => '25596ffed2cf4bed831b80397c77e295',
       'newsfile.sc' => 'afe0363c51236eacdf1a5434d17533a3',
       'newsimage.sc' => '75738371cff6146174ea00971730a0da',
-      'nextprev.sc' => '8fbd81c6f1a3274aa8b587e48660d566',
+      'nextprev.sc' => '85bade909702980372c5c1c0b728dc1d',
       'picture.sc' => '0f4d00920f1ddbac7293549862b3c0da',
       'plugin.sc' => 'be06266acd86f06b244dd27266df8f12',
       'print_item.sc' => 'fb3b5508fed60548689a5c496d45e1b3',
@@ -309,7 +310,7 @@
       'user_extended.sc' => '96cb880827295452164bd86c24cb0e78',
       'wmessage.sc' => 'c24f80349ceafd36f6cf0d6ec6875fa7',
     ),
-    'def_e107_prefs.php' => 'd929fdd0d20de447334375e28d1a43ab',
+    'def_e107_prefs.php' => '5cec5e4f536beba7617fc585bbeac0a4',
     'e107.css' => 'e5cfa4047831f19def7df032ef8bc830',
     'e107.js' => 'e6e6fd1d50c5aefbe1a4c3ff0e4ced3d',
     'e_ajax.js' => 'b583773e72852158e27af8a9bba7c97f',
@@ -347,11 +348,11 @@
     array (
       'language' => 
       array (
-        'phpmailer.lang-en.php' => 'dca429b3dfc000a241f32ed11d3a6aca',
+        'phpmailer.lang-en.php' => 'a74b5cfe2f7636a31107b3c8df71fdf7',
       ),
-      'class.phpmailer.php' => '41bbfce3f86dc09ba7eca4e716d6aa29',
-      'class.pop3.php' => '15ad99c609a248dcb1dbd10b68dcc326',
-      'class.smtp.php' => 'e9f2821680e2d42f2f2285a7f5009ab6',
+      'class.phpmailer.php' => '4b87656ccbdc865d24bedc6262b7f4e4',
+      'class.pop3.php' => '4ee33629dec2b6c217792d2d75f83b51',
+      'class.smtp.php' => '3703c67c81f61a223cd6bc1c10687dbf',
       'e107.htaccess' => '507de3fb6f951cafa6b1a346d232604f',
       'mailout_process.php' => '5933e84899b54c073729c1d54b0078d7',
     ),
@@ -369,7 +370,7 @@
       'index.html' => 'd41d8cd98f00b204e9800998ecf8427e',
       'search_comment.php' => 'd6969967014e8c14e613bad64a091253',
       'search_download.php' => 'ad2776a005adc703798e0f543d36bd92',
-      'search_event.php' => '17c68ea4f5728e87e7009b96b978006c',
+      'search_event.php' => '186c015626529d267b46e7f3e58f2149',
       'search_news.php' => 'bc0321e07ae69c925ac83a72ae67c136',
       'search_pages.php' => '8d64a81740abb06374191891604f63aa',
       'search_user.php' => '09d6c3a85872a9b894d1afccf94bf31d',
@@ -378,10 +379,15 @@
     array (
       'langs' => 
       array (
-        'en.js' => 'f304920296d23ba3ed1a8ec3a2a1844d',
+        'en.js' => 'b8a3157ba03ebce3bb977a37c71d452e',
       ),
       'plugins' => 
       array (
+        'compat2x' => 
+        array (
+          'editor_plugin.js' => '9e9ff1b8efdd329d514453fb94802c71',
+          'editor_plugin_src.js' => 'a5cdd63a55dc7599341c328c9a376ac2',
+        ),
         'contextmenu' => 
         array (
           'css' => 
@@ -393,8 +399,8 @@
             'spacer.gif' => '12bf9e19374920de3146a64775f46a5e',
           ),
           'contextmenu.css' => '93ad8b3e8a5e1a48bf6ed727ca0384e2',
-          'editor_plugin.js' => 'f4df4d4889b61ecd067ea2d6977420ca',
-          'editor_plugin_src.js' => '7772eef735b088e4a6fdfdf707e33e65',
+          'editor_plugin.js' => '615aede93687b7373e0518026a69d65f',
+          'editor_plugin_src.js' => 'a8ec7d4ed27fc25535456034069ca507',
         ),
         'emoticons' => 
         array (
@@ -404,10 +410,10 @@
           ),
           'langs' => 
           array (
-            'en.js' => '25334d4a3d329cc805a54c3f815ff26a',
+            'en.js' => '4e72c7cd68a7fb3a6b8f1e1cd6eeac8a',
           ),
-          'editor_plugin.js' => 'ede01e828a3698e2e00a9dbd503e7d95',
-          'emoticons.php' => '31f361fda0b760ad25d72a9cf8bed070',
+          'editor_plugin.js' => '555eb804407f612356f57639776a28af',
+          'emoticons.php' => '0e6acc8a0005b36417bd2714ce1a6c11',
           'index.html' => 'd41d8cd98f00b204e9800998ecf8427e',
         ),
         'ibrowser' => 
@@ -420,31 +426,24 @@
           ),
           'langs' => 
           array (
-            'en.js' => '5bc48956a398ac86f36edb041a898a85',
+            'English.php' => 'b4716dc46edddd195dc6a27d95630e2a',
+            'en.js' => '2f2d7290102dc90e696f878a96329f3c',
           ),
           'config.php' => '4e178e32efb96453c26523ded26f6ee7',
-          'editor_plugin.js' => 'e16d63db65af69d1db26ff64b706a0d9',
-          'ibrowser.php' => 'ee1a24596dfa9d77950fed1acbb24bc3',
+          'editor_plugin.js' => '43bed74f8ecaf568fb0773c217f50daf',
+          'ibrowser.php' => '953e30bcec4fab85548e04962d3348ab',
         ),
         'iespell' => 
         array (
-          'images' => 
-          array (
-            'iespell.gif' => 'eb12c26b5768fcd344ea6205aa98e761',
-          ),
-          'langs' => 
-          array (
-            'en.js' => 'b262530d5b63841b50ab5b67f94883aa',
-          ),
-          'editor_plugin.js' => 'fae3a5e1abb9e78c55eb4dab42d8dfd1',
-          'editor_plugin_src.js' => '24caf83859f447628508cd99c907352c',
+          'editor_plugin.js' => '22526393cacb6447a0e3bfff2fb47773',
+          'editor_plugin_src.js' => '46a827c6cca2c40b0ec0402b454d8bd0',
         ),
         'media' => 
         array (
           'css' => 
           array (
-            'content.css' => 'f665ed43e62a4ab7c0661d00fa4f0fdb',
-            'media.css' => 'af181e09ae05dd73b0d32c0caa87d1a4',
+            'content.css' => '3135bdacabceae466c3b643e33dc3e17',
+            'media.css' => 'b7d62f5bcf41bb15ddc82206ad11664d',
           ),
           'images' => 
           array (
@@ -455,6 +454,21 @@
             'shockwave.gif' => 'acad15b370f34deb12355bea4b89c2e1',
             'windowsmedia.gif' => '825f4eca28a633397050f9a6cca9358f',
           ),
+          'img' => 
+          array (
+            'flash.gif' => '709d9df69d8c2030e56321046d76ab8b',
+            'flv_player.swf' => '0832561b93570aff683eeca311228419',
+            'quicktime.gif' => '4a4709a92bb1ef6bc1621019c92a83b8',
+            'realmedia.gif' => '51de6342ba5327787eba762116d20130',
+            'shockwave.gif' => 'acad15b370f34deb12355bea4b89c2e1',
+            'trans.gif' => '12bf9e19374920de3146a64775f46a5e',
+            'windowsmedia.gif' => '825f4eca28a633397050f9a6cca9358f',
+          ),
+          'js' => 
+          array (
+            'embed.js' => '2288f2d23b707283921aaeff2dfeb005',
+            'media.js' => 'c56e5dfcee7cd5d177df8fa248d29083',
+          ),
           'jscripts' => 
           array (
             'embed.js' => '2288f2d23b707283921aaeff2dfeb005',
@@ -462,11 +476,11 @@
           ),
           'langs' => 
           array (
-            'en.js' => 'de38190b0b16ff997c6f7a2e09818f3c',
+            'en_dlg.js' => '3439c7545446063966919aaaf8c9bc93',
           ),
-          'editor_plugin.js' => '6c1cbbc18a0f3a07757ee1a3969d55f8',
-          'editor_plugin_src.js' => '9603968370efb4b25ae25d701db8ffd1',
-          'media.htm' => 'd3fce5ed41db220e12ebfebd143e1f47',
+          'editor_plugin.js' => '8711a73c0d6d417b635bf646dc5091c8',
+          'editor_plugin_src.js' => '2be6ec26bfa058d65bd23140e212707c',
+          'media.htm' => 'ac37ca5e4be99e68ade8f8032e9042f1',
         ),
         'table' => 
         array (
@@ -474,7 +488,7 @@
           array (
             'cell.css' => 'a51b50f9a8153e7f55fe06a03caca016',
             'row.css' => '6d95ac81b478e4e8a176e209c739c38d',
-            'table.css' => '8357d1c13919a34806d23fa2160a8064',
+            'table.css' => '4490a8d23537f43adc8431afbd87be33',
           ),
           'images' => 
           array (
@@ -492,6 +506,13 @@
             'table_row_props.gif' => '639bc7a8c034d99ab1cbef8f602f8aa8',
             'table_split_cells.gif' => 'aa2082cf1eb2e62eecda57fd2f986ab7',
           ),
+          'js' => 
+          array (
+            'cell.js' => 'd445d72fffdcbb12318d6019be4d1a53',
+            'merge_cells.js' => 'cd321e3350c013d4123ec52ea8ca6173',
+            'row.js' => '47978778bbc411d5dff43d1b437c4b70',
+            'table.js' => '4d836bff1b1f83c78581b1a19c54d6a1',
+          ),
           'jscripts' => 
           array (
             'cell.js' => 'df27f8a9de847dcc4b433960c72f99fa',
@@ -501,14 +522,14 @@
           ),
           'langs' => 
           array (
-            'en.js' => 'efb577fa33557c4f819d45f8be16ff20',
+            'en_dlg.js' => 'c1b41c798f4b9c6de38fdd28c9e7c2e2',
           ),
-          'cell.htm' => '19a425a22f5dc25f42e755ad38d3ba98',
-          'editor_plugin.js' => '21d04eeb64cf88af767f0641f1c360ee',
-          'editor_plugin_src.js' => 'aeac85b281a5aff98f76157bbbbfb3f0',
-          'merge_cells.htm' => '9470fcdf7575a48d499fdde3f20d8d5e',
-          'row.htm' => '7c8c219909be04d09bad3bfeb048c560',
-          'table.htm' => 'ec13d5c3ebb1e460e4a99de394664dc0',
+          'cell.htm' => '8897de52c93d9291d6b4312f6fa5b06f',
+          'editor_plugin.js' => '77d2afc9920cc9c46cbedf78e8f47b97',
+          'editor_plugin_src.js' => '81beb2553cc06be39b0fb88c5b4a3d93',
+          'merge_cells.htm' => 'e186ab851531e109edfe36463de1194c',
+          'row.htm' => '9c2f070ff15d6d76d86159c183432d44',
+          'table.htm' => 'd834be5d0d403f36ca024aee92454e6f',
         ),
         'zoom' => 
         array (
@@ -526,6 +547,28 @@
             'editor_popup.css' => 'e2c24b08b5fdb21ca55da439aa30564a',
             'editor_ui.css' => '5d74992a65ac983a065f7c3d3012779e',
           ),
+          'docs' => 
+          array (
+            'en' => 
+            array (
+              'images' => 
+              array (
+                'insert_anchor_window.gif' => '31ba68f936dfde5f280000f03f075a30',
+                'insert_image_window.gif' => '9ee69afeea6c1873588137837ce1382d',
+                'insert_link_window.gif' => '6fe4a492ca27b54d9a7c7c1f923455a9',
+                'insert_table_window.gif' => '6956617debd00b007292d2a365564eac',
+              ),
+              'about.htm' => '764466407de9a9a83452b9b3c86c60a0',
+              'common_buttons.htm' => '73dfa1decb7909ffb1ec0ebe13920ddd',
+              'create_accessible_content.htm' => 'd15201fd5783b7e9431862eabefb3a65',
+              'index.htm' => 'f9e5846d30636011991a2ffb0b5ef61b',
+              'insert_anchor_button.htm' => '489ef6dfa00d015274ab778a9b04b4e3',
+              'insert_image_button.htm' => 'f6d6048feacb971c22991c3b190c9918',
+              'insert_link_button.htm' => '14d85c7ae1b3a2b3137009b6ed8555ed',
+              'insert_table_button.htm' => '3510f97425d11f7b53cb6315afce90d0',
+              'style.css' => '82fb57bcdc42c11a367ea89a50038660',
+            ),
+          ),
           'images' => 
           array (
             'xp' => 
@@ -544,6 +587,7 @@
             'bold_es.gif' => 'eedfd6c0dc13c5db5054bd893ac92ca0',
             'bold_fr.gif' => '8fbda35d5ebfc1474f93f808953b1386',
             'bold_ru.gif' => 'c227dfb4b70957d31c240fd0fd9f55b6',
+            'bold_tw.gif' => 'c568a6c3d979acb4f6f96d86745aad7f',
             'browse.gif' => '2babc35c383abee1260e021dd87fd7a5',
             'bullist.gif' => 'f360470402affab13062de5ffbfb7f74',
             'button_menu.gif' => 'ed293e6a817f44328f74c0853c628e69',
@@ -570,6 +614,7 @@
             'italic_de_se.gif' => '2eafa516095a0d8b3cd03e7b8a4430f7',
             'italic_es.gif' => '61553fb992530dbbbad211eddcc66eb9',
             'italic_ru.gif' => 'bbc7be374d89a1ced0441287eeba297a',
+            'italic_tw.gif' => '0e673a64e0e502f8dac30c4a76af967b',
             'justifycenter.gif' => '652af6256deb0eeb781b0793ee4142f2',
             'justifyfull.gif' => '009750822e228e10f51e746ddf8d1fec',
             'justifyleft.gif' => '7e1153a270935427f7b61c7b6c21ab8a',
@@ -603,10 +648,26 @@
             'underline_es.gif' => '027608183023f80b0c9bf663c9e81301',
             'underline_fr.gif' => '027608183023f80b0c9bf663c9e81301',
             'underline_ru.gif' => '843cb1b52316024629bdc6adc665b918',
+            'underline_tw.gif' => '5be8c0f2086ce05c56f681775f1429f0',
             'undo.gif' => '7883b9e1f9bf0b860e77b904e1941591',
             'unlink.gif' => 'dcd93dd109c065562fe9f5d6f978a028',
             'visualaid.gif' => '491fbaab8d180fdd051cece94f2b8845',
           ),
+          'img' => 
+          array (
+            'colorpicker.jpg' => '35246246c8889992f3a2a42d501f8bfe',
+            'icons.gif' => '0709a7b61683ff5f347466cf14aa1f8e',
+          ),
+          'js' => 
+          array (
+            'about.js' => '7bf0a479da2e4c9a6cafda7626b98322',
+            'anchor.js' => '84df40a014548a495c806ff29688605d',
+            'charmap.js' => 'c2efdc6070e8d49ab61179d086512749',
+            'color_picker.js' => 'cd77c90f08f79f0653ea74efb104fdcf',
+            'image.js' => '466f1e7b127166b8bb865f5006d280b0',
+            'link.js' => '9dbd489e76753fb9f6ac65be0863117a',
+            'source_editor.js' => '9e10d96960c09241fef4ee2e0024411e',
+          ),
           'jscripts' => 
           array (
             'about.js' => '7168d330431da1d7c082c84df665a6f0',
@@ -619,53 +680,72 @@
           ),
           'langs' => 
           array (
-            'en.js' => 'd954dbe69d706823e7ce2acc99ca16c6',
+            'en.js' => 'f576640731578339d587b1b227d4449d',
+            'en_dlg.js' => '9e74c0e060e1a209644191c5b090d02b',
+          ),
+          'skins' => 
+          array (
+            'default' => 
+            array (
+              'img' => 
+              array (
+                'buttons.png' => 'f3b8decaa968630b3635b0d939d155cc',
+                'items.gif' => '5cb42865ce70a58d420786854fed4ae1',
+                'menu_arrow.gif' => 'e21752451a9d80e276fef7b602bdbdba',
+                'menu_check.gif' => 'c7d003885737f94768eecae49dcbca63',
+                'progress.gif' => '208a0e0f39c548fd938680b564ea3bd1',
+                'tabs.gif' => '47ef3b1cf81bd4cc7b27aed88af21533',
+              ),
+              'content.css' => 'fc86d84321a23cbd31f6936c3809eba2',
+              'dialog.css' => '71f6cefa23b6223e85d7bffcf0934412',
+              'ui.css' => '9bafd419c8ff293320e0d7b6c49cf24a',
+            ),
           ),
-          'about.htm' => 'fc2c574502ccf3e53fd00f52d9aa3869',
-          'anchor.htm' => '15ace71eb4c333034944ef7cfb1646d2',
-          'charmap.htm' => '9848d7254d4979ce94dfbdee055900ba',
-          'color_picker.htm' => 'c00bae115f05a96d5a561dd46cfb9fa4',
+          'about.htm' => '866230a747a5dc27812b6fc80f5edc6a',
+          'anchor.htm' => '89fc96bc71b8f51c409ebeef480b148a',
+          'charmap.htm' => 'c9f33a629f80fe46c4012dc17948576f',
+          'color_picker.htm' => '1cff74c461e5e659499dca809a20a02d',
           'editor_content.css' => '99f256c087e16872937f6cf9e4ea0c32',
           'editor_popup.css' => 'a2bbb5f95ba2d3422c1666222170d700',
-          'editor_template.js' => '34f49851a46c0c3f5f90929fb5a1260e',
-          'editor_template_src.js' => 'cd30e9a71b4422f62e370538a3b24dc4',
+          'editor_template.js' => 'e4f47b78c98d99433c91ec4a145f7ff5',
+          'editor_template_src.js' => '0b23a1d936587b11a71df98c27f09fc1',
           'editor_ui.css' => '62632779c868eddf46f3a8e121083d31',
-          'image.htm' => '4a2a0fe9cc33b4997f718b58af1be6ca',
-          'link.htm' => '8f96d1fee5e848c10bd1c73faf0b38a6',
-          'source_editor.htm' => '7b533802f9534af465bb276a2c318f35',
+          'image.htm' => '8453941b410a1a31f5d79e2ac8a41e0e',
+          'link.htm' => 'de02c48a8f1664f083bae483b57e4781',
+          'source_editor.htm' => 'a34324fc81ac5bdd3afc5f986dc3cd3f',
         ),
       ),
       'utils' => 
       array (
-        'editable_selects.js' => 'fafc283bd5b48b6cd188cf12856aac88',
-        'form_utils.js' => '74cf73cde95e530009a570facd900874',
+        'editable_selects.js' => '21d35147bc49d964207943b002741b71',
+        'form_utils.js' => '8368da1eed7cc3329705e6bae180dec7',
         'mclayer.js' => '1c7d5ff736bf571af7b1407758db937e',
-        'mctabs.js' => '70249b9a54761a08db2006afb99079a1',
-        'validate.js' => '50799f6a9ebc837f3d0345c4a42367bd',
+        'mctabs.js' => '6e6136492058c6604b825381dc3ee409',
+        'validate.js' => 'a19e8dfb6020378bf0f4e41bc6ba140f',
       ),
       'blank.htm' => '72406c871a9be7972922686221a885a2',
       'filelist.php' => '63d5fa62565bc100d3345de82ab36985',
       'index.html' => 'd41d8cd98f00b204e9800998ecf8427e',
-      'tiny_mce.js' => 'ae9f1a863b1d3686cf0c6ab0994acf2b',
+      'tiny_mce.js' => 'a2ab08e402c47c4745a9853cc813e3a7',
       'tiny_mce_gzip.php' => '846511eed428312feca1f0e5fec6cd91',
-      'tiny_mce_popup.js' => '0a5ce4187f9d2f58e36302d7d40bf3d2',
-      'tiny_mce_src.js' => '1a99b9dcd773d76df1fee42e072cb1a4',
-      'wysiwyg.php' => '4f59c0626c7e2030b7c5bdd7004d8cc3',
+      'tiny_mce_popup.js' => '6205d9cde4b1151ecf8ddcee6fe1c5fe',
+      'tiny_mce_src.js' => 'ef1de7b4cd52f8e2d91ad5c1c291e026',
+      'wysiwyg.php' => '5f33c86778ac867848d5dc252f1d1ea6',
     ),
     'admin_handler.php' => '2d593943e40bf02d5d46cf6b6af6b7e7',
     'admin_log_class.php' => '3cc96f21bcc7399e29c2b75d17fb2171',
     'arraystorage_class.php' => '4862b38926c8f68029c95d31990435a4',
     'avatar_handler.php' => '54c9f790d9f17e30f52b8011633d486c',
-    'bbcode_handler.php' => '53fae188dcfbc9496927fa4389d90ecc',
+    'bbcode_handler.php' => 'f67a6447b8b883db0abc7fb20a572eb1',
     'cache_handler.php' => '87bea235aa6d8e55f1268675b237ae43',
-    'comment_class.php' => '4ea051287540777754c6a4b9d719f26b',
-    'date_handler.php' => 'dc0f62d02024e515f5db56230882676f',
-    'db_debug_class.php' => 'c8536fce0bc77a01d9a97fef8327855b',
-    'debug_handler.php' => '9fa1acc69ef4cfc2593345c3866841d3',
+    'comment_class.php' => '85fc3b232366060f8cadd2ae31ae5fce',
+    'date_handler.php' => '35cd4c6db33032c31a3d1b622e0019ae',
+    'db_debug_class.php' => '143f5d3f5a3545e9f041470ba1c5398f',
+    'debug_handler.php' => 'f3f9d7859d53842492bf2b3c5009bb91',
     'e107_Compat_handler.php' => 'e76211b3178e4a9724933ecfe85ba8ea',
     'e107_class.php' => 'de0052a652261489b4b9609b3b70af6c',
-    'e_parse_class.php' => 'd1f95c2a6afb85a8aaa5f895214e4d29',
-    'emailprint_class.php' => 'c0dbe279de39cf512f5bcb6baa339ebb',
+    'e_parse_class.php' => 'fd67c8736895d13061299c83a5791a20',
+    'emailprint_class.php' => '7e364bbec69540e1087c19291d24e97a',
     'emote.php' => 'bbda3eafde2bb54c645194bf72dd47e3',
     'emote_filter.php' => '6348bb4a8adf203fccc2b5ecf4bff378',
     'encrypt_handler.php' => 'de4230eb5dc1541306a43f83b6a04671',
@@ -675,15 +755,15 @@
     'index.html' => 'd41d8cd98f00b204e9800998ecf8427e',
     'language_class.php' => 'c9486b41066040a84dbbe5c221f67b79',
     'level_handler.php' => '8ad6a092a84bef9c29912699b4a6263c',
-    'login.php' => '86cb41838f6e7a2afbcafefa7e7684d3',
+    'login.php' => '003872531cee56662cb0018fc5c655ee',
     'magpie_rss.php' => 'a04efb623cda4635cf46d9fe7c327d44',
     'mail.php' => '248bc747f9b99bd66acc3442b5c8d926',
     'mail_validation_class.php' => '75e722bf8c6975349ec402682323314e',
     'message_handler.php' => 'b6adb65802a3b790d7f8d0735a72364b',
-    'mysql_class.php' => '0fa3faf0fa129da9f26b30bf9517d985',
-    'news_class.php' => 'f38ba4ef117796455094cdb4952aa54c',
-    'notify_class.php' => '9f5603e38b5614ce9772bbde70a7eae2',
-    'np_class.php' => '68a8edcf50703e47e19f165c1a108a45',
+    'mysql_class.php' => '62b981a7b000a1ae33e28aebb4981178',
+    'news_class.php' => '6922663e75de2596a2662760f7f32c8c',
+    'notify_class.php' => '2d5c9ff51c06bddbdc21d80ff937e70c',
+    'np_class.php' => 'c094b25f1ad27fff15947d364c9709f2',
     'override_class.php' => 'a1f7451103a7fb47f3e541c31cf32343',
     'parser_functions.php' => '81daef0e484ee070d440e4ebc9bc8095',
     'parser_handler.php' => '650775595b663683a426c61dba6215cc',
@@ -695,29 +775,29 @@
     'plugin_class.php' => '6a6d576a19c6d751944dd36b4925f942',
     'pop3_class.php' => '3164abd686583e15f96901ab722cd272',
     'popup_handler.php' => '8915aa18adc4e69df003becaf508003d',
-    'pref_class.php' => '4d2d63ee3f969ee742d6b989863b11e7',
+    'pref_class.php' => '07f2ae7553c443ea4670abfb0ce23359',
     'preset_class.php' => 'a687add695b164e133e4c6375c5791fc',
     'profanity_filter.php' => '8287df29151f6bcb3b18b2230c85b45d',
-    'rate_class.php' => 'be7d6c95e9e702eddf6c93e0de6344e1',
+    'rate_class.php' => '797ca52a4635684f253215fd1f595d70',
     'ren_help.php' => '3669752caadf96c167ee0674b23d8296',
-    'resize_handler.php' => '1bf429885169500b77d3cdb2673fab04',
-    'search_class.php' => 'fe9c65c10349512b91164b8b67e724be',
+    'resize_handler.php' => '81c4ec905d4264437609d716226ca269',
+    'search_class.php' => '602ae9a9715b1fa9b04361bf10853e9b',
     'secure_img_handler.php' => '2cf9d9bb7616a5cc9d04d782a7bf8611',
     'secure_img_render.php' => '7364c99eec3f7881b7e4c0a10fc75cdf',
     'session_handler.php' => '54f987aa4f0f2a31c646d9e0f81cd061',
-    'shortcode_handler.php' => 'eba9ecc1e8a7d69e6914f8874271ff7d',
-    'sitelinks_class.php' => 'bb871c65344553d18e4f96a18e2c564e',
+    'shortcode_handler.php' => 'd7a00666489e6ae6ecfc57e9c5181206',
+    'sitelinks_class.php' => '538d7b083e4cb7f4c53aa72a5659ebdf',
     'smtp.php' => '71008c80b0a5e12faef990c0560f8226',
     'theme_handler.php' => '3a9a09ee4c47d1998d94ed0213b55020',
-    'traffic_class.php' => 'd9939fec7c60e3c8b95111dca22ce918',
+    'traffic_class.php' => 'b7cf43a2901e7e33e1c752d8d019fc8a',
     'traffic_class_display.php' => 'ab41779353db54ab54c6317f0464bae0',
     'upload_handler.php' => '7c0f8b9d913d54bbb9f59526dbc0a996',
     'user_extended_class.php' => '457b2971e01c3149e2c2a59a8b42ebda',
     'user_func.php' => 'bb871abafb6c91109c809afa9514afcc',
     'user_select_class.php' => 'd0ce7bea9522abbea48869734f8953ec',
-    'userclass_class.php' => 'd5af0c983c508edcfe587c7dbcf19210',
+    'userclass_class.php' => '2153be8f56417d0136b4fd01b80090e6',
     'usersession_class.php' => 'dcd6889bc9e8a11cba08fdd13f629615',
-    'xml_class.php' => 'e0ee6f1aec86b5416adc2725f35af285',
+    'xml_class.php' => 'f2c2995aac01ae6cc71a68f831b26d59',
   ),
   $coredir['images'] => 
   array (
@@ -1213,15 +1293,16 @@
           'users_extended.php' => 'b73f20ff4c7d9f9b9eae883b300b2426',
           'wmessage.php' => '5aa5f420a6b29adad555ef7e55bd932f',
         ),
-        'lan_admin.php' => '467d023763ab448026b168c1a0a16a1c',
+        'lan_admin.php' => '0c19f38956892b98193c09327bf87e17',
         'lan_admin_log.php' => '0f9dacdf93cb2d6a4145487de304cb87',
-        'lan_administrator.php' => '83b1eaead32e6c500d42a74c40b059a5',
-        'lan_banlist.php' => 'eab999e2192f8806d3c296a51ff7b304',
+        'lan_administrator.php' => '59f82614923f75fe228f3356c94a50b2',
+        'lan_banlist.php' => '4d598bd8a459d29905c29cc884ddc474',
         'lan_banner.php' => '576ae839e8066b9452bf413aa971dd48',
         'lan_cache.php' => '0926abdc99274d71157280c9d58749e0',
+        'lan_check_user.php' => '87025248016b1dd9b3bd592eb4a773a0',
         'lan_cpage.php' => '011e368a1d39d8bd1b95560289b1cb9e',
         'lan_credits.php' => 'aae0c491eb54b8c529013691755044a1',
-        'lan_db.php' => '74ecf348cdf654a125c7c9fd42a3aca2',
+        'lan_db.php' => '2b94a62f98ff069a9e81f644b3e3fece',
         'lan_db_verify.php' => 'f354b3a5832e4817bcb2171b2845047d',
         'lan_docs.php' => '9df02b4a6fafef4e9be2962bfeaed509',
         'lan_download.php' => 'e2b7224f4413ba3e8941f1ee1e2f8649',
@@ -1242,10 +1323,10 @@
         'lan_message.php' => 'bcfd03068e0ee9d76eb1a3df969bb544',
         'lan_meta.php' => '31801b3e9c137a3b22d58e5d80d291c8',
         'lan_modcomment.php' => '7f8738c7c0b3ab882f4b9c330136b6b3',
-        'lan_newspost.php' => 'ebe79009f612996ed1115d7fe063449e',
+        'lan_newspost.php' => 'd0b0582ef13530ea0c49d7f66df532db',
         'lan_notify.php' => '65a1a5a108c74ba8b2db5592c06a1ecd',
         'lan_plugin.php' => 'b1601f8c8075936fc4f204292c95cec9',
-        'lan_prefs.php' => 'fd91f2780e38d89c2bf8e2c68d98e80a',
+        'lan_prefs.php' => '8ba7fba8bb47c0c0dcaca5d3e73ed4f8',
         'lan_search.php' => '40348a80633b22b4013d2d21e623969c',
         'lan_theme.php' => '193c87b22b71daf4d434a672c873f96c',
         'lan_ugflag.php' => '29f0ad8c752be1bf98cc067534994711',
@@ -1254,20 +1335,20 @@
         'lan_userclass.php' => '4ea892222af2878ae303e6234545107c',
         'lan_userclass2.php' => 'e475c31e99b4867d9517705b584f5a44',
         'lan_userinfo.php' => '241d3c717696a30d97152aec8f5fcdf2',
-        'lan_users.php' => 'a41954c84f438a673df3c9c4cdc9601a',
+        'lan_users.php' => 'c2dc318e946267065b1f24cde8c1ca65',
         'lan_users_extended.php' => '01668b2029e05b10ed6cc14c71757d31',
         'lan_wmessage.php' => '27b96105500cdfa56bc27e391a0c2f3b',
       ),
-      'English.php' => 'd2c7712a5d818ec3f987c4d3961d1d1f',
+      'English.php' => 'b308a0b49ea43f5cd8b1c7d4b7bd595e',
       'lan_banner.php' => '92308af6029553992ebc4a46e97d4e1d',
       'lan_comment.php' => '7f872a8de759d8bba242e0c0214e3811',
-      'lan_contact.php' => 'f6ec02eb9a5effc567f8483071105e66',
+      'lan_contact.php' => '2eaaef23d2032b7ce690dba631ad29b2',
       'lan_date.php' => 'af33dd14b696babe19fd09e386c200c5',
       'lan_download.php' => 'a810798b7f71ba54f23f61fe5f6896eb',
       'lan_email.php' => '499e255fe29b037d49ea7b50fa679c09',
       'lan_error.php' => '9d5d4ac7a6672f0be9c83b06cebc8d16',
       'lan_fpw.php' => 'cb552bb8035414854363a77d844b194b',
-      'lan_installer.php' => '08806a3107735703ba7060b4757c77c4',
+      'lan_installer.php' => '56c0e1638370b88f328e027f56fb194b',
       'lan_login.php' => '3bf7ecb7c00be86b54c83370fab6f8c6',
       'lan_mail_handler.php' => '001b336311279c058df01c2ae04aa87d',
       'lan_membersonly.php' => '102bba47b482668bb433a5a607767bae',
@@ -1282,10 +1363,10 @@
       'lan_rate.php' => '02191b8a77011476d4e3e554387c01d5',
       'lan_ren_help.php' => '1ca40febf5f376f3dd7190f46cd26f02',
       'lan_search.php' => '60c1954cd9e67fe0ef3b7176978597cc',
-      'lan_signup.php' => '54ffcc9cba74b44e767b151e2f164daa',
+      'lan_signup.php' => '25a09dc7960ff0affd1ada6281cb0c90',
       'lan_sitedown.php' => '65c55fc812ceff72c4aba3f56dbaf4cc',
       'lan_sitelinks.php' => 'ca292ed1c514df28d693b3e8cdc6baec',
-      'lan_submitnews.php' => 'b07d8acc4221fc35ee5f655f2c8e55ce',
+      'lan_submitnews.php' => 'be072c62e26cacaeffebbf07031a2334',
       'lan_top.php' => 'eaf2c17d7c6e40e4e660e9a6dea851a1',
       'lan_upload.php' => '3e4225c2ee0fb49c9c6934bf68693c62',
       'lan_upload_handler.php' => 'b97489a3c1ce2d23ea0cb1310e6aa4e5',
@@ -1302,7 +1383,7 @@
   array (
     'admin_menu' => 
     array (
-      'admin_menu.php' => '12f13f429b068399d2aad7270c07a5c9',
+      'admin_menu.php' => 'c8c6702ee885e51aae6f6f3d46360ce2',
     ),
     'alt_auth' => 
     array (
@@ -1332,7 +1413,7 @@
     ),
     'alt_news' => 
     array (
-      'alt_news.php' => '67c4b14229bbb94f1ded6214e89216f1',
+      'alt_news.php' => '358ada97d61b6aa40e3bf00e59feaf37',
     ),
     'banner_menu' => 
     array (
@@ -1341,7 +1422,7 @@
         'English.php' => '34df03d8f502238bd6f3c8102f1fc399',
       ),
       'banner_menu.php' => '32329ab6e68ec3b1cc6ec89374f3b4d6',
-      'config.php' => 'b98411f3612b2c0dbf2ab1314f7ed663',
+      'config.php' => '031969acc0c80390f405d4d56548ddcb',
     ),
     'blogcalendar_menu' => 
     array (
@@ -1404,10 +1485,10 @@
       array (
         'search_parser.php' => '46ad148c6924dff0789cffa7240d895a',
       ),
-      'admin_config.php' => '637d77a1f80e4fc40d4772e285e52a82',
-      'calendar.php' => '75a8709d8089c63f7c277696010311b1',
+      'admin_config.php' => 'a1561d1cfc0cff6e5317dd58e7fe2946',
+      'calendar.php' => '384127d0d8b697614b1b477514b7828a',
       'calendar_menu.php' => '89fa2cc5825235633565c48682940e16',
-      'calendar_shortcodes.php' => '8caad7046186dc80c386a932cb485ff0',
+      'calendar_shortcodes.php' => 'ebaa618f412cf3bc5f86ace42d413933',
       'calendar_sql.php' => '39899457df794d8b56c58d3b1c8db88e',
       'calendar_template.php' => 'd852ceef7f6c8c10c5b10db571e16ccb',
       'e_list.php' => 'bc86836aabe7f01b4285d512a3079e9e',
@@ -1415,7 +1496,7 @@
       'e_rss.php' => '077b415bf70aaae7b8de3d55a5912632',
       'e_search.php' => 'a1681c6fed9972dd140b72b3ebfbd3c8',
       'ecal_class.php' => 'a1b10a8c8695f4cff9ed82e310825189',
-      'event.php' => '2ddb0bbb67a293ce9106cbe42c5c34ac',
+      'event.php' => '176f5d5c5d86d111205c7c07f3dde5c3',
       'index.html' => 'd41d8cd98f00b204e9800998ecf8427e',
       'next_event_menu.php' => '6d1819f703dc045efa0fd1a4041e6545',
       'plugin.php' => 'ba58d6517d948f30f27dcbd7d1c2026a',
@@ -1435,7 +1516,7 @@
       array (
         'English' => 
         array (
-          'English.php' => 'f7161fde06c16b7a4c08311f6d6c1f98',
+          'English.php' => 'd722afcab5159eec3878d8dff31f528f',
           'English_config.php' => '9adc5ef167b75da9ea343a3f0b1e07a7',
           'lan_chatbox_search.php' => 'cfe3e4e7191917199b79c85ae8b9f018',
         ),
@@ -1445,10 +1526,10 @@
         'search_advanced.php' => 'b7a8eab8e5969256ab578277c92d3c47',
         'search_parser.php' => 'c576ea7d07ce91c106c3bae38912237c',
       ),
-      'admin_chatbox.php' => '6f1214cbae4b9154a4c5e779b307fe44',
+      'admin_chatbox.php' => '7d76c868314e4b0a58f1dd39555f9602',
       'chat.php' => '9841a76774363747857756af2efa089a',
-      'chat_template.php' => 'cf97b7663cd4177f9c7ac299318ef8e5',
-      'chatbox_menu.php' => 'ebee41812c0f352176d5fddb640c0f8b',
+      'chat_template.php' => '14c2ebf62352cf10f2b0b83e100ae856',
+      'chatbox_menu.php' => '220560b75963403cec5df91632b2366f',
       'chatbox_sql.php' => 'aeb0d501ff23212e304f7f9a83d6926d',
       'e_list.php' => '11fde3fe8b58bec52bc6220053498509',
       'e_notify.php' => '379fbef832829bc4e9188b9fed62f31f',
@@ -1468,8 +1549,8 @@
         'English.php' => 'a6414a6871116b964cc12d77d72b2748',
       ),
       'clock.js' => '98871f097e7b77f981df163421edb721',
-      'clock_menu.php' => 'e0d33629ca46324479cf344eb2bdbdd8',
-      'config.php' => 'b5c6e83c7f9141ade22165ed62ed1884',
+      'clock_menu.php' => 'a35bc7bf53776a024a6960c3c9ee5026',
+      'config.php' => 'a5b370d4bf9a79d523163f9e4342da03',
     ),
     'comment_menu' => 
     array (
@@ -1478,7 +1559,7 @@
         'English.php' => '10c5f9fd588de9eaa9bf96b42b11b535',
       ),
       'comment_menu.php' => 'd3991926641aecf015f1acd6a3baeda6',
-      'comment_menu_shortcodes.php' => '5235639944dc6888113f4615c595ae5d',
+      'comment_menu_shortcodes.php' => '4c9b1835a7e9ef640fd708ce1fe09e82',
       'comment_menu_template.php' => '17f0cb0b44f43d0cf62770f2b7cb4526',
       'config.php' => 'd8e5bd9258392c98d02009d552401aa4',
     ),
@@ -1499,7 +1580,7 @@
     array (
       'handlers' => 
       array (
-        'content_class.php' => '4400a94a9eb69518387405b6ad2682d5',
+        'content_class.php' => '2c19037a14a9f63c772f0acb1bb65aa4',
         'content_convert_class.php' => '2e05d94418f8960eaac431741ce402a1',
         'content_db_class.php' => '5274299167623166e2f573af85f0f614',
         'content_defines.php' => '784711a6c68dc17c7752fb084400229c',
@@ -1597,7 +1678,7 @@
       array (
         'search_advanced.php' => 'c6c6ae35cd1020d27a861ac693347560',
         'search_comments.php' => '34b14edbe1d2e8fbac541dc03262b21d',
-        'search_parser.php' => '1dd7a7f04aba6ae80cbd2d74457040f1',
+        'search_parser.php' => '3fe4485e89f9addf78d48d1797a44948',
       ),
       'templates' => 
       array (
@@ -1623,16 +1704,17 @@
       ),
       'admin_content_config.php' => '5eaadc48ca7f9d18cfcbba35937e778e',
       'content.js' => 'd41d8cd98f00b204e9800998ecf8427e',
-      'content.php' => '880cecd68d540867ed079d1aa7d848d4',
+      'content.php' => '5fea84528fc95622b37bd2bc2d67bd5c',
       'content_manager.php' => 'f05358be1e9f851366e6483a5c1fce9f',
-      'content_shortcodes.php' => '96a10b5cbb7f7f37d7fbcf147f5b2969',
+      'content_shortcodes.php' => 'b8292c1d2dbcf9cc3cb9e073b8e1cc00',
       'content_sql.php' => '2632a603dd04ed62bbb3f011d3c5de41',
       'content_submit.php' => '15c56c828ea76a15aff7f020c0806d8f',
       'content_update.php' => '3820d50a8de13fe523bc58e949229e67',
       'content_update_check.php' => '83b6aa48eb79b70555f5d2d578baa07d',
       'e_comment.php' => 'd1f4f87a428c69c499818721d0f48331',
       'e_emailprint.php' => '48572a480656347a64798b024168a7f1',
-      'e_frontpage.php' => '4fee2ac77b9c66c1d5b760b95e6ea255',
+      'e_frontpage.php' => 'fe4139040c268b13517b9a78fa35f190',
+      'e_help.php' => '950985bb6c445147d901bb4fb00b0f1d',
       'e_latest.php' => 'dad7101dbd2063723e94300723e67c2e',
       'e_list.php' => '1e789a60e65a1273d9e89330285e90d2',
       'e_meta.php' => 'cbb645eebdedb216511c413fe64991a8',
@@ -1640,8 +1722,7 @@
       'e_rss.php' => '76954b881d598f26ecaebb4422f87696',
       'e_search.php' => 'd86c2f562c466bd7200974bd16f07c45',
       'e_status.php' => 'cf12158206b16c94292788fb9771c478',
-      'help.php' => '950985bb6c445147d901bb4fb00b0f1d',
-      'plugin.php' => 'cfb9004ff38e24cb87370ceb9017867f',
+      'plugin.php' => '56bdd9e6d08541f0a9c79d512888503e',
     ),
     'counter_menu' => 
     array (
@@ -1670,7 +1751,7 @@
       'admin_config.php' => '773de81a3c2d8bdbb714e280277500ec',
       'e_rss.php' => 'e3b277cca6f5262dcee948434aacfc5e',
       'featurebox.php' => '58326f62f0251b8660d3040097cdd958',
-      'plugin.php' => '47e04d81450fac857afde4570ae883e3',
+      'plugin.php' => 'fc39d7f490fbd654cdccc71671b566be',
     ),
     'forum' => 
     array (
@@ -1791,11 +1872,11 @@
       array (
         'English' => 
         array (
-          'lan_forum.php' => '9875770dea852891260e131cd6f07882',
-          'lan_forum_admin.php' => 'd4689a6f1c8ce14fa4172eaa86508c56',
+          'lan_forum.php' => 'ea936a869c140d39814f088684a4a766',
+          'lan_forum_admin.php' => '80ba85f9c367e339326a3e7af081b153',
           'lan_forum_conf.php' => '44f0d7ca6da7d71004e1acd9c1f04f70',
           'lan_forum_frontpage.php' => '5ac941c384cf10a76b6ab040f7ee7986',
-          'lan_forum_post.php' => '369a256d811d2a36f9a49448c7ee3cc1',
+          'lan_forum_post.php' => 'cd71dea8ee31042d1934fd3b80807d9c',
           'lan_forum_search.php' => 'dd1263ff01cf0b71991de16756677f68',
           'lan_forum_stats.php' => 'ecccb2b57c568336e5b1accfa29ad08b',
           'lan_forum_uploads.php' => '840b741edd3f2d8fcc340b29804689b5',
@@ -1811,7 +1892,7 @@
       ),
       'templates' => 
       array (
-        'forum_icons_template.php' => '7a1550fd2f17636cdfd257e6a3c5708a',
+        'forum_icons_template.php' => '388dfeacbaba25a81cc21f7d4963ad8f',
         'forum_post_template.php' => 'f1017fb9b9ae6c73691d27b4da2d8cd3',
         'forum_posted_template.php' => 'd0790156815c4f32a794becbe68da4cc',
         'forum_preview_template.php' => '11b636f1bcccded162fcf42880df5b5d',
@@ -1820,7 +1901,7 @@
         'forum_viewtopic_template.php' => '86bb9e4bb1cb15c4f311783899e736a4',
       ),
       'e_emailprint.php' => '8a41fe10faf7c2293a65bd66e598dd82',
-      'e_frontpage.php' => 'c939394e051b055ccbc963d17b1a1d46',
+      'e_frontpage.php' => '47fc49f7f27140d518eb73932b6023c6',
       'e_latest.php' => 'ba485c38b9ab90c0f572a2397b49c9f5',
       'e_linkgen.php' => '3184982dc3f9321a1d85df7cc41acf70',
       'e_list.php' => '523f01012192923c6901b7c088101ec0',
@@ -1828,15 +1909,15 @@
       'e_search.php' => '663a93cb1f0d05351ecbb85a3bf721d4',
       'e_status.php' => 'e707e64a960612d443e16906faaf0e22',
       'forum.php' => '0bd4c27751efefb21188c3b483a822a7',
-      'forum_admin.php' => '17d086b87f55405546d2db805ed95598',
-      'forum_class.php' => '8a96c3ca35232aff5bc339c6bf0d2ec4',
-      'forum_conf.php' => '6cacab70081de88058215040494143b8',
-      'forum_mod.php' => 'edd98521f3e8c94534c72b39bbc131ee',
-      'forum_post.php' => '162565c1e4c4d90014a4f600ea73fe1a',
+      'forum_admin.php' => 'bcc90af18bfeb211562007d667f3f80c',
+      'forum_class.php' => '61090373b95e4863d6c77cb136996378',
+      'forum_conf.php' => 'dbb20dfde501333fb794b1925d981416',
+      'forum_mod.php' => '1071403b53a79f9122e711658c525a33',
+      'forum_post.php' => 'b545afc689403e19d7b0bcbacd57e260',
       'forum_post_shortcodes.php' => '58d0390a6fa95d713603a203025eb3f2',
       'forum_shortcodes.php' => 'dce37f018fa3be3a2bb67c740fe4725f',
       'forum_sql.php' => '3355b8219c200d8d669ce08e59053465',
-      'forum_stats.php' => '066d34a6f39fb18ff4e76e444375ace2',
+      'forum_stats.php' => '469ac229ea060727f3615e001f16a58f',
       'forum_test.php' => 'ed668e3268952cb268b3f4aca0d2e37a',
       'forum_update.php' => '8e1fed1bae66e84eb3ad0235a60f0c69',
       'forum_update_check.php' => '95b6355554098357b5648807c4e95705',
@@ -1844,9 +1925,9 @@
       'forum_viewforum.php' => '2f35f7cafbc651fe80991d4b7c83c1ed',
       'forum_viewtopic.php' => 'ab460e959ba4523374375e92abebb874',
       'index.php' => '1d225ecdb6dfb425fcdd39501ed196c7',
-      'newforumposts_menu.php' => 'd6ac5152213f6c6f4448a10f9a3d5acf',
+      'newforumposts_menu.php' => '986abfe5b636e93afdb1e50b57df2ebf',
       'newforumposts_menu_config.php' => '264e2763fdd9f384af958c3d76272a5e',
-      'plugin.php' => '871a97116e50c74039db5f2e3c96d040',
+      'plugin.php' => 'f0d1b3a504ce7ca5f93e7f905f2a52cc',
     ),
     'gsitemap' => 
     array (
@@ -1875,7 +1956,7 @@
       array (
         'English.php' => 'd78c5a1f0cd1dafde8fe3bf33083db1e',
       ),
-      'admin_integrity_check.php' => 'fc38aac66a949bc1737ccd86b5c4b569',
+      'admin_integrity_check.php' => '99eeeea29f99c039499dfcecb9ed722d',
       'plugin.php' => 'b32f26e2fc819c93a60a0c53692888fa',
     ),
     'lastseen' => 
@@ -1916,21 +1997,21 @@
       'admin_linkspage_config.php' => '5576e1a0eee8984ad5909d901e481b30',
       'e_comment.php' => '13b0aa38e21d08a535276a7526cedde2',
       'e_frontpage.php' => '0a352c2a0b559b9d930943f1928f9d45',
+      'e_help.php' => 'a8495b50a8243ebbb3e37c8bcb169184',
       'e_latest.php' => '68bacd178e137861748385080b253ee4',
       'e_list.php' => '41486a930bbaf136d0a371c3201aa0e6',
       'e_notify.php' => 'eab13b015f9b5fa679fef28f63d72dde',
       'e_rss.php' => 'd213cc9cc0d5eeed3442b861e565961e',
       'e_search.php' => '7a7416dde4bc42481cf92431f4832b65',
       'e_status.php' => 'e1b28e610e6f89277440430a2f8747d8',
-      'help.php' => 'a8495b50a8243ebbb3e37c8bcb169184',
-      'link_class.php' => 'c875574f710f73ce342b3f93defa010c',
+      'link_class.php' => '2131e50627f2a37c1de6e83b2d7cc5e5',
       'link_defines.php' => '1c9c8a4d29cac5f35e2164805bb3eca6',
-      'link_menu.php' => '3520965348d79de448646454ddb04565',
-      'link_shortcodes.php' => 'e7c72490ab6613732109aa5bbff0a8da',
-      'links.php' => '5356018b46c6985c3d570b96a532c7d1',
+      'link_menu.php' => 'db5245c494ebbf51adf0b2d7deafcd87',
+      'link_shortcodes.php' => '0f5e9fd5e457177a51096a5952c3a15a',
+      'links.php' => '6eaaf2b65b6548aacae52b8eae58083c',
       'links_page_sql.php' => 'ebe16a35037a69b93eaa929782ca66ba',
       'links_template.php' => '01f0789358ececda57e350844c5257eb',
-      'plugin.php' => 'b05df4d36293f4c2e2b949b3006cc712',
+      'plugin.php' => '2a230e6fe081f8b5fac05a7765645acf',
     ),
     'linkwords' => 
     array (
@@ -1943,10 +2024,10 @@
       array (
         'English.php' => 'b135d2e84df7694ff086d7715eb2898e',
       ),
-      'admin_config.php' => 'fc16dfe98e95a1a80669ef9ec6d67899',
+      'admin_config.php' => 'cb84391b8ca88ca95f50481e1427a901',
       'linkwords.php' => '3fdd194464d07cd1ccbbeca79732a2c6',
       'linkwords_sql.php' => '33f4d40e8da9aa758c512d4847f6d5d7',
-      'plugin.php' => 'eff85c9026041473b4fb5cc355ef51ad',
+      'plugin.php' => '8631be6ef1536b1aa9e29cdea7ff7062',
     ),
     'list_new' => 
     array (
@@ -1981,10 +2062,10 @@
         'list_news.php' => '7faa1d6728ff1e692aa834ac4027c4e0',
       ),
       'admin_list_config.php' => 'ca675031ff789bcf4f75e9ce98d86b87',
-      'list.php' => '40e2923674835fe1c404219d164e7a92',
-      'list_class.php' => '1c3fc99f62bf6d5e1d48ac8ccec83128',
-      'list_new_menu.php' => 'b130b1aeb94b0c494dc77f6c58c7a19c',
-      'list_recent_menu.php' => 'a8cffc271ef0637df899195561e07cb4',
+      'list.php' => 'e26c96ef49382d150baa604c67efce6b',
+      'list_class.php' => '10b1f9d2874439afa88e9db4d8d1ec7e',
+      'list_new_menu.php' => '3725d617fb04202bf88aed0c02f01718',
+      'list_recent_menu.php' => '3865fe5b56a591c102a2192dd0094a5b',
       'list_shortcodes.php' => '1c4972d09e83f1945c6652126bba6248',
       'list_template.php' => 'ca73750411b19f1b8df71c5111fe1789',
       'plugin.php' => '9eb14ccec83d20559b387b9c332a6d23',
@@ -2096,8 +2177,8 @@
       'log_update.php' => '619bea78d9c76a1ec0cd4c44eeda36c5',
       'log_update_check.php' => 'f4e7f5fb3767e4c19adae8cb5e41e62c',
       'loginfo.php' => '854e51cd364a5f34bbb98559a1d997a5',
-      'plugin.php' => '5809c35fd538c5326ebe6e1876de72c4',
-      'stats.php' => '184029922a97ff943b98de23cc796bb9',
+      'plugin.php' => '68060de28e330695a727e7b718a31fb6',
+      'stats.php' => '67166ee596b2c4553e000a04a44113e1',
     ),
     'login_menu' => 
     array (
@@ -2106,8 +2187,8 @@
         'English.php' => '3be9768e81217f108c055cff9f15c8d5',
       ),
       'config.php' => '5f0c8229c96c4d4cf5a806bfc8d1a1c4',
-      'login_menu.php' => 'f666063fe9ec095244f2f0366511cf06',
-      'login_menu_shortcodes.php' => '8eab22364c2413bd5957406cca4dabf3',
+      'login_menu.php' => '14c9f12699735e3ed08594251271d3a3',
+      'login_menu_shortcodes.php' => 'e7b67b1a732e9b0e15a0d36f4834f3f0',
       'login_menu_template.php' => '88e210369bd4f7ba640e0008b274d782',
     ),
     'newforumposts_main' => 
@@ -2145,12 +2226,12 @@
         'newsfeed_template.php' => '5cc2377bbc4251eb511c6f16bde69765',
       ),
       'admin_config.php' => 'f91744a0ceedba0fe0e7fe85c2fa0e5a',
-      'e_frontpage.php' => '2a8967b05bef4a2eb6b771ca44e6bf01',
-      'help.php' => '7942458e34eb69cdad92cc7d9454f626',
-      'newsfeed.php' => '1c8d283cb9b5abceabf9df4752d96dc6',
+      'e_frontpage.php' => 'e382f0f562128593eb6f92ec404fa6e3',
+      'e_help.php' => 'b57bf2aabec1cdef5fe4cace4ddf9925',
+      'newsfeed.php' => '6ff26c036db3dc4cc05c627b0dc1885c',
       'newsfeed_functions.php' => '711f0b7e516bb728a64c1aca2cc3e14d',
       'newsfeed_menu.php' => 'c6719765d152055b42afd2e9ae7b55e5',
-      'plugin.php' => '9518316c3bbd37326a4c1383ae1d550d',
+      'plugin.php' => '8bf9d6dabb5bca722ca9eeb84f50e422',
     ),
     'newsletter' => 
     array (
@@ -2163,9 +2244,9 @@
       array (
         'English.php' => 'dbf0f956c851ae529fd3bb4c04fbe29f',
       ),
-      'admin_config.php' => 'd11d3be81f37367ea36d146590cf5fc3',
+      'admin_config.php' => '1bcb9fc735526f1dde5e935184f65531',
       'newsletter_menu.php' => 'f8b8ab30443dea6a8dbb2e27c17799d6',
-      'plugin.php' => '5c491459a08ab61854fb5a8f56230f66',
+      'plugin.php' => '02279964dd6e87fb621964eb7d84a028',
     ),
     'online_extended_menu' => 
     array (
@@ -2193,8 +2274,8 @@
       array (
         'English.php' => 'b04593965071e6f5bd46286fadcec456',
       ),
-      'other_news2_menu.php' => '0bbd3ae78d234000ac84adb5f5d04195',
-      'other_news_menu.php' => 'f51dfcfb4bb737285af7b824aa1342d4',
+      'other_news2_menu.php' => '0352906638ff3924a0b035108e829ff4',
+      'other_news_menu.php' => '22df4f4fc1c30c6e079c9bbc0105dfdc',
     ),
     'pdf' => 
     array (
@@ -2285,19 +2366,19 @@
       ),
       'index.html' => 'd41d8cd98f00b204e9800998ecf8427e',
       'plugin.php' => 'c89f4e634476ef16447a5375f39ce495',
-      'pm.php' => '6bcd6f653fcc1a94dc2efe432554ffd3',
+      'pm.php' => 'c390585267c8b8e6ea965890860a6614',
       'pm_class.php' => 'ef6f751b872acc6ea1994af7af67adba',
-      'pm_conf.php' => '814f47b30db1aa07075469c0d1bcc4c0',
+      'pm_conf.php' => '06968bbec9d62e6dd85bff321d8d281f',
       'pm_default.php' => '0213fb9bcfe60d37041f44136727649b',
       'pm_func.php' => '61f9aea908d41a5d23a791efe67ac0ac',
       'pm_notes.txt' => 'df26332907da1f35c4731d8893aea23e',
-      'pm_shortcodes.php' => 'd1724a0b4d71996bf47758db99aed5dd',
+      'pm_shortcodes.php' => '69208fe4b9226991925074eb99bb6253',
       'pm_sql.php' => '4608486c1027c6485dc32674fd536dc5',
-      'pm_template.php' => 'd2a1f25ec59536d6f9744f203bda98a7',
-      'pm_update.php' => 'e66fc6610e273471a212471e07598710',
+      'pm_template.php' => '082f8cb6a6298ce46a5ab2d3284ffd74',
+      'pm_update.php' => 'cb5624f01693633d7509c2b47a91ae20',
       'pm_update_check.php' => 'a5b341b5373844cdfc1f961fb3d3151f',
       'private_msg_menu.php' => 'c672e6f4be8aa79896f873fdd0eff9f3',
-      'sendpm.sc' => '6318c4f90564ce0bbd87a3e16c03c30b',
+      'sendpm.sc' => '8da5535f878725ca446739cef48fc9e5',
     ),
     'poll' => 
     array (
@@ -2322,11 +2403,11 @@
         'poll_template.php' => '0c83f7e4984e9a0b8bbc196262cc650f',
       ),
       'admin_config.php' => 'eeea52c7fab3125610a8e3903c0be8c9',
-      'oldpolls.php' => '4a873e55c457ae529acb447b28e06780',
+      'oldpolls.php' => '27b1f706fd71bb52bf3f9f1e2eb0e155',
       'plugin.php' => 'f68c44986bf5d097e3901f220726530b',
       'poll.php' => 'b51353ac9b1d4f9664b954d528644547',
-      'poll_class.php' => '8b8e8ff6ac10b6edd85b82104b880c29',
-      'poll_menu.php' => '002a59a4cfa6b2036a0ae0e5abf34051',
+      'poll_class.php' => 'ea623ef543f015e80366cbd1578dd972',
+      'poll_menu.php' => '7b6e54ab4249b6869254706a464bdf82',
       'poll_sql.php' => 'ffe53748dbd1504f7c4204027814064a',
     ),
     'powered_by_menu' => 
@@ -2355,7 +2436,7 @@
       'admin_prefs.php' => '511047205732e1f3a5098052e3a2eb4e',
       'e_meta.php' => 'af7e8b4a56e0d4cbb7a469dea4b86f9c',
       'plugin.php' => '46b1e37c9d18e6872083425afb3115fa',
-      'rss.php' => 'ab053cb91633c1fc8c5259c77f07a716',
+      'rss.php' => '28a7c3dcbe256b4f4893f3d8877c4b1f',
       'rss_menu.php' => '1be0ce84109cbbbcdadf68cc93fb5c20',
       'rss_shortcodes.php' => '5e842cc4bcb5262055b7bf4d9aa57f55',
       'rss_sql.php' => 'efee18037cab9fbf35cdf81f97efc2a3',
@@ -2393,7 +2474,7 @@
       array (
         'English.php' => 'e482c4c1b04b71a713e8aa21cb4b047c',
       ),
-      'admin_config.php' => '33cdfe877fe26c13f06e973e23d076d1',
+      'admin_config.php' => '79723322e61b09e8def954e65ee22b80',
       'e_meta.php' => 'f773d59990b39abd93a8a18f676d5770',
       'modtrackback.php' => 'bf17b7ad8dd20905d3188a564c20ac59',
       'plugin.php' => 'faaf0e70297414b7f61db1a8f030a02c',
@@ -2406,7 +2487,7 @@
       array (
         'English.php' => 'be4478e772ee1e1189a57284891582d8',
       ),
-      'config.php' => 'a78276d858ff5dcaf1980939ea0d9578',
+      'config.php' => '38a8c6ac8cbefa0c72616a0823e22090',
       'tree_menu.php' => 'd900170e1e56cf3b74933bd4b9486c8a',
     ),
     'userlanguage_menu' => 
@@ -2415,7 +2496,7 @@
       array (
         'English.php' => '11eb945ea792024fc2ecd881d77781d7',
       ),
-      'userlanguage_menu.php' => 'abd699d94fcb5a8d37054b5a151360e8',
+      'userlanguage_menu.php' => '4a7e90d9314e9893f32deeb30da2b32d',
     ),
     'usertheme_menu' => 
     array (
@@ -2423,7 +2504,7 @@
       array (
         'English.php' => 'cee12f306f38b237a4ee461a1346db5c',
       ),
-      'config.php' => '7db2c64207a4b30840ed8e29b45cd124',
+      'config.php' => '8871c5dab8925f4da3d71495fc1640c0',
       'usertheme_menu.php' => '82bfb26abe99afca396c1b2861d6d895',
     ),
     'index.html' => 'd41d8cd98f00b204e9800998ecf8427e',
@@ -2447,7 +2528,7 @@
       'index.html' => 'd41d8cd98f00b204e9800998ecf8427e',
       'preview.jpg' => 'b841409838526ba769866861bf236100',
       'style.css' => 'ea3af6647ce3d7ed62c5a973b8a2a7bb',
-      'theme.php' => '9f63c8aa0ff3f0e6ab07c89a8bb7bd08',
+      'theme.php' => '4e4bf84efb0abd26c280ef9b232fb32f',
     ),
     'e107v4a' => 
     array (
@@ -2494,7 +2575,7 @@
       'index.html' => 'd41d8cd98f00b204e9800998ecf8427e',
       'newsfeed_template.php' => 'bf35ae0a44194fb397c9816bd81c7522',
       'preview.jpg' => '1f1e5815a674ceb1eaa562caa0e23607',
-      'style.css' => '31dbd50ef3ff04150146f4b618c18385',
+      'style.css' => '18850902efe5f0feb78f6b1841639ffc',
       'theme.php' => 'ae959d0742632c6b95373b34f2a7f69a',
     ),
     'human_condition' => 
@@ -2517,8 +2598,8 @@
       'index.html' => 'd41d8cd98f00b204e9800998ecf8427e',
       'newforumpost.php' => '6a9cd60b76c00cd41384f21ce1265860',
       'preview.jpg' => '37766edab6519ba0d82d89d0fad9b9df',
-      'style.css' => '98b43a380766349d489c4bdc3ea69eff',
-      'theme.php' => 'a17c960a480eaee833aa500e819d6072',
+      'style.css' => '77b477d84c413fa5f3412fb28137b533',
+      'theme.php' => '9a1b355a8ee65e25e102d4506918b8ce',
     ),
     'interfectus' => 
     array (
@@ -2562,7 +2643,7 @@
       'index.html' => 'd41d8cd98f00b204e9800998ecf8427e',
       'preview.jpg' => 'a4b48f473468c22cb5f03054eda08794',
       'style.css' => 'bb2e6303ad7fed8a1119fd08b7bd11e8',
-      'theme.php' => '18a3f6c6802b51f8d98626190b27c494',
+      'theme.php' => '191a6471dcbce4810e803762d0af717c',
     ),
     'jayya' => 
     array (
@@ -2587,7 +2668,7 @@
         'fcap2.png' => '0a733fe6e51713f13276eec753da2d9c',
         'fcap2orig.png' => '5f6f45697bc185d51f2c06d904642aad',
         'finfobar.png' => '71585c0c2d3340ece8cf769a135286b9',
-        'forum_icons_template.php' => '5be0c43f7e4beadd660d02467905f626',
+        'forum_icons_template.php' => 'd215f2602ae462ae4e1e2554b132ab0d',
         'main_admin.png' => '4033115a6d4c622f16e23c7d82bc1bd9',
         'moderator.png' => 'd3100a24d0bf141c8d3e5445d24b712a',
         'new.png' => 'f80e5840a07b08c9502af386b9c6c928',
@@ -2642,7 +2723,7 @@
       array (
         'English.php' => 'a17223b305835b22475b0cd9ada9c367',
       ),
-      'admin_template.php' => 'd62d017059658f2ed757b7b00809cae7',
+      'admin_template.php' => 'ca62e31cee0cb47fd3717de408938c5c',
       'canvas.css' => 'acdfee6441e3dc292657ca469b669df4',
       'index.html' => 'd41d8cd98f00b204e9800998ecf8427e',
       'nav_menu.css' => 'ac9d2df99166eb5ce87c16bb146bc413',
@@ -2697,7 +2778,7 @@
       'poll_template.php' => 'c01388206c3cf373ff04e01c38485d99',
       'preview.png' => 'b164565b63d086a6a5a28fd76097487c',
       'style.css' => 'be699284eb74ccbd6543eac6f60754ea',
-      'theme.php' => '97855abc56b4772669264f233c9611d9',
+      'theme.php' => '7677cfd9619f4ead59e389a96772a76f',
     ),
     'kubrick' => 
     array (
@@ -2716,13 +2797,13 @@
       ),
       'languages' => 
       array (
-        'English.php' => '29e32afa6cb7251090bed09b73521875',
+        'English.php' => 'eede6c4b32123ccd2f16f780bddbdf09',
       ),
       'index.html' => 'd41d8cd98f00b204e9800998ecf8427e',
       'preview.jpg' => 'cb94c52db72d1ba8bd4d1e08ee41cbfb',
       'style.css' => '0f93072e98199ac87d3d2957cda402b9',
       'theme.js' => '092a48b0a95fcb44c48236c40948eb13',
-      'theme.php' => 'd87f3c2136ed889cfe6741c4167490ca',
+      'theme.php' => 'b73b0c65f350b82747cfc08f109c1cdf',
       'ul.sc' => 'd06064877926df43530b0039a4a30069',
     ),
     'lamb' => 
@@ -2754,9 +2835,9 @@
       ),
       'languages' => 
       array (
-        'English.php' => '9d1ea4ad30dea8e0d9992c25cd108773',
+        'English.php' => '06d4f73534ddd32a49a0496849e1007e',
       ),
-      'alt_style.css' => 'e9ee5679b9218c1c7d89c98c2f95b701',
+      'alt_style.css' => '35aa4c44b4194a12623da7c9a107d21b',
       'alt_theme.php' => '09fc4de57c31e85eac390e643d401ed7',
       'chat_template.php' => '8a57696d7ecb512823073c64768c8ed7',
       'download_template.php' => 'b6e968dc3f6d17d161b0105b67ae2903',
@@ -2771,7 +2852,7 @@
       'news_template.php' => '0f5b689c4ad3d212934707f44b959b11',
       'preview.jpg' => '184658c1d2222cd0137cc445fcc785ea',
       'style.css' => '475d1badb0a770d6da07c350ffd6dcb7',
-      'theme.php' => '62adf3ecacca0967dd85ffa2c6160c2f',
+      'theme.php' => 'c14351121ad7434daa47855bc27dbfd6',
     ),
     'leaf' => 
     array (
@@ -2823,9 +2904,9 @@
       'index.html' => 'd41d8cd98f00b204e9800998ecf8427e',
       'links.sc' => 'a3f5d8fa1e9e14c1b6cc27b06c7754fc',
       'preview.png' => '804c22db1f71223d10e6f7b8b85f69a9',
-      'style.css' => 'e7392ac143d7daa82882e906b5413c31',
+      'style.css' => 'a54048b5029e3711fdbe23ef3abb9f05',
       'theme.js' => '16285b5ba2631979457e5e2ec1cf10af',
-      'theme.php' => '07f4075ab49042785a57acf28764b9a9',
+      'theme.php' => '4b82716fce8b8d1033751760ee2a3237',
       'ul.sc' => '40e66ba9fbd2f99d59b9f7f9ba55256c',
     ),
     'newsroom' => 
@@ -2880,13 +2961,13 @@
         'English.php' => '3288884b05004a91af4802cb7e2098a2',
       ),
       'admin_style.css' => '7850d3c2db60fb1e649a6eb6201cfc11',
-      'admin_template.php' => '92c8ff5fde3790dbcfc895c52c7dc3d0',
+      'admin_template.php' => '2d58509103d7eb1518ef66d79313898e',
       'cube.sc' => 'f85e6d1f10ab3372ec7ebdb0548651ad',
       'full_width.css' => 'f806f549c1200131c4c043db72408da7',
       'index.html' => 'd41d8cd98f00b204e9800998ecf8427e',
       'preview.jpg' => '30da9e1ef04e5f1fef38ae3d23e0f3c4',
       'style.css' => 'aa2df8aa8519c802f10e3eddfd95aed3',
-      'theme.php' => 'e60a37f11fe588039350405f03e3252a',
+      'theme.php' => '3059590886e9a8549a3eab7f7fdccf7e',
     ),
     'sebes' => 
     array (
@@ -2908,25 +2989,25 @@
       ),
       'languages' => 
       array (
-        'English.php' => '886394355713facf26c16e029a2b9d7b',
+        'English.php' => '448656c4129566642e111f27fc9e57f0',
       ),
       'index.html' => 'd41d8cd98f00b204e9800998ecf8427e',
       'preview.jpg' => 'a9e7139c84a52e4b164c460a6428b317',
       'style.css' => '2520113be12170cc926299ac4ece598d',
-      'theme.php' => 'f8959c9374250d4ae616c1ad958992c7',
+      'theme.php' => 'ad94b996cd9672fb3a65fcba6ebff121',
     ),
     'templates' => 
     array (
-      'admin_template.php' => 'aedfda791297d2d2301ca3c2d14b9d7c',
+      'admin_template.php' => '2852767e150181d896f2dc30a08466ff',
       'banner_template.php' => '58c9cb82186cc85b7a1af8398c6b888b',
       'bbcode_template.php' => '884969ebee7a4a328a88f308f04c7822',
       'comment_template.php' => 'be07b00f84a5fbbeeef3ad557294700d',
-      'contact_template.php' => 'beee7004f0235889e55c69d2472d7779',
+      'contact_template.php' => '594ca4a1e569214733cf5d584c79eea0',
       'download_template.php' => '5681bcd3468ce80571394a0a68fb0926',
-      'email_template.php' => 'cc12dc6238aa47bf50f915a1a114a858',
-      'footer_default.php' => '633f17fe5dbb3865de99b9e65eecc190',
+      'email_template.php' => 'bcab5cc478a5c82bb71f35926dab72fd',
+      'footer_default.php' => 'b5f07579a97a22b63bcdc500f0724c13',
       'fpw_template.php' => '326abf6c01f19246a9ebe07e64d07ead',
-      'header_default.php' => 'bd4edc6cfd3a11249a9f59a846ffab87',
+      'header_default.php' => '573d6bf242b433a91f9d044f77bacbfe',
       'index.html' => 'd41d8cd98f00b204e9800998ecf8427e',
       'login_template.php' => 'cd32f6bad43c829a8fa6e166a987c987',
       'membersonly_template.php' => '14635660ab8f2daed92f4260ed0f3fa1',
@@ -2935,7 +3016,7 @@
       'signup_template.php' => '2168fa51ff1cfcfb3b8f2aaf87287d99',
       'sitedown_template.php' => '5e7c7db5ff15ed4a866d3fb46377c247',
       'trackback_template.php' => 'fd54d8c26c75f9d380e8ec90860b0107',
-      'user_template.php' => '6338b0faa7ad36c8ecd89cfd0f933d90',
+      'user_template.php' => '096eda6eb3cf505cde1669285c21f053',
       'userposts_template.php' => '4b86473e3ca67cbba7790b2395db345f',
       'usersettings_template.php' => 'f3e3837913dca2349b8f422cb4fef38c',
     ),
@@ -2964,23 +3045,25 @@
       'index.html' => 'd41d8cd98f00b204e9800998ecf8427e',
       'nav_menu.css' => '74b91306b957f69bc390ed612df76ac9',
       'preview.jpg' => 'fbb8bde5f9eb4f8efc39f85234959823',
-      'style.css' => 'b11955766d34da3f5ee12aa7ca734655',
-      'theme.php' => '1a7cbeaf958bed83418158d97f8cd9f6',
+      'style.css' => '02e8aa814f130ab566515c10ea564b53',
+      'theme.php' => '2b4b8cff395cc03ce0474c60569ab45d',
     ),
     'index.html' => 'd41d8cd98f00b204e9800998ecf8427e',
   ),
+  '.cvsignore' => '49be6cd45c5b85b7e1542481d7aa7b28',
   'article.php' => '274696e46f6946007b5a1d308e033b3a',
   'backend.php' => '312552577f67c7965a76bda84b949a64',
   'banner.php' => 'e028fd2fa6fac77863505acb501b6632',
-  'class2.php' => 'c6177adb2b95dc7dd149c66bc2a3115d',
+  'class2.php' => 'c08ffd487f8152cb9630d46c836752c0',
   'comment.php' => 'd7bf36a5bec9342815f58c47ba847db7',
-  'contact.php' => 'be3feefdfb6c086b112ef037989fcbd1',
+  'contact.php' => '086abf7a78a498f82d1824415ef794f2',
   'content.php' => '9a9f4da9afbd0d081e4f275fbcd13674',
-  'download.php' => '2eacaeab87a376aeb2641733c0c5b357',
+  'download.php' => '27df2991aa9ac193d6a9c2e9621cfdee',
   'e107.htaccess' => 'c5e1ad68b41f947be285926c0f81d914',
+  'e107.robots.txt' => '118aadbc5395ee3d4c6fade187097e5a',
   'e107_config.php' => 'd41d8cd98f00b204e9800998ecf8427e',
   'email.php' => '6f5a6b9bd588d7f774f4e1a731efa937',
-  'error.php' => 'cefbba8e1639ecf9c35502cf646c5cda',
+  'error.php' => '43c688d9b7c8fef79dd6f8a2ae64e3b4',
   'favicon.ico' => '5fceb78b9124ddae4027396d7cfcd328',
   'forum.php' => '3c10184d52685d7c9a6906a967b7e3d8',
   'forum_viewforum.php' => '4b9fcc3a820ed2f93b4dc707c3ebe3b4',
@@ -2989,25 +3072,24 @@
   'gsitemap.php' => '5a3d81b0d9ca3f41c6a8c46155c41cc7',
   'index.php' => '960de1b196ffa6e7887fe99ae65fa682',
   'links.php' => 'bed206fc2abe8f1307ef4db3b7fee63e',
-  'login.php' => '4483bb69d947c6150c22c7a22dc8def9',
+  'login.php' => 'b63487844599e96d23800fdb5b74fbf2',
   'membersonly.php' => '0903a2ef48312a12ce81b2fa17fe0233',
-  'news.php' => '8c9b92d43b27d2882f6f1b0d80d34ed8',
+  'news.php' => 'fe0005f77d9f317c5d9f2b8dacdb522a',
   'online.php' => '76ab26b03b5e4d6f83f0c4b22257b8b6',
-  'page.php' => '8a20cbd55e6ab1f627bdcd62af8fa2f0',
+  'page.php' => '0cb738f6c6cfe7b117f3ddad6a970493',
   'print.php' => '82e7c7267881349a4ef5e11f3efb6de8',
   'rate.php' => '4730b1d1cf3ace6af2179fb52a521366',
-  'request.php' => '3891299e7754fae7fcf92d9ec65d8a3e',
-  'robots.txt' => '118aadbc5395ee3d4c6fade187097e5a',
+  'request.php' => 'c65a13737a9be96bd04ab836a9a14350',
   'search.php' => '69297aaac6cd8e8c44371e2bdd3d7eec',
-  'signup.php' => '9ad605016650e43aa595c74f6be4a49f',
-  'sitedown.php' => '7a2d95fb0976ce5ab287a403b118acfa',
+  'signup.php' => 'a55c004bf3704e9648f7154c51ab6286',
+  'sitedown.php' => 'f6723ac4ca112e3a684b094f970bda1d',
   'subcontent.php' => '5a534e399228320e38056244e944357d',
-  'submitnews.php' => '4615a023d5c16cd745bd03cc4fb980ad',
+  'submitnews.php' => '99735d671704e4610935275159d703a1',
   'top.php' => '9d7f39ec5411241994a7bd2777f592aa',
-  'upload.php' => '2d9b16e50c62df01f265af5a8c7e1c99',
+  'upload.php' => '0096a4384f7b820091deae6e94aa4f67',
   'user.php' => '04be88f587ad8a00cbf42eacbef75598',
-  'userposts.php' => '973300cda186f7eda50879bd6b161ab7',
-  'usersettings.php' => '8c592e3b8cc1eb047787fb89ca3faeaf',
+  'userposts.php' => '7b9cd08364856d45f52b5d4ebf2fe8e6',
+  'usersettings.php' => 'b035fd67e853e96d8164eaea1aa1e8be',
 );
 
 $deprecated_image = array (
@@ -3821,6 +3903,7 @@
         array (
           'images' => 
           array (
+            'iespell.gif' => 'eb12c26b5768fcd344ea6205aa98e761',
           ),
           'langs' => 
           array (
@@ -3829,6 +3912,7 @@
             'da.js' => 'cfc6d891c08e588b1461202d2568d7d6',
             'de.js' => '91728a57ef0ba20f25e47ee03b4866da',
             'el.js' => '3d65d19ee490b26fa1787bd8fbd35855',
+            'en.js' => 'b262530d5b63841b50ab5b67f94883aa',
             'es.js' => 'dd6eac9bdd597674c08d5daa9991d0fe',
             'fr.js' => '724009d0efaff99b88271c7f34ef1dfa',
             'fr_ca.js' => '54bbb38074a99afe3837478c49c0afc2',
@@ -3861,6 +3945,7 @@
           ),
           'langs' => 
           array (
+            'en.js' => 'de38190b0b16ff997c6f7a2e09818f3c',
           ),
         ),
         'table' => 
@@ -3882,6 +3967,7 @@
             'da.js' => '6149f162722148ecf3876fb10b3e737e',
             'de.js' => '8cb4b9f7f1c94b051d781acb3da4d0d5',
             'el.js' => 'dcd0296a2b66bea7eb4014c5e499ae53',
+            'en.js' => 'efb577fa33557c4f819d45f8be16ff20',
             'es.js' => '438ea428f82d61c1ed95eaed346f97dc',
             'fa.js' => 'e64696a278069b4ea22bd952aaadfcaf',
             'fi.js' => 'fcf27030ae50526ae018dcfafa692002',
@@ -4579,6 +4665,7 @@
         array (
         ),
       ),
+      'help.php' => '950985bb6c445147d901bb4fb00b0f1d',
     ),
     'counter_menu' => 
     array (
@@ -4714,6 +4801,7 @@
       'search' => 
       array (
       ),
+      'help.php' => 'a8495b50a8243ebbb3e37c8bcb169184',
     ),
     'linkwords' => 
     array (
@@ -4792,6 +4880,7 @@
       'templates' => 
       array (
       ),
+      'help.php' => '7942458e34eb69cdad92cc7d9454f626',
     ),
     'newsletter' => 
     array (
@@ -5712,10 +5801,12 @@
   'ReadMe_English_iso-8859-1.txt' => 'a15c32416143ecdebb10fab747a9065a',
   'chat.php' => 'f99ca9a68e350852ff12b6f201ff46e4',
   'e107_6171_readme.txt' => '7f411eaafccc974f91447c8efd9992d4',
+  'e107_v0.7.15_full.tar.gz' => 'cb4e979a03311400f4feda26fe5832e4',
   'forum_post.php' => 'b4537a7296252a0d8c010824b698259b',
   'install.php' => 'e5ab961c3e9aaeefd8bcc11b9e2ae6bc',
   'oldpolls.php' => '2758e56550195c508819c6062b950bc3',
   'readme.txt' => 'ff257006036939e779d287cdfee3b4b3',
+  'robots.txt' => '118aadbc5395ee3d4c6fade187097e5a',
   'sitemap.php' => 'd72fdc265a68f5a3b8a5d4b51d776f84',
   'stats.php' => '70a4419f7b5ce5ad398a2f2d38ab55eb',
   'upgrade.php' => '5e74e594b56732d62183c0300e222f2a',
diff -x .svn -aruN 0.7.15.src/e107_admin/cpage.php 0.7.16.src/e107_admin/cpage.php
--- 0.7.15.src/e107_admin/cpage.php	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_admin/cpage.php	2009-08-03 13:35:40.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_admin/cpage.php,v $
-|     $Revision: 1.42 $
-|     $Date: 2008/07/09 20:07:54 $
-|     $Author: e107steved $
+|     $Revision: 1.46 $
+|     $Date: 2009/08/03 18:36:04 $
+|     $Author: marj_nl_fr $
 +----------------------------------------------------------------------------+
 */
 
@@ -28,7 +28,6 @@
 require_once("auth.php");
 // require_once(e_HANDLER."ren_help.php");
 require_once(e_HANDLER."userclass_class.php");
-$custpage_lang = ($sql->mySQLlanguage) ? $sql->mySQLlanguage : $pref['sitelanguage'];
 
 if (e_QUERY)
 {
@@ -267,7 +266,7 @@
 
 			<tr>
 			<td style='width:25%' class='forumheader3'>".CUSLAN_18."</td>
-			<td style='width:75%' class='forumheader3'>".r_userclass("page_class", $page_class)."</td>
+			<td style='width:75%' class='forumheader3'>".r_userclass("page_class", $page_class, "off", "public,guest,nobody,member,main,admin,classes")."</td>
 			</tr>";
 		}
 
@@ -302,16 +301,21 @@
 
 		if($mode)
 		{	// Don't think $_POST['page_ip_restrict'] is ever set.
-
-			$update = $sql -> db_Update("page", "page_title='$page_title', page_text='$page_text', page_author='$pauthor', page_rating_flag='".intval($_POST['page_rating_flag'])."', page_comment_flag='".intval($_POST['page_comment_flag'])."', page_password='".$_POST['page_password']."', page_class='".$_POST['page_class']."', page_ip_restrict='".varset($_POST['page_ip_restrict'],'')."' WHERE page_id='$mode'");
+			$update = $sql -> db_Update("page", "page_title='{$page_title}', page_text='{$page_text}', page_datestamp='".time()."', page_author='{$pauthor}', page_rating_flag='".intval($_POST['page_rating_flag'])."', page_comment_flag='".intval($_POST['page_comment_flag'])."', page_password='".$_POST['page_password']."', page_class='".$_POST['page_class']."', page_ip_restrict='".varset($_POST['page_ip_restrict'],'')."' WHERE page_id='{$mode}'");
 			$e107cache->clear("page_{$mode}");
 			$e107cache->clear("page-t_{$mode}");
 
-			if($type)
+			if($type)  // it's a menu.
 			{
 				$menu_name = $tp -> toDB($_POST['menu_name']); // not to be confused with menu-caption.
-				$sql -> db_Update("menus", "menu_name='$menu_name' WHERE menu_path='$mode' ");
-				$update++;
+				if($sql -> db_Update("menus", "menu_name='$menu_name' WHERE menu_path='$mode' "))
+				{
+				  	$update++;
+				}
+				else
+				{
+                  	$sql -> db_Insert("menus", "0, '$menu_name', '0', '0', '0', '', '".$mode."' ");
+				}
 			}
 
 			if ($_POST['page_link'])
diff -x .svn -aruN 0.7.15.src/e107_admin/db.php 0.7.16.src/e107_admin/db.php
--- 0.7.15.src/e107_admin/db.php	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_admin/db.php	2009-01-04 03:34:48.000000000 -0600
@@ -11,25 +11,34 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_admin/db.php,v $
-|     $Revision: 1.23 $
-|     $Date: 2007/10/26 09:43:03 $
-|     $Author: e107coders $
+|     $Revision: 1.24 $
+|     $Date: 2009/01/04 09:35:12 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 
 require_once("../class2.php");
-if (!getperms('0')) {
+if (!getperms('0')) 
+{
 	header('location:'.e_BASE.'index.php');
 	exit;
 }
 $e_sub_cat = 'database';
 
-if (isset($_POST['db_update'])) {
+if (isset($_POST['db_update'])) 
+{
 	header("location: ".e_ADMIN."e107_update.php");
 	exit;
 }
 
-if (isset($_POST['verify_sql'])) {
+if (isset($_POST['check_user'])) 
+{
+	header("location: ".e_ADMIN."check_user.php");
+	exit;
+}
+
+if (isset($_POST['verify_sql'])) 
+{
 	header("location: ".e_ADMIN."db_verify.php");
 	exit;
 }
@@ -52,14 +61,16 @@
 }
 
 
-if (isset($_POST['optimize_sql'])) {
+if (isset($_POST['optimize_sql'])) 
+{
 	optimizesql($mySQLdefaultdb);
 	require_once("footer.php");
 	exit;
 }
 
 
-if (isset($_POST['backup_core'])) {
+if (isset($_POST['backup_core'])) 
+{
 	backup_core();
 	message_handler("MESSAGE", DBLAN_1);
 }
@@ -70,7 +81,8 @@
 
 }
 
-if (isset($_POST['plugin_scan']) || e_QUERY == "plugin" || $_POST['delplug']) {
+if (isset($_POST['plugin_scan']) || e_QUERY == "plugin" || $_POST['delplug']) 
+{
 	plugin_viewscan();
 	require_once("footer.php");
 	exit;
@@ -112,9 +124,14 @@
 	</tr>
 
 	<tr>
+	<td style='width:70%' class='forumheader3'>".DBLAN_35."</td>
+	<td class='forumheader3' style='width:30%;text-align:center'><input class='button' style='width: 100%' type='submit' name='check_user' value='".DBLAN_36."' /></td>
+	</tr>
+
+	<tr>
 	<td style='width:70%' class='forumheader3'>".DBLAN_8."</td>
 	<td class='forumheader3' style='width:30%;text-align:center'><input class='button' style='width: 100%' type='submit' name='backup_core' value='".DBLAN_9."' />
-	<input type='hidden' name='sqltext' value='$sqltext' />
+	<input type='hidden' name='sqltext' value='{$sqltext}' />
 	</td></tr>
 	</table>
 	</form>
diff -x .svn -aruN 0.7.15.src/e107_admin/download.php 0.7.16.src/e107_admin/download.php
--- 0.7.15.src/e107_admin/download.php	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_admin/download.php	2009-05-19 17:22:15.000000000 -0500
@@ -11,16 +11,16 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_admin/download.php,v $
-|     $Revision: 1.104 $
-|     $Date: 2008/09/23 19:31:36 $
-|     $Author: e107steved $
+|     $Revision: 1.107 $
+|     $Date: 2009/05/19 22:22:39 $
+|     $Author: bugrain $
 +----------------------------------------------------------------------------+
 */
 
 define('DOWNLOAD_DEBUG',FALSE);
 
 require_once("../class2.php");
-if (!getperms("R")) 
+if (!getperms("R"))
 {
 	header("location:".e_BASE."index.php");
 	exit;
@@ -63,7 +63,7 @@
 
 $rs = new form;
 $sub_action = '';
-if (e_QUERY) 
+if (e_QUERY)
 {
 	$tmp = explode(".", e_QUERY);
 	$action = $tmp[0];
@@ -102,7 +102,7 @@
 
 if ($sql->db_Select("rbinary"))
 {
-  while ($row = $sql->db_Fetch())	
+  while ($row = $sql->db_Fetch())
   {
 		extract($row);
 		$file_array[] = "Binary ".$binary_id."/".$binary_name;
@@ -126,12 +126,12 @@
 	$e107cache->clear("download_cat");
 }
 
-if (isset($_POST['add_category'])) 
+if (isset($_POST['add_category']))
 {
 	$download->create_category($sub_action, $id);
 }
 
-if (isset($_POST['submit_download'])) 
+if (isset($_POST['submit_download']))
 {
 	$download->submit_download($sub_action, $id);
 	$action = "main";
@@ -242,28 +242,28 @@
 }
 
 
-if ($action == "create") 
+if ($action == "create")
 {
 	$download->create_download($sub_action, $id);
 }
 
 
-if ($delete == 'category') 
+if ($delete == 'category')
 {
-  if (admin_update($sql->db_Delete("download_category", "download_category_id='$del_id' "), 'delete', DOWLAN_49." #".$del_id." ".DOWLAN_36)) 
+  if (admin_update($sql->db_Delete("download_category", "download_category_id='$del_id' "), 'delete', DOWLAN_49." #".$del_id." ".DOWLAN_36))
   {
 		$sql->db_Delete("download_category", "download_category_parent='{$del_id}' ");
 	}
 }
 
 
-if ($action == "cat") 
+if ($action == "cat")
 {
 	$download->show_categories($sub_action, $id);
 }
 
 
-if ($delete == 'main') 
+if ($delete == 'main')
 {
 	$result = admin_update($sql->db_Delete("download", "download_id='$del_id' "), 'delete', DOWLAN_27." #".$del_id." ".DOWLAN_36);
 	if($result)
@@ -275,14 +275,14 @@
 }
 
 
-if (isset($message)) 
+if (isset($message))
 {
 	$ns->tablerender("", "<div style='text-align:center'><b>".$message."</b></div>");
 }
 
 
 
-if (!e_QUERY || $action == "main") 
+if (!e_QUERY || $action == "main")
 {
 	$download->show_existing_items($action, $sub_action, $id, $from, $amount);
 }
@@ -290,7 +290,7 @@
 
 
 
-if ($action == "opt") 
+if ($action == "opt")
 {
 	global $pref, $ns;
 	$agree_flag = $pref['agree_flag'];
@@ -502,9 +502,9 @@
 
 
 
-class download 
+class download
 {
-	function show_existing_items($action, $sub_action, $id, $from, $amount) 
+	function show_existing_items($action, $sub_action, $id, $from, $amount)
 	{
 		global $sql, $rs, $ns, $tp, $mySQLdefaultdb, $pref;
 		$text = "<div style='text-align:center'><div style='padding : 1px; ".ADMIN_WIDTH."; margin-left: auto; margin-right: auto;'>";
@@ -528,7 +528,7 @@
 
          $query = "SELECT d.*, dc.* FROM `#download` AS d	LEFT JOIN `#download_category` AS dc ON dc. download_category_id  = d.download_category";
 
-		if (isset($_POST['searchquery']) && $_POST['searchquery'] != "") 
+		if (isset($_POST['searchquery']) && $_POST['searchquery'] != "")
 		{
 			$query .= " WHERE  download_url REGEXP('".$_POST['searchquery']."') OR download_author REGEXP('".$_POST['searchquery']."') OR download_description  REGEXP('".$_POST['searchquery']."') ";
           foreach($search_display as $disp)
@@ -536,13 +536,13 @@
 		  		$query .= " OR $disp REGEXP('".$_POST['searchquery']."') ";
 			}
           $query .= " ORDER BY {$sortorder} {$sortdirection}";
-		} 
-		else 
+		}
+		else
 		{
 		  $query .= " ORDER BY ".($sub_action ? $sub_action : $sortorder)." ".($id ? $id : $sortdirection)."  LIMIT $from, $amount";
 		}
 
-      	if ($dl_count = $sql->db_Select_gen($query)) 
+      	if ($dl_count = $sql->db_Select_gen($query))
 		{
 		  $text .= $rs->form_open("post", e_SELF."?".e_QUERY, "myform")."
 				<table class='fborder' style='width:99%'>
@@ -567,11 +567,11 @@
 
 		  $text .="<td style='width:10%' class='fcaption'>".LAN_OPTIONS."</td></tr>";
 
-		  while ($row = $sql->db_Fetch()) 
+		  while ($row = $sql->db_Fetch())
 		  {
 			$text .= "<tr><td style='width:5%;vertical-align:top' class='forumheader3'>".$row['download_id']."</td>";
 
-			// Display Chosen options 
+			// Display Chosen options
 			foreach($search_display as $disp)
 			{
 			  $text .= "<td class='forumheader3' style='vertical-align:top'>";
@@ -604,16 +604,16 @@
 				  break;
 				case "download_active" :
 				  if($row[$disp]== 1)
-				  { 
-				    $text .= "<img src='".ADMIN_TRUE_ICON_PATH."' title='".DOWLAN_123."' alt='' style='cursor:help' />\n"; 	
+				  {
+				    $text .= "<img src='".ADMIN_TRUE_ICON_PATH."' title='".DOWLAN_123."' alt='' style='cursor:help' />\n";
 				  }
 				  elseif($row[$disp]== 2)
-				  { 
-				    $text .= "<img src='".ADMIN_TRUE_ICON_PATH."' title='".DOWLAN_124."' alt='' style='cursor:help' /><img src='".ADMIN_TRUE_ICON_PATH."' title='".DOWLAN_124."' alt='' style='cursor:help' />\n"; 	
+				  {
+				    $text .= "<img src='".ADMIN_TRUE_ICON_PATH."' title='".DOWLAN_124."' alt='' style='cursor:help' /><img src='".ADMIN_TRUE_ICON_PATH."' title='".DOWLAN_124."' alt='' style='cursor:help' />\n";
 				  }
 				  else
-				  { 
-				    $text .= "<img src='".ADMIN_FALSE_ICON_PATH."' title='".DOWLAN_122."' alt='' style='cursor:help' />\n";  
+				  {
+				    $text .= "<img src='".ADMIN_FALSE_ICON_PATH."' title='".DOWLAN_122."' alt='' style='cursor:help' />\n";
 				  }
 				  break;
 				case "download_comment" :
@@ -634,8 +634,8 @@
 					</tr>";
 		  }
 		  $text .= "</table></form>";
-		} 
-		else 
+		}
+		else
 		{	// 'No downloads yet'
 		  $text .= "<div style='text-align:center'>".DOWLAN_6."</div>";
 		}
@@ -643,7 +643,7 @@
 
 		// Next-Previous.
 		$downloads = $sql->db_Count("download");
-		if ($downloads > $amount && !$_POST['searchquery']) 
+		if ($downloads > $amount && !$_POST['searchquery'])
 		{
 		  $parms = "{$downloads},{$amount},{$from},".e_SELF."?".(e_QUERY ? "$action.$sub_action.$id." : "main.{$sortorder}.{$sortdirection}.")."[FROM]";
 			$text .= "<br />".$tp->parseTemplate("{NEXTPREV={$parms}}");
@@ -754,7 +754,7 @@
 
 
 
-	function create_download($sub_action, $id) 
+	function create_download($sub_action, $id)
 	{
 		global $cal,$tp, $sql, $fl, $rs, $ns, $file_array, $image_array, $thumb_array,$pst;
 		require_once(e_FILE."shortcode/batch/download_shortcodes.php");
@@ -767,15 +767,15 @@
 		$preset = $pst->read_preset("admin_downloads");  // read preset values into array
 		extract($preset);
 
-		if (!$sql->db_Select("download_category")) 
+		if (!$sql->db_Select("download_category"))
 		{
 			$ns->tablerender(ADLAN_24, "<div style='text-align:center'>".DOWLAN_5."</div>");
 			return;
 		}
 		$download_active = 1;
-		if ($sub_action == "edit" && !$_POST['submit']) 
+		if ($sub_action == "edit" && !$_POST['submit'])
 		{
-			if ($sql->db_Select("download", "*", "download_id=".$id)) 
+			if ($sql->db_Select("download", "*", "download_id=".$id))
 			{
 				$row = $sql->db_Fetch();
 				extract($row);
@@ -784,9 +784,9 @@
 			}
 		}
 
-		if ($sub_action == "dlm" && !$_POST['submit']) 
+		if ($sub_action == "dlm" && !$_POST['submit'])
 		{
-			if ($sql->db_Select("upload", "*", "upload_id=".$id)) 
+			if ($sql->db_Select("upload", "*", "upload_id=".$id))
 			{
 				$row = $sql->db_Fetch();
 
@@ -833,11 +833,11 @@
 			";
 
 		$counter = 0;
-		while (isset($file_array[$counter])) 
+		while (isset($file_array[$counter]))
 		{
 			$fpath = str_replace(e_DOWNLOAD,"",$file_array[$counter]['path']).$file_array[$counter]['fname'];
 			$selected = '';
-			if (stristr($fpath, $download_url) !== FALSE) 
+			if (stristr($fpath, $download_url) !== FALSE)
 			{
 				$selected = " selected='selected'";
 				$found = 1;
@@ -848,7 +848,7 @@
 		}
 
 		$dt = 'display:none';
-		if (preg_match("/http:|ftp:/", $download_url)) 
+		if (preg_match("/http:|ftp:/", $download_url))
 		{
 			$download_url_external = $download_url;
 			$download_url = '';
@@ -856,25 +856,42 @@
 		}
 
 		$etext = " - (".DOWLAN_68.")";
-		if (file_exists(e_FILE."public/".$download_url)) 
+		if (file_exists(e_FILE."public/".$download_url))
 		{
 			$etext = "";
 		}
 
-		if (!$found && $download_url) 
+		if (!$found && $download_url)
 		{
 			$text .= "<option value='".$download_url."' selected='selected'>".$download_url.$etext."</option>\n";
 		}
 
+		if($sub_action == 'edit' || $sub_action == 'dlm')
+		{
+			$b_sel = "selected='selected'";
+			$kb_sel = '';
+		}
+		else
+		{
+			$kb_sel = "selected='selected'";
+			$b_sel = '';
+		}
+
 		$text .= "</select></div>
             <span style='padding-top:6px;cursor:pointer;text-decoration:underline' onclick='expandit(this)' title='".DOWLAN_14."'>".DOWLAN_149."</span>
 			<div id='use_ext' style='padding-top:6px;{$dt}'>
            URL:&nbsp;
 
 			<input class='tbox' type='text' name='download_url_external' size='70' value='{$download_url_external}' maxlength='150' />
-			&nbsp;&nbsp;&nbsp;".DOWLAN_66."
-			<input class='tbox' type='text' name='download_filesize_external' size='8' value='{$download_filesize}' maxlength='10' />
-           </div>
+			<br />".DOWLAN_66."
+			<input class='tbox' type='text' name='download_filesize_external' size='12' value='{$download_filesize}' maxlength='10' />
+      <select class='tbox' name='download_filesize_unit'>
+      <option value='B'{$b_sel}>".CORE_LAN_B."</option>
+      <option value='KB'{$kb_sel}>".CORE_LAN_KB."</option>
+      <option value='MB'>".CORE_LAN_MB."</option>
+      <option value='GB'>".CORE_LAN_GB."</option>
+      <option value='TB'>".CORE_LAN_TB."</option>
+      </div>
 
 			</td>
 			</tr>
@@ -906,7 +923,7 @@
 				<select name='download_mirror_name[]' class='tbox'>
 					<option value=''>&nbsp;</option>";
 
-				foreach ($mirrorList as $mirror)	
+				foreach ($mirrorList as $mirror)
 				{
 					extract($mirror);
 					$text .= "<option value='{$mirror_id}'".($mirror_id == $mirrorArray[($count-1)]['id'] ? " selected='selected'" : "").">{$mirror_name}</option>\n";
@@ -1158,9 +1175,35 @@
 
 // -----------------------------------------------------------------------------
 
+	function calc_filesize($size, $unit)
+	{
+		switch($unit)
+		{
+			case 'B' :
+				return $size;
+				break;
+
+			case 'KB' :
+				return $size * 1024;
+				break;
+
+			case 'MB' :
+				return $size * 1024 * 1024;
+				break;
+
+			case 'GB' :
+				return $size * 1024 * 1024 * 1024;
+				break;
+
+			case 'TB' :
+				return $size * 1024 * 1024 * 1024 * 1024;
+				break;
+		}
 
+	}
 
-	function submit_download($sub_action, $id) 
+
+	function submit_download($sub_action, $id)
 	{
 		global $tp, $sql, $DOWNLOADS_DIRECTORY, $e_event;
 
@@ -1175,14 +1218,14 @@
 		if ($_POST['download_url_external'] && $_POST['download_url'] == '')
 		{
 			$durl = $_POST['download_url_external'];
-			$filesize = $_POST['download_filesize_external'];
+			$filesize = $this->calc_filesize($_POST['download_filesize_external'], $_POST['download_filesize_unit']);
 		}
 		else
 		{
 			$durl = $_POST['download_url'];
 			if($_POST['download_filesize_external'])
 			{
-				$filesize = $_POST['download_filesize_external'];
+				$filesize = $this->calc_filesize($_POST['download_filesize_external'], $_POST['download_filesize_unit']);
 			}
 			else
 			{
@@ -1256,8 +1299,8 @@
 		}
 
 		if($_POST['update_datestamp'])
-		{	
-			$_POST['download_datestamp'] = time();	
+		{
+			$_POST['download_datestamp'] = time();
 		}
 
 		$mirrorStr = "";
@@ -1314,15 +1357,15 @@
 			admin_update($sql->db_Update("download", "download_name='".$_POST['download_name']."', download_url='".$durl."', download_author='".$_POST['download_author']."', download_author_email='".$_POST['download_author_email']."', download_author_website='".$_POST['download_author_website']."', download_description='".$_POST['download_description']."', download_filesize='".$filesize."', download_category='".intval($_POST['download_category'])."', download_active='".intval($_POST['download_active'])."', download_datestamp='".intval($_POST['download_datestamp'])."', download_thumb='".$_POST['download_thumb']."', download_image='".$_POST['download_image']."', download_comment='".intval($_POST['download_comment'])."', download_class = '{$_POST['download_class']}', download_mirror='$mirrorStr', download_mirror_type='".intval($_POST['download_mirror_type'])."' , download_visible='".$_POST['download_visible']."' WHERE download_id=".intval($id)), 'update', DOWLAN_2." (<a href='".e_BASE."download.php?view.".$id."'>".$_POST['download_name']."</a>)");
             $dlinfo = array("download_id" => $download_id, "download_name" => $_POST['download_name'], "download_url" => $durl, "download_author" => $_POST['download_author'], "download_author_email" => $_POST['download_author_email'], "download_author_website" => $_POST['download_author_website'], "download_description" => $_POST['download_description'], "download_filesize" => $filesize, "download_category" => $_POST['download_category'], "download_active" => $_POST['download_active'], "download_datestamp" => $time, "download_thumb" => $_POST['download_thumb'], "download_image" => $_POST['download_image'], "download_comment" => $_POST['download_comment'] );
 			$e_event->trigger("dlupdate", $dlinfo);
-		} 
-		else 
+		}
+		else
 		{
-			if (admin_update($download_id = $sql->db_Insert("download", "0, '".$_POST['download_name']."', '".$durl."', '".$_POST['download_author']."', '".$_POST['download_author_email']."', '".$_POST['download_author_website']."', '".$_POST['download_description']."', '".$filesize."', '0', '".intval($_POST['download_category'])."', '".intval($_POST['download_active'])."', '".intval($_POST['download_datestamp'])."', '".$_POST['download_thumb']."', '".$_POST['download_image']."', '".intval($_POST['download_comment'])."', '{$_POST['download_class']}', '$mirrorStr', '".intval($_POST['download_mirror_type'])."', '".$_POST['download_visible']."' "), 'insert', DOWLAN_1." (<a href='".e_BASE."download.php?view.".$download_id."'>".$_POST['download_name']."</a>)")) 
+			if (admin_update($download_id = $sql->db_Insert("download", "0, '".$_POST['download_name']."', '".$durl."', '".$_POST['download_author']."', '".$_POST['download_author_email']."', '".$_POST['download_author_website']."', '".$_POST['download_description']."', '".$filesize."', '0', '".intval($_POST['download_category'])."', '".intval($_POST['download_active'])."', '".intval($_POST['download_datestamp'])."', '".$_POST['download_thumb']."', '".$_POST['download_image']."', '".intval($_POST['download_comment'])."', '{$_POST['download_class']}', '$mirrorStr', '".intval($_POST['download_mirror_type'])."', '".$_POST['download_visible']."' "), 'insert', DOWLAN_1." (<a href='".e_BASE."download.php?view.".$download_id."'>".$_POST['download_name']."</a>)"))
 			{
 				$dlinfo = array("download_id" => $download_id, "download_name" => $_POST['download_name'], "download_url" => $durl, "download_author" => $_POST['download_author'], "download_author_email" => $_POST['download_author_email'], "download_author_website" => $_POST['download_author_website'], "download_description" => $_POST['download_description'], "download_filesize" => $filesize, "download_category" => $_POST['download_category'], "download_active" => $_POST['download_active'], "download_datestamp" => $time, "download_thumb" => $_POST['download_thumb'], "download_image" => $_POST['download_image'], "download_comment" => $_POST['download_comment'] );
 				$e_event->trigger("dlpost", $dlinfo);
 
-				if ($_POST['remove_upload']) 
+				if ($_POST['remove_upload'])
 				{
 					$sql->db_Update("upload", "upload_active='1' WHERE upload_id='".$_POST['remove_id']."'");
 					$mes = "<br />".$_POST['download_name']." ".DOWLAN_104;
@@ -1616,11 +1659,11 @@
 		  $download_category_icon .= trim(chr(1).$tp->toDB($_POST['download_category_icon_empty']));
 		}
 
-		if ($id) 
+		if ($id)
 		{
 		  admin_update($sql->db_Update("download_category", "download_category_name='{$download_category_name}', download_category_description='{$download_category_description}', download_category_icon ='{$download_category_icon}', download_category_parent= '{$download_categoory_parent}', download_category_class='{$download_category_class}' WHERE download_category_id='{$id}'"), 'update', DOWLAN_48);
-		} 
-		else 
+		}
+		else
 		{
 		  admin_update($sql->db_Insert("download_category", "0, '{$download_category_name}', '{$download_category_description}', '{$download_category_icon}', '{$download_categoory_parent}', '{$download_category_class}', 0 "), 'insert', DOWLAN_47);
 		}
diff -x .svn -aruN 0.7.15.src/e107_admin/fla.php 0.7.16.src/e107_admin/fla.php
--- 0.7.15.src/e107_admin/fla.php	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_admin/fla.php	2009-07-18 08:07:48.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_admin/fla.php,v $
-|     $Revision: 1.14 $
-|     $Date: 2008/11/29 13:24:09 $
-|     $Author: e107steved $
+|     $Revision: 1.15 $
+|     $Date: 2009/07/18 13:08:12 $
+|     $Author: marj_nl_fr $
 +----------------------------------------------------------------------------+
 */
 require_once("../class2.php");
@@ -113,7 +113,7 @@
 		$message .= " - ".$ab['gen_ip'];
 	}
 
-	$message .= "<div style='text-align: right;'>( <a href='".e_SELF."?dabl'>".FLALAN_16."</a> )</div>";
+	$message .= "<div style='text-align: right;'>(<a href='".e_SELF."?dabl'>".FLALAN_16."</a>)</div>";
 
 }
 
@@ -154,8 +154,8 @@
 		<td style='width: 50%;' class='forumheader3'>".str_replace(":::", "<br />", htmlentities($gen_chardata, ENT_QUOTES, CHARSET))."</td>
 		<td style='width: 20%;' class='forumheader'>".$fa['gen_ip']."<br />{$host}</td>
 		<td style='width: 10%; text-align: left;' class='forumheader3'>
-		<input type='checkbox' name='fladelete[]' value='{$gen_id}' /> ".LAN_DELETE."<br />
-		<input type='checkbox' name='flaban[]' value='{$gen_id}' /> ".LAN_BAN."
+		<label><input type='checkbox' name='fladelete[]' value='{$gen_id}' /> ".LAN_DELETE."</label><br />
+		<label><input type='checkbox' name='flaban[]' value='{$gen_id}' /> ".LAN_BAN."</label>
 		</td>
 		</tr>
 		";
diff -x .svn -aruN 0.7.15.src/e107_admin/footer.php 0.7.16.src/e107_admin/footer.php
--- 0.7.15.src/e107_admin/footer.php	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_admin/footer.php	2009-07-11 22:30:57.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_admin/footer.php,v $
-|     $Revision: 1.27 $
-|     $Date: 2008/04/06 21:37:41 $
-|     $Author: e107steved $
+|     $Revision: 1.28 $
+|     $Date: 2009/07/12 03:31:21 $
+|     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
 if (!defined('e107_INIT')) { exit; }
@@ -167,10 +167,10 @@
 	}
 }
 
-if((ADMIN == true || $pref['developer']) && $error_handler->debug == true) {
+if((ADMIN == true || $pref['developer']) && count($error_handler->errors) && $error_handler->debug == true) 
+{
 	echo "
-	<br /><br />
-	<div>
+	<div class='e107_debug php_err block-text'>
 		<h3>PHP Errors:</h3><br />
 		".$error_handler->return_errors()."
 	</div>
diff -x .svn -aruN 0.7.15.src/e107_admin/header.php 0.7.16.src/e107_admin/header.php
--- 0.7.15.src/e107_admin/header.php	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_admin/header.php	2009-07-23 03:14:02.000000000 -0500
@@ -12,9 +12,9 @@
 |        GNU General Public License (http://gnu.org).
 |
 |   $Source: /cvsroot/e107/e107_0.7/e107_admin/header.php,v $
-|   $Revision: 1.62 $
-|   $Date: 2008/05/23 21:14:30 $
-|   $Author: e107steved $
+|   $Revision: 1.65 $
+|   $Date: 2009/07/23 08:14:26 $
+|   $Author: marj_nl_fr $
 +---------------------------------------------------------------+
 */
 
@@ -72,17 +72,11 @@
 // B.2: Include admin LAN defines
 //
 
-if (file_exists(e_LANGUAGEDIR.e_LANGUAGE.'/admin/lan_header.php')) {
-	@include_once(e_LANGUAGEDIR.e_LANGUAGE."/admin/lan_header.php");
-} else {
-	@include_once(e_LANGUAGEDIR."English/admin/lan_header.php");
-}
-if (file_exists(e_LANGUAGEDIR.e_LANGUAGE.'/admin/lan_footer.php')) {
-	@include_once(e_LANGUAGEDIR.e_LANGUAGE.'/admin/lan_footer.php');
-} else {
-	@include_once(e_LANGUAGEDIR.'English/admin/lan_footer.php');
-}
-if (!defined('ADMIN_WIDTH')) {
+include_lan(e_LANGUAGEDIR.e_LANGUAGE."/admin/lan_header.php");
+include_lan(e_LANGUAGEDIR.e_LANGUAGE.'/admin/lan_footer.php');
+
+if (!defined('ADMIN_WIDTH'))
+{
 	define('ADMIN_WIDTH', 'width: 95%');
 }
 
@@ -118,8 +112,12 @@
 //
 
 echo "<html xmlns='http://www.w3.org/1999/xhtml'".(defined("TEXTDIRECTION") ? " dir='".TEXTDIRECTION."'" : "").(defined("CORE_LC") ? " xml:lang=\"".CORE_LC."\"" : "").">
-	<head>
-	<title>".SITENAME." : ".LAN_head_4."</title>\n";
+<head>
+<meta http-equiv='content-type' content='text/html; charset=".CHARSET."' />
+<meta http-equiv='content-style-type' content='text/css' />
+";
+echo (defined("CORE_LC")) ? "<meta http-equiv='content-language' content='".CORE_LC."' />\n" : "";
+echo "<title>".SITENAME." : ".LAN_head_4."</title>\n";
 
 //
 // D: Send JS
@@ -146,9 +144,8 @@
 	echo "\n<!-- eplug_js -->\n";
 	echo "<script type='text/javascript' src='{$eplug_js}'></script>\n";
 }
-if (isset($htmlarea_js) && $htmlarea_js) {
-	echo $htmlarea_js;
-}
+
+
 if ((strpos(e_SELF, 'fileinspector.php') === FALSE) && getperms("0")) 
 {
 echo "<script type='text/javascript'>
@@ -202,11 +199,6 @@
 //
 echo "<!-- *META* -->\n";
 
-// Multi-Language meta-tags with merge and override option.
-
-echo "<meta http-equiv='content-type' content='text/html; charset=".CHARSET."' />
-<meta http-equiv='content-style-type' content='text/css' />\n";
-
 // --- Load plugin Meta files and eplug_ before others --------
 if (is_array($pref['e_meta_list']))
 {
diff -x .svn -aruN 0.7.15.src/e107_admin/language.php 0.7.16.src/e107_admin/language.php
--- 0.7.15.src/e107_admin/language.php	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_admin/language.php	2009-03-26 16:55:12.000000000 -0500
@@ -11,8 +11,8 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_admin/language.php,v $
-|     $Revision: 1.42 $
-|     $Date: 2008/12/01 22:22:10 $
+|     $Revision: 1.43 $
+|     $Date: 2009/03/26 21:55:36 $
 |     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
@@ -281,7 +281,8 @@
     {
         $row = $sql->db_Fetch();
         $qry = $row[1];
-        $qry = str_replace($old, $new, $qry);
+//        $qry = str_replace($old, $new, $qry);
+		$qry = preg_replace("#CREATE\sTABLE\s`{0,1}".$old."`{0,1}\s#", "CREATE TABLE `{$new}` ", $qry, 1);	// More selective search
     }
     $result = mysql_query($qry);
     if(!$result)
diff -x .svn -aruN 0.7.15.src/e107_admin/links.php 0.7.16.src/e107_admin/links.php
--- 0.7.15.src/e107_admin/links.php	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_admin/links.php	2009-04-28 21:05:46.000000000 -0500
@@ -11,16 +11,16 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_admin/links.php,v $
-|     $Revision: 1.73 $
-|     $Date: 2008/09/23 19:37:30 $
-|     $Author: e107steved $
+|     $Revision: 1.75 $
+|     $Date: 2009/04/29 02:06:10 $
+|     $Author: bugrain $
 |
 | links.php?debug shows stored data for each link after name (before constant conversion)
 +----------------------------------------------------------------------------+
 */
 
 require_once('../class2.php');
-if (!getperms('I')) 
+if (!getperms('I'))
 {
   header('location:'.e_BASE.'index.php');
   exit;
@@ -47,7 +47,7 @@
 $linkpost = new links;
 
 $action = '';
-if (e_QUERY) 
+if (e_QUERY)
 {
   $tmp = explode('.', e_QUERY);
   $action = $tmp[0];
@@ -111,25 +111,25 @@
 	}
 }
 
-if ($incdec_action == 'inc') 
+if ($incdec_action == 'inc')
 {
   $sql->db_Update("links", "link_order=link_order+1 WHERE link_order='".intval($link_order-1)."'");
   $sql->db_Update("links", "link_order=link_order-1 WHERE link_id='".intval($linkid)."'");
 }
-elseif ($incdec_action =='dec') 
+elseif ($incdec_action =='dec')
 {
   $sql->db_Update("links", "link_order=link_order-1 WHERE link_order='".intval($link_order+1)."'");
   $sql->db_Update("links", "link_order=link_order+1 WHERE link_id='".intval($linkid)."'");
 }
 
-if (isset($_POST['update'])) 
+if (isset($_POST['update']))
 {
-	foreach ($_POST['link_order'] as $loid) 
+	foreach ($_POST['link_order'] as $loid)
 	{
 	  $tmp = explode(".", $loid);
 	  $sql->db_Update("links", "link_order=".intval($tmp[1])." WHERE link_id=".intval($tmp[0]));
 	}
-	foreach ($_POST['link_class'] as $lckey => $lcid) 
+	foreach ($_POST['link_class'] as $lckey => $lcid)
 	{
 	 	$sql->db_Update("links", "link_class='".$lcid."' WHERE link_id=".intval($lckey));
 	}
@@ -176,7 +176,7 @@
 	$linkpost->show_existing_items();
 }
 
-if ($action == 'debug') 
+if ($action == 'debug')
 {
   $linkpost->show_existing_items(TRUE);
 }
@@ -292,7 +292,7 @@
 	{
 		global $sql, $rs, $ns, $tp, $linkArray;
 		$this->debug_dis = $dbg_display;
-		
+
 		if (count($linkArray))
 		{
 
@@ -338,7 +338,7 @@
 		$this->aIdOptPrep = $this->prepOpts($this->aIdOptData);
 	}
 
-	function display_row($row2, $indent = FALSE) 
+	function display_row($row2, $indent = FALSE)
 	{
 		global $sql, $rs, $ns, $tp, $linkArray, $previous_cat;
 		extract($row2);
@@ -361,13 +361,13 @@
 		{
 			$link_name = $this->linkName( $link_name );
 		}
-		
+
 		if ($this->debug_dis)
 		{
 		  $link_name.= ' ['.$link_url.']';
 		}
 
-		if ($indent) 
+		if ($indent)
 		{
 		  $subimage = "<img src='".e_IMAGE."admin_images/sublink.png' alt='' />";
 		  $subspacer = ($indent > 1) ? " style='padding-left: ".(($indent - 1) * 16)."px'" : "";
@@ -381,7 +381,7 @@
 				<table cellspacing='0' cellpadding='0' border='0' style='width: 100%'>
 				<tr>
 			".$subindent."
-				<td style='".($indent ? "" : "font-weight:bold;")."width: 100%'>".$link_name."</td>
+				<td style='".($indent ? "" : "font-weight:bold;")."width: 100%'><a href='".$tp->replaceConstants(e_BASE.$row2['link_url'], true, true)."'>".$link_name."</a></td>
 				</tr>
 				</table>
 				</td>";
@@ -390,7 +390,7 @@
 		$text .= "<a href='".e_SELF."?create.edit.{$link_id}'>".ADMIN_EDIT_ICON."</a>&nbsp;";
 		$text .= "<input type='image' title='".LAN_DELETE."' name='main_delete_{$link_id}' src='".ADMIN_DELETE_ICON_PATH."' onclick=\"return jsconfirm('".$tp->toJS(LCLAN_58." [ $link_name ]")."') \" />";
 		$text .= "</td>";
-		$text .= "<td style='text-align:center' class='forumheader3'>".r_userclass("link_class[".$link_id."]", $link_class, "off", "public,guest,nobody,member,admin,classes")."</td>";
+		$text .= "<td style='text-align:center' class='forumheader3'>".r_userclass("link_class[".$link_id."]", $link_class, "off", "public,guest,nobody,main,member,admin,classes")."</td>";
 		$text .= "<td style='text-align:center; white-space: nowrap' class='forumheader3'>";
 		$name_suffix = URL_SEPARATOR.$link_id.URL_SEPARATOR.$link_order;
 		$text .= "<input name='inc".$name_suffix."' type='image' src='".e_IMAGE."admin_images/up.png' title='".LCLAN_30."' />";
@@ -533,7 +533,7 @@
 			</tr>
 			<tr>
 			<td style='width:30%' class='forumheader3'>".LCLAN_25.":<br /><span class='smalltext'>(".LCLAN_26.")</span></td>
-			<td style='width:70%' class='forumheader3'>".r_userclass("link_class", $link_class, "off", "public,guest,nobody,member,admin,classes")."
+			<td style='width:70%' class='forumheader3'>".r_userclass("link_class", $link_class, "off", "public,guest,nobody,member,main,admin,classes")."
 			</td></tr>
 
 			<tr style='vertical-align:top'>
@@ -553,10 +553,10 @@
 	}
 
 
-	function submit_link($sub_action, $id) 
+	function submit_link($sub_action, $id)
 	{
 		global $sql, $e107cache, $tp;
-		if(!is_object($tp)) 
+		if(!is_object($tp))
 		{
 		  $tp=new e_parse;
 		}
@@ -575,15 +575,15 @@
 		$link_class = $tp->toDB($_POST['link_class']);
 
 		$link_t = $sql->db_Count("links", "(*)");
-		if ($id) 
+		if ($id)
 		{
 		  $sql->db_Update("links", "link_parent='{$parent_id}', link_name='{$link_name}', link_url='{$link_url}', link_description='{$link_description}', link_button= '{$link_button}', link_category='{$link_render}', link_open='{$link_open}', link_class='{$link_class}' WHERE link_id='{$id}'");
 			//rename all sublinks to eliminate old embedded 'submenu' etc hierarchy.
 		    // this is for upgrade compatibility only. Current hierarchy uses link_parent.
 		  $e107cache->clear("sitelinks");
 		  $this->show_message(LCLAN_3);
-		} 
-		else 
+		}
+		else
 		{
 		  $sql->db_Insert("links", "0, '$link_name', '$link_url', '$link_description', '$link_button', ".$link_render.", ".($link_t+1).", ".$parent_id.", ".$link_open.", ".$link_class);
 		  $e107cache->clear("sitelinks");
@@ -634,7 +634,7 @@
 
 	// Delete link
 	// We need to update the 'order' number of other links with the same parentage - may be top level or a sub-level
-	function delete_link($linkInfo)	
+	function delete_link($linkInfo)
 	{
 		global $sql;
 
@@ -663,7 +663,7 @@
 
 // -------------------------- Sub links generator ------------->
 
-function show_sublink_generator() 
+function show_sublink_generator()
 {
 	global $ns,$sql;
 
@@ -736,17 +736,17 @@
 	$sublink_type['downloads']['fieldicon'] = "download_category_icon";
 
 
-	if ($sql -> db_Select("plugin", "plugin_path", "plugin_installflag = '1'")) 
+	if ($sql -> db_Select("plugin", "plugin_path", "plugin_installflag = '1'"))
 	{
-		while ($row = $sql -> db_Fetch()) 
+		while ($row = $sql -> db_Fetch())
 		{
 			$sublink_plugs[] = $row['plugin_path'];
 		}
 	}
 
-	foreach ($sublink_plugs as $plugin_id) 
+	foreach ($sublink_plugs as $plugin_id)
 	{
-		if (is_readable(e_PLUGIN.$plugin_id.'/e_linkgen.php')) 
+		if (is_readable(e_PLUGIN.$plugin_id.'/e_linkgen.php'))
 		{
 		  	require_once(e_PLUGIN.$plugin_id.'/e_linkgen.php');
 		}
@@ -787,7 +787,7 @@
 		$aPrep[$i++] = $sOut;
 		$sTxtPrev = $sTxt;
 	}
-	if ($i) 
+	if ($i)
 	{  // terminate final option
 		$aPrep[$i] = '>'.$sTxtPrev.'</option>';
 	}
@@ -821,10 +821,10 @@
 
 }
 
-function links_adminmenu() 
+function links_adminmenu()
 {
 	global $action;
-	if ($action == "") 
+	if ($action == "")
 	{
 		$action = "main";
 	}
diff -x .svn -aruN 0.7.15.src/e107_admin/mailout.php 0.7.16.src/e107_admin/mailout.php
--- 0.7.15.src/e107_admin/mailout.php	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_admin/mailout.php	2009-02-21 05:55:20.000000000 -0600
@@ -11,8 +11,8 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_admin/mailout.php,v $
-|     $Revision: 1.64 $
-|     $Date: 2008/07/28 21:33:20 $
+|     $Revision: 1.65 $
+|     $Date: 2009/02/21 11:55:44 $
 |     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
@@ -308,7 +308,7 @@
 	}
 
 	$debug = (e_MENU == "debug") ? "?[debug]" : "";
-	$text .= "<div style='".ADMIN_WIDTH." text-align:center'>
+	$text .= "<div style='".ADMIN_WIDTH."; text-align:center'>
 	<form method='post' action='".e_SELF.$debug."' id='mailout_form'>
 	<table class='fborder' style='".ADMIN_WIDTH."'  cellpadding='0' cellspacing='0'>
 	<tr>
@@ -549,7 +549,7 @@
 
 
 	$smtpdisp = ($pref['mailer'] != "smtp") ? "display:none;" : "";
-	$text .= "<div id='smtp' style='$smtpdisp text-align:right'><table style='margin-right:0px;margin-left:auto;border:0px'>";
+	$text .= "<div id='smtp' style='{$smtpdisp} text-align:right'><table style='margin-right:0px;margin-left:auto;border:0px'>";
 	$text .= "	<tr>
 	<td style='text-align:right' >".PRFLAN_72.":&nbsp;&nbsp;</td>
 	<td style='width:50%; text-align:right' >
@@ -595,7 +595,7 @@
 
 
 	$senddisp = ($pref['mailer'] != "sendmail") ? "display:none;" : "";
-	$text .= "<div id='sendmail' style='$senddisp text-align:right'><table style='margin-right:0px;margin-left:auto;border:0px'>";
+	$text .= "<div id='sendmail' style='{$senddisp} text-align:right'><table style='margin-right:0px;margin-left:auto;border:0px'>";
 	$text .= "
 
 	<tr>
@@ -701,16 +701,16 @@
 				$datestamp = $gen->convert_date($row2['gen_datestamp'], "short");
 
 				$text .= "<tr>
-				<td class='forumheader3' style='; text-align: center;'>".$row2['gen_id'] ."</td>
+				<td class='forumheader3' style='text-align: center;'>".$row2['gen_id'] ."</td>
 				<td class='forumheader3'>".$row2['user_name']."</td>
 				<td class='forumheader3'>".$row2['gen_ip']."</td>
 
-				<td class='forumheader3' style='; text-align: center;'>".$datestamp."</td>
+				<td class='forumheader3' style='text-align: center;'>".$datestamp."</td>
 
 				<td style='width:50px;white-space:nowrap' class='forumheader3'>
 				<div>
 				<input type='image' name='edit[{$row2['gen_id']}]' value='edit' src='".e_IMAGE."admin_images/edit_16.png' alt='".LAN_EDIT."' title='".LAN_EDIT."' style='border:0px' />
-				<input type='image' name='delete[{$row2['gen_id']}]' value='del' onclick=\"return jsconfirm('".$tp->toJS(LAN_CONFIRMDEL." [".$row2['gen_ip']."]")."') \" src='".e_IMAGE."admin_images/delete_16.png' alt='".LAN_DELETE."' title='".LAN_DELETE."' style='border:0px' />
+				<input type='image' name='delete[{$row2['gen_id']}]' value='del' onclick='return jsconfirm(\"".$tp->toJS(LAN_CONFIRMDEL." [".$row2['gen_ip']."]")."\")'  src='".e_IMAGE."admin_images/delete_16.png' alt='".LAN_DELETE."' title='".LAN_DELETE."' style='border:0px' />
 				</div>
 				</td>
 				</tr>
diff -x .svn -aruN 0.7.15.src/e107_admin/meta.php 0.7.16.src/e107_admin/meta.php
--- 0.7.15.src/e107_admin/meta.php	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_admin/meta.php	2009-08-03 13:35:40.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_admin/meta.php,v $
-|     $Revision: 1.18 $
-|     $Date: 2007/03/23 21:45:51 $
-|     $Author: lisa_ $
+|     $Revision: 1.19 $
+|     $Date: 2009/08/03 18:36:04 $
+|     $Author: marj_nl_fr $
 +----------------------------------------------------------------------------+
 */
 require_once("../class2.php");
@@ -24,7 +24,8 @@
 $e_sub_cat = 'meta';
 require_once("auth.php");
 
-$current_lang = ($sql->mySQLlanguage != "") ? $sql->mySQLlanguage : $pref['sitelanguage'];
+//$current_lang = ($sql->mySQLlanguage != "") ? $sql->mySQLlanguage : $pref['sitelanguage'];
+$current_lang = e_LANGUAGE;
 
 if (isset($_POST['metasubmit'])) {
 
@@ -38,11 +39,11 @@
 		$meta_author[$lan] = $pref['meta_author'][$lan];
 	}
 
-	$meta_tag[$current_lang] = strip_if_magic(chop($_POST['meta']));
-	$meta_diz[$current_lang] = strip_if_magic(chop($_POST['meta_description']));
-	$meta_keywords[$current_lang] = strip_if_magic(chop($_POST['meta_keywords']));
-	$meta_copyright[$current_lang] = strip_if_magic(chop($_POST['meta_copyright']));
-	$meta_author[$current_lang] = strip_if_magic(chop($_POST['meta_author']));
+	$meta_tag[e_LANGUAGE] = strip_if_magic(chop($_POST['meta']));
+	$meta_diz[e_LANGUAGE] = strip_if_magic(chop($_POST['meta_description']));
+	$meta_keywords[e_LANGUAGE] = strip_if_magic(chop($_POST['meta_keywords']));
+	$meta_copyright[e_LANGUAGE] = strip_if_magic(chop($_POST['meta_copyright']));
+	$meta_author[e_LANGUAGE] = strip_if_magic(chop($_POST['meta_author']));
 
     $pref['meta_news_summary'] = $_POST['meta_news_summary'];
 	$pref['meta_tag'] = $meta_tag;
@@ -52,8 +53,8 @@
 	$pref['meta_author'] = $meta_author;
 
    /*
-    if($pref['meta_tag'][$current_lang] == ""){
-        unset($meta_tag[$current_lang]);
+    if($pref['meta_tag'][e_LANGUAGE] == ""){
+        unset($meta_tag[e_LANGUAGE]);
     }*/
 
 	save_prefs();
@@ -61,7 +62,7 @@
 }
 
 if ($message) {
-	$ns->tablerender(METLAN_4, "<div style='text-align:center'>".METLAN_1." (".$current_lang.").</div>");
+	$ns->tablerender(METLAN_4, "<div style='text-align:center'>".METLAN_1." (".e_LANGUAGE.").</div>");
 }
 
 $meta = $pref['meta_tag'];
@@ -77,28 +78,28 @@
 	<tr>
     <td style='width:25%' class='forumheader3'>".METLAN_9."</td>
     <td style='width:75%' class='forumheader3'>
-	<textarea class='tbox' title='meta_description' id='meta_description' name='meta_description' cols='70' rows='4' style='width:90%'>".$tp->toForm($meta_diz[$current_lang])."</textarea>
+	<textarea class='tbox' title='meta_description' id='meta_description' name='meta_description' cols='70' rows='4' style='width:90%'>".$tp->toForm($meta_diz[e_LANGUAGE])."</textarea>
 	</td>
 	</tr>
 
 	<tr>
 	<td style='width:25%' class='forumheader3'>".METLAN_10."</td>
     <td style='width:75%' class='forumheader3'>
-	<textarea class='tbox' title='meta_keywords' id='meta_keywords' name='meta_keywords' cols='70' rows='4' style='width:90%'>".$tp->toForm($meta_keywords[$current_lang])."</textarea>
+	<textarea class='tbox' title='meta_keywords' id='meta_keywords' name='meta_keywords' cols='70' rows='4' style='width:90%'>".$tp->toForm($meta_keywords[e_LANGUAGE])."</textarea>
 	</td>
 	</tr>
 
 	<tr>
 	<td style='width:25%' class='forumheader3'>".METLAN_11."</td>
     <td style='width:75%' class='forumheader3'>
-	<input class='tbox' style='width:90%' size='70' type='text' name='meta_copyright' value='".$meta_copyright[$current_lang]."' />
+	<input class='tbox' style='width:90%' size='70' type='text' name='meta_copyright' value='".$meta_copyright[e_LANGUAGE]."' />
 	</td>
 	</tr>
 
 	<tr>
 	<td style='width:25%' class='forumheader3'>".METLAN_13."</td>
     <td style='width:75%' class='forumheader3'>
-	<input class='tbox' style='width:90%' size='70' type='text' name='meta_author' value=\"".$meta_author[$current_lang]."\" />
+	<input class='tbox' style='width:90%' size='70' type='text' name='meta_author' value=\"".$meta_author[e_LANGUAGE]."\" />
 	</td>
 	</tr>
 
@@ -109,7 +110,7 @@
 	</td>
 	<td style='width:75%' class='forumheader3'>
 	<textarea class='tbox' title=\"eg. <meta name='author' content='your name' />\" id='meta' name='meta' cols='70'
-	rows='10' style='width:90%' onselect='storeCaret(this);' onclick='storeCaret(this);' onkeyup='storeCaret(this);'>".str_replace("<","&lt;",$tp->toForm($meta[$current_lang]))."</textarea>
+	rows='10' style='width:90%' onselect='storeCaret(this);' onclick='storeCaret(this);' onkeyup='storeCaret(this);'>".str_replace("<","&lt;",$tp->toForm($meta[e_LANGUAGE]))."</textarea>
 	<br />";
 $text .= "</td>
 </tr>
@@ -134,7 +135,7 @@
 
 
 
-$ns -> tablerender(METLAN_8." (".$current_lang.")", $text);
+$ns -> tablerender(METLAN_8." (".e_LANGUAGE.")", $text);
 
 require_once("footer.php");
 
diff -x .svn -aruN 0.7.15.src/e107_admin/modcomment.php 0.7.16.src/e107_admin/modcomment.php
--- 0.7.15.src/e107_admin/modcomment.php	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_admin/modcomment.php	2009-05-08 16:41:31.000000000 -0500
@@ -11,8 +11,8 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_admin/modcomment.php,v $
-|     $Revision: 1.18 $
-|     $Date: 2008/11/23 21:12:05 $
+|     $Revision: 1.21 $
+|     $Date: 2009/05/08 21:41:55 $
 |     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
@@ -32,16 +32,23 @@
 $editid	= intval($tmp[2]);
 $type	= $cobj -> getCommentType($table);
 
-if (isset($_POST['moderate'])) {
-	if (isset($_POST['comment_comment'])) {
-		$sql->db_Update("comments", "comment_comment='".$tp -> todb($_POST['comment_comment'])."' WHERE comment_id='$editid' ");
-		header("location: ".e_ADMIN."modcomment.php?{$table}.{$id}"); exit;
+if (isset($_POST['moderate'])) 
+{
+	if (isset($_POST['comment_comment'])) 
+	{
+		$sql->db_Update('comments', "comment_comment='".$tp -> todb($_POST['comment_comment'])."' WHERE comment_id=".$editid);
+		header("location: ".e_ADMIN."modcomment.php?{$table}.{$id}"); 
+		exit;
 	}
-	if (isset($_POST['comment_lock']) && $_POST['comment_lock'] == "1" && $_POST['comment_lock'] != $_POST['current_lock']) {
-		$sql->db_Update("comments", "comment_lock='1' WHERE comment_item_id='$id' ");
+
+	if (isset($_POST['comment_lock']) && $_POST['comment_lock'] == "1" && $_POST['comment_lock'] != $_POST['current_lock']) 
+	{
+		$sql->db_Update('comments', "comment_lock='1' WHERE `comment_item_id`=".$id." AND `comment_type`='".$tp -> toDB($type, true)."' ");
 	}
-	if ((!isset($_POST['comment_lock']) || $_POST['comment_lock'] == "0") && $_POST['comment_lock'] != $_POST['current_lock']) {
-		$sql->db_Update("comments", "comment_lock='0' WHERE comment_item_id='$id' ");
+
+	if ((!isset($_POST['comment_lock']) || $_POST['comment_lock'] == "0") && $_POST['comment_lock'] != $_POST['current_lock']) 
+	{
+		$sql->db_Update('comments', "comment_lock='0' WHERE `comment_item_id`=".$id." AND `comment_type`='".$tp -> toDB($type, true)."' ");
 	}
 	if (is_array($_POST['comment_blocked'])) {
 		while (list ($key, $cid) = each ($_POST['comment_blocked'])) {
@@ -53,9 +60,12 @@
 			$sql->db_Update("comments", "comment_blocked='0' WHERE comment_id='$cid' ");
 		}
 	}
-	if (is_array($_POST['comment_delete'])) {
-		while (list ($key, $cid) = each ($_POST['comment_delete'])) {
-			if ($sql->db_Select("comments", "*", "comment_id='$cid' ")) {
+	if (is_array($_POST['comment_delete'])) 
+	{
+		while (list ($key, $cid) = each ($_POST['comment_delete'])) 
+		{
+			if ($sql->db_Select('comments', "*", "comment_id='$cid' ")) 
+			{
 				$row = $sql->db_Fetch();
 				delete_children($row, $cid);
 			}
@@ -157,24 +167,32 @@
 
 require_once("footer.php");
 
-function delete_children($row, $cid) {
+
+
+function delete_children($row, $cid) 
+{
 	global $sql, $sql2, $table;
 
 	$tmp = explode(".", $row['comment_author']);
-	$u_id = $tmp[0];
-	if ($u_id >= 1) {
-		$sql->db_Update("user", "user_comments=user_comments-1 WHERE user_id='$u_id'");
+	$u_id = intval($tmp[0]);
+	if ($u_id >= 1) 
+	{
+		$sql->db_Update("user", "user_comments=user_comments-1 WHERE user_id=".$u_id);
 	}
-	if($table == "news"){
+	if (($table == "news") || ($table == '0'))
+	{
 		$sql->db_Update("news", "news_comment_total=news_comment_total-1 WHERE news_id='".$row['comment_item_id']."'");
 	}
-	if ($sql2->db_Select("comments", "*", "comment_pid='".$row['comment_id']."'")) {
-		while ($row2 = $sql2->db_Fetch()) {
+	if ($sql2->db_Select("comments", "*", "comment_pid='".$row['comment_id']."'")) 
+	{
+		while ($row2 = $sql2->db_Fetch()) 
+		{
 			delete_children($row2, $row2['comment_id']);
 		}
 	}
 	$c_del[] = $cid;
-	while (list ($key, $cid) = each ($c_del)) {
+	while (list ($key, $cid) = each ($c_del)) 
+	{
 		$sql->db_Delete("comments", "comment_id='$cid'");
 	}
 }
diff -x .svn -aruN 0.7.15.src/e107_admin/newspost.php 0.7.16.src/e107_admin/newspost.php
--- 0.7.15.src/e107_admin/newspost.php	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_admin/newspost.php	2009-04-19 15:53:55.000000000 -0500
@@ -11,8 +11,8 @@
 |        GNU General Public License (http://gnu.org).
 |
 |   $Source: /cvsroot/e107/e107_0.7/e107_admin/newspost.php,v $
-|   $Revision: 1.148 $
-|   $Date: 2008/06/15 20:20:28 $
+|   $Revision: 1.150 $
+|   $Date: 2009/04/19 20:54:19 $
 |   $Author: e107steved $
 +---------------------------------------------------------------+
 
@@ -59,13 +59,13 @@
 
 if (e_QUERY) 
 {
-  $tmp = explode(".", e_QUERY);
-  $action = $tmp[0];
-  $sub_action = varset($tmp[1],'');
-  $id = intval(varset($tmp[2],0));
-  $sort_order = varset($tmp[2],'desc');
-  $from = intval(varset($tmp[3],0));
-  unset($tmp);
+	$tmp = explode(".", e_QUERY);
+	$action = $tmp[0];
+	$sub_action = varset($tmp[1],'');
+	$id = intval(varset($tmp[2],0));
+	$sort_order = varset($tmp[2],'desc');
+	$from = intval(varset($tmp[3],0));
+	unset($tmp);
 }
 
 $from = ($from ? $from : 0);
@@ -79,6 +79,28 @@
 }
 
 
+
+if (isset($_POST['news_comments_recalc']))
+{
+$qry = "SELECT 
+		COUNT(`comment_id`) AS c_count,
+		`comment_item_id`
+		FROM `#comments`
+		WHERE (`comment_type`='0') OR (`comment_type`='news')
+		GROUP BY `comment_item_id`";
+		
+	if ($sql->db_Select_gen($qry))
+	{
+		while ($row = $sql->db_Fetch(MYSQL_ASSOC))
+		{
+			$sql2->db_Update('news', 'news_comment_total = '.$row['c_count'].' WHERE news_id='.$row['comment_item_id']);
+		}
+	}
+	$newspost->show_message(LAN_NEWS_53);
+}
+
+
+
 if(isset($_POST['delete']))
 {
 	$tmp = array_keys($_POST['delete']);
@@ -266,6 +288,13 @@
 
 
 
+if ($action == 'maint') 
+{
+	$newspost->show_maintenance($sub_action, $id);
+}
+
+
+
 if ($action == "sn") 
 {
 	$newspost->submitted_news($sub_action, $id);
@@ -378,7 +407,8 @@
 	}
 
 
-	function show_options($action) {
+	function show_options($action) 
+	{
 		global $sql;
 
 		if ($action == "") {
@@ -397,11 +427,18 @@
 		$var['pref']['text'] = NWSLAN_90;
 		$var['pref']['link'] = e_SELF."?pref";
 		$var['pref']['perm'] = "N";
-		if ($sql->db_Select("submitnews", "*", "submitnews_auth ='0' ")) {
+		if ($sql->db_Select("submitnews", "*", "submitnews_auth ='0' ")) 
+		{
 			$var['sn']['text'] = NWSLAN_47;
 			$var['sn']['link'] = e_SELF."?sn";
 			$var['sn']['perm'] = "N";
 		}
+		if (getperms('0'))
+		{
+		$var['maint']['text'] = LAN_NEWS_50;
+		$var['maint']['link'] = e_SELF."?maint";
+		$var['maint']['perm'] = "N";
+		}
 
 		show_admin_menu(NWSLAN_48, $action, $var);
 
@@ -492,8 +529,8 @@
 		<td style='width:80%;margin-left:auto' class='forumheader3'>";
 
 		$insertjs = (!e_WYSIWYG) ? "rows='15' onselect='storeCaret(this);' onclick='storeCaret(this);' onkeyup='storeCaret(this);'": "rows='25' ";
-		$_POST['data'] = $tp->toForm($_POST['data']);
-		$text .= "<textarea class='tbox' id='data' name='data'  cols='80'  style='width:100%' $insertjs>".(strstr($tp->post_toForm($_POST['data']), "[img]http") ? $_POST['data'] : str_replace("[img]../", "[img]", $tp->post_toForm($_POST['data'])))."</textarea>
+//		$_POST['data'] = $tp->toForm($_POST['data']);
+		$text .= "<textarea class='tbox' id='data' name='data'  cols='80'  style='width:100%' $insertjs>".(strstr($tp->post_toForm($_POST['data']), "[img]http") ? $tp->post_toForm($_POST['data']) : str_replace("[img]../", "[img]", $tp->post_toForm($_POST['data'])))."</textarea>
 		";
         $text .= display_help("helpb", 'news');
 
@@ -745,7 +782,8 @@
 	}
 
 
-	function preview_item($id) {
+	function preview_item($id) 
+	{
 		// ##### Display news preview ---------------------------------------------------------------------------------------------------------
 		global $tp, $sql, $ix, $IMAGES_DIRECTORY;
 
@@ -793,14 +831,18 @@
 		$_PR = $_POST;
 
 
-		$_PR['news_body'] = $tp->post_toHTML($_PR['data'],FALSE);
+/*		$_PR['news_body'] = $tp->post_toHTML($_PR['data'],FALSE);
 		$_PR['news_title'] = $tp->post_toHTML($_PR['news_title'],FALSE,"emotes_off, no_make_clickable");
 		$_PR['news_summary'] = $tp->post_toHTML($_PR['news_summary']);
-		$_PR['news_extended'] = $tp->post_toHTML($_PR['news_extended']);
+		$_PR['news_extended'] = $tp->post_toHTML($_PR['news_extended']);  */
+		$_PR['news_body'] = $tp->toDB($_PR['data']);
+		$_PR['news_title'] = $tp->toDB($_PR['news_title']);
+		$_PR['news_summary'] = $tp->toDB($_PR['news_summary']);
+		$_PR['news_extended'] = $tp->toDB($_PR['news_extended']);
 		$_PR['news_file'] = $_POST['news_file'];
 		$_PR['news_image'] = $_POST['news_image'];
 
-		$ix -> render_newsitem($_PR);
+		$ix->render_newsitem($_PR);
 		echo $tp -> parseTemplate('{NEWSINFO}', FALSE, $news_shortcodes);
 	}
 
@@ -867,6 +909,7 @@
 		$ns->tablerender("", "<div style='text-align:center'><b>".$message."</b></div>");
 	}
 
+
 	function show_categories($sub_action, $id) {
 		global $sql, $rs, $ns, $tp;
 		$handle = opendir(e_IMAGE."icons");
@@ -956,7 +999,10 @@
 		$ns->tablerender(NWSLAN_51, $text);
 	}
 
-	function show_news_prefs() {
+
+
+	function show_news_prefs() 
+	{
 		global $sql, $rs, $ns, $pref;
 
 		$text = "<div style='text-align:center'>
@@ -1094,6 +1140,27 @@
 
 
 
+	function show_maintenance() 
+	{
+		global $sql, $rs, $ns, $pref;
+
+		$text = "<div style='text-align:center'>
+		".$rs->form_open("post", e_SELF."?maint", "dataform")."
+		<table class='fborder' style='".ADMIN_WIDTH."'>
+
+		<tr><td class='forumheader3'>".LAN_NEWS_51."</td><td style='text-align:center' class='forumheader3'>";
+		$text .= "<input class='button' type='submit' name='news_comments_recalc' value='".LAN_NEWS_52."' /></td></tr>";
+
+		$text .= "</table>
+		".$rs->form_close()."
+		</div>";
+
+		$ns->tablerender(LAN_NEWS_54, $text);
+	}
+
+
+
+
 	function submitted_news($sub_action, $id) 
 	{
 		global $rs, $ns, $tp;
@@ -1138,7 +1205,8 @@
 
 }
 
-function newspost_adminmenu() {
+function newspost_adminmenu() 
+{
 	global $newspost;
 	global $action;
 	$newspost->show_options($action);
diff -x .svn -aruN 0.7.15.src/e107_admin/plugin.php 0.7.16.src/e107_admin/plugin.php
--- 0.7.15.src/e107_admin/plugin.php	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_admin/plugin.php	2009-05-19 16:23:54.000000000 -0500
@@ -11,14 +11,15 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_admin/plugin.php,v $
-|     $Revision: 1.74 $
-|     $Date: 2008/04/05 07:58:28 $
+|     $Revision: 1.75 $
+|     $Date: 2009/05/19 21:24:18 $
 |     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 
 require_once("../class2.php");
-if (!getperms("Z")) {
+if (!getperms("Z")) 
+{
 	header("location:".e_BASE."index.php");
 	exit;
 }
@@ -32,17 +33,22 @@
 $action = $tmp[0];
 $id = intval($tmp[1]);
 
-if (isset($_POST['upload'])) {
-	if (!$_POST['ac'] == md5(ADMINPWCHANGE)) {
+if (isset($_POST['upload'])) 
+{
+	if (!$_POST['ac'] == md5(ADMINPWCHANGE)) 
+	{
 		exit;
 	}
 
 	extract($_FILES);
 	/* check if e_PLUGIN dir is writable ... */
-	if(!is_writable(e_PLUGIN)) {
+	if(!is_writable(e_PLUGIN))
+	{
 		/* still not writable - spawn error message */
 		$ns->tablerender(EPL_ADLAN_40, EPL_ADLAN_39);
-	} else {
+	}
+	else
+	{
 		/* e_PLUGIN is writable - continue */
 		$pref['upload_storagetype'] = "1";
 		require_once(e_HANDLER."upload_handler.php");
@@ -50,18 +56,24 @@
 		$fileSize = $file_userfile['size'][0];
 		$fileType = $file_userfile['type'][0];
 
-		if(strstr($file_userfile['type'][0], "gzip")) {
+		if(strstr($file_userfile['type'][0], "gzip"))
+		{
 			$fileType = "tar";
-		} else if (strstr($file_userfile['type'][0], "zip")) {
+		}
+		else if (strstr($file_userfile['type'][0], "zip"))
+		{
 			$fileType = "zip";
-		} else {
+		}
+		else
+		{
 			/* not zip or tar - spawn error message */
 			$ns->tablerender(EPL_ADLAN_40, EPL_ADLAN_41);
 			require_once("footer.php");
 			exit;
 		}
 
-		if ($fileSize) {
+		if ($fileSize)
+		{
 
 			$opref = $pref['upload_storagetype'];
 			$pref['upload_storagetype'] = 1;		/* temporarily set upload type pref to flatfile */
@@ -72,20 +84,27 @@
 
 			/* attempt to unarchive ... */
 
-			if($fileType == "zip") {
+			if($fileType == "zip")
+			{
 				require_once(e_HANDLER."pclzip.lib.php");
 				$archive = new PclZip(e_PLUGIN.$archiveName);
 				$unarc = ($fileList = $archive -> extract(PCLZIP_OPT_PATH, e_PLUGIN, PCLZIP_OPT_SET_CHMOD, 0666));
-			} else {
+			}
+			else
+			{
 				require_once(e_HANDLER."pcltar.lib.php");
 				$unarc = ($fileList = PclTarExtract($archiveName, e_PLUGIN));
 			}
 
-			if(!$unarc) {
+			if(!$unarc)
+			{
 				/* unarc failed ... */
-				if($fileType == "zip") {
+				if($fileType == "zip")
+				{
 					$error = EPL_ADLAN_46." '".$archive -> errorName(TRUE)."'";
-				} else {
+				}
+				else
+				{
 					$error = EPL_ADLAN_47.PclErrorString().", ".EPL_ADLAN_48.intval(PclErrorCode());
 				}
 				$ns->tablerender(EPL_ADLAN_40, EPL_ADLAN_42." ".$archiveName." ".$error);
@@ -101,7 +120,9 @@
 			if(file_exists(e_PLUGIN.$folderName."/plugin.php")) {
 				/* upload is a plugin */
 				$ns->tablerender(EPL_ADLAN_40, EPL_ADLAN_43);
-			} else {
+			}
+			else
+			{
 				/* upload is a menu */
 				$ns->tablerender(EPL_ADLAN_40, EPL_ADLAN_45);
 			}
@@ -129,7 +150,8 @@
 		include(e_PLUGIN.$plug['plugin_path'].'/plugin.php');
 
 		$func = $eplug_folder.'_uninstall';
-		if (function_exists($func)) {
+			if (function_exists($func))
+			{
 			$text .= call_user_func($func);
 		}
 
@@ -153,25 +175,29 @@
 			$text .= EPL_ADLAN_49."<br />";
 		}
 
-		if (is_array($eplug_prefs)) {
+			if (is_array($eplug_prefs))
+			{
 			$plugin->manage_prefs('remove', $eplug_prefs);
 			$text .= EPL_ADLAN_29."<br />";
 		}
 
-		if (is_array($eplug_comment_ids)) {
+			if (is_array($eplug_comment_ids))
+			{
 			$text .= ($plugin->manage_comments('remove', $eplug_comment_ids)) ? EPL_ADLAN_50."<br />" : "";
 		}
 
 
-		if ($eplug_module) {
+		if ($eplug_module) 
+		{
 			$plugin->manage_plugin_prefs('remove', 'modules', $eplug_folder);
 		}
-
-		if ($eplug_status) {
+			if ($eplug_status)
+			{
 			$plugin->manage_plugin_prefs('remove', 'plug_status', $eplug_folder);
 		}
 
-		if ($eplug_latest) {
+			if ($eplug_latest)
+			{
 			$plugin->manage_plugin_prefs('remove', 'plug_latest', $eplug_folder);
 		}
 
@@ -217,11 +243,13 @@
 			$sql->db_Delete('menus', "menu_name='$eplug_menu_name' ");
 		}
 
-		if ($eplug_link) {
+			if ($eplug_link)
+			{
 			$plugin->manage_link('remove', $eplug_link_url, $eplug_link_name);
 		}
 
-		if ($eplug_userclass) {
+			if ($eplug_userclass)
+			{
 			$plugin->manage_userclass('remove', $eplug_userclass);
 		}
 
@@ -259,39 +287,54 @@
 	$plugin ->save_addon_prefs();
 }
 
-if ($action == 'upgrade') {
+if ($action == 'upgrade')
+{
 	$plug = $plugin->getinfo($id);
 	include(e_PLUGIN.$plug['plugin_path'].'/plugin.php');
 
 	$func = $eplug_folder.'_upgrade';
-	if (function_exists($func)) {
+		if (function_exists($func))
+		{
 		$text .= call_user_func($func);
 	}
 
-	if (is_array($upgrade_alter_tables)) {
+		if (is_array($upgrade_alter_tables))
+		{
 		$result = $plugin->manage_tables('upgrade', $upgrade_alter_tables);
-		if (!$result) {
+			if (!$result)
+			{
 			$text .= EPL_ADLAN_9.'<br />';
-		} else {
+			}
+			else
+			{
 			$text .= EPL_ADLAN_7."<br />";
 		}
 	}
 
-	if ($eplug_module) {
+	if ($eplug_module) 
+	{
 		$plugin->manage_plugin_prefs('add', 'modules', $eplug_folder);
-	} else {
+		}
+		else
+		{
 		$plugin->manage_plugin_prefs('remove', 'modules', $eplug_folder);
 	}
 
-	if ($eplug_status) {
+		if ($eplug_status)
+		{
 		$plugin->manage_plugin_prefs('add', 'plug_status', $eplug_folder);
-	} else {
+		}
+		else
+		{
 		$plugin->manage_plugin_prefs('remove', 'plug_status', $eplug_folder);
 	}
 
-	if ($eplug_latest) {
+		if ($eplug_latest)
+		{
 		$plugin->manage_plugin_prefs('add', 'plug_latest', $eplug_folder);
-	} else {
+		}
+		else
+		{
 		$plugin->manage_plugin_prefs('remove', 'plug_latest', $eplug_folder);
 	}
 
@@ -315,12 +358,14 @@
 		$plugin->manage_plugin_prefs('remove', 'plug_bb', $eplug_folder, $eplug_bb);
 	}
 
-	if (is_array($upgrade_add_prefs)) {
+	if (is_array($upgrade_add_prefs)) 
+	{
 		$plugin->manage_prefs('add', $upgrade_add_prefs);
 		$text .= EPL_ADLAN_8.'<br />';
 	}
 
-	if (is_array($upgrade_remove_prefs)) {
+		if (is_array($upgrade_remove_prefs))
+		{
 		$plugin->manage_prefs('remove', $upgrade_remove_prefs);
 	}
 
@@ -395,9 +440,12 @@
 
 /* plugin upload form */
 
-if(!is_writable(e_PLUGIN)) {
+if(!is_writable(e_PLUGIN))
+{
 	$ns->tablerender(EPL_ADLAN_40, EPL_ADLAN_44);
-} else {
+} 
+else 
+{
 	$text = "<div style='text-align:center'>
 	<form enctype='multipart/form-data' method='post' action='".e_SELF."'>
 	<table style='".ADMIN_WIDTH."' class='fborder'>
@@ -435,7 +483,8 @@
 
 	if (empty($pluginList)) return '';
 
-	foreach($pluginList as $plug) {
+	foreach($pluginList as $plug) 
+	{
 	//Unset any possible eplug_ variables set by last plugin.php
 		$defined_vars = array_keys(get_defined_vars());
 		foreach($defined_vars as $varname) {
@@ -497,14 +546,20 @@
 
 		$text .= "</table></td>";
 		$text .= "<td class='forumheader3' style='width:70px;text-align:center'>";
-    	if ($eplug_conffile || $eplug_module || is_array($eplug_table_names) || is_array($eplug_prefs) || is_array($eplug_user_prefs) || is_array($eplug_sc) || is_array($eplug_bb) || $eplug_status || $eplug_latest) {
+    	if ($eplug_conffile || $eplug_module || $eplug_link || is_array($eplug_table_names) || is_array($eplug_prefs) || is_array($eplug_user_prefs) || is_array($eplug_sc) || is_array($eplug_bb) || $eplug_status || $eplug_latest) {
 			$text .= ($plug['plugin_installflag'] ? "<input type='button' class='button' onclick=\"location.href='".e_SELF."?uninstall.{$plug['plugin_id']}'\" title='".EPL_ADLAN_1."' value='".EPL_ADLAN_1."' /> " : "<input type='button' class='button' onclick=\"location.href='".e_SELF."?install.{$plug['plugin_id']}'\" title='".EPL_ADLAN_0."' value='".EPL_ADLAN_0."' />");
-		} else {
-	   		if ($eplug_menu_name) {
+		} 
+		else 
+		{
+	   		if ($eplug_menu_name) 
+			{
 				$text .= EPL_NOINSTALL.str_replace("..", "", e_PLUGIN.$plug['plugin_path'])."/ ".EPL_DIRECTORY;
-			} else {
+			} 
+			else 
+			{
 				$text .= EPL_NOINSTALL_1.str_replace("..", "", e_PLUGIN.$plug['plugin_path'])."/ ".EPL_DIRECTORY;
-				if($plug['plugin_installflag'] == FALSE){
+				if($plug['plugin_installflag'] == FALSE)
+				{
 					global $sql;
 					$sql->db_Delete('plugin', "plugin_installflag=0 AND (plugin_path='{$plug['plugin_path']}' OR plugin_path='{$plug['plugin_path']}/' )  ");
 				}
diff -x .svn -aruN 0.7.15.src/e107_admin/prefs.php 0.7.16.src/e107_admin/prefs.php
--- 0.7.15.src/e107_admin/prefs.php	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_admin/prefs.php	2008-12-31 11:07:45.000000000 -0600
@@ -11,8 +11,8 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_admin/prefs.php,v $
-|     $Revision: 1.104 $
-|     $Date: 2008/06/29 16:40:23 $
+|     $Revision: 1.106 $
+|     $Date: 2008/12/31 17:08:08 $
 |     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
@@ -64,6 +64,8 @@
 	  'antiflood_timeout' => array('min' => 3, 'max' => 300, 'default' => 10)
 	);
 
+	$pref['post_html'] = intval($_POST['post_html']);			// This ensures the setting is reflected in set text
+
 	foreach($_POST as $key => $value)
 	{
 	  if (isset($pref_limits[$key]))
@@ -530,7 +532,7 @@
 	<tr>
 	<td style='width:50%' class='forumheader3'>".PRFLAN_155.":</td>
 	<td class='forumheader3' style='width:50%;text-align:right' >
-	".r_userclass('displayname_class',$pref['displayname_class'],'off','nobody,public,admin,classes')."
+	".r_userclass('displayname_class',$pref['displayname_class'],'off','nobody,public,member,admin,classes')."
 	<input class='button' type='submit' name='submit_resetdisplaynames' value='".PRFLAN_156."' />
 	</td>
 	</tr>
diff -x .svn -aruN 0.7.15.src/e107_admin/userclass2.php 0.7.16.src/e107_admin/userclass2.php
--- 0.7.15.src/e107_admin/userclass2.php	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_admin/userclass2.php	2009-07-14 15:59:18.000000000 -0500
@@ -11,8 +11,8 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_admin/userclass2.php,v $
-|     $Revision: 1.23 $
-|     $Date: 2008/07/09 20:37:22 $
+|     $Revision: 1.25 $
+|     $Date: 2009/07/14 20:59:42 $
 |     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
@@ -85,10 +85,11 @@
 
 if (isset($_POST['delete']))
 {
-	$class_id = $_POST['existing'];
+	$class_id = intval($_POST['existing']);
 	check_allowed($class_id);
-	if ($_POST['confirm']) {
-		$sql->db_Delete('userclass_classes', "userclass_id='".$_POST['existing']."' ");
+	if ($_POST['confirm']) 
+	{
+		$sql->db_Delete('userclass_classes', "userclass_id=".$class_id);
 		if ($sql->db_Select('user', 'user_id, user_class', "user_class = '{$class_id}' OR user_class REGEXP('^{$class_id},') OR user_class REGEXP(',{$class_id},') OR user_class REGEXP(',{$class_id}$')"))
 		{
 			while ($row = $sql->db_Fetch())
@@ -112,18 +113,21 @@
 
 if(isset($_POST['edit']))
 {
-	check_allowed($_POST['existing']);
-	$sql->db_Select('userclass_classes', '*', "userclass_id='".$_POST['existing']."' ");
+	$class_id = intval($_POST['existing']);
+	check_allowed($class_id);
+	$sql->db_Select('userclass_classes', '*', "userclass_id=".$class_id);
 	$row = $sql->db_Fetch();
 	extract($row);
 }
 
 if (isset($_POST['updateclass']))
 {
-	check_allowed($_POST['userclass_id']);
+	$class_id = intval($_POST['userclass_id']);
+	check_allowed($class_id);
 	$_POST['userclass_name'] = $tp->toDB($_POST['userclass_name']);
 	$_POST['userclass_description'] = $tp->toDB($_POST['userclass_description']);
-	$sql->db_Update('userclass_classes', "userclass_editclass={$_POST['userclass_editclass']}, userclass_name='".$_POST['userclass_name']."', userclass_description='".$_POST['userclass_description']."' WHERE userclass_id='".$_POST['userclass_id']."' ");
+	$_POST['userclass_editclass'] = intval($_POST['userclass_editclass']);
+	$sql->db_Update('userclass_classes', "userclass_editclass={$_POST['userclass_editclass']}, userclass_name='".$_POST['userclass_name']."', userclass_description='".$_POST['userclass_description']."' WHERE userclass_id=".$class_id);
 	$message = UCSLAN_5;
 }
 
@@ -134,14 +138,15 @@
 		$_POST['userclass_name'] = $tp->toDB($_POST['userclass_name']);
 		$_POST['userclass_description'] = $tp->toDB($_POST['userclass_description']);
 
-		if (getperms("0") || check_class($_POST['userclass_editclass']) && $_POST['userclass_editclass']) {
-			$editclass = $_POST['userclass_editclass'];
+		$editclass = intval(varset($_POST['userclass_editclass'], 0));
+		if ($editclass && (getperms('0') || check_class($editclass))) 
+		{
 			$i = 1;
 			while ($sql->db_Select('userclass_classes', '*', "userclass_id='".$i."' ") && $i < 255)
 			{
 				$i++;
 			}
-			if ($i < 255)
+			if ($i < 245)
 			{
 				$sql->db_Insert("userclass_classes", $i.", '".strip_tags($_POST['userclass_name'])."', '".$_POST['userclass_description']."',{$editclass} ");
 			}
diff -x .svn -aruN 0.7.15.src/e107_admin/userinfo.php 0.7.16.src/e107_admin/userinfo.php
--- 0.7.15.src/e107_admin/userinfo.php	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_admin/userinfo.php	2009-08-23 05:39:28.000000000 -0500
@@ -11,30 +11,43 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_admin/userinfo.php,v $
-|     $Revision: 1.10 $
-|     $Date: 2006/10/28 10:09:17 $
-|     $Author: lisa_ $
+|     $Revision: 1.11 $
+|     $Date: 2009/08/23 10:39:52 $
+|     $Author: marj_nl_fr $
 +----------------------------------------------------------------------------+
 */
 require_once("../class2.php");
-if (!getperms("4")) {
+if (!getperms("4"))
+{
 	header("location:".e_BASE."index.php");
 	 exit;
 }
 $e_sub_cat = 'users';
 require_once("auth.php");
 
-if (!e_QUERY) {
+if ( ! e_QUERY)
+{
 	$text = "<div style=\"text-align:center\">".USFLAN_1."</div>";
 	$ns->tablerender(LAN_ERROR, $text);
 	require_once("footer.php");
-	exit;
-} else {
+	exit();
+}
+else
+{
 	$ipd = e_QUERY;
 }
 
-if (isset($ipd)) {
-	if(!defined("BULLET")) define("BULLET", "bullet2.gif");
+if (isset($ipd))
+{
+	$bullet = '';
+	if(defined('BULLET'))
+	{
+		$bullet = '<img src="'.THEME.'images/'.BULLET.'" alt="" style="vertical-align: middle;" />';
+	}
+	elseif(file_exists(THEME.'images/bullet2.gif'))
+	{
+		$bullet = '<img src="'.THEME.'images/bullet2.gif" alt="" style="vertical-align: middle;" />';
+	}
 
 	$obj = new convert;
 	$sql->db_Select("chatbox", "*", "cb_ip='$ipd' LIMIT 0,20");
@@ -43,24 +56,37 @@
 		<i><a href=\"banlist.php?".$ipd."\">".USFLAN_5."</a></i>
 
 		<br /><br />";
-	while (list($cb_id, $cb_nick, $cb_message, $cb_datestamp, $cb_blocked, $cb_ip ) = $sql->db_Fetch()) {
+	while (list($cb_id, $cb_nick, $cb_message, $cb_datestamp, $cb_blocked, $cb_ip ) = $sql->db_Fetch())
+	{
 		$datestamp = $obj->convert_date($cb_datestamp, "short");
 		$post_author_id = substr($cb_nick, 0, strpos($cb_nick, "."));
 		$post_author_name = substr($cb_nick, (strpos($cb_nick, ".")+1));
-		$text .= "<img src='".THEME_ABS."images/".BULLET."' alt='bullet' />
-			<span class=\"defaulttext\"><i>".$post_author_name." (".USFLAN_6.": ".$post_author_id.")</i></span>\n<div class=\"mediumtext\">".$datestamp."<br />". $cb_message."
-			</div><br />";
+		$text .= $bullet."
+			<span class=\"defaulttext\"><i>".$post_author_name." (".USFLAN_6.": ".$post_author_id.")</i></span>
+			<div class=\"mediumtext\">
+			".$datestamp."
+			<br />
+			". $cb_message."
+			</div>
+			<br />";
 	}
 
 	$text .= "<hr />";
 
 	$sql->db_Select("comments", "*", "comment_ip='$ipd' LIMIT 0,20");
-	while (list($comment_id, $comment_item_id, $comment_author, $comment_author_email, $comment_datestamp, $comment_comment, $comment_blocked, $comment_ip) = $sql->db_Fetch()) {
+	while (list($comment_id, $comment_item_id, $comment_author, $comment_author_email, $comment_datestamp, $comment_comment, $comment_blocked, $comment_ip) = $sql->db_Fetch())
+	{
 		$datestamp = $obj->convert_date($comment_datestamp, "short");
 		$post_author_id = substr($comment_author, 0, strpos($comment_author, "."));
 		$post_author_name = substr($comment_author, (strpos($comment_author, ".")+1));
-		$text .= "<img src='".THEME_ABS."images/".BULLET."' alt='bullet' />
-			<span class=\"defaulttext\"><i>".$post_author_name." (".USFLAN_6.": ".$post_author_id.")</i></span>\n<div class=\"mediumtext\">".$datestamp."<br />". $comment_comment."</div><br />";
+		$text .= $bullet."
+			<span class=\"defaulttext\"><i>".$post_author_name." (".USFLAN_6.": ".$post_author_id.")</i>
+			</span>\n<div class=\"mediumtext\">
+			".$datestamp."
+			<br />
+			". $comment_comment."
+			</div>
+			<br />";
 	}
 
 }
diff -x .svn -aruN 0.7.15.src/e107_admin/users.php 0.7.16.src/e107_admin/users.php
--- 0.7.15.src/e107_admin/users.php	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_admin/users.php	2009-07-18 10:53:18.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_admin/users.php,v $
-|     $Revision: 1.95 $
-|     $Date: 2008/08/28 19:57:46 $
-|     $Author: e107steved $
+|     $Revision: 1.100 $
+|     $Date: 2009/07/18 15:53:42 $
+|     $Author: marj_nl_fr $
 +----------------------------------------------------------------------------+
 */
 require_once("../class2.php");
@@ -159,14 +159,19 @@
 	$e107cache->clear("online_menu_totals");
 	$text = USRLAN_56." ";
 	$bantype = $_POST['prune_type'];
-	if ($sql->db_Select("user", "user_id, user_name", "user_ban= {$bantype}"))
+	if($bantype == 30) // older than 30 days.
+	{
+    	$bantype = 2;
+		$ins = " AND user_join < ".strtotime("-30 days");
+	}
+	if ($sql->db_Select("user", "user_id, user_name", "user_ban= {$bantype}".$ins))
 	{
 		$uList = $sql->db_getList();
 		foreach($uList as $u)
 		{
 			$text .= $u['user_name']." ";
 			$sql->db_Delete("user", "user_id='{$u['user_id']}' ");
-			$sql->db_Delete("user_extended", "user_extended_id='{$u['user_id']}' ");
+		 	$sql->db_Delete("user_extended", "user_extended_id='{$u['user_id']}' ");
 		}
 	}
 	$ns->tablerender(USRLAN_57, "<div style='text-align:center'><b>".$text."</b></div>");
@@ -200,13 +205,18 @@
 		message_handler("P_ALERT", USRLAN_66);
 		$error = TRUE;
 	}
+	if ($sql->db_Select("user", "user_loginname", "user_loginname='".$_POST['loginname']."' ")) 
+	{    
+		message_handler("P_ALERT", USRLAN_75 );   
+		$error = TRUE; 
+	}
 	if ($_POST['password1'] != $_POST['password2']) 
 	{
 		message_handler("P_ALERT", USRLAN_67);
 		$error = TRUE;
 	}
 
-	if ($_POST['name'] == "" || $_POST['password1'] == "" || $_POST['password2'] = "") 
+	if ($_POST['name'] == "" || $_POST['password1'] == "" || $_POST['password2'] == "") 
 	{
 		message_handler("P_ALERT", USRLAN_68);
 		$error = TRUE;
@@ -845,15 +855,15 @@
 
 
 
-	function show_options($action) 
+	function show_options($action)
 	{
 		global $unverified;
-		// ##### Display options 
-		if ($action == "") 
+		// ##### Display options
+		if ($action == "")
 		{
 			$action = "main";
 		}
-		// ##### Display options 
+		// ##### Display options
 		$var['main']['text'] = USRLAN_71;
 		$var['main']['link'] = e_SELF;
 
@@ -966,14 +976,19 @@
 
 		$unactive = $sql->db_Select("user", "*", "user_ban=2");
 		$bounced = $sql->db_Select("user", "*", "user_ban=3");
+		$older30 = $sql->db_Count("user", "(*)", "WHERE user_ban=2 AND (user_join < ".strtotime("-30 days").")");
+
 		$text = "<div style='text-align:center'><br /><br />
 			<form method='post' action='".e_SELF."'>
 			<table style='".ADMIN_WIDTH."' class='fborder'>
 			<tr>
 			<td class='forumheader3' style='text-align:center'><br />".LAN_DELETE.":&nbsp;
 			<select class='tbox' name='prune_type'>";
-            $prune_type = array(2=>USRLAN_138." [".$unactive."]",3=>USRLAN_145." [".$bounced."]");
-			foreach($prune_type as $key=>$val){
+
+			$prune_type = array(2=>USRLAN_138." [".$unactive."]",'30'=>USRLAN_138." (".USRLAN_219.") [".$older30."]", 3=>USRLAN_145." [".$bounced."]");
+
+			foreach($prune_type as $key=>$val)
+			{
             	$text .= "<option value='$key'>{$val}</option>\n";
 			}
 
@@ -991,20 +1006,20 @@
 	}
 
 	function add_user() {
-		global $rs, $ns;
+		global $rs, $ns, $pref;
 		$text = "<div style='text-align:center'>". $rs->form_open("post", e_SELF.'?create', "adduserform")."
 			<table style='".ADMIN_WIDTH."' class='fborder'>
 			<tr>
 			<td style='width:30%' class='forumheader3'>".USRLAN_61."</td>
 			<td style='width:70%' class='forumheader3'>
-			".$rs->form_text("name", 40, "", 30)."
+			".$rs->form_text("name", 40, "", varset($pref['displayname_maxlength'],15))."
 			</td>
 			</tr>
 
 			<tr>
 			<td style='width:30%' class='forumheader3'>".USRLAN_128."</td>
 			<td style='width:70%' class='forumheader3'>
-			".$rs->form_text("loginname", 40, "", 30)."
+			".$rs->form_text("loginname", 40, "", varset($pref['loginname_maxlength'],30))."
 			</td>
 			</tr>
 
@@ -1067,7 +1082,7 @@
 	function resend($id,$key,$name,$email,$lfile=''){
         global $sql,$mailheader_e107id;
 
-
+        //@FIXME multilanguage
     	// Check for a Language field, and if present, send the email in the user's language.
         if($lfile == ""){
 			if($sql -> db_Select("user_extended", "user_language", "user_extended_id = '$id'")){
@@ -1079,13 +1094,13 @@
 			require_once($lfile);
 		}else{
 			$row['user_language'] = e_LANGUAGE;
-    		require_once(e_LANGUAGEDIR.e_LANGUAGE."/lan_signup.php");
+    		@require_once(e_LANGUAGEDIR.e_LANGUAGE."/lan_signup.php");
 		}
 
 
 		$return_address = (substr(SITEURL, -1) == "/") ? SITEURL."signup.php?activate.".$id.".".$key : SITEURL."/signup.php?activate.".$id.".".$key;
 
-		$message = LAN_EMAIL_01." ".$name."\n\n".LAN_SIGNUP_24." ".SITENAME.".\n".LAN_SIGNUP_21."...\n\n";
+		$message = LAN_EMAIL_01." ".$name."\n\n".LAN_SIGNUP_24." ".SITENAME.".\n".LAN_SIGNUP_21."\n\n";
 		$message .= $return_address . "\n\n".SITENAME."\n".SITEURL;
 
         $mailheader_e107id = $id;
diff -x .svn -aruN 0.7.15.src/e107_admin/ver.php 0.7.16.src/e107_admin/ver.php
--- 0.7.15.src/e107_admin/ver.php	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_admin/ver.php	2009-09-05 10:24:04.000000000 -0500
@@ -11,14 +11,14 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_admin/ver.php,v $
-|     $Revision: 1.27 $
-|     $Date: 2008/12/10 02:54:23 $
+|     $Revision: 1.28 $
+|     $Date: 2009/09/05 15:24:28 $
 |     $Author: mcfly_e107 $
 +----------------------------------------------------------------------------+
 */
 
 if (!defined('e107_INIT')) { exit; }
 
-$e107info['e107_version'] = "0.7.15";
+$e107info['e107_version'] = "0.7.16";
 
 ?>
\ No newline at end of file
diff -x .svn -aruN 0.7.15.src/e107_config.php 0.7.16.src/e107_config.php
--- 0.7.15.src/e107_config.php	2008-12-10 12:43:52.000000000 -0600
+++ 0.7.16.src/e107_config.php	2010-01-12 09:48:08.000000000 -0600
@@ -20,15 +20,17 @@
 $mySQLpassword  = '[% mysql.e107.sqlpass %]';
 $mySQLdefaultdb = '[% mysql.e107.sqldb %]';
 $mySQLprefix    = '[% table_prefix %]_';
+// $mySQLcharset can only contain 'utf8' or ''
+$mySQLcharset   = 'utf8';
 
-$ADMIN_DIRECTORY     = "e107_admin/";
-$FILES_DIRECTORY     = "e107_files/";
-$IMAGES_DIRECTORY    = "e107_images/";
-$THEMES_DIRECTORY    = "e107_themes/";
-$PLUGINS_DIRECTORY   = "e107_plugins/";
-$HANDLERS_DIRECTORY  = "e107_handlers/";
-$LANGUAGES_DIRECTORY = "e107_languages/";
-$HELP_DIRECTORY      = "e107_docs/help/";
-$DOWNLOADS_DIRECTORY = "e107_files/downloads/";
+$ADMIN_DIRECTORY     = 'e107_admin/';
+$FILES_DIRECTORY     = 'e107_files/';
+$IMAGES_DIRECTORY    = 'e107_images/';
+$THEMES_DIRECTORY    = 'e107_themes/';
+$PLUGINS_DIRECTORY   = 'e107_plugins/';
+$HANDLERS_DIRECTORY  = 'e107_handlers/';
+$LANGUAGES_DIRECTORY = 'e107_languages/';
+$HELP_DIRECTORY      = 'e107_docs/help/';
+$DOWNLOADS_DIRECTORY = 'e107_files/downloads/';
 
 ?>
diff -x .svn -aruN 0.7.15.src/e107_files/def_e107_prefs.php 0.7.16.src/e107_files/def_e107_prefs.php
--- 0.7.15.src/e107_files/def_e107_prefs.php	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_files/def_e107_prefs.php	2009-09-03 07:05:48.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_files/def_e107_prefs.php,v $
-|     $Revision: 1.67 $
-|     $Date: 2008/10/31 21:10:39 $
-|     $Author: e107steved $
+|     $Revision: 1.70 $
+|     $Date: 2009/09/03 12:06:12 $
+|     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
 
@@ -85,6 +85,8 @@
   'meta_tag' => '',
   'email_notify' => '0',
   'resize_method' => 'gd2',
+  'image_post' => '1',
+  'image_post_class' => '0',
   'im_path' => '/usr/X11R6/bin/',
   'im_quality' => '80',
   'im_width' => '120',
@@ -162,7 +164,7 @@
   'download_email' => '0',
   'comments_disabled' => '0',
   'memberlist_access' => '253',
-  'check_updates' => '0',
+  'check_updates' => '1',
   'user_tracking' => 'cookie',
   'cookie_name' => 'e107cookie'
 );
diff -x .svn -aruN 0.7.15.src/e107_files/import/mambo.php 0.7.16.src/e107_files/import/mambo.php
--- 0.7.15.src/e107_files/import/mambo.php	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_files/import/mambo.php	2009-07-23 03:33:16.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_files/import/mambo.php,v $
-|     $Revision: 1.3 $
-|     $Date: 2008/03/28 22:10:49 $
-|     $Author: e107steved $
+|     $Revision: 1.4 $
+|     $Date: 2009/07/23 08:33:40 $
+|     $Author: marj_nl_fr $
 +----------------------------------------------------------------------------+
 */
 require_once("../../class2.php");
@@ -91,7 +91,7 @@
 	goError("Error! Cound not connect to e107 database.");
 }
 
-echo "Successfully connected to Mambo and e107 databases ...<br><br />";
+echo "Successfully connected to Mambo and e107 databases ...<br /><br />";
 
 
 $phpbb_res = mysql_query("SELECT * FROM {$mamboPrefix}users", $phpbbConnection);
diff -x .svn -aruN 0.7.15.src/e107_files/shortcode/admin_help.sc 0.7.16.src/e107_files/shortcode/admin_help.sc
--- 0.7.15.src/e107_files/shortcode/admin_help.sc	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_files/shortcode/admin_help.sc	2009-07-18 10:53:18.000000000 -0500
@@ -5,6 +5,7 @@
 
   if(strpos(e_SELF, e_ADMIN_ABS) !== FALSE)
   {
+	//@TODO better way to do this?
 	if (is_readable(e_LANGUAGEDIR.e_LANGUAGE."/admin/help/".e_PAGE)) 
 	{
 	  $helpfile = e_LANGUAGEDIR.e_LANGUAGE."/admin/help/".e_PAGE;
diff -x .svn -aruN 0.7.15.src/e107_files/shortcode/admin_lang.sc 0.7.16.src/e107_files/shortcode/admin_lang.sc
--- 0.7.15.src/e107_files/shortcode/admin_lang.sc	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_files/shortcode/admin_lang.sc	2009-07-17 09:48:18.000000000 -0500
@@ -37,7 +37,7 @@
 			}
 			else
 			{
-				setcookie('e107language_'.$pref['cookie_name'], $lanperms[0], time() + 86400);
+				setcookie('e107language_'.$pref['cookie_name'], $lanperms[0], time() + 86400, '/');
 				$_COOKIE['e107language_'.$pref['cookie_name']]= $lanperms[0];
 			}
 		}
diff -x .svn -aruN 0.7.15.src/e107_files/shortcode/admin_sel_lan.sc 0.7.16.src/e107_files/shortcode/admin_sel_lan.sc
--- 0.7.15.src/e107_files/shortcode/admin_sel_lan.sc	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_files/shortcode/admin_sel_lan.sc	2009-08-03 13:45:41.000000000 -0500
@@ -1,8 +1,6 @@
-if (ADMIN) {
-	if ($pref['multilanguage']) {
-		global $sql;
-		$ret = " <b>".ADLAN_132.":</b> ";
-		$ret .= ($sql->mySQLlanguage) ? $sql->mySQLlanguage : ADLAN_133;
-		return $ret;
-	}
-}
\ No newline at end of file
+//<? $Id: admin_sel_lan.sc,v 1.3 2009/08/03 18:46:05 marj_nl_fr Exp $
+if (ADMIN && $pref['multilanguage'])
+{
+	$language = ($pref['sitelanguage'] == e_LANGUAGE) ? ADLAN_133 : e_LANGUAGE;
+	return ' <strong>'.ADLAN_132.'</strong> '.$language;
+}
diff -x .svn -aruN 0.7.15.src/e107_files/shortcode/admin_siteinfo.sc 0.7.16.src/e107_files/shortcode/admin_siteinfo.sc
--- 0.7.15.src/e107_files/shortcode/admin_siteinfo.sc	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_files/shortcode/admin_siteinfo.sc	2009-07-14 04:53:10.000000000 -0500
@@ -1,15 +1,6 @@
-if (ADMIN) {
-	global $sql, $ns, $pref, $themename, $themeversion, $themeauthor, $themedate, $themeinfo, $mySQLdefaultdb;
-
-	if (!isset($pref['install_date'])) {
-		$sql -> db_Select("core", "*", "e107_name='e107' ");
-		$row = $sql -> db_Fetch();
-		$coreinfo = unserialize($row['e107_value']);
-		$pref['install_date'] = $coreinfo['e107_datestamp'];
-   		save_prefs();
-   		$sql -> db_Delete("core", "e107_name='e107'");
-	}
-	
+if (ADMIN) 
+{
+	global $ns, $pref, $themename, $themeversion, $themeauthor, $themedate, $themeinfo, $mySQLdefaultdb;
 
 	if (file_exists(e_ADMIN."ver.php"))
 	{ 
diff -x .svn -aruN 0.7.15.src/e107_files/shortcode/admin_update.sc 0.7.16.src/e107_files/shortcode/admin_update.sc
--- 0.7.15.src/e107_files/shortcode/admin_update.sc	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_files/shortcode/admin_update.sc	2009-09-03 08:29:37.000000000 -0500
@@ -1,9 +1,10 @@
-// $Id: admin_update.sc,v 1.6 2007/07/18 19:53:41 e107steved Exp $
+// $Id: admin_update.sc,v 1.7 2009/09/03 13:30:01 e107coders Exp $
+
 
 	if (!ADMIN) return "";
 
 	global $e107cache,$ns, $pref;
-	if (!varset($pref['check_updates'], FALSE)) return "";
+  	if (!varset($pref['check_updates'], FALSE)) return "";
 	
 	if (is_readable(e_ADMIN."ver.php"))
 	{
@@ -18,16 +19,16 @@
    	  	return $ns -> tablerender(LAN_NEWVERSION, $cacheData);
     }
 
-	// Don't check for updates if running locally (comment out the next line to allow check - but 
-	// remember it can cause delays/errors if its not possible to access the Internet
-	if ((strpos(e_SELF,'localhost') !== FALSE) || (strpos(e_SELF,'127.0.0.1') !== FALSE)) return '';
+	// Keep commented out to be sure it continues to work under all circumstances.
+
+	//if ((strpos(e_SELF,'localhost') !== FALSE) || (strpos(e_SELF,'127.0.0.1') !== FALSE)) return '';
 
 	require_once(e_HANDLER."xml_class.php");
 	$xml = new parseXml;
 	require_once(e_HANDLER."magpie_rss.php");
 
     $ftext = "";
-	if($rawData = $xml -> getRemoteXmlFile($feed))
+	if($rawData = $xml -> getRemoteXmlFile($feed,5))
 	{
 	  $rss = new MagpieRSS( $rawData );
       list($cur_version,$tag) = explode(" ",$e107info['e107_version']);
diff -x .svn -aruN 0.7.15.src/e107_files/shortcode/admin_userlan.sc 0.7.16.src/e107_files/shortcode/admin_userlan.sc
--- 0.7.15.src/e107_files/shortcode/admin_userlan.sc	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_files/shortcode/admin_userlan.sc	2009-08-03 13:45:41.000000000 -0500
@@ -1,4 +1,6 @@
+// Does actually the same than ADMIN_SEL_LAN
+/*
 if (isset($_COOKIE['userlan']) && $_COOKIE['userlan']) {
 	return " <b>Language:</b> ".$_COOKIE['userlan'];
 }
-
+*/
\ No newline at end of file
diff -x .svn -aruN 0.7.15.src/e107_files/shortcode/batch/download_shortcodes.php 0.7.16.src/e107_files/shortcode/batch/download_shortcodes.php
--- 0.7.15.src/e107_files/shortcode/batch/download_shortcodes.php	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_files/shortcode/batch/download_shortcodes.php	2009-01-29 17:45:43.000000000 -0600
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_files/shortcode/batch/download_shortcodes.php,v $
-|     $Revision: 1.30 $
-|     $Date: 2008/12/08 21:15:39 $
-|     $Author: e107steved $
+|     $Revision: 1.31 $
+|     $Date: 2009/01/29 23:46:07 $
+|     $Author: bugrain $
 +----------------------------------------------------------------------------+
 */
 if (!defined('e107_INIT')) { exit; }
@@ -480,14 +480,28 @@
 	    }
 
 		// Now generate the options
-	    foreach ($catlist as $thiscat)
-	    {  // Main categories
+	   foreach ($catlist as $thiscat)
+	   {  // Main categories
 			// Could add a display class to the group, but the default looked OK
 
-            if(count($thiscat['subcats'])>0)
+         if(count($thiscat['subcats'])>0)
 			{
 				$boxinfo .= "<optgroup label='".htmlspecialchars($thiscat['download_category_name'])."'>\n";
 		  		$scprefix = '';
+	      	foreach ($thiscat['subcats'] as $sc)
+	      	{  // Sub-categories
+		    	   $sscprefix = '--> ';
+		    	   $boxinfo .= "<option value='".$sc['download_category_id']."'";
+		    	   if ($cdc == $sc['download_category_id']) { $boxinfo .= " selected='selected'"; }
+		   	   $boxinfo .= ">".$scprefix.htmlspecialchars($sc['download_category_name'])."</option>\n";
+		    	   foreach ($sc['subsubcats'] as $ssc)
+		    	   {  // Sub-sub categories
+		         		$boxinfo .= "<option value='".$ssc['download_category_id']."'";
+		         		if ($cdc == $ssc['download_category_id']) { $boxinfo .= " selected='selected'"; }
+		         		$boxinfo .= ">".htmlspecialchars($sscprefix.$ssc['download_category_name'])."</option>\n";
+		    	   }
+	      	}
+			   $boxinfo .= "</optgroup>\n";
 			}
 			else
 			{
@@ -495,21 +509,7 @@
             	$boxinfo .= "<option value='".$thiscat['download_category_id']."' {$sel}>".htmlspecialchars($thiscat['download_category_name'])."</option>\n";
 			}
 
-	      	foreach ($thiscat['subcats'] as $sc)
-	      	{  // Sub-categories
-		    	$sscprefix = '--> ';
-		    	$boxinfo .= "<option value='".$sc['download_category_id']."'";
-		    	if ($cdc == $sc['download_category_id']) { $boxinfo .= " selected='selected'"; }
-		   		$boxinfo .= ">".$scprefix.htmlspecialchars($sc['download_category_name'])."</option>\n";
-		    	foreach ($sc['subsubcats'] as $ssc)
-		    	{  // Sub-sub categories
-		      		$boxinfo .= "<option value='".$ssc['download_category_id']."'";
-		      		if ($cdc == $ssc['download_category_id']) { $boxinfo .= " selected='selected'"; }
-		      		$boxinfo .= ">".htmlspecialchars($sscprefix.$ssc['download_category_name'])."</option>\n";
-		    	}
-	      	}
-			$boxinfo .= "</optgroup>\n";
-	    }
+	  }
 
 	  $boxinfo .= "</select>\n";
 	  return $boxinfo;
diff -x .svn -aruN 0.7.15.src/e107_files/shortcode/batch/news_archives.php 0.7.16.src/e107_files/shortcode/batch/news_archives.php
--- 0.7.15.src/e107_files/shortcode/batch/news_archives.php	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_files/shortcode/batch/news_archives.php	2009-08-23 05:39:28.000000000 -0500
@@ -18,8 +18,16 @@
 		
 /*
 SC_BEGIN ARCHIVE_BULLET
-global $news2;
-return "<img src='".THEME."images/".(defined("BULLET") ? BULLET : "bullet2.gif")."' style='border:0px' alt='' />";
+$bullet = '';
+if(defined('BULLET'))
+{
+	$bullet = '<img src="'.THEME.'images/'.BULLET.'" alt="" style="vertical-align: middle;" />';
+}
+elseif(file_exists(THEME.'images/bullet2.gif'))
+{
+	$bullet = '<img src="'.THEME.'images/bullet2.gif" alt="" style="vertical-align: middle;" />';
+}
+return $bullet;
 SC_END
 
 SC_BEGIN ARCHIVE_LINK
diff -x .svn -aruN 0.7.15.src/e107_files/shortcode/batch/news_shortcodes.php 0.7.16.src/e107_files/shortcode/batch/news_shortcodes.php
--- 0.7.15.src/e107_files/shortcode/batch/news_shortcodes.php	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_files/shortcode/batch/news_shortcodes.php	2009-03-29 16:40:51.000000000 -0500
@@ -11,8 +11,8 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_files/shortcode/batch/news_shortcodes.php,v $
-|     $Revision: 1.39 $
-|     $Date: 2008/12/01 21:04:01 $
+|     $Revision: 1.40 $
+|     $Date: 2009/03/29 21:41:15 $
 |     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
@@ -33,7 +33,8 @@
 $news_item = getcachedvars('current_news_item');
 $param = getcachedvars('current_news_param');
 $news_body = $tp -> toHTML($news_item['news_body'], TRUE, 'BODY, fromadmin', $news_item['news_author']);
-if($news_item['news_extended'] && (isset($_POST['preview']) || strpos(e_QUERY, 'extend') !== FALSE) && $parm != "noextend") {
+if($news_item['news_extended'] && (isset($_POST['preview']) || strpos(e_QUERY, 'extend') !== FALSE) && $parm != "noextend") 
+{
     $news_extended = $tp -> toHTML($news_item['news_extended'], TRUE, 'BODY, fromadmin', $news_item['news_author']);
     $news_body .= "<br /><br />".$news_extended;
 }
@@ -143,7 +144,9 @@
 {
 	$NEWIMAGE = $param['image_nonew_small'];
 }
-return ($news_item['news_allow_comments'] ? $param['commentoffstring'] : ''.($pref['comments_icon'] ? $NEWIMAGE : '')." <a href='".e_HTTP."comment.php?comment.news.".$news_item['news_id']."'>".$param['commentlink'].$news_item['news_comment_total'].'</a>');
+return ($news_item['news_allow_comments'] ? $param['commentoffstring'] 
+:
+ ''.($pref['comments_icon'] ? $NEWIMAGE : '')." <a href='".e_HTTP."comment.php?comment.news.".$news_item['news_id']."'>".$param['commentlink'].$news_item['news_comment_total'].'</a>');
 SC_END
 
 SC_BEGIN NEWSCOMMENTLINK
@@ -199,21 +202,30 @@
 SC_END
 
 SC_BEGIN EXTENDED
+global $tp;
 $news_item = getcachedvars('current_news_item');
 $param = getcachedvars('current_news_param');
-if ($news_item['news_extended'] && (strpos(e_QUERY, 'extend') === FALSE || $parm == "force")) {
-	if (defined("PRE_EXTENDEDSTRING")) {
+if ($news_item['news_extended'] && (strpos(e_QUERY, 'extend') === FALSE || $parm == "force")) 
+{
+	if (defined("PRE_EXTENDEDSTRING")) 
+	{
 		$es1 = PRE_EXTENDEDSTRING;
 	}
-	if (defined("POST_EXTENDEDSTRING")) {
+	if (defined("POST_EXTENDEDSTRING")) 
+	{
 		$es2 = POST_EXTENDEDSTRING;
 	}
-	if (isset($_POST['preview'])) {
-		return $es1.EXTENDEDSTRING.$es2."<br />".$news_item['news_extended'];
-	} else {
+	if (isset($_POST['preview'])) 
+	{
+		return $es1.EXTENDEDSTRING.$es2."<br />".$tp->toHTML($news_item['news_extended'], TRUE, 'BODY, fromadmin', $news_item['news_author']);
+	} 
+	else 
+	{
 		return $es1."<a class='".$GLOBALS['NEWS_CSSMODE']."_extendstring' href='".e_HTTP."news.php?extend.".$news_item['news_id']."'>".EXTENDEDSTRING."</a>".$es2;
 	}
-} else {
+} 
+else 
+{
 	return "";
 }
 SC_END
diff -x .svn -aruN 0.7.15.src/e107_files/shortcode/custom.sc 0.7.16.src/e107_files/shortcode/custom.sc
--- 0.7.15.src/e107_files/shortcode/custom.sc	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_files/shortcode/custom.sc	2009-08-03 16:53:38.000000000 -0500
@@ -1,4 +1,5 @@
-global $tp,$pref;
+//<? $Id: custom.sc,v 1.25 2009/08/03 21:54:02 marj_nl_fr Exp $
+global $tp, $pref;
 $ret = "";
 $custom_query = explode('+', $parm);
 switch($custom_query[0])
@@ -57,28 +58,27 @@
 				return $quote;
 				break;
 
-		case "language":
+		case 'language':
+				//FIXME obtrusive and may not work with session or subdomains - certainly better to use {LANGUAGELINKS} anyway
+				$languageList = explode(',', e_LANLIST);
+				sort($languageList);
+				$action = (e_QUERY && ! $_GET['elan']) ? e_SELF.'?'.e_QUERY : e_SELF;
+				$text = '
+				<form method="post" action="'.$action.'" id="langchange">
+					<select name="sitelanguage" class="tbox" onchange=\'document.getElementById("langchange").submit()\'>';
 
-				require_once(e_HANDLER."file_class.php");
-				$fl = new e_file;
-				$reject = array('.','..','/','CVS','thumbs.db','*._$');
-				$lanlist = $fl->get_dirs(e_LANGUAGEDIR);
-				sort($lanlist);
-				$action = (e_QUERY && !$_GET['elan']) ? e_SELF."?".e_QUERY : e_SELF;
-				$lantext = "<form method='post' action='".$action."' id='langchange'>
-				<div><select name='sitelanguage' class='tbox' onchange=\"document.getElementById('langchange').submit()\">\n";
-
-				foreach($lanlist as $langval) {
-						$langname = $langval;
-						$langval = ($langval == $pref['sitelanguage']) ? "" : $langval;
-						$selected = ($langval == USERLAN) ? "selected='selected'" : "";
-						$lantext .= "<option value='".$langval."' $selected>".$langname."</option>\n ";
+				foreach($languageList as $languageFolder)
+				{
+					$selected = ($languageFolder == e_LANGUAGE) ? ' selected="selected"' : '';
+					$text .= '
+							<option value="'.$languageFolder.'"'.$selected.'>'.$languageFolder.'</option>';
 				}
 
-				$lantext .= "</select>\n";
-				$lantext .= "<input type='hidden' name='setlanguage' value='1' />";
-				$lantext .= "</div></form>";
-				return $lantext;
+				$text .= '
+					</select>
+					<input type="hidden" name="setlanguage" value="1" />
+				</form>';
+				return $text;
 				break;
 
 
diff -x .svn -aruN 0.7.15.src/e107_files/shortcode/email.sc 0.7.16.src/e107_files/shortcode/email.sc
--- 0.7.15.src/e107_files/shortcode/email.sc	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_files/shortcode/email.sc	2009-08-15 06:54:06.000000000 -0500
@@ -1,5 +1,5 @@
-@include_once(e_LANGUAGEDIR.e_LANGUAGE."/lan_user.php");
-@include_once(e_LANGUAGEDIR."English/lan_user.php");
+include_lan(e_LANGUAGEDIR.e_LANGUAGE."/lan_user.php");
+
 global $tp;
 if (substr($parm, -5) == '-link')
 {
diff -x .svn -aruN 0.7.15.src/e107_files/shortcode/languagelinks.sc 0.7.16.src/e107_files/shortcode/languagelinks.sc
--- 0.7.15.src/e107_files/shortcode/languagelinks.sc	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_files/shortcode/languagelinks.sc	2009-08-03 16:11:49.000000000 -0500
@@ -1,43 +1,48 @@
-// $Id: languagelinks.sc,v 1.7 2007/10/30 21:43:18 e107coders Exp $
+//<? $Id: languagelinks.sc,v 1.8 2009/08/03 21:12:13 marj_nl_fr Exp $
 global $pref;
-$sep = (defined("LANGLINKS_SEPARATOR")) ? LANGLINKS_SEPARATOR : "|&nbsp;";
-$cursub = explode(".",$_SERVER['HTTP_HOST']);
+if( ! defined('LANGLINKS_SEPARATOR'))
+{
+	define('LANGLINKS_SEPARATOR', '&nbsp;|&nbsp;');
+}
+//$cursub = explode('.', $_SERVER['HTTP_HOST']);
+
+require_once(e_HANDLER.'language_class.php');
+$slng = new language;
+
+if($parm)
+{
+	$languageList = explode(',', $parm);
+}
+else
+{
+	$languageList = explode(',', e_LANLIST);
+	sort($languageList);
+}
+
+if(count($languageList) < 2)
+{
+	return;
+}
+
+foreach($languageList as $languageFolder)
+{
+	$code = $slng->convert($languageFolder);
+	$name = $slng->toNative($languageFolder);
+	//$subdom = (isset($cursub[2])) ? $cursub[0] : '';
 
-require_once(e_HANDLER."language_class.php");
-$lng = new language;
-
-	if($parm)
+	if(varset($pref['multilanguage_subdomain']))
 	{
-		$tmp = explode(",",$parm);
+		$code = ($languageFolder == $pref['sitelanguage']) ? 'www.' : $code;
+		$link = (e_QUERY)
+		        ? str_replace($_SERVER['HTTP_HOST'], $code.'.'.e_DOMAIN, e_SELF).'?'.e_QUERY
+		        : str_replace($_SERVER['HTTP_HOST'], $code.'.'.e_DOMAIN, e_SELF);
 	}
 	else
 	{
-		$tmp = explode(",",e_LANLIST);
-		sort($tmp);
-	}
-
-	if(count($tmp) < 2)
-	{
-		return;
-	}
-
-	foreach($tmp as $val)
-	{
-		$code = $lng->convert($val);
-		$name = $lng->toNative($val);
-		$subdom = (isset($cursub[2])) ? $cursub[0] : "";
-
-		if(isset($pref['multilanguage_subdomain']) && $pref['multilanguage_subdomain']){
-        	$link = (e_QUERY) ? str_replace($_SERVER['HTTP_HOST'],$code.".".e_DOMAIN,e_SELF)."?".e_QUERY : str_replace($_SERVER['HTTP_HOST'],$code.".".e_DOMAIN,e_SELF);
-		}
-		else{
-			$link = (e_QUERY) ? e_SELF."?[".$code."]".e_QUERY : e_SELF."?[".$code."]";
-		}
-		if(isset($pref['multilanguage_subdomain']) && $pref['multilanguage_subdomain'] && $val == $pref['sitelanguage']){
-        	$link = str_replace($code.".".e_DOMAIN,"www.".e_DOMAIN,$link);
-		}
-		$class = ($val == e_LANGUAGE) ? "languagelink_active" : "languagelink";
-    	$ret[] =  "<a class='{$class}' href='{$link}' title=\"".$name."\">".$name."</a>\n";
+		$link = (e_QUERY) ? e_SELF.'?['.$code.']'.e_QUERY : e_SELF.'?['.$code.']';
 	}
+	$class = ($languageFolder == e_LANGUAGE) ? 'languagelink_active' : 'languagelink';
+	$ret[] =  "\n<a class='{$class}' href='{$link}'>{$name}</a>";
+}
 
-return implode($sep,$ret);
\ No newline at end of file
+return implode(LANGLINKS_SEPARATOR, $ret);
\ No newline at end of file
diff -x .svn -aruN 0.7.15.src/e107_files/shortcode/menu.sc 0.7.16.src/e107_files/shortcode/menu.sc
--- 0.7.15.src/e107_files/shortcode/menu.sc	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_files/shortcode/menu.sc	2009-02-05 05:49:22.000000000 -0600
@@ -1,4 +1,4 @@
-/* $Id: menu.sc,v 1.29 2008/06/19 22:46:12 e107coders Exp $ */
+/* $Id: menu.sc,v 1.30 2009/02/05 11:49:46 secretr Exp $ */
 global $sql;
 global $ns;
 global $eMenuList;
@@ -17,7 +17,7 @@
 {
 	$show_menu = TRUE;
 	if($row['menu_pages']) {
-		list($listtype,$listpages) = explode("-",$row['menu_pages']);
+		list($listtype,$listpages) = explode("-",$row['menu_pages'], 2);
 		$pagelist = explode("|",$listpages);
 		$check_url = e_SELF.(e_QUERY ? "?".e_QUERY : '');
 
@@ -26,6 +26,7 @@
 			$show_menu = FALSE;
 			foreach($pagelist as $p)
 			{
+
 				if(substr($p, -1) == '!')
 				{
 					$p = substr($p, 0, -1);
@@ -34,7 +35,7 @@
 						$show_menu = TRUE;
 					}
 				}
-				else 
+				else
 				{
 					if(strpos($check_url,$p) !== FALSE)
 					{
@@ -55,7 +56,7 @@
 						$show_menu = FALSE;
 					}
 				}
-				else 
+				else
 				{
 					if(strpos($check_url, $p) !== FALSE)
 					{
@@ -85,9 +86,9 @@
 			if(is_readable(e_LANGUAGEDIR.e_LANGUAGE."/plugins/lan_{$row['menu_path']}.php")) {
 				include_once(e_LANGUAGEDIR.e_LANGUAGE."/plugins/lan_{$row['menu_path']}.php");
 			} elseif (is_readable(e_PLUGIN.$row['menu_path']."/languages/".e_LANGUAGE.".php")) {
-				include_once(e_PLUGIN.$row['menu_path']."/languages/".e_LANGUAGE.".php");	
+				include_once(e_PLUGIN.$row['menu_path']."/languages/".e_LANGUAGE.".php");
 			} elseif (is_readable(e_PLUGIN.$row['menu_path']."/languages/".e_LANGUAGE."/".e_LANGUAGE.".php")) {
-				include_once(e_PLUGIN.$row['menu_path']."/languages/".e_LANGUAGE."/".e_LANGUAGE.".php");	
+				include_once(e_PLUGIN.$row['menu_path']."/languages/".e_LANGUAGE."/".e_LANGUAGE.".php");
 			} elseif (is_readable(e_LANGUAGEDIR."english/plugins/lan_{$row['menu_path']}.php")) {
 				include_once(e_LANGUAGEDIR."English/plugins/lan_{$row['menu_path']}.php");
 			} elseif (is_readable(e_PLUGIN.$row['menu_path']."/languages/English.php")) {
@@ -95,7 +96,7 @@
 			} elseif (is_readable(e_PLUGIN.$row['menu_path']."/languages/English/English.php")) {
 				include_once(e_PLUGIN.$row['menu_path']."/languages/English/English.php");
 			}
-			
+
 			if(file_exists(e_PLUGIN.$row['menu_path']."/".$mname.".php"))
 			{
 				include_once(e_PLUGIN.$row['menu_path']."/".$mname.".php");
@@ -103,7 +104,7 @@
 		}
 		$sql->db_Mark_Time("(After ".$mname.")");
 		if ($error_handler->debug == true) {
-			echo "\n<!-- Menu End: ".$mname." -->\n";			
+			echo "\n<!-- Menu End: ".$mname." -->\n";
 		}
 	}
 }
diff -x .svn -aruN 0.7.15.src/e107_files/shortcode/news_categories.sc 0.7.16.src/e107_files/shortcode/news_categories.sc
--- 0.7.15.src/e107_files/shortcode/news_categories.sc	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_files/shortcode/news_categories.sc	2009-06-06 12:02:57.000000000 -0500
@@ -115,7 +115,7 @@
 
 	while ($t % $nbr_cols != 0){
 		$text3 .= "<td style='".NEWSCAT_CELL.";width:{$wid}%'>&nbsp;</td>\n";
-		$text3 .= (($t+1) % nbr_cols == 0) ? "</tr>" : "";
+		$text3 .= (($t+1) % $nbr_cols == 0) ? "</tr>" : "";
 		$t++;
 	}
 
diff -x .svn -aruN 0.7.15.src/e107_files/shortcode/nextprev.sc 0.7.16.src/e107_files/shortcode/nextprev.sc
--- 0.7.15.src/e107_files/shortcode/nextprev.sc	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_files/shortcode/nextprev.sc	2009-08-15 06:54:06.000000000 -0500
@@ -1,8 +1,7 @@
 
 global $pref;
 
-@include_once(e_LANGUAGEDIR.e_LANGUAGE."/lan_np.php");
-@include_once(e_LANGUAGEDIR."English/lan_np.php");
+include_lan(e_LANGUAGEDIR.e_LANGUAGE."/lan_np.php");
 
 $parm_count = substr_count($parm, ",");
 
diff -x .svn -aruN 0.7.15.src/e107_handlers/bbcode_handler.php 0.7.16.src/e107_handlers/bbcode_handler.php
--- 0.7.15.src/e107_handlers/bbcode_handler.php	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_handlers/bbcode_handler.php	2009-07-11 22:27:57.000000000 -0500
@@ -11,8 +11,8 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_handlers/bbcode_handler.php,v $
-|     $Revision: 1.61 $
-|     $Date: 2007/11/13 07:30:19 $
+|     $Revision: 1.62 $
+|     $Date: 2009/07/12 03:28:21 $
 |     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
@@ -290,10 +290,8 @@
 			}
 		}
 		global $e107_debug;
-		if(E107_DBG_BBSC)
-		{
-			trigger_error("starting bbcode [$code]", E_USER_ERROR);
-		}
+
+
 		ob_start();
 		$bbcode_return = eval($bbcode);
 		$bbcode_output = ob_get_contents();
diff -x .svn -aruN 0.7.15.src/e107_handlers/comment_class.php 0.7.16.src/e107_handlers/comment_class.php
--- 0.7.15.src/e107_handlers/comment_class.php	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_handlers/comment_class.php	2009-08-15 06:54:06.000000000 -0500
@@ -12,16 +12,16 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_handlers/comment_class.php,v $
-|     $Revision: 1.78 $
-|     $Date: 2008/10/22 21:31:02 $
-|     $Author: e107steved $
+|     $Revision: 1.81 $
+|     $Date: 2009/08/15 11:54:30 $
+|     $Author: marj_nl_fr $
 +----------------------------------------------------------------------------+
 */
 
 if (!defined('e107_INIT')) { exit; }
 
-@include_once(e_LANGUAGEDIR.e_LANGUAGE."/lan_comment.php");
-@include_once(e_LANGUAGEDIR."English/lan_comment.php");
+include_lan(e_LANGUAGEDIR.e_LANGUAGE."/lan_comment.php");
+
 global $comment_shortcodes;
 require_once(e_FILE."shortcode/batch/comment_shortcodes.php");
 
@@ -80,9 +80,9 @@
 				$eaction = 'edit';
 				$id = $_GET['comment_id'];
 			}
-		  elseif (strstr(e_QUERY, "edit"))
+			elseif (strpos(e_QUERY, 'edit.') !== FALSE)
 			{
-				$eaction = "edit";
+				$eaction = 'edit';
 				$tmp = explode(".", e_QUERY);
 				$count = 0;
 
@@ -300,8 +300,7 @@
 			  }
 			}
 		}		// End (nested comment handling)
-		//echo $text;
-		return stripslashes($text);
+		return $text;
 	}
 
 	/**
diff -x .svn -aruN 0.7.15.src/e107_handlers/date_handler.php 0.7.16.src/e107_handlers/date_handler.php
--- 0.7.15.src/e107_handlers/date_handler.php	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_handlers/date_handler.php	2009-08-15 06:54:06.000000000 -0500
@@ -11,19 +11,15 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_handlers/date_handler.php,v $
-|     $Revision: 1.11 $
-|     $Date: 2007/02/18 13:10:18 $
-|     $Author: e107steved $
+|     $Revision: 1.12 $
+|     $Date: 2009/08/15 11:54:30 $
+|     $Author: marj_nl_fr $
 |
 +----------------------------------------------------------------------------+
 */
 if (!defined('e107_INIT')) { exit; }
 
-if (is_readable(e_LANGUAGEDIR.e_LANGUAGE."/lan_date.php")) {
-	@include_once(e_LANGUAGEDIR.e_LANGUAGE."/lan_date.php");
-} else {
-	@include_once(e_LANGUAGEDIR."English/lan_date.php");
-}
+include_lan(e_LANGUAGEDIR.e_LANGUAGE."/lan_date.php");
 
 class convert
 {
diff -x .svn -aruN 0.7.15.src/e107_handlers/db_debug_class.php 0.7.16.src/e107_handlers/db_debug_class.php
--- 0.7.15.src/e107_handlers/db_debug_class.php	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_handlers/db_debug_class.php	2009-08-19 06:16:44.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_handlers/db_debug_class.php,v $
-|     $Revision: 1.20 $
-|     $Date: 2008/07/20 17:08:29 $
-|     $Author: e107steved $
+|     $Revision: 1.22 $
+|     $Date: 2009/08/19 11:17:08 $
+|     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
 
@@ -65,6 +65,7 @@
 		$this->ShowIf('Shortcodes / BBCode',$this->Show_SC_BB());
 		$this->ShowIf('Paths', $this->Show_PATH());
 		$this->ShowIf('Deprecated Function Usage', $this->Show_DEPRECATED());
+		$this->ShowIf('Included Files', $this->Show_Includes());
 	}
 	
 	function ShowIf($title,$str)
@@ -176,6 +177,12 @@
 		//
 		// Show stats from aSQLdetails array
 		//
+		if (!E107_DBG_SQLQUERIES && !E107_DBG_SQLDETAILS)
+		{
+			return FALSE;
+		}
+
+
 		$text='';
 		$nQueries=$sql->db_QueryCount();
 
@@ -212,7 +219,7 @@
 		//
 		// Optionally list good queries
 		//
-		if ($okCount && E107_DBG_SQLQUERIES) {
+		if ($okCount && E107_DBG_SQLDETAILS) {
 			$text .= "\n<table class='fborder'>\n";
 			$text .= "<tr><td class='fcaption' colspan='3'><b>{$okCount[TRUE]} Good Queries</b></td></tr>\n";
 			$text .= "<tr><td class='fcaption'><b>Index</b></td><td class='fcaption'><b>Qtime</b></td><td class='fcaption'><b>Query</b></td></tr>\n
@@ -408,7 +415,7 @@
 		}
 		$this -> scbbcodes[$this -> scbcount]['type'] = $type;
 		$this -> scbbcodes[$this -> scbcount]['code'] = $code;
-		$this -> scbbcodes[$this -> scbcount]['parm'] = $parm;
+		$this -> scbbcodes[$this -> scbcount]['parm'] = htmlentities($parm);
 		$this -> scbbcodes[$this -> scbcount]['postID'] = $postID;
 		$this -> scbcount ++;
 	}
@@ -428,7 +435,7 @@
 			<td class='fcaption' style='width: 10%;'>Post ID</td>
 			</tr>\n";
 
-		foreach($this -> scbbcodes as $codes)
+ 		foreach($this -> scbbcodes as $codes)
 		{
 			$text .= "<tr>
 				<td class='forumheader3' style='width: 10%;'>".($codes['type'] == 1 ? "BBCode" : "Shortcode")."</td>
@@ -453,17 +460,17 @@
 			<tr>
 			<td class='forumheader3'>\n";
 
-		ob_start();
-		echo "<pre>"; print_r($e107); echo "</pre>";
-		$text .= ob_get_contents();
-		ob_end_clean();
-
 		$text .= "e_HTTP: '".e_HTTP."'<br />";
 		$text .= "e_BASE: '".e_BASE."'<br />";
 		$text .= "\$_SERVER['PHP_SELF']: '".$_SERVER['PHP_SELF']."'<br />";
 		$text .= "\$_SERVER['DOCUMENT_ROOT']: '".$_SERVER['DOCUMENT_ROOT']."'<br />";
 		$text .= "\$_SERVER['HTTP_HOST']: '".$_SERVER['HTTP_HOST']."'<br />";
 
+
+  	  	$text .= "<pre>";
+        $text .= htmlspecialchars(print_r($e107,TRUE));
+	  	$text .= "</pre>";
+
 		$text .= "</td></tr></table>";
 		return $text;
 	}
@@ -549,6 +556,19 @@
 
 		return $text;
 	}
+	
+	function Show_Includes()
+	{
+		if (!E107_DBG_INCLUDES) return FALSE;
+
+		$aIncList = get_included_files();
+		$text = "<table class='fborder'>\n";
+		$text .= "<tr><td class='forumheader3'>".
+							implode("&nbsp;</td></tr>\n<tr><td class='forumheader3'>", $aIncList).
+							"&nbsp;</td></tr>\n";
+		$text .= "</table>\n";
+		return $text;
+	}
 }
 
 function e107_debug_shutdown()
@@ -587,4 +607,4 @@
 	echo "</body></html>";
 }
 
-?>
+?>
\ No newline at end of file
diff -x .svn -aruN 0.7.15.src/e107_handlers/debug_handler.php 0.7.16.src/e107_handlers/debug_handler.php
--- 0.7.15.src/e107_handlers/debug_handler.php	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_handlers/debug_handler.php	2009-07-11 22:27:57.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_handlers/debug_handler.php,v $
-|     $Revision: 1.21 $
-|     $Date: 2006/12/04 13:32:10 $
-|     $Author: mrpete $
+|     $Revision: 1.22 $
+|     $Date: 2009/07/12 03:28:21 $
+|     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
 
@@ -75,7 +75,9 @@
 define('E107_DBG_SC',       	(E107_DEBUG_LEVEL &  4096));    // Dump (inline) SC filenames as used
 define('E107_DBG_ERRBACKTRACE',	(E107_DEBUG_LEVEL &  8192));    // show backtrace for php errors
 define('E107_DBG_DEPRECATED', (E107_DEBUG_LEVEL & 16384));    // Show use of deprecated functions
-define('E107_DBG_ALLERRORS',	(E107_DEBUG_LEVEL & 32768));   // show ALL php errors (including notices), not just fatal issues
+define('E107_DBG_ALLERRORS',	(E107_DEBUG_LEVEL & 32768));    // show ALL php errors (including notices), not just fatal issues
+define('E107_DBG_INCLUDES',   (E107_DEBUG_LEVEL & 65536));    // show included file list
+define('E107_DBG_NOTICES',   (E107_DEBUG_LEVEL & 32768));    // show included file list
 
 class e107_debug {
 
@@ -91,16 +93,18 @@
 		'showsql'		=> 2,       // sql basics
 		'counts'		=> 4,       // traffic counters
 
-		'detail'		=> 32767,   // all details
-		'd' 			  => 32767,   // all details
-		'time' 			=> 257,     // time details and php errors
-		'sql' 			=> 513,     // sql details and php errors
+		'detail'		=> 16740351,   // (0+0xfffff-32768-4096) all details, except notice and inline sc
+		'd' 			  => 16740351,   // all details, except notice and inline sc
+		'time' 			=> 256,     // time details and php errors
+		'sql' 			=> 512,     // sql details and php errors
 		'paths' 		=> 1024,		// dump path strings
 		'bbsc' 			=> 2048,		// show bb and sc details
 		'sc'			  => 4096,   		// Shortcode paths dumped inline
 		'backtrace' => 8192,		// show backtrace when PHP has errors
 		'deprecated'	=> 16384,   // show if code is using deprecated functions
-		'notice'		=> 32768,   // you REALLY don't want all this, do you?
+		'notice'		=> 32768,   // detailed notice error messages?
+		'inc'       =>  65536,  // include files
+
 		'everything'=> 61439,   //(65535-4096) everything we know, and the rumors too
 		                        // (but shortcode paths removed: inline debug breaks pages!
 	);
diff -x .svn -aruN 0.7.15.src/e107_handlers/emailprint_class.php 0.7.16.src/e107_handlers/emailprint_class.php
--- 0.7.15.src/e107_handlers/emailprint_class.php	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_handlers/emailprint_class.php	2009-08-15 06:54:06.000000000 -0500
@@ -11,18 +11,16 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_handlers/emailprint_class.php,v $
-|     $Revision: 1.12 $
-|     $Date: 2008/09/04 20:07:10 $
-|     $Author: e107steved $
+|     $Revision: 1.13 $
+|     $Date: 2009/08/15 11:54:30 $
+|     $Author: marj_nl_fr $
 +----------------------------------------------------------------------------+
 */
 
 if (!defined('e107_INIT')) { exit; }
 
-@include_lan(e_LANGUAGEDIR.e_LANGUAGE."/lan_print.php");
-//@include_once(e_LANGUAGEDIR."English/lan_print.php");
-@include_lan(e_LANGUAGEDIR.e_LANGUAGE."/lan_email.php");
-//@include_once(e_LANGUAGEDIR."English/lan_email.php");
+include_lan(e_LANGUAGEDIR.e_LANGUAGE."/lan_print.php");
+include_lan(e_LANGUAGEDIR.e_LANGUAGE."/lan_email.php");
 
 class emailprint 
 {
diff -x .svn -aruN 0.7.15.src/e107_handlers/e_parse_class.php 0.7.16.src/e107_handlers/e_parse_class.php
--- 0.7.15.src/e107_handlers/e_parse_class.php	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_handlers/e_parse_class.php	2009-09-03 14:26:16.000000000 -0500
@@ -11,8 +11,8 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_handlers/e_parse_class.php,v $
-|     $Revision: 1.217 $
-|     $Date: 2008/11/16 19:58:36 $
+|     $Revision: 1.220 $
+|     $Date: 2009/09/03 19:26:40 $
 |     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
@@ -251,173 +251,190 @@
 		$nobreak is a list of tags within which word wrap is to be inactive
 		*/
 
-  if (!ctype_digit($width)) return $str;		// Don't wrap if non-numeric width
-  if ($width < 6) return $str;					// Trap stupid wrap counts, as well
-
-  // Transform protected element lists into arrays
-  $nobreak = explode(" ", strtolower($nobreak));
-
-  // Variable setup
-  $intag = false;
-  $innbk = array();
-  $drain = "";
-
-  // List of characters it is "safe" to insert line-breaks at
-  // It is not necessary to add < and > as they are automatically implied
-  $lbrks = "/?!%)-}]\\\"':;&";
-
-  // Is $str a UTF8 string?
-	if ($utf || strtolower(CHARSET) == 'utf-8')
-	{	// 0x1680, 0x180e, 0x2000-0x200a, 0x2028, 0x205f, 0x3000 are 'non-ASCII' Unicode UCS-4 codepoints - see http://www.unicode.org/Public/UNIDATA/UnicodeData.txt
-		// All convert to 3-byte utf-8 sequences:
-		// 0x1680	0xe1	0x9a	0x80
-		// 0x180e	0xe1	0xa0	0x8e
-		// 0x2000	0xe2	0x80	0x80
-		//   -
-		// 0x200a	0xe2	0x80	0x8a
-		// 0x2028	0xe2	0x80	0xa8
-		// 0x205f	0xe2	0x81	0x9f
-		// 0x3000	0xe3	0x80	0x80
-		$utf8 = 'u';
-		$whiteSpace = '#([\x20|\x0c]|[\xe1][\x9a][\x80]|[\xe1][\xa0][\x8e]|[\xe2][\x80][\x80-\x8a,\xa8]|[\xe2][\x81][\x9f]|[\xe3][\x80][\x80]+)#';	
-		// Have to explicitly enumerate the whitespace chars, and use non-utf-8 mode, otherwise regex fails on badly formed utf-8
-	}
-	else
-	{
-		$utf8 = '';
-		$whiteSpace = '#(\s+)#';		// For non-utf-8, can use a simple match string
-	}
-	
-
-// Start of the serious stuff - split into HTML tags and text between
-	  $content = preg_split('#(<.*?>)#mis', $str, -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE );
-	  foreach($content as $value)
-	  {
-		if ($value[0] == "<")
-		{  // We are within an HTML tag
-          // Create a lowercase copy of this tag's contents
-          $lvalue = strtolower(substr($value,1,-1));
-		  if ($lvalue)
-		  {	// Tag of non-zero length
-			// If the first character is not a / then this is an opening tag
-            if ($lvalue[0] != "/") 
-			{            // Collect the tag name   
-              preg_match("/^(\w*?)(\s|$)/", $lvalue, $t);
-
-              // If this is a protected element, activate the associated protection flag
-              if (in_array($t[1], $nobreak)) array_unshift($innbk, $t[1]);
-            }
-		    else 
-		    {  // Otherwise this is a closing tag
-              // If this is a closing tag for a protected element, unset the flag
-              if (in_array(substr($lvalue, 1), $nobreak)) 
-			  {
-                reset($innbk);
-                while (list($key, $tag) = each($innbk)) 
-				{
-                  if (substr($lvalue, 1) == $tag) 
-				  {
-                    unset($innbk[$key]);
-                    break;
-                  }
-                }
-                $innbk = array_values($innbk);
-              }
-            }
-		  }
-		  else
-		  {
-		    $value = '';		// Eliminate any empty tags altogether
-		  }
-        // Else if we're outside any tags, and with non-zero length string...
-        } 
-		elseif ($value) 
-		{    // If unprotected...
-          if (!count($innbk)) 
-		  {
-            // Use the ACK (006) ASCII symbol to replace all HTML entities temporarily
-            $value = str_replace("\x06", "", $value);
-            preg_match_all("/&([a-z\d]{2,7}|#\d{2,5});/i", $value, $ents);
-            $value = preg_replace("/&([a-z\d]{2,7}|#\d{2,5});/i", "\x06", $value);
-//			echo "Found block length ".strlen($value).': '.substr($value,20).'<br />';
-			// Split at spaces - note that this will fail if presented with invalid utf-8 when doing the regex whitespace search
-//			$split = preg_split('#(\s)#'.$utf8, $value, -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE );
-			$split = preg_split($whiteSpace, $value, -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE );
-			$value = '';
-			foreach ($split as $sp)
-			{
-//			echo "Split length ".strlen($sp).': '.substr($sp,20).'<br />';
-				$loopCount = 0;
-			  while (strlen($sp) > $width)
-			  {	// Enough characters that we may need to do something.
-				$pulled = '';
-				if ($utf8)
-				{
-				  // Pull out a piece of the maximum permissible length
-				  if (preg_match('#^((?:[\x00-\x7F]|[\xC0-\xFF][\x80-\xBF]+){0,'.$width.'})(.{0,1}).*#s',$sp,$matches) == 0)
-				  {
-					$value .= '[!<b>invalid utf-8: '.$sp.'<b>!]';		// Make any problems obvious for now
-					$sp = '';
-				  }
-				  elseif (empty($matches[2]))
-				  {  // utf-8 length is less than specified - treat as a special case
-				    $value .= $sp;
-					$sp = '';
-				  }
-				  else
-				  {		// Need to find somewhere to break the string
-					for ($i = strlen($matches[1])-1; $i >= 0; $i--)
+		// Don't wrap if non-numeric width
+		$width = intval($width);
+		// And trap stupid wrap counts
+		if ($width < 6)
+			return $str;
+
+		// Transform protected element lists into arrays
+		$nobreak = explode(" ", strtolower($nobreak));
+
+		// Variable setup
+		$intag = false;
+		$innbk = array();
+		$drain = "";
+
+		// List of characters it is "safe" to insert line-breaks at
+		// It is not necessary to add < and > as they are automatically implied
+		$lbrks = "/?!%)-}]\\\"':;&";
+
+		// Is $str a UTF8 string?
+		if ($utf || strtolower(CHARSET) == 'utf-8')
+		{
+			// 0x1680, 0x180e, 0x2000-0x200a, 0x2028, 0x205f, 0x3000 are 'non-ASCII' Unicode UCS-4 codepoints - see http://www.unicode.org/Public/UNIDATA/UnicodeData.txt
+			// All convert to 3-byte utf-8 sequences:
+			// 0x1680	0xe1	0x9a	0x80
+			// 0x180e	0xe1	0xa0	0x8e
+			// 0x2000	0xe2	0x80	0x80
+			//   -
+			// 0x200a	0xe2	0x80	0x8a
+			// 0x2028	0xe2	0x80	0xa8
+			// 0x205f	0xe2	0x81	0x9f
+			// 0x3000	0xe3	0x80	0x80
+			$utf8 = 'u';
+			$whiteSpace = '#([\x20|\x0c]|[\xe1][\x9a][\x80]|[\xe1][\xa0][\x8e]|[\xe2][\x80][\x80-\x8a,\xa8]|[\xe2][\x81][\x9f]|[\xe3][\x80][\x80]+)#';
+			// Have to explicitly enumerate the whitespace chars, and use non-utf-8 mode, otherwise regex fails on badly formed utf-8
+		}
+		else
+		{
+			$utf8 = '';
+			// For non-utf-8, can use a simple match string
+			$whiteSpace = '#(\s+)#';
+		}
+		
+
+		// Start of the serious stuff - split into HTML tags and text between
+		$content = preg_split('#(<.*?'.'>)#mis', $str, -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE );
+		foreach($content as $value)
+		{
+			if ($value[0] == "<")
+			{
+				// We are within an HTML tag
+				// Create a lowercase copy of this tag's contents
+				$lvalue = strtolower(substr($value,1,-1));
+				if ($lvalue)
+				{	// Tag of non-zero length
+					// If the first character is not a / then this is an opening tag
+					if ($lvalue[0] != "/")
 					{
-					  if (strpos($lbrks,$matches[1][$i]) !== FALSE) break;
-					}
-					if ($i < 0)
-					{	// No 'special' break character found - break at the word boundary
-					  $pulled = $matches[1];
+						// Collect the tag name
+						preg_match("/^(\w*?)(\s|$)/", $lvalue, $t);
+
+						// If this is a protected element, activate the associated protection flag
+						if (in_array($t[1], $nobreak)) array_unshift($innbk, $t[1]);
 					}
 					else
-					{
-					  $pulled = substr($sp,0,$i+1);
+					{  // Otherwise this is a closing tag
+						// If this is a closing tag for a protected element, unset the flag
+						if (in_array(substr($lvalue, 1), $nobreak))
+						{
+							reset($innbk);
+							while (list($key, $tag) = each($innbk))
+							{
+								if (substr($lvalue, 1) == $tag)
+								{
+									unset($innbk[$key]);
+									break;
+								}
+							}
+							$innbk = array_values($innbk);
+						}
 					}
-				  }
-				  $loopCount++;
-				  if ($loopCount > 20)
-				  {
-					$value .= '[!<b>loop count exceeded: '.$sp.'</b>!]';		// Make any problems obvious for now
-					$sp = '';
-				  }
 				}
 				else
 				{
-					for ($i = min($width,strlen($sp)); $i > 0; $i--)
-					{
-					  if (strpos($lbrks,$sp[$i-1]) !== FALSE) break;		// No speed advantage to defining match character
-					}
-					if ($i == 0)
-					{	// No 'special' break boundary character found - break at the word boundary
-					  $pulled = substr($sp,0,$width);
-					}
-					else
+					// Eliminate any empty tags altogether
+					$value = '';
+				}
+				// Else if we're outside any tags, and with non-zero length string...
+			}
+			elseif ($value)
+			{
+				// If unprotected...
+				if (!count($innbk))
+				{
+					// Use the ACK (006) ASCII symbol to replace all HTML entities temporarily
+					$value = str_replace("\x06", "", $value);
+					preg_match_all("/&([a-z\d]{2,7}|#\d{2,5});/i", $value, $ents);
+					$value = preg_replace("/&([a-z\d]{2,7}|#\d{2,5});/i", "\x06", $value);
+					//			echo "Found block length ".strlen($value).': '.substr($value,20).'<br />';
+					// Split at spaces - note that this will fail if presented with invalid utf-8 when doing the regex whitespace search
+					//			$split = preg_split('#(\s)#'.$utf8, $value, -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE );
+					$split = preg_split($whiteSpace, $value, -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE );
+					$value = '';
+					foreach ($split as $sp)
 					{
-					  $pulled = substr($sp,0,$i);
+						//			echo "Split length ".strlen($sp).': '.substr($sp,20).'<br />';
+						$loopCount = 0;
+						while (strlen($sp) > $width)
+						{
+							// Enough characters that we may need to do something.
+							$pulled = '';
+							if ($utf8)
+							{
+								// Pull out a piece of the maximum permissible length
+								if (preg_match('#^((?:[\x00-\x7F]|[\xC0-\xFF][\x80-\xBF]+){0,'.$width.'})(.{0,1}).*#s',$sp,$matches) == 0)
+								{
+									// Make any problems obvious for now
+									$value .= '[!<b>invalid utf-8: '.$sp.'<b>!]';
+									$sp = '';
+								}
+								elseif (empty($matches[2]))
+								{  // utf-8 length is less than specified - treat as a special case
+									$value .= $sp;
+									$sp = '';
+								}
+								else
+								{		// Need to find somewhere to break the string
+									for ($i = strlen($matches[1])-1; $i >= 0; $i--)
+									{
+										if (strpos($lbrks,$matches[1][$i]) !== FALSE) break;
+									}
+									if ($i < 0)
+									{	// No 'special' break character found - break at the word boundary
+										$pulled = $matches[1];
+									}
+									else
+									{
+										$pulled = substr($sp,0,$i+1);
+									}
+								}
+								$loopCount++;
+								if ($loopCount > 20)
+								{
+									// Make any problems obvious for now
+									$value .= '[!<b>loop count exceeded: '.$sp.'</b>!]';
+									$sp = '';
+								}
+							}
+							else
+							{
+								for ($i = min($width,strlen($sp)); $i > 0; $i--)
+								{
+									// No speed advantage to defining match character
+									if (strpos($lbrks,$sp[$i-1]) !== FALSE)
+										break;
+								}
+								if ($i == 0)
+								{	
+									// No 'special' break boundary character found - break at the word boundary
+									$pulled = substr($sp,0,$width);
+								}
+								else
+								{
+									$pulled = substr($sp,0,$i);
+								}
+							}
+							if ($pulled)
+							{
+								$value .= $pulled.$break;
+								// Shorten $sp by whatever we've processed (will work even for utf-8)
+								$sp = substr($sp,strlen($pulled));
+							}
+						}
+						// Add in any residue
+						$value .= $sp;
 					}
+					// Put captured HTML entities back into the string
+					foreach ($ents[0] as $ent) $value = preg_replace("/\x06/", $ent, $value, 1);
 				}
-				if ($pulled)
-				{
-				  $value .= $pulled.$break;
-				  $sp = substr($sp,strlen($pulled));			// Shorten $sp by whatever we've processed (will work even for utf-8)
-				}
-			  }
-			  $value .= $sp;		// Add in any residue
 			}
-            // Put captured HTML entities back into the string
-            foreach ($ents[0] as $ent) $value = preg_replace("/\x06/", $ent, $value, 1);
-          } 
-        }
-        // Send the modified segment down the drain
-        $drain .= $value;
-	  }
-	  // Return contents of the drain
-	  return $drain;
+			// Send the modified segment down the drain
+			$drain .= $value;
+		}
+		// Return contents of the drain
+		return $drain;
 	}
 
 
@@ -481,7 +498,7 @@
 				break;
 			}
 		}
-		$ret = ($tmp_pos > 0 ? substr($text, 0, $tmp_pos) : substr($text, 0, $pos));
+		$ret = ($tmp_pos > 0 ? substr($text, 0, $tmp_pos+1) : substr($text, 0, $pos));
 		if($pos < strlen($text))
 		{
 			$ret = $ret.$more;
@@ -668,24 +685,20 @@
               $text = preg_replace("#(^|[\s])([\w]+?://(?:[\w-%]+?)(?:\.[\w-%]+?)+.*?)(?=$|[\s()[\]<]|\.\s|\.$|,\s|,$)#is", "\\1<a href=\"\\2\" {$_ext}>".$pref['link_text']."</a>", $text);
 //			  $text = preg_replace("#(^|[\n \]])((www|ftp)\.[\w+-]+?\.[\w+\-.]*(?(?=/)(/.+?(?=\s|,\s))|(?=\W)))#is", "\\1<a href=\"http://\\2\" {$_ext}>".$pref['link_text']."</a>", $text);
 			  $text = preg_replace("#(^|[\s])((?:www|ftp)(?:\.[\w-%]+?){2}.*?)(?=$|[\s()[\]<]|\.\s|\.$|,\s|,$)#is", "\\1<a href=\"http://\\2\" {$_ext}>".$pref['link_text']."</a>", $text);
-              if(CHARSET != "utf-8" && CHARSET != "UTF-8")
-			  {
-                $email_text = ($pref['email_text']) ? $this->replaceConstants($pref['email_text']) : "\\1\\2&copy;\\3";
-              }
-			  else
-			  {
-                $email_text = ($pref['email_text']) ? $this->replaceConstants($pref['email_text']) : "\\1\\2©\\3";
-              }
+
+			  $email_text = ($pref['email_text']) ? $this->replaceConstants($pref['email_text']) : LAN_EMAIL_SUBS;
               $text = preg_replace("#([\n ])([a-z0-9\-_.]+?)@([\w\-]+\.([\w\-\.]+\.)*[\w]+)#i", "\\1<a rel='external' href='javascript:window.location=\"mai\"+\"lto:\"+\"\\2\"+\"@\"+\"\\3\";self.close();' onmouseover='window.status=\"mai\"+\"lto:\"+\"\\2\"+\"@\"+\"\\3\"; return true;' onmouseout='window.status=\"\";return true;'>".$email_text."</a>", $text);
-            }
+
+			}
 			else
 			{
-//            $text = preg_replace("#(^|[\n ])([\w]+?://[^ \"\n\r\t<,]*)#is", "\\1<a href=\"\\2\" rel=\"external\">\\2</a>", $text);
-              $text = preg_replace("#(^|[\s])([\w]+?://(?:[\w-%]+?)(?:\.[\w-%]+?)+.*?)(?=$|[\s()[\]<]|\.\s|\.$|,\s|,$)#is", "\\1<a href=\"\\2\" rel=\"external\">\\2</a>", $text);
-//			  $text = preg_replace("#(^|[\n \]])((www|ftp)\.[\w+-]+?\.[\w+\-.]*(?(?=/)(/.+?(?=\s|,\s))|(?=\W)))#is", "\\1<a href=\"http://\\2\" rel=\"external\">\\2</a>", $text);
-			  $text = preg_replace("#(^|[\s])((?:www|ftp)(?:\.[\w-%]+?){2}.*?)(?=$|[\s()[\]<]|\.\s|\.$|,\s|,$)#is", "\\1<a href=\"http://\\2\" rel=\"external\">\\2</a>", $text);
-              $text = preg_replace("#([\n ])([a-z0-9\-_.]+?)@([\w\-]+\.([\w\-\.]+\.)*[\w]+)#i", "\\1<a rel='external' href='javascript:window.location=\"mai\"+\"lto:\"+\"\\2\"+\"@\"+\"\\3\";self.close();' onmouseover='window.status=\"mai\"+\"lto:\"+\"\\2\"+\"@\"+\"\\3\"; return true;' onmouseout='window.status=\"\";return true;'>".LAN_EMAIL_SUBS."</a>", $text);
-            }
+	           	$email_text = (CHARSET != "utf-8" && CHARSET != "UTF-8") ? "\\1\\2&copy;\\3" : "\\1\\2©\\3";
+	//          $text = preg_replace("#(^|[\n ])([\w]+?://[^ \"\n\r\t<,]*)#is", "\\1<a href=\"\\2\" rel=\"external\">\\2</a>", $text);
+				$text = preg_replace("#(^|[\s])([\w]+?://(?:[\w-%]+?)(?:\.[\w-%]+?)+.*?)(?=$|[\s()[\]<]|\.\s|\.$|,\s|,$)#is", "\\1<a href=\"\\2\" rel=\"external\">\\2</a>", $text);
+	//			$text = preg_replace("#(^|[\n \]])((www|ftp)\.[\w+-]+?\.[\w+\-.]*(?(?=/)(/.+?(?=\s|,\s))|(?=\W)))#is", "\\1<a href=\"http://\\2\" rel=\"external\">\\2</a>", $text);
+				$text = preg_replace("#(^|[\s])((?:www|ftp)(?:\.[\w-%]+?){2}.*?)(?=$|[\s()[\]<]|\.\s|\.$|,\s|,$)#is", "\\1<a href=\"http://\\2\" rel=\"external\">\\2</a>", $text);
+				$text = preg_replace("#([\n ])([a-z0-9\-_.]+?)@([\w\-]+\.([\w\-\.]+\.)*[\w]+)#i", "\\1<a rel='external' href='javascript:window.location=\"mai\"+\"lto:\"+\"\\2\"+\"@\"+\"\\3\";self.close();' onmouseover='window.status=\"mai\"+\"lto:\"+\"\\2\"+\"@\"+\"\\3\"; return true;' onmouseout='window.status=\"\";return true;'>".$email_text."</a>", $text);
+			}
         }
 
 
diff -x .svn -aruN 0.7.15.src/e107_handlers/login.php 0.7.16.src/e107_handlers/login.php
--- 0.7.15.src/e107_handlers/login.php	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_handlers/login.php	2009-07-25 16:17:34.000000000 -0500
@@ -12,8 +12,8 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_handlers/login.php,v $
-|     $Revision: 1.40 $
-|     $Date: 2008/04/29 19:30:45 $
+|     $Revision: 1.44 $
+|     $Date: 2009/07/25 21:17:58 $
 |     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
@@ -23,7 +23,8 @@
 include_lan(e_LANGUAGEDIR.e_LANGUAGE."/lan_login.php");
 
 class userlogin {
-	function userlogin($username, $userpass, $autologin) {
+	function userlogin($username, $userpass, $autologin) 
+	{
 		/* Constructor
 		# Class called when user attempts to log in
 		#
@@ -42,18 +43,21 @@
 			return FALSE;
 		}
 
-	 	if(!is_object($sql)){
-		$sql = new db;
+	 	if(!is_object($sql))
+		{
+			$sql = new db;
 		}
 
 		$fip = $e107->getip();
-		if($sql -> db_Select("banlist", "*", "banlist_ip='{$fip}' ")) {
+		if($sql -> db_Select("banlist", "*", "banlist_ip='{$fip}' ")) 
+		{
 			exit;
 		}
 
 		$autologin = intval($autologin);
 
-		if ($pref['auth_method'] && $pref['auth_method'] != "e107") {
+		if ($pref['auth_method'] && $pref['auth_method'] != "e107") 
+		{
 			$auth_file = e_PLUGIN."alt_auth/".$pref['auth_method']."_auth.php";
 			if (file_exists($auth_file)) {
 				require_once(e_PLUGIN."alt_auth/alt_auth_login_class.php");
@@ -61,29 +65,37 @@
 			}
 		}
 
-		if ($pref['logcode'] && extension_loaded("gd")) {
+		if ($pref['logcode'] && extension_loaded("gd")) 
+		{
 			require_once(e_HANDLER."secure_img_handler.php");
 			$sec_img = new secure_image;
-			if (!$sec_img->verify_code($_POST['rand_num'], $_POST['code_verify'])) {
+			if (!$sec_img->verify_code($_POST['rand_num'], $_POST['code_verify'])) 
+			{
 				define("LOGINMESSAGE", LAN_303."<br /><br />");
 				return FALSE;
 			}
 		}
 		$username = preg_replace("/\sOR\s|\=|\#/", "", $username);
-		$username = substr($username, 0, 30);
+		if (strlen($username) > varset($pref['loginname_maxlength'],30))
+		{	// Login name too long - don't log as an error
+			$this->checkibr($fip);
+			return FALSE;
+		}
 		$ouserpass = $userpass;
 		$userpass = md5($ouserpass);
 
 		// This is only required for upgrades and only for those not using utf-8 to begin with..
-		if(isset($pref['utf-compatmode']) && (CHARSET == "utf-8" || CHARSET == "UTF-8")){
+		if(isset($pref['utf-compatmode']) && (CHARSET == "utf-8" || CHARSET == "UTF-8"))
+		{
 			$username = utf8_decode($username);
 			$userpass = md5(utf8_decode($ouserpass));
 		}
 
-		if (!$sql->db_Select("user", "*", "user_loginname = '".$tp -> toDB($username)."'")) {
+		if (!$sql->db_Select("user", "*", "user_loginname = '".$tp -> toDB($username)."'")) 
+		{
 			define("LOGINMESSAGE", LAN_300."<br /><br />");
-			$sql -> db_Insert("generic", "0, 'failed_login', '".time()."', 0, '{$fip}', 0, '".LAN_LOGIN_14." ::: ".LAN_LOGIN_1.": ".$tp -> toDB($username)."'");
-			$this -> checkibr($fip);
+			$sql->db_Insert('generic', "0, 'failed_login', '".time()."', 0, '{$fip}', 0, '".$tp->toDB(LAN_LOGIN_14.' ::: '.LAN_LOGIN_1.': '.$username)."' ");
+			$this->checkibr($fip);
 			return FALSE;
 		}
 		else if(!$sql->db_Select("user", "*", "user_loginname = '".$tp -> toDB($username)."' AND user_password = '{$userpass}'")) {
@@ -92,7 +104,7 @@
 		}
 		else if(!$sql->db_Select("user", "*", "user_loginname = '".$tp -> toDB($username)."' AND user_password = '{$userpass}' AND user_ban!=2 ")) {
 			define("LOGINMESSAGE", LAN_302."<br /><br />");
-               	$sql -> db_Insert("generic", "0, 'failed_login', '".time()."', 0, '{$fip}', 0, '".LAN_LOGIN_15." ::: ".LAN_LOGIN_1.": ".$tp -> toDB($username)."'");
+               	$sql->db_Insert('generic', "0, 'failed_login', '".time()."', 0, '{$fip}', 0, '".$tp->toDB(LAN_LOGIN_15.' ::: '.LAN_LOGIN_1.': '.$username)."' ");
 				$this -> checkibr($fip);
 			return FALSE;
 		} else {
@@ -110,7 +122,7 @@
 				if($pref['disallowMultiLogin']) {
 					if($sql -> db_Select("online", "online_ip", "online_user_id='".$user_id.".".$user_name."'")) {
 						define("LOGINMESSAGE", LAN_304."<br /><br />");
-						$sql -> db_Insert("generic", "0, 'failed_login', '".time()."', 0, '$fip', '$user_id', '".LAN_LOGIN_16." ::: ".LAN_LOGIN_1.": ".$tp -> toDB($username).", ".LAN_LOGIN_17.": ".md5($ouserpass)."' ");
+						$sql->db_Insert('generic', "0, 'failed_login', '".time()."', 0, '{$fip}', '$user_id', '".$tp->toDB(LAN_LOGIN_16.' ::: '.LAN_LOGIN_1.': '.$username.', '.LAN_LOGIN_17.': ').md5($ouserpass)."' ");
 						$this -> checkibr($fip);
 						return FALSE;
 					}
@@ -133,23 +145,23 @@
 				$edata_li = array("user_id" => $user_id, "user_name" => $username);
 				$e_event->trigger("login", $edata_li);
 				$redir = str_replace('&amp;','&',(e_QUERY ? e_SELF."?".e_QUERY : e_SELF));
-				if (strstr($_SERVER['SERVER_SOFTWARE'], "Apache")) {
-					header("Location: ".$redir);
-					exit;
-				} else {
-					echo "<script type='text/javascript'>document.location.href='{$redir}'</script>\n";
-				}
+
+				header("Location: ".$redir);
+				exit;
 			}
 		}
 	}
 
-	function checkibr($fip) {
+	function checkibr($fip) 
+	{
 		global $sql, $pref, $tp;
-		if($pref['autoban'] == 1 || $pref['autoban'] == 3){ // Flood + Login or Login Only.
-	   		$fails = $sql -> db_Count("generic", "(*)", "WHERE gen_ip='$fip' AND gen_type='failed_login' ");
-			if($fails > 10) {
+		if($pref['autoban'] == 1 || $pref['autoban'] == 3)
+		{ // Flood + Login or Login Only.
+	   		$fails = $sql -> db_Count("generic", "(*)", "WHERE gen_ip='{$fip}' AND gen_type='failed_login' ");
+			if($fails > 10) 
+			{
 				$sql -> db_Insert("banlist", "'$fip', '1', '".LAN_LOGIN_18."' ");
-		   		$sql -> db_Insert("generic", "0, 'auto_banned', '".time()."', 0, '$fip', '$user_id', '".LAN_LOGIN_20.": ".$tp -> toDB($username).", ".LAN_LOGIN_17.": ".md5($ouserpass)."' ");
+		   		$sql->db_Insert('generic', "0, 'auto_banned', '".time()."', 0, '{$fip}', 0, '".$tp->toDB(LAN_LOGIN_20.': '.$username.', '.LAN_LOGIN_17.': ').md5($ouserpass)."' ");
 			}
 		}
 	}
@@ -167,7 +179,7 @@
 					$count++;
 				}
 
-				$sql -> db_Update("user", "user_login='{$FN}', user_hideemail='{EMAILHIDE}', user_signature='{$SIG}', user_sess='{$PHOTO}', user_image='{$AV}', user_timezone='{$TZ}' WHERE user_id='".intval($user_id)."'");
+				$sql -> db_Update("user", "user_login='{$FN}', user_hideemail='{$EMAILHIDE}', user_signature='{$SIG}', user_sess='{$PHOTO}', user_image='{$AV}', user_timezone='{$TZ}' WHERE user_id='".intval($user_id)."'");
 
 				$ue_fields = "";
 				$fields = array("URL" => "homepage",
diff -x .svn -aruN 0.7.15.src/e107_handlers/mysql_class.php 0.7.16.src/e107_handlers/mysql_class.php
--- 0.7.15.src/e107_handlers/mysql_class.php	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_handlers/mysql_class.php	2009-07-17 09:19:36.000000000 -0500
@@ -12,9 +12,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_handlers/mysql_class.php,v $
-|     $Revision: 1.83 $
-|     $Date: 2007/10/15 10:29:13 $
-|     $Author: e107coders $
+|     $Revision: 1.84 $
+|     $Date: 2009/07/17 14:20:00 $
+|     $Author: marj_nl_fr $
 |
 +----------------------------------------------------------------------------+
 */
@@ -30,8 +30,8 @@
 * MySQL Abstraction class
 *
 * @package e107
-* @version $Revision: 1.83 $
-* @author $Author: e107coders $
+* @version $Revision: 1.84 $
+* @author $Author: marj_nl_fr $
 */
 class db {
 
@@ -47,44 +47,59 @@
 	var $mySQLlanguage;
 	var $mySQLinfo;
 	var $tabset;
+	
+	/**
+	 * @public  MySQL Charset
+	 **/
+	var $mySQLcharset;
 
 	/**
-	* @return db
-	* @desc db constructor gets language options from the cookie or session
-	* @access public
-	*/
-	function db() {
+	 * db constructor gets language options from the cookie or session
+	 * @access public
+	 * @return void
+	 */
+	function db()
+	{
 		global $pref, $eTraffic;
 		$eTraffic->BumpWho('Create db object', 1);
 		$langid = 'e107language_'.$pref['cookie_name'];
-		if ($pref['user_tracking'] == 'session') {
-			if (!isset($_SESSION[$langid])) { return; }
+		if ($pref['user_tracking'] == 'session')
+		{
+			if (!isset($_SESSION[$langid]))
+			{
+				return;
+			}
 			$this->mySQLlanguage = $_SESSION[$langid];
-		} else {
-			if (!isset($_COOKIE[$langid])) { return; }
+		}
+		else
+		{
+			if (!isset($_COOKIE[$langid]))
+			{
+				return;
+			}
 			$this->mySQLlanguage = $_COOKIE[$langid];
 		}
 	}
 
 	/**
-	* @return null or string error code
-	* @param string $mySQLserver IP Or hostname of the MySQL server
-	* @param string $mySQLuser MySQL username
-	* @param string $mySQLpassword MySQL Password
-	* @param string $mySQLdefaultdb The database schema to connect to
-	* @desc Connects to mySQL server and selects database - generally not required if your table is in the main DB.<br />
-	* <br />
-	* Example using e107 database with variables defined in config.php:<br />
-	* <code>$sql = new db;
-	* $sql->db_Connect($mySQLserver, $mySQLuser, $mySQLpassword, $mySQLdefaultdb);</code>
-	* <br />
-	* OR to connect an other database:<br />
-	* <code>$sql = new db;
-	* $sql->db_Connect('url_server_database', 'user_database', 'password_database', 'name_of_database');</code>
-	*
-	* @access public
-	*/
-	function db_Connect($mySQLserver, $mySQLuser, $mySQLpassword, $mySQLdefaultdb) 
+	 * @access public
+	 * Connects to mySQL server and selects database - generally not required if your table is in the main DB.<br />
+	 * <br />
+	 * Example using e107 database with variables defined in e107_config.php:<br />
+	 * <code>$sql = new db;
+	 * $sql->db_Connect($mySQLserver, $mySQLuser, $mySQLpassword, $mySQLdefaultdb);</code>
+	 * <br />
+	 * OR to connect an other database:<br />
+	 * <code>$sql = new db;
+	 * $sql->db_Connect('url_server_database', 'user_database', 'password_database', 'name_of_database');</code>
+	 *
+	 * @param string $mySQLserver IP Or hostname of the MySQL server
+	 * @param string $mySQLuser MySQL username
+	 * @param string $mySQLpassword MySQL Password
+	 * @param string $mySQLdefaultdb The database schema to connect to
+	 * @return null|string error code
+	 */
+	function db_Connect($mySQLserver, $mySQLuser, $mySQLpassword, $mySQLdefaultdb)
 	{
 		global $eTraffic, $db_ConnectionID;
 		$eTraffic->BumpWho('db Connect', 1);
@@ -96,29 +111,50 @@
 
 		$temp = $this->mySQLerror;
 		$this->mySQLerror = FALSE;
-		if(defined("USE_PERSISTANT_DB") && USE_PERSISTANT_DB == true){
-			if (!$this->mySQLaccess = @mysql_pconnect($this->mySQLserver, $this->mySQLuser, $this->mySQLpassword)) {
+		if(defined("USE_PERSISTANT_DB") && USE_PERSISTANT_DB == TRUE)
+		{
+			if ( ! $this->mySQLaccess = @mysql_pconnect($this->mySQLserver, $this->mySQLuser, $this->mySQLpassword))
+			{
 				return 'e1';
-			} else {
-				if (!@mysql_select_db($this->mySQLdefaultdb,$this->mySQLaccess)) {
+			}
+			else
+			{
+				if ( ! @mysql_select_db($this->mySQLdefaultdb, $this->mySQLaccess))
+				{
 					return 'e2';
-				} else {
+				}
+				else
+				{
 					$this->dbError('dbConnect/SelectDB');
 				}
 			}
-		} else {
-			
-			if (!$this->mySQLaccess = @mysql_connect($this->mySQLserver, $this->mySQLuser, $this->mySQLpassword)) {
+		}
+		else
+		{
+
+			if ( ! $this->mySQLaccess = @mysql_connect($this->mySQLserver, $this->mySQLuser, $this->mySQLpassword))
+			{
 				return 'e1';
-			} else {
-				if (!@mysql_select_db($this->mySQLdefaultdb,$this->mySQLaccess)) {
+			}
+			else
+			{
+				if ( ! @mysql_select_db($this->mySQLdefaultdb, $this->mySQLaccess))
+				{
 					return 'e2';
-				} else {
+				}
+				else
+				{
 					$this->dbError('dbConnect/SelectDB');
 				}
 			}
 		}
-	  if ($db_ConnectionID == NULL) $db_ConnectionID = $this->mySQLaccess;		// Save the connection resource
+		// Set utf8 connection?
+		//@TODO: simplify when yet undiscovered side-effects will be fixed
+		$this->db_Set_Charset();
+
+		// Save the connection resource
+		if ($db_ConnectionID == NULL)
+			$db_ConnectionID = $this->mySQLaccess;
 	}
 
 
@@ -810,6 +846,57 @@
 
 		return mysql_real_escape_string($data,$this->mySQLaccess);
 	}
+	
+	/**
+	 * Check if MySQL version is utf8 compatible and may be used as it accordingly to the user choice
+	 *
+	 * @access public
+	 * @param string    MySQL charset may be forced in special occasion.
+	 *                  UTF-8 encoding and decoding is left to the progammer
+	 * @param bool      TRUE enter debug mode. default FALSE
+	 * @return string   hardcoded error message
+	 */
+	function db_Set_Charset($charset = '', $debug = FALSE)
+	{
+		// Get the default user choice
+		global $mySQLcharset;
+		if (varset($mySQLcharset) != 'utf8')
+		{
+			// Only utf8 is accepted
+			$mySQLcharset = '';
+		}
+		$charset = ($charset ? $charset : $mySQLcharset);
+		$message = (( ! $charset && $debug) ? 'Empty charset!' : '');
+		if($charset)
+		{
+			if ( ! $debug)
+			{
+			    @mysql_query("SET NAMES `$charset`");
+			}
+			else
+			{
+				// Check if MySQL version is utf8 compatible
+				preg_match('/^(.*?)($|-)/', mysql_get_server_info(), $mysql_version);
+				if (version_compare($mysql_version[1], '4.1.2', '<'))
+				{
+					// reset utf8
+					//@TODO reset globally? $mySQLcharset = '';
+					$charset      = '';
+					$message      = 'MySQL version is not utf8 compatible!';
+				}
+				else
+				{
+					// Use db_Query() debug handler
+					$this->db_Query("SET NAMES `$charset`", NULL, '', $debug);
+				}
+			}
+		}
+
+		// Save mySQLcharset for further uses within this connection
+		$this->mySQLcharset = $charset;
+		return $message;
+	}
+	
 }
 
 ?>
\ No newline at end of file
diff -x .svn -aruN 0.7.15.src/e107_handlers/news_class.php 0.7.16.src/e107_handlers/news_class.php
--- 0.7.15.src/e107_handlers/news_class.php	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_handlers/news_class.php	2009-07-06 00:57:53.000000000 -0500
@@ -12,9 +12,9 @@
 | GNU General Public License (http://gnu.org).
 |
 | $Source: /cvsroot/e107/e107_0.7/e107_handlers/news_class.php,v $
-| $Revision: 1.77 $
-| $Date: 2007/12/20 20:47:55 $
-| $Author: e107steved $
+| $Revision: 1.78 $
+| $Date: 2009/07/06 05:58:17 $
+| $Author: marj_nl_fr $
 +---------------------------------------------------------------+
 */
 
@@ -207,7 +207,7 @@
 	}
 
 	function make_xml_compatible($original) {
-		global $tp, $ml;
+		global $tp;
 		if (!is_object($tp)) $tp = new e_parse;
 		$original = $tp->toHTML($original, TRUE);
 		$original = str_replace('&pound', '&amp;#163;', $original);
diff -x .svn -aruN 0.7.15.src/e107_handlers/notify_class.php 0.7.16.src/e107_handlers/notify_class.php
--- 0.7.15.src/e107_handlers/notify_class.php	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_handlers/notify_class.php	2009-08-11 12:24:56.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_handlers/notify_class.php,v $
-|     $Revision: 1.15 $
-|     $Date: 2007/03/22 21:26:27 $
-|     $Author: e107steved $
+|     $Revision: 1.16 $
+|     $Date: 2009/08/11 17:25:20 $
+|     $Author: marj_nl_fr $
 +----------------------------------------------------------------------------+
 */
 
@@ -33,31 +33,39 @@
 			}
 		}
 
-		if(defined("e_LANGUAGE") && is_readable(e_LANGUAGEDIR.e_LANGUAGE.'/lan_notify.php')) {
-			include_once(e_LANGUAGEDIR.e_LANGUAGE.'/lan_notify.php');
-		} else {
-			include_once(e_LANGUAGEDIR.'English/lan_notify.php');
-		}
+		include_lan(e_LANGUAGEDIR.e_LANGUAGE.'/lan_notify.php');
 	}
 
-	function send($id, $subject, $message) {
-		global $sql,$tp;
+	function send($id, $subject, $message)
+	{
+		global $sql, $tp;
 		e107_require_once(e_HANDLER.'mail.php');
 		$subject = SITENAME.': '.$subject;
-		if ($this -> notify_prefs['event'][$id]['type'] == 'main') {
+		if ($this -> notify_prefs['event'][$id]['type'] == 'main')
+		{
 			sendemail(SITEADMINEMAIL, $tp->toEmail($subject), $tp->toEmail($message));
-		} else if ($this -> notify_prefs['event'][$id]['type'] == 'class') {
-			if ($this -> notify_prefs['event'][$id]['class'] == '254') {
-				$sql -> db_Select('user', 'user_email', "user_admin = 1");
-			} else if ($this -> notify_prefs['event'][$id]['class'] == '253') {
-				$sql -> db_Select('user', 'user_email');
-			} else {
-				$sql -> db_Select('user', 'user_email', "user_class REGEXP '(^|,)(".$this -> notify_prefs['event'][$id]['class'].")(,|$)'");
+		}
+		elseif ($this -> notify_prefs['event'][$id]['type'] == 'class')
+		{
+			if ($this -> notify_prefs['event'][$id]['class'] == e_UC_ADMIN)
+			{
+				$sql -> db_Select('user', 'user_email', "user_admin = 1 AND user_ban = 0");
+			}
+			elseif ($this -> notify_prefs['event'][$id]['class'] == e_UC_MEMBER)
+			{
+				$sql -> db_Select('user', 'user_email', 'user_ban = 0');
+			}
+			else
+			{
+				$sql -> db_Select('user', 'user_email', "user_ban = 0 AND user_class REGEXP '(^|,)(".$this -> notify_prefs['event'][$id]['class'].")(,|$)'");
 			}
-			while ($email = $sql -> db_Fetch()) {
+			while ($email = $sql -> db_Fetch())
+			{
 				sendemail($email['user_email'], $tp->toEmail($subject), $tp->toEmail($message));
 			}
-		} else if ($this -> notify_prefs['event'][$id]['type'] == 'email') {
+		}
+		elseif ($this -> notify_prefs['event'][$id]['type'] == 'email')
+		{
 			sendemail($this -> notify_prefs['event'][$id]['email'], $tp->toEmail($subject), $tp->toEmail($message));
 		}
 	}
diff -x .svn -aruN 0.7.15.src/e107_handlers/np_class.php 0.7.16.src/e107_handlers/np_class.php
--- 0.7.15.src/e107_handlers/np_class.php	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_handlers/np_class.php	2009-08-15 06:54:06.000000000 -0500
@@ -11,16 +11,15 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_handlers/np_class.php,v $
-|     $Revision: 1.8 $
-|     $Date: 2006/10/07 00:19:31 $
-|     $Author: mcfly_e107 $
+|     $Revision: 1.9 $
+|     $Date: 2009/08/15 11:54:30 $
+|     $Author: marj_nl_fr $
 +----------------------------------------------------------------------------+
 */
 
 if (!defined('e107_INIT')) { exit; }
 
-@include_once(e_LANGUAGEDIR.e_LANGUAGE."/lan_np.php");
-@include_once(e_LANGUAGEDIR."English/lan_np.php");
+include_lan(e_LANGUAGEDIR.e_LANGUAGE."/lan_np.php");
 
 /**
  * Next / Previous handling class
diff -x .svn -aruN 0.7.15.src/e107_handlers/phpmailer/class.phpmailer.php 0.7.16.src/e107_handlers/phpmailer/class.phpmailer.php
--- 0.7.15.src/e107_handlers/phpmailer/class.phpmailer.php	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_handlers/phpmailer/class.phpmailer.php	2009-05-20 16:00:22.000000000 -0500
@@ -2,7 +2,7 @@
 /*~ class.phpmailer.php
 .---------------------------------------------------------------------------.
 |  Software: PHPMailer - PHP email class                                    |
-|   Version: 2.0.0 rc3                                                      |
+|   Version: 2.0.4                                                          |
 |   Contact: via sourceforge.net support pages (also www.codeworxtech.com)  |
 |      Info: http://phpmailer.sourceforge.net                               |
 |   Support: http://sourceforge.net/projects/phpmailer/                     |
@@ -28,7 +28,7 @@
  * PHPMailer - PHP email transport class
  * @package PHPMailer
  * @author Andy Prevost
- * @copyright 2004 - 2007 Andy Prevost
+ * @copyright 2004 - 2009 Andy Prevost
  */
 
 class PHPMailer {
@@ -139,7 +139,7 @@
    * Holds PHPMailer version.
    * @var string
    */
-  var $Version           = "2.0.0 rc3";
+  var $Version           = "2.0.4";
 
   /**
    * Sets the email address that a reading confirmation will be sent.
@@ -155,6 +155,13 @@
    */
   var $Hostname          = '';
 
+  /**
+   * Sets the message ID to be used in the Message-Id header.
+   * If empty, a unique id will be generated.
+   * @var string
+   */
+  var $MessageID         = '';
+
   /////////////////////////////////////////////////
   // PROPERTIES FOR SMTP
   /////////////////////////////////////////////////
@@ -250,6 +257,9 @@
   var $language        = array();
   var $error_count     = 0;
   var $LE              = "\n";
+  var $sign_cert_file  = "";
+  var $sign_key_file   = "";
+  var $sign_key_pass   = "";
 
   /////////////////////////////////////////////////
   // METHODS, VARIABLES
@@ -433,12 +443,14 @@
     fputs($mail, $header);
     fputs($mail, $body);
 
-    $result = pclose($mail) >> 8 & 0xFF;
+    $result = pclose($mail);
+    if (version_compare(phpversion(), '4.2.3') == -1) {
+      $result = $result >> 8 & 0xFF;
+    }
     if($result != 0) {
       $this->SetError($this->Lang('execute') . $this->Sendmail);
       return false;
     }
-
     return true;
   }
 
@@ -457,10 +469,10 @@
 
     $toArr = split(',', $to);
 
-    if ($this->Sender != '' && strlen(ini_get('safe_mode'))< 1) {
+    $params = sprintf("-oi -f %s", $this->Sender);
+    if ($this->Sender != '' && strlen(ini_get('safe_mode')) < 1) {
       $old_from = ini_get('sendmail_from');
       ini_set('sendmail_from', $this->Sender);
-      $params = sprintf("-oi -f %s", $this->Sender);
       if ($this->SingleTo === true && count($toArr) > 1) {
         foreach ($toArr as $key => $val) {
           $rt = @mail($val, $this->EncodeHeader($this->SecureHeader($this->Subject)), $body, $header, $params);
@@ -638,8 +650,20 @@
     } elseif (file_exists($lang_path.'phpmailer.lang-en.php')) {
       include($lang_path.'phpmailer.lang-en.php');
     } else {
-      $this->SetError('Could not load language file');
-      return false;
+      $PHPMAILER_LANG = array();
+      $PHPMAILER_LANG["provide_address"]      = 'You must provide at least one ' .
+      $PHPMAILER_LANG["mailer_not_supported"] = ' mailer is not supported.';
+      $PHPMAILER_LANG["execute"]              = 'Could not execute: ';
+      $PHPMAILER_LANG["instantiate"]          = 'Could not instantiate mail function.';
+      $PHPMAILER_LANG["authenticate"]         = 'SMTP Error: Could not authenticate.';
+      $PHPMAILER_LANG["from_failed"]          = 'The following From address failed: ';
+      $PHPMAILER_LANG["recipients_failed"]    = 'SMTP Error: The following ' .
+      $PHPMAILER_LANG["data_not_accepted"]    = 'SMTP Error: Data not accepted.';
+      $PHPMAILER_LANG["connect_host"]         = 'SMTP Error: Could not connect to SMTP host.';
+      $PHPMAILER_LANG["file_access"]          = 'Could not access file: ';
+      $PHPMAILER_LANG["file_open"]            = 'File Error: Could not open file: ';
+      $PHPMAILER_LANG["encoding"]             = 'Unknown encoding: ';
+      $PHPMAILER_LANG["signing"]              = 'Signing Error: ';
     }
     $this->language = $PHPMAILER_LANG;
 
@@ -692,6 +716,9 @@
    */
   function WrapText($message, $length, $qp_mode = false) {
     $soft_break = ($qp_mode) ? sprintf(" =%s", $this->LE) : $this->LE;
+    // If utf-8 encoding is used, we will need to make sure we don't
+    // split multibyte characters when we wrap
+    $is_utf8 = (strtolower($this->CharSet) == "utf-8");
 
     $message = $this->FixEOL($message);
     if (substr($message, -1) == $this->LE) {
@@ -710,9 +737,11 @@
           if ($e != 0) {
             if ($space_left > 20) {
               $len = $space_left;
-              if (substr($word, $len - 1, 1) == '=') {
+              if ($is_utf8) {
+                $len = $this->UTF8CharBoundary($word, $len);
+              } elseif (substr($word, $len - 1, 1) == "=") {
                 $len--;
-              } elseif (substr($word, $len - 2, 1) == '=') {
+              } elseif (substr($word, $len - 2, 1) == "=") {
                 $len -= 2;
               }
               $part = substr($word, 0, $len);
@@ -726,9 +755,11 @@
           }
           while (strlen($word) > 0) {
             $len = $length;
-            if (substr($word, $len - 1, 1) == '=') {
+            if ($is_utf8) {
+              $len = $this->UTF8CharBoundary($word, $len);
+            } elseif (substr($word, $len - 1, 1) == "=") {
               $len--;
-            } elseif (substr($word, $len - 2, 1) == '=') {
+            } elseif (substr($word, $len - 2, 1) == "=") {
               $len -= 2;
             }
             $part = substr($word, 0, $len);
@@ -757,6 +788,47 @@
   }
 
   /**
+   * Finds last character boundary prior to maxLength in a utf-8
+   * quoted (printable) encoded string.
+   * Original written by Colin Brown.
+   * @access private
+   * @param string $encodedText utf-8 QP text
+   * @param int    $maxLength   find last character boundary prior to this length
+   * @return int
+   */
+  function UTF8CharBoundary($encodedText, $maxLength) {
+    $foundSplitPos = false;
+    $lookBack = 3;
+    while (!$foundSplitPos) {
+      $lastChunk = substr($encodedText, $maxLength - $lookBack, $lookBack);
+      $encodedCharPos = strpos($lastChunk, "=");
+      if ($encodedCharPos !== false) {
+        // Found start of encoded character byte within $lookBack block.
+        // Check the encoded byte value (the 2 chars after the '=')
+        $hex = substr($encodedText, $maxLength - $lookBack + $encodedCharPos + 1, 2);
+        $dec = hexdec($hex);
+        if ($dec < 128) { // Single byte character.
+          // If the encoded char was found at pos 0, it will fit
+          // otherwise reduce maxLength to start of the encoded char
+          $maxLength = ($encodedCharPos == 0) ? $maxLength :
+          $maxLength - ($lookBack - $encodedCharPos);
+          $foundSplitPos = true;
+        } elseif ($dec >= 192) { // First byte of a multi byte character
+          // Reduce maxLength to split at start of character
+          $maxLength = $maxLength - ($lookBack - $encodedCharPos);
+          $foundSplitPos = true;
+        } elseif ($dec < 192) { // Middle byte of a multi byte character, look further back
+          $lookBack += 3;
+        }
+      } else {
+        // No encoded character found
+        $foundSplitPos = true;
+      }
+    }
+    return $maxLength;
+  }
+
+  /**
    * Set the body wrapping.
    * @access private
    * @return void
@@ -805,9 +877,6 @@
       } elseif (count($this->cc) == 0) {
         $result .= $this->HeaderLine('To', 'undisclosed-recipients:;');
       }
-      if(count($this->cc) > 0) {
-        $result .= $this->AddrAppend('Cc', $this->cc);
-      }
     }
 
     $from = array();
@@ -834,7 +903,11 @@
       $result .= $this->HeaderLine('Subject', $this->EncodeHeader($this->SecureHeader($this->Subject)));
     }
 
-    $result .= sprintf("Message-ID: <%s@%s>%s", $uniq_id, $this->ServerHostname(), $this->LE);
+    if($this->MessageID != '') {
+      $result .= $this->HeaderLine('Message-ID',$this->MessageID);
+    } else {
+      $result .= sprintf("Message-ID: <%s@%s>%s", $uniq_id, $this->ServerHostname(), $this->LE);
+    }
     $result .= $this->HeaderLine('X-Priority', $this->Priority);
     $result .= $this->HeaderLine('X-Mailer', 'PHPMailer (phpmailer.sourceforge.net) [version ' . $this->Version . ']');
 
@@ -846,8 +919,21 @@
     for($index = 0; $index < count($this->CustomHeader); $index++) {
       $result .= $this->HeaderLine(trim($this->CustomHeader[$index][0]), $this->EncodeHeader(trim($this->CustomHeader[$index][1])));
     }
-    $result .= $this->HeaderLine('MIME-Version', '1.0');
+    if (!$this->sign_key_file) {
+      $result .= $this->HeaderLine('MIME-Version', '1.0');
+      $result .= $this->GetMailMIME();
+    }
 
+    return $result;
+  }
+
+  /**
+   * Returns the message MIME.
+   * @access private
+   * @return string
+   */
+  function GetMailMIME() {
+    $result = '';
     switch($this->message_type) {
       case 'plain':
         $result .= $this->HeaderLine('Content-Transfer-Encoding', $this->Encoding);
@@ -883,6 +969,9 @@
    */
   function CreateBody() {
     $result = '';
+    if ($this->sign_key_file) {
+      $result .= $this->GetMailMIME();
+    }
 
     $this->SetWordWrap();
 
@@ -918,8 +1007,31 @@
         $result .= $this->AttachAll();
         break;
     }
+
     if($this->IsError()) {
       $result = '';
+    } else if ($this->sign_key_file) {
+      $file = tempnam("", "mail");
+      $fp = fopen($file, "w");
+      fwrite($fp, $result);
+      fclose($fp);
+      $signed = tempnam("", "signed");
+
+      if (@openssl_pkcs7_sign($file, $signed, "file://".$this->sign_cert_file, array("file://".$this->sign_key_file, $this->sign_key_pass), null)) {
+        $fp = fopen($signed, "r");
+        $result = fread($fp, filesize($this->sign_key_file));
+        $result = '';
+        while(!feof($fp)){
+          $result = $result . fread($fp, 1024);
+        }
+        fclose($fp);
+      } else {
+        $this->SetError($this->Lang("signing").openssl_error_string());
+        $result = '';
+      }
+
+      unlink($file);
+      unlink($signed);
     }
 
     return $result;
@@ -1061,14 +1173,14 @@
       $cid         = $this->attachment[$i][7];
 
       $mime[] = sprintf("--%s%s", $this->boundary[1], $this->LE);
-      $mime[] = sprintf("Content-Type: %s; name=\"%s\"%s", $type, $name, $this->LE);
+      $mime[] = sprintf("Content-Type: %s; name=\"%s\"%s", $type, $this->EncodeHeader($this->SecureHeader($name)), $this->LE);
       $mime[] = sprintf("Content-Transfer-Encoding: %s%s", $encoding, $this->LE);
 
       if($disposition == 'inline') {
         $mime[] = sprintf("Content-ID: <%s>%s", $cid, $this->LE);
       }
 
-      $mime[] = sprintf("Content-Disposition: %s; filename=\"%s\"%s", $disposition, $name, $this->LE.$this->LE);
+      $mime[] = sprintf("Content-Disposition: %s; filename=\"%s\"%s", $disposition, $this->EncodeHeader($this->SecureHeader($name)), $this->LE.$this->LE);
 
       /* Encode as string attachment */
       if($bString) {
@@ -1182,9 +1294,15 @@
     /* Try to select the encoding which should produce the shortest output */
     if (strlen($str)/3 < $x) {
       $encoding = 'B';
-      $encoded = base64_encode($str);
-      $maxlen -= $maxlen % 4;
-      $encoded = trim(chunk_split($encoded, $maxlen, "\n"));
+      if (function_exists('mb_strlen') && $this->HasMultiBytes($str)) {
+     // Use a custom function which correctly encodes and wraps long
+     // multibyte strings without breaking lines within a character
+        $encoded = $this->Base64EncodeWrapMB($str);
+      } else {
+        $encoded = base64_encode($str);
+        $maxlen -= $maxlen % 4;
+        $encoded = trim(chunk_split($encoded, $maxlen, "\n"));
+      }
     } else {
       $encoding = 'Q';
       $encoded = $this->EncodeQ($str, $position);
@@ -1199,6 +1317,60 @@
   }
 
   /**
+   * Checks if a string contains multibyte characters.
+   * @access private
+   * @param string $str multi-byte text to wrap encode
+   * @return bool
+   */
+  function HasMultiBytes($str) {
+    if (function_exists('mb_strlen')) {
+      return (strlen($str) > mb_strlen($str, $this->CharSet));
+    } else { // Assume no multibytes (we can't handle without mbstring functions anyway)
+      return False;
+    }
+  }
+
+  /**
+   * Correctly encodes and wraps long multibyte strings for mail headers
+   * without breaking lines within a character.
+   * Adapted from a function by paravoid at http://uk.php.net/manual/en/function.mb-encode-mimeheader.php
+   * @access private
+   * @param string $str multi-byte text to wrap encode
+   * @return string
+   */
+  function Base64EncodeWrapMB($str) {
+    $start = "=?".$this->CharSet."?B?";
+    $end = "?=";
+    $encoded = "";
+
+    $mb_length = mb_strlen($str, $this->CharSet);
+    // Each line must have length <= 75, including $start and $end
+    $length = 75 - strlen($start) - strlen($end);
+    // Average multi-byte ratio
+    $ratio = $mb_length / strlen($str);
+    // Base64 has a 4:3 ratio
+    $offset = $avgLength = floor($length * $ratio * .75);
+
+    for ($i = 0; $i < $mb_length; $i += $offset) {
+      $lookBack = 0;
+
+      do {
+        $offset = $avgLength - $lookBack;
+        $chunk = mb_substr($str, $i, $offset, $this->CharSet);
+        $chunk = base64_encode($chunk);
+        $lookBack++;
+      }
+      while (strlen($chunk) > $length);
+
+      $encoded .= $chunk . $this->LE;
+    }
+
+    // Chomp the last linefeed
+    $encoded = substr($encoded, 0, -strlen($this->LE));
+    return $encoded;
+  }
+
+  /**
    * Encode string to quoted-printable.
    * @access private
    * @return string
@@ -1241,7 +1413,7 @@
       } // end of for
       $output .= $newline.$eol;
     } // end of while
-    return trim($output);
+    return $output;
   }
 
   /**
@@ -1538,25 +1710,32 @@
    * @access public
    * @return $message
    */
-  function MsgHTML($message) {
+  function MsgHTML($message,$basedir='') {
     preg_match_all("/(src|background)=\"(.*)\"/Ui", $message, $images);
     if(isset($images[2])) {
       foreach($images[2] as $i => $url) {
-        $filename  = basename($url);
-        $directory = dirname($url);
-        $cid       = 'cid:' . md5($filename);
-        $fileParts = split("\.", $filename);
-        $ext       = $fileParts[1];
-        $mimeType  = $this->_mime_types($ext);
-        $message = preg_replace("/".$images[1][$i]."=\"".preg_quote($url, '/')."\"/Ui", $images[1][$i]."=\"".$cid."\"", $message);
-        $this->AddEmbeddedImage($url, md5($filename), $filename, 'base64', $mimeType);
+        // do not change urls for absolute images (thanks to corvuscorax)
+        if (!preg_match('/^[A-z][A-z]*:\/\//',$url)) {
+          $filename = basename($url);
+          $directory = dirname($url);
+          ($directory == '.')?$directory='':'';
+          $cid = 'cid:' . md5($filename);
+          $fileParts = split("\.", $filename);
+          $ext = $fileParts[1];
+          $mimeType = $this->_mime_types($ext);
+          if ( strlen($basedir) > 1 && substr($basedir,-1) != '/') { $basedir .= '/'; }
+          if ( strlen($directory) > 1 && substr($directory,-1) != '/') { $directory .= '/'; }
+          if ( $this->AddEmbeddedImage($basedir.$directory.$filename, md5($filename), $filename, 'base64',$mimeType) ) {
+            $message = preg_replace("/".$images[1][$i]."=\"".preg_quote($url, '/')."\"/Ui", $images[1][$i]."=\"".$cid."\"", $message);
+          }
+        }
       }
     }
     $this->IsHTML(true);
     $this->Body = $message;
-    $textMsg = trim(strip_tags($message));
+    $textMsg = trim(strip_tags(preg_replace('/<(head|title|style|script)[^>]*>.*?<\/\\1>/s','',$message)));
     if ( !empty($textMsg) && empty($this->AltBody) ) {
-      $this->AltBody = $textMsg;
+      $this->AltBody = html_entity_decode($textMsg);
     }
     if ( empty($this->AltBody) ) {
       $this->AltBody = 'To view this email message, open the email in with HTML compatibility!' . "\n\n";
@@ -1570,95 +1749,94 @@
    */
   function _mime_types($ext = '') {
     $mimes = array(
-      'hqx'  =>  'application/mac-binhex40',
-      'cpt'   =>  'application/mac-compactpro',
-      'doc'   =>  'application/msword',
+      'ai'    =>  'application/postscript',
+      'aif'   =>  'audio/x-aiff',
+      'aifc'  =>  'audio/x-aiff',
+      'aiff'  =>  'audio/x-aiff',
+      'avi'   =>  'video/x-msvideo',
       'bin'   =>  'application/macbinary',
-      'dms'   =>  'application/octet-stream',
-      'lha'   =>  'application/octet-stream',
-      'lzh'   =>  'application/octet-stream',
-      'exe'   =>  'application/octet-stream',
+      'bmp'   =>  'image/bmp',
       'class' =>  'application/octet-stream',
-      'psd'   =>  'application/octet-stream',
-      'so'    =>  'application/octet-stream',
-      'sea'   =>  'application/octet-stream',
-      'dll'   =>  'application/octet-stream',
-      'oda'   =>  'application/oda',
-      'pdf'   =>  'application/pdf',
-      'ai'    =>  'application/postscript',
-      'eps'   =>  'application/postscript',
-      'ps'    =>  'application/postscript',
-      'smi'   =>  'application/smil',
-      'smil'  =>  'application/smil',
-      'mif'   =>  'application/vnd.mif',
-      'xls'   =>  'application/vnd.ms-excel',
-      'ppt'   =>  'application/vnd.ms-powerpoint',
-      'wbxml' =>  'application/vnd.wap.wbxml',
-      'wmlc'  =>  'application/vnd.wap.wmlc',
+      'cpt'   =>  'application/mac-compactpro',
+      'css'   =>  'text/css',
       'dcr'   =>  'application/x-director',
       'dir'   =>  'application/x-director',
-      'dxr'   =>  'application/x-director',
+      'dll'   =>  'application/octet-stream',
+      'dms'   =>  'application/octet-stream',
+      'doc'   =>  'application/msword',
       'dvi'   =>  'application/x-dvi',
+      'dxr'   =>  'application/x-director',
+      'eml'   =>  'message/rfc822',
+      'eps'   =>  'application/postscript',
+      'exe'   =>  'application/octet-stream',
+      'gif'   =>  'image/gif',
       'gtar'  =>  'application/x-gtar',
-      'php'   =>  'application/x-httpd-php',
-      'php4'  =>  'application/x-httpd-php',
-      'php3'  =>  'application/x-httpd-php',
-      'phtml' =>  'application/x-httpd-php',
-      'phps'  =>  'application/x-httpd-php-source',
+      'htm'   =>  'text/html',
+      'html'  =>  'text/html',
+      'jpe'   =>  'image/jpeg',
+      'jpeg'  =>  'image/jpeg',
+      'jpg'   =>  'image/jpeg',
+      'hqx'   =>  'application/mac-binhex40',
       'js'    =>  'application/x-javascript',
-      'swf'   =>  'application/x-shockwave-flash',
-      'sit'   =>  'application/x-stuffit',
-      'tar'   =>  'application/x-tar',
-      'tgz'   =>  'application/x-tar',
-      'xhtml' =>  'application/xhtml+xml',
-      'xht'   =>  'application/xhtml+xml',
-      'zip'   =>  'application/zip',
+      'lha'   =>  'application/octet-stream',
+      'log'   =>  'text/plain',
+      'lzh'   =>  'application/octet-stream',
       'mid'   =>  'audio/midi',
       'midi'  =>  'audio/midi',
-      'mpga'  =>  'audio/mpeg',
+      'mif'   =>  'application/vnd.mif',
+      'mov'   =>  'video/quicktime',
+      'movie' =>  'video/x-sgi-movie',
       'mp2'   =>  'audio/mpeg',
       'mp3'   =>  'audio/mpeg',
-      'aif'   =>  'audio/x-aiff',
-      'aiff'  =>  'audio/x-aiff',
-      'aifc'  =>  'audio/x-aiff',
+      'mpe'   =>  'video/mpeg',
+      'mpeg'  =>  'video/mpeg',
+      'mpg'   =>  'video/mpeg',
+      'mpga'  =>  'audio/mpeg',
+      'oda'   =>  'application/oda',
+      'pdf'   =>  'application/pdf',
+      'php'   =>  'application/x-httpd-php',
+      'php3'  =>  'application/x-httpd-php',
+      'php4'  =>  'application/x-httpd-php',
+      'phps'  =>  'application/x-httpd-php-source',
+      'phtml' =>  'application/x-httpd-php',
+      'png'   =>  'image/png',
+      'ppt'   =>  'application/vnd.ms-powerpoint',
+      'ps'    =>  'application/postscript',
+      'psd'   =>  'application/octet-stream',
+      'qt'    =>  'video/quicktime',
+      'ra'    =>  'audio/x-realaudio',
       'ram'   =>  'audio/x-pn-realaudio',
       'rm'    =>  'audio/x-pn-realaudio',
       'rpm'   =>  'audio/x-pn-realaudio-plugin',
-      'ra'    =>  'audio/x-realaudio',
+      'rtf'   =>  'text/rtf',
+      'rtx'   =>  'text/richtext',
       'rv'    =>  'video/vnd.rn-realvideo',
-      'wav'   =>  'audio/x-wav',
-      'bmp'   =>  'image/bmp',
-      'gif'   =>  'image/gif',
-      'jpeg'  =>  'image/jpeg',
-      'jpg'   =>  'image/jpeg',
-      'jpe'   =>  'image/jpeg',
-      'png'   =>  'image/png',
-      'tiff'  =>  'image/tiff',
-      'tif'   =>  'image/tiff',
-      'css'   =>  'text/css',
-      'html'  =>  'text/html',
-      'htm'   =>  'text/html',
+      'sea'   =>  'application/octet-stream',
       'shtml' =>  'text/html',
-      'txt'   =>  'text/plain',
+      'sit'   =>  'application/x-stuffit',
+      'so'    =>  'application/octet-stream',
+      'smi'   =>  'application/smil',
+      'smil'  =>  'application/smil',
+      'swf'   =>  'application/x-shockwave-flash',
+      'tar'   =>  'application/x-tar',
       'text'  =>  'text/plain',
-      'log'   =>  'text/plain',
-      'rtx'   =>  'text/richtext',
-      'rtf'   =>  'text/rtf',
-      'xml'   =>  'text/xml',
-      'xsl'   =>  'text/xml',
-      'mpeg'  =>  'video/mpeg',
-      'mpg'   =>  'video/mpeg',
-      'mpe'   =>  'video/mpeg',
-      'qt'    =>  'video/quicktime',
-      'mov'   =>  'video/quicktime',
-      'avi'   =>  'video/x-msvideo',
-      'movie' =>  'video/x-sgi-movie',
-      'doc'   =>  'application/msword',
+      'txt'   =>  'text/plain',
+      'tgz'   =>  'application/x-tar',
+      'tif'   =>  'image/tiff',
+      'tiff'  =>  'image/tiff',
+      'wav'   =>  'audio/x-wav',
+      'wbxml' =>  'application/vnd.wap.wbxml',
+      'wmlc'  =>  'application/vnd.wap.wmlc',
       'word'  =>  'application/msword',
+      'xht'   =>  'application/xhtml+xml',
+      'xhtml' =>  'application/xhtml+xml',
       'xl'    =>  'application/excel',
-      'eml'   =>  'message/rfc822'
+      'xls'   =>  'application/vnd.ms-excel',
+      'xml'   =>  'text/xml',
+      'xsl'   =>  'text/xml',
+      'zip'   =>  'application/zip'
     );
-    return ( ! isset($mimes[strtolower($ext)])) ? 'application/x-unknown-content-type' : $mimes[strtolower($ext)];
+    return ( ! isset($mimes[strtolower($ext)])) ? 'application/octet-stream' : $mimes[strtolower($ext)];
   }
 
   /**
@@ -1713,6 +1891,19 @@
     return $str;
   }
 
+  /**
+   * Set the private key file and password to sign the message.
+   *
+   * @access public
+   * @param string $key_filename Parameter File Name
+   * @param string $key_pass Password for private key
+   */
+  function Sign($cert_filename, $key_filename, $key_pass) {
+    $this->sign_cert_file = $cert_filename;
+    $this->sign_key_file = $key_filename;
+    $this->sign_key_pass = $key_pass;
+  }
+
 }
 
-?>
+?>
\ No newline at end of file
diff -x .svn -aruN 0.7.15.src/e107_handlers/phpmailer/class.pop3.php 0.7.16.src/e107_handlers/phpmailer/class.pop3.php
--- 0.7.15.src/e107_handlers/phpmailer/class.pop3.php	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_handlers/phpmailer/class.pop3.php	2009-05-20 16:00:22.000000000 -0500
@@ -2,7 +2,7 @@
 /*~ class.pop3.php
 .---------------------------------------------------------------------------.
 |  Software: PHPMailer - PHP email class                                    |
-|   Version: 2.0.0 rc2                                                      |
+|   Version: 2.0.4                                                          |
 |   Contact: via sourceforge.net support pages (also www.codeworxtech.com)  |
 |      Info: http://phpmailer.sourceforge.net                               |
 |   Support: http://sourceforge.net/projects/phpmailer/                     |
@@ -26,7 +26,6 @@
 
 /**
  * POP Before SMTP Authentication Class
- * Version 1.0
  *
  * Author: Richard Davey (rich@corephp.co.uk)
  * License: LGPL, see PHPMailer License
diff -x .svn -aruN 0.7.15.src/e107_handlers/phpmailer/class.smtp.php 0.7.16.src/e107_handlers/phpmailer/class.smtp.php
--- 0.7.15.src/e107_handlers/phpmailer/class.smtp.php	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_handlers/phpmailer/class.smtp.php	2009-05-20 16:00:22.000000000 -0500
@@ -2,7 +2,7 @@
 /*~ class.smtp.php
 .---------------------------------------------------------------------------.
 |  Software: PHPMailer - PHP email class                                    |
-|   Version: 2.0.0 rc1                                                      |
+|   Version: 2.0.4                                                          |
 |   Contact: via sourceforge.net support pages (also www.codeworxtech.com)  |
 |      Info: http://phpmailer.sourceforge.net                               |
 |   Support: http://sourceforge.net/projects/phpmailer/                     |
diff -x .svn -aruN 0.7.15.src/e107_handlers/phpmailer/language/phpmailer.lang-en.php 0.7.16.src/e107_handlers/phpmailer/language/phpmailer.lang-en.php
--- 0.7.15.src/e107_handlers/phpmailer/language/phpmailer.lang-en.php	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_handlers/phpmailer/language/phpmailer.lang-en.php	2009-05-20 16:00:22.000000000 -0500
@@ -1,21 +1,23 @@
 <?php
 /**
-* PHPMailer language file.
-* English Version
-*/
-	
+ * PHPMailer language file.
+ * English Version
+ */
+
 $PHPMAILER_LANG = array();
-	
-$PHPMAILER_LANG["provide_address"] = 'You must provide at least one ' . 'recipient email address.';
-$PHPMAILER_LANG["mailer_not_supported"] = ' mailer is not supported.';
-$PHPMAILER_LANG["execute"] = 'Could not execute: ';
-$PHPMAILER_LANG["instantiate"] = 'Could not instantiate mail function.';
-$PHPMAILER_LANG["authenticate"] = 'SMTP Error: Could not authenticate.';
-$PHPMAILER_LANG["from_failed"] = 'The following From address failed: ';
-$PHPMAILER_LANG["recipients_failed"] = 'SMTP Error: The following ' . 'recipients failed: ';
-$PHPMAILER_LANG["data_not_accepted"] = 'SMTP Error: Data not accepted.';
-$PHPMAILER_LANG["connect_host"] = 'SMTP Error: Could not connect to SMTP host.';
-$PHPMAILER_LANG["file_access"] = 'Could not access file: ';
-$PHPMAILER_LANG["file_open"] = 'File Error: Could not open file: ';
-$PHPMAILER_LANG["encoding"] = 'Unknown encoding: ';
+
+$PHPMAILER_LANG['provide_address']      = 'You must provide at least one recipient email address.';
+$PHPMAILER_LANG['mailer_not_supported'] = ' mailer is not supported.';
+$PHPMAILER_LANG['execute']              = 'Could not execute: ';
+$PHPMAILER_LANG['instantiate']          = 'Could not instantiate mail function.';
+$PHPMAILER_LANG['authenticate']         = 'SMTP Error: Could not authenticate.';
+$PHPMAILER_LANG['from_failed']          = 'The following From address failed: ';
+$PHPMAILER_LANG['recipients_failed']    = 'SMTP Error: The following recipients failed: ';
+$PHPMAILER_LANG['data_not_accepted']    = 'SMTP Error: Data not accepted.';
+$PHPMAILER_LANG['connect_host']         = 'SMTP Error: Could not connect to SMTP host.';
+$PHPMAILER_LANG['file_access']          = 'Could not access file: ';
+$PHPMAILER_LANG['file_open']            = 'File Error: Could not open file: ';
+$PHPMAILER_LANG['encoding']             = 'Unknown encoding: ';
+$PHPMAILER_LANG['signing']              = 'Signing Error: ';
+$PHPMAILER_LANG['smtp_error']           = 'SMTP server error: ';
 ?>
\ No newline at end of file
diff -x .svn -aruN 0.7.15.src/e107_handlers/pref_class.php 0.7.16.src/e107_handlers/pref_class.php
--- 0.7.15.src/e107_handlers/pref_class.php	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_handlers/pref_class.php	2008-12-30 10:50:31.000000000 -0600
@@ -10,6 +10,11 @@
 |
 | Released under the terms and conditions of the
 | GNU General Public License (http://gnu.org).
+|
+|		$Source: /cvsroot/e107/e107_0.7/e107_handlers/pref_class.php,v $
+|		$Revision: 1.14 $
+|		$Date: 2008/12/30 16:50:54 $
+|		$Author: e107steved $
 +---------------------------------------------------------------+
 */
 
@@ -30,14 +35,21 @@
 //  Just to be safe I have changed a number of menu_pref edits to use setArray().
 //
 
-class prefs {
+class prefs 
+{
 	var $prefVals;
 	var $prefArrays;
 
-	// List of rows that shouldn't be automatically extracted (delimeted by '|')
+	// Default prefs to load
 	var $DefaultRows = "e107_name='e107' OR e107_name='menu_pref' OR e107_name='notify_prefs'";
 
-	function ExtractPrefs($RowList = "", $use_default = FALSE) {
+	// Read prefs from DB - get as many rows as are required with a single query.
+	// $RowList is an array of pref entries to retrieve.
+	// If $use_default is TRUE, $RowList entries are added to the default array. Otherwise only $RowList is used.
+	// Returns TRUE on success (measured as getting at least one row of data); false on error.
+	// Any data read is buffered (in serialised form) here - retrieve using get()
+	function ExtractPrefs($RowList = "", $use_default = FALSE) 
+	{
 		global $sql;
 		$Args = '';
 		if($use_default)
@@ -51,36 +63,50 @@
 				$Args .= ($Args ? " OR e107_name='{$v}'" : "e107_name='{$v}'");
 			}
 		}
-		$sql->db_Select('core', '*', $Args, 'default');
+		if (!$sql->db_Select('core', '*', $Args, 'default'))
+		{
+			return FALSE;
+		}
 		while ($row = $sql->db_Fetch())
 		{
 			$this->prefVals['core'][$row['e107_name']] = $row['e107_value'];
 		}
+		return TRUE;
 	}
 
+
 	/**
 	* Return current pref string $name from $table (only core for now)
 	*
 	* - @param  string $name -- name of pref row
 	* - @param  string $table -- "core"
-	* - @return  string pref value, slashes already stripped
+	* - @return  string pref value, slashes already stripped. FALSE on error
 	* - @access  public
 	*/
-	function get($Name) {
-		if(isset($this->prefVals['core'][$Name])){
-			if($this->prefVals['core'][$Name] != '### ROW CACHE FALSE ###'){
-				return $this->prefVals['core'][$Name];
-			} else {
+	function get($Name) 
+	{
+		if(isset($this->prefVals['core'][$Name]))
+		{
+			if($this->prefVals['core'][$Name] != '### ROW CACHE FALSE ###')
+			{
+				return $this->prefVals['core'][$Name];		// Dava from cache
+			} 
+			else 
+			{
 				return false;
 			}
 		}
 
+		// Data not in cache - retrieve from DB
 		$get_sql = new db; // required so sql loops don't break using $tp->toHTML(). 
-		if($get_sql->db_Select('core', '*', "`e107_name` = '{$Name}'", 'default')) {
+		if($get_sql->db_Select('core', '*', "`e107_name` = '{$Name}'", 'default')) 
+		{
 			$row = $get_sql->db_Fetch();
 			$this->prefVals['core'][$Name] = $row['e107_value'];
 			return $this->prefVals['core'][$Name];
-		} else {
+		} 
+		else 
+		{	// Data not in DB - put a 'doesn't exist' entry in cache to save another DB access
 			$this->prefVals['core'][$Name] = '### ROW CACHE FALSE ###';
 			return false;
 		}
diff -x .svn -aruN 0.7.15.src/e107_handlers/rate_class.php 0.7.16.src/e107_handlers/rate_class.php
--- 0.7.15.src/e107_handlers/rate_class.php	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_handlers/rate_class.php	2009-08-15 06:54:06.000000000 -0500
@@ -11,16 +11,16 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_handlers/rate_class.php,v $
-|     $Revision: 1.20 $
-|     $Date: 2007/01/10 21:30:34 $
-|     $Author: e107steved $
+|     $Revision: 1.21 $
+|     $Date: 2009/08/15 11:54:30 $
+|     $Author: marj_nl_fr $
 +----------------------------------------------------------------------------+
 */
 
 if (!defined('e107_INIT')) { exit; }
 
-@include_once(e_LANGUAGEDIR.e_LANGUAGE."/lan_rate.php");
-@include_once(e_LANGUAGEDIR."English/lan_rate.php");
+include_lan(e_LANGUAGEDIR.e_LANGUAGE."/lan_rate.php");
+
 class rater {
 	function rateselect($text, $table, $id, $mode=FALSE) {
 		//$mode	: if mode is set, no urljump will be used (used in combined comments+rating system)
diff -x .svn -aruN 0.7.15.src/e107_handlers/resize_handler.php 0.7.16.src/e107_handlers/resize_handler.php
--- 0.7.15.src/e107_handlers/resize_handler.php	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_handlers/resize_handler.php	2009-04-23 15:23:25.000000000 -0500
@@ -11,8 +11,8 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_handlers/resize_handler.php,v $
-|     $Revision: 1.12 $
-|     $Date: 2008/10/03 20:28:30 $
+|     $Revision: 1.13 $
+|     $Date: 2009/04/23 20:23:49 $
 |     $Author: e107steved $
 |
 |
@@ -20,6 +20,23 @@
 */
 if (!defined('e107_INIT')) { exit; }
 
+// Given an image file name, return the mime type string. Returns FALSE if invalid
+function mimeFromFilename($fileName)
+{
+	$fileExt = strtolower(substr(strrchr($fileName, "."), 1));
+	$mimeTypes = array(
+		'jpg' 	=> 'jpeg',
+		'gif' 	=> 'gif',
+		'png'	=> 'png',
+		'jpeg'	=> 'jpeg',
+		'pjpeg' => 'jpeg',
+		'bmp'	=> 'bmp'
+		);
+	if (!isset($mimeTypes[$fileExt])) {	return FALSE;  }		// only allow image files  }
+	return "Content-type: image/".$mimeTypes[$fileExt];
+}
+
+
 function resize_image($source_file, $destination_file, $type = "upload", $model = "") 
 {
 // $destination_file - 'stdout' sends direct to browser. Otherwise treated as file name	
@@ -46,16 +63,16 @@
 	$mode = ($pref['resize_method'] ? $pref['resize_method'] : "gd2");
 	if ($type == "upload") 
 	{
-	  $new_size = varset($pref['im_width'],400);
+		$new_size = varset($pref['im_width'],400);
 	}
 	elseif(is_numeric($type)) 
 	{
-	  $new_size = $type;
+		$new_size = $type;
 	} 
 	else 
 	{	// Use preferences or failing that hard-coded defaults for new size
-	  $new_size = varset($pref['im_width'], 120);
-	  $new_height = varset($pref['im_height'], 100);
+		$new_size = varset($pref['im_width'], 120);
+		$new_height = varset($pref['im_height'], 100);
 	}
 
 
@@ -66,18 +83,18 @@
 	if ($image_stats == null) 
 	{
 //	  echo "<b>DEBUG</b> image_stats are null<br />";
-	  return false;
+		return false;
 	}
 	if (($image_stats[0] == 0) || ($image_stats[1] == 0))
 	{
-	  return FALSE;				// Zero sized image - shouldn't happen
+		return FALSE;				// Zero sized image - shouldn't happen
 	}
 	 
 	// Check the image type. '1'=GIF, '2'=jpeg, '3' = PNG
 	if ($image_stats[2] != 1 && $image_stats[2] != 2 && $image_stats[2] != 3 && ($mode == 'gd1' || $mode == 'gd2')) 
 	{
-	  echo "<b>DEBUG</b> Wrong image type<br />";
-	  return FALSE;
+		echo "<b>DEBUG</b> Wrong image type<br />";
+		return FALSE;
 	}
 	
 	$imagewidth = $image_stats[0];		// Width of existing image
@@ -96,17 +113,8 @@
 			case 'noscale' :	// No scaling of small images- just want destination to be the same as source
 				if ($destination_file == 'stdout')
 				{
-					$fileExt = strtolower(substr(strrchr($source_file, "."), 1));
-					$mimeTypes = array(
-						'jpg' 	=> 'jpeg',
-						'gif' 	=> 'gif',
-						'png'	=> 'png',
-						'jpeg'	=> 'jpeg',
-						'pjpeg' => 'jpeg',
-						'bmp'	=> 'bmp'
-						);
-					if (!isset($mimeTypes[$fileExt])) {	return FALSE;  }		// only allow image files  }
-					header("Content-type: image/".$mimeTypes[$fileExt]);
+					if (($result = mimeFromFilename($source_file)) === FALSE) { return FALSE; }
+					header($result);
 					if (@readfile($source_file) === FALSE) { return FALSE; }
 				}
 				else
@@ -159,13 +167,16 @@
 		{
 		  case IMAGETYPE_PNG : // 3 - PNG
 			$src_img = @imagecreatefrompng($source_file);
+			$fileExt = 'png';
 			break;
 		  case IMAGETYPE_GIF : // 1 - GIF
 		    if (!function_exists('imagecreatefromgif')) return FALSE;		// Some versions of GD library don't support GIF
 			$src_img = @imagecreatefromgif($source_file);
+			$fileExt = 'gif';
 			break;
 		  case IMAGETYPE_JPEG :	// 2 - Jpeg
 		    $src_img = @imagecreatefromjpeg($source_file);
+			$fileExt = 'jpg';
 			break;
 		  default :
 			return FALSE; // Unsupported image type
@@ -187,24 +198,56 @@
 		}
 		if ($returnError)
 		{
-			echo "Resizing error: {$returnError}<br />";
+			echo "Resizing error (1): {$returnError}<br />";
 			return FALSE;
 		}
- 
+
+		// Now output or save the resized file
+
+		$destName = $destination_file;
 		if ($destination_file == "stdout") 
 		{
-		  header("Content-type: image/jpeg");
-		  if (!imagejpeg($dst_img, '', $im_quality)) $returnError = -1;
+			$destName = '';
+			if (($result = mimeFromFilename($source_file)) === FALSE) 
+			{ 
+				$returnError = -6; 
+			}
+			else
+			{
+				header($result);
+			}
 		} 
-		else 
+		else
 		{
-			if (!imagejpeg($dst_img, $destination_file, $im_quality)) { $returnError = -1; }
+			$fileExt = strtolower(substr(strrchr($destination_file, "."), 1));
 		}
+
+		if ($returnError == 0)
+		{	// We can output the image, or save it to a file
+			switch ($fileExt)
+			{
+				case 'png' :
+					if (!imagepng($dst_img, $destName, 6)) { $returnError = -1; }		// Fix the quality for now
+					break;
+				case 'gif' :
+					if (!imagegif($dst_img, $destName)) { $returnError = -1; }
+					$outputFunc = 'imagegif';
+					break;
+				case 'jpg' :
+				case 'jpeg' :
+					if (!imagejpeg($dst_img, $destName, $im_quality)) { $returnError = -1; }
+					$outputFunc = 'imagejpeg';
+					break;
+				default :
+					$returnError = -7;			// Invalid output extensiot
+			}
+		}
+
 		if (!imagedestroy($src_img)) { $returnError = -2; }
 		if (!imagedestroy($dst_img)) { $returnError = -3; }
 		if ($returnError)
 		{
-			echo "Resizing error: {$returnError}<br />";
+			echo "Resizing error (2): {$returnError}<br />";
 			return FALSE;
 		}  
 		break;
diff -x .svn -aruN 0.7.15.src/e107_handlers/search/search_event.php 0.7.16.src/e107_handlers/search/search_event.php
--- 0.7.15.src/e107_handlers/search/search_event.php	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_handlers/search/search_event.php	2009-08-23 05:39:27.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_handlers/search/search_event.php,v $
-|     $Revision: 1.5 $
-|     $Date: 2005/12/28 14:50:24 $
-|     $Author: sweetas $
+|     $Revision: 1.6 $
+|     $Date: 2009/08/23 10:39:51 $
+|     $Author: marj_nl_fr $
 +----------------------------------------------------------------------------+
 */
 	
@@ -60,7 +60,18 @@
 	if (!$event_url_) {
 		$event_threat_ = $event_threat;
 	}
-	$text .= "<img src='".THEME_ABS."images/bullet2.gif' alt='bullet' /> <a href=\"event.php?".$event_start."\">{$event_title}</a>{$event_details}<br />";
+
+	$bullet = '';
+	if(defined('BULLET'))
+	{
+		$bullet = '<img src="'.THEME.'images/'.BULLET.'" alt="" style="vertical-align: middle;" />';
+	}
+	elseif(file_exists(THEME.'images/bullet2.gif'))
+	{
+		$bullet = '<img src="'.THEME.'images/bullet2.gif" alt="" style="vertical-align: middle;" />';
+	}
+
+	$text .= $bullet." <a href=\"event.php?".$event_start."\">{$event_title}</a>{$event_details}<br />";
 }
 $qtype = LAN_911;
 ?>
\ No newline at end of file
diff -x .svn -aruN 0.7.15.src/e107_handlers/search_class.php 0.7.16.src/e107_handlers/search_class.php
--- 0.7.15.src/e107_handlers/search_class.php	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_handlers/search_class.php	2009-08-23 05:39:28.000000000 -0500
@@ -11,15 +11,16 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_handlers/search_class.php,v $
-|     $Revision: 1.36 $
-|     $Date: 2006/04/14 00:28:13 $
-|     $Author: sweetas $
+|     $Revision: 1.37 $
+|     $Date: 2009/08/23 10:39:52 $
+|     $Author: marj_nl_fr $
 +----------------------------------------------------------------------------+
 */
 
-if (!defined('e107_INIT')) { exit; }
+if ( ! defined('e107_INIT')) { exit(); }
 
-class e_search {
+class e_search
+{
 	
 	var $query;
 	var $text;
@@ -29,10 +30,20 @@
 	var $stopwords_php = "|a|about|an|and|are|as|at|be|by|com|edu|for|from|how|i|in|is|it|of|on|or|that|the|this|to|was|what|when|where|who|will|with|the|www|";
 	var $stopwords_mysql = "|a|a's|able|about|above|according|accordingly|across|actually|after|afterwards|again|against|ain't|all|allow|allows|almost|alone|along|already|also|although|always|am|among|amongst|an|and|another|any|anybody|anyhow|anyone|anything|anyway|anyways|anywhere|apart|appear|appreciate|appropriate|are|aren't|around|as|aside|ask|asking|associated|at|available|away|awfully|be|became|because|become|becomes|becoming|been|before|beforehand|behind|being|believe|below|beside|besides|best|better|between|beyond|both|brief|but|by|c'mon|c's|came|can|can't|cannot|cant|cause|causes|certain|certainly|changes|clearly|co|com|come|comes|concerning|consequently|consider|considering|contain|containing|contains|corresponding|could|couldn't|course|currently|definitely|described|despite|did|didn't|different|do|does|doesn't|doing|don't|done|down|downwards|during|each|edu|eg|eight|either|else|elsewhere|enough|entirely|especially|et|etc|even|ever|every|everybody|everyone|everything|everywhere|ex|exactly|example|except|far|few|fifth|first|five|followed|following|follows|for|former|formerly|forth|four|from|further|furthermore|get|gets|getting|given|gives|go|goes|going|gone|got|gotten|greetings|had|hadn't|happens|hardly|has|hasn't|have|haven't|having|he|he's|hello|help|hence|her|here|here's|hereafter|hereby|herein|hereupon|hers|herself|hi|him|himself|his|hither|hopefully|how|howbeit|however|i|i'd|i'll|i'm|i've|ie|if|ignored|immediate|in|inasmuch|inc|indeed|indicate|indicated|indicates|inner|insofar|instead|into|inward|is|isn't|it|it'd|it'll|it's|its|itself|just|keep|keeps|kept|know|knows|known|last|lately|later|latter|latterly|least|less|lest|let|let's|like|liked|likely|little|look|looking|looks|ltd|mainly|many|may|maybe|me|mean|meanwhile|merely|might|more|moreover|most|mostly|much|must|my|myself|name|namely|nd|near|nearly|necessary|need|needs|neither|never|nevertheless|new|next|nine|no|nobody|non|none|noone|nor|normally|not|nothing|novel|now|nowhere|obviously|of|off|often|oh|ok|okay|old|on|once|one|ones|only|onto|or|other|others|otherwise|ought|our|ours|ourselves|out|outside|over|overall|own|particular|particularly|per|perhaps|php|placed|please|plus|possible|presumably|probably|provides|que|quite|qv|rather|rd|re|really|reasonably|regarding|regardless|regards|relatively|respectively|right|said|same|saw|say|saying|says|second|secondly|see|seeing|seem|seemed|seeming|seems|seen|self|selves|sensible|sent|serious|seriously|seven|several|shall|she|should|shouldn't|since|six|so|some|somebody|somehow|someone|something|sometime|sometimes|somewhat|somewhere|soon|sorry|specified|specify|specifying|still|sub|such|sup|sure|t's|take|taken|tell|tends|th|than|thank|thanks|thanx|that|that's|thats|the|their|theirs|them|themselves|then|thence|there|there's|thereafter|thereby|therefore|therein|theres|thereupon|these|they|they'd|they'll|they're|they've|think|third|this|thorough|thoroughly|those|though|three|through|throughout|thru|thus|to|together|too|took|toward|towards|tried|tries|truly|try|trying|twice|two|un|under|unfortunately|unless|unlikely|until|unto|up|upon|us|use|used|useful|uses|using|usually|value|various|very|via|viz|vs|want|wants|was|wasn't|way|we|we'd|we'll|we're|we've|welcome|well|went|were|weren't|what|what's|whatever|when|whence|whenever|where|where's|whereafter|whereas|whereby|wherein|whereupon|wherever|whether|which|while|whither|who|who's|whoever|whole|whom|whose|why|will|willing|wish|with|within|without|won't|wonder|would|would|wouldn't|yes|yet|you|you'd|you'll|you're|you've|your|yours|yourself|yourselves|zero|";
 	
-	function e_search() {
+	function e_search()
+	{
 		global $query, $tp;
-		$this -> query = $query;
-		$this -> bullet = (defined("BULLET") ? "<img src='".THEME."images/".BULLET."' alt='' style='vertical-align: middle' />" : "<img src='".THEME."images/bullet2.gif' alt='' style='vertical-align: middle' />");
+		$this->query = $query;
+		$this->bullet = '';
+		if(defined('BULLET'))
+		{
+			$this->bullet = '<img src="'.THEME.'images/'.BULLET.'" alt="" style="vertical-align: middle;" />';
+		}
+		elseif(file_exists(THEME.'images/bullet2.gif'))
+		{
+			$this->bullet = '<img src="'.THEME.'images/bullet2.gif" alt="bullet" style="vertical-align: middle;" />';
+		}
+
 		preg_match_all('/(\W?".*?")|(.*?)(\s|$)/', $this -> query, $boolean_keys);
 		sort($this -> keywords['split'] = array_unique(array_filter(str_replace('"', '', array_merge($boolean_keys[1], $boolean_keys[2])))));
 		foreach ($this -> keywords['split'] as $k_key => $key) {
diff -x .svn -aruN 0.7.15.src/e107_handlers/shortcode_handler.php 0.7.16.src/e107_handlers/shortcode_handler.php
--- 0.7.15.src/e107_handlers/shortcode_handler.php	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_handlers/shortcode_handler.php	2009-07-11 22:27:57.000000000 -0500
@@ -12,9 +12,9 @@
 | GNU General Public License (http://gnu.org).
 |
 | $Source: /cvsroot/e107/e107_0.7/e107_handlers/shortcode_handler.php,v $
-| $Revision: 1.46 $
-| $Date: 2008/10/29 20:30:30 $
-| $Author: e107steved $
+| $Revision: 1.47 $
+| $Date: 2009/07/12 03:28:21 $
+| $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
 
@@ -104,7 +104,7 @@
 		}
 		$parm = trim($parm);
 
-		if (E107_DBG_BBSC)
+		if (E107_DBG_BBSC || E107_DBG_SC)
 		{
 			global $db_debug;
 			$sql->db_Mark_Time("SC $code");
@@ -157,14 +157,20 @@
 
         if(E107_DBG_SC)
 		{
-		  	echo ($scFile) ? "<br />sc_file= ".str_replace(e_FILE."shortcode/","",$scFile)."<br />" : "";
-			echo "<br />sc= <b>$code</b>";
+           	echo "<strong>";
+            echo '{';
+			echo $code;
+			echo ($parm) ? '='.htmlentities($parm) : "";
+			echo '}';
+			echo "</strong>";
 		}
 
 		if(E107_DBG_BBSC)
 		{
-		  trigger_error("starting shortcode {".$code."}", E_USER_ERROR);
+		//   trigger_error("starting shortcode {".$code."}", E_USER_ERROR);   // not useful.
 		}
+
+
 		$ret = eval($shortcode);
 
 		if($ret != '' || is_numeric($ret))
diff -x .svn -aruN 0.7.15.src/e107_handlers/sitelinks_class.php 0.7.16.src/e107_handlers/sitelinks_class.php
--- 0.7.15.src/e107_handlers/sitelinks_class.php	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_handlers/sitelinks_class.php	2009-08-15 06:54:06.000000000 -0500
@@ -12,16 +12,15 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_handlers/sitelinks_class.php,v $
-|     $Revision: 1.119 $
-|     $Date: 2008/05/30 20:57:20 $
-|     $Author: e107steved $
+|     $Revision: 1.121 $
+|     $Date: 2009/08/15 11:54:30 $
+|     $Author: marj_nl_fr $
 +---------------------------------------------------------------+
 */
 
 if (!defined('e107_INIT')) { exit; }
 
-@include_once(e_LANGUAGEDIR.e_LANGUAGE."/lan_sitelinks.php");
-@include_once(e_LANGUAGEDIR."English/lan_sitelinks.php");
+include_lan(e_LANGUAGEDIR.e_LANGUAGE."/lan_sitelinks.php");
 
 /**
 * @return void
@@ -171,7 +170,7 @@
                 $text .= $ns->tablerender($k, $mnu, 'sitelinks_sub', TRUE);
             }
         }
-        $text .= "\n\n\n<!--- end Site Links -->\n\n\n";
+        $text .= "\n\n\n<!-- end Site Links -->\n\n\n";
         if($usecache)
         {
             $e107cache->set('sitelinks_'.$cat.md5($linkstyle.e_PAGE.e_QUERY), $text);
diff -x .svn -aruN 0.7.15.src/e107_handlers/tiny_mce/langs/en.js 0.7.16.src/e107_handlers/tiny_mce/langs/en.js
--- 0.7.15.src/e107_handlers/tiny_mce/langs/en.js	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_handlers/tiny_mce/langs/en.js	2009-06-30 19:36:48.000000000 -0500
@@ -1,41 +1,154 @@
-// UK lang variables
-
-tinyMCE.addToLang('',{
-bold_desc : 'Bold (Ctrl+B)',
-italic_desc : 'Italic (Ctrl+I)',
-underline_desc : 'Underline (Ctrl+U)',
-striketrough_desc : 'Strikethrough',
-justifyleft_desc : 'Align left',
-justifycenter_desc : 'Align center',
-justifyright_desc : 'Align right',
-justifyfull_desc : 'Align full',
-bullist_desc : 'Unordered list',
-numlist_desc : 'Ordered list',
-outdent_desc : 'Outdent',
-indent_desc : 'Indent',
-undo_desc : 'Undo (Ctrl+Z)',
-redo_desc : 'Redo (Ctrl+Y)',
-link_desc : 'Insert/edit link',
-unlink_desc : 'Unlink',
-image_desc : 'Insert/edit image',
-cleanup_desc : 'Cleanup messy code',
-focus_alert : 'A editor instance must be focused before using this command.',
-edit_confirm : 'Do you want to use the WYSIWYG mode for this textarea?',
-insert_link_title : 'Insert/edit link',
-insert : 'Insert',
-update : 'Update',
-cancel : 'Cancel',
-insert_link_url : 'Link URL',
-insert_link_target : 'Target',
-insert_link_target_same : 'Open link in the same window',
-insert_link_target_blank : 'Open link in a new window',
-insert_image_title : 'Insert/edit image',
-insert_image_src : 'Image URL',
-insert_image_alt : 'Image description',
-help_desc : 'Help',
-bold_img : "bold.gif",
-italic_img : "italic.gif",
-underline_img : "underline.gif",
-clipboard_msg : 'Copy/Cut/Paste is not available in Mozilla and Firefox.\nDo you want more information about this issue?',
-popup_blocked : 'Sorry, but we have noticed that your popup-blocker has disabled a window that provides application functionality. You will need to disable popup blocking on this site in order to fully utilize this tool.'
-});
+tinyMCE.addI18n({en:{
+common:{
+edit_confirm:"Do you want to use the WYSIWYG mode for this textarea?",
+apply:"Apply",
+insert:"Insert",
+update:"Update",
+cancel:"Cancel",
+close:"Close",
+browse:"Browse",
+class_name:"Class",
+not_set:"-- Not set --",
+clipboard_msg:"Copy/Cut/Paste is not available in Mozilla and Firefox.\nDo you want more information about this issue?",
+clipboard_no_support:"Currently not supported by your browser, use keyboard shortcuts instead.",
+popup_blocked:"Sorry, but we have noticed that your popup-blocker has disabled a window that provides application functionality. You will need to disable popup blocking on this site in order to fully utilize this tool.",
+invalid_data:"Error: Invalid values entered, these are marked in red.",
+more_colors:"More colors"
+},
+contextmenu:{
+align:"Alignment",
+left:"Left",
+center:"Center",
+right:"Right",
+full:"Full"
+},
+insertdatetime:{
+date_fmt:"%Y-%m-%d",
+time_fmt:"%H:%M:%S",
+insertdate_desc:"Insert date",
+inserttime_desc:"Insert time",
+months_long:"January,February,March,April,May,June,July,August,September,October,November,December",
+months_short:"Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec",
+day_long:"Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday,Sunday",
+day_short:"Sun,Mon,Tue,Wed,Thu,Fri,Sat,Sun"
+},
+print:{
+print_desc:"Print"
+},
+preview:{
+preview_desc:"Preview"
+},
+directionality:{
+ltr_desc:"Direction left to right",
+rtl_desc:"Direction right to left"
+},
+layer:{
+insertlayer_desc:"Insert new layer",
+forward_desc:"Move forward",
+backward_desc:"Move backward",
+absolute_desc:"Toggle absolute positioning",
+content:"New layer..."
+},
+save:{
+save_desc:"Save",
+cancel_desc:"Cancel all changes"
+},
+nonbreaking:{
+nonbreaking_desc:"Insert non-breaking space character"
+},
+iespell:{
+iespell_desc:"Run spell checking",
+download:"ieSpell not detected. Do you want to install it now?"
+},
+advhr:{
+advhr_desc:"Horizontal rule"
+},
+emotions:{
+emotions_desc:"Emotions"
+},
+searchreplace:{
+search_desc:"Find",
+replace_desc:"Find/Replace"
+},
+advimage:{
+image_desc:"Insert/edit image"
+},
+advlink:{
+link_desc:"Insert/edit link"
+},
+xhtmlxtras:{
+cite_desc:"Citation",
+abbr_desc:"Abbreviation",
+acronym_desc:"Acronym",
+del_desc:"Deletion",
+ins_desc:"Insertion",
+attribs_desc:"Insert/Edit Attributes"
+},
+style:{
+desc:"Edit CSS Style"
+},
+paste:{
+paste_text_desc:"Paste as Plain Text",
+paste_word_desc:"Paste from Word",
+selectall_desc:"Select All"
+},
+paste_dlg:{
+text_title:"Use CTRL+V on your keyboard to paste the text into the window.",
+text_linebreaks:"Keep linebreaks",
+word_title:"Use CTRL+V on your keyboard to paste the text into the window."
+},
+table:{
+desc:"Inserts a new table",
+row_before_desc:"Insert row before",
+row_after_desc:"Insert row after",
+delete_row_desc:"Delete row",
+col_before_desc:"Insert column before",
+col_after_desc:"Insert column after",
+delete_col_desc:"Remove column",
+split_cells_desc:"Split merged table cells",
+merge_cells_desc:"Merge table cells",
+row_desc:"Table row properties",
+cell_desc:"Table cell properties",
+props_desc:"Table properties",
+paste_row_before_desc:"Paste table row before",
+paste_row_after_desc:"Paste table row after",
+cut_row_desc:"Cut table row",
+copy_row_desc:"Copy table row",
+del:"Delete table",
+row:"Row",
+col:"Column",
+cell:"Cell"
+},
+autosave:{
+unload_msg:"The changes you made will be lost if you navigate away from this page."
+},
+fullscreen:{
+desc:"Toggle fullscreen mode"
+},
+media:{
+desc:"Insert / edit embedded media",
+edit:"Edit embedded media"
+},
+fullpage:{
+desc:"Document properties"
+},
+template:{
+desc:"Insert predefined template content"
+},
+visualchars:{
+desc:"Visual control characters on/off."
+},
+spellchecker:{
+desc:"Toggle spellchecker",
+menu:"Spellchecker settings",
+ignore_word:"Ignore word",
+ignore_words:"Ignore all",
+langs:"Languages",
+wait:"Please wait...",
+sug:"Suggestions",
+no_sug:"No suggestions",
+no_mpell:"No misspellings found."
+},
+pagebreak:{
+desc:"Insert page break."
+}}});
\ No newline at end of file
diff -x .svn -aruN 0.7.15.src/e107_handlers/tiny_mce/plugins/compat2x/editor_plugin.js 0.7.16.src/e107_handlers/tiny_mce/plugins/compat2x/editor_plugin.js
--- 0.7.15.src/e107_handlers/tiny_mce/plugins/compat2x/editor_plugin.js	1969-12-31 18:00:00.000000000 -0600
+++ 0.7.16.src/e107_handlers/tiny_mce/plugins/compat2x/editor_plugin.js	2009-07-07 18:17:17.000000000 -0500
@@ -0,0 +1 @@
+(function(){var c=tinymce.DOM,a=tinymce.dom.Event,d=tinymce.each,b=tinymce.is;tinymce.create("tinymce.plugins.Compat2x",{getInfo:function(){return{longname:"Compat2x",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/compat2x",version:tinyMCE.majorVersion+"."+tinyMCE.minorVersion}}});(function(){tinymce.extend(tinyMCE,{addToLang:function(f,e){d(e,function(h,g){tinyMCE.i18n[(tinyMCE.settings.language||"en")+"."+(f?f+"_":"")+g]=h})},getInstanceById:function(e){return this.get(e)}})})();(function(){var e=tinymce.EditorManager;tinyMCE.instances={};tinyMCE.plugins={};tinymce.PluginManager.onAdd.add(function(f,h,g){tinyMCE.plugins[h]=g});tinyMCE.majorVersion=tinymce.majorVersion;tinyMCE.minorVersion=tinymce.minorVersion;tinyMCE.releaseDate=tinymce.releaseDate;tinyMCE.baseURL=tinymce.baseURL;tinyMCE.isIE=tinyMCE.isMSIE=tinymce.isIE||tinymce.isOpera;tinyMCE.isMSIE5=tinymce.isIE;tinyMCE.isMSIE5_0=tinymce.isIE;tinyMCE.isMSIE7=tinymce.isIE;tinyMCE.isGecko=tinymce.isGecko;tinyMCE.isSafari=tinymce.isWebKit;tinyMCE.isOpera=tinymce.isOpera;tinyMCE.isMac=false;tinyMCE.isNS7=false;tinyMCE.isNS71=false;tinyMCE.compat=true;TinyMCE_Engine=tinyMCE;tinymce.extend(tinyMCE,{getParam:function(g,f){return this.activeEditor.getParam(g,f)},addEvent:function(i,g,h,j){tinymce.dom.Event.add(i,g,h,j||this)},getControlHTML:function(f){return e.activeEditor.controlManager.createControl(f)},loadCSS:function(f){tinymce.DOM.loadCSS(f)},importCSS:function(g,f){if(g==document){this.loadCSS(f)}else{new tinymce.dom.DOMUtils(g).loadCSS(f)}},log:function(){console.debug.apply(console,arguments)},getLang:function(h,g){var f=e.activeEditor.getLang(h.replace(/^lang_/g,""),g);if(/^[0-9\-.]+$/g.test(f)){return parseInt(f)}return f},isInstance:function(f){return f!=null&&typeof(f)=="object"&&f.execCommand},triggerNodeChange:function(){e.activeEditor.nodeChanged()},regexpReplace:function(j,f,h,i){var g;if(j==null){return j}if(typeof(i)=="undefined"){i="g"}g=new RegExp(f,i);return j.replace(g,h)},trim:function(f){return tinymce.trim(f)},xmlEncode:function(f){return tinymce.DOM.encode(f)},explode:function(f,h){var g=[];tinymce.each(f.split(h),function(i){if(i!=""){g.push(i)}});return g},switchClass:function(h,g){var f;if(/^mceButton/.test(g)){f=e.activeEditor.controlManager.get(h);if(!f){return}switch(g){case"mceButtonNormal":f.setDisabled(false);f.setActive(false);return;case"mceButtonDisabled":f.setDisabled(true);return;case"mceButtonSelected":f.setActive(true);f.setDisabled(false);return}}},addCSSClass:function(g,h,f){return tinymce.DOM.addClass(g,h,f)},hasCSSClass:function(f,g){return tinymce.DOM.hasClass(f,g)},removeCSSClass:function(f,g){return tinymce.DOM.removeClass(f,g)},getCSSClasses:function(){var f=e.activeEditor.dom.getClasses(),g=[];d(f,function(h){g.push(h["class"])});return g},setWindowArg:function(g,f){e.activeEditor.windowManager.params[g]=f},getWindowArg:function(i,g){var h=e.activeEditor.windowManager,f;f=h.getParam(i);if(f===""){return""}return f||h.getFeature(i)||g},getParentNode:function(h,g){return this._getDOM().getParent(h,g)},selectElements:function(o,k,m){var l,j=[],h,g;for(g=0,k=k.split(",");g<k.length;g++){for(l=0,h=o.getElementsByTagName(k[g]);l<h.length;l++){(!m||m(h[l]))&&j.push(h[l])}}return j},getNodeTree:function(i,f,g,h){return this.selectNodes(i,function(j){return(!g||j.nodeType==g)&&(!h||j.nodeName==h)},f?f:[])},getAttrib:function(g,h,f){return this._getDOM().getAttrib(g,h,f)},setAttrib:function(g,h,f){return this._getDOM().setAttrib(g,h,f)},getElementsByAttributeValue:function(m,k,g,h){var j,f=m.getElementsByTagName(k),l=[];for(j=0;j<f.length;j++){if(tinyMCE.getAttrib(f[j],g).indexOf(h)!=-1){l[l.length]=f[j]}}return l},selectNodes:function(k,j,g){var h;if(!g){g=[]}if(j(k)){g[g.length]=k}if(k.hasChildNodes()){for(h=0;h<k.childNodes.length;h++){tinyMCE.selectNodes(k.childNodes[h],j,g)}}return g},getContent:function(){return e.activeEditor.getContent()},getParentElement:function(i,g,h){if(g){g=new RegExp("^("+g.toUpperCase().replace(/,/g,"|")+")$","g")}return this._getDOM().getParent(i,function(f){return f.nodeType==1&&(!g||g.test(f.nodeName))&&(!h||h(f))},this.activeEditor.getBody())},importPluginLanguagePack:function(f){tinymce.PluginManager.requireLangPack(f)},getButtonHTML:function(l,j,h,k,i,g){var f=e.activeEditor;h=h.replace(/\{\$pluginurl\}/g,tinyMCE.pluginURL);h=h.replace(/\{\$themeurl\}/g,tinyMCE.themeURL);j=j.replace(/^lang_/g,"");return f.controlManager.createButton(l,{title:j,command:k,ui:i,value:g,scope:this,"class":"compat",image:h})},addSelectAccessibility:function(h,g,f){if(!g._isAccessible){g.onkeydown=tinyMCE.accessibleEventHandler;g.onblur=tinyMCE.accessibleEventHandler;g._isAccessible=true;g._win=f}return false},accessibleEventHandler:function(g){var h,f=this._win;g=tinymce.isIE?f.event:g;h=tinymce.isIE?g.srcElement:g.target;if(g.type=="blur"){if(h.oldonchange){h.onchange=h.oldonchange;h.oldonchange=null}return true}if(h.nodeName=="SELECT"&&!h.oldonchange){h.oldonchange=h.onchange;h.onchange=null}if(g.keyCode==13||g.keyCode==32){h.onchange=h.oldonchange;h.onchange();h.oldonchange=null;tinyMCE.cancelEvent(g);return false}return true},cancelEvent:function(f){return tinymce.dom.Event.cancel(f)},handleVisualAid:function(f){e.activeEditor.addVisual(f)},getAbsPosition:function(g,f){return tinymce.DOM.getPos(g,f)},cleanupEventStr:function(f){f=""+f;f=f.replace("function anonymous()\n{\n","");f=f.replace("\n}","");f=f.replace(/^return true;/gi,"");return f},getVisualAidClass:function(f){return f},parseStyle:function(f){return this._getDOM().parseStyle(f)},serializeStyle:function(f){return this._getDOM().serializeStyle(f)},openWindow:function(h,g){var f=e.activeEditor,i={},j;for(j in h){i[j]=h[j]}h=i;g=g||{};h.url=new tinymce.util.URI(tinymce.ThemeManager.themeURLs[f.settings.theme]).toAbsolute(h.file);h.inline=h.inline||g.inline;f.windowManager.open(h,g)},closeWindow:function(f){e.activeEditor.windowManager.close(f)},getOuterHTML:function(f){return tinymce.DOM.getOuterHTML(f)},setOuterHTML:function(g,f,i){return tinymce.DOM.setOuterHTML(g,f,i)},hasPlugin:function(f){return tinymce.PluginManager.get(f)!=null},_setEventsEnabled:function(){},addPlugin:function(g,i){var h=this;function j(f){tinyMCE.selectedInstance=f;f.onInit.add(function(){h.settings=f.settings;h.settings.base_href=tinyMCE.documentBasePath;tinyMCE.settings=h.settings;tinyMCE.documentBasePath=f.documentBasePath;if(i.initInstance){i.initInstance(f)}f.contentDocument=f.getDoc();f.contentWindow=f.getWin();f.undoRedo=f.undoManager;f.startContent=f.getContent({format:"raw"});tinyMCE.instances[f.id]=f;tinyMCE.loadedFiles=[]});f.onActivate.add(function(){tinyMCE.settings=f.settings;tinyMCE.selectedInstance=f});if(i.handleNodeChange){f.onNodeChange.add(function(l,k,m){i.handleNodeChange(l.id,m,0,0,false,!l.selection.isCollapsed())})}if(i.onChange){f.onChange.add(function(k,l){return i.onChange(k)})}if(i.cleanup){f.onGetContent.add(function(){})}this.getInfo=function(){return i.getInfo()};this.createControl=function(k){tinyMCE.pluginURL=tinymce.baseURL+"/plugins/"+g;tinyMCE.themeURL=tinymce.baseURL+"/themes/"+tinyMCE.activeEditor.settings.theme;if(i.getControlHTML){return i.getControlHTML(k)}return null};this.execCommand=function(l,k,m){if(i.execCommand){return i.execCommand(f.id,f.getBody(),l,k,m)}return false}}tinymce.PluginManager.add(g,j)},_getDOM:function(){return tinyMCE.activeEditor?tinyMCE.activeEditor.dom:tinymce.DOM},convertRelativeToAbsoluteURL:function(f,g){return new tinymce.util.URI(f).toAbsolute(g)},convertAbsoluteURLToRelativeURL:function(f,g){return new tinymce.util.URI(f).toRelative(g)}});tinymce.extend(tinymce.Editor.prototype,{getFocusElement:function(){return this.selection.getNode()},getData:function(f){if(!this.data){this.data=[]}if(!this.data[f]){this.data[f]=[]}return this.data[f]},hasPlugin:function(f){return this.plugins[f]!=null},getContainerWin:function(){return window},getHTML:function(f){return this.getContent({format:f?"raw":"html"})},setHTML:function(f){this.setContent(f)},getSel:function(){return this.selection.getSel()},getRng:function(){return this.selection.getRng()},isHidden:function(){var f;if(!tinymce.isGecko){return false}f=this.getSel();return(!f||!f.rangeCount||f.rangeCount==0)},translate:function(f){var h=this.settings.language,g;if(!f){return f}g=tinymce.EditorManager.i18n[h+"."+f]||f.replace(/{\#([^}]+)\}/g,function(j,i){return tinymce.EditorManager.i18n[h+"."+i]||"{#"+i+"}"});g=g.replace(/{\$lang_([^}]+)\}/g,function(j,i){return tinymce.EditorManager.i18n[h+"."+i]||"{$lang_"+i+"}"});return g},repaint:function(){this.execCommand("mceRepaint")}});tinymce.extend(tinymce.dom.Selection.prototype,{getSelectedText:function(){return this.getContent({format:"text"})},getSelectedHTML:function(){return this.getContent({format:"html"})},getFocusElement:function(){return this.getNode()},selectNode:function(i,j,g,f){var h=this;h.select(i,g||0);if(!b(j)){j=true}if(j){if(!b(f)){f=true}h.collapse(f)}}})}).call(this);tinymce.PluginManager.add("compat2x",tinymce.plugins.Compat2x)})();
\ No newline at end of file
diff -x .svn -aruN 0.7.15.src/e107_handlers/tiny_mce/plugins/compat2x/editor_plugin_src.js 0.7.16.src/e107_handlers/tiny_mce/plugins/compat2x/editor_plugin_src.js
--- 0.7.15.src/e107_handlers/tiny_mce/plugins/compat2x/editor_plugin_src.js	1969-12-31 18:00:00.000000000 -0600
+++ 0.7.16.src/e107_handlers/tiny_mce/plugins/compat2x/editor_plugin_src.js	2009-07-07 18:17:17.000000000 -0500
@@ -0,0 +1,616 @@
+/**
+ * $Id: editor_plugin_src.js,v 1.1 2009/07/07 23:17:41 e107coders Exp $
+ *
+ * @author Moxiecode
+ * @copyright Copyright  2004-2008, Moxiecode Systems AB, All rights reserved.
+ */
+
+(function() {
+	var DOM = tinymce.DOM, Event = tinymce.dom.Event, each = tinymce.each, is = tinymce.is;
+
+	tinymce.create('tinymce.plugins.Compat2x', {
+		getInfo : function() {
+			return {
+				longname : 'Compat2x',
+				author : 'Moxiecode Systems AB',
+				authorurl : 'http://tinymce.moxiecode.com',
+				infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/compat2x',
+				version : tinyMCE.majorVersion + "." + tinyMCE.minorVersion
+			};
+		}
+	});
+
+	(function() {
+		// Extend tinyMCE/EditorManager
+		tinymce.extend(tinyMCE, {
+			addToLang : function(p, l) {
+				each(l, function(v, k) {
+					tinyMCE.i18n[(tinyMCE.settings.language || 'en') + '.' + (p ? p + '_' : '') + k] = v;
+				});
+			},
+
+			getInstanceById : function(n) {
+				return this.get(n);
+			}
+		});
+	})();
+
+	(function() {
+		var EditorManager = tinymce.EditorManager;
+
+		tinyMCE.instances = {};
+		tinyMCE.plugins = {};
+		tinymce.PluginManager.onAdd.add(function(pm, n, p) {
+			tinyMCE.plugins[n] = p;
+		});
+
+		tinyMCE.majorVersion = tinymce.majorVersion;
+		tinyMCE.minorVersion = tinymce.minorVersion;
+		tinyMCE.releaseDate = tinymce.releaseDate;
+		tinyMCE.baseURL = tinymce.baseURL;
+		tinyMCE.isIE = tinyMCE.isMSIE = tinymce.isIE || tinymce.isOpera;
+		tinyMCE.isMSIE5 = tinymce.isIE;
+		tinyMCE.isMSIE5_0 = tinymce.isIE;
+		tinyMCE.isMSIE7 = tinymce.isIE;
+		tinyMCE.isGecko = tinymce.isGecko;
+		tinyMCE.isSafari = tinymce.isWebKit;
+		tinyMCE.isOpera = tinymce.isOpera;
+		tinyMCE.isMac = false;
+		tinyMCE.isNS7 = false;
+		tinyMCE.isNS71 = false;
+		tinyMCE.compat = true;
+
+		// Extend tinyMCE class
+		TinyMCE_Engine = tinyMCE;
+		tinymce.extend(tinyMCE, {
+			getParam : function(n, dv) {
+				return this.activeEditor.getParam(n, dv);
+			},
+
+			addEvent : function(e, na, f, sc) {
+				tinymce.dom.Event.add(e, na, f, sc || this);
+			},
+
+			getControlHTML : function(n) {
+				return EditorManager.activeEditor.controlManager.createControl(n);
+			},
+
+			loadCSS : function(u) {
+				tinymce.DOM.loadCSS(u);
+			},
+
+			importCSS : function(doc, u) {
+				if (doc == document)
+					this.loadCSS(u);
+				else
+					new tinymce.dom.DOMUtils(doc).loadCSS(u);
+			},
+
+			log : function() {
+				console.debug.apply(console, arguments);
+			},
+
+			getLang : function(n, dv) {
+				var v = EditorManager.activeEditor.getLang(n.replace(/^lang_/g, ''), dv);
+
+				// Is number
+				if (/^[0-9\-.]+$/g.test(v))
+					return parseInt(v);
+
+				return v;
+			},
+
+			isInstance : function(o) {
+				return o != null && typeof(o) == "object" && o.execCommand;
+			},
+
+			triggerNodeChange : function() {
+				EditorManager.activeEditor.nodeChanged();
+			},
+
+			regexpReplace : function(in_str, reg_exp, replace_str, opts) {
+				var re;
+
+				if (in_str == null)
+					return in_str;
+
+				if (typeof(opts) == "undefined")
+					opts = 'g';
+
+				re = new RegExp(reg_exp, opts);
+
+				return in_str.replace(re, replace_str);
+			},
+
+			trim : function(s) {
+				return tinymce.trim(s);
+			},
+
+			xmlEncode : function(s) {
+				return tinymce.DOM.encode(s);
+			},
+
+			explode : function(s, d) {
+				var o = [];
+
+				tinymce.each(s.split(d), function(v) {
+					if (v != '')
+						o.push(v);
+				});
+
+				return o;
+			},
+
+			switchClass : function(id, cls) {
+				var b;
+
+				if (/^mceButton/.test(cls)) {
+					b = EditorManager.activeEditor.controlManager.get(id);
+
+					if (!b)
+						return;
+
+					switch (cls) {
+						case "mceButtonNormal":
+							b.setDisabled(false);
+							b.setActive(false);
+							return;
+
+						case "mceButtonDisabled":
+							b.setDisabled(true);
+							return;
+
+						case "mceButtonSelected":
+							b.setActive(true);
+							b.setDisabled(false);
+							return;
+					}
+				}
+			},
+
+			addCSSClass : function(e, n, b) {
+				return tinymce.DOM.addClass(e, n, b);
+			},
+
+			hasCSSClass : function(e, n) {
+				return tinymce.DOM.hasClass(e, n);
+			},
+
+			removeCSSClass : function(e, n) {
+				return tinymce.DOM.removeClass(e, n);
+			},
+
+			getCSSClasses : function() {
+				var cl = EditorManager.activeEditor.dom.getClasses(), o = [];
+
+				each(cl, function(c) {
+					o.push(c['class']);
+				});
+
+				return o;
+			},
+
+			setWindowArg : function(n, v) {
+				EditorManager.activeEditor.windowManager.params[n] = v;
+			},
+
+			getWindowArg : function(n, dv) {
+				var wm = EditorManager.activeEditor.windowManager, v;
+
+				v = wm.getParam(n);
+				if (v === '')
+					return '';
+
+				return v || wm.getFeature(n) || dv;
+			},
+
+			getParentNode : function(n, f) {
+				return this._getDOM().getParent(n, f);
+			},
+
+			selectElements : function(n, na, f) {
+				var i, a = [], nl, x;
+
+				for (x=0, na = na.split(','); x<na.length; x++)
+					for (i=0, nl = n.getElementsByTagName(na[x]); i<nl.length; i++)
+						(!f || f(nl[i])) && a.push(nl[i]);
+
+				return a;
+			},
+
+			getNodeTree : function(n, na, t, nn) {
+				return this.selectNodes(n, function(n) {
+					return (!t || n.nodeType == t) && (!nn || n.nodeName == nn);
+				}, na ? na : []);
+			},
+
+			getAttrib : function(e, n, dv) {
+				return this._getDOM().getAttrib(e, n, dv);
+			},
+
+			setAttrib : function(e, n, v) {
+				return this._getDOM().setAttrib(e, n, v);
+			},
+
+			getElementsByAttributeValue : function(n, e, a, v) {
+				var i, nl = n.getElementsByTagName(e), o = [];
+
+				for (i=0; i<nl.length; i++) {
+					if (tinyMCE.getAttrib(nl[i], a).indexOf(v) != -1)
+						o[o.length] = nl[i];
+				}
+
+				return o;
+			},
+
+			selectNodes : function(n, f, a) {
+				var i;
+
+				if (!a)
+					a = [];
+
+				if (f(n))
+					a[a.length] = n;
+
+				if (n.hasChildNodes()) {
+					for (i=0; i<n.childNodes.length; i++)
+						tinyMCE.selectNodes(n.childNodes[i], f, a);
+				}
+
+				return a;
+			},
+
+			getContent : function() {
+				return EditorManager.activeEditor.getContent();
+			},
+
+			getParentElement : function(n, na, f) {
+				if (na)
+					na = new RegExp('^(' + na.toUpperCase().replace(/,/g, '|') + ')$', 'g');
+
+				return this._getDOM().getParent(n, function(n) {
+					return n.nodeType == 1 && (!na || na.test(n.nodeName)) && (!f || f(n));
+				}, this.activeEditor.getBody());
+			},
+
+			importPluginLanguagePack : function(n) {
+				tinymce.PluginManager.requireLangPack(n);
+			},
+
+			getButtonHTML : function(cn, lang, img, c, u, v) {
+				var ed = EditorManager.activeEditor;
+
+				img = img.replace(/\{\$pluginurl\}/g, tinyMCE.pluginURL);
+				img = img.replace(/\{\$themeurl\}/g, tinyMCE.themeURL);
+				lang = lang.replace(/^lang_/g, '');
+
+				return ed.controlManager.createButton(cn, {
+					title : lang,
+					command : c,
+					ui : u,
+					value : v,
+					scope : this,
+					'class' : 'compat',
+					image : img
+				});
+			},
+
+			addSelectAccessibility : function(e, s, w) {
+				// Add event handlers 
+				if (!s._isAccessible) {
+					s.onkeydown = tinyMCE.accessibleEventHandler;
+					s.onblur = tinyMCE.accessibleEventHandler;
+					s._isAccessible = true;
+					s._win = w;
+				}
+
+				return false;
+			},
+
+			accessibleEventHandler : function(e) {
+				var elm, win = this._win;
+
+				e = tinymce.isIE ? win.event : e;
+				elm = tinymce.isIE ? e.srcElement : e.target;
+
+				// Unpiggyback onchange on blur
+				if (e.type == "blur") {
+					if (elm.oldonchange) {
+						elm.onchange = elm.oldonchange;
+						elm.oldonchange = null;
+					}
+
+					return true;
+				}
+
+				// Piggyback onchange
+				if (elm.nodeName == "SELECT" && !elm.oldonchange) {
+					elm.oldonchange = elm.onchange;
+					elm.onchange = null;
+				}
+
+				// Execute onchange and remove piggyback
+				if (e.keyCode == 13 || e.keyCode == 32) {
+					elm.onchange = elm.oldonchange;
+					elm.onchange();
+					elm.oldonchange = null;
+
+					tinyMCE.cancelEvent(e);
+					return false;
+				}
+
+				return true;
+			},
+
+			cancelEvent : function(e) {
+				return tinymce.dom.Event.cancel(e);
+			},
+
+			handleVisualAid : function(e) {
+				EditorManager.activeEditor.addVisual(e);
+			},
+
+			getAbsPosition : function(n, r) {
+				return tinymce.DOM.getPos(n, r);
+			},
+
+			cleanupEventStr : function(s) {
+				s = "" + s;
+				s = s.replace('function anonymous()\n{\n', '');
+				s = s.replace('\n}', '');
+				s = s.replace(/^return true;/gi, ''); // Remove event blocker
+
+				return s;
+			},
+
+			getVisualAidClass : function(s) {
+				// TODO: Implement
+				return s;
+			},
+
+			parseStyle : function(s) {
+				return this._getDOM().parseStyle(s);
+			},
+
+			serializeStyle : function(s) {
+				return this._getDOM().serializeStyle(s);
+			},
+
+			openWindow : function(tpl, args) {
+				var ed = EditorManager.activeEditor, o = {}, n;
+
+				// Convert name/value array to object
+				for (n in tpl)
+					o[n] = tpl[n];
+
+				tpl = o;
+
+				args = args || {};
+				tpl.url = new tinymce.util.URI(tinymce.ThemeManager.themeURLs[ed.settings.theme]).toAbsolute(tpl.file);
+				tpl.inline = tpl.inline || args.inline;
+
+				ed.windowManager.open(tpl, args);
+			},
+
+			closeWindow : function(win) {
+				EditorManager.activeEditor.windowManager.close(win);
+			},
+
+			getOuterHTML : function(e) {
+				return tinymce.DOM.getOuterHTML(e);
+			},
+
+			setOuterHTML : function(e, h, d) {
+				return tinymce.DOM.setOuterHTML(e, h, d);
+			},
+
+			hasPlugin : function(n) {
+				return tinymce.PluginManager.get(n) != null;
+			},
+
+			_setEventsEnabled : function() {
+				// Ignore it!!
+			},
+
+			addPlugin : function(pn, f) {
+				var t = this;
+
+				function PluginWrapper(ed) {
+					tinyMCE.selectedInstance = ed;
+
+					ed.onInit.add(function() {
+						t.settings = ed.settings;
+						t.settings['base_href'] = tinyMCE.documentBasePath;
+						tinyMCE.settings = t.settings;
+						tinyMCE.documentBasePath = ed.documentBasePath;
+						//ed.formElement = DOM.get(ed.id);
+
+						if (f.initInstance)
+							f.initInstance(ed);
+
+						ed.contentDocument = ed.getDoc();
+						ed.contentWindow = ed.getWin();
+						ed.undoRedo = ed.undoManager;
+						ed.startContent = ed.getContent({format : 'raw'});
+
+						tinyMCE.instances[ed.id] = ed;
+						tinyMCE.loadedFiles = [];
+					});
+
+					ed.onActivate.add(function() {
+						tinyMCE.settings = ed.settings;
+						tinyMCE.selectedInstance = ed;
+					});
+
+				/*	if (f.removeInstance) {
+						ed.onDestroy.add(function() {
+							return f.removeInstance(ed.id);
+						});
+					}*/
+
+					if (f.handleNodeChange) {
+						ed.onNodeChange.add(function(ed, cm, n) {
+							f.handleNodeChange(ed.id, n, 0, 0, false, !ed.selection.isCollapsed());
+						});
+					}
+
+					if (f.onChange) {
+						ed.onChange.add(function(ed, n) {
+							return f.onChange(ed);
+						});
+					}
+
+					if (f.cleanup) {
+						ed.onGetContent.add(function() {
+							//f.cleanup(type, content, inst);
+						});
+					}
+
+					this.getInfo = function() {
+						return f.getInfo();
+					};
+
+					this.createControl = function(n) {
+						tinyMCE.pluginURL = tinymce.baseURL + '/plugins/' + pn;
+						tinyMCE.themeURL = tinymce.baseURL + '/themes/' + tinyMCE.activeEditor.settings.theme;
+
+						if (f.getControlHTML)
+							return f.getControlHTML(n);
+
+						return null;
+					};
+
+					this.execCommand = function(cmd, ui, val) {
+						if (f.execCommand)
+							return f.execCommand(ed.id, ed.getBody(), cmd, ui, val);
+
+						return false;
+					};
+				};
+
+				tinymce.PluginManager.add(pn, PluginWrapper);
+			},
+
+			_getDOM : function() {
+				return tinyMCE.activeEditor ? tinyMCE.activeEditor.dom : tinymce.DOM;
+			},
+
+			convertRelativeToAbsoluteURL : function(b, u) {
+				return new tinymce.util.URI(b).toAbsolute(u);
+			},
+
+			convertAbsoluteURLToRelativeURL : function(b, u) {
+				return new tinymce.util.URI(b).toRelative(u);
+			}
+		});
+
+		// Extend Editor class
+		tinymce.extend(tinymce.Editor.prototype, {
+			getFocusElement : function() {
+				return this.selection.getNode();
+			},
+
+			getData : function(n) {
+				if (!this.data)
+					this.data = [];
+
+				if (!this.data[n])
+					this.data[n] = [];
+
+				return this.data[n];
+			},
+
+			hasPlugin : function(n) {
+				return this.plugins[n] != null;
+			},
+
+			getContainerWin : function() {
+				return window;
+			},
+
+			getHTML : function(raw) {
+				return this.getContent({ format : raw ? 'raw' : 'html'});
+			},
+
+			setHTML : function(h) {
+				this.setContent(h);
+			},
+
+			getSel : function() {
+				return this.selection.getSel();
+			},
+
+			getRng : function() {
+				return this.selection.getRng();
+			},
+
+			isHidden : function() {
+				var s;
+
+				if (!tinymce.isGecko)
+					return false;
+
+				s = this.getSel();
+
+				// Weird, wheres that cursor selection?
+				return (!s || !s.rangeCount || s.rangeCount == 0);
+			},
+
+			translate : function(s) {
+				var c = this.settings.language, o;
+
+				if (!s)
+					return s;
+
+				o = tinymce.EditorManager.i18n[c + '.' + s] || s.replace(/{\#([^}]+)\}/g, function(a, b) {
+					return tinymce.EditorManager.i18n[c + '.' + b] || '{#' + b + '}';
+				});
+
+				o = o.replace(/{\$lang_([^}]+)\}/g, function(a, b) {
+					return tinymce.EditorManager.i18n[c + '.' + b] || '{$lang_' + b + '}';
+				});
+
+				return o;
+			},
+
+			repaint : function() {
+				this.execCommand('mceRepaint');
+			}
+		});
+
+		// Extend selection
+		tinymce.extend(tinymce.dom.Selection.prototype, {
+			getSelectedText : function() {
+				return this.getContent({format : 'text'});
+			},
+
+			getSelectedHTML : function() {
+				return this.getContent({format : 'html'});
+			},
+
+			getFocusElement : function() {
+				return this.getNode();
+			},
+
+			selectNode : function(node, collapse, select_text_node, to_start) {
+				var t = this;
+
+				t.select(node, select_text_node || 0);
+
+				if (!is(collapse))
+					collapse = true;
+
+				if (collapse) {
+					if (!is(to_start))
+						to_start = true;
+
+					t.collapse(to_start);
+				}
+			}
+		});
+	}).call(this);
+
+	// Register plugin
+	tinymce.PluginManager.add('compat2x', tinymce.plugins.Compat2x);
+})();
+
diff -x .svn -aruN 0.7.15.src/e107_handlers/tiny_mce/plugins/contextmenu/editor_plugin.js 0.7.16.src/e107_handlers/tiny_mce/plugins/contextmenu/editor_plugin.js
--- 0.7.15.src/e107_handlers/tiny_mce/plugins/contextmenu/editor_plugin.js	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_handlers/tiny_mce/plugins/contextmenu/editor_plugin.js	2009-06-30 19:36:48.000000000 -0500
@@ -1 +1 @@
-if(!tinyMCE.settings['contextmenu_skip_plugin_css']){tinyMCE.loadCSS(tinyMCE.baseURL+"/plugins/contextmenu/css/contextmenu.css")}var TinyMCE_ContextMenuPlugin={_contextMenu:null,getInfo:function(){return{longname:'Context menus',author:'Moxiecode Systems AB',authorurl:'http://tinymce.moxiecode.com',infourl:'http://tinymce.moxiecode.com/tinymce/docs/plugin_contextmenu.html',version:tinyMCE.majorVersion+"."+tinyMCE.minorVersion}},initInstance:function(inst){if(tinyMCE.isMSIE5_0&&tinyMCE.isOpera)return;TinyMCE_ContextMenuPlugin._contextMenu=new TinyMCE_ContextMenu({commandhandler:"TinyMCE_ContextMenuPlugin._commandHandler",spacer_image:tinyMCE.baseURL+"/plugins/contextmenu/images/spacer.gif"});tinyMCE.addEvent(inst.getDoc(),"click",TinyMCE_ContextMenuPlugin._hideContextMenu);tinyMCE.addEvent(inst.getDoc(),"keypress",TinyMCE_ContextMenuPlugin._hideContextMenu);tinyMCE.addEvent(inst.getDoc(),"keydown",TinyMCE_ContextMenuPlugin._hideContextMenu);tinyMCE.addEvent(document,"click",TinyMCE_ContextMenuPlugin._hideContextMenu);tinyMCE.addEvent(document,"keypress",TinyMCE_ContextMenuPlugin._hideContextMenu);tinyMCE.addEvent(document,"keydown",TinyMCE_ContextMenuPlugin._hideContextMenu);if(tinyMCE.isGecko){tinyMCE.addEvent(inst.getDoc(),"contextmenu",function(e){TinyMCE_ContextMenuPlugin._showContextMenu(tinyMCE.isMSIE?inst.contentWindow.event:e,inst)})}else tinyMCE.addEvent(inst.getDoc(),"contextmenu",TinyMCE_ContextMenuPlugin._onContextMenu)},_onContextMenu:function(e){var elm=tinyMCE.isMSIE?e.srcElement:e.target;var targetInst,body;if((body=tinyMCE.getParentElement(elm,"body"))!=null){for(var n in tinyMCE.instances){var inst=tinyMCE.instances[n];if(!tinyMCE.isInstance(inst))continue;if(body==inst.getBody()){targetInst=inst;break}}return TinyMCE_ContextMenuPlugin._showContextMenu(tinyMCE.isMSIE?targetInst.contentWindow.event:e,targetInst)}},_showContextMenu:function(e,inst){function getAttrib(elm,name){return elm.getAttribute(name)?elm.getAttribute(name):""}var x,y,elm,contextMenu;var pos=tinyMCE.getAbsPosition(inst.iframeElement);x=tinyMCE.isMSIE?e.screenX:pos.absLeft+(e.pageX-inst.getBody().scrollLeft);y=tinyMCE.isMSIE?e.screenY:pos.absTop+(e.pageY-inst.getBody().scrollTop);elm=tinyMCE.isMSIE?e.srcElement:e.target;contextMenu=this._contextMenu;contextMenu.inst=inst;window.setTimeout(function(){var theme=tinyMCE.getParam("theme");contextMenu.clearAll();var sel=inst.selection.getSelectedText().length!=0||elm.nodeName=="IMG";contextMenu.addItem(tinyMCE.baseURL+"/themes/"+theme+"/images/cut.gif","$lang_cut_desc","Cut","",!sel);contextMenu.addItem(tinyMCE.baseURL+"/themes/"+theme+"/images/copy.gif","$lang_copy_desc","Copy","",!sel);contextMenu.addItem(tinyMCE.baseURL+"/themes/"+theme+"/images/paste.gif","$lang_paste_desc","Paste","",false);if(sel||(elm?(elm.nodeName=='A')||(elm.nodeName=='IMG'):false)){contextMenu.addSeparator();contextMenu.addItem(tinyMCE.baseURL+"/themes/advanced/images/link.gif","$lang_link_desc",inst.hasPlugin("advlink")?"mceAdvLink":"mceLink");contextMenu.addItem(tinyMCE.baseURL+"/themes/advanced/images/unlink.gif","$lang_unlink_desc","unlink","",(elm?(elm.nodeName!='A')&&(elm.nodeName!='IMG'):true))}elm=tinyMCE.getParentElement(elm,"img,table,td"+(inst.hasPlugin("advhr")?',hr':''));if(elm){switch(elm.nodeName){case"IMG":contextMenu.addSeparator();if(tinyMCE.hasPlugin('flash')&&tinyMCE.getAttrib(elm,'class').indexOf('mceItemFlash')!=-1)contextMenu.addItem(tinyMCE.baseURL+"/plugins/flash/images/flash.gif","$lang_flash_props","mceFlash");else if(tinyMCE.hasPlugin('media')&&/mceItem(Flash|ShockWave|WindowsMedia|QuickTime|RealMedia)/.test(tinyMCE.getAttrib(elm,'class')))contextMenu.addItem(tinyMCE.baseURL+"/plugins/flash/images/flash.gif","$lang_media_title","mceMedia");else contextMenu.addItem(tinyMCE.baseURL+"/themes/"+theme+"/images/image.gif","$lang_image_props_desc",inst.hasPlugin("advimage")?"mceAdvImage":"mceImage");break;case"HR":contextMenu.addSeparator();contextMenu.addItem(tinyMCE.baseURL+"/plugins/advhr/images/advhr.gif","$lang_insert_advhr_desc","mceAdvancedHr");break;case"TABLE":case"TD":if(inst.hasPlugin("table")){var colspan=(elm.nodeName=="TABLE")?"":getAttrib(elm,"colspan");var rowspan=(elm.nodeName=="TABLE")?"":getAttrib(elm,"rowspan");colspan=colspan==""?"1":colspan;rowspan=rowspan==""?"1":rowspan;contextMenu.addSeparator();contextMenu.addItem(tinyMCE.baseURL+"/themes/"+theme+"/images/cut.gif","$lang_table_cut_row_desc","mceTableCutRow");contextMenu.addItem(tinyMCE.baseURL+"/themes/"+theme+"/images/copy.gif","$lang_table_copy_row_desc","mceTableCopyRow");contextMenu.addItem(tinyMCE.baseURL+"/themes/"+theme+"/images/paste.gif","$lang_table_paste_row_before_desc","mceTablePasteRowBefore","",inst.tableRowClipboard==null);contextMenu.addItem(tinyMCE.baseURL+"/themes/"+theme+"/images/paste.gif","$lang_table_paste_row_after_desc","mceTablePasteRowAfter","",inst.tableRowClipboard==null);contextMenu.addSeparator();contextMenu.addItem(tinyMCE.baseURL+"/plugins/table/images/table.gif","$lang_table_desc","mceInsertTable","insert");contextMenu.addItem(tinyMCE.baseURL+"/plugins/table/images/table.gif","$lang_table_props_desc","mceInsertTable");contextMenu.addItem(tinyMCE.baseURL+"/plugins/table/images/table_cell_props.gif","$lang_table_cell_desc","mceTableCellProps");contextMenu.addItem(tinyMCE.baseURL+"/plugins/table/images/table_delete.gif","$lang_table_del","mceTableDelete");contextMenu.addSeparator();contextMenu.addItem(tinyMCE.baseURL+"/plugins/table/images/table_row_props.gif","$lang_table_row_desc","mceTableRowProps");contextMenu.addItem(tinyMCE.baseURL+"/plugins/table/images/table_insert_row_before.gif","$lang_table_row_before_desc","mceTableInsertRowBefore");contextMenu.addItem(tinyMCE.baseURL+"/plugins/table/images/table_insert_row_after.gif","$lang_table_row_after_desc","mceTableInsertRowAfter");contextMenu.addItem(tinyMCE.baseURL+"/plugins/table/images/table_delete_row.gif","$lang_table_delete_row_desc","mceTableDeleteRow");contextMenu.addSeparator();contextMenu.addItem(tinyMCE.baseURL+"/plugins/table/images/table_insert_col_before.gif","$lang_table_col_before_desc","mceTableInsertColBefore");contextMenu.addItem(tinyMCE.baseURL+"/plugins/table/images/table_insert_col_after.gif","$lang_table_col_after_desc","mceTableInsertColAfter");contextMenu.addItem(tinyMCE.baseURL+"/plugins/table/images/table_delete_col.gif","$lang_table_delete_col_desc","mceTableDeleteCol");contextMenu.addSeparator();contextMenu.addItem(tinyMCE.baseURL+"/plugins/table/images/table_split_cells.gif","$lang_table_split_cells_desc","mceTableSplitCells","",(colspan=="1"&&rowspan=="1"));contextMenu.addItem(tinyMCE.baseURL+"/plugins/table/images/table_merge_cells.gif","$lang_table_merge_cells_desc","mceTableMergeCells","",false)}break}}else{if(inst.hasPlugin("table")){contextMenu.addSeparator();contextMenu.addItem(tinyMCE.baseURL+"/plugins/table/images/table.gif","$lang_table_desc","mceInsertTable","insert")}}contextMenu.show(x,y)},10);tinyMCE.cancelEvent(e);return false},_hideContextMenu:function(){if(TinyMCE_ContextMenuPlugin._contextMenu)TinyMCE_ContextMenuPlugin._contextMenu.hide()},_commandHandler:function(command,value){var cm=TinyMCE_ContextMenuPlugin._contextMenu;cm.hide();var ui=false;if(command=="mceInsertTable"||command=="mceTableCellProps"||command=="mceTableRowProps"||command=="mceTableMergeCells")ui=true;if(command=="Paste")value=null;if(tinyMCE.getParam("dialog_type")=="modal"&&tinyMCE.isMSIE){window.setTimeout(function(){cm.inst.execCommand(command,ui,value)},100)}else cm.inst.execCommand(command,ui,value)}};tinyMCE.addPlugin("contextmenu",TinyMCE_ContextMenuPlugin);function TinyMCE_ContextMenu(settings){var doc,self=this;function defParam(key,def_val){settings[key]=typeof(settings[key])!="undefined"?settings[key]:def_val}this.isMSIE=(navigator.appName=="Microsoft Internet Explorer");this.contextMenuDiv=document.createElement("div");this.contextMenuDiv.className="contextMenu";this.contextMenuDiv.setAttribute("class","contextMenu");this.contextMenuDiv.style.display="none";this.contextMenuDiv.style.position='absolute';this.contextMenuDiv.style.zindex=1000;this.contextMenuDiv.style.left='0';this.contextMenuDiv.style.top='0';this.contextMenuDiv.unselectable="on";document.body.appendChild(this.contextMenuDiv);defParam("commandhandler","");defParam("spacer_image","images/spacer.gif");this.items=new Array();this.settings=settings;this.html="";if(tinyMCE.isMSIE&&!tinyMCE.isMSIE5_0&&!tinyMCE.isOpera){this.pop=window.createPopup();doc=this.pop.document;doc.open();doc.write('<html><head><link href="'+tinyMCE.baseURL+'/plugins/contextmenu/css/contextmenu.css" rel="stylesheet" type="text/css" /></head><body unselectable="yes" class="contextMenuIEPopup"></body></html>');doc.close()}};TinyMCE_ContextMenu.prototype={clearAll:function(){this.html="";this.contextMenuDiv.innerHTML=""},addSeparator:function(){this.html+='<tr class="contextMenuItem"><td class="contextMenuIcon"><img src="'+this.settings['spacer_image']+'" width="20" height="1" class="contextMenuImage" /></td><td><img class="contextMenuSeparator" width="1" height="1" src="'+this.settings['spacer_image']+'" /></td></tr>'},addItem:function(icon,title,command,value,disabled){if(title.charAt(0)=='$')title=tinyMCE.getLang(title.substring(1));var onMouseDown='';var html='';if(tinyMCE.isMSIE&&!tinyMCE.isMSIE5_0)onMouseDown='contextMenu.execCommand(\''+command+'\', \''+value+'\');return false;';else onMouseDown=this.settings['commandhandler']+'(\''+command+'\', \''+value+'\');return false;';if(icon=="")icon=this.settings['spacer_image'];if(!disabled)html+='<tr class="contextMenuItem">';else html+='<tr class="contextMenuItemDisabled">';html+='<td class="contextMenuIcon"><img src="'+icon+'" width="20" height="20" class="contextMenuImage" /></td>';html+='<td><div class="contextMenuText">';html+='<a href="javascript:void(0);" onclick="'+onMouseDown+'" onmousedown="return false;">&#160;';html+=title;html+='&#160;</a>';html+='</div></td>';html+='</tr>';this.html+=html},show:function(x,y){var vp,width,height,yo;if(this.html=="")return;var html='';html+='<a href="#"></a><table border="0" cellpadding="0" cellspacing="0">';html+=this.html;html+='</table>';this.contextMenuDiv.innerHTML=html;this.contextMenuDiv.style.display="block";width=this.contextMenuDiv.offsetWidth;height=this.contextMenuDiv.offsetHeight;this.contextMenuDiv.style.display="none";if(tinyMCE.isMSIE&&!tinyMCE.isMSIE5_0&&!tinyMCE.isOpera){this.pop.document.body.innerHTML='<div class="contextMenu">'+html+"</div>";this.pop.document.tinyMCE=tinyMCE;this.pop.document.contextMenu=this;this.pop.show(x,y,width,height)}else{vp=this.getViewPort();yo=tinyMCE.isMSIE5_0?document.body.scrollTop:self.pageYOffset;this.contextMenuDiv.style.left=(x>vp.left+vp.width-width?vp.left+vp.width-width:x)+'px';this.contextMenuDiv.style.top=(y>vp.top+vp.height-height?vp.top+vp.height-height:y)+'px';this.contextMenuDiv.style.display="block"}},getViewPort:function(){return{left:self.pageXOffset||self.document.documentElement.scrollLeft||self.document.body.scrollLeft,top:self.pageYOffset||self.document.documentElement.scrollTop||self.document.body.scrollTop,width:document.documentElement.offsetWidth||document.body.offsetWidth,height:self.innerHeight||document.documentElement.clientHeight||document.body.clientHeight}},hide:function(){if(tinyMCE.isMSIE&&!tinyMCE.isMSIE5_0&&!tinyMCE.isOpera)this.pop.hide();else this.contextMenuDiv.style.display="none"},execCommand:function(command,value){eval(this.settings['commandhandler']+"(command, value);")}};
\ No newline at end of file
+(function(){var a=tinymce.dom.Event,c=tinymce.each,b=tinymce.DOM;tinymce.create("tinymce.plugins.ContextMenu",{init:function(d){var f=this;f.editor=d;f.onContextMenu=new tinymce.util.Dispatcher(this);d.onContextMenu.add(function(g,h){if(!h.ctrlKey){f._getMenu(g).showMenu(h.clientX,h.clientY);a.add(g.getDoc(),"click",e);a.cancel(h)}});function e(){if(f._menu){f._menu.removeAll();f._menu.destroy();a.remove(d.getDoc(),"click",e)}}d.onMouseDown.add(e);d.onKeyDown.add(e)},getInfo:function(){return{longname:"Contextmenu",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/contextmenu",version:tinymce.majorVersion+"."+tinymce.minorVersion}},_getMenu:function(h){var l=this,f=l._menu,i=h.selection,e=i.isCollapsed(),d=i.getNode()||h.getBody(),g,k,j;if(f){f.removeAll();f.destroy()}k=b.getPos(h.getContentAreaContainer());j=b.getPos(h.getContainer());f=h.controlManager.createDropMenu("contextmenu",{offset_x:k.x+h.getParam("contextmenu_offset_x",0),offset_y:k.y+h.getParam("contextmenu_offset_y",0),constrain:1});l._menu=f;f.add({title:"advanced.cut_desc",icon:"cut",cmd:"Cut"}).setDisabled(e);f.add({title:"advanced.copy_desc",icon:"copy",cmd:"Copy"}).setDisabled(e);f.add({title:"advanced.paste_desc",icon:"paste",cmd:"Paste"});if((d.nodeName=="A"&&!h.dom.getAttrib(d,"name"))||!e){f.addSeparator();f.add({title:"advanced.link_desc",icon:"link",cmd:h.plugins.advlink?"mceAdvLink":"mceLink",ui:true});f.add({title:"advanced.unlink_desc",icon:"unlink",cmd:"UnLink"})}f.addSeparator();f.add({title:"advanced.image_desc",icon:"image",cmd:h.plugins.advimage?"mceAdvImage":"mceImage",ui:true});f.addSeparator();g=f.addMenu({title:"contextmenu.align"});g.add({title:"contextmenu.left",icon:"justifyleft",cmd:"JustifyLeft"});g.add({title:"contextmenu.center",icon:"justifycenter",cmd:"JustifyCenter"});g.add({title:"contextmenu.right",icon:"justifyright",cmd:"JustifyRight"});g.add({title:"contextmenu.full",icon:"justifyfull",cmd:"JustifyFull"});l.onContextMenu.dispatch(l,f,d,e);return f}});tinymce.PluginManager.add("contextmenu",tinymce.plugins.ContextMenu)})();
\ No newline at end of file
diff -x .svn -aruN 0.7.15.src/e107_handlers/tiny_mce/plugins/contextmenu/editor_plugin_src.js 0.7.16.src/e107_handlers/tiny_mce/plugins/contextmenu/editor_plugin_src.js
--- 0.7.15.src/e107_handlers/tiny_mce/plugins/contextmenu/editor_plugin_src.js	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_handlers/tiny_mce/plugins/contextmenu/editor_plugin_src.js	2009-06-30 19:36:48.000000000 -0500
@@ -1,357 +1,95 @@
 /**
- * $Id: editor_plugin_src.js,v 1.9 2006/10/27 22:36:57 e107coders Exp $
+ * $Id: editor_plugin_src.js,v 1.10 2009/07/01 00:37:12 e107coders Exp $
  *
  * @author Moxiecode
- * @copyright Copyright  2004-2006, Moxiecode Systems AB, All rights reserved.
+ * @copyright Copyright  2004-2008, Moxiecode Systems AB, All rights reserved.
  */
 
-/* Import plugin specific language pack */
-if (!tinyMCE.settings['contextmenu_skip_plugin_css']) {
-	tinyMCE.loadCSS(tinyMCE.baseURL + "/plugins/contextmenu/css/contextmenu.css");
-}
-
-var TinyMCE_ContextMenuPlugin = {
-	// Private fields
-	_contextMenu : null,
-
-	getInfo : function() {
-		return {
-			longname : 'Context menus',
-			author : 'Moxiecode Systems AB',
-			authorurl : 'http://tinymce.moxiecode.com',
-			infourl : 'http://tinymce.moxiecode.com/tinymce/docs/plugin_contextmenu.html',
-			version : tinyMCE.majorVersion + "." + tinyMCE.minorVersion
-		};
-	},
-
-	initInstance : function(inst) {
-		// Is not working on MSIE 5.0 or Opera no contextmenu event
-		if (tinyMCE.isMSIE5_0 && tinyMCE.isOpera)
-			return;
-
-		TinyMCE_ContextMenuPlugin._contextMenu = new TinyMCE_ContextMenu({
-			commandhandler : "TinyMCE_ContextMenuPlugin._commandHandler",
-			spacer_image : tinyMCE.baseURL + "/plugins/contextmenu/images/spacer.gif"
-		});
-
-		// Add hide event handles
-		tinyMCE.addEvent(inst.getDoc(), "click", TinyMCE_ContextMenuPlugin._hideContextMenu);
-		tinyMCE.addEvent(inst.getDoc(), "keypress", TinyMCE_ContextMenuPlugin._hideContextMenu);
-		tinyMCE.addEvent(inst.getDoc(), "keydown", TinyMCE_ContextMenuPlugin._hideContextMenu);
-		tinyMCE.addEvent(document, "click", TinyMCE_ContextMenuPlugin._hideContextMenu);
-		tinyMCE.addEvent(document, "keypress", TinyMCE_ContextMenuPlugin._hideContextMenu);
-		tinyMCE.addEvent(document, "keydown", TinyMCE_ContextMenuPlugin._hideContextMenu);
-
-		// Attach contextmenu event
-		if (tinyMCE.isGecko) {
-			tinyMCE.addEvent(inst.getDoc(), "contextmenu", function(e) {TinyMCE_ContextMenuPlugin._showContextMenu(tinyMCE.isMSIE ? inst.contentWindow.event : e, inst);});
-		} else
-			tinyMCE.addEvent(inst.getDoc(), "contextmenu", TinyMCE_ContextMenuPlugin._onContextMenu);
-	},
-
-	// Private plugin internal methods
-
-	_onContextMenu : function(e) {
-		var elm = tinyMCE.isMSIE ? e.srcElement : e.target;
-		var targetInst, body;
-
-		// Find instance
-		if ((body = tinyMCE.getParentElement(elm, "body")) != null) {
-			for (var n in tinyMCE.instances) {
-				var inst = tinyMCE.instances[n];
-				if (!tinyMCE.isInstance(inst))
-					continue;
-
-				if (body == inst.getBody()) {
-					targetInst = inst;
-					break;
+(function() {
+	var Event = tinymce.dom.Event, each = tinymce.each, DOM = tinymce.DOM;
+
+	tinymce.create('tinymce.plugins.ContextMenu', {
+		init : function(ed) {
+			var t = this;
+
+			t.editor = ed;
+			t.onContextMenu = new tinymce.util.Dispatcher(this);
+
+			ed.onContextMenu.add(function(ed, e) {
+				if (!e.ctrlKey) {
+					t._getMenu(ed).showMenu(e.clientX, e.clientY);
+					Event.add(ed.getDoc(), 'click', hide);
+					Event.cancel(e);
 				}
-			}
+			});
 
-			return TinyMCE_ContextMenuPlugin._showContextMenu(tinyMCE.isMSIE ? targetInst.contentWindow.event : e, targetInst);
-		}
-	},
+			function hide() {
+				if (t._menu) {
+					t._menu.removeAll();
+					t._menu.destroy();
+					Event.remove(ed.getDoc(), 'click', hide);
+				}
+			};
 
-	_showContextMenu : function(e, inst) {
-		function getAttrib(elm, name) {
-			return elm.getAttribute(name) ? elm.getAttribute(name) : "";
-		}
+			ed.onMouseDown.add(hide);
+			ed.onKeyDown.add(hide);
+		},
+
+		getInfo : function() {
+			return {
+				longname : 'Contextmenu',
+				author : 'Moxiecode Systems AB',
+				authorurl : 'http://tinymce.moxiecode.com',
+				infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/contextmenu',
+				version : tinymce.majorVersion + "." + tinymce.minorVersion
+			};
+		},
+
+		_getMenu : function(ed) {
+			var t = this, m = t._menu, se = ed.selection, col = se.isCollapsed(), el = se.getNode() || ed.getBody(), am, p1, p2;
+
+			if (m) {
+				m.removeAll();
+				m.destroy();
+			}
 
-		var x, y, elm, contextMenu;
-		var pos = tinyMCE.getAbsPosition(inst.iframeElement);
+			p1 = DOM.getPos(ed.getContentAreaContainer());
+			p2 = DOM.getPos(ed.getContainer());
 
-		x = tinyMCE.isMSIE ? e.screenX : pos.absLeft + (e.pageX - inst.getBody().scrollLeft);
-		y = tinyMCE.isMSIE ? e.screenY : pos.absTop + (e.pageY - inst.getBody().scrollTop);
-		elm = tinyMCE.isMSIE ? e.srcElement : e.target;
-
-		contextMenu = this._contextMenu;
-		contextMenu.inst = inst;
-
-		// Mozilla needs some time
-		window.setTimeout(function () {
-			var theme = tinyMCE.getParam("theme");
-
-			contextMenu.clearAll();
-			var sel = inst.selection.getSelectedText().length != 0 || elm.nodeName == "IMG";
-
-			// Default items
-			contextMenu.addItem(tinyMCE.baseURL + "/themes/" + theme + "/images/cut.gif", "$lang_cut_desc", "Cut", "", !sel);
-			contextMenu.addItem(tinyMCE.baseURL + "/themes/" + theme + "/images/copy.gif", "$lang_copy_desc", "Copy", "", !sel);
-			contextMenu.addItem(tinyMCE.baseURL + "/themes/" + theme + "/images/paste.gif", "$lang_paste_desc", "Paste", "", false);
-
-			if (sel || (elm ? (elm.nodeName == 'A') || (elm.nodeName == 'IMG') : false)) {
-				contextMenu.addSeparator();
-				contextMenu.addItem(tinyMCE.baseURL + "/themes/advanced/images/link.gif", "$lang_link_desc", inst.hasPlugin("advlink") ? "mceAdvLink" : "mceLink");
-				contextMenu.addItem(tinyMCE.baseURL + "/themes/advanced/images/unlink.gif", "$lang_unlink_desc", "unlink", "", (elm ? (elm.nodeName != 'A') && (elm.nodeName != 'IMG') : true));
+			m = ed.controlManager.createDropMenu('contextmenu', {
+				offset_x : p1.x + ed.getParam('contextmenu_offset_x', 0),
+				offset_y : p1.y + ed.getParam('contextmenu_offset_y', 0),
+				constrain : 1
+			});
+
+			t._menu = m;
+
+			m.add({title : 'advanced.cut_desc', icon : 'cut', cmd : 'Cut'}).setDisabled(col);
+			m.add({title : 'advanced.copy_desc', icon : 'copy', cmd : 'Copy'}).setDisabled(col);
+			m.add({title : 'advanced.paste_desc', icon : 'paste', cmd : 'Paste'});
+
+			if ((el.nodeName == 'A' && !ed.dom.getAttrib(el, 'name')) || !col) {
+				m.addSeparator();
+				m.add({title : 'advanced.link_desc', icon : 'link', cmd : ed.plugins.advlink ? 'mceAdvLink' : 'mceLink', ui : true});
+				m.add({title : 'advanced.unlink_desc', icon : 'unlink', cmd : 'UnLink'});
 			}
 
-			// Get element
-			elm = tinyMCE.getParentElement(elm, "img,table,td" + (inst.hasPlugin("advhr") ? ',hr' : ''));
-			if (elm) {
-				switch (elm.nodeName) {
-					case "IMG":
-						contextMenu.addSeparator();
-
-						// If flash
-						if (tinyMCE.hasPlugin('flash') && tinyMCE.getAttrib(elm, 'class').indexOf('mceItemFlash') != -1)
-							contextMenu.addItem(tinyMCE.baseURL + "/plugins/flash/images/flash.gif", "$lang_flash_props", "mceFlash");
-						else if (tinyMCE.hasPlugin('media') && /mceItem(Flash|ShockWave|WindowsMedia|QuickTime|RealMedia)/.test(tinyMCE.getAttrib(elm, 'class')))
-							contextMenu.addItem(tinyMCE.baseURL + "/plugins/flash/images/flash.gif", "$lang_media_title", "mceMedia");
-						else
-							contextMenu.addItem(tinyMCE.baseURL + "/themes/" + theme + "/images/image.gif", "$lang_image_props_desc", inst.hasPlugin("advimage") ? "mceAdvImage" : "mceImage");
-						break;
-
-					case "HR":
-						contextMenu.addSeparator();
-						contextMenu.addItem(tinyMCE.baseURL + "/plugins/advhr/images/advhr.gif", "$lang_insert_advhr_desc", "mceAdvancedHr");
-						break;
-
-					case "TABLE":
-					case "TD":
-						// Is table plugin loaded
-						if (inst.hasPlugin("table")) {
-							var colspan = (elm.nodeName == "TABLE") ? "" : getAttrib(elm, "colspan");
-							var rowspan = (elm.nodeName == "TABLE") ? "" : getAttrib(elm, "rowspan");
-
-							colspan = colspan == "" ? "1" : colspan;
-							rowspan = rowspan == "" ? "1" : rowspan;
-
-							contextMenu.addSeparator();
-							contextMenu.addItem(tinyMCE.baseURL + "/themes/" + theme + "/images/cut.gif", "$lang_table_cut_row_desc", "mceTableCutRow");
-							contextMenu.addItem(tinyMCE.baseURL + "/themes/" + theme + "/images/copy.gif", "$lang_table_copy_row_desc", "mceTableCopyRow");
-							contextMenu.addItem(tinyMCE.baseURL + "/themes/" + theme + "/images/paste.gif", "$lang_table_paste_row_before_desc", "mceTablePasteRowBefore", "", inst.tableRowClipboard == null);
-							contextMenu.addItem(tinyMCE.baseURL + "/themes/" + theme + "/images/paste.gif", "$lang_table_paste_row_after_desc", "mceTablePasteRowAfter", "", inst.tableRowClipboard == null);
-
-	/*						contextMenu.addItem(tinyMCE.baseURL + "/themes/" + theme + "/images/justifyleft.gif", "$lang_justifyleft_desc", "JustifyLeft", "", false);
-							contextMenu.addItem(tinyMCE.baseURL + "/themes/" + theme + "/images/justifycenter.gif", "$lang_justifycenter_desc", "JustifyCenter", "", false);
-							contextMenu.addItem(tinyMCE.baseURL + "/themes/" + theme + "/images/justifyright.gif", "$lang_justifyright_desc", "JustifyRight", "", false);
-							contextMenu.addItem(tinyMCE.baseURL + "/themes/" + theme + "/images/justifyfull.gif", "$lang_justifyfull_desc", "JustifyFull", "", false);*/
-							contextMenu.addSeparator();
-							contextMenu.addItem(tinyMCE.baseURL + "/plugins/table/images/table.gif", "$lang_table_desc", "mceInsertTable", "insert");
-							contextMenu.addItem(tinyMCE.baseURL + "/plugins/table/images/table.gif", "$lang_table_props_desc", "mceInsertTable");
-							contextMenu.addItem(tinyMCE.baseURL + "/plugins/table/images/table_cell_props.gif", "$lang_table_cell_desc", "mceTableCellProps");
-							contextMenu.addItem(tinyMCE.baseURL + "/plugins/table/images/table_delete.gif", "$lang_table_del", "mceTableDelete");
-							contextMenu.addSeparator();
-							contextMenu.addItem(tinyMCE.baseURL + "/plugins/table/images/table_row_props.gif", "$lang_table_row_desc", "mceTableRowProps");
-							contextMenu.addItem(tinyMCE.baseURL + "/plugins/table/images/table_insert_row_before.gif", "$lang_table_row_before_desc", "mceTableInsertRowBefore");
-							contextMenu.addItem(tinyMCE.baseURL + "/plugins/table/images/table_insert_row_after.gif", "$lang_table_row_after_desc", "mceTableInsertRowAfter");
-							contextMenu.addItem(tinyMCE.baseURL + "/plugins/table/images/table_delete_row.gif", "$lang_table_delete_row_desc", "mceTableDeleteRow");
-							contextMenu.addSeparator();
-							contextMenu.addItem(tinyMCE.baseURL + "/plugins/table/images/table_insert_col_before.gif", "$lang_table_col_before_desc", "mceTableInsertColBefore");
-							contextMenu.addItem(tinyMCE.baseURL + "/plugins/table/images/table_insert_col_after.gif", "$lang_table_col_after_desc", "mceTableInsertColAfter");
-							contextMenu.addItem(tinyMCE.baseURL + "/plugins/table/images/table_delete_col.gif", "$lang_table_delete_col_desc", "mceTableDeleteCol");
-							contextMenu.addSeparator();
-							contextMenu.addItem(tinyMCE.baseURL + "/plugins/table/images/table_split_cells.gif", "$lang_table_split_cells_desc", "mceTableSplitCells", "", (colspan == "1" && rowspan == "1"));
-							contextMenu.addItem(tinyMCE.baseURL + "/plugins/table/images/table_merge_cells.gif", "$lang_table_merge_cells_desc", "mceTableMergeCells", "", false);
-						}
-						break;
-				}
-			}  else {
-				// Add table specific
-				if (inst.hasPlugin("table")) {
-					contextMenu.addSeparator();
-					contextMenu.addItem(tinyMCE.baseURL + "/plugins/table/images/table.gif", "$lang_table_desc", "mceInsertTable", "insert");
-				}
-			}
+			m.addSeparator();
+			m.add({title : 'advanced.image_desc', icon : 'image', cmd : ed.plugins.advimage ? 'mceAdvImage' : 'mceImage', ui : true});
+
+			m.addSeparator();
+			am = m.addMenu({title : 'contextmenu.align'});
+			am.add({title : 'contextmenu.left', icon : 'justifyleft', cmd : 'JustifyLeft'});
+			am.add({title : 'contextmenu.center', icon : 'justifycenter', cmd : 'JustifyCenter'});
+			am.add({title : 'contextmenu.right', icon : 'justifyright', cmd : 'JustifyRight'});
+			am.add({title : 'contextmenu.full', icon : 'justifyfull', cmd : 'JustifyFull'});
 
-			contextMenu.show(x, y);
-		}, 10);
+			t.onContextMenu.dispatch(t, m, el, col);
 
-		// Cancel default handeling
-		tinyMCE.cancelEvent(e);
-		return false;
-	},
-
-	_hideContextMenu : function() {
-		if (TinyMCE_ContextMenuPlugin._contextMenu)
-			TinyMCE_ContextMenuPlugin._contextMenu.hide();
-	},
-
-	_commandHandler : function(command, value) {
-		var cm = TinyMCE_ContextMenuPlugin._contextMenu;
-
-		cm.hide();
-
-		// UI must be true on these
-		var ui = false;
-		if (command == "mceInsertTable" || command == "mceTableCellProps" || command == "mceTableRowProps" || command == "mceTableMergeCells")
-			ui = true;
-
-		if (command == "Paste")
-			value = null;
-
-		if (tinyMCE.getParam("dialog_type") == "modal" && tinyMCE.isMSIE) {
-			// Cell properties will generate access denied error is this isn't done?!
-			window.setTimeout(function() {
-				cm.inst.execCommand(command, ui, value);
-			}, 100);
-		} else
-			cm.inst.execCommand(command, ui, value);
-	}
-};
-
-tinyMCE.addPlugin("contextmenu", TinyMCE_ContextMenuPlugin);
-
-// Context menu class
-
-function TinyMCE_ContextMenu(settings) {
-	var doc, self = this;
-
-	// Default value function
-	function defParam(key, def_val) {
-		settings[key] = typeof(settings[key]) != "undefined" ? settings[key] : def_val;
-	}
-
-	this.isMSIE = (navigator.appName == "Microsoft Internet Explorer");
-
-	// Setup contextmenu div
-	this.contextMenuDiv = document.createElement("div");
-	this.contextMenuDiv.className = "contextMenu";
-	this.contextMenuDiv.setAttribute("class", "contextMenu");
-	this.contextMenuDiv.style.display = "none";
-	this.contextMenuDiv.style.position = 'absolute';
-	this.contextMenuDiv.style.zindex = 1000;
-	this.contextMenuDiv.style.left = '0';
-	this.contextMenuDiv.style.top = '0';
-	this.contextMenuDiv.unselectable = "on";
-
-	document.body.appendChild(this.contextMenuDiv);
-
-	// Setup default values
-	defParam("commandhandler", "");
-	defParam("spacer_image", "images/spacer.gif");
-
-	this.items = new Array();
-	this.settings = settings;
-	this.html = "";
-
-	// IE Popup
-	if (tinyMCE.isMSIE && !tinyMCE.isMSIE5_0 && !tinyMCE.isOpera) {
-		this.pop = window.createPopup();
-		doc = this.pop.document;
-		doc.open();
-		doc.write('<html><head><link href="' + tinyMCE.baseURL + '/plugins/contextmenu/css/contextmenu.css" rel="stylesheet" type="text/css" /></head><body unselectable="yes" class="contextMenuIEPopup"></body></html>');
-		doc.close();
-	}
-};
-
-TinyMCE_ContextMenu.prototype = {
-	clearAll : function() {
-		this.html = "";
-		this.contextMenuDiv.innerHTML = "";
-	},
-
-	addSeparator : function() {
-		this.html += '<tr class="contextMenuItem"><td class="contextMenuIcon"><img src="' + this.settings['spacer_image'] + '" width="20" height="1" class="contextMenuImage" /></td><td><img class="contextMenuSeparator" width="1" height="1" src="' + this.settings['spacer_image'] + '" /></td></tr>';
-	},
-
-	addItem : function(icon, title, command, value, disabled) {
-		if (title.charAt(0) == '$')
-			title = tinyMCE.getLang(title.substring(1));
-
-		var onMouseDown = '';
-		var html = '';
-
-		if (tinyMCE.isMSIE && !tinyMCE.isMSIE5_0)
-			onMouseDown = 'contextMenu.execCommand(\'' + command + '\', \'' + value + '\');return false;';
-		else
-			onMouseDown = this.settings['commandhandler'] + '(\'' + command + '\', \'' + value + '\');return false;';
-
-		if (icon == "")
-			icon = this.settings['spacer_image'];
-
-		if (!disabled)
-			html += '<tr class="contextMenuItem">';
-		else
-			html += '<tr class="contextMenuItemDisabled">';
-
-		html += '<td class="contextMenuIcon"><img src="' + icon + '" width="20" height="20" class="contextMenuImage" /></td>';
-		html += '<td><div class="contextMenuText">';
-		html += '<a href="javascript:void(0);" onclick="' + onMouseDown + '" onmousedown="return false;">&#160;';
-
-		// Add text
-		html += title;
-
-		html += '&#160;</a>';
-		html += '</div></td>';
-		html += '</tr>';
-
-		// Add to main
-		this.html += html;
-	},
-
-	show : function(x, y) {
-		var vp, width, height, yo;
-
-		if (this.html == "")
-			return;
-
-		var html = '';
-
-		html += '<a href="#"></a><table border="0" cellpadding="0" cellspacing="0">';
-		html += this.html;
-		html += '</table>';
-
-		this.contextMenuDiv.innerHTML = html;
-
-		// Get dimensions
-		this.contextMenuDiv.style.display = "block";
-		width = this.contextMenuDiv.offsetWidth;
-		height = this.contextMenuDiv.offsetHeight;
-		this.contextMenuDiv.style.display = "none";
-
-		if (tinyMCE.isMSIE && !tinyMCE.isMSIE5_0 && !tinyMCE.isOpera) {
-			// Setup popup and show
-			this.pop.document.body.innerHTML = '<div class="contextMenu">' + html + "</div>";
-			this.pop.document.tinyMCE = tinyMCE;
-			this.pop.document.contextMenu = this;
-			this.pop.show(x, y, width, height);
-		} else {
-			vp = this.getViewPort();
-			yo = tinyMCE.isMSIE5_0 ? document.body.scrollTop : self.pageYOffset;
-			this.contextMenuDiv.style.left = (x > vp.left + vp.width - width ? vp.left + vp.width - width : x) + 'px';
-			this.contextMenuDiv.style.top = (y > vp.top + vp.height - height ? vp.top + vp.height - height : y) + 'px';
-			this.contextMenuDiv.style.display = "block";
+			return m;
 		}
-	},
+	});
 
-	getViewPort : function() {
-		return {
-			left : self.pageXOffset || self.document.documentElement.scrollLeft || self.document.body.scrollLeft,
-			top: self.pageYOffset || self.document.documentElement.scrollTop || self.document.body.scrollTop,
-			width : document.documentElement.offsetWidth || document.body.offsetWidth,
-			height : self.innerHeight || document.documentElement.clientHeight || document.body.clientHeight
-		};
-	},
-
-	hide : function() {
-		if (tinyMCE.isMSIE && !tinyMCE.isMSIE5_0 && !tinyMCE.isOpera)
-			this.pop.hide();
-		else
-			this.contextMenuDiv.style.display = "none";
-	},
-
-	execCommand : function(command, value) {
-		eval(this.settings['commandhandler'] + "(command, value);");
-	}
-};
+	// Register plugin
+	tinymce.PluginManager.add('contextmenu', tinymce.plugins.ContextMenu);
+})();
\ No newline at end of file
diff -x .svn -aruN 0.7.15.src/e107_handlers/tiny_mce/plugins/emoticons/editor_plugin.js 0.7.16.src/e107_handlers/tiny_mce/plugins/emoticons/editor_plugin.js
--- 0.7.15.src/e107_handlers/tiny_mce/plugins/emoticons/editor_plugin.js	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_handlers/tiny_mce/plugins/emoticons/editor_plugin.js	2009-07-06 01:16:08.000000000 -0500
@@ -1,56 +1,81 @@
-
-tinyMCE.importPluginLanguagePack('emoticons', 'en');
-
-// Plucin static class
-var TinyMCE_emoticonsPlugin = {
-	getInfo : function() {
-		return {
-			longname : 'emoticons',
-			author : 'CaMer0n',
-			authorurl : 'http://e107coders.org',
-			infourl : 'http://www.e107.org',
-			version : tinyMCE.majorVersion + "." + tinyMCE.minorVersion
-		};
-	},
-
-	/**
-	 * Returns the HTML contents of the emoticons control.
-	 */
-	getControlHTML : function(cn) {
-		switch (cn) {
-			case "emoticons":
-				return tinyMCE.getButtonHTML(cn, 'lang_emoticons_desc', '{$pluginurl}/images/emoticons.png', 'mceEmotion');
-		}
-
-		return "";
-	},
-
-	/**
-	 * Executes the mceEmotion command.
-	 */
-	execCommand : function(editor_id, element, command, user_interface, value) {
-		// Handle commands
-		switch (command) {
-			case "mceEmotion":
-				var template = new Array();
-
-				template['file'] = '../../plugins/emoticons/emoticons.php'; // Relative to theme
-				template['width'] = 200;
-				template['height'] = 200;
-
-				// Language specific width and height addons
-				template['width'] += tinyMCE.getLang('lang_emoticons_delta_width', 0);
-				template['height'] += tinyMCE.getLang('lang_emoticons_delta_height', 0);
-
-				tinyMCE.openWindow(template, {editor_id : editor_id, inline : "yes"});
-
-				return true;
+/**
+ * $Id: editor_plugin.js,v 1.4 2009/07/06 06:16:32 e107coders Exp $
+ *
+ * @author Moxiecode
+ * @copyright Copyright  2004-2008, Moxiecode Systems AB, All rights reserved.
+ */
+
+(function() {
+	// Load plugin specific language pack
+  	tinymce.PluginManager.requireLangPack('emoticons');
+
+	tinymce.create('tinymce.plugins.EmoticonsPlugin', {
+		/**
+		 * Initializes the plugin, this will be executed after the plugin has been created.
+		 * This call is done before the editor instance has finished it's initialization so use the onInit event
+		 * of the editor instance to intercept that event.
+		 *
+		 * @param {tinymce.Editor} ed Editor instance that the plugin is initialized in.
+		 * @param {string} url Absolute URL to where the plugin is located.
+		 */
+		init : function(ed, url) {
+			// Register the command so that it can be invoked by using tinyMCE.activeEditor.execCommand('mceExample');
+			ed.addCommand('mceEmotion', function() {
+				ed.windowManager.open({
+					file :  url + '/emoticons.php',
+					width : 220 + parseInt(ed.getLang('emoticons.delta_width', 0)),
+					height : 220 + parseInt(ed.getLang('emoticons.delta_height', 0)),
+					inline : 1
+				}, {
+					plugin_url : url, // Plugin absolute URL
+					some_custom_arg : 'custom arg' // Custom argument
+				});
+			});
+
+			// Register example button
+			ed.addButton('emoticons', {
+				title : 'emoticons.desc',
+				cmd : 'mceEmotion',
+				image : url + '/images/emoticons.png'
+			});
+
+			// Add a node change handler, selects the button in the UI when a image is selected
+			ed.onNodeChange.add(function(ed, cm, n) {
+				cm.setActive('emoticons', n.nodeName == 'IMG');
+			});
+		},
+
+		/**
+		 * Creates control instances based in the incomming name. This method is normally not
+		 * needed since the addButton method of the tinymce.Editor class is a more easy way of adding buttons
+		 * but you sometimes need to create more complex controls like listboxes, split buttons etc then this
+		 * method can be used to create those.
+		 *
+		 * @param {String} n Name of the control to create.
+		 * @param {tinymce.ControlManager} cm Control manager to use inorder to create new control.
+		 * @return {tinymce.ui.Control} New control instance or null if no control was created.
+		 */
+		createControl : function(n, cm) {
+			return null;
+		},
+
+		/**
+		 * Returns information about the plugin as a name/value array.
+		 * The current keys are longname, author, authorurl, infourl and version.
+		 *
+		 * @return {Object} Name/value array containing information about the plugin.
+		 */
+		getInfo : function() {
+			return {
+				longname : 'Emoticons plugin',
+				author : 'CaMer0n',
+				authorurl : 'http://e107coders.org',
+				infourl : '',
+				version : "1.0"
+			};
 		}
+	});
 
-		// Pass to next handler in chain
-		return false;
-	}
-};
-
-// Register plugin
-tinyMCE.addPlugin('emoticons', TinyMCE_emoticonsPlugin);
\ No newline at end of file
+	// Register plugin
+	tinymce.PluginManager.add('emoticons', tinymce.plugins.EmoticonsPlugin);
+})();
\ No newline at end of file
diff -x .svn -aruN 0.7.15.src/e107_handlers/tiny_mce/plugins/emoticons/emoticons.php 0.7.16.src/e107_handlers/tiny_mce/plugins/emoticons/emoticons.php
--- 0.7.15.src/e107_handlers/tiny_mce/plugins/emoticons/emoticons.php	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_handlers/tiny_mce/plugins/emoticons/emoticons.php	2009-07-06 01:16:08.000000000 -0500
@@ -6,9 +6,8 @@
 $HEADER = "";
 require_once(HEADERF);
 
-
 	$emotes = $sysprefs->getArray("emote_".$pref['emotepack']);
-	$str = "<div class='spacer' style='white-space:wrap;width:130px;text-align:center'>";
+	$str = "<div class='spacer' style='padding:10px;white-space:wrap;width:180px;text-align:center'>";
     foreach($emotes as $key => $value){
 		$key = str_replace("!", ".", $key);
 		$key = preg_replace("#_(\w{3})$#", ".\\1", $key);
diff -x .svn -aruN 0.7.15.src/e107_handlers/tiny_mce/plugins/emoticons/langs/en.js 0.7.16.src/e107_handlers/tiny_mce/plugins/emoticons/langs/en.js
--- 0.7.15.src/e107_handlers/tiny_mce/plugins/emoticons/langs/en.js	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_handlers/tiny_mce/plugins/emoticons/langs/en.js	2009-07-06 01:16:08.000000000 -0500
@@ -1,5 +1,5 @@
 // UK lang variables
 
-tinyMCELang['lang_insert_emoticons_title'] = 'Insert emotion';
-tinyMCELang['lang_emoticons_desc'] = 'Emotions';
-
+tinyMCE.addI18n('en.emoticons',{
+	desc : 'Insert emotion'
+});
\ No newline at end of file
diff -x .svn -aruN 0.7.15.src/e107_handlers/tiny_mce/plugins/ibrowser/editor_plugin.js 0.7.16.src/e107_handlers/tiny_mce/plugins/ibrowser/editor_plugin.js
--- 0.7.15.src/e107_handlers/tiny_mce/plugins/ibrowser/editor_plugin.js	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_handlers/tiny_mce/plugins/ibrowser/editor_plugin.js	2009-07-01 18:33:50.000000000 -0500
@@ -1,92 +1,81 @@
-// Import theme specific language pack
-// $Source: /cvsroot/e107/e107_0.7/e107_handlers/tiny_mce/plugins/ibrowser/editor_plugin.js,v $
-// $Revision: 1.4 $
-// $Date: 2006/10/27 22:36:57 $
-// $Author: e107coders $
-
-tinyMCE.importPluginLanguagePack('ibrowser', 'en,es,da,de,fr,nl,pl,sv,ru');
-
-// Returns the HTML contents of the ibrowser control.
-
-var TinyMCE_ibrowserPlugin = {
-	getInfo : function() {
-		return {
-			longname : 'ibrowser',
-			author : 'Your name',
-			authorurl : '',
-			infourl : '',
-			version : "1.1"
-		};
-	},
-
-	getControlHTML : function(cn) {
-		switch (cn) {
-			case "ibrowser":
-				return tinyMCE.getButtonHTML(cn, 'lang_ibrowser_desc', '{$pluginurl}/images/ibrowser.gif', 'mceBrowseImage', true);
+/**
+ * $Id: editor_plugin.js,v 1.5 2009/07/01 23:34:14 e107coders Exp $
+ *
+ * @author Moxiecode
+ * @copyright Copyright  2004-2008, Moxiecode Systems AB, All rights reserved.
+ */
+
+(function() {
+	// Load plugin specific language pack
+	tinymce.PluginManager.requireLangPack('ibrowser');
+
+	tinymce.create('tinymce.plugins.ibrowserPlugin', {
+		/**
+		 * Initializes the plugin, this will be executed after the plugin has been created.
+		 * This call is done before the editor instance has finished it's initialization so use the onInit event
+		 * of the editor instance to intercept that event.
+		 *
+		 * @param {tinymce.Editor} ed Editor instance that the plugin is initialized in.
+		 * @param {string} url Absolute URL to where the plugin is located.
+		 */
+		init : function(ed, url) {
+			// Register the command so that it can be invoked by using tinyMCE.activeEditor.execCommand('mceibrowser');
+			ed.addCommand('mceibrowser', function() {
+				ed.windowManager.open({
+					file : url + '/ibrowser.php',
+					width : 520 + parseInt(ed.getLang('ibrowser.delta_width', 0)),
+					height : 770 + parseInt(ed.getLang('ibrowser.delta_height', 0)),
+					inline : 1
+				}, {
+					plugin_url : url, // Plugin absolute URL
+					some_custom_arg : 'custom arg' // Custom argument
+				});
+			});
+
+			// Register ibrowser button
+			ed.addButton('ibrowser', {
+				title : 'ibrowser.desc',
+				cmd : 'mceibrowser',
+				image : url + '/images/ibrowser.gif'
+			});
+
+			// Add a node change handler, selects the button in the UI when a image is selected
+			ed.onNodeChange.add(function(ed, cm, n) {
+				cm.setActive('ibrowser', n.nodeName == 'IMG');
+			});
+		},
+
+		/**
+		 * Creates control instances based in the incomming name. This method is normally not
+		 * needed since the addButton method of the tinymce.Editor class is a more easy way of adding buttons
+		 * but you sometimes need to create more complex controls like listboxes, split buttons etc then this
+		 * method can be used to create those.
+		 *
+		 * @param {String} n Name of the control to create.
+		 * @param {tinymce.ControlManager} cm Control manager to use inorder to create new control.
+		 * @return {tinymce.ui.Control} New control instance or null if no control was created.
+		 */
+		createControl : function(n, cm) {
+			return null;
+		},
+
+		/**
+		 * Returns information about the plugin as a name/value array.
+		 * The current keys are longname, author, authorurl, infourl and version.
+		 *
+		 * @return {Object} Name/value array containing information about the plugin.
+		 */
+		getInfo : function() {
+			return {
+				longname : 'ibrowser plugin',
+				author : 'Some author',
+				authorurl : 'http://tinymce.moxiecode.com',
+				infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/ibrowser',
+				version : "1.0"
+			};
 		}
+	});
 
-		return "";
-	},
-
-
-	execCommand : function(editor_id, element, command, user_interface, value) {
-		// Handle commands
-		switch (command) {
-		case "mceBrowseImage":
-			var template = new Array();
-
-			template['file'] = '../../plugins/ibrowser/ibrowser.php'; // Relative to theme location
-			template['width'] = 480;
-			template['height'] = 670;
-
-			var src = "", alt = "", border = "", hspace = "", vspace = "", width = "", height = "", align = "";
-            var margin_left = "";
-			var margin_right = "";
-			var margin_top = "";
-			var margin_bottom = "";
-
-			if (tinyMCE.selectedElement != null && tinyMCE.selectedElement.nodeName.toLowerCase() == "img")
-				tinyMCE.imgElement = tinyMCE.selectedElement;
-
-            if (tinyMCE.imgElement) {
-                src = tinyMCE.imgElement.getAttribute('src') ? tinyMCE.imgElement.getAttribute('src') : "";
-                alt = tinyMCE.imgElement.getAttribute('alt') ? tinyMCE.imgElement.getAttribute('alt') : "";
-			}
-            /*
-
-                border = tinyMCE.imgElement.style.border ? tinyMCE.imgElement.style.border : "";
-                hspace = tinyMCE.imgElement.getAttribute('hspace') ? tinyMCE.imgElement.getAttribute('hspace') : "";
-                vspace = tinyMCE.imgElement.getAttribute('vspace') ? tinyMCE.imgElement.getAttribute('vspace') : "";
-                width = tinyMCE.imgElement.style.width ? tinyMCE.imgElement.style.width.replace('px','') : "";
-                height = tinyMCE.imgElement.style.height ? tinyMCE.imgElement.style.height.replace('px','') : "";
-                align = tinyMCE.imgElement.getAttribute('align') ? tinyMCE.imgElement.getAttribute('align') : "";
-
-                margin_left = tinyMCE.imgElement.style.marginLeft ? tinyMCE.imgElement.style.marginLeft.replace('px','') : "";
-                margin_right = tinyMCE.imgElement.style.marginRight ? tinyMCE.imgElement.style.marginRight.replace('px','') : "";
-                margin_top = tinyMCE.imgElement.style.marginTop ? tinyMCE.imgElement.style.marginTop.replace('px','') : "";
-                margin_bottom = tinyMCE.imgElement.style.marginBottom ? tinyMCE.imgElement.style.marginBottom.replace('px','') : "";
-
-                // Fix for drag-drop/copy paste bug in Mozilla
-                mceRealSrc = tinyMCE.imgElement.getAttribute('mce_real_src') ? tinyMCE.imgElement.getAttribute('mce_real_src') : "";
-                if (mceRealSrc != "")
-                    src = mceRealSrc;
-
-           //       src = eval(tinyMCE.settings['urlconvertor_callback'] + "(src, tinyMCE.imgElement, true);");
-            }
-*/
-				tinyMCE.openWindow(template, {editor_id : editor_id, src : src, alt : alt, border : border, hspace : hspace, vspace : vspace, width : width, height : height, align : align});
-				return true;
-	}
-
-   		// Pass to next handler in chain
-		return false;
-	}
-
-};
-
-
-tinyMCE.addPlugin("ibrowser", TinyMCE_ibrowserPlugin);
-
-
-
-
+	// Register plugin
+	tinymce.PluginManager.add('ibrowser', tinymce.plugins.ibrowserPlugin);
+})();
\ No newline at end of file
diff -x .svn -aruN 0.7.15.src/e107_handlers/tiny_mce/plugins/ibrowser/ibrowser.php 0.7.16.src/e107_handlers/tiny_mce/plugins/ibrowser/ibrowser.php
--- 0.7.15.src/e107_handlers/tiny_mce/plugins/ibrowser/ibrowser.php	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_handlers/tiny_mce/plugins/ibrowser/ibrowser.php	2009-07-01 22:22:33.000000000 -0500
@@ -9,13 +9,13 @@
 // ------------------------------------------------
 //                                   www.j-cons.com
 // ================================================
-// $Revision: 1.9 $Date: 2004/10/04
+// $Revision: 1.12 $Date: 2004/10/04
 // ================================================
 //
 // $Source: /cvsroot/e107/e107_0.7/e107_handlers/tiny_mce/plugins/ibrowser/ibrowser.php,v $
-// $Revision: 1.9 $
-// $Date: 2007/08/09 19:10:00 $
-// $Author: e107steved $
+// $Revision: 1.12 $
+// $Date: 2009/07/02 03:22:57 $
+// $Author: e107coders $
 // +----------------------------------------------------------------------------+
 // Major Re-work by CaMer0n
 
@@ -23,11 +23,15 @@
 // unset $tinyMCE_imglib_include
 require_once("../../../../class2.php");
 if (!defined('e107_INIT')) { exit; }
+
+
 unset($tinyMCE_imglib_include);
 
 // include image library config settings
+
 include 'config.php';
 
+
 $request_uri = urldecode(empty($_POST['request_uri'])?(empty($_GET['request_uri'])?'':$_GET['request_uri']):$_POST['request_uri']);
 
 // if set include file specified in $tinyMCE_imglib_include
@@ -64,16 +68,36 @@
 $preview = e_IMAGE."generic/blank.gif";
 
 $errors = array();
+if(is_readable("langs/".e_LANGUAGE.".php"))
+{
+	include_once("langs/".e_LANGUAGE.".php");
+}
+else
+{
+	include_once("langs/English.php");
+}
+
+	$_root = e_BASE;
+	$d = @dir(e_BASE.$imglib);
+
+
+echo "
+<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">
 
-?>
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
 <html>
 <head>
-<title>{$lang_ibrowser_title}</title>
-<script type="text/javaScript" src="../../tiny_mce_popup.js"></script>
-<meta http-equiv="Pragma" content="no-cache">
-<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET ?>" />
-<script type="text/javascript">
+<title>".$lang_ibrowser_title."</title>
+<script type=\"text/javascript\" src=\"../../tiny_mce_popup.js\"></script>
+<meta http-equiv=\"Pragma\" content=\"no-cache\" />
+<meta http-equiv=\"Content-Type\" content=\"text/html; charset=". CHARSET."\" />
+<script type=\"text/javascript\">
+
+   //<![CDATA[
+
+";
+
+
+ ?>
 	// click ok - select picture or save changes
 	function selectClick() {
 
@@ -112,8 +136,8 @@
       	}
   //	}
 
-	// validate input values
-	function validateParams() {
+
+	function validateParams() {   	// validate input values
     	// check numeric values for attributes
     	if (isNaN(parseInt(document.getElementById("width").value)) && document.getElementById("width").value != '') {
  				alert(tinyMCE.getLang('lang_ibrowser_error')+ ' : '+ tinyMCE.getLang('lang_ibrowser_error_width_nan'));
@@ -144,8 +168,8 @@
 
 	}
 
-	// delete image
-	function deleteClick()
+
+	function deleteClick()   // delete image
 	{
 		if (document.libbrowser.imglist.selectedIndex>=0)
 	  	{
@@ -157,76 +181,74 @@
 	  	}
 	}
 
-// set picture attributes on change
-	function selectChange(obj)
+
+	function selectChange(obj)  // set picture attributes on change
 	{
 		var formObj = document.forms[0];
-//		formObj.src.value = '<?php echo $tinyMCE_base_url.$imglib?>'+obj.options[obj.selectedIndex].value;
-//		formObj.width.value = obj.options[obj.selectedIndex].img_width;
-//		formObj.height.value = obj.options[obj.selectedIndex].img_height;
-//		formObj.size.value = obj.options[obj.selectedIndex].f_size;
-//		formObj.alt.value = obj.options[obj.selectedIndex].value;
-		var splitvar = obj.options[obj.selectedIndex].value.split("|");
-		formObj.src.value = '<?php echo $tinyMCE_base_url.$imglib?>'+splitvar[3];
-		formObj.width.value = splitvar[0];
-		formObj.height.value = splitvar[1];
-		formObj.size.value = splitvar[2];
-		formObj.alt.value = splitvar[3];
+
+		var splitvar 			= obj.options[obj.selectedIndex].value.split("|");
+		formObj.src.value 		= '<?php echo $tinyMCE_base_url.$imglib?>'+splitvar[3];
+		formObj.width.value 	= splitvar[0];
+		formObj.height.value 	= splitvar[1];
+		formObj.size.value 		= splitvar[2];
+		formObj.alt.value 		= splitvar[3];
 
 		owidth = eval(formObj.width.value);
 		oheight = eval(formObj.height.value);
-		updateStyle()
+		updateStyle();
 	}
 
-	// init functions
-	function init()
+
+	function init()  // init functions
 	{
-		// if existing image (image properties)
-		if (tinyMCE.getWindowArg('src') != '') {
+		var formObj = document.forms[0], nl = formObj.elements, ed = tinyMCEPopup.editor, dom = ed.dom, n = ed.selection.getNode();
 
-			var formObj = document.forms[0];
-			for (var i=0; i<document.forms[0].align.options.length; i++) {
-				if (document.forms[0].align.options[i].value == tinyMCE.imgElement.style.cssFloat)
+		if (n.nodeName == 'IMG')  // if existing image (image properties)
+	  	{
+			for (var i=0; i<formObj.align.options.length; i++)
+			{
+				if (document.forms[0].align.options[i].value == n.style.cssFloat)
 				document.forms[0].align.options.selectedIndex = i;
 			}
 
-			formObj.src.value = tinyMCE.getWindowArg('src');
-			formObj.alt.value = tinyMCE.imgElement.alt;
-			formObj.border.value = tinyMCE.imgElement.style.borderLeftWidth.replace('px','');
-        	formObj.width.value = tinyMCE.imgElement.style.width.replace('px','');
-			formObj.height.value = tinyMCE.imgElement.style.height.replace('px','');
-			formObj.margin_left.value = tinyMCE.imgElement.style.marginLeft.replace('px','');
-			formObj.margin_right.value = tinyMCE.imgElement.style.marginRight.replace('px','');
-			formObj.margin_top.value = tinyMCE.imgElement.style.marginTop.replace('px','');
-			formObj.margin_bottom.value = tinyMCE.imgElement.style.marginBottom.replace('px','');
+			formObj.src.value 			= dom.getAttrib(n, 'src');
+			formObj.alt.value 			= dom.getAttrib(n, 'alt');
+			formObj.border.value 		= n.style.borderLeftWidth.replace('px','');
+         	formObj.width.value 		= n.style.width.replace('px','');
+			formObj.height.value 		= n.style.height.replace('px','');
+			formObj.margin_left.value 	= n.style.marginLeft.replace('px','');
+			formObj.margin_right.value 	= n.style.marginRight.replace('px','');
+			formObj.margin_top.value 	= n.style.marginTop.replace('px','');
+			formObj.margin_bottom.value = n.style.marginBottom.replace('px','');
 
 			formObj.size.value = 'n/a';
 			owidth = eval(formObj.width.value);
 			oheight = eval(formObj.height.value);
+			document.getElementById('imgpreview').src = '<?php echo $_root ?>' + formObj.src.value;
 
-			frameID = "imgpreview";
-			//document.all(frameID).src = tinyMCE.getWindowArg('src');
-			document.getElementById("imgpreview").src = tinyMCE.getWindowArg('src');
 			updateStyle();
 		}
 
-		window.focus();
+        window.focus();
 	}
 
-	// updates style settings
-	function updateStyle() {
-	 //	if (validateParams()) {
-		  //	alert('val=' + document.getElementById('wrap').style.marginLeft);
 
+	function updateStyle()  // updates style settings on preview
+	{
+
+			document.getElementById('wrap').style.marginLeft 	= document.getElementById('margin_left').value + 'px';
+			document.getElementById('wrap').style.marginRight 	= document.getElementById('margin_right').value + 'px';
+			document.getElementById('wrap').style.marginTop 	= document.getElementById('margin_top').value + 'px';
+			document.getElementById('wrap').style.marginBottom 	= document.getElementById('margin_bottom').value + 'px';
+			document.getElementById('wrap').style.borderWidth 	= document.getElementById('border').value + 'px';
+			document.getElementById('wrap').alt 				= document.getElementById('alt').value;
 
-			document.getElementById('wrap').style.marginLeft = document.libbrowser.margin_left.value;
-			document.getElementById('wrap').style.marginRight = document.libbrowser.margin_right.value;
-			document.getElementById('wrap').style.marginTop = document.libbrowser.margin_top.value;
-			document.getElementById('wrap').style.marginBottom = document.libbrowser.margin_bottom.value;
-            document.getElementById('wrap').style.cssFloat = document.libbrowser.align.value;
-			document.getElementById('wrap').style.borderWidth = document.libbrowser.border.value;
-			document.getElementById('wrap').alt = document.libbrowser.alt.value;
-	 //	}
+            var AlignBox = document.getElementById("align");
+
+		 	if(AlignBox.options[AlignBox.selectedIndex].value)
+			{
+	           	document.getElementById('wrap').style.cssFloat = AlignBox.options[AlignBox.selectedIndex].value;
+	  		}
 	}
 
 	// change picture dimensions
@@ -256,93 +278,98 @@
 	  // 	alert('<?php echo $tinyMCE_base_url.$imglib?>' + formObj.src.value);
 		if (splitvar[3]) imgpreview.location.href = '<?php echo $tinyMCE_base_url.$imglib?>' + formObj.src.value;
 	}
+
+      // ]]>
+
 </script>
-</head>
-<body onLoad="init();">
-<script type="text/javascript">
+
+<?php
+
+echo "</head>
+<body onload='init();'>
+<script type='text/javascript'>
     window.name = 'imglibrary';
 </script>
-<form name="libbrowser" method="post" action="ibrowser.php?request_uri=<?php echo $_GET['request_uri']?>" enctype="multipart/form-data" target="imglibrary">
-  <input type="hidden" name="request_uri" value="<?php echo urlencode($request_uri)?>" />
-  <input type="hidden" name="lib_action" value="" />
-  <fieldset style= "padding: 5 5 5 5; margin-top: -5px;">
-  <legend>{$lang_ibrowser_img_sel}</legend>
-  <table width="440" border="0" cellspacing="0" cellpadding="0">
+
+<form id=\"libbrowser\" method=\"post\" action=\"ibrowser.php?request_uri=".$_GET['request_uri']."\" enctype=\"multipart/form-data\" target=\"imglibrary\">
+  <div>
+  <input type=\"hidden\" name=\"request_uri\" value=\"". urlencode($request_uri)."\" />
+  <input type=\"hidden\" name=\"lib_action\" value=\"\" />
+  <fieldset style= \"padding: 5px; margin-top: -5px;\">
+  <legend>".$lang_ibrowser_img_sel."</legend>
+  <table style='width:100%;border:0px' cellspacing=\"0\" cellpadding=\"0\">
     <tr>
-      <td><table width="100%"  border="0" cellpadding="2" cellspacing="0">
+      <td><table style='width:100%;border:0px' cellpadding=\"2\" cellspacing=\"0\">
           <tr>
-            <td width="210"><strong>{$lang_ibrowser_library}:</strong></td>
-            <td width="5">&nbsp;</td>
-            <td width="210"><strong>{$lang_ibrowser_preview}:</strong></td>
+            <td style='width:210px'><strong>".$lang_ibrowser_library.":</strong></td>
+            <td style='width:5px'>&nbsp;</td>
+            <td ><strong>".$lang_ibrowser_preview.":</strong></td>
           </tr>
           <tr>
-            <td><select name="lib" size="1" style="width: 100%;" onChange="libbrowser.submit();">
-                <?php echo $lib_options?>
+            <td><select name=\"lib\" size=\"1\" style=\"width: 100%;\" onchange=\"this.form.submit();\">
+                ".$lib_options."
               </select></td>
             <td>&nbsp;</td>
-            <td width="210" rowspan="3" align="left" valign="top"><iframe name="imgpreview" id="imgpreview" class="previewWindow" src="<?php echo $preview?>" style="width: 100%; height: 100%;" scrolling="Auto" marginheight="0" marginwidth="0" frameborder="0"></iframe>
+            <td style='border:0px;text-align:left;vertical-align:top' rowspan=\"3\"><iframe name=\"imgpreview\" id=\"imgpreview\" class=\"previewWindow\" src=\"".$preview."\" style=\"border:0px;width: 100%; height: 220px;overflow:auto\" ></iframe>
             </td>
           </tr>
           <tr>
-            <td><strong>{$lang_ibrowser_images}:</strong></td>
+            <td><strong>".$lang_ibrowser_images.":</strong></td>
             <td>&nbsp;</td>
           </tr>
           <tr>
-            <td><?php
-    if (!preg_match('#/$#', $_SERVER['DOCUMENT_ROOT'])){
-    //  $_root = $_SERVER['DOCUMENT_ROOT'].'/';
-		$_root = e_BASE;
-   } else {
-   //   $_root = $_SERVER['DOCUMENT_ROOT'];
-      $_root = e_BASE;
-	}
-  //  $d = @dir($_root.$imglib);
-  //	echo "<Br >dir=".$_root.$imglib;
-	$d = @dir(e_BASE.$imglib);
+            <td>
 
-  ?>
-          <select name="imglist" size="15" style="width: 100%;"
-    onChange="show_image(this);selectChange(this);" ondblclick="selectClick();">
-            <?php
-    	if ($d)
-    {
-	  $i = 0;
-      while (false !== ($entry = $d->read())) {
-        $ext = strtolower(substr(strrchr($entry,'.'), 1));
-        if (is_file($_root.$imglib.$entry) && in_array($ext,$tinyMCE_valid_imgs))
-        {
-			$arr_tinyMCE_image_files[$i][file_name] = $entry;
-			$i++;
-        }
-      }
-      $d->close();
-	  // sort the list of image filenames alphabetically.
-	  sort($arr_tinyMCE_image_files);
-	  for($k=0; $k<count($arr_tinyMCE_image_files); $k++){
-      $entry = $arr_tinyMCE_image_files[$k][file_name];
-	  $size = getimagesize($_root.$imglib.$entry);
-	  $fsize = filesize($_root.$imglib.$entry);
-   ?>
-            <option  value="<?php echo $size[0]; ?>|<?php echo $size[1]; ?>|<?php echo filesize_h($fsize,2); ?>|<?php echo $entry?>" <?php echo ($entry == $img)?'selected':''?>><?php echo $entry?></option>
-            <?php
-	  }
+
+ 	<select name=\"imglist\" size=\"15\" style=\"width: 100%;\"
+    onchange=\"show_image(this);selectChange(this);\" ondblclick=\"selectClick();\">\n";
+
+	if ($d)
+	{
+		  $i = 0;
+	      while (false !== ($entry = $d->read()))
+		  {
+	        $ext = strtolower(substr(strrchr($entry,'.'), 1));
+	        if (is_file($_root.$imglib.$entry) && in_array($ext,$tinyMCE_valid_imgs))
+	        {
+				$arr_tinyMCE_image_files[$i][file_name] = $entry;
+				$i++;
+	        }
+	      }
+	      $d->close();
+		  // sort the list of image filenames alphabetically.
+		  sort($arr_tinyMCE_image_files);
+		  for($k=0; $k<count($arr_tinyMCE_image_files); $k++)
+		  {
+		      	$entry = $arr_tinyMCE_image_files[$k][file_name];
+			  	$size = getimagesize($_root.$imglib.$entry);
+			  	$fsize = filesize($_root.$imglib.$entry);
+  			  	$sel =  ($entry == $img)? "selected='selected'" : "";
+
+				echo "<option  value='".$size[0]."|".$size[1]."|". filesize_h($fsize,2)."|". $entry."'  $sel >". $entry ."</option>\n";
+		  }
     }
     else
     {
       $errors[] = '{$lang_ibrowser_errornodir}';
     }
-  ?>
-          </select></td>
+
+ echo "  </select></td>
             <td>&nbsp;</td>
           </tr>
           <tr>
-            <td colspan="3"><table width="100%"  border="0" cellspacing="0" cellpadding="0">
+            <td colspan=\"3\"><table style='width:100%;border:0px' cellspacing=\"0\" cellpadding=\"0\">
                 <tr>
-                  <td width="40%"><?php if ($tinyMCE_img_delete_allowed) { ?>
-                    <input type="button" value="{$lang_ibrowser_delete}" class="bt" onClick="deleteClick();" />
-                    <?php } ?></td>
-                  <td align="right"><input type="button" name="selectbt" value="{$lang_ibrowser_select}" class="bt" onClick="selectClick();" />
-                    <input type="button" value="{$lang_ibrowser_cancel}" class="bt" onClick="window.close();" /></td>
+                  <td style='width:40%'>";
+
+					if ($tinyMCE_img_delete_allowed)
+					{
+				   		echo "<input type=\"button\" value=\"".$lang_ibrowser_delete."\" class=\"bt\" onclick=\"deleteClick();\" />";
+					}
+
+					echo "</td>
+                  <td align=\"right\"><input type=\"button\" name=\"selectbt\" value=\"{$lang_ibrowser_select}\" class=\"bt\" onclick=\"selectClick();\" />
+                    <input type=\"button\" value=\"".$lang_ibrowser_cancel."\" class=\"bt\" onclick=\"tinyMCEPopup.close();\" /></td>
                 </tr>
               </table></td>
           </tr>
@@ -350,30 +377,35 @@
     </tr>
   </table>
   </fieldset>
-  <fieldset style= "padding: 5 5 5 5; margin-top: 10px;">
-  <legend>{$lang_ibrowser_img_info}</legend>
-  <table style='width:440px;border:0px' cellspacing="0" cellpadding="0">
+
+
+  <fieldset style= \"padding: 5px; margin-top: 10px;\">
+  <legend>".$lang_ibrowser_img_info."</legend>
+  <table style='width:440px;border:0px' cellspacing=\"0\" cellpadding=\"0\">
     <tr>
-      <td><table style='width:440px;border:0px' cellpadding="2" cellspacing="0">
+      <td><table style='width:440px;border:0px' cellpadding=\"2\" cellspacing=\"0\">
           <tr>
-            <td style='width:80px'>{$lang_ibrowser_src}:</td>
-            <td colspan="5"><input name="src" type="text" id="src" value="" style="width: 100%;" /></td>
+            <td style='width:80px'>".$lang_ibrowser_src.":</td>
+            <td colspan=\"5\"><input name=\"src\" type=\"text\" id=\"src\" value=\"\" style=\"width: 100%;\" /></td>
           </tr>
           <tr>
-            <td>{$lang_ibrowser_alt}:</td>
-            <td colspan="5"><input name="alt" type="text" id="alt" value="" style="width: 100%;" onChange="updateStyle()" /></td>
+            <td>".$lang_ibrowser_alt.":</td>
+            <td colspan=\"5\"><input name=\"alt\" type=\"text\" id=\"alt\" value=\"\" style=\"width: 100%;\" onchange=\"updateStyle()\" /></td>
           </tr>
           <tr>
-            <td>{$lang_ibrowser_align}:</td>
-            <td colspan="3"><select name="align" style="width: 100%;" onChange="updateStyle()">
-                <option value="">{$lang_insert_image_align_default}</option>
-                <option value="left">{$lang_insert_image_align_left}</option>
-                <option value="right">{$lang_insert_image_align_right}</option>
-              </select></td>
-            <td width="5">&nbsp;</td>
-            <td rowspan="8" align="left" valign="top" style='width:210px;overflow:hidden'>
-			<div id="stylepreview" style="padding:10px; width: 200px; height:100%; overflow:hidden; background-color:#ffffff; font-size:8px" class="previewWindow">
-                <p><img id="wrap" src="images/textflow.gif" width="45" height="45" alt="" style="border:0px; float:right; margin-left:0px; margin-right:0px; margin-top:0px; margin-bottom:0px" />Lorem
+            <td>".$lang_ibrowser_align.":</td>
+            <td colspan=\"3\">
+				<select id='align' name='align' style=\"width: 100%;\" onchange=\"updateStyle()\">
+                <option value=\"none\">".$lang_insert_image_align_default."</option>
+                <option value=\"left\">".$lang_insert_image_align_left."</option>
+                <option value=\"right\">".$lang_insert_image_align_right."</option>
+              	</select>
+			</td>
+
+            <td style='width:5%'>&nbsp;</td>
+            <td rowspan=\"8\" style='text-align:left;vertical-align:top;width:210px;overflow:hidden'>
+			<div id=\"stylepreview\" style=\"padding:10px; width: 200px; height:100%; overflow:hidden; background-color:#ffffff; font-size:8px\" class=\"previewWindow\">
+                <p><img id=\"wrap\" src=\"images/textflow.gif\" width=\"45\" height=\"45\" alt=\"\" style=\"border:0px solid black; float:none; margin-left:0px; margin-right:0px; margin-top:0px; margin-bottom:0px\" />Lorem
                   ipsum, Dolor sit amet, consectetuer adipiscing loreum ipsum
                   edipiscing elit, sed diam nonummy nibh euismod tincidunt ut
                   laoreet dolore magna aliquam erat volutpat.Loreum ipsum edipiscing
@@ -387,51 +419,55 @@
 			</td>
           </tr>
           <tr>
-            <td>{$lang_ibrowser_size}:</td>
-            <td colspan="3"><input name="size" type="text" id="size" value="" readonly="true" style="width: 100%;" /></td>
+            <td>".$lang_ibrowser_size.":</td>
+            <td colspan=\"3\"><input name=\"size\" type=\"text\" id=\"size\" value=\"\" readonly=\"readonly\" style=\"width: 100%;\" /></td>
             <td>&nbsp;</td>
           </tr>
           <tr>
-            <td>{$lang_ibrowser_height}:</td>
-            <td width="40"><input name="height" type="text" id="height" value="" size="5" maxlength="4" style="text-align: right;" onChange="changeDim(0)" /></td>
-            <td width="25" rowspan="2" align="left" valign="middle"><a href="#" onClick="resetDim();" ><img src="images/constrain.gif" alt="{$lang_ibrowser_reset}" width="22" height="29" border="0"></a></td>
-            <td rowspan="2">&nbsp;</td>
+            <td>".$lang_ibrowser_height.":</td>
+            <td style='width:40%'><input name=\"height\" type=\"text\" id=\"height\" value=\"\" size=\"5\" maxlength=\"4\" style=\"text-align: right;\" onchange=\"changeDim(0)\" /></td>
+            <td style='width:25%' rowspan=\"2\" align=\"left\" valign=\"middle\">
+				<a href=\"#\" onclick=\"resetDim();\" >
+					<img src=\"images/constrain.gif\" alt=\"".$lang_ibrowser_reset."\" width=\"22\" height=\"29\" style='border:0px' />
+				</a>
+			</td>
+            <td rowspan=\"2\">&nbsp;</td>
             <td>&nbsp;</td>
           </tr>
           <tr>
-            <td>{$lang_ibrowser_width}:</td>
-            <td><input name="width" type="text" id="width" value="" size="5" maxlength="4" style="text-align: right;" onChange="changeDim(1)" /></td>
+            <td>".$lang_ibrowser_width.":</td>
+            <td><input name=\"width\" type=\"text\" id=\"width\" value=\"\" size=\"5\" maxlength=\"4\" style=\"text-align: right;\" onchange=\"changeDim(1)\" /></td>
             <td>&nbsp;</td>
           </tr>
           <tr>
-            <td>{$lang_ibrowser_border}:</td>
-            <td colspan="3">
-			<input name="border" type="text" id="border" value="0" size="5" maxlength="4" style="text-align: right;" onchange="updateStyle()" />px
+            <td>".$lang_ibrowser_border.":</td>
+            <td colspan=\"3\">
+			<input name=\"border\" type=\"text\" id=\"border\" value=\"0\" size=\"5\" maxlength=\"4\" style=\"text-align: right;\" onchange=\"updateStyle()\" />px
 			</td>
             <td>&nbsp;</td>
           </tr>
           <tr>
-            <td>Margin-left:</td>
-            <td colspan="3"><input name="margin_left" type="text" id="margin_left" value="0" size="5" maxlength="4" style="text-align: right;" onchange="updateStyle()" />px
+            <td>".$lang_ibrowser_marginl.":</td>
+            <td colspan=\"3\"><input name=\"margin_left\" type=\"text\" id=\"margin_left\" value=\"0\" size=\"5\" maxlength=\"4\" style=\"text-align: right;\" onchange=\"updateStyle()\" />px
 			</td>
             <td>&nbsp;</td>
           </tr>
           <tr>
-            <td>Margin-Right:</td>
-            <td colspan="3"><input name="margin_right" type="text" id="margin_right" value="0" size="5" maxlength="4" style="text-align: right;" onchange="updateStyle()" />px
+            <td>".$lang_ibrowser_marginr.":</td>
+            <td colspan=\"3\"><input name=\"margin_right\" type=\"text\" id=\"margin_right\" value=\"0\" size=\"5\" maxlength=\"4\" style=\"text-align: right;\" onchange=\"updateStyle()\" />px
 			</td>
             <td>&nbsp;</td>
           </tr>
 
           <tr>
-            <td>Margin-Top:</td>
-            <td colspan="3"><input name="margin_top" type="text" id="margin_top" value="0" size="5" maxlength="4" style="text-align: right;" onchange="updateStyle()" />px
+            <td>".$lang_ibrowser_margint.":</td>
+            <td colspan=\"3\"><input name=\"margin_top\" type=\"text\" id=\"margin_top\" value=\"0\" size=\"5\" maxlength=\"4\" style=\"text-align: right;\" onchange=\"updateStyle()\" />px
 			</td>
             <td>&nbsp;</td>
           </tr>
           <tr>
-            <td>Margin-Bottom:</td>
-            <td colspan="3"><input name="margin_bottom" type="text" id="margin_bottom" value="0" size="5" maxlength="4" style="text-align: right;" onchange="updateStyle()" />px
+            <td>".$lang_ibrowser_marginb.":</td>
+            <td colspan=\"3\"><input name=\"margin_bottom\" type=\"text\" id=\"margin_bottom\" value=\"0\" size=\"5\" maxlength=\"4\" style=\"text-align: right;\" onchange=\"updateStyle()\" />px
 			</td>
             <td>&nbsp;</td>
           </tr>
@@ -440,16 +476,18 @@
     </tr>
   </table>
   </fieldset>
-
+</div>
 </form>
 </body>
-</html>
-<?php
+</html>";
+
+
 function liboptions($arr, $prefix = '', $sel = '')
 {
   $buf = '';
-  foreach($arr as $lib) {
-    $buf .= '<option value="'.$lib['value'].'"'.(($lib['value'] == $sel)?' selected':'').'>'.$prefix.$lib['text'].'</option>'."\n";
+  foreach($arr as $lib)
+  {
+    $buf .= '<option value="'.$lib['value'].'"'.(($lib['value'] == $sel)?' selected="selected"':'').'>'.$prefix.$lib['text'].'</option>'."\n";
   }
   return $buf;
 }
diff -x .svn -aruN 0.7.15.src/e107_handlers/tiny_mce/plugins/ibrowser/langs/English.php 0.7.16.src/e107_handlers/tiny_mce/plugins/ibrowser/langs/English.php
--- 0.7.15.src/e107_handlers/tiny_mce/plugins/ibrowser/langs/English.php	1969-12-31 18:00:00.000000000 -0600
+++ 0.7.16.src/e107_handlers/tiny_mce/plugins/ibrowser/langs/English.php	2009-07-01 18:33:51.000000000 -0500
@@ -0,0 +1,48 @@
+<?php
+
+$lang_ibrowser_title= 'Insert / Edit Image';
+$lang_ibrowser_desc= 'Insert / Edit Image';
+$lang_ibrowser_library= 'Library';
+$lang_ibrowser_preview= 'Preview';
+$lang_ibrowser_img_sel= 'Image selection';
+$lang_ibrowser_img_info= 'Image information';
+$lang_ibrowser_img_upload= 'Image upload';
+$lang_ibrowser_images= 'Images';
+$lang_ibrowser_src= 'Source';
+$lang_ibrowser_alt= 'Description';
+$lang_ibrowser_size= 'Size';
+$lang_ibrowser_align= 'Text flow';
+$lang_ibrowser_height= 'Height';
+$lang_ibrowser_width= 'Width';
+$lang_ibrowser_reset= 'Reset Dimensions';
+$lang_ibrowser_border= 'Border';
+$lang_ibrowser_hspace= 'HSpace';
+$lang_ibrowser_vspace= 'VSpace';
+$lang_ibrowser_select= 'Save';
+$lang_ibrowser_delete= 'Delete';
+$lang_ibrowser_cancel= 'Cancel';
+$lang_ibrowser_uploadtxt= 'File';
+$lang_ibrowser_uploadbt= 'Upload';
+$lang_ibrowser_marginl = 'Margin-Left';
+$lang_ibrowser_marginr = 'Margin-Right';
+$lang_ibrowser_margint = 'Margin-Top';
+$lang_ibrowser_marginb = 'Margin-Bottom';
+$lang_insert_image_align_default = "Default";
+$lang_insert_image_align_left = "Left";
+$lang_insert_image_align_right = "Right";
+
+// error messages
+$lang_ibrowser_error= 'Error';
+$lang_ibrowser_errornoimg= 'Please select an image';
+$lang_ibrowser_errornodir= 'Library doesn\'t physically exist';
+$lang_ibrowser_errorupload= 'An error occured while handling the file upload.\nPlease try again later';
+$lang_ibrowser_errortype= 'Wrong image file type';
+$lang_ibrowser_errordelete= 'Delete failed';
+$lang_ibrowser_confirmdelete= 'Click OK to delete image!';
+$lang_ibrowser_error_width_nan= 'Width is not a number!';
+$lang_ibrowser_error_height_nan= 'Height is not a number!';
+$lang_ibrowser_error_border_nan= 'Border is not a number!';
+$lang_ibrowser_error_hspace_nan= 'Horizontal space is not a number!';
+$lang_ibrowser_error_vspace_nan= 'Vertical space is not a number!';
+
+?>
\ No newline at end of file
diff -x .svn -aruN 0.7.15.src/e107_handlers/tiny_mce/plugins/ibrowser/langs/en.js 0.7.16.src/e107_handlers/tiny_mce/plugins/ibrowser/langs/en.js
--- 0.7.15.src/e107_handlers/tiny_mce/plugins/ibrowser/langs/en.js	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_handlers/tiny_mce/plugins/ibrowser/langs/en.js	2009-07-01 18:33:51.000000000 -0500
@@ -1,38 +1,4 @@
 // UK lang variables
-
-tinyMCELang['lang_ibrowser_title'] = 'Insert / Edit Image';
-tinyMCELang['lang_ibrowser_desc'] = 'Insert / Edit Image';
-tinyMCELang['lang_ibrowser_library'] = 'Library';
-tinyMCELang['lang_ibrowser_preview'] = 'Preview';
-tinyMCELang['lang_ibrowser_img_sel'] = 'Image selection';
-tinyMCELang['lang_ibrowser_img_info'] = 'Image information';
-tinyMCELang['lang_ibrowser_img_upload'] = 'Image upload';
-tinyMCELang['lang_ibrowser_images'] = 'Images';
-tinyMCELang['lang_ibrowser_src'] = 'Source';
-tinyMCELang['lang_ibrowser_alt'] = 'Description';
-tinyMCELang['lang_ibrowser_size'] = 'Size';
-tinyMCELang['lang_ibrowser_align'] = 'Text flow';
-tinyMCELang['lang_ibrowser_height'] = 'Height';
-tinyMCELang['lang_ibrowser_width'] = 'Width';
-tinyMCELang['lang_ibrowser_reset'] = 'Reset Dimensions';
-tinyMCELang['lang_ibrowser_border'] = 'Border';
-tinyMCELang['lang_ibrowser_hspace'] = 'HSpace';
-tinyMCELang['lang_ibrowser_vspace'] = 'VSpace';
-tinyMCELang['lang_ibrowser_select'] = 'Save';
-tinyMCELang['lang_ibrowser_delete'] = 'Delete';
-tinyMCELang['lang_ibrowser_cancel'] = 'Cancel';
-tinyMCELang['lang_ibrowser_uploadtxt'] = 'File';
-tinyMCELang['lang_ibrowser_uploadbt'] = 'Upload';
-// error messages
-tinyMCELang['lang_ibrowser_error'] = 'Error';
-tinyMCELang['lang_ibrowser_errornoimg'] = 'Please select an image';
-tinyMCELang['lang_ibrowser_errornodir'] = 'Library doesn\'t physically exist';
-tinyMCELang['lang_ibrowser_errorupload'] = 'An error occured while handling the file upload.\nPlease try again later';
-tinyMCELang['lang_ibrowser_errortype'] = 'Wrong image file type';
-tinyMCELang['lang_ibrowser_errordelete'] = 'Delete failed';
-tinyMCELang['lang_ibrowser_confirmdelete'] = 'Click OK to delete image!';
-tinyMCELang['lang_ibrowser_error_width_nan'] = 'Width is not a number!';
-tinyMCELang['lang_ibrowser_error_height_nan'] = 'Height is not a number!';
-tinyMCELang['lang_ibrowser_error_border_nan'] = 'Border is not a number!';
-tinyMCELang['lang_ibrowser_error_hspace_nan'] = 'Horizontal space is not a number!';
-tinyMCELang['lang_ibrowser_error_vspace_nan'] = 'Vertical space is not a number!';	
\ No newline at end of file
+tinyMCE.addI18n('en.ibrowser',{
+	desc : 'Image Browser'
+});
\ No newline at end of file
diff -x .svn -aruN 0.7.15.src/e107_handlers/tiny_mce/plugins/iespell/editor_plugin.js 0.7.16.src/e107_handlers/tiny_mce/plugins/iespell/editor_plugin.js
--- 0.7.15.src/e107_handlers/tiny_mce/plugins/iespell/editor_plugin.js	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_handlers/tiny_mce/plugins/iespell/editor_plugin.js	2009-06-30 19:36:48.000000000 -0500
@@ -1 +1 @@
-tinyMCE.importPluginLanguagePack('iespell');var TinyMCE_IESpellPlugin={getInfo:function(){return{longname:'IESpell (MSIE Only)',author:'Moxiecode Systems AB',authorurl:'http://tinymce.moxiecode.com',infourl:'http://tinymce.moxiecode.com/tinymce/docs/plugin_iespell.html',version:tinyMCE.majorVersion+"."+tinyMCE.minorVersion}},getControlHTML:function(cn){if(cn=="iespell"&&(tinyMCE.isMSIE&&!tinyMCE.isOpera))return tinyMCE.getButtonHTML(cn,'lang_iespell_desc','{$pluginurl}/images/iespell.gif','mceIESpell');return""},execCommand:function(editor_id,element,command,user_interface,value){if(command=="mceIESpell"){try{var ieSpell=new ActiveXObject("ieSpell.ieSpellExtension");ieSpell.CheckDocumentNode(tinyMCE.getInstanceById(editor_id).contentDocument.documentElement)}catch(e){if(e.number==-2146827859){if(confirm(tinyMCE.getLang("lang_iespell_download","",true)))window.open('http://www.iespell.com/download.php','ieSpellDownload','')}else alert("Error Loading ieSpell: Exception "+e.number)}return true}return false}};tinyMCE.addPlugin("iespell",TinyMCE_IESpellPlugin);
\ No newline at end of file
+(function(){tinymce.create("tinymce.plugins.IESpell",{init:function(a,b){var c=this,d;if(!tinymce.isIE){return}c.editor=a;a.addCommand("mceIESpell",function(){try{d=new ActiveXObject("ieSpell.ieSpellExtension");d.CheckDocumentNode(a.getDoc().documentElement)}catch(f){if(f.number==-2146827859){a.windowManager.confirm(a.getLang("iespell.download"),function(e){if(e){window.open("http://www.iespell.com/download.php","ieSpellDownload","")}})}else{a.windowManager.alert("Error Loading ieSpell: Exception "+f.number)}}});a.addButton("iespell",{title:"iespell.iespell_desc",cmd:"mceIESpell"})},getInfo:function(){return{longname:"IESpell (IE Only)",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/iespell",version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.PluginManager.add("iespell",tinymce.plugins.IESpell)})();
\ No newline at end of file
diff -x .svn -aruN 0.7.15.src/e107_handlers/tiny_mce/plugins/iespell/editor_plugin_src.js 0.7.16.src/e107_handlers/tiny_mce/plugins/iespell/editor_plugin_src.js
--- 0.7.15.src/e107_handlers/tiny_mce/plugins/iespell/editor_plugin_src.js	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_handlers/tiny_mce/plugins/iespell/editor_plugin_src.js	2009-06-30 19:36:48.000000000 -0500
@@ -1,58 +1,51 @@
 /**
- * $Id: editor_plugin_src.js,v 1.9 2006/10/27 22:36:57 e107coders Exp $
+ * $Id: editor_plugin_src.js,v 1.10 2009/07/01 00:37:12 e107coders Exp $
  *
  * @author Moxiecode
- * @copyright Copyright  2004-2006, Moxiecode Systems AB, All rights reserved.
+ * @copyright Copyright  2004-2008, Moxiecode Systems AB, All rights reserved.
  */
 
-/* Import plugin specific language pack */
-tinyMCE.importPluginLanguagePack('iespell');
-
-var TinyMCE_IESpellPlugin = {
-	getInfo : function() {
-		return {
-			longname : 'IESpell (MSIE Only)',
-			author : 'Moxiecode Systems AB',
-			authorurl : 'http://tinymce.moxiecode.com',
-			infourl : 'http://tinymce.moxiecode.com/tinymce/docs/plugin_iespell.html',
-			version : tinyMCE.majorVersion + "." + tinyMCE.minorVersion
-		};
-	},
-
-	/**
-	 * Returns the HTML contents of the iespell control.
-	 */
-	getControlHTML : function(cn) {
-		// Is it the iespell control and is the brower MSIE.
-		if (cn == "iespell" && (tinyMCE.isMSIE && !tinyMCE.isOpera))
-			return tinyMCE.getButtonHTML(cn, 'lang_iespell_desc', '{$pluginurl}/images/iespell.gif', 'mceIESpell');
-
-		return "";
-	},
-
-	/**
-	 * Executes the mceIESpell command.
-	 */
-	execCommand : function(editor_id, element, command, user_interface, value) {
-		// Handle ieSpellCommand
-		if (command == "mceIESpell") {
-			try {
-				var ieSpell = new ActiveXObject("ieSpell.ieSpellExtension");
-				ieSpell.CheckDocumentNode(tinyMCE.getInstanceById(editor_id).contentDocument.documentElement);
-			} catch (e) {
-				if (e.number == -2146827859) {
-					if (confirm(tinyMCE.getLang("lang_iespell_download", "", true)))
-						window.open('http://www.iespell.com/download.php', 'ieSpellDownload', '');
-				} else
-					alert("Error Loading ieSpell: Exception " + e.number);
-			}
-
-			return true;
+(function() {
+	tinymce.create('tinymce.plugins.IESpell', {
+		init : function(ed, url) {
+			var t = this, sp;
+
+			if (!tinymce.isIE)
+				return;
+
+			t.editor = ed;
+
+			// Register commands
+			ed.addCommand('mceIESpell', function() {
+				try {
+					sp = new ActiveXObject("ieSpell.ieSpellExtension");
+					sp.CheckDocumentNode(ed.getDoc().documentElement);
+				} catch (e) {
+					if (e.number == -2146827859) {
+						ed.windowManager.confirm(ed.getLang("iespell.download"), function(s) {
+							if (s)
+								window.open('http://www.iespell.com/download.php', 'ieSpellDownload', '');
+						});
+					} else
+						ed.windowManager.alert("Error Loading ieSpell: Exception " + e.number);
+				}
+			});
+
+			// Register buttons
+			ed.addButton('iespell', {title : 'iespell.iespell_desc', cmd : 'mceIESpell'});
+		},
+
+		getInfo : function() {
+			return {
+				longname : 'IESpell (IE Only)',
+				author : 'Moxiecode Systems AB',
+				authorurl : 'http://tinymce.moxiecode.com',
+				infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/iespell',
+				version : tinymce.majorVersion + "." + tinymce.minorVersion
+			};
 		}
+	});
 
-		// Pass to next handler in chain
-		return false;
-	}
-};
-
-tinyMCE.addPlugin("iespell", TinyMCE_IESpellPlugin);
+	// Register plugin
+	tinymce.PluginManager.add('iespell', tinymce.plugins.IESpell);
+})();
\ No newline at end of file
diff -x .svn -aruN 0.7.15.src/e107_handlers/tiny_mce/plugins/iespell/images/iespell.gif 0.7.16.src/e107_handlers/tiny_mce/plugins/iespell/images/iespell.gif
--- 0.7.15.src/e107_handlers/tiny_mce/plugins/iespell/images/iespell.gif	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_handlers/tiny_mce/plugins/iespell/images/iespell.gif	1969-12-31 18:00:00.000000000 -0600
@@ -1 +0,0 @@
-GIF89a   MMMMM0h0pP   !   ,       Ax0IP ^R0`hh9WEErrS1(+v;M  ;
\ No newline at end of file
diff -x .svn -aruN 0.7.15.src/e107_handlers/tiny_mce/plugins/iespell/langs/en.js 0.7.16.src/e107_handlers/tiny_mce/plugins/iespell/langs/en.js
--- 0.7.15.src/e107_handlers/tiny_mce/plugins/iespell/langs/en.js	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_handlers/tiny_mce/plugins/iespell/langs/en.js	1969-12-31 18:00:00.000000000 -0600
@@ -1,7 +0,0 @@
-// UK lang variables
-
-tinyMCE.addToLang('',{
-iespell_desc : 'Run spell checking',
-iespell_download : "ieSpell not detected. Click OK to go to download page."
-});
-
diff -x .svn -aruN 0.7.15.src/e107_handlers/tiny_mce/plugins/media/css/content.css 0.7.16.src/e107_handlers/tiny_mce/plugins/media/css/content.css
--- 0.7.15.src/e107_handlers/tiny_mce/plugins/media/css/content.css	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_handlers/tiny_mce/plugins/media/css/content.css	2009-06-30 19:36:48.000000000 -0500
@@ -1,26 +1,6 @@
-.mceItemFlash, .mceItemShockWave, .mceItemQuickTime, .mceItemWindowsMedia, .mceItemRealMedia {
-	border: 1px dotted #cc0000;
-	background-position: center;
-	background-repeat: no-repeat;
-	background-color: #ffffcc;
-}
-
-.mceItemShockWave {
-	background-image: url('../images/shockwave.gif');
-}
-
-.mceItemFlash {
-	background-image: url('../images/flash.gif');
-}
-
-.mceItemQuickTime {
-	background-image: url('../images/quicktime.gif');
-}
-
-.mceItemWindowsMedia {
-	background-image: url('../images/windowsmedia.gif');
-}
-
-.mceItemRealMedia {
-	background-image: url('../images/realmedia.gif');
-}
+.mceItemFlash, .mceItemShockWave, .mceItemQuickTime, .mceItemWindowsMedia, .mceItemRealMedia {border:1px dotted #cc0000; background-position:center; background-repeat:no-repeat; background-color:#ffffcc;}
+.mceItemShockWave {background-image: url(../img/shockwave.gif);}
+.mceItemFlash {background-image:url(../img/flash.gif);}
+.mceItemQuickTime {background-image:url(../img/quicktime.gif);}
+.mceItemWindowsMedia {background-image:url(../img/windowsmedia.gif);}
+.mceItemRealMedia {background-image:url(../img/realmedia.gif);}
diff -x .svn -aruN 0.7.15.src/e107_handlers/tiny_mce/plugins/media/css/media.css 0.7.16.src/e107_handlers/tiny_mce/plugins/media/css/media.css
--- 0.7.15.src/e107_handlers/tiny_mce/plugins/media/css/media.css	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_handlers/tiny_mce/plugins/media/css/media.css	2009-06-30 19:36:48.000000000 -0500
@@ -1,68 +1,16 @@
-#id, #name, #hspace, #vspace, #class_name, #align {
-	width: 100px;
-}
-
-#hspace, #vspace {
-	width: 50px;
-}
-
-#flash_quality, #flash_align, #flash_scale, #flash_salign, #flash_wmode {
-	width: 100px;
-}
-
-#flash_base, #flash_flashvars {
-	width: 240px;
-}
-
-#width, #height {
-	width: 40px;
-}
-
-#src, #media_type {
-	width: 250px;
-}
-
-#class {
-	width: 120px;
-}
-
-#prev {
-	margin: 0;
-	border: 1px solid black;
-	width: 99%;
-	height: 230px;
-	overflow: auto;
-}
-
-.panel_wrapper div.current {
-	height: 390px;
-	overflow: auto;
-}
-
-#flash_options, #shockwave_options, #qt_options, #wmp_options, #rmp_options {
-	display: none;
-}
-
-.mceAddSelectValue {
-	background-color: #DDDDDD;
-}
-
-#qt_starttime, #qt_endtime, #qt_fov, #qt_href, #qt_moveid, #qt_moviename, #qt_node, #qt_pan, #qt_qtsrc, #qt_qtsrcchokespeed, #qt_target, #qt_tilt, #qt_urlsubstituten, #qt_volume {
-	width: 70px;
-}
-
-#wmp_balance, #wmp_baseurl, #wmp_captioningid, #wmp_currentmarker, #wmp_currentposition, #wmp_defaultframe, #wmp_playcount, #wmp_rate, #wmp_uimode, #wmp_volume {
-	width: 70px;
-}
-
-#rmp_console, #rmp_numloop, #rmp_controls, #rmp_scriptcallbacks {
-	width: 70px;
-}
-
-#shockwave_swvolume, #shockwave_swframe, #shockwave_swurl, #shockwave_swstretchvalign, #shockwave_swstretchhalign, #shockwave_swstretchstyle {
-	width: 90px;
-}
-
-#qt_qtsrc {
-	width: 200px;
-}
+#id, #name, #hspace, #vspace, #class_name, #align {	width: 100px }
+#hspace, #vspace { width: 50px }
+#flash_quality, #flash_align, #flash_scale, #flash_salign, #flash_wmode { width: 100px }
+#flash_base, #flash_flashvars { width: 240px }
+#width, #height { width: 40px }
+#src, #media_type { width: 250px }
+#class { width: 120px }
+#prev { margin: 0; border: 1px solid black; width: 380px; height: 230px; overflow: auto }
+.panel_wrapper div.current { height: 390px; overflow: auto }
+#flash_options, #shockwave_options, #qt_options, #wmp_options, #rmp_options { display: none }
+.mceAddSelectValue { background-color: #DDDDDD }
+#qt_starttime, #qt_endtime, #qt_fov, #qt_href, #qt_moveid, #qt_moviename, #qt_node, #qt_pan, #qt_qtsrc, #qt_qtsrcchokespeed, #qt_target, #qt_tilt, #qt_urlsubstituten, #qt_volume { width: 70px }
+#wmp_balance, #wmp_baseurl, #wmp_captioningid, #wmp_currentmarker, #wmp_currentposition, #wmp_defaultframe, #wmp_playcount, #wmp_rate, #wmp_uimode, #wmp_volume { width: 70px }
+#rmp_console, #rmp_numloop, #rmp_controls, #rmp_scriptcallbacks { width: 70px }
+#shockwave_swvolume, #shockwave_swframe, #shockwave_swurl, #shockwave_swstretchvalign, #shockwave_swstretchhalign, #shockwave_swstretchstyle { width: 90px }
+#qt_qtsrc { width: 200px }
diff -x .svn -aruN 0.7.15.src/e107_handlers/tiny_mce/plugins/media/editor_plugin.js 0.7.16.src/e107_handlers/tiny_mce/plugins/media/editor_plugin.js
--- 0.7.15.src/e107_handlers/tiny_mce/plugins/media/editor_plugin.js	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_handlers/tiny_mce/plugins/media/editor_plugin.js	2009-06-30 19:36:49.000000000 -0500
@@ -1 +1 @@
-tinyMCE.importPluginLanguagePack('media');var TinyMCE_MediaPlugin={getInfo:function(){return{longname:'Media',author:'Moxiecode Systems AB',authorurl:'http://tinymce.moxiecode.com',infourl:'http://tinymce.moxiecode.com/tinymce/docs/plugin_media.html',version:tinyMCE.majorVersion+"."+tinyMCE.minorVersion}},initInstance:function(inst){if(!tinyMCE.settings['media_skip_plugin_css'])tinyMCE.importCSS(inst.getDoc(),tinyMCE.baseURL+"/plugins/media/css/content.css")},getControlHTML:function(cn){switch(cn){case"media":return tinyMCE.getButtonHTML(cn,'lang_media_desc','{$pluginurl}/images/media.gif','mceMedia')}return""},execCommand:function(editor_id,element,command,user_interface,value){switch(command){case"mceMedia":tinyMCE.openWindow({file:'../../plugins/media/media.htm',width:430+tinyMCE.getLang('lang_media_delta_width',0),height:470+tinyMCE.getLang('lang_media_delta_height',0)},{editor_id:editor_id,inline:"yes"});return true}return false},cleanup:function(type,content,inst){var nl,img,i,ne,d,s,ci;switch(type){case"insert_to_editor":img=tinyMCE.getParam("theme_href")+'/images/spacer.gif';content=content.replace(/<script[^>]*>\s*write(Flash|ShockWave|WindowsMedia|QuickTime|RealMedia)\(\{([^\)]*)\}\);\s*<\/script>/gi,'<img class="mceItem$1" title="$2" src="'+img+'" />');content=content.replace(/<object([^>]*)>/gi,'<div class="mceItemObject" $1>');content=content.replace(/<embed([^>]*)>/gi,'<div class="mceItemObjectEmbed" $1>');content=content.replace(/<\/(object|embed)([^>]*)>/gi,'</div>');content=content.replace(/<param([^>]*)>/gi,'<div $1 class="mceItemParam"></div>');content=content.replace(new RegExp('\\/ class="mceItemParam"><\\/div>','gi'),'class="mceItemParam"></div>');break;case"insert_to_editor_dom":d=inst.getDoc();nl=content.getElementsByTagName("img");for(i=0;i<nl.length;i++){if(/mceItem(Flash|ShockWave|WindowsMedia|QuickTime|RealMedia)/.test(nl[i].className)){nl[i].width=nl[i].title.replace(/.*width:[^0-9]?([0-9]+)%?.*/g,'$1');nl[i].height=nl[i].title.replace(/.*height:[^0-9]?([0-9]+)%?.*/g,'$1');}}nl=tinyMCE.selectElements(content,'DIV',function(n){return tinyMCE.hasCSSClass(n,'mceItemObject')});for(i=0;i<nl.length;i++){ci=tinyMCE.getAttrib(nl[i],"classid").toLowerCase().replace(/\s+/g,'');switch(ci){case'clsid:d27cdb6e-ae6d-11cf-96b8-444553540000':nl[i].parentNode.replaceChild(TinyMCE_MediaPlugin._createImg('mceItemFlash',d,nl[i]),nl[i]);break;case'clsid:166b1bca-3f9c-11cf-8075-444553540000':nl[i].parentNode.replaceChild(TinyMCE_MediaPlugin._createImg('mceItemShockWave',d,nl[i]),nl[i]);break;case'clsid:6bf52a52-394a-11d3-b153-00c04f79faa6':nl[i].parentNode.replaceChild(TinyMCE_MediaPlugin._createImg('mceItemWindowsMedia',d,nl[i]),nl[i]);break;case'clsid:02bf25d5-8c17-4b23-bc80-d3488abddc6b':nl[i].parentNode.replaceChild(TinyMCE_MediaPlugin._createImg('mceItemQuickTime',d,nl[i]),nl[i]);break;case'clsid:cfcdaa03-8be4-11cf-b84b-0020afbbccfa':case'clsid:22d6f312-b0f6-11d0-94ab-0080c74c7e95':case'clsid:05589fa1-c356-11ce-bf01-00aa0055595a':nl[i].parentNode.replaceChild(TinyMCE_MediaPlugin._createImg('mceItemRealMedia',d,nl[i]),nl[i]);break}}nl=tinyMCE.selectNodes(content,function(n){return n.className=='mceItemObjectEmbed'});for(i=0;i<nl.length;i++){switch(tinyMCE.getAttrib(nl[i],'type')){case'application/x-shockwave-flash':TinyMCE_MediaPlugin._createImgFromEmbed(nl[i],d,'mceItemFlash');break;case'application/x-director':TinyMCE_MediaPlugin._createImgFromEmbed(nl[i],d,'mceItemShockWave');break;case'application/x-mplayer2':TinyMCE_MediaPlugin._createImgFromEmbed(nl[i],d,'mceItemWindowsMedia');break;case'video/quicktime':TinyMCE_MediaPlugin._createImgFromEmbed(nl[i],d,'mceItemQuickTime');break;case'audio/x-pn-realaudio-plugin':TinyMCE_MediaPlugin._createImgFromEmbed(nl[i],d,'mceItemRealMedia');break}}break;case"get_from_editor":var startPos=-1,endPos,attribs,chunkBefore,chunkAfter,embedHTML,at,pl,cb,mt,ex;while((startPos=content.indexOf('<img',startPos+1))!=-1){endPos=content.indexOf('/>',startPos);attribs=TinyMCE_MediaPlugin._parseAttributes(content.substring(startPos+4,endPos));if(!/mceItem(Flash|ShockWave|WindowsMedia|QuickTime|RealMedia)/.test(attribs['class']))continue;endPos+=2;at=attribs['title'];if(at){at=at.replace(/&#39;/g,"'");at=at.replace(/&#quot;/g,'"');try{pl=eval('x={'+at+'};')}catch(ex){pl={}}}if(!tinyMCE.getParam('media_use_script',false)){switch(attribs['class']){case'mceItemFlash':ci='d27cdb6e-ae6d-11cf-96b8-444553540000';cb='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0';mt='application/x-shockwave-flash';break;case'mceItemShockWave':ci='166B1BCA-3F9C-11CF-8075-444553540000';cb='http://download.macromedia.com/pub/shockwave/cabs/director/sw.cab#version=8,5,1,0';mt='application/x-director';break;case'mceItemWindowsMedia':ci=tinyMCE.getParam('media_wmp6_compatible')?'05589FA1-C356-11CE-BF01-00AA0055595A':'6BF52A52-394A-11D3-B153-00C04F79FAA6';cb='http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701';mt='application/x-mplayer2';break;case'mceItemQuickTime':ci='02BF25D5-8C17-4B23-BC80-D3488ABDDC6B';cb='http://www.apple.com/qtactivex/qtplugin.cab#version=6,0,2,0';mt='video/quicktime';break;case'mceItemRealMedia':ci='CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA';cb='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0';mt='audio/x-pn-realaudio-plugin';break}if(!tinyMCE.getParam("relative_urls"))pl.src=tinyMCE.convertRelativeToAbsoluteURL(tinyMCE.settings['base_href'],pl.src);embedHTML=TinyMCE_MediaPlugin._getEmbed(ci,cb,mt,pl,attribs)}else{switch(attribs['class']){case'mceItemFlash':s='writeFlash';break;case'mceItemShockWave':s='writeShockWave';break;case'mceItemWindowsMedia':s='writeWindowsMedia';break;case'mceItemQuickTime':s='writeQuickTime';break;case'mceItemRealMedia':s='writeRealMedia';break}if(attribs.width)at=at.replace(/width:[^0-9]?[0-9]+%?[^0-9]?/g,"width:'"+attribs.width+"'");if(attribs.height)at=at.replace(/height:[^0-9]?[0-9]+%?[^0-9]?/g,"height:'"+attribs.height+"'");if(!tinyMCE.getParam("relative_urls")){pl.src=tinyMCE.convertRelativeToAbsoluteURL(tinyMCE.settings['base_href'],pl.src);at=at.replace(new RegExp("src:'[^']*'","g"),"src:'"+pl.src+"'")}embedHTML='<script type="text/javascript">'+s+'({'+at+'});</script>'}chunkBefore=content.substring(0,startPos);chunkAfter=content.substring(endPos);content=chunkBefore+embedHTML+chunkAfter}break}return content},handleNodeChange:function(editor_id,node,undo_index,undo_levels,visual_aid,any_selection){if(node==null)return;do{if(node.nodeName=="IMG"&&/mceItem(Flash|ShockWave|WindowsMedia|QuickTime|RealMedia)/.test(tinyMCE.getAttrib(node,'class'))){tinyMCE.switchClass(editor_id+'_media','mceButtonSelected');return true}}while((node=node.parentNode));tinyMCE.switchClass(editor_id+'_media','mceButtonNormal');return true},_createImgFromEmbed:function(n,d,cl){var ne,at,i,ti='',an;ne=d.createElement('img');ne.src=tinyMCE.getParam("theme_href")+'/images/spacer.gif';ne.width=tinyMCE.getAttrib(n,'width');ne.height=tinyMCE.getAttrib(n,'height');ne.className=cl;at=n.attributes;for(i=0;i<at.length;i++){if(at[i].specified&&at[i].nodeValue){an=at[i].nodeName.toLowerCase();if(an=='src')continue;if(an=='mce_src')an='src';if(an.indexOf('mce_')==-1&&!new RegExp('^(class|type)$').test(an))ti+=an.toLowerCase()+':\''+at[i].nodeValue+"',"}}ti=ti.length>0?ti.substring(0,ti.length-1):ti;ne.title=ti;n.parentNode.replaceChild(ne,n)},_createImg:function(cl,d,n){var i,nl,ti="",an,av,al=new Array();ne=d.createElement('img');ne.src=tinyMCE.getParam("theme_href")+'/images/spacer.gif';ne.width=tinyMCE.getAttrib(n,'width');ne.height=tinyMCE.getAttrib(n,'height');ne.className=cl;al.id=tinyMCE.getAttrib(n,'id');al.name=tinyMCE.getAttrib(n,'name');al.width=tinyMCE.getAttrib(n,'width');al.height=tinyMCE.getAttrib(n,'height');al.bgcolor=tinyMCE.getAttrib(n,'bgcolor');al.align=tinyMCE.getAttrib(n,'align');al.class_name=tinyMCE.getAttrib(n,'mce_class');nl=n.getElementsByTagName('div');for(i=0;i<nl.length;i++){av=tinyMCE.getAttrib(nl[i],'value');av=av.replace(new RegExp('\\\\','g'),'\\\\');av=av.replace(new RegExp('"','g'),'\\"');av=av.replace(new RegExp("'",'g'),"\\'");an=tinyMCE.getAttrib(nl[i],'name');al[an]=av}if(al.movie){al.src=al.movie;al.movie=null}for(an in al){if(al[an]!=null&&typeof(al[an])!="function"&&al[an]!='')ti+=an.toLowerCase()+':\''+al[an]+"',"}ti=ti.length>0?ti.substring(0,ti.length-1):ti;ne.title=ti;return ne},_getEmbed:function(cls,cb,mt,p,at){var h='',n;p.width=at.width?at.width:p.width;p.height=at.height?at.height:p.height;h+='<object classid="clsid:'+cls+'" codebase="'+cb+'"';h+=typeof(p.id)!="undefined"?' id="'+p.id+'"':'';h+=typeof(p.name)!="undefined"?' name="'+p.name+'"':'';h+=typeof(p.width)!="undefined"?' width="'+p.width+'"':'';h+=typeof(p.height)!="undefined"?' height="'+p.height+'"':'';h+=typeof(p.align)!="undefined"?' align="'+p.align+'"':'';h+='>';for(n in p){if(p[n]&&typeof(p[n])!="function"){h+='<param name="'+n+'" value="'+p[n]+'" />';if(n=='src'&&p[n].indexOf('://')!=-1&&mt=='application/x-mplayer2')h+='<param name="url" value="'+p[n]+'" />'}}h+='<embed type="'+mt+'"';for(n in p){if(typeof(p[n])=="function")continue;if(!(n=='url'&&mt=='application/x-mplayer2'))h+=' '+n+'="'+p[n]+'"'}h+='></embed></object>';return h},_parseAttributes:function(attribute_string){var attributeName="";var attributeValue="";var withInName;var withInValue;var attributes=new Array();var whiteSpaceRegExp=new RegExp('^[ \n\r\t]+','g');if(attribute_string==null||attribute_string.length<2)return null;withInName=withInValue=false;for(var i=0;i<attribute_string.length;i++){var chr=attribute_string.charAt(i);if((chr=='"'||chr=="'")&&!withInValue)withInValue=true;else if((chr=='"'||chr=="'")&&withInValue){withInValue=false;var pos=attributeName.lastIndexOf(' ');if(pos!=-1)attributeName=attributeName.substring(pos+1);attributes[attributeName.toLowerCase()]=attributeValue.substring(1);attributeName="";attributeValue=""}else if(!whiteSpaceRegExp.test(chr)&&!withInName&&!withInValue)withInName=true;if(chr=='='&&withInName)withInName=false;if(withInName)attributeName+=chr;if(withInValue)attributeValue+=chr}return attributes}};tinyMCE.addPlugin("media",TinyMCE_MediaPlugin);
\ No newline at end of file
+(function(){var a=tinymce.each;tinymce.create("tinymce.plugins.MediaPlugin",{init:function(b,c){var e=this;e.editor=b;e.url=c;function f(g){return/^(mceItemFlash|mceItemShockWave|mceItemWindowsMedia|mceItemQuickTime|mceItemRealMedia)$/.test(g.className)}b.onPreInit.add(function(){b.serializer.addRules("param[name|value|_mce_value]")});b.addCommand("mceMedia",function(){b.windowManager.open({file:c+"/media.htm",width:430+parseInt(b.getLang("media.delta_width",0)),height:470+parseInt(b.getLang("media.delta_height",0)),inline:1},{plugin_url:c})});b.addButton("media",{title:"media.desc",cmd:"mceMedia"});b.onNodeChange.add(function(h,g,i){g.setActive("media",i.nodeName=="IMG"&&f(i))});b.onInit.add(function(){var g={mceItemFlash:"flash",mceItemShockWave:"shockwave",mceItemWindowsMedia:"windowsmedia",mceItemQuickTime:"quicktime",mceItemRealMedia:"realmedia"};b.selection.onSetContent.add(function(){e._spansToImgs(b.getBody())});b.selection.onBeforeSetContent.add(e._objectsToSpans,e);if(b.settings.content_css!==false){b.dom.loadCSS(c+"/css/content.css")}if(b.theme.onResolveName){b.theme.onResolveName.add(function(h,i){if(i.name=="img"){a(g,function(l,j){if(b.dom.hasClass(i.node,j)){i.name=l;i.title=b.dom.getAttrib(i.node,"title");return false}})}})}if(b&&b.plugins.contextmenu){b.plugins.contextmenu.onContextMenu.add(function(i,h,j){if(j.nodeName=="IMG"&&/mceItem(Flash|ShockWave|WindowsMedia|QuickTime|RealMedia)/.test(j.className)){h.add({title:"media.edit",icon:"media",cmd:"mceMedia"})}})}});b.onBeforeSetContent.add(e._objectsToSpans,e);b.onSetContent.add(function(){e._spansToImgs(b.getBody())});b.onPreProcess.add(function(g,i){var h=g.dom;if(i.set){e._spansToImgs(i.node);a(h.select("IMG",i.node),function(k){var j;if(f(k)){j=e._parse(k.title);h.setAttrib(k,"width",h.getAttrib(k,"width",j.width||100));h.setAttrib(k,"height",h.getAttrib(k,"height",j.height||100))}})}if(i.get){a(h.select("IMG",i.node),function(m){var l,j,k;if(g.getParam("media_use_script")){if(f(m)){m.className=m.className.replace(/mceItem/g,"mceTemp")}return}switch(m.className){case"mceItemFlash":l="d27cdb6e-ae6d-11cf-96b8-444553540000";j="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0";k="application/x-shockwave-flash";break;case"mceItemShockWave":l="166b1bca-3f9c-11cf-8075-444553540000";j="http://download.macromedia.com/pub/shockwave/cabs/director/sw.cab#version=8,5,1,0";k="application/x-director";break;case"mceItemWindowsMedia":l=g.getParam("media_wmp6_compatible")?"05589fa1-c356-11ce-bf01-00aa0055595a":"6bf52a52-394a-11d3-b153-00c04f79faa6";j="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701";k="application/x-mplayer2";break;case"mceItemQuickTime":l="02bf25d5-8c17-4b23-bc80-d3488abddc6b";j="http://www.apple.com/qtactivex/qtplugin.cab#version=6,0,2,0";k="video/quicktime";break;case"mceItemRealMedia":l="cfcdaa03-8be4-11cf-b84b-0020afbbccfa";j="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0";k="audio/x-pn-realaudio-plugin";break}if(l){h.replace(e._buildObj({classid:l,codebase:j,type:k},m),m)}})}});b.onPostProcess.add(function(g,h){h.content=h.content.replace(/_mce_value=/g,"value=")});function d(g,h){h=new RegExp(h+'="([^"]+)"',"g").exec(g);return h?b.dom.decode(h[1]):""}b.onPostProcess.add(function(g,h){if(g.getParam("media_use_script")){h.content=h.content.replace(/<img[^>]+>/g,function(j){var i=d(j,"class");if(/^(mceTempFlash|mceTempShockWave|mceTempWindowsMedia|mceTempQuickTime|mceTempRealMedia)$/.test(i)){at=e._parse(d(j,"title"));at.width=d(j,"width");at.height=d(j,"height");j='<script type="text/javascript">write'+i.substring(7)+"({"+e._serialize(at)+"});<\/script>"}return j})}})},getInfo:function(){return{longname:"Media",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/media",version:tinymce.majorVersion+"."+tinymce.minorVersion}},_objectsToSpans:function(b,e){var c=this,d=e.content;d=d.replace(/<script[^>]*>\s*write(Flash|ShockWave|WindowsMedia|QuickTime|RealMedia)\(\{([^\)]*)\}\);\s*<\/script>/gi,function(g,f,i){var h=c._parse(i);return'<img class="mceItem'+f+'" title="'+b.dom.encode(i)+'" src="'+c.url+'/img/trans.gif" width="'+h.width+'" height="'+h.height+'" />'});d=d.replace(/<object([^>]*)>/gi,'<span class="mceItemObject" $1>');d=d.replace(/<embed([^>]*)\/?>/gi,'<span class="mceItemEmbed" $1></span>');d=d.replace(/<embed([^>]*)>/gi,'<span class="mceItemEmbed" $1>');d=d.replace(/<\/(object)([^>]*)>/gi,"</span>");d=d.replace(/<\/embed>/gi,"");d=d.replace(/<param([^>]*)>/gi,function(g,f){return"<span "+f.replace(/value=/gi,"_mce_value=")+' class="mceItemParam"></span>'});d=d.replace(/\/ class=\"mceItemParam\"><\/span>/gi,'class="mceItemParam"></span>');e.content=d},_buildObj:function(g,h){var d,c=this.editor,f=c.dom,e=this._parse(h.title),b;b=c.getParam("media_strict",true)&&g.type=="application/x-shockwave-flash";e.width=g.width=f.getAttrib(h,"width")||100;e.height=g.height=f.getAttrib(h,"height")||100;if(e.src){e.src=c.convertURL(e.src,"src",h)}if(b){d=f.create("span",{id:e.id,mce_name:"object",type:"application/x-shockwave-flash",data:e.src,style:f.getAttrib(h,"style"),width:g.width,height:g.height})}else{d=f.create("span",{id:e.id,mce_name:"object",classid:"clsid:"+g.classid,style:f.getAttrib(h,"style"),codebase:g.codebase,width:g.width,height:g.height})}a(e,function(j,i){if(!/^(width|height|codebase|classid|id|_cx|_cy)$/.test(i)){if(g.type=="application/x-mplayer2"&&i=="src"&&!e.url){i="url"}if(j){f.add(d,"span",{mce_name:"param",name:i,_mce_value:j})}}});if(!b){f.add(d,"span",tinymce.extend({mce_name:"embed",type:g.type,style:f.getAttrib(h,"style")},e))}return d},_spansToImgs:function(e){var d=this,f=d.editor.dom,b,c;a(f.select("span",e),function(g){if(f.getAttrib(g,"class")=="mceItemObject"){c=f.getAttrib(g,"classid").toLowerCase().replace(/\s+/g,"");switch(c){case"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000":f.replace(d._createImg("mceItemFlash",g),g);break;case"clsid:166b1bca-3f9c-11cf-8075-444553540000":f.replace(d._createImg("mceItemShockWave",g),g);break;case"clsid:6bf52a52-394a-11d3-b153-00c04f79faa6":case"clsid:22d6f312-b0f6-11d0-94ab-0080c74c7e95":case"clsid:05589fa1-c356-11ce-bf01-00aa0055595a":f.replace(d._createImg("mceItemWindowsMedia",g),g);break;case"clsid:02bf25d5-8c17-4b23-bc80-d3488abddc6b":f.replace(d._createImg("mceItemQuickTime",g),g);break;case"clsid:cfcdaa03-8be4-11cf-b84b-0020afbbccfa":f.replace(d._createImg("mceItemRealMedia",g),g);break;default:f.replace(d._createImg("mceItemFlash",g),g)}return}if(f.getAttrib(g,"class")=="mceItemEmbed"){switch(f.getAttrib(g,"type")){case"application/x-shockwave-flash":f.replace(d._createImg("mceItemFlash",g),g);break;case"application/x-director":f.replace(d._createImg("mceItemShockWave",g),g);break;case"application/x-mplayer2":f.replace(d._createImg("mceItemWindowsMedia",g),g);break;case"video/quicktime":f.replace(d._createImg("mceItemQuickTime",g),g);break;case"audio/x-pn-realaudio-plugin":f.replace(d._createImg("mceItemRealMedia",g),g);break;default:f.replace(d._createImg("mceItemFlash",g),g)}}})},_createImg:function(c,h){var b,g=this.editor.dom,f={},e="",d;d=["id","name","width","height","bgcolor","align","flashvars","src","wmode","allowfullscreen","quality"];b=g.create("img",{src:this.url+"/img/trans.gif",width:g.getAttrib(h,"width")||100,height:g.getAttrib(h,"height")||100,style:g.getAttrib(h,"style"),"class":c});a(d,function(i){var j=g.getAttrib(h,i);if(j){f[i]=j}});a(g.select("span",h),function(i){if(g.hasClass(i,"mceItemParam")){f[g.getAttrib(i,"name")]=g.getAttrib(i,"_mce_value")}});if(f.movie){f.src=f.movie;delete f.movie}h=g.select(".mceItemEmbed",h)[0];if(h){a(d,function(i){var j=g.getAttrib(h,i);if(j&&!f[i]){f[i]=j}})}delete f.width;delete f.height;b.title=this._serialize(f);return b},_parse:function(b){return tinymce.util.JSON.parse("{"+b+"}")},_serialize:function(b){return tinymce.util.JSON.serialize(b).replace(/[{}]/g,"")}});tinymce.PluginManager.add("media",tinymce.plugins.MediaPlugin)})();
\ No newline at end of file
diff -x .svn -aruN 0.7.15.src/e107_handlers/tiny_mce/plugins/media/editor_plugin_src.js 0.7.16.src/e107_handlers/tiny_mce/plugins/media/editor_plugin_src.js
--- 0.7.15.src/e107_handlers/tiny_mce/plugins/media/editor_plugin_src.js	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_handlers/tiny_mce/plugins/media/editor_plugin_src.js	2009-06-30 19:36:49.000000000 -0500
@@ -1,168 +1,124 @@
 /**
- * $Id: editor_plugin_src.js,v 1.1 2006/10/27 22:36:57 e107coders Exp $
+ * $Id: editor_plugin_src.js,v 1.2 2009/07/01 00:37:13 e107coders Exp $
  *
  * @author Moxiecode
- * @copyright Copyright  2004-2006, Moxiecode Systems AB, All rights reserved.
+ * @copyright Copyright  2004-2008, Moxiecode Systems AB, All rights reserved.
  */
 
-/* Import plugin specific language pack */
-tinyMCE.importPluginLanguagePack('media');
+(function() {
+	var each = tinymce.each;
 
-var TinyMCE_MediaPlugin = {
-	getInfo : function() {
-		return {
-			longname : 'Media',
-			author : 'Moxiecode Systems AB',
-			authorurl : 'http://tinymce.moxiecode.com',
-			infourl : 'http://tinymce.moxiecode.com/tinymce/docs/plugin_media.html',
-			version : tinyMCE.majorVersion + "." + tinyMCE.minorVersion
-		};
-	},
-
-	initInstance : function(inst) {
-		if (!tinyMCE.settings['media_skip_plugin_css'])
-			tinyMCE.importCSS(inst.getDoc(), tinyMCE.baseURL + "/plugins/media/css/content.css");
-	},
-
-	getControlHTML : function(cn) {
-		switch (cn) {
-			case "media":
-				return tinyMCE.getButtonHTML(cn, 'lang_media_desc', '{$pluginurl}/images/media.gif', 'mceMedia');
-		}
-
-		return "";
-	},
-
-	execCommand : function(editor_id, element, command, user_interface, value) {
-		// Handle commands
-		switch (command) {
-			case "mceMedia":
-				tinyMCE.openWindow({
-						file : '../../plugins/media/media.htm',
-						width : 430 + tinyMCE.getLang('lang_media_delta_width', 0),
-						height : 470 + tinyMCE.getLang('lang_media_delta_height', 0)
-					}, {
-						editor_id : editor_id,
-						inline : "yes"
+	tinymce.create('tinymce.plugins.MediaPlugin', {
+		init : function(ed, url) {
+			var t = this;
+			
+			t.editor = ed;
+			t.url = url;
+
+			function isMediaElm(n) {
+				return /^(mceItemFlash|mceItemShockWave|mceItemWindowsMedia|mceItemQuickTime|mceItemRealMedia)$/.test(n.className);
+			};
+
+			ed.onPreInit.add(function() {
+				// Force in _value parameter this extra parameter is required for older Opera versions
+				ed.serializer.addRules('param[name|value|_mce_value]');
+			});
+
+			// Register commands
+			ed.addCommand('mceMedia', function() {
+				ed.windowManager.open({
+					file : url + '/media.htm',
+					width : 430 + parseInt(ed.getLang('media.delta_width', 0)),
+					height : 470 + parseInt(ed.getLang('media.delta_height', 0)),
+					inline : 1
+				}, {
+					plugin_url : url
 				});
+			});
 
-				return true;
-	   }
+			// Register buttons
+			ed.addButton('media', {title : 'media.desc', cmd : 'mceMedia'});
 
-	   // Pass to next handler in chain
-	   return false;
-	},
-
-	cleanup : function(type, content, inst) {
-		var nl, img, i, ne, d, s, ci;
-
-		switch (type) {
-			case "insert_to_editor":
-				img = tinyMCE.getParam("theme_href") + '/images/spacer.gif';
-				content = content.replace(/<script[^>]*>\s*write(Flash|ShockWave|WindowsMedia|QuickTime|RealMedia)\(\{([^\)]*)\}\);\s*<\/script>/gi, '<img class="mceItem$1" title="$2" src="' + img + '" />');
-				content = content.replace(/<object([^>]*)>/gi, '<div class="mceItemObject" $1>');
-				content = content.replace(/<embed([^>]*)>/gi, '<div class="mceItemObjectEmbed" $1>');
-				content = content.replace(/<\/(object|embed)([^>]*)>/gi, '</div>');
-				content = content.replace(/<param([^>]*)>/gi, '<div $1 class="mceItemParam"></div>');
-				content = content.replace(new RegExp('\\/ class="mceItemParam"><\\/div>', 'gi'), 'class="mceItemParam"></div>');
-				break;
-
-			case "insert_to_editor_dom":
-				d = inst.getDoc();
-				nl = content.getElementsByTagName("img");
-				for (i=0; i<nl.length; i++) {
-					if (/mceItem(Flash|ShockWave|WindowsMedia|QuickTime|RealMedia)/.test(nl[i].className)) {
-						nl[i].width = nl[i].title.replace(/.*width:[^0-9]?([0-9]+)%?.*/g, '$1');
-						nl[i].height = nl[i].title.replace(/.*height:[^0-9]?([0-9]+)%?.*/g, '$1');
-						//nl[i].align = nl[i].title.replace(/.*align:([a-z]+).*/gi, '$1');
-					}
-				}
-
-				nl = tinyMCE.selectElements(content, 'DIV', function (n) {return tinyMCE.hasCSSClass(n, 'mceItemObject');});
-				for (i=0; i<nl.length; i++) {
-					ci = tinyMCE.getAttrib(nl[i], "classid").toLowerCase().replace(/\s+/g, '');
+			ed.onNodeChange.add(function(ed, cm, n) {
+				cm.setActive('media', n.nodeName == 'IMG' && isMediaElm(n));
+			});
+
+			ed.onInit.add(function() {
+				var lo = {
+					mceItemFlash : 'flash',
+					mceItemShockWave : 'shockwave',
+					mceItemWindowsMedia : 'windowsmedia',
+					mceItemQuickTime : 'quicktime',
+					mceItemRealMedia : 'realmedia'
+				};
 
-					switch (ci) {
-						case 'clsid:d27cdb6e-ae6d-11cf-96b8-444553540000':
-							nl[i].parentNode.replaceChild(TinyMCE_MediaPlugin._createImg('mceItemFlash', d, nl[i]), nl[i]);
-							break;
+				ed.selection.onSetContent.add(function() {
+					t._spansToImgs(ed.getBody());
+				});
 
-						case 'clsid:166b1bca-3f9c-11cf-8075-444553540000':
-							nl[i].parentNode.replaceChild(TinyMCE_MediaPlugin._createImg('mceItemShockWave', d, nl[i]), nl[i]);
-							break;
+				ed.selection.onBeforeSetContent.add(t._objectsToSpans, t);
 
-						case 'clsid:6bf52a52-394a-11d3-b153-00c04f79faa6':
-							nl[i].parentNode.replaceChild(TinyMCE_MediaPlugin._createImg('mceItemWindowsMedia', d, nl[i]), nl[i]);
-							break;
+				if (ed.settings.content_css !== false)
+					ed.dom.loadCSS(url + "/css/content.css");
 
-						case 'clsid:02bf25d5-8c17-4b23-bc80-d3488abddc6b':
-							nl[i].parentNode.replaceChild(TinyMCE_MediaPlugin._createImg('mceItemQuickTime', d, nl[i]), nl[i]);
-							break;
+				if (ed.theme.onResolveName) {
+					ed.theme.onResolveName.add(function(th, o) {
+						if (o.name == 'img') {
+							each(lo, function(v, k) {
+								if (ed.dom.hasClass(o.node, k)) {
+									o.name = v;
+									o.title = ed.dom.getAttrib(o.node, 'title');
+									return false;
+								}
+							});
+						}
+					});
+				}
 
-						case 'clsid:cfcdaa03-8be4-11cf-b84b-0020afbbccfa':
-						case 'clsid:22d6f312-b0f6-11d0-94ab-0080c74c7e95':
-						case 'clsid:05589fa1-c356-11ce-bf01-00aa0055595a':
-							nl[i].parentNode.replaceChild(TinyMCE_MediaPlugin._createImg('mceItemRealMedia', d, nl[i]), nl[i]);
-							break;
-					}
+				if (ed && ed.plugins.contextmenu) {
+					ed.plugins.contextmenu.onContextMenu.add(function(th, m, e) {
+						if (e.nodeName == 'IMG' && /mceItem(Flash|ShockWave|WindowsMedia|QuickTime|RealMedia)/.test(e.className)) {
+							m.add({title : 'media.edit', icon : 'media', cmd : 'mceMedia'});
+						}
+					});
 				}
+			});
 
-				// Handle embed (if any)
-				nl = tinyMCE.selectNodes(content, function (n) {return n.className == 'mceItemObjectEmbed';});
-				for (i=0; i<nl.length; i++) {
-					switch (tinyMCE.getAttrib(nl[i], 'type')) {
-						case 'application/x-shockwave-flash':
-							TinyMCE_MediaPlugin._createImgFromEmbed(nl[i], d, 'mceItemFlash');
-							break;
+			ed.onBeforeSetContent.add(t._objectsToSpans, t);
 
-						case 'application/x-director':
-							TinyMCE_MediaPlugin._createImgFromEmbed(nl[i], d, 'mceItemShockWave');
-							break;
+			ed.onSetContent.add(function() {
+				t._spansToImgs(ed.getBody());
+			});
 
-						case 'application/x-mplayer2':
-							TinyMCE_MediaPlugin._createImgFromEmbed(nl[i], d, 'mceItemWindowsMedia');
-							break;
+			ed.onPreProcess.add(function(ed, o) {
+				var dom = ed.dom;
 
-						case 'video/quicktime':
-							TinyMCE_MediaPlugin._createImgFromEmbed(nl[i], d, 'mceItemQuickTime');
-							break;
+				if (o.set) {
+					t._spansToImgs(o.node);
 
-						case 'audio/x-pn-realaudio-plugin':
-							TinyMCE_MediaPlugin._createImgFromEmbed(nl[i], d, 'mceItemRealMedia');
-							break;
-					}
+					each(dom.select('IMG', o.node), function(n) {
+						var p;
+
+						if (isMediaElm(n)) {
+							p = t._parse(n.title);
+							dom.setAttrib(n, 'width', dom.getAttrib(n, 'width', p.width || 100));
+							dom.setAttrib(n, 'height', dom.getAttrib(n, 'height', p.height || 100));
+						}
+					});
 				}
-				break;
 
-			case "get_from_editor":
-				var startPos = -1, endPos, attribs, chunkBefore, chunkAfter, embedHTML, at, pl, cb, mt, ex;
+				if (o.get) {
+					each(dom.select('IMG', o.node), function(n) {
+						var ci, cb, mt;
+
+						if (ed.getParam('media_use_script')) {
+							if (isMediaElm(n))
+								n.className = n.className.replace(/mceItem/g, 'mceTemp');
 
-				while ((startPos = content.indexOf('<img', startPos+1)) != -1) {
-					endPos = content.indexOf('/>', startPos);
-					attribs = TinyMCE_MediaPlugin._parseAttributes(content.substring(startPos + 4, endPos));
-
-					// Is not flash, skip it
-					if (!/mceItem(Flash|ShockWave|WindowsMedia|QuickTime|RealMedia)/.test(attribs['class']))
-						continue;
-
-					endPos += 2;
-
-					// Parse attributes
-					at = attribs['title'];
-					if (at) {
-						at = at.replace(/&#39;/g, "'");
-						at = at.replace(/&#quot;/g, '"');
-
-						try {
-							pl = eval('x={' + at + '};');
-						} catch (ex) {
-							pl = {};
+							return;
 						}
-					}
 
-					// Use object/embed
-					if (!tinyMCE.getParam('media_use_script', false)) {
-						switch (attribs['class']) {
+						switch (n.className) {
 							case 'mceItemFlash':
 								ci = 'd27cdb6e-ae6d-11cf-96b8-444553540000';
 								cb = 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0';
@@ -170,259 +126,280 @@
 								break;
 
 							case 'mceItemShockWave':
-								ci = '166B1BCA-3F9C-11CF-8075-444553540000';
+								ci = '166b1bca-3f9c-11cf-8075-444553540000';
 								cb = 'http://download.macromedia.com/pub/shockwave/cabs/director/sw.cab#version=8,5,1,0';
 								mt = 'application/x-director';
 								break;
 
 							case 'mceItemWindowsMedia':
-								ci = tinyMCE.getParam('media_wmp6_compatible') ? '05589FA1-C356-11CE-BF01-00AA0055595A' : '6BF52A52-394A-11D3-B153-00C04F79FAA6';
+								ci = ed.getParam('media_wmp6_compatible') ? '05589fa1-c356-11ce-bf01-00aa0055595a' : '6bf52a52-394a-11d3-b153-00c04f79faa6';
 								cb = 'http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701';
 								mt = 'application/x-mplayer2';
 								break;
 
 							case 'mceItemQuickTime':
-								ci = '02BF25D5-8C17-4B23-BC80-D3488ABDDC6B';
+								ci = '02bf25d5-8c17-4b23-bc80-d3488abddc6b';
 								cb = 'http://www.apple.com/qtactivex/qtplugin.cab#version=6,0,2,0';
 								mt = 'video/quicktime';
 								break;
 
 							case 'mceItemRealMedia':
-								ci = 'CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA';
+								ci = 'cfcdaa03-8be4-11cf-b84b-0020afbbccfa';
 								cb = 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0';
 								mt = 'audio/x-pn-realaudio-plugin';
 								break;
 						}
 
-						// Force absolute URL
-						if (!tinyMCE.getParam("relative_urls"))
-							pl.src = tinyMCE.convertRelativeToAbsoluteURL(tinyMCE.settings['base_href'], pl.src);
-
-						embedHTML = TinyMCE_MediaPlugin._getEmbed(ci, cb, mt, pl, attribs);
-					} else {
-						// Use script version
-						switch (attribs['class']) {
-							case 'mceItemFlash':
-								s = 'writeFlash';
-								break;
-
-							case 'mceItemShockWave':
-								s = 'writeShockWave';
-								break;
-
-							case 'mceItemWindowsMedia':
-								s = 'writeWindowsMedia';
-								break;
-
-							case 'mceItemQuickTime':
-								s = 'writeQuickTime';
-								break;
-
-							case 'mceItemRealMedia':
-								s = 'writeRealMedia';
-								break;
+						if (ci) {
+							dom.replace(t._buildObj({
+								classid : ci,
+								codebase : cb,
+								type : mt
+							}, n), n);
 						}
+					});
+				}
+			});
 
-						if (attribs.width)
-							at = at.replace(/width:[^0-9]?[0-9]+%?[^0-9]?/g, "width:'" + attribs.width + "'");
-
-						if (attribs.height)
-							at = at.replace(/height:[^0-9]?[0-9]+%?[^0-9]?/g, "height:'" + attribs.height + "'");
-
-						// Force absolute URL
-						if (!tinyMCE.getParam("relative_urls")) {
-							pl.src = tinyMCE.convertRelativeToAbsoluteURL(tinyMCE.settings['base_href'], pl.src);
-							at = at.replace(new RegExp("src:'[^']*'", "g"), "src:'" + pl.src + "'");
+			ed.onPostProcess.add(function(ed, o) {
+				o.content = o.content.replace(/_mce_value=/g, 'value=');
+			});
+
+			function getAttr(s, n) {
+				n = new RegExp(n + '=\"([^\"]+)\"', 'g').exec(s);
+
+				return n ? ed.dom.decode(n[1]) : '';
+			};
+
+			ed.onPostProcess.add(function(ed, o) {
+				if (ed.getParam('media_use_script')) {
+					o.content = o.content.replace(/<img[^>]+>/g, function(im) {
+						var cl = getAttr(im, 'class');
+
+						if (/^(mceTempFlash|mceTempShockWave|mceTempWindowsMedia|mceTempQuickTime|mceTempRealMedia)$/.test(cl)) {
+							at = t._parse(getAttr(im, 'title'));
+							at.width = getAttr(im, 'width');
+							at.height = getAttr(im, 'height');
+							im = '<script type="text/javascript">write' + cl.substring(7) + '({' + t._serialize(at) + '});</script>';
 						}
 
-						embedHTML = '<script type="text/javascript">' + s + '({' + at + '});</script>';
-					}
-
-					// Insert embed/object chunk
-					chunkBefore = content.substring(0, startPos);
-					chunkAfter = content.substring(endPos);
-					content = chunkBefore + embedHTML + chunkAfter;
+						return im;
+					});
 				}
-				break;
-		}
-
-		return content;
-	},
+			});
+		},
 
-	handleNodeChange : function(editor_id, node, undo_index, undo_levels, visual_aid, any_selection) {
-		if (node == null)
-			return;
-
-		do {
-			if (node.nodeName == "IMG" && /mceItem(Flash|ShockWave|WindowsMedia|QuickTime|RealMedia)/.test(tinyMCE.getAttrib(node, 'class'))) {
-				tinyMCE.switchClass(editor_id + '_media', 'mceButtonSelected');
-				return true;
+		getInfo : function() {
+			return {
+				longname : 'Media',
+				author : 'Moxiecode Systems AB',
+				authorurl : 'http://tinymce.moxiecode.com',
+				infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/media',
+				version : tinymce.majorVersion + "." + tinymce.minorVersion
+			};
+		},
+
+		// Private methods
+		_objectsToSpans : function(ed, o) {
+			var t = this, h = o.content;
+
+			h = h.replace(/<script[^>]*>\s*write(Flash|ShockWave|WindowsMedia|QuickTime|RealMedia)\(\{([^\)]*)\}\);\s*<\/script>/gi, function(a, b, c) {
+				var o = t._parse(c);
+
+				return '<img class="mceItem' + b + '" title="' + ed.dom.encode(c) + '" src="' + t.url + '/img/trans.gif" width="' + o.width + '" height="' + o.height + '" />'
+			});
+
+			h = h.replace(/<object([^>]*)>/gi, '<span class="mceItemObject" $1>');
+			h = h.replace(/<embed([^>]*)\/?>/gi, '<span class="mceItemEmbed" $1></span>');
+			h = h.replace(/<embed([^>]*)>/gi, '<span class="mceItemEmbed" $1>');
+			h = h.replace(/<\/(object)([^>]*)>/gi, '</span>');
+			h = h.replace(/<\/embed>/gi, '');
+			h = h.replace(/<param([^>]*)>/gi, function(a, b) {return '<span ' + b.replace(/value=/gi, '_mce_value=') + ' class="mceItemParam"></span>'});
+			h = h.replace(/\/ class=\"mceItemParam\"><\/span>/gi, 'class="mceItemParam"></span>');
+
+			o.content = h;
+		},
+
+		_buildObj : function(o, n) {
+			var ob, ed = this.editor, dom = ed.dom, p = this._parse(n.title), stc;
+			
+			stc = ed.getParam('media_strict', true) && o.type == 'application/x-shockwave-flash';
+
+			p.width = o.width = dom.getAttrib(n, 'width') || 100;
+			p.height = o.height = dom.getAttrib(n, 'height') || 100;
+
+			if (p.src)
+				p.src = ed.convertURL(p.src, 'src', n);
+
+			if (stc) {
+				ob = dom.create('span', {
+					id : p.id,
+					mce_name : 'object',
+					type : 'application/x-shockwave-flash',
+					data : p.src,
+					style : dom.getAttrib(n, 'style'),
+					width : o.width,
+					height : o.height
+				});
+			} else {
+				ob = dom.create('span', {
+					id : p.id,
+					mce_name : 'object',
+					classid : "clsid:" + o.classid,
+					style : dom.getAttrib(n, 'style'),
+					codebase : o.codebase,
+					width : o.width,
+					height : o.height
+				});
 			}
-		} while ((node = node.parentNode));
 
-		tinyMCE.switchClass(editor_id + '_media', 'mceButtonNormal');
+			each (p, function(v, k) {
+				if (!/^(width|height|codebase|classid|id|_cx|_cy)$/.test(k)) {
+					// Use url instead of src in IE for Windows media
+					if (o.type == 'application/x-mplayer2' && k == 'src' && !p.url)
+						k = 'url';
 
-		return true;
-	},
+					if (v)
+						dom.add(ob, 'span', {mce_name : 'param', name : k, '_mce_value' : v});
+				}
+			});
 
-	_createImgFromEmbed : function(n, d, cl) {
-		var ne, at, i, ti = '', an;
+			if (!stc)
+				dom.add(ob, 'span', tinymce.extend({mce_name : 'embed', type : o.type, style : dom.getAttrib(n, 'style')}, p));
 
-		ne = d.createElement('img');
-		ne.src = tinyMCE.getParam("theme_href") + '/images/spacer.gif';
-		ne.width = tinyMCE.getAttrib(n, 'width');
-		ne.height = tinyMCE.getAttrib(n, 'height');
-		ne.className = cl;
+			return ob;
+		},
 
-		at = n.attributes;
-		for (i=0; i<at.length; i++) {
-			if (at[i].specified && at[i].nodeValue) {
-				an = at[i].nodeName.toLowerCase();
+		_spansToImgs : function(p) {
+			var t = this, dom = t.editor.dom, im, ci;
 
-				if (an == 'src')
-					continue;
+			each(dom.select('span', p), function(n) {
+				// Convert object into image
+				if (dom.getAttrib(n, 'class') == 'mceItemObject') {
+					ci = dom.getAttrib(n, "classid").toLowerCase().replace(/\s+/g, '');
 
-				if (an == 'mce_src')
-					an = 'src';
+					switch (ci) {
+						case 'clsid:d27cdb6e-ae6d-11cf-96b8-444553540000':
+							dom.replace(t._createImg('mceItemFlash', n), n);
+							break;
 
-				if (an.indexOf('mce_') == -1 && !new RegExp('^(class|type)$').test(an))
-					ti += an.toLowerCase() + ':\'' + at[i].nodeValue + "',";
-			}
-		}
+						case 'clsid:166b1bca-3f9c-11cf-8075-444553540000':
+							dom.replace(t._createImg('mceItemShockWave', n), n);
+							break;
 
-		ti = ti.length > 0 ? ti.substring(0, ti.length - 1) : ti;
-		ne.title = ti;
+						case 'clsid:6bf52a52-394a-11d3-b153-00c04f79faa6':
+						case 'clsid:22d6f312-b0f6-11d0-94ab-0080c74c7e95':
+						case 'clsid:05589fa1-c356-11ce-bf01-00aa0055595a':
+							dom.replace(t._createImg('mceItemWindowsMedia', n), n);
+							break;
 
-		n.parentNode.replaceChild(ne, n);
-	},
+						case 'clsid:02bf25d5-8c17-4b23-bc80-d3488abddc6b':
+							dom.replace(t._createImg('mceItemQuickTime', n), n);
+							break;
 
-	_createImg : function(cl, d, n) {
-		var i, nl, ti = "", an, av, al = new Array();
+						case 'clsid:cfcdaa03-8be4-11cf-b84b-0020afbbccfa':
+							dom.replace(t._createImg('mceItemRealMedia', n), n);
+							break;
 
-		ne = d.createElement('img');
-		ne.src = tinyMCE.getParam("theme_href") + '/images/spacer.gif';
-		ne.width = tinyMCE.getAttrib(n, 'width');
-		ne.height = tinyMCE.getAttrib(n, 'height');
-		ne.className = cl;
-
-		al.id = tinyMCE.getAttrib(n, 'id');
-		al.name = tinyMCE.getAttrib(n, 'name');
-		al.width = tinyMCE.getAttrib(n, 'width');
-		al.height = tinyMCE.getAttrib(n, 'height');
-		al.bgcolor = tinyMCE.getAttrib(n, 'bgcolor');
-		al.align = tinyMCE.getAttrib(n, 'align');
-		al.class_name = tinyMCE.getAttrib(n, 'mce_class');
-
-		nl = n.getElementsByTagName('div');
-		for (i=0; i<nl.length; i++) {
-			av = tinyMCE.getAttrib(nl[i], 'value');
-			av = av.replace(new RegExp('\\\\', 'g'), '\\\\');
-			av = av.replace(new RegExp('"', 'g'), '\\"');
-			av = av.replace(new RegExp("'", 'g'), "\\'");
-			an = tinyMCE.getAttrib(nl[i], 'name');
-			al[an] = av;
-		}
+						default:
+							dom.replace(t._createImg('mceItemFlash', n), n);
+					}
+					
+					return;
+				}
 
-		if (al.movie) {
-			al.src = al.movie;
-			al.movie = null;
-		}
+				// Convert embed into image
+				if (dom.getAttrib(n, 'class') == 'mceItemEmbed') {
+					switch (dom.getAttrib(n, 'type')) {
+						case 'application/x-shockwave-flash':
+							dom.replace(t._createImg('mceItemFlash', n), n);
+							break;
 
-		for (an in al) {
-			if (al[an] != null && typeof(al[an]) != "function" && al[an] != '')
-				ti += an.toLowerCase() + ':\'' + al[an] + "',";
-		}
+						case 'application/x-director':
+							dom.replace(t._createImg('mceItemShockWave', n), n);
+							break;
 
-		ti = ti.length > 0 ? ti.substring(0, ti.length - 1) : ti;
-		ne.title = ti;
+						case 'application/x-mplayer2':
+							dom.replace(t._createImg('mceItemWindowsMedia', n), n);
+							break;
 
-		return ne;
-	},
+						case 'video/quicktime':
+							dom.replace(t._createImg('mceItemQuickTime', n), n);
+							break;
 
-	_getEmbed : function(cls, cb, mt, p, at) {
-		var h = '', n;
+						case 'audio/x-pn-realaudio-plugin':
+							dom.replace(t._createImg('mceItemRealMedia', n), n);
+							break;
 
-		p.width = at.width ? at.width : p.width;
-		p.height = at.height ? at.height : p.height;
-
-		h += '<object classid="clsid:' + cls + '" codebase="' + cb + '"';
-		h += typeof(p.id) != "undefined" ? ' id="' + p.id + '"' : '';
-		h += typeof(p.name) != "undefined" ? ' name="' + p.name + '"' : '';
-		h += typeof(p.width) != "undefined" ? ' width="' + p.width + '"' : '';
-		h += typeof(p.height) != "undefined" ? ' height="' + p.height + '"' : '';
-		h += typeof(p.align) != "undefined" ? ' align="' + p.align + '"' : '';
-		h += '>';
-
-		for (n in p) {
-			if (p[n] && typeof(p[n]) != "function") {
-				h += '<param name="' + n + '" value="' + p[n] + '" />';
-
-				// Add extra url parameter if it's an absolute URL on WMP
-				if (n == 'src' && p[n].indexOf('://') != -1 && mt == 'application/x-mplayer2')
-					h += '<param name="url" value="' + p[n] + '" />';
+						default:
+							dom.replace(t._createImg('mceItemFlash', n), n);
+					}
+				}			
+			});
+		},
+
+		_createImg : function(cl, n) {
+			var im, dom = this.editor.dom, pa = {}, ti = '', args;
+
+			args = ['id', 'name', 'width', 'height', 'bgcolor', 'align', 'flashvars', 'src', 'wmode', 'allowfullscreen', 'quality'];	
+
+			// Create image
+			im = dom.create('img', {
+				src : this.url + '/img/trans.gif',
+				width : dom.getAttrib(n, 'width') || 100,
+				height : dom.getAttrib(n, 'height') || 100,
+				style : dom.getAttrib(n, 'style'),
+				'class' : cl
+			});
+
+			// Setup base parameters
+			each(args, function(na) {
+				var v = dom.getAttrib(n, na);
+
+				if (v)
+					pa[na] = v;
+			});
+
+			// Add optional parameters
+			each(dom.select('span', n), function(n) {
+				if (dom.hasClass(n, 'mceItemParam'))
+					pa[dom.getAttrib(n, 'name')] = dom.getAttrib(n, '_mce_value');
+			});
+
+			// Use src not movie
+			if (pa.movie) {
+				pa.src = pa.movie;
+				delete pa.movie;
 			}
-		}
-
-		h += '<embed type="' + mt + '"';
-
-		for (n in p) {
-			if (typeof(p[n]) == "function")
-				continue;
-
-			// Skip url parameter for embed tag on WMP
-			if (!(n == 'url' && mt == 'application/x-mplayer2'))
-				h += ' ' + n + '="' + p[n] + '"';
-		}
-
-		h += '></embed></object>';
-
-		return h;
-	},
-
-	_parseAttributes : function(attribute_string) {
-		var attributeName = "";
-		var attributeValue = "";
-		var withInName;
-		var withInValue;
-		var attributes = new Array();
-		var whiteSpaceRegExp = new RegExp('^[ \n\r\t]+', 'g');
 
-		if (attribute_string == null || attribute_string.length < 2)
-			return null;
+			// Merge with embed args
+			n = dom.select('.mceItemEmbed', n)[0];
+			if (n) {
+				each(args, function(na) {
+					var v = dom.getAttrib(n, na);
 
-		withInName = withInValue = false;
-
-		for (var i=0; i<attribute_string.length; i++) {
-			var chr = attribute_string.charAt(i);
-
-			if ((chr == '"' || chr == "'") && !withInValue)
-				withInValue = true;
-			else if ((chr == '"' || chr == "'") && withInValue) {
-				withInValue = false;
-
-				var pos = attributeName.lastIndexOf(' ');
-				if (pos != -1)
-					attributeName = attributeName.substring(pos+1);
+					if (v && !pa[na])
+						pa[na] = v;
+				});
+			}
 
-				attributes[attributeName.toLowerCase()] = attributeValue.substring(1);
+			delete pa.width;
+			delete pa.height;
 
-				attributeName = "";
-				attributeValue = "";
-			} else if (!whiteSpaceRegExp.test(chr) && !withInName && !withInValue)
-				withInName = true;
+			im.title = this._serialize(pa);
 
-			if (chr == '=' && withInName)
-				withInName = false;
+			return im;
+		},
 
-			if (withInName)
-				attributeName += chr;
+		_parse : function(s) {
+			return tinymce.util.JSON.parse('{' + s + '}');
+		},
 
-			if (withInValue)
-				attributeValue += chr;
+		_serialize : function(o) {
+			return tinymce.util.JSON.serialize(o).replace(/[{}]/g, '');
 		}
+	});
 
-		return attributes;
-	}
-};
-
-tinyMCE.addPlugin("media", TinyMCE_MediaPlugin);
+	// Register plugin
+	tinymce.PluginManager.add('media', tinymce.plugins.MediaPlugin);
+})();
\ No newline at end of file
diff -x .svn -aruN 0.7.15.src/e107_handlers/tiny_mce/plugins/media/img/flash.gif 0.7.16.src/e107_handlers/tiny_mce/plugins/media/img/flash.gif
--- 0.7.15.src/e107_handlers/tiny_mce/plugins/media/img/flash.gif	1969-12-31 18:00:00.000000000 -0600
+++ 0.7.16.src/e107_handlers/tiny_mce/plugins/media/img/flash.gif	2009-07-08 05:04:39.000000000 -0500
@@ -0,0 +1,4 @@
+GIF89a  	 (JnVjz\䂏8Zj}   !   ,       I8?Bh4NQ0ZaEǼԄ  0B@H$
+p0әpHÌ r\  ڙ^5Us
Nam4CQva*-
s
+U
+ 
%a
9.MO8)H ;
\ No newline at end of file
diff -x .svn -aruN 0.7.15.src/e107_handlers/tiny_mce/plugins/media/img/flv_player.swf 0.7.16.src/e107_handlers/tiny_mce/plugins/media/img/flv_player.swf
--- 0.7.15.src/e107_handlers/tiny_mce/plugins/media/img/flv_player.swf	1969-12-31 18:00:00.000000000 -0600
+++ 0.7.16.src/e107_handlers/tiny_mce/plugins/media/img/flv_player.swf	2009-07-08 05:04:39.000000000 -0500
@@ -0,0 +1,46 @@
+CWSa  x|	\S$pr/EO΀  ѐEUEzZj[jjjkov?xowfvvfvf`KsBj)@=%hjjJe
6(
+UH|F5PT!
(5y$DxLB[
+4SH
+e>aJ PBIB.&䫴>$)sIC=؇ޓ!g}o^ӣzT
G)!;tQTPPƏ-Z>C=>A×迨֡幻GJ?쑱"Ӫھ{SVes¶ŋe^cKqy?	5~E^LhQD5޿ˬ<+O߅i8jοMN6,?D~#5d([T;nJ	=DAqfy 9	^)jrp@/oɰ&6ٸT+Tɠj؎A:;0)Yp<\<0B
k*ۥO2FD G0cۥB_HXޕA!A$B,D`(it
+Z[J~ЬَW+
EH.,225S*H+*QZTi	(_֠RBoư(EYԐZf0贤h07JQPBcե<
dXQkU(L"J02JP΀M WҖ 22>>U0BS~4H]{>Coұ~PeH`P
+
R0#,ẠP~O(ӱ¥X4'ҫ*%' <ScJezA
E*BqȠ0 9Rtq(**.*3y"u\!GjJ(+jCNDcK{)4<E8T֨r&PE,]R3>vI)zbҨ |:6K>K'iU*"
+ oPFQjЁ:S(eĚ_4egVm }3L+Yc@Q1`|e%^b{:
+nn|r06m>tZ*("DHa0(hO
+
+Tz@*y#[aI {+
+4VQ(׫Kq Du?aZ YP4mO~*,Jl 76F1FG✔Jbcj$HA@TUU?L@#NX
D
tUZFU(JB@EA=;Fuѱ[TNTKgPdfFir̅JT1(oo(Y+,UU"uŝQ~YAW	R
خ5~ZZTb-.a0 )0L@-QjthEѮ54!Ƞ*uQoH8Q&2V_*(?@o=Д)@cVAgT
+-F2iG)P%3<c3嬫nDcȁQƔ(nPεW8 HHtz0 (U:l &}WZDŊq*8Ȉ	)0ZU>j3*$ӫ2ʊ
+.2ء,+"QPyN:uh
αZ QiqqªVBgV\:g~c6^0He<_b-n>QBj`^?!8sjRBjvؖ*..	AxFzP22p5
+
nټ3o,V/6~J hD%v~ +
+B H)a+rZZ xXXM!pe I 9'#	@C12;d^
+#$e.H"#	Iyqv&e/\)@=	I"D|HlLZ$7|IԑCDI٦L<4Tˎe'q!5\
сmvV_t/sB7,21")!ǽ	2Me-h]+""<E.
!x7D#dsy<d~ZO%=6oq+|lږM_u5 dXMD4P'd쟤UiL :0PONrR_  |m@(-$@(b0Xki!. )U Q0ܧ¾(Ncz! *56P.	WrmLm$]j
].j;"=,G,!SY{B	x_JI-ZbMjᐝ~ZZT,eИU9_u\c@s5(Wÿm
+9H&*.se,@,/}7	D䐎oXhvoϗ:v]'עHl$Z1A
+v{\ҁSKF*c۾5!KC,Yg<M_ _A |M5NrN$"jlXD("B	vEt`lYDE[[Dm
+
+-F;r2(*F@ -"1<dQ40_0/ð٨'a&`#dY6kTvX*LW*e0UDhFW~"~"xu1w&BvD$ w&]Qr ͇"1R\'N:;/|bg=X,V?5KbhcbGy%6ndN#(v&JٙU\ԪVЗe$ߗN^}wH҃qRitɎS(BfPwI<AZ)#0!HhM3&I$M*WZ%#-# ~hŲe24^SGBMVNYJ镍38OH&%}3MMzC ;7Ӟ2qBL8VPuH MO)K?$K_.$ <unrTup#?Qd|SS D]Nb$b؁b
+$Ϭrpx^kPZF947O'3Rn8Ǭ ѝс7jQ!Sv:`wan-Vx	VY<-y($n"cƅJJ!B3I耝)q,Ԩ5-fRGdK6uѼ:5O[UT53rb}3(Fu6yK-ػ kV]&(`3厲hl#m l.H򺩵e*u<*0?Ώ+iJYg"r>`7tycMǶ@m< W}9!FPMc46-dZa_<aZ7Yѳ#T0'<[ӏB,ZX';2I5e0DU:1 k|97L%jc!gociأ6l|`1wcۃp4ޒ5 SN8F9߃ <sC;tQk,ZࣥPa
+D mΊ\V%X4Qu0Μ$R+Px#4YfV6r1D,K$WM3-%l%R7!T|+Mmٙqm,*CB|B~CnFNpu!"!oeq@ad
,S",ق 79'->j'n3 ds((LIw%㥙ԟ0@;A
I9|SiEpY4W0QBr["7a%HH1B4+ΈY:2dytw;@E<S\Z0&$9z\X9ɷd\_RI3&*y%#BjjEF\NBu+"=>x:1پ}@q6c4
+8Tm}2"<<$rod/Y_">l+
snAQ>>DdDwVD?"_N/|hKqH c)7aV$>#}?5y8NfDXD`Vj&T#nad!aoWP.,,K: d;dnv.H]XL=eSmk/+5LԌxC;+/֝0
D_[8qZ81=5a4VihwDHz"OA)XBbm
9a'>x[yZ+umH&Ҩ/)Lދ:бZM?1<;.CrOYt2ӓ>G#2\e!DjN`5[V'(XefZ4eSWji\kS
+p
+ti$D
_;8 m(q|Nvc&x#\LV mZHݖ3,
+<?2
)/Bq
+M8-s"ZSE{wGʪ!	R OL oځ}y'$Z|1E kG_ Hvʩ_E[(H}.7.qEir>(WS^.9ܡ2fOQ!I`R-h&nRZ;4Wk3Auo7czW0	'Li<ZV\nDK
+	!:
+?xT%;rY%>$B$MeNצɠ=tF$6f5kTBҥGmMmDdB Q[۬FīY!fRj6M&`#\	隓	Cvt*|EDPM'ɗ=Po)ePҜ/ΉM$j%dGEl@G` i\
xl}k6ペJFe	9<Iث,`1[lߌE74J-@LmeNė94BCU%Jyȼ6Yk8cDUCk\`첀U|q+ʴlv`u⯎@h$̓V=r7չۦ2^7w_[!6En"aE.'Di5-ӕ{&n&ErLI<1Qe%
t%?y:
dWǗ>@ǥ3i
;7e#0femw\7g>FlX<b:73[ KCD"#NPGr K_w#Y3<j@h&7S+mvhh\D1ƿٙ/%K[HLF|I
Y`fw0$ 85ag>&o| UH_!aQ)/+{:5[6<PpviLtS5'Ĵ\  [\;xI.?%
G tӞd?ڇ=瑰V`|T̅⁹WR\ؓBVԒԒYj`qVc
+x2:vK3BB
+zCLKՖx.Hrdg2i4tZda8Ma}9gd̉OdIγ{3f_h^0t`Sqq\"Xk&.dq/[ee?~n!tV|HS?`t$|U/'Z6WXp5c߰`ʂ>zζ^DaLCb$s'L[8^`o*pqi\!!jvߡE35^R=59ྋ"^
+n"İ$1S*좽!hɛVUev}}=rwր?IoF	(n<p'JjѬ΅>rU<qIfOZfA?TB2FR74z:&/Wlp)}U
lό7>_:
˳jNV	\t|ɪK:מ+wꮮbu0Og9rJ$}%W5-p܅T8mf4 tDW17_id3Ƣ¦5]\]uQ>kWYwhvRؑK]B {{F5c$SX}pn9E%\\r{nN9
6ɢu$c\.a?y5]l<$35Ҩaӂ8=8qgmD#dO*1	wY9~5@ #eHAQכkF8} [cQYKHɒ&<?U`30]GO_Hcg*жmNޜlqC#;dDdlG8θvu{\%L;6ŻKՊ!ߤYU9ߺΥJ3&':hns]Z<xc9\>Mg@cZB>kwPq B)mAScN"a;K`+dO|eT~,`3ݾ
+
+
ge	?iC6@nPs^UT,$nN]+B{mn@	R-MÍJlBL@L0Y4i*.<Wh2& l˹@+#. 's=	Aghq}nCbnϨzJȺ١5od	@b8nna&]9LwЖ  B$G1\L%@,)5:pe?
+gFN/	yú6dn	d`XEĪ	"+"׃r )-`b
w@JB{plhRC /vA+Ĕ~z
+UZZ?QUDnNINw(lLDy@'oĔ0CqN
+<0[	͟Q?4|^bTMƏx
BP$%ŠXuEPwfq)Ʉ/cKdN`*8vl~[5g]kgfۆmJpCBKECJ0s&6Efw	(=xُncGD_ݞ%;t d.R~ߋdMm6eN2ϒG˪S/qDnOl#fL tQhV֢as:wI^ {[yGݽ3s#GGV)2  ` 0DzkGl ?wo)?(FhB@۠'-2д
+GKy4!4z
+ FbƗo	 çVfa`\?G\l0;<p☍j$9YK"|ٽiǂ^Cw>ܮrww#A0lN.q0LNkw=VŮNPs1d!,4rb>z1C1L#wPweXJD$;8
+	0;wH%*.m[x",[6խ6%㾌.ʹf>9''N{9lO}gYw]O6'V[3׺ʼ^
]_YkFFM5#{O*.NPt}-r6c{_~<4Y\RTD_MCkq	[[̅9g~<xB<-,bEnKK4T7q~?uSP<ZtnjQM~v9>vz~"犤;o"@ޠ+]op"꽶ፄQ{
+v2ySڝin>]mSz|?	>~own5=須VPHW礤)W(<^޶^,
^)?_=eOWZy5˥߿zUoZvw{%MGw҃KoG;
g¦W=+䚝~[ώkl^9u|Q[QcRVgSV?,C[Ӻ!nG9>i?tZ25W<kfX=|>߻ρ·.KSK+ccOUXPW6sꮑ&]y;OK{XlwxɃwGflc6qBỮsyCcؑ+?y.ԨsC.!k/dйYg
+]ffjp׏7?&D"ܽq|+iN٭lnދUuOg(c6=pf_π}kԭx%]/W3		I=-r^BѰ=;< uI5R~vLWɹNwxV_k=2|ِ;w<~7.U)Vʛ+&NN[7hkNdCo
<y@ũc<x.w\Sٮ\i[gvn:sc租uQE1d/[}}ۯ"_j&fަ49'0}^H3C,d A4xA^
m
nQ){WN(l[FN&:zƐo>9ÉCZwҸ_ȟ\l7|0j×Nd!oGݴ}y;ܚ:s{#NOoV$>&gːSxqpț{y留'ľ_1v)uG`g݉{ϡU].ȍ1qF꥞%k\n޻W~I#9~~SuMaњXg8V^Լ}cc[Ԙ0'wGFnx¸={L~÷.3{7HPgE§ILWݿ+yyٛroonK?.pOq+;n1ו%ΏJ%Ÿt96緝㤮>YY`ەR]^Qk_^w*tUmO
q{ޥ?nzXz9s5p5c*8"p8b-XFGesAVŚ}s-]ZwֿtKtǠeuukJg-|KϽ	{oJLslcw:(,oh=Od'O'ްU믟ͨ>#n;uvb0<ysbGnr֣=c>˫٩Q_1~1[fV#!T5~Y~]xڔ'φ|t蓛n虻}fVNh$^_hg}ͱ7&]<)Go-Yjʸ#~#cWh?>gT;?z>om/ԍܔrxm燷%hy[k|MgVnT%2ڧႺ=WM יV_?8Wr^|/jt*kv׆fhԜGʏv4vFh$_b$tt&3xk= 
rX3!iAkQ4NՁiA+|k%"! 1o/-W֋1\z2+VŁʙr8$- Ä`Wxr/;e[@ GOS־~=ۓ{4z9,]lPrYl7y}n
a+Uf:LW2dAHΤHOwP.ш"ey׶V:|Vݩaƭ욲dk[W]F5`\t5`GtwqL1DbtC{xvi\E14xdLtafˠxBL]˴B+"#*˼h5H}<ǲ#I=շ %7<BTGb:
+"Oeī9!D! C/~!3U/Nmlص.BWR-7bTtg_
+I)%~~#go ޥIã# lIMˉA}}}0m&;kPW}߄r*HWd(RhQlAtzUq$22T0zfPTL\L4ĥgLqqkУ3B=,'/7ɩwvZ2Qrrьݧg8"F=;c·~ZWTp+V_[m*UL߫+j|_ūj??,r=s]fs_ppBԵיӶt{uiƃΝ/Դ,{kv,ߏy|[ɮ#6$#@
uOc˫e}TYnV7i2]ϭqmC{t8o&⯁]/<+ȽὖZBd. <~GA]ˣwJV)+c@~SҞ_|vG/xst"tw3R={}|×}~ve^~uގ?&>gvN1|ϻGnyB<4)~[\|gӓTWW7/'է}}}c*ޞ57Bn%N{pvo}ĉr̷:ooZ{r\I8l}㌇n]sĂG?,G	}dMЍ\W[/ F\1Ž$%pC2V?3|K"#$7ؒD{;(~SQ{[1(^UA@5u@G|P̠FSh^H@^_mtf_Y\gz)0"
$.r/qDЧv-DzD{H.Bw2p>ڵkESSq\ze%e9g
+xnBCL:ݹA],FϹk# DkVB8mb#<S	-^
+! uI3t׸D$ElP܀Et3=]g/;SvJ.H0x.fnՖ#
\ No newline at end of file
diff -x .svn -aruN 0.7.15.src/e107_handlers/tiny_mce/plugins/media/img/quicktime.gif 0.7.16.src/e107_handlers/tiny_mce/plugins/media/img/quicktime.gif
--- 0.7.15.src/e107_handlers/tiny_mce/plugins/media/img/quicktime.gif	1969-12-31 18:00:00.000000000 -0600
+++ 0.7.16.src/e107_handlers/tiny_mce/plugins/media/img/quicktime.gif	2009-07-08 05:04:39.000000000 -0500
@@ -0,0 +1,3 @@
+GIF89a   7M6nX
brt|)t!   ,       'Ga1_g<[m\ E`,
2  2!@ 4C Y(>iLD8ntYuD#uxz"#7S	,V
+".
+;*? 5;"
 <_
 		,\"	! ;
\ No newline at end of file
diff -x .svn -aruN 0.7.15.src/e107_handlers/tiny_mce/plugins/media/img/realmedia.gif 0.7.16.src/e107_handlers/tiny_mce/plugins/media/img/realmedia.gif
--- 0.7.15.src/e107_handlers/tiny_mce/plugins/media/img/realmedia.gif	1969-12-31 18:00:00.000000000 -0600
+++ 0.7.16.src/e107_handlers/tiny_mce/plugins/media/img/realmedia.gif	2009-07-08 05:04:39.000000000 -0500
@@ -0,0 +1,5 @@
+GIF89a%   RPM @kű@=;.+)c5xHVusq}$pX
 Jfff   !   ,    %   '<Cp,DA{N
lC;h&P8c#e
+
h\gPx"0X:J8 	*14H_$f pf 
;1 u
nC "  p
ɑhT#Vt΍"j
+Ӄ{"ɏ[k&Pɰ
*0-@`!
+9`Ⱥ )V@ 4p! F֍`
+$xCA@7PHQ#=5KP4* ;
\ No newline at end of file
diff -x .svn -aruN 0.7.15.src/e107_handlers/tiny_mce/plugins/media/img/shockwave.gif 0.7.16.src/e107_handlers/tiny_mce/plugins/media/img/shockwave.gif
--- 0.7.15.src/e107_handlers/tiny_mce/plugins/media/img/shockwave.gif	1969-12-31 18:00:00.000000000 -0600
+++ 0.7.16.src/e107_handlers/tiny_mce/plugins/media/img/shockwave.gif	2009-07-08 05:04:39.000000000 -0500
@@ -0,0 +1,2 @@
+GIF89a       2 -Ŝ՟lf wh|Ŝӽ;Ģ̵Y f  $$33..77ll~~꟟                                                            !  + ,       *H#!H:FI]
+i2ՠH:Ωkd:DE`:&i^E$#(G)o	#& %F)#x$*#Go#&"H**#)#{**&*+)E!*!O*))CH)TN*A ;
\ No newline at end of file
diff -x .svn -aruN 0.7.15.src/e107_handlers/tiny_mce/plugins/media/img/trans.gif 0.7.16.src/e107_handlers/tiny_mce/plugins/media/img/trans.gif
--- 0.7.15.src/e107_handlers/tiny_mce/plugins/media/img/trans.gif	1969-12-31 18:00:00.000000000 -0600
+++ 0.7.16.src/e107_handlers/tiny_mce/plugins/media/img/trans.gif	2009-07-08 05:04:39.000000000 -0500
@@ -0,0 +1 @@
+GIF89a          !   ,       D ;
\ No newline at end of file
diff -x .svn -aruN 0.7.15.src/e107_handlers/tiny_mce/plugins/media/img/windowsmedia.gif 0.7.16.src/e107_handlers/tiny_mce/plugins/media/img/windowsmedia.gif
--- 0.7.15.src/e107_handlers/tiny_mce/plugins/media/img/windowsmedia.gif	1969-12-31 18:00:00.000000000 -0600
+++ 0.7.16.src/e107_handlers/tiny_mce/plugins/media/img/windowsmedia.gif	2009-07-08 05:04:39.000000000 -0500
@@ -0,0 +1,2 @@
+GIF89a  ? uS-ѩaY0@G愅p+fҎG,LWKqxwwV&^qKNCiiimKx+tnV^K~3fp!BWuWr(a;vTHo9!  ? ,        "
+%lhhD4],G:jͤ\fఄT s5 !*$/	  ;-!&1/<'9;=7+;:78(3.2	"+%?>))'=.,?

.,	B	2%3cB(	~ ;
\ No newline at end of file
diff -x .svn -aruN 0.7.15.src/e107_handlers/tiny_mce/plugins/media/js/embed.js 0.7.16.src/e107_handlers/tiny_mce/plugins/media/js/embed.js
--- 0.7.15.src/e107_handlers/tiny_mce/plugins/media/js/embed.js	1969-12-31 18:00:00.000000000 -0600
+++ 0.7.16.src/e107_handlers/tiny_mce/plugins/media/js/embed.js	2009-07-08 05:04:39.000000000 -0500
@@ -0,0 +1,73 @@
+/**
+ * This script contains embed functions for common plugins. This scripts are complety free to use for any purpose.
+ */
+
+function writeFlash(p) {
+	writeEmbed(
+		'D27CDB6E-AE6D-11cf-96B8-444553540000',
+		'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0',
+		'application/x-shockwave-flash',
+		p
+	);
+}
+
+function writeShockWave(p) {
+	writeEmbed(
+	'166B1BCA-3F9C-11CF-8075-444553540000',
+	'http://download.macromedia.com/pub/shockwave/cabs/director/sw.cab#version=8,5,1,0',
+	'application/x-director',
+		p
+	);
+}
+
+function writeQuickTime(p) {
+	writeEmbed(
+		'02BF25D5-8C17-4B23-BC80-D3488ABDDC6B',
+		'http://www.apple.com/qtactivex/qtplugin.cab#version=6,0,2,0',
+		'video/quicktime',
+		p
+	);
+}
+
+function writeRealMedia(p) {
+	writeEmbed(
+		'CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA',
+		'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0',
+		'audio/x-pn-realaudio-plugin',
+		p
+	);
+}
+
+function writeWindowsMedia(p) {
+	p.url = p.src;
+	writeEmbed(
+		'6BF52A52-394A-11D3-B153-00C04F79FAA6',
+		'http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701',
+		'application/x-mplayer2',
+		p
+	);
+}
+
+function writeEmbed(cls, cb, mt, p) {
+	var h = '', n;
+
+	h += '<object classid="clsid:' + cls + '" codebase="' + cb + '"';
+	h += typeof(p.id) != "undefined" ? 'id="' + p.id + '"' : '';
+	h += typeof(p.name) != "undefined" ? 'name="' + p.name + '"' : '';
+	h += typeof(p.width) != "undefined" ? 'width="' + p.width + '"' : '';
+	h += typeof(p.height) != "undefined" ? 'height="' + p.height + '"' : '';
+	h += typeof(p.align) != "undefined" ? 'align="' + p.align + '"' : '';
+	h += '>';
+
+	for (n in p)
+		h += '<param name="' + n + '" value="' + p[n] + '">';
+
+	h += '<embed type="' + mt + '"';
+
+	for (n in p)
+		h += n + '="' + p[n] + '" ';
+
+	h += '></embed></object>';
+
+	document.write(h);
+}
diff -x .svn -aruN 0.7.15.src/e107_handlers/tiny_mce/plugins/media/js/media.js 0.7.16.src/e107_handlers/tiny_mce/plugins/media/js/media.js
--- 0.7.15.src/e107_handlers/tiny_mce/plugins/media/js/media.js	1969-12-31 18:00:00.000000000 -0600
+++ 0.7.16.src/e107_handlers/tiny_mce/plugins/media/js/media.js	2009-07-08 05:04:39.000000000 -0500
@@ -0,0 +1,630 @@
+tinyMCEPopup.requireLangPack();
+
+var oldWidth, oldHeight, ed, url;
+
+if (url = tinyMCEPopup.getParam("media_external_list_url"))
+	document.write('<script language="javascript" type="text/javascript" src="' + tinyMCEPopup.editor.documentBaseURI.toAbsolute(url) + '"></script>');
+
+function init() {
+	var pl = "", f, val;
+	var type = "flash", fe, i;
+
+	ed = tinyMCEPopup.editor;
+
+	tinyMCEPopup.resizeToInnerSize();
+	f = document.forms[0]
+
+	fe = ed.selection.getNode();
+	if (/mceItem(Flash|ShockWave|WindowsMedia|QuickTime|RealMedia)/.test(ed.dom.getAttrib(fe, 'class'))) {
+		pl = fe.title;
+
+		switch (ed.dom.getAttrib(fe, 'class')) {
+			case 'mceItemFlash':
+				type = 'flash';
+				break;
+
+			case 'mceItemFlashVideo':
+				type = 'flv';
+				break;
+
+			case 'mceItemShockWave':
+				type = 'shockwave';
+				break;
+
+			case 'mceItemWindowsMedia':
+				type = 'wmp';
+				break;
+
+			case 'mceItemQuickTime':
+				type = 'qt';
+				break;
+
+			case 'mceItemRealMedia':
+				type = 'rmp';
+				break;
+		}
+
+		document.forms[0].insert.value = ed.getLang('update', 'Insert', true); 
+	}
+
+	document.getElementById('filebrowsercontainer').innerHTML = getBrowserHTML('filebrowser','src','media','media');
+	document.getElementById('qtsrcfilebrowsercontainer').innerHTML = getBrowserHTML('qtsrcfilebrowser','qt_qtsrc','media','media');
+	document.getElementById('bgcolor_pickcontainer').innerHTML = getColorPickerHTML('bgcolor_pick','bgcolor');
+
+	var html = getMediaListHTML('medialist','src','media','media');
+	if (html == "")
+		document.getElementById("linklistrow").style.display = 'none';
+	else
+		document.getElementById("linklistcontainer").innerHTML = html;
+
+	// Resize some elements
+	if (isVisible('filebrowser'))
+		document.getElementById('src').style.width = '230px';
+
+	// Setup form
+	if (pl != "") {
+		pl = tinyMCEPopup.editor.plugins.media._parse(pl);
+
+		switch (type) {
+			case "flash":
+				setBool(pl, 'flash', 'play');
+				setBool(pl, 'flash', 'loop');
+				setBool(pl, 'flash', 'menu');
+				setBool(pl, 'flash', 'swliveconnect');
+				setStr(pl, 'flash', 'quality');
+				setStr(pl, 'flash', 'scale');
+				setStr(pl, 'flash', 'salign');
+				setStr(pl, 'flash', 'wmode');
+				setStr(pl, 'flash', 'base');
+				setStr(pl, 'flash', 'flashvars');
+			break;
+
+			case "qt":
+				setBool(pl, 'qt', 'loop');
+				setBool(pl, 'qt', 'autoplay');
+				setBool(pl, 'qt', 'cache');
+				setBool(pl, 'qt', 'controller');
+				setBool(pl, 'qt', 'correction');
+				setBool(pl, 'qt', 'enablejavascript');
+				setBool(pl, 'qt', 'kioskmode');
+				setBool(pl, 'qt', 'autohref');
+				setBool(pl, 'qt', 'playeveryframe');
+				setBool(pl, 'qt', 'tarsetcache');
+				setStr(pl, 'qt', 'scale');
+				setStr(pl, 'qt', 'starttime');
+				setStr(pl, 'qt', 'endtime');
+				setStr(pl, 'qt', 'tarset');
+				setStr(pl, 'qt', 'qtsrcchokespeed');
+				setStr(pl, 'qt', 'volume');
+				setStr(pl, 'qt', 'qtsrc');
+			break;
+
+			case "shockwave":
+				setBool(pl, 'shockwave', 'sound');
+				setBool(pl, 'shockwave', 'progress');
+				setBool(pl, 'shockwave', 'autostart');
+				setBool(pl, 'shockwave', 'swliveconnect');
+				setStr(pl, 'shockwave', 'swvolume');
+				setStr(pl, 'shockwave', 'swstretchstyle');
+				setStr(pl, 'shockwave', 'swstretchhalign');
+				setStr(pl, 'shockwave', 'swstretchvalign');
+			break;
+
+			case "wmp":
+				setBool(pl, 'wmp', 'autostart');
+				setBool(pl, 'wmp', 'enabled');
+				setBool(pl, 'wmp', 'enablecontextmenu');
+				setBool(pl, 'wmp', 'fullscreen');
+				setBool(pl, 'wmp', 'invokeurls');
+				setBool(pl, 'wmp', 'mute');
+				setBool(pl, 'wmp', 'stretchtofit');
+				setBool(pl, 'wmp', 'windowlessvideo');
+				setStr(pl, 'wmp', 'balance');
+				setStr(pl, 'wmp', 'baseurl');
+				setStr(pl, 'wmp', 'captioningid');
+				setStr(pl, 'wmp', 'currentmarker');
+				setStr(pl, 'wmp', 'currentposition');
+				setStr(pl, 'wmp', 'defaultframe');
+				setStr(pl, 'wmp', 'playcount');
+				setStr(pl, 'wmp', 'rate');
+				setStr(pl, 'wmp', 'uimode');
+				setStr(pl, 'wmp', 'volume');
+			break;
+
+			case "rmp":
+				setBool(pl, 'rmp', 'autostart');
+				setBool(pl, 'rmp', 'loop');
+				setBool(pl, 'rmp', 'autogotourl');
+				setBool(pl, 'rmp', 'center');
+				setBool(pl, 'rmp', 'imagestatus');
+				setBool(pl, 'rmp', 'maintainaspect');
+				setBool(pl, 'rmp', 'nojava');
+				setBool(pl, 'rmp', 'prefetch');
+				setBool(pl, 'rmp', 'shuffle');
+				setStr(pl, 'rmp', 'console');
+				setStr(pl, 'rmp', 'controls');
+				setStr(pl, 'rmp', 'numloop');
+				setStr(pl, 'rmp', 'scriptcallbacks');
+			break;
+		}
+
+		setStr(pl, null, 'src');
+		setStr(pl, null, 'id');
+		setStr(pl, null, 'name');
+		setStr(pl, null, 'vspace');
+		setStr(pl, null, 'hspace');
+		setStr(pl, null, 'bgcolor');
+		setStr(pl, null, 'align');
+		setStr(pl, null, 'width');
+		setStr(pl, null, 'height');
+
+		if ((val = ed.dom.getAttrib(fe, "width")) != "")
+			pl.width = f.width.value = val;
+
+		if ((val = ed.dom.getAttrib(fe, "height")) != "")
+			pl.height = f.height.value = val;
+
+		oldWidth = pl.width ? parseInt(pl.width) : 0;
+		oldHeight = pl.height ? parseInt(pl.height) : 0;
+	} else
+		oldWidth = oldHeight = 0;
+
+	selectByValue(f, 'media_type', type);
+	changedType(type);
+	updateColor('bgcolor_pick', 'bgcolor');
+
+	TinyMCE_EditableSelects.init();
+	generatePreview();
+}
+
+function insertMedia() {
+	var fe, f = document.forms[0], h;
+
+	tinyMCEPopup.restoreSelection();
+
+	if (!AutoValidator.validate(f)) {
+		tinyMCEPopup.alert(ed.getLang('invalid_data'));
+		return false;
+	}
+
+	f.width.value = f.width.value == "" ? 100 : f.width.value;
+	f.height.value = f.height.value == "" ? 100 : f.height.value;
+
+	fe = ed.selection.getNode();
+	if (fe != null && /mceItem(Flash|ShockWave|WindowsMedia|QuickTime|RealMedia)/.test(ed.dom.getAttrib(fe, 'class'))) {
+		switch (f.media_type.options[f.media_type.selectedIndex].value) {
+			case "flash":
+				fe.className = "mceItemFlash";
+				break;
+
+			case "flv":
+				fe.className = "mceItemFlashVideo";
+				break;
+
+			case "shockwave":
+				fe.className = "mceItemShockWave";
+				break;
+
+			case "qt":
+				fe.className = "mceItemQuickTime";
+				break;
+
+			case "wmp":
+				fe.className = "mceItemWindowsMedia";
+				break;
+
+			case "rmp":
+				fe.className = "mceItemRealMedia";
+				break;
+		}
+
+		if (fe.width != f.width.value || fe.height != f.height.value)
+			ed.execCommand('mceRepaint');
+
+		fe.title = serializeParameters();
+		fe.width = f.width.value;
+		fe.height = f.height.value;
+		fe.style.width = f.width.value + (f.width.value.indexOf('%') == -1 ? 'px' : '');
+		fe.style.height = f.height.value + (f.height.value.indexOf('%') == -1 ? 'px' : '');
+		fe.align = f.align.options[f.align.selectedIndex].value;
+	} else {
+		h = '<img src="' + tinyMCEPopup.getWindowArg("plugin_url") + '/img/trans.gif"' ;
+
+		switch (f.media_type.options[f.media_type.selectedIndex].value) {
+			case "flash":
+				h += ' class="mceItemFlash"';
+				break;
+
+			case "flv":
+				h += ' class="mceItemFlashVideo"';
+				break;
+
+			case "shockwave":
+				h += ' class="mceItemShockWave"';
+				break;
+
+			case "qt":
+				h += ' class="mceItemQuickTime"';
+				break;
+
+			case "wmp":
+				h += ' class="mceItemWindowsMedia"';
+				break;
+
+			case "rmp":
+				h += ' class="mceItemRealMedia"';
+				break;
+		}
+
+		h += ' title="' + serializeParameters() + '"';
+		h += ' width="' + f.width.value + '"';
+		h += ' height="' + f.height.value + '"';
+		h += ' align="' + f.align.options[f.align.selectedIndex].value + '"';
+
+		h += ' />';
+
+		ed.execCommand('mceInsertContent', false, h);
+	}
+
+	tinyMCEPopup.close();
+}
+
+function updatePreview() {
+	var f = document.forms[0], type;
+
+	f.width.value = f.width.value || '320';
+	f.height.value = f.height.value || '240';
+
+	type = getType(f.src.value);
+	selectByValue(f, 'media_type', type);
+	changedType(type);
+	generatePreview();
+}
+
+function getMediaListHTML() {
+	if (typeof(tinyMCEMediaList) != "undefined" && tinyMCEMediaList.length > 0) {
+		var html = "";
+
+		html += '<select id="linklist" name="linklist" style="width: 250px" onchange="this.form.src.value=this.options[this.selectedIndex].value;updatePreview();">';
+		html += '<option value="">---</option>';
+
+		for (var i=0; i<tinyMCEMediaList.length; i++)
+			html += '<option value="' + tinyMCEMediaList[i][1] + '">' + tinyMCEMediaList[i][0] + '</option>';
+
+		html += '</select>';
+
+		return html;
+	}
+
+	return "";
+}
+
+function getType(v) {
+	var fo, i, c, el, x, f = document.forms[0];
+
+	fo = ed.getParam("media_types", "flash=swf;flv=flv;shockwave=dcr;qt=mov,qt,mpg,mp3,mp4,mpeg;shockwave=dcr;wmp=avi,wmv,wm,asf,asx,wmx,wvx;rmp=rm,ra,ram").split(';');
+
+	// YouTube
+	if (v.match(/watch\?v=(.+)(.*)/)) {
+		f.width.value = '425';
+		f.height.value = '350';
+		f.src.value = 'http://www.youtube.com/v/' + v.match(/v=(.*)(.*)/)[0].split('=')[1];
+		return 'flash';
+	}
+
+	// Google video
+	if (v.indexOf('http://video.google.com/videoplay?docid=') == 0) {
+		f.width.value = '425';
+		f.height.value = '326';
+		f.src.value = 'http://video.google.com/googleplayer.swf?docId=' + v.substring('http://video.google.com/videoplay?docid='.length) + '&hl=en';
+		return 'flash';
+	}
+
+	for (i=0; i<fo.length; i++) {
+		c = fo[i].split('=');
+
+		el = c[1].split(',');
+		for (x=0; x<el.length; x++)
+		if (v.indexOf('.' + el[x]) != -1)
+			return c[0];
+	}
+
+	return null;
+}
+
+function switchType(v) {
+	var t = getType(v), d = document, f = d.forms[0];
+
+	if (!t)
+		return;
+
+	selectByValue(d.forms[0], 'media_type', t);
+	changedType(t);
+
+	// Update qtsrc also
+	if (t == 'qt' && f.src.value.toLowerCase().indexOf('rtsp://') != -1) {
+		alert(ed.getLang("media_qt_stream_warn"));
+
+		if (f.qt_qtsrc.value == '')
+			f.qt_qtsrc.value = f.src.value;
+	}
+}
+
+function changedType(t) {
+	var d = document;
+
+	d.getElementById('flash_options').style.display = 'none';
+	d.getElementById('flv_options').style.display = 'none';
+	d.getElementById('qt_options').style.display = 'none';
+	d.getElementById('shockwave_options').style.display = 'none';
+	d.getElementById('wmp_options').style.display = 'none';
+	d.getElementById('rmp_options').style.display = 'none';
+
+	if (t)
+		d.getElementById(t + '_options').style.display = 'block';
+}
+
+function serializeParameters() {
+	var d = document, f = d.forms[0], s = '';
+
+	switch (f.media_type.options[f.media_type.selectedIndex].value) {
+		case "flash":
+			s += getBool('flash', 'play', true);
+			s += getBool('flash', 'loop', true);
+			s += getBool('flash', 'menu', true);
+			s += getBool('flash', 'swliveconnect', false);
+			s += getStr('flash', 'quality');
+			s += getStr('flash', 'scale');
+			s += getStr('flash', 'salign');
+			s += getStr('flash', 'wmode');
+			s += getStr('flash', 'base');
+			s += getStr('flash', 'flashvars');
+		break;
+
+		case "qt":
+			s += getBool('qt', 'loop', false);
+			s += getBool('qt', 'autoplay', true);
+			s += getBool('qt', 'cache', false);
+			s += getBool('qt', 'controller', true);
+			s += getBool('qt', 'correction', false, 'none', 'full');
+			s += getBool('qt', 'enablejavascript', false);
+			s += getBool('qt', 'kioskmode', false);
+			s += getBool('qt', 'autohref', false);
+			s += getBool('qt', 'playeveryframe', false);
+			s += getBool('qt', 'targetcache', false);
+			s += getStr('qt', 'scale');
+			s += getStr('qt', 'starttime');
+			s += getStr('qt', 'endtime');
+			s += getStr('qt', 'target');
+			s += getStr('qt', 'qtsrcchokespeed');
+			s += getStr('qt', 'volume');
+			s += getStr('qt', 'qtsrc');
+		break;
+
+		case "shockwave":
+			s += getBool('shockwave', 'sound');
+			s += getBool('shockwave', 'progress');
+			s += getBool('shockwave', 'autostart');
+			s += getBool('shockwave', 'swliveconnect');
+			s += getStr('shockwave', 'swvolume');
+			s += getStr('shockwave', 'swstretchstyle');
+			s += getStr('shockwave', 'swstretchhalign');
+			s += getStr('shockwave', 'swstretchvalign');
+		break;
+
+		case "wmp":
+			s += getBool('wmp', 'autostart', true);
+			s += getBool('wmp', 'enabled', false);
+			s += getBool('wmp', 'enablecontextmenu', true);
+			s += getBool('wmp', 'fullscreen', false);
+			s += getBool('wmp', 'invokeurls', true);
+			s += getBool('wmp', 'mute', false);
+			s += getBool('wmp', 'stretchtofit', false);
+			s += getBool('wmp', 'windowlessvideo', false);
+			s += getStr('wmp', 'balance');
+			s += getStr('wmp', 'baseurl');
+			s += getStr('wmp', 'captioningid');
+			s += getStr('wmp', 'currentmarker');
+			s += getStr('wmp', 'currentposition');
+			s += getStr('wmp', 'defaultframe');
+			s += getStr('wmp', 'playcount');
+			s += getStr('wmp', 'rate');
+			s += getStr('wmp', 'uimode');
+			s += getStr('wmp', 'volume');
+		break;
+
+		case "rmp":
+			s += getBool('rmp', 'autostart', false);
+			s += getBool('rmp', 'loop', false);
+			s += getBool('rmp', 'autogotourl', true);
+			s += getBool('rmp', 'center', false);
+			s += getBool('rmp', 'imagestatus', true);
+			s += getBool('rmp', 'maintainaspect', false);
+			s += getBool('rmp', 'nojava', false);
+			s += getBool('rmp', 'prefetch', false);
+			s += getBool('rmp', 'shuffle', false);
+			s += getStr('rmp', 'console');
+			s += getStr('rmp', 'controls');
+			s += getStr('rmp', 'numloop');
+			s += getStr('rmp', 'scriptcallbacks');
+		break;
+	}
+
+	s += getStr(null, 'id');
+	s += getStr(null, 'name');
+	s += getStr(null, 'src');
+	s += getStr(null, 'align');
+	s += getStr(null, 'bgcolor');
+	s += getInt(null, 'vspace');
+	s += getInt(null, 'hspace');
+	s += getStr(null, 'width');
+	s += getStr(null, 'height');
+
+	s = s.length > 0 ? s.substring(0, s.length - 1) : s;
+
+	return s;
+}
+
+function setBool(pl, p, n) {
+	if (typeof(pl[n]) == "undefined")
+		return;
+
+	document.forms[0].elements[p + "_" + n].checked = pl[n] != 'false';
+}
+
+function setStr(pl, p, n) {
+	var f = document.forms[0], e = f.elements[(p != null ? p + "_" : '') + n];
+
+	if (typeof(pl[n]) == "undefined")
+		return;
+
+	if (e.type == "text")
+		e.value = pl[n];
+	else
+		selectByValue(f, (p != null ? p + "_" : '') + n, pl[n]);
+}
+
+function getBool(p, n, d, tv, fv) {
+	var v = document.forms[0].elements[p + "_" + n].checked;
+
+	tv = typeof(tv) == 'undefined' ? 'true' : "'" + jsEncode(tv) + "'";
+	fv = typeof(fv) == 'undefined' ? 'false' : "'" + jsEncode(fv) + "'";
+
+	return (v == d) ? '' : n + (v ? ':' + tv + ',' : ":\'" + fv + "\',");
+}
+
+function getStr(p, n, d) {
+	var e = document.forms[0].elements[(p != null ? p + "_" : "") + n];
+	var v = e.type == "text" ? e.value : e.options[e.selectedIndex].value;
+
+	if (n == 'src')
+		v = tinyMCEPopup.editor.convertURL(v, 'src', null);
+
+	return ((n == d || v == '') ? '' : n + ":'" + jsEncode(v) + "',");
+}
+
+function getInt(p, n, d) {
+	var e = document.forms[0].elements[(p != null ? p + "_" : "") + n];
+	var v = e.type == "text" ? e.value : e.options[e.selectedIndex].value;
+
+	return ((n == d || v == '') ? '' : n + ":" + v.replace(/[^0-9]+/g, '') + ",");
+}
+
+function jsEncode(s) {
+	s = s.replace(new RegExp('\\\\', 'g'), '\\\\');
+	s = s.replace(new RegExp('"', 'g'), '\\"');
+	s = s.replace(new RegExp("'", 'g'), "\\'");
+
+	return s;
+}
+
+function generatePreview(c) {
+	var f = document.forms[0], p = document.getElementById('prev'), h = '', cls, pl, n, type, codebase, wp, hp, nw, nh;
+
+	p.innerHTML = '<!-- x --->';
+
+	nw = parseInt(f.width.value);
+	nh = parseInt(f.height.value);
+
+	if (f.width.value != "" && f.height.value != "") {
+		if (f.constrain.checked) {
+			if (c == 'width' && oldWidth != 0) {
+				wp = nw / oldWidth;
+				nh = Math.round(wp * nh);
+				f.height.value = nh;
+			} else if (c == 'height' && oldHeight != 0) {
+				hp = nh / oldHeight;
+				nw = Math.round(hp * nw);
+				f.width.value = nw;
+			}
+		}
+	}
+
+	if (f.width.value != "")
+		oldWidth = nw;
+
+	if (f.height.value != "")
+		oldHeight = nh;
+
+	// After constrain
+	pl = serializeParameters();
+
+	switch (f.media_type.options[f.media_type.selectedIndex].value) {
+		case "flash":
+			cls = 'clsid:D27CDB6E-AE6D-11cf-96B8-444553540000';
+			codebase = 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0';
+			type = 'application/x-shockwave-flash';
+			break;
+
+		case "shockwave":
+			cls = 'clsid:166B1BCA-3F9C-11CF-8075-444553540000';
+			codebase = 'http://download.macromedia.com/pub/shockwave/cabs/director/sw.cab#version=8,5,1,0';
+			type = 'application/x-director';
+			break;
+
+		case "qt":
+			cls = 'clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B';
+			codebase = 'http://www.apple.com/qtactivex/qtplugin.cab#version=6,0,2,0';
+			type = 'video/quicktime';
+			break;
+
+		case "wmp":
+			cls = ed.getParam('media_wmp6_compatible') ? 'clsid:05589FA1-C356-11CE-BF01-00AA0055595A' : 'clsid:6BF52A52-394A-11D3-B153-00C04F79FAA6';
+			codebase = 'http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701';
+			type = 'application/x-mplayer2';
+			break;
+
+		case "rmp":
+			cls = 'clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA';
+			codebase = 'http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701';
+			type = 'audio/x-pn-realaudio-plugin';
+			break;
+	}
+
+	if (pl == '') {
+		p.innerHTML = '';
+		return;
+	}
+
+	pl = tinyMCEPopup.editor.plugins.media._parse(pl);
+
+	if (!pl.src) {
+		p.innerHTML = '';
+		return;
+	}
+
+	pl.src = tinyMCEPopup.editor.documentBaseURI.toAbsolute(pl.src);
+	pl.width = !pl.width ? 100 : pl.width;
+	pl.height = !pl.height ? 100 : pl.height;
+	pl.id = !pl.id ? 'obj' : pl.id;
+	pl.name = !pl.name ? 'eobj' : pl.name;
+	pl.align = !pl.align ? '' : pl.align;
+
+	// Avoid annoying warning about insecure items
+	if (!tinymce.isIE || document.location.protocol != 'https:') {
+		h += '<object classid="' + cls + '" codebase="' + codebase + '" width="' + pl.width + '" height="' + pl.height + '" id="' + pl.id + '" name="' + pl.name + '" align="' + pl.align + '">';
+
+		for (n in pl) {
+			h += '<param name="' + n + '" value="' + pl[n] + '">';
+
+			// Add extra url parameter if it's an absolute URL
+			if (n == 'src' && pl[n].indexOf('://') != -1)
+				h += '<param name="url" value="' + pl[n] + '" />';
+		}
+	}
+
+	h += '<embed type="' + type + '" ';
+
+	for (n in pl)
+		h += n + '="' + pl[n] + '" ';
+
+	h += '></embed>';
+
+	// Avoid annoying warning about insecure items
+	if (!tinymce.isIE || document.location.protocol != 'https:')
+		h += '</object>';
+
+	p.innerHTML = "<!-- x --->" + h;
+}
+
+tinyMCEPopup.onInit.add(init);
diff -x .svn -aruN 0.7.15.src/e107_handlers/tiny_mce/plugins/media/langs/en_dlg.js 0.7.16.src/e107_handlers/tiny_mce/plugins/media/langs/en_dlg.js
--- 0.7.15.src/e107_handlers/tiny_mce/plugins/media/langs/en_dlg.js	1969-12-31 18:00:00.000000000 -0600
+++ 0.7.16.src/e107_handlers/tiny_mce/plugins/media/langs/en_dlg.js	2009-07-06 01:16:08.000000000 -0500
@@ -0,0 +1,103 @@
+tinyMCE.addI18n('en.media_dlg',{
+title:"Insert / edit embedded media",
+general:"General",
+advanced:"Advanced",
+file:"File/URL",
+list:"List",
+size:"Dimensions",
+preview:"Preview",
+constrain_proportions:"Constrain proportions",
+type:"Type",
+id:"Id",
+name:"Name",
+class_name:"Class",
+vspace:"V-Space",
+hspace:"H-Space",
+play:"Auto play",
+loop:"Loop",
+menu:"Show menu",
+quality:"Quality",
+scale:"Scale",
+align:"Align",
+salign:"SAlign",
+wmode:"WMode",
+bgcolor:"Background",
+base:"Base",
+flashvars:"Flashvars",
+liveconnect:"SWLiveConnect",
+autohref:"AutoHREF",
+cache:"Cache",
+hidden:"Hidden",
+controller:"Controller",
+kioskmode:"Kiosk mode",
+playeveryframe:"Play every frame",
+targetcache:"Target cache",
+correction:"No correction",
+enablejavascript:"Enable JavaScript",
+starttime:"Start time",
+endtime:"End time",
+href:"Href",
+qtsrcchokespeed:"Choke speed",
+target:"Target",
+volume:"Volume",
+autostart:"Auto start",
+enabled:"Enabled",
+fullscreen:"Fullscreen",
+invokeurls:"Invoke URLs",
+mute:"Mute",
+stretchtofit:"Stretch to fit",
+windowlessvideo:"Windowless video",
+balance:"Balance",
+baseurl:"Base URL",
+captioningid:"Captioning id",
+currentmarker:"Current marker",
+currentposition:"Current position",
+defaultframe:"Default frame",
+playcount:"Play count",
+rate:"Rate",
+uimode:"UI Mode",
+flash_options:"Flash options",
+qt_options:"Quicktime options",
+wmp_options:"Windows media player options",
+rmp_options:"Real media player options",
+shockwave_options:"Shockwave options",
+autogotourl:"Auto goto URL",
+center:"Center",
+imagestatus:"Image status",
+maintainaspect:"Maintain aspect",
+nojava:"No java",
+prefetch:"Prefetch",
+shuffle:"Shuffle",
+console:"Console",
+numloop:"Num loops",
+controls:"Controls",
+scriptcallbacks:"Script callbacks",
+swstretchstyle:"Stretch style",
+swstretchhalign:"Stretch H-Align",
+swstretchvalign:"Stretch V-Align",
+sound:"Sound",
+progress:"Progress",
+qtsrc:"QT Src",
+qt_stream_warn:"Streamed rtsp resources should be added to the QT Src field under the advanced tab.\nYou should also add a non streamed version to the Src field..",
+align_top:"Top",
+align_right:"Right",
+align_bottom:"Bottom",
+align_left:"Left",
+align_center:"Center",
+align_top_left:"Top left",
+align_top_right:"Top right",
+align_bottom_left:"Bottom left",
+align_bottom_right:"Bottom right",
+flv_options:"Flash video options",
+flv_scalemode:"Scale mode",
+flv_buffer:"Buffer",
+flv_startimage:"Start image",
+flv_starttime:"Start time",
+flv_defaultvolume:"Default volumne",
+flv_hiddengui:"Hidden GUI",
+flv_autostart:"Auto start",
+flv_loop:"Loop",
+flv_showscalemodes:"Show scale modes",
+flv_smoothvideo:"Smooth video",
+flv_jscallback:"JS Callback"
+});
\ No newline at end of file
diff -x .svn -aruN 0.7.15.src/e107_handlers/tiny_mce/plugins/media/langs/en.js 0.7.16.src/e107_handlers/tiny_mce/plugins/media/langs/en.js
--- 0.7.15.src/e107_handlers/tiny_mce/plugins/media/langs/en.js	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_handlers/tiny_mce/plugins/media/langs/en.js	1969-12-31 18:00:00.000000000 -0600
@@ -1,85 +0,0 @@
-// UK lang variables
-
-tinyMCE.addToLang('media',{
-title : 'Insert / edit embedded media',
-desc : 'Insert / edit embedded media',
-general : 'General',
-advanced : 'Advanced',
-file : 'File',
-list : 'List',
-size : 'Dimensions',
-preview : 'Preview',
-constrain_proportions : 'Constrain proportions',
-type : 'Type',
-id : 'Id',
-name : 'Name',
-class_name : 'Class',
-vspace : 'V-Space',
-hspace : 'H-Space',
-play : 'Auto play',
-loop : 'Loop',
-menu : 'Show menu',
-quality : 'Quality',
-scale : 'Scale',
-align : 'Align',
-salign : 'SAlign',
-wmode : 'WMode',
-bgcolor : 'Background',
-base : 'Base',
-flashvars : 'Flashvars',
-liveconnect : 'SWLiveConnect',
-autohref : 'AutoHREF',
-cache : 'Cache',
-hidden : 'Hidden',
-controller : 'Controller',
-kioskmode : 'Kiosk mode',
-playeveryframe : 'Play every frame',
-targetcache : 'Target cache',
-correction : 'No correction',
-enablejavascript : 'Enable JavaScript',
-starttime : 'Start time',
-endtime : 'End time',
-href : 'Href',
-qtsrcchokespeed : 'Choke speed',
-target : 'Target',
-volume : 'Volume',
-autostart : 'Auto start',
-enabled : 'Enabled',
-fullscreen : 'Fullscreen',
-invokeurls : 'Invoke URLs',
-mute : 'Mute',
-stretchtofit : 'Stretch to fit',
-windowlessvideo : 'Windowless video',
-balance : 'Balance',
-baseurl : 'Base URL',
-captioningid : 'Captioning id',
-currentmarker : 'Current marker',
-currentposition : 'Current position',
-defaultframe : 'Default frame',
-playcount : 'Play count',
-rate : 'Rate',
-uimode : 'UI Mode',
-flash_options : 'Flash options',
-qt_options : 'Quicktime options',
-wmp_options : 'Windows media player options',
-rmp_options : 'Real media player options',
-shockwave_options : 'Shockwave options',
-autogotourl : 'Auto goto URL',
-center : 'Center',
-imagestatus : 'Image status',
-maintainaspect : 'Maintain aspect',
-nojava : 'No java',
-prefetch : 'Prefetch',
-shuffle : 'Shuffle',
-console : 'Console',
-numloop : 'Num loops',
-controls : 'Controls',
-scriptcallbacks : 'Script callbacks',
-swstretchstyle : 'Stretch style',
-swstretchhalign : 'Stretch H-Align',
-swstretchvalign : 'Stretch V-Align',
-sound : 'Sound',
-progress : 'Progress',
-qtsrc : 'QT Src',
-qt_stream_warn : 'Streamed rtsp resources should be added to the QT Src field under the advanced tab.\nYou should also add a non streamed version to the Src field..'
-});
diff -x .svn -aruN 0.7.15.src/e107_handlers/tiny_mce/plugins/media/media.htm 0.7.16.src/e107_handlers/tiny_mce/plugins/media/media.htm
--- 0.7.15.src/e107_handlers/tiny_mce/plugins/media/media.htm	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_handlers/tiny_mce/plugins/media/media.htm	2009-06-30 19:36:49.000000000 -0500
@@ -1,102 +1,104 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
 <html xmlns="http://www.w3.org/1999/xhtml">
 <head>
-	<title>{$lang_media_title}</title>
-	<script language="javascript" type="text/javascript" src="../../tiny_mce_popup.js"></script>
-	<script language="javascript" type="text/javascript" src="jscripts/media.js"></script>
-	<script language="javascript" type="text/javascript" src="../../utils/mctabs.js"></script>
-	<script language="javascript" type="text/javascript" src="../../utils/validate.js"></script>
-	<script language="javascript" type="text/javascript" src="../../utils/form_utils.js"></script>
-	<script language="javascript" type="text/javascript" src="../../utils/editable_selects.js"></script>
+	<title>{#media_dlg.title}</title>
+	<script type="text/javascript" src="../../tiny_mce_popup.js"></script>
+	<script type="text/javascript" src="js/media.js"></script>
+	<script type="text/javascript" src="../../utils/mctabs.js"></script>
+	<script type="text/javascript" src="../../utils/validate.js"></script>
+	<script type="text/javascript" src="../../utils/form_utils.js"></script>
+	<script type="text/javascript" src="../../utils/editable_selects.js"></script>
 	<link href="css/media.css" rel="stylesheet" type="text/css" />
-	<base target="_self" />
 </head>
-<body onload="tinyMCEPopup.executeOnLoad('init();');" style="display: none">
+<body style="display: none">
     <form onsubmit="insertMedia();return false;" action="#">
 		<div class="tabs">
 			<ul>
-				<li id="general_tab" class="current"><span><a href="javascript:mcTabs.displayTab('general_tab','general_panel');generatePreview();" onmousedown="return false;">{$lang_media_general}</a></span></li>
-				<li id="advanced_tab"><span><a href="javascript:mcTabs.displayTab('advanced_tab','advanced_panel');" onmousedown="return false;">{$lang_media_advanced}</a></span></li>
+				<li id="general_tab" class="current"><span><a href="javascript:mcTabs.displayTab('general_tab','general_panel');generatePreview();" onmousedown="return false;">{#media_dlg.general}</a></span></li>
+				<li id="advanced_tab"><span><a href="javascript:mcTabs.displayTab('advanced_tab','advanced_panel');" onmousedown="return false;">{#media_dlg.advanced}</a></span></li>
 			</ul>
 		</div>
 
 		<div class="panel_wrapper">
 			<div id="general_panel" class="panel current">
 				<fieldset>
-					<legend>{$lang_media_general}</legend>
+					<legend>{#media_dlg.general}</legend>
 
 					<table border="0" cellpadding="4" cellspacing="0">
 							<tr>
-								<td><label for="media_type">{$lang_media_type}</label></td>
+								<td><label for="media_type">{#media_dlg.type}</label></td>
 								<td>
 									<select id="media_type" name="media_type" onchange="changedType(this.value);generatePreview();">
 										<option value="flash">Flash</option>
+										<!-- <option value="flv">Flash video (FLV)</option> -->
 										<option value="qt">Quicktime</option>
-										<option value="shockwave">Shockware</option>
+										<option value="shockwave">Shockwave</option>
 										<option value="wmp">Windows Media</option>
 										<option value="rmp">Real Media</option>
 									</select>
 								</td>
 							</tr>
 							<tr>
-							<td><label for="src">{$lang_media_file}</label></td>
+							<td><label for="src">{#media_dlg.file}</label></td>
 							  <td>
 									<table border="0" cellspacing="0" cellpadding="0">
 									  <tr>
-										<td><input id="src" name="src" type="text" value="" onchange="switchType(this.value);generatePreview();" /></td>
+										<td><input id="src" name="src" type="text" value="" class="mceFocus" onchange="switchType(this.value);generatePreview();" /></td>
 										<td id="filebrowsercontainer">&nbsp;</td>
 									  </tr>
 									</table>
 								</td>
 							</tr>
 							<tr id="linklistrow">
-								<td><label for="linklist">{$lang_media_list}</label></td>
-								<td id="linklistcontainer">&nbsp;</td>
+								<td><label for="linklist">{#media_dlg.list}</label></td>
+								<td id="linklistcontainer"><select id="linklist"><option value=""></option></select></td>
 							</tr>
 							<tr>
-								<td><label for="width">{$lang_media_size}</label></td>
+								<td><label for="width">{#media_dlg.size}</label></td>
 								<td>
-								<table border="0" cellpadding="0" cellspacing="0">
-									<tr>
-										<td><input type="text" id="width" name="width" value="" class="size" onchange="generatePreview('width');" /> x <input type="text" id="height" name="height" value="" class="size"  onchange="generatePreview('height');" /></td>
-										<td>&nbsp;&nbsp;<input id="constrain" type="checkbox" name="constrain" class="checkbox" /></td>
-										<td><label id="constrainlabel" for="constrain">{$lang_media_constrain_proportions}</label></td>
-									</tr>
-								</table>
+									<table border="0" cellpadding="0" cellspacing="0">
+										<tr>
+											<td><input type="text" id="width" name="width" value="" class="size" onchange="generatePreview('width');" /> x <input type="text" id="height" name="height" value="" class="size"  onchange="generatePreview('height');" /></td>
+											<td>&nbsp;&nbsp;<input id="constrain" type="checkbox" name="constrain" class="checkbox" /></td>
+											<td><label id="constrainlabel" for="constrain">{#media_dlg.constrain_proportions}</label></td>
+										</tr>
+									</table>
+								</td>
 							</tr>
 					</table>
 				</fieldset>
 
 				<fieldset>
-					<legend>{$lang_media_preview}</legend>
+					<legend>{#media_dlg.preview}</legend>
 					<div id="prev"></div>
 				</fieldset>
 			</div>
 
 			<div id="advanced_panel" class="panel">
 				<fieldset>
-					<legend>{$lang_media_advanced}</legend>
+					<legend>{#media_dlg.advanced}</legend>
 
 					<table border="0" cellpadding="4" cellspacing="0" width="100%">
 						<tr>
-							<td><label for="id">{$lang_media_id}</label></td>
+							<td><label for="id">{#media_dlg.id}</label></td>
 							<td><input type="text" id="id" name="id" onchange="generatePreview();" /></td>
-							<td><label for="name">{$lang_media_name}</label></td>
+							<td><label for="name">{#media_dlg.name}</label></td>
 							<td><input type="text" id="name" name="name" onchange="generatePreview();" /></td>
 						</tr>
 
 						<tr>
-							<td><label for="align">{$lang_media_align}</label></td>
+							<td><label for="align">{#media_dlg.align}</label></td>
 							<td>
 								<select id="align" name="align" onchange="generatePreview();">
-									<option value="">{$lang_not_set}</option> 
-									<option value="top">top</option>
-									<option value="right">right</option>
-									<option value="bottom">bottom</option>
-									<option value="left">left</option>
+									<option value="">{#not_set}</option> 
+									<option value="top">{#media_dlg.align_top}</option>
+									<option value="right">{#media_dlg.align_right}</option>
+									<option value="bottom">{#media_dlg.align_bottom}</option>
+									<option value="left">{#media_dlg.align_left}</option>
 								</select>
 							</td>
 
-							<td><label for="bgcolor">{$lang_media_bgcolor}</label></td>
+							<td><label for="bgcolor">{#media_dlg.bgcolor}</label></td>
 							<td>
 								<table border="0" cellpadding="0" cellspacing="0">
 									<tr>
@@ -108,23 +110,23 @@
 						</tr>
 
 						<tr>
-							<td><label for="vspace">{$lang_media_vspace}</label></td>
+							<td><label for="vspace">{#media_dlg.vspace}</label></td>
 							<td><input type="text" id="vspace" name="vspace" class="number" onchange="generatePreview();" /></td>
-							<td><label for="hspace">{$lang_media_hspace}</label></td>
+							<td><label for="hspace">{#media_dlg.hspace}</label></td>
 							<td><input type="text" id="hspace" name="hspace" class="number" onchange="generatePreview();" /></td>
 						</tr>
 					</table>
 				</fieldset>
 
 				<fieldset id="flash_options">
-					<legend>{$lang_media_flash_options}</legend>
+					<legend>{#media_dlg.flash_options}</legend>
 
 					<table border="0" cellpadding="4" cellspacing="0">
 						<tr>
-							<td><label for="flash_quality">{$lang_media_quality}</label></td>
+							<td><label for="flash_quality">{#media_dlg.quality}</label></td>
 							<td>
 								<select id="flash_quality" name="flash_quality" onchange="generatePreview();">
-									<option value="">{$lang_not_set}</option> 
+									<option value="">{#not_set}</option> 
 									<option value="high">high</option>
 									<option value="low">low</option>
 									<option value="autolow">autolow</option>
@@ -133,40 +135,41 @@
 								</select>
 							</td>
 
-							<td><label for="flash_scale">{$lang_media_scale}</label></td>
+							<td><label for="flash_scale">{#media_dlg.scale}</label></td>
 							<td>
 								<select id="flash_scale" name="flash_scale" onchange="generatePreview();">
-									<option value="">{$lang_not_set}</option> 
+									<option value="">{#not_set}</option> 
 									<option value="showall">showall</option>
 									<option value="noborder">noborder</option>
 									<option value="exactfit">exactfit</option>
+									<option value="noscale">noscale</option>
 								</select>
 							</td>
 						</tr>
 
 						<tr>
-							<td><label for="flash_wmode">{$lang_media_wmode}</label></td>
+							<td><label for="flash_wmode">{#media_dlg.wmode}</label></td>
 							<td>
 								<select id="flash_wmode" name="flash_wmode" onchange="generatePreview();">
-									<option value="">{$lang_not_set}</option> 
+									<option value="">{#not_set}</option> 
 									<option value="window">window</option>
 									<option value="opaque">opaque</option>
 									<option value="transparent">transparent</option>
 								</select>
 							</td>
 
-							<td><label for="flash_salign">{$lang_media_salign}</label></td>
+							<td><label for="flash_salign">{#media_dlg.salign}</label></td>
 							<td>
 								<select id="flash_salign" name="flash_salign" onchange="generatePreview();">
-									<option value="">{$lang_not_set}</option> 
-									<option value="l">left</option>
-									<option value="t">top</option>
-									<option value="r">right</option>
-									<option value="b">bottom</option>
-									<option value="tl">top-left</option>
-									<option value="tr">top_right</option>
-									<option value="bl">bottom-left</option>
-									<option value="br">bottom-right</option>
+									<option value="">{#not_set}</option> 
+									<option value="l">{#media_dlg.align_left}</option>
+									<option value="t">{#media_dlg.align_top}</option>
+									<option value="r">{#media_dlg.align_right}</option>
+									<option value="b">{#media_dlg.align_bottom}</option>
+									<option value="tl">{#media_dlg.align_top_left}</option>
+									<option value="tr">{#media_dlg.align_top_right}</option>
+									<option value="bl">{#media_dlg.align_bottom_left}</option>
+									<option value="br">{#media_dlg.align_bottom_right}</option>
 								</select>
 							</td>
 						</tr>
@@ -176,7 +179,7 @@
 								<table border="0" cellpadding="0" cellspacing="0">
 									<tr>
 										<td><input type="checkbox" class="checkbox" id="flash_play" name="flash_play" checked="checked" onchange="generatePreview();" /></td>
-										<td><label for="flash_play">{$lang_media_play}</label></td>
+										<td><label for="flash_play">{#media_dlg.play}</label></td>
 									</tr>
 								</table>
 							</td>
@@ -185,7 +188,7 @@
 								<table border="0" cellpadding="0" cellspacing="0">
 									<tr>
 										<td><input type="checkbox" class="checkbox" id="flash_loop" name="flash_loop" checked="checked" onchange="generatePreview();" /></td>
-										<td><label for="flash_loop">{$lang_media_loop}</label></td>
+										<td><label for="flash_loop">{#media_dlg.loop}</label></td>
 									</tr>
 								</table>
 							</td>
@@ -196,7 +199,7 @@
 								<table border="0" cellpadding="0" cellspacing="0">
 									<tr>
 										<td><input type="checkbox" class="checkbox" id="flash_menu" name="flash_menu" checked="checked" onchange="generatePreview();" /></td>
-										<td><label for="flash_menu">{$lang_media_menu}</label></td>
+										<td><label for="flash_menu">{#media_dlg.menu}</label></td>
 									</tr>
 								</table>
 							</td>
@@ -205,7 +208,7 @@
 								<table border="0" cellpadding="0" cellspacing="0">
 									<tr>
 										<td><input type="checkbox" class="checkbox" id="flash_swliveconnect" name="flash_swliveconnect" onchange="generatePreview();" /></td>
-										<td><label for="flash_swliveconnect">{$lang_media_liveconnect}</label></td>
+										<td><label for="flash_swliveconnect">{#media_dlg.liveconnect}</label></td>
 									</tr>
 								</table>
 							</td>
@@ -214,19 +217,115 @@
 
 					<table>
 						<tr>
-							<td><label for="flash_base">{$lang_media_base}</label></td>
+							<td><label for="flash_base">{#media_dlg.base}</label></td>
 							<td><input type="text" id="flash_base" name="flash_base" onchange="generatePreview();" /></td>
 						</tr>
 
 						<tr>
-							<td><label for="flash_flashvars">{$lang_media_flashvars}</label></td>
+							<td><label for="flash_flashvars">{#media_dlg.flashvars}</label></td>
 							<td><input type="text" id="flash_flashvars" name="flash_flashvars" onchange="generatePreview();" /></td>
 						</tr>
 					</table>
 				</fieldset>
 
+				<fieldset id="flv_options">
+					<legend>{#media_dlg.flv_options}</legend>
+
+					<table border="0" cellpadding="4" cellspacing="0">
+						<tr>
+							<td><label for="flv_scalemode">{#media_dlg.flv_scalemode}</label></td>
+							<td>
+								<select id="flv_scalemode" name="flv_scalemode" onchange="generatePreview();">
+									<option value="">{#not_set}</option> 
+									<option value="none">none</option>
+									<option value="double">double</option>
+									<option value="full">full</option>
+								</select>
+							</td>
+
+							<td><label for="flv_buffer">{#media_dlg.flv_buffer}</label></td>
+							<td><input type="text" id="flv_buffer" name="flv_buffer" onchange="generatePreview();" /></td>
+						</tr>
+
+						<tr>
+							<td><label for="flv_startimage">{#media_dlg.flv_startimage}</label></td>
+							<td><input type="text" id="flv_startimage" name="flv_startimage" onchange="generatePreview();" /></td>
+
+							<td><label for="flv_starttime">{#media_dlg.flv_starttime}</label></td>
+							<td><input type="text" id="flv_starttime" name="flv_starttime" onchange="generatePreview();" /></td>
+						</tr>
+
+						<tr>
+							<td><label for="flv_defaultvolume">{#media_dlg.flv_defaultvolume}</label></td>
+							<td><input type="text" id="flv_defaultvolume" name="flv_defaultvolume" onchange="generatePreview();" /></td>
+
+
+						</tr>
+
+						<tr>
+							<td colspan="2">
+								<table border="0" cellpadding="0" cellspacing="0">
+									<tr>
+										<td><input type="checkbox" class="checkbox" id="flv_hiddengui" name="flv_hiddengui" checked="checked" onchange="generatePreview();" /></td>
+										<td><label for="flv_hiddengui">{#media_dlg.flv_hiddengui}</label></td>
+									</tr>
+								</table>
+							</td>
+
+							<td colspan="2">
+								<table border="0" cellpadding="0" cellspacing="0">
+									<tr>
+										<td><input type="checkbox" class="checkbox" id="flv_autostart" name="flv_autostart" checked="checked" onchange="generatePreview();" /></td>
+										<td><label for="flv_autostart">{#media_dlg.flv_autostart}</label></td>
+									</tr>
+								</table>
+							</td>
+						</tr>
+
+						<tr>
+							<td colspan="2">
+								<table border="0" cellpadding="0" cellspacing="0">
+									<tr>
+										<td><input type="checkbox" class="checkbox" id="flv_loop" name="flv_loop" checked="checked" onchange="generatePreview();" /></td>
+										<td><label for="flv_loop">{#media_dlg.flv_loop}</label></td>
+									</tr>
+								</table>
+							</td>
+
+							<td colspan="2">
+								<table border="0" cellpadding="0" cellspacing="0">
+									<tr>
+										<td><input type="checkbox" class="checkbox" id="flv_showscalemodes" name="flv_showscalemodes" onchange="generatePreview();" /></td>
+										<td><label for="flv_showscalemodes">{#media_dlg.flv_showscalemodes}</label></td>
+									</tr>
+								</table>
+							</td>
+						</tr>
+
+						<tr>
+							<td colspan="2">
+								<table border="0" cellpadding="0" cellspacing="0">
+									<tr>
+										<td><input type="checkbox" class="checkbox" id="flv_smoothvideo" name="flash_flv_flv_smoothvideosmoothvideo" checked="checked" onchange="generatePreview();" /></td>
+										<td><label for="flv_smoothvideo">{#media_dlg.flv_smoothvideo}</label></td>
+									</tr>
+								</table>
+							</td>
+
+							<td colspan="2">
+								<table border="0" cellpadding="0" cellspacing="0">
+									<tr>
+										<td><input type="checkbox" class="checkbox" id="flv_jscallback" name="flv_jscallback" onchange="generatePreview();" /></td>
+										<td><label for="flv_jscallback">{#media_dlg.flv_jscallback}</label></td>
+									</tr>
+								</table>
+							</td>
+						</tr>
+					</table>
+				</fieldset>
+
 				<fieldset id="qt_options">
-					<legend>{$lang_media_qt_options}</legend>
+					<legend>{#media_dlg.qt_options}</legend>
 
 					<table border="0" cellpadding="4" cellspacing="0">
 						<tr>
@@ -234,7 +333,7 @@
 								<table border="0" cellpadding="0" cellspacing="0">
 									<tr>
 										<td><input type="checkbox" class="checkbox" id="qt_loop" name="qt_loop" onchange="generatePreview();" /></td>
-										<td><label for="qt_loop">{$lang_media_loop}</label></td>
+										<td><label for="qt_loop">{#media_dlg.loop}</label></td>
 									</tr>
 								</table>
 							</td>
@@ -242,8 +341,8 @@
 							<td colspan="2">
 								<table border="0" cellpadding="0" cellspacing="0">
 									<tr>
-										<td><input type="checkbox" class="checkbox" id="qt_autoplay" name="qt_autoplay" onchange="generatePreview();" /></td>
-										<td><label for="qt_autoplay">{$lang_media_play}</label></td>
+										<td><input type="checkbox" class="checkbox" id="qt_autoplay" name="qt_autoplay" checked="checked" onchange="generatePreview();" /></td>
+										<td><label for="qt_autoplay">{#media_dlg.play}</label></td>
 									</tr>
 								</table>
 							</td>
@@ -254,7 +353,7 @@
 								<table border="0" cellpadding="0" cellspacing="0">
 									<tr>
 										<td><input type="checkbox" class="checkbox" id="qt_cache" name="qt_cache" onchange="generatePreview();" /></td>
-										<td><label for="qt_cache">{$lang_media_cache}</label></td>
+										<td><label for="qt_cache">{#media_dlg.cache}</label></td>
 									</tr>
 								</table>
 							</td>
@@ -263,7 +362,7 @@
 								<table border="0" cellpadding="0" cellspacing="0">
 									<tr>
 										<td><input type="checkbox" class="checkbox" id="qt_controller" name="qt_controller" checked="checked" onchange="generatePreview();" /></td>
-										<td><label for="qt_controller">{$lang_media_controller}</label></td>
+										<td><label for="qt_controller">{#media_dlg.controller}</label></td>
 									</tr>
 								</table>
 							</td>
@@ -274,7 +373,7 @@
 								<table border="0" cellpadding="0" cellspacing="0">
 									<tr>
 										<td><input type="checkbox" class="checkbox" id="qt_correction" name="qt_correction" onchange="generatePreview();" /></td>
-										<td><label for="qt_correction">{$lang_media_correction}</label></td>
+										<td><label for="qt_correction">{#media_dlg.correction}</label></td>
 									</tr>
 								</table>
 							</td>
@@ -283,7 +382,7 @@
 								<table border="0" cellpadding="0" cellspacing="0">
 									<tr>
 										<td><input type="checkbox" class="checkbox" id="qt_enablejavascript" name="qt_enablejavascript" onchange="generatePreview();" /></td>
-										<td><label for="qt_enablejavascript">{$lang_media_enablejavascript}</label></td>
+										<td><label for="qt_enablejavascript">{#media_dlg.enablejavascript}</label></td>
 									</tr>
 								</table>
 							</td>
@@ -294,7 +393,7 @@
 								<table border="0" cellpadding="0" cellspacing="0">
 									<tr>
 										<td><input type="checkbox" class="checkbox" id="qt_kioskmode" name="qt_kioskmode" onchange="generatePreview();" /></td>
-										<td><label for="qt_kioskmode">{$lang_media_kioskmode}</label></td>
+										<td><label for="qt_kioskmode">{#media_dlg.kioskmode}</label></td>
 									</tr>
 								</table>
 							</td>
@@ -303,7 +402,7 @@
 								<table border="0" cellpadding="0" cellspacing="0">
 									<tr>
 										<td><input type="checkbox" class="checkbox" id="qt_autohref" name="qt_autohref" onchange="generatePreview();" /></td>
-										<td><label for="qt_autohref">{$lang_media_autohref}</label></td>
+										<td><label for="qt_autohref">{#media_dlg.autohref}</label></td>
 									</tr>
 								</table>
 							</td>
@@ -314,7 +413,7 @@
 								<table border="0" cellpadding="0" cellspacing="0">
 									<tr>
 										<td><input type="checkbox" class="checkbox" id="qt_playeveryframe" name="qt_playeveryframe" onchange="generatePreview();" /></td>
-										<td><label for="qt_playeveryframe">{$lang_media_playeveryframe}</label></td>
+										<td><label for="qt_playeveryframe">{#media_dlg.playeveryframe}</label></td>
 									</tr>
 								</table>
 							</td>
@@ -323,16 +422,16 @@
 								<table border="0" cellpadding="0" cellspacing="0">
 									<tr>
 										<td><input type="checkbox" class="checkbox" id="qt_targetcache" name="qt_targetcache" onchange="generatePreview();" /></td>
-										<td><label for="qt_targetcache">{$lang_media_targetcache}</label></td>
+										<td><label for="qt_targetcache">{#media_dlg.targetcache}</label></td>
 									</tr>
 								</table>
 							</td>
 						</tr>
 
 						<tr>
-							<td><label for="qt_scale">{$lang_media_scale}</label></td>
+							<td><label for="qt_scale">{#media_dlg.scale}</label></td>
 							<td><select id="qt_scale" name="qt_scale" class="mceEditableSelect" onchange="generatePreview();">
-									<option value="">{$lang_not_set}</option> 
+									<option value="">{#not_set}</option> 
 									<option value="tofit">tofit</option>
 									<option value="aspect">aspect</option>
 								</select>
@@ -342,31 +441,31 @@
 						</tr>
 
 						<tr>
-							<td><label for="qt_starttime">{$lang_media_starttime}</label></td>
+							<td><label for="qt_starttime">{#media_dlg.starttime}</label></td>
 							<td><input type="text" id="qt_starttime" name="qt_starttime" onchange="generatePreview();" /></td>
 
-							<td><label for="qt_endtime">{$lang_media_endtime}</label></td>
+							<td><label for="qt_endtime">{#media_dlg.endtime}</label></td>
 							<td><input type="text" id="qt_endtime" name="qt_endtime" onchange="generatePreview();" /></td>
 						</tr>
 
 						<tr>
-							<td><label for="qt_target">{$lang_media_target}</label></td>
+							<td><label for="qt_target">{#media_dlg.target}</label></td>
 							<td><input type="text" id="qt_target" name="qt_target" onchange="generatePreview();" /></td>
 
-							<td><label for="qt_href">{$lang_media_href}</label></td>
+							<td><label for="qt_href">{#media_dlg.href}</label></td>
 							<td><input type="text" id="qt_href" name="qt_href" onchange="generatePreview();" /></td>
 						</tr>
 
 						<tr>
-							<td><label for="qt_qtsrcchokespeed">{$lang_media_qtsrcchokespeed}</label></td>
+							<td><label for="qt_qtsrcchokespeed">{#media_dlg.qtsrcchokespeed}</label></td>
 							<td><input type="text" id="qt_qtsrcchokespeed" name="qt_qtsrcchokespeed" onchange="generatePreview();" /></td>
 
-							<td><label for="qt_volume">{$lang_media_volume}</label></td>
+							<td><label for="qt_volume">{#media_dlg.volume}</label></td>
 							<td><input type="text" id="qt_volume" name="qt_volume" onchange="generatePreview();" /></td>
 						</tr>
 
 						<tr>
-							<td><label for="qt_qtsrc">{$lang_media_qtsrc}</label></td>
+							<td><label for="qt_qtsrc">{#media_dlg.qtsrc}</label></td>
 							<td colspan="4">
 							<table border="0" cellspacing="0" cellpadding="0">
 								  <tr>
@@ -380,7 +479,7 @@
 				</fieldset>
 
 				<fieldset id="wmp_options">
-					<legend>{$lang_media_wmp_options}</legend>
+					<legend>{#media_dlg.wmp_options}</legend>
 
 					<table border="0" cellpadding="4" cellspacing="0">
 						<tr>
@@ -388,7 +487,7 @@
 								<table border="0" cellpadding="0" cellspacing="0">
 									<tr>
 										<td><input type="checkbox" class="checkbox" id="wmp_autostart" name="wmp_autostart" checked="checked" onchange="generatePreview();" /></td>
-										<td><label for="wmp_autostart">{$lang_media_autostart}</label></td>
+										<td><label for="wmp_autostart">{#media_dlg.autostart}</label></td>
 									</tr>
 								</table>
 							</td>
@@ -397,7 +496,7 @@
 								<table border="0" cellpadding="0" cellspacing="0">
 									<tr>
 										<td><input type="checkbox" class="checkbox" id="wmp_enabled" name="wmp_enabled" onchange="generatePreview();" /></td>
-										<td><label for="wmp_enabled">{$lang_media_enabled}</label></td>
+										<td><label for="wmp_enabled">{#media_dlg.enabled}</label></td>
 									</tr>
 								</table>
 							</td>
@@ -408,7 +507,7 @@
 								<table border="0" cellpadding="0" cellspacing="0">
 									<tr>
 										<td><input type="checkbox" class="checkbox" id="wmp_enablecontextmenu" name="wmp_enablecontextmenu" checked="checked" onchange="generatePreview();" /></td>
-										<td><label for="wmp_enablecontextmenu">{$lang_media_menu}</label></td>
+										<td><label for="wmp_enablecontextmenu">{#media_dlg.menu}</label></td>
 									</tr>
 								</table>
 							</td>
@@ -417,7 +516,7 @@
 								<table border="0" cellpadding="0" cellspacing="0">
 									<tr>
 										<td><input type="checkbox" class="checkbox" id="wmp_fullscreen" name="wmp_fullscreen" onchange="generatePreview();" /></td>
-										<td><label for="wmp_fullscreen">{$lang_media_fullscreen}</label></td>
+										<td><label for="wmp_fullscreen">{#media_dlg.fullscreen}</label></td>
 									</tr>
 								</table>
 							</td>
@@ -428,7 +527,7 @@
 								<table border="0" cellpadding="0" cellspacing="0">
 									<tr>
 										<td><input type="checkbox" class="checkbox" id="wmp_invokeurls" name="wmp_invokeurls" checked="checked" onchange="generatePreview();" /></td>
-										<td><label for="wmp_invokeurls">{$lang_media_invokeurls}</label></td>
+										<td><label for="wmp_invokeurls">{#media_dlg.invokeurls}</label></td>
 									</tr>
 								</table>
 							</td>
@@ -437,7 +536,7 @@
 								<table border="0" cellpadding="0" cellspacing="0">
 									<tr>
 										<td><input type="checkbox" class="checkbox" id="wmp_mute" name="wmp_mute" onchange="generatePreview();" /></td>
-										<td><label for="wmp_mute">{$lang_media_mute}</label></td>
+										<td><label for="wmp_mute">{#media_dlg.mute}</label></td>
 									</tr>
 								</table>
 							</td>
@@ -448,7 +547,7 @@
 								<table border="0" cellpadding="0" cellspacing="0">
 									<tr>
 										<td><input type="checkbox" class="checkbox" id="wmp_stretchtofit" name="wmp_stretchtofit" onchange="generatePreview();" /></td>
-										<td><label for="wmp_stretchtofit">{$lang_media_stretchtofit}</label></td>
+										<td><label for="wmp_stretchtofit">{#media_dlg.stretchtofit}</label></td>
 									</tr>
 								</table>
 							</td>
@@ -457,49 +556,49 @@
 								<table border="0" cellpadding="0" cellspacing="0">
 									<tr>
 										<td><input type="checkbox" class="checkbox" id="wmp_windowlessvideo" name="wmp_windowlessvideo" onchange="generatePreview();" /></td>
-										<td><label for="wmp_windowlessvideo">{$lang_media_windowlessvideo}</label></td>
+										<td><label for="wmp_windowlessvideo">{#media_dlg.windowlessvideo}</label></td>
 									</tr>
 								</table>
 							</td>
 						</tr>
 
 						<tr>
-							<td><label for="wmp_balance">{$lang_media_balance}</label></td>
+							<td><label for="wmp_balance">{#media_dlg.balance}</label></td>
 							<td><input type="text" id="wmp_balance" name="wmp_balance" onchange="generatePreview();" /></td>
 
-							<td><label for="wmp_baseurl">{$lang_media_baseurl}</label></td>
+							<td><label for="wmp_baseurl">{#media_dlg.baseurl}</label></td>
 							<td><input type="text" id="wmp_baseurl" name="wmp_baseurl" onchange="generatePreview();" /></td>
 						</tr>
 
 						<tr>
-							<td><label for="wmp_captioningid">{$lang_media_captioningid}</label></td>
+							<td><label for="wmp_captioningid">{#media_dlg.captioningid}</label></td>
 							<td><input type="text" id="wmp_captioningid" name="wmp_captioningid" onchange="generatePreview();" /></td>
 
-							<td><label for="wmp_currentmarker">{$lang_media_currentmarker}</label></td>
+							<td><label for="wmp_currentmarker">{#media_dlg.currentmarker}</label></td>
 							<td><input type="text" id="wmp_currentmarker" name="wmp_currentmarker" onchange="generatePreview();" /></td>
 						</tr>
 
 						<tr>
-							<td><label for="wmp_currentposition">{$lang_media_currentposition}</label></td>
+							<td><label for="wmp_currentposition">{#media_dlg.currentposition}</label></td>
 							<td><input type="text" id="wmp_currentposition" name="wmp_currentposition" onchange="generatePreview();" /></td>
 
-							<td><label for="wmp_defaultframe">{$lang_media_defaultframe}</label></td>
+							<td><label for="wmp_defaultframe">{#media_dlg.defaultframe}</label></td>
 							<td><input type="text" id="wmp_defaultframe" name="wmp_defaultframe" onchange="generatePreview();" /></td>
 						</tr>
 
 						<tr>
-							<td><label for="wmp_playcount">{$lang_media_playcount}</label></td>
+							<td><label for="wmp_playcount">{#media_dlg.playcount}</label></td>
 							<td><input type="text" id="wmp_playcount" name="wmp_playcount" onchange="generatePreview();" /></td>
 
-							<td><label for="wmp_rate">{$lang_media_rate}</label></td>
+							<td><label for="wmp_rate">{#media_dlg.rate}</label></td>
 							<td><input type="text" id="wmp_rate" name="wmp_rate" onchange="generatePreview();" /></td>
 						</tr>
 
 						<tr>
-							<td><label for="wmp_uimode">{$lang_media_uimode}</label></td>
+							<td><label for="wmp_uimode">{#media_dlg.uimode}</label></td>
 							<td><input type="text" id="wmp_uimode" name="wmp_uimode" onchange="generatePreview();" /></td>
 
-							<td><label for="wmp_volume">{$lang_media_volume}</label></td>
+							<td><label for="wmp_volume">{#media_dlg.volume}</label></td>
 							<td><input type="text" id="wmp_volume" name="wmp_volume" onchange="generatePreview();" /></td>
 						</tr>
 
@@ -507,7 +606,7 @@
 				</fieldset>
 
 				<fieldset id="rmp_options">
-					<legend>{$lang_media_rmp_options}</legend>
+					<legend>{#media_dlg.rmp_options}</legend>
 
 					<table border="0" cellpadding="4" cellspacing="0">
 						<tr>
@@ -515,7 +614,7 @@
 								<table border="0" cellpadding="0" cellspacing="0">
 									<tr>
 										<td><input type="checkbox" class="checkbox" id="rmp_autostart" name="rmp_autostart" onchange="generatePreview();" /></td>
-										<td><label for="rmp_autostart">{$lang_media_autostart}</label></td>
+										<td><label for="rmp_autostart">{#media_dlg.autostart}</label></td>
 									</tr>
 								</table>
 							</td>
@@ -524,7 +623,7 @@
 								<table border="0" cellpadding="0" cellspacing="0">
 									<tr>
 										<td><input type="checkbox" class="checkbox" id="rmp_loop" name="rmp_loop" onchange="generatePreview();" /></td>
-										<td><label for="rmp_loop">{$lang_media_loop}</label></td>
+										<td><label for="rmp_loop">{#media_dlg.loop}</label></td>
 									</tr>
 								</table>
 							</td>
@@ -535,7 +634,7 @@
 								<table border="0" cellpadding="0" cellspacing="0">
 									<tr>
 										<td><input type="checkbox" class="checkbox" id="rmp_autogotourl" name="rmp_autogotourl" checked="checked" onchange="generatePreview();" /></td>
-										<td><label for="rmp_autogotourl">{$lang_media_autogotourl}</label></td>
+										<td><label for="rmp_autogotourl">{#media_dlg.autogotourl}</label></td>
 									</tr>
 								</table>
 							</td>
@@ -544,7 +643,7 @@
 								<table border="0" cellpadding="0" cellspacing="0">
 									<tr>
 										<td><input type="checkbox" class="checkbox" id="rmp_center" name="rmp_center" onchange="generatePreview();" /></td>
-										<td><label for="rmp_center">{$lang_media_center}</label></td>
+										<td><label for="rmp_center">{#media_dlg.center}</label></td>
 									</tr>
 								</table>
 							</td>
@@ -555,7 +654,7 @@
 								<table border="0" cellpadding="0" cellspacing="0">
 									<tr>
 										<td><input type="checkbox" class="checkbox" id="rmp_imagestatus" name="rmp_imagestatus" checked="checked" onchange="generatePreview();" /></td>
-										<td><label for="rmp_imagestatus">{$lang_media_imagestatus}</label></td>
+										<td><label for="rmp_imagestatus">{#media_dlg.imagestatus}</label></td>
 									</tr>
 								</table>
 							</td>
@@ -564,7 +663,7 @@
 								<table border="0" cellpadding="0" cellspacing="0">
 									<tr>
 										<td><input type="checkbox" class="checkbox" id="rmp_maintainaspect" name="rmp_maintainaspect" onchange="generatePreview();" /></td>
-										<td><label for="rmp_maintainaspect">{$lang_media_maintainaspect}</label></td>
+										<td><label for="rmp_maintainaspect">{#media_dlg.maintainaspect}</label></td>
 									</tr>
 								</table>
 							</td>
@@ -575,7 +674,7 @@
 								<table border="0" cellpadding="0" cellspacing="0">
 									<tr>
 										<td><input type="checkbox" class="checkbox" id="rmp_nojava" name="rmp_nojava" onchange="generatePreview();" /></td>
-										<td><label for="rmp_nojava">{$lang_media_nojava}</label></td>
+										<td><label for="rmp_nojava">{#media_dlg.nojava}</label></td>
 									</tr>
 								</table>
 							</td>
@@ -584,7 +683,7 @@
 								<table border="0" cellpadding="0" cellspacing="0">
 									<tr>
 										<td><input type="checkbox" class="checkbox" id="rmp_prefetch" name="rmp_prefetch" onchange="generatePreview();" /></td>
-										<td><label for="rmp_prefetch">{$lang_media_prefetch}</label></td>
+										<td><label for="rmp_prefetch">{#media_dlg.prefetch}</label></td>
 									</tr>
 								</table>
 							</td>
@@ -595,7 +694,7 @@
 								<table border="0" cellpadding="0" cellspacing="0">
 									<tr>
 										<td><input type="checkbox" class="checkbox" id="rmp_shuffle" name="rmp_shuffle" onchange="generatePreview();" /></td>
-										<td><label for="rmp_shuffle">{$lang_media_shuffle}</label></td>
+										<td><label for="rmp_shuffle">{#media_dlg.shuffle}</label></td>
 									</tr>
 								</table>
 							</td>
@@ -606,60 +705,60 @@
 						</tr>
 
 						<tr>
-							<td><label for="rmp_console">{$lang_media_console}</label></td>
+							<td><label for="rmp_console">{#media_dlg.console}</label></td>
 							<td><input type="text" id="rmp_console" name="rmp_console" onchange="generatePreview();" /></td>
 
-							<td><label for="rmp_controls">{$lang_media_controls}</label></td>
+							<td><label for="rmp_controls">{#media_dlg.controls}</label></td>
 							<td><input type="text" id="rmp_controls" name="rmp_controls" onchange="generatePreview();" /></td>
 						</tr>
 
 						<tr>
-							<td><label for="rmp_numloop">{$lang_media_numloop}</label></td>
+							<td><label for="rmp_numloop">{#media_dlg.numloop}</label></td>
 							<td><input type="text" id="rmp_numloop" name="rmp_numloop" onchange="generatePreview();" /></td>
 
-							<td><label for="rmp_scriptcallbacks">{$lang_media_scriptcallbacks}</label></td>
+							<td><label for="rmp_scriptcallbacks">{#media_dlg.scriptcallbacks}</label></td>
 							<td><input type="text" id="rmp_scriptcallbacks" name="rmp_scriptcallbacks" onchange="generatePreview();" /></td>
 						</tr>
 					</table>
 				</fieldset>
 
 				<fieldset id="shockwave_options">
-					<legend>{$lang_media_shockwave_options}</legend>
+					<legend>{#media_dlg.shockwave_options}</legend>
 
 					<table border="0" cellpadding="4" cellspacing="0">
 						<tr>
-							<td><label for="shockwave_swstretchstyle">{$lang_media_swstretchstyle}</label></td>
+							<td><label for="shockwave_swstretchstyle">{#media_dlg.swstretchstyle}</label></td>
 							<td>
 								<select id="shockwave_swstretchstyle" name="shockwave_swstretchstyle" onchange="generatePreview();">
-									<option value="none">None</option>
+									<option value="none">{#not_set}</option>
 									<option value="meet">Meet</option>
 									<option value="fill">Fill</option>
 									<option value="stage">Stage</option>
 								</select>
 							</td>
 
-							<td><label for="shockwave_swvolume">{$lang_media_volume}</label></td>
+							<td><label for="shockwave_swvolume">{#media_dlg.volume}</label></td>
 							<td><input type="text" id="shockwave_swvolume" name="shockwave_swvolume" onchange="generatePreview();" /></td>
 						</tr>
 
 						<tr>
-							<td><label for="shockwave_swstretchhalign">{$lang_media_swstretchhalign}</label></td>
+							<td><label for="shockwave_swstretchhalign">{#media_dlg.swstretchhalign}</label></td>
 							<td>
 								<select id="shockwave_swstretchhalign" name="shockwave_swstretchhalign" onchange="generatePreview();">
-									<option value="none">None</option>
-									<option value="left">left</option>
-									<option value="center">center</option>
-									<option value="right">right</option>
+									<option value="none">{#not_set}</option>
+									<option value="left">{#media_dlg.align_left}</option>
+									<option value="center">{#media_dlg.align_center}</option>
+									<option value="right">{#media_dlg.align_right}</option>
 								</select>
 							</td>
 
-							<td><label for="shockwave_swstretchvalign">{$lang_media_swstretchvalign}</label></td>
+							<td><label for="shockwave_swstretchvalign">{#media_dlg.swstretchvalign}</label></td>
 							<td>
 								<select id="shockwave_swstretchvalign" name="shockwave_swstretchvalign" onchange="generatePreview();">
-									<option value="none">None</option>
-									<option value="meet">Top</option>
-									<option value="fill">Center</option>
-									<option value="stage">Bottom</option>
+									<option value="none">{#not_set}</option>
+									<option value="meet">Meet</option>
+									<option value="fill">Fill</option>
+									<option value="stage">Stage</option>
 								</select>
 							</td>
 						</tr>
@@ -669,7 +768,7 @@
 								<table border="0" cellpadding="0" cellspacing="0">
 									<tr>
 										<td><input type="checkbox" class="checkbox" id="shockwave_autostart" name="shockwave_autostart" onchange="generatePreview();" checked="checked" /></td>
-										<td><label for="shockwave_autostart">{$lang_media_autostart}</label></td>
+										<td><label for="shockwave_autostart">{#media_dlg.autostart}</label></td>
 									</tr>
 								</table>
 							</td>
@@ -678,7 +777,7 @@
 								<table border="0" cellpadding="0" cellspacing="0">
 									<tr>
 										<td><input type="checkbox" class="checkbox" id="shockwave_sound" name="shockwave_sound" onchange="generatePreview();" checked="checked" /></td>
-										<td><label for="shockwave_sound">{$lang_media_sound}</label></td>
+										<td><label for="shockwave_sound">{#media_dlg.sound}</label></td>
 									</tr>
 								</table>
 							</td>
@@ -690,7 +789,7 @@
 								<table border="0" cellpadding="0" cellspacing="0">
 									<tr>
 										<td><input type="checkbox" class="checkbox" id="shockwave_swliveconnect" name="shockwave_swliveconnect" onchange="generatePreview();" /></td>
-										<td><label for="shockwave_swliveconnect">{$lang_media_liveconnect}</label></td>
+										<td><label for="shockwave_swliveconnect">{#media_dlg.liveconnect}</label></td>
 									</tr>
 								</table>
 							</td>
@@ -699,7 +798,7 @@
 								<table border="0" cellpadding="0" cellspacing="0">
 									<tr>
 										<td><input type="checkbox" class="checkbox" id="shockwave_progress" name="shockwave_progress" onchange="generatePreview();" checked="checked" /></td>
-										<td><label for="shockwave_progress">{$lang_media_progress}</label></td>
+										<td><label for="shockwave_progress">{#media_dlg.progress}</label></td>
 									</tr>
 								</table>
 							</td>
@@ -711,11 +810,11 @@
 
 		<div class="mceActionPanel">
 			<div style="float: left">
-				<input type="button" id="insert" name="insert" value="{$lang_insert}" onclick="insertMedia();" />
+				<input type="submit" id="insert" name="insert" value="{#insert}" />
 			</div>
 
 			<div style="float: right">
-				<input type="button" id="cancel" name="cancel" value="{$lang_cancel}" onclick="tinyMCEPopup.close();" />
+				<input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />
 			</div>
 		</div>
 	</form>
diff -x .svn -aruN 0.7.15.src/e107_handlers/tiny_mce/plugins/table/cell.htm 0.7.16.src/e107_handlers/tiny_mce/plugins/table/cell.htm
--- 0.7.15.src/e107_handlers/tiny_mce/plugins/table/cell.htm	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_handlers/tiny_mce/plugins/table/cell.htm	2009-06-30 19:36:49.000000000 -0500
@@ -1,85 +1,86 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
 <html xmlns="http://www.w3.org/1999/xhtml">
 <head>
-	<title>{$lang_table_cell_title}</title>
-	<script language="javascript" type="text/javascript" src="../../tiny_mce_popup.js"></script>
-	<script language="javascript" type="text/javascript" src="../../utils/mctabs.js"></script>
-	<script language="javascript" type="text/javascript" src="../../utils/form_utils.js"></script>
-	<script language="javascript" type="text/javascript" src="jscripts/cell.js"></script>
+	<title>{#table_dlg.cell_title}</title>
+	<script type="text/javascript" src="../../tiny_mce_popup.js"></script>
+	<script type="text/javascript" src="../../utils/mctabs.js"></script>
+	<script type="text/javascript" src="../../utils/form_utils.js"></script>
+	<script type="text/javascript" src="../../utils/editable_selects.js"></script>
+	<script type="text/javascript" src="js/cell.js"></script>
 	<link href="css/cell.css" rel="stylesheet" type="text/css" />
-	<base target="_self" />
 </head>
-<body id="tablecell" onload="tinyMCEPopup.executeOnLoad('init();');" style="display: none">
+<body id="tablecell" style="display: none">
 	<form onsubmit="updateAction();return false;" action="#">
 		<div class="tabs">
 			<ul>
-				<li id="general_tab" class="current"><span><a href="javascript:mcTabs.displayTab('general_tab','general_panel');" onmousedown="return false;">{$lang_table_general_tab}</a></span></li>
-				<li id="advanced_tab"><span><a href="javascript:mcTabs.displayTab('advanced_tab','advanced_panel');" onmousedown="return false;">{$lang_table_advanced_tab}</a></span></li>
+				<li id="general_tab" class="current"><span><a href="javascript:mcTabs.displayTab('general_tab','general_panel');" onmousedown="return false;">{#table_dlg.general_tab}</a></span></li>
+				<li id="advanced_tab"><span><a href="javascript:mcTabs.displayTab('advanced_tab','advanced_panel');" onmousedown="return false;">{#table_dlg.advanced_tab}</a></span></li>
 			</ul>
 		</div>
 
 		<div class="panel_wrapper">
 			<div id="general_panel" class="panel current">
 				<fieldset>
-					<legend>{$lang_table_general_props}</legend>
+					<legend>{#table_dlg.general_props}</legend>
 
 					<table border="0" cellpadding="4" cellspacing="0">
 						<tr>
-							<td><label for="align">{$lang_table_align}</label></td>
+							<td><label for="align">{#table_dlg.align}</label></td>
 							<td>
-								<select id="align" name="align">
-									<option value="">{$lang_not_set}</option>
-									<option value="center">{$lang_table_align_middle}</option>
-									<option value="left">{$lang_table_align_left}</option>
-									<option value="right">{$lang_table_align_right}</option>
+								<select id="align" name="align" class="mceFocus">
+									<option value="">{#not_set}</option>
+									<option value="center">{#table_dlg.align_middle}</option>
+									<option value="left">{#table_dlg.align_left}</option>
+									<option value="right">{#table_dlg.align_right}</option>
 								</select>
 							</td>
 		
-							<td><label for="celltype">{$lang_table_cell_type}</label></td>
+							<td><label for="celltype">{#table_dlg.cell_type}</label></td>
 							<td>
 								<select id="celltype" name="celltype">
-									<option value="td">{$lang_table_td}</option>
-									<option value="th">{$lang_table_th}</option>
+									<option value="td">{#table_dlg.td}</option>
+									<option value="th">{#table_dlg.th}</option>
 								</select>
 							</td>
 						</tr>
 
 						<tr>
-							<td><label for="valign">{$lang_table_valign}</label></td>
+							<td><label for="valign">{#table_dlg.valign}</label></td>
 							<td>
 								<select id="valign" name="valign">
-									<option value="">{$lang_not_set}</option>
-									<option value="top">{$lang_table_align_top}</option>
-									<option value="middle">{$lang_table_align_middle}</option>
-									<option value="bottom">{$lang_table_align_bottom}</option>
+									<option value="">{#not_set}</option>
+									<option value="top">{#table_dlg.align_top}</option>
+									<option value="middle">{#table_dlg.align_middle}</option>
+									<option value="bottom">{#table_dlg.align_bottom}</option>
 								</select>
 							</td>
 
-							<td><label for="scope">{$lang_table_scope}</label></td>
+							<td><label for="scope">{#table_dlg.scope}</label></td>
 							<td>
 								<select id="scope" name="scope">
-									<option value="">{$lang_not_set}</option>
-									<option value="col">{$lang_table_col}</option>
-									<option value="row">{$lang_table_row}</option>
-									<option value="rowgroup">{$lang_table_rowgroup}</option>
-									<option value="colgroup">{$lang_table_colgroup}</option>
+									<option value="">{#not_set}</option>
+									<option value="col">{#table.col}</option>
+									<option value="row">{#table.row}</option>
+									<option value="rowgroup">{#table_dlg.rowgroup}</option>
+									<option value="colgroup">{#table_dlg.colgroup}</option>
 								</select>
 							</td>
 
 						</tr>
 
 						<tr>
-							<td><label for="width">{$lang_table_width}</label></td>
+							<td><label for="width">{#table_dlg.width}</label></td>
 							<td><input id="width" name="width" type="text" value="" size="4" maxlength="4" onchange="changedSize();" /></td>
 
-							<td><label for="height">{$lang_table_height}</label></td>
+							<td><label for="height">{#table_dlg.height}</label></td>
 							<td><input id="height" name="height" type="text" value="" size="4" maxlength="4" onchange="changedSize();" /></td>
 						</tr>
 
 						<tr id="styleSelectRow">
-							<td><label for="class">{$lang_class_name}</label></td>
+							<td><label for="class">{#class_name}</label></td>
 							<td colspan="3">
-								<select id="class" name="class">
-									<option value="" selected="selected">{$lang_not_set}</option>
+								<select id="class" name="class" class="mceEditableSelect">
+									<option value="" selected="selected">{#not_set}</option>
 								</select>
 							</td>
 						</tr>
@@ -89,39 +90,39 @@
 
 			<div id="advanced_panel" class="panel">
 				<fieldset>
-					<legend>{$lang_table_advanced_props}</legend>
+					<legend>{#table_dlg.advanced_props}</legend>
 
 					<table border="0" cellpadding="0" cellspacing="4">
 						<tr>
-							<td class="column1"><label for="id">{$lang_table_id}</label></td> 
+							<td class="column1"><label for="id">{#table_dlg.id}</label></td> 
 							<td><input id="id" name="id" type="text" value="" style="width: 200px" /></td> 
 						</tr>
 
 						<tr>
-							<td><label for="style">{$lang_table_style}</label></td>
+							<td><label for="style">{#table_dlg.style}</label></td>
 							<td><input type="text" id="style" name="style" value="" style="width: 200px;" onchange="changedStyle();" /></td>
 						</tr>
 
 						<tr>
-							<td class="column1"><label for="dir">{$lang_table_langdir}</label></td> 
+							<td class="column1"><label for="dir">{#table_dlg.langdir}</label></td> 
 							<td>
 								<select id="dir" name="dir" style="width: 200px"> 
-										<option value="">{$lang_not_set}</option> 
-										<option value="ltr">{$lang_table_ltr}</option> 
-										<option value="rtl">{$lang_table_rtl}</option> 
+										<option value="">{#not_set}</option> 
+										<option value="ltr">{#table_dlg.ltr}</option> 
+										<option value="rtl">{#table_dlg.rtl}</option> 
 								</select>
 							</td> 
 						</tr>
 
 						<tr>
-							<td class="column1"><label for="lang">{$lang_table_langcode}</label></td> 
+							<td class="column1"><label for="lang">{#table_dlg.langcode}</label></td> 
 							<td>
 								<input id="lang" name="lang" type="text" value="" style="width: 200px" />
 							</td> 
 						</tr>
 
 						<tr>
-							<td class="column1"><label for="backgroundimage">{$lang_table_bgimage}</label></td> 
+							<td class="column1"><label for="backgroundimage">{#table_dlg.bgimage}</label></td> 
 							<td>
 								<table border="0" cellpadding="0" cellspacing="0">
 									<tr>
@@ -133,7 +134,7 @@
 						</tr>
 
 						<tr>
-							<td class="column1"><label for="bordercolor">{$lang_table_bordercolor}</label></td> 
+							<td class="column1"><label for="bordercolor">{#table_dlg.bordercolor}</label></td> 
 							<td>
 								<table border="0" cellpadding="0" cellspacing="0">
 									<tr>
@@ -145,7 +146,7 @@
 						</tr>
 
 						<tr>
-							<td class="column1"><label for="bgcolor">{$lang_table_bgcolor}</label></td> 
+							<td class="column1"><label for="bgcolor">{#table_dlg.bgcolor}</label></td> 
 							<td>
 								<table border="0" cellpadding="0" cellspacing="0">
 									<tr>
@@ -163,18 +164,18 @@
 		<div class="mceActionPanel">
 			<div>
 				<select id="action" name="action">
-					<option value="cell">{$lang_table_cell_cell}</option>
-					<option value="row">{$lang_table_cell_row}</option>
-					<option value="all">{$lang_table_cell_all}</option>
+					<option value="cell">{#table_dlg.cell_cell}</option>
+					<option value="row">{#table_dlg.cell_row}</option>
+					<option value="all">{#table_dlg.cell_all}</option>
 				</select>
 			</div>
 
 			<div style="float: left">
-				<div><input type="button" id="insert" name="insert" value="{$lang_update}" onclick="updateAction();" /></div>
+				<div><input type="submit" id="insert" name="insert" value="{#update}" /></div>
 			</div>
 
 			<div style="float: right">
-				<input type="button" id="cancel" name="cancel" value="{$lang_cancel}" onclick="tinyMCEPopup.close();" />
+				<input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />
 			</div>
 		</div>
 	</form>
diff -x .svn -aruN 0.7.15.src/e107_handlers/tiny_mce/plugins/table/css/table.css 0.7.16.src/e107_handlers/tiny_mce/plugins/table/css/table.css
--- 0.7.15.src/e107_handlers/tiny_mce/plugins/table/css/table.css	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_handlers/tiny_mce/plugins/table/css/table.css	2009-06-30 19:36:49.000000000 -0500
@@ -1,7 +1,7 @@
 /* CSS file for table dialog in the table plugin */
 
 .panel_wrapper div.current {
-	height: 220px;
+	height: 245px;
 }
 
 .advfield {
diff -x .svn -aruN 0.7.15.src/e107_handlers/tiny_mce/plugins/table/editor_plugin.js 0.7.16.src/e107_handlers/tiny_mce/plugins/table/editor_plugin.js
--- 0.7.15.src/e107_handlers/tiny_mce/plugins/table/editor_plugin.js	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_handlers/tiny_mce/plugins/table/editor_plugin.js	2009-06-30 19:36:49.000000000 -0500
@@ -1 +1 @@
-tinyMCE.importPluginLanguagePack('table');var TinyMCE_TablePlugin={getInfo:function(){return{longname:'Tables',author:'Moxiecode Systems AB',authorurl:'http://tinymce.moxiecode.com',infourl:'http://tinymce.moxiecode.com/tinymce/docs/plugin_table.html',version:tinyMCE.majorVersion+"."+tinyMCE.minorVersion}},initInstance:function(inst){if(tinyMCE.isGecko){var doc=inst.getDoc();tinyMCE.addEvent(doc,"mouseup",TinyMCE_TablePlugin._mouseDownHandler)}inst.tableRowClipboard=null},getControlHTML:function(control_name){var controls=new Array(['table','table.gif','lang_table_desc','mceInsertTable',true],['delete_table','table_delete.gif','lang_table_del','mceTableDelete'],['delete_col','table_delete_col.gif','lang_table_delete_col_desc','mceTableDeleteCol'],['delete_row','table_delete_row.gif','lang_table_delete_row_desc','mceTableDeleteRow'],['col_after','table_insert_col_after.gif','lang_table_col_after_desc','mceTableInsertColAfter'],['col_before','table_insert_col_before.gif','lang_table_col_before_desc','mceTableInsertColBefore'],['row_after','table_insert_row_after.gif','lang_table_row_after_desc','mceTableInsertRowAfter'],['row_before','table_insert_row_before.gif','lang_table_row_before_desc','mceTableInsertRowBefore'],['row_props','table_row_props.gif','lang_table_row_desc','mceTableRowProps',true],['cell_props','table_cell_props.gif','lang_table_cell_desc','mceTableCellProps',true],['split_cells','table_split_cells.gif','lang_table_split_cells_desc','mceTableSplitCells',true],['merge_cells','table_merge_cells.gif','lang_table_merge_cells_desc','mceTableMergeCells',true]);for(var i=0;i<controls.length;i++){var but=controls[i];var cmd='tinyMCE.execInstanceCommand(\'{$editor_id}\',\''+but[3]+'\', '+(but.length>4?but[4]:false)+(but.length>5?', \''+but[5]+'\'':'')+');return false;';if(but[0]==control_name)return tinyMCE.getButtonHTML(control_name,but[2],'{$pluginurl}/images/'+but[1],but[3],(but.length>4?but[4]:false))}if(control_name=="tablecontrols"){var html="";html+=tinyMCE.getControlHTML("table");html+=tinyMCE.getControlHTML("separator");html+=tinyMCE.getControlHTML("row_props");html+=tinyMCE.getControlHTML("cell_props");html+=tinyMCE.getControlHTML("separator");html+=tinyMCE.getControlHTML("row_before");html+=tinyMCE.getControlHTML("row_after");html+=tinyMCE.getControlHTML("delete_row");html+=tinyMCE.getControlHTML("separator");html+=tinyMCE.getControlHTML("col_before");html+=tinyMCE.getControlHTML("col_after");html+=tinyMCE.getControlHTML("delete_col");html+=tinyMCE.getControlHTML("separator");html+=tinyMCE.getControlHTML("split_cells");html+=tinyMCE.getControlHTML("merge_cells");return html}return""},execCommand:function(editor_id,element,command,user_interface,value){switch(command){case"mceInsertTable":case"mceTableRowProps":case"mceTableCellProps":case"mceTableSplitCells":case"mceTableMergeCells":case"mceTableInsertRowBefore":case"mceTableInsertRowAfter":case"mceTableDeleteRow":case"mceTableInsertColBefore":case"mceTableInsertColAfter":case"mceTableDeleteCol":case"mceTableCutRow":case"mceTableCopyRow":case"mceTablePasteRowBefore":case"mceTablePasteRowAfter":case"mceTableDelete":var inst=tinyMCE.getInstanceById(editor_id);inst.execCommand('mceBeginUndoLevel');TinyMCE_TablePlugin._doExecCommand(editor_id,element,command,user_interface,value);inst.execCommand('mceEndUndoLevel');return true}return false},handleNodeChange:function(editor_id,node,undo_index,undo_levels,visual_aid,any_selection){var colspan="1",rowspan="1",tdElm;var inst=tinyMCE.getInstanceById(editor_id);tinyMCE.switchClass(editor_id+'_table','mceButtonNormal');tinyMCE.switchClass(editor_id+'_delete_table','mceButtonDisabled');tinyMCE.switchClass(editor_id+'_row_props','mceButtonDisabled');tinyMCE.switchClass(editor_id+'_cell_props','mceButtonDisabled');tinyMCE.switchClass(editor_id+'_row_before','mceButtonDisabled');tinyMCE.switchClass(editor_id+'_row_after','mceButtonDisabled');tinyMCE.switchClass(editor_id+'_delete_row','mceButtonDisabled');tinyMCE.switchClass(editor_id+'_col_before','mceButtonDisabled');tinyMCE.switchClass(editor_id+'_col_after','mceButtonDisabled');tinyMCE.switchClass(editor_id+'_delete_col','mceButtonDisabled');tinyMCE.switchClass(editor_id+'_split_cells','mceButtonDisabled');tinyMCE.switchClass(editor_id+'_merge_cells','mceButtonDisabled');if(tdElm=tinyMCE.getParentElement(node,"td,th")){tinyMCE.switchClass(editor_id+'_cell_props','mceButtonSelected');tinyMCE.switchClass(editor_id+'_delete_table','mceButtonNormal');tinyMCE.switchClass(editor_id+'_row_before','mceButtonNormal');tinyMCE.switchClass(editor_id+'_row_after','mceButtonNormal');tinyMCE.switchClass(editor_id+'_delete_row','mceButtonNormal');tinyMCE.switchClass(editor_id+'_col_before','mceButtonNormal');tinyMCE.switchClass(editor_id+'_col_after','mceButtonNormal');tinyMCE.switchClass(editor_id+'_delete_col','mceButtonNormal');colspan=tinyMCE.getAttrib(tdElm,"colspan");rowspan=tinyMCE.getAttrib(tdElm,"rowspan");colspan=colspan==""?"1":colspan;rowspan=rowspan==""?"1":rowspan;if(colspan!="1"||rowspan!="1")tinyMCE.switchClass(editor_id+'_split_cells','mceButtonNormal')}if(tinyMCE.getParentElement(node,"tr"))tinyMCE.switchClass(editor_id+'_row_props','mceButtonSelected');if(tinyMCE.getParentElement(node,"table")){tinyMCE.switchClass(editor_id+'_table','mceButtonSelected');tinyMCE.switchClass(editor_id+'_merge_cells','mceButtonNormal')}},_mouseDownHandler:function(e){var elm=tinyMCE.isMSIE?event.srcElement:e.target;var focusElm=tinyMCE.selectedInstance.getFocusElement();if(elm.nodeName=="BODY"&&(focusElm.nodeName=="TD"||focusElm.nodeName=="TH"||(focusElm.parentNode&&focusElm.parentNode.nodeName=="TD")||(focusElm.parentNode&&focusElm.parentNode.nodeName=="TH"))){window.setTimeout(function(){var tableElm=tinyMCE.getParentElement(focusElm,"table");tinyMCE.handleVisualAid(tableElm,true,tinyMCE.settings['visual'],tinyMCE.selectedInstance)},10)}},_doExecCommand:function(editor_id,element,command,user_interface,value){var inst=tinyMCE.getInstanceById(editor_id);var focusElm=inst.getFocusElement();var trElm=tinyMCE.getParentElement(focusElm,"tr");var tdElm=tinyMCE.getParentElement(focusElm,"td,th");var tableElm=tinyMCE.getParentElement(focusElm,"table");var doc=inst.contentWindow.document;var tableBorder=tableElm?tableElm.getAttribute("border"):"";if(trElm&&tdElm==null)tdElm=trElm.cells[0];function inArray(ar,v){for(var i=0;i<ar.length;i++){if(ar[i].length>0&&inArray(ar[i],v))return true;if(ar[i]==v)return true}return false}function makeTD(){var newTD=doc.createElement("td");newTD.innerHTML="&nbsp;"}function getColRowSpan(td){var colspan=tinyMCE.getAttrib(td,"colspan");var rowspan=tinyMCE.getAttrib(td,"rowspan");colspan=colspan==""?1:parseInt(colspan);rowspan=rowspan==""?1:parseInt(rowspan);return{colspan:colspan,rowspan:rowspan}}function getCellPos(grid,td){var x,y;for(y=0;y<grid.length;y++){for(x=0;x<grid[y].length;x++){if(grid[y][x]==td)return{cellindex:x,rowindex:y}}}return null}function getCell(grid,row,col){if(grid[row]&&grid[row][col])return grid[row][col];return null}function getTableGrid(table){var grid=new Array(),rows=table.rows,x,y,td,sd,xstart,x2,y2;for(y=0;y<rows.length;y++){for(x=0;x<rows[y].cells.length;x++){td=rows[y].cells[x];sd=getColRowSpan(td);for(xstart=x;grid[y]&&grid[y][xstart];xstart++);for(y2=y;y2<y+sd['rowspan'];y2++){if(!grid[y2])grid[y2]=new Array();for(x2=xstart;x2<xstart+sd['colspan'];x2++)grid[y2][x2]=td}}}return grid}function trimRow(table,tr,td,new_tr){var grid=getTableGrid(table),cpos=getCellPos(grid,td);var cells,lastElm;if(new_tr.cells.length!=tr.childNodes.length){cells=tr.childNodes;lastElm=null;for(var x=0;td=getCell(grid,cpos.rowindex,x);x++){var remove=true;var sd=getColRowSpan(td);if(inArray(cells,td)){new_tr.childNodes[x]._delete=true}else if((lastElm==null||td!=lastElm)&&sd.colspan>1){for(var i=x;i<x+td.colSpan;i++)new_tr.childNodes[i]._delete=true}if((lastElm==null||td!=lastElm)&&sd.rowspan>1)td.rowSpan=sd.rowspan+1;lastElm=td}deleteMarked(tableElm)}}function prevElm(node,name){while((node=node.previousSibling)!=null){if(node.nodeName==name)return node}return null}function nextElm(node,names){var namesAr=names.split(',');while((node=node.nextSibling)!=null){for(var i=0;i<namesAr.length;i++){if(node.nodeName.toLowerCase()==namesAr[i].toLowerCase())return node}}return null}function deleteMarked(tbl){if(tbl.rows==0)return;var tr=tbl.rows[0];do{var next=nextElm(tr,"TR");if(tr._delete){tr.parentNode.removeChild(tr);continue}var td=tr.cells[0];if(td.cells>1){do{var nexttd=nextElm(td,"TD,TH");if(td._delete)td.parentNode.removeChild(td)}while((td=nexttd)!=null)}}while((tr=next)!=null)}function addRows(td_elm,tr_elm,rowspan){td_elm.rowSpan=1;var trNext=nextElm(tr_elm,"TR");for(var i=1;i<rowspan&&trNext;i++){var newTD=doc.createElement("td");newTD.innerHTML="&nbsp;";if(tinyMCE.isMSIE)trNext.insertBefore(newTD,trNext.cells(td_elm.cellIndex));else trNext.insertBefore(newTD,trNext.cells[td_elm.cellIndex]);trNext=nextElm(trNext,"TR")}}function copyRow(doc,table,tr){var grid=getTableGrid(table);var newTR=tr.cloneNode(false);var cpos=getCellPos(grid,tr.cells[0]);var lastCell=null;var tableBorder=tinyMCE.getAttrib(table,"border");var tdElm=null;for(var x=0;tdElm=getCell(grid,cpos.rowindex,x);x++){var newTD=null;if(lastCell!=tdElm){for(var i=0;i<tr.cells.length;i++){if(tdElm==tr.cells[i]){newTD=tdElm.cloneNode(true);break}}}if(newTD==null){newTD=doc.createElement("td");newTD.innerHTML="&nbsp;"}newTD.colSpan=1;newTD.rowSpan=1;newTR.appendChild(newTD);lastCell=tdElm}return newTR}switch(command){case"mceTableRowProps":if(trElm==null)return true;if(user_interface){var template=new Array();template['file']='../../plugins/table/row.htm';template['width']=380;template['height']=295;template['width']+=tinyMCE.getLang('lang_table_rowprops_delta_width',0);template['height']+=tinyMCE.getLang('lang_table_rowprops_delta_height',0);tinyMCE.openWindow(template,{editor_id:inst.editorId,inline:"yes"})}return true;case"mceTableCellProps":if(tdElm==null)return true;if(user_interface){var template=new Array();template['file']='../../plugins/table/cell.htm';template['width']=380;template['height']=295;template['width']+=tinyMCE.getLang('lang_table_cellprops_delta_width',0);template['height']+=tinyMCE.getLang('lang_table_cellprops_delta_height',0);tinyMCE.openWindow(template,{editor_id:inst.editorId,inline:"yes"})}return true;case"mceInsertTable":if(user_interface){var template=new Array();template['file']='../../plugins/table/table.htm';template['width']=380;template['height']=295;template['width']+=tinyMCE.getLang('lang_table_table_delta_width',0);template['height']+=tinyMCE.getLang('lang_table_table_delta_height',0);tinyMCE.openWindow(template,{editor_id:inst.editorId,inline:"yes",action:value})}return true;case"mceTableDelete":var table=tinyMCE.getParentElement(inst.getFocusElement(),"table");if(table){table.parentNode.removeChild(table);inst.repaint()}return true;case"mceTableSplitCells":case"mceTableMergeCells":case"mceTableInsertRowBefore":case"mceTableInsertRowAfter":case"mceTableDeleteRow":case"mceTableInsertColBefore":case"mceTableInsertColAfter":case"mceTableDeleteCol":case"mceTableCutRow":case"mceTableCopyRow":case"mceTablePasteRowBefore":case"mceTablePasteRowAfter":if(!tableElm)return true;if(trElm&&tableElm!=trElm.parentNode)tableElm=trElm.parentNode;if(tableElm&&trElm){switch(command){case"mceTableCutRow":if(!trElm||!tdElm)return true;inst.tableRowClipboard=copyRow(doc,tableElm,trElm);inst.execCommand("mceTableDeleteRow");break;case"mceTableCopyRow":if(!trElm||!tdElm)return true;inst.tableRowClipboard=copyRow(doc,tableElm,trElm);break;case"mceTablePasteRowBefore":if(!trElm||!tdElm)return true;var newTR=inst.tableRowClipboard.cloneNode(true);var prevTR=prevElm(trElm,"TR");if(prevTR!=null)trimRow(tableElm,prevTR,prevTR.cells[0],newTR);trElm.parentNode.insertBefore(newTR,trElm);break;case"mceTablePasteRowAfter":if(!trElm||!tdElm)return true;var nextTR=nextElm(trElm,"TR");var newTR=inst.tableRowClipboard.cloneNode(true);trimRow(tableElm,trElm,tdElm,newTR);if(nextTR==null)trElm.parentNode.appendChild(newTR);else nextTR.parentNode.insertBefore(newTR,nextTR);break;case"mceTableInsertRowBefore":if(!trElm||!tdElm)return true;var grid=getTableGrid(tableElm);var cpos=getCellPos(grid,tdElm);var newTR=doc.createElement("tr");var lastTDElm=null;cpos.rowindex--;if(cpos.rowindex<0)cpos.rowindex=0;for(var x=0;tdElm=getCell(grid,cpos.rowindex,x);x++){if(tdElm!=lastTDElm){var sd=getColRowSpan(tdElm);if(sd['rowspan']==1){var newTD=doc.createElement("td");newTD.innerHTML="&nbsp;";newTD.colSpan=tdElm.colSpan;newTR.appendChild(newTD)}else tdElm.rowSpan=sd['rowspan']+1;lastTDElm=tdElm}}trElm.parentNode.insertBefore(newTR,trElm);grid=getTableGrid(tableElm);inst.selection.selectNode(getCell(grid,cpos.rowindex+1,cpos.cellindex),tinyMCE.isGecko,true);break;case"mceTableInsertRowAfter":if(!trElm||!tdElm)return true;var grid=getTableGrid(tableElm);var cpos=getCellPos(grid,tdElm);var newTR=doc.createElement("tr");var lastTDElm=null;for(var x=0;tdElm=getCell(grid,cpos.rowindex,x);x++){if(tdElm!=lastTDElm){var sd=getColRowSpan(tdElm);if(sd['rowspan']==1){var newTD=doc.createElement("td");newTD.innerHTML="&nbsp;";newTD.colSpan=tdElm.colSpan;newTR.appendChild(newTD)}else tdElm.rowSpan=sd['rowspan']+1;lastTDElm=tdElm}}if(newTR.hasChildNodes()){var nextTR=nextElm(trElm,"TR");if(nextTR)nextTR.parentNode.insertBefore(newTR,nextTR);else tableElm.appendChild(newTR)}grid=getTableGrid(tableElm);inst.selection.selectNode(getCell(grid,cpos.rowindex,cpos.cellindex),tinyMCE.isGecko,true);break;case"mceTableDeleteRow":if(!trElm||!tdElm)return true;var grid=getTableGrid(tableElm);var cpos=getCellPos(grid,tdElm);if(grid.length==1){tableElm=tinyMCE.getParentElement(tableElm,"table");tableElm.parentNode.removeChild(tableElm);return true}var cells=trElm.cells;var nextTR=nextElm(trElm,"TR");for(var x=0;x<cells.length;x++){if(cells[x].rowSpan>1){var newTD=cells[x].cloneNode(true);var sd=getColRowSpan(cells[x]);newTD.rowSpan=sd.rowspan-1;var nextTD=nextTR.cells[x];if(nextTD==null)nextTR.appendChild(newTD);else nextTR.insertBefore(newTD,nextTD)}}var lastTDElm=null;for(var x=0;tdElm=getCell(grid,cpos.rowindex,x);x++){if(tdElm!=lastTDElm){var sd=getColRowSpan(tdElm);if(sd.rowspan>1){tdElm.rowSpan=sd.rowspan-1}else{trElm=tdElm.parentNode;if(trElm.parentNode)trElm._delete=true}lastTDElm=tdElm}}deleteMarked(tableElm);cpos.rowindex--;if(cpos.rowindex<0)cpos.rowindex=0;grid=getTableGrid(tableElm);inst.selection.selectNode(getCell(grid,cpos.rowindex,0),tinyMCE.isGecko,true);break;case"mceTableInsertColBefore":if(!trElm||!tdElm)return true;var grid=getTableGrid(tableElm);var cpos=getCellPos(grid,tdElm);var lastTDElm=null;for(var y=0;tdElm=getCell(grid,y,cpos.cellindex);y++){if(tdElm!=lastTDElm){var sd=getColRowSpan(tdElm);if(sd['colspan']==1){var newTD=doc.createElement(tdElm.nodeName);newTD.innerHTML="&nbsp;";newTD.rowSpan=tdElm.rowSpan;tdElm.parentNode.insertBefore(newTD,tdElm)}else tdElm.colSpan++;lastTDElm=tdElm}}grid=getTableGrid(tableElm);inst.selection.selectNode(getCell(grid,cpos.rowindex,cpos.cellindex+1),tinyMCE.isGecko,true);break;case"mceTableInsertColAfter":if(!trElm||!tdElm)return true;var grid=getTableGrid(tableElm);var cpos=getCellPos(grid,tdElm);var lastTDElm=null;for(var y=0;tdElm=getCell(grid,y,cpos.cellindex);y++){if(tdElm!=lastTDElm){var sd=getColRowSpan(tdElm);if(sd['colspan']==1){var newTD=doc.createElement(tdElm.nodeName);newTD.innerHTML="&nbsp;";newTD.rowSpan=tdElm.rowSpan;var nextTD=nextElm(tdElm,"TD,TH");if(nextTD==null)tdElm.parentNode.appendChild(newTD);else nextTD.parentNode.insertBefore(newTD,nextTD)}else tdElm.colSpan++;lastTDElm=tdElm}}grid=getTableGrid(tableElm);inst.selection.selectNode(getCell(grid,cpos.rowindex,cpos.cellindex),tinyMCE.isGecko,true);break;case"mceTableDeleteCol":if(!trElm||!tdElm)return true;var grid=getTableGrid(tableElm);var cpos=getCellPos(grid,tdElm);var lastTDElm=null;if(grid.length>1&&grid[0].length<=1){tableElm=tinyMCE.getParentElement(tableElm,"table");tableElm.parentNode.removeChild(tableElm);return true}for(var y=0;tdElm=getCell(grid,y,cpos.cellindex);y++){if(tdElm!=lastTDElm){var sd=getColRowSpan(tdElm);if(sd['colspan']>1)tdElm.colSpan=sd['colspan']-1;else{if(tdElm.parentNode)tdElm.parentNode.removeChild(tdElm)}lastTDElm=tdElm}}cpos.cellindex--;if(cpos.cellindex<0)cpos.cellindex=0;grid=getTableGrid(tableElm);inst.selection.selectNode(getCell(grid,cpos.rowindex,0),tinyMCE.isGecko,true);break;case"mceTableSplitCells":if(!trElm||!tdElm)return true;var spandata=getColRowSpan(tdElm);var colspan=spandata["colspan"];var rowspan=spandata["rowspan"];if(colspan>1||rowspan>1){tdElm.colSpan=1;for(var i=1;i<colspan;i++){var newTD=doc.createElement("td");newTD.innerHTML="&nbsp;";trElm.insertBefore(newTD,nextElm(tdElm,"TD,TH"));if(rowspan>1)addRows(newTD,trElm,rowspan)}addRows(tdElm,trElm,rowspan)}tableElm=tinyMCE.getParentElement(inst.getFocusElement(),"table");break;case"mceTableMergeCells":var rows=new Array();var sel=inst.getSel();var grid=getTableGrid(tableElm);if(tinyMCE.isMSIE||sel.rangeCount==1){if(user_interface){var template=new Array();var sp=getColRowSpan(tdElm);template['file']='../../plugins/table/merge_cells.htm';template['width']=250;template['height']=105+(tinyMCE.isNS7?25:0);template['width']+=tinyMCE.getLang('lang_table_merge_cells_delta_width',0);template['height']+=tinyMCE.getLang('lang_table_merge_cells_delta_height',0);tinyMCE.openWindow(template,{editor_id:inst.editorId,inline:"yes",action:"update",numcols:sp.colspan,numrows:sp.rowspan});return true}else{var numRows=parseInt(value['numrows']);var numCols=parseInt(value['numcols']);var cpos=getCellPos(grid,tdElm);if((""+numRows)=="NaN")numRows=1;if((""+numCols)=="NaN")numCols=1;var tRows=tableElm.rows;for(var y=cpos.rowindex;y<grid.length;y++){var rowCells=new Array();for(var x=cpos.cellindex;x<grid[y].length;x++){var td=getCell(grid,y,x);if(td&&!inArray(rows,td)&&!inArray(rowCells,td)){var cp=getCellPos(grid,td);if(cp.cellindex<cpos.cellindex+numCols&&cp.rowindex<cpos.rowindex+numRows)rowCells[rowCells.length]=td}}if(rowCells.length>0)rows[rows.length]=rowCells}}}else{var cells=new Array();var sel=inst.getSel();var lastTR=null;var curRow=null;var x1=-1,y1=-1,x2,y2;if(sel.rangeCount<2)return true;for(var i=0;i<sel.rangeCount;i++){var rng=sel.getRangeAt(i);var tdElm=rng.startContainer.childNodes[rng.startOffset];if(!tdElm)break;if(tdElm.nodeName=="TD")cells[cells.length]=tdElm}var tRows=tableElm.rows;for(var y=0;y<tRows.length;y++){var rowCells=new Array();for(var x=0;x<tRows[y].cells.length;x++){var td=tRows[y].cells[x];for(var i=0;i<cells.length;i++){if(td==cells[i]){rowCells[rowCells.length]=td}}}if(rowCells.length>0)rows[rows.length]=rowCells}var curRow=new Array();var lastTR=null;for(var y=0;y<grid.length;y++){for(var x=0;x<grid[y].length;x++){grid[y][x]._selected=false;for(var i=0;i<cells.length;i++){if(grid[y][x]==cells[i]){if(x1==-1){x1=x;y1=y}x2=x;y2=y;grid[y][x]._selected=true}}}}for(var y=y1;y<=y2;y++){for(var x=x1;x<=x2;x++){if(!grid[y][x]._selected){alert("Invalid selection for merge.");return true}}}}var rowSpan=1,colSpan=1;var lastRowSpan=-1;for(var y=0;y<rows.length;y++){var rowColSpan=0;for(var x=0;x<rows[y].length;x++){var sd=getColRowSpan(rows[y][x]);rowColSpan+=sd['colspan'];if(lastRowSpan!=-1&&sd['rowspan']!=lastRowSpan){alert("Invalid selection for merge.");return true}lastRowSpan=sd['rowspan']}if(rowColSpan>colSpan)colSpan=rowColSpan;lastRowSpan=-1}var lastColSpan=-1;for(var x=0;x<rows[0].length;x++){var colRowSpan=0;for(var y=0;y<rows.length;y++){var sd=getColRowSpan(rows[y][x]);colRowSpan+=sd['rowspan'];if(lastColSpan!=-1&&sd['colspan']!=lastColSpan){alert("Invalid selection for merge.");return true}lastColSpan=sd['colspan']}if(colRowSpan>rowSpan)rowSpan=colRowSpan;lastColSpan=-1}tdElm=rows[0][0];tdElm.rowSpan=rowSpan;tdElm.colSpan=colSpan;for(var y=0;y<rows.length;y++){for(var x=0;x<rows[y].length;x++){var html=rows[y][x].innerHTML;var chk=tinyMCE.regexpReplace(html,"[ \t\r\n]","");if(chk!="<br/>"&&chk!="<br>"&&chk!="&nbsp;"&&(x+y>0))tdElm.innerHTML+=html;if(rows[y][x]!=tdElm&&!rows[y][x]._deleted){var cpos=getCellPos(grid,rows[y][x]);var tr=rows[y][x].parentNode;tr.removeChild(rows[y][x]);rows[y][x]._deleted=true;if(!tr.hasChildNodes()){tr.parentNode.removeChild(tr);var lastCell=null;for(var x=0;cellElm=getCell(grid,cpos.rowindex,x);x++){if(cellElm!=lastCell&&cellElm.rowSpan>1)cellElm.rowSpan--;lastCell=cellElm}if(tdElm.rowSpan>1)tdElm.rowSpan--}}}}break}tableElm=tinyMCE.getParentElement(inst.getFocusElement(),"table");tinyMCE.handleVisualAid(tableElm,true,tinyMCE.settings['visual'],tinyMCE.selectedInstance);tinyMCE.triggerNodeChange();inst.repaint()}return true}return false}};tinyMCE.addPlugin("table",TinyMCE_TablePlugin);
\ No newline at end of file
+(function(){var a=tinymce.each;tinymce.create("tinymce.plugins.TablePlugin",{init:function(b,c){var d=this;d.editor=b;d.url=c;a([["table","table.desc","mceInsertTable",true],["delete_table","table.del","mceTableDelete"],["delete_col","table.delete_col_desc","mceTableDeleteCol"],["delete_row","table.delete_row_desc","mceTableDeleteRow"],["col_after","table.col_after_desc","mceTableInsertColAfter"],["col_before","table.col_before_desc","mceTableInsertColBefore"],["row_after","table.row_after_desc","mceTableInsertRowAfter"],["row_before","table.row_before_desc","mceTableInsertRowBefore"],["row_props","table.row_desc","mceTableRowProps",true],["cell_props","table.cell_desc","mceTableCellProps",true],["split_cells","table.split_cells_desc","mceTableSplitCells",true],["merge_cells","table.merge_cells_desc","mceTableMergeCells",true]],function(e){b.addButton(e[0],{title:e[1],cmd:e[2],ui:e[3]})});if(b.getParam("inline_styles")){b.onPreProcess.add(function(e,g){var f=e.dom;a(f.select("table",g.node),function(i){var h;if(h=f.getAttrib(i,"width")){f.setStyle(i,"width",h);f.setAttrib(i,"width")}if(h=f.getAttrib(i,"height")){f.setStyle(i,"height",h);f.setAttrib(i,"height")}})})}b.onInit.add(function(){if(b&&b.plugins.contextmenu){b.plugins.contextmenu.onContextMenu.add(function(h,f,j){var k,i=b.selection,g=i.getNode()||b.getBody();if(b.dom.getParent(j,"td")||b.dom.getParent(j,"th")){f.removeAll();if(g.nodeName=="A"&&!b.dom.getAttrib(g,"name")){f.add({title:"advanced.link_desc",icon:"link",cmd:b.plugins.advlink?"mceAdvLink":"mceLink",ui:true});f.add({title:"advanced.unlink_desc",icon:"unlink",cmd:"UnLink"});f.addSeparator()}if(g.nodeName=="IMG"&&g.className.indexOf("mceItem")==-1){f.add({title:"advanced.image_desc",icon:"image",cmd:b.plugins.advimage?"mceAdvImage":"mceImage",ui:true});f.addSeparator()}f.add({title:"table.desc",icon:"table",cmd:"mceInsertTable",ui:true,value:{action:"insert"}});f.add({title:"table.props_desc",icon:"table_props",cmd:"mceInsertTable",ui:true});f.add({title:"table.del",icon:"delete_table",cmd:"mceTableDelete",ui:true});f.addSeparator();k=f.addMenu({title:"table.cell"});k.add({title:"table.cell_desc",icon:"cell_props",cmd:"mceTableCellProps",ui:true});k.add({title:"table.split_cells_desc",icon:"split_cells",cmd:"mceTableSplitCells",ui:true});k.add({title:"table.merge_cells_desc",icon:"merge_cells",cmd:"mceTableMergeCells",ui:true});k=f.addMenu({title:"table.row"});k.add({title:"table.row_desc",icon:"row_props",cmd:"mceTableRowProps",ui:true});k.add({title:"table.row_before_desc",icon:"row_before",cmd:"mceTableInsertRowBefore"});k.add({title:"table.row_after_desc",icon:"row_after",cmd:"mceTableInsertRowAfter"});k.add({title:"table.delete_row_desc",icon:"delete_row",cmd:"mceTableDeleteRow"});k.addSeparator();k.add({title:"table.cut_row_desc",icon:"cut",cmd:"mceTableCutRow"});k.add({title:"table.copy_row_desc",icon:"copy",cmd:"mceTableCopyRow"});k.add({title:"table.paste_row_before_desc",icon:"paste",cmd:"mceTablePasteRowBefore"});k.add({title:"table.paste_row_after_desc",icon:"paste",cmd:"mceTablePasteRowAfter"});k=f.addMenu({title:"table.col"});k.add({title:"table.col_before_desc",icon:"col_before",cmd:"mceTableInsertColBefore"});k.add({title:"table.col_after_desc",icon:"col_after",cmd:"mceTableInsertColAfter"});k.add({title:"table.delete_col_desc",icon:"delete_col",cmd:"mceTableDeleteCol"})}else{f.add({title:"table.desc",icon:"table",cmd:"mceInsertTable",ui:true})}})}});b.onKeyDown.add(function(f,g){if(g.keyCode==9&&f.dom.getParent(f.selection.getNode(),"TABLE")){if(!tinymce.isGecko&&!tinymce.isOpera){tinyMCE.execInstanceCommand(f.editorId,"mceTableMoveToNextRow",true);return tinymce.dom.Event.cancel(g)}f.undoManager.add()}});if(!tinymce.isIE){if(b.getParam("table_selection",true)){b.onClick.add(function(f,g){g=g.target;if(g.nodeName==="TABLE"){f.selection.select(g)}})}}b.onNodeChange.add(function(f,e,h){var g=f.dom.getParent(h,"td,th,caption");e.setActive("table",h.nodeName==="TABLE"||!!g);if(g&&g.nodeName==="CAPTION"){g=null}e.setDisabled("delete_table",!g);e.setDisabled("delete_col",!g);e.setDisabled("delete_table",!g);e.setDisabled("delete_row",!g);e.setDisabled("col_after",!g);e.setDisabled("col_before",!g);e.setDisabled("row_after",!g);e.setDisabled("row_before",!g);e.setDisabled("row_props",!g);e.setDisabled("cell_props",!g);e.setDisabled("split_cells",!g||(parseInt(f.dom.getAttrib(g,"colspan","1"))<2&&parseInt(f.dom.getAttrib(g,"rowspan","1"))<2));e.setDisabled("merge_cells",!g)});if(!tinymce.isIE){b.onBeforeSetContent.add(function(e,f){if(f.initial){f.content=f.content.replace(/<(td|th)([^>]+|)>\s*<\/(td|th)>/g,tinymce.isOpera?"<$1$2>&nbsp;</$1>":'<$1$2><br mce_bogus="1" /></$1>')}})}},execCommand:function(f,e,g){var d=this.editor,c;switch(f){case"mceTableMoveToNextRow":case"mceInsertTable":case"mceTableRowProps":case"mceTableCellProps":case"mceTableSplitCells":case"mceTableMergeCells":case"mceTableInsertRowBefore":case"mceTableInsertRowAfter":case"mceTableDeleteRow":case"mceTableInsertColBefore":case"mceTableInsertColAfter":case"mceTableDeleteCol":case"mceTableCutRow":case"mceTableCopyRow":case"mceTablePasteRowBefore":case"mceTablePasteRowAfter":case"mceTableDelete":d.execCommand("mceBeginUndoLevel");this._doExecCommand(f,e,g);d.execCommand("mceEndUndoLevel");return true}return false},getInfo:function(){return{longname:"Tables",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/table",version:tinymce.majorVersion+"."+tinymce.minorVersion}},_doExecCommand:function(r,Z,ae){var V=this.editor,au=V,g=this.url;var n=V.selection.getNode();var W=V.dom.getParent(n,"tr");var aq=V.dom.getParent(n,"td,th");var F=V.dom.getParent(n,"table");var k=V.contentWindow.document;var av=F?F.getAttribute("border"):"";if(W&&aq==null){aq=W.cells[0]}function ap(y,x){for(var ax=0;ax<y.length;ax++){if(y[ax].length>0&&ap(y[ax],x)){return true}if(y[ax]==x){return true}}return false}function aj(x,i){var y;ad=e(F);x=x||0;i=i||0;x=Math.max(o.cellindex+x,0);i=Math.max(o.rowindex+i,0);V.execCommand("mceRepaint");y=d(ad,i,x);if(y){V.selection.select(y.firstChild||y);V.selection.collapse(1)}}function ah(){var i=k.createElement("td");if(!tinymce.isIE){i.innerHTML='<br mce_bogus="1"/>'}}function j(y){var x=V.dom.getAttrib(y,"colspan");var i=V.dom.getAttrib(y,"rowspan");x=x==""?1:parseInt(x);i=i==""?1:parseInt(i);return{colspan:x,rowspan:i}}function al(ax,az){var i,ay;for(ay=0;ay<ax.length;ay++){for(i=0;i<ax[ay].length;i++){if(ax[ay][i]==az){return{cellindex:i,rowindex:ay}}}}return null}function d(x,y,i){if(x[y]&&x[y][i]){return x[y][i]}return null}function A(aC,ax){var az=[],y=0,aA,ay,ax,aB;for(aA=0;aA<aC.rows.length;aA++){for(ay=0;ay<aC.rows[aA].cells.length;ay++,y++){az[y]=aC.rows[aA].cells[ay]}}for(aA=0;aA<az.length;aA++){if(az[aA]==ax){if(aB=az[aA+1]){return aB}}}}function e(aE){var i=[],aF=aE.rows,aC,aB,ay,az,aD,ax,aA;for(aB=0;aB<aF.length;aB++){for(aC=0;aC<aF[aB].cells.length;aC++){ay=aF[aB].cells[aC];az=j(ay);for(aD=aC;i[aB]&&i[aB][aD];aD++){}for(aA=aB;aA<aB+az.rowspan;aA++){if(!i[aA]){i[aA]=[]}for(ax=aD;ax<aD+az.colspan;ax++){i[aA][ax]=ay}}}}return i}function m(aG,aD,ay,ax){var y=e(aG),aF=al(y,ay);var aH,aC;if(ax.cells.length!=aD.childNodes.length){aH=aD.childNodes;aC=null;for(var aE=0;ay=d(y,aF.rowindex,aE);aE++){var aA=true;var aB=j(ay);if(ap(aH,ay)){ax.childNodes[aE]._delete=true}else{if((aC==null||ay!=aC)&&aB.colspan>1){for(var az=aE;az<aE+ay.colSpan;az++){ax.childNodes[az]._delete=true}}}if((aC==null||ay!=aC)&&aB.rowspan>1){ay.rowSpan=aB.rowspan+1}aC=ay}B(F)}}function O(x,i){while((x=x.previousSibling)!=null){if(x.nodeName==i){return x}}return null}function af(ax,ay){var x=ay.split(",");while((ax=ax.nextSibling)!=null){for(var y=0;y<x.length;y++){if(ax.nodeName.toLowerCase()==x[y].toLowerCase()){return ax}}}return null}function B(ax){if(ax.rows==0){return}var y=ax.rows[0];do{var x=af(y,"TR");if(y._delete){y.parentNode.removeChild(y);continue}var ay=y.cells[0];if(ay.cells>1){do{var i=af(ay,"TD,TH");if(ay._delete){ay.parentNode.removeChild(ay)}}while((ay=i)!=null)}}while((y=x)!=null)}function p(ax,aA,az){ax.rowSpan=1;var x=af(aA,"TR");for(var ay=1;ay<az&&x;ay++){var y=k.createElement("td");if(!tinymce.isIE){y.innerHTML='<br mce_bogus="1"/>'}if(tinymce.isIE){x.insertBefore(y,x.cells(ax.cellIndex))}else{x.insertBefore(y,x.cells[ax.cellIndex])}x=af(x,"TR")}}function S(aF,aH,aB){var y=e(aH);var ax=aB.cloneNode(false);var aG=al(y,aB.cells[0]);var aC=null;var aA=V.dom.getAttrib(aH,"border");var az=null;for(var aE=0;az=d(y,aG.rowindex,aE);aE++){var aD=null;if(aC!=az){for(var ay=0;ay<aB.cells.length;ay++){if(az==aB.cells[ay]){aD=az.cloneNode(true);break}}}if(aD==null){aD=aF.createElement("td");if(!tinymce.isIE){aD.innerHTML='<br mce_bogus="1"/>'}}aD.colSpan=1;aD.rowSpan=1;ax.appendChild(aD);aC=az}return ax}switch(r){case"mceTableMoveToNextRow":var L=A(F,aq);if(!L){V.execCommand("mceTableInsertRowAfter",aq);L=A(F,aq)}V.selection.select(L);V.selection.collapse(true);return true;case"mceTableRowProps":if(W==null){return true}if(Z){V.windowManager.open({url:g+"/row.htm",width:400+parseInt(V.getLang("table.rowprops_delta_width",0)),height:295+parseInt(V.getLang("table.rowprops_delta_height",0)),inline:1},{plugin_url:g})}return true;case"mceTableCellProps":if(aq==null){return true}if(Z){V.windowManager.open({url:g+"/cell.htm",width:400+parseInt(V.getLang("table.cellprops_delta_width",0)),height:295+parseInt(V.getLang("table.cellprops_delta_height",0)),inline:1},{plugin_url:g})}return true;case"mceInsertTable":if(Z){V.windowManager.open({url:g+"/table.htm",width:400+parseInt(V.getLang("table.table_delta_width",0)),height:320+parseInt(V.getLang("table.table_delta_height",0)),inline:1},{plugin_url:g,action:ae?ae.action:0})}return true;case"mceTableDelete":var G=V.dom.getParent(V.selection.getNode(),"table");if(G){G.parentNode.removeChild(G);V.execCommand("mceRepaint")}return true;case"mceTableSplitCells":case"mceTableMergeCells":case"mceTableInsertRowBefore":case"mceTableInsertRowAfter":case"mceTableDeleteRow":case"mceTableInsertColBefore":case"mceTableInsertColAfter":case"mceTableDeleteCol":case"mceTableCutRow":case"mceTableCopyRow":case"mceTablePasteRowBefore":case"mceTablePasteRowAfter":if(!F){return true}if(W&&F!=W.parentNode){F=W.parentNode}if(F&&W){switch(r){case"mceTableCutRow":if(!W||!aq){return true}V.tableRowClipboard=S(k,F,W);V.execCommand("mceTableDeleteRow");break;case"mceTableCopyRow":if(!W||!aq){return true}V.tableRowClipboard=S(k,F,W);break;case"mceTablePasteRowBefore":if(!W||!aq){return true}var v=V.tableRowClipboard.cloneNode(true);var h=O(W,"TR");if(h!=null){m(F,h,h.cells[0],v)}W.parentNode.insertBefore(v,W);break;case"mceTablePasteRowAfter":if(!W||!aq){return true}var X=af(W,"TR");var v=V.tableRowClipboard.cloneNode(true);m(F,W,aq,v);if(X==null){W.parentNode.appendChild(v)}else{X.parentNode.insertBefore(v,X)}break;case"mceTableInsertRowBefore":if(!W||!aq){return true}var ad=e(F);var o=al(ad,aq);var v=k.createElement("tr");var u=null;o.rowindex--;if(o.rowindex<0){o.rowindex=0}for(var ac=0;aq=d(ad,o.rowindex,ac);ac++){if(aq!=u){var E=j(aq);if(E.rowspan==1){var J=k.createElement("td");if(!tinymce.isIE){J.innerHTML='<br mce_bogus="1"/>'}J.colSpan=aq.colSpan;v.appendChild(J)}else{aq.rowSpan=E.rowspan+1}u=aq}}W.parentNode.insertBefore(v,W);aj(0,1);break;case"mceTableInsertRowAfter":if(!W||!aq){return true}var ad=e(F);var o=al(ad,aq);var v=k.createElement("tr");var u=null;for(var ac=0;aq=d(ad,o.rowindex,ac);ac++){if(aq!=u){var E=j(aq);if(E.rowspan==1){var J=k.createElement("td");if(!tinymce.isIE){J.innerHTML='<br mce_bogus="1"/>'}J.colSpan=aq.colSpan;v.appendChild(J)}else{aq.rowSpan=E.rowspan+1}u=aq}}if(v.hasChildNodes()){var X=af(W,"TR");if(X){X.parentNode.insertBefore(v,X)}else{F.appendChild(v)}}aj(0,1);break;case"mceTableDeleteRow":if(!W||!aq){return true}var ad=e(F);var o=al(ad,aq);if(ad.length==1&&F.nodeName=="TBODY"){V.dom.remove(V.dom.getParent(F,"table"));return true}var D=W.cells;var X=af(W,"TR");for(var ac=0;ac<D.length;ac++){if(D[ac].rowSpan>1){var J=D[ac].cloneNode(true);var E=j(D[ac]);J.rowSpan=E.rowspan-1;var ak=X.cells[ac];if(ak==null){X.appendChild(J)}else{X.insertBefore(J,ak)}}}var u=null;for(var ac=0;aq=d(ad,o.rowindex,ac);ac++){if(aq!=u){var E=j(aq);if(E.rowspan>1){aq.rowSpan=E.rowspan-1}else{W=aq.parentNode;if(W.parentNode){W._delete=true}}u=aq}}B(F);aj(0,-1);break;case"mceTableInsertColBefore":if(!W||!aq){return true}var ad=e(V.dom.getParent(F,"table"));var o=al(ad,aq);var u=null;for(var aa=0;aq=d(ad,aa,o.cellindex);aa++){if(aq!=u){var E=j(aq);if(E.colspan==1){var J=k.createElement(aq.nodeName);if(!tinymce.isIE){J.innerHTML='<br mce_bogus="1"/>'}J.rowSpan=aq.rowSpan;aq.parentNode.insertBefore(J,aq)}else{aq.colSpan++}u=aq}}aj();break;case"mceTableInsertColAfter":if(!W||!aq){return true}var ad=e(V.dom.getParent(F,"table"));var o=al(ad,aq);var u=null;for(var aa=0;aq=d(ad,aa,o.cellindex);aa++){if(aq!=u){var E=j(aq);if(E.colspan==1){var J=k.createElement(aq.nodeName);if(!tinymce.isIE){J.innerHTML='<br mce_bogus="1"/>'}J.rowSpan=aq.rowSpan;var ak=af(aq,"TD,TH");if(ak==null){aq.parentNode.appendChild(J)}else{ak.parentNode.insertBefore(J,ak)}}else{aq.colSpan++}u=aq}}aj(1);break;case"mceTableDeleteCol":if(!W||!aq){return true}var ad=e(F);var o=al(ad,aq);var u=null;if((ad.length>1&&ad[0].length<=1)&&F.nodeName=="TBODY"){V.dom.remove(V.dom.getParent(F,"table"));return true}for(var aa=0;aq=d(ad,aa,o.cellindex);aa++){if(aq!=u){var E=j(aq);if(E.colspan>1){aq.colSpan=E.colspan-1}else{if(aq.parentNode){aq.parentNode.removeChild(aq)}}u=aq}}aj(-1);break;case"mceTableSplitCells":if(!W||!aq){return true}var l=j(aq);var C=l.colspan;var H=l.rowspan;if(C>1||H>1){aq.colSpan=1;for(var am=1;am<C;am++){var J=k.createElement("td");if(!tinymce.isIE){J.innerHTML='<br mce_bogus="1"/>'}W.insertBefore(J,af(aq,"TD,TH"));if(H>1){p(J,W,H)}}p(aq,W,H)}F=V.dom.getParent(V.selection.getNode(),"table");break;case"mceTableMergeCells":var ao=[];var R=V.selection.getSel();var ad=e(F);if(tinymce.isIE||R.rangeCount==1){if(Z){var t=j(aq);V.windowManager.open({url:g+"/merge_cells.htm",width:240+parseInt(V.getLang("table.merge_cells_delta_width",0)),height:110+parseInt(V.getLang("table.merge_cells_delta_height",0)),inline:1},{action:"update",numcols:t.colspan,numrows:t.rowspan,plugin_url:g});return true}else{var U=parseInt(ae.numrows);var c=parseInt(ae.numcols);var o=al(ad,aq);if((""+U)=="NaN"){U=1}if((""+c)=="NaN"){c=1}var b=F.rows;for(var aa=o.rowindex;aa<ad.length;aa++){var ag=[];for(var ac=o.cellindex;ac<ad[aa].length;ac++){var f=d(ad,aa,ac);if(f&&!ap(ao,f)&&!ap(ag,f)){var N=al(ad,f);if(N.cellindex<o.cellindex+c&&N.rowindex<o.rowindex+U){ag[ag.length]=f}}}if(ag.length>0){ao[ao.length]=ag}var f=d(ad,o.rowindex,o.cellindex);a(au.dom.select("br",f),function(y,x){if(x>0&&au.dom.getAttrib("mce_bogus")){au.dom.remove(y)}})}}}else{var D=[];var R=V.selection.getSel();var Y=null;var an=null;var z=-1,aw=-1,w,at;if(R.rangeCount<2){return true}for(var am=0;am<R.rangeCount;am++){var ai=R.getRangeAt(am);var aq=ai.startContainer.childNodes[ai.startOffset];if(!aq){break}if(aq.nodeName=="TD"||aq.nodeName=="TH"){D[D.length]=aq}}var b=F.rows;for(var aa=0;aa<b.length;aa++){var ag=[];for(var ac=0;ac<b[aa].cells.length;ac++){var f=b[aa].cells[ac];for(var am=0;am<D.length;am++){if(f==D[am]){ag[ag.length]=f}}}if(ag.length>0){ao[ao.length]=ag}}var an=[];var Y=null;for(var aa=0;aa<ad.length;aa++){for(var ac=0;ac<ad[aa].length;ac++){ad[aa][ac]._selected=false;for(var am=0;am<D.length;am++){if(ad[aa][ac]==D[am]){if(z==-1){z=ac;aw=aa}w=ac;at=aa;ad[aa][ac]._selected=true}}}}for(var aa=aw;aa<=at;aa++){for(var ac=z;ac<=w;ac++){if(!ad[aa][ac]._selected){alert("Invalid selection for merge.");return true}}}}var s=1,q=1;var T=-1;for(var aa=0;aa<ao.length;aa++){var I=0;for(var ac=0;ac<ao[aa].length;ac++){var E=j(ao[aa][ac]);I+=E.colspan;if(T!=-1&&E.rowspan!=T){alert("Invalid selection for merge.");return true}T=E.rowspan}if(I>q){q=I}T=-1}var Q=-1;for(var ac=0;ac<ao[0].length;ac++){var M=0;for(var aa=0;aa<ao.length;aa++){var E=j(ao[aa][ac]);M+=E.rowspan;if(Q!=-1&&E.colspan!=Q){alert("Invalid selection for merge.");return true}Q=E.colspan}if(M>s){s=M}Q=-1}aq=ao[0][0];aq.rowSpan=s;aq.colSpan=q;for(var aa=0;aa<ao.length;aa++){for(var ac=0;ac<ao[aa].length;ac++){var P=ao[aa][ac].innerHTML;var K=P.replace(/[ \t\r\n]/g,"");if(K!="<br/>"&&K!="<br>"&&K!='<br mce_bogus="1"/>'&&(ac+aa>0)){aq.innerHTML+=P}if(ao[aa][ac]!=aq&&!ao[aa][ac]._deleted){var o=al(ad,ao[aa][ac]);var ar=ao[aa][ac].parentNode;ar.removeChild(ao[aa][ac]);ao[aa][ac]._deleted=true;if(!ar.hasChildNodes()){ar.parentNode.removeChild(ar);var ab=null;for(var ac=0;cellElm=d(ad,o.rowindex,ac);ac++){if(cellElm!=ab&&cellElm.rowSpan>1){cellElm.rowSpan--}ab=cellElm}if(aq.rowSpan>1){aq.rowSpan--}}}}}a(au.dom.select("br",aq),function(y,x){if(x>0&&au.dom.getAttrib(y,"mce_bogus")){au.dom.remove(y)}});break}F=V.dom.getParent(V.selection.getNode(),"table");V.addVisual(F);V.nodeChanged()}return true}return false}});tinymce.PluginManager.add("table",tinymce.plugins.TablePlugin)})();
\ No newline at end of file
diff -x .svn -aruN 0.7.15.src/e107_handlers/tiny_mce/plugins/table/editor_plugin_src.js 0.7.16.src/e107_handlers/tiny_mce/plugins/table/editor_plugin_src.js
--- 0.7.15.src/e107_handlers/tiny_mce/plugins/table/editor_plugin_src.js	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_handlers/tiny_mce/plugins/table/editor_plugin_src.js	2009-06-30 19:36:49.000000000 -0500
@@ -1,879 +1,979 @@
 /**
- * $Id: editor_plugin_src.js,v 1.11 2006/10/27 22:36:57 e107coders Exp $
+ * $Id: editor_plugin_src.js,v 1.12 2009/07/01 00:37:13 e107coders Exp $
  *
  * @author Moxiecode
- * @copyright Copyright  2004-2006, Moxiecode Systems AB, All rights reserved.
+ * @copyright Copyright  2004-2008, Moxiecode Systems AB, All rights reserved.
  */
 
-/* Import plugin specific language pack */
-tinyMCE.importPluginLanguagePack('table');
+(function() {
+	var each = tinymce.each;
 
-var TinyMCE_TablePlugin = {
-	getInfo : function() {
-		return {
-			longname : 'Tables',
-			author : 'Moxiecode Systems AB',
-			authorurl : 'http://tinymce.moxiecode.com',
-			infourl : 'http://tinymce.moxiecode.com/tinymce/docs/plugin_table.html',
-			version : tinyMCE.majorVersion + "." + tinyMCE.minorVersion
-		};
-	},
-
-	initInstance : function(inst) {
-		if (tinyMCE.isGecko) {
-			var doc = inst.getDoc();
-			tinyMCE.addEvent(doc, "mouseup", TinyMCE_TablePlugin._mouseDownHandler);
-		}
+	tinymce.create('tinymce.plugins.TablePlugin', {
+		init : function(ed, url) {
+			var t = this;
+
+			t.editor = ed;
+			t.url = url;
+
+			// Register buttons
+			each([
+				['table', 'table.desc', 'mceInsertTable', true],
+				['delete_table', 'table.del', 'mceTableDelete'],
+				['delete_col', 'table.delete_col_desc', 'mceTableDeleteCol'],
+				['delete_row', 'table.delete_row_desc', 'mceTableDeleteRow'],
+				['col_after', 'table.col_after_desc', 'mceTableInsertColAfter'],
+				['col_before', 'table.col_before_desc', 'mceTableInsertColBefore'],
+				['row_after', 'table.row_after_desc', 'mceTableInsertRowAfter'],
+				['row_before', 'table.row_before_desc', 'mceTableInsertRowBefore'],
+				['row_props', 'table.row_desc', 'mceTableRowProps', true],
+				['cell_props', 'table.cell_desc', 'mceTableCellProps', true],
+				['split_cells', 'table.split_cells_desc', 'mceTableSplitCells', true],
+				['merge_cells', 'table.merge_cells_desc', 'mceTableMergeCells', true]
+			], function(c) {
+				ed.addButton(c[0], {title : c[1], cmd : c[2], ui : c[3]});
+			});
+
+			if (ed.getParam('inline_styles')) {
+				// Force move of attribs to styles in strict mode
+				ed.onPreProcess.add(function(ed, o) {
+					var dom = ed.dom;
+
+					each(dom.select('table', o.node), function(n) {
+						var v;
+
+						if (v = dom.getAttrib(n, 'width')) {
+							dom.setStyle(n, 'width', v);
+							dom.setAttrib(n, 'width');
+						}
 
-		inst.tableRowClipboard = null;
-	},
+						if (v = dom.getAttrib(n, 'height')) {
+							dom.setStyle(n, 'height', v);
+							dom.setAttrib(n, 'height');
+						}
+					});
+				});
+			}
 
-	/**
-	 * Returns the HTML contents of the table control.
-	 */
-	getControlHTML : function(control_name) {
-		var controls = new Array(
-			['table', 'table.gif', 'lang_table_desc', 'mceInsertTable', true],
-			['delete_table', 'table_delete.gif', 'lang_table_del', 'mceTableDelete'],
-			['delete_col', 'table_delete_col.gif', 'lang_table_delete_col_desc', 'mceTableDeleteCol'],
-			['delete_row', 'table_delete_row.gif', 'lang_table_delete_row_desc', 'mceTableDeleteRow'],
-			['col_after', 'table_insert_col_after.gif', 'lang_table_col_after_desc', 'mceTableInsertColAfter'],
-			['col_before', 'table_insert_col_before.gif', 'lang_table_col_before_desc', 'mceTableInsertColBefore'],
-			['row_after', 'table_insert_row_after.gif', 'lang_table_row_after_desc', 'mceTableInsertRowAfter'],
-			['row_before', 'table_insert_row_before.gif', 'lang_table_row_before_desc', 'mceTableInsertRowBefore'],
-			['row_props', 'table_row_props.gif', 'lang_table_row_desc', 'mceTableRowProps', true],
-			['cell_props', 'table_cell_props.gif', 'lang_table_cell_desc', 'mceTableCellProps', true],
-			['split_cells', 'table_split_cells.gif', 'lang_table_split_cells_desc', 'mceTableSplitCells', true],
-			['merge_cells', 'table_merge_cells.gif', 'lang_table_merge_cells_desc', 'mceTableMergeCells', true]);
-
-		// Render table control
-		for (var i=0; i<controls.length; i++) {
-			var but = controls[i];
-			var cmd = 'tinyMCE.execInstanceCommand(\'{$editor_id}\',\'' + but[3] + '\', ' + (but.length > 4 ? but[4] : false) + (but.length > 5 ? ', \'' + but[5] + '\'' : '') + ');return false;';
+			ed.onInit.add(function() {
+				if (ed && ed.plugins.contextmenu) {
+					ed.plugins.contextmenu.onContextMenu.add(function(th, m, e) {
+						var sm, se = ed.selection, el = se.getNode() || ed.getBody();
+
+						if (ed.dom.getParent(e, 'td') || ed.dom.getParent(e, 'th')) {
+							m.removeAll();
+
+							if (el.nodeName == 'A' && !ed.dom.getAttrib(el, 'name')) {
+								m.add({title : 'advanced.link_desc', icon : 'link', cmd : ed.plugins.advlink ? 'mceAdvLink' : 'mceLink', ui : true});
+								m.add({title : 'advanced.unlink_desc', icon : 'unlink', cmd : 'UnLink'});
+								m.addSeparator();
+							}
 
-			if (but[0] == control_name)
-				return tinyMCE.getButtonHTML(control_name, but[2], '{$pluginurl}/images/'+ but[1], but[3], (but.length > 4 ? but[4] : false));
-		}
+							if (el.nodeName == 'IMG' && el.className.indexOf('mceItem') == -1) {
+								m.add({title : 'advanced.image_desc', icon : 'image', cmd : ed.plugins.advimage ? 'mceAdvImage' : 'mceImage', ui : true});
+								m.addSeparator();
+							}
 
-		// Special tablecontrols
-		if (control_name == "tablecontrols") {
-			var html = "";
-
-			html += tinyMCE.getControlHTML("table");
-			html += tinyMCE.getControlHTML("separator");
-			html += tinyMCE.getControlHTML("row_props");
-			html += tinyMCE.getControlHTML("cell_props");
-			html += tinyMCE.getControlHTML("separator");
-			html += tinyMCE.getControlHTML("row_before");
-			html += tinyMCE.getControlHTML("row_after");
-			html += tinyMCE.getControlHTML("delete_row");
-			html += tinyMCE.getControlHTML("separator");
-			html += tinyMCE.getControlHTML("col_before");
-			html += tinyMCE.getControlHTML("col_after");
-			html += tinyMCE.getControlHTML("delete_col");
-			html += tinyMCE.getControlHTML("separator");
-			html += tinyMCE.getControlHTML("split_cells");
-			html += tinyMCE.getControlHTML("merge_cells");
+							m.add({title : 'table.desc', icon : 'table', cmd : 'mceInsertTable', ui : true, value : {action : 'insert'}});
+							m.add({title : 'table.props_desc', icon : 'table_props', cmd : 'mceInsertTable', ui : true});
+							m.add({title : 'table.del', icon : 'delete_table', cmd : 'mceTableDelete', ui : true});
+							m.addSeparator();
+
+							// Cell menu
+							sm = m.addMenu({title : 'table.cell'});
+							sm.add({title : 'table.cell_desc', icon : 'cell_props', cmd : 'mceTableCellProps', ui : true});
+							sm.add({title : 'table.split_cells_desc', icon : 'split_cells', cmd : 'mceTableSplitCells', ui : true});
+							sm.add({title : 'table.merge_cells_desc', icon : 'merge_cells', cmd : 'mceTableMergeCells', ui : true});
+
+							// Row menu
+							sm = m.addMenu({title : 'table.row'});
+							sm.add({title : 'table.row_desc', icon : 'row_props', cmd : 'mceTableRowProps', ui : true});
+							sm.add({title : 'table.row_before_desc', icon : 'row_before', cmd : 'mceTableInsertRowBefore'});
+							sm.add({title : 'table.row_after_desc', icon : 'row_after', cmd : 'mceTableInsertRowAfter'});
+							sm.add({title : 'table.delete_row_desc', icon : 'delete_row', cmd : 'mceTableDeleteRow'});
+							sm.addSeparator();
+							sm.add({title : 'table.cut_row_desc', icon : 'cut', cmd : 'mceTableCutRow'});
+							sm.add({title : 'table.copy_row_desc', icon : 'copy', cmd : 'mceTableCopyRow'});
+							sm.add({title : 'table.paste_row_before_desc', icon : 'paste', cmd : 'mceTablePasteRowBefore'});
+							sm.add({title : 'table.paste_row_after_desc', icon : 'paste', cmd : 'mceTablePasteRowAfter'});
+
+							// Column menu
+							sm = m.addMenu({title : 'table.col'});
+							sm.add({title : 'table.col_before_desc', icon : 'col_before', cmd : 'mceTableInsertColBefore'});
+							sm.add({title : 'table.col_after_desc', icon : 'col_after', cmd : 'mceTableInsertColAfter'});
+							sm.add({title : 'table.delete_col_desc', icon : 'delete_col', cmd : 'mceTableDeleteCol'});
+						} else
+							m.add({title : 'table.desc', icon : 'table', cmd : 'mceInsertTable', ui : true});
+					});
+				}
+			});
 
-			return html;
-		}
+			// Add undo level when new rows are created using the tab key
+			ed.onKeyDown.add(function(ed, e) {
+				if (e.keyCode == 9 && ed.dom.getParent(ed.selection.getNode(), 'TABLE')) {
+					if (!tinymce.isGecko && !tinymce.isOpera) {
+						tinyMCE.execInstanceCommand(ed.editorId, "mceTableMoveToNextRow", true);
+						return tinymce.dom.Event.cancel(e);
+					}
 
-		return "";
-	},
+					ed.undoManager.add();
+				}
+			});
 
-	/**
-	 * Executes the table commands.
-	 */
-	execCommand : function(editor_id, element, command, user_interface, value) {
-		// Is table command
-		switch (command) {
-			case "mceInsertTable":
-			case "mceTableRowProps":
-			case "mceTableCellProps":
-			case "mceTableSplitCells":
-			case "mceTableMergeCells":
-			case "mceTableInsertRowBefore":
-			case "mceTableInsertRowAfter":
-			case "mceTableDeleteRow":
-			case "mceTableInsertColBefore":
-			case "mceTableInsertColAfter":
-			case "mceTableDeleteCol":
-			case "mceTableCutRow":
-			case "mceTableCopyRow":
-			case "mceTablePasteRowBefore":
-			case "mceTablePasteRowAfter":
-			case "mceTableDelete":
-				var inst = tinyMCE.getInstanceById(editor_id);
-
-				inst.execCommand('mceBeginUndoLevel');
-				TinyMCE_TablePlugin._doExecCommand(editor_id, element, command, user_interface, value);
-				inst.execCommand('mceEndUndoLevel');
+			// Select whole table is a table border is clicked
+			if (!tinymce.isIE) {
+				if (ed.getParam('table_selection', true)) {
+					ed.onClick.add(function(ed, e) {
+						e = e.target;
+
+						if (e.nodeName === 'TABLE')
+							ed.selection.select(e);
+					});
+				}
+			}
 
-				return true;
-		}
+			ed.onNodeChange.add(function(ed, cm, n) {
+				var p = ed.dom.getParent(n, 'td,th,caption');
 
-		// Pass to next handler in chain
-		return false;
-	},
-
-	handleNodeChange : function(editor_id, node, undo_index, undo_levels, visual_aid, any_selection) {
-		var colspan = "1", rowspan = "1", tdElm;
-
-		var inst = tinyMCE.getInstanceById(editor_id);
-
-		// Reset table controls
-		tinyMCE.switchClass(editor_id + '_table', 'mceButtonNormal');
-		tinyMCE.switchClass(editor_id + '_delete_table', 'mceButtonDisabled');
-		tinyMCE.switchClass(editor_id + '_row_props', 'mceButtonDisabled');
-		tinyMCE.switchClass(editor_id + '_cell_props', 'mceButtonDisabled');
-		tinyMCE.switchClass(editor_id + '_row_before', 'mceButtonDisabled');
-		tinyMCE.switchClass(editor_id + '_row_after', 'mceButtonDisabled');
-		tinyMCE.switchClass(editor_id + '_delete_row', 'mceButtonDisabled');
-		tinyMCE.switchClass(editor_id + '_col_before', 'mceButtonDisabled');
-		tinyMCE.switchClass(editor_id + '_col_after', 'mceButtonDisabled');
-		tinyMCE.switchClass(editor_id + '_delete_col', 'mceButtonDisabled');
-		tinyMCE.switchClass(editor_id + '_split_cells', 'mceButtonDisabled');
-		tinyMCE.switchClass(editor_id + '_merge_cells', 'mceButtonDisabled');
-
-		// Within a td element
-		if (tdElm = tinyMCE.getParentElement(node, "td,th")) {
-			tinyMCE.switchClass(editor_id + '_cell_props', 'mceButtonSelected');
-			tinyMCE.switchClass(editor_id + '_delete_table', 'mceButtonNormal');
-			tinyMCE.switchClass(editor_id + '_row_before', 'mceButtonNormal');
-			tinyMCE.switchClass(editor_id + '_row_after', 'mceButtonNormal');
-			tinyMCE.switchClass(editor_id + '_delete_row', 'mceButtonNormal');
-			tinyMCE.switchClass(editor_id + '_col_before', 'mceButtonNormal');
-			tinyMCE.switchClass(editor_id + '_col_after', 'mceButtonNormal');
-			tinyMCE.switchClass(editor_id + '_delete_col', 'mceButtonNormal');
+				cm.setActive('table', n.nodeName === 'TABLE' || !!p);
+				if (p && p.nodeName === 'CAPTION')
+					p = null;
+
+				cm.setDisabled('delete_table', !p);
+				cm.setDisabled('delete_col', !p);
+				cm.setDisabled('delete_table', !p);
+				cm.setDisabled('delete_row', !p);
+				cm.setDisabled('col_after', !p);
+				cm.setDisabled('col_before', !p);
+				cm.setDisabled('row_after', !p);
+				cm.setDisabled('row_before', !p);
+				cm.setDisabled('row_props', !p);
+				cm.setDisabled('cell_props', !p);
+				cm.setDisabled('split_cells', !p || (parseInt(ed.dom.getAttrib(p, 'colspan', '1')) < 2 && parseInt(ed.dom.getAttrib(p, 'rowspan', '1')) < 2));
+				cm.setDisabled('merge_cells', !p);
+			});
+
+			// Padd empty table cells
+			if (!tinymce.isIE) {
+				ed.onBeforeSetContent.add(function(ed, o) {
+					if (o.initial)
+						o.content = o.content.replace(/<(td|th)([^>]+|)>\s*<\/(td|th)>/g, tinymce.isOpera ? '<$1$2>&nbsp;</$1>' : '<$1$2><br mce_bogus="1" /></$1>');
+				});
+			}
+		},
 
-			colspan = tinyMCE.getAttrib(tdElm, "colspan");
-			rowspan = tinyMCE.getAttrib(tdElm, "rowspan");
+		execCommand : function(cmd, ui, val) {
+			var ed = this.editor, b;
 
-			colspan = colspan == "" ? "1" : colspan;
-			rowspan = rowspan == "" ? "1" : rowspan;
+			// Is table command
+			switch (cmd) {
+				case "mceTableMoveToNextRow":
+				case "mceInsertTable":
+				case "mceTableRowProps":
+				case "mceTableCellProps":
+				case "mceTableSplitCells":
+				case "mceTableMergeCells":
+				case "mceTableInsertRowBefore":
+				case "mceTableInsertRowAfter":
+				case "mceTableDeleteRow":
+				case "mceTableInsertColBefore":
+				case "mceTableInsertColAfter":
+				case "mceTableDeleteCol":
+				case "mceTableCutRow":
+				case "mceTableCopyRow":
+				case "mceTablePasteRowBefore":
+				case "mceTablePasteRowAfter":
+				case "mceTableDelete":
+					ed.execCommand('mceBeginUndoLevel');
+					this._doExecCommand(cmd, ui, val);
+					ed.execCommand('mceEndUndoLevel');
 
-			if (colspan != "1" || rowspan != "1")
-				tinyMCE.switchClass(editor_id + '_split_cells', 'mceButtonNormal');
-		}
+					return true;
+			}
 
-		// Within a tr element
-		if (tinyMCE.getParentElement(node, "tr"))
-			tinyMCE.switchClass(editor_id + '_row_props', 'mceButtonSelected');
-
-		// Within table
-		if (tinyMCE.getParentElement(node, "table")) {
-			tinyMCE.switchClass(editor_id + '_table', 'mceButtonSelected');
-			tinyMCE.switchClass(editor_id + '_merge_cells', 'mceButtonNormal');
-		}
-	},
+			// Pass to next handler in chain
+			return false;
+		},
 
-	// Private plugin internal methods
+		getInfo : function() {
+			return {
+				longname : 'Tables',
+				author : 'Moxiecode Systems AB',
+				authorurl : 'http://tinymce.moxiecode.com',
+				infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/table',
+				version : tinymce.majorVersion + "." + tinymce.minorVersion
+			};
+		},
+
+		// Private plugin internal methods
+
+		/**
+		 * Executes the table commands.
+		 */
+		_doExecCommand : function(command, user_interface, value) {
+			var inst = this.editor, ed = inst, url = this.url;
+			var focusElm = inst.selection.getNode();
+			var trElm = inst.dom.getParent(focusElm, "tr");
+			var tdElm = inst.dom.getParent(focusElm, "td,th");
+			var tableElm = inst.dom.getParent(focusElm, "table");
+			var doc = inst.contentWindow.document;
+			var tableBorder = tableElm ? tableElm.getAttribute("border") : "";
+
+			// Get first TD if no TD found
+			if (trElm && tdElm == null)
+				tdElm = trElm.cells[0];
+
+			function inArray(ar, v) {
+				for (var i=0; i<ar.length; i++) {
+					// Is array
+					if (ar[i].length > 0 && inArray(ar[i], v))
+						return true;
+
+					// Found value
+					if (ar[i] == v)
+						return true;
+				}
 
-	_mouseDownHandler : function(e) {
-		var elm = tinyMCE.isMSIE ? event.srcElement : e.target;
-		var focusElm = tinyMCE.selectedInstance.getFocusElement();
-
-		// If press on special Mozilla create TD/TR thingie
-		if (elm.nodeName == "BODY" && (focusElm.nodeName == "TD" || focusElm.nodeName == "TH" || (focusElm.parentNode && focusElm.parentNode.nodeName == "TD") ||(focusElm.parentNode && focusElm.parentNode.nodeName == "TH") )) {
-			window.setTimeout(function() {
-				var tableElm = tinyMCE.getParentElement(focusElm, "table");
-				tinyMCE.handleVisualAid(tableElm, true, tinyMCE.settings['visual'], tinyMCE.selectedInstance);
-			}, 10);
-		}
-	},
+				return false;
+			}
 
-	/**
-	 * Executes the table commands.
-	 */
-	_doExecCommand : function(editor_id, element, command, user_interface, value) {
-		var inst = tinyMCE.getInstanceById(editor_id);
-		var focusElm = inst.getFocusElement();
-		var trElm = tinyMCE.getParentElement(focusElm, "tr");
-		var tdElm = tinyMCE.getParentElement(focusElm, "td,th");
-		var tableElm = tinyMCE.getParentElement(focusElm, "table");
-		var doc = inst.contentWindow.document;
-		var tableBorder = tableElm ? tableElm.getAttribute("border") : "";
-
-		// Get first TD if no TD found
-		if (trElm && tdElm == null)
-			tdElm = trElm.cells[0];
-
-		// ------- Inner functions ---------
-		function inArray(ar, v) {
-			for (var i=0; i<ar.length; i++) {
-				// Is array
-				if (ar[i].length > 0 && inArray(ar[i], v))
-					return true;
+			function select(dx, dy) {
+				var td;
 
-				// Found value
-				if (ar[i] == v)
-					return true;
-			}
+				grid = getTableGrid(tableElm);
+				dx = dx || 0;
+				dy = dy || 0;
+				dx = Math.max(cpos.cellindex + dx, 0);
+				dy = Math.max(cpos.rowindex + dy, 0);
+
+				// Recalculate grid and select
+				inst.execCommand('mceRepaint');
+				td = getCell(grid, dy, dx);
+
+				if (td) {
+					inst.selection.select(td.firstChild || td);
+					inst.selection.collapse(1);
+				}
+			};
 
-			return false;
-		}
+			function makeTD() {
+				var newTD = doc.createElement("td");
 
-		function makeTD() {
-			var newTD = doc.createElement("td");
-			newTD.innerHTML = "&nbsp;";
-		}
+				if (!tinymce.isIE)
+					newTD.innerHTML = '<br mce_bogus="1"/>';
+			}
 
-		function getColRowSpan(td) {
-			var colspan = tinyMCE.getAttrib(td, "colspan");
-			var rowspan = tinyMCE.getAttrib(td, "rowspan");
+			function getColRowSpan(td) {
+				var colspan = inst.dom.getAttrib(td, "colspan");
+				var rowspan = inst.dom.getAttrib(td, "rowspan");
 
-			colspan = colspan == "" ? 1 : parseInt(colspan);
-			rowspan = rowspan == "" ? 1 : parseInt(rowspan);
+				colspan = colspan == "" ? 1 : parseInt(colspan);
+				rowspan = rowspan == "" ? 1 : parseInt(rowspan);
 
-			return {colspan : colspan, rowspan : rowspan};
-		}
+				return {colspan : colspan, rowspan : rowspan};
+			}
 
-		function getCellPos(grid, td) {
-			var x, y;
+			function getCellPos(grid, td) {
+				var x, y;
 
-			for (y=0; y<grid.length; y++) {
-				for (x=0; x<grid[y].length; x++) {
-					if (grid[y][x] == td)
-						return {cellindex : x, rowindex : y};
+				for (y=0; y<grid.length; y++) {
+					for (x=0; x<grid[y].length; x++) {
+						if (grid[y][x] == td)
+							return {cellindex : x, rowindex : y};
+					}
 				}
+
+				return null;
 			}
 
-			return null;
-		}
+			function getCell(grid, row, col) {
+				if (grid[row] && grid[row][col])
+					return grid[row][col];
 
-		function getCell(grid, row, col) {
-			if (grid[row] && grid[row][col])
-				return grid[row][col];
+				return null;
+			}
 
-			return null;
-		}
+			function getNextCell(table, cell) {
+				var cells = [], x = 0, i, j, cell, nextCell;
+
+				for (i = 0; i < table.rows.length; i++)
+					for (j = 0; j < table.rows[i].cells.length; j++, x++)
+						cells[x] = table.rows[i].cells[j];
+
+				for (i = 0; i < cells.length; i++)
+					if (cells[i] == cell)
+						if (nextCell = cells[i+1])
+							return nextCell;
+			}
 
-		function getTableGrid(table) {
-			var grid = new Array(), rows = table.rows, x, y, td, sd, xstart, x2, y2;
+			function getTableGrid(table) {
+				var grid = [], rows = table.rows, x, y, td, sd, xstart, x2, y2;
 
-			for (y=0; y<rows.length; y++) {
-				for (x=0; x<rows[y].cells.length; x++) {
-					td = rows[y].cells[x];
-					sd = getColRowSpan(td);
-
-					// All ready filled
-					for (xstart = x; grid[y] && grid[y][xstart]; xstart++) ;
-
-					// Fill box
-					for (y2=y; y2<y+sd['rowspan']; y2++) {
-						if (!grid[y2])
-							grid[y2] = new Array();
+				for (y=0; y<rows.length; y++) {
+					for (x=0; x<rows[y].cells.length; x++) {
+						td = rows[y].cells[x];
+						sd = getColRowSpan(td);
+
+						// All ready filled
+						for (xstart = x; grid[y] && grid[y][xstart]; xstart++) ;
+
+						// Fill box
+						for (y2=y; y2<y+sd['rowspan']; y2++) {
+							if (!grid[y2])
+								grid[y2] = [];
 
-						for (x2=xstart; x2<xstart+sd['colspan']; x2++)
-							grid[y2][x2] = td;
+							for (x2=xstart; x2<xstart+sd['colspan']; x2++)
+								grid[y2][x2] = td;
+						}
 					}
 				}
+
+				return grid;
 			}
 
-			return grid;
-		}
+			function trimRow(table, tr, td, new_tr) {
+				var grid = getTableGrid(table), cpos = getCellPos(grid, td);
+				var cells, lastElm;
+
+				// Time to crop away some
+				if (new_tr.cells.length != tr.childNodes.length) {
+					cells = tr.childNodes;
+					lastElm = null;
+
+					for (var x=0; td = getCell(grid, cpos.rowindex, x); x++) {
+						var remove = true;
+						var sd = getColRowSpan(td);
+
+						// Remove due to rowspan
+						if (inArray(cells, td)) {
+							new_tr.childNodes[x]._delete = true;
+						} else if ((lastElm == null || td != lastElm) && sd.colspan > 1) { // Remove due to colspan
+							for (var i=x; i<x+td.colSpan; i++)
+								new_tr.childNodes[i]._delete = true;
+						}
 
-		function trimRow(table, tr, td, new_tr) {
-			var grid = getTableGrid(table), cpos = getCellPos(grid, td);
-			var cells, lastElm;
-
-			// Time to crop away some
-			if (new_tr.cells.length != tr.childNodes.length) {
-				cells = tr.childNodes;
-				lastElm = null;
-
-				for (var x=0; td = getCell(grid, cpos.rowindex, x); x++) {
-					var remove = true;
-					var sd = getColRowSpan(td);
-
-					// Remove due to rowspan
-					if (inArray(cells, td)) {
-						new_tr.childNodes[x]._delete = true;
-					} else if ((lastElm == null || td != lastElm) && sd.colspan > 1) { // Remove due to colspan
-						for (var i=x; i<x+td.colSpan; i++)
-							new_tr.childNodes[i]._delete = true;
+						if ((lastElm == null || td != lastElm) && sd.rowspan > 1)
+							td.rowSpan = sd.rowspan + 1;
+
+						lastElm = td;
 					}
 
-					if ((lastElm == null || td != lastElm) && sd.rowspan > 1)
-						td.rowSpan = sd.rowspan + 1;
+					deleteMarked(tableElm);
+				}
+			}
 
-					lastElm = td;
+			function prevElm(node, name) {
+				while ((node = node.previousSibling) != null) {
+					if (node.nodeName == name)
+						return node;
 				}
 
-				deleteMarked(tableElm);
+				return null;
 			}
-		}
 
-		function prevElm(node, name) {
-			while ((node = node.previousSibling) != null) {
-				if (node.nodeName == name)
-					return node;
+			function nextElm(node, names) {
+				var namesAr = names.split(',');
+
+				while ((node = node.nextSibling) != null) {
+					for (var i=0; i<namesAr.length; i++) {
+						if (node.nodeName.toLowerCase() == namesAr[i].toLowerCase() )
+							return node;
+					}
+				}
+
+				return null;
 			}
 
-			return null;
-		}
+			function deleteMarked(tbl) {
+				if (tbl.rows == 0)
+					return;
+
+				var tr = tbl.rows[0];
+				do {
+					var next = nextElm(tr, "TR");
+
+					// Delete row
+					if (tr._delete) {
+						tr.parentNode.removeChild(tr);
+						continue;
+					}
+
+					// Delete cells
+					var td = tr.cells[0];
+					if (td.cells > 1) {
+						do {
+							var nexttd = nextElm(td, "TD,TH");
+
+							if (td._delete)
+								td.parentNode.removeChild(td);
+						} while ((td = nexttd) != null);
+					}
+				} while ((tr = next) != null);
+			}
 
-		function nextElm(node, names) {
-			var namesAr = names.split(',');
+			function addRows(td_elm, tr_elm, rowspan) {
+				// Add rows
+				td_elm.rowSpan = 1;
+				var trNext = nextElm(tr_elm, "TR");
+				for (var i=1; i<rowspan && trNext; i++) {
+					var newTD = doc.createElement("td");
+
+					if (!tinymce.isIE)
+						newTD.innerHTML = '<br mce_bogus="1"/>';
+
+					if (tinymce.isIE)
+						trNext.insertBefore(newTD, trNext.cells(td_elm.cellIndex));
+					else
+						trNext.insertBefore(newTD, trNext.cells[td_elm.cellIndex]);
 
-			while ((node = node.nextSibling) != null) {
-				for (var i=0; i<namesAr.length; i++) {
-					if (node.nodeName.toLowerCase() == namesAr[i].toLowerCase() )
-						return node;
+					trNext = nextElm(trNext, "TR");
 				}
 			}
 
-			return null;
-		}
+			function copyRow(doc, table, tr) {
+				var grid = getTableGrid(table);
+				var newTR = tr.cloneNode(false);
+				var cpos = getCellPos(grid, tr.cells[0]);
+				var lastCell = null;
+				var tableBorder = inst.dom.getAttrib(table, "border");
+				var tdElm = null;
+
+				for (var x=0; tdElm = getCell(grid, cpos.rowindex, x); x++) {
+					var newTD = null;
+
+					if (lastCell != tdElm) {
+						for (var i=0; i<tr.cells.length; i++) {
+							if (tdElm == tr.cells[i]) {
+								newTD = tdElm.cloneNode(true);
+								break;
+							}
+						}
+					}
 
-		function deleteMarked(tbl) {
-			if (tbl.rows == 0)
-				return;
-
-			var tr = tbl.rows[0];
-			do {
-				var next = nextElm(tr, "TR");
-
-				// Delete row
-				if (tr._delete) {
-					tr.parentNode.removeChild(tr);
-					continue;
-				}
+					if (newTD == null) {
+						newTD = doc.createElement("td");
 
-				// Delete cells
-				var td = tr.cells[0];
-				if (td.cells > 1) {
-					do {
-						var nexttd = nextElm(td, "TD,TH");
-
-						if (td._delete)
-							td.parentNode.removeChild(td);
-					} while ((td = nexttd) != null);
-				}
-			} while ((tr = next) != null);
-		}
+						if (!tinymce.isIE)
+							newTD.innerHTML = '<br mce_bogus="1"/>';
+					}
 
-		function addRows(td_elm, tr_elm, rowspan) {
-			// Add rows
-			td_elm.rowSpan = 1;
-			var trNext = nextElm(tr_elm, "TR");
-			for (var i=1; i<rowspan && trNext; i++) {
-				var newTD = doc.createElement("td");
-				newTD.innerHTML = "&nbsp;";
+					// Reset col/row span
+					newTD.colSpan = 1;
+					newTD.rowSpan = 1;
 
-				if (tinyMCE.isMSIE)
-					trNext.insertBefore(newTD, trNext.cells(td_elm.cellIndex));
-				else
-					trNext.insertBefore(newTD, trNext.cells[td_elm.cellIndex]);
+					newTR.appendChild(newTD);
 
-				trNext = nextElm(trNext, "TR");
+					lastCell = tdElm;
+				}
+
+				return newTR;
 			}
-		}
 
-		function copyRow(doc, table, tr) {
-			var grid = getTableGrid(table);
-			var newTR = tr.cloneNode(false);
-			var cpos = getCellPos(grid, tr.cells[0]);
-			var lastCell = null;
-			var tableBorder = tinyMCE.getAttrib(table, "border");
-			var tdElm = null;
-
-			for (var x=0; tdElm = getCell(grid, cpos.rowindex, x); x++) {
-				var newTD = null;
-
-				if (lastCell != tdElm) {
-					for (var i=0; i<tr.cells.length; i++) {
-						if (tdElm == tr.cells[i]) {
-							newTD = tdElm.cloneNode(true);
-							break;
-						}
+			// ---- Commands -----
+
+			// Handle commands
+			switch (command) {
+				case "mceTableMoveToNextRow":
+					var nextCell = getNextCell(tableElm, tdElm);
+
+					if (!nextCell) {
+						inst.execCommand("mceTableInsertRowAfter", tdElm);
+						nextCell = getNextCell(tableElm, tdElm);
 					}
-				}
 
-				if (newTD == null) {
-					newTD = doc.createElement("td");
-					newTD.innerHTML = "&nbsp;";
-				}
+					inst.selection.select(nextCell);
+					inst.selection.collapse(true);
 
-				// Reset col/row span
-				newTD.colSpan = 1;
-				newTD.rowSpan = 1;
+					return true;
 
-				newTR.appendChild(newTD);
+				case "mceTableRowProps":
+					if (trElm == null)
+						return true;
+
+					if (user_interface) {
+						inst.windowManager.open({
+							url : url + '/row.htm',
+							width : 400 + parseInt(inst.getLang('table.rowprops_delta_width', 0)),
+							height : 295 + parseInt(inst.getLang('table.rowprops_delta_height', 0)),
+							inline : 1
+						}, {
+							plugin_url : url
+						});
+					}
 
-				lastCell = tdElm;
-			}
+					return true;
 
-			return newTR;
-		}
+				case "mceTableCellProps":
+					if (tdElm == null)
+						return true;
+
+					if (user_interface) {
+						inst.windowManager.open({
+							url : url + '/cell.htm',
+							width : 400 + parseInt(inst.getLang('table.cellprops_delta_width', 0)),
+							height : 295 + parseInt(inst.getLang('table.cellprops_delta_height', 0)),
+							inline : 1
+						}, {
+							plugin_url : url
+						});
+					}
+
+					return true;
 
-		// ---- Commands -----
+				case "mceInsertTable":
+					if (user_interface) {
+						inst.windowManager.open({
+							url : url + '/table.htm',
+							width : 400 + parseInt(inst.getLang('table.table_delta_width', 0)),
+							height : 320 + parseInt(inst.getLang('table.table_delta_height', 0)),
+							inline : 1
+						}, {
+							plugin_url : url,
+							action : value ? value.action : 0
+						});
+					}
 
-		// Handle commands
-		switch (command) {
-			case "mceTableRowProps":
-				if (trElm == null)
 					return true;
 
-				if (user_interface) {
-					// Setup template
-					var template = new Array();
-
-					template['file'] = '../../plugins/table/row.htm';
-					template['width'] = 380;
-					template['height'] = 295;
-
-					// Language specific width and height addons
-					template['width'] += tinyMCE.getLang('lang_table_rowprops_delta_width', 0);
-					template['height'] += tinyMCE.getLang('lang_table_rowprops_delta_height', 0);
+				case "mceTableDelete":
+					var table = inst.dom.getParent(inst.selection.getNode(), "table");
+					if (table) {
+						table.parentNode.removeChild(table);
+						inst.execCommand('mceRepaint');
+					}
+					return true;
 
-					// Open window
-					tinyMCE.openWindow(template, {editor_id : inst.editorId, inline : "yes"});
-				}
+				case "mceTableSplitCells":
+				case "mceTableMergeCells":
+				case "mceTableInsertRowBefore":
+				case "mceTableInsertRowAfter":
+				case "mceTableDeleteRow":
+				case "mceTableInsertColBefore":
+				case "mceTableInsertColAfter":
+				case "mceTableDeleteCol":
+				case "mceTableCutRow":
+				case "mceTableCopyRow":
+				case "mceTablePasteRowBefore":
+				case "mceTablePasteRowAfter":
+					// No table just return (invalid command)
+					if (!tableElm)
+						return true;
+
+					// Table has a tbody use that reference
+					// Changed logic by ApTest 2005.07.12 (www.aptest.com)
+					// Now lookk at the focused element and take its parentNode.  That will be a tbody or a table.
+					if (trElm && tableElm != trElm.parentNode)
+						tableElm = trElm.parentNode;
+
+					if (tableElm && trElm) {
+						switch (command) {
+							case "mceTableCutRow":
+								if (!trElm || !tdElm)
+									return true;
 
-				return true;
+								inst.tableRowClipboard = copyRow(doc, tableElm, trElm);
+								inst.execCommand("mceTableDeleteRow");
+								break;
 
-			case "mceTableCellProps":
-				if (tdElm == null)
-					return true;
+							case "mceTableCopyRow":
+								if (!trElm || !tdElm)
+									return true;
 
-				if (user_interface) {
-					// Setup template
-					var template = new Array();
-
-					template['file'] = '../../plugins/table/cell.htm';
-					template['width'] = 380;
-					template['height'] = 295;
-
-					// Language specific width and height addons
-					template['width'] += tinyMCE.getLang('lang_table_cellprops_delta_width', 0);
-					template['height'] += tinyMCE.getLang('lang_table_cellprops_delta_height', 0);
+								inst.tableRowClipboard = copyRow(doc, tableElm, trElm);
+								break;
 
-					// Open window
-					tinyMCE.openWindow(template, {editor_id : inst.editorId, inline : "yes"});
-				}
+							case "mceTablePasteRowBefore":
+								if (!trElm || !tdElm)
+									return true;
 
-				return true;
+								var newTR = inst.tableRowClipboard.cloneNode(true);
 
-			case "mceInsertTable":
-				if (user_interface) {
-					// Setup template
-					var template = new Array();
-
-					template['file'] = '../../plugins/table/table.htm';
-					template['width'] = 380;
-					template['height'] = 295;
-
-					// Language specific width and height addons
-					template['width'] += tinyMCE.getLang('lang_table_table_delta_width', 0);
-					template['height'] += tinyMCE.getLang('lang_table_table_delta_height', 0);
+								var prevTR = prevElm(trElm, "TR");
+								if (prevTR != null)
+									trimRow(tableElm, prevTR, prevTR.cells[0], newTR);
 
-					// Open window
-					tinyMCE.openWindow(template, {editor_id : inst.editorId, inline : "yes", action : value});
-				}
+								trElm.parentNode.insertBefore(newTR, trElm);
+								break;
 
-				return true;
+							case "mceTablePasteRowAfter":
+								if (!trElm || !tdElm)
+									return true;
+								
+								var nextTR = nextElm(trElm, "TR");
+								var newTR = inst.tableRowClipboard.cloneNode(true);
 
-			case "mceTableDelete":
-				var table = tinyMCE.getParentElement(inst.getFocusElement(), "table");
-				if (table) {
-					table.parentNode.removeChild(table);
-					inst.repaint();
-				}
-				return true;
+								trimRow(tableElm, trElm, tdElm, newTR);
 
-			case "mceTableSplitCells":
-			case "mceTableMergeCells":
-			case "mceTableInsertRowBefore":
-			case "mceTableInsertRowAfter":
-			case "mceTableDeleteRow":
-			case "mceTableInsertColBefore":
-			case "mceTableInsertColAfter":
-			case "mceTableDeleteCol":
-			case "mceTableCutRow":
-			case "mceTableCopyRow":
-			case "mceTablePasteRowBefore":
-			case "mceTablePasteRowAfter":
-				// No table just return (invalid command)
-				if (!tableElm)
-					return true;
+								if (nextTR == null)
+									trElm.parentNode.appendChild(newTR);
+								else
+									nextTR.parentNode.insertBefore(newTR, nextTR);
 
-				// Table has a tbody use that reference
-				// Changed logic by ApTest 2005.07.12 (www.aptest.com)
-				// Now lookk at the focused element and take its parentNode.  That will be a tbody or a table.
-				if (trElm && tableElm != trElm.parentNode)
-					tableElm = trElm.parentNode;
-
-				if (tableElm && trElm) {
-					switch (command) {
-						case "mceTableCutRow":
-							if (!trElm || !tdElm)
-								return true;
+								break;
 
-							inst.tableRowClipboard = copyRow(doc, tableElm, trElm);
-							inst.execCommand("mceTableDeleteRow");
-							break;
+							case "mceTableInsertRowBefore":
+								if (!trElm || !tdElm)
+									return true;
 
-						case "mceTableCopyRow":
-							if (!trElm || !tdElm)
-								return true;
+								var grid = getTableGrid(tableElm);
+								var cpos = getCellPos(grid, tdElm);
+								var newTR = doc.createElement("tr");
+								var lastTDElm = null;
 
-							inst.tableRowClipboard = copyRow(doc, tableElm, trElm);
-							break;
+								cpos.rowindex--;
+								if (cpos.rowindex < 0)
+									cpos.rowindex = 0;
 
-						case "mceTablePasteRowBefore":
-							if (!trElm || !tdElm)
-								return true;
+								// Create cells
+								for (var x=0; tdElm = getCell(grid, cpos.rowindex, x); x++) {
+									if (tdElm != lastTDElm) {
+										var sd = getColRowSpan(tdElm);
 
-							var newTR = inst.tableRowClipboard.cloneNode(true);
+										if (sd['rowspan'] == 1) {
+											var newTD = doc.createElement("td");
 
-							var prevTR = prevElm(trElm, "TR");
-							if (prevTR != null)
-								trimRow(tableElm, prevTR, prevTR.cells[0], newTR);
+											if (!tinymce.isIE)
+												newTD.innerHTML = '<br mce_bogus="1"/>';
 
-							trElm.parentNode.insertBefore(newTR, trElm);
-							break;
+											newTD.colSpan = tdElm.colSpan;
 
-						case "mceTablePasteRowAfter":
-							if (!trElm || !tdElm)
-								return true;
-							
-							var nextTR = nextElm(trElm, "TR");
-							var newTR = inst.tableRowClipboard.cloneNode(true);
-
-							trimRow(tableElm, trElm, tdElm, newTR);
-
-							if (nextTR == null)
-								trElm.parentNode.appendChild(newTR);
-							else
-								nextTR.parentNode.insertBefore(newTR, nextTR);
+											newTR.appendChild(newTD);
+										} else
+											tdElm.rowSpan = sd['rowspan'] + 1;
 
+										lastTDElm = tdElm;
+									}
+								}
+
+								trElm.parentNode.insertBefore(newTR, trElm);
+								select(0, 1);
 							break;
 
-						case "mceTableInsertRowBefore":
-							if (!trElm || !tdElm)
-								return true;
+							case "mceTableInsertRowAfter":
+								if (!trElm || !tdElm)
+									return true;
 
-							var grid = getTableGrid(tableElm);
-							var cpos = getCellPos(grid, tdElm);
-							var newTR = doc.createElement("tr");
-							var lastTDElm = null;
-
-							cpos.rowindex--;
-							if (cpos.rowindex < 0)
-								cpos.rowindex = 0;
-
-							// Create cells
-							for (var x=0; tdElm = getCell(grid, cpos.rowindex, x); x++) {
-								if (tdElm != lastTDElm) {
-									var sd = getColRowSpan(tdElm);
-
-									if (sd['rowspan'] == 1) {
-										var newTD = doc.createElement("td");
-
-										newTD.innerHTML = "&nbsp;";
-										newTD.colSpan = tdElm.colSpan;
-
-										newTR.appendChild(newTD);
-									} else
-										tdElm.rowSpan = sd['rowspan'] + 1;
+								var grid = getTableGrid(tableElm);
+								var cpos = getCellPos(grid, tdElm);
+								var newTR = doc.createElement("tr");
+								var lastTDElm = null;
 
-									lastTDElm = tdElm;
-								}
-							}
+								// Create cells
+								for (var x=0; tdElm = getCell(grid, cpos.rowindex, x); x++) {
+									if (tdElm != lastTDElm) {
+										var sd = getColRowSpan(tdElm);
 
-							trElm.parentNode.insertBefore(newTR, trElm);
+										if (sd['rowspan'] == 1) {
+											var newTD = doc.createElement("td");
 
-							grid = getTableGrid(tableElm);
-							inst.selection.selectNode(getCell(grid, cpos.rowindex + 1, cpos.cellindex), tinyMCE.isGecko, true); // Only collape on gecko
-						break;
+											if (!tinymce.isIE)
+												newTD.innerHTML = '<br mce_bogus="1"/>';
 
-						case "mceTableInsertRowAfter":
-							if (!trElm || !tdElm)
-								return true;
+											newTD.colSpan = tdElm.colSpan;
 
-							var grid = getTableGrid(tableElm);
-							var cpos = getCellPos(grid, tdElm);
-							var newTR = doc.createElement("tr");
-							var lastTDElm = null;
-
-							// Create cells
-							for (var x=0; tdElm = getCell(grid, cpos.rowindex, x); x++) {
-								if (tdElm != lastTDElm) {
-									var sd = getColRowSpan(tdElm);
-
-									if (sd['rowspan'] == 1) {
-										var newTD = doc.createElement("td");
-
-										newTD.innerHTML = "&nbsp;";
-										newTD.colSpan = tdElm.colSpan;
-
-										newTR.appendChild(newTD);
-									} else
-										tdElm.rowSpan = sd['rowspan'] + 1;
+											newTR.appendChild(newTD);
+										} else
+											tdElm.rowSpan = sd['rowspan'] + 1;
 
-									lastTDElm = tdElm;
+										lastTDElm = tdElm;
+									}
 								}
-							}
 
-							if (newTR.hasChildNodes()) {
-								var nextTR = nextElm(trElm, "TR");
-								if (nextTR)
-									nextTR.parentNode.insertBefore(newTR, nextTR);
-								else
-									tableElm.appendChild(newTR);
-							}
+								if (newTR.hasChildNodes()) {
+									var nextTR = nextElm(trElm, "TR");
+									if (nextTR)
+										nextTR.parentNode.insertBefore(newTR, nextTR);
+									else
+										tableElm.appendChild(newTR);
+								}
 
-							grid = getTableGrid(tableElm);
-							inst.selection.selectNode(getCell(grid, cpos.rowindex, cpos.cellindex), tinyMCE.isGecko, true); // Only collape on gecko
-						break;
+								select(0, 1);
+							break;
 
-						case "mceTableDeleteRow":
-							if (!trElm || !tdElm)
-								return true;
+							case "mceTableDeleteRow":
+								if (!trElm || !tdElm)
+									return true;
 
-							var grid = getTableGrid(tableElm);
-							var cpos = getCellPos(grid, tdElm);
+								var grid = getTableGrid(tableElm);
+								var cpos = getCellPos(grid, tdElm);
 
-							// Only one row, remove whole table
-							if (grid.length == 1) {
-								tableElm = tinyMCE.getParentElement(tableElm, "table"); // Look for table instead of tbody
-								tableElm.parentNode.removeChild(tableElm);
-								return true;
-							}
+								// Only one row, remove whole table
+								if (grid.length == 1 && tableElm.nodeName == 'TBODY') {
+									inst.dom.remove(inst.dom.getParent(tableElm, "table"));
+									return true;
+								}
 
-							// Move down row spanned cells
-							var cells = trElm.cells;
-							var nextTR = nextElm(trElm, "TR");
-							for (var x=0; x<cells.length; x++) {
-								if (cells[x].rowSpan > 1) {
-									var newTD = cells[x].cloneNode(true);
-									var sd = getColRowSpan(cells[x]);
+								// Move down row spanned cells
+								var cells = trElm.cells;
+								var nextTR = nextElm(trElm, "TR");
+								for (var x=0; x<cells.length; x++) {
+									if (cells[x].rowSpan > 1) {
+										var newTD = cells[x].cloneNode(true);
+										var sd = getColRowSpan(cells[x]);
 
-									newTD.rowSpan = sd.rowspan - 1;
+										newTD.rowSpan = sd.rowspan - 1;
 
-									var nextTD = nextTR.cells[x];
+										var nextTD = nextTR.cells[x];
 
-									if (nextTD == null)
-										nextTR.appendChild(newTD);
-									else
-										nextTR.insertBefore(newTD, nextTD);
+										if (nextTD == null)
+											nextTR.appendChild(newTD);
+										else
+											nextTR.insertBefore(newTD, nextTD);
+									}
 								}
-							}
 
-							// Delete cells
-							var lastTDElm = null;
-							for (var x=0; tdElm = getCell(grid, cpos.rowindex, x); x++) {
-								if (tdElm != lastTDElm) {
-									var sd = getColRowSpan(tdElm);
-
-									if (sd.rowspan > 1) {
-										tdElm.rowSpan = sd.rowspan - 1;
-									} else {
-										trElm = tdElm.parentNode;
+								// Delete cells
+								var lastTDElm = null;
+								for (var x=0; tdElm = getCell(grid, cpos.rowindex, x); x++) {
+									if (tdElm != lastTDElm) {
+										var sd = getColRowSpan(tdElm);
+
+										if (sd.rowspan > 1) {
+											tdElm.rowSpan = sd.rowspan - 1;
+										} else {
+											trElm = tdElm.parentNode;
 
-										if (trElm.parentNode)
-											trElm._delete = true;
-									}
+											if (trElm.parentNode)
+												trElm._delete = true;
+										}
 
-									lastTDElm = tdElm;
+										lastTDElm = tdElm;
+									}
 								}
-							}
 
-							deleteMarked(tableElm);
+								deleteMarked(tableElm);
 
-							cpos.rowindex--;
-							if (cpos.rowindex < 0)
-								cpos.rowindex = 0;
-
-							// Recalculate grid and select
-							grid = getTableGrid(tableElm);
-							inst.selection.selectNode(getCell(grid, cpos.rowindex, 0), tinyMCE.isGecko, true); // Only collape on gecko
-						break;
+								select(0, -1);
+							break;
 
-						case "mceTableInsertColBefore":
-							if (!trElm || !tdElm)
-								return true;
+							case "mceTableInsertColBefore":
+								if (!trElm || !tdElm)
+									return true;
 
-							var grid = getTableGrid(tableElm);
-							var cpos = getCellPos(grid, tdElm);
-							var lastTDElm = null;
+								var grid = getTableGrid(inst.dom.getParent(tableElm, "table"));
+								var cpos = getCellPos(grid, tdElm);
+								var lastTDElm = null;
+
+								for (var y=0; tdElm = getCell(grid, y, cpos.cellindex); y++) {
+									if (tdElm != lastTDElm) {
+										var sd = getColRowSpan(tdElm);
 
-							for (var y=0; tdElm = getCell(grid, y, cpos.cellindex); y++) {
-								if (tdElm != lastTDElm) {
-									var sd = getColRowSpan(tdElm);
+										if (sd['colspan'] == 1) {
+											var newTD = doc.createElement(tdElm.nodeName);
 
-									if (sd['colspan'] == 1) {
-										var newTD = doc.createElement(tdElm.nodeName);
+											if (!tinymce.isIE)
+												newTD.innerHTML = '<br mce_bogus="1"/>';
 
-										newTD.innerHTML = "&nbsp;";
-										newTD.rowSpan = tdElm.rowSpan;
+											newTD.rowSpan = tdElm.rowSpan;
 
-										tdElm.parentNode.insertBefore(newTD, tdElm);
-									} else
-										tdElm.colSpan++;
+											tdElm.parentNode.insertBefore(newTD, tdElm);
+										} else
+											tdElm.colSpan++;
 
-									lastTDElm = tdElm;
+										lastTDElm = tdElm;
+									}
 								}
-							}
 
-							grid = getTableGrid(tableElm);
-							inst.selection.selectNode(getCell(grid, cpos.rowindex, cpos.cellindex + 1), tinyMCE.isGecko, true); // Only collape on gecko
-						break;
+								select();
+							break;
 
-						case "mceTableInsertColAfter":
-							if (!trElm || !tdElm)
-								return true;
+							case "mceTableInsertColAfter":
+								if (!trElm || !tdElm)
+									return true;
 
-							var grid = getTableGrid(tableElm);
-							var cpos = getCellPos(grid, tdElm);
-							var lastTDElm = null;
+								var grid = getTableGrid(inst.dom.getParent(tableElm, "table"));
+								var cpos = getCellPos(grid, tdElm);
+								var lastTDElm = null;
 
-							for (var y=0; tdElm = getCell(grid, y, cpos.cellindex); y++) {
-								if (tdElm != lastTDElm) {
-									var sd = getColRowSpan(tdElm);
+								for (var y=0; tdElm = getCell(grid, y, cpos.cellindex); y++) {
+									if (tdElm != lastTDElm) {
+										var sd = getColRowSpan(tdElm);
 
-									if (sd['colspan'] == 1) {
-										var newTD = doc.createElement(tdElm.nodeName);
+										if (sd['colspan'] == 1) {
+											var newTD = doc.createElement(tdElm.nodeName);
 
-										newTD.innerHTML = "&nbsp;";
-										newTD.rowSpan = tdElm.rowSpan;
+											if (!tinymce.isIE)
+												newTD.innerHTML = '<br mce_bogus="1"/>';
 
-										var nextTD = nextElm(tdElm, "TD,TH");
-										if (nextTD == null)
-											tdElm.parentNode.appendChild(newTD);
-										else
-											nextTD.parentNode.insertBefore(newTD, nextTD);
-									} else
-										tdElm.colSpan++;
+											newTD.rowSpan = tdElm.rowSpan;
 
-									lastTDElm = tdElm;
+											var nextTD = nextElm(tdElm, "TD,TH");
+											if (nextTD == null)
+												tdElm.parentNode.appendChild(newTD);
+											else
+												nextTD.parentNode.insertBefore(newTD, nextTD);
+										} else
+											tdElm.colSpan++;
+
+										lastTDElm = tdElm;
+									}
 								}
-							}
 
-							grid = getTableGrid(tableElm);
-							inst.selection.selectNode(getCell(grid, cpos.rowindex, cpos.cellindex), tinyMCE.isGecko, true); // Only collape on gecko
-						break;
+								select(1);
+							break;
 
-						case "mceTableDeleteCol":
-							if (!trElm || !tdElm)
-								return true;
+							case "mceTableDeleteCol":
+								if (!trElm || !tdElm)
+									return true;
 
-							var grid = getTableGrid(tableElm);
-							var cpos = getCellPos(grid, tdElm);
-							var lastTDElm = null;
+								var grid = getTableGrid(tableElm);
+								var cpos = getCellPos(grid, tdElm);
+								var lastTDElm = null;
 
-							// Only one col, remove whole table
-							if (grid.length > 1 && grid[0].length <= 1) {
-								tableElm = tinyMCE.getParentElement(tableElm, "table"); // Look for table instead of tbody
-								tableElm.parentNode.removeChild(tableElm);
-								return true;
-							}
+								// Only one col, remove whole table
+								if ((grid.length > 1 && grid[0].length <= 1) && tableElm.nodeName == 'TBODY') {
+									inst.dom.remove(inst.dom.getParent(tableElm, "table"));
+									return true;
+								}
 
-							// Delete cells
-							for (var y=0; tdElm = getCell(grid, y, cpos.cellindex); y++) {
-								if (tdElm != lastTDElm) {
-									var sd = getColRowSpan(tdElm);
-
-									if (sd['colspan'] > 1)
-										tdElm.colSpan = sd['colspan'] - 1;
-									else {
-										if (tdElm.parentNode)
-											tdElm.parentNode.removeChild(tdElm);
-									}
+								// Delete cells
+								for (var y=0; tdElm = getCell(grid, y, cpos.cellindex); y++) {
+									if (tdElm != lastTDElm) {
+										var sd = getColRowSpan(tdElm);
+
+										if (sd['colspan'] > 1)
+											tdElm.colSpan = sd['colspan'] - 1;
+										else {
+											if (tdElm.parentNode)
+												tdElm.parentNode.removeChild(tdElm);
+										}
 
-									lastTDElm = tdElm;
+										lastTDElm = tdElm;
+									}
 								}
-							}
 
-							cpos.cellindex--;
-							if (cpos.cellindex < 0)
-								cpos.cellindex = 0;
+								select(-1);
+							break;
 
-							// Recalculate grid and select
-							grid = getTableGrid(tableElm);
-							inst.selection.selectNode(getCell(grid, cpos.rowindex, 0), tinyMCE.isGecko, true); // Only collape on gecko
-						break;
+						case "mceTableSplitCells":
+							if (!trElm || !tdElm)
+								return true;
 
-					case "mceTableSplitCells":
-						if (!trElm || !tdElm)
-							return true;
+							var spandata = getColRowSpan(tdElm);
 
-						var spandata = getColRowSpan(tdElm);
+							var colspan = spandata["colspan"];
+							var rowspan = spandata["rowspan"];
 
-						var colspan = spandata["colspan"];
-						var rowspan = spandata["rowspan"];
+							// Needs splitting
+							if (colspan > 1 || rowspan > 1) {
+								// Generate cols
+								tdElm.colSpan = 1;
+								for (var i=1; i<colspan; i++) {
+									var newTD = doc.createElement("td");
 
-						// Needs splitting
-						if (colspan > 1 || rowspan > 1) {
-							// Generate cols
-							tdElm.colSpan = 1;
-							for (var i=1; i<colspan; i++) {
-								var newTD = doc.createElement("td");
+									if (!tinymce.isIE)
+										newTD.innerHTML = '<br mce_bogus="1"/>';
 
-								newTD.innerHTML = "&nbsp;";
+									trElm.insertBefore(newTD, nextElm(tdElm, "TD,TH"));
 
-								trElm.insertBefore(newTD, nextElm(tdElm, "TD,TH"));
+									if (rowspan > 1)
+										addRows(newTD, trElm, rowspan);
+								}
 
-								if (rowspan > 1)
-									addRows(newTD, trElm, rowspan);
+								addRows(tdElm, trElm, rowspan);
 							}
 
-							addRows(tdElm, trElm, rowspan);
-						}
+							// Apply visual aids
+							tableElm = inst.dom.getParent(inst.selection.getNode(), "table");
+							break;
 
-						// Apply visual aids
-						tableElm = tinyMCE.getParentElement(inst.getFocusElement(), "table");
-						break;
-
-					case "mceTableMergeCells":
-						var rows = new Array();
-						var sel = inst.getSel();
-						var grid = getTableGrid(tableElm);
-
-						if (tinyMCE.isMSIE || sel.rangeCount == 1) {
-							if (user_interface) {
-								// Setup template
-								var template = new Array();
-								var sp = getColRowSpan(tdElm);
-
-								template['file'] = '../../plugins/table/merge_cells.htm';
-								template['width'] = 250;
-								template['height'] = 105 + (tinyMCE.isNS7 ? 25 : 0);
-
-								// Language specific width and height addons
-								template['width'] += tinyMCE.getLang('lang_table_merge_cells_delta_width', 0);
-								template['height'] += tinyMCE.getLang('lang_table_merge_cells_delta_height', 0);
+						case "mceTableMergeCells":
+							var rows = [];
+							var sel = inst.selection.getSel();
+							var grid = getTableGrid(tableElm);
 
-								// Open window
-								tinyMCE.openWindow(template, {editor_id : inst.editorId, inline : "yes", action : "update", numcols : sp.colspan, numrows : sp.rowspan});
+							if (tinymce.isIE || sel.rangeCount == 1) {
+								if (user_interface) {
+									// Setup template
+									var sp = getColRowSpan(tdElm);
+
+									inst.windowManager.open({
+										url : url + '/merge_cells.htm',
+										width : 240 + parseInt(inst.getLang('table.merge_cells_delta_width', 0)),
+										height : 110 + parseInt(inst.getLang('table.merge_cells_delta_height', 0)),
+										inline : 1
+									}, {
+										action : "update",
+										numcols : sp.colspan,
+										numrows : sp.rowspan,
+										plugin_url : url
+									});
 
-								return true;
+									return true;
+								} else {
+									var numRows = parseInt(value['numrows']);
+									var numCols = parseInt(value['numcols']);
+									var cpos = getCellPos(grid, tdElm);
+
+									if (("" + numRows) == "NaN")
+										numRows = 1;
+
+									if (("" + numCols) == "NaN")
+										numCols = 1;
+
+									// Get rows and cells
+									var tRows = tableElm.rows;
+									for (var y=cpos.rowindex; y<grid.length; y++) {
+										var rowCells = [];
+
+										for (var x=cpos.cellindex; x<grid[y].length; x++) {
+											var td = getCell(grid, y, x);
+
+											if (td && !inArray(rows, td) && !inArray(rowCells, td)) {
+												var cp = getCellPos(grid, td);
+
+												// Within range
+												if (cp.cellindex < cpos.cellindex+numCols && cp.rowindex < cpos.rowindex+numRows)
+													rowCells[rowCells.length] = td;
+											}
+										}
+
+										if (rowCells.length > 0)
+											rows[rows.length] = rowCells;
+
+										var td = getCell(grid, cpos.rowindex, cpos.cellindex);
+										each(ed.dom.select('br', td), function(e, i) {
+											if (i > 0 && ed.dom.getAttrib('mce_bogus'))
+												ed.dom.remove(e);
+										});
+									}
+
+									//return true;
+								}
 							} else {
-								var numRows = parseInt(value['numrows']);
-								var numCols = parseInt(value['numcols']);
-								var cpos = getCellPos(grid, tdElm);
+								var cells = [];
+								var sel = inst.selection.getSel();
+								var lastTR = null;
+								var curRow = null;
+								var x1 = -1, y1 = -1, x2, y2;
+
+								// Only one cell selected, whats the point?
+								if (sel.rangeCount < 2)
+									return true;
 
-								if (("" + numRows) == "NaN")
-									numRows = 1;
+								// Get all selected cells
+								for (var i=0; i<sel.rangeCount; i++) {
+									var rng = sel.getRangeAt(i);
+									var tdElm = rng.startContainer.childNodes[rng.startOffset];
 
-								if (("" + numCols) == "NaN")
-									numCols = 1;
+									if (!tdElm)
+										break;
+
+									if (tdElm.nodeName == "TD" || tdElm.nodeName == "TH")
+										cells[cells.length] = tdElm;
+								}
 
 								// Get rows and cells
 								var tRows = tableElm.rows;
-								for (var y=cpos.rowindex; y<grid.length; y++) {
-									var rowCells = new Array();
-
-									for (var x=cpos.cellindex; x<grid[y].length; x++) {
-										var td = getCell(grid, y, x);
+								for (var y=0; y<tRows.length; y++) {
+									var rowCells = [];
 
-										if (td && !inArray(rows, td) && !inArray(rowCells, td)) {
-											var cp = getCellPos(grid, td);
+									for (var x=0; x<tRows[y].cells.length; x++) {
+										var td = tRows[y].cells[x];
 
-											// Within range
-											if (cp.cellindex < cpos.cellindex+numCols && cp.rowindex < cpos.rowindex+numRows)
+										for (var i=0; i<cells.length; i++) {
+											if (td == cells[i]) {
 												rowCells[rowCells.length] = td;
+											}
 										}
 									}
 
@@ -881,193 +981,156 @@
 										rows[rows.length] = rowCells;
 								}
 
-								//return true;
-							}
-						} else {
-							var cells = new Array();
-							var sel = inst.getSel();
-							var lastTR = null;
-							var curRow = null;
-							var x1 = -1, y1 = -1, x2, y2;
-
-							// Only one cell selected, whats the point?
-							if (sel.rangeCount < 2)
-								return true;
-
-							// Get all selected cells
-							for (var i=0; i<sel.rangeCount; i++) {
-								var rng = sel.getRangeAt(i);
-								var tdElm = rng.startContainer.childNodes[rng.startOffset];
-
-								if (!tdElm)
-									break;
+								// Find selected cells in grid and box
+								var curRow = [];
+								var lastTR = null;
+								for (var y=0; y<grid.length; y++) {
+									for (var x=0; x<grid[y].length; x++) {
+										grid[y][x]._selected = false;
+
+										for (var i=0; i<cells.length; i++) {
+											if (grid[y][x] == cells[i]) {
+												// Get start pos
+												if (x1 == -1) {
+													x1 = x;
+													y1 = y;
+												}
+
+												// Get end pos
+												x2 = x;
+												y2 = y;
 
-								if (tdElm.nodeName == "TD")
-									cells[cells.length] = tdElm;
-							}
-
-							// Get rows and cells
-							var tRows = tableElm.rows;
-							for (var y=0; y<tRows.length; y++) {
-								var rowCells = new Array();
-
-								for (var x=0; x<tRows[y].cells.length; x++) {
-									var td = tRows[y].cells[x];
-
-									for (var i=0; i<cells.length; i++) {
-										if (td == cells[i]) {
-											rowCells[rowCells.length] = td;
+												grid[y][x]._selected = true;
+											}
 										}
 									}
 								}
 
-								if (rowCells.length > 0)
-									rows[rows.length] = rowCells;
-							}
-
-							// Find selected cells in grid and box
-							var curRow = new Array();
-							var lastTR = null;
-							for (var y=0; y<grid.length; y++) {
-								for (var x=0; x<grid[y].length; x++) {
-									grid[y][x]._selected = false;
-
-									for (var i=0; i<cells.length; i++) {
-										if (grid[y][x] == cells[i]) {
-											// Get start pos
-											if (x1 == -1) {
-												x1 = x;
-												y1 = y;
-											}
-
-											// Get end pos
-											x2 = x;
-											y2 = y;
-
-											grid[y][x]._selected = true;
+								// Is there gaps, if so deny
+								for (var y=y1; y<=y2; y++) {
+									for (var x=x1; x<=x2; x++) {
+										if (!grid[y][x]._selected) {
+											alert("Invalid selection for merge.");
+											return true;
 										}
 									}
 								}
 							}
 
-							// Is there gaps, if so deny
-							for (var y=y1; y<=y2; y++) {
-								for (var x=x1; x<=x2; x++) {
-									if (!grid[y][x]._selected) {
-										alert("Invalid selection for merge.");
-										return true;
-									}
-								}
-							}
-						}
+							// Validate selection and get total rowspan and colspan
+							var rowSpan = 1, colSpan = 1;
 
-						// Validate selection and get total rowspan and colspan
-						var rowSpan = 1, colSpan = 1;
+							// Validate horizontal and get total colspan
+							var lastRowSpan = -1;
+							for (var y=0; y<rows.length; y++) {
+								var rowColSpan = 0;
 
-						// Validate horizontal and get total colspan
-						var lastRowSpan = -1;
-						for (var y=0; y<rows.length; y++) {
-							var rowColSpan = 0;
+								for (var x=0; x<rows[y].length; x++) {
+									var sd = getColRowSpan(rows[y][x]);
 
-							for (var x=0; x<rows[y].length; x++) {
-								var sd = getColRowSpan(rows[y][x]);
+									rowColSpan += sd['colspan'];
 
-								rowColSpan += sd['colspan'];
+									if (lastRowSpan != -1 && sd['rowspan'] != lastRowSpan) {
+										alert("Invalid selection for merge.");
+										return true;
+									}
 
-								if (lastRowSpan != -1 && sd['rowspan'] != lastRowSpan) {
-									alert("Invalid selection for merge.");
-									return true;
+									lastRowSpan = sd['rowspan'];
 								}
 
-								lastRowSpan = sd['rowspan'];
-							}
+								if (rowColSpan > colSpan)
+									colSpan = rowColSpan;
 
-							if (rowColSpan > colSpan)
-								colSpan = rowColSpan;
+								lastRowSpan = -1;
+							}
 
-							lastRowSpan = -1;
-						}
+							// Validate vertical and get total rowspan
+							var lastColSpan = -1;
+							for (var x=0; x<rows[0].length; x++) {
+								var colRowSpan = 0;
 
-						// Validate vertical and get total rowspan
-						var lastColSpan = -1;
-						for (var x=0; x<rows[0].length; x++) {
-							var colRowSpan = 0;
+								for (var y=0; y<rows.length; y++) {
+									var sd = getColRowSpan(rows[y][x]);
 
-							for (var y=0; y<rows.length; y++) {
-								var sd = getColRowSpan(rows[y][x]);
+									colRowSpan += sd['rowspan'];
 
-								colRowSpan += sd['rowspan'];
+									if (lastColSpan != -1 && sd['colspan'] != lastColSpan) {
+										alert("Invalid selection for merge.");
+										return true;
+									}
 
-								if (lastColSpan != -1 && sd['colspan'] != lastColSpan) {
-									alert("Invalid selection for merge.");
-									return true;
+									lastColSpan = sd['colspan'];
 								}
 
-								lastColSpan = sd['colspan'];
+								if (colRowSpan > rowSpan)
+									rowSpan = colRowSpan;
+
+								lastColSpan = -1;
 							}
 
-							if (colRowSpan > rowSpan)
-								rowSpan = colRowSpan;
+							// Setup td
+							tdElm = rows[0][0];
+							tdElm.rowSpan = rowSpan;
+							tdElm.colSpan = colSpan;
 
-							lastColSpan = -1;
-						}
+							// Merge cells
+							for (var y=0; y<rows.length; y++) {
+								for (var x=0; x<rows[y].length; x++) {
+									var html = rows[y][x].innerHTML;
+									var chk = html.replace(/[ \t\r\n]/g, "");
+
+									if (chk != "<br/>" && chk != "<br>" && chk != '<br mce_bogus="1"/>' && (x+y > 0))
+										tdElm.innerHTML += html;
+
+									// Not current cell
+									if (rows[y][x] != tdElm && !rows[y][x]._deleted) {
+										var cpos = getCellPos(grid, rows[y][x]);
+										var tr = rows[y][x].parentNode;
+
+										tr.removeChild(rows[y][x]);
+										rows[y][x]._deleted = true;
+
+										// Empty TR, remove it
+										if (!tr.hasChildNodes()) {
+											tr.parentNode.removeChild(tr);
+
+											var lastCell = null;
+											for (var x=0; cellElm = getCell(grid, cpos.rowindex, x); x++) {
+												if (cellElm != lastCell && cellElm.rowSpan > 1)
+													cellElm.rowSpan--;
 
-						// Setup td
-						tdElm = rows[0][0];
-						tdElm.rowSpan = rowSpan;
-						tdElm.colSpan = colSpan;
-
-						// Merge cells
-						for (var y=0; y<rows.length; y++) {
-							for (var x=0; x<rows[y].length; x++) {
-								var html = rows[y][x].innerHTML;
-								var chk = tinyMCE.regexpReplace(html, "[ \t\r\n]", "");
-
-								if (chk != "<br/>" && chk != "<br>" && chk != "&nbsp;" && (x+y > 0))
-									tdElm.innerHTML += html;
-
-								// Not current cell
-								if (rows[y][x] != tdElm && !rows[y][x]._deleted) {
-									var cpos = getCellPos(grid, rows[y][x]);
-									var tr = rows[y][x].parentNode;
-
-									tr.removeChild(rows[y][x]);
-									rows[y][x]._deleted = true;
-
-									// Empty TR, remove it
-									if (!tr.hasChildNodes()) {
-										tr.parentNode.removeChild(tr);
-
-										var lastCell = null;
-										for (var x=0; cellElm = getCell(grid, cpos.rowindex, x); x++) {
-											if (cellElm != lastCell && cellElm.rowSpan > 1)
-												cellElm.rowSpan--;
+												lastCell = cellElm;
+											}
 
-											lastCell = cellElm;
+											if (tdElm.rowSpan > 1)
+												tdElm.rowSpan--;
 										}
-
-										if (tdElm.rowSpan > 1)
-											tdElm.rowSpan--;
 									}
 								}
 							}
+
+							// Remove all but one bogus br
+							each(ed.dom.select('br', tdElm), function(e, i) {
+								if (i > 0 && ed.dom.getAttrib(e, 'mce_bogus'))
+									ed.dom.remove(e);
+							});
+
+							break;
 						}
 
-						break;
+						tableElm = inst.dom.getParent(inst.selection.getNode(), "table");
+						inst.addVisual(tableElm);
+						inst.nodeChanged();
 					}
 
-					tableElm = tinyMCE.getParentElement(inst.getFocusElement(), "table");
-					tinyMCE.handleVisualAid(tableElm, true, tinyMCE.settings['visual'], tinyMCE.selectedInstance);
-					tinyMCE.triggerNodeChange();
-					inst.repaint();
-				}
+				return true;
+			}
 
-			return true;
+			// Pass to next handler in chain
+			return false;
 		}
+	});
 
-		// Pass to next handler in chain
-		return false;
-	}
-};
-
-tinyMCE.addPlugin("table", TinyMCE_TablePlugin);
+	// Register plugin
+	tinymce.PluginManager.add('table', tinymce.plugins.TablePlugin);
+})();
\ No newline at end of file
diff -x .svn -aruN 0.7.15.src/e107_handlers/tiny_mce/plugins/table/js/cell.js 0.7.16.src/e107_handlers/tiny_mce/plugins/table/js/cell.js
--- 0.7.15.src/e107_handlers/tiny_mce/plugins/table/js/cell.js	1969-12-31 18:00:00.000000000 -0600
+++ 0.7.16.src/e107_handlers/tiny_mce/plugins/table/js/cell.js	2009-07-08 05:04:39.000000000 -0500
@@ -0,0 +1,269 @@
+tinyMCEPopup.requireLangPack();
+
+var ed;
+
+function init() {
+	ed = tinyMCEPopup.editor;
+	tinyMCEPopup.resizeToInnerSize();
+
+	document.getElementById('backgroundimagebrowsercontainer').innerHTML = getBrowserHTML('backgroundimagebrowser','backgroundimage','image','table');
+	document.getElementById('bordercolor_pickcontainer').innerHTML = getColorPickerHTML('bordercolor_pick','bordercolor');
+	document.getElementById('bgcolor_pickcontainer').innerHTML = getColorPickerHTML('bgcolor_pick','bgcolor')
+
+	var inst = ed;
+	var tdElm = ed.dom.getParent(ed.selection.getNode(), "td,th");
+	var formObj = document.forms[0];
+	var st = ed.dom.parseStyle(ed.dom.getAttrib(tdElm, "style"));
+
+	// Get table cell data
+	var celltype = tdElm.nodeName.toLowerCase();
+	var align = ed.dom.getAttrib(tdElm, 'align');
+	var valign = ed.dom.getAttrib(tdElm, 'valign');
+	var width = trimSize(getStyle(tdElm, 'width', 'width'));
+	var height = trimSize(getStyle(tdElm, 'height', 'height'));
+	var bordercolor = convertRGBToHex(getStyle(tdElm, 'bordercolor', 'borderLeftColor'));
+	var bgcolor = convertRGBToHex(getStyle(tdElm, 'bgcolor', 'backgroundColor'));
+	var className = ed.dom.getAttrib(tdElm, 'class');
+	var backgroundimage = getStyle(tdElm, 'background', 'backgroundImage').replace(new RegExp("url\\('?([^']*)'?\\)", 'gi'), "$1");;
+	var id = ed.dom.getAttrib(tdElm, 'id');
+	var lang = ed.dom.getAttrib(tdElm, 'lang');
+	var dir = ed.dom.getAttrib(tdElm, 'dir');
+	var scope = ed.dom.getAttrib(tdElm, 'scope');
+
+	// Setup form
+	addClassesToList('class', 'table_cell_styles');
+	TinyMCE_EditableSelects.init();
+
+	formObj.bordercolor.value = bordercolor;
+	formObj.bgcolor.value = bgcolor;
+	formObj.backgroundimage.value = backgroundimage;
+	formObj.width.value = width;
+	formObj.height.value = height;
+	formObj.id.value = id;
+	formObj.lang.value = lang;
+	formObj.style.value = ed.dom.serializeStyle(st);
+	selectByValue(formObj, 'align', align);
+	selectByValue(formObj, 'valign', valign);
+	selectByValue(formObj, 'class', className, true, true);
+	selectByValue(formObj, 'celltype', celltype);
+	selectByValue(formObj, 'dir', dir);
+	selectByValue(formObj, 'scope', scope);
+
+	// Resize some elements
+	if (isVisible('backgroundimagebrowser'))
+		document.getElementById('backgroundimage').style.width = '180px';
+
+	updateColor('bordercolor_pick', 'bordercolor');
+	updateColor('bgcolor_pick', 'bgcolor');
+}
+
+function updateAction() {
+	var el, inst = ed, tdElm, trElm, tableElm, formObj = document.forms[0];
+
+	tinyMCEPopup.restoreSelection();
+	el = ed.selection.getNode();
+	tdElm = ed.dom.getParent(el, "td,th");
+	trElm = ed.dom.getParent(el, "tr");
+	tableElm = ed.dom.getParent(el, "table");
+
+	ed.execCommand('mceBeginUndoLevel');
+
+	switch (getSelectValue(formObj, 'action')) {
+		case "cell":
+			var celltype = getSelectValue(formObj, 'celltype');
+			var scope = getSelectValue(formObj, 'scope');
+
+			function doUpdate(s) {
+				if (s) {
+					updateCell(tdElm);
+
+					ed.addVisual();
+					ed.nodeChanged();
+					inst.execCommand('mceEndUndoLevel');
+					tinyMCEPopup.close();
+				}
+			};
+
+			if (ed.getParam("accessibility_warnings", 1)) {
+				if (celltype == "th" && scope == "")
+					tinyMCEPopup.confirm(ed.getLang('table_dlg.missing_scope', '', true), doUpdate);
+				else
+					doUpdate(1);
+
+				return;
+			}
+
+			updateCell(tdElm);
+			break;
+
+		case "row":
+			var cell = trElm.firstChild;
+
+			if (cell.nodeName != "TD" && cell.nodeName != "TH")
+				cell = nextCell(cell);
+
+			do {
+				cell = updateCell(cell, true);
+			} while ((cell = nextCell(cell)) != null);
+
+			break;
+
+		case "all":
+			var rows = tableElm.getElementsByTagName("tr");
+
+			for (var i=0; i<rows.length; i++) {
+				var cell = rows[i].firstChild;
+
+				if (cell.nodeName != "TD" && cell.nodeName != "TH")
+					cell = nextCell(cell);
+
+				do {
+					cell = updateCell(cell, true);
+				} while ((cell = nextCell(cell)) != null);
+			}
+
+			break;
+	}
+
+	ed.addVisual();
+	ed.nodeChanged();
+	inst.execCommand('mceEndUndoLevel');
+	tinyMCEPopup.close();
+}
+
+function nextCell(elm) {
+	while ((elm = elm.nextSibling) != null) {
+		if (elm.nodeName == "TD" || elm.nodeName == "TH")
+			return elm;
+	}
+
+	return null;
+}
+
+function updateCell(td, skip_id) {
+	var inst = ed;
+	var formObj = document.forms[0];
+	var curCellType = td.nodeName.toLowerCase();
+	var celltype = getSelectValue(formObj, 'celltype');
+	var doc = inst.getDoc();
+	var dom = ed.dom;
+
+	if (!skip_id)
+		td.setAttribute('id', formObj.id.value);
+
+	td.setAttribute('align', formObj.align.value);
+	td.setAttribute('vAlign', formObj.valign.value);
+	td.setAttribute('lang', formObj.lang.value);
+	td.setAttribute('dir', getSelectValue(formObj, 'dir'));
+	td.setAttribute('style', ed.dom.serializeStyle(ed.dom.parseStyle(formObj.style.value)));
+	td.setAttribute('scope', formObj.scope.value);
+	ed.dom.setAttrib(td, 'class', getSelectValue(formObj, 'class'));
+
+	// Clear deprecated attributes
+	ed.dom.setAttrib(td, 'width', '');
+	ed.dom.setAttrib(td, 'height', '');
+	ed.dom.setAttrib(td, 'bgColor', '');
+	ed.dom.setAttrib(td, 'borderColor', '');
+	ed.dom.setAttrib(td, 'background', '');
+
+	// Set styles
+	td.style.width = getCSSSize(formObj.width.value);
+	td.style.height = getCSSSize(formObj.height.value);
+	if (formObj.bordercolor.value != "") {
+		td.style.borderColor = formObj.bordercolor.value;
+		td.style.borderStyle = td.style.borderStyle == "" ? "solid" : td.style.borderStyle;
+		td.style.borderWidth = td.style.borderWidth == "" ? "1px" : td.style.borderWidth;
+	} else
+		td.style.borderColor = '';
+
+	td.style.backgroundColor = formObj.bgcolor.value;
+
+	if (formObj.backgroundimage.value != "")
+		td.style.backgroundImage = "url('" + formObj.backgroundimage.value + "')";
+	else
+		td.style.backgroundImage = '';
+
+	if (curCellType != celltype) {
+		// changing to a different node type
+		var newCell = doc.createElement(celltype);
+
+		for (var c=0; c<td.childNodes.length; c++)
+			newCell.appendChild(td.childNodes[c].cloneNode(1));
+
+		for (var a=0; a<td.attributes.length; a++)
+			ed.dom.setAttrib(newCell, td.attributes[a].name, ed.dom.getAttrib(td, td.attributes[a].name));
+
+		td.parentNode.replaceChild(newCell, td);
+		td = newCell;
+	}
+
+	dom.setAttrib(td, 'style', dom.serializeStyle(dom.parseStyle(td.style.cssText)));
+
+	return td;
+}
+
+function changedBackgroundImage() {
+	var formObj = document.forms[0];
+	var st = ed.dom.parseStyle(formObj.style.value);
+
+	st['background-image'] = "url('" + formObj.backgroundimage.value + "')";
+
+	formObj.style.value = ed.dom.serializeStyle(st);
+}
+
+function changedSize() {
+	var formObj = document.forms[0];
+	var st = ed.dom.parseStyle(formObj.style.value);
+
+	var width = formObj.width.value;
+	if (width != "")
+		st['width'] = getCSSSize(width);
+	else
+		st['width'] = "";
+
+	var height = formObj.height.value;
+	if (height != "")
+		st['height'] = getCSSSize(height);
+	else
+		st['height'] = "";
+
+	formObj.style.value = ed.dom.serializeStyle(st);
+}
+
+function changedColor() {
+	var formObj = document.forms[0];
+	var st = ed.dom.parseStyle(formObj.style.value);
+
+	st['background-color'] = formObj.bgcolor.value;
+	st['border-color'] = formObj.bordercolor.value;
+
+	formObj.style.value = ed.dom.serializeStyle(st);
+}
+
+function changedStyle() {
+	var formObj = document.forms[0];
+	var st = ed.dom.parseStyle(formObj.style.value);
+
+	if (st['background-image'])
+		formObj.backgroundimage.value = st['background-image'].replace(new RegExp("url\\('?([^']*)'?\\)", 'gi'), "$1");
+	else
+		formObj.backgroundimage.value = '';
+
+	if (st['width'])
+		formObj.width.value = trimSize(st['width']);
+
+	if (st['height'])
+		formObj.height.value = trimSize(st['height']);
+
+	if (st['background-color']) {
+		formObj.bgcolor.value = st['background-color'];
+		updateColor('bgcolor_pick','bgcolor');
+	}
+
+	if (st['border-color']) {
+		formObj.bordercolor.value = st['border-color'];
+		updateColor('bordercolor_pick','bordercolor');
+	}
+}
+
+tinyMCEPopup.onInit.add(init);
diff -x .svn -aruN 0.7.15.src/e107_handlers/tiny_mce/plugins/table/js/merge_cells.js 0.7.16.src/e107_handlers/tiny_mce/plugins/table/js/merge_cells.js
--- 0.7.15.src/e107_handlers/tiny_mce/plugins/table/js/merge_cells.js	1969-12-31 18:00:00.000000000 -0600
+++ 0.7.16.src/e107_handlers/tiny_mce/plugins/table/js/merge_cells.js	2009-07-08 05:04:39.000000000 -0500
@@ -0,0 +1,29 @@
+tinyMCEPopup.requireLangPack();
+
+function init() {
+	var f = document.forms[0], v;
+
+	tinyMCEPopup.resizeToInnerSize();
+
+	f.numcols.value = tinyMCEPopup.getWindowArg('numcols', 1);
+	f.numrows.value = tinyMCEPopup.getWindowArg('numrows', 1);
+}
+
+function mergeCells() {
+	var args = [], f = document.forms[0];
+
+	tinyMCEPopup.restoreSelection();
+
+	if (!AutoValidator.validate(f)) {
+		tinyMCEPopup.alert(tinyMCEPopup.getLang('invalid_data'));
+		return false;
+	}
+
+	args["numcols"] = f.numcols.value;
+	args["numrows"] = f.numrows.value;
+
+	tinyMCEPopup.execCommand("mceTableMergeCells", false, args);
+	tinyMCEPopup.close();
+}
+
+tinyMCEPopup.onInit.add(init);
diff -x .svn -aruN 0.7.15.src/e107_handlers/tiny_mce/plugins/table/js/row.js 0.7.16.src/e107_handlers/tiny_mce/plugins/table/js/row.js
--- 0.7.15.src/e107_handlers/tiny_mce/plugins/table/js/row.js	1969-12-31 18:00:00.000000000 -0600
+++ 0.7.16.src/e107_handlers/tiny_mce/plugins/table/js/row.js	2009-07-08 05:04:39.000000000 -0500
@@ -0,0 +1,212 @@
+tinyMCEPopup.requireLangPack();
+
+function init() {
+	tinyMCEPopup.resizeToInnerSize();
+
+	document.getElementById('backgroundimagebrowsercontainer').innerHTML = getBrowserHTML('backgroundimagebrowser','backgroundimage','image','table');
+	document.getElementById('bgcolor_pickcontainer').innerHTML = getColorPickerHTML('bgcolor_pick','bgcolor');
+
+	var inst = tinyMCEPopup.editor;
+	var dom = inst.dom;
+	var trElm = dom.getParent(inst.selection.getNode(), "tr");
+	var formObj = document.forms[0];
+	var st = dom.parseStyle(dom.getAttrib(trElm, "style"));
+
+	// Get table row data
+	var rowtype = trElm.parentNode.nodeName.toLowerCase();
+	var align = dom.getAttrib(trElm, 'align');
+	var valign = dom.getAttrib(trElm, 'valign');
+	var height = trimSize(getStyle(trElm, 'height', 'height'));
+	var className = dom.getAttrib(trElm, 'class');
+	var bgcolor = convertRGBToHex(getStyle(trElm, 'bgcolor', 'backgroundColor'));
+	var backgroundimage = getStyle(trElm, 'background', 'backgroundImage').replace(new RegExp("url\\('?([^']*)'?\\)", 'gi'), "$1");;
+	var id = dom.getAttrib(trElm, 'id');
+	var lang = dom.getAttrib(trElm, 'lang');
+	var dir = dom.getAttrib(trElm, 'dir');
+
+	// Setup form
+	addClassesToList('class', 'table_row_styles');
+	TinyMCE_EditableSelects.init();
+
+	formObj.bgcolor.value = bgcolor;
+	formObj.backgroundimage.value = backgroundimage;
+	formObj.height.value = height;
+	formObj.id.value = id;
+	formObj.lang.value = lang;
+	formObj.style.value = dom.serializeStyle(st);
+	selectByValue(formObj, 'align', align);
+	selectByValue(formObj, 'valign', valign);
+	selectByValue(formObj, 'class', className, true, true);
+	selectByValue(formObj, 'rowtype', rowtype);
+	selectByValue(formObj, 'dir', dir);
+
+	// Resize some elements
+	if (isVisible('backgroundimagebrowser'))
+		document.getElementById('backgroundimage').style.width = '180px';
+
+	updateColor('bgcolor_pick', 'bgcolor');
+}
+
+function updateAction() {
+	var inst = tinyMCEPopup.editor, dom = inst.dom, trElm, tableElm, formObj = document.forms[0];
+	var action = getSelectValue(formObj, 'action');
+
+	tinyMCEPopup.restoreSelection();
+	trElm = dom.getParent(inst.selection.getNode(), "tr");
+	tableElm = dom.getParent(inst.selection.getNode(), "table");
+
+	inst.execCommand('mceBeginUndoLevel');
+
+	switch (action) {
+		case "row":
+			updateRow(trElm);
+			break;
+
+		case "all":
+			var rows = tableElm.getElementsByTagName("tr");
+
+			for (var i=0; i<rows.length; i++)
+				updateRow(rows[i], true);
+
+			break;
+
+		case "odd":
+		case "even":
+			var rows = tableElm.getElementsByTagName("tr");
+
+			for (var i=0; i<rows.length; i++) {
+				if ((i % 2 == 0 && action == "odd") || (i % 2 != 0 && action == "even"))
+					updateRow(rows[i], true, true);
+			}
+
+			break;
+	}
+
+	inst.addVisual();
+	inst.nodeChanged();
+	inst.execCommand('mceEndUndoLevel');
+	tinyMCEPopup.close();
+}
+
+function updateRow(tr_elm, skip_id, skip_parent) {
+	var inst = tinyMCEPopup.editor;
+	var formObj = document.forms[0];
+	var dom = inst.dom;
+	var curRowType = tr_elm.parentNode.nodeName.toLowerCase();
+	var rowtype = getSelectValue(formObj, 'rowtype');
+	var doc = inst.getDoc();
+
+	// Update row element
+	if (!skip_id)
+		tr_elm.setAttribute('id', formObj.id.value);
+
+	tr_elm.setAttribute('align', getSelectValue(formObj, 'align'));
+	tr_elm.setAttribute('vAlign', getSelectValue(formObj, 'valign'));
+	tr_elm.setAttribute('lang', formObj.lang.value);
+	tr_elm.setAttribute('dir', getSelectValue(formObj, 'dir'));
+	tr_elm.setAttribute('style', dom.serializeStyle(dom.parseStyle(formObj.style.value)));
+	dom.setAttrib(tr_elm, 'class', getSelectValue(formObj, 'class'));
+
+	// Clear deprecated attributes
+	tr_elm.setAttribute('background', '');
+	tr_elm.setAttribute('bgColor', '');
+	tr_elm.setAttribute('height', '');
+
+	// Set styles
+	tr_elm.style.height = getCSSSize(formObj.height.value);
+	tr_elm.style.backgroundColor = formObj.bgcolor.value;
+
+	if (formObj.backgroundimage.value != "")
+		tr_elm.style.backgroundImage = "url('" + formObj.backgroundimage.value + "')";
+	else
+		tr_elm.style.backgroundImage = '';
+
+	// Setup new rowtype
+	if (curRowType != rowtype && !skip_parent) {
+		// first, clone the node we are working on
+		var newRow = tr_elm.cloneNode(1);
+
+		// next, find the parent of its new destination (creating it if necessary)
+		var theTable = dom.getParent(tr_elm, "table");
+		var dest = rowtype;
+		var newParent = null;
+		for (var i = 0; i < theTable.childNodes.length; i++) {
+			if (theTable.childNodes[i].nodeName.toLowerCase() == dest)
+				newParent = theTable.childNodes[i];
+		}
+
+		if (newParent == null) {
+			newParent = doc.createElement(dest);
+
+			if (dest == "thead") {
+				if (theTable.firstChild.nodeName == 'CAPTION')
+					inst.dom.insertAfter(newParent, theTable.firstChild);
+				else
+					theTable.insertBefore(newParent, theTable.firstChild);
+			} else
+				theTable.appendChild(newParent);
+		}
+
+		// append the row to the new parent
+		newParent.appendChild(newRow);
+
+		// remove the original
+		tr_elm.parentNode.removeChild(tr_elm);
+
+		// set tr_elm to the new node
+		tr_elm = newRow;
+	}
+
+	dom.setAttrib(tr_elm, 'style', dom.serializeStyle(dom.parseStyle(tr_elm.style.cssText)));
+}
+
+function changedBackgroundImage() {
+	var formObj = document.forms[0], dom = tinyMCEPopup.editor.dom;
+	var st = dom.parseStyle(formObj.style.value);
+
+	st['background-image'] = "url('" + formObj.backgroundimage.value + "')";
+
+	formObj.style.value = dom.serializeStyle(st);
+}
+
+function changedStyle() {
+	var formObj = document.forms[0], dom = tinyMCEPopup.editor.dom;
+	var st = dom.parseStyle(formObj.style.value);
+
+	if (st['background-image'])
+		formObj.backgroundimage.value = st['background-image'].replace(new RegExp("url\\('?([^']*)'?\\)", 'gi'), "$1");
+	else
+		formObj.backgroundimage.value = '';
+
+	if (st['height'])
+		formObj.height.value = trimSize(st['height']);
+
+	if (st['background-color']) {
+		formObj.bgcolor.value = st['background-color'];
+		updateColor('bgcolor_pick','bgcolor');
+	}
+}
+
+function changedSize() {
+	var formObj = document.forms[0], dom = tinyMCEPopup.editor.dom;
+	var st = dom.parseStyle(formObj.style.value);
+
+	var height = formObj.height.value;
+	if (height != "")
+		st['height'] = getCSSSize(height);
+	else
+		st['height'] = "";
+
+	formObj.style.value = dom.serializeStyle(st);
+}
+
+function changedColor() {
+	var formObj = document.forms[0], dom = tinyMCEPopup.editor.dom;
+	var st = dom.parseStyle(formObj.style.value);
+
+	st['background-color'] = formObj.bgcolor.value;
+
+	formObj.style.value = dom.serializeStyle(st);
+}
+
+tinyMCEPopup.onInit.add(init);
diff -x .svn -aruN 0.7.15.src/e107_handlers/tiny_mce/plugins/table/js/table.js 0.7.16.src/e107_handlers/tiny_mce/plugins/table/js/table.js
--- 0.7.15.src/e107_handlers/tiny_mce/plugins/table/js/table.js	1969-12-31 18:00:00.000000000 -0600
+++ 0.7.16.src/e107_handlers/tiny_mce/plugins/table/js/table.js	2009-07-08 05:04:39.000000000 -0500
@@ -0,0 +1,440 @@
+tinyMCEPopup.requireLangPack();
+
+var action, orgTableWidth, orgTableHeight, dom = tinyMCEPopup.editor.dom;
+
+function insertTable() {
+	var formObj = document.forms[0];
+	var inst = tinyMCEPopup.editor, dom = inst.dom;
+	var cols = 2, rows = 2, border = 0, cellpadding = -1, cellspacing = -1, align, width, height, className, caption, frame, rules;
+	var html = '', capEl, elm;
+	var cellLimit, rowLimit, colLimit;
+
+	tinyMCEPopup.restoreSelection();
+
+	if (!AutoValidator.validate(formObj)) {
+		tinyMCEPopup.alert(inst.getLang('invalid_data'));
+		return false;
+	}
+
+	elm = dom.getParent(inst.selection.getNode(), 'table');
+
+	// Get form data
+	cols = formObj.elements['cols'].value;
+	rows = formObj.elements['rows'].value;
+	border = formObj.elements['border'].value != "" ? formObj.elements['border'].value  : 0;
+	cellpadding = formObj.elements['cellpadding'].value != "" ? formObj.elements['cellpadding'].value : "";
+	cellspacing = formObj.elements['cellspacing'].value != "" ? formObj.elements['cellspacing'].value : "";
+	align = formObj.elements['align'].options[formObj.elements['align'].selectedIndex].value;
+	frame = formObj.elements['tframe'].options[formObj.elements['tframe'].selectedIndex].value;
+	rules = formObj.elements['rules'].options[formObj.elements['rules'].selectedIndex].value;
+	width = formObj.elements['width'].value;
+	height = formObj.elements['height'].value;
+	bordercolor = formObj.elements['bordercolor'].value;
+	bgcolor = formObj.elements['bgcolor'].value;
+	className = formObj.elements['class'].options[formObj.elements['class'].selectedIndex].value;
+	id = formObj.elements['id'].value;
+	summary = formObj.elements['summary'].value;
+	style = formObj.elements['style'].value;
+	dir = formObj.elements['dir'].value;
+	lang = formObj.elements['lang'].value;
+	background = formObj.elements['backgroundimage'].value;
+	caption = formObj.elements['caption'].checked;
+
+	cellLimit = tinyMCEPopup.getParam('table_cell_limit', false);
+	rowLimit = tinyMCEPopup.getParam('table_row_limit', false);
+	colLimit = tinyMCEPopup.getParam('table_col_limit', false);
+
+	// Validate table size
+	if (colLimit && cols > colLimit) {
+		tinyMCEPopup.alert(inst.getLang('table_dlg.col_limit').replace(/\{\$cols\}/g, colLimit));
+		return false;
+	} else if (rowLimit && rows > rowLimit) {
+		tinyMCEPopup.alert(inst.getLang('table_dlg.row_limit').replace(/\{\$rows\}/g, rowLimit));
+		return false;
+	} else if (cellLimit && cols * rows > cellLimit) {
+		tinyMCEPopup.alert(inst.getLang('table_dlg.cell_limit').replace(/\{\$cells\}/g, cellLimit));
+		return false;
+	}
+
+	// Update table
+	if (action == "update") {
+		inst.execCommand('mceBeginUndoLevel');
+
+		dom.setAttrib(elm, 'cellPadding', cellpadding, true);
+		dom.setAttrib(elm, 'cellSpacing', cellspacing, true);
+		dom.setAttrib(elm, 'border', border);
+		dom.setAttrib(elm, 'align', align);
+		dom.setAttrib(elm, 'frame', frame);
+		dom.setAttrib(elm, 'rules', rules);
+		dom.setAttrib(elm, 'class', className);
+		dom.setAttrib(elm, 'style', style);
+		dom.setAttrib(elm, 'id', id);
+		dom.setAttrib(elm, 'summary', summary);
+		dom.setAttrib(elm, 'dir', dir);
+		dom.setAttrib(elm, 'lang', lang);
+
+		capEl = inst.dom.select('caption', elm)[0];
+
+		if (capEl && !caption)
+			capEl.parentNode.removeChild(capEl);
+
+		if (!capEl && caption) {
+			capEl = elm.ownerDocument.createElement('caption');
+
+			if (!tinymce.isIE)
+				capEl.innerHTML = '<br mce_bogus="1"/>';
+
+			elm.insertBefore(capEl, elm.firstChild);
+		}
+
+		if (width && inst.settings.inline_styles) {
+			dom.setStyle(elm, 'width', width);
+			dom.setAttrib(elm, 'width', '');
+		} else {
+			dom.setAttrib(elm, 'width', width, true);
+			dom.setStyle(elm, 'width', '');
+		}
+
+		// Remove these since they are not valid XHTML
+		dom.setAttrib(elm, 'borderColor', '');
+		dom.setAttrib(elm, 'bgColor', '');
+		dom.setAttrib(elm, 'background', '');
+
+		if (height && inst.settings.inline_styles) {
+			dom.setStyle(elm, 'height', height);
+			dom.setAttrib(elm, 'height', '');
+		} else {
+			dom.setAttrib(elm, 'height', height, true);
+			dom.setStyle(elm, 'height', '');
+ 		}
+
+		if (background != '')
+			elm.style.backgroundImage = "url('" + background + "')";
+		else
+			elm.style.backgroundImage = '';
+
+/*		if (tinyMCEPopup.getParam("inline_styles")) {
+			if (width != '')
+				elm.style.width = getCSSSize(width);
+		}*/
+
+		if (bordercolor != "") {
+			elm.style.borderColor = bordercolor;
+			elm.style.borderStyle = elm.style.borderStyle == "" ? "solid" : elm.style.borderStyle;
+			elm.style.borderWidth = border == "" ? "1px" : border;
+		} else
+			elm.style.borderColor = '';
+
+		elm.style.backgroundColor = bgcolor;
+		elm.style.height = getCSSSize(height);
+
+		inst.addVisual();
+
+		// Fix for stange MSIE align bug
+		//elm.outerHTML = elm.outerHTML;
+
+		inst.nodeChanged();
+		inst.execCommand('mceEndUndoLevel');
+
+		// Repaint if dimensions changed
+		if (formObj.width.value != orgTableWidth || formObj.height.value != orgTableHeight)
+			inst.execCommand('mceRepaint');
+
+		tinyMCEPopup.close();
+		return true;
+	}
+
+	// Create new table
+	html += '<table';
+
+	html += makeAttrib('id', id);
+	html += makeAttrib('border', border);
+	html += makeAttrib('cellpadding', cellpadding);
+	html += makeAttrib('cellspacing', cellspacing);
+
+	if (width && inst.settings.inline_styles) {
+		if (style)
+			style += '; ';
+
+		// Force px
+		if (/^[0-9\.]+$/.test(width))
+			width += 'px';
+
+		style += 'width: ' + width;
+	} else
+		html += makeAttrib('width', width);
+
+/*	if (height) {
+		if (style)
+			style += '; ';
+
+		style += 'height: ' + height;
+	}*/
+
+	//html += makeAttrib('height', height);
+	//html += makeAttrib('bordercolor', bordercolor);
+	//html += makeAttrib('bgcolor', bgcolor);
+	html += makeAttrib('align', align);
+	html += makeAttrib('frame', frame);
+	html += makeAttrib('rules', rules);
+	html += makeAttrib('class', className);
+	html += makeAttrib('style', style);
+	html += makeAttrib('summary', summary);
+	html += makeAttrib('dir', dir);
+	html += makeAttrib('lang', lang);
+	html += '>';
+
+	if (caption) {
+		if (!tinymce.isIE)
+			html += '<caption><br mce_bogus="1"/></caption>';
+		else
+			html += '<caption></caption>';
+	}
+
+	for (var y=0; y<rows; y++) {
+		html += "<tr>";
+
+		for (var x=0; x<cols; x++) {
+			if (!tinymce.isIE)
+				html += '<td><br mce_bogus="1"/></td>';
+			else
+				html += '<td></td>';
+		}
+
+		html += "</tr>";
+	}
+
+	html += "</table>";
+
+	inst.execCommand('mceBeginUndoLevel');
+
+	// Move table
+	if (inst.settings.fix_table_elements) {
+		var bm = inst.selection.getBookmark(), patt = '';
+
+		inst.execCommand('mceInsertContent', false, '<br class="_mce_marker" />');
+
+		tinymce.each('h1,h2,h3,h4,h5,h6,p'.split(','), function(n) {
+			if (patt)
+				patt += ',';
+
+			patt += n + ' ._mce_marker';
+		});
+
+		tinymce.each(inst.dom.select(patt), function(n) {
+			inst.dom.split(inst.dom.getParent(n, 'h1,h2,h3,h4,h5,h6,p'), n);
+		});
+
+		dom.setOuterHTML(dom.select('._mce_marker')[0], html);
+
+		inst.selection.moveToBookmark(bm);
+	} else
+		inst.execCommand('mceInsertContent', false, html);
+
+	inst.addVisual();
+	inst.execCommand('mceEndUndoLevel');
+
+	tinyMCEPopup.close();
+}
+
+function makeAttrib(attrib, value) {
+	var formObj = document.forms[0];
+	var valueElm = formObj.elements[attrib];
+
+	if (typeof(value) == "undefined" || value == null) {
+		value = "";
+
+		if (valueElm)
+			value = valueElm.value;
+	}
+
+	if (value == "")
+		return "";
+
+	// XML encode it
+	value = value.replace(/&/g, '&amp;');
+	value = value.replace(/\"/g, '&quot;');
+	value = value.replace(/</g, '&lt;');
+	value = value.replace(/>/g, '&gt;');
+
+	return ' ' + attrib + '="' + value + '"';
+}
+
+function init() {
+	tinyMCEPopup.resizeToInnerSize();
+
+	document.getElementById('backgroundimagebrowsercontainer').innerHTML = getBrowserHTML('backgroundimagebrowser','backgroundimage','image','table');
+	document.getElementById('backgroundimagebrowsercontainer').innerHTML = getBrowserHTML('backgroundimagebrowser','backgroundimage','image','table');
+	document.getElementById('bordercolor_pickcontainer').innerHTML = getColorPickerHTML('bordercolor_pick','bordercolor');
+	document.getElementById('bgcolor_pickcontainer').innerHTML = getColorPickerHTML('bgcolor_pick','bgcolor');
+
+	var cols = 2, rows = 2, border = tinyMCEPopup.getParam('table_default_border', '0'), cellpadding = tinyMCEPopup.getParam('table_default_cellpadding', ''), cellspacing = tinyMCEPopup.getParam('table_default_cellspacing', '');
+	var align = "", width = "", height = "", bordercolor = "", bgcolor = "", className = "";
+	var id = "", summary = "", style = "", dir = "", lang = "", background = "", bgcolor = "", bordercolor = "", rules, frame;
+	var inst = tinyMCEPopup.editor, dom = inst.dom;
+	var formObj = document.forms[0];
+	var elm = dom.getParent(inst.selection.getNode(), "table");
+
+	action = tinyMCEPopup.getWindowArg('action');
+
+	if (!action)
+		action = elm ? "update" : "insert";
+
+	if (elm && action != "insert") {
+		var rowsAr = elm.rows;
+		var cols = 0;
+		for (var i=0; i<rowsAr.length; i++)
+			if (rowsAr[i].cells.length > cols)
+				cols = rowsAr[i].cells.length;
+
+		cols = cols;
+		rows = rowsAr.length;
+
+		st = dom.parseStyle(dom.getAttrib(elm, "style"));
+		border = trimSize(getStyle(elm, 'border', 'borderWidth'));
+		cellpadding = dom.getAttrib(elm, 'cellpadding', "");
+		cellspacing = dom.getAttrib(elm, 'cellspacing', "");
+		width = trimSize(getStyle(elm, 'width', 'width'));
+		height = trimSize(getStyle(elm, 'height', 'height'));
+		bordercolor = convertRGBToHex(getStyle(elm, 'bordercolor', 'borderLeftColor'));
+		bgcolor = convertRGBToHex(getStyle(elm, 'bgcolor', 'backgroundColor'));
+		align = dom.getAttrib(elm, 'align', align);
+		frame = dom.getAttrib(elm, 'frame');
+		rules = dom.getAttrib(elm, 'rules');
+		className = tinymce.trim(dom.getAttrib(elm, 'class').replace(/mceItem.+/g, ''));
+		id = dom.getAttrib(elm, 'id');
+		summary = dom.getAttrib(elm, 'summary');
+		style = dom.serializeStyle(st);
+		dir = dom.getAttrib(elm, 'dir');
+		lang = dom.getAttrib(elm, 'lang');
+		background = getStyle(elm, 'background', 'backgroundImage').replace(new RegExp("url\\('?([^']*)'?\\)", 'gi'), "$1");
+		formObj.caption.checked = elm.getElementsByTagName('caption').length > 0;
+
+		orgTableWidth = width;
+		orgTableHeight = height;
+
+		action = "update";
+		formObj.insert.value = inst.getLang('update');
+	}
+
+	addClassesToList('class', "table_styles");
+	TinyMCE_EditableSelects.init();
+
+	// Update form
+	selectByValue(formObj, 'align', align);
+	selectByValue(formObj, 'tframe', frame);
+	selectByValue(formObj, 'rules', rules);
+	selectByValue(formObj, 'class', className, true, true);
+	formObj.cols.value = cols;
+	formObj.rows.value = rows;
+	formObj.border.value = border;
+	formObj.cellpadding.value = cellpadding;
+	formObj.cellspacing.value = cellspacing;
+	formObj.width.value = width;
+	formObj.height.value = height;
+	formObj.bordercolor.value = bordercolor;
+	formObj.bgcolor.value = bgcolor;
+	formObj.id.value = id;
+	formObj.summary.value = summary;
+	formObj.style.value = style;
+	formObj.dir.value = dir;
+	formObj.lang.value = lang;
+	formObj.backgroundimage.value = background;
+
+	updateColor('bordercolor_pick', 'bordercolor');
+	updateColor('bgcolor_pick', 'bgcolor');
+
+	// Resize some elements
+	if (isVisible('backgroundimagebrowser'))
+		document.getElementById('backgroundimage').style.width = '180px';
+
+	// Disable some fields in update mode
+	if (action == "update") {
+		formObj.cols.disabled = true;
+		formObj.rows.disabled = true;
+	}
+}
+
+function changedSize() {
+	var formObj = document.forms[0];
+	var st = dom.parseStyle(formObj.style.value);
+
+/*	var width = formObj.width.value;
+	if (width != "")
+		st['width'] = tinyMCEPopup.getParam("inline_styles") ? getCSSSize(width) : "";
+	else
+		st['width'] = "";*/
+
+	var height = formObj.height.value;
+	if (height != "")
+		st['height'] = getCSSSize(height);
+	else
+		st['height'] = "";
+
+	formObj.style.value = dom.serializeStyle(st);
+}
+
+function changedBackgroundImage() {
+	var formObj = document.forms[0];
+	var st = dom.parseStyle(formObj.style.value);
+
+	st['background-image'] = "url('" + formObj.backgroundimage.value + "')";
+
+	formObj.style.value = dom.serializeStyle(st);
+}
+
+function changedBorder() {
+	var formObj = document.forms[0];
+	var st = dom.parseStyle(formObj.style.value);
+
+	// Update border width if the element has a color
+	if (formObj.border.value != "" && formObj.bordercolor.value != "")
+		st['border-width'] = formObj.border.value + "px";
+
+	formObj.style.value = dom.serializeStyle(st);
+}
+
+function changedColor() {
+	var formObj = document.forms[0];
+	var st = dom.parseStyle(formObj.style.value);
+
+	st['background-color'] = formObj.bgcolor.value;
+
+	if (formObj.bordercolor.value != "") {
+		st['border-color'] = formObj.bordercolor.value;
+
+		// Add border-width if it's missing
+		if (!st['border-width'])
+			st['border-width'] = formObj.border.value == "" ? "1px" : formObj.border.value + "px";
+	}
+
+	formObj.style.value = dom.serializeStyle(st);
+}
+
+function changedStyle() {
+	var formObj = document.forms[0];
+	var st = dom.parseStyle(formObj.style.value);
+
+	if (st['background-image'])
+		formObj.backgroundimage.value = st['background-image'].replace(new RegExp("url\\('?([^']*)'?\\)", 'gi'), "$1");
+	else
+		formObj.backgroundimage.value = '';
+
+	if (st['width'])
+		formObj.width.value = trimSize(st['width']);
+
+	if (st['height'])
+		formObj.height.value = trimSize(st['height']);
+
+	if (st['background-color']) {
+		formObj.bgcolor.value = st['background-color'];
+		updateColor('bgcolor_pick','bgcolor');
+	}
+
+	if (st['border-color']) {
+		formObj.bordercolor.value = st['border-color'];
+		updateColor('bordercolor_pick','bordercolor');
+	}
+}
+
+tinyMCEPopup.onInit.add(init);
diff -x .svn -aruN 0.7.15.src/e107_handlers/tiny_mce/plugins/table/langs/en_dlg.js 0.7.16.src/e107_handlers/tiny_mce/plugins/table/langs/en_dlg.js
--- 0.7.15.src/e107_handlers/tiny_mce/plugins/table/langs/en_dlg.js	1969-12-31 18:00:00.000000000 -0600
+++ 0.7.16.src/e107_handlers/tiny_mce/plugins/table/langs/en_dlg.js	2009-07-06 01:16:08.000000000 -0500
@@ -0,0 +1,74 @@
+tinyMCE.addI18n('en.table_dlg',{
+general_tab:"General",
+advanced_tab:"Advanced",
+general_props:"General properties",
+advanced_props:"Advanced properties",
+rowtype:"Row in table part",
+title:"Insert/Modify table",
+width:"Width",
+height:"Height",
+cols:"Cols",
+rows:"Rows",
+cellspacing:"Cellspacing",
+cellpadding:"Cellpadding",
+border:"Border",
+align:"Alignment",
+align_default:"Default",
+align_left:"Left",
+align_right:"Right",
+align_middle:"Center",
+row_title:"Table row properties",
+cell_title:"Table cell properties",
+cell_type:"Cell type",
+valign:"Vertical alignment",
+align_top:"Top",
+align_bottom:"Bottom",
+bordercolor:"Border color",
+bgcolor:"Background color",
+merge_cells_title:"Merge table cells",
+id:"Id",
+style:"Style",
+langdir:"Language direction",
+langcode:"Language code",
+mime:"Target MIME type",
+ltr:"Left to right",
+rtl:"Right to left",
+bgimage:"Background image",
+summary:"Summary",
+td:"Data",
+th:"Header",
+cell_cell:"Update current cell",
+cell_row:"Update all cells in row",
+cell_all:"Update all cells in table",
+row_row:"Update current row",
+row_odd:"Update odd rows in table",
+row_even:"Update even rows in table",
+row_all:"Update all rows in table",
+thead:"Table Head",
+tbody:"Table Body",
+tfoot:"Table Foot",
+scope:"Scope",
+rowgroup:"Row Group",
+colgroup:"Col Group",
+col_limit:"You've exceeded the maximum number of columns of {$cols}.",
+row_limit:"You've exceeded the maximum number of rows of {$rows}.",
+cell_limit:"You've exceeded the maximum number of cells of {$cells}.",
+missing_scope:"Are you sure you want to continue without specifying a scope for this table header cell. Without it, it may be difficult for some users with disabilities to understand the content or data displayed of the table.",
+caption:"Table caption",
+frame:"Frame",
+frame_none:"none",
+frame_groups:"groups",
+frame_rows:"rows",
+frame_cols:"cols",
+frame_all:"all",
+rules:"Rules",
+rules_void:"void",
+rules_above:"above",
+rules_below:"below",
+rules_hsides:"hsides",
+rules_lhs:"lhs",
+rules_rhs:"rhs",
+rules_vsides:"vsides",
+rules_box:"box",
+rules_border:"border"
+});
\ No newline at end of file
diff -x .svn -aruN 0.7.15.src/e107_handlers/tiny_mce/plugins/table/langs/en.js 0.7.16.src/e107_handlers/tiny_mce/plugins/table/langs/en.js
--- 0.7.15.src/e107_handlers/tiny_mce/plugins/table/langs/en.js	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_handlers/tiny_mce/plugins/table/langs/en.js	1969-12-31 18:00:00.000000000 -0600
@@ -1,78 +0,0 @@
-// UK lang variables
-
-tinyMCE.addToLang('table',{
-general_tab : 'General',
-advanced_tab : 'Advanced',
-general_props : 'General properties',
-advanced_props : 'Advanced properties',
-desc : 'Inserts a new table',
-row_before_desc : 'Insert row before',
-row_after_desc : 'Insert row after',
-delete_row_desc : 'Delete row',
-col_before_desc : 'Insert column before',
-col_after_desc : 'Insert column after',
-delete_col_desc : 'Remove column',
-rowtype : 'Row in table part',
-title : 'Insert/Modify table',
-width : 'Width',
-height : 'Height',
-cols : 'Columns',
-rows : 'Rows',
-cellspacing : 'Cellspacing',
-cellpadding : 'Cellpadding',
-border : 'Border',
-align : 'Alignment',
-align_default : 'Default',
-align_left : 'Left',
-align_right : 'Right',
-align_middle : 'Center',
-row_title : 'Table row properties',
-cell_title : 'Table cell properties',
-cell_type : 'Cell type',
-row_desc : 'Table row properties',
-cell_desc : 'Table cell properties',
-valign : 'Vertical alignment',
-align_top : 'Top',
-align_bottom : 'Bottom',
-props_desc : 'Table properties',
-bordercolor : 'Border color',
-bgcolor : 'Background color',
-merge_cells_title : 'Merge table cells',
-split_cells_desc : 'Split table cells',
-merge_cells_desc : 'Merge table cells',
-cut_row_desc : 'Cut table row',
-copy_row_desc : 'Copy table row',
-paste_row_before_desc : 'Paste table row before',
-paste_row_after_desc : 'Paste table row after',
-id : 'Id',
-style: 'Style',
-langdir : 'Language direction',
-langcode : 'Language code',
-mime : 'Target MIME type',
-ltr : 'Left to right',
-rtl : 'Right to left',
-bgimage : 'Background image',
-summary : 'Summary',
-td : "Data",
-th : "Header",
-cell_cell : 'Update current cell',
-cell_row : 'Update all cells in row',
-cell_all : 'Update all cells in table',
-row_row : 'Update current row',
-row_odd : 'Update odd rows in table',
-row_even : 'Update even rows in table',
-row_all : 'Update all rows in table',
-thead : 'Table Head',
-tbody : 'Table Body',
-tfoot : 'Table Foot',
-del : 'Delete table',
-scope : 'Scope',
-row : 'Row',
-col : 'Col',
-rowgroup : 'Row Group',
-colgroup : 'Col Group',
-col_limit : 'You\'ve exceeded the maximum number of columns of {$cols}.',
-row_limit : 'You\'ve exceeded the maximum number of rows of {$rows}.',
-cell_limit : 'You\'ve exceeded the maximum number of cells of {$cells}.',
-missing_scope: 'Are you sure you want to continue without specifying a scope for this table header cell. Without it, it may be difficult for some users with disabilities to understand the content or data displayed of the table.'
-});
diff -x .svn -aruN 0.7.15.src/e107_handlers/tiny_mce/plugins/table/merge_cells.htm 0.7.16.src/e107_handlers/tiny_mce/plugins/table/merge_cells.htm
--- 0.7.15.src/e107_handlers/tiny_mce/plugins/table/merge_cells.htm	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_handlers/tiny_mce/plugins/table/merge_cells.htm	2009-06-30 19:36:49.000000000 -0500
@@ -1,24 +1,23 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
 <html xmlns="http://www.w3.org/1999/xhtml">
 <head>
-	<title>{$lang_table_merge_cells_title}</title>
-	<script language="javascript" type="text/javascript" src="../../tiny_mce_popup.js"></script>
-	<script language="javascript" type="text/javascript" src="../../utils/mctabs.js"></script>
-	<script language="javascript" type="text/javascript" src="../../utils/validate.js"></script>
-	<script language="javascript" type="text/javascript" src="jscripts/merge_cells.js"></script>
-	<base target="_self" />
+	<title>{#table_dlg.merge_cells_title}</title>
+	<script type="text/javascript" src="../../tiny_mce_popup.js"></script>
+	<script type="text/javascript" src="../../utils/mctabs.js"></script>
+	<script type="text/javascript" src="../../utils/validate.js"></script>
+	<script type="text/javascript" src="js/merge_cells.js"></script>
 </head>
-<body onload="tinyMCEPopup.executeOnLoad('init();');" style="margin: 8px" style="display: none">
-<form onsubmit="insertTable();return false;" action="#">
+<body style="margin: 8px">
+<form onsubmit="mergeCells();return false;" action="#">
 	<fieldset>
-		<legend>{$lang_table_merge_cells_title}</legend>
+		<legend>{#table_dlg.merge_cells_title}</legend>
 		  <table border="0" cellpadding="0" cellspacing="3" width="100%">
 			  <tr>
-				<td>{$lang_table_cols}:</td>
-				<td align="right"><input type="text" name="numcols" value="" class="number min1" style="width: 30px" /></td>
-				<td>
+				<td>{#table_dlg.cols}:</td>
+				<td align="right"><input type="text" name="numcols" value="" class="number min1 mceFocus" style="width: 30px" /></td>
 			  </tr>
 			  <tr>
-				<td>{$lang_table_rows}:</td>
+				<td>{#table_dlg.rows}:</td>
 				<td align="right"><input type="text" name="numrows" value="" class="number min1" style="width: 30px" /></td>
 			  </tr>
 		  </table>
@@ -26,11 +25,11 @@
 
 	<div class="mceActionPanel">
 		<div style="float: left">
-			<input type="button" id="insert" name="insert" value="{$lang_update}" onclick="mergeCells();" />
+			<input type="submit" id="insert" name="insert" value="{#update}" />
 		</div>
 
 		<div style="float: right">
-			<input type="button" id="cancel" name="cancel" value="{$lang_cancel}" onclick="tinyMCEPopup.close();" />
+			<input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />
 		</div>
 	</div>
 </form>
diff -x .svn -aruN 0.7.15.src/e107_handlers/tiny_mce/plugins/table/row.htm 0.7.16.src/e107_handlers/tiny_mce/plugins/table/row.htm
--- 0.7.15.src/e107_handlers/tiny_mce/plugins/table/row.htm	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_handlers/tiny_mce/plugins/table/row.htm	2009-06-30 19:36:49.000000000 -0500
@@ -1,74 +1,75 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
 <html xmlns="http://www.w3.org/1999/xhtml">
 <head>
-	<title>{$lang_table_row_title}</title>
-	<script language="javascript" type="text/javascript" src="../../tiny_mce_popup.js"></script>
-	<script language="javascript" type="text/javascript" src="../../utils/mctabs.js"></script>
-	<script language="javascript" type="text/javascript" src="../../utils/form_utils.js"></script>
-	<script language="javascript" type="text/javascript" src="jscripts/row.js"></script>
+	<title>{#table_dlg.row_title}</title>
+	<script type="text/javascript" src="../../tiny_mce_popup.js"></script>
+	<script type="text/javascript" src="../../utils/mctabs.js"></script>
+	<script type="text/javascript" src="../../utils/form_utils.js"></script>
+	<script type="text/javascript" src="../../utils/editable_selects.js"></script>
+	<script type="text/javascript" src="js/row.js"></script>
 	<link href="css/row.css" rel="stylesheet" type="text/css" />
-	<base target="_self" />
 </head>
-<body id="tablerow" onload="tinyMCEPopup.executeOnLoad('init();');" style="display: none">
-	<form onsubmit="updateAction();return false;">
+<body id="tablerow" style="display: none">
+	<form onsubmit="updateAction();return false;" action="#">
 		<div class="tabs">
 			<ul>
-				<li id="general_tab" class="current"><span><a href="javascript:mcTabs.displayTab('general_tab','general_panel');" onmousedown="return false;">{$lang_table_general_tab}</a></span></li>
-				<li id="advanced_tab"><span><a href="javascript:mcTabs.displayTab('advanced_tab','advanced_panel');" onmousedown="return false;">{$lang_table_advanced_tab}</a></span></li>
+				<li id="general_tab" class="current"><span><a href="javascript:mcTabs.displayTab('general_tab','general_panel');" onmousedown="return false;">{#table_dlg.general_tab}</a></span></li>
+				<li id="advanced_tab"><span><a href="javascript:mcTabs.displayTab('advanced_tab','advanced_panel');" onmousedown="return false;">{#table_dlg.advanced_tab}</a></span></li>
 			</ul>
 		</div>
 
 		<div class="panel_wrapper">
 			<div id="general_panel" class="panel current">
 				<fieldset>
-					<legend>{$lang_table_general_props}</legend>
+					<legend>{#table_dlg.general_props}</legend>
 
 					<table border="0" cellpadding="4" cellspacing="0">
 						<tr>
-							<td><label for="rowtype">{$lang_table_rowtype}</label></td>
+							<td><label for="rowtype">{#table_dlg.rowtype}</label></td>
 							<td class="col2">
-								<select id="rowtype" name="rowtype">
-									<option value="thead">{$lang_table_thead}</option>
-									<option value="tbody">{$lang_table_tbody}</option>
-									<option value="tfoot">{$lang_table_tfoot}</option>
+								<select id="rowtype" name="rowtype" class="mceFocus">
+									<option value="thead">{#table_dlg.thead}</option>
+									<option value="tbody">{#table_dlg.tbody}</option>
+									<option value="tfoot">{#table_dlg.tfoot}</option>
 								</select>
 							</td>
 						</tr>
 
 						<tr>
-							<td><label for="align">{$lang_table_align}</label></td>
+							<td><label for="align">{#table_dlg.align}</label></td>
 							<td class="col2">
 								<select id="align" name="align">
-									<option value="">{$lang_not_set}</option>
-									<option value="center">{$lang_table_align_middle}</option>
-									<option value="left">{$lang_table_align_left}</option>
-									<option value="right">{$lang_table_align_right}</option>
+									<option value="">{#not_set}</option>
+									<option value="center">{#table_dlg.align_middle}</option>
+									<option value="left">{#table_dlg.align_left}</option>
+									<option value="right">{#table_dlg.align_right}</option>
 								</select>
 							</td>
 						</tr>
 
 						<tr>
-							<td><label for="valign">{$lang_table_valign}</label></td>
+							<td><label for="valign">{#table_dlg.valign}</label></td>
 							<td class="col2">
 								<select id="valign" name="valign">
-									<option value="">{$lang_not_set}</option>
-									<option value="top">{$lang_table_align_top}</option>
-									<option value="middle">{$lang_table_align_middle}</option>
-									<option value="bottom">{$lang_table_align_bottom}</option>
+									<option value="">{#not_set}</option>
+									<option value="top">{#table_dlg.align_top}</option>
+									<option value="middle">{#table_dlg.align_middle}</option>
+									<option value="bottom">{#table_dlg.align_bottom}</option>
 								</select>
 							</td>
 						</tr>
 
 						<tr id="styleSelectRow">
-							<td><label for="class">{$lang_class_name}</label></td>
+							<td><label for="class">{#class_name}</label></td>
 							<td class="col2">
-								<select id="class" name="class">
-									<option value="" selected="selected">{$lang_not_set}</option>
+								<select id="class" name="class" class="mceEditableSelect">
+									<option value="" selected="selected">{#not_set}</option>
 								</select>
 							</td>
 						</tr>
 
 						<tr>
-							<td><label for="height">{$lang_table_height}</label></td>
+							<td><label for="height">{#table_dlg.height}</label></td>
 							<td class="col2"><input name="height" type="text" id="height" value="" size="4" maxlength="4" onchange="changedSize();" /></td>
 						</tr>
 					</table>
@@ -77,39 +78,39 @@
 
 			<div id="advanced_panel" class="panel">
 				<fieldset>
-					<legend>{$lang_table_advanced_props}</legend>
+					<legend>{#table_dlg.advanced_props}</legend>
 
 					<table border="0" cellpadding="0" cellspacing="4">
 						<tr>
-							<td class="column1"><label for="id">{$lang_table_id}</label></td> 
+							<td class="column1"><label for="id">{#table_dlg.id}</label></td> 
 							<td><input id="id" name="id" type="text" value="" style="width: 200px" /></td> 
 						</tr>
 
 						<tr>
-							<td><label for="style">{$lang_table_style}</label></td>
+							<td><label for="style">{#table_dlg.style}</label></td>
 							<td><input type="text" id="style" name="style" value="" style="width: 200px;" onchange="changedStyle();" /></td>
 						</tr>
 
 						<tr>
-							<td class="column1"><label for="dir">{$lang_table_langdir}</label></td> 
+							<td class="column1"><label for="dir">{#table_dlg.langdir}</label></td> 
 							<td>
 								<select id="dir" name="dir" style="width: 200px"> 
-										<option value="">{$lang_not_set}</option> 
-										<option value="ltr">{$lang_table_ltr}</option> 
-										<option value="rtl">{$lang_table_rtl}</option> 
+										<option value="">{#not_set}</option> 
+										<option value="ltr">{#table_dlg.ltr}</option> 
+										<option value="rtl">{#table_dlg.rtl}</option> 
 								</select>
 							</td> 
 						</tr>
 
 						<tr>
-							<td class="column1"><label for="lang">{$lang_table_langcode}</label></td> 
+							<td class="column1"><label for="lang">{#table_dlg.langcode}</label></td> 
 							<td>
 								<input id="lang" name="lang" type="text" value="" style="width: 200px" />
 							</td> 
 						</tr>
 
 						<tr>
-							<td class="column1"><label for="backgroundimage">{$lang_table_bgimage}</label></td> 
+							<td class="column1"><label for="backgroundimage">{#table_dlg.bgimage}</label></td> 
 							<td>
 								<table border="0" cellpadding="0" cellspacing="0">
 									<tr>
@@ -121,7 +122,7 @@
 						</tr>
 
 						<tr>
-							<td class="column1"><label for="bgcolor">{$lang_table_bgcolor}</label></td> 
+							<td class="column1"><label for="bgcolor">{#table_dlg.bgcolor}</label></td> 
 							<td>
 								<table border="0" cellpadding="0" cellspacing="0">
 									<tr>
@@ -139,19 +140,19 @@
 		<div class="mceActionPanel">
 			<div>
 				<select id="action" name="action">
-					<option value="row">{$lang_table_row_row}</option>
-					<option value="odd">{$lang_table_row_odd}</option>
-					<option value="even">{$lang_table_row_even}</option>
-					<option value="all">{$lang_table_row_all}</option>
+					<option value="row">{#table_dlg.row_row}</option>
+					<option value="odd">{#table_dlg.row_odd}</option>
+					<option value="even">{#table_dlg.row_even}</option>
+					<option value="all">{#table_dlg.row_all}</option>
 				</select>
 			</div>
 
 			<div style="float: left">
-				<div><input type="button" id="insert" name="insert" value="{$lang_update}" onclick="updateAction();" /></div>
+				<div><input type="submit" id="insert" name="insert" value="{#update}" /></div>
 			</div>
 
 			<div style="float: right">
-				<input type="button" id="cancel" name="cancel" value="{$lang_cancel}" onclick="tinyMCEPopup.close();" />
+				<input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />
 			</div>
 		</div>
 	</form>
diff -x .svn -aruN 0.7.15.src/e107_handlers/tiny_mce/plugins/table/table.htm 0.7.16.src/e107_handlers/tiny_mce/plugins/table/table.htm
--- 0.7.15.src/e107_handlers/tiny_mce/plugins/table/table.htm	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_handlers/tiny_mce/plugins/table/table.htm	2009-06-30 19:36:49.000000000 -0500
@@ -1,109 +1,102 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
 <html xmlns="http://www.w3.org/1999/xhtml">
 <head>
-	<title>{$lang_table_title}</title>
-	<script language="javascript" type="text/javascript" src="../../tiny_mce_popup.js"></script>
-	<script language="javascript" type="text/javascript" src="../../utils/mctabs.js"></script>
-	<script language="javascript" type="text/javascript" src="../../utils/form_utils.js"></script>
-	<script language="javascript" type="text/javascript" src="../../utils/validate.js"></script>
-	<script language="javascript" type="text/javascript" src="jscripts/table.js"></script>
+	<title>{#table_dlg.title}</title>
+	<script type="text/javascript" src="../../tiny_mce_popup.js"></script>
+	<script type="text/javascript" src="../../utils/mctabs.js"></script>
+	<script type="text/javascript" src="../../utils/form_utils.js"></script>
+	<script type="text/javascript" src="../../utils/validate.js"></script>
+	<script type="text/javascript" src="../../utils/editable_selects.js"></script>
+	<script type="text/javascript" src="js/table.js"></script>
 	<link href="css/table.css" rel="stylesheet" type="text/css" />
-	<base target="_self" />
 </head>
-<body id="table" onload="tinyMCEPopup.executeOnLoad('init();');" style="display: none">
+<body id="table" style="display: none">
 	<form onsubmit="insertTable();return false;" action="#">
 		<div class="tabs">
 			<ul>
-				<li id="general_tab" class="current"><span><a href="javascript:mcTabs.displayTab('general_tab','general_panel');" onmousedown="return false;">{$lang_table_general_tab}</a></span></li>
-				<li id="advanced_tab"><span><a href="javascript:mcTabs.displayTab('advanced_tab','advanced_panel');" onmousedown="return false;">{$lang_table_advanced_tab}</a></span></li>
+				<li id="general_tab" class="current"><span><a href="javascript:mcTabs.displayTab('general_tab','general_panel');" onmousedown="return false;">{#table_dlg.general_tab}</a></span></li>
+				<li id="advanced_tab"><span><a href="javascript:mcTabs.displayTab('advanced_tab','advanced_panel');" onmousedown="return false;">{#table_dlg.advanced_tab}</a></span></li>
 			</ul>
 		</div>
 
 		<div class="panel_wrapper">
 			<div id="general_panel" class="panel current">
 				<fieldset>
-					<legend>{$lang_table_general_props}</legend>
-
+					<legend>{#table_dlg.general_props}</legend>
 					  <table border="0" cellpadding="4" cellspacing="0" width="100%">
 							  <tr>
-								<td><label id="colslabel" for="cols">{$lang_table_cols}</label></td>
-								<td><input id="cols" name="cols" type="text" value="" size="3" maxlength="3" class="required number min1" /></td>
-								<td><label id="rowslabel" for="rows">{$lang_table_rows}</label></td>
+								<td><label id="colslabel" for="cols">{#table_dlg.cols}</label></td>
+								<td><input id="cols" name="cols" type="text" value="" size="3" maxlength="3" class="required number min1 mceFocus" /></td>
+								<td><label id="rowslabel" for="rows">{#table_dlg.rows}</label></td>
 								<td><input id="rows" name="rows" type="text" value="" size="3" maxlength="3" class="required number min1" /></td>
 							  </tr>
 							  <tr>
-								<td><label id="cellpaddinglabel" for="cellpadding">{$lang_table_cellpadding}</label></td>
+								<td><label id="cellpaddinglabel" for="cellpadding">{#table_dlg.cellpadding}</label></td>
 								<td><input id="cellpadding" name="cellpadding" type="text" value="" size="3" maxlength="3" class="number" /></td>
-								<td><label id="cellspacinglabel" for="cellspacing">{$lang_table_cellspacing}</label></td>
+								<td><label id="cellspacinglabel" for="cellspacing">{#table_dlg.cellspacing}</label></td>
 								<td><input id="cellspacing" name="cellspacing" type="text" value="" size="3" maxlength="3" class="number" /></td>
 							  </tr>
 							  <tr>
-								<td><label id="alignlabel" for="align">{$lang_table_align}</label></td>
+								<td><label id="alignlabel" for="align">{#table_dlg.align}</label></td>
 								<td><select id="align" name="align">
-									<option value="">{$lang_not_set}</option>
-									<option value="center">{$lang_table_align_middle}</option>
-									<option value="left">{$lang_table_align_left}</option>
-									<option value="right">{$lang_table_align_right}</option>
+									<option value="">{#not_set}</option>
+									<option value="center">{#table_dlg.align_middle}</option>
+									<option value="left">{#table_dlg.align_left}</option>
+									<option value="right">{#table_dlg.align_right}</option>
 								  </select></td>
-								<td><label id="borderlabel" for="border">{$lang_table_border}</label></td>
+								<td><label id="borderlabel" for="border">{#table_dlg.border}</label></td>
 								<td><input id="border" name="border" type="text" value="" size="3" maxlength="3" onchange="changedBorder();" class="number" /></td>
 							  </tr>
 							  <tr id="width_row">
-								<td><label id="widthlabel" for="width">{$lang_table_width}</label></td>
+								<td><label id="widthlabel" for="width">{#table_dlg.width}</label></td>
 								<td><input name="width" type="text" id="width" value="" size="4" maxlength="4" onchange="changedSize();" class="size" /></td>
-								<td><label id="heightlabel" for="height">{$lang_table_height}</label></td>
+								<td><label id="heightlabel" for="height">{#table_dlg.height}</label></td>
 								<td><input name="height" type="text" id="height" value="" size="4" maxlength="4" onchange="changedSize();" class="size" /></td>
 							  </tr>
 							  <tr id="styleSelectRow">
-								<td><label id="classlabel" for="class">{$lang_class_name}</label></td>
+								<td><label id="classlabel" for="class">{#class_name}</label></td>
 								<td colspan="3">
-								 <select id="class" name="class">
-									<option value="" selected>{$lang_not_set}</option>
+								 <select id="class" name="class" class="mceEditableSelect">
+									<option value="" selected="selected">{#not_set}</option>
 								 </select></td>
 							  </tr>
+							  <tr>
+								<td class="column1"><label for="caption">{#table_dlg.caption}</label></td> 
+								<td><input id="caption" name="caption" type="checkbox" class="checkbox" value="true" /></td> 
+							  </tr>
 							</table>
 				</fieldset>
 			</div>
 
 			<div id="advanced_panel" class="panel">
 				<fieldset>
-					<legend>{$lang_table_advanced_props}</legend>
+					<legend>{#table_dlg.advanced_props}</legend>
 
 					<table border="0" cellpadding="0" cellspacing="4">
 						<tr>
-							<td class="column1"><label for="id">{$lang_table_id}</label></td> 
+							<td class="column1"><label for="id">{#table_dlg.id}</label></td> 
 							<td><input id="id" name="id" type="text" value="" class="advfield" /></td> 
 						</tr>
 
 						<tr>
-							<td class="column1"><label for="summary">{$lang_table_summary}</label></td> 
+							<td class="column1"><label for="summary">{#table_dlg.summary}</label></td> 
 							<td><input id="summary" name="summary" type="text" value="" class="advfield" /></td> 
 						</tr>
 
 						<tr>
-							<td><label for="style">{$lang_table_style}</label></td>
+							<td><label for="style">{#table_dlg.style}</label></td>
 							<td><input type="text" id="style" name="style" value="" class="advfield" onchange="changedStyle();" /></td>
 						</tr>
 
 						<tr>
-							<td class="column1"><label for="dir">{$lang_table_langdir}</label></td> 
-							<td>
-								<select id="dir" name="dir" class="advfield"> 
-										<option value="">{$lang_not_set}</option> 
-										<option value="ltr">{$lang_table_ltr}</option> 
-										<option value="rtl">{$lang_table_rtl}</option> 
-								</select>
-							</td> 
-						</tr>
-
-						<tr>
-							<td class="column1"><label id="langlabel" for="lang">{$lang_table_langcode}</label></td> 
+							<td class="column1"><label id="langlabel" for="lang">{#table_dlg.langcode}</label></td> 
 							<td>
 								<input id="lang" name="lang" type="text" value="" class="advfield" />
 							</td> 
 						</tr>
 
 						<tr>
-							<td class="column1"><label for="backgroundimage">{$lang_table_bgimage}</label></td> 
+							<td class="column1"><label for="backgroundimage">{#table_dlg.bgimage}</label></td> 
 							<td>
 								<table border="0" cellpadding="0" cellspacing="0">
 									<tr>
@@ -115,7 +108,50 @@
 						</tr>
 
 						<tr>
-							<td class="column1"><label for="bordercolor">{$lang_table_bordercolor}</label></td> 
+							<td class="column1"><label for="tframe">{#table_dlg.frame}</label></td> 
+							<td>
+								<select id="tframe" name="tframe" class="advfield"> 
+										<option value="">{#not_set}</option>
+										<option value="void">{#table_dlg.rules_void}</option>
+										<option value="above">{#table_dlg.rules_above}</option> 
+										<option value="below">{#table_dlg.rules_below}</option> 
+										<option value="hsides">{#table_dlg.rules_hsides}</option> 
+										<option value="lhs">{#table_dlg.rules_lhs}</option> 
+										<option value="rhs">{#table_dlg.rules_rhs}</option> 
+										<option value="vsides">{#table_dlg.rules_vsides}</option> 
+										<option value="box">{#table_dlg.rules_box}</option> 
+										<option value="border">{#table_dlg.rules_border}</option> 
+								</select>
+							</td> 
+						</tr>
+
+						<tr>
+							<td class="column1"><label for="rules">{#table_dlg.rules}</label></td> 
+							<td>
+								<select id="rules" name="rules" class="advfield"> 
+										<option value="">{#not_set}</option> 
+										<option value="none">{#table_dlg.frame_none}</option>
+										<option value="groups">{#table_dlg.frame_groups}</option>
+										<option value="rows">{#table_dlg.frame_rows}</option>
+										<option value="cols">{#table_dlg.frame_cols}</option>
+										<option value="all">{#table_dlg.frame_all}</option>
+									</select>
+							</td> 
+						</tr>
+
+						<tr>
+							<td class="column1"><label for="dir">{#table_dlg.langdir}</label></td> 
+							<td>
+								<select id="dir" name="dir" class="advfield"> 
+										<option value="">{#not_set}</option> 
+										<option value="ltr">{#table_dlg.ltr}</option> 
+										<option value="rtl">{#table_dlg.rtl}</option> 
+								</select>
+							</td> 
+						</tr>
+
+						<tr>
+							<td class="column1"><label for="bordercolor">{#table_dlg.bordercolor}</label></td> 
 							<td>
 								<table border="0" cellpadding="0" cellspacing="0">
 									<tr>
@@ -127,7 +163,7 @@
 						</tr>
 
 						<tr>
-							<td class="column1"><label for="bgcolor">{$lang_table_bgcolor}</label></td> 
+							<td class="column1"><label for="bgcolor">{#table_dlg.bgcolor}</label></td> 
 							<td>
 								<table border="0" cellpadding="0" cellspacing="0">
 									<tr>
@@ -144,11 +180,11 @@
 
 		<div class="mceActionPanel">
 			<div style="float: left">
-				<input type="button" id="insert" name="insert" value="{$lang_insert}" onclick="insertTable();" />
+				<input type="submit" id="insert" name="insert" value="{#insert}" />
 			</div>
 
 			<div style="float: right">
-				<input type="button" id="cancel" name="cancel" value="{$lang_cancel}" onclick="tinyMCEPopup.close();" />
+				<input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />
 			</div>
 		</div>
 	</form>
diff -x .svn -aruN 0.7.15.src/e107_handlers/tiny_mce/themes/advanced/about.htm 0.7.16.src/e107_handlers/tiny_mce/themes/advanced/about.htm
--- 0.7.15.src/e107_handlers/tiny_mce/themes/advanced/about.htm	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_handlers/tiny_mce/themes/advanced/about.htm	2009-06-30 19:36:49.000000000 -0500
@@ -1,35 +1,39 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
 <html xmlns="http://www.w3.org/1999/xhtml">
 <head>
-	<title>{$lang_about_title}</title>
-	<script language="javascript" type="text/javascript" src="../../tiny_mce_popup.js"></script>
-	<script language="javascript" type="text/javascript" src="../../utils/mctabs.js"></script>
-	<script language="javascript" type="text/javascript" src="jscripts/about.js"></script>
-	<base target="_self" />
+	<title>{#advanced_dlg.about_title}</title>
+	<script type="text/javascript" src="../../tiny_mce_popup.js"></script>
+	<script type="text/javascript" src="../../utils/mctabs.js"></script>
+	<script type="text/javascript" src="js/about.js"></script>
 </head>
-<body id="about" onload="tinyMCEPopup.executeOnLoad('init();');" style="display: none">
+<body id="about" style="display: none">
 		<div class="tabs">
 			<ul>
-				<li id="general_tab" class="current"><span><a href="javascript:mcTabs.displayTab('general_tab','general_panel');" onmousedown="return false;">{$lang_about}</a></span></li>
-				<li id="help_tab"><span><a href="javascript:mcTabs.displayTab('help_tab','help_panel');" onmousedown="return false;">{$lang_help}</a></span></li>
-				<li id="plugins_tab"><span><a href="javascript:mcTabs.displayTab('plugins_tab','plugins_panel');" onmousedown="return false;">{$lang_plugins}</a></span></li>
+				<li id="general_tab" class="current"><span><a href="javascript:mcTabs.displayTab('general_tab','general_panel');" onmousedown="return false;">{#advanced_dlg.about_general}</a></span></li>
+				<li id="help_tab" style="display:none"><span><a href="javascript:mcTabs.displayTab('help_tab','help_panel');" onmousedown="return false;">{#advanced_dlg.about_help}</a></span></li>
+				<li id="plugins_tab"><span><a href="javascript:mcTabs.displayTab('plugins_tab','plugins_panel');" onmousedown="return false;">{#advanced_dlg.about_plugins}</a></span></li>
 			</ul>
 		</div>
 
 		<div class="panel_wrapper">
 			<div id="general_panel" class="panel current">
-				<h3>{$lang_about_title}</h3>
-				<p>Version: {$tinymce_version} ({$tinymce_releasedate})</p>
+				<h3>{#advanced_dlg.about_title}</h3>
+				<p>Version: <span id="version"></span> (<span id="date"></span>)</p>
 				<p>TinyMCE is a platform independent web based Javascript HTML WYSIWYG editor control released as Open Source under <a href="../../license.txt" target="_blank">LGPL</a>
 				by Moxiecode Systems AB. It has the ability to convert HTML TEXTAREA fields or other HTML elements to editor instances.</p>
-				<p>Copyright &copy; 2003-2006, <a href="http://www.moxiecode.com" target="_blank">Moxiecode Systems AB</a>, All rights reserved.</p>
+				<p>Copyright &copy; 2003-2008, <a href="http://www.moxiecode.com" target="_blank">Moxiecode Systems AB</a>, All rights reserved.</p>
 				<p>For more information about this software visit the <a href="http://tinymce.moxiecode.com" target="_blank">TinyMCE website</a>.</p>
 
-				<div id="buttoncontainer"></div>
+				<div id="buttoncontainer">
+					<a href="http://www.moxiecode.com" target="_blank"><img src="http://tinymce.moxiecode.com/images/gotmoxie.png" alt="Got Moxie?" border="0" /></a>
+					<a href="http://sourceforge.net/projects/tinymce/" target="_blank"><img src="http://sourceforge.net/sflogo.php?group_id=103281" alt="Hosted By Sourceforge" border="0" /></a>
+					<a href="http://www.freshmeat.net/projects/tinymce" target="_blank"><img src="http://tinymce.moxiecode.com/images/fm.gif" alt="Also on freshmeat" border="0" /></a>
+				</div>
 			</div>
 
 			<div id="plugins_panel" class="panel">
 				<div id="pluginscontainer">
-					<h3>{$lang_loaded_plugins}</h3>
+					<h3>{#advanced_dlg.about_loaded}</h3>
 
 					<div id="plugintablecontainer">
 					</div>
@@ -45,7 +49,7 @@
 
 		<div class="mceActionPanel">
 			<div style="float: right">
-				<input type="button" id="cancel" name="cancel" value="{$lang_close}" onclick="tinyMCEPopup.close();" />
+				<input type="button" id="cancel" name="cancel" value="{#close}" onclick="tinyMCEPopup.close();" />
 			</div>
 		</div>
 </body>
diff -x .svn -aruN 0.7.15.src/e107_handlers/tiny_mce/themes/advanced/anchor.htm 0.7.16.src/e107_handlers/tiny_mce/themes/advanced/anchor.htm
--- 0.7.15.src/e107_handlers/tiny_mce/themes/advanced/anchor.htm	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_handlers/tiny_mce/themes/advanced/anchor.htm	2009-06-30 19:36:49.000000000 -0500
@@ -1,33 +1,31 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
 <html xmlns="http://www.w3.org/1999/xhtml">
 <head>
-	<title>{$lang_insert_anchor_title}</title>
-	<script language="javascript" type="text/javascript" src="../../tiny_mce_popup.js"></script>
-	<script language="javascript" type="text/javascript" src="jscripts/anchor.js"></script>
-	<base target="_self" />
+	<title>{#advanced_dlg.anchor_title}</title>
+	<script type="text/javascript" src="../../tiny_mce_popup.js"></script>
+	<script type="text/javascript" src="js/anchor.js"></script>
 </head>
-<body onload="tinyMCEPopup.executeOnLoad('init();');" style="display: none">
-<form onsubmit="insertAnchor();return false;" action="#">
-
+<body style="display: none">
+<form onsubmit="AnchorDialog.update();return false;" action="#">
 	<table border="0" cellpadding="4" cellspacing="0">
 		<tr>
-			<td colspan="2" class="title">{$lang_insert_anchor_title}</td>
+			<td colspan="2" class="title">{#advanced_dlg.anchor_title}</td>
 		</tr>
 		<tr>
-			<td nowrap="nowrap">{$lang_insert_anchor_name}:</td>
-			<td><input name="anchorName" type="text" id="anchorName" value="" style="width: 200px" /></td>
+			<td class="nowrap">{#advanced_dlg.anchor_name}:</td>
+			<td><input name="anchorName" type="text" class="mceFocus" id="anchorName" value="" style="width: 200px" /></td>
 		</tr>
 	</table>
 
 	<div class="mceActionPanel">
 		<div style="float: left">
-			<input type="button" id="insert" name="insert" value="{$lang_update}" onclick="insertAnchor();" />
+			<input type="submit" id="insert" name="insert" value="{#update}" />
 		</div>
 
 		<div style="float: right">
-			<input type="button" id="cancel" name="cancel" value="{$lang_cancel}" onclick="tinyMCEPopup.close();" />
+			<input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />
 		</div>
 	</div>
-
 </form>
 </body>
 </html>
diff -x .svn -aruN 0.7.15.src/e107_handlers/tiny_mce/themes/advanced/charmap.htm 0.7.16.src/e107_handlers/tiny_mce/themes/advanced/charmap.htm
--- 0.7.15.src/e107_handlers/tiny_mce/themes/advanced/charmap.htm	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_handlers/tiny_mce/themes/advanced/charmap.htm	2009-06-30 19:36:49.000000000 -0500
@@ -1,27 +1,27 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 <html xmlns="http://www.w3.org/1999/xhtml">
 <head>
-	<title>{$lang_theme_charmap_title}</title>
+	<title>{#advanced_dlg.charmap_title}</title>
 	<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
-	<script language="javascript" type="text/javascript" src="../../tiny_mce_popup.js"></script>
-	<script language="javascript" type="text/javascript" src="jscripts/charmap.js"></script>
-	<base target="_self" />
+	<script type="text/javascript" src="../../tiny_mce_popup.js"></script>
+	<script type="text/javascript" src="js/charmap.js"></script>
 </head>
-<body onload="tinyMCEPopup.executeOnLoad('init();');" style="display: none">
+<body id="charmap" style="display:none">
 <table align="center" border="0" cellspacing="0" cellpadding="2">
     <tr>
-        <td colspan="2" class="title">{$lang_theme_charmap_title}</td>
+        <td colspan="2" class="title">{#advanced_dlg.charmap_title}</td>
     </tr>
     <tr>
-        <td rowspan="2" align="left" valign="top">
-            <script language="javascript" type="text/javascript">renderCharMapHTML();</script>
+        <td id="charmapView" rowspan="2" align="left" valign="top">
+			<!-- Chars will be rendered here -->
         </td>
         <td width="100" align="center" valign="top">
-            <table border="0" cellpadding="0" cellspacing="0" width="100" style="height: 100px">
+            <table border="0" cellpadding="0" cellspacing="0" width="100" style="height:100px">
                 <tr>
-                    <td class="charmapOver" style="font-size: 40px; height:80px;" id="codeV">&nbsp;</td>
+                    <td id="codeV">&nbsp;</td>
                 </tr>
                 <tr>
-                    <td style="font-size: 10px; font-family: Arial, Helvetica, sans-serif; text-align:center;" id="codeN">&nbsp;</td>
+                    <td id="codeN">&nbsp;</td>
                 </tr>
             </table>
         </td>
diff -x .svn -aruN 0.7.15.src/e107_handlers/tiny_mce/themes/advanced/color_picker.htm 0.7.16.src/e107_handlers/tiny_mce/themes/advanced/color_picker.htm
--- 0.7.15.src/e107_handlers/tiny_mce/themes/advanced/color_picker.htm	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_handlers/tiny_mce/themes/advanced/color_picker.htm	2009-06-30 19:36:49.000000000 -0500
@@ -1,13 +1,75 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
 <html xmlns="http://www.w3.org/1999/xhtml">
 <head>
-	<title>{$lang_theme_colorpicker_title}</title>
-	<script language="javascript" type="text/javascript" src="../../tiny_mce_popup.js"></script>
-	<script language="javascript" type="text/javascript" src="jscripts/color_picker.js"></script>
-	<base target="_self" />
+	<title>{#advanced_dlg.colorpicker_title}</title>
+	<script type="text/javascript" src="../../tiny_mce_popup.js"></script>
+	<script type="text/javascript" src="../../utils/mctabs.js"></script>
+	<script type="text/javascript" src="js/color_picker.js"></script>
 </head>
-<body onload="tinyMCEPopup.executeOnLoad('init();');" style="margin: 3px; display: none">
-	<div align="center">
-	   <script language="javascript" type="text/javascript">renderColorMap();</script>
+<body id="colorpicker" style="display: none">
+<form onsubmit="insertAction();return false" action="#">
+	<div class="tabs">
+		<ul>
+			<li id="picker_tab" class="current"><span><a href="javascript:mcTabs.displayTab('picker_tab','picker_panel');" onmousedown="return false;">{#advanced_dlg.colorpicker_picker_tab}</a></span></li>
+			<li id="rgb_tab"><span><a href="javascript:;" onclick="generateWebColors();mcTabs.displayTab('rgb_tab','rgb_panel');" onmousedown="return false;">{#advanced_dlg.colorpicker_palette_tab}</a></span></li>
+			<li id="named_tab"><span><a  href="javascript:;" onclick="generateNamedColors();javascript:mcTabs.displayTab('named_tab','named_panel');" onmousedown="return false;">{#advanced_dlg.colorpicker_named_tab}</a></span></li>
+		</ul>
 	</div>
+
+	<div class="panel_wrapper">
+		<div id="picker_panel" class="panel current">
+			<fieldset>
+				<legend>{#advanced_dlg.colorpicker_picker_title}</legend>
+				<div id="picker">
+					<img id="colors" src="img/colorpicker.jpg" onclick="computeColor(event)" onmousedown="isMouseDown = true;return false;" onmouseup="isMouseDown = false;" onmousemove="if (isMouseDown && isMouseOver) computeColor(event); return false;" onmouseover="isMouseOver=true;" onmouseout="isMouseOver=false;" alt=" " />
+
+					<div id="light">
+						<!-- Will be filled with divs -->
+					</div>
+
+					<br style="clear: both" />
+				</div>
+			</fieldset>
+		</div>
+
+		<div id="rgb_panel" class="panel">
+			<fieldset>
+				<legend>{#advanced_dlg.colorpicker_palette_title}</legend>
+				<div id="webcolors">
+					<!-- Gets filled with web safe colors-->
+				</div>
+
+				<br style="clear: both" />
+			</fieldset>
+		</div>
+
+		<div id="named_panel" class="panel">
+			<fieldset>
+				<legend>{#advanced_dlg.colorpicker_named_title}</legend>
+				<div id="namedcolors">
+					<!-- Gets filled with named colors-->
+				</div>
+
+				<br style="clear: both" />
+
+				<div id="colornamecontainer">
+					{#advanced_dlg.colorpicker_name} <span id="colorname"></span>
+				</div>
+			</fieldset>
+		</div>
+	</div>
+
+	<div class="mceActionPanel">
+		<div style="float: left">
+			<input type="submit" id="insert" name="insert" value="{#apply}" />
+		</div>
+
+		<div id="preview"></div>
+
+		<div id="previewblock">
+			<label for="color">{#advanced_dlg.colorpicker_color}</label> <input id="color" type="text" size="8" maxlength="8" class="text mceFocus" />
+		</div>
+	</div>
+</form>
 </body>
 </html>
diff -x .svn -aruN 0.7.15.src/e107_handlers/tiny_mce/themes/advanced/docs/en/about.htm 0.7.16.src/e107_handlers/tiny_mce/themes/advanced/docs/en/about.htm
--- 0.7.15.src/e107_handlers/tiny_mce/themes/advanced/docs/en/about.htm	1969-12-31 18:00:00.000000000 -0600
+++ 0.7.16.src/e107_handlers/tiny_mce/themes/advanced/docs/en/about.htm	2009-07-06 15:33:56.000000000 -0500
@@ -0,0 +1,31 @@
+<html xmlns="http://www.w3.org/1999/xhtml">
+<HEAD>
+<TITLE>About TinyMCE</TITLE>
+<link href="style.css" rel="stylesheet" type="text/css">
+</HEAD>
+
+<BODY>
+
+<table width="100%" border="0" cellpadding="1" cellspacing="3" class="pageheader">
+  <tr> 
+    <td><span class="title">About TinyMCE</span></td>
+    <td align="right"><a href="index.htm"><acronym title="Table of contents">TOC</acronym></a></td>
+  </tr>
+</table>
+<hr noshade>
+<br>
+TinyMCE is a small WYSIWYG editor control for web browsers such as MSIE or Mozilla 
+that enables you to edit HTML contents in a more user friendly way. It has common 
+features that are found in most word processors and should not be difficult to 
+use.<br>
+<br>
+<hr noshade>
+<table width="100%" border="0" cellpadding="1" cellspacing="3" class="pagefooter">
+  <tr> 
+    <td>Go to: <a href="index.htm">Table of contents</a></td>
+    <td align="right"><a href="#">Top</a></td>
+  </tr>
+</table>
+<br>
+</BODY>
+</HTML>
diff -x .svn -aruN 0.7.15.src/e107_handlers/tiny_mce/themes/advanced/docs/en/common_buttons.htm 0.7.16.src/e107_handlers/tiny_mce/themes/advanced/docs/en/common_buttons.htm
--- 0.7.15.src/e107_handlers/tiny_mce/themes/advanced/docs/en/common_buttons.htm	1969-12-31 18:00:00.000000000 -0600
+++ 0.7.16.src/e107_handlers/tiny_mce/themes/advanced/docs/en/common_buttons.htm	2009-07-06 15:33:56.000000000 -0500
@@ -0,0 +1,162 @@
+<html xmlns="http://www.w3.org/1999/xhtml">
+<HEAD>
+<TITLE>Common buttons</TITLE>
+<link href="style.css" rel="stylesheet" type="text/css">
+</HEAD>
+
+<BODY>
+
+<table width="100%" border="0" cellpadding="1" cellspacing="3" class="pageheader">
+  <tr> 
+    <td><span class="title">Common buttons</span></td>
+    <td align="right"><a href="index.htm"><acronym title="Table of contents">TOC</acronym></a></td>
+  </tr>
+</table>
+<hr noshade>
+<br>
+Below is a short description about each button.
+<br>
+<br>
+<table border="1" cellpadding="3" cellspacing="0">
+  <tr>
+    <td><img src="../../images/bold.gif" width="20" height="20" alt="Bold text icon" /></td>
+    <td>Bold text style (Ctrl+B).</td>
+  </tr>
+  <tr>
+    <td><img src="../../images/italic.gif" width="20" height="20" alt="Italic text icon" /></td>
+    <td>Italic text style (Ctrl+I).</td>
+  </tr>
+  <tr>
+    <td><img src="../../images/underline.gif" width="20" height="20" alt="Underline text icon." /></td>
+    <td>Underline text style (Ctrl+U).</td>
+  </tr>
+  <tr>
+    <td><img src="../../images/strikethrough.gif" width="20" height="20" alt="Strikethrough text icon." /></td>
+    <td>Strikethrough text style.</td>
+  </tr>
+  <tr>
+    <td><img src="../../images/justifyleft.gif" width="20" height="20" alt="Align left icon." /></td>
+    <td>Align left.</td>
+  </tr>
+  <tr>
+    <td><img src="../../images/justifycenter.gif" width="20" height="20" alt="Align center icon." /></td>
+    <td>Align center.</td>
+  </tr>
+  <tr>
+    <td><img src="../../images/justifyright.gif" width="20" height="20" alt="Align right icon." /></td>
+    <td>Align right.</td>
+  </tr>
+  <tr>
+    <td><img src="../../images/justifyfull.gif" width="20" height="20" alt="Align full icon." /></td>
+    <td>Align full.</td>
+  </tr>
+  <tr>
+    <td><img src="../../images/bullist.gif" width="20" height="20" alt="Unordered list/bullet list icon." /></td>
+    <td>Unordered list/bullet list.</td>
+  </tr>
+  <tr>
+    <td><img src="../../images/numlist.gif" width="20" height="20" alt="Ordered list/numbered list icon." /></td>
+    <td>Ordered list/numbered list</td>
+  </tr>
+  <tr>
+    <td><img src="../../images/outdent.gif" width="20" height="20" alt="Outdent/decrease indentation icon." /></td>
+    <td>Outdent/decrease indentation.</td>
+  </tr>
+  <tr>
+    <td><img src="../../images/indent.gif" width="20" height="20" alt="Indent/increase indentation icon." /></td>
+    <td>Indent/increase indentation.</td>
+  </tr>
+  <tr>
+    <td><img src="../../images/undo.gif" width="20" height="20" alt="Undo the last operation." /></td>
+    <td>Undo the last operation (Ctrl+Z).</td>
+  </tr>
+  <tr>
+    <td><img src="../../images/redo.gif" width="20" height="20" alt="Redo the last operation icon." /></td>
+    <td>Redo the last operation (Ctrl+Y).</td>
+  </tr>
+  <tr>
+    <td><img src="../../images/link.gif" width="20" height="20" alt="Insert a new link icon." /></td>
+    <td>Insert a new link, read more about this function in the <a href="insert_link_button.htm">Insert 
+      link section</a>.</td>
+  </tr>
+  <tr>
+    <td><img src="../../images/unlink.gif" width="20" height="20" alt="Unlinks the current selection icon." /></td>
+    <td>Unlinks the current selection/removes all selected links.</td>
+  </tr>
+  <tr>
+    <td><img src="../../images/anchor.gif" width="20" height="20" alt="Insert a new anchor icon." /></td>
+    <td>Insert a new anchor, read more about this function in the <a href="insert_anchor_button.htm">Insert anchor section.</a></td>
+  </tr>
+  <tr>
+    <td><img src="../../images/image.gif" width="20" height="20" alt="Insert a new image icon." /></td>
+    <td>Insert a new image, read more about this function in the <a href="insert_image_button.htm">Insert 
+      image section</a>.</td>
+  </tr>
+  <tr>
+    <td><img src="../../images/cleanup.gif" width="20" height="20" alt="Cleanup code icon." /></td>
+    <td>Cleanup code/Removes unwanted formating. This function is useful when 
+      you copy contents from for example a office product.</td>
+  </tr>
+  <tr>
+    <td><img src="../../images/help.gif" width="20" height="20" alt="Show help icon." /></td>
+    <td>Shows this help window.</td>
+  </tr>
+  <tr>
+    <td><img src="../../images/code.gif" width="20" height="20" alt="Source code editor icon." /></td>
+    <td>Opens HTML source code editor. </td>
+  </tr>
+  <tr>
+    <td><img src="../../../../plugins/table/images/table.gif" width="20" height="20" alt="Insert table icon." /></td>
+    <td>Inserts a new table at the current location. </td>
+  </tr>
+  <tr>
+    <td><img src="../../../../plugins/table/images/table_insert_row_before.gif" width="20" height="20" alt="Adds a row above icon." /></td>
+    <td>Adds a row above the current one. </td>
+  </tr>
+  <tr>
+    <td><img src="../../../../plugins/table/images/table_insert_row_after.gif" width="20" height="20" alt="Adds a row under icon." /></td>
+    <td>Adds a row under the current one. </td>
+  </tr>
+  <tr>
+    <td><img src="../../../../plugins/table/images/table_delete_row.gif" width="20" height="20" alt="Remove row icon." /></td>
+    <td>Removes the row. </td>
+  </tr>
+  <tr>
+    <td><img src="../../../../plugins/table/images/table_insert_col_before.gif" width="20" height="20" alt="Add column before icon." /></td>
+    <td>Adds a column before the current one.</td>
+  </tr>
+  <tr>
+    <td><img src="../../../../plugins/table/images/table_insert_col_after.gif" width="20" height="20" alt="Add column after icon." /></td>
+    <td>Adds a column after the current one.</td>
+  </tr>
+  <tr>
+    <td><img src="../../../../plugins/table/images/table_delete_col.gif" width="20" height="20" alt="Remove column icon." /></td>
+    <td>Removes the current column.</td>
+  </tr>
+  <tr>
+    <td><img src="../../images/hr.gif" width="20" height="20" alt="Insert horizontal ruler icon." /></td>
+    <td>Inserts a new horizontal ruler </td>
+  </tr>
+  <tr>
+    <td><img src="../../images/removeformat.gif" width="20" height="20" alt="Remove formatting icon." /></td>
+    <td>Removes formatting from the selection. </td>
+  </tr>
+  <tr>
+    <td><img src="../../images/sub.gif" width="20" height="20" alt="Subscript icon." /></td>
+    <td>Makes the selection to be subscript. </td>
+  </tr>
+  <tr>
+    <td><img src="../../images/sup.gif" width="20" height="20" alt="Superscript icon." /></td>
+    <td>Makes the selection to be superscripted. </td>
+  </tr>
+</table>
+<br>
+<hr noshade="noshade" />
+<table width="100%" border="0" cellpadding="1" cellspacing="3" class="pagefooter">
+  <tr> 
+    <td>Go to: <a href="index.htm">Table of contents</a></td>
+    <td align="right"><a href="#">Top</a></td>
+  </tr>
+</table>
+</BODY>
+</HTML>
diff -x .svn -aruN 0.7.15.src/e107_handlers/tiny_mce/themes/advanced/docs/en/create_accessible_content.htm 0.7.16.src/e107_handlers/tiny_mce/themes/advanced/docs/en/create_accessible_content.htm
--- 0.7.15.src/e107_handlers/tiny_mce/themes/advanced/docs/en/create_accessible_content.htm	1969-12-31 18:00:00.000000000 -0600
+++ 0.7.16.src/e107_handlers/tiny_mce/themes/advanced/docs/en/create_accessible_content.htm	2009-07-06 15:33:56.000000000 -0500
@@ -0,0 +1,45 @@
+<html xmlns="http://www.w3.org/1999/xhtml">
+<HEAD>
+<TITLE>Insert table button</TITLE>
+<link href="style.css" rel="stylesheet" type="text/css">
+</HEAD>
+
+<BODY>
+
+<table width="100%" border="0" cellpadding="1" cellspacing="3" class="pageheader">
+  <tr> 
+    <td><span class="title">Create accessible content</span></td>
+    <td align="right"><a href="index.htm"><acronym title="Table of contents">TOC</acronym></a></td>
+  </tr>
+</table>
+<hr noshade>
+<p>TinyMCE can create HTML content that will be accessible to all users, including those with disabilities using assistive technologies, as well as those using text-based browsers, or those browsing the Web with images turned off. </p>
+
+<p><strong>Things you can do to make your content accessible:</strong></p>
+<ol>
+<li><strong>Include an Image Description:</strong> Blind users, or others who are unable to view images, will rely on the Image Description (or Alt text) to take the place of the image. If an image contains no meaning, such as a decoration or a spacer image, leave the Image Description empty. TinyMCE will then insert an empty Alt text attribute that will force assistive technologies to ignore the image. <br /><br /></li>
+
+<li> <strong>Add Scope to data table header cells:</strong> In the table cell editor dialog window, choose a Scope when creating Header cells so the column or row label in that cell becomes explicitely associated with its data cells. Table cell headers will then be announced with each data cell, making it easier for blind users using a screen reader to understand what the content of each cell represents. <br /><br /></li>
+
+<li><strong> Structure content with properly nested headings:</strong> In the format selection menu choose Heading 1 to Heading 6 to represent headings in your content,  rather than using other font formating options. Blind users using a screen reader can then extract the headings from the page to generate a summary of the content it contains, and use those headings to navigate quickly to subsections within the page.<br /><br /></li>
+
+<li><strong> Include alternate content:</strong> Create an alternate page for non-HTML content such as Flash, Java applets, or  embedded movies. This might be a static image, with a description of the image, and a description of the content that would have appeared in its place. An alternate HTML page could also be created, and a link to it included next to the non-HTML object. This will ensure that the content will be accessible to users of assistive technologies that can not view or play the content, and ensure the content will be available to those who do not have the appropriate plugin or helper application installed.<br /><br /></li>
+
+<li><strong> Check accessbility: </strong> When the AChecker plugin is installed with TinyMCE, click on the Check Accessibility button to generate a report of potential accessibility problems.<br /><br /></li>
+
+</ol>
+
+<p>See the <a href="http://checker.atrc.utoronto.ca" target="_new">AChecker Web Site</a> for further details about creating content that will be accessible to all users.<br />
+</p>
+
+<hr noshade>
+<table width="100%" border="0" cellpadding="1" cellspacing="3" class="pagefooter">
+  <tr> 
+    <td>Go to: <a href="index.htm">Table of contents</a></td>
+    <td align="right"><a href="#">Top</a></td>
+  </tr>
+</table>
+
+<br>
+</BODY>
+</HTML>
diff -x .svn -aruN 0.7.15.src/e107_handlers/tiny_mce/themes/advanced/docs/en/images/insert_anchor_window.gif 0.7.16.src/e107_handlers/tiny_mce/themes/advanced/docs/en/images/insert_anchor_window.gif
--- 0.7.15.src/e107_handlers/tiny_mce/themes/advanced/docs/en/images/insert_anchor_window.gif	1969-12-31 18:00:00.000000000 -0600
+++ 0.7.16.src/e107_handlers/tiny_mce/themes/advanced/docs/en/images/insert_anchor_window.gif	2009-07-06 15:33:57.000000000 -0500
@@ -0,0 +1,20 @@
+GIF89aJ   7T,p9V#>0M6xA^1t*o:|/s)n
+$j%kf(D<Y3vIgュҊzYx5RvUUU̇3Pa(m$@s <}[zLknQpMkLjx,H2NSq/K4Pϝ@]Rqi-INlᘼ䄦ӟ}Qo5xt2Ou9{8UDb^~u:W7z`:WB_OnOmB`{pJiNmPo fr?]>[?\"=~1Ncꇩ~VuGedx
'm^}Vtk!<~sĝa4QϚ#?KiFdl쒵 ;}+G\|]|*FWv8ypTs5w6S0tۏ&BTri-qUt'Bm)E'C4wHfhb[zEcڀЙj%@e=Z|g.rDahyd%A2u{Fcm`*F+o\{皽_~ЈcGeӍ;XkCaJh=[/LZy}www-Jq9{.JqwȖXw~Wv3fnSr&l
'lↆo33 f  333M̙ 33f___3@@@   !     ,    J   	H*\ȰÇ#JHŋ3ϟǏ CIɓ(S\ɲ˗0cʜI}iɳϟ@
+ZgG~
*]t)`atTKJ $Xyd[DPI3`@ va5
+Q%Q6n8Q#9d@	 'T,BYΠ1@,]ي!8LM 
̠,bE$0z0)ҧ;oC5)Zdgʱ`W@l]<u')ŋr }֭K4Ѡ\pr5 $TP3Є "*X+(
9sBC7P	 ŔFF24b
+A #0L6PF%?F5dNA%UVaW^%Yf[n%]v_~&a!cA&eag&ik&mo'q!sA'uawށ'y桧{'}( " B(!b!("&".(#6#>)$F")v%9!5$ROE5UUWeUW_5VYgV[o5W]wW_6Xa%XcE6YeeYg6ZiZk6[m[o7\q%\sE7]ue]w߅7^y祷^{7_}_8`&`F8afa8b'b/8c7c?9dG&J{ԕt 
%b[hֻ&nt|'zܧ6<(ĆNŌf(ǒ~\Ș)ʞˤ|*ͪܪΰ<+жѼ&+>]V,nԆ}-ڞN:1룤Vwd1񄟷.I/o{|&'Â>\Ĥ.(AcF)q*eb^V*fY9>;YVBUv4_--XN#VԎE5e]YZVצ6k-[fB'}?'!bO\JGׁqx5 ]c&{#gD#8H@9P;99jcB&4GJ
+fYlƪxD>@R;zR6,kjJ՘JkF"Fȏ~ #~`;A'QbQ>,-}\ܽ_sXW05"+@0sw<`#SY!'D^u|")x$h"%ݡca(1y$\;elP!<H!!^4.ˤ:0bz2=2	$aY<b8$of@R  y\@r
+$s@"T@r<rl$2	z@➏#?iA GX )H^gyFAnJZb4m=hdʁ#=RQq,q/@Lgx*Gx$	 ?8yd/GsFk%<l#(x5 H>j$WUӁDGyd=q? IjG0PxA)H
yD
+GPHDUɼV(e+f
؇<Y= Le:>j?Ӝj{Q}M8?嚳}.kU
+$,GAvTdNx0^缅H>WC?v%#X? (HhᰲA8:a^VWR!{c;Ўĥ=0Rbe&ඉۭuT~3q*wbs]HyL`uoi`ru^Q+ż޷ןO|0ׄ{P- Rw.X6	(BY~Tf vaҏthGLښx*&A&Q˶p?wpd!ȨI2&S66kex.xgLemi?tf8s67M<<b#uphp	Ao7
<ȉSi)$/nGUFE#5>ctCTs:؞Cy~d0Z5$?s4#xI}H?B'Vi?;RvE+2&Lave}C>66)^F<lOޟ'?9^nQv4 K|tQHJMWEt;*IB̒5QSCgw$QhճKƷY/||||s>Z8E/cM}\'9GS1W@y:w2AsH:A*3P3BhBB<-T`
+h<3nX |^=_|dDfjlw}"7E>Au8D?s?Tm$@sN闃NG>AcH:A3HsPI;RP$</tԀ}Xͣ؊$6xh7ErMww}dԂ?D9x~9xt@4BG3B脹P+H<u<|XY-SrMQI7}#8d}aÂ{}?Fh~6~r)(AtFHOKXI;%I;xVX<؎ؒxDD294Y6y.d<ٓ>@B9DYFyHJu8PR9TYVyXZ\ٕ^`Nfyhjlٖnpr9tYvyxz|c9}9Yy}9		.ٙy8ᙢ9YYٚ9YnYywIȹٜfɛ9yYعٝYIy깞ٔɞyD)y鞘ٟ	iKrifzږzPڠ
+hlY$'ʡ#*\ע
+fi'	j2:2J9J?
+ B7ɢFLz-ڤ/j.:T
+UjYʥ=McNZgJjڥjI]:oz)
+٩Y1z7:;6glk*JajSZ
+hzf٨t:ʩʦک)}j*0z=|ڦz
+Kwzs*ʖb*ǚzJ:z:dZz:Zz꺘ٺJJʜKyGYe;[k{*
+	K$[&K;j#{02QK:.;<۳2r9~	EK3/R;q)[O[H_;]a˲fTj;Vk{;8*tۦYkc+_ږh~)ѶqIu\;ki[[]+|;(!Y:+eKw\˴w}KۖK˳{{kzțʛ5ۭY;|Y;{ϛ+۽૮;Z+Jaɾ>ټI{xY{h˿*ks)il
+L@"qY64[y< ,K',#\'.*j3\>\0:¶%68EH,J<@4<+<YXl-<T,r@lWIe[PF|pc_܅leLal,t}Ky\z\ņWhK,x×fk<|xȢɣgluyɟ3h\sʻ\lLW;׋Ԍ|,̟<Y,켞\\J
+=}љ
+ݜ}=Yѿv"=$]&}*,]0y02=4"T8:<<@B=D]F}Hm ;
\ No newline at end of file
diff -x .svn -aruN 0.7.15.src/e107_handlers/tiny_mce/themes/advanced/docs/en/images/insert_image_window.gif 0.7.16.src/e107_handlers/tiny_mce/themes/advanced/docs/en/images/insert_image_window.gif
--- 0.7.15.src/e107_handlers/tiny_mce/themes/advanced/docs/en/images/insert_image_window.gif	1969-12-31 18:00:00.000000000 -0600
+++ 0.7.16.src/e107_handlers/tiny_mce/themes/advanced/docs/en/images/insert_image_window.gif	2009-07-06 15:33:57.000000000 -0500
@@ -0,0 +1,32 @@
+GIF89a^!  Us^~Rq\{A^,q9V*F?\'l6S.J;X4w+H:|">/s6x(n0t8z+p@@@
+$jJhIg%k{fYxu9{2uCa7T3w:Wl'CԑUUU-Ie]|0sFdiKijk=Z`EbEc7x2O݄0LnyɤjFd֌ـd虽Vu&B1M|rå/KQo(m/L*o}GeGepHf5QXv*op~4Qۜm ;}"=~hiNm f̣풵tb(DZz!=~[zNlOmUtbt)DXw]}ы&AѠ$@xMl <}wȊ؋`DbB`$@ꃥLjMkwǏxȓ=ZSrdaꖹ.r%AҌ^}q8U<Y5R3PyzʛcA_qoZy遢|}aWvTr#?n3Oߡ쏱܍5xVuvrQpgwww>[@]1N2NsĐ?]Kjh3fmPnPoה)E*Fᆆ33 f  333ff̙___     !     ,    ^!  	H*\ȰÇ#JHŋ3bϟǏ CIɓ(S\ɲ˗0cʜI}iɳϟ@
+J Ύ2(]ʴ)H2A0,(k(aDh$HRșg ijňʊ}Kw3lmۄ,MZ
+Je 
+f1
+޲+	~ Yrc38lؠ['OD\j: )ьA/?V |*ƧSOhZ8:urPCqq$UMXYL4PJ$H܂`11b-N""	ְ_0S"43(CtBz0#Jc*'B
+HK.fE*<*p0kqDPh\v`)csNM]ΚlTTSUuUV[uWaUYi[qU]y_
Va-cMVemgVikVmo
Wq-sMWumwWy{W}X	.NXn!X)1X9AYI.QNYYnI9%5$RPI UVaW^%Yf[n%]v_~&a9b9dYfyhjlنnpr9tYvyx䙇z|ه~:Zz$,4ڈ<DL:	TZ\t㍫t"?0d90pǙ0鰞I1'
+2$?z*W20o:63<BZ4HϺN5TzZ5`/;fG6l_rw[7x~8{xC8N0P94s04x8tp:V	b|؟,&(jcG%FR(,LŌS4DRU@[\eX%VLt%|jv)Kl*6YmيKo媂Gu
]W8o!>HG:qoT 	x&-
+T X@9-Nxz؞$1B8#sGR;]eYj*jg.xh:V
+jBG$LZ<6fYgڪնy}'
+7rmSU8x!n^WG3ձ:#SQGC!C*riAInb$Bql#(eHRlaT๲H>*\ybYa~IGeߓb4gjZԀG 8Fs⏍8}'?O>x}41xꑃda H	# 	D3C 	GZ|e THV҆: I @bK($SHQ
+$0			@b 0#B6X#R?yd!8AR$KI<`5pܪֹ]~aW $kYkC5^U<R 4#cH@X\^<B?By2ɌGN #<xHh
+#	<#Hy<Ե*ة<4lIG BqG8䑣HzGcT="$H$Q<\׍ZW
fyDgAoc0(du?~+"ٯ? _.")?&x<aH	Ʌal8$IJ(6hb@$q!hlcG8G%P^@B+!cr
+\%@,@5s`
+H^&81v4|#6/ZF0J'vm9`1 
s41oCWH?dUk'?;6|Lc#Vې%\`Zvٜ_{v(_.Yn}f }vt0|O/`wx1Rڤ!KNb9^?Z_z1Gg~ӚX<9{ ?Z6ћmt!]nJ?돦?=SǗm@^xa'X
+^JaG!wxq7B="hBx
+5u!a=9dz/ă4yErjU
+yہkU5ZȔz>6
Q[ t7tIf
+f
{ {t\Q
+5|ȧuYU}|N]ҧGnK 3Pn^ADAIA~R1RQI2#qQ+;Bgj4C#yƓ*AR<<DKDD=D8DƢLE>T4MEp\E{at.4?gTNF]]A<ulf W~gPTAsA:SI1WH;ZQ*;; QR W3hCʓK><$DLR5R[sD>S$MsEEM%.7(?fDNFɧN:Xc:GN}(H8AIA::BCBYxB[8!;CU<CRlCKC4=S3Ɉ=v=NT@ǇXTEE?Rx|Wp4Y6y86%:JH.0DYe0Ix
ՄC䊳SBVB	$CRȣˣK93=Ԍ HTTָEL>}ӒX?0/9NqSELOɊ 1iB#W.;[	y萔I(Sph=6ב=(TSEs	P6٘?e4N~iUFI^EQyșʹG9YyؙڹٝUH=Yy虞깞ٞ9Y9ٟ :Zz
+ڠzڡZ_$Z&z(*"/+02:4J-5:<ڣzB:DZ/
+FJLڠHڤPRO:VzX*U\ڥ^[b:dzaZhezjڦnzlr:Itzxv|ڧ*~ڡ:zZjڨZJ+JO꩖?*#ᵡʟڪ:	*z Jꤤ׫JꪭZڬɪɪ꟯؊hjZJ:ʫ:
+jમ:zjڟΚ +z̗J:J	{Z*jˮz+J"۩)k5{8+ۦ!:7Hk8S
+AUks^Q
+b[JJfCj۶;ʶn3
+r[+Jv&z۷ʷ~
+
+{[fVU6;[6K^QkΙ;۹N;[4ڳ[EKk;UkۡK9;;kJ۰ں⋰k[蛾{j;]+﫢竾ۿ7q:Kǚ{[(k|ڼ  \|0!,J	ZY
+2K jڴ_<\	~JFĵ}T\V|9*\R`Ld\_\hcl<kp̢ot̠g\a|xzǂ~췀z8Ly<ǟXȎWśۋ»kLĜPܟlVɝʟɓ{ʶl+|\˥<<Zּ*^Z&͚|!!Υ1ˠ̧󬼋lʚl ͒L˼SZmL%+JZμ[Lɿkl$2-=<˘%M1ˣ|89ۼ2
4=w̽EBk5mr*,+Kկl;Zm\b`b=N[f}ڜpl]nֿCvt~9k=Җx{ݥғxg"cH]!<탙؃=1]ѕw=[ڑxxm۶=Ýݿړ-l]̴J4 !ܡqݍu۩mҾD-ްM]][Ŋ}}=.;]
ԋyܛ6-mmM}C->6"$=ݭݷ}/~.|m:awtܦH>^W)_咺y1+0,~rnt^zxz~:.~~PjyMQ@`V+LLNꡮl
+>nn=[ԂZr{%-؊OM®԰~ۗ>u~#Q
N{nA0:~̎޶
+.~Pyjk_ϟ	
ꨞNyldϲ"/$_(*.04/6O9?=/?ACoՃ|RzR}QF>NK)A}"ku!~	j/l/
ӵ<lhq/EߣRȃϣOȇ֋OR:L3_?k_=;xOčֵ/?Ż֏:O>Ӳ?f=WȮ>^~c+owou`;IՍr_$XA	.dC%:߾/^_G!E*I)U7K1eԈ&Ǚ9u,O-w%Zh7.epSQN*UY&QWaŎ%KƲiծevk׌pΥ[.ӳ^/EJ&\n^/fqcȑ%|<eo7
+3ʟE^ΪU?=Zi2{jlѰq]ݝu7P/WqɛKf~mW:陫̮]`t`_O}|'Xzro9ВC;A0@,@A"T4lB*а
+ڰdDUL<x1AE/ƿr?ъ<H$R2"&?s7(kJ-./,0Z̩DtI.ߔ8:ԓ1
OtP%$Dt̐QHMJ+*,tS4̅,1KQ6IJLUXI]S?CRe]5\]
v^}XXSb56uvdkj5ZLוX'pѭ]uZjOBnYV]փW͗k}I}jo던0iKb}xR.㎿mޒSNߋʸnVߊWv\z=ݍ%V9ݖ%dc'6]o){.`7-eF^Hdokzưk
YцݕRYum^>-iȾSWipqUSzo#'P+r3gm;	sCtC'OG=sWu#=gmo:w[΋~x7xW~ywy裗~z꫷|{{?>7|W}w}mj|~~ P$`
x@&Pd`@FP`-xA ;
\ No newline at end of file
diff -x .svn -aruN 0.7.15.src/e107_handlers/tiny_mce/themes/advanced/docs/en/images/insert_link_window.gif 0.7.16.src/e107_handlers/tiny_mce/themes/advanced/docs/en/images/insert_link_window.gif
--- 0.7.15.src/e107_handlers/tiny_mce/themes/advanced/docs/en/images/insert_link_window.gif	1969-12-31 18:00:00.000000000 -0600
+++ 0.7.16.src/e107_handlers/tiny_mce/themes/advanced/docs/en/images/insert_link_window.gif	2009-07-06 15:33:57.000000000 -0500
@@ -0,0 +1,18 @@
+GIF89aJ   6y2v4Q/s0t-q*o)n
+$jgz4wYxHf5R'CXw,HuUUU%kVu:W ;}2N1Nt7Sp¢Ecila,pNmFdϠ뛾Eb{2OFd.J;X$?@]՞Ut0sh8z(D@^A_3P]|MkRq
'mxȗ?]8UB_B`Ca}do9VC`}nTs_~*G7x">;| f̙rē*F!<}Ԟ=ZQpiPoQoێܟsfWv
'lfIhJhKi!=~ԓl_0L꙽c1MTs#?:|?\2u&AZy"=~؁Igwȋv&B\|рa>[wt=[[z.rOm㛾搲)E^}$@+pp[z\{|~{mܜ皽)Eo8U7TSrm`^~(mPn5xSq荰yɔ%Axq-IdMk-JNlwww9{/K6SrKj/Ljבe:{3fLjbjGe&l;Y<Yb+G33 f  333M̙  3f@@@   !     ,    J   	H*\ȰÇ#JHŋ3ϟǏ CIɓ(S\ɲ˗0cʜI}iɳϟ@
+ZgG~	*]ʔ),uUX(j,
+`  |	"[0qQUY0aȩ[fPٳ԰	2$D
#FHP\OhЀ:56)rH(QHq
r"D'ϵpIAs1
+X7k۵吏P BV\]B@4fQ 
+6Q1*XXf,Xie4 
2EC&@'<0M9}07P"I"D6Q2BMBRcE=Gxaz,$L6PBɏQ:1M:XfSPIEUXiŕW`EYhŖ[pE]xŗ_	Fa)ƘcIFeiƙgFiƚkFmƛo	Gq)ǜsIGuiǝwGyǞ{G}ǟ 
+H*ȠJHjȡ H(Ȣ0H8ȣ@
+IHF:9eNH-
I\SQMUUYmWaUYi[qU]y_
Va-cMVemgVikVmo
Wq-sMWumwWy{W}X	.NXn!X)1X9AYIeOe?-l`nRznyo 9pp#Z;qS$kzr*0:s6<sBZHtNT+{uZC`[;v:1STvC#v½b}A<ݥ`;&fΛlK?o-^y0
s凢.(AcF)q*eb>R*fv+*h"+iÂ,#Y{פj
[sЇ<\]/\JpcxG4KL*T x_n/:~G?H#"DY5\<$R"T62O,T+w<:$*G`ճYVC˕x!.C!)ԐUeY[רkm~CTzArDQ		G>zЎvCOdGx7xDoâE5}pg.Okğ@9l1}$HHE#-xN%eALn|'O <Mk)T\^'}ģ(?x9R]z<@f:4KI@# ?>m$
+IӍpr@G$Jq$v>ϏXOH?i?h]aZCP#BIN	y
+pK6-KJF=%Δ5?xɢGd`?xd9?5O}?HxHxG# ٣?($>r<@#H"H4r{<PXyd?aHyqGO#-0,y<"H$bBC
OɖBg?c mܞvp6N[kׂ+"?."?K\"WQsݏ4 agl<R>ѻqKd:
zϷ*|QDG v@b00!(XЕ̋e=s1b/|G;ӦVƫͩ?\tZ砷e7m'SWzW-s1=s\,*wn,fBg9p? ALm"%g%
̣_9}Zqz^mWFcqT\3Wɻfrt1uf5cvw]EGlFflྖ:WVfQax#1	<BY\vvAnKJ; yGmPE#
+G3P|__Fj|P5yMUOXUX#ʫ]?΀Yqs.#v	fAt#()[ua]\@҇d,G}oc\ɤ)M}}C>|p+c9q3 k3jT<?A<*hf,AD;!ISB"XBu.5d<4J%|&%RWDBZ2S7}'>r}|s>Z8&~d8uB~''?CG7@G#@$:dH#*3*:TIBt;$4	;)QSg3Cvh5DWcbhHKXbpr8wycE'E>]48x3?s'3\GC(:h9<9@:TH#A.C*J::4PFSPcB
+B4<%aQ8X$h̗vu$M؇yXM݇M~M'#N9~%y(G7hOmPU;"Ix(PHJ,抯-Mяb}{c>xHMǂʸMh~c~ U@9(XOw::䄞8RxPꈀZH<2JX٢4GD8:<ٓ>aಆB9DYFyHJLٔNPH	bGxXZ\ٕ^`b9dYfyXAЖnpr9tYvyxz|ٗ~9jI٘I	bYyw999ٚvyl隲9Y	Yٛɚ9yYřٜ9ٖYؙyٝY9y艙晞ٞ	TIyIGٟ9Y
JrI	Zʗ_טږ:*qu$ʘڢn0
+5ɹ{:<*GDY>
ڣG:@L*N
+$j&jF-^z2:`&zP:UbJ2o:VOjrfzڥrbqjG*t:%zzʛ|klڦZzJ_ʤڨwjE:RijvZljꪤک*:)ZyȚڬJzZ
+ךܪڭJʘZ*ߚڮﺛRYzN*e ;k)Z۰{9{i;$[1ѱI*'M{)&;4[ ꚰ.-;?6;D[8;*k/aL
+s)E[VKG+I]M봩`;pIW{h{KS+`Q`+tiiz{Y[]K%ʵP۴vxkzJq;uh۷;E빅ٯ)4kɶ
+;V}	ۻP鸇{;k{ʛɻ+;{Żڽۭ뚾[{kih;_+{69qm˿TSLGQ;[
̺,́ܗCz %!1,Ek"-@9̫JP,LF<H<	L@곗Kw0-¹ac\e<f,_W_\ggmnlK phlO|QLS,J\<yĎ8Liȏɏ,jɛlƘəɖ|!L|R)aC<ɕ~\ɢ$ɣw`_k<ʩ˧HD>ą봁kRDмǞͦLΡdl<FOlR֬ڼs+ -Iwq<̽|l,|<-bLaʄz\"}H[髕9dl24 <<]]Zҹ?YF}N-
+R-;ZV
XȺ\^Սb}d]8:KK_kClm=˗j-\[[Ȅ+yy$kKLݙBf1Ï}K3ap5ן
5Ml'mx{sl<ǎو9M<ƦռmM]ܰ--=ȭ=νy]\}j\ݧ|ɌԨމ-ݭ݃+
KTyi 
	5JkonCme(hg=Ϊ&ή%,.24^y8:>@9D>F~ߙJޝLP(>]]VXc-H`b>O}h7Iln?i >t^v~Kz|~ ;
\ No newline at end of file
diff -x .svn -aruN 0.7.15.src/e107_handlers/tiny_mce/themes/advanced/docs/en/images/insert_table_window.gif 0.7.16.src/e107_handlers/tiny_mce/themes/advanced/docs/en/images/insert_table_window.gif
--- 0.7.15.src/e107_handlers/tiny_mce/themes/advanced/docs/en/images/insert_table_window.gif	1969-12-31 18:00:00.000000000 -0600
+++ 0.7.16.src/e107_handlers/tiny_mce/themes/advanced/docs/en/images/insert_table_window.gif	2009-07-06 15:33:57.000000000 -0500
@@ -0,0 +1,27 @@
+GIF89aT   JhUs4w9V'l3O=Z+H7T.J!<~1t.r#?6y,q4P)n@@@
+$ju%kf'CIg-I<Y3v8yYxkUUUDb{(DvǎRp|;X ;}Srbޓ[znNlC`Rqsx:Wt:WMl3Pi?\0v1NOm(mSqs)E_~MkGe`Pnyz*o6R*oOnQpPop <}~o"=5R:|wEcl f̙:{a]|+Grrd?\/K#>~Wvc䑳>[7y6S&BVu0L]}^}Xv%A0sЖA^یڍiLj2uKiUtVuЕ$@%A@^*F8Uۂe\{拭mjhbLjFd@].r,pghB`A_Fc*F_+p҇Չׇ֘lxc`yɞ鄦5w\|eZzqwwwZy|9{3fݛqÔ᜿n}XwCaHfGeo1M0M33 f  333M̙ 3f___   !     ,    T   	H*\ȰÇ#JHŋ3:ϟǏ CIɓ(S\ɲ˗0cʜI&}iɳϟ@
+gG~*]t2˖a<ŀIpA@hB61(HPJIZA
+PNs 	qN@"P
 2t-SzQ	7jYAwn :D%H%`	b|
+HP$r!B`v4; E	
3mdT$o`.2ּB=(LZPٌsF D%@Fs\AI&\B5QH
T`8߀2J%d!q4J݀H2|4U R0TViXfSט#c:TTYV\yXdZl\tم^|`b9dYfyhjlنnpr9tYvyxz|ه~:Zz$,4ڈ<DL:	[XvRK]C;#(TTLUUYmWaUYi[qU]y_
Va-cMVemgVikVmo
Wq-sMWumwWy{W}X	.NXn!X)1X9AYI.QN{S{`&cB܋kfqLw*g}BăZlhƉrǏ,iɕʛi̡Lͧjϭ
гmkҹ2ӿJ-lbzlђMתm
mnN/
?_[	pq/zT:!Oi?ILPsG0&c
+YHF)
+T:3PlT63UR3VUBUj4\#MԀ5aYXYKgMZeڰm[qus||>E.jpk/~36a H~	`p؜*La<@QP<Ea3QWK">%3Qy$H<UUAhu[#|2#Ӛ,AklbGpmߒV.+}
+AE/}AyG2Ўvld
+G9c )1s	GB.<#ձFA%L3'=R{a*7Vd`QX<.(=_z1eqQ3H>h&D]>	FhrGu7ߕc?qt 'HA;=$`Y<  $	g@$.x$3AHJ~D6		9Y; ?(x
+ Hd	Gg $I@r!xF@"dl<,{7TfRo*xdudGx$GÏX?HA
+!G8$Ge:*DGtPI\rɍG6I#  	?{$4x<#@*Rz#RJP#S Ij"t#'HLgjc6Ȑ<2E9bP}KT d%cR1|(plD;NUuaݏ|E$3/!{W+|+HP77"$H8Gtp	 aߠacP?Bk"I?!kG:L+鐁M}J>mlCh6^9BuIdrdw3grNe8U^J|~͟1`90(XEkǄqNGYZ1M=r\p19Uv[?v׺բ[^$6.(nnU-Km0y䆳H<>-ݽR)v?\h
+#E8?6pb#C&53~ꍗmul1[3H<R.P{[yG9S
+ЃHΝkewz$[? 0_#qAIS1r=wquC_`XݡLJV4೘l?RҝiGi}d 	bWIG2pHQks GM\TddK58JNXUNBG#9x4@c0v90~OD(s(np:)#PcIPbGX'T3f;,dJC<4Jų+w5&CͣRKED=Dؓ667-ScMB$A\vuU??sGT9{d@pyҁ@:BA%Xg'X|*:r2.;#|B5BB;2JcCCCC,WcЃKHt=4N='ES$>(E4F2w\)0X?Gt9@#H@$:xX:tg)3X&*4;;;1JSCJ+BhKDϳKD/LJ=xLP=c&x8%ȏ?5YIf8u@Ëi0{X4H:&c)(&(}8sQxJڸh<AH'CtRÎMD6DޣL&g2D%Hi/Ԑ؆HtO"8:(2}8I-h;d:Q?((DxA7iD9ɄDSUdDYy9䊎9YyٙITG8Yyٚ9ٛ9YyșʹٜɛiYyؙڹٝ9D9YyY.ٞ뉛yY :z
+
Z:zʜڡ ":&zZ(,z*ڢ02Z64z:ۙ<@>DZ9FJHNJMRQWY[]_: aʥ`ynɦr*Zuڜt
+\ʧ|:*yv:xe*[h]ڨWh*zw
+i_i
+jp*k:
+j:
+
+*κګJJڬӺʭ
+ҚzZ
+Ϫʬڮʞ隬kڛʮ˪JdʬZʨj:zۧʩ	UJy!۱69؉$+&.j/;ڲ4{i8<@;)D{iH٩L[@ RCeY][_[1241L3=Z5ʶ2H+1AMyi0D/ڦuʱ\Zq:ɷٵ ~
+˹;d$Éۧj);jԚ)KkI; !1jɶkd;뽺ى׋໮ѻ[xΩm{kɿsK	+Kѩ׻k)kIK0*"|ܢ%˳+- 61/7,3̢Xk?kDܞ[[H|=LCPGT<TV|LZ\D`bALT{y54)(
+7mƣv|r}lS%1jșB|\L;Щ$y	ǩBZLɉI"i+ʻɾ+ɨZ바Jϻ!퉺쬾,I aIܛܽ̪,˾)A)̛<۫<̶\mj+˿6lʦ{L]
̷iϼ<ѬϺnҎ-\5Ӈ7ĸ̝@*2zԧCe̟JO]9=gi(<^QDb
d]<{hj4np+;tݱv
Xw-W-IYO|S.9U-~F:Պ]!ؘGdٓ-}+-M+QXx8ع'ɮ=&!K?ɽא]mK]{]yݻ
Ж꺗2
yݑ+̼­kΜiD=ѩLࢫ n:-;ܝ
+~)J(~{mTH%);.ի6>;9n\Xj.7>V>٤<1-Е
;ͼȍD.-=⩸vnҽE>(^?
n]Σ伭®&$nաËI~[}NMM~[żaN>L>ȞO̾IU{~> -]=4>N>>ǉ>c>La>	=I󜾳zAЄ_ o&ΰ(IN,$/`>މ\0%?><O٫-=DoSHoﹽ?ܪSf/Q["=O>)Lu;['
/._@ϣ?:Z_l3-+O?Ĥy&^Ð
J_-ȝnۣ6]._,/.\[)?⩿oYȌ߷[y
 A	CI`E5nG!E$)!''췱eƗ//ʜYǉ
+,xPN<Y4(QA}%xNSYUYpH5-BIӠV9ԭўL{iT]ׯG\Iʌ9VaÉTK[B&ݧQ]瑁J(0ǞEZccˑ+6nQڱ6qkA,8Hغ-WV޼!^*ֵ'wy('_<goNz=u'}ѿ篽}n@4@
+@Ap е/pC;+CCqD-DSTQWtEj1FkѤqG{hFD 4<&tI(CrʫJ,IIP}&/0LL3CsL8kS7q4؜3:=#5-3PsCM軁ըKHt8-U*2#J=;Q9UP$k34,1>6QWTpRbkSWeZmYEY_ɞu؄-Yc%mQp%(nw-uON嶶ʅ\?=
}X7ӑ^u֥"#_8-6i5OZuZ{㤼7O
9┕3yYnyߕyH5*ffqf$o块(K椛NZx^zjU)!zkk{&lF{fm݆{{oO
Kpp7pW|qwqg+r3w;sC}t!OiSW}u[wuc}+vs}w{w~x7x/  ;
\ No newline at end of file
diff -x .svn -aruN 0.7.15.src/e107_handlers/tiny_mce/themes/advanced/docs/en/index.htm 0.7.16.src/e107_handlers/tiny_mce/themes/advanced/docs/en/index.htm
--- 0.7.15.src/e107_handlers/tiny_mce/themes/advanced/docs/en/index.htm	1969-12-31 18:00:00.000000000 -0600
+++ 0.7.16.src/e107_handlers/tiny_mce/themes/advanced/docs/en/index.htm	2009-07-06 15:33:56.000000000 -0500
@@ -0,0 +1,27 @@
+<html xmlns="http://www.w3.org/1999/xhtml">
+<HEAD>
+<TITLE>Help Index</TITLE>
+<link href="style.css" rel="stylesheet" type="text/css">
+</HEAD>
+<BODY onload="window.focus();">
+<table width="100%" border="0" cellpadding="1" cellspacing="3" class="pageheader">
+  <tr> 
+    <td><span class="title">Table of contents</span></td>
+    <td align="right">&nbsp;</td>
+  </tr>
+</table>
+<hr noshade>
+<br>
+Click the links below to go to the different help sections. 
+<ul class="toc_ul">
+  <li class="toc_li"><a href="about.htm">About TinyMCE</a></li>
+  <li class="toc_li"><a href="common_buttons.htm">Common buttons</a></li>
+  <li class="toc_li"><a href="insert_image_button.htm">Insert image button</a></li>
+  <li class="toc_li"><a href="insert_link_button.htm">Insert link button</a></li>
+  <li class="toc_li"><a href="insert_anchor_button.htm">Insert anchor button</a></li>
+  <li class="toc_li"><a href="insert_table_button.htm">Insert table button</a></li>
+ <li class="toc_li"><a href="create_accessible_content.htm">Create accessible content</a></li>
+</ul>
+<hr noshade>
+</BODY>
+</HTML>
diff -x .svn -aruN 0.7.15.src/e107_handlers/tiny_mce/themes/advanced/docs/en/insert_anchor_button.htm 0.7.16.src/e107_handlers/tiny_mce/themes/advanced/docs/en/insert_anchor_button.htm
--- 0.7.15.src/e107_handlers/tiny_mce/themes/advanced/docs/en/insert_anchor_button.htm	1969-12-31 18:00:00.000000000 -0600
+++ 0.7.16.src/e107_handlers/tiny_mce/themes/advanced/docs/en/insert_anchor_button.htm	2009-07-06 15:33:56.000000000 -0500
@@ -0,0 +1,32 @@
+<html xmlns="http://www.w3.org/1999/xhtml">
+<HEAD>
+<TITLE>Insert anchor button</TITLE>
+<link href="style.css" rel="stylesheet" type="text/css">
+</HEAD>
+
+<BODY>
+
+<table width="100%" border="0" cellpadding="1" cellspacing="3" class="pageheader">
+  <tr> 
+    <td><span class="title">Insert anchor button</span></td>
+    <td align="right"><a href="index.htm"><acronym title="Table of contents">TOC</acronym></a></td>
+  </tr>
+</table>
+<hr noshade>
+<br>
+This button opens a new window with the insert/edit anchor function.<br>
+<br>
+<img src="images/insert_anchor_window.gif" width="330" height="139" alt="Anchor dialog/window" /><br>
+<br>
+There are one field in this window, this is where you enter the name of you anchor point. Remember the anchor name needs to be unique. <br>
+<br>
+<hr noshade>
+<table width="100%" border="0" cellpadding="1" cellspacing="3" class="pagefooter">
+  <tr> 
+    <td>Go to: <a href="index.htm">Table of contents</a></td>
+    <td align="right"><a href="#">Top</a></td>
+  </tr>
+</table>
+<br>
+</BODY>
+</HTML>
diff -x .svn -aruN 0.7.15.src/e107_handlers/tiny_mce/themes/advanced/docs/en/insert_image_button.htm 0.7.16.src/e107_handlers/tiny_mce/themes/advanced/docs/en/insert_image_button.htm
--- 0.7.15.src/e107_handlers/tiny_mce/themes/advanced/docs/en/insert_image_button.htm	1969-12-31 18:00:00.000000000 -0600
+++ 0.7.16.src/e107_handlers/tiny_mce/themes/advanced/docs/en/insert_image_button.htm	2009-07-06 15:33:56.000000000 -0500
@@ -0,0 +1,65 @@
+<html xmlns="http://www.w3.org/1999/xhtml">
+<HEAD>
+<TITLE>Insert image button</TITLE>
+<link href="style.css" rel="stylesheet" type="text/css">
+</HEAD>
+
+<BODY>
+
+<table width="100%" border="0" cellpadding="1" cellspacing="3" class="pageheader">
+  <tr> 
+    <td><span class="title">Insert image button</span></td>
+    <td align="right"><a href="index.htm"><acronym title="Table of contents">TOC</acronym></a></td>
+  </tr>
+</table>
+<hr noshade>
+<br>
+The insert image button opens the window shown below.<br>
+<br>
+<img src="images/insert_image_window.gif" alt="Insert image dialog/window" /><br>
+<br>
+You simply enter a URL to the image you want to link to and enter a image description, 
+this is then displayed as an alternative text descripton of the image on the page.<br>
+<br>
+<strong>Field descriptions:</strong><br>
+<table border="1" cellspacing="0">
+  <tr>
+    <td width="150"><strong>Image URL </strong></td>
+    <td>URL/path to the image.</td>
+  </tr>
+  <tr>
+    <td width="150"><strong>Image description </strong></td>
+    <td>Alternative description of image contents.</td>
+  </tr>
+  <tr>
+    <td><strong>Dimentions</strong></td>
+    <td>Image width/height. </td>
+  </tr>
+  <tr>
+    <td><strong>Alignment</strong></td>
+    <td>Image alignment, useful when wrapping text around images.</td>
+  </tr>
+  <tr>
+    <td><strong>Border</strong></td>
+    <td>Border thickness. </td>
+  </tr>
+  <tr>
+    <td><strong>VSpace</strong></td>
+    <td>Vertical space, useful when wrapping text around images.</td>
+  </tr>
+  <tr>
+    <td><strong>HSpace</strong></td>
+    <td>Horizontal space, useful when wrapping text around images.</td>
+  </tr>
+</table>
+<br>
+<hr noshade>
+<table width="100%" border="0" cellpadding="1" cellspacing="3" class="pagefooter">
+  <tr> 
+    <td>Go to: <a href="index.htm">Table of contents</a></td>
+    <td align="right"><a href="#">Top</a></td>
+  </tr>
+</table>
+<br>
+</BODY>
+</HTML>
diff -x .svn -aruN 0.7.15.src/e107_handlers/tiny_mce/themes/advanced/docs/en/insert_link_button.htm 0.7.16.src/e107_handlers/tiny_mce/themes/advanced/docs/en/insert_link_button.htm
--- 0.7.15.src/e107_handlers/tiny_mce/themes/advanced/docs/en/insert_link_button.htm	1969-12-31 18:00:00.000000000 -0600
+++ 0.7.16.src/e107_handlers/tiny_mce/themes/advanced/docs/en/insert_link_button.htm	2009-07-06 15:33:56.000000000 -0500
@@ -0,0 +1,33 @@
+<html xmlns="http://www.w3.org/1999/xhtml">
+<HEAD>
+<TITLE>Insert link button</TITLE>
+<link href="style.css" rel="stylesheet" type="text/css">
+</HEAD>
+
+<BODY>
+
+<table width="100%" border="0" cellpadding="1" cellspacing="3" class="pageheader">
+  <tr> 
+    <td><span class="title">Insert link button</span></td>
+    <td align="right"><a href="index.htm"><acronym title="Table of contents">TOC</acronym></a></td>
+  </tr>
+</table>
+<hr noshade>
+<br>
+This button opens a new window with the insert/edit link function.<br>
+<br>
+<img src="images/insert_link_window.gif" width="330" height="159" alt="Insert link dialog/window" /><br>
+<br>
+There are two fields in this window the first one &quot;Link URL&quot; is the 
+URL of the link. The target enables you to select how the link is to be opened.<br>
+<br>
+<hr noshade>
+<table width="100%" border="0" cellpadding="1" cellspacing="3" class="pagefooter">
+  <tr> 
+    <td>Go to: <a href="index.htm">Table of contents</a></td>
+    <td align="right"><a href="#">Top</a></td>
+  </tr>
+</table>
+<br>
+</BODY>
+</HTML>
diff -x .svn -aruN 0.7.15.src/e107_handlers/tiny_mce/themes/advanced/docs/en/insert_table_button.htm 0.7.16.src/e107_handlers/tiny_mce/themes/advanced/docs/en/insert_table_button.htm
--- 0.7.15.src/e107_handlers/tiny_mce/themes/advanced/docs/en/insert_table_button.htm	1969-12-31 18:00:00.000000000 -0600
+++ 0.7.16.src/e107_handlers/tiny_mce/themes/advanced/docs/en/insert_table_button.htm	2009-07-06 15:33:56.000000000 -0500
@@ -0,0 +1,71 @@
+<html xmlns="http://www.w3.org/1999/xhtml">
+<HEAD>
+<TITLE>Insert table button</TITLE>
+<link href="style.css" rel="stylesheet" type="text/css">
+</HEAD>
+
+<BODY>
+
+<table width="100%" border="0" cellpadding="1" cellspacing="3" class="pageheader">
+  <tr> 
+    <td><span class="title">Insert table button</span></td>
+    <td align="right"><a href="index.htm"><acronym title="Table of contents">TOC</acronym></a></td>
+  </tr>
+</table>
+<hr noshade>
+<br>
+The insert table button opens the window shown below. This action enables you to create tables. <br>
+<br>
+<img src="images/insert_table_window.gif" width="340" height="229" alt="Image of table window" /><br>
+<br>
+<strong>Field descriptions:</strong><br>
+<table border="1" cellspacing="0">
+  <tr>
+    <td width="150"><strong>Columns</strong></td>
+    <td>Number of columns in the  table. </td>
+  </tr>
+  <tr>
+    <td width="150"><strong>Rows</strong></td>
+    <td>Number of rows in the new table.</td>
+  </tr>
+  <tr>
+    <td><strong>Cellpadding</strong></td>
+    <td>Cellpadding of the table . </td>
+  </tr>
+  <tr>
+    <td><strong>Cellspacing</strong></td>
+    <td>Cellspacing of the table .</td>
+  </tr>
+  <tr>
+    <td><strong>Alignment</strong></td>
+    <td>Table alignment . </td>
+  </tr>
+  <tr>
+    <td><strong>Border</strong></td>
+    <td>Border thinkness of table.</td>
+  </tr>
+  <tr>
+    <td><strong>Width</strong></td>
+    <td>Width in pixels of table .</td>
+  </tr>
+  <tr>
+    <td><strong>Height</strong></td>
+    <td>Height in pixels of table.</td>
+  </tr>
+  <tr>
+    <td><strong>Class</strong></td>
+    <td>Style or CSS class of table.</td>
+  </tr>
+</table>
+<br>
+<br>
+<hr noshade>
+<table width="100%" border="0" cellpadding="1" cellspacing="3" class="pagefooter">
+  <tr> 
+    <td>Go to: <a href="index.htm">Table of contents</a></td>
+    <td align="right"><a href="#">Top</a></td>
+  </tr>
+</table>
+<br>
+</BODY>
+</HTML>
diff -x .svn -aruN 0.7.15.src/e107_handlers/tiny_mce/themes/advanced/docs/en/style.css 0.7.16.src/e107_handlers/tiny_mce/themes/advanced/docs/en/style.css
--- 0.7.15.src/e107_handlers/tiny_mce/themes/advanced/docs/en/style.css	1969-12-31 18:00:00.000000000 -0600
+++ 0.7.16.src/e107_handlers/tiny_mce/themes/advanced/docs/en/style.css	2009-07-06 15:33:56.000000000 -0500
@@ -0,0 +1,28 @@
+body { background-color: #FFFFFF; }
+body, td, .content { font-family: Verdana, Arial, helvetica, sans-serif; font-size: 12px; }
+.title { font-family: Verdana, Arial, helvetica, sans-serif; font-size: 16px; font-weight: bold; }
+.subtitle { font-size: 12px; font-weight: bold; }
+
+.toc_ul, .toc_li { margin-left: 8px; line-height: 16px; }
+.step_ol, .step_li { margin-left: 11px; line-height: 16px; }
+img { border: #000000 solid 1px; }
+
+a:visited { color: #666666; text-decoration: underline; }
+a:active { color: #666666; text-decoration: underline; }
+a:hover { color: #666666; text-decoration: underline; }
+a { color: #666666; text-decoration: underline; }
+
+.pageheader { border: #E0E0E0 solid 1px; }
+.pagefooter { border: #E0E0E0 solid 1px; }
+.sample { background-color: #FFFFFF; border: #000000 solid 1px; }
+.samplecontent { font-size: 10px; }
+
+.code { background-color: #FFFFFF; border: #000000 solid 1px; }
+.codecontent { font-size: 10px; }
+.codecontent a:visited { color: #666666; text-decoration: none; font-weight: bold }
+.codecontent a:active { color: #666666; text-decoration: none; font-weight: bold  }
+.codecontent a:hover { color: #666666; text-decoration: none; font-weight: bold  }
+.codecontent a { color: #666666; text-decoration: none; font-weight: bold  }
+
+hr { height: 1px; }
+
diff -x .svn -aruN 0.7.15.src/e107_handlers/tiny_mce/themes/advanced/editor_template.js 0.7.16.src/e107_handlers/tiny_mce/themes/advanced/editor_template.js
--- 0.7.15.src/e107_handlers/tiny_mce/themes/advanced/editor_template.js	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_handlers/tiny_mce/themes/advanced/editor_template.js	2009-06-30 19:36:49.000000000 -0500
@@ -1 +1 @@
-tinyMCE.importThemeLanguagePack('advanced');var TinyMCE_AdvancedTheme={_defColors:"000000,993300,333300,003300,003366,000080,333399,333333,800000,FF6600,808000,008000,008080,0000FF,666699,808080,FF0000,FF9900,99CC00,339966,33CCCC,3366FF,800080,999999,FF00FF,FFCC00,FFFF00,00FF00,00FFFF,00CCFF,993366,C0C0C0,FF99CC,FFCC99,FFFF99,CCFFCC,CCFFFF,99CCFF,CC99FF,FFFFFF",_autoImportCSSClasses:true,_resizer:{},_buttons:[['bold','{$lang_bold_img}','lang_bold_desc','Bold'],['italic','{$lang_italic_img}','lang_italic_desc','Italic'],['underline','{$lang_underline_img}','lang_underline_desc','Underline'],['strikethrough','strikethrough.gif','lang_striketrough_desc','Strikethrough'],['justifyleft','justifyleft.gif','lang_justifyleft_desc','JustifyLeft'],['justifycenter','justifycenter.gif','lang_justifycenter_desc','JustifyCenter'],['justifyright','justifyright.gif','lang_justifyright_desc','JustifyRight'],['justifyfull','justifyfull.gif','lang_justifyfull_desc','JustifyFull'],['bullist','bullist.gif','lang_bullist_desc','InsertUnorderedList'],['numlist','numlist.gif','lang_numlist_desc','InsertOrderedList'],['outdent','outdent.gif','lang_outdent_desc','Outdent'],['indent','indent.gif','lang_indent_desc','Indent'],['cut','cut.gif','lang_cut_desc','Cut'],['copy','copy.gif','lang_copy_desc','Copy'],['paste','paste.gif','lang_paste_desc','Paste'],['undo','undo.gif','lang_undo_desc','Undo'],['redo','redo.gif','lang_redo_desc','Redo'],['link','link.gif','lang_link_desc','mceLink',true],['unlink','unlink.gif','lang_unlink_desc','unlink'],['image','image.gif','lang_image_desc','mceImage',true],['cleanup','cleanup.gif','lang_cleanup_desc','mceCleanup'],['help','help.gif','lang_help_desc','mceHelp'],['code','code.gif','lang_theme_code_desc','mceCodeEditor'],['hr','hr.gif','lang_theme_hr_desc','inserthorizontalrule'],['removeformat','removeformat.gif','lang_theme_removeformat_desc','removeformat'],['sub','sub.gif','lang_theme_sub_desc','subscript'],['sup','sup.gif','lang_theme_sup_desc','superscript'],['forecolor','forecolor.gif','lang_theme_forecolor_desc','forecolor',true],['backcolor','backcolor.gif','lang_theme_backcolor_desc','HiliteColor',true],['charmap','charmap.gif','lang_theme_charmap_desc','mceCharMap'],['visualaid','visualaid.gif','lang_theme_visualaid_desc','mceToggleVisualAid'],['anchor','anchor.gif','lang_theme_anchor_desc','mceInsertAnchor'],['newdocument','newdocument.gif','lang_newdocument_desc','mceNewDocument']],_buttonMap:'anchor,backcolor,bold,bullist,charmap,cleanup,code,copy,cut,forecolor,help,hr,image,indent,italic,justifycenter,justifyfull,justifyleft,justifyright,link,newdocument,numlist,outdent,paste,redo,removeformat,strikethrough,sub,sup,underline,undo,unlink,visualaid,advhr,ltr,rtl,emotions,flash,fullpage,fullscreen,iespell,insertdate,inserttime,pastetext,pasteword,selectall,preview,print,save,replace,search,table,cell_props,delete_col,delete_row,col_after,col_before,row_after,row_before,merge_cells,row_props,split_cells,delete_table',getControlHTML:function(button_name){var i,x,but;for(i=0;i<TinyMCE_AdvancedTheme._buttons.length;i++){but=TinyMCE_AdvancedTheme._buttons[i];if(but[0]==button_name&&(button_name=="forecolor"||button_name=="backcolor"))return tinyMCE.getMenuButtonHTML(but[0],but[2],'{$themeurl}/images/'+but[1],but[3]+"Menu",but[3],(but.length>4?but[4]:false),(but.length>5?but[5]:null));if(but[0]==button_name)return tinyMCE.getButtonHTML(but[0],but[2],'{$themeurl}/images/'+but[1],but[3],(but.length>4?but[4]:false),(but.length>5?but[5]:null))}switch(button_name){case"formatselect":var html='<select id="{$editor_id}_formatSelect" name="{$editor_id}_formatSelect" onfocus="tinyMCE.addSelectAccessibility(event, this, window);" onchange="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'FormatBlock\',false,this.options[this.selectedIndex].value);" class="mceSelectList">';var formats=tinyMCE.getParam("theme_advanced_blockformats","p,address,pre,h1,h2,h3,h4,h5,h6",true).split(',');var lookup=[['p','{$lang_theme_paragraph}'],['address','{$lang_theme_address}'],['pre','{$lang_theme_pre}'],['h1','{$lang_theme_h1}'],['h2','{$lang_theme_h2}'],['h3','{$lang_theme_h3}'],['h4','{$lang_theme_h4}'],['h5','{$lang_theme_h5}'],['h6','{$lang_theme_h6}'],['div','{$lang_theme_div}'],['blockquote','{$lang_theme_blockquote}'],['code','{$lang_theme_code}'],['dt','{$lang_theme_dt}'],['dd','{$lang_theme_dd}'],['samp','{$lang_theme_samp}']];html+='<option value="">{$lang_theme_block}</option>';for(var i=0;i<formats.length;i++){for(var x=0;x<lookup.length;x++){if(formats[i]==lookup[x][0])html+='<option value="&lt;'+lookup[x][0]+'&gt;">'+lookup[x][1]+'</option>'}}html+='</select>';return html;case"styleselect":return'<select id="{$editor_id}_styleSelect" onmousedown="tinyMCE.themes.advanced._setupCSSClasses(\'{$editor_id}\');" name="{$editor_id}_styleSelect" onfocus="tinyMCE.addSelectAccessibility(event,this,window);" onchange="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'mceSetCSSClass\',false,this.options[this.selectedIndex].value);" class="mceSelectList">{$style_select_options}</select>';case"fontselect":var fontHTML='<select id="{$editor_id}_fontNameSelect" name="{$editor_id}_fontNameSelect" onfocus="tinyMCE.addSelectAccessibility(event, this, window);" onchange="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'FontName\',false,this.options[this.selectedIndex].value);" class="mceSelectList"><option value="">{$lang_theme_fontdefault}</option>';var iFonts='Arial=arial,helvetica,sans-serif;Courier New=courier new,courier,monospace;Georgia=georgia,times new roman,times,serif;Tahoma=tahoma,arial,helvetica,sans-serif;Times New Roman=times new roman,times,serif;Verdana=verdana,arial,helvetica,sans-serif;Impact=impact;WingDings=wingdings';var nFonts='Andale Mono=andale mono,times;Arial=arial,helvetica,sans-serif;Arial Black=arial black,avant garde;Book Antiqua=book antiqua,palatino;Comic Sans MS=comic sans ms,sand;Courier New=courier new,courier;Georgia=georgia,palatino;Helvetica=helvetica;Impact=impact,chicago;Symbol=symbol;Tahoma=tahoma,arial,helvetica,sans-serif;Terminal=terminal,monaco;Times New Roman=times new roman,times;Trebuchet MS=trebuchet ms,geneva;Verdana=verdana,geneva;Webdings=webdings;Wingdings=wingdings,zapf dingbats';var fonts=tinyMCE.getParam("theme_advanced_fonts",nFonts).split(';');for(i=0;i<fonts.length;i++){if(fonts[i]!=''){var parts=fonts[i].split('=');fontHTML+='<option value="'+parts[1]+'">'+parts[0]+'</option>'}}fontHTML+='</select>';return fontHTML;case"fontsizeselect":return'<select id="{$editor_id}_fontSizeSelect" name="{$editor_id}_fontSizeSelect" onfocus="tinyMCE.addSelectAccessibility(event, this, window);" onchange="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'FontSize\',false,this.options[this.selectedIndex].value);" class="mceSelectList">'+'<option value="0">{$lang_theme_font_size}</option>'+'<option value="1">1 (8 pt)</option>'+'<option value="2">2 (10 pt)</option>'+'<option value="3">3 (12 pt)</option>'+'<option value="4">4 (14 pt)</option>'+'<option value="5">5 (18 pt)</option>'+'<option value="6">6 (24 pt)</option>'+'<option value="7">7 (36 pt)</option>'+'</select>';case"|":case"separator":return'<img src="{$themeurl}/images/separator.gif" width="2" height="20" class="mceSeparatorLine" />';case"spacer":return'<img src="{$themeurl}/images/separator.gif" width="2" height="15" border="0" class="mceSeparatorLine" style="vertical-align: middle" />';case"rowseparator":return'<br />'}return""},execCommand:function(editor_id,element,command,user_interface,value){switch(command){case'mceHelp':tinyMCE.openWindow({file:'about.htm',width:480,height:380},{tinymce_version:tinyMCE.majorVersion+"."+tinyMCE.minorVersion,tinymce_releasedate:tinyMCE.releaseDate,inline:"yes"});return true;case"mceLink":var inst=tinyMCE.getInstanceById(editor_id);var doc=inst.getDoc();var selectedText="";if(tinyMCE.isMSIE){var rng=doc.selection.createRange();selectedText=rng.text}else selectedText=inst.getSel().toString();if(!tinyMCE.linkElement){if((tinyMCE.selectedElement.nodeName.toLowerCase()!="img")&&(selectedText.length<=0))return true}var href="",target="",title="",onclick="",action="insert",style_class="";if(tinyMCE.selectedElement.nodeName.toLowerCase()=="a")tinyMCE.linkElement=tinyMCE.selectedElement;if(tinyMCE.linkElement!=null&&tinyMCE.getAttrib(tinyMCE.linkElement,'href')=="")tinyMCE.linkElement=null;if(tinyMCE.linkElement){href=tinyMCE.getAttrib(tinyMCE.linkElement,'href');target=tinyMCE.getAttrib(tinyMCE.linkElement,'target');title=tinyMCE.getAttrib(tinyMCE.linkElement,'title');onclick=tinyMCE.getAttrib(tinyMCE.linkElement,'onclick');style_class=tinyMCE.getAttrib(tinyMCE.linkElement,'class');if(onclick=="")onclick=tinyMCE.getAttrib(tinyMCE.linkElement,'onclick');onclick=tinyMCE.cleanupEventStr(onclick);href=eval(tinyMCE.settings['urlconverter_callback']+"(href, tinyMCE.linkElement, true);");mceRealHref=tinyMCE.getAttrib(tinyMCE.linkElement,'mce_href');if(mceRealHref!=""){href=mceRealHref;if(tinyMCE.getParam('convert_urls'))href=eval(tinyMCE.settings['urlconverter_callback']+"(href, tinyMCE.linkElement, true);")}action="update"}var template=new Array();template['file']='link.htm';template['width']=310;template['height']=200;template['width']+=tinyMCE.getLang('lang_insert_link_delta_width',0);template['height']+=tinyMCE.getLang('lang_insert_link_delta_height',0);if(inst.settings['insertlink_callback']){var returnVal=eval(inst.settings['insertlink_callback']+"(href, target, title, onclick, action, style_class);");if(returnVal&&returnVal['href'])TinyMCE_AdvancedTheme._insertLink(returnVal['href'],returnVal['target'],returnVal['title'],returnVal['onclick'],returnVal['style_class'])}else{tinyMCE.openWindow(template,{href:href,target:target,title:title,onclick:onclick,action:action,className:style_class,inline:"yes"})}return true;case"mceImage":var src="",alt="",border="",hspace="",vspace="",width="",height="",align="";var title="",onmouseover="",onmouseout="",action="insert";var img=tinyMCE.imgElement;var inst=tinyMCE.getInstanceById(editor_id);if(tinyMCE.selectedElement!=null&&tinyMCE.selectedElement.nodeName.toLowerCase()=="img"){img=tinyMCE.selectedElement;tinyMCE.imgElement=img}if(img){if(tinyMCE.getAttrib(img,'name').indexOf('mce_')==0)return true;src=tinyMCE.getAttrib(img,'src');alt=tinyMCE.getAttrib(img,'alt');if(alt=="")alt=tinyMCE.getAttrib(img,'title');if(tinyMCE.isGecko){var w=img.style.width;if(w!=null&&w!="")img.setAttribute("width",w);var h=img.style.height;if(h!=null&&h!="")img.setAttribute("height",h)}border=tinyMCE.getAttrib(img,'border');hspace=tinyMCE.getAttrib(img,'hspace');vspace=tinyMCE.getAttrib(img,'vspace');width=tinyMCE.getAttrib(img,'width');height=tinyMCE.getAttrib(img,'height');align=tinyMCE.getAttrib(img,'align');onmouseover=tinyMCE.getAttrib(img,'onmouseover');onmouseout=tinyMCE.getAttrib(img,'onmouseout');title=tinyMCE.getAttrib(img,'title');if(tinyMCE.isMSIE){width=img.attributes['width'].specified?width:"";height=img.attributes['height'].specified?height:""}src=eval(tinyMCE.settings['urlconverter_callback']+"(src, img, true);");mceRealSrc=tinyMCE.getAttrib(img,'mce_src');if(mceRealSrc!=""){src=mceRealSrc;if(tinyMCE.getParam('convert_urls'))src=eval(tinyMCE.settings['urlconverter_callback']+"(src, img, true);")}action="update"}var template=new Array();template['file']='image.htm?src={$src}';template['width']=355;template['height']=265+(tinyMCE.isMSIE?25:0);template['width']+=tinyMCE.getLang('lang_insert_image_delta_width',0);template['height']+=tinyMCE.getLang('lang_insert_image_delta_height',0);if(inst.settings['insertimage_callback']){var returnVal=eval(inst.settings['insertimage_callback']+"(src, alt, border, hspace, vspace, width, height, align, title, onmouseover, onmouseout, action);");if(returnVal&&returnVal['src'])TinyMCE_AdvancedTheme._insertImage(returnVal['src'],returnVal['alt'],returnVal['border'],returnVal['hspace'],returnVal['vspace'],returnVal['width'],returnVal['height'],returnVal['align'],returnVal['title'],returnVal['onmouseover'],returnVal['onmouseout'])}else tinyMCE.openWindow(template,{src:src,alt:alt,border:border,hspace:hspace,vspace:vspace,width:width,height:height,align:align,title:title,onmouseover:onmouseover,onmouseout:onmouseout,action:action,inline:"yes"});return true;case"forecolor":var fcp=new TinyMCE_Layer(editor_id+'_fcPreview',false),p,img,elm;TinyMCE_AdvancedTheme._hideMenus(editor_id);if(!fcp.exists()){fcp.create('div','mceColorPreview',document.getElementById(editor_id+'_toolbar'));elm=fcp.getElement();elm._editor_id=editor_id;elm._command="forecolor";elm._switchId=editor_id+"_forecolor";tinyMCE.addEvent(elm,'click',TinyMCE_AdvancedTheme._handleMenuEvent);tinyMCE.addEvent(elm,'mouseover',TinyMCE_AdvancedTheme._handleMenuEvent);tinyMCE.addEvent(elm,'mouseout',TinyMCE_AdvancedTheme._handleMenuEvent)}img=tinyMCE.selectNodes(document.getElementById(editor_id+"_forecolor"),function(n){return n.nodeName=="IMG"})[0];p=tinyMCE.getAbsPosition(img,document.getElementById(editor_id+'_toolbar'));fcp.moveTo(p.absLeft,p.absTop);fcp.getElement().style.backgroundColor=value!=null?value:tinyMCE.getInstanceById(editor_id).foreColor;fcp.show();return false;case"forecolorMenu":TinyMCE_AdvancedTheme._hideMenus(editor_id);var ml=new TinyMCE_Layer(editor_id+'_fcMenu');if(!ml.exists())ml.create('div','mceMenu',document.body,TinyMCE_AdvancedTheme._getColorHTML(editor_id,'theme_advanced_text_colors','forecolor'));tinyMCE.switchClass(editor_id+'_forecolor','mceMenuButtonFocus');ml.moveRelativeTo(document.getElementById(editor_id+"_forecolor"),'bl');ml.moveBy(tinyMCE.isMSIE&&!tinyMCE.isOpera?-1:1,-1);if(tinyMCE.isOpera)ml.moveBy(0,-2);ml.show();return true;case"HiliteColor":var bcp=new TinyMCE_Layer(editor_id+'_bcPreview',false),p,img;TinyMCE_AdvancedTheme._hideMenus(editor_id);if(!bcp.exists()){bcp.create('div','mceColorPreview',document.getElementById(editor_id+'_toolbar'));elm=bcp.getElement();elm._editor_id=editor_id;elm._command="HiliteColor";elm._switchId=editor_id+"_backcolor";tinyMCE.addEvent(elm,'click',TinyMCE_AdvancedTheme._handleMenuEvent);tinyMCE.addEvent(elm,'mouseover',TinyMCE_AdvancedTheme._handleMenuEvent);tinyMCE.addEvent(elm,'mouseout',TinyMCE_AdvancedTheme._handleMenuEvent)}img=tinyMCE.selectNodes(document.getElementById(editor_id+"_backcolor"),function(n){return n.nodeName=="IMG"})[0];p=tinyMCE.getAbsPosition(img,document.getElementById(editor_id+'_toolbar'));bcp.moveTo(p.absLeft,p.absTop);bcp.getElement().style.backgroundColor=value!=null?value:tinyMCE.getInstanceById(editor_id).backColor;bcp.show();return false;case"HiliteColorMenu":TinyMCE_AdvancedTheme._hideMenus(editor_id);var ml=new TinyMCE_Layer(editor_id+'_bcMenu');if(!ml.exists())ml.create('div','mceMenu',document.body,TinyMCE_AdvancedTheme._getColorHTML(editor_id,'theme_advanced_background_colors','HiliteColor'));tinyMCE.switchClass(editor_id+'_backcolor','mceMenuButtonFocus');ml.moveRelativeTo(document.getElementById(editor_id+"_backcolor"),'bl');ml.moveBy(tinyMCE.isMSIE&&!tinyMCE.isOpera?-1:1,-1);if(tinyMCE.isOpera)ml.moveBy(0,-2);ml.show();return true;case"mceColorPicker":if(user_interface){var template=new Array();var inputColor=value['document'].getElementById(value['element_id']).value;template['file']='color_picker.htm';template['width']=220;template['height']=190;template['close_previous']="no";template['width']+=tinyMCE.getLang('lang_theme_advanced_colorpicker_delta_width',0);template['height']+=tinyMCE.getLang('lang_theme_advanced_colorpicker_delta_height',0);if(typeof(value['store_selection'])=="undefined")value['store_selection']=true;tinyMCE.lastColorPickerValue=value;tinyMCE.openWindow(template,{editor_id:editor_id,mce_store_selection:value['store_selection'],inline:"yes",command:"mceColorPicker",input_color:inputColor})}else{var savedVal=tinyMCE.lastColorPickerValue;var elm=savedVal['document'].getElementById(savedVal['element_id']);elm.value=value;if(elm.onchange!=null&&elm.onchange!='')eval('elm.onchange();')}return true;case"mceCodeEditor":var template=new Array();template['file']='source_editor.htm';template['width']=parseInt(tinyMCE.getParam("theme_advanced_source_editor_width",720));template['height']=parseInt(tinyMCE.getParam("theme_advanced_source_editor_height",580));tinyMCE.openWindow(template,{editor_id:editor_id,resizable:"yes",scrollbars:"no",inline:"yes"});return true;case"mceCharMap":var template=new Array();template['file']='charmap.htm';template['width']=550+(tinyMCE.isOpera?40:0);template['height']=250;template['width']+=tinyMCE.getLang('lang_theme_advanced_charmap_delta_width',0);template['height']+=tinyMCE.getLang('lang_theme_advanced_charmap_delta_height',0);tinyMCE.openWindow(template,{editor_id:editor_id,inline:"yes"});return true;case"mceInsertAnchor":var template=new Array();template['file']='anchor.htm';template['width']=320;template['height']=90+(tinyMCE.isNS7?30:0);template['width']+=tinyMCE.getLang('lang_theme_advanced_anchor_delta_width',0);template['height']+=tinyMCE.getLang('lang_theme_advanced_anchor_delta_height',0);tinyMCE.openWindow(template,{editor_id:editor_id,inline:"yes"});return true;case"mceNewDocument":if(confirm(tinyMCE.getLang('lang_newdocument')))tinyMCE.execInstanceCommand(editor_id,'mceSetContent',false,' ');return true}return false},getEditorTemplate:function(settings,editorId){function removeFromArray(in_array,remove_array){var outArray=new Array(),skip;for(var i=0;i<in_array.length;i++){skip=false;for(var j=0;j<remove_array.length;j++){if(in_array[i]==remove_array[j]){skip=true}}if(!skip){outArray[outArray.length]=in_array[i]}}return outArray}function addToArray(in_array,add_array){for(var i=0;i<add_array.length;i++){in_array[in_array.length]=add_array[i]}return in_array}var template=new Array();var deltaHeight=0;var resizing=tinyMCE.getParam("theme_advanced_resizing",false);var path=tinyMCE.getParam("theme_advanced_path",true);var statusbarHTML='<div id="{$editor_id}_path" class="mceStatusbarPathText" style="display: '+(path?"block":"none")+'">&#160;</div><div id="{$editor_id}_resize" class="mceStatusbarResize" style="display: '+(resizing?"block":"none")+'" onmousedown="tinyMCE.themes.advanced._setResizing(event,\'{$editor_id}\',true);"></div><br style="clear: both" />';var layoutManager=tinyMCE.getParam("theme_advanced_layout_manager","SimpleLayout");var styleSelectHTML='<option value="">{$lang_theme_style_select}</option>';if(settings['theme_advanced_styles']){var stylesAr=settings['theme_advanced_styles'].split(';');for(var i=0;i<stylesAr.length;i++){var key,value;key=stylesAr[i].split('=')[0];value=stylesAr[i].split('=')[1];styleSelectHTML+='<option value="'+value+'">'+key+'</option>'}TinyMCE_AdvancedTheme._autoImportCSSClasses=false}switch(layoutManager){case"SimpleLayout":var toolbarHTML="";var toolbarLocation=tinyMCE.getParam("theme_advanced_toolbar_location","bottom");var toolbarAlign=tinyMCE.getParam("theme_advanced_toolbar_align","center");var pathLocation=tinyMCE.getParam("theme_advanced_path_location","none");var statusbarLocation=tinyMCE.getParam("theme_advanced_statusbar_location",pathLocation);var defVals={theme_advanced_buttons1:"bold,italic,underline,strikethrough,separator,justifyleft,justifycenter,justifyright,justifyfull,separator,styleselect,formatselect",theme_advanced_buttons2:"bullist,numlist,separator,outdent,indent,separator,undo,redo,separator,link,unlink,anchor,image,cleanup,help,code",theme_advanced_buttons3:"hr,removeformat,visualaid,separator,sub,sup,separator,charmap"};toolbarHTML+='<a href="#" accesskey="q" title="'+tinyMCE.getLang("lang_toolbar_focus")+'"';if(!tinyMCE.getParam("accessibility_focus"))toolbarHTML+=' onfocus="tinyMCE.getInstanceById(\''+editorId+'\').getWin().focus();"';toolbarHTML+='></a>';for(var i=1;i<100;i++){var def=defVals["theme_advanced_buttons"+i];var buttons=tinyMCE.getParam("theme_advanced_buttons"+i,def==null?'':def,true,',');if(buttons.length==0)break;buttons=removeFromArray(buttons,tinyMCE.getParam("theme_advanced_disable","",true,','));buttons=addToArray(buttons,tinyMCE.getParam("theme_advanced_buttons"+i+"_add","",true,','));buttons=addToArray(tinyMCE.getParam("theme_advanced_buttons"+i+"_add_before","",true,','),buttons);for(var b=0;b<buttons.length;b++)toolbarHTML+=tinyMCE.getControlHTML(buttons[b]);if(buttons.length>0){toolbarHTML+="<br />";deltaHeight-=23}}toolbarHTML+='<a href="#" accesskey="z" onfocus="tinyMCE.getInstanceById(\''+editorId+'\').getWin().focus();"></a>';template['html']='<table class="mceEditor" border="0" cellpadding="0" cellspacing="0" width="{$width}" height="{$height}" style="width:{$width_style};height:{$height_style}"><tbody>';if(toolbarLocation=="top"){template['html']+='<tr><td class="mceToolbarTop" align="'+toolbarAlign+'" height="1" nowrap="nowrap"><span id="'+editorId+'_toolbar" class="mceToolbarContainer">'+toolbarHTML+'</span></td></tr>'}if(statusbarLocation=="top"){template['html']+='<tr><td class="mceStatusbarTop" height="1">'+statusbarHTML+'</td></tr>';deltaHeight-=23}template['html']+='<tr><td align="center"><span id="{$editor_id}"></span></td></tr>';if(toolbarLocation=="bottom"){template['html']+='<tr><td class="mceToolbarBottom" align="'+toolbarAlign+'" height="1"><span id="'+editorId+'_toolbar" class="mceToolbarContainer">'+toolbarHTML+'</span></td></tr>'}if(toolbarLocation=="external"){var bod=document.body;var elm=document.createElement("div");toolbarHTML=tinyMCE.replaceVar(toolbarHTML,'style_select_options',styleSelectHTML);toolbarHTML=tinyMCE.applyTemplate(toolbarHTML,{editor_id:editorId});elm.className="mceToolbarExternal";elm.id=editorId+"_toolbar";elm.innerHTML='<table width="100%" border="0" align="center"><tr><td align="center">'+toolbarHTML+'</td></tr></table>';bod.appendChild(elm);deltaHeight=0;tinyMCE.getInstanceById(editorId).toolbarElement=elm;}else{tinyMCE.getInstanceById(editorId).toolbarElement=null}if(statusbarLocation=="bottom"){template['html']+='<tr><td class="mceStatusbarBottom" height="1">'+statusbarHTML+'</td></tr>';deltaHeight-=23}template['html']+='</tbody></table>';break;case"RowLayout":template['html']='<table class="mceEditor" border="0" cellpadding="0" cellspacing="0" width="{$width}" height="{$height}" style="width:{$width}px;height:{$height}px"><tbody>';var containers=tinyMCE.getParam("theme_advanced_containers","",true,",");var defaultContainerCSS=tinyMCE.getParam("theme_advanced_containers_default_class","container");var defaultContainerAlign=tinyMCE.getParam("theme_advanced_containers_default_align","center");for(var i=0;i<containers.length;i++){if(containers[i]=="mceEditor")template['html']+='<tr><td align="center" class="mceEditor_border"><span id="{$editor_id}"></span></td></tr>';else if(containers[i]=="mceElementpath"||containers[i]=="mceStatusbar"){var pathClass="mceStatusbar";if(i==containers.length-1){pathClass="mceStatusbarBottom"}else if(i==0){pathClass="mceStatusbar"}else{deltaHeight-=2}template['html']+='<tr><td class="'+pathClass+'" height="1">'+statusbarHTML+'</td></tr>';deltaHeight-=22}else{var curContainer=tinyMCE.getParam("theme_advanced_container_"+containers[i],"",true,',');var curContainerHTML="";var curAlign=tinyMCE.getParam("theme_advanced_container_"+containers[i]+"_align",defaultContainerAlign);var curCSS=tinyMCE.getParam("theme_advanced_container_"+containers[i]+"_class",defaultContainerCSS);curContainer=removeFromArray(curContainer,tinyMCE.getParam("theme_advanced_disable","",true,','));for(var j=0;j<curContainer.length;j++)curContainerHTML+=tinyMCE.getControlHTML(curContainer[j]);if(curContainer.length>0){curContainerHTML+="<br />";deltaHeight-=23}template['html']+='<tr><td class="'+curCSS+'" align="'+curAlign+'" height="1">'+curContainerHTML+'</td></tr>'}}template['html']+='</tbody></table>';break;case"CustomLayout":var customLayout=tinyMCE.getParam("theme_advanced_custom_layout","");if(customLayout!=""&&eval("typeof("+customLayout+")")!="undefined"){template=eval(customLayout+"(template);")}break}if(resizing)template['html']+='<span id="{$editor_id}_resize_box" class="mceResizeBox"></span>';template['html']=tinyMCE.replaceVar(template['html'],'style_select_options',styleSelectHTML);template['delta_width']=0;template['delta_height']=deltaHeight;return template},initInstance:function(inst){if(tinyMCE.getParam("theme_advanced_resizing",false)){if(tinyMCE.getParam("theme_advanced_resizing_use_cookie",true)){var w=TinyMCE_AdvancedTheme._getCookie("TinyMCE_"+inst.editorId+"_width");var h=TinyMCE_AdvancedTheme._getCookie("TinyMCE_"+inst.editorId+"_height");TinyMCE_AdvancedTheme._resizeTo(inst,w,h,tinyMCE.getParam("theme_advanced_resize_horizontal",true))}}inst.addShortcut('ctrl','k','lang_link_desc','mceLink')},_handleMenuEvent:function(e){var te=tinyMCE.isMSIE?window.event.srcElement:e.target;tinyMCE._menuButtonEvent(e.type=="mouseover"?"over":"out",document.getElementById(te._switchId));if(e.type=="click")tinyMCE.execInstanceCommand(te._editor_id,te._command)},_hideMenus:function(id){var fcml=new TinyMCE_Layer(id+'_fcMenu'),bcml=new TinyMCE_Layer(id+'_bcMenu');if(fcml.exists()&&fcml.isVisible()){tinyMCE.switchClass(id+'_forecolor','mceMenuButton');fcml.hide()}if(bcml.exists()&&bcml.isVisible()){tinyMCE.switchClass(id+'_backcolor','mceMenuButton');bcml.hide()}},handleNodeChange:function(editor_id,node,undo_index,undo_levels,visual_aid,any_selection,setup_content){var alignNode,breakOut,classNode;function selectByValue(select_elm,value,first_index){first_index=typeof(first_index)=="undefined"?false:true;if(select_elm){for(var i=0;i<select_elm.options.length;i++){var ov=""+select_elm.options[i].value;if(first_index&&ov.toLowerCase().indexOf(value.toLowerCase())==0){select_elm.selectedIndex=i;return true}if(ov==value){select_elm.selectedIndex=i;return true}}}return false};function getAttrib(elm,name){return elm.getAttribute(name)?elm.getAttribute(name):""};if(node==null)return;var pathElm=document.getElementById(editor_id+"_path");var inst=tinyMCE.getInstanceById(editor_id);var doc=inst.getDoc();TinyMCE_AdvancedTheme._hideMenus(editor_id);if(pathElm){var parentNode=node;var path=new Array();while(parentNode!=null){if(parentNode.nodeName.toUpperCase()=="BODY"){break}if(parentNode.nodeType==1&&tinyMCE.getAttrib(parentNode,"class").indexOf('mceItemHidden')==-1){path[path.length]=parentNode}parentNode=parentNode.parentNode}var html="";for(var i=path.length-1;i>=0;i--){var nodeName=path[i].nodeName.toLowerCase();var nodeData="";if(nodeName.indexOf("html:")==0)nodeName=nodeName.substring(5);if(nodeName=="b"){nodeName="strong"}if(nodeName=="i"){nodeName="em"}if(nodeName=="span"){var cn=tinyMCE.getAttrib(path[i],"class");if(cn!=""&&cn.indexOf('mceItem')==-1)nodeData+="class: "+cn+" ";var st=tinyMCE.getAttrib(path[i],"style");if(st!=""){st=tinyMCE.serializeStyle(tinyMCE.parseStyle(st));nodeData+="style: "+st+" "}}if(nodeName=="font"){if(tinyMCE.getParam("convert_fonts_to_spans"))nodeName="span";var face=tinyMCE.getAttrib(path[i],"face");if(face!="")nodeData+="font: "+face+" ";var size=tinyMCE.getAttrib(path[i],"size");if(size!="")nodeData+="size: "+size+" ";var color=tinyMCE.getAttrib(path[i],"color");if(color!="")nodeData+="color: "+color+" "}if(getAttrib(path[i],'id')!=""){nodeData+="id: "+path[i].getAttribute('id')+" "}var className=tinyMCE.getVisualAidClass(tinyMCE.getAttrib(path[i],"class"),false);if(className!=""&&className.indexOf('mceItem')==-1)nodeData+="class: "+className+" ";if(getAttrib(path[i],'src')!=""){var src=tinyMCE.getAttrib(path[i],"mce_src");if(src=="")src=tinyMCE.getAttrib(path[i],"src");nodeData+="src: "+src+" "}if(path[i].nodeName=='A'&&getAttrib(path[i],'href')!=""){var href=tinyMCE.getAttrib(path[i],"mce_href");if(href=="")href=tinyMCE.getAttrib(path[i],"href");nodeData+="href: "+href+" "}className=tinyMCE.getAttrib(path[i],"class");if((nodeName=="img"||nodeName=="span")&&className.indexOf('mceItem')!=-1){nodeName=className.replace(/mceItem([a-z]+)/gi,'$1').toLowerCase();nodeData=path[i].getAttribute('title')}if(nodeName=="a"&&(anchor=tinyMCE.getAttrib(path[i],"name"))!=""){nodeName="a";nodeName+="#"+anchor;nodeData=""}if(getAttrib(path[i],'name').indexOf("mce_")!=0){var className=tinyMCE.getVisualAidClass(tinyMCE.getAttrib(path[i],"class"),false);if(className!=""&&className.indexOf('mceItem')==-1){nodeName+="."+className}}var cmd='tinyMCE.execInstanceCommand(\''+editor_id+'\',\'mceSelectNodeDepth\',false,\''+i+'\');';html+='<a title="'+nodeData+'" href="javascript:'+cmd+'" onclick="'+cmd+'return false;" onmousedown="return false;" target="_self" class="mcePathItem">'+nodeName+'</a>';if(i>0){html+=" &raquo; "}}pathElm.innerHTML='<a href="#" accesskey="x"></a>'+tinyMCE.getLang('lang_theme_path')+": "+html+'&#160;'}tinyMCE.switchClass(editor_id+'_justifyleft','mceButtonNormal');tinyMCE.switchClass(editor_id+'_justifyright','mceButtonNormal');tinyMCE.switchClass(editor_id+'_justifycenter','mceButtonNormal');tinyMCE.switchClass(editor_id+'_justifyfull','mceButtonNormal');tinyMCE.switchClass(editor_id+'_bold','mceButtonNormal');tinyMCE.switchClass(editor_id+'_italic','mceButtonNormal');tinyMCE.switchClass(editor_id+'_underline','mceButtonNormal');tinyMCE.switchClass(editor_id+'_strikethrough','mceButtonNormal');tinyMCE.switchClass(editor_id+'_bullist','mceButtonNormal');tinyMCE.switchClass(editor_id+'_numlist','mceButtonNormal');tinyMCE.switchClass(editor_id+'_sub','mceButtonNormal');tinyMCE.switchClass(editor_id+'_sup','mceButtonNormal');tinyMCE.switchClass(editor_id+'_anchor','mceButtonNormal');tinyMCE.switchClass(editor_id+'_link','mceButtonDisabled');tinyMCE.switchClass(editor_id+'_unlink','mceButtonDisabled');tinyMCE.switchClass(editor_id+'_outdent','mceButtonDisabled');tinyMCE.switchClass(editor_id+'_image','mceButtonNormal');tinyMCE.switchClass(editor_id+'_hr','mceButtonNormal');if(node.nodeName=="A"&&tinyMCE.getAttrib(node,"class").indexOf('mceItemAnchor')!=-1)tinyMCE.switchClass(editor_id+'_anchor','mceButtonSelected');var anchorLink=tinyMCE.getParentElement(node,"a","href");if(anchorLink||any_selection){tinyMCE.switchClass(editor_id+'_link',anchorLink?'mceButtonSelected':'mceButtonNormal');tinyMCE.switchClass(editor_id+'_unlink',anchorLink?'mceButtonSelected':'mceButtonNormal')}tinyMCE.switchClass(editor_id+'_visualaid',visual_aid?'mceButtonSelected':'mceButtonNormal');if(undo_levels!=-1){tinyMCE.switchClass(editor_id+'_undo','mceButtonDisabled');tinyMCE.switchClass(editor_id+'_redo','mceButtonDisabled')}if(tinyMCE.getParentElement(node,"li,blockquote"))tinyMCE.switchClass(editor_id+'_outdent','mceButtonNormal');if(undo_index!=-1&&(undo_index<undo_levels-1&&undo_levels>0))tinyMCE.switchClass(editor_id+'_redo','mceButtonNormal');if(undo_index!=-1&&(undo_index>0&&undo_levels>0))tinyMCE.switchClass(editor_id+'_undo','mceButtonNormal');var selectElm=document.getElementById(editor_id+"_styleSelect");if(selectElm){TinyMCE_AdvancedTheme._setupCSSClasses(editor_id);classNode=node;breakOut=false;var index=0;do{if(classNode&&classNode.className){for(var i=0;i<selectElm.options.length;i++){if(selectElm.options[i].value==classNode.className){index=i;breakOut=true;break}}}}while(!breakOut&&classNode!=null&&(classNode=classNode.parentNode)!=null);selectElm.selectedIndex=index}var selectElm=document.getElementById(editor_id+"_formatSelect");if(selectElm){var elm=tinyMCE.getParentElement(node,"p,div,h1,h2,h3,h4,h5,h6,pre,address");if(elm)selectByValue(selectElm,"<"+elm.nodeName.toLowerCase()+">");else selectByValue(selectElm,"")}var selectElm=document.getElementById(editor_id+"_fontNameSelect");if(selectElm){if(!tinyMCE.isSafari&&!(tinyMCE.isMSIE&&!tinyMCE.isOpera)){var face=inst.queryCommandValue('FontName');face=face==null||face==""?"":face;selectByValue(selectElm,face,face!="")}else{var elm=tinyMCE.getParentElement(node,"font","face");if(elm){var family=tinyMCE.getAttrib(elm,"face");if(family=='')family=''+elm.style.fontFamily;if(!selectByValue(selectElm,family,family!=""))selectByValue(selectElm,"")}else selectByValue(selectElm,"")}}var selectElm=document.getElementById(editor_id+"_fontSizeSelect");if(selectElm){if(!tinyMCE.isSafari&&!tinyMCE.isOpera){var size=inst.queryCommandValue('FontSize');selectByValue(selectElm,size==null||size==""?"0":size)}else{var elm=tinyMCE.getParentElement(node,"font","size");if(elm){var size=tinyMCE.getAttrib(elm,"size");if(size==''){var sizes=new Array('','8px','10px','12px','14px','18px','24px','36px');size=''+elm.style.fontSize;for(var i=0;i<sizes.length;i++){if((''+sizes[i])==size){size=i;break}}}if(!selectByValue(selectElm,size))selectByValue(selectElm,"")}else selectByValue(selectElm,"0")}}alignNode=node;breakOut=false;do{if(!alignNode.getAttribute||!alignNode.getAttribute('align'))continue;switch(alignNode.getAttribute('align').toLowerCase()){case"left":tinyMCE.switchClass(editor_id+'_justifyleft','mceButtonSelected');breakOut=true;break;case"right":tinyMCE.switchClass(editor_id+'_justifyright','mceButtonSelected');breakOut=true;break;case"middle":case"center":tinyMCE.switchClass(editor_id+'_justifycenter','mceButtonSelected');breakOut=true;break;case"justify":tinyMCE.switchClass(editor_id+'_justifyfull','mceButtonSelected');breakOut=true;break}}while(!breakOut&&(alignNode=alignNode.parentNode)!=null);var div=tinyMCE.getParentElement(node,"div");if(div&&div.style.textAlign=="center")tinyMCE.switchClass(editor_id+'_justifycenter','mceButtonSelected');if(!setup_content){var ar=new Array("Bold","_bold","Italic","_italic","Strikethrough","_strikethrough","superscript","_sup","subscript","_sub");for(var i=0;i<ar.length;i+=2){if(inst.queryCommandState(ar[i]))tinyMCE.switchClass(editor_id+ar[i+1],'mceButtonSelected')}if(inst.queryCommandState("Underline")&&(node.parentNode==null||node.parentNode.nodeName!="A"))tinyMCE.switchClass(editor_id+'_underline','mceButtonSelected')}do{switch(node.nodeName){case"UL":tinyMCE.switchClass(editor_id+'_bullist','mceButtonSelected');break;case"OL":tinyMCE.switchClass(editor_id+'_numlist','mceButtonSelected');break;case"HR":tinyMCE.switchClass(editor_id+'_hr','mceButtonSelected');break;case"IMG":if(getAttrib(node,'name').indexOf('mce_')!=0&&tinyMCE.getAttrib(node,'class').indexOf('mceItem')==-1){tinyMCE.switchClass(editor_id+'_image','mceButtonSelected')}break}}while((node=node.parentNode)!=null)},_setupCSSClasses:function(editor_id){var i,selectElm;if(!TinyMCE_AdvancedTheme._autoImportCSSClasses)return;selectElm=document.getElementById(editor_id+'_styleSelect');if(selectElm&&selectElm.getAttribute('cssImported')!='true'){var csses=tinyMCE.getCSSClasses(editor_id);if(csses&&selectElm){for(i=0;i<csses.length;i++)selectElm.options[selectElm.options.length]=new Option(csses[i],csses[i])}if(csses!=null&&csses.length>0)selectElm.setAttribute('cssImported','true')}},_setCookie:function(name,value,expires,path,domain,secure){var curCookie=name+"="+escape(value)+((expires)?"; expires="+expires.toGMTString():"")+((path)?"; path="+escape(path):"")+((domain)?"; domain="+domain:"")+((secure)?"; secure":"");document.cookie=curCookie},_getCookie:function(name){var dc=document.cookie;var prefix=name+"=";var begin=dc.indexOf("; "+prefix);if(begin==-1){begin=dc.indexOf(prefix);if(begin!=0)return null}else begin+=2;var end=document.cookie.indexOf(";",begin);if(end==-1)end=dc.length;return unescape(dc.substring(begin+prefix.length,end))},_resizeTo:function(inst,w,h,set_w){var editorContainer=document.getElementById(inst.editorId+'_parent');var tableElm=editorContainer.firstChild;var iframe=inst.iframeElement;if(w==null||w=="null"){set_w=false;w=0}if(h==null||h=="null")return;w=parseInt(w);h=parseInt(h);if(tinyMCE.isGecko){w+=2;h+=2}var dx=w-tableElm.clientWidth;var dy=h-tableElm.clientHeight;w=w<1?30:w;h=h<1?30:h;if(set_w)tableElm.style.width=w+"px";tableElm.style.height=h+"px";iw=iframe.clientWidth+dx;ih=iframe.clientHeight+dy;iw=iw<1?30:iw;ih=ih<1?30:ih;if(tinyMCE.isGecko){iw-=2;ih-=2}if(set_w)iframe.style.width=iw+"px";iframe.style.height=ih+"px";if(set_w){var tableBodyElm=tableElm.firstChild;var minIframeWidth=tableBodyElm.scrollWidth;if(inst.iframeElement.clientWidth<minIframeWidth){dx=minIframeWidth-inst.iframeElement.clientWidth;inst.iframeElement.style.width=(iw+dx)+"px"}}inst.useCSS=false},_resizeEventHandler:function(e){var resizer=TinyMCE_AdvancedTheme._resizer;if(!resizer.resizing)return;e=typeof(e)=="undefined"?window.event:e;var dx=e.screenX-resizer.downX;var dy=e.screenY-resizer.downY;var resizeBox=resizer.resizeBox;var editorId=resizer.editorId;switch(e.type){case"mousemove":var w,h;w=resizer.width+dx;h=resizer.height+dy;w=w<1?1:w;h=h<1?1:h;if(resizer.horizontal)resizeBox.style.width=w+"px";resizeBox.style.height=h+"px";break;case"mouseup":TinyMCE_AdvancedTheme._setResizing(e,editorId,false);TinyMCE_AdvancedTheme._resizeTo(tinyMCE.getInstanceById(editorId),resizer.width+dx,resizer.height+dy,resizer.horizontal);if(tinyMCE.getParam("theme_advanced_resizing_use_cookie",true)){var expires=new Date();expires.setTime(expires.getTime()+3600000*24*30);TinyMCE_AdvancedTheme._setCookie("TinyMCE_"+editorId+"_width",""+(resizer.horizontal?resizer.width+dx:""),expires);TinyMCE_AdvancedTheme._setCookie("TinyMCE_"+editorId+"_height",""+(resizer.height+dy),expires)}break}},_setResizing:function(e,editor_id,state){e=typeof(e)=="undefined"?window.event:e;var resizer=TinyMCE_AdvancedTheme._resizer;var editorContainer=document.getElementById(editor_id+'_parent');var editorArea=document.getElementById(editor_id+'_parent').firstChild;var resizeBox=document.getElementById(editor_id+'_resize_box');var inst=tinyMCE.getInstanceById(editor_id);if(state){var width=editorArea.clientWidth;var height=editorArea.clientHeight;resizeBox.style.width=width+"px";resizeBox.style.height=height+"px";resizer.iframeWidth=inst.iframeElement.clientWidth;resizer.iframeHeight=inst.iframeElement.clientHeight;editorArea.style.display="none";resizeBox.style.display="block";if(!resizer.eventHandlers){if(tinyMCE.isMSIE)tinyMCE.addEvent(document,"mousemove",TinyMCE_AdvancedTheme._resizeEventHandler);else tinyMCE.addEvent(window,"mousemove",TinyMCE_AdvancedTheme._resizeEventHandler);tinyMCE.addEvent(document,"mouseup",TinyMCE_AdvancedTheme._resizeEventHandler);resizer.eventHandlers=true}resizer.resizing=true;resizer.downX=e.screenX;resizer.downY=e.screenY;resizer.width=parseInt(resizeBox.style.width);resizer.height=parseInt(resizeBox.style.height);resizer.editorId=editor_id;resizer.resizeBox=resizeBox;resizer.horizontal=tinyMCE.getParam("theme_advanced_resize_horizontal",true)}else{resizer.resizing=false;resizeBox.style.display="none";editorArea.style.display=tinyMCE.isMSIE&&!tinyMCE.isOpera?"block":"table";tinyMCE.execCommand('mceResetDesignMode')}},_getColorHTML:function(id,n,cm){var i,h,cl;h='<span class="mceMenuLine"></span>';cl=tinyMCE.getParam(n,TinyMCE_AdvancedTheme._defColors).split(',');h+='<table class="mceColors"><tr>';for(i=0;i<cl.length;i++){c='tinyMCE.execInstanceCommand(\''+id+'\', \''+cm+'\', false, \'#'+cl[i]+'\');';h+='<td><a href="javascript:'+c+'" style="background-color: #'+cl[i]+'" onclick="'+c+';return false;"></a></td>';if((i+1)%8==0)h+='</tr><tr>'}h+='</tr></table>';return h},_insertImage:function(src,alt,border,hspace,vspace,width,height,align,title,onmouseover,onmouseout){tinyMCE.execCommand('mceBeginUndoLevel');if(src=="")return;if(!tinyMCE.imgElement&&tinyMCE.isSafari){var html="";html+='<img src="'+src+'" alt="'+alt+'"';html+=' border="'+border+'" hspace="'+hspace+'"';html+=' vspace="'+vspace+'" width="'+width+'"';html+=' height="'+height+'" align="'+align+'" title="'+title+'" onmouseover="'+onmouseover+'" onmouseout="'+onmouseout+'" />';tinyMCE.execCommand("mceInsertContent",false,html)}else{if(!tinyMCE.imgElement&&tinyMCE.selectedInstance){if(tinyMCE.isSafari)tinyMCE.execCommand("mceInsertContent",false,'<img src="'+tinyMCE.uniqueURL+'" />');else tinyMCE.selectedInstance.contentDocument.execCommand("insertimage",false,tinyMCE.uniqueURL);tinyMCE.imgElement=tinyMCE.getElementByAttributeValue(tinyMCE.selectedInstance.contentDocument.body,"img","src",tinyMCE.uniqueURL)}}if(tinyMCE.imgElement){var needsRepaint=false;var msrc=src;src=eval(tinyMCE.settings['urlconverter_callback']+"(src, tinyMCE.imgElement);");if(tinyMCE.getParam('convert_urls'))msrc=src;if(onmouseover&&onmouseover!="")onmouseover="this.src='"+eval(tinyMCE.settings['urlconverter_callback']+"(onmouseover, tinyMCE.imgElement);")+"';";if(onmouseout&&onmouseout!="")onmouseout="this.src='"+eval(tinyMCE.settings['urlconverter_callback']+"(onmouseout, tinyMCE.imgElement);")+"';";if(typeof(title)=="undefined")title=alt;if(width!=tinyMCE.imgElement.getAttribute("width")||height!=tinyMCE.imgElement.getAttribute("height")||align!=tinyMCE.imgElement.getAttribute("align"))needsRepaint=true;tinyMCE.setAttrib(tinyMCE.imgElement,'src',src);tinyMCE.setAttrib(tinyMCE.imgElement,'mce_src',msrc);tinyMCE.setAttrib(tinyMCE.imgElement,'alt',alt);tinyMCE.setAttrib(tinyMCE.imgElement,'title',title);tinyMCE.setAttrib(tinyMCE.imgElement,'align',align);tinyMCE.setAttrib(tinyMCE.imgElement,'border',border,true);tinyMCE.setAttrib(tinyMCE.imgElement,'hspace',hspace,true);tinyMCE.setAttrib(tinyMCE.imgElement,'vspace',vspace,true);tinyMCE.setAttrib(tinyMCE.imgElement,'width',width,true);tinyMCE.setAttrib(tinyMCE.imgElement,'height',height,true);tinyMCE.setAttrib(tinyMCE.imgElement,'onmouseover',onmouseover);tinyMCE.setAttrib(tinyMCE.imgElement,'onmouseout',onmouseout);if(width&&width!="")tinyMCE.imgElement.style.pixelWidth=width;if(height&&height!="")tinyMCE.imgElement.style.pixelHeight=height;if(needsRepaint)tinyMCE.selectedInstance.repaint()}tinyMCE.execCommand('mceEndUndoLevel')},_insertLink:function(href,target,title,onclick,style_class){tinyMCE.execCommand('mceBeginUndoLevel');if(tinyMCE.selectedInstance&&tinyMCE.selectedElement&&tinyMCE.selectedElement.nodeName.toLowerCase()=="img"){var doc=tinyMCE.selectedInstance.getDoc();var linkElement=tinyMCE.getParentElement(tinyMCE.selectedElement,"a");var newLink=false;if(!linkElement){linkElement=doc.createElement("a");newLink=true}var mhref=href;var thref=eval(tinyMCE.settings['urlconverter_callback']+"(href, linkElement);");mhref=tinyMCE.getParam('convert_urls')?href:mhref;tinyMCE.setAttrib(linkElement,'href',thref);tinyMCE.setAttrib(linkElement,'mce_href',mhref);tinyMCE.setAttrib(linkElement,'target',target);tinyMCE.setAttrib(linkElement,'title',title);tinyMCE.setAttrib(linkElement,'onclick',onclick);tinyMCE.setAttrib(linkElement,'class',style_class);if(newLink){linkElement.appendChild(tinyMCE.selectedElement.cloneNode(true));tinyMCE.selectedElement.parentNode.replaceChild(linkElement,tinyMCE.selectedElement)}return}if(!tinyMCE.linkElement&&tinyMCE.selectedInstance){if(tinyMCE.isSafari){tinyMCE.execCommand("mceInsertContent",false,'<a href="'+tinyMCE.uniqueURL+'">'+tinyMCE.selectedInstance.selection.getSelectedHTML()+'</a>')}else tinyMCE.selectedInstance.contentDocument.execCommand("createlink",false,tinyMCE.uniqueURL);tinyMCE.linkElement=tinyMCE.getElementByAttributeValue(tinyMCE.selectedInstance.contentDocument.body,"a","href",tinyMCE.uniqueURL);var elementArray=tinyMCE.getElementsByAttributeValue(tinyMCE.selectedInstance.contentDocument.body,"a","href",tinyMCE.uniqueURL);for(var i=0;i<elementArray.length;i++){var mhref=href;var thref=eval(tinyMCE.settings['urlconverter_callback']+"(href, elementArray[i]);");mhref=tinyMCE.getParam('convert_urls')?href:mhref;tinyMCE.setAttrib(elementArray[i],'href',thref);tinyMCE.setAttrib(elementArray[i],'mce_href',mhref);tinyMCE.setAttrib(elementArray[i],'target',target);tinyMCE.setAttrib(elementArray[i],'title',title);tinyMCE.setAttrib(elementArray[i],'onclick',onclick);tinyMCE.setAttrib(elementArray[i],'class',style_class)}tinyMCE.linkElement=elementArray[0]}if(tinyMCE.linkElement){var mhref=href;href=eval(tinyMCE.settings['urlconverter_callback']+"(href, tinyMCE.linkElement);");mhref=tinyMCE.getParam('convert_urls')?href:mhref;tinyMCE.setAttrib(tinyMCE.linkElement,'href',href);tinyMCE.setAttrib(tinyMCE.linkElement,'mce_href',mhref);tinyMCE.setAttrib(tinyMCE.linkElement,'target',target);tinyMCE.setAttrib(tinyMCE.linkElement,'title',title);tinyMCE.setAttrib(tinyMCE.linkElement,'onclick',onclick);tinyMCE.setAttrib(tinyMCE.linkElement,'class',style_class)}tinyMCE.execCommand('mceEndUndoLevel')}};tinyMCE.addTheme("advanced",TinyMCE_AdvancedTheme);tinyMCE.addButtonMap(TinyMCE_AdvancedTheme._buttonMap);
\ No newline at end of file
+(function(e){var d=e.DOM,b=e.dom.Event,h=e.extend,f=e.each,a=e.util.Cookie,g,c=e.explode;e.ThemeManager.requireLangPack("advanced");e.create("tinymce.themes.AdvancedTheme",{sizes:[8,10,12,14,18,24,36],controls:{bold:["bold_desc","Bold"],italic:["italic_desc","Italic"],underline:["underline_desc","Underline"],strikethrough:["striketrough_desc","Strikethrough"],justifyleft:["justifyleft_desc","JustifyLeft"],justifycenter:["justifycenter_desc","JustifyCenter"],justifyright:["justifyright_desc","JustifyRight"],justifyfull:["justifyfull_desc","JustifyFull"],bullist:["bullist_desc","InsertUnorderedList"],numlist:["numlist_desc","InsertOrderedList"],outdent:["outdent_desc","Outdent"],indent:["indent_desc","Indent"],cut:["cut_desc","Cut"],copy:["copy_desc","Copy"],paste:["paste_desc","Paste"],undo:["undo_desc","Undo"],redo:["redo_desc","Redo"],link:["link_desc","mceLink"],unlink:["unlink_desc","unlink"],image:["image_desc","mceImage"],cleanup:["cleanup_desc","mceCleanup"],help:["help_desc","mceHelp"],code:["code_desc","mceCodeEditor"],hr:["hr_desc","InsertHorizontalRule"],removeformat:["removeformat_desc","RemoveFormat"],sub:["sub_desc","subscript"],sup:["sup_desc","superscript"],forecolor:["forecolor_desc","ForeColor"],forecolorpicker:["forecolor_desc","mceForeColor"],backcolor:["backcolor_desc","HiliteColor"],backcolorpicker:["backcolor_desc","mceBackColor"],charmap:["charmap_desc","mceCharMap"],visualaid:["visualaid_desc","mceToggleVisualAid"],anchor:["anchor_desc","mceInsertAnchor"],newdocument:["newdocument_desc","mceNewDocument"],blockquote:["blockquote_desc","mceBlockQuote"]},stateControls:["bold","italic","underline","strikethrough","bullist","numlist","justifyleft","justifycenter","justifyright","justifyfull","sub","sup","blockquote"],init:function(j,k){var l=this,m,i,n;l.editor=j;l.url=k;l.onResolveName=new e.util.Dispatcher(this);l.settings=m=h({theme_advanced_path:true,theme_advanced_toolbar_location:"bottom",theme_advanced_buttons1:"bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,styleselect,formatselect",theme_advanced_buttons2:"bullist,numlist,|,outdent,indent,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code",theme_advanced_buttons3:"hr,removeformat,visualaid,|,sub,sup,|,charmap",theme_advanced_blockformats:"p,address,pre,h1,h2,h3,h4,h5,h6",theme_advanced_toolbar_align:"center",theme_advanced_fonts:"Andale Mono=andale mono,times;Arial=arial,helvetica,sans-serif;Arial Black=arial black,avant garde;Book Antiqua=book antiqua,palatino;Comic Sans MS=comic sans ms,sans-serif;Courier New=courier new,courier;Georgia=georgia,palatino;Helvetica=helvetica;Impact=impact,chicago;Symbol=symbol;Tahoma=tahoma,arial,helvetica,sans-serif;Terminal=terminal,monaco;Times New Roman=times new roman,times;Trebuchet MS=trebuchet ms,geneva;Verdana=verdana,geneva;Webdings=webdings;Wingdings=wingdings,zapf dingbats",theme_advanced_more_colors:1,theme_advanced_row_height:23,theme_advanced_resize_horizontal:1,theme_advanced_resizing_use_cookie:1,theme_advanced_font_sizes:"1,2,3,4,5,6,7",readonly:j.settings.readonly},j.settings);if(!m.font_size_style_values){m.font_size_style_values="8pt,10pt,12pt,14pt,18pt,24pt,36pt"}if(e.is(m.theme_advanced_font_sizes,"string")){m.font_size_style_values=e.explode(m.font_size_style_values);m.font_size_classes=e.explode(m.font_size_classes||"");n={};j.settings.theme_advanced_font_sizes=m.theme_advanced_font_sizes;f(j.getParam("theme_advanced_font_sizes","","hash"),function(q,p){var o;if(p==q&&q>=1&&q<=7){p=q+" ("+l.sizes[q-1]+"pt)";if(j.settings.convert_fonts_to_spans){o=m.font_size_classes[q-1];q=m.font_size_style_values[q-1]||(l.sizes[q-1]+"pt")}}if(/^\s*\./.test(q)){o=q.replace(/\./g,"")}n[p]=o?{"class":o}:{fontSize:q}});m.theme_advanced_font_sizes=n}if((i=m.theme_advanced_path_location)&&i!="none"){m.theme_advanced_statusbar_location=m.theme_advanced_path_location}if(m.theme_advanced_statusbar_location=="none"){m.theme_advanced_statusbar_location=0}j.onInit.add(function(){j.onNodeChange.add(l._nodeChanged,l);if(j.settings.content_css!==false){j.dom.loadCSS(j.baseURI.toAbsolute("themes/advanced/skins/"+j.settings.skin+"/content.css"))}});j.onSetProgressState.add(function(q,o,r){var s,t=q.id,p;if(o){l.progressTimer=setTimeout(function(){s=q.getContainer();s=s.insertBefore(d.create("DIV",{style:"position:relative"}),s.firstChild);p=d.get(q.id+"_tbl");d.add(s,"div",{id:t+"_blocker","class":"mceBlocker",style:{width:p.clientWidth+2,height:p.clientHeight+2}});d.add(s,"div",{id:t+"_progress","class":"mceProgress",style:{left:p.clientWidth/2,top:p.clientHeight/2}})},r||0)}else{d.remove(t+"_blocker");d.remove(t+"_progress");clearTimeout(l.progressTimer)}});d.loadCSS(m.editor_css?j.documentBaseURI.toAbsolute(m.editor_css):k+"/skins/"+j.settings.skin+"/ui.css");if(m.skin_variant){d.loadCSS(k+"/skins/"+j.settings.skin+"/ui_"+m.skin_variant+".css")}},createControl:function(l,i){var j,k;if(k=i.createControl(l)){return k}switch(l){case"styleselect":return this._createStyleSelect();case"formatselect":return this._createBlockFormats();case"fontselect":return this._createFontSelect();case"fontsizeselect":return this._createFontSizeSelect();case"forecolor":return this._createForeColorMenu();case"backcolor":return this._createBackColorMenu()}if((j=this.controls[l])){return i.createButton(l,{title:"advanced."+j[0],cmd:j[1],ui:j[2],value:j[3]})}},execCommand:function(k,j,l){var i=this["_"+k];if(i){i.call(this,j,l);return true}return false},_importClasses:function(j){var i=this.editor,k=i.controlManager.get("styleselect");if(k.getLength()==0){f(i.dom.getClasses(),function(l){k.add(l["class"],l["class"])})}},_createStyleSelect:function(m){var j=this,i=j.editor,k=i.controlManager,l=k.createListBox("styleselect",{title:"advanced.style_select",onselect:function(n){if(l.selectedValue===n){i.execCommand("mceSetStyleInfo",0,{command:"removeformat"});l.select();return false}else{i.execCommand("mceSetCSSClass",0,n)}}});if(l){f(i.getParam("theme_advanced_styles","","hash"),function(o,n){if(o){l.add(j.editor.translate(n),o)}});l.onPostRender.add(function(o,p){if(!l.NativeListBox){b.add(p.id+"_text","focus",j._importClasses,j);b.add(p.id+"_text","mousedown",j._importClasses,j);b.add(p.id+"_open","focus",j._importClasses,j);b.add(p.id+"_open","mousedown",j._importClasses,j)}else{b.add(p.id,"focus",j._importClasses,j)}})}return l},_createFontSelect:function(){var k,j=this,i=j.editor;k=i.controlManager.createListBox("fontselect",{title:"advanced.fontdefault",cmd:"FontName"});if(k){f(i.getParam("theme_advanced_fonts",j.settings.theme_advanced_fonts,"hash"),function(m,l){k.add(i.translate(l),m,{style:m.indexOf("dings")==-1?"font-family:"+m:""})})}return k},_createFontSizeSelect:function(){var m=this,k=m.editor,n,l=0,j=[];n=k.controlManager.createListBox("fontsizeselect",{title:"advanced.font_size",onselect:function(i){if(i.fontSize){k.execCommand("FontSize",false,i.fontSize)}else{f(m.settings.theme_advanced_font_sizes,function(p,o){if(p["class"]){j.push(p["class"])}});k.editorCommands._applyInlineStyle("span",{"class":i["class"]},{check_classes:j})}}});if(n){f(m.settings.theme_advanced_font_sizes,function(o,i){var p=o.fontSize;if(p>=1&&p<=7){p=m.sizes[parseInt(p)-1]+"pt"}n.add(i,o,{style:"font-size:"+p,"class":"mceFontSize"+(l++)+(" "+(o["class"]||""))})})}return n},_createBlockFormats:function(){var k,i={p:"advanced.paragraph",address:"advanced.address",pre:"advanced.pre",h1:"advanced.h1",h2:"advanced.h2",h3:"advanced.h3",h4:"advanced.h4",h5:"advanced.h5",h6:"advanced.h6",div:"advanced.div",blockquote:"advanced.blockquote",code:"advanced.code",dt:"advanced.dt",dd:"advanced.dd",samp:"advanced.samp"},j=this;k=j.editor.controlManager.createListBox("formatselect",{title:"advanced.block",cmd:"FormatBlock"});if(k){f(j.editor.getParam("theme_advanced_blockformats",j.settings.theme_advanced_blockformats,"hash"),function(m,l){k.add(j.editor.translate(l!=m?l:i[m]),m,{"class":"mce_formatPreview mce_"+m})})}return k},_createForeColorMenu:function(){var m,j=this,k=j.settings,l={},i;if(k.theme_advanced_more_colors){l.more_colors_func=function(){j._mceColorPicker(0,{color:m.value,func:function(n){m.setColor(n)}})}}if(i=k.theme_advanced_text_colors){l.colors=i}if(k.theme_advanced_default_foreground_color){l.default_color=k.theme_advanced_default_foreground_color}l.title="advanced.forecolor_desc";l.cmd="ForeColor";l.scope=this;m=j.editor.controlManager.createColorSplitButton("forecolor",l);return m},_createBackColorMenu:function(){var m,j=this,k=j.settings,l={},i;if(k.theme_advanced_more_colors){l.more_colors_func=function(){j._mceColorPicker(0,{color:m.value,func:function(n){m.setColor(n)}})}}if(i=k.theme_advanced_background_colors){l.colors=i}if(k.theme_advanced_default_background_color){l.default_color=k.theme_advanced_default_background_color}l.title="advanced.backcolor_desc";l.cmd="HiliteColor";l.scope=this;m=j.editor.controlManager.createColorSplitButton("backcolor",l);return m},renderUI:function(k){var m,l,q,v=this,r=v.editor,w=v.settings,u,j,i;m=j=d.create("span",{id:r.id+"_parent","class":"mceEditor "+r.settings.skin+"Skin"+(w.skin_variant?" "+r.settings.skin+"Skin"+v._ufirst(w.skin_variant):"")});if(!d.boxModel){m=d.add(m,"div",{"class":"mceOldBoxModel"})}m=u=d.add(m,"table",{id:r.id+"_tbl","class":"mceLayout",cellSpacing:0,cellPadding:0});m=q=d.add(m,"tbody");switch((w.theme_advanced_layout_manager||"").toLowerCase()){case"rowlayout":l=v._rowLayout(w,q,k);break;case"customlayout":l=r.execCallback("theme_advanced_custom_layout",w,q,k,j);break;default:l=v._simpleLayout(w,q,k,j)}m=k.targetNode;i=d.stdMode?u.getElementsByTagName("tr"):u.rows;d.addClass(i[0],"mceFirst");d.addClass(i[i.length-1],"mceLast");f(d.select("tr",q),function(o){d.addClass(o.firstChild,"mceFirst");d.addClass(o.childNodes[o.childNodes.length-1],"mceLast")});if(d.get(w.theme_advanced_toolbar_container)){d.get(w.theme_advanced_toolbar_container).appendChild(j)}else{d.insertAfter(j,m)}b.add(r.id+"_path_row","click",function(n){n=n.target;if(n.nodeName=="A"){v._sel(n.className.replace(/^.*mcePath_([0-9]+).*$/,"$1"));return b.cancel(n)}});if(!r.getParam("accessibility_focus")){b.add(d.add(j,"a",{href:"#"},"<!-- IE -->"),"focus",function(){tinyMCE.get(r.id).focus()})}if(w.theme_advanced_toolbar_location=="external"){k.deltaHeight=0}v.deltaHeight=k.deltaHeight;k.targetNode=null;return{iframeContainer:l,editorContainer:r.id+"_parent",sizeContainer:u,deltaHeight:k.deltaHeight}},getInfo:function(){return{longname:"Advanced theme",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",version:e.majorVersion+"."+e.minorVersion}},resizeBy:function(i,j){var k=d.get(this.editor.id+"_tbl");this.resizeTo(k.clientWidth+i,k.clientHeight+j)},resizeTo:function(i,l){var j=this.editor,k=j.settings,n=d.get(j.id+"_tbl"),o=d.get(j.id+"_ifr"),m;i=Math.max(k.theme_advanced_resizing_min_width||100,i);l=Math.max(k.theme_advanced_resizing_min_height||100,l);i=Math.min(k.theme_advanced_resizing_max_width||65535,i);l=Math.min(k.theme_advanced_resizing_max_height||65535,l);m=n.clientHeight-o.clientHeight;d.setStyle(o,"height",l-m);d.setStyles(n,{width:i,height:l})},destroy:function(){var i=this.editor.id;b.clear(i+"_resize");b.clear(i+"_path_row");b.clear(i+"_external_close")},_simpleLayout:function(y,r,k,i){var x=this,u=x.editor,v=y.theme_advanced_toolbar_location,m=y.theme_advanced_statusbar_location,l,j,q,w;if(y.readonly){l=d.add(r,"tr");l=j=d.add(l,"td",{"class":"mceIframeContainer"});return j}if(v=="top"){x._addToolbars(r,k)}if(v=="external"){l=w=d.create("div",{style:"position:relative"});l=d.add(l,"div",{id:u.id+"_external","class":"mceExternalToolbar"});d.add(l,"a",{id:u.id+"_external_close",href:"javascript:;","class":"mceExternalClose"});l=d.add(l,"table",{id:u.id+"_tblext",cellSpacing:0,cellPadding:0});q=d.add(l,"tbody");if(i.firstChild.className=="mceOldBoxModel"){i.firstChild.appendChild(w)}else{i.insertBefore(w,i.firstChild)}x._addToolbars(q,k);u.onMouseUp.add(function(){var o=d.get(u.id+"_external");d.show(o);d.hide(g);var n=b.add(u.id+"_external_close","click",function(){d.hide(u.id+"_external");b.remove(u.id+"_external_close","click",n)});d.show(o);d.setStyle(o,"top",0-d.getRect(u.id+"_tblext").h-1);d.hide(o);d.show(o);o.style.filter="";g=u.id+"_external";o=null})}if(m=="top"){x._addStatusBar(r,k)}if(!y.theme_advanced_toolbar_container){l=d.add(r,"tr");l=j=d.add(l,"td",{"class":"mceIframeContainer"})}if(v=="bottom"){x._addToolbars(r,k)}if(m=="bottom"){x._addStatusBar(r,k)}return j},_rowLayout:function(w,m,k){var v=this,p=v.editor,u,x,i=p.controlManager,l,j,r,q;u=w.theme_advanced_containers_default_class||"";x=w.theme_advanced_containers_default_align||"center";f(c(w.theme_advanced_containers||""),function(s,o){var n=w["theme_advanced_container_"+s]||"";switch(n.toLowerCase()){case"mceeditor":l=d.add(m,"tr");l=j=d.add(l,"td",{"class":"mceIframeContainer"});break;case"mceelementpath":v._addStatusBar(m,k);break;default:q=(w["theme_advanced_container_"+s+"_align"]||x).toLowerCase();q="mce"+v._ufirst(q);l=d.add(d.add(m,"tr"),"td",{"class":"mceToolbar "+(w["theme_advanced_container_"+s+"_class"]||u)+" "+q||x});r=i.createToolbar("toolbar"+o);v._addControls(n,r);d.setHTML(l,r.renderHTML());k.deltaHeight-=w.theme_advanced_row_height}});return j},_addControls:function(j,i){var k=this,l=k.settings,m,n=k.editor.controlManager;if(l.theme_advanced_disable&&!k._disabled){m={};f(c(l.theme_advanced_disable),function(o){m[o]=1});k._disabled=m}else{m=k._disabled}f(c(j),function(p){var o;if(m&&m[p]){return}if(p=="tablecontrols"){f(["table","|","row_props","cell_props","|","row_before","row_after","delete_row","|","col_before","col_after","delete_col","|","split_cells","merge_cells"],function(q){q=k.createControl(q,n);if(q){i.add(q)}});return}o=k.createControl(p,n);if(o){i.add(o)}})},_addToolbars:function(w,k){var z=this,p,m,r=z.editor,A=z.settings,y,j=r.controlManager,u,l,q=[],x;x=A.theme_advanced_toolbar_align.toLowerCase();x="mce"+z._ufirst(x);l=d.add(d.add(w,"tr"),"td",{"class":"mceToolbar "+x});if(!r.getParam("accessibility_focus")){q.push(d.createHTML("a",{href:"#",onfocus:"tinyMCE.get('"+r.id+"').focus();"},"<!-- IE -->"))}q.push(d.createHTML("a",{href:"#",accesskey:"q",title:r.getLang("advanced.toolbar_focus")},"<!-- IE -->"));for(p=1;(y=A["theme_advanced_buttons"+p]);p++){m=j.createToolbar("toolbar"+p,{"class":"mceToolbarRow"+p});if(A["theme_advanced_buttons"+p+"_add"]){y+=","+A["theme_advanced_buttons"+p+"_add"]}if(A["theme_advanced_buttons"+p+"_add_before"]){y=A["theme_advanced_buttons"+p+"_add_before"]+","+y}z._addControls(y,m);q.push(m.renderHTML());k.deltaHeight-=A.theme_advanced_row_height}q.push(d.createHTML("a",{href:"#",accesskey:"z",title:r.getLang("advanced.toolbar_focus"),onfocus:"tinyMCE.getInstanceById('"+r.id+"').focus();"},"<!-- IE -->"));d.setHTML(l,q.join(""))},_addStatusBar:function(m,j){var k,v=this,p=v.editor,w=v.settings,i,q,u,l;k=d.add(m,"tr");k=l=d.add(k,"td",{"class":"mceStatusbar"});k=d.add(k,"div",{id:p.id+"_path_row"},w.theme_advanced_path?p.translate("advanced.path")+": ":"&#160;");d.add(k,"a",{href:"#",accesskey:"x"});if(w.theme_advanced_resizing){d.add(l,"a",{id:p.id+"_resize",href:"javascript:;",onclick:"return false;","class":"mceResize"});if(w.theme_advanced_resizing_use_cookie){p.onPostRender.add(function(){var n=a.getHash("TinyMCE_"+p.id+"_size"),r=d.get(p.id+"_tbl");if(!n){return}if(w.theme_advanced_resize_horizontal){r.style.width=Math.max(10,n.cw)+"px"}r.style.height=Math.max(10,n.ch)+"px";d.get(p.id+"_ifr").style.height=Math.max(10,parseInt(n.ch)+v.deltaHeight)+"px"})}p.onPostRender.add(function(){b.add(p.id+"_resize","mousedown",function(x){var z,t,o,s,y,r;z=d.get(p.id+"_tbl");o=z.clientWidth;s=z.clientHeight;miw=w.theme_advanced_resizing_min_width||100;mih=w.theme_advanced_resizing_min_height||100;maw=w.theme_advanced_resizing_max_width||65535;mah=w.theme_advanced_resizing_max_height||65535;t=d.add(d.get(p.id+"_parent"),"div",{"class":"mcePlaceHolder"});d.setStyles(t,{width:o,height:s});d.hide(z);d.show(t);i={x:x.screenX,y:x.screenY,w:o,h:s,dx:null,dy:null};q=b.add(d.doc,"mousemove",function(B){var n,A;i.dx=B.screenX-i.x;i.dy=B.screenY-i.y;n=Math.max(miw,i.w+i.dx);A=Math.max(mih,i.h+i.dy);n=Math.min(maw,n);A=Math.min(mah,A);if(w.theme_advanced_resize_horizontal){t.style.width=n+"px"}t.style.height=A+"px";return b.cancel(B)});u=b.add(d.doc,"mouseup",function(n){var A;b.remove(d.doc,"mousemove",q);b.remove(d.doc,"mouseup",u);z.style.display="";d.remove(t);if(i.dx===null){return}A=d.get(p.id+"_ifr");if(w.theme_advanced_resize_horizontal){z.style.width=Math.max(10,i.w+i.dx)+"px"}z.style.height=Math.max(10,i.h+i.dy)+"px";A.style.height=Math.max(10,A.clientHeight+i.dy)+"px";if(w.theme_advanced_resizing_use_cookie){a.setHash("TinyMCE_"+p.id+"_size",{cw:i.w+i.dx,ch:i.h+i.dy})}});return b.cancel(x)})})}j.deltaHeight-=21;k=m=null},_nodeChanged:function(l,u,k,q){var y=this,i,r=0,x,m,z=y.settings,w,j,o;if(z.readonly){return}e.each(y.stateControls,function(n){u.setActive(n,l.queryCommandState(y.controls[n][1]))});u.setActive("visualaid",l.hasVisual);u.setDisabled("undo",!l.undoManager.hasUndo()&&!l.typing);u.setDisabled("redo",!l.undoManager.hasRedo());u.setDisabled("outdent",!l.queryCommandState("Outdent"));i=d.getParent(k,"A");if(m=u.get("link")){if(!i||!i.name){m.setDisabled(!i&&q);m.setActive(!!i)}}if(m=u.get("unlink")){m.setDisabled(!i&&q);m.setActive(!!i&&!i.name)}if(m=u.get("anchor")){m.setActive(!!i&&i.name);if(e.isWebKit){i=d.getParent(k,"IMG");m.setActive(!!i&&d.getAttrib(i,"mce_name")=="a")}}i=d.getParent(k,"IMG");if(m=u.get("image")){m.setActive(!!i&&k.className.indexOf("mceItem")==-1)}if(m=u.get("styleselect")){if(k.className){y._importClasses();m.select(k.className)}else{m.select()}}if(m=u.get("formatselect")){i=d.getParent(k,d.isBlock);if(i){m.select(i.nodeName.toLowerCase())}}if(l.settings.convert_fonts_to_spans){l.dom.getParent(k,function(p){if(p.nodeName==="SPAN"){if(!w&&p.className){w=p.className}if(!j&&p.style.fontSize){j=p.style.fontSize}if(!o&&p.style.fontFamily){o=p.style.fontFamily.replace(/[\"\']+/g,"").replace(/^([^,]+).*/,"$1").toLowerCase()}}return false});if(m=u.get("fontselect")){m.select(function(n){return n.replace(/^([^,]+).*/,"$1").toLowerCase()==o})}if(m=u.get("fontsizeselect")){m.select(function(n){if(n.fontSize&&n.fontSize===j){return true}if(n["class"]&&n["class"]===w){return true}})}}else{if(m=u.get("fontselect")){m.select(l.queryCommandValue("FontName"))}if(m=u.get("fontsizeselect")){x=l.queryCommandValue("FontSize");m.select(function(n){return n.fontSize==x})}}if(z.theme_advanced_path&&z.theme_advanced_statusbar_location){i=d.get(l.id+"_path")||d.add(l.id+"_path_row","span",{id:l.id+"_path"});d.setHTML(i,"");l.dom.getParent(k,function(A){var p=A.nodeName.toLowerCase(),s,v,t="";if(A.nodeType!=1||A.nodeName==="BR"||(d.hasClass(A,"mceItemHidden")||d.hasClass(A,"mceItemRemoved"))){return}if(x=d.getAttrib(A,"mce_name")){p=x}if(e.isIE&&A.scopeName!=="HTML"){p=A.scopeName+":"+p}p=p.replace(/mce\:/g,"");switch(p){case"b":p="strong";break;case"i":p="em";break;case"img":if(x=d.getAttrib(A,"src")){t+="src: "+x+" "}break;case"a":if(x=d.getAttrib(A,"name")){t+="name: "+x+" ";p+="#"+x}if(x=d.getAttrib(A,"href")){t+="href: "+x+" "}break;case"font":if(z.convert_fonts_to_spans){p="span"}if(x=d.getAttrib(A,"face")){t+="font: "+x+" "}if(x=d.getAttrib(A,"size")){t+="size: "+x+" "}if(x=d.getAttrib(A,"color")){t+="color: "+x+" "}break;case"span":if(x=d.getAttrib(A,"style")){t+="style: "+x+" "}break}if(x=d.getAttrib(A,"id")){t+="id: "+x+" "}if(x=A.className){x=x.replace(/(webkit-[\w\-]+|Apple-[\w\-]+|mceItem\w+|mceVisualAid)/g,"");if(x&&x.indexOf("mceItem")==-1){t+="class: "+x+" ";if(d.isBlock(A)||p=="img"||p=="span"){p+="."+x}}}p=p.replace(/(html:)/g,"");p={name:p,node:A,title:t};y.onResolveName.dispatch(y,p);t=p.title;p=p.name;v=d.create("a",{href:"javascript:;",onmousedown:"return false;",title:t,"class":"mcePath_"+(r++)},p);if(i.hasChildNodes()){i.insertBefore(d.doc.createTextNode(" \u00bb "),i.firstChild);i.insertBefore(v,i.firstChild)}else{i.appendChild(v)}},l.getBody())}},_sel:function(i){this.editor.execCommand("mceSelectNodeDepth",false,i)},_mceInsertAnchor:function(k,j){var i=this.editor;i.windowManager.open({url:e.baseURL+"/themes/advanced/anchor.htm",width:320+parseInt(i.getLang("advanced.anchor_delta_width",0)),height:90+parseInt(i.getLang("advanced.anchor_delta_height",0)),inline:true},{theme_url:this.url})},_mceCharMap:function(){var i=this.editor;i.windowManager.open({url:e.baseURL+"/themes/advanced/charmap.htm",width:550+parseInt(i.getLang("advanced.charmap_delta_width",0)),height:250+parseInt(i.getLang("advanced.charmap_delta_height",0)),inline:true},{theme_url:this.url})},_mceHelp:function(){var i=this.editor;i.windowManager.open({url:e.baseURL+"/themes/advanced/about.htm",width:480,height:380,inline:true},{theme_url:this.url})},_mceColorPicker:function(k,j){var i=this.editor;j=j||{};i.windowManager.open({url:e.baseURL+"/themes/advanced/color_picker.htm",width:375+parseInt(i.getLang("advanced.colorpicker_delta_width",0)),height:250+parseInt(i.getLang("advanced.colorpicker_delta_height",0)),close_previous:false,inline:true},{input_color:j.color,func:j.func,theme_url:this.url})},_mceCodeEditor:function(j,k){var i=this.editor;i.windowManager.open({url:e.baseURL+"/themes/advanced/source_editor.htm",width:parseInt(i.getParam("theme_advanced_source_editor_width",720)),height:parseInt(i.getParam("theme_advanced_source_editor_height",580)),inline:true,resizable:true,maximizable:true},{theme_url:this.url})},_mceImage:function(j,k){var i=this.editor;if(i.dom.getAttrib(i.selection.getNode(),"class").indexOf("mceItem")!=-1){return}i.windowManager.open({url:e.baseURL+"/themes/advanced/image.htm",width:355+parseInt(i.getLang("advanced.image_delta_width",0)),height:275+parseInt(i.getLang("advanced.image_delta_height",0)),inline:true},{theme_url:this.url})},_mceLink:function(j,k){var i=this.editor;i.windowManager.open({url:e.baseURL+"/themes/advanced/link.htm",width:310+parseInt(i.getLang("advanced.link_delta_width",0)),height:200+parseInt(i.getLang("advanced.link_delta_height",0)),inline:true},{theme_url:this.url})},_mceNewDocument:function(){var i=this.editor;i.windowManager.confirm("advanced.newdocument",function(j){if(j){i.execCommand("mceSetContent",false,"")}})},_mceForeColor:function(){var i=this;this._mceColorPicker(0,{color:i.fgColor,func:function(j){i.fgColor=j;i.editor.execCommand("ForeColor",false,j)}})},_mceBackColor:function(){var i=this;this._mceColorPicker(0,{color:i.bgColor,func:function(j){i.bgColor=j;i.editor.execCommand("HiliteColor",false,j)}})},_ufirst:function(i){return i.substring(0,1).toUpperCase()+i.substring(1)}});e.ThemeManager.add("advanced",e.themes.AdvancedTheme)}(tinymce));
\ No newline at end of file
diff -x .svn -aruN 0.7.15.src/e107_handlers/tiny_mce/themes/advanced/editor_template_src.js 0.7.16.src/e107_handlers/tiny_mce/themes/advanced/editor_template_src.js
--- 0.7.15.src/e107_handlers/tiny_mce/themes/advanced/editor_template_src.js	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_handlers/tiny_mce/themes/advanced/editor_template_src.js	2009-06-30 19:36:50.000000000 -0500
@@ -1,1534 +1,1153 @@
 /**
- * $Id: editor_template_src.js,v 1.13 2006/10/27 22:36:57 e107coders Exp $
+ * $Id: editor_template_src.js,v 1.14 2009/07/01 00:37:14 e107coders Exp $
  *
  * @author Moxiecode
- * @copyright Copyright  2004-2006, Moxiecode Systems AB, All rights reserved.
+ * @copyright Copyright  2004-2008, Moxiecode Systems AB, All rights reserved.
  */
 
-/* Import theme specific language pack */
-tinyMCE.importThemeLanguagePack('advanced');
+(function(tinymce) {
+	var DOM = tinymce.DOM, Event = tinymce.dom.Event, extend = tinymce.extend, each = tinymce.each, Cookie = tinymce.util.Cookie, lastExtID, explode = tinymce.explode;
 
-var TinyMCE_AdvancedTheme = {
-	// Private theme fields
-	_defColors : "000000,993300,333300,003300,003366,000080,333399,333333,800000,FF6600,808000,008000,008080,0000FF,666699,808080,FF0000,FF9900,99CC00,339966,33CCCC,3366FF,800080,999999,FF00FF,FFCC00,FFFF00,00FF00,00FFFF,00CCFF,993366,C0C0C0,FF99CC,FFCC99,FFFF99,CCFFCC,CCFFFF,99CCFF,CC99FF,FFFFFF",
-	_autoImportCSSClasses : true,
-	_resizer : {},
-	_buttons : [
-		// Control id, button img, button title, command, user_interface, value
-		['bold', '{$lang_bold_img}', 'lang_bold_desc', 'Bold'],
-		['italic', '{$lang_italic_img}', 'lang_italic_desc', 'Italic'],
-		['underline', '{$lang_underline_img}', 'lang_underline_desc', 'Underline'],
-		['strikethrough', 'strikethrough.gif', 'lang_striketrough_desc', 'Strikethrough'],
-		['justifyleft', 'justifyleft.gif', 'lang_justifyleft_desc', 'JustifyLeft'],
-		['justifycenter', 'justifycenter.gif', 'lang_justifycenter_desc', 'JustifyCenter'],
-		['justifyright', 'justifyright.gif', 'lang_justifyright_desc', 'JustifyRight'],
-		['justifyfull', 'justifyfull.gif', 'lang_justifyfull_desc', 'JustifyFull'],
-		['bullist', 'bullist.gif', 'lang_bullist_desc', 'InsertUnorderedList'],
-		['numlist', 'numlist.gif', 'lang_numlist_desc', 'InsertOrderedList'],
-		['outdent', 'outdent.gif', 'lang_outdent_desc', 'Outdent'],
-		['indent', 'indent.gif', 'lang_indent_desc', 'Indent'],
-		['cut', 'cut.gif', 'lang_cut_desc', 'Cut'],
-		['copy', 'copy.gif', 'lang_copy_desc', 'Copy'],
-		['paste', 'paste.gif', 'lang_paste_desc', 'Paste'],
-		['undo', 'undo.gif', 'lang_undo_desc', 'Undo'],
-		['redo', 'redo.gif', 'lang_redo_desc', 'Redo'],
-		['link', 'link.gif', 'lang_link_desc', 'mceLink', true],
-		['unlink', 'unlink.gif', 'lang_unlink_desc', 'unlink'],
-		['image', 'image.gif', 'lang_image_desc', 'mceImage', true],
-		['cleanup', 'cleanup.gif', 'lang_cleanup_desc', 'mceCleanup'],
-		['help', 'help.gif', 'lang_help_desc', 'mceHelp'],
-		['code', 'code.gif', 'lang_theme_code_desc', 'mceCodeEditor'],
-		['hr', 'hr.gif', 'lang_theme_hr_desc', 'inserthorizontalrule'],
-		['removeformat', 'removeformat.gif', 'lang_theme_removeformat_desc', 'removeformat'],
-		['sub', 'sub.gif', 'lang_theme_sub_desc', 'subscript'],
-		['sup', 'sup.gif', 'lang_theme_sup_desc', 'superscript'],
-		['forecolor', 'forecolor.gif', 'lang_theme_forecolor_desc', 'forecolor', true],
-		['backcolor', 'backcolor.gif', 'lang_theme_backcolor_desc', 'HiliteColor', true],
-		['charmap', 'charmap.gif', 'lang_theme_charmap_desc', 'mceCharMap'],
-		['visualaid', 'visualaid.gif', 'lang_theme_visualaid_desc', 'mceToggleVisualAid'],
-		['anchor', 'anchor.gif', 'lang_theme_anchor_desc', 'mceInsertAnchor'],
-		['newdocument', 'newdocument.gif', 'lang_newdocument_desc', 'mceNewDocument']
-	],
-
-	_buttonMap : 'anchor,backcolor,bold,bullist,charmap,cleanup,code,copy,cut,forecolor,help,hr,image,indent,italic,justifycenter,justifyfull,justifyleft,justifyright,link,newdocument,numlist,outdent,paste,redo,removeformat,strikethrough,sub,sup,underline,undo,unlink,visualaid,advhr,ltr,rtl,emotions,flash,fullpage,fullscreen,iespell,insertdate,inserttime,pastetext,pasteword,selectall,preview,print,save,replace,search,table,cell_props,delete_col,delete_row,col_after,col_before,row_after,row_before,merge_cells,row_props,split_cells,delete_table',
-
-	/**
-	 * Returns HTML code for the specificed control.
-	 */
-	getControlHTML : function(button_name) {
-		var i, x, but;
-
-		// Lookup button in button list
-		for (i=0; i<TinyMCE_AdvancedTheme._buttons.length; i++) {
-			but = TinyMCE_AdvancedTheme._buttons[i];
+	// Tell it to load theme specific language pack(s)
+	tinymce.ThemeManager.requireLangPack('advanced');
 
-			if (but[0] == button_name && (button_name == "forecolor" || button_name == "backcolor"))
-				return tinyMCE.getMenuButtonHTML(but[0], but[2], '{$themeurl}/images/' + but[1], but[3] + "Menu", but[3], (but.length > 4 ? but[4] : false), (but.length > 5 ? but[5] : null));
+	tinymce.create('tinymce.themes.AdvancedTheme', {
+		sizes : [8, 10, 12, 14, 18, 24, 36],
 
-			if (but[0] == button_name)
-				return tinyMCE.getButtonHTML(but[0], but[2], '{$themeurl}/images/' + but[1], but[3], (but.length > 4 ? but[4] : false), (but.length > 5 ? but[5] : null));
-		}
-
-		// Custom controlls other than buttons
-		switch (button_name) {
-			case "formatselect":
-				var html = '<select id="{$editor_id}_formatSelect" name="{$editor_id}_formatSelect" onfocus="tinyMCE.addSelectAccessibility(event, this, window);" onchange="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'FormatBlock\',false,this.options[this.selectedIndex].value);" class="mceSelectList">';
-				var formats = tinyMCE.getParam("theme_advanced_blockformats", "p,address,pre,h1,h2,h3,h4,h5,h6", true).split(',');
-				var lookup = [
-					['p', '{$lang_theme_paragraph}'],
-					['address', '{$lang_theme_address}'],
-					['pre', '{$lang_theme_pre}'],
-					['h1', '{$lang_theme_h1}'],
-					['h2', '{$lang_theme_h2}'],
-					['h3', '{$lang_theme_h3}'],
-					['h4', '{$lang_theme_h4}'],
-					['h5', '{$lang_theme_h5}'],
-					['h6', '{$lang_theme_h6}'],
-					['div', '{$lang_theme_div}'],
-					['blockquote', '{$lang_theme_blockquote}'],
-					['code', '{$lang_theme_code}'],
-					['dt', '{$lang_theme_dt}'],
-					['dd', '{$lang_theme_dd}'],
-					['samp', '{$lang_theme_samp}']
-				];
-
-				html += '<option value="">{$lang_theme_block}</option>';
-
-				// Build format select
-				for (var i=0; i<formats.length; i++) {
-					for (var x=0; x<lookup.length; x++) {
-						if (formats[i] == lookup[x][0])
-							html += '<option value="&lt;' + lookup[x][0] + '&gt;">' + lookup[x][1] + '</option>';
-					}
-				}
-
-				html += '</select>';
-
-				return html;
-
-			case "styleselect":
-				return '<select id="{$editor_id}_styleSelect" onmousedown="tinyMCE.themes.advanced._setupCSSClasses(\'{$editor_id}\');" name="{$editor_id}_styleSelect" onfocus="tinyMCE.addSelectAccessibility(event,this,window);" onchange="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'mceSetCSSClass\',false,this.options[this.selectedIndex].value);" class="mceSelectList">{$style_select_options}</select>';
-
-			case "fontselect":
-				var fontHTML = '<select id="{$editor_id}_fontNameSelect" name="{$editor_id}_fontNameSelect" onfocus="tinyMCE.addSelectAccessibility(event, this, window);" onchange="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'FontName\',false,this.options[this.selectedIndex].value);" class="mceSelectList"><option value="">{$lang_theme_fontdefault}</option>';
-				var iFonts = 'Arial=arial,helvetica,sans-serif;Courier New=courier new,courier,monospace;Georgia=georgia,times new roman,times,serif;Tahoma=tahoma,arial,helvetica,sans-serif;Times New Roman=times new roman,times,serif;Verdana=verdana,arial,helvetica,sans-serif;Impact=impact;WingDings=wingdings';
-				var nFonts = 'Andale Mono=andale mono,times;Arial=arial,helvetica,sans-serif;Arial Black=arial black,avant garde;Book Antiqua=book antiqua,palatino;Comic Sans MS=comic sans ms,sand;Courier New=courier new,courier;Georgia=georgia,palatino;Helvetica=helvetica;Impact=impact,chicago;Symbol=symbol;Tahoma=tahoma,arial,helvetica,sans-serif;Terminal=terminal,monaco;Times New Roman=times new roman,times;Trebuchet MS=trebuchet ms,geneva;Verdana=verdana,geneva;Webdings=webdings;Wingdings=wingdings,zapf dingbats';
-				var fonts = tinyMCE.getParam("theme_advanced_fonts", nFonts).split(';');
-				for (i=0; i<fonts.length; i++) {
-					if (fonts[i] != '') {
-						var parts = fonts[i].split('=');
-						fontHTML += '<option value="' + parts[1] + '">' + parts[0] + '</option>';
+		// Control name lookup, format: title, command
+		controls : {
+			bold : ['bold_desc', 'Bold'],
+			italic : ['italic_desc', 'Italic'],
+			underline : ['underline_desc', 'Underline'],
+			strikethrough : ['striketrough_desc', 'Strikethrough'],
+			justifyleft : ['justifyleft_desc', 'JustifyLeft'],
+			justifycenter : ['justifycenter_desc', 'JustifyCenter'],
+			justifyright : ['justifyright_desc', 'JustifyRight'],
+			justifyfull : ['justifyfull_desc', 'JustifyFull'],
+			bullist : ['bullist_desc', 'InsertUnorderedList'],
+			numlist : ['numlist_desc', 'InsertOrderedList'],
+			outdent : ['outdent_desc', 'Outdent'],
+			indent : ['indent_desc', 'Indent'],
+			cut : ['cut_desc', 'Cut'],
+			copy : ['copy_desc', 'Copy'],
+			paste : ['paste_desc', 'Paste'],
+			undo : ['undo_desc', 'Undo'],
+			redo : ['redo_desc', 'Redo'],
+			link : ['link_desc', 'mceLink'],
+			unlink : ['unlink_desc', 'unlink'],
+			image : ['image_desc', 'mceImage'],
+			cleanup : ['cleanup_desc', 'mceCleanup'],
+			help : ['help_desc', 'mceHelp'],
+			code : ['code_desc', 'mceCodeEditor'],
+			hr : ['hr_desc', 'InsertHorizontalRule'],
+			removeformat : ['removeformat_desc', 'RemoveFormat'],
+			sub : ['sub_desc', 'subscript'],
+			sup : ['sup_desc', 'superscript'],
+			forecolor : ['forecolor_desc', 'ForeColor'],
+			forecolorpicker : ['forecolor_desc', 'mceForeColor'],
+			backcolor : ['backcolor_desc', 'HiliteColor'],
+			backcolorpicker : ['backcolor_desc', 'mceBackColor'],
+			charmap : ['charmap_desc', 'mceCharMap'],
+			visualaid : ['visualaid_desc', 'mceToggleVisualAid'],
+			anchor : ['anchor_desc', 'mceInsertAnchor'],
+			newdocument : ['newdocument_desc', 'mceNewDocument'],
+			blockquote : ['blockquote_desc', 'mceBlockQuote']
+		},
+
+		stateControls : ['bold', 'italic', 'underline', 'strikethrough', 'bullist', 'numlist', 'justifyleft', 'justifycenter', 'justifyright', 'justifyfull', 'sub', 'sup', 'blockquote'],
+
+		init : function(ed, url) {
+			var t = this, s, v, o;
+	
+			t.editor = ed;
+			t.url = url;
+			t.onResolveName = new tinymce.util.Dispatcher(this);
+
+			// Default settings
+			t.settings = s = extend({
+				theme_advanced_path : true,
+				theme_advanced_toolbar_location : 'bottom',
+				theme_advanced_buttons1 : "bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,styleselect,formatselect",
+				theme_advanced_buttons2 : "bullist,numlist,|,outdent,indent,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code",
+				theme_advanced_buttons3 : "hr,removeformat,visualaid,|,sub,sup,|,charmap",
+				theme_advanced_blockformats : "p,address,pre,h1,h2,h3,h4,h5,h6",
+				theme_advanced_toolbar_align : "center",
+				theme_advanced_fonts : "Andale Mono=andale mono,times;Arial=arial,helvetica,sans-serif;Arial Black=arial black,avant garde;Book Antiqua=book antiqua,palatino;Comic Sans MS=comic sans ms,sans-serif;Courier New=courier new,courier;Georgia=georgia,palatino;Helvetica=helvetica;Impact=impact,chicago;Symbol=symbol;Tahoma=tahoma,arial,helvetica,sans-serif;Terminal=terminal,monaco;Times New Roman=times new roman,times;Trebuchet MS=trebuchet ms,geneva;Verdana=verdana,geneva;Webdings=webdings;Wingdings=wingdings,zapf dingbats",
+				theme_advanced_more_colors : 1,
+				theme_advanced_row_height : 23,
+				theme_advanced_resize_horizontal : 1,
+				theme_advanced_resizing_use_cookie : 1,
+				theme_advanced_font_sizes : "1,2,3,4,5,6,7",
+				readonly : ed.settings.readonly
+			}, ed.settings);
+
+			// Setup default font_size_style_values
+			if (!s.font_size_style_values)
+				s.font_size_style_values = "8pt,10pt,12pt,14pt,18pt,24pt,36pt";
+
+			if (tinymce.is(s.theme_advanced_font_sizes, 'string')) {
+				s.font_size_style_values = tinymce.explode(s.font_size_style_values);
+				s.font_size_classes = tinymce.explode(s.font_size_classes || '');
+
+				// Parse string value
+				o = {};
+				ed.settings.theme_advanced_font_sizes = s.theme_advanced_font_sizes;
+				each(ed.getParam('theme_advanced_font_sizes', '', 'hash'), function(v, k) {
+					var cl;
+
+					if (k == v && v >= 1 && v <= 7) {
+						k = v + ' (' + t.sizes[v - 1] + 'pt)';
+
+						if (ed.settings.convert_fonts_to_spans) {
+							cl = s.font_size_classes[v - 1];
+							v = s.font_size_style_values[v - 1] || (t.sizes[v - 1] + 'pt');
+						}
 					}
-				}
-
-				fontHTML += '</select>';
-				return fontHTML;
 
-			case "fontsizeselect":
-				return '<select id="{$editor_id}_fontSizeSelect" name="{$editor_id}_fontSizeSelect" onfocus="tinyMCE.addSelectAccessibility(event, this, window);" onchange="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'FontSize\',false,this.options[this.selectedIndex].value);" class="mceSelectList">'+
-						'<option value="0">{$lang_theme_font_size}</option>'+
-						'<option value="1">1 (8 pt)</option>'+
-						'<option value="2">2 (10 pt)</option>'+
-						'<option value="3">3 (12 pt)</option>'+
-						'<option value="4">4 (14 pt)</option>'+
-						'<option value="5">5 (18 pt)</option>'+
-						'<option value="6">6 (24 pt)</option>'+
-						'<option value="7">7 (36 pt)</option>'+
-						'</select>';
-
-			case "|":
-			case "separator":
-				return '<img src="{$themeurl}/images/separator.gif" width="2" height="20" class="mceSeparatorLine" />';
+					if (/^\s*\./.test(v))
+						cl = v.replace(/\./g, '');
 
-			case "spacer":
-				return '<img src="{$themeurl}/images/separator.gif" width="2" height="15" border="0" class="mceSeparatorLine" style="vertical-align: middle" />';
-
-			case "rowseparator":
-				return '<br />';
-		}
+					o[k] = cl ? {'class' : cl} : {fontSize : v};
+				});
 
-		return "";
-	},
+				s.theme_advanced_font_sizes = o;
+			}
 
-	/**
-	 * Theme specific execcommand handling.
-	 */
-	execCommand : function(editor_id, element, command, user_interface, value) {
-		switch (command) {
-			case 'mceHelp':
-				tinyMCE.openWindow({
-					file : 'about.htm',
-					width : 480,
-					height : 380
-				}, {
-					tinymce_version : tinyMCE.majorVersion + "." + tinyMCE.minorVersion,
-					tinymce_releasedate : tinyMCE.releaseDate,
-					inline : "yes"
-				});
-			return true;
+			if ((v = s.theme_advanced_path_location) && v != 'none')
+				s.theme_advanced_statusbar_location = s.theme_advanced_path_location;
 
-			case "mceLink":
-				var inst = tinyMCE.getInstanceById(editor_id);
-				var doc = inst.getDoc();
-				var selectedText = "";
-
-				if (tinyMCE.isMSIE) {
-					var rng = doc.selection.createRange();
-					selectedText = rng.text;
-				} else
-					selectedText = inst.getSel().toString();
+			if (s.theme_advanced_statusbar_location == 'none')
+				s.theme_advanced_statusbar_location = 0;
 
-				if (!tinyMCE.linkElement) {
-					if ((tinyMCE.selectedElement.nodeName.toLowerCase() != "img") && (selectedText.length <= 0))
-						return true;
+			// Init editor
+			ed.onInit.add(function() {
+				ed.onNodeChange.add(t._nodeChanged, t);
+
+				if (ed.settings.content_css !== false)
+					ed.dom.loadCSS(ed.baseURI.toAbsolute("themes/advanced/skins/" + ed.settings.skin + "/content.css"));
+			});
+
+			ed.onSetProgressState.add(function(ed, b, ti) {
+				var co, id = ed.id, tb;
+
+				if (b) {
+					t.progressTimer = setTimeout(function() {
+						co = ed.getContainer();
+						co = co.insertBefore(DOM.create('DIV', {style : 'position:relative'}), co.firstChild);
+						tb = DOM.get(ed.id + '_tbl');
+
+						DOM.add(co, 'div', {id : id + '_blocker', 'class' : 'mceBlocker', style : {width : tb.clientWidth + 2, height : tb.clientHeight + 2}});
+						DOM.add(co, 'div', {id : id + '_progress', 'class' : 'mceProgress', style : {left : tb.clientWidth / 2, top : tb.clientHeight / 2}});
+					}, ti || 0);
+				} else {
+					DOM.remove(id + '_blocker');
+					DOM.remove(id + '_progress');
+					clearTimeout(t.progressTimer);
 				}
+			});
 
-				var href = "", target = "", title = "", onclick = "", action = "insert", style_class = "";
+			DOM.loadCSS(s.editor_css ? ed.documentBaseURI.toAbsolute(s.editor_css) : url + "/skins/" + ed.settings.skin + "/ui.css");
 
-				if (tinyMCE.selectedElement.nodeName.toLowerCase() == "a")
-					tinyMCE.linkElement = tinyMCE.selectedElement;
+			if (s.skin_variant)
+				DOM.loadCSS(url + "/skins/" + ed.settings.skin + "/ui_" + s.skin_variant + ".css");
+		},
 
-				// Is anchor not a link
-				if (tinyMCE.linkElement != null && tinyMCE.getAttrib(tinyMCE.linkElement, 'href') == "")
-					tinyMCE.linkElement = null;
+		createControl : function(n, cf) {
+			var cd, c;
 
-				if (tinyMCE.linkElement) {
-					href = tinyMCE.getAttrib(tinyMCE.linkElement, 'href');
-					target = tinyMCE.getAttrib(tinyMCE.linkElement, 'target');
-					title = tinyMCE.getAttrib(tinyMCE.linkElement, 'title');
-					onclick = tinyMCE.getAttrib(tinyMCE.linkElement, 'onclick');
-					style_class = tinyMCE.getAttrib(tinyMCE.linkElement, 'class');
+			if (c = cf.createControl(n))
+				return c;
 
-					// Try old onclick to if copy/pasted content
-					if (onclick == "")
-						onclick = tinyMCE.getAttrib(tinyMCE.linkElement, 'onclick');
+			switch (n) {
+				case "styleselect":
+					return this._createStyleSelect();
 
-					onclick = tinyMCE.cleanupEventStr(onclick);
+				case "formatselect":
+					return this._createBlockFormats();
 
-					href = eval(tinyMCE.settings['urlconverter_callback'] + "(href, tinyMCE.linkElement, true);");
+				case "fontselect":
+					return this._createFontSelect();
 
-					// Use mce_href if defined
-					mceRealHref = tinyMCE.getAttrib(tinyMCE.linkElement, 'mce_href');
-					if (mceRealHref != "") {
-						href = mceRealHref;
+				case "fontsizeselect":
+					return this._createFontSizeSelect();
 
-						if (tinyMCE.getParam('convert_urls'))
-							href = eval(tinyMCE.settings['urlconverter_callback'] + "(href, tinyMCE.linkElement, true);");
-					}
+				case "forecolor":
+					return this._createForeColorMenu();
 
-					action = "update";
-				}
+				case "backcolor":
+					return this._createBackColorMenu();
+			}
 
-				var template = new Array();
+			if ((cd = this.controls[n]))
+				return cf.createButton(n, {title : "advanced." + cd[0], cmd : cd[1], ui : cd[2], value : cd[3]});
+		},
 
-				template['file'] = 'link.htm';
-				template['width'] = 310;
-				template['height'] = 200;
-
-				// Language specific width and height addons
-				template['width'] += tinyMCE.getLang('lang_insert_link_delta_width', 0);
-				template['height'] += tinyMCE.getLang('lang_insert_link_delta_height', 0);
-
-				if (inst.settings['insertlink_callback']) {
-					var returnVal = eval(inst.settings['insertlink_callback'] + "(href, target, title, onclick, action, style_class);");
-					if (returnVal && returnVal['href'])
-						TinyMCE_AdvancedTheme._insertLink(returnVal['href'], returnVal['target'], returnVal['title'], returnVal['onclick'], returnVal['style_class']);
-				} else {
-					tinyMCE.openWindow(template, {href : href, target : target, title : title, onclick : onclick, action : action, className : style_class, inline : "yes"});
-				}
+		execCommand : function(cmd, ui, val) {
+			var f = this['_' + cmd];
 
+			if (f) {
+				f.call(this, ui, val);
 				return true;
+			}
 
-			case "mceImage":
-				var src = "", alt = "", border = "", hspace = "", vspace = "", width = "", height = "", align = "";
-				var title = "", onmouseover = "", onmouseout = "", action = "insert";
-				var img = tinyMCE.imgElement;
-				var inst = tinyMCE.getInstanceById(editor_id);
-
-				if (tinyMCE.selectedElement != null && tinyMCE.selectedElement.nodeName.toLowerCase() == "img") {
-					img = tinyMCE.selectedElement;
-					tinyMCE.imgElement = img;
-				}
+			return false;
+		},
 
-				if (img) {
-					// Is it a internal MCE visual aid image, then skip this one.
-					if (tinyMCE.getAttrib(img, 'name').indexOf('mce_') == 0)
-						return true;
-
-					src = tinyMCE.getAttrib(img, 'src');
-					alt = tinyMCE.getAttrib(img, 'alt');
-
-					// Try polling out the title
-					if (alt == "")
-						alt = tinyMCE.getAttrib(img, 'title');
-
-					// Fix width/height attributes if the styles is specified
-					if (tinyMCE.isGecko) {
-						var w = img.style.width;
-						if (w != null && w != "")
-							img.setAttribute("width", w);
-
-						var h = img.style.height;
-						if (h != null && h != "")
-							img.setAttribute("height", h);
-					}
+		_importClasses : function(e) {
+			var ed = this.editor, c = ed.controlManager.get('styleselect');
 
-					border = tinyMCE.getAttrib(img, 'border');
-					hspace = tinyMCE.getAttrib(img, 'hspace');
-					vspace = tinyMCE.getAttrib(img, 'vspace');
-					width = tinyMCE.getAttrib(img, 'width');
-					height = tinyMCE.getAttrib(img, 'height');
-					align = tinyMCE.getAttrib(img, 'align');
-					onmouseover = tinyMCE.getAttrib(img, 'onmouseover');
-					onmouseout = tinyMCE.getAttrib(img, 'onmouseout');
-					title = tinyMCE.getAttrib(img, 'title');
-
-					// Is realy specified?
-					if (tinyMCE.isMSIE) {
-						width = img.attributes['width'].specified ? width : "";
-						height = img.attributes['height'].specified ? height : "";
-					}
+			if (c.getLength() == 0) {
+				each(ed.dom.getClasses(), function(o) {
+					c.add(o['class'], o['class']);
+				});
+			}
+		},
 
-					//onmouseover = tinyMCE.getImageSrc(tinyMCE.cleanupEventStr(onmouseover));
-					//onmouseout = tinyMCE.getImageSrc(tinyMCE.cleanupEventStr(onmouseout));
+		_createStyleSelect : function(n) {
+			var t = this, ed = t.editor, cf = ed.controlManager, c = cf.createListBox('styleselect', {
+				title : 'advanced.style_select',
+				onselect : function(v) {
+					if (c.selectedValue === v) {
+						ed.execCommand('mceSetStyleInfo', 0, {command : 'removeformat'});
+						c.select();
+						return false;
+					} else
+						ed.execCommand('mceSetCSSClass', 0, v);
+				}
+			});
+
+			if (c) {
+				each(ed.getParam('theme_advanced_styles', '', 'hash'), function(v, k) {
+					if (v)
+						c.add(t.editor.translate(k), v);
+				});
 
-					src = eval(tinyMCE.settings['urlconverter_callback'] + "(src, img, true);");
+				c.onPostRender.add(function(ed, n) {
+					if (!c.NativeListBox) {
+						Event.add(n.id + '_text', 'focus', t._importClasses, t);
+						Event.add(n.id + '_text', 'mousedown', t._importClasses, t);
+						Event.add(n.id + '_open', 'focus', t._importClasses, t);
+						Event.add(n.id + '_open', 'mousedown', t._importClasses, t);
+					} else
+						Event.add(n.id, 'focus', t._importClasses, t);
+				});
+			}
 
-					// Use mce_src if defined
-					mceRealSrc = tinyMCE.getAttrib(img, 'mce_src');
-					if (mceRealSrc != "") {
-						src = mceRealSrc;
+			return c;
+		},
 
-						if (tinyMCE.getParam('convert_urls'))
-							src = eval(tinyMCE.settings['urlconverter_callback'] + "(src, img, true);");
-					}
+		_createFontSelect : function() {
+			var c, t = this, ed = t.editor;
 
-					//if (onmouseover != "")
-					//	onmouseover = eval(tinyMCE.settings['urlconverter_callback'] + "(onmouseover, img, true);");
+			c = ed.controlManager.createListBox('fontselect', {title : 'advanced.fontdefault', cmd : 'FontName'});
+			if (c) {
+				each(ed.getParam('theme_advanced_fonts', t.settings.theme_advanced_fonts, 'hash'), function(v, k) {
+					c.add(ed.translate(k), v, {style : v.indexOf('dings') == -1 ? 'font-family:' + v : ''});
+				});
+			}
 
-					//if (onmouseout != "")
-					//	onmouseout = eval(tinyMCE.settings['urlconverter_callback'] + "(onmouseout, img, true);");
+			return c;
+		},
 
-					action = "update";
-				}
+		_createFontSizeSelect : function() {
+			var t = this, ed = t.editor, c, i = 0, cl = [];
 
-				var template = new Array();
+			c = ed.controlManager.createListBox('fontsizeselect', {title : 'advanced.font_size', onselect : function(v) {
+				if (v.fontSize)
+					ed.execCommand('FontSize', false, v.fontSize);
+				else {
+					each(t.settings.theme_advanced_font_sizes, function(v, k) {
+						if (v['class'])
+							cl.push(v['class']);
+					});
 
-				template['file'] = 'image.htm?src={$src}';
-				template['width'] = 355;
-				template['height'] = 265 + (tinyMCE.isMSIE ? 25 : 0);
-
-				// Language specific width and height addons
-				template['width'] += tinyMCE.getLang('lang_insert_image_delta_width', 0);
-				template['height'] += tinyMCE.getLang('lang_insert_image_delta_height', 0);
-
-				if (inst.settings['insertimage_callback']) {
-					var returnVal = eval(inst.settings['insertimage_callback'] + "(src, alt, border, hspace, vspace, width, height, align, title, onmouseover, onmouseout, action);");
-					if (returnVal && returnVal['src'])
-						TinyMCE_AdvancedTheme._insertImage(returnVal['src'], returnVal['alt'], returnVal['border'], returnVal['hspace'], returnVal['vspace'], returnVal['width'], returnVal['height'], returnVal['align'], returnVal['title'], returnVal['onmouseover'], returnVal['onmouseout']);
-				} else
-					tinyMCE.openWindow(template, {src : src, alt : alt, border : border, hspace : hspace, vspace : vspace, width : width, height : height, align : align, title : title, onmouseover : onmouseover, onmouseout : onmouseout, action : action, inline : "yes"});
+					ed.editorCommands._applyInlineStyle('span', {'class' : v['class']}, {check_classes : cl});
+				}
+			}});
 
-				return true;
+			if (c) {
+				each(t.settings.theme_advanced_font_sizes, function(v, k) {
+					var fz = v.fontSize;
 
-			case "forecolor":
-				var fcp = new TinyMCE_Layer(editor_id + '_fcPreview', false), p, img, elm;
+					if (fz >= 1 && fz <= 7)
+						fz = t.sizes[parseInt(fz) - 1] + 'pt';
 
-				TinyMCE_AdvancedTheme._hideMenus(editor_id);
+					c.add(k, v, {'style' : 'font-size:' + fz, 'class' : 'mceFontSize' + (i++) + (' ' + (v['class'] || ''))});
+				});
+			}
 
-				if (!fcp.exists()) {
-					fcp.create('div', 'mceColorPreview', document.getElementById(editor_id + '_toolbar'));
-					elm = fcp.getElement();
-					elm._editor_id = editor_id;
-					elm._command = "forecolor";
-					elm._switchId = editor_id + "_forecolor";
-					tinyMCE.addEvent(elm, 'click', TinyMCE_AdvancedTheme._handleMenuEvent);
-					tinyMCE.addEvent(elm, 'mouseover', TinyMCE_AdvancedTheme._handleMenuEvent);
-					tinyMCE.addEvent(elm, 'mouseout', TinyMCE_AdvancedTheme._handleMenuEvent);
-				}
+			return c;
+		},
 
-				img = tinyMCE.selectNodes(document.getElementById(editor_id + "_forecolor"), function(n) {return n.nodeName == "IMG";})[0];
-				p = tinyMCE.getAbsPosition(img, document.getElementById(editor_id + '_toolbar'));
+		_createBlockFormats : function() {
+			var c, fmts = {
+				p : 'advanced.paragraph',
+				address : 'advanced.address',
+				pre : 'advanced.pre',
+				h1 : 'advanced.h1',
+				h2 : 'advanced.h2',
+				h3 : 'advanced.h3',
+				h4 : 'advanced.h4',
+				h5 : 'advanced.h5',
+				h6 : 'advanced.h6',
+				div : 'advanced.div',
+				blockquote : 'advanced.blockquote',
+				code : 'advanced.code',
+				dt : 'advanced.dt',
+				dd : 'advanced.dd',
+				samp : 'advanced.samp'
+			}, t = this;
+
+			c = t.editor.controlManager.createListBox('formatselect', {title : 'advanced.block', cmd : 'FormatBlock'});
+			if (c) {
+				each(t.editor.getParam('theme_advanced_blockformats', t.settings.theme_advanced_blockformats, 'hash'), function(v, k) {
+					c.add(t.editor.translate(k != v ? k : fmts[v]), v, {'class' : 'mce_formatPreview mce_' + v});
+				});
+			}
 
-				fcp.moveTo(p.absLeft, p.absTop);
-				fcp.getElement().style.backgroundColor = value != null ? value : tinyMCE.getInstanceById(editor_id).foreColor;
-				fcp.show();
+			return c;
+		},
 
-				return false;
+		_createForeColorMenu : function() {
+			var c, t = this, s = t.settings, o = {}, v;
 
-			case "forecolorMenu":
-				TinyMCE_AdvancedTheme._hideMenus(editor_id);
+			if (s.theme_advanced_more_colors) {
+				o.more_colors_func = function() {
+					t._mceColorPicker(0, {
+						color : c.value,
+						func : function(co) {
+							c.setColor(co);
+						}
+					});
+				};
+			}
 
-				// Create color layer
-				var ml = new TinyMCE_Layer(editor_id + '_fcMenu');
+			if (v = s.theme_advanced_text_colors)
+				o.colors = v;
 
-				if (!ml.exists())
-					ml.create('div', 'mceMenu', document.body, TinyMCE_AdvancedTheme._getColorHTML(editor_id, 'theme_advanced_text_colors', 'forecolor'));
+			if (s.theme_advanced_default_foreground_color)
+				o.default_color = s.theme_advanced_default_foreground_color;
 
-				tinyMCE.switchClass(editor_id + '_forecolor', 'mceMenuButtonFocus');
-				ml.moveRelativeTo(document.getElementById(editor_id + "_forecolor"), 'bl');
+			o.title = 'advanced.forecolor_desc';
+			o.cmd = 'ForeColor';
+			o.scope = this;
+
+			c = t.editor.controlManager.createColorSplitButton('forecolor', o);
+
+			return c;
+		},
+
+		_createBackColorMenu : function() {
+			var c, t = this, s = t.settings, o = {}, v;
+
+			if (s.theme_advanced_more_colors) {
+				o.more_colors_func = function() {
+					t._mceColorPicker(0, {
+						color : c.value,
+						func : function(co) {
+							c.setColor(co);
+						}
+					});
+				};
+			}
 
-				ml.moveBy(tinyMCE.isMSIE && !tinyMCE.isOpera ? -1 : 1, -1);
+			if (v = s.theme_advanced_background_colors)
+				o.colors = v;
 
-				if (tinyMCE.isOpera)
-					ml.moveBy(0, -2);
+			if (s.theme_advanced_default_background_color)
+				o.default_color = s.theme_advanced_default_background_color;
 
-				ml.show();
-			return true;
+			o.title = 'advanced.backcolor_desc';
+			o.cmd = 'HiliteColor';
+			o.scope = this;
 
-			case "HiliteColor":
-				var bcp = new TinyMCE_Layer(editor_id + '_bcPreview', false), p, img;
+			c = t.editor.controlManager.createColorSplitButton('backcolor', o);
 
-				TinyMCE_AdvancedTheme._hideMenus(editor_id);
+			return c;
+		},
 
-				if (!bcp.exists()) {
-					bcp.create('div', 'mceColorPreview', document.getElementById(editor_id + '_toolbar'));
-					elm = bcp.getElement();
-					elm._editor_id = editor_id;
-					elm._command = "HiliteColor";
-					elm._switchId = editor_id + "_backcolor";
-					tinyMCE.addEvent(elm, 'click', TinyMCE_AdvancedTheme._handleMenuEvent);
-					tinyMCE.addEvent(elm, 'mouseover', TinyMCE_AdvancedTheme._handleMenuEvent);
-					tinyMCE.addEvent(elm, 'mouseout', TinyMCE_AdvancedTheme._handleMenuEvent);
-				}
+		renderUI : function(o) {
+			var n, ic, tb, t = this, ed = t.editor, s = t.settings, sc, p, nl;
 
-				img = tinyMCE.selectNodes(document.getElementById(editor_id + "_backcolor"), function(n) {return n.nodeName == "IMG";})[0];
-				p = tinyMCE.getAbsPosition(img, document.getElementById(editor_id + '_toolbar'));
+			n = p = DOM.create('span', {id : ed.id + '_parent', 'class' : 'mceEditor ' + ed.settings.skin + 'Skin' + (s.skin_variant ? ' ' + ed.settings.skin + 'Skin' + t._ufirst(s.skin_variant) : '')});
 
-				bcp.moveTo(p.absLeft, p.absTop);
-				bcp.getElement().style.backgroundColor = value != null ? value : tinyMCE.getInstanceById(editor_id).backColor;
-				bcp.show();
+			if (!DOM.boxModel)
+				n = DOM.add(n, 'div', {'class' : 'mceOldBoxModel'});
 
-				return false;
+			n = sc = DOM.add(n, 'table', {id : ed.id + '_tbl', 'class' : 'mceLayout', cellSpacing : 0, cellPadding : 0});
+			n = tb = DOM.add(n, 'tbody');
 
-			case "HiliteColorMenu":
-				TinyMCE_AdvancedTheme._hideMenus(editor_id);
+			switch ((s.theme_advanced_layout_manager || '').toLowerCase()) {
+				case "rowlayout":
+					ic = t._rowLayout(s, tb, o);
+					break;
 
-				// Create color layer
-				var ml = new TinyMCE_Layer(editor_id + '_bcMenu');
+				case "customlayout":
+					ic = ed.execCallback("theme_advanced_custom_layout", s, tb, o, p);
+					break;
 
-				if (!ml.exists())
-					ml.create('div', 'mceMenu', document.body, TinyMCE_AdvancedTheme._getColorHTML(editor_id, 'theme_advanced_background_colors', 'HiliteColor'));
+				default:
+					ic = t._simpleLayout(s, tb, o, p);
+			}
 
-				tinyMCE.switchClass(editor_id + '_backcolor', 'mceMenuButtonFocus');
-				ml.moveRelativeTo(document.getElementById(editor_id + "_backcolor"), 'bl');
+			n = o.targetNode;
 
-				ml.moveBy(tinyMCE.isMSIE && !tinyMCE.isOpera ? -1 : 1, -1);
+			// Add classes to first and last TRs
+			nl = DOM.stdMode ? sc.getElementsByTagName('tr') : sc.rows; // Quick fix for IE 8
+			DOM.addClass(nl[0], 'mceFirst');
+			DOM.addClass(nl[nl.length - 1], 'mceLast');
+
+			// Add classes to first and last TDs
+			each(DOM.select('tr', tb), function(n) {
+				DOM.addClass(n.firstChild, 'mceFirst');
+				DOM.addClass(n.childNodes[n.childNodes.length - 1], 'mceLast');
+			});
 
-				if (tinyMCE.isOpera)
-					ml.moveBy(0, -2);
+			if (DOM.get(s.theme_advanced_toolbar_container))
+				DOM.get(s.theme_advanced_toolbar_container).appendChild(p);
+			else
+				DOM.insertAfter(p, n);
 
-				ml.show();
-			return true;
+			Event.add(ed.id + '_path_row', 'click', function(e) {
+				e = e.target;
 
-			case "mceColorPicker":
-				if (user_interface) {
-					var template = new Array();
-					var inputColor = value['document'].getElementById(value['element_id']).value;
+				if (e.nodeName == 'A') {
+					t._sel(e.className.replace(/^.*mcePath_([0-9]+).*$/, '$1'));
 
-					template['file'] = 'color_picker.htm';
-					template['width'] = 220;
-					template['height'] = 190;
-					template['close_previous'] = "no";
+					return Event.cancel(e);
+				}
+			});
+/*
+			if (DOM.get(ed.id + '_path_row')) {
+				Event.add(ed.id + '_tbl', 'mouseover', function(e) {
+					var re;
+	
+					e = e.target;
+
+					if (e.nodeName == 'SPAN' && DOM.hasClass(e.parentNode, 'mceButton')) {
+						re = DOM.get(ed.id + '_path_row');
+						t.lastPath = re.innerHTML;
+						DOM.setHTML(re, e.parentNode.title);
+					}
+				});
 
-					template['width'] += tinyMCE.getLang('lang_theme_advanced_colorpicker_delta_width', 0);
-					template['height'] += tinyMCE.getLang('lang_theme_advanced_colorpicker_delta_height', 0);
+				Event.add(ed.id + '_tbl', 'mouseout', function(e) {
+					if (t.lastPath) {
+						DOM.setHTML(ed.id + '_path_row', t.lastPath);
+						t.lastPath = 0;
+					}
+				});
+			}
+*/
 
-					if (typeof(value['store_selection']) == "undefined")
-						value['store_selection'] = true;
+			if (!ed.getParam('accessibility_focus'))
+				Event.add(DOM.add(p, 'a', {href : '#'}, '<!-- IE -->'), 'focus', function() {tinyMCE.get(ed.id).focus();});
 
-					tinyMCE.lastColorPickerValue = value;
-					tinyMCE.openWindow(template, {editor_id : editor_id, mce_store_selection : value['store_selection'], inline : "yes", command : "mceColorPicker", input_color : inputColor});
-				} else {
-					var savedVal = tinyMCE.lastColorPickerValue;
-					var elm = savedVal['document'].getElementById(savedVal['element_id']);
-					elm.value = value;
+			if (s.theme_advanced_toolbar_location == 'external')
+				o.deltaHeight = 0;
 
-					if (elm.onchange != null && elm.onchange != '')
-						eval('elm.onchange();');
-				}
-			return true;
+			t.deltaHeight = o.deltaHeight;
+			o.targetNode = null;
+
+			return {
+				iframeContainer : ic,
+				editorContainer : ed.id + '_parent',
+				sizeContainer : sc,
+				deltaHeight : o.deltaHeight
+			};
+		},
+
+		getInfo : function() {
+			return {
+				longname : 'Advanced theme',
+				author : 'Moxiecode Systems AB',
+				authorurl : 'http://tinymce.moxiecode.com',
+				version : tinymce.majorVersion + "." + tinymce.minorVersion
+			}
+		},
 
-			case "mceCodeEditor":
-				var template = new Array();
+		resizeBy : function(dw, dh) {
+			var e = DOM.get(this.editor.id + '_tbl');
 
-				template['file'] = 'source_editor.htm';
-				template['width'] = parseInt(tinyMCE.getParam("theme_advanced_source_editor_width", 720));
-				template['height'] = parseInt(tinyMCE.getParam("theme_advanced_source_editor_height", 580));
+			this.resizeTo(e.clientWidth + dw, e.clientHeight + dh);
+		},
 
-				tinyMCE.openWindow(template, {editor_id : editor_id, resizable : "yes", scrollbars : "no", inline : "yes"});
-				return true;
+		resizeTo : function(w, h) {
+			var ed = this.editor, s = ed.settings, e = DOM.get(ed.id + '_tbl'), ifr = DOM.get(ed.id + '_ifr'), dh;
 
-			case "mceCharMap":
-				var template = new Array();
+			// Boundery fix box
+			w = Math.max(s.theme_advanced_resizing_min_width || 100, w);
+			h = Math.max(s.theme_advanced_resizing_min_height || 100, h);
+			w = Math.min(s.theme_advanced_resizing_max_width || 0xFFFF, w);
+			h = Math.min(s.theme_advanced_resizing_max_height || 0xFFFF, h);
 
-				template['file'] = 'charmap.htm';
-				template['width'] = 550 + (tinyMCE.isOpera ? 40 : 0);
-				template['height'] = 250;
+			// Calc difference between iframe and container
+			dh = e.clientHeight - ifr.clientHeight;
 
-				template['width'] += tinyMCE.getLang('lang_theme_advanced_charmap_delta_width', 0);
-				template['height'] += tinyMCE.getLang('lang_theme_advanced_charmap_delta_height', 0);
+			// Resize iframe and container
+			DOM.setStyle(ifr, 'height', h - dh);
+			DOM.setStyles(e, {width : w, height : h});
+		},
 
-				tinyMCE.openWindow(template, {editor_id : editor_id, inline : "yes"});
-				return true;
+		destroy : function() {
+			var id = this.editor.id;
 
-			case "mceInsertAnchor":
-				var template = new Array();
+			Event.clear(id + '_resize');
+			Event.clear(id + '_path_row');
+			Event.clear(id + '_external_close');
+		},
 
-				template['file'] = 'anchor.htm';
-				template['width'] = 320;
-				template['height'] = 90 + (tinyMCE.isNS7 ? 30 : 0);
+		// Internal functions
 
-				template['width'] += tinyMCE.getLang('lang_theme_advanced_anchor_delta_width', 0);
-				template['height'] += tinyMCE.getLang('lang_theme_advanced_anchor_delta_height', 0);
+		_simpleLayout : function(s, tb, o, p) {
+			var t = this, ed = t.editor, lo = s.theme_advanced_toolbar_location, sl = s.theme_advanced_statusbar_location, n, ic, etb, c;
 
-				tinyMCE.openWindow(template, {editor_id : editor_id, inline : "yes"});
-				return true;
+			if (s.readonly) {
+				n = DOM.add(tb, 'tr');
+				n = ic = DOM.add(n, 'td', {'class' : 'mceIframeContainer'});
+				return ic;
+			}
 
-			case "mceNewDocument":
-				if (confirm(tinyMCE.getLang('lang_newdocument')))
-					tinyMCE.execInstanceCommand(editor_id, 'mceSetContent', false, ' ');
+			// Create toolbar container at top
+			if (lo == 'top')
+				t._addToolbars(tb, o);
+
+			// Create external toolbar
+			if (lo == 'external') {
+				n = c = DOM.create('div', {style : 'position:relative'});
+				n = DOM.add(n, 'div', {id : ed.id + '_external', 'class' : 'mceExternalToolbar'});
+				DOM.add(n, 'a', {id : ed.id + '_external_close', href : 'javascript:;', 'class' : 'mceExternalClose'});
+				n = DOM.add(n, 'table', {id : ed.id + '_tblext', cellSpacing : 0, cellPadding : 0});
+				etb = DOM.add(n, 'tbody');
 
-				return true;
-		}
+				if (p.firstChild.className == 'mceOldBoxModel')
+					p.firstChild.appendChild(c);
+				else
+					p.insertBefore(c, p.firstChild);
 
-		return false;
-	},
+				t._addToolbars(etb, o);
 
-	/**
-	 * Editor instance template function.
-	 */
-	getEditorTemplate : function(settings, editorId) {
-		function removeFromArray(in_array, remove_array) {
-			var outArray = new Array(), skip;
-			
-			for (var i=0; i<in_array.length; i++) {
-				skip = false;
-
-				for (var j=0; j<remove_array.length; j++) {
-					if (in_array[i] == remove_array[j]) {
-						skip = true;
-					}
-				}
+				ed.onMouseUp.add(function() {
+					var e = DOM.get(ed.id + '_external');
+					DOM.show(e);
 
-				if (!skip) {
-					outArray[outArray.length] = in_array[i];
-				}
-			}
+					DOM.hide(lastExtID);
 
-			return outArray;
-		}
+					var f = Event.add(ed.id + '_external_close', 'click', function() {
+						DOM.hide(ed.id + '_external');
+						Event.remove(ed.id + '_external_close', 'click', f);
+					});
 
-		function addToArray(in_array, add_array) {
-			for (var i=0; i<add_array.length; i++) {
-				in_array[in_array.length] = add_array[i];
-			}
+					DOM.show(e);
+					DOM.setStyle(e, 'top', 0 - DOM.getRect(ed.id + '_tblext').h - 1);
 
-			return in_array;
-		}
+					// Fixes IE rendering bug
+					DOM.hide(e);
+					DOM.show(e);
+					e.style.filter = '';
 
-		var template = new Array();
-		var deltaHeight = 0;
-		var resizing = tinyMCE.getParam("theme_advanced_resizing", false);
-		var path = tinyMCE.getParam("theme_advanced_path", true);
-		var statusbarHTML = '<div id="{$editor_id}_path" class="mceStatusbarPathText" style="display: ' + (path ? "block" : "none") + '">&#160;</div><div id="{$editor_id}_resize" class="mceStatusbarResize" style="display: ' + (resizing ? "block" : "none") + '" onmousedown="tinyMCE.themes.advanced._setResizing(event,\'{$editor_id}\',true);"></div><br style="clear: both" />';
-		var layoutManager = tinyMCE.getParam("theme_advanced_layout_manager", "SimpleLayout");
-
-		// Setup style select options -- MOVED UP FOR EXTERNAL TOOLBAR COMPATABILITY!
-		var styleSelectHTML = '<option value="">{$lang_theme_style_select}</option>';
-		if (settings['theme_advanced_styles']) {
-			var stylesAr = settings['theme_advanced_styles'].split(';');
-			
-			for (var i=0; i<stylesAr.length; i++) {
-				var key, value;
+					lastExtID = ed.id + '_external';
+
+					e = null;
+				});
+			}
 
-				key = stylesAr[i].split('=')[0];
-				value = stylesAr[i].split('=')[1];
+			if (sl == 'top')
+				t._addStatusBar(tb, o);
 
-				styleSelectHTML += '<option value="' + value + '">' + key + '</option>';
+			// Create iframe container
+			if (!s.theme_advanced_toolbar_container) {
+				n = DOM.add(tb, 'tr');
+				n = ic = DOM.add(n, 'td', {'class' : 'mceIframeContainer'});
 			}
 
-			TinyMCE_AdvancedTheme._autoImportCSSClasses = false;
-		}
+			// Create toolbar container at bottom
+			if (lo == 'bottom')
+				t._addToolbars(tb, o);
 
-		switch(layoutManager) {
-			case "SimpleLayout" : //the default TinyMCE Layout (for backwards compatibility)...
-				var toolbarHTML = "";
-				var toolbarLocation = tinyMCE.getParam("theme_advanced_toolbar_location", "bottom");
-				var toolbarAlign = tinyMCE.getParam("theme_advanced_toolbar_align", "center");
-				var pathLocation = tinyMCE.getParam("theme_advanced_path_location", "none"); // Compatiblity
-				var statusbarLocation = tinyMCE.getParam("theme_advanced_statusbar_location", pathLocation);
-				var defVals = {
-					theme_advanced_buttons1 : "bold,italic,underline,strikethrough,separator,justifyleft,justifycenter,justifyright,justifyfull,separator,styleselect,formatselect",
-					theme_advanced_buttons2 : "bullist,numlist,separator,outdent,indent,separator,undo,redo,separator,link,unlink,anchor,image,cleanup,help,code",
-					theme_advanced_buttons3 : "hr,removeformat,visualaid,separator,sub,sup,separator,charmap"
-				};
+			if (sl == 'bottom')
+				t._addStatusBar(tb, o);
 
-				// Add accessibility control
-				toolbarHTML += '<a href="#" accesskey="q" title="' + tinyMCE.getLang("lang_toolbar_focus") + '"';
+			return ic;
+		},
 
-				if (!tinyMCE.getParam("accessibility_focus"))
-					toolbarHTML += ' onfocus="tinyMCE.getInstanceById(\'' + editorId + '\').getWin().focus();"';
+		_rowLayout : function(s, tb, o) {
+			var t = this, ed = t.editor, dc, da, cf = ed.controlManager, n, ic, to, a;
 
-				toolbarHTML += '></a>';
+			dc = s.theme_advanced_containers_default_class || '';
+			da = s.theme_advanced_containers_default_align || 'center';
 
-				// Render rows
-				for (var i=1; i<100; i++) {
-					var def = defVals["theme_advanced_buttons" + i];
+			each(explode(s.theme_advanced_containers || ''), function(c, i) {
+				var v = s['theme_advanced_container_' + c] || '';
 
-					var buttons = tinyMCE.getParam("theme_advanced_buttons" + i, def == null ? '' : def, true, ',');
-					if (buttons.length == 0)
+				switch (v.toLowerCase()) {
+					case 'mceeditor':
+						n = DOM.add(tb, 'tr');
+						n = ic = DOM.add(n, 'td', {'class' : 'mceIframeContainer'});
 						break;
 
-					buttons = removeFromArray(buttons, tinyMCE.getParam("theme_advanced_disable", "", true, ','));
-					buttons = addToArray(buttons, tinyMCE.getParam("theme_advanced_buttons" + i + "_add", "", true, ','));
-					buttons = addToArray(tinyMCE.getParam("theme_advanced_buttons" + i + "_add_before", "", true, ','), buttons);
-
-					for (var b=0; b<buttons.length; b++)
-						toolbarHTML += tinyMCE.getControlHTML(buttons[b]);
-
-					if (buttons.length > 0) {
-						toolbarHTML += "<br />";
-						deltaHeight -= 23;
-					}
-				}
+					case 'mceelementpath':
+						t._addStatusBar(tb, o);
+						break;
 
-				// Add accessibility control
-				toolbarHTML += '<a href="#" accesskey="z" onfocus="tinyMCE.getInstanceById(\'' + editorId + '\').getWin().focus();"></a>';
+					default:
+						a = (s['theme_advanced_container_' + c + '_align'] || da).toLowerCase();
+						a = 'mce' + t._ufirst(a);
 
-				// Setup template html
-				template['html'] = '<table class="mceEditor" border="0" cellpadding="0" cellspacing="0" width="{$width}" height="{$height}" style="width:{$width_style};height:{$height_style}"><tbody>';
+						n = DOM.add(DOM.add(tb, 'tr'), 'td', {
+							'class' : 'mceToolbar ' + (s['theme_advanced_container_' + c + '_class'] || dc) + ' ' + a || da
+						});
 
-				if (toolbarLocation == "top") {
-					template['html'] += '<tr><td class="mceToolbarTop" align="' + toolbarAlign + '" height="1" nowrap="nowrap"><span id="' + editorId + '_toolbar" class="mceToolbarContainer">' + toolbarHTML + '</span></td></tr>';
+						to = cf.createToolbar("toolbar" + i);
+						t._addControls(v, to);
+						DOM.setHTML(n, to.renderHTML());
+						o.deltaHeight -= s.theme_advanced_row_height;
 				}
+			});
 
-				if (statusbarLocation == "top") {
-					template['html'] += '<tr><td class="mceStatusbarTop" height="1">' + statusbarHTML + '</td></tr>';
-					deltaHeight -= 23;
-				}
+			return ic;
+		},
 
-				template['html'] += '<tr><td align="center"><span id="{$editor_id}"></span></td></tr>';
+		_addControls : function(v, tb) {
+			var t = this, s = t.settings, di, cf = t.editor.controlManager;
 
-				if (toolbarLocation == "bottom") {
-					template['html'] += '<tr><td class="mceToolbarBottom" align="' + toolbarAlign + '" height="1"><span id="' + editorId + '_toolbar" class="mceToolbarContainer">' + toolbarHTML + '</span></td></tr>';
-				}
+			if (s.theme_advanced_disable && !t._disabled) {
+				di = {};
 
-				// External toolbar changes
-				if (toolbarLocation == "external") {
-					var bod = document.body;
-					var elm = document.createElement ("div");
-
-					toolbarHTML = tinyMCE.replaceVar(toolbarHTML, 'style_select_options', styleSelectHTML);
-					toolbarHTML = tinyMCE.applyTemplate(toolbarHTML, {editor_id : editorId});
-
-					elm.className = "mceToolbarExternal";
-					elm.id = editorId+"_toolbar";
-					elm.innerHTML = '<table width="100%" border="0" align="center"><tr><td align="center">'+toolbarHTML+'</td></tr></table>';
-					bod.appendChild (elm);
-					// bod.style.marginTop = elm.offsetHeight + "px";
+				each(explode(s.theme_advanced_disable), function(v) {
+					di[v] = 1;
+				});
 
-					deltaHeight = 0;
-					tinyMCE.getInstanceById(editorId).toolbarElement = elm;
+				t._disabled = di;
+			} else
+				di = t._disabled;
 
-					//template['html'] = '<div id="mceExternalToolbar" align="center" class="mceToolbarExternal"><table width="100%" border="0" align="center"><tr><td align="center">'+toolbarHTML+'</td></tr></table></div>' + template["html"];
-				} else {
-					tinyMCE.getInstanceById(editorId).toolbarElement = null;
-				}
+			each(explode(v), function(n) {
+				var c;
 
-				if (statusbarLocation == "bottom") {
-					template['html'] += '<tr><td class="mceStatusbarBottom" height="1">' + statusbarHTML + '</td></tr>';
-					deltaHeight -= 23;
-				}
+				if (di && di[n])
+					return;
 
-				template['html'] += '</tbody></table>';
-				//"SimpleLayout"
-			break;
-
-			case "RowLayout" : //Container Layout - containers defined in "theme_advanced_containers" are rendered from top to bottom.
-				template['html'] = '<table class="mceEditor" border="0" cellpadding="0" cellspacing="0" width="{$width}" height="{$height}" style="width:{$width}px;height:{$height}px"><tbody>';
-
-				var containers = tinyMCE.getParam("theme_advanced_containers", "", true, ",");
-				var defaultContainerCSS = tinyMCE.getParam("theme_advanced_containers_default_class", "container");
-				var defaultContainerAlign = tinyMCE.getParam("theme_advanced_containers_default_align", "center");
-
-				//Render Containers:
-				for (var i = 0; i < containers.length; i++)
-				{
-					if (containers[i] == "mceEditor") //Exceptions for mceEditor and ...
-						template['html'] += '<tr><td align="center" class="mceEditor_border"><span id="{$editor_id}"></span></td></tr>';
-					else if (containers[i] == "mceElementpath" || containers[i] == "mceStatusbar") // ... mceElementpath:
-					{
-						var pathClass = "mceStatusbar";
-
-						if (i == containers.length-1)
-						{
-							pathClass = "mceStatusbarBottom";
-						}
-						else if (i == 0)
-						{
-							pathClass = "mceStatusbar";
-						}
-						else
-						{
-							deltaHeight-=2;
-						}
+				// Compatiblity with 2.x
+				if (n == 'tablecontrols') {
+					each(["table","|","row_props","cell_props","|","row_before","row_after","delete_row","|","col_before","col_after","delete_col","|","split_cells","merge_cells"], function(n) {
+						n = t.createControl(n, cf);
 
-						template['html'] += '<tr><td class="' + pathClass + '" height="1">' + statusbarHTML + '</td></tr>';
-						deltaHeight -= 22;
-					} else { // Render normal Container
-						var curContainer = tinyMCE.getParam("theme_advanced_container_"+containers[i], "", true, ',');
-						var curContainerHTML = "";
-						var curAlign = tinyMCE.getParam("theme_advanced_container_"+containers[i]+"_align", defaultContainerAlign);
-						var curCSS = tinyMCE.getParam("theme_advanced_container_"+containers[i]+"_class", defaultContainerCSS);
-
-						curContainer = removeFromArray(curContainer, tinyMCE.getParam("theme_advanced_disable", "", true, ','));
-
-						for (var j=0; j<curContainer.length; j++)
-							curContainerHTML += tinyMCE.getControlHTML(curContainer[j]);
-
-						if (curContainer.length > 0) {
-							curContainerHTML += "<br />";
-							deltaHeight -= 23;
-						}
+						if (n)
+							tb.add(n);
+					});
 
-						template['html'] += '<tr><td class="' + curCSS + '" align="' + curAlign + '" height="1">' + curContainerHTML + '</td></tr>';
-					}
+					return;
 				}
 
-				template['html'] += '</tbody></table>';
-				//RowLayout
-			break;
+				c = t.createControl(n, cf);
 
-			case "CustomLayout" : //User defined layout callback...
-				var customLayout = tinyMCE.getParam("theme_advanced_custom_layout","");
+				if (c)
+					tb.add(c);
+			});
+		},
 
-				if (customLayout != "" && eval("typeof(" + customLayout + ")") != "undefined") {
-					template = eval(customLayout + "(template);");
-				}
-			break;
-		}
+		_addToolbars : function(c, o) {
+			var t = this, i, tb, ed = t.editor, s = t.settings, v, cf = ed.controlManager, di, n, h = [], a;
 
-		if (resizing)
-			template['html'] += '<span id="{$editor_id}_resize_box" class="mceResizeBox"></span>';
+			a = s.theme_advanced_toolbar_align.toLowerCase();
+			a = 'mce' + t._ufirst(a);
 
-		template['html'] = tinyMCE.replaceVar(template['html'], 'style_select_options', styleSelectHTML);
-		template['delta_width'] = 0;
-		template['delta_height'] = deltaHeight;
-
-		return template;
-	},
-
-	initInstance : function(inst) {
-		if (tinyMCE.getParam("theme_advanced_resizing", false)) {
-			if (tinyMCE.getParam("theme_advanced_resizing_use_cookie", true)) {
-				var w = TinyMCE_AdvancedTheme._getCookie("TinyMCE_" + inst.editorId + "_width");
-				var h = TinyMCE_AdvancedTheme._getCookie("TinyMCE_" + inst.editorId + "_height");
+			n = DOM.add(DOM.add(c, 'tr'), 'td', {'class' : 'mceToolbar ' + a});
 
-				TinyMCE_AdvancedTheme._resizeTo(inst, w, h, tinyMCE.getParam("theme_advanced_resize_horizontal", true));
-			}
-		}
+			if (!ed.getParam('accessibility_focus'))
+				h.push(DOM.createHTML('a', {href : '#', onfocus : 'tinyMCE.get(\'' + ed.id + '\').focus();'}, '<!-- IE -->'));
 
-		inst.addShortcut('ctrl', 'k', 'lang_link_desc', 'mceLink');
-	},
+			h.push(DOM.createHTML('a', {href : '#', accesskey : 'q', title : ed.getLang("advanced.toolbar_focus")}, '<!-- IE -->'));
 
-	_handleMenuEvent : function(e) {
-		var te = tinyMCE.isMSIE ? window.event.srcElement : e.target;
-		tinyMCE._menuButtonEvent(e.type == "mouseover" ? "over" : "out", document.getElementById(te._switchId));
-
-		if (e.type == "click")
-			tinyMCE.execInstanceCommand(te._editor_id, te._command);
-	},
-
-	_hideMenus : function(id) {
-		var fcml = new TinyMCE_Layer(id + '_fcMenu'), bcml = new TinyMCE_Layer(id + '_bcMenu');
-
-		if (fcml.exists() && fcml.isVisible()) {
-			tinyMCE.switchClass(id + '_forecolor', 'mceMenuButton');
-			fcml.hide();
-		}
+			// Create toolbar and add the controls
+			for (i=1; (v = s['theme_advanced_buttons' + i]); i++) {
+				tb = cf.createToolbar("toolbar" + i, {'class' : 'mceToolbarRow' + i});
 
-		if (bcml.exists() && bcml.isVisible()) {
-			tinyMCE.switchClass(id + '_backcolor', 'mceMenuButton');
-			bcml.hide();
-		}
-	},
+				if (s['theme_advanced_buttons' + i + '_add'])
+					v += ',' + s['theme_advanced_buttons' + i + '_add'];
 
-	/**
-	 * Node change handler.
-	 */
-	handleNodeChange : function(editor_id, node, undo_index, undo_levels, visual_aid, any_selection, setup_content) {
-		var alignNode, breakOut, classNode;
-
-		function selectByValue(select_elm, value, first_index) {
-			first_index = typeof(first_index) == "undefined" ? false : true;
-
-			if (select_elm) {
-				for (var i=0; i<select_elm.options.length; i++) {
-					var ov = "" + select_elm.options[i].value;
-
-					if (first_index && ov.toLowerCase().indexOf(value.toLowerCase()) == 0) {
-						select_elm.selectedIndex = i;
-						return true;
-					}
+				if (s['theme_advanced_buttons' + i + '_add_before'])
+					v = s['theme_advanced_buttons' + i + '_add_before'] + ',' + v;
 
-					if (ov == value) {
-						select_elm.selectedIndex = i;
-						return true;
-					}
-				}
-			}
-
-			return false;
-		};
+				t._addControls(v, tb);
 
-		function getAttrib(elm, name) {
-			return elm.getAttribute(name) ? elm.getAttribute(name) : "";
-		};
-
-		// No node provided
-		if (node == null)
-			return;
-
-		// Update path
-		var pathElm = document.getElementById(editor_id + "_path");
-		var inst = tinyMCE.getInstanceById(editor_id);
-		var doc = inst.getDoc();
-		TinyMCE_AdvancedTheme._hideMenus(editor_id);
-
-		if (pathElm) {
-			// Get node path
-			var parentNode = node;
-			var path = new Array();
-			
-			while (parentNode != null) {
-				if (parentNode.nodeName.toUpperCase() == "BODY") {
-					break;
-				}
-
-				// Only append element nodes to path
-				if (parentNode.nodeType == 1 && tinyMCE.getAttrib(parentNode, "class").indexOf('mceItemHidden') == -1) {
-					path[path.length] = parentNode;
-				}
+				//n.appendChild(n = tb.render());
+				h.push(tb.renderHTML());
 
-				parentNode = parentNode.parentNode;
+				o.deltaHeight -= s.theme_advanced_row_height;
 			}
 
-			// Setup HTML
-			var html = "";
-			for (var i=path.length-1; i>=0; i--) {
-				var nodeName = path[i].nodeName.toLowerCase();
-				var nodeData = "";
+			h.push(DOM.createHTML('a', {href : '#', accesskey : 'z', title : ed.getLang("advanced.toolbar_focus"), onfocus : 'tinyMCE.getInstanceById(\'' + ed.id + '\').focus();'}, '<!-- IE -->'));
+			DOM.setHTML(n, h.join(''));
+		},
 
-				if (nodeName.indexOf("html:") == 0)
-					nodeName = nodeName.substring(5);
+		_addStatusBar : function(tb, o) {
+			var n, t = this, ed = t.editor, s = t.settings, r, mf, me, td;
 
-				if (nodeName == "b") {
-					nodeName = "strong";
-				}
+			n = DOM.add(tb, 'tr');
+			n = td = DOM.add(n, 'td', {'class' : 'mceStatusbar'});
+			n = DOM.add(n, 'div', {id : ed.id + '_path_row'}, s.theme_advanced_path ? ed.translate('advanced.path') + ': ' : '&#160;');
+			DOM.add(n, 'a', {href : '#', accesskey : 'x'});
 
-				if (nodeName == "i") {
-					nodeName = "em";
-				}
+			if (s.theme_advanced_resizing) {
+				DOM.add(td, 'a', {id : ed.id + '_resize', href : 'javascript:;', onclick : "return false;", 'class' : 'mceResize'});
 
-				if (nodeName == "span") {
-					var cn = tinyMCE.getAttrib(path[i], "class");
-					if (cn != "" && cn.indexOf('mceItem') == -1)
-						nodeData += "class: " + cn + " ";
-
-					var st = tinyMCE.getAttrib(path[i], "style");
-					if (st != "") {
-						st = tinyMCE.serializeStyle(tinyMCE.parseStyle(st));
-						nodeData += "style: " + st + " ";
-					}
-				}
+				if (s.theme_advanced_resizing_use_cookie) {
+					ed.onPostRender.add(function() {
+						var o = Cookie.getHash("TinyMCE_" + ed.id + "_size"), c = DOM.get(ed.id + '_tbl');
 
-				if (nodeName == "font") {
-					if (tinyMCE.getParam("convert_fonts_to_spans"))
-						nodeName = "span";
-
-					var face = tinyMCE.getAttrib(path[i], "face");
-					if (face != "")
-						nodeData += "font: " + face + " ";
-
-					var size = tinyMCE.getAttrib(path[i], "size");
-					if (size != "")
-						nodeData += "size: " + size + " ";
-
-					var color = tinyMCE.getAttrib(path[i], "color");
-					if (color != "")
-						nodeData += "color: " + color + " ";
-				}
-
-				if (getAttrib(path[i], 'id') != "") {
-					nodeData += "id: " + path[i].getAttribute('id') + " ";
-				}
+						if (!o)
+							return;
 
-				var className = tinyMCE.getVisualAidClass(tinyMCE.getAttrib(path[i], "class"), false);
-				if (className != "" && className.indexOf('mceItem') == -1)
-					nodeData += "class: " + className + " ";
+						if (s.theme_advanced_resize_horizontal)
+							c.style.width = Math.max(10, o.cw) + 'px';
 
-				if (getAttrib(path[i], 'src') != "") {
-					var src = tinyMCE.getAttrib(path[i], "mce_src");
-
-					if (src == "")
-						 src = tinyMCE.getAttrib(path[i], "src");
-
-					nodeData += "src: " + src + " ";
+						c.style.height = Math.max(10, o.ch) + 'px';
+						DOM.get(ed.id + '_ifr').style.height = Math.max(10, parseInt(o.ch) + t.deltaHeight) + 'px';
+					});
 				}
 
-				if (path[i].nodeName == 'A' && getAttrib(path[i], 'href') != "") {
-					var href = tinyMCE.getAttrib(path[i], "mce_href");
+				ed.onPostRender.add(function() {
+					Event.add(ed.id + '_resize', 'mousedown', function(e) {
+						var c, p, w, h, n, pa;
 
-					if (href == "")
-						 href = tinyMCE.getAttrib(path[i], "href");
+						// Measure container
+						c = DOM.get(ed.id + '_tbl');
+						w = c.clientWidth;
+						h = c.clientHeight;
 
-					nodeData += "href: " + href + " ";
-				}
+						miw = s.theme_advanced_resizing_min_width || 100;
+						mih = s.theme_advanced_resizing_min_height || 100;
+						maw = s.theme_advanced_resizing_max_width || 0xFFFF;
+						mah = s.theme_advanced_resizing_max_height || 0xFFFF;
 
-				className = tinyMCE.getAttrib(path[i], "class");
-				if ((nodeName == "img" || nodeName == "span") && className.indexOf('mceItem') != -1) {
-					nodeName = className.replace(/mceItem([a-z]+)/gi, '$1').toLowerCase();
-					nodeData = path[i].getAttribute('title');
-				}
+						// Setup placeholder
+						p = DOM.add(DOM.get(ed.id + '_parent'), 'div', {'class' : 'mcePlaceHolder'});
+						DOM.setStyles(p, {width : w, height : h});
 
-				if (nodeName == "a" && (anchor = tinyMCE.getAttrib(path[i], "name")) != "") {
-					nodeName = "a";
-					nodeName += "#" + anchor;
-					nodeData = "";
-				}
+						// Replace with placeholder
+						DOM.hide(c);
+						DOM.show(p);
 
-				if (getAttrib(path[i], 'name').indexOf("mce_") != 0) {
-					var className = tinyMCE.getVisualAidClass(tinyMCE.getAttrib(path[i], "class"), false);
-					if (className != "" && className.indexOf('mceItem') == -1) {
-						nodeName += "." + className;
-					}
-				}
+						// Create internal resize obj
+						r = {
+							x : e.screenX,
+							y : e.screenY,
+							w : w,
+							h : h,
+							dx : null,
+							dy : null
+						};
 
-				var cmd = 'tinyMCE.execInstanceCommand(\'' + editor_id + '\',\'mceSelectNodeDepth\',false,\'' + i + '\');';
-				html += '<a title="' + nodeData + '" href="javascript:' + cmd + '" onclick="' + cmd + 'return false;" onmousedown="return false;" target="_self" class="mcePathItem">' + nodeName + '</a>';
+						// Start listening
+						mf = Event.add(DOM.doc, 'mousemove', function(e) {
+							var w, h;
 
-				if (i > 0) {
-					html += " &raquo; ";
-				}
-			}
+							// Calc delta values
+							r.dx = e.screenX - r.x;
+							r.dy = e.screenY - r.y;
 
-			pathElm.innerHTML = '<a href="#" accesskey="x"></a>' + tinyMCE.getLang('lang_theme_path') + ": " + html + '&#160;';
-		}
+							// Boundery fix box
+							w = Math.max(miw, r.w + r.dx);
+							h = Math.max(mih, r.h + r.dy);
+							w = Math.min(maw, w);
+							h = Math.min(mah, h);
 
-		// Reset old states
-		tinyMCE.switchClass(editor_id + '_justifyleft', 'mceButtonNormal');
-		tinyMCE.switchClass(editor_id + '_justifyright', 'mceButtonNormal');
-		tinyMCE.switchClass(editor_id + '_justifycenter', 'mceButtonNormal');
-		tinyMCE.switchClass(editor_id + '_justifyfull', 'mceButtonNormal');
-		tinyMCE.switchClass(editor_id + '_bold', 'mceButtonNormal');
-		tinyMCE.switchClass(editor_id + '_italic', 'mceButtonNormal');
-		tinyMCE.switchClass(editor_id + '_underline', 'mceButtonNormal');
-		tinyMCE.switchClass(editor_id + '_strikethrough', 'mceButtonNormal');
-		tinyMCE.switchClass(editor_id + '_bullist', 'mceButtonNormal');
-		tinyMCE.switchClass(editor_id + '_numlist', 'mceButtonNormal');
-		tinyMCE.switchClass(editor_id + '_sub', 'mceButtonNormal');
-		tinyMCE.switchClass(editor_id + '_sup', 'mceButtonNormal');
-		tinyMCE.switchClass(editor_id + '_anchor', 'mceButtonNormal');
-		tinyMCE.switchClass(editor_id + '_link', 'mceButtonDisabled');
-		tinyMCE.switchClass(editor_id + '_unlink', 'mceButtonDisabled');
-		tinyMCE.switchClass(editor_id + '_outdent', 'mceButtonDisabled');
-		tinyMCE.switchClass(editor_id + '_image', 'mceButtonNormal');
-		tinyMCE.switchClass(editor_id + '_hr', 'mceButtonNormal');
-
-		if (node.nodeName == "A" && tinyMCE.getAttrib(node, "class").indexOf('mceItemAnchor') != -1)
-			tinyMCE.switchClass(editor_id + '_anchor', 'mceButtonSelected');
-
-		// Get link
-		var anchorLink = tinyMCE.getParentElement(node, "a", "href");
-
-		if (anchorLink || any_selection) {
-			tinyMCE.switchClass(editor_id + '_link', anchorLink ? 'mceButtonSelected' : 'mceButtonNormal');
-			tinyMCE.switchClass(editor_id + '_unlink', anchorLink ? 'mceButtonSelected' : 'mceButtonNormal');
-		}
+							// Resize placeholder
+							if (s.theme_advanced_resize_horizontal)
+								p.style.width = w + 'px';
 
-		// Handle visual aid
-		tinyMCE.switchClass(editor_id + '_visualaid', visual_aid ? 'mceButtonSelected' : 'mceButtonNormal');
+							p.style.height = h + 'px';
 
-		if (undo_levels != -1) {
-			tinyMCE.switchClass(editor_id + '_undo', 'mceButtonDisabled');
-			tinyMCE.switchClass(editor_id + '_redo', 'mceButtonDisabled');
-		}
+							return Event.cancel(e);
+						});
 
-		// Within li, blockquote
-		if (tinyMCE.getParentElement(node, "li,blockquote"))
-			tinyMCE.switchClass(editor_id + '_outdent', 'mceButtonNormal');
-
-		// Has redo levels
-		if (undo_index != -1 && (undo_index < undo_levels-1 && undo_levels > 0))
-			tinyMCE.switchClass(editor_id + '_redo', 'mceButtonNormal');
-
-		// Has undo levels
-		if (undo_index != -1 && (undo_index > 0 && undo_levels > 0))
-			tinyMCE.switchClass(editor_id + '_undo', 'mceButtonNormal');
-
-		// Select class in select box
-		var selectElm = document.getElementById(editor_id + "_styleSelect");
-		
-		if (selectElm) {
-			TinyMCE_AdvancedTheme._setupCSSClasses(editor_id);
-
-			classNode = node;
-			breakOut = false;
-			var index = 0;
-
-			do {
-				if (classNode && classNode.className) {
-					for (var i=0; i<selectElm.options.length; i++) {
-						if (selectElm.options[i].value == classNode.className) {
-							index = i;
-							breakOut = true;
-							break;
-						}
-					}
-				}
-			} while (!breakOut && classNode != null && (classNode = classNode.parentNode) != null);
+						me = Event.add(DOM.doc, 'mouseup', function(e) {
+							var ifr;
 
-			selectElm.selectedIndex = index;
-		}
+							// Stop listening
+							Event.remove(DOM.doc, 'mousemove', mf);
+							Event.remove(DOM.doc, 'mouseup', me);
 
-		// Select formatblock
-		var selectElm = document.getElementById(editor_id + "_formatSelect");
-		if (selectElm) {
-			var elm = tinyMCE.getParentElement(node, "p,div,h1,h2,h3,h4,h5,h6,pre,address");
+							c.style.display = '';
+							DOM.remove(p);
 
-			if (elm)
-				selectByValue(selectElm, "<" + elm.nodeName.toLowerCase() + ">");
-			else
-				selectByValue(selectElm, "");
-		}
+							if (r.dx === null)
+								return;
 
-		// Select fontselect
-		var selectElm = document.getElementById(editor_id + "_fontNameSelect");
-		if (selectElm) {
-			if (!tinyMCE.isSafari && !(tinyMCE.isMSIE && !tinyMCE.isOpera)) {
-				var face = inst.queryCommandValue('FontName');
+							ifr = DOM.get(ed.id + '_ifr');
 
-				face = face == null || face == "" ? "" : face;
+							if (s.theme_advanced_resize_horizontal)
+								c.style.width = Math.max(10, r.w + r.dx) + 'px';
 
-				selectByValue(selectElm, face, face != "");
-			} else {
-				var elm = tinyMCE.getParentElement(node, "font", "face");
+							c.style.height = Math.max(10, r.h + r.dy) + 'px';
+							ifr.style.height = Math.max(10, ifr.clientHeight + r.dy) + 'px';
 
-				if (elm) {
-					var family = tinyMCE.getAttrib(elm, "face");
-
-					if (family == '')
-						family = '' + elm.style.fontFamily;
+							if (s.theme_advanced_resizing_use_cookie) {
+								Cookie.setHash("TinyMCE_" + ed.id + "_size", {
+									cw : r.w + r.dx,
+									ch : r.h + r.dy
+								});
+							}
+						});
 
-					if (!selectByValue(selectElm, family, family != ""))
-						selectByValue(selectElm, "");
-				} else
-					selectByValue(selectElm, "");
+						return Event.cancel(e);
+					});
+				});
 			}
-		}
-
-		// Select fontsize
-		var selectElm = document.getElementById(editor_id + "_fontSizeSelect");
-		if (selectElm) {
-			if (!tinyMCE.isSafari && !tinyMCE.isOpera) {
-				var size = inst.queryCommandValue('FontSize');
-				selectByValue(selectElm, size == null || size == "" ? "0" : size);
-			} else {
-				var elm = tinyMCE.getParentElement(node, "font", "size");
-				if (elm) {
-					var size = tinyMCE.getAttrib(elm, "size");
-
-					if (size == '') {
-						var sizes = new Array('', '8px', '10px', '12px', '14px', '18px', '24px', '36px');
-
-						size = '' + elm.style.fontSize;
-
-						for (var i=0; i<sizes.length; i++) {
-							if (('' + sizes[i]) == size) {
-								size = i;
-								break;
-							}
-						}
-					}
 
-					if (!selectByValue(selectElm, size))
-						selectByValue(selectElm, "");
-				} else
-					selectByValue(selectElm, "0");
+			o.deltaHeight -= 21;
+			n = tb = null;
+		},
+
+		_nodeChanged : function(ed, cm, n, co) {
+			var t = this, p, de = 0, v, c, s = t.settings, cl, fz, fn;
+
+			if (s.readonly)
+				return;
+
+			tinymce.each(t.stateControls, function(c) {
+				cm.setActive(c, ed.queryCommandState(t.controls[c][1]));
+			});
+
+			cm.setActive('visualaid', ed.hasVisual);
+			cm.setDisabled('undo', !ed.undoManager.hasUndo() && !ed.typing);
+			cm.setDisabled('redo', !ed.undoManager.hasRedo());
+			cm.setDisabled('outdent', !ed.queryCommandState('Outdent'));
+
+			p = DOM.getParent(n, 'A');
+			if (c = cm.get('link')) {
+				if (!p || !p.name) {
+					c.setDisabled(!p && co);
+					c.setActive(!!p);
+				}
 			}
-		}
 
-		// Handle align attributes
-		alignNode = node;
-		breakOut = false;
-		do {
-			if (!alignNode.getAttribute || !alignNode.getAttribute('align'))
-				continue;
-
-			switch (alignNode.getAttribute('align').toLowerCase()) {
-				case "left":
-					tinyMCE.switchClass(editor_id + '_justifyleft', 'mceButtonSelected');
-					breakOut = true;
-				break;
-
-				case "right":
-					tinyMCE.switchClass(editor_id + '_justifyright', 'mceButtonSelected');
-					breakOut = true;
-				break;
-
-				case "middle":
-				case "center":
-					tinyMCE.switchClass(editor_id + '_justifycenter', 'mceButtonSelected');
-					breakOut = true;
-				break;
-
-				case "justify":
-					tinyMCE.switchClass(editor_id + '_justifyfull', 'mceButtonSelected');
-					breakOut = true;
-				break;
-			}
-		} while (!breakOut && (alignNode = alignNode.parentNode) != null);
-
-		// Div justification
-		var div = tinyMCE.getParentElement(node, "div");
-		if (div && div.style.textAlign == "center")
-			tinyMCE.switchClass(editor_id + '_justifycenter', 'mceButtonSelected');
-
-		// Do special text
-		if (!setup_content) {
-			// , "JustifyLeft", "_justifyleft", "JustifyCenter", "justifycenter", "JustifyRight", "justifyright", "JustifyFull", "justifyfull", "InsertUnorderedList", "bullist", "InsertOrderedList", "numlist", "InsertUnorderedList", "bullist", "Outdent", "outdent", "Indent", "indent", "subscript", "sub"
-			var ar = new Array("Bold", "_bold", "Italic", "_italic", "Strikethrough", "_strikethrough", "superscript", "_sup", "subscript", "_sub");
-			for (var i=0; i<ar.length; i+=2) {
-				if (inst.queryCommandState(ar[i]))
-					tinyMCE.switchClass(editor_id + ar[i+1], 'mceButtonSelected');
+			if (c = cm.get('unlink')) {
+				c.setDisabled(!p && co);
+				c.setActive(!!p && !p.name);
 			}
 
-			if (inst.queryCommandState("Underline") && (node.parentNode == null || node.parentNode.nodeName != "A"))
-				tinyMCE.switchClass(editor_id + '_underline', 'mceButtonSelected');
-		}
+			if (c = cm.get('anchor')) {
+				c.setActive(!!p && p.name);
 
-		// Handle elements
-		do {
-			switch (node.nodeName) {
-				case "UL":
-					tinyMCE.switchClass(editor_id + '_bullist', 'mceButtonSelected');
-				break;
-
-				case "OL":
-					tinyMCE.switchClass(editor_id + '_numlist', 'mceButtonSelected');
-				break;
-
-				case "HR":
-					 tinyMCE.switchClass(editor_id + '_hr', 'mceButtonSelected');
-				break;
-
-				case "IMG":
-				if (getAttrib(node, 'name').indexOf('mce_') != 0 && tinyMCE.getAttrib(node, 'class').indexOf('mceItem') == -1) {
-					tinyMCE.switchClass(editor_id + '_image', 'mceButtonSelected');
+				if (tinymce.isWebKit) {
+					p = DOM.getParent(n, 'IMG');
+					c.setActive(!!p && DOM.getAttrib(p, 'mce_name') == 'a');
 				}
-				break;
 			}
-		} while ((node = node.parentNode) != null);
-	},
-
-	// Private theme internal functions
-
-	// This function auto imports CSS classes into the class selection droplist
-	_setupCSSClasses : function(editor_id) {
-		var i, selectElm;
 
-		if (!TinyMCE_AdvancedTheme._autoImportCSSClasses)
-			return;
-
-		selectElm = document.getElementById(editor_id + '_styleSelect');
-
-		if (selectElm && selectElm.getAttribute('cssImported') != 'true') {
-			var csses = tinyMCE.getCSSClasses(editor_id);
-			if (csses && selectElm)	{
-				for (i=0; i<csses.length; i++)
-					selectElm.options[selectElm.options.length] = new Option(csses[i], csses[i]);
+			p = DOM.getParent(n, 'IMG');
+			if (c = cm.get('image'))
+				c.setActive(!!p && n.className.indexOf('mceItem') == -1);
+
+			if (c = cm.get('styleselect')) {
+				if (n.className) {
+					t._importClasses();
+					c.select(n.className);
+				} else
+					c.select();
 			}
 
-			// Only do this once
-			if (csses != null && csses.length > 0)
-				selectElm.setAttribute('cssImported', 'true');
-		}
-	},
-
-	_setCookie : function(name, value, expires, path, domain, secure) {
-		var curCookie = name + "=" + escape(value) +
-			((expires) ? "; expires=" + expires.toGMTString() : "") +
-			((path) ? "; path=" + escape(path) : "") +
-			((domain) ? "; domain=" + domain : "") +
-			((secure) ? "; secure" : "");
-
-		document.cookie = curCookie;
-	},
-
-	_getCookie : function(name) {
-		var dc = document.cookie;
-		var prefix = name + "=";
-		var begin = dc.indexOf("; " + prefix);
-
-		if (begin == -1) {
-			begin = dc.indexOf(prefix);
-
-			if (begin != 0)
-				return null;
-		} else
-			begin += 2;
-
-		var end = document.cookie.indexOf(";", begin);
-
-		if (end == -1)
-			end = dc.length;
-
-		return unescape(dc.substring(begin + prefix.length, end));
-	},
-
-	_resizeTo : function(inst, w, h, set_w) {
-		var editorContainer = document.getElementById(inst.editorId + '_parent');
-		var tableElm = editorContainer.firstChild;
-		var iframe = inst.iframeElement;
-
-		if (w == null || w == "null") {
-			set_w = false;
-			w = 0;
-		}
-
-		if (h == null || h == "null")
-			return;
-
-		w = parseInt(w);
-		h = parseInt(h);
-
-		if (tinyMCE.isGecko) {
-			w += 2;
-			h += 2;
-		}
+			if (c = cm.get('formatselect')) {
+				p = DOM.getParent(n, DOM.isBlock);
 
-		var dx = w - tableElm.clientWidth;
-		var dy = h - tableElm.clientHeight;
-
-		w = w < 1 ? 30 : w;
-		h = h < 1 ? 30 : h;
-
-		if (set_w)
-			tableElm.style.width = w + "px";
-
-		tableElm.style.height = h + "px";
-
-		iw = iframe.clientWidth + dx;
-		ih = iframe.clientHeight + dy;
-
-		iw = iw < 1 ? 30 : iw;
-		ih = ih < 1 ? 30 : ih;
-
-		if (tinyMCE.isGecko) {
-			iw -= 2;
-			ih -= 2;
-		}
+				if (p)
+					c.select(p.nodeName.toLowerCase());
+			}
 
-		if (set_w)
-			iframe.style.width = iw + "px";
+			if (ed.settings.convert_fonts_to_spans) {
+				ed.dom.getParent(n, function(n) {
+					if (n.nodeName === 'SPAN') {
+						if (!cl && n.className)
+							cl = n.className;
 
-		iframe.style.height = ih + "px";
+						if (!fz && n.style.fontSize)
+							fz = n.style.fontSize;
 
-		// Is it to small, make it bigger again
-		if (set_w) {
-			var tableBodyElm = tableElm.firstChild;
-			var minIframeWidth = tableBodyElm.scrollWidth;
-			if (inst.iframeElement.clientWidth < minIframeWidth) {
-				dx = minIframeWidth - inst.iframeElement.clientWidth;
+						if (!fn && n.style.fontFamily)
+							fn = n.style.fontFamily.replace(/[\"\']+/g, '').replace(/^([^,]+).*/, '$1').toLowerCase();
+					}
 
-				inst.iframeElement.style.width = (iw + dx) + "px";
-			}
-		}
+					return false;
+				});
 
-		// Remove pesky table controls
-		inst.useCSS = false;
-	},
-
-	/**
-	 * Handles resizing events.
-	 */
-	_resizeEventHandler : function(e) {
-		var resizer = TinyMCE_AdvancedTheme._resizer;
-
-		// Do nothing
-		if (!resizer.resizing)
-			return;
-
-		e = typeof(e) == "undefined" ? window.event : e;
-
-		var dx = e.screenX - resizer.downX;
-		var dy = e.screenY - resizer.downY;
-		var resizeBox = resizer.resizeBox;
-		var editorId = resizer.editorId;
-
-		switch (e.type) {
-			case "mousemove":
-				var w, h;
-
-				w = resizer.width + dx;
-				h = resizer.height + dy;
-
-				w = w < 1 ? 1 : w;
-				h = h < 1 ? 1 : h;
-
-				if (resizer.horizontal)
-					resizeBox.style.width = w + "px";
-
-				resizeBox.style.height = h + "px";
-				break;
-
-			case "mouseup":
-				TinyMCE_AdvancedTheme._setResizing(e, editorId, false);
-				TinyMCE_AdvancedTheme._resizeTo(tinyMCE.getInstanceById(editorId), resizer.width + dx, resizer.height + dy, resizer.horizontal);
-
-				// Expire in a month
-				if (tinyMCE.getParam("theme_advanced_resizing_use_cookie", true)) {
-					var expires = new Date();
-					expires.setTime(expires.getTime() + 3600000 * 24 * 30);
-
-					// Set the cookies
-					TinyMCE_AdvancedTheme._setCookie("TinyMCE_" + editorId + "_width", "" + (resizer.horizontal ? resizer.width + dx : ""), expires);
-					TinyMCE_AdvancedTheme._setCookie("TinyMCE_" + editorId + "_height", "" + (resizer.height + dy), expires);
+				if (c = cm.get('fontselect')) {
+					c.select(function(v) {
+						return v.replace(/^([^,]+).*/, '$1').toLowerCase() == fn;
+					});
 				}
-				break;
-		}
-	},
 
-	/**
-	 * Starts/stops the editor resizing.
-	 */
-	_setResizing : function(e, editor_id, state) {
-		e = typeof(e) == "undefined" ? window.event : e;
-
-		var resizer = TinyMCE_AdvancedTheme._resizer;
-		var editorContainer = document.getElementById(editor_id + '_parent');
-		var editorArea = document.getElementById(editor_id + '_parent').firstChild;
-		var resizeBox = document.getElementById(editor_id + '_resize_box');
-		var inst = tinyMCE.getInstanceById(editor_id);
-
-		if (state) {
-			// Place box over editor area
-			var width = editorArea.clientWidth;
-			var height = editorArea.clientHeight;
-
-			resizeBox.style.width = width + "px";
-			resizeBox.style.height = height + "px";
-
-			resizer.iframeWidth = inst.iframeElement.clientWidth;
-			resizer.iframeHeight = inst.iframeElement.clientHeight;
-
-			// Hide editor and show resize box
-			editorArea.style.display = "none";
-			resizeBox.style.display = "block";
-
-			// Add event handlers, only once
-			if (!resizer.eventHandlers) {
-				if (tinyMCE.isMSIE)
-					tinyMCE.addEvent(document, "mousemove", TinyMCE_AdvancedTheme._resizeEventHandler);
-				else
-					tinyMCE.addEvent(window, "mousemove", TinyMCE_AdvancedTheme._resizeEventHandler);
-
-				tinyMCE.addEvent(document, "mouseup", TinyMCE_AdvancedTheme._resizeEventHandler);
+				if (c = cm.get('fontsizeselect')) {
+					c.select(function(v) {
+						if (v.fontSize && v.fontSize === fz)
+							return true;
+
+						if (v['class'] && v['class'] === cl)
+							return true;
+					});
+				}
+			} else {
+				if (c = cm.get('fontselect'))
+					c.select(ed.queryCommandValue('FontName'));
 
-				resizer.eventHandlers = true;
+				if (c = cm.get('fontsizeselect')) {
+					v = ed.queryCommandValue('FontSize');
+					c.select(function(iv) {
+						return iv.fontSize == v;
+					});
+				}
 			}
 
-			resizer.resizing = true;
-			resizer.downX = e.screenX;
-			resizer.downY = e.screenY;
-			resizer.width = parseInt(resizeBox.style.width);
-			resizer.height = parseInt(resizeBox.style.height);
-			resizer.editorId = editor_id;
-			resizer.resizeBox = resizeBox;
-			resizer.horizontal = tinyMCE.getParam("theme_advanced_resize_horizontal", true);
-		} else {
-			resizer.resizing = false;
-			resizeBox.style.display = "none";
-			editorArea.style.display = tinyMCE.isMSIE && !tinyMCE.isOpera ? "block" : "table";
-			tinyMCE.execCommand('mceResetDesignMode');
-		}
-	},
-
-	_getColorHTML : function(id, n, cm) {
-		var i, h, cl;
-
-		h = '<span class="mceMenuLine"></span>';
-		cl = tinyMCE.getParam(n, TinyMCE_AdvancedTheme._defColors).split(',');
-
-		h += '<table class="mceColors"><tr>';
-		for (i=0; i<cl.length; i++) {
-			c = 'tinyMCE.execInstanceCommand(\'' + id + '\', \'' + cm + '\', false, \'#' + cl[i] + '\');';
-			h += '<td><a href="javascript:' + c + '" style="background-color: #' + cl[i] + '" onclick="' + c + ';return false;"></a></td>';
+			if (s.theme_advanced_path && s.theme_advanced_statusbar_location) {
+				p = DOM.get(ed.id + '_path') || DOM.add(ed.id + '_path_row', 'span', {id : ed.id + '_path'});
+				DOM.setHTML(p, '');
+
+				ed.dom.getParent(n, function(n) {
+					var na = n.nodeName.toLowerCase(), u, pi, ti = '';
+
+					// Ignore non element and hidden elements
+					if (n.nodeType != 1 || n.nodeName === 'BR' || (DOM.hasClass(n, 'mceItemHidden') || DOM.hasClass(n, 'mceItemRemoved')))
+						return;
+
+					// Fake name
+					if (v = DOM.getAttrib(n, 'mce_name'))
+						na = v;
+
+					// Handle prefix
+					if (tinymce.isIE && n.scopeName !== 'HTML')
+						na = n.scopeName + ':' + na;
+
+					// Remove internal prefix
+					na = na.replace(/mce\:/g, '');
+
+					// Handle node name
+					switch (na) {
+						case 'b':
+							na = 'strong';
+							break;
 
-			if ((i+1) % 8 == 0)
-				h += '</tr><tr>';
-		}
+						case 'i':
+							na = 'em';
+							break;
 
-		h += '</tr></table>';
-		/*
-		h += '<a href="" class="mceMoreColors">More colors</a>';
-		*/
-
-		return h;
-	},
-
-	_insertImage : function(src, alt, border, hspace, vspace, width, height, align, title, onmouseover, onmouseout) {
-		tinyMCE.execCommand('mceBeginUndoLevel');
-
-		if (src == "")
-			return;
-
-		if (!tinyMCE.imgElement && tinyMCE.isSafari) {
-			var html = "";
-
-			html += '<img src="' + src + '" alt="' + alt + '"';
-			html += ' border="' + border + '" hspace="' + hspace + '"';
-			html += ' vspace="' + vspace + '" width="' + width + '"';
-			html += ' height="' + height + '" align="' + align + '" title="' + title + '" onmouseover="' + onmouseover + '" onmouseout="' + onmouseout + '" />';
-
-			tinyMCE.execCommand("mceInsertContent", false, html);
-		} else {
-			if (!tinyMCE.imgElement && tinyMCE.selectedInstance) {
-				if (tinyMCE.isSafari)
-					tinyMCE.execCommand("mceInsertContent", false, '<img src="' + tinyMCE.uniqueURL + '" />');
-				else
-					tinyMCE.selectedInstance.contentDocument.execCommand("insertimage", false, tinyMCE.uniqueURL);
+						case 'img':
+							if (v = DOM.getAttrib(n, 'src'))
+								ti += 'src: ' + v + ' ';
 
-				tinyMCE.imgElement = tinyMCE.getElementByAttributeValue(tinyMCE.selectedInstance.contentDocument.body, "img", "src", tinyMCE.uniqueURL);
-			}
-		}
-
-		if (tinyMCE.imgElement) {
-			var needsRepaint = false;
-			var msrc = src;
-
-			src = eval(tinyMCE.settings['urlconverter_callback'] + "(src, tinyMCE.imgElement);");
-
-			if (tinyMCE.getParam('convert_urls'))
-				msrc = src;
-
-			if (onmouseover && onmouseover != "")
-				onmouseover = "this.src='" + eval(tinyMCE.settings['urlconverter_callback'] + "(onmouseover, tinyMCE.imgElement);") + "';";
-
-			if (onmouseout && onmouseout != "")
-				onmouseout = "this.src='" + eval(tinyMCE.settings['urlconverter_callback'] + "(onmouseout, tinyMCE.imgElement);") + "';";
-
-			// Use alt as title if it's undefined
-			if (typeof(title) == "undefined")
-				title = alt;
-
-			if (width != tinyMCE.imgElement.getAttribute("width") || height != tinyMCE.imgElement.getAttribute("height") || align != tinyMCE.imgElement.getAttribute("align"))
-				needsRepaint = true;
-
-			tinyMCE.setAttrib(tinyMCE.imgElement, 'src', src);
-			tinyMCE.setAttrib(tinyMCE.imgElement, 'mce_src', msrc);
-			tinyMCE.setAttrib(tinyMCE.imgElement, 'alt', alt);
-			tinyMCE.setAttrib(tinyMCE.imgElement, 'title', title);
-			tinyMCE.setAttrib(tinyMCE.imgElement, 'align', align);
-			tinyMCE.setAttrib(tinyMCE.imgElement, 'border', border, true);
-			tinyMCE.setAttrib(tinyMCE.imgElement, 'hspace', hspace, true);
-			tinyMCE.setAttrib(tinyMCE.imgElement, 'vspace', vspace, true);
-			tinyMCE.setAttrib(tinyMCE.imgElement, 'width', width, true);
-			tinyMCE.setAttrib(tinyMCE.imgElement, 'height', height, true);
-			tinyMCE.setAttrib(tinyMCE.imgElement, 'onmouseover', onmouseover);
-			tinyMCE.setAttrib(tinyMCE.imgElement, 'onmouseout', onmouseout);
-
-			// Fix for bug #989846 - Image resize bug
-			if (width && width != "")
-				tinyMCE.imgElement.style.pixelWidth = width;
+							break;
 
-			if (height && height != "")
-				tinyMCE.imgElement.style.pixelHeight = height;
+						case 'a':
+							if (v = DOM.getAttrib(n, 'name')) {
+								ti += 'name: ' + v + ' ';
+								na += '#' + v;
+							}
 
-			if (needsRepaint)
-				tinyMCE.selectedInstance.repaint();
-		}
+							if (v = DOM.getAttrib(n, 'href'))
+								ti += 'href: ' + v + ' ';
 
-		tinyMCE.execCommand('mceEndUndoLevel');
-	},
+							break;
 
-	_insertLink : function(href, target, title, onclick, style_class) {
-		tinyMCE.execCommand('mceBeginUndoLevel');
+						case 'font':
+							if (s.convert_fonts_to_spans)
+								na = 'span';
 
-		if (tinyMCE.selectedInstance && tinyMCE.selectedElement && tinyMCE.selectedElement.nodeName.toLowerCase() == "img") {
-			var doc = tinyMCE.selectedInstance.getDoc();
-			var linkElement = tinyMCE.getParentElement(tinyMCE.selectedElement, "a");
-			var newLink = false;
+							if (v = DOM.getAttrib(n, 'face'))
+								ti += 'font: ' + v + ' ';
 
-			if (!linkElement) {
-				linkElement = doc.createElement("a");
-				newLink = true;
-			}
+							if (v = DOM.getAttrib(n, 'size'))
+								ti += 'size: ' + v + ' ';
 
-			var mhref = href;
-			var thref = eval(tinyMCE.settings['urlconverter_callback'] + "(href, linkElement);");
-			mhref = tinyMCE.getParam('convert_urls') ? href : mhref;
+							if (v = DOM.getAttrib(n, 'color'))
+								ti += 'color: ' + v + ' ';
 
-			tinyMCE.setAttrib(linkElement, 'href', thref);
-			tinyMCE.setAttrib(linkElement, 'mce_href', mhref);
-			tinyMCE.setAttrib(linkElement, 'target', target);
-			tinyMCE.setAttrib(linkElement, 'title', title);
-			tinyMCE.setAttrib(linkElement, 'onclick', onclick);
-			tinyMCE.setAttrib(linkElement, 'class', style_class);
+							break;
 
-			if (newLink) {
-				linkElement.appendChild(tinyMCE.selectedElement.cloneNode(true));
-				tinyMCE.selectedElement.parentNode.replaceChild(linkElement, tinyMCE.selectedElement);
-			}
+						case 'span':
+							if (v = DOM.getAttrib(n, 'style'))
+								ti += 'style: ' + v + ' ';
 
-			return;
-		}
+							break;
+					}
 
-		if (!tinyMCE.linkElement && tinyMCE.selectedInstance) {
-			if (tinyMCE.isSafari) {
-				tinyMCE.execCommand("mceInsertContent", false, '<a href="' + tinyMCE.uniqueURL + '">' + tinyMCE.selectedInstance.selection.getSelectedHTML() + '</a>');
-			} else
-				tinyMCE.selectedInstance.contentDocument.execCommand("createlink", false, tinyMCE.uniqueURL);
+					if (v = DOM.getAttrib(n, 'id'))
+						ti += 'id: ' + v + ' ';
 
-			tinyMCE.linkElement = tinyMCE.getElementByAttributeValue(tinyMCE.selectedInstance.contentDocument.body, "a", "href", tinyMCE.uniqueURL);
+					if (v = n.className) {
+						v = v.replace(/(webkit-[\w\-]+|Apple-[\w\-]+|mceItem\w+|mceVisualAid)/g, '');
 
-			var elementArray = tinyMCE.getElementsByAttributeValue(tinyMCE.selectedInstance.contentDocument.body, "a", "href", tinyMCE.uniqueURL);
+						if (v && v.indexOf('mceItem') == -1) {
+							ti += 'class: ' + v + ' ';
 
-			for (var i=0; i<elementArray.length; i++) {
-				var mhref = href;
-				var thref = eval(tinyMCE.settings['urlconverter_callback'] + "(href, elementArray[i]);");
-				mhref = tinyMCE.getParam('convert_urls') ? href : mhref;
+							if (DOM.isBlock(n) || na == 'img' || na == 'span')
+								na += '.' + v;
+						}
+					}
 
-				tinyMCE.setAttrib(elementArray[i], 'href', thref);
-				tinyMCE.setAttrib(elementArray[i], 'mce_href', mhref);
-				tinyMCE.setAttrib(elementArray[i], 'target', target);
-				tinyMCE.setAttrib(elementArray[i], 'title', title);
-				tinyMCE.setAttrib(elementArray[i], 'onclick', onclick);
-				tinyMCE.setAttrib(elementArray[i], 'class', style_class);
+					na = na.replace(/(html:)/g, '');
+					na = {name : na, node : n, title : ti};
+					t.onResolveName.dispatch(t, na);
+					ti = na.title;
+					na = na.name;
+
+					//u = "javascript:tinymce.EditorManager.get('" + ed.id + "').theme._sel('" + (de++) + "');";
+					pi = DOM.create('a', {'href' : "javascript:;", onmousedown : "return false;", title : ti, 'class' : 'mcePath_' + (de++)}, na);
+
+					if (p.hasChildNodes()) {
+						p.insertBefore(DOM.doc.createTextNode(' \u00bb '), p.firstChild);
+						p.insertBefore(pi, p.firstChild);
+					} else
+						p.appendChild(pi);
+				}, ed.getBody());
 			}
+		},
 
-			tinyMCE.linkElement = elementArray[0];
-		}
-
-		if (tinyMCE.linkElement) {
-			var mhref = href;
-			href = eval(tinyMCE.settings['urlconverter_callback'] + "(href, tinyMCE.linkElement);");
-			mhref = tinyMCE.getParam('convert_urls') ? href : mhref;
-
-			tinyMCE.setAttrib(tinyMCE.linkElement, 'href', href);
-			tinyMCE.setAttrib(tinyMCE.linkElement, 'mce_href', mhref);
-			tinyMCE.setAttrib(tinyMCE.linkElement, 'target', target);
-			tinyMCE.setAttrib(tinyMCE.linkElement, 'title', title);
-			tinyMCE.setAttrib(tinyMCE.linkElement, 'onclick', onclick);
-			tinyMCE.setAttrib(tinyMCE.linkElement, 'class', style_class);
-		}
+		// Commands gets called by execCommand
 
-		tinyMCE.execCommand('mceEndUndoLevel');
-	}
-};
+		_sel : function(v) {
+			this.editor.execCommand('mceSelectNodeDepth', false, v);
+		},
+
+		_mceInsertAnchor : function(ui, v) {
+			var ed = this.editor;
+
+			ed.windowManager.open({
+				url : tinymce.baseURL + '/themes/advanced/anchor.htm',
+				width : 320 + parseInt(ed.getLang('advanced.anchor_delta_width', 0)),
+				height : 90 + parseInt(ed.getLang('advanced.anchor_delta_height', 0)),
+				inline : true
+			}, {
+				theme_url : this.url
+			});
+		},
+
+		_mceCharMap : function() {
+			var ed = this.editor;
+
+			ed.windowManager.open({
+				url : tinymce.baseURL + '/themes/advanced/charmap.htm',
+				width : 550 + parseInt(ed.getLang('advanced.charmap_delta_width', 0)),
+				height : 250 + parseInt(ed.getLang('advanced.charmap_delta_height', 0)),
+				inline : true
+			}, {
+				theme_url : this.url
+			});
+		},
+
+		_mceHelp : function() {
+			var ed = this.editor;
+
+			ed.windowManager.open({
+				url : tinymce.baseURL + '/themes/advanced/about.htm',
+				width : 480,
+				height : 380,
+				inline : true
+			}, {
+				theme_url : this.url
+			});
+		},
+
+		_mceColorPicker : function(u, v) {
+			var ed = this.editor;
+
+			v = v || {};
+
+			ed.windowManager.open({
+				url : tinymce.baseURL + '/themes/advanced/color_picker.htm',
+				width : 375 + parseInt(ed.getLang('advanced.colorpicker_delta_width', 0)),
+				height : 250 + parseInt(ed.getLang('advanced.colorpicker_delta_height', 0)),
+				close_previous : false,
+				inline : true
+			}, {
+				input_color : v.color,
+				func : v.func,
+				theme_url : this.url
+			});
+		},
+
+		_mceCodeEditor : function(ui, val) {
+			var ed = this.editor;
+
+			ed.windowManager.open({
+				url : tinymce.baseURL + '/themes/advanced/source_editor.htm',
+				width : parseInt(ed.getParam("theme_advanced_source_editor_width", 720)),
+				height : parseInt(ed.getParam("theme_advanced_source_editor_height", 580)),
+				inline : true,
+				resizable : true,
+				maximizable : true
+			}, {
+				theme_url : this.url
+			});
+		},
+
+		_mceImage : function(ui, val) {
+			var ed = this.editor;
+
+			// Internal image object like a flash placeholder
+			if (ed.dom.getAttrib(ed.selection.getNode(), 'class').indexOf('mceItem') != -1)
+				return;
+
+			ed.windowManager.open({
+				url : tinymce.baseURL + '/themes/advanced/image.htm',
+				width : 355 + parseInt(ed.getLang('advanced.image_delta_width', 0)),
+				height : 275 + parseInt(ed.getLang('advanced.image_delta_height', 0)),
+				inline : true
+			}, {
+				theme_url : this.url
+			});
+		},
+
+		_mceLink : function(ui, val) {
+			var ed = this.editor;
+
+			ed.windowManager.open({
+				url : tinymce.baseURL + '/themes/advanced/link.htm',
+				width : 310 + parseInt(ed.getLang('advanced.link_delta_width', 0)),
+				height : 200 + parseInt(ed.getLang('advanced.link_delta_height', 0)),
+				inline : true
+			}, {
+				theme_url : this.url
+			});
+		},
+
+		_mceNewDocument : function() {
+			var ed = this.editor;
+
+			ed.windowManager.confirm('advanced.newdocument', function(s) {
+				if (s)
+					ed.execCommand('mceSetContent', false, '');
+			});
+		},
+
+		_mceForeColor : function() {
+			var t = this;
+
+			this._mceColorPicker(0, {
+				color: t.fgColor,
+				func : function(co) {
+					t.fgColor = co;
+					t.editor.execCommand('ForeColor', false, co);
+				}
+			});
+		},
+
+		_mceBackColor : function() {
+			var t = this;
+
+			this._mceColorPicker(0, {
+				color: t.bgColor,
+				func : function(co) {
+					t.bgColor = co;
+					t.editor.execCommand('HiliteColor', false, co);
+				}
+			});
+		},
 
-tinyMCE.addTheme("advanced", TinyMCE_AdvancedTheme);
+		_ufirst : function(s) {
+			return s.substring(0, 1).toUpperCase() + s.substring(1);
+		}
+	});
 
-// Add default buttons maps for advanced theme and all internal plugins
-tinyMCE.addButtonMap(TinyMCE_AdvancedTheme._buttonMap);
+	tinymce.ThemeManager.add('advanced', tinymce.themes.AdvancedTheme);
+}(tinymce));
\ No newline at end of file
diff -x .svn -aruN 0.7.15.src/e107_handlers/tiny_mce/themes/advanced/image.htm 0.7.16.src/e107_handlers/tiny_mce/themes/advanced/image.htm
--- 0.7.15.src/e107_handlers/tiny_mce/themes/advanced/image.htm	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_handlers/tiny_mce/themes/advanced/image.htm	2009-06-30 19:36:50.000000000 -0500
@@ -1,17 +1,17 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
 <html xmlns="http://www.w3.org/1999/xhtml">
 <head>
-	<title>{$lang_insert_image_title}</title>
-	<script language="javascript" type="text/javascript" src="../../tiny_mce_popup.js"></script>
-	<script language="javascript" type="text/javascript" src="../../utils/mctabs.js"></script>
-	<script language="javascript" type="text/javascript" src="../../utils/form_utils.js"></script>
-	<script language="javascript" type="text/javascript" src="jscripts/image.js"></script>
-	<base target="_self" />
+	<title>{#advanced_dlg.image_title}</title>
+	<script type="text/javascript" src="../../tiny_mce_popup.js"></script>
+	<script type="text/javascript" src="../../utils/mctabs.js"></script>
+	<script type="text/javascript" src="../../utils/form_utils.js"></script>
+	<script type="text/javascript" src="js/image.js"></script>
 </head>
-<body id="image" onload="tinyMCEPopup.executeOnLoad('init();');" style="display: none">
-<form onsubmit="insertImage();return false;" action="#">
+<body id="image" style="display: none">
+<form onsubmit="ImageDialog.update();return false;" action="#">
 	<div class="tabs">
 		<ul>
-			<li id="general_tab" class="current"><span><a href="javascript:mcTabs.displayTab('general_tab','general_panel');" onmousedown="return false;">{$lang_insert_image_title}</a></span></li>
+			<li id="general_tab" class="current"><span><a href="javascript:mcTabs.displayTab('general_tab','general_panel');" onmousedown="return false;">{#advanced_dlg.image_title}</a></span></li>
 		</ul>
 	</div>
 
@@ -19,68 +19,53 @@
 		<div id="general_panel" class="panel current">
      <table border="0" cellpadding="4" cellspacing="0">
           <tr>
-            <td nowrap="nowrap"><label for="src">{$lang_insert_image_src}</label></td>
+            <td class="nowrap"><label for="src">{#advanced_dlg.image_src}</label></td>
             <td><table border="0" cellspacing="0" cellpadding="0">
                 <tr>
-                  <td><input id="src" name="src" type="text" value="" style="width: 200px" onchange="getImageData();"></td>
+                  <td><input id="src" name="src" type="text" class="mceFocus" value="" style="width: 200px" onchange="ImageDialog.getImageData();" /></td>
                   <td id="srcbrowsercontainer">&nbsp;</td>
                 </tr>
               </table></td>
           </tr>
-		  <!-- Image list -->
-		  <script language="javascript">
-			if (typeof(tinyMCEImageList) != "undefined" && tinyMCEImageList.length > 0) {
-				var html = "";
-
-				html += '<tr><td><label for="image_list">{$lang_image_list}</label></td>';
-				html += '<td><select id="image_list" name="image_list" style="width: 200px" onchange="this.form.src.value=this.options[this.selectedIndex].value;resetImageData();getImageData();">';
-				html += '<option value="">---</option>';
-
-				for (var i=0; i<tinyMCEImageList.length; i++)
-					html += '<option value="' + tinyMCEImageList[i][1] + '">' + tinyMCEImageList[i][0] + '</option>';
-
-				html += '</select></td></tr>';
-
-				document.write(html);
-			}
-		  </script>
-		  <!-- /Image list -->
-          <tr>
-            <td nowrap="nowrap"><label for="alt">{$lang_insert_image_alt}</label></td>
-            <td><input id="alt" name="alt" type="text" value="" style="width: 200px"></td>
-          </tr>
-          <tr>
-            <td nowrap="nowrap"><label for="align">{$lang_insert_image_align}</label></td>
-            <td><select id="align" name="align">
-                <option value="">{$lang_insert_image_align_default}</option>
-                <option value="baseline">{$lang_insert_image_align_baseline}</option>
-                <option value="top">{$lang_insert_image_align_top}</option>
-                <option value="middle">{$lang_insert_image_align_middle}</option>
-                <option value="bottom">{$lang_insert_image_align_bottom}</option>
-                <option value="texttop">{$lang_insert_image_align_texttop}</option>
-                <option value="absmiddle">{$lang_insert_image_align_absmiddle}</option>
-                <option value="absbottom">{$lang_insert_image_align_absbottom}</option>
-                <option value="left">{$lang_insert_image_align_left}</option>
-                <option value="right">{$lang_insert_image_align_right}</option>
+		  <tr>
+			<td><label for="image_list">{#advanced_dlg.image_list}</label></td>
+			<td><select id="image_list" name="image_list" onchange="document.getElementById('src').value=this.options[this.selectedIndex].value;document.getElementById('alt').value=this.options[this.selectedIndex].text;"></select></td>
+		  </tr>
+          <tr>
+            <td class="nowrap"><label for="alt">{#advanced_dlg.image_alt}</label></td>
+            <td><input id="alt" name="alt" type="text" value="" style="width: 200px" /></td>
+          </tr>
+          <tr>
+            <td class="nowrap"><label for="align">{#advanced_dlg.image_align}</label></td>
+            <td><select id="align" name="align" onchange="ImageDialog.updateStyle();">
+                <option value="">{#not_set}</option>
+                <option value="baseline">{#advanced_dlg.image_align_baseline}</option>
+                <option value="top">{#advanced_dlg.image_align_top}</option>
+                <option value="middle">{#advanced_dlg.image_align_middle}</option>
+                <option value="bottom">{#advanced_dlg.image_align_bottom}</option>
+                <option value="text-top">{#advanced_dlg.image_align_texttop}</option>
+                <option value="text-bottom">{#advanced_dlg.image_align_textbottom}</option>
+                <option value="left">{#advanced_dlg.image_align_left}</option>
+                <option value="right">{#advanced_dlg.image_align_right}</option>
               </select></td>
           </tr>
           <tr>
-            <td nowrap="nowrap"><label for="width">{$lang_insert_image_dimensions}</label></td>
-            <td><input id="width" name="width" type="text" value="" size="3" maxlength="3">
+            <td class="nowrap"><label for="width">{#advanced_dlg.image_dimensions}</label></td>
+            <td><input id="width" name="width" type="text" value="" size="3" maxlength="5" />
               x
-              <input id="height" name="height" type="text" value="" size="3" maxlength="3"></td>
+              <input id="height" name="height" type="text" value="" size="3" maxlength="5" /></td>
           </tr>
           <tr>
-            <td nowrap="nowrap"><label for="border">{$lang_insert_image_border}</label></td>
-            <td><input id="border" name="border" type="text" value="" size="3" maxlength="3"></td>
+            <td class="nowrap"><label for="border">{#advanced_dlg.image_border}</label></td>
+            <td><input id="border" name="border" type="text" value="" size="3" maxlength="3" onchange="ImageDialog.updateStyle();" /></td>
           </tr>
           <tr>
-            <td nowrap="nowrap"><label for="vspace">{$lang_insert_image_vspace}</label></td>
-            <td><input id="vspace" name="vspace" type="text" value="" size="3" maxlength="3"></td>
+            <td class="nowrap"><label for="vspace">{#advanced_dlg.image_vspace}</label></td>
+            <td><input id="vspace" name="vspace" type="text" value="" size="3" maxlength="3" onchange="ImageDialog.updateStyle();" /></td>
           </tr>
           <tr>
-            <td nowrap="nowrap"><label for="hspace">{$lang_insert_image_hspace}</label></td>
-            <td><input id="hspace" name="hspace" type="text" value="" size="3" maxlength="3"></td>
+            <td class="nowrap"><label for="hspace">{#advanced_dlg.image_hspace}</label></td>
+            <td><input id="hspace" name="hspace" type="text" value="" size="3" maxlength="3" onchange="ImageDialog.updateStyle();" /></td>
           </tr>
         </table>
 		</div>
@@ -88,11 +73,11 @@
 
 	<div class="mceActionPanel">
 		<div style="float: left">
-			<input type="button" id="insert" name="insert" value="{$lang_insert}" onclick="insertImage();" />
+			<input type="submit" id="insert" name="insert" value="{#insert}" />
 		</div>
 
 		<div style="float: right">
-			<input type="button" id="cancel" name="cancel" value="{$lang_cancel}" onclick="tinyMCEPopup.close();" />
+			<input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />
 		</div>
 	</div>
 </form>
diff -x .svn -aruN 0.7.15.src/e107_handlers/tiny_mce/themes/advanced/images/bold_tw.gif 0.7.16.src/e107_handlers/tiny_mce/themes/advanced/images/bold_tw.gif
--- 0.7.15.src/e107_handlers/tiny_mce/themes/advanced/images/bold_tw.gif	1969-12-31 18:00:00.000000000 -0600
+++ 0.7.16.src/e107_handlers/tiny_mce/themes/advanced/images/bold_tw.gif	2009-07-06 15:33:57.000000000 -0500
@@ -0,0 +1 @@
+GIF89a   """UUUwwwDDD333fff      !   ,       |I8;"4nw5D(B\4ȁ6K4,(1&  en
J " V-AAX  Y̐B/,a(ӖƀtA0	>P	#6)ry  [" ;
\ No newline at end of file
diff -x .svn -aruN 0.7.15.src/e107_handlers/tiny_mce/themes/advanced/images/italic_tw.gif 0.7.16.src/e107_handlers/tiny_mce/themes/advanced/images/italic_tw.gif
--- 0.7.15.src/e107_handlers/tiny_mce/themes/advanced/images/italic_tw.gif	1969-12-31 18:00:00.000000000 -0600
+++ 0.7.16.src/e107_handlers/tiny_mce/themes/advanced/images/italic_tw.gif	2009-07-06 15:33:57.000000000 -0500
@@ -0,0 +1,2 @@
+GIF89a   oooOOO___///￿ߏ???                                                !   ,        $dih:.*z<C)g<x,rcx,	Ń`z)#$.jPx8h Jpl4	&`
U
+zz&a
Ly
>$ #
&	m#b%	04-F2--! ;
\ No newline at end of file
diff -x .svn -aruN 0.7.15.src/e107_handlers/tiny_mce/themes/advanced/images/underline_tw.gif 0.7.16.src/e107_handlers/tiny_mce/themes/advanced/images/underline_tw.gif
--- 0.7.15.src/e107_handlers/tiny_mce/themes/advanced/images/underline_tw.gif	1969-12-31 18:00:00.000000000 -0600
+++ 0.7.16.src/e107_handlers/tiny_mce/themes/advanced/images/underline_tw.gif	2009-07-06 15:33:57.000000000 -0500
@@ -0,0 +1 @@
+GIF89a   UUUwww̙333fff"""&&&LLLoooDDD???                                 !   ,       r`%dihJ>TQjMT*TFHp<	" F*+%e9P(&m2<wri)i#^i}(=	#	
(! ;
\ No newline at end of file
diff -x .svn -aruN 0.7.15.src/e107_handlers/tiny_mce/themes/advanced/img/colorpicker.jpg 0.7.16.src/e107_handlers/tiny_mce/themes/advanced/img/colorpicker.jpg
--- 0.7.15.src/e107_handlers/tiny_mce/themes/advanced/img/colorpicker.jpg	1969-12-31 18:00:00.000000000 -0600
+++ 0.7.16.src/e107_handlers/tiny_mce/themes/advanced/img/colorpicker.jpg	2009-07-06 15:33:57.000000000 -0500
@@ -0,0 +1,19 @@
+ JFIF       >CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality
+ C 		
+
 $.' ",#(7),01444'9=82<.342 C			

2!!22222222222222222222222222222222222222222222222222  ,"            	
+    } !1AQa"q2#BR$3br	
+%&'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz        	
+   w !1AQaq"2B	#3Rbr
+$4%&'()*56789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz   ? 孇JضY6k[D{nկlzVEjַ=+ȯHٶ=+^ٺV-ZҼ<,C4پAUejZFX@qEyZjĆHk>sҚ)R!@TJ~jrc4u<IRe5"MH
+%u5"MJ
+c(Q=j<U־({UzǹZ&z${Xx#d\p:M^&%-]^^5N3OwZ\VXRBD*b+s>"Bv#cqUTL*f
+qLXTL*v
+Qf@£"aL#BLn:Vj̀t8;WZ'^fjշ=+*ߵizWZ'^FZұ=+R^]h-vhEVB(5r Y
O!!!@q1+ާ)1~:<*MD
<MH
B
H
{c'`xWZ9^ᩙq޲;֤.~ёЉp:UZ󎵗8^֠j֠kьâh֭F*֭F+#j1\XT⢌T=ЉF¥4YԦB£aSQ^$LFELE0MTPjτt{W
XUiPv(J̇hzWV'ZFi@+*ҴanՁVfoUy[s"sUL xC!Vs]0b"BǚPi(5B:T(4j j@kã'Pj@ji׷2p&9Vz׳E53Y)tґQ8Y8YҙQFL֡j֡ECנ#Zj-e91VPT(*
+o"xMڢASc-f#5)+3Lab
HRL"ZSE2#hCTz˫25	&*D*фք-ҳ!5~&
+<ʬ[8*j0<nj@淌""sUj"HZp]y^fJ
<p53p&1Lk֤ԣ5PuU	Ч#ѥ>aֳ(3ԥ2ejQ"bEE-XAYgE *$:
+ZT☂9hzԧ*B)WY
+dDSH^EcE2")H⼚R
+TUȫ<ڳ.EWb5J*:</DjMYњWH}F\-.ԥv٪5`yQJơc[V$g(4yPԐx54kӤp$
D
<H
W⠐ץM!NZ-]]wRFQT~ATNgIүZȵuzZ5VQYgEAST+LHIژXNZ90a)^uVlFE0iU-Ln*B)6Ե2x[F*uTf:՘r'Ic5j6Hjm\QqQRf1ұ֪D5DƞƢcZ"0zҊޜN7Ӂ8麗p$
F
8K&j
IC]ajVIVު]pNITUZA]PN%U-1V;iUR*Ԫg}1TT)*UNCT⚢+HE4iQ)M""Ey
+S#"LWJd*T(*t	̝*:NYȴ#UD5:5a(eSYƢcJMFMhrMƣcN&&P8Z\Љ<Piӳ]PDr
G\dI;5RSBYWqVT+3:1Vu:`UP"@*@*θHrv) Ⲕa*B)W4٢)TR\)Ln*LRb&%QS-FZ	Lje5
+ԋY8DjejVdnZ@CHM4	 &MIP9	6֑晚\D.i5EI.ikxP#jVڵR6HXT,*
+jmVei֜CBND Ss:# @r7Rb+f)1O&+	3VC<P(s)8Ap!mԅ=ԛ!&nL3hRi	&i74fDA٥74f!r.ih~ifÐCL4HjP#"EJE42HJmZDaiSsDN1K! .)qSZRbLT6W8Rb1PÜf)1Oq*k,4f)XAE v %QaX(,AES asIEI(Rb((E]1F(R((p)bQEvPg
\ No newline at end of file
diff -x .svn -aruN 0.7.15.src/e107_handlers/tiny_mce/themes/advanced/img/icons.gif 0.7.16.src/e107_handlers/tiny_mce/themes/advanced/img/icons.gif
--- 0.7.15.src/e107_handlers/tiny_mce/themes/advanced/img/icons.gif	1969-12-31 18:00:00.000000000 -0600
+++ 0.7.16.src/e107_handlers/tiny_mce/themes/advanced/img/icons.gif	2009-07-06 15:33:57.000000000 -0500
@@ -0,0 +1,78 @@
+GIF89a<   9c§   n%4O8*opqyn4Kcpz1QﮏХX̣XݹpQQRԚ=8)؊Ssb/i䴕T|ՍxY.-Y]fr[vOmAwl𑣹tlaUOPhĸ5f-M97ϰQϨ˴g急ٺO5`pˑ6MGYur虙Rkƴq*KKzBRc򅊝򨩶suRyMFH|lOf>봱0ChBgd}ΓR{kW@Ks@`A8?g..<<?1bUbbSaԯԓsK  Ѝلě ƘOq!@x_oBf gd >QkܱS"X^Sp%c WnNX	9Lp𨸸Jvc"Zڎr̦PUg2Rr6[[Z?ː()'Р`!   ,    <   	H*\ȰÇ#JHŋ3jȱǏ CIɓ(}ԨeC0cʜ)ʛ8sɳϟ@
+JѣH;x`iӗJJUͤXjpQ.I((ٳhܥKۋ*6ݻx~vu^~
LÈzM3]u؉\*-z(g0.ti ?
ĺHlጐ򉧏%|*s|z > dF萑ą6J{kL8dD.\ {=VѷGhqK.rp	Vham.
6f@H A	 C$aD	TleBj<~GV}I
 9I	5>jT 	#dIq1CD, a f`fjV" p	gDP5Yt 'B!(!ߠUFޑ G]] GFtX
+%`d;^ڑ38HD(qm4 fH뭺jPkFt &aH .@A#
 	1o	enB,l0A@ i3%PG?P
+L0ލ NN5\s^S].jB"D$#rwBPChD W2{ѳq&D@FfE}E~!&sq.$zԉDG TDjB= #61J*k__$%H-CvI|FXK&bBV/K3I:'@0BGG\8K7+D5tLP/r<S}Rι	6l6@0'
+C0~/o/'Z}~/5ɇcB6@!A@P{Z@F	6rqP A 4*`ЈU
+AX;RFZ!A \9Ґjy8okh8n)$qjW.>}iܕH6.*T'5C)F(@ 7	I-n@@"'
D$(Qq$`p^_!^Vt/r=MӘב&4A|R!PG'"LPUޔ+V|\ߠ| Yr?1:c I7M?CN.S
2e@}D BRL0 A38H!*y.`PC2$v1)y悞-sfvx Ģ״EAD 0/X }ַx2Fw %:O tq&.M LSzp@6(n ?h8Qr+~T2[i$E<Je+ @p;9nÖJ^>g?-((Dla0B
+q2
2S dI
+bM"fE7
+1#F&$
40 5
+W[6EXv\2UI'ZcփTK8!=[5H0ZiF0ъr	0nKQ%i.Ep7PB.p̲Zfsl!x@J0! , \#8*N:&[@}G
ڙM6A҅2b	 ,gq喅<A" Hs`9W2j]Aq:XxDBV&f,D|?&'fĺ풡e3EEɵa3Zط6 4aNho,d@>CnKNg4A; dDqB[6fjD\7!T0]\H1TkZú ` 	R =1$=mBqB4 6\!EMC"tU	Ә(H"$-1q!XWMT4%5v)JiKfz[/{ɴ."]P"1Vm#FOLr?ιdOsdr31d1#r B.ApfXlL)HMxlWe8NzSa^rsVV_
+[jS5̎]@ºw_2aE@8C ͺ(ebY͠sA"GdfC" 9 SH$4H b7JSֈX ]SĦVԉ7JJ(]=QIO"$g!լ5rEY]#8$q@ 
+AT^3Y?gE{K#tA5.g9OS"FPtZ@t$FrP V r"d^".ufPh@Pj 6yJ 1zL  y!kqwNc'waTt9 3x$ (b|FāGEPzpWPsAG@
7'8h wW7qaaL !6${gX6|T0s37drUuV>{	W}AqG+}'Aq+s(gc7|#vG@Bt  tQ 3]g>
uǘ>Y',Udt^cŅlUR(j!hP ).rn$jv@Q<\-Cl1&yEHG͐
f  $p S`2b&iXexquA1!`cacsov8W#wMp-%6p͕SUOX#lc(l1#	=7W=wWhwsK \ P4x AP kE8sTiH`1C.W]vQ8R{YGųG
( XY8S@	4ёU!i8{qTUӅry&.@qNh>4y&H& fW3U ^<bZ銷Y jeCOĩJ'799X	h9Y8)AdO֒F"@
+ IsGZoaܥu-]cr7Aaoo.` v衜NWFq.!av7AO0m , [Z\
+[qIv4b#!b*٠~ :
pL`ڧ$ Xr~
+xQ8x9_
+Z>@٩:Zz:|:Zzګ++ZjȚo`(X]7zκC0P"8W`lmpqml0Dd0
+pAЯ:! :
+G P	;K
> * p21۱pP	*aIC.O 2;28г0
U0UF{p [ 0p	
+SЊԚb
+O0n]`
+px{ZP
+
+J06 pTWp\	p;S '@P@` @
+@d >cpI!۹+Z%++ePؓ;`c	˼K  ;Q{
++ 8[`:%r" _"@@ {`	BPl		 `	¬.b  p@;{=[*נ[88* %8P:5 aYpzPZxPVl/Z`@ `+l<n0b7q<q6`nP10rRLȃRLrѷQ`<Q۸
+1x@	%Q I0/k?m@mjj3ʼ̄  0;I[
+@|Z;o;KC@"3HL<-c LPlu|\ EpE
+%pn чk"~^ =-Fd
+| 2K	q22 	#\q+p
1Q5@c	<|20p@Adp~ll0R\r=xpzx/P4g,dl`pƆrLǀ
+y 
@re;)<E-E70נm 4cE]Z6R7ue 't! *"ʭ PXaO`"gpQ}:;PU{	p	kV;o<9{ޕ; +p
mزLy
+AP9Oݺ[K[ 66
m"T!6jо⇺->'$7>pW0 5.>p P	 R RRP2Ygk"@Y
+']+

pO0
+Vpl <-`@`@1
ƀE
 H`4}pÛ pZ`]rP>5pl0vxq  8+ aL hl
aǋ]"-
e
+=^ϐ AﲵqUkȭ`P?mp9 m-0Sb(qQ'@v!]lO n @P
+ Mk
Թ=;[JP?  </;P;`6]0ί3"^j
+ϟa
2>;rt&6a_]+AQ	L1!R^0 ?t 
 ֽ&.`ow-NP 
LpWP
|n ې0VP[r 0`/p ` nH NA	1p#&0:٭
ps0@i9߿OHdx0C<
t3PXO2|c^zEV2BEdg/6K#`L_A}!kQ&LpӠƥM&ݸUYvj#M ,$H.hc/RFJ{r#Xc!zZl*x`a!%N!%
+tQ
+~r HR'OiGN
a5Ҏjas(>ܫnԆR{:Buތ"'Lɑc|WlN?]=OR8 RUX 8	 `'	&
0v!(>5Fh +pE* )$6 /sܱG>x
+5" #| %|HuǤrˬ$tJA`G0`Ǖj@
`2h83G
+xk^hKأx^!6zo
+"tv`>@jJ\9ܠu4Xa0dڨcX4V
+$$lAMgOQOiѢ[8PVK $ZYhFe.&|$H2I"y+C:L$Cxv؃n2x'{'`23^1<JKAAt^䊀.)"+Kg$
+Y1.yL#6.hv7<Y#䑴 ꬓ!F2 j'F`q!
P;P0 
fjaQZ .e:Qo<darOXS%ƙ1JQdoP.,|*ggpj0>|-XI}#>jS)eZ҂h 
&>&C^3"߈ &IY$
B_}eUz/{}OGJ-A46ax T;y/Gg04  (aH3xCB1Q
pؔ.dp`jd0DatArt0Jկ^TXoA$ 2BA[xHȭʴc@
+(ĺ6.	FfND -C'"2	W-`bIiF1vB E\)1EIe*bj2B.^d'vHJRd"IԌd< $@c6gMp(ZdGd87gǃ!QC6	6lh;9v 'VФ@pZĥ2ԡHy2!mC 4nwpa!(HсqHaG8'8r3Y`9	kHցϩ&T1<ZCU50( 
+E5o2$7ܲyX܄J8`+aa:Ba7N kC%G@V 	Le1{ЯelaKFA=8Z~`&( vTNvJpP   e`T(
+	B"fIE#a/8uxjYhF!#A+`!Z䢯`"	a5DźF_4^C3adQs(GpEx=#-8h`H{.8H"Gz-zZԢ0J)R'.@X%ɕkK\2IL:eSDrLK◴gpMNęf8
G4p[@zD@15ORcèFBFZX$(1hi!V2OtvIxp0Ci0Bq Àf4pIMq't#V Tc3De!CɈ L
+$h?
+pGՂ d2\	H@ C 	V!h]2<ws6c`ZЂO`>?= hO
+şpFaw82T\^W>xF8Ab[n . @-н@BN06 	!`QZ ^.
7U7OpEhDr^0ӨBpx$\C	̂@DlDR/pAGkA9)`?dp(?NlR56Na-ؗ?|dy'?fQiZRZQ>rB}X*Ie1f#d1 @b`Np3O5uO
+/tuj'D9byj	Y1i`K	KK@@_  4MxS#( .H5]^^akhb66?`)hh ;1i*UlSnCbp7ۈ+`P`K`H5>F V7!7 
?> 09>C*E\#D\7PĊ'9?A,ęD\Fřߑ:9"SSZ` X
p./h + YAHX<_􂧋:Dp1'^:Jh˅0ӆ$;+x/+0s`)ʻ"
xIW Z @i <.P<%@1
+Ppp#3H0xo:K.#1"8ט	E#cH {8AHR[A3Ky# 	,fϚ		JɆ`
+X;0JHJ
+(>02#R k˙I1xbzs?lBӃ73N?:ӿz>4>0C+@M}X
+r@dw:4dQC
+p 0<
+耰y+<pص8h
+8Ɂ븎&hS@ Yu~ 2UX6o˂p{
+>V0-> >'(
+;! @h   C }݀EP&7xgU	ͨ
+NTP%zP{p5HHBx"`Уm@ QWXpCfxJd$ҧC>H:l0j܈m
+^7h'h @4Xǃpp/+sdGZ 0 z 	,K!%X<D
+hY<@ȉș'8
+2 ˤA($TM׌M{ޫɍHlWJ%
+XJ	8SU 0VYJQk*&J)˷'VU3X x˸3KZˣKCˆ3 (К`C@{Ec L D
+2̩̍@Xe1nVTmXMMd
? T`( Q:T.B08'1$½<dxɨ  [YϤ"D5U[,J4S 1E[ۺۼ۬h[=۷e($8ddL),[< Wp!/@mh ǨEh(]эRiF'kdHaR!8S X G
+/4σv x<վS0GZ(TC%*(@HgTK|hLTlJ`(p  (VB:o=E^x{ZY>ٔ׬ՠ`([ =dfݿ	`a4H\&	?mʮJ	pVr^&\ yso?]Y}}0lL;ၚA[,J Ym /c\`x<'ciɄ6BhL8h
+~:S` S**
+>
+݂Kd7uՊ
+[@"[M[7X[&lexeǒ@,[`¥%Z XmBf\! H$
uFhe݈odh؃o]G \ph8(@`-ph|LE
+$(<(qPHMITK=s6C#(uQCՆ`~cm~1iI#>vc~{8&֊_%0p"~.P^Ra"Fj'aQ>#p&K|?#"#Y>:;p@TTH,J[KpVu }(&Ug	[k֊;h
+XB(F`N{JPŐNli$ʙv,ߖI
+ʣ8قׂPB
+Wn
+x8g'o,0MGɨ~n7-)SSjZ@ZHThG]<@ 䂐
+Tf_8H 0(NM|MM&Ԏʖl
%Ȋ	Pj^Gfqpq^᪶j>EpJ 
+r&Snr[m)Ͻ!x^,r-r2i
+LӞr~m s9s:7٪9 ݨs>7js:J}AVHtE_DU/4ɰk|LLPCuR/uS?R/CuVouWuXuYuZu[u\u]u^u_u`vavb/vc?vdOve_vfovgvhvivjvkvlvmvnvo#vs?wtOwu_wvow9G q?_x;ww{w|w}a^(w~x/x?xOzWxxΉxcw'wxxxr=yOy_yoyyyygYyyyzz/z?zOzOozzzyWgzzxz?{O{lxx{{vxox|({{?t{{|/nA ox7|o||ȏ|ɟ|ʯ|˿|  ;
\ No newline at end of file
diff -x .svn -aruN 0.7.15.src/e107_handlers/tiny_mce/themes/advanced/js/about.js 0.7.16.src/e107_handlers/tiny_mce/themes/advanced/js/about.js
--- 0.7.15.src/e107_handlers/tiny_mce/themes/advanced/js/about.js	1969-12-31 18:00:00.000000000 -0600
+++ 0.7.16.src/e107_handlers/tiny_mce/themes/advanced/js/about.js	2009-07-06 15:33:57.000000000 -0500
@@ -0,0 +1,72 @@
+tinyMCEPopup.requireLangPack();
+
+function init() {
+	var ed, tcont;
+
+	tinyMCEPopup.resizeToInnerSize();
+	ed = tinyMCEPopup.editor;
+
+	// Give FF some time
+	window.setTimeout(insertHelpIFrame, 10);
+
+	tcont = document.getElementById('plugintablecontainer');
+	document.getElementById('plugins_tab').style.display = 'none';
+
+	var html = "";
+	html += '<table id="plugintable">';
+	html += '<thead>';
+	html += '<tr>';
+	html += '<td>' + ed.getLang('advanced_dlg.about_plugin') + '</td>';
+	html += '<td>' + ed.getLang('advanced_dlg.about_author') + '</td>';
+	html += '<td>' + ed.getLang('advanced_dlg.about_version') + '</td>';
+	html += '</tr>';
+	html += '</thead>';
+	html += '<tbody>';
+
+	tinymce.each(ed.plugins, function(p, n) {
+		var info;
+
+		if (!p.getInfo)
+			return;
+
+		html += '<tr>';
+
+		info = p.getInfo();
+
+		if (info.infourl != null && info.infourl != '')
+			html += '<td width="50%" title="' + n + '"><a href="' + info.infourl + '" target="_blank">' + info.longname + '</a></td>';
+		else
+			html += '<td width="50%" title="' + n + '">' + info.longname + '</td>';
+
+		if (info.authorurl != null && info.authorurl != '')
+			html += '<td width="35%"><a href="' + info.authorurl + '" target="_blank">' + info.author + '</a></td>';
+		else
+			html += '<td width="35%">' + info.author + '</td>';
+
+		html += '<td width="15%">' + info.version + '</td>';
+		html += '</tr>';
+
+		document.getElementById('plugins_tab').style.display = '';
+
+	});
+
+	html += '</tbody>';
+	html += '</table>';
+
+	tcont.innerHTML = html;
+
+	tinyMCEPopup.dom.get('version').innerHTML = tinymce.majorVersion + "." + tinymce.minorVersion;
+	tinyMCEPopup.dom.get('date').innerHTML = tinymce.releaseDate;
+}
+
+function insertHelpIFrame() {
+	var html;
+
+	if (tinyMCEPopup.getParam('docs_url')) {
+		html = '<iframe width="100%" height="300" src="' + tinyMCEPopup.editor.baseURI.toAbsolute(tinyMCEPopup.getParam('docs_url')) + '"></iframe>';
+		document.getElementById('iframecontainer').innerHTML = html;
+		document.getElementById('help_tab').style.display = 'block';
+	}
+}
+
+tinyMCEPopup.onInit.add(init);
diff -x .svn -aruN 0.7.15.src/e107_handlers/tiny_mce/themes/advanced/js/anchor.js 0.7.16.src/e107_handlers/tiny_mce/themes/advanced/js/anchor.js
--- 0.7.15.src/e107_handlers/tiny_mce/themes/advanced/js/anchor.js	1969-12-31 18:00:00.000000000 -0600
+++ 0.7.16.src/e107_handlers/tiny_mce/themes/advanced/js/anchor.js	2009-07-06 15:33:57.000000000 -0500
@@ -0,0 +1,37 @@
+tinyMCEPopup.requireLangPack();
+
+var AnchorDialog = {
+	init : function(ed) {
+		var action, elm, f = document.forms[0];
+
+		this.editor = ed;
+		elm = ed.dom.getParent(ed.selection.getNode(), 'A,IMG');
+		v = ed.dom.getAttrib(elm, 'name');
+
+		if (v) {
+			this.action = 'update';
+			f.anchorName.value = v;
+		}
+
+		f.insert.value = ed.getLang(elm ? 'update' : 'insert');
+	},
+
+	update : function() {
+		var ed = this.editor;
+		
+		tinyMCEPopup.restoreSelection();
+
+		if (this.action != 'update')
+			ed.selection.collapse(1);
+
+		// Webkit acts weird if empty inline element is inserted so we need to use a image instead
+		if (tinymce.isWebKit)
+			ed.execCommand('mceInsertContent', 0, ed.dom.createHTML('img', {mce_name : 'a', name : document.forms[0].anchorName.value, 'class' : 'mceItemAnchor'}));
+		else
+			ed.execCommand('mceInsertContent', 0, ed.dom.createHTML('a', {name : document.forms[0].anchorName.value, 'class' : 'mceItemAnchor'}, ''));
+
+		tinyMCEPopup.close();
+	}
+};
+
+tinyMCEPopup.onInit.add(AnchorDialog.init, AnchorDialog);
diff -x .svn -aruN 0.7.15.src/e107_handlers/tiny_mce/themes/advanced/js/charmap.js 0.7.16.src/e107_handlers/tiny_mce/themes/advanced/js/charmap.js
--- 0.7.15.src/e107_handlers/tiny_mce/themes/advanced/js/charmap.js	1969-12-31 18:00:00.000000000 -0600
+++ 0.7.16.src/e107_handlers/tiny_mce/themes/advanced/js/charmap.js	2009-07-06 15:33:57.000000000 -0500
@@ -0,0 +1,325 @@
+tinyMCEPopup.requireLangPack();
+
+var charmap = [
+	['&nbsp;',    '&#160;',  true, 'no-break space'],
+	['&amp;',     '&#38;',   true, 'ampersand'],
+	['&quot;',    '&#34;',   true, 'quotation mark'],
+// finance
+	['&cent;',    '&#162;',  true, 'cent sign'],
+	['&euro;',    '&#8364;', true, 'euro sign'],
+	['&pound;',   '&#163;',  true, 'pound sign'],
+	['&yen;',     '&#165;',  true, 'yen sign'],
+// signs
+	['&copy;',    '&#169;',  true, 'copyright sign'],
+	['&reg;',     '&#174;',  true, 'registered sign'],
+	['&trade;',   '&#8482;', true, 'trade mark sign'],
+	['&permil;',  '&#8240;', true, 'per mille sign'],
+	['&micro;',   '&#181;',  true, 'micro sign'],
+	['&middot;',  '&#183;',  true, 'middle dot'],
+	['&bull;',    '&#8226;', true, 'bullet'],
+	['&hellip;',  '&#8230;', true, 'three dot leader'],
+	['&prime;',   '&#8242;', true, 'minutes / feet'],
+	['&Prime;',   '&#8243;', true, 'seconds / inches'],
+	['&sect;',    '&#167;',  true, 'section sign'],
+	['&para;',    '&#182;',  true, 'paragraph sign'],
+	['&szlig;',   '&#223;',  true, 'sharp s / ess-zed'],
+// quotations
+	['&lsaquo;',  '&#8249;', true, 'single left-pointing angle quotation mark'],
+	['&rsaquo;',  '&#8250;', true, 'single right-pointing angle quotation mark'],
+	['&laquo;',   '&#171;',  true, 'left pointing guillemet'],
+	['&raquo;',   '&#187;',  true, 'right pointing guillemet'],
+	['&lsquo;',   '&#8216;', true, 'left single quotation mark'],
+	['&rsquo;',   '&#8217;', true, 'right single quotation mark'],
+	['&ldquo;',   '&#8220;', true, 'left double quotation mark'],
+	['&rdquo;',   '&#8221;', true, 'right double quotation mark'],
+	['&sbquo;',   '&#8218;', true, 'single low-9 quotation mark'],
+	['&bdquo;',   '&#8222;', true, 'double low-9 quotation mark'],
+	['&lt;',      '&#60;',   true, 'less-than sign'],
+	['&gt;',      '&#62;',   true, 'greater-than sign'],
+	['&le;',      '&#8804;', true, 'less-than or equal to'],
+	['&ge;',      '&#8805;', true, 'greater-than or equal to'],
+	['&ndash;',   '&#8211;', true, 'en dash'],
+	['&mdash;',   '&#8212;', true, 'em dash'],
+	['&macr;',    '&#175;',  true, 'macron'],
+	['&oline;',   '&#8254;', true, 'overline'],
+	['&curren;',  '&#164;',  true, 'currency sign'],
+	['&brvbar;',  '&#166;',  true, 'broken bar'],
+	['&uml;',     '&#168;',  true, 'diaeresis'],
+	['&iexcl;',   '&#161;',  true, 'inverted exclamation mark'],
+	['&iquest;',  '&#191;',  true, 'turned question mark'],
+	['&circ;',    '&#710;',  true, 'circumflex accent'],
+	['&tilde;',   '&#732;',  true, 'small tilde'],
+	['&deg;',     '&#176;',  true, 'degree sign'],
+	['&minus;',   '&#8722;', true, 'minus sign'],
+	['&plusmn;',  '&#177;',  true, 'plus-minus sign'],
+	['&divide;',  '&#247;',  true, 'division sign'],
+	['&frasl;',   '&#8260;', true, 'fraction slash'],
+	['&times;',   '&#215;',  true, 'multiplication sign'],
+	['&sup1;',    '&#185;',  true, 'superscript one'],
+	['&sup2;',    '&#178;',  true, 'superscript two'],
+	['&sup3;',    '&#179;',  true, 'superscript three'],
+	['&frac14;',  '&#188;',  true, 'fraction one quarter'],
+	['&frac12;',  '&#189;',  true, 'fraction one half'],
+	['&frac34;',  '&#190;',  true, 'fraction three quarters'],
+// math / logical
+	['&fnof;',    '&#402;',  true, 'function / florin'],
+	['&int;',     '&#8747;', true, 'integral'],
+	['&sum;',     '&#8721;', true, 'n-ary sumation'],
+	['&infin;',   '&#8734;', true, 'infinity'],
+	['&radic;',   '&#8730;', true, 'square root'],
+	['&sim;',     '&#8764;', false,'similar to'],
+	['&cong;',    '&#8773;', false,'approximately equal to'],
+	['&asymp;',   '&#8776;', true, 'almost equal to'],
+	['&ne;',      '&#8800;', true, 'not equal to'],
+	['&equiv;',   '&#8801;', true, 'identical to'],
+	['&isin;',    '&#8712;', false,'element of'],
+	['&notin;',   '&#8713;', false,'not an element of'],
+	['&ni;',      '&#8715;', false,'contains as member'],
+	['&prod;',    '&#8719;', true, 'n-ary product'],
+	['&and;',     '&#8743;', false,'logical and'],
+	['&or;',      '&#8744;', false,'logical or'],
+	['&not;',     '&#172;',  true, 'not sign'],
+	['&cap;',     '&#8745;', true, 'intersection'],
+	['&cup;',     '&#8746;', false,'union'],
+	['&part;',    '&#8706;', true, 'partial differential'],
+	['&forall;',  '&#8704;', false,'for all'],
+	['&exist;',   '&#8707;', false,'there exists'],
+	['&empty;',   '&#8709;', false,'diameter'],
+	['&nabla;',   '&#8711;', false,'backward difference'],
+	['&lowast;',  '&#8727;', false,'asterisk operator'],
+	['&prop;',    '&#8733;', false,'proportional to'],
+	['&ang;',     '&#8736;', false,'angle'],
+// undefined
+	['&acute;',   '&#180;',  true, 'acute accent'],
+	['&cedil;',   '&#184;',  true, 'cedilla'],
+	['&ordf;',    '&#170;',  true, 'feminine ordinal indicator'],
+	['&ordm;',    '&#186;',  true, 'masculine ordinal indicator'],
+	['&dagger;',  '&#8224;', true, 'dagger'],
+	['&Dagger;',  '&#8225;', true, 'double dagger'],
+// alphabetical special chars
+	['&Agrave;',  '&#192;',  true, 'A - grave'],
+	['&Aacute;',  '&#193;',  true, 'A - acute'],
+	['&Acirc;',   '&#194;',  true, 'A - circumflex'],
+	['&Atilde;',  '&#195;',  true, 'A - tilde'],
+	['&Auml;',    '&#196;',  true, 'A - diaeresis'],
+	['&Aring;',   '&#197;',  true, 'A - ring above'],
+	['&AElig;',   '&#198;',  true, 'ligature AE'],
+	['&Ccedil;',  '&#199;',  true, 'C - cedilla'],
+	['&Egrave;',  '&#200;',  true, 'E - grave'],
+	['&Eacute;',  '&#201;',  true, 'E - acute'],
+	['&Ecirc;',   '&#202;',  true, 'E - circumflex'],
+	['&Euml;',    '&#203;',  true, 'E - diaeresis'],
+	['&Igrave;',  '&#204;',  true, 'I - grave'],
+	['&Iacute;',  '&#205;',  true, 'I - acute'],
+	['&Icirc;',   '&#206;',  true, 'I - circumflex'],
+	['&Iuml;',    '&#207;',  true, 'I - diaeresis'],
+	['&ETH;',     '&#208;',  true, 'ETH'],
+	['&Ntilde;',  '&#209;',  true, 'N - tilde'],
+	['&Ograve;',  '&#210;',  true, 'O - grave'],
+	['&Oacute;',  '&#211;',  true, 'O - acute'],
+	['&Ocirc;',   '&#212;',  true, 'O - circumflex'],
+	['&Otilde;',  '&#213;',  true, 'O - tilde'],
+	['&Ouml;',    '&#214;',  true, 'O - diaeresis'],
+	['&Oslash;',  '&#216;',  true, 'O - slash'],
+	['&OElig;',   '&#338;',  true, 'ligature OE'],
+	['&Scaron;',  '&#352;',  true, 'S - caron'],
+	['&Ugrave;',  '&#217;',  true, 'U - grave'],
+	['&Uacute;',  '&#218;',  true, 'U - acute'],
+	['&Ucirc;',   '&#219;',  true, 'U - circumflex'],
+	['&Uuml;',    '&#220;',  true, 'U - diaeresis'],
+	['&Yacute;',  '&#221;',  true, 'Y - acute'],
+	['&Yuml;',    '&#376;',  true, 'Y - diaeresis'],
+	['&THORN;',   '&#222;',  true, 'THORN'],
+	['&agrave;',  '&#224;',  true, 'a - grave'],
+	['&aacute;',  '&#225;',  true, 'a - acute'],
+	['&acirc;',   '&#226;',  true, 'a - circumflex'],
+	['&atilde;',  '&#227;',  true, 'a - tilde'],
+	['&auml;',    '&#228;',  true, 'a - diaeresis'],
+	['&aring;',   '&#229;',  true, 'a - ring above'],
+	['&aelig;',   '&#230;',  true, 'ligature ae'],
+	['&ccedil;',  '&#231;',  true, 'c - cedilla'],
+	['&egrave;',  '&#232;',  true, 'e - grave'],
+	['&eacute;',  '&#233;',  true, 'e - acute'],
+	['&ecirc;',   '&#234;',  true, 'e - circumflex'],
+	['&euml;',    '&#235;',  true, 'e - diaeresis'],
+	['&igrave;',  '&#236;',  true, 'i - grave'],
+	['&iacute;',  '&#237;',  true, 'i - acute'],
+	['&icirc;',   '&#238;',  true, 'i - circumflex'],
+	['&iuml;',    '&#239;',  true, 'i - diaeresis'],
+	['&eth;',     '&#240;',  true, 'eth'],
+	['&ntilde;',  '&#241;',  true, 'n - tilde'],
+	['&ograve;',  '&#242;',  true, 'o - grave'],
+	['&oacute;',  '&#243;',  true, 'o - acute'],
+	['&ocirc;',   '&#244;',  true, 'o - circumflex'],
+	['&otilde;',  '&#245;',  true, 'o - tilde'],
+	['&ouml;',    '&#246;',  true, 'o - diaeresis'],
+	['&oslash;',  '&#248;',  true, 'o slash'],
+	['&oelig;',   '&#339;',  true, 'ligature oe'],
+	['&scaron;',  '&#353;',  true, 's - caron'],
+	['&ugrave;',  '&#249;',  true, 'u - grave'],
+	['&uacute;',  '&#250;',  true, 'u - acute'],
+	['&ucirc;',   '&#251;',  true, 'u - circumflex'],
+	['&uuml;',    '&#252;',  true, 'u - diaeresis'],
+	['&yacute;',  '&#253;',  true, 'y - acute'],
+	['&thorn;',   '&#254;',  true, 'thorn'],
+	['&yuml;',    '&#255;',  true, 'y - diaeresis'],
+    ['&Alpha;',   '&#913;',  true, 'Alpha'],
+	['&Beta;',    '&#914;',  true, 'Beta'],
+	['&Gamma;',   '&#915;',  true, 'Gamma'],
+	['&Delta;',   '&#916;',  true, 'Delta'],
+	['&Epsilon;', '&#917;',  true, 'Epsilon'],
+	['&Zeta;',    '&#918;',  true, 'Zeta'],
+	['&Eta;',     '&#919;',  true, 'Eta'],
+	['&Theta;',   '&#920;',  true, 'Theta'],
+	['&Iota;',    '&#921;',  true, 'Iota'],
+	['&Kappa;',   '&#922;',  true, 'Kappa'],
+	['&Lambda;',  '&#923;',  true, 'Lambda'],
+	['&Mu;',      '&#924;',  true, 'Mu'],
+	['&Nu;',      '&#925;',  true, 'Nu'],
+	['&Xi;',      '&#926;',  true, 'Xi'],
+	['&Omicron;', '&#927;',  true, 'Omicron'],
+	['&Pi;',      '&#928;',  true, 'Pi'],
+	['&Rho;',     '&#929;',  true, 'Rho'],
+	['&Sigma;',   '&#931;',  true, 'Sigma'],
+	['&Tau;',     '&#932;',  true, 'Tau'],
+	['&Upsilon;', '&#933;',  true, 'Upsilon'],
+	['&Phi;',     '&#934;',  true, 'Phi'],
+	['&Chi;',     '&#935;',  true, 'Chi'],
+	['&Psi;',     '&#936;',  true, 'Psi'],
+	['&Omega;',   '&#937;',  true, 'Omega'],
+	['&alpha;',   '&#945;',  true, 'alpha'],
+	['&beta;',    '&#946;',  true, 'beta'],
+	['&gamma;',   '&#947;',  true, 'gamma'],
+	['&delta;',   '&#948;',  true, 'delta'],
+	['&epsilon;', '&#949;',  true, 'epsilon'],
+	['&zeta;',    '&#950;',  true, 'zeta'],
+	['&eta;',     '&#951;',  true, 'eta'],
+	['&theta;',   '&#952;',  true, 'theta'],
+	['&iota;',    '&#953;',  true, 'iota'],
+	['&kappa;',   '&#954;',  true, 'kappa'],
+	['&lambda;',  '&#955;',  true, 'lambda'],
+	['&mu;',      '&#956;',  true, 'mu'],
+	['&nu;',      '&#957;',  true, 'nu'],
+	['&xi;',      '&#958;',  true, 'xi'],
+	['&omicron;', '&#959;',  true, 'omicron'],
+	['&pi;',      '&#960;',  true, 'pi'],
+	['&rho;',     '&#961;',  true, 'rho'],
+	['&sigmaf;',  '&#962;',  true, 'final sigma'],
+	['&sigma;',   '&#963;',  true, 'sigma'],
+	['&tau;',     '&#964;',  true, 'tau'],
+	['&upsilon;', '&#965;',  true, 'upsilon'],
+	['&phi;',     '&#966;',  true, 'phi'],
+	['&chi;',     '&#967;',  true, 'chi'],
+	['&psi;',     '&#968;',  true, 'psi'],
+	['&omega;',   '&#969;',  true, 'omega'],
+// symbols
+	['&alefsym;', '&#8501;', false,'alef symbol'],
+	['&piv;',     '&#982;',  false,'pi symbol'],
+	['&real;',    '&#8476;', false,'real part symbol'],
+	['&thetasym;','&#977;',  false,'theta symbol'],
+	['&upsih;',   '&#978;',  false,'upsilon - hook symbol'],
+	['&weierp;',  '&#8472;', false,'Weierstrass p'],
+	['&image;',   '&#8465;', false,'imaginary part'],
+// arrows
+	['&larr;',    '&#8592;', true, 'leftwards arrow'],
+	['&uarr;',    '&#8593;', true, 'upwards arrow'],
+	['&rarr;',    '&#8594;', true, 'rightwards arrow'],
+	['&darr;',    '&#8595;', true, 'downwards arrow'],
+	['&harr;',    '&#8596;', true, 'left right arrow'],
+	['&crarr;',   '&#8629;', false,'carriage return'],
+	['&lArr;',    '&#8656;', false,'leftwards double arrow'],
+	['&uArr;',    '&#8657;', false,'upwards double arrow'],
+	['&rArr;',    '&#8658;', false,'rightwards double arrow'],
+	['&dArr;',    '&#8659;', false,'downwards double arrow'],
+	['&hArr;',    '&#8660;', false,'left right double arrow'],
+	['&there4;',  '&#8756;', false,'therefore'],
+	['&sub;',     '&#8834;', false,'subset of'],
+	['&sup;',     '&#8835;', false,'superset of'],
+	['&nsub;',    '&#8836;', false,'not a subset of'],
+	['&sube;',    '&#8838;', false,'subset of or equal to'],
+	['&supe;',    '&#8839;', false,'superset of or equal to'],
+	['&oplus;',   '&#8853;', false,'circled plus'],
+	['&otimes;',  '&#8855;', false,'circled times'],
+	['&perp;',    '&#8869;', false,'perpendicular'],
+	['&sdot;',    '&#8901;', false,'dot operator'],
+	['&lceil;',   '&#8968;', false,'left ceiling'],
+	['&rceil;',   '&#8969;', false,'right ceiling'],
+	['&lfloor;',  '&#8970;', false,'left floor'],
+	['&rfloor;',  '&#8971;', false,'right floor'],
+	['&lang;',    '&#9001;', false,'left-pointing angle bracket'],
+	['&rang;',    '&#9002;', false,'right-pointing angle bracket'],
+	['&loz;',     '&#9674;', true,'lozenge'],
+	['&spades;',  '&#9824;', false,'black spade suit'],
+	['&clubs;',   '&#9827;', true, 'black club suit'],
+	['&hearts;',  '&#9829;', true, 'black heart suit'],
+	['&diams;',   '&#9830;', true, 'black diamond suit'],
+	['&ensp;',    '&#8194;', false,'en space'],
+	['&emsp;',    '&#8195;', false,'em space'],
+	['&thinsp;',  '&#8201;', false,'thin space'],
+	['&zwnj;',    '&#8204;', false,'zero width non-joiner'],
+	['&zwj;',     '&#8205;', false,'zero width joiner'],
+	['&lrm;',     '&#8206;', false,'left-to-right mark'],
+	['&rlm;',     '&#8207;', false,'right-to-left mark'],
+	['&shy;',     '&#173;',  false,'soft hyphen']
+];
+
+tinyMCEPopup.onInit.add(function() {
+	tinyMCEPopup.dom.setHTML('charmapView', renderCharMapHTML());
+});
+
+function renderCharMapHTML() {
+	var charsPerRow = 20, tdWidth=20, tdHeight=20, i;
+	var html = '<table border="0" cellspacing="1" cellpadding="0" width="' + (tdWidth*charsPerRow) + '"><tr height="' + tdHeight + '">';
+	var cols=-1;
+
+	for (i=0; i<charmap.length; i++) {
+		if (charmap[i][2]==true) {
+			cols++;
+			html += ''
+				+ '<td class="charmap">'
+				+ '<a onmouseover="previewChar(\'' + charmap[i][1].substring(1,charmap[i][1].length) + '\',\'' + charmap[i][0].substring(1,charmap[i][0].length) + '\',\'' + charmap[i][3] + '\');" onfocus="previewChar(\'' + charmap[i][1].substring(1,charmap[i][1].length) + '\',\'' + charmap[i][0].substring(1,charmap[i][0].length) + '\',\'' + charmap[i][3] + '\');" href="javascript:void(0)" onclick="insertChar(\'' + charmap[i][1].substring(2,charmap[i][1].length-1) + '\');" onclick="return false;" onmousedown="return false;" title="' + charmap[i][3] + '">'
+				+ charmap[i][1]
+				+ '</a></td>';
+			if ((cols+1) % charsPerRow == 0)
+				html += '</tr><tr height="' + tdHeight + '">';
+		}
+	 }
+
+	if (cols % charsPerRow > 0) {
+		var padd = charsPerRow - (cols % charsPerRow);
+		for (var i=0; i<padd-1; i++)
+			html += '<td width="' + tdWidth + '" height="' + tdHeight + '" class="charmap">&nbsp;</td>';
+	}
+
+	html += '</tr></table>';
+
+	return html;
+}
+
+function insertChar(chr) {
+	tinyMCEPopup.execCommand('mceInsertContent', false, '&#' + chr + ';');
+
+	// Refocus in window
+	if (tinyMCEPopup.isWindow)
+		window.focus();
+
+	tinyMCEPopup.editor.focus();
+	tinyMCEPopup.close();
+}
+
+function previewChar(codeA, codeB, codeN) {
+	var elmA = document.getElementById('codeA');
+	var elmB = document.getElementById('codeB');
+	var elmV = document.getElementById('codeV');
+	var elmN = document.getElementById('codeN');
+
+	if (codeA=='#160;') {
+		elmV.innerHTML = '__';
+	} else {
+		elmV.innerHTML = '&' + codeA;
+	}
+
+	elmB.innerHTML = '&amp;' + codeA;
+	elmA.innerHTML = '&amp;' + codeB;
+	elmN.innerHTML = codeN;
+}
diff -x .svn -aruN 0.7.15.src/e107_handlers/tiny_mce/themes/advanced/js/color_picker.js 0.7.16.src/e107_handlers/tiny_mce/themes/advanced/js/color_picker.js
--- 0.7.15.src/e107_handlers/tiny_mce/themes/advanced/js/color_picker.js	1969-12-31 18:00:00.000000000 -0600
+++ 0.7.16.src/e107_handlers/tiny_mce/themes/advanced/js/color_picker.js	2009-07-06 15:33:57.000000000 -0500
@@ -0,0 +1,253 @@
+tinyMCEPopup.requireLangPack();
+
+var detail = 50, strhex = "0123456789abcdef", i, isMouseDown = false, isMouseOver = false;
+
+var colors = [
+	"#000000","#000033","#000066","#000099","#0000cc","#0000ff","#330000","#330033",
+	"#330066","#330099","#3300cc","#3300ff","#660000","#660033","#660066","#660099",
+	"#6600cc","#6600ff","#990000","#990033","#990066","#990099","#9900cc","#9900ff",
+	"#cc0000","#cc0033","#cc0066","#cc0099","#cc00cc","#cc00ff","#ff0000","#ff0033",
+	"#ff0066","#ff0099","#ff00cc","#ff00ff","#003300","#003333","#003366","#003399",
+	"#0033cc","#0033ff","#333300","#333333","#333366","#333399","#3333cc","#3333ff",
+	"#663300","#663333","#663366","#663399","#6633cc","#6633ff","#993300","#993333",
+	"#993366","#993399","#9933cc","#9933ff","#cc3300","#cc3333","#cc3366","#cc3399",
+	"#cc33cc","#cc33ff","#ff3300","#ff3333","#ff3366","#ff3399","#ff33cc","#ff33ff",
+	"#006600","#006633","#006666","#006699","#0066cc","#0066ff","#336600","#336633",
+	"#336666","#336699","#3366cc","#3366ff","#666600","#666633","#666666","#666699",
+	"#6666cc","#6666ff","#996600","#996633","#996666","#996699","#9966cc","#9966ff",
+	"#cc6600","#cc6633","#cc6666","#cc6699","#cc66cc","#cc66ff","#ff6600","#ff6633",
+	"#ff6666","#ff6699","#ff66cc","#ff66ff","#009900","#009933","#009966","#009999",
+	"#0099cc","#0099ff","#339900","#339933","#339966","#339999","#3399cc","#3399ff",
+	"#669900","#669933","#669966","#669999","#6699cc","#6699ff","#999900","#999933",
+	"#999966","#999999","#9999cc","#9999ff","#cc9900","#cc9933","#cc9966","#cc9999",
+	"#cc99cc","#cc99ff","#ff9900","#ff9933","#ff9966","#ff9999","#ff99cc","#ff99ff",
+	"#00cc00","#00cc33","#00cc66","#00cc99","#00cccc","#00ccff","#33cc00","#33cc33",
+	"#33cc66","#33cc99","#33cccc","#33ccff","#66cc00","#66cc33","#66cc66","#66cc99",
+	"#66cccc","#66ccff","#99cc00","#99cc33","#99cc66","#99cc99","#99cccc","#99ccff",
+	"#cccc00","#cccc33","#cccc66","#cccc99","#cccccc","#ccccff","#ffcc00","#ffcc33",
+	"#ffcc66","#ffcc99","#ffcccc","#ffccff","#00ff00","#00ff33","#00ff66","#00ff99",
+	"#00ffcc","#00ffff","#33ff00","#33ff33","#33ff66","#33ff99","#33ffcc","#33ffff",
+	"#66ff00","#66ff33","#66ff66","#66ff99","#66ffcc","#66ffff","#99ff00","#99ff33",
+	"#99ff66","#99ff99","#99ffcc","#99ffff","#ccff00","#ccff33","#ccff66","#ccff99",
+	"#ccffcc","#ccffff","#ffff00","#ffff33","#ffff66","#ffff99","#ffffcc","#ffffff"
+];
+
+var named = {
+	'#F0F8FF':'AliceBlue','#FAEBD7':'AntiqueWhite','#00FFFF':'Aqua','#7FFFD4':'Aquamarine','#F0FFFF':'Azure','#F5F5DC':'Beige',
+	'#FFE4C4':'Bisque','#000000':'Black','#FFEBCD':'BlanchedAlmond','#0000FF':'Blue','#8A2BE2':'BlueViolet','#A52A2A':'Brown',
+	'#DEB887':'BurlyWood','#5F9EA0':'CadetBlue','#7FFF00':'Chartreuse','#D2691E':'Chocolate','#FF7F50':'Coral','#6495ED':'CornflowerBlue',
+	'#FFF8DC':'Cornsilk','#DC143C':'Crimson','#00FFFF':'Cyan','#00008B':'DarkBlue','#008B8B':'DarkCyan','#B8860B':'DarkGoldenRod',
+	'#A9A9A9':'DarkGray','#A9A9A9':'DarkGrey','#006400':'DarkGreen','#BDB76B':'DarkKhaki','#8B008B':'DarkMagenta','#556B2F':'DarkOliveGreen',
+	'#FF8C00':'Darkorange','#9932CC':'DarkOrchid','#8B0000':'DarkRed','#E9967A':'DarkSalmon','#8FBC8F':'DarkSeaGreen','#483D8B':'DarkSlateBlue',
+	'#2F4F4F':'DarkSlateGray','#2F4F4F':'DarkSlateGrey','#00CED1':'DarkTurquoise','#9400D3':'DarkViolet','#FF1493':'DeepPink','#00BFFF':'DeepSkyBlue',
+	'#696969':'DimGray','#696969':'DimGrey','#1E90FF':'DodgerBlue','#B22222':'FireBrick','#FFFAF0':'FloralWhite','#228B22':'ForestGreen',
+	'#FF00FF':'Fuchsia','#DCDCDC':'Gainsboro','#F8F8FF':'GhostWhite','#FFD700':'Gold','#DAA520':'GoldenRod','#808080':'Gray','#808080':'Grey',
+	'#008000':'Green','#ADFF2F':'GreenYellow','#F0FFF0':'HoneyDew','#FF69B4':'HotPink','#CD5C5C':'IndianRed','#4B0082':'Indigo','#FFFFF0':'Ivory',
+	'#F0E68C':'Khaki','#E6E6FA':'Lavender','#FFF0F5':'LavenderBlush','#7CFC00':'LawnGreen','#FFFACD':'LemonChiffon','#ADD8E6':'LightBlue',
+	'#F08080':'LightCoral','#E0FFFF':'LightCyan','#FAFAD2':'LightGoldenRodYellow','#D3D3D3':'LightGray','#D3D3D3':'LightGrey','#90EE90':'LightGreen',
+	'#FFB6C1':'LightPink','#FFA07A':'LightSalmon','#20B2AA':'LightSeaGreen','#87CEFA':'LightSkyBlue','#778899':'LightSlateGray','#778899':'LightSlateGrey',
+	'#B0C4DE':'LightSteelBlue','#FFFFE0':'LightYellow','#00FF00':'Lime','#32CD32':'LimeGreen','#FAF0E6':'Linen','#FF00FF':'Magenta','#800000':'Maroon',
+	'#66CDAA':'MediumAquaMarine','#0000CD':'MediumBlue','#BA55D3':'MediumOrchid','#9370D8':'MediumPurple','#3CB371':'MediumSeaGreen','#7B68EE':'MediumSlateBlue',
+	'#00FA9A':'MediumSpringGreen','#48D1CC':'MediumTurquoise','#C71585':'MediumVioletRed','#191970':'MidnightBlue','#F5FFFA':'MintCream','#FFE4E1':'MistyRose','#FFE4B5':'Moccasin',
+	'#FFDEAD':'NavajoWhite','#000080':'Navy','#FDF5E6':'OldLace','#808000':'Olive','#6B8E23':'OliveDrab','#FFA500':'Orange','#FF4500':'OrangeRed','#DA70D6':'Orchid',
+	'#EEE8AA':'PaleGoldenRod','#98FB98':'PaleGreen','#AFEEEE':'PaleTurquoise','#D87093':'PaleVioletRed','#FFEFD5':'PapayaWhip','#FFDAB9':'PeachPuff',
+	'#CD853F':'Peru','#FFC0CB':'Pink','#DDA0DD':'Plum','#B0E0E6':'PowderBlue','#800080':'Purple','#FF0000':'Red','#BC8F8F':'RosyBrown','#4169E1':'RoyalBlue',
+	'#8B4513':'SaddleBrown','#FA8072':'Salmon','#F4A460':'SandyBrown','#2E8B57':'SeaGreen','#FFF5EE':'SeaShell','#A0522D':'Sienna','#C0C0C0':'Silver',
+	'#87CEEB':'SkyBlue','#6A5ACD':'SlateBlue','#708090':'SlateGray','#708090':'SlateGrey','#FFFAFA':'Snow','#00FF7F':'SpringGreen',
+	'#4682B4':'SteelBlue','#D2B48C':'Tan','#008080':'Teal','#D8BFD8':'Thistle','#FF6347':'Tomato','#40E0D0':'Turquoise','#EE82EE':'Violet',
+	'#F5DEB3':'Wheat','#FFFFFF':'White','#F5F5F5':'WhiteSmoke','#FFFF00':'Yellow','#9ACD32':'YellowGreen'
+};
+
+function init() {
+	var inputColor = convertRGBToHex(tinyMCEPopup.getWindowArg('input_color'));
+
+	tinyMCEPopup.resizeToInnerSize();
+
+	generatePicker();
+
+	if (inputColor) {
+		changeFinalColor(inputColor);
+
+		col = convertHexToRGB(inputColor);
+
+		if (col)
+			updateLight(col.r, col.g, col.b);
+	}
+}
+
+function insertAction() {
+	var color = document.getElementById("color").value, f = tinyMCEPopup.getWindowArg('func');
+
+	tinyMCEPopup.restoreSelection();
+
+	if (f)
+		f(color);
+
+	tinyMCEPopup.close();
+}
+
+function showColor(color, name) {
+	if (name)
+		document.getElementById("colorname").innerHTML = name;
+
+	document.getElementById("preview").style.backgroundColor = color;
+	document.getElementById("color").value = color.toLowerCase();
+}
+
+function convertRGBToHex(col) {
+	var re = new RegExp("rgb\\s*\\(\\s*([0-9]+).*,\\s*([0-9]+).*,\\s*([0-9]+).*\\)", "gi");
+
+	if (!col)
+		return col;
+
+	var rgb = col.replace(re, "$1,$2,$3").split(',');
+	if (rgb.length == 3) {
+		r = parseInt(rgb[0]).toString(16);
+		g = parseInt(rgb[1]).toString(16);
+		b = parseInt(rgb[2]).toString(16);
+
+		r = r.length == 1 ? '0' + r : r;
+		g = g.length == 1 ? '0' + g : g;
+		b = b.length == 1 ? '0' + b : b;
+
+		return "#" + r + g + b;
+	}
+
+	return col;
+}
+
+function convertHexToRGB(col) {
+	if (col.indexOf('#') != -1) {
+		col = col.replace(new RegExp('[^0-9A-F]', 'gi'), '');
+
+		r = parseInt(col.substring(0, 2), 16);
+		g = parseInt(col.substring(2, 4), 16);
+		b = parseInt(col.substring(4, 6), 16);
+
+		return {r : r, g : g, b : b};
+	}
+
+	return null;
+}
+
+function generatePicker() {
+	var el = document.getElementById('light'), h = '', i;
+
+	for (i = 0; i < detail; i++){
+		h += '<div id="gs'+i+'" style="background-color:#000000; width:15px; height:3px; border-style:none; border-width:0px;"'
+		+ ' onclick="changeFinalColor(this.style.backgroundColor)"'
+		+ ' onmousedown="isMouseDown = true; return false;"'
+		+ ' onmouseup="isMouseDown = false;"'
+		+ ' onmousemove="if (isMouseDown && isMouseOver) changeFinalColor(this.style.backgroundColor); return false;"'
+		+ ' onmouseover="isMouseOver = true;"'
+		+ ' onmouseout="isMouseOver = false;"'
+		+ '></div>';
+	}
+
+	el.innerHTML = h;
+}
+
+function generateWebColors() {
+	var el = document.getElementById('webcolors'), h = '', i;
+
+	if (el.className == 'generated')
+		return;
+
+	h += '<table border="0" cellspacing="1" cellpadding="0">'
+		+ '<tr>';
+
+	for (i=0; i<colors.length; i++) {
+		h += '<td bgcolor="' + colors[i] + '" width="10" height="10">'
+			+ '<a href="javascript:insertAction();" onfocus="showColor(\'' + colors[i] +  '\');" onmouseover="showColor(\'' + colors[i] +  '\');" style="display:block;width:10px;height:10px;overflow:hidden;">'
+			+ '</a></td>';
+		if ((i+1) % 18 == 0)
+			h += '</tr><tr>';
+	}
+
+	h += '</table>';
+
+	el.innerHTML = h;
+	el.className = 'generated';
+}
+
+function generateNamedColors() {
+	var el = document.getElementById('namedcolors'), h = '', n, v, i = 0;
+
+	if (el.className == 'generated')
+		return;
+
+	for (n in named) {
+		v = named[n];
+		h += '<a href="javascript:insertAction();" onmouseover="showColor(\'' + n +  '\',\'' + v + '\');" style="background-color: ' + n + '"><!-- IE --></a>'
+	}
+
+	el.innerHTML = h;
+	el.className = 'generated';
+}
+
+function dechex(n) {
+	return strhex.charAt(Math.floor(n / 16)) + strhex.charAt(n % 16);
+}
+
+function computeColor(e) {
+	var x, y, partWidth, partDetail, imHeight, r, g, b, coef, i, finalCoef, finalR, finalG, finalB;
+
+	x = e.offsetX ? e.offsetX : (e.target ? e.clientX - e.target.x : 0);
+	y = e.offsetY ? e.offsetY : (e.target ? e.clientY - e.target.y : 0);
+
+	partWidth = document.getElementById('colors').width / 6;
+	partDetail = detail / 2;
+	imHeight = document.getElementById('colors').height;
+
+	r = (x >= 0)*(x < partWidth)*255 + (x >= partWidth)*(x < 2*partWidth)*(2*255 - x * 255 / partWidth) + (x >= 4*partWidth)*(x < 5*partWidth)*(-4*255 + x * 255 / partWidth) + (x >= 5*partWidth)*(x < 6*partWidth)*255;
+	g = (x >= 0)*(x < partWidth)*(x * 255 / partWidth) + (x >= partWidth)*(x < 3*partWidth)*255	+ (x >= 3*partWidth)*(x < 4*partWidth)*(4*255 - x * 255 / partWidth);
+	b = (x >= 2*partWidth)*(x < 3*partWidth)*(-2*255 + x * 255 / partWidth) + (x >= 3*partWidth)*(x < 5*partWidth)*255 + (x >= 5*partWidth)*(x < 6*partWidth)*(6*255 - x * 255 / partWidth);
+
+	coef = (imHeight - y) / imHeight;
+	r = 128 + (r - 128) * coef;
+	g = 128 + (g - 128) * coef;
+	b = 128 + (b - 128) * coef;
+
+	changeFinalColor('#' + dechex(r) + dechex(g) + dechex(b));
+	updateLight(r, g, b);
+}
+
+function updateLight(r, g, b) {
+	var i, partDetail = detail / 2, finalCoef, finalR, finalG, finalB, color;
+
+	for (i=0; i<detail; i++) {
+		if ((i>=0) && (i<partDetail)) {
+			finalCoef = i / partDetail;
+			finalR = dechex(255 - (255 - r) * finalCoef);
+			finalG = dechex(255 - (255 - g) * finalCoef);
+			finalB = dechex(255 - (255 - b) * finalCoef);
+		} else {
+			finalCoef = 2 - i / partDetail;
+			finalR = dechex(r * finalCoef);
+			finalG = dechex(g * finalCoef);
+			finalB = dechex(b * finalCoef);
+		}
+
+		color = finalR + finalG + finalB;
+
+		setCol('gs' + i, '#'+color);
+	}
+}
+
+function changeFinalColor(color) {
+	if (color.indexOf('#') == -1)
+		color = convertRGBToHex(color);
+
+	setCol('preview', color);
+	document.getElementById('color').value = color;
+}
+
+function setCol(e, c) {
+	try {
+		document.getElementById(e).style.backgroundColor = c;
+	} catch (ex) {
+		// Ignore IE warning
+	}
+}
+
+tinyMCEPopup.onInit.add(init);
diff -x .svn -aruN 0.7.15.src/e107_handlers/tiny_mce/themes/advanced/js/image.js 0.7.16.src/e107_handlers/tiny_mce/themes/advanced/js/image.js
--- 0.7.15.src/e107_handlers/tiny_mce/themes/advanced/js/image.js	1969-12-31 18:00:00.000000000 -0600
+++ 0.7.16.src/e107_handlers/tiny_mce/themes/advanced/js/image.js	2009-07-06 15:33:57.000000000 -0500
@@ -0,0 +1,245 @@
+var ImageDialog = {
+	preInit : function() {
+		var url;
+
+		tinyMCEPopup.requireLangPack();
+
+		if (url = tinyMCEPopup.getParam("external_image_list_url"))
+			document.write('<script language="javascript" type="text/javascript" src="' + tinyMCEPopup.editor.documentBaseURI.toAbsolute(url) + '"></script>');
+	},
+
+	init : function() {
+		var f = document.forms[0], ed = tinyMCEPopup.editor;
+
+		// Setup browse button
+		document.getElementById('srcbrowsercontainer').innerHTML = getBrowserHTML('srcbrowser','src','image','theme_advanced_image');
+		if (isVisible('srcbrowser'))
+			document.getElementById('src').style.width = '180px';
+
+		e = ed.selection.getNode();
+
+		this.fillFileList('image_list', 'tinyMCEImageList');
+
+		if (e.nodeName == 'IMG') {
+			f.src.value = ed.dom.getAttrib(e, 'src');
+			f.alt.value = ed.dom.getAttrib(e, 'alt');
+			f.border.value = this.getAttrib(e, 'border');
+			f.vspace.value = this.getAttrib(e, 'vspace');
+			f.hspace.value = this.getAttrib(e, 'hspace');
+			f.width.value = ed.dom.getAttrib(e, 'width');
+			f.height.value = ed.dom.getAttrib(e, 'height');
+			f.insert.value = ed.getLang('update');
+			this.styleVal = ed.dom.getAttrib(e, 'style');
+			selectByValue(f, 'image_list', f.src.value);
+			selectByValue(f, 'align', this.getAttrib(e, 'align'));
+			this.updateStyle();
+		}
+	},
+
+	fillFileList : function(id, l) {
+		var dom = tinyMCEPopup.dom, lst = dom.get(id), v, cl;
+
+		l = window[l];
+
+		if (l && l.length > 0) {
+			lst.options[lst.options.length] = new Option('', '');
+
+			tinymce.each(l, function(o) {
+				lst.options[lst.options.length] = new Option(o[0], o[1]);
+			});
+		} else
+			dom.remove(dom.getParent(id, 'tr'));
+	},
+
+	update : function() {
+		var f = document.forms[0], nl = f.elements, ed = tinyMCEPopup.editor, args = {}, el;
+
+		tinyMCEPopup.restoreSelection();
+
+		if (f.src.value === '') {
+			if (ed.selection.getNode().nodeName == 'IMG') {
+				ed.dom.remove(ed.selection.getNode());
+				ed.execCommand('mceRepaint');
+			}
+
+			tinyMCEPopup.close();
+			return;
+		}
+
+		if (!ed.settings.inline_styles) {
+			args = tinymce.extend(args, {
+				vspace : nl.vspace.value,
+				hspace : nl.hspace.value,
+				border : nl.border.value,
+				align : getSelectValue(f, 'align')
+			});
+		} else
+			args.style = this.styleVal;
+
+		tinymce.extend(args, {
+			src : f.src.value,
+			alt : f.alt.value,
+			width : f.width.value,
+			height : f.height.value
+		});
+
+		el = ed.selection.getNode();
+
+		if (el && el.nodeName == 'IMG') {
+			ed.dom.setAttribs(el, args);
+		} else {
+			ed.execCommand('mceInsertContent', false, '<img id="__mce_tmp" />', {skip_undo : 1});
+			ed.dom.setAttribs('__mce_tmp', args);
+			ed.dom.setAttrib('__mce_tmp', 'id', '');
+			ed.undoManager.add();
+		}
+
+		tinyMCEPopup.close();
+	},
+
+	updateStyle : function() {
+		var dom = tinyMCEPopup.dom, st, v, f = document.forms[0];
+
+		if (tinyMCEPopup.editor.settings.inline_styles) {
+			st = tinyMCEPopup.dom.parseStyle(this.styleVal);
+
+			// Handle align
+			v = getSelectValue(f, 'align');
+			if (v) {
+				if (v == 'left' || v == 'right') {
+					st['float'] = v;
+					delete st['vertical-align'];
+				} else {
+					st['vertical-align'] = v;
+					delete st['float'];
+				}
+			} else {
+				delete st['float'];
+				delete st['vertical-align'];
+			}
+
+			// Handle border
+			v = f.border.value;
+			if (v || v == '0') {
+				if (v == '0')
+					st['border'] = '0';
+				else
+					st['border'] = v + 'px solid black';
+			} else
+				delete st['border'];
+
+			// Handle hspace
+			v = f.hspace.value;
+			if (v) {
+				delete st['margin'];
+				st['margin-left'] = v + 'px';
+				st['margin-right'] = v + 'px';
+			} else {
+				delete st['margin-left'];
+				delete st['margin-right'];
+			}
+
+			// Handle vspace
+			v = f.vspace.value;
+			if (v) {
+				delete st['margin'];
+				st['margin-top'] = v + 'px';
+				st['margin-bottom'] = v + 'px';
+			} else {
+				delete st['margin-top'];
+				delete st['margin-bottom'];
+			}
+
+			// Merge
+			st = tinyMCEPopup.dom.parseStyle(dom.serializeStyle(st));
+			this.styleVal = dom.serializeStyle(st);
+		}
+	},
+
+	getAttrib : function(e, at) {
+		var ed = tinyMCEPopup.editor, dom = ed.dom, v, v2;
+
+		if (ed.settings.inline_styles) {
+			switch (at) {
+				case 'align':
+					if (v = dom.getStyle(e, 'float'))
+						return v;
+
+					if (v = dom.getStyle(e, 'vertical-align'))
+						return v;
+
+					break;
+
+				case 'hspace':
+					v = dom.getStyle(e, 'margin-left')
+					v2 = dom.getStyle(e, 'margin-right');
+					if (v && v == v2)
+						return parseInt(v.replace(/[^0-9]/g, ''));
+
+					break;
+
+				case 'vspace':
+					v = dom.getStyle(e, 'margin-top')
+					v2 = dom.getStyle(e, 'margin-bottom');
+					if (v && v == v2)
+						return parseInt(v.replace(/[^0-9]/g, ''));
+
+					break;
+
+				case 'border':
+					v = 0;
+
+					tinymce.each(['top', 'right', 'bottom', 'left'], function(sv) {
+						sv = dom.getStyle(e, 'border-' + sv + '-width');
+
+						// False or not the same as prev
+						if (!sv || (sv != v && v !== 0)) {
+							v = 0;
+							return false;
+						}
+
+						if (sv)
+							v = sv;
+					});
+
+					if (v)
+						return parseInt(v.replace(/[^0-9]/g, ''));
+
+					break;
+			}
+		}
+
+		if (v = dom.getAttrib(e, at))
+			return v;
+
+		return '';
+	},
+
+	resetImageData : function() {
+		var f = document.forms[0];
+
+		f.width.value = f.height.value = "";	
+	},
+
+	updateImageData : function() {
+		var f = document.forms[0], t = ImageDialog;
+
+		if (f.width.value == "")
+			f.width.value = t.preloadImg.width;
+
+		if (f.height.value == "")
+			f.height.value = t.preloadImg.height;
+	},
+
+	getImageData : function() {
+		var f = document.forms[0];
+
+		this.preloadImg = new Image();
+		this.preloadImg.onload = this.updateImageData;
+		this.preloadImg.onerror = this.resetImageData;
+		this.preloadImg.src = tinyMCEPopup.editor.documentBaseURI.toAbsolute(f.src.value);
+	}
+};
+
+ImageDialog.preInit();
+tinyMCEPopup.onInit.add(ImageDialog.init, ImageDialog);
diff -x .svn -aruN 0.7.15.src/e107_handlers/tiny_mce/themes/advanced/js/link.js 0.7.16.src/e107_handlers/tiny_mce/themes/advanced/js/link.js
--- 0.7.15.src/e107_handlers/tiny_mce/themes/advanced/js/link.js	1969-12-31 18:00:00.000000000 -0600
+++ 0.7.16.src/e107_handlers/tiny_mce/themes/advanced/js/link.js	2009-07-06 15:33:57.000000000 -0500
@@ -0,0 +1,156 @@
+tinyMCEPopup.requireLangPack();
+
+var LinkDialog = {
+	preInit : function() {
+		var url;
+
+		if (url = tinyMCEPopup.getParam("external_link_list_url"))
+			document.write('<script language="javascript" type="text/javascript" src="' + tinyMCEPopup.editor.documentBaseURI.toAbsolute(url) + '"></script>');
+	},
+
+	init : function() {
+		var f = document.forms[0], ed = tinyMCEPopup.editor;
+
+		// Setup browse button
+		document.getElementById('hrefbrowsercontainer').innerHTML = getBrowserHTML('hrefbrowser', 'href', 'file', 'theme_advanced_link');
+		if (isVisible('hrefbrowser'))
+			document.getElementById('href').style.width = '180px';
+
+		this.fillClassList('class_list');
+		this.fillFileList('link_list', 'tinyMCELinkList');
+		this.fillTargetList('target_list');
+
+		if (e = ed.dom.getParent(ed.selection.getNode(), 'A')) {
+			f.href.value = ed.dom.getAttrib(e, 'href');
+			f.linktitle.value = ed.dom.getAttrib(e, 'title');
+			f.insert.value = ed.getLang('update');
+			selectByValue(f, 'link_list', f.href.value);
+			selectByValue(f, 'target_list', ed.dom.getAttrib(e, 'target'));
+			selectByValue(f, 'class_list', ed.dom.getAttrib(e, 'class'));
+		}
+	},
+
+	update : function() {
+		var f = document.forms[0], ed = tinyMCEPopup.editor, e, b;
+
+		tinyMCEPopup.restoreSelection();
+		e = ed.dom.getParent(ed.selection.getNode(), 'A');
+
+		// Remove element if there is no href
+		if (!f.href.value) {
+			if (e) {
+				tinyMCEPopup.execCommand("mceBeginUndoLevel");
+				b = ed.selection.getBookmark();
+				ed.dom.remove(e, 1);
+				ed.selection.moveToBookmark(b);
+				tinyMCEPopup.execCommand("mceEndUndoLevel");
+				tinyMCEPopup.close();
+				return;
+			}
+		}
+
+		tinyMCEPopup.execCommand("mceBeginUndoLevel");
+
+		// Create new anchor elements
+		if (e == null) {
+			ed.getDoc().execCommand("unlink", false, null);
+			tinyMCEPopup.execCommand("CreateLink", false, "#mce_temp_url#", {skip_undo : 1});
+
+			tinymce.each(ed.dom.select("a"), function(n) {
+				if (ed.dom.getAttrib(n, 'href') == '#mce_temp_url#') {
+					e = n;
+
+					ed.dom.setAttribs(e, {
+						href : f.href.value,
+						title : f.linktitle.value,
+						target : f.target_list ? f.target_list.options[f.target_list.selectedIndex].value : null,
+						'class' : f.class_list ? f.class_list.options[f.class_list.selectedIndex].value : null
+					});
+				}
+			});
+		} else {
+			ed.dom.setAttribs(e, {
+				href : f.href.value,
+				title : f.linktitle.value,
+				target : f.target_list ? f.target_list.options[f.target_list.selectedIndex].value : null,
+				'class' : f.class_list ? f.class_list.options[f.class_list.selectedIndex].value : null
+			});
+		}
+
+		// Don't move caret if selection was image
+		if (e.childNodes.length != 1 || e.firstChild.nodeName != 'IMG') {
+			ed.focus();
+			ed.selection.select(e);
+			ed.selection.collapse(0);
+			tinyMCEPopup.storeSelection();
+		}
+
+		tinyMCEPopup.execCommand("mceEndUndoLevel");
+		tinyMCEPopup.close();
+	},
+
+	checkPrefix : function(n) {
+		if (n.value && Validator.isEmail(n) && !/^\s*mailto:/i.test(n.value) && confirm(tinyMCEPopup.getLang('advanced_dlg.link_is_email')))
+			n.value = 'mailto:' + n.value;
+
+		if (/^\s*www\./i.test(n.value) && confirm(tinyMCEPopup.getLang('advanced_dlg.link_is_external')))
+			n.value = 'http://' + n.value;
+	},
+
+	fillFileList : function(id, l) {
+		var dom = tinyMCEPopup.dom, lst = dom.get(id), v, cl;
+
+		l = window[l];
+
+		if (l && l.length > 0) {
+			lst.options[lst.options.length] = new Option('', '');
+
+			tinymce.each(l, function(o) {
+				lst.options[lst.options.length] = new Option(o[0], o[1]);
+			});
+		} else
+			dom.remove(dom.getParent(id, 'tr'));
+	},
+
+	fillClassList : function(id) {
+		var dom = tinyMCEPopup.dom, lst = dom.get(id), v, cl;
+
+		if (v = tinyMCEPopup.getParam('theme_advanced_styles')) {
+			cl = [];
+
+			tinymce.each(v.split(';'), function(v) {
+				var p = v.split('=');
+
+				cl.push({'title' : p[0], 'class' : p[1]});
+			});
+		} else
+			cl = tinyMCEPopup.editor.dom.getClasses();
+
+		if (cl.length > 0) {
+			lst.options[lst.options.length] = new Option(tinyMCEPopup.getLang('not_set'), '');
+
+			tinymce.each(cl, function(o) {
+				lst.options[lst.options.length] = new Option(o.title || o['class'], o['class']);
+			});
+		} else
+			dom.remove(dom.getParent(id, 'tr'));
+	},
+
+	fillTargetList : function(id) {
+		var dom = tinyMCEPopup.dom, lst = dom.get(id), v;
+
+		lst.options[lst.options.length] = new Option(tinyMCEPopup.getLang('not_set'), '');
+		lst.options[lst.options.length] = new Option(tinyMCEPopup.getLang('advanced_dlg.link_target_same'), '_self');
+		lst.options[lst.options.length] = new Option(tinyMCEPopup.getLang('advanced_dlg.link_target_blank'), '_blank');
+
+		if (v = tinyMCEPopup.getParam('theme_advanced_link_targets')) {
+			tinymce.each(v.split(','), function(v) {
+				v = v.split('=');
+				lst.options[lst.options.length] = new Option(v[0], v[1]);
+			});
+		}
+	}
+};
+
+LinkDialog.preInit();
+tinyMCEPopup.onInit.add(LinkDialog.init, LinkDialog);
diff -x .svn -aruN 0.7.15.src/e107_handlers/tiny_mce/themes/advanced/js/source_editor.js 0.7.16.src/e107_handlers/tiny_mce/themes/advanced/js/source_editor.js
--- 0.7.15.src/e107_handlers/tiny_mce/themes/advanced/js/source_editor.js	1969-12-31 18:00:00.000000000 -0600
+++ 0.7.16.src/e107_handlers/tiny_mce/themes/advanced/js/source_editor.js	2009-07-06 15:33:57.000000000 -0500
@@ -0,0 +1,62 @@
+tinyMCEPopup.requireLangPack();
+tinyMCEPopup.onInit.add(onLoadInit);
+
+function saveContent() {
+	tinyMCEPopup.editor.setContent(document.getElementById('htmlSource').value, {source_view : true});
+	tinyMCEPopup.close();
+}
+
+function onLoadInit() {
+	tinyMCEPopup.resizeToInnerSize();
+
+	// Remove Gecko spellchecking
+	if (tinymce.isGecko)
+		document.body.spellcheck = tinyMCEPopup.editor.getParam("gecko_spellcheck");
+
+	document.getElementById('htmlSource').value = tinyMCEPopup.editor.getContent({source_view : true});
+
+	if (tinyMCEPopup.editor.getParam("theme_advanced_source_editor_wrap", true)) {
+		setWrap('soft');
+		document.getElementById('wraped').checked = true;
+	}
+
+	resizeInputs();
+}
+
+function setWrap(val) {
+	var v, n, s = document.getElementById('htmlSource');
+
+	s.wrap = val;
+
+	if (!tinymce.isIE) {
+		v = s.value;
+		n = s.cloneNode(false);
+		n.setAttribute("wrap", val);
+		s.parentNode.replaceChild(n, s);
+		n.value = v;
+	}
+}
+
+function toggleWordWrap(elm) {
+	if (elm.checked)
+		setWrap('soft');
+	else
+		setWrap('off');
+}
+
+var wHeight=0, wWidth=0, owHeight=0, owWidth=0;
+
+function resizeInputs() {
+	var el = document.getElementById('htmlSource');
+
+	if (!tinymce.isIE) {
+		 wHeight = self.innerHeight - 65;
+		 wWidth = self.innerWidth - 16;
+	} else {
+		 wHeight = document.body.clientHeight - 70;
+		 wWidth = document.body.clientWidth - 16;
+	}
+
+	el.style.height = Math.abs(wHeight) + 'px';
+	el.style.width  = Math.abs(wWidth) + 'px';
+}
diff -x .svn -aruN 0.7.15.src/e107_handlers/tiny_mce/themes/advanced/langs/en_dlg.js 0.7.16.src/e107_handlers/tiny_mce/themes/advanced/langs/en_dlg.js
--- 0.7.15.src/e107_handlers/tiny_mce/themes/advanced/langs/en_dlg.js	1969-12-31 18:00:00.000000000 -0600
+++ 0.7.16.src/e107_handlers/tiny_mce/themes/advanced/langs/en_dlg.js	2009-07-06 15:33:57.000000000 -0500
@@ -0,0 +1,51 @@
+tinyMCE.addI18n('en.advanced_dlg',{
+about_title:"About TinyMCE",
+about_general:"About",
+about_help:"Help",
+about_license:"License",
+about_plugins:"Plugins",
+about_plugin:"Plugin",
+about_author:"Author",
+about_version:"Version",
+about_loaded:"Loaded plugins",
+anchor_title:"Insert/edit anchor",
+anchor_name:"Anchor name",
+code_title:"HTML Source Editor",
+code_wordwrap:"Word wrap",
+colorpicker_title:"Select a color",
+colorpicker_picker_tab:"Picker",
+colorpicker_picker_title:"Color picker",
+colorpicker_palette_tab:"Palette",
+colorpicker_palette_title:"Palette colors",
+colorpicker_named_tab:"Named",
+colorpicker_named_title:"Named colors",
+colorpicker_color:"Color:",
+colorpicker_name:"Name:",
+charmap_title:"Select custom character",
+image_title:"Insert/edit image",
+image_src:"Image URL",
+image_alt:"Image description",
+image_list:"Image list",
+image_border:"Border",
+image_dimensions:"Dimensions",
+image_vspace:"Vertical space",
+image_hspace:"Horizontal space",
+image_align:"Alignment",
+image_align_baseline:"Baseline",
+image_align_top:"Top",
+image_align_middle:"Middle",
+image_align_bottom:"Bottom",
+image_align_texttop:"Text top",
+image_align_textbottom:"Text bottom",
+image_align_left:"Left",
+image_align_right:"Right",
+link_title:"Insert/edit link",
+link_url:"Link URL",
+link_target:"Target",
+link_target_same:"Open link in the same window",
+link_target_blank:"Open link in a new window",
+link_titlefield:"Title",
+link_is_email:"The URL you entered seems to be an email address, do you want to add the required mailto: prefix?",
+link_is_external:"The URL you entered seems to external link, do you want to add the required http:// prefix?",
+link_list:"Link list"
+});
\ No newline at end of file
diff -x .svn -aruN 0.7.15.src/e107_handlers/tiny_mce/themes/advanced/langs/en.js 0.7.16.src/e107_handlers/tiny_mce/themes/advanced/langs/en.js
--- 0.7.15.src/e107_handlers/tiny_mce/themes/advanced/langs/en.js	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_handlers/tiny_mce/themes/advanced/langs/en.js	2009-06-30 19:36:50.000000000 -0500
@@ -1,82 +1,62 @@
-// UK lang variables
-
-tinyMCE.addToLang('',{
-theme_style_select : '-- Styles --',
-theme_code_desc : 'Edit HTML Source',
-theme_code_title : 'HTML Source Editor',
-theme_code_wordwrap : 'Word wrap',
-theme_sub_desc : 'Subscript',
-theme_sup_desc : 'Superscript',
-theme_hr_desc : 'Insert horizontal ruler',
-theme_removeformat_desc : 'Remove formatting',
-theme_custom1_desc : 'Your custom description here',
-insert_image_border : 'Border',
-insert_image_dimensions : 'Dimensions',
-insert_image_vspace : 'Vertical space',
-insert_image_hspace : 'Horizontal space',
-insert_image_align : 'Alignment',
-insert_image_align_default : '-- Not set --',
-insert_image_align_baseline : 'Baseline',
-insert_image_align_top : 'Top',
-insert_image_align_middle : 'Middle',
-insert_image_align_bottom : 'Bottom',
-insert_image_align_texttop : 'TextTop',
-insert_image_align_absmiddle : 'Absolute Middle',
-insert_image_align_absbottom : 'Absolute Bottom',
-insert_image_align_left : 'Left',
-insert_image_align_right : 'Right',
-theme_font_size : '-- Font size --',
-theme_fontdefault : '-- Font family --',
-theme_block : '-- Format --',
-theme_paragraph : 'Paragraph',
-theme_div : 'Div',
-theme_address : 'Address',
-theme_pre : 'Preformatted',
-theme_h1 : 'Heading 1',
-theme_h2 : 'Heading 2',
-theme_h3 : 'Heading 3',
-theme_h4 : 'Heading 4',
-theme_h5 : 'Heading 5',
-theme_h6 : 'Heading 6',
-theme_blockquote : 'Blockquote',
-theme_code : 'Code',
-theme_samp : 'Code sample',
-theme_dt : 'Definition term ',
-theme_dd : 'Definition description',
-theme_colorpicker_title : 'Select a color',
-theme_colorpicker_apply : 'Apply',
-theme_forecolor_desc : 'Select text color',
-theme_backcolor_desc : 'Select background color',
-theme_charmap_title : 'Select custom character',
-theme_charmap_desc : 'Insert custom character',
-theme_visualaid_desc : 'Toggle guidelines/invisible elements',
-insert_anchor_title : 'Insert/edit anchor',
-insert_anchor_name : 'Anchor name',
-theme_anchor_desc : 'Insert/edit anchor',
-theme_insert_link_titlefield : 'Title',
-theme_clipboard_msg : 'Copy/Cut/Paste is not available in Mozilla and Firefox.\nDo you want more information about this issue?',
-theme_path : 'Path',
-cut_desc : 'Cut',
-copy_desc : 'Copy',
-paste_desc : 'Paste',
-link_list : 'Link list',
-image_list : 'Image list',
-browse : 'Browse',
-image_props_desc : 'Image properties',
-newdocument_desc : 'New document',
-class_name : 'Class',
-newdocument : 'Are you sure you want clear all contents?',
-about_title : 'About TinyMCE',
-about : 'About',
-license : 'License',
-plugins : 'Plugins',
-plugin : 'Plugin',
-author : 'Author',
-version : 'Version',
-loaded_plugins : 'Loaded plugins',
-help : 'Help',
-not_set : '-- Not set --',
-close : 'Close',
-toolbar_focus : 'Jump to tool buttons - Alt+Q, Jump to editor - Alt-Z, Jump to element path - Alt-X',
-invalid_data : 'Error: Invalid values entered, these are marked in red.'
-});
+tinyMCE.addI18n('en.advanced',{
+style_select:"Styles",
+font_size:"Font size",
+fontdefault:"Font family",
+block:"Format",
+paragraph:"Paragraph",
+div:"Div",
+address:"Address",
+pre:"Preformatted",
+h1:"Heading 1",
+h2:"Heading 2",
+h3:"Heading 3",
+h4:"Heading 4",
+h5:"Heading 5",
+h6:"Heading 6",
+blockquote:"Blockquote",
+code:"Code",
+samp:"Code sample",
+dt:"Definition term ",
+dd:"Definition description",
+bold_desc:"Bold (Ctrl+B)",
+italic_desc:"Italic (Ctrl+I)",
+underline_desc:"Underline (Ctrl+U)",
+striketrough_desc:"Strikethrough",
+justifyleft_desc:"Align left",
+justifycenter_desc:"Align center",
+justifyright_desc:"Align right",
+justifyfull_desc:"Align full",
+bullist_desc:"Unordered list",
+numlist_desc:"Ordered list",
+outdent_desc:"Outdent",
+indent_desc:"Indent",
+undo_desc:"Undo (Ctrl+Z)",
+redo_desc:"Redo (Ctrl+Y)",
+link_desc:"Insert/edit link",
+unlink_desc:"Unlink",
+image_desc:"Insert/edit image",
+cleanup_desc:"Cleanup messy code",
+code_desc:"Edit HTML Source",
+sub_desc:"Subscript",
+sup_desc:"Superscript",
+hr_desc:"Insert horizontal ruler",
+removeformat_desc:"Remove formatting",
+custom1_desc:"Your custom description here",
+forecolor_desc:"Select text color",
+backcolor_desc:"Select background color",
+charmap_desc:"Insert custom character",
+visualaid_desc:"Toggle guidelines/invisible elements",
+anchor_desc:"Insert/edit anchor",
+cut_desc:"Cut",
+copy_desc:"Copy",
+paste_desc:"Paste",
+image_props_desc:"Image properties",
+newdocument_desc:"New document",
+help_desc:"Help",
+blockquote_desc:"Blockquote",
+clipboard_msg:"Copy/Cut/Paste is not available in Mozilla and Firefox.\r\nDo you want more information about this issue?",
+path:"Path",
+newdocument:"Are you sure you want clear all contents?",
+toolbar_focus:"Jump to tool buttons - Alt+Q, Jump to editor - Alt-Z, Jump to element path - Alt-X",
+more_colors:"More colors"
+});
\ No newline at end of file
diff -x .svn -aruN 0.7.15.src/e107_handlers/tiny_mce/themes/advanced/link.htm 0.7.16.src/e107_handlers/tiny_mce/themes/advanced/link.htm
--- 0.7.15.src/e107_handlers/tiny_mce/themes/advanced/link.htm	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_handlers/tiny_mce/themes/advanced/link.htm	2009-06-30 19:36:50.000000000 -0500
@@ -1,17 +1,18 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
 <html xmlns="http://www.w3.org/1999/xhtml">
 <head>
-	<title>{$lang_insert_link_title}</title>
-	<script language="javascript" type="text/javascript" src="../../tiny_mce_popup.js"></script>
-	<script language="javascript" type="text/javascript" src="../../utils/mctabs.js"></script>
-	<script language="javascript" type="text/javascript" src="../../utils/form_utils.js"></script>
-	<script language="javascript" type="text/javascript" src="jscripts/link.js"></script>
-	<base target="_self" />
+	<title>{#advanced_dlg.link_title}</title>
+	<script type="text/javascript" src="../../tiny_mce_popup.js"></script>
+	<script type="text/javascript" src="../../utils/mctabs.js"></script>
+	<script type="text/javascript" src="../../utils/form_utils.js"></script>
+	<script type="text/javascript" src="../../utils/validate.js"></script>
+	<script type="text/javascript" src="js/link.js"></script>
 </head>
-<body id="link" onload="tinyMCEPopup.executeOnLoad('init();');" style="display: none">
-<form onsubmit="insertLink();return false;" action="#">
+<body id="link" style="display: none">
+<form onsubmit="LinkDialog.update();return false;" action="#">
 	<div class="tabs">
 		<ul>
-			<li id="general_tab" class="current"><span><a href="javascript:mcTabs.displayTab('general_tab','general_panel');" onmousedown="return false;">{$lang_insert_link_title}</a></span></li>
+			<li id="general_tab" class="current"><span><a href="javascript:mcTabs.displayTab('general_tab','general_panel');" onmousedown="return false;">{#advanced_dlg.link_title}</a></span></li>
 		</ul>
 	</div>
 
@@ -20,79 +21,41 @@
 
 		<table border="0" cellpadding="4" cellspacing="0">
           <tr>
-            <td nowrap="nowrap"><label for="href">{$lang_insert_link_url}</label></td>
+            <td class="nowrap"><label for="href">{#advanced_dlg.link_url}</label></td>
             <td><table border="0" cellspacing="0" cellpadding="0"> 
 				  <tr> 
-					<td><input id="href" name="href" type="text" value="" style="width: 200px" /></td> 
+					<td><input id="href" name="href" type="text" class="mceFocus" value="" style="width: 200px" onchange="LinkDialog.checkPrefix(this);" /></td> 
 					<td id="hrefbrowsercontainer">&nbsp;</td>
 				  </tr> 
 				</table></td>
           </tr>
-		  <!-- Link list -->
-		  <script language="javascript">
-			if (typeof(tinyMCELinkList) != "undefined" && tinyMCELinkList.length > 0) {
-				var html = "";
-
-				html += '<tr><td><label for="link_list">{$lang_link_list}</label></td>';
-				html += '<td><select id="link_list" name="link_list" style="width: 200px" onchange="this.form.href.value=this.options[this.selectedIndex].value;">';
-				html += '<option value="">---</option>';
-
-				for (var i=0; i<tinyMCELinkList.length; i++)
-					html += '<option value="' + tinyMCELinkList[i][1] + '">' + tinyMCELinkList[i][0] + '</option>';
-
-				html += '</select></td></tr>';
-
-				document.write(html);
-			}
-		  </script>
-		  <!-- /Link list -->
-          <tr>
-            <td nowrap="nowrap"><label for="target">{$lang_insert_link_target}</label></td>
-            <td><select id="target" name="target" style="width: 200px">
-                <option value="_self">{$lang_insert_link_target_same}</option>
-                <option value="_blank">{$lang_insert_link_target_blank}</option>
-				<script language="javascript">
-					var html = "";
-					var targets = tinyMCE.getParam('theme_advanced_link_targets', '').split(';');
-
-					for (var i=0; i<targets.length; i++) {
-						var key, value;
-
-						if (targets[i] == "")
-							continue;
-
-						key = targets[i].split('=')[0];
-						value = targets[i].split('=')[1];
-
-						html += '<option value="' + value + '">' + key + '</option>';
-					}
-
-					document.write(html);
-				</script>
-            </select></td>
-          </tr>
+		  <tr>
+			<td><label for="link_list">{#advanced_dlg.link_list}</label></td>
+			<td><select id="link_list" name="link_list" onchange="document.getElementById('href').value=this.options[this.selectedIndex].value;"></select></td>
+		  </tr>
+		<tr>
+			<td><label id="targetlistlabel" for="targetlist">{#advanced_dlg.link_target}</label></td>
+			<td><select id="target_list" name="target_list"></select></td>
+		</tr>
           <tr>
-            <td nowrap="nowrap"><label for="linktitle">{$lang_theme_insert_link_titlefield}</label></td>
-            <td><input id="linktitle" name="linktitle" type="text" value="" style="width: 200px"></td>
-          </tr>
-          <tr id="styleSelectRow">
-            <td><label for="styleSelect">{$lang_class_name}</label></td>
-            <td>
-			 <select id="styleSelect" name="styleSelect">
-                <option value="" selected>{$lang_theme_style_select}</option>
-             </select></td>
+            <td class="nowrap"><label for="linktitle">{#advanced_dlg.link_titlefield}</label></td>
+            <td><input id="linktitle" name="linktitle" type="text" value="" style="width: 200px" /></td>
           </tr>
+			<tr>
+				<td><label for="class_list">{#class_name}</label></td>
+				<td><select id="class_list" name="class_list"></select></td>
+			</tr>
         </table>
 		</div>
 	</div>
 
 	<div class="mceActionPanel">
 		<div style="float: left">
-			<input type="button" id="insert" name="insert" value="{$lang_insert}" onclick="insertLink();" />
+			<input type="submit" id="insert" name="insert" value="{#insert}" />
 		</div>
 
 		<div style="float: right">
-			<input type="button" id="cancel" name="cancel" value="{$lang_cancel}" onclick="tinyMCEPopup.close();" />
+			<input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />
 		</div>
 	</div>
 </form>
diff -x .svn -aruN 0.7.15.src/e107_handlers/tiny_mce/themes/advanced/skins/default/content.css 0.7.16.src/e107_handlers/tiny_mce/themes/advanced/skins/default/content.css
--- 0.7.15.src/e107_handlers/tiny_mce/themes/advanced/skins/default/content.css	1969-12-31 18:00:00.000000000 -0600
+++ 0.7.16.src/e107_handlers/tiny_mce/themes/advanced/skins/default/content.css	2009-07-06 15:33:57.000000000 -0500
@@ -0,0 +1,32 @@
+body, td, pre {color:#000; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:10px; margin:8px;}
+body {background:#FFF;}
+body.mceForceColors {background:#FFF; color:#000;}
+h1 {font-size: 2em}
+h2 {font-size: 1.5em}
+h3 {font-size: 1.17em}
+h4 {font-size: 1em}
+h5 {font-size: .83em}
+h6 {font-size: .75em}
+.mceItemTable, .mceItemTable td, .mceItemTable th, .mceItemTable caption, .mceItemVisualAid {border: 1px dashed #BBB;}
+a.mceItemAnchor {width:12px; line-height:6px; overflow:hidden; padding-left:12px; background:url(img/items.gif) no-repeat bottom left;}
+img.mceItemAnchor {width:12px; height:12px; background:url(img/items.gif) no-repeat;}
+img {border:0;}
+table {cursor:default}
+table td, table th {cursor:text}
+ins {border-bottom:1px solid green; text-decoration: none; color:green}
+del {color:red; text-decoration:line-through}
+cite {border-bottom:1px dashed blue}
+acronym {border-bottom:1px dotted #CCC; cursor:help}
+abbr, html\:abbr {border-bottom:1px dashed #CCC; cursor:help}
+
+/* IE */
+* html body {
+scrollbar-3dlight-color:#F0F0EE;
+scrollbar-arrow-color:#676662;
+scrollbar-base-color:#F0F0EE;
+scrollbar-darkshadow-color:#DDD;
+scrollbar-face-color:#E0E0DD;
+scrollbar-highlight-color:#F0F0EE;
+scrollbar-shadow-color:#F0F0EE;
+scrollbar-track-color:#F5F5F5;
+}
diff -x .svn -aruN 0.7.15.src/e107_handlers/tiny_mce/themes/advanced/skins/default/dialog.css 0.7.16.src/e107_handlers/tiny_mce/themes/advanced/skins/default/dialog.css
--- 0.7.15.src/e107_handlers/tiny_mce/themes/advanced/skins/default/dialog.css	1969-12-31 18:00:00.000000000 -0600
+++ 0.7.16.src/e107_handlers/tiny_mce/themes/advanced/skins/default/dialog.css	2009-07-06 15:33:57.000000000 -0500
@@ -0,0 +1,116 @@
+/* Generic */
+body {
+font-family:Verdana, Arial, Helvetica, sans-serif; font-size:11px;
+scrollbar-3dlight-color:#F0F0EE;
+scrollbar-arrow-color:#676662;
+scrollbar-base-color:#F0F0EE;
+scrollbar-darkshadow-color:#DDDDDD;
+scrollbar-face-color:#E0E0DD;
+scrollbar-highlight-color:#F0F0EE;
+scrollbar-shadow-color:#F0F0EE;
+scrollbar-track-color:#F5F5F5;
+background:#F0F0EE;
+padding:0;
+margin:8px 8px 0 8px;
+}
+
+html {background:#F0F0EE;}
+td {font-family:Verdana, Arial, Helvetica, sans-serif; font-size:10px;}
+textarea {resize:none;outline:none;}
+a:link, a:visited {color:black;}
+a:hover {color:#2B6FB6;}
+.nowrap {white-space: nowrap}
+
+/* Forms */
+fieldset {margin:0; padding:4px; border:1px solid #919B9C; font-family:Verdana, Arial; font-size:10px;}
+legend {color:#2B6FB6; font-weight:bold;}
+label.msg {display:none;}
+label.invalid {color:#EE0000; display:inline;}
+input.invalid {border:1px solid #EE0000;}
+input {background:#FFF; border:1px solid #CCC;}
+input, select, textarea {font-family:Verdana, Arial, Helvetica, sans-serif; font-size:10px;}
+input, select, textarea {border:1px solid #808080;}
+input.radio {border:1px none #000000; background:transparent; vertical-align:middle;}
+input.checkbox {border:1px none #000000; background:transparent; vertical-align:middle;}
+.input_noborder {border:0;}
+
+/* Buttons */
+#insert, #cancel, input.button, .updateButton {
+border:0; margin:0; padding:0;
+font-weight:bold;
+width:94px; height:26px;
+background:url(img/buttons.png) 0 -26px;
+cursor:pointer;
+padding-bottom:2px;
+}
+
+#insert {background:url(img/buttons.png) 0 -52px;}
+#cancel {background:url(img/buttons.png) 0 0;}
+
+/* Browse */
+a.pickcolor, a.browse {text-decoration:none}
+a.browse span {display:block; width:20px; height:18px; background:url(../../img/icons.gif) -860px 0; border:1px solid #FFF; margin-left:1px;}
+.mceOldBoxModel a.browse span {width:22px; height:20px;}
+a.browse:hover span {border:1px solid #0A246A; background-color:#B2BBD0;}
+a.browse span.disabled {border:1px solid white; opacity:0.3; -ms-filter:'alpha(opacity=30)'; filter:alpha(opacity=30)}
+a.browse:hover span.disabled {border:1px solid white; background-color:transparent;}
+a.pickcolor span {display:block; width:20px; height:16px; background:url(../../img/icons.gif) -840px 0; margin-left:2px;}
+.mceOldBoxModel a.pickcolor span {width:21px; height:17px;}
+a.pickcolor:hover span {background-color:#B2BBD0;}
+a.pickcolor:hover span.disabled {}
+
+/* Charmap */
+table.charmap {border:1px solid #AAA; text-align:center}
+td.charmap, #charmap a {width:18px; height:18px; color:#000; border:1px solid #AAA; text-align:center; font-size:12px; vertical-align:middle; line-height: 18px;}
+#charmap a {display:block; color:#000; text-decoration:none; border:0}
+#charmap a:hover {background:#CCC;color:#2B6FB6}
+#charmap #codeN {font-size:10px; font-family:Arial,Helvetica,sans-serif; text-align:center}
+#charmap #codeV {font-size:40px; height:80px; border:1px solid #AAA; text-align:center}
+
+/* Source */
+.wordWrapCode {vertical-align:middle; border:1px none #000000; background:transparent;}
+.mceActionPanel {margin-top:5px;}
+
+/* Tabs classes */
+.tabs {width:100%; height:18px; line-height:normal; background:url(img/tabs.gif) repeat-x 0 -72px;}
+.tabs ul {margin:0; padding:0; list-style:none;}
+.tabs li {float:left; background:url(img/tabs.gif) no-repeat 0 0; margin:0 2px 0 0; padding:0 0 0 10px; line-height:17px; height:18px; display:block;}
+.tabs li.current {background:url(img/tabs.gif) no-repeat 0 -18px; margin-right:2px;}
+.tabs span {float:left; display:block; background:url(img/tabs.gif) no-repeat right -36px; padding:0px 10px 0 0;}
+.tabs .current span {background:url(img/tabs.gif) no-repeat right -54px;}
+.tabs a {text-decoration:none; font-family:Verdana, Arial; font-size:10px;}
+.tabs a:link, .tabs a:visited, .tabs a:hover {color:black;}
+
+/* Panels */
+.panel_wrapper div.panel {display:none;}
+.panel_wrapper div.current {display:block; width:100%; height:300px; overflow:visible;}
+.panel_wrapper {border:1px solid #919B9C; border-top:0px; padding:10px; padding-top:5px; clear:both; background:white;}
+
+/* Columns */
+.column {float:left;}
+.properties {width:100%;}
+.properties .column1 {}
+.properties .column2 {text-align:left;}
+
+/* Titles */
+h1, h2, h3, h4 {color:#2B6FB6; margin:0; padding:0; padding-top:5px;}
+h3 {font-size:14px;}
+.title {font-size:12px; font-weight:bold; color:#2B6FB6;}
+
+/* Dialog specific */
+#link .panel_wrapper, #link div.current {height:125px;}
+#image .panel_wrapper, #image div.current {height:200px;}
+#plugintable thead {font-weight:bold; background:#DDD;}
+#plugintable, #about #plugintable td {border:1px solid #919B9C;}
+#plugintable {width:96%; margin-top:10px;}
+#pluginscontainer {height:290px; overflow:auto;}
+#colorpicker #preview {float:right; width:50px; height:14px;line-height:1px; border:1px solid black; margin-left:5px;}
+#colorpicker #colors {float:left; border:1px solid gray; cursor:crosshair;}
+#colorpicker #light {border:1px solid gray; margin-left:5px; float:left;width:15px; height:150px; cursor:crosshair;}
+#colorpicker #light div {overflow:hidden;}
+#colorpicker #previewblock {float:right; padding-left:10px; height:20px;}
+#colorpicker .panel_wrapper div.current {height:175px;}
+#colorpicker #namedcolors {width:150px;}
+#colorpicker #namedcolors a {display:block; float:left; width:10px; height:10px; margin:1px 1px 0 0; overflow:hidden;}
+#colorpicker #colornamecontainer {margin-top:5px;}
+#colorpicker #picker_panel fieldset {margin:auto;width:325px;}
\ No newline at end of file
diff -x .svn -aruN 0.7.15.src/e107_handlers/tiny_mce/themes/advanced/skins/default/img/buttons.png 0.7.16.src/e107_handlers/tiny_mce/themes/advanced/skins/default/img/buttons.png
--- 0.7.15.src/e107_handlers/tiny_mce/themes/advanced/skins/default/img/buttons.png	1969-12-31 18:00:00.000000000 -0600
+++ 0.7.16.src/e107_handlers/tiny_mce/themes/advanced/skins/default/img/buttons.png	2009-07-06 15:33:57.000000000 -0500
@@ -0,0 +1,12 @@
+PNG
+
+   
IHDR   ^   N   Q   gAMA  7   tEXtSoftware Adobe ImageReadyqe<  OPLTE!𴳲[[[^žu\
+apī'xxxlllHHH»***kkkܻĽǿ޾444JJJ׷ĻٹyyyzzzKKK߿]]]ȿvvvü^0}#999UUUBBB111KYYYᑢ9```nnnDY>>>rrrMMMӿtttgggċ%%%bq慅쑐1M  
+IDATxڴ_WG2ɄPTf"
Y I$	%W.UZRWE@^m]["ؾ眙ɤ৿o>999sTQQZ khA`_޾i#;GV+_C3D\#s;D܂Wzrᔋ;@F'񆄂 4JHӍ2M8?R-ׇ}wfS_UX\Jk	sC<"rWdX\eͺrjԅ$`6=}Ezz,YLR-=E_(TxG\{Ywuz\ GVXhqtzуzwb"5}Hu/ww*.NstvZU!@:$*=J뫫`Z߁씽ۭUjHWIIҞ,Mx¢U
+Abi
+{^
	{d^L8jҦ>Kwy QР+uj9ǃd
}{4a<
au:Odgs\a< {r7 豪I	DG+p<7^"%к&
+ʸbWW ރu<
0ڌUёJ*ѧK:DF!O_ʞ8%Jo\ ?l3fޜݘi𡚚T:LHM&55h?|;*Dvd9TdqҹS?N~cNC8;ٻ[#cݝ; ~t6Rn^ o0I9~[Z^ťşN;c?wu!|]]D=[!	(E쓋'/oPcWFe%Jʡ'Rn%T34AbK~ijH$dJʚ>;qmEjqġtY9*)ihqi0l~8o_\aٟ	e'QD&~f5/}e>6rYWǈjyforZor	+|z`؛*8>Y&g{:P\&2LOO92<<<B%50ʌZGG+UT2diqM~kgZ(
DSFF&gu_1&miiCD05HcJ{\pS[Ȍ4L0OOO9Оanq\KP,a%%AtN6:`8*x
^ ΜfjPz882$ӌ-j$ǲu
+^R6T{{6;Bթf>RE\%"׺/zgA协S)AQ`^ѣGB8:C/_jDLG13T8|Vټ fZ Yv|9ԩSDH4
+ЬSD(~PF
+

=EDCCQD%!-
?密՜[f# DnĔHJ
>̀1L0>ɌlvF[$86x/	)_)	b@<VEQL<4>5 aٔDk2OM=3E0}6t60/ߝ_"bջi[j,/_Jζ2:qx0>H׎	»aנ0<h^صkא`2^e pWypy".j:SZMOPiW?
+BV?q)ֺ3,,Thx0[w߹{[J[ov~>R(0	:?ޤ	(Shj4o0O
*44_=q"?asUi8K-H VVl_02D:,KKM8DDpnA8
v12
N2SrrFb9s=Pfi*M*IUR);a&jɵ8g4jF#[I !ia4Ti1&)'PS˦4XȉJ<]TicZABlRPbY#w=^Fĥ0Yd[/#Ui"0F~4J4y$UmARJr"Gb<'\@=68'	@RfKdcFfLUiñESwNU8&`o ~L*-0nҴXUEd#Vv- vWiߢJsmD
+#J{<@oENe؅U1 dx~q8B%R	m7[5KjbJ9?n+Sb_] i'k6ժmEǼTlݍdhR[^UƀWi[6(D2[F_ l0[    IENDB`
\ No newline at end of file
diff -x .svn -aruN 0.7.15.src/e107_handlers/tiny_mce/themes/advanced/skins/default/img/items.gif 0.7.16.src/e107_handlers/tiny_mce/themes/advanced/skins/default/img/items.gif
--- 0.7.15.src/e107_handlers/tiny_mce/themes/advanced/skins/default/img/items.gif	1969-12-31 18:00:00.000000000 -0600
+++ 0.7.16.src/e107_handlers/tiny_mce/themes/advanced/skins/default/img/items.gif	2009-07-06 15:33:57.000000000 -0500
@@ -0,0 +1 @@
+GIF89a       !   ,      @w&ڃq|a4b ;
\ No newline at end of file
diff -x .svn -aruN 0.7.15.src/e107_handlers/tiny_mce/themes/advanced/skins/default/img/menu_arrow.gif 0.7.16.src/e107_handlers/tiny_mce/themes/advanced/skins/default/img/menu_arrow.gif
--- 0.7.15.src/e107_handlers/tiny_mce/themes/advanced/skins/default/img/menu_arrow.gif	1969-12-31 18:00:00.000000000 -0600
+++ 0.7.16.src/e107_handlers/tiny_mce/themes/advanced/skins/default/img/menu_arrow.gif	2009-07-06 15:33:57.000000000 -0500
@@ -0,0 +1 @@
+GIF89a      !   ,       zq(׉* ;
\ No newline at end of file
diff -x .svn -aruN 0.7.15.src/e107_handlers/tiny_mce/themes/advanced/skins/default/img/menu_check.gif 0.7.16.src/e107_handlers/tiny_mce/themes/advanced/skins/default/img/menu_check.gif
--- 0.7.15.src/e107_handlers/tiny_mce/themes/advanced/skins/default/img/menu_check.gif	1969-12-31 18:00:00.000000000 -0600
+++ 0.7.16.src/e107_handlers/tiny_mce/themes/advanced/skins/default/img/menu_check.gif	2009-07-06 15:33:57.000000000 -0500
@@ -0,0 +1 @@
+GIF89a      !   ,       ;i#~ʶ{ ;
\ No newline at end of file
diff -x .svn -aruN 0.7.15.src/e107_handlers/tiny_mce/themes/advanced/skins/default/img/progress.gif 0.7.16.src/e107_handlers/tiny_mce/themes/advanced/skins/default/img/progress.gif
--- 0.7.15.src/e107_handlers/tiny_mce/themes/advanced/skins/default/img/progress.gif	1969-12-31 18:00:00.000000000 -0600
+++ 0.7.16.src/e107_handlers/tiny_mce/themes/advanced/skins/default/img/progress.gif	2009-07-06 15:33:57.000000000 -0500
@@ -0,0 +1,9 @@
+GIF89a      򺺺444ėTTT   !NETSCAPE2.0   !   ,         I)KͧJJ5URK(&05+/mbp
z1;$1C I*	HCh`Ao"3qT5\8aBdwxG=YgwHbvA=0V\\;;H0t%HsrY<H.ŉbZbOEg:GY].=AOQs \bh.9=sgce*ֆf 7D  !   ,       rI
+5bRHhW*lkL&-)1-vm )Mt\RdAH̑ oƇ Gz{ !   ,      rIg@5
rYMQ!(((8ÜJKbr3h K!63u`&DAzfLZ*	^`nFOssyJ}TN.aqXshCXJ !   ,      i	Y4CvAMA"JjA'0T*bJII ZFPMM sbgqV$v!5	
+?}	 	 !   ,      ep80 #^qX
	[(\-S@ P0" LzxLՍϊ*Z_HDeU
+ywZt	n !   ,      A2WE&j׊B&w~6b8p`4r|FM>,bLv|?4BvʛPu9+&	2x&		k&	U]	vo
+opraT& !   ,     {	'e7\l-)S7@&4+`yTSL\:=Jk:;eĈ8cA8Oj@b/+:{	tyt#|-
+	mN	qK !   ,     lI+8b̠y h*Zp=3`C`B "p X	9bPB`Z=
+8>u,St"ΦOT\um|;
+8~* !   ,     xIA]GeAPb)"!s BIМV	5q((X2=,In#&AVq5t
+sny\)_g|r5 !   ,      gD+8[{`&y_hI)(L"+gN8l5"LA .%@%O@8NgL+Ƀpus/jȩjVjc7I !   ,     \0t p	hQm6Tqmx( 6'sa@`]-lz0 _gir!` !   ,      s	ءXP\|)pWʄQ稊G.}!*1 p v;Tݩ2X)|f%9`}0PFd~ezGw) ;
\ No newline at end of file
diff -x .svn -aruN 0.7.15.src/e107_handlers/tiny_mce/themes/advanced/skins/default/img/tabs.gif 0.7.16.src/e107_handlers/tiny_mce/themes/advanced/skins/default/img/tabs.gif
--- 0.7.15.src/e107_handlers/tiny_mce/themes/advanced/skins/default/img/tabs.gif	1969-12-31 18:00:00.000000000 -0600
+++ 0.7.16.src/e107_handlers/tiny_mce/themes/advanced/skins/default/img/tabs.gif	2009-07-06 15:33:57.000000000 -0500
@@ -0,0 +1,6 @@
+GIF89a,Z      2Jb͑󡳻둛                     !  8 ,    ,Z  @da(Ȥrl:ШtJZج)xL.zn|N~""6#7$% !! 
+H*\ȰÇ#JHQ0hȱǏ CIɓ(S\ɲ˗-
h@͛8sɳ@
+JѣH5@SӧPJJիXjʵׯ`Êր	Ҫ]˶۷pʝKݻx˷_RLÈ+^̸ǐ#KL˘-ذϠCMӨS^ͺװc˞
+sͻNȓ+_μr-HNسkνËO
X˟OϿ h&J D(Vhfv ($hb,0(4h8<> DiH&6 PF)TJiǕXf\v%NV)V~ihkIU)tign©'w矀bzj衈&裐F&)饘f*Ʃ駠N)ꩨFJjQꫀꓰjz뮼z++lj&6,>+Vk
+öv+k覫&ko	 l'|p
,G,@gwLw,$|*l,
+/412۬<B9,DE''PGrOKmBXwu*docBl-/=x |7~nx*}K?8x[=y+}yyy褷<z験|zozKz'<K{|{{{ķ;|'7G/Wogw/o7 ;
\ No newline at end of file
diff -x .svn -aruN 0.7.15.src/e107_handlers/tiny_mce/themes/advanced/skins/default/ui.css 0.7.16.src/e107_handlers/tiny_mce/themes/advanced/skins/default/ui.css
--- 0.7.15.src/e107_handlers/tiny_mce/themes/advanced/skins/default/ui.css	1969-12-31 18:00:00.000000000 -0600
+++ 0.7.16.src/e107_handlers/tiny_mce/themes/advanced/skins/default/ui.css	2009-07-06 15:33:57.000000000 -0500
@@ -0,0 +1,214 @@
+/* Reset */
+.defaultSkin table, .defaultSkin tbody, .defaultSkin a, .defaultSkin img, .defaultSkin tr, .defaultSkin div, .defaultSkin td, .defaultSkin iframe, .defaultSkin span, .defaultSkin *, .defaultSkin .mceText {border:0; margin:0; padding:0; background:transparent; white-space:nowrap; text-decoration:none; font-weight:normal; cursor:default; color:#000; vertical-align:baseline; width:auto; border-collapse:separate; text-align:left}
+.defaultSkin a:hover, .defaultSkin a:link, .defaultSkin a:visited, .defaultSkin a:active {text-decoration:none; font-weight:normal; cursor:default; color:#000}
+.defaultSkin table td {vertical-align:middle}
+
+/* Containers */
+.defaultSkin table {background:#F0F0EE}
+.defaultSkin iframe {display:block; background:#FFF}
+.defaultSkin .mceToolbar {height:26px}
+.defaultSkin .mceLeft {text-align:left}
+.defaultSkin .mceRight {text-align:right}
+
+/* External */
+.defaultSkin .mceExternalToolbar {position:absolute; border:1px solid #CCC; border-bottom:0; display:none;}
+.defaultSkin .mceExternalToolbar td.mceToolbar {padding-right:13px;}
+.defaultSkin .mceExternalClose {position:absolute; top:3px; right:3px; width:7px; height:7px; background:url(../../img/icons.gif) -820px 0}
+
+/* Layout */
+.defaultSkin table.mceLayout {border:0; border-left:1px solid #CCC; border-right:1px solid #CCC}
+.defaultSkin table.mceLayout tr.mceFirst td {border-top:1px solid #CCC}
+.defaultSkin table.mceLayout tr.mceLast td {border-bottom:1px solid #CCC}
+.defaultSkin table.mceToolbar, .defaultSkin tr.mceFirst .mceToolbar tr td, .defaultSkin tr.mceLast .mceToolbar tr td {border:0; margin:0; padding:0;}
+.defaultSkin td.mceToolbar {padding-top:1px; vertical-align:top}
+.defaultSkin .mceIframeContainer {border-top:1px solid #CCC; border-bottom:1px solid #CCC}
+.defaultSkin .mceStatusbar {font-family:'MS Sans Serif',sans-serif,Verdana,Arial; font-size:9pt; line-height:16px; overflow:visible; color:#000; display:block; height:20px}
+.defaultSkin .mceStatusbar div {float:left; margin:2px}
+.defaultSkin .mceStatusbar a.mceResize {display:block; float:right; background:url(../../img/icons.gif) -800px 0; width:20px; height:20px; cursor:se-resize}
+.defaultSkin .mceStatusbar a:hover {text-decoration:underline}
+.defaultSkin table.mceToolbar {margin-left:3px}
+.defaultSkin span.mceIcon, .defaultSkin img.mceIcon {display:block; width:20px; height:20px}
+.defaultSkin .mceIcon {background:url(../../img/icons.gif) no-repeat 20px 20px}
+.defaultSkin td.mceCenter {text-align:center;}
+.defaultSkin td.mceCenter table {margin:0 auto; text-align:left;}
+.defaultSkin td.mceRight table {margin:0 0 0 auto;}
+
+/* Button */
+.defaultSkin .mceButton {display:block; border:1px solid #F0F0EE; width:20px; height:20px; margin-right:1px}
+.defaultSkin a.mceButtonEnabled:hover {border:1px solid #0A246A; background-color:#B2BBD0}
+.defaultSkin a.mceButtonActive, .defaultSkin a.mceButtonSelected {border:1px solid #0A246A; background-color:#C2CBE0}
+.defaultSkin .mceButtonDisabled .mceIcon {opacity:0.3; -ms-filter:'alpha(opacity=30)'; filter:alpha(opacity=30)}
+.defaultSkin .mceButtonLabeled {width:auto}
+.defaultSkin .mceButtonLabeled span.mceIcon {float:left}
+.defaultSkin span.mceButtonLabel {display:block; font-size:10px; padding:4px 6px 0 22px; font-family:Tahoma,Verdana,Arial,Helvetica}
+.defaultSkin .mceButtonDisabled .mceButtonLabel {color:#888}
+
+/* Separator */
+.defaultSkin .mceSeparator {display:block; background:url(../../img/icons.gif) -180px 0; width:2px; height:20px; margin:2px 2px 0 4px}
+
+/* ListBox */
+.defaultSkin .mceListBox {direction:ltr}
+.defaultSkin .mceListBox, .defaultSkin .mceListBox a {display:block}
+.defaultSkin .mceListBox .mceText {padding-left:4px; width:70px; text-align:left; border:1px solid #CCC; border-right:0; background:#FFF; font-family:Tahoma,Verdana,Arial,Helvetica; font-size:11px; height:20px; line-height:20px; overflow:hidden}
+.defaultSkin .mceListBox .mceOpen {width:9px; height:20px; background:url(../../img/icons.gif) -741px 0; margin-right:2px; border:1px solid #CCC;}
+.defaultSkin table.mceListBoxEnabled:hover .mceText, .defaultSkin .mceListBoxHover .mceText, .defaultSkin .mceListBoxSelected .mceText {border:1px solid #A2ABC0; border-right:0; background:#FFF}
+.defaultSkin table.mceListBoxEnabled:hover .mceOpen, .defaultSkin .mceListBoxHover .mceOpen, .defaultSkin .mceListBoxSelected .mceOpen {background-color:#FFF; border:1px solid #A2ABC0}
+.defaultSkin .mceListBoxDisabled a.mceText {color:gray; background-color:transparent;}
+.defaultSkin .mceListBoxMenu {overflow:auto; overflow-x:hidden}
+.defaultSkin .mceOldBoxModel .mceListBox .mceText {height:22px}
+.defaultSkin .mceOldBoxModel .mceListBox .mceOpen {width:11px; height:22px;}
+.defaultSkin select.mceNativeListBox {font-family:'MS Sans Serif',sans-serif,Verdana,Arial; font-size:7pt; background:#F0F0EE; border:1px solid gray; margin-right:2px;}
+
+/* SplitButton */
+.defaultSkin .mceSplitButton {width:32px; height:20px; direction:ltr}
+.defaultSkin .mceSplitButton a, .defaultSkin .mceSplitButton span {height:20px; display:block}
+.defaultSkin .mceSplitButton a.mceAction {width:20px; border:1px solid #F0F0EE; border-right:0;}
+.defaultSkin .mceSplitButton span.mceAction {width:20px; background:url(../../img/icons.gif) 20px 20px;}
+.defaultSkin .mceSplitButton a.mceOpen {width:9px; background:url(../../img/icons.gif) -741px 0; border:1px solid #F0F0EE;}
+.defaultSkin .mceSplitButton span.mceOpen {display:none}
+.defaultSkin table.mceSplitButtonEnabled:hover a.mceAction, .defaultSkin .mceSplitButtonHover a.mceAction, .defaultSkin .mceSplitButtonSelected a.mceAction {border:1px solid #0A246A; border-right:0; background-color:#B2BBD0}
+.defaultSkin table.mceSplitButtonEnabled:hover a.mceOpen, .defaultSkin .mceSplitButtonHover a.mceOpen, .defaultSkin .mceSplitButtonSelected a.mceOpen {background-color:#B2BBD0; border:1px solid #0A246A;}
+.defaultSkin .mceSplitButtonDisabled .mceAction, .defaultSkin .mceSplitButtonDisabled a.mceOpen {opacity:0.3; -ms-filter:'alpha(opacity=30)'; filter:alpha(opacity=30)}
+.defaultSkin .mceSplitButtonActive a.mceAction {border:1px solid #0A246A; background-color:#C2CBE0}
+.defaultSkin .mceSplitButtonActive a.mceOpen {border-left:0;}
+
+/* ColorSplitButton */
+.defaultSkin div.mceColorSplitMenu table {background:#FFF; border:1px solid gray}
+.defaultSkin .mceColorSplitMenu td {padding:2px}
+.defaultSkin .mceColorSplitMenu a {display:block; width:9px; height:9px; overflow:hidden; border:1px solid #808080}
+.defaultSkin .mceColorSplitMenu td.mceMoreColors {padding:1px 3px 1px 1px}
+.defaultSkin .mceColorSplitMenu a.mceMoreColors {width:100%; height:auto; text-align:center; font-family:Tahoma,Verdana,Arial,Helvetica; font-size:11px; line-height:20px; border:1px solid #FFF}
+.defaultSkin .mceColorSplitMenu a.mceMoreColors:hover {border:1px solid #0A246A; background-color:#B6BDD2}
+.defaultSkin a.mceMoreColors:hover {border:1px solid #0A246A}
+.defaultSkin .mceColorPreview {margin-left:2px; width:16px; height:4px; overflow:hidden; background:#9a9b9a}
+.defaultSkin .mce_forecolor span.mceAction, .defaultSkin .mce_backcolor span.mceAction {overflow:hidden; height:16px}
+
+/* Menu */
+.defaultSkin .mceMenu {position:absolute; left:0; top:0; z-index:1000; border:1px solid #D4D0C8}
+.defaultSkin .mceNoIcons span.mceIcon {width:0;}
+.defaultSkin .mceNoIcons a .mceText {padding-left:10px}
+.defaultSkin .mceMenu table {background:#FFF}
+.defaultSkin .mceMenu a, .defaultSkin .mceMenu span, .defaultSkin .mceMenu {display:block}
+.defaultSkin .mceMenu td {height:20px}
+.defaultSkin .mceMenu a {position:relative;padding:3px 0 4px 0}
+.defaultSkin .mceMenu .mceText {position:relative; display:block; font-family:Tahoma,Verdana,Arial,Helvetica; color:#000; cursor:default; margin:0; padding:0 25px 0 25px; display:block}
+.defaultSkin .mceMenu span.mceText, .defaultSkin .mceMenu .mcePreview {font-size:11px}
+.defaultSkin .mceMenu pre.mceText {font-family:Monospace}
+.defaultSkin .mceMenu .mceIcon {position:absolute; top:0; left:0; width:22px;}
+.defaultSkin .mceMenu .mceMenuItemEnabled a:hover, .defaultSkin .mceMenu .mceMenuItemActive {background-color:#dbecf3}
+.defaultSkin td.mceMenuItemSeparator {background:#DDD; height:1px}
+.defaultSkin .mceMenuItemTitle a {border:0; background:#EEE; border-bottom:1px solid #DDD}
+.defaultSkin .mceMenuItemTitle span.mceText {color:#000; font-weight:bold; padding-left:4px}
+.defaultSkin .mceMenuItemDisabled .mceText {color:#888}
+.defaultSkin .mceMenuItemSelected .mceIcon {background:url(img/menu_check.gif)}
+.defaultSkin .mceNoIcons .mceMenuItemSelected a {background:url(img/menu_arrow.gif) no-repeat -6px center}
+.defaultSkin .mceMenu span.mceMenuLine {display:none}
+.defaultSkin .mceMenuItemSub a {background:url(img/menu_arrow.gif) no-repeat top right;}
+
+/* Progress,Resize */
+.defaultSkin .mceBlocker {position:absolute; left:0; top:0; z-index:1000; opacity:0.5; -ms-filter:'alpha(opacity=50)'; filter:alpha(opacity=50); background:#FFF}
+.defaultSkin .mceProgress {position:absolute; left:0; top:0; z-index:1001; background:url(img/progress.gif) no-repeat; width:32px; height:32px; margin:-16px 0 0 -16px}
+.defaultSkin .mcePlaceHolder {border:1px dotted gray}
+
+/* Formats */
+.defaultSkin .mce_formatPreview a {font-size:10px}
+.defaultSkin .mce_p span.mceText {}
+.defaultSkin .mce_address span.mceText {font-style:italic}
+.defaultSkin .mce_pre span.mceText {font-family:monospace}
+.defaultSkin .mce_h1 span.mceText {font-weight:bolder; font-size: 2em}
+.defaultSkin .mce_h2 span.mceText {font-weight:bolder; font-size: 1.5em}
+.defaultSkin .mce_h3 span.mceText {font-weight:bolder; font-size: 1.17em}
+.defaultSkin .mce_h4 span.mceText {font-weight:bolder; font-size: 1em}
+.defaultSkin .mce_h5 span.mceText {font-weight:bolder; font-size: .83em}
+.defaultSkin .mce_h6 span.mceText {font-weight:bolder; font-size: .75em}
+
+/* Theme */
+.defaultSkin span.mce_bold {background-position:0 0}
+.defaultSkin span.mce_italic {background-position:-60px 0}
+.defaultSkin span.mce_underline {background-position:-140px 0}
+.defaultSkin span.mce_strikethrough {background-position:-120px 0}
+.defaultSkin span.mce_undo {background-position:-160px 0}
+.defaultSkin span.mce_redo {background-position:-100px 0}
+.defaultSkin span.mce_cleanup {background-position:-40px 0}
+.defaultSkin span.mce_bullist {background-position:-20px 0}
+.defaultSkin span.mce_numlist {background-position:-80px 0}
+.defaultSkin span.mce_justifyleft {background-position:-460px 0}
+.defaultSkin span.mce_justifyright {background-position:-480px 0}
+.defaultSkin span.mce_justifycenter {background-position:-420px 0}
+.defaultSkin span.mce_justifyfull {background-position:-440px 0}
+.defaultSkin span.mce_anchor {background-position:-200px 0}
+.defaultSkin span.mce_indent {background-position:-400px 0}
+.defaultSkin span.mce_outdent {background-position:-540px 0}
+.defaultSkin span.mce_link {background-position:-500px 0}
+.defaultSkin span.mce_unlink {background-position:-640px 0}
+.defaultSkin span.mce_sub {background-position:-600px 0}
+.defaultSkin span.mce_sup {background-position:-620px 0}
+.defaultSkin span.mce_removeformat {background-position:-580px 0}
+.defaultSkin span.mce_newdocument {background-position:-520px 0}
+.defaultSkin span.mce_image {background-position:-380px 0}
+.defaultSkin span.mce_help {background-position:-340px 0}
+.defaultSkin span.mce_code {background-position:-260px 0}
+.defaultSkin span.mce_hr {background-position:-360px 0}
+.defaultSkin span.mce_visualaid {background-position:-660px 0}
+.defaultSkin span.mce_charmap {background-position:-240px 0}
+.defaultSkin span.mce_paste {background-position:-560px 0}
+.defaultSkin span.mce_copy {background-position:-700px 0}
+.defaultSkin span.mce_cut {background-position:-680px 0}
+.defaultSkin span.mce_blockquote {background-position:-220px 0}
+.defaultSkin .mce_forecolor span.mceAction {background-position:-720px 0}
+.defaultSkin .mce_backcolor span.mceAction {background-position:-760px 0}
+.defaultSkin span.mce_forecolorpicker {background-position:-720px 0}
+.defaultSkin span.mce_backcolorpicker {background-position:-760px 0}
+
+/* Plugins */
+.defaultSkin span.mce_advhr {background-position:-0px -20px}
+.defaultSkin span.mce_ltr {background-position:-20px -20px}
+.defaultSkin span.mce_rtl {background-position:-40px -20px}
+.defaultSkin span.mce_emotions {background-position:-60px -20px}
+.defaultSkin span.mce_fullpage {background-position:-80px -20px}
+.defaultSkin span.mce_fullscreen {background-position:-100px -20px}
+.defaultSkin span.mce_iespell {background-position:-120px -20px}
+.defaultSkin span.mce_insertdate {background-position:-140px -20px}
+.defaultSkin span.mce_inserttime {background-position:-160px -20px}
+.defaultSkin span.mce_absolute {background-position:-180px -20px}
+.defaultSkin span.mce_backward {background-position:-200px -20px}
+.defaultSkin span.mce_forward {background-position:-220px -20px}
+.defaultSkin span.mce_insert_layer {background-position:-240px -20px}
+.defaultSkin span.mce_insertlayer {background-position:-260px -20px}
+.defaultSkin span.mce_movebackward {background-position:-280px -20px}
+.defaultSkin span.mce_moveforward {background-position:-300px -20px}
+.defaultSkin span.mce_media {background-position:-320px -20px}
+.defaultSkin span.mce_nonbreaking {background-position:-340px -20px}
+.defaultSkin span.mce_pastetext {background-position:-360px -20px}
+.defaultSkin span.mce_pasteword {background-position:-380px -20px}
+.defaultSkin span.mce_selectall {background-position:-400px -20px}
+.defaultSkin span.mce_preview {background-position:-420px -20px}
+.defaultSkin span.mce_print {background-position:-440px -20px}
+.defaultSkin span.mce_cancel {background-position:-460px -20px}
+.defaultSkin span.mce_save {background-position:-480px -20px}
+.defaultSkin span.mce_replace {background-position:-500px -20px}
+.defaultSkin span.mce_search {background-position:-520px -20px}
+.defaultSkin span.mce_styleprops {background-position:-560px -20px}
+.defaultSkin span.mce_table {background-position:-580px -20px}
+.defaultSkin span.mce_cell_props {background-position:-600px -20px}
+.defaultSkin span.mce_delete_table {background-position:-620px -20px}
+.defaultSkin span.mce_delete_col {background-position:-640px -20px}
+.defaultSkin span.mce_delete_row {background-position:-660px -20px}
+.defaultSkin span.mce_col_after {background-position:-680px -20px}
+.defaultSkin span.mce_col_before {background-position:-700px -20px}
+.defaultSkin span.mce_row_after {background-position:-720px -20px}
+.defaultSkin span.mce_row_before {background-position:-740px -20px}
+.defaultSkin span.mce_merge_cells {background-position:-760px -20px}
+.defaultSkin span.mce_table_props {background-position:-980px -20px}
+.defaultSkin span.mce_row_props {background-position:-780px -20px}
+.defaultSkin span.mce_split_cells {background-position:-800px -20px}
+.defaultSkin span.mce_template {background-position:-820px -20px}
+.defaultSkin span.mce_visualchars {background-position:-840px -20px}
+.defaultSkin span.mce_abbr {background-position:-860px -20px}
+.defaultSkin span.mce_acronym {background-position:-880px -20px}
+.defaultSkin span.mce_attribs {background-position:-900px -20px}
+.defaultSkin span.mce_cite {background-position:-920px -20px}
+.defaultSkin span.mce_del {background-position:-940px -20px}
+.defaultSkin span.mce_ins {background-position:-960px -20px}
+.defaultSkin span.mce_pagebreak {background-position:0 -40px}
+.defaultSkin .mce_spellchecker span.mceAction {background-position:-540px -20px}
diff -x .svn -aruN 0.7.15.src/e107_handlers/tiny_mce/themes/advanced/source_editor.htm 0.7.16.src/e107_handlers/tiny_mce/themes/advanced/source_editor.htm
--- 0.7.15.src/e107_handlers/tiny_mce/themes/advanced/source_editor.htm	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_handlers/tiny_mce/themes/advanced/source_editor.htm	2009-06-30 19:36:50.000000000 -0500
@@ -1,30 +1,29 @@
 <html xmlns="http://www.w3.org/1999/xhtml">
 <head>
 	<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
-	<title>{$lang_theme_code_title}</title>
-	<script language="javascript" type="text/javascript" src="../../tiny_mce_popup.js"></script>
-	<script language="javascript" type="text/javascript" src="jscripts/source_editor.js"></script>
-	<base target="_self" />
+	<title>{#advanced_dlg.code_title}</title>
+	<script type="text/javascript" src="../../tiny_mce_popup.js"></script>
+	<script type="text/javascript" src="js/source_editor.js"></script>
 </head>
-<body onload="tinyMCEPopup.executeOnLoad('onLoadInit();');" onresize="resizeInputs();" style="display: none">
-	<form name="source" onsubmit="saveContent();" action="#">
-		<div style="float: left" class="title">{$lang_theme_code_title}</div>
+<body onresize="resizeInputs();" style="display:none; overflow:hidden;">
+	<form name="source" onsubmit="saveContent();return false;" action="#">
+		<div style="float: left" class="title">{#advanced_dlg.code_title}</div>
 
 		<div id="wrapline" style="float: right">
-			<input type="checkbox" name="wraped" id="wraped" onclick="toggleWordWrap(this);" class="wordWrapCode" /><label for="wraped">{$lang_theme_code_wordwrap}</label>
+			<input type="checkbox" name="wraped" id="wraped" onclick="toggleWordWrap(this);" class="wordWrapCode" /><label for="wraped">{#advanced_dlg.code_wordwrap}</label>
 		</div>
 
 		<br style="clear: both" />
 
-		<textarea name="htmlSource" id="htmlSource" rows="15" cols="100" style="width: 100%; height: 100%; font-family: 'Courier New',Courier,mono; font-size: 12px" dir="ltr" wrap="off"></textarea>
+		<textarea name="htmlSource" id="htmlSource" rows="15" cols="100" style="width: 100%; height: 100%; font-family: 'Courier New',Courier,monospace; font-size: 12px;" dir="ltr" wrap="off" class="mceFocus"></textarea>
 
 		<div class="mceActionPanel">
 			<div style="float: left">
-				<input type="button" name="insert" value="{$lang_update}" onclick="saveContent();" id="insert" />
+				<input type="submit" name="insert" value="{#update}" id="insert" />
 			</div>
 
 			<div style="float: right">
-				<input type="button" name="cancel" value="{$lang_cancel}" onclick="tinyMCEPopup.close();" id="cancel" />
+				<input type="button" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" id="cancel" />
 			</div>
 		</div>
 	</form>
diff -x .svn -aruN 0.7.15.src/e107_handlers/tiny_mce/tiny_mce.js 0.7.16.src/e107_handlers/tiny_mce/tiny_mce.js
--- 0.7.15.src/e107_handlers/tiny_mce/tiny_mce.js	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_handlers/tiny_mce/tiny_mce.js	2009-06-30 19:36:50.000000000 -0500
@@ -1 +1 @@
-function TinyMCE_Engine(){var ua;this.majorVersion="2";this.minorVersion="0.8";this.releaseDate="2006-10-23";this.instances=new Array();this.switchClassCache=new Array();this.windowArgs=new Array();this.loadedFiles=new Array();this.pendingFiles=new Array();this.loadingIndex=0;this.configs=new Array();this.currentConfig=0;this.eventHandlers=new Array();this.log=new Array();this.undoLevels=[];this.undoIndex=0;this.typingUndoIndex=-1;ua=navigator.userAgent;this.isMSIE=(navigator.appName=="Microsoft Internet Explorer");this.isMSIE5=this.isMSIE&&(ua.indexOf('MSIE 5')!=-1);this.isMSIE5_0=this.isMSIE&&(ua.indexOf('MSIE 5.0')!=-1);this.isMSIE7=this.isMSIE&&(ua.indexOf('MSIE 7')!=-1);this.isGecko=ua.indexOf('Gecko')!=-1;this.isSafari=ua.indexOf('Safari')!=-1;this.isOpera=ua.indexOf('Opera')!=-1;this.isMac=ua.indexOf('Mac')!=-1;this.isNS7=ua.indexOf('Netscape/7')!=-1;this.isNS71=ua.indexOf('Netscape/7.1')!=-1;this.dialogCounter=0;this.plugins=new Array();this.themes=new Array();this.menus=new Array();this.loadedPlugins=new Array();this.buttonMap=new Array();this.isLoaded=false;if(this.isOpera){this.isMSIE=true;this.isGecko=false;this.isSafari=false}this.isIE=this.isMSIE;this.isRealIE=this.isMSIE&&!this.isOpera;this.idCounter=0};TinyMCE_Engine.prototype={init:function(settings){var theme,nl,baseHREF="",i;if(this.isMSIE5_0)return;this.settings=settings;if(typeof(document.execCommand)=='undefined')return;if(!tinyMCE.baseURL){var elements=document.getElementsByTagName('script');nl=document.getElementsByTagName('base');for(i=0;i<nl.length;i++){if(nl[i].href)baseHREF=nl[i].href}for(var i=0;i<elements.length;i++){if(elements[i].src&&(elements[i].src.indexOf("tiny_mce.js")!=-1||elements[i].src.indexOf("tiny_mce_dev.js")!=-1||elements[i].src.indexOf("tiny_mce_src.js")!=-1||elements[i].src.indexOf("tiny_mce_gzip")!=-1)){var src=elements[i].src;tinyMCE.srcMode=(src.indexOf('_src')!=-1||src.indexOf('_dev')!=-1)?'_src':'';tinyMCE.gzipMode=src.indexOf('_gzip')!=-1;src=src.substring(0,src.lastIndexOf('/'));if(settings.exec_mode=="src"||settings.exec_mode=="normal")tinyMCE.srcMode=settings.exec_mode=="src"?'_src':'';if(baseHREF!=""&&src.indexOf('://')==-1)tinyMCE.baseURL=baseHREF+src;else tinyMCE.baseURL=src;break}}}this.documentBasePath=document.location.href;if(this.documentBasePath.indexOf('?')!=-1)this.documentBasePath=this.documentBasePath.substring(0,this.documentBasePath.indexOf('?'));this.documentURL=this.documentBasePath;this.documentBasePath=this.documentBasePath.substring(0,this.documentBasePath.lastIndexOf('/'));if(tinyMCE.baseURL.indexOf('://')==-1&&tinyMCE.baseURL.charAt(0)!='/'){tinyMCE.baseURL=this.documentBasePath+"/"+tinyMCE.baseURL}this._def("mode","none");this._def("theme","advanced");this._def("plugins","",true);this._def("language","en");this._def("docs_language",this.settings['language']);this._def("elements","");this._def("textarea_trigger","mce_editable");this._def("editor_selector","");this._def("editor_deselector","mceNoEditor");this._def("valid_elements","+a[id|style|rel|rev|charset|hreflang|dir|lang|tabindex|accesskey|type|name|href|target|title|class|onfocus|onblur|onclick|ondblclick|onmousedown|onmouseup|onmouseover|onmousemove|onmouseout|onkeypress|onkeydown|onkeyup],-strong/-b[class|style],-em/-i[class|style],-strike[class|style],-u[class|style],#p[id|style|dir|class|align],-ol[class|style],-ul[class|style],-li[class|style],br,img[id|dir|lang|longdesc|usemap|style|class|src|onmouseover|onmouseout|border|alt=|title|hspace|vspace|width|height|align],-sub[style|class],-sup[style|class],-blockquote[dir|style],-table[border=0|cellspacing|cellpadding|width|height|class|align|summary|style|dir|id|lang|bgcolor|background|bordercolor],-tr[id|lang|dir|class|rowspan|width|height|align|valign|style|bgcolor|background|bordercolor],tbody[id|class],thead[id|class],tfoot[id|class],#td[id|lang|dir|class|colspan|rowspan|width|height|align|valign|style|bgcolor|background|bordercolor|scope],-th[id|lang|dir|class|colspan|rowspan|width|height|align|valign|style|scope],caption[id|lang|dir|class|style],-div[id|dir|class|align|style],-span[style|class|align],-pre[class|align|style],address[class|align|style],-h1[id|style|dir|class|align],-h2[id|style|dir|class|align],-h3[id|style|dir|class|align],-h4[id|style|dir|class|align],-h5[id|style|dir|class|align],-h6[id|style|dir|class|align],hr[class|style],-font[face|size|style|id|class|dir|color],dd[id|class|title|style|dir|lang],dl[id|class|title|style|dir|lang],dt[id|class|title|style|dir|lang],cite[title|id|class|style|dir|lang],abbr[title|id|class|style|dir|lang],acronym[title|id|class|style|dir|lang],del[title|id|class|style|dir|lang|datetime|cite],ins[title|id|class|style|dir|lang|datetime|cite]");this._def("extended_valid_elements","");this._def("invalid_elements","");this._def("encoding","");this._def("urlconverter_callback",tinyMCE.getParam("urlconvertor_callback","TinyMCE_Engine.prototype.convertURL"));this._def("save_callback","");this._def("debug",false);this._def("force_br_newlines",false);this._def("force_p_newlines",true);this._def("add_form_submit_trigger",true);this._def("relative_urls",true);this._def("remove_script_host",true);this._def("focus_alert",true);this._def("document_base_url",this.documentURL);this._def("visual",true);this._def("visual_table_class","mceVisualAid");this._def("setupcontent_callback","");this._def("fix_content_duplication",true);this._def("custom_undo_redo",true);this._def("custom_undo_redo_levels",-1);this._def("custom_undo_redo_keyboard_shortcuts",true);this._def("custom_undo_redo_restore_selection",true);this._def("custom_undo_redo_global",false);this._def("verify_html",true);this._def("apply_source_formatting",false);this._def("directionality","ltr");this._def("cleanup_on_startup",false);this._def("inline_styles",false);this._def("convert_newlines_to_brs",false);this._def("auto_reset_designmode",true);this._def("entities","39,#39,160,nbsp,161,iexcl,162,cent,163,pound,164,curren,165,yen,166,brvbar,167,sect,168,uml,169,copy,170,ordf,171,laquo,172,not,173,shy,174,reg,175,macr,176,deg,177,plusmn,178,sup2,179,sup3,180,acute,181,micro,182,para,183,middot,184,cedil,185,sup1,186,ordm,187,raquo,188,frac14,189,frac12,190,frac34,191,iquest,192,Agrave,193,Aacute,194,Acirc,195,Atilde,196,Auml,197,Aring,198,AElig,199,Ccedil,200,Egrave,201,Eacute,202,Ecirc,203,Euml,204,Igrave,205,Iacute,206,Icirc,207,Iuml,208,ETH,209,Ntilde,210,Ograve,211,Oacute,212,Ocirc,213,Otilde,214,Ouml,215,times,216,Oslash,217,Ugrave,218,Uacute,219,Ucirc,220,Uuml,221,Yacute,222,THORN,223,szlig,224,agrave,225,aacute,226,acirc,227,atilde,228,auml,229,aring,230,aelig,231,ccedil,232,egrave,233,eacute,234,ecirc,235,euml,236,igrave,237,iacute,238,icirc,239,iuml,240,eth,241,ntilde,242,ograve,243,oacute,244,ocirc,245,otilde,246,ouml,247,divide,248,oslash,249,ugrave,250,uacute,251,ucirc,252,uuml,253,yacute,254,thorn,255,yuml,402,fnof,913,Alpha,914,Beta,915,Gamma,916,Delta,917,Epsilon,918,Zeta,919,Eta,920,Theta,921,Iota,922,Kappa,923,Lambda,924,Mu,925,Nu,926,Xi,927,Omicron,928,Pi,929,Rho,931,Sigma,932,Tau,933,Upsilon,934,Phi,935,Chi,936,Psi,937,Omega,945,alpha,946,beta,947,gamma,948,delta,949,epsilon,950,zeta,951,eta,952,theta,953,iota,954,kappa,955,lambda,956,mu,957,nu,958,xi,959,omicron,960,pi,961,rho,962,sigmaf,963,sigma,964,tau,965,upsilon,966,phi,967,chi,968,psi,969,omega,977,thetasym,978,upsih,982,piv,8226,bull,8230,hellip,8242,prime,8243,Prime,8254,oline,8260,frasl,8472,weierp,8465,image,8476,real,8482,trade,8501,alefsym,8592,larr,8593,uarr,8594,rarr,8595,darr,8596,harr,8629,crarr,8656,lArr,8657,uArr,8658,rArr,8659,dArr,8660,hArr,8704,forall,8706,part,8707,exist,8709,empty,8711,nabla,8712,isin,8713,notin,8715,ni,8719,prod,8721,sum,8722,minus,8727,lowast,8730,radic,8733,prop,8734,infin,8736,ang,8743,and,8744,or,8745,cap,8746,cup,8747,int,8756,there4,8764,sim,8773,cong,8776,asymp,8800,ne,8801,equiv,8804,le,8805,ge,8834,sub,8835,sup,8836,nsub,8838,sube,8839,supe,8853,oplus,8855,otimes,8869,perp,8901,sdot,8968,lceil,8969,rceil,8970,lfloor,8971,rfloor,9001,lang,9002,rang,9674,loz,9824,spades,9827,clubs,9829,hearts,9830,diams,34,quot,38,amp,60,lt,62,gt,338,OElig,339,oelig,352,Scaron,353,scaron,376,Yuml,710,circ,732,tilde,8194,ensp,8195,emsp,8201,thinsp,8204,zwnj,8205,zwj,8206,lrm,8207,rlm,8211,ndash,8212,mdash,8216,lsquo,8217,rsquo,8218,sbquo,8220,ldquo,8221,rdquo,8222,bdquo,8224,dagger,8225,Dagger,8240,permil,8249,lsaquo,8250,rsaquo,8364,euro",true);this._def("entity_encoding","named");this._def("cleanup_callback","");this._def("add_unload_trigger",true);this._def("ask",false);this._def("nowrap",false);this._def("auto_resize",false);this._def("auto_focus",false);this._def("cleanup",true);this._def("remove_linebreaks",true);this._def("button_tile_map",false);this._def("submit_patch",true);this._def("browsers","msie,safari,gecko,opera",true);this._def("dialog_type","window");this._def("accessibility_warnings",true);this._def("accessibility_focus",true);this._def("merge_styles_invalid_parents","");this._def("force_hex_style_colors",true);this._def("trim_span_elements",true);this._def("convert_fonts_to_spans",false);this._def("doctype",'<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">');this._def("font_size_classes",'');this._def("font_size_style_values",'xx-small,x-small,small,medium,large,x-large,xx-large',true);this._def("event_elements",'a,img',true);this._def("convert_urls",true);this._def("table_inline_editing",false);this._def("object_resizing",true);this._def("custom_shortcuts",true);this._def("convert_on_click",false);this._def("content_css",'');this._def("fix_list_elements",false);this._def("fix_table_elements",false);this._def("strict_loading_mode",document.contentType=='application/xhtml+xml');this._def("hidden_tab_class",'');this._def("display_tab_class",'');this._def("gecko_spellcheck",false);if(this.isMSIE&&!this.isOpera)this.settings.strict_loading_mode=false;if(this.isMSIE&&this.settings['browsers'].indexOf('msie')==-1)return;if(this.isGecko&&this.settings['browsers'].indexOf('gecko')==-1)return;if(this.isSafari&&this.settings['browsers'].indexOf('safari')==-1)return;if(this.isOpera&&this.settings['browsers'].indexOf('opera')==-1)return;baseHREF=tinyMCE.settings['document_base_url'];var h=document.location.href;var p=h.indexOf('://');if(p>0&&document.location.protocol!="file:"){p=h.indexOf('/',p+3);h=h.substring(0,p);if(baseHREF.indexOf('://')==-1)baseHREF=h+baseHREF;tinyMCE.settings['document_base_url']=baseHREF;tinyMCE.settings['document_base_prefix']=h}if(baseHREF.indexOf('?')!=-1)baseHREF=baseHREF.substring(0,baseHREF.indexOf('?'));this.settings['base_href']=baseHREF.substring(0,baseHREF.lastIndexOf('/'))+"/";theme=this.settings['theme'];this.inlineStrict='A|BR|SPAN|BDO|MAP|OBJECT|IMG|TT|I|B|BIG|SMALL|EM|STRONG|DFN|CODE|Q|SAMP|KBD|VAR|CITE|ABBR|ACRONYM|SUB|SUP|#text|#comment';this.inlineTransitional='A|BR|SPAN|BDO|OBJECT|APPLET|IMG|MAP|IFRAME|TT|I|B|U|S|STRIKE|BIG|SMALL|FONT|BASEFONT|EM|STRONG|DFN|CODE|Q|SAMP|KBD|VAR|CITE|ABBR|ACRONYM|SUB|SUP|INPUT|SELECT|TEXTAREA|LABEL|BUTTON|#text|#comment';this.blockElms='H[1-6]|P|DIV|ADDRESS|PRE|FORM|TABLE|LI|OL|UL|TD|BLOCKQUOTE|CENTER|DL|DT|DD|DIR|FIELDSET|FORM|NOSCRIPT|NOFRAMES|MENU|ISINDEX|SAMP';this.blockRegExp=new RegExp("^("+this.blockElms+")$","i");this.posKeyCodes=new Array(13,45,36,35,33,34,37,38,39,40);this.uniqueURL='javascript:TINYMCE_UNIQUEURL();';this.uniqueTag='<div id="mceTMPElement" style="display: none">TMP</div>';this.callbacks=new Array('onInit','getInfo','getEditorTemplate','setupContent','onChange','onPageLoad','handleNodeChange','initInstance','execCommand','getControlHTML','handleEvent','cleanup');this.settings['theme_href']=tinyMCE.baseURL+"/themes/"+theme;if(!tinyMCE.isIE||tinyMCE.isOpera)this.settings['force_br_newlines']=false;if(tinyMCE.getParam("popups_css",false)){var cssPath=tinyMCE.getParam("popups_css","");if(cssPath.indexOf('://')==-1&&cssPath.charAt(0)!='/')this.settings['popups_css']=this.documentBasePath+"/"+cssPath;else this.settings['popups_css']=cssPath}else this.settings['popups_css']=tinyMCE.baseURL+"/themes/"+theme+"/css/editor_popup.css";if(tinyMCE.getParam("editor_css",false)){var cssPath=tinyMCE.getParam("editor_css","");if(cssPath.indexOf('://')==-1&&cssPath.charAt(0)!='/')this.settings['editor_css']=this.documentBasePath+"/"+cssPath;else this.settings['editor_css']=cssPath}else{if(this.settings.editor_css!='')this.settings['editor_css']=tinyMCE.baseURL+"/themes/"+theme+"/css/editor_ui.css"}if(tinyMCE.settings['debug']){var msg="Debug: \n";msg+="baseURL: "+this.baseURL+"\n";msg+="documentBasePath: "+this.documentBasePath+"\n";msg+="content_css: "+this.settings['content_css']+"\n";msg+="popups_css: "+this.settings['popups_css']+"\n";msg+="editor_css: "+this.settings['editor_css']+"\n";alert(msg)}if(this.configs.length==0){if(typeof(TinyMCECompressed)=="undefined"){tinyMCE.addEvent(window,"DOMContentLoaded",TinyMCE_Engine.prototype.onLoad);if(tinyMCE.isRealIE){if(document.body)tinyMCE.addEvent(document.body,"readystatechange",TinyMCE_Engine.prototype.onLoad);else tinyMCE.addEvent(document,"readystatechange",TinyMCE_Engine.prototype.onLoad)}tinyMCE.addEvent(window,"load",TinyMCE_Engine.prototype.onLoad);tinyMCE._addUnloadEvents()}}this.loadScript(tinyMCE.baseURL+'/themes/'+this.settings['theme']+'/editor_template'+tinyMCE.srcMode+'.js');this.loadScript(tinyMCE.baseURL+'/langs/'+this.settings['language']+'.js');this.loadCSS(this.settings['editor_css']);var p=tinyMCE.getParam('plugins','',true,',');if(p.length>0){for(var i=0;i<p.length;i++){if(p[i].charAt(0)!='-')this.loadScript(tinyMCE.baseURL+'/plugins/'+p[i]+'/editor_plugin'+tinyMCE.srcMode+'.js')}}if(tinyMCE.getParam('entity_encoding')=='named'){settings['cleanup_entities']=new Array();var entities=tinyMCE.getParam('entities','',true,',');for(var i=0;i<entities.length;i+=2)settings['cleanup_entities']['c'+entities[i]]=entities[i+1]}settings['index']=this.configs.length;this.configs[this.configs.length]=settings;this.loadNextScript();if(this.isIE&&!this.isOpera){try{document.execCommand('BackgroundImageCache',false,true)}catch(e){}}},_addUnloadEvents:function(){if(tinyMCE.isIE){if(tinyMCE.settings['add_unload_trigger']){tinyMCE.addEvent(window,"unload",TinyMCE_Engine.prototype.unloadHandler);tinyMCE.addEvent(window.document,"beforeunload",TinyMCE_Engine.prototype.unloadHandler)}}else{if(tinyMCE.settings['add_unload_trigger'])tinyMCE.addEvent(window,"unload",function(){tinyMCE.triggerSave(true,true)})}},_def:function(key,def_val,t){var v=tinyMCE.getParam(key,def_val);v=t?v.replace(/\s+/g,""):v;this.settings[key]=v},hasPlugin:function(n){return typeof(this.plugins[n])!="undefined"&&this.plugins[n]!=null},addPlugin:function(n,p){var op=this.plugins[n];p.baseURL=op?op.baseURL:tinyMCE.baseURL+"/plugins/"+n;this.plugins[n]=p;this.loadNextScript()},setPluginBaseURL:function(n,u){var op=this.plugins[n];if(op)op.baseURL=u;else this.plugins[n]={baseURL:u}},loadPlugin:function(n,u){u=u.indexOf('.js')!=-1?u.substring(0,u.lastIndexOf('/')):u;u=u.charAt(u.length-1)=='/'?u.substring(0,u.length-1):u;this.plugins[n]={baseURL:u};this.loadScript(u+"/editor_plugin"+(tinyMCE.srcMode?'_src':'')+".js")},hasTheme:function(n){return typeof(this.themes[n])!="undefined"&&this.themes[n]!=null},addTheme:function(n,t){this.themes[n]=t;this.loadNextScript()},addMenu:function(n,m){this.menus[n]=m},hasMenu:function(n){return typeof(this.plugins[n])!="undefined"&&this.plugins[n]!=null},loadScript:function(url){var i;for(i=0;i<this.loadedFiles.length;i++){if(this.loadedFiles[i]==url)return}if(tinyMCE.settings.strict_loading_mode)this.pendingFiles[this.pendingFiles.length]=url;else document.write('<sc'+'ript language="javascript" type="text/javascript" src="'+url+'"></script>');this.loadedFiles[this.loadedFiles.length]=url},loadNextScript:function(){var d=document,se;if(!tinyMCE.settings.strict_loading_mode)return;if(this.loadingIndex<this.pendingFiles.length){se=d.createElementNS('http://www.w3.org/1999/xhtml','script');se.setAttribute('language','javascript');se.setAttribute('type','text/javascript');se.setAttribute('src',this.pendingFiles[this.loadingIndex++]);d.getElementsByTagName("head")[0].appendChild(se)}else this.loadingIndex=-1;},loadCSS:function(url){var ar=url.replace(/\s+/,'').split(',');var lflen=0,csslen=0;var skip=false;var x=0,i=0,nl,le;for(x=0,csslen=ar.length;x<csslen;x++){if(ar[x]!=null&&ar[x]!='null'&&ar[x].length>0){for(i=0,lflen=this.loadedFiles.length;i<lflen;i++){if(this.loadedFiles[i]==ar[x]){skip=true;break}}if(!skip){if(tinyMCE.settings.strict_loading_mode){nl=document.getElementsByTagName("head");le=document.createElement('link');le.setAttribute('href',ar[x]);le.setAttribute('rel','stylesheet');le.setAttribute('type','text/css');nl[0].appendChild(le)}else document.write('<link href="'+ar[x]+'" rel="stylesheet" type="text/css" />');this.loadedFiles[this.loadedFiles.length]=ar[x]}}}},importCSS:function(doc,css){var css_ary=css.replace(/\s+/,'').split(',');var csslen,elm,headArr,x,css_file;for(x=0,csslen=css_ary.length;x<csslen;x++){css_file=css_ary[x];if(css_file!=null&&css_file!='null'&&css_file.length>0){if(css_file.indexOf('://')==-1&&css_file.charAt(0)!='/')css_file=this.documentBasePath+"/"+css_file;if(typeof(doc.createStyleSheet)=="undefined"){elm=doc.createElement("link");elm.rel="stylesheet";elm.href=css_file;if((headArr=doc.getElementsByTagName("head"))!=null&&headArr.length>0)headArr[0].appendChild(elm)}else doc.createStyleSheet(css_file)}}},confirmAdd:function(e,settings){var elm=tinyMCE.isIE?event.srcElement:e.target;var elementId=elm.name?elm.name:elm.id;tinyMCE.settings=settings;if(tinyMCE.settings['convert_on_click']||(!elm.getAttribute('mce_noask')&&confirm(tinyMCELang['lang_edit_confirm'])))tinyMCE.addMCEControl(elm,elementId);elm.setAttribute('mce_noask','true')},updateContent:function(form_element_name){var formElement=document.getElementById(form_element_name);for(var n in tinyMCE.instances){var inst=tinyMCE.instances[n];if(!tinyMCE.isInstance(inst))continue;inst.switchSettings();if(inst.formElement==formElement){var doc=inst.getDoc();tinyMCE._setHTML(doc,inst.formElement.value);if(!tinyMCE.isIE)doc.body.innerHTML=tinyMCE._cleanupHTML(inst,doc,this.settings,doc.body,inst.visualAid)}}},addMCEControl:function(replace_element,form_element_name,target_document){var id="mce_editor_"+tinyMCE.idCounter++;var inst=new TinyMCE_Control(tinyMCE.settings);inst.editorId=id;this.instances[id]=inst;inst._onAdd(replace_element,form_element_name,target_document)},removeInstance:function(ti){var t=[],n,i;for(n in tinyMCE.instances){i=tinyMCE.instances[n];if(tinyMCE.isInstance(i)&&ti!=i)t[n]=i}tinyMCE.instances=t;n=[];t=tinyMCE.undoLevels;for(i=0;i<t.length;i++){if(t[i]!=ti)n.push(t[i])}tinyMCE.undoLevels=n;tinyMCE.undoIndex=n.length;return ti},removeMCEControl:function(editor_id){var inst=tinyMCE.getInstanceById(editor_id),h,re,ot,tn;if(inst){inst.switchSettings();editor_id=inst.editorId;h=tinyMCE.getContent(editor_id);this.removeInstance(inst);tinyMCE.selectedElement=null;tinyMCE.selectedInstance=null;re=document.getElementById(editor_id+"_parent");ot=inst.oldTargetElement;tn=ot.nodeName.toLowerCase();if(tn=="textarea"||tn=="input"){re.parentNode.removeChild(re);ot.style.display="inline";ot.value=h}else{ot.innerHTML=h;ot.style.display='block';re.parentNode.insertBefore(ot,re);re.parentNode.removeChild(re)}}},triggerSave:function(skip_cleanup,skip_callback){var inst,n;if(typeof(skip_cleanup)=="undefined")skip_cleanup=false;if(typeof(skip_callback)=="undefined")skip_callback=false;for(n in tinyMCE.instances){inst=tinyMCE.instances[n];if(!tinyMCE.isInstance(inst))continue;inst.triggerSave(skip_cleanup,skip_callback)}},resetForm:function(form_index){var i,inst,n,formObj=document.forms[form_index];for(n in tinyMCE.instances){inst=tinyMCE.instances[n];if(!tinyMCE.isInstance(inst))continue;inst.switchSettings();for(i=0;i<formObj.elements.length;i++){if(inst.formTargetElementId==formObj.elements[i].name)inst.getBody().innerHTML=inst.startContent}}},execInstanceCommand:function(editor_id,command,user_interface,value,focus){var inst=tinyMCE.getInstanceById(editor_id),r;if(inst){r=inst.selection.getRng();if(typeof(focus)=="undefined")focus=true;if(focus&&(!r||!r.item))inst.contentWindow.focus();inst.autoResetDesignMode();this.selectedElement=inst.getFocusElement();inst.select();tinyMCE.execCommand(command,user_interface,value);if(tinyMCE.isIE&&window.event!=null)tinyMCE.cancelEvent(window.event)}},execCommand:function(command,user_interface,value){var inst=tinyMCE.selectedInstance;user_interface=user_interface?user_interface:false;value=value?value:null;if(inst)inst.switchSettings();switch(command){case"Undo":if(this.getParam('custom_undo_redo_global')){if(this.undoIndex>0){tinyMCE.nextUndoRedoAction='Undo';inst=this.undoLevels[--this.undoIndex];inst.select();if(!tinyMCE.nextUndoRedoInstanceId)inst.execCommand('Undo')}}else inst.execCommand('Undo');return true;case"Redo":if(this.getParam('custom_undo_redo_global')){if(this.undoIndex<=this.undoLevels.length-1){tinyMCE.nextUndoRedoAction='Redo';inst=this.undoLevels[this.undoIndex++];inst.select();if(!tinyMCE.nextUndoRedoInstanceId)inst.execCommand('Redo')}}else inst.execCommand('Redo');return true;case'mceFocus':var inst=tinyMCE.getInstanceById(value);if(inst)inst.getWin().focus();return;case"mceAddControl":case"mceAddEditor":tinyMCE.addMCEControl(tinyMCE._getElementById(value),value);return;case"mceAddFrameControl":tinyMCE.addMCEControl(tinyMCE._getElementById(value['element'],value['document']),value['element'],value['document']);return;case"mceRemoveControl":case"mceRemoveEditor":tinyMCE.removeMCEControl(value);return;case"mceResetDesignMode":if(!tinyMCE.isIE){for(var n in tinyMCE.instances){if(!tinyMCE.isInstance(tinyMCE.instances[n]))continue;try{tinyMCE.instances[n].getDoc().designMode="on"}catch(e){}}}return}if(inst){inst.execCommand(command,user_interface,value)}else if(tinyMCE.settings['focus_alert'])alert(tinyMCELang['lang_focus_alert'])},_createIFrame:function(replace_element,doc,win){var iframe,id=replace_element.getAttribute("id");var aw,ah;if(typeof(doc)=="undefined")doc=document;if(typeof(win)=="undefined")win=window;iframe=doc.createElement("iframe");aw=""+tinyMCE.settings['area_width'];ah=""+tinyMCE.settings['area_height'];if(aw.indexOf('%')==-1){aw=parseInt(aw);aw=(isNaN(aw)||aw<0)?300:aw;aw=aw+"px"}if(ah.indexOf('%')==-1){ah=parseInt(ah);ah=(isNaN(ah)||ah<0)?240:ah;ah=ah+"px"}iframe.setAttribute("id",id);iframe.setAttribute("name",id);iframe.setAttribute("class","mceEditorIframe");iframe.setAttribute("border","0");iframe.setAttribute("frameBorder","0");iframe.setAttribute("marginWidth","0");iframe.setAttribute("marginHeight","0");iframe.setAttribute("leftMargin","0");iframe.setAttribute("topMargin","0");iframe.setAttribute("width",aw);iframe.setAttribute("height",ah);iframe.setAttribute("allowtransparency","true");iframe.className='mceEditorIframe';if(tinyMCE.settings["auto_resize"])iframe.setAttribute("scrolling","no");if(tinyMCE.isRealIE)iframe.setAttribute("src",this.settings['default_document']);iframe.style.width=aw;iframe.style.height=ah;if(tinyMCE.settings.strict_loading_mode)iframe.style.marginBottom='-5px';if(tinyMCE.isRealIE)replace_element.outerHTML=iframe.outerHTML;else replace_element.parentNode.replaceChild(iframe,replace_element);if(tinyMCE.isRealIE)return win.frames[id];else return iframe},setupContent:function(editor_id){var inst=tinyMCE.instances[editor_id],i;var doc=inst.getDoc();var head=doc.getElementsByTagName('head').item(0);var content=inst.startContent;if(tinyMCE.settings.strict_loading_mode){content=content.replace(/&lt;/g,'<');content=content.replace(/&gt;/g,'>');content=content.replace(/&quot;/g,'"');content=content.replace(/&amp;/g,'&')}inst.switchSettings();if(!tinyMCE.isIE&&tinyMCE.getParam("setupcontent_reload",false)&&doc.title!="blank_page"){try{doc.location.href=tinyMCE.baseURL+"/blank.htm"}catch(ex){}window.setTimeout("tinyMCE.setupContent('"+editor_id+"');",1000);return}if(!head){window.setTimeout("tinyMCE.setupContent('"+editor_id+"');",10);return}tinyMCE.importCSS(inst.getDoc(),tinyMCE.baseURL+"/themes/"+inst.settings['theme']+"/css/editor_content.css");tinyMCE.importCSS(inst.getDoc(),inst.settings['content_css']);tinyMCE.dispatchCallback(inst,'init_instance_callback','initInstance',inst);if(tinyMCE.getParam('custom_undo_redo_keyboard_shortcuts')){inst.addShortcut('ctrl','z','lang_undo_desc','Undo');inst.addShortcut('ctrl','y','lang_redo_desc','Redo')}for(i=1;i<=6;i++)inst.addShortcut('ctrl',''+i,'','FormatBlock',false,'<h'+i+'>');inst.addShortcut('ctrl','7','','FormatBlock',false,'<p>');inst.addShortcut('ctrl','8','','FormatBlock',false,'<div>');inst.addShortcut('ctrl','9','','FormatBlock',false,'<address>');if(tinyMCE.isGecko){inst.addShortcut('ctrl','b','lang_bold_desc','Bold');inst.addShortcut('ctrl','i','lang_italic_desc','Italic');inst.addShortcut('ctrl','u','lang_underline_desc','Underline')}if(tinyMCE.getParam("convert_fonts_to_spans"))inst.getBody().setAttribute('id','mceSpanFonts');if(tinyMCE.settings['nowrap'])doc.body.style.whiteSpace="nowrap";doc.body.dir=this.settings['directionality'];doc.editorId=editor_id;if(!tinyMCE.isIE)doc.documentElement.editorId=editor_id;inst.setBaseHREF(tinyMCE.settings['base_href']);if(tinyMCE.settings['convert_newlines_to_brs']){content=tinyMCE.regexpReplace(content,"\r\n","<br />","gi");content=tinyMCE.regexpReplace(content,"\r","<br />","gi");content=tinyMCE.regexpReplace(content,"\n","<br />","gi")}content=tinyMCE.storeAwayURLs(content);content=tinyMCE._customCleanup(inst,"insert_to_editor",content);if(tinyMCE.isIE){window.setInterval('try{tinyMCE.getCSSClasses(tinyMCE.instances["'+editor_id+'"].getDoc(), "'+editor_id+'");}catch(e){}',500);if(tinyMCE.settings["force_br_newlines"])doc.styleSheets[0].addRule("p","margin: 0;");var body=inst.getBody();body.editorId=editor_id}content=tinyMCE.cleanupHTMLCode(content);if(!tinyMCE.isIE){var contentElement=inst.getDoc().createElement("body");var doc=inst.getDoc();contentElement.innerHTML=content;if(tinyMCE.isGecko&&tinyMCE.settings['remove_lt_gt'])content=content.replace(new RegExp('&lt;&gt;','g'),"");if(tinyMCE.settings['cleanup_on_startup'])tinyMCE.setInnerHTML(inst.getBody(),tinyMCE._cleanupHTML(inst,doc,this.settings,contentElement));else tinyMCE.setInnerHTML(inst.getBody(),content);tinyMCE.convertAllRelativeURLs(inst.getBody())}else{if(tinyMCE.settings['cleanup_on_startup']){tinyMCE._setHTML(inst.getDoc(),content);eval('try {tinyMCE.setInnerHTML(inst.getBody(), tinyMCE._cleanupHTML(inst, inst.contentDocument, this.settings, inst.getBody()));} catch(e) {}')}else tinyMCE._setHTML(inst.getDoc(),content)}var parentElm=inst.targetDoc.getElementById(inst.editorId+'_parent');inst.formElement=tinyMCE.isGecko?parentElm.previousSibling:parentElm.nextSibling;tinyMCE.handleVisualAid(inst.getBody(),true,tinyMCE.settings['visual'],inst);tinyMCE.dispatchCallback(inst,'setupcontent_callback','setupContent',editor_id,inst.getBody(),inst.getDoc());if(!tinyMCE.isIE)tinyMCE.addEventHandlers(inst);if(tinyMCE.isIE){tinyMCE.addEvent(inst.getBody(),"blur",TinyMCE_Engine.prototype._eventPatch);tinyMCE.addEvent(inst.getBody(),"beforedeactivate",TinyMCE_Engine.prototype._eventPatch);if(!tinyMCE.isOpera){tinyMCE.addEvent(doc.body,"mousemove",TinyMCE_Engine.prototype.onMouseMove);tinyMCE.addEvent(doc.body,"beforepaste",TinyMCE_Engine.prototype._eventPatch);tinyMCE.addEvent(doc.body,"drop",TinyMCE_Engine.prototype._eventPatch)}}inst.select();tinyMCE.selectedElement=inst.contentWindow.document.body;tinyMCE._customCleanup(inst,"insert_to_editor_dom",inst.getBody());tinyMCE._customCleanup(inst,"setup_content_dom",inst.getBody());tinyMCE._setEventsEnabled(inst.getBody(),false);tinyMCE.cleanupAnchors(inst.getDoc());if(tinyMCE.getParam("convert_fonts_to_spans"))tinyMCE.convertSpansToFonts(inst.getDoc());inst.startContent=tinyMCE.trim(inst.getBody().innerHTML);inst.undoRedo.add({content:inst.startContent});if(tinyMCE.isGecko){tinyMCE.selectNodes(inst.getBody(),function(n){if(n.nodeType==3||n.nodeType==8)n.nodeValue=n.nodeValue.replace(new RegExp('\\s(mce_src|mce_href)=\"[^\"]*\"','gi'),"");return false})}if(tinyMCE.isGecko)inst.getBody().spellcheck=tinyMCE.getParam("gecko_spellcheck");tinyMCE._removeInternal(inst.getBody());inst.select();tinyMCE.triggerNodeChange(false,true)},storeAwayURLs:function(s){if(!s.match(/(mce_src|mce_href)/gi,s)){s=s.replace(new RegExp('src\\s*=\\s*\"([^ >\"]*)\"','gi'),'src="$1" mce_src="$1"');s=s.replace(new RegExp('href\\s*=\\s*\"([^ >\"]*)\"','gi'),'href="$1" mce_href="$1"')}return s},_removeInternal:function(n){if(tinyMCE.isGecko){tinyMCE.selectNodes(n,function(n){if(n.nodeType==3||n.nodeType==8)n.nodeValue=n.nodeValue.replace(new RegExp('\\s(mce_src|mce_href)=\"[^\"]*\"','gi'),"");return false})}},handleEvent:function(e){var inst=tinyMCE.selectedInstance;if(typeof(tinyMCE)=="undefined")return true;if(tinyMCE.executeCallback(tinyMCE.selectedInstance,'handle_event_callback','handleEvent',e))return false;switch(e.type){case"beforedeactivate":case"blur":if(tinyMCE.selectedInstance)tinyMCE.selectedInstance.execCommand('mceEndTyping');tinyMCE.hideMenus();return;case"drop":case"beforepaste":if(tinyMCE.selectedInstance)tinyMCE.selectedInstance.setBaseHREF(null);if(tinyMCE.isRealIE){var ife=tinyMCE.selectedInstance.iframeElement;if(ife.style.height.indexOf('%')!=-1){ife._oldHeight=ife.style.height;ife.style.height=ife.clientHeight}}window.setTimeout("tinyMCE.selectedInstance.setBaseHREF(tinyMCE.settings['base_href']);tinyMCE._resetIframeHeight();",1);return;case"submit":tinyMCE.triggerSave();tinyMCE.isNotDirty=true;return;case"reset":var formObj=tinyMCE.isIE?window.event.srcElement:e.target;for(var i=0;i<document.forms.length;i++){if(document.forms[i]==formObj)window.setTimeout('tinyMCE.resetForm('+i+');',10)}return;case"keypress":if(inst&&inst.handleShortcut(e))return false;if(e.target.editorId){tinyMCE.instances[e.target.editorId].select()}else{if(e.target.ownerDocument.editorId)tinyMCE.instances[e.target.ownerDocument.editorId].select()}if(tinyMCE.selectedInstance)tinyMCE.selectedInstance.switchSettings();if((tinyMCE.isGecko||tinyMCE.isOpera||tinyMCE.isSafari)&&tinyMCE.settings['force_p_newlines']&&e.keyCode==13&&!e.shiftKey){if(TinyMCE_ForceParagraphs._insertPara(tinyMCE.selectedInstance,e)){tinyMCE.execCommand("mceAddUndoLevel");return tinyMCE.cancelEvent(e)}}if((tinyMCE.isGecko&&!tinyMCE.isSafari)&&tinyMCE.settings['force_p_newlines']&&(e.keyCode==8||e.keyCode==46)&&!e.shiftKey){if(TinyMCE_ForceParagraphs._handleBackSpace(tinyMCE.selectedInstance,e.type)){tinyMCE.execCommand("mceAddUndoLevel");return tinyMCE.cancelEvent(e)}}if(tinyMCE.isIE&&tinyMCE.settings['force_br_newlines']&&e.keyCode==13){if(e.target.editorId)tinyMCE.instances[e.target.editorId].select();if(tinyMCE.selectedInstance){var sel=tinyMCE.selectedInstance.getDoc().selection;var rng=sel.createRange();if(tinyMCE.getParentElement(rng.parentElement(),"li")!=null)return false;e.returnValue=false;e.cancelBubble=true;rng.pasteHTML("<br />");rng.collapse(false);rng.select();tinyMCE.execCommand("mceAddUndoLevel");tinyMCE.triggerNodeChange(false);return false}}if(e.keyCode==8||e.keyCode==46){tinyMCE.selectedElement=e.target;tinyMCE.linkElement=tinyMCE.getParentElement(e.target,"a");tinyMCE.imgElement=tinyMCE.getParentElement(e.target,"img");tinyMCE.triggerNodeChange(false)}return false;break;case"keyup":case"keydown":tinyMCE.hideMenus();tinyMCE.hasMouseMoved=false;if(inst&&inst.handleShortcut(e))return false;if(e.target.editorId)tinyMCE.instances[e.target.editorId].select();if(tinyMCE.selectedInstance)tinyMCE.selectedInstance.switchSettings();var inst=tinyMCE.selectedInstance;if(tinyMCE.isGecko&&tinyMCE.settings['force_p_newlines']&&(e.keyCode==8||e.keyCode==46)&&!e.shiftKey){if(TinyMCE_ForceParagraphs._handleBackSpace(tinyMCE.selectedInstance,e.type)){tinyMCE.execCommand("mceAddUndoLevel");e.preventDefault();return false}}tinyMCE.selectedElement=null;tinyMCE.selectedNode=null;var elm=tinyMCE.selectedInstance.getFocusElement();tinyMCE.linkElement=tinyMCE.getParentElement(elm,"a");tinyMCE.imgElement=tinyMCE.getParentElement(elm,"img");tinyMCE.selectedElement=elm;if(tinyMCE.isGecko&&e.type=="keyup"&&e.keyCode==9)tinyMCE.handleVisualAid(tinyMCE.selectedInstance.getBody(),true,tinyMCE.settings['visual'],tinyMCE.selectedInstance);if(tinyMCE.isIE&&e.type=="keydown"&&e.keyCode==13)tinyMCE.enterKeyElement=tinyMCE.selectedInstance.getFocusElement();if(tinyMCE.isIE&&e.type=="keyup"&&e.keyCode==13){var elm=tinyMCE.enterKeyElement;if(elm){var re=new RegExp('^HR|IMG|BR$','g');var dre=new RegExp('^H[1-6]$','g');if(!elm.hasChildNodes()&&!re.test(elm.nodeName)){if(dre.test(elm.nodeName))elm.innerHTML="&nbsp;&nbsp;";else elm.innerHTML="&nbsp;"}}}var keys=tinyMCE.posKeyCodes;var posKey=false;for(var i=0;i<keys.length;i++){if(keys[i]==e.keyCode){posKey=true;break}}if(tinyMCE.isIE&&tinyMCE.settings['custom_undo_redo']){var keys=new Array(8,46);for(var i=0;i<keys.length;i++){if(keys[i]==e.keyCode){if(e.type=="keyup")tinyMCE.triggerNodeChange(false)}}}if(e.keyCode==17)return true;if(tinyMCE.isGecko){if(!posKey&&e.type=="keyup"&&!e.ctrlKey||(e.ctrlKey&&(e.keyCode==86||e.keyCode==88)))tinyMCE.execCommand("mceStartTyping")}else{if(!posKey&&e.type=="keyup")tinyMCE.execCommand("mceStartTyping")}if(e.type=="keydown"&&(posKey||e.ctrlKey)&&inst)inst.undoBookmark=inst.selection.getBookmark();if(e.type=="keyup"&&(posKey||e.ctrlKey))tinyMCE.execCommand("mceEndTyping");if(posKey&&e.type=="keyup")tinyMCE.triggerNodeChange(false);if(tinyMCE.isIE&&e.ctrlKey)window.setTimeout('tinyMCE.triggerNodeChange(false);',1);break;case"mousedown":case"mouseup":case"click":case"dblclick":case"focus":tinyMCE.hideMenus();if(tinyMCE.selectedInstance){tinyMCE.selectedInstance.switchSettings();tinyMCE.selectedInstance.isFocused=true}var targetBody=tinyMCE.getParentElement(e.target,"html");for(var instanceName in tinyMCE.instances){if(!tinyMCE.isInstance(tinyMCE.instances[instanceName]))continue;var inst=tinyMCE.instances[instanceName];inst.autoResetDesignMode();if(inst.getBody().parentNode==targetBody){inst.select();tinyMCE.selectedElement=e.target;tinyMCE.linkElement=tinyMCE.getParentElement(tinyMCE.selectedElement,"a");tinyMCE.imgElement=tinyMCE.getParentElement(tinyMCE.selectedElement,"img");break}}if(!tinyMCE.selectedInstance.undoRedo.undoLevels[0].bookmark&&(e.type=="mouseup"||e.type=="dblclick"))tinyMCE.selectedInstance.undoRedo.undoLevels[0].bookmark=tinyMCE.selectedInstance.selection.getBookmark();if(e.type!="focus")tinyMCE.selectedNode=null;tinyMCE.triggerNodeChange(false);tinyMCE.execCommand("mceEndTyping");if(e.type=="mouseup")tinyMCE.execCommand("mceAddUndoLevel");if(!tinyMCE.selectedInstance&&e.target.editorId)tinyMCE.instances[e.target.editorId].select();return false;break}},getButtonHTML:function(id,lang,img,cmd,ui,val){var h='',m,x,io='';cmd='tinyMCE.execInstanceCommand(\'{$editor_id}\',\''+cmd+'\'';if(typeof(ui)!="undefined"&&ui!=null)cmd+=','+ui;if(typeof(val)!="undefined"&&val!=null)cmd+=",'"+val+"'";cmd+=');';if(tinyMCE.isRealIE)io='onmouseover="tinyMCE.lastHover = this;"';if(tinyMCE.getParam('button_tile_map')&&(!tinyMCE.isIE||tinyMCE.isOpera)&&(m=this.buttonMap[id])!=null&&(tinyMCE.getParam("language")=="en"||img.indexOf('$lang')==-1)){x=0-(m*20)==0?'0':0-(m*20);h+='<a id="{$editor_id}_'+id+'" href="javascript:'+cmd+'" onclick="'+cmd+'return false;" onmousedown="return false;" '+io+' class="mceTiledButton mceButtonNormal" target="_self">';h+='<img src="{$themeurl}/images/spacer.gif" style="background-position: '+x+'px 0" title="{$'+lang+'}" />';h+='</a>'}else{h+='<a id="{$editor_id}_'+id+'" href="javascript:'+cmd+'" onclick="'+cmd+'return false;" onmousedown="return false;" '+io+' class="mceButtonNormal" target="_self">';h+='<img src="'+img+'" title="{$'+lang+'}" />';h+='</a>'}return h},getMenuButtonHTML:function(id,lang,img,mcmd,cmd,ui,val){var h='',m,x;mcmd='tinyMCE.execInstanceCommand(\'{$editor_id}\',\''+mcmd+'\');';cmd='tinyMCE.execInstanceCommand(\'{$editor_id}\',\''+cmd+'\'';if(typeof(ui)!="undefined"&&ui!=null)cmd+=','+ui;if(typeof(val)!="undefined"&&val!=null)cmd+=",'"+val+"'";cmd+=');';if(tinyMCE.getParam('button_tile_map')&&(!tinyMCE.isIE||tinyMCE.isOpera)&&(m=tinyMCE.buttonMap[id])!=null&&(tinyMCE.getParam("language")=="en"||img.indexOf('$lang')==-1)){x=0-(m*20)==0?'0':0-(m*20);if(tinyMCE.isRealIE)h+='<span id="{$editor_id}_'+id+'" class="mceMenuButton" onmouseover="tinyMCE._menuButtonEvent(\'over\',this);tinyMCE.lastHover = this;" onmouseout="tinyMCE._menuButtonEvent(\'out\',this);">';else h+='<span id="{$editor_id}_'+id+'" class="mceMenuButton">';h+='<a href="javascript:'+cmd+'" onclick="'+cmd+'return false;" onmousedown="return false;" class="mceTiledButton mceMenuButtonNormal" target="_self">';h+='<img src="{$themeurl}/images/spacer.gif" style="width: 20px; height: 20px; background-position: '+x+'px 0" title="{$'+lang+'}" /></a>';h+='<a href="javascript:'+mcmd+'" onclick="'+mcmd+'return false;" onmousedown="return false;"><img src="{$themeurl}/images/button_menu.gif" title="{$'+lang+'}" class="mceMenuButton" />';h+='</a></span>'}else{if(tinyMCE.isRealIE)h+='<span id="{$editor_id}_'+id+'" class="mceMenuButton" onmouseover="tinyMCE._menuButtonEvent(\'over\',this);tinyMCE.lastHover = this;" onmouseout="tinyMCE._menuButtonEvent(\'out\',this);">';else h+='<span id="{$editor_id}_'+id+'" class="mceMenuButton">';h+='<a href="javascript:'+cmd+'" onclick="'+cmd+'return false;" onmousedown="return false;" class="mceMenuButtonNormal" target="_self">';h+='<img src="'+img+'" title="{$'+lang+'}" /></a>';h+='<a href="javascript:'+mcmd+'" onclick="'+mcmd+'return false;" onmousedown="return false;"><img src="{$themeurl}/images/button_menu.gif" title="{$'+lang+'}" class="mceMenuButton" />';h+='</a></span>'}return h},_menuButtonEvent:function(e,o){if(o.className=='mceMenuButtonFocus')return;if(e=='over')o.className=o.className+' mceMenuHover';else o.className=o.className.replace(/\s.*$/,'')},addButtonMap:function(m){var i,a=m.replace(/\s+/,'').split(',');for(i=0;i<a.length;i++)this.buttonMap[a[i]]=i},submitPatch:function(){tinyMCE.triggerSave();tinyMCE.isNotDirty=true;this.mceOldSubmit()},onLoad:function(){var r;if(tinyMCE.settings.strict_loading_mode&&this.loadingIndex!=-1){window.setTimeout('tinyMCE.onLoad();',1);return}if(tinyMCE.isRealIE&&window.event.type=="readystatechange"&&document.readyState!="complete")return true;if(tinyMCE.isLoaded)return true;tinyMCE.isLoaded=true;if(tinyMCE.isRealIE&&document.body){r=document.body.createTextRange();r.collapse(true);r.select()}tinyMCE.dispatchCallback(null,'onpageload','onPageLoad');for(var c=0;c<tinyMCE.configs.length;c++){tinyMCE.settings=tinyMCE.configs[c];var selector=tinyMCE.getParam("editor_selector");var deselector=tinyMCE.getParam("editor_deselector");var elementRefAr=new Array();if(document.forms&&tinyMCE.settings['add_form_submit_trigger']&&!tinyMCE.submitTriggers){for(var i=0;i<document.forms.length;i++){var form=document.forms[i];tinyMCE.addEvent(form,"submit",TinyMCE_Engine.prototype.handleEvent);tinyMCE.addEvent(form,"reset",TinyMCE_Engine.prototype.handleEvent);tinyMCE.submitTriggers=true;if(tinyMCE.settings['submit_patch']){try{form.mceOldSubmit=form.submit;form.submit=TinyMCE_Engine.prototype.submitPatch}catch(e){}}}}var mode=tinyMCE.settings['mode'];switch(mode){case"exact":var elements=tinyMCE.getParam('elements','',true,',');for(var i=0;i<elements.length;i++){var element=tinyMCE._getElementById(elements[i]);var trigger=element?element.getAttribute(tinyMCE.settings['textarea_trigger']):"";if(new RegExp('\\b'+deselector+'\\b').test(tinyMCE.getAttrib(element,"class")))continue;if(trigger=="false")continue;if((tinyMCE.settings['ask']||tinyMCE.settings['convert_on_click'])&&element){elementRefAr[elementRefAr.length]=element;continue}if(element)tinyMCE.addMCEControl(element,elements[i]);else if(tinyMCE.settings['debug'])alert("Error: Could not find element by id or name: "+elements[i])}break;case"specific_textareas":case"textareas":var nodeList=document.getElementsByTagName("textarea");for(var i=0;i<nodeList.length;i++){var elm=nodeList.item(i);var trigger=elm.getAttribute(tinyMCE.settings['textarea_trigger']);if(selector!=''&&!new RegExp('\\b'+selector+'\\b').test(tinyMCE.getAttrib(elm,"class")))continue;if(selector!='')trigger=selector!=""?"true":"";if(new RegExp('\\b'+deselector+'\\b').test(tinyMCE.getAttrib(elm,"class")))continue;if((mode=="specific_textareas"&&trigger=="true")||(mode=="textareas"&&trigger!="false"))elementRefAr[elementRefAr.length]=elm}break}for(var i=0;i<elementRefAr.length;i++){var element=elementRefAr[i];var elementId=element.name?element.name:element.id;if(tinyMCE.settings['ask']||tinyMCE.settings['convert_on_click']){if(tinyMCE.isGecko){var settings=tinyMCE.settings;tinyMCE.addEvent(element,"focus",function(e){window.setTimeout(function(){TinyMCE_Engine.prototype.confirmAdd(e,settings)},10)});if(element.nodeName!="TEXTAREA"&&element.nodeName!="INPUT")tinyMCE.addEvent(element,"click",function(e){window.setTimeout(function(){TinyMCE_Engine.prototype.confirmAdd(e,settings)},10)});}else{var settings=tinyMCE.settings;tinyMCE.addEvent(element,"focus",function(){TinyMCE_Engine.prototype.confirmAdd(null,settings)});tinyMCE.addEvent(element,"click",function(){TinyMCE_Engine.prototype.confirmAdd(null,settings)});}}else tinyMCE.addMCEControl(element,elementId)}if(tinyMCE.settings['auto_focus']){window.setTimeout(function(){var inst=tinyMCE.getInstanceById(tinyMCE.settings['auto_focus']);inst.selection.selectNode(inst.getBody(),true,true);inst.contentWindow.focus()},100)}tinyMCE.dispatchCallback(null,'oninit','onInit')}},isInstance:function(o){return o!=null&&typeof(o)=="object"&&o.isTinyMCE_Control},getParam:function(name,default_value,strip_whitespace,split_chr){var value=(typeof(this.settings[name])=="undefined")?default_value:this.settings[name];if(value=="true"||value=="false")return(value=="true");if(strip_whitespace)value=tinyMCE.regexpReplace(value,"[ \t\r\n]","");if(typeof(split_chr)!="undefined"&&split_chr!=null){value=value.split(split_chr);var outArray=new Array();for(var i=0;i<value.length;i++){if(value[i]&&value[i]!="")outArray[outArray.length]=value[i]}value=outArray}return value},getLang:function(name,default_value,parse_entities,va){var v=(typeof(tinyMCELang[name])=="undefined")?default_value:tinyMCELang[name],n;if(parse_entities)v=tinyMCE.entityDecode(v);if(va){for(n in va)v=this.replaceVar(v,n,va[n])}return v},entityDecode:function(s){var e=document.createElement("div");e.innerHTML=s;return e.firstChild.nodeValue},addToLang:function(prefix,ar){for(var key in ar){if(typeof(ar[key])=='function')continue;tinyMCELang[(key.indexOf('lang_')==-1?'lang_':'')+(prefix!=''?(prefix+"_"):'')+key]=ar[key]}this.loadNextScript();},triggerNodeChange:function(focus,setup_content){if(tinyMCE.selectedInstance){var inst=tinyMCE.selectedInstance;var editorId=inst.editorId;var elm=(typeof(setup_content)!="undefined"&&setup_content)?tinyMCE.selectedElement:inst.getFocusElement();var undoIndex=-1,doc;var undoLevels=-1;var anySelection=false;var selectedText=inst.selection.getSelectedText();if(tinyMCE.settings.auto_resize)inst.resizeToContent();if(setup_content&&tinyMCE.isGecko&&inst.isHidden())elm=inst.getBody();inst.switchSettings();if(tinyMCE.selectedElement)anySelection=(tinyMCE.selectedElement.nodeName.toLowerCase()=="img")||(selectedText&&selectedText.length>0);if(tinyMCE.settings['custom_undo_redo']){undoIndex=inst.undoRedo.undoIndex;undoLevels=inst.undoRedo.undoLevels.length}tinyMCE.dispatchCallback(inst,'handle_node_change_callback','handleNodeChange',editorId,elm,undoIndex,undoLevels,inst.visualAid,anySelection,setup_content)}if(this.selectedInstance&&(typeof(focus)=="undefined"||focus))this.selectedInstance.contentWindow.focus()},_customCleanup:function(inst,type,content){var pl,po,i;var customCleanup=tinyMCE.settings['cleanup_callback'];if(customCleanup!=""&&eval("typeof("+customCleanup+")")!="undefined")content=eval(customCleanup+"(type, content, inst);");po=tinyMCE.themes[tinyMCE.settings['theme']];if(po&&po.cleanup)content=po.cleanup(type,content,inst);pl=inst.plugins;for(i=0;i<pl.length;i++){po=tinyMCE.plugins[pl[i]];if(po&&po.cleanup)content=po.cleanup(type,content,inst)}return content},setContent:function(h){if(tinyMCE.selectedInstance){tinyMCE.selectedInstance.execCommand('mceSetContent',false,h);tinyMCE.selectedInstance.repaint()}},importThemeLanguagePack:function(name){if(typeof(name)=="undefined")name=tinyMCE.settings['theme'];tinyMCE.loadScript(tinyMCE.baseURL+'/themes/'+name+'/langs/'+tinyMCE.settings['language']+'.js')},importPluginLanguagePack:function(name){var b=tinyMCE.baseURL+'/plugins/'+name;if(this.plugins[name])b=this.plugins[name].baseURL;tinyMCE.loadScript(b+'/langs/'+tinyMCE.settings['language']+'.js')},applyTemplate:function(h,as){return h.replace(new RegExp('\\{\\$([a-z0-9_]+)\\}','gi'),function(m,s){if(s.indexOf('lang_')==0&&tinyMCELang[s])return tinyMCELang[s];if(as&&as[s])return as[s];if(tinyMCE.settings[s])return tinyMCE.settings[s];if(m=='themeurl')return tinyMCE.themeURL;return m})},replaceVar:function(h,r,v){return h.replace(new RegExp('{\\\$'+r+'}','g'),v)},openWindow:function(template,args){var html,width,height,x,y,resizable,scrollbars,url;args['mce_template_file']=template['file'];args['mce_width']=template['width'];args['mce_height']=template['height'];tinyMCE.windowArgs=args;html=template['html'];if(!(width=parseInt(template['width'])))width=320;if(!(height=parseInt(template['height'])))height=200;if(tinyMCE.isIE)height+=40;else height+=20;x=parseInt(screen.width/ 2.0) - (width /2.0);y=parseInt(screen.height/ 2.0) - (height /2.0);resizable=(args&&args['resizable'])?args['resizable']:"no";scrollbars=(args&&args['scrollbars'])?args['scrollbars']:"no";if(template['file'].charAt(0)!='/'&&template['file'].indexOf('://')==-1)url=tinyMCE.baseURL+"/themes/"+tinyMCE.getParam("theme")+"/"+template['file'];else url=template['file'];for(var name in args){if(typeof(args[name])=='function')continue;url=tinyMCE.replaceVar(url,name,escape(args[name]))}if(html){html=tinyMCE.replaceVar(html,"css",this.settings['popups_css']);html=tinyMCE.applyTemplate(html,args);var win=window.open("","mcePopup"+new Date().getTime(),"top="+y+",left="+x+",scrollbars="+scrollbars+",dialog=yes,minimizable="+resizable+",modal=yes,width="+width+",height="+height+",resizable="+resizable);if(win==null){alert(tinyMCELang['lang_popup_blocked']);return}win.document.write(html);win.document.close();win.resizeTo(width,height);win.focus()}else{if((tinyMCE.isRealIE)&&resizable!='yes'&&tinyMCE.settings["dialog_type"]=="modal"){height+=10;var features="resizable:"+resizable+";scroll:"+scrollbars+";status:yes;center:yes;help:no;dialogWidth:"+width+"px;dialogHeight:"+height+"px;";window.showModalDialog(url,window,features)}else{var modal=(resizable=="yes")?"no":"yes";if(tinyMCE.isGecko&&tinyMCE.isMac)modal="no";if(template['close_previous']!="no")try{tinyMCE.lastWindow.close()}catch(ex){}var win=window.open(url,"mcePopup"+new Date().getTime(),"top="+y+",left="+x+",scrollbars="+scrollbars+",dialog="+modal+",minimizable="+resizable+",modal="+modal+",width="+width+",height="+height+",resizable="+resizable);if(win==null){alert(tinyMCELang['lang_popup_blocked']);return}if(template['close_previous']!="no")tinyMCE.lastWindow=win;eval('try { win.resizeTo(width, height); } catch(e) { }');if(tinyMCE.isGecko){if(win.document.defaultView.statusbar.visible)win.resizeBy(0,tinyMCE.isMac?10:24)}win.focus()}}},closeWindow:function(win){win.close()},getVisualAidClass:function(class_name,state){var aidClass=tinyMCE.settings['visual_table_class'];if(typeof(state)=="undefined")state=tinyMCE.settings['visual'];var classNames=new Array();var ar=class_name.split(' ');for(var i=0;i<ar.length;i++){if(ar[i]==aidClass)ar[i]="";if(ar[i]!="")classNames[classNames.length]=ar[i]}if(state)classNames[classNames.length]=aidClass;var className="";for(var i=0;i<classNames.length;i++){if(i>0)className+=" ";className+=classNames[i]}return className},handleVisualAid:function(el,deep,state,inst,skip_dispatch){if(!el)return;if(!skip_dispatch)tinyMCE.dispatchCallback(inst,'handle_visual_aid_callback','handleVisualAid',el,deep,state,inst);var tableElement=null;switch(el.nodeName){case"TABLE":var oldW=el.style.width;var oldH=el.style.height;var bo=tinyMCE.getAttrib(el,"border");bo=bo==""||bo=="0"?true:false;tinyMCE.setAttrib(el,"class",tinyMCE.getVisualAidClass(tinyMCE.getAttrib(el,"class"),state&&bo));el.style.width=oldW;el.style.height=oldH;for(var y=0;y<el.rows.length;y++){for(var x=0;x<el.rows[y].cells.length;x++){var cn=tinyMCE.getVisualAidClass(tinyMCE.getAttrib(el.rows[y].cells[x],"class"),state&&bo);tinyMCE.setAttrib(el.rows[y].cells[x],"class",cn)}}break;case"A":var anchorName=tinyMCE.getAttrib(el,"name");if(anchorName!=''&&state){el.title=anchorName;tinyMCE.addCSSClass(el,'mceItemAnchor')}else if(anchorName!=''&&!state)el.className='';break}if(deep&&el.hasChildNodes()){for(var i=0;i<el.childNodes.length;i++)tinyMCE.handleVisualAid(el.childNodes[i],deep,state,inst,true)}},fixGeckoBaseHREFBug:function(m,e,h){var xsrc,xhref;if(tinyMCE.isGecko){if(m==1){h=h.replace(/\ssrc=/gi," mce_tsrc=");h=h.replace(/\shref=/gi," mce_thref=");return h}else{if(!new RegExp('(src|href)=','g').test(h))return h;tinyMCE.selectElements(e,'A,IMG,SELECT,AREA,IFRAME,BASE,INPUT,SCRIPT,EMBED,OBJECT,LINK',function(n){xsrc=tinyMCE.getAttrib(n,"mce_tsrc");xhref=tinyMCE.getAttrib(n,"mce_thref");if(xsrc!=""){try{n.src=tinyMCE.convertRelativeToAbsoluteURL(tinyMCE.settings['base_href'],xsrc)}catch(e){}n.removeAttribute("mce_tsrc")}if(xhref!=""){try{n.href=tinyMCE.convertRelativeToAbsoluteURL(tinyMCE.settings['base_href'],xhref)}catch(e){}n.removeAttribute("mce_thref")}return false});tinyMCE.selectNodes(e,function(n){if(n.nodeType==3||n.nodeType==8){n.nodeValue=n.nodeValue.replace(/\smce_tsrc=/gi," src=");n.nodeValue=n.nodeValue.replace(/\smce_thref=/gi," href=")}return false})}}return h},_setHTML:function(doc,html_content){html_content=tinyMCE.cleanupHTMLCode(html_content);try{tinyMCE.setInnerHTML(doc.body,html_content)}catch(e){if(this.isMSIE)doc.body.createTextRange().pasteHTML(html_content)}if(tinyMCE.isIE&&tinyMCE.settings['fix_content_duplication']){var paras=doc.getElementsByTagName("P");for(var i=0;i<paras.length;i++){var node=paras[i];while((node=node.parentNode)!=null){if(node.nodeName=="P")node.outerHTML=node.innerHTML}}var html=doc.body.innerHTML;tinyMCE.setInnerHTML(doc.body,html)}tinyMCE.cleanupAnchors(doc);if(tinyMCE.getParam("convert_fonts_to_spans"))tinyMCE.convertSpansToFonts(doc)},getEditorId:function(form_element){var inst=this.getInstanceById(form_element);if(!inst)return null;return inst.editorId},getInstanceById:function(editor_id){var inst=this.instances[editor_id];if(!inst){for(var n in tinyMCE.instances){var instance=tinyMCE.instances[n];if(!tinyMCE.isInstance(instance))continue;if(instance.formTargetElementId==editor_id){inst=instance;break}}}return inst},queryInstanceCommandValue:function(editor_id,command){var inst=tinyMCE.getInstanceById(editor_id);if(inst)return inst.queryCommandValue(command);return false},queryInstanceCommandState:function(editor_id,command){var inst=tinyMCE.getInstanceById(editor_id);if(inst)return inst.queryCommandState(command);return null},setWindowArg:function(n,v){this.windowArgs[n]=v},getWindowArg:function(n,d){return(typeof(this.windowArgs[n])=="undefined")?d:this.windowArgs[n]},getCSSClasses:function(editor_id,doc){var output=new Array();if(typeof(tinyMCE.cssClasses)!="undefined")return tinyMCE.cssClasses;if(typeof(editor_id)=="undefined"&&typeof(doc)=="undefined"){var instance;for(var instanceName in tinyMCE.instances){instance=tinyMCE.instances[instanceName];if(!tinyMCE.isInstance(instance))continue;break}doc=instance.getDoc()}if(typeof(doc)=="undefined"){var instance=tinyMCE.getInstanceById(editor_id);doc=instance.getDoc()}if(doc){var styles=doc.styleSheets;if(styles&&styles.length>0){for(var x=0;x<styles.length;x++){var csses=null;eval("try {var csses = tinyMCE.isIE ? doc.styleSheets("+x+").rules : styles["+x+"].cssRules;} catch(e) {}");if(!csses)return new Array();for(var i=0;i<csses.length;i++){var selectorText=csses[i].selectorText;if(selectorText){var rules=selectorText.split(',');for(var c=0;c<rules.length;c++){var rule=rules[c];while(rule.indexOf(' ')==0)rule=rule.substring(1);if(rule.indexOf(' ')!=-1||rule.indexOf(':')!=-1||rule.indexOf('mceItem')!=-1)continue;if(rule.indexOf(tinyMCE.settings['visual_table_class'])!=-1||rule.indexOf('mceEditable')!=-1||rule.indexOf('mceNonEditable')!=-1)continue;if(rule.indexOf('.')!=-1){var cssClass=rule.substring(rule.indexOf('.')+1);var addClass=true;for(var p=0;p<output.length&&addClass;p++){if(output[p]==cssClass)addClass=false}if(addClass)output[output.length]=cssClass}}}}}}}if(output.length>0)tinyMCE.cssClasses=output;return output},regexpReplace:function(in_str,reg_exp,replace_str,opts){if(in_str==null)return in_str;if(typeof(opts)=="undefined")opts='g';var re=new RegExp(reg_exp,opts);return in_str.replace(re,replace_str)},trim:function(s){return s.replace(/^\s*|\s*$/g,"")},cleanupEventStr:function(s){s=""+s;s=s.replace('function anonymous()\n{\n','');s=s.replace('\n}','');s=s.replace(/^return true;/gi,'');return s},getControlHTML:function(c){var i,l,n,o,v;l=tinyMCE.plugins;for(n in l){o=l[n];if(o.getControlHTML&&(v=o.getControlHTML(c))!='')return tinyMCE.replaceVar(v,"pluginurl",o.baseURL)}o=tinyMCE.themes[tinyMCE.settings['theme']];if(o.getControlHTML&&(v=o.getControlHTML(c))!='')return v;return''},evalFunc:function(f,idx,a,o){var s='(',i;for(i=idx;i<a.length;i++){s+='a['+i+']';if(i<a.length-1)s+=','}s+=');';return o?eval("o."+f+s):eval("f"+s)},dispatchCallback:function(i,p,n){return this.callFunc(i,p,n,0,this.dispatchCallback.arguments)},executeCallback:function(i,p,n){return this.callFunc(i,p,n,1,this.executeCallback.arguments)},execCommandCallback:function(i,p,n){return this.callFunc(i,p,n,2,this.execCommandCallback.arguments)},callFunc:function(ins,p,n,m,a){var l,i,on,o,s,v;s=m==2;l=tinyMCE.getParam(p,'');if(l!=''&&(v=tinyMCE.evalFunc(typeof(l)=="function"?l:eval(l),3,a))==s&&m>0)return true;if(ins!=null){for(i=0,l=ins.plugins;i<l.length;i++){o=tinyMCE.plugins[l[i]];if(o[n]&&(v=tinyMCE.evalFunc(n,3,a,o))==s&&m>0)return true}}l=tinyMCE.themes;for(on in l){o=l[on];if(o[n]&&(v=tinyMCE.evalFunc(n,3,a,o))==s&&m>0)return true}return false},xmlEncode:function(s){return s?(''+s).replace(new RegExp('[<>&"\']','g'),function(c,b){switch(c){case'&':return'&amp;';case'"':return'&quot;';case'\'':return'&#39;';case'<':return'&lt;';case'>':return'&gt;'}return c}):s},extend:function(p,np){var o={};o.parent=p;for(n in p)o[n]=p[n];for(n in np)o[n]=np[n];return o},hideMenus:function(){var e=tinyMCE.lastSelectedMenuBtn;if(tinyMCE.lastMenu){tinyMCE.lastMenu.hide();tinyMCE.lastMenu=null}if(e){tinyMCE.switchClass(e,tinyMCE.lastMenuBtnClass);tinyMCE.lastSelectedMenuBtn=null}}};var TinyMCE=TinyMCE_Engine;var tinyMCE=new TinyMCE_Engine();var tinyMCELang={};function TinyMCE_Control(settings){var t,i,to,fu,p,x,fn,fu,pn,s=settings;this.undoRedoLevel=true;this.isTinyMCE_Control=true;this.settings=s;this.settings['theme']=tinyMCE.getParam("theme","default");this.settings['width']=tinyMCE.getParam("width",-1);this.settings['height']=tinyMCE.getParam("height",-1);this.selection=new TinyMCE_Selection(this);this.undoRedo=new TinyMCE_UndoRedo(this);this.cleanup=new TinyMCE_Cleanup();this.shortcuts=new Array();this.hasMouseMoved=false;this.foreColor=this.backColor="#999999";this.data={};this.cleanup.init({valid_elements:s.valid_elements,extended_valid_elements:s.extended_valid_elements,valid_child_elements:s.valid_child_elements,entities:s.entities,entity_encoding:s.entity_encoding,debug:s.cleanup_debug,url_converter:'TinyMCE_Cleanup.prototype._urlConverter',indent:s.apply_source_formatting,invalid_elements:s.invalid_elements,verify_html:s.verify_html,fix_content_duplication:s.fix_content_duplication});t=this.settings['theme'];if(!tinyMCE.hasTheme(t)){fn=tinyMCE.callbacks;to={};for(i=0;i<fn.length;i++){if((fu=window['TinyMCE_'+t+"_"+fn[i]]))to[fn[i]]=fu}tinyMCE.addTheme(t,to)}this.plugins=new Array();p=tinyMCE.getParam('plugins','',true,',');if(p.length>0){for(i=0;i<p.length;i++){pn=p[i];if(pn.charAt(0)=='-')pn=pn.substring(1);if(!tinyMCE.hasPlugin(pn)){fn=tinyMCE.callbacks;to={};for(x=0;x<fn.length;x++){if((fu=window['TinyMCE_'+pn+"_"+fn[x]]))to[fn[x]]=fu}tinyMCE.addPlugin(pn,to)}this.plugins[this.plugins.length]=pn}}};TinyMCE_Control.prototype={selection:null,settings:null,cleanup:null,getData:function(na){var o=this.data[na];if(!o)o=this.data[na]={};return o},hasPlugin:function(n){var i;for(i=0;i<this.plugins.length;i++){if(this.plugins[i]==n)return true}return false},addPlugin:function(n,p){if(!this.hasPlugin(n)){tinyMCE.addPlugin(n,p);this.plugins[this.plugins.length]=n}},repaint:function(){var s,b,ex;if(tinyMCE.isRealIE)return;try{s=this.selection;b=s.getBookmark(true);this.getBody().style.display='none';this.getDoc().execCommand('selectall',false,null);this.getSel().collapseToStart();this.getBody().style.display='block';s.moveToBookmark(b)}catch(ex){}},switchSettings:function(){if(tinyMCE.configs.length>1&&tinyMCE.currentConfig!=this.settings['index']){tinyMCE.settings=this.settings;tinyMCE.currentConfig=this.settings['index']}},select:function(){var oldInst=tinyMCE.selectedInstance;if(oldInst!=this){if(oldInst)oldInst.execCommand('mceEndTyping');tinyMCE.dispatchCallback(this,'select_instance_callback','selectInstance',this,oldInst);tinyMCE.selectedInstance=this}},getBody:function(){return this.contentBody?this.contentBody:this.getDoc().body},getDoc:function(){return this.contentWindow.document},getWin:function(){return this.contentWindow},getContainerWin:function(){return this.containerWindow?this.containerWindow:window},getViewPort:function(){return tinyMCE.getViewPort(this.getWin())},getParentNode:function(n,f){return tinyMCE.getParentNode(n,f,this.getBody())},getParentElement:function(n,na,f){return tinyMCE.getParentElement(n,na,f,this.getBody())},getParentBlockElement:function(n){return tinyMCE.getParentBlockElement(n,this.getBody())},resizeToContent:function(){var d=this.getDoc(),b=d.body,de=d.documentElement;this.iframeElement.style.height=(tinyMCE.isRealIE)?b.scrollHeight:de.offsetHeight+'px'},addShortcut:function(m,k,d,cmd,ui,va){var n=typeof(k)=="number",ie=tinyMCE.isIE,c,sc,i,scl=this.shortcuts;if(!tinyMCE.getParam('custom_shortcuts'))return false;m=m.toLowerCase();k=ie&&!n?k.toUpperCase():k;c=n?null:k.charCodeAt(0);d=d&&d.indexOf('lang_')==0?tinyMCE.getLang(d):d;sc={alt:m.indexOf('alt')!=-1,ctrl:m.indexOf('ctrl')!=-1,shift:m.indexOf('shift')!=-1,charCode:c,keyCode:n?k:(ie?c:null),desc:d,cmd:cmd,ui:ui,val:va};for(i=0;i<scl.length;i++){if(sc.alt==scl[i].alt&&sc.ctrl==scl[i].ctrl&&sc.shift==scl[i].shift&&sc.charCode==scl[i].charCode&&sc.keyCode==scl[i].keyCode){return false}}scl[scl.length]=sc;return true},handleShortcut:function(e){var i,s=this.shortcuts,o;for(i=0;i<s.length;i++){o=s[i];if(o.alt==e.altKey&&o.ctrl==e.ctrlKey&&(o.keyCode==e.keyCode||o.charCode==e.charCode)){if(o.cmd&&(e.type=="keydown"||(e.type=="keypress"&&!tinyMCE.isOpera)))tinyMCE.execCommand(o.cmd,o.ui,o.val);tinyMCE.cancelEvent(e);return true}}return false},autoResetDesignMode:function(){if(!tinyMCE.isIE&&this.isHidden()&&tinyMCE.getParam('auto_reset_designmode'))eval('try { this.getDoc().designMode = "On"; this.useCSS = false; } catch(e) {}')},isHidden:function(){var s;if(tinyMCE.isIE)return false;s=this.getSel();return(!s||!s.rangeCount||s.rangeCount==0)},isDirty:function(){return tinyMCE.trim(this.startContent)!=tinyMCE.trim(this.getBody().innerHTML)&&!tinyMCE.isNotDirty},_mergeElements:function(scmd,pa,ch,override){if(scmd=="removeformat"){pa.className="";pa.style.cssText="";ch.className="";ch.style.cssText="";return}var st=tinyMCE.parseStyle(tinyMCE.getAttrib(pa,"style"));var stc=tinyMCE.parseStyle(tinyMCE.getAttrib(ch,"style"));var className=tinyMCE.getAttrib(pa,"class");className=tinyMCE.getAttrib(ch,"class");if(override){for(var n in st){if(typeof(st[n])=='function')continue;stc[n]=st[n]}}else{for(var n in stc){if(typeof(stc[n])=='function')continue;st[n]=stc[n]}}tinyMCE.setAttrib(pa,"style",tinyMCE.serializeStyle(st));tinyMCE.setAttrib(pa,"class",tinyMCE.trim(className));ch.className="";ch.style.cssText="";ch.removeAttribute("class");ch.removeAttribute("style")},_setUseCSS:function(b){var d=this.getDoc();try{d.execCommand("useCSS",false,!b)}catch(ex){}try{d.execCommand("styleWithCSS",false,b)}catch(ex){}if(!tinyMCE.getParam("table_inline_editing"))try{d.execCommand('enableInlineTableEditing',false,"false")}catch(ex){}if(!tinyMCE.getParam("object_resizing"))try{d.execCommand('enableObjectResizing',false,"false")}catch(ex){}},execCommand:function(command,user_interface,value){var doc=this.getDoc(),win=this.getWin(),focusElm=this.getFocusElement();if(!new RegExp('mceStartTyping|mceEndTyping|mceBeginUndoLevel|mceEndUndoLevel|mceAddUndoLevel','gi').test(command))this.undoBookmark=null;if(!tinyMCE.isIE&&!this.useCSS){this._setUseCSS(false);this.useCSS=true}this.contentDocument=doc;if(tinyMCE.execCommandCallback(this,'execcommand_callback','execCommand',this.editorId,this.getBody(),command,user_interface,value))return;if(focusElm&&focusElm.nodeName=="IMG"){var align=focusElm.getAttribute('align');var img=command=="JustifyCenter"?focusElm.cloneNode(false):focusElm;switch(command){case"JustifyLeft":if(align=='left')img.removeAttribute('align');else img.setAttribute('align','left');var div=focusElm.parentNode;if(div&&div.nodeName=="DIV"&&div.childNodes.length==1&&div.parentNode)div.parentNode.replaceChild(img,div);this.selection.selectNode(img);this.repaint();tinyMCE.triggerNodeChange();return;case"JustifyCenter":img.removeAttribute('align');var div=tinyMCE.getParentElement(focusElm,"div");if(div&&div.style.textAlign=="center"){if(div.nodeName=="DIV"&&div.childNodes.length==1&&div.parentNode)div.parentNode.replaceChild(img,div)}else{var div=this.getDoc().createElement("div");div.style.textAlign='center';div.appendChild(img);focusElm.parentNode.replaceChild(div,focusElm)}this.selection.selectNode(img);this.repaint();tinyMCE.triggerNodeChange();return;case"JustifyRight":if(align=='right')img.removeAttribute('align');else img.setAttribute('align','right');var div=focusElm.parentNode;if(div&&div.nodeName=="DIV"&&div.childNodes.length==1&&div.parentNode)div.parentNode.replaceChild(img,div);this.selection.selectNode(img);this.repaint();tinyMCE.triggerNodeChange();return}}if(tinyMCE.settings['force_br_newlines']){var alignValue="";if(doc.selection.type!="Control"){switch(command){case"JustifyLeft":alignValue="left";break;case"JustifyCenter":alignValue="center";break;case"JustifyFull":alignValue="justify";break;case"JustifyRight":alignValue="right";break}if(alignValue!=""){var rng=doc.selection.createRange();if((divElm=tinyMCE.getParentElement(rng.parentElement(),"div"))!=null)divElm.setAttribute("align",alignValue);else if(rng.pasteHTML&&rng.htmlText.length>0)rng.pasteHTML('<div align="'+alignValue+'">'+rng.htmlText+"</div>");tinyMCE.triggerNodeChange();return}}}switch(command){case"mceRepaint":this.repaint();return true;case"unlink":if(tinyMCE.isGecko&&this.getSel().isCollapsed){focusElm=tinyMCE.getParentElement(focusElm,'A');if(focusElm)this.selection.selectNode(focusElm,false)}this.getDoc().execCommand(command,user_interface,value);tinyMCE.isGecko&&this.getSel().collapseToEnd();tinyMCE.triggerNodeChange();return true;case"FormatBlock":if(!this.cleanup.isValid(value))return true;this.getDoc().execCommand(command,user_interface,value);tinyMCE.triggerNodeChange();break;case"InsertUnorderedList":case"InsertOrderedList":this.getDoc().execCommand(command,user_interface,value);tinyMCE.triggerNodeChange();break;case"Strikethrough":this.getDoc().execCommand(command,user_interface,value);tinyMCE.triggerNodeChange();break;case"mceSelectNode":this.selection.selectNode(value);tinyMCE.triggerNodeChange();tinyMCE.selectedNode=value;break;case"FormatBlock":if(value==null||value==""){var elm=tinyMCE.getParentElement(this.getFocusElement(),"p,div,h1,h2,h3,h4,h5,h6,pre,address,blockquote,dt,dl,dd,samp");if(elm)this.execCommand("mceRemoveNode",false,elm)}else{if(tinyMCE.isGecko&&new RegExp('<(div|blockquote|code|dt|dd|dl|samp)>','gi').test(value))value=value.replace(/[^a-z]/gi,'');if(tinyMCE.isIE&&new RegExp('blockquote|code|samp','gi').test(value)){var b=this.selection.getBookmark();this.getDoc().execCommand("FormatBlock",false,'<p>');tinyMCE.renameElement(tinyMCE.getParentBlockElement(this.getFocusElement()),value);this.selection.moveToBookmark(b)}else this.getDoc().execCommand("FormatBlock",false,value)}tinyMCE.triggerNodeChange();break;case"mceRemoveNode":if(!value)value=tinyMCE.getParentElement(this.getFocusElement());if(tinyMCE.isIE){value.outerHTML=value.innerHTML}else{var rng=value.ownerDocument.createRange();rng.setStartBefore(value);rng.setEndAfter(value);rng.deleteContents();rng.insertNode(rng.createContextualFragment(value.innerHTML))}tinyMCE.triggerNodeChange();break;case"mceSelectNodeDepth":var parentNode=this.getFocusElement();for(var i=0;parentNode;i++){if(parentNode.nodeName.toLowerCase()=="body")break;if(parentNode.nodeName.toLowerCase()=="#text"){i--;parentNode=parentNode.parentNode;continue}if(i==value){this.selection.selectNode(parentNode,false);tinyMCE.triggerNodeChange();tinyMCE.selectedNode=parentNode;return}parentNode=parentNode.parentNode}break;case"SetStyleInfo":var rng=this.getRng();var sel=this.getSel();var scmd=value['command'];var sname=value['name'];var svalue=value['value']==null?'':value['value'];var wrapper=value['wrapper']?value['wrapper']:"span";var parentElm=null;var invalidRe=new RegExp("^BODY|HTML$","g");var invalidParentsRe=tinyMCE.settings['merge_styles_invalid_parents']!=''?new RegExp(tinyMCE.settings['merge_styles_invalid_parents'],"gi"):null;if(tinyMCE.isIE){if(rng.item)parentElm=rng.item(0);else{var pelm=rng.parentElement();var prng=doc.selection.createRange();prng.moveToElementText(pelm);if(rng.htmlText==prng.htmlText||rng.boundingWidth==0){if(invalidParentsRe==null||!invalidParentsRe.test(pelm.nodeName))parentElm=pelm}}}else{var felm=this.getFocusElement();if(sel.isCollapsed||(new RegExp('td|tr|tbody|table','gi').test(felm.nodeName)&&sel.anchorNode==felm.parentNode))parentElm=felm}if(parentElm&&!invalidRe.test(parentElm.nodeName)){if(scmd=="setstyle")tinyMCE.setStyleAttrib(parentElm,sname,svalue);if(scmd=="setattrib")tinyMCE.setAttrib(parentElm,sname,svalue);if(scmd=="removeformat"){parentElm.style.cssText='';tinyMCE.setAttrib(parentElm,'class','')}var ch=tinyMCE.getNodeTree(parentElm,new Array(),1);for(var z=0;z<ch.length;z++){if(ch[z]==parentElm)continue;if(scmd=="setstyle")tinyMCE.setStyleAttrib(ch[z],sname,'');if(scmd=="setattrib")tinyMCE.setAttrib(ch[z],sname,'');if(scmd=="removeformat"){ch[z].style.cssText='';tinyMCE.setAttrib(ch[z],'class','')}}}else{this._setUseCSS(false);doc.execCommand("FontName",false,"#mce_temp_font#");var elementArray=tinyMCE.getElementsByAttributeValue(this.getBody(),"font","face","#mce_temp_font#");for(var x=0;x<elementArray.length;x++){elm=elementArray[x];if(elm){var spanElm=doc.createElement(wrapper);if(scmd=="setstyle")tinyMCE.setStyleAttrib(spanElm,sname,svalue);if(scmd=="setattrib")tinyMCE.setAttrib(spanElm,sname,svalue);if(scmd=="removeformat"){spanElm.style.cssText='';tinyMCE.setAttrib(spanElm,'class','')}if(elm.hasChildNodes()){for(var i=0;i<elm.childNodes.length;i++)spanElm.appendChild(elm.childNodes[i].cloneNode(true))}spanElm.setAttribute("mce_new","true");elm.parentNode.replaceChild(spanElm,elm);var ch=tinyMCE.getNodeTree(spanElm,new Array(),1);for(var z=0;z<ch.length;z++){if(ch[z]==spanElm)continue;if(scmd=="setstyle")tinyMCE.setStyleAttrib(ch[z],sname,'');if(scmd=="setattrib")tinyMCE.setAttrib(ch[z],sname,'');if(scmd=="removeformat"){ch[z].style.cssText='';tinyMCE.setAttrib(ch[z],'class','')}}}}}var nodes=doc.getElementsByTagName(wrapper);for(var i=nodes.length-1;i>=0;i--){var elm=nodes[i];var isNew=tinyMCE.getAttrib(elm,"mce_new")=="true";elm.removeAttribute("mce_new");if(elm.childNodes&&elm.childNodes.length==1&&elm.childNodes[0].nodeType==1){this._mergeElements(scmd,elm,elm.childNodes[0],isNew);continue}if(elm.parentNode.childNodes.length==1&&!invalidRe.test(elm.nodeName)&&!invalidRe.test(elm.parentNode.nodeName)){if(invalidParentsRe==null||!invalidParentsRe.test(elm.parentNode.nodeName))this._mergeElements(scmd,elm.parentNode,elm,false)}}var nodes=doc.getElementsByTagName(wrapper);for(var i=nodes.length-1;i>=0;i--){var elm=nodes[i];var isEmpty=true;var tmp=doc.createElement("body");tmp.appendChild(elm.cloneNode(false));tmp.innerHTML=tmp.innerHTML.replace(new RegExp('style=""|class=""','gi'),'');if(new RegExp('<span>','gi').test(tmp.innerHTML)){for(var x=0;x<elm.childNodes.length;x++){if(elm.parentNode!=null)elm.parentNode.insertBefore(elm.childNodes[x].cloneNode(true),elm)}elm.parentNode.removeChild(elm)}}if(scmd=="removeformat")tinyMCE.handleVisualAid(this.getBody(),true,this.visualAid,this);tinyMCE.triggerNodeChange();break;case"FontName":if(value==null){var s=this.getSel();if(tinyMCE.isGecko&&s.isCollapsed){var f=tinyMCE.getParentElement(this.getFocusElement(),"font");if(f!=null)this.selection.selectNode(f,false)}this.getDoc().execCommand("RemoveFormat",false,null);if(f!=null&&tinyMCE.isGecko){var r=this.getRng().cloneRange();r.collapse(true);s.removeAllRanges();s.addRange(r)}}else this.getDoc().execCommand('FontName',false,value);if(tinyMCE.isGecko)window.setTimeout('tinyMCE.triggerNodeChange(false);',1);return;case"FontSize":this.getDoc().execCommand('FontSize',false,value);if(tinyMCE.isGecko)window.setTimeout('tinyMCE.triggerNodeChange(false);',1);return;case"forecolor":value=value==null?this.foreColor:value;value=tinyMCE.trim(value);value=value.charAt(0)!='#'?(isNaN('0x'+value)?value:'#'+value):value;this.foreColor=value;this.getDoc().execCommand('forecolor',false,value);break;case"HiliteColor":value=value==null?this.backColor:value;value=tinyMCE.trim(value);value=value.charAt(0)!='#'?(isNaN('0x'+value)?value:'#'+value):value;this.backColor=value;if(tinyMCE.isGecko){this._setUseCSS(true);this.getDoc().execCommand('hilitecolor',false,value);this._setUseCSS(false)}else this.getDoc().execCommand('BackColor',false,value);break;case"Cut":case"Copy":case"Paste":var cmdFailed=false;eval('try {this.getDoc().execCommand(command, user_interface, value);} catch (e) {cmdFailed = true;}');if(tinyMCE.isOpera&&cmdFailed)alert('Currently not supported by your browser, use keyboard shortcuts instead.');if(tinyMCE.isGecko&&cmdFailed){if(confirm(tinyMCE.entityDecode(tinyMCE.getLang('lang_clipboard_msg'))))window.open('http://www.mozilla.org/editor/midasdemo/securityprefs.html','mceExternal');return}else tinyMCE.triggerNodeChange();break;case"mceSetContent":if(!value)value="";value=tinyMCE.storeAwayURLs(value);value=tinyMCE._customCleanup(this,"insert_to_editor",value);if(this.getBody().nodeName=='BODY')tinyMCE._setHTML(doc,value);else this.getBody().innerHTML=value;tinyMCE.setInnerHTML(this.getBody(),tinyMCE._cleanupHTML(this,doc,this.settings,this.getBody(),false,false,false,true));tinyMCE.convertAllRelativeURLs(this.getBody());tinyMCE._removeInternal(this.getBody());if(tinyMCE.getParam("convert_fonts_to_spans"))tinyMCE.convertSpansToFonts(doc);tinyMCE.handleVisualAid(this.getBody(),true,this.visualAid,this);tinyMCE._setEventsEnabled(this.getBody(),false);return true;case"mceCleanup":var b=this.selection.getBookmark();tinyMCE._setHTML(this.contentDocument,this.getBody().innerHTML);tinyMCE.setInnerHTML(this.getBody(),tinyMCE._cleanupHTML(this,this.contentDocument,this.settings,this.getBody(),this.visualAid));tinyMCE.convertAllRelativeURLs(doc.body);if(tinyMCE.getParam("convert_fonts_to_spans"))tinyMCE.convertSpansToFonts(doc);tinyMCE.handleVisualAid(this.getBody(),true,this.visualAid,this);tinyMCE._setEventsEnabled(this.getBody(),false);this.repaint();this.selection.moveToBookmark(b);tinyMCE.triggerNodeChange();break;case"mceReplaceContent":if(!value)value='';this.getWin().focus();var selectedText="";if(tinyMCE.isIE){var rng=doc.selection.createRange();selectedText=rng.text}else selectedText=this.getSel().toString();if(selectedText.length>0){value=tinyMCE.replaceVar(value,"selection",selectedText);tinyMCE.execCommand('mceInsertContent',false,value)}tinyMCE.triggerNodeChange();break;case"mceSetAttribute":if(typeof(value)=='object'){var targetElms=(typeof(value['targets'])=="undefined")?"p,img,span,div,td,h1,h2,h3,h4,h5,h6,pre,address":value['targets'];var targetNode=tinyMCE.getParentElement(this.getFocusElement(),targetElms);if(targetNode){targetNode.setAttribute(value['name'],value['value']);tinyMCE.triggerNodeChange()}}break;case"mceSetCSSClass":this.execCommand("SetStyleInfo",false,{command:"setattrib",name:"class",value:value});break;case"mceInsertRawHTML":var key='tiny_mce_marker';this.execCommand('mceBeginUndoLevel');this.execCommand('mceInsertContent',false,key);var scrollX=this.getBody().scrollLeft+this.getDoc().documentElement.scrollLeft;var scrollY=this.getBody().scrollTop+this.getDoc().documentElement.scrollTop;var html=this.getBody().innerHTML;if((pos=html.indexOf(key))!=-1)tinyMCE.setInnerHTML(this.getBody(),html.substring(0,pos)+value+html.substring(pos+key.length));this.contentWindow.scrollTo(scrollX,scrollY);this.execCommand('mceEndUndoLevel');break;case"mceInsertContent":if(!value)value='';var insertHTMLFailed=false;if(tinyMCE.isGecko||tinyMCE.isOpera){try{if(value.indexOf('<')==-1&&!value.match(/(&#38;|&#160;|&#60;|&#62;)/g)){var r=this.getRng();var n=this.getDoc().createTextNode(tinyMCE.entityDecode(value));var s=this.getSel();var r2=r.cloneRange();s.removeAllRanges();r.deleteContents();r.insertNode(n);r2.selectNode(n);r2.collapse(false);s.removeAllRanges();s.addRange(r2)}else{value=tinyMCE.fixGeckoBaseHREFBug(1,this.getDoc(),value);this.getDoc().execCommand('inserthtml',false,value);tinyMCE.fixGeckoBaseHREFBug(2,this.getDoc(),value)}}catch(ex){insertHTMLFailed=true}if(!insertHTMLFailed){tinyMCE.triggerNodeChange();return}}if(!tinyMCE.isIE){var isHTML=value.indexOf('<')!=-1;var sel=this.getSel();var rng=this.getRng();if(isHTML){if(tinyMCE.isSafari){var tmpRng=this.getDoc().createRange();tmpRng.setStart(this.getBody(),0);tmpRng.setEnd(this.getBody(),0);value=tmpRng.createContextualFragment(value)}else value=rng.createContextualFragment(value)}else{var el=document.createElement("div");el.innerHTML=value;value=el.firstChild.nodeValue;value=doc.createTextNode(value)}if(tinyMCE.isSafari&&!isHTML){this.execCommand('InsertText',false,value.nodeValue);tinyMCE.triggerNodeChange();return true}else if(tinyMCE.isSafari&&isHTML){rng.deleteContents();rng.insertNode(value);tinyMCE.triggerNodeChange();return true}rng.deleteContents();if(rng.startContainer.nodeType==3){var node=rng.startContainer.splitText(rng.startOffset);node.parentNode.insertBefore(value,node)}else rng.insertNode(value);if(!isHTML){sel.selectAllChildren(doc.body);sel.removeAllRanges();var rng=doc.createRange();rng.selectNode(value);rng.collapse(false);sel.addRange(rng)}else rng.collapse(false);tinyMCE.fixGeckoBaseHREFBug(2,this.getDoc(),value)}else{var rng=doc.selection.createRange(),tmpRng=null;var c=value.indexOf('<!--')!=-1;if(c)value=tinyMCE.uniqueTag+value;if(rng.item)rng.item(0).outerHTML=value;else rng.pasteHTML(value);if(c){var e=this.getDoc().getElementById('mceTMPElement');e.parentNode.removeChild(e)}}tinyMCE.execCommand("mceAddUndoLevel");tinyMCE.triggerNodeChange();break;case"mceStartTyping":if(tinyMCE.settings['custom_undo_redo']&&this.undoRedo.typingUndoIndex==-1){this.undoRedo.typingUndoIndex=this.undoRedo.undoIndex;tinyMCE.typingUndoIndex=tinyMCE.undoIndex;this.execCommand('mceAddUndoLevel')}break;case"mceEndTyping":if(tinyMCE.settings['custom_undo_redo']&&this.undoRedo.typingUndoIndex!=-1){this.execCommand('mceAddUndoLevel');this.undoRedo.typingUndoIndex=-1}tinyMCE.typingUndoIndex=-1;break;case"mceBeginUndoLevel":this.undoRedoLevel=false;break;case"mceEndUndoLevel":this.undoRedoLevel=true;this.execCommand('mceAddUndoLevel');break;case"mceAddUndoLevel":if(tinyMCE.settings['custom_undo_redo']&&this.undoRedoLevel){if(this.undoRedo.add())tinyMCE.triggerNodeChange(false)}break;case"Undo":if(tinyMCE.settings['custom_undo_redo']){tinyMCE.execCommand("mceEndTyping");this.undoRedo.undo();tinyMCE.triggerNodeChange()}else this.getDoc().execCommand(command,user_interface,value);break;case"Redo":if(tinyMCE.settings['custom_undo_redo']){tinyMCE.execCommand("mceEndTyping");this.undoRedo.redo();tinyMCE.triggerNodeChange()}else this.getDoc().execCommand(command,user_interface,value);break;case"mceToggleVisualAid":this.visualAid=!this.visualAid;tinyMCE.handleVisualAid(this.getBody(),true,this.visualAid,this);tinyMCE.triggerNodeChange();break;case"Indent":this.getDoc().execCommand(command,user_interface,value);tinyMCE.triggerNodeChange();if(tinyMCE.isIE){var n=tinyMCE.getParentElement(this.getFocusElement(),"blockquote");do{if(n&&n.nodeName=="BLOCKQUOTE"){n.removeAttribute("dir");n.removeAttribute("style")}}while(n!=null&&(n=n.parentNode)!=null)}break;case"removeformat":var text=this.selection.getSelectedText();if(tinyMCE.isOpera){this.getDoc().execCommand("RemoveFormat",false,null);return}if(tinyMCE.isIE){try{var rng=doc.selection.createRange();rng.execCommand("RemoveFormat",false,null)}catch(e){}this.execCommand("SetStyleInfo",false,{command:"removeformat"})}else{this.getDoc().execCommand(command,user_interface,value);this.execCommand("SetStyleInfo",false,{command:"removeformat"})}if(text.length==0)this.execCommand("mceSetCSSClass",false,"");tinyMCE.triggerNodeChange();break;default:this.getDoc().execCommand(command,user_interface,value);if(tinyMCE.isGecko)window.setTimeout('tinyMCE.triggerNodeChange(false);',1);else tinyMCE.triggerNodeChange()}if(command!="mceAddUndoLevel"&&command!="Undo"&&command!="Redo"&&command!="mceStartTyping"&&command!="mceEndTyping")tinyMCE.execCommand("mceAddUndoLevel")},queryCommandValue:function(c){try{return this.getDoc().queryCommandValue(c)}catch(e){return null}},queryCommandState:function(c){return this.getDoc().queryCommandState(c)},_onAdd:function(replace_element,form_element_name,target_document){var hc,th,to,editorTemplate;th=this.settings['theme'];to=tinyMCE.themes[th];var targetDoc=target_document?target_document:document;this.targetDoc=targetDoc;tinyMCE.themeURL=tinyMCE.baseURL+"/themes/"+this.settings['theme'];this.settings['themeurl']=tinyMCE.themeURL;if(!replace_element){alert("Error: Could not find the target element.");return false}if(to.getEditorTemplate)editorTemplate=to.getEditorTemplate(this.settings,this.editorId);var deltaWidth=editorTemplate['delta_width']?editorTemplate['delta_width']:0;var deltaHeight=editorTemplate['delta_height']?editorTemplate['delta_height']:0;var html='<span id="'+this.editorId+'_parent" class="mceEditorContainer">'+editorTemplate['html'];html=tinyMCE.replaceVar(html,"editor_id",this.editorId);this.settings['default_document']=tinyMCE.baseURL+"/blank.htm";this.settings['old_width']=this.settings['width'];this.settings['old_height']=this.settings['height'];if(this.settings['width']==-1)this.settings['width']=replace_element.offsetWidth;if(this.settings['height']==-1)this.settings['height']=replace_element.offsetHeight;if(this.settings['width']==0)this.settings['width']=replace_element.style.width;if(this.settings['height']==0)this.settings['height']=replace_element.style.height;if(this.settings['width']==0)this.settings['width']=320;if(this.settings['height']==0)this.settings['height']=240;this.settings['area_width']=parseInt(this.settings['width']);this.settings['area_height']=parseInt(this.settings['height']);this.settings['area_width']+=deltaWidth;this.settings['area_height']+=deltaHeight;this.settings['width_style']=""+this.settings['width'];this.settings['height_style']=""+this.settings['height'];if((""+this.settings['width']).indexOf('%')!=-1)this.settings['area_width']="100%";else this.settings['width_style']+='px';if((""+this.settings['height']).indexOf('%')!=-1)this.settings['area_height']="100%";else this.settings['height_style']+='px';if((""+replace_element.style.width).indexOf('%')!=-1){this.settings['width']=replace_element.style.width;this.settings['area_width']="100%";this.settings['width_style']="100%"}if((""+replace_element.style.height).indexOf('%')!=-1){this.settings['height']=replace_element.style.height;this.settings['area_height']="100%";this.settings['height_style']="100%"}html=tinyMCE.applyTemplate(html);this.settings['width']=this.settings['old_width'];this.settings['height']=this.settings['old_height'];this.visualAid=this.settings['visual'];this.formTargetElementId=form_element_name;if(replace_element.nodeName=="TEXTAREA"||replace_element.nodeName=="INPUT")this.startContent=replace_element.value;else this.startContent=replace_element.innerHTML;if(replace_element.nodeName!="TEXTAREA"&&replace_element.nodeName!="INPUT"){this.oldTargetElement=replace_element;if(tinyMCE.settings['debug']){hc='<textarea wrap="off" id="'+form_element_name+'" name="'+form_element_name+'" cols="100" rows="15"></textarea>'}else{hc='<input type="hidden" id="'+form_element_name+'" name="'+form_element_name+'" />';this.oldTargetElement.style.display="none"}html+='</span>';if(tinyMCE.isGecko)html=hc+html;else html+=hc;if(tinyMCE.isGecko){var rng=replace_element.ownerDocument.createRange();rng.setStartBefore(replace_element);var fragment=rng.createContextualFragment(html);tinyMCE.insertAfter(fragment,replace_element)}else replace_element.insertAdjacentHTML("beforeBegin",html)}else{html+='</span>';this.oldTargetElement=replace_element;if(!tinyMCE.settings['debug'])this.oldTargetElement.style.display="none";if(tinyMCE.isGecko){var rng=replace_element.ownerDocument.createRange();rng.setStartBefore(replace_element);var fragment=rng.createContextualFragment(html);tinyMCE.insertAfter(fragment,replace_element)}else replace_element.insertAdjacentHTML("beforeBegin",html)}var dynamicIFrame=false;var tElm=targetDoc.getElementById(this.editorId);if(!tinyMCE.isIE){if(tElm&&(tElm.nodeName=="SPAN"||tElm.nodeName=="span")){tElm=tinyMCE._createIFrame(tElm,targetDoc);dynamicIFrame=true}this.targetElement=tElm;this.iframeElement=tElm;this.contentDocument=tElm.contentDocument;this.contentWindow=tElm.contentWindow;}else{if(tElm&&tElm.nodeName=="SPAN")tElm=tinyMCE._createIFrame(tElm,targetDoc,targetDoc.parentWindow);else tElm=targetDoc.frames[this.editorId];this.targetElement=tElm;this.iframeElement=targetDoc.getElementById(this.editorId);if(tinyMCE.isOpera){this.contentDocument=this.iframeElement.contentDocument;this.contentWindow=this.iframeElement.contentWindow;dynamicIFrame=true}else{this.contentDocument=tElm.window.document;this.contentWindow=tElm.window}this.getDoc().designMode="on"}var doc=this.contentDocument;if(dynamicIFrame){var html=tinyMCE.getParam('doctype')+'<html><head xmlns="http://www.w3.org/1999/xhtml"><base href="'+tinyMCE.settings['base_href']+'" /><title>blank_page</title><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"></head><body class="mceContentBody"></body></html>';try{if(!this.isHidden())this.getDoc().designMode="on";doc.open();doc.write(html);doc.close()}catch(e){this.getDoc().location.href=tinyMCE.baseURL+"/blank.htm"}}if(tinyMCE.isIE)window.setTimeout("tinyMCE.addEventHandlers(tinyMCE.instances[\""+this.editorId+"\"]);",1);tinyMCE.setupContent(this.editorId,true);return true},setBaseHREF:function(u){var h,b,d,nl;d=this.getDoc();nl=d.getElementsByTagName("base");b=nl.length>0?nl[0]:null;if(!b){nl=d.getElementsByTagName("head");h=nl.length>0?nl[0]:null;b=d.createElement("base");b.setAttribute('href',u);h.appendChild(b)}else{if(u==""||u==null)b.parentNode.removeChild(b);else b.setAttribute('href',u)}},getHTML:function(r){var h,d=this.getDoc(),b=this.getBody();if(r)return b.innerHTML;h=tinyMCE._cleanupHTML(this,d,this.settings,b,false,true,false,true);if(tinyMCE.getParam("convert_fonts_to_spans"))tinyMCE.convertSpansToFonts(d);return h},setHTML:function(h){this.execCommand('mceSetContent',false,h);this.repaint()},getFocusElement:function(){return this.selection.getFocusElement()},getSel:function(){return this.selection.getSel()},getRng:function(){return this.selection.getRng()},triggerSave:function(skip_cleanup,skip_callback){var e,nl=[],i,s;this.switchSettings();s=tinyMCE.settings;if(tinyMCE.isRealIE){e=this.iframeElement;do{if(e.style&&e.style.display=='none'){e.style.display='block';nl[nl.length]={elm:e,type:'style'}}if(e.style&&s.hidden_tab_class.length>0&&e.className.indexOf(s.hidden_tab_class)!=-1){e.className=s.display_tab_class;nl[nl.length]={elm:e,type:'class'}}}while((e=e.parentNode)!=null)}tinyMCE.settings['preformatted']=false;if(typeof(skip_cleanup)=="undefined")skip_cleanup=false;if(typeof(skip_callback)=="undefined")skip_callback=false;tinyMCE._setHTML(this.getDoc(),this.getBody().innerHTML);if(this.settings['cleanup']==false){tinyMCE.handleVisualAid(this.getBody(),true,false,this);tinyMCE._setEventsEnabled(this.getBody(),true)}tinyMCE._customCleanup(this,"submit_content_dom",this.contentWindow.document.body);var htm=skip_cleanup?this.getBody().innerHTML:tinyMCE._cleanupHTML(this,this.getDoc(),this.settings,this.getBody(),tinyMCE.visualAid,true,true);htm=tinyMCE._customCleanup(this,"submit_content",htm);if(!skip_callback&&tinyMCE.settings['save_callback']!="")var content=eval(tinyMCE.settings['save_callback']+"(this.formTargetElementId,htm,this.getBody());");if((typeof(content)!="undefined")&&content!=null)htm=content;htm=tinyMCE.regexpReplace(htm,"&#40;","(","gi");htm=tinyMCE.regexpReplace(htm,"&#41;",")","gi");htm=tinyMCE.regexpReplace(htm,"&#59;",";","gi");htm=tinyMCE.regexpReplace(htm,"&#34;","&quot;","gi");htm=tinyMCE.regexpReplace(htm,"&#94;","^","gi");if(this.formElement)this.formElement.value=htm;if(tinyMCE.isSafari&&this.formElement)this.formElement.innerText=htm;for(i=0;i<nl.length;i++){if(nl[i].type=='style')nl[i].elm.style.display='none';else nl[i].elm.className=s.hidden_tab_class}}};TinyMCE_Engine.prototype.cleanupHTMLCode=function(s){s=s.replace(new RegExp('<p \\/>','gi'),'<p>&nbsp;</p>');s=s.replace(new RegExp('<p>\\s*<\\/p>','gi'),'<p>&nbsp;</p>');s=s.replace(new RegExp('<br>\\s*<\\/br>','gi'),'<br />');s=s.replace(new RegExp('<(h[1-6]|p|div|address|pre|form|table|li|ol|ul|td|b|font|em|strong|i|strike|u|span|a|ul|ol|li|blockquote)([a-z]*)([^\\\\|>]*)\\/>','gi'),'<$1$2$3></$1$2>');s=s.replace(new RegExp('\\s+></','gi'),'></');s=s.replace(new RegExp('<(img|br|hr)([^>]*)><\\/(img|br|hr)>','gi'),'<$1$2 />');if(tinyMCE.isIE)s=s.replace(new RegExp('<p><hr \\/><\\/p>','gi'),"<hr>");if(tinyMCE.isIE)s=s.replace(/<!(\s*)\/>/g,'');return s};TinyMCE_Engine.prototype.parseStyle=function(str){var ar=new Array();if(str==null)return ar;var st=str.split(';');tinyMCE.clearArray(ar);for(var i=0;i<st.length;i++){if(st[i]=='')continue;var re=new RegExp('^\\s*([^:]*):\\s*(.*)\\s*$');var pa=st[i].replace(re,'$1||$2').split('||');if(pa.length==2)ar[pa[0].toLowerCase()]=pa[1]}return ar};TinyMCE_Engine.prototype.compressStyle=function(ar,pr,sf,res){var box=new Array();box[0]=ar[pr+'-top'+sf];box[1]=ar[pr+'-left'+sf];box[2]=ar[pr+'-right'+sf];box[3]=ar[pr+'-bottom'+sf];for(var i=0;i<box.length;i++){if(box[i]==null)return;for(var a=0;a<box.length;a++){if(box[a]!=box[i])return}}ar[res]=box[0];ar[pr+'-top'+sf]=null;ar[pr+'-left'+sf]=null;ar[pr+'-right'+sf]=null;ar[pr+'-bottom'+sf]=null};TinyMCE_Engine.prototype.serializeStyle=function(ar){var str="";tinyMCE.compressStyle(ar,"border","","border");tinyMCE.compressStyle(ar,"border","-width","border-width");tinyMCE.compressStyle(ar,"border","-color","border-color");tinyMCE.compressStyle(ar,"border","-style","border-style");tinyMCE.compressStyle(ar,"padding","","padding");tinyMCE.compressStyle(ar,"margin","","margin");for(var key in ar){var val=ar[key];if(typeof(val)=='function')continue;if(key.indexOf('mso-')==0)continue;if(val!=null&&val!=''){val=''+val;val=val.replace(new RegExp("url\\(\\'?([^\\']*)\\'?\\)",'gi'),"url('$1')");if(val.indexOf('url(')!=-1&&tinyMCE.getParam('convert_urls')){var m=new RegExp("url\\('(.*?)'\\)").exec(val);if(m.length>1)val="url('"+eval(tinyMCE.getParam('urlconverter_callback')+"(m[1], null, true);")+"')"}if(tinyMCE.getParam("force_hex_style_colors"))val=tinyMCE.convertRGBToHex(val,true);if(val!="url('')")str+=key.toLowerCase()+": "+val+"; "}}if(new RegExp('; $').test(str))str=str.substring(0,str.length-2);return str};TinyMCE_Engine.prototype.convertRGBToHex=function(s,k){if(s.toLowerCase().indexOf('rgb')!=-1){var re=new RegExp("(.*?)rgb\\s*?\\(\\s*?([0-9]+).*?,\\s*?([0-9]+).*?,\\s*?([0-9]+).*?\\)(.*?)","gi");var rgb=s.replace(re,"$1,$2,$3,$4,$5").split(',');if(rgb.length==5){r=parseInt(rgb[1]).toString(16);g=parseInt(rgb[2]).toString(16);b=parseInt(rgb[3]).toString(16);r=r.length==1?'0'+r:r;g=g.length==1?'0'+g:g;b=b.length==1?'0'+b:b;s="#"+r+g+b;if(k)s=rgb[0]+s+rgb[4]}}return s};TinyMCE_Engine.prototype.convertHexToRGB=function(s){if(s.indexOf('#')!=-1){s=s.replace(new RegExp('[^0-9A-F]','gi'),'');return"rgb("+parseInt(s.substring(0,2),16)+","+parseInt(s.substring(2,4),16)+","+parseInt(s.substring(4,6),16)+")"}return s};TinyMCE_Engine.prototype.convertSpansToFonts=function(doc){var sizes=tinyMCE.getParam('font_size_style_values').replace(/\s+/,'').split(',');var h=doc.body.innerHTML;h=h.replace(/<span/gi,'<font');h=h.replace(/<\/span/gi,'</font');tinyMCE.setInnerHTML(doc.body,h);var s=doc.getElementsByTagName("font");for(var i=0;i<s.length;i++){var size=tinyMCE.trim(s[i].style.fontSize).toLowerCase();var fSize=0;for(var x=0;x<sizes.length;x++){if(sizes[x]==size){fSize=x+1;break}}if(fSize>0){tinyMCE.setAttrib(s[i],'size',fSize);s[i].style.fontSize=''}var fFace=s[i].style.fontFamily;if(fFace!=null&&fFace!=""){tinyMCE.setAttrib(s[i],'face',fFace);s[i].style.fontFamily=''}var fColor=s[i].style.color;if(fColor!=null&&fColor!=""){tinyMCE.setAttrib(s[i],'color',tinyMCE.convertRGBToHex(fColor));s[i].style.color=''}}};TinyMCE_Engine.prototype.convertFontsToSpans=function(doc){var sizes=tinyMCE.getParam('font_size_style_values').replace(/\s+/,'').split(',');var h=doc.body.innerHTML;h=h.replace(/<font/gi,'<span');h=h.replace(/<\/font/gi,'</span');tinyMCE.setInnerHTML(doc.body,h);var fsClasses=tinyMCE.getParam('font_size_classes');if(fsClasses!='')fsClasses=fsClasses.replace(/\s+/,'').split(',');else fsClasses=null;var s=doc.getElementsByTagName("span");for(var i=0;i<s.length;i++){var fSize,fFace,fColor;fSize=tinyMCE.getAttrib(s[i],'size');fFace=tinyMCE.getAttrib(s[i],'face');fColor=tinyMCE.getAttrib(s[i],'color');if(fSize!=""){fSize=parseInt(fSize);if(fSize>0&&fSize<8){if(fsClasses!=null)tinyMCE.setAttrib(s[i],'class',fsClasses[fSize-1]);else s[i].style.fontSize=sizes[fSize-1]}s[i].removeAttribute('size')}if(fFace!=""){s[i].style.fontFamily=fFace;s[i].removeAttribute('face')}if(fColor!=""){s[i].style.color=fColor;s[i].removeAttribute('color')}}};TinyMCE_Engine.prototype.cleanupAnchors=function(doc){var i,cn,x,an=doc.getElementsByTagName("a");for(i=an.length-1;i>=0;i--){if(tinyMCE.getAttrib(an[i],"name")!=""&&tinyMCE.getAttrib(an[i],"href")==""){cn=an[i].childNodes;for(x=cn.length-1;x>=0;x--)tinyMCE.insertAfter(cn[x],an[i])}}};TinyMCE_Engine.prototype.getContent=function(editor_id){if(typeof(editor_id)!="undefined")tinyMCE.getInstanceById(editor_id).select();if(tinyMCE.selectedInstance)return tinyMCE.selectedInstance.getHTML();return null};TinyMCE_Engine.prototype._fixListElements=function(d){var nl,x,a=['ol','ul'],i,n,p,r=new RegExp('^(OL|UL)$'),np;for(x=0;x<a.length;x++){nl=d.getElementsByTagName(a[x]);for(i=0;i<nl.length;i++){n=nl[i];p=n.parentNode;if(r.test(p.nodeName)){np=tinyMCE.prevNode(n,'LI');if(!np){np=d.createElement('li');np.innerHTML='&nbsp;';np.appendChild(n);p.insertBefore(np,p.firstChild)}else np.appendChild(n)}}}};TinyMCE_Engine.prototype._fixTables=function(d){var nl,i,n,p,np,x,t;nl=d.getElementsByTagName('table');for(i=0;i<nl.length;i++){n=nl[i];if((p=tinyMCE.getParentElement(n,'p,div,h1,h2,h3,h4,h5,h6'))!=null){np=p.cloneNode(false);np.removeAttribute('id');t=n;while((n=n.nextSibling))np.appendChild(n);tinyMCE.insertAfter(np,p);tinyMCE.insertAfter(t,p)}}};TinyMCE_Engine.prototype._cleanupHTML=function(inst,doc,config,elm,visual,on_save,on_submit,inn){var h,d,t1,t2,t3,t4,t5,c,s,nb;if(!tinyMCE.getParam('cleanup'))return elm.innerHTML;on_save=typeof(on_save)=='undefined'?false:on_save;c=inst.cleanup;s=inst.settings;d=c.settings.debug;if(d)t1=new Date().getTime();if(tinyMCE.getParam("convert_fonts_to_spans"))tinyMCE.convertFontsToSpans(doc);if(tinyMCE.getParam("fix_list_elements"))tinyMCE._fixListElements(doc);if(tinyMCE.getParam("fix_table_elements"))tinyMCE._fixTables(doc);tinyMCE._customCleanup(inst,on_save?"get_from_editor_dom":"insert_to_editor_dom",doc.body);if(d)t2=new Date().getTime();c.settings.on_save=on_save;c.idCount=0;c.serializationId++;c.serializedNodes=new Array();c.sourceIndex=-1;if(s.cleanup_serializer=="xml")h=c.serializeNodeAsXML(elm,inn);else h=c.serializeNodeAsHTML(elm,inn);if(d)t3=new Date().getTime();nb=tinyMCE.getParam('entity_encoding')=='numeric'?'&#160;':'&nbsp;';h=h.replace(/<\/?(body|head|html)[^>]*>/gi,'');h=h.replace(new RegExp(' (rowspan="1"|colspan="1")','g'),'');h=h.replace(/<p><hr \/><\/p>/g,'<hr />');h=h.replace(/<p>(&nbsp;|&#160;)<\/p><hr \/><p>(&nbsp;|&#160;)<\/p>/g,'<hr />');h=h.replace(/<td>\s*<br \/>\s*<\/td>/g,'<td>'+nb+'</td>');h=h.replace(/<p>\s*<br \/>\s*<\/p>/g,'<p>'+nb+'</p>');h=h.replace(/<br \/>$/,'');h=h.replace(/<br \/><\/p>/g,'</p>');h=h.replace(/<p>\s*(&nbsp;|&#160;)\s*<br \/>\s*(&nbsp;|&#160;)\s*<\/p>/g,'<p>'+nb+'</p>');h=h.replace(/<p>\s*(&nbsp;|&#160;)\s*<br \/>\s*<\/p>/g,'<p>'+nb+'</p>');h=h.replace(/<p>\s*<br \/>\s*&nbsp;\s*<\/p>/g,'<p>'+nb+'</p>');h=h.replace(new RegExp('<a>(.*?)<\\/a>','g'),'$1');h=h.replace(/<p([^>]*)>\s*<\/p>/g,'<p$1>'+nb+'</p>');if(/^\s*(<br \/>|<p>&nbsp;<\/p>|<p>&#160;<\/p>|<p><\/p>)\s*$/.test(h))h='';if(s.preformatted){h=h.replace(/^<pre>/,'');h=h.replace(/<\/pre>$/,'');h='<pre>'+h+'</pre>'}if(tinyMCE.isGecko){h=h.replace(/<o:p _moz-userdefined="" \/>/g,'');h=h.replace(/<td([^>]*)>\s*<br \/>\s*<\/td>/g,'<td$1>'+nb+'</td>')}if(s.force_br_newlines)h=h.replace(/<p>(&nbsp;|&#160;)<\/p>/g,'<br />');h=tinyMCE._customCleanup(inst,on_save?"get_from_editor":"insert_to_editor",h);if(on_save){h=h.replace(new RegExp(' ?(mceItem[a-zA-Z0-9]*|'+s.visual_table_class+')','g'),'');h=h.replace(new RegExp(' ?class=""','g'),'')}if(s.remove_linebreaks&&!c.settings.indent)h=h.replace(/\n|\r/g,' ');if(d)t4=new Date().getTime();if(on_save&&c.settings.indent)h=c.formatHTML(h);if(on_submit&&(s.encoding=="xml"||s.encoding=="html"))h=c.xmlEncode(h);if(d)t5=new Date().getTime();if(c.settings.debug)tinyMCE.debug("Cleanup in ms: Pre="+(t2-t1)+", Serialize: "+(t3-t2)+", Post: "+(t4-t3)+", Format: "+(t5-t4)+", Sum: "+(t5-t1)+".");return h};function TinyMCE_Cleanup(){this.isIE=(navigator.appName=="Microsoft Internet Explorer");this.rules=tinyMCE.clearArray(new Array());this.settings={indent_elements:'head,table,tbody,thead,tfoot,form,tr,ul,ol,blockquote,object',newline_before_elements:'h1,h2,h3,h4,h5,h6,pre,address,div,ul,ol,li,meta,option,area,title,link,base,script,td',newline_after_elements:'br,hr,p,pre,address,div,ul,ol,meta,option,area,link,base,script',newline_before_after_elements:'html,head,body,table,thead,tbody,tfoot,tr,form,ul,ol,blockquote,p,object,param,hr,div',indent_char:'\t',indent_levels:1,entity_encoding:'raw',valid_elements:'*[*]',entities:'',url_converter:'',invalid_elements:'',verify_html:false};this.vElements=tinyMCE.clearArray(new Array());this.vElementsRe='';this.closeElementsRe=/^(IMG|BR|HR|LINK|META|BASE|INPUT|AREA)$/;this.codeElementsRe=/^(SCRIPT|STYLE)$/;this.serializationId=0;this.mceAttribs={href:'mce_href',src:'mce_src',type:'mce_type'}}TinyMCE_Cleanup.prototype={init:function(s){var n,a,i,ir,or,st;for(n in s)this.settings[n]=s[n];s=this.settings;this.inRe=this._arrayToRe(s.indent_elements.split(','),'','^<(',')[^>]*');this.ouRe=this._arrayToRe(s.indent_elements.split(','),'','^<\\/(',')[^>]*');this.nlBeforeRe=this._arrayToRe(s.newline_before_elements.split(','),'gi','<(',')([^>]*)>');this.nlAfterRe=this._arrayToRe(s.newline_after_elements.split(','),'gi','<(',')([^>]*)>');this.nlBeforeAfterRe=this._arrayToRe(s.newline_before_after_elements.split(','),'gi','<(\\/?)(',')([^>]*)>');this.serializedNodes=[];if(s.invalid_elements!='')this.iveRe=this._arrayToRe(s.invalid_elements.toUpperCase().split(','),'g','^(',')$');else this.iveRe=null;st='';for(i=0;i<s.indent_levels;i++)st+=s.indent_char;this.inStr=st;if(!s.verify_html){s.valid_elements='*[*]';s.extended_valid_elements=''}this.fillStr=s.entity_encoding=="named"?"&nbsp;":"&#160;";this.idCount=0},addRuleStr:function(s){var r=this.parseRuleStr(s);var n;for(n in r){if(r[n])this.rules[n]=r[n]}this.vElements=tinyMCE.clearArray(new Array());for(n in this.rules){if(this.rules[n])this.vElements[this.vElements.length]=this.rules[n].tag}this.vElementsRe=this._arrayToRe(this.vElements,'')},isValid:function(n){this._setupRules();n=n.replace(/[^a-z0-9]+/gi,'').toUpperCase();return!tinyMCE.getParam('cleanup')||this.vElementsRe.test(n)},addChildRemoveRuleStr:function(s){var x,y,p,i,t,tn,ta,cl,r;if(!s)return;ta=s.split(',');for(x=0;x<ta.length;x++){s=ta[x];p=this.split(/\[|\]/,s);if(p==null||p.length<1)t=s.toUpperCase();else t=p[0].toUpperCase();tn=this.split('/',t);for(y=0;y<tn.length;y++){r="^(";cl=this.split(/\|/,p[1]);for(i=0;i<cl.length;i++){if(cl[i]=='%istrict')r+=tinyMCE.inlineStrict;else if(cl[i]=='%itrans')r+=tinyMCE.inlineTransitional;else if(cl[i]=='%istrict_na')r+=tinyMCE.inlineStrict.substring(2);else if(cl[i]=='%itrans_na')r+=tinyMCE.inlineTransitional.substring(2);else if(cl[i]=='%btrans')r+=tinyMCE.blockElms;else if(cl[i]=='%strict')r+=tinyMCE.blockStrict;else r+=(cl[i].charAt(0)!='#'?cl[i].toUpperCase():cl[i]);r+=(i!=cl.length-1?'|':'')}r+=')$';if(this.childRules==null)this.childRules=tinyMCE.clearArray(new Array());this.childRules[tn[y]]=new RegExp(r);if(p.length>1)this.childRules[tn[y]].wrapTag=p[2]}}},parseRuleStr:function(s){var ta,p,r,a,i,x,px,t,tn,y,av,or=tinyMCE.clearArray(new Array()),dv;if(s==null||s.length==0)return or;ta=s.split(',');for(x=0;x<ta.length;x++){s=ta[x];if(s.length==0)continue;p=this.split(/\[|\]/,s);if(p==null||p.length<1)t=s.toUpperCase();else t=p[0].toUpperCase();tn=this.split('/',t);for(y=0;y<tn.length;y++){r={};r.tag=tn[y];r.forceAttribs=null;r.defaultAttribs=null;r.validAttribValues=null;px=r.tag.charAt(0);r.forceOpen=px=='+';r.removeEmpty=px=='-';r.fill=px=='#';r.tag=r.tag.replace(/\+|-|#/g,'');r.oTagName=tn[0].replace(/\+|-|#/g,'').toLowerCase();r.isWild=new RegExp('\\*|\\?|\\+','g').test(r.tag);r.validRe=new RegExp(this._wildcardToRe('^'+r.tag+'$'));if(p.length>1){r.vAttribsRe='^(';a=this.split(/\|/,p[1]);for(i=0;i<a.length;i++){t=a[i];if(t.charAt(0)=='!'){a[i]=t=t.substring(1);if(!r.reqAttribsRe)r.reqAttribsRe='\\s+('+t;else r.reqAttribsRe+='|'+t}av=new RegExp('(=|:|<)(.*?)$').exec(t);t=t.replace(new RegExp('(=|:|<).*?$'),'');if(av&&av.length>0){if(av[0].charAt(0)==':'){if(!r.forceAttribs)r.forceAttribs=tinyMCE.clearArray(new Array());r.forceAttribs[t.toLowerCase()]=av[0].substring(1)}else if(av[0].charAt(0)=='='){if(!r.defaultAttribs)r.defaultAttribs=tinyMCE.clearArray(new Array());dv=av[0].substring(1);r.defaultAttribs[t.toLowerCase()]=dv==""?"mce_empty":dv}else if(av[0].charAt(0)=='<'){if(!r.validAttribValues)r.validAttribValues=tinyMCE.clearArray(new Array());r.validAttribValues[t.toLowerCase()]=this._arrayToRe(this.split('?',av[0].substring(1)),'i')}}r.vAttribsRe+=''+t.toLowerCase()+(i!=a.length-1?'|':'');a[i]=t.toLowerCase()}if(r.reqAttribsRe)r.reqAttribsRe=new RegExp(r.reqAttribsRe+')=\"','g');r.vAttribsRe+=')$';r.vAttribsRe=this._wildcardToRe(r.vAttribsRe);r.vAttribsReIsWild=new RegExp('\\*|\\?|\\+','g').test(r.vAttribsRe);r.vAttribsRe=new RegExp(r.vAttribsRe);r.vAttribs=a.reverse();}else{r.vAttribsRe='';r.vAttribs=tinyMCE.clearArray(new Array());r.vAttribsReIsWild=false}or[r.tag]=r}}return or},serializeNodeAsXML:function(n){var s,b;if(!this.xmlDoc){if(this.isIE){try{this.xmlDoc=new ActiveXObject('MSXML2.DOMDocument')}catch(e){}if(!this.xmlDoc)try{this.xmlDoc=new ActiveXObject('Microsoft.XmlDom')}catch(e){}}else this.xmlDoc=document.implementation.createDocument('','',null);if(!this.xmlDoc)alert("Error XML Parser could not be found.")}if(this.xmlDoc.firstChild)this.xmlDoc.removeChild(this.xmlDoc.firstChild);b=this.xmlDoc.createElement("html");b=this.xmlDoc.appendChild(b);this._convertToXML(n,b);if(this.isIE)return this.xmlDoc.xml;else return new XMLSerializer().serializeToString(this.xmlDoc)},_convertToXML:function(n,xn){var xd,el,i,l,cn,at,no,hc=false;if(this._isDuplicate(n))return;xd=this.xmlDoc;switch(n.nodeType){case 1:hc=n.hasChildNodes();el=xd.createElement(n.nodeName.toLowerCase());at=n.attributes;for(i=at.length-1;i>-1;i--){no=at[i];if(no.specified&&no.nodeValue)el.setAttribute(no.nodeName.toLowerCase(),no.nodeValue)}if(!hc&&!this.closeElementsRe.test(n.nodeName))el.appendChild(xd.createTextNode(""));xn=xn.appendChild(el);break;case 3:xn.appendChild(xd.createTextNode(n.nodeValue));return;case 8:xn.appendChild(xd.createComment(n.nodeValue));return}if(hc){cn=n.childNodes;for(i=0,l=cn.length;i<l;i++)this._convertToXML(cn[i],xn)}},serializeNodeAsHTML:function(n,inn){var en,no,h='',i,l,t,st,r,cn,va=false,f=false,at,hc,cr;this._setupRules();if(this._isDuplicate(n))return'';if(n.parentNode&&this.childRules!=null){cr=this.childRules[n.parentNode.nodeName];if(typeof(cr)!="undefined"&&!cr.test(n.nodeName)){st=true;t=null}}switch(n.nodeType){case 1:hc=n.hasChildNodes();if(st)break;if((tinyMCE.isRealIE)&&n.nodeName.indexOf('/')!=-1)break;if(this.vElementsRe.test(n.nodeName)&&(!this.iveRe||!this.iveRe.test(n.nodeName))&&!inn){va=true;r=this.rules[n.nodeName];if(!r){at=this.rules;for(no in at){if(at[no]&&at[no].validRe.test(n.nodeName)){r=at[no];break}}}en=r.isWild?n.nodeName.toLowerCase():r.oTagName;f=r.fill;if(r.removeEmpty&&!hc)return"";t='<'+en;if(r.vAttribsReIsWild){at=n.attributes;for(i=at.length-1;i>-1;i--){no=at[i];if(no.specified&&r.vAttribsRe.test(no.nodeName))t+=this._serializeAttribute(n,r,no.nodeName)}}else{for(i=r.vAttribs.length-1;i>-1;i--)t+=this._serializeAttribute(n,r,r.vAttribs[i])}if(!this.settings.on_save){at=this.mceAttribs;for(no in at){if(at[no])t+=this._serializeAttribute(n,r,at[no])}}if(r.reqAttribsRe&&!t.match(r.reqAttribsRe))t=null;if(t!=null&&this.closeElementsRe.test(n.nodeName))return t+' />';if(t!=null)h+=t+'>';if(this.isIE&&this.codeElementsRe.test(n.nodeName))h+=n.innerHTML}break;case 3:if(st)break;if(n.parentNode&&this.codeElementsRe.test(n.parentNode.nodeName))return this.isIE?'':n.nodeValue;return this.xmlEncode(n.nodeValue);case 8:if(st)break;return"<!--"+this._trimComment(n.nodeValue)+"-->"}if(hc){cn=n.childNodes;for(i=0,l=cn.length;i<l;i++)h+=this.serializeNodeAsHTML(cn[i])}if(f&&!hc)h+=this.fillStr;if(t!=null&&va)h+='</'+en+'>';return h},_serializeAttribute:function(n,r,an){var av='',t,os=this.settings.on_save;if(os&&(an.indexOf('mce_')==0||an.indexOf('_moz')==0))return'';if(os&&this.mceAttribs[an])av=this._getAttrib(n,this.mceAttribs[an]);if(av.length==0)av=this._getAttrib(n,an);if(av.length==0&&r.defaultAttribs&&(t=r.defaultAttribs[an])){av=t;if(av=="mce_empty")return" "+an+'=""'}if(r.forceAttribs&&(t=r.forceAttribs[an]))av=t;if(os&&av.length!=0&&this.settings.url_converter.length!=0&&/^(src|href|longdesc)$/.test(an))av=eval(this.settings.url_converter+'(this, n, av)');if(av.length!=0&&r.validAttribValues&&r.validAttribValues[an]&&!r.validAttribValues[an].test(av))return"";if(av.length!=0&&av=="{$uid}")av="uid_"+(this.idCount++);if(av.length!=0){if(an.indexOf('on')!=0)av=this.xmlEncode(av);return" "+an+"="+'"'+av+'"'}return""},formatHTML:function(h){var s=this.settings,p='',i=0,li=0,o='',l;h=h.replace(/<pre([^>]*)>(.*?)<\/pre>/gi,function(a,b,c){c=c.replace(/<br\s*\/>/gi,'\n');return'<pre'+b+'>'+c+'</pre>'});h=h.replace(/\r/g,'');h='\n'+h;h=h.replace(new RegExp('\\n\\s+','gi'),'\n');h=h.replace(this.nlBeforeRe,'\n<$1$2>');h=h.replace(this.nlAfterRe,'<$1$2>\n');h=h.replace(this.nlBeforeAfterRe,'\n<$1$2$3>\n');h+='\n';while((i=h.indexOf('\n',i+1))!=-1){if((l=h.substring(li+1,i)).length!=0){if(this.ouRe.test(l)&&p.length>=s.indent_levels)p=p.substring(s.indent_levels);o+=p+l+'\n';if(this.inRe.test(l))p+=this.inStr}li=i}return o},xmlEncode:function(s){var cl=this;this._setupEntities();switch(this.settings.entity_encoding){case"raw":return tinyMCE.xmlEncode(s);case"named":return s.replace(new RegExp('[\u007F-\uFFFF<>&"\']','g'),function(c,b){b=cl.entities[c.charCodeAt(0)];return b?'&'+b+';':c});case"numeric":return s.replace(new RegExp('[\u007F-\uFFFF<>&"\']','g'),function(c,b){return b?'&#'+c.charCodeAt(0)+';':c})}return s},split:function(re,s){var c=s.split(re);var i,l,o=new Array();for(i=0,l=c.length;i<l;i++){if(c[i]!='')o[i]=c[i]}return o},_trimComment:function(s){s=s.replace(new RegExp('\\smce_src=\"[^\"]*\"','gi'),"");s=s.replace(new RegExp('\\smce_href=\"[^\"]*\"','gi'),"");return s},_getAttrib:function(e,n,d){if(typeof(d)=="undefined")d="";if(!e||e.nodeType!=1)return d;var v=e.getAttribute(n,0);if(n=="class"&&!v)v=e.className;if(this.isIE&&n=="http-equiv")v=e.httpEquiv;if(this.isIE&&e.nodeName=="FORM"&&n=="enctype"&&v=="application/x-www-form-urlencoded")v="";if(this.isIE&&e.nodeName=="INPUT"&&n=="size"&&v=="20")v="";if(this.isIE&&e.nodeName=="INPUT"&&n=="maxlength"&&v=="2147483647")v="";if(n=="style"&&!tinyMCE.isOpera)v=e.style.cssText;if(n=='style')v=tinyMCE.serializeStyle(tinyMCE.parseStyle(v));if(this.settings.on_save&&n.indexOf('on')!=-1&&this.settings.on_save&&v&&v!="")v=tinyMCE.cleanupEventStr(v);return(v&&v!="")?''+v:d},_urlConverter:function(c,n,v){if(!c.settings.on_save)return tinyMCE.convertRelativeToAbsoluteURL(tinyMCE.settings.base_href,v);else if(tinyMCE.getParam('convert_urls'))return eval(tinyMCE.settings.urlconverter_callback+"(v, n, true);");return v},_arrayToRe:function(a,op,be,af){var i,r;op=typeof(op)=="undefined"?"gi":op;be=typeof(be)=="undefined"?"^(":be;af=typeof(af)=="undefined"?")$":af;r=be;for(i=0;i<a.length;i++)r+=this._wildcardToRe(a[i])+(i!=a.length-1?"|":"");r+=af;return new RegExp(r,op)},_wildcardToRe:function(s){s=s.replace(/\?/g,'(\\S?)');s=s.replace(/\+/g,'(\\S+)');s=s.replace(/\*/g,'(\\S*)');return s},_setupEntities:function(){var n,a,i,s=this.settings;if(!this.entitiesDone){if(s.entity_encoding=="named"){n=tinyMCE.clearArray(new Array());a=this.split(',',s.entities);for(i=0;i<a.length;i+=2)n[a[i]]=a[i+1];this.entities=n}this.entitiesDone=true}},_setupRules:function(){var s=this.settings;if(!this.rulesDone){this.addRuleStr(s.valid_elements);this.addRuleStr(s.extended_valid_elements);this.addChildRemoveRuleStr(s.valid_child_elements);this.rulesDone=true}},_isDuplicate:function(n){var i;if(!this.settings.fix_content_duplication)return false;if(tinyMCE.isRealIE&&n.nodeType==1){if(n.mce_serialized==this.serializationId)return true;n.setAttribute('mce_serialized',this.serializationId)}else{for(i=0;i<this.serializedNodes.length;i++){if(this.serializedNodes[i]==n)return true}this.serializedNodes[this.serializedNodes.length]=n}return false}};TinyMCE_Engine.prototype.createTagHTML=function(tn,a,h){var o='',f=tinyMCE.xmlEncode;o='<'+tn;if(a){for(n in a){if(typeof(a[n])!='function'&&a[n]!=null)o+=' '+f(n)+'="'+f(''+a[n])+'"'}}o+=!h?' />':'>'+h+'</'+tn+'>';return o};TinyMCE_Engine.prototype.createTag=function(d,tn,a,h){var o=d.createElement(tn);if(a){for(n in a){if(typeof(a[n])!='function'&&a[n]!=null)tinyMCE.setAttrib(o,n,a[n])}}if(h)o.innerHTML=h;return o};TinyMCE_Engine.prototype.getElementByAttributeValue=function(n,e,a,v){return(n=this.getElementsByAttributeValue(n,e,a,v)).length==0?null:n[0]};TinyMCE_Engine.prototype.getElementsByAttributeValue=function(n,e,a,v){var i,nl=n.getElementsByTagName(e),o=new Array();for(i=0;i<nl.length;i++){if(tinyMCE.getAttrib(nl[i],a).indexOf(v)!=-1)o[o.length]=nl[i]}return o};TinyMCE_Engine.prototype.isBlockElement=function(n){return n!=null&&n.nodeType==1&&this.blockRegExp.test(n.nodeName)};TinyMCE_Engine.prototype.getParentBlockElement=function(n,r){return this.getParentNode(n,function(n){return tinyMCE.isBlockElement(n)},r);return null};TinyMCE_Engine.prototype.insertAfter=function(n,r){if(r.nextSibling)r.parentNode.insertBefore(n,r.nextSibling);else r.parentNode.appendChild(n)};TinyMCE_Engine.prototype.setInnerHTML=function(e,h){var i,nl,n;if(tinyMCE.isGecko){h=h.replace(/<strong/gi,'<b');h=h.replace(/<em(\/?)/gi,'<i');h=h.replace(/<em /gi,'<i');h=h.replace(/<\/strong>/gi,'</b>');h=h.replace(/<\/em>/gi,'</i>')}if(tinyMCE.isRealIE){h=h.replace(/\s\/>/g,'>');h=h.replace(/<p([^>]*)>\u00A0?<\/p>/gi,'<p$1 mce_keep="true">&nbsp;</p>');h=h.replace(/<p([^>]*)>\s*&nbsp;\s*<\/p>/gi,'<p$1 mce_keep="true">&nbsp;</p>');h=h.replace(/<p([^>]*)>\s+<\/p>/gi,'<p$1 mce_keep="true">&nbsp;</p>');e.innerHTML=tinyMCE.uniqueTag+h;e.firstChild.removeNode(true);nl=e.getElementsByTagName("p");for(i=nl.length-1;i>=0;i--){n=nl[i];if(n.nodeName=='P'&&!n.hasChildNodes()&&!n.mce_keep)n.parentNode.removeChild(n)}}else{h=this.fixGeckoBaseHREFBug(1,e,h);e.innerHTML=h;this.fixGeckoBaseHREFBug(2,e,h)}};TinyMCE_Engine.prototype.getOuterHTML=function(e){if(tinyMCE.isIE)return e.outerHTML;var d=e.ownerDocument.createElement("body");d.appendChild(e.cloneNode(true));return d.innerHTML};TinyMCE_Engine.prototype.setOuterHTML=function(e,h,d){var d=typeof(d)=="undefined"?e.ownerDocument:d,i,nl,t;if(tinyMCE.isIE&&e.nodeType==1)e.outerHTML=h;else{t=d.createElement("body");t.innerHTML=h;for(i=0,nl=t.childNodes;i<nl.length;i++)e.parentNode.insertBefore(nl[i].cloneNode(true),e);e.parentNode.removeChild(e)}};TinyMCE_Engine.prototype._getElementById=function(id,d){var e,i,j,f;if(typeof(d)=="undefined")d=document;e=d.getElementById(id);if(!e){f=d.forms;for(i=0;i<f.length;i++){for(j=0;j<f[i].elements.length;j++){if(f[i].elements[j].name==id){e=f[i].elements[j];break}}}}return e};TinyMCE_Engine.prototype.getNodeTree=function(n,na,t,nn){return this.selectNodes(n,function(n){return(!t||n.nodeType==t)&&(!nn||n.nodeName==nn)},na?na:new Array())};TinyMCE_Engine.prototype.getParentElement=function(n,na,f,r){var re=na?new RegExp('^('+na.toUpperCase().replace(/,/g,'|')+')$'):0,v;if(f&&typeof(f)=='string')return this.getParentElement(n,na,function(no){return tinyMCE.getAttrib(no,f)!=''});return this.getParentNode(n,function(n){return((n.nodeType==1&&!re)||(re&&re.test(n.nodeName)))&&(!f||f(n))},r)};TinyMCE_Engine.prototype.getParentNode=function(n,f,r){while(n){if(n==r)return null;if(f(n))return n;n=n.parentNode}return null};TinyMCE_Engine.prototype.getAttrib=function(elm,name,dv){var v;if(typeof(dv)=="undefined")dv="";if(!elm||elm.nodeType!=1)return dv;v=elm.getAttribute(name);if(name=="class"&&!v)v=elm.className;if(tinyMCE.isGecko&&name=="src"&&elm.src!=null&&elm.src!="")v=elm.src;if(tinyMCE.isGecko&&name=="href"&&elm.href!=null&&elm.href!="")v=elm.href;if(name=="http-equiv"&&tinyMCE.isIE)v=elm.httpEquiv;if(name=="style"&&!tinyMCE.isOpera)v=elm.style.cssText;return(v&&v!="")?v:dv};TinyMCE_Engine.prototype.setAttrib=function(el,name,va,fix){if(typeof(va)=="number"&&va!=null)va=""+va;if(fix){if(va==null)va="";va=va.replace(/[^0-9%]/g,'')}if(name=="style")el.style.cssText=va;if(name=="class")el.className=va;if(va!=null&&va!=""&&va!=-1)el.setAttribute(name,va);else el.removeAttribute(name)};TinyMCE_Engine.prototype.setStyleAttrib=function(e,n,v){e.style[n]=v;if(tinyMCE.isIE&&v==null||v==''){v=tinyMCE.serializeStyle(tinyMCE.parseStyle(e.style.cssText));e.style.cssText=v;e.setAttribute("style",v)}};TinyMCE_Engine.prototype.switchClass=function(ei,c){var e;if(tinyMCE.switchClassCache[ei])e=tinyMCE.switchClassCache[ei];else e=tinyMCE.switchClassCache[ei]=document.getElementById(ei);if(e){if(tinyMCE.settings.button_tile_map&&e.className&&e.className.indexOf('mceTiledButton')==0)c='mceTiledButton '+c;e.className=c}};TinyMCE_Engine.prototype.getAbsPosition=function(n,cn){var l=0,t=0;while(n&&n!=cn){l+=n.offsetLeft;t+=n.offsetTop;n=n.offsetParent}return{absLeft:l,absTop:t}};TinyMCE_Engine.prototype.prevNode=function(e,n){var a=n.split(','),i;while((e=e.previousSibling)!=null){for(i=0;i<a.length;i++){if(e.nodeName==a[i])return e}}return null};TinyMCE_Engine.prototype.nextNode=function(e,n){var a=n.split(','),i;while((e=e.nextSibling)!=null){for(i=0;i<a.length;i++){if(e.nodeName==a[i])return e}}return null};TinyMCE_Engine.prototype.selectElements=function(n,na,f){var i,a=[],nl,x;for(x=0,na=na.split(',');x<na.length;x++)for(i=0,nl=n.getElementsByTagName(na[x]);i<nl.length;i++)(!f||f(nl[i]))&&a.push(nl[i]);return a};TinyMCE_Engine.prototype.selectNodes=function(n,f,a){var i;if(!a)a=new Array();if(f(n))a[a.length]=n;if(n.hasChildNodes()){for(i=0;i<n.childNodes.length;i++)tinyMCE.selectNodes(n.childNodes[i],f,a)}return a};TinyMCE_Engine.prototype.addCSSClass=function(e,c,b){var o=this.removeCSSClass(e,c);return e.className=b?c+(o!=''?(' '+o):''):(o!=''?(o+' '):'')+c};TinyMCE_Engine.prototype.removeCSSClass=function(e,c){c=e.className.replace(new RegExp("(^|\\s+)"+c+"(\\s+|$)"),' ');return e.className=c!=' '?c:''};TinyMCE_Engine.prototype.hasCSSClass=function(n,c){return new RegExp('\\b'+c+'\\b','g').test(n.className)};TinyMCE_Engine.prototype.renameElement=function(e,n,d){var ne,i,ar;d=typeof(d)=="undefined"?tinyMCE.selectedInstance.getDoc():d;if(e){ne=d.createElement(n);ar=e.attributes;for(i=ar.length-1;i>-1;i--){if(ar[i].specified&&ar[i].nodeValue)ne.setAttribute(ar[i].nodeName.toLowerCase(),ar[i].nodeValue)}ar=e.childNodes;for(i=0;i<ar.length;i++)ne.appendChild(ar[i].cloneNode(true));e.parentNode.replaceChild(ne,e)}};TinyMCE_Engine.prototype.getViewPort=function(w){var d=w.document,m=d.compatMode=='CSS1Compat',b=d.body,de=d.documentElement;return{left:w.pageXOffset||(m?de.scrollLeft:b.scrollLeft),top:w.pageYOffset||(m?de.scrollTop:b.scrollTop),width:w.innerWidth||(m?de.clientWidth:b.clientWidth),height:w.innerHeight||(m?de.clientHeight:b.clientHeight)}};TinyMCE_Engine.prototype.parseURL=function(url_str){var urlParts=new Array();if(url_str){var pos,lastPos;pos=url_str.indexOf('://');if(pos!=-1){urlParts['protocol']=url_str.substring(0,pos);lastPos=pos+3}for(var i=lastPos;i<url_str.length;i++){var chr=url_str.charAt(i);if(chr==':')break;if(chr=='/')break}pos=i;urlParts['host']=url_str.substring(lastPos,pos);urlParts['port']="";lastPos=pos;if(url_str.charAt(pos)==':'){pos=url_str.indexOf('/',lastPos);urlParts['port']=url_str.substring(lastPos+1,pos)}lastPos=pos;pos=url_str.indexOf('?',lastPos);if(pos==-1)pos=url_str.indexOf('#',lastPos);if(pos==-1)pos=url_str.length;urlParts['path']=url_str.substring(lastPos,pos);lastPos=pos;if(url_str.charAt(pos)=='?'){pos=url_str.indexOf('#');pos=(pos==-1)?url_str.length:pos;urlParts['query']=url_str.substring(lastPos+1,pos)}lastPos=pos;if(url_str.charAt(pos)=='#'){pos=url_str.length;urlParts['anchor']=url_str.substring(lastPos+1,pos)}}return urlParts};TinyMCE_Engine.prototype.serializeURL=function(up){var o="";if(up['protocol'])o+=up['protocol']+"://";if(up['host'])o+=up['host'];if(up['port'])o+=":"+up['port'];if(up['path'])o+=up['path'];if(up['query'])o+="?"+up['query'];if(up['anchor'])o+="#"+up['anchor'];return o};TinyMCE_Engine.prototype.convertAbsoluteURLToRelativeURL=function(base_url,url_to_relative){var baseURL=this.parseURL(base_url);var targetURL=this.parseURL(url_to_relative);var strTok1;var strTok2;var breakPoint=0;var outPath="";var forceSlash=false;if(targetURL.path=="")targetURL.path="/";else forceSlash=true;base_url=baseURL.path.substring(0,baseURL.path.lastIndexOf('/'));strTok1=base_url.split('/');strTok2=targetURL.path.split('/');if(strTok1.length>=strTok2.length){for(var i=0;i<strTok1.length;i++){if(i>=strTok2.length||strTok1[i]!=strTok2[i]){breakPoint=i+1;break}}}if(strTok1.length<strTok2.length){for(var i=0;i<strTok2.length;i++){if(i>=strTok1.length||strTok1[i]!=strTok2[i]){breakPoint=i+1;break}}}if(breakPoint==1)return targetURL.path;for(var i=0;i<(strTok1.length-(breakPoint-1));i++)outPath+="../";for(var i=breakPoint-1;i<strTok2.length;i++){if(i!=(breakPoint-1))outPath+="/"+strTok2[i];else outPath+=strTok2[i]}targetURL.protocol=null;targetURL.host=null;targetURL.port=null;targetURL.path=outPath==""&&forceSlash?"/":outPath;var fileName=baseURL.path;var pos;if((pos=fileName.lastIndexOf('/'))!=-1)fileName=fileName.substring(pos+1);if(fileName==targetURL.path&&targetURL.anchor!="")targetURL.path="";if(targetURL.path==""&&!targetURL.anchor)targetURL.path=fileName!=""?fileName:"/";return this.serializeURL(targetURL)};TinyMCE_Engine.prototype.convertRelativeToAbsoluteURL=function(base_url,relative_url){var baseURL=this.parseURL(base_url),baseURLParts,relURLParts;var relURL=this.parseURL(relative_url);if(relative_url==""||relative_url.indexOf('://')!=-1||/^(mailto:|javascript:|#|\/)/.test(relative_url))return relative_url;baseURLParts=baseURL['path'].split('/');relURLParts=relURL['path'].split('/');var newBaseURLParts=new Array();for(var i=baseURLParts.length-1;i>=0;i--){if(baseURLParts[i].length==0)continue;newBaseURLParts[newBaseURLParts.length]=baseURLParts[i]}baseURLParts=newBaseURLParts.reverse();var newRelURLParts=new Array();var numBack=0;for(var i=relURLParts.length-1;i>=0;i--){if(relURLParts[i].length==0||relURLParts[i]==".")continue;if(relURLParts[i]=='..'){numBack++;continue}if(numBack>0){numBack--;continue}newRelURLParts[newRelURLParts.length]=relURLParts[i]}relURLParts=newRelURLParts.reverse();var len=baseURLParts.length-numBack;var absPath=(len<=0?"":"/")+baseURLParts.slice(0,len).join('/')+"/"+relURLParts.join('/');var start="",end="";relURL.protocol=baseURL.protocol;relURL.host=baseURL.host;relURL.port=baseURL.port;if(relURL.path.charAt(relURL.path.length-1)=="/")absPath+="/";relURL.path=absPath;return this.serializeURL(relURL)};TinyMCE_Engine.prototype.convertURL=function(url,node,on_save){var prot=document.location.protocol;var host=document.location.hostname;var port=document.location.port;if(prot=="file:")return url;url=tinyMCE.regexpReplace(url,'(http|https):///','/');if(url.indexOf('mailto:')!=-1||url.indexOf('javascript:')!=-1||tinyMCE.regexpReplace(url,'[ \t\r\n\+]|%20','').charAt(0)=="#")return url;if(!tinyMCE.isIE&&!on_save&&url.indexOf("://")==-1&&url.charAt(0)!='/')return tinyMCE.settings['base_href']+url;if(on_save&&tinyMCE.getParam('relative_urls')){var curl=tinyMCE.convertRelativeToAbsoluteURL(tinyMCE.settings['base_href'],url);if(curl.charAt(0)=='/')curl=tinyMCE.settings['document_base_prefix']+curl;var urlParts=tinyMCE.parseURL(curl);var tmpUrlParts=tinyMCE.parseURL(tinyMCE.settings['document_base_url']);if(urlParts['host']==tmpUrlParts['host']&&(urlParts['port']==tmpUrlParts['port']))return tinyMCE.convertAbsoluteURLToRelativeURL(tinyMCE.settings['document_base_url'],curl)}if(!tinyMCE.getParam('relative_urls')){var urlParts=tinyMCE.parseURL(url);var baseUrlParts=tinyMCE.parseURL(tinyMCE.settings['base_href']);url=tinyMCE.convertRelativeToAbsoluteURL(tinyMCE.settings['base_href'],url);if(urlParts['anchor']&&urlParts['path']==baseUrlParts['path'])return"#"+urlParts['anchor']}if(tinyMCE.getParam('remove_script_host')){var start="",portPart="";if(port!="")portPart=":"+port;start=prot+"//"+host+portPart+"/";if(url.indexOf(start)==0)url=url.substring(start.length-1)}return url};TinyMCE_Engine.prototype.convertAllRelativeURLs=function(body){var i,elms,src,href,mhref,msrc;elms=body.getElementsByTagName("img");for(i=0;i<elms.length;i++){src=tinyMCE.getAttrib(elms[i],'src');msrc=tinyMCE.getAttrib(elms[i],'mce_src');if(msrc!="")src=msrc;if(src!=""){src=tinyMCE.convertRelativeToAbsoluteURL(tinyMCE.settings['base_href'],src);elms[i].setAttribute("src",src)}}elms=body.getElementsByTagName("a");for(i=0;i<elms.length;i++){href=tinyMCE.getAttrib(elms[i],'href');mhref=tinyMCE.getAttrib(elms[i],'mce_href');if(mhref!="")href=mhref;if(href&&href!=""){href=tinyMCE.convertRelativeToAbsoluteURL(tinyMCE.settings['base_href'],href);elms[i].setAttribute("href",href)}}};TinyMCE_Engine.prototype.clearArray=function(a){var n;for(n in a)a[n]=null;return a};TinyMCE_Engine.prototype.explode=function(d,s){var ar=s.split(d),oar=new Array(),i;for(i=0;i<ar.length;i++){if(ar[i]!="")oar[oar.length]=ar[i]}return oar};TinyMCE_Engine.prototype._setEventsEnabled=function(node,state){var evs,x,y,elms,i,event;var events=['onfocus','onblur','onclick','ondblclick','onmousedown','onmouseup','onmouseover','onmousemove','onmouseout','onkeypress','onkeydown','onkeydown','onkeyup'];evs=tinyMCE.settings['event_elements'].split(',');for(y=0;y<evs.length;y++){elms=node.getElementsByTagName(evs[y]);for(i=0;i<elms.length;i++){event="";for(x=0;x<events.length;x++){if((event=tinyMCE.getAttrib(elms[i],events[x]))!=''){event=tinyMCE.cleanupEventStr(""+event);if(!state)event="return true;"+event;else event=event.replace(/^return true;/gi,'');elms[i].removeAttribute(events[x]);elms[i].setAttribute(events[x],event)}}}}};TinyMCE_Engine.prototype._eventPatch=function(editor_id){var n,inst,win,e;if(typeof(tinyMCE)=="undefined")return true;try{if(tinyMCE.selectedInstance){win=tinyMCE.selectedInstance.getWin();if(win&&win.event){e=win.event;if(!e.target)e.target=e.srcElement;TinyMCE_Engine.prototype.handleEvent(e);return}}for(n in tinyMCE.instances){inst=tinyMCE.instances[n];if(!tinyMCE.isInstance(inst))continue;inst.select();win=inst.getWin();if(win&&win.event){e=win.event;if(!e.target)e.target=e.srcElement;TinyMCE_Engine.prototype.handleEvent(e);return}}}catch(ex){}};TinyMCE_Engine.prototype.findEvent=function(e){var n,inst;if(e)return e;for(n in tinyMCE.instances){inst=tinyMCE.instances[n];if(tinyMCE.isInstance(inst)&&inst.getWin().event)return inst.getWin().event}return null};TinyMCE_Engine.prototype.unloadHandler=function(){tinyMCE.triggerSave(true,true)};TinyMCE_Engine.prototype.addEventHandlers=function(inst){this.setEventHandlers(inst,1)};TinyMCE_Engine.prototype.setEventHandlers=function(inst,s){var doc=inst.getDoc(),ie,ot,i,f=s?tinyMCE.addEvent:tinyMCE.removeEvent;ie=['keypress','keyup','keydown','click','mouseup','mousedown','controlselect','dblclick'];ot=['keypress','keyup','keydown','click','mouseup','mousedown','focus','blur','dragdrop'];inst.switchSettings();if(tinyMCE.isIE){for(i=0;i<ie.length;i++)f(doc,ie[i],TinyMCE_Engine.prototype._eventPatch)}else{for(i=0;i<ot.length;i++)f(doc,ot[i],tinyMCE.handleEvent);eval('try { doc.designMode = "On"; } catch(e) {}');}};TinyMCE_Engine.prototype.onMouseMove=function(){var inst,lh;if(tinyMCE.lastHover){lh=tinyMCE.lastHover;if(lh.className.indexOf('mceMenu')!=-1)tinyMCE._menuButtonEvent('out',lh);else lh.className=lh.className;tinyMCE.lastHover=null}if(!tinyMCE.hasMouseMoved){inst=tinyMCE.selectedInstance;if(inst.isFocused){inst.undoBookmark=inst.selection.getBookmark();tinyMCE.hasMouseMoved=true}}};TinyMCE_Engine.prototype.cancelEvent=function(e){if(!e)return false;if(tinyMCE.isIE){e.returnValue=false;e.cancelBubble=true}else{e.preventDefault();e.stopPropagation&&e.stopPropagation()}return false};TinyMCE_Engine.prototype.addEvent=function(o,n,h){if(n!='unload'){function clean(){var ex;try{tinyMCE.removeEvent(o,n,h);tinyMCE.removeEvent(window,'unload',clean);o=n=h=null}catch(ex){}}tinyMCE.addEvent(window,'unload',clean)}if(o.attachEvent)o.attachEvent("on"+n,h);else o.addEventListener(n,h,false)};TinyMCE_Engine.prototype.removeEvent=function(o,n,h){if(o.detachEvent)o.detachEvent("on"+n,h);else o.removeEventListener(n,h,false)};TinyMCE_Engine.prototype.addSelectAccessibility=function(e,s,w){if(!s._isAccessible){s.onkeydown=tinyMCE.accessibleEventHandler;s.onblur=tinyMCE.accessibleEventHandler;s._isAccessible=true;s._win=w}return false};TinyMCE_Engine.prototype.accessibleEventHandler=function(e){var win=this._win;e=tinyMCE.isIE?win.event:e;var elm=tinyMCE.isIE?e.srcElement:e.target;if(e.type=="blur"){if(elm.oldonchange){elm.onchange=elm.oldonchange;elm.oldonchange=null}return true}if(elm.nodeName=="SELECT"&&!elm.oldonchange){elm.oldonchange=elm.onchange;elm.onchange=null}if(e.keyCode==13||e.keyCode==32){elm.onchange=elm.oldonchange;elm.onchange();elm.oldonchange=null;tinyMCE.cancelEvent(e);return false}return true};TinyMCE_Engine.prototype._resetIframeHeight=function(){var ife;if(tinyMCE.isRealIE){ife=tinyMCE.selectedInstance.iframeElement;if(ife._oldHeight){ife.style.height=ife._oldHeight;ife.height=ife._oldHeight}}};function TinyMCE_Selection(inst){this.instance=inst};TinyMCE_Selection.prototype={getSelectedHTML:function(){var inst=this.instance;var e,r=this.getRng(),h;if(!r)return null;e=document.createElement("body");if(r.cloneContents)e.appendChild(r.cloneContents());else if(typeof(r.item)!='undefined'||typeof(r.htmlText)!='undefined')e.innerHTML=r.item?r.item(0).outerHTML:r.htmlText;else e.innerHTML=r.toString();h=tinyMCE._cleanupHTML(inst,inst.contentDocument,inst.settings,e,e,false,true,false);if(tinyMCE.getParam("convert_fonts_to_spans"))tinyMCE.convertSpansToFonts(inst.getDoc());return h},getSelectedText:function(){var inst=this.instance;var d,r,s,t;if(tinyMCE.isIE){d=inst.getDoc();if(d.selection.type=="Text"){r=d.selection.createRange();t=r.text}else t=''}else{s=this.getSel();if(s&&s.toString)t=s.toString();else t=''}return t},getBookmark:function(simple){var inst=this.instance;var rng=this.getRng();var doc=inst.getDoc(),b=inst.getBody();var sp,le,s,e,nl,i,si,ei,w;var trng,sx,sy,xx=-999999999,vp=inst.getViewPort();sx=vp.left;sy=vp.top;if(tinyMCE.isSafari||tinyMCE.isOpera||simple)return{rng:rng,scrollX:sx,scrollY:sy};if(tinyMCE.isIE){if(rng.item){e=rng.item(0);nl=b.getElementsByTagName(e.nodeName);for(i=0;i<nl.length;i++){if(e==nl[i]){sp=i;break}}return{tag:e.nodeName,index:sp,scrollX:sx,scrollY:sy}}else{trng=doc.body.createTextRange();trng.moveToElementText(inst.getBody());trng.collapse(true);bp=Math.abs(trng.move('character',xx));trng=rng.duplicate();trng.collapse(true);sp=Math.abs(trng.move('character',xx));trng=rng.duplicate();trng.collapse(false);le=Math.abs(trng.move('character',xx))-sp;return{start:sp-bp,length:le,scrollX:sx,scrollY:sy}}}if(tinyMCE.isGecko){s=this.getSel();e=this.getFocusElement();if(!s)return null;if(e&&e.nodeName=='IMG'){return{start:-1,end:-1,index:sp,scrollX:sx,scrollY:sy}}if(s.anchorNode==s.focusNode&&s.anchorOffset==s.focusOffset){e=this._getPosText(b,s.anchorNode,s.focusNode);if(!e)return{scrollX:sx,scrollY:sy};return{start:e.start+s.anchorOffset,end:e.end+s.focusOffset,scrollX:sx,scrollY:sy}}else{e=this._getPosText(b,rng.startContainer,rng.endContainer);if(!e)return{scrollX:sx,scrollY:sy};return{start:e.start+rng.startOffset,end:e.end+rng.endOffset,scrollX:sx,scrollY:sy}}}return null},moveToBookmark:function(bookmark){var inst=this.instance;var rng,nl,i,ex,b=inst.getBody(),sd;var doc=inst.getDoc();var win=inst.getWin();var sel=this.getSel();if(!bookmark)return false;if(tinyMCE.isSafari){sel.setBaseAndExtent(bookmark.rng.startContainer,bookmark.rng.startOffset,bookmark.rng.endContainer,bookmark.rng.endOffset);return true}if(tinyMCE.isRealIE){if(bookmark.rng){try{bookmark.rng.select()}catch(ex){}return true}win.focus();if(bookmark.tag){rng=b.createControlRange();nl=b.getElementsByTagName(bookmark.tag);if(nl.length>bookmark.index){try{rng.addElement(nl[bookmark.index])}catch(ex){}}}else{try{if(bookmark.start<0)return true;rng=inst.getSel().createRange();rng.moveToElementText(inst.getBody());rng.collapse(true);rng.moveStart('character',bookmark.start);rng.moveEnd('character',bookmark.length)}catch(ex){return true}}rng.select();win.scrollTo(bookmark.scrollX,bookmark.scrollY);return true}if(tinyMCE.isGecko||tinyMCE.isOpera){if(bookmark.rng){sel.removeAllRanges();sel.addRange(bookmark.rng)}if(bookmark.start!=-1&&bookmark.end!=-1){try{sd=this._getTextPos(b,bookmark.start,bookmark.end);rng=doc.createRange();rng.setStart(sd.startNode,sd.startOffset);rng.setEnd(sd.endNode,sd.endOffset);sel.removeAllRanges();sel.addRange(rng);win.focus()}catch(ex){}}win.scrollTo(bookmark.scrollX,bookmark.scrollY);return true}return false},_getPosText:function(r,sn,en){var w=document.createTreeWalker(r,NodeFilter.SHOW_TEXT,null,false),n,p=0,d={};while((n=w.nextNode())!=null){if(n==sn)d.start=p;if(n==en){d.end=p;return d}p+=n.nodeValue?n.nodeValue.length:0}return null},_getTextPos:function(r,sp,ep){var w=document.createTreeWalker(r,NodeFilter.SHOW_TEXT,null,false),n,p=0,d={};while((n=w.nextNode())!=null){p+=n.nodeValue?n.nodeValue.length:0;if(p>=sp&&!d.startNode){d.startNode=n;d.startOffset=sp-(p-n.nodeValue.length)}if(p>=ep){d.endNode=n;d.endOffset=ep-(p-n.nodeValue.length);return d}}return null},selectNode:function(node,collapse,select_text_node,to_start){var inst=this.instance,sel,rng,nodes;if(!node)return;if(typeof(collapse)=="undefined")collapse=true;if(typeof(select_text_node)=="undefined")select_text_node=false;if(typeof(to_start)=="undefined")to_start=true;if(inst.settings.auto_resize)inst.resizeToContent();if(tinyMCE.isRealIE){rng=inst.getDoc().body.createTextRange();try{rng.moveToElementText(node);if(collapse)rng.collapse(to_start);rng.select()}catch(e){}}else{sel=this.getSel();if(!sel)return;if(tinyMCE.isSafari){sel.setBaseAndExtent(node,0,node,node.innerText.length);if(collapse){if(to_start)sel.collapseToStart();else sel.collapseToEnd()}this.scrollToNode(node);return}rng=inst.getDoc().createRange();if(select_text_node){nodes=tinyMCE.getNodeTree(node,new Array(),3);if(nodes.length>0)rng.selectNodeContents(nodes[0]);else rng.selectNodeContents(node)}else rng.selectNode(node);if(collapse){if(!to_start&&node.nodeType==3){rng.setStart(node,node.nodeValue.length);rng.setEnd(node,node.nodeValue.length)}else rng.collapse(to_start)}sel.removeAllRanges();sel.addRange(rng)}this.scrollToNode(node);tinyMCE.selectedElement=null;if(node.nodeType==1)tinyMCE.selectedElement=node},scrollToNode:function(node){var inst=this.instance,w=inst.getWin(),vp=inst.getViewPort(),pos=tinyMCE.getAbsPosition(node),cvp,p,cwin;if(pos.absLeft<vp.left||pos.absLeft>vp.left+vp.width||pos.absTop<vp.top||pos.absTop>vp.top+(vp.height-25))w.scrollTo(pos.absLeft,pos.absTop-vp.height+25);if(inst.settings.auto_resize){cwin=inst.getContainerWin();cvp=tinyMCE.getViewPort(cwin);p=this.getAbsPosition(node);if(p.absLeft<cvp.left||p.absLeft>cvp.left+cvp.width||p.absTop<cvp.top||p.absTop>cvp.top+cvp.height)cwin.scrollTo(p.absLeft,p.absTop-cvp.height+25)}},getAbsPosition:function(n){var pos=tinyMCE.getAbsPosition(n),ipos=tinyMCE.getAbsPosition(this.instance.iframeElement);return{absLeft:ipos.absLeft+pos.absLeft,absTop:ipos.absTop+pos.absTop}},getSel:function(){var inst=this.instance;if(tinyMCE.isRealIE)return inst.getDoc().selection;return inst.contentWindow.getSelection()},getRng:function(){var s=this.getSel();if(s==null)return null;if(tinyMCE.isRealIE)return s.createRange();if(tinyMCE.isSafari&&!s.getRangeAt)return''+window.getSelection();return s.getRangeAt(0)},getFocusElement:function(){var inst=this.instance,doc,rng,sel,elm;if(tinyMCE.isRealIE){doc=inst.getDoc();rng=doc.selection.createRange();elm=rng.item?rng.item(0):rng.parentElement()}else{if(!tinyMCE.isSafari&&inst.isHidden())return inst.getBody();sel=this.getSel();rng=this.getRng();if(!sel||!rng)return null;elm=rng.commonAncestorContainer;if(!rng.collapsed){if(rng.startContainer==rng.endContainer){if(rng.startOffset-rng.endOffset<2){if(rng.startContainer.hasChildNodes())elm=rng.startContainer.childNodes[rng.startOffset]}}}elm=tinyMCE.getParentElement(elm);}return elm}};function TinyMCE_UndoRedo(inst){this.instance=inst;this.undoLevels=new Array();this.undoIndex=0;this.typingUndoIndex=-1;this.undoRedo=true};TinyMCE_UndoRedo.prototype={add:function(l){var b,customUndoLevels,newHTML,inst=this.instance,i,ul,ur;if(l){this.undoLevels[this.undoLevels.length]=l;return true}if(this.typingUndoIndex!=-1){this.undoIndex=this.typingUndoIndex;if(tinyMCE.typingUndoIndex!=-1)tinyMCE.undoIndex=tinyMCE.typingUndoIndex}newHTML=tinyMCE.trim(inst.getBody().innerHTML);if(this.undoLevels[this.undoIndex]&&newHTML!=this.undoLevels[this.undoIndex].content){tinyMCE.dispatchCallback(inst,'onchange_callback','onChange',inst);customUndoLevels=tinyMCE.settings['custom_undo_redo_levels'];if(customUndoLevels!=-1&&this.undoLevels.length>customUndoLevels){for(i=0;i<this.undoLevels.length-1;i++)this.undoLevels[i]=this.undoLevels[i+1];this.undoLevels.length--;this.undoIndex--;}b=inst.undoBookmark;if(!b)b=inst.selection.getBookmark();this.undoIndex++;this.undoLevels[this.undoIndex]={content:newHTML,bookmark:b};ul=tinyMCE.undoLevels;for(i=tinyMCE.undoIndex+1;i<ul.length;i++){ur=ul[i].undoRedo;if(ur.undoIndex==ur.undoLevels.length-1)ur.undoIndex--;ur.undoLevels.length--}tinyMCE.undoLevels[tinyMCE.undoIndex++]=inst;tinyMCE.undoLevels.length=tinyMCE.undoIndex;this.undoLevels.length=this.undoIndex+1;return true}return false},undo:function(){var inst=this.instance;if(this.undoIndex>0){this.undoIndex--;tinyMCE.setInnerHTML(inst.getBody(),this.undoLevels[this.undoIndex].content);inst.repaint();if(inst.settings.custom_undo_redo_restore_selection)inst.selection.moveToBookmark(this.undoLevels[this.undoIndex].bookmark)}},redo:function(){var inst=this.instance;tinyMCE.execCommand("mceEndTyping");if(this.undoIndex<(this.undoLevels.length-1)){this.undoIndex++;tinyMCE.setInnerHTML(inst.getBody(),this.undoLevels[this.undoIndex].content);inst.repaint();if(inst.settings.custom_undo_redo_restore_selection)inst.selection.moveToBookmark(this.undoLevels[this.undoIndex].bookmark)}tinyMCE.triggerNodeChange()}};var TinyMCE_ForceParagraphs={_insertPara:function(inst,e){var doc=inst.getDoc(),sel=inst.getSel(),body=inst.getBody(),win=inst.contentWindow,rng=sel.getRangeAt(0);var rootElm=doc.documentElement,blockName="P",startNode,endNode,startBlock,endBlock;var rngBefore,rngAfter,direct,startNode,startOffset,endNode,endOffset,b=tinyMCE.isOpera?inst.selection.getBookmark():null;var paraBefore,paraAfter,startChop,endChop,contents;function isEmpty(para){function isEmptyHTML(html){return html.replace(new RegExp('[ \t\r\n]+','g'),'').toLowerCase()==""}if(para.getElementsByTagName("img").length>0)return false;if(para.getElementsByTagName("table").length>0)return false;if(para.getElementsByTagName("hr").length>0)return false;var nodes=tinyMCE.getNodeTree(para,new Array(),3);for(var i=0;i<nodes.length;i++){if(!isEmptyHTML(nodes[i].nodeValue))return false}return true}rngBefore=doc.createRange();rngBefore.setStart(sel.anchorNode,sel.anchorOffset);rngBefore.collapse(true);rngAfter=doc.createRange();rngAfter.setStart(sel.focusNode,sel.focusOffset);rngAfter.collapse(true);direct=rngBefore.compareBoundaryPoints(rngBefore.START_TO_END,rngAfter)<0;startNode=direct?sel.anchorNode:sel.focusNode;startOffset=direct?sel.anchorOffset:sel.focusOffset;endNode=direct?sel.focusNode:sel.anchorNode;endOffset=direct?sel.focusOffset:sel.anchorOffset;startNode=startNode.nodeName=="BODY"?startNode.firstChild:startNode;endNode=endNode.nodeName=="BODY"?endNode.firstChild:endNode;startBlock=inst.getParentBlockElement(startNode);endBlock=inst.getParentBlockElement(endNode);if(startBlock&&new RegExp('absolute|relative|static','gi').test(startBlock.style.position))startBlock=null;if(endBlock&&new RegExp('absolute|relative|static','gi').test(endBlock.style.position))endBlock=null;if(startBlock!=null){blockName=startBlock.nodeName;if(blockName=="TD"||blockName=="TABLE"||(blockName=="DIV"&&new RegExp('left|right','gi').test(startBlock.style.cssFloat)))blockName="P"}if(tinyMCE.getParentElement(startBlock,"OL,UL",null,body)!=null)return false;if((startBlock!=null&&startBlock.nodeName=="TABLE")||(endBlock!=null&&endBlock.nodeName=="TABLE"))startBlock=endBlock=null;paraBefore=(startBlock!=null&&startBlock.nodeName==blockName)?startBlock.cloneNode(false):doc.createElement(blockName);paraAfter=(endBlock!=null&&endBlock.nodeName==blockName)?endBlock.cloneNode(false):doc.createElement(blockName);if(/^(H[1-6])$/.test(blockName))paraAfter=doc.createElement("p");startChop=startNode;endChop=endNode;node=startChop;do{if(node==body||node.nodeType==9||tinyMCE.isBlockElement(node))break;startChop=node}while((node=node.previousSibling?node.previousSibling:node.parentNode));node=endChop;do{if(node==body||node.nodeType==9||tinyMCE.isBlockElement(node))break;endChop=node}while((node=node.nextSibling?node.nextSibling:node.parentNode));if(startChop.nodeName=="TD")startChop=startChop.firstChild;if(endChop.nodeName=="TD")endChop=endChop.lastChild;if(startBlock==null){rng.deleteContents();if(!tinyMCE.isSafari)sel.removeAllRanges();if(startChop!=rootElm&&endChop!=rootElm){rngBefore=rng.cloneRange();if(startChop==body)rngBefore.setStart(startChop,0);else rngBefore.setStartBefore(startChop);paraBefore.appendChild(rngBefore.cloneContents());if(endChop.parentNode.nodeName==blockName)endChop=endChop.parentNode;rng.setEndAfter(endChop);if(endChop.nodeName!="#text"&&endChop.nodeName!="BODY")rngBefore.setEndAfter(endChop);contents=rng.cloneContents();if(contents.firstChild&&(contents.firstChild.nodeName==blockName||contents.firstChild.nodeName=="BODY"))paraAfter.innerHTML=contents.firstChild.innerHTML;else paraAfter.appendChild(contents);if(isEmpty(paraBefore))paraBefore.innerHTML="&nbsp;";if(isEmpty(paraAfter))paraAfter.innerHTML="&nbsp;";rng.deleteContents();rngAfter.deleteContents();rngBefore.deleteContents();if(tinyMCE.isOpera){paraBefore.normalize();rngBefore.insertNode(paraBefore);paraAfter.normalize();rngBefore.insertNode(paraAfter)}else{paraAfter.normalize();rngBefore.insertNode(paraAfter);paraBefore.normalize();rngBefore.insertNode(paraBefore)}}else{body.innerHTML="<"+blockName+">&nbsp;</"+blockName+"><"+blockName+">&nbsp;</"+blockName+">";paraAfter=body.childNodes[1]}inst.selection.moveToBookmark(b);inst.selection.selectNode(paraAfter,true,true);return true}if(startChop.nodeName==blockName)rngBefore.setStart(startChop,0);else rngBefore.setStartBefore(startChop);rngBefore.setEnd(startNode,startOffset);paraBefore.appendChild(rngBefore.cloneContents());rngAfter.setEndAfter(endChop);rngAfter.setStart(endNode,endOffset);contents=rngAfter.cloneContents();if(contents.firstChild&&contents.firstChild.nodeName==blockName){paraAfter.innerHTML=contents.firstChild.innerHTML}else paraAfter.appendChild(contents);if(isEmpty(paraBefore))paraBefore.innerHTML="&nbsp;";if(isEmpty(paraAfter))paraAfter.innerHTML="&nbsp;";rng=doc.createRange();if(!startChop.previousSibling&&startChop.parentNode.nodeName.toUpperCase()==blockName){rng.setStartBefore(startChop.parentNode)}else{if(rngBefore.startContainer.nodeName.toUpperCase()==blockName&&rngBefore.startOffset==0)rng.setStartBefore(rngBefore.startContainer);else rng.setStart(rngBefore.startContainer,rngBefore.startOffset)}if(!endChop.nextSibling&&endChop.parentNode.nodeName.toUpperCase()==blockName)rng.setEndAfter(endChop.parentNode);else rng.setEnd(rngAfter.endContainer,rngAfter.endOffset);rng.deleteContents();if(tinyMCE.isOpera){rng.insertNode(paraBefore);rng.insertNode(paraAfter)}else{rng.insertNode(paraAfter);rng.insertNode(paraBefore)}paraAfter.normalize();paraBefore.normalize();inst.selection.moveToBookmark(b);inst.selection.selectNode(paraAfter,true,true);return true},_handleBackSpace:function(inst){var r=inst.getRng(),sn=r.startContainer,nv,s=false;if(sn&&sn.nextSibling&&sn.nextSibling.nodeName=="BR"&&sn.parentNode.nodeName!="BODY"){nv=sn.nodeValue;if(nv!=null&&r.startOffset==nv.length)sn.nextSibling.parentNode.removeChild(sn.nextSibling)}if(inst.settings.auto_resize)inst.resizeToContent();return s}};function TinyMCE_Layer(id,bm){this.id=id;this.blockerElement=null;this.events=false;this.element=null;this.blockMode=typeof(bm)!='undefined'?bm:true;this.doc=document};TinyMCE_Layer.prototype={moveRelativeTo:function(re,p){var rep=this.getAbsPosition(re);var w=parseInt(re.offsetWidth);var h=parseInt(re.offsetHeight);var e=this.getElement();var ew=parseInt(e.offsetWidth);var eh=parseInt(e.offsetHeight);var x,y;switch(p){case"tl":x=rep.absLeft;y=rep.absTop;break;case"tr":x=rep.absLeft+w;y=rep.absTop;break;case"bl":x=rep.absLeft;y=rep.absTop+h;break;case"br":x=rep.absLeft+w;y=rep.absTop+h;break;case"cc":x=rep.absLeft+(w/ 2) - (ew /2);y=rep.absTop+(h/ 2) - (eh /2);break}this.moveTo(x,y)},moveBy:function(x,y){var e=this.getElement();this.moveTo(parseInt(e.style.left)+x,parseInt(e.style.top)+y)},moveTo:function(x,y){var e=this.getElement();e.style.left=x+"px";e.style.top=y+"px";this.updateBlocker()},resizeBy:function(w,h){var e=this.getElement();this.resizeTo(parseInt(e.style.width)+w,parseInt(e.style.height)+h)},resizeTo:function(w,h){var e=this.getElement();if(w!=null)e.style.width=w+"px";if(h!=null)e.style.height=h+"px";this.updateBlocker()},show:function(){this.getElement().style.display='block';this.updateBlocker()},hide:function(){this.getElement().style.display='none';this.updateBlocker()},isVisible:function(){return this.getElement().style.display=='block'},getElement:function(){if(!this.element)this.element=this.doc.getElementById(this.id);return this.element},setBlockMode:function(s){this.blockMode=s},updateBlocker:function(){var e,b,x,y,w,h;b=this.getBlocker();if(b){if(this.blockMode){e=this.getElement();x=this.parseInt(e.style.left);y=this.parseInt(e.style.top);w=this.parseInt(e.offsetWidth);h=this.parseInt(e.offsetHeight);b.style.left=x+'px';b.style.top=y+'px';b.style.width=w+'px';b.style.height=h+'px';b.style.display=e.style.display}else b.style.display='none'}},getBlocker:function(){var d,b;if(!this.blockerElement&&this.blockMode){d=this.doc;b=d.getElementById(this.id+"_blocker");if(!b){b=d.createElement("iframe");b.setAttribute('id',this.id+"_blocker");b.style.cssText='display: none; position: absolute; left: 0; top: 0';b.src='javascript:false;';b.frameBorder='0';b.scrolling='no';d.body.appendChild(b)}this.blockerElement=b}return this.blockerElement},getAbsPosition:function(n){var p={absLeft:0,absTop:0};while(n){p.absLeft+=n.offsetLeft;p.absTop+=n.offsetTop;n=n.offsetParent}return p},create:function(n,c,p,h){var d=this.doc,e=d.createElement(n);e.setAttribute('id',this.id);if(c)e.className=c;if(!p)p=d.body;if(h)e.innerHTML=h;p.appendChild(e);return this.element=e},exists:function(){return this.doc.getElementById(this.id)!=null},parseInt:function(s){if(s==null||s=='')return 0;return parseInt(s)}};function TinyMCE_Menu(){var id;if(typeof(tinyMCE.menuCounter)=="undefined")tinyMCE.menuCounter=0;id="mc_menu_"+tinyMCE.menuCounter++;TinyMCE_Layer.call(this,id,true);this.id=id;this.items=new Array();this.needsUpdate=true};TinyMCE_Menu.prototype=tinyMCE.extend(TinyMCE_Layer.prototype,{init:function(s){var n;this.settings={separator_class:'mceMenuSeparator',title_class:'mceMenuTitle',disabled_class:'mceMenuDisabled',menu_class:'mceMenu',drop_menu:true};for(n in s)this.settings[n]=s[n];this.create('div',this.settings.menu_class)},clear:function(){this.items=new Array()},addTitle:function(t){this.add({type:'title',text:t})},addDisabled:function(t){this.add({type:'disabled',text:t})},addSeparator:function(){this.add({type:'separator'})},addItem:function(t,js){this.add({text:t,js:js})},add:function(mi){this.items[this.items.length]=mi;this.needsUpdate=true},update:function(){var e=this.getElement(),h='',i,t,m=this.items,s=this.settings;if(this.settings.drop_menu)h+='<span class="mceMenuLine"></span>';h+='<table border="0" cellpadding="0" cellspacing="0">';for(i=0;i<m.length;i++){t=tinyMCE.xmlEncode(m[i].text);c=m[i].class_name?' class="'+m[i].class_name+'"':'';switch(m[i].type){case'separator':h+='<tr class="'+s.separator_class+'"><td>';break;case'title':h+='<tr class="'+s.title_class+'"><td><span'+c+'>'+t+'</span>';break;case'disabled':h+='<tr class="'+s.disabled_class+'"><td><span'+c+'>'+t+'</span>';break;default:h+='<tr><td><a href="#" onclick="return tinyMCE.cancelEvent(event);" onmousedown="return tinyMCE.cancelEvent(event);" onmouseup="'+tinyMCE.xmlEncode(m[i].js)+';return tinyMCE.cancelEvent(event);"><span'+c+'>'+t+'</span></a>'}h+='</td></tr>'}h+='</table>';e.innerHTML=h;this.needsUpdate=false;this.updateBlocker()},show:function(){var nl,i;if(tinyMCE.lastMenu==this)return;if(this.needsUpdate)this.update();if(tinyMCE.lastMenu&&tinyMCE.lastMenu!=this)tinyMCE.lastMenu.hide();TinyMCE_Layer.prototype.show.call(this);if(!tinyMCE.isOpera){}tinyMCE.lastMenu=this}});if(!Function.prototype.call){Function.prototype.call=function(){var a=arguments,s=a[0],i,as='',r,o;for(i=1;i<a.length;i++)as+=(i>1?',':'')+'a['+i+']';o=s._fu;s._fu=this;r=eval('s._fu('+as+')');s._fu=o;return r}};TinyMCE_Engine.prototype.debug=function(){var m="",a,i,l=tinyMCE.log.length;for(i=0,a=this.debug.arguments;i<a.length;i++){m+=a[i];if(i<a.length-1)m+=', '}if(l<1000)tinyMCE.log[l]="[debug] "+m};
\ No newline at end of file
+var tinymce={majorVersion:"3",minorVersion:"2.5",releaseDate:"2009-06-29",_init:function(){var o=this,k=document,l=window,j=navigator,b=j.userAgent,h,a,g,f,e,m;o.isOpera=l.opera&&opera.buildNumber;o.isWebKit=/WebKit/.test(b);o.isIE=!o.isWebKit&&!o.isOpera&&(/MSIE/gi).test(b)&&(/Explorer/gi).test(j.appName);o.isIE6=o.isIE&&/MSIE [56]/.test(b);o.isGecko=!o.isWebKit&&/Gecko/.test(b);o.isMac=b.indexOf("Mac")!=-1;o.isAir=/adobeair/i.test(b);if(l.tinyMCEPreInit){o.suffix=tinyMCEPreInit.suffix;o.baseURL=tinyMCEPreInit.base;o.query=tinyMCEPreInit.query;return}o.suffix="";a=k.getElementsByTagName("base");for(h=0;h<a.length;h++){if(m=a[h].href){if(/^https?:\/\/[^\/]+$/.test(m)){m+="/"}f=m?m.match(/.*\//)[0]:""}}function c(d){if(d.src&&/tiny_mce(|_gzip|_jquery|_prototype)(_dev|_src)?.js/.test(d.src)){if(/_(src|dev)\.js/g.test(d.src)){o.suffix="_src"}if((e=d.src.indexOf("?"))!=-1){o.query=d.src.substring(e+1)}o.baseURL=d.src.substring(0,d.src.lastIndexOf("/"));if(f&&o.baseURL.indexOf("://")==-1){o.baseURL=f+o.baseURL}return o.baseURL}return null}a=k.getElementsByTagName("script");for(h=0;h<a.length;h++){if(c(a[h])){return}}g=k.getElementsByTagName("head")[0];if(g){a=g.getElementsByTagName("script");for(h=0;h<a.length;h++){if(c(a[h])){return}}}return},is:function(b,a){var c=typeof(b);if(!a){return c!="undefined"}if(a=="array"&&(b.hasOwnProperty&&b instanceof Array)){return true}return c==a},each:function(d,a,c){var e,b;if(!d){return 0}c=c||d;if(typeof(d.length)!="undefined"){for(e=0,b=d.length;e<b;e++){if(a.call(c,d[e],e,d)===false){return 0}}}else{for(e in d){if(d.hasOwnProperty(e)){if(a.call(c,d[e],e,d)===false){return 0}}}}return 1},map:function(b,c){var d=[];tinymce.each(b,function(a){d.push(c(a))});return d},grep:function(b,c){var d=[];tinymce.each(b,function(a){if(!c||c(a)){d.push(a)}});return d},inArray:function(c,d){var e,b;if(c){for(e=0,b=c.length;e<b;e++){if(c[e]===d){return e}}}return -1},extend:function(f,d){var c,b=arguments;for(c=1;c<b.length;c++){d=b[c];tinymce.each(d,function(a,e){if(typeof(a)!=="undefined"){f[e]=a}})}return f},trim:function(a){return(a?""+a:"").replace(/^\s*|\s*$/g,"")},create:function(j,a){var i=this,b,e,f,g,d,h=0;j=/^((static) )?([\w.]+)(:([\w.]+))?/.exec(j);f=j[3].match(/(^|\.)(\w+)$/i)[2];e=i.createNS(j[3].replace(/\.\w+$/,""));if(e[f]){return}if(j[2]=="static"){e[f]=a;if(this.onCreate){this.onCreate(j[2],j[3],e[f])}return}if(!a[f]){a[f]=function(){};h=1}e[f]=a[f];i.extend(e[f].prototype,a);if(j[5]){b=i.resolve(j[5]).prototype;g=j[5].match(/\.(\w+)$/i)[1];d=e[f];if(h){e[f]=function(){return b[g].apply(this,arguments)}}else{e[f]=function(){this.parent=b[g];return d.apply(this,arguments)}}e[f].prototype[f]=e[f];i.each(b,function(c,k){e[f].prototype[k]=b[k]});i.each(a,function(c,k){if(b[k]){e[f].prototype[k]=function(){this.parent=b[k];return c.apply(this,arguments)}}else{if(k!=f){e[f].prototype[k]=c}}})}i.each(a["static"],function(c,k){e[f][k]=c});if(this.onCreate){this.onCreate(j[2],j[3],e[f].prototype)}},walk:function(c,b,d,a){a=a||this;if(c){if(d){c=c[d]}tinymce.each(c,function(f,e){if(b.call(a,f,e,d)===false){return false}tinymce.walk(f,b,d,a)})}},createNS:function(d,c){var b,a;c=c||window;d=d.split(".");for(b=0;b<d.length;b++){a=d[b];if(!c[a]){c[a]={}}c=c[a]}return c},resolve:function(d,c){var b,a;c=c||window;d=d.split(".");for(b=0,a=d.length;b<a;b++){c=c[d[b]];if(!c){break}}return c},addUnload:function(e,d){var c=this,a=window;e={func:e,scope:d||this};if(!c.unloads){function b(){var f=c.unloads,h,i;if(f){for(i in f){h=f[i];if(h&&h.func){h.func.call(h.scope,1)}}if(a.detachEvent){a.detachEvent("onbeforeunload",g);a.detachEvent("onunload",b)}else{if(a.removeEventListener){a.removeEventListener("unload",b,false)}}c.unloads=h=f=a=b=0;if(window.CollectGarbage){window.CollectGarbage()}}}function g(){var h=document;if(h.readyState=="interactive"){function f(){h.detachEvent("onstop",f);if(b){b()}h=0}if(h){h.attachEvent("onstop",f)}window.setTimeout(function(){if(h){h.detachEvent("onstop",f)}},0)}}if(a.attachEvent){a.attachEvent("onunload",b);a.attachEvent("onbeforeunload",g)}else{if(a.addEventListener){a.addEventListener("unload",b,false)}}c.unloads=[e]}else{c.unloads.push(e)}return e},removeUnload:function(c){var a=this.unloads,b=null;tinymce.each(a,function(e,d){if(e&&e.func==c){a.splice(d,1);b=c;return false}});return b},explode:function(a,b){return a?tinymce.map(a.split(b||","),tinymce.trim):a},_addVer:function(b){var a;if(!this.query){return b}a=(b.indexOf("?")==-1?"?":"&")+this.query;if(b.indexOf("#")==-1){return b+a}return b.replace("#",a+"#")}};window.tinymce=tinymce;tinymce._init();tinymce.create("tinymce.util.Dispatcher",{scope:null,listeners:null,Dispatcher:function(a){this.scope=a||this;this.listeners=[]},add:function(a,b){this.listeners.push({cb:a,scope:b||this.scope});return a},addToTop:function(a,b){this.listeners.unshift({cb:a,scope:b||this.scope});return a},remove:function(a){var b=this.listeners,c=null;tinymce.each(b,function(e,d){if(a==e.cb){c=a;b.splice(d,1);return false}});return c},dispatch:function(){var f,d=arguments,e,b=this.listeners,g;for(e=0;e<b.length;e++){g=b[e];f=g.cb.apply(g.scope,d);if(f===false){break}}return f}});(function(){var a=tinymce.each;tinymce.create("tinymce.util.URI",{URI:function(e,g){var f=this,h,d,c;e=tinymce.trim(e);g=f.settings=g||{};if(/^(mailto|tel|news|javascript|about):/i.test(e)||/^\s*#/.test(e)){f.source=e;return}if(e.indexOf("/")===0&&e.indexOf("//")!==0){e=(g.base_uri?g.base_uri.protocol||"http":"http")+"://mce_host"+e}if(!/^\w*:?\/\//.test(e)){e=(g.base_uri.protocol||"http")+"://mce_host"+f.toAbsPath(g.base_uri.path,e)}e=e.replace(/@@/g,"(mce_at)");e=/^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*):?([^:@]*))?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/.exec(e);a(["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"],function(b,j){var k=e[j];if(k){k=k.replace(/\(mce_at\)/g,"@@")}f[b]=k});if(c=g.base_uri){if(!f.protocol){f.protocol=c.protocol}if(!f.userInfo){f.userInfo=c.userInfo}if(!f.port&&f.host=="mce_host"){f.port=c.port}if(!f.host||f.host=="mce_host"){f.host=c.host}f.source=""}},setPath:function(c){var b=this;c=/^(.*?)\/?(\w+)?$/.exec(c);b.path=c[0];b.directory=c[1];b.file=c[2];b.source="";b.getURI()},toRelative:function(b){var c=this,d;if(b==="./"){return b}b=new tinymce.util.URI(b,{base_uri:c});if((b.host!="mce_host"&&c.host!=b.host&&b.host)||c.port!=b.port||c.protocol!=b.protocol){return b.getURI()}d=c.toRelPath(c.path,b.path);if(b.query){d+="?"+b.query}if(b.anchor){d+="#"+b.anchor}return d},toAbsolute:function(b,c){var b=new tinymce.util.URI(b,{base_uri:this});return b.getURI(this.host==b.host?c:0)},toRelPath:function(g,h){var c,f=0,d="",e,b;g=g.substring(0,g.lastIndexOf("/"));g=g.split("/");c=h.split("/");if(g.length>=c.length){for(e=0,b=g.length;e<b;e++){if(e>=c.length||g[e]!=c[e]){f=e+1;break}}}if(g.length<c.length){for(e=0,b=c.length;e<b;e++){if(e>=g.length||g[e]!=c[e]){f=e+1;break}}}if(f==1){return h}for(e=0,b=g.length-(f-1);e<b;e++){d+="../"}for(e=f-1,b=c.length;e<b;e++){if(e!=f-1){d+="/"+c[e]}else{d+=c[e]}}return d},toAbsPath:function(e,f){var c,b=0,g=[],d;d=/\/$/.test(f)?"/":"";e=e.split("/");f=f.split("/");a(e,function(h){if(h){g.push(h)}});e=g;for(c=f.length-1,g=[];c>=0;c--){if(f[c].length==0||f[c]=="."){continue}if(f[c]==".."){b++;continue}if(b>0){b--;continue}g.push(f[c])}c=e.length-b;if(c<=0){return"/"+g.reverse().join("/")+d}return"/"+e.slice(0,c).join("/")+"/"+g.reverse().join("/")+d},getURI:function(d){var c,b=this;if(!b.source||d){c="";if(!d){if(b.protocol){c+=b.protocol+"://"}if(b.userInfo){c+=b.userInfo+"@"}if(b.host){c+=b.host}if(b.port){c+=":"+b.port}}if(b.path){c+=b.path}if(b.query){c+="?"+b.query}if(b.anchor){c+="#"+b.anchor}b.source=c}return b.source}})})();(function(){var a=tinymce.each;tinymce.create("static tinymce.util.Cookie",{getHash:function(d){var b=this.get(d),c;if(b){a(b.split("&"),function(e){e=e.split("=");c=c||{};c[unescape(e[0])]=unescape(e[1])})}return c},setHash:function(j,b,g,f,i,c){var h="";a(b,function(e,d){h+=(!h?"":"&")+escape(d)+"="+escape(e)});this.set(j,h,g,f,i,c)},get:function(i){var h=document.cookie,g,f=i+"=",d;if(!h){return}d=h.indexOf("; "+f);if(d==-1){d=h.indexOf(f);if(d!=0){return null}}else{d+=2}g=h.indexOf(";",d);if(g==-1){g=h.length}return unescape(h.substring(d+f.length,g))},set:function(i,b,g,f,h,c){document.cookie=i+"="+escape(b)+((g)?"; expires="+g.toGMTString():"")+((f)?"; path="+escape(f):"")+((h)?"; domain="+h:"")+((c)?"; secure":"")},remove:function(e,b){var c=new Date();c.setTime(c.getTime()-1000);this.set(e,"",c,b,c)}})})();tinymce.create("static tinymce.util.JSON",{serialize:function(e){var c,a,d=tinymce.util.JSON.serialize,b;if(e==null){return"null"}b=typeof e;if(b=="string"){a="\bb\tt\nn\ff\rr\"\"''\\\\";return'"'+e.replace(/([\u0080-\uFFFF\x00-\x1f\"])/g,function(g,f){c=a.indexOf(f);if(c+1){return"\\"+a.charAt(c+1)}g=f.charCodeAt().toString(16);return"\\u"+"0000".substring(g.length)+g})+'"'}if(b=="object"){if(e.hasOwnProperty&&e instanceof Array){for(c=0,a="[";c<e.length;c++){a+=(c>0?",":"")+d(e[c])}return a+"]"}a="{";for(c in e){a+=typeof e[c]!="function"?(a.length>1?',"':'"')+c+'":'+d(e[c]):""}return a+"}"}return""+e},parse:function(s){try{return eval("("+s+")")}catch(ex){}}});tinymce.create("static tinymce.util.XHR",{send:function(g){var a,e,b=window,h=0;g.scope=g.scope||this;g.success_scope=g.success_scope||g.scope;g.error_scope=g.error_scope||g.scope;g.async=g.async===false?false:true;g.data=g.data||"";function d(i){a=0;try{a=new ActiveXObject(i)}catch(c){}return a}a=b.XMLHttpRequest?new XMLHttpRequest():d("Microsoft.XMLHTTP")||d("Msxml2.XMLHTTP");if(a){if(a.overrideMimeType){a.overrideMimeType(g.content_type)}a.open(g.type||(g.data?"POST":"GET"),g.url,g.async);if(g.content_type){a.setRequestHeader("Content-Type",g.content_type)}a.send(g.data);function f(){if(!g.async||a.readyState==4||h++>10000){if(g.success&&h<10000&&a.status==200){g.success.call(g.success_scope,""+a.responseText,a,g)}else{if(g.error){g.error.call(g.error_scope,h>10000?"TIMED_OUT":"GENERAL",a,g)}}a=null}else{b.setTimeout(f,10)}}if(!g.async){return f()}e=b.setTimeout(f,10)}}});(function(){var c=tinymce.extend,b=tinymce.util.JSON,a=tinymce.util.XHR;tinymce.create("tinymce.util.JSONRequest",{JSONRequest:function(d){this.settings=c({},d);this.count=0},send:function(f){var e=f.error,d=f.success;f=c(this.settings,f);f.success=function(h,g){h=b.parse(h);if(typeof(h)=="undefined"){h={error:"JSON Parse error."}}if(h.error){e.call(f.error_scope||f.scope,h.error,g)}else{d.call(f.success_scope||f.scope,h.result)}};f.error=function(h,g){e.call(f.error_scope||f.scope,h,g)};f.data=b.serialize({id:f.id||"c"+(this.count++),method:f.method,params:f.params});f.content_type="application/json";a.send(f)},"static":{sendRPC:function(d){return new tinymce.util.JSONRequest().send(d)}}})}());(function(c){var e=c.each,b=c.is;var d=c.isWebKit,a=c.isIE;c.create("tinymce.dom.DOMUtils",{doc:null,root:null,files:null,pixelStyles:/^(top|left|bottom|right|width|height|borderWidth)$/,props:{"for":"htmlFor","class":"className",className:"className",checked:"checked",disabled:"disabled",maxlength:"maxLength",readonly:"readOnly",selected:"selected",value:"value",id:"id",name:"name",type:"type"},DOMUtils:function(i,g){var f=this;f.doc=i;f.win=window;f.files={};f.cssFlicker=false;f.counter=0;f.boxModel=!c.isIE||i.compatMode=="CSS1Compat";f.stdMode=i.documentMode===8;f.settings=g=c.extend({keep_values:false,hex_colors:1,process_html:1},g);if(c.isIE6){try{i.execCommand("BackgroundImageCache",false,true)}catch(h){f.cssFlicker=true}}c.addUnload(f.destroy,f)},getRoot:function(){var f=this,g=f.settings;return(g&&f.get(g.root_element))||f.doc.body},getViewPort:function(g){var h,f;g=!g?this.win:g;h=g.document;f=this.boxModel?h.documentElement:h.body;return{x:g.pageXOffset||f.scrollLeft,y:g.pageYOffset||f.scrollTop,w:g.innerWidth||f.clientWidth,h:g.innerHeight||f.clientHeight}},getRect:function(i){var h,f=this,g;i=f.get(i);h=f.getPos(i);g=f.getSize(i);return{x:h.x,y:h.y,w:g.w,h:g.h}},getSize:function(j){var g=this,f,i;j=g.get(j);f=g.getStyle(j,"width");i=g.getStyle(j,"height");if(f.indexOf("px")===-1){f=0}if(i.indexOf("px")===-1){i=0}return{w:parseInt(f)||j.offsetWidth||j.clientWidth,h:parseInt(i)||j.offsetHeight||j.clientHeight}},getParent:function(i,h,g){return this.getParents(i,h,g,false)},getParents:function(p,k,i,m){var h=this,g,j=h.settings,l=[];p=h.get(p);m=m===undefined;if(j.strict_root){i=i||h.getRoot()}if(b(k,"string")){g=k;if(k==="*"){k=function(f){return f.nodeType==1}}else{k=function(f){return h.is(f,g)}}}while(p){if(p==i||!p.nodeType||p.nodeType===9){break}if(!k||k(p)){if(m){l.push(p)}else{return p}}p=p.parentNode}return m?l:null},get:function(f){var g;if(f&&this.doc&&typeof(f)=="string"){g=f;f=this.doc.getElementById(f);if(f&&f.id!==g){return this.doc.getElementsByName(g)[1]}}return f},select:function(h,g){var f=this;return c.dom.Sizzle(h,f.get(g)||f.get(f.settings.root_element)||f.doc,[])},is:function(g,f){return c.dom.Sizzle.matches(f,g.nodeType?[g]:g).length>0},add:function(j,l,f,i,k){var g=this;return this.run(j,function(n){var m,h;m=b(l,"string")?g.doc.createElement(l):l;g.setAttribs(m,f);if(i){if(i.nodeType){m.appendChild(i)}else{g.setHTML(m,i)}}return !k?n.appendChild(m):m})},create:function(i,f,g){return this.add(this.doc.createElement(i),i,f,g,1)},createHTML:function(m,f,j){var l="",i=this,g;l+="<"+m;for(g in f){if(f.hasOwnProperty(g)){l+=" "+g+'="'+i.encode(f[g])+'"'}}if(c.is(j)){return l+">"+j+"</"+m+">"}return l+" />"},remove:function(h,f){var g=this;return this.run(h,function(m){var l,k,j;l=m.parentNode;if(!l){return null}if(f){for(j=m.childNodes.length-1;j>=0;j--){g.insertAfter(m.childNodes[j],m)}}if(g.fixPsuedoLeaks){l=m.cloneNode(true);f="IELeakGarbageBin";k=g.get(f)||g.add(g.doc.body,"div",{id:f,style:"display:none"});k.appendChild(m);k.innerHTML="";return l}return l.removeChild(m)})},setStyle:function(i,f,g){var h=this;return h.run(i,function(l){var k,j;k=l.style;f=f.replace(/-(\D)/g,function(n,m){return m.toUpperCase()});if(h.pixelStyles.test(f)&&(c.is(g,"number")||/^[\-0-9\.]+$/.test(g))){g+="px"}switch(f){case"opacity":if(a){k.filter=g===""?"":"alpha(opacity="+(g*100)+")";if(!i.currentStyle||!i.currentStyle.hasLayout){k.display="inline-block"}}k[f]=k["-moz-opacity"]=k["-khtml-opacity"]=g||"";break;case"float":a?k.styleFloat=g:k.cssFloat=g;break;default:k[f]=g||""}if(h.settings.update_styles){h.setAttrib(l,"mce_style")}})},getStyle:function(i,f,h){i=this.get(i);if(!i){return false}if(this.doc.defaultView&&h){f=f.replace(/[A-Z]/g,function(j){return"-"+j});try{return this.doc.defaultView.getComputedStyle(i,null).getPropertyValue(f)}catch(g){return null}}f=f.replace(/-(\D)/g,function(k,j){return j.toUpperCase()});if(f=="float"){f=a?"styleFloat":"cssFloat"}if(i.currentStyle&&h){return i.currentStyle[f]}return i.style[f]},setStyles:function(i,j){var g=this,h=g.settings,f;f=h.update_styles;h.update_styles=0;e(j,function(k,l){g.setStyle(i,l,k)});h.update_styles=f;if(h.update_styles){g.setAttrib(i,h.cssText)}},setAttrib:function(h,i,f){var g=this;if(!h||!i){return}if(g.settings.strict){i=i.toLowerCase()}return this.run(h,function(k){var j=g.settings;switch(i){case"style":if(!b(f,"string")){e(f,function(l,m){g.setStyle(k,m,l)});return}if(j.keep_values){if(f&&!g._isRes(f)){k.setAttribute("mce_style",f,2)}else{k.removeAttribute("mce_style",2)}}k.style.cssText=f;break;case"class":k.className=f||"";break;case"src":case"href":if(j.keep_values){if(j.url_converter){f=j.url_converter.call(j.url_converter_scope||g,f,i,k)}g.setAttrib(k,"mce_"+i,f,2)}break;case"shape":k.setAttribute("mce_style",f);break}if(b(f)&&f!==null&&f.length!==0){k.setAttribute(i,""+f,2)}else{k.removeAttribute(i,2)}})},setAttribs:function(g,h){var f=this;return this.run(g,function(i){e(h,function(j,k){f.setAttrib(i,k,j)})})},getAttrib:function(i,j,h){var f,g=this;i=g.get(i);if(!i||i.nodeType!==1){return false}if(!b(h)){h=""}if(/^(src|href|style|coords|shape)$/.test(j)){f=i.getAttribute("mce_"+j);if(f){return f}}if(a&&g.props[j]){f=i[g.props[j]];f=f&&f.nodeValue?f.nodeValue:f}if(!f){f=i.getAttribute(j,2)}if(j==="style"){f=f||i.style.cssText;if(f){f=g.serializeStyle(g.parseStyle(f));if(g.settings.keep_values&&!g._isRes(f)){i.setAttribute("mce_style",f)}}}if(d&&j==="class"&&f){f=f.replace(/(apple|webkit)\-[a-z\-]+/gi,"")}if(a){switch(j){case"rowspan":case"colspan":if(f===1){f=""}break;case"size":if(f==="+0"||f===20||f===0){f=""}break;case"width":case"height":case"vspace":case"checked":case"disabled":case"readonly":if(f===0){f=""}break;case"hspace":if(f===-1){f=""}break;case"maxlength":case"tabindex":if(f===32768||f===2147483647||f==="32768"){f=""}break;case"multiple":case"compact":case"noshade":case"nowrap":if(f===65535){return j}return h;case"shape":f=f.toLowerCase();break;default:if(j.indexOf("on")===0&&f){f=(""+f).replace(/^function\s+\w+\(\)\s+\{\s+(.*)\s+\}$/,"$1")}}}return(f!==undefined&&f!==null&&f!=="")?""+f:h},getPos:function(m,i){var g=this,f=0,l=0,j,k=g.doc,h;m=g.get(m);i=i||k.body;if(m){if(a&&!g.stdMode){m=m.getBoundingClientRect();j=g.boxModel?k.documentElement:k.body;f=g.getStyle(g.select("html")[0],"borderWidth");f=(f=="medium"||g.boxModel&&!g.isIE6)&&2||f;m.top+=g.win.self!=g.win.top?2:0;return{x:m.left+j.scrollLeft-f,y:m.top+j.scrollTop-f}}h=m;while(h&&h!=i&&h.nodeType){f+=h.offsetLeft||0;l+=h.offsetTop||0;h=h.offsetParent}h=m.parentNode;while(h&&h!=i&&h.nodeType){f-=h.scrollLeft||0;l-=h.scrollTop||0;h=h.parentNode}}return{x:f,y:l}},parseStyle:function(h){var i=this,j=i.settings,k={};if(!h){return k}function f(w,q,v){var o,u,m,n;o=k[w+"-top"+q];if(!o){return}u=k[w+"-right"+q];if(o!=u){return}m=k[w+"-bottom"+q];if(u!=m){return}n=k[w+"-left"+q];if(m!=n){return}k[v]=n;delete k[w+"-top"+q];delete k[w+"-right"+q];delete k[w+"-bottom"+q];delete k[w+"-left"+q]}function g(n,m,l,p){var o;o=k[m];if(!o){return}o=k[l];if(!o){return}o=k[p];if(!o){return}k[n]=k[m]+" "+k[l]+" "+k[p];delete k[m];delete k[l];delete k[p]}h=h.replace(/&(#?[a-z0-9]+);/g,"&$1_MCE_SEMI_");e(h.split(";"),function(m){var l,n=[];if(m){m=m.replace(/_MCE_SEMI_/g,";");m=m.replace(/url\([^\)]+\)/g,function(o){n.push(o);return"url("+n.length+")"});m=m.split(":");l=c.trim(m[1]);l=l.replace(/url\(([^\)]+)\)/g,function(p,o){return n[parseInt(o)-1]});l=l.replace(/rgb\([^\)]+\)/g,function(o){return i.toHex(o)});if(j.url_converter){l=l.replace(/url\([\'\"]?([^\)\'\"]+)[\'\"]?\)/g,function(o,p){return"url("+j.url_converter.call(j.url_converter_scope||i,i.decode(p),"style",null)+")"})}k[c.trim(m[0]).toLowerCase()]=l}});f("border","","border");f("border","-width","border-width");f("border","-color","border-color");f("border","-style","border-style");f("padding","","padding");f("margin","","margin");g("border","border-width","border-style","border-color");if(a){if(k.border=="medium none"){k.border=""}}return k},serializeStyle:function(g){var f="";e(g,function(i,h){if(h&&i){if(c.isGecko&&h.indexOf("-moz-")===0){return}switch(h){case"color":case"background-color":i=i.toLowerCase();break}f+=(f?" ":"")+h+": "+i+";"}});return f},loadCSS:function(f){var h=this,i=h.doc,g;if(!f){f=""}g=h.select("head")[0];e(f.split(","),function(j){var k;if(h.files[j]){return}h.files[j]=true;k=h.create("link",{rel:"stylesheet",href:c._addVer(j)});if(a&&i.documentMode){k.onload=function(){i.recalc();k.onload=null}}g.appendChild(k)})},addClass:function(f,g){return this.run(f,function(h){var i;if(!g){return 0}if(this.hasClass(h,g)){return h.className}i=this.removeClass(h,g);return h.className=(i!=""?(i+" "):"")+g})},removeClass:function(h,i){var f=this,g;return f.run(h,function(k){var j;if(f.hasClass(k,i)){if(!g){g=new RegExp("(^|\\s+)"+i+"(\\s+|$)","g")}j=k.className.replace(g," ");return k.className=c.trim(j!=" "?j:"")}return k.className})},hasClass:function(g,f){g=this.get(g);if(!g||!f){return false}return(" "+g.className+" ").indexOf(" "+f+" ")!==-1},show:function(f){return this.setStyle(f,"display","block")},hide:function(f){return this.setStyle(f,"display","none")},isHidden:function(f){f=this.get(f);return !f||f.style.display=="none"||this.getStyle(f,"display")=="none"},uniqueId:function(f){return(!f?"mce_":f)+(this.counter++)},setHTML:function(i,g){var f=this;return this.run(i,function(m){var h,k,j,q,l,h;g=f.processHTML(g);if(a){function o(){try{m.innerHTML="<br />"+g;m.removeChild(m.firstChild)}catch(n){while(m.firstChild){m.firstChild.removeNode()}h=f.create("div");h.innerHTML="<br />"+g;e(h.childNodes,function(r,p){if(p){m.appendChild(r)}})}}if(f.settings.fix_ie_paragraphs){g=g.replace(/<p><\/p>|<p([^>]+)><\/p>|<p[^\/+]\/>/gi,'<p$1 mce_keep="true">&nbsp;</p>')}o();if(f.settings.fix_ie_paragraphs){j=m.getElementsByTagName("p");for(k=j.length-1,h=0;k>=0;k--){q=j[k];if(!q.hasChildNodes()){if(!q.mce_keep){h=1;break}q.removeAttribute("mce_keep")}}}if(h){g=g.replace(/<p ([^>]+)>|<p>/g,'<div $1 mce_tmp="1">');g=g.replace(/<\/p>/g,"</div>");o();if(f.settings.fix_ie_paragraphs){j=m.getElementsByTagName("DIV");for(k=j.length-1;k>=0;k--){q=j[k];if(q.mce_tmp){l=f.doc.createElement("p");q.cloneNode(false).outerHTML.replace(/([a-z0-9\-_]+)=/gi,function(p,n){var r;if(n!=="mce_tmp"){r=q.getAttribute(n);if(!r&&n==="class"){r=q.className}l.setAttribute(n,r)}});for(h=0;h<q.childNodes.length;h++){l.appendChild(q.childNodes[h].cloneNode(true))}q.swapNode(l)}}}}}else{m.innerHTML=g}return g})},processHTML:function(j){var g=this,i=g.settings;if(!i.process_html){return j}if(c.isGecko){j=j.replace(/<(\/?)strong>|<strong( [^>]+)>/gi,"<$1b$2>");j=j.replace(/<(\/?)em>|<em( [^>]+)>/gi,"<$1i$2>")}else{if(a){j=j.replace(/&apos;/g,"&#39;");j=j.replace(/\s+(disabled|checked|readonly|selected)\s*=\s*[\"\']?(false|0)[\"\']?/gi,"")}}j=j.replace(/<a( )([^>]+)\/>|<a\/>/gi,"<a$1$2></a>");if(i.keep_values){if(/<script|noscript|style/.test(j)){function f(h){h=h.replace(/(<!--\[CDATA\[|\]\]-->)/g,"\n");h=h.replace(/^[\r\n]*|[\r\n]*$/g,"");h=h.replace(/^\s*(\/\/\s*<!--|\/\/\s*<!\[CDATA\[|<!--|<!\[CDATA\[)[\r\n]*/g,"");h=h.replace(/\s*(\/\/\s*\]\]>|\/\/\s*-->|\]\]>|-->|\]\]-->)\s*$/g,"");return h}j=j.replace(/<script([^>]+|)>([\s\S]*?)<\/script>/g,function(h,l,k){if(!l){l=' type="text/javascript"'}l=l.replace(/(type|language)=\"?/,"$&mce-");l=l.replace(/src=\"([^\"]+)\"?/,function(m,n){if(i.url_converter){n=g.encode(i.url_converter.call(i.url_converter_scope||g,g.decode(n),"src","script"))}return'mce_src="'+n+'"'});if(c.trim(k)){k="<!--\n"+f(k)+"\n// -->"}return"<mce:script"+l+">"+k+"</mce:script>"});j=j.replace(/<style([^>]+|)>([\s\S]*?)<\/style>/g,function(h,l,k){if(k){k="<!--\n"+f(k)+"\n-->"}return"<mce:style"+l+">"+k+"</mce:style><style "+l+' mce_bogus="1">'+k+"</style>"});j=j.replace(/<noscript([^>]+|)>([\s\S]*?)<\/noscript>/g,function(h,l,k){return"<mce:noscript"+l+"><!--"+g.encode(k).replace(/--/g,"&#45;&#45;")+"--></mce:noscript>"})}j=j.replace(/<!\[CDATA\[([\s\S]+)\]\]>/g,"<!--[CDATA[$1]]-->");j=j.replace(/<([\w:]+) [^>]*(src|href|style|shape|coords)[^>]*>/gi,function(h,l){function k(o,n,q){var p=q;if(h.indexOf("mce_"+n)!=-1){return o}if(n=="style"){if(g._isRes(q)){return o}if(i.hex_colors){p=p.replace(/rgb\([^\)]+\)/g,function(m){return g.toHex(m)})}if(i.url_converter){p=p.replace(/url\([\'\"]?([^\)\'\"]+)\)/g,function(m,r){return"url("+g.encode(i.url_converter.call(i.url_converter_scope||g,g.decode(r),n,l))+")"})}}else{if(n!="coords"&&n!="shape"){if(i.url_converter){p=g.encode(i.url_converter.call(i.url_converter_scope||g,g.decode(q),n,l))}}}return" "+n+'="'+q+'" mce_'+n+'="'+p+'"'}h=h.replace(/ (src|href|style|coords|shape)=[\"]([^\"]+)[\"]/gi,k);h=h.replace(/ (src|href|style|coords|shape)=[\']([^\']+)[\']/gi,k);return h.replace(/ (src|href|style|coords|shape)=([^\s\"\'>]+)/gi,k)})}return j},getOuterHTML:function(f){var g;f=this.get(f);if(!f){return null}if(f.outerHTML!==undefined){return f.outerHTML}g=(f.ownerDocument||this.doc).createElement("body");g.appendChild(f.cloneNode(true));return g.innerHTML},setOuterHTML:function(i,g,j){var f=this;return this.run(i,function(h){var l,k;h=f.get(h);j=j||h.ownerDocument||f.doc;if(a&&h.nodeType==1){h.outerHTML=g}else{k=j.createElement("body");k.innerHTML=g;l=k.lastChild;while(l){f.insertAfter(l.cloneNode(true),h);l=l.previousSibling}f.remove(h)}})},decode:function(g){var h,i,f;if(/&[^;]+;/.test(g)){h=this.doc.createElement("div");h.innerHTML=g;i=h.firstChild;f="";if(i){do{f+=i.nodeValue}while(i.nextSibling)}return f||g}return g},encode:function(f){return f?(""+f).replace(/[<>&\"]/g,function(h,g){switch(h){case"&":return"&amp;";case'"':return"&quot;";case"<":return"&lt;";case">":return"&gt;"}return h}):f},insertAfter:function(h,g){var f=this;g=f.get(g);return this.run(h,function(k){var j,i;j=g.parentNode;i=g.nextSibling;if(i){j.insertBefore(k,i)}else{j.appendChild(k)}return k})},isBlock:function(f){if(f.nodeType&&f.nodeType!==1){return false}f=f.nodeName||f;return/^(H[1-6]|HR|P|DIV|ADDRESS|PRE|FORM|TABLE|LI|OL|UL|TR|TD|CAPTION|BLOCKQUOTE|CENTER|DL|DT|DD|DIR|FIELDSET|NOSCRIPT|NOFRAMES|MENU|ISINDEX|SAMP)$/.test(f)},replace:function(i,h,f){var g=this;if(b(h,"array")){i=i.cloneNode(true)}return g.run(h,function(j){if(f){e(j.childNodes,function(k){i.appendChild(k.cloneNode(true))})}if(g.fixPsuedoLeaks&&j.nodeType===1){j.parentNode.insertBefore(i,j);g.remove(j);return i}return j.parentNode.replaceChild(i,j)})},findCommonAncestor:function(h,f){var i=h,g;while(i){g=f;while(g&&i!=g){g=g.parentNode}if(i==g){break}i=i.parentNode}if(!i&&h.ownerDocument){return h.ownerDocument.documentElement}return i},toHex:function(f){var h=/^\s*rgb\s*?\(\s*?([0-9]+)\s*?,\s*?([0-9]+)\s*?,\s*?([0-9]+)\s*?\)\s*$/i.exec(f);function g(i){i=parseInt(i).toString(16);return i.length>1?i:"0"+i}if(h){f="#"+g(h[1])+g(h[2])+g(h[3]);return f}return f},getClasses:function(){var l=this,g=[],k,m={},n=l.settings.class_filter,j;if(l.classes){return l.classes}function o(f){e(f.imports,function(i){o(i)});e(f.cssRules||f.rules,function(i){switch(i.type||1){case 1:if(i.selectorText){e(i.selectorText.split(","),function(p){p=p.replace(/^\s*|\s*$|^\s\./g,"");if(/\.mce/.test(p)||!/\.[\w\-]+$/.test(p)){return}j=p;p=p.replace(/.*\.([a-z0-9_\-]+).*/i,"$1");if(n&&!(p=n(p,j))){return}if(!m[p]){g.push({"class":p});m[p]=1}})}break;case 3:o(i.styleSheet);break}})}try{e(l.doc.styleSheets,o)}catch(h){}if(g.length>0){l.classes=g}return g},run:function(j,i,h){var g=this,k;if(g.doc&&typeof(j)==="string"){j=g.get(j)}if(!j){return false}h=h||this;if(!j.nodeType&&(j.length||j.length===0)){k=[];e(j,function(l,f){if(l){if(typeof(l)=="string"){l=g.doc.getElementById(l)}k.push(i.call(h,l,f))}});return k}return i.call(h,j)},getAttribs:function(g){var f;g=this.get(g);if(!g){return[]}if(a){f=[];if(g.nodeName=="OBJECT"){return g.attributes}g.cloneNode(false).outerHTML.replace(/([a-z0-9\:\-_]+)=/gi,function(i,h){f.push({specified:1,nodeName:h})});return f}return g.attributes},destroy:function(g){var f=this;if(f.events){f.events.destroy()}f.win=f.doc=f.root=f.events=null;if(!g){c.removeUnload(f.destroy)}},createRng:function(){var f=this.doc;return f.createRange?f.createRange():new c.dom.Range(this)},split:function(k,j,n){var o=this,f=o.createRng(),l,i,m;function g(q,p){q=q[p];if(q&&q[p]&&q[p].nodeType==1&&h(q[p])){o.remove(q[p])}}function h(p){p=o.getOuterHTML(p);p=p.replace(/<(img|hr|table)/gi,"-");p=p.replace(/<[^>]+>/g,"");return p.replace(/[ \t\r\n]+|&nbsp;|&#160;/g,"")==""}if(k&&j){f.setStartBefore(k);f.setEndBefore(j);l=f.extractContents();f=o.createRng();f.setStartAfter(j);f.setEndAfter(k);i=f.extractContents();m=k.parentNode;g(l,"lastChild");if(!h(l)){m.insertBefore(l,k)}if(n){m.replaceChild(n,j)}else{m.insertBefore(j,k)}g(i,"firstChild");if(!h(i)){m.insertBefore(i,k)}o.remove(k);return n||j}},bind:function(j,f,i,h){var g=this;if(!g.events){g.events=new c.dom.EventUtils()}return g.events.add(j,f,i,h||this)},unbind:function(i,f,h){var g=this;if(!g.events){g.events=new c.dom.EventUtils()}return g.events.remove(i,f,h)},_isRes:function(f){return/^(top|left|bottom|right|width|height)/i.test(f)||/;\s*(top|left|bottom|right|width|height)/i.test(f)}});c.DOM=new c.dom.DOMUtils(document,{process_html:0})})(tinymce);(function(f){var h=0,c=1,e=2,d=tinymce.extend;function g(m,k){var j,l;if(m.parentNode!=k){return -1}for(l=k.firstChild,j=0;l!=m;l=l.nextSibling){j++}return j}function b(k){var j=0;while(k.previousSibling){j++;k=k.previousSibling}return j}function i(j,k){var l;if(j.nodeType==3){return j}if(k<0){return j}l=j.firstChild;while(l!=null&&k>0){--k;l=l.nextSibling}if(l!=null){return l}return j}function a(k){var j=k.doc;d(this,{dom:k,startContainer:j,startOffset:0,endContainer:j,endOffset:0,collapsed:true,commonAncestorContainer:j,START_TO_START:0,START_TO_END:1,END_TO_END:2,END_TO_START:3})}d(a.prototype,{setStart:function(k,j){this._setEndPoint(true,k,j)},setEnd:function(k,j){this._setEndPoint(false,k,j)},setStartBefore:function(j){this.setStart(j.parentNode,b(j))},setStartAfter:function(j){this.setStart(j.parentNode,b(j)+1)},setEndBefore:function(j){this.setEnd(j.parentNode,b(j))},setEndAfter:function(j){this.setEnd(j.parentNode,b(j)+1)},collapse:function(k){var j=this;if(k){j.endContainer=j.startContainer;j.endOffset=j.startOffset}else{j.startContainer=j.endContainer;j.startOffset=j.endOffset}j.collapsed=true},selectNode:function(j){this.setStartBefore(j);this.setEndAfter(j)},selectNodeContents:function(j){this.setStart(j,0);this.setEnd(j,j.nodeType===1?j.childNodes.length:j.nodeValue.length)},compareBoundaryPoints:function(m,n){var l=this,p=l.startContainer,o=l.startOffset,k=l.endContainer,j=l.endOffset;if(m===0){return l._compareBoundaryPoints(p,o,p,o)}if(m===1){return l._compareBoundaryPoints(p,o,k,j)}if(m===2){return l._compareBoundaryPoints(k,j,k,j)}if(m===3){return l._compareBoundaryPoints(k,j,p,o)}},deleteContents:function(){this._traverse(e)},extractContents:function(){return this._traverse(h)},cloneContents:function(){return this._traverse(c)},insertNode:function(m){var j=this,l,k;if(m.nodeType===3||m.nodeType===4){l=j.startContainer.splitText(j.startOffset);j.startContainer.parentNode.insertBefore(m,l)}else{if(j.startContainer.childNodes.length>0){k=j.startContainer.childNodes[j.startOffset]}j.startContainer.insertBefore(m,k)}},surroundContents:function(l){var j=this,k=j.extractContents();j.insertNode(l);l.appendChild(k);j.selectNode(l)},cloneRange:function(){var j=this;return d(new a(j.dom),{startContainer:j.startContainer,startOffset:j.startOffset,endContainer:j.endContainer,endOffset:j.endOffset,collapsed:j.collapsed,commonAncestorContainer:j.commonAncestorContainer})},_isCollapsed:function(){return(this.startContainer==this.endContainer&&this.startOffset==this.endOffset)},_compareBoundaryPoints:function(m,p,k,o){var q,l,j,r,t,s;if(m==k){if(p==o){return 0}else{if(p<o){return -1}else{return 1}}}q=k;while(q&&q.parentNode!=m){q=q.parentNode}if(q){l=0;j=m.firstChild;while(j!=q&&l<p){l++;j=j.nextSibling}if(p<=l){return -1}else{return 1}}q=m;while(q&&q.parentNode!=k){q=q.parentNode}if(q){l=0;j=k.firstChild;while(j!=q&&l<o){l++;j=j.nextSibling}if(l<o){return -1}else{return 1}}r=this.dom.findCommonAncestor(m,k);t=m;while(t&&t.parentNode!=r){t=t.parentNode}if(!t){t=r}s=k;while(s&&s.parentNode!=r){s=s.parentNode}if(!s){s=r}if(t==s){return 0}j=r.firstChild;while(j){if(j==t){return -1}if(j==s){return 1}j=j.nextSibling}},_setEndPoint:function(k,q,p){var l=this,j,m;if(k){l.startContainer=q;l.startOffset=p}else{l.endContainer=q;l.endOffset=p}j=l.endContainer;while(j.parentNode){j=j.parentNode}m=l.startContainer;while(m.parentNode){m=m.parentNode}if(m!=j){l.collapse(k)}else{if(l._compareBoundaryPoints(l.startContainer,l.startOffset,l.endContainer,l.endOffset)>0){l.collapse(k)}}l.collapsed=l._isCollapsed();l.commonAncestorContainer=l.dom.findCommonAncestor(l.startContainer,l.endContainer)},_traverse:function(r){var s=this,q,m=0,v=0,k,o,l,n,j,u;if(s.startContainer==s.endContainer){return s._traverseSameContainer(r)}for(q=s.endContainer,k=q.parentNode;k!=null;q=k,k=k.parentNode){if(k==s.startContainer){return s._traverseCommonStartContainer(q,r)}++m}for(q=s.startContainer,k=q.parentNode;k!=null;q=k,k=k.parentNode){if(k==s.endContainer){return s._traverseCommonEndContainer(q,r)}++v}o=v-m;l=s.startContainer;while(o>0){l=l.parentNode;o--}n=s.endContainer;while(o<0){n=n.parentNode;o++}for(j=l.parentNode,u=n.parentNode;j!=u;j=j.parentNode,u=u.parentNode){l=j;n=u}return s._traverseCommonAncestors(l,n,r)},_traverseSameContainer:function(o){var r=this,q,u,j,k,l,p,m;if(o!=e){q=r.dom.doc.createDocumentFragment()}if(r.startOffset==r.endOffset){return q}if(r.startContainer.nodeType==3){u=r.startContainer.nodeValue;j=u.substring(r.startOffset,r.endOffset);if(o!=c){r.startContainer.deleteData(r.startOffset,r.endOffset-r.startOffset);r.collapse(true)}if(o==e){return null}q.appendChild(r.dom.doc.createTextNode(j));return q}k=i(r.startContainer,r.startOffset);l=r.endOffset-r.startOffset;while(l>0){p=k.nextSibling;m=r._traverseFullySelected(k,o);if(q){q.appendChild(m)}--l;k=p}if(o!=c){r.collapse(true)}return q},_traverseCommonStartContainer:function(j,p){var s=this,r,k,l,m,q,o;if(p!=e){r=s.dom.doc.createDocumentFragment()}k=s._traverseRightBoundary(j,p);if(r){r.appendChild(k)}l=g(j,s.startContainer);m=l-s.startOffset;if(m<=0){if(p!=c){s.setEndBefore(j);s.collapse(false)}return r}k=j.previousSibling;while(m>0){q=k.previousSibling;o=s._traverseFullySelected(k,p);if(r){r.insertBefore(o,r.firstChild)}--m;k=q}if(p!=c){s.setEndBefore(j);s.collapse(false)}return r},_traverseCommonEndContainer:function(m,p){var s=this,r,o,j,k,q,l;if(p!=e){r=s.dom.doc.createDocumentFragment()}j=s._traverseLeftBoundary(m,p);if(r){r.appendChild(j)}o=g(m,s.endContainer);++o;k=s.endOffset-o;j=m.nextSibling;while(k>0){q=j.nextSibling;l=s._traverseFullySelected(j,p);if(r){r.appendChild(l)}--k;j=q}if(p!=c){s.setStartAfter(m);s.collapse(true)}return r},_traverseCommonAncestors:function(p,j,s){var w=this,l,v,o,q,r,k,u,m;if(s!=e){v=w.dom.doc.createDocumentFragment()}l=w._traverseLeftBoundary(p,s);if(v){v.appendChild(l)}o=p.parentNode;q=g(p,o);r=g(j,o);++q;k=r-q;u=p.nextSibling;while(k>0){m=u.nextSibling;l=w._traverseFullySelected(u,s);if(v){v.appendChild(l)}u=m;--k}l=w._traverseRightBoundary(j,s);if(v){v.appendChild(l)}if(s!=c){w.setStartAfter(p);w.collapse(true)}return v},_traverseRightBoundary:function(p,q){var s=this,l=i(s.endContainer,s.endOffset-1),r,o,n,j,k;var m=l!=s.endContainer;if(l==p){return s._traverseNode(l,m,false,q)}r=l.parentNode;o=s._traverseNode(r,false,false,q);while(r!=null){while(l!=null){n=l.previousSibling;j=s._traverseNode(l,m,false,q);if(q!=e){o.insertBefore(j,o.firstChild)}m=true;l=n}if(r==p){return o}l=r.previousSibling;r=r.parentNode;k=s._traverseNode(r,false,false,q);if(q!=e){k.appendChild(o)}o=k}return null},_traverseLeftBoundary:function(p,q){var s=this,m=i(s.startContainer,s.startOffset);var n=m!=s.startContainer,r,o,l,j,k;if(m==p){return s._traverseNode(m,n,true,q)}r=m.parentNode;o=s._traverseNode(r,false,true,q);while(r!=null){while(m!=null){l=m.nextSibling;j=s._traverseNode(m,n,true,q);if(q!=e){o.appendChild(j)}n=true;m=l}if(r==p){return o}m=r.nextSibling;r=r.parentNode;k=s._traverseNode(r,false,true,q);if(q!=e){k.appendChild(o)}o=k}return null},_traverseNode:function(j,o,r,s){var u=this,m,l,p,k,q;if(o){return u._traverseFullySelected(j,s)}if(j.nodeType==3){m=j.nodeValue;if(r){k=u.startOffset;l=m.substring(k);p=m.substring(0,k)}else{k=u.endOffset;l=m.substring(0,k);p=m.substring(k)}if(s!=c){j.nodeValue=p}if(s==e){return null}q=j.cloneNode(false);q.nodeValue=l;return q}if(s==e){return null}return j.cloneNode(false)},_traverseFullySelected:function(l,k){var j=this;if(k!=e){return k==c?l.cloneNode(true):l}l.parentNode.removeChild(l);return null}});f.Range=a})(tinymce.dom);(function(){function a(e){var d=this,h="\uFEFF",b,g;function c(j,i){if(j&&i){if(j.item&&i.item&&j.item(0)===i.item(0)){return 1}if(j.isEqual&&i.isEqual&&i.isEqual(j)){return 1}}return 0}function f(){var m=e.dom,j=e.getRng(),s=m.createRng(),p,k,n,q,o,l;function i(v){var t=v.parentNode.childNodes,u;for(u=t.length-1;u>=0;u--){if(t[u]==v){return u}}return -1}function r(v){var t=j.duplicate(),B,y,u,w,x=0,z=0,A,C;t.collapse(v);B=t.parentElement();t.pasteHTML(h);u=B.childNodes;for(y=0;y<u.length;y++){w=u[y];if(y>0&&(w.nodeType!==3||u[y-1].nodeType!==3)){z++}if(w.nodeType===3){A=w.nodeValue.indexOf(h);if(A!==-1){x+=A;break}x+=w.nodeValue.length}else{x=0}}t.moveStart("character",-1);t.text="";return{index:z,offset:x,parent:B}}n=j.item?j.item(0):j.parentElement();if(n.ownerDocument!=m.doc){return s}if(j.item||!n.hasChildNodes()){s.setStart(n.parentNode,i(n));s.setEnd(s.startContainer,s.startOffset+1);return s}l=e.isCollapsed();p=r(true);k=r(false);p.parent.normalize();k.parent.normalize();q=p.parent.childNodes[Math.min(p.index,p.parent.childNodes.length-1)];if(q.nodeType!=3){s.setStart(p.parent,p.index)}else{s.setStart(p.parent.childNodes[p.index],p.offset)}o=k.parent.childNodes[Math.min(k.index,k.parent.childNodes.length-1)];if(o.nodeType!=3){if(!l){k.index++}s.setEnd(k.parent,k.index)}else{s.setEnd(k.parent.childNodes[k.index],k.offset)}if(!l){q=s.startContainer;if(q.nodeType==1){s.setStart(q,Math.min(s.startOffset,q.childNodes.length))}o=s.endContainer;if(o.nodeType==1){s.setEnd(o,Math.min(s.endOffset,o.childNodes.length))}}d.addRange(s);return s}this.addRange=function(j){var o,m=e.dom.doc.body,p,k,q,l,n,i;q=j.startContainer;l=j.startOffset;n=j.endContainer;i=j.endOffset;o=m.createTextRange();q=q.nodeType==1?q.childNodes[Math.min(l,q.childNodes.length-1)]:q;n=n.nodeType==1?n.childNodes[Math.min(l==i?i:i-1,n.childNodes.length-1)]:n;if(q==n&&q.nodeType==1){if(/^(IMG|TABLE)$/.test(q.nodeName)&&l!=i){o=m.createControlRange();o.addElement(q)}else{o=m.createTextRange();if(!q.hasChildNodes()&&q.canHaveHTML){q.innerHTML=h}o.moveToElementText(q);if(q.innerHTML==h){o.collapse(true);q.removeChild(q.firstChild)}}if(l==i){o.collapse(i<=j.endContainer.childNodes.length-1)}o.select();return}function r(t,v){var u,s,w;if(t.nodeType!=3){return -1}u=t.nodeValue;s=m.createTextRange();t.nodeValue=u.substring(0,v)+h+u.substring(v);s.moveToElementText(t.parentNode);s.findText(h);w=Math.abs(s.moveStart("character",-1048575));t.nodeValue=u;return w}if(j.collapsed){pos=r(q,l);o=m.createTextRange();o.move("character",pos);o.select();return}else{if(q==n&&q.nodeType==3){p=r(q,l);o.move("character",p);o.moveEnd("character",i-l);o.select();return}p=r(q,l);k=r(n,i);o=m.createTextRange();if(p==-1){o.moveToElementText(q);p=0}else{o.move("character",p)}tmpRng=m.createTextRange();if(k==-1){tmpRng.moveToElementText(n)}else{tmpRng.move("character",k)}o.setEndPoint("EndToEnd",tmpRng);o.select();return}};this.getRangeAt=function(){if(!b||!c(g,e.getRng())){b=f();g=e.getRng()}return b};this.destroy=function(){g=b=null}}tinymce.dom.TridentSelection=a})();(function(){var p=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?/g,i=0,d=Object.prototype.toString,n=false;var b=function(D,t,A,v){A=A||[];var e=t=t||document;if(t.nodeType!==1&&t.nodeType!==9){return[]}if(!D||typeof D!=="string"){return A}var B=[],C,y,G,F,z,s,r=true,w=o(t);p.lastIndex=0;while((C=p.exec(D))!==null){B.push(C[1]);if(C[2]){s=RegExp.rightContext;break}}if(B.length>1&&j.exec(D)){if(B.length===2&&f.relative[B[0]]){y=g(B[0]+B[1],t)}else{y=f.relative[B[0]]?[t]:b(B.shift(),t);while(B.length){D=B.shift();if(f.relative[D]){D+=B.shift()}y=g(D,y)}}}else{if(!v&&B.length>1&&t.nodeType===9&&!w&&f.match.ID.test(B[0])&&!f.match.ID.test(B[B.length-1])){var H=b.find(B.shift(),t,w);t=H.expr?b.filter(H.expr,H.set)[0]:H.set[0]}if(t){var H=v?{expr:B.pop(),set:a(v)}:b.find(B.pop(),B.length===1&&(B[0]==="~"||B[0]==="+")&&t.parentNode?t.parentNode:t,w);y=H.expr?b.filter(H.expr,H.set):H.set;if(B.length>0){G=a(y)}else{r=false}while(B.length){var u=B.pop(),x=u;if(!f.relative[u]){u=""}else{x=B.pop()}if(x==null){x=t}f.relative[u](G,x,w)}}else{G=B=[]}}if(!G){G=y}if(!G){throw"Syntax error, unrecognized expression: "+(u||D)}if(d.call(G)==="[object Array]"){if(!r){A.push.apply(A,G)}else{if(t&&t.nodeType===1){for(var E=0;G[E]!=null;E++){if(G[E]&&(G[E]===true||G[E].nodeType===1&&h(t,G[E]))){A.push(y[E])}}}else{for(var E=0;G[E]!=null;E++){if(G[E]&&G[E].nodeType===1){A.push(y[E])}}}}}else{a(G,A)}if(s){b(s,e,A,v);b.uniqueSort(A)}return A};b.uniqueSort=function(r){if(c){n=false;r.sort(c);if(n){for(var e=1;e<r.length;e++){if(r[e]===r[e-1]){r.splice(e--,1)}}}}};b.matches=function(e,r){return b(e,null,null,r)};b.find=function(x,e,y){var w,u;if(!x){return[]}for(var t=0,s=f.order.length;t<s;t++){var v=f.order[t],u;if((u=f.match[v].exec(x))){var r=RegExp.leftContext;if(r.substr(r.length-1)!=="\\"){u[1]=(u[1]||"").replace(/\\/g,"");w=f.find[v](u,e,y);if(w!=null){x=x.replace(f.match[v],"");break}}}}if(!w){w=e.getElementsByTagName("*")}return{set:w,expr:x}};b.filter=function(A,z,D,t){var s=A,F=[],x=z,v,e,w=z&&z[0]&&o(z[0]);while(A&&z.length){for(var y in f.filter){if((v=f.match[y].exec(A))!=null){var r=f.filter[y],E,C;e=false;if(x==F){F=[]}if(f.preFilter[y]){v=f.preFilter[y](v,x,D,F,t,w);if(!v){e=E=true}else{if(v===true){continue}}}if(v){for(var u=0;(C=x[u])!=null;u++){if(C){E=r(C,v,u,x);var B=t^!!E;if(D&&E!=null){if(B){e=true}else{x[u]=false}}else{if(B){F.push(C);e=true}}}}}if(E!==undefined){if(!D){x=F}A=A.replace(f.match[y],"");if(!e){return[]}break}}}if(A==s){if(e==null){throw"Syntax error, unrecognized expression: "+A}else{break}}s=A}return x};var f=b.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF_-]|\\.)+)/,CLASS:/\.((?:[\w\u00c0-\uFFFF_-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF_-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF_-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*_-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\((even|odd|[\dn+-]*)\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF_-]|\\.)+)(?:\((['"]*)((?:\([^\)]+\)|[^\2\(\)]*)+)\2\))?/},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(e){return e.getAttribute("href")}},relative:{"+":function(x,e,w){var u=typeof e==="string",y=u&&!/\W/.test(e),v=u&&!y;if(y&&!w){e=e.toUpperCase()}for(var t=0,s=x.length,r;t<s;t++){if((r=x[t])){while((r=r.previousSibling)&&r.nodeType!==1){}x[t]=v||r&&r.nodeName===e?r||false:r===e}}if(v){b.filter(e,x,true)}},">":function(w,r,x){var u=typeof r==="string";if(u&&!/\W/.test(r)){r=x?r:r.toUpperCase();for(var s=0,e=w.length;s<e;s++){var v=w[s];if(v){var t=v.parentNode;w[s]=t.nodeName===r?t:false}}}else{for(var s=0,e=w.length;s<e;s++){var v=w[s];if(v){w[s]=u?v.parentNode:v.parentNode===r}}if(u){b.filter(r,w,true)}}},"":function(t,r,v){var s=i++,e=q;if(!r.match(/\W/)){var u=r=v?r:r.toUpperCase();e=m}e("parentNode",r,s,t,u,v)},"~":function(t,r,v){var s=i++,e=q;if(typeof r==="string"&&!r.match(/\W/)){var u=r=v?r:r.toUpperCase();e=m}e("previousSibling",r,s,t,u,v)}},find:{ID:function(r,s,t){if(typeof s.getElementById!=="undefined"&&!t){var e=s.getElementById(r[1]);return e?[e]:[]}},NAME:function(s,v,w){if(typeof v.getElementsByName!=="undefined"){var r=[],u=v.getElementsByName(s[1]);for(var t=0,e=u.length;t<e;t++){if(u[t].getAttribute("name")===s[1]){r.push(u[t])}}return r.length===0?null:r}},TAG:function(e,r){return r.getElementsByTagName(e[1])}},preFilter:{CLASS:function(t,r,s,e,w,x){t=" "+t[1].replace(/\\/g,"")+" ";if(x){return t}for(var u=0,v;(v=r[u])!=null;u++){if(v){if(w^(v.className&&(" "+v.className+" ").indexOf(t)>=0)){if(!s){e.push(v)}}else{if(s){r[u]=false}}}}return false},ID:function(e){return e[1].replace(/\\/g,"")},TAG:function(r,e){for(var s=0;e[s]===false;s++){}return e[s]&&o(e[s])?r[1]:r[1].toUpperCase()},CHILD:function(e){if(e[1]=="nth"){var r=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(e[2]=="even"&&"2n"||e[2]=="odd"&&"2n+1"||!/\D/.test(e[2])&&"0n+"+e[2]||e[2]);e[2]=(r[1]+(r[2]||1))-0;e[3]=r[3]-0}e[0]=i++;return e},ATTR:function(u,r,s,e,v,w){var t=u[1].replace(/\\/g,"");if(!w&&f.attrMap[t]){u[1]=f.attrMap[t]}if(u[2]==="~="){u[4]=" "+u[4]+" "}return u},PSEUDO:function(u,r,s,e,v){if(u[1]==="not"){if(u[3].match(p).length>1||/^\w/.test(u[3])){u[3]=b(u[3],null,null,r)}else{var t=b.filter(u[3],r,s,true^v);if(!s){e.push.apply(e,t)}return false}}else{if(f.match.POS.test(u[0])||f.match.CHILD.test(u[0])){return true}}return u},POS:function(e){e.unshift(true);return e}},filters:{enabled:function(e){return e.disabled===false&&e.type!=="hidden"},disabled:function(e){return e.disabled===true},checked:function(e){return e.checked===true},selected:function(e){e.parentNode.selectedIndex;return e.selected===true},parent:function(e){return !!e.firstChild},empty:function(e){return !e.firstChild},has:function(s,r,e){return !!b(e[3],s).length},header:function(e){return/h\d/i.test(e.nodeName)},text:function(e){return"text"===e.type},radio:function(e){return"radio"===e.type},checkbox:function(e){return"checkbox"===e.type},file:function(e){return"file"===e.type},password:function(e){return"password"===e.type},submit:function(e){return"submit"===e.type},image:function(e){return"image"===e.type},reset:function(e){return"reset"===e.type},button:function(e){return"button"===e.type||e.nodeName.toUpperCase()==="BUTTON"},input:function(e){return/input|select|textarea|button/i.test(e.nodeName)}},setFilters:{first:function(r,e){return e===0},last:function(s,r,e,t){return r===t.length-1},even:function(r,e){return e%2===0},odd:function(r,e){return e%2===1},lt:function(s,r,e){return r<e[3]-0},gt:function(s,r,e){return r>e[3]-0},nth:function(s,r,e){return e[3]-0==r},eq:function(s,r,e){return e[3]-0==r}},filter:{PSEUDO:function(w,s,t,x){var r=s[1],u=f.filters[r];if(u){return u(w,t,s,x)}else{if(r==="contains"){return(w.textContent||w.innerText||"").indexOf(s[3])>=0}else{if(r==="not"){var v=s[3];for(var t=0,e=v.length;t<e;t++){if(v[t]===w){return false}}return true}}}},CHILD:function(e,t){var w=t[1],r=e;switch(w){case"only":case"first":while(r=r.previousSibling){if(r.nodeType===1){return false}}if(w=="first"){return true}r=e;case"last":while(r=r.nextSibling){if(r.nodeType===1){return false}}return true;case"nth":var s=t[2],z=t[3];if(s==1&&z==0){return true}var v=t[0],y=e.parentNode;if(y&&(y.sizcache!==v||!e.nodeIndex)){var u=0;for(r=y.firstChild;r;r=r.nextSibling){if(r.nodeType===1){r.nodeIndex=++u}}y.sizcache=v}var x=e.nodeIndex-z;if(s==0){return x==0}else{return(x%s==0&&x/s>=0)}}},ID:function(r,e){return r.nodeType===1&&r.getAttribute("id")===e},TAG:function(r,e){return(e==="*"&&r.nodeType===1)||r.nodeName===e},CLASS:function(r,e){return(" "+(r.className||r.getAttribute("class"))+" ").indexOf(e)>-1},ATTR:function(v,t){var s=t[1],e=f.attrHandle[s]?f.attrHandle[s](v):v[s]!=null?v[s]:v.getAttribute(s),w=e+"",u=t[2],r=t[4];return e==null?u==="!=":u==="="?w===r:u==="*="?w.indexOf(r)>=0:u==="~="?(" "+w+" ").indexOf(r)>=0:!r?w&&e!==false:u==="!="?w!=r:u==="^="?w.indexOf(r)===0:u==="$="?w.substr(w.length-r.length)===r:u==="|="?w===r||w.substr(0,r.length+1)===r+"-":false},POS:function(u,r,s,v){var e=r[2],t=f.setFilters[e];if(t){return t(u,s,r,v)}}}};var j=f.match.POS;for(var l in f.match){f.match[l]=new RegExp(f.match[l].source+/(?![^\[]*\])(?![^\(]*\))/.source)}var a=function(r,e){r=Array.prototype.slice.call(r);if(e){e.push.apply(e,r);return e}return r};try{Array.prototype.slice.call(document.documentElement.childNodes)}catch(k){a=function(u,t){var r=t||[];if(d.call(u)==="[object Array]"){Array.prototype.push.apply(r,u)}else{if(typeof u.length==="number"){for(var s=0,e=u.length;s<e;s++){r.push(u[s])}}else{for(var s=0;u[s];s++){r.push(u[s])}}}return r}}var c;if(document.documentElement.compareDocumentPosition){c=function(r,e){var s=r.compareDocumentPosition(e)&4?-1:r===e?0:1;if(s===0){n=true}return s}}else{if("sourceIndex" in document.documentElement){c=function(r,e){var s=r.sourceIndex-e.sourceIndex;if(s===0){n=true}return s}}else{if(document.createRange){c=function(t,r){var s=t.ownerDocument.createRange(),e=r.ownerDocument.createRange();s.setStart(t,0);s.setEnd(t,0);e.setStart(r,0);e.setEnd(r,0);var u=s.compareBoundaryPoints(Range.START_TO_END,e);if(u===0){n=true}return u}}}}(function(){var r=document.createElement("div"),s="script"+(new Date).getTime();r.innerHTML="<a name='"+s+"'/>";var e=document.documentElement;e.insertBefore(r,e.firstChild);if(!!document.getElementById(s)){f.find.ID=function(u,v,w){if(typeof v.getElementById!=="undefined"&&!w){var t=v.getElementById(u[1]);return t?t.id===u[1]||typeof t.getAttributeNode!=="undefined"&&t.getAttributeNode("id").nodeValue===u[1]?[t]:undefined:[]}};f.filter.ID=function(v,t){var u=typeof v.getAttributeNode!=="undefined"&&v.getAttributeNode("id");return v.nodeType===1&&u&&u.nodeValue===t}}e.removeChild(r)})();(function(){var e=document.createElement("div");e.appendChild(document.createComment(""));if(e.getElementsByTagName("*").length>0){f.find.TAG=function(r,v){var u=v.getElementsByTagName(r[1]);if(r[1]==="*"){var t=[];for(var s=0;u[s];s++){if(u[s].nodeType===1){t.push(u[s])}}u=t}return u}}e.innerHTML="<a href='#'></a>";if(e.firstChild&&typeof e.firstChild.getAttribute!=="undefined"&&e.firstChild.getAttribute("href")!=="#"){f.attrHandle.href=function(r){return r.getAttribute("href",2)}}})();if(document.querySelectorAll){(function(){var e=b,s=document.createElement("div");s.innerHTML="<p class='TEST'></p>";if(s.querySelectorAll&&s.querySelectorAll(".TEST").length===0){return}b=function(w,v,t,u){v=v||document;if(!u&&v.nodeType===9&&!o(v)){try{return a(v.querySelectorAll(w),t)}catch(x){}}return e(w,v,t,u)};for(var r in e){b[r]=e[r]}})()}if(document.getElementsByClassName&&document.documentElement.getElementsByClassName){(function(){var e=document.createElement("div");e.innerHTML="<div class='test e'></div><div class='test'></div>";if(e.getElementsByClassName("e").length===0){return}e.lastChild.className="e";if(e.getElementsByClassName("e").length===1){return}f.order.splice(1,0,"CLASS");f.find.CLASS=function(r,s,t){if(typeof s.getElementsByClassName!=="undefined"&&!t){return s.getElementsByClassName(r[1])}}})()}function m(r,w,v,A,x,z){var y=r=="previousSibling"&&!z;for(var t=0,s=A.length;t<s;t++){var e=A[t];if(e){if(y&&e.nodeType===1){e.sizcache=v;e.sizset=t}e=e[r];var u=false;while(e){if(e.sizcache===v){u=A[e.sizset];break}if(e.nodeType===1&&!z){e.sizcache=v;e.sizset=t}if(e.nodeName===w){u=e;break}e=e[r]}A[t]=u}}}function q(r,w,v,A,x,z){var y=r=="previousSibling"&&!z;for(var t=0,s=A.length;t<s;t++){var e=A[t];if(e){if(y&&e.nodeType===1){e.sizcache=v;e.sizset=t}e=e[r];var u=false;while(e){if(e.sizcache===v){u=A[e.sizset];break}if(e.nodeType===1){if(!z){e.sizcache=v;e.sizset=t}if(typeof w!=="string"){if(e===w){u=true;break}}else{if(b.filter(w,[e]).length>0){u=e;break}}}e=e[r]}A[t]=u}}}var h=document.compareDocumentPosition?function(r,e){return r.compareDocumentPosition(e)&16}:function(r,e){return r!==e&&(r.contains?r.contains(e):true)};var o=function(e){return e.nodeType===9&&e.documentElement.nodeName!=="HTML"||!!e.ownerDocument&&e.ownerDocument.documentElement.nodeName!=="HTML"};var g=function(e,x){var t=[],u="",v,s=x.nodeType?[x]:x;while((v=f.match.PSEUDO.exec(e))){u+=v[0];e=e.replace(f.match.PSEUDO,"")}e=f.relative[e]?e+"*":e;for(var w=0,r=s.length;w<r;w++){b(e,s[w],t)}return b.filter(u,t)};window.tinymce.dom.Sizzle=b})();(function(d){var f=d.each,c=d.DOM,b=d.isIE,e=d.isWebKit,a;d.create("tinymce.dom.EventUtils",{EventUtils:function(){this.inits=[];this.events=[]},add:function(m,p,l,j){var g,h=this,i=h.events,k;if(p instanceof Array){k=[];f(p,function(o){k.push(h.add(m,o,l,j))});return k}if(m&&m.hasOwnProperty&&m instanceof Array){k=[];f(m,function(n){n=c.get(n);k.push(h.add(n,p,l,j))});return k}m=c.get(m);if(!m){return}g=function(n){if(h.disabled){return}n=n||window.event;if(n&&b){if(!n.target){n.target=n.srcElement}d.extend(n,h._stoppers)}if(!j){return l(n)}return l.call(j,n)};if(p=="unload"){d.unloads.unshift({func:g});return g}if(p=="init"){if(h.domLoaded){g()}else{h.inits.push(g)}return g}i.push({obj:m,name:p,func:l,cfunc:g,scope:j});h._add(m,p,g);return l},remove:function(l,m,k){var h=this,g=h.events,i=false,j;if(l&&l.hasOwnProperty&&l instanceof Array){j=[];f(l,function(n){n=c.get(n);j.push(h.remove(n,m,k))});return j}l=c.get(l);f(g,function(o,n){if(o.obj==l&&o.name==m&&(!k||(o.func==k||o.cfunc==k))){g.splice(n,1);h._remove(l,m,o.cfunc);i=true;return false}});return i},clear:function(l){var j=this,g=j.events,h,k;if(l){l=c.get(l);for(h=g.length-1;h>=0;h--){k=g[h];if(k.obj===l){j._remove(k.obj,k.name,k.cfunc);k.obj=k.cfunc=null;g.splice(h,1)}}}},cancel:function(g){if(!g){return false}this.stop(g);return this.prevent(g)},stop:function(g){if(g.stopPropagation){g.stopPropagation()}else{g.cancelBubble=true}return false},prevent:function(g){if(g.preventDefault){g.preventDefault()}else{g.returnValue=false}return false},destroy:function(){var g=this;f(g.events,function(j,h){g._remove(j.obj,j.name,j.cfunc);j.obj=j.cfunc=null});g.events=[];g=null},_add:function(h,i,g){if(h.attachEvent){h.attachEvent("on"+i,g)}else{if(h.addEventListener){h.addEventListener(i,g,false)}else{h["on"+i]=g}}},_remove:function(i,j,h){if(i){try{if(i.detachEvent){i.detachEvent("on"+j,h)}else{if(i.removeEventListener){i.removeEventListener(j,h,false)}else{i["on"+j]=null}}}catch(g){}}},_pageInit:function(h){var g=this;if(g.domLoaded){return}g.domLoaded=true;f(g.inits,function(i){i()});g.inits=[]},_wait:function(i){var g=this,h=i.document;if(i.tinyMCE_GZ&&tinyMCE_GZ.loaded){g.domLoaded=1;return}if(h.attachEvent){h.attachEvent("onreadystatechange",function(){if(h.readyState==="complete"){h.detachEvent("onreadystatechange",arguments.callee);g._pageInit(i)}});if(h.documentElement.doScroll&&i==i.top){(function(){if(g.domLoaded){return}try{h.documentElement.doScroll("left")}catch(j){setTimeout(arguments.callee,0);return}g._pageInit(i)})()}}else{if(h.addEventListener){g._add(i,"DOMContentLoaded",function(){g._pageInit(i)})}}g._add(i,"load",function(){g._pageInit(i)})},_stoppers:{preventDefault:function(){this.returnValue=false},stopPropagation:function(){this.cancelBubble=true}}});a=d.dom.Event=new d.dom.EventUtils();a._wait(window);d.addUnload(function(){a.destroy()})})(tinymce);(function(a){var b=a.each;a.create("tinymce.dom.Element",{Element:function(g,e){var c=this,f,d;e=e||{};c.id=g;c.dom=f=e.dom||a.DOM;c.settings=e;if(!a.isIE){d=c.dom.get(c.id)}b(["getPos","getRect","getParent","add","setStyle","getStyle","setStyles","setAttrib","setAttribs","getAttrib","addClass","removeClass","hasClass","getOuterHTML","setOuterHTML","remove","show","hide","isHidden","setHTML","get"],function(h){c[h]=function(){var j=[g],k;for(k=0;k<arguments.length;k++){j.push(arguments[k])}j=f[h].apply(f,j);c.update(h);return j}})},on:function(e,d,c){return a.dom.Event.add(this.id,e,d,c)},getXY:function(){return{x:parseInt(this.getStyle("left")),y:parseInt(this.getStyle("top"))}},getSize:function(){var c=this.dom.get(this.id);return{w:parseInt(this.getStyle("width")||c.clientWidth),h:parseInt(this.getStyle("height")||c.clientHeight)}},moveTo:function(c,d){this.setStyles({left:c,top:d})},moveBy:function(c,e){var d=this.getXY();this.moveTo(d.x+c,d.y+e)},resizeTo:function(c,d){this.setStyles({width:c,height:d})},resizeBy:function(c,e){var d=this.getSize();this.resizeTo(d.w+c,d.h+e)},update:function(d){var e=this,c,f=e.dom;if(a.isIE6&&e.settings.blocker){d=d||"";if(d.indexOf("get")===0||d.indexOf("has")===0||d.indexOf("is")===0){return}if(d=="remove"){f.remove(e.blocker);return}if(!e.blocker){e.blocker=f.uniqueId();c=f.add(e.settings.container||f.getRoot(),"iframe",{id:e.blocker,style:"position:absolute;",frameBorder:0,src:'javascript:""'});f.setStyle(c,"opacity",0)}else{c=f.get(e.blocker)}f.setStyle(c,"left",e.getStyle("left",1));f.setStyle(c,"top",e.getStyle("top",1));f.setStyle(c,"width",e.getStyle("width",1));f.setStyle(c,"height",e.getStyle("height",1));f.setStyle(c,"display",e.getStyle("display",1));f.setStyle(c,"zIndex",parseInt(e.getStyle("zIndex",1)||0)-1)}}})})(tinymce);(function(c){function e(f){return f.replace(/[\n\r]+/g,"")}var b=c.is,a=c.isIE,d=c.each;c.create("tinymce.dom.Selection",{Selection:function(i,h,g){var f=this;f.dom=i;f.win=h;f.serializer=g;d(["onBeforeSetContent","onBeforeGetContent","onSetContent","onGetContent"],function(j){f[j]=new c.util.Dispatcher(f)});if(!f.win.getSelection){f.tridentSel=new c.dom.TridentSelection(f)}c.addUnload(f.destroy,f)},getContent:function(g){var f=this,h=f.getRng(),l=f.dom.create("body"),j=f.getSel(),i,k,m;g=g||{};i=k="";g.get=true;g.format=g.format||"html";f.onBeforeGetContent.dispatch(f,g);if(g.format=="text"){return f.isCollapsed()?"":(h.text||(j.toString?j.toString():""))}if(h.cloneContents){m=h.cloneContents();if(m){l.appendChild(m)}}else{if(b(h.item)||b(h.htmlText)){l.innerHTML=h.item?h.item(0).outerHTML:h.htmlText}else{l.innerHTML=h.toString()}}if(/^\s/.test(l.innerHTML)){i=" "}if(/\s+$/.test(l.innerHTML)){k=" "}g.getInner=true;g.content=f.isCollapsed()?"":i+f.serializer.serialize(l,g)+k;f.onGetContent.dispatch(f,g);return g.content},setContent:function(i,g){var f=this,j=f.getRng(),l,k=f.win.document;g=g||{format:"html"};g.set=true;i=g.content=f.dom.processHTML(i);f.onBeforeSetContent.dispatch(f,g);i=g.content;if(j.insertNode){i+='<span id="__caret">_</span>';j.deleteContents();j.insertNode(f.getRng().createContextualFragment(i));l=f.dom.get("__caret");j=k.createRange();j.setStartBefore(l);j.setEndAfter(l);f.setRng(j);f.dom.remove("__caret")}else{if(j.item){k.execCommand("Delete",false,null);j=f.getRng()}j.pasteHTML(i)}f.onSetContent.dispatch(f,g)},getStart:function(){var f=this,g=f.getRng(),h;if(a){if(g.item){return g.item(0)}g=g.duplicate();g.collapse(1);h=g.parentElement();if(h&&h.nodeName=="BODY"){return h.firstChild}return h}else{h=g.startContainer;if(h.nodeName=="BODY"){return h.firstChild}return f.dom.getParent(h,"*")}},getEnd:function(){var f=this,g=f.getRng(),h;if(a){if(g.item){return g.item(0)}g=g.duplicate();g.collapse(0);h=g.parentElement();if(h&&h.nodeName=="BODY"){return h.lastChild}return h}else{h=g.endContainer;if(h.nodeName=="BODY"){return h.lastChild}return f.dom.getParent(h,"*")}},getBookmark:function(x){var j=this,m=j.getRng(),f,n,l,u=j.dom.getViewPort(j.win),v,p,z,o,w=-16777215,k,h=j.dom.getRoot(),g=0,i=0,y;n=u.x;l=u.y;if(x){return{rng:m,scrollX:n,scrollY:l}}if(a){if(m.item){v=m.item(0);d(j.dom.select(v.nodeName),function(s,r){if(v==s){p=r;return false}});return{tag:v.nodeName,index:p,scrollX:n,scrollY:l}}f=j.dom.doc.body.createTextRange();f.moveToElementText(h);f.collapse(true);z=Math.abs(f.move("character",w));f=m.duplicate();f.collapse(true);p=Math.abs(f.move("character",w));f=m.duplicate();f.collapse(false);o=Math.abs(f.move("character",w))-p;return{start:p-z,length:o,scrollX:n,scrollY:l}}v=j.getNode();k=j.getSel();if(!k){return null}if(v&&v.nodeName=="IMG"){return{scrollX:n,scrollY:l}}function q(A,D,t){var s=j.dom.doc.createTreeWalker(A,NodeFilter.SHOW_TEXT,null,false),E,B=0,C={};while((E=s.nextNode())!=null){if(E==D){C.start=B}if(E==t){C.end=B;return C}B+=e(E.nodeValue||"").length}return null}if(k.anchorNode==k.focusNode&&k.anchorOffset==k.focusOffset){v=q(h,k.anchorNode,k.focusNode);if(!v){return{scrollX:n,scrollY:l}}e(k.anchorNode.nodeValue||"").replace(/^\s+/,function(r){g=r.length});return{start:Math.max(v.start+k.anchorOffset-g,0),end:Math.max(v.end+k.focusOffset-g,0),scrollX:n,scrollY:l,beg:k.anchorOffset-g==0}}else{v=q(h,m.startContainer,m.endContainer);if(!v){return{scrollX:n,scrollY:l}}return{start:Math.max(v.start+m.startOffset-g,0),end:Math.max(v.end+m.endOffset-i,0),scrollX:n,scrollY:l,beg:m.startOffset-g==0}}},moveToBookmark:function(n){var o=this,g=o.getRng(),p=o.getSel(),j=o.dom.getRoot(),m,h,k;function i(q,t,D){var B=o.dom.doc.createTreeWalker(q,NodeFilter.SHOW_TEXT,null,false),x,s=0,A={},u,C,z,y;while((x=B.nextNode())!=null){z=y=0;k=x.nodeValue||"";h=e(k).length;s+=h;if(s>=t&&!A.startNode){u=t-(s-h);if(n.beg&&u>=h){continue}A.startNode=x;A.startOffset=u+y}if(s>=D){A.endNode=x;A.endOffset=D-(s-h)+y;return A}}return null}if(!n){return false}o.win.scrollTo(n.scrollX,n.scrollY);if(a){if(g=n.rng){try{g.select()}catch(l){}return true}o.win.focus();if(n.tag){g=j.createControlRange();d(o.dom.select(n.tag),function(r,q){if(q==n.index){g.addElement(r)}})}else{try{if(n.start<0){return true}g=p.createRange();g.moveToElementText(j);g.collapse(true);g.moveStart("character",n.start);g.moveEnd("character",n.length)}catch(f){return true}}try{g.select()}catch(l){}return true}if(!p){return false}if(n.rng){p.removeAllRanges();p.addRange(n.rng)}else{if(b(n.start)&&b(n.end)){try{m=i(j,n.start,n.end);if(m){g=o.dom.doc.createRange();g.setStart(m.startNode,m.startOffset);g.setEnd(m.endNode,m.endOffset);p.removeAllRanges();p.addRange(g)}if(!c.isOpera){o.win.focus()}}catch(l){}}}},select:function(g,l){var p=this,f=p.getRng(),q=p.getSel(),o,m,k,j=p.win.document;function h(u,t){var s,r;if(u){s=j.createTreeWalker(u,NodeFilter.SHOW_TEXT,null,false);while(u=s.nextNode()){r=u;if(c.trim(u.nodeValue).length!=0){if(t){return u}else{r=u}}}}return r}if(a){try{o=j.body;if(/^(IMG|TABLE)$/.test(g.nodeName)){f=o.createControlRange();f.addElement(g)}else{f=o.createTextRange();f.moveToElementText(g)}f.select()}catch(i){}}else{if(l){m=h(g,1)||p.dom.select("br:first",g)[0];k=h(g,0)||p.dom.select("br:last",g)[0];if(m&&k){f=j.createRange();if(m.nodeName=="BR"){f.setStartBefore(m)}else{f.setStart(m,0)}if(k.nodeName=="BR"){f.setEndBefore(k)}else{f.setEnd(k,k.nodeValue.length)}}else{f.selectNode(g)}}else{f.selectNode(g)}p.setRng(f)}return g},isCollapsed:function(){var f=this,h=f.getRng(),g=f.getSel();if(!h||h.item){return false}return !g||h.boundingWidth==0||h.collapsed},collapse:function(f){var g=this,h=g.getRng(),i;if(h.item){i=h.item(0);h=this.win.document.body.createTextRange();h.moveToElementText(i)}h.collapse(!!f);g.setRng(h)},getSel:function(){var g=this,f=this.win;return f.getSelection?f.getSelection():f.document.selection},getRng:function(j){var g=this,h,i;if(j&&g.tridentSel){return g.tridentSel.getRangeAt(0)}try{if(h=g.getSel()){i=h.rangeCount>0?h.getRangeAt(0):(h.createRange?h.createRange():g.win.document.createRange())}}catch(f){}if(!i){i=a?g.win.document.body.createTextRange():g.win.document.createRange()}return i},setRng:function(i){var h,g=this;if(!g.tridentSel){h=g.getSel();if(h){h.removeAllRanges();h.addRange(i)}}else{if(i.cloneRange){g.tridentSel.addRange(i);return}try{i.select()}catch(f){}}},setNode:function(g){var f=this;f.setContent(f.dom.getOuterHTML(g));return g},getNode:function(){var f=this,h=f.getRng(),g=f.getSel(),i;if(!a){if(!h){return f.dom.getRoot()}i=h.commonAncestorContainer;if(!h.collapsed){if(c.isWebKit&&g.anchorNode&&g.anchorNode.nodeType==1){return g.anchorNode.childNodes[g.anchorOffset]}if(h.startContainer==h.endContainer){if(h.startOffset-h.endOffset<2){if(h.startContainer.hasChildNodes()){i=h.startContainer.childNodes[h.startOffset]}}}}return f.dom.getParent(i,"*")}return h.item?h.item(0):h.parentElement()},getSelectedBlocks:function(g,f){var i=this,j=i.dom,m,h,l,k=[];m=j.getParent(g||i.getStart(),j.isBlock);h=j.getParent(f||i.getEnd(),j.isBlock);if(m){k.push(m)}if(m&&h&&m!=h){l=m;while((l=l.nextSibling)&&l!=h){if(j.isBlock(l)){k.push(l)}}}if(h&&m!=h){k.push(h)}return k},destroy:function(g){var f=this;f.win=null;if(f.tridentSel){f.tridentSel.destroy()}if(!g){c.removeUnload(f.destroy)}}})})(tinymce);(function(a){a.create("tinymce.dom.XMLWriter",{node:null,XMLWriter:function(c){function b(){var e=document.implementation;if(!e||!e.createDocument){try{return new ActiveXObject("MSXML2.DOMDocument")}catch(d){}try{return new ActiveXObject("Microsoft.XmlDom")}catch(d){}}else{return e.createDocument("","",null)}}this.doc=b();this.valid=a.isOpera||a.isWebKit;this.reset()},reset:function(){var b=this,c=b.doc;if(c.firstChild){c.removeChild(c.firstChild)}b.node=c.appendChild(c.createElement("html"))},writeStartElement:function(c){var b=this;b.node=b.node.appendChild(b.doc.createElement(c))},writeAttribute:function(c,b){if(this.valid){b=b.replace(/>/g,"%MCGT%")}this.node.setAttribute(c,b)},writeEndElement:function(){this.node=this.node.parentNode},writeFullEndElement:function(){var b=this,c=b.node;c.appendChild(b.doc.createTextNode(""));b.node=c.parentNode},writeText:function(b){if(this.valid){b=b.replace(/>/g,"%MCGT%")}this.node.appendChild(this.doc.createTextNode(b))},writeCDATA:function(b){this.node.appendChild(this.doc.createCDATASection(b))},writeComment:function(b){if(a.isIE){b=b.replace(/^\-|\-$/g," ")}this.node.appendChild(this.doc.createComment(b.replace(/\-\-/g," ")))},getContent:function(){var b;b=this.doc.xml||new XMLSerializer().serializeToString(this.doc);b=b.replace(/<\?[^?]+\?>|<html>|<\/html>|<html\/>|<!DOCTYPE[^>]+>/g,"");b=b.replace(/ ?\/>/g," />");if(this.valid){b=b.replace(/\%MCGT%/g,"&gt;")}return b}})})(tinymce);(function(a){a.create("tinymce.dom.StringWriter",{str:null,tags:null,count:0,settings:null,indent:null,StringWriter:function(b){this.settings=a.extend({indent_char:" ",indentation:0},b);this.reset()},reset:function(){this.indent="";this.str="";this.tags=[];this.count=0},writeStartElement:function(b){this._writeAttributesEnd();this.writeRaw("<"+b);this.tags.push(b);this.inAttr=true;this.count++;this.elementCount=this.count},writeAttribute:function(d,b){var c=this;c.writeRaw(" "+c.encode(d)+'="'+c.encode(b)+'"')},writeEndElement:function(){var b;if(this.tags.length>0){b=this.tags.pop();if(this._writeAttributesEnd(1)){this.writeRaw("</"+b+">")}if(this.settings.indentation>0){this.writeRaw("\n")}}},writeFullEndElement:function(){if(this.tags.length>0){this._writeAttributesEnd();this.writeRaw("</"+this.tags.pop()+">");if(this.settings.indentation>0){this.writeRaw("\n")}}},writeText:function(b){this._writeAttributesEnd();this.writeRaw(this.encode(b));this.count++},writeCDATA:function(b){this._writeAttributesEnd();this.writeRaw("<![CDATA["+b+"]]>");this.count++},writeComment:function(b){this._writeAttributesEnd();this.writeRaw("<!-- "+b+"-->");this.count++},writeRaw:function(b){this.str+=b},encode:function(b){return b.replace(/[<>&"]/g,function(c){switch(c){case"<":return"&lt;";case">":return"&gt;";case"&":return"&amp;";case'"':return"&quot;"}return c})},getContent:function(){return this.str},_writeAttributesEnd:function(b){if(!this.inAttr){return}this.inAttr=false;if(b&&this.elementCount==this.count){this.writeRaw(" />");return false}this.writeRaw(">");return true}})})(tinymce);(function(e){var g=e.extend,f=e.each,b=e.util.Dispatcher,d=e.isIE,a=e.isGecko;function c(h){return h.replace(/([?+*])/g,".$1")}e.create("tinymce.dom.Serializer",{Serializer:function(j){var i=this;i.key=0;i.onPreProcess=new b(i);i.onPostProcess=new b(i);try{i.writer=new e.dom.XMLWriter()}catch(h){i.writer=new e.dom.StringWriter()}i.settings=j=g({dom:e.DOM,valid_nodes:0,node_filter:0,attr_filter:0,invalid_attrs:/^(mce_|_moz_|sizset|sizcache)/,closed:/^(br|hr|input|meta|img|link|param|area)$/,entity_encoding:"named",entities:"160,nbsp,161,iexcl,162,cent,163,pound,164,curren,165,yen,166,brvbar,167,sect,168,uml,169,copy,170,ordf,171,laquo,172,not,173,shy,174,reg,175,macr,176,deg,177,plusmn,178,sup2,179,sup3,180,acute,181,micro,182,para,183,middot,184,cedil,185,sup1,186,ordm,187,raquo,188,frac14,189,frac12,190,frac34,191,iquest,192,Agrave,193,Aacute,194,Acirc,195,Atilde,196,Auml,197,Aring,198,AElig,199,Ccedil,200,Egrave,201,Eacute,202,Ecirc,203,Euml,204,Igrave,205,Iacute,206,Icirc,207,Iuml,208,ETH,209,Ntilde,210,Ograve,211,Oacute,212,Ocirc,213,Otilde,214,Ouml,215,times,216,Oslash,217,Ugrave,218,Uacute,219,Ucirc,220,Uuml,221,Yacute,222,THORN,223,szlig,224,agrave,225,aacute,226,acirc,227,atilde,228,auml,229,aring,230,aelig,231,ccedil,232,egrave,233,eacute,234,ecirc,235,euml,236,igrave,237,iacute,238,icirc,239,iuml,240,eth,241,ntilde,242,ograve,243,oacute,244,ocirc,245,otilde,246,ouml,247,divide,248,oslash,249,ugrave,250,uacute,251,ucirc,252,uuml,253,yacute,254,thorn,255,yuml,402,fnof,913,Alpha,914,Beta,915,Gamma,916,Delta,917,Epsilon,918,Zeta,919,Eta,920,Theta,921,Iota,922,Kappa,923,Lambda,924,Mu,925,Nu,926,Xi,927,Omicron,928,Pi,929,Rho,931,Sigma,932,Tau,933,Upsilon,934,Phi,935,Chi,936,Psi,937,Omega,945,alpha,946,beta,947,gamma,948,delta,949,epsilon,950,zeta,951,eta,952,theta,953,iota,954,kappa,955,lambda,956,mu,957,nu,958,xi,959,omicron,960,pi,961,rho,962,sigmaf,963,sigma,964,tau,965,upsilon,966,phi,967,chi,968,psi,969,omega,977,thetasym,978,upsih,982,piv,8226,bull,8230,hellip,8242,prime,8243,Prime,8254,oline,8260,frasl,8472,weierp,8465,image,8476,real,8482,trade,8501,alefsym,8592,larr,8593,uarr,8594,rarr,8595,darr,8596,harr,8629,crarr,8656,lArr,8657,uArr,8658,rArr,8659,dArr,8660,hArr,8704,forall,8706,part,8707,exist,8709,empty,8711,nabla,8712,isin,8713,notin,8715,ni,8719,prod,8721,sum,8722,minus,8727,lowast,8730,radic,8733,prop,8734,infin,8736,ang,8743,and,8744,or,8745,cap,8746,cup,8747,int,8756,there4,8764,sim,8773,cong,8776,asymp,8800,ne,8801,equiv,8804,le,8805,ge,8834,sub,8835,sup,8836,nsub,8838,sube,8839,supe,8853,oplus,8855,otimes,8869,perp,8901,sdot,8968,lceil,8969,rceil,8970,lfloor,8971,rfloor,9001,lang,9002,rang,9674,loz,9824,spades,9827,clubs,9829,hearts,9830,diams,338,OElig,339,oelig,352,Scaron,353,scaron,376,Yuml,710,circ,732,tilde,8194,ensp,8195,emsp,8201,thinsp,8204,zwnj,8205,zwj,8206,lrm,8207,rlm,8211,ndash,8212,mdash,8216,lsquo,8217,rsquo,8218,sbquo,8220,ldquo,8221,rdquo,8222,bdquo,8224,dagger,8225,Dagger,8240,permil,8249,lsaquo,8250,rsaquo,8364,euro",bool_attrs:/(checked|disabled|readonly|selected|nowrap)/,valid_elements:"*[*]",extended_valid_elements:0,valid_child_elements:0,invalid_elements:0,fix_table_elements:1,fix_list_elements:true,fix_content_duplication:true,convert_fonts_to_spans:false,font_size_classes:0,font_size_style_values:0,apply_source_formatting:0,indent_mode:"simple",indent_char:"\t",indent_levels:1,remove_linebreaks:1,remove_redundant_brs:1,element_format:"xhtml"},j);i.dom=j.dom;if(j.remove_redundant_brs){i.onPostProcess.add(function(k,l){l.content=l.content.replace(/(<br \/>\s*)+<\/(p|h[1-6]|div|li)>/gi,function(n,m,o){if(/^<br \/>\s*<\//.test(n)){return"</"+o+">"}return n})})}if(j.element_format=="html"){i.onPostProcess.add(function(k,l){l.content=l.content.replace(/<([^>]+) \/>/g,"<$1>")})}if(j.fix_list_elements){i.onPreProcess.add(function(v,s){var l,y,w=["ol","ul"],u,t,q,k=/^(OL|UL)$/,z;function m(r,x){var o=x.split(","),p;while((r=r.previousSibling)!=null){for(p=0;p<o.length;p++){if(r.nodeName==o[p]){return r}}}return null}for(y=0;y<w.length;y++){l=i.dom.select(w[y],s.node);for(u=0;u<l.length;u++){t=l[u];q=t.parentNode;if(k.test(q.nodeName)){z=m(t,"LI");if(!z){z=i.dom.create("li");z.innerHTML="&nbsp;";z.appendChild(t);q.insertBefore(z,q.firstChild)}else{z.appendChild(t)}}}}})}if(j.fix_table_elements){i.onPreProcess.add(function(k,l){f(i.dom.select("p table",l.node),function(m){if(d){m.outerHTML=m.outerHTML}i.dom.split(i.dom.getParent(m,"p"),m)})})}},setEntities:function(p){var n=this,j,m,h={},o="",k;if(n.entityLookup){return}j=p.split(",");for(m=0;m<j.length;m+=2){k=j[m];if(k==34||k==38||k==60||k==62){continue}h[String.fromCharCode(j[m])]=j[m+1];k=parseInt(j[m]).toString(16);o+="\\u"+"0000".substring(k.length)+k}if(!o){n.settings.entity_encoding="raw";return}n.entitiesRE=new RegExp("["+o+"]","g");n.entityLookup=h},setValidChildRules:function(h){this.childRules=null;this.addValidChildRules(h)},addValidChildRules:function(k){var j=this,l,h,i;if(!k){return}l="A|BR|SPAN|BDO|MAP|OBJECT|IMG|TT|I|B|BIG|SMALL|EM|STRONG|DFN|CODE|Q|SAMP|KBD|VAR|CITE|ABBR|ACRONYM|SUB|SUP|#text|#comment";h="A|BR|SPAN|BDO|OBJECT|APPLET|IMG|MAP|IFRAME|TT|I|B|U|S|STRIKE|BIG|SMALL|FONT|BASEFONT|EM|STRONG|DFN|CODE|Q|SAMP|KBD|VAR|CITE|ABBR|ACRONYM|SUB|SUP|INPUT|SELECT|TEXTAREA|LABEL|BUTTON|#text|#comment";i="H[1-6]|P|DIV|ADDRESS|PRE|FORM|TABLE|LI|OL|UL|TD|CAPTION|BLOCKQUOTE|CENTER|DL|DT|DD|DIR|FIELDSET|FORM|NOSCRIPT|NOFRAMES|MENU|ISINDEX|SAMP";f(k.split(","),function(n){var o=n.split(/\[|\]/),m;n="";f(o[1].split("|"),function(p){if(n){n+="|"}switch(p){case"%itrans":p=h;break;case"%itrans_na":p=h.substring(2);break;case"%istrict":p=l;break;case"%istrict_na":p=l.substring(2);break;case"%btrans":p=i;break;case"%bstrict":p=i;break}n+=p});m=new RegExp("^("+n.toLowerCase()+")$","i");f(o[0].split("/"),function(p){j.childRules=j.childRules||{};j.childRules[p]=m})});k="";f(j.childRules,function(n,m){if(k){k+="|"}k+=m});j.parentElementsRE=new RegExp("^("+k.toLowerCase()+")$","i")},setRules:function(i){var h=this;h._setup();h.rules={};h.wildRules=[];h.validElements={};return h.addRules(i)},addRules:function(i){var h=this,j;if(!i){return}h._setup();f(i.split(","),function(m){var q=m.split(/\[|\]/),l=q[0].split("/"),r,k,o,n=[];if(j){k=e.extend([],j.attribs)}if(q.length>1){f(q[1].split("|"),function(u){var p={},t;k=k||[];u=u.replace(/::/g,"~");u=/^([!\-])?([\w*.?~_\-]+|)([=:<])?(.+)?$/.exec(u);u[2]=u[2].replace(/~/g,":");if(u[1]=="!"){r=r||[];r.push(u[2])}if(u[1]=="-"){for(t=0;t<k.length;t++){if(k[t].name==u[2]){k.splice(t,1);return}}}switch(u[3]){case"=":p.defaultVal=u[4]||"";break;case":":p.forcedVal=u[4];break;case"<":p.validVals=u[4].split("?");break}if(/[*.?]/.test(u[2])){o=o||[];p.nameRE=new RegExp("^"+c(u[2])+"$");o.push(p)}else{p.name=u[2];k.push(p)}n.push(u[2])})}f(l,function(v,u){var w=v.charAt(0),t=1,p={};if(j){if(j.noEmpty){p.noEmpty=j.noEmpty}if(j.fullEnd){p.fullEnd=j.fullEnd}if(j.padd){p.padd=j.padd}}switch(w){case"-":p.noEmpty=true;break;case"+":p.fullEnd=true;break;case"#":p.padd=true;break;default:t=0}l[u]=v=v.substring(t);h.validElements[v]=1;if(/[*.?]/.test(l[0])){p.nameRE=new RegExp("^"+c(l[0])+"$");h.wildRules=h.wildRules||{};h.wildRules.push(p)}else{p.name=l[0];if(l[0]=="@"){j=p}h.rules[v]=p}p.attribs=k;if(r){p.requiredAttribs=r}if(o){v="";f(n,function(s){if(v){v+="|"}v+="("+c(s)+")"});p.validAttribsRE=new RegExp("^"+v.toLowerCase()+"$");p.wildAttribs=o}})});i="";f(h.validElements,function(m,l){if(i){i+="|"}if(l!="@"){i+=l}});h.validElementsRE=new RegExp("^("+c(i.toLowerCase())+")$")},findRule:function(m){var j=this,l=j.rules,h,k;j._setup();k=l[m];if(k){return k}l=j.wildRules;for(h=0;h<l.length;h++){if(l[h].nameRE.test(m)){return l[h]}}return null},findAttribRule:function(h,l){var j,k=h.wildAttribs;for(j=0;j<k.length;j++){if(k[j].nameRE.test(l)){return k[j]}}return null},serialize:function(m,l){var j,i=this,k;i._setup();l=l||{};l.format=l.format||"html";m=m.cloneNode(true);i.processObj=l;if(e.isWebKit){k=m.ownerDocument.implementation.createHTMLDocument("");k.body.appendChild(m)}i.key=""+(parseInt(i.key)+1);if(!l.no_events){l.node=m;i.onPreProcess.dispatch(i,l)}i.writer.reset();i._serializeNode(m,l.getInner);l.content=i.writer.getContent();if(!l.no_events){i.onPostProcess.dispatch(i,l)}i._postProcess(l);l.node=null;return e.trim(l.content)},_postProcess:function(n){var i=this,k=i.settings,j=n.content,m=[],l;if(n.format=="html"){l=i._protect({content:j,patterns:[{pattern:/(<script[^>]*>)(.*?)(<\/script>)/g},{pattern:/(<noscript[^>]*>)(.*?)(<\/noscript>)/g},{pattern:/(<style[^>]*>)(.*?)(<\/style>)/g},{pattern:/(<pre[^>]*>)(.*?)(<\/pre>)/g,encode:1},{pattern:/(<!--\[CDATA\[)(.*?)(\]\]-->)/g}]});j=l.content;if(k.entity_encoding!=="raw"){j=i._encode(j)}if(!n.set){j=j.replace(/<p>\s+<\/p>|<p([^>]+)>\s+<\/p>/g,k.entity_encoding=="numeric"?"<p$1>&#160;</p>":"<p$1>&nbsp;</p>");if(k.remove_linebreaks){j=j.replace(/\r?\n|\r/g," ");j=j.replace(/(<[^>]+>)\s+/g,"$1 ");j=j.replace(/\s+(<\/[^>]+>)/g," $1");j=j.replace(/<(p|h[1-6]|blockquote|hr|div|table|tbody|tr|td|body|head|html|title|meta|style|pre|script|link|object) ([^>]+)>\s+/g,"<$1 $2>");j=j.replace(/<(p|h[1-6]|blockquote|hr|div|table|tbody|tr|td|body|head|html|title|meta|style|pre|script|link|object)>\s+/g,"<$1>");j=j.replace(/\s+<\/(p|h[1-6]|blockquote|hr|div|table|tbody|tr|td|body|head|html|title|meta|style|pre|script|link|object)>/g,"</$1>")}if(k.apply_source_formatting&&k.indent_mode=="simple"){j=j.replace(/<(\/?)(ul|hr|table|meta|link|tbody|tr|object|body|head|html|map)(|[^>]+)>\s*/g,"\n<$1$2$3>\n");j=j.replace(/\s*<(p|h[1-6]|blockquote|div|title|style|pre|script|td|li|area)(|[^>]+)>/g,"\n<$1$2>");j=j.replace(/<\/(p|h[1-6]|blockquote|div|title|style|pre|script|td|li)>\s*/g,"</$1>\n");j=j.replace(/\n\n/g,"\n")}}j=i._unprotect(j,l);j=j.replace(/<!--\[CDATA\[([\s\S]+)\]\]-->/g,"<![CDATA[$1]]>");j=j.replace(/(type|language)=\"mce-/g,'$1="');if(k.entity_encoding=="raw"){j=j.replace(/<p>&nbsp;<\/p>|<p([^>]+)>&nbsp;<\/p>/g,"<p$1>\u00a0</p>")}j=j.replace(/<noscript([^>]+|)>([\s\S]*?)<\/noscript>/g,function(h,p,o){return"<noscript"+p+">"+i.dom.decode(o.replace(/<!--|-->/g,""))+"</noscript>"})}n.content=j},_serializeNode:function(D,o){var z=this,A=z.settings,x=z.writer,q,j,u,F,E,G,B,h,y,k,r,C,p,m;if(!A.node_filter||A.node_filter(D)){switch(D.nodeType){case 1:if(D.hasAttribute?D.hasAttribute("mce_bogus"):D.getAttribute("mce_bogus")){return}p=false;q=D.hasChildNodes();k=D.getAttribute("mce_name")||D.nodeName.toLowerCase();if(d){if(D.scopeName!=="HTML"&&D.scopeName!=="html"){k=D.scopeName+":"+k}}if(k.indexOf("mce:")===0){k=k.substring(4)}if(!z.validElementsRE||!z.validElementsRE.test(k)||(z.invalidElementsRE&&z.invalidElementsRE.test(k))||o){p=true;break}if(d){if(A.fix_content_duplication){if(D.mce_serialized==z.key){return}D.mce_serialized=z.key}if(k.charAt(0)=="/"){k=k.substring(1)}}else{if(a){if(D.nodeName==="BR"&&D.getAttribute("type")=="_moz"){return}}}if(z.childRules){if(z.parentElementsRE.test(z.elementName)){if(!z.childRules[z.elementName].test(k)){p=true;break}}z.elementName=k}r=z.findRule(k);k=r.name||k;m=A.closed.test(k);if((!q&&r.noEmpty)||(d&&!k)){p=true;break}if(r.requiredAttribs){G=r.requiredAttribs;for(F=G.length-1;F>=0;F--){if(this.dom.getAttrib(D,G[F])!==""){break}}if(F==-1){p=true;break}}x.writeStartElement(k);if(r.attribs){for(F=0,B=r.attribs,E=B.length;F<E;F++){G=B[F];y=z._getAttrib(D,G);if(y!==null){x.writeAttribute(G.name,y)}}}if(r.validAttribsRE){B=z.dom.getAttribs(D);for(F=B.length-1;F>-1;F--){h=B[F];if(h.specified){G=h.nodeName.toLowerCase();if(A.invalid_attrs.test(G)||!r.validAttribsRE.test(G)){continue}C=z.findAttribRule(r,G);y=z._getAttrib(D,C,G);if(y!==null){x.writeAttribute(G,y)}}}}if(k==="script"&&e.trim(D.innerHTML)){x.writeText("// ");x.writeCDATA(D.innerHTML.replace(/<!--|-->|<\[CDATA\[|\]\]>/g,""));q=false;break}if(r.padd){if(q&&(u=D.firstChild)&&u.nodeType===1&&D.childNodes.length===1){if(u.hasAttribute?u.hasAttribute("mce_bogus"):u.getAttribute("mce_bogus")){x.writeText("\u00a0")}}else{if(!q){x.writeText("\u00a0")}}}break;case 3:if(z.childRules&&z.parentElementsRE.test(z.elementName)){if(!z.childRules[z.elementName].test(D.nodeName)){return}}return x.writeText(D.nodeValue);case 4:return x.writeCDATA(D.nodeValue);case 8:return x.writeComment(D.nodeValue)}}else{if(D.nodeType==1){q=D.hasChildNodes()}}if(q&&!m){u=D.firstChild;while(u){z._serializeNode(u);z.elementName=k;u=u.nextSibling}}if(!p){if(!m){x.writeFullEndElement()}else{x.writeEndElement()}}},_protect:function(j){var i=this;j.items=j.items||[];function h(l){return l.replace(/[\r\n\\]/g,function(m){if(m==="\n"){return"\\n"}else{if(m==="\\"){return"\\\\"}}return"\\r"})}function k(l){return l.replace(/\\[\\rn]/g,function(m){if(m==="\\n"){return"\n"}else{if(m==="\\\\"){return"\\"}}return"\r"})}f(j.patterns,function(l){j.content=k(h(j.content).replace(l.pattern,function(n,o,m,p){m=k(m);if(l.encode){m=i._encode(m)}j.items.push(m);return o+"<!--mce:"+(j.items.length-1)+"-->"+p}))});return j},_unprotect:function(i,j){i=i.replace(/\<!--mce:([0-9]+)--\>/g,function(k,h){return j.items[parseInt(h)]});j.items=[];return i},_encode:function(m){var j=this,k=j.settings,i;if(k.entity_encoding!=="raw"){if(k.entity_encoding.indexOf("named")!=-1){j.setEntities(k.entities);i=j.entityLookup;m=m.replace(j.entitiesRE,function(h){var l;if(l=i[h]){h="&"+l+";"}return h})}if(k.entity_encoding.indexOf("numeric")!=-1){m=m.replace(/[\u007E-\uFFFF]/g,function(h){return"&#"+h.charCodeAt(0)+";"})}}return m},_setup:function(){var h=this,i=this.settings;if(h.done){return}h.done=1;h.setRules(i.valid_elements);h.addRules(i.extended_valid_elements);h.addValidChildRules(i.valid_child_elements);if(i.invalid_elements){h.invalidElementsRE=new RegExp("^("+c(i.invalid_elements.replace(/,/g,"|").toLowerCase())+")$")}if(i.attrib_value_filter){h.attribValueFilter=i.attribValueFilter}},_getAttrib:function(m,j,h){var l,k;h=h||j.name;if(j.forcedVal&&(k=j.forcedVal)){if(k==="{$uid}"){return this.dom.uniqueId()}return k}k=this.dom.getAttrib(m,h);if(this.settings.bool_attrs.test(h)&&k){k=(""+k).toLowerCase();if(k==="false"||k==="0"){return null}k=h}switch(h){case"rowspan":case"colspan":if(k=="1"){k=""}break}if(this.attribValueFilter){k=this.attribValueFilter(h,k,m)}if(j.validVals){for(l=j.validVals.length-1;l>=0;l--){if(k==j.validVals[l]){break}}if(l==-1){return null}}if(k===""&&typeof(j.defaultVal)!="undefined"){k=j.defaultVal;if(k==="{$uid}"){return this.dom.uniqueId()}return k}else{if(h=="class"&&this.processObj.get){k=k.replace(/\s?mceItem\w+\s?/g,"")}}if(k===""){return null}return k}})})(tinymce);(function(tinymce){var each=tinymce.each,Event=tinymce.dom.Event;tinymce.create("tinymce.dom.ScriptLoader",{ScriptLoader:function(s){this.settings=s||{};this.queue=[];this.lookup={}},isDone:function(u){return this.lookup[u]?this.lookup[u].state==2:0},markDone:function(u){this.lookup[u]={state:2,url:u}},add:function(u,cb,s,pr){var t=this,lo=t.lookup,o;if(o=lo[u]){if(cb&&o.state==2){cb.call(s||this)}return o}o={state:0,url:u,func:cb,scope:s||this};if(pr){t.queue.unshift(o)}else{t.queue.push(o)}lo[u]=o;return o},load:function(u,cb,s){var t=this,o;if(o=t.lookup[u]){if(cb&&o.state==2){cb.call(s||t)}return o}function loadScript(u){if(Event.domLoaded||t.settings.strict_mode){tinymce.util.XHR.send({url:tinymce._addVer(u),error:t.settings.error,async:false,success:function(co){t.eval(co)}})}else{document.write('<script type="text/javascript" src="'+tinymce._addVer(u)+'"><\/script>')}}if(!tinymce.is(u,"string")){each(u,function(u){loadScript(u)});if(cb){cb.call(s||t)}}else{loadScript(u);if(cb){cb.call(s||t)}}},loadQueue:function(cb,s){var t=this;if(!t.queueLoading){t.queueLoading=1;t.queueCallbacks=[];t.loadScripts(t.queue,function(){t.queueLoading=0;if(cb){cb.call(s||t)}each(t.queueCallbacks,function(o){o.func.call(o.scope)})})}else{if(cb){t.queueCallbacks.push({func:cb,scope:s||t})}}},eval:function(co){var w=window;if(!w.execScript){try{eval.call(w,co)}catch(ex){eval(co,w)}}else{w.execScript(co)}},loadScripts:function(sc,cb,s){var t=this,lo=t.lookup;function done(o){o.state=2;if(o.func){o.func.call(o.scope||t)}}function allDone(){var l;l=sc.length;each(sc,function(o){o=lo[o.url];if(o.state===2){done(o);l--}else{load(o)}});if(l===0&&cb){cb.call(s||t);cb=0}}function load(o){if(o.state>0){return}o.state=1;tinymce.dom.ScriptLoader.loadScript(o.url,function(){done(o);allDone()})}each(sc,function(o){var u=o.url;if(!lo[u]){lo[u]=o;t.queue.push(o)}else{o=lo[u]}if(o.state>0){return}if(!Event.domLoaded&&!t.settings.strict_mode){var ix,ol="";if(cb||o.func){o.state=1;ix=tinymce.dom.ScriptLoader._addOnLoad(function(){done(o);allDone()});if(tinymce.isIE){ol=' onreadystatechange="'}else{ol=' onload="'}ol+="tinymce.dom.ScriptLoader._onLoad(this,'"+u+"',"+ix+');"'}document.write('<script type="text/javascript" src="'+tinymce._addVer(u)+'"'+ol+"><\/script>");if(!o.func){done(o)}}else{load(o)}});allDone()},"static":{_addOnLoad:function(f){var t=this;t._funcs=t._funcs||[];t._funcs.push(f);return t._funcs.length-1},_onLoad:function(e,u,ix){if(!tinymce.isIE||e.readyState=="complete"){this._funcs[ix].call(this)}},loadScript:function(u,cb){var id=tinymce.DOM.uniqueId(),e;function done(){Event.clear(id);tinymce.DOM.remove(id);if(cb){cb.call(document,u);cb=0}}if(tinymce.isIE){tinymce.util.XHR.send({url:tinymce._addVer(u),async:false,success:function(co){window.execScript(co);done()}})}else{e=tinymce.DOM.create("script",{id:id,type:"text/javascript",src:tinymce._addVer(u)});Event.add(e,"load",done);(document.getElementsByTagName("head")[0]||document.body).appendChild(e)}}}});tinymce.ScriptLoader=new tinymce.dom.ScriptLoader()})(tinymce);(function(c){var b=c.DOM,a=c.is;c.create("tinymce.ui.Control",{Control:function(e,d){this.id=e;this.settings=d=d||{};this.rendered=false;this.onRender=new c.util.Dispatcher(this);this.classPrefix="";this.scope=d.scope||this;this.disabled=0;this.active=0},setDisabled:function(d){var f;if(d!=this.disabled){f=b.get(this.id);if(f&&this.settings.unavailable_prefix){if(d){this.prevTitle=f.title;f.title=this.settings.unavailable_prefix+": "+f.title}else{f.title=this.prevTitle}}this.setState("Disabled",d);this.setState("Enabled",!d);this.disabled=d}},isDisabled:function(){return this.disabled},setActive:function(d){if(d!=this.active){this.setState("Active",d);this.active=d}},isActive:function(){return this.active},setState:function(f,d){var e=b.get(this.id);f=this.classPrefix+f;if(d){b.addClass(e,f)}else{b.removeClass(e,f)}},isRendered:function(){return this.rendered},renderHTML:function(){},renderTo:function(d){b.setHTML(d,this.renderHTML())},postRender:function(){var e=this,d;if(a(e.disabled)){d=e.disabled;e.disabled=-1;e.setDisabled(d)}if(a(e.active)){d=e.active;e.active=-1;e.setActive(d)}},remove:function(){b.remove(this.id);this.destroy()},destroy:function(){c.dom.Event.clear(this.id)}})})(tinymce);tinymce.create("tinymce.ui.Container:tinymce.ui.Control",{Container:function(b,a){this.parent(b,a);this.controls=[];this.lookup={}},add:function(a){this.lookup[a.id]=a;this.controls.push(a);return a},get:function(a){return this.lookup[a]}});tinymce.create("tinymce.ui.Separator:tinymce.ui.Control",{Separator:function(b,a){this.parent(b,a);this.classPrefix="mceSeparator"},renderHTML:function(){return tinymce.DOM.createHTML("span",{"class":this.classPrefix})}});(function(d){var c=d.is,b=d.DOM,e=d.each,a=d.walk;d.create("tinymce.ui.MenuItem:tinymce.ui.Control",{MenuItem:function(g,f){this.parent(g,f);this.classPrefix="mceMenuItem"},setSelected:function(f){this.setState("Selected",f);this.selected=f},isSelected:function(){return this.selected},postRender:function(){var f=this;f.parent();if(c(f.selected)){f.setSelected(f.selected)}}})})(tinymce);(function(d){var c=d.is,b=d.DOM,e=d.each,a=d.walk;d.create("tinymce.ui.Menu:tinymce.ui.MenuItem",{Menu:function(h,g){var f=this;f.parent(h,g);f.items={};f.collapsed=false;f.menuCount=0;f.onAddItem=new d.util.Dispatcher(this)},expand:function(g){var f=this;if(g){a(f,function(h){if(h.expand){h.expand()}},"items",f)}f.collapsed=false},collapse:function(g){var f=this;if(g){a(f,function(h){if(h.collapse){h.collapse()}},"items",f)}f.collapsed=true},isCollapsed:function(){return this.collapsed},add:function(f){if(!f.settings){f=new d.ui.MenuItem(f.id||b.uniqueId(),f)}this.onAddItem.dispatch(this,f);return this.items[f.id]=f},addSeparator:function(){return this.add({separator:true})},addMenu:function(f){if(!f.collapse){f=this.createMenu(f)}this.menuCount++;return this.add(f)},hasMenus:function(){return this.menuCount!==0},remove:function(f){delete this.items[f.id]},removeAll:function(){var f=this;a(f,function(g){if(g.removeAll){g.removeAll()}else{g.remove()}g.destroy()},"items",f);f.items={}},createMenu:function(g){var f=new d.ui.Menu(g.id||b.uniqueId(),g);f.onAddItem.add(this.onAddItem.dispatch,this.onAddItem);return f}})})(tinymce);(function(e){var d=e.is,c=e.DOM,f=e.each,a=e.dom.Event,b=e.dom.Element;e.create("tinymce.ui.DropMenu:tinymce.ui.Menu",{DropMenu:function(h,g){g=g||{};g.container=g.container||c.doc.body;g.offset_x=g.offset_x||0;g.offset_y=g.offset_y||0;g.vp_offset_x=g.vp_offset_x||0;g.vp_offset_y=g.vp_offset_y||0;if(d(g.icons)&&!g.icons){g["class"]+=" mceNoIcons"}this.parent(h,g);this.onShowMenu=new e.util.Dispatcher(this);this.onHideMenu=new e.util.Dispatcher(this);this.classPrefix="mceMenu"},createMenu:function(j){var h=this,i=h.settings,g;j.container=j.container||i.container;j.parent=h;j.constrain=j.constrain||i.constrain;j["class"]=j["class"]||i["class"];j.vp_offset_x=j.vp_offset_x||i.vp_offset_x;j.vp_offset_y=j.vp_offset_y||i.vp_offset_y;g=new e.ui.DropMenu(j.id||c.uniqueId(),j);g.onAddItem.add(h.onAddItem.dispatch,h.onAddItem);return g},update:function(){var i=this,j=i.settings,g=c.get("menu_"+i.id+"_tbl"),l=c.get("menu_"+i.id+"_co"),h,k;h=j.max_width?Math.min(g.clientWidth,j.max_width):g.clientWidth;k=j.max_height?Math.min(g.clientHeight,j.max_height):g.clientHeight;if(!c.boxModel){i.element.setStyles({width:h+2,height:k+2})}else{i.element.setStyles({width:h,height:k})}if(j.max_width){c.setStyle(l,"width",h)}if(j.max_height){c.setStyle(l,"height",k);if(g.clientHeight<j.max_height){c.setStyle(l,"overflow","hidden")}}},showMenu:function(p,n,r){var z=this,A=z.settings,o,g=c.getViewPort(),u,l,v,q,i=2,k,j,m=z.classPrefix;z.collapse(1);if(z.isMenuVisible){return}if(!z.rendered){o=c.add(z.settings.container,z.renderNode());f(z.items,function(h){h.postRender()});z.element=new b("menu_"+z.id,{blocker:1,container:A.container})}else{o=c.get("menu_"+z.id)}if(!e.isOpera){c.setStyles(o,{left:-65535,top:-65535})}c.show(o);z.update();p+=A.offset_x||0;n+=A.offset_y||0;g.w-=4;g.h-=4;if(A.constrain){u=o.clientWidth-i;l=o.clientHeight-i;v=g.x+g.w;q=g.y+g.h;if((p+A.vp_offset_x+u)>v){p=r?r-u:Math.max(0,(v-A.vp_offset_x)-u)}if((n+A.vp_offset_y+l)>q){n=Math.max(0,(q-A.vp_offset_y)-l)}}c.setStyles(o,{left:p,top:n});z.element.update();z.isMenuVisible=1;z.mouseClickFunc=a.add(o,"click",function(s){var h;s=s.target;if(s&&(s=c.getParent(s,"tr"))&&!c.hasClass(s,m+"ItemSub")){h=z.items[s.id];if(h.isDisabled()){return}k=z;while(k){if(k.hideMenu){k.hideMenu()}k=k.settings.parent}if(h.settings.onclick){h.settings.onclick(s)}return a.cancel(s)}});if(z.hasMenus()){z.mouseOverFunc=a.add(o,"mouseover",function(w){var h,t,s;w=w.target;if(w&&(w=c.getParent(w,"tr"))){h=z.items[w.id];if(z.lastMenu){z.lastMenu.collapse(1)}if(h.isDisabled()){return}if(w&&c.hasClass(w,m+"ItemSub")){t=c.getRect(w);h.showMenu((t.x+t.w-i),t.y-i,t.x);z.lastMenu=h;c.addClass(c.get(h.id).firstChild,m+"ItemActive")}}})}z.onShowMenu.dispatch(z);if(A.keyboard_focus){a.add(o,"keydown",z._keyHandler,z);c.select("a","menu_"+z.id)[0].focus();z._focusIdx=0}},hideMenu:function(j){var g=this,i=c.get("menu_"+g.id),h;if(!g.isMenuVisible){return}a.remove(i,"mouseover",g.mouseOverFunc);a.remove(i,"click",g.mouseClickFunc);a.remove(i,"keydown",g._keyHandler);c.hide(i);g.isMenuVisible=0;if(!j){g.collapse(1)}if(g.element){g.element.hide()}if(h=c.get(g.id)){c.removeClass(h.firstChild,g.classPrefix+"ItemActive")}g.onHideMenu.dispatch(g)},add:function(i){var g=this,h;i=g.parent(i);if(g.isRendered&&(h=c.get("menu_"+g.id))){g._add(c.select("tbody",h)[0],i)}return i},collapse:function(g){this.parent(g);this.hideMenu(1)},remove:function(g){c.remove(g.id);this.destroy();return this.parent(g)},destroy:function(){var g=this,h=c.get("menu_"+g.id);a.remove(h,"mouseover",g.mouseOverFunc);a.remove(h,"click",g.mouseClickFunc);if(g.element){g.element.remove()}c.remove(h)},renderNode:function(){var i=this,j=i.settings,l,h,k,g;g=c.create("div",{id:"menu_"+i.id,"class":j["class"],style:"position:absolute;left:0;top:0;z-index:200000"});k=c.add(g,"div",{id:"menu_"+i.id+"_co","class":i.classPrefix+(j["class"]?" "+j["class"]:"")});i.element=new b("menu_"+i.id,{blocker:1,container:j.container});if(j.menu_line){c.add(k,"span",{"class":i.classPrefix+"Line"})}l=c.add(k,"table",{id:"menu_"+i.id+"_tbl",border:0,cellPadding:0,cellSpacing:0});h=c.add(l,"tbody");f(i.items,function(m){i._add(h,m)});i.rendered=true;return g},_keyHandler:function(j){var i=this,h=j.keyCode;function g(m){var k=i._focusIdx+m,l=c.select("a","menu_"+i.id)[k];if(l){i._focusIdx=k;l.focus()}}switch(h){case 38:g(-1);return;case 40:g(1);return;case 13:return;case 27:return this.hideMenu()}},_add:function(j,h){var i,q=h.settings,p,l,k,m=this.classPrefix,g;if(q.separator){l=c.add(j,"tr",{id:h.id,"class":m+"ItemSeparator"});c.add(l,"td",{"class":m+"ItemSeparator"});if(i=l.previousSibling){c.addClass(i,"mceLast")}return}i=l=c.add(j,"tr",{id:h.id,"class":m+"Item "+m+"ItemEnabled"});i=k=c.add(i,"td");i=p=c.add(i,"a",{href:"javascript:;",onclick:"return false;",onmousedown:"return false;"});c.addClass(k,q["class"]);g=c.add(i,"span",{"class":"mceIcon"+(q.icon?" mce_"+q.icon:"")});if(q.icon_src){c.add(g,"img",{src:q.icon_src})}i=c.add(i,q.element||"span",{"class":"mceText",title:h.settings.title},h.settings.title);if(h.settings.style){c.setAttrib(i,"style",h.settings.style)}if(j.childNodes.length==1){c.addClass(l,"mceFirst")}if((i=l.previousSibling)&&c.hasClass(i,m+"ItemSeparator")){c.addClass(l,"mceFirst")}if(h.collapse){c.addClass(l,m+"ItemSub")}if(i=l.previousSibling){c.removeClass(i,"mceLast")}c.addClass(l,"mceLast")}})})(tinymce);(function(b){var a=b.DOM;b.create("tinymce.ui.Button:tinymce.ui.Control",{Button:function(d,c){this.parent(d,c);this.classPrefix="mceButton"},renderHTML:function(){var f=this.classPrefix,e=this.settings,d,c;c=a.encode(e.label||"");d='<a id="'+this.id+'" href="javascript:;" class="'+f+" "+f+"Enabled "+e["class"]+(c?" "+f+"Labeled":"")+'" onmousedown="return false;" onclick="return false;" title="'+a.encode(e.title)+'">';if(e.image){d+='<img class="mceIcon" src="'+e.image+'" />'+c+"</a>"}else{d+='<span class="mceIcon '+e["class"]+'"></span>'+(c?'<span class="'+f+'Label">'+c+"</span>":"")+"</a>"}return d},postRender:function(){var c=this,d=c.settings;b.dom.Event.add(c.id,"click",function(f){if(!c.isDisabled()){return d.onclick.call(d.scope,f)}})}})})(tinymce);(function(d){var c=d.DOM,b=d.dom.Event,e=d.each,a=d.util.Dispatcher;d.create("tinymce.ui.ListBox:tinymce.ui.Control",{ListBox:function(h,g){var f=this;f.parent(h,g);f.items=[];f.onChange=new a(f);f.onPostRender=new a(f);f.onAdd=new a(f);f.onRenderMenu=new d.util.Dispatcher(this);f.classPrefix="mceListBox"},select:function(h){var g=this,j,i;if(h==undefined){return g.selectByIndex(-1)}if(h&&h.call){i=h}else{i=function(f){return f==h}}if(h!=g.selectedValue){e(g.items,function(k,f){if(i(k.value)){j=1;g.selectByIndex(f);return false}});if(!j){g.selectByIndex(-1)}}},selectByIndex:function(f){var g=this,h,i;if(f!=g.selectedIndex){h=c.get(g.id+"_text");i=g.items[f];if(i){g.selectedValue=i.value;g.selectedIndex=f;c.setHTML(h,c.encode(i.title));c.removeClass(h,"mceTitle")}else{c.setHTML(h,c.encode(g.settings.title));c.addClass(h,"mceTitle");g.selectedValue=g.selectedIndex=null}h=0}},add:function(i,f,h){var g=this;h=h||{};h=d.extend(h,{title:i,value:f});g.items.push(h);g.onAdd.dispatch(g,h)},getLength:function(){return this.items.length},renderHTML:function(){var i="",f=this,g=f.settings,j=f.classPrefix;i='<table id="'+f.id+'" cellpadding="0" cellspacing="0" class="'+j+" "+j+"Enabled"+(g["class"]?(" "+g["class"]):"")+'"><tbody><tr>';i+="<td>"+c.createHTML("a",{id:f.id+"_text",href:"javascript:;","class":"mceText",onclick:"return false;",onmousedown:"return false;"},c.encode(f.settings.title))+"</td>";i+="<td>"+c.createHTML("a",{id:f.id+"_open",tabindex:-1,href:"javascript:;","class":"mceOpen",onclick:"return false;",onmousedown:"return false;"},"<span></span>")+"</td>";i+="</tr></tbody></table>";return i},showMenu:function(){var g=this,j,i,h=c.get(this.id),f;if(g.isDisabled()||g.items.length==0){return}if(g.menu&&g.menu.isMenuVisible){return g.hideMenu()}if(!g.isMenuRendered){g.renderMenu();g.isMenuRendered=true}j=c.getPos(this.settings.menu_container);i=c.getPos(h);f=g.menu;f.settings.offset_x=i.x;f.settings.offset_y=i.y;f.settings.keyboard_focus=!d.isOpera;if(g.oldID){f.items[g.oldID].setSelected(0)}e(g.items,function(k){if(k.value===g.selectedValue){f.items[k.id].setSelected(1);g.oldID=k.id}});f.showMenu(0,h.clientHeight);b.add(c.doc,"mousedown",g.hideMenu,g);c.addClass(g.id,g.classPrefix+"Selected")},hideMenu:function(g){var f=this;if(g&&g.type=="mousedown"&&(g.target.id==f.id+"_text"||g.target.id==f.id+"_open")){return}if(!g||!c.getParent(g.target,".mceMenu")){c.removeClass(f.id,f.classPrefix+"Selected");b.remove(c.doc,"mousedown",f.hideMenu,f);if(f.menu){f.menu.hideMenu()}}},renderMenu:function(){var g=this,f;f=g.settings.control_manager.createDropMenu(g.id+"_menu",{menu_line:1,"class":g.classPrefix+"Menu mceNoIcons",max_width:150,max_height:150});f.onHideMenu.add(g.hideMenu,g);f.add({title:g.settings.title,"class":"mceMenuItemTitle",onclick:function(){if(g.settings.onselect("")!==false){g.select("")}}});e(g.items,function(h){h.id=c.uniqueId();h.onclick=function(){if(g.settings.onselect(h.value)!==false){g.select(h.value)}};f.add(h)});g.onRenderMenu.dispatch(g,f);g.menu=f},postRender:function(){var f=this,g=f.classPrefix;b.add(f.id,"click",f.showMenu,f);b.add(f.id+"_text","focus",function(h){if(!f._focused){f.keyDownHandler=b.add(f.id+"_text","keydown",function(l){var i=-1,j,k=l.keyCode;e(f.items,function(m,n){if(f.selectedValue==m.value){i=n}});if(k==38){j=f.items[i-1]}else{if(k==40){j=f.items[i+1]}else{if(k==13){j=f.selectedValue;f.selectedValue=null;f.settings.onselect(j);return b.cancel(l)}}}if(j){f.hideMenu();f.select(j.value)}})}f._focused=1});b.add(f.id+"_text","blur",function(){b.remove(f.id+"_text","keydown",f.keyDownHandler);f._focused=0});if(d.isIE6||!c.boxModel){b.add(f.id,"mouseover",function(){if(!c.hasClass(f.id,g+"Disabled")){c.addClass(f.id,g+"Hover")}});b.add(f.id,"mouseout",function(){if(!c.hasClass(f.id,g+"Disabled")){c.removeClass(f.id,g+"Hover")}})}f.onPostRender.dispatch(f,c.get(f.id))},destroy:function(){this.parent();b.clear(this.id+"_text");b.clear(this.id+"_open")}})})(tinymce);(function(d){var c=d.DOM,b=d.dom.Event,e=d.each,a=d.util.Dispatcher;d.create("tinymce.ui.NativeListBox:tinymce.ui.ListBox",{NativeListBox:function(g,f){this.parent(g,f);this.classPrefix="mceNativeListBox"},setDisabled:function(f){c.get(this.id).disabled=f},isDisabled:function(){return c.get(this.id).disabled},select:function(h){var g=this,j,i;if(h==undefined){return g.selectByIndex(-1)}if(h&&h.call){i=h}else{i=function(f){return f==h}}if(h!=g.selectedValue){e(g.items,function(k,f){if(i(k.value)){j=1;g.selectByIndex(f);return false}});if(!j){g.selectByIndex(-1)}}},selectByIndex:function(f){c.get(this.id).selectedIndex=f+1;this.selectedValue=this.items[f]?this.items[f].value:null},add:function(j,g,f){var i,h=this;f=f||{};f.value=g;if(h.isRendered()){c.add(c.get(this.id),"option",f,j)}i={title:j,value:g,attribs:f};h.items.push(i);h.onAdd.dispatch(h,i)},getLength:function(){return c.get(this.id).options.length-1},renderHTML:function(){var g,f=this;g=c.createHTML("option",{value:""},"-- "+f.settings.title+" --");e(f.items,function(h){g+=c.createHTML("option",{value:h.value},h.title)});g=c.createHTML("select",{id:f.id,"class":"mceNativeListBox"},g);return g},postRender:function(){var g=this,h;g.rendered=true;function f(j){var i=g.items[j.target.selectedIndex-1];if(i&&(i=i.value)){g.onChange.dispatch(g,i);if(g.settings.onselect){g.settings.onselect(i)}}}b.add(g.id,"change",f);b.add(g.id,"keydown",function(j){var i;b.remove(g.id,"change",h);i=b.add(g.id,"blur",function(){b.add(g.id,"change",f);b.remove(g.id,"blur",i)});if(j.keyCode==13||j.keyCode==32){f(j);return b.cancel(j)}});g.onPostRender.dispatch(g,c.get(g.id))}})})(tinymce);(function(c){var b=c.DOM,a=c.dom.Event,d=c.each;c.create("tinymce.ui.MenuButton:tinymce.ui.Button",{MenuButton:function(f,e){this.parent(f,e);this.onRenderMenu=new c.util.Dispatcher(this);e.menu_container=e.menu_container||b.doc.body},showMenu:function(){var g=this,j,i,h=b.get(g.id),f;if(g.isDisabled()){return}if(!g.isMenuRendered){g.renderMenu();g.isMenuRendered=true}if(g.isMenuVisible){return g.hideMenu()}j=b.getPos(g.settings.menu_container);i=b.getPos(h);f=g.menu;f.settings.offset_x=i.x;f.settings.offset_y=i.y;f.settings.vp_offset_x=i.x;f.settings.vp_offset_y=i.y;f.settings.keyboard_focus=g._focused;f.showMenu(0,h.clientHeight);a.add(b.doc,"mousedown",g.hideMenu,g);g.setState("Selected",1);g.isMenuVisible=1},renderMenu:function(){var f=this,e;e=f.settings.control_manager.createDropMenu(f.id+"_menu",{menu_line:1,"class":this.classPrefix+"Menu",icons:f.settings.icons});e.onHideMenu.add(f.hideMenu,f);f.onRenderMenu.dispatch(f,e);f.menu=e},hideMenu:function(g){var f=this;if(g&&g.type=="mousedown"&&b.getParent(g.target,function(h){return h.id===f.id||h.id===f.id+"_open"})){return}if(!g||!b.getParent(g.target,".mceMenu")){f.setState("Selected",0);a.remove(b.doc,"mousedown",f.hideMenu,f);if(f.menu){f.menu.hideMenu()}}f.isMenuVisible=0},postRender:function(){var e=this,f=e.settings;a.add(e.id,"click",function(){if(!e.isDisabled()){if(f.onclick){f.onclick(e.value)}e.showMenu()}})}})})(tinymce);(function(c){var b=c.DOM,a=c.dom.Event,d=c.each;c.create("tinymce.ui.SplitButton:tinymce.ui.MenuButton",{SplitButton:function(f,e){this.parent(f,e);this.classPrefix="mceSplitButton"},renderHTML:function(){var i,f=this,g=f.settings,e;i="<tbody><tr>";if(g.image){e=b.createHTML("img ",{src:g.image,"class":"mceAction "+g["class"]})}else{e=b.createHTML("span",{"class":"mceAction "+g["class"]},"")}i+="<td>"+b.createHTML("a",{id:f.id+"_action",href:"javascript:;","class":"mceAction "+g["class"],onclick:"return false;",onmousedown:"return false;",title:g.title},e)+"</td>";e=b.createHTML("span",{"class":"mceOpen "+g["class"]});i+="<td>"+b.createHTML("a",{id:f.id+"_open",href:"javascript:;","class":"mceOpen "+g["class"],onclick:"return false;",onmousedown:"return false;",title:g.title},e)+"</td>";i+="</tr></tbody>";return b.createHTML("table",{id:f.id,"class":"mceSplitButton mceSplitButtonEnabled "+g["class"],cellpadding:"0",cellspacing:"0",onmousedown:"return false;",title:g.title},i)},postRender:function(){var e=this,f=e.settings;if(f.onclick){a.add(e.id+"_action","click",function(){if(!e.isDisabled()){f.onclick(e.value)}})}a.add(e.id+"_open","click",e.showMenu,e);a.add(e.id+"_open","focus",function(){e._focused=1});a.add(e.id+"_open","blur",function(){e._focused=0});if(c.isIE6||!b.boxModel){a.add(e.id,"mouseover",function(){if(!b.hasClass(e.id,"mceSplitButtonDisabled")){b.addClass(e.id,"mceSplitButtonHover")}});a.add(e.id,"mouseout",function(){if(!b.hasClass(e.id,"mceSplitButtonDisabled")){b.removeClass(e.id,"mceSplitButtonHover")}})}},destroy:function(){this.parent();a.clear(this.id+"_action");a.clear(this.id+"_open")}})})(tinymce);(function(d){var c=d.DOM,a=d.dom.Event,b=d.is,e=d.each;d.create("tinymce.ui.ColorSplitButton:tinymce.ui.SplitButton",{ColorSplitButton:function(h,g){var f=this;f.parent(h,g);f.settings=g=d.extend({colors:"000000,993300,333300,003300,003366,000080,333399,333333,800000,FF6600,808000,008000,008080,0000FF,666699,808080,FF0000,FF9900,99CC00,339966,33CCCC,3366FF,800080,999999,FF00FF,FFCC00,FFFF00,00FF00,00FFFF,00CCFF,993366,C0C0C0,FF99CC,FFCC99,FFFF99,CCFFCC,CCFFFF,99CCFF,CC99FF,FFFFFF",grid_width:8,default_color:"#888888"},f.settings);f.onShowMenu=new d.util.Dispatcher(f);f.onHideMenu=new d.util.Dispatcher(f);f.value=g.default_color},showMenu:function(){var f=this,g,j,i,h;if(f.isDisabled()){return}if(!f.isMenuRendered){f.renderMenu();f.isMenuRendered=true}if(f.isMenuVisible){return f.hideMenu()}i=c.get(f.id);c.show(f.id+"_menu");c.addClass(i,"mceSplitButtonSelected");h=c.getPos(i);c.setStyles(f.id+"_menu",{left:h.x,top:h.y+i.clientHeight,zIndex:200000});i=0;a.add(c.doc,"mousedown",f.hideMenu,f);f.onShowMenu.dispatch(f);if(f._focused){f._keyHandler=a.add(f.id+"_menu","keydown",function(k){if(k.keyCode==27){f.hideMenu()}});c.select("a",f.id+"_menu")[0].focus()}f.isMenuVisible=1},hideMenu:function(g){var f=this;if(g&&g.type=="mousedown"&&c.getParent(g.target,function(h){return h.id===f.id+"_open"})){return}if(!g||!c.getParent(g.target,".mceSplitButtonMenu")){c.removeClass(f.id,"mceSplitButtonSelected");a.remove(c.doc,"mousedown",f.hideMenu,f);a.remove(f.id+"_menu","keydown",f._keyHandler);c.hide(f.id+"_menu")}f.onHideMenu.dispatch(f);f.isMenuVisible=0},renderMenu:function(){var k=this,f,j=0,l=k.settings,p,h,o,g;g=c.add(l.menu_container,"div",{id:k.id+"_menu","class":l.menu_class+" "+l["class"],style:"position:absolute;left:0;top:-1000px;"});f=c.add(g,"div",{"class":l["class"]+" mceSplitButtonMenu"});c.add(f,"span",{"class":"mceMenuLine"});p=c.add(f,"table",{"class":"mceColorSplitMenu"});h=c.add(p,"tbody");j=0;e(b(l.colors,"array")?l.colors:l.colors.split(","),function(i){i=i.replace(/^#/,"");if(!j--){o=c.add(h,"tr");j=l.grid_width-1}p=c.add(o,"td");p=c.add(p,"a",{href:"javascript:;",style:{backgroundColor:"#"+i},mce_color:"#"+i})});if(l.more_colors_func){p=c.add(h,"tr");p=c.add(p,"td",{colspan:l.grid_width,"class":"mceMoreColors"});p=c.add(p,"a",{id:k.id+"_more",href:"javascript:;",onclick:"return false;","class":"mceMoreColors"},l.more_colors_title);a.add(p,"click",function(i){l.more_colors_func.call(l.more_colors_scope||this);return a.cancel(i)})}c.addClass(f,"mceColorSplitMenu");a.add(k.id+"_menu","click",function(i){var m;i=i.target;if(i.nodeName=="A"&&(m=i.getAttribute("mce_color"))){k.setColor(m)}return a.cancel(i)});return g},setColor:function(g){var f=this;c.setStyle(f.id+"_preview","backgroundColor",g);f.value=g;f.hideMenu();f.settings.onselect(g)},postRender:function(){var f=this,g=f.id;f.parent();c.add(g+"_action","div",{id:g+"_preview","class":"mceColorPreview"});c.setStyle(f.id+"_preview","backgroundColor",f.value)},destroy:function(){this.parent();a.clear(this.id+"_menu");a.clear(this.id+"_more");c.remove(this.id+"_menu")}})})(tinymce);tinymce.create("tinymce.ui.Toolbar:tinymce.ui.Container",{renderHTML:function(){var l=this,e="",g,j,b=tinymce.DOM,m=l.settings,d,a,f,k;k=l.controls;for(d=0;d<k.length;d++){j=k[d];a=k[d-1];f=k[d+1];if(d===0){g="mceToolbarStart";if(j.Button){g+=" mceToolbarStartButton"}else{if(j.SplitButton){g+=" mceToolbarStartSplitButton"}else{if(j.ListBox){g+=" mceToolbarStartListBox"}}}e+=b.createHTML("td",{"class":g},b.createHTML("span",null,"<!-- IE -->"))}if(a&&j.ListBox){if(a.Button||a.SplitButton){e+=b.createHTML("td",{"class":"mceToolbarEnd"},b.createHTML("span",null,"<!-- IE -->"))}}if(b.stdMode){e+='<td style="position: relative">'+j.renderHTML()+"</td>"}else{e+="<td>"+j.renderHTML()+"</td>"}if(f&&j.ListBox){if(f.Button||f.SplitButton){e+=b.createHTML("td",{"class":"mceToolbarStart"},b.createHTML("span",null,"<!-- IE -->"))}}}g="mceToolbarEnd";if(j.Button){g+=" mceToolbarEndButton"}else{if(j.SplitButton){g+=" mceToolbarEndSplitButton"}else{if(j.ListBox){g+=" mceToolbarEndListBox"}}}e+=b.createHTML("td",{"class":g},b.createHTML("span",null,"<!-- IE -->"));return b.createHTML("table",{id:l.id,"class":"mceToolbar"+(m["class"]?" "+m["class"]:""),cellpadding:"0",cellspacing:"0",align:l.settings.align||""},"<tbody><tr>"+e+"</tr></tbody>")}});(function(b){var a=b.util.Dispatcher,c=b.each;b.create("tinymce.AddOnManager",{items:[],urls:{},lookup:{},onAdd:new a(this),get:function(d){return this.lookup[d]},requireLangPack:function(f){var d,e=b.EditorManager.settings;if(e&&e.language){d=this.urls[f]+"/langs/"+e.language+".js";if(!b.dom.Event.domLoaded&&!e.strict_mode){b.ScriptLoader.load(d)}else{b.ScriptLoader.add(d)}}},add:function(e,d){this.items.push(d);this.lookup[e]=d;this.onAdd.dispatch(this,e,d);return d},load:function(h,e,d,g){var f=this;if(f.urls[h]){return}if(e.indexOf("/")!=0&&e.indexOf("://")==-1){e=b.baseURL+"/"+e}f.urls[h]=e.substring(0,e.lastIndexOf("/"));b.ScriptLoader.add(e,d,g)}});b.PluginManager=new b.AddOnManager();b.ThemeManager=new b.AddOnManager()}(tinymce));(function(f){var g=f.each,h=f.extend,e=f.DOM,a=f.dom.Event,c=f.ThemeManager,b=f.PluginManager,d=f.explode;f.create("static tinymce.EditorManager",{editors:{},i18n:{},activeEditor:null,preInit:function(){var i=this,j=window.location;f.documentBaseURL=j.href.replace(/[\?#].*$/,"").replace(/[\/\\][^\/]+$/,"");if(!/[\/\\]$/.test(f.documentBaseURL)){f.documentBaseURL+="/"}f.baseURL=new f.util.URI(f.documentBaseURL).toAbsolute(f.baseURL);f.EditorManager.baseURI=new f.util.URI(f.baseURL);i.onBeforeUnload=new f.util.Dispatcher(i);a.add(window,"beforeunload",function(k){i.onBeforeUnload.dispatch(i,k)})},init:function(q){var p=this,l,k=f.ScriptLoader,o,n,i=[],m;function j(u,v,r){var t=u[v];if(!t){return}if(f.is(t,"string")){r=t.replace(/\.\w+$/,"");r=r?f.resolve(r):0;t=f.resolve(t)}return t.apply(r||this,Array.prototype.slice.call(arguments,2))}q=h({theme:"simple",language:"en",strict_loading_mode:document.contentType=="application/xhtml+xml"},q);p.settings=q;if(!a.domLoaded&&!q.strict_loading_mode){if(q.language){k.add(f.baseURL+"/langs/"+q.language+".js")}if(q.theme&&q.theme.charAt(0)!="-"&&!c.urls[q.theme]){c.load(q.theme,"themes/"+q.theme+"/editor_template"+f.suffix+".js")}if(q.plugins){l=d(q.plugins);if(f.inArray(l,"compat2x")!=-1){b.load("compat2x","plugins/compat2x/editor_plugin"+f.suffix+".js")}g(l,function(r){if(r&&r.charAt(0)!="-"&&!b.urls[r]){if(!f.isWebKit&&r=="safari"){return}b.load(r,"plugins/"+r+"/editor_plugin"+f.suffix+".js")}})}k.loadQueue()}a.add(document,"init",function(){var r,t;j(q,"onpageload");if(q.browsers){r=false;g(d(q.browsers),function(u){switch(u){case"ie":case"msie":if(f.isIE){r=true}break;case"gecko":if(f.isGecko){r=true}break;case"safari":case"webkit":if(f.isWebKit){r=true}break;case"opera":if(f.isOpera){r=true}break}});if(!r){return}}switch(q.mode){case"exact":r=q.elements||"";if(r.length>0){g(d(r),function(u){if(e.get(u)){m=new f.Editor(u,q);i.push(m);m.render(1)}else{o=0;g(document.forms,function(v){g(v.elements,function(w){if(w.name===u){u="mce_editor_"+o;e.setAttrib(w,"id",u);m=new f.Editor(u,q);i.push(m);m.render(1)}})})}})}break;case"textareas":case"specific_textareas":function s(v,u){return u.constructor===RegExp?u.test(v.className):e.hasClass(v,u)}g(e.select("textarea"),function(u){if(q.editor_deselector&&s(u,q.editor_deselector)){return}if(!q.editor_selector||s(u,q.editor_selector)){n=e.get(u.name);if(!u.id&&!n){u.id=u.name}if(!u.id||p.get(u.id)){u.id=e.uniqueId()}m=new f.Editor(u.id,q);i.push(m);m.render(1)}});break}if(q.oninit){r=t=0;g(i,function(u){t++;if(!u.initialized){u.onInit.add(function(){r++;if(r==t){j(q,"oninit")}})}else{r++}if(r==t){j(q,"oninit")}})}})},get:function(i){return this.editors[i]},getInstanceById:function(i){return this.get(i)},add:function(i){this.editors[i.id]=i;this._setActive(i);return i},remove:function(j){var i=this;if(!i.editors[j.id]){return null}delete i.editors[j.id];if(i.activeEditor==j){i._setActive(null);g(i.editors,function(k){i._setActive(k);return false})}j.destroy();return j},execCommand:function(o,m,l){var n=this,k=n.get(l),i;switch(o){case"mceFocus":k.focus();return true;case"mceAddEditor":case"mceAddControl":if(!n.get(l)){new f.Editor(l,n.settings).render()}return true;case"mceAddFrameControl":i=l.window;i.tinyMCE=tinyMCE;i.tinymce=f;f.DOM.doc=i.document;f.DOM.win=i;k=new f.Editor(l.element_id,l);k.render();if(f.isIE){function j(){k.destroy();i.detachEvent("onunload",j);i=i.tinyMCE=i.tinymce=null}i.attachEvent("onunload",j)}l.page_window=null;return true;case"mceRemoveEditor":case"mceRemoveControl":if(k){k.remove()}return true;case"mceToggleEditor":if(!k){n.execCommand("mceAddControl",0,l);return true}if(k.isHidden()){k.show()}else{k.hide()}return true}if(n.activeEditor){return n.activeEditor.execCommand(o,m,l)}return false},execInstanceCommand:function(m,l,k,j){var i=this.get(m);if(i){return i.execCommand(l,k,j)}return false},triggerSave:function(){g(this.editors,function(i){i.save()})},addI18n:function(k,l){var i,j=this.i18n;if(!f.is(k,"string")){g(k,function(n,m){g(n,function(q,p){g(q,function(s,r){if(p==="common"){j[m+"."+r]=s}else{j[m+"."+p+"."+r]=s}})})})}else{g(l,function(n,m){j[k+"."+m]=n})}},_setActive:function(i){this.selectedInstance=this.activeEditor=i}});f.EditorManager.preInit()})(tinymce);var tinyMCE=window.tinyMCE=tinymce.EditorManager;(function(n){var o=n.DOM,k=n.dom.Event,f=n.extend,l=n.util.Dispatcher;var j=n.each,a=n.isGecko,b=n.isIE,e=n.isWebKit;var d=n.is,h=n.ThemeManager,c=n.PluginManager,i=n.EditorManager;var p=n.inArray,m=n.grep,g=n.explode;n.create("tinymce.Editor",{Editor:function(u,r){var q=this;q.id=q.editorId=u;q.execCommands={};q.queryStateCommands={};q.queryValueCommands={};q.plugins={};j(["onPreInit","onBeforeRenderUI","onPostRender","onInit","onRemove","onActivate","onDeactivate","onClick","onEvent","onMouseUp","onMouseDown","onDblClick","onKeyDown","onKeyUp","onKeyPress","onContextMenu","onSubmit","onReset","onPaste","onPreProcess","onPostProcess","onBeforeSetContent","onBeforeGetContent","onSetContent","onGetContent","onLoadContent","onSaveContent","onNodeChange","onChange","onBeforeExecCommand","onExecCommand","onUndo","onRedo","onVisualAid","onSetProgressState"],function(s){q[s]=new l(q)});q.settings=r=f({id:u,language:"en",docs_language:"en",theme:"simple",skin:"default",delta_width:0,delta_height:0,popup_css:"",plugins:"",document_base_url:n.documentBaseURL,add_form_submit_trigger:1,submit_patch:1,add_unload_trigger:1,convert_urls:1,relative_urls:1,remove_script_host:1,table_inline_editing:0,object_resizing:1,cleanup:1,accessibility_focus:1,custom_shortcuts:1,custom_undo_redo_keyboard_shortcuts:1,custom_undo_redo_restore_selection:1,custom_undo_redo:1,doctype:'<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">',visual_table_class:"mceItemTable",visual:1,inline_styles:true,convert_fonts_to_spans:true,font_size_style_values:"xx-small,x-small,small,medium,large,x-large,xx-large",apply_source_formatting:1,directionality:"ltr",forced_root_block:"p",valid_elements:"@[id|class|style|title|dir<ltr?rtl|lang|xml::lang|onclick|ondblclick|onmousedown|onmouseup|onmouseover|onmousemove|onmouseout|onkeypress|onkeydown|onkeyup],a[rel|rev|charset|hreflang|tabindex|accesskey|type|name|href|target|title|class|onfocus|onblur],strong/b,em/i,strike,u,#p[align],-ol[type|compact],-ul[type|compact],-li,br,img[longdesc|usemap|src|border|alt=|title|hspace|vspace|width|height|align],-sub,-sup,-blockquote[cite],-table[border=0|cellspacing|cellpadding|width|frame|rules|height|align|summary|bgcolor|background|bordercolor],-tr[rowspan|width|height|align|valign|bgcolor|background|bordercolor],tbody,thead,tfoot,#td[colspan|rowspan|width|height|align|valign|bgcolor|background|bordercolor|scope],#th[colspan|rowspan|width|height|align|valign|scope],caption,-div,-span,-code,-pre,address,-h1,-h2,-h3,-h4,-h5,-h6,hr[size|noshade],-font[face|size|color],dd,dl,dt,cite,abbr,acronym,del[datetime|cite],ins[datetime|cite],object[classid|width|height|codebase|*],param[name|value],embed[type|width|height|src|*],script[src|type],map[name],area[shape|coords|href|alt|target],bdo,button,col[align|char|charoff|span|valign|width],colgroup[align|char|charoff|span|valign|width],dfn,fieldset,form[action|accept|accept-charset|enctype|method],input[accept|alt|checked|disabled|maxlength|name|readonly|size|src|type|value|tabindex|accesskey],kbd,label[for],legend,noscript,optgroup[label|disabled],option[disabled|label|selected|value],q[cite],samp,select[disabled|multiple|name|size],small,textarea[cols|rows|disabled|name|readonly],tt,var,big",hidden_input:1,padd_empty_editor:1,render_ui:1,init_theme:1,force_p_newlines:1,indentation:"30px",keep_styles:1,fix_table_elements:1,removeformat_selector:"span,b,strong,em,i,font,u,strike"},r);q.documentBaseURI=new n.util.URI(r.document_base_url||n.documentBaseURL,{base_uri:tinyMCE.baseURI});q.baseURI=i.baseURI;q.execCallback("setup",q)},render:function(u){var v=this,w=v.settings,x=v.id,q=n.ScriptLoader;if(!k.domLoaded){k.add(document,"init",function(){v.render()});return}if(!u){w.strict_loading_mode=1;tinyMCE.settings=w}if(!v.getElement()){return}if(w.strict_loading_mode){q.settings.strict_mode=w.strict_loading_mode;n.DOM.settings.strict=1}if(!/TEXTAREA|INPUT/i.test(v.getElement().nodeName)&&w.hidden_input&&o.getParent(x,"form")){o.insertAfter(o.create("input",{type:"hidden",name:x}),x)}if(n.WindowManager){v.windowManager=new n.WindowManager(v)}if(w.encoding=="xml"){v.onGetContent.add(function(s,t){if(t.save){t.content=o.encode(t.content)}})}if(w.add_form_submit_trigger){v.onSubmit.addToTop(function(){if(v.initialized){v.save();v.isNotDirty=1}})}if(w.add_unload_trigger){v._beforeUnload=tinyMCE.onBeforeUnload.add(function(){if(v.initialized&&!v.destroyed&&!v.isHidden()){v.save({format:"raw",no_events:true})}})}n.addUnload(v.destroy,v);if(w.submit_patch){v.onBeforeRenderUI.add(function(){var s=v.getElement().form;if(!s){return}if(s._mceOldSubmit){return}if(!s.submit.nodeType&&!s.submit.length){v.formElement=s;s._mceOldSubmit=s.submit;s.submit=function(){i.triggerSave();v.isNotDirty=1;return v.formElement._mceOldSubmit(v.formElement)}}s=null})}function r(){if(w.language){q.add(n.baseURL+"/langs/"+w.language+".js")}if(w.theme&&w.theme.charAt(0)!="-"&&!h.urls[w.theme]){h.load(w.theme,"themes/"+w.theme+"/editor_template"+n.suffix+".js")}j(g(w.plugins),function(s){if(s&&s.charAt(0)!="-"&&!c.urls[s]){if(!e&&s=="safari"){return}c.load(s,"plugins/"+s+"/editor_plugin"+n.suffix+".js")}});q.loadQueue(function(){if(!v.removed){v.init()}})}if(w.plugins.indexOf("compat2x")!=-1){c.load("compat2x","plugins/compat2x/editor_plugin"+n.suffix+".js");q.loadQueue(r)}else{r()}},init:function(){var v,F=this,G=F.settings,C,z,B=F.getElement(),r,q,D,y,A,E;i.add(F);if(G.theme){G.theme=G.theme.replace(/-/,"");r=h.get(G.theme);F.theme=new r();if(F.theme.init&&G.init_theme){F.theme.init(F,h.urls[G.theme]||n.documentBaseURL.replace(/\/$/,""))}}j(g(G.plugins.replace(/\-/g,"")),function(w){var H=c.get(w),t=c.urls[w]||n.documentBaseURL.replace(/\/$/,""),s;if(H){s=new H(F,t);F.plugins[w]=s;if(s.init){s.init(F,t)}}});if(G.popup_css!==false){if(G.popup_css){G.popup_css=F.documentBaseURI.toAbsolute(G.popup_css)}else{G.popup_css=F.baseURI.toAbsolute("themes/"+G.theme+"/skins/"+G.skin+"/dialog.css")}}if(G.popup_css_add){G.popup_css+=","+F.documentBaseURI.toAbsolute(G.popup_css_add)}F.controlManager=new n.ControlManager(F);F.undoManager=new n.UndoManager(F);F.undoManager.onAdd.add(function(t,s){if(!s.initial){return F.onChange.dispatch(F,s,t)}});F.undoManager.onUndo.add(function(t,s){return F.onUndo.dispatch(F,s,t)});F.undoManager.onRedo.add(function(t,s){return F.onRedo.dispatch(F,s,t)});if(G.custom_undo_redo){F.onExecCommand.add(function(t,w,u,H,s){if(w!="Undo"&&w!="Redo"&&w!="mceRepaint"&&(!s||!s.skip_undo)){F.undoManager.add()}})}F.onExecCommand.add(function(s,t){if(!/^(FontName|FontSize)$/.test(t)){F.nodeChanged()}});if(a){function x(s,t){if(!t||!t.initial){F.execCommand("mceRepaint")}}F.onUndo.add(x);F.onRedo.add(x);F.onSetContent.add(x)}F.onBeforeRenderUI.dispatch(F,F.controlManager);if(G.render_ui){C=G.width||B.style.width||B.offsetWidth;z=G.height||B.style.height||B.offsetHeight;F.orgDisplay=B.style.display;E=/^[0-9\.]+(|px)$/i;if(E.test(""+C)){C=Math.max(parseInt(C)+(r.deltaWidth||0),100)}if(E.test(""+z)){z=Math.max(parseInt(z)+(r.deltaHeight||0),100)}r=F.theme.renderUI({targetNode:B,width:C,height:z,deltaWidth:G.delta_width,deltaHeight:G.delta_height});F.editorContainer=r.editorContainer}if(document.domain&&location.hostname!=document.domain){n.relaxedDomain=document.domain}o.setStyles(r.sizeContainer||r.editorContainer,{width:C,height:z});z=(r.iframeHeight||z)+(typeof(z)=="number"?(r.deltaHeight||0):"");if(z<100){z=100}F.iframeHTML=G.doctype+'<html><head xmlns="http://www.w3.org/1999/xhtml">';if(G.document_base_url!=n.documentBaseURL){F.iframeHTML+='<base href="'+F.documentBaseURI.getURI()+'" />'}F.iframeHTML+='<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />';if(n.relaxedDomain){F.iframeHTML+='<script type="text/javascript">document.domain = "'+n.relaxedDomain+'";<\/script>'}y=G.body_id||"tinymce";if(y.indexOf("=")!=-1){y=F.getParam("body_id","","hash");y=y[F.id]||y}A=G.body_class||"";if(A.indexOf("=")!=-1){A=F.getParam("body_class","","hash");A=A[F.id]||""}F.iframeHTML+='</head><body id="'+y+'" class="mceContentBody '+A+'"></body></html>';if(n.relaxedDomain){if(b||(n.isOpera&&parseFloat(opera.version())>=9.5)){D='javascript:(function(){document.open();document.domain="'+document.domain+'";var ed = window.parent.tinyMCE.get("'+F.id+'");document.write(ed.iframeHTML);document.close();ed.setupIframe();})()'}else{if(n.isOpera){D='javascript:(function(){document.open();document.domain="'+document.domain+'";document.close();ed.setupIframe();})()'}}}v=o.add(r.iframeContainer,"iframe",{id:F.id+"_ifr",src:D||'javascript:""',frameBorder:"0",style:{width:"100%",height:z}});F.contentAreaContainer=r.iframeContainer;o.get(r.editorContainer).style.display=F.orgDisplay;o.get(F.id).style.display="none";if(!b||!n.relaxedDomain){F.setupIframe()}B=v=r=null},setupIframe:function(){var z=this,A=z.settings,u=o.get(z.id),v=z.getDoc(),r,x;if(!b||!n.relaxedDomain){v.open();v.write(z.iframeHTML);v.close()}if(!b){try{if(!A.readonly){v.designMode="On"}}catch(w){}}if(b){x=z.getBody();o.hide(x);if(!A.readonly){x.contentEditable=true}o.show(x)}z.dom=new n.DOM.DOMUtils(z.getDoc(),{keep_values:true,url_converter:z.convertURL,url_converter_scope:z,hex_colors:A.force_hex_style_colors,class_filter:A.class_filter,update_styles:1,fix_ie_paragraphs:1});z.serializer=new n.dom.Serializer({entity_encoding:A.entity_encoding,entities:A.entities,valid_elements:A.verify_html===false?"*[*]":A.valid_elements,extended_valid_elements:A.extended_valid_elements,valid_child_elements:A.valid_child_elements,invalid_elements:A.invalid_elements,fix_table_elements:A.fix_table_elements,fix_list_elements:A.fix_list_elements,fix_content_duplication:A.fix_content_duplication,convert_fonts_to_spans:A.convert_fonts_to_spans,font_size_classes:A.font_size_classes,font_size_style_values:A.font_size_style_values,apply_source_formatting:A.apply_source_formatting,remove_linebreaks:A.remove_linebreaks,element_format:A.element_format,dom:z.dom});z.selection=new n.dom.Selection(z.dom,z.getWin(),z.serializer);z.forceBlocks=new n.ForceBlocks(z,{forced_root_block:A.forced_root_block});z.editorCommands=new n.EditorCommands(z);z.serializer.onPreProcess.add(function(s,t){return z.onPreProcess.dispatch(z,t,s)});z.serializer.onPostProcess.add(function(s,t){return z.onPostProcess.dispatch(z,t,s)});z.onPreInit.dispatch(z);if(!A.gecko_spellcheck){z.getBody().spellcheck=0}if(!A.readonly){z._addEvents()}z.controlManager.onPostRender.dispatch(z,z.controlManager);z.onPostRender.dispatch(z);if(A.directionality){z.getBody().dir=A.directionality}if(A.nowrap){z.getBody().style.whiteSpace="nowrap"}if(A.custom_elements){function y(s,t){j(g(A.custom_elements),function(B){var C;if(B.indexOf("~")===0){B=B.substring(1);C="span"}else{C="div"}t.content=t.content.replace(new RegExp("<("+B+")([^>]*)>","g"),"<"+C+' mce_name="$1"$2>');t.content=t.content.replace(new RegExp("</("+B+")>","g"),"</"+C+">")})}z.onBeforeSetContent.add(y);z.onPostProcess.add(function(s,t){if(t.set){y(s,t)}})}if(A.handle_node_change_callback){z.onNodeChange.add(function(t,s,B){z.execCallback("handle_node_change_callback",z.id,B,-1,-1,true,z.selection.isCollapsed())})}if(A.save_callback){z.onSaveContent.add(function(s,B){var t=z.execCallback("save_callback",z.id,B.content,z.getBody());if(t){B.content=t}})}if(A.onchange_callback){z.onChange.add(function(t,s){z.execCallback("onchange_callback",z,s)})}if(A.convert_newlines_to_brs){z.onBeforeSetContent.add(function(s,t){if(t.initial){t.content=t.content.replace(/\r?\n/g,"<br />")}})}if(A.fix_nesting&&b){z.onBeforeSetContent.add(function(s,t){t.content=z._fixNesting(t.content)})}if(A.preformatted){z.onPostProcess.add(function(s,t){t.content=t.content.replace(/^\s*<pre.*?>/,"");t.content=t.content.replace(/<\/pre>\s*$/,"");if(t.set){t.content='<pre class="mceItemHidden">'+t.content+"</pre>"}})}if(A.verify_css_classes){z.serializer.attribValueFilter=function(D,B){var C,t;if(D=="class"){if(!z.classesRE){t=z.dom.getClasses();if(t.length>0){C="";j(t,function(s){C+=(C?"|":"")+s["class"]});z.classesRE=new RegExp("("+C+")","gi")}}return !z.classesRE||/(\bmceItem\w+\b|\bmceTemp\w+\b)/g.test(B)||z.classesRE.test(B)?B:""}return B}}if(A.convert_fonts_to_spans){z._convertFonts()}if(A.inline_styles){z._convertInlineElements()}if(A.cleanup_callback){z.onBeforeSetContent.add(function(s,t){t.content=z.execCallback("cleanup_callback","insert_to_editor",t.content,t)});z.onPreProcess.add(function(s,t){if(t.set){z.execCallback("cleanup_callback","insert_to_editor_dom",t.node,t)}if(t.get){z.execCallback("cleanup_callback","get_from_editor_dom",t.node,t)}});z.onPostProcess.add(function(s,t){if(t.set){t.content=z.execCallback("cleanup_callback","insert_to_editor",t.content,t)}if(t.get){t.content=z.execCallback("cleanup_callback","get_from_editor",t.content,t)}})}if(A.save_callback){z.onGetContent.add(function(s,t){if(t.save){t.content=z.execCallback("save_callback",z.id,t.content,z.getBody())}})}if(A.handle_event_callback){z.onEvent.add(function(s,t,B){if(z.execCallback("handle_event_callback",t,s,B)===false){k.cancel(t)}})}z.onSetContent.add(function(){z.addVisual(z.getBody())});if(A.padd_empty_editor){z.onPostProcess.add(function(s,t){t.content=t.content.replace(/^(<p[^>]*>(&nbsp;|&#160;|\s|\u00a0|)<\/p>[\r\n]*|<br \/>[\r\n]*)$/,"")})}if(a){function q(s,t){j(s.dom.select("a"),function(C){var B=C.parentNode;if(s.dom.isBlock(B)&&B.lastChild===C){s.dom.add(B,"br",{mce_bogus:1})}})}z.onExecCommand.add(function(s,t){if(t==="CreateLink"){q(s)}});z.onSetContent.add(z.selection.onSetContent.add(q));if(!A.readonly){try{v.designMode="Off";v.designMode="On"}catch(w){}}}setTimeout(function(){if(z.removed){return}z.load({initial:true,format:(A.cleanup_on_startup?"html":"raw")});z.startContent=z.getContent({format:"raw"});z.undoManager.add({initial:true});z.initialized=true;z.onInit.dispatch(z);z.execCallback("setupcontent_callback",z.id,z.getBody(),z.getDoc());z.execCallback("init_instance_callback",z);z.focus(true);z.nodeChanged({initial:1});if(A.content_css){n.each(g(A.content_css),function(s){z.dom.loadCSS(z.documentBaseURI.toAbsolute(s))})}if(A.auto_focus){setTimeout(function(){var s=i.get(A.auto_focus);s.selection.select(s.getBody(),1);s.selection.collapse(1);s.getWin().focus()},100)}},1);u=null},focus:function(r){var u,q=this,s=q.settings.content_editable;if(!r){if(!s&&(!b||q.selection.getNode().ownerDocument!=q.getDoc())){q.getWin().focus()}}if(i.activeEditor!=q){if((u=i.activeEditor)!=null){u.onDeactivate.dispatch(u,q)}q.onActivate.dispatch(q,u)}i._setActive(q)},execCallback:function(v){var q=this,u=q.settings[v],r;if(!u){return}if(q.callbackLookup&&(r=q.callbackLookup[v])){u=r.func;r=r.scope}if(d(u,"string")){r=u.replace(/\.\w+$/,"");r=r?n.resolve(r):0;u=n.resolve(u);q.callbackLookup=q.callbackLookup||{};q.callbackLookup[v]={func:u,scope:r}}return u.apply(r||q,Array.prototype.slice.call(arguments,1))},translate:function(q){var t=this.settings.language||"en",r=i.i18n;if(!q){return""}return r[t+"."+q]||q.replace(/{\#([^}]+)\}/g,function(u,s){return r[t+"."+s]||"{#"+s+"}"})},getLang:function(r,q){return i.i18n[(this.settings.language||"en")+"."+r]||(d(q)?q:"{#"+r+"}")},getParam:function(w,s,q){var t=n.trim,r=d(this.settings[w])?this.settings[w]:s,u;if(q==="hash"){u={};if(d(r,"string")){j(r.indexOf("=")>0?r.split(/[;,](?![^=;,]*(?:[;,]|$))/):r.split(","),function(x){x=x.split("=");if(x.length>1){u[t(x[0])]=t(x[1])}else{u[t(x[0])]=t(x)}})}else{u=r}return u}return r},nodeChanged:function(u){var q=this,r=q.selection,v=r.getNode()||q.getBody();if(q.initialized){q.onNodeChange.dispatch(q,u?u.controlManager||q.controlManager:q.controlManager,b&&v.ownerDocument!=q.getDoc()?q.getBody():v,r.isCollapsed(),u)}},addButton:function(u,r){var q=this;q.buttons=q.buttons||{};q.buttons[u]=r},addCommand:function(t,r,q){this.execCommands[t]={func:r,scope:q||this}},addQueryStateHandler:function(t,r,q){this.queryStateCommands[t]={func:r,scope:q||this}},addQueryValueHandler:function(t,r,q){this.queryValueCommands[t]={func:r,scope:q||this}},addShortcut:function(s,v,q,u){var r=this,w;if(!r.settings.custom_shortcuts){return false}r.shortcuts=r.shortcuts||{};if(d(q,"string")){w=q;q=function(){r.execCommand(w,false,null)}}if(d(q,"object")){w=q;q=function(){r.execCommand(w[0],w[1],w[2])}}j(g(s),function(t){var x={func:q,scope:u||this,desc:v,alt:false,ctrl:false,shift:false};j(g(t,"+"),function(y){switch(y){case"alt":case"ctrl":case"shift":x[y]=true;break;default:x.charCode=y.charCodeAt(0);x.keyCode=y.toUpperCase().charCodeAt(0)}});r.shortcuts[(x.ctrl?"ctrl":"")+","+(x.alt?"alt":"")+","+(x.shift?"shift":"")+","+x.keyCode]=x});return true},execCommand:function(x,w,z,q){var u=this,v=0,y,r;if(!/^(mceAddUndoLevel|mceEndUndoLevel|mceBeginUndoLevel|mceRepaint|SelectAll)$/.test(x)&&(!q||!q.skip_focus)){u.focus()}y={};u.onBeforeExecCommand.dispatch(u,x,w,z,y);if(y.terminate){return false}if(u.execCallback("execcommand_callback",u.id,u.selection.getNode(),x,w,z)){u.onExecCommand.dispatch(u,x,w,z,q);return true}if(y=u.execCommands[x]){r=y.func.call(y.scope,w,z);if(r!==true){u.onExecCommand.dispatch(u,x,w,z,q);return r}}j(u.plugins,function(s){if(s.execCommand&&s.execCommand(x,w,z)){u.onExecCommand.dispatch(u,x,w,z,q);v=1;return false}});if(v){return true}if(u.theme&&u.theme.execCommand&&u.theme.execCommand(x,w,z)){u.onExecCommand.dispatch(u,x,w,z,q);return true}if(n.GlobalCommands.execCommand(u,x,w,z)){u.onExecCommand.dispatch(u,x,w,z,q);return true}if(u.editorCommands.execCommand(x,w,z)){u.onExecCommand.dispatch(u,x,w,z,q);return true}u.getDoc().execCommand(x,w,z);u.onExecCommand.dispatch(u,x,w,z,q)},queryCommandState:function(w){var r=this,v,u;if(r._isHidden()){return}if(v=r.queryStateCommands[w]){u=v.func.call(v.scope);if(u!==true){return u}}v=r.editorCommands.queryCommandState(w);if(v!==-1){return v}try{return this.getDoc().queryCommandState(w)}catch(q){}},queryCommandValue:function(w){var r=this,v,u;if(r._isHidden()){return}if(v=r.queryValueCommands[w]){u=v.func.call(v.scope);if(u!==true){return u}}v=r.editorCommands.queryCommandValue(w);if(d(v)){return v}try{return this.getDoc().queryCommandValue(w)}catch(q){}},show:function(){var q=this;o.show(q.getContainer());o.hide(q.id);q.load()},hide:function(){var q=this,r=q.getDoc();if(b&&r){r.execCommand("SelectAll")}q.save();o.hide(q.getContainer());o.setStyle(q.id,"display",q.orgDisplay)},isHidden:function(){return !o.isHidden(this.id)},setProgressState:function(q,r,s){this.onSetProgressState.dispatch(this,q,r,s);return q},load:function(u){var q=this,s=q.getElement(),r;if(s){u=u||{};u.load=true;r=q.setContent(d(s.value)?s.value:s.innerHTML,u);u.element=s;if(!u.no_events){q.onLoadContent.dispatch(q,u)}u.element=s=null;return r}},save:function(v){var q=this,u=q.getElement(),r,s;if(!u||!q.initialized){return}v=v||{};v.save=true;if(!v.no_events){q.undoManager.typing=0;q.undoManager.add()}v.element=u;r=v.content=q.getContent(v);if(!v.no_events){q.onSaveContent.dispatch(q,v)}r=v.content;if(!/TEXTAREA|INPUT/i.test(u.nodeName)){u.innerHTML=r;if(s=o.getParent(q.id,"form")){j(s.elements,function(t){if(t.name==q.id){t.value=r;return false}})}}else{u.value=r}v.element=u=null;return r},setContent:function(r,s){var q=this;s=s||{};s.format=s.format||"html";s.set=true;s.content=r;if(!s.no_events){q.onBeforeSetContent.dispatch(q,s)}if(!n.isIE&&(r.length===0||/^\s+$/.test(r))){s.content=q.dom.setHTML(q.getBody(),'<br mce_bogus="1" />');s.format="raw"}s.content=q.dom.setHTML(q.getBody(),n.trim(s.content));if(s.format!="raw"&&q.settings.cleanup){s.getInner=true;s.content=q.dom.setHTML(q.getBody(),q.serializer.serialize(q.getBody(),s))}if(!s.no_events){q.onSetContent.dispatch(q,s)}return s.content},getContent:function(s){var q=this,r;s=s||{};s.format=s.format||"html";s.get=true;if(!s.no_events){q.onBeforeGetContent.dispatch(q,s)}if(s.format!="raw"&&q.settings.cleanup){s.getInner=true;r=q.serializer.serialize(q.getBody(),s)}else{r=q.getBody().innerHTML}r=r.replace(/^\s*|\s*$/g,"");s.content=r;if(!s.no_events){q.onGetContent.dispatch(q,s)}return s.content},isDirty:function(){var q=this;return n.trim(q.startContent)!=n.trim(q.getContent({format:"raw",no_events:1}))&&!q.isNotDirty},getContainer:function(){var q=this;if(!q.container){q.container=o.get(q.editorContainer||q.id+"_parent")}return q.container},getContentAreaContainer:function(){return this.contentAreaContainer},getElement:function(){return o.get(this.settings.content_element||this.id)},getWin:function(){var q=this,r;if(!q.contentWindow){r=o.get(q.id+"_ifr");if(r){q.contentWindow=r.contentWindow}}return q.contentWindow},getDoc:function(){var r=this,q;if(!r.contentDocument){q=r.getWin();if(q){r.contentDocument=q.document}}return r.contentDocument},getBody:function(){return this.bodyElement||this.getDoc().body},convertURL:function(q,x,w){var r=this,v=r.settings;if(v.urlconverter_callback){return r.execCallback("urlconverter_callback",q,w,true,x)}if(!v.convert_urls||(w&&w.nodeName=="LINK")||q.indexOf("file:")===0){return q}if(v.relative_urls){return r.documentBaseURI.toRelative(q)}q=r.documentBaseURI.toAbsolute(q,v.remove_script_host);return q},addVisual:function(u){var q=this,r=q.settings;u=u||q.getBody();if(!d(q.hasVisual)){q.hasVisual=r.visual}j(q.dom.select("table,a",u),function(t){var s;switch(t.nodeName){case"TABLE":s=q.dom.getAttrib(t,"border");if(!s||s=="0"){if(q.hasVisual){q.dom.addClass(t,r.visual_table_class)}else{q.dom.removeClass(t,r.visual_table_class)}}return;case"A":s=q.dom.getAttrib(t,"name");if(s){if(q.hasVisual){q.dom.addClass(t,"mceItemAnchor")}else{q.dom.removeClass(t,"mceItemAnchor")}}return}});q.onVisualAid.dispatch(q,u,q.hasVisual)},remove:function(){var q=this,r=q.getContainer();q.removed=1;q.hide();q.execCallback("remove_instance_callback",q);q.onRemove.dispatch(q);q.onExecCommand.listeners=[];i.remove(q);o.remove(r)},destroy:function(r){var q=this;if(q.destroyed){return}if(!r){n.removeUnload(q.destroy);tinyMCE.onBeforeUnload.remove(q._beforeUnload);if(q.theme&&q.theme.destroy){q.theme.destroy()}q.controlManager.destroy();q.selection.destroy();q.dom.destroy();if(!q.settings.content_editable){k.clear(q.getWin());k.clear(q.getDoc())}k.clear(q.getBody());k.clear(q.formElement)}if(q.formElement){q.formElement.submit=q.formElement._mceOldSubmit;q.formElement._mceOldSubmit=null}q.contentAreaContainer=q.formElement=q.container=q.settings.content_element=q.bodyElement=q.contentDocument=q.contentWindow=null;if(q.selection){q.selection=q.selection.win=q.selection.dom=q.selection.dom.doc=null}q.destroyed=1},_addEvents:function(){var w=this,v,y=w.settings,x={mouseup:"onMouseUp",mousedown:"onMouseDown",click:"onClick",keyup:"onKeyUp",keydown:"onKeyDown",keypress:"onKeyPress",submit:"onSubmit",reset:"onReset",contextmenu:"onContextMenu",dblclick:"onDblClick",paste:"onPaste"};function u(t,A){var s=t.type;if(w.removed){return}if(w.onEvent.dispatch(w,t,A)!==false){w[x[t.fakeType||t.type]].dispatch(w,t,A)}}j(x,function(t,s){switch(s){case"contextmenu":if(n.isOpera){w.dom.bind(w.getBody(),"mousedown",function(A){if(A.ctrlKey){A.fakeType="contextmenu";u(A)}})}else{w.dom.bind(w.getBody(),s,u)}break;case"paste":w.dom.bind(w.getBody(),s,function(A){u(A)});break;case"submit":case"reset":w.dom.bind(w.getElement().form||o.getParent(w.id,"form"),s,u);break;default:w.dom.bind(y.content_editable?w.getBody():w.getDoc(),s,u)}});w.dom.bind(y.content_editable?w.getBody():(a?w.getDoc():w.getWin()),"focus",function(s){w.focus(true)});if(n.isGecko){w.dom.bind(w.getDoc(),"DOMNodeInserted",function(t){var s;t=t.target;if(t.nodeType===1&&t.nodeName==="IMG"&&(s=t.getAttribute("mce_src"))){t.src=w.documentBaseURI.toAbsolute(s)}})}if(a){function q(){var B=this,D=B.getDoc(),C=B.settings;if(a&&!C.readonly){if(B._isHidden()){try{if(!C.content_editable){D.designMode="On"}}catch(A){}}try{D.execCommand("styleWithCSS",0,false)}catch(A){if(!B._isHidden()){try{D.execCommand("useCSS",0,true)}catch(A){}}}if(!C.table_inline_editing){try{D.execCommand("enableInlineTableEditing",false,false)}catch(A){}}if(!C.object_resizing){try{D.execCommand("enableObjectResizing",false,false)}catch(A){}}}}w.onBeforeExecCommand.add(q);w.onMouseDown.add(q)}w.onMouseUp.add(w.nodeChanged);w.onClick.add(w.nodeChanged);w.onKeyUp.add(function(s,t){var A=t.keyCode;if((A>=33&&A<=36)||(A>=37&&A<=40)||A==13||A==45||A==46||A==8||(n.isMac&&(A==91||A==93))||t.ctrlKey){w.nodeChanged()}});w.onReset.add(function(){w.setContent(w.startContent,{format:"raw"})});if(y.custom_shortcuts){if(y.custom_undo_redo_keyboard_shortcuts){w.addShortcut("ctrl+z",w.getLang("undo_desc"),"Undo");w.addShortcut("ctrl+y",w.getLang("redo_desc"),"Redo")}if(a){w.addShortcut("ctrl+b",w.getLang("bold_desc"),"Bold");w.addShortcut("ctrl+i",w.getLang("italic_desc"),"Italic");w.addShortcut("ctrl+u",w.getLang("underline_desc"),"Underline")}for(v=1;v<=6;v++){w.addShortcut("ctrl+"+v,"",["FormatBlock",false,"<h"+v+">"])}w.addShortcut("ctrl+7","",["FormatBlock",false,"<p>"]);w.addShortcut("ctrl+8","",["FormatBlock",false,"<div>"]);w.addShortcut("ctrl+9","",["FormatBlock",false,"<address>"]);function z(t){var s=null;if(!t.altKey&&!t.ctrlKey&&!t.metaKey){return s}j(w.shortcuts,function(A){if(n.isMac&&A.ctrl!=t.metaKey){return}else{if(!n.isMac&&A.ctrl!=t.ctrlKey){return}}if(A.alt!=t.altKey){return}if(A.shift!=t.shiftKey){return}if(t.keyCode==A.keyCode||(t.charCode&&t.charCode==A.charCode)){s=A;return false}});return s}w.onKeyUp.add(function(s,t){var A=z(t);if(A){return k.cancel(t)}});w.onKeyPress.add(function(s,t){var A=z(t);if(A){return k.cancel(t)}});w.onKeyDown.add(function(s,t){var A=z(t);if(A){A.func.call(A.scope);return k.cancel(t)}})}if(n.isIE){w.dom.bind(w.getDoc(),"controlselect",function(A){var t=w.resizeInfo,s;A=A.target;if(A.nodeName!=="IMG"){return}if(t){w.dom.unbind(t.node,t.ev,t.cb)}if(!w.dom.hasClass(A,"mceItemNoResize")){ev="resizeend";s=w.dom.bind(A,ev,function(C){var B;C=C.target;if(B=w.dom.getStyle(C,"width")){w.dom.setAttrib(C,"width",B.replace(/[^0-9%]+/g,""));w.dom.setStyle(C,"width","")}if(B=w.dom.getStyle(C,"height")){w.dom.setAttrib(C,"height",B.replace(/[^0-9%]+/g,""));w.dom.setStyle(C,"height","")}})}else{ev="resizestart";s=w.dom.bind(A,"resizestart",k.cancel,k)}t=w.resizeInfo={node:A,ev:ev,cb:s}});w.onKeyDown.add(function(s,t){switch(t.keyCode){case 8:if(w.selection.getRng().item){w.selection.getRng().item(0).removeNode();return k.cancel(t)}}})}if(n.isOpera){w.onClick.add(function(s,t){k.prevent(t)})}if(y.custom_undo_redo){function r(){w.undoManager.typing=0;w.undoManager.add()}if(n.isIE){w.dom.bind(w.getWin(),"blur",function(s){var t;if(w.selection){t=w.selection.getNode();if(!w.removed&&t.ownerDocument&&t.ownerDocument!=w.getDoc()){r()}}})}else{w.dom.bind(w.getDoc(),"blur",function(){if(w.selection&&!w.removed){r()}})}w.onMouseDown.add(r);w.onKeyUp.add(function(s,t){if((t.keyCode>=33&&t.keyCode<=36)||(t.keyCode>=37&&t.keyCode<=40)||t.keyCode==13||t.keyCode==45||t.ctrlKey){w.undoManager.typing=0;w.undoManager.add()}});w.onKeyDown.add(function(s,t){if((t.keyCode>=33&&t.keyCode<=36)||(t.keyCode>=37&&t.keyCode<=40)||t.keyCode==13||t.keyCode==45){if(w.undoManager.typing){w.undoManager.add();w.undoManager.typing=0}return}if(!w.undoManager.typing){w.undoManager.add();w.undoManager.typing=1}})}},_convertInlineElements:function(){var z=this,B=z.settings,r=z.dom,y,w,u,A,q;function x(s,t){if(!B.inline_styles){return}if(t.get){j(z.dom.select("table,u,strike",t.node),function(v){switch(v.nodeName){case"TABLE":if(y=r.getAttrib(v,"height")){r.setStyle(v,"height",y);r.setAttrib(v,"height","")}break;case"U":case"STRIKE":v.style.textDecoration=v.nodeName=="U"?"underline":"line-through";r.setAttrib(v,"mce_style","");r.setAttrib(v,"mce_name","span");break}})}else{if(t.set){j(z.dom.select("table,span",t.node).reverse(),function(v){if(v.nodeName=="TABLE"){if(y=r.getStyle(v,"height")){r.setAttrib(v,"height",y.replace(/[^0-9%]+/g,""))}}else{if(v.style.textDecoration=="underline"){u="u"}else{if(v.style.textDecoration=="line-through"){u="strike"}else{u=""}}if(u){v.style.textDecoration="";r.setAttrib(v,"mce_style","");w=r.create(u,{style:r.getAttrib(v,"style")});r.replace(w,v,1)}}})}}}z.onPreProcess.add(x);if(!B.cleanup_on_startup){z.onSetContent.add(function(s,t){if(t.initial){x(z,{node:z.getBody(),set:1})}})}},_convertFonts:function(){var w=this,x=w.settings,z=w.dom,v,r,q,u;if(!x.inline_styles){return}v=[8,10,12,14,18,24,36];r=["xx-small","x-small","small","medium","large","x-large","xx-large"];if(q=x.font_size_style_values){q=g(q)}if(u=x.font_size_classes){u=g(u)}function y(B){var C,A,t,s;if(!x.inline_styles){return}t=w.dom.select("font",B);for(s=t.length-1;s>=0;s--){C=t[s];A=z.create("span",{style:z.getAttrib(C,"style"),"class":z.getAttrib(C,"class")});z.setStyles(A,{fontFamily:z.getAttrib(C,"face"),color:z.getAttrib(C,"color"),backgroundColor:C.style.backgroundColor});if(C.size){if(q){z.setStyle(A,"fontSize",q[parseInt(C.size)-1])}else{z.setAttrib(A,"class",u[parseInt(C.size)-1])}}z.setAttrib(A,"mce_style","");z.replace(A,C,1)}}w.onPreProcess.add(function(s,t){if(t.get){y(t.node)}});w.onSetContent.add(function(s,t){if(t.initial){y(t.node)}})},_isHidden:function(){var q;if(!a){return 0}q=this.selection.getSel();return(!q||!q.rangeCount||q.rangeCount==0)},_fixNesting:function(r){var t=[],q;r=r.replace(/<(\/)?([^\s>]+)[^>]*?>/g,function(u,s,w){var v;if(s==="/"){if(!t.length){return""}if(w!==t[t.length-1].tag){for(q=t.length-1;q>=0;q--){if(t[q].tag===w){t[q].close=1;break}}return""}else{t.pop();if(t.length&&t[t.length-1].close){u=u+"</"+t[t.length-1].tag+">";t.pop()}}}else{if(/^(br|hr|input|meta|img|link|param)$/i.test(w)){return u}if(/\/>$/.test(u)){return u}t.push({tag:w})}return u});for(q=t.length-1;q>=0;q--){r+="</"+t[q].tag+">"}return r}})})(tinymce);(function(d){var f=d.each,c=d.isIE,a=d.isGecko,b=d.isOpera,e=d.isWebKit;d.create("tinymce.EditorCommands",{EditorCommands:function(g){this.editor=g},execCommand:function(k,j,l){var h=this,g=h.editor,i;switch(k){case"mceResetDesignMode":case"mceBeginUndoLevel":return true;case"unlink":h.UnLink();return true;case"JustifyLeft":case"JustifyCenter":case"JustifyRight":case"JustifyFull":h.mceJustify(k,k.substring(7).toLowerCase());return true;default:i=this[k];if(i){i.call(this,j,l);return true}}return false},Indent:function(){var g=this.editor,l=g.dom,j=g.selection,k,h,i;h=g.settings.indentation;i=/[a-z%]+$/i.exec(h);h=parseInt(h);if(g.settings.inline_styles&&(!this.queryStateInsertUnorderedList()&&!this.queryStateInsertOrderedList())){f(j.getSelectedBlocks(),function(m){l.setStyle(m,"paddingLeft",(parseInt(m.style.paddingLeft||0)+h)+i)});return}g.getDoc().execCommand("Indent",false,null);if(c){l.getParent(j.getNode(),function(m){if(m.nodeName=="BLOCKQUOTE"){m.dir=m.style.cssText=""}})}},Outdent:function(){var h=this.editor,m=h.dom,k=h.selection,l,g,i,j;i=h.settings.indentation;j=/[a-z%]+$/i.exec(i);i=parseInt(i);if(h.settings.inline_styles&&(!this.queryStateInsertUnorderedList()&&!this.queryStateInsertOrderedList())){f(k.getSelectedBlocks(),function(n){g=Math.max(0,parseInt(n.style.paddingLeft||0)-i);m.setStyle(n,"paddingLeft",g?g+j:"")});return}h.getDoc().execCommand("Outdent",false,null)},mceSetContent:function(h,g){this.editor.setContent(g)},mceToggleVisualAid:function(){var g=this.editor;g.hasVisual=!g.hasVisual;g.addVisual()},mceReplaceContent:function(h,g){var i=this.editor.selection;i.setContent(g.replace(/\{\$selection\}/g,i.getContent({format:"text"})))},mceInsertLink:function(i,h){var g=this.editor,j=g.selection,k=g.dom.getParent(j.getNode(),"a");if(d.is(h,"string")){h={href:h}}function l(m){f(h,function(o,n){g.dom.setAttrib(m,n,o)})}if(!k){g.execCommand("CreateLink",false,"javascript:mctmp(0);");f(g.dom.select("a[href=javascript:mctmp(0);]"),function(m){l(m)})}else{if(h.href){l(k)}else{g.dom.remove(k,1)}}},UnLink:function(){var g=this.editor,h=g.selection;if(h.isCollapsed()){h.select(h.getNode())}g.getDoc().execCommand("unlink",false,null);h.collapse(0)},FontName:function(i,h){var j=this,g=j.editor,k=g.selection,l;if(!h){if(k.isCollapsed()){k.select(k.getNode())}}else{if(g.settings.convert_fonts_to_spans){j._applyInlineStyle("span",{style:{fontFamily:h}})}else{g.getDoc().execCommand("FontName",false,h)}}},FontSize:function(j,i){var h=this.editor,l=h.settings,k,g;if(l.convert_fonts_to_spans&&i>=1&&i<=7){g=d.explode(l.font_size_style_values);k=d.explode(l.font_size_classes);if(k){i=k[i-1]||i}else{i=g[i-1]||i}}if(i>=1&&i<=7){h.getDoc().execCommand("FontSize",false,i)}else{this._applyInlineStyle("span",{style:{fontSize:i}})}},queryCommandValue:function(h){var g=this["queryValue"+h];if(g){return g.call(this,h)}return false},queryCommandState:function(h){var g;switch(h){case"JustifyLeft":case"JustifyCenter":case"JustifyRight":case"JustifyFull":return this.queryStateJustify(h,h.substring(7).toLowerCase());default:if(g=this["queryState"+h]){return g.call(this,h)}}return -1},_queryState:function(h){try{return this.editor.getDoc().queryCommandState(h)}catch(g){}},_queryVal:function(h){try{return this.editor.getDoc().queryCommandValue(h)}catch(g){}},queryValueFontSize:function(){var h=this.editor,g=0,i;if(i=h.dom.getParent(h.selection.getNode(),"span")){g=i.style.fontSize}if(!g&&(b||e)){if(i=h.dom.getParent(h.selection.getNode(),"font")){g=i.size}return g}return g||this._queryVal("FontSize")},queryValueFontName:function(){var h=this.editor,g=0,i;if(i=h.dom.getParent(h.selection.getNode(),"font")){g=i.face}if(i=h.dom.getParent(h.selection.getNode(),"span")){g=i.style.fontFamily.replace(/, /g,",").replace(/[\'\"]/g,"").toLowerCase()}if(!g){g=this._queryVal("FontName")}return g},mceJustify:function(o,p){var k=this.editor,m=k.selection,g=m.getNode(),q=g.nodeName,h,j,i=k.dom,l;if(k.settings.inline_styles&&this.queryStateJustify(o,p)){l=1}h=i.getParent(g,k.dom.isBlock);if(q=="IMG"){if(p=="full"){return}if(l){if(p=="center"){i.setStyle(h||g.parentNode,"textAlign","")}i.setStyle(g,"float","");this.mceRepaint();return}if(p=="center"){if(h&&/^(TD|TH)$/.test(h.nodeName)){h=0}if(!h||h.childNodes.length>1){j=i.create("p");j.appendChild(g.cloneNode(false));if(h){i.insertAfter(j,h)}else{i.insertAfter(j,g)}i.remove(g);g=j.firstChild;h=j}i.setStyle(h,"textAlign",p);i.setStyle(g,"float","")}else{i.setStyle(g,"float",p);i.setStyle(h||g.parentNode,"textAlign","")}this.mceRepaint();return}if(k.settings.inline_styles&&k.settings.forced_root_block){if(l){p=""}f(m.getSelectedBlocks(i.getParent(m.getStart(),i.isBlock),i.getParent(m.getEnd(),i.isBlock)),function(n){i.setAttrib(n,"align","");i.setStyle(n,"textAlign",p=="full"?"justify":p)});return}else{if(!l){k.getDoc().execCommand(o,false,null)}}if(k.settings.inline_styles){if(l){i.getParent(k.selection.getNode(),function(r){if(r.style&&r.style.textAlign){i.setStyle(r,"textAlign","")}});return}f(i.select("*"),function(s){var r=s.align;if(r){if(r=="full"){r="justify"}i.setStyle(s,"textAlign",r);i.setAttrib(s,"align","")}})}},mceSetCSSClass:function(h,g){this.mceSetStyleInfo(0,{command:"setattrib",name:"class",value:g})},getSelectedElement:function(){var w=this,o=w.editor,n=o.dom,s=o.selection,h=s.getRng(),l,k,u,p,j,g,q,i,x,v;if(s.isCollapsed()||h.item){return s.getNode()}v=o.settings.merge_styles_invalid_parents;if(d.is(v,"string")){v=new RegExp(v,"i")}if(c){l=h.duplicate();l.collapse(true);u=l.parentElement();k=h.duplicate();k.collapse(false);p=k.parentElement();if(u!=p){l.move("character",1);u=l.parentElement()}if(u==p){l=h.duplicate();l.moveToElementText(u);if(l.compareEndPoints("StartToStart",h)==0&&l.compareEndPoints("EndToEnd",h)==0){return v&&v.test(u.nodeName)?null:u}}}else{function m(r){return n.getParent(r,"*")}u=h.startContainer;p=h.endContainer;j=h.startOffset;g=h.endOffset;if(!h.collapsed){if(u==p){if(j-g<2){if(u.hasChildNodes()){i=u.childNodes[j];return v&&v.test(i.nodeName)?null:i}}}}if(u.nodeType!=3||p.nodeType!=3){return null}if(j==0){i=m(u);if(i&&i.firstChild!=u){i=null}}if(j==u.nodeValue.length){q=u.nextSibling;if(q&&q.nodeType==1){i=u.nextSibling}}if(g==0){q=p.previousSibling;if(q&&q.nodeType==1){x=q}}if(g==p.nodeValue.length){x=m(p);if(x&&x.lastChild!=p){x=null}}if(i==x){return v&&i&&v.test(i.nodeName)?null:i}}return null},mceSetStyleInfo:function(n,m){var q=this,h=q.editor,j=h.getDoc(),g=h.dom,i,k,r=h.selection,p=m.wrapper||"span",k=r.getBookmark(),o;function l(t,s){if(t.nodeType==1){switch(m.command){case"setattrib":return g.setAttrib(t,m.name,m.value);case"setstyle":return g.setStyle(t,m.name,m.value);case"removeformat":return g.setAttrib(t,"class","")}}}o=h.settings.merge_styles_invalid_parents;if(d.is(o,"string")){o=new RegExp(o,"i")}if((i=q.getSelectedElement())&&!h.settings.force_span_wrappers){l(i,1)}else{j.execCommand("FontName",false,"__");f(g.select("span,font"),function(u){var s,t;if(g.getAttrib(u,"face")=="__"||u.style.fontFamily==="__"){s=g.create(p,{mce_new:"1"});l(s);f(u.childNodes,function(v){s.appendChild(v.cloneNode(true))});g.replace(s,u)}})}f(g.select(p).reverse(),function(t){var s=t.parentNode;if(!g.getAttrib(t,"mce_new")){s=g.getParent(t,"*[mce_new]");if(s){g.remove(t,1)}}});f(g.select(p).reverse(),function(t){var s=t.parentNode;if(!s||!g.getAttrib(t,"mce_new")){return}if(h.settings.force_span_wrappers&&s.nodeName!="SPAN"){return}if(s.nodeName==p.toUpperCase()&&s.childNodes.length==1){return g.remove(s,1)}if(t.nodeType==1&&(!o||!o.test(s.nodeName))&&s.childNodes.length==1){l(s);g.setAttrib(t,"class","")}});f(g.select(p).reverse(),function(s){if(g.getAttrib(s,"mce_new")||(g.getAttribs(s).length<=1&&s.className==="")){if(!g.getAttrib(s,"class")&&!g.getAttrib(s,"style")){return g.remove(s,1)}g.setAttrib(s,"mce_new","")}});r.moveToBookmark(k)},queryStateJustify:function(k,h){var g=this.editor,j=g.selection.getNode(),i=g.dom;if(j&&j.nodeName=="IMG"){if(i.getStyle(j,"float")==h){return 1}return j.parentNode.style.textAlign==h}j=i.getParent(g.selection.getStart(),function(l){return l.nodeType==1&&l.style.textAlign});if(h=="full"){h="justify"}if(g.settings.inline_styles){return(j&&j.style.textAlign==h)}return this._queryState(k)},ForeColor:function(i,h){var g=this.editor;if(g.settings.convert_fonts_to_spans){this._applyInlineStyle("span",{style:{color:h}});return}else{g.getDoc().execCommand("ForeColor",false,h)}},HiliteColor:function(i,k){var h=this,g=h.editor,j=g.getDoc();if(g.settings.convert_fonts_to_spans){this._applyInlineStyle("span",{style:{backgroundColor:k}});return}function l(n){if(!a){return}try{j.execCommand("styleWithCSS",0,n)}catch(m){j.execCommand("useCSS",0,!n)}}if(a||b){l(true);j.execCommand("hilitecolor",false,k);l(false)}else{j.execCommand("BackColor",false,k)}},FormatBlock:function(n,h){var o=this,l=o.editor,p=l.selection,j=l.dom,g,k,m;function i(q){return/^(P|DIV|H[1-6]|ADDRESS|BLOCKQUOTE|PRE)$/.test(q.nodeName)}g=j.getParent(p.getNode(),function(q){return i(q)});if(g){if((c&&i(g.parentNode))||g.nodeName=="DIV"){k=l.dom.create(h);f(j.getAttribs(g),function(q){j.setAttrib(k,q.nodeName,j.getAttrib(g,q.nodeName))});m=p.getBookmark();j.replace(k,g,1);p.moveToBookmark(m);l.nodeChanged();return}}h=l.settings.forced_root_block?(h||"<p>"):h;if(h.indexOf("<")==-1){h="<"+h+">"}if(d.isGecko){h=h.replace(/<(div|blockquote|code|dt|dd|dl|samp)>/gi,"$1")}l.getDoc().execCommand("FormatBlock",false,h)},mceCleanup:function(){var h=this.editor,i=h.selection,g=i.getBookmark();h.setContent(h.getContent());i.moveToBookmark(g)},mceRemoveNode:function(j,k){var h=this.editor,i=h.selection,g,l=k||i.getNode();if(l==h.getBody()){return}g=i.getBookmark();h.dom.remove(l,1);i.moveToBookmark(g);h.nodeChanged()},mceSelectNodeDepth:function(i,j){var g=this.editor,h=g.selection,k=0;g.dom.getParent(h.getNode(),function(l){if(l.nodeType==1&&k++==j){h.select(l);g.nodeChanged();return false}},g.getBody())},mceSelectNode:function(h,g){this.editor.selection.select(g)},mceInsertContent:function(g,h){this.editor.selection.setContent(h)},mceInsertRawHTML:function(h,i){var g=this.editor;g.selection.setContent("tiny_mce_marker");g.setContent(g.getContent().replace(/tiny_mce_marker/g,i))},mceRepaint:function(){var i,g,j=this.editor;if(d.isGecko){try{i=j.selection;g=i.getBookmark(true);if(i.getSel()){i.getSel().selectAllChildren(j.getBody())}i.collapse(true);i.moveToBookmark(g)}catch(h){}}},queryStateUnderline:function(){var g=this.editor,h=g.selection.getNode();if(h&&h.nodeName=="A"){return false}return this._queryState("Underline")},queryStateOutdent:function(){var g=this.editor,h;if(g.settings.inline_styles){if((h=g.dom.getParent(g.selection.getStart(),g.dom.isBlock))&&parseInt(h.style.paddingLeft)>0){return true}if((h=g.dom.getParent(g.selection.getEnd(),g.dom.isBlock))&&parseInt(h.style.paddingLeft)>0){return true}}return this.queryStateInsertUnorderedList()||this.queryStateInsertOrderedList()||(!g.settings.inline_styles&&!!g.dom.getParent(g.selection.getNode(),"BLOCKQUOTE"))},queryStateInsertUnorderedList:function(){return this.editor.dom.getParent(this.editor.selection.getNode(),"UL")},queryStateInsertOrderedList:function(){return this.editor.dom.getParent(this.editor.selection.getNode(),"OL")},queryStatemceBlockQuote:function(){return !!this.editor.dom.getParent(this.editor.selection.getStart(),function(g){return g.nodeName==="BLOCKQUOTE"})},_applyInlineStyle:function(o,j,m){var q=this,n=q.editor,l=n.dom,i,p={},k,r;o=o.toUpperCase();if(m&&m.check_classes&&j["class"]){m.check_classes.push(j["class"])}function h(){f(l.select(o).reverse(),function(t){var s=0;f(l.getAttribs(t),function(u){if(u.nodeName.substring(0,1)!="_"&&l.getAttrib(t,u.nodeName)!=""){s++}});if(s==0){l.remove(t,1)}})}function g(){var s;f(l.select("span,font"),function(t){if(t.style.fontFamily=="mceinline"||t.face=="mceinline"){if(!s){s=n.selection.getBookmark()}j._mce_new="1";l.replace(l.create(o,j),t,1)}});f(l.select(o+"[_mce_new]"),function(u){function t(v){if(v.nodeType==1){f(j.style,function(x,w){l.setStyle(v,w,"")});if(j["class"]&&v.className&&m){f(m.check_classes,function(w){if(l.hasClass(v,w)){l.removeClass(v,w)}})}}}f(l.select(o,u),t);if(u.parentNode&&u.parentNode.nodeType==1&&u.parentNode.childNodes.length==1){t(u.parentNode)}l.getParent(u.parentNode,function(v){if(v.nodeType==1){if(j.style){f(j.style,function(y,x){var w;if(!p[x]&&(w=l.getStyle(v,x))){if(w===y){l.setStyle(u,x,"")}p[x]=1}})}if(j["class"]&&v.className&&m){f(m.check_classes,function(w){if(l.hasClass(v,w)){l.removeClass(u,w)}})}}return false});u.removeAttribute("_mce_new")});h();n.selection.moveToBookmark(s);return !!s}n.focus();n.getDoc().execCommand("FontName",false,"mceinline");g();if(k=q._applyInlineStyle.keyhandler){n.onKeyUp.remove(k);n.onKeyPress.remove(k);n.onKeyDown.remove(k);n.onSetContent.remove(q._applyInlineStyle.chandler)}if(n.selection.isCollapsed()){if(!c){f(l.getParents(n.selection.getNode(),"span"),function(s){f(j.style,function(u,t){var w;if(w=l.getStyle(s,t)){if(w==u){l.setStyle(s,t,"");r=2;return false}r=1;return false}});if(r){return false}});if(r==2){i=n.selection.getBookmark();h();n.selection.moveToBookmark(i);window.setTimeout(function(){n.nodeChanged()},1);return}}q._pendingStyles=d.extend(q._pendingStyles||{},j.style);q._applyInlineStyle.chandler=n.onSetContent.add(function(){delete q._pendingStyles});q._applyInlineStyle.keyhandler=k=function(s){if(q._pendingStyles){j.style=q._pendingStyles;delete q._pendingStyles}if(g()){n.onKeyDown.remove(q._applyInlineStyle.keyhandler);n.onKeyPress.remove(q._applyInlineStyle.keyhandler)}if(s.type=="keyup"){n.onKeyUp.remove(q._applyInlineStyle.keyhandler)}};n.onKeyDown.add(k);n.onKeyPress.add(k);n.onKeyUp.add(k)}else{q._pendingStyles=0}}})})(tinymce);(function(a){a.create("tinymce.UndoManager",{index:0,data:null,typing:0,UndoManager:function(c){var d=this,b=a.util.Dispatcher;d.editor=c;d.data=[];d.onAdd=new b(this);d.onUndo=new b(this);d.onRedo=new b(this)},add:function(d){var g=this,f,e=g.editor,c,h=e.settings,j;d=d||{};d.content=d.content||e.getContent({format:"raw",no_events:1});d.content=d.content.replace(/^\s*|\s*$/g,"");j=g.data[g.index>0&&(g.index==0||g.index==g.data.length)?g.index-1:g.index];if(!d.initial&&j&&d.content==j.content){return null}if(h.custom_undo_redo_levels){if(g.data.length>h.custom_undo_redo_levels){for(f=0;f<g.data.length-1;f++){g.data[f]=g.data[f+1]}g.data.length--;g.index=g.data.length}}if(h.custom_undo_redo_restore_selection&&!d.initial){d.bookmark=c=d.bookmark||e.selection.getBookmark()}if(g.index<g.data.length){g.index++}if(g.data.length===0&&!d.initial){return null}g.data.length=g.index+1;g.data[g.index++]=d;if(d.initial){g.index=0}if(g.data.length==2&&g.data[0].initial){g.data[0].bookmark=c}g.onAdd.dispatch(g,d);e.isNotDirty=0;return d},undo:function(){var e=this,c=e.editor,b=b,d;if(e.typing){e.add();e.typing=0}if(e.index>0){if(e.index==e.data.length&&e.index>1){d=e.index;e.typing=0;if(!e.add()){e.index=d}--e.index}b=e.data[--e.index];c.setContent(b.content,{format:"raw"});c.selection.moveToBookmark(b.bookmark);e.onUndo.dispatch(e,b)}return b},redo:function(){var d=this,c=d.editor,b=null;if(d.index<d.data.length-1){b=d.data[++d.index];c.setContent(b.content,{format:"raw"});c.selection.moveToBookmark(b.bookmark);d.onRedo.dispatch(d,b)}return b},clear:function(){var b=this;b.data=[];b.index=0;b.typing=0;b.add({initial:true})},hasUndo:function(){return this.index!=0||this.typing},hasRedo:function(){return this.index<this.data.length-1}})})(tinymce);(function(e){var b,d,a,c,f,h;b=e.dom.Event;d=e.isIE;a=e.isGecko;c=e.isOpera;f=e.each;h=e.extend;function g(i){i=i.innerHTML;i=i.replace(/<(img|hr|table|input|select|textarea)[ \>]/gi,"-");i=i.replace(/<[^>]+>/g,"");return i.replace(/[ \t\r\n]+/g,"")==""}e.create("tinymce.ForceBlocks",{ForceBlocks:function(j){var k=this,l=j.settings,m;k.editor=j;k.dom=j.dom;m=(l.forced_root_block||"p").toLowerCase();l.element=m.toUpperCase();j.onPreInit.add(k.setup,k);k.reOpera=new RegExp("(\\u00a0|&#160;|&nbsp;)</"+m+">","gi");k.rePadd=new RegExp("<p( )([^>]+)><\\/p>|<p( )([^>]+)\\/>|<p( )([^>]+)>\\s+<\\/p>|<p><\\/p>|<p\\/>|<p>\\s+<\\/p>".replace(/p/g,m),"gi");k.reNbsp2BR1=new RegExp("<p( )([^>]+)>[\\s\\u00a0]+<\\/p>|<p>[\\s\\u00a0]+<\\/p>".replace(/p/g,m),"gi");k.reNbsp2BR2=new RegExp("<%p()([^>]+)>(&nbsp;|&#160;)<\\/%p>|<%p>(&nbsp;|&#160;)<\\/%p>".replace(/%p/g,m),"gi");k.reBR2Nbsp=new RegExp("<p( )([^>]+)>\\s*<br \\/>\\s*<\\/p>|<p>\\s*<br \\/>\\s*<\\/p>".replace(/p/g,m),"gi");function i(n,p){if(c){p.content=p.content.replace(k.reOpera,"</"+m+">")}p.content=p.content.replace(k.rePadd,"<"+m+"$1$2$3$4$5$6>\u00a0</"+m+">");if(!d&&!c&&p.set){p.content=p.content.replace(k.reNbsp2BR1,"<"+m+"$1$2><br /></"+m+">");p.content=p.content.replace(k.reNbsp2BR2,"<"+m+"$1$2><br /></"+m+">")}else{p.content=p.content.replace(k.reBR2Nbsp,"<"+m+"$1$2>\u00a0</"+m+">")}}j.onBeforeSetContent.add(i);j.onPostProcess.add(i);if(l.forced_root_block){j.onInit.add(k.forceRoots,k);j.onSetContent.add(k.forceRoots,k);j.onBeforeGetContent.add(k.forceRoots,k)}},setup:function(){var j=this,i=j.editor,k=i.settings;if(k.forced_root_block){i.onKeyUp.add(j.forceRoots,j);i.onPreProcess.add(j.forceRoots,j)}if(k.force_br_newlines){if(d){i.onKeyPress.add(function(m,p){var q,o=m.selection;if(p.keyCode==13&&o.getNode().nodeName!="LI"){o.setContent('<br id="__" /> ',{format:"raw"});q=m.dom.get("__");q.removeAttribute("id");o.select(q);o.collapse();return b.cancel(p)}})}return}if(!d&&k.force_p_newlines){i.onKeyPress.add(function(m,n){if(n.keyCode==13&&!n.shiftKey){if(!j.insertPara(n)){b.cancel(n)}}});if(a){i.onKeyDown.add(function(m,n){if((n.keyCode==8||n.keyCode==46)&&!n.shiftKey){j.backspaceDelete(n,n.keyCode==8)}})}}function l(n,m){var o=i.dom.create(m);f(n.attributes,function(p){if(p.specified&&p.nodeValue){o.setAttribute(p.nodeName.toLowerCase(),p.nodeValue)}});f(n.childNodes,function(p){o.appendChild(p.cloneNode(true))});n.parentNode.replaceChild(o,n);return o}i.onPreProcess.add(function(m,n){f(m.dom.select("p,h1,h2,h3,h4,h5,h6,div",n.node),function(o){if(g(o)){f(m.dom.select("span,em,strong,b,i",n.node),function(p){if(!p.hasChildNodes()){p.appendChild(m.getDoc().createTextNode("\u00a0"));return false}})}})});if(d){if(k.element!="P"){i.onKeyPress.add(function(m,n){j.lastElm=m.selection.getNode().nodeName});i.onKeyUp.add(function(o,q){var s,p=o.selection,r=p.getNode(),m=o.getBody();if(m.childNodes.length===1&&r.nodeName=="P"){r=l(r,k.element);p.select(r);p.collapse();o.nodeChanged()}else{if(q.keyCode==13&&!q.shiftKey&&j.lastElm!="P"){s=o.dom.getParent(r,"p");if(s){l(s,k.element);o.nodeChanged()}}}})}}},find:function(o,k,l){var j=this.editor,i=j.getDoc().createTreeWalker(o,4,null,false),m=-1;while(o=i.nextNode()){m++;if(k==0&&o==l){return m}if(k==1&&m==l){return o}}return -1},forceRoots:function(p,D){var u=this,p=u.editor,H=p.getBody(),E=p.getDoc(),K=p.selection,v=K.getSel(),w=K.getRng(),I=-2,o,B,j,k,F=-16777215;var G,l,J,A,x,m=H.childNodes,z,y,q;for(z=m.length-1;z>=0;z--){G=m[z];if(G.nodeType==3||(!u.dom.isBlock(G)&&G.nodeType!=8)){if(!l){if(G.nodeType!=3||/[^\s]/g.test(G.nodeValue)){if(I==-2&&w){if(!d){if(w.startContainer.nodeType==1&&(y=w.startContainer.childNodes[w.startOffset])&&y.nodeType==1){q=y.getAttribute("id");y.setAttribute("id","__mce")}else{if(p.dom.getParent(w.startContainer,function(i){return i===H})){B=w.startOffset;j=w.endOffset;I=u.find(H,0,w.startContainer);o=u.find(H,0,w.endContainer)}}}else{k=E.body.createTextRange();k.moveToElementText(H);k.collapse(1);J=k.move("character",F)*-1;k=w.duplicate();k.collapse(1);A=k.move("character",F)*-1;k=w.duplicate();k.collapse(0);x=(k.move("character",F)*-1)-A;I=A-J;o=x}}l=p.dom.create(p.settings.forced_root_block);l.appendChild(G.cloneNode(1));G.parentNode.replaceChild(l,G)}}else{if(l.hasChildNodes()){l.insertBefore(G,l.firstChild)}else{l.appendChild(G)}}}else{l=null}}if(I!=-2){if(!d){l=H.getElementsByTagName(p.settings.element)[0];w=E.createRange();if(I!=-1){w.setStart(u.find(H,1,I),B)}else{w.setStart(l,0)}if(o!=-1){w.setEnd(u.find(H,1,o),j)}else{w.setEnd(l,0)}if(v){v.removeAllRanges();v.addRange(w)}}else{try{w=v.createRange();w.moveToElementText(H);w.collapse(1);w.moveStart("character",I);w.moveEnd("character",o);w.select()}catch(C){}}}else{if(!d&&(y=p.dom.get("__mce"))){if(q){y.setAttribute("id",q)}else{y.removeAttribute("id")}w=E.createRange();w.setStartBefore(y);w.setEndBefore(y);K.setRng(w)}}},getParentBlock:function(j){var i=this.dom;return i.getParent(j,i.isBlock)},insertPara:function(M){var A=this,o=A.editor,I=o.dom,N=o.getDoc(),R=o.settings,B=o.selection.getSel(),C=B.getRangeAt(0),Q=N.body;var F,G,D,K,J,l,j,m,q,i,x,P,k,p,E,H=I.getViewPort(o.getWin()),w,z,v;F=N.createRange();F.setStart(B.anchorNode,B.anchorOffset);F.collapse(true);G=N.createRange();G.setStart(B.focusNode,B.focusOffset);G.collapse(true);D=F.compareBoundaryPoints(F.START_TO_END,G)<0;K=D?B.anchorNode:B.focusNode;J=D?B.anchorOffset:B.focusOffset;l=D?B.focusNode:B.anchorNode;j=D?B.focusOffset:B.anchorOffset;if(K===l&&/^(TD|TH)$/.test(K.nodeName)){if(K.firstChild.nodeName=="BR"){I.remove(K.firstChild)}if(K.childNodes.length==0){o.dom.add(K,R.element,null,"<br />");P=o.dom.add(K,R.element,null,"<br />")}else{E=K.innerHTML;K.innerHTML="";o.dom.add(K,R.element,null,E);P=o.dom.add(K,R.element,null,"<br />")}C=N.createRange();C.selectNodeContents(P);C.collapse(1);o.selection.setRng(C);return false}if(K==Q&&l==Q&&Q.firstChild&&o.dom.isBlock(Q.firstChild)){K=l=K.firstChild;J=j=0;F=N.createRange();F.setStart(K,0);G=N.createRange();G.setStart(l,0)}K=K.nodeName=="HTML"?N.body:K;K=K.nodeName=="BODY"?K.firstChild:K;l=l.nodeName=="HTML"?N.body:l;l=l.nodeName=="BODY"?l.firstChild:l;m=A.getParentBlock(K);q=A.getParentBlock(l);i=m?m.nodeName:R.element;if(A.dom.getParent(m,"ol,ul,pre")){return true}if(m&&(m.nodeName=="CAPTION"||/absolute|relative|fixed/gi.test(I.getStyle(m,"position",1)))){i=R.element;m=null}if(q&&(q.nodeName=="CAPTION"||/absolute|relative|fixed/gi.test(I.getStyle(m,"position",1)))){i=R.element;q=null}if(/(TD|TABLE|TH|CAPTION)/.test(i)||(m&&i=="DIV"&&/left|right/gi.test(I.getStyle(m,"float",1)))){i=R.element;m=q=null}x=(m&&m.nodeName==i)?m.cloneNode(0):o.dom.create(i);P=(q&&q.nodeName==i)?q.cloneNode(0):o.dom.create(i);P.removeAttribute("id");if(/^(H[1-6])$/.test(i)&&K.nodeValue&&J==K.nodeValue.length){P=o.dom.create(R.element)}E=k=K;do{if(E==Q||E.nodeType==9||A.dom.isBlock(E)||/(TD|TABLE|TH|CAPTION)/.test(E.nodeName)){break}k=E}while((E=E.previousSibling?E.previousSibling:E.parentNode));E=p=l;do{if(E==Q||E.nodeType==9||A.dom.isBlock(E)||/(TD|TABLE|TH|CAPTION)/.test(E.nodeName)){break}p=E}while((E=E.nextSibling?E.nextSibling:E.parentNode));if(k.nodeName==i){F.setStart(k,0)}else{F.setStartBefore(k)}F.setEnd(K,J);x.appendChild(F.cloneContents()||N.createTextNode(""));try{G.setEndAfter(p)}catch(L){}G.setStart(l,j);P.appendChild(G.cloneContents()||N.createTextNode(""));C=N.createRange();if(!k.previousSibling&&k.parentNode.nodeName==i){C.setStartBefore(k.parentNode)}else{if(F.startContainer.nodeName==i&&F.startOffset==0){C.setStartBefore(F.startContainer)}else{C.setStart(F.startContainer,F.startOffset)}}if(!p.nextSibling&&p.parentNode.nodeName==i){C.setEndAfter(p.parentNode)}else{C.setEnd(G.endContainer,G.endOffset)}C.deleteContents();if(c){o.getWin().scrollTo(0,H.y)}if(x.firstChild&&x.firstChild.nodeName==i){x.innerHTML=x.firstChild.innerHTML}if(P.firstChild&&P.firstChild.nodeName==i){P.innerHTML=P.firstChild.innerHTML}if(g(x)){x.innerHTML="<br />"}function O(y,s){var r=[],T,S,t;y.innerHTML="";if(R.keep_styles){S=s;do{if(/^(SPAN|STRONG|B|EM|I|FONT|STRIKE|U)$/.test(S.nodeName)){T=S.cloneNode(false);I.setAttrib(T,"id","");r.push(T)}}while(S=S.parentNode)}if(r.length>0){for(t=r.length-1,T=y;t>=0;t--){T=T.appendChild(r[t])}r[0].innerHTML=c?"&nbsp;":"<br />";return r[0]}else{y.innerHTML=c?"&nbsp;":"<br />"}}if(g(P)){v=O(P,l)}if(c&&parseFloat(opera.version())<9.5){C.insertNode(x);C.insertNode(P)}else{C.insertNode(P);C.insertNode(x)}P.normalize();x.normalize();function u(r){return N.createTreeWalker(r,NodeFilter.SHOW_TEXT,null,false).nextNode()||r}C=N.createRange();C.selectNodeContents(a?u(v||P):v||P);C.collapse(1);B.removeAllRanges();B.addRange(C);w=o.dom.getPos(P).y;z=P.clientHeight;if(w<H.y||w+z>H.y+H.h){o.getWin().scrollTo(0,w<H.y?w:w-H.h+25)}return false},backspaceDelete:function(l,u){var x=this,k=x.editor,p=k.getBody(),j,m=k.selection,i=m.getRng(),o=i.startContainer,j,q,s;if(o&&k.dom.isBlock(o)&&!/^(TD|TH)$/.test(o.nodeName)&&u){if(o.childNodes.length==0||(o.childNodes.length==1&&o.firstChild.nodeName=="BR")){j=o;while((j=j.previousSibling)&&!k.dom.isBlock(j)){}if(j){if(o!=p.firstChild){q=k.dom.doc.createTreeWalker(j,NodeFilter.SHOW_TEXT,null,false);while(s=q.nextNode()){j=s}i=k.getDoc().createRange();i.setStart(j,j.nodeValue?j.nodeValue.length:0);i.setEnd(j,j.nodeValue?j.nodeValue.length:0);m.setRng(i);k.dom.remove(o)}return b.cancel(l)}}}function v(n){var r;n=n.target;if(n&&n.parentNode&&n.nodeName=="BR"&&(j=x.getParentBlock(n))){r=n.previousSibling;b.remove(p,"DOMNodeInserted",v);if(r&&r.nodeType==3&&/\s+$/.test(r.nodeValue)){return}if(n.previousSibling||n.nextSibling){k.dom.remove(n)}}}b._add(p,"DOMNodeInserted",v);window.setTimeout(function(){b._remove(p,"DOMNodeInserted",v)},1)}})})(tinymce);(function(c){var b=c.DOM,a=c.dom.Event,d=c.each,e=c.extend;c.create("tinymce.ControlManager",{ControlManager:function(f,j){var h=this,g;j=j||{};h.editor=f;h.controls={};h.onAdd=new c.util.Dispatcher(h);h.onPostRender=new c.util.Dispatcher(h);h.prefix=j.prefix||f.id+"_";h._cls={};h.onPostRender.add(function(){d(h.controls,function(i){i.postRender()})})},get:function(f){return this.controls[this.prefix+f]||this.controls[f]},setActive:function(h,f){var g=null;if(g=this.get(h)){g.setActive(f)}return g},setDisabled:function(h,f){var g=null;if(g=this.get(h)){g.setDisabled(f)}return g},add:function(g){var f=this;if(g){f.controls[g.id]=g;f.onAdd.dispatch(g,f)}return g},createControl:function(i){var h,g=this,f=g.editor;d(f.plugins,function(j){if(j.createControl){h=j.createControl(i,g);if(h){return false}}});switch(i){case"|":case"separator":return g.createSeparator()}if(!h&&f.buttons&&(h=f.buttons[i])){return g.createButton(i,h)}return g.add(h)},createDropMenu:function(f,n,h){var m=this,i=m.editor,j,g,k,l;n=e({"class":"mceDropDown",constrain:i.settings.constrain_menus},n);n["class"]=n["class"]+" "+i.getParam("skin")+"Skin";if(k=i.getParam("skin_variant")){n["class"]+=" "+i.getParam("skin")+"Skin"+k.substring(0,1).toUpperCase()+k.substring(1)}f=m.prefix+f;l=h||m._cls.dropmenu||c.ui.DropMenu;j=m.controls[f]=new l(f,n);j.onAddItem.add(function(r,q){var p=q.settings;p.title=i.getLang(p.title,p.title);if(!p.onclick){p.onclick=function(o){i.execCommand(p.cmd,p.ui||false,p.value)}}});i.onRemove.add(function(){j.destroy()});if(c.isIE){j.onShowMenu.add(function(){i.focus();g=i.selection.getBookmark(1)});j.onHideMenu.add(function(){if(g){i.selection.moveToBookmark(g);g=0}})}return m.add(j)},createListBox:function(m,i,l){var h=this,g=h.editor,j,k,f;if(h.get(m)){return null}i.title=g.translate(i.title);i.scope=i.scope||g;if(!i.onselect){i.onselect=function(n){g.execCommand(i.cmd,i.ui||false,n||i.value)}}i=e({title:i.title,"class":"mce_"+m,scope:i.scope,control_manager:h},i);m=h.prefix+m;if(g.settings.use_native_selects){k=new c.ui.NativeListBox(m,i)}else{f=l||h._cls.listbox||c.ui.ListBox;k=new f(m,i)}h.controls[m]=k;if(c.isWebKit){k.onPostRender.add(function(p,o){a.add(o,"mousedown",function(){g.bookmark=g.selection.getBookmark(1)});a.add(o,"focus",function(){g.selection.moveToBookmark(g.bookmark);g.bookmark=null})})}if(k.hideMenu){g.onMouseDown.add(k.hideMenu,k)}return h.add(k)},createButton:function(m,i,l){var h=this,g=h.editor,j,k,f;if(h.get(m)){return null}i.title=g.translate(i.title);i.label=g.translate(i.label);i.scope=i.scope||g;if(!i.onclick&&!i.menu_button){i.onclick=function(){g.execCommand(i.cmd,i.ui||false,i.value)}}i=e({title:i.title,"class":"mce_"+m,unavailable_prefix:g.getLang("unavailable",""),scope:i.scope,control_manager:h},i);m=h.prefix+m;if(i.menu_button){f=l||h._cls.menubutton||c.ui.MenuButton;k=new f(m,i);g.onMouseDown.add(k.hideMenu,k)}else{f=h._cls.button||c.ui.Button;k=new f(m,i)}return h.add(k)},createMenuButton:function(h,f,g){f=f||{};f.menu_button=1;return this.createButton(h,f,g)},createSplitButton:function(m,i,l){var h=this,g=h.editor,j,k,f;if(h.get(m)){return null}i.title=g.translate(i.title);i.scope=i.scope||g;if(!i.onclick){i.onclick=function(n){g.execCommand(i.cmd,i.ui||false,n||i.value)}}if(!i.onselect){i.onselect=function(n){g.execCommand(i.cmd,i.ui||false,n||i.value)}}i=e({title:i.title,"class":"mce_"+m,scope:i.scope,control_manager:h},i);m=h.prefix+m;f=l||h._cls.splitbutton||c.ui.SplitButton;k=h.add(new f(m,i));g.onMouseDown.add(k.hideMenu,k);return k},createColorSplitButton:function(f,n,h){var l=this,j=l.editor,i,k,m,g;if(l.get(f)){return null}n.title=j.translate(n.title);n.scope=n.scope||j;if(!n.onclick){n.onclick=function(o){if(c.isIE){g=j.selection.getBookmark(1)}j.execCommand(n.cmd,n.ui||false,o||n.value)}}if(!n.onselect){n.onselect=function(o){j.execCommand(n.cmd,n.ui||false,o||n.value)}}n=e({title:n.title,"class":"mce_"+f,menu_class:j.getParam("skin")+"Skin",scope:n.scope,more_colors_title:j.getLang("more_colors")},n);f=l.prefix+f;m=h||l._cls.colorsplitbutton||c.ui.ColorSplitButton;k=new m(f,n);j.onMouseDown.add(k.hideMenu,k);j.onRemove.add(function(){k.destroy()});if(c.isIE){k.onShowMenu.add(function(){j.focus();g=j.selection.getBookmark(1)});k.onHideMenu.add(function(){if(g){j.selection.moveToBookmark(g);g=0}})}return l.add(k)},createToolbar:function(k,h,j){var i,g=this,f;k=g.prefix+k;f=j||g._cls.toolbar||c.ui.Toolbar;i=new f(k,h);if(g.get(k)){return null}return g.add(i)},createSeparator:function(g){var f=g||this._cls.separator||c.ui.Separator;return new f()},setControlType:function(g,f){return this._cls[g.toLowerCase()]=f},destroy:function(){d(this.controls,function(f){f.destroy()});this.controls=null}})})(tinymce);(function(d){var a=d.util.Dispatcher,e=d.each,c=d.isIE,b=d.isOpera;d.create("tinymce.WindowManager",{WindowManager:function(f){var g=this;g.editor=f;g.onOpen=new a(g);g.onClose=new a(g);g.params={};g.features={}},open:function(z,h){var v=this,k="",n,m,i=v.editor.settings.dialog_type=="modal",q,o,j,g=d.DOM.getViewPort(),r;z=z||{};h=h||{};o=b?g.w:screen.width;j=b?g.h:screen.height;z.name=z.name||"mc_"+new Date().getTime();z.width=parseInt(z.width||320);z.height=parseInt(z.height||240);z.resizable=true;z.left=z.left||parseInt(o/2)-(z.width/2);z.top=z.top||parseInt(j/2)-(z.height/2);h.inline=false;h.mce_width=z.width;h.mce_height=z.height;h.mce_auto_focus=z.auto_focus;if(i){if(c){z.center=true;z.help=false;z.dialogWidth=z.width+"px";z.dialogHeight=z.height+"px";z.scroll=z.scrollbars||false}}e(z,function(p,f){if(d.is(p,"boolean")){p=p?"yes":"no"}if(!/^(name|url)$/.test(f)){if(c&&i){k+=(k?";":"")+f+":"+p}else{k+=(k?",":"")+f+"="+p}}});v.features=z;v.params=h;v.onOpen.dispatch(v,z,h);r=z.url||z.file;r=d._addVer(r);try{if(c&&i){q=1;window.showModalDialog(r,window,k)}else{q=window.open(r,z.name,k)}}catch(l){}if(!q){alert(v.editor.getLang("popup_blocked"))}},close:function(f){f.close();this.onClose.dispatch(this)},createInstance:function(i,h,g,m,l,k){var j=d.resolve(i);return new j(h,g,m,l,k)},confirm:function(h,f,i,g){g=g||window;f.call(i||this,g.confirm(this._decode(this.editor.getLang(h,h))))},alert:function(h,f,j,g){var i=this;g=g||window;g.alert(i._decode(i.editor.getLang(h,h)));if(f){f.call(j||i)}},_decode:function(f){return d.DOM.decode(f).replace(/\\n/g,"\n")}})}(tinymce));(function(a){a.CommandManager=function(){var c={},b={},d={};function e(i,h,g,f){if(typeof(h)=="string"){h=[h]}a.each(h,function(j){i[j.toLowerCase()]={func:g,scope:f}})}a.extend(this,{add:function(h,g,f){e(c,h,g,f)},addQueryStateHandler:function(h,g,f){e(b,h,g,f)},addQueryValueHandler:function(h,g,f){e(d,h,g,f)},execCommand:function(g,j,i,h,f){if(j=c[j.toLowerCase()]){if(j.func.call(g||j.scope,i,h,f)!==false){return true}}},queryCommandValue:function(){if(cmd=d[cmd.toLowerCase()]){return cmd.func.call(scope||cmd.scope,ui,value,args)}},queryCommandState:function(){if(cmd=b[cmd.toLowerCase()]){return cmd.func.call(scope||cmd.scope,ui,value,args)}}})};a.GlobalCommands=new a.CommandManager()})(tinymce);(function(b){function a(i,d,h,m){var j,g,e,l,f;function k(p,o){do{if(p.parentNode==o){return p}p=p.parentNode}while(p)}function c(o){m(o);b.walk(o,m,"childNodes")}j=i.findCommonAncestor(d,h);e=k(d,j)||d;l=k(h,j)||h;for(g=d;g&&g!=e;g=g.parentNode){for(f=g.nextSibling;f;f=f.nextSibling){c(f)}}if(e!=l){for(g=e.nextSibling;g&&g!=l;g=g.nextSibling){c(g)}}else{c(e)}for(g=h;g&&g!=l;g=g.parentNode){for(f=g.previousSibling;f;f=f.previousSibling){c(f)}}}b.GlobalCommands.add("RemoveFormat",function(){var m=this,l=m.dom,u=m.selection,d=u.getRng(1),e=[],h,f,j,q,g,o,c,i;function k(s){var r;l.getParent(s,function(v){if(l.is(v,m.getParam("removeformat_selector"))){r=v}return l.isBlock(v)},m.getBody());return r}function p(r){if(l.is(r,m.getParam("removeformat_selector"))){e.push(r)}}function t(r){p(r);b.walk(r,p,"childNodes")}h=u.getBookmark();q=d.startContainer;o=d.endContainer;g=d.startOffset;c=d.endOffset;q=q.nodeType==1?q.childNodes[Math.min(g,q.childNodes.length-1)]:q;o=o.nodeType==1?o.childNodes[Math.min(g==c?c:c-1,o.childNodes.length-1)]:o;if(q==o){f=k(q);if(q.nodeType==3){if(f&&f.nodeType==1){i=q.splitText(g);i.splitText(c-g);l.split(f,i);u.moveToBookmark(h)}return}t(l.split(f,q)||q)}else{f=k(q);j=k(o);if(f){if(q.nodeType==3){if(g==q.nodeValue.length){q.nodeValue+="\uFEFF"}q=q.splitText(g)}}if(j){if(o.nodeType==3){o.splitText(c)}}if(f&&f==j){l.replace(l.create("span",{id:"__end"},o.cloneNode(true)),o)}if(f){f=l.split(f,q)}else{f=q}if(i=l.get("__end")){o=i;j=k(o)}if(j){j=l.split(j,o)}else{j=o}a(l,f,j,p);if(q.nodeValue=="\uFEFF"){q.nodeValue=""}t(o);t(q)}b.each(e,function(r){l.remove(r,1)});l.remove("__end",1);u.moveToBookmark(h)})})(tinymce);(function(a){a.GlobalCommands.add("mceBlockQuote",function(){var j=this,o=j.selection,f=j.dom,l,k,e,d,p,c,m,h,b;function g(i){return f.getParent(i,function(q){return q.nodeName==="BLOCKQUOTE"})}l=f.getParent(o.getStart(),f.isBlock);k=f.getParent(o.getEnd(),f.isBlock);if(p=g(l)){if(l!=k||l.childNodes.length>1||(l.childNodes.length==1&&l.firstChild.nodeName!="BR")){d=o.getBookmark()}if(g(k)){m=p.cloneNode(false);while(e=k.nextSibling){m.appendChild(e.parentNode.removeChild(e))}}if(m){f.insertAfter(m,p)}b=o.getSelectedBlocks(l,k);for(h=b.length-1;h>=0;h--){f.insertAfter(b[h],p)}if(/^\s*$/.test(p.innerHTML)){f.remove(p,1)}if(m&&/^\s*$/.test(m.innerHTML)){f.remove(m,1)}if(!d){if(!a.isIE){c=j.getDoc().createRange();c.setStart(l,0);c.setEnd(l,0);o.setRng(c)}else{o.select(l);o.collapse(0);if(f.getParent(o.getStart(),f.isBlock)!=l){c=o.getRng();c.move("character",-1);c.select()}}}else{j.selection.moveToBookmark(d)}return}if(a.isIE&&!l&&!k){j.getDoc().execCommand("Indent");e=g(o.getNode());e.style.margin=e.dir="";return}if(!l||!k){return}if(l!=k||l.childNodes.length>1||(l.childNodes.length==1&&l.firstChild.nodeName!="BR")){d=o.getBookmark()}a.each(o.getSelectedBlocks(g(o.getStart()),g(o.getEnd())),function(i){if(i.nodeName=="BLOCKQUOTE"&&!p){p=i;return}if(!p){p=f.create("blockquote");i.parentNode.insertBefore(p,i)}if(i.nodeName=="BLOCKQUOTE"&&p){e=i.firstChild;while(e){p.appendChild(e.cloneNode(true));e=e.nextSibling}f.remove(i);return}p.appendChild(f.remove(i))});if(!d){if(!a.isIE){c=j.getDoc().createRange();c.setStart(l,0);c.setEnd(l,0);o.setRng(c)}else{o.select(l);o.collapse(1)}}else{o.moveToBookmark(d)}})})(tinymce);(function(a){a.each(["Cut","Copy","Paste"],function(b){a.GlobalCommands.add(b,function(){var c=this,e=c.getDoc();try{e.execCommand(b,false,null);if(!e.queryCommandSupported(b)){throw"Error"}}catch(d){c.windowManager.alert(c.getLang("clipboard_no_support"))}})})})(tinymce);(function(a){a.GlobalCommands.add("InsertHorizontalRule",function(){if(a.isOpera){return this.getDoc().execCommand("InsertHorizontalRule",false,"")}this.selection.setContent("<hr />")})})(tinymce);(function(){var a=tinymce.GlobalCommands;a.add(["mceEndUndoLevel","mceAddUndoLevel"],function(){this.undoManager.add()});a.add("Undo",function(){var b=this;if(b.settings.custom_undo_redo){b.undoManager.undo();b.nodeChanged();return true}return false});a.add("Redo",function(){var b=this;if(b.settings.custom_undo_redo){b.undoManager.redo();b.nodeChanged();return true}return false})})();
\ No newline at end of file
diff -x .svn -aruN 0.7.15.src/e107_handlers/tiny_mce/tiny_mce_popup.js 0.7.16.src/e107_handlers/tiny_mce/tiny_mce_popup.js
--- 0.7.15.src/e107_handlers/tiny_mce/tiny_mce_popup.js	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_handlers/tiny_mce/tiny_mce_popup.js	2009-06-30 19:36:50.000000000 -0500
@@ -1,288 +1,5 @@
-// Some global instances, this will be filled later
-var tinyMCE = null, tinyMCELang = null;
 
-function TinyMCE_Popup() {
-};
+// Uncomment and change this document.domain value if you are loading the script cross subdomains
+// document.domain = 'moxiecode.com';
 
-TinyMCE_Popup.prototype = {
-	findWin : function(w) {
-		var c;
-
-		// Check parents
-		c = w;
-		while (c && (c = c.parent) != null) {
-			if (typeof(c.tinyMCE) != "undefined")
-				return c;
-		}
-
-		// Check openers
-		c = w;
-		while (c && (c = c.opener) != null) {
-			if (typeof(c.tinyMCE) != "undefined")
-				return c;
-		}
-
-		// Try top
-		if (typeof(top.tinyMCE) != "undefined")
-			return top;
-
-		return null;
-	},
-
-	init : function() {
-		var win = window.opener ? window.opener : window.dialogArguments, c;
-		var inst;
-
-		if (!win)
-			win = this.findWin(window);
-
-		if (!win) {
-			alert("tinyMCE object reference not found from popup.");
-			return;
-		}
-
-		window.opener = win;
-		this.windowOpener = win;
-		this.onLoadEval = "";
-
-		// Setup parent references
-		tinyMCE = win.tinyMCE;
-		tinyMCELang = win.tinyMCELang;
-
-		inst = tinyMCE.selectedInstance;
-		this.isWindow = tinyMCE.getWindowArg('mce_inside_iframe', false) == false;
-		this.storeSelection = (tinyMCE.isRealIE) && !this.isWindow && tinyMCE.getWindowArg('mce_store_selection', true);
-
-		if (this.isWindow)
-			window.focus();
-
-		// Store selection
-		if (this.storeSelection)
-			inst.selectionBookmark = inst.selection.getBookmark(true);
-
-		// Setup dir
-		if (tinyMCELang['lang_dir'])
-			document.dir = tinyMCELang['lang_dir'];
-
-		// Setup title
-		var re = new RegExp('{|\\\$|}', 'g');
-		var title = document.title.replace(re, "");
-		if (typeof tinyMCELang[title] != "undefined") {
-			var divElm = document.createElement("div");
-			divElm.innerHTML = tinyMCELang[title];
-			document.title = divElm.innerHTML;
-
-			if (tinyMCE.setWindowTitle != null)
-				tinyMCE.setWindowTitle(window, divElm.innerHTML);
-		}
-
-		// Output Popup CSS class
-		document.write('<link href="' + tinyMCE.getParam("popups_css") + '" rel="stylesheet" type="text/css">');
-
-		if (tinyMCE.getParam("popups_css_add")) {
-			c = tinyMCE.getParam("popups_css_add");
-
-			// Is relative
-			if (c.indexOf('://') == -1 && c.charAt(0) != '/')
-				c = tinyMCE.documentBasePath + "/" + c;
-
-			document.write('<link href="' + c + '" rel="stylesheet" type="text/css">');
-		}
-
-		tinyMCE.addEvent(window, "load", this.onLoad);
-	},
-
-	onLoad : function() {
-		var dir, i, elms, body = document.body;
-
-		if (tinyMCE.getWindowArg('mce_replacevariables', true))
-			body.innerHTML = tinyMCE.applyTemplate(body.innerHTML, tinyMCE.windowArgs);
-
-		dir = tinyMCE.selectedInstance.settings['directionality'];
-		if (dir == "rtl" && document.forms && document.forms.length > 0) {
-			elms = document.forms[0].elements;
-			for (i=0; i<elms.length; i++) {
-				if ((elms[i].type == "text" || elms[i].type == "textarea") && elms[i].getAttribute("dir") != "ltr")
-					elms[i].dir = dir;
-			}
-		}
-
-		if (body.style.display == 'none')
-			body.style.display = 'block';
-
-		// Execute real onload (Opera fix)
-		if (tinyMCEPopup.onLoadEval != "")
-			eval(tinyMCEPopup.onLoadEval);
-	},
-
-	executeOnLoad : function(str) {
-		if (tinyMCE.isOpera)
-			this.onLoadEval = str;
-		else
-			eval(str);
-	},
-
-	resizeToInnerSize : function() {
-		// Netscape 7.1 workaround
-		if (this.isWindow && tinyMCE.isNS71) {
-			window.resizeBy(0, 10);
-			return;
-		}
-
-		if (this.isWindow) {
-			var doc = document;
-			var body = doc.body;
-			var oldMargin, wrapper, iframe, nodes, dx, dy;
-
-			if (body.style.display == 'none')
-				body.style.display = 'block';
-
-			// Remove margin
-			oldMargin = body.style.margin;
-			body.style.margin = '0';
-
-			// Create wrapper
-			wrapper = doc.createElement("div");
-			wrapper.id = 'mcBodyWrapper';
-			wrapper.style.display = 'none';
-			wrapper.style.margin = '0';
-
-			// Wrap body elements
-			nodes = doc.body.childNodes;
-			for (var i=nodes.length-1; i>=0; i--) {
-				if (wrapper.hasChildNodes())
-					wrapper.insertBefore(nodes[i].cloneNode(true), wrapper.firstChild);
-				else
-					wrapper.appendChild(nodes[i].cloneNode(true));
-
-				nodes[i].parentNode.removeChild(nodes[i]);
-			}
-
-			// Add wrapper
-			doc.body.appendChild(wrapper);
-
-			// Create iframe
-			iframe = document.createElement("iframe");
-			iframe.id = "mcWinIframe";
-			iframe.src = document.location.href.toLowerCase().indexOf('https') == -1 ? "about:blank" : tinyMCE.settings['default_document'];
-			iframe.width = "100%";
-			iframe.height = "100%";
-			iframe.style.margin = '0';
-
-			// Add iframe
-			doc.body.appendChild(iframe);
-
-			// Measure iframe
-			iframe = document.getElementById('mcWinIframe');
-			dx = tinyMCE.getWindowArg('mce_width') - iframe.clientWidth;
-			dy = tinyMCE.getWindowArg('mce_height') - iframe.clientHeight;
-
-			// Resize window
-			// tinyMCE.debug(tinyMCE.getWindowArg('mce_width') + "," + tinyMCE.getWindowArg('mce_height') + " - " + dx + "," + dy);
-			window.resizeBy(dx, dy);
-
-			// Hide iframe and show wrapper
-			body.style.margin = oldMargin;
-			iframe.style.display = 'none';
-			wrapper.style.display = 'block';
-		}
-	},
-
-	resizeToContent : function() {
-		var isMSIE = (navigator.appName == "Microsoft Internet Explorer");
-		var isOpera = (navigator.userAgent.indexOf("Opera") != -1);
-
-		if (isOpera)
-			return;
-
-		if (isMSIE) {
-			try { window.resizeTo(10, 10); } catch (e) {}
-
-			var elm = document.body;
-			var width = elm.offsetWidth;
-			var height = elm.offsetHeight;
-			var dx = (elm.scrollWidth - width) + 4;
-			var dy = elm.scrollHeight - height;
-
-			try { window.resizeBy(dx, dy); } catch (e) {}
-		} else {
-			window.scrollBy(1000, 1000);
-			if (window.scrollX > 0 || window.scrollY > 0) {
-				window.resizeBy(window.innerWidth * 2, window.innerHeight * 2);
-				window.sizeToContent();
-				window.scrollTo(0, 0);
-				var x = parseInt(screen.width / 2.0) - (window.outerWidth / 2.0);
-				var y = parseInt(screen.height / 2.0) - (window.outerHeight / 2.0);
-				window.moveTo(x, y);
-			}
-		}
-	},
-
-	getWindowArg : function(name, default_value) {
-		return tinyMCE.getWindowArg(name, default_value);
-	},
-
-	restoreSelection : function() {
-		if (this.storeSelection) {
-			var inst = tinyMCE.selectedInstance;
-
-			inst.getWin().focus();
-
-			if (inst.selectionBookmark)
-				inst.selection.moveToBookmark(inst.selectionBookmark);
-		}
-	},
-
-	execCommand : function(command, user_interface, value) {
-		var inst = tinyMCE.selectedInstance;
-
-		this.restoreSelection();
-		inst.execCommand(command, user_interface, value);
-
-		// Store selection
-		if (this.storeSelection)
-			inst.selectionBookmark = inst.selection.getBookmark(true);
-	},
-
-	close : function() {
-		tinyMCE.closeWindow(window);
-	},
-
-	pickColor : function(e, element_id) {
-		tinyMCE.selectedInstance.execCommand('mceColorPicker', true, {
-			element_id : element_id,
-			document : document,
-			window : window,
-			store_selection : false
-		});
-	},
-
-	openBrowser : function(element_id, type, option) {
-		var cb = tinyMCE.getParam(option, tinyMCE.getParam("file_browser_callback"));
-		var url = document.getElementById(element_id).value;
-
-		tinyMCE.setWindowArg("window", window);
-		tinyMCE.setWindowArg("document", document);
-
-		// Call to external callback
-		if (eval('typeof(tinyMCEPopup.windowOpener.' + cb + ')') == "undefined")
-			alert("Callback function: " + cb + " could not be found.");
-		else
-			eval("tinyMCEPopup.windowOpener." + cb + "(element_id, url, type, window);");
-	},
-
-	importClass : function(c) {
-		window[c] = function() {};
-
-		for (var n in window.opener[c].prototype)
-			window[c].prototype[n] = window.opener[c].prototype[n];
-
-		window[c].constructor = window.opener[c].constructor;
-	}
-
-	};
-
-// Setup global instance
-var tinyMCEPopup = new TinyMCE_Popup();
-
-tinyMCEPopup.init();
+var tinymce=null,tinyMCEPopup,tinyMCE;tinyMCEPopup={init:function(){var b=this,a,c;a=b.getWin();tinymce=a.tinymce;tinyMCE=a.tinyMCE;b.editor=tinymce.EditorManager.activeEditor;b.params=b.editor.windowManager.params;b.features=b.editor.windowManager.features;b.dom=b.editor.windowManager.createInstance("tinymce.dom.DOMUtils",document);if(b.features.popup_css!==false){b.dom.loadCSS(b.features.popup_css||b.editor.settings.popup_css)}b.listeners=[];b.onInit={add:function(e,d){b.listeners.push({func:e,scope:d})}};b.isWindow=!b.getWindowArg("mce_inline");b.id=b.getWindowArg("mce_window_id");b.editor.windowManager.onOpen.dispatch(b.editor.windowManager,window)},getWin:function(){return window.dialogArguments||opener||parent||top},getWindowArg:function(c,b){var a=this.params[c];return tinymce.is(a)?a:b},getParam:function(b,a){return this.editor.getParam(b,a)},getLang:function(b,a){return this.editor.getLang(b,a)},execCommand:function(d,c,e,b){b=b||{};b.skip_focus=1;this.restoreSelection();return this.editor.execCommand(d,c,e,b)},resizeToInnerSize:function(){var e=this,g,a=document.body,c=e.dom.getViewPort(window),d,f;d=e.getWindowArg("mce_width")-c.w;f=e.getWindowArg("mce_height")-c.h;if(e.isWindow){window.resizeBy(d,f)}else{e.editor.windowManager.resizeBy(d,f,e.id)}},executeOnLoad:function(s){this.onInit.add(function(){eval(s)})},storeSelection:function(){this.editor.windowManager.bookmark=tinyMCEPopup.editor.selection.getBookmark(1)},restoreSelection:function(){var a=tinyMCEPopup;if(!a.isWindow&&tinymce.isIE){a.editor.selection.moveToBookmark(a.editor.windowManager.bookmark)}},requireLangPack:function(){var b=this,a=b.getWindowArg("plugin_url")||b.getWindowArg("theme_url");if(a&&b.editor.settings.language&&b.features.translate_i18n!==false){a+="/langs/"+b.editor.settings.language+"_dlg.js";if(!tinymce.ScriptLoader.isDone(a)){document.write('<script type="text/javascript" src="'+tinymce._addVer(a)+'"><\/script>');tinymce.ScriptLoader.markDone(a)}}},pickColor:function(b,a){this.execCommand("mceColorPicker",true,{color:document.getElementById(a).value,func:function(e){document.getElementById(a).value=e;try{document.getElementById(a).onchange()}catch(d){}}})},openBrowser:function(a,c,b){tinyMCEPopup.restoreSelection();this.editor.execCallback("file_browser_callback",a,document.getElementById(a).value,c,window)},confirm:function(b,a,c){this.editor.windowManager.confirm(b,a,c,window)},alert:function(b,a,c){this.editor.windowManager.alert(b,a,c,window)},close:function(){var a=this;function b(){a.editor.windowManager.close(window);tinymce=tinyMCE=a.editor=a.params=a.dom=a.dom.doc=null}if(tinymce.isOpera){a.getWin().setTimeout(b,0)}else{b()}},_restoreSelection:function(){var a=window.event.srcElement;if(a.nodeName=="INPUT"&&(a.type=="submit"||a.type=="button")){tinyMCEPopup.restoreSelection()}},_onDOMLoaded:function(){var b=tinyMCEPopup,d=document.title,e,c,a;if(b.domLoaded){return}b.domLoaded=1;if(b.features.translate_i18n!==false){c=document.body.innerHTML;if(tinymce.isIE){c=c.replace(/ (value|title|alt)=([^"][^\s>]+)/gi,' $1="$2"')}document.dir=b.editor.getParam("directionality","");if((a=b.editor.translate(c))&&a!=c){document.body.innerHTML=a}if((a=b.editor.translate(d))&&a!=d){document.title=d=a}}document.body.style.display="";if(tinymce.isIE){document.attachEvent("onmouseup",tinyMCEPopup._restoreSelection);b.dom.add(b.dom.select("head")[0],"base",{target:"_self"})}b.restoreSelection();b.resizeToInnerSize();if(!b.isWindow){b.editor.windowManager.setTitle(window,d)}else{window.focus()}if(!tinymce.isIE&&!b.isWindow){tinymce.dom.Event._add(document,"focus",function(){b.editor.windowManager.focus(b.id)})}tinymce.each(b.dom.select("select"),function(f){f.onkeydown=tinyMCEPopup._accessHandler});tinymce.each(b.listeners,function(f){f.func.call(f.scope,b.editor)});if(b.getWindowArg("mce_auto_focus",true)){window.focus();tinymce.each(document.forms,function(g){tinymce.each(g.elements,function(f){if(b.dom.hasClass(f,"mceFocus")&&!f.disabled){f.focus();return false}})})}document.onkeyup=tinyMCEPopup._closeWinKeyHandler},_accessHandler:function(a){a=a||window.event;if(a.keyCode==13||a.keyCode==32){a=a.target||a.srcElement;if(a.onchange){a.onchange()}return tinymce.dom.Event.cancel(a)}},_closeWinKeyHandler:function(a){a=a||window.event;if(a.keyCode==27){tinyMCEPopup.close()}},_wait:function(){if(document.attachEvent){document.attachEvent("onreadystatechange",function(){if(document.readyState==="complete"){document.detachEvent("onreadystatechange",arguments.callee);tinyMCEPopup._onDOMLoaded()}});if(document.documentElement.doScroll&&window==window.top){(function(){if(tinyMCEPopup.domLoaded){return}try{document.documentElement.doScroll("left")}catch(a){setTimeout(arguments.callee,0);return}tinyMCEPopup._onDOMLoaded()})()}document.attachEvent("onload",tinyMCEPopup._onDOMLoaded)}else{if(document.addEventListener){window.addEventListener("DOMContentLoaded",tinyMCEPopup._onDOMLoaded,false);window.addEventListener("load",tinyMCEPopup._onDOMLoaded,false)}}}};tinyMCEPopup.init();tinyMCEPopup._wait();
\ No newline at end of file
diff -x .svn -aruN 0.7.15.src/e107_handlers/tiny_mce/tiny_mce_src.js 0.7.16.src/e107_handlers/tiny_mce/tiny_mce_src.js
--- 0.7.15.src/e107_handlers/tiny_mce/tiny_mce_src.js	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_handlers/tiny_mce/tiny_mce_src.js	2009-06-30 19:36:50.000000000 -0500
@@ -1,7284 +1,13030 @@
+var tinymce = {
+	majorVersion : '3',
+	minorVersion : '2.5',
+	releaseDate : '2009-06-29',
+
+	_init : function() {
+		var t = this, d = document, w = window, na = navigator, ua = na.userAgent, i, nl, n, base, p, v;
+
+		// Browser checks
+		t.isOpera = w.opera && opera.buildNumber;
+		t.isWebKit = /WebKit/.test(ua);
+		t.isIE = !t.isWebKit && !t.isOpera && (/MSIE/gi).test(ua) && (/Explorer/gi).test(na.appName);
+		t.isIE6 = t.isIE && /MSIE [56]/.test(ua);
+		t.isGecko = !t.isWebKit && /Gecko/.test(ua);
+		t.isMac = ua.indexOf('Mac') != -1;
+		t.isAir = /adobeair/i.test(ua);
+
+		// TinyMCE .NET webcontrol might be setting the values for TinyMCE
+		if (w.tinyMCEPreInit) {
+			t.suffix = tinyMCEPreInit.suffix;
+			t.baseURL = tinyMCEPreInit.base;
+			t.query = tinyMCEPreInit.query;
+			return;
+		}
 
-/* file:jscripts/tiny_mce/classes/TinyMCE_Engine.class.js */
+		// Get suffix and base
+		t.suffix = '';
 
-function TinyMCE_Engine() {
-	var ua;
+		// If base element found, add that infront of baseURL
+		nl = d.getElementsByTagName('base');
+		for (i=0; i<nl.length; i++) {
+			if (v = nl[i].href) {
+				// Host only value like http://site.com or http://site.com:8008
+				if (/^https?:\/\/[^\/]+$/.test(v))
+					v += '/';
 
-	this.majorVersion = "2";
-	this.minorVersion = "0.8";
-	this.releaseDate = "2006-10-23";
-
-	this.instances = new Array();
-	this.switchClassCache = new Array();
-	this.windowArgs = new Array();
-	this.loadedFiles = new Array();
-	this.pendingFiles = new Array();
-	this.loadingIndex = 0;
-	this.configs = new Array();
-	this.currentConfig = 0;
-	this.eventHandlers = new Array();
-	this.log = new Array();
-	this.undoLevels = [];
-	this.undoIndex = 0;
-	this.typingUndoIndex = -1;
-
-	// Browser check
-	ua = navigator.userAgent;
-	this.isMSIE = (navigator.appName == "Microsoft Internet Explorer");
-	this.isMSIE5 = this.isMSIE && (ua.indexOf('MSIE 5') != -1);
-	this.isMSIE5_0 = this.isMSIE && (ua.indexOf('MSIE 5.0') != -1);
-	this.isMSIE7 = this.isMSIE && (ua.indexOf('MSIE 7') != -1);
-	this.isGecko = ua.indexOf('Gecko') != -1;
-	this.isSafari = ua.indexOf('Safari') != -1;
-	this.isOpera = ua.indexOf('Opera') != -1;
-	this.isMac = ua.indexOf('Mac') != -1;
-	this.isNS7 = ua.indexOf('Netscape/7') != -1;
-	this.isNS71 = ua.indexOf('Netscape/7.1') != -1;
-	this.dialogCounter = 0;
-	this.plugins = new Array();
-	this.themes = new Array();
-	this.menus = new Array();
-	this.loadedPlugins = new Array();
-	this.buttonMap = new Array();
-	this.isLoaded = false;
-
-	// Fake MSIE on Opera and if Opera fakes IE, Gecko or Safari cancel those
-	if (this.isOpera) {
-		this.isMSIE = true;
-		this.isGecko = false;
-		this.isSafari =  false;
-	}
+				base = v ? v.match(/.*\//)[0] : ''; // Get only directory
+			}
+		}
 
-	this.isIE = this.isMSIE;
-	this.isRealIE = this.isMSIE && !this.isOpera;
+		function getBase(n) {
+			if (n.src && /tiny_mce(|_gzip|_jquery|_prototype)(_dev|_src)?.js/.test(n.src)) {
+				if (/_(src|dev)\.js/g.test(n.src))
+					t.suffix = '_src';
 
-	// TinyMCE editor id instance counter
-	this.idCounter = 0;
-};
+				if ((p = n.src.indexOf('?')) != -1)
+					t.query = n.src.substring(p + 1);
 
-TinyMCE_Engine.prototype = {
-	init : function(settings) {
-		var theme, nl, baseHREF = "", i;
+				t.baseURL = n.src.substring(0, n.src.lastIndexOf('/'));
 
-		// IE 5.0x is no longer supported since 5.5, 6.0 and 7.0 now exists. We can't support old browsers forever, sorry.
-		if (this.isMSIE5_0)
-			return;
+				// If path to script is relative and a base href was found add that one infront
+				if (base && t.baseURL.indexOf('://') == -1)
+					t.baseURL = base + t.baseURL;
 
-		this.settings = settings;
+				return t.baseURL;
+			}
 
-		// Check if valid browser has execcommand support
-		if (typeof(document.execCommand) == 'undefined')
-			return;
+			return null;
+		};
 
-		// Get script base path
-		if (!tinyMCE.baseURL) {
-			var elements = document.getElementsByTagName('script');
+		// Check document
+		nl = d.getElementsByTagName('script');
+		for (i=0; i<nl.length; i++) {
+			if (getBase(nl[i]))
+				return;
+		}
 
-			// If base element found, add that infront of baseURL
-			nl = document.getElementsByTagName('base');
+		// Check head
+		n = d.getElementsByTagName('head')[0];
+		if (n) {
+			nl = n.getElementsByTagName('script');
 			for (i=0; i<nl.length; i++) {
-				if (nl[i].href)
-					baseHREF = nl[i].href;
+				if (getBase(nl[i]))
+					return;
 			}
+		}
 
-			for (var i=0; i<elements.length; i++) {
-				if (elements[i].src && (elements[i].src.indexOf("tiny_mce.js") != -1 || elements[i].src.indexOf("tiny_mce_dev.js") != -1 || elements[i].src.indexOf("tiny_mce_src.js") != -1 || elements[i].src.indexOf("tiny_mce_gzip") != -1)) {
-					var src = elements[i].src;
+		return;
+	},
 
-					tinyMCE.srcMode = (src.indexOf('_src') != -1 || src.indexOf('_dev') != -1) ? '_src' : '';
-					tinyMCE.gzipMode = src.indexOf('_gzip') != -1;
-					src = src.substring(0, src.lastIndexOf('/'));
+	is : function(o, t) {
+		var n = typeof(o);
 
-					if (settings.exec_mode == "src" || settings.exec_mode == "normal")
-						tinyMCE.srcMode = settings.exec_mode == "src" ? '_src' : '';
+		if (!t)
+			return n != 'undefined';
 
-					// Force it absolute if page has a base href
-					if (baseHREF != "" && src.indexOf('://') == -1)
-						tinyMCE.baseURL = baseHREF + src;
-					else
-						tinyMCE.baseURL = src;
+		if (t == 'array' && (o.hasOwnProperty && o instanceof Array))
+			return true;
 
-					break;
+		return n == t;
+	},
+
+
+	each : function(o, cb, s) {
+		var n, l;
+
+		if (!o)
+			return 0;
+
+		s = s || o;
+
+		if (typeof(o.length) != 'undefined') {
+			// Indexed arrays, needed for Safari
+			for (n=0, l = o.length; n<l; n++) {
+				if (cb.call(s, o[n], n, o) === false)
+					return 0;
+			}
+		} else {
+			// Hashtables
+			for (n in o) {
+				if (o.hasOwnProperty(n)) {
+					if (cb.call(s, o[n], n, o) === false)
+						return 0;
 				}
 			}
 		}
 
-		// Get document base path
-		this.documentBasePath = document.location.href;
-		if (this.documentBasePath.indexOf('?') != -1)
-			this.documentBasePath = this.documentBasePath.substring(0, this.documentBasePath.indexOf('?'));
-		this.documentURL = this.documentBasePath;
-		this.documentBasePath = this.documentBasePath.substring(0, this.documentBasePath.lastIndexOf('/'));
-
-		// If not HTTP absolute
-		if (tinyMCE.baseURL.indexOf('://') == -1 && tinyMCE.baseURL.charAt(0) != '/') {
-			// If site absolute
-			tinyMCE.baseURL = this.documentBasePath + "/" + tinyMCE.baseURL;
-		}
-
-		// Set default values on settings
-		this._def("mode", "none");
-		this._def("theme", "advanced");
-		this._def("plugins", "", true);
-		this._def("language", "en");
-		this._def("docs_language", this.settings['language']);
-		this._def("elements", "");
-		this._def("textarea_trigger", "mce_editable");
-		this._def("editor_selector", "");
-		this._def("editor_deselector", "mceNoEditor");
-		this._def("valid_elements", "+a[id|style|rel|rev|charset|hreflang|dir|lang|tabindex|accesskey|type|name|href|target|title|class|onfocus|onblur|onclick|ondblclick|onmousedown|onmouseup|onmouseover|onmousemove|onmouseout|onkeypress|onkeydown|onkeyup],-strong/-b[class|style],-em/-i[class|style],-strike[class|style],-u[class|style],#p[id|style|dir|class|align],-ol[class|style],-ul[class|style],-li[class|style],br,img[id|dir|lang|longdesc|usemap|style|class|src|onmouseover|onmouseout|border|alt=|title|hspace|vspace|width|height|align],-sub[style|class],-sup[style|class],-blockquote[dir|style],-table[border=0|cellspacing|cellpadding|width|height|class|align|summary|style|dir|id|lang|bgcolor|background|bordercolor],-tr[id|lang|dir|class|rowspan|width|height|align|valign|style|bgcolor|background|bordercolor],tbody[id|class],thead[id|class],tfoot[id|class],#td[id|lang|dir|class|colspan|rowspan|width|height|align|valign|style|bgcolor|background|bordercolor|scope],-th[id|lang|dir|class|colspan|rowspan|width|height|align|valign|style|scope],caption[id|lang|dir|class|style],-div[id|dir|class|align|style],-span[style|class|align],-pre[class|align|style],address[class|align|style],-h1[id|style|dir|class|align],-h2[id|style|dir|class|align],-h3[id|style|dir|class|align],-h4[id|style|dir|class|align],-h5[id|style|dir|class|align],-h6[id|style|dir|class|align],hr[class|style],-font[face|size|style|id|class|dir|color],dd[id|class|title|style|dir|lang],dl[id|class|title|style|dir|lang],dt[id|class|title|style|dir|lang],cite[title|id|class|style|dir|lang],abbr[title|id|class|style|dir|lang],acronym[title|id|class|style|dir|lang],del[title|id|class|style|dir|lang|datetime|cite],ins[title|id|class|style|dir|lang|datetime|cite]");
-		this._def("extended_valid_elements", "");
-		this._def("invalid_elements", "");
-		this._def("encoding", "");
-		this._def("urlconverter_callback", tinyMCE.getParam("urlconvertor_callback", "TinyMCE_Engine.prototype.convertURL"));
-		this._def("save_callback", "");
-		this._def("debug", false);
-		this._def("force_br_newlines", false);
-		this._def("force_p_newlines", true);
-		this._def("add_form_submit_trigger", true);
-		this._def("relative_urls", true);
-		this._def("remove_script_host", true);
-		this._def("focus_alert", true);
-		this._def("document_base_url", this.documentURL);
-		this._def("visual", true);
-		this._def("visual_table_class", "mceVisualAid");
-		this._def("setupcontent_callback", "");
-		this._def("fix_content_duplication", true);
-		this._def("custom_undo_redo", true);
-		this._def("custom_undo_redo_levels", -1);
-		this._def("custom_undo_redo_keyboard_shortcuts", true);
-		this._def("custom_undo_redo_restore_selection", true);
-		this._def("custom_undo_redo_global", false);
-		this._def("verify_html", true);
-		this._def("apply_source_formatting", false);
-		this._def("directionality", "ltr");
-		this._def("cleanup_on_startup", false);
-		this._def("inline_styles", false);
-		this._def("convert_newlines_to_brs", false);
-		this._def("auto_reset_designmode", true);
-		this._def("entities", "39,#39,160,nbsp,161,iexcl,162,cent,163,pound,164,curren,165,yen,166,brvbar,167,sect,168,uml,169,copy,170,ordf,171,laquo,172,not,173,shy,174,reg,175,macr,176,deg,177,plusmn,178,sup2,179,sup3,180,acute,181,micro,182,para,183,middot,184,cedil,185,sup1,186,ordm,187,raquo,188,frac14,189,frac12,190,frac34,191,iquest,192,Agrave,193,Aacute,194,Acirc,195,Atilde,196,Auml,197,Aring,198,AElig,199,Ccedil,200,Egrave,201,Eacute,202,Ecirc,203,Euml,204,Igrave,205,Iacute,206,Icirc,207,Iuml,208,ETH,209,Ntilde,210,Ograve,211,Oacute,212,Ocirc,213,Otilde,214,Ouml,215,times,216,Oslash,217,Ugrave,218,Uacute,219,Ucirc,220,Uuml,221,Yacute,222,THORN,223,szlig,224,agrave,225,aacute,226,acirc,227,atilde,228,auml,229,aring,230,aelig,231,ccedil,232,egrave,233,eacute,234,ecirc,235,euml,236,igrave,237,iacute,238,icirc,239,iuml,240,eth,241,ntilde,242,ograve,243,oacute,244,ocirc,245,otilde,246,ouml,247,divide,248,oslash,249,ugrave,250,uacute,251,ucirc,252,uuml,253,yacute,254,thorn,255,yuml,402,fnof,913,Alpha,914,Beta,915,Gamma,916,Delta,917,Epsilon,918,Zeta,919,Eta,920,Theta,921,Iota,922,Kappa,923,Lambda,924,Mu,925,Nu,926,Xi,927,Omicron,928,Pi,929,Rho,931,Sigma,932,Tau,933,Upsilon,934,Phi,935,Chi,936,Psi,937,Omega,945,alpha,946,beta,947,gamma,948,delta,949,epsilon,950,zeta,951,eta,952,theta,953,iota,954,kappa,955,lambda,956,mu,957,nu,958,xi,959,omicron,960,pi,961,rho,962,sigmaf,963,sigma,964,tau,965,upsilon,966,phi,967,chi,968,psi,969,omega,977,thetasym,978,upsih,982,piv,8226,bull,8230,hellip,8242,prime,8243,Prime,8254,oline,8260,frasl,8472,weierp,8465,image,8476,real,8482,trade,8501,alefsym,8592,larr,8593,uarr,8594,rarr,8595,darr,8596,harr,8629,crarr,8656,lArr,8657,uArr,8658,rArr,8659,dArr,8660,hArr,8704,forall,8706,part,8707,exist,8709,empty,8711,nabla,8712,isin,8713,notin,8715,ni,8719,prod,8721,sum,8722,minus,8727,lowast,8730,radic,8733,prop,8734,infin,8736,ang,8743,and,8744,or,8745,cap,8746,cup,8747,int,8756,there4,8764,sim,8773,cong,8776,asymp,8800,ne,8801,equiv,8804,le,8805,ge,8834,sub,8835,sup,8836,nsub,8838,sube,8839,supe,8853,oplus,8855,otimes,8869,perp,8901,sdot,8968,lceil,8969,rceil,8970,lfloor,8971,rfloor,9001,lang,9002,rang,9674,loz,9824,spades,9827,clubs,9829,hearts,9830,diams,34,quot,38,amp,60,lt,62,gt,338,OElig,339,oelig,352,Scaron,353,scaron,376,Yuml,710,circ,732,tilde,8194,ensp,8195,emsp,8201,thinsp,8204,zwnj,8205,zwj,8206,lrm,8207,rlm,8211,ndash,8212,mdash,8216,lsquo,8217,rsquo,8218,sbquo,8220,ldquo,8221,rdquo,8222,bdquo,8224,dagger,8225,Dagger,8240,permil,8249,lsaquo,8250,rsaquo,8364,euro", true);
-		this._def("entity_encoding", "named");
-		this._def("cleanup_callback", "");
-		this._def("add_unload_trigger", true);
-		this._def("ask", false);
-		this._def("nowrap", false);
-		this._def("auto_resize", false);
-		this._def("auto_focus", false);
-		this._def("cleanup", true);
-		this._def("remove_linebreaks", true);
-		this._def("button_tile_map", false);
-		this._def("submit_patch", true);
-		this._def("browsers", "msie,safari,gecko,opera", true);
-		this._def("dialog_type", "window");
-		this._def("accessibility_warnings", true);
-		this._def("accessibility_focus", true);
-		this._def("merge_styles_invalid_parents", "");
-		this._def("force_hex_style_colors", true);
-		this._def("trim_span_elements", true);
-		this._def("convert_fonts_to_spans", false);
-		this._def("doctype", '<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">');
-		this._def("font_size_classes", '');
-		this._def("font_size_style_values", 'xx-small,x-small,small,medium,large,x-large,xx-large', true);
-		this._def("event_elements", 'a,img', true);
-		this._def("convert_urls", true);
-		this._def("table_inline_editing", false);
-		this._def("object_resizing", true);
-		this._def("custom_shortcuts", true);
-		this._def("convert_on_click", false);
-		this._def("content_css", '');
-		this._def("fix_list_elements", false);
-		this._def("fix_table_elements", false);
-		this._def("strict_loading_mode", document.contentType == 'application/xhtml+xml');
-		this._def("hidden_tab_class", '');
-		this._def("display_tab_class", '');
-		this._def("gecko_spellcheck", false);
-
-		// Force strict loading mode to false on non Gecko browsers
-		if (this.isMSIE && !this.isOpera)
-			this.settings.strict_loading_mode = false;
+		return 1;
+	},
+
+	map : function(a, f) {
+		var o = [];
 
-		// Browser check IE
-		if (this.isMSIE && this.settings['browsers'].indexOf('msie') == -1)
-			return;
+		tinymce.each(a, function(v) {
+			o.push(f(v));
+		});
 
-		// Browser check Gecko
-		if (this.isGecko && this.settings['browsers'].indexOf('gecko') == -1)
-			return;
+		return o;
+	},
 
-		// Browser check Safari
-		if (this.isSafari && this.settings['browsers'].indexOf('safari') == -1)
-			return;
+	grep : function(a, f) {
+		var o = [];
 
-		// Browser check Opera
-		if (this.isOpera && this.settings['browsers'].indexOf('opera') == -1)
-			return;
+		tinymce.each(a, function(v) {
+			if (!f || f(v))
+				o.push(v);
+		});
 
-		// If not super absolute make it so
-		baseHREF = tinyMCE.settings['document_base_url'];
-		var h = document.location.href;
-		var p = h.indexOf('://');
-		if (p > 0 && document.location.protocol != "file:") {
-			p = h.indexOf('/', p + 3);
-			h = h.substring(0, p);
-
-			if (baseHREF.indexOf('://') == -1)
-				baseHREF = h + baseHREF;
-
-			tinyMCE.settings['document_base_url'] = baseHREF;
-			tinyMCE.settings['document_base_prefix'] = h;
-		}
-
-		// Trim away query part
-		if (baseHREF.indexOf('?') != -1)
-			baseHREF = baseHREF.substring(0, baseHREF.indexOf('?'));
-
-		this.settings['base_href'] = baseHREF.substring(0, baseHREF.lastIndexOf('/')) + "/";
-
-		theme = this.settings['theme'];
-		this.inlineStrict = 'A|BR|SPAN|BDO|MAP|OBJECT|IMG|TT|I|B|BIG|SMALL|EM|STRONG|DFN|CODE|Q|SAMP|KBD|VAR|CITE|ABBR|ACRONYM|SUB|SUP|#text|#comment';
-		this.inlineTransitional = 'A|BR|SPAN|BDO|OBJECT|APPLET|IMG|MAP|IFRAME|TT|I|B|U|S|STRIKE|BIG|SMALL|FONT|BASEFONT|EM|STRONG|DFN|CODE|Q|SAMP|KBD|VAR|CITE|ABBR|ACRONYM|SUB|SUP|INPUT|SELECT|TEXTAREA|LABEL|BUTTON|#text|#comment';
-		this.blockElms = 'H[1-6]|P|DIV|ADDRESS|PRE|FORM|TABLE|LI|OL|UL|TD|BLOCKQUOTE|CENTER|DL|DT|DD|DIR|FIELDSET|FORM|NOSCRIPT|NOFRAMES|MENU|ISINDEX|SAMP';
-		this.blockRegExp = new RegExp("^(" + this.blockElms + ")$", "i");
-		this.posKeyCodes = new Array(13,45,36,35,33,34,37,38,39,40);
-		this.uniqueURL = 'javascript:TINYMCE_UNIQUEURL();'; // Make unique URL non real URL
-		this.uniqueTag = '<div id="mceTMPElement" style="display: none">TMP</div>';
-		this.callbacks = new Array('onInit', 'getInfo', 'getEditorTemplate', 'setupContent', 'onChange', 'onPageLoad', 'handleNodeChange', 'initInstance', 'execCommand', 'getControlHTML', 'handleEvent', 'cleanup');
-
-		// Theme url
-		this.settings['theme_href'] = tinyMCE.baseURL + "/themes/" + theme;
-
-		if (!tinyMCE.isIE || tinyMCE.isOpera)
-			this.settings['force_br_newlines'] = false;
-
-		if (tinyMCE.getParam("popups_css", false)) {
-			var cssPath = tinyMCE.getParam("popups_css", "");
-
-			// Is relative
-			if (cssPath.indexOf('://') == -1 && cssPath.charAt(0) != '/')
-				this.settings['popups_css'] = this.documentBasePath + "/" + cssPath;
-			else
-				this.settings['popups_css'] = cssPath;
-		} else
-			this.settings['popups_css'] = tinyMCE.baseURL + "/themes/" + theme + "/css/editor_popup.css";
+		return o;
+	},
 
-		if (tinyMCE.getParam("editor_css", false)) {
-			var cssPath = tinyMCE.getParam("editor_css", "");
+	inArray : function(a, v) {
+		var i, l;
 
-			// Is relative
-			if (cssPath.indexOf('://') == -1 && cssPath.charAt(0) != '/')
-				this.settings['editor_css'] = this.documentBasePath + "/" + cssPath;
-			else
-				this.settings['editor_css'] = cssPath;
-		} else {
-			if (this.settings.editor_css != '')
-				this.settings['editor_css'] = tinyMCE.baseURL + "/themes/" + theme + "/css/editor_ui.css";
+		if (a) {
+			for (i = 0, l = a.length; i < l; i++) {
+				if (a[i] === v)
+					return i;
+			}
 		}
 
-		if (tinyMCE.settings['debug']) {
-			var msg = "Debug: \n";
+		return -1;
+	},
+
+	extend : function(o, e) {
+		var i, a = arguments;
 
-			msg += "baseURL: " + this.baseURL + "\n";
-			msg += "documentBasePath: " + this.documentBasePath + "\n";
-			msg += "content_css: " + this.settings['content_css'] + "\n";
-			msg += "popups_css: " + this.settings['popups_css'] + "\n";
-			msg += "editor_css: " + this.settings['editor_css'] + "\n";
+		for (i=1; i<a.length; i++) {
+			e = a[i];
 
-			alert(msg);
+			tinymce.each(e, function(v, n) {
+				if (typeof(v) !== 'undefined')
+					o[n] = v;
+			});
 		}
 
-		// Only do this once
-		if (this.configs.length == 0) {
-			if (typeof(TinyMCECompressed) == "undefined") {
-				tinyMCE.addEvent(window, "DOMContentLoaded", TinyMCE_Engine.prototype.onLoad);
+		return o;
+	},
 
-				if (tinyMCE.isRealIE) {
-					if (document.body)
-						tinyMCE.addEvent(document.body, "readystatechange", TinyMCE_Engine.prototype.onLoad);
-					else
-						tinyMCE.addEvent(document, "readystatechange", TinyMCE_Engine.prototype.onLoad);
-				}
 
-				tinyMCE.addEvent(window, "load", TinyMCE_Engine.prototype.onLoad);
-				tinyMCE._addUnloadEvents();
-			}
-		}
+	trim : function(s) {
+		return (s ? '' + s : '').replace(/^\s*|\s*$/g, '');
+	},
 
-		this.loadScript(tinyMCE.baseURL + '/themes/' + this.settings['theme'] + '/editor_template' + tinyMCE.srcMode + '.js');
-		this.loadScript(tinyMCE.baseURL + '/langs/' + this.settings['language'] +  '.js');
-		this.loadCSS(this.settings['editor_css']);
+	create : function(s, p) {
+		var t = this, sp, ns, cn, scn, c, de = 0;
 
-		// Add plugins
-		var p = tinyMCE.getParam('plugins', '', true, ',');
-		if (p.length > 0) {
-			for (var i=0; i<p.length; i++) {
-				if (p[i].charAt(0) != '-')
-					this.loadScript(tinyMCE.baseURL + '/plugins/' + p[i] + '/editor_plugin' + tinyMCE.srcMode + '.js');
-			}
-		}
+		// Parse : <prefix> <class>:<super class>
+		s = /^((static) )?([\w.]+)(:([\w.]+))?/.exec(s);
+		cn = s[3].match(/(^|\.)(\w+)$/i)[2]; // Class name
 
-		// Setup entities
-		if (tinyMCE.getParam('entity_encoding') == 'named') {
-			settings['cleanup_entities'] = new Array();
-			var entities = tinyMCE.getParam('entities', '', true, ',');
-			for (var i=0; i<entities.length; i+=2)
-				settings['cleanup_entities']['c' + entities[i]] = entities[i+1];
-		}
+		// Create namespace for new class
+		ns = t.createNS(s[3].replace(/\.\w+$/, ''));
 
-		// Save away this config
-		settings['index'] = this.configs.length;
-		this.configs[this.configs.length] = settings;
+		// Class already exists
+		if (ns[cn])
+			return;
 
-		// Start loading first one in chain
-		this.loadNextScript();
+		// Make pure static class
+		if (s[2] == 'static') {
+			ns[cn] = p;
 
-		// Force flicker free CSS backgrounds in IE
-		if (this.isIE && !this.isOpera) {
-			try {
-				document.execCommand('BackgroundImageCache', false, true);
-			} catch (e) {
-			}
+			if (this.onCreate)
+				this.onCreate(s[2], s[3], ns[cn]);
+
+			return;
 		}
-	},
 
-	_addUnloadEvents : function() {
-		if (tinyMCE.isIE) {
-			if (tinyMCE.settings['add_unload_trigger']) {
-				tinyMCE.addEvent(window, "unload", TinyMCE_Engine.prototype.unloadHandler);
-				tinyMCE.addEvent(window.document, "beforeunload", TinyMCE_Engine.prototype.unloadHandler);
+		// Create default constructor
+		if (!p[cn]) {
+			p[cn] = function() {};
+			de = 1;
+		}
+
+		// Add constructor and methods
+		ns[cn] = p[cn];
+		t.extend(ns[cn].prototype, p);
+
+		// Extend
+		if (s[5]) {
+			sp = t.resolve(s[5]).prototype;
+			scn = s[5].match(/\.(\w+)$/i)[1]; // Class name
+
+			// Extend constructor
+			c = ns[cn];
+			if (de) {
+				// Add passthrough constructor
+				ns[cn] = function() {
+					return sp[scn].apply(this, arguments);
+				};
+			} else {
+				// Add inherit constructor
+				ns[cn] = function() {
+					this.parent = sp[scn];
+					return c.apply(this, arguments);
+				};
 			}
-		} else {
-			if (tinyMCE.settings['add_unload_trigger'])
-				tinyMCE.addEvent(window, "unload", function () {tinyMCE.triggerSave(true, true);});
-		}
-	},
+			ns[cn].prototype[cn] = ns[cn];
 
-	_def : function(key, def_val, t) {
-		var v = tinyMCE.getParam(key, def_val);
+			// Add super methods
+			t.each(sp, function(f, n) {
+				ns[cn].prototype[n] = sp[n];
+			});
 
-		v = t ? v.replace(/\s+/g, "") : v;
+			// Add overridden methods
+			t.each(p, function(f, n) {
+				// Extend methods if needed
+				if (sp[n]) {
+					ns[cn].prototype[n] = function() {
+						this.parent = sp[n];
+						return f.apply(this, arguments);
+					};
+				} else {
+					if (n != cn)
+						ns[cn].prototype[n] = f;
+				}
+			});
+		}
 
-		this.settings[key] = v;
-	},
+		// Add static methods
+		t.each(p['static'], function(f, n) {
+			ns[cn][n] = f;
+		});
 
-	hasPlugin : function(n) {
-		return typeof(this.plugins[n]) != "undefined" && this.plugins[n] != null;
+		if (this.onCreate)
+			this.onCreate(s[2], s[3], ns[cn].prototype);
 	},
 
-	addPlugin : function(n, p) {
-		var op = this.plugins[n];
+	walk : function(o, f, n, s) {
+		s = s || this;
+
+		if (o) {
+			if (n)
+				o = o[n];
 
-		// Use the previous plugin object base URL used when loading external plugins
-		p.baseURL = op ? op.baseURL : tinyMCE.baseURL + "/plugins/" + n;
-		this.plugins[n] = p;
+			tinymce.each(o, function(o, i) {
+				if (f.call(s, o, i, n) === false)
+					return false;
 
-		this.loadNextScript();
+				tinymce.walk(o, f, n, s);
+			});
+		}
 	},
 
-	setPluginBaseURL : function(n, u) {
-		var op = this.plugins[n];
+	createNS : function(n, o) {
+		var i, v;
 
-		if (op)
-			op.baseURL = u;
-		else
-			this.plugins[n] = {baseURL : u};
-	},
+		o = o || window;
 
-	loadPlugin : function(n, u) {
-		u = u.indexOf('.js') != -1 ? u.substring(0, u.lastIndexOf('/')) : u;
-		u = u.charAt(u.length-1) == '/' ? u.substring(0, u.length-1) : u;
-		this.plugins[n] = {baseURL : u};
-		this.loadScript(u + "/editor_plugin" + (tinyMCE.srcMode ? '_src' : '') + ".js");
-	},
+		n = n.split('.');
+		for (i=0; i<n.length; i++) {
+			v = n[i];
 
-	hasTheme : function(n) {
-		return typeof(this.themes[n]) != "undefined" && this.themes[n] != null;
-	},
+			if (!o[v])
+				o[v] = {};
 
-	addTheme : function(n, t) {
-		this.themes[n] = t;
+			o = o[v];
+		}
 
-		this.loadNextScript();
+		return o;
 	},
 
-	addMenu : function(n, m) {
-		this.menus[n] = m;
-	},
+	resolve : function(n, o) {
+		var i, l;
 
-	hasMenu : function(n) {
-		return typeof(this.plugins[n]) != "undefined" && this.plugins[n] != null;
-	},
+		o = o || window;
 
-	loadScript : function(url) {
-		var i;
+		n = n.split('.');
+		for (i=0, l = n.length; i<l; i++) {
+			o = o[n[i]];
 
-		for (i=0; i<this.loadedFiles.length; i++) {
-			if (this.loadedFiles[i] == url)
-				return;
+			if (!o)
+				break;
 		}
 
-		if (tinyMCE.settings.strict_loading_mode)
-			this.pendingFiles[this.pendingFiles.length] = url;
-		else
-			document.write('<sc'+'ript language="javascript" type="text/javascript" src="' + url + '"></script>');
-
-		this.loadedFiles[this.loadedFiles.length] = url;
+		return o;
 	},
 
-	loadNextScript : function() {
-		var d = document, se;
+	addUnload : function(f, s) {
+		var t = this, w = window;
 
-		if (!tinyMCE.settings.strict_loading_mode)
-			return;
+		f = {func : f, scope : s || this};
 
-		if (this.loadingIndex < this.pendingFiles.length) {
-			se = d.createElementNS('http://www.w3.org/1999/xhtml', 'script');
-			se.setAttribute('language', 'javascript');
-			se.setAttribute('type', 'text/javascript');
-			se.setAttribute('src', this.pendingFiles[this.loadingIndex++]);
+		if (!t.unloads) {
+			function unload() {
+				var li = t.unloads, o, n;
 
-			d.getElementsByTagName("head")[0].appendChild(se);
-		} else
-			this.loadingIndex = -1; // Done with loading
-	},
+				if (li) {
+					// Call unload handlers
+					for (n in li) {
+						o = li[n];
 
-	loadCSS : function(url) {
-		var ar = url.replace(/\s+/, '').split(',');
-		var lflen = 0, csslen = 0;
-		var skip = false;
-		var x = 0, i = 0, nl, le;
-
-		for (x = 0,csslen = ar.length; x<csslen; x++) {
-			if (ar[x] != null && ar[x] != 'null' && ar[x].length > 0) {
-				/* Make sure it doesn't exist. */
-				for (i=0, lflen=this.loadedFiles.length; i<lflen; i++) {
-					if (this.loadedFiles[i] == ar[x]) {
-						skip = true;
-						break;
+						if (o && o.func)
+							o.func.call(o.scope, 1); // Send in one arg to distinct unload and user destroy
 					}
-				}
 
-				if (!skip) {
-					if (tinyMCE.settings.strict_loading_mode) {
-						nl = document.getElementsByTagName("head");
-
-						le = document.createElement('link');
-						le.setAttribute('href', ar[x]);
-						le.setAttribute('rel', 'stylesheet');
-						le.setAttribute('type', 'text/css');
+					// Detach unload function
+					if (w.detachEvent) {
+						w.detachEvent('onbeforeunload', fakeUnload);
+						w.detachEvent('onunload', unload);
+					} else if (w.removeEventListener)
+						w.removeEventListener('unload', unload, false);
 
-						nl[0].appendChild(le);			
-					} else
-						document.write('<link href="' + ar[x] + '" rel="stylesheet" type="text/css" />');
+					// Destroy references
+					t.unloads = o = li = w = unload = 0;
 
-					this.loadedFiles[this.loadedFiles.length] = ar[x];
+					// Run garbarge collector on IE
+					if (window.CollectGarbage)
+						window.CollectGarbage();
 				}
-			}
-		}
-	},
+			};
 
-	importCSS : function(doc, css) {
-		var css_ary = css.replace(/\s+/, '').split(',');
-		var csslen, elm, headArr, x, css_file;
-
-		for (x = 0, csslen = css_ary.length; x<csslen; x++) {
-			css_file = css_ary[x];
-
-			if (css_file != null && css_file != 'null' && css_file.length > 0) {
-				// Is relative, make absolute
-				if (css_file.indexOf('://') == -1 && css_file.charAt(0) != '/')
-					css_file = this.documentBasePath + "/" + css_file;
+			function fakeUnload() {
+				var d = document;
 
-				if (typeof(doc.createStyleSheet) == "undefined") {
-					elm = doc.createElement("link");
+				// Is there things still loading, then do some magic
+				if (d.readyState == 'interactive') {
+					function stop() {
+						// Prevent memory leak
+						d.detachEvent('onstop', stop);
+
+						// Call unload handler
+						if (unload)
+							unload();
+
+						d = 0;
+					};
+
+					// Fire unload when the currently loading page is stopped
+					if (d)
+						d.attachEvent('onstop', stop);
+
+					// Remove onstop listener after a while to prevent the unload function
+					// to execute if the user presses cancel in an onbeforeunload
+					// confirm dialog and then presses the browser stop button
+					window.setTimeout(function() {
+						if (d)
+							d.detachEvent('onstop', stop);
+					}, 0);
+				}
+			};
 
-					elm.rel = "stylesheet";
-					elm.href = css_file;
+			// Attach unload handler
+			if (w.attachEvent) {
+				w.attachEvent('onunload', unload);
+				w.attachEvent('onbeforeunload', fakeUnload);
+			} else if (w.addEventListener)
+				w.addEventListener('unload', unload, false);
 
-					if ((headArr = doc.getElementsByTagName("head")) != null && headArr.length > 0)
-						headArr[0].appendChild(elm);
-				} else
-					doc.createStyleSheet(css_file);
-			}
-		}
+			// Setup initial unload handler array
+			t.unloads = [f];
+		} else
+			t.unloads.push(f);
+
+		return f;
 	},
 
-	confirmAdd : function(e, settings) {
-		var elm = tinyMCE.isIE ? event.srcElement : e.target;
-		var elementId = elm.name ? elm.name : elm.id;
+	removeUnload : function(f) {
+		var u = this.unloads, r = null;
 
-		tinyMCE.settings = settings;
+		tinymce.each(u, function(o, i) {
+			if (o && o.func == f) {
+				u.splice(i, 1);
+				r = f;
+				return false;
+			}
+		});
 
-		if (tinyMCE.settings['convert_on_click'] || (!elm.getAttribute('mce_noask') && confirm(tinyMCELang['lang_edit_confirm'])))
-			tinyMCE.addMCEControl(elm, elementId);
+		return r;
+	},
 
-		elm.setAttribute('mce_noask', 'true');
+	explode : function(s, d) {
+		return s ? tinymce.map(s.split(d || ','), tinymce.trim) : s;
 	},
 
-	updateContent : function(form_element_name) {
-		// Find MCE instance linked to given form element and copy it's value
-		var formElement = document.getElementById(form_element_name);
-		for (var n in tinyMCE.instances) {
-			var inst = tinyMCE.instances[n];
-			if (!tinyMCE.isInstance(inst))
-				continue;
+	_addVer : function(u) {
+		var v;
 
-			inst.switchSettings();
+		if (!this.query)
+			return u;
 
-			if (inst.formElement == formElement) {
-				var doc = inst.getDoc();
-		
-				tinyMCE._setHTML(doc, inst.formElement.value);
+		v = (u.indexOf('?') == -1 ? '?' : '&') + this.query;
 
-				if (!tinyMCE.isIE)
-					doc.body.innerHTML = tinyMCE._cleanupHTML(inst, doc, this.settings, doc.body, inst.visualAid);
-			}
-		}
-	},
+		if (u.indexOf('#') == -1)
+			return u + v;
+
+		return u.replace('#', v + '#');
+	}
 
-	addMCEControl : function(replace_element, form_element_name, target_document) {
-		var id = "mce_editor_" + tinyMCE.idCounter++;
-		var inst = new TinyMCE_Control(tinyMCE.settings);
+	};
 
-		inst.editorId = id;
-		this.instances[id] = inst;
+// Required for GZip AJAX loading
+window.tinymce = tinymce;
 
-		inst._onAdd(replace_element, form_element_name, target_document);
-	},
+// Initialize the API
+tinymce._init();
+tinymce.create('tinymce.util.Dispatcher', {
+	scope : null,
+	listeners : null,
 
-	removeInstance : function(ti) {
-		var t = [], n, i;
+	Dispatcher : function(s) {
+		this.scope = s || this;
+		this.listeners = [];
+	},
 
-		// Remove from instances
-		for (n in tinyMCE.instances) {
-			i = tinyMCE.instances[n];
+	add : function(cb, s) {
+		this.listeners.push({cb : cb, scope : s || this.scope});
 
-			if (tinyMCE.isInstance(i) && ti != i)
-					t[n] = i;
-		}
+		return cb;
+	},
 
-		tinyMCE.instances = t;
+	addToTop : function(cb, s) {
+		this.listeners.unshift({cb : cb, scope : s || this.scope});
 
-		// Remove from global undo/redo
-		n = [];
-		t = tinyMCE.undoLevels;
+		return cb;
+	},
 
-		for (i=0; i<t.length; i++) {
-			if (t[i] != ti)
-				n.push(t[i]);
-		}
+	remove : function(cb) {
+		var l = this.listeners, o = null;
 
-		tinyMCE.undoLevels = n;
-		tinyMCE.undoIndex = n.length;
+		tinymce.each(l, function(c, i) {
+			if (cb == c.cb) {
+				o = cb;
+				l.splice(i, 1);
+				return false;
+			}
+		});
 
-		return ti;
+		return o;
 	},
 
-	removeMCEControl : function(editor_id) {
-		var inst = tinyMCE.getInstanceById(editor_id), h, re, ot, tn;
-
-		if (inst) {
-			inst.switchSettings();
+	dispatch : function() {
+		var s, a = arguments, i, li = this.listeners, c;
 
-			editor_id = inst.editorId;
-			h = tinyMCE.getContent(editor_id);
+		// Needs to be a real loop since the listener count might change while looping
+		// And this is also more efficient
+		for (i = 0; i<li.length; i++) {
+			c = li[i];
+			s = c.cb.apply(c.scope, a);
 
-			this.removeInstance(inst);
+			if (s === false)
+				break;
+		}
 
-			tinyMCE.selectedElement = null;
-			tinyMCE.selectedInstance = null;
+		return s;
+	}
 
-			// Remove element
-			re = document.getElementById(editor_id + "_parent");
-			ot = inst.oldTargetElement;
-			tn = ot.nodeName.toLowerCase();
+	});
+(function() {
+	var each = tinymce.each;
 
-			if (tn == "textarea" || tn == "input") {
-				re.parentNode.removeChild(re);
-				ot.style.display = "inline";
-				ot.value = h;
-			} else {
-				ot.innerHTML = h;
-				ot.style.display = 'block';
-				re.parentNode.insertBefore(ot, re);
-				re.parentNode.removeChild(re);
+	tinymce.create('tinymce.util.URI', {
+		URI : function(u, s) {
+			var t = this, o, a, b;
+
+			// Trim whitespace
+			u = tinymce.trim(u);
+
+			// Default settings
+			s = t.settings = s || {};
+
+			// Strange app protocol or local anchor
+			if (/^(mailto|tel|news|javascript|about):/i.test(u) || /^\s*#/.test(u)) {
+				t.source = u;
+				return;
 			}
-		}
-	},
 
-	triggerSave : function(skip_cleanup, skip_callback) {
-		var inst, n;
+			// Absolute path with no host, fake host and protocol
+			if (u.indexOf('/') === 0 && u.indexOf('//') !== 0)
+				u = (s.base_uri ? s.base_uri.protocol || 'http' : 'http') + '://mce_host' + u;
+
+			// Relative path http:// or protocol relative //path
+			if (!/^\w*:?\/\//.test(u))
+				u = (s.base_uri.protocol || 'http') + '://mce_host' + t.toAbsPath(s.base_uri.path, u);
+
+			// Parse URL (Credits goes to Steave, http://blog.stevenlevithan.com/archives/parseuri)
+			u = u.replace(/@@/g, '(mce_at)'); // Zope 3 workaround, they use @@something
+			u = /^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*):?([^:@]*))?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/.exec(u);
+			each(["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"], function(v, i) {
+				var s = u[i];
+
+				// Zope 3 workaround, they use @@something
+				if (s)
+					s = s.replace(/\(mce_at\)/g, '@@');
 
-		// Default to false
-		if (typeof(skip_cleanup) == "undefined")
-			skip_cleanup = false;
+				t[v] = s;
+			});
 
-		// Default to false
-		if (typeof(skip_callback) == "undefined")
-			skip_callback = false;
+			if (b = s.base_uri) {
+				if (!t.protocol)
+					t.protocol = b.protocol;
 
-		// Cleanup and set all form fields
-		for (n in tinyMCE.instances) {
-			inst = tinyMCE.instances[n];
+				if (!t.userInfo)
+					t.userInfo = b.userInfo;
 
-			if (!tinyMCE.isInstance(inst))
-				continue;
+				if (!t.port && t.host == 'mce_host')
+					t.port = b.port;
 
-			inst.triggerSave(skip_cleanup, skip_callback);
-		}
-	},
+				if (!t.host || t.host == 'mce_host')
+					t.host = b.host;
 
-	resetForm : function(form_index) {
-		var i, inst, n, formObj = document.forms[form_index];
+				t.source = '';
+			}
 
-		for (n in tinyMCE.instances) {
-			inst = tinyMCE.instances[n];
+			//t.path = t.path || '/';
+		},
 
-			if (!tinyMCE.isInstance(inst))
-				continue;
+		setPath : function(p) {
+			var t = this;
 
-			inst.switchSettings();
+			p = /^(.*?)\/?(\w+)?$/.exec(p);
 
-			for (i=0; i<formObj.elements.length; i++) {
-				if (inst.formTargetElementId == formObj.elements[i].name)
-					inst.getBody().innerHTML = inst.startContent;
-			}
-		}
-	},
+			// Update path parts
+			t.path = p[0];
+			t.directory = p[1];
+			t.file = p[2];
 
-	execInstanceCommand : function(editor_id, command, user_interface, value, focus) {
-		var inst = tinyMCE.getInstanceById(editor_id), r;
+			// Rebuild source
+			t.source = '';
+			t.getURI();
+		},
 
-		if (inst) {
-			r = inst.selection.getRng();
+		toRelative : function(u) {
+			var t = this, o;
 
-			if (typeof(focus) == "undefined")
-				focus = true;
+			if (u === "./")
+				return u;
 
-			// IE bug lost focus on images in absolute divs Bug #1534575
-			if (focus && (!r || !r.item))
-				inst.contentWindow.focus();
+			u = new tinymce.util.URI(u, {base_uri : t});
 
-			// Reset design mode if lost
-			inst.autoResetDesignMode();
+			// Not on same domain/port or protocol
+			if ((u.host != 'mce_host' && t.host != u.host && u.host) || t.port != u.port || t.protocol != u.protocol)
+				return u.getURI();
 
-			this.selectedElement = inst.getFocusElement();
-			inst.select();
-			tinyMCE.execCommand(command, user_interface, value);
+			o = t.toRelPath(t.path, u.path);
 
-			// Cancel event so it doesn't call onbeforeonunlaod
-			if (tinyMCE.isIE && window.event != null)
-				tinyMCE.cancelEvent(window.event);
-		}
-	},
+			// Add query
+			if (u.query)
+				o += '?' + u.query;
 
-	execCommand : function(command, user_interface, value) {
-		var inst = tinyMCE.selectedInstance;
+			// Add anchor
+			if (u.anchor)
+				o += '#' + u.anchor;
 
-		// Default input
-		user_interface = user_interface ? user_interface : false;
-		value = value ? value : null;
-
-		if (inst)
-			inst.switchSettings();
-
-		switch (command) {
-			case "Undo":
-				if (this.getParam('custom_undo_redo_global')) {
-					if (this.undoIndex > 0) {
-						tinyMCE.nextUndoRedoAction = 'Undo';
-						inst = this.undoLevels[--this.undoIndex];
-						inst.select();
+			return o;
+		},
+	
+		toAbsolute : function(u, nh) {
+			var u = new tinymce.util.URI(u, {base_uri : this});
 
-						if (!tinyMCE.nextUndoRedoInstanceId)
-							inst.execCommand('Undo');
-					}
-				} else
-					inst.execCommand('Undo');
-				return true;
+			return u.getURI(this.host == u.host ? nh : 0);
+		},
 
-			case "Redo":
-				if (this.getParam('custom_undo_redo_global')) {
-					if (this.undoIndex <= this.undoLevels.length - 1) {
-						tinyMCE.nextUndoRedoAction = 'Redo';
-						inst = this.undoLevels[this.undoIndex++];
-						inst.select();
+		toRelPath : function(base, path) {
+			var items, bp = 0, out = '', i, l;
 
-						if (!tinyMCE.nextUndoRedoInstanceId)
-							inst.execCommand('Redo');
+			// Split the paths
+			base = base.substring(0, base.lastIndexOf('/'));
+			base = base.split('/');
+			items = path.split('/');
+
+			if (base.length >= items.length) {
+				for (i = 0, l = base.length; i < l; i++) {
+					if (i >= items.length || base[i] != items[i]) {
+						bp = i + 1;
+						break;
 					}
-				} else
-					inst.execCommand('Redo');
-
-				return true;
+				}
+			}
 
-			case 'mceFocus':
-				var inst = tinyMCE.getInstanceById(value);
-				if (inst)
-					inst.getWin().focus();
-			return;
+			if (base.length < items.length) {
+				for (i = 0, l = items.length; i < l; i++) {
+					if (i >= base.length || base[i] != items[i]) {
+						bp = i + 1;
+						break;
+					}
+				}
+			}
 
-			case "mceAddControl":
-			case "mceAddEditor":
-				tinyMCE.addMCEControl(tinyMCE._getElementById(value), value);
-				return;
+			if (bp == 1)
+				return path;
 
-			case "mceAddFrameControl":
-				tinyMCE.addMCEControl(tinyMCE._getElementById(value['element'], value['document']), value['element'], value['document']);
-				return;
+			for (i = 0, l = base.length - (bp - 1); i < l; i++)
+				out += "../";
 
-			case "mceRemoveControl":
-			case "mceRemoveEditor":
-				tinyMCE.removeMCEControl(value);
-				return;
+			for (i = bp - 1, l = items.length; i < l; i++) {
+				if (i != bp - 1)
+					out += "/" + items[i];
+				else
+					out += items[i];
+			}
 
-			case "mceResetDesignMode":
-				// Resets the designmode state of the editors in Gecko
-				if (!tinyMCE.isIE) {
-					for (var n in tinyMCE.instances) {
-						if (!tinyMCE.isInstance(tinyMCE.instances[n]))
-							continue;
+			return out;
+		},
 
-						try {
-							tinyMCE.instances[n].getDoc().designMode = "on";
-						} catch (e) {
-							// Ignore any errors
-						}
-					}
-				}
+		toAbsPath : function(base, path) {
+			var i, nb = 0, o = [], tr;
 
-				return;
-		}
+			// Split paths
+			tr = /\/$/.test(path) ? '/' : '';
+			base = base.split('/');
+			path = path.split('/');
 
-		if (inst) {
-			inst.execCommand(command, user_interface, value);
-		} else if (tinyMCE.settings['focus_alert'])
-			alert(tinyMCELang['lang_focus_alert']);
-	},
+			// Remove empty chunks
+			each(base, function(k) {
+				if (k)
+					o.push(k);
+			});
 
-	_createIFrame : function(replace_element, doc, win) {
-		var iframe, id = replace_element.getAttribute("id");
-		var aw, ah;
-
-		if (typeof(doc) == "undefined")
-			doc = document;
-
-		if (typeof(win) == "undefined")
-			win = window;
-
-		iframe = doc.createElement("iframe");
-
-		aw = "" + tinyMCE.settings['area_width'];
-		ah = "" + tinyMCE.settings['area_height'];
-
-		if (aw.indexOf('%') == -1) {
-			aw = parseInt(aw);
-			aw = (isNaN(aw) || aw < 0) ? 300 : aw;
-			aw = aw + "px";
-		}
-
-		if (ah.indexOf('%') == -1) {
-			ah = parseInt(ah);
-			ah = (isNaN(ah) || ah < 0) ? 240 : ah;
-			ah = ah + "px";
-		}
-
-		iframe.setAttribute("id", id);
-		iframe.setAttribute("name", id);
-		iframe.setAttribute("class", "mceEditorIframe");
-		iframe.setAttribute("border", "0");
-		iframe.setAttribute("frameBorder", "0");
-		iframe.setAttribute("marginWidth", "0");
-		iframe.setAttribute("marginHeight", "0");
-		iframe.setAttribute("leftMargin", "0");
-		iframe.setAttribute("topMargin", "0");
-		iframe.setAttribute("width", aw);
-		iframe.setAttribute("height", ah);
-		iframe.setAttribute("allowtransparency", "true");
-		iframe.className = 'mceEditorIframe';
-
-		if (tinyMCE.settings["auto_resize"])
-			iframe.setAttribute("scrolling", "no");
-
-		// Must have a src element in MSIE HTTPs breaks aswell as absoute URLs
-		if (tinyMCE.isRealIE)
-			iframe.setAttribute("src", this.settings['default_document']);
-
-		iframe.style.width = aw;
-		iframe.style.height = ah;
-
-		// Ugly hack for Gecko problem in strict mode
-		if (tinyMCE.settings.strict_loading_mode)
-			iframe.style.marginBottom = '-5px';
-
-		// MSIE 5.0 issue
-		if (tinyMCE.isRealIE)
-			replace_element.outerHTML = iframe.outerHTML;
-		else
-			replace_element.parentNode.replaceChild(iframe, replace_element);
-
-		if (tinyMCE.isRealIE)
-			return win.frames[id];
-		else
-			return iframe;
-	},
+			base = o;
 
-	setupContent : function(editor_id) {
-		var inst = tinyMCE.instances[editor_id], i;
-		var doc = inst.getDoc();
-		var head = doc.getElementsByTagName('head').item(0);
-		var content = inst.startContent;
-
-		// HTML values get XML encoded in strict mode
-		if (tinyMCE.settings.strict_loading_mode) {
-			content = content.replace(/&lt;/g, '<');
-			content = content.replace(/&gt;/g, '>');
-			content = content.replace(/&quot;/g, '"');
-			content = content.replace(/&amp;/g, '&');
-		}
-
-		inst.switchSettings();
-
-		// Not loaded correctly hit it again, Mozilla bug #997860
-		if (!tinyMCE.isIE && tinyMCE.getParam("setupcontent_reload", false) && doc.title != "blank_page") {
-			// This part will remove the designMode status
-			// Failes first time in Firefox 1.5b2 on Mac
-			try {doc.location.href = tinyMCE.baseURL + "/blank.htm";} catch (ex) {}
-			window.setTimeout("tinyMCE.setupContent('" + editor_id + "');", 1000);
-			return;
-		}
+			// Merge relURLParts chunks
+			for (i = path.length - 1, o = []; i >= 0; i--) {
+				// Ignore empty or .
+				if (path[i].length == 0 || path[i] == ".")
+					continue;
 
-		if (!head) {
-			window.setTimeout("tinyMCE.setupContent('" + editor_id + "');", 10);
-			return;
-		}
+				// Is parent
+				if (path[i] == '..') {
+					nb++;
+					continue;
+				}
 
-		// Import theme specific content CSS the user specific
-		tinyMCE.importCSS(inst.getDoc(), tinyMCE.baseURL + "/themes/" + inst.settings['theme'] + "/css/editor_content.css");
-		tinyMCE.importCSS(inst.getDoc(), inst.settings['content_css']);
-		tinyMCE.dispatchCallback(inst, 'init_instance_callback', 'initInstance', inst);
+				// Move up
+				if (nb > 0) {
+					nb--;
+					continue;
+				}
 
-		// Setup keyboard shortcuts
-		if (tinyMCE.getParam('custom_undo_redo_keyboard_shortcuts')) {
-			inst.addShortcut('ctrl', 'z', 'lang_undo_desc', 'Undo');
-			inst.addShortcut('ctrl', 'y', 'lang_redo_desc', 'Redo');
-		}
+				o.push(path[i]);
+			}
 
-		// BlockFormat shortcuts keys
-		for (i=1; i<=6; i++)
-			inst.addShortcut('ctrl', '' + i, '', 'FormatBlock', false, '<h' + i + '>');
+			i = base.length - nb;
 
-		inst.addShortcut('ctrl', '7', '', 'FormatBlock', false, '<p>');
-		inst.addShortcut('ctrl', '8', '', 'FormatBlock', false, '<div>');
-		inst.addShortcut('ctrl', '9', '', 'FormatBlock', false, '<address>');
+			// If /a/b/c or /
+			if (i <= 0)
+				return '/' + o.reverse().join('/') + tr;
 
-		// Add default shortcuts for gecko
-		if (tinyMCE.isGecko) {
-			inst.addShortcut('ctrl', 'b', 'lang_bold_desc', 'Bold');
-			inst.addShortcut('ctrl', 'i', 'lang_italic_desc', 'Italic');
-			inst.addShortcut('ctrl', 'u', 'lang_underline_desc', 'Underline');
-		}
+			return '/' + base.slice(0, i).join('/') + '/' + o.reverse().join('/') + tr;
+		},
 
-		// Setup span styles
-		if (tinyMCE.getParam("convert_fonts_to_spans"))
-			inst.getBody().setAttribute('id', 'mceSpanFonts');
+		getURI : function(nh) {
+			var s, t = this;
 
-		if (tinyMCE.settings['nowrap'])
-			doc.body.style.whiteSpace = "nowrap";
+			// Rebuild source
+			if (!t.source || nh) {
+				s = '';
 
-		doc.body.dir = this.settings['directionality'];
-		doc.editorId = editor_id;
+				if (!nh) {
+					if (t.protocol)
+						s += t.protocol + '://';
 
-		// Add on document element in Mozilla
-		if (!tinyMCE.isIE)
-			doc.documentElement.editorId = editor_id;
+					if (t.userInfo)
+						s += t.userInfo + '@';
 
-		inst.setBaseHREF(tinyMCE.settings['base_href']);
+					if (t.host)
+						s += t.host;
 
-		// Replace new line characters to BRs
-		if (tinyMCE.settings['convert_newlines_to_brs']) {
-			content = tinyMCE.regexpReplace(content, "\r\n", "<br />", "gi");
-			content = tinyMCE.regexpReplace(content, "\r", "<br />", "gi");
-			content = tinyMCE.regexpReplace(content, "\n", "<br />", "gi");
-		}
+					if (t.port)
+						s += ':' + t.port;
+				}
 
-		// Open closed anchors
-	//	content = content.replace(new RegExp('<a(.*?)/>', 'gi'), '<a$1></a>');
+				if (t.path)
+					s += t.path;
 
-		// Call custom cleanup code
-		content = tinyMCE.storeAwayURLs(content);
-		content = tinyMCE._customCleanup(inst, "insert_to_editor", content);
+				if (t.query)
+					s += '?' + t.query;
 
-		if (tinyMCE.isIE) {
-			// Ugly!!!
-			window.setInterval('try{tinyMCE.getCSSClasses(tinyMCE.instances["' + editor_id + '"].getDoc(), "' + editor_id + '");}catch(e){}', 500);
+				if (t.anchor)
+					s += '#' + t.anchor;
 
-			if (tinyMCE.settings["force_br_newlines"])
-				doc.styleSheets[0].addRule("p", "margin: 0;");
+				t.source = s;
+			}
 
-			var body = inst.getBody();
-			body.editorId = editor_id;
+			return t.source;
 		}
 
-		content = tinyMCE.cleanupHTMLCode(content);
+		});
+})();
+(function() {
+	var each = tinymce.each;
+
+	tinymce.create('static tinymce.util.Cookie', {
+		getHash : function(n) {
+			var v = this.get(n), h;
+
+			if (v) {
+				each(v.split('&'), function(v) {
+					v = v.split('=');
+					h = h || {};
+					h[unescape(v[0])] = unescape(v[1]);
+				});
+			}
+
+			return h;
+		},
+
+		setHash : function(n, v, e, p, d, s) {
+			var o = '';
 
-		// Fix for bug #958637
-		if (!tinyMCE.isIE) {
-			var contentElement = inst.getDoc().createElement("body");
-			var doc = inst.getDoc();
+			each(v, function(v, k) {
+				o += (!o ? '' : '&') + escape(k) + '=' + escape(v);
+			});
 
-			contentElement.innerHTML = content;
+			this.set(n, o, e, p, d, s);
+		},
 
-			// Remove weridness!
-			if (tinyMCE.isGecko && tinyMCE.settings['remove_lt_gt'])
-				content = content.replace(new RegExp('&lt;&gt;', 'g'), "");
+		get : function(n) {
+			var c = document.cookie, e, p = n + "=", b;
 
-			if (tinyMCE.settings['cleanup_on_startup'])
-				tinyMCE.setInnerHTML(inst.getBody(), tinyMCE._cleanupHTML(inst, doc, this.settings, contentElement));
-			else
-				tinyMCE.setInnerHTML(inst.getBody(), content);
+			// Strict mode
+			if (!c)
+				return;
 
-			tinyMCE.convertAllRelativeURLs(inst.getBody());
-		} else {
-			if (tinyMCE.settings['cleanup_on_startup']) {
-				tinyMCE._setHTML(inst.getDoc(), content);
+			b = c.indexOf("; " + p);
 
-				// Produces permission denied error in MSIE 5.5
-				eval('try {tinyMCE.setInnerHTML(inst.getBody(), tinyMCE._cleanupHTML(inst, inst.contentDocument, this.settings, inst.getBody()));} catch(e) {}');
+			if (b == -1) {
+				b = c.indexOf(p);
+
+				if (b != 0)
+					return null;
 			} else
-				tinyMCE._setHTML(inst.getDoc(), content);
-		}
+				b += 2;
 
-		// Fix for bug #957681
-		//inst.getDoc().designMode = inst.getDoc().designMode;
+			e = c.indexOf(";", b);
 
-		// Setup element references
-		var parentElm = inst.targetDoc.getElementById(inst.editorId + '_parent');
-		inst.formElement = tinyMCE.isGecko ? parentElm.previousSibling : parentElm.nextSibling;
+			if (e == -1)
+				e = c.length;
 
-		tinyMCE.handleVisualAid(inst.getBody(), true, tinyMCE.settings['visual'], inst);
-		tinyMCE.dispatchCallback(inst, 'setupcontent_callback', 'setupContent', editor_id, inst.getBody(), inst.getDoc());
+			return unescape(c.substring(b + p.length, e));
+		},
 
-		// Re-add design mode on mozilla
-		if (!tinyMCE.isIE)
-			tinyMCE.addEventHandlers(inst);
+		set : function(n, v, e, p, d, s) {
+			document.cookie = n + "=" + escape(v) +
+				((e) ? "; expires=" + e.toGMTString() : "") +
+				((p) ? "; path=" + escape(p) : "") +
+				((d) ? "; domain=" + d : "") +
+				((s) ? "; secure" : "");
+		},
 
-		// Add blur handler
-		if (tinyMCE.isIE) {
-			tinyMCE.addEvent(inst.getBody(), "blur", TinyMCE_Engine.prototype._eventPatch);
-			tinyMCE.addEvent(inst.getBody(), "beforedeactivate", TinyMCE_Engine.prototype._eventPatch); // Bug #1439953
+		remove : function(n, p) {
+			var d = new Date();
 
-			// Workaround for drag drop/copy paste base href bug
-			if (!tinyMCE.isOpera) {
-				tinyMCE.addEvent(doc.body, "mousemove", TinyMCE_Engine.prototype.onMouseMove);
-				tinyMCE.addEvent(doc.body, "beforepaste", TinyMCE_Engine.prototype._eventPatch);
-				tinyMCE.addEvent(doc.body, "drop", TinyMCE_Engine.prototype._eventPatch);
-			}
+			d.setTime(d.getTime() - 1000);
+
+			this.set(n, '', d, p, d);
 		}
 
-		// Trigger node change, this call locks buttons for tables and so forth
-		inst.select();
-		tinyMCE.selectedElement = inst.contentWindow.document.body;
+		});
+})();
+tinymce.create('static tinymce.util.JSON', {
+	serialize : function(o) {
+		var i, v, s = tinymce.util.JSON.serialize, t;
 
-		// Call custom DOM cleanup
-		tinyMCE._customCleanup(inst, "insert_to_editor_dom", inst.getBody());
-		tinyMCE._customCleanup(inst, "setup_content_dom", inst.getBody());
-		tinyMCE._setEventsEnabled(inst.getBody(), false);
-		tinyMCE.cleanupAnchors(inst.getDoc());
+		if (o == null)
+			return 'null';
 
-		if (tinyMCE.getParam("convert_fonts_to_spans"))
-			tinyMCE.convertSpansToFonts(inst.getDoc());
+		t = typeof o;
 
-		inst.startContent = tinyMCE.trim(inst.getBody().innerHTML);
-		inst.undoRedo.add({ content : inst.startContent });
+		if (t == 'string') {
+			v = '\bb\tt\nn\ff\rr\""\'\'\\\\';
 
-		// Cleanup any mess left from storyAwayURLs
-		if (tinyMCE.isGecko) {
-			// Remove mce_src from textnodes and comments
-			tinyMCE.selectNodes(inst.getBody(), function(n) {
-				if (n.nodeType == 3 || n.nodeType == 8)
-					n.nodeValue = n.nodeValue.replace(new RegExp('\\s(mce_src|mce_href)=\"[^\"]*\"', 'gi'), "");
+			return '"' + o.replace(/([\u0080-\uFFFF\x00-\x1f\"])/g, function(a, b) {
+				i = v.indexOf(b);
 
-				return false;
-			});
-		}
+				if (i + 1)
+					return '\\' + v.charAt(i + 1);
 
-		// Remove Gecko spellchecking
-		if (tinyMCE.isGecko)
-			inst.getBody().spellcheck = tinyMCE.getParam("gecko_spellcheck");
+				a = b.charCodeAt().toString(16);
 
-		// Cleanup any mess left from storyAwayURLs
-		tinyMCE._removeInternal(inst.getBody());
+				return '\\u' + '0000'.substring(a.length) + a;
+			}) + '"';
+		}
 
-		inst.select();
-		tinyMCE.triggerNodeChange(false, true);
-	},
+		if (t == 'object') {
+			if (o.hasOwnProperty && o instanceof Array) {
+					for (i=0, v = '['; i<o.length; i++)
+						v += (i > 0 ? ',' : '') + s(o[i]);
 
-	storeAwayURLs : function(s) {
-		// Remove all mce_src, mce_href and replace them with new ones
-	//	s = s.replace(new RegExp('mce_src\\s*=\\s*\"[^ >\"]*\"', 'gi'), '');
-	//	s = s.replace(new RegExp('mce_href\\s*=\\s*\"[^ >\"]*\"', 'gi'), '');
-
-		if (!s.match(/(mce_src|mce_href)/gi, s)) {
-			s = s.replace(new RegExp('src\\s*=\\s*\"([^ >\"]*)\"', 'gi'), 'src="$1" mce_src="$1"');
-			s = s.replace(new RegExp('href\\s*=\\s*\"([^ >\"]*)\"', 'gi'), 'href="$1" mce_href="$1"');
-		}
+					return v + ']';
+				}
 
-		return s;
-	},
+				v = '{';
 
-	_removeInternal : function(n) {
-		if (tinyMCE.isGecko) {
-			// Remove mce_src from textnodes and comments
-			tinyMCE.selectNodes(n, function(n) {
-				if (n.nodeType == 3 || n.nodeType == 8)
-					n.nodeValue = n.nodeValue.replace(new RegExp('\\s(mce_src|mce_href)=\"[^\"]*\"', 'gi'), "");
+				for (i in o)
+					v += typeof o[i] != 'function' ? (v.length > 1 ? ',"' : '"') + i + '":' + s(o[i]) : '';
 
-				return false;
-			});
+				return v + '}';
 		}
+
+		return '' + o;
 	},
 
-	handleEvent : function(e) {
-		var inst = tinyMCE.selectedInstance;
+	parse : function(s) {
+		try {
+			return eval('(' + s + ')');
+		} catch (ex) {
+			// Ignore
+		}
+	}
 
-		// Remove odd, error
-		if (typeof(tinyMCE) == "undefined")
-			return true;
+	});
+tinymce.create('static tinymce.util.XHR', {
+	send : function(o) {
+		var x, t, w = window, c = 0;
+
+		// Default settings
+		o.scope = o.scope || this;
+		o.success_scope = o.success_scope || o.scope;
+		o.error_scope = o.error_scope || o.scope;
+		o.async = o.async === false ? false : true;
+		o.data = o.data || '';
 
-		//tinyMCE.debug(e.type + " " + e.target.nodeName + " " + (e.relatedTarget ? e.relatedTarget.nodeName : ""));
+		function get(s) {
+			x = 0;
 
-		if (tinyMCE.executeCallback(tinyMCE.selectedInstance, 'handle_event_callback', 'handleEvent', e))
-			return false;
+			try {
+				x = new ActiveXObject(s);
+			} catch (ex) {
+			}
 
-		switch (e.type) {
-			case "beforedeactivate": // Was added due to bug #1439953
-			case "blur":
-				if (tinyMCE.selectedInstance)
-					tinyMCE.selectedInstance.execCommand('mceEndTyping');
+			return x;
+		};
 
-				tinyMCE.hideMenus();
+		x = w.XMLHttpRequest ? new XMLHttpRequest() : get('Microsoft.XMLHTTP') || get('Msxml2.XMLHTTP');
 
-				return;
+		if (x) {
+			if (x.overrideMimeType)
+				x.overrideMimeType(o.content_type);
 
-			// Workaround for drag drop/copy paste base href bug
-			case "drop":
-			case "beforepaste":
-				if (tinyMCE.selectedInstance)
-					tinyMCE.selectedInstance.setBaseHREF(null);
+			x.open(o.type || (o.data ? 'POST' : 'GET'), o.url, o.async);
 
-				// Fixes odd MSIE bug where drag/droping elements in a iframe with height 100% breaks
-				// This logic forces the width/height to be in pixels while the user is drag/dropping
-				if (tinyMCE.isRealIE) {
-					var ife = tinyMCE.selectedInstance.iframeElement;
+			if (o.content_type)
+				x.setRequestHeader('Content-Type', o.content_type);
 
-					/*if (ife.style.width.indexOf('%') != -1) {
-						ife._oldWidth = ife.width.height;
-						ife.style.width = ife.clientWidth;
-					}*/
+			x.send(o.data);
 
-					if (ife.style.height.indexOf('%') != -1) {
-						ife._oldHeight = ife.style.height;
-						ife.style.height = ife.clientHeight;
-					}
-				}
+			function ready() {
+				if (!o.async || x.readyState == 4 || c++ > 10000) {
+					if (o.success && c < 10000 && x.status == 200)
+						o.success.call(o.success_scope, '' + x.responseText, x, o);
+					else if (o.error)
+						o.error.call(o.error_scope, c > 10000 ? 'TIMED_OUT' : 'GENERAL', x, o);
 
-				window.setTimeout("tinyMCE.selectedInstance.setBaseHREF(tinyMCE.settings['base_href']);tinyMCE._resetIframeHeight();", 1);
-				return;
+					x = null;
+				} else
+					w.setTimeout(ready, 10);
+			};
 
-			case "submit":
-				tinyMCE.triggerSave();
-				tinyMCE.isNotDirty = true;
-				return;
+			// Syncronous request
+			if (!o.async)
+				return ready();
 
-			case "reset":
-				var formObj = tinyMCE.isIE ? window.event.srcElement : e.target;
+			// Wait for response, onReadyStateChange can not be used since it leaks memory in IE
+			t = w.setTimeout(ready, 10);
+		}
 
-				for (var i=0; i<document.forms.length; i++) {
-					if (document.forms[i] == formObj)
-						window.setTimeout('tinyMCE.resetForm(' + i + ');', 10);
-				}
+		}
+});
+(function() {
+	var extend = tinymce.extend, JSON = tinymce.util.JSON, XHR = tinymce.util.XHR;
 
-				return;
+	tinymce.create('tinymce.util.JSONRequest', {
+		JSONRequest : function(s) {
+			this.settings = extend({
+			}, s);
+			this.count = 0;
+		},
 
-			case "keypress":
-				if (inst && inst.handleShortcut(e))
-					return false;
+		send : function(o) {
+			var ecb = o.error, scb = o.success;
 
-				if (e.target.editorId) {
-					tinyMCE.instances[e.target.editorId].select();
-				} else {
-					if (e.target.ownerDocument.editorId)
-						tinyMCE.instances[e.target.ownerDocument.editorId].select();
-				}
+			o = extend(this.settings, o);
 
-				if (tinyMCE.selectedInstance)
-					tinyMCE.selectedInstance.switchSettings();
+			o.success = function(c, x) {
+				c = JSON.parse(c);
 
-				// Insert P element
-				if ((tinyMCE.isGecko || tinyMCE.isOpera || tinyMCE.isSafari) && tinyMCE.settings['force_p_newlines'] && e.keyCode == 13 && !e.shiftKey) {
-					// Insert P element instead of BR
-					if (TinyMCE_ForceParagraphs._insertPara(tinyMCE.selectedInstance, e)) {
-						// Cancel event
-						tinyMCE.execCommand("mceAddUndoLevel");
-						return tinyMCE.cancelEvent(e);
-					}
+				if (typeof(c) == 'undefined') {
+					c = {
+						error : 'JSON Parse error.'
+					};
 				}
 
-				// Handle backspace
-				if ((tinyMCE.isGecko && !tinyMCE.isSafari) && tinyMCE.settings['force_p_newlines'] && (e.keyCode == 8 || e.keyCode == 46) && !e.shiftKey) {
-					// Insert P element instead of BR
-					if (TinyMCE_ForceParagraphs._handleBackSpace(tinyMCE.selectedInstance, e.type)) {
-						// Cancel event
-						tinyMCE.execCommand("mceAddUndoLevel");
-						return tinyMCE.cancelEvent(e);
-					}
-				}
+				if (c.error)
+					ecb.call(o.error_scope || o.scope, c.error, x);
+				else
+					scb.call(o.success_scope || o.scope, c.result);
+			};
 
-				// Return key pressed
-				if (tinyMCE.isIE && tinyMCE.settings['force_br_newlines'] && e.keyCode == 13) {
-					if (e.target.editorId)
-						tinyMCE.instances[e.target.editorId].select();
+			o.error = function(ty, x) {
+				ecb.call(o.error_scope || o.scope, ty, x);
+			};
 
-					if (tinyMCE.selectedInstance) {
-						var sel = tinyMCE.selectedInstance.getDoc().selection;
-						var rng = sel.createRange();
+			o.data = JSON.serialize({
+				id : o.id || 'c' + (this.count++),
+				method : o.method,
+				params : o.params
+			});
 
-						if (tinyMCE.getParentElement(rng.parentElement(), "li") != null)
-							return false;
+			// JSON content type for Ruby on rails. Bug: #1883287
+			o.content_type = 'application/json';
 
-						// Cancel event
-						e.returnValue = false;
-						e.cancelBubble = true;
-
-						// Insert BR element
-						rng.pasteHTML("<br />");
-						rng.collapse(false);
-						rng.select();
+			XHR.send(o);
+		},
 
-						tinyMCE.execCommand("mceAddUndoLevel");
-						tinyMCE.triggerNodeChange(false);
-						return false;
-					}
-				}
+		'static' : {
+			sendRPC : function(o) {
+				return new tinymce.util.JSONRequest().send(o);
+			}
+		}
 
-				// Backspace or delete
-				if (e.keyCode == 8 || e.keyCode == 46) {
-					tinyMCE.selectedElement = e.target;
-					tinyMCE.linkElement = tinyMCE.getParentElement(e.target, "a");
-					tinyMCE.imgElement = tinyMCE.getParentElement(e.target, "img");
-					tinyMCE.triggerNodeChange(false);
+		});
+}());(function(tinymce) {
+	// Shorten names
+	var each = tinymce.each, is = tinymce.is;
+	var isWebKit = tinymce.isWebKit, isIE = tinymce.isIE;
+
+	tinymce.create('tinymce.dom.DOMUtils', {
+		doc : null,
+		root : null,
+		files : null,
+		pixelStyles : /^(top|left|bottom|right|width|height|borderWidth)$/,
+		props : {
+			"for" : "htmlFor",
+			"class" : "className",
+			className : "className",
+			checked : "checked",
+			disabled : "disabled",
+			maxlength : "maxLength",
+			readonly : "readOnly",
+			selected : "selected",
+			value : "value",
+			id : "id",
+			name : "name",
+			type : "type"
+		},
+
+		DOMUtils : function(d, s) {
+			var t = this;
+
+			t.doc = d;
+			t.win = window;
+			t.files = {};
+			t.cssFlicker = false;
+			t.counter = 0;
+			t.boxModel = !tinymce.isIE || d.compatMode == "CSS1Compat"; 
+			t.stdMode = d.documentMode === 8;
+
+			t.settings = s = tinymce.extend({
+				keep_values : false,
+				hex_colors : 1,
+				process_html : 1
+			}, s);
+
+			// Fix IE6SP2 flicker and check it failed for pre SP2
+			if (tinymce.isIE6) {
+				try {
+					d.execCommand('BackgroundImageCache', false, true);
+				} catch (e) {
+					t.cssFlicker = true;
 				}
+			}
 
-				return false;
-			break;
+			tinymce.addUnload(t.destroy, t);
+		},
 
-			case "keyup":
-			case "keydown":
-				tinyMCE.hideMenus();
-				tinyMCE.hasMouseMoved = false;
+		getRoot : function() {
+			var t = this, s = t.settings;
 
-				if (inst && inst.handleShortcut(e))
-					return false;
+			return (s && t.get(s.root_element)) || t.doc.body;
+		},
 
-				if (e.target.editorId)
-					tinyMCE.instances[e.target.editorId].select();
+		getViewPort : function(w) {
+			var d, b;
 
-				if (tinyMCE.selectedInstance)
-					tinyMCE.selectedInstance.switchSettings();
+			w = !w ? this.win : w;
+			d = w.document;
+			b = this.boxModel ? d.documentElement : d.body;
 
-				var inst = tinyMCE.selectedInstance;
+			// Returns viewport size excluding scrollbars
+			return {
+				x : w.pageXOffset || b.scrollLeft,
+				y : w.pageYOffset || b.scrollTop,
+				w : w.innerWidth || b.clientWidth,
+				h : w.innerHeight || b.clientHeight
+			};
+		},
 
-				// Handle backspace
-				if (tinyMCE.isGecko && tinyMCE.settings['force_p_newlines'] && (e.keyCode == 8 || e.keyCode == 46) && !e.shiftKey) {
-					// Insert P element instead of BR
-					if (TinyMCE_ForceParagraphs._handleBackSpace(tinyMCE.selectedInstance, e.type)) {
-						// Cancel event
-						tinyMCE.execCommand("mceAddUndoLevel");
-						e.preventDefault();
-						return false;
-					}
-				}
+		getRect : function(e) {
+			var p, t = this, sr;
 
-				tinyMCE.selectedElement = null;
-				tinyMCE.selectedNode = null;
-				var elm = tinyMCE.selectedInstance.getFocusElement();
-				tinyMCE.linkElement = tinyMCE.getParentElement(elm, "a");
-				tinyMCE.imgElement = tinyMCE.getParentElement(elm, "img");
-				tinyMCE.selectedElement = elm;
-
-				// Update visualaids on tabs
-				if (tinyMCE.isGecko && e.type == "keyup" && e.keyCode == 9)
-					tinyMCE.handleVisualAid(tinyMCE.selectedInstance.getBody(), true, tinyMCE.settings['visual'], tinyMCE.selectedInstance);
-
-				// Fix empty elements on return/enter, check where enter occured
-				if (tinyMCE.isIE && e.type == "keydown" && e.keyCode == 13)
-					tinyMCE.enterKeyElement = tinyMCE.selectedInstance.getFocusElement();
-
-				// Fix empty elements on return/enter
-				if (tinyMCE.isIE && e.type == "keyup" && e.keyCode == 13) {
-					var elm = tinyMCE.enterKeyElement;
-					if (elm) {
-						var re = new RegExp('^HR|IMG|BR$','g'); // Skip these
-						var dre = new RegExp('^H[1-6]$','g'); // Add double on these
-
-						if (!elm.hasChildNodes() && !re.test(elm.nodeName)) {
-							if (dre.test(elm.nodeName))
-								elm.innerHTML = "&nbsp;&nbsp;";
-							else
-								elm.innerHTML = "&nbsp;";
-						}
-					}
-				}
+			e = t.get(e);
+			p = t.getPos(e);
+			sr = t.getSize(e);
+
+			return {
+				x : p.x,
+				y : p.y,
+				w : sr.w,
+				h : sr.h
+			};
+		},
 
-				// Check if it's a position key
-				var keys = tinyMCE.posKeyCodes;
-				var posKey = false;
-				for (var i=0; i<keys.length; i++) {
-					if (keys[i] == e.keyCode) {
-						posKey = true;
-						break;
-					}
-				}
+		getSize : function(e) {
+			var t = this, w, h;
 
-				// MSIE custom key handling
-				if (tinyMCE.isIE && tinyMCE.settings['custom_undo_redo']) {
-					var keys = new Array(8,46); // Backspace,Delete
+			e = t.get(e);
+			w = t.getStyle(e, 'width');
+			h = t.getStyle(e, 'height');
+
+			// Non pixel value, then force offset/clientWidth
+			if (w.indexOf('px') === -1)
+				w = 0;
+
+			// Non pixel value, then force offset/clientWidth
+			if (h.indexOf('px') === -1)
+				h = 0;
+
+			return {
+				w : parseInt(w) || e.offsetWidth || e.clientWidth,
+				h : parseInt(h) || e.offsetHeight || e.clientHeight
+			};
+		},
 
-					for (var i=0; i<keys.length; i++) {
-						if (keys[i] == e.keyCode) {
-							if (e.type == "keyup")
-								tinyMCE.triggerNodeChange(false);
-						}
-					}
-				}
+		getParent : function(n, f, r) {
+			return this.getParents(n, f, r, false);
+		},
 
-				// If Ctrl key
-				if (e.keyCode == 17)
-					return true;
+		getParents : function(n, f, r, c) {
+			var t = this, na, se = t.settings, o = [];
 
-				// Handle Undo/Redo when typing content
+			n = t.get(n);
+			c = c === undefined;
 
-				if (tinyMCE.isGecko) {
-					// Start typing (not a position key or ctrl key, but ctrl+x and ctrl+p is ok)
-					if (!posKey && e.type == "keyup" && !e.ctrlKey || (e.ctrlKey && (e.keyCode == 86 || e.keyCode == 88)))
-						tinyMCE.execCommand("mceStartTyping");
+			if (se.strict_root)
+				r = r || t.getRoot();
+
+			// Wrap node name as func
+			if (is(f, 'string')) {
+				na = f;
+
+				if (f === '*') {
+					f = function(n) {return n.nodeType == 1;};
 				} else {
-					// IE seems to be working better with this setting
-					if (!posKey && e.type == "keyup")
-						tinyMCE.execCommand("mceStartTyping");
+					f = function(n) {
+						return t.is(n, na);
+					};
 				}
+			}
 
-				// Store undo bookmark
-				if (e.type == "keydown" && (posKey || e.ctrlKey) && inst)
-					inst.undoBookmark = inst.selection.getBookmark();
-
-				// End typing (position key) or some Ctrl event
-				if (e.type == "keyup" && (posKey || e.ctrlKey))
-					tinyMCE.execCommand("mceEndTyping");
+			while (n) {
+				if (n == r || !n.nodeType || n.nodeType === 9)
+					break;
 
-				if (posKey && e.type == "keyup")
-					tinyMCE.triggerNodeChange(false);
+				if (!f || f(n)) {
+					if (c)
+						o.push(n);
+					else
+						return n;
+				}
 
-				if (tinyMCE.isIE && e.ctrlKey)
-					window.setTimeout('tinyMCE.triggerNodeChange(false);', 1);
-			break;
+				n = n.parentNode;
+			}
 
-			case "mousedown":
-			case "mouseup":
-			case "click":
-			case "dblclick":
-			case "focus":
-				tinyMCE.hideMenus();
-
-				if (tinyMCE.selectedInstance) {
-					tinyMCE.selectedInstance.switchSettings();
-					tinyMCE.selectedInstance.isFocused = true;
-				}
-
-				// Check instance event trigged on
-				var targetBody = tinyMCE.getParentElement(e.target, "html");
-				for (var instanceName in tinyMCE.instances) {
-					if (!tinyMCE.isInstance(tinyMCE.instances[instanceName]))
-						continue;
+			return c ? o : null;
+		},
 
-					var inst = tinyMCE.instances[instanceName];
+		get : function(e) {
+			var n;
 
-					// Reset design mode if lost (on everything just in case)
-					inst.autoResetDesignMode();
+			if (e && this.doc && typeof(e) == 'string') {
+				n = e;
+				e = this.doc.getElementById(e);
 
-					// Use HTML element since users might click outside of body element
-					if (inst.getBody().parentNode == targetBody) {
-						inst.select();
-						tinyMCE.selectedElement = e.target;
-						tinyMCE.linkElement = tinyMCE.getParentElement(tinyMCE.selectedElement, "a");
-						tinyMCE.imgElement = tinyMCE.getParentElement(tinyMCE.selectedElement, "img");
-						break;
-					}
-				}
+				// IE and Opera returns meta elements when they match the specified input ID, but getElementsByName seems to do the trick
+				if (e && e.id !== n)
+					return this.doc.getElementsByName(n)[1];
+			}
 
-				// Add first bookmark location
-				if (!tinyMCE.selectedInstance.undoRedo.undoLevels[0].bookmark && (e.type == "mouseup" || e.type == "dblclick"))
-					tinyMCE.selectedInstance.undoRedo.undoLevels[0].bookmark = tinyMCE.selectedInstance.selection.getBookmark();
-
-				// Reset selected node
-				if (e.type != "focus")
-					tinyMCE.selectedNode = null;
-
-				tinyMCE.triggerNodeChange(false);
-				tinyMCE.execCommand("mceEndTyping");
-
-				if (e.type == "mouseup")
-					tinyMCE.execCommand("mceAddUndoLevel");
-
-				// Just in case
-				if (!tinyMCE.selectedInstance && e.target.editorId)
-					tinyMCE.instances[e.target.editorId].select();
+			return e;
+		},
 
-				return false;
-			break;
-		}
-	},
 
-	getButtonHTML : function(id, lang, img, cmd, ui, val) {
-		var h = '', m, x, io = '';
+		select : function(pa, s) {
+			var t = this;
 
-		cmd = 'tinyMCE.execInstanceCommand(\'{$editor_id}\',\'' + cmd + '\'';
+			return tinymce.dom.Sizzle(pa, t.get(s) || t.get(t.settings.root_element) || t.doc, []);
+		},
 
-		if (typeof(ui) != "undefined" && ui != null)
-			cmd += ',' + ui;
+		is : function(n, patt) {
+			return tinymce.dom.Sizzle.matches(patt, n.nodeType ? [n] : n).length > 0;
+		},
 
-		if (typeof(val) != "undefined" && val != null)
-			cmd += ",'" + val + "'";
-
-		cmd += ');';
-
-		// Patch for IE7 bug with hover out not restoring correctly
-		if (tinyMCE.isRealIE)
-			io = 'onmouseover="tinyMCE.lastHover = this;"';
-
-		// Use tilemaps when enabled and found and never in MSIE since it loads the tile each time from cache if cahce is disabled
-		if (tinyMCE.getParam('button_tile_map') && (!tinyMCE.isIE || tinyMCE.isOpera) && (m = this.buttonMap[id]) != null && (tinyMCE.getParam("language") == "en" || img.indexOf('$lang') == -1)) {
-			// Tiled button
-			x = 0 - (m * 20) == 0 ? '0' : 0 - (m * 20);
-			h += '<a id="{$editor_id}_' + id + '" href="javascript:' + cmd + '" onclick="' + cmd + 'return false;" onmousedown="return false;" ' + io + ' class="mceTiledButton mceButtonNormal" target="_self">';
-			h += '<img src="{$themeurl}/images/spacer.gif" style="background-position: ' + x + 'px 0" title="{$' + lang + '}" />';
-			h += '</a>';
-		} else {
-			// Normal button
-			h += '<a id="{$editor_id}_' + id + '" href="javascript:' + cmd + '" onclick="' + cmd + 'return false;" onmousedown="return false;" ' + io + ' class="mceButtonNormal" target="_self">';
-			h += '<img src="' + img + '" title="{$' + lang + '}" />';
-			h += '</a>';
-		}
 
-		return h;
-	},
+		add : function(p, n, a, h, c) {
+			var t = this;
 
-	getMenuButtonHTML : function(id, lang, img, mcmd, cmd, ui, val) {
-		var h = '', m, x;
+			return this.run(p, function(p) {
+				var e, k;
 
-		mcmd = 'tinyMCE.execInstanceCommand(\'{$editor_id}\',\'' + mcmd + '\');';
-		cmd = 'tinyMCE.execInstanceCommand(\'{$editor_id}\',\'' + cmd + '\'';
+				e = is(n, 'string') ? t.doc.createElement(n) : n;
+				t.setAttribs(e, a);
 
-		if (typeof(ui) != "undefined" && ui != null)
-			cmd += ',' + ui;
+				if (h) {
+					if (h.nodeType)
+						e.appendChild(h);
+					else
+						t.setHTML(e, h);
+				}
 
-		if (typeof(val) != "undefined" && val != null)
-			cmd += ",'" + val + "'";
+				return !c ? p.appendChild(e) : e;
+			});
+		},
 
-		cmd += ');';
+		create : function(n, a, h) {
+			return this.add(this.doc.createElement(n), n, a, h, 1);
+		},
 
-		// Use tilemaps when enabled and found and never in MSIE since it loads the tile each time from cache if cahce is disabled
-		if (tinyMCE.getParam('button_tile_map') && (!tinyMCE.isIE || tinyMCE.isOpera) && (m = tinyMCE.buttonMap[id]) != null && (tinyMCE.getParam("language") == "en" || img.indexOf('$lang') == -1)) {
-			x = 0 - (m * 20) == 0 ? '0' : 0 - (m * 20);
+		createHTML : function(n, a, h) {
+			var o = '', t = this, k;
 
-			if (tinyMCE.isRealIE)
-				h += '<span id="{$editor_id}_' + id + '" class="mceMenuButton" onmouseover="tinyMCE._menuButtonEvent(\'over\',this);tinyMCE.lastHover = this;" onmouseout="tinyMCE._menuButtonEvent(\'out\',this);">';
-			else
-				h += '<span id="{$editor_id}_' + id + '" class="mceMenuButton">';
+			o += '<' + n;
 
-			h += '<a href="javascript:' + cmd + '" onclick="' + cmd + 'return false;" onmousedown="return false;" class="mceTiledButton mceMenuButtonNormal" target="_self">';
-			h += '<img src="{$themeurl}/images/spacer.gif" style="width: 20px; height: 20px; background-position: ' + x + 'px 0" title="{$' + lang + '}" /></a>';
-			h += '<a href="javascript:' + mcmd + '" onclick="' + mcmd + 'return false;" onmousedown="return false;"><img src="{$themeurl}/images/button_menu.gif" title="{$' + lang + '}" class="mceMenuButton" />';
-			h += '</a></span>';
-		} else {
-			if (tinyMCE.isRealIE)
-				h += '<span id="{$editor_id}_' + id + '" class="mceMenuButton" onmouseover="tinyMCE._menuButtonEvent(\'over\',this);tinyMCE.lastHover = this;" onmouseout="tinyMCE._menuButtonEvent(\'out\',this);">';
-			else
-				h += '<span id="{$editor_id}_' + id + '" class="mceMenuButton">';
+			for (k in a) {
+				if (a.hasOwnProperty(k))
+					o += ' ' + k + '="' + t.encode(a[k]) + '"';
+			}
 
-			h += '<a href="javascript:' + cmd + '" onclick="' + cmd + 'return false;" onmousedown="return false;" class="mceMenuButtonNormal" target="_self">';
-			h += '<img src="' + img + '" title="{$' + lang + '}" /></a>';
-			h += '<a href="javascript:' + mcmd + '" onclick="' + mcmd + 'return false;" onmousedown="return false;"><img src="{$themeurl}/images/button_menu.gif" title="{$' + lang + '}" class="mceMenuButton" />';
-			h += '</a></span>';
-		}
+			if (tinymce.is(h))
+				return o + '>' + h + '</' + n + '>';
 
-		return h;
-	},
+			return o + ' />';
+		},
 
-	_menuButtonEvent : function(e, o) {
-		if (o.className == 'mceMenuButtonFocus')
-			return;
+		remove : function(n, k) {
+			var t = this;
 
-		if (e == 'over')
-			o.className = o.className + ' mceMenuHover';
-		else
-			o.className = o.className.replace(/\s.*$/, '');
-	},
+			return this.run(n, function(n) {
+				var p, g, i;
 
-	addButtonMap : function(m) {
-		var i, a = m.replace(/\s+/, '').split(',');
+				p = n.parentNode;
 
-		for (i=0; i<a.length; i++)
-			this.buttonMap[a[i]] = i;
-	},
+				if (!p)
+					return null;
 
-	submitPatch : function() {
-		tinyMCE.triggerSave();
-		tinyMCE.isNotDirty = true;
-		this.mceOldSubmit();
-	},
+				if (k) {
+					for (i = n.childNodes.length - 1; i >= 0; i--)
+						t.insertAfter(n.childNodes[i], n);
 
-	onLoad : function() {
-		var r;
+					//each(n.childNodes, function(c) {
+					//	p.insertBefore(c.cloneNode(true), n);
+					//});
+				}
 
-		// Wait for everything to be loaded first
-		if (tinyMCE.settings.strict_loading_mode && this.loadingIndex != -1) {
-			window.setTimeout('tinyMCE.onLoad();', 1);
-			return;
-		}
+				// Fix IE psuedo leak
+				if (t.fixPsuedoLeaks) {
+					p = n.cloneNode(true);
+					k = 'IELeakGarbageBin';
+					g = t.get(k) || t.add(t.doc.body, 'div', {id : k, style : 'display:none'});
+					g.appendChild(n);
+					g.innerHTML = '';
 
-		if (tinyMCE.isRealIE && window.event.type == "readystatechange" && document.readyState != "complete")
-			return true;
+					return p;
+				}
 
-		if (tinyMCE.isLoaded)
-			return true;
+				return p.removeChild(n);
+			});
+		},
 
-		tinyMCE.isLoaded = true;
+		setStyle : function(n, na, v) {
+			var t = this;
 
-		// IE produces JS error if TinyMCE is placed in a frame
-		// It seems to have something to do with the selection not beeing
-		// correctly initialized in IE so this hack solves the problem
-		if (tinyMCE.isRealIE && document.body) {
-			r = document.body.createTextRange();
-			r.collapse(true);
-			r.select();
-		}
+			return t.run(n, function(e) {
+				var s, i;
 
-		tinyMCE.dispatchCallback(null, 'onpageload', 'onPageLoad');
+				s = e.style;
 
-		for (var c=0; c<tinyMCE.configs.length; c++) {
-			tinyMCE.settings = tinyMCE.configs[c];
+				// Camelcase it, if needed
+				na = na.replace(/-(\D)/g, function(a, b){
+					return b.toUpperCase();
+				});
 
-			var selector = tinyMCE.getParam("editor_selector");
-			var deselector = tinyMCE.getParam("editor_deselector");
-			var elementRefAr = new Array();
+				// Default px suffix on these
+				if (t.pixelStyles.test(na) && (tinymce.is(v, 'number') || /^[\-0-9\.]+$/.test(v)))
+					v += 'px';
+
+				switch (na) {
+					case 'opacity':
+						// IE specific opacity
+						if (isIE) {
+							s.filter = v === '' ? '' : "alpha(opacity=" + (v * 100) + ")";
 
-			// Add submit triggers
-			if (document.forms && tinyMCE.settings['add_form_submit_trigger'] && !tinyMCE.submitTriggers) {
-				for (var i=0; i<document.forms.length; i++) {
-					var form = document.forms[i];
+							if (!n.currentStyle || !n.currentStyle.hasLayout)
+								s.display = 'inline-block';
+						}
 
-					tinyMCE.addEvent(form, "submit", TinyMCE_Engine.prototype.handleEvent);
-					tinyMCE.addEvent(form, "reset", TinyMCE_Engine.prototype.handleEvent);
-					tinyMCE.submitTriggers = true; // Do it only once
+						// Fix for older browsers
+						s[na] = s['-moz-opacity'] = s['-khtml-opacity'] = v || '';
+						break;
 
-					// Patch the form.submit function
-					if (tinyMCE.settings['submit_patch']) {
-						try {
-							form.mceOldSubmit = form.submit;
-							form.submit = TinyMCE_Engine.prototype.submitPatch;
-						} catch (e) {
-							// Do nothing
-						}
-					}
+					case 'float':
+						isIE ? s.styleFloat = v : s.cssFloat = v;
+						break;
+					
+					default:
+						s[na] = v || '';
 				}
-			}
 
-			// Add editor instances based on mode
-			var mode = tinyMCE.settings['mode'];
-			switch (mode) {
-				case "exact":
-					var elements = tinyMCE.getParam('elements', '', true, ',');
+				// Force update of the style data
+				if (t.settings.update_styles)
+					t.setAttrib(e, 'mce_style');
+			});
+		},
 
-					for (var i=0; i<elements.length; i++) {
-						var element = tinyMCE._getElementById(elements[i]);
-						var trigger = element ? element.getAttribute(tinyMCE.settings['textarea_trigger']) : "";
+		getStyle : function(n, na, c) {
+			n = this.get(n);
 
-						if (new RegExp('\\b' + deselector + '\\b').test(tinyMCE.getAttrib(element, "class")))
-							continue;
+			if (!n)
+				return false;
 
-						if (trigger == "false")
-							continue;
+			// Gecko
+			if (this.doc.defaultView && c) {
+				// Remove camelcase
+				na = na.replace(/[A-Z]/g, function(a){
+					return '-' + a;
+				});
 
-						if ((tinyMCE.settings['ask'] || tinyMCE.settings['convert_on_click']) && element) {
-							elementRefAr[elementRefAr.length] = element;
-							continue;
-						}
+				try {
+					return this.doc.defaultView.getComputedStyle(n, null).getPropertyValue(na);
+				} catch (ex) {
+					// Old safari might fail
+					return null;
+				}
+			}
 
-						if (element)
-							tinyMCE.addMCEControl(element, elements[i]);
-						else if (tinyMCE.settings['debug'])
-							alert("Error: Could not find element by id or name: " + elements[i]);
-					}
-				break;
+			// Camelcase it, if needed
+			na = na.replace(/-(\D)/g, function(a, b){
+				return b.toUpperCase();
+			});
 
-				case "specific_textareas":
-				case "textareas":
-					var nodeList = document.getElementsByTagName("textarea");
-
-					for (var i=0; i<nodeList.length; i++) {
-						var elm = nodeList.item(i);
-						var trigger = elm.getAttribute(tinyMCE.settings['textarea_trigger']);
+			if (na == 'float')
+				na = isIE ? 'styleFloat' : 'cssFloat';
 
-						if (selector != '' && !new RegExp('\\b' + selector + '\\b').test(tinyMCE.getAttrib(elm, "class")))
-							continue;
+			// IE & Opera
+			if (n.currentStyle && c)
+				return n.currentStyle[na];
 
-						if (selector != '')
-							trigger = selector != "" ? "true" : "";
+			return n.style[na];
+		},
 
-						if (new RegExp('\\b' + deselector + '\\b').test(tinyMCE.getAttrib(elm, "class")))
-							continue;
+		setStyles : function(e, o) {
+			var t = this, s = t.settings, ol;
 
-						if ((mode == "specific_textareas" && trigger == "true") || (mode == "textareas" && trigger != "false"))
-							elementRefAr[elementRefAr.length] = elm;
-					}
-				break;
-			}
+			ol = s.update_styles;
+			s.update_styles = 0;
 
-			for (var i=0; i<elementRefAr.length; i++) {
-				var element = elementRefAr[i];
-				var elementId = element.name ? element.name : element.id;
-
-				if (tinyMCE.settings['ask'] || tinyMCE.settings['convert_on_click']) {
-					// Focus breaks in Mozilla
-					if (tinyMCE.isGecko) {
-						var settings = tinyMCE.settings;
-
-						tinyMCE.addEvent(element, "focus", function (e) {window.setTimeout(function() {TinyMCE_Engine.prototype.confirmAdd(e, settings);}, 10);});
-
-						if (element.nodeName != "TEXTAREA" && element.nodeName != "INPUT")
-							tinyMCE.addEvent(element, "click", function (e) {window.setTimeout(function() {TinyMCE_Engine.prototype.confirmAdd(e, settings);}, 10);});
-						// tinyMCE.addEvent(element, "mouseover", function (e) {window.setTimeout(function() {TinyMCE_Engine.prototype.confirmAdd(e, settings);}, 10);});
-					} else {
-						var settings = tinyMCE.settings;
+			each(o, function(v, n) {
+				t.setStyle(e, n, v);
+			});
 
-						tinyMCE.addEvent(element, "focus", function () { TinyMCE_Engine.prototype.confirmAdd(null, settings); });
-						tinyMCE.addEvent(element, "click", function () { TinyMCE_Engine.prototype.confirmAdd(null, settings); });
-						// tinyMCE.addEvent(element, "mouseenter", function () { TinyMCE_Engine.prototype.confirmAdd(null, settings); });
-					}
-				} else
-					tinyMCE.addMCEControl(element, elementId);
-			}
+			// Update style info
+			s.update_styles = ol;
+			if (s.update_styles)
+				t.setAttrib(e, s.cssText);
+		},
 
-			// Handle auto focus
-			if (tinyMCE.settings['auto_focus']) {
-				window.setTimeout(function () {
-					var inst = tinyMCE.getInstanceById(tinyMCE.settings['auto_focus']);
-					inst.selection.selectNode(inst.getBody(), true, true);
-					inst.contentWindow.focus();
-				}, 100);
-			}
+		setAttrib : function(e, n, v) {
+			var t = this;
 
-			tinyMCE.dispatchCallback(null, 'oninit', 'onInit');
-		}
-	},
+			// Whats the point
+			if (!e || !n)
+				return;
 
-	isInstance : function(o) {
-		return o != null && typeof(o) == "object" && o.isTinyMCE_Control;
-	},
+			// Strict XML mode
+			if (t.settings.strict)
+				n = n.toLowerCase();
+
+			return this.run(e, function(e) {
+				var s = t.settings;
+
+				switch (n) {
+					case "style":
+						if (!is(v, 'string')) {
+							each(v, function(v, n) {
+								t.setStyle(e, n, v);
+							});
 
-	getParam : function(name, default_value, strip_whitespace, split_chr) {
-		var value = (typeof(this.settings[name]) == "undefined") ? default_value : this.settings[name];
+							return;
+						}
 
-		// Fix bool values
-		if (value == "true" || value == "false")
-			return (value == "true");
+						// No mce_style for elements with these since they might get resized by the user
+						if (s.keep_values) {
+							if (v && !t._isRes(v))
+								e.setAttribute('mce_style', v, 2);
+							else
+								e.removeAttribute('mce_style', 2);
+						}
 
-		if (strip_whitespace)
-			value = tinyMCE.regexpReplace(value, "[ \t\r\n]", "");
+						e.style.cssText = v;
+						break;
 
-		if (typeof(split_chr) != "undefined" && split_chr != null) {
-			value = value.split(split_chr);
-			var outArray = new Array();
+					case "class":
+						e.className = v || ''; // Fix IE null bug
+						break;
 
-			for (var i=0; i<value.length; i++) {
-				if (value[i] && value[i] != "")
-					outArray[outArray.length] = value[i];
-			}
+					case "src":
+					case "href":
+						if (s.keep_values) {
+							if (s.url_converter)
+								v = s.url_converter.call(s.url_converter_scope || t, v, n, e);
 
-			value = outArray;
-		}
+							t.setAttrib(e, 'mce_' + n, v, 2);
+						}
 
-		return value;
-	},
+						break;
+					
+					case "shape":
+						e.setAttribute('mce_style', v);
+						break;
+				}
 
-	getLang : function(name, default_value, parse_entities, va) {
-		var v = (typeof(tinyMCELang[name]) == "undefined") ? default_value : tinyMCELang[name], n;
+				if (is(v) && v !== null && v.length !== 0)
+					e.setAttribute(n, '' + v, 2);
+				else
+					e.removeAttribute(n, 2);
+			});
+		},
 
-		if (parse_entities)
-			v = tinyMCE.entityDecode(v);
+		setAttribs : function(e, o) {
+			var t = this;
 
-		if (va) {
-			for (n in va)
-				v = this.replaceVar(v, n, va[n]);
-		}
+			return this.run(e, function(e) {
+				each(o, function(v, n) {
+					t.setAttrib(e, n, v);
+				});
+			});
+		},
 
-		return v;
-	},
+		getAttrib : function(e, n, dv) {
+			var v, t = this;
 
-	entityDecode : function(s) {
-		var e = document.createElement("div");
+			e = t.get(e);
 
-		e.innerHTML = s;
+			if (!e || e.nodeType !== 1)
+				return false;
 
-		return e.firstChild.nodeValue;
-	},
+			if (!is(dv))
+				dv = '';
 
-	addToLang : function(prefix, ar) {
-		for (var key in ar) {
-			if (typeof(ar[key]) == 'function')
-				continue;
+			// Try the mce variant for these
+			if (/^(src|href|style|coords|shape)$/.test(n)) {
+				v = e.getAttribute("mce_" + n);
 
-			tinyMCELang[(key.indexOf('lang_') == -1 ? 'lang_' : '') + (prefix != '' ? (prefix + "_") : '') + key] = ar[key];
-		}
+				if (v)
+					return v;
+			}
 
-		this.loadNextScript();
+			if (isIE && t.props[n]) {
+				v = e[t.props[n]];
+				v = v && v.nodeValue ? v.nodeValue : v;
+			}
 
-	//	for (var key in ar)
-	//		tinyMCELang[(key.indexOf('lang_') == -1 ? 'lang_' : '') + (prefix != '' ? (prefix + "_") : '') + key] = "|" + ar[key] + "|";
-	},
+			if (!v)
+				v = e.getAttribute(n, 2);
 
-	triggerNodeChange : function(focus, setup_content) {
-		if (tinyMCE.selectedInstance) {
-			var inst = tinyMCE.selectedInstance;
-			var editorId = inst.editorId;
-			var elm = (typeof(setup_content) != "undefined" && setup_content) ? tinyMCE.selectedElement : inst.getFocusElement();
-			var undoIndex = -1, doc;
-			var undoLevels = -1;
-			var anySelection = false;
-			var selectedText = inst.selection.getSelectedText();
+			if (n === 'style') {
+				v = v || e.style.cssText;
 
-			if (tinyMCE.settings.auto_resize)
-				inst.resizeToContent();
+				if (v) {
+					v = t.serializeStyle(t.parseStyle(v));
 
-			if (setup_content && tinyMCE.isGecko && inst.isHidden())
-				elm = inst.getBody();
+					if (t.settings.keep_values && !t._isRes(v))
+						e.setAttribute('mce_style', v);
+				}
+			}
 
-			inst.switchSettings();
+			// Remove Apple and WebKit stuff
+			if (isWebKit && n === "class" && v)
+				v = v.replace(/(apple|webkit)\-[a-z\-]+/gi, '');
 
-			if (tinyMCE.selectedElement)
-				anySelection = (tinyMCE.selectedElement.nodeName.toLowerCase() == "img") || (selectedText && selectedText.length > 0);
+			// Handle IE issues
+			if (isIE) {
+				switch (n) {
+					case 'rowspan':
+					case 'colspan':
+						// IE returns 1 as default value
+						if (v === 1)
+							v = '';
 
-			if (tinyMCE.settings['custom_undo_redo']) {
-				undoIndex = inst.undoRedo.undoIndex;
-				undoLevels = inst.undoRedo.undoLevels.length;
-			}
+						break;
 
-			tinyMCE.dispatchCallback(inst, 'handle_node_change_callback', 'handleNodeChange', editorId, elm, undoIndex, undoLevels, inst.visualAid, anySelection, setup_content);
-		}
+					case 'size':
+						// IE returns +0 as default value for size
+						if (v === '+0' || v === 20 || v === 0)
+							v = '';
 
-		if (this.selectedInstance && (typeof(focus) == "undefined" || focus))
-			this.selectedInstance.contentWindow.focus();
-	},
+						break;
 
-	_customCleanup : function(inst, type, content) {
-		var pl, po, i;
+					case 'width':
+					case 'height':
+					case 'vspace':
+					case 'checked':
+					case 'disabled':
+					case 'readonly':
+						if (v === 0)
+							v = '';
 
-		// Call custom cleanup
-		var customCleanup = tinyMCE.settings['cleanup_callback'];
-		if (customCleanup != "" && eval("typeof(" + customCleanup + ")") != "undefined")
-			content = eval(customCleanup + "(type, content, inst);");
+						break;
 
-		// Trigger theme cleanup
-		po = tinyMCE.themes[tinyMCE.settings['theme']];
-		if (po && po.cleanup)
-			content = po.cleanup(type, content, inst);
+					case 'hspace':
+						// IE returns -1 as default value
+						if (v === -1)
+							v = '';
 
-		// Trigger plugin cleanups
-		pl = inst.plugins;
-		for (i=0; i<pl.length; i++) {
-			po = tinyMCE.plugins[pl[i]];
+						break;
 
-			if (po && po.cleanup)
-				content = po.cleanup(type, content, inst);
-		}
+					case 'maxlength':
+					case 'tabindex':
+						// IE returns default value
+						if (v === 32768 || v === 2147483647 || v === '32768')
+							v = '';
 
-		return content;
-	},
+						break;
 
-	setContent : function(h) {
-		if (tinyMCE.selectedInstance) {
-			tinyMCE.selectedInstance.execCommand('mceSetContent', false, h);
-			tinyMCE.selectedInstance.repaint();
-		}
-	},
+					case 'multiple':
+					case 'compact':
+					case 'noshade':
+					case 'nowrap':
+						if (v === 65535)
+							return n;
 
-	importThemeLanguagePack : function(name) {
-		if (typeof(name) == "undefined")
-			name = tinyMCE.settings['theme'];
+						return dv;
 
-		tinyMCE.loadScript(tinyMCE.baseURL + '/themes/' + name + '/langs/' + tinyMCE.settings['language'] + '.js');
-	},
+					case 'shape':
+						v = v.toLowerCase();
+						break;
 
-	importPluginLanguagePack : function(name) {
-		var b = tinyMCE.baseURL + '/plugins/' + name;
+					default:
+						// IE has odd anonymous function for event attributes
+						if (n.indexOf('on') === 0 && v)
+							v = ('' + v).replace(/^function\s+\w+\(\)\s+\{\s+(.*)\s+\}$/, '$1');
+				}
+			}
 
-		if (this.plugins[name])
-			b = this.plugins[name].baseURL;
+			return (v !== undefined && v !== null && v !== '') ? '' + v : dv;
+		},
 
-		tinyMCE.loadScript(b + '/langs/' + tinyMCE.settings['language'] +  '.js');
-	},
+		getPos : function(n, ro) {
+			var t = this, x = 0, y = 0, e, d = t.doc, r;
 
-	applyTemplate : function(h, as) {
-		return h.replace(new RegExp('\\{\\$([a-z0-9_]+)\\}', 'gi'), function(m, s) {
-			if (s.indexOf('lang_') == 0 && tinyMCELang[s])
-				return tinyMCELang[s];
+			n = t.get(n);
+			ro = ro || d.body;
 
-			if (as && as[s])
-				return as[s];
+			if (n) {
+				// Use getBoundingClientRect on IE, Opera has it but it's not perfect
+				if (isIE && !t.stdMode) {
+					n = n.getBoundingClientRect();
+					e = t.boxModel ? d.documentElement : d.body;
+					x = t.getStyle(t.select('html')[0], 'borderWidth'); // Remove border
+					x = (x == 'medium' || t.boxModel && !t.isIE6) && 2 || x;
+					n.top += t.win.self != t.win.top ? 2 : 0; // IE adds some strange extra cord if used in a frameset
 
-			if (tinyMCE.settings[s])
-				return tinyMCE.settings[s];
+					return {x : n.left + e.scrollLeft - x, y : n.top + e.scrollTop - x};
+				}
 
-			if (m == 'themeurl')
-				return tinyMCE.themeURL;
+				r = n;
+				while (r && r != ro && r.nodeType) {
+					x += r.offsetLeft || 0;
+					y += r.offsetTop || 0;
+					r = r.offsetParent;
+				}
 
-			return m;
-		});
-	},
+				r = n.parentNode;
+				while (r && r != ro && r.nodeType) {
+					x -= r.scrollLeft || 0;
+					y -= r.scrollTop || 0;
+					r = r.parentNode;
+				}
+			}
 
-	replaceVar : function(h, r, v) {
-		return h.replace(new RegExp('{\\\$' + r + '}', 'g'), v);
-	},
+			return {x : x, y : y};
+		},
 
-	openWindow : function(template, args) {
-		var html, width, height, x, y, resizable, scrollbars, url;
+		parseStyle : function(st) {
+			var t = this, s = t.settings, o = {};
 
-		args['mce_template_file'] = template['file'];
-		args['mce_width'] = template['width'];
-		args['mce_height'] = template['height'];
-		tinyMCE.windowArgs = args;
+			if (!st)
+				return o;
 
-		html = template['html'];
-		if (!(width = parseInt(template['width'])))
-			width = 320;
+			function compress(p, s, ot) {
+				var t, r, b, l;
 
-		if (!(height = parseInt(template['height'])))
-			height = 200;
+				// Get values and check it it needs compressing
+				t = o[p + '-top' + s];
+				if (!t)
+					return;
 
-		// Add to height in M$ due to SP2 WHY DON'T YOU GUYS IMPLEMENT innerWidth of windows!!
-		if (tinyMCE.isIE)
-			height += 40;
-		else
-			height += 20;
+				r = o[p + '-right' + s];
+				if (t != r)
+					return;
 
-		x = parseInt(screen.width / 2.0) - (width / 2.0);
-		y = parseInt(screen.height / 2.0) - (height / 2.0);
+				b = o[p + '-bottom' + s];
+				if (r != b)
+					return;
 
-		resizable = (args && args['resizable']) ? args['resizable'] : "no";
-		scrollbars = (args && args['scrollbars']) ? args['scrollbars'] : "no";
+				l = o[p + '-left' + s];
+				if (b != l)
+					return;
 
-		if (template['file'].charAt(0) != '/' && template['file'].indexOf('://') == -1)
-			url = tinyMCE.baseURL + "/themes/" + tinyMCE.getParam("theme") + "/" + template['file'];
-		else
-			url = template['file'];
+				// Compress
+				o[ot] = l;
+				delete o[p + '-top' + s];
+				delete o[p + '-right' + s];
+				delete o[p + '-bottom' + s];
+				delete o[p + '-left' + s];
+			};
 
-		// Replace all args as variables in URL
-		for (var name in args) {
-			if (typeof(args[name]) == 'function')
-				continue;
+			function compress2(ta, a, b, c) {
+				var t;
 
-			url = tinyMCE.replaceVar(url, name, escape(args[name]));
-		}
+				t = o[a];
+				if (!t)
+					return;
 
-		if (html) {
-			html = tinyMCE.replaceVar(html, "css", this.settings['popups_css']);
-			html = tinyMCE.applyTemplate(html, args);
+				t = o[b];
+				if (!t)
+					return;
 
-			var win = window.open("", "mcePopup" + new Date().getTime(), "top=" + y + ",left=" + x + ",scrollbars=" + scrollbars + ",dialog=yes,minimizable=" + resizable + ",modal=yes,width=" + width + ",height=" + height + ",resizable=" + resizable);
-			if (win == null) {
-				alert(tinyMCELang['lang_popup_blocked']);
-				return;
-			}
+				t = o[c];
+				if (!t)
+					return;
 
-			win.document.write(html);
-			win.document.close();
-			win.resizeTo(width, height);
-			win.focus();
-		} else {
-			if ((tinyMCE.isRealIE) && resizable != 'yes' && tinyMCE.settings["dialog_type"] == "modal") {
-				height += 10;
+				// Compress
+				o[ta] = o[a] + ' ' + o[b] + ' ' + o[c];
+				delete o[a];
+				delete o[b];
+				delete o[c];
+			};
 
-				var features = "resizable:" + resizable 
-					+ ";scroll:"
-					+ scrollbars + ";status:yes;center:yes;help:no;dialogWidth:"
-					+ width + "px;dialogHeight:" + height + "px;";
+			st = st.replace(/&(#?[a-z0-9]+);/g, '&$1_MCE_SEMI_'); // Protect entities
 
-				window.showModalDialog(url, window, features);
-			} else {
-				var modal = (resizable == "yes") ? "no" : "yes";
+			each(st.split(';'), function(v) {
+				var sv, ur = [];
 
-				if (tinyMCE.isGecko && tinyMCE.isMac)
-					modal = "no";
+				if (v) {
+					v = v.replace(/_MCE_SEMI_/g, ';'); // Restore entities
+					v = v.replace(/url\([^\)]+\)/g, function(v) {ur.push(v);return 'url(' + ur.length + ')';});
+					v = v.split(':');
+					sv = tinymce.trim(v[1]);
+					sv = sv.replace(/url\(([^\)]+)\)/g, function(a, b) {return ur[parseInt(b) - 1];});
 
-				if (template['close_previous'] != "no")
-					try {tinyMCE.lastWindow.close();} catch (ex) {}
+					sv = sv.replace(/rgb\([^\)]+\)/g, function(v) {
+						return t.toHex(v);
+					});
 
-				var win = window.open(url, "mcePopup" + new Date().getTime(), "top=" + y + ",left=" + x + ",scrollbars=" + scrollbars + ",dialog=" + modal + ",minimizable=" + resizable + ",modal=" + modal + ",width=" + width + ",height=" + height + ",resizable=" + resizable);
-				if (win == null) {
-					alert(tinyMCELang['lang_popup_blocked']);
-					return;
+					if (s.url_converter) {
+						sv = sv.replace(/url\([\'\"]?([^\)\'\"]+)[\'\"]?\)/g, function(x, c) {
+							return 'url(' + s.url_converter.call(s.url_converter_scope || t, t.decode(c), 'style', null) + ')';
+						});
+					}
+
+					o[tinymce.trim(v[0]).toLowerCase()] = sv;
 				}
+			});
 
-				if (template['close_previous'] != "no")
-					tinyMCE.lastWindow = win;
+			compress("border", "", "border");
+			compress("border", "-width", "border-width");
+			compress("border", "-color", "border-color");
+			compress("border", "-style", "border-style");
+			compress("padding", "", "padding");
+			compress("margin", "", "margin");
+			compress2('border', 'border-width', 'border-style', 'border-color');
+
+			if (isIE) {
+				// Remove pointless border
+				if (o.border == 'medium none')
+					o.border = '';
+			}
+
+			return o;
+		},
+
+		serializeStyle : function(o) {
+			var s = '';
+
+			each(o, function(v, k) {
+				if (k && v) {
+					if (tinymce.isGecko && k.indexOf('-moz-') === 0)
+						return;
 
-				eval('try { win.resizeTo(width, height); } catch(e) { }');
+					switch (k) {
+						case 'color':
+						case 'background-color':
+							v = v.toLowerCase();
+							break;
+					}
 
-				// Make it bigger if statusbar is forced
-				if (tinyMCE.isGecko) {
-					if (win.document.defaultView.statusbar.visible)
-						win.resizeBy(0, tinyMCE.isMac ? 10 : 24);
+					s += (s ? ' ' : '') + k + ': ' + v + ';';
 				}
+			});
 
-				win.focus();
-			}
-		}
-	},
+			return s;
+		},
 
-	closeWindow : function(win) {
-		win.close();
-	},
+		loadCSS : function(u) {
+			var t = this, d = t.doc, head;
 
-	getVisualAidClass : function(class_name, state) {
-		var aidClass = tinyMCE.settings['visual_table_class'];
+			if (!u)
+				u = '';
 
-		if (typeof(state) == "undefined")
-			state = tinyMCE.settings['visual'];
+			head = t.select('head')[0];
 
-		// Split
-		var classNames = new Array();
-		var ar = class_name.split(' ');
-		for (var i=0; i<ar.length; i++) {
-			if (ar[i] == aidClass)
-				ar[i] = "";
+			each(u.split(','), function(u) {
+				var link;
 
-			if (ar[i] != "")
-				classNames[classNames.length] = ar[i];
-		}
+				if (t.files[u])
+					return;
+
+				t.files[u] = true;
+				link = t.create('link', {rel : 'stylesheet', href : tinymce._addVer(u)});
 
-		if (state)
-			classNames[classNames.length] = aidClass;
+				// IE 8 has a bug where dynamically loading stylesheets would produce a 1 item remaining bug
+				// This fix seems to resolve that issue by realcing the document ones a stylesheet finishes loading
+				// It's ugly but it seems to work fine.
+				if (isIE && d.documentMode) {
+					link.onload = function() {
+						d.recalc();
+						link.onload = null;
+					};
+				}
 
-		// Glue
-		var className = "";
-		for (var i=0; i<classNames.length; i++) {
-			if (i > 0)
-				className += " ";
+				head.appendChild(link);
+			});
+		},
 
-			className += classNames[i];
-		}
+		addClass : function(e, c) {
+			return this.run(e, function(e) {
+				var o;
 
-		return className;
-	},
+				if (!c)
+					return 0;
 
-	handleVisualAid : function(el, deep, state, inst, skip_dispatch) {
-		if (!el)
-			return;
+				if (this.hasClass(e, c))
+					return e.className;
 
-		if (!skip_dispatch)
-			tinyMCE.dispatchCallback(inst, 'handle_visual_aid_callback', 'handleVisualAid', el, deep, state, inst);
+				o = this.removeClass(e, c);
 
-		var tableElement = null;
+				return e.className = (o != '' ? (o + ' ') : '') + c;
+			});
+		},
 
-		switch (el.nodeName) {
-			case "TABLE":
-				var oldW = el.style.width;
-				var oldH = el.style.height;
-				var bo = tinyMCE.getAttrib(el, "border");
+		removeClass : function(e, c) {
+			var t = this, re;
 
-				bo = bo == "" || bo == "0" ? true : false;
+			return t.run(e, function(e) {
+				var v;
 
-				tinyMCE.setAttrib(el, "class", tinyMCE.getVisualAidClass(tinyMCE.getAttrib(el, "class"), state && bo));
+				if (t.hasClass(e, c)) {
+					if (!re)
+						re = new RegExp("(^|\\s+)" + c + "(\\s+|$)", "g");
 
-				el.style.width = oldW;
-				el.style.height = oldH;
+					v = e.className.replace(re, ' ');
 
-				for (var y=0; y<el.rows.length; y++) {
-					for (var x=0; x<el.rows[y].cells.length; x++) {
-						var cn = tinyMCE.getVisualAidClass(tinyMCE.getAttrib(el.rows[y].cells[x], "class"), state && bo);
-						tinyMCE.setAttrib(el.rows[y].cells[x], "class", cn);
-					}
+					return e.className = tinymce.trim(v != ' ' ? v : '');
 				}
 
-				break;
+				return e.className;
+			});
+		},
 
-			case "A":
-				var anchorName = tinyMCE.getAttrib(el, "name");
+		hasClass : function(n, c) {
+			n = this.get(n);
 
-				if (anchorName != '' && state) {
-					el.title = anchorName;
-					tinyMCE.addCSSClass(el, 'mceItemAnchor');
-				} else if (anchorName != '' && !state)
-					el.className = '';
+			if (!n || !c)
+				return false;
 
-				break;
-		}
+			return (' ' + n.className + ' ').indexOf(' ' + c + ' ') !== -1;
+		},
 
-		if (deep && el.hasChildNodes()) {
-			for (var i=0; i<el.childNodes.length; i++)
-				tinyMCE.handleVisualAid(el.childNodes[i], deep, state, inst, true);
-		}
-	},
+		show : function(e) {
+			return this.setStyle(e, 'display', 'block');
+		},
 
-	/*
-	applyClassesToFonts : function(doc, size) {
-		var f = doc.getElementsByTagName("font");
-		for (var i=0; i<f.length; i++) {
-			var s = tinyMCE.getAttrib(f[i], "size");
-
-			if (s != "")
-				tinyMCE.setAttrib(f[i], 'class', "mceItemFont" + s);
-		}
-
-		if (typeof(size) != "undefined") {
-			var css = "";
-
-			for (var x=0; x<doc.styleSheets.length; x++) {
-				for (var i=0; i<doc.styleSheets[x].rules.length; i++) {
-					if (doc.styleSheets[x].rules[i].selectorText == '#mceSpanFonts .mceItemFont' + size) {
-						css = doc.styleSheets[x].rules[i].style.cssText;
-						break;
-					}
-				}
+		hide : function(e) {
+			return this.setStyle(e, 'display', 'none');
+		},
 
-				if (css != "")
-					break;
-			}
+		isHidden : function(e) {
+			e = this.get(e);
 
-			if (doc.styleSheets[0].rules[0].selectorText == "FONT")
-				doc.styleSheets[0].removeRule(0);
+			return !e || e.style.display == 'none' || this.getStyle(e, 'display') == 'none';
+		},
 
-			doc.styleSheets[0].addRule("FONT", css, 0);
-		}
-	},
-	*/
+		uniqueId : function(p) {
+			return (!p ? 'mce_' : p) + (this.counter++);
+		},
 
-	fixGeckoBaseHREFBug : function(m, e, h) {
-		var xsrc, xhref;
+		setHTML : function(e, h) {
+			var t = this;
 
-		if (tinyMCE.isGecko) {
-			if (m == 1) {
-				h = h.replace(/\ssrc=/gi, " mce_tsrc=");
-				h = h.replace(/\shref=/gi, " mce_thref=");
+			return this.run(e, function(e) {
+				var x, i, nl, n, p, x;
 
-				return h;
-			} else {
-				// Why bother if there is no src or href broken
-				if (!new RegExp('(src|href)=', 'g').test(h))
-					return h;
-
-				// Restore src and href that gets messed up by Gecko
-				tinyMCE.selectElements(e, 'A,IMG,SELECT,AREA,IFRAME,BASE,INPUT,SCRIPT,EMBED,OBJECT,LINK', function (n) {
-					xsrc = tinyMCE.getAttrib(n, "mce_tsrc");
-					xhref = tinyMCE.getAttrib(n, "mce_thref");
+				h = t.processHTML(h);
 
-					if (xsrc != "") {
+				if (isIE) {
+					function set() {
 						try {
-							n.src = tinyMCE.convertRelativeToAbsoluteURL(tinyMCE.settings['base_href'], xsrc);
-						} catch (e) {
-							// Ignore, Firefox cast exception if local file wasn't found
+							// IE will remove comments from the beginning
+							// unless you padd the contents with something
+							e.innerHTML = '<br />' + h;
+							e.removeChild(e.firstChild);
+						} catch (ex) {
+							// IE sometimes produces an unknown runtime error on innerHTML if it's an block element within a block element for example a div inside a p
+							// This seems to fix this problem
+
+							// Remove all child nodes
+							while (e.firstChild)
+								e.firstChild.removeNode();
+
+							// Create new div with HTML contents and a BR infront to keep comments
+							x = t.create('div');
+							x.innerHTML = '<br />' + h;
+
+							// Add all children from div to target
+							each (x.childNodes, function(n, i) {
+								// Skip br element
+								if (i)
+									e.appendChild(n);
+							});
 						}
+					};
 
-						n.removeAttribute("mce_tsrc");
-					}
+					// IE has a serious bug when it comes to paragraphs it can produce an invalid
+					// DOM tree if contents like this <p><ul><li>Item 1</li></ul></p> is inserted
+					// It seems to be that IE doesn't like a root block element placed inside another root block element
+					if (t.settings.fix_ie_paragraphs)
+						h = h.replace(/<p><\/p>|<p([^>]+)><\/p>|<p[^\/+]\/>/gi, '<p$1 mce_keep="true">&nbsp;</p>');
+
+					set();
+
+					if (t.settings.fix_ie_paragraphs) {
+						// Check for odd paragraphs this is a sign of a broken DOM
+						nl = e.getElementsByTagName("p");
+						for (i = nl.length - 1, x = 0; i >= 0; i--) {
+							n = nl[i];
+
+							if (!n.hasChildNodes()) {
+								if (!n.mce_keep) {
+									x = 1; // Is broken
+									break;
+								}
 
-					if (xhref != "") {
-						try {
-							n.href = tinyMCE.convertRelativeToAbsoluteURL(tinyMCE.settings['base_href'], xhref);
-						} catch (e) {
-							// Ignore, Firefox cast exception if local file wasn't found
+								n.removeAttribute('mce_keep');
+							}
 						}
-
-						n.removeAttribute("mce_thref");
 					}
 
-					return false;
-				});
+					// Time to fix the madness IE left us
+					if (x) {
+						// So if we replace the p elements with divs and mark them and then replace them back to paragraphs
+						// after we use innerHTML we can fix the DOM tree
+						h = h.replace(/<p ([^>]+)>|<p>/g, '<div $1 mce_tmp="1">');
+						h = h.replace(/<\/p>/g, '</div>');
+
+						// Set the new HTML with DIVs
+						set();
+
+						// Replace all DIV elements with he mce_tmp attibute back to paragraphs
+						// This is needed since IE has a annoying bug see above for details
+						// This is a slow process but it has to be done. :(
+						if (t.settings.fix_ie_paragraphs) {
+							nl = e.getElementsByTagName("DIV");
+							for (i = nl.length - 1; i >= 0; i--) {
+								n = nl[i];
+
+								// Is it a temp div
+								if (n.mce_tmp) {
+									// Create new paragraph
+									p = t.doc.createElement('p');
+
+									// Copy all attributes
+									n.cloneNode(false).outerHTML.replace(/([a-z0-9\-_]+)=/gi, function(a, b) {
+										var v;
+
+										if (b !== 'mce_tmp') {
+											v = n.getAttribute(b);
+
+											if (!v && b === 'class')
+												v = n.className;
+
+											p.setAttribute(b, v);
+										}
+									});
+
+									// Append all children to new paragraph
+									for (x = 0; x<n.childNodes.length; x++)
+										p.appendChild(n.childNodes[x].cloneNode(true));
 
-				// Restore text/comment nodes
-				tinyMCE.selectNodes(e, function(n) {
-					if (n.nodeType == 3 || n.nodeType == 8) {
-						n.nodeValue = n.nodeValue.replace(/\smce_tsrc=/gi, " src=");
-						n.nodeValue = n.nodeValue.replace(/\smce_thref=/gi, " href=");
+									// Replace div with new paragraph
+									n.swapNode(p);
+								}
+							}
+						}
 					}
+				} else
+					e.innerHTML = h;
 
-					return false;
-				});
-			}
-		}
+				return h;
+			});
+		},
 
-		return h;
-	},
+		processHTML : function(h) {
+			var t = this, s = t.settings;
 
-	_setHTML : function(doc, html_content) {
-		// Force closed anchors open
-		//html_content = html_content.replace(new RegExp('<a(.*?)/>', 'gi'), '<a$1></a>');
+			if (!s.process_html)
+				return h;
 
-		html_content = tinyMCE.cleanupHTMLCode(html_content);
+			// Convert strong and em to b and i in FF since it can't handle them
+			if (tinymce.isGecko) {
+				h = h.replace(/<(\/?)strong>|<strong( [^>]+)>/gi, '<$1b$2>');
+				h = h.replace(/<(\/?)em>|<em( [^>]+)>/gi, '<$1i$2>');
+			} else if (isIE) {
+				h = h.replace(/&apos;/g, '&#39;'); // IE can't handle apos
+				h = h.replace(/\s+(disabled|checked|readonly|selected)\s*=\s*[\"\']?(false|0)[\"\']?/gi, ''); // IE doesn't handle default values correct
+			}
+
+			// Fix some issues
+			h = h.replace(/<a( )([^>]+)\/>|<a\/>/gi, '<a$1$2></a>'); // Force open
+
+			// Store away src and href in mce_src and mce_href since browsers mess them up
+			if (s.keep_values) {
+				// Wrap scripts and styles in comments for serialization purposes
+				if (/<script|noscript|style/.test(h)) {
+					function trim(s) {
+						// Remove prefix and suffix code for element
+						s = s.replace(/(<!--\[CDATA\[|\]\]-->)/g, '\n');
+						s = s.replace(/^[\r\n]*|[\r\n]*$/g, '');
+						s = s.replace(/^\s*(\/\/\s*<!--|\/\/\s*<!\[CDATA\[|<!--|<!\[CDATA\[)[\r\n]*/g, '');
+						s = s.replace(/\s*(\/\/\s*\]\]>|\/\/\s*-->|\]\]>|-->|\]\]-->)\s*$/g, '');
+
+						return s;
+					};
+
+					// Wrap the script contents in CDATA and keep them from executing
+					h = h.replace(/<script([^>]+|)>([\s\S]*?)<\/script>/g, function(v, attribs, text) {
+						// Force type attribute
+						if (!attribs)
+							attribs = ' type="text/javascript"';
+
+						// Prefix script type/language attribute values with mce- to prevent it from executing
+						attribs = attribs.replace(/(type|language)=\"?/, '$&mce-');
+						attribs = attribs.replace(/src=\"([^\"]+)\"?/, function(a, url) {
+							if (s.url_converter)
+								url = t.encode(s.url_converter.call(s.url_converter_scope || t, t.decode(url), 'src', 'script'));
+
+							return 'mce_src="' + url + '"';
+						});
+
+						// Wrap text contents
+						if (tinymce.trim(text))
+							text = '<!--\n' + trim(text) + '\n// -->';
+
+						return '<mce:script' + attribs + '>' + text + '</mce:script>';
+					});
+
+					// Wrap style elements
+					h = h.replace(/<style([^>]+|)>([\s\S]*?)<\/style>/g, function(v, attribs, text) {
+						// Wrap text contents
+						if (text)
+							text = '<!--\n' + trim(text) + '\n-->';
+
+						return '<mce:style' + attribs + '>' + text + '</mce:style><style ' + attribs + ' mce_bogus="1">' + text + '</style>';
+					});
+
+					// Wrap noscript elements
+					h = h.replace(/<noscript([^>]+|)>([\s\S]*?)<\/noscript>/g, function(v, attribs, text) {
+						return '<mce:noscript' + attribs + '><!--' + t.encode(text).replace(/--/g, '&#45;&#45;') + '--></mce:noscript>';
+					});
+				}
+
+				h = h.replace(/<!\[CDATA\[([\s\S]+)\]\]>/g, '<!--[CDATA[$1]]-->');
+
+				// Process all tags with src, href or style
+				h = h.replace(/<([\w:]+) [^>]*(src|href|style|shape|coords)[^>]*>/gi, function(a, n) {
+					function handle(m, b, c) {
+						var u = c;
+
+						// Tag already got a mce_ version
+						if (a.indexOf('mce_' + b) != -1)
+							return m;
+
+						if (b == 'style') {
+							// No mce_style for elements with these since they might get resized by the user
+							if (t._isRes(c))
+								return m;
+
+							if (s.hex_colors) {
+								u = u.replace(/rgb\([^\)]+\)/g, function(v) {
+									return t.toHex(v);
+								});
+							}
 
-		// Try innerHTML if it fails use pasteHTML in MSIE
-		try {
-			tinyMCE.setInnerHTML(doc.body, html_content);
-		} catch (e) {
-			if (this.isMSIE)
-				doc.body.createTextRange().pasteHTML(html_content);
-		}
-
-		// Content duplication bug fix
-		if (tinyMCE.isIE && tinyMCE.settings['fix_content_duplication']) {
-			// Remove P elements in P elements
-			var paras = doc.getElementsByTagName("P");
-			for (var i=0; i<paras.length; i++) {
-				var node = paras[i];
-				while ((node = node.parentNode) != null) {
-					if (node.nodeName == "P")
-						node.outerHTML = node.innerHTML;
-				}
-			}
+							if (s.url_converter) {
+								u = u.replace(/url\([\'\"]?([^\)\'\"]+)\)/g, function(x, c) {
+									return 'url(' + t.encode(s.url_converter.call(s.url_converter_scope || t, t.decode(c), b, n)) + ')';
+								});
+							}
+						} else if (b != 'coords' && b != 'shape') {
+							if (s.url_converter)
+								u = t.encode(s.url_converter.call(s.url_converter_scope || t, t.decode(c), b, n));
+						}
 
-			// Content duplication bug fix (Seems to be word crap)
-			var html = doc.body.innerHTML;
-/*
-			if (html.indexOf('="mso') != -1) {
-				for (var i=0; i<doc.body.all.length; i++) {
-					var el = doc.body.all[i];
-					el.removeAttribute("className","",0);
-					el.removeAttribute("style","",0);
-				}
-
-				html = doc.body.innerHTML;
-				html = tinyMCE.regexpReplace(html, "<o:p><\/o:p>", "<br />");
-				html = tinyMCE.regexpReplace(html, "<o:p>&nbsp;<\/o:p>", "");
-				html = tinyMCE.regexpReplace(html, "<st1:.*?>", "");
-				html = tinyMCE.regexpReplace(html, "<p><\/p>", "");
-				html = tinyMCE.regexpReplace(html, "<p><\/p>\r\n<p><\/p>", "");
-				html = tinyMCE.regexpReplace(html, "<p>&nbsp;<\/p>", "<br />");
-				html = tinyMCE.regexpReplace(html, "<p>\s*(<p>\s*)?", "<p>");
-				html = tinyMCE.regexpReplace(html, "<\/p>\s*(<\/p>\s*)?", "</p>");
-			}*/
+						return ' ' + b + '="' + c + '" mce_' + b + '="' + u + '"';
+					};
 
-			// Always set the htmlText output
-			tinyMCE.setInnerHTML(doc.body, html);
-		}
+					a = a.replace(/ (src|href|style|coords|shape)=[\"]([^\"]+)[\"]/gi, handle); // W3C
+					a = a.replace(/ (src|href|style|coords|shape)=[\']([^\']+)[\']/gi, handle); // W3C
 
-		tinyMCE.cleanupAnchors(doc);
+					return a.replace(/ (src|href|style|coords|shape)=([^\s\"\'>]+)/gi, handle); // IE
+				});
+			}
 
-		if (tinyMCE.getParam("convert_fonts_to_spans"))
-			tinyMCE.convertSpansToFonts(doc);
-	},
+			return h;
+		},
 
-	getEditorId : function(form_element) {
-		var inst = this.getInstanceById(form_element);
-		if (!inst)
-			return null;
+		getOuterHTML : function(e) {
+			var d;
 
-		return inst.editorId;
-	},
+			e = this.get(e);
 
-	getInstanceById : function(editor_id) {
-		var inst = this.instances[editor_id];
-		if (!inst) {
-			for (var n in tinyMCE.instances) {
-				var instance = tinyMCE.instances[n];
-				if (!tinyMCE.isInstance(instance))
-					continue;
+			if (!e)
+				return null;
 
-				if (instance.formTargetElementId == editor_id) {
-					inst = instance;
-					break;
-				}
-			}
-		}
+			if (e.outerHTML !== undefined)
+				return e.outerHTML;
 
-		return inst;
-	},
+			d = (e.ownerDocument || this.doc).createElement("body");
+			d.appendChild(e.cloneNode(true));
 
-	queryInstanceCommandValue : function(editor_id, command) {
-		var inst = tinyMCE.getInstanceById(editor_id);
-		if (inst)
-			return inst.queryCommandValue(command);
+			return d.innerHTML;
+		},
 
-		return false;
-	},
+		setOuterHTML : function(e, h, d) {
+			var t = this;
 
-	queryInstanceCommandState : function(editor_id, command) {
-		var inst = tinyMCE.getInstanceById(editor_id);
-		if (inst)
-			return inst.queryCommandState(command);
+			return this.run(e, function(e) {
+				var n, tp;
 
-		return null;
-	},
+				e = t.get(e);
+				d = d || e.ownerDocument || t.doc;
 
-	setWindowArg : function(n, v) {
-		this.windowArgs[n] = v;
-	},
+				if (isIE && e.nodeType == 1)
+					e.outerHTML = h;
+				else {
+					tp = d.createElement("body");
+					tp.innerHTML = h;
 
-	getWindowArg : function(n, d) {
-		return (typeof(this.windowArgs[n]) == "undefined") ? d : this.windowArgs[n];
-	},
+					n = tp.lastChild;
+					while (n) {
+						t.insertAfter(n.cloneNode(true), e);
+						n = n.previousSibling;
+					}
 
-	getCSSClasses : function(editor_id, doc) {
-		var output = new Array();
+					t.remove(e);
+				}
+			});
+		},
 
-		// Is cached, use that
-		if (typeof(tinyMCE.cssClasses) != "undefined")
-			return tinyMCE.cssClasses;
-
-		if (typeof(editor_id) == "undefined" && typeof(doc) == "undefined") {
-			var instance;
-
-			for (var instanceName in tinyMCE.instances) {
-				instance = tinyMCE.instances[instanceName];
-				if (!tinyMCE.isInstance(instance))
-					continue;
+		decode : function(s) {
+			var e, n, v;
 
-				break;
-			}
+			// Look for entities to decode
+			if (/&[^;]+;/.test(s)) {
+				// Decode the entities using a div element not super efficient but less code
+				e = this.doc.createElement("div");
+				e.innerHTML = s;
+				n = e.firstChild;
+				v = '';
 
-			doc = instance.getDoc();
-		}
+				if (n) {
+					do {
+						v += n.nodeValue;
+					} while (n.nextSibling);
+				}
 
-		if (typeof(doc) == "undefined") {
-			var instance = tinyMCE.getInstanceById(editor_id);
-			doc = instance.getDoc();
-		}
+				return v || s;
+			}
 
-		if (doc) {
-			var styles = doc.styleSheets;
+			return s;
+		},
 
-			if (styles && styles.length > 0) {
-				for (var x=0; x<styles.length; x++) {
-					var csses = null;
+		encode : function(s) {
+			return s ? ('' + s).replace(/[<>&\"]/g, function (c, b) {
+				switch (c) {
+					case '&':
+						return '&amp;';
 
-					// Just ignore any errors
-					eval("try {var csses = tinyMCE.isIE ? doc.styleSheets(" + x + ").rules : styles[" + x + "].cssRules;} catch(e) {}");
-					if (!csses)
-						return new Array();
+					case '"':
+						return '&quot;';
 
-					for (var i=0; i<csses.length; i++) {
-						var selectorText = csses[i].selectorText;
+					case '<':
+						return '&lt;';
 
-						// Can be multiple rules per selector
-						if (selectorText) {
-							var rules = selectorText.split(',');
-							for (var c=0; c<rules.length; c++) {
-								var rule = rules[c];
+					case '>':
+						return '&gt;';
+				}
 
-								// Strip spaces between selectors
-								while (rule.indexOf(' ') == 0)
-									rule = rule.substring(1);
+				return c;
+			}) : s;
+		},
 
-								// Invalid rule
-								if (rule.indexOf(' ') != -1 || rule.indexOf(':') != -1 || rule.indexOf('mceItem') != -1)
-									continue;
+		insertAfter : function(n, r) {
+			var t = this;
 
-								if (rule.indexOf(tinyMCE.settings['visual_table_class']) != -1 || rule.indexOf('mceEditable') != -1 || rule.indexOf('mceNonEditable') != -1)
-									continue;
+			r = t.get(r);
 
-								// Is class rule
-								if (rule.indexOf('.') != -1) {
-									var cssClass = rule.substring(rule.indexOf('.') + 1);
-									var addClass = true;
+			return this.run(n, function(n) {
+				var p, ns;
 
-									for (var p=0; p<output.length && addClass; p++) {
-										if (output[p] == cssClass)
-											addClass = false;
-									}
+				p = r.parentNode;
+				ns = r.nextSibling;
 
-									if (addClass)
-										output[output.length] = cssClass;
-								}
-							}
-						}
-					}
-				}
-			}
-		}
+				if (ns)
+					p.insertBefore(n, ns);
+				else
+					p.appendChild(n);
 
-		// Cache em
-		if (output.length > 0)
-			tinyMCE.cssClasses = output;
+				return n;
+			});
+		},
 
-		return output;
-	},
+		isBlock : function(n) {
+			if (n.nodeType && n.nodeType !== 1)
+				return false;
 
-	regexpReplace : function(in_str, reg_exp, replace_str, opts) {
-		if (in_str == null)
-			return in_str;
+			n = n.nodeName || n;
 
-		if (typeof(opts) == "undefined")
-			opts = 'g';
+			return /^(H[1-6]|HR|P|DIV|ADDRESS|PRE|FORM|TABLE|LI|OL|UL|TR|TD|CAPTION|BLOCKQUOTE|CENTER|DL|DT|DD|DIR|FIELDSET|NOSCRIPT|NOFRAMES|MENU|ISINDEX|SAMP)$/.test(n);
+		},
 
-		var re = new RegExp(reg_exp, opts);
-		return in_str.replace(re, replace_str);
-	},
+		replace : function(n, o, k) {
+			var t = this;
 
-	trim : function(s) {
-		return s.replace(/^\s*|\s*$/g, "");
-	},
+			if (is(o, 'array'))
+				n = n.cloneNode(true);
 
-	cleanupEventStr : function(s) {
-		s = "" + s;
-		s = s.replace('function anonymous()\n{\n', '');
-		s = s.replace('\n}', '');
-		s = s.replace(/^return true;/gi, ''); // Remove event blocker
+			return t.run(o, function(o) {
+				if (k) {
+					each(o.childNodes, function(c) {
+						n.appendChild(c.cloneNode(true));
+					});
+				}
 
-		return s;
-	},
+				// Fix IE psuedo leak for elements since replacing elements if fairly common
+				// Will break parentNode for some unknown reason
+				if (t.fixPsuedoLeaks && o.nodeType === 1) {
+					o.parentNode.insertBefore(n, o);
+					t.remove(o);
+					return n;
+				}
 
-	getControlHTML : function(c) {
-		var i, l, n, o, v;
+				return o.parentNode.replaceChild(n, o);
+			});
+		},
 
-		l = tinyMCE.plugins;
-		for (n in l) {
-			o = l[n];
+		findCommonAncestor : function(a, b) {
+			var ps = a, pe;
 
-			if (o.getControlHTML && (v = o.getControlHTML(c)) != '')
-				return tinyMCE.replaceVar(v, "pluginurl", o.baseURL);
-		}
+			while (ps) {
+				pe = b;
 
-		o = tinyMCE.themes[tinyMCE.settings['theme']];
-		if (o.getControlHTML && (v = o.getControlHTML(c)) != '')
-			return v;
+				while (pe && ps != pe)
+					pe = pe.parentNode;
 
-		return '';
-	},
+				if (ps == pe)
+					break;
 
-	evalFunc : function(f, idx, a, o) {
-		var s = '(', i;
+				ps = ps.parentNode;
+			}
 
-		for (i=idx; i<a.length; i++) {
-			s += 'a[' + i + ']';
+			if (!ps && a.ownerDocument)
+				return a.ownerDocument.documentElement;
 
-			if (i < a.length-1)
-				s += ',';
-		}
+			return ps;
+		},
 
-		s += ');';
+		toHex : function(s) {
+			var c = /^\s*rgb\s*?\(\s*?([0-9]+)\s*?,\s*?([0-9]+)\s*?,\s*?([0-9]+)\s*?\)\s*$/i.exec(s);
 
-		return o ? eval("o." + f + s) : eval("f" + s);
-	},
+			function hex(s) {
+				s = parseInt(s).toString(16);
 
-	dispatchCallback : function(i, p, n) {
-		return this.callFunc(i, p, n, 0, this.dispatchCallback.arguments);
-	},
+				return s.length > 1 ? s : '0' + s; // 0 -> 00
+			};
 
-	executeCallback : function(i, p, n) {
-		return this.callFunc(i, p, n, 1, this.executeCallback.arguments);
-	},
+			if (c) {
+				s = '#' + hex(c[1]) + hex(c[2]) + hex(c[3]);
 
-	execCommandCallback : function(i, p, n) {
-		return this.callFunc(i, p, n, 2, this.execCommandCallback.arguments);
-	},
+				return s;
+			}
 
-	callFunc : function(ins, p, n, m, a) {
-		var l, i, on, o, s, v;
+			return s;
+		},
 
-		s = m == 2;
+		getClasses : function() {
+			var t = this, cl = [], i, lo = {}, f = t.settings.class_filter, ov;
 
-		l = tinyMCE.getParam(p, '');
+			if (t.classes)
+				return t.classes;
 
-		if (l != '' && (v = tinyMCE.evalFunc(typeof(l) == "function" ? l : eval(l), 3, a)) == s && m > 0)
-			return true;
+			function addClasses(s) {
+				// IE style imports
+				each(s.imports, function(r) {
+					addClasses(r);
+				});
 
-		if (ins != null) {
-			for (i=0, l = ins.plugins; i<l.length; i++) {
-				o = tinyMCE.plugins[l[i]];
+				each(s.cssRules || s.rules, function(r) {
+					// Real type or fake it on IE
+					switch (r.type || 1) {
+						// Rule
+						case 1:
+							if (r.selectorText) {
+								each(r.selectorText.split(','), function(v) {
+									v = v.replace(/^\s*|\s*$|^\s\./g, "");
+
+									// Is internal or it doesn't contain a class
+									if (/\.mce/.test(v) || !/\.[\w\-]+$/.test(v))
+										return;
+
+									// Remove everything but class name
+									ov = v;
+									v = v.replace(/.*\.([a-z0-9_\-]+).*/i, '$1');
+
+									// Filter classes
+									if (f && !(v = f(v, ov)))
+										return;
+
+									if (!lo[v]) {
+										cl.push({'class' : v});
+										lo[v] = 1;
+									}
+								});
+							}
+							break;
 
-				if (o[n] && (v = tinyMCE.evalFunc(n, 3, a, o)) == s && m > 0)
-					return true;
+						// Import
+						case 3:
+							addClasses(r.styleSheet);
+							break;
+					}
+				});
+			};
+
+			try {
+				each(t.doc.styleSheets, addClasses);
+			} catch (ex) {
+				// Ignore
 			}
-		}
 
-		l = tinyMCE.themes;
-		for (on in l) {
-			o = l[on];
+			if (cl.length > 0)
+				t.classes = cl;
 
-			if (o[n] && (v = tinyMCE.evalFunc(n, 3, a, o)) == s && m > 0)
-				return true;
-		}
+			return cl;
+		},
 
-		return false;
-	},
+		run : function(e, f, s) {
+			var t = this, o;
 
-	xmlEncode : function(s) {
-		return s ? ('' + s).replace(new RegExp('[<>&"\']', 'g'), function (c, b) {
-			switch (c) {
-				case '&':
-					return '&amp;';
+			if (t.doc && typeof(e) === 'string')
+				e = t.get(e);
 
-				case '"':
-					return '&quot;';
+			if (!e)
+				return false;
 
-				case '\'':
-					return '&#39;'; // &apos; is not working in MSIE
+			s = s || this;
+			if (!e.nodeType && (e.length || e.length === 0)) {
+				o = [];
+
+				each(e, function(e, i) {
+					if (e) {
+						if (typeof(e) == 'string')
+							e = t.doc.getElementById(e);
 
-				case '<':
-					return '&lt;';
+						o.push(f.call(s, e, i));
+					}
+				});
 
-				case '>':
-					return '&gt;';
+				return o;
 			}
 
-			return c;
-		}) : s;
-	},
+			return f.call(s, e);
+		},
 
-	extend : function(p, np) {
-		var o = {};
+		getAttribs : function(n) {
+			var o;
 
-		o.parent = p;
+			n = this.get(n);
 
-		for (n in p)
-			o[n] = p[n];
+			if (!n)
+				return [];
 
-		for (n in np)
-			o[n] = np[n];
+			if (isIE) {
+				o = [];
 
-		return o;
-	},
+				// Object will throw exception in IE
+				if (n.nodeName == 'OBJECT')
+					return n.attributes;
 
-	hideMenus : function() {
-		var e = tinyMCE.lastSelectedMenuBtn;
+				// It's crazy that this is faster in IE but it's because it returns all attributes all the time
+				n.cloneNode(false).outerHTML.replace(/([a-z0-9\:\-_]+)=/gi, function(a, b) {
+					o.push({specified : 1, nodeName : b});
+				});
 
-		if (tinyMCE.lastMenu) {
-			tinyMCE.lastMenu.hide();
-			tinyMCE.lastMenu = null;
-		}
+				return o;
+			}
 
-		if (e) {
-			tinyMCE.switchClass(e, tinyMCE.lastMenuBtnClass);
-			tinyMCE.lastSelectedMenuBtn = null;
-		}
-	}
+			return n.attributes;
+		},
 
-	};
+		destroy : function(s) {
+			var t = this;
 
-// Global instances
-var TinyMCE = TinyMCE_Engine; // Compatiblity with gzip compressors
-var tinyMCE = new TinyMCE_Engine();
-var tinyMCELang = {};
-
-/* file:jscripts/tiny_mce/classes/TinyMCE_Control.class.js */
-
-function TinyMCE_Control(settings) {
-	var t, i, to, fu, p, x, fn, fu, pn, s = settings;
-
-	this.undoRedoLevel = true;
-	this.isTinyMCE_Control = true;
-
-	// Default settings
-	this.settings = s;
-	this.settings['theme'] = tinyMCE.getParam("theme", "default");
-	this.settings['width'] = tinyMCE.getParam("width", -1);
-	this.settings['height'] = tinyMCE.getParam("height", -1);
-	this.selection = new TinyMCE_Selection(this);
-	this.undoRedo = new TinyMCE_UndoRedo(this);
-	this.cleanup = new TinyMCE_Cleanup();
-	this.shortcuts = new Array();
-	this.hasMouseMoved = false;
-	this.foreColor = this.backColor = "#999999";
-	this.data = {};
-
-	this.cleanup.init({
-		valid_elements : s.valid_elements,
-		extended_valid_elements : s.extended_valid_elements,
-		valid_child_elements : s.valid_child_elements,
-		entities : s.entities,
-		entity_encoding : s.entity_encoding,
-		debug : s.cleanup_debug,
-		url_converter : 'TinyMCE_Cleanup.prototype._urlConverter',
-		indent : s.apply_source_formatting,
-		invalid_elements : s.invalid_elements,
-		verify_html : s.verify_html,
-		fix_content_duplication : s.fix_content_duplication
-	});
+			if (t.events)
+				t.events.destroy();
 
-	// Wrap old theme
-	t = this.settings['theme'];
-	if (!tinyMCE.hasTheme(t)) {
-		fn = tinyMCE.callbacks;
-		to = {};
-
-		for (i=0; i<fn.length; i++) {
-			if ((fu = window['TinyMCE_' + t + "_" + fn[i]]))
-				to[fn[i]] = fu;
-		}
+			t.win = t.doc = t.root = t.events = null;
 
-		tinyMCE.addTheme(t, to);
-	}
+			// Manual destroy then remove unload handler
+			if (!s)
+				tinymce.removeUnload(t.destroy);
+		},
 
-	// Wrap old plugins
-	this.plugins = new Array();
-	p = tinyMCE.getParam('plugins', '', true, ',');
-	if (p.length > 0) {
-		for (i=0; i<p.length; i++) {
-			pn = p[i];
+		createRng : function() {
+			var d = this.doc;
 
-			if (pn.charAt(0) == '-')
-				pn = pn.substring(1);
+			return d.createRange ? d.createRange() : new tinymce.dom.Range(this);
+		},
 
-			if (!tinyMCE.hasPlugin(pn)) {
-				fn = tinyMCE.callbacks;
-				to = {};
+		split : function(pe, e, re) {
+			var t = this, r = t.createRng(), bef, aft, pa;
+
+			// W3C valid browsers tend to leave empty nodes to the left/right side of the contents, this makes sence
+			// but we don't want that in our code since it serves no purpose
+			// For example if this is chopped:
+			//   <p>text 1<span><b>CHOP</b></span>text 2</p>
+			// would produce:
+			//   <p>text 1<span></span></p><b>CHOP</b><p><span></span>text 2</p>
+			// this function will then trim of empty edges and produce:
+			//   <p>text 1</p><b>CHOP</b><p>text 2</p>
+			function trimEdge(n, na) {
+				n = n[na];
 
-				for (x=0; x<fn.length; x++) {
-					if ((fu = window['TinyMCE_' + pn + "_" + fn[x]]))
-						to[fn[x]] = fu;
-				}
+				if (n && n[na] && n[na].nodeType == 1 && isEmpty(n[na]))
+					t.remove(n[na]);
+			};
 
-				tinyMCE.addPlugin(pn, to);
-			}
+			function isEmpty(n) {
+				n = t.getOuterHTML(n);
+				n = n.replace(/<(img|hr|table)/gi, '-'); // Keep these convert them to - chars
+				n = n.replace(/<[^>]+>/g, ''); // Remove all tags
 
-			this.plugins[this.plugins.length] = pn; 
-		}
-	}
-};
+				return n.replace(/[ \t\r\n]+|&nbsp;|&#160;/g, '') == '';
+			};
 
-TinyMCE_Control.prototype = {
-	selection : null,
+			if (pe && e) {
+				// Get before chunk
+				r.setStartBefore(pe);
+				r.setEndBefore(e);
+				bef = r.extractContents();
+
+				// Get after chunk
+				r = t.createRng();
+				r.setStartAfter(e);
+				r.setEndAfter(pe);
+				aft = r.extractContents();
+
+				// Insert chunks and remove parent
+				pa = pe.parentNode;
 
-	settings : null,
+				// Remove right side edge of the before contents
+				trimEdge(bef, 'lastChild');
 
-	cleanup : null,
+				if (!isEmpty(bef))
+					pa.insertBefore(bef, pe);
 
-	getData : function(na) {
-		var o = this.data[na];
+				if (re)
+					pa.replaceChild(re, e);
+				else
+					pa.insertBefore(e, pe);
 
-		if (!o)
-			o = this.data[na] = {};
+				// Remove left site edge of the after contents
+				trimEdge(aft, 'firstChild');
 
-		return o;
-	},
+				if (!isEmpty(aft))
+					pa.insertBefore(aft, pe);
 
-	hasPlugin : function(n) {
-		var i;
+				t.remove(pe);
 
-		for (i=0; i<this.plugins.length; i++) {
-			if (this.plugins[i] == n)
-				return true;
-		}
+				return re || e;
+			}
+		},
 
-		return false;
-	},
+		bind : function(target, name, func, scope) {
+			var t = this;
 
-	addPlugin : function(n, p) {
-		if (!this.hasPlugin(n)) {
-			tinyMCE.addPlugin(n, p);
-			this.plugins[this.plugins.length] = n;
-		}
-	},
+			if (!t.events)
+				t.events = new tinymce.dom.EventUtils();
 
-	repaint : function() {
-		var s, b, ex;
+			return t.events.add(target, name, func, scope || this);
+		},
 
-		if (tinyMCE.isRealIE)
-			return;
+		unbind : function(target, name, func) {
+			var t = this;
 
-		try {
-			s = this.selection;
-			b = s.getBookmark(true);
-			this.getBody().style.display = 'none';
-			this.getDoc().execCommand('selectall', false, null);
-			this.getSel().collapseToStart();
-			this.getBody().style.display = 'block';
-			s.moveToBookmark(b);
-		} catch (ex) {
-			// Ignore
-		}
-	},
+			if (!t.events)
+				t.events = new tinymce.dom.EventUtils();
+
+			return t.events.remove(target, name, func);
+		},
 
-	switchSettings : function() {
-		if (tinyMCE.configs.length > 1 && tinyMCE.currentConfig != this.settings['index']) {
-			tinyMCE.settings = this.settings;
-			tinyMCE.currentConfig = this.settings['index'];
+
+		_isRes : function(c) {
+			// Is live resizble element
+			return /^(top|left|bottom|right|width|height)/i.test(c) || /;\s*(top|left|bottom|right|width|height)/i.test(c);
 		}
-	},
 
-	select : function() {
-		var oldInst = tinyMCE.selectedInstance;
+		/*
+		walk : function(n, f, s) {
+			var d = this.doc, w;
 
-		if (oldInst != this) {
-			if (oldInst)
-				oldInst.execCommand('mceEndTyping');
+			if (d.createTreeWalker) {
+				w = d.createTreeWalker(n, NodeFilter.SHOW_TEXT, null, false);
 
-			tinyMCE.dispatchCallback(this, 'select_instance_callback', 'selectInstance', this, oldInst);
-			tinyMCE.selectedInstance = this;
+				while ((n = w.nextNode()) != null)
+					f.call(s || this, n);
+			} else
+				tinymce.walk(n, f, 'childNodes', s);
 		}
-	},
+		*/
 
-	getBody : function() {
-		return this.contentBody ? this.contentBody : this.getDoc().body;
-	},
+		/*
+		toRGB : function(s) {
+			var c = /^\s*?#([0-9A-F]{2})([0-9A-F]{1,2})([0-9A-F]{2})?\s*?$/.exec(s);
 
-	getDoc : function() {
-//		return this.contentDocument ? this.contentDocument : this.contentWindow.document; // Removed due to IE 5.5 ?
-		return this.contentWindow.document;
-	},
+			if (c) {
+				// #FFF -> #FFFFFF
+				if (!is(c[3]))
+					c[3] = c[2] = c[1];
 
-	getWin : function() {
-		return this.contentWindow;
-	},
+				return "rgb(" + parseInt(c[1], 16) + "," + parseInt(c[2], 16) + "," + parseInt(c[3], 16) + ")";
+			}
 
-	getContainerWin : function() {
-		return this.containerWindow ? this.containerWindow : window;
-	},
+			return s;
+		}
+		*/
 
-	getViewPort : function() {
-		return tinyMCE.getViewPort(this.getWin());
-	},
+		});
 
-	getParentNode : function(n, f) {
-		return tinyMCE.getParentNode(n, f, this.getBody());
-	},
+	// Setup page DOM
+	tinymce.DOM = new tinymce.dom.DOMUtils(document, {process_html : 0});
+})(tinymce);
+(function(ns) {
+	// Traverse constants
+	var EXTRACT = 0, CLONE = 1, DELETE = 2, extend = tinymce.extend;
+
+	function indexOf(child, parent) {
+		var i, node;
 
-	getParentElement : function(n, na, f) {
-		return tinyMCE.getParentElement(n, na, f, this.getBody());
-	},
+		if (child.parentNode != parent)
+			return -1;
 
-	getParentBlockElement : function(n) {
-		return tinyMCE.getParentBlockElement(n, this.getBody());
-	},
+		for (node = parent.firstChild, i = 0; node != child; node = node.nextSibling)
+			i++;
 
-	resizeToContent : function() {
-		var d = this.getDoc(), b = d.body, de = d.documentElement;
+		return i;
+	};
 
-		this.iframeElement.style.height = (tinyMCE.isRealIE) ? b.scrollHeight : de.offsetHeight + 'px';
-	},
+	function nodeIndex(n) {
+		var i = 0;
 
-	addShortcut : function(m, k, d, cmd, ui, va) {
-		var n = typeof(k) == "number", ie = tinyMCE.isIE, c, sc, i, scl = this.shortcuts;
+		while (n.previousSibling) {
+			i++;
+			n = n.previousSibling;
+		}
 
-		if (!tinyMCE.getParam('custom_shortcuts'))
-			return false;
+		return i;
+	};
 
-		m = m.toLowerCase();
-		k = ie && !n ? k.toUpperCase() : k;
-		c = n ? null : k.charCodeAt(0);
-		d = d && d.indexOf('lang_') == 0 ? tinyMCE.getLang(d) : d;
-
-		sc = {
-			alt : m.indexOf('alt') != -1,
-			ctrl : m.indexOf('ctrl') != -1,
-			shift : m.indexOf('shift') != -1,
-			charCode : c,
-			keyCode : n ? k : (ie ? c : null),
-			desc : d,
-			cmd : cmd,
-			ui : ui,
-			val : va
-		};
+	function getSelectedNode(container, offset) {
+		var child;
 
-		for (i=0; i<scl.length; i++) {
-			if (sc.alt == scl[i].alt && sc.ctrl == scl[i].ctrl && sc.shift == scl[i].shift
-				&& sc.charCode == scl[i].charCode && sc.keyCode == scl[i].keyCode) {
-				return false;
-			}
+		if (container.nodeType == 3 /* TEXT_NODE */)
+			return container;
+
+		if (offset < 0)
+			return container;
+
+		child = container.firstChild;
+		while (child != null && offset > 0) {
+			--offset;
+			child = child.nextSibling;
 		}
 
-		scl[scl.length] = sc;
+		if (child != null)
+			return child;
 
-		return true;
-	},
+		return container;
+	};
+
+	// Range constructor
+	function Range(dom) {
+		var d = dom.doc;
+
+		extend(this, {
+			dom : dom,
+
+			// Inital states
+			startContainer : d,
+			startOffset : 0,
+			endContainer : d,
+			endOffset : 0,
+			collapsed : true,
+			commonAncestorContainer : d,
+
+			// Range constants
+			START_TO_START : 0,
+			START_TO_END : 1,
+			END_TO_END : 2,
+			END_TO_START : 3
+		});
+	};
 
-	handleShortcut : function(e) {
-		var i, s = this.shortcuts, o;
+	// Add range methods
+	extend(Range.prototype, {
+		setStart : function(n, o) {
+			this._setEndPoint(true, n, o);
+		},
+
+		setEnd : function(n, o) {
+			this._setEndPoint(false, n, o);
+		},
+
+		setStartBefore : function(n) {
+			this.setStart(n.parentNode, nodeIndex(n));
+		},
+
+		setStartAfter : function(n) {
+			this.setStart(n.parentNode, nodeIndex(n) + 1);
+		},
+
+		setEndBefore : function(n) {
+			this.setEnd(n.parentNode, nodeIndex(n));
+		},
+
+		setEndAfter : function(n) {
+			this.setEnd(n.parentNode, nodeIndex(n) + 1);
+		},
+
+		collapse : function(ts) {
+			var t = this;
+
+			if (ts) {
+				t.endContainer = t.startContainer;
+				t.endOffset = t.startOffset;
+			} else {
+				t.startContainer = t.endContainer;
+				t.startOffset = t.endOffset;
+			}
 
-		for (i=0; i<s.length; i++) {
-			o = s[i];
+			t.collapsed = true;
+		},
 
-			if (o.alt == e.altKey && o.ctrl == e.ctrlKey && (o.keyCode == e.keyCode || o.charCode == e.charCode)) {
-				if (o.cmd && (e.type == "keydown" || (e.type == "keypress" && !tinyMCE.isOpera)))
-					tinyMCE.execCommand(o.cmd, o.ui, o.val);
+		selectNode : function(n) {
+			this.setStartBefore(n);
+			this.setEndAfter(n);
+		},
+
+		selectNodeContents : function(n) {
+			this.setStart(n, 0);
+			this.setEnd(n, n.nodeType === 1 ? n.childNodes.length : n.nodeValue.length);
+		},
+
+		compareBoundaryPoints : function(h, r) {
+			var t = this, sc = t.startContainer, so = t.startOffset, ec = t.endContainer, eo = t.endOffset;
+
+			// Check START_TO_START
+			if (h === 0)
+				return t._compareBoundaryPoints(sc, so, sc, so);
+
+			// Check START_TO_END
+			if (h === 1)
+				return t._compareBoundaryPoints(sc, so, ec, eo);
+
+			// Check END_TO_END
+			if (h === 2)
+				return t._compareBoundaryPoints(ec, eo, ec, eo);
+
+			// Check END_TO_START
+			if (h === 3)
+				return t._compareBoundaryPoints(ec, eo, sc, so);
+		},
+
+		deleteContents : function() {
+			this._traverse(DELETE);
+		},
+
+		extractContents : function() {
+			return this._traverse(EXTRACT);
+		},
+
+		cloneContents : function() {
+			return this._traverse(CLONE);
+		},
+
+		insertNode : function(n) {
+			var t = this, nn, o;
+
+			// Node is TEXT_NODE or CDATA
+			if (n.nodeType === 3 || n.nodeType === 4) {
+				nn = t.startContainer.splitText(t.startOffset);
+				t.startContainer.parentNode.insertBefore(n, nn);
+			} else {
+				// Insert element node
+				if (t.startContainer.childNodes.length > 0)
+					o = t.startContainer.childNodes[t.startOffset];
+
+				t.startContainer.insertBefore(n, o);
+			}
+		},
+
+		surroundContents : function(n) {
+			var t = this, f = t.extractContents();
+
+			t.insertNode(n);
+			n.appendChild(f);
+			t.selectNode(n);
+		},
+
+		cloneRange : function() {
+			var t = this;
+
+			return extend(new Range(t.dom), {
+				startContainer : t.startContainer,
+				startOffset : t.startOffset,
+				endContainer : t.endContainer,
+				endOffset : t.endOffset,
+				collapsed : t.collapsed,
+				commonAncestorContainer : t.commonAncestorContainer
+			});
+		},
 
-				tinyMCE.cancelEvent(e);
-				return true;
+/*
+		detach : function() {
+			// Not implemented
+		},
+*/
+		// Internal methods
+
+		_isCollapsed : function() {
+			return (this.startContainer == this.endContainer && this.startOffset == this.endOffset);
+		},
+
+		_compareBoundaryPoints : function (containerA, offsetA, containerB, offsetB) {
+			var c, offsetC, n, cmnRoot, childA, childB;
+
+			// In the first case the boundary-points have the same container. A is before B 
+			// if its offset is less than the offset of B, A is equal to B if its offset is 
+			// equal to the offset of B, and A is after B if its offset is greater than the 
+			// offset of B.
+			if (containerA == containerB) {
+				if (offsetA == offsetB) {
+					return 0; // equal
+				} else if (offsetA < offsetB) {
+					return -1; // before
+				} else {
+					return 1; // after
+				}
 			}
-		}
 
-		return false;
-	},
+			// In the second case a child node C of the container of A is an ancestor 
+			// container of B. In this case, A is before B if the offset of A is less than or 
+			// equal to the index of the child node C and A is after B otherwise.
+			c = containerB;
+			while (c && c.parentNode != containerA) {
+				c = c.parentNode;
+			}
+			if (c) {
+				offsetC = 0;
+				n = containerA.firstChild;
 
-	autoResetDesignMode : function() {
-		// Add fix for tab/style.display none/block problems in Gecko
-		if (!tinyMCE.isIE && this.isHidden() && tinyMCE.getParam('auto_reset_designmode'))
-			eval('try { this.getDoc().designMode = "On"; this.useCSS = false; } catch(e) {}');
-	},
+				while (n != c && offsetC < offsetA) {
+					offsetC++;
+					n = n.nextSibling;
+				}
 
-	isHidden : function() {
-		var s;
+				if (offsetA <= offsetC) {
+					return -1; // before
+				} else {
+					return 1; // after
+				}
+			}
 
-		if (tinyMCE.isIE)
-			return false;
+			// In the third case a child node C of the container of B is an ancestor container 
+			// of A. In this case, A is before B if the index of the child node C is less than 
+			// the offset of B and A is after B otherwise.
+			c = containerA;
+			while (c && c.parentNode != containerB) {
+				c = c.parentNode;
+			}
 
-		s = this.getSel();
+			if (c) {
+				offsetC = 0;
+				n = containerB.firstChild;
 
-		// Weird, wheres that cursor selection?
-		return (!s || !s.rangeCount || s.rangeCount == 0);
-	},
+				while (n != c && offsetC < offsetB) {
+					offsetC++;
+					n = n.nextSibling;
+				}
 
-	isDirty : function() {
-		// Is content modified and not in a submit procedure
-		return tinyMCE.trim(this.startContent) != tinyMCE.trim(this.getBody().innerHTML) && !tinyMCE.isNotDirty;
-	},
+				if (offsetC < offsetB) {
+					return -1; // before
+				} else {
+					return 1; // after
+				}
+			}
 
-	_mergeElements : function(scmd, pa, ch, override) {
-		if (scmd == "removeformat") {
-			pa.className = "";
-			pa.style.cssText = "";
-			ch.className = "";
-			ch.style.cssText = "";
-			return;
-		}
+			// In the fourth case, none of three other cases hold: the containers of A and B 
+			// are siblings or descendants of sibling nodes. In this case, A is before B if 
+			// the container of A is before the container of B in a pre-order traversal of the
+			// Ranges' context tree and A is after B otherwise.
+			cmnRoot = this.dom.findCommonAncestor(containerA, containerB);
+			childA = containerA;
 
-		var st = tinyMCE.parseStyle(tinyMCE.getAttrib(pa, "style"));
-		var stc = tinyMCE.parseStyle(tinyMCE.getAttrib(ch, "style"));
-		var className = tinyMCE.getAttrib(pa, "class");
-
-		// Removed class adding due to bug #1478272
-		className = tinyMCE.getAttrib(ch, "class");
-
-		if (override) {
-			for (var n in st) {
-				if (typeof(st[n]) == 'function')
-					continue;
+			while (childA && childA.parentNode != cmnRoot) {
+				childA = childA.parentNode;  
+			}
 
-				stc[n] = st[n];
+			if (!childA) {
+				childA = cmnRoot;
 			}
-		} else {
-			for (var n in stc) {
-				if (typeof(stc[n]) == 'function')
-					continue;
 
-				st[n] = stc[n];
+			childB = containerB;
+			while (childB && childB.parentNode != cmnRoot) {
+				childB = childB.parentNode;
 			}
-		}
 
-		tinyMCE.setAttrib(pa, "style", tinyMCE.serializeStyle(st));
-		tinyMCE.setAttrib(pa, "class", tinyMCE.trim(className));
-		ch.className = "";
-		ch.style.cssText = "";
-		ch.removeAttribute("class");
-		ch.removeAttribute("style");
-	},
+			if (!childB) {
+				childB = cmnRoot;
+			}
 
-	_setUseCSS : function(b) {
-		var d = this.getDoc();
+			if (childA == childB) {
+				return 0; // equal
+			}
 
-		try {d.execCommand("useCSS", false, !b);} catch (ex) {}
-		try {d.execCommand("styleWithCSS", false, b);} catch (ex) {}
+			n = cmnRoot.firstChild;
+			while (n) {
+				if (n == childA) {
+					return -1; // before
+				}
 
-		if (!tinyMCE.getParam("table_inline_editing"))
-			try {d.execCommand('enableInlineTableEditing', false, "false");} catch (ex) {}
+				if (n == childB) {
+					return 1; // after
+				}
 
-		if (!tinyMCE.getParam("object_resizing"))
-			try {d.execCommand('enableObjectResizing', false, "false");} catch (ex) {}
-	},
+				n = n.nextSibling;
+			}
+		},
 
-	execCommand : function(command, user_interface, value) {
-		var doc = this.getDoc(), win = this.getWin(), focusElm = this.getFocusElement();
+		_setEndPoint : function(st, n, o) {
+			var t = this, ec, sc;
 
-		// Is not a undo specific command
-		if (!new RegExp('mceStartTyping|mceEndTyping|mceBeginUndoLevel|mceEndUndoLevel|mceAddUndoLevel', 'gi').test(command))
-			this.undoBookmark = null;
+			if (st) {
+				t.startContainer = n;
+				t.startOffset = o;
+			} else {
+				t.endContainer = n;
+				t.endOffset = o;
+			}
 
-		// Mozilla issue
-		if (!tinyMCE.isIE && !this.useCSS) {
-			this._setUseCSS(false);
-			this.useCSS = true;
-		}
+			// If one boundary-point of a Range is set to have a root container 
+			// other than the current one for the Range, the Range is collapsed to 
+			// the new position. This enforces the restriction that both boundary-
+			// points of a Range must have the same root container.
+			ec = t.endContainer;
+			while (ec.parentNode)
+				ec = ec.parentNode;
+
+			sc = t.startContainer;
+			while (sc.parentNode)
+				sc = sc.parentNode;
 
-		//debug("command: " + command + ", user_interface: " + user_interface + ", value: " + value);
-		this.contentDocument = doc; // <-- Strange, unless this is applied Mozilla 1.3 breaks
+			if (sc != ec) {
+				t.collapse(st);
+			} else {
+				// The start position of a Range is guaranteed to never be after the 
+				// end position. To enforce this restriction, if the start is set to 
+				// be at a position after the end, the Range is collapsed to that 
+				// position.
+				if (t._compareBoundaryPoints(t.startContainer, t.startOffset, t.endContainer, t.endOffset) > 0)
+					t.collapse(st);
+			}
 
-		if (tinyMCE.execCommandCallback(this, 'execcommand_callback', 'execCommand', this.editorId, this.getBody(), command, user_interface, value))
-			return;
+			t.collapsed = t._isCollapsed();
+			t.commonAncestorContainer = t.dom.findCommonAncestor(t.startContainer, t.endContainer);
+		},
 
-		// Fix align on images
-		if (focusElm && focusElm.nodeName == "IMG") {
-			var align = focusElm.getAttribute('align');
-			var img = command == "JustifyCenter" ? focusElm.cloneNode(false) : focusElm;
-
-			switch (command) {
-				case "JustifyLeft":
-					if (align == 'left')
-						img.removeAttribute('align');
-					else
-						img.setAttribute('align', 'left');
+		// This code is heavily "inspired" by the Apache Xerces implementation. I hope they don't mind. :)
 
-					// Remove the div
-					var div = focusElm.parentNode;
-					if (div && div.nodeName == "DIV" && div.childNodes.length == 1 && div.parentNode)
-						div.parentNode.replaceChild(img, div);
-
-					this.selection.selectNode(img);
-					this.repaint();
-					tinyMCE.triggerNodeChange();
-					return;
+		_traverse : function(how) {
+			var t = this, c, endContainerDepth = 0, startContainerDepth = 0, p, depthDiff, startNode, endNode, sp, ep;
 
-				case "JustifyCenter":
-					img.removeAttribute('align');
+			if (t.startContainer == t.endContainer)
+				return t._traverseSameContainer(how);
 
-					// Is centered
-					var div = tinyMCE.getParentElement(focusElm, "div");
-					if (div && div.style.textAlign == "center") {
-						// Remove div
-						if (div.nodeName == "DIV" && div.childNodes.length == 1 && div.parentNode)
-							div.parentNode.replaceChild(img, div);
-					} else {
-						// Add div
-						var div = this.getDoc().createElement("div");
-						div.style.textAlign = 'center';
-						div.appendChild(img);
-						focusElm.parentNode.replaceChild(div, focusElm);
-					}
+			for (c = t.endContainer, p = c.parentNode; p != null; c = p, p = p.parentNode) {
+				if (p == t.startContainer)
+					return t._traverseCommonStartContainer(c, how);
 
-					this.selection.selectNode(img);
-					this.repaint();
-					tinyMCE.triggerNodeChange();
-					return;
+				++endContainerDepth;
+			}
 
-				case "JustifyRight":
-					if (align == 'right')
-						img.removeAttribute('align');
-					else
-						img.setAttribute('align', 'right');
+			for (c = t.startContainer, p = c.parentNode; p != null; c = p, p = p.parentNode) {
+				if (p == t.endContainer)
+					return t._traverseCommonEndContainer(c, how);
 
-					// Remove the div
-					var div = focusElm.parentNode;
-					if (div && div.nodeName == "DIV" && div.childNodes.length == 1 && div.parentNode)
-						div.parentNode.replaceChild(img, div);
-
-					this.selection.selectNode(img);
-					this.repaint();
-					tinyMCE.triggerNodeChange();
-					return;
+				++startContainerDepth;
 			}
-		}
 
-		if (tinyMCE.settings['force_br_newlines']) {
-			var alignValue = "";
+			depthDiff = startContainerDepth - endContainerDepth;
 
-			if (doc.selection.type != "Control") {
-				switch (command) {
-						case "JustifyLeft":
-							alignValue = "left";
-							break;
+			startNode = t.startContainer;
+			while (depthDiff > 0) {
+				startNode = startNode.parentNode;
+				depthDiff--;
+			}
 
-						case "JustifyCenter":
-							alignValue = "center";
-							break;
+			endNode = t.endContainer;
+			while (depthDiff < 0) {
+				endNode = endNode.parentNode;
+				depthDiff++;
+			}
 
-						case "JustifyFull":
-							alignValue = "justify";
-							break;
+			// ascend the ancestor hierarchy until we have a common parent.
+			for (sp = startNode.parentNode, ep = endNode.parentNode; sp != ep; sp = sp.parentNode, ep = ep.parentNode) {
+				startNode = sp;
+				endNode = ep;
+			}
 
-						case "JustifyRight":
-							alignValue = "right";
-							break;
-				}
+			return t._traverseCommonAncestors(startNode, endNode, how);
+		},
 
-				if (alignValue != "") {
-					var rng = doc.selection.createRange();
+		_traverseSameContainer : function(how) {
+			var t = this, frag, s, sub, n, cnt, sibling, xferNode;
 
-					if ((divElm = tinyMCE.getParentElement(rng.parentElement(), "div")) != null)
-						divElm.setAttribute("align", alignValue);
-					else if (rng.pasteHTML && rng.htmlText.length > 0)
-						rng.pasteHTML('<div align="' + alignValue + '">' + rng.htmlText + "</div>");
+			if (how != DELETE)
+				frag = t.dom.doc.createDocumentFragment();
 
-					tinyMCE.triggerNodeChange();
-					return;
-				}
-			}
-		}
+			// If selection is empty, just return the fragment
+			if (t.startOffset == t.endOffset)
+				return frag;
 
-		switch (command) {
-			case "mceRepaint":
-				this.repaint();
-				return true;
+			// Text node needs special case handling
+			if (t.startContainer.nodeType == 3 /* TEXT_NODE */) {
+				// get the substring
+				s = t.startContainer.nodeValue;
+				sub = s.substring(t.startOffset, t.endOffset);
 
-			case "unlink":
-				// Unlink if caret is inside link
-				if (tinyMCE.isGecko && this.getSel().isCollapsed) {
-					focusElm = tinyMCE.getParentElement(focusElm, 'A');
+				// set the original text node to its new value
+				if (how != CLONE) {
+					t.startContainer.deleteData(t.startOffset, t.endOffset - t.startOffset);
 
-					if (focusElm)
-						this.selection.selectNode(focusElm, false);
+					// Nothing is partially selected, so collapse to start point
+					t.collapse(true);
 				}
 
-				this.getDoc().execCommand(command, user_interface, value);
+				if (how == DELETE)
+					return null;
 
-				tinyMCE.isGecko && this.getSel().collapseToEnd();
+				frag.appendChild(t.dom.doc.createTextNode(sub));
+				return frag;
+			}
 
-				tinyMCE.triggerNodeChange();
+			// Copy nodes between the start/end offsets.
+			n = getSelectedNode(t.startContainer, t.startOffset);
+			cnt = t.endOffset - t.startOffset;
 
-				return true;
+			while (cnt > 0) {
+				sibling = n.nextSibling;
+				xferNode = t._traverseFullySelected(n, how);
 
-			case "FormatBlock":
-				if (!this.cleanup.isValid(value))
-					return true;
+				if (frag)
+					frag.appendChild( xferNode );
 
-				this.getDoc().execCommand(command, user_interface, value);
-				tinyMCE.triggerNodeChange();
-				break;
+				--cnt;
+				n = sibling;
+			}
 
-			case "InsertUnorderedList":
-			case "InsertOrderedList":
-				this.getDoc().execCommand(command, user_interface, value);
-				tinyMCE.triggerNodeChange();
-				break;
+			// Nothing is partially selected, so collapse to start point
+			if (how != CLONE)
+				t.collapse(true);
 
-			case "Strikethrough":
-				this.getDoc().execCommand(command, user_interface, value);
-				tinyMCE.triggerNodeChange();
-				break;
+			return frag;
+		},
 
-			case "mceSelectNode":
-				this.selection.selectNode(value);
-				tinyMCE.triggerNodeChange();
-				tinyMCE.selectedNode = value;
-				break;
+		_traverseCommonStartContainer : function(endAncestor, how) {
+			var t = this, frag, n, endIdx, cnt, sibling, xferNode;
 
-			case "FormatBlock":
-				if (value == null || value == "") {
-					var elm = tinyMCE.getParentElement(this.getFocusElement(), "p,div,h1,h2,h3,h4,h5,h6,pre,address,blockquote,dt,dl,dd,samp");
+			if (how != DELETE)
+				frag = t.dom.doc.createDocumentFragment();
 
-					if (elm)
-						this.execCommand("mceRemoveNode", false, elm);
-				} else {
-					if (tinyMCE.isGecko && new RegExp('<(div|blockquote|code|dt|dd|dl|samp)>', 'gi').test(value))
-						value = value.replace(/[^a-z]/gi, '');
+			n = t._traverseRightBoundary(endAncestor, how);
 
-					if (tinyMCE.isIE && new RegExp('blockquote|code|samp', 'gi').test(value)) {
-						var b = this.selection.getBookmark();
-						this.getDoc().execCommand("FormatBlock", false, '<p>');
-						tinyMCE.renameElement(tinyMCE.getParentBlockElement(this.getFocusElement()), value);
-						this.selection.moveToBookmark(b);
-					} else
-						this.getDoc().execCommand("FormatBlock", false, value);
-				}
+			if (frag)
+				frag.appendChild(n);
 
-				tinyMCE.triggerNodeChange();
+			endIdx = indexOf(endAncestor, t.startContainer);
+			cnt = endIdx - t.startOffset;
 
-				break;
+			if (cnt <= 0) {
+				// Collapse to just before the endAncestor, which 
+				// is partially selected.
+				if (how != CLONE) {
+					t.setEndBefore(endAncestor);
+					t.collapse(false);
+				}
 
-			case "mceRemoveNode":
-				if (!value)
-					value = tinyMCE.getParentElement(this.getFocusElement());
+				return frag;
+			}
 
-				if (tinyMCE.isIE) {
-					value.outerHTML = value.innerHTML;
-				} else {
-					var rng = value.ownerDocument.createRange();
-					rng.setStartBefore(value);
-					rng.setEndAfter(value);
-					rng.deleteContents();
-					rng.insertNode(rng.createContextualFragment(value.innerHTML));
-				}
+			n = endAncestor.previousSibling;
+			while (cnt > 0) {
+				sibling = n.previousSibling;
+				xferNode = t._traverseFullySelected(n, how);
 
-				tinyMCE.triggerNodeChange();
+				if (frag)
+					frag.insertBefore(xferNode, frag.firstChild);
 
-				break;
+				--cnt;
+				n = sibling;
+			}
 
-			case "mceSelectNodeDepth":
-				var parentNode = this.getFocusElement();
-				for (var i=0; parentNode; i++) {
-					if (parentNode.nodeName.toLowerCase() == "body")
-						break;
+			// Collapse to just before the endAncestor, which 
+			// is partially selected.
+			if (how != CLONE) {
+				t.setEndBefore(endAncestor);
+				t.collapse(false);
+			}
 
-					if (parentNode.nodeName.toLowerCase() == "#text") {
-						i--;
-						parentNode = parentNode.parentNode;
-						continue;
-					}
+			return frag;
+		},
 
-					if (i == value) {
-						this.selection.selectNode(parentNode, false);
-						tinyMCE.triggerNodeChange();
-						tinyMCE.selectedNode = parentNode;
-						return;
-					}
+		_traverseCommonEndContainer : function(startAncestor, how) {
+			var t = this, frag, startIdx, n, cnt, sibling, xferNode;
 
-					parentNode = parentNode.parentNode;
-				}
+			if (how != DELETE)
+				frag = t.dom.doc.createDocumentFragment();
 
-				break;
+			n = t._traverseLeftBoundary(startAncestor, how);
+			if (frag)
+				frag.appendChild(n);
 
-			case "SetStyleInfo":
-				var rng = this.getRng();
-				var sel = this.getSel();
-				var scmd = value['command'];
-				var sname = value['name'];
-				var svalue = value['value'] == null ? '' : value['value'];
-				//var svalue = value['value'] == null ? '' : value['value'];
-				var wrapper = value['wrapper'] ? value['wrapper'] : "span";
-				var parentElm = null;
-				var invalidRe = new RegExp("^BODY|HTML$", "g");
-				var invalidParentsRe = tinyMCE.settings['merge_styles_invalid_parents'] != '' ? new RegExp(tinyMCE.settings['merge_styles_invalid_parents'], "gi") : null;
-
-				// Whole element selected check
-				if (tinyMCE.isIE) {
-					// Control range
-					if (rng.item)
-						parentElm = rng.item(0);
-					else {
-						var pelm = rng.parentElement();
-						var prng = doc.selection.createRange();
-						prng.moveToElementText(pelm);
-
-						if (rng.htmlText == prng.htmlText || rng.boundingWidth == 0) {
-							if (invalidParentsRe == null || !invalidParentsRe.test(pelm.nodeName))
-								parentElm = pelm;
-						}
-					}
-				} else {
-					var felm = this.getFocusElement();
-					if (sel.isCollapsed || (new RegExp('td|tr|tbody|table', 'gi').test(felm.nodeName) && sel.anchorNode == felm.parentNode))
-						parentElm = felm;
-				}
+			startIdx = indexOf(startAncestor, t.endContainer);
+			++startIdx;  // Because we already traversed it....
 
-				// Whole element selected
-				if (parentElm && !invalidRe.test(parentElm.nodeName)) {
-					if (scmd == "setstyle")
-						tinyMCE.setStyleAttrib(parentElm, sname, svalue);
+			cnt = t.endOffset - startIdx;
+			n = startAncestor.nextSibling;
+			while (cnt > 0) {
+				sibling = n.nextSibling;
+				xferNode = t._traverseFullySelected(n, how);
 
-					if (scmd == "setattrib")
-						tinyMCE.setAttrib(parentElm, sname, svalue);
+				if (frag)
+					frag.appendChild(xferNode);
 
-					if (scmd == "removeformat") {
-						parentElm.style.cssText = '';
-						tinyMCE.setAttrib(parentElm, 'class', '');
-					}
+				--cnt;
+				n = sibling;
+			}
 
-					// Remove style/attribs from all children
-					var ch = tinyMCE.getNodeTree(parentElm, new Array(), 1);
-					for (var z=0; z<ch.length; z++) {
-						if (ch[z] == parentElm)
-							continue;
+			if (how != CLONE) {
+				t.setStartAfter(startAncestor);
+				t.collapse(true);
+			}
 
-						if (scmd == "setstyle")
-							tinyMCE.setStyleAttrib(ch[z], sname, '');
+			return frag;
+		},
 
-						if (scmd == "setattrib")
-							tinyMCE.setAttrib(ch[z], sname, '');
+		_traverseCommonAncestors : function(startAncestor, endAncestor, how) {
+			var t = this, n, frag, commonParent, startOffset, endOffset, cnt, sibling, nextSibling;
 
-						if (scmd == "removeformat") {
-							ch[z].style.cssText = '';
-							tinyMCE.setAttrib(ch[z], 'class', '');
-						}
-					}
-				} else {
-					this._setUseCSS(false); // Bug in FF when running in fullscreen
-					doc.execCommand("FontName", false, "#mce_temp_font#");
-					var elementArray = tinyMCE.getElementsByAttributeValue(this.getBody(), "font", "face", "#mce_temp_font#");
-
-					// Change them all
-					for (var x=0; x<elementArray.length; x++) {
-						elm = elementArray[x];
-						if (elm) {
-							var spanElm = doc.createElement(wrapper);
-
-							if (scmd == "setstyle")
-								tinyMCE.setStyleAttrib(spanElm, sname, svalue);
-
-							if (scmd == "setattrib")
-								tinyMCE.setAttrib(spanElm, sname, svalue);
-
-							if (scmd == "removeformat") {
-								spanElm.style.cssText = '';
-								tinyMCE.setAttrib(spanElm, 'class', '');
-							}
+			if (how != DELETE)
+				frag = t.dom.doc.createDocumentFragment();
 
-							if (elm.hasChildNodes()) {
-								for (var i=0; i<elm.childNodes.length; i++)
-									spanElm.appendChild(elm.childNodes[i].cloneNode(true));
-							}
+			n = t._traverseLeftBoundary(startAncestor, how);
+			if (frag)
+				frag.appendChild(n);
 
-							spanElm.setAttribute("mce_new", "true");
-							elm.parentNode.replaceChild(spanElm, elm);
+			commonParent = startAncestor.parentNode;
+			startOffset = indexOf(startAncestor, commonParent);
+			endOffset = indexOf(endAncestor, commonParent);
+			++startOffset;
 
-							// Remove style/attribs from all children
-							var ch = tinyMCE.getNodeTree(spanElm, new Array(), 1);
-							for (var z=0; z<ch.length; z++) {
-								if (ch[z] == spanElm)
-									continue;
-
-								if (scmd == "setstyle")
-									tinyMCE.setStyleAttrib(ch[z], sname, '');
-
-								if (scmd == "setattrib")
-									tinyMCE.setAttrib(ch[z], sname, '');
-
-								if (scmd == "removeformat") {
-									ch[z].style.cssText = '';
-									tinyMCE.setAttrib(ch[z], 'class', '');
-								}
-							}
-						}
-					}
-				}
+			cnt = endOffset - startOffset;
+			sibling = startAncestor.nextSibling;
 
-				// Cleaup wrappers
-				var nodes = doc.getElementsByTagName(wrapper);
-				for (var i=nodes.length-1; i>=0; i--) {
-					var elm = nodes[i];
-					var isNew = tinyMCE.getAttrib(elm, "mce_new") == "true";
-
-					elm.removeAttribute("mce_new");
-
-					// Is only child a element
-					if (elm.childNodes && elm.childNodes.length == 1 && elm.childNodes[0].nodeType == 1) {
-						//tinyMCE.debug("merge1" + isNew);
-						this._mergeElements(scmd, elm, elm.childNodes[0], isNew);
-						continue;
-					}
+			while (cnt > 0) {
+				nextSibling = sibling.nextSibling;
+				n = t._traverseFullySelected(sibling, how);
 
-					// Is I the only child
-					if (elm.parentNode.childNodes.length == 1 && !invalidRe.test(elm.nodeName) && !invalidRe.test(elm.parentNode.nodeName)) {
-						//tinyMCE.debug("merge2" + isNew + "," + elm.nodeName + "," + elm.parentNode.nodeName);
-						if (invalidParentsRe == null || !invalidParentsRe.test(elm.parentNode.nodeName))
-							this._mergeElements(scmd, elm.parentNode, elm, false);
-					}
-				}
+				if (frag)
+					frag.appendChild(n);
 
-				// Remove empty wrappers
-				var nodes = doc.getElementsByTagName(wrapper);
-				for (var i=nodes.length-1; i>=0; i--) {
-					var elm = nodes[i];
-					var isEmpty = true;
+				sibling = nextSibling;
+				--cnt;
+			}
 
-					// Check if it has any attribs
-					var tmp = doc.createElement("body");
-					tmp.appendChild(elm.cloneNode(false));
+			n = t._traverseRightBoundary(endAncestor, how);
 
-					// Is empty span, remove it
-					tmp.innerHTML = tmp.innerHTML.replace(new RegExp('style=""|class=""', 'gi'), '');
-					//tinyMCE.debug(tmp.innerHTML);
-					if (new RegExp('<span>', 'gi').test(tmp.innerHTML)) {
-						for (var x=0; x<elm.childNodes.length; x++) {
-							if (elm.parentNode != null)
-								elm.parentNode.insertBefore(elm.childNodes[x].cloneNode(true), elm);
-						}
+			if (frag)
+				frag.appendChild(n);
 
-						elm.parentNode.removeChild(elm);
-					}
-				}
+			if (how != CLONE) {
+				t.setStartAfter(startAncestor);
+				t.collapse(true);
+			}
 
-				// Re add the visual aids
-				if (scmd == "removeformat")
-					tinyMCE.handleVisualAid(this.getBody(), true, this.visualAid, this);
+			return frag;
+		},
 
-				tinyMCE.triggerNodeChange();
+		_traverseRightBoundary : function(root, how) {
+			var t = this, next = getSelectedNode(t.endContainer, t.endOffset - 1), parent, clonedParent, prevSibling, clonedChild, clonedGrandParent;
+			var isFullySelected = next != t.endContainer;
 
-				break;
+			if (next == root)
+				return t._traverseNode(next, isFullySelected, false, how);
 
-			case "FontName":
-				if (value == null) {
-					var s = this.getSel();
+			parent = next.parentNode;
+			clonedParent = t._traverseNode(parent, false, false, how);
 
-					// Find font and select it
-					if (tinyMCE.isGecko && s.isCollapsed) {
-						var f = tinyMCE.getParentElement(this.getFocusElement(), "font");
+			while (parent != null) {
+				while (next != null) {
+					prevSibling = next.previousSibling;
+					clonedChild = t._traverseNode(next, isFullySelected, false, how);
 
-						if (f != null)
-							this.selection.selectNode(f, false);
-					}
+					if (how != DELETE)
+						clonedParent.insertBefore(clonedChild, clonedParent.firstChild);
 
-					// Remove format
-					this.getDoc().execCommand("RemoveFormat", false, null);
+					isFullySelected = true;
+					next = prevSibling;
+				}
 
-					// Collapse range if font was found
-					if (f != null && tinyMCE.isGecko) {
-						var r = this.getRng().cloneRange();
-						r.collapse(true);
-						s.removeAllRanges();
-						s.addRange(r);
-					}
-				} else
-					this.getDoc().execCommand('FontName', false, value);
+				if (parent == root)
+					return clonedParent;
 
-				if (tinyMCE.isGecko)
-					window.setTimeout('tinyMCE.triggerNodeChange(false);', 1);
+				next = parent.previousSibling;
+				parent = parent.parentNode;
 
-				return;
+				clonedGrandParent = t._traverseNode(parent, false, false, how);
 
-			case "FontSize":
-				this.getDoc().execCommand('FontSize', false, value);
+				if (how != DELETE)
+					clonedGrandParent.appendChild(clonedParent);
 
-				if (tinyMCE.isGecko)
-					window.setTimeout('tinyMCE.triggerNodeChange(false);', 1);
+				clonedParent = clonedGrandParent;
+			}
 
-				return;
+			// should never occur
+			return null;
+		},
 
-			case "forecolor":
-				value = value == null ? this.foreColor : value;
-				value = tinyMCE.trim(value);
-				value = value.charAt(0) != '#' ? (isNaN('0x' + value) ? value : '#' + value) : value;
+		_traverseLeftBoundary : function(root, how) {
+			var t = this, next = getSelectedNode(t.startContainer, t.startOffset);
+			var isFullySelected = next != t.startContainer, parent, clonedParent, nextSibling, clonedChild, clonedGrandParent;
 
-				this.foreColor = value;
-				this.getDoc().execCommand('forecolor', false, value);
-				break;
+			if (next == root)
+				return t._traverseNode(next, isFullySelected, true, how);
 
-			case "HiliteColor":
-				value = value == null ? this.backColor : value;
-				value = tinyMCE.trim(value);
-				value = value.charAt(0) != '#' ? (isNaN('0x' + value) ? value : '#' + value) : value;
-				this.backColor = value;
-
-				if (tinyMCE.isGecko) {
-					this._setUseCSS(true);
-					this.getDoc().execCommand('hilitecolor', false, value);
-					this._setUseCSS(false);
-				} else
-					this.getDoc().execCommand('BackColor', false, value);
-				break;
+			parent = next.parentNode;
+			clonedParent = t._traverseNode(parent, false, true, how);
 
-			case "Cut":
-			case "Copy":
-			case "Paste":
-				var cmdFailed = false;
-
-				// Try executing command
-				eval('try {this.getDoc().execCommand(command, user_interface, value);} catch (e) {cmdFailed = true;}');
-
-				if (tinyMCE.isOpera && cmdFailed)
-					alert('Currently not supported by your browser, use keyboard shortcuts instead.');
-
-				// Alert error in gecko if command failed
-				if (tinyMCE.isGecko && cmdFailed) {
-					// Confirm more info
-					if (confirm(tinyMCE.entityDecode(tinyMCE.getLang('lang_clipboard_msg'))))
-						window.open('http://www.mozilla.org/editor/midasdemo/securityprefs.html', 'mceExternal');
+			while (parent != null) {
+				while (next != null) {
+					nextSibling = next.nextSibling;
+					clonedChild = t._traverseNode(next, isFullySelected, true, how);
 
-					return;
-				} else
-					tinyMCE.triggerNodeChange();
-			break;
+					if (how != DELETE)
+						clonedParent.appendChild(clonedChild);
 
-			case "mceSetContent":
-				if (!value)
-					value = "";
-
-				// Call custom cleanup code
-				value = tinyMCE.storeAwayURLs(value);
-				value = tinyMCE._customCleanup(this, "insert_to_editor", value);
+					isFullySelected = true;
+					next = nextSibling;
+				}
 
-				if (this.getBody().nodeName == 'BODY')
-					tinyMCE._setHTML(doc, value);
-				else
-					this.getBody().innerHTML = value;
+				if (parent == root)
+					return clonedParent;
 
-				tinyMCE.setInnerHTML(this.getBody(), tinyMCE._cleanupHTML(this, doc, this.settings, this.getBody(), false, false, false, true));
-				tinyMCE.convertAllRelativeURLs(this.getBody());
+				next = parent.nextSibling;
+				parent = parent.parentNode;
 
-				// Cleanup any mess left from storyAwayURLs
-				tinyMCE._removeInternal(this.getBody());
+				clonedGrandParent = t._traverseNode(parent, false, true, how);
 
-				// When editing always use fonts internaly
-				if (tinyMCE.getParam("convert_fonts_to_spans"))
-					tinyMCE.convertSpansToFonts(doc);
+				if (how != DELETE)
+					clonedGrandParent.appendChild(clonedParent);
 
-				tinyMCE.handleVisualAid(this.getBody(), true, this.visualAid, this);
-				tinyMCE._setEventsEnabled(this.getBody(), false);
-				return true;
+				clonedParent = clonedGrandParent;
+			}
 
-			case "mceCleanup":
-				var b = this.selection.getBookmark();
-				tinyMCE._setHTML(this.contentDocument, this.getBody().innerHTML);
-				tinyMCE.setInnerHTML(this.getBody(), tinyMCE._cleanupHTML(this, this.contentDocument, this.settings, this.getBody(), this.visualAid));
-				tinyMCE.convertAllRelativeURLs(doc.body);
-
-				// When editing always use fonts internaly
-				if (tinyMCE.getParam("convert_fonts_to_spans"))
-					tinyMCE.convertSpansToFonts(doc);
-
-				tinyMCE.handleVisualAid(this.getBody(), true, this.visualAid, this);
-				tinyMCE._setEventsEnabled(this.getBody(), false);
-				this.repaint();
-				this.selection.moveToBookmark(b);
-				tinyMCE.triggerNodeChange();
-			break;
+			// should never occur
+			return null;
+		},
 
-			case "mceReplaceContent":
-				// Force empty string
-				if (!value)
-					value = '';
-
-				this.getWin().focus();
-
-				var selectedText = "";
-
-				if (tinyMCE.isIE) {
-					var rng = doc.selection.createRange();
-					selectedText = rng.text;
-				} else
-					selectedText = this.getSel().toString();
+		_traverseNode : function(n, isFullySelected, isLeft, how) {
+			var t = this, txtValue, newNodeValue, oldNodeValue, offset, newNode;
 
-				if (selectedText.length > 0) {
-					value = tinyMCE.replaceVar(value, "selection", selectedText);
-					tinyMCE.execCommand('mceInsertContent', false, value);
-				}
+			if (isFullySelected)
+				return t._traverseFullySelected(n, how);
 
-				tinyMCE.triggerNodeChange();
-			break;
+			if (n.nodeType == 3 /* TEXT_NODE */) {
+				txtValue = n.nodeValue;
 
-			case "mceSetAttribute":
-				if (typeof(value) == 'object') {
-					var targetElms = (typeof(value['targets']) == "undefined") ? "p,img,span,div,td,h1,h2,h3,h4,h5,h6,pre,address" : value['targets'];
-					var targetNode = tinyMCE.getParentElement(this.getFocusElement(), targetElms);
-
-					if (targetNode) {
-						targetNode.setAttribute(value['name'], value['value']);
-						tinyMCE.triggerNodeChange();
-					}
+				if (isLeft) {
+					offset = t.startOffset;
+					newNodeValue = txtValue.substring(offset);
+					oldNodeValue = txtValue.substring(0, offset);
+				} else {
+					offset = t.endOffset;
+					newNodeValue = txtValue.substring(0, offset);
+					oldNodeValue = txtValue.substring(offset);
 				}
-			break;
-
-			case "mceSetCSSClass":
-				this.execCommand("SetStyleInfo", false, {command : "setattrib", name : "class", value : value});
-			break;
-
-			case "mceInsertRawHTML":
-				var key = 'tiny_mce_marker';
 
-				this.execCommand('mceBeginUndoLevel');
+				if (how != CLONE)
+					n.nodeValue = oldNodeValue;
 
-				// Insert marker key
-				this.execCommand('mceInsertContent', false, key);
+				if (how == DELETE)
+					return null;
 
-				// Store away scroll pos
-				var scrollX = this.getBody().scrollLeft + this.getDoc().documentElement.scrollLeft;
-				var scrollY = this.getBody().scrollTop + this.getDoc().documentElement.scrollTop;
+				newNode = n.cloneNode(false);
+				newNode.nodeValue = newNodeValue;
 
-				// Find marker and replace with RAW HTML
-				var html = this.getBody().innerHTML;
-				if ((pos = html.indexOf(key)) != -1)
-					tinyMCE.setInnerHTML(this.getBody(), html.substring(0, pos) + value + html.substring(pos + key.length));
+				return newNode;
+			}
 
-				// Restore scoll pos
-				this.contentWindow.scrollTo(scrollX, scrollY);
+			if (how == DELETE)
+				return null;
 
-				this.execCommand('mceEndUndoLevel');
+			return n.cloneNode(false);
+		},
 
-				break;
+		_traverseFullySelected : function(n, how) {
+			var t = this;
 
-			case "mceInsertContent":
-				// Force empty string
-				if (!value)
-					value = '';
+			if (how != DELETE)
+				return how == CLONE ? n.cloneNode(true) : n;
 
-				var insertHTMLFailed = false;
+			n.parentNode.removeChild(n);
+			return null;
+		}
+	});
 
-				// Removed since it produced problems in IE
-				// this.getWin().focus();
+	ns.Range = Range;
+})(tinymce.dom);
+(function() {
+	function Selection(selection) {
+		var t = this, invisibleChar = '\uFEFF', range, lastIERng;
+
+		function compareRanges(rng1, rng2) {
+			if (rng1 && rng2) {
+				// Both are control ranges and the selected element matches
+				if (rng1.item && rng2.item && rng1.item(0) === rng2.item(0))
+					return 1;
+
+				// Both are text ranges and the range matches
+				if (rng1.isEqual && rng2.isEqual && rng2.isEqual(rng1))
+					return 1;
+			}
 
-				if (tinyMCE.isGecko || tinyMCE.isOpera) {
-					try {
-						// Is plain text or HTML, &amp;, &nbsp; etc will be encoded wrong in FF
-						if (value.indexOf('<') == -1 && !value.match(/(&#38;|&#160;|&#60;|&#62;)/g)) {
-							var r = this.getRng();
-							var n = this.getDoc().createTextNode(tinyMCE.entityDecode(value));
-							var s = this.getSel();
-							var r2 = r.cloneRange();
+			return 0;
+		};
 
-							// Insert text at cursor position
-							s.removeAllRanges();
-							r.deleteContents();
-							r.insertNode(n);
+		function getRange() {
+			var dom = selection.dom, ieRange = selection.getRng(), domRange = dom.createRng(), startPos, endPos, element, sc, ec, collapsed;
 
-							// Move the cursor to the end of text
-							r2.selectNode(n);
-							r2.collapse(false);
-							s.removeAllRanges();
-							s.addRange(r2);
-						} else {
-							value = tinyMCE.fixGeckoBaseHREFBug(1, this.getDoc(), value);
-							this.getDoc().execCommand('inserthtml', false, value);
-							tinyMCE.fixGeckoBaseHREFBug(2, this.getDoc(), value);
-						}
-					} catch (ex) {
-						insertHTMLFailed = true;
-					}
+			function findIndex(element) {
+				var nl = element.parentNode.childNodes, i;
 
-					if (!insertHTMLFailed) {
-						tinyMCE.triggerNodeChange();
-						return;
-					}
+				for (i = nl.length - 1; i >= 0; i--) {
+					if (nl[i] == element)
+						return i;
 				}
 
-				if (!tinyMCE.isIE) {
-					var isHTML = value.indexOf('<') != -1;
-					var sel = this.getSel();
-					var rng = this.getRng();
-
-					if (isHTML) {
-						if (tinyMCE.isSafari) {
-							var tmpRng = this.getDoc().createRange();
-
-							tmpRng.setStart(this.getBody(), 0);
-							tmpRng.setEnd(this.getBody(), 0);
-
-							value = tmpRng.createContextualFragment(value);
-						} else
-							value = rng.createContextualFragment(value);
-					} else {
-						// Setup text node
-						var el = document.createElement("div");
-						el.innerHTML = value;
-						value = el.firstChild.nodeValue;
-						value = doc.createTextNode(value);
-					}
+				return -1;
+			};
 
-					// Insert plain text in Safari
-					if (tinyMCE.isSafari && !isHTML) {
-						this.execCommand('InsertText', false, value.nodeValue);
-						tinyMCE.triggerNodeChange();
-						return true;
-					} else if (tinyMCE.isSafari && isHTML) {
-						rng.deleteContents();
-						rng.insertNode(value);
-						tinyMCE.triggerNodeChange();
-						return true;
-					}
+			function findEndPoint(start) {
+				var rng = ieRange.duplicate(), parent, i, nl, n, offset = 0, index = 0, pos, tmpRng;
 
-					rng.deleteContents();
+				// Insert marker character
+				rng.collapse(start);
+				parent = rng.parentElement();
+				rng.pasteHTML(invisibleChar); // Needs to be a pasteHTML instead of .text = since IE has a bug with nodeValue
+
+				// Find marker character
+				nl = parent.childNodes;
+				for (i = 0; i < nl.length; i++) {
+					n = nl[i];
+
+					// Calculate node index excluding text node fragmentation
+					if (i > 0 && (n.nodeType !== 3 || nl[i - 1].nodeType !== 3))
+						index++;
+
+					// If text node then calculate offset
+					if (n.nodeType === 3) {
+						// Look for marker
+						pos = n.nodeValue.indexOf(invisibleChar);
+						if (pos !== -1) {
+							offset += pos;
+							break;
+						}
 
-					// If target node is text do special treatment, (Mozilla 1.3 fix)
-					if (rng.startContainer.nodeType == 3) {
-						var node = rng.startContainer.splitText(rng.startOffset);
-						node.parentNode.insertBefore(value, node); 
+						offset += n.nodeValue.length;
 					} else
-						rng.insertNode(value);
-
-					if (!isHTML) {
-						// Removes weird selection trails
-						sel.selectAllChildren(doc.body);
-						sel.removeAllRanges();
-
-						// Move cursor to end of content
-						var rng = doc.createRange();
-
-						rng.selectNode(value);
-						rng.collapse(false);
+						offset = 0;
+				}
 
-						sel.addRange(rng);
-					} else
-						rng.collapse(false);
+				// Remove marker character
+				rng.moveStart('character', -1);
+				rng.text = '';
 
-					tinyMCE.fixGeckoBaseHREFBug(2, this.getDoc(), value);
-				} else {
-					var rng = doc.selection.createRange(), tmpRng = null;
-					var c = value.indexOf('<!--') != -1;
+				return {index : index, offset : offset, parent : parent};
+			};
 
-					// Fix comment bug, add tag before comments
-					if (c)
-						value = tinyMCE.uniqueTag + value;
+			// If selection is outside the current document just return an empty range
+			element = ieRange.item ? ieRange.item(0) : ieRange.parentElement();
+			if (element.ownerDocument != dom.doc)
+				return domRange;
 
-					//	tmpRng = rng.duplicate(); // Store away range (Fixes Undo bookmark bug in IE)
+			// Handle control selection or text selection of a image
+			if (ieRange.item || !element.hasChildNodes()) {
+				domRange.setStart(element.parentNode, findIndex(element));
+				domRange.setEnd(domRange.startContainer, domRange.startOffset + 1);
 
-					if (rng.item)
-						rng.item(0).outerHTML = value;
-					else
-						rng.pasteHTML(value);
+				return domRange;
+			}
 
-					//if (tmpRng)
-					//	tmpRng.select(); // Restore range  (Fixes Undo bookmark bug in IE)
+			// Check collapsed state
+			collapsed = selection.isCollapsed();
 
-					// Remove unique tag
-					if (c) {
-						var e = this.getDoc().getElementById('mceTMPElement');
-						e.parentNode.removeChild(e);
-					}
-				}
+			// Find start and end pos index and offset
+			startPos = findEndPoint(true);
+			endPos = findEndPoint(false);
 
-				tinyMCE.execCommand("mceAddUndoLevel");
-				tinyMCE.triggerNodeChange();
-			break;
+			// Normalize the elements to avoid fragmented dom
+			startPos.parent.normalize();
+			endPos.parent.normalize();
 
-			case "mceStartTyping":
-				if (tinyMCE.settings['custom_undo_redo'] && this.undoRedo.typingUndoIndex == -1) {
-					this.undoRedo.typingUndoIndex = this.undoRedo.undoIndex;
-					tinyMCE.typingUndoIndex = tinyMCE.undoIndex;
-					this.execCommand('mceAddUndoLevel');
-				}
-				break;
+			// Set start container and offset
+			sc = startPos.parent.childNodes[Math.min(startPos.index, startPos.parent.childNodes.length - 1)];
 
-			case "mceEndTyping":
-				if (tinyMCE.settings['custom_undo_redo'] && this.undoRedo.typingUndoIndex != -1) {
-					this.execCommand('mceAddUndoLevel');
-					this.undoRedo.typingUndoIndex = -1;
-				}
+			if (sc.nodeType != 3)
+				domRange.setStart(startPos.parent, startPos.index);
+			else
+				domRange.setStart(startPos.parent.childNodes[startPos.index], startPos.offset);
 
-				tinyMCE.typingUndoIndex = -1;
-				break;
+			// Set end container and offset
+			ec = endPos.parent.childNodes[Math.min(endPos.index, endPos.parent.childNodes.length - 1)];
 
-			case "mceBeginUndoLevel":
-				this.undoRedoLevel = false;
-				break;
+			if (ec.nodeType != 3) {
+				if (!collapsed)
+					endPos.index++;
 
-			case "mceEndUndoLevel":
-				this.undoRedoLevel = true;
-				this.execCommand('mceAddUndoLevel');
-				break;
+				domRange.setEnd(endPos.parent, endPos.index);
+			} else
+				domRange.setEnd(endPos.parent.childNodes[endPos.index], endPos.offset);
 
-			case "mceAddUndoLevel":
-				if (tinyMCE.settings['custom_undo_redo'] && this.undoRedoLevel) {
-					if (this.undoRedo.add())
-						tinyMCE.triggerNodeChange(false);
-				}
-				break;
+			// If not collapsed then make sure offsets are valid
+			if (!collapsed) {
+				sc = domRange.startContainer;
+				if (sc.nodeType == 1)
+					domRange.setStart(sc, Math.min(domRange.startOffset, sc.childNodes.length));
 
-			case "Undo":
-				if (tinyMCE.settings['custom_undo_redo']) {
-					tinyMCE.execCommand("mceEndTyping");
-					this.undoRedo.undo();
-					tinyMCE.triggerNodeChange();
-				} else
-					this.getDoc().execCommand(command, user_interface, value);
-				break;
+				ec = domRange.endContainer;
+				if (ec.nodeType == 1)
+					domRange.setEnd(ec, Math.min(domRange.endOffset, ec.childNodes.length));
+			}
 
-			case "Redo":
-				if (tinyMCE.settings['custom_undo_redo']) {
-					tinyMCE.execCommand("mceEndTyping");
-					this.undoRedo.redo();
-					tinyMCE.triggerNodeChange();
-				} else
-					this.getDoc().execCommand(command, user_interface, value);
-				break;
+			// Restore selection to new range
+			t.addRange(domRange);
 
-			case "mceToggleVisualAid":
-				this.visualAid = !this.visualAid;
-				tinyMCE.handleVisualAid(this.getBody(), true, this.visualAid, this);
-				tinyMCE.triggerNodeChange();
-				break;
+			return domRange;
+		};
 
-			case "Indent":
-				this.getDoc().execCommand(command, user_interface, value);
-				tinyMCE.triggerNodeChange();
+		this.addRange = function(rng) {
+			var ieRng, body = selection.dom.doc.body, startPos, endPos, sc, so, ec, eo;
 
-				if (tinyMCE.isIE) {
-					var n = tinyMCE.getParentElement(this.getFocusElement(), "blockquote");
-					do {
-						if (n && n.nodeName == "BLOCKQUOTE") {
-							n.removeAttribute("dir");
-							n.removeAttribute("style");
-						}
-					} while (n != null && (n = n.parentNode) != null);
-				}
-				break;
+			// Setup some shorter versions
+			sc = rng.startContainer;
+			so = rng.startOffset;
+			ec = rng.endContainer;
+			eo = rng.endOffset;
+			ieRng = body.createTextRange();
+
+			// Find element
+			sc = sc.nodeType == 1 ? sc.childNodes[Math.min(so, sc.childNodes.length - 1)] : sc;
+			ec = ec.nodeType == 1 ? ec.childNodes[Math.min(so == eo ? eo : eo - 1, ec.childNodes.length - 1)] : ec;
+
+			// Single element selection
+			if (sc == ec && sc.nodeType == 1) {
+				// Make control selection for some elements
+				if (/^(IMG|TABLE)$/.test(sc.nodeName) && so != eo) {
+					ieRng = body.createControlRange();
+					ieRng.addElement(sc);
+				} else {
+					ieRng = body.createTextRange();
 
-			case "removeformat":
-				var text = this.selection.getSelectedText();
+					// Padd empty elements with invisible character
+					if (!sc.hasChildNodes() && sc.canHaveHTML)
+						sc.innerHTML = invisibleChar;
 
-				if (tinyMCE.isOpera) {
-					this.getDoc().execCommand("RemoveFormat", false, null);
-					return;
-				}
+					// Select element contents
+					ieRng.moveToElementText(sc);
 
-				if (tinyMCE.isIE) {
-					try {
-						var rng = doc.selection.createRange();
-						rng.execCommand("RemoveFormat", false, null);
-					} catch (e) {
-						// Do nothing
+					// If it's only containing a padding remove it so the caret remains
+					if (sc.innerHTML == invisibleChar) {
+						ieRng.collapse(true);
+						sc.removeChild(sc.firstChild);
 					}
-
-					this.execCommand("SetStyleInfo", false, {command : "removeformat"});
-				} else {
-					this.getDoc().execCommand(command, user_interface, value);
-
-					this.execCommand("SetStyleInfo", false, {command : "removeformat"});
 				}
 
-				// Remove class
-				if (text.length == 0)
-					this.execCommand("mceSetCSSClass", false, "");
-
-				tinyMCE.triggerNodeChange();
-				break;
-
-			default:
-				this.getDoc().execCommand(command, user_interface, value);
-
-				if (tinyMCE.isGecko)
-					window.setTimeout('tinyMCE.triggerNodeChange(false);', 1);
-				else
-					tinyMCE.triggerNodeChange();
-		}
-
-		// Add undo level after modification
-		if (command != "mceAddUndoLevel" && command != "Undo" && command != "Redo" && command != "mceStartTyping" && command != "mceEndTyping")
-			tinyMCE.execCommand("mceAddUndoLevel");
-	},
+				if (so == eo)
+					ieRng.collapse(eo <= rng.endContainer.childNodes.length - 1);
 
-	queryCommandValue : function(c) {
-		try {
-			return this.getDoc().queryCommandValue(c);
-		} catch (e) {
-			return null;
-		}
-	},
+				ieRng.select();
 
-	queryCommandState : function(c) {
-		return this.getDoc().queryCommandState(c);
-	},
+				return;
+			}
 
-	_onAdd : function(replace_element, form_element_name, target_document) {
-		var hc, th, to, editorTemplate;
+			function getCharPos(container, offset) {
+				var nodeVal, rng, pos;
 
-		th = this.settings['theme'];
-		to = tinyMCE.themes[th];
+				if (container.nodeType != 3)
+					return -1;
 
-		var targetDoc = target_document ? target_document : document;
+				nodeVal = container.nodeValue;
+				rng = body.createTextRange();
 
-		this.targetDoc = targetDoc;
+				// Insert marker at offset position
+				container.nodeValue = nodeVal.substring(0, offset) + invisibleChar + nodeVal.substring(offset);
 
-		tinyMCE.themeURL = tinyMCE.baseURL + "/themes/" + this.settings['theme'];
-		this.settings['themeurl'] = tinyMCE.themeURL;
+				// Find char pos of marker and remove it
+				rng.moveToElementText(container.parentNode);
+				rng.findText(invisibleChar);
+				pos = Math.abs(rng.moveStart('character', -0xFFFFF));
+				container.nodeValue = nodeVal;
 
-		if (!replace_element) {
-			alert("Error: Could not find the target element.");
-			return false;
-		}
+				return pos;
+			};
 
-		if (to.getEditorTemplate)
-			editorTemplate = to.getEditorTemplate(this.settings, this.editorId);
+			// Collapsed range
+			if (rng.collapsed) {
+				pos = getCharPos(sc, so);
+
+				ieRng = body.createTextRange();
+				ieRng.move('character', pos);
+				ieRng.select();
 
-		var deltaWidth = editorTemplate['delta_width'] ? editorTemplate['delta_width'] : 0;
-		var deltaHeight = editorTemplate['delta_height'] ? editorTemplate['delta_height'] : 0;
-		var html = '<span id="' + this.editorId + '_parent" class="mceEditorContainer">' + editorTemplate['html'];
+				return;
+			} else {
+				// If same text container
+				if (sc == ec && sc.nodeType == 3) {
+					startPos = getCharPos(sc, so);
+
+					ieRng.move('character', startPos);
+					ieRng.moveEnd('character', eo - so);
+					ieRng.select();
 
-		html = tinyMCE.replaceVar(html, "editor_id", this.editorId);
-		this.settings['default_document'] = tinyMCE.baseURL + "/blank.htm";
+					return;
+				}
 
-		this.settings['old_width'] = this.settings['width'];
-		this.settings['old_height'] = this.settings['height'];
+				// Get caret positions
+				startPos = getCharPos(sc, so);
+				endPos = getCharPos(ec, eo);
+				ieRng = body.createTextRange();
+
+				// Move start of range to start character position or start element
+				if (startPos == -1) {
+					ieRng.moveToElementText(sc);
+					startPos = 0;
+				} else
+					ieRng.move('character', startPos);
 
-		// Set default width, height
-		if (this.settings['width'] == -1)
-			this.settings['width'] = replace_element.offsetWidth;
+				// Move end of range to end character position or end element
+				tmpRng = body.createTextRange();
 
-		if (this.settings['height'] == -1)
-			this.settings['height'] = replace_element.offsetHeight;
+				if (endPos == -1)
+					tmpRng.moveToElementText(ec);
+				else
+					tmpRng.move('character', endPos);
 
-		// Try the style width
-		if (this.settings['width'] == 0)
-			this.settings['width'] = replace_element.style.width;
+				ieRng.setEndPoint('EndToEnd', tmpRng);
+				ieRng.select();
 
-		// Try the style height
-		if (this.settings['height'] == 0)
-			this.settings['height'] = replace_element.style.height; 
+				return;
+			}
+		};
 
-		// If no width/height then default to 320x240, better than nothing
-		if (this.settings['width'] == 0)
-			this.settings['width'] = 320;
+		this.getRangeAt = function() {
+			// Setup new range if the cache is empty
+			if (!range || !compareRanges(lastIERng, selection.getRng())) {
+				range = getRange();
 
-		if (this.settings['height'] == 0)
-			this.settings['height'] = 240;
+				// Store away text range for next call
+				lastIERng = selection.getRng();
+			}
 
-		this.settings['area_width'] = parseInt(this.settings['width']);
-		this.settings['area_height'] = parseInt(this.settings['height']);
-		this.settings['area_width'] += deltaWidth;
-		this.settings['area_height'] += deltaHeight;
+			// Return cached range
+			return range;
+		};
 
-		this.settings['width_style'] = "" + this.settings['width'];
-		this.settings['height_style'] = "" + this.settings['height'];
+		this.destroy = function() {
+			// Destroy cached range and last IE range to avoid memory leaks
+			lastIERng = range = null;
+		};
+	};
 
-		// Special % handling
-		if (("" + this.settings['width']).indexOf('%') != -1)
-			this.settings['area_width'] = "100%";
-		else
-			this.settings['width_style'] += 'px';
+	// Expose the selection object
+	tinymce.dom.TridentSelection = Selection;
+})();
 
-		if (("" + this.settings['height']).indexOf('%') != -1)
-			this.settings['area_height'] = "100%";
-		else
-			this.settings['height_style'] += 'px';
+/*
+ * Sizzle CSS Selector Engine - v1.0
+ *  Copyright 2009, The Dojo Foundation
+ *  Released under the MIT, BSD, and GPL Licenses.
+ *  More information: http://sizzlejs.com/
+ */
+(function(){
+
+var chunker = /((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?/g,
+	done = 0,
+	toString = Object.prototype.toString,
+	hasDuplicate = false;
+
+var Sizzle = function(selector, context, results, seed) {
+	results = results || [];
+	var origContext = context = context || document;
 
-		if (("" + replace_element.style.width).indexOf('%') != -1) {
-			this.settings['width'] = replace_element.style.width;
-			this.settings['area_width'] = "100%";
-			this.settings['width_style'] = "100%";
-		}
+	if ( context.nodeType !== 1 && context.nodeType !== 9 ) {
+		return [];
+	}
+	
+	if ( !selector || typeof selector !== "string" ) {
+		return results;
+	}
 
-		if (("" + replace_element.style.height).indexOf('%') != -1) {
-			this.settings['height'] = replace_element.style.height;
-			this.settings['area_height'] = "100%";
-			this.settings['height_style'] = "100%";
+	var parts = [], m, set, checkSet, check, mode, extra, prune = true, contextXML = isXML(context);
+	
+	// Reset the position of the chunker regexp (start from head)
+	chunker.lastIndex = 0;
+	
+	while ( (m = chunker.exec(selector)) !== null ) {
+		parts.push( m[1] );
+		
+		if ( m[2] ) {
+			extra = RegExp.rightContext;
+			break;
 		}
+	}
 
-		html = tinyMCE.applyTemplate(html);
-
-		this.settings['width'] = this.settings['old_width'];
-		this.settings['height'] = this.settings['old_height'];
+	if ( parts.length > 1 && origPOS.exec( selector ) ) {
+		if ( parts.length === 2 && Expr.relative[ parts[0] ] ) {
+			set = posProcess( parts[0] + parts[1], context );
+		} else {
+			set = Expr.relative[ parts[0] ] ?
+				[ context ] :
+				Sizzle( parts.shift(), context );
 
-		this.visualAid = this.settings['visual'];
-		this.formTargetElementId = form_element_name;
+			while ( parts.length ) {
+				selector = parts.shift();
 
-		// Get replace_element contents
-		if (replace_element.nodeName == "TEXTAREA" || replace_element.nodeName == "INPUT")
-			this.startContent = replace_element.value;
-		else
-			this.startContent = replace_element.innerHTML;
+				if ( Expr.relative[ selector ] )
+					selector += parts.shift();
 
-		// If not text area or input
-		if (replace_element.nodeName != "TEXTAREA" && replace_element.nodeName != "INPUT") {
-			this.oldTargetElement = replace_element;
+				set = posProcess( selector, set );
+			}
+		}
+	} else {
+		// Take a shortcut and set the context if the root selector is an ID
+		// (but not if it'll be faster if the inner selector is an ID)
+		if ( !seed && parts.length > 1 && context.nodeType === 9 && !contextXML &&
+				Expr.match.ID.test(parts[0]) && !Expr.match.ID.test(parts[parts.length - 1]) ) {
+			var ret = Sizzle.find( parts.shift(), context, contextXML );
+			context = ret.expr ? Sizzle.filter( ret.expr, ret.set )[0] : ret.set[0];
+		}
+
+		if ( context ) {
+			var ret = seed ?
+				{ expr: parts.pop(), set: makeArray(seed) } :
+				Sizzle.find( parts.pop(), parts.length === 1 && (parts[0] === "~" || parts[0] === "+") && context.parentNode ? context.parentNode : context, contextXML );
+			set = ret.expr ? Sizzle.filter( ret.expr, ret.set ) : ret.set;
 
-			// Debug mode
-			if (tinyMCE.settings['debug']) {
-				hc = '<textarea wrap="off" id="' + form_element_name + '" name="' + form_element_name + '" cols="100" rows="15"></textarea>';
+			if ( parts.length > 0 ) {
+				checkSet = makeArray(set);
 			} else {
-				hc = '<input type="hidden" id="' + form_element_name + '" name="' + form_element_name + '" />';
-				this.oldTargetElement.style.display = "none";
+				prune = false;
 			}
 
-			html += '</span>';
+			while ( parts.length ) {
+				var cur = parts.pop(), pop = cur;
 
-			if (tinyMCE.isGecko)
-				html = hc + html;
-			else
-				html += hc;
+				if ( !Expr.relative[ cur ] ) {
+					cur = "";
+				} else {
+					pop = parts.pop();
+				}
 
-			// Output HTML and set editable
-			if (tinyMCE.isGecko) {
-				var rng = replace_element.ownerDocument.createRange();
-				rng.setStartBefore(replace_element);
+				if ( pop == null ) {
+					pop = context;
+				}
 
-				var fragment = rng.createContextualFragment(html);
-				tinyMCE.insertAfter(fragment, replace_element);
-			} else
-				replace_element.insertAdjacentHTML("beforeBegin", html);
+				Expr.relative[ cur ]( checkSet, pop, contextXML );
+			}
 		} else {
-			html += '</span>';
-
-			// Just hide the textarea element
-			this.oldTargetElement = replace_element;
-
-			if (!tinyMCE.settings['debug'])
-				this.oldTargetElement.style.display = "none";
-
-			// Output HTML and set editable
-			if (tinyMCE.isGecko) {
-				var rng = replace_element.ownerDocument.createRange();
-				rng.setStartBefore(replace_element);
-
-				var fragment = rng.createContextualFragment(html);
-				tinyMCE.insertAfter(fragment, replace_element);
-			} else
-				replace_element.insertAdjacentHTML("beforeBegin", html);
+			checkSet = parts = [];
 		}
+	}
 
-		// Setup iframe
-		var dynamicIFrame = false;
-		var tElm = targetDoc.getElementById(this.editorId);
-
-		if (!tinyMCE.isIE) {
-			// Node case is preserved in XML strict mode
-			if (tElm && (tElm.nodeName == "SPAN" || tElm.nodeName == "span")) {
-				tElm = tinyMCE._createIFrame(tElm, targetDoc);
-				dynamicIFrame = true;
-			}
+	if ( !checkSet ) {
+		checkSet = set;
+	}
 
-			this.targetElement = tElm;
-			this.iframeElement = tElm;
-			this.contentDocument = tElm.contentDocument;
-			this.contentWindow = tElm.contentWindow;
+	if ( !checkSet ) {
+		throw "Syntax error, unrecognized expression: " + (cur || selector);
+	}
 
-			//this.getDoc().designMode = "on";
+	if ( toString.call(checkSet) === "[object Array]" ) {
+		if ( !prune ) {
+			results.push.apply( results, checkSet );
+		} else if ( context && context.nodeType === 1 ) {
+			for ( var i = 0; checkSet[i] != null; i++ ) {
+				if ( checkSet[i] && (checkSet[i] === true || checkSet[i].nodeType === 1 && contains(context, checkSet[i])) ) {
+					results.push( set[i] );
+				}
+			}
 		} else {
-			if (tElm && tElm.nodeName == "SPAN")
-				tElm = tinyMCE._createIFrame(tElm, targetDoc, targetDoc.parentWindow);
-			else
-				tElm = targetDoc.frames[this.editorId];
-
-			this.targetElement = tElm;
-			this.iframeElement = targetDoc.getElementById(this.editorId);
-
-			if (tinyMCE.isOpera) {
-				this.contentDocument = this.iframeElement.contentDocument;
-				this.contentWindow = this.iframeElement.contentWindow;
-				dynamicIFrame = true;
-			} else {
-				this.contentDocument = tElm.window.document;
-				this.contentWindow = tElm.window;
+			for ( var i = 0; checkSet[i] != null; i++ ) {
+				if ( checkSet[i] && checkSet[i].nodeType === 1 ) {
+					results.push( set[i] );
+				}
 			}
-
-			this.getDoc().designMode = "on";
 		}
+	} else {
+		makeArray( checkSet, results );
+	}
 
-		// Setup base HTML
-		var doc = this.contentDocument;
-		if (dynamicIFrame) {
-			var html = tinyMCE.getParam('doctype') + '<html><head xmlns="http://www.w3.org/1999/xhtml"><base href="' + tinyMCE.settings['base_href'] + '" /><title>blank_page</title><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"></head><body class="mceContentBody"></body></html>';
+	if ( extra ) {
+		Sizzle( extra, origContext, results, seed );
+		Sizzle.uniqueSort( results );
+	}
 
-			try {
-				if (!this.isHidden())
-					this.getDoc().designMode = "on";
+	return results;
+};
+
+Sizzle.uniqueSort = function(results){
+	if ( sortOrder ) {
+		hasDuplicate = false;
+		results.sort(sortOrder);
 
-				doc.open();
-				doc.write(html);
-				doc.close();
-			} catch (e) {
-				// Failed Mozilla 1.3
-				this.getDoc().location.href = tinyMCE.baseURL + "/blank.htm";
+		if ( hasDuplicate ) {
+			for ( var i = 1; i < results.length; i++ ) {
+				if ( results[i] === results[i-1] ) {
+					results.splice(i--, 1);
+				}
 			}
 		}
+	}
+};
 
-		// This timeout is needed in MSIE 5.5 for some odd reason
-		// it seems that the document.frames isn't initialized yet?
-		if (tinyMCE.isIE)
-			window.setTimeout("tinyMCE.addEventHandlers(tinyMCE.instances[\"" + this.editorId + "\"]);", 1);
+Sizzle.matches = function(expr, set){
+	return Sizzle(expr, null, null, set);
+};
 
-		tinyMCE.setupContent(this.editorId, true);
+Sizzle.find = function(expr, context, isXML){
+	var set, match;
 
-		return true;
-	},
+	if ( !expr ) {
+		return [];
+	}
 
-	setBaseHREF : function(u) {
-		var h, b, d, nl;
+	for ( var i = 0, l = Expr.order.length; i < l; i++ ) {
+		var type = Expr.order[i], match;
+		
+		if ( (match = Expr.match[ type ].exec( expr )) ) {
+			var left = RegExp.leftContext;
 
-		d = this.getDoc();
-		nl = d.getElementsByTagName("base");
-		b = nl.length > 0 ? nl[0] : null;
-
-		if (!b) {
-			nl = d.getElementsByTagName("head");
-			h = nl.length > 0 ? nl[0] : null;
-
-			b = d.createElement("base");
-			b.setAttribute('href', u);
-			h.appendChild(b);
-		} else {
-			if (u == "" || u == null)
-				b.parentNode.removeChild(b);
-			else
-				b.setAttribute('href', u);
+			if ( left.substr( left.length - 1 ) !== "\\" ) {
+				match[1] = (match[1] || "").replace(/\\/g, "");
+				set = Expr.find[ type ]( match, context, isXML );
+				if ( set != null ) {
+					expr = expr.replace( Expr.match[ type ], "" );
+					break;
+				}
+			}
 		}
-	},
-
-	getHTML : function(r) {
-		var h, d = this.getDoc(), b = this.getBody();
-
-		if (r)
-			return b.innerHTML;
+	}
 
-		h = tinyMCE._cleanupHTML(this, d, this.settings, b, false, true, false, true);
+	if ( !set ) {
+		set = context.getElementsByTagName("*");
+	}
 
-		if (tinyMCE.getParam("convert_fonts_to_spans"))
-			tinyMCE.convertSpansToFonts(d);
+	return {set: set, expr: expr};
+};
 
-		return h;
-	},
+Sizzle.filter = function(expr, set, inplace, not){
+	var old = expr, result = [], curLoop = set, match, anyFound,
+		isXMLFilter = set && set[0] && isXML(set[0]);
 
-	setHTML : function(h) {
-		this.execCommand('mceSetContent', false, h);
-		this.repaint();
-	},
+	while ( expr && set.length ) {
+		for ( var type in Expr.filter ) {
+			if ( (match = Expr.match[ type ].exec( expr )) != null ) {
+				var filter = Expr.filter[ type ], found, item;
+				anyFound = false;
 
-	getFocusElement : function() {
-		return this.selection.getFocusElement();
-	},
+				if ( curLoop == result ) {
+					result = [];
+				}
 
-	getSel : function() {
-		return this.selection.getSel();
-	},
+				if ( Expr.preFilter[ type ] ) {
+					match = Expr.preFilter[ type ]( match, curLoop, inplace, result, not, isXMLFilter );
 
-	getRng : function() {
-		return this.selection.getRng();
-	},
+					if ( !match ) {
+						anyFound = found = true;
+					} else if ( match === true ) {
+						continue;
+					}
+				}
 
-	triggerSave : function(skip_cleanup, skip_callback) {
-		var e, nl = [], i, s;
+				if ( match ) {
+					for ( var i = 0; (item = curLoop[i]) != null; i++ ) {
+						if ( item ) {
+							found = filter( item, match, i, curLoop );
+							var pass = not ^ !!found;
+
+							if ( inplace && found != null ) {
+								if ( pass ) {
+									anyFound = true;
+								} else {
+									curLoop[i] = false;
+								}
+							} else if ( pass ) {
+								result.push( item );
+								anyFound = true;
+							}
+						}
+					}
+				}
 
-		this.switchSettings();
-		s = tinyMCE.settings;
+				if ( found !== undefined ) {
+					if ( !inplace ) {
+						curLoop = result;
+					}
 
-		// Force hidden tabs visible while serializing
-		if (tinyMCE.isRealIE) {
-			e = this.iframeElement;
+					expr = expr.replace( Expr.match[ type ], "" );
 
-			do {
-				if (e.style && e.style.display == 'none') {
-					e.style.display = 'block';
-					nl[nl.length] = {elm : e, type : 'style'};
-				}
+					if ( !anyFound ) {
+						return [];
+					}
 
-				if (e.style && s.hidden_tab_class.length > 0 && e.className.indexOf(s.hidden_tab_class) != -1) {
-					e.className = s.display_tab_class;
-					nl[nl.length] = {elm : e, type : 'class'};
+					break;
 				}
-			} while ((e = e.parentNode) != null)
+			}
 		}
 
-		tinyMCE.settings['preformatted'] = false;
-
-		// Default to false
-		if (typeof(skip_cleanup) == "undefined")
-			skip_cleanup = false;
+		// Improper expression
+		if ( expr == old ) {
+			if ( anyFound == null ) {
+				throw "Syntax error, unrecognized expression: " + expr;
+			} else {
+				break;
+			}
+		}
 
-		// Default to false
-		if (typeof(skip_callback) == "undefined")
-			skip_callback = false;
+		old = expr;
+	}
 
-		tinyMCE._setHTML(this.getDoc(), this.getBody().innerHTML);
+	return curLoop;
+};
 
-		// Remove visual aids when cleanup is disabled
-		if (this.settings['cleanup'] == false) {
-			tinyMCE.handleVisualAid(this.getBody(), true, false, this);
-			tinyMCE._setEventsEnabled(this.getBody(), true);
+var Expr = Sizzle.selectors = {
+	order: [ "ID", "NAME", "TAG" ],
+	match: {
+		ID: /#((?:[\w\u00c0-\uFFFF_-]|\\.)+)/,
+		CLASS: /\.((?:[\w\u00c0-\uFFFF_-]|\\.)+)/,
+		NAME: /\[name=['"]*((?:[\w\u00c0-\uFFFF_-]|\\.)+)['"]*\]/,
+		ATTR: /\[\s*((?:[\w\u00c0-\uFFFF_-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/,
+		TAG: /^((?:[\w\u00c0-\uFFFF\*_-]|\\.)+)/,
+		CHILD: /:(only|nth|last|first)-child(?:\((even|odd|[\dn+-]*)\))?/,
+		POS: /:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^-]|$)/,
+		PSEUDO: /:((?:[\w\u00c0-\uFFFF_-]|\\.)+)(?:\((['"]*)((?:\([^\)]+\)|[^\2\(\)]*)+)\2\))?/
+	},
+	attrMap: {
+		"class": "className",
+		"for": "htmlFor"
+	},
+	attrHandle: {
+		href: function(elem){
+			return elem.getAttribute("href");
 		}
+	},
+	relative: {
+		"+": function(checkSet, part, isXML){
+			var isPartStr = typeof part === "string",
+				isTag = isPartStr && !/\W/.test(part),
+				isPartStrNotTag = isPartStr && !isTag;
 
-		tinyMCE._customCleanup(this, "submit_content_dom", this.contentWindow.document.body);
-		var htm = skip_cleanup ? this.getBody().innerHTML : tinyMCE._cleanupHTML(this, this.getDoc(), this.settings, this.getBody(), tinyMCE.visualAid, true, true);
-		htm = tinyMCE._customCleanup(this, "submit_content", htm);
+			if ( isTag && !isXML ) {
+				part = part.toUpperCase();
+			}
 
-		if (!skip_callback && tinyMCE.settings['save_callback'] != "")
-			var content = eval(tinyMCE.settings['save_callback'] + "(this.formTargetElementId,htm,this.getBody());");
+			for ( var i = 0, l = checkSet.length, elem; i < l; i++ ) {
+				if ( (elem = checkSet[i]) ) {
+					while ( (elem = elem.previousSibling) && elem.nodeType !== 1 ) {}
 
-		// Use callback content if available
-		if ((typeof(content) != "undefined") && content != null)
-			htm = content;
+					checkSet[i] = isPartStrNotTag || elem && elem.nodeName === part ?
+						elem || false :
+						elem === part;
+				}
+			}
 
-		// Replace some weird entities (Bug: #1056343)
-		htm = tinyMCE.regexpReplace(htm, "&#40;", "(", "gi");
-		htm = tinyMCE.regexpReplace(htm, "&#41;", ")", "gi");
-		htm = tinyMCE.regexpReplace(htm, "&#59;", ";", "gi");
-		htm = tinyMCE.regexpReplace(htm, "&#34;", "&quot;", "gi");
-		htm = tinyMCE.regexpReplace(htm, "&#94;", "^", "gi");
+			if ( isPartStrNotTag ) {
+				Sizzle.filter( part, checkSet, true );
+			}
+		},
+		">": function(checkSet, part, isXML){
+			var isPartStr = typeof part === "string";
 
-		if (this.formElement)
-			this.formElement.value = htm;
+			if ( isPartStr && !/\W/.test(part) ) {
+				part = isXML ? part : part.toUpperCase();
 
-		if (tinyMCE.isSafari && this.formElement)
-			this.formElement.innerText = htm;
+				for ( var i = 0, l = checkSet.length; i < l; i++ ) {
+					var elem = checkSet[i];
+					if ( elem ) {
+						var parent = elem.parentNode;
+						checkSet[i] = parent.nodeName === part ? parent : false;
+					}
+				}
+			} else {
+				for ( var i = 0, l = checkSet.length; i < l; i++ ) {
+					var elem = checkSet[i];
+					if ( elem ) {
+						checkSet[i] = isPartStr ?
+							elem.parentNode :
+							elem.parentNode === part;
+					}
+				}
 
-		// Hide them again (tabs in MSIE)
-		for (i=0; i<nl.length; i++) {
-			if (nl[i].type == 'style')
-				nl[i].elm.style.display = 'none';
-			else
-				nl[i].elm.className = s.hidden_tab_class;
-		}
-	}
+				if ( isPartStr ) {
+					Sizzle.filter( part, checkSet, true );
+				}
+			}
+		},
+		"": function(checkSet, part, isXML){
+			var doneName = done++, checkFn = dirCheck;
 
-	};
+			if ( !part.match(/\W/) ) {
+				var nodeCheck = part = isXML ? part : part.toUpperCase();
+				checkFn = dirNodeCheck;
+			}
 
-/* file:jscripts/tiny_mce/classes/TinyMCE_Cleanup.class.js */
+			checkFn("parentNode", part, doneName, checkSet, nodeCheck, isXML);
+		},
+		"~": function(checkSet, part, isXML){
+			var doneName = done++, checkFn = dirCheck;
 
-TinyMCE_Engine.prototype.cleanupHTMLCode = function(s) {
-	s = s.replace(new RegExp('<p \\/>', 'gi'), '<p>&nbsp;</p>');
-	s = s.replace(new RegExp('<p>\\s*<\\/p>', 'gi'), '<p>&nbsp;</p>');
+			if ( typeof part === "string" && !part.match(/\W/) ) {
+				var nodeCheck = part = isXML ? part : part.toUpperCase();
+				checkFn = dirNodeCheck;
+			}
 
-	// Fix close BR elements
-	s = s.replace(new RegExp('<br>\\s*<\\/br>', 'gi'), '<br />');
+			checkFn("previousSibling", part, doneName, checkSet, nodeCheck, isXML);
+		}
+	},
+	find: {
+		ID: function(match, context, isXML){
+			if ( typeof context.getElementById !== "undefined" && !isXML ) {
+				var m = context.getElementById(match[1]);
+				return m ? [m] : [];
+			}
+		},
+		NAME: function(match, context, isXML){
+			if ( typeof context.getElementsByName !== "undefined" ) {
+				var ret = [], results = context.getElementsByName(match[1]);
 
-	// Open closed tags like <b/> to <b></b>
-	s = s.replace(new RegExp('<(h[1-6]|p|div|address|pre|form|table|li|ol|ul|td|b|font|em|strong|i|strike|u|span|a|ul|ol|li|blockquote)([a-z]*)([^\\\\|>]*)\\/>', 'gi'), '<$1$2$3></$1$2>');
+				for ( var i = 0, l = results.length; i < l; i++ ) {
+					if ( results[i].getAttribute("name") === match[1] ) {
+						ret.push( results[i] );
+					}
+				}
 
-	// Remove trailing space <b > to <b>
-	s = s.replace(new RegExp('\\s+></', 'gi'), '></');
+				return ret.length === 0 ? null : ret;
+			}
+		},
+		TAG: function(match, context){
+			return context.getElementsByTagName(match[1]);
+		}
+	},
+	preFilter: {
+		CLASS: function(match, curLoop, inplace, result, not, isXML){
+			match = " " + match[1].replace(/\\/g, "") + " ";
 
-	// Close tags <img></img> to <img/>
-	s = s.replace(new RegExp('<(img|br|hr)([^>]*)><\\/(img|br|hr)>', 'gi'), '<$1$2 />');
+			if ( isXML ) {
+				return match;
+			}
 
-	// Weird MSIE bug, <p><hr /></p> breaks runtime?
-	if (tinyMCE.isIE)
-		s = s.replace(new RegExp('<p><hr \\/><\\/p>', 'gi'), "<hr>");
+			for ( var i = 0, elem; (elem = curLoop[i]) != null; i++ ) {
+				if ( elem ) {
+					if ( not ^ (elem.className && (" " + elem.className + " ").indexOf(match) >= 0) ) {
+						if ( !inplace )
+							result.push( elem );
+					} else if ( inplace ) {
+						curLoop[i] = false;
+					}
+				}
+			}
 
-	// Weird tags will make IE error #bug: 1538495
-	if (tinyMCE.isIE)
-		s = s.replace(/<!(\s*)\/>/g, '');
-
-	// Convert relative anchors to absolute URLs ex: #something to file.htm#something
-	// Removed: Since local document anchors should never be forced absolute example edit.php?id=something
-	//if (tinyMCE.getParam('convert_urls'))
-	//	s = s.replace(new RegExp('(href=\"{0,1})(\\s*#)', 'gi'), '$1' + tinyMCE.settings['document_base_url'] + "#");
+			return false;
+		},
+		ID: function(match){
+			return match[1].replace(/\\/g, "");
+		},
+		TAG: function(match, curLoop){
+			for ( var i = 0; curLoop[i] === false; i++ ){}
+			return curLoop[i] && isXML(curLoop[i]) ? match[1] : match[1].toUpperCase();
+		},
+		CHILD: function(match){
+			if ( match[1] == "nth" ) {
+				// parse equations like 'even', 'odd', '5', '2n', '3n+2', '4n-1', '-n+6'
+				var test = /(-?)(\d*)n((?:\+|-)?\d*)/.exec(
+					match[2] == "even" && "2n" || match[2] == "odd" && "2n+1" ||
+					!/\D/.test( match[2] ) && "0n+" + match[2] || match[2]);
+
+				// calculate the numbers (first)n+(last) including if they are negative
+				match[2] = (test[1] + (test[2] || 1)) - 0;
+				match[3] = test[3] - 0;
+			}
+
+			// TODO: Move to normal caching system
+			match[0] = done++;
+
+			return match;
+		},
+		ATTR: function(match, curLoop, inplace, result, not, isXML){
+			var name = match[1].replace(/\\/g, "");
+			
+			if ( !isXML && Expr.attrMap[name] ) {
+				match[1] = Expr.attrMap[name];
+			}
+
+			if ( match[2] === "~=" ) {
+				match[4] = " " + match[4] + " ";
+			}
+
+			return match;
+		},
+		PSEUDO: function(match, curLoop, inplace, result, not){
+			if ( match[1] === "not" ) {
+				// If we're dealing with a complex expression, or a simple one
+				if ( match[3].match(chunker).length > 1 || /^\w/.test(match[3]) ) {
+					match[3] = Sizzle(match[3], null, null, curLoop);
+				} else {
+					var ret = Sizzle.filter(match[3], curLoop, inplace, true ^ not);
+					if ( !inplace ) {
+						result.push.apply( result, ret );
+					}
+					return false;
+				}
+			} else if ( Expr.match.POS.test( match[0] ) || Expr.match.CHILD.test( match[0] ) ) {
+				return true;
+			}
+			
+			return match;
+		},
+		POS: function(match){
+			match.unshift( true );
+			return match;
+		}
+	},
+	filters: {
+		enabled: function(elem){
+			return elem.disabled === false && elem.type !== "hidden";
+		},
+		disabled: function(elem){
+			return elem.disabled === true;
+		},
+		checked: function(elem){
+			return elem.checked === true;
+		},
+		selected: function(elem){
+			// Accessing this property makes selected-by-default
+			// options in Safari work properly
+			elem.parentNode.selectedIndex;
+			return elem.selected === true;
+		},
+		parent: function(elem){
+			return !!elem.firstChild;
+		},
+		empty: function(elem){
+			return !elem.firstChild;
+		},
+		has: function(elem, i, match){
+			return !!Sizzle( match[3], elem ).length;
+		},
+		header: function(elem){
+			return /h\d/i.test( elem.nodeName );
+		},
+		text: function(elem){
+			return "text" === elem.type;
+		},
+		radio: function(elem){
+			return "radio" === elem.type;
+		},
+		checkbox: function(elem){
+			return "checkbox" === elem.type;
+		},
+		file: function(elem){
+			return "file" === elem.type;
+		},
+		password: function(elem){
+			return "password" === elem.type;
+		},
+		submit: function(elem){
+			return "submit" === elem.type;
+		},
+		image: function(elem){
+			return "image" === elem.type;
+		},
+		reset: function(elem){
+			return "reset" === elem.type;
+		},
+		button: function(elem){
+			return "button" === elem.type || elem.nodeName.toUpperCase() === "BUTTON";
+		},
+		input: function(elem){
+			return /input|select|textarea|button/i.test(elem.nodeName);
+		}
+	},
+	setFilters: {
+		first: function(elem, i){
+			return i === 0;
+		},
+		last: function(elem, i, match, array){
+			return i === array.length - 1;
+		},
+		even: function(elem, i){
+			return i % 2 === 0;
+		},
+		odd: function(elem, i){
+			return i % 2 === 1;
+		},
+		lt: function(elem, i, match){
+			return i < match[3] - 0;
+		},
+		gt: function(elem, i, match){
+			return i > match[3] - 0;
+		},
+		nth: function(elem, i, match){
+			return match[3] - 0 == i;
+		},
+		eq: function(elem, i, match){
+			return match[3] - 0 == i;
+		}
+	},
+	filter: {
+		PSEUDO: function(elem, match, i, array){
+			var name = match[1], filter = Expr.filters[ name ];
+
+			if ( filter ) {
+				return filter( elem, i, match, array );
+			} else if ( name === "contains" ) {
+				return (elem.textContent || elem.innerText || "").indexOf(match[3]) >= 0;
+			} else if ( name === "not" ) {
+				var not = match[3];
 
-	return s;
-};
+				for ( var i = 0, l = not.length; i < l; i++ ) {
+					if ( not[i] === elem ) {
+						return false;
+					}
+				}
 
-TinyMCE_Engine.prototype.parseStyle = function(str) {
-	var ar = new Array();
+				return true;
+			}
+		},
+		CHILD: function(elem, match){
+			var type = match[1], node = elem;
+			switch (type) {
+				case 'only':
+				case 'first':
+					while (node = node.previousSibling)  {
+						if ( node.nodeType === 1 ) return false;
+					}
+					if ( type == 'first') return true;
+					node = elem;
+				case 'last':
+					while (node = node.nextSibling)  {
+						if ( node.nodeType === 1 ) return false;
+					}
+					return true;
+				case 'nth':
+					var first = match[2], last = match[3];
 
-	if (str == null)
-		return ar;
+					if ( first == 1 && last == 0 ) {
+						return true;
+					}
+					
+					var doneName = match[0],
+						parent = elem.parentNode;
+	
+					if ( parent && (parent.sizcache !== doneName || !elem.nodeIndex) ) {
+						var count = 0;
+						for ( node = parent.firstChild; node; node = node.nextSibling ) {
+							if ( node.nodeType === 1 ) {
+								node.nodeIndex = ++count;
+							}
+						} 
+						parent.sizcache = doneName;
+					}
+					
+					var diff = elem.nodeIndex - last;
+					if ( first == 0 ) {
+						return diff == 0;
+					} else {
+						return ( diff % first == 0 && diff / first >= 0 );
+					}
+			}
+		},
+		ID: function(elem, match){
+			return elem.nodeType === 1 && elem.getAttribute("id") === match;
+		},
+		TAG: function(elem, match){
+			return (match === "*" && elem.nodeType === 1) || elem.nodeName === match;
+		},
+		CLASS: function(elem, match){
+			return (" " + (elem.className || elem.getAttribute("class")) + " ")
+				.indexOf( match ) > -1;
+		},
+		ATTR: function(elem, match){
+			var name = match[1],
+				result = Expr.attrHandle[ name ] ?
+					Expr.attrHandle[ name ]( elem ) :
+					elem[ name ] != null ?
+						elem[ name ] :
+						elem.getAttribute( name ),
+				value = result + "",
+				type = match[2],
+				check = match[4];
+
+			return result == null ?
+				type === "!=" :
+				type === "=" ?
+				value === check :
+				type === "*=" ?
+				value.indexOf(check) >= 0 :
+				type === "~=" ?
+				(" " + value + " ").indexOf(check) >= 0 :
+				!check ?
+				value && result !== false :
+				type === "!=" ?
+				value != check :
+				type === "^=" ?
+				value.indexOf(check) === 0 :
+				type === "$=" ?
+				value.substr(value.length - check.length) === check :
+				type === "|=" ?
+				value === check || value.substr(0, check.length + 1) === check + "-" :
+				false;
+		},
+		POS: function(elem, match, i, array){
+			var name = match[2], filter = Expr.setFilters[ name ];
+
+			if ( filter ) {
+				return filter( elem, i, match, array );
+			}
+		}
+	}
+};
 
-	var st = str.split(';');
+var origPOS = Expr.match.POS;
 
-	tinyMCE.clearArray(ar);
+for ( var type in Expr.match ) {
+	Expr.match[ type ] = new RegExp( Expr.match[ type ].source + /(?![^\[]*\])(?![^\(]*\))/.source );
+}
 
-	for (var i=0; i<st.length; i++) {
-		if (st[i] == '')
-			continue;
+var makeArray = function(array, results) {
+	array = Array.prototype.slice.call( array );
 
-		var re = new RegExp('^\\s*([^:]*):\\s*(.*)\\s*$');
-		var pa = st[i].replace(re, '$1||$2').split('||');
-//tinyMCE.debug(str, pa[0] + "=" + pa[1], st[i].replace(re, '$1||$2'));
-		if (pa.length == 2)
-			ar[pa[0].toLowerCase()] = pa[1];
+	if ( results ) {
+		results.push.apply( results, array );
+		return results;
 	}
-
-	return ar;
+	
+	return array;
 };
 
-TinyMCE_Engine.prototype.compressStyle = function(ar, pr, sf, res) {
-	var box = new Array();
-
-	box[0] = ar[pr + '-top' + sf];
-	box[1] = ar[pr + '-left' + sf];
-	box[2] = ar[pr + '-right' + sf];
-	box[3] = ar[pr + '-bottom' + sf];
+// Perform a simple check to determine if the browser is capable of
+// converting a NodeList to an array using builtin methods.
+try {
+	Array.prototype.slice.call( document.documentElement.childNodes );
 
-	for (var i=0; i<box.length; i++) {
-		if (box[i] == null)
-			return;
+// Provide a fallback method if it does not work
+} catch(e){
+	makeArray = function(array, results) {
+		var ret = results || [];
 
-		for (var a=0; a<box.length; a++) {
-			if (box[a] != box[i])
-				return;
+		if ( toString.call(array) === "[object Array]" ) {
+			Array.prototype.push.apply( ret, array );
+		} else {
+			if ( typeof array.length === "number" ) {
+				for ( var i = 0, l = array.length; i < l; i++ ) {
+					ret.push( array[i] );
+				}
+			} else {
+				for ( var i = 0; array[i]; i++ ) {
+					ret.push( array[i] );
+				}
+			}
 		}
-	}
 
-	// They are all the same
-	ar[res] = box[0];
-	ar[pr + '-top' + sf] = null;
-	ar[pr + '-left' + sf] = null;
-	ar[pr + '-right' + sf] = null;
-	ar[pr + '-bottom' + sf] = null;
-};
-
-TinyMCE_Engine.prototype.serializeStyle = function(ar) {
-	var str = "";
-
-	// Compress box
-	tinyMCE.compressStyle(ar, "border", "", "border");
-	tinyMCE.compressStyle(ar, "border", "-width", "border-width");
-	tinyMCE.compressStyle(ar, "border", "-color", "border-color");
-	tinyMCE.compressStyle(ar, "border", "-style", "border-style");
-	tinyMCE.compressStyle(ar, "padding", "", "padding");
-	tinyMCE.compressStyle(ar, "margin", "", "margin");
+		return ret;
+	};
+}
 
-	for (var key in ar) {
-		var val = ar[key];
+var sortOrder;
 
-		if (typeof(val) == 'function')
-			continue;
+if ( document.documentElement.compareDocumentPosition ) {
+	sortOrder = function( a, b ) {
+		var ret = a.compareDocumentPosition(b) & 4 ? -1 : a === b ? 0 : 1;
+		if ( ret === 0 ) {
+			hasDuplicate = true;
+		}
+		return ret;
+	};
+} else if ( "sourceIndex" in document.documentElement ) {
+	sortOrder = function( a, b ) {
+		var ret = a.sourceIndex - b.sourceIndex;
+		if ( ret === 0 ) {
+			hasDuplicate = true;
+		}
+		return ret;
+	};
+} else if ( document.createRange ) {
+	sortOrder = function( a, b ) {
+		var aRange = a.ownerDocument.createRange(), bRange = b.ownerDocument.createRange();
+		aRange.setStart(a, 0);
+		aRange.setEnd(a, 0);
+		bRange.setStart(b, 0);
+		bRange.setEnd(b, 0);
+		var ret = aRange.compareBoundaryPoints(Range.START_TO_END, bRange);
+		if ( ret === 0 ) {
+			hasDuplicate = true;
+		}
+		return ret;
+	};
+}
 
-		if (key.indexOf('mso-') == 0)
-			continue;
+// Check to see if the browser returns elements by name when
+// querying by getElementById (and provide a workaround)
+(function(){
+	// We're going to inject a fake input element with a specified name
+	var form = document.createElement("div"),
+		id = "script" + (new Date).getTime();
+	form.innerHTML = "<a name='" + id + "'/>";
+
+	// Inject it into the root element, check its status, and remove it quickly
+	var root = document.documentElement;
+	root.insertBefore( form, root.firstChild );
+
+	// The workaround has to do additional checks after a getElementById
+	// Which slows things down for other browsers (hence the branching)
+	if ( !!document.getElementById( id ) ) {
+		Expr.find.ID = function(match, context, isXML){
+			if ( typeof context.getElementById !== "undefined" && !isXML ) {
+				var m = context.getElementById(match[1]);
+				return m ? m.id === match[1] || typeof m.getAttributeNode !== "undefined" && m.getAttributeNode("id").nodeValue === match[1] ? [m] : undefined : [];
+			}
+		};
 
-		if (val != null && val != '') {
-			val = '' + val; // Force string
+		Expr.filter.ID = function(elem, match){
+			var node = typeof elem.getAttributeNode !== "undefined" && elem.getAttributeNode("id");
+			return elem.nodeType === 1 && node && node.nodeValue === match;
+		};
+	}
 
-			// Fix style URL
-			val = val.replace(new RegExp("url\\(\\'?([^\\']*)\\'?\\)", 'gi'), "url('$1')");
+	root.removeChild( form );
+})();
 
-			// Convert URL
-			if (val.indexOf('url(') != -1 && tinyMCE.getParam('convert_urls')) {
-				var m = new RegExp("url\\('(.*?)'\\)").exec(val);
+(function(){
+	// Check to see if the browser returns only elements
+	// when doing getElementsByTagName("*")
 
-				if (m.length > 1)
-					val = "url('" + eval(tinyMCE.getParam('urlconverter_callback') + "(m[1], null, true);") + "')";
-			}
+	// Create a fake element
+	var div = document.createElement("div");
+	div.appendChild( document.createComment("") );
 
-			// Force HEX colors
-			if (tinyMCE.getParam("force_hex_style_colors"))
-				val = tinyMCE.convertRGBToHex(val, true);
+	// Make sure no comments are found
+	if ( div.getElementsByTagName("*").length > 0 ) {
+		Expr.find.TAG = function(match, context){
+			var results = context.getElementsByTagName(match[1]);
 
-			if (val != "url('')")
-				str += key.toLowerCase() + ": " + val + "; ";
-		}
-	}
+			// Filter out possible comments
+			if ( match[1] === "*" ) {
+				var tmp = [];
 
-	if (new RegExp('; $').test(str))
-		str = str.substring(0, str.length - 2);
+				for ( var i = 0; results[i]; i++ ) {
+					if ( results[i].nodeType === 1 ) {
+						tmp.push( results[i] );
+					}
+				}
 
-	return str;
-};
+				results = tmp;
+			}
 
-TinyMCE_Engine.prototype.convertRGBToHex = function(s, k) {
-	if (s.toLowerCase().indexOf('rgb') != -1) {
-		var re = new RegExp("(.*?)rgb\\s*?\\(\\s*?([0-9]+).*?,\\s*?([0-9]+).*?,\\s*?([0-9]+).*?\\)(.*?)", "gi");
-		var rgb = s.replace(re, "$1,$2,$3,$4,$5").split(',');
-		if (rgb.length == 5) {
-			r = parseInt(rgb[1]).toString(16);
-			g = parseInt(rgb[2]).toString(16);
-			b = parseInt(rgb[3]).toString(16);
-
-			r = r.length == 1 ? '0' + r : r;
-			g = g.length == 1 ? '0' + g : g;
-			b = b.length == 1 ? '0' + b : b;
+			return results;
+		};
+	}
 
-			s = "#" + r + g + b;
+	// Check to see if an attribute returns normalized href attributes
+	div.innerHTML = "<a href='#'></a>";
+	if ( div.firstChild && typeof div.firstChild.getAttribute !== "undefined" &&
+			div.firstChild.getAttribute("href") !== "#" ) {
+		Expr.attrHandle.href = function(elem){
+			return elem.getAttribute("href", 2);
+		};
+	}
+})();
 
-			if (k)
-				s = rgb[0] + s + rgb[4];
-		}
+if ( document.querySelectorAll ) (function(){
+	var oldSizzle = Sizzle, div = document.createElement("div");
+	div.innerHTML = "<p class='TEST'></p>";
+
+	// Safari can't handle uppercase or unicode characters when
+	// in quirks mode.
+	if ( div.querySelectorAll && div.querySelectorAll(".TEST").length === 0 ) {
+		return;
 	}
+	
+	Sizzle = function(query, context, extra, seed){
+		context = context || document;
 
-	return s;
-};
+		// Only use querySelectorAll on non-XML documents
+		// (ID selectors don't work in non-HTML documents)
+		if ( !seed && context.nodeType === 9 && !isXML(context) ) {
+			try {
+				return makeArray( context.querySelectorAll(query), extra );
+			} catch(e){}
+		}
+		
+		return oldSizzle(query, context, extra, seed);
+	};
 
-TinyMCE_Engine.prototype.convertHexToRGB = function(s) {
-	if (s.indexOf('#') != -1) {
-		s = s.replace(new RegExp('[^0-9A-F]', 'gi'), '');
-		return "rgb(" + parseInt(s.substring(0, 2), 16) + "," + parseInt(s.substring(2, 4), 16) + "," + parseInt(s.substring(4, 6), 16) + ")";
+	for ( var prop in oldSizzle ) {
+		Sizzle[ prop ] = oldSizzle[ prop ];
 	}
+})();
 
-	return s;
-};
+if ( document.getElementsByClassName && document.documentElement.getElementsByClassName ) (function(){
+	var div = document.createElement("div");
+	div.innerHTML = "<div class='test e'></div><div class='test'></div>";
 
-TinyMCE_Engine.prototype.convertSpansToFonts = function(doc) {
-	var sizes = tinyMCE.getParam('font_size_style_values').replace(/\s+/, '').split(',');
+	// Opera can't find a second classname (in 9.6)
+	if ( div.getElementsByClassName("e").length === 0 )
+		return;
 
-	var h = doc.body.innerHTML;
-	h = h.replace(/<span/gi, '<font');
-	h = h.replace(/<\/span/gi, '</font');
-	tinyMCE.setInnerHTML(doc.body, h);
-
-	var s = doc.getElementsByTagName("font");
-	for (var i=0; i<s.length; i++) {
-		var size = tinyMCE.trim(s[i].style.fontSize).toLowerCase();
-		var fSize = 0;
-
-		for (var x=0; x<sizes.length; x++) {
-			if (sizes[x] == size) {
-				fSize = x + 1;
-				break;
-			}
-		}
+	// Safari caches class attributes, doesn't catch changes (in 3.2)
+	div.lastChild.className = "e";
 
-		if (fSize > 0) {
-			tinyMCE.setAttrib(s[i], 'size', fSize);
-			s[i].style.fontSize = '';
-		}
+	if ( div.getElementsByClassName("e").length === 1 )
+		return;
 
-		var fFace = s[i].style.fontFamily;
-		if (fFace != null && fFace != "") {
-			tinyMCE.setAttrib(s[i], 'face', fFace);
-			s[i].style.fontFamily = '';
+	Expr.order.splice(1, 0, "CLASS");
+	Expr.find.CLASS = function(match, context, isXML) {
+		if ( typeof context.getElementsByClassName !== "undefined" && !isXML ) {
+			return context.getElementsByClassName(match[1]);
 		}
+	};
+})();
 
-		var fColor = s[i].style.color;
-		if (fColor != null && fColor != "") {
-			tinyMCE.setAttrib(s[i], 'color', tinyMCE.convertRGBToHex(fColor));
-			s[i].style.color = '';
-		}
-	}
-};
+function dirNodeCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) {
+	var sibDir = dir == "previousSibling" && !isXML;
+	for ( var i = 0, l = checkSet.length; i < l; i++ ) {
+		var elem = checkSet[i];
+		if ( elem ) {
+			if ( sibDir && elem.nodeType === 1 ){
+				elem.sizcache = doneName;
+				elem.sizset = i;
+			}
+			elem = elem[dir];
+			var match = false;
+
+			while ( elem ) {
+				if ( elem.sizcache === doneName ) {
+					match = checkSet[elem.sizset];
+					break;
+				}
 
-TinyMCE_Engine.prototype.convertFontsToSpans = function(doc) {
-	var sizes = tinyMCE.getParam('font_size_style_values').replace(/\s+/, '').split(',');
+				if ( elem.nodeType === 1 && !isXML ){
+					elem.sizcache = doneName;
+					elem.sizset = i;
+				}
 
-	var h = doc.body.innerHTML;
-	h = h.replace(/<font/gi, '<span');
-	h = h.replace(/<\/font/gi, '</span');
-	tinyMCE.setInnerHTML(doc.body, h);
-
-	var fsClasses = tinyMCE.getParam('font_size_classes');
-	if (fsClasses != '')
-		fsClasses = fsClasses.replace(/\s+/, '').split(',');
-	else
-		fsClasses = null;
-
-	var s = doc.getElementsByTagName("span");
-	for (var i=0; i<s.length; i++) {
-		var fSize, fFace, fColor;
-
-		fSize = tinyMCE.getAttrib(s[i], 'size');
-		fFace = tinyMCE.getAttrib(s[i], 'face');
-		fColor = tinyMCE.getAttrib(s[i], 'color');
-
-		if (fSize != "") {
-			fSize = parseInt(fSize);
-
-			if (fSize > 0 && fSize < 8) {
-				if (fsClasses != null)
-					tinyMCE.setAttrib(s[i], 'class', fsClasses[fSize-1]);
-				else
-					s[i].style.fontSize = sizes[fSize-1];
+				if ( elem.nodeName === cur ) {
+					match = elem;
+					break;
+				}
+
+				elem = elem[dir];
 			}
 
-			s[i].removeAttribute('size');
+			checkSet[i] = match;
 		}
+	}
+}
 
-		if (fFace != "") {
-			s[i].style.fontFamily = fFace;
-			s[i].removeAttribute('face');
-		}
+function dirCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) {
+	var sibDir = dir == "previousSibling" && !isXML;
+	for ( var i = 0, l = checkSet.length; i < l; i++ ) {
+		var elem = checkSet[i];
+		if ( elem ) {
+			if ( sibDir && elem.nodeType === 1 ) {
+				elem.sizcache = doneName;
+				elem.sizset = i;
+			}
+			elem = elem[dir];
+			var match = false;
+
+			while ( elem ) {
+				if ( elem.sizcache === doneName ) {
+					match = checkSet[elem.sizset];
+					break;
+				}
 
-		if (fColor != "") {
-			s[i].style.color = fColor;
-			s[i].removeAttribute('color');
-		}
-	}
-};
+				if ( elem.nodeType === 1 ) {
+					if ( !isXML ) {
+						elem.sizcache = doneName;
+						elem.sizset = i;
+					}
+					if ( typeof cur !== "string" ) {
+						if ( elem === cur ) {
+							match = true;
+							break;
+						}
 
-TinyMCE_Engine.prototype.cleanupAnchors = function(doc) {
-	var i, cn, x, an = doc.getElementsByTagName("a");
+					} else if ( Sizzle.filter( cur, [elem] ).length > 0 ) {
+						match = elem;
+						break;
+					}
+				}
 
-	// Loops backwards due to bug #1467987
-	for (i=an.length-1; i>=0; i--) {
-		if (tinyMCE.getAttrib(an[i], "name") != "" && tinyMCE.getAttrib(an[i], "href") == "") {
-			cn = an[i].childNodes;
+				elem = elem[dir];
+			}
 
-			for (x=cn.length-1; x>=0; x--)
-				tinyMCE.insertAfter(cn[x], an[i]);
+			checkSet[i] = match;
 		}
 	}
-};
-
-TinyMCE_Engine.prototype.getContent = function(editor_id) {
-	if (typeof(editor_id) != "undefined")
-		 tinyMCE.getInstanceById(editor_id).select();
-
-	if (tinyMCE.selectedInstance)
-		return tinyMCE.selectedInstance.getHTML();
+}
 
-	return null;
+var contains = document.compareDocumentPosition ?  function(a, b){
+	return a.compareDocumentPosition(b) & 16;
+} : function(a, b){
+	return a !== b && (a.contains ? a.contains(b) : true);
 };
 
-TinyMCE_Engine.prototype._fixListElements = function(d) {
-	var nl, x, a = ['ol', 'ul'], i, n, p, r = new RegExp('^(OL|UL)$'), np;
+var isXML = function(elem){
+	return elem.nodeType === 9 && elem.documentElement.nodeName !== "HTML" ||
+		!!elem.ownerDocument && elem.ownerDocument.documentElement.nodeName !== "HTML";
+};
 
-	for (x=0; x<a.length; x++) {
-		nl = d.getElementsByTagName(a[x]);
+var posProcess = function(selector, context){
+	var tmpSet = [], later = "", match,
+		root = context.nodeType ? [context] : context;
 
-		for (i=0; i<nl.length; i++) {
-			n = nl[i];
-			p = n.parentNode;
+	// Position selectors must be done after the filter
+	// And so must :not(positional) so we move all PSEUDOs to the end
+	while ( (match = Expr.match.PSEUDO.exec( selector )) ) {
+		later += match[0];
+		selector = selector.replace( Expr.match.PSEUDO, "" );
+	}
 
-			if (r.test(p.nodeName)) {
-				np = tinyMCE.prevNode(n, 'LI');
+	selector = Expr.relative[selector] ? selector + "*" : selector;
 
-				if (!np) {
-					np = d.createElement('li');
-					np.innerHTML = '&nbsp;';
-					np.appendChild(n);
-					p.insertBefore(np, p.firstChild);
-				} else
-					np.appendChild(n);
-			}
-		}
+	for ( var i = 0, l = root.length; i < l; i++ ) {
+		Sizzle( selector, root[i], tmpSet );
 	}
-};
 
-TinyMCE_Engine.prototype._fixTables = function(d) {
-	var nl, i, n, p, np, x, t;
+	return Sizzle.filter( later, tmpSet );
+};
 
-	nl = d.getElementsByTagName('table');
-	for (i=0; i<nl.length; i++) {
-		n = nl[i];
+// EXPOSE
 
-		if ((p = tinyMCE.getParentElement(n, 'p,div,h1,h2,h3,h4,h5,h6')) != null) {
-			np = p.cloneNode(false);
-			np.removeAttribute('id');
+window.tinymce.dom.Sizzle = Sizzle;
 
-			t = n;
+})();
 
-			while ((n = n.nextSibling))
-				np.appendChild(n);
+(function(tinymce) {
+	// Shorten names
+	var each = tinymce.each, DOM = tinymce.DOM, isIE = tinymce.isIE, isWebKit = tinymce.isWebKit, Event;
 
-			tinyMCE.insertAfter(np, p);
-			tinyMCE.insertAfter(t, p);
-		}
-	}
-};
+	tinymce.create('tinymce.dom.EventUtils', {
+		EventUtils : function() {
+			this.inits = [];
+			this.events = [];
+		},
 
-TinyMCE_Engine.prototype._cleanupHTML = function(inst, doc, config, elm, visual, on_save, on_submit, inn) {
-	var h, d, t1, t2, t3, t4, t5, c, s, nb;
+		add : function(o, n, f, s) {
+			var cb, t = this, el = t.events, r;
 
-	if (!tinyMCE.getParam('cleanup'))
-		return elm.innerHTML;
+			if (n instanceof Array) {
+				r = [];
 
-	on_save = typeof(on_save) == 'undefined' ? false : on_save;
+				each(n, function(n) {
+					r.push(t.add(o, n, f, s));
+				});
 
-	c = inst.cleanup;
-	s = inst.settings;
-	d = c.settings.debug;
-
-	if (d)
-		t1 = new Date().getTime();
-
-	if (tinyMCE.getParam("convert_fonts_to_spans"))
-		tinyMCE.convertFontsToSpans(doc);
-
-	if (tinyMCE.getParam("fix_list_elements"))
-		tinyMCE._fixListElements(doc);
-
-	if (tinyMCE.getParam("fix_table_elements"))
-		tinyMCE._fixTables(doc);
-
-	// Call custom cleanup code
-	tinyMCE._customCleanup(inst, on_save ? "get_from_editor_dom" : "insert_to_editor_dom", doc.body);
-
-	if (d)
-		t2 = new Date().getTime();
-
-	c.settings.on_save = on_save;
-	//for (var i=0; i<100; i++)
-
-	c.idCount = 0;
-	c.serializationId++;
-	c.serializedNodes = new Array();
-	c.sourceIndex = -1;
-
-	if (s.cleanup_serializer == "xml")
-		h = c.serializeNodeAsXML(elm, inn);
-	else
-		h = c.serializeNodeAsHTML(elm, inn);
-
-	if (d)
-		t3 = new Date().getTime();
-
-	// Post processing
-	nb = tinyMCE.getParam('entity_encoding') == 'numeric' ? '&#160;' : '&nbsp;';
-	h = h.replace(/<\/?(body|head|html)[^>]*>/gi, '');
-	h = h.replace(new RegExp(' (rowspan="1"|colspan="1")', 'g'), '');
-	h = h.replace(/<p><hr \/><\/p>/g, '<hr />');
-	h = h.replace(/<p>(&nbsp;|&#160;)<\/p><hr \/><p>(&nbsp;|&#160;)<\/p>/g, '<hr />');
-	h = h.replace(/<td>\s*<br \/>\s*<\/td>/g, '<td>' + nb + '</td>');
-	h = h.replace(/<p>\s*<br \/>\s*<\/p>/g, '<p>' + nb + '</p>');
-	h = h.replace(/<br \/>$/, ''); // Remove last BR for Gecko
-	h = h.replace(/<br \/><\/p>/g, '</p>'); // Remove last BR in P tags for Gecko
-	h = h.replace(/<p>\s*(&nbsp;|&#160;)\s*<br \/>\s*(&nbsp;|&#160;)\s*<\/p>/g, '<p>' + nb + '</p>');
-	h = h.replace(/<p>\s*(&nbsp;|&#160;)\s*<br \/>\s*<\/p>/g, '<p>' + nb + '</p>');
-	h = h.replace(/<p>\s*<br \/>\s*&nbsp;\s*<\/p>/g, '<p>' + nb + '</p>');
-	h = h.replace(new RegExp('<a>(.*?)<\\/a>', 'g'), '$1');
-	h = h.replace(/<p([^>]*)>\s*<\/p>/g, '<p$1>' + nb + '</p>');
-
-	// Clean body
-	if (/^\s*(<br \/>|<p>&nbsp;<\/p>|<p>&#160;<\/p>|<p><\/p>)\s*$/.test(h))
-		h = '';
-
-	// If preformatted
-	if (s.preformatted) {
-		h = h.replace(/^<pre>/, '');
-		h = h.replace(/<\/pre>$/, '');
-		h = '<pre>' + h + '</pre>';
-	}
+				return r;
+			}
 
-	// Gecko specific processing
-	if (tinyMCE.isGecko) {
-		h = h.replace(/<o:p _moz-userdefined="" \/>/g, '');
-		h = h.replace(/<td([^>]*)>\s*<br \/>\s*<\/td>/g, '<td$1>' + nb + '</td>');
-	}
+			// Handle array
+			if (o && o.hasOwnProperty && o instanceof Array) {
+				r = [];
 
-	if (s.force_br_newlines)
-		h = h.replace(/<p>(&nbsp;|&#160;)<\/p>/g, '<br />');
+				each(o, function(o) {
+					o = DOM.get(o);
+					r.push(t.add(o, n, f, s));
+				});
 
-	// Call custom cleanup code
-	h = tinyMCE._customCleanup(inst, on_save ? "get_from_editor" : "insert_to_editor", h);
+				return r;
+			}
 
-	// Remove internal classes
-	if (on_save) {
-		h = h.replace(new RegExp(' ?(mceItem[a-zA-Z0-9]*|' + s.visual_table_class + ')', 'g'), '');
-		h = h.replace(new RegExp(' ?class=""', 'g'), '');
-	}
+			o = DOM.get(o);
 
-	if (s.remove_linebreaks && !c.settings.indent)
-		h = h.replace(/\n|\r/g, ' ');
+			if (!o)
+				return;
 
-	if (d)
-		t4 = new Date().getTime();
+			// Setup event callback
+			cb = function(e) {
+				// Is all events disabled
+				if (t.disabled)
+					return;
 
-	if (on_save && c.settings.indent)
-		h = c.formatHTML(h);
+				e = e || window.event;
 
-	// If encoding (not recommended option)
-	if (on_submit && (s.encoding == "xml" || s.encoding == "html"))
-		h = c.xmlEncode(h);
+				// Patch in target, preventDefault and stopPropagation in IE it's W3C valid
+				if (e && isIE) {
+					if (!e.target)
+						e.target = e.srcElement;
 
-	if (d)
-		t5 = new Date().getTime();
+					// Patch in preventDefault, stopPropagation methods for W3C compatibility
+					tinymce.extend(e, t._stoppers);
+				}
 
-	if (c.settings.debug)
-		tinyMCE.debug("Cleanup in ms: Pre=" + (t2-t1) + ", Serialize: " + (t3-t2) + ", Post: " + (t4-t3) + ", Format: " + (t5-t4) + ", Sum: " + (t5-t1) + ".");
+				if (!s)
+					return f(e);
 
-	return h;
-};
+				return f.call(s, e);
+			};
 
-function TinyMCE_Cleanup() {
-	this.isIE = (navigator.appName == "Microsoft Internet Explorer");
-	this.rules = tinyMCE.clearArray(new Array());
-
-	// Default config
-	this.settings = {
-		indent_elements : 'head,table,tbody,thead,tfoot,form,tr,ul,ol,blockquote,object',
-		newline_before_elements : 'h1,h2,h3,h4,h5,h6,pre,address,div,ul,ol,li,meta,option,area,title,link,base,script,td',
-		newline_after_elements : 'br,hr,p,pre,address,div,ul,ol,meta,option,area,link,base,script',
-		newline_before_after_elements : 'html,head,body,table,thead,tbody,tfoot,tr,form,ul,ol,blockquote,p,object,param,hr,div',
-		indent_char : '\t',
-		indent_levels : 1,
-		entity_encoding : 'raw',
-		valid_elements : '*[*]',
-		entities : '',
-		url_converter : '',
-		invalid_elements : '',
-		verify_html : false
-	};
+			if (n == 'unload') {
+				tinymce.unloads.unshift({func : cb});
+				return cb;
+			}
 
-	this.vElements = tinyMCE.clearArray(new Array());
-	this.vElementsRe = '';
-	this.closeElementsRe = /^(IMG|BR|HR|LINK|META|BASE|INPUT|AREA)$/;
-	this.codeElementsRe = /^(SCRIPT|STYLE)$/;
-	this.serializationId = 0;
-	this.mceAttribs = {
-		href : 'mce_href',
-		src : 'mce_src',
-		type : 'mce_type'
-	};
-}
+			if (n == 'init') {
+				if (t.domLoaded)
+					cb();
+				else
+					t.inits.push(cb);
 
-TinyMCE_Cleanup.prototype = {
-	init : function(s) {
-		var n, a, i, ir, or, st;
-
-		for (n in s)
-			this.settings[n] = s[n];
-
-		// Setup code formating
-		s = this.settings;
-
-		// Setup regexps
-		this.inRe = this._arrayToRe(s.indent_elements.split(','), '', '^<(', ')[^>]*');
-		this.ouRe = this._arrayToRe(s.indent_elements.split(','), '', '^<\\/(', ')[^>]*');
-		this.nlBeforeRe = this._arrayToRe(s.newline_before_elements.split(','), 'gi', '<(',  ')([^>]*)>');
-		this.nlAfterRe = this._arrayToRe(s.newline_after_elements.split(','), 'gi', '<(',  ')([^>]*)>');
-		this.nlBeforeAfterRe = this._arrayToRe(s.newline_before_after_elements.split(','), 'gi', '<(\\/?)(', ')([^>]*)>');
-		this.serializedNodes = [];
-
-		if (s.invalid_elements != '')
-			this.iveRe = this._arrayToRe(s.invalid_elements.toUpperCase().split(','), 'g', '^(', ')$');
-		else
-			this.iveRe = null;
-
-		// Setup separator
-		st = '';
-		for (i=0; i<s.indent_levels; i++)
-			st += s.indent_char;
-
-		this.inStr = st;
-
-		// If verify_html if false force *[*]
-		if (!s.verify_html) {
-			s.valid_elements = '*[*]';
-			s.extended_valid_elements = '';
-		}
+				return cb;
+			}
 
-		this.fillStr = s.entity_encoding == "named" ? "&nbsp;" : "&#160;";
-		this.idCount = 0;
-	},
+			// Store away listener reference
+			el.push({
+				obj : o,
+				name : n,
+				func : f,
+				cfunc : cb,
+				scope : s
+			});
 
-	addRuleStr : function(s) {
-		var r = this.parseRuleStr(s);
-		var n;
+			t._add(o, n, cb);
 
-		for (n in r) {
-			if (r[n])
-				this.rules[n] = r[n];
-		}
+			return f;
+		},
 
-		this.vElements = tinyMCE.clearArray(new Array());
+		remove : function(o, n, f) {
+			var t = this, a = t.events, s = false, r;
 
-		for (n in this.rules) {
-			if (this.rules[n])
-				this.vElements[this.vElements.length] = this.rules[n].tag;
-		}
+			// Handle array
+			if (o && o.hasOwnProperty && o instanceof Array) {
+				r = [];
 
-		this.vElementsRe = this._arrayToRe(this.vElements, '');
-	},
+				each(o, function(o) {
+					o = DOM.get(o);
+					r.push(t.remove(o, n, f));
+				});
 
-	isValid : function(n) {
-		this._setupRules(); // Will initialize cleanup rules
+				return r;
+			}
 
-		// Clean the name up a bit
-		n = n.replace(/[^a-z0-9]+/gi, '').toUpperCase();
+			o = DOM.get(o);
 
-		return !tinyMCE.getParam('cleanup') || this.vElementsRe.test(n);
-	},
+			each(a, function(e, i) {
+				if (e.obj == o && e.name == n && (!f || (e.func == f || e.cfunc == f))) {
+					a.splice(i, 1);
+					t._remove(o, n, e.cfunc);
+					s = true;
+					return false;
+				}
+			});
 
-	addChildRemoveRuleStr : function(s) {
-		var x, y, p, i, t, tn, ta, cl, r;
+			return s;
+		},
 
-		if (!s)
-			return;
+		clear : function(o) {
+			var t = this, a = t.events, i, e;
 
-		ta = s.split(',');
-		for (x=0; x<ta.length; x++) {
-			s = ta[x];
-
-			// Split tag/children
-			p = this.split(/\[|\]/, s);
-			if (p == null || p.length < 1)
-				t = s.toUpperCase();
-			else
-				t = p[0].toUpperCase();
+			if (o) {
+				o = DOM.get(o);
 
-			// Handle all tag names
-			tn = this.split('/', t);
-			for (y=0; y<tn.length; y++) {
-				r = "^(";
-
-				// Build regex
-				cl = this.split(/\|/, p[1]);
-				for (i=0; i<cl.length; i++) {
-					if (cl[i] == '%istrict')
-						r += tinyMCE.inlineStrict;
-					else if (cl[i] == '%itrans')
-						r += tinyMCE.inlineTransitional;
-					else if (cl[i] == '%istrict_na')
-						r += tinyMCE.inlineStrict.substring(2);
-					else if (cl[i] == '%itrans_na')
-						r += tinyMCE.inlineTransitional.substring(2);
-					else if (cl[i] == '%btrans')
-						r += tinyMCE.blockElms;
-					else if (cl[i] == '%strict')
-						r += tinyMCE.blockStrict;
-					else
-						r += (cl[i].charAt(0) != '#' ? cl[i].toUpperCase() : cl[i]);
+				for (i = a.length - 1; i >= 0; i--) {
+					e = a[i];
 
-					r += (i != cl.length - 1 ? '|' : '');
+					if (e.obj === o) {
+						t._remove(e.obj, e.name, e.cfunc);
+						e.obj = e.cfunc = null;
+						a.splice(i, 1);
+					}
 				}
+			}
+		},
 
-				r += ')$';
-//tinyMCE.debug(t + "=" + r);
-				if (this.childRules == null)
-					this.childRules = tinyMCE.clearArray(new Array());
+		cancel : function(e) {
+			if (!e)
+				return false;
 
-				this.childRules[tn[y]] = new RegExp(r);
+			this.stop(e);
 
-				if (p.length > 1)
-					this.childRules[tn[y]].wrapTag = p[2];
-			}
-		}
-	},
+			return this.prevent(e);
+		},
 
-	parseRuleStr : function(s) {
-		var ta, p, r, a, i, x, px, t, tn, y, av, or = tinyMCE.clearArray(new Array()), dv;
+		stop : function(e) {
+			if (e.stopPropagation)
+				e.stopPropagation();
+			else
+				e.cancelBubble = true;
 
-		if (s == null || s.length == 0)
-			return or;
+			return false;
+		},
 
-		ta = s.split(',');
-		for (x=0; x<ta.length; x++) {
-			s = ta[x];
-			if (s.length == 0)
-				continue;
-
-			// Split tag/attrs
-			p = this.split(/\[|\]/, s);
-			if (p == null || p.length < 1)
-				t = s.toUpperCase();
+		prevent : function(e) {
+			if (e.preventDefault)
+				e.preventDefault();
 			else
-				t = p[0].toUpperCase();
+				e.returnValue = false;
 
-			// Handle all tag names
-			tn = this.split('/', t);
-			for (y=0; y<tn.length; y++) {
-				r = {};
-
-				r.tag = tn[y];
-				r.forceAttribs = null;
-				r.defaultAttribs = null;
-				r.validAttribValues = null;
-
-				// Handle prefixes
-				px = r.tag.charAt(0);
-				r.forceOpen = px == '+';
-				r.removeEmpty = px == '-';
-				r.fill = px == '#';
-				r.tag = r.tag.replace(/\+|-|#/g, '');
-				r.oTagName = tn[0].replace(/\+|-|#/g, '').toLowerCase();
-				r.isWild = new RegExp('\\*|\\?|\\+', 'g').test(r.tag);
-				r.validRe = new RegExp(this._wildcardToRe('^' + r.tag + '$'));
+			return false;
+		},
 
-				// Setup valid attributes
-				if (p.length > 1) {
-					r.vAttribsRe = '^(';
-					a = this.split(/\|/, p[1]);
+		destroy : function() {
+			var t = this;
 
-					for (i=0; i<a.length; i++) {
-						t = a[i];
+			each(t.events, function(e, i) {
+				t._remove(e.obj, e.name, e.cfunc);
+				e.obj = e.cfunc = null;
+			});
 
-						if (t.charAt(0) == '!') {
-							a[i] = t = t.substring(1);
+			t.events = [];
+			t = null;
+		},
+
+		_add : function(o, n, f) {
+			if (o.attachEvent)
+				o.attachEvent('on' + n, f);
+			else if (o.addEventListener)
+				o.addEventListener(n, f, false);
+			else
+				o['on' + n] = f;
+		},
 
-							if (!r.reqAttribsRe)
-								r.reqAttribsRe = '\\s+(' + t;
-							else
-								r.reqAttribsRe += '|' + t;
-						}
+		_remove : function(o, n, f) {
+			if (o) {
+				try {
+					if (o.detachEvent)
+						o.detachEvent('on' + n, f);
+					else if (o.removeEventListener)
+						o.removeEventListener(n, f, false);
+					else
+						o['on' + n] = null;
+				} catch (ex) {
+					// Might fail with permission denined on IE so we just ignore that
+				}
+			}
+		},
+
+		_pageInit : function(win) {
+			var t = this;
 
-						av = new RegExp('(=|:|<)(.*?)$').exec(t);
-						t = t.replace(new RegExp('(=|:|<).*?$'), '');
-						if (av && av.length > 0) {
-							if (av[0].charAt(0) == ':') {
-								if (!r.forceAttribs)
-									r.forceAttribs = tinyMCE.clearArray(new Array());
+			// Keep it from running more than once
+			if (t.domLoaded)
+				return;
 
-								r.forceAttribs[t.toLowerCase()] = av[0].substring(1);
-							} else if (av[0].charAt(0) == '=') {
-								if (!r.defaultAttribs)
-									r.defaultAttribs = tinyMCE.clearArray(new Array());
+			t.domLoaded = true;
 
-								dv = av[0].substring(1);
+			each(t.inits, function(c) {
+				c();
+			});
 
-								r.defaultAttribs[t.toLowerCase()] = dv == "" ? "mce_empty" : dv;
-							} else if (av[0].charAt(0) == '<') {
-								if (!r.validAttribValues)
-									r.validAttribValues = tinyMCE.clearArray(new Array());
+			t.inits = [];
+		},
 
-								r.validAttribValues[t.toLowerCase()] = this._arrayToRe(this.split('?', av[0].substring(1)), 'i');
-							}
-						}
+		_wait : function(win) {
+			var t = this, doc = win.document;
 
-						r.vAttribsRe += '' + t.toLowerCase() + (i != a.length - 1 ? '|' : '');
+			// No need since the document is already loaded
+			if (win.tinyMCE_GZ && tinyMCE_GZ.loaded) {
+				t.domLoaded = 1;
+				return;
+			}
 
-						a[i] = t.toLowerCase();
+			// Use IE method
+			if (doc.attachEvent) {
+				doc.attachEvent("onreadystatechange", function() {
+					if (doc.readyState === "complete") {
+						doc.detachEvent("onreadystatechange", arguments.callee);
+						t._pageInit(win);
 					}
+				});
 
-					if (r.reqAttribsRe)
-						r.reqAttribsRe = new RegExp(r.reqAttribsRe + ')=\"', 'g');
+				if (doc.documentElement.doScroll && win == win.top) {
+					(function() {
+						if (t.domLoaded)
+							return;
 
-					r.vAttribsRe += ')$';
-					r.vAttribsRe = this._wildcardToRe(r.vAttribsRe);
-					r.vAttribsReIsWild = new RegExp('\\*|\\?|\\+', 'g').test(r.vAttribsRe);
-					r.vAttribsRe = new RegExp(r.vAttribsRe);
-					r.vAttribs = a.reverse();
+						try {
+							// If IE is used, use the trick by Diego Perini
+							// http://javascript.nwbox.com/IEContentLoaded/
+							doc.documentElement.doScroll("left");
+						} catch (ex) {
+							setTimeout(arguments.callee, 0);
+							return;
+						}
 
-					//tinyMCE.debug(r.tag, r.oTagName, r.vAttribsRe, r.vAttribsReWC);
-				} else {
-					r.vAttribsRe = '';
-					r.vAttribs = tinyMCE.clearArray(new Array());
-					r.vAttribsReIsWild = false;
+						t._pageInit(win);
+					})();
 				}
-
-				or[r.tag] = r;
+			} else if (doc.addEventListener) {
+				t._add(win, 'DOMContentLoaded', function() {
+					t._pageInit(win);
+				});
 			}
-		}
-
-		return or;
-	},
-
-	serializeNodeAsXML : function(n) {
-		var s, b;
 
-		if (!this.xmlDoc) {
-			if (this.isIE) {
-				try {this.xmlDoc = new ActiveXObject('MSXML2.DOMDocument');} catch (e) {}
+			t._add(win, 'load', function() {
+				t._pageInit(win);
+			});
+		},
 
-				if (!this.xmlDoc)
-					try {this.xmlDoc = new ActiveXObject('Microsoft.XmlDom');} catch (e) {}
-			} else
-				this.xmlDoc = document.implementation.createDocument('', '', null);
+		_stoppers : {
+			preventDefault :  function() {
+				this.returnValue = false;
+			},
 
-			if (!this.xmlDoc)
-				alert("Error XML Parser could not be found.");
+			stopPropagation : function() {
+				this.cancelBubble = true;
+			}
 		}
 
-		if (this.xmlDoc.firstChild)
-			this.xmlDoc.removeChild(this.xmlDoc.firstChild);
+		});
 
-		b = this.xmlDoc.createElement("html");
-		b = this.xmlDoc.appendChild(b);
+	// Shorten name and setup global instance
+	Event = tinymce.dom.Event = new tinymce.dom.EventUtils();
 
-		this._convertToXML(n, b);
+	// Dispatch DOM content loaded event for IE and Safari
+	Event._wait(window);
 
-		if (this.isIE)
-			return this.xmlDoc.xml;
-		else
-			return new XMLSerializer().serializeToString(this.xmlDoc);
-	},
+	tinymce.addUnload(function() {
+		Event.destroy();
+	});
+})(tinymce);
+(function(tinymce) {
+	var each = tinymce.each;
+
+	tinymce.create('tinymce.dom.Element', {
+		Element : function(id, s) {
+			var t = this, dom, el;
+
+			s = s || {};
+			t.id = id;
+			t.dom = dom = s.dom || tinymce.DOM;
+			t.settings = s;
+
+			// Only IE leaks DOM references, this is a lot faster
+			if (!tinymce.isIE)
+				el = t.dom.get(t.id);
+
+			each([
+				'getPos',
+				'getRect',
+				'getParent',
+				'add',
+				'setStyle',
+				'getStyle',
+				'setStyles',
+				'setAttrib',
+				'setAttribs',
+				'getAttrib',
+				'addClass',
+				'removeClass',
+				'hasClass',
+				'getOuterHTML',
+				'setOuterHTML',
+				'remove',
+				'show',
+				'hide',
+				'isHidden',
+				'setHTML',
+				'get'
+			], function(k) {
+				t[k] = function() {
+					var a = [id], i;
 
-	_convertToXML : function(n, xn) {
-		var xd, el, i, l, cn, at, no, hc = false;
+					for (i = 0; i < arguments.length; i++)
+						a.push(arguments[i]);
 
-		if (this._isDuplicate(n))
-			return;
+					a = dom[k].apply(dom, a);
+					t.update(k);
 
-		xd = this.xmlDoc;
+					return a;
+				};
+			});
+		},
 
-		switch (n.nodeType) {
-			case 1: // Element
-				hc = n.hasChildNodes();
+		on : function(n, f, s) {
+			return tinymce.dom.Event.add(this.id, n, f, s);
+		},
+
+		getXY : function() {
+			return {
+				x : parseInt(this.getStyle('left')),
+				y : parseInt(this.getStyle('top'))
+			};
+		},
 
-				el = xd.createElement(n.nodeName.toLowerCase());
+		getSize : function() {
+			var n = this.dom.get(this.id);
 
-				at = n.attributes;
-				for (i=at.length-1; i>-1; i--) {
-					no = at[i];
+			return {
+				w : parseInt(this.getStyle('width') || n.clientWidth),
+				h : parseInt(this.getStyle('height') || n.clientHeight)
+			};
+		},
 
-					if (no.specified && no.nodeValue)
-						el.setAttribute(no.nodeName.toLowerCase(), no.nodeValue);
-				}
+		moveTo : function(x, y) {
+			this.setStyles({left : x, top : y});
+		},
 
-				if (!hc && !this.closeElementsRe.test(n.nodeName))
-					el.appendChild(xd.createTextNode(""));
+		moveBy : function(x, y) {
+			var p = this.getXY();
 
-				xn = xn.appendChild(el);
-				break;
+			this.moveTo(p.x + x, p.y + y);
+		},
 
-			case 3: // Text
-				xn.appendChild(xd.createTextNode(n.nodeValue));
-				return;
+		resizeTo : function(w, h) {
+			this.setStyles({width : w, height : h});
+		},
 
-			case 8: // Comment
-				xn.appendChild(xd.createComment(n.nodeValue));
-				return;
-		}
+		resizeBy : function(w, h) {
+			var s = this.getSize();
 
-		if (hc) {
-			cn = n.childNodes;
+			this.resizeTo(s.w + w, s.h + h);
+		},
 
-			for (i=0, l=cn.length; i<l; i++)
-				this._convertToXML(cn[i], xn);
-		}
-	},
+		update : function(k) {
+			var t = this, b, dom = t.dom;
 
-	serializeNodeAsHTML : function(n, inn) {
-		var en, no, h = '', i, l, t, st, r, cn, va = false, f = false, at, hc, cr;
+			if (tinymce.isIE6 && t.settings.blocker) {
+				k = k || '';
 
-		this._setupRules(); // Will initialize cleanup rules
+				// Ignore getters
+				if (k.indexOf('get') === 0 || k.indexOf('has') === 0 || k.indexOf('is') === 0)
+					return;
 
-		if (this._isDuplicate(n))
-			return '';
+				// Remove blocker on remove
+				if (k == 'remove') {
+					dom.remove(t.blocker);
+					return;
+				}
 
-		// Skip non valid child elements
-		if (n.parentNode && this.childRules != null) {
-			cr = this.childRules[n.parentNode.nodeName];
+				if (!t.blocker) {
+					t.blocker = dom.uniqueId();
+					b = dom.add(t.settings.container || dom.getRoot(), 'iframe', {id : t.blocker, style : 'position:absolute;', frameBorder : 0, src : 'javascript:""'});
+					dom.setStyle(b, 'opacity', 0);
+				} else
+					b = dom.get(t.blocker);
 
-			if (typeof(cr) != "undefined" && !cr.test(n.nodeName)) {
-				st = true;
-				t = null;
+				dom.setStyle(b, 'left', t.getStyle('left', 1));
+				dom.setStyle(b, 'top', t.getStyle('top', 1));
+				dom.setStyle(b, 'width', t.getStyle('width', 1));
+				dom.setStyle(b, 'height', t.getStyle('height', 1));
+				dom.setStyle(b, 'display', t.getStyle('display', 1));
+				dom.setStyle(b, 'zIndex', parseInt(t.getStyle('zIndex', 1) || 0) - 1);
 			}
 		}
 
-		switch (n.nodeType) {
-			case 1: // Element
-				hc = n.hasChildNodes();
+		});
+})(tinymce);
+(function(tinymce) {
+	function trimNl(s) {
+		return s.replace(/[\n\r]+/g, '');
+	};
 
-				if (st)
-					break;
+	// Shorten names
+	var is = tinymce.is, isIE = tinymce.isIE, each = tinymce.each;
 
-				// MSIE sometimes produces <//tag>
-				if ((tinyMCE.isRealIE) && n.nodeName.indexOf('/') != -1)
-					break;
+	tinymce.create('tinymce.dom.Selection', {
+		Selection : function(dom, win, serializer) {
+			var t = this;
+
+			t.dom = dom;
+			t.win = win;
+			t.serializer = serializer;
+
+			// Add events
+			each([
+				'onBeforeSetContent',
+				'onBeforeGetContent',
+				'onSetContent',
+				'onGetContent'
+			], function(e) {
+				t[e] = new tinymce.util.Dispatcher(t);
+			});
 
-				if (this.vElementsRe.test(n.nodeName) && (!this.iveRe || !this.iveRe.test(n.nodeName)) && !inn) {
-					va = true;
+			// No W3C Range support
+			if (!t.win.getSelection)
+				t.tridentSel = new tinymce.dom.TridentSelection(t);
+
+			// Prevent leaks
+			tinymce.addUnload(t.destroy, t);
+		},
+
+		getContent : function(s) {
+			var t = this, r = t.getRng(), e = t.dom.create("body"), se = t.getSel(), wb, wa, n;
+
+			s = s || {};
+			wb = wa = '';
+			s.get = true;
+			s.format = s.format || 'html';
+			t.onBeforeGetContent.dispatch(t, s);
+
+			if (s.format == 'text')
+				return t.isCollapsed() ? '' : (r.text || (se.toString ? se.toString() : ''));
+
+			if (r.cloneContents) {
+				n = r.cloneContents();
+
+				if (n)
+					e.appendChild(n);
+			} else if (is(r.item) || is(r.htmlText))
+				e.innerHTML = r.item ? r.item(0).outerHTML : r.htmlText;
+			else
+				e.innerHTML = r.toString();
 
-					r = this.rules[n.nodeName];
-					if (!r) {
-						at = this.rules;
-						for (no in at) {
-							if (at[no] && at[no].validRe.test(n.nodeName)) {
-								r = at[no];
-								break;
-							}
-						}
-					}
+			// Keep whitespace before and after
+			if (/^\s/.test(e.innerHTML))
+				wb = ' ';
 
-					en = r.isWild ? n.nodeName.toLowerCase() : r.oTagName;
-					f = r.fill;
+			if (/\s+$/.test(e.innerHTML))
+				wa = ' ';
 
-					if (r.removeEmpty && !hc)
-						return "";
+			s.getInner = true;
 
-					t = '<' + en;
+			s.content = t.isCollapsed() ? '' : wb + t.serializer.serialize(e, s) + wa;
+			t.onGetContent.dispatch(t, s);
 
-					if (r.vAttribsReIsWild) {
-						// Serialize wildcard attributes
-						at = n.attributes;
-						for (i=at.length-1; i>-1; i--) {
-							no = at[i];
-							if (no.specified && r.vAttribsRe.test(no.nodeName))
-								t += this._serializeAttribute(n, r, no.nodeName);
-						}
-					} else {
-						// Serialize specific attributes
-						for (i=r.vAttribs.length-1; i>-1; i--)
-							t += this._serializeAttribute(n, r, r.vAttribs[i]);
-					}
+			return s.content;
+		},
 
-					// Serialize mce_ atts
-					if (!this.settings.on_save) {
-						at = this.mceAttribs;
+		setContent : function(h, s) {
+			var t = this, r = t.getRng(), c, d = t.win.document;
 
-						for (no in at) {
-							if (at[no])
-								t += this._serializeAttribute(n, r, at[no]);
-						}
-					}
+			s = s || {format : 'html'};
+			s.set = true;
+			h = s.content = t.dom.processHTML(h);
 
-					// Check for required attribs
-					if (r.reqAttribsRe && !t.match(r.reqAttribsRe))
-						t = null;
+			// Dispatch before set content event
+			t.onBeforeSetContent.dispatch(t, s);
+			h = s.content;
 
-					// Close these
-					if (t != null && this.closeElementsRe.test(n.nodeName))
-						return t + ' />';
+			if (r.insertNode) {
+				// Make caret marker since insertNode places the caret in the beginning of text after insert
+				h += '<span id="__caret">_</span>';
 
-					if (t != null)
-						h += t + '>';
+				// Delete and insert new node
+				r.deleteContents();
+				r.insertNode(t.getRng().createContextualFragment(h));
 
-					if (this.isIE && this.codeElementsRe.test(n.nodeName))
-						h += n.innerHTML;
-				}
-			break;
+				// Move to caret marker
+				c = t.dom.get('__caret');
 
-			case 3: // Text
-				if (st)
-					break;
+				// Make sure we wrap it compleatly, Opera fails with a simple select call
+				r = d.createRange();
+				r.setStartBefore(c);
+				r.setEndAfter(c);
+				t.setRng(r);
 
-				if (n.parentNode && this.codeElementsRe.test(n.parentNode.nodeName))
-					return this.isIE ? '' : n.nodeValue;
+				// Delete the marker, and hopefully the caret gets placed in the right location
+				// Removed this since it seems to remove &nbsp; in FF and simply deleting it
+				// doesn't seem to affect the caret position in any browser
+				//d.execCommand('Delete', false, null);
 
-				return this.xmlEncode(n.nodeValue);
+				// Remove the caret position
+				t.dom.remove('__caret');
+			} else {
+				if (r.item) {
+					// Delete content and get caret text selection
+					d.execCommand('Delete', false, null);
+					r = t.getRng();
+				}
 
-			case 8: // Comment
-				if (st)
-					break;
+				r.pasteHTML(h);
+			}
 
-				return "<!--" + this._trimComment(n.nodeValue) + "-->";
-		}
+			// Dispatch set content event
+			t.onSetContent.dispatch(t, s);
+		},
 
-		if (hc) {
-			cn = n.childNodes;
+		getStart : function() {
+			var t = this, r = t.getRng(), e;
 
-			for (i=0, l=cn.length; i<l; i++)
-				h += this.serializeNodeAsHTML(cn[i]);
-		}
+			if (isIE) {
+				if (r.item)
+					return r.item(0);
 
-		// Fill empty nodes
-		if (f && !hc)
-			h += this.fillStr;
+				r = r.duplicate();
+				r.collapse(1);
+				e = r.parentElement();
 
-		// End element
-		if (t != null && va)
-			h += '</' + en + '>';
+				if (e && e.nodeName == 'BODY')
+					return e.firstChild;
 
-		return h;
-	},
+				return e;
+			} else {
+				e = r.startContainer;
 
-	_serializeAttribute : function(n, r, an) {
-		var av = '', t, os = this.settings.on_save;
+				if (e.nodeName == 'BODY')
+					return e.firstChild;
 
-		if (os && (an.indexOf('mce_') == 0 || an.indexOf('_moz') == 0))
-			return '';
+				return t.dom.getParent(e, '*');
+			}
+		},
 
-		if (os && this.mceAttribs[an])
-			av = this._getAttrib(n, this.mceAttribs[an]);
+		getEnd : function() {
+			var t = this, r = t.getRng(), e;
 
-		if (av.length == 0)
-			av = this._getAttrib(n, an);
+			if (isIE) {
+				if (r.item)
+					return r.item(0);
 
-		if (av.length == 0 && r.defaultAttribs && (t = r.defaultAttribs[an])) {
-			av = t;
+				r = r.duplicate();
+				r.collapse(0);
+				e = r.parentElement();
 
-			if (av == "mce_empty")
-				return " " + an + '=""';
-		}
+				if (e && e.nodeName == 'BODY')
+					return e.lastChild;
 
-		if (r.forceAttribs && (t = r.forceAttribs[an]))
-			av = t;
+				return e;
+			} else {
+				e = r.endContainer;
 
-		if (os && av.length != 0 && this.settings.url_converter.length != 0 && /^(src|href|longdesc)$/.test(an))
-			av = eval(this.settings.url_converter + '(this, n, av)');
+				if (e.nodeName == 'BODY')
+					return e.lastChild;
 
-		if (av.length != 0 && r.validAttribValues && r.validAttribValues[an] && !r.validAttribValues[an].test(av))
-			return "";
+				return t.dom.getParent(e, '*');
+			}
+		},
 
-		if (av.length != 0 && av == "{$uid}")
-			av = "uid_" + (this.idCount++);
+		getBookmark : function(si) {
+			var t = this, r = t.getRng(), tr, sx, sy, vp = t.dom.getViewPort(t.win), e, sp, bp, le, c = -0xFFFFFF, s, ro = t.dom.getRoot(), wb = 0, wa = 0, nv;
+			sx = vp.x;
+			sy = vp.y;
 
-		if (av.length != 0) {
-			if (an.indexOf('on') != 0)
-				av = this.xmlEncode(av);
+			// Simple bookmark fast but not as persistent
+			if (si)
+				return {rng : r, scrollX : sx, scrollY : sy};
 
-			return " " + an + "=" + '"' + av + '"';
-		}
+			// Handle IE
+			if (isIE) {
+				// Control selection
+				if (r.item) {
+					e = r.item(0);
 
-		return "";
-	},
+					each(t.dom.select(e.nodeName), function(n, i) {
+						if (e == n) {
+							sp = i;
+							return false;
+						}
+					});
 
-	formatHTML : function(h) {
-		var s = this.settings, p = '', i = 0, li = 0, o = '', l;
+					return {
+						tag : e.nodeName,
+						index : sp,
+						scrollX : sx,
+						scrollY : sy
+					};
+				}
+
+				// Text selection
+				tr = t.dom.doc.body.createTextRange();
+				tr.moveToElementText(ro);
+				tr.collapse(true);
+				bp = Math.abs(tr.move('character', c));
+
+				tr = r.duplicate();
+				tr.collapse(true);
+				sp = Math.abs(tr.move('character', c));
+
+				tr = r.duplicate();
+				tr.collapse(false);
+				le = Math.abs(tr.move('character', c)) - sp;
 
-		// Replace BR in pre elements to \n
-		h = h.replace(/<pre([^>]*)>(.*?)<\/pre>/gi, function (a, b, c) {
-			c = c.replace(/<br\s*\/>/gi, '\n');
-			return '<pre' + b + '>' + c + '</pre>';
-		});
+				return {
+					start : sp - bp,
+					length : le,
+					scrollX : sx,
+					scrollY : sy
+				};
+			}
 
-		h = h.replace(/\r/g, ''); // Windows sux, isn't carriage return a thing of the past :)
-		h = '\n' + h;
-		h = h.replace(new RegExp('\\n\\s+', 'gi'), '\n'); // Remove previous formatting
-		h = h.replace(this.nlBeforeRe, '\n<$1$2>');
-		h = h.replace(this.nlAfterRe, '<$1$2>\n');
-		h = h.replace(this.nlBeforeAfterRe, '\n<$1$2$3>\n');
-		h += '\n';
-
-		//tinyMCE.debug(h);
-
-		while ((i = h.indexOf('\n', i + 1)) != -1) {
-			if ((l = h.substring(li + 1, i)).length != 0) {
-				if (this.ouRe.test(l) && p.length >= s.indent_levels)
-					p = p.substring(s.indent_levels);
+			// Handle W3C
+			e = t.getNode();
+			s = t.getSel();
 
-				o += p + l + '\n';
-	
-				if (this.inRe.test(l))
-					p += this.inStr;
-			}
-
-			li = i;
-		}
-
-		//tinyMCE.debug(h);
+			if (!s)
+				return null;
 
-		return o;
-	},
+			// Image selection
+			if (e && e.nodeName == 'IMG') {
+				return {
+					scrollX : sx,
+					scrollY : sy
+				};
+			}
 
-	xmlEncode : function(s) {
-		var cl = this;
+			// Text selection
 
-		this._setupEntities(); // Will intialize lookup table
+			function getPos(r, sn, en) {
+				var w = t.dom.doc.createTreeWalker(r, NodeFilter.SHOW_TEXT, null, false), n, p = 0, d = {};
 
-		switch (this.settings.entity_encoding) {
-			case "raw":
-				return tinyMCE.xmlEncode(s);
+				while ((n = w.nextNode()) != null) {
+					if (n == sn)
+						d.start = p;
 
-			case "named":
-				return s.replace(new RegExp('[\u007F-\uFFFF<>&"\']', 'g'), function (c, b) {
-					b = cl.entities[c.charCodeAt(0)];
+					if (n == en) {
+						d.end = p;
+						return d;
+					}
 
-					return b ? '&' + b + ';' : c;
-				});
+					p += trimNl(n.nodeValue || '').length;
+				}
 
-			case "numeric":
-				return s.replace(new RegExp('[\u007F-\uFFFF<>&"\']', 'g'), function (c, b) {
-					return b ? '&#' + c.charCodeAt(0) + ';' : c;
-				});
-		}
+				return null;
+			};
 
-		return s;
-	},
+			// Caret or selection
+			if (s.anchorNode == s.focusNode && s.anchorOffset == s.focusOffset) {
+				e = getPos(ro, s.anchorNode, s.focusNode);
 
-	split : function(re, s) {
-		var c = s.split(re);
-		var i, l, o = new Array();
-
-		for (i=0, l=c.length; i<l; i++) {
-			if (c[i] != '')
-				o[i] = c[i];
-		}
+				if (!e)
+					return {scrollX : sx, scrollY : sy};
 
-		return o;
-	},
+				// Count whitespace before
+				trimNl(s.anchorNode.nodeValue || '').replace(/^\s+/, function(a) {wb = a.length;});
 
-	_trimComment : function(s) {
-		// Remove mce_src, mce_href
-		s = s.replace(new RegExp('\\smce_src=\"[^\"]*\"', 'gi'), "");
-		s = s.replace(new RegExp('\\smce_href=\"[^\"]*\"', 'gi'), "");
+				return {
+					start : Math.max(e.start + s.anchorOffset - wb, 0),
+					end : Math.max(e.end + s.focusOffset - wb, 0),
+					scrollX : sx,
+					scrollY : sy,
+					beg : s.anchorOffset - wb == 0
+				};
+			} else {
+				e = getPos(ro, r.startContainer, r.endContainer);
 
-		return s;
-	},
+				// Count whitespace before start and end container
+				//(r.startContainer.nodeValue || '').replace(/^\s+/, function(a) {wb = a.length;});
+				//(r.endContainer.nodeValue || '').replace(/^\s+/, function(a) {wa = a.length;});
 
-	_getAttrib : function(e, n, d) {
-		if (typeof(d) == "undefined")
-			d = "";
+				if (!e)
+					return {scrollX : sx, scrollY : sy};
 
-		if (!e || e.nodeType != 1)
-			return d;
+				return {
+					start : Math.max(e.start + r.startOffset - wb, 0),
+					end : Math.max(e.end + r.endOffset - wa, 0),
+					scrollX : sx,
+					scrollY : sy,
+					beg : r.startOffset - wb == 0
+				};
+			}
+		},
 
-		var v = e.getAttribute(n, 0);
+		moveToBookmark : function(b) {
+			var t = this, r = t.getRng(), s = t.getSel(), ro = t.dom.getRoot(), sd, nvl, nv;
 
-		if (n == "class" && !v)
-			v = e.className;
+			function getPos(r, sp, ep) {
+				var w = t.dom.doc.createTreeWalker(r, NodeFilter.SHOW_TEXT, null, false), n, p = 0, d = {}, o, v, wa, wb;
 
-		if (this.isIE && n == "http-equiv")
-			v = e.httpEquiv;
+				while ((n = w.nextNode()) != null) {
+					wa = wb = 0;
 
-		if (this.isIE && e.nodeName == "FORM" && n == "enctype" && v == "application/x-www-form-urlencoded")
-			v = "";
+					nv = n.nodeValue || '';
+					//nv.replace(/^\s+[^\s]/, function(a) {wb = a.length - 1;});
+					//nv.replace(/[^\s]\s+$/, function(a) {wa = a.length - 1;});
 
-		if (this.isIE && e.nodeName == "INPUT" && n == "size" && v == "20")
-			v = "";
+					nvl = trimNl(nv).length;
+					p += nvl;
 
-		if (this.isIE && e.nodeName == "INPUT" && n == "maxlength" && v == "2147483647")
-			v = "";
+					if (p >= sp && !d.startNode) {
+						o = sp - (p - nvl);
 
-		if (n == "style" && !tinyMCE.isOpera)
-			v = e.style.cssText;
+						// Fix for odd quirk in FF
+						if (b.beg && o >= nvl)
+							continue;
 
-		if (n == 'style')
-			v = tinyMCE.serializeStyle(tinyMCE.parseStyle(v));
+						d.startNode = n;
+						d.startOffset = o + wb;
+					}
 
-		if (this.settings.on_save && n.indexOf('on') != -1 && this.settings.on_save && v && v != "")
-			v = tinyMCE.cleanupEventStr(v);
+					if (p >= ep) {
+						d.endNode = n;
+						d.endOffset = ep - (p - nvl) + wb;
+						return d;
+					}
+				}
 
-		return (v && v != "") ? '' + v : d;
-	},
+				return null;
+			};
 
-	_urlConverter : function(c, n, v) {
-		if (!c.settings.on_save)
-			return tinyMCE.convertRelativeToAbsoluteURL(tinyMCE.settings.base_href, v);
-		else if (tinyMCE.getParam('convert_urls'))
-			return eval(tinyMCE.settings.urlconverter_callback + "(v, n, true);");
+			if (!b)
+				return false;
 
-		return v;
-	},
+			t.win.scrollTo(b.scrollX, b.scrollY);
 
-	_arrayToRe : function(a, op, be, af) {
-		var i, r;
+			// Handle explorer
+			if (isIE) {
+				// Handle simple
+				if (r = b.rng) {
+					try {
+						r.select();
+					} catch (ex) {
+						// Ignore
+					}
 
-		op = typeof(op) == "undefined" ? "gi" : op;
-		be = typeof(be) == "undefined" ? "^(" : be;
-		af = typeof(af) == "undefined" ? ")$" : af;
+					return true;
+				}
 
-		r = be;
+				t.win.focus();
 
-		for (i=0; i<a.length; i++)
-			r += this._wildcardToRe(a[i]) + (i != a.length-1 ? "|" : "");
+				// Handle control bookmark
+				if (b.tag) {
+					r = ro.createControlRange();
+
+					each(t.dom.select(b.tag), function(n, i) {
+						if (i == b.index)
+							r.addElement(n);
+					});
+				} else {
+					// Try/catch needed since this operation breaks when TinyMCE is placed in hidden divs/tabs
+					try {
+						// Incorrect bookmark
+						if (b.start < 0)
+							return true;
 
-		r += af;
+						r = s.createRange();
+						r.moveToElementText(ro);
+						r.collapse(true);
+						r.moveStart('character', b.start);
+						r.moveEnd('character', b.length);
+					} catch (ex2) {
+						return true;
+					}
+				}
 
-		return new RegExp(r, op);
-	},
+				try {
+					r.select();
+				} catch (ex) {
+					// Needed for some odd IE bug #1843306
+				}
 
-	_wildcardToRe : function(s) {
-		s = s.replace(/\?/g, '(\\S?)');
-		s = s.replace(/\+/g, '(\\S+)');
-		s = s.replace(/\*/g, '(\\S*)');
+				return true;
+			}
 
-		return s;
-	},
+			// Handle W3C
+			if (!s)
+				return false;
 
-	_setupEntities : function() {
-		var n, a, i, s = this.settings;
+			// Handle simple
+			if (b.rng) {
+				s.removeAllRanges();
+				s.addRange(b.rng);
+			} else {
+				if (is(b.start) && is(b.end)) {
+					try {
+						sd = getPos(ro, b.start, b.end);
 
-		// Setup entities
-		if (!this.entitiesDone) {
-			if (s.entity_encoding == "named") {
-				n = tinyMCE.clearArray(new Array());
-				a = this.split(',', s.entities);
-				for (i=0; i<a.length; i+=2)
-					n[a[i]] = a[i+1];
+						if (sd) {
+							r = t.dom.doc.createRange();
+							r.setStart(sd.startNode, sd.startOffset);
+							r.setEnd(sd.endNode, sd.endOffset);
+							s.removeAllRanges();
+							s.addRange(r);
+						}
 
-				this.entities = n;
+						if (!tinymce.isOpera)
+							t.win.focus();
+					} catch (ex) {
+						// Ignore
+					}
+				}
 			}
+		},
 
-			this.entitiesDone = true;
-		}
-	},
-
-	_setupRules : function() {
-		var s = this.settings;
+		select : function(n, c) {
+			var t = this, r = t.getRng(), s = t.getSel(), b, fn, ln, d = t.win.document;
 
-		// Setup default rule
-		if (!this.rulesDone) {
-			this.addRuleStr(s.valid_elements);
-			this.addRuleStr(s.extended_valid_elements);
-			this.addChildRemoveRuleStr(s.valid_child_elements);
+			function find(n, start) {
+				var walker, o;
 
-			this.rulesDone = true;
-		}
-	},
+				if (n) {
+					walker = d.createTreeWalker(n, NodeFilter.SHOW_TEXT, null, false);
 
-	_isDuplicate : function(n) {
-		var i;
+					// Find first/last non empty text node
+					while (n = walker.nextNode()) {
+						o = n;
 
-		if (!this.settings.fix_content_duplication)
-			return false;
+						if (tinymce.trim(n.nodeValue).length != 0) {
+							if (start)
+								return n;
+							else
+								o = n;
+						}
+					}
+				}
 
-		if (tinyMCE.isRealIE && n.nodeType == 1) {
-			// Mark elements
-			if (n.mce_serialized == this.serializationId)
-				return true;
+				return o;
+			};
 
-			n.setAttribute('mce_serialized', this.serializationId);
-		} else {
-			// Search lookup table for text nodes  and comments
-			for (i=0; i<this.serializedNodes.length; i++) {
-				if (this.serializedNodes[i] == n)
-					return true;
-			}
+			if (isIE) {
+				try {
+					b = d.body;
 
-			this.serializedNodes[this.serializedNodes.length] = n;
-		}
+					if (/^(IMG|TABLE)$/.test(n.nodeName)) {
+						r = b.createControlRange();
+						r.addElement(n);
+					} else {
+						r = b.createTextRange();
+						r.moveToElementText(n);
+					}
 
-		return false;
-	}
+					r.select();
+				} catch (ex) {
+					// Throws illigal agrument in IE some times
+				}
+			} else {
+				if (c) {
+					fn = find(n, 1) || t.dom.select('br:first', n)[0];
+					ln = find(n, 0) || t.dom.select('br:last', n)[0];
+
+					if (fn && ln) {
+						r = d.createRange();
+
+						if (fn.nodeName == 'BR')
+							r.setStartBefore(fn);
+						else
+							r.setStart(fn, 0);
+
+						if (ln.nodeName == 'BR')
+							r.setEndBefore(ln);
+						else
+							r.setEnd(ln, ln.nodeValue.length);
+					} else
+						r.selectNode(n);
+				} else
+					r.selectNode(n);
 
-	};
+				t.setRng(r);
+			}
 
-/* file:jscripts/tiny_mce/classes/TinyMCE_DOMUtils.class.js */
+			return n;
+		},
 
-TinyMCE_Engine.prototype.createTagHTML = function(tn, a, h) {
-	var o = '', f = tinyMCE.xmlEncode;
+		isCollapsed : function() {
+			var t = this, r = t.getRng(), s = t.getSel();
 
-	o = '<' + tn;
+			if (!r || r.item)
+				return false;
 
-	if (a) {
-		for (n in a) {
-			if (typeof(a[n]) != 'function' && a[n] != null)
-				o += ' ' + f(n) + '="' + f('' + a[n]) + '"';
-		}
-	}
+			return !s || r.boundingWidth == 0 || r.collapsed;
+		},
 
-	o += !h ? ' />' : '>' + h + '</' + tn + '>';
+		collapse : function(b) {
+			var t = this, r = t.getRng(), n;
 
-	return o;
-};
+			// Control range on IE
+			if (r.item) {
+				n = r.item(0);
+				r = this.win.document.body.createTextRange();
+				r.moveToElementText(n);
+			}
 
-TinyMCE_Engine.prototype.createTag = function(d, tn, a, h) {
-	var o = d.createElement(tn);
+			r.collapse(!!b);
+			t.setRng(r);
+		},
 
-	if (a) {
-		for (n in a) {
-			if (typeof(a[n]) != 'function' && a[n] != null)
-				tinyMCE.setAttrib(o, n, a[n]);
-		}
-	}
+		getSel : function() {
+			var t = this, w = this.win;
 
-	if (h)
-		o.innerHTML = h;
+			return w.getSelection ? w.getSelection() : w.document.selection;
+		},
 
-	return o;
-};
+		getRng : function(w3c) {
+			var t = this, s, r;
 
-TinyMCE_Engine.prototype.getElementByAttributeValue = function(n, e, a, v) {
-	return (n = this.getElementsByAttributeValue(n, e, a, v)).length == 0 ? null : n[0];
-};
+			// Found tridentSel object then we need to use that one
+			if (w3c && t.tridentSel)
+				return t.tridentSel.getRangeAt(0);
 
-TinyMCE_Engine.prototype.getElementsByAttributeValue = function(n, e, a, v) {
-	var i, nl = n.getElementsByTagName(e), o = new Array();
+			try {
+				if (s = t.getSel())
+					r = s.rangeCount > 0 ? s.getRangeAt(0) : (s.createRange ? s.createRange() : t.win.document.createRange());
+			} catch (ex) {
+				// IE throws unspecified error here if TinyMCE is placed in a frame/iframe
+			}
 
-	for (i=0; i<nl.length; i++) {
-		if (tinyMCE.getAttrib(nl[i], a).indexOf(v) != -1)
-			o[o.length] = nl[i];
-	}
+			// No range found then create an empty one
+			// This can occur when the editor is placed in a hidden container element on Gecko
+			// Or on IE when there was an exception
+			if (!r)
+				r = isIE ? t.win.document.body.createTextRange() : t.win.document.createRange();
 
-	return o;
-};
+			return r;
+		},
 
-TinyMCE_Engine.prototype.isBlockElement = function(n) {
-	return n != null && n.nodeType == 1 && this.blockRegExp.test(n.nodeName);
-};
+		setRng : function(r) {
+			var s, t = this;
 
-TinyMCE_Engine.prototype.getParentBlockElement = function(n, r) {
-	return this.getParentNode(n, function(n) {
-		return tinyMCE.isBlockElement(n);
-	}, r);
+			if (!t.tridentSel) {
+				s = t.getSel();
 
-	return null;
-};
+				if (s) {
+					s.removeAllRanges();
+					s.addRange(r);
+				}
+			} else {
+				// Is W3C Range
+				if (r.cloneRange) {
+					t.tridentSel.addRange(r);
+					return;
+				}
 
-TinyMCE_Engine.prototype.insertAfter = function(n, r){
-	if (r.nextSibling)
-		r.parentNode.insertBefore(n, r.nextSibling);
-	else
-		r.parentNode.appendChild(n);
-};
+				// Is IE specific range
+				try {
+					r.select();
+				} catch (ex) {
+					// Needed for some odd IE bug #1843306
+				}
+			}
+		},
 
-TinyMCE_Engine.prototype.setInnerHTML = function(e, h) {
-	var i, nl, n;
+		setNode : function(n) {
+			var t = this;
 
-	// Convert all strong/em to b/i in Gecko
-	if (tinyMCE.isGecko) {
-		h = h.replace(/<strong/gi, '<b');
-		h = h.replace(/<em(\/?)/gi, '<i');
-		h = h.replace(/<em /gi, '<i');
-		h = h.replace(/<\/strong>/gi, '</b>');
-		h = h.replace(/<\/em>/gi, '</i>');
-	}
+			t.setContent(t.dom.getOuterHTML(n));
 
-	if (tinyMCE.isRealIE) {
-		// Since MSIE handles invalid HTML better that valid XHTML we
-		// need to make some things invalid. <hr /> gets converted to <hr>.
-		h = h.replace(/\s\/>/g, '>');
-
-		// Since MSIE auto generated emtpy P tags some times we must tell it to keep the real ones
-		h = h.replace(/<p([^>]*)>\u00A0?<\/p>/gi, '<p$1 mce_keep="true">&nbsp;</p>'); // Keep empty paragraphs
-		h = h.replace(/<p([^>]*)>\s*&nbsp;\s*<\/p>/gi, '<p$1 mce_keep="true">&nbsp;</p>'); // Keep empty paragraphs
-		h = h.replace(/<p([^>]*)>\s+<\/p>/gi, '<p$1 mce_keep="true">&nbsp;</p>'); // Keep empty paragraphs
-
-		// Remove first comment
-		e.innerHTML = tinyMCE.uniqueTag + h;
-		e.firstChild.removeNode(true);
-
-		// Remove weird auto generated empty paragraphs unless it's supposed to be there
-		nl = e.getElementsByTagName("p");
-		for (i=nl.length-1; i>=0; i--) {
-			n = nl[i];
+			return n;
+		},
 
-			if (n.nodeName == 'P' && !n.hasChildNodes() && !n.mce_keep)
-				n.parentNode.removeChild(n);
-		}
-	} else {
-		h = this.fixGeckoBaseHREFBug(1, e, h);
-		e.innerHTML = h;
-		this.fixGeckoBaseHREFBug(2, e, h);
-	}
-};
+		getNode : function() {
+			var t = this, r = t.getRng(), s = t.getSel(), e;
 
-TinyMCE_Engine.prototype.getOuterHTML = function(e) {
-	if (tinyMCE.isIE)
-		return e.outerHTML;
-
-	var d = e.ownerDocument.createElement("body");
-	d.appendChild(e.cloneNode(true));
-	return d.innerHTML;
-};
+			if (!isIE) {
+				// Range maybe lost after the editor is made visible again
+				if (!r)
+					return t.dom.getRoot();
+
+				e = r.commonAncestorContainer;
+
+				// Handle selection a image or other control like element such as anchors
+				if (!r.collapsed) {
+					// If the anchor node is a element instead of a text node then return this element
+					if (tinymce.isWebKit && s.anchorNode && s.anchorNode.nodeType == 1) 
+						return s.anchorNode.childNodes[s.anchorOffset]; 
+
+					if (r.startContainer == r.endContainer) {
+						if (r.startOffset - r.endOffset < 2) {
+							if (r.startContainer.hasChildNodes())
+								e = r.startContainer.childNodes[r.startOffset];
+						}
+					}
+				}
 
-TinyMCE_Engine.prototype.setOuterHTML = function(e, h, d) {
-	var d = typeof(d) == "undefined" ? e.ownerDocument : d, i, nl, t;
+				return t.dom.getParent(e, '*');
+			}
 
-	if (tinyMCE.isIE && e.nodeType == 1)
-		e.outerHTML = h;
-	else {
-		t = d.createElement("body");
-		t.innerHTML = h;
+			return r.item ? r.item(0) : r.parentElement();
+		},
 
-		for (i=0, nl=t.childNodes; i<nl.length; i++)
-			e.parentNode.insertBefore(nl[i].cloneNode(true), e);
+		getSelectedBlocks : function(st, en) {
+			var t = this, dom = t.dom, sb, eb, n, bl = [];
 
-		e.parentNode.removeChild(e);
-	}
-};
+			sb = dom.getParent(st || t.getStart(), dom.isBlock);
+			eb = dom.getParent(en || t.getEnd(), dom.isBlock);
 
-TinyMCE_Engine.prototype._getElementById = function(id, d) {
-	var e, i, j, f;
+			if (sb)
+				bl.push(sb);
 
-	if (typeof(d) == "undefined")
-		d = document;
+			if (sb && eb && sb != eb) {
+				n = sb;
 
-	e = d.getElementById(id);
-	if (!e) {
-		f = d.forms;
-
-		for (i=0; i<f.length; i++) {
-			for (j=0; j<f[i].elements.length; j++) {
-				if (f[i].elements[j].name == id) {
-					e = f[i].elements[j];
-					break;
+				while ((n = n.nextSibling) && n != eb) {
+					if (dom.isBlock(n))
+						bl.push(n);
 				}
 			}
-		}
-	}
 
-	return e;
-};
+			if (eb && sb != eb)
+				bl.push(eb);
 
-TinyMCE_Engine.prototype.getNodeTree = function(n, na, t, nn) {
-	return this.selectNodes(n, function(n) {
-		return (!t || n.nodeType == t) && (!nn || n.nodeName == nn);
-	}, na ? na : new Array());
-};
+			return bl;
+		},
 
-TinyMCE_Engine.prototype.getParentElement = function(n, na, f, r) {
-	var re = na ? new RegExp('^(' + na.toUpperCase().replace(/,/g, '|') + ')$') : 0, v;
+		destroy : function(s) {
+			var t = this;
 
-	// Compatiblity with old scripts where f param was a attribute string
-	if (f && typeof(f) == 'string')
-		return this.getParentElement(n, na, function(no) {return tinyMCE.getAttrib(no, f) != '';});
-
-	return this.getParentNode(n, function(n) {
-		return ((n.nodeType == 1 && !re) || (re && re.test(n.nodeName))) && (!f || f(n));
-	}, r);
-};
+			t.win = null;
 
-TinyMCE_Engine.prototype.getParentNode = function(n, f, r) {
-	while (n) {
-		if (n == r)
-			return null;
+			if (t.tridentSel)
+				t.tridentSel.destroy();
 
-		if (f(n))
-			return n;
+			// Manual destroy then remove unload handler
+			if (!s)
+				tinymce.removeUnload(t.destroy);
+		}
 
-		n = n.parentNode;
-	}
+		});
+})(tinymce);
+(function(tinymce) {
+	tinymce.create('tinymce.dom.XMLWriter', {
+		node : null,
+
+		XMLWriter : function(s) {
+			// Get XML document
+			function getXML() {
+				var i = document.implementation;
+
+				if (!i || !i.createDocument) {
+					// Try IE objects
+					try {return new ActiveXObject('MSXML2.DOMDocument');} catch (ex) {}
+					try {return new ActiveXObject('Microsoft.XmlDom');} catch (ex) {}
+				} else
+					return i.createDocument('', '', null);
+			};
 
-	return null;
-};
+			this.doc = getXML();
+			
+			// Since Opera and WebKit doesn't escape > into &gt; we need to do it our self to normalize the output for all browsers
+			this.valid = tinymce.isOpera || tinymce.isWebKit;
 
-TinyMCE_Engine.prototype.getAttrib = function(elm, name, dv) {
-	var v;
+			this.reset();
+		},
 
-	if (typeof(dv) == "undefined")
-		dv = "";
+		reset : function() {
+			var t = this, d = t.doc;
 
-	// Not a element
-	if (!elm || elm.nodeType != 1)
-		return dv;
+			if (d.firstChild)
+				d.removeChild(d.firstChild);
 
-	v = elm.getAttribute(name);
+			t.node = d.appendChild(d.createElement("html"));
+		},
 
-	// Try className for class attrib
-	if (name == "class" && !v)
-		v = elm.className;
+		writeStartElement : function(n) {
+			var t = this;
 
-	// Workaround for a issue with Firefox 1.5rc2+
-	if (tinyMCE.isGecko && name == "src" && elm.src != null && elm.src != "")
-		v = elm.src;
+			t.node = t.node.appendChild(t.doc.createElement(n));
+		},
 
-	// Workaround for a issue with Firefox 1.5rc2+
-	if (tinyMCE.isGecko && name == "href" && elm.href != null && elm.href != "")
-		v = elm.href;
+		writeAttribute : function(n, v) {
+			if (this.valid)
+				v = v.replace(/>/g, '%MCGT%');
 
-	if (name == "http-equiv" && tinyMCE.isIE)
-		v = elm.httpEquiv;
+			this.node.setAttribute(n, v);
+		},
 
-	if (name == "style" && !tinyMCE.isOpera)
-		v = elm.style.cssText;
+		writeEndElement : function() {
+			this.node = this.node.parentNode;
+		},
 
-	return (v && v != "") ? v : dv;
-};
+		writeFullEndElement : function() {
+			var t = this, n = t.node;
 
-TinyMCE_Engine.prototype.setAttrib = function(el, name, va, fix) {
-	if (typeof(va) == "number" && va != null)
-		va = "" + va;
-
-	if (fix) {
-		if (va == null)
-			va = "";
+			n.appendChild(t.doc.createTextNode(""));
+			t.node = n.parentNode;
+		},
 
-		va = va.replace(/[^0-9%]/g, '');
-	}
+		writeText : function(v) {
+			if (this.valid)
+				v = v.replace(/>/g, '%MCGT%');
 
-	if (name == "style")
-		el.style.cssText = va;
+			this.node.appendChild(this.doc.createTextNode(v));
+		},
 
-	if (name == "class")
-		el.className = va;
+		writeCDATA : function(v) {
+			this.node.appendChild(this.doc.createCDATASection(v));
+		},
 
-	if (va != null && va != "" && va != -1)
-		el.setAttribute(name, va);
-	else
-		el.removeAttribute(name);
-};
+		writeComment : function(v) {
+			// Fix for bug #2035694
+			if (tinymce.isIE)
+				v = v.replace(/^\-|\-$/g, ' ');
 
-TinyMCE_Engine.prototype.setStyleAttrib = function(e, n, v) {
-	e.style[n] = v;
+			this.node.appendChild(this.doc.createComment(v.replace(/\-\-/g, ' ')));
+		},
 
-	// Style attrib deleted in IE
-	if (tinyMCE.isIE && v == null || v == '') {
-		v = tinyMCE.serializeStyle(tinyMCE.parseStyle(e.style.cssText));
-		e.style.cssText = v;
-		e.setAttribute("style", v);
-	}
-};
+		getContent : function() {
+			var h;
 
-TinyMCE_Engine.prototype.switchClass = function(ei, c) {
-	var e;
+			h = this.doc.xml || new XMLSerializer().serializeToString(this.doc);
+			h = h.replace(/<\?[^?]+\?>|<html>|<\/html>|<html\/>|<!DOCTYPE[^>]+>/g, '');
+			h = h.replace(/ ?\/>/g, ' />');
 
-	if (tinyMCE.switchClassCache[ei])
-		e = tinyMCE.switchClassCache[ei];
-	else
-		e = tinyMCE.switchClassCache[ei] = document.getElementById(ei);
-
-	if (e) {
-		// Keep tile mode
-		if (tinyMCE.settings.button_tile_map && e.className && e.className.indexOf('mceTiledButton') == 0)
-			c = 'mceTiledButton ' + c;
+			if (this.valid)
+				h = h.replace(/\%MCGT%/g, '&gt;');
 
-		e.className = c;
-	}
-};
+			return h;
+		}
 
-TinyMCE_Engine.prototype.getAbsPosition = function(n, cn) {
-	var l = 0, t = 0;
+		});
+})(tinymce);
+(function(tinymce) {
+	tinymce.create('tinymce.dom.StringWriter', {
+		str : null,
+		tags : null,
+		count : 0,
+		settings : null,
+		indent : null,
+
+		StringWriter : function(s) {
+			this.settings = tinymce.extend({
+				indent_char : ' ',
+				indentation : 0
+			}, s);
+
+			this.reset();
+		},
+
+		reset : function() {
+			this.indent = '';
+			this.str = "";
+			this.tags = [];
+			this.count = 0;
+		},
+
+		writeStartElement : function(n) {
+			this._writeAttributesEnd();
+			this.writeRaw('<' + n);
+			this.tags.push(n);
+			this.inAttr = true;
+			this.count++;
+			this.elementCount = this.count;
+		},
+
+		writeAttribute : function(n, v) {
+			var t = this;
+
+			t.writeRaw(" " + t.encode(n) + '="' + t.encode(v) + '"');
+		},
+
+		writeEndElement : function() {
+			var n;
+
+			if (this.tags.length > 0) {
+				n = this.tags.pop();
+
+				if (this._writeAttributesEnd(1))
+					this.writeRaw('</' + n + '>');
+
+				if (this.settings.indentation > 0)
+					this.writeRaw('\n');
+			}
+		},
+
+		writeFullEndElement : function() {
+			if (this.tags.length > 0) {
+				this._writeAttributesEnd();
+				this.writeRaw('</' + this.tags.pop() + '>');
+
+				if (this.settings.indentation > 0)
+					this.writeRaw('\n');
+			}
+		},
+
+		writeText : function(v) {
+			this._writeAttributesEnd();
+			this.writeRaw(this.encode(v));
+			this.count++;
+		},
+
+		writeCDATA : function(v) {
+			this._writeAttributesEnd();
+			this.writeRaw('<![CDATA[' + v + ']]>');
+			this.count++;
+		},
+
+		writeComment : function(v) {
+			this._writeAttributesEnd();
+			this.writeRaw('<!-- ' + v + '-->');
+			this.count++;
+		},
+
+		writeRaw : function(v) {
+			this.str += v;
+		},
+
+		encode : function(s) {
+			return s.replace(/[<>&"]/g, function(v) {
+				switch (v) {
+					case '<':
+						return '&lt;';
+
+					case '>':
+						return '&gt;';
 
-	while (n && n != cn) {
-		l += n.offsetLeft;
-		t += n.offsetTop;
-		n = n.offsetParent;
-	}
+					case '&':
+						return '&amp;';
 
-	return {absLeft : l, absTop : t};
-};
+					case '"':
+						return '&quot;';
+				}
 
-TinyMCE_Engine.prototype.prevNode = function(e, n) {
-	var a = n.split(','), i;
+				return v;
+			});
+		},
 
-	while ((e = e.previousSibling) != null) {
-		for (i=0; i<a.length; i++) {
-			if (e.nodeName == a[i])
-				return e;
-		}
-	}
+		getContent : function() {
+			return this.str;
+		},
 
-	return null;
-};
+		_writeAttributesEnd : function(s) {
+			if (!this.inAttr)
+				return;
 
-TinyMCE_Engine.prototype.nextNode = function(e, n) {
-	var a = n.split(','), i;
+			this.inAttr = false;
 
-	while ((e = e.nextSibling) != null) {
-		for (i=0; i<a.length; i++) {
-			if (e.nodeName == a[i])
-				return e;
+			if (s && this.elementCount == this.count) {
+				this.writeRaw(' />');
+				return false;
+			}
+
+			this.writeRaw('>');
+
+			return true;
 		}
-	}
 
-	return null;
-};
+		});
+})(tinymce);
+(function(tinymce) {
+	// Shorten names
+	var extend = tinymce.extend, each = tinymce.each, Dispatcher = tinymce.util.Dispatcher, isIE = tinymce.isIE, isGecko = tinymce.isGecko;
 
-TinyMCE_Engine.prototype.selectElements = function(n, na, f) {
-	var i, a = [], nl, x;
+	function wildcardToRE(s) {
+		return s.replace(/([?+*])/g, '.$1');
+	};
 
-	for (x=0, na = na.split(','); x<na.length; x++)
-		for (i=0, nl = n.getElementsByTagName(na[x]); i<nl.length; i++)
-			(!f || f(nl[i])) && a.push(nl[i]);
+	tinymce.create('tinymce.dom.Serializer', {
+		Serializer : function(s) {
+			var t = this;
+
+			t.key = 0;
+			t.onPreProcess = new Dispatcher(t);
+			t.onPostProcess = new Dispatcher(t);
 
-	return a;
-};
+			try {
+				t.writer = new tinymce.dom.XMLWriter();
+			} catch (ex) {
+				// IE might throw exception if ActiveX is disabled so we then switch to the slightly slower StringWriter
+				t.writer = new tinymce.dom.StringWriter();
+			}
 
-TinyMCE_Engine.prototype.selectNodes = function(n, f, a) {
-	var i;
+			// Default settings
+			t.settings = s = extend({
+				dom : tinymce.DOM,
+				valid_nodes : 0,
+				node_filter : 0,
+				attr_filter : 0,
+				invalid_attrs : /^(mce_|_moz_|sizset|sizcache)/,
+				closed : /^(br|hr|input|meta|img|link|param|area)$/,
+				entity_encoding : 'named',
+				entities : '160,nbsp,161,iexcl,162,cent,163,pound,164,curren,165,yen,166,brvbar,167,sect,168,uml,169,copy,170,ordf,171,laquo,172,not,173,shy,174,reg,175,macr,176,deg,177,plusmn,178,sup2,179,sup3,180,acute,181,micro,182,para,183,middot,184,cedil,185,sup1,186,ordm,187,raquo,188,frac14,189,frac12,190,frac34,191,iquest,192,Agrave,193,Aacute,194,Acirc,195,Atilde,196,Auml,197,Aring,198,AElig,199,Ccedil,200,Egrave,201,Eacute,202,Ecirc,203,Euml,204,Igrave,205,Iacute,206,Icirc,207,Iuml,208,ETH,209,Ntilde,210,Ograve,211,Oacute,212,Ocirc,213,Otilde,214,Ouml,215,times,216,Oslash,217,Ugrave,218,Uacute,219,Ucirc,220,Uuml,221,Yacute,222,THORN,223,szlig,224,agrave,225,aacute,226,acirc,227,atilde,228,auml,229,aring,230,aelig,231,ccedil,232,egrave,233,eacute,234,ecirc,235,euml,236,igrave,237,iacute,238,icirc,239,iuml,240,eth,241,ntilde,242,ograve,243,oacute,244,ocirc,245,otilde,246,ouml,247,divide,248,oslash,249,ugrave,250,uacute,251,ucirc,252,uuml,253,yacute,254,thorn,255,yuml,402,fnof,913,Alpha,914,Beta,915,Gamma,916,Delta,917,Epsilon,918,Zeta,919,Eta,920,Theta,921,Iota,922,Kappa,923,Lambda,924,Mu,925,Nu,926,Xi,927,Omicron,928,Pi,929,Rho,931,Sigma,932,Tau,933,Upsilon,934,Phi,935,Chi,936,Psi,937,Omega,945,alpha,946,beta,947,gamma,948,delta,949,epsilon,950,zeta,951,eta,952,theta,953,iota,954,kappa,955,lambda,956,mu,957,nu,958,xi,959,omicron,960,pi,961,rho,962,sigmaf,963,sigma,964,tau,965,upsilon,966,phi,967,chi,968,psi,969,omega,977,thetasym,978,upsih,982,piv,8226,bull,8230,hellip,8242,prime,8243,Prime,8254,oline,8260,frasl,8472,weierp,8465,image,8476,real,8482,trade,8501,alefsym,8592,larr,8593,uarr,8594,rarr,8595,darr,8596,harr,8629,crarr,8656,lArr,8657,uArr,8658,rArr,8659,dArr,8660,hArr,8704,forall,8706,part,8707,exist,8709,empty,8711,nabla,8712,isin,8713,notin,8715,ni,8719,prod,8721,sum,8722,minus,8727,lowast,8730,radic,8733,prop,8734,infin,8736,ang,8743,and,8744,or,8745,cap,8746,cup,8747,int,8756,there4,8764,sim,8773,cong,8776,asymp,8800,ne,8801,equiv,8804,le,8805,ge,8834,sub,8835,sup,8836,nsub,8838,sube,8839,supe,8853,oplus,8855,otimes,8869,perp,8901,sdot,8968,lceil,8969,rceil,8970,lfloor,8971,rfloor,9001,lang,9002,rang,9674,loz,9824,spades,9827,clubs,9829,hearts,9830,diams,338,OElig,339,oelig,352,Scaron,353,scaron,376,Yuml,710,circ,732,tilde,8194,ensp,8195,emsp,8201,thinsp,8204,zwnj,8205,zwj,8206,lrm,8207,rlm,8211,ndash,8212,mdash,8216,lsquo,8217,rsquo,8218,sbquo,8220,ldquo,8221,rdquo,8222,bdquo,8224,dagger,8225,Dagger,8240,permil,8249,lsaquo,8250,rsaquo,8364,euro',
+				bool_attrs : /(checked|disabled|readonly|selected|nowrap)/,
+				valid_elements : '*[*]',
+				extended_valid_elements : 0,
+				valid_child_elements : 0,
+				invalid_elements : 0,
+				fix_table_elements : 1,
+				fix_list_elements : true,
+				fix_content_duplication : true,
+				convert_fonts_to_spans : false,
+				font_size_classes : 0,
+				font_size_style_values : 0,
+				apply_source_formatting : 0,
+				indent_mode : 'simple',
+				indent_char : '\t',
+				indent_levels : 1,
+				remove_linebreaks : 1,
+				remove_redundant_brs : 1,
+				element_format : 'xhtml'
+			}, s);
+
+			t.dom = s.dom;
+
+			if (s.remove_redundant_brs) {
+				t.onPostProcess.add(function(se, o) {
+					// Remove single BR at end of block elements since they get rendered
+					o.content = o.content.replace(/(<br \/>\s*)+<\/(p|h[1-6]|div|li)>/gi, function(a, b, c) {
+						// Check if it's a single element
+						if (/^<br \/>\s*<\//.test(a))
+							return '</' + c + '>';
 
-	if (!a)
-		a = new Array();
+						return a;
+					});
+				});
+			}
 
-	if (f(n))
-		a[a.length] = n;
+			// Remove XHTML element endings i.e. produce crap :) XHTML is better
+			if (s.element_format == 'html') {
+				t.onPostProcess.add(function(se, o) {
+					o.content = o.content.replace(/<([^>]+) \/>/g, '<$1>');
+				});
+			}
 
-	if (n.hasChildNodes()) {
-		for (i=0; i<n.childNodes.length; i++)
-			tinyMCE.selectNodes(n.childNodes[i], f, a);
-	}
+			if (s.fix_list_elements) {
+				t.onPreProcess.add(function(se, o) {
+					var nl, x, a = ['ol', 'ul'], i, n, p, r = /^(OL|UL)$/, np;
+
+					function prevNode(e, n) {
+						var a = n.split(','), i;
+
+						while ((e = e.previousSibling) != null) {
+							for (i=0; i<a.length; i++) {
+								if (e.nodeName == a[i])
+									return e;
+							}
+						}
 
-	return a;
-};
+						return null;
+					};
 
-TinyMCE_Engine.prototype.addCSSClass = function(e, c, b) {
-	var o = this.removeCSSClass(e, c);
-	return e.className = b ? c + (o != '' ? (' ' + o) : '') : (o != '' ? (o + ' ') : '') + c;
-};
+					for (x=0; x<a.length; x++) {
+						nl = t.dom.select(a[x], o.node);
 
-TinyMCE_Engine.prototype.removeCSSClass = function(e, c) {
-	c = e.className.replace(new RegExp("(^|\\s+)" + c + "(\\s+|$)"), ' ');
-	return e.className = c != ' ' ? c : '';
-};
+						for (i=0; i<nl.length; i++) {
+							n = nl[i];
+							p = n.parentNode;
+
+							if (r.test(p.nodeName)) {
+								np = prevNode(n, 'LI');
+
+								if (!np) {
+									np = t.dom.create('li');
+									np.innerHTML = '&nbsp;';
+									np.appendChild(n);
+									p.insertBefore(np, p.firstChild);
+								} else
+									np.appendChild(n);
+							}
+						}
+					}
+				});
+			}
 
-TinyMCE_Engine.prototype.hasCSSClass = function(n, c) {
-	return new RegExp('\\b' + c + '\\b', 'g').test(n.className);
-};
+			if (s.fix_table_elements) {
+				t.onPreProcess.add(function(se, o) {
+					each(t.dom.select('p table', o.node), function(n) {
+						// IE has a odd bug where tables inside paragraphs sometimes gets wrapped in a BODY and documentFragement element
+						// This hack seems to resolve that issue. This will normally not happed since your contents should be valid in the first place
+						if (isIE)
+							n.outerHTML = n.outerHTML;
 
-TinyMCE_Engine.prototype.renameElement = function(e, n, d) {
-	var ne, i, ar;
+						t.dom.split(t.dom.getParent(n, 'p'), n);
+					});
+				});
+			}
+		},
 
-	d = typeof(d) == "undefined" ? tinyMCE.selectedInstance.getDoc() : d;
+		setEntities : function(s) {
+			var t = this, a, i, l = {}, re = '', v;
 
-	if (e) {
-		ne = d.createElement(n);
+			// No need to setup more than once
+			if (t.entityLookup)
+				return;
 
-		ar = e.attributes;
-		for (i=ar.length-1; i>-1; i--) {
-			if (ar[i].specified && ar[i].nodeValue)
-				ne.setAttribute(ar[i].nodeName.toLowerCase(), ar[i].nodeValue);
-		}
+			// Build regex and lookup array
+			a = s.split(',');
+			for (i = 0; i < a.length; i += 2) {
+				v = a[i];
 
-		ar = e.childNodes;
-		for (i=0; i<ar.length; i++)
-			ne.appendChild(ar[i].cloneNode(true));
+				// Don't add default &amp; &quot; etc.
+				if (v == 34 || v == 38 || v == 60 || v == 62)
+					continue;
 
-		e.parentNode.replaceChild(ne, e);
-	}
-};
+				l[String.fromCharCode(a[i])] = a[i + 1];
 
-TinyMCE_Engine.prototype.getViewPort = function(w) {
-	var d = w.document, m = d.compatMode == 'CSS1Compat', b = d.body, de = d.documentElement;
+				v = parseInt(a[i]).toString(16);
+				re += '\\u' + '0000'.substring(v.length) + v;
+			}
 
-	return {
-		left : w.pageXOffset || (m ? de.scrollLeft : b.scrollLeft),
-		top : w.pageYOffset || (m ? de.scrollTop : b.scrollTop),
-		width : w.innerWidth || (m ? de.clientWidth : b.clientWidth),
-		height : w.innerHeight || (m ? de.clientHeight : b.clientHeight)
-	};
-};
+			if (!re) {
+				t.settings.entity_encoding = 'raw';
+				return;
+			}
 
-/* file:jscripts/tiny_mce/classes/TinyMCE_URL.class.js */
+			t.entitiesRE = new RegExp('[' + re + ']', 'g');
+			t.entityLookup = l;
+		},
+
+		setValidChildRules : function(s) {
+			this.childRules = null;
+			this.addValidChildRules(s);
+		},
 
-TinyMCE_Engine.prototype.parseURL = function(url_str) {
-	var urlParts = new Array();
+		addValidChildRules : function(s) {
+			var t = this, inst, intr, bloc;
 
-	if (url_str) {
-		var pos, lastPos;
+			if (!s)
+				return;
 
-		// Parse protocol part
-		pos = url_str.indexOf('://');
-		if (pos != -1) {
-			urlParts['protocol'] = url_str.substring(0, pos);
-			lastPos = pos + 3;
-		}
+			inst = 'A|BR|SPAN|BDO|MAP|OBJECT|IMG|TT|I|B|BIG|SMALL|EM|STRONG|DFN|CODE|Q|SAMP|KBD|VAR|CITE|ABBR|ACRONYM|SUB|SUP|#text|#comment';
+			intr = 'A|BR|SPAN|BDO|OBJECT|APPLET|IMG|MAP|IFRAME|TT|I|B|U|S|STRIKE|BIG|SMALL|FONT|BASEFONT|EM|STRONG|DFN|CODE|Q|SAMP|KBD|VAR|CITE|ABBR|ACRONYM|SUB|SUP|INPUT|SELECT|TEXTAREA|LABEL|BUTTON|#text|#comment';
+			bloc = 'H[1-6]|P|DIV|ADDRESS|PRE|FORM|TABLE|LI|OL|UL|TD|CAPTION|BLOCKQUOTE|CENTER|DL|DT|DD|DIR|FIELDSET|FORM|NOSCRIPT|NOFRAMES|MENU|ISINDEX|SAMP';
+
+			each(s.split(','), function(s) {
+				var p = s.split(/\[|\]/), re;
+
+				s = '';
+				each(p[1].split('|'), function(v) {
+					if (s)
+						s += '|';
+
+					switch (v) {
+						case '%itrans':
+							v = intr;
+							break;
 
-		// Find port or path start
-		for (var i=lastPos; i<url_str.length; i++) {
-			var chr = url_str.charAt(i);
+						case '%itrans_na':
+							v = intr.substring(2);
+							break;
 
-			if (chr == ':')
-				break;
+						case '%istrict':
+							v = inst;
+							break;
 
-			if (chr == '/')
-				break;
-		}
-		pos = i;
+						case '%istrict_na':
+							v = inst.substring(2);
+							break;
 
-		// Get host
-		urlParts['host'] = url_str.substring(lastPos, pos);
+						case '%btrans':
+							v = bloc;
+							break;
 
-		// Get port
-		urlParts['port'] = "";
-		lastPos = pos;
-		if (url_str.charAt(pos) == ':') {
-			pos = url_str.indexOf('/', lastPos);
-			urlParts['port'] = url_str.substring(lastPos+1, pos);
-		}
+						case '%bstrict':
+							v = bloc;
+							break;
+					}
 
-		// Get path
-		lastPos = pos;
-		pos = url_str.indexOf('?', lastPos);
+					s += v;
+				});
+				re = new RegExp('^(' + s.toLowerCase() + ')$', 'i');
 
-		if (pos == -1)
-			pos = url_str.indexOf('#', lastPos);
+				each(p[0].split('/'), function(s) {
+					t.childRules = t.childRules || {};
+					t.childRules[s] = re;
+				});
+			});
 
-		if (pos == -1)
-			pos = url_str.length;
+			// Build regex
+			s = '';
+			each(t.childRules, function(v, k) {
+				if (s)
+					s += '|';
 
-		urlParts['path'] = url_str.substring(lastPos, pos);
+				s += k;
+			});
 
-		// Get query
-		lastPos = pos;
-		if (url_str.charAt(pos) == '?') {
-			pos = url_str.indexOf('#');
-			pos = (pos == -1) ? url_str.length : pos;
-			urlParts['query'] = url_str.substring(lastPos+1, pos);
-		}
+			t.parentElementsRE = new RegExp('^(' + s.toLowerCase() + ')$', 'i');
 
-		// Get anchor
-		lastPos = pos;
-		if (url_str.charAt(pos) == '#') {
-			pos = url_str.length;
-			urlParts['anchor'] = url_str.substring(lastPos+1, pos);
-		}
-	}
+			/*console.debug(t.parentElementsRE.toString());
+			each(t.childRules, function(v) {
+				console.debug(v.toString());
+			});*/
+		},
+
+		setRules : function(s) {
+			var t = this;
+
+			t._setup();
+			t.rules = {};
+			t.wildRules = [];
+			t.validElements = {};
 
-	return urlParts;
-};
+			return t.addRules(s);
+		},
 
-TinyMCE_Engine.prototype.serializeURL = function(up) {
-	var o = "";
+		addRules : function(s) {
+			var t = this, dr;
 
-	if (up['protocol'])
-		o += up['protocol'] + "://";
+			if (!s)
+				return;
 
-	if (up['host'])
-		o += up['host'];
+			t._setup();
 
-	if (up['port'])
-		o += ":" + up['port'];
+			each(s.split(','), function(s) {
+				var p = s.split(/\[|\]/), tn = p[0].split('/'), ra, at, wat, va = [];
 
-	if (up['path'])
-		o += up['path'];
+				// Extend with default rules
+				if (dr)
+					at = tinymce.extend([], dr.attribs);
 
-	if (up['query'])
-		o += "?" + up['query'];
+				// Parse attributes
+				if (p.length > 1) {
+					each(p[1].split('|'), function(s) {
+						var ar = {}, i;
 
-	if (up['anchor'])
-		o += "#" + up['anchor'];
+						at = at || [];
 
-	return o;
-};
+						// Parse attribute rule
+						s = s.replace(/::/g, '~');
+						s = /^([!\-])?([\w*.?~_\-]+|)([=:<])?(.+)?$/.exec(s);
+						s[2] = s[2].replace(/~/g, ':');
+
+						// Add required attributes
+						if (s[1] == '!') {
+							ra = ra || [];
+							ra.push(s[2]);
+						}
 
-TinyMCE_Engine.prototype.convertAbsoluteURLToRelativeURL = function(base_url, url_to_relative) {
-	var baseURL = this.parseURL(base_url);
-	var targetURL = this.parseURL(url_to_relative);
-	var strTok1;
-	var strTok2;
-	var breakPoint = 0;
-	var outPath = "";
-	var forceSlash = false;
-
-	if (targetURL.path == "")
-		targetURL.path = "/";
-	else
-		forceSlash = true;
-
-	// Crop away last path part
-	base_url = baseURL.path.substring(0, baseURL.path.lastIndexOf('/'));
-	strTok1 = base_url.split('/');
-	strTok2 = targetURL.path.split('/');
-
-	if (strTok1.length >= strTok2.length) {
-		for (var i=0; i<strTok1.length; i++) {
-			if (i >= strTok2.length || strTok1[i] != strTok2[i]) {
-				breakPoint = i + 1;
-				break;
-			}
-		}
-	}
+						// Remove inherited attributes
+						if (s[1] == '-') {
+							for (i = 0; i <at.length; i++) {
+								if (at[i].name == s[2]) {
+									at.splice(i, 1);
+									return;
+								}
+							}
+						}
 
-	if (strTok1.length < strTok2.length) {
-		for (var i=0; i<strTok2.length; i++) {
-			if (i >= strTok1.length || strTok1[i] != strTok2[i]) {
-				breakPoint = i + 1;
-				break;
-			}
-		}
-	}
+						switch (s[3]) {
+							// Add default attrib values
+							case '=':
+								ar.defaultVal = s[4] || '';
+								break;
 
-	if (breakPoint == 1)
-		return targetURL.path;
+							// Add forced attrib values
+							case ':':
+								ar.forcedVal = s[4];
+								break;
 
-	for (var i=0; i<(strTok1.length-(breakPoint-1)); i++)
-		outPath += "../";
+							// Add validation values
+							case '<':
+								ar.validVals = s[4].split('?');
+								break;
+						}
 
-	for (var i=breakPoint-1; i<strTok2.length; i++) {
-		if (i != (breakPoint-1))
-			outPath += "/" + strTok2[i];
-		else
-			outPath += strTok2[i];
-	}
+						if (/[*.?]/.test(s[2])) {
+							wat = wat || [];
+							ar.nameRE = new RegExp('^' + wildcardToRE(s[2]) + '$');
+							wat.push(ar);
+						} else {
+							ar.name = s[2];
+							at.push(ar);
+						}
 
-	targetURL.protocol = null;
-	targetURL.host = null;
-	targetURL.port = null;
-	targetURL.path = outPath == "" && forceSlash ? "/" : outPath;
-
-	// Remove document prefix from local anchors
-	var fileName = baseURL.path;
-	var pos;
-
-	if ((pos = fileName.lastIndexOf('/')) != -1)
-		fileName = fileName.substring(pos + 1);
-
-	// Is local anchor
-	if (fileName == targetURL.path && targetURL.anchor != "")
-		targetURL.path = "";
-
-	// If empty and not local anchor force filename or slash
-	if (targetURL.path == "" && !targetURL.anchor)
-		targetURL.path = fileName != "" ? fileName : "/";
+						va.push(s[2]);
+					});
+				}
 
-	return this.serializeURL(targetURL);
-};
+				// Handle element names
+				each(tn, function(s, i) {
+					var pr = s.charAt(0), x = 1, ru = {};
 
-TinyMCE_Engine.prototype.convertRelativeToAbsoluteURL = function(base_url, relative_url) {
-	var baseURL = this.parseURL(base_url), baseURLParts, relURLParts;
-	var relURL = this.parseURL(relative_url);
-
-	if (relative_url == "" || relative_url.indexOf('://') != -1 || /^(mailto:|javascript:|#|\/)/.test(relative_url))
-		return relative_url;
-
-	// Split parts
-	baseURLParts = baseURL['path'].split('/');
-	relURLParts = relURL['path'].split('/');
-
-	// Remove empty chunks
-	var newBaseURLParts = new Array();
-	for (var i=baseURLParts.length-1; i>=0; i--) {
-		if (baseURLParts[i].length == 0)
-			continue;
+					// Extend with default rule data
+					if (dr) {
+						if (dr.noEmpty)
+							ru.noEmpty = dr.noEmpty;
 
-		newBaseURLParts[newBaseURLParts.length] = baseURLParts[i];
-	}
-	baseURLParts = newBaseURLParts.reverse();
+						if (dr.fullEnd)
+							ru.fullEnd = dr.fullEnd;
 
-	// Merge relURLParts chunks
-	var newRelURLParts = new Array();
-	var numBack = 0;
-	for (var i=relURLParts.length-1; i>=0; i--) {
-		if (relURLParts[i].length == 0 || relURLParts[i] == ".")
-			continue;
+						if (dr.padd)
+							ru.padd = dr.padd;
+					}
 
-		if (relURLParts[i] == '..') {
-			numBack++;
-			continue;
-		}
+					// Handle prefixes
+					switch (pr) {
+						case '-':
+							ru.noEmpty = true;
+							break;
 
-		if (numBack > 0) {
-			numBack--;
-			continue;
-		}
+						case '+':
+							ru.fullEnd = true;
+							break;
 
-		newRelURLParts[newRelURLParts.length] = relURLParts[i];
-	}
+						case '#':
+							ru.padd = true;
+							break;
 
-	relURLParts = newRelURLParts.reverse();
+						default:
+							x = 0;
+					}
 
-	// Remove end from absolute path
-	var len = baseURLParts.length-numBack;
-	var absPath = (len <= 0 ? "" : "/") + baseURLParts.slice(0, len).join('/') + "/" + relURLParts.join('/');
-	var start = "", end = "";
+					tn[i] = s = s.substring(x);
+					t.validElements[s] = 1;
 
-	// Build output URL
-	relURL.protocol = baseURL.protocol;
-	relURL.host = baseURL.host;
-	relURL.port = baseURL.port;
+					// Add element name or element regex
+					if (/[*.?]/.test(tn[0])) {
+						ru.nameRE = new RegExp('^' + wildcardToRE(tn[0]) + '$');
+						t.wildRules = t.wildRules || {};
+						t.wildRules.push(ru);
+					} else {
+						ru.name = tn[0];
 
-	// Re-add trailing slash if it's removed
-	if (relURL.path.charAt(relURL.path.length-1) == "/")
-		absPath += "/";
+						// Store away default rule
+						if (tn[0] == '@')
+							dr = ru;
 
-	relURL.path = absPath;
+						t.rules[s] = ru;
+					}
 
-	return this.serializeURL(relURL);
-};
+					ru.attribs = at;
 
-TinyMCE_Engine.prototype.convertURL = function(url, node, on_save) {
-	var prot = document.location.protocol;
-	var host = document.location.hostname;
-	var port = document.location.port;
-
-	// Pass through file protocol
-	if (prot == "file:")
-		return url;
-
-	// Something is wrong, remove weirdness
-	url = tinyMCE.regexpReplace(url, '(http|https):///', '/');
-
-	// Mailto link or anchor (Pass through)
-	if (url.indexOf('mailto:') != -1 || url.indexOf('javascript:') != -1 || tinyMCE.regexpReplace(url,'[ \t\r\n\+]|%20','').charAt(0) == "#")
-		return url;
-
-	// Fix relative/Mozilla
-	if (!tinyMCE.isIE && !on_save && url.indexOf("://") == -1 && url.charAt(0) != '/')
-		return tinyMCE.settings['base_href'] + url;
-
-	// Handle relative URLs
-	if (on_save && tinyMCE.getParam('relative_urls')) {
-		var curl = tinyMCE.convertRelativeToAbsoluteURL(tinyMCE.settings['base_href'], url);
-		if (curl.charAt(0) == '/')
-			curl = tinyMCE.settings['document_base_prefix'] + curl;
-
-		var urlParts = tinyMCE.parseURL(curl);
-		var tmpUrlParts = tinyMCE.parseURL(tinyMCE.settings['document_base_url']);
-
-		// Force relative
-		if (urlParts['host'] == tmpUrlParts['host'] && (urlParts['port'] == tmpUrlParts['port']))
-			return tinyMCE.convertAbsoluteURLToRelativeURL(tinyMCE.settings['document_base_url'], curl);
-	}
+					if (ra)
+						ru.requiredAttribs = ra;
 
-	// Handle absolute URLs
-	if (!tinyMCE.getParam('relative_urls')) {
-		var urlParts = tinyMCE.parseURL(url);
-		var baseUrlParts = tinyMCE.parseURL(tinyMCE.settings['base_href']);
-
-		// Force absolute URLs from relative URLs
-		url = tinyMCE.convertRelativeToAbsoluteURL(tinyMCE.settings['base_href'], url);
-
-		// If anchor and path is the same page
-		if (urlParts['anchor'] && urlParts['path'] == baseUrlParts['path'])
-			return "#" + urlParts['anchor'];
-	}
+					if (wat) {
+						// Build valid attributes regexp
+						s = '';
+						each(va, function(v) {
+							if (s)
+								s += '|';
 
-	// Remove current domain
-	if (tinyMCE.getParam('remove_script_host')) {
-		var start = "", portPart = "";
+							s += '(' + wildcardToRE(v) + ')';
+						});
+						ru.validAttribsRE = new RegExp('^' + s.toLowerCase() + '$');
+						ru.wildAttribs = wat;
+					}
+				});
+			});
 
-		if (port != "")
-			portPart = ":" + port;
+			// Build valid elements regexp
+			s = '';
+			each(t.validElements, function(v, k) {
+				if (s)
+					s += '|';
 
-		start = prot + "//" + host + portPart + "/";
+				if (k != '@')
+					s += k;
+			});
+			t.validElementsRE = new RegExp('^(' + wildcardToRE(s.toLowerCase()) + ')$');
 
-		if (url.indexOf(start) == 0)
-			url = url.substring(start.length-1);
-	}
+			//console.debug(t.validElementsRE.toString());
+			//console.dir(t.rules);
+			//console.dir(t.wildRules);
+		},
+
+		findRule : function(n) {
+			var t = this, rl = t.rules, i, r;
+
+			t._setup();
+
+			// Exact match
+			r = rl[n];
+			if (r)
+				return r;
+
+			// Try wildcards
+			rl = t.wildRules;
+			for (i = 0; i < rl.length; i++) {
+				if (rl[i].nameRE.test(n))
+					return rl[i];
+			}
 
-	return url;
-};
+			return null;
+		},
 
-TinyMCE_Engine.prototype.convertAllRelativeURLs = function(body) {
-	var i, elms, src, href, mhref, msrc;
+		findAttribRule : function(ru, n) {
+			var i, wa = ru.wildAttribs;
 
-	// Convert all image URL:s to absolute URL
-	elms = body.getElementsByTagName("img");
-	for (i=0; i<elms.length; i++) {
-		src = tinyMCE.getAttrib(elms[i], 'src');
-
-		msrc = tinyMCE.getAttrib(elms[i], 'mce_src');
-		if (msrc != "")
-			src = msrc;
-
-		if (src != "") {
-			src = tinyMCE.convertRelativeToAbsoluteURL(tinyMCE.settings['base_href'], src);
-			elms[i].setAttribute("src", src);
-		}
-	}
+			for (i = 0; i < wa.length; i++) {
+				if (wa[i].nameRE.test(n))
+					return wa[i];
+			}
 
-	// Convert all link URL:s to absolute URL
-	elms = body.getElementsByTagName("a");
-	for (i=0; i<elms.length; i++) {
-		href = tinyMCE.getAttrib(elms[i], 'href');
-
-		mhref = tinyMCE.getAttrib(elms[i], 'mce_href');
-		if (mhref != "")
-			href = mhref;
-
-		if (href && href != "") {
-			href = tinyMCE.convertRelativeToAbsoluteURL(tinyMCE.settings['base_href'], href);
-			elms[i].setAttribute("href", href);
-		}
-	}
-};
+			return null;
+		},
 
-/* file:jscripts/tiny_mce/classes/TinyMCE_Array.class.js */
+		serialize : function(n, o) {
+			var h, t = this, doc;
 
-TinyMCE_Engine.prototype.clearArray = function(a) {
-	var n;
+			t._setup();
+			o = o || {};
+			o.format = o.format || 'html';
+			n = n.cloneNode(true);
+			t.processObj = o;
 
-	for (n in a)
-		a[n] = null;
+			// Nodes needs to be attached to something in WebKit due to a bug https://bugs.webkit.org/show_bug.cgi?id=25571
+			if (tinymce.isWebKit) {
+				doc = n.ownerDocument.implementation.createHTMLDocument("");
+				doc.body.appendChild(n);
+			}
 
-	return a;
-};
+			t.key = '' + (parseInt(t.key) + 1);
 
-TinyMCE_Engine.prototype.explode = function(d, s) {
-	var ar = s.split(d), oar = new Array(), i;
+			// Pre process
+			if (!o.no_events) {
+				o.node = n;
+				t.onPreProcess.dispatch(t, o);
+			}
 
-	for (i = 0; i<ar.length; i++) {
-		if (ar[i] != "")
-			oar[oar.length] = ar[i];
-	}
+			// Serialize HTML DOM into a string
+			t.writer.reset();
+			t._serializeNode(n, o.getInner);
 
-	return oar;
-};
+			// Post process
+			o.content = t.writer.getContent();
 
-/* file:jscripts/tiny_mce/classes/TinyMCE_Event.class.js */
+			if (!o.no_events)
+				t.onPostProcess.dispatch(t, o);
 
-TinyMCE_Engine.prototype._setEventsEnabled = function(node, state) {
-	var evs, x, y, elms, i, event;
-	var events = ['onfocus','onblur','onclick','ondblclick',
-				'onmousedown','onmouseup','onmouseover','onmousemove',
-				'onmouseout','onkeypress','onkeydown','onkeydown','onkeyup'];
-
-	evs = tinyMCE.settings['event_elements'].split(',');
-	for (y=0; y<evs.length; y++){
-		elms = node.getElementsByTagName(evs[y]);
-		for (i=0; i<elms.length; i++) {
-			event = "";
-
-			for (x=0; x<events.length; x++) {
-				if ((event = tinyMCE.getAttrib(elms[i], events[x])) != '') {
-					event = tinyMCE.cleanupEventStr("" + event);
+			t._postProcess(o);
+			o.node = null;
 
-					if (!state)
-						event = "return true;" + event;
-					else
-						event = event.replace(/^return true;/gi, '');
+			return tinymce.trim(o.content);
+		},
 
-					elms[i].removeAttribute(events[x]);
-					elms[i].setAttribute(events[x], event);
-				}
-			}
-		}
-	}
-};
+		// Internal functions
 
-TinyMCE_Engine.prototype._eventPatch = function(editor_id) {
-	var n, inst, win, e;
+		_postProcess : function(o) {
+			var t = this, s = t.settings, h = o.content, sc = [], p;
 
-	// Remove odd, error
-	if (typeof(tinyMCE) == "undefined")
-		return true;
+			if (o.format == 'html') {
+				// Protect some elements
+				p = t._protect({
+					content : h,
+					patterns : [
+						{pattern : /(<script[^>]*>)(.*?)(<\/script>)/g},
+						{pattern : /(<noscript[^>]*>)(.*?)(<\/noscript>)/g},
+						{pattern : /(<style[^>]*>)(.*?)(<\/style>)/g},
+						{pattern : /(<pre[^>]*>)(.*?)(<\/pre>)/g, encode : 1},
+						{pattern : /(<!--\[CDATA\[)(.*?)(\]\]-->)/g}
+					]
+				});
 
-	try {
-		// Try selected instance first
-		if (tinyMCE.selectedInstance) {
-			win = tinyMCE.selectedInstance.getWin();
+				h = p.content;
 
-			if (win && win.event) {
-				e = win.event;
+				// Entity encode
+				if (s.entity_encoding !== 'raw')
+					h = t._encode(h);
+
+				// Use BR instead of &nbsp; padded P elements inside editor and use <p>&nbsp;</p> outside editor
+/*				if (o.set)
+					h = h.replace(/<p>\s+(&nbsp;|&#160;|\u00a0|<br \/>)\s+<\/p>/g, '<p><br /></p>');
+				else
+					h = h.replace(/<p>\s+(&nbsp;|&#160;|\u00a0|<br \/>)\s+<\/p>/g, '<p>$1</p>');*/
 
-				if (!e.target)
-					e.target = e.srcElement;
+				// Since Gecko and Safari keeps whitespace in the DOM we need to
+				// remove it inorder to match other browsers. But I think Gecko and Safari is right.
+				// This process is only done when getting contents out from the editor.
+				if (!o.set) {
+					// We need to replace paragraph whitespace with an nbsp before indentation to keep the \u00a0 char
+					h = h.replace(/<p>\s+<\/p>|<p([^>]+)>\s+<\/p>/g, s.entity_encoding == 'numeric' ? '<p$1>&#160;</p>' : '<p$1>&nbsp;</p>');
 
-				TinyMCE_Engine.prototype.handleEvent(e);
-				return;
-			}
-		}
+					if (s.remove_linebreaks) {
+						h = h.replace(/\r?\n|\r/g, ' ');
+						h = h.replace(/(<[^>]+>)\s+/g, '$1 ');
+						h = h.replace(/\s+(<\/[^>]+>)/g, ' $1');
+						h = h.replace(/<(p|h[1-6]|blockquote|hr|div|table|tbody|tr|td|body|head|html|title|meta|style|pre|script|link|object) ([^>]+)>\s+/g, '<$1 $2>'); // Trim block start
+						h = h.replace(/<(p|h[1-6]|blockquote|hr|div|table|tbody|tr|td|body|head|html|title|meta|style|pre|script|link|object)>\s+/g, '<$1>'); // Trim block start
+						h = h.replace(/\s+<\/(p|h[1-6]|blockquote|hr|div|table|tbody|tr|td|body|head|html|title|meta|style|pre|script|link|object)>/g, '</$1>'); // Trim block end
+					}
 
-		// Search for it
-		for (n in tinyMCE.instances) {
-			inst = tinyMCE.instances[n];
+					// Simple indentation
+					if (s.apply_source_formatting && s.indent_mode == 'simple') {
+						// Add line breaks before and after block elements
+						h = h.replace(/<(\/?)(ul|hr|table|meta|link|tbody|tr|object|body|head|html|map)(|[^>]+)>\s*/g, '\n<$1$2$3>\n');
+						h = h.replace(/\s*<(p|h[1-6]|blockquote|div|title|style|pre|script|td|li|area)(|[^>]+)>/g, '\n<$1$2>');
+						h = h.replace(/<\/(p|h[1-6]|blockquote|div|title|style|pre|script|td|li)>\s*/g, '</$1>\n');
+						h = h.replace(/\n\n/g, '\n');
+					}
+				}
 
-			if (!tinyMCE.isInstance(inst))
-				continue;
+				h = t._unprotect(h, p);
 
-			inst.select();
-			win = inst.getWin();
+				// Restore CDATA sections
+				h = h.replace(/<!--\[CDATA\[([\s\S]+)\]\]-->/g, '<![CDATA[$1]]>');
 
-			if (win && win.event) {
-				e = win.event;
+				// Restore scripts
+				h = h.replace(/(type|language)=\"mce-/g, '$1="');
 
-				if (!e.target)
-					e.target = e.srcElement;
+				// Restore the \u00a0 character if raw mode is enabled
+				if (s.entity_encoding == 'raw')
+					h = h.replace(/<p>&nbsp;<\/p>|<p([^>]+)>&nbsp;<\/p>/g, '<p$1>\u00a0</p>');
 
-				TinyMCE_Engine.prototype.handleEvent(e);
-				return;
+				// Restore noscript elements
+				h = h.replace(/<noscript([^>]+|)>([\s\S]*?)<\/noscript>/g, function(v, attribs, text) {
+					return '<noscript' + attribs + '>' + t.dom.decode(text.replace(/<!--|-->/g, '')) + '</noscript>';
+				});
 			}
-		}
-	} catch (ex) {
-		// Ignore error if iframe is pointing to external URL
-	}
-};
-
-TinyMCE_Engine.prototype.findEvent = function(e) {
-	var n, inst;
-
-	if (e)
-		return e;
 
-	for (n in tinyMCE.instances) {
-		inst = tinyMCE.instances[n];
+			o.content = h;
+		},
 
-		if (tinyMCE.isInstance(inst) && inst.getWin().event)
-			return inst.getWin().event;
-	}
+		_serializeNode : function(n, inn) {
+			var t = this, s = t.settings, w = t.writer, hc, el, cn, i, l, a, at, no, v, nn, ru, ar, iv, closed;
 
-	return null;
-};
+			if (!s.node_filter || s.node_filter(n)) {
+				switch (n.nodeType) {
+					case 1: // Element
+						if (n.hasAttribute ? n.hasAttribute('mce_bogus') : n.getAttribute('mce_bogus'))
+							return;
+
+						iv = false;
+						hc = n.hasChildNodes();
+						nn = n.getAttribute('mce_name') || n.nodeName.toLowerCase();
+
+						// Add correct prefix on IE
+						if (isIE) {
+							if (n.scopeName !== 'HTML' && n.scopeName !== 'html')
+								nn = n.scopeName + ':' + nn;
+						}
 
-TinyMCE_Engine.prototype.unloadHandler = function() {
-	tinyMCE.triggerSave(true, true);
-};
+						// Remove mce prefix on IE needed for the abbr element
+						if (nn.indexOf('mce:') === 0)
+							nn = nn.substring(4);
+
+						// Check if valid
+						if (!t.validElementsRE || !t.validElementsRE.test(nn) || (t.invalidElementsRE && t.invalidElementsRE.test(nn)) || inn) {
+							iv = true;
+							break;
+						}
 
-TinyMCE_Engine.prototype.addEventHandlers = function(inst) {
-	this.setEventHandlers(inst, 1);
-};
+						if (isIE) {
+							// Fix IE content duplication (DOM can have multiple copies of the same node)
+							if (s.fix_content_duplication) {
+								if (n.mce_serialized == t.key)
+									return;
 
-TinyMCE_Engine.prototype.setEventHandlers = function(inst, s) {
-	var doc = inst.getDoc(), ie, ot, i, f = s ? tinyMCE.addEvent : tinyMCE.removeEvent;
+								n.mce_serialized = t.key;
+							}
 
-	ie = ['keypress', 'keyup', 'keydown', 'click', 'mouseup', 'mousedown', 'controlselect', 'dblclick'];
-	ot = ['keypress', 'keyup', 'keydown', 'click', 'mouseup', 'mousedown', 'focus', 'blur', 'dragdrop'];
+							// IE sometimes adds a / infront of the node name
+							if (nn.charAt(0) == '/')
+								nn = nn.substring(1);
+						} else if (isGecko) {
+							// Ignore br elements
+							if (n.nodeName === 'BR' && n.getAttribute('type') == '_moz')
+								return;
+						}
 
-	inst.switchSettings();
+						// Check if valid child
+						if (t.childRules) {
+							if (t.parentElementsRE.test(t.elementName)) {
+								if (!t.childRules[t.elementName].test(nn)) {
+									iv = true;
+									break;
+								}
+							}
 
-	if (tinyMCE.isIE) {
-		for (i=0; i<ie.length; i++)
-			f(doc, ie[i], TinyMCE_Engine.prototype._eventPatch);
-	} else {
-		for (i=0; i<ot.length; i++)
-			f(doc, ot[i], tinyMCE.handleEvent);
+							t.elementName = nn;
+						}
 
-		eval('try { doc.designMode = "On"; } catch(e) {}'); // Force designmode
-	}
-};
+						ru = t.findRule(nn);
+						nn = ru.name || nn;
+						closed = s.closed.test(nn);
+
+						// Skip empty nodes or empty node name in IE
+						if ((!hc && ru.noEmpty) || (isIE && !nn)) {
+							iv = true;
+							break;
+						}
 
-TinyMCE_Engine.prototype.onMouseMove = function() {
-	var inst, lh;
+						// Check required
+						if (ru.requiredAttribs) {
+							a = ru.requiredAttribs;
+
+							for (i = a.length - 1; i >= 0; i--) {
+								if (this.dom.getAttrib(n, a[i]) !== '')
+									break;
+							}
 
-	// Fix for IE7 bug where it's not restoring hover on anchors correctly
-	if (tinyMCE.lastHover) {
-		lh = tinyMCE.lastHover;
-
-		// Call out on menus and refresh class on normal buttons
-		if (lh.className.indexOf('mceMenu') != -1)
-			tinyMCE._menuButtonEvent('out', lh);
-		else
-			lh.className = lh.className;
+							// None of the required was there
+							if (i == -1) {
+								iv = true;
+								break;
+							}
+						}
 
-		tinyMCE.lastHover = null;
-	}
+						w.writeStartElement(nn);
 
-	if (!tinyMCE.hasMouseMoved) {
-		inst = tinyMCE.selectedInstance;
+						// Add ordered attributes
+						if (ru.attribs) {
+							for (i=0, at = ru.attribs, l = at.length; i<l; i++) {
+								a = at[i];
+								v = t._getAttrib(n, a);
 
-		// Workaround for bug #1437457 (Odd MSIE bug)
-		if (inst.isFocused) {
-			inst.undoBookmark = inst.selection.getBookmark();
-			tinyMCE.hasMouseMoved = true;
-		}
-	}
+								if (v !== null)
+									w.writeAttribute(a.name, v);
+							}
+						}
 
-//	tinyMCE.cancelEvent(inst.getWin().event);
-//	return false;
-};
+						// Add wild attributes
+						if (ru.validAttribsRE) {
+							at = t.dom.getAttribs(n);
+							for (i=at.length-1; i>-1; i--) {
+								no = at[i];
+
+								if (no.specified) {
+									a = no.nodeName.toLowerCase();
 
-TinyMCE_Engine.prototype.cancelEvent = function(e) {
-	if (!e)
-		return false;
-
-	if (tinyMCE.isIE) {
-		e.returnValue = false;
-		e.cancelBubble = true;
-	} else {
-		e.preventDefault();
-		e.stopPropagation && e.stopPropagation();
-	}
+									if (s.invalid_attrs.test(a) || !ru.validAttribsRE.test(a))
+										continue;
 
-	return false;
-};
+									ar = t.findAttribRule(ru, a);
+									v = t._getAttrib(n, ar, a);
 
-TinyMCE_Engine.prototype.addEvent = function(o, n, h) {
-	// Add cleanup for all non unload events
-	if (n != 'unload') {
-		function clean() {
-			var ex;
+									if (v !== null)
+										w.writeAttribute(a, v);
+								}
+							}
+						}
 
-			try {
-				tinyMCE.removeEvent(o, n, h);
-				tinyMCE.removeEvent(window, 'unload', clean);
-				o = n = h = null;
-			} catch (ex) {
-				// IE may produce access denied exception on unload
-			}
-		}
+						// Write text from script
+						if (nn === 'script' && tinymce.trim(n.innerHTML)) {
+							w.writeText('// '); // Padd it with a comment so it will parse on older browsers
+							w.writeCDATA(n.innerHTML.replace(/<!--|-->|<\[CDATA\[|\]\]>/g, '')); // Remove comments and cdata stuctures
+							hc = false;
+							break;
+						}
 
-		// Add memory cleaner
-		tinyMCE.addEvent(window, 'unload', clean);
-	}
+						// Padd empty nodes with a &nbsp;
+						if (ru.padd) {
+							// If it has only one bogus child, padd it anyway workaround for <td><br /></td> bug
+							if (hc && (cn = n.firstChild) && cn.nodeType === 1 && n.childNodes.length === 1) {
+								if (cn.hasAttribute ? cn.hasAttribute('mce_bogus') : cn.getAttribute('mce_bogus'))
+									w.writeText('\u00a0');
+							} else if (!hc)
+								w.writeText('\u00a0'); // No children then padd it
+						}
 
-	if (o.attachEvent)
-		o.attachEvent("on" + n, h);
-	else
-		o.addEventListener(n, h, false);
-};
+						break;
 
-TinyMCE_Engine.prototype.removeEvent = function(o, n, h) {
-	if (o.detachEvent)
-		o.detachEvent("on" + n, h);
-	else
-		o.removeEventListener(n, h, false);
-};
+					case 3: // Text
+						// Check if valid child
+						if (t.childRules && t.parentElementsRE.test(t.elementName)) {
+							if (!t.childRules[t.elementName].test(n.nodeName))
+								return;
+						}
 
-TinyMCE_Engine.prototype.addSelectAccessibility = function(e, s, w) {
-	// Add event handlers 
-	if (!s._isAccessible) {
-		s.onkeydown = tinyMCE.accessibleEventHandler;
-		s.onblur = tinyMCE.accessibleEventHandler;
-		s._isAccessible = true;
-		s._win = w;
-	}
+						return w.writeText(n.nodeValue);
 
-	return false;
-};
+					case 4: // CDATA
+						return w.writeCDATA(n.nodeValue);
 
-TinyMCE_Engine.prototype.accessibleEventHandler = function(e) {
-	var win = this._win;
-	e = tinyMCE.isIE ? win.event : e;
-	var elm = tinyMCE.isIE ? e.srcElement : e.target;
-
-	// Unpiggyback onchange on blur
-	if (e.type == "blur") {
-		if (elm.oldonchange) {
-			elm.onchange = elm.oldonchange;
-			elm.oldonchange = null;
-		}
+					case 8: // Comment
+						return w.writeComment(n.nodeValue);
+				}
+			} else if (n.nodeType == 1)
+				hc = n.hasChildNodes();
 
-		return true;
-	}
+			if (hc && !closed) {
+				cn = n.firstChild;
 
-	// Piggyback onchange
-	if (elm.nodeName == "SELECT" && !elm.oldonchange) {
-		elm.oldonchange = elm.onchange;
-		elm.onchange = null;
-	}
+				while (cn) {
+					t._serializeNode(cn);
+					t.elementName = nn;
+					cn = cn.nextSibling;
+				}
+			}
 
-	// Execute onchange and remove piggyback
-	if (e.keyCode == 13 || e.keyCode == 32) {
-		elm.onchange = elm.oldonchange;
-		elm.onchange();
-		elm.oldonchange = null;
+			// Write element end
+			if (!iv) {
+				if (!closed)
+					w.writeFullEndElement();
+				else
+					w.writeEndElement();
+			}
+		},
 
-		tinyMCE.cancelEvent(e);
-		return false;
-	}
+		_protect : function(o) {
+			var t = this;
 
-	return true;
-};
+			o.items = o.items || [];
 
-TinyMCE_Engine.prototype._resetIframeHeight = function() {
-	var ife;
+			function enc(s) {
+				return s.replace(/[\r\n\\]/g, function(c) {
+					if (c === '\n')
+						return '\\n';
+					else if (c === '\\')
+						return '\\\\';
 
-	if (tinyMCE.isRealIE) {
-		ife = tinyMCE.selectedInstance.iframeElement;
+					return '\\r';
+				});
+			};
 
-/*		if (ife._oldWidth) {
-			ife.style.width = ife._oldWidth;
-			ife.width = ife._oldWidth;
-		}*/
-
-		if (ife._oldHeight) {
-			ife.style.height = ife._oldHeight;
-			ife.height = ife._oldHeight;
-		}
-	}
-};
+			function dec(s) {
+				return s.replace(/\\[\\rn]/g, function(c) {
+					if (c === '\\n')
+						return '\n';
+					else if (c === '\\\\')
+						return '\\';
 
-/* file:jscripts/tiny_mce/classes/TinyMCE_Selection.class.js */
+					return '\r';
+				});
+			};
 
-function TinyMCE_Selection(inst) {
-	this.instance = inst;
-};
+			each(o.patterns, function(p) {
+				o.content = dec(enc(o.content).replace(p.pattern, function(x, a, b, c) {
+					b = dec(b);
+
+					if (p.encode)
+						b = t._encode(b);
+
+					o.items.push(b);
+					return a + '<!--mce:' + (o.items.length - 1) + '-->' + c;
+				}));
+			});
 
-TinyMCE_Selection.prototype = {
-	getSelectedHTML : function() {
-		var inst = this.instance;
-		var e, r = this.getRng(), h;
+			return o;
+		},
 
-		if (!r)
-			return null;
+		_unprotect : function(h, o) {
+			h = h.replace(/\<!--mce:([0-9]+)--\>/g, function(a, b) {
+				return o.items[parseInt(b)];
+			});
 
-		e = document.createElement("body");
+			o.items = [];
 
-		if (r.cloneContents)
-			e.appendChild(r.cloneContents());
-		else if (typeof(r.item) != 'undefined' || typeof(r.htmlText) != 'undefined')
-			e.innerHTML = r.item ? r.item(0).outerHTML : r.htmlText;
-		else
-			e.innerHTML = r.toString(); // Failed, use text for now
-
-		h = tinyMCE._cleanupHTML(inst, inst.contentDocument, inst.settings, e, e, false, true, false);
-
-		// When editing always use fonts internaly
-		if (tinyMCE.getParam("convert_fonts_to_spans"))
-			tinyMCE.convertSpansToFonts(inst.getDoc());
+			return h;
+		},
 
-		return h;
-	},
+		_encode : function(h) {
+			var t = this, s = t.settings, l;
 
-	getSelectedText : function() {
-		var inst = this.instance;
-		var d, r, s, t;
-
-		if (tinyMCE.isIE) {
-			d = inst.getDoc();
-
-			if (d.selection.type == "Text") {
-				r = d.selection.createRange();
-				t = r.text;
-			} else
-				t = '';
-		} else {
-			s = this.getSel();
+			// Entity encode
+			if (s.entity_encoding !== 'raw') {
+				if (s.entity_encoding.indexOf('named') != -1) {
+					t.setEntities(s.entities);
+					l = t.entityLookup;
 
-			if (s && s.toString)
-				t = s.toString();
-			else
-				t = '';
-		}
+					h = h.replace(t.entitiesRE, function(a) {
+						var v;
 
-		return t;
-	},
+						if (v = l[a])
+							a = '&' + v + ';';
 
-	getBookmark : function(simple) {
-		var inst = this.instance;
-		var rng = this.getRng();
-		var doc = inst.getDoc(), b = inst.getBody();
-		var sp, le, s, e, nl, i, si, ei, w;
-		var trng, sx, sy, xx = -999999999, vp = inst.getViewPort();
-
-		sx = vp.left;
-		sy = vp.top;
-
-		if (tinyMCE.isSafari || tinyMCE.isOpera || simple)
-			return {rng : rng, scrollX : sx, scrollY : sy};
-
-		if (tinyMCE.isIE) {
-			if (rng.item) {
-				e = rng.item(0);
-
-				nl = b.getElementsByTagName(e.nodeName);
-				for (i=0; i<nl.length; i++) {
-					if (e == nl[i]) {
-						sp = i;
-						break;
-					}
+						return a;
+					});
 				}
 
-				return {
-					tag : e.nodeName,
-					index : sp,
-					scrollX : sx,
-					scrollY : sy
-				};
-			} else {
-				trng = doc.body.createTextRange();
-				trng.moveToElementText(inst.getBody());
-				trng.collapse(true);
-				bp = Math.abs(trng.move('character', xx));
-
-				trng = rng.duplicate();
-				trng.collapse(true);
-				sp = Math.abs(trng.move('character', xx));
-
-				trng = rng.duplicate();
-				trng.collapse(false);
-				le = Math.abs(trng.move('character', xx)) - sp;
-
-				return {
-					start : sp - bp,
-					length : le,
-					scrollX : sx,
-					scrollY : sy
-				};
+				if (s.entity_encoding.indexOf('numeric') != -1) {
+					h = h.replace(/[\u007E-\uFFFF]/g, function(a) {
+						return '&#' + a.charCodeAt(0) + ';';
+					});
+				}
 			}
-		}
 
-		if (tinyMCE.isGecko) {
-			s = this.getSel();
-			e = this.getFocusElement();
+			return h;
+		},
 
-			if (!s)
-				return null;
+		_setup : function() {
+			var t = this, s = this.settings;
 
-			if (e && e.nodeName == 'IMG') {
-				/*nl = b.getElementsByTagName('IMG');
-				for (i=0; i<nl.length; i++) {
-					if (e == nl[i]) {
-						sp = i;
-						break;
-					}
-				}*/
+			if (t.done)
+				return;
 
-				return {
-					start : -1,
-					end : -1,
-					index : sp,
-					scrollX : sx,
-					scrollY : sy
-				};
-			}
+			t.done = 1;
 
-			// Caret or selection
-			if (s.anchorNode == s.focusNode && s.anchorOffset == s.focusOffset) {
-				e = this._getPosText(b, s.anchorNode, s.focusNode);
+			t.setRules(s.valid_elements);
+			t.addRules(s.extended_valid_elements);
+			t.addValidChildRules(s.valid_child_elements);
 
-				if (!e)
-					return {scrollX : sx, scrollY : sy};
+			if (s.invalid_elements)
+				t.invalidElementsRE = new RegExp('^(' + wildcardToRE(s.invalid_elements.replace(/,/g, '|').toLowerCase()) + ')$');
 
-				return {
-					start : e.start + s.anchorOffset,
-					end : e.end + s.focusOffset,
-					scrollX : sx,
-					scrollY : sy
-				};
-			} else {
-				e = this._getPosText(b, rng.startContainer, rng.endContainer);
+			if (s.attrib_value_filter)
+				t.attribValueFilter = s.attribValueFilter;
+		},
 
-				if (!e)
-					return {scrollX : sx, scrollY : sy};
+		_getAttrib : function(n, a, na) {
+			var i, v;
 
-				return {
-					start : e.start + rng.startOffset,
-					end : e.end + rng.endOffset,
-					scrollX : sx,
-					scrollY : sy
-				};
-			}
-		}
+			na = na || a.name;
 
-		return null;
-	},
+			if (a.forcedVal && (v = a.forcedVal)) {
+				if (v === '{$uid}')
+					return this.dom.uniqueId();
 
-	moveToBookmark : function(bookmark) {
-		var inst = this.instance;
-		var rng, nl, i, ex, b = inst.getBody(), sd;
-		var doc = inst.getDoc();
-		var win = inst.getWin();
-		var sel = this.getSel();
+				return v;
+			}
 
-		if (!bookmark)
-			return false;
+			v = this.dom.getAttrib(n, na);
 
-		if (tinyMCE.isSafari) {
-			sel.setBaseAndExtent(bookmark.rng.startContainer, bookmark.rng.startOffset, bookmark.rng.endContainer, bookmark.rng.endOffset);
-			return true;
-		}
+			// Bool attr
+			if (this.settings.bool_attrs.test(na) && v) {
+				v = ('' + v).toLowerCase();
 
-		if (tinyMCE.isRealIE) {
-			if (bookmark.rng) {
-				try {
-					bookmark.rng.select();
-				} catch (ex) {
-					// Ignore
-				}
+				if (v === 'false' || v === '0')
+					return null;
 
-				return true;
+				v = na;
 			}
 
-			win.focus();
+			switch (na) {
+				case 'rowspan':
+				case 'colspan':
+					// Whats the point? Remove usless attribute value
+					if (v == '1')
+						v = '';
 
-			if (bookmark.tag) {
-				rng = b.createControlRange();
+					break;
+			}
 
-				nl = b.getElementsByTagName(bookmark.tag);
+			if (this.attribValueFilter)
+				v = this.attribValueFilter(na, v, n);
 
-				if (nl.length > bookmark.index) {
-					try {
-						rng.addElement(nl[bookmark.index]);
-					} catch (ex) {
-						// Might be thrown if the node no longer exists
-					}
+			if (a.validVals) {
+				for (i = a.validVals.length - 1; i >= 0; i--) {
+					if (v == a.validVals[i])
+						break;
 				}
-			} else {
-				// Try/catch needed since this operation breaks when TinyMCE is placed in hidden divs/tabs
-				try {
-					// Incorrect bookmark
-					if (bookmark.start < 0)
-						return true;
 
-					rng = inst.getSel().createRange();
-					rng.moveToElementText(inst.getBody());
-					rng.collapse(true);
-					rng.moveStart('character', bookmark.start);
-					rng.moveEnd('character', bookmark.length);
-				} catch (ex) {
-					return true;
-				}
+				if (i == -1)
+					return null;
 			}
 
-			rng.select();
-
-			win.scrollTo(bookmark.scrollX, bookmark.scrollY);
-			return true;
-		}
+			if (v === '' && typeof(a.defaultVal) != 'undefined') {
+				v = a.defaultVal;
 
-		if (tinyMCE.isGecko || tinyMCE.isOpera) {
-			if (bookmark.rng) {
-				sel.removeAllRanges();
-				sel.addRange(bookmark.rng);
-			}
+				if (v === '{$uid}')
+					return this.dom.uniqueId();
 
-			if (bookmark.start != -1 && bookmark.end != -1) {
-				try {
-					sd = this._getTextPos(b, bookmark.start, bookmark.end);
-					rng = doc.createRange();
-					rng.setStart(sd.startNode, sd.startOffset);
-					rng.setEnd(sd.endNode, sd.endOffset);
-					sel.removeAllRanges();
-					sel.addRange(rng);
-					win.focus();
-				} catch (ex) {
-					// Ignore
-				}
+				return v;
+			} else {
+				// Remove internal mceItemXX classes when content is extracted from editor
+				if (na == 'class' && this.processObj.get)
+					v = v.replace(/\s?mceItem\w+\s?/g, '');
 			}
 
-			/*
-			if (typeof(bookmark.index) != 'undefined') {
-				tinyMCE.selectElements(b, 'IMG', function (n) {
-					if (bookmark.index-- == 0) {
-						// Select image in Gecko here
-					}
+			if (v === '')
+				return null;
 
-					return false;
-				});
-			}
-			*/
 
-			win.scrollTo(bookmark.scrollX, bookmark.scrollY);
-			return true;
+			return v;
 		}
 
-		return false;
-	},
+		});
+})(tinymce);
+(function(tinymce) {
+	var each = tinymce.each, Event = tinymce.dom.Event;
 
-	_getPosText : function(r, sn, en) {
-		var w = document.createTreeWalker(r, NodeFilter.SHOW_TEXT, null, false), n, p = 0, d = {};
+	tinymce.create('tinymce.dom.ScriptLoader', {
+		ScriptLoader : function(s) {
+			this.settings = s || {};
+			this.queue = [];
+			this.lookup = {};
+		},
 
-		while ((n = w.nextNode()) != null) {
-			if (n == sn)
-				d.start = p;
+		isDone : function(u) {
+			return this.lookup[u] ? this.lookup[u].state == 2 : 0;
+		},
 
-			if (n == en) {
-				d.end = p;
-				return d;
-			}
+		markDone : function(u) {
+			this.lookup[u] = {state : 2, url : u};
+		},
 
-			p += n.nodeValue ? n.nodeValue.length : 0;
-		}
+		add : function(u, cb, s, pr) {
+			var t = this, lo = t.lookup, o;
 
-		return null;
-	},
+			if (o = lo[u]) {
+				// Is loaded fire callback
+				if (cb && o.state == 2)
+					cb.call(s || this);
 
-	_getTextPos : function(r, sp, ep) {
-		var w = document.createTreeWalker(r, NodeFilter.SHOW_TEXT, null, false), n, p = 0, d = {};
+				return o;
+			}
 
-		while ((n = w.nextNode()) != null) {
-			p += n.nodeValue ? n.nodeValue.length : 0;
+			o = {state : 0, url : u, func : cb, scope : s || this};
 
-			if (p >= sp && !d.startNode) {
-				d.startNode = n;
-				d.startOffset = sp - (p - n.nodeValue.length);
-			}
+			if (pr)
+				t.queue.unshift(o);
+			else
+				t.queue.push(o);
 
-			if (p >= ep) {
-				d.endNode = n;
-				d.endOffset = ep - (p - n.nodeValue.length);
+			lo[u] = o;
 
-				return d;
-			}
-		}
+			return o;
+		},
 
-		return null;
-	},
+		load : function(u, cb, s) {
+			var t = this, o;
 
-	selectNode : function(node, collapse, select_text_node, to_start) {
-		var inst = this.instance, sel, rng, nodes;
+			if (o = t.lookup[u]) {
+				// Is loaded fire callback
+				if (cb && o.state == 2)
+					cb.call(s || t);
 
-		if (!node)
-			return;
+				return o;
+			}
 
-		if (typeof(collapse) == "undefined")
-			collapse = true;
+			function loadScript(u) {
+				if (Event.domLoaded || t.settings.strict_mode) {
+					tinymce.util.XHR.send({
+						url : tinymce._addVer(u),
+						error : t.settings.error,
+						async : false,
+						success : function(co) {
+							t.eval(co);
+						}
+					});
+				} else
+					document.write('<script type="text/javascript" src="' + tinymce._addVer(u) + '"></script>');
+			};
 
-		if (typeof(select_text_node) == "undefined")
-			select_text_node = false;
+			if (!tinymce.is(u, 'string')) {
+				each(u, function(u) {
+					loadScript(u);
+				});
 
-		if (typeof(to_start) == "undefined")
-			to_start = true;
+				if (cb)
+					cb.call(s || t);
+			} else {
+				loadScript(u);
 
-		if (inst.settings.auto_resize)
-			inst.resizeToContent();
+				if (cb)
+					cb.call(s || t);
+			}
+		},
 
-		if (tinyMCE.isRealIE) {
-			rng = inst.getDoc().body.createTextRange();
+		loadQueue : function(cb, s) {
+			var t = this;
 
-			try {
-				rng.moveToElementText(node);
+			if (!t.queueLoading) {
+				t.queueLoading = 1;
+				t.queueCallbacks = [];
 
-				if (collapse)
-					rng.collapse(to_start);
+				t.loadScripts(t.queue, function() {
+					t.queueLoading = 0;
 
-				rng.select();
-			} catch (e) {
-				// Throws illigal agrument in MSIE some times
-			}
-		} else {
-			sel = this.getSel();
+					if (cb)
+						cb.call(s || t);
 
-			if (!sel)
-				return;
+					each(t.queueCallbacks, function(o) {
+						o.func.call(o.scope);
+					});
+				});
+			} else if (cb)
+				t.queueCallbacks.push({func : cb, scope : s || t});
+		},
 
-			if (tinyMCE.isSafari) {
-				sel.setBaseAndExtent(node, 0, node, node.innerText.length);
+		eval : function(co) {
+			var w = window;
 
-				if (collapse) {
-					if (to_start)
-						sel.collapseToStart();
-					else
-						sel.collapseToEnd();
+			// Evaluate script
+			if (!w.execScript) {
+				try {
+					eval.call(w, co);
+				} catch (ex) {
+					eval(co, w); // Firefox 3.0a8
 				}
+			} else
+				w.execScript(co); // IE
+		},
 
-				this.scrollToNode(node);
+		loadScripts : function(sc, cb, s) {
+			var t = this, lo = t.lookup;
 
-				return;
-			}
+			function done(o) {
+				o.state = 2; // Has been loaded
 
-			rng = inst.getDoc().createRange();
+				// Run callback
+				if (o.func)
+					o.func.call(o.scope || t);
+			};
 
-			if (select_text_node) {
-				// Find first textnode in tree
-				nodes = tinyMCE.getNodeTree(node, new Array(), 3);
-				if (nodes.length > 0)
-					rng.selectNodeContents(nodes[0]);
-				else
-					rng.selectNodeContents(node);
-			} else
-				rng.selectNode(node);
+			function allDone() {
+				var l;
+
+				// Check if all files are loaded
+				l = sc.length;
+				each(sc, function(o) {
+					o = lo[o.url];
+
+					if (o.state === 2) {// It has finished loading
+						done(o);
+						l--;
+					} else
+						load(o);
+				});
+
+				// They are all loaded
+				if (l === 0 && cb) {
+					cb.call(s || t);
+					cb = 0;
+				}
+			};
+
+			function load(o) {
+				if (o.state > 0)
+					return;
+
+				o.state = 1; // Is loading
+
+				tinymce.dom.ScriptLoader.loadScript(o.url, function() {
+					done(o);
+					allDone();
+				});
+
+				/*
+				tinymce.util.XHR.send({
+					url : o.url,
+					error : t.settings.error,
+					success : function(co) {
+						t.eval(co);
+						done(o);
+						allDone();
+					}
+				});
+				*/
+			};
 
-			if (collapse) {
-				// Special treatment of textnode collapse
-				if (!to_start && node.nodeType == 3) {
-					rng.setStart(node, node.nodeValue.length);
-					rng.setEnd(node, node.nodeValue.length);
+			each(sc, function(o) {
+				var u = o.url;
+
+				// Add to queue if needed
+				if (!lo[u]) {
+					lo[u] = o;
+					t.queue.push(o);
 				} else
-					rng.collapse(to_start);
-			}
+					o = lo[u];
+
+				// Is already loading or has been loaded
+				if (o.state > 0)
+					return;
+
+				if (!Event.domLoaded && !t.settings.strict_mode) {
+					var ix, ol = '';
+
+					// Add onload events
+					if (cb || o.func) {
+						o.state = 1; // Is loading
+
+						ix = tinymce.dom.ScriptLoader._addOnLoad(function() {
+							done(o);
+							allDone();
+						});
+
+						if (tinymce.isIE)
+							ol = ' onreadystatechange="';
+						else
+							ol = ' onload="';
+
+						ol += 'tinymce.dom.ScriptLoader._onLoad(this,\'' + u + '\',' + ix + ');"';
+					}
+
+					document.write('<script type="text/javascript" src="' + tinymce._addVer(u) + '"' + ol + '></script>');
+
+					if (!o.func)
+						done(o);
+				} else
+					load(o);
+			});
 
-			sel.removeAllRanges();
-			sel.addRange(rng);
+			allDone();
+		},
+
+		// Static methods
+		'static' : {
+			_addOnLoad : function(f) {
+				var t = this;
+
+				t._funcs = t._funcs || [];
+				t._funcs.push(f);
+
+				return t._funcs.length - 1;
+			},
+
+			_onLoad : function(e, u, ix) {
+				if (!tinymce.isIE || e.readyState == 'complete')
+					this._funcs[ix].call(this);
+			},
+
+			loadScript : function(u, cb) {
+				var id = tinymce.DOM.uniqueId(), e;
+
+				function done() {
+					Event.clear(id);
+					tinymce.DOM.remove(id);
+
+					if (cb) {
+						cb.call(document, u);
+						cb = 0;
+					}
+				};
+
+				if (tinymce.isIE) {
+/*					Event.add(e, 'readystatechange', function(e) {
+						if (e.target && e.target.readyState == 'complete')
+							done();
+					});*/
+
+					tinymce.util.XHR.send({
+						url : tinymce._addVer(u),
+						async : false,
+						success : function(co) {
+							window.execScript(co);
+							done();
+						}
+					});
+				} else {
+					e = tinymce.DOM.create('script', {id : id, type : 'text/javascript', src : tinymce._addVer(u)});
+					Event.add(e, 'load', done);
+
+					// Check for head or body
+					(document.getElementsByTagName('head')[0] || document.body).appendChild(e);
+				}
+			}
 		}
 
-		this.scrollToNode(node);
+		});
 
-		// Set selected element
-		tinyMCE.selectedElement = null;
-		if (node.nodeType == 1)
-			tinyMCE.selectedElement = node;
-	},
+	// Global script loader
+	tinymce.ScriptLoader = new tinymce.dom.ScriptLoader();
+})(tinymce);
+(function(tinymce) {
+	// Shorten class names
+	var DOM = tinymce.DOM, is = tinymce.is;
+
+	tinymce.create('tinymce.ui.Control', {
+		Control : function(id, s) {
+			this.id = id;
+			this.settings = s = s || {};
+			this.rendered = false;
+			this.onRender = new tinymce.util.Dispatcher(this);
+			this.classPrefix = '';
+			this.scope = s.scope || this;
+			this.disabled = 0;
+			this.active = 0;
+		},
+
+		setDisabled : function(s) {
+			var e;
+
+			if (s != this.disabled) {
+				e = DOM.get(this.id);
+
+				// Add accessibility title for unavailable actions
+				if (e && this.settings.unavailable_prefix) {
+					if (s) {
+						this.prevTitle = e.title;
+						e.title = this.settings.unavailable_prefix + ": " + e.title;
+					} else
+						e.title = this.prevTitle;
+				}
+
+				this.setState('Disabled', s);
+				this.setState('Enabled', !s);
+				this.disabled = s;
+			}
+		},
+
+		isDisabled : function() {
+			return this.disabled;
+		},
 
-	scrollToNode : function(node) {
-		var inst = this.instance, w = inst.getWin(), vp = inst.getViewPort(), pos = tinyMCE.getAbsPosition(node), cvp, p, cwin;
+		setActive : function(s) {
+			if (s != this.active) {
+				this.setState('Active', s);
+				this.active = s;
+			}
+		},
+
+		isActive : function() {
+			return this.active;
+		},
+
+		setState : function(c, s) {
+			var n = DOM.get(this.id);
+
+			c = this.classPrefix + c;
+
+			if (s)
+				DOM.addClass(n, c);
+			else
+				DOM.removeClass(n, c);
+		},
+
+		isRendered : function() {
+			return this.rendered;
+		},
+
+		renderHTML : function() {
+		},
 
-		// Only scroll if out of visible area
-		if (pos.absLeft < vp.left || pos.absLeft > vp.left + vp.width || pos.absTop < vp.top || pos.absTop > vp.top + (vp.height-25))
-			w.scrollTo(pos.absLeft, pos.absTop - vp.height + 25);
-
-		// Scroll container window
-		if (inst.settings.auto_resize) {
-			cwin = inst.getContainerWin();
-			cvp = tinyMCE.getViewPort(cwin);
-			p = this.getAbsPosition(node);
+		renderTo : function(n) {
+			DOM.setHTML(n, this.renderHTML());
+		},
 
-			if (p.absLeft < cvp.left || p.absLeft > cvp.left + cvp.width || p.absTop < cvp.top || p.absTop > cvp.top + cvp.height)
-				cwin.scrollTo(p.absLeft, p.absTop - cvp.height + 25);
+		postRender : function() {
+			var t = this, b;
+
+			// Set pending states
+			if (is(t.disabled)) {
+				b = t.disabled;
+				t.disabled = -1;
+				t.setDisabled(b);
+			}
+
+			if (is(t.active)) {
+				b = t.active;
+				t.active = -1;
+				t.setActive(b);
+			}
+		},
+
+		remove : function() {
+			DOM.remove(this.id);
+			this.destroy();
+		},
+
+		destroy : function() {
+			tinymce.dom.Event.clear(this.id);
 		}
+
+		});
+})(tinymce);tinymce.create('tinymce.ui.Container:tinymce.ui.Control', {
+	Container : function(id, s) {
+		this.parent(id, s);
+		this.controls = [];
+		this.lookup = {};
 	},
 
-	getAbsPosition : function(n) {
-		var pos = tinyMCE.getAbsPosition(n), ipos = tinyMCE.getAbsPosition(this.instance.iframeElement);
+	add : function(c) {
+		this.lookup[c.id] = c;
+		this.controls.push(c);
 
-		return {
-			absLeft : ipos.absLeft + pos.absLeft,
-			absTop : ipos.absTop + pos.absTop
-		};
+		return c;
 	},
 
-	getSel : function() {
-		var inst = this.instance;
+	get : function(n) {
+		return this.lookup[n];
+	}
 
-		if (tinyMCE.isRealIE)
-			return inst.getDoc().selection;
+	});
 
-		return inst.contentWindow.getSelection();
+tinymce.create('tinymce.ui.Separator:tinymce.ui.Control', {
+	Separator : function(id, s) {
+		this.parent(id, s);
+		this.classPrefix = 'mceSeparator';
 	},
 
-	getRng : function() {
-		var s = this.getSel();
+	renderHTML : function() {
+		return tinymce.DOM.createHTML('span', {'class' : this.classPrefix});
+	}
+
+	});
+(function(tinymce) {
+	var is = tinymce.is, DOM = tinymce.DOM, each = tinymce.each, walk = tinymce.walk;
 
-		if (s == null)
-			return null;
+	tinymce.create('tinymce.ui.MenuItem:tinymce.ui.Control', {
+		MenuItem : function(id, s) {
+			this.parent(id, s);
+			this.classPrefix = 'mceMenuItem';
+		},
+
+		setSelected : function(s) {
+			this.setState('Selected', s);
+			this.selected = s;
+		},
+
+		isSelected : function() {
+			return this.selected;
+		},
+
+		postRender : function() {
+			var t = this;
+			
+			t.parent();
+
+			// Set pending state
+			if (is(t.selected))
+				t.setSelected(t.selected);
+		}
+
+		});
+})(tinymce);
+(function(tinymce) {
+	var is = tinymce.is, DOM = tinymce.DOM, each = tinymce.each, walk = tinymce.walk;
+
+	tinymce.create('tinymce.ui.Menu:tinymce.ui.MenuItem', {
+		Menu : function(id, s) {
+			var t = this;
+
+			t.parent(id, s);
+			t.items = {};
+			t.collapsed = false;
+			t.menuCount = 0;
+			t.onAddItem = new tinymce.util.Dispatcher(this);
+		},
+
+		expand : function(d) {
+			var t = this;
+
+			if (d) {
+				walk(t, function(o) {
+					if (o.expand)
+						o.expand();
+				}, 'items', t);
+			}
+
+			t.collapsed = false;
+		},
+
+		collapse : function(d) {
+			var t = this;
+
+			if (d) {
+				walk(t, function(o) {
+					if (o.collapse)
+						o.collapse();
+				}, 'items', t);
+			}
+
+			t.collapsed = true;
+		},
+
+		isCollapsed : function() {
+			return this.collapsed;
+		},
+
+		add : function(o) {
+			if (!o.settings)
+				o = new tinymce.ui.MenuItem(o.id || DOM.uniqueId(), o);
+
+			this.onAddItem.dispatch(this, o);
+
+			return this.items[o.id] = o;
+		},
+
+		addSeparator : function() {
+			return this.add({separator : true});
+		},
+
+		addMenu : function(o) {
+			if (!o.collapse)
+				o = this.createMenu(o);
+
+			this.menuCount++;
+
+			return this.add(o);
+		},
+
+		hasMenus : function() {
+			return this.menuCount !== 0;
+		},
+
+		remove : function(o) {
+			delete this.items[o.id];
+		},
+
+		removeAll : function() {
+			var t = this;
+
+			walk(t, function(o) {
+				if (o.removeAll)
+					o.removeAll();
+				else
+					o.remove();
+
+				o.destroy();
+			}, 'items', t);
+
+			t.items = {};
+		},
+
+		createMenu : function(o) {
+			var m = new tinymce.ui.Menu(o.id || DOM.uniqueId(), o);
+
+			m.onAddItem.add(this.onAddItem.dispatch, this.onAddItem);
+
+			return m;
+		}
+
+		});
+})(tinymce);(function(tinymce) {
+	var is = tinymce.is, DOM = tinymce.DOM, each = tinymce.each, Event = tinymce.dom.Event, Element = tinymce.dom.Element;
+
+	tinymce.create('tinymce.ui.DropMenu:tinymce.ui.Menu', {
+		DropMenu : function(id, s) {
+			s = s || {};
+			s.container = s.container || DOM.doc.body;
+			s.offset_x = s.offset_x || 0;
+			s.offset_y = s.offset_y || 0;
+			s.vp_offset_x = s.vp_offset_x || 0;
+			s.vp_offset_y = s.vp_offset_y || 0;
+
+			if (is(s.icons) && !s.icons)
+				s['class'] += ' mceNoIcons';
+
+			this.parent(id, s);
+			this.onShowMenu = new tinymce.util.Dispatcher(this);
+			this.onHideMenu = new tinymce.util.Dispatcher(this);
+			this.classPrefix = 'mceMenu';
+		},
+
+		createMenu : function(s) {
+			var t = this, cs = t.settings, m;
+
+			s.container = s.container || cs.container;
+			s.parent = t;
+			s.constrain = s.constrain || cs.constrain;
+			s['class'] = s['class'] || cs['class'];
+			s.vp_offset_x = s.vp_offset_x || cs.vp_offset_x;
+			s.vp_offset_y = s.vp_offset_y || cs.vp_offset_y;
+			m = new tinymce.ui.DropMenu(s.id || DOM.uniqueId(), s);
+
+			m.onAddItem.add(t.onAddItem.dispatch, t.onAddItem);
+
+			return m;
+		},
+
+		update : function() {
+			var t = this, s = t.settings, tb = DOM.get('menu_' + t.id + '_tbl'), co = DOM.get('menu_' + t.id + '_co'), tw, th;
+
+			tw = s.max_width ? Math.min(tb.clientWidth, s.max_width) : tb.clientWidth;
+			th = s.max_height ? Math.min(tb.clientHeight, s.max_height) : tb.clientHeight;
+
+			if (!DOM.boxModel)
+				t.element.setStyles({width : tw + 2, height : th + 2});
+			else
+				t.element.setStyles({width : tw, height : th});
+
+			if (s.max_width)
+				DOM.setStyle(co, 'width', tw);
+
+			if (s.max_height) {
+				DOM.setStyle(co, 'height', th);
+
+				if (tb.clientHeight < s.max_height)
+					DOM.setStyle(co, 'overflow', 'hidden');
+			}
+		},
+
+		showMenu : function(x, y, px) {
+			var t = this, s = t.settings, co, vp = DOM.getViewPort(), w, h, mx, my, ot = 2, dm, tb, cp = t.classPrefix;
+
+			t.collapse(1);
+
+			if (t.isMenuVisible)
+				return;
+
+			if (!t.rendered) {
+				co = DOM.add(t.settings.container, t.renderNode());
+
+				each(t.items, function(o) {
+					o.postRender();
+				});
+
+				t.element = new Element('menu_' + t.id, {blocker : 1, container : s.container});
+			} else
+				co = DOM.get('menu_' + t.id);
+
+			// Move layer out of sight unless it's Opera since it scrolls to top of page due to an bug
+			if (!tinymce.isOpera)
+				DOM.setStyles(co, {left : -0xFFFF , top : -0xFFFF});
+
+			DOM.show(co);
+			t.update();
+
+			x += s.offset_x || 0;
+			y += s.offset_y || 0;
+			vp.w -= 4;
+			vp.h -= 4;
+
+			// Move inside viewport if not submenu
+			if (s.constrain) {
+				w = co.clientWidth - ot;
+				h = co.clientHeight - ot;
+				mx = vp.x + vp.w;
+				my = vp.y + vp.h;
+
+				if ((x + s.vp_offset_x + w) > mx)
+					x = px ? px - w : Math.max(0, (mx - s.vp_offset_x) - w);
+
+				if ((y + s.vp_offset_y + h) > my)
+					y = Math.max(0, (my - s.vp_offset_y) - h);
+			}
+
+			DOM.setStyles(co, {left : x , top : y});
+			t.element.update();
+
+			t.isMenuVisible = 1;
+			t.mouseClickFunc = Event.add(co, 'click', function(e) {
+				var m;
+
+				e = e.target;
+
+				if (e && (e = DOM.getParent(e, 'tr')) && !DOM.hasClass(e, cp + 'ItemSub')) {
+					m = t.items[e.id];
+
+					if (m.isDisabled())
+						return;
+
+					dm = t;
+
+					while (dm) {
+						if (dm.hideMenu)
+							dm.hideMenu();
+
+						dm = dm.settings.parent;
+					}
+
+					if (m.settings.onclick)
+						m.settings.onclick(e);
+
+					return Event.cancel(e); // Cancel to fix onbeforeunload problem
+				}
+			});
+
+			if (t.hasMenus()) {
+				t.mouseOverFunc = Event.add(co, 'mouseover', function(e) {
+					var m, r, mi;
+
+					e = e.target;
+					if (e && (e = DOM.getParent(e, 'tr'))) {
+						m = t.items[e.id];
+
+						if (t.lastMenu)
+							t.lastMenu.collapse(1);
+
+						if (m.isDisabled())
+							return;
+
+						if (e && DOM.hasClass(e, cp + 'ItemSub')) {
+							//p = DOM.getPos(s.container);
+							r = DOM.getRect(e);
+							m.showMenu((r.x + r.w - ot), r.y - ot, r.x);
+							t.lastMenu = m;
+							DOM.addClass(DOM.get(m.id).firstChild, cp + 'ItemActive');
+						}
+					}
+				});
+			}
+
+			t.onShowMenu.dispatch(t);
+
+			if (s.keyboard_focus) {
+				Event.add(co, 'keydown', t._keyHandler, t);
+				DOM.select('a', 'menu_' + t.id)[0].focus(); // Select first link
+				t._focusIdx = 0;
+			}
+		},
+
+		hideMenu : function(c) {
+			var t = this, co = DOM.get('menu_' + t.id), e;
+
+			if (!t.isMenuVisible)
+				return;
+
+			Event.remove(co, 'mouseover', t.mouseOverFunc);
+			Event.remove(co, 'click', t.mouseClickFunc);
+			Event.remove(co, 'keydown', t._keyHandler);
+			DOM.hide(co);
+			t.isMenuVisible = 0;
+
+			if (!c)
+				t.collapse(1);
+
+			if (t.element)
+				t.element.hide();
+
+			if (e = DOM.get(t.id))
+				DOM.removeClass(e.firstChild, t.classPrefix + 'ItemActive');
+
+			t.onHideMenu.dispatch(t);
+		},
+
+		add : function(o) {
+			var t = this, co;
+
+			o = t.parent(o);
+
+			if (t.isRendered && (co = DOM.get('menu_' + t.id)))
+				t._add(DOM.select('tbody', co)[0], o);
+
+			return o;
+		},
+
+		collapse : function(d) {
+			this.parent(d);
+			this.hideMenu(1);
+		},
+
+		remove : function(o) {
+			DOM.remove(o.id);
+			this.destroy();
+
+			return this.parent(o);
+		},
+
+		destroy : function() {
+			var t = this, co = DOM.get('menu_' + t.id);
+
+			Event.remove(co, 'mouseover', t.mouseOverFunc);
+			Event.remove(co, 'click', t.mouseClickFunc);
+
+			if (t.element)
+				t.element.remove();
+
+			DOM.remove(co);
+		},
+
+		renderNode : function() {
+			var t = this, s = t.settings, n, tb, co, w;
+
+			w = DOM.create('div', {id : 'menu_' + t.id, 'class' : s['class'], 'style' : 'position:absolute;left:0;top:0;z-index:200000'});
+			co = DOM.add(w, 'div', {id : 'menu_' + t.id + '_co', 'class' : t.classPrefix + (s['class'] ? ' ' + s['class'] : '')});
+			t.element = new Element('menu_' + t.id, {blocker : 1, container : s.container});
+
+			if (s.menu_line)
+				DOM.add(co, 'span', {'class' : t.classPrefix + 'Line'});
+
+//			n = DOM.add(co, 'div', {id : 'menu_' + t.id + '_co', 'class' : 'mceMenuContainer'});
+			n = DOM.add(co, 'table', {id : 'menu_' + t.id + '_tbl', border : 0, cellPadding : 0, cellSpacing : 0});
+			tb = DOM.add(n, 'tbody');
+
+			each(t.items, function(o) {
+				t._add(tb, o);
+			});
+
+			t.rendered = true;
+
+			return w;
+		},
+
+		// Internal functions
+
+		_keyHandler : function(e) {
+			var t = this, kc = e.keyCode;
+
+			function focus(d) {
+				var i = t._focusIdx + d, e = DOM.select('a', 'menu_' + t.id)[i];
+
+				if (e) {
+					t._focusIdx = i;
+					e.focus();
+				}
+			};
+
+			switch (kc) {
+				case 38:
+					focus(-1); // Select first link
+					return;
+
+				case 40:
+					focus(1);
+					return;
+
+				case 13:
+					return;
+
+				case 27:
+					return this.hideMenu();
+			}
+		},
+
+		_add : function(tb, o) {
+			var n, s = o.settings, a, ro, it, cp = this.classPrefix, ic;
+
+			if (s.separator) {
+				ro = DOM.add(tb, 'tr', {id : o.id, 'class' : cp + 'ItemSeparator'});
+				DOM.add(ro, 'td', {'class' : cp + 'ItemSeparator'});
+
+				if (n = ro.previousSibling)
+					DOM.addClass(n, 'mceLast');
+
+				return;
+			}
+
+			n = ro = DOM.add(tb, 'tr', {id : o.id, 'class' : cp + 'Item ' + cp + 'ItemEnabled'});
+			n = it = DOM.add(n, 'td');
+			n = a = DOM.add(n, 'a', {href : 'javascript:;', onclick : "return false;", onmousedown : 'return false;'});
+
+			DOM.addClass(it, s['class']);
+//			n = DOM.add(n, 'span', {'class' : 'item'});
+
+			ic = DOM.add(n, 'span', {'class' : 'mceIcon' + (s.icon ? ' mce_' + s.icon : '')});
+
+			if (s.icon_src)
+				DOM.add(ic, 'img', {src : s.icon_src});
+
+			n = DOM.add(n, s.element || 'span', {'class' : 'mceText', title : o.settings.title}, o.settings.title);
+
+			if (o.settings.style)
+				DOM.setAttrib(n, 'style', o.settings.style);
+
+			if (tb.childNodes.length == 1)
+				DOM.addClass(ro, 'mceFirst');
+
+			if ((n = ro.previousSibling) && DOM.hasClass(n, cp + 'ItemSeparator'))
+				DOM.addClass(ro, 'mceFirst');
+
+			if (o.collapse)
+				DOM.addClass(ro, cp + 'ItemSub');
+
+			if (n = ro.previousSibling)
+				DOM.removeClass(n, 'mceLast');
+
+			DOM.addClass(ro, 'mceLast');
+		}
+
+		});
+})(tinymce);(function(tinymce) {
+	var DOM = tinymce.DOM;
+
+	tinymce.create('tinymce.ui.Button:tinymce.ui.Control', {
+		Button : function(id, s) {
+			this.parent(id, s);
+			this.classPrefix = 'mceButton';
+		},
+
+		renderHTML : function() {
+			var cp = this.classPrefix, s = this.settings, h, l;
+
+			l = DOM.encode(s.label || '');
+			h = '<a id="' + this.id + '" href="javascript:;" class="' + cp + ' ' + cp + 'Enabled ' + s['class'] + (l ? ' ' + cp + 'Labeled' : '') +'" onmousedown="return false;" onclick="return false;" title="' + DOM.encode(s.title) + '">';
+
+			if (s.image)
+				h += '<img class="mceIcon" src="' + s.image + '" />' + l + '</a>';
+			else
+				h += '<span class="mceIcon ' + s['class'] + '"></span>' + (l ? '<span class="' + cp + 'Label">' + l + '</span>' : '') + '</a>';
+
+			return h;
+		},
+
+		postRender : function() {
+			var t = this, s = t.settings;
+
+			tinymce.dom.Event.add(t.id, 'click', function(e) {
+				if (!t.isDisabled())
+					return s.onclick.call(s.scope, e);
+			});
+		}
+
+		});
+})(tinymce);
+(function(tinymce) {
+	var DOM = tinymce.DOM, Event = tinymce.dom.Event, each = tinymce.each, Dispatcher = tinymce.util.Dispatcher;
+
+	tinymce.create('tinymce.ui.ListBox:tinymce.ui.Control', {
+		ListBox : function(id, s) {
+			var t = this;
+
+			t.parent(id, s);
+			t.items = [];
+			t.onChange = new Dispatcher(t);
+			t.onPostRender = new Dispatcher(t);
+			t.onAdd = new Dispatcher(t);
+			t.onRenderMenu = new tinymce.util.Dispatcher(this);
+			t.classPrefix = 'mceListBox';
+		},
+
+		select : function(va) {
+			var t = this, fv, f;
+
+			if (va == undefined)
+				return t.selectByIndex(-1);
+
+			// Is string or number make function selector
+			if (va && va.call)
+				f = va;
+			else {
+				f = function(v) {
+					return v == va;
+				};
+			}
+
+			// Do we need to do something?
+			if (va != t.selectedValue) {
+				// Find item
+				each(t.items, function(o, i) {
+					if (f(o.value)) {
+						fv = 1;
+						t.selectByIndex(i);
+						return false;
+					}
+				});
+
+				if (!fv)
+					t.selectByIndex(-1);
+			}
+		},
+
+		selectByIndex : function(idx) {
+			var t = this, e, o;
+
+			if (idx != t.selectedIndex) {
+				e = DOM.get(t.id + '_text');
+				o = t.items[idx];
+
+				if (o) {
+					t.selectedValue = o.value;
+					t.selectedIndex = idx;
+					DOM.setHTML(e, DOM.encode(o.title));
+					DOM.removeClass(e, 'mceTitle');
+				} else {
+					DOM.setHTML(e, DOM.encode(t.settings.title));
+					DOM.addClass(e, 'mceTitle');
+					t.selectedValue = t.selectedIndex = null;
+				}
+
+				e = 0;
+			}
+		},
+
+		add : function(n, v, o) {
+			var t = this;
+
+			o = o || {};
+			o = tinymce.extend(o, {
+				title : n,
+				value : v
+			});
+
+			t.items.push(o);
+			t.onAdd.dispatch(t, o);
+		},
+
+		getLength : function() {
+			return this.items.length;
+		},
+
+		renderHTML : function() {
+			var h = '', t = this, s = t.settings, cp = t.classPrefix;
+
+			h = '<table id="' + t.id + '" cellpadding="0" cellspacing="0" class="' + cp + ' ' + cp + 'Enabled' + (s['class'] ? (' ' + s['class']) : '') + '"><tbody><tr>';
+			h += '<td>' + DOM.createHTML('a', {id : t.id + '_text', href : 'javascript:;', 'class' : 'mceText', onclick : "return false;", onmousedown : 'return false;'}, DOM.encode(t.settings.title)) + '</td>';
+			h += '<td>' + DOM.createHTML('a', {id : t.id + '_open', tabindex : -1, href : 'javascript:;', 'class' : 'mceOpen', onclick : "return false;", onmousedown : 'return false;'}, '<span></span>') + '</td>';
+			h += '</tr></tbody></table>';
+
+			return h;
+		},
+
+		showMenu : function() {
+			var t = this, p1, p2, e = DOM.get(this.id), m;
+
+			if (t.isDisabled() || t.items.length == 0)
+				return;
+
+			if (t.menu && t.menu.isMenuVisible)
+				return t.hideMenu();
+
+			if (!t.isMenuRendered) {
+				t.renderMenu();
+				t.isMenuRendered = true;
+			}
+
+			p1 = DOM.getPos(this.settings.menu_container);
+			p2 = DOM.getPos(e);
+
+			m = t.menu;
+			m.settings.offset_x = p2.x;
+			m.settings.offset_y = p2.y;
+			m.settings.keyboard_focus = !tinymce.isOpera; // Opera is buggy when it comes to auto focus
+
+			// Select in menu
+			if (t.oldID)
+				m.items[t.oldID].setSelected(0);
+
+			each(t.items, function(o) {
+				if (o.value === t.selectedValue) {
+					m.items[o.id].setSelected(1);
+					t.oldID = o.id;
+				}
+			});
+
+			m.showMenu(0, e.clientHeight);
+
+			Event.add(DOM.doc, 'mousedown', t.hideMenu, t);
+			DOM.addClass(t.id, t.classPrefix + 'Selected');
+
+			//DOM.get(t.id + '_text').focus();
+		},
+
+		hideMenu : function(e) {
+			var t = this;
+
+			// Prevent double toogles by canceling the mouse click event to the button
+			if (e && e.type == "mousedown" && (e.target.id == t.id + '_text' || e.target.id == t.id + '_open'))
+				return;
+
+			if (!e || !DOM.getParent(e.target, '.mceMenu')) {
+				DOM.removeClass(t.id, t.classPrefix + 'Selected');
+				Event.remove(DOM.doc, 'mousedown', t.hideMenu, t);
+
+				if (t.menu)
+					t.menu.hideMenu();
+			}
+		},
+
+		renderMenu : function() {
+			var t = this, m;
+
+			m = t.settings.control_manager.createDropMenu(t.id + '_menu', {
+				menu_line : 1,
+				'class' : t.classPrefix + 'Menu mceNoIcons',
+				max_width : 150,
+				max_height : 150
+			});
+
+			m.onHideMenu.add(t.hideMenu, t);
+
+			m.add({
+				title : t.settings.title,
+				'class' : 'mceMenuItemTitle',
+				onclick : function() {
+					if (t.settings.onselect('') !== false)
+						t.select(''); // Must be runned after
+				}
+			});
+
+			each(t.items, function(o) {
+				o.id = DOM.uniqueId();
+				o.onclick = function() {
+					if (t.settings.onselect(o.value) !== false)
+						t.select(o.value); // Must be runned after
+				};
+
+				m.add(o);
+			});
+
+			t.onRenderMenu.dispatch(t, m);
+			t.menu = m;
+		},
+
+		postRender : function() {
+			var t = this, cp = t.classPrefix;
+
+			Event.add(t.id, 'click', t.showMenu, t);
+			Event.add(t.id + '_text', 'focus', function(e) {
+				if (!t._focused) {
+					t.keyDownHandler = Event.add(t.id + '_text', 'keydown', function(e) {
+						var idx = -1, v, kc = e.keyCode;
+
+						// Find current index
+						each(t.items, function(v, i) {
+							if (t.selectedValue == v.value)
+								idx = i;
+						});
+
+						// Move up/down
+						if (kc == 38)
+							v = t.items[idx - 1];
+						else if (kc == 40)
+							v = t.items[idx + 1];
+						else if (kc == 13) {
+							// Fake select on enter
+							v = t.selectedValue;
+							t.selectedValue = null; // Needs to be null to fake change
+							t.settings.onselect(v);
+							return Event.cancel(e);
+						}
+
+						if (v) {
+							t.hideMenu();
+							t.select(v.value);
+						}
+					});
+				}
+
+				t._focused = 1;
+			});
+			Event.add(t.id + '_text', 'blur', function() {Event.remove(t.id + '_text', 'keydown', t.keyDownHandler); t._focused = 0;});
+
+			// Old IE doesn't have hover on all elements
+			if (tinymce.isIE6 || !DOM.boxModel) {
+				Event.add(t.id, 'mouseover', function() {
+					if (!DOM.hasClass(t.id, cp + 'Disabled'))
+						DOM.addClass(t.id, cp + 'Hover');
+				});
+
+				Event.add(t.id, 'mouseout', function() {
+					if (!DOM.hasClass(t.id, cp + 'Disabled'))
+						DOM.removeClass(t.id, cp + 'Hover');
+				});
+			}
+
+			t.onPostRender.dispatch(t, DOM.get(t.id));
+		},
+
+		destroy : function() {
+			this.parent();
+
+			Event.clear(this.id + '_text');
+			Event.clear(this.id + '_open');
+		}
+
+		});
+})(tinymce);(function(tinymce) {
+	var DOM = tinymce.DOM, Event = tinymce.dom.Event, each = tinymce.each, Dispatcher = tinymce.util.Dispatcher;
+
+	tinymce.create('tinymce.ui.NativeListBox:tinymce.ui.ListBox', {
+		NativeListBox : function(id, s) {
+			this.parent(id, s);
+			this.classPrefix = 'mceNativeListBox';
+		},
+
+		setDisabled : function(s) {
+			DOM.get(this.id).disabled = s;
+		},
+
+		isDisabled : function() {
+			return DOM.get(this.id).disabled;
+		},
+
+		select : function(va) {
+			var t = this, fv, f;
+
+			if (va == undefined)
+				return t.selectByIndex(-1);
+
+			// Is string or number make function selector
+			if (va && va.call)
+				f = va;
+			else {
+				f = function(v) {
+					return v == va;
+				};
+			}
+
+			// Do we need to do something?
+			if (va != t.selectedValue) {
+				// Find item
+				each(t.items, function(o, i) {
+					if (f(o.value)) {
+						fv = 1;
+						t.selectByIndex(i);
+						return false;
+					}
+				});
+
+				if (!fv)
+					t.selectByIndex(-1);
+			}
+		},
+
+		selectByIndex : function(idx) {
+			DOM.get(this.id).selectedIndex = idx + 1;
+			this.selectedValue = this.items[idx] ? this.items[idx].value : null;
+		},
+
+		add : function(n, v, a) {
+			var o, t = this;
+
+			a = a || {};
+			a.value = v;
+
+			if (t.isRendered())
+				DOM.add(DOM.get(this.id), 'option', a, n);
+
+			o = {
+				title : n,
+				value : v,
+				attribs : a
+			};
+
+			t.items.push(o);
+			t.onAdd.dispatch(t, o);
+		},
+
+		getLength : function() {
+			return DOM.get(this.id).options.length - 1;
+		},
+
+		renderHTML : function() {
+			var h, t = this;
+
+			h = DOM.createHTML('option', {value : ''}, '-- ' + t.settings.title + ' --');
+
+			each(t.items, function(it) {
+				h += DOM.createHTML('option', {value : it.value}, it.title);
+			});
+
+			h = DOM.createHTML('select', {id : t.id, 'class' : 'mceNativeListBox'}, h);
+
+			return h;
+		},
+
+		postRender : function() {
+			var t = this, ch;
+
+			t.rendered = true;
+
+			function onChange(e) {
+				var v = t.items[e.target.selectedIndex - 1];
+
+				if (v && (v = v.value)) {
+					t.onChange.dispatch(t, v);
+
+					if (t.settings.onselect)
+						t.settings.onselect(v);
+				}
+			};
+
+			Event.add(t.id, 'change', onChange);
+
+			// Accessibility keyhandler
+			Event.add(t.id, 'keydown', function(e) {
+				var bf;
+
+				Event.remove(t.id, 'change', ch);
+
+				bf = Event.add(t.id, 'blur', function() {
+					Event.add(t.id, 'change', onChange);
+					Event.remove(t.id, 'blur', bf);
+				});
+
+				if (e.keyCode == 13 || e.keyCode == 32) {
+					onChange(e);
+					return Event.cancel(e);
+				}
+			});
+
+			t.onPostRender.dispatch(t, DOM.get(t.id));
+		}
+
+		});
+})(tinymce);(function(tinymce) {
+	var DOM = tinymce.DOM, Event = tinymce.dom.Event, each = tinymce.each;
+
+	tinymce.create('tinymce.ui.MenuButton:tinymce.ui.Button', {
+		MenuButton : function(id, s) {
+			this.parent(id, s);
+			this.onRenderMenu = new tinymce.util.Dispatcher(this);
+			s.menu_container = s.menu_container || DOM.doc.body;
+		},
+
+		showMenu : function() {
+			var t = this, p1, p2, e = DOM.get(t.id), m;
+
+			if (t.isDisabled())
+				return;
+
+			if (!t.isMenuRendered) {
+				t.renderMenu();
+				t.isMenuRendered = true;
+			}
+
+			if (t.isMenuVisible)
+				return t.hideMenu();
+
+			p1 = DOM.getPos(t.settings.menu_container);
+			p2 = DOM.getPos(e);
+
+			m = t.menu;
+			m.settings.offset_x = p2.x;
+			m.settings.offset_y = p2.y;
+			m.settings.vp_offset_x = p2.x;
+			m.settings.vp_offset_y = p2.y;
+			m.settings.keyboard_focus = t._focused;
+			m.showMenu(0, e.clientHeight);
+
+			Event.add(DOM.doc, 'mousedown', t.hideMenu, t);
+			t.setState('Selected', 1);
+
+			t.isMenuVisible = 1;
+		},
+
+		renderMenu : function() {
+			var t = this, m;
+
+			m = t.settings.control_manager.createDropMenu(t.id + '_menu', {
+				menu_line : 1,
+				'class' : this.classPrefix + 'Menu',
+				icons : t.settings.icons
+			});
+
+			m.onHideMenu.add(t.hideMenu, t);
+
+			t.onRenderMenu.dispatch(t, m);
+			t.menu = m;
+		},
+
+		hideMenu : function(e) {
+			var t = this;
+
+			// Prevent double toogles by canceling the mouse click event to the button
+			if (e && e.type == "mousedown" && DOM.getParent(e.target, function(e) {return e.id === t.id || e.id === t.id + '_open';}))
+				return;
+
+			if (!e || !DOM.getParent(e.target, '.mceMenu')) {
+				t.setState('Selected', 0);
+				Event.remove(DOM.doc, 'mousedown', t.hideMenu, t);
+				if (t.menu)
+					t.menu.hideMenu();
+			}
+
+			t.isMenuVisible = 0;
+		},
+
+		postRender : function() {
+			var t = this, s = t.settings;
+
+			Event.add(t.id, 'click', function() {
+				if (!t.isDisabled()) {
+					if (s.onclick)
+						s.onclick(t.value);
+
+					t.showMenu();
+				}
+			});
+		}
+
+		});
+})(tinymce);
+(function(tinymce) {
+	var DOM = tinymce.DOM, Event = tinymce.dom.Event, each = tinymce.each;
+
+	tinymce.create('tinymce.ui.SplitButton:tinymce.ui.MenuButton', {
+		SplitButton : function(id, s) {
+			this.parent(id, s);
+			this.classPrefix = 'mceSplitButton';
+		},
+
+		renderHTML : function() {
+			var h, t = this, s = t.settings, h1;
+
+			h = '<tbody><tr>';
+
+			if (s.image)
+				h1 = DOM.createHTML('img ', {src : s.image, 'class' : 'mceAction ' + s['class']});
+			else
+				h1 = DOM.createHTML('span', {'class' : 'mceAction ' + s['class']}, '');
+
+			h += '<td>' + DOM.createHTML('a', {id : t.id + '_action', href : 'javascript:;', 'class' : 'mceAction ' + s['class'], onclick : "return false;", onmousedown : 'return false;', title : s.title}, h1) + '</td>';
+	
+			h1 = DOM.createHTML('span', {'class' : 'mceOpen ' + s['class']});
+			h += '<td>' + DOM.createHTML('a', {id : t.id + '_open', href : 'javascript:;', 'class' : 'mceOpen ' + s['class'], onclick : "return false;", onmousedown : 'return false;', title : s.title}, h1) + '</td>';
+
+			h += '</tr></tbody>';
+
+			return DOM.createHTML('table', {id : t.id, 'class' : 'mceSplitButton mceSplitButtonEnabled ' + s['class'], cellpadding : '0', cellspacing : '0', onmousedown : 'return false;', title : s.title}, h);
+		},
+
+		postRender : function() {
+			var t = this, s = t.settings;
+
+			if (s.onclick) {
+				Event.add(t.id + '_action', 'click', function() {
+					if (!t.isDisabled())
+						s.onclick(t.value);
+				});
+			}
+
+			Event.add(t.id + '_open', 'click', t.showMenu, t);
+			Event.add(t.id + '_open', 'focus', function() {t._focused = 1;});
+			Event.add(t.id + '_open', 'blur', function() {t._focused = 0;});
+
+			// Old IE doesn't have hover on all elements
+			if (tinymce.isIE6 || !DOM.boxModel) {
+				Event.add(t.id, 'mouseover', function() {
+					if (!DOM.hasClass(t.id, 'mceSplitButtonDisabled'))
+						DOM.addClass(t.id, 'mceSplitButtonHover');
+				});
+
+				Event.add(t.id, 'mouseout', function() {
+					if (!DOM.hasClass(t.id, 'mceSplitButtonDisabled'))
+						DOM.removeClass(t.id, 'mceSplitButtonHover');
+				});
+			}
+		},
+
+		destroy : function() {
+			this.parent();
+
+			Event.clear(this.id + '_action');
+			Event.clear(this.id + '_open');
+		}
+
+		});
+})(tinymce);
+(function(tinymce) {
+	var DOM = tinymce.DOM, Event = tinymce.dom.Event, is = tinymce.is, each = tinymce.each;
+
+	tinymce.create('tinymce.ui.ColorSplitButton:tinymce.ui.SplitButton', {
+		ColorSplitButton : function(id, s) {
+			var t = this;
+
+			t.parent(id, s);
+
+			t.settings = s = tinymce.extend({
+				colors : '000000,993300,333300,003300,003366,000080,333399,333333,800000,FF6600,808000,008000,008080,0000FF,666699,808080,FF0000,FF9900,99CC00,339966,33CCCC,3366FF,800080,999999,FF00FF,FFCC00,FFFF00,00FF00,00FFFF,00CCFF,993366,C0C0C0,FF99CC,FFCC99,FFFF99,CCFFCC,CCFFFF,99CCFF,CC99FF,FFFFFF',
+				grid_width : 8,
+				default_color : '#888888'
+			}, t.settings);
+
+			t.onShowMenu = new tinymce.util.Dispatcher(t);
+			t.onHideMenu = new tinymce.util.Dispatcher(t);
+
+			t.value = s.default_color;
+		},
+
+		showMenu : function() {
+			var t = this, r, p, e, p2;
+
+			if (t.isDisabled())
+				return;
+
+			if (!t.isMenuRendered) {
+				t.renderMenu();
+				t.isMenuRendered = true;
+			}
+
+			if (t.isMenuVisible)
+				return t.hideMenu();
+
+			e = DOM.get(t.id);
+			DOM.show(t.id + '_menu');
+			DOM.addClass(e, 'mceSplitButtonSelected');
+			p2 = DOM.getPos(e);
+			DOM.setStyles(t.id + '_menu', {
+				left : p2.x,
+				top : p2.y + e.clientHeight,
+				zIndex : 200000
+			});
+			e = 0;
+
+			Event.add(DOM.doc, 'mousedown', t.hideMenu, t);
+			t.onShowMenu.dispatch(t);
+
+			if (t._focused) {
+				t._keyHandler = Event.add(t.id + '_menu', 'keydown', function(e) {
+					if (e.keyCode == 27)
+						t.hideMenu();
+				});
+
+				DOM.select('a', t.id + '_menu')[0].focus(); // Select first link
+			}
+
+			t.isMenuVisible = 1;
+		},
+
+		hideMenu : function(e) {
+			var t = this;
+
+			// Prevent double toogles by canceling the mouse click event to the button
+			if (e && e.type == "mousedown" && DOM.getParent(e.target, function(e) {return e.id === t.id + '_open';}))
+				return;
+
+			if (!e || !DOM.getParent(e.target, '.mceSplitButtonMenu')) {
+				DOM.removeClass(t.id, 'mceSplitButtonSelected');
+				Event.remove(DOM.doc, 'mousedown', t.hideMenu, t);
+				Event.remove(t.id + '_menu', 'keydown', t._keyHandler);
+				DOM.hide(t.id + '_menu');
+			}
+
+			t.onHideMenu.dispatch(t);
+
+			t.isMenuVisible = 0;
+		},
+
+		renderMenu : function() {
+			var t = this, m, i = 0, s = t.settings, n, tb, tr, w;
+
+			w = DOM.add(s.menu_container, 'div', {id : t.id + '_menu', 'class' : s['menu_class'] + ' ' + s['class'], style : 'position:absolute;left:0;top:-1000px;'});
+			m = DOM.add(w, 'div', {'class' : s['class'] + ' mceSplitButtonMenu'});
+			DOM.add(m, 'span', {'class' : 'mceMenuLine'});
+
+			n = DOM.add(m, 'table', {'class' : 'mceColorSplitMenu'});
+			tb = DOM.add(n, 'tbody');
+
+			// Generate color grid
+			i = 0;
+			each(is(s.colors, 'array') ? s.colors : s.colors.split(','), function(c) {
+				c = c.replace(/^#/, '');
+
+				if (!i--) {
+					tr = DOM.add(tb, 'tr');
+					i = s.grid_width - 1;
+				}
+
+				n = DOM.add(tr, 'td');
+
+				n = DOM.add(n, 'a', {
+					href : 'javascript:;',
+					style : {
+						backgroundColor : '#' + c
+					},
+					mce_color : '#' + c
+				});
+			});
+
+			if (s.more_colors_func) {
+				n = DOM.add(tb, 'tr');
+				n = DOM.add(n, 'td', {colspan : s.grid_width, 'class' : 'mceMoreColors'});
+				n = DOM.add(n, 'a', {id : t.id + '_more', href : 'javascript:;', onclick : 'return false;', 'class' : 'mceMoreColors'}, s.more_colors_title);
+
+				Event.add(n, 'click', function(e) {
+					s.more_colors_func.call(s.more_colors_scope || this);
+					return Event.cancel(e); // Cancel to fix onbeforeunload problem
+				});
+			}
+
+			DOM.addClass(m, 'mceColorSplitMenu');
+
+			Event.add(t.id + '_menu', 'click', function(e) {
+				var c;
+
+				e = e.target;
+
+				if (e.nodeName == 'A' && (c = e.getAttribute('mce_color')))
+					t.setColor(c);
+
+				return Event.cancel(e); // Prevent IE auto save warning
+			});
+
+			return w;
+		},
+
+		setColor : function(c) {
+			var t = this;
+
+			DOM.setStyle(t.id + '_preview', 'backgroundColor', c);
+
+			t.value = c;
+			t.hideMenu();
+			t.settings.onselect(c);
+		},
+
+		postRender : function() {
+			var t = this, id = t.id;
+
+			t.parent();
+			DOM.add(id + '_action', 'div', {id : id + '_preview', 'class' : 'mceColorPreview'});
+			DOM.setStyle(t.id + '_preview', 'backgroundColor', t.value);
+		},
+
+		destroy : function() {
+			this.parent();
+
+			Event.clear(this.id + '_menu');
+			Event.clear(this.id + '_more');
+			DOM.remove(this.id + '_menu');
+		}
+
+		});
+})(tinymce);
+tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', {
+	renderHTML : function() {
+		var t = this, h = '', c, co, dom = tinymce.DOM, s = t.settings, i, pr, nx, cl;
+
+		cl = t.controls;
+		for (i=0; i<cl.length; i++) {
+			// Get current control, prev control, next control and if the control is a list box or not
+			co = cl[i];
+			pr = cl[i - 1];
+			nx = cl[i + 1];
+
+			// Add toolbar start
+			if (i === 0) {
+				c = 'mceToolbarStart';
+
+				if (co.Button)
+					c += ' mceToolbarStartButton';
+				else if (co.SplitButton)
+					c += ' mceToolbarStartSplitButton';
+				else if (co.ListBox)
+					c += ' mceToolbarStartListBox';
+
+				h += dom.createHTML('td', {'class' : c}, dom.createHTML('span', null, '<!-- IE -->'));
+			}
+
+			// Add toolbar end before list box and after the previous button
+			// This is to fix the o2k7 editor skins
+			if (pr && co.ListBox) {
+				if (pr.Button || pr.SplitButton)
+					h += dom.createHTML('td', {'class' : 'mceToolbarEnd'}, dom.createHTML('span', null, '<!-- IE -->'));
+			}
+
+			// Render control HTML
+
+			// IE 8 quick fix, needed to propertly generate a hit area for anchors
+			if (dom.stdMode)
+				h += '<td style="position: relative">' + co.renderHTML() + '</td>';
+			else
+				h += '<td>' + co.renderHTML() + '</td>';
+
+			// Add toolbar start after list box and before the next button
+			// This is to fix the o2k7 editor skins
+			if (nx && co.ListBox) {
+				if (nx.Button || nx.SplitButton)
+					h += dom.createHTML('td', {'class' : 'mceToolbarStart'}, dom.createHTML('span', null, '<!-- IE -->'));
+			}
+		}
+
+		c = 'mceToolbarEnd';
+
+		if (co.Button)
+			c += ' mceToolbarEndButton';
+		else if (co.SplitButton)
+			c += ' mceToolbarEndSplitButton';
+		else if (co.ListBox)
+			c += ' mceToolbarEndListBox';
+
+		h += dom.createHTML('td', {'class' : c}, dom.createHTML('span', null, '<!-- IE -->'));
+
+		return dom.createHTML('table', {id : t.id, 'class' : 'mceToolbar' + (s['class'] ? ' ' + s['class'] : ''), cellpadding : '0', cellspacing : '0', align : t.settings.align || ''}, '<tbody><tr>' + h + '</tr></tbody>');
+	}
+
+	});
+(function(tinymce) {
+	var Dispatcher = tinymce.util.Dispatcher, each = tinymce.each;
+
+	tinymce.create('tinymce.AddOnManager', {
+		items : [],
+		urls : {},
+		lookup : {},
+		onAdd : new Dispatcher(this),
+
+		get : function(n) {
+			return this.lookup[n];
+		},
+
+		requireLangPack : function(n) {
+			var u, s = tinymce.EditorManager.settings;
+
+			if (s && s.language) {
+				u = this.urls[n] + '/langs/' + s.language + '.js';
+
+				if (!tinymce.dom.Event.domLoaded && !s.strict_mode)
+					tinymce.ScriptLoader.load(u);
+				else
+					tinymce.ScriptLoader.add(u);
+			}
+		},
+
+		add : function(id, o) {
+			this.items.push(o);
+			this.lookup[id] = o;
+			this.onAdd.dispatch(this, id, o);
+
+			return o;
+		},
+
+		load : function(n, u, cb, s) {
+			var t = this;
+
+			if (t.urls[n])
+				return;
+
+			if (u.indexOf('/') != 0 && u.indexOf('://') == -1)
+				u = tinymce.baseURL + '/' +  u;
+
+			t.urls[n] = u.substring(0, u.lastIndexOf('/'));
+			tinymce.ScriptLoader.add(u, cb, s);
+		}
+
+		});
+
+	// Create plugin and theme managers
+	tinymce.PluginManager = new tinymce.AddOnManager();
+	tinymce.ThemeManager = new tinymce.AddOnManager();
+}(tinymce));(function(tinymce) {
+	// Shorten names
+	var each = tinymce.each, extend = tinymce.extend, DOM = tinymce.DOM, Event = tinymce.dom.Event, ThemeManager = tinymce.ThemeManager, PluginManager = tinymce.PluginManager, explode = tinymce.explode;
+
+	tinymce.create('static tinymce.EditorManager', {
+		editors : {},
+		i18n : {},
+		activeEditor : null,
+
+		preInit : function() {
+			var t = this, lo = window.location;
+
+			// Setup some URLs where the editor API is located and where the document is
+			tinymce.documentBaseURL = lo.href.replace(/[\?#].*$/, '').replace(/[\/\\][^\/]+$/, '');
+			if (!/[\/\\]$/.test(tinymce.documentBaseURL))
+				tinymce.documentBaseURL += '/';
+
+			tinymce.baseURL = new tinymce.util.URI(tinymce.documentBaseURL).toAbsolute(tinymce.baseURL);
+			tinymce.EditorManager.baseURI = new tinymce.util.URI(tinymce.baseURL);
+
+			// Add before unload listener
+			// This was required since IE was leaking memory if you added and removed beforeunload listeners
+			// with attachEvent/detatchEvent so this only adds one listener and instances can the attach to the onBeforeUnload event
+			t.onBeforeUnload = new tinymce.util.Dispatcher(t);
+
+			// Must be on window or IE will leak if the editor is placed in frame or iframe
+			Event.add(window, 'beforeunload', function(e) {
+				t.onBeforeUnload.dispatch(t, e);
+			});
+		},
+
+		init : function(s) {
+			var t = this, pl, sl = tinymce.ScriptLoader, c, e, el = [], ed;
+
+			function execCallback(se, n, s) {
+				var f = se[n];
+
+				if (!f)
+					return;
+
+				if (tinymce.is(f, 'string')) {
+					s = f.replace(/\.\w+$/, '');
+					s = s ? tinymce.resolve(s) : 0;
+					f = tinymce.resolve(f);
+				}
+
+				return f.apply(s || this, Array.prototype.slice.call(arguments, 2));
+			};
+
+			s = extend({
+				theme : "simple",
+				language : "en",
+				strict_loading_mode : document.contentType == 'application/xhtml+xml'
+			}, s);
+
+			t.settings = s;
+
+			// If page not loaded and strict mode isn't enabled then load them
+			if (!Event.domLoaded && !s.strict_loading_mode) {
+				// Load language
+				if (s.language)
+					sl.add(tinymce.baseURL + '/langs/' + s.language + '.js');
+
+				// Load theme
+				if (s.theme && s.theme.charAt(0) != '-' && !ThemeManager.urls[s.theme])
+					ThemeManager.load(s.theme, 'themes/' + s.theme + '/editor_template' + tinymce.suffix + '.js');
+
+				// Load plugins
+				if (s.plugins) {
+					pl = explode(s.plugins);
+
+					// Load compat2x first
+					if (tinymce.inArray(pl, 'compat2x') != -1)
+						PluginManager.load('compat2x', 'plugins/compat2x/editor_plugin' + tinymce.suffix + '.js');
+
+					// Load rest if plugins
+					each(pl, function(v) {
+						if (v && v.charAt(0) != '-' && !PluginManager.urls[v]) {
+							// Skip safari plugin for other browsers
+							if (!tinymce.isWebKit && v == 'safari')
+								return;
+
+							PluginManager.load(v, 'plugins/' + v + '/editor_plugin' + tinymce.suffix + '.js');
+						}
+					});
+				}
+
+				sl.loadQueue();
+			}
+
+			// Legacy call
+			Event.add(document, 'init', function() {
+				var l, co;
+
+				execCallback(s, 'onpageload');
+
+				// Verify that it's a valid browser
+				if (s.browsers) {
+					l = false;
+
+					each(explode(s.browsers), function(v) {
+						switch (v) {
+							case 'ie':
+							case 'msie':
+								if (tinymce.isIE)
+									l = true;
+								break;
+
+							case 'gecko':
+								if (tinymce.isGecko)
+									l = true;
+								break;
+
+							case 'safari':
+							case 'webkit':
+								if (tinymce.isWebKit)
+									l = true;
+								break;
+
+							case 'opera':
+								if (tinymce.isOpera)
+									l = true;
+
+								break;
+						}
+					});
+
+					// Not a valid one
+					if (!l)
+						return;
+				}
+
+				switch (s.mode) {
+					case "exact":
+						l = s.elements || '';
+
+						if(l.length > 0) {
+							each(explode(l), function(v) {
+								if (DOM.get(v)) {
+									ed = new tinymce.Editor(v, s);
+									el.push(ed);
+									ed.render(1);
+								} else {
+									c = 0;
+
+									each(document.forms, function(f) {
+										each(f.elements, function(e) {
+											if (e.name === v) {
+												v = 'mce_editor_' + c;
+												DOM.setAttrib(e, 'id', v);
+
+												ed = new tinymce.Editor(v, s);
+												el.push(ed);
+												ed.render(1);
+											}
+										});
+									});
+								}
+							});
+						}
+						break;
+
+					case "textareas":
+					case "specific_textareas":
+						function hasClass(n, c) {
+							return c.constructor === RegExp ? c.test(n.className) : DOM.hasClass(n, c);
+						};
+
+						each(DOM.select('textarea'), function(v) {
+							if (s.editor_deselector && hasClass(v, s.editor_deselector))
+								return;
+
+							if (!s.editor_selector || hasClass(v, s.editor_selector)) {
+								// Can we use the name
+								e = DOM.get(v.name);
+								if (!v.id && !e)
+									v.id = v.name;
+
+								// Generate unique name if missing or already exists
+								if (!v.id || t.get(v.id))
+									v.id = DOM.uniqueId();
+
+								ed = new tinymce.Editor(v.id, s);
+								el.push(ed);
+								ed.render(1);
+							}
+						});
+						break;
+				}
+
+				// Call onInit when all editors are initialized
+				if (s.oninit) {
+					l = co = 0;
+
+					each (el, function(ed) {
+						co++;
+
+						if (!ed.initialized) {
+							// Wait for it
+							ed.onInit.add(function() {
+								l++;
+
+								// All done
+								if (l == co)
+									execCallback(s, 'oninit');
+							});
+						} else
+							l++;
+
+						// All done
+						if (l == co)
+							execCallback(s, 'oninit');					
+					});
+				}
+			});
+		},
+
+		get : function(id) {
+			return this.editors[id];
+		},
+
+		getInstanceById : function(id) {
+			return this.get(id);
+		},
+
+		add : function(e) {
+			this.editors[e.id] = e;
+			this._setActive(e);
+
+			return e;
+		},
+
+		remove : function(e) {
+			var t = this;
+
+			// Not in the collection
+			if (!t.editors[e.id])
+				return null;
+
+			delete t.editors[e.id];
+
+			// Select another editor since the active one was removed
+			if (t.activeEditor == e) {
+				t._setActive(null);
+
+				each(t.editors, function(e) {
+					t._setActive(e);
+					return false; // Break
+				});
+			}
+
+			e.destroy();
+
+			return e;
+		},
+
+		execCommand : function(c, u, v) {
+			var t = this, ed = t.get(v), w;
+
+			// Manager commands
+			switch (c) {
+				case "mceFocus":
+					ed.focus();
+					return true;
+
+				case "mceAddEditor":
+				case "mceAddControl":
+					if (!t.get(v))
+						new tinymce.Editor(v, t.settings).render();
+
+					return true;
+
+				case "mceAddFrameControl":
+					w = v.window;
+
+					// Add tinyMCE global instance and tinymce namespace to specified window
+					w.tinyMCE = tinyMCE;
+					w.tinymce = tinymce;
+
+					tinymce.DOM.doc = w.document;
+					tinymce.DOM.win = w;
+
+					ed = new tinymce.Editor(v.element_id, v);
+					ed.render();
+
+					// Fix IE memory leaks
+					if (tinymce.isIE) {
+						function clr() {
+							ed.destroy();
+							w.detachEvent('onunload', clr);
+							w = w.tinyMCE = w.tinymce = null; // IE leak
+						};
+
+						w.attachEvent('onunload', clr);
+					}
+
+					v.page_window = null;
+
+					return true;
+
+				case "mceRemoveEditor":
+				case "mceRemoveControl":
+					if (ed)
+						ed.remove();
+
+					return true;
+
+				case 'mceToggleEditor':
+					if (!ed) {
+						t.execCommand('mceAddControl', 0, v);
+						return true;
+					}
+
+					if (ed.isHidden())
+						ed.show();
+					else
+						ed.hide();
+
+					return true;
+			}
+
+			// Run command on active editor
+			if (t.activeEditor)
+				return t.activeEditor.execCommand(c, u, v);
+
+			return false;
+		},
+
+		execInstanceCommand : function(id, c, u, v) {
+			var ed = this.get(id);
+
+			if (ed)
+				return ed.execCommand(c, u, v);
+
+			return false;
+		},
+
+		triggerSave : function() {
+			each(this.editors, function(e) {
+				e.save();
+			});
+		},
+
+		addI18n : function(p, o) {
+			var lo, i18n = this.i18n;
+
+			if (!tinymce.is(p, 'string')) {
+				each(p, function(o, lc) {
+					each(o, function(o, g) {
+						each(o, function(o, k) {
+							if (g === 'common')
+								i18n[lc + '.' + k] = o;
+							else
+								i18n[lc + '.' + g + '.' + k] = o;
+						});
+					});
+				});
+			} else {
+				each(o, function(o, k) {
+					i18n[p + '.' + k] = o;
+				});
+			}
+		},
+
+		// Private methods
+
+		_setActive : function(e) {
+			this.selectedInstance = this.activeEditor = e;
+		}
+
+		});
+
+	tinymce.EditorManager.preInit();
+})(tinymce);
+
+// Short for editor manager window.tinyMCE is needed when TinyMCE gets loaded though a XHR call
+var tinyMCE = window.tinyMCE = tinymce.EditorManager;
+(function(tinymce) {
+	var DOM = tinymce.DOM, Event = tinymce.dom.Event, extend = tinymce.extend, Dispatcher = tinymce.util.Dispatcher;
+	var each = tinymce.each, isGecko = tinymce.isGecko, isIE = tinymce.isIE, isWebKit = tinymce.isWebKit;
+	var is = tinymce.is, ThemeManager = tinymce.ThemeManager, PluginManager = tinymce.PluginManager, EditorManager = tinymce.EditorManager;
+	var inArray = tinymce.inArray, grep = tinymce.grep, explode = tinymce.explode;
+
+	tinymce.create('tinymce.Editor', {
+		Editor : function(id, s) {
+			var t = this;
+
+			t.id = t.editorId = id;
+			t.execCommands = {};
+			t.queryStateCommands = {};
+			t.queryValueCommands = {};
+			t.plugins = {};
+
+			// Add events to the editor
+			each([
+				'onPreInit',
+				'onBeforeRenderUI',
+				'onPostRender',
+				'onInit',
+				'onRemove',
+				'onActivate',
+				'onDeactivate',
+				'onClick',
+				'onEvent',
+				'onMouseUp',
+				'onMouseDown',
+				'onDblClick',
+				'onKeyDown',
+				'onKeyUp',
+				'onKeyPress',
+				'onContextMenu',
+				'onSubmit',
+				'onReset',
+				'onPaste',
+				'onPreProcess',
+				'onPostProcess',
+				'onBeforeSetContent',
+				'onBeforeGetContent',
+				'onSetContent',
+				'onGetContent',
+				'onLoadContent',
+				'onSaveContent',
+				'onNodeChange',
+				'onChange',
+				'onBeforeExecCommand',
+				'onExecCommand',
+				'onUndo',
+				'onRedo',
+				'onVisualAid',
+				'onSetProgressState'
+			], function(e) {
+				t[e] = new Dispatcher(t);
+			});
+
+			// Default editor config
+			t.settings = s = extend({
+				id : id,
+				language : 'en',
+				docs_language : 'en',
+				theme : 'simple',
+				skin : 'default',
+				delta_width : 0,
+				delta_height : 0,
+				popup_css : '',
+				plugins : '',
+				document_base_url : tinymce.documentBaseURL,
+				add_form_submit_trigger : 1,
+				submit_patch : 1,
+				add_unload_trigger : 1,
+				convert_urls : 1,
+				relative_urls : 1,
+				remove_script_host : 1,
+				table_inline_editing : 0,
+				object_resizing : 1,
+				cleanup : 1,
+				accessibility_focus : 1,
+				custom_shortcuts : 1,
+				custom_undo_redo_keyboard_shortcuts : 1,
+				custom_undo_redo_restore_selection : 1,
+				custom_undo_redo : 1,
+				doctype : '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">',
+				visual_table_class : 'mceItemTable',
+				visual : 1,
+				inline_styles : true,
+				convert_fonts_to_spans : true,
+				font_size_style_values : 'xx-small,x-small,small,medium,large,x-large,xx-large',
+				apply_source_formatting : 1,
+				directionality : 'ltr',
+				forced_root_block : 'p',
+				valid_elements : '@[id|class|style|title|dir<ltr?rtl|lang|xml::lang|onclick|ondblclick|onmousedown|onmouseup|onmouseover|onmousemove|onmouseout|onkeypress|onkeydown|onkeyup],a[rel|rev|charset|hreflang|tabindex|accesskey|type|name|href|target|title|class|onfocus|onblur],strong/b,em/i,strike,u,#p[align],-ol[type|compact],-ul[type|compact],-li,br,img[longdesc|usemap|src|border|alt=|title|hspace|vspace|width|height|align],-sub,-sup,-blockquote[cite],-table[border=0|cellspacing|cellpadding|width|frame|rules|height|align|summary|bgcolor|background|bordercolor],-tr[rowspan|width|height|align|valign|bgcolor|background|bordercolor],tbody,thead,tfoot,#td[colspan|rowspan|width|height|align|valign|bgcolor|background|bordercolor|scope],#th[colspan|rowspan|width|height|align|valign|scope],caption,-div,-span,-code,-pre,address,-h1,-h2,-h3,-h4,-h5,-h6,hr[size|noshade],-font[face|size|color],dd,dl,dt,cite,abbr,acronym,del[datetime|cite],ins[datetime|cite],object[classid|width|height|codebase|*],param[name|value],embed[type|width|height|src|*],script[src|type],map[name],area[shape|coords|href|alt|target],bdo,button,col[align|char|charoff|span|valign|width],colgroup[align|char|charoff|span|valign|width],dfn,fieldset,form[action|accept|accept-charset|enctype|method],input[accept|alt|checked|disabled|maxlength|name|readonly|size|src|type|value|tabindex|accesskey],kbd,label[for],legend,noscript,optgroup[label|disabled],option[disabled|label|selected|value],q[cite],samp,select[disabled|multiple|name|size],small,textarea[cols|rows|disabled|name|readonly],tt,var,big',
+				hidden_input : 1,
+				padd_empty_editor : 1,
+				render_ui : 1,
+				init_theme : 1,
+				force_p_newlines : 1,
+				indentation : '30px',
+				keep_styles : 1,
+				fix_table_elements : 1,
+				removeformat_selector : 'span,b,strong,em,i,font,u,strike'
+			}, s);
+
+			// Setup URIs
+			t.documentBaseURI = new tinymce.util.URI(s.document_base_url || tinymce.documentBaseURL, {
+				base_uri : tinyMCE.baseURI
+			});
+			t.baseURI = EditorManager.baseURI;
+
+			// Call setup
+			t.execCallback('setup', t);
+		},
+
+		render : function(nst) {
+			var t = this, s = t.settings, id = t.id, sl = tinymce.ScriptLoader;
+
+			// Page is not loaded yet, wait for it
+			if (!Event.domLoaded) {
+				Event.add(document, 'init', function() {
+					t.render();
+				});
+				return;
+			}
+
+			// Force strict loading mode if render us called by user and not internally
+			if (!nst) {
+				s.strict_loading_mode = 1;
+				tinyMCE.settings = s;
+			}
+
+			// Element not found, then skip initialization
+			if (!t.getElement())
+				return;
+
+			if (s.strict_loading_mode) {
+				sl.settings.strict_mode = s.strict_loading_mode;
+				tinymce.DOM.settings.strict = 1;
+			}
+
+			// Add hidden input for non input elements inside form elements
+			if (!/TEXTAREA|INPUT/i.test(t.getElement().nodeName) && s.hidden_input && DOM.getParent(id, 'form'))
+				DOM.insertAfter(DOM.create('input', {type : 'hidden', name : id}), id);
+
+			if (tinymce.WindowManager)
+				t.windowManager = new tinymce.WindowManager(t);
+
+			if (s.encoding == 'xml') {
+				t.onGetContent.add(function(ed, o) {
+					if (o.save)
+						o.content = DOM.encode(o.content);
+				});
+			}
+
+			if (s.add_form_submit_trigger) {
+				t.onSubmit.addToTop(function() {
+					if (t.initialized) {
+						t.save();
+						t.isNotDirty = 1;
+					}
+				});
+			}
+
+			if (s.add_unload_trigger) {
+				t._beforeUnload = tinyMCE.onBeforeUnload.add(function() {
+					if (t.initialized && !t.destroyed && !t.isHidden())
+						t.save({format : 'raw', no_events : true});
+				});
+			}
+
+			tinymce.addUnload(t.destroy, t);
+
+			if (s.submit_patch) {
+				t.onBeforeRenderUI.add(function() {
+					var n = t.getElement().form;
+
+					if (!n)
+						return;
+
+					// Already patched
+					if (n._mceOldSubmit)
+						return;
+
+					// Check page uses id="submit" or name="submit" for it's submit button
+					if (!n.submit.nodeType && !n.submit.length) {
+						t.formElement = n;
+						n._mceOldSubmit = n.submit;
+						n.submit = function() {
+							// Save all instances
+							EditorManager.triggerSave();
+							t.isNotDirty = 1;
+
+							return t.formElement._mceOldSubmit(t.formElement);
+						};
+					}
+
+					n = null;
+				});
+			}
+
+			// Load scripts
+			function loadScripts() {
+				if (s.language)
+					sl.add(tinymce.baseURL + '/langs/' + s.language + '.js');
+
+				if (s.theme && s.theme.charAt(0) != '-' && !ThemeManager.urls[s.theme])
+					ThemeManager.load(s.theme, 'themes/' + s.theme + '/editor_template' + tinymce.suffix + '.js');
+
+				each(explode(s.plugins), function(p) {
+					if (p && p.charAt(0) != '-' && !PluginManager.urls[p]) {
+						// Skip safari plugin for other browsers
+						if (!isWebKit && p == 'safari')
+							return;
+
+						PluginManager.load(p, 'plugins/' + p + '/editor_plugin' + tinymce.suffix + '.js');
+					}
+				});
+
+				// Init when que is loaded
+				sl.loadQueue(function() {
+					if (!t.removed)
+						t.init();
+				});
+			};
+
+			// Load compat2x first
+			if (s.plugins.indexOf('compat2x') != -1) {
+				PluginManager.load('compat2x', 'plugins/compat2x/editor_plugin' + tinymce.suffix + '.js');
+				sl.loadQueue(loadScripts);
+			} else
+				loadScripts();
+		},
+
+		init : function() {
+			var n, t = this, s = t.settings, w, h, e = t.getElement(), o, ti, u, bi, bc, re;
+
+			EditorManager.add(t);
+
+			// Create theme
+			if (s.theme) {
+				s.theme = s.theme.replace(/-/, '');
+				o = ThemeManager.get(s.theme);
+				t.theme = new o();
+
+				if (t.theme.init && s.init_theme)
+					t.theme.init(t, ThemeManager.urls[s.theme] || tinymce.documentBaseURL.replace(/\/$/, ''));
+			}
+
+			// Create all plugins
+			each(explode(s.plugins.replace(/\-/g, '')), function(p) {
+				var c = PluginManager.get(p), u = PluginManager.urls[p] || tinymce.documentBaseURL.replace(/\/$/, ''), po;
+
+				if (c) {
+					po = new c(t, u);
+
+					t.plugins[p] = po;
+
+					if (po.init)
+						po.init(t, u);
+				}
+			});
+
+			// Setup popup CSS path(s)
+			if (s.popup_css !== false) {
+				if (s.popup_css)
+					s.popup_css = t.documentBaseURI.toAbsolute(s.popup_css);
+				else
+					s.popup_css = t.baseURI.toAbsolute("themes/" + s.theme + "/skins/" + s.skin + "/dialog.css");
+			}
+
+			if (s.popup_css_add)
+				s.popup_css += ',' + t.documentBaseURI.toAbsolute(s.popup_css_add);
+
+			// Setup control factory
+			t.controlManager = new tinymce.ControlManager(t);
+			t.undoManager = new tinymce.UndoManager(t);
+
+			// Pass through
+			t.undoManager.onAdd.add(function(um, l) {
+				if (!l.initial)
+					return t.onChange.dispatch(t, l, um);
+			});
+
+			t.undoManager.onUndo.add(function(um, l) {
+				return t.onUndo.dispatch(t, l, um);
+			});
+
+			t.undoManager.onRedo.add(function(um, l) {
+				return t.onRedo.dispatch(t, l, um);
+			});
+
+			if (s.custom_undo_redo) {
+				t.onExecCommand.add(function(ed, cmd, ui, val, a) {
+					if (cmd != 'Undo' && cmd != 'Redo' && cmd != 'mceRepaint' && (!a || !a.skip_undo))
+						t.undoManager.add();
+				});
+			}
+
+			t.onExecCommand.add(function(ed, c) {
+				// Don't refresh the select lists until caret move
+				if (!/^(FontName|FontSize)$/.test(c))
+					t.nodeChanged();
+			});
+
+			// Remove ghost selections on images and tables in Gecko
+			if (isGecko) {
+				function repaint(a, o) {
+					if (!o || !o.initial)
+						t.execCommand('mceRepaint');
+				};
+
+				t.onUndo.add(repaint);
+				t.onRedo.add(repaint);
+				t.onSetContent.add(repaint);
+			}
+
+			// Enables users to override the control factory
+			t.onBeforeRenderUI.dispatch(t, t.controlManager);
+
+			// Measure box
+			if (s.render_ui) {
+				w = s.width || e.style.width || e.offsetWidth;
+				h = s.height || e.style.height || e.offsetHeight;
+				t.orgDisplay = e.style.display;
+				re = /^[0-9\.]+(|px)$/i;
+
+				if (re.test('' + w))
+					w = Math.max(parseInt(w) + (o.deltaWidth || 0), 100);
+
+				if (re.test('' + h))
+					h = Math.max(parseInt(h) + (o.deltaHeight || 0), 100);
+
+				// Render UI
+				o = t.theme.renderUI({
+					targetNode : e,
+					width : w,
+					height : h,
+					deltaWidth : s.delta_width,
+					deltaHeight : s.delta_height
+				});
+
+				t.editorContainer = o.editorContainer;
+			}
+
+
+			// User specified a document.domain value
+			if (document.domain && location.hostname != document.domain)
+				tinymce.relaxedDomain = document.domain;
+
+			// Resize editor
+			DOM.setStyles(o.sizeContainer || o.editorContainer, {
+				width : w,
+				height : h
+			});
+
+			h = (o.iframeHeight || h) + (typeof(h) == 'number' ? (o.deltaHeight || 0) : '');
+			if (h < 100)
+				h = 100;
+
+			t.iframeHTML = s.doctype + '<html><head xmlns="http://www.w3.org/1999/xhtml">';
+
+			// We only need to override paths if we have to
+			// IE has a bug where it remove site absolute urls to relative ones if this is specified
+			if (s.document_base_url != tinymce.documentBaseURL)
+				t.iframeHTML += '<base href="' + t.documentBaseURI.getURI() + '" />';
+
+			t.iframeHTML += '<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />';
+
+			if (tinymce.relaxedDomain)
+				t.iframeHTML += '<script type="text/javascript">document.domain = "' + tinymce.relaxedDomain + '";</script>';
+
+			bi = s.body_id || 'tinymce';
+			if (bi.indexOf('=') != -1) {
+				bi = t.getParam('body_id', '', 'hash');
+				bi = bi[t.id] || bi;
+			}
+
+			bc = s.body_class || '';
+			if (bc.indexOf('=') != -1) {
+				bc = t.getParam('body_class', '', 'hash');
+				bc = bc[t.id] || '';
+			}
+
+			t.iframeHTML += '</head><body id="' + bi + '" class="mceContentBody ' + bc + '"></body></html>';
+
+			// Domain relaxing enabled, then set document domain
+			if (tinymce.relaxedDomain) {
+				// We need to write the contents here in IE since multiple writes messes up refresh button and back button
+				if (isIE || (tinymce.isOpera && parseFloat(opera.version()) >= 9.5))
+					u = 'javascript:(function(){document.open();document.domain="' + document.domain + '";var ed = window.parent.tinyMCE.get("' + t.id + '");document.write(ed.iframeHTML);document.close();ed.setupIframe();})()';
+				else if (tinymce.isOpera)
+					u = 'javascript:(function(){document.open();document.domain="' + document.domain + '";document.close();ed.setupIframe();})()';					
+			}
+
+			// Create iframe
+			n = DOM.add(o.iframeContainer, 'iframe', {
+				id : t.id + "_ifr",
+				src : u || 'javascript:""', // Workaround for HTTPS warning in IE6/7
+				frameBorder : '0',
+				style : {
+					width : '100%',
+					height : h
+				}
+			});
+
+			t.contentAreaContainer = o.iframeContainer;
+			DOM.get(o.editorContainer).style.display = t.orgDisplay;
+			DOM.get(t.id).style.display = 'none';
+
+			if (!isIE || !tinymce.relaxedDomain)
+				t.setupIframe();
+
+			e = n = o = null; // Cleanup
+		},
+
+		setupIframe : function() {
+			var t = this, s = t.settings, e = DOM.get(t.id), d = t.getDoc(), h, b;
+
+			// Setup iframe body
+			if (!isIE || !tinymce.relaxedDomain) {
+				d.open();
+				d.write(t.iframeHTML);
+				d.close();
+			}
+
+			// Design mode needs to be added here Ctrl+A will fail otherwise
+			if (!isIE) {
+				try {
+					if (!s.readonly)
+						d.designMode = 'On';
+				} catch (ex) {
+					// Will fail on Gecko if the editor is placed in an hidden container element
+					// The design mode will be set ones the editor is focused
+				}
+			}
+
+			// IE needs to use contentEditable or it will display non secure items for HTTPS
+			if (isIE) {
+				// It will not steal focus if we hide it while setting contentEditable
+				b = t.getBody();
+				DOM.hide(b);
+
+				if (!s.readonly)
+					b.contentEditable = true;
+
+				DOM.show(b);
+			}
+
+			// Setup objects
+			t.dom = new tinymce.DOM.DOMUtils(t.getDoc(), {
+				keep_values : true,
+				url_converter : t.convertURL,
+				url_converter_scope : t,
+				hex_colors : s.force_hex_style_colors,
+				class_filter : s.class_filter,
+				update_styles : 1,
+				fix_ie_paragraphs : 1
+			});
+
+			t.serializer = new tinymce.dom.Serializer({
+				entity_encoding : s.entity_encoding,
+				entities : s.entities,
+				valid_elements : s.verify_html === false ? '*[*]' : s.valid_elements,
+				extended_valid_elements : s.extended_valid_elements,
+				valid_child_elements : s.valid_child_elements,
+				invalid_elements : s.invalid_elements,
+				fix_table_elements : s.fix_table_elements,
+				fix_list_elements : s.fix_list_elements,
+				fix_content_duplication : s.fix_content_duplication,
+				convert_fonts_to_spans : s.convert_fonts_to_spans,
+				font_size_classes  : s.font_size_classes,
+				font_size_style_values : s.font_size_style_values,
+				apply_source_formatting : s.apply_source_formatting,
+				remove_linebreaks : s.remove_linebreaks,
+				element_format : s.element_format,
+				dom : t.dom
+			});
+
+			t.selection = new tinymce.dom.Selection(t.dom, t.getWin(), t.serializer);
+			t.forceBlocks = new tinymce.ForceBlocks(t, {
+				forced_root_block : s.forced_root_block
+			});
+			t.editorCommands = new tinymce.EditorCommands(t);
+
+			// Pass through
+			t.serializer.onPreProcess.add(function(se, o) {
+				return t.onPreProcess.dispatch(t, o, se);
+			});
+
+			t.serializer.onPostProcess.add(function(se, o) {
+				return t.onPostProcess.dispatch(t, o, se);
+			});
+
+			t.onPreInit.dispatch(t);
+
+			if (!s.gecko_spellcheck)
+				t.getBody().spellcheck = 0;
+
+			if (!s.readonly)
+				t._addEvents();
+
+			t.controlManager.onPostRender.dispatch(t, t.controlManager);
+			t.onPostRender.dispatch(t);
+
+			if (s.directionality)
+				t.getBody().dir = s.directionality;
+
+			if (s.nowrap)
+				t.getBody().style.whiteSpace = "nowrap";
+
+			if (s.custom_elements) {
+				function handleCustom(ed, o) {
+					each(explode(s.custom_elements), function(v) {
+						var n;
+
+						if (v.indexOf('~') === 0) {
+							v = v.substring(1);
+							n = 'span';
+						} else
+							n = 'div';
+
+						o.content = o.content.replace(new RegExp('<(' + v + ')([^>]*)>', 'g'), '<' + n + ' mce_name="$1"$2>');
+						o.content = o.content.replace(new RegExp('</(' + v + ')>', 'g'), '</' + n + '>');
+					});
+				};
+
+				t.onBeforeSetContent.add(handleCustom);
+				t.onPostProcess.add(function(ed, o) {
+					if (o.set)
+						handleCustom(ed, o);
+				});
+			}
+
+			if (s.handle_node_change_callback) {
+				t.onNodeChange.add(function(ed, cm, n) {
+					t.execCallback('handle_node_change_callback', t.id, n, -1, -1, true, t.selection.isCollapsed());
+				});
+			}
+
+			if (s.save_callback) {
+				t.onSaveContent.add(function(ed, o) {
+					var h = t.execCallback('save_callback', t.id, o.content, t.getBody());
+
+					if (h)
+						o.content = h;
+				});
+			}
+
+			if (s.onchange_callback) {
+				t.onChange.add(function(ed, l) {
+					t.execCallback('onchange_callback', t, l);
+				});
+			}
+
+			if (s.convert_newlines_to_brs) {
+				t.onBeforeSetContent.add(function(ed, o) {
+					if (o.initial)
+						o.content = o.content.replace(/\r?\n/g, '<br />');
+				});
+			}
+
+			if (s.fix_nesting && isIE) {
+				t.onBeforeSetContent.add(function(ed, o) {
+					o.content = t._fixNesting(o.content);
+				});
+			}
+
+			if (s.preformatted) {
+				t.onPostProcess.add(function(ed, o) {
+					o.content = o.content.replace(/^\s*<pre.*?>/, '');
+					o.content = o.content.replace(/<\/pre>\s*$/, '');
+
+					if (o.set)
+						o.content = '<pre class="mceItemHidden">' + o.content + '</pre>';
+				});
+			}
+
+			if (s.verify_css_classes) {
+				t.serializer.attribValueFilter = function(n, v) {
+					var s, cl;
+
+					if (n == 'class') {
+						// Build regexp for classes
+						if (!t.classesRE) {
+							cl = t.dom.getClasses();
+
+							if (cl.length > 0) {
+								s = '';
+
+								each (cl, function(o) {
+									s += (s ? '|' : '') + o['class'];
+								});
+
+								t.classesRE = new RegExp('(' + s + ')', 'gi');
+							}
+						}
+
+						return !t.classesRE || /(\bmceItem\w+\b|\bmceTemp\w+\b)/g.test(v) || t.classesRE.test(v) ? v : '';
+					}
+
+					return v;
+				};
+			}
+
+			if (s.convert_fonts_to_spans)
+				t._convertFonts();
+
+			if (s.inline_styles)
+				t._convertInlineElements();
+
+			if (s.cleanup_callback) {
+				t.onBeforeSetContent.add(function(ed, o) {
+					o.content = t.execCallback('cleanup_callback', 'insert_to_editor', o.content, o);
+				});
+
+				t.onPreProcess.add(function(ed, o) {
+					if (o.set)
+						t.execCallback('cleanup_callback', 'insert_to_editor_dom', o.node, o);
+
+					if (o.get)
+						t.execCallback('cleanup_callback', 'get_from_editor_dom', o.node, o);
+				});
+
+				t.onPostProcess.add(function(ed, o) {
+					if (o.set)
+						o.content = t.execCallback('cleanup_callback', 'insert_to_editor', o.content, o);
+
+					if (o.get)						
+						o.content = t.execCallback('cleanup_callback', 'get_from_editor', o.content, o);
+				});
+			}
+
+			if (s.save_callback) {
+				t.onGetContent.add(function(ed, o) {
+					if (o.save)
+						o.content = t.execCallback('save_callback', t.id, o.content, t.getBody());
+				});
+			}
+
+			if (s.handle_event_callback) {
+				t.onEvent.add(function(ed, e, o) {
+					if (t.execCallback('handle_event_callback', e, ed, o) === false)
+						Event.cancel(e);
+				});
+			}
+
+			// Add visual aids when new contents is added
+			t.onSetContent.add(function() {
+				t.addVisual(t.getBody());
+			});
+
+			// Remove empty contents
+			if (s.padd_empty_editor) {
+				t.onPostProcess.add(function(ed, o) {
+					o.content = o.content.replace(/^(<p[^>]*>(&nbsp;|&#160;|\s|\u00a0|)<\/p>[\r\n]*|<br \/>[\r\n]*)$/, '');
+				});
+			}
+
+			if (isGecko) {
+				// Fix gecko link bug, when a link is placed at the end of block elements there is
+				// no way to move the caret behind the link. This fix adds a bogus br element after the link
+				function fixLinks(ed, o) {
+					each(ed.dom.select('a'), function(n) {
+						var pn = n.parentNode;
+
+						if (ed.dom.isBlock(pn) && pn.lastChild === n)
+							ed.dom.add(pn, 'br', {'mce_bogus' : 1});
+					});
+				};
+
+				t.onExecCommand.add(function(ed, cmd) {
+					if (cmd === 'CreateLink')
+						fixLinks(ed);
+				});
+
+				t.onSetContent.add(t.selection.onSetContent.add(fixLinks));
+
+				if (!s.readonly) {
+					try {
+						// Design mode must be set here once again to fix a bug where
+						// Ctrl+A/Delete/Backspace didn't work if the editor was added using mceAddControl then removed then added again
+						d.designMode = 'Off';
+						d.designMode = 'On';
+					} catch (ex) {
+						// Will fail on Gecko if the editor is placed in an hidden container element
+						// The design mode will be set ones the editor is focused
+					}
+				}
+			}
+
+			// A small timeout was needed since firefox will remove. Bug: #1838304
+			setTimeout(function () {
+				if (t.removed)
+					return;
+
+				t.load({initial : true, format : (s.cleanup_on_startup ? 'html' : 'raw')});
+				t.startContent = t.getContent({format : 'raw'});
+				t.undoManager.add({initial : true});
+				t.initialized = true;
+
+				t.onInit.dispatch(t);
+				t.execCallback('setupcontent_callback', t.id, t.getBody(), t.getDoc());
+				t.execCallback('init_instance_callback', t);
+				t.focus(true);
+				t.nodeChanged({initial : 1});
+
+				// Load specified content CSS last
+				if (s.content_css) {
+					tinymce.each(explode(s.content_css), function(u) {
+						t.dom.loadCSS(t.documentBaseURI.toAbsolute(u));
+					});
+				}
+
+				// Handle auto focus
+				if (s.auto_focus) {
+					setTimeout(function () {
+						var ed = EditorManager.get(s.auto_focus);
+
+						ed.selection.select(ed.getBody(), 1);
+						ed.selection.collapse(1);
+						ed.getWin().focus();
+					}, 100);
+				}
+			}, 1);
+	
+			e = null;
+		},
+
+
+		focus : function(sf) {
+			var oed, t = this, ce = t.settings.content_editable;
+
+			if (!sf) {
+				// Is not content editable or the selection is outside the area in IE
+				// the IE statement is needed to avoid bluring if element selections inside layers since
+				// the layer is like it's own document in IE
+				if (!ce && (!isIE || t.selection.getNode().ownerDocument != t.getDoc()))
+					t.getWin().focus();
+
+			}
+
+			if (EditorManager.activeEditor != t) {
+				if ((oed = EditorManager.activeEditor) != null)
+					oed.onDeactivate.dispatch(oed, t);
+
+				t.onActivate.dispatch(t, oed);
+			}
+
+			EditorManager._setActive(t);
+		},
+
+		execCallback : function(n) {
+			var t = this, f = t.settings[n], s;
+
+			if (!f)
+				return;
+
+			// Look through lookup
+			if (t.callbackLookup && (s = t.callbackLookup[n])) {
+				f = s.func;
+				s = s.scope;
+			}
+
+			if (is(f, 'string')) {
+				s = f.replace(/\.\w+$/, '');
+				s = s ? tinymce.resolve(s) : 0;
+				f = tinymce.resolve(f);
+				t.callbackLookup = t.callbackLookup || {};
+				t.callbackLookup[n] = {func : f, scope : s};
+			}
+
+			return f.apply(s || t, Array.prototype.slice.call(arguments, 1));
+		},
+
+		translate : function(s) {
+			var c = this.settings.language || 'en', i18n = EditorManager.i18n;
+
+			if (!s)
+				return '';
+
+			return i18n[c + '.' + s] || s.replace(/{\#([^}]+)\}/g, function(a, b) {
+				return i18n[c + '.' + b] || '{#' + b + '}';
+			});
+		},
+
+		getLang : function(n, dv) {
+			return EditorManager.i18n[(this.settings.language || 'en') + '.' + n] || (is(dv) ? dv : '{#' + n + '}');
+		},
+
+		getParam : function(n, dv, ty) {
+			var tr = tinymce.trim, v = is(this.settings[n]) ? this.settings[n] : dv, o;
+
+			if (ty === 'hash') {
+				o = {};
+
+				if (is(v, 'string')) {
+					each(v.indexOf('=') > 0 ? v.split(/[;,](?![^=;,]*(?:[;,]|$))/) : v.split(','), function(v) {
+						v = v.split('=');
+
+						if (v.length > 1)
+							o[tr(v[0])] = tr(v[1]);
+						else
+							o[tr(v[0])] = tr(v);
+					});
+				} else
+					o = v;
+
+				return o;
+			}
+
+			return v;
+		},
+
+		nodeChanged : function(o) {
+			var t = this, s = t.selection, n = s.getNode() || t.getBody();
+
+			// Fix for bug #1896577 it seems that this can not be fired while the editor is loading
+			if (t.initialized) {
+				t.onNodeChange.dispatch(
+					t,
+					o ? o.controlManager || t.controlManager : t.controlManager,
+					isIE && n.ownerDocument != t.getDoc() ? t.getBody() : n, // Fix for IE initial state
+					s.isCollapsed(),
+					o
+				);
+			}
+		},
+
+		addButton : function(n, s) {
+			var t = this;
+
+			t.buttons = t.buttons || {};
+			t.buttons[n] = s;
+		},
+
+		addCommand : function(n, f, s) {
+			this.execCommands[n] = {func : f, scope : s || this};
+		},
+
+		addQueryStateHandler : function(n, f, s) {
+			this.queryStateCommands[n] = {func : f, scope : s || this};
+		},
+
+		addQueryValueHandler : function(n, f, s) {
+			this.queryValueCommands[n] = {func : f, scope : s || this};
+		},
+
+		addShortcut : function(pa, desc, cmd_func, sc) {
+			var t = this, c;
+
+			if (!t.settings.custom_shortcuts)
+				return false;
+
+			t.shortcuts = t.shortcuts || {};
+
+			if (is(cmd_func, 'string')) {
+				c = cmd_func;
+
+				cmd_func = function() {
+					t.execCommand(c, false, null);
+				};
+			}
+
+			if (is(cmd_func, 'object')) {
+				c = cmd_func;
+
+				cmd_func = function() {
+					t.execCommand(c[0], c[1], c[2]);
+				};
+			}
+
+			each(explode(pa), function(pa) {
+				var o = {
+					func : cmd_func,
+					scope : sc || this,
+					desc : desc,
+					alt : false,
+					ctrl : false,
+					shift : false
+				};
+
+				each(explode(pa, '+'), function(v) {
+					switch (v) {
+						case 'alt':
+						case 'ctrl':
+						case 'shift':
+							o[v] = true;
+							break;
+
+						default:
+							o.charCode = v.charCodeAt(0);
+							o.keyCode = v.toUpperCase().charCodeAt(0);
+					}
+				});
+
+				t.shortcuts[(o.ctrl ? 'ctrl' : '') + ',' + (o.alt ? 'alt' : '') + ',' + (o.shift ? 'shift' : '') + ',' + o.keyCode] = o;
+			});
+
+			return true;
+		},
+
+		execCommand : function(cmd, ui, val, a) {
+			var t = this, s = 0, o, st;
+
+			if (!/^(mceAddUndoLevel|mceEndUndoLevel|mceBeginUndoLevel|mceRepaint|SelectAll)$/.test(cmd) && (!a || !a.skip_focus))
+				t.focus();
+
+			o = {};
+			t.onBeforeExecCommand.dispatch(t, cmd, ui, val, o);
+			if (o.terminate)
+				return false;
+
+			// Command callback
+			if (t.execCallback('execcommand_callback', t.id, t.selection.getNode(), cmd, ui, val)) {
+				t.onExecCommand.dispatch(t, cmd, ui, val, a);
+				return true;
+			}
+
+			// Registred commands
+			if (o = t.execCommands[cmd]) {
+				st = o.func.call(o.scope, ui, val);
+
+				// Fall through on true
+				if (st !== true) {
+					t.onExecCommand.dispatch(t, cmd, ui, val, a);
+					return st;
+				}
+			}
+
+			// Plugin commands
+			each(t.plugins, function(p) {
+				if (p.execCommand && p.execCommand(cmd, ui, val)) {
+					t.onExecCommand.dispatch(t, cmd, ui, val, a);
+					s = 1;
+					return false;
+				}
+			});
+
+			if (s)
+				return true;
+
+			// Theme commands
+			if (t.theme && t.theme.execCommand && t.theme.execCommand(cmd, ui, val)) {
+				t.onExecCommand.dispatch(t, cmd, ui, val, a);
+				return true;
+			}
+
+			// Execute global commands
+			if (tinymce.GlobalCommands.execCommand(t, cmd, ui, val)) {
+				t.onExecCommand.dispatch(t, cmd, ui, val, a);
+				return true;
+			}
+
+			// Editor commands
+			if (t.editorCommands.execCommand(cmd, ui, val)) {
+				t.onExecCommand.dispatch(t, cmd, ui, val, a);
+				return true;
+			}
+
+			// Browser commands
+			t.getDoc().execCommand(cmd, ui, val);
+			t.onExecCommand.dispatch(t, cmd, ui, val, a);
+		},
+
+		queryCommandState : function(c) {
+			var t = this, o, s;
+
+			// Is hidden then return undefined
+			if (t._isHidden())
+				return;
+
+			// Registred commands
+			if (o = t.queryStateCommands[c]) {
+				s = o.func.call(o.scope);
+
+				// Fall though on true
+				if (s !== true)
+					return s;
+			}
+
+			// Registred commands
+			o = t.editorCommands.queryCommandState(c);
+			if (o !== -1)
+				return o;
+
+			// Browser commands
+			try {
+				return this.getDoc().queryCommandState(c);
+			} catch (ex) {
+				// Fails sometimes see bug: 1896577
+			}
+		},
+
+		queryCommandValue : function(c) {
+			var t = this, o, s;
+
+			// Is hidden then return undefined
+			if (t._isHidden())
+				return;
+
+			// Registred commands
+			if (o = t.queryValueCommands[c]) {
+				s = o.func.call(o.scope);
+
+				// Fall though on true
+				if (s !== true)
+					return s;
+			}
+
+			// Registred commands
+			o = t.editorCommands.queryCommandValue(c);
+			if (is(o))
+				return o;
+
+			// Browser commands
+			try {
+				return this.getDoc().queryCommandValue(c);
+			} catch (ex) {
+				// Fails sometimes see bug: 1896577
+			}
+		},
+
+		show : function() {
+			var t = this;
+
+			DOM.show(t.getContainer());
+			DOM.hide(t.id);
+			t.load();
+		},
+
+		hide : function() {
+			var t = this, d = t.getDoc();
+
+			// Fixed bug where IE has a blinking cursor left from the editor
+			if (isIE && d)
+				d.execCommand('SelectAll');
+
+			// We must save before we hide so Safari doesn't crash
+			t.save();
+			DOM.hide(t.getContainer());
+			DOM.setStyle(t.id, 'display', t.orgDisplay);
+		},
+
+		isHidden : function() {
+			return !DOM.isHidden(this.id);
+		},
+
+		setProgressState : function(b, ti, o) {
+			this.onSetProgressState.dispatch(this, b, ti, o);
+
+			return b;
+		},
+
+		load : function(o) {
+			var t = this, e = t.getElement(), h;
+
+			if (e) {
+				o = o || {};
+				o.load = true;
+
+				// Double encode existing entities in the value
+				h = t.setContent(is(e.value) ? e.value : e.innerHTML, o);
+				o.element = e;
+
+				if (!o.no_events)
+					t.onLoadContent.dispatch(t, o);
+
+				o.element = e = null;
+
+				return h;
+			}
+		},
+
+		save : function(o) {
+			var t = this, e = t.getElement(), h, f;
+
+			if (!e || !t.initialized)
+				return;
+
+			o = o || {};
+			o.save = true;
+
+			// Add undo level will trigger onchange event
+			if (!o.no_events) {
+				t.undoManager.typing = 0;
+				t.undoManager.add();
+			}
+
+			o.element = e;
+			h = o.content = t.getContent(o);
+
+			if (!o.no_events)
+				t.onSaveContent.dispatch(t, o);
+
+			h = o.content;
+
+			if (!/TEXTAREA|INPUT/i.test(e.nodeName)) {
+				e.innerHTML = h;
+
+				// Update hidden form element
+				if (f = DOM.getParent(t.id, 'form')) {
+					each(f.elements, function(e) {
+						if (e.name == t.id) {
+							e.value = h;
+							return false;
+						}
+					});
+				}
+			} else
+				e.value = h;
+
+			o.element = e = null;
+
+			return h;
+		},
+
+		setContent : function(h, o) {
+			var t = this;
+
+			o = o || {};
+			o.format = o.format || 'html';
+			o.set = true;
+			o.content = h;
+
+			if (!o.no_events)
+				t.onBeforeSetContent.dispatch(t, o);
+
+			// Padd empty content in Gecko and Safari. Commands will otherwise fail on the content
+			// It will also be impossible to place the caret in the editor unless there is a BR element present
+			if (!tinymce.isIE && (h.length === 0 || /^\s+$/.test(h))) {
+				o.content = t.dom.setHTML(t.getBody(), '<br mce_bogus="1" />');
+				o.format = 'raw';
+			}
+
+			o.content = t.dom.setHTML(t.getBody(), tinymce.trim(o.content));
+
+			if (o.format != 'raw' && t.settings.cleanup) {
+				o.getInner = true;
+				o.content = t.dom.setHTML(t.getBody(), t.serializer.serialize(t.getBody(), o));
+			}
+
+			if (!o.no_events)
+				t.onSetContent.dispatch(t, o);
+
+			return o.content;
+		},
+
+		getContent : function(o) {
+			var t = this, h;
+
+			o = o || {};
+			o.format = o.format || 'html';
+			o.get = true;
+
+			if (!o.no_events)
+				t.onBeforeGetContent.dispatch(t, o);
+
+			if (o.format != 'raw' && t.settings.cleanup) {
+				o.getInner = true;
+				h = t.serializer.serialize(t.getBody(), o);
+			} else
+				h = t.getBody().innerHTML;
+
+			h = h.replace(/^\s*|\s*$/g, '');
+			o.content = h;
+
+			if (!o.no_events)
+				t.onGetContent.dispatch(t, o);
+
+			return o.content;
+		},
+
+		isDirty : function() {
+			var t = this;
+
+			return tinymce.trim(t.startContent) != tinymce.trim(t.getContent({format : 'raw', no_events : 1})) && !t.isNotDirty;
+		},
+
+		getContainer : function() {
+			var t = this;
+
+			if (!t.container)
+				t.container = DOM.get(t.editorContainer || t.id + '_parent');
+
+			return t.container;
+		},
+
+		getContentAreaContainer : function() {
+			return this.contentAreaContainer;
+		},
+
+		getElement : function() {
+			return DOM.get(this.settings.content_element || this.id);
+		},
+
+		getWin : function() {
+			var t = this, e;
+
+			if (!t.contentWindow) {
+				e = DOM.get(t.id + "_ifr");
+
+				if (e)
+					t.contentWindow = e.contentWindow;
+			}
+
+			return t.contentWindow;
+		},
+
+		getDoc : function() {
+			var t = this, w;
+
+			if (!t.contentDocument) {
+				w = t.getWin();
+
+				if (w)
+					t.contentDocument = w.document;
+			}
+
+			return t.contentDocument;
+		},
+
+		getBody : function() {
+			return this.bodyElement || this.getDoc().body;
+		},
+
+		convertURL : function(u, n, e) {
+			var t = this, s = t.settings;
+
+			// Use callback instead
+			if (s.urlconverter_callback)
+				return t.execCallback('urlconverter_callback', u, e, true, n);
+
+			// Don't convert link href since thats the CSS files that gets loaded into the editor also skip local file URLs
+			if (!s.convert_urls || (e && e.nodeName == 'LINK') || u.indexOf('file:') === 0)
+				return u;
+
+			// Convert to relative
+			if (s.relative_urls)
+				return t.documentBaseURI.toRelative(u);
+
+			// Convert to absolute
+			u = t.documentBaseURI.toAbsolute(u, s.remove_script_host);
+
+			return u;
+		},
+
+		addVisual : function(e) {
+			var t = this, s = t.settings;
+
+			e = e || t.getBody();
+
+			if (!is(t.hasVisual))
+				t.hasVisual = s.visual;
+
+			each(t.dom.select('table,a', e), function(e) {
+				var v;
+
+				switch (e.nodeName) {
+					case 'TABLE':
+						v = t.dom.getAttrib(e, 'border');
+
+						if (!v || v == '0') {
+							if (t.hasVisual)
+								t.dom.addClass(e, s.visual_table_class);
+							else
+								t.dom.removeClass(e, s.visual_table_class);
+						}
+
+						return;
+
+					case 'A':
+						v = t.dom.getAttrib(e, 'name');
+
+						if (v) {
+							if (t.hasVisual)
+								t.dom.addClass(e, 'mceItemAnchor');
+							else
+								t.dom.removeClass(e, 'mceItemAnchor');
+						}
+
+						return;
+				}
+			});
+
+			t.onVisualAid.dispatch(t, e, t.hasVisual);
+		},
+
+		remove : function() {
+			var t = this, e = t.getContainer();
+
+			t.removed = 1; // Cancels post remove event execution
+			t.hide();
+
+			t.execCallback('remove_instance_callback', t);
+			t.onRemove.dispatch(t);
+
+			// Clear all execCommand listeners this is required to avoid errors if the editor was removed inside another command
+			t.onExecCommand.listeners = [];
+
+			EditorManager.remove(t);
+			DOM.remove(e);
+		},
+
+		destroy : function(s) {
+			var t = this;
+
+			// One time is enough
+			if (t.destroyed)
+				return;
+
+			if (!s) {
+				tinymce.removeUnload(t.destroy);
+				tinyMCE.onBeforeUnload.remove(t._beforeUnload);
+
+				// Manual destroy
+				if (t.theme && t.theme.destroy)
+					t.theme.destroy();
+
+				// Destroy controls, selection and dom
+				t.controlManager.destroy();
+				t.selection.destroy();
+				t.dom.destroy();
+
+				// Remove all events
+
+				// Don't clear the window or document if content editable
+				// is enabled since other instances might still be present
+				if (!t.settings.content_editable) {
+					Event.clear(t.getWin());
+					Event.clear(t.getDoc());
+				}
+
+				Event.clear(t.getBody());
+				Event.clear(t.formElement);
+			}
+
+			if (t.formElement) {
+				t.formElement.submit = t.formElement._mceOldSubmit;
+				t.formElement._mceOldSubmit = null;
+			}
+
+			t.contentAreaContainer = t.formElement = t.container = t.settings.content_element = t.bodyElement = t.contentDocument = t.contentWindow = null;
+
+			if (t.selection)
+				t.selection = t.selection.win = t.selection.dom = t.selection.dom.doc = null;
+
+			t.destroyed = 1;
+		},
+
+		// Internal functions
+
+		_addEvents : function() {
+			// 'focus', 'blur', 'dblclick', 'beforedeactivate', submit, reset
+			var t = this, i, s = t.settings, lo = {
+				mouseup : 'onMouseUp',
+				mousedown : 'onMouseDown',
+				click : 'onClick',
+				keyup : 'onKeyUp',
+				keydown : 'onKeyDown',
+				keypress : 'onKeyPress',
+				submit : 'onSubmit',
+				reset : 'onReset',
+				contextmenu : 'onContextMenu',
+				dblclick : 'onDblClick',
+				paste : 'onPaste' // Doesn't work in all browsers yet
+			};
+
+			function eventHandler(e, o) {
+				var ty = e.type;
+
+				// Don't fire events when it's removed
+				if (t.removed)
+					return;
+
+				// Generic event handler
+				if (t.onEvent.dispatch(t, e, o) !== false) {
+					// Specific event handler
+					t[lo[e.fakeType || e.type]].dispatch(t, e, o);
+				}
+			};
+
+			// Add DOM events
+			each(lo, function(v, k) {
+				switch (k) {
+					case 'contextmenu':
+						if (tinymce.isOpera) {
+							// Fake contextmenu on Opera
+							t.dom.bind(t.getBody(), 'mousedown', function(e) {
+								if (e.ctrlKey) {
+									e.fakeType = 'contextmenu';
+									eventHandler(e);
+								}
+							});
+						} else
+							t.dom.bind(t.getBody(), k, eventHandler);
+						break;
+
+					case 'paste':
+						t.dom.bind(t.getBody(), k, function(e) {
+							eventHandler(e);
+						});
+						break;
+
+					case 'submit':
+					case 'reset':
+						t.dom.bind(t.getElement().form || DOM.getParent(t.id, 'form'), k, eventHandler);
+						break;
+
+					default:
+						t.dom.bind(s.content_editable ? t.getBody() : t.getDoc(), k, eventHandler);
+				}
+			});
+
+			t.dom.bind(s.content_editable ? t.getBody() : (isGecko ? t.getDoc() : t.getWin()), 'focus', function(e) {
+				t.focus(true);
+			});
+
+
+			// Fixes bug where a specified document_base_uri could result in broken images
+			// This will also fix drag drop of images in Gecko
+			if (tinymce.isGecko) {
+				// Convert all images to absolute URLs
+/*				t.onSetContent.add(function(ed, o) {
+					each(ed.dom.select('img'), function(e) {
+						var v;
+
+						if (v = e.getAttribute('mce_src'))
+							e.src = t.documentBaseURI.toAbsolute(v);
+					})
+				});*/
+
+				t.dom.bind(t.getDoc(), 'DOMNodeInserted', function(e) {
+					var v;
+
+					e = e.target;
+
+					if (e.nodeType === 1 && e.nodeName === 'IMG' && (v = e.getAttribute('mce_src')))
+						e.src = t.documentBaseURI.toAbsolute(v);
+				});
+			}
+
+			// Set various midas options in Gecko
+			if (isGecko) {
+				function setOpts() {
+					var t = this, d = t.getDoc(), s = t.settings;
+
+					if (isGecko && !s.readonly) {
+						if (t._isHidden()) {
+							try {
+								if (!s.content_editable)
+									d.designMode = 'On';
+							} catch (ex) {
+								// Fails if it's hidden
+							}
+						}
+
+						try {
+							// Try new Gecko method
+							d.execCommand("styleWithCSS", 0, false);
+						} catch (ex) {
+							// Use old method
+							if (!t._isHidden())
+								try {d.execCommand("useCSS", 0, true);} catch (ex) {}
+						}
+
+						if (!s.table_inline_editing)
+							try {d.execCommand('enableInlineTableEditing', false, false);} catch (ex) {}
+
+						if (!s.object_resizing)
+							try {d.execCommand('enableObjectResizing', false, false);} catch (ex) {}
+					}
+				};
+
+				t.onBeforeExecCommand.add(setOpts);
+				t.onMouseDown.add(setOpts);
+			}
+
+			// Add node change handlers
+			t.onMouseUp.add(t.nodeChanged);
+			t.onClick.add(t.nodeChanged);
+			t.onKeyUp.add(function(ed, e) {
+				var c = e.keyCode;
+
+				if ((c >= 33 && c <= 36) || (c >= 37 && c <= 40) || c == 13 || c == 45 || c == 46 || c == 8 || (tinymce.isMac && (c == 91 || c == 93)) || e.ctrlKey)
+					t.nodeChanged();
+			});
+
+			// Add reset handler
+			t.onReset.add(function() {
+				t.setContent(t.startContent, {format : 'raw'});
+			});
+
+			// Add shortcuts
+			if (s.custom_shortcuts) {
+				if (s.custom_undo_redo_keyboard_shortcuts) {
+					t.addShortcut('ctrl+z', t.getLang('undo_desc'), 'Undo');
+					t.addShortcut('ctrl+y', t.getLang('redo_desc'), 'Redo');
+				}
+
+				// Add default shortcuts for gecko
+				if (isGecko) {
+					t.addShortcut('ctrl+b', t.getLang('bold_desc'), 'Bold');
+					t.addShortcut('ctrl+i', t.getLang('italic_desc'), 'Italic');
+					t.addShortcut('ctrl+u', t.getLang('underline_desc'), 'Underline');
+				}
+
+				// BlockFormat shortcuts keys
+				for (i=1; i<=6; i++)
+					t.addShortcut('ctrl+' + i, '', ['FormatBlock', false, '<h' + i + '>']);
+
+				t.addShortcut('ctrl+7', '', ['FormatBlock', false, '<p>']);
+				t.addShortcut('ctrl+8', '', ['FormatBlock', false, '<div>']);
+				t.addShortcut('ctrl+9', '', ['FormatBlock', false, '<address>']);
+
+				function find(e) {
+					var v = null;
+
+					if (!e.altKey && !e.ctrlKey && !e.metaKey)
+						return v;
+
+					each(t.shortcuts, function(o) {
+						if (tinymce.isMac && o.ctrl != e.metaKey)
+							return;
+						else if (!tinymce.isMac && o.ctrl != e.ctrlKey)
+							return;
+
+						if (o.alt != e.altKey)
+							return;
+
+						if (o.shift != e.shiftKey)
+							return;
+
+						if (e.keyCode == o.keyCode || (e.charCode && e.charCode == o.charCode)) {
+							v = o;
+							return false;
+						}
+					});
+
+					return v;
+				};
+
+				t.onKeyUp.add(function(ed, e) {
+					var o = find(e);
+
+					if (o)
+						return Event.cancel(e);
+				});
+
+				t.onKeyPress.add(function(ed, e) {
+					var o = find(e);
+
+					if (o)
+						return Event.cancel(e);
+				});
+
+				t.onKeyDown.add(function(ed, e) {
+					var o = find(e);
+
+					if (o) {
+						o.func.call(o.scope);
+						return Event.cancel(e);
+					}
+				});
+			}
+
+			if (tinymce.isIE) {
+				// Fix so resize will only update the width and height attributes not the styles of an image
+				// It will also block mceItemNoResize items
+				t.dom.bind(t.getDoc(), 'controlselect', function(e) {
+					var re = t.resizeInfo, cb;
+
+					e = e.target;
+
+					// Don't do this action for non image elements
+					if (e.nodeName !== 'IMG')
+						return;
+
+					if (re)
+						t.dom.unbind(re.node, re.ev, re.cb);
+
+					if (!t.dom.hasClass(e, 'mceItemNoResize')) {
+						ev = 'resizeend';
+						cb = t.dom.bind(e, ev, function(e) {
+							var v;
+
+							e = e.target;
+
+							if (v = t.dom.getStyle(e, 'width')) {
+								t.dom.setAttrib(e, 'width', v.replace(/[^0-9%]+/g, ''));
+								t.dom.setStyle(e, 'width', '');
+							}
+
+							if (v = t.dom.getStyle(e, 'height')) {
+								t.dom.setAttrib(e, 'height', v.replace(/[^0-9%]+/g, ''));
+								t.dom.setStyle(e, 'height', '');
+							}
+						});
+					} else {
+						ev = 'resizestart';
+						cb = t.dom.bind(e, 'resizestart', Event.cancel, Event);
+					}
+
+					re = t.resizeInfo = {
+						node : e,
+						ev : ev,
+						cb : cb
+					};
+				});
+
+				t.onKeyDown.add(function(ed, e) {
+					switch (e.keyCode) {
+						case 8:
+							// Fix IE control + backspace browser bug
+							if (t.selection.getRng().item) {
+								t.selection.getRng().item(0).removeNode();
+								return Event.cancel(e);
+							}
+					}
+				});
+
+				/*if (t.dom.boxModel) {
+					t.getBody().style.height = '100%';
+
+					Event.add(t.getWin(), 'resize', function(e) {
+						var docElm = t.getDoc().documentElement;
+
+						docElm.style.height = (docElm.offsetHeight - 10) + 'px';
+					});
+				}*/
+			}
+
+			if (tinymce.isOpera) {
+				t.onClick.add(function(ed, e) {
+					Event.prevent(e);
+				});
+			}
+
+			// Add custom undo/redo handlers
+			if (s.custom_undo_redo) {
+				function addUndo() {
+					t.undoManager.typing = 0;
+					t.undoManager.add();
+				};
+
+				// Add undo level on editor blur
+				if (tinymce.isIE) {
+					t.dom.bind(t.getWin(), 'blur', function(e) {
+						var n;
+
+						// Check added for fullscreen bug
+						if (t.selection) {
+							n = t.selection.getNode();
+
+							// Add undo level is selection was lost to another document
+							if (!t.removed && n.ownerDocument && n.ownerDocument != t.getDoc())
+								addUndo();
+						}
+					});
+				} else {
+					t.dom.bind(t.getDoc(), 'blur', function() {
+						if (t.selection && !t.removed)
+							addUndo();
+					});
+				}
+
+				t.onMouseDown.add(addUndo);
+
+				t.onKeyUp.add(function(ed, e) {
+					if ((e.keyCode >= 33 && e.keyCode <= 36) || (e.keyCode >= 37 && e.keyCode <= 40) || e.keyCode == 13 || e.keyCode == 45 || e.ctrlKey) {
+						t.undoManager.typing = 0;
+						t.undoManager.add();
+					}
+				});
+
+				t.onKeyDown.add(function(ed, e) {
+					// Is caracter positon keys
+					if ((e.keyCode >= 33 && e.keyCode <= 36) || (e.keyCode >= 37 && e.keyCode <= 40) || e.keyCode == 13 || e.keyCode == 45) {
+						if (t.undoManager.typing) {
+							t.undoManager.add();
+							t.undoManager.typing = 0;
+						}
+
+						return;
+					}
+
+					if (!t.undoManager.typing) {
+						t.undoManager.add();
+						t.undoManager.typing = 1;
+					}
+				});
+			}
+		},
+
+		_convertInlineElements : function() {
+			var t = this, s = t.settings, dom = t.dom, v, e, na, st, sp;
+
+			function convert(ed, o) {
+				if (!s.inline_styles)
+					return;
+
+				if (o.get) {
+					each(t.dom.select('table,u,strike', o.node), function(n) {
+						switch (n.nodeName) {
+							case 'TABLE':
+								if (v = dom.getAttrib(n, 'height')) {
+									dom.setStyle(n, 'height', v);
+									dom.setAttrib(n, 'height', '');
+								}
+								break;
+
+							case 'U':
+							case 'STRIKE':
+								//sp = dom.create('span', {style : dom.getAttrib(n, 'style')});
+								n.style.textDecoration = n.nodeName == 'U' ? 'underline' : 'line-through';
+								dom.setAttrib(n, 'mce_style', '');
+								dom.setAttrib(n, 'mce_name', 'span');
+								break;
+						}
+					});
+				} else if (o.set) {
+					each(t.dom.select('table,span', o.node).reverse(), function(n) {
+						if (n.nodeName == 'TABLE') {
+							if (v = dom.getStyle(n, 'height'))
+								dom.setAttrib(n, 'height', v.replace(/[^0-9%]+/g, ''));
+						} else {
+							// Convert spans to elements
+							if (n.style.textDecoration == 'underline')
+								na = 'u';
+							else if (n.style.textDecoration == 'line-through')
+								na = 'strike';
+							else
+								na = '';
+
+							if (na) {
+								n.style.textDecoration = '';
+								dom.setAttrib(n, 'mce_style', '');
+
+								e = dom.create(na, {
+									style : dom.getAttrib(n, 'style')
+								});
+
+								dom.replace(e, n, 1);
+							}
+						}
+					});
+				}
+			};
+
+			t.onPreProcess.add(convert);
+
+			if (!s.cleanup_on_startup) {
+				t.onSetContent.add(function(ed, o) {
+					if (o.initial)
+						convert(t, {node : t.getBody(), set : 1});
+				});
+			}
+		},
+
+		_convertFonts : function() {
+			var t = this, s = t.settings, dom = t.dom, fz, fzn, sl, cl;
+
+			// No need
+			if (!s.inline_styles)
+				return;
+
+			// Font pt values and font size names
+			fz = [8, 10, 12, 14, 18, 24, 36];
+			fzn = ['xx-small', 'x-small','small','medium','large','x-large', 'xx-large'];
+
+			if (sl = s.font_size_style_values)
+				sl = explode(sl);
+
+			if (cl = s.font_size_classes)
+				cl = explode(cl);
+
+			function process(no) {
+				var n, sp, nl, x;
+
+				// Keep unit tests happy
+				if (!s.inline_styles)
+					return;
+
+				nl = t.dom.select('font', no);
+				for (x = nl.length - 1; x >= 0; x--) {
+					n = nl[x];
+
+					sp = dom.create('span', {
+						style : dom.getAttrib(n, 'style'),
+						'class' : dom.getAttrib(n, 'class')
+					});
+
+					dom.setStyles(sp, {
+						fontFamily : dom.getAttrib(n, 'face'),
+						color : dom.getAttrib(n, 'color'),
+						backgroundColor : n.style.backgroundColor
+					});
+
+					if (n.size) {
+						if (sl)
+							dom.setStyle(sp, 'fontSize', sl[parseInt(n.size) - 1]);
+						else
+							dom.setAttrib(sp, 'class', cl[parseInt(n.size) - 1]);
+					}
+
+					dom.setAttrib(sp, 'mce_style', '');
+					dom.replace(sp, n, 1);
+				}
+			};
+
+			// Run on cleanup
+			t.onPreProcess.add(function(ed, o) {
+				if (o.get)
+					process(o.node);
+			});
+
+			t.onSetContent.add(function(ed, o) {
+				if (o.initial)
+					process(o.node);
+			});
+		},
+
+		_isHidden : function() {
+			var s;
+
+			if (!isGecko)
+				return 0;
+
+			// Weird, wheres that cursor selection?
+			s = this.selection.getSel();
+			return (!s || !s.rangeCount || s.rangeCount == 0);
+		},
+
+		// Fix for bug #1867292
+		_fixNesting : function(s) {
+			var d = [], i;
+
+			s = s.replace(/<(\/)?([^\s>]+)[^>]*?>/g, function(a, b, c) {
+				var e;
+
+				// Handle end element
+				if (b === '/') {
+					if (!d.length)
+						return '';
+
+					if (c !== d[d.length - 1].tag) {
+						for (i=d.length - 1; i>=0; i--) {
+							if (d[i].tag === c) {
+								d[i].close = 1;
+								break;
+							}
+						}
+
+						return '';
+					} else {
+						d.pop();
+
+						if (d.length && d[d.length - 1].close) {
+							a = a + '</' + d[d.length - 1].tag + '>';
+							d.pop();
+						}
+					}
+				} else {
+					// Ignore these
+					if (/^(br|hr|input|meta|img|link|param)$/i.test(c))
+						return a;
+
+					// Ignore closed ones
+					if (/\/>$/.test(a))
+						return a;
+
+					d.push({tag : c}); // Push start element
+				}
+
+				return a;
+			});
+
+			// End all open tags
+			for (i=d.length - 1; i>=0; i--)
+				s += '</' + d[i].tag + '>';
+
+			return s;
+		}
+
+		});
+})(tinymce);
+(function(tinymce) {
+	var each = tinymce.each, isIE = tinymce.isIE, isGecko = tinymce.isGecko, isOpera = tinymce.isOpera, isWebKit = tinymce.isWebKit;
+
+	tinymce.create('tinymce.EditorCommands', {
+		EditorCommands : function(ed) {
+			this.editor = ed;
+		},
+
+		execCommand : function(cmd, ui, val) {
+			var t = this, ed = t.editor, f;
+
+			switch (cmd) {
+				// Ignore these
+				case 'mceResetDesignMode':
+				case 'mceBeginUndoLevel':
+					return true;
+
+				// Ignore these
+				case 'unlink':
+					t.UnLink();
+					return true;
+
+				// Bundle these together
+				case 'JustifyLeft':
+				case 'JustifyCenter':
+				case 'JustifyRight':
+				case 'JustifyFull':
+					t.mceJustify(cmd, cmd.substring(7).toLowerCase());
+					return true;
+
+				default:
+					f = this[cmd];
+
+					if (f) {
+						f.call(this, ui, val);
+						return true;
+					}
+			}
+
+			return false;
+		},
+
+		Indent : function() {
+			var ed = this.editor, d = ed.dom, s = ed.selection, e, iv, iu;
+
+			// Setup indent level
+			iv = ed.settings.indentation;
+			iu = /[a-z%]+$/i.exec(iv);
+			iv = parseInt(iv);
+
+			if (ed.settings.inline_styles && (!this.queryStateInsertUnorderedList() && !this.queryStateInsertOrderedList())) {
+				each(s.getSelectedBlocks(), function(e) {
+					d.setStyle(e, 'paddingLeft', (parseInt(e.style.paddingLeft || 0) + iv) + iu);
+				});
+
+				return;
+			}
+
+			ed.getDoc().execCommand('Indent', false, null);
+
+			if (isIE) {
+				d.getParent(s.getNode(), function(n) {
+					if (n.nodeName == 'BLOCKQUOTE') {
+						n.dir = n.style.cssText = '';
+					}
+				});
+			}
+		},
+
+		Outdent : function() {
+			var ed = this.editor, d = ed.dom, s = ed.selection, e, v, iv, iu;
+
+			// Setup indent level
+			iv = ed.settings.indentation;
+			iu = /[a-z%]+$/i.exec(iv);
+			iv = parseInt(iv);
+
+			if (ed.settings.inline_styles && (!this.queryStateInsertUnorderedList() && !this.queryStateInsertOrderedList())) {
+				each(s.getSelectedBlocks(), function(e) {
+					v = Math.max(0, parseInt(e.style.paddingLeft || 0) - iv);
+					d.setStyle(e, 'paddingLeft', v ? v + iu : '');
+				});
+
+				return;
+			}
+
+			ed.getDoc().execCommand('Outdent', false, null);
+		},
+
+/*
+		mceSetAttribute : function(u, v) {
+			var ed = this.editor, d = ed.dom, e;
+
+			if (e = d.getParent(ed.selection.getNode(), d.isBlock))
+				d.setAttrib(e, v.name, v.value);
+		},
+*/
+		mceSetContent : function(u, v) {
+			this.editor.setContent(v);
+		},
+
+		mceToggleVisualAid : function() {
+			var ed = this.editor;
+
+			ed.hasVisual = !ed.hasVisual;
+			ed.addVisual();
+		},
+
+		mceReplaceContent : function(u, v) {
+			var s = this.editor.selection;
+
+			s.setContent(v.replace(/\{\$selection\}/g, s.getContent({format : 'text'})));
+		},
+
+		mceInsertLink : function(u, v) {
+			var ed = this.editor, s = ed.selection, e = ed.dom.getParent(s.getNode(), 'a');
+
+			if (tinymce.is(v, 'string'))
+				v = {href : v};
+
+			function set(e) {
+				each(v, function(v, k) {
+					ed.dom.setAttrib(e, k, v);
+				});
+			};
+
+			if (!e) {
+				ed.execCommand('CreateLink', false, 'javascript:mctmp(0);');
+				each(ed.dom.select('a[href=javascript:mctmp(0);]'), function(e) {
+					set(e);
+				});
+			} else {
+				if (v.href)
+					set(e);
+				else
+					ed.dom.remove(e, 1);
+			}
+		},
+
+		UnLink : function() {
+			var ed = this.editor, s = ed.selection;
+
+			if (s.isCollapsed())
+				s.select(s.getNode());
+
+			ed.getDoc().execCommand('unlink', false, null);
+			s.collapse(0);
+		},
+
+		FontName : function(u, v) {
+			var t = this, ed = t.editor, s = ed.selection, e;
+
+			if (!v) {
+				if (s.isCollapsed())
+					s.select(s.getNode());
+			} else {
+				if (ed.settings.convert_fonts_to_spans)
+					t._applyInlineStyle('span', {style : {fontFamily : v}});
+				else
+					ed.getDoc().execCommand('FontName', false, v);
+			}
+		},
+
+		FontSize : function(u, v) {
+			var ed = this.editor, s = ed.settings, fc, fs;
+
+			// Use style options instead
+			if (s.convert_fonts_to_spans && v >= 1 && v <= 7) {
+				fs = tinymce.explode(s.font_size_style_values);
+				fc = tinymce.explode(s.font_size_classes);
+
+				if (fc)
+					v = fc[v - 1] || v;
+				else
+					v = fs[v - 1] || v;
+			}
+
+			if (v >= 1 && v <= 7)
+				ed.getDoc().execCommand('FontSize', false, v);
+			else
+				this._applyInlineStyle('span', {style : {fontSize : v}});
+		},
+
+		queryCommandValue : function(c) {
+			var f = this['queryValue' + c];
+
+			if (f)
+				return f.call(this, c);
+
+			return false;
+		},
+
+		queryCommandState : function(cmd) {
+			var f;
+
+			switch (cmd) {
+				// Bundle these together
+				case 'JustifyLeft':
+				case 'JustifyCenter':
+				case 'JustifyRight':
+				case 'JustifyFull':
+					return this.queryStateJustify(cmd, cmd.substring(7).toLowerCase());
+
+				default:
+					if (f = this['queryState' + cmd])
+						return f.call(this, cmd);
+			}
+
+			return -1;
+		},
+
+		_queryState : function(c) {
+			try {
+				return this.editor.getDoc().queryCommandState(c);
+			} catch (ex) {
+				// Ignore exception
+			}
+		},
+
+		_queryVal : function(c) {
+			try {
+				return this.editor.getDoc().queryCommandValue(c);
+			} catch (ex) {
+				// Ignore exception
+			}
+		},
+
+		queryValueFontSize : function() {
+			var ed = this.editor, v = 0, p;
+
+			if (p = ed.dom.getParent(ed.selection.getNode(), 'span'))
+				v = p.style.fontSize;
+
+			if (!v && (isOpera || isWebKit)) {
+				if (p = ed.dom.getParent(ed.selection.getNode(), 'font'))
+					v = p.size;
+
+				return v;
+			}
+
+			return v || this._queryVal('FontSize');
+		},
+
+		queryValueFontName : function() {
+			var ed = this.editor, v = 0, p;
+
+			if (p = ed.dom.getParent(ed.selection.getNode(), 'font'))
+				v = p.face;
+
+			if (p = ed.dom.getParent(ed.selection.getNode(), 'span'))
+				v = p.style.fontFamily.replace(/, /g, ',').replace(/[\'\"]/g, '').toLowerCase();
+
+			if (!v)
+				v = this._queryVal('FontName');
+
+			return v;
+		},
+
+		mceJustify : function(c, v) {
+			var ed = this.editor, se = ed.selection, n = se.getNode(), nn = n.nodeName, bl, nb, dom = ed.dom, rm;
+
+			if (ed.settings.inline_styles && this.queryStateJustify(c, v))
+				rm = 1;
+
+			bl = dom.getParent(n, ed.dom.isBlock);
+
+			if (nn == 'IMG') {
+				if (v == 'full')
+					return;
+
+				if (rm) {
+					if (v == 'center')
+						dom.setStyle(bl || n.parentNode, 'textAlign', '');
+
+					dom.setStyle(n, 'float', '');
+					this.mceRepaint();
+					return;
+				}
+
+				if (v == 'center') {
+					// Do not change table elements
+					if (bl && /^(TD|TH)$/.test(bl.nodeName))
+						bl = 0;
+
+					if (!bl || bl.childNodes.length > 1) {
+						nb = dom.create('p');
+						nb.appendChild(n.cloneNode(false));
+
+						if (bl)
+							dom.insertAfter(nb, bl);
+						else
+							dom.insertAfter(nb, n);
+
+						dom.remove(n);
+						n = nb.firstChild;
+						bl = nb;
+					}
+
+					dom.setStyle(bl, 'textAlign', v);
+					dom.setStyle(n, 'float', '');
+				} else {
+					dom.setStyle(n, 'float', v);
+					dom.setStyle(bl || n.parentNode, 'textAlign', '');
+				}
+
+				this.mceRepaint();
+				return;
+			}
+
+			// Handle the alignment outselfs, less quirks in all browsers
+			if (ed.settings.inline_styles && ed.settings.forced_root_block) {
+				if (rm)
+					v = '';
+
+				each(se.getSelectedBlocks(dom.getParent(se.getStart(), dom.isBlock), dom.getParent(se.getEnd(), dom.isBlock)), function(e) {
+					dom.setAttrib(e, 'align', '');
+					dom.setStyle(e, 'textAlign', v == 'full' ? 'justify' : v);
+				});
+
+				return;
+			} else if (!rm)
+				ed.getDoc().execCommand(c, false, null);
+
+			if (ed.settings.inline_styles) {
+				if (rm) {
+					dom.getParent(ed.selection.getNode(), function(n) {
+						if (n.style && n.style.textAlign)
+							dom.setStyle(n, 'textAlign', '');
+					});
+
+					return;
+				}
+
+				each(dom.select('*'), function(n) {
+					var v = n.align;
+
+					if (v) {
+						if (v == 'full')
+							v = 'justify';
+
+						dom.setStyle(n, 'textAlign', v);
+						dom.setAttrib(n, 'align', '');
+					}
+				});
+			}
+		},
+
+		mceSetCSSClass : function(u, v) {
+			this.mceSetStyleInfo(0, {command : 'setattrib', name : 'class', value : v});
+		},
+
+		getSelectedElement : function() {
+			var t = this, ed = t.editor, dom = ed.dom, se = ed.selection, r = se.getRng(), r1, r2, sc, ec, so, eo, e, sp, ep, re;
+
+			if (se.isCollapsed() || r.item)
+				return se.getNode();
+
+			// Setup regexp
+			re = ed.settings.merge_styles_invalid_parents;
+			if (tinymce.is(re, 'string'))
+				re = new RegExp(re, 'i');
+
+			if (isIE) {
+				r1 = r.duplicate();
+				r1.collapse(true);
+				sc = r1.parentElement();
+
+				r2 = r.duplicate();
+				r2.collapse(false);
+				ec = r2.parentElement();
+
+				if (sc != ec) {
+					r1.move('character', 1);
+					sc = r1.parentElement();
+				}
+
+				if (sc == ec) {
+					r1 = r.duplicate();
+					r1.moveToElementText(sc);
+
+					if (r1.compareEndPoints('StartToStart', r) == 0 && r1.compareEndPoints('EndToEnd', r) == 0)
+						return re && re.test(sc.nodeName) ? null : sc;
+				}
+			} else {
+				function getParent(n) {
+					return dom.getParent(n, '*');
+				};
+
+				sc = r.startContainer;
+				ec = r.endContainer;
+				so = r.startOffset;
+				eo = r.endOffset;
+
+				if (!r.collapsed) {
+					if (sc == ec) {
+						if (so - eo < 2) {
+							if (sc.hasChildNodes()) {
+								sp = sc.childNodes[so];
+								return re && re.test(sp.nodeName) ? null : sp;
+							}
+						}
+					}
+				}
+
+				if (sc.nodeType != 3 || ec.nodeType != 3)
+					return null;
+
+				if (so == 0) {
+					sp = getParent(sc);
+
+					if (sp && sp.firstChild != sc)
+						sp = null;
+				}
+
+				if (so == sc.nodeValue.length) {
+					e = sc.nextSibling;
+
+					if (e && e.nodeType == 1)
+						sp = sc.nextSibling;
+				}
+
+				if (eo == 0) {
+					e = ec.previousSibling;
+
+					if (e && e.nodeType == 1)
+						ep = e;
+				}
+
+				if (eo == ec.nodeValue.length) {
+					ep = getParent(ec);
+
+					if (ep && ep.lastChild != ec)
+						ep = null;
+				}
+
+				// Same element
+				if (sp == ep)
+					return re && sp && re.test(sp.nodeName) ? null : sp;
+			}
+
+			return null;
+		},
+
+		mceSetStyleInfo : function(u, v) {
+			var t = this, ed = t.editor, d = ed.getDoc(), dom = ed.dom, e, b, s = ed.selection, nn = v.wrapper || 'span', b = s.getBookmark(), re;
+
+			function set(n, e) {
+				if (n.nodeType == 1) {
+					switch (v.command) {
+						case 'setattrib':
+							return dom.setAttrib(n, v.name, v.value);
+
+						case 'setstyle':
+							return dom.setStyle(n, v.name, v.value);
+
+						case 'removeformat':
+							return dom.setAttrib(n, 'class', '');
+					}
+				}
+			};
+
+			// Setup regexp
+			re = ed.settings.merge_styles_invalid_parents;
+			if (tinymce.is(re, 'string'))
+				re = new RegExp(re, 'i');
+
+			// Set style info on selected element
+			if ((e = t.getSelectedElement()) && !ed.settings.force_span_wrappers)
+				set(e, 1);
+			else {
+				// Generate wrappers and set styles on them
+				d.execCommand('FontName', false, '__');
+				each(dom.select('span,font'), function(n) {
+					var sp, e;
+
+					if (dom.getAttrib(n, 'face') == '__' || n.style.fontFamily === '__') {
+						sp = dom.create(nn, {mce_new : '1'});
+
+						set(sp);
+
+						each (n.childNodes, function(n) {
+							sp.appendChild(n.cloneNode(true));
+						});
+
+						dom.replace(sp, n);
+					}
+				});
+			}
+
+			// Remove wrappers inside new ones
+			each(dom.select(nn).reverse(), function(n) {
+				var p = n.parentNode;
+
+				// Check if it's an old span in a new wrapper
+				if (!dom.getAttrib(n, 'mce_new')) {
+					// Find new wrapper
+					p = dom.getParent(n, '*[mce_new]');
+
+					if (p)
+						dom.remove(n, 1);
+				}
+			});
+
+			// Merge wrappers with parent wrappers
+			each(dom.select(nn).reverse(), function(n) {
+				var p = n.parentNode;
+
+				if (!p || !dom.getAttrib(n, 'mce_new'))
+					return;
+
+				if (ed.settings.force_span_wrappers && p.nodeName != 'SPAN')
+					return;
+
+				// Has parent of the same type and only child
+				if (p.nodeName == nn.toUpperCase() && p.childNodes.length == 1)
+					return dom.remove(p, 1);
+
+				// Has parent that is more suitable to have the class and only child
+				if (n.nodeType == 1 && (!re || !re.test(p.nodeName)) && p.childNodes.length == 1) {
+					set(p); // Set style info on parent instead
+					dom.setAttrib(n, 'class', '');
+				}
+			});
+
+			// Remove empty wrappers
+			each(dom.select(nn).reverse(), function(n) {
+				if (dom.getAttrib(n, 'mce_new') || (dom.getAttribs(n).length <= 1 && n.className === '')) {
+					if (!dom.getAttrib(n, 'class') && !dom.getAttrib(n, 'style'))
+						return dom.remove(n, 1);
+
+					dom.setAttrib(n, 'mce_new', ''); // Remove mce_new marker
+				}
+			});
+
+			s.moveToBookmark(b);
+		},
+
+		queryStateJustify : function(c, v) {
+			var ed = this.editor, n = ed.selection.getNode(), dom = ed.dom;
+
+			if (n && n.nodeName == 'IMG') {
+				if (dom.getStyle(n, 'float') == v)
+					return 1;
+
+				return n.parentNode.style.textAlign == v;
+			}
+
+			n = dom.getParent(ed.selection.getStart(), function(n) {
+				return n.nodeType == 1 && n.style.textAlign;
+			});
+
+			if (v == 'full')
+				v = 'justify';
+
+			if (ed.settings.inline_styles)
+				return (n && n.style.textAlign == v);
+
+			return this._queryState(c);
+		},
+
+		ForeColor : function(ui, v) {
+			var ed = this.editor;
+
+			if (ed.settings.convert_fonts_to_spans) {
+				this._applyInlineStyle('span', {style : {color : v}});
+				return;
+			} else
+				ed.getDoc().execCommand('ForeColor', false, v);
+		},
+
+		HiliteColor : function(ui, val) {
+			var t = this, ed = t.editor, d = ed.getDoc();
+
+			if (ed.settings.convert_fonts_to_spans) {
+				this._applyInlineStyle('span', {style : {backgroundColor : val}});
+				return;
+			}
+
+			function set(s) {
+				if (!isGecko)
+					return;
+
+				try {
+					// Try new Gecko method
+					d.execCommand("styleWithCSS", 0, s);
+				} catch (ex) {
+					// Use old
+					d.execCommand("useCSS", 0, !s);
+				}
+			};
+
+			if (isGecko || isOpera) {
+				set(true);
+				d.execCommand('hilitecolor', false, val);
+				set(false);
+			} else
+				d.execCommand('BackColor', false, val);
+		},
+
+		FormatBlock : function(ui, val) {
+			var t = this, ed = t.editor, s = ed.selection, dom = ed.dom, bl, nb, b;
+
+			function isBlock(n) {
+				return /^(P|DIV|H[1-6]|ADDRESS|BLOCKQUOTE|PRE)$/.test(n.nodeName);
+			};
+
+			bl = dom.getParent(s.getNode(), function(n) {
+				return isBlock(n);
+			});
+
+			// IE has an issue where it removes the parent div if you change format on the paragrah in <div><p>Content</p></div>
+			// FF and Opera doesn't change parent DIV elements if you switch format
+			if (bl) {
+				if ((isIE && isBlock(bl.parentNode)) || bl.nodeName == 'DIV') {
+					// Rename block element
+					nb = ed.dom.create(val);
+
+					each(dom.getAttribs(bl), function(v) {
+						dom.setAttrib(nb, v.nodeName, dom.getAttrib(bl, v.nodeName));
+					});
+
+					b = s.getBookmark();
+					dom.replace(nb, bl, 1);
+					s.moveToBookmark(b);
+					ed.nodeChanged();
+					return;
+				}
+			}
+
+			val = ed.settings.forced_root_block ? (val || '<p>') : val;
+
+			if (val.indexOf('<') == -1)
+				val = '<' + val + '>';
+
+			if (tinymce.isGecko)
+				val = val.replace(/<(div|blockquote|code|dt|dd|dl|samp)>/gi, '$1');
+
+			ed.getDoc().execCommand('FormatBlock', false, val);
+		},
+
+		mceCleanup : function() {
+			var ed = this.editor, s = ed.selection, b = s.getBookmark();
+			ed.setContent(ed.getContent());
+			s.moveToBookmark(b);
+		},
+
+		mceRemoveNode : function(ui, val) {
+			var ed = this.editor, s = ed.selection, b, n = val || s.getNode();
+
+			// Make sure that the body node isn't removed
+			if (n == ed.getBody())
+				return;
+
+			b = s.getBookmark();
+			ed.dom.remove(n, 1);
+			s.moveToBookmark(b);
+			ed.nodeChanged();
+		},
+
+		mceSelectNodeDepth : function(ui, val) {
+			var ed = this.editor, s = ed.selection, c = 0;
+
+			ed.dom.getParent(s.getNode(), function(n) {
+				if (n.nodeType == 1 && c++ == val) {
+					s.select(n);
+					ed.nodeChanged();
+					return false;
+				}
+			}, ed.getBody());
+		},
+
+		mceSelectNode : function(u, v) {
+			this.editor.selection.select(v);
+		},
+
+		mceInsertContent : function(ui, val) {
+			this.editor.selection.setContent(val);
+		},
+
+		mceInsertRawHTML : function(ui, val) {
+			var ed = this.editor;
+
+			ed.selection.setContent('tiny_mce_marker');
+			ed.setContent(ed.getContent().replace(/tiny_mce_marker/g, val));
+		},
+
+		mceRepaint : function() {
+			var s, b, e = this.editor;
+
+			if (tinymce.isGecko) {
+				try {
+					s = e.selection;
+					b = s.getBookmark(true);
+
+					if (s.getSel())
+						s.getSel().selectAllChildren(e.getBody());
+
+					s.collapse(true);
+					s.moveToBookmark(b);
+				} catch (ex) {
+					// Ignore
+				}
+			}
+		},
+
+		queryStateUnderline : function() {
+			var ed = this.editor, n = ed.selection.getNode();
+
+			if (n && n.nodeName == 'A')
+				return false;
+
+			return this._queryState('Underline');
+		},
+
+		queryStateOutdent : function() {
+			var ed = this.editor, n;
+
+			if (ed.settings.inline_styles) {
+				if ((n = ed.dom.getParent(ed.selection.getStart(), ed.dom.isBlock)) && parseInt(n.style.paddingLeft) > 0)
+					return true;
+
+				if ((n = ed.dom.getParent(ed.selection.getEnd(), ed.dom.isBlock)) && parseInt(n.style.paddingLeft) > 0)
+					return true;
+			}
+
+			return this.queryStateInsertUnorderedList() || this.queryStateInsertOrderedList() || (!ed.settings.inline_styles && !!ed.dom.getParent(ed.selection.getNode(), 'BLOCKQUOTE'));
+		},
+
+		queryStateInsertUnorderedList : function() {
+			return this.editor.dom.getParent(this.editor.selection.getNode(), 'UL');
+		},
+
+		queryStateInsertOrderedList : function() {
+			return this.editor.dom.getParent(this.editor.selection.getNode(), 'OL');
+		},
+
+		queryStatemceBlockQuote : function() {
+			return !!this.editor.dom.getParent(this.editor.selection.getStart(), function(n) {return n.nodeName === 'BLOCKQUOTE';});
+		},
+
+		_applyInlineStyle : function(na, at, op) {
+			var t = this, ed = t.editor, dom = ed.dom, bm, lo = {}, kh, found;
+
+			na = na.toUpperCase();
+
+			if (op && op.check_classes && at['class'])
+				op.check_classes.push(at['class']);
+
+			function removeEmpty() {
+				each(dom.select(na).reverse(), function(n) {
+					var c = 0;
+
+					// Check if there is any attributes
+					each(dom.getAttribs(n), function(an) {
+						if (an.nodeName.substring(0, 1) != '_' && dom.getAttrib(n, an.nodeName) != '') {
+							//console.log(dom.getOuterHTML(n), dom.getAttrib(n, an.nodeName));
+							c++;
+						}
+					});
+
+					// No attributes then remove the element and keep the children
+					if (c == 0)
+						dom.remove(n, 1);
+				});
+			};
+
+			function replaceFonts() {
+				var bm;
+
+				each(dom.select('span,font'), function(n) {
+					if (n.style.fontFamily == 'mceinline' || n.face == 'mceinline') {
+						if (!bm)
+							bm = ed.selection.getBookmark();
+
+						at._mce_new = '1';
+						dom.replace(dom.create(na, at), n, 1);
+					}
+				});
+
+				// Remove redundant elements
+				each(dom.select(na + '[_mce_new]'), function(n) {
+					function removeStyle(n) {
+						if (n.nodeType == 1) {
+							each(at.style, function(v, k) {
+								dom.setStyle(n, k, '');
+							});
+
+							// Remove spans with the same class or marked classes
+							if (at['class'] && n.className && op) {
+								each(op.check_classes, function(c) {
+									if (dom.hasClass(n, c))
+										dom.removeClass(n, c);
+								});
+							}
+						}
+					};
+
+					// Remove specified style information from child elements
+					each(dom.select(na, n), removeStyle);
+
+					// Remove the specified style information on parent if current node is only child (IE)
+					if (n.parentNode && n.parentNode.nodeType == 1 && n.parentNode.childNodes.length == 1)
+						removeStyle(n.parentNode);
+
+					// Remove the child elements style info if a parent already has it
+					dom.getParent(n.parentNode, function(pn) {
+						if (pn.nodeType == 1) {
+							if (at.style) {
+								each(at.style, function(v, k) {
+									var sv;
+
+									if (!lo[k] && (sv = dom.getStyle(pn, k))) {
+										if (sv === v)
+											dom.setStyle(n, k, '');
+
+										lo[k] = 1;
+									}
+								});
+							}
+
+							// Remove spans with the same class or marked classes
+							if (at['class'] && pn.className && op) {
+								each(op.check_classes, function(c) {
+									if (dom.hasClass(pn, c))
+										dom.removeClass(n, c);
+								});
+							}
+						}
+
+						return false;
+					});
+
+					n.removeAttribute('_mce_new');
+				});
+
+				removeEmpty();
+				ed.selection.moveToBookmark(bm);
+
+				return !!bm;
+			};
+
+			// Create inline elements
+			ed.focus();
+			ed.getDoc().execCommand('FontName', false, 'mceinline');
+			replaceFonts();
+
+			if (kh = t._applyInlineStyle.keyhandler) {
+				ed.onKeyUp.remove(kh);
+				ed.onKeyPress.remove(kh);
+				ed.onKeyDown.remove(kh);
+				ed.onSetContent.remove(t._applyInlineStyle.chandler);
+			}
+
+			if (ed.selection.isCollapsed()) {
+				// IE will format the current word so this code can't be executed on that browser
+				if (!isIE) {
+					each(dom.getParents(ed.selection.getNode(), 'span'), function(n) {
+						each(at.style, function(v, k) {
+							var kv;
+
+							if (kv = dom.getStyle(n, k)) {
+								if (kv == v) {
+									dom.setStyle(n, k, '');
+									found = 2;
+									return false;
+								}
+
+								found = 1;
+								return false;
+							}
+						});
+
+						if (found)
+							return false;
+					});
+
+					if (found == 2) {
+						bm = ed.selection.getBookmark();
+
+						removeEmpty();
+
+						ed.selection.moveToBookmark(bm);
+
+						// Node change needs to be detached since the onselect event
+						// for the select box will run the onclick handler after onselect call. Todo: Add a nicer fix!
+						window.setTimeout(function() {
+							ed.nodeChanged();
+						}, 1);
+
+						return;
+					}
+				}
+
+				// Start collecting styles
+				t._pendingStyles = tinymce.extend(t._pendingStyles || {}, at.style);
+
+				t._applyInlineStyle.chandler = ed.onSetContent.add(function() {
+					delete t._pendingStyles;
+				});
+
+				t._applyInlineStyle.keyhandler = kh = function(e) {
+					// Use pending styles
+					if (t._pendingStyles) {
+						at.style = t._pendingStyles;
+						delete t._pendingStyles;
+					}
+
+					if (replaceFonts()) {
+						ed.onKeyDown.remove(t._applyInlineStyle.keyhandler);
+						ed.onKeyPress.remove(t._applyInlineStyle.keyhandler);
+					}
+
+					if (e.type == 'keyup')
+						ed.onKeyUp.remove(t._applyInlineStyle.keyhandler);
+				};
+
+				ed.onKeyDown.add(kh);
+				ed.onKeyPress.add(kh);
+				ed.onKeyUp.add(kh);
+			} else
+				t._pendingStyles = 0;
+		}
+	});
+})(tinymce);(function(tinymce) {
+	tinymce.create('tinymce.UndoManager', {
+		index : 0,
+		data : null,
+		typing : 0,
+
+		UndoManager : function(ed) {
+			var t = this, Dispatcher = tinymce.util.Dispatcher;
+
+			t.editor = ed;
+			t.data = [];
+			t.onAdd = new Dispatcher(this);
+			t.onUndo = new Dispatcher(this);
+			t.onRedo = new Dispatcher(this);
+		},
+
+		add : function(l) {
+			var t = this, i, ed = t.editor, b, s = ed.settings, la;
+
+			l = l || {};
+			l.content = l.content || ed.getContent({format : 'raw', no_events : 1});
+
+			// Add undo level if needed
+			l.content = l.content.replace(/^\s*|\s*$/g, '');
+			la = t.data[t.index > 0 && (t.index == 0 || t.index == t.data.length) ? t.index - 1 : t.index];
+			if (!l.initial && la && l.content == la.content)
+				return null;
+
+			// Time to compress
+			if (s.custom_undo_redo_levels) {
+				if (t.data.length > s.custom_undo_redo_levels) {
+					for (i = 0; i < t.data.length - 1; i++)
+						t.data[i] = t.data[i + 1];
+
+					t.data.length--;
+					t.index = t.data.length;
+				}
+			}
+
+			if (s.custom_undo_redo_restore_selection && !l.initial)
+				l.bookmark = b = l.bookmark || ed.selection.getBookmark();
+
+			if (t.index < t.data.length)
+				t.index++;
+
+			// Only initial marked undo levels should be allowed as first item
+			// This to workaround a bug with Firefox and the blur event
+			if (t.data.length === 0 && !l.initial)
+				return null;
+
+			// Add level
+			t.data.length = t.index + 1;
+			t.data[t.index++] = l;
+
+			if (l.initial)
+				t.index = 0;
+
+			// Set initial bookmark use first real undo level
+			if (t.data.length == 2 && t.data[0].initial)
+				t.data[0].bookmark = b;
+
+			t.onAdd.dispatch(t, l);
+			ed.isNotDirty = 0;
+
+			//console.dir(t.data);
+
+			return l;
+		},
+
+		undo : function() {
+			var t = this, ed = t.editor, l = l, i;
+
+			if (t.typing) {
+				t.add();
+				t.typing = 0;
+			}
+
+			if (t.index > 0) {
+				// If undo on last index then take snapshot
+				if (t.index == t.data.length && t.index > 1) {
+					i = t.index;
+					t.typing = 0;
+
+					if (!t.add())
+						t.index = i;
+
+					--t.index;
+				}
+
+				l = t.data[--t.index];
+				ed.setContent(l.content, {format : 'raw'});
+				ed.selection.moveToBookmark(l.bookmark);
+
+				t.onUndo.dispatch(t, l);
+			}
+
+			return l;
+		},
+
+		redo : function() {
+			var t = this, ed = t.editor, l = null;
+
+			if (t.index < t.data.length - 1) {
+				l = t.data[++t.index];
+				ed.setContent(l.content, {format : 'raw'});
+				ed.selection.moveToBookmark(l.bookmark);
+
+				t.onRedo.dispatch(t, l);
+			}
+
+			return l;
+		},
+
+		clear : function() {
+			var t = this;
+
+			t.data = [];
+			t.index = 0;
+			t.typing = 0;
+			t.add({initial : true});
+		},
+
+		hasUndo : function() {
+			return this.index != 0 || this.typing;
+		},
+
+		hasRedo : function() {
+			return this.index < this.data.length - 1;
+		}
+
+		});
+})(tinymce);
+(function(tinymce) {
+	// Shorten names
+	var Event, isIE, isGecko, isOpera, each, extend;
+
+	Event = tinymce.dom.Event;
+	isIE = tinymce.isIE;
+	isGecko = tinymce.isGecko;
+	isOpera = tinymce.isOpera;
+	each = tinymce.each;
+	extend = tinymce.extend;
+
+	function isEmpty(n) {
+		n = n.innerHTML;
+
+		n = n.replace(/<(img|hr|table|input|select|textarea)[ \>]/gi, '-'); // Keep these convert them to - chars
+		n = n.replace(/<[^>]+>/g, ''); // Remove all tags
+
+		return n.replace(/[ \t\r\n]+/g, '') == '';
+	};
+
+	tinymce.create('tinymce.ForceBlocks', {
+		ForceBlocks : function(ed) {
+			var t = this, s = ed.settings, elm;
+
+			t.editor = ed;
+			t.dom = ed.dom;
+			elm = (s.forced_root_block || 'p').toLowerCase();
+			s.element = elm.toUpperCase();
+
+			ed.onPreInit.add(t.setup, t);
+
+			t.reOpera = new RegExp('(\\u00a0|&#160;|&nbsp;)<\/' + elm + '>', 'gi');
+			t.rePadd = new RegExp('<p( )([^>]+)><\\\/p>|<p( )([^>]+)\\\/>|<p( )([^>]+)>\\s+<\\\/p>|<p><\\\/p>|<p\\\/>|<p>\\s+<\\\/p>'.replace(/p/g, elm), 'gi');
+			t.reNbsp2BR1 = new RegExp('<p( )([^>]+)>[\\s\\u00a0]+<\\\/p>|<p>[\\s\\u00a0]+<\\\/p>'.replace(/p/g, elm), 'gi');
+			t.reNbsp2BR2 = new RegExp('<%p()([^>]+)>(&nbsp;|&#160;)<\\\/%p>|<%p>(&nbsp;|&#160;)<\\\/%p>'.replace(/%p/g, elm), 'gi');
+			t.reBR2Nbsp = new RegExp('<p( )([^>]+)>\\s*<br \\\/>\\s*<\\\/p>|<p>\\s*<br \\\/>\\s*<\\\/p>'.replace(/p/g, elm), 'gi');
+
+			function padd(ed, o) {
+				if (isOpera)
+					o.content = o.content.replace(t.reOpera, '</' + elm + '>');
+
+				o.content = o.content.replace(t.rePadd, '<' + elm + '$1$2$3$4$5$6>\u00a0</' + elm + '>');
+
+				if (!isIE && !isOpera && o.set) {
+					// Use &nbsp; instead of BR in padded paragraphs
+					o.content = o.content.replace(t.reNbsp2BR1, '<' + elm + '$1$2><br /></' + elm + '>');
+					o.content = o.content.replace(t.reNbsp2BR2, '<' + elm + '$1$2><br /></' + elm + '>');
+				} else
+					o.content = o.content.replace(t.reBR2Nbsp, '<' + elm + '$1$2>\u00a0</' + elm + '>');
+			};
+
+			ed.onBeforeSetContent.add(padd);
+			ed.onPostProcess.add(padd);
+
+			if (s.forced_root_block) {
+				ed.onInit.add(t.forceRoots, t);
+				ed.onSetContent.add(t.forceRoots, t);
+				ed.onBeforeGetContent.add(t.forceRoots, t);
+			}
+		},
+
+		setup : function() {
+			var t = this, ed = t.editor, s = ed.settings;
+
+			// Force root blocks when typing and when getting output
+			if (s.forced_root_block) {
+				ed.onKeyUp.add(t.forceRoots, t);
+				ed.onPreProcess.add(t.forceRoots, t);
+			}
+
+			if (s.force_br_newlines) {
+				// Force IE to produce BRs on enter
+				if (isIE) {
+					ed.onKeyPress.add(function(ed, e) {
+						var n, s = ed.selection;
+
+						if (e.keyCode == 13 && s.getNode().nodeName != 'LI') {
+							s.setContent('<br id="__" /> ', {format : 'raw'});
+							n = ed.dom.get('__');
+							n.removeAttribute('id');
+							s.select(n);
+							s.collapse();
+							return Event.cancel(e);
+						}
+					});
+				}
+
+				return;
+			}
+
+			if (!isIE && s.force_p_newlines) {
+/*				ed.onPreProcess.add(function(ed, o) {
+					each(ed.dom.select('br', o.node), function(n) {
+						var p = n.parentNode;
+
+						// Replace <p><br /></p> with <p>&nbsp;</p>
+						if (p && p.nodeName == 'p' && (p.childNodes.length == 1 || p.lastChild == n)) {
+							p.replaceChild(ed.getDoc().createTextNode('\u00a0'), n);
+						}
+					});
+				});*/
+
+				ed.onKeyPress.add(function(ed, e) {
+					if (e.keyCode == 13 && !e.shiftKey) {
+						if (!t.insertPara(e))
+							Event.cancel(e);
+					}
+				});
+
+				if (isGecko) {
+					ed.onKeyDown.add(function(ed, e) {
+						if ((e.keyCode == 8 || e.keyCode == 46) && !e.shiftKey)
+							t.backspaceDelete(e, e.keyCode == 8);
+					});
+				}
+			}
+
+			function ren(rn, na) {
+				var ne = ed.dom.create(na);
+
+				each(rn.attributes, function(a) {
+					if (a.specified && a.nodeValue)
+						ne.setAttribute(a.nodeName.toLowerCase(), a.nodeValue);
+				});
+
+				each(rn.childNodes, function(n) {
+					ne.appendChild(n.cloneNode(true));
+				});
+
+				rn.parentNode.replaceChild(ne, rn);
+
+				return ne;
+			};
+
+			// Padd empty inline elements within block elements
+			// For example: <p><strong><em></em></strong></p> becomes <p><strong><em>&nbsp;</em></strong></p>
+			ed.onPreProcess.add(function(ed, o) {
+				each(ed.dom.select('p,h1,h2,h3,h4,h5,h6,div', o.node), function(p) {
+					if (isEmpty(p)) {
+						each(ed.dom.select('span,em,strong,b,i', o.node), function(n) {
+							if (!n.hasChildNodes()) {
+								n.appendChild(ed.getDoc().createTextNode('\u00a0'));
+								return false; // Break the loop one padding is enough
+							}
+						});
+					}
+				});
+			});
+
+			// IE specific fixes
+			if (isIE) {
+				// Replaces IE:s auto generated paragraphs with the specified element name
+				if (s.element != 'P') {
+					ed.onKeyPress.add(function(ed, e) {
+						t.lastElm = ed.selection.getNode().nodeName;
+					});
+
+					ed.onKeyUp.add(function(ed, e) {
+						var bl, sel = ed.selection, n = sel.getNode(), b = ed.getBody();
+
+						if (b.childNodes.length === 1 && n.nodeName == 'P') {
+							n = ren(n, s.element);
+							sel.select(n);
+							sel.collapse();
+							ed.nodeChanged();
+						} else if (e.keyCode == 13 && !e.shiftKey && t.lastElm != 'P') {
+							bl = ed.dom.getParent(n, 'p');
+
+							if (bl) {
+								ren(bl, s.element);
+								ed.nodeChanged();
+							}
+						}
+					});
+				}
+			}
+		},
+
+		find : function(n, t, s) {
+			var ed = this.editor, w = ed.getDoc().createTreeWalker(n, 4, null, false), c = -1;
+
+			while (n = w.nextNode()) {
+				c++;
+
+				// Index by node
+				if (t == 0 && n == s)
+					return c;
+
+				// Node by index
+				if (t == 1 && c == s)
+					return n;
+			}
+
+			return -1;
+		},
+
+		forceRoots : function(ed, e) {
+			var t = this, ed = t.editor, b = ed.getBody(), d = ed.getDoc(), se = ed.selection, s = se.getSel(), r = se.getRng(), si = -2, ei, so, eo, tr, c = -0xFFFFFF;
+			var nx, bl, bp, sp, le, nl = b.childNodes, i, n, eid;
+
+			// Fix for bug #1863847
+			//if (e && e.keyCode == 13)
+			//	return true;
+
+			// Wrap non blocks into blocks
+			for (i = nl.length - 1; i >= 0; i--) {
+				nx = nl[i];
+
+				// Is text or non block element
+				if (nx.nodeType == 3 || (!t.dom.isBlock(nx) && nx.nodeType != 8)) {
+					if (!bl) {
+						// Create new block but ignore whitespace
+						if (nx.nodeType != 3 || /[^\s]/g.test(nx.nodeValue)) {
+							// Store selection
+							if (si == -2 && r) {
+								if (!isIE) {
+									// If selection is element then mark it
+									if (r.startContainer.nodeType == 1 && (n = r.startContainer.childNodes[r.startOffset]) && n.nodeType == 1) {
+										// Save the id of the selected element
+										eid = n.getAttribute("id");
+										n.setAttribute("id", "__mce");
+									} else {
+										// If element is inside body, might not be the case in contentEdiable mode
+										if (ed.dom.getParent(r.startContainer, function(e) {return e === b;})) {
+											so = r.startOffset;
+											eo = r.endOffset;
+											si = t.find(b, 0, r.startContainer);
+											ei = t.find(b, 0, r.endContainer);
+										}
+									}
+								} else {
+									tr = d.body.createTextRange();
+									tr.moveToElementText(b);
+									tr.collapse(1);
+									bp = tr.move('character', c) * -1;
+
+									tr = r.duplicate();
+									tr.collapse(1);
+									sp = tr.move('character', c) * -1;
+
+									tr = r.duplicate();
+									tr.collapse(0);
+									le = (tr.move('character', c) * -1) - sp;
+
+									si = sp - bp;
+									ei = le;
+								}
+							}
+
+							bl = ed.dom.create(ed.settings.forced_root_block);
+							bl.appendChild(nx.cloneNode(1));
+							nx.parentNode.replaceChild(bl, nx);
+						}
+					} else {
+						if (bl.hasChildNodes())
+							bl.insertBefore(nx, bl.firstChild);
+						else
+							bl.appendChild(nx);
+					}
+				} else
+					bl = null; // Time to create new block
+			}
+
+			// Restore selection
+			if (si != -2) {
+				if (!isIE) {
+					bl = b.getElementsByTagName(ed.settings.element)[0];
+					r = d.createRange();
+
+					// Select last location or generated block
+					if (si != -1)
+						r.setStart(t.find(b, 1, si), so);
+					else
+						r.setStart(bl, 0);
+
+					// Select last location or generated block
+					if (ei != -1)
+						r.setEnd(t.find(b, 1, ei), eo);
+					else
+						r.setEnd(bl, 0);
+
+					if (s) {
+						s.removeAllRanges();
+						s.addRange(r);
+					}
+				} else {
+					try {
+						r = s.createRange();
+						r.moveToElementText(b);
+						r.collapse(1);
+						r.moveStart('character', si);
+						r.moveEnd('character', ei);
+						r.select();
+					} catch (ex) {
+						// Ignore
+					}
+				}
+			} else if (!isIE && (n = ed.dom.get('__mce'))) {
+				// Restore the id of the selected element
+				if (eid)
+					n.setAttribute('id', eid);
+				else
+					n.removeAttribute('id');
+
+				// Move caret before selected element
+				r = d.createRange();
+				r.setStartBefore(n);
+				r.setEndBefore(n);
+				se.setRng(r);
+			}
+		},
+
+		getParentBlock : function(n) {
+			var d = this.dom;
+
+			return d.getParent(n, d.isBlock);
+		},
+
+		insertPara : function(e) {
+			var t = this, ed = t.editor, dom = ed.dom, d = ed.getDoc(), se = ed.settings, s = ed.selection.getSel(), r = s.getRangeAt(0), b = d.body;
+			var rb, ra, dir, sn, so, en, eo, sb, eb, bn, bef, aft, sc, ec, n, vp = dom.getViewPort(ed.getWin()), y, ch, car;
+
+			// If root blocks are forced then use Operas default behavior since it's really good
+// Removed due to bug: #1853816
+//			if (se.forced_root_block && isOpera)
+//				return true;
+
+			// Setup before range
+			rb = d.createRange();
+
+			// If is before the first block element and in body, then move it into first block element
+			rb.setStart(s.anchorNode, s.anchorOffset);
+			rb.collapse(true);
+
+			// Setup after range
+			ra = d.createRange();
+
+			// If is before the first block element and in body, then move it into first block element
+			ra.setStart(s.focusNode, s.focusOffset);
+			ra.collapse(true);
+
+			// Setup start/end points
+			dir = rb.compareBoundaryPoints(rb.START_TO_END, ra) < 0;
+			sn = dir ? s.anchorNode : s.focusNode;
+			so = dir ? s.anchorOffset : s.focusOffset;
+			en = dir ? s.focusNode : s.anchorNode;
+			eo = dir ? s.focusOffset : s.anchorOffset;
+
+			// If selection is in empty table cell
+			if (sn === en && /^(TD|TH)$/.test(sn.nodeName)) {
+				if (sn.firstChild.nodeName == 'BR')
+					dom.remove(sn.firstChild); // Remove BR
+
+				// Create two new block elements
+				if (sn.childNodes.length == 0) {
+					ed.dom.add(sn, se.element, null, '<br />');
+					aft = ed.dom.add(sn, se.element, null, '<br />');
+				} else {
+					n = sn.innerHTML;
+					sn.innerHTML = '';
+					ed.dom.add(sn, se.element, null, n);
+					aft = ed.dom.add(sn, se.element, null, '<br />');
+				}
+
+				// Move caret into the last one
+				r = d.createRange();
+				r.selectNodeContents(aft);
+				r.collapse(1);
+				ed.selection.setRng(r);
+
+				return false;
+			}
+
+			// If the caret is in an invalid location in FF we need to move it into the first block
+			if (sn == b && en == b && b.firstChild && ed.dom.isBlock(b.firstChild)) {
+				sn = en = sn.firstChild;
+				so = eo = 0;
+				rb = d.createRange();
+				rb.setStart(sn, 0);
+				ra = d.createRange();
+				ra.setStart(en, 0);
+			}
+
+			// Never use body as start or end node
+			sn = sn.nodeName == "HTML" ? d.body : sn; // Fix for Opera bug: https://bugs.opera.com/show_bug.cgi?id=273224&comments=yes
+			sn = sn.nodeName == "BODY" ? sn.firstChild : sn;
+			en = en.nodeName == "HTML" ? d.body : en; // Fix for Opera bug: https://bugs.opera.com/show_bug.cgi?id=273224&comments=yes
+			en = en.nodeName == "BODY" ? en.firstChild : en;
+
+			// Get start and end blocks
+			sb = t.getParentBlock(sn);
+			eb = t.getParentBlock(en);
+			bn = sb ? sb.nodeName : se.element; // Get block name to create
+
+			// Return inside list use default browser behavior
+			if (t.dom.getParent(sb, 'ol,ul,pre'))
+				return true;
+
+			// If caption or absolute layers then always generate new blocks within
+			if (sb && (sb.nodeName == 'CAPTION' || /absolute|relative|fixed/gi.test(dom.getStyle(sb, 'position', 1)))) {
+				bn = se.element;
+				sb = null;
+			}
+
+			// If caption or absolute layers then always generate new blocks within
+			if (eb && (eb.nodeName == 'CAPTION' || /absolute|relative|fixed/gi.test(dom.getStyle(sb, 'position', 1)))) {
+				bn = se.element;
+				eb = null;
+			}
+
+			// Use P instead
+			if (/(TD|TABLE|TH|CAPTION)/.test(bn) || (sb && bn == "DIV" && /left|right/gi.test(dom.getStyle(sb, 'float', 1)))) {
+				bn = se.element;
+				sb = eb = null;
+			}
 
-		if (tinyMCE.isRealIE)
-			return s.createRange();
+			// Setup new before and after blocks
+			bef = (sb && sb.nodeName == bn) ? sb.cloneNode(0) : ed.dom.create(bn);
+			aft = (eb && eb.nodeName == bn) ? eb.cloneNode(0) : ed.dom.create(bn);
 
-		if (tinyMCE.isSafari && !s.getRangeAt)
-			return '' + window.getSelection();
+			// Remove id from after clone
+			aft.removeAttribute('id');
 
-		return s.getRangeAt(0);
-	},
+			// Is header and cursor is at the end, then force paragraph under
+			if (/^(H[1-6])$/.test(bn) && sn.nodeValue && so == sn.nodeValue.length)
+				aft = ed.dom.create(se.element);
 
-	getFocusElement : function() {
-		var inst = this.instance, doc, rng, sel, elm;
+			// Find start chop node
+			n = sc = sn;
+			do {
+				if (n == b || n.nodeType == 9 || t.dom.isBlock(n) || /(TD|TABLE|TH|CAPTION)/.test(n.nodeName))
+					break;
 
-		if (tinyMCE.isRealIE) {
-			doc = inst.getDoc();
-			rng = doc.selection.createRange();
+				sc = n;
+			} while ((n = n.previousSibling ? n.previousSibling : n.parentNode));
 
-	//		if (rng.collapse)
-	//			rng.collapse(true);
+			// Find end chop node
+			n = ec = en;
+			do {
+				if (n == b || n.nodeType == 9 || t.dom.isBlock(n) || /(TD|TABLE|TH|CAPTION)/.test(n.nodeName))
+					break;
 
-			elm = rng.item ? rng.item(0) : rng.parentElement();
-		} else {
-			if (!tinyMCE.isSafari && inst.isHidden())
-				return inst.getBody();
+				ec = n;
+			} while ((n = n.nextSibling ? n.nextSibling : n.parentNode));
 
-			sel = this.getSel();
-			rng = this.getRng();
+			// Place first chop part into before block element
+			if (sc.nodeName == bn)
+				rb.setStart(sc, 0);
+			else
+				rb.setStartBefore(sc);
 
-			if (!sel || !rng)
-				return null;
+			rb.setEnd(sn, so);
+			bef.appendChild(rb.cloneContents() || d.createTextNode('')); // Empty text node needed for Safari
 
-			elm = rng.commonAncestorContainer;
-			//elm = (sel && sel.anchorNode) ? sel.anchorNode : null;
+			// Place secnd chop part within new block element
+			try {
+				ra.setEndAfter(ec);
+			} catch(ex) {
+				//console.debug(s.focusNode, s.focusOffset);
+			}
 
-			// Handle selection a image or other control like element such as anchors
-			if (!rng.collapsed) {
-				// Is selection small
-				if (rng.startContainer == rng.endContainer) {
-					if (rng.startOffset - rng.endOffset < 2) {
-						if (rng.startContainer.hasChildNodes())
-							elm = rng.startContainer.childNodes[rng.startOffset];
-					}
-				}
+			ra.setStart(en, eo);
+			aft.appendChild(ra.cloneContents() || d.createTextNode('')); // Empty text node needed for Safari
+
+			// Create range around everything
+			r = d.createRange();
+			if (!sc.previousSibling && sc.parentNode.nodeName == bn) {
+				r.setStartBefore(sc.parentNode);
+			} else {
+				if (rb.startContainer.nodeName == bn && rb.startOffset == 0)
+					r.setStartBefore(rb.startContainer);
+				else
+					r.setStart(rb.startContainer, rb.startOffset);
 			}
 
-			// Get the element parent of the node
-			elm = tinyMCE.getParentElement(elm);
+			if (!ec.nextSibling && ec.parentNode.nodeName == bn)
+				r.setEndAfter(ec.parentNode);
+			else
+				r.setEnd(ra.endContainer, ra.endOffset);
 
-			//if (tinyMCE.selectedElement != null && tinyMCE.selectedElement.nodeName.toLowerCase() == "img")
-			//	elm = tinyMCE.selectedElement;
-		}
+			// Delete and replace it with new block elements
+			r.deleteContents();
 
-		return elm;
-	}
+			if (isOpera)
+				ed.getWin().scrollTo(0, vp.y);
 
-	};
+			// Never wrap blocks in blocks
+			if (bef.firstChild && bef.firstChild.nodeName == bn)
+				bef.innerHTML = bef.firstChild.innerHTML;
 
-/* file:jscripts/tiny_mce/classes/TinyMCE_UndoRedo.class.js */
+			if (aft.firstChild && aft.firstChild.nodeName == bn)
+				aft.innerHTML = aft.firstChild.innerHTML;
 
-function TinyMCE_UndoRedo(inst) {
-	this.instance = inst;
-	this.undoLevels = new Array();
-	this.undoIndex = 0;
-	this.typingUndoIndex = -1;
-	this.undoRedo = true;
-};
+			// Padd empty blocks
+			if (isEmpty(bef))
+				bef.innerHTML = '<br />';
 
-TinyMCE_UndoRedo.prototype = {
-	add : function(l) {
-		var b, customUndoLevels, newHTML, inst = this.instance, i, ul, ur;
+			function appendStyles(e, en) {
+				var nl = [], nn, n, i;
 
-		if (l) {
-			this.undoLevels[this.undoLevels.length] = l;
-			return true;
-		}
+				e.innerHTML = '';
 
-		if (this.typingUndoIndex != -1) {
-			this.undoIndex = this.typingUndoIndex;
+				// Make clones of style elements
+				if (se.keep_styles) {
+					n = en;
+					do {
+						// We only want style specific elements
+						if (/^(SPAN|STRONG|B|EM|I|FONT|STRIKE|U)$/.test(n.nodeName)) {
+							nn = n.cloneNode(false);
+							dom.setAttrib(nn, 'id', ''); // Remove ID since it needs to be unique
+							nl.push(nn);
+						}
+					} while (n = n.parentNode);
+				}
 
-			if (tinyMCE.typingUndoIndex != -1)
-				tinyMCE.undoIndex = tinyMCE.typingUndoIndex;
-		}
+				// Append style elements to aft
+				if (nl.length > 0) {
+					for (i = nl.length - 1, nn = e; i >= 0; i--)
+						nn = nn.appendChild(nl[i]);
 
-		newHTML = tinyMCE.trim(inst.getBody().innerHTML);
-		if (this.undoLevels[this.undoIndex] && newHTML != this.undoLevels[this.undoIndex].content) {
-			//tinyMCE.debug(newHTML, this.undoLevels[this.undoIndex].content);
+					// Padd most inner style element
+					nl[0].innerHTML = isOpera ? '&nbsp;' : '<br />'; // Extra space for Opera so that the caret can move there
+					return nl[0]; // Move caret to most inner element
+				} else
+					e.innerHTML = isOpera ? '&nbsp;' : '<br />'; // Extra space for Opera so that the caret can move there
+			};
 
-			tinyMCE.dispatchCallback(inst, 'onchange_callback', 'onChange', inst);
+			// Fill empty afterblook with current style
+			if (isEmpty(aft))
+				car = appendStyles(aft, en);
+
+			// Opera needs this one backwards for older versions
+			if (isOpera && parseFloat(opera.version()) < 9.5) {
+				r.insertNode(bef);
+				r.insertNode(aft);
+			} else {
+				r.insertNode(aft);
+				r.insertNode(bef);
+			}
 
-			// Time to compress
-			customUndoLevels = tinyMCE.settings['custom_undo_redo_levels'];
-			if (customUndoLevels != -1 && this.undoLevels.length > customUndoLevels) {
-				for (i=0; i<this.undoLevels.length-1; i++)
-					this.undoLevels[i] = this.undoLevels[i+1];
+			// Normalize
+			aft.normalize();
+			bef.normalize();
 
-				this.undoLevels.length--;
-				this.undoIndex--;
+			function first(n) {
+				return d.createTreeWalker(n, NodeFilter.SHOW_TEXT, null, false).nextNode() || n;
+			};
 
-				// Todo: Implement global undo/redo logic here
+			// Move cursor and scroll into view
+			r = d.createRange();
+			r.selectNodeContents(isGecko ? first(car || aft) : car || aft);
+			r.collapse(1);
+			s.removeAllRanges();
+			s.addRange(r);
+
+			// scrollIntoView seems to scroll the parent window in most browsers now including FF 3.0b4 so it's time to stop using it and do it our selfs
+			y = ed.dom.getPos(aft).y;
+			ch = aft.clientHeight;
+
+			// Is element within viewport
+			if (y < vp.y || y + ch > vp.y + vp.h) {
+				ed.getWin().scrollTo(0, y < vp.y ? y : y - vp.h + 25); // Needs to be hardcoded to roughly one line of text if a huge text block is broken into two blocks
+				//console.debug('SCROLL!', 'vp.y: ' + vp.y, 'y' + y, 'vp.h' + vp.h, 'clientHeight' + aft.clientHeight, 'yyy: ' + (y < vp.y ? y : y - vp.h + aft.clientHeight));
 			}
 
-			b = inst.undoBookmark;
-
-			if (!b)
-				b = inst.selection.getBookmark();
+			return false;
+		},
 
-			this.undoIndex++;
-			this.undoLevels[this.undoIndex] = {
-				content : newHTML,
-				bookmark : b
-			};
+		backspaceDelete : function(e, bs) {
+			var t = this, ed = t.editor, b = ed.getBody(), n, se = ed.selection, r = se.getRng(), sc = r.startContainer, n, w, tn;
 
-			// Remove all above from global undo/redo
-			ul = tinyMCE.undoLevels;
-			for (i=tinyMCE.undoIndex + 1; i<ul.length; i++) {
-				ur = ul[i].undoRedo;
+			// The caret sometimes gets stuck in Gecko if you delete empty paragraphs
+			// This workaround removes the element by hand and moves the caret to the previous element
+			if (sc && ed.dom.isBlock(sc) && !/^(TD|TH)$/.test(sc.nodeName) && bs) {
+				if (sc.childNodes.length == 0 || (sc.childNodes.length == 1 && sc.firstChild.nodeName == 'BR')) {
+					// Find previous block element
+					n = sc;
+					while ((n = n.previousSibling) && !ed.dom.isBlock(n)) ;
+
+					if (n) {
+						if (sc != b.firstChild) {
+							// Find last text node
+							w = ed.dom.doc.createTreeWalker(n, NodeFilter.SHOW_TEXT, null, false);
+							while (tn = w.nextNode())
+								n = tn;
+
+							// Place caret at the end of last text node
+							r = ed.getDoc().createRange();
+							r.setStart(n, n.nodeValue ? n.nodeValue.length : 0);
+							r.setEnd(n, n.nodeValue ? n.nodeValue.length : 0);
+							se.setRng(r);
 
-				if (ur.undoIndex == ur.undoLevels.length -1)
-					ur.undoIndex--;
+							// Remove the target container
+							ed.dom.remove(sc);
+						}
 
-				ur.undoLevels.length--;
+						return Event.cancel(e);
+					}
+				}
 			}
 
-			// Add global undo level
-			tinyMCE.undoLevels[tinyMCE.undoIndex++] = inst;
-			tinyMCE.undoLevels.length = tinyMCE.undoIndex;
+			// Gecko generates BR elements here and there, we don't like those so lets remove them
+			function handler(e) {
+				var pr;
 
-			this.undoLevels.length = this.undoIndex + 1;
+				e = e.target;
 
-			return true;
-		}
+				// A new BR was created in a block element, remove it
+				if (e && e.parentNode && e.nodeName == 'BR' && (n = t.getParentBlock(e))) {
+					pr = e.previousSibling;
 
-		return false;
-	},
+					Event.remove(b, 'DOMNodeInserted', handler);
 
-	undo : function() {
-		var inst = this.instance;
+					// Is there whitespace at the end of the node before then we might need the pesky BR
+					// to place the caret at a correct location see bug: #2013943
+					if (pr && pr.nodeType == 3 && /\s+$/.test(pr.nodeValue))
+						return;
 
-		// Do undo
-		if (this.undoIndex > 0) {
-			this.undoIndex--;
+					// Only remove BR elements that got inserted in the middle of the text
+					if (e.previousSibling || e.nextSibling)
+						ed.dom.remove(e);
+				}
+			};
 
-			tinyMCE.setInnerHTML(inst.getBody(), this.undoLevels[this.undoIndex].content);
-			inst.repaint();
+			// Listen for new nodes
+			Event._add(b, 'DOMNodeInserted', handler);
 
-			if (inst.settings.custom_undo_redo_restore_selection)
-				inst.selection.moveToBookmark(this.undoLevels[this.undoIndex].bookmark);
+			// Remove listener
+			window.setTimeout(function() {
+				Event._remove(b, 'DOMNodeInserted', handler);
+			}, 1);
 		}
-	},
+	});
+})(tinymce);
+(function(tinymce) {
+	// Shorten names
+	var DOM = tinymce.DOM, Event = tinymce.dom.Event, each = tinymce.each, extend = tinymce.extend;
+
+	tinymce.create('tinymce.ControlManager', {
+		ControlManager : function(ed, s) {
+			var t = this, i;
+
+			s = s || {};
+			t.editor = ed;
+			t.controls = {};
+			t.onAdd = new tinymce.util.Dispatcher(t);
+			t.onPostRender = new tinymce.util.Dispatcher(t);
+			t.prefix = s.prefix || ed.id + '_';
+			t._cls = {};
+
+			t.onPostRender.add(function() {
+				each(t.controls, function(c) {
+					c.postRender();
+				});
+			});
+		},
 
-	redo : function() {
-		var inst = this.instance;
+		get : function(id) {
+			return this.controls[this.prefix + id] || this.controls[id];
+		},
 
-		tinyMCE.execCommand("mceEndTyping");
+		setActive : function(id, s) {
+			var c = null;
 
-		if (this.undoIndex < (this.undoLevels.length-1)) {
-			this.undoIndex++;
+			if (c = this.get(id))
+				c.setActive(s);
 
-			tinyMCE.setInnerHTML(inst.getBody(), this.undoLevels[this.undoIndex].content);
-			inst.repaint();
+			return c;
+		},
 
-			if (inst.settings.custom_undo_redo_restore_selection)
-				inst.selection.moveToBookmark(this.undoLevels[this.undoIndex].bookmark);
-		}
+		setDisabled : function(id, s) {
+			var c = null;
 
-		tinyMCE.triggerNodeChange();
-	}
+			if (c = this.get(id))
+				c.setDisabled(s);
 
-	};
+			return c;
+		},
 
-/* file:jscripts/tiny_mce/classes/TinyMCE_ForceParagraphs.class.js */
+		add : function(c) {
+			var t = this;
 
-var TinyMCE_ForceParagraphs = {
-	_insertPara : function(inst, e) {
-		var doc = inst.getDoc(), sel = inst.getSel(), body = inst.getBody(), win = inst.contentWindow, rng = sel.getRangeAt(0);
-		var rootElm = doc.documentElement, blockName = "P", startNode, endNode, startBlock, endBlock;
-		var rngBefore, rngAfter, direct, startNode, startOffset, endNode, endOffset, b = tinyMCE.isOpera ? inst.selection.getBookmark() : null;
-		var paraBefore, paraAfter, startChop, endChop, contents;
-
-		function isEmpty(para) {
-			function isEmptyHTML(html) {
-				return html.replace(new RegExp('[ \t\r\n]+', 'g'), '').toLowerCase() == "";
+			if (c) {
+				t.controls[c.id] = c;
+				t.onAdd.dispatch(c, t);
 			}
 
-			// Check for images
-			if (para.getElementsByTagName("img").length > 0)
-				return false;
-
-			// Check for tables
-			if (para.getElementsByTagName("table").length > 0)
-				return false;
-
-			// Check for HRs
-			if (para.getElementsByTagName("hr").length > 0)
-				return false;
+			return c;
+		},
 
-			// Check all textnodes
-			var nodes = tinyMCE.getNodeTree(para, new Array(), 3);
-			for (var i=0; i<nodes.length; i++) {
-				if (!isEmptyHTML(nodes[i].nodeValue))
-					return false;
-			}
+		createControl : function(n) {
+			var c, t = this, ed = t.editor;
 
-			// No images, no tables, no hrs, no text content then it's empty
-			return true;
-		}
+			each(ed.plugins, function(p) {
+				if (p.createControl) {
+					c = p.createControl(n, t);
 
-	//	tinyMCE.debug(body.innerHTML);
+					if (c)
+						return false;
+				}
+			});
 
-	//	debug(e.target, sel.anchorNode.nodeName, sel.focusNode.nodeName, rng.startContainer, rng.endContainer, rng.commonAncestorContainer, sel.anchorOffset, sel.focusOffset, rng.toString());
+			switch (n) {
+				case "|":
+				case "separator":
+					return t.createSeparator();
+			}
+
+			if (!c && ed.buttons && (c = ed.buttons[n]))
+				return t.createButton(n, c);
+
+			return t.add(c);
+		},
+
+		createDropMenu : function(id, s, cc) {
+			var t = this, ed = t.editor, c, bm, v, cls;
+
+			s = extend({
+				'class' : 'mceDropDown',
+				constrain : ed.settings.constrain_menus
+			}, s);
+
+			s['class'] = s['class'] + ' ' + ed.getParam('skin') + 'Skin';
+			if (v = ed.getParam('skin_variant'))
+				s['class'] += ' ' + ed.getParam('skin') + 'Skin' + v.substring(0, 1).toUpperCase() + v.substring(1);
+
+			id = t.prefix + id;
+			cls = cc || t._cls.dropmenu || tinymce.ui.DropMenu;
+			c = t.controls[id] = new cls(id, s);
+			c.onAddItem.add(function(c, o) {
+				var s = o.settings;
+
+				s.title = ed.getLang(s.title, s.title);
+
+				if (!s.onclick) {
+					s.onclick = function(v) {
+						ed.execCommand(s.cmd, s.ui || false, s.value);
+					};
+				}
+			});
 
-		// Setup before range
-		rngBefore = doc.createRange();
-		rngBefore.setStart(sel.anchorNode, sel.anchorOffset);
-		rngBefore.collapse(true);
-
-		// Setup after range
-		rngAfter = doc.createRange();
-		rngAfter.setStart(sel.focusNode, sel.focusOffset);
-		rngAfter.collapse(true);
-
-		// Setup start/end points
-		direct = rngBefore.compareBoundaryPoints(rngBefore.START_TO_END, rngAfter) < 0;
-		startNode = direct ? sel.anchorNode : sel.focusNode;
-		startOffset = direct ? sel.anchorOffset : sel.focusOffset;
-		endNode = direct ? sel.focusNode : sel.anchorNode;
-		endOffset = direct ? sel.focusOffset : sel.anchorOffset;
-
-		startNode = startNode.nodeName == "BODY" ? startNode.firstChild : startNode;
-		endNode = endNode.nodeName == "BODY" ? endNode.firstChild : endNode;
-
-		// Get block elements
-		startBlock = inst.getParentBlockElement(startNode);
-		endBlock = inst.getParentBlockElement(endNode);
-
-		// If absolute force paragraph generation within
-		if (startBlock && new RegExp('absolute|relative|static', 'gi').test(startBlock.style.position))
-			startBlock = null;
-
-		if (endBlock && new RegExp('absolute|relative|static', 'gi').test(endBlock.style.position))
-			endBlock = null;
-
-		// Use current block name
-		if (startBlock != null) {
-			blockName = startBlock.nodeName;
+			ed.onRemove.add(function() {
+				c.destroy();
+			});
 
-			// Use P instead
-			if (blockName == "TD" || blockName == "TABLE" || (blockName == "DIV" && new RegExp('left|right', 'gi').test(startBlock.style.cssFloat)))
-				blockName = "P";
-		}
+			// Fix for bug #1897785, #1898007
+			if (tinymce.isIE) {
+				c.onShowMenu.add(function() {
+					// IE 8 needs focus in order to store away a range with the current collapsed caret location
+					ed.focus();
 
-		// Within a list use normal behaviour
-		if (tinyMCE.getParentElement(startBlock, "OL,UL", null, body) != null)
-			return false;
+					bm = ed.selection.getBookmark(1);
+				});
 
-		// Within a table create new paragraphs
-		if ((startBlock != null && startBlock.nodeName == "TABLE") || (endBlock != null && endBlock.nodeName == "TABLE"))
-			startBlock = endBlock = null;
-
-		// Setup new paragraphs
-		paraBefore = (startBlock != null && startBlock.nodeName == blockName) ? startBlock.cloneNode(false) : doc.createElement(blockName);
-		paraAfter = (endBlock != null && endBlock.nodeName == blockName) ? endBlock.cloneNode(false) : doc.createElement(blockName);
-
-		// Is header, then force paragraph under
-		if (/^(H[1-6])$/.test(blockName))
-			paraAfter = doc.createElement("p");
-
-		// Setup chop nodes
-		startChop = startNode;
-		endChop = endNode;
-
-		// Get startChop node
-		node = startChop;
-		do {
-			if (node == body || node.nodeType == 9 || tinyMCE.isBlockElement(node))
-				break;
+				c.onHideMenu.add(function() {
+					if (bm) {
+						ed.selection.moveToBookmark(bm);
+						bm = 0;
+					}
+				});
+			}
 
-			startChop = node;
-		} while ((node = node.previousSibling ? node.previousSibling : node.parentNode));
+			return t.add(c);
+		},
 
-		// Get endChop node
-		node = endChop;
-		do {
-			if (node == body || node.nodeType == 9 || tinyMCE.isBlockElement(node))
-				break;
+		createListBox : function(id, s, cc) {
+			var t = this, ed = t.editor, cmd, c, cls;
 
-			endChop = node;
-		} while ((node = node.nextSibling ? node.nextSibling : node.parentNode));
+			if (t.get(id))
+				return null;
 
-		// Fix when only a image is within the TD
-		if (startChop.nodeName == "TD")
-			startChop = startChop.firstChild;
-
-		if (endChop.nodeName == "TD")
-			endChop = endChop.lastChild;
-
-		// If not in a block element
-		if (startBlock == null) {
-			// Delete selection
-			rng.deleteContents();
-
-			if (!tinyMCE.isSafari)
-				sel.removeAllRanges();
-
-			if (startChop != rootElm && endChop != rootElm) {
-				// Insert paragraph before
-				rngBefore = rng.cloneRange();
+			s.title = ed.translate(s.title);
+			s.scope = s.scope || ed;
 
-				if (startChop == body)
-					rngBefore.setStart(startChop, 0);
-				else
-					rngBefore.setStartBefore(startChop);
+			if (!s.onselect) {
+				s.onselect = function(v) {
+					ed.execCommand(s.cmd, s.ui || false, v || s.value);
+				};
+			}
 
-				paraBefore.appendChild(rngBefore.cloneContents());
+			s = extend({
+				title : s.title,
+				'class' : 'mce_' + id,
+				scope : s.scope,
+				control_manager : t
+			}, s);
+
+			id = t.prefix + id;
+
+			if (ed.settings.use_native_selects)
+				c = new tinymce.ui.NativeListBox(id, s);
+			else {
+				cls = cc || t._cls.listbox || tinymce.ui.ListBox;
+				c = new cls(id, s);
+			}
+
+			t.controls[id] = c;
+
+			// Fix focus problem in Safari
+			if (tinymce.isWebKit) {
+				c.onPostRender.add(function(c, n) {
+					// Store bookmark on mousedown
+					Event.add(n, 'mousedown', function() {
+						ed.bookmark = ed.selection.getBookmark(1);
+					});
+
+					// Restore on focus, since it might be lost
+					Event.add(n, 'focus', function() {
+						ed.selection.moveToBookmark(ed.bookmark);
+						ed.bookmark = null;
+					});
+				});
+			}
 
-				// Insert paragraph after
-				if (endChop.parentNode.nodeName == blockName)
-					endChop = endChop.parentNode;
+			if (c.hideMenu)
+				ed.onMouseDown.add(c.hideMenu, c);
 
-				// If not after image
-				//if (rng.startContainer.nodeName != "BODY" && rng.endContainer.nodeName != "BODY")
-					rng.setEndAfter(endChop);
+			return t.add(c);
+		},
 
-				if (endChop.nodeName != "#text" && endChop.nodeName != "BODY")
-					rngBefore.setEndAfter(endChop);
+		createButton : function(id, s, cc) {
+			var t = this, ed = t.editor, o, c, cls;
 
-				contents = rng.cloneContents();
-				if (contents.firstChild && (contents.firstChild.nodeName == blockName || contents.firstChild.nodeName == "BODY"))
-					paraAfter.innerHTML = contents.firstChild.innerHTML;
-				else
-					paraAfter.appendChild(contents);
+			if (t.get(id))
+				return null;
 
-				// Check if it's a empty paragraph
-				if (isEmpty(paraBefore))
-					paraBefore.innerHTML = "&nbsp;";
-
-				// Check if it's a empty paragraph
-				if (isEmpty(paraAfter))
-					paraAfter.innerHTML = "&nbsp;";
-
-				// Delete old contents
-				rng.deleteContents();
-				rngAfter.deleteContents();
-				rngBefore.deleteContents();
-
-				// Insert new paragraphs
-				if (tinyMCE.isOpera) {
-					paraBefore.normalize();
-					rngBefore.insertNode(paraBefore);
-					paraAfter.normalize();
-					rngBefore.insertNode(paraAfter);
-				} else {
-					paraAfter.normalize();
-					rngBefore.insertNode(paraAfter);
-					paraBefore.normalize();
-					rngBefore.insertNode(paraBefore);
-				}
+			s.title = ed.translate(s.title);
+			s.label = ed.translate(s.label);
+			s.scope = s.scope || ed;
+
+			if (!s.onclick && !s.menu_button) {
+				s.onclick = function() {
+					ed.execCommand(s.cmd, s.ui || false, s.value);
+				};
+			}
 
-				//tinyMCE.debug("1: ", paraBefore.innerHTML, paraAfter.innerHTML);
+			s = extend({
+				title : s.title,
+				'class' : 'mce_' + id,
+				unavailable_prefix : ed.getLang('unavailable', ''),
+				scope : s.scope,
+				control_manager : t
+			}, s);
+
+			id = t.prefix + id;
+
+			if (s.menu_button) {
+				cls = cc || t._cls.menubutton || tinymce.ui.MenuButton;
+				c = new cls(id, s);
+				ed.onMouseDown.add(c.hideMenu, c);
 			} else {
-				body.innerHTML = "<" + blockName + ">&nbsp;</" + blockName + "><" + blockName + ">&nbsp;</" + blockName + ">";
-				paraAfter = body.childNodes[1];
+				cls = t._cls.button || tinymce.ui.Button;
+				c = new cls(id, s);
 			}
 
-			inst.selection.moveToBookmark(b);
-			inst.selection.selectNode(paraAfter, true, true);
+			return t.add(c);
+		},
 
-			return true;
-		}
+		createMenuButton : function(id, s, cc) {
+			s = s || {};
+			s.menu_button = 1;
 
-		// Place first part within new paragraph
-		if (startChop.nodeName == blockName)
-			rngBefore.setStart(startChop, 0);
-		else
-			rngBefore.setStartBefore(startChop);
-
-		rngBefore.setEnd(startNode, startOffset);
-		paraBefore.appendChild(rngBefore.cloneContents());
-
-		// Place secound part within new paragraph
-		rngAfter.setEndAfter(endChop);
-		rngAfter.setStart(endNode, endOffset);
-		contents = rngAfter.cloneContents();
-
-		if (contents.firstChild && contents.firstChild.nodeName == blockName) {
-	/*		var nodes = contents.firstChild.childNodes;
-			for (var i=0; i<nodes.length; i++) {
-				//tinyMCE.debug(nodes[i].nodeName);
-				if (nodes[i].nodeName != "BODY")
-					paraAfter.appendChild(nodes[i]);
-			}
-	*/
-			paraAfter.innerHTML = contents.firstChild.innerHTML;
-		} else
-			paraAfter.appendChild(contents);
+			return this.createButton(id, s, cc);
+		},
 
-		// Check if it's a empty paragraph
-		if (isEmpty(paraBefore))
-			paraBefore.innerHTML = "&nbsp;";
+		createSplitButton : function(id, s, cc) {
+			var t = this, ed = t.editor, cmd, c, cls;
 
-		// Check if it's a empty paragraph
-		if (isEmpty(paraAfter))
-			paraAfter.innerHTML = "&nbsp;";
+			if (t.get(id))
+				return null;
 
-		// Create a range around everything
-		rng = doc.createRange();
+			s.title = ed.translate(s.title);
+			s.scope = s.scope || ed;
 
-		if (!startChop.previousSibling && startChop.parentNode.nodeName.toUpperCase() == blockName) {
-			rng.setStartBefore(startChop.parentNode);
-		} else {
-			if (rngBefore.startContainer.nodeName.toUpperCase() == blockName && rngBefore.startOffset == 0)
-				rng.setStartBefore(rngBefore.startContainer);
-			else
-				rng.setStart(rngBefore.startContainer, rngBefore.startOffset);
-		}
+			if (!s.onclick) {
+				s.onclick = function(v) {
+					ed.execCommand(s.cmd, s.ui || false, v || s.value);
+				};
+			}
 
-		if (!endChop.nextSibling && endChop.parentNode.nodeName.toUpperCase() == blockName)
-			rng.setEndAfter(endChop.parentNode);
-		else
-			rng.setEnd(rngAfter.endContainer, rngAfter.endOffset);
+			if (!s.onselect) {
+				s.onselect = function(v) {
+					ed.execCommand(s.cmd, s.ui || false, v || s.value);
+				};
+			}
 
-		// Delete all contents and insert new paragraphs
-		rng.deleteContents();
+			s = extend({
+				title : s.title,
+				'class' : 'mce_' + id,
+				scope : s.scope,
+				control_manager : t
+			}, s);
+
+			id = t.prefix + id;
+			cls = cc || t._cls.splitbutton || tinymce.ui.SplitButton;
+			c = t.add(new cls(id, s));
+			ed.onMouseDown.add(c.hideMenu, c);
 
-		if (tinyMCE.isOpera) {
-			rng.insertNode(paraBefore);
-			rng.insertNode(paraAfter);
-		} else {
-			rng.insertNode(paraAfter);
-			rng.insertNode(paraBefore);
-		}
+			return c;
+		},
 
-		//tinyMCE.debug("2", paraBefore.innerHTML, paraAfter.innerHTML);
+		createColorSplitButton : function(id, s, cc) {
+			var t = this, ed = t.editor, cmd, c, cls, bm;
 
-		// Normalize
-		paraAfter.normalize();
-		paraBefore.normalize();
+			if (t.get(id))
+				return null;
 
-		inst.selection.moveToBookmark(b);
-		inst.selection.selectNode(paraAfter, true, true);
+			s.title = ed.translate(s.title);
+			s.scope = s.scope || ed;
 
-		return true;
-	},
+			if (!s.onclick) {
+				s.onclick = function(v) {
+					if (tinymce.isIE)
+						bm = ed.selection.getBookmark(1);
 
-	_handleBackSpace : function(inst) {
-		var r = inst.getRng(), sn = r.startContainer, nv, s = false;
+					ed.execCommand(s.cmd, s.ui || false, v || s.value);
+				};
+			}
 
-		// Added body check for bug #1527787
-		if (sn && sn.nextSibling && sn.nextSibling.nodeName == "BR" && sn.parentNode.nodeName != "BODY") {
-			nv = sn.nodeValue;
+			if (!s.onselect) {
+				s.onselect = function(v) {
+					ed.execCommand(s.cmd, s.ui || false, v || s.value);
+				};
+			}
 
-			// Handle if a backspace is pressed after a space character #bug 1466054 removed since fix for #1527787
-			/*if (nv != null && nv.length >= r.startOffset && nv.charAt(r.startOffset - 1) == ' ')
-				s = true;*/
+			s = extend({
+				title : s.title,
+				'class' : 'mce_' + id,
+				'menu_class' : ed.getParam('skin') + 'Skin',
+				scope : s.scope,
+				more_colors_title : ed.getLang('more_colors')
+			}, s);
+
+			id = t.prefix + id;
+			cls = cc || t._cls.colorsplitbutton || tinymce.ui.ColorSplitButton;
+			c = new cls(id, s);
+			ed.onMouseDown.add(c.hideMenu, c);
+
+			// Remove the menu element when the editor is removed
+			ed.onRemove.add(function() {
+				c.destroy();
+			});
 
-			// Only remove BRs if we are at the end of line #bug 1464152
-			if (nv != null && r.startOffset == nv.length)
-				sn.nextSibling.parentNode.removeChild(sn.nextSibling);
-		}
+			// Fix for bug #1897785, #1898007
+			if (tinymce.isIE) {
+				c.onShowMenu.add(function() {
+					// IE 8 needs focus in order to store away a range with the current collapsed caret location
+					ed.focus();
+					bm = ed.selection.getBookmark(1);
+				});
 
-		if (inst.settings.auto_resize)
-			inst.resizeToContent();
+				c.onHideMenu.add(function() {
+					if (bm) {
+						ed.selection.moveToBookmark(bm);
+						bm = 0;
+					}
+				});
+			}
 
-		return s;
-	}
+			return t.add(c);
+		},
 
-	};
+		createToolbar : function(id, s, cc) {
+			var c, t = this, cls;
 
-/* file:jscripts/tiny_mce/classes/TinyMCE_Layer.class.js */
+			id = t.prefix + id;
+			cls = cc || t._cls.toolbar || tinymce.ui.Toolbar;
+			c = new cls(id, s);
 
-function TinyMCE_Layer(id, bm) {
-	this.id = id;
-	this.blockerElement = null;
-	this.events = false;
-	this.element = null;
-	this.blockMode = typeof(bm) != 'undefined' ? bm : true;
-	this.doc = document;
-};
+			if (t.get(id))
+				return null;
 
-TinyMCE_Layer.prototype = {
-	moveRelativeTo : function(re, p) {
-		var rep = this.getAbsPosition(re);
-		var w = parseInt(re.offsetWidth);
-		var h = parseInt(re.offsetHeight);
-		var e = this.getElement();
-		var ew = parseInt(e.offsetWidth);
-		var eh = parseInt(e.offsetHeight);
-		var x, y;
-
-		switch (p) {
-			case "tl":
-				x = rep.absLeft;
-				y = rep.absTop;
-				break;
+			return t.add(c);
+		},
 
-			case "tr":
-				x = rep.absLeft + w;
-				y = rep.absTop;
-				break;
+		createSeparator : function(cc) {
+			var cls = cc || this._cls.separator || tinymce.ui.Separator;
 
-			case "bl":
-				x = rep.absLeft;
-				y = rep.absTop + h;
-				break;
+			return new cls();
+		},
 
-			case "br":
-				x = rep.absLeft + w;
-				y = rep.absTop + h;
-				break;
+		setControlType : function(n, c) {
+			return this._cls[n.toLowerCase()] = c;
+		},
+
+		destroy : function() {
+			each(this.controls, function(c) {
+				c.destroy();
+			});
 
-			case "cc":
-				x = rep.absLeft + (w / 2) - (ew / 2);
-				y = rep.absTop + (h / 2) - (eh / 2);
-				break;
+			this.controls = null;
 		}
 
-		this.moveTo(x, y);
-	},
-
-	moveBy : function(x, y) {
-		var e = this.getElement();
-		this.moveTo(parseInt(e.style.left) + x, parseInt(e.style.top) + y);
-	},
-
-	moveTo : function(x, y) {
-		var e = this.getElement();
-
-		e.style.left = x + "px";
-		e.style.top = y + "px";
-
-		this.updateBlocker();
-	},
-
-	resizeBy : function(w, h) {
-		var e = this.getElement();
-		this.resizeTo(parseInt(e.style.width) + w, parseInt(e.style.height) + h);
-	},
+		});
+})(tinymce);
+(function(tinymce) {
+	var Dispatcher = tinymce.util.Dispatcher, each = tinymce.each, isIE = tinymce.isIE, isOpera = tinymce.isOpera;
+
+	tinymce.create('tinymce.WindowManager', {
+		WindowManager : function(ed) {
+			var t = this;
+
+			t.editor = ed;
+			t.onOpen = new Dispatcher(t);
+			t.onClose = new Dispatcher(t);
+			t.params = {};
+			t.features = {};
+		},
+
+		open : function(s, p) {
+			var t = this, f = '', x, y, mo = t.editor.settings.dialog_type == 'modal', w, sw, sh, vp = tinymce.DOM.getViewPort(), u;
+
+			// Default some options
+			s = s || {};
+			p = p || {};
+			sw = isOpera ? vp.w : screen.width; // Opera uses windows inside the Opera window
+			sh = isOpera ? vp.h : screen.height;
+			s.name = s.name || 'mc_' + new Date().getTime();
+			s.width = parseInt(s.width || 320);
+			s.height = parseInt(s.height || 240);
+			s.resizable = true;
+			s.left = s.left || parseInt(sw / 2.0) - (s.width / 2.0);
+			s.top = s.top || parseInt(sh / 2.0) - (s.height / 2.0);
+			p.inline = false;
+			p.mce_width = s.width;
+			p.mce_height = s.height;
+			p.mce_auto_focus = s.auto_focus;
+
+			if (mo) {
+				if (isIE) {
+					s.center = true;
+					s.help = false;
+					s.dialogWidth = s.width + 'px';
+					s.dialogHeight = s.height + 'px';
+					s.scroll = s.scrollbars || false;
+				}
+			}
 
-	resizeTo : function(w, h) {
-		var e = this.getElement();
+			// Build features string
+			each(s, function(v, k) {
+				if (tinymce.is(v, 'boolean'))
+					v = v ? 'yes' : 'no';
+
+				if (!/^(name|url)$/.test(k)) {
+					if (isIE && mo)
+						f += (f ? ';' : '') + k + ':' + v;
+					else
+						f += (f ? ',' : '') + k + '=' + v;
+				}
+			});
 
-		if (w != null)
-			e.style.width = w + "px";
+			t.features = s;
+			t.params = p;
+			t.onOpen.dispatch(t, s, p);
 
-		if (h != null)
-			e.style.height = h + "px";
+			u = s.url || s.file;
+			u = tinymce._addVer(u);
 
-		this.updateBlocker();
-	},
+			try {
+				if (isIE && mo) {
+					w = 1;
+					window.showModalDialog(u, window, f);
+				} else
+					w = window.open(u, s.name, f);
+			} catch (ex) {
+				// Ignore
+			}
 
-	show : function() {
-		this.getElement().style.display = 'block';
-		this.updateBlocker();
-	},
+			if (!w)
+				alert(t.editor.getLang('popup_blocked'));
+		},
 
-	hide : function() {
-		this.getElement().style.display = 'none';
-		this.updateBlocker();
-	},
+		close : function(w) {
+			w.close();
+			this.onClose.dispatch(this);
+		},
 
-	isVisible : function() {
-		return this.getElement().style.display == 'block';
-	},
+		createInstance : function(cl, a, b, c, d, e) {
+			var f = tinymce.resolve(cl);
 
-	getElement : function() {
-		if (!this.element)
-			this.element = this.doc.getElementById(this.id);
+			return new f(a, b, c, d, e);
+		},
 
-		return this.element;
-	},
+		confirm : function(t, cb, s, w) {
+			w = w || window;
 
-	setBlockMode : function(s) {
-		this.blockMode = s;
-	},
+			cb.call(s || this, w.confirm(this._decode(this.editor.getLang(t, t))));
+		},
 
-	updateBlocker : function() {
-		var e, b, x, y, w, h;
+		alert : function(tx, cb, s, w) {
+			var t = this;
 
-		b = this.getBlocker();
-		if (b) {
-			if (this.blockMode) {
-				e = this.getElement();
-				x = this.parseInt(e.style.left);
-				y = this.parseInt(e.style.top);
-				w = this.parseInt(e.offsetWidth);
-				h = this.parseInt(e.offsetHeight);
-
-				b.style.left = x + 'px';
-				b.style.top = y + 'px';
-				b.style.width = w + 'px';
-				b.style.height = h + 'px';
-				b.style.display = e.style.display;
-			} else
-				b.style.display = 'none';
-		}
-	},
+			w = w || window;
+			w.alert(t._decode(t.editor.getLang(tx, tx)));
 
-	getBlocker : function() {
-		var d, b;
+			if (cb)
+				cb.call(s || t);
+		},
 
-		if (!this.blockerElement && this.blockMode) {
-			d = this.doc;
-			b = d.getElementById(this.id + "_blocker");
-
-			if (!b) {
-				b = d.createElement("iframe");
-
-				b.setAttribute('id', this.id + "_blocker");
-				b.style.cssText = 'display: none; position: absolute; left: 0; top: 0';
-				b.src = 'javascript:false;';
-				b.frameBorder = '0';
-				b.scrolling = 'no';
-	
-				d.body.appendChild(b);
-			}
+		// Internal functions
 
-			this.blockerElement = b;
+		_decode : function(s) {
+			return tinymce.DOM.decode(s).replace(/\\n/g, '\n');
 		}
 
-		return this.blockerElement;
-	},
+		});
+}(tinymce));(function(tinymce) {
+	tinymce.CommandManager = function() {
+		var execCommands = {}, queryStateCommands = {}, queryValueCommands = {};
+
+		function add(collection, cmd, func, scope) {
+			if (typeof(cmd) == 'string')
+				cmd = [cmd];
 
-	getAbsPosition : function(n) {
-		var p = {absLeft : 0, absTop : 0};
+			tinymce.each(cmd, function(cmd) {
+				collection[cmd.toLowerCase()] = {func : func, scope : scope};
+			});
+		};
 
-		while (n) {
-			p.absLeft += n.offsetLeft;
-			p.absTop += n.offsetTop;
-			n = n.offsetParent;
-		}
+		tinymce.extend(this, {
+			add : function(cmd, func, scope) {
+				add(execCommands, cmd, func, scope);
+			},
+
+			addQueryStateHandler : function(cmd, func, scope) {
+				add(queryStateCommands, cmd, func, scope);
+			},
+
+			addQueryValueHandler : function(cmd, func, scope) {
+				add(queryValueCommands, cmd, func, scope);
+			},
+
+			execCommand : function(scope, cmd, ui, value, args) {
+				if (cmd = execCommands[cmd.toLowerCase()]) {
+					if (cmd.func.call(scope || cmd.scope, ui, value, args) !== false)
+						return true;
+				}
+			},
 
-		return p;
-	},
+			queryCommandValue : function() {
+				if (cmd = queryValueCommands[cmd.toLowerCase()])
+					return cmd.func.call(scope || cmd.scope, ui, value, args);
+			},
+
+			queryCommandState : function() {
+				if (cmd = queryStateCommands[cmd.toLowerCase()])
+					return cmd.func.call(scope || cmd.scope, ui, value, args);
+			}
+		});
+	};
 
-	create : function(n, c, p, h) {
-		var d = this.doc, e = d.createElement(n);
+	tinymce.GlobalCommands = new tinymce.CommandManager();
+})(tinymce);(function(tinymce) {
+	function processRange(dom, start, end, callback) {
+		var ancestor, n, startPoint, endPoint, sib;
 
-		e.setAttribute('id', this.id);
+		function findEndPoint(n, c) {
+			do {
+				if (n.parentNode == c)
+					return n;
 
-		if (c)
-			e.className = c;
+				n = n.parentNode;
+			} while(n);
+		};
 
-		if (!p)
-			p = d.body;
+		function process(n) {
+			callback(n);
+			tinymce.walk(n, callback, 'childNodes');
+		};
 
-		if (h)
-			e.innerHTML = h;
+		// Find common ancestor and end points
+		ancestor = dom.findCommonAncestor(start, end);
+		startPoint = findEndPoint(start, ancestor) || start;
+		endPoint = findEndPoint(end, ancestor) || end;
+
+		// Process left leaf
+		for (n = start; n && n != startPoint; n = n.parentNode) {
+			for (sib = n.nextSibling; sib; sib = sib.nextSibling)
+				process(sib);
+		}
 
-		p.appendChild(e);
+		// Process middle from start to end point
+		if (startPoint != endPoint) {
+			for (n = startPoint.nextSibling; n && n != endPoint; n = n.nextSibling)
+				process(n);
+		} else
+			process(startPoint);
 
-		return this.element = e;
-	},
+		// Process right leaf
+		for (n = end; n && n != endPoint; n = n.parentNode) {
+			for (sib = n.previousSibling; sib; sib = sib.previousSibling)
+				process(sib);
+		}
+	};
 
-	exists : function() {
-		return this.doc.getElementById(this.id) != null;
-	},
+	tinymce.GlobalCommands.add('RemoveFormat', function() {
+		var ed = this, dom = ed.dom, s = ed.selection, r = s.getRng(1), nodes = [], bm, start, end, sc, so, ec, eo, n;
 
-	parseInt : function(s) {
-		if (s == null || s == '')
-			return 0;
+		function findFormatRoot(n) {
+			var sp;
 
-		return parseInt(s);
-	}
+			dom.getParent(n, function(n) {
+				if (dom.is(n, ed.getParam('removeformat_selector')))
+					sp = n;
 
-	};
+				return dom.isBlock(n);
+			}, ed.getBody());
 
-/* file:jscripts/tiny_mce/classes/TinyMCE_Menu.class.js */
+			return sp;
+		};
 
-function TinyMCE_Menu() {
-	var id;
+		function collect(n) {
+			if (dom.is(n, ed.getParam('removeformat_selector')))
+				nodes.push(n);
+		};
 
-	if (typeof(tinyMCE.menuCounter) == "undefined")
-		tinyMCE.menuCounter = 0;
+		function walk(n) {
+			collect(n);
+			tinymce.walk(n, collect, 'childNodes');
+		};
 
-	id = "mc_menu_" + tinyMCE.menuCounter++;
+		bm = s.getBookmark();
+		sc = r.startContainer;
+		ec = r.endContainer;
+		so = r.startOffset;
+		eo = r.endOffset;
+		sc = sc.nodeType == 1 ? sc.childNodes[Math.min(so, sc.childNodes.length - 1)] : sc;
+		ec = ec.nodeType == 1 ? ec.childNodes[Math.min(so == eo ? eo : eo - 1, ec.childNodes.length - 1)] : ec;
+
+		// Same container
+		if (sc == ec) { // TEXT_NODE
+			start = findFormatRoot(sc);
+
+			// Handle single text node
+			if (sc.nodeType == 3) {
+				if (start && start.nodeType == 1) { // ELEMENT
+					n = sc.splitText(so);
+					n.splitText(eo - so);
+					dom.split(start, n);
 
-	TinyMCE_Layer.call(this, id, true);
+					s.moveToBookmark(bm);
+				}
 
-	this.id = id;
-	this.items = new Array();
-	this.needsUpdate = true;
-};
+				return;
+			}
 
-TinyMCE_Menu.prototype = tinyMCE.extend(TinyMCE_Layer.prototype, {
-	init : function(s) {
-		var n;
-
-		// Default params
-		this.settings = {
-			separator_class : 'mceMenuSeparator',
-			title_class : 'mceMenuTitle',
-			disabled_class : 'mceMenuDisabled',
-			menu_class : 'mceMenu',
-			drop_menu : true
-		};
+			// Handle single element
+			walk(dom.split(start, sc) || sc);
+		} else {
+			// Find start/end format root
+			start = findFormatRoot(sc);
+			end = findFormatRoot(ec);
 
-		for (n in s)
-			this.settings[n] = s[n];
+			// Split start text node
+			if (start) {
+				if (sc.nodeType == 3) { // TEXT
+					// Since IE doesn't support white space nodes in the DOM we need to
+					// add this invisible character so that the splitText function can split the contents
+					if (so == sc.nodeValue.length)
+						sc.nodeValue += '\uFEFF'; // Yet another pesky IE fix
 
-		this.create('div', this.settings.menu_class);
-	},
+					sc = sc.splitText(so);
+				}
+			}
 
-	clear : function() {
-		this.items = new Array();
-	},
+			// Split end text node
+			if (end) {
+				if (ec.nodeType == 3) // TEXT
+					ec.splitText(eo);
+			}
 
-	addTitle : function(t) {
-		this.add({type : 'title', text : t});
-	},
+			// If the start and end format root is the same then we need to wrap
+			// the end node in a span since the split calls might change the reference
+			// Example: <p><b><em>x[yz<span>---</span>12]3</em></b></p>
+			if (start && start == end)
+				dom.replace(dom.create('span', {id : '__end'}, ec.cloneNode(true)), ec);
 
-	addDisabled : function(t) {
-		this.add({type : 'disabled', text : t});
-	},
+			// Split all start containers down to the format root
+			if (start)
+				start = dom.split(start, sc);
+			else
+				start = sc;
 
-	addSeparator : function() {
-		this.add({type : 'separator'});
-	},
+			// If there is a span wrapper use that one instead
+			if (n = dom.get('__end')) {
+				ec = n;
+				end = findFormatRoot(ec);
+			}
 
-	addItem : function(t, js) {
-		this.add({text : t, js : js});
-	},
+			// Split all end containers down to the format root
+			if (end)
+				end = dom.split(end, ec);
+			else
+				end = ec;
 
-	add : function(mi) {
-		this.items[this.items.length] = mi;
-		this.needsUpdate = true;
-	},
+			// Collect nodes in between
+			processRange(dom, start, end, collect);
 
-	update : function() {
-		var e = this.getElement(), h = '', i, t, m = this.items, s = this.settings;
+			// Remove invisible character for IE workaround if we find it
+			if (sc.nodeValue == '\uFEFF')
+				sc.nodeValue = '';
 
-		if (this.settings.drop_menu)
-			h += '<span class="mceMenuLine"></span>';
+			// Process start/end container elements
+			walk(ec);
+			walk(sc);
+		}
 
-		h += '<table border="0" cellpadding="0" cellspacing="0">';
+		// Remove all collected nodes
+		tinymce.each(nodes, function(n) {
+			dom.remove(n, 1);
+		});
 
-		for (i=0; i<m.length; i++) {
-			t = tinyMCE.xmlEncode(m[i].text);
-			c = m[i].class_name ? ' class="' + m[i].class_name + '"' : '';
+		// Remove leftover wrapper
+		dom.remove('__end', 1);
 
-			switch (m[i].type) {
-				case 'separator':
-					h += '<tr class="' + s.separator_class + '"><td>';
-					break;
+		s.moveToBookmark(bm);
+	});
+})(tinymce);
+(function(tinymce) {
+	tinymce.GlobalCommands.add('mceBlockQuote', function() {
+		var ed = this, s = ed.selection, dom = ed.dom, sb, eb, n, bm, bq, r, bq2, i, nl;
 
-				case 'title':
-					h += '<tr class="' + s.title_class + '"><td><span' + c +'>' + t + '</span>';
-					break;
+		function getBQ(e) {
+			return dom.getParent(e, function(n) {return n.nodeName === 'BLOCKQUOTE';});
+		};
 
-				case 'disabled':
-					h += '<tr class="' + s.disabled_class + '"><td><span' + c +'>' + t + '</span>';
-					break;
+		// Get start/end block
+		sb = dom.getParent(s.getStart(), dom.isBlock);
+		eb = dom.getParent(s.getEnd(), dom.isBlock);
+
+		// Remove blockquote(s)
+		if (bq = getBQ(sb)) {
+			if (sb != eb || sb.childNodes.length > 1 || (sb.childNodes.length == 1 && sb.firstChild.nodeName != 'BR'))
+				bm = s.getBookmark();
+
+			// Move all elements after the end block into new bq
+			if (getBQ(eb)) {
+				bq2 = bq.cloneNode(false);
+
+				while (n = eb.nextSibling)
+					bq2.appendChild(n.parentNode.removeChild(n));
+			}
+
+			// Add new bq after
+			if (bq2)
+				dom.insertAfter(bq2, bq);
+
+			// Move all selected blocks after the current bq
+			nl = s.getSelectedBlocks(sb, eb);
+			for (i = nl.length - 1; i >= 0; i--) {
+				dom.insertAfter(nl[i], bq);
+			}
+
+			// Empty bq, then remove it
+			if (/^\s*$/.test(bq.innerHTML))
+				dom.remove(bq, 1); // Keep children so boomark restoration works correctly
+
+			// Empty bq, then remote it
+			if (bq2 && /^\s*$/.test(bq2.innerHTML))
+				dom.remove(bq2, 1); // Keep children so boomark restoration works correctly
+
+			if (!bm) {
+				// Move caret inside empty block element
+				if (!tinymce.isIE) {
+					r = ed.getDoc().createRange();
+					r.setStart(sb, 0);
+					r.setEnd(sb, 0);
+					s.setRng(r);
+				} else {
+					s.select(sb);
+					s.collapse(0);
 
-				default:
-					h += '<tr><td><a href="#" onclick="return tinyMCE.cancelEvent(event);" onmousedown="return tinyMCE.cancelEvent(event);" onmouseup="' + tinyMCE.xmlEncode(m[i].js) + ';return tinyMCE.cancelEvent(event);"><span' + c +'>' + t + '</span></a>';
-			}
+					// IE misses the empty block some times element so we must move back the caret
+					if (dom.getParent(s.getStart(), dom.isBlock) != sb) {
+						r = s.getRng();
+						r.move('character', -1);
+						r.select();
+					}
+				}
+			} else
+				ed.selection.moveToBookmark(bm);
 
-			h += '</td></tr>';
+			return;
 		}
 
-		h += '</table>';
+		// Since IE can start with a totally empty document we need to add the first bq and paragraph
+		if (tinymce.isIE && !sb && !eb) {
+			ed.getDoc().execCommand('Indent');
+			n = getBQ(s.getNode());
+			n.style.margin = n.dir = ''; // IE adds margin and dir to bq
+			return;
+		}
 
-		e.innerHTML = h;
+		if (!sb || !eb)
+			return;
 
-		this.needsUpdate = false;
-		this.updateBlocker();
-	},
+		// If empty paragraph node then do not use bookmark
+		if (sb != eb || sb.childNodes.length > 1 || (sb.childNodes.length == 1 && sb.firstChild.nodeName != 'BR'))
+			bm = s.getBookmark();
+
+		// Move selected block elements into a bq
+		tinymce.each(s.getSelectedBlocks(getBQ(s.getStart()), getBQ(s.getEnd())), function(e) {
+			// Found existing BQ add to this one
+			if (e.nodeName == 'BLOCKQUOTE' && !bq) {
+				bq = e;
+				return;
+			}
 
-	show : function() {
-		var nl, i;
+			// No BQ found, create one
+			if (!bq) {
+				bq = dom.create('blockquote');
+				e.parentNode.insertBefore(bq, e);
+			}
 
-		if (tinyMCE.lastMenu == this)
-			return;
+			// Add children from existing BQ
+			if (e.nodeName == 'BLOCKQUOTE' && bq) {
+				n = e.firstChild;
 
-		if (this.needsUpdate)
-			this.update();
+				while (n) {
+					bq.appendChild(n.cloneNode(true));
+					n = n.nextSibling;
+				}
 
-		if (tinyMCE.lastMenu && tinyMCE.lastMenu != this)
-			tinyMCE.lastMenu.hide();
+				dom.remove(e);
+				return;
+			}
 
-		TinyMCE_Layer.prototype.show.call(this);
+			// Add non BQ element to BQ
+			bq.appendChild(dom.remove(e));
+		});
 
-		if (!tinyMCE.isOpera) {
-			// Accessibility stuff
-/*			nl = this.getElement().getElementsByTagName("a");
-			if (nl.length > 0)
-				nl[0].focus();*/
-		}
+		if (!bm) {
+			// Move caret inside empty block element
+			if (!tinymce.isIE) {
+				r = ed.getDoc().createRange();
+				r.setStart(sb, 0);
+				r.setEnd(sb, 0);
+				s.setRng(r);
+			} else {
+				s.select(sb);
+				s.collapse(1);
+			}
+		} else
+			s.moveToBookmark(bm);
+	});
+})(tinymce);
+(function(tinymce) {
+	tinymce.each(['Cut', 'Copy', 'Paste'], function(cmd) {
+		tinymce.GlobalCommands.add(cmd, function() {
+			var ed = this, doc = ed.getDoc();
 
-		tinyMCE.lastMenu = this;
-	}
+			try {
+				doc.execCommand(cmd, false, null);
 
+				// On WebKit the command will just be ignored if it's not enabled
+				if (!doc.queryCommandSupported(cmd))
+					throw 'Error';
+			} catch (ex) {
+				ed.windowManager.alert(ed.getLang('clipboard_no_support'));
+			}
+		});
 	});
+})(tinymce);
+(function(tinymce) {
+	tinymce.GlobalCommands.add('InsertHorizontalRule', function() {
+		if (tinymce.isOpera)
+			return this.getDoc().execCommand('InsertHorizontalRule', false, '');
 
-/* file:jscripts/tiny_mce/classes/TinyMCE_Compatibility.class.js */
-
-if (!Function.prototype.call) {
-	Function.prototype.call = function() {
-		var a = arguments, s = a[0], i, as = '', r, o;
-
-		for (i=1; i<a.length; i++)
-			as += (i > 1 ? ',' : '') + 'a[' + i + ']';
-
-		o = s._fu;
-		s._fu = this;
-		r = eval('s._fu(' + as + ')');
-		s._fu = o;
+		this.selection.setContent('<hr />');
+	});
+})(tinymce);
+(function() {
+	var cmds = tinymce.GlobalCommands;
 
-		return r;
-	};
-};
+	cmds.add(['mceEndUndoLevel', 'mceAddUndoLevel'], function() {
+		this.undoManager.add();
+	});
 
-/* file:jscripts/tiny_mce/classes/TinyMCE_Debug.class.js */
+	cmds.add('Undo', function() {
+		var ed = this;
 
-TinyMCE_Engine.prototype.debug = function() {
-	var m = "", a, i, l = tinyMCE.log.length;
+		if (ed.settings.custom_undo_redo) {
+			ed.undoManager.undo();
+			ed.nodeChanged();
+			return true;
+		}
 
-	for (i=0, a = this.debug.arguments; i<a.length; i++) {
-		m += a[i];
+		return false; // Run browser command
+	});
 
-		if (i<a.length-1)
-			m += ', ';
-	}
+	cmds.add('Redo', function() {
+		var ed = this;
 
-	if (l < 1000)
-		tinyMCE.log[l] = "[debug] " + m;
-};
+		if (ed.settings.custom_undo_redo) {
+			ed.undoManager.redo();
+			ed.nodeChanged();
+			return true;
+		}
 
+		return false; // Run browser command
+	});
+})();
diff -x .svn -aruN 0.7.15.src/e107_handlers/tiny_mce/utils/editable_selects.js 0.7.16.src/e107_handlers/tiny_mce/utils/editable_selects.js
--- 0.7.15.src/e107_handlers/tiny_mce/utils/editable_selects.js	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_handlers/tiny_mce/utils/editable_selects.js	2009-06-30 19:36:50.000000000 -0500
@@ -1,10 +1,10 @@
 /**
- * $Id: editable_selects.js,v 1.2 2006/10/27 22:36:57 e107coders Exp $
+ * $Id: editable_selects.js,v 1.3 2009/07/01 00:37:14 e107coders Exp $
  *
  * Makes select boxes editable.
  *
  * @author Moxiecode
- * @copyright Copyright  2004-2006, Moxiecode Systems AB, All rights reserved.
+ * @copyright Copyright  2004-2008, Moxiecode Systems AB, All rights reserved.
  */
 
 var TinyMCE_EditableSelects = {
@@ -20,13 +20,13 @@
 				o.className = 'mceAddSelectValue';
 
 				nl[i].options[nl[i].options.length] = o;
-				nl[i].setAttribute('onchange', 'TinyMCE_EditableSelects.onChangeEditableSelect(this);');
+				nl[i].onchange = TinyMCE_EditableSelects.onChangeEditableSelect;
 			}
 		}
 	},
 
-	onChangeEditableSelect : function(se) {
-		var d = document, ne;
+	onChangeEditableSelect : function(e) {
+		var d = document, ne, se = window.event ? window.event.srcElement : e.target;
 
 		if (se.options[se.selectedIndex].value == '__mce_add_custom__') {
 			ne = d.createElement("input");
@@ -34,11 +34,12 @@
 			ne.name = se.name + "_custom";
 			ne.type = "text";
 
-			ne.style.width = se.clientWidth;
+			ne.style.width = se.offsetWidth + 'px';
 			se.parentNode.insertBefore(ne, se);
 			se.style.display = 'none';
 			ne.focus();
 			ne.onblur = TinyMCE_EditableSelects.onBlurEditableSelectInput;
+			ne.onkeydown = TinyMCE_EditableSelects.onKeyDown;
 			TinyMCE_EditableSelects.editSelectElm = se;
 		}
 	},
@@ -57,5 +58,12 @@
 			se.parentNode.removeChild(se.previousSibling);
 			TinyMCE_EditableSelects.editSelectElm = null;
 		}
+	},
+
+	onKeyDown : function(e) {
+		e = e || window.event;
+
+		if (e.keyCode == 13)
+			TinyMCE_EditableSelects.onBlurEditableSelectInput();
 	}
 };
diff -x .svn -aruN 0.7.15.src/e107_handlers/tiny_mce/utils/form_utils.js 0.7.16.src/e107_handlers/tiny_mce/utils/form_utils.js
--- 0.7.15.src/e107_handlers/tiny_mce/utils/form_utils.js	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_handlers/tiny_mce/utils/form_utils.js	2009-06-30 19:36:50.000000000 -0500
@@ -1,33 +1,23 @@
 /**
- * $Id: form_utils.js,v 1.6 2006/10/27 22:36:57 e107coders Exp $
+ * $Id: form_utils.js,v 1.7 2009/07/01 00:37:14 e107coders Exp $
  *
  * Various form utilitiy functions.
  *
  * @author Moxiecode
- * @copyright Copyright  2004-2006, Moxiecode Systems AB, All rights reserved.
+ * @copyright Copyright  2004-2008, Moxiecode Systems AB, All rights reserved.
  */
 
-var themeBaseURL = tinyMCE.baseURL + '/themes/' + tinyMCE.getParam("theme");
+var themeBaseURL = tinyMCEPopup.editor.baseURI.toAbsolute('themes/' + tinyMCEPopup.getParam("theme"));
 
 function getColorPickerHTML(id, target_form_element) {
 	var h = "";
 
-	h += '<a id="' + id + '_link" href="javascript:void(0);" onkeydown="pickColor(event,\'' + target_form_element +'\');" onmousedown="pickColor(event,\'' + target_form_element +'\');return false;">';
-	h += '<img id="' + id + '" src="' + themeBaseURL + '/images/color.gif"';
-	h += ' onmouseover="this.className=\'mceButtonOver\'"';
-	h += ' onmouseout="this.className=\'mceButtonNormal\'"';
-	h += ' onmousedown="this.className=\'mceButtonDown\'"';
-	h += ' width="20" height="16" border="0" title="' + tinyMCE.getLang('lang_browse') + '"';
-	h += ' class="mceButtonNormal" alt="' + tinyMCE.getLang('lang_browse') + '" /></a>';
+	h += '<a id="' + id + '_link" href="javascript:;" onclick="tinyMCEPopup.pickColor(event,\'' + target_form_element +'\');" onmousedown="return false;" class="pickcolor">';
+	h += '<span id="' + id + '" title="' + tinyMCEPopup.getLang('browse') + '">&nbsp;</span></a>';
 
 	return h;
 }
 
-function pickColor(e, target_form_element) {
-	if ((e.keyCode == 32 || e.keyCode == 13) || e.type == "mousedown")
-		tinyMCEPopup.pickColor(e, target_form_element);
-}
-
 function updateColor(img_id, form_element_id) {
 	document.getElementById(img_id).style.backgroundColor = document.forms[0].elements[form_element_id].value;
 }
@@ -40,34 +30,32 @@
 		if (state) {
 			lnk.setAttribute("realhref", lnk.getAttribute("href"));
 			lnk.removeAttribute("href");
-			tinyMCE.switchClass(img, 'mceButtonDisabled', true);
+			tinyMCEPopup.dom.addClass(img, 'disabled');
 		} else {
-			lnk.setAttribute("href", lnk.getAttribute("realhref"));
-			tinyMCE.switchClass(img, 'mceButtonNormal', false);
+			if (lnk.getAttribute("realhref"))
+				lnk.setAttribute("href", lnk.getAttribute("realhref"));
+
+			tinyMCEPopup.dom.removeClass(img, 'disabled');
 		}
 	}
 }
 
 function getBrowserHTML(id, target_form_element, type, prefix) {
-	var option = prefix + "_" + type + "_browser_callback";
-	var cb = tinyMCE.getParam(option, tinyMCE.getParam("file_browser_callback"));
-	if (cb == null)
-		return "";
+	var option = prefix + "_" + type + "_browser_callback", cb, html;
 
-	var html = "";
+	cb = tinyMCEPopup.getParam(option, tinyMCEPopup.getParam("file_browser_callback"));
 
-	html += '<a id="' + id + '_link" href="javascript:openBrower(\'' + id + '\',\'' + target_form_element + '\', \'' + type + '\',\'' + option + '\');" onmousedown="return false;">';
-	html += '<img id="' + id + '" src="' + themeBaseURL + '/images/browse.gif"';
-	html += ' onmouseover="this.className=\'mceButtonOver\';"';
-	html += ' onmouseout="this.className=\'mceButtonNormal\';"';
-	html += ' onmousedown="this.className=\'mceButtonDown\';"';
-	html += ' width="20" height="18" border="0" title="' + tinyMCE.getLang('lang_browse') + '"';
-	html += ' class="mceButtonNormal" alt="' + tinyMCE.getLang('lang_browse') + '" /></a>';
+	if (!cb)
+		return "";
+
+	html = "";
+	html += '<a id="' + id + '_link" href="javascript:openBrowser(\'' + id + '\',\'' + target_form_element + '\', \'' + type + '\',\'' + option + '\');" onmousedown="return false;" class="browse">';
+	html += '<span id="' + id + '" title="' + tinyMCEPopup.getLang('browse') + '">&nbsp;</span></a>';
 
 	return html;
 }
 
-function openBrower(img_id, target_form_element, type, option) {
+function openBrowser(img_id, target_form_element, type, option) {
 	var img = document.getElementById(img_id);
 
 	if (img.className != "mceButtonDisabled")
@@ -119,8 +107,8 @@
 function addClassesToList(list_id, specific_option) {
 	// Setup class droplist
 	var styleSelectElm = document.getElementById(list_id);
-	var styles = tinyMCE.getParam('theme_advanced_styles', false);
-	styles = tinyMCE.getParam(specific_option, styles);
+	var styles = tinyMCEPopup.getParam('theme_advanced_styles', false);
+	styles = tinyMCEPopup.getParam(specific_option, styles);
 
 	if (styles) {
 		var stylesAr = styles.split(';');
@@ -136,10 +124,9 @@
 			}
 		}
 	} else {
-		// Use auto impored classes
-		var csses = tinyMCE.getCSSClasses(tinyMCE.getWindowArg('editor_id'));
-		for (var i=0; i<csses.length; i++)
-			styleSelectElm.options[styleSelectElm.length] = new Option(csses[i], csses[i]);
+		tinymce.each(tinyMCEPopup.editor.dom.getClasses(), function(o) {
+			styleSelectElm.options[styleSelectElm.length] = new Option(o.title || o['class'], o['class']);
+		});
 	}
 }
 
@@ -183,7 +170,7 @@
 }
 
 function trimSize(size) {
-	return size.replace(new RegExp('[^0-9%]', 'gi'), '');
+	return size.replace(/([0-9\.]+)px|(%|in|cm|mm|em|ex|pt|pc)/, '$1$2');
 }
 
 function getCSSSize(size) {
@@ -192,11 +179,15 @@
 	if (size == "")
 		return "";
 
-	return size.indexOf('%') != -1 ? size : size + "px";
+	// Add px
+	if (/^[0-9]+$/.test(size))
+		size += 'px';
+
+	return size;
 }
 
 function getStyle(elm, attrib, style) {
-	var val = tinyMCE.getAttrib(elm, attrib);
+	var val = tinyMCEPopup.dom.getAttrib(elm, attrib);
 
 	if (val != '')
 		return '' + val;
@@ -204,7 +195,5 @@
 	if (typeof(style) == 'undefined')
 		style = attrib;
 
-	val = eval('elm.style.' + style);
-
-	return val == null ? '' : '' + val;
+	return tinyMCEPopup.dom.getStyle(elm, style);
 }
diff -x .svn -aruN 0.7.15.src/e107_handlers/tiny_mce/utils/mctabs.js 0.7.16.src/e107_handlers/tiny_mce/utils/mctabs.js
--- 0.7.15.src/e107_handlers/tiny_mce/utils/mctabs.js	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_handlers/tiny_mce/utils/mctabs.js	2009-06-30 19:36:50.000000000 -0500
@@ -1,14 +1,14 @@
 /**
- * $Id: mctabs.js,v 1.6 2006/10/27 22:36:57 e107coders Exp $
+ * $Id: mctabs.js,v 1.7 2009/07/01 00:37:14 e107coders Exp $
  *
  * Moxiecode DHTML Tabs script.
  *
  * @author Moxiecode
- * @copyright Copyright  2004-2006, Moxiecode Systems AB, All rights reserved.
+ * @copyright Copyright  2004-2008, Moxiecode Systems AB, All rights reserved.
  */
 
 function MCTabs() {
-	this.settings = new Array();
+	this.settings = [];
 };
 
 MCTabs.prototype.init = function(settings) {
@@ -28,17 +28,19 @@
 };
 
 MCTabs.prototype.displayTab = function(tab_id, panel_id) {
-	var panelElm = document.getElementById(panel_id);
-	var panelContainerElm = panelElm ? panelElm.parentNode : null;
-	var tabElm = document.getElementById(tab_id);
-	var tabContainerElm = tabElm ? tabElm.parentNode : null;
-	var selectionClass = this.getParam('selection_class', 'current');
+	var panelElm, panelContainerElm, tabElm, tabContainerElm, selectionClass, nodes, i;
+
+	panelElm= document.getElementById(panel_id);
+	panelContainerElm = panelElm ? panelElm.parentNode : null;
+	tabElm = document.getElementById(tab_id);
+	tabContainerElm = tabElm ? tabElm.parentNode : null;
+	selectionClass = this.getParam('selection_class', 'current');
 
 	if (tabElm && tabContainerElm) {
-		var nodes = tabContainerElm.childNodes;
+		nodes = tabContainerElm.childNodes;
 
 		// Hide all other tabs
-		for (var i=0; i<nodes.length; i++) {
+		for (i = 0; i < nodes.length; i++) {
 			if (nodes[i].nodeName == "LI")
 				nodes[i].className = '';
 		}
@@ -48,10 +50,10 @@
 	}
 
 	if (panelElm && panelContainerElm) {
-		var nodes = panelContainerElm.childNodes;
+		nodes = panelContainerElm.childNodes;
 
 		// Hide all other panels
-		for (var i=0; i<nodes.length; i++) {
+		for (i = 0; i < nodes.length; i++) {
 			if (nodes[i].nodeName == "DIV")
 				nodes[i].className = 'panel';
 		}
diff -x .svn -aruN 0.7.15.src/e107_handlers/tiny_mce/utils/validate.js 0.7.16.src/e107_handlers/tiny_mce/utils/validate.js
--- 0.7.15.src/e107_handlers/tiny_mce/utils/validate.js	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_handlers/tiny_mce/utils/validate.js	2009-06-30 19:36:50.000000000 -0500
@@ -1,10 +1,10 @@
 /**
- * $Id: validate.js,v 1.6 2006/10/27 22:36:57 e107coders Exp $
+ * $Id: validate.js,v 1.7 2009/07/01 00:37:14 e107coders Exp $
  *
  * Various form validation methods.
  *
  * @author Moxiecode
- * @copyright Copyright  2004-2006, Moxiecode Systems AB, All rights reserved.
+ * @copyright Copyright  2004-2008, Moxiecode Systems AB, All rights reserved.
  */
 
 /**
@@ -31,7 +31,7 @@
 	},
 
 	isSize : function(s) {
-		return this.test(s, '^[0-9]+(px|%)?$');
+		return this.test(s, '^[0-9]+(%|in|cm|mm|em|ex|pt|pc|px)?$');
 	},
 
 	isId : function(s) {
@@ -110,7 +110,7 @@
 	},
 
 	reset : function(e) {
-		var t = new Array('label', 'input', 'select', 'textarea');
+		var t = ['label', 'input', 'select', 'textarea'];
 		var i, j, nl, s = this.settings;
 
 		if (e == null)
diff -x .svn -aruN 0.7.15.src/e107_handlers/tiny_mce/wysiwyg.php 0.7.16.src/e107_handlers/tiny_mce/wysiwyg.php
--- 0.7.15.src/e107_handlers/tiny_mce/wysiwyg.php	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_handlers/tiny_mce/wysiwyg.php	2009-08-31 19:03:41.000000000 -0500
@@ -4,14 +4,14 @@
 |     e107 website system - Tiny MCE controller file.
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_handlers/tiny_mce/wysiwyg.php,v $
-|     $Revision: 1.36 $
-|     $Date: 2008/05/31 17:55:18 $
-|     $Author: e107steved $
+|     $Revision: 1.39 $
+|     $Date: 2009/09/01 00:04:05 $
+|     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
 
-function wysiwyg($formids){
-define("ADMIN","");
+function wysiwyg($formids)
+{
 global $pref,$HANDLERS_DIRECTORY,$PLUGINS_DIRECTORY,$IMAGES_DIRECTORY;
 $lang = e_LANGUAGE;
 $tinylang = array(
@@ -54,7 +54,7 @@
 
 $text .= ($pref['smiley_activate']) ? ",emoticons" : "";
 $text .= (ADMIN) ? ",ibrowser" : ",image";
-$text .= ",iespell,zoom,media";
+$text .= ",iespell,zoom,media,compat2x";
 $text .= "'\n"; // end of plugins list.
 
 $text .= ",theme_advanced_buttons1 : 'fontsizeselect,separator,bold,italic,underline,separator,justifyleft,justifycenter,justifyright,justifyfull,separator,bullist,numlist,outdent, indent,separator, forecolor,cut,copy,paste'";
@@ -68,7 +68,7 @@
 
 $text .= ",theme_advanced_buttons3 : ''";
 $text .= ",theme_advanced_toolbar_location : 'top'";
-$text .= ",extended_valid_elements : 'p[style],a[name|href|target|rel|title|style|class],img[class|src|style|alt|title|name],hr[class],span[align|class|style],div[align|class|style|height|width] ,table[class|style|cellpadding|cellspacing|background|height|width],td[background|style|class|valign|align|height|width]'";
+$text .= ",extended_valid_elements : ''\n";
 $text .= ",invalid_elements: 'p,font,align,script,applet,iframe'\n";
 $text .= ",auto_cleanup_word: true\n";
 $text .= ",convert_fonts_to_spans : true\n";
diff -x .svn -aruN 0.7.15.src/e107_handlers/traffic_class.php 0.7.16.src/e107_handlers/traffic_class.php
--- 0.7.15.src/e107_handlers/traffic_class.php	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_handlers/traffic_class.php	2009-08-19 06:16:44.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_handlers/traffic_class.php,v $
-|     $Revision: 1.10 $
-|     $Date: 2006/10/21 11:18:00 $
-|     $Author: mrpete $
+|     $Revision: 1.11 $
+|     $Date: 2009/08/19 11:17:08 $
+|     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
 
@@ -167,7 +167,8 @@
 	}
 
 	function Display() {
-		if (!defined("E107_DBG_TRAFFIC") || !E107_DBG_TRAFFIC) {
+		if (!defined("E107_DBG_TRAFFIC") || !E107_DBG_TRAFFIC || E107_DBG_BASIC)   // 'Basic' should not display Traffic. 
+		 {
 			return '';
 		}
 
diff -x .svn -aruN 0.7.15.src/e107_handlers/userclass_class.php 0.7.16.src/e107_handlers/userclass_class.php
--- 0.7.15.src/e107_handlers/userclass_class.php	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_handlers/userclass_class.php	2009-08-15 06:54:06.000000000 -0500
@@ -11,16 +11,15 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_handlers/userclass_class.php,v $
-|     $Revision: 1.22 $
-|     $Date: 2008/04/25 19:39:47 $
-|     $Author: e107steved $
+|     $Revision: 1.23 $
+|     $Date: 2009/08/15 11:54:30 $
+|     $Author: marj_nl_fr $
 +----------------------------------------------------------------------------+
 */
 
 if (!defined('e107_INIT')) { exit; }
 
-@include_once(e_LANGUAGEDIR.e_LANGUAGE."/lan_userclass.php");
-@include_once(e_LANGUAGEDIR."English/lan_userclass.php");
+include_lan(e_LANGUAGEDIR.e_LANGUAGE."/lan_userclass.php");
 
 /*
 With $optlist you can now specify which classes are shown in the dropdown.
diff -x .svn -aruN 0.7.15.src/e107_handlers/xml_class.php 0.7.16.src/e107_handlers/xml_class.php
--- 0.7.15.src/e107_handlers/xml_class.php	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_handlers/xml_class.php	2009-09-03 08:29:37.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_handlers/xml_class.php,v $
-|     $Revision: 1.8 $
-|     $Date: 2007/01/24 21:21:20 $
-|     $Author: e107steved $
+|     $Revision: 1.9 $
+|     $Date: 2009/09/03 13:30:01 $
+|     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
 
@@ -31,55 +31,83 @@
 	var $xmlFileContents;
 
 
-	function getRemoteXmlFile($address)
+    function getRemoteXmlFile($address, $timeout = 10)
 	{
-		if(function_exists("curl_init"))
+		// Could do something like: if ($timeout <= 0) $timeout = $pref['get_remote_timeout'];  here
+		$timeout = min($timeout, 120);
+		$timeout = max($timeout, 3);
+		$address = str_replace(array("\r", "\n", "\t"), '', $address); // May be paranoia, but streaky thought it might be a good idea
+		// ... and there shouldn't be unprintable characters in the URL anyway
+		if (function_exists('file_get_contents'))
 		{
-			$cu = curl_init (); 
+			$old_timeout = e107_ini_set('default_socket_timeout', $timeout);
+			$data = file_get_contents(urlencode($address));
+
+			// $data = file_get_contents(htmlspecialchars($address));	// buggy - sometimes fails.
+			if ($old_timeout !== FALSE)
+			{
+				e107_ini_set('default_socket_timeout', $old_timeout);
+			}
+			if ($data)
+			{
+				return $data;
+			}
+		}
+		if (function_exists("curl_init"))
+		{
+			$cu = curl_init();
 			curl_setopt($cu, CURLOPT_URL, $address);
 			curl_setopt($cu, CURLOPT_RETURNTRANSFER, 1);
-			curl_setopt ($cu, CURLOPT_HEADER, 0);
-			curl_setopt ($cu, CURLOPT_TIMEOUT, 10);
-			$this -> xmlFileContents = curl_exec($cu);
+			curl_setopt($cu, CURLOPT_HEADER, 0);
+			curl_setopt($cu, CURLOPT_TIMEOUT, $timeout);
+			$this->xmlFileContents = curl_exec($cu);
 			if (curl_error($cu))
 			{
-				$this -> error =  "Error: ".curl_errno($cu).", ".curl_error($cu);
+				$this->error = "Curl error: ".curl_errno($cu).", ".curl_error($cu);
 				return FALSE;
 			}
-			curl_close ($cu);
-			return $this -> xmlFileContents;
+			curl_close($cu);
+			return $this->xmlFileContents;
 		}
-
-		if(ini_get("allow_url_fopen"))
+		if (ini_get("allow_url_fopen"))
 		{
-			if(!$remote = @fopen ($address, "r"))
+			$old_timeout = e107_ini_set('default_socket_timeout', $timeout);
+			$remote = @fopen($address, "r");
+			if (!$remote)
 			{
-				$this -> error = "Unable to open remote XML file.";
+				$this->error = "fopen: Unable to open remote XML file: ".$address;
 				return FALSE;
 			}
 		}
 		else
 		{
+			$old_timeout = $timeout;
 			$tmp = parse_url($address);
-			if(!$remote = fsockopen ($tmp['host'], 80 ,$errno, $errstr, 10))
+			if (!$remote = fsockopen($tmp['host'], 80, $errno, $errstr, $timeout))
 			{
-				$this -> error = "Unable to open remote XML file.";
+				$this->error = "Sockets: Unable to open remote XML file: ".$address;
 				return FALSE;
 			}
 			else
 			{
-				socket_set_timeout($remote, 10);
-				fputs($remote, "GET ".$headline_url." HTTP/1.0\r\n\r\n");
+				socket_set_timeout($remote, $timeout);
+				fputs($remote, "GET ".urlencode($address)." HTTP/1.0\r\n\r\n");
 			}
 		}
-
-		$this -> xmlFileContents = "";
+		$this->xmlFileContents = "";
 		while (!feof($remote))
 		{
-			$this -> xmlFileContents .= fgets ($remote, 4096);
+			$this->xmlFileContents .= fgets($remote, 4096);
+		}
+		fclose($remote);
+		if ($old_timeout != $timeout)
+		{
+			if ($old_timeout !== FALSE)
+			{
+				e107_ini_set('default_socket_timeout', $old_timeout);
+			}
 		}
-		fclose ($remote);
-		return $this -> xmlFileContents;
+		return $this->xmlFileContents;
 	}
 
 
diff -x .svn -aruN 0.7.15.src/e107_languages/English/admin/lan_administrator.php 0.7.16.src/e107_languages/English/admin/lan_administrator.php
--- 0.7.15.src/e107_languages/English/admin/lan_administrator.php	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_languages/English/admin/lan_administrator.php	2009-07-18 10:53:18.000000000 -0500
@@ -4,9 +4,9 @@
 |     e107 website system - Language File.
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_languages/English/admin/lan_administrator.php,v $
-|     $Revision: 1.16 $
-|     $Date: 2006/11/10 15:59:14 $
-|     $Author: mcfly_e107 $
+|     $Revision: 1.17 $
+|     $Date: 2009/07/18 15:53:42 $
+|     $Author: marj_nl_fr $
 +----------------------------------------------------------------------------+
 */
 define("ADMSLAN_0", "New user/admin entry created for");
@@ -45,9 +45,9 @@
 // define("ADMSLAN_38", "Moderate/configure chatbox");
 define("ADMSLAN_39", "Post news");
 define("ADMSLAN_40", "Post links");
-define("ADMSLAN_41", "Post articles");
-define("ADMSLAN_42", "Post reviews");
-define("ADMSLAN_43", "Post content pages");
+//obsolete 	define("ADMSLAN_41", "Post articles");
+//obsolete 	define("ADMSLAN_42", "Post reviews");
+//obsolete - use in v0.8: Configure URLs	 define("ADMSLAN_43", "Post content pages");
 define("ADMSLAN_44", "Post downloads");
 define("ADMSLAN_45", "Post polls");
 define("ADMSLAN_46", "Welcome message");
diff -x .svn -aruN 0.7.15.src/e107_languages/English/admin/lan_admin.php 0.7.16.src/e107_languages/English/admin/lan_admin.php
--- 0.7.15.src/e107_languages/English/admin/lan_admin.php	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_languages/English/admin/lan_admin.php	2009-07-18 10:53:18.000000000 -0500
@@ -4,9 +4,9 @@
 |     e107 website system - Language File.
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_languages/English/admin/lan_admin.php,v $
-|     $Revision: 1.60 $
-|     $Date: 2008/06/29 15:23:37 $
-|     $Author: e107steved $
+|     $Revision: 1.61 $
+|     $Date: 2009/07/18 15:53:42 $
+|     $Author: marj_nl_fr $
 +----------------------------------------------------------------------------+
 */
 define("ADLAN_0", "News");
@@ -194,7 +194,7 @@
 define("ADLAN_LAT_7", "File uploads");
 define("ADLAN_LAT_8", "There are unmoderated administrator messages");
 
-define("ADLAN_ERR_1", "Warning!");
+//LAN_WARNING define("ADLAN_ERR_1", "Warning!");
 define("ADLAN_ERR_2", "There are files on your server that are known to be exploitable. These must be removed <b>immediately</b>. The files are related to the older 0.6xx branch of e107. Please delete the following directories and all their contents:");
 define("ADLAN_ERR_3", "There are one or more files in your public upload directories that are not in your allowed upload filetypes list. These may have been placed here by an attacker and if so should be removed <b>immediately</b>. You should <b>not</b> open these files as this may execute any malicious code the file might contain; i.e. do not open them with your browser.<br /><br />If you recognise these files as being legitimate, it is likely that due to the recent allowed filetypes changes, the filetype you allowed is no longer in the allowed filetypes list and you will need to re-add it (see admin => uploads). You should not allow the upload of .html, .txt, etc as an attacker may upload a file of this type which includes malicious javascript. You should also, of course, not allow the upload of .php files or any other type of executable script.<br /><br />Below is the list of files that could potentially be malicious:");
 define("ADLAN_ERR_4", "Deprecated plugin file(s) found");
@@ -275,4 +275,4 @@
 define("LAN_NEWVERSION","New Version Available");
 
 
-?>
+?>
\ No newline at end of file
diff -x .svn -aruN 0.7.15.src/e107_languages/English/admin/lan_banlist.php 0.7.16.src/e107_languages/English/admin/lan_banlist.php
--- 0.7.15.src/e107_languages/English/admin/lan_banlist.php	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_languages/English/admin/lan_banlist.php	2009-02-03 15:16:05.000000000 -0600
@@ -4,8 +4,8 @@
 |     e107 website system - Language File.
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_languages/English/admin/lan_banlist.php,v $
-|     $Revision: 1.8 $
-|     $Date: 2007/02/11 10:33:58 $
+|     $Revision: 1.9 $
+|     $Date: 2009/02/03 21:16:29 $
 |     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
@@ -21,5 +21,6 @@
 define("BANLAN_11", "Auto-ban: More than 10 failed login attempts");
 define("BANLAN_12", "Note: Reverse DNS is currently disabled, it must be enabled to allow banning by host.  Banning by IP and email will still function normally.");
 define("BANLAN_13", "Note: To ban a user by user name, go to the users admin page: ");
+define('BANLAN_78','Hit count exceeded (--HITS-- requests within allotted time)');
 
 ?>
\ No newline at end of file
diff -x .svn -aruN 0.7.15.src/e107_languages/English/admin/lan_check_user.php 0.7.16.src/e107_languages/English/admin/lan_check_user.php
--- 0.7.15.src/e107_languages/English/admin/lan_check_user.php	1969-12-31 18:00:00.000000000 -0600
+++ 0.7.16.src/e107_languages/English/admin/lan_check_user.php	2009-01-06 14:57:44.000000000 -0600
@@ -0,0 +1,34 @@
+<?php
+/*
++ ----------------------------------------------------------------------------+
+|     e107 website system - Language File.
+|
+|     $Source: /cvsroot/e107/e107_0.7/e107_languages/English/admin/lan_check_user.php,v $
+|     $Revision: 1.2 $
+|     $Date: 2009/01/06 20:58:08 $
+|     $Author: e107steved $
++----------------------------------------------------------------------------+
+*/
+
+define('LAN_CKUSER_01','Check user database');
+define('LAN_CKUSER_02','This will check for various potential problems with your user database');
+define('LAN_CKUSER_03','If you have a lot of users, it may take some time, or even time out');
+define('LAN_CKUSER_04','Proceed');
+define('LAN_CKUSER_05','Check for duplicate login names');
+define('LAN_CKUSER_06','Select functions to perform');
+define('LAN_CKUSER_07','Duplicate User Names found');
+define('LAN_CKUSER_08','No duplicates found');
+define('LAN_CKUSER_09','User Name');
+define('LAN_CKUSER_10','User ID');
+define('LAN_CKUSER_11','Display Name');
+define('LAN_CKUSER_12','Check for duplicate email addresses');
+define('LAN_CKUSER_13','Duplicate email addresses found');
+define('LAN_CKUSER_14','Email address');
+define('LAN_CKUSER_15','No duplicates found');
+define('LAN_CKUSER_16','Find entries where user name is someone else\'s login name');
+define('LAN_CKUSER_17','Conflicting user name and login name');
+define('LAN_CKUSER_18','User A');
+define('LAN_CKUSER_19','User B');
+define('LAN_CKUSER_20','');
+
+?>
\ No newline at end of file
diff -x .svn -aruN 0.7.15.src/e107_languages/English/admin/lan_db.php 0.7.16.src/e107_languages/English/admin/lan_db.php
--- 0.7.15.src/e107_languages/English/admin/lan_db.php	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_languages/English/admin/lan_db.php	2009-01-04 03:34:54.000000000 -0600
@@ -4,8 +4,8 @@
 |     e107 website system - Language File.
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_languages/English/admin/lan_db.php,v $
-|     $Revision: 1.7 $
-|     $Date: 2007/02/14 21:17:42 $
+|     $Revision: 1.8 $
+|     $Date: 2009/01/04 09:35:18 $
 |     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
@@ -43,6 +43,8 @@
 define("DBLAN_32", "Error");
 define("DBLAN_33", "Inaccessible");
 define("DBLAN_34", "Not checked");
+define('DBLAN_35', 'Click button to check validity of user table');
+define('DBLAN_36', 'Check user table');
 
 
 ?>
diff -x .svn -aruN 0.7.15.src/e107_languages/English/admin/lan_newspost.php 0.7.16.src/e107_languages/English/admin/lan_newspost.php
--- 0.7.15.src/e107_languages/English/admin/lan_newspost.php	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_languages/English/admin/lan_newspost.php	2009-04-19 15:53:55.000000000 -0500
@@ -4,9 +4,9 @@
 |     e107 website system - Language File.
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_languages/English/admin/lan_newspost.php,v $
-|     $Revision: 1.32 $
-|     $Date: 2007/10/06 00:17:10 $
-|     $Author: e107coders $
+|     $Revision: 1.33 $
+|     $Date: 2009/04/19 20:54:19 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 define("NWSLAN_1", "News story deleted.");
@@ -170,4 +170,10 @@
 
 define("LAN_NEWS_49", "Render-type");
 
+define('LAN_NEWS_50', 'Maintenance');
+define('LAN_NEWS_51', 'Recalculate comment counts');
+define('LAN_NEWS_52', 'Proceed');
+define('LAN_NEWS_53', 'Update complete');
+define('LAN_NEWS_54', 'News Maintenance');
+
 ?>
diff -x .svn -aruN 0.7.15.src/e107_languages/English/admin/lan_prefs.php 0.7.16.src/e107_languages/English/admin/lan_prefs.php
--- 0.7.15.src/e107_languages/English/admin/lan_prefs.php	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_languages/English/admin/lan_prefs.php	2009-03-08 13:38:14.000000000 -0500
@@ -12,9 +12,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_languages/English/admin/lan_prefs.php,v $
-|     $Revision: 1.67 $
-|     $Date: 2007/12/29 19:06:15 $
-|     $Author: e107steved $
+|     $Revision: 1.69 $
+|     $Date: 2009/03/08 18:38:38 $
+|     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
 
@@ -36,14 +36,14 @@
 define("PRFLAN_16", "Display sql queries?");
 define("PRFLAN_17", "Compress Site Output Using gzip");
 define("PRFLAN_19", "Signup Page Options");
-define("PRFLAN_21", "Date display options");
+define("PRFLAN_21", "Date Display options");
 define("PRFLAN_22", "Short date format");
 define("PRFLAN_23", "Long date format");
 define("PRFLAN_24", "Forum date format");
 define("PRFLAN_25", "For more information on date formats see the");
 define("PRFLAN_26", "Time offset");
 define("PRFLAN_27", "Example, if you set this to +2, all times on your site will have two hours added to them");
-define("PRFLAN_28", "User registration/posting");
+define("PRFLAN_28", "User Registration/Posting");
 define("PRFLAN_29", "Activate user registration system?");
 define("PRFLAN_30", "allow users to register as members on your site");
 //define("PRFLAN_31", "Use email verification for signups?");
@@ -108,9 +108,9 @@
 define("PRFLAN_96", "Will display info on all admin pages for each plugin supporting this type of feature");
 define("PRFLAN_97", "Unique 'Plugins info' menu:");
 define("PRFLAN_98", "If unchecked, each plugin will display its own info in an individual menu. If checked all info will be displayed in one menu.");
-define("PRFLAN_101", "Text rendering");
+define("PRFLAN_101", "Text Rendering");
 define("PRFLAN_102", "Replace clickable URLs");
-define("PRFLAN_103", "If ticked, and 'Make Clickable' (above) is also ticked, posted URLs are displayed as a hyperlink using text from the textbox below. This keeps very long URLs from breaking layout.");
+define("PRFLAN_103", "If ticked, and 'Make Clickable' (above) is also ticked, posted URLs or Email addresses are displayed as a hyperlink using text from the textboxes below. This keeps very long URLs/Emails from breaking layout.");
 define("PRFLAN_104", "URL replacement text");
 define("PRFLAN_105", "Replacement visible text for clickable URLs. Image can be used by using &lt;img&gt; tag, with full path to image");
 define("PRFLAN_106", "Core preferences saved to database.");
@@ -133,7 +133,7 @@
 define("PRFLAN_125", "Turning this on will show the nextprev pages as 1 2 3 ... 21 22 23, instead of the new look with the dropdown.");
 define("PRFLAN_126", "Text to display on signup page");
 define("PRFLAN_127", "Make URLs clickable");
-define("PRFLAN_128", "Turning this on will convert posted URLs to hyperlinks");
+define("PRFLAN_128", "Turning this on will convert posted URLs or Email addresses to hyperlinks");
 define("PRFLAN_129", "Disallow multiple logins");
 define("PRFLAN_130", "Activating this will prevent more than one person logging in with the same username/password (login detail sharing)");
 define("PRFLAN_131", "Activate use of [php] bbcode");
diff -x .svn -aruN 0.7.15.src/e107_languages/English/admin/lan_users.php 0.7.16.src/e107_languages/English/admin/lan_users.php
--- 0.7.15.src/e107_languages/English/admin/lan_users.php	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_languages/English/admin/lan_users.php	2009-06-24 15:09:47.000000000 -0500
@@ -4,9 +4,9 @@
 |     e107 website system - Language File.
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_languages/English/admin/lan_users.php,v $
-|     $Revision: 1.34 $
-|     $Date: 2008/08/28 19:57:55 $
-|     $Author: e107steved $
+|     $Revision: 1.36 $
+|     $Date: 2009/06/24 20:10:11 $
+|     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
 define("USRLAN_1", "Options Saved.");
@@ -79,7 +79,7 @@
 define("USRLAN_71", "Users Front Page");
 define("USRLAN_72", "Quick Add User");
 define("USRLAN_73", "Prune Users");
-// define("USRLAN_75", "Options");
+define("USRLAN_75", "That login name already exists in the database, please choose a different login name");
 define("USRLAN_76", "User Options");
 define("USRLAN_77", "Existing Users");
 define("USRLAN_78", "User Name");
@@ -202,4 +202,6 @@
 define("DUSRLAN_36", "Password Change");
 define("DUSRLAN_37", "XUP");
 
+define('USRLAN_219', 'Older than 30 days');     
+
 ?>
\ No newline at end of file
diff -x .svn -aruN 0.7.15.src/e107_languages/English/English.php 0.7.16.src/e107_languages/English/English.php
--- 0.7.15.src/e107_languages/English/English.php	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_languages/English/English.php	2009-08-15 08:22:26.000000000 -0500
@@ -4,12 +4,12 @@
 |     e107 website system - Language File.
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_languages/English/English.php,v $
-|     $Revision: 1.13 $
-|     $Date: 2008/10/19 11:33:43 $
-|     $Author: e107steved $
+|     $Revision: 1.15 $
+|     $Date: 2009/08/15 13:22:50 $
+|     $Author: marj_nl_fr $
 +----------------------------------------------------------------------------+
 */
-setlocale(LC_ALL, 'en');
+setlocale(LC_ALL, 'en_GB.UTF-8', 'en_GB.utf8', 'eng_eng.utf8', 'en');
 define("CORE_LC", 'en');
 define("CORE_LC2", 'gb');
 // define("TEXTDIRECTION","rtl");
@@ -17,8 +17,8 @@
 define("CORE_LAN1","Error : theme is missing.\\n\\nChange the used themes in your preferences (admin area) or upload files of the current theme on the server.");
 
 //v.616
-define("CORE_LAN2"," \\1 wrote:");// "\\1" represents the username.
-define("CORE_LAN3","file attachment disabled");
+//obsolete define("CORE_LAN2"," \\1 wrote:");// "\\1" represents the username.
+//obsolete define("CORE_LAN3","file attachment disabled");
 
 //v0.7+
 define("CORE_LAN4", "Please delete install.php from your server");
diff -x .svn -aruN 0.7.15.src/e107_languages/English/lan_contact.php 0.7.16.src/e107_languages/English/lan_contact.php
--- 0.7.15.src/e107_languages/English/lan_contact.php	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_languages/English/lan_contact.php	2009-07-18 12:00:25.000000000 -0500
@@ -4,12 +4,14 @@
 |     e107 website system - Language File.
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_languages/English/lan_contact.php,v $
-|     $Revision: 1.4 $
-|     $Date: 2006/08/11 16:50:41 $
-|     $Author: e107coders $
+|     $Revision: 1.5 $
+|     $Date: 2009/07/18 17:00:49 $
+|     $Author: marj_nl_fr $
 +----------------------------------------------------------------------------+
 */
 
+define('PAGE_NAME',     'Contact Us');
+
 define("LANCONTACT_01", "Contact Details");
 define("LANCONTACT_02", "Contact Form");
 define("LANCONTACT_03", "Enter your name:");
diff -x .svn -aruN 0.7.15.src/e107_languages/English/lan_installer.php 0.7.16.src/e107_languages/English/lan_installer.php
--- 0.7.15.src/e107_languages/English/lan_installer.php	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_languages/English/lan_installer.php	2009-07-18 13:37:21.000000000 -0500
@@ -37,7 +37,7 @@
 define("LANINS_027", "MySQL Database:");
 define("LANINS_028", "Create Database?");
 define("LANINS_029", "Table prefix:");
-define("LANINS_030", "The MySQL server you would like e107 to use. It can also include a port number. e.g. \"hostname:port\" or a path to a local socket e.g. \":/path/to/socket\" for the localhost.");
+define("LANINS_030", "The MySQL server you would like e107 to use. It can also include a port number. e.g. “hostname:port” or a path to a local socket e.g. \":/path/to/socket\" for the localhost.");
 define("LANINS_031", "The username you wish e107 to use for connecting to your MySQL server");
 define("LANINS_032", "The Password for the user you just entered");
 define("LANINS_033", "The MySQL database you wish e107 to reside in, sometimes referred to as a schema. If the user has database create permissions you can opt to create the database automatically if it doesn't already exist.");
@@ -60,8 +60,8 @@
 define("LANINS_050", "XML Extension");
 define("LANINS_051", "Installed");
 define("LANINS_052", "Not Installed");
-define("LANINS_053", "e107 0.7.x requires the PHP XML Extension to be installed. Please contact your host or read the information at ");
-define("LANINS_054", " before continuing");
+define("LANINS_053", "e107 0.7.x requires the PHP XML Extension to be installed. Please contact your host or read the information at <a href='http://php.net/manual/en/ref.xml.php' target='_blank'>php.net</a> before continuing");
+//not used: define("LANINS_054", " before continuing");
 define("LANINS_055", "Install Confirmation");
 define("LANINS_056", "6");
 define("LANINS_057", " e107 now has all the information it needs to complete the installation.
@@ -137,18 +137,21 @@
 
 define("LANINS_096", 'Latest Comments');
 define("LANINS_097", '[more ...]');
-define("LANINS_098", 'Articles');
-define("LANINS_099", 'Articles Front Page ...');
+//define("LANINS_098", 'Articles');
+//define("LANINS_099", 'Articles Front Page ...');
 define("LANINS_100", 'Latest Forum Posts');
 define("LANINS_101", 'Update menu Settings');
 define("LANINS_102", 'Date / Time');
-define("LANINS_103", 'Reviews');
-define("LANINS_104", 'Review Front Page ...');
+//define("LANINS_103", 'Reviews');
+//define("LANINS_104", 'Review Front Page ...');
 
-define("LANINS_105", 'A database name or prefix beginning with some digits followed by \'e\' or \'E\' is not acceptable');
+define("LANINS_105", 'A database name or prefix beginning with some digits followed by “e” or “E” is not acceptable');
 define("LANINS_106", 'WARNING - E107 cannot write to the directories and/or files listed. While this will not stop E107 installing, it will mean that certain features are not available. 
 				You will need to change the file permissions to use these features');
-define("LANINS_107", '');
-define("LANINS_108", '');
 
-?>
+// for v0.7.16+ only
+define('LANINS_DB_UTF8_CAPTION', 'MySQL Charset:');
+define('LANINS_DB_UTF8_LABEL',   'Force UTF-8 Database?');
+define('LANINS_DB_UTF8_TOOLTIP', 'If set, the installation script will make the database UTF-8 compatible if possible. UTF-8 Database are required for the next major e107 version.');
+
+?>
\ No newline at end of file
diff -x .svn -aruN 0.7.15.src/e107_languages/English/lan_signup.php 0.7.16.src/e107_languages/English/lan_signup.php
--- 0.7.15.src/e107_languages/English/lan_signup.php	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_languages/English/lan_signup.php	2009-07-06 02:48:48.000000000 -0500
@@ -4,9 +4,9 @@
 |     e107 website system - Language File.
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_languages/English/lan_signup.php,v $
-|     $Revision: 1.30 $
-|     $Date: 2008/07/30 19:46:23 $
-|     $Author: e107steved $
+|     $Revision: 1.35 $
+|     $Date: 2009/07/06 07:49:12 $
+|     $Author: marj_nl_fr $
 +----------------------------------------------------------------------------+
 */
 define("PAGE_NAME", "Register");
@@ -66,10 +66,10 @@
 define("LAN_SIGNUP_15", "Please contact the main site admin");
 define("LAN_SIGNUP_16", "if you require assistance.");
 define("LAN_SIGNUP_17", "Please certify you are 13 or over the age of 13.");
-define("LAN_SIGNUP_18", "Your registration has been received and created with the following login information ...");
-define("LAN_SIGNUP_19", "Username:");
-define("LAN_SIGNUP_20", "Password:");
-define("LAN_SIGNUP_21", "Your account is currently marked as being inactive, to activate your account please go to the following link ...");
+define("LAN_SIGNUP_18", "Your registration has been received and created with the following login information:");
+//define("LAN_SIGNUP_19", "Username:"); // now LAN_LOGINNAME
+//define("LAN_SIGNUP_20", "Password:"); // now LAN_PASSWORD
+define("LAN_SIGNUP_21", "Your account is currently marked as being inactive. To activate your account please go to the following link:");
 define("LAN_SIGNUP_22", "click here");
 define("LAN_SIGNUP_23", "to login.");
 define("LAN_SIGNUP_24", "Thank you for registering at");
@@ -119,6 +119,17 @@
 define("LAN_SIGNUP_57", "That login name is too long. Please choose another");
 define("LAN_SIGNUP_58", "Signup Preview");
 define("LAN_SIGNUP_59","**** If the link doesn't work, please check that part of it has not overflowed onto the next line. ****");
+define('LAN_SIGNUP_60', 'Error accessing external avatar');
+
+// 0.7.16
+
+define("LAN_SIGNUP_72", "Thanks for signing up on [sitename]! We just sent you a confirmation email to [email]. Please click on the confirmation link in the email to complete your sign up and activate your account.");  	// LAN_405
+
+define("LAN_SIGNUP_98", "Confirm Your Email Address");
+define("LAN_SIGNUP_99", "Problem Encountered");
+define("LAN_SIGNUP_100", "Admin Approval Pending");
+
+
 
 
 ?>
diff -x .svn -aruN 0.7.15.src/e107_languages/English/lan_submitnews.php 0.7.16.src/e107_languages/English/lan_submitnews.php
--- 0.7.15.src/e107_languages/English/lan_submitnews.php	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_languages/English/lan_submitnews.php	2009-08-17 14:21:52.000000000 -0500
@@ -4,17 +4,17 @@
 |     e107 website system - Language File.
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_languages/English/lan_submitnews.php,v $
-|     $Revision: 1.3 $
-|     $Date: 2007/04/12 22:58:23 $
-|     $Author: e107coders $
+|     $Revision: 1.5 $
+|     $Date: 2009/08/17 19:22:16 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 define("PAGE_NAME", "Submit News");
-define("LAN_7", "Username: ");
-define("LAN_62", "Subject: ");
+define("LAN_7", "Name: ");
+define("LAN_62", "News Title: ");
 define("LAN_112", "Email Address: ");
 define("LAN_133", "Thank you");
-define("LAN_134", "Your item has been submitted and will be reviewed by one of the site administrators in due course.");
+define("LAN_134", "Your item has been submitted for review by one of the site administrators.");
 define("LAN_135", "News Item: ");
 define("LAN_136", "Submit News Item");
 define("NWSLAN_6", "Category");
@@ -28,5 +28,7 @@
 define("SUBNEWSLAN_4", "File too Large");
 define("SUBNEWSLAN_5", "Image File");
 define("SUBNEWSLAN_6", "(jpg, gif or png)");
+define('SUBNEWSLAN_7', 'You must give your name and email address');
+define('SUBNEWSLAN_8', 'Error uploading image');
 
 ?>
diff -x .svn -aruN 0.7.15.src/e107_plugins/admin_menu/admin_menu.php 0.7.16.src/e107_plugins/admin_menu/admin_menu.php
--- 0.7.15.src/e107_plugins/admin_menu/admin_menu.php	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_plugins/admin_menu/admin_menu.php	2009-07-18 05:17:02.000000000 -0500
@@ -11,17 +11,18 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/admin_menu/admin_menu.php,v $
-|     $Revision: 1.11 $
-|     $Date: 2006/11/23 09:46:33 $
-|     $Author: e107coders $
+|     $Revision: 1.12 $
+|     $Date: 2009/07/18 10:17:26 $
+|     $Author: marj_nl_fr $
 +----------------------------------------------------------------------------+
 */
 
 if (!defined('e107_INIT')) { exit; }
 global $tp;
-if (ADMIN == TRUE) {
-	@include_once(e_LANGUAGEDIR.e_LANGUAGE."/admin/lan_admin.php");
-	@include_once(e_LANGUAGEDIR."English/admin/lan_admin.php");
+if (ADMIN == TRUE)
+{
+	// We're not in admin - load generic admin phrases
+	include_lan(e_LANGUAGEDIR.e_LANGUAGE.'/admin/lan_admin.php');
 
 	require_once(e_HANDLER."userclass_class.php");
 	require_once(e_ADMIN."ad_links.php");
@@ -53,9 +54,11 @@
 	$ns->tablerender(LAN_ADMIN, $amtext, 'admin_menu');
 }
 
-function render_admin_links($link, $title, $perms) {
-	if (getperms($perms)) {
+function render_admin_links($link, $title, $perms)
+{
+	if (getperms($perms))
+	{
 		return "<option value='".$link."'>".$title."</option>";
 	}
 }
-?>
+?>
\ No newline at end of file
diff -x .svn -aruN 0.7.15.src/e107_plugins/alt_news/alt_news.php 0.7.16.src/e107_plugins/alt_news/alt_news.php
--- 0.7.15.src/e107_plugins/alt_news/alt_news.php	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_plugins/alt_news/alt_news.php	2009-08-23 05:39:28.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/alt_news/alt_news.php,v $
-|     $Revision: 1.10 $
-|     $Date: 2006/06/02 13:59:40 $
-|     $Author: lisa_ $
+|     $Revision: 1.12 $
+|     $Date: 2009/08/23 10:39:52 $
+|     $Author: marj_nl_fr $
 +----------------------------------------------------------------------------+
 */
 
@@ -22,7 +22,7 @@
 require_once(e_HANDLER."news_class.php");
 
 function alt_news($news_category) {
-	global $ml, $sql, $aj, $ns;
+	global $sql, $aj, $ns;
 	$ix = new news;
 	if (strstr(e_QUERY, "cat")) {
 		$category = $news_category;
@@ -47,13 +47,28 @@
 					$datestamp = $gen->convert_date($news_datestamp, "short");
 					$news_body = strip_tags(substr($news_body, 0, 100))." ...";
 					$comment_total = $sql2->db_Count("comments", "(*)", "WHERE comment_item_id='".intval($news_id)."' AND comment_type='0' ");
-					$text .= "<div class='mediumtext'>
-						<img src='".THEME."images/".(defined("BULLET") ? BULLET : "bullet2.gif")."' alt='bullet' /> ";
-
-					if ($news_allow_comments) {
-						$text .= "<a href='news.php?extend.".$news_id."'>".$news_title."</a>";
-					} else {
-						$text .= "<a href='comment.php?comment.news.".$news_id."'>".$news_title."</a>";
+					$bullet = '';
+					if(defined('BULLET'))
+					{
+						$bullet = '<img src="'.THEME.'images/'.BULLET.'" alt="" style="vertical-align: middle;" />';
+					}
+					elseif(file_exists(THEME.'images/bullet2.gif'))
+					{
+						$bullet = '<img src="'.THEME.'images/bullet2.gif" alt="" style="vertical-align: middle;" />';
+					}
+					$text .= "
+						<div class='mediumtext'>
+						".$bullet;
+
+					if ($news_allow_comments)
+					{
+						$text .= "
+						<a href='news.php?extend.".$news_id."'>".$news_title."</a>";
+					}
+					else
+					{
+						$text .= "
+						<a href='comment.php?comment.news.".$news_id."'>".$news_title."</a>";
 					}
 					$text .= "<br />
 						".LAN_NEWS_100." ".$datestamp." (".LAN_NEWS_99.": ";
diff -x .svn -aruN 0.7.15.src/e107_plugins/banner_menu/config.php 0.7.16.src/e107_plugins/banner_menu/config.php
--- 0.7.15.src/e107_plugins/banner_menu/config.php	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_plugins/banner_menu/config.php	2009-08-15 06:54:07.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/banner_menu/config.php,v $
-|     $Revision: 1.10 $
-|     $Date: 2008/08/26 19:45:33 $
-|     $Author: e107steved $
+|     $Revision: 1.11 $
+|     $Date: 2009/08/15 11:54:31 $
+|     $Author: marj_nl_fr $
 +----------------------------------------------------------------------------+
 */
 $eplug_admin = TRUE;
@@ -27,7 +27,7 @@
 require_once(e_HANDLER."form_handler.php");
 $rs = new form;
 	
-@include_lan(e_PLUGIN."banner_menu/languages/".e_LANGUAGE.".php");
+include_lan(e_PLUGIN."banner_menu/languages/".e_LANGUAGE.".php");
 include_lan(e_LANGUAGEDIR.e_LANGUAGE."/admin/lan_menus.php");
 	
 if (e_QUERY) 
diff -x .svn -aruN 0.7.15.src/e107_plugins/calendar_menu/admin_config.php 0.7.16.src/e107_plugins/calendar_menu/admin_config.php
--- 0.7.15.src/e107_plugins/calendar_menu/admin_config.php	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_plugins/calendar_menu/admin_config.php	2009-05-04 14:41:07.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/calendar_menu/admin_config.php,v $
-|     $Revision: 1.17 $
-|     $Date: 2007/12/29 20:34:37 $
-|     $Author: e107steved $
+|     $Revision: 1.18 $
+|     $Date: 2009/05/04 19:41:31 $
+|     $Author: bugrain $
 |
 | 02.11.06 - Cache clear option added
 | 10.11.06 - Support for updated templates etc
@@ -23,13 +23,13 @@
 $eplug_admin = true;		// Make sure we show admin theme
 require_once("../../class2.php");
 require_once(e_HANDLER."userclass_class.php");
-if (!getperms("P")) 
+if (!getperms("P"))
 {
   header("location:".e_BASE."index.php");
   exit;
 }
-	
-	
+
+
 include_lan(e_PLUGIN."calendar_menu/languages/".e_LANGUAGE.".php");
 
 
@@ -41,14 +41,14 @@
 	$pref['eventpost_admin'] = $_POST['eventpost_admin'];
 	$pref['eventpost_adminlog'] = $_POST['eventpost_adminlog'];
 	$pref['eventpost_showeventcount'] = $_POST['eventpost_showeventcount'];
-	$pref['eventpost_forum'] = $_POST['eventpost_forum'];	
+	$pref['eventpost_forum'] = $_POST['eventpost_forum'];
 	$pref['eventpost_recentshow'] = $_POST['eventpost_recentshow'];
 	$pref['eventpost_super'] = $_POST['eventpost_super'];
 	$pref['eventpost_menulink'] = $_POST['eventpost_menulink'];
-	$pref['eventpost_dateformat'] = $_POST['eventpost_dateformat'];	
+	$pref['eventpost_dateformat'] = $_POST['eventpost_dateformat'];
 	$pref['eventpost_fivemins'] = $_POST['eventpost_fivemins'];
 	$pref['eventpost_weekstart'] = $_POST['eventpost_weekstart'];
-	$pref['eventpost_lenday'] = $_POST['eventpost_lenday'];			
+	$pref['eventpost_lenday'] = $_POST['eventpost_lenday'];
 	$pref['eventpost_caltime'] = $_POST['eventpost_caltime'];
 	$pref['eventpost_datedisplay'] = $_POST['eventpost_datedisplay'];
 	$pref['eventpost_timedisplay']	= $_POST['eventpost_timedisplay'];
@@ -57,8 +57,8 @@
 	$pref['eventpost_datenext'] = $_POST['eventpost_datenext'];
 	$pref['eventpost_eventdatecustom'] = $_POST['eventpost_eventdatecustom'];
 	$pref['eventpost_nextdatecustom'] = $_POST['eventpost_nextdatecustom'];
-	$pref['eventpost_mailsubject'] = $_POST['eventpost_mailsubject'];			
-	$pref['eventpost_mailfrom'] = $_POST['eventpost_mailfrom'];		
+	$pref['eventpost_mailsubject'] = $_POST['eventpost_mailsubject'];
+	$pref['eventpost_mailfrom'] = $_POST['eventpost_mailfrom'];
 	$pref['eventpost_mailaddress'] = $_POST['eventpost_mailaddress'];
 	$pref['eventpost_asubs'] = $_POST['eventpost_asubs'];
 	$pref['eventpost_emaillog'] = $_POST['eventpost_emaillog'];
@@ -83,7 +83,7 @@
   $message = EC_ADLAN_A109; // "Forthcoming Events settings updated.";
 }
 
-if (e_QUERY) 
+if (e_QUERY)
 {
   $qs = explode(".", e_QUERY);
 }
@@ -163,7 +163,7 @@
 	</tr>
 	<tr><td colspan='2'  style='text-align:center' class='fcaption'><input class='button' type='submit' name='confirmdeleteold' value='".EC_LAN_50."' /></td></tr>
 	</table></form></div>";
-	
+
 	$ns->tablerender("<div style='text-align:center'>".EC_LAN_50."</div>", $text);
 }
 
@@ -179,12 +179,12 @@
 	</tr>
 	<tr><td colspan='2'  style='text-align:center' class='fcaption'><input class='button' type='submit' name='confirmdelcache' value='".EC_LAN_50."' /></td></tr>
 	</table></form></div>";
-	
+
 	$ns->tablerender("<div style='text-align:center'>".EC_LAN_50."</div>", $text);
 }
 
 
-if (isset($message)) 
+if (isset($message))
 {
   $ns->tablerender("", "<div style='text-align:center'><b>$message</b></div>");
 }
@@ -203,21 +203,21 @@
 	{
 		$calendarmenu_id = $_POST['calendarmenu_id'];
 		if ($calendarmenu_id == 0)
-		{ 
+		{
 			// New record so add it
 			// Enumerate fields so it doesn't matter if they're in the wrong order.
 			// db_Insert can take an array of key => value pairs
 			$calendarmenu_args = array (
 			'event_cat_id'			=> 0,
-			'event_cat_name'		=> $_POST['event_cat_name'],
-			'event_cat_description'	=> $_POST['event_cat_description'],
+			'event_cat_name'		=> $tp->toDB($_POST['event_cat_name']),
+			'event_cat_description'	=> $tp->toDB($_POST['event_cat_description']),
 			'event_cat_icon'		=> $_POST['ne_new_category_icon'],
 			'event_cat_class'		=> intval($_POST['event_cat_class']),
 			'event_cat_subs'		=> intval($_POST['event_cat_subs']),
 			'event_cat_force_class'	=> intval($_POST['event_cat_force_class']),
 			'event_cat_ahead'		=> intval($_POST['event_cat_ahead']),
-			'event_cat_msg1'		=> $_POST['event_cat_msg1'],
-			'event_cat_msg2'		=> $_POST['event_cat_msg2'],
+			'event_cat_msg1'		=> $tp->toDB($_POST['event_cat_msg1']),
+			'event_cat_msg2'		=> $tp->toDB($_POST['event_cat_msg2']),
 			'event_cat_notify'		=> intval($_POST['event_cat_notify']),
 			'event_cat_lastupdate'	=> intval(time()),
 			'event_cat_addclass'	=>  intval($_POST['event_cat_addclass'])
@@ -230,33 +230,33 @@
 			else
 			{
 			  $calendarmenu_msg .= "<tr><td class='forumheader3' colspan='2'><strong>".EC_ADLAN_A27."</strong></td></tr>";
-			} 
+			}
 		}
 		else
-		{ 
+		{
 			// Update existing
 			$calendarmenu_args = "
-			event_cat_name='".$_POST['event_cat_name']."',
-			event_cat_description='".$_POST['event_cat_description']."',
+			event_cat_name='".$tp->toDB($_POST['event_cat_name'])."',
+			event_cat_description='".$tp->toDB($_POST['event_cat_description'])."',
 			event_cat_class='".intval($_POST['event_cat_class'])."',
 			event_cat_icon='".$_POST['ne_new_category_icon']."',
 			event_cat_subs='".intval($_POST['event_cat_subs'])."',
 			event_cat_force_class='".intval($_POST['event_cat_force_class'])."',
 			event_cat_ahead='".intval($_POST['event_cat_ahead'])."',
-			event_cat_msg1='".$_POST['event_cat_msg1']."',
-			event_cat_msg2='".$_POST['event_cat_msg2']."',
+			event_cat_msg1='".$tp->toDB($_POST['event_cat_msg1'])."',
+			event_cat_msg2='".$tp->toDB($_POST['event_cat_msg2'])."',
 			event_cat_notify='".intval($_POST['event_cat_notify'])."',
 			event_cat_addclass='".intval($_POST['event_cat_addclass'])."',
-			event_cat_lastupdate='".time()."'		
+			event_cat_lastupdate='".time()."'
 			where event_cat_id='$calendarmenu_id'";
-			if ($calendarmenu_db->db_Update("event_cat", $calendarmenu_args)){ 
+			if ($calendarmenu_db->db_Update("event_cat", $calendarmenu_args)){
 				// Changes saved
 				$calendarmenu_msg .= "<tr><td class='forumheader3' colspan='2'><b>".EC_ADLAN_A28."</b></td></tr>";
 			}else{
 				$calendarmenu_msg .= "<tr><td class='forumheader3' colspan='2'><b>".EC_ADLAN_A29."</b></td></tr>";
-			} 
-		} 
-	} 
+			}
+		}
+	}
 	// We are creating, editing or deleting a record
 	if ($calendarmenu_action == 'dothings')
 	{
@@ -275,20 +275,20 @@
 					$calendarmenu_cap1 = EC_ADLAN_A24;
 					$calendarmenu_edit = TRUE;
 					break;
-				} 
+				}
 			case '2': // New category
 				{
 					// Create new record
-					$calendarmenu_id = 0; 
+					$calendarmenu_id = 0;
 					// set all fields to zero/blank
 					$calendar_category_name = "";
 					$calendar_category_description = "";
 					$calendarmenu_cap1 = EC_ADLAN_A23;
 					$calendarmenu_edit = TRUE;
 					break;
-				} 
+				}
 			case '3':
-				{ 
+				{
 					// delete the record
 					if ($_POST['calendarmenu_okdel'] == '1'){
 						if ($calendarmenu_db->db_Select("event", "event_id", " where event_category='$calendarmenu_id'", "nowhere")){
@@ -298,21 +298,21 @@
 								$calendarmenu_msg .= "<tr><td class='forumheader3' colspan='2'><strong>".EC_ADLAN_A30."</strong></td></tr>";
 							}else{
 								$calendarmenu_msg .= "<tr><td class='forumheader3' colspan='2'><strong>".EC_ADLAN_A32."</strong></td></tr>";
-							} 
-						} 
+							}
+						}
 					}else{
 						$calendarmenu_msg .= "<tr><td class='forumheader3' colspan='2'><strong>".EC_ADLAN_A31."</strong></td></tr>";
-					} 
+					}
 					$calendarmenu_dodel = TRUE;
 					$calendarmenu_edit = FALSE;
-				} 
-		} 
+				}
+		}
 
 		if (!$calendarmenu_dodel)
 		{
 			require_once(e_HANDLER."file_class.php");
-			
-			
+
+
 			$calendarmenu_text .= "
 			<form id='calformupdate' method='post' action='".e_SELF."?cat'>
 			<table style='width:97%;' class='fborder'>
@@ -334,11 +334,11 @@
 			<tr>
 				<td style='width:20%' class='forumheader3'>".EC_ADLAN_A80."</td>
 				<td style='width:80%' class='forumheader3'>".r_userclass("event_cat_class", $event_cat_class, "off", 'public, nobody, member, admin, classes')."</td>
-			</tr>	
+			</tr>
 			<tr>
 				<td style='width:20%' class='forumheader3'>".EC_ADLAN_A94."</td>
 				<td style='width:80%' class='forumheader3'>".r_userclass("event_cat_addclass", $event_cat_addclass, "off", 'public, nobody, member, admin, classes')."</td>
-			</tr>			
+			</tr>
 			<tr>
 				<td class='forumheader3' style='width:20%'>".EC_LAN_55."</td><td class='forumheader3' >
 					<input class='tbox' style='width:150px' id='caticon' type='text' name='ne_new_category_icon' value='".$event_cat_icon."' />
@@ -349,7 +349,7 @@
 					foreach($imagelist as $img){
 						if ($img['fname']){
 							$calendarmenu_text .= "<a href='javascript:insertext(\"{$img['fname']}\", \"caticon\", \"cat_icons\")'><img src='".e_PLUGIN."calendar_menu/images/".$img['fname']."' style='border:0px' alt='' /></a> ";
-						} 
+						}
 					}
 					$calendarmenu_text .= "
 					</div>
@@ -368,13 +368,13 @@
 				<option value='3' ".($event_cat_notify == 3?" selected='selected'":"")." >".EC_ADLAN_A90."</option>
 				<option value='4' ".($event_cat_notify == 4?" selected='selected'":"")." >".EC_ADLAN_A110."</option>
 				<option value='5' ".($event_cat_notify == 5?" selected='selected'":"")." >".EC_ADLAN_A111."</option>
-				</select>		
+				</select>
 				</td>
 			</tr>
 			<tr>
 				<td style='width:20%' class='forumheader3'>".EC_ADLAN_A82."</td>
 				<td style='width:80%' class='forumheader3'>".r_userclass("event_cat_force_class", $event_cat_force_class, "off", 'nobody, member, admin, classes')."</td>
-			</tr>			
+			</tr>
 			<tr>
 				<td class='forumheader3' style='width:20%'>".EC_ADLAN_A83."</td>
 				<td class='forumheader3'><input type='text' size='4' maxlength='5' class='tbox' name='event_cat_ahead' value='$event_cat_ahead'  /></td>
@@ -386,14 +386,14 @@
 			<tr>
 				<td class='forumheader3' style='width:20%;vertical-align:top;'>".EC_ADLAN_A117."</td>
 				<td class='forumheader3'><textarea rows='5' cols='80' class='tbox' name='event_cat_msg2' >".$event_cat_msg2."</textarea></td>
-			</tr>			
+			</tr>
 			<tr><td colspan='2' style='text-align:center' class='fcaption'><input type='submit' name='submits' value='".EC_LAN_77."' class='tbox' /></td></tr>
 			</table>
 			</form>";
-		} 
-	} 
+		}
+	}
 	if (!$calendarmenu_edit)
-	{ 
+	{
 		// Get the category names to display in combo box then display actions available
 		$calendarmenu2_db = new DB;
 		$calendarmenu_catopt = '';
@@ -403,16 +403,16 @@
 			while ($row = $calendarmenu2_db->db_Fetch()){
 				//extract($calendarmenu_row);
 				$calendarmenu_catopt .= "<option value='".$row['event_cat_id']."' ".($calendarmenu_id == $row['event_cat_id'] ?" selected='selected'":"")." >".$row['event_cat_name']."</option>";
-			} 
+			}
 		}
 		else
 		{
 			$calendarmenu_catopt .= "<option value=0'>".EC_ADLAN_A33."</option>";
-		} 
+		}
 
 		$calendarmenu_text .= "
 		<form id='calform' method='post' action='".e_SELF."?cat'>
-		
+
 		<table width='97%' class='fborder'>
 		<tr>
 			<td colspan='2' class='fcaption'>".EC_ADLAN_A11."<input type='hidden' value='dothings' name='calendarmenu_action' /></td>
@@ -493,19 +493,19 @@
 			</select>
 		</td>
 	</tr>
-	
+
 	<tr>
 		<td style='width:40%;vertical-align:top;' class='forumheader3'>".EC_ADLAN_A104."</td>
 		<td style='width:60%;vertical-align:top;' class='forumheader3'><input class='tbox' type='checkbox' name='eventpost_fe_linkheader' value='1' ".($pref['eventpost_linkheader']==1?" checked='checked' ":"")." />
 		</td>
 	</tr>
-	
+
 	<tr>
 		<td style='width:40%;vertical-align:top;' class='forumheader3'>".EC_ADLAN_A120."</td>
 		<td style='width:60%;vertical-align:top;' class='forumheader3'><input class='tbox' type='checkbox' name='eventpost_showcaticon' value='1' ".($pref['eventpost_showcaticon']==1?" checked='checked' ":"")." />
 		</td>
 	</tr>
-	
+
 	<tr>
 		<td style='width:40%;vertical-align:top;' class='forumheader3'>".EC_ADLAN_A118."</td>
 		<td style='width:60%;vertical-align:top;' class='forumheader3'>";
@@ -520,21 +520,21 @@
 	  {
 	    $selected = isset($cal_fe_prefs[$row['event_cat_id']]);
 		$text .= "<input type='checkbox' name='fe_eventclass[]' value='".$row['event_cat_id'].($selected == 1?"' checked='checked'":"'")." />".$row['event_cat_name']."<br /> ";
-	  } 
+	  }
 	}
 	else
 	{
 	  $text .= EC_ADLAN_A119;		// No categories, or error
-	} 
-  
+	}
+
 	$text .= "</td>
 	</tr>
-	
+
 	<tr><td colspan='2'  style='text-align:center' class='fcaption'><input class='button' type='submit' name='updateforthcoming' value='".EC_LAN_77."' /></td></tr>
 	</table>
 	</form>
 	</div>";
-	
+
 	$ns->tablerender("<div style='text-align:center'>".EC_ADLAN_A100."</div>", $text);
 }   // End of Forthcoming Events Menu Options
 
@@ -571,7 +571,7 @@
 	</tr>
 	<tr><td colspan='2'  style='text-align:center' class='fcaption'><input class='button' type='submit' name='deleteold' value='".EC_ADLAN_A145."' /></td></tr>
 	</table></form></div><br /><br />";
-	
+
 	$ns->tablerender("<div style='text-align:center'>".EC_ADLAN_A144."</div>", $text);
 
 	$text = "<div style='text-align:center'>
@@ -580,7 +580,7 @@
 	<tr><td style='vertical-align:top; text-align:center;' colspan='2' class='smalltext'><em>".EC_ADLAN_A160."</em> </td></tr>
 	<tr><td colspan='2'  style='text-align:center' class='fcaption'><input class='button' type='submit' name='cache_clear' value='".EC_ADLAN_A161."' /></td></tr>
 	</table></form></div>";
-	
+
 	$ns->tablerender("<div style='text-align:center'>".EC_ADLAN_A159."</div>", $text);
 
 }
@@ -645,7 +645,7 @@
 		<td style='width:60%;vertical-align:top;' class='forumheader3'><input class='tbox' type='text' name='eventpost_recentshow' size='10' value='".$pref['eventpost_recentshow']."' maxlength='5' />
 		<span class='smalltext'><em>".EC_ADLAN_A172."</em></span>
 		</td>
-	</tr>  
+	</tr>
 
 	<tr>
 		<td style='width:40%;vertical-align:top;' class='forumheader3'>".EC_LAN_114."</td>
@@ -693,7 +693,7 @@
 		<td style='width:60%;vertical-align:top;' class='forumheader3'><input class='tbox' type='checkbox' name='eventpost_fivemins' value='1' ".($pref['eventpost_fivemins']==1?" checked='checked' ":"")." />&nbsp;&nbsp;<span class='smalltext'><em>".EC_ADLAN_A139."</em></span>
 		</td>
 	</tr>
-	
+
 	<tr>
 		<td style='width:40%;vertical-align:top;' class='forumheader3'>".EC_ADLAN_A122."<br />
 		<span class='smalltext'><em>".EC_ADLAN_A124."</em></span>".$ecal_class->time_string($ecal_class->time_now)."<br />
@@ -762,24 +762,24 @@
 		<td style='width:60%;vertical-align:top;' class='forumheader3'><input class='tbox' type='checkbox' name='eventpost_asubs' value='1' ".($pref['eventpost_asubs']==1?" checked='checked' ":"")." />&nbsp;&nbsp;<span class='smalltext'><em>".EC_ADLAN_A96."</em></span>
 		</td>
 	</tr>
-	
+
 	<tr>
 		<td style='width:40%;vertical-align:top;' class='forumheader3'>".EC_ADLAN_A92."</td>
 		<td style='width:60%;vertical-align:top;' class='forumheader3'><input class='tbox' type='text' name='eventpost_mailfrom' size='60' value='".$pref['eventpost_mailfrom']."' maxlength='100' />
 		</td>
-	</tr>  
+	</tr>
 
 	<tr>
 		<td style='width:40%;vertical-align:top;' class='forumheader3'>".EC_ADLAN_A91."</td>
 		<td style='width:60%;vertical-align:top;' class='forumheader3'><input class='tbox' type='text' name='eventpost_mailsubject' size='60' value='".$pref['eventpost_mailsubject']."' maxlength='100' />
 		</td>
-	</tr>  
+	</tr>
 
 	<tr>
 		<td style='width:40%;vertical-align:top;' class='forumheader3'>".EC_ADLAN_A93."</td>
 		<td style='width:60%;vertical-align:top;' class='forumheader3'><input class='tbox' type='text' name='eventpost_mailaddress' size='60' value='".$pref['eventpost_mailaddress']."' maxlength='100' />
 		</td>
-	</tr>  
+	</tr>
 
 	<tr>
 		<td style='width:40%;vertical-align:top;' class='forumheader3'>".EC_ADLAN_A114."<br /></td>
@@ -796,7 +796,7 @@
 	</table>
 	</form>
 	</div>";
-	
+
 	$ns->tablerender("<div style='text-align:center'>".EC_LAN_78."</div>", $text);
 }
 
@@ -813,16 +813,16 @@
 		}
 		$var['config']['text'] = EC_ADLAN_A10;
 		$var['config']['link'] = "admin_config.php";
-			
+
 		$var['cat']['text'] = EC_ADLAN_A11;
 		$var['cat']['link'] ="admin_config.php?cat";
-		
+
 		$var['forthcoming']['text'] = EC_ADLAN_A100;
 		$var['forthcoming']['link'] ="admin_config.php?forthcoming";
 
 		$var['maint']['text'] = EC_ADLAN_A141;
 		$var['maint']['link'] ="admin_config.php?maint";
-		
+
 		show_admin_menu(EC_ADLAN_A12, $action, $var);
 }
 
diff -x .svn -aruN 0.7.15.src/e107_plugins/calendar_menu/calendar.php 0.7.16.src/e107_plugins/calendar_menu/calendar.php
--- 0.7.15.src/e107_plugins/calendar_menu/calendar.php	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_plugins/calendar_menu/calendar.php	2009-08-15 06:54:07.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/calendar_menu/calendar.php,v $
-|     $Revision: 1.20 $
-|     $Date: 2008/09/17 19:56:14 $
-|     $Author: e107steved $
+|     $Revision: 1.21 $
+|     $Date: 2009/08/15 11:54:31 $
+|     $Author: marj_nl_fr $
 |
 | 11.11.06 - steved - mods for next CVS release
 |
@@ -36,7 +36,7 @@
     Header("Location: " . e_PLUGIN . "calendar_menu/subscribe.php");
 } 
 
-@include_lan(e_PLUGIN."calendar_menu/languages/".e_LANGUAGE.".php");
+include_lan(e_PLUGIN."calendar_menu/languages/".e_LANGUAGE.".php");
 define("PAGE_NAME", EC_LAN_121);
 
 require_once('ecal_class.php');
diff -x .svn -aruN 0.7.15.src/e107_plugins/calendar_menu/calendar_shortcodes.php 0.7.16.src/e107_plugins/calendar_menu/calendar_shortcodes.php
--- 0.7.15.src/e107_plugins/calendar_menu/calendar_shortcodes.php	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_plugins/calendar_menu/calendar_shortcodes.php	2009-08-23 05:39:29.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/calendar_menu/calendar_shortcodes.php,v $
-|     $Revision: 1.15 $
-|     $Date: 2008/07/28 20:15:56 $
-|     $Author: e107steved $
+|     $Revision: 1.16 $
+|     $Date: 2009/08/23 10:39:53 $
+|     $Author: marj_nl_fr $
 |
 | 10.11.06 - mods for next CVS release
 +----------------------------------------------------------------------------+
@@ -132,13 +132,18 @@
 // CALENDAR SHOWEVENT ------------------------------------------------------------
 SC_BEGIN SHOWEVENT_IMAGE
 	global $SHOWEVENT_IMAGE, $ev;
+	$img = '';
 	if($ev['event_cat_icon'] && file_exists(e_PLUGIN."calendar_menu/images/".$ev['event_cat_icon']))
 	{
 	  $img = "<img style='border:0' src='".e_PLUGIN_ABS."calendar_menu/images/".$ev['event_cat_icon']."' alt='' height='".$ev['imagesize']."' width='".$ev['imagesize']."' />";
 	}
-	else
+	elseif(defined('BULLET'))
+	{
+		$img = '<img src="'.THEME.'images/'.BULLET.'" alt="" style="vertical-align: middle;" />';
+	}
+	elseif(file_exists(THEME.'images/bullet2.gif'))
 	{
-	  $img = "<img src='".THEME."images/".(defined("BULLET") ? BULLET : "bullet2.gif")."' alt='' style='border:0; vertical-align:middle;' />";
+		$img = '<img src="'.THEME.'images/bullet2.gif" alt="" style="vertical-align: middle;" />';
 	}
 	return $img;
 	//return "<img style='border:0' src='".e_PLUGIN_ABS."calendar_menu/images/".$ev['event_cat_icon']."' alt='' height='".$ev['imagesize']."' width='".$ev['imagesize']."' />";
@@ -449,14 +454,18 @@
   $fe_icon_file = "";
   if ($pref['eventpost_showcaticon'] == 1)
   {
-	if($cal_row['event_cat_icon'] && file_exists($ecal_dir."images/".$cal_row['event_cat_icon']))
-	{
-	  $fe_icon_file = $ecal_dir."images/".$cal_row['event_cat_icon'];
-	}
-	else
-	{
-	  $fe_icon_file = THEME."images/".(defined("BULLET") ? BULLET : "bullet2.gif");
-	}
+		if($cal_row['event_cat_icon'] && file_exists($ecal_dir."images/".$cal_row['event_cat_icon']))
+		{
+		  $fe_icon_file = $ecal_dir."images/".$cal_row['event_cat_icon'];
+		}
+		elseif(defined('BULLET'))
+		{
+			$img = HEME.'images/'.BULLET;
+		}
+		elseif(file_exists(THEME.'images/bullet2.gif'))
+		{
+			$img = THEME.'images/bullet2.gif';
+		}
   }
   return $fe_icon_file;
 SC_END
diff -x .svn -aruN 0.7.15.src/e107_plugins/calendar_menu/event.php 0.7.16.src/e107_plugins/calendar_menu/event.php
--- 0.7.15.src/e107_plugins/calendar_menu/event.php	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_plugins/calendar_menu/event.php	2009-09-01 14:28:10.000000000 -0500
@@ -11,8 +11,8 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/calendar_menu/event.php,v $
-|     $Revision: 1.33 $
-|     $Date: 2008/09/17 19:56:14 $
+|     $Revision: 1.35 $
+|     $Date: 2009/09/01 19:28:34 $
 |     $Author: e107steved $
 |
 | 09.11.06 - Started next batch of mods
@@ -36,7 +36,7 @@
     Header("Location: ".e_PLUGIN."calendar_menu/subscribe.php");
 }
 
-@include_lan(e_PLUGIN."calendar_menu/languages/".e_LANGUAGE.".php");
+include_lan(e_PLUGIN."calendar_menu/languages/".e_LANGUAGE.".php");
 define("PAGE_NAME", EC_LAN_80);
 
 require_once(e_PLUGIN.'calendar_menu/ecal_class.php');
@@ -69,7 +69,7 @@
 }
 */
 // Event to add or update
-if ((isset($_POST['ne_insert']) || isset($_POST['ne_update'])) && USER == true)
+if ((isset($_POST['ne_insert']) || isset($_POST['ne_update'])) && ($cal_super || check_class($pref['eventpost_admin'])))
 {  
   if (($_POST['ne_event'] == "") || !isset($_POST['qs']))
   {	// Problem - tell user to go away
diff -x .svn -aruN 0.7.15.src/e107_plugins/chatbox_menu/admin_chatbox.php 0.7.16.src/e107_plugins/chatbox_menu/admin_chatbox.php
--- 0.7.15.src/e107_plugins/chatbox_menu/admin_chatbox.php	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_plugins/chatbox_menu/admin_chatbox.php	2009-08-15 06:54:07.000000000 -0500
@@ -11,17 +11,16 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/chatbox_menu/admin_chatbox.php,v $
-|     $Revision: 1.21 $
-|     $Date: 2007/01/28 13:51:57 $
-|     $Author: e107steved $
+|     $Revision: 1.22 $
+|     $Date: 2009/08/15 11:54:31 $
+|     $Author: marj_nl_fr $
 +----------------------------------------------------------------------------+
 */
 require_once("../../class2.php");
 
 if(!getperms("P")) { header("location:".e_BASE."index.php"); exit; }
 
-@include_once e_PLUGIN."chatbox_menu/languages/".e_LANGUAGE."/".e_LANGUAGE."_config.php";
-@include_once e_PLUGIN."chatbox_menu/languages/English/English_config.php";
+include_lan(e_PLUGIN."chatbox_menu/languages/".e_LANGUAGE."/".e_LANGUAGE."_config.php");
 
 require_once(e_ADMIN."auth.php");
 require_once(e_HANDLER."userclass_class.php");
diff -x .svn -aruN 0.7.15.src/e107_plugins/chatbox_menu/chatbox_menu.php 0.7.16.src/e107_plugins/chatbox_menu/chatbox_menu.php
--- 0.7.15.src/e107_plugins/chatbox_menu/chatbox_menu.php	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_plugins/chatbox_menu/chatbox_menu.php	2009-08-23 05:39:28.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/chatbox_menu/chatbox_menu.php,v $
-|     $Revision: 1.79 $
-|     $Date: 2008/06/26 19:40:37 $
-|     $Author: e107steved $
+|     $Revision: 1.81 $
+|     $Date: 2009/08/23 10:39:52 $
+|     $Author: marj_nl_fr $
 +----------------------------------------------------------------------------+
 */
 
@@ -27,8 +27,7 @@
 
 		//Normally the menu.sc file will auto-load the language file, this is needed in case
 		//ajax is turned on and the menu is not loaded from the menu.sc
-		@include_lan(e_PLUGIN."chatbox_menu/languages/".e_LANGUAGE."/".e_LANGUAGE.".php");
-		@include_lan(e_PLUGIN."chatbox_menu/languages/English/English.php");
+		include_lan(e_PLUGIN."chatbox_menu/languages/".e_LANGUAGE."/".e_LANGUAGE.".php");
 	}
 	$footer_js[] = e_FILE_ABS.'e_ajax.js';
 }
@@ -204,9 +203,17 @@
 			$cb_message = str_replace($search, $replace, $cb_message);
 
 			global $CHATBOXSTYLE;
-			if(!$CHATBOXSTYLE)
+			if( ! $CHATBOXSTYLE)
 			{
-				$bullet = (defined("BULLET") ? "<img src='".THEME_ABS."images/".BULLET."' alt='' style='vertical-align: middle;' />" : "<img src='".THEME_ABS."images/".(defined("BULLET") ? BULLET : "bullet2.gif")."' alt='' style='vertical-align: middle;' />");
+				$bullet = '';
+				if(defined('BULLET'))
+				{
+					$bullet = '<img src="'.THEME.'images/'.BULLET.'" alt="" style="vertical-align: middle;" />';
+				}
+				elseif(file_exists(THEME.'images/bullet2.gif'))
+				{
+					$bullet = '<img src="'.THEME.'images/bullet2.gif" alt="" style="vertical-align: middle;" />';
+				}
 				// default chatbox style
 				$CHATBOXSTYLE = "<!-- chatbox -->\n<div class='spacer'>
 				$bullet <b>{USERNAME}</b><br /><span class='smalltext'>{TIMEDATE}</span><br /><div class='smallblacktext'>{MESSAGE}</div></div><br />\n";
diff -x .svn -aruN 0.7.15.src/e107_plugins/chatbox_menu/chat_template.php 0.7.16.src/e107_plugins/chatbox_menu/chat_template.php
--- 0.7.15.src/e107_plugins/chatbox_menu/chat_template.php	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_plugins/chatbox_menu/chat_template.php	2009-08-23 05:39:28.000000000 -0500
@@ -7,14 +7,18 @@
 		$CHAT_TABLE_START = "
 		<br /><table style='width:100%'><tr><td>";
 }
-if(!$CHAT_TABLE){
-		$CHAT_TABLE = "\n
+if(!$CHAT_TABLE)
+{
+//TODO review bullet
+		$CHAT_TABLE = "
 		<div class='spacer'>
 			<div class='{CHAT_TABLE_FLAG}'>
-				<img src='".THEME."images/bullet2.gif' alt='bullet' /> \n<b>{CHAT_TABLE_NICK}</b> ".CHATBOX_L22." {CHAT_TABLE_DATESTAMP}<br />
-				<div class='defaulttext'><i>{CHAT_TABLE_MESSAGE}</i></div>\n
+				<img src='".THEME."images/bullet2.gif' alt='bullet' />
+				<b>{CHAT_TABLE_NICK}</b> ".CHATBOX_L22." {CHAT_TABLE_DATESTAMP}
+				<br />
+				<div class='defaulttext'><i>{CHAT_TABLE_MESSAGE}</i></div>
 			</div>
-		</div>\n";
+		</div>";
 
 }
 if(!$CHAT_TABLE_END){
diff -x .svn -aruN 0.7.15.src/e107_plugins/chatbox_menu/languages/English/English.php 0.7.16.src/e107_plugins/chatbox_menu/languages/English/English.php
--- 0.7.15.src/e107_plugins/chatbox_menu/languages/English/English.php	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_plugins/chatbox_menu/languages/English/English.php	2009-05-26 15:05:12.000000000 -0500
@@ -11,15 +11,15 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/chatbox_menu/languages/English/English.php,v $
-|     $Revision: 1.7 $
-|     $Date: 2006/10/21 11:22:03 $
-|     $Author: mrpete $
+|     $Revision: 1.8 $
+|     $Date: 2009/05/26 20:05:36 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 
 define("CHATBOX_L1", "Unable to accept post as that username is registered - if it is your username please login to post.");
 define("CHATBOX_L2", "Chatbox");
-define("CHATBOX_L3", "You must be logged in to post comments on this site - please either log in or if you are not registered click <a href='".e_BASE."signup.php'>here</a> to signup");
+define("CHATBOX_L3", "You must be logged in to post comments on this site - please either log in or if you are not registered click <a href='".e_SIGNUP."'>here</a> to signup");
 define("CHATBOX_L4", "Submit");
 define("CHATBOX_L5", "Reset");
 define("CHATBOX_L6", "[blocked by admin]");
diff -x .svn -aruN 0.7.15.src/e107_plugins/clock_menu/clock_menu.php 0.7.16.src/e107_plugins/clock_menu/clock_menu.php
--- 0.7.15.src/e107_plugins/clock_menu/clock_menu.php	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_plugins/clock_menu/clock_menu.php	2009-08-15 06:54:07.000000000 -0500
@@ -17,9 +17,9 @@
 | GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/clock_menu/clock_menu.php,v $
-|     $Revision: 1.16 $
-|     $Date: 2005/12/14 19:28:43 $
-|     $Author: sweetas $
+|     $Revision: 1.17 $
+|     $Date: 2009/08/15 11:54:31 $
+|     $Author: marj_nl_fr $
 +---------------------------------------------------------------+
 */
 
@@ -35,9 +35,10 @@
 	}
 }
 
-$ec_dir = e_PLUGIN."clock_menu/";
-$lan_file = $ec_dir."languages/".e_LANGUAGE.".php";
-e107_include_once(file_exists($lan_file) ? $lan_file : e_PLUGIN."clock_menu/languages/English.php");
+//$ec_dir = e_PLUGIN."clock_menu/";
+
+include_lan(e_PLUGIN."clock_menu/languages/".e_LANGUAGE.".php");
+
 if (!defined("e_HTTP")) {
 	exit;
 }
diff -x .svn -aruN 0.7.15.src/e107_plugins/clock_menu/config.php 0.7.16.src/e107_plugins/clock_menu/config.php
--- 0.7.15.src/e107_plugins/clock_menu/config.php	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_plugins/clock_menu/config.php	2009-08-15 06:54:07.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/clock_menu/config.php,v $
-|     $Revision: 1.7 $
-|     $Date: 2005/06/01 06:40:09 $
-|     $Author: e107coders $
+|     $Revision: 1.8 $
+|     $Date: 2009/08/15 11:54:31 $
+|     $Author: marj_nl_fr $
 +----------------------------------------------------------------------------+
 */
 $eplug_admin = TRUE;
@@ -23,8 +23,8 @@
 	 exit ;
 }
 require_once(e_ADMIN."auth.php");
-@include_once(e_PLUGIN."clock_menu/languages/admin/".e_LANGUAGE.".php");
-@include_once(e_PLUGIN."clock_menu/languages/admin/English.php");
+include_lan(e_PLUGIN."clock_menu/languages/admin/".e_LANGUAGE.".php");
+
 require_once(e_HANDLER."form_handler.php");
 $rs = new form;
 	
diff -x .svn -aruN 0.7.15.src/e107_plugins/comment_menu/comment_menu_shortcodes.php 0.7.16.src/e107_plugins/comment_menu/comment_menu_shortcodes.php
--- 0.7.15.src/e107_plugins/comment_menu/comment_menu_shortcodes.php	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_plugins/comment_menu/comment_menu_shortcodes.php	2009-08-23 05:39:29.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/comment_menu/comment_menu_shortcodes.php,v $
-|     $Revision: 1.2 $
-|     $Date: 2007/02/08 22:35:09 $
-|     $Author: e107steved $
+|     $Revision: 1.3 $
+|     $Date: 2009/08/23 10:39:53 $
+|     $Author: marj_nl_fr $
 +----------------------------------------------------------------------------+
 */
 if (!defined('e107_INIT')) { exit; }
@@ -22,7 +22,16 @@
 
 /*
 SC_BEGIN CM_ICON
-return (defined("BULLET") ? "<img src='".THEME_ABS."images/".BULLET."' alt='' style='border:0; vertical-align: middle;' />" : "<img src='".THEME_ABS."images/bullet2.gif' alt='bullet' style='border:0; vertical-align: middle;' />");
+$bullet = '';
+if(defined('BULLET'))
+{
+	$bullet = '<img src="'.THEME.'images/'.BULLET.'" alt="" style="vertical-align: middle;" />';
+}
+elseif(file_exists(THEME.'images/bullet2.gif'))
+{
+	$bullet = '<img src="'.THEME.'images/bullet2.gif" alt="" style="vertical-align: middle;" />';
+}
+return $bullet;
 SC_END
 
 SC_BEGIN CM_DATESTAMP
diff -x .svn -aruN 0.7.15.src/e107_plugins/content/content.php 0.7.16.src/e107_plugins/content/content.php
--- 0.7.15.src/e107_plugins/content/content.php	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_plugins/content/content.php	2009-01-29 09:26:13.000000000 -0600
@@ -12,9 +12,9 @@
 |        GNU General Public License (http://gnu.org).
 |
 |		$Source: /cvsroot/e107/e107_0.7/e107_plugins/content/content.php,v $
-|		$Revision: 1.114 $
-|		$Date: 2008/06/27 21:22:19 $
-|		$Author: e107steved $
+|		$Revision: 1.115 $
+|		$Date: 2009/01/29 15:26:37 $
+|		$Author: lisa_ $
 +---------------------------------------------------------------+
 */
 
@@ -1153,6 +1153,26 @@
 		global $CONTENT_CONTENT_TABLE_TEXT, $CONTENT_CONTENT_TABLE_PAGENAMES, $CONTENT_CONTENT_TABLE_SUMMARY, $CONTENT_CONTENT_TABLE_CUSTOM_TAGS, $CONTENT_CONTENT_TABLE_PARENT, $CONTENT_CONTENT_TABLE_INFO_PRE, $CONTENT_CONTENT_TABLE_INFO_POST, $CONTENT_CONTENT_TABLE_AUTHORDETAILS, $CONTENT_CONTENT_TABLE_INFO_PRE_HEADDATA, $CONTENT_CONTENT_TABLE_INFO_POST_HEADDATA;
 		global $CONTENT_CONTENT_TABLE_PREV_PAGE, $CONTENT_CONTENT_TABLE_NEXT_PAGE;
 
+		//if we get here through the rated auto-redirect
+		//we need to delete cache and redirect to the normal item url
+		if($qs[2]=='rated' || (is_numeric($qs[2]) && $qs[3]=='rated') )
+		{
+			$e107cache->clear("$plugintable.content.$qs[1]");
+			$e107cache->clear("comment.$plugintable.$qs[1]");
+			//and reset qs[2]
+			if($qs[2]=='rated')
+			{
+				$qs[2] = '';
+				$qry = e_SELF."?content.".$qs[1];
+			}
+			else
+			{
+				$qs[3] = '';
+				$qry = e_SELF."?content.".$qs[1].".".$qs[2];
+			}
+			header("location:".$qry); exit;
+		}
+
 		$mainparent			= $aa -> getMainParent(intval($qs[1]));
 		$content_pref		= $aa -> getContentPref($mainparent);
 		
diff -x .svn -aruN 0.7.15.src/e107_plugins/content/content_shortcodes.php 0.7.16.src/e107_plugins/content/content_shortcodes.php
--- 0.7.15.src/e107_plugins/content/content_shortcodes.php	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_plugins/content/content_shortcodes.php	2009-01-29 09:26:13.000000000 -0600
@@ -835,7 +835,12 @@
 SC_BEGIN CONTENT_CONTENT_TABLE_RATING
 global $CONTENT_CONTENT_TABLE_RATING, $content_pref, $qs, $row, $rater, $plugintable, $mainparent;
 if(($content_pref["content_content_rating"] && $row['content_rate']) || $content_pref["content_content_rating_all"] ){
-return $rater->composerating($plugintable, $row['content_id'], $enter=TRUE, $userid=FALSE);
+	//return $rater->composerating($plugintable, $row['content_id'], $enter=TRUE, $userid=FALSE);
+	$tmp = $_SERVER['QUERY_STRING'];
+	$_SERVER['QUERY_STRING'] .= ".rated";
+	$text = $rater->composerating($plugintable, $row['content_id'], $enter=TRUE, $userid=FALSE);
+	$_SERVER['QUERY_STRING'] = $tmp;
+	return $text;
 }
 SC_END
 
diff -x .svn -aruN 0.7.15.src/e107_plugins/content/e_frontpage.php 0.7.16.src/e107_plugins/content/e_frontpage.php
--- 0.7.15.src/e107_plugins/content/e_frontpage.php	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_plugins/content/e_frontpage.php	2009-08-15 06:54:07.000000000 -0500
@@ -2,8 +2,7 @@
 
 if (!defined('e107_INIT')) { exit; }
 
-@include_once(e_PLUGIN.'content/languages/'.e_LANGUAGE.'/lan_content_frontpage.php');
-@include_once(e_PLUGIN.'content/languages/English/lan_content_frontpage.php');
+include_lan(e_PLUGIN.'content/languages/'.e_LANGUAGE.'/lan_content_frontpage.php');
 
 $sql2 = new db;
 if ($sql2 -> db_Select("pcontent", "content_id, content_heading", "LEFT(content_parent,1)='0'")) {
diff -x .svn -aruN 0.7.15.src/e107_plugins/content/e_help.php 0.7.16.src/e107_plugins/content/e_help.php
--- 0.7.15.src/e107_plugins/content/e_help.php	1969-12-31 18:00:00.000000000 -0600
+++ 0.7.16.src/e107_plugins/content/e_help.php	2009-07-19 04:32:00.000000000 -0500
@@ -0,0 +1,108 @@
+<?php
+if (!defined('e107_INIT')) { exit; }
+
+global $plugindir;
+require_once($plugindir."handlers/content_defines.php");
+$lan_file = $plugindir.'languages/'.e_LANGUAGE.'/lan_content_help.php';
+include_once(file_exists($lan_file) ? $lan_file : $plugindir.'languages/English/lan_content_help.php');
+
+
+//$arrhide = array("creation", "submission", "paththeme", "general", "contentmanager", "menu", "recentpages", "catpages", "contentpages", "authorpage", "archivepage", "toppage", "scorepage");
+
+
+if(!e_QUERY){
+	$text = CONTENT_ADMIN_HELP_ITEM_1;
+}else{
+	$qs = explode(".", e_QUERY);
+
+	//##### CONTENT --------------------------------------------------
+		//manage content items
+		if($qs[0] == "content" && is_numeric($qs[1]) ){
+			$text = CONTENT_ADMIN_HELP_ITEM_2;
+
+		//edit content item
+		}elseif($qs[0] == "content" && $qs[1] == "edit" && is_numeric($qs[2]) ){
+			$text = CONTENT_ADMIN_HELP_ITEMEDIT_1;
+
+		//post submitted content item
+		}elseif($qs[0] == "content" && $qs[1] == "sa" && is_numeric($qs[2]) ){
+			$text = CONTENT_ADMIN_HELP_ITEMCREATE_2;
+
+		//create content item
+		}elseif($qs[0] == "content" && $qs[1] == "create" ){
+			//Create New Content (no category selected)
+			if(!isset($qs[2])){
+				$text = CONTENT_ADMIN_HELP_ITEMCREATE_1;
+
+			//Create New Content (category selected)
+			}elseif(is_numeric($qs[2])){
+				$text = CONTENT_ADMIN_HELP_ITEMCREATE_2;
+			}
+
+	//##### ORDER --------------------------------------------------
+		//order : view categories
+		}elseif($qs[0] == "order" && (!isset($qs[1]) || $qs[1] == "inc" || $qs[1] == "dec")){
+			$text = CONTENT_ADMIN_HELP_ORDER_1;
+
+		//order global items of parent='2'
+		}elseif($qs[0] == "order" && is_numeric($qs[1]) && (!isset($qs[2]) || $qs[2] == "inc" || $qs[2] == "dec") ){
+			$text = CONTENT_ADMIN_HELP_ORDER_3;
+
+		//order items with parent=2 or category='5'
+		}elseif($qs[0] == "order" && is_numeric($qs[1]) && is_numeric($qs[2]) && (!isset($qs[3]) || $qs[3] == "inc" || $qs[3] == "dec") ){
+			$text = CONTENT_ADMIN_HELP_ORDER_2;
+
+	//##### SUBMITTED --------------------------------------------------
+		}elseif($qs[0] == "submitted" && !isset($qs[1]) ){
+			$text = CONTENT_ADMIN_HELP_SUBMIT_1;
+
+	//##### OPTION --------------------------------------------------
+		//option: mainpage
+		}elseif($qs[0] == "option" && !isset($qs[1]) ){
+			$text = CONTENT_ADMIN_HELP_OPTION_1;
+
+		//option: with main parent selected, show all options
+		}elseif($qs[0] == "option" && isset($qs[1]) && (is_numeric($qs[1]) || $qs[1] == "default") ){
+			//$text = CONTENT_ADMIN_HELP_OPTION_2;
+			$text .= "
+			<div id='creationhelp'>".CONTENT_ADMIN_HELP_OPTION_DIV_1."</div>
+			<div id='catcreationhelp' style='display:none;'>".CONTENT_ADMIN_HELP_OPTION_DIV_14."</div>
+			<div id='submissionhelp' style='display:none;'>".CONTENT_ADMIN_HELP_OPTION_DIV_2."</div>
+			<div id='paththemehelp' style='display:none;'>".CONTENT_ADMIN_HELP_OPTION_DIV_3."</div>
+			<div id='generalhelp' style='display:none;'>".CONTENT_ADMIN_HELP_OPTION_DIV_4."</div>
+			<div id='menuhelp' style='display:none;'>".CONTENT_ADMIN_HELP_OPTION_DIV_6."</div>
+			<div id='recentpageshelp' style='display:none;'>".CONTENT_ADMIN_HELP_OPTION_DIV_7."</div>
+			<div id='catpageshelp' style='display:none;'>".CONTENT_ADMIN_HELP_OPTION_DIV_8."</div>
+			<div id='contentpageshelp' style='display:none;'>".CONTENT_ADMIN_HELP_OPTION_DIV_9."</div>
+			<div id='authorpagehelp' style='display:none;'>".CONTENT_ADMIN_HELP_OPTION_DIV_10."</div>
+			<div id='archivepagehelp' style='display:none;'>".CONTENT_ADMIN_HELP_OPTION_DIV_11."</div>
+			<div id='toppagehelp' style='display:none;'>".CONTENT_ADMIN_HELP_OPTION_DIV_12."</div>
+			<div id='scorepagehelp' style='display:none;'>".CONTENT_ADMIN_HELP_OPTION_DIV_13."</div>
+			";
+
+	//##### CATEGORY --------------------------------------------------
+		//category content manager : choose category
+		}elseif($qs[0] == "manager" && !isset($qs[1]) ){
+			$text = CONTENT_ADMIN_HELP_MANAGER_1;
+
+		//category content manager : view contentmanager
+		}elseif($qs[0] == "manager" && isset($qs[1]) && is_numeric($qs[1]) ){
+			$text = CONTENT_ADMIN_HELP_MANAGER_2;
+
+		//overview all categories
+		}elseif($qs[0] == "cat" && !isset($qs[1]) ){
+			$text = CONTENT_ADMIN_HELP_CAT_1;
+
+		//create category
+		}elseif($qs[0] == "cat" && $qs[1] == "create" ){
+			$text = CONTENT_ADMIN_HELP_CAT_2;
+
+		//edit category
+		}elseif($qs[0] == "cat" && $qs[1] == "edit" && is_numeric($qs[2]) ){
+			$text = CONTENT_ADMIN_HELP_CAT_3;
+
+		}
+}
+$ns -> tablerender(CONTENT_ADMIN_HELP_1, $text);
+
+?>
\ No newline at end of file
diff -x .svn -aruN 0.7.15.src/e107_plugins/content/handlers/content_class.php 0.7.16.src/e107_plugins/content/handlers/content_class.php
--- 0.7.15.src/e107_plugins/content/handlers/content_class.php	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_plugins/content/handlers/content_class.php	2009-08-23 05:39:28.000000000 -0500
@@ -12,9 +12,9 @@
 |        GNU General Public License (http://gnu.org).
 |
 |		$Source: /cvsroot/e107/e107_0.7/e107_plugins/content/handlers/content_class.php,v $
-|		$Revision: 1.111 $
-|		$Date: 2007/03/01 09:34:49 $
-|		$Author: lisa_ $
+|		$Revision: 1.112 $
+|		$Date: 2009/08/23 10:39:52 $
+|		$Author: marj_nl_fr $
 +---------------------------------------------------------------+
 */
 
@@ -1301,9 +1301,18 @@
 			$data .= "\n";
 			$data .= "\$lan_file = e_PLUGIN.'content/languages/'.e_LANGUAGE.'/lan_content.php';\n";
 			$data .= "include_once(file_exists(\$lan_file) ? \$lan_file : e_PLUGIN.'content/languages/English/lan_content.php');\n";
-			$data .= "\n";
-			$data .= "\$bullet = (defined('BULLET') ? \"<img src='\".THEME_ABS.\"images/\".BULLET.\"' alt='' style='border:0;vertical-align: middle;' />\" : \"<img src='\".THEME_ABS.\"images/bullet2.gif' alt='bullet' style='border:0;vertical-align: middle;' />\");\n";
-			$data .= "\n";
+			$data .= '
+					$bullet = \'\';
+					if(defined(\'BULLET\'))
+					{
+						$bullet = \'<img src="\'.THEME.\'images/\'.BULLET.\'" alt="" style="vertical-align: middle;" />\';
+					}
+					elseif(file_exists(THEME.\'images/bullet2.gif\'))
+					{
+						$bullet = \'<img src="\'.THEME.\'images/bullet2.gif" alt="" style="vertical-align: middle;" />\';
+					}
+			';
+
 			$data .= "\$content_pref					= \$aa -> getContentPref(\$menutypeid);\n";
 			$data .= "\$content_icon_path				= \$tp -> replaceConstants(\$content_pref[\"content_icon_path\"]);\n";
 			$data .= "\$content_cat_icon_path_small	= \$tp -> replaceConstants(\$content_pref[\"content_cat_icon_path_small\"]);\n";
diff -x .svn -aruN 0.7.15.src/e107_plugins/content/help.php 0.7.16.src/e107_plugins/content/help.php
--- 0.7.15.src/e107_plugins/content/help.php	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_plugins/content/help.php	1969-12-31 18:00:00.000000000 -0600
@@ -1,108 +0,0 @@
-<?php
-if (!defined('e107_INIT')) { exit; }
-
-global $plugindir;
-require_once($plugindir."handlers/content_defines.php");
-$lan_file = $plugindir.'languages/'.e_LANGUAGE.'/lan_content_help.php';
-include_once(file_exists($lan_file) ? $lan_file : $plugindir.'languages/English/lan_content_help.php');
-
-
-//$arrhide = array("creation", "submission", "paththeme", "general", "contentmanager", "menu", "recentpages", "catpages", "contentpages", "authorpage", "archivepage", "toppage", "scorepage");
-
-
-if(!e_QUERY){
-	$text = CONTENT_ADMIN_HELP_ITEM_1;
-}else{
-	$qs = explode(".", e_QUERY);
-
-	//##### CONTENT --------------------------------------------------
-		//manage content items
-		if($qs[0] == "content" && is_numeric($qs[1]) ){
-			$text = CONTENT_ADMIN_HELP_ITEM_2;
-
-		//edit content item
-		}elseif($qs[0] == "content" && $qs[1] == "edit" && is_numeric($qs[2]) ){
-			$text = CONTENT_ADMIN_HELP_ITEMEDIT_1;
-
-		//post submitted content item
-		}elseif($qs[0] == "content" && $qs[1] == "sa" && is_numeric($qs[2]) ){
-			$text = CONTENT_ADMIN_HELP_ITEMCREATE_2;
-
-		//create content item
-		}elseif($qs[0] == "content" && $qs[1] == "create" ){
-			//Create New Content (no category selected)
-			if(!isset($qs[2])){
-				$text = CONTENT_ADMIN_HELP_ITEMCREATE_1;
-
-			//Create New Content (category selected)
-			}elseif(is_numeric($qs[2])){
-				$text = CONTENT_ADMIN_HELP_ITEMCREATE_2;
-			}
-
-	//##### ORDER --------------------------------------------------
-		//order : view categories
-		}elseif($qs[0] == "order" && (!isset($qs[1]) || $qs[1] == "inc" || $qs[1] == "dec")){
-			$text = CONTENT_ADMIN_HELP_ORDER_1;
-
-		//order global items of parent='2'
-		}elseif($qs[0] == "order" && is_numeric($qs[1]) && (!isset($qs[2]) || $qs[2] == "inc" || $qs[2] == "dec") ){
-			$text = CONTENT_ADMIN_HELP_ORDER_3;
-
-		//order items with parent=2 or category='5'
-		}elseif($qs[0] == "order" && is_numeric($qs[1]) && is_numeric($qs[2]) && (!isset($qs[3]) || $qs[3] == "inc" || $qs[3] == "dec") ){
-			$text = CONTENT_ADMIN_HELP_ORDER_2;
-
-	//##### SUBMITTED --------------------------------------------------
-		}elseif($qs[0] == "submitted" && !isset($qs[1]) ){
-			$text = CONTENT_ADMIN_HELP_SUBMIT_1;
-
-	//##### OPTION --------------------------------------------------
-		//option: mainpage
-		}elseif($qs[0] == "option" && !isset($qs[1]) ){
-			$text = CONTENT_ADMIN_HELP_OPTION_1;
-
-		//option: with main parent selected, show all options
-		}elseif($qs[0] == "option" && isset($qs[1]) && (is_numeric($qs[1]) || $qs[1] == "default") ){
-			//$text = CONTENT_ADMIN_HELP_OPTION_2;
-			$text .= "
-			<div id='creationhelp'>".CONTENT_ADMIN_HELP_OPTION_DIV_1."</div>
-			<div id='catcreationhelp' style='display:none;'>".CONTENT_ADMIN_HELP_OPTION_DIV_14."</div>
-			<div id='submissionhelp' style='display:none;'>".CONTENT_ADMIN_HELP_OPTION_DIV_2."</div>
-			<div id='paththemehelp' style='display:none;'>".CONTENT_ADMIN_HELP_OPTION_DIV_3."</div>
-			<div id='generalhelp' style='display:none;'>".CONTENT_ADMIN_HELP_OPTION_DIV_4."</div>
-			<div id='menuhelp' style='display:none;'>".CONTENT_ADMIN_HELP_OPTION_DIV_6."</div>
-			<div id='recentpageshelp' style='display:none;'>".CONTENT_ADMIN_HELP_OPTION_DIV_7."</div>
-			<div id='catpageshelp' style='display:none;'>".CONTENT_ADMIN_HELP_OPTION_DIV_8."</div>
-			<div id='contentpageshelp' style='display:none;'>".CONTENT_ADMIN_HELP_OPTION_DIV_9."</div>
-			<div id='authorpagehelp' style='display:none;'>".CONTENT_ADMIN_HELP_OPTION_DIV_10."</div>
-			<div id='archivepagehelp' style='display:none;'>".CONTENT_ADMIN_HELP_OPTION_DIV_11."</div>
-			<div id='toppagehelp' style='display:none;'>".CONTENT_ADMIN_HELP_OPTION_DIV_12."</div>
-			<div id='scorepagehelp' style='display:none;'>".CONTENT_ADMIN_HELP_OPTION_DIV_13."</div>
-			";
-
-	//##### CATEGORY --------------------------------------------------
-		//category content manager : choose category
-		}elseif($qs[0] == "manager" && !isset($qs[1]) ){
-			$text = CONTENT_ADMIN_HELP_MANAGER_1;
-
-		//category content manager : view contentmanager
-		}elseif($qs[0] == "manager" && isset($qs[1]) && is_numeric($qs[1]) ){
-			$text = CONTENT_ADMIN_HELP_MANAGER_2;
-
-		//overview all categories
-		}elseif($qs[0] == "cat" && !isset($qs[1]) ){
-			$text = CONTENT_ADMIN_HELP_CAT_1;
-
-		//create category
-		}elseif($qs[0] == "cat" && $qs[1] == "create" ){
-			$text = CONTENT_ADMIN_HELP_CAT_2;
-
-		//edit category
-		}elseif($qs[0] == "cat" && $qs[1] == "edit" && is_numeric($qs[2]) ){
-			$text = CONTENT_ADMIN_HELP_CAT_3;
-
-		}
-}
-$ns -> tablerender(CONTENT_ADMIN_HELP_1, $text);
-
-?>
\ No newline at end of file
diff -x .svn -aruN 0.7.15.src/e107_plugins/content/plugin.php 0.7.16.src/e107_plugins/content/plugin.php
--- 0.7.15.src/e107_plugins/content/plugin.php	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_plugins/content/plugin.php	2009-08-15 06:54:07.000000000 -0500
@@ -16,8 +16,7 @@
 if (!defined('e107_INIT')) { exit; }
 
 global $PLUGINS_DIRECTORY;
-@include_once(e_PLUGIN.'content/languages/'.e_LANGUAGE.'/lan_content_admin.php');
-@include_once(e_PLUGIN.'content/languages/English/lan_content_admin.php');
+include_lan(e_PLUGIN.'content/languages/'.e_LANGUAGE.'/lan_content_admin.php');
 
 // Plugin info -------------------------------------------------------------------------------------------------------
 $eplug_name = "CONTENT_PLUGIN_LAN_1";
diff -x .svn -aruN 0.7.15.src/e107_plugins/content/search/search_parser.php 0.7.16.src/e107_plugins/content/search/search_parser.php
--- 0.7.15.src/e107_plugins/content/search/search_parser.php	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_plugins/content/search/search_parser.php	2009-03-26 17:18:20.000000000 -0500
@@ -11,8 +11,8 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/content/search/search_parser.php,v $
-|     $Revision: 1.7 $
-|     $Date: 2008/09/28 19:03:00 $
+|     $Revision: 1.8 $
+|     $Date: 2009/03/26 22:18:44 $
 |     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
@@ -54,7 +54,8 @@
 
 function search_content($row) 
 {
-	global $con, $sql;
+	global $con;
+	$sqlCon = new db;		// Use a separate DB to avoid interfering with main query
 	$res['link'] = e_PLUGIN."content/content.php?content.".$row['content_id'];
 	$res['pre_title'] = "";
 	$res['title'] = $row['content_heading'];
@@ -85,8 +86,8 @@
 		WHERE c.content_id = '".$row['content_id']."' ";
 	}
 	
-	$sql -> db_Select_gen($qry);
-	$cat = $sql -> db_Fetch();
+	$sqlCon -> db_Select_gen($qry);
+	$cat = $sqlCon -> db_Fetch();
 
 	$res['detail'] = LAN_SEARCH_3.$con -> convert_date($row['content_datestamp'], "long")." ".CONT_SCH_LAN_4." ".$cat['content_heading'];
 	return $res;
diff -x .svn -aruN 0.7.15.src/e107_plugins/featurebox/plugin.php 0.7.16.src/e107_plugins/featurebox/plugin.php
--- 0.7.15.src/e107_plugins/featurebox/plugin.php	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_plugins/featurebox/plugin.php	2009-08-15 06:54:07.000000000 -0500
@@ -11,16 +11,15 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/featurebox/plugin.php,v $
-|     $Revision: 1.8 $
-|     $Date: 2008/09/02 21:12:08 $
-|     $Author: e107steved $
+|     $Revision: 1.9 $
+|     $Date: 2009/08/15 11:54:31 $
+|     $Author: marj_nl_fr $
 +----------------------------------------------------------------------------+
 */
 
 if (!defined('e107_INIT')) { exit; }
 
-@include_once(e_PLUGIN."featurebox/languages/".e_LANGUAGE.".php");
-@include_once(e_PLUGIN."featurebox/languages/English.php");
+include_lan(e_PLUGIN."featurebox/languages/".e_LANGUAGE.".php");
 
 // Plugin info -------------------------------------------------------------------------------------------------------
 $eplug_name = 'FBLAN_01';
diff -x .svn -aruN 0.7.15.src/e107_plugins/forum/e_frontpage.php 0.7.16.src/e107_plugins/forum/e_frontpage.php
--- 0.7.15.src/e107_plugins/forum/e_frontpage.php	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_plugins/forum/e_frontpage.php	2009-08-15 06:54:07.000000000 -0500
@@ -2,8 +2,7 @@
 
 if (!defined('e107_INIT')) { exit; }
 
-@include_once(e_PLUGIN.'forum/languages/'.e_LANGUAGE.'/lan_forum_frontpage.php');
-@include_once(e_PLUGIN.'forum/languages/English/lan_forum_frontpage.php');
+include_lan(e_PLUGIN.'forum/languages/'.e_LANGUAGE.'/lan_forum_frontpage.php');
 
 $front_page['forum'] = array('page' => $PLUGINS_DIRECTORY.'forum/forum.php', 'title' => FOR_FP_1);
 
diff -x .svn -aruN 0.7.15.src/e107_plugins/forum/forum_admin.php 0.7.16.src/e107_plugins/forum/forum_admin.php
--- 0.7.15.src/e107_plugins/forum/forum_admin.php	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_plugins/forum/forum_admin.php	2009-08-15 06:54:07.000000000 -0500
@@ -11,15 +11,14 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/forum/forum_admin.php,v $
-|     $Revision: 1.48 $
-|     $Date: 2007/11/11 23:45:33 $
-|     $Author: mcfly_e107 $
+|     $Revision: 1.49 $
+|     $Date: 2009/08/15 11:54:31 $
+|     $Author: marj_nl_fr $
 +----------------------------------------------------------------------------+
 */
 $eplug_admin = true;
 require_once("../../class2.php");
-@include_once e_PLUGIN.'forum/languages/'.e_LANGUAGE.'/lan_forum_admin.php';
-@include_once e_PLUGIN.'forum/languages/English/lan_forum_admin.php';
+include_lan(e_PLUGIN.'forum/languages/'.e_LANGUAGE.'/lan_forum_admin.php');
 
 if (!getperms("P"))
 {
diff -x .svn -aruN 0.7.15.src/e107_plugins/forum/forum_class.php 0.7.16.src/e107_plugins/forum/forum_class.php
--- 0.7.15.src/e107_plugins/forum/forum_class.php	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_plugins/forum/forum_class.php	2009-08-16 10:52:36.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/forum/forum_class.php,v $
-|     $Revision: 1.72 $
-|     $Date: 2008/10/03 19:27:49 $
-|     $Author: e107steved $
+|     $Revision: 1.73 $
+|     $Date: 2009/08/16 15:53:00 $
+|     $Author: e107steved $	   ** Amended by Marj to re-order list line 818 - 851
 +----------------------------------------------------------------------------+
 */
 if (!defined('e107_INIT')) { exit; }
@@ -753,7 +753,7 @@
 				$gen = new convert;
 				$email_name = $parent_thread[0]['user_name'];
 				$email_addy = $parent_thread[0]['user_email'];
-				$message = LAN_384.SITENAME.".<br /><br />". LAN_382.$datestamp."<br />". LAN_94.": ".$thread_poster['post_user_name']."<br /><br />". LAN_385.$email_post."<br /><br />". LAN_383."<br /><br />".$mail_link;
+				$message = LAN_384.SITENAME.".<br /><br />". LAN_382.$datestamp."<br />". LAN_94.": ".$thread_poster['post_user_name']."<br /><br />". LAN_385.$tp->toHTML($email_post, TRUE, 'USER_BODY')."<br /><br />". LAN_383."<br /><br />".$mail_link;
 				include_once(e_HANDLER."mail.php");
 				sendemail($email_addy, $pref['forum_eprefix']." '".$thread_name."', ".LAN_381.SITENAME, $message, $email_name);
 			}
@@ -763,7 +763,7 @@
 			if ($pref['forum_track'] && $sql->db_Select("user", "user_id, user_email, user_name", "user_realm REGEXP('-".intval($thread_parent)."-') "))
 			{
 				include_once(e_HANDLER.'mail.php');
-				$message = LAN_385.SITENAME.".<br /><br />". LAN_382.$datestamp."<br />". LAN_94.": ".$thread_poster['post_user_name']."<br /><br />". LAN_385.$email_post."<br /><br />". LAN_383."<br /><br />".$mail_link;
+				$message = LAN_385.SITENAME.".<br /><br />". LAN_382.$datestamp."<br />". LAN_94.": ".$thread_poster['post_user_name']."<br /><br />". LAN_385.$tp->toHTML($email_post, TRUE, 'USER_BODY')."<br /><br />". LAN_383."<br /><br />".$mail_link;
 				while ($row = $sql->db_Fetch())
 				{	// Don't sent to self, nor to originator of thread if they've got 'notify' set
 					if ($row['user_email'] && ($row['user_email'] != $email_addy) && ($row['user_id'] != USERID))	// (May be wrong, but this could be faster than filtering current user in the query)
@@ -814,6 +814,41 @@
 		}
 		return $ret;
 	}
+	
+	//*** added by marj
+        function postGetOldestNew($count = 50, $userviewed = USERVIEWED)
+        {
+                global $sql;
+                $viewed = '';
+                if($userviewed)
+                {
+                        $viewed = preg_replace('#\.+#', '.', $userviewed);
+                        $viewed = preg_replace('#^\.#', '', $viewed);
+                        $viewed = preg_replace('#\.$#', '', $viewed);
+                        $viewed = str_replace('.', ',', $viewed);
+                }
+                if($viewed != '')
+                {
+                        $viewed = ' AND ft.thread_id NOT IN ('.$viewed.') AND  ft.thread_parent NOT IN ('.$viewed.') ';
+                }
+
+                $qry = '
+                SELECT ft.*, fp.thread_name as post_subject, fp.thread_total_replies as replies, u.user_id, u.user_name, f.forum_class, f.forum_name
+                FROM #forum_t AS ft
+                LEFT JOIN #forum_t as fp ON fp.thread_id = ft.thread_parent
+                LEFT JOIN #user as u ON u.user_id = SUBSTRING_INDEX(ft.thread_user,".",1)
+                LEFT JOIN #forum as f ON f.forum_id = ft.thread_forum_id
+                WHERE ft.thread_datestamp > '.USERLV. '
+                AND f.forum_class IN ('.USERCLASS_LIST.')
+        '.$viewed.'
+                ORDER BY ft.thread_datestamp ASC LIMIT 0, '.intval($count);
+                if($sql->db_Select_gen($qry))
+                {
+                        $ret = $sql->db_getList();
+                }
+                return $ret;
+        }
+//*** end added by marj
 
 	function forum_prune($type, $days, $forumArray)
 	{
diff -x .svn -aruN 0.7.15.src/e107_plugins/forum/forum_conf.php 0.7.16.src/e107_plugins/forum/forum_conf.php
--- 0.7.15.src/e107_plugins/forum/forum_conf.php	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_plugins/forum/forum_conf.php	2009-08-15 06:54:07.000000000 -0500
@@ -11,14 +11,13 @@
 | GNU General Public License (http://gnu.org).
 |
 | $Source: /cvsroot/e107/e107_0.7/e107_plugins/forum/forum_conf.php,v $
-| $Revision: 1.11 $
-| $Date: 2007/09/26 19:28:41 $
-| $Author: e107steved $
+| $Revision: 1.12 $
+| $Date: 2009/08/15 11:54:31 $
+| $Author: marj_nl_fr $
 +---------------------------------------------------------------+
 */
 require_once("../../class2.php");
-@include_once e_PLUGIN.'forum/languages/'.e_LANGUAGE.'/lan_forum_conf.php';
-@include_once e_PLUGIN.'forum/languages/English/lan_forum_conf.php';
+include_lan(e_PLUGIN.'forum/languages/'.e_LANGUAGE.'/lan_forum_conf.php');
 
 $e_sub_cat = 'forum';
 	
diff -x .svn -aruN 0.7.15.src/e107_plugins/forum/forum_mod.php 0.7.16.src/e107_plugins/forum/forum_mod.php
--- 0.7.15.src/e107_plugins/forum/forum_mod.php	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_plugins/forum/forum_mod.php	2009-08-15 06:54:07.000000000 -0500
@@ -11,15 +11,14 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/forum/forum_mod.php,v $
-|     $Revision: 1.13 $
-|     $Date: 2007/11/11 23:45:34 $
-|     $Author: mcfly_e107 $
+|     $Revision: 1.15 $
+|     $Date: 2009/08/15 11:54:31 $
+|     $Author: marj_nl_fr $
 +----------------------------------------------------------------------------+
 */
 if (!defined('e107_INIT')) { exit; }
 
-@include_once e_PLUGIN.'forum/languages/'.e_LANGUAGE.'/lan_forum_admin.php';
-@include_once e_PLUGIN.'forum/languages/English/lan_forum_admin.php';
+include_lan(e_PLUGIN.'forum/languages/'.e_LANGUAGE.'/lan_forum_admin.php');
 
 function forum_thread_moderate($p)
 {
@@ -110,7 +109,7 @@
 			// delete the post itself
 			$sql->db_Delete("forum_t", "thread_id=".$thread_id);
 			// update thread/reply counts
-			$sql->db_Update("forum", "forum_threads = CAST(GREATEST(CAST(forum_threads AS SIGNED) - 1, 0) AS UNSIGNED), forum_threads = CAST(GREATEST(CAST(forum_replies AS SIGNED) - {$count}, 0) AS UNSIGNED) WHERE forum_id=".$row['thread_forum_id']);
+			$sql->db_Update("forum", "forum_threads = CAST(GREATEST(CAST(forum_threads AS SIGNED) - 1, 0) AS UNSIGNED), forum_replies = CAST(GREATEST(CAST(forum_replies AS SIGNED) - {$count}, 0) AS UNSIGNED) WHERE forum_id=".$row['thread_forum_id']);
 
 			// update lastpost info
 			$f->update_lastpost('forum', $row['thread_forum_id']);
diff -x .svn -aruN 0.7.15.src/e107_plugins/forum/forum_post.php 0.7.16.src/e107_plugins/forum/forum_post.php
--- 0.7.15.src/e107_plugins/forum/forum_post.php	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_plugins/forum/forum_post.php	2009-05-26 15:08:31.000000000 -0500
@@ -11,8 +11,8 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/forum/forum_post.php,v $
-|     $Revision: 1.87 $
-|     $Date: 2008/01/18 21:08:06 $
+|     $Revision: 1.88 $
+|     $Date: 2009/05/26 20:08:55 $
 |     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
@@ -551,7 +551,7 @@
 		<br />
 		<input type='checkbox' name='autologin' value='1' /> ".LAN_11."
 		<br /><br />
-		[ <a href='".e_BASE."signup.php'>".LAN_174."</a> ]<br />[ <a href='fpw.php'>".LAN_212."</a> ]
+		[ <a href='".e_SIGNUP."'>".LAN_174."</a> ]<br />[ <a href='".e_BASE."fpw.php'>".LAN_212."</a> ]
 		</p>
 		</form>
 		</div>";
diff -x .svn -aruN 0.7.15.src/e107_plugins/forum/forum_stats.php 0.7.16.src/e107_plugins/forum/forum_stats.php
--- 0.7.15.src/e107_plugins/forum/forum_stats.php	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_plugins/forum/forum_stats.php	2009-07-30 05:07:19.000000000 -0500
@@ -11,22 +11,21 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/forum/forum_stats.php,v $
-|     $Revision: 1.16 $
-|     $Date: 2008/06/26 19:59:04 $
-|     $Author: e107steved $
+|     $Revision: 1.17 $
+|     $Date: 2009/07/30 10:07:43 $
+|     $Author: marj_nl_fr $
 +----------------------------------------------------------------------------+
 */
 
 require_once('../../class2.php');
 
-@include_once e_PLUGIN.'forum/languages/'.e_LANGUAGE.'/lan_forum_stats.php';
-@include_once e_PLUGIN.'forum/languages/English/lan_forum_stats.php';
+include_lan(e_PLUGIN.'forum/languages/'.e_LANGUAGE.'/lan_forum_stats.php');
 @require_once(e_PLUGIN.'forum/forum_class.php');
 $gen = new convert;
 
 $barl = (file_exists(THEME."images/barl.png") ? THEME."images/barl.png" : e_PLUGIN."poll/images/barl.png");
 $barr = (file_exists(THEME."images/barr.png") ? THEME."images/barr.png" : e_PLUGIN."poll/images/barr.png");
-$bar = (file_exists(THEME."images/bar.png") ? THEME."images/bar.png" : e_PLUGIN."poll/images/bar.png");
+$bar  = (file_exists(THEME."images/bar.png") ? THEME."images/bar.png" : e_PLUGIN."poll/images/bar.png");
 
 require_once(HEADERF);
 
@@ -71,8 +70,8 @@
 
 
 $query = "
-SELECT ft.thread_id, ft.thread_user, ft.thread_name, ft.thread_total_replies, ft.thread_datestamp, f.forum_class, u.user_name FROM #forum_t as ft
-LEFT JOIN #user AS u ON ft.thread_user = u.user_id
+SELECT ft.thread_id, ft.thread_user, ft.thread_name, ft.thread_total_replies, ft.thread_datestamp, f.forum_class, u.user_name, u.user_id FROM #forum_t as ft
+LEFT JOIN #user AS u ON SUBSTRING_INDEX(ft.thread_user,'.',1) = u.user_id
 LEFT JOIN #forum AS f ON f.forum_id = ft.thread_forum_id
 WHERE ft.thread_parent = 0
 AND ft.thread_active != 0
@@ -82,8 +81,8 @@
 $most_activeArray = $sql -> db_getList();
 
 $query = "
-SELECT ft.*, f.forum_class, user_name FROM #forum_t as ft
-LEFT JOIN #user AS u ON ft.thread_user = u.user_id
+SELECT ft.*, f.forum_class, u.user_name, u.user_id FROM #forum_t as ft
+LEFT JOIN #user AS u ON SUBSTRING_INDEX(ft.thread_user,'.',1) = u.user_id
 LEFT JOIN #forum AS f ON f.forum_id = ft.thread_forum_id
 WHERE ft.thread_parent=0
 AND f.forum_class IN (".USERCLASS_LIST.")
@@ -181,7 +180,7 @@
 {
 	if($ma['user_name'])
 	{
-		$uinfo = "<a href='".e_BASE."user.php?id.{$ma['thread_user']}'>{$ma['user_name']}</a>";
+		$uinfo = "<a href='".e_BASE."user.php?id.{$ma['user_id']}'>{$ma['user_name']}</a>";
 	}
 	else
 	{
@@ -219,13 +218,22 @@
 $count=1;
 foreach($most_viewedArray as $ma)
 {
-	extract($ma);
+	if($ma['user_name'])
+	{
+		$uinfo = "<a href='".e_BASE."user.php?id.{$ma['user_id']}'>{$ma['user_name']}</a>";
+	}
+	else
+	{
+		$tmp = explode(chr(1), $ma['thread_anon']);
+		$uinfo = $tp->toHTML($tmp[0]);
+	}
+
 	$text .= "<tr>
 	<td style='width: 10%; text-align: center;' class='forumheader3'>$count</td>
-	<td style='width: 40%;' class='forumheader3'><a href='".e_PLUGIN."forum/forum_viewtopic.php?$thread_id'>$thread_name</a></td>
-	<td style='width: 10%; text-align: center;' class='forumheader3'>$thread_views</td>
-	<td style='width: 20%; text-align: center;' class='forumheader3'><a href='".e_BASE."user.php?id.$thread_user'>$user_name</a></td>
-	<td style='width: 20%; text-align: center;' class='forumheader3'>".$gen->convert_date($thread_datestamp, "forum")."</td>
+	<td style='width: 40%;' class='forumheader3'><a href='".e_PLUGIN."forum/forum_viewtopic.php?{$ma['thread_id']}'>{$ma['thread_name']}</a></td>
+	<td style='width: 10%; text-align: center;' class='forumheader3'>{$ma['thread_views']}</td>
+	<td style='width: 20%; text-align: center;' class='forumheader3'>{$uinfo}</td>
+	<td style='width: 20%; text-align: center;' class='forumheader3'>".$gen->convert_date($ma['thread_datestamp'], "forum")."</td>
 	</tr>
 	";
 	$count++;
diff -x .svn -aruN 0.7.15.src/e107_plugins/forum/languages/English/lan_forum_admin.php 0.7.16.src/e107_plugins/forum/languages/English/lan_forum_admin.php
--- 0.7.15.src/e107_plugins/forum/languages/English/lan_forum_admin.php	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_plugins/forum/languages/English/lan_forum_admin.php	2009-08-09 01:19:24.000000000 -0500
@@ -4,9 +4,9 @@
 |     e107 website system - Language File.
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/forum/languages/English/lan_forum_admin.php,v $
-|     $Revision: 1.23 $
-|     $Date: 2007/03/04 04:04:39 $
-|     $Author: mcfly_e107 $
+|     $Revision: 1.24 $
+|     $Date: 2009/08/09 06:19:48 $
+|     $Author: marj_nl_fr $
 +----------------------------------------------------------------------------+
 */
 define("FORLAN_1", "You must enter the number of days you wish to prune.");
@@ -155,7 +155,7 @@
 define("FORLAN_134", "Maximum width of uploaded image");
 define("FORLAN_135", "Leave blank to disable auto resizing of images");
 define("FORLAN_136", "Create link to full size image");
-define("FORLAN_137", "Enabling this will resize larger images and also create a link to the original full size image.  If disabled, original image will be discarded");
+define("FORLAN_137", "Enabling this will resize larger images and also create a link to the original full size image. If disabled, original image will be discarded");
 define("FORLAN_138", "Prune these forums");
 define("FORLAN_139", "To use this setting you also need to tick 'Enable image posting' on the <a href='".e_ADMIN."image.php'>images</a> page");
 define("FORLAN_140", "View");
@@ -200,7 +200,7 @@
 define("FORLAN_177", "email notification ON by default");
 define("FORLAN_178", "Tick this to allow make the email notification checkbox be on by default");
 
-define("FORLAN_179", "(Adding a * to the beginning of the forum name will make this forum a container for sub-forums only.  The forum theme must support this option also.)");
+define("FORLAN_179", "(Adding a * to the beginning of the forum name will make this forum a container for sub-forums only. The forum theme must support this option also.)");
 define("FORLAN_180", "Confirm delete operation");
 define("FORLAN_181", "Confirm Delete");
 define("FORLAN_182", "also recalculate replies for all threads in selected forum");
diff -x .svn -aruN 0.7.15.src/e107_plugins/forum/languages/English/lan_forum.php 0.7.16.src/e107_plugins/forum/languages/English/lan_forum.php
--- 0.7.15.src/e107_plugins/forum/languages/English/lan_forum.php	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_plugins/forum/languages/English/lan_forum.php	2009-08-09 01:19:24.000000000 -0500
@@ -4,9 +4,9 @@
 |     e107 website system - Language File.
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/forum/languages/English/lan_forum.php,v $
-|     $Revision: 1.8 $
-|     $Date: 2007/11/24 15:10:42 $
-|     $Author: e107steved $
+|     $Revision: 1.9 $
+|     $Date: 2009/08/09 06:19:48 $
+|     $Author: marj_nl_fr $
 +----------------------------------------------------------------------------+
 */
 define("e_PAGETITLE", "Forum");
@@ -22,7 +22,7 @@
 define("LAN_38", ", all times are ");
 define("LAN_41", "Newest member: ");
 define("LAN_42", "Registered members: ");
-define("LAN_44", "These forums can be used by non-registered users, but please be aware that your IP Address will be logged if you make a post.<br />To access the full features of this forum  you will need to");
+define("LAN_44", "These forums can be used by non-registered users, but please be aware that your IP Address will be logged if you make a post.<br />To access the full features of this forum you will need to");
 define("LAN_45", "These forums can only be posted to by registered and logged in members, please click");
 define("LAN_46", "Forum");
 define("LAN_47", "Threads");
diff -x .svn -aruN 0.7.15.src/e107_plugins/forum/languages/English/lan_forum_post.php 0.7.16.src/e107_plugins/forum/languages/English/lan_forum_post.php
--- 0.7.15.src/e107_plugins/forum/languages/English/lan_forum_post.php	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_plugins/forum/languages/English/lan_forum_post.php	2009-08-09 01:19:24.000000000 -0500
@@ -4,9 +4,9 @@
 |     e107 website system - Language File.
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/forum/languages/English/lan_forum_post.php,v $
-|     $Revision: 1.12 $
-|     $Date: 2007/08/11 15:10:57 $
-|     $Author: e107steved $
+|     $Revision: 1.13 $
+|     $Date: 2009/08/09 06:19:48 $
+|     $Author: marj_nl_fr $
 +----------------------------------------------------------------------------+
 */
 define("PAGE_NAME", "Forum");
@@ -38,7 +38,7 @@
 define("LAN_63", "Post: ");
 define("LAN_64", "Submit new thread");
 define("LAN_73", "Reply: ");
-define("LAN_74", "Reply to  thread");
+define("LAN_74", "Reply to thread");
 define("LAN_77", "Update Thread");
 define("LAN_78", "Update Reply");
 define("LAN_94", "Posted by");
diff -x .svn -aruN 0.7.15.src/e107_plugins/forum/newforumposts_menu.php 0.7.16.src/e107_plugins/forum/newforumposts_menu.php
--- 0.7.15.src/e107_plugins/forum/newforumposts_menu.php	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_plugins/forum/newforumposts_menu.php	2009-08-23 05:39:28.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/forum/newforumposts_menu.php,v $
-|     $Revision: 1.22 $
-|     $Date: 2008/07/20 17:08:36 $
-|     $Author: e107steved $
+|     $Revision: 1.23 $
+|     $Date: 2009/08/23 10:39:52 $
+|     $Author: marj_nl_fr $
 +----------------------------------------------------------------------------+
 */
 if (!defined('e107_INIT')) { exit; }
@@ -84,13 +84,23 @@
 
 		$fi['thread_thread'] = $tp->text_truncate($fi['thread_thread'], $menu_pref['newforumposts_characters'], $menu_pref['newforumposts_postfix']);
 
+		$bullet = '';
+		if(defined('BULLET'))
+		{
+			$bullet = '<img src="'.THEME.'images/'.BULLET.'" alt="" style="vertical-align: middle;" />';
+		}
+		elseif(file_exists(THEME.'images/bullet2.gif'))
+		{
+			$bullet = '<img src="'.THEME.'images/bullet2.gif" alt="" style="vertical-align: middle;" />';
+		}
+
 		if ($menu_pref['newforumposts_title'])
 		{
-			$text .= "<img src='".THEME_ABS."images/".(defined("BULLET") ? BULLET : "bullet2.gif")."' alt='' /> <a href='".e_PLUGIN."forum/forum_viewtopic.php?{$id}.post'>".$topic."</a><br />".$fi['thread_thread']."<br />".NFP_11." ".$poster."<br />".$datestamp."<br /><br />";
+			$text .= $bullet." <a href='".e_PLUGIN."forum/forum_viewtopic.php?{$id}.post'>".$topic."</a><br />".$fi['thread_thread']."<br />".NFP_11." ".$poster."<br />".$datestamp."<br /><br />";
 		}
 		else
 		{
-			$text .= "<img src='".THEME_ABS."images/".(defined("BULLET") ? BULLET : "bullet2.gif")."' alt='' /> <a href='".e_PLUGIN."forum/forum_viewtopic.php?{$id}.post'>".NFP_11." ".$poster."</a><br />".$fi['thread_thread']."<br />".$datestamp."<br/><br />";
+			$text .= $bullet." <a href='".e_PLUGIN."forum/forum_viewtopic.php?{$id}.post'>".NFP_11." ".$poster."</a><br />".$fi['thread_thread']."<br />".$datestamp."<br/><br />";
 		}
 	}
 }
diff -x .svn -aruN 0.7.15.src/e107_plugins/forum/plugin.php 0.7.16.src/e107_plugins/forum/plugin.php
--- 0.7.15.src/e107_plugins/forum/plugin.php	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_plugins/forum/plugin.php	2009-08-15 06:54:07.000000000 -0500
@@ -11,16 +11,15 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/forum/plugin.php,v $
-|     $Revision: 1.14 $
-|     $Date: 2006/04/29 20:34:37 $
-|     $Author: e107coders $
+|     $Revision: 1.15 $
+|     $Date: 2009/08/15 11:54:31 $
+|     $Author: marj_nl_fr $
 +----------------------------------------------------------------------------+
 */
 
 if (!defined('e107_INIT')) { exit; }
 
-@include_once(e_PLUGIN.'forum/languages/'.e_LANGUAGE.'/lan_forum_conf.php');
-@include_once(e_PLUGIN.'forum/languages/English/lan_forum_conf.php');
+include_lan(e_PLUGIN.'forum/languages/'.e_LANGUAGE.'/lan_forum_conf.php');
 
 // Plugin info -------------------------------------------------------------------------------------------------------
 $eplug_name = 'Forum';
diff -x .svn -aruN 0.7.15.src/e107_plugins/forum/templates/forum_icons_template.php 0.7.16.src/e107_plugins/forum/templates/forum_icons_template.php
--- 0.7.15.src/e107_plugins/forum/templates/forum_icons_template.php	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_plugins/forum/templates/forum_icons_template.php	2009-08-15 06:54:07.000000000 -0500
@@ -11,16 +11,15 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/forum/templates/forum_icons_template.php,v $
-|     $Revision: 1.10 $
-|     $Date: 2007/03/04 16:59:25 $
-|     $Author: e107steved $
+|     $Revision: 1.12 $
+|     $Date: 2009/08/15 11:54:31 $
+|     $Author: marj_nl_fr $
 +----------------------------------------------------------------------------+
 */
 	
 if (!defined('e107_INIT')) { exit; }
 
-@include_once(e_PLUGIN.'forum/languages/'.e_LANGUAGE.'/lan_forum_viewforum.php');
-@include_once(e_PLUGIN.'forum/languages/English/lan_forum_viewforum.php');
+include_lan(e_PLUGIN.'forum/languages/'.e_LANGUAGE.'/lan_forum_viewforum.php');
 
 define("IMAGE_e", "<img src='".img_path('e.png')."' alt='' title='' style='border:0' />");
 define("IMAGE_new", "<img src='".img_path('new.png')."' alt='".LAN_199."' title='".LAN_199."' style='border:0' />");
@@ -56,7 +55,7 @@
 	
 define("IMAGE_admin_delete", "src='".img_path('admin_delete.png')."' alt='".LAN_435."' title='".LAN_435."' style='border:0' ");
 define("IMAGE_admin_unstick", "src='".img_path('admin_unstick.png')."' alt='".LAN_398."' title='".LAN_398."' style='border:0' ");
-define("IMAGE_admin_stick", "src='".img_path('sticky_small.png')."' alt='".LAN_401."' title='".LAN_401."' style='border:0' ");
+define("IMAGE_admin_stick", "src='".img_path('admin_stick.png')."' alt='".LAN_401."' title='".LAN_401."' style='border:0' ");
 define("IMAGE_admin_lock", "src='".img_path('admin_lock.png')."' alt='".LAN_399."' title='".LAN_399."' style='border:0' ");
 define("IMAGE_admin_unlock", "src='".img_path('admin_unlock.png')."' alt='".LAN_400."' title='".LAN_400."' style='border:0' ");
 	
diff -x .svn -aruN 0.7.15.src/e107_plugins/integrity_check/admin_integrity_check.php 0.7.16.src/e107_plugins/integrity_check/admin_integrity_check.php
--- 0.7.15.src/e107_plugins/integrity_check/admin_integrity_check.php	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_plugins/integrity_check/admin_integrity_check.php	2009-08-15 06:54:07.000000000 -0500
@@ -203,7 +203,7 @@
 }
 	
 //Language-definitions
-@include_once((file_exists("languages/".e_LANGUAGE.".php") ? "languages/".e_LANGUAGE.".php" : "languages/English.php"));
+include_lan(e_PLUGIN."integrity_check/languages/".e_LANGUAGE.".php");
 	
 if (file_exists($o_path."log.txt")) {
 	$_log = explode(".-.", stripslashes(file_get_contents($o_path."log.txt")));
diff -x .svn -aruN 0.7.15.src/e107_plugins/links_page/e_help.php 0.7.16.src/e107_plugins/links_page/e_help.php
--- 0.7.15.src/e107_plugins/links_page/e_help.php	1969-12-31 18:00:00.000000000 -0600
+++ 0.7.16.src/e107_plugins/links_page/e_help.php	2009-07-19 04:32:00.000000000 -0500
@@ -0,0 +1,54 @@
+<?php
+if (!defined('e107_INIT')) { exit; }
+
+$lan_file = $plugindir."languages/".e_LANGUAGE.".php";
+include_once(file_exists($lan_file) ? $lan_file : $plugindir."languages/English.php");
+
+if(!e_QUERY){
+	$text = LAN_ADMIN_HELP_1;
+}else{
+	if(e_QUERY){
+		$qs = explode(".", e_QUERY);
+
+		if(is_numeric($qs[0])){
+			$from = array_shift($qs);
+		}else{
+			$from = "0";
+		}
+	}
+
+	//##### LINK --------------------------------------------------
+		//manage Link items
+		if($qs[0] == "link" && !isset($qs[1]) ){
+			$text = LAN_ADMIN_HELP_3;
+		//edit
+		}elseif($qs[0] == "link" && $qs[1] == "edit" && is_numeric($qs[2]) ){
+			$text = LAN_ADMIN_HELP_9;
+		//view links in cat
+		}elseif($qs[0] == "link" && $qs[1] == "view" && (is_numeric($qs[2]) || $qs[2] == "all") ){
+			$text = LAN_ADMIN_HELP_8;
+		//create
+		}elseif($qs[0] == "link" && $qs[1] == "create" && !isset($qs[2])){
+			$text = LAN_ADMIN_HELP_4;
+		//create/post submitted
+		}elseif($qs[0] == "link" && $qs[1] == "sn" && is_numeric($qs[2])){
+			$text = LAN_ADMIN_HELP_10;
+
+	//##### SUBMITTED --------------------------------------------------
+		}elseif($qs[0] == "sn" && !isset($qs[1]) ){
+			$text = LAN_ADMIN_HELP_5;
+
+	//##### OPTION --------------------------------------------------
+		}elseif($qs[0] == "opt" && !isset($qs[1]) ){
+			$text = LAN_ADMIN_HELP_6;
+
+	//##### CATEGORY --------------------------------------------------
+		}elseif($qs[0] == "cat" && $qs[1] == "create" ){
+			$text = LAN_ADMIN_HELP_2;
+		}elseif($qs[0] == "cat" && $qs[1] == "edit" && is_numeric($qs[2]) ){
+			$text = LAN_ADMIN_HELP_7;
+		}
+}
+$ns -> tablerender(LAN_ADMIN_HELP_0, $text);
+
+?>
\ No newline at end of file
diff -x .svn -aruN 0.7.15.src/e107_plugins/links_page/help.php 0.7.16.src/e107_plugins/links_page/help.php
--- 0.7.15.src/e107_plugins/links_page/help.php	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_plugins/links_page/help.php	1969-12-31 18:00:00.000000000 -0600
@@ -1,54 +0,0 @@
-<?php
-if (!defined('e107_INIT')) { exit; }
-
-$lan_file = $plugindir."languages/".e_LANGUAGE.".php";
-include_once(file_exists($lan_file) ? $lan_file : $plugindir."languages/English.php");
-
-if(!e_QUERY){
-	$text = LAN_ADMIN_HELP_1;
-}else{
-	if(e_QUERY){
-		$qs = explode(".", e_QUERY);
-
-		if(is_numeric($qs[0])){
-			$from = array_shift($qs);
-		}else{
-			$from = "0";
-		}
-	}
-
-	//##### LINK --------------------------------------------------
-		//manage Link items
-		if($qs[0] == "link" && !isset($qs[1]) ){
-			$text = LAN_ADMIN_HELP_3;
-		//edit
-		}elseif($qs[0] == "link" && $qs[1] == "edit" && is_numeric($qs[2]) ){
-			$text = LAN_ADMIN_HELP_9;
-		//view links in cat
-		}elseif($qs[0] == "link" && $qs[1] == "view" && (is_numeric($qs[2]) || $qs[2] == "all") ){
-			$text = LAN_ADMIN_HELP_8;
-		//create
-		}elseif($qs[0] == "link" && $qs[1] == "create" && !isset($qs[2])){
-			$text = LAN_ADMIN_HELP_4;
-		//create/post submitted
-		}elseif($qs[0] == "link" && $qs[1] == "sn" && is_numeric($qs[2])){
-			$text = LAN_ADMIN_HELP_10;
-
-	//##### SUBMITTED --------------------------------------------------
-		}elseif($qs[0] == "sn" && !isset($qs[1]) ){
-			$text = LAN_ADMIN_HELP_5;
-
-	//##### OPTION --------------------------------------------------
-		}elseif($qs[0] == "opt" && !isset($qs[1]) ){
-			$text = LAN_ADMIN_HELP_6;
-
-	//##### CATEGORY --------------------------------------------------
-		}elseif($qs[0] == "cat" && $qs[1] == "create" ){
-			$text = LAN_ADMIN_HELP_2;
-		}elseif($qs[0] == "cat" && $qs[1] == "edit" && is_numeric($qs[2]) ){
-			$text = LAN_ADMIN_HELP_7;
-		}
-}
-$ns -> tablerender(LAN_ADMIN_HELP_0, $text);
-
-?>
\ No newline at end of file
diff -x .svn -aruN 0.7.15.src/e107_plugins/links_page/link_class.php 0.7.16.src/e107_plugins/links_page/link_class.php
--- 0.7.15.src/e107_plugins/links_page/link_class.php	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_plugins/links_page/link_class.php	2009-01-30 16:02:21.000000000 -0600
@@ -11,9 +11,9 @@
 |    GNU    General Public  License (http://gnu.org).
 |
 |    $Source: /cvsroot/e107/e107_0.7/e107_plugins/links_page/link_class.php,v $
-|    $Revision: 1.46 $
-|    $Date: 2008/07/28 20:15:57 $
-|    $Author: e107steved $
+|    $Revision: 1.47 $
+|    $Date: 2009/01/30 22:02:45 $
+|    $Author: lisa_ $
 +----------------------------------------------------------------------------+
 */
 
@@ -476,6 +476,21 @@
         }
     }
 
+	function verify_link_manage($id)
+	{
+		global $sql;
+
+		if ($sql->db_Select("links_page", "link_author", "link_id='".intval($id)."' "))
+		{
+			$row = $sql->db_Fetch();
+		}
+
+		if(varset($row['link_author']) != USERID)
+		{
+			js_location(SITEURL);
+		}
+	}
+
 	// Create a new link. If $mode == 'submit', link has to go through the approval process; else its admin entry
     function dbLinkCreate($mode='') 
 	{
diff -x .svn -aruN 0.7.15.src/e107_plugins/links_page/link_menu.php 0.7.16.src/e107_plugins/links_page/link_menu.php
--- 0.7.15.src/e107_plugins/links_page/link_menu.php	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_plugins/links_page/link_menu.php	2009-08-23 05:39:29.000000000 -0500
@@ -8,10 +8,18 @@
 $rs = new form;
 global $tp;
 
-$lan_file = e_PLUGIN."links_page/languages/".e_LANGUAGE.".php";
-include_once(file_exists($lan_file) ? $lan_file : e_PLUGIN."links_page/languages/English.php");
+include_lan(e_PLUGIN."links_page/languages/".e_LANGUAGE.".php");
+
+$bullet = '';
+if(defined('BULLET'))
+{
+	$bullet = '<img src="'.THEME.'images/'.BULLET.'" alt="" style="vertical-align: middle;" />';
+}
+elseif(file_exists(THEME.'images/bullet2.gif'))
+{
+	$bullet = '<img src="'.THEME.'images/bullet2.gif" alt="" style="vertical-align: middle;" />';
+}
 
-$bullet = "<img src='".THEME_ABS."images/bullet2.gif' alt='' style='border:0;' />";
 global $linkspage_pref;
 $linkspage_pref = $lc -> getLinksPagePref();
 
diff -x .svn -aruN 0.7.15.src/e107_plugins/links_page/link_shortcodes.php 0.7.16.src/e107_plugins/links_page/link_shortcodes.php
--- 0.7.15.src/e107_plugins/links_page/link_shortcodes.php	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_plugins/links_page/link_shortcodes.php	2009-08-23 05:39:29.000000000 -0500
@@ -155,32 +155,59 @@
 SC_BEGIN LINK_MAIN_ICON
 global $LINK_MAIN_ICON, $rowl, $linkspage_pref;
 $LINK_MAIN_ICON = "";
-if(isset($linkspage_pref['link_cat_icon']) && $linkspage_pref['link_cat_icon']){
-	if (isset($rowl['link_category_icon']) && $rowl['link_category_icon']) {
-		if(strstr($rowl['link_category_icon'], "/")){
-			if(file_exists(e_BASE.$rowl['link_category_icon'])){
-			$LINK_MAIN_ICON = "<img src='".e_BASE.$rowl['link_category_icon']."' alt='' style='border:0; vertical-align:middle' />";
-			} else {
-				if(isset($linkspage_pref['link_cat_icon_empty']) && $linkspage_pref['link_cat_icon_empty']){
-				$LINK_MAIN_ICON = "<img src='".THEME_ABS."images/".(defined("BULLET") ? BULLET : "bullet2.gif")."' alt='' style='border:0; vertical-align:middle;' />";
+$bullet = '';
+if(defined('BULLET'))
+{
+	$bullet = '<img src="'.THEME.'images/'.BULLET.'" alt="" style="vertical-align: middle;" />';
+}
+elseif(file_exists(THEME.'images/bullet2.gif'))
+{
+	$bullet = '<img src="'.THEME.'images/bullet2.gif" alt="" style="vertical-align: middle;" />';
+}
+
+if(isset($linkspage_pref['link_cat_icon']) && $linkspage_pref['link_cat_icon'])
+{
+	if (isset($rowl['link_category_icon']) && $rowl['link_category_icon'])
+	{
+		if(strstr($rowl['link_category_icon'], "/"))
+		{
+			if(file_exists(e_BASE.$rowl['link_category_icon']))
+			{
+				$LINK_MAIN_ICON = "<img src='".e_BASE.$rowl['link_category_icon']."' alt='' style='border:0; vertical-align:middle' />";
+			}
+			else
+			{
+				if(isset($linkspage_pref['link_cat_icon_empty']) && $linkspage_pref['link_cat_icon_empty'])
+				{
+					$LINK_MAIN_ICON = $bullet;
 				}
 			}
-		}else{
-			if(file_exists(e_PLUGIN."links_page/cat_images/".$rowl['link_category_icon'])){
+		}
+		else
+		{
+			if(file_exists(e_PLUGIN."links_page/cat_images/".$rowl['link_category_icon']))
+			{
 			$LINK_MAIN_ICON = "<img src='".e_PLUGIN_ABS."links_page/cat_images/".$rowl['link_category_icon']."' alt='' style='border:0; vertical-align:middle' />";
-			} else {
-				if(isset($linkspage_pref['link_cat_icon_empty']) && $linkspage_pref['link_cat_icon_empty']){
-				$LINK_MAIN_ICON = "<img src='".THEME_ABS."images/".(defined("BULLET") ? BULLET : "bullet2.gif")."' alt='' style='border:0; vertical-align:middle;' />";
+			}
+			else
+			{
+				if(isset($linkspage_pref['link_cat_icon_empty']) && $linkspage_pref['link_cat_icon_empty'])
+				{
+					$LINK_MAIN_ICON = $bullet;
 				}
 			}
 		}
-	} else {
-		if(isset($linkspage_pref['link_cat_icon_empty']) && $linkspage_pref['link_cat_icon_empty']){
-		$LINK_MAIN_ICON = "<img src='".THEME_ABS."images/".(defined("BULLET") ? BULLET : "bullet2.gif")."' alt='' style='border:0; vertical-align:middle;' />";
+	}
+	else
+	{
+		if(isset($linkspage_pref['link_cat_icon_empty']) && $linkspage_pref['link_cat_icon_empty'])
+		{
+			$LINK_MAIN_ICON = $bullet;
 		}
 	}
-	if($rowl['total_links'] && $LINK_MAIN_ICON){
-	$LINK_MAIN_ICON = "<a href='links.php?cat.".$rowl['link_category_id']."'>".$LINK_MAIN_ICON."</a>";
+	if($rowl['total_links'] && $LINK_MAIN_ICON)
+	{
+		$LINK_MAIN_ICON = "<a href='links.php?cat.".$rowl['link_category_id']."'>".$LINK_MAIN_ICON."</a>";
 	}
 }
 return $LINK_MAIN_ICON;
diff -x .svn -aruN 0.7.15.src/e107_plugins/links_page/links.php 0.7.16.src/e107_plugins/links_page/links.php
--- 0.7.15.src/e107_plugins/links_page/links.php	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_plugins/links_page/links.php	2009-01-30 16:02:21.000000000 -0600
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/links_page/links.php,v $
-|     $Revision: 1.51 $
-|     $Date: 2008/11/18 22:03:22 $
-|     $Author: e107steved $
+|     $Revision: 1.52 $
+|     $Date: 2009/01/30 22:02:45 $
+|     $Author: lisa_ $
 +----------------------------------------------------------------------------+
 */
 require_once('../../class2.php');
@@ -107,7 +107,10 @@
 	if($qs[0] == "manage"){
 		if(check_class($linkspage_pref['link_manager_class'])){
 			
-			$lc->verify_link_manage($qs[2]);
+			if(isset($qs[2]) && is_numeric($qs[2]))
+			{
+				$lc->verify_link_manage($qs[2]);
+			}
 			
 			if(isset($linkspage_pref['link_directpost']) && $linkspage_pref['link_directpost']){
 				$lc -> dbLinkCreate();
diff -x .svn -aruN 0.7.15.src/e107_plugins/links_page/plugin.php 0.7.16.src/e107_plugins/links_page/plugin.php
--- 0.7.15.src/e107_plugins/links_page/plugin.php	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_plugins/links_page/plugin.php	2009-08-15 06:54:08.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/links_page/plugin.php,v $
-|     $Revision: 1.21 $
-|     $Date: 2006/10/21 11:22:57 $
-|     $Author: mrpete $
+|     $Revision: 1.22 $
+|     $Date: 2009/08/15 11:54:32 $
+|     $Author: marj_nl_fr $
 +----------------------------------------------------------------------------+
 */
 
@@ -21,8 +21,7 @@
 
 // Plugin info -------------------------------------------------------------------------------------------------------
 @include_once(e_PLUGIN.'links_page/link_defines.php');
-@include_once(e_PLUGIN.'links_page/languages/'.e_LANGUAGE.'.php');
-@include_once(e_PLUGIN.'links_page/languages/English.php');
+include_lan(e_PLUGIN.'links_page/languages/'.e_LANGUAGE.'.php');
 
 $eplug_name = "LCLAN_PLUGIN_LAN_1";
 $eplug_version = "1.12";
diff -x .svn -aruN 0.7.15.src/e107_plugins/linkwords/admin_config.php 0.7.16.src/e107_plugins/linkwords/admin_config.php
--- 0.7.15.src/e107_plugins/linkwords/admin_config.php	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_plugins/linkwords/admin_config.php	2009-08-15 06:54:08.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/linkwords/admin_config.php,v $
-|     $Revision: 1.7 $
-|     $Date: 2007/07/23 21:02:23 $
-|     $Author: e107steved $
+|     $Revision: 1.8 $
+|     $Date: 2009/08/15 11:54:32 $
+|     $Author: marj_nl_fr $
 +----------------------------------------------------------------------------+
 */
 require_once("../../class2.php");
@@ -22,8 +22,7 @@
 	 exit ;
 }
 require_once(e_ADMIN."auth.php");
-@include_once(e_PLUGIN."linkwords/languages/".e_LANGUAGE.".php");
-@include_once(e_PLUGIN."linkwords/languages/English.php");
+include_lan(e_PLUGIN."linkwords/languages/".e_LANGUAGE.".php");
 
 $lw_context_areas = array(
 			'title' => LWLAN_33,
diff -x .svn -aruN 0.7.15.src/e107_plugins/linkwords/plugin.php 0.7.16.src/e107_plugins/linkwords/plugin.php
--- 0.7.15.src/e107_plugins/linkwords/plugin.php	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_plugins/linkwords/plugin.php	2009-08-15 06:54:08.000000000 -0500
@@ -11,16 +11,15 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/linkwords/plugin.php,v $
-|     $Revision: 1.6 $
-|     $Date: 2007/07/28 16:48:01 $
-|     $Author: e107steved $
+|     $Revision: 1.7 $
+|     $Date: 2009/08/15 11:54:32 $
+|     $Author: marj_nl_fr $
 +----------------------------------------------------------------------------+
 */
 
 if (!defined('e107_INIT')) { exit; }
 
-@include_once(e_PLUGIN."linkwords/languages/".e_LANGUAGE.".php");
-@include_once(e_PLUGIN."linkwords/languages/English.php");
+include_lan(e_PLUGIN."linkwords/languages/".e_LANGUAGE.".php");
 
 // Plugin info -------------------------------------------------------------------------------------------------------
 $eplug_name = "LWLANINS_1";
diff -x .svn -aruN 0.7.15.src/e107_plugins/list_new/list_class.php 0.7.16.src/e107_plugins/list_new/list_class.php
--- 0.7.15.src/e107_plugins/list_new/list_class.php	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_plugins/list_new/list_class.php	2009-08-23 05:39:29.000000000 -0500
@@ -11,9 +11,9 @@
 |       GNU General Public License (http://gnu.org).
 |
 |		$Source: /cvsroot/e107/e107_0.7/e107_plugins/list_new/list_class.php,v $
-|		$Revision: 1.18 $
-|		$Date: 2008/10/21 19:10:43 $
-|		$Author: e107steved $
+|		$Revision: 1.19 $
+|		$Date: 2009/08/23 10:39:53 $
+|		$Author: marj_nl_fr $
 +---------------------------------------------------------------+
 */
 if (!defined('e107_INIT')) { exit; }
@@ -493,9 +493,12 @@
 		$icon_height = "8";
 		$style_pre = "";
 
-		if($list_pref[$mode."_icon_use"]){
-			if($sectionicon){
-				if(file_exists($listplugindir."images/".$sectionicon)){
+		if($list_pref[$mode."_icon_use"])
+		{
+			if($sectionicon)
+			{
+				if(file_exists($listplugindir."images/".$sectionicon))
+				{
 					$bullet = "<img src='".$listplugindir."images/".$sectionicon."' style='width:".$icon_width."px; height:".$icon_height."px; border:0; vertical-align:middle;' alt='' />";
 				}
 			}
diff -x .svn -aruN 0.7.15.src/e107_plugins/list_new/list_new_menu.php 0.7.16.src/e107_plugins/list_new/list_new_menu.php
--- 0.7.15.src/e107_plugins/list_new/list_new_menu.php	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_plugins/list_new/list_new_menu.php	2009-01-06 15:30:13.000000000 -0600
@@ -11,48 +11,57 @@
 |       GNU General Public License (http://gnu.org).
 |
 |		$Source: /cvsroot/e107/e107_0.7/e107_plugins/list_new/list_new_menu.php,v $
-|		$Revision: 1.6 $
-|		$Date: 2005/12/14 19:28:44 $
-|		$Author: sweetas $
+|		$Revision: 1.7 $
+|		$Date: 2009/01/06 21:30:37 $
+|		$Author: e107steved $
 +---------------------------------------------------------------+
 */
 
 if (!defined('e107_INIT')) { exit; }
 
-if(!$sql -> db_Select("plugin", "*", "plugin_path = 'list_new' AND plugin_installflag = '1' ")){
-	return;
+if (!isset($pref['plug_installed']['list_new']))
+{
+    return;
 }
 
-global $sysprefs, $tp, $eArrayStorage;
-$listplugindir = e_PLUGIN."list_new/";
+global $sysprefs, $tp, $eArrayStorage, $list_pref, $rc;
+$listplugindir = e_PLUGIN . "list_new/";
 unset($text);
 require_once($listplugindir."list_shortcodes.php");
 
-//get language file
-$lan_file = $listplugindir."languages/".e_LANGUAGE.".php";
-include_once(file_exists($lan_file) ? $lan_file : $listplugindir."languages/English.php");
-
-require_once($listplugindir."list_class.php");
-$rc = new listclass;
-
-$list_pref	= $rc -> getListPrefs();
-$mode		= "new_menu";
-$sections	= $rc -> prepareSection($mode);
-$arr		= $rc -> prepareSectionArray($mode, $sections);
+// get language file
+include_lan($listplugindir . "languages/" . e_LANGUAGE . ".php");
 
-//display the sections
+if (!is_object($rc))
+{
+    require_once($listplugindir . "list_class.php");
+    $rc = new listclass;
+}
+
+if(!isset($list_pref))
+{
+	$list_pref = $rc->getListPrefs();
+}
+
+$mode = "new_menu";
+$sections = $rc->prepareSection($mode);
+$arr = $rc->prepareSectionArray($mode, $sections);
+// display the sections
 $text = "";
-for($i=0;$i<count($arr);$i++){
-	if($arr[$i][1] == "1"){
-		$sectiontext = $rc -> show_section_list($arr[$i], $mode);
-		if($sectiontext != ""){
-			$text .= $sectiontext;
-		}
-	}
+for($i = 0;$i < count($arr);$i++)
+{
+    if ($arr[$i][1] == "1")
+    {
+        $sectiontext = $rc->show_section_list($arr[$i], $mode);
+        if ($sectiontext != "")
+        {
+            $text .= $sectiontext;
+        }
+    }
 }
 
 $caption = (isset($list_pref[$mode."_caption"]) && $list_pref[$mode."_caption"] ? $list_pref[$mode."_caption"] : LIST_MENU_1);
-$ns -> tablerender($caption, $text, 'list_new');
+$ns->tablerender($caption, $text, 'list_new');
 unset($text);
 
 ?>
\ No newline at end of file
diff -x .svn -aruN 0.7.15.src/e107_plugins/list_new/list.php 0.7.16.src/e107_plugins/list_new/list.php
--- 0.7.15.src/e107_plugins/list_new/list.php	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_plugins/list_new/list.php	2009-01-06 15:30:13.000000000 -0600
@@ -11,26 +11,33 @@
 |       GNU General Public License (http://gnu.org).
 |
 |		$Source: /cvsroot/e107/e107_0.7/e107_plugins/list_new/list.php,v $
-|		$Revision: 1.12 $
-|		$Date: 2006/11/11 15:29:16 $
-|		$Author: lisa_ $
+|		$Revision: 1.13 $
+|		$Date: 2009/01/06 21:30:37 $
+|		$Author: e107steved $
 +---------------------------------------------------------------+
 */
 require_once("../../class2.php");
+
 $listplugindir = e_PLUGIN."list_new/";
+
 //get language file
-$lan_file = $listplugindir."languages/".e_LANGUAGE.".php";
-include_once(file_exists($lan_file) ? $lan_file : $listplugindir."languages/English.php");
+include_lan($listplugindir."languages/".e_LANGUAGE.".php");
 
-if(!$sql -> db_Select("plugin", "*", "plugin_path = 'list_new' AND plugin_installflag = '1' ")){
+if(!isset($pref['plug_installed']['list_new']))
+{
 	require_once(HEADERF);
 	$ns -> tablerender("", LIST_PLUGIN_6);
 	require_once(FOOTERF);
 	exit;
 }
+
 require_once($listplugindir."list_shortcodes.php");
-require_once($listplugindir."list_class.php");
-$rc = new listclass;
+if (!is_object($rc))
+{
+    require_once($listplugindir . "list_class.php");
+    $rc = new listclass;
+}
+
 require_once(e_HANDLER."form_handler.php");
 $rs = new form;
 e107_require_once(e_HANDLER.'arraystorage_class.php');
@@ -40,28 +47,38 @@
 
 require_once(HEADERF);
 
-global $tp;
+global $tp,$list_pref;
 
 // check query
-if(e_QUERY){
+if(e_QUERY)
+{
 	$qs = explode(".", e_QUERY);
-	if($qs[0] == "new"){
+	if($qs[0] == "new")
+	{
 		$mode = $qs[0];
 	}
 }
-if(isset($mode) && $mode == "new"){
+
+if(isset($mode) && $mode == "new")
+{
 	$mode = "new_page";
-}else{
+}
+else
+{
 	$mode = "recent_page";	//default to 'page'
 }
 
-$list_pref	= $rc -> getListPrefs();
+if(!isset($list_pref))
+{
+	$list_pref = $rc->getListPrefs();
+}
 $sections	= $rc -> prepareSection($mode);
 $arr		= $rc -> prepareSectionArray($mode, $sections);
 
 $text = "";
 $timelapse = 0;
-if(isset($qs[0]) && $qs[0] == "new"){
+if(isset($qs[0]) && $qs[0] == "new")
+{
 	if(isset($list_pref['new_page_timelapse']) && $list_pref['new_page_timelapse']){
 		if(isset($list_pref['new_page_timelapse_days']) && is_numeric($list_pref['new_page_timelapse_days'])){
 			$days = $list_pref['new_page_timelapse_days'];
@@ -92,18 +109,22 @@
 $LIST_COL_CELLWIDTH = round((100/$list_pref[$mode."_colomn"]),0);
 $text .= $LIST_COL_START;
 
-if($list_pref[$mode."_welcometext"]){
+if($list_pref[$mode."_welcometext"])
+{
 	$LIST_COL_WELCOMETEXT = $tp -> toHTML($list_pref[$mode."_welcometext"]);
 	$text .= preg_replace("/\{(.*?)\}/e", '$\1', $LIST_COL_WELCOME);
 }
 $k=0;
-for($i=0;$i<count($arr);$i++){
+for($i=0;$i<count($arr);$i++)
+{
 	unset($rowswitch);
-	if($arr[$i][1] == "1"){
-				
+	if($arr[$i][1] == "1")
+	{
 		$sectiontext = $rc -> show_section_list($arr[$i], $mode);
-		if($sectiontext != ""){
-			if( intval($k/$list_pref[$mode."_colomn"]) == $k/$list_pref[$mode."_colomn"] ){
+		if($sectiontext != "")
+		{
+			if( intval($k/$list_pref[$mode."_colomn"]) == $k/$list_pref[$mode."_colomn"] )
+			{
 				$rowswitch = $LIST_COL_ROWSWITCH;
 			}
 			$text .= (isset($rowswitch) ? $rowswitch : "");
diff -x .svn -aruN 0.7.15.src/e107_plugins/list_new/list_recent_menu.php 0.7.16.src/e107_plugins/list_new/list_recent_menu.php
--- 0.7.15.src/e107_plugins/list_new/list_recent_menu.php	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_plugins/list_new/list_recent_menu.php	2009-01-06 15:30:13.000000000 -0600
@@ -11,8 +11,8 @@
 |       GNU General Public License (http://gnu.org).
 |
 |		$Source: /cvsroot/e107/e107_0.7/e107_plugins/list_new/list_recent_menu.php,v $
-|		$Revision: 1.7 $
-|		$Date: 2007/08/08 19:34:51 $
+|		$Revision: 1.8 $
+|		$Date: 2009/01/06 21:30:37 $
 |		$Author: e107steved $
 +---------------------------------------------------------------+
 */
@@ -22,20 +22,26 @@
 if (!isset($pref['plug_installed']['list_new'])) return;
 
 
-
-global $sysprefs, $tp, $eArrayStorage;
+global $sysprefs, $tp, $eArrayStorage, $list_pref, $rc;
 $listplugindir = e_PLUGIN."list_new/";
 unset($text);
 require_once($listplugindir."list_shortcodes.php");
 
 //get language file
-$lan_file = $listplugindir."languages/".e_LANGUAGE.".php";
-include_once(file_exists($lan_file) ? $lan_file : $listplugindir."languages/English.php");
+include_lan($listplugindir."languages/".e_LANGUAGE.".php");
+
 
-require_once($listplugindir."list_class.php");
-$rc = new listclass;
+if (!is_object($rc))
+{
+    require_once($listplugindir . "list_class.php");
+    $rc = new listclass;
+}
+
+if(!isset($list_pref))
+{
+	$list_pref = $rc->getListPrefs();
+}
 
-$list_pref	= $rc -> getListPrefs();
 $mode		= "recent_menu";
 $sections	= $rc -> prepareSection($mode);
 $arr		= $rc -> prepareSectionArray($mode, $sections);
diff -x .svn -aruN 0.7.15.src/e107_plugins/log/plugin.php 0.7.16.src/e107_plugins/log/plugin.php
--- 0.7.15.src/e107_plugins/log/plugin.php	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_plugins/log/plugin.php	2009-08-15 06:54:08.000000000 -0500
@@ -11,16 +11,15 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/log/plugin.php,v $
-|     $Revision: 1.7 $
-|     $Date: 2008/09/02 21:12:08 $
-|     $Author: e107steved $
+|     $Revision: 1.8 $
+|     $Date: 2009/08/15 11:54:32 $
+|     $Author: marj_nl_fr $
 +----------------------------------------------------------------------------+
 */
 
 if (!defined('e107_INIT')) { exit; }
 
-@include_once(e_PLUGIN."log/languages/admin/".e_LANGUAGE.".php");
-@include_once(e_PLUGIN."log/languages/admin/English.php");
+include_lan(e_PLUGIN."log/languages/admin/".e_LANGUAGE.".php");
 
 // Plugin info -------------------------------------------------------------------------------------------------------
 $eplug_name = 'ADSTAT_L3';
diff -x .svn -aruN 0.7.15.src/e107_plugins/log/stats.php 0.7.16.src/e107_plugins/log/stats.php
--- 0.7.15.src/e107_plugins/log/stats.php	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_plugins/log/stats.php	2009-08-15 06:54:08.000000000 -0500
@@ -11,15 +11,14 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/log/stats.php,v $
-|     $Revision: 1.42 $
-|     $Date: 2008/10/07 19:08:54 $
-|     $Author: e107steved $
+|     $Revision: 1.43 $
+|     $Date: 2009/08/15 11:54:32 $
+|     $Author: marj_nl_fr $
 +----------------------------------------------------------------------------+
 */
 require_once("../../class2.php");
 
-@include_once(e_PLUGIN."log/languages/".e_LANGUAGE.".php");
-@include_once(e_PLUGIN."log/languages/English.php");
+include_lan(e_PLUGIN."log/languages/".e_LANGUAGE.".php");
 
 function core_head() {
 	$bar = (file_exists(THEME."images/bar.png") ? THEME."images/bar.png" : e_IMAGE."generic/bar.png");
diff -x .svn -aruN 0.7.15.src/e107_plugins/login_menu/login_menu.php 0.7.16.src/e107_plugins/login_menu/login_menu.php
--- 0.7.15.src/e107_plugins/login_menu/login_menu.php	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_plugins/login_menu/login_menu.php	2009-08-23 05:39:26.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/login_menu/login_menu.php,v $
-|     $Revision: 1.53 $
-|     $Date: 2007/05/27 18:57:44 $
-|     $Author: e107steved $
+|     $Revision: 1.54 $
+|     $Date: 2009/08/23 10:39:50 $
+|     $Author: marj_nl_fr $
 +----------------------------------------------------------------------------+
 */
 
@@ -28,19 +28,6 @@
 require_once(e_PLUGIN."login_menu/login_menu_shortcodes.php");
 $ip = $e107->getip();
 
-	if(defined("BULLET"))
-	{
-   		$bullet = "<img src='".THEME_ABS."images/".BULLET."' alt='' style='vertical-align: middle;' />";
-	}
-	elseif(file_exists(THEME."images/bullet2.gif"))
-	{
-		$bullet = "<img src='".THEME_ABS."images/bullet2.gif' alt='bullet' style='vertical-align: middle;' />";
-	}
-	else
-	{
-		$bullet = "";
-	}
-
 if (defined('CORRUPT_COOKIE') && CORRUPT_COOKIE == TRUE)
 {
 	$text = "<div style='text-align:center'>".LOGIN_MENU_L7."<br /><br />
diff -x .svn -aruN 0.7.15.src/e107_plugins/login_menu/login_menu_shortcodes.php 0.7.16.src/e107_plugins/login_menu/login_menu_shortcodes.php
--- 0.7.15.src/e107_plugins/login_menu/login_menu_shortcodes.php	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_plugins/login_menu/login_menu_shortcodes.php	2009-08-23 05:39:27.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/login_menu/login_menu_shortcodes.php,v $
-|     $Revision: 1.11 $
-|     $Date: 2007/03/25 09:22:17 $
-|     $Author: lisa_ $
+|     $Revision: 1.13 $
+|     $Date: 2009/08/23 10:39:51 $
+|     $Author: marj_nl_fr $
 +----------------------------------------------------------------------------+
 */
 if (!defined('e107_INIT')) { exit; }
@@ -22,11 +22,14 @@
 
 /*
 SC_BEGIN LM_USERNAME_INPUT
-return "<input class='tbox login user' type='text' name='username' size='15' value='' maxlength='30' />\n";
+global $pref;
+return "<input class='tbox login user' type='text' name='username' id='username' size='15' value='' maxlength='".varset($pref['loginname_maxlength'],30)."' />\n";
 SC_END
 
 SC_BEGIN LM_PASSWORD_INPUT
-return "<input class='tbox login pass' type='password' name='userpass' size='15' value='' maxlength='20' />\n\n";
+global $pref;
+$t_password = "<input class='tbox login pass' type='password' name='userpass' id='userpass' size='15' value='' maxlength='30' />\n";
+return $t_password;
 SC_END
 
 SC_BEGIN LM_IMAGECODE
@@ -97,10 +100,19 @@
 SC_END
 
 SC_BEGIN LM_ADMINLINK_BULLET
-global $bullet;
-if(ADMIN==TRUE && $bullet !='bullet'){
-	return $bullet;
+$bullet = '';
+if(ADMIN)
+{
+	if(defined('BULLET'))
+	{
+		$bullet = '<img src="'.THEME.'images/'.BULLET.'" alt="" style="vertical-align: middle;" />';
+	}
+	elseif(file_exists(THEME.'images/bullet2.gif'))
+	{
+		$bullet = '<img src="'.THEME.'images/bullet2.gif" alt="" style="vertical-align: middle;" />';
+	}
 }
+return $bullet;
 SC_END
 
 SC_BEGIN LM_ADMINLINK
@@ -123,9 +135,16 @@
 
 
 SC_BEGIN LM_BULLET
-global $bullet;
+$bullet = '';
+if(defined('BULLET'))
+{
+	$bullet = '<img src="'.THEME.'images/'.BULLET.'" alt="" style="vertical-align: middle;" />';
+}
+elseif(file_exists(THEME.'images/bullet2.gif'))
+{
+	$bullet = '<img src="'.THEME.'images/bullet2.gif" alt="" style="vertical-align: middle;" />';
+}
 return $bullet;
-
 SC_END
 
 SC_BEGIN LM_USERSETTINGS
diff -x .svn -aruN 0.7.15.src/e107_plugins/newsfeed/e_frontpage.php 0.7.16.src/e107_plugins/newsfeed/e_frontpage.php
--- 0.7.15.src/e107_plugins/newsfeed/e_frontpage.php	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_plugins/newsfeed/e_frontpage.php	2009-08-15 06:54:08.000000000 -0500
@@ -2,8 +2,7 @@
 
 if (!defined('e107_INIT')) { exit; }
 
-@include_once(e_PLUGIN.'newsfeed/languages/'.e_LANGUAGE.'_frontpage.php');
-@include_once(e_PLUGIN.'newsfeed/languages/English_frontpage.php');
+include_lan(e_PLUGIN.'newsfeed/languages/'.e_LANGUAGE.'_frontpage.php');
 
 $front_page['newsfeed']['title'] = NWSF_FP_1.': '.$row['content_heading'];
 $front_page['newsfeed']['page'][] = array('page' => $PLUGINS_DIRECTORY.'newsfeed/newsfeed.php', 'title' => NWSF_FP_2);
diff -x .svn -aruN 0.7.15.src/e107_plugins/newsfeed/e_help.php 0.7.16.src/e107_plugins/newsfeed/e_help.php
--- 0.7.15.src/e107_plugins/newsfeed/e_help.php	1969-12-31 18:00:00.000000000 -0600
+++ 0.7.16.src/e107_plugins/newsfeed/e_help.php	2009-08-15 06:54:08.000000000 -0500
@@ -0,0 +1,23 @@
+<?php
+/*
++ ----------------------------------------------------------------------------+
+|     e107 website system
+|
+|     Steve Dunstan 2001-2002
+|     http://e107.org
+|     jalist@e107.org
+|
+|     Released under the terms and conditions of the
+|     GNU General Public License (http://gnu.org).
+|
+|     $Source: /cvsroot/e107/e107_0.7/e107_plugins/newsfeed/e_help.php,v $
+|     $Revision: 1.2 $
+|     $Date: 2009/08/15 11:54:32 $
+|     $Author: marj_nl_fr $
++----------------------------------------------------------------------------+
+*/
+if (!defined('e107_INIT')) { exit; }
+
+include_lan(e_PLUGIN."newsfeed/languages/".e_LANGUAGE.".php");
+$ns->tablerender(NFLAN_43, NFLAN_42);
+?>
\ No newline at end of file
diff -x .svn -aruN 0.7.15.src/e107_plugins/newsfeed/help.php 0.7.16.src/e107_plugins/newsfeed/help.php
--- 0.7.15.src/e107_plugins/newsfeed/help.php	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_plugins/newsfeed/help.php	1969-12-31 18:00:00.000000000 -0600
@@ -1,24 +0,0 @@
-<?php
-/*
-+ ----------------------------------------------------------------------------+
-|     e107 website system
-|
-|     Steve Dunstan 2001-2002
-|     http://e107.org
-|     jalist@e107.org
-|
-|     Released under the terms and conditions of the
-|     GNU General Public License (http://gnu.org).
-|
-|     $Source: /cvsroot/e107/e107_0.7/e107_plugins/newsfeed/help.php,v $
-|     $Revision: 1.3 $
-|     $Date: 2005/12/14 19:28:44 $
-|     $Author: sweetas $
-+----------------------------------------------------------------------------+
-*/
-if (!defined('e107_INIT')) { exit; }
-
-@include_once(e_PLUGIN."newsfeed/languages/".e_LANGUAGE.".php");
-@include_once(e_PLUGIN."newsfeed/languages/English.php");
-$ns->tablerender(NFLAN_43, NFLAN_42);
-?>
\ No newline at end of file
diff -x .svn -aruN 0.7.15.src/e107_plugins/newsfeed/newsfeed.php 0.7.16.src/e107_plugins/newsfeed/newsfeed.php
--- 0.7.15.src/e107_plugins/newsfeed/newsfeed.php	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_plugins/newsfeed/newsfeed.php	2009-08-15 06:54:08.000000000 -0500
@@ -11,15 +11,15 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/newsfeed/newsfeed.php,v $
-|     $Revision: 1.14 $
-|     $Date: 2008/05/30 20:36:47 $
-|     $Author: e107steved $
+|     $Revision: 1.15 $
+|     $Date: 2009/08/15 11:54:32 $
+|     $Author: marj_nl_fr $
 +----------------------------------------------------------------------------+
 */
 require_once("../../class2.php");
 
-@include_once(e_PLUGIN."newsfeed/languages/".e_LANGUAGE.".php");
-@include_once(e_PLUGIN."newsfeed/languages/English.php");
+include_lan(e_PLUGIN."newsfeed/languages/".e_LANGUAGE.".php");
+
 if(!function_exists("checkUpdate"))
 {
 	require(e_PLUGIN."newsfeed/newsfeed_functions.php");
diff -x .svn -aruN 0.7.15.src/e107_plugins/newsfeed/plugin.php 0.7.16.src/e107_plugins/newsfeed/plugin.php
--- 0.7.15.src/e107_plugins/newsfeed/plugin.php	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_plugins/newsfeed/plugin.php	2009-08-15 06:54:08.000000000 -0500
@@ -11,16 +11,15 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/newsfeed/plugin.php,v $
-|     $Revision: 1.6 $
-|     $Date: 2006/08/25 15:37:54 $
-|     $Author: e107coders $
+|     $Revision: 1.7 $
+|     $Date: 2009/08/15 11:54:32 $
+|     $Author: marj_nl_fr $
 +----------------------------------------------------------------------------+
 */
 
 if (!defined('e107_INIT')) { exit; }
 
-@include_once(e_PLUGIN."newsfeed/languages/".e_LANGUAGE.".php");
-@include_once(e_PLUGIN."newsfeed/languages/English.php");
+include_lan(e_PLUGIN."newsfeed/languages/".e_LANGUAGE.".php");
 
 // Plugin info -------------------------------------------------------------------------------------------------------
 $eplug_name = "NFLAN_01";
diff -x .svn -aruN 0.7.15.src/e107_plugins/newsletter/admin_config.php 0.7.16.src/e107_plugins/newsletter/admin_config.php
--- 0.7.15.src/e107_plugins/newsletter/admin_config.php	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_plugins/newsletter/admin_config.php	2009-03-05 16:21:47.000000000 -0600
@@ -11,15 +11,15 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/newsletter/admin_config.php,v $
-|     $Revision: 1.12 $
-|     $Date: 2008/09/22 20:38:18 $
+|     $Revision: 1.14 $
+|     $Date: 2009/03/05 22:22:11 $
 |     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
-require_once("../../class2.php");
+require_once('../../class2.php');
 if (!getperms("P")) 
 {
-	header("location:".e_BASE."index.php");
+	header('location:'.e_BASE.'index.php');
 	exit;
 }
 $e_sub_cat = 'newsletter';
@@ -46,22 +46,30 @@
 }
 else
 {
-	if ($action == "vs") 
-	{ // View subscribers of a newsletter
-		$nl -> view_subscribers($id);
-	} 
-	elseif ($action == "remove") 
-	{ // Remove subscriber
-		$nl -> remove_subscribers($id,$key);
-	} 
-	else 
+	switch ($action)
 	{
-		$function = $action."Newsletter";
-		$nl -> $function();
+		case 'vs' :	 // View subscribers of a newsletter
+			$nl -> view_subscribers($id);
+			break;
+		case  'remove' :	// Remove subscriber
+			$nl -> remove_subscribers($id,$key);
+			$nl -> view_subscribers($id);
+			break;
+		default:
+			$function = $action."Newsletter";
+			if (method_exists($nl, $function))
+			{
+				$nl -> $function();
+			}
+			else
+			{
+				exit;
+			}
 	}
 }
 
 
+
 class newsletter
 {
 	var $message;
@@ -69,30 +77,31 @@
 
 	function newsletter()
 	{
-		global $ns;
+		global $ns, $tp;
 
 		foreach($_POST as $key => $value)
 		{
+			$key = $tp->toDB($key);
 			if(strstr($key, "nlmailnow"))
 			{
-				$this -> releaseIssue($key);
+				$this->releaseIssue($key);
 				break;
 			}
 		}
 
 		if(isset($_POST['delete']))
 		{
-			$this -> deleteNewsletter();
+			$this->deleteNewsletter();
 		}
 
 		if(isset($_POST['createNewsletter']))
 		{
-			$this -> createNewsletter();
+			$this->createNewsletter();
 		}
 
 		if(isset($_POST['createIssue']))
 		{
-			$this -> createIssue();
+			$this->createIssue();
 		}
 
 		if($this -> message)
@@ -195,13 +204,14 @@
 	function defineNewsletter($edit=FALSE)
 	{
 		global $ns, $tp;
+		// We've been passed a value from DB, so should be reasonably sanitised.
 
 		if($edit)
 		{
-			extract($edit);
-			$newsletter_title = $tp -> toFORM($newsletter_title);
-			$newsletter_text = $tp -> toFORM($newsletter_text);
-			$newsletter_footer = $tp -> toFORM($newsletter_footer);
+			$newsletter_title = $tp -> toFORM($edit['newsletter_title']);
+			$newsletter_text = $tp -> toFORM($edit['newsletter_text']);
+			$newsletter_footer = $tp -> toFORM($edit['newsletter_footer']);
+			$newsletter_header = $tp -> toFORM($edit['newsletter_header']);	// Looks as if this was missed
 		}
 
 		$text .= "<div style='text-align:center; margin-left:auto; margin-right: auto;'>
@@ -209,24 +219,24 @@
 		<table style='".ADMIN_WIDTH."' class='fborder'>
 		<tr>
 		<td style='width:30%;' class='forumheader3'>".NLLAN_21."</td>
-		<td style='width:70%' class='forumheader3'><input class='tbox' type='text' name='newsletter_title' size='60' value='$newsletter_title' maxlength='200' /></td>
+		<td style='width:70%' class='forumheader3'><input class='tbox' type='text' name='newsletter_title' size='60' value='{$newsletter_title}' maxlength='200' /></td>
 		</tr>
 		<tr>
 		<td style='width:30%;' class='forumheader3'>".NLLAN_22."</td>
-		<td style='width:70%' class='forumheader3'><textarea class='tbox' id='data' name='newsletter_text' cols='80' rows='10' style='width:95%'>$newsletter_text</textarea></td>
+		<td style='width:70%' class='forumheader3'><textarea class='tbox' id='data' name='newsletter_text' cols='80' rows='10' style='width:95%'>{$newsletter_text}</textarea></td>
 		</tr>
 		<tr>
 		<td style='width:30%;' class='forumheader3'>".NLLAN_23."</td>
-		<td style='width:70%' class='forumheader3'><textarea class='tbox' id='data' name='newsletter_header' cols='80' rows='5' style='width:95%'>$newsletter_header</textarea></td>
+		<td style='width:70%' class='forumheader3'><textarea class='tbox' id='data' name='newsletter_header' cols='80' rows='5' style='width:95%'>{$newsletter_header}</textarea></td>
 		</tr>
 		<tr>
 		<td style='width:30%;' class='forumheader3'>".NLLAN_24."</td>
-		<td style='width:70%' class='forumheader3'><textarea class='tbox' id='data' name='newsletter_footer' cols='80' rows='5' style='width:95%'>$newsletter_footer</textarea></td>
+		<td style='width:70%' class='forumheader3'><textarea class='tbox' id='data' name='newsletter_footer' cols='80' rows='5' style='width:95%'>{$newsletter_footer}</textarea></td>
 		</tr>
 		<tr>
 		<td colspan='2' style='text-align:center' class='forumheader'>
 		".
-		($edit ? "<input class='button' type='submit' name='createNewsletter' value='".NLLAN_25."' />\n<input type='hidden' name='editid' value='$newsletter_id' />" : "<input class='button' type='submit' name='createNewsletter' value='".NLLAN_26."' />")."
+		($edit ? "<input class='button' type='submit' name='createNewsletter' value='".NLLAN_25."' />\n<input type='hidden' name='editid' value='{$edit['newsletter_id']}' />" : "<input class='button' type='submit' name='createNewsletter' value='".NLLAN_26."' />")."
 		</td>
 		</tr>
 
@@ -246,19 +256,20 @@
 	{
 		global $sql, $tp;
 
-		$newsletter_title = $tp -> toDB($_POST['newsletter_title']);
-		$newsletter_text = $tp -> toDB($_POST['newsletter_text']);
-		$newsletter_header = $tp -> toDB($_POST['newsletter_header']);
-		$newsletter_footer = $tp -> toDB($_POST['newsletter_footer']);
+		$letter['newsletter_title'] = $tp -> toDB($_POST['newsletter_title']);
+		$letter['newsletter_text'] = $tp -> toDB($_POST['newsletter_text']);
+		$letter['newsletter_header'] = $tp -> toDB($_POST['newsletter_header']);
+		$letter['newsletter_footer'] = $tp -> toDB($_POST['newsletter_footer']);
 
 		if(isset($_POST['editid']))
 		{
-			$sql -> db_Update("newsletter", "newsletter_title='$newsletter_title', newsletter_text='$newsletter_text', newsletter_header='$newsletter_header', newsletter_footer='$newsletter_footer' WHERE newsletter_id='".$_POST['editid']."' ");
+			$sql -> db_Update("newsletter", "newsletter_title='{$letter['newsletter_title']}', newsletter_text='{$letter['newsletter_text']}', newsletter_header='{$letter['newsletter_header']}', newsletter_footer='{$letter['newsletter_footer']}' WHERE newsletter_id=".intval($_POST['editid']));
 			$this -> message = NLLAN_27;
 		}
 		else
 		{
-			$sql -> db_Insert("newsletter", "0, '".time()."', '$newsletter_title', '$newsletter_text', '$newsletter_header', '$newsletter_footer', '', '0', '0', '0' ");
+			$letter['newsletter_datestamp'] = time();
+			$sql -> db_Insert('newsletter', $letter);
 			$this -> message = NLLAN_28;
 		}
 	}
@@ -269,11 +280,12 @@
 	{
 		global $sql, $ns, $tp;
 
+		// Passed data is from DB
 		if($edit)
 		{
-			extract($edit);
-			$newsletter_title = $tp -> toFORM($newsletter_title);
-			$newsletter_text = $tp -> toFORM($newsletter_text);
+			$newsletter_title = $tp -> toFORM($edit['newsletter_title']);
+			$newsletter_text = $tp -> toFORM($edit['newsletter_text']);
+			$newsletter_issue = $tp -> toFORM($edit['newsletter_issue']);
 		}
 
 		if(!$sql -> db_Select("newsletter", "*", "newsletter_parent='0' "))
@@ -304,20 +316,20 @@
 
 		<tr>
 		<td style='width:30%;' class='forumheader3'>".NLLAN_31."</td>
-		<td style='width:70%' class='forumheader3'><input class='tbox' type='text' name='newsletter_title' size='60' value='$newsletter_title' maxlength='200' /></td>
+		<td style='width:70%' class='forumheader3'><input class='tbox' type='text' name='newsletter_title' size='60' value='{$newsletter_title}' maxlength='200' /></td>
 		</tr>
 		<tr>
 		<td style='width:30%;' class='forumheader3'>".NLLAN_32."</td>
-		<td style='width:70%' class='forumheader3'><input class='tbox' type='text' name='newsletter_issue' size='10' value='$newsletter_issue' maxlength='200' /></td>
+		<td style='width:70%' class='forumheader3'><input class='tbox' type='text' name='newsletter_issue' size='10' value='{$newsletter_issue}' maxlength='200' /></td>
 		</tr>
 		<tr>
 		<td style='width:30%;' class='forumheader3'>".NLLAN_33."</td>
-		<td style='width:70%' class='forumheader3'><textarea class='tbox' id='data' name='newsletter_text' cols='80' rows='10' style='width:95%'>$newsletter_text</textarea></td>
+		<td style='width:70%' class='forumheader3'><textarea class='tbox' id='data' name='newsletter_text' cols='80' rows='10' style='width:95%'>{$edit['newsletter_text']}</textarea></td>
 		</tr>
 		<tr>
 		<td colspan='2' style='text-align:center' class='forumheader'>
 		".
-		($edit ? "<input class='button' type='submit' name='createIssue' value='".NLLAN_34."' />\n<input type='hidden' name='editid' value='$newsletter_id' />" : "<input class='button' type='submit' name='createIssue' value='".NLLAN_35."' />")."
+		($edit ? "<input class='button' type='submit' name='createIssue' value='".NLLAN_34."' />\n<input type='hidden' name='editid' value='{$edit['newsletter_id']}' />" : "<input class='button' type='submit' name='createIssue' value='".NLLAN_35."' />")."
 		</td>
 		</tr>
 		</table>
@@ -335,17 +347,20 @@
 	function createIssue()
 	{
 		global $sql, $tp;
-		$newsletter_title = $tp -> toDB($_POST['newsletter_title']);
-		$newsletter_text = $tp -> toDB($_POST['newsletter_text']);
+		$letter['newsletter_title'] = $tp -> toDB($_POST['newsletter_title']);
+		$letter['newsletter_text'] = $tp -> toDB($_POST['newsletter_text']);
+		$letter['newsletter_parent'] = intval($_POST['newsletter_parent']);
+		$letter['newsletter_issue'] = $tp->toDB($_POST['newsletter_issue']);
 
-		if(isset($_POST['editid']))
+		if (isset($_POST['editid']))
 		{
-			$sql -> db_Update("newsletter", "newsletter_title='$newsletter_title', newsletter_text='$newsletter_text', newsletter_parent='".$_POST['newsletter_parent']."', newsletter_issue='".$_POST['newsletter_issue']."' WHERE newsletter_id='".$_POST['editid']."' ");
+			$sql -> db_Update('newsletter', "newsletter_title='{$letter['newsletter_title']}', newsletter_text='{$letter['newsletter_text']}', newsletter_parent='".$letter['newsletter_parent']."', newsletter_issue='".$letter['newsletter_issue']."' WHERE newsletter_id=".intval($_POST['editid']));
 			$this -> message = NLLAN_38;
 		}
 		else
 		{
-			$sql -> db_Insert("newsletter", "0, '".time()."', '$newsletter_title', '$newsletter_text', '', '', '', '".$_POST['newsletter_parent']."', '0', '".$_POST['newsletter_issue']."' ");
+			$letter['newsletter_datestamp'] = time();
+			$sql -> db_Insert('newsletter', $letter);
 			$this -> message = NLLAN_39;
 		}
 	}
@@ -358,7 +373,7 @@
 
 		$issue = str_replace("nlmailnow_", "", $issue);
 
-		if(!$sql -> db_Select("newsletter", "*", "newsletter_id='$issue' "))
+		if(!$sql -> db_Select("newsletter", "*", "newsletter_id='{$issue}' "))
 		{
 			return FALSE;
 		}
@@ -456,7 +471,7 @@
 	{
 		global $id, $sql;
 
-		if($sql -> db_Select("newsletter", "*", "newsletter_id='$id' "))
+		if($sql -> db_Select("newsletter", "*", "newsletter_id='{$id}' "))
 		{
 			$foo = $sql -> db_Fetch();
 			if(!$foo['newsletter_parent'])
@@ -479,13 +494,13 @@
 		if(strstr($tmp['key'], "newsletter"))
 		{
 			$id = str_replace("newsletter_", "", $tmp['key']);
-			$sql -> db_Delete("newsletter", "newsletter_id='$id' ");
+			$sql -> db_Delete("newsletter", "newsletter_id='{$id}' ");
 			$this -> message = NLLAN_42;
 		}
 		else
 		{
 			$id = str_replace("issue_", "", $tmp['key']);
-			$sql -> db_Delete("newsletter", "newsletter_id='$id' ");
+			$sql -> db_Delete("newsletter", "newsletter_id='{$id}' ");
 			$this -> message = NLLAN_43;
 		}
 	}
@@ -521,17 +536,18 @@
 	global $ns;
 
 	$nl_sql = new db;
-	if(!$nl_sql -> db_Select("newsletter", "*", "newsletter_id=".$p_id))
+	if(!$nl_sql -> db_Select('newsletter', '*', 'newsletter_id='.$p_id))
 	{
 		// Check if newsletter id is available
 		$vs_text .= "<br /><br /><center>".NLLAN_56."<br /><br/>
-                 <input class='button' type=button value='".NLLAN_57."' onClick='history.go(-1)'></center>";
+                 <input class='button' type=button value='".NLLAN_57."' onClick=\"window.location='".e_SELF."'\"></center>";
 		$ns -> tablerender(NLLAN_58, $vs_text);
 		return;
 	} 
 	else 
 	{
 	  $vs_text .= "
+			<form action='".e_SELF."' id='newsletterform' method='post'>
 		<table style='".ADMIN_WIDTH."' class='fborder'>
 			<tr>
 			<td style='width:5%; text-align: center;' class='forumheader'>".NLLAN_55."</td>
@@ -540,10 +556,9 @@
 			<td style='width:15%; text-align: center;' class='forumheader'>".NLLAN_61."</td>
 			</tr>";
 
-		$nl_sql -> db_Select("newsletter", "*", "newsletter_id='".$p_id."'");
+//		$nl_sql -> db_Select("newsletter", "*", "newsletter_id=".$p_id);		Already done
 		if($nl_row = $nl_sql-> db_Fetch())
 		{
-//			$subscribers_total_count = substr_count($nl_row['newsletter_subscribers'], chr(1));
 			$subscribers_list = explode(chr(1), trim($nl_row['newsletter_subscribers']));
 			$subscribers_total_count = count($subscribers_list) - 1;		// Get a null entry as well
 		}
@@ -562,13 +577,13 @@
 				if($nl_row = $nl_sql-> db_Fetch())
 				{
 					$vs_text .= "<tr>
-						<td text-align: center;' class='forumheader3'>{$val}
+						<td style='text-align: center;' class='forumheader3'>{$val}
 						</td>
 						<td class='forumheader3'><a href='".e_BASE."user.php?id.{$val}'>".$nl_row['user_name']."</a>
 						</td>
 						<td class='forumheader3'>".$nl_row['user_email']."
 						</td>
-						<td text-align: center;' class='forumheader3'><a href='".e_SELF."?remove.{$p_id}.{$key}'>".ADMIN_DELETE_ICON."</a>
+						<td style='text-align: center;' class='forumheader3'><a href='".e_SELF."?remove.{$p_id}.{$val}'>".ADMIN_DELETE_ICON."</a>
 					".(($nl_row['user_ban'] > 0) ? NLLAN_62 : "")."
 					</td>
 					</tr>";
@@ -579,29 +594,27 @@
 
 	$vs_text .= "
       <tr>
-      <td colspan=4 class='forumheader'>".NLLAN_63.": ".$subscribers_total_count."</td>
+      <td colspan='4' class='forumheader'>".NLLAN_63.": ".$subscribers_total_count."</td>
       </tr>
-      <tr><td colspan=4 style='text-align:center;'><br /><input class='button' type=button value='".NLLAN_64."' onClick='history.go(-1)'></td></tr>
-      </table>
+      <tr><td colspan='4' style='text-align:center;'><br /><input class='button' type='submit' value='".NLLAN_64."' /></td></tr>
+      </table></form>
       ";
 	$ns -> tablerender(NLLAN_65.' '.$p_id, $vs_text);
  }
  
  
-  function remove_subscribers($p_id, $p_key) 
-  {
-	global $sql;
-   	$sql -> db_Select("newsletter", "*", "newsletter_id=".$p_id);
-  	if($nl_row = $sql-> db_Fetch())
-	{
-		$subscribers_list = explode(chr(1), $nl_row['newsletter_subscribers']);
-		unset($subscribers_list[$p_key]);
-		$new_subscriber_list = implode(chr(1), $subscribers_list);
-		$sql -> db_Update("newsletter", "newsletter_subscribers='{$new_subscriber_list}' WHERE newsletter_id=".$p_id);
-		header("location:".e_SELF."?vs.{$p_id}");
-     	exit;
-  	}
-  }
+	function remove_subscribers($p_id, $p_key) 
+	{
+		global $sql;
+		$sql -> db_Select("newsletter", "*", "newsletter_id=".$p_id);
+		if($nl_row = $sql-> db_Fetch())
+		{
+			$subscribers_list = array_flip(explode(chr(1), $nl_row['newsletter_subscribers']));
+			unset($subscribers_list[$p_key]);
+			$new_subscriber_list = implode(chr(1), array_keys($subscribers_list));
+			$sql -> db_Update("newsletter", "newsletter_subscribers='{$new_subscriber_list}' WHERE newsletter_id=".$p_id);
+		}
+	}
 }
 
 
diff -x .svn -aruN 0.7.15.src/e107_plugins/newsletter/plugin.php 0.7.16.src/e107_plugins/newsletter/plugin.php
--- 0.7.15.src/e107_plugins/newsletter/plugin.php	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_plugins/newsletter/plugin.php	2009-08-15 06:54:08.000000000 -0500
@@ -11,16 +11,15 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/newsletter/plugin.php,v $
-|     $Revision: 1.4 $
-|     $Date: 2006/08/25 15:37:54 $
-|     $Author: e107coders $
+|     $Revision: 1.5 $
+|     $Date: 2009/08/15 11:54:32 $
+|     $Author: marj_nl_fr $
 +----------------------------------------------------------------------------+
 */
 
 if (!defined('e107_INIT')) { exit; }
 
-@include_once(e_PLUGIN."newsletter/languages/".e_LANGUAGE.".php");
-@include_once(e_PLUGIN."newsletter/languages/English.php");
+include_lan(e_PLUGIN."newsletter/languages/".e_LANGUAGE.".php");
 
 // Plugin info -------------------------------------------------------------------------------------------------------
 $eplug_name = "NLLAN_01";
diff -x .svn -aruN 0.7.15.src/e107_plugins/other_news_menu/other_news2_menu.php 0.7.16.src/e107_plugins/other_news_menu/other_news2_menu.php
--- 0.7.15.src/e107_plugins/other_news_menu/other_news2_menu.php	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_plugins/other_news_menu/other_news2_menu.php	2009-06-06 12:03:00.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/other_news_menu/other_news2_menu.php,v $
-|     $Revision: 1.12 $
-|     $Date: 2007/09/09 06:45:04 $
-|     $Author: e107coders $
+|     $Revision: 1.13 $
+|     $Date: 2009/06/06 17:03:24 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 if (!defined('e107_INIT')) { exit; }
@@ -118,7 +118,7 @@
 
 	while ($t % $nbr_cols != 0){
 		$text .= "<td style='width:$wid'>&nbsp;</td>\n";
-		$text .= (($t+1) % nbr_cols == 0) ? "</tr>" : "";
+		$text .= (($t+1) % $nbr_cols == 0) ? "</tr>" : "";
 		$t++;
 
 	}
diff -x .svn -aruN 0.7.15.src/e107_plugins/other_news_menu/other_news_menu.php 0.7.16.src/e107_plugins/other_news_menu/other_news_menu.php
--- 0.7.15.src/e107_plugins/other_news_menu/other_news_menu.php	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_plugins/other_news_menu/other_news_menu.php	2009-06-06 12:03:01.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/other_news_menu/other_news_menu.php,v $
-|     $Revision: 1.19 $
-|     $Date: 2007/09/09 06:45:04 $
-|     $Author: e107coders $
+|     $Revision: 1.20 $
+|     $Date: 2009/06/06 17:03:25 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 if (!defined('e107_INIT')) { exit; }
@@ -118,7 +118,7 @@
 	while ($t % $nbr_cols != 0)
 	{
 		$text .= "<td style='width:$wid'>&nbsp;</td>\n";
-		$text .= (($t+1) % nbr_cols == 0) ? "</tr>" : "";
+		$text .= (($t+1) % $nbr_cols == 0) ? "</tr>" : "";
 		$t++;
 	}
 	$text .= "</table>";
diff -x .svn -aruN 0.7.15.src/e107_plugins/pm/pm_conf.php 0.7.16.src/e107_plugins/pm/pm_conf.php
--- 0.7.15.src/e107_plugins/pm/pm_conf.php	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_plugins/pm/pm_conf.php	2008-12-30 10:34:47.000000000 -0600
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/pm/pm_conf.php,v $
-|     $Revision: 1.8 $
-|     $Date: 2007/02/04 15:36:54 $
-|     $Author: mcfly_e107 $
+|     $Revision: 1.9 $
+|     $Date: 2008/12/30 16:35:10 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 $retrieve_prefs[] = 'pm_prefs';
@@ -176,7 +176,7 @@
 	</tr>
 	<tr>
 		<td class='forumheader3' style='width:75%'>".ADLAN_PM_23."</td>
-		<td class='forumheader3' style='width:25%'>".r_userclass('option[pm_class]', $pm_prefs['pm_class'], 'off', 'members, admin, classes')."</td>
+		<td class='forumheader3' style='width:25%'>".r_userclass('option[pm_class]', $pm_prefs['pm_class'], 'off', 'member, admin, classes')."</td>
 	</tr>
 	<tr>
 		<td class='forumheader3' style='width:75%'>".ADLAN_PM_24."</td>
@@ -184,15 +184,15 @@
 	</tr>
 	<tr>
 		<td class='forumheader3' style='width:75%'>".ADLAN_PM_25."</td>
-		<td class='forumheader3' style='width:25%'>".r_userclass('option[notify_class]', $pm_prefs['notify_class'], 'off', 'nobody, members, admin, classes')."</td>
+		<td class='forumheader3' style='width:25%'>".r_userclass('option[notify_class]', $pm_prefs['notify_class'], 'off', 'nobody, member, admin, classes')."</td>
 	</tr>
 	<tr>
 		<td class='forumheader3' style='width:75%'>".ADLAN_PM_26."</td>
-		<td class='forumheader3' style='width:25%'>".r_userclass('option[receipt_class]', $pm_prefs['receipt_class'], 'off', 'nobody, members, admin, classes')."</td>
+		<td class='forumheader3' style='width:25%'>".r_userclass('option[receipt_class]', $pm_prefs['receipt_class'], 'off', 'nobody, member, admin, classes')."</td>
 	</tr>
 	<tr>
 		<td class='forumheader3' style='width:75%'>".ADLAN_PM_27."</td>
-		<td class='forumheader3' style='width:25%'>".r_userclass('option[attach_class]', $pm_prefs['attach_class'], 'off', 'nobody, members, admin, classes')."</td>
+		<td class='forumheader3' style='width:25%'>".r_userclass('option[attach_class]', $pm_prefs['attach_class'], 'off', 'nobody, member, admin, classes')."</td>
 	</tr>
 	<tr>
 		<td class='forumheader3' style='width:75%'>".ADLAN_PM_28."</td>
@@ -200,11 +200,11 @@
 	</tr>
 	<tr>
 		<td class='forumheader3' style='width:75%'>".ADLAN_PM_29."</td>
-		<td class='forumheader3' style='width:25%'>".r_userclass('option[sendall_class]', $pm_prefs['sendall_class'], 'off', 'nobody, members, admin, classes')."</td>
+		<td class='forumheader3' style='width:25%'>".r_userclass('option[sendall_class]', $pm_prefs['sendall_class'], 'off', 'nobody, member, admin, classes')."</td>
 	</tr>
 	<tr>
 		<td class='forumheader3' style='width:75%'>".ADLAN_PM_30."</td>
-		<td class='forumheader3' style='width:25%'>".r_userclass('option[multi_class]', $pm_prefs['multi_class'], 'off', 'nobody, members, admin, classes')."</td>
+		<td class='forumheader3' style='width:25%'>".r_userclass('option[multi_class]', $pm_prefs['multi_class'], 'off', 'nobody, member, admin, classes')."</td>
 	</tr>
 	<tr>
 		<td class='forumheader3' style='width:75%'>".ADLAN_PM_31."</td>
diff -x .svn -aruN 0.7.15.src/e107_plugins/pm/pm.php 0.7.16.src/e107_plugins/pm/pm.php
--- 0.7.15.src/e107_plugins/pm/pm.php	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_plugins/pm/pm.php	2009-08-24 17:01:25.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/pm/pm.php,v $
-|     $Revision: 1.28 $
-|     $Date: 2008/11/08 17:11:39 $
-|     $Author: e107steved $
+|     $Revision: 1.30 $
+|     $Date: 2009/08/24 22:01:49 $
+|     $Author: bugrain $
 +----------------------------------------------------------------------------+
 */
 
@@ -198,7 +198,7 @@
 			$pm_info['from_name'] = $row['user_name'];
 		}
 	}
-		
+
 	if($pm_outbox['outbox']['filled'] >= 100)
 	{
 		return str_replace('{PERCENT}', $pm_outbox['outbox']['filled'], LAN_PM_13);
@@ -223,7 +223,7 @@
 	include(is_readable($tpl_file) ? $tpl_file : e_PLUGIN."pm/pm_template.php");
 	$pm_blocks = $pm->block_get();
 	$pmlist = $pm->pm_get_inbox(USERID, $pm_start, $pm_prefs['perpage']);
-	$txt = "<form method='post' action='".e_SELF."?".e_QUERY."'>";
+	$txt = "<form method='post' action='".e_SELF."?".e_QUERY."' id='pm_list_form'>";
 	$txt .= $tp->parseTemplate($PM_INBOX_HEADER, true, $pm_shortcodes);
 	if($pmlist['total_messages'])
 	{
@@ -251,7 +251,7 @@
 	$tpl_file = THEME."pm_template.php";
 	include(is_readable($tpl_file) ? $tpl_file : e_PLUGIN."pm/pm_template.php");
 	$pmlist = $pm->pm_get_outbox(USERID, $pm_start, $pm_prefs['perpage']);
-	$txt = "<form method='post' action='".e_SELF."?".e_QUERY."'>";
+	$txt = "<form method='post' action='".e_SELF."?".e_QUERY."' id='pm_list_form'>";
 	$txt .= $tp->parseTemplate($PM_OUTBOX_HEADER, true, $pm_shortcodes);
 	if($pmlist['total_messages'])
 	{
@@ -292,10 +292,10 @@
 	}
 	$txt .= $tp->parseTemplate($PM_SHOW, true, $pm_shortcodes);
 	$ns -> tablerender(LAN_PM, $txt);
-	if($pm_info['pm_from'] == USERID) 
+	if($pm_info['pm_from'] == USERID)
 	{	// Show Outbox
 		$ns->tablerender(LAN_PM." - ".LAN_PM_26, show_outbox($pm_proc_id), "PM");
-	} 
+	}
 	else
 	{	// Show Inbox
 		$ns->tablerender(LAN_PM." - ".LAN_PM_25, show_inbox($pm_proc_id), "PM");
@@ -329,7 +329,7 @@
 			{
 				return LAN_PM_15;
 			}
-			elseif(!check_class($_POST['pm_userclass']) && !ADMIN)
+			elseif((!check_class($_POST['pm_userclass']) || !check_class($pm_prefs['multi_class'])) && !ADMIN)
 			{
 				return LAN_PM_16;
 			}
@@ -419,7 +419,7 @@
 			if(check_class($pm_prefs['attach_class']))
 			{
 				require_once(e_HANDLER."upload_handler.php");
-				$randnum = rand(1000, 9999);			
+				$randnum = rand(1000, 9999);
 				$_POST['uploaded'] = file_upload(e_PLUGIN."pm/attachments", "attachment", $randnum."_");
 				if($_POST['uploaded'] == FALSE)
 				{
diff -x .svn -aruN 0.7.15.src/e107_plugins/pm/pm_shortcodes.php 0.7.16.src/e107_plugins/pm/pm_shortcodes.php
--- 0.7.15.src/e107_plugins/pm/pm_shortcodes.php	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_plugins/pm/pm_shortcodes.php	2009-08-24 17:01:25.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/pm/pm_shortcodes.php,v $
-|     $Revision: 1.20 $
-|     $Date: 2007/09/22 17:41:29 $
-|     $Author: e107steved $
+|     $Revision: 1.22 $
+|     $Date: 2009/08/24 22:01:49 $
+|     $Author: bugrain $
 +----------------------------------------------------------------------------+
 */
 if (!defined('e107_INIT')) { exit; }
@@ -48,7 +48,7 @@
 {
 	return "";
 }
-if($pm_prefs['allow_userclass'])
+if($pm_prefs['allow_userclass'] && check_class($pm_prefs['multi_class']))
 {
 	$ret = "<input type='checkbox' name='to_userclass' value='1' />".LAN_PM_4." ";
 	require_once(e_HANDLER."userclass_class.php");
@@ -262,7 +262,7 @@
 
 SC_BEGIN PM_SELECT
 global $pm_info;
-return "<input type='checkbox' name='selected_pm[{$pm_info['pm_id']}]' value='1' />";
+return "<input type='checkbox' name='selected_pm[{$pm_info['pm_id']}]' id='selected_pm[{$pm_info['pm_id']}]' value='1' />";
 SC_END
 
 SC_BEGIN PM_READ_ICON
@@ -297,7 +297,7 @@
 SC_BEGIN PM_DELETE
 global $pm_info;
 if($parm != "")
-{ 
+{
   $extra = '.'.$parm;
 }
 else
@@ -368,7 +368,7 @@
 		return NEWPM_ANIMATION;
 	}
 }
-return "";
+return '';
 SC_END
 
 SC_BEGIN PM_NEXTPREV
@@ -376,5 +376,10 @@
 return $tp->parseTemplate("{NEXTPREV={$pmlist['total_messages']},{$pm_prefs['perpage']},{$pm_start},".e_SELF."?{$parm}.[FROM]}");
 SC_END
 
+SC_BEGIN PM_CHECK_ALL_NONE
+return "<input type='checkbox' id='pm_check_all_none' class='tbox' onclick='setCheckboxes(\"pm_list_form\", document.getElementById(\"pm_check_all_none\").checked)'/>";
+SC_END
+
+
 */
 ?>
\ No newline at end of file
diff -x .svn -aruN 0.7.15.src/e107_plugins/pm/pm_template.php 0.7.16.src/e107_plugins/pm/pm_template.php
--- 0.7.15.src/e107_plugins/pm/pm_template.php	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_plugins/pm/pm_template.php	2009-08-24 17:01:25.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/pm/pm_template.php,v $
-|     $Revision: 1.14 $
-|     $Date: 2008/07/28 20:15:58 $
-|     $Author: e107steved $
+|     $Revision: 1.15 $
+|     $Date: 2009/08/24 22:01:49 $
+|     $Author: bugrain $
 +----------------------------------------------------------------------------+
 */
 if (!defined('e107_INIT')) { exit; }
@@ -55,7 +55,7 @@
 $sc_style['PM_REPLY']['pre'] = "<tr>
 	<td class='forumheader' style='text-align:center' colspan='2'>
 ";
-	
+
 $sc_style['PM_REPLY']['post'] = "</td>
 	</tr>
 ";
@@ -90,7 +90,7 @@
 $PM_INBOX_HEADER = "
 <table class='fborder' style='width:95%'>
 <tr>
-	<td class='fcaption' style='width:1%'>&nbsp;</td>
+	<td class='fcaption' style='width:1%'>{PM_CHECK_ALL_NONE}</td>
 	<td class='fcaption' style='width:1%'>&nbsp;</td>
 	<td class='fcaption' style='width:38%'>".LAN_PM_5."</td>
 	<td class='fcaption' style='width:22%'>".LAN_PM_31."</td>
@@ -129,7 +129,7 @@
 $PM_OUTBOX_HEADER = "
 <table class='fborder' style='width:95%'>
 <tr>
-	<td class='fcaption' style='width:1%'>&nbsp;</td>
+	<td class='fcaption' style='width:1%'>{PM_CHECK_ALL_NONE}</td>
 	<td class='fcaption' style='width:1%'>&nbsp;</td>
 	<td class='fcaption' style='width:38%'>".LAN_PM_5."</td>
 	<td class='fcaption' style='width:22%'>".LAN_PM_2."</td>
diff -x .svn -aruN 0.7.15.src/e107_plugins/pm/pm_update.php 0.7.16.src/e107_plugins/pm/pm_update.php
--- 0.7.15.src/e107_plugins/pm/pm_update.php	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_plugins/pm/pm_update.php	2009-08-15 06:54:08.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/pm/pm_update.php,v $
-|     $Revision: 1.3 $
-|     $Date: 2006/02/23 15:37:19 $
-|     $Author: whoisrich $
+|     $Revision: 1.4 $
+|     $Date: 2009/08/15 11:54:32 $
+|     $Author: marj_nl_fr $
 +----------------------------------------------------------------------------+
 */
 
@@ -21,8 +21,7 @@
 
 set_time_limit(300);
 
-@include_once(e_PLUGIN."pm/languages/admin/".e_LANGUAGE.".php");
-@include_once(e_PLUGIN."pm/languages/admin/English.php");
+include_lan(e_PLUGIN."pm/languages/admin/".e_LANGUAGE.".php");
 
 $sql->db_Update("plugin", "plugin_name=".ADLAN_PM." WHERE plugin_path='pm'");
 
diff -x .svn -aruN 0.7.15.src/e107_plugins/pm/sendpm.sc 0.7.16.src/e107_plugins/pm/sendpm.sc
--- 0.7.15.src/e107_plugins/pm/sendpm.sc	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_plugins/pm/sendpm.sc	2009-08-15 06:54:08.000000000 -0500
@@ -1,5 +1,4 @@
-@include_once(e_PLUGIN."pm/languages/".e_LANGUAGE.".php");
-@include_once(e_PLUGIN."pm/languages/English.php");
+include_lan(e_PLUGIN."pm/languages/".e_LANGUAGE.".php");
 global $sysprefs, $pm_prefs;
 $pm_prefs = $sysprefs->getArray("pm_prefs");
 if(check_class($pm_prefs['pm_class']))
diff -x .svn -aruN 0.7.15.src/e107_plugins/poll/oldpolls.php 0.7.16.src/e107_plugins/poll/oldpolls.php
--- 0.7.15.src/e107_plugins/poll/oldpolls.php	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_plugins/poll/oldpolls.php	2009-08-20 05:17:49.000000000 -0500
@@ -1,21 +1,21 @@
 <?php
 /*
-+ ----------------------------------------------------------------------------+
-|     e107 website system
-|
-|     Steve Dunstan 2001-2002
-|     http://e107.org
-|     jalist@e107.org
-|
-|     Released under the terms and conditions of the
-|     GNU General Public License (http://gnu.org).
-|
-|     $Source: /cvsroot/e107/e107_0.7/e107_plugins/poll/oldpolls.php,v $
-|     $Revision: 1.14 $
-|     $Date: 2007/03/03 19:41:17 $
-|     $Author: e107steved $
-+----------------------------------------------------------------------------+
-*/
+ + ----------------------------------------------------------------------------+
+ |     e107 website system
+ |
+ |     Steve Dunstan 2001-2002
+ |     http://e107.org
+ |     jalist@e107.org
+ |
+ |     Released under the terms and conditions of the
+ |     GNU General Public License (http://gnu.org).
+ |
+ |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/poll/oldpolls.php,v $
+ |     $Revision: 1.16 $
+ |     $Date: 2009/08/20 10:18:13 $
+ |     $Author: marj_nl_fr $
+ +----------------------------------------------------------------------------+
+ */
 require_once("../../class2.php");
 require_once(HEADERF);
 require_once(e_HANDLER."comment_class.php");
@@ -23,10 +23,7 @@
 $gen = new convert;
 if(!defined("USER_WIDTH")){ define("USER_WIDTH","width:95%"); }
 
-
-@include(e_PLUGIN."poll/languages/".e_LANGUAGE.".php");
-@include(e_PLUGIN."poll/languages/English.php");
-
+include_lan(e_PLUGIN."poll/languages/".e_LANGUAGE.".php");
 
 if(e_QUERY)
 {
@@ -73,14 +70,20 @@
 
 		foreach($optionArray as $option)
 		{
-			$text .= "<tr>
+			$text .= "
+			<tr>
 			<td style='width:40%; text-align: right' class='mediumtext'><b>".$tp -> toHTML($option)."</b>&nbsp;&nbsp;</td>
 			<td class='smalltext'>
-
-
-			<div style='background-image: url($barl); width: 5px; height: 14px; float: left;'></div><div style='background-image: url($bar); width: ".(floor($percentage[$count]) != 100 ? floor($percentage[$count]) : 95)."%; height: 14px; float: left;'></div><div style='background-image: url($barr); width: 5px; height: 14px; float: left;'></div>".$percentage[$count]."% [".POLLAN_31.": ".$voteArray[$count]."]</div>
+				<div style='background-image: url($barl); width: 5px; height: 14px; float: left;'>
+				</div>
+				<div style='background-image: url($bar); width: ".(floor($percentage[$count]) != 100 ? floor($percentage[$count]) : 95)."%; height: 14px; float: left;'>
+				</div>
+				<div style='background-image: url($barr); width: 5px; height: 14px; float: left;'>
+				</div>
+				".$percentage[$count]."% [".POLLAN_31.": ".$voteArray[$count]."]
 			</td>
-			</tr>\n";
+			</tr>
+			";
 			$count++;
 
 		}
@@ -131,6 +134,12 @@
 <td class='fcaption' style='width: 30%;'>".POLLAN_36."</td>
 </tr>\n";
 
+if (!is_object($tp->e_bb))
+{
+	require_once(e_HANDLER.'bbcode_handler.php');
+	$tp->e_bb = new e_bbcode;
+}
+
 foreach($oldpollArray as $oldpoll)
 {
 	extract($oldpoll);
@@ -138,7 +147,7 @@
 	$to = $gen->convert_date($poll_end_datestamp, "short");
 
 	$poll_title = $tp->e_bb->parseBBCodes($poll_title, 0,TRUE,TRUE);		// Strip bbcodes
-	
+
 	$text .= "<tr>
 	<td class='forumheader3' style='width: 55%;'><a href='".e_SELF."?{$poll_id}'>{$poll_title}</a></td>
 	<td class='forumheader3' style='width: 15%;'><a href='".e_BASE."user.php?id.{$poll_admin_id}'>{$user_name}</a></td>
@@ -149,5 +158,3 @@
 $text .= "</table>";
 $ns->tablerender(POLLAN_28, $text);
 require_once(FOOTERF);
-
-?>
diff -x .svn -aruN 0.7.15.src/e107_plugins/poll/poll_class.php 0.7.16.src/e107_plugins/poll/poll_class.php
--- 0.7.15.src/e107_plugins/poll/poll_class.php	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_plugins/poll/poll_class.php	2009-08-15 06:54:08.000000000 -0500
@@ -11,14 +11,14 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/poll/poll_class.php,v $
-|     $Revision: 1.61 $
-|     $Date: 2008/11/16 18:01:08 $
-|     $Author: e107steved $
+|     $Revision: 1.62 $
+|     $Date: 2009/08/15 11:54:32 $
+|     $Author: marj_nl_fr $
 +----------------------------------------------------------------------------+
 */
 if (!defined('e107_INIT')) { exit; }
 
-@include_lan(e_PLUGIN."poll/languages/".e_LANGUAGE.".php");
+include_lan(e_PLUGIN."poll/languages/".e_LANGUAGE.".php");
 define("POLLCLASS", TRUE);
 define("POLL_MODE_COOKIE", 0);
 define("POLL_MODE_IP", 1);
@@ -270,8 +270,6 @@
 
 		if($type == "preview")
 		{
-			/* load lan file */
-			@include_lan(e_PLUGIN."poll/languages/".e_LANGUAGE.".php");
 			$optionArray = $pollArray['poll_option'];
 			$voteArray = array();
 			$voteArray = array_pad($voteArray, count($optionArray), 0);
@@ -279,7 +277,6 @@
 		}
 		else if($type == "forum")
 		{
-			@include_lan(e_PLUGIN."poll/languages/".e_LANGUAGE.".php");
 			if(isset($_POST['fpreview']))
 			{
 				$pollArray['poll_allow_multiple'] = $pollArray['multipleChoice'];
diff -x .svn -aruN 0.7.15.src/e107_plugins/poll/poll_menu.php 0.7.16.src/e107_plugins/poll/poll_menu.php
--- 0.7.15.src/e107_plugins/poll/poll_menu.php	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_plugins/poll/poll_menu.php	2009-08-15 06:54:08.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/poll/poll_menu.php,v $
-|     $Revision: 1.11 $
-|     $Date: 2008/06/03 21:31:19 $
-|     $Author: e107steved $
+|     $Revision: 1.12 $
+|     $Date: 2009/08/15 11:54:32 $
+|     $Author: marj_nl_fr $
 +----------------------------------------------------------------------------+
 */
 
@@ -37,8 +37,7 @@
 if(!defined("POLL_1"))
 {
 	/* if menu is being called from comments, lan files have to be included manually ... */
-	@include_once(e_PLUGIN."poll/languages/".e_LANGUAGE.".php");
-	@include_once(e_PLUGIN."poll/languages/English.php");
+	include_lan(e_PLUGIN."poll/languages/".e_LANGUAGE.".php");
 }
 
 if (empty($poll_to_show))
diff -x .svn -aruN 0.7.15.src/e107_plugins/rss_menu/rss.php 0.7.16.src/e107_plugins/rss_menu/rss.php
--- 0.7.15.src/e107_plugins/rss_menu/rss.php	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_plugins/rss_menu/rss.php	2009-06-29 01:26:10.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/rss_menu/rss.php,v $
-|     $Revision: 1.64 $
-|     $Date: 2008/11/02 22:28:03 $
-|     $Author: e107steved $
+|     $Revision: 1.66 $
+|     $Date: 2009/06/29 06:26:34 $
+|     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
 
@@ -185,19 +185,23 @@
 		switch ($content_type) {
 			case 'news' :
 			case 1:
-				if($topic_id && is_numeric($topic_id)){
+				if($topic_id && is_numeric($topic_id))
+				{
 					$topic = " AND news_category = ".intval($topic_id);
-				}else{
+				}
+				else
+				{
 					$topic = '';
 				}
 				$path='';
 				$render = ($pref['rss_othernews'] != 1) ? "AND n.news_render_type < 2" : "";
+				$nobody_regexp = "'(^|,)(".str_replace(",", "|", e_UC_NOBODY).")(,|$)'";
 
 				$this -> rssQuery = "
 				SELECT n.*, u.user_id, u.user_name, u.user_email, u.user_customtitle, nc.category_name, nc.category_icon FROM #news AS n
 				LEFT JOIN #user AS u ON n.news_author = u.user_id
 				LEFT JOIN #news_category AS nc ON n.news_category = nc.category_id
-				WHERE n.news_class IN (".USERCLASS_LIST.") AND n.news_start < ".time()." AND (n.news_end=0 || n.news_end>".time().") {$render} {$topic} ORDER BY news_datestamp DESC LIMIT 0,".$this -> limit;
+				WHERE n.news_class IN (".USERCLASS_LIST.") AND NOT (n.news_class REGEXP ".$nobody_regexp.") AND n.news_start < ".time()." AND (n.news_end=0 || n.news_end>".time().") {$render} {$topic} ORDER BY news_datestamp DESC LIMIT 0,".$this -> limit;
 				$sql->db_Select_gen($this -> rssQuery);
 				$tmp = $sql->db_getList();
 				$this -> rssItems = array();
@@ -396,7 +400,7 @@
 	}
 
 	function buildRss($rss_title) {
-		global $sql, $pref, $tp, $e107, $PLUGINS_DIRECTORY;
+		global $sql, $pref, $tp, $e107, $PLUGINS_DIRECTORY,$topic_id ;
 		header('Content-type: application/xml', TRUE);
 
 		$rss_title = $tp->toRss($pref['sitename']." : ".$rss_title);
@@ -450,32 +454,38 @@
 
 				echo "<language>".CORE_LC.(defined("CORE_LC2") ? "-".CORE_LC2 : "")."</language>
 				<copyright>".preg_replace("#\<br \/\>|\n|\r#si", "", SITEDISCLAIMER)."</copyright>
-				<managingEditor>".$pref['siteadmin']." - ".$this->nospam($pref['siteadminemail'])."</managingEditor>
-				<webMaster>".$this->nospam($pref['siteadminemail'])."</webMaster>
+				<managingEditor>".$this->nospam($pref['siteadminemail'])." (".$pref['siteadmin'].")</managingEditor>
+				<webMaster>".$this->nospam($pref['siteadminemail'])." (".$pref['siteadmin'].")</webMaster>
 				<pubDate>".date("r",($time + $this -> offset))."</pubDate>
 				<lastBuildDate>".date("r",($time + $this -> offset))."</lastBuildDate>
 				<docs>http://backend.userland.com/rss</docs>
 				<generator>e107 (http://e107.org)</generator>
 				<ttl>60</ttl>";
+
 				if (trim(SITEBUTTON))
 				{
-				echo "
-				<image>
-				<title>".$tp->toRss($rss_title)."</title>
-				<url>".(strstr(SITEBUTTON, "http:") ? SITEBUTTON : SITEURL.str_replace("../", "", e_IMAGE).SITEBUTTON)."</url>
-				<link>".$pref['siteurl']."</link>
-				<width>88</width>
-				<height>31</height>
-				<description>".$tp->toRss($pref['sitedescription'])."</description>
-				</image>";
+					echo "
+					<image>
+					<title>".$tp->toRss($rss_title)."</title>
+					<url>".(strstr(SITEBUTTON, "http:") ? SITEBUTTON : SITEURL.str_replace("../", "", e_IMAGE).SITEBUTTON)."</url>
+					<link>".$pref['siteurl']."</link>
+					<width>88</width>
+					<height>31</height>
+					<description>".$tp->toRss($pref['sitedescription'])."</description>
+					</image>";
 				}
-				echo "
+
+				// Generally Ignored by 99% of readers.
+               /*
+			   	echo "
 				<textInput>
 				<title>Search</title>
 				<description>Search ".$tp->toRss($pref['sitename'])."</description>
 				<name>query</name>
 				<link>".SITEURL.(substr(SITEURL, -1) == "/" ? "" : "/")."search.php</link>
 				</textInput>";
+				*/
+
 				foreach($this -> rssItems as $value)
 				{
                     // Multi-language rss links.
@@ -502,7 +512,7 @@
 					}
 
 					if($value['author']){
-						echo "<author>".$value['author']."&lt;".$this->nospam($value['author_email'])."&gt;</author>\n";
+						echo "<author>".$this->nospam($value['author_email'])." (".$value['author'].")</author>\n";
 					}
 
 					// enclosure support for podcasting etc.
@@ -518,6 +528,7 @@
 
 					echo "</item>";
 				}
+		   //		echo "<atom:link href=\"".e_SELF."?".($this -> contentType).".4.".$this -> topicId ."\" rel=\"self\" type=\"application/rss+xml\" />";
 				echo "
 				</channel>
 				</rss>";
diff -x .svn -aruN 0.7.15.src/e107_plugins/trackback/admin_config.php 0.7.16.src/e107_plugins/trackback/admin_config.php
--- 0.7.15.src/e107_plugins/trackback/admin_config.php	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_plugins/trackback/admin_config.php	2009-08-15 06:54:08.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/trackback/admin_config.php,v $
-|     $Revision: 1.4 $
-|     $Date: 2007/12/26 14:20:00 $
-|     $Author: e107steved $
+|     $Revision: 1.5 $
+|     $Date: 2009/08/15 11:54:32 $
+|     $Author: marj_nl_fr $
 +----------------------------------------------------------------------------+
 */
 require_once("../../class2.php");
@@ -22,8 +22,7 @@
 	 exit ;
 }
 
-@include_once(e_PLUGIN."trackback/languages/".e_LANGUAGE.".php");
-@include_once(e_PLUGIN."trackback/languages/English.php");
+include_lan(e_PLUGIN."trackback/languages/".e_LANGUAGE.".php");
 	
 require_once(e_ADMIN."auth.php");
 	
diff -x .svn -aruN 0.7.15.src/e107_plugins/tree_menu/config.php 0.7.16.src/e107_plugins/tree_menu/config.php
--- 0.7.15.src/e107_plugins/tree_menu/config.php	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_plugins/tree_menu/config.php	2009-08-15 06:54:08.000000000 -0500
@@ -11,15 +11,14 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/tree_menu/config.php,v $
-|     $Revision: 1.7 $
-|     $Date: 2005/10/07 03:29:47 $
-|     $Author: sweetas $
+|     $Revision: 1.8 $
+|     $Date: 2009/08/15 11:54:32 $
+|     $Author: marj_nl_fr $
 +----------------------------------------------------------------------------+
 */
 $eplug_admin = TRUE;
 require_once("../../class2.php");
-@include_once(e_PLUGIN."tree_menu/languages/".e_LANGUAGE.".php");
-@include_once(e_PLUGIN."tree_menu/languages/English.php");
+include_lan(e_PLUGIN."tree_menu/languages/".e_LANGUAGE.".php");
 
 if (!getperms("4")) {
 	header("location:".e_BASE."index.php");
diff -x .svn -aruN 0.7.15.src/e107_plugins/userlanguage_menu/userlanguage_menu.php 0.7.16.src/e107_plugins/userlanguage_menu/userlanguage_menu.php
--- 0.7.15.src/e107_plugins/userlanguage_menu/userlanguage_menu.php	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_plugins/userlanguage_menu/userlanguage_menu.php	2009-08-14 06:32:10.000000000 -0500
@@ -11,53 +11,64 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/userlanguage_menu/userlanguage_menu.php,v $
-|     $Revision: 1.12 $
-|     $Date: 2007/09/01 02:25:11 $
-|     $Author: e107coders $
+|     $Revision: 1.14 $
+|     $Date: 2009/08/14 11:32:34 $
+|     $Author: marj_nl_fr $
 +----------------------------------------------------------------------------+
 */
 
-if (!defined('e107_INIT')) { exit; }
+if ( ! defined('e107_INIT')) { exit(); }
 
-require_once(e_HANDLER."language_class.php");
+require_once(e_HANDLER.'language_class.php');
 $slng = new language;
-require_once(e_HANDLER."file_class.php");
-	$fl = new e_file;
-	$lanlist = $fl->get_dirs(e_LANGUAGEDIR);
-	sort($lanlist);
 
-	if(isset($pref['multilanguage_subdomain']) && $pref['multilanguage_subdomain'])
+$languageList = explode(',', e_LANLIST);
+sort($languageList);
+
+if(varset($pref['multilanguage_subdomain']))
+{
+	$action = (e_QUERY) ? e_SELF.'?'.e_QUERY : e_SELF;
+	$text = '
+	<form method="post" action="'.$action.'">
+		<div style="text-align:center">
+			<select class="tbox" name="lang_select" style="width:95%" onchange="location.href=this.options[selectedIndex].value">';
+	foreach($languageList as $languageFolder)
 	{
-        	$text = "<div style='text-align:center'><select class='tbox' name='lang_select' style='width:95%' onchange=\"location.href=this.options[selectedIndex].value\">";
-			foreach($lanlist as $lng)
-			{
-				$selected = ($lng  == USERLAN || ($lng == $pref['sitelanguage'] && USERLAN == "")) ? "selected='selected'" : "";
-                $urlval = $slng->subdomainUrl($lng);
-				$text .= "<option value='".$urlval."' $selected>$lng</option>\n";
-			}
-			$text .= "</select></div>";
+		$selected = ($languageFolder == e_LANGUAGE) ? ' selected="selected"' : '';
+		$urlval   = $slng->subdomainUrl($languageFolder);
+		$text .= '
+				<option value="'.$urlval.'" $selected>$languageFolder</option>';
+		$text .= '
+				<option value="'.$urlval.'"'.$selected.'>'.$languageFolder.'</option>';
 	}
-	else
+	$text .= '
+			</select>
+		</div>
+	</form>';
+}
+else
+{
+	//FIXME may not work with session
+	$action = (e_QUERY && ! $_GET['elan']) ? e_SELF.'?'.e_QUERY : e_SELF;
+	$text = '
+		<div style="text-align:center">
+			<select name="sitelanguage" class="tbox">';
+	foreach($languageList as $languageFolder)
 	{
-		$action = (e_QUERY && !$_GET['elan']) ? e_SELF."?".e_QUERY : e_SELF;
-		$text = "<form method='post' action='".$action."'>
-			<div style='text-align:center'>
-			<select name='sitelanguage' class='tbox' >";
-		foreach($lanlist as $langval)
-		{
-			$selected ="";
-			if($langval == USERLAN || ($langval == $pref['sitelanguage'] && USERLAN == ""))
-			{
-				$selected = "selected='selected'";
-			}
-			$text .= "<option value='".$langval."' $selected>".$langval."</option>\n ";
-		}
-
-		$text .= "</select>";
-		$text .= "<br /><br /><input class='button' type='submit' name='setlanguage' value='".UTHEME_MENU_L1."' />";
-		$text .= "</div></form>";
+		$selected = ($languageFolder == e_LANGUAGE) ? ' selected="selected"' : '';
+		$text .= '
+				<option value="'.$languageFolder.'"'.$selected.'>'.$languageFolder.'</option>';
 	}
 
+	$text .= '
+			</select>
+			<br />
+			<br />
+			<button class="button" type="submit" name="setlanguage"><span>'.UTHEME_MENU_L1.'</span></button>';
+	$text .= '
+		</div>';
+}
+
 $ns->tablerender(UTHEME_MENU_L2, $text, 'user_lan');
 
 ?>
\ No newline at end of file
diff -x .svn -aruN 0.7.15.src/e107_plugins/usertheme_menu/config.php 0.7.16.src/e107_plugins/usertheme_menu/config.php
--- 0.7.15.src/e107_plugins/usertheme_menu/config.php	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_plugins/usertheme_menu/config.php	2009-08-15 06:54:08.000000000 -0500
@@ -11,14 +11,14 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/usertheme_menu/config.php,v $
-|     $Revision: 1.2 $
-|     $Date: 2008/11/16 16:46:44 $
-|     $Author: e107steved $
+|     $Revision: 1.3 $
+|     $Date: 2009/08/15 11:54:32 $
+|     $Author: marj_nl_fr $
 +----------------------------------------------------------------------------+
 */
 $eplug_admin = TRUE;
 require_once("../../class2.php");
-@include_lan(e_PLUGIN."usertheme_menu/languages/".e_LANGUAGE.".php");
+include_lan(e_PLUGIN."usertheme_menu/languages/".e_LANGUAGE.".php");
 require_once(e_HANDLER.'userclass_class.php');
 
 
diff -x .svn -aruN 0.7.15.src/e107.robots.txt 0.7.16.src/e107.robots.txt
--- 0.7.15.src/e107.robots.txt	1969-12-31 18:00:00.000000000 -0600
+++ 0.7.16.src/e107.robots.txt	2009-08-15 08:12:23.000000000 -0500
@@ -0,0 +1,5 @@
+User-agent: *
+Disallow: /e107_admin/
+Disallow: /e107_handlers/
+Disallow: /e107_files/cache/
+Disallow: /e107_files/public/avatars/
diff -x .svn -aruN 0.7.15.src/e107_themes/crahan/theme.php 0.7.16.src/e107_themes/crahan/theme.php
--- 0.7.15.src/e107_themes/crahan/theme.php	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_themes/crahan/theme.php	2009-07-18 10:53:18.000000000 -0500
@@ -11,17 +11,16 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_themes/crahan/theme.php,v $
-|     $Revision: 1.10 $
-|     $Date: 2005/12/14 19:28:52 $
-|     $Author: sweetas $
+|     $Revision: 1.11 $
+|     $Date: 2009/07/18 15:53:42 $
+|     $Author: marj_nl_fr $
 +----------------------------------------------------------------------------+
 */
 
 if (!defined('e107_INIT')) { exit; }
 
 // [multilanguage]
-@include_once(e_THEME."crahan/languages/".e_LANGUAGE.".php");
-@include_once(e_THEME."crahan/languages/English.php");
+include_lan(e_THEME."crahan/languages/".e_LANGUAGE.".php");
 
 // [theme]
 $themename = "CraHan";
diff -x .svn -aruN 0.7.15.src/e107_themes/e107v4a/style.css 0.7.16.src/e107_themes/e107v4a/style.css
--- 0.7.15.src/e107_themes/e107v4a/style.css	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_themes/e107v4a/style.css	2009-07-29 04:13:25.000000000 -0500
@@ -248,7 +248,7 @@
 	color:#000;
 	padding: 4px;
 	border: #C3BDBD 1px solid;
-	background-image : url(forum/finfobar.png);
+/*	background-image : url(forum/finfobar.png); */
 }
 
 a.forumlink{
diff -x .svn -aruN 0.7.15.src/e107_themes/human_condition/style.css 0.7.16.src/e107_themes/human_condition/style.css
--- 0.7.15.src/e107_themes/human_condition/style.css	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_themes/human_condition/style.css	2009-07-29 03:41:59.000000000 -0500
@@ -2,7 +2,7 @@
 	margin: 0 auto;
 	background: #E4F2FF url(images/bg.png) repeat-y center;
 	width: 767px;
-	font-family: Lucida Grande, Lucida Sans Unicode, Lucida, Helvetica, Verdana, Arial, Sans-serif;
+	font-family: "Lucida Grande", "Lucida Sans Unicode", Lucida, Helvetica, Verdana, Arial, sans-serif;
 	text-align: center;
 }
 
@@ -98,7 +98,7 @@
 
 .menubox {
 	color: #242424;
-	font-family: Lucida Grande, Lucida Sans Unicode, Lucida, Helvetica, Verdana, Arial, Sans-serif;
+	font-family: "Lucida Grande", "Lucida Sans Unicode", Lucida, Helvetica, Verdana, Arial, sans-serif;
 	font-size: 8pt;
 	margin-top: 15px;
 	padding: 5px;
diff -x .svn -aruN 0.7.15.src/e107_themes/human_condition/theme.php 0.7.16.src/e107_themes/human_condition/theme.php
--- 0.7.15.src/e107_themes/human_condition/theme.php	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_themes/human_condition/theme.php	2009-07-18 10:53:18.000000000 -0500
@@ -11,17 +11,16 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_themes/human_condition/theme.php,v $
-|     $Revision: 1.13 $
-|     $Date: 2008/07/20 17:08:44 $
-|     $Author: e107steved $
+|     $Revision: 1.14 $
+|     $Date: 2009/07/18 15:53:42 $
+|     $Author: marj_nl_fr $
 +----------------------------------------------------------------------------+
 */
 
 if (!defined('e107_INIT')) { exit; }
 
 // [multilanguage]
-@include_once(e_THEME."human_condition/languages/".e_LANGUAGE.".php");
-@include_once(e_THEME."human_condition/languages/English.php");
+include_lan(e_THEME."human_condition/languages/".e_LANGUAGE.".php");
 
 // [theme]
 $themename = "human condition";
diff -x .svn -aruN 0.7.15.src/e107_themes/interfectus/theme.php 0.7.16.src/e107_themes/interfectus/theme.php
--- 0.7.15.src/e107_themes/interfectus/theme.php	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_themes/interfectus/theme.php	2009-07-18 10:53:18.000000000 -0500
@@ -11,17 +11,16 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_themes/interfectus/theme.php,v $
-|     $Revision: 1.11 $
-|     $Date: 2007/03/18 11:20:30 $
-|     $Author: e107steved $
+|     $Revision: 1.12 $
+|     $Date: 2009/07/18 15:53:42 $
+|     $Author: marj_nl_fr $
 +----------------------------------------------------------------------------+
 */
 
 if (!defined('e107_INIT')) { exit; }
 
 // [multilanguage]
-@include_once(e_THEME."interfectus/languages/".e_LANGUAGE.".php");
-@include_once(e_THEME."interfectus/languages/English.php");
+include_lan(e_THEME."interfectus/languages/".e_LANGUAGE.".php");
 
 // [theme]
 $themename = "interfectus";
diff -x .svn -aruN 0.7.15.src/e107_themes/jayya/admin_template.php 0.7.16.src/e107_themes/jayya/admin_template.php
--- 0.7.15.src/e107_themes/jayya/admin_template.php	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_themes/jayya/admin_template.php	2009-08-03 14:40:19.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_themes/jayya/admin_template.php,v $
-|     $Revision: 1.21 $
-|     $Date: 2007/08/16 00:00:26 $
-|     $Author: e107coders $
+|     $Revision: 1.22 $
+|     $Date: 2009/08/03 19:40:43 $
+|     $Author: marj_nl_fr $
 +----------------------------------------------------------------------------+
 */
 
@@ -47,7 +47,6 @@
 <div style='margin-bottom: 3px;'>
 {ADMIN_LOGGED}
 {ADMIN_SEL_LAN}
-{ADMIN_USERLAN}
 </div>
 {SITELINKS=flat}
 </td>
diff -x .svn -aruN 0.7.15.src/e107_themes/jayya/forum/forum_icons_template.php 0.7.16.src/e107_themes/jayya/forum/forum_icons_template.php
--- 0.7.15.src/e107_themes/jayya/forum/forum_icons_template.php	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_themes/jayya/forum/forum_icons_template.php	2009-07-18 10:53:18.000000000 -0500
@@ -11,16 +11,15 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_themes/jayya/forum/forum_icons_template.php,v $
-|     $Revision: 1.4 $
-|     $Date: 2007/06/06 19:31:50 $
-|     $Author: e107steved $
+|     $Revision: 1.5 $
+|     $Date: 2009/07/18 15:53:42 $
+|     $Author: marj_nl_fr $
 +----------------------------------------------------------------------------+
 */
 	
 if (!defined('e107_INIT')) { exit; }
 
-@include_once(e_PLUGIN.'forum/languages/'.e_LANGUAGE.'/lan_forum_viewforum.php');
-@include_once(e_PLUGIN.'forum/languages/English/lan_forum_viewforum.php');
+include_lan(e_PLUGIN.'forum/languages/'.e_LANGUAGE.'/lan_forum_viewforum.php');
 
 define("IMAGE_e", "<img src='".img_path('e.png')."' alt='' title='' style='border:0' />");
 define("IMAGE_new", "<img src='".img_path('new.png')."' alt='".LAN_199."' title='".LAN_199."' style='border:0' />");
diff -x .svn -aruN 0.7.15.src/e107_themes/khatru/theme.php 0.7.16.src/e107_themes/khatru/theme.php
--- 0.7.15.src/e107_themes/khatru/theme.php	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_themes/khatru/theme.php	2009-07-18 10:53:18.000000000 -0500
@@ -3,7 +3,7 @@
 +---------------------------------------------------------------+
 |	e107 website system
 |
-|	�Steve Dunstan 2001-2005
+|	(C)Steve Dunstan 2001-2005
 |	http://e107.org
 |	jalist@e107.org
 |
@@ -14,8 +14,7 @@
 if (!defined('e107_INIT')) { exit; }
 
 // [multilanguage]
-@include_once(THEME."languages/".e_LANGUAGE.".php");
-@include_once(THEME."languages/English.php");
+include_lan(e_THEME."khatru/languages/".e_LANGUAGE.".php");
 
 // [theme]
 $themename = "khatru";
diff -x .svn -aruN 0.7.15.src/e107_themes/kubrick/languages/English.php 0.7.16.src/e107_themes/kubrick/languages/English.php
--- 0.7.15.src/e107_themes/kubrick/languages/English.php	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_themes/kubrick/languages/English.php	2009-06-11 14:21:12.000000000 -0500
@@ -11,8 +11,8 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_themes/kubrick/languages/English.php,v $
-|     $Revision: 1.4 $
-|     $Date: 2007/03/03 19:59:43 $
+|     $Revision: 1.5 $
+|     $Date: 2009/06/11 19:21:36 $
 |     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
@@ -22,6 +22,8 @@
 define("LAN_THEME_3", "comment: ");
 define("LAN_THEME_4", "Read the rest ...");
 define("LAN_THEME_5", "Trackbacks: ");
+define('LAN_THEME_6', 'on');
+define('LAN_THEME_7', 'by');
 
 
 ?>
\ No newline at end of file
diff -x .svn -aruN 0.7.15.src/e107_themes/kubrick/theme.php 0.7.16.src/e107_themes/kubrick/theme.php
--- 0.7.15.src/e107_themes/kubrick/theme.php	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_themes/kubrick/theme.php	2009-06-11 14:21:12.000000000 -0500
@@ -10,8 +10,8 @@
 |	Released under the terms and conditions of the
 |	GNU General Public License (http://gnu.org).
 |
-|   $Revision: 1.22 $
-|   $Date: 2007/06/04 19:42:37 $
+|   $Revision: 1.24 $
+|   $Date: 2009/06/11 19:21:36 $
 |   $Author: e107steved $
 +---------------------------------------------------------------+
 */
@@ -20,8 +20,7 @@
 
 // [multilanguage]
 
-@include_once(e_THEME."kubrick/languages/".e_LANGUAGE.".php");
-@include_once(e_THEME."kubrick/languages/English.php");
+include_lan(e_THEME."kubrick/languages/".e_LANGUAGE.".php");
 
 // [theme]
 $themename = "kubrick";
@@ -38,8 +37,6 @@
 define("THEME_DISCLAIMER", "<br /><i>".LAN_THEME_1."</i>");
 
 if(!defined("e_THEME")){ exit; }
-$page=substr(strrchr($_SERVER['PHP_SELF'], "/"), 1);
-define("e_PAGE", $page);
 
 $register_sc[]= "UL";  // register shortcode ul.sc for inclusion.
 
@@ -94,7 +91,7 @@
 
 $NEWSSTYLE = "
 <h2>{NEWSTITLE}</h2>
-<small>on {NEWSDATE} | by {NEWSAUTHOR}</small>
+<small>".LAN_THEME_6." {NEWSDATE} | ".LAN_THEME_7." {NEWSAUTHOR}</small>
 <div class='entry' style='text-align:left'>
 {NEWSBODY}
 {EXTENDED}
diff -x .svn -aruN 0.7.15.src/e107_themes/lamb/alt_style.css 0.7.16.src/e107_themes/lamb/alt_style.css
--- 0.7.15.src/e107_themes/lamb/alt_style.css	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_themes/lamb/alt_style.css	2009-07-29 04:13:25.000000000 -0500
@@ -338,7 +338,7 @@
 	font: 12px verdana, tahoma, arial, helvetica, sans-serif;
 	color:#000;
 	padding: 4px;
-	background-image : url('../e107_images/forum/fcap2.png');
+/*	background-image : url('../e107_images/forum/fcap2.png'); */
 	border: 1px solid #ececf2;
 }
 
@@ -375,7 +375,8 @@
 	color:#000;
 	padding: 4px;
 	border: 1px solid #C3BDBD;
-	background-image : url('../e107_images/forum/finfobar.png');font-style:normal; font-variant:normal; font-weight:normal; font-size:11px; font-family:verdana, tahoma, arial, helvetica, sans-serif
+/*	background-image : url('../e107_images/forum/finfobar.png'); */
+	font-style:normal; font-variant:normal; font-weight:normal; font-size:11px; font-family:verdana, tahoma, arial, helvetica, sans-serif
 }
 
 .helpbox {
diff -x .svn -aruN 0.7.15.src/e107_themes/lamb/languages/English.php 0.7.16.src/e107_themes/lamb/languages/English.php
--- 0.7.15.src/e107_themes/lamb/languages/English.php	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_themes/lamb/languages/English.php	2009-01-20 14:32:26.000000000 -0600
@@ -11,8 +11,8 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_themes/lamb/languages/English.php,v $
-|     $Revision: 1.4 $
-|     $Date: 2007/03/03 19:59:49 $
+|     $Revision: 1.5 $
+|     $Date: 2009/01/20 20:32:50 $
 |     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
@@ -22,6 +22,7 @@
 define("LAN_THEME_3", "comment: ");
 define("LAN_THEME_4", "Read the rest ...");
 define("LAN_THEME_5", "Trackbacks: ");
+define("LAN_THEME_6", 'on');
 
 
 ?>
\ No newline at end of file
diff -x .svn -aruN 0.7.15.src/e107_themes/lamb/theme.php 0.7.16.src/e107_themes/lamb/theme.php
--- 0.7.15.src/e107_themes/lamb/theme.php	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_themes/lamb/theme.php	2009-07-18 10:53:18.000000000 -0500
@@ -9,14 +9,18 @@
 |
 |	Released under the terms and conditions of the
 |	GNU General Public License (http://gnu.org).
+|
+|     $Source: /cvsroot/e107/e107_0.7/e107_themes/lamb/theme.php,v $
+|     $Revision: 1.38 $
+|     $Date: 2009/07/18 15:53:42 $
+|     $Author: marj_nl_fr $
 +---------------------------------------------------------------+
 */
 
 if (!defined('e107_INIT')) { exit; }
 
 // [multilanguage]
-@include_once(e_THEME."lamb/languages/".e_LANGUAGE.".php");
-@include_once(e_THEME."lamb/languages/English.php");
+include_lan(e_THEME."lamb/languages/".e_LANGUAGE.".php");
 
 // [theme]
 $themename = "lamb";
@@ -96,7 +100,7 @@
 </div>
 <div style='text-align:right' class='smalltext'>
 {NEWSAUTHOR}
-on
+".LAN_THEME_6."
 {NEWSDATE}
 <br />
 <img src='".e_IMAGE_ABS."admin_images/userclass_16.png' alt='' style='vertical-align: middle;' />
diff -x .svn -aruN 0.7.15.src/e107_themes/leaf/style.css 0.7.16.src/e107_themes/leaf/style.css
--- 0.7.15.src/e107_themes/leaf/style.css	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_themes/leaf/style.css	2009-07-29 03:39:01.000000000 -0500
@@ -39,7 +39,7 @@
 body{
 	color: #4C4C4C;
 	font-size: 11px;
-	font-family: Trebuchet MS, "Lucida Sans Unicode", Arial, Lucida Sans, Tahoma, Sans-Serif;
+	font-family: "Trebuchet MS", "Lucida Sans Unicode", "Lucida Sans Unicode", Tahoma, sans-serif;
 	background: #123454 url(images/01_bg.gif) top repeat-x;
 	padding: 20px 0 20px 0;
 	text-align: center;
@@ -396,7 +396,6 @@
 /*Form's buttons*/
 .formbutton{
 	font-size: 11px;
-	font-family: Trebuchet MS, "Lucida Sans Unicode", Arial, Lucida Sans, Tahoma, Sans-Serif;
 	margin: 1px 0 0 0;
 	padding: 1px 10px;
 	color: #494949;
@@ -406,10 +405,6 @@
 	border-bottom: 1px solid #868686;
 	border-right: 1px solid #868686;
 }
-/* Don't show textarea scrollbar on IE */
-textarea{
-	overflow: hidden;
-}
 
 
 /* STYLING OF MENU TITLES */
@@ -500,7 +495,7 @@
 li{
 	padding: 0 0 0 9px;
 	margin: 0 0 2px 0;
-	background: url(images/01_arrow.gif) 0 6px no-repeat;
+	background: url(images/bullet2.gif) 0 6px no-repeat;
 }
 
 /*THE SEARCH HIGHLIGHT*/
@@ -686,7 +681,6 @@
 .tbox, .helpbox{
 	/* width: 80%; */
 	font-size: 11px;
-	font-family: Trebuchet MS, "Lucida Sans Unicode", Arial, Lucida Sans, Tahoma, Sans-Serif;
 	margin: 0 0 2px 0;
 	color: #494949;
 	border-top: 1px solid #868686;
@@ -696,7 +690,6 @@
 }
 .button{
 	font-size: 11px;
-	font-family: Trebuchet MS, "Lucida Sans Unicode", Arial, Lucida Sans, Tahoma, Sans-Serif;
 	margin: 1px 0 0 0;
 	padding: 1px 10px;
 	color: #494949;
diff -x .svn -aruN 0.7.15.src/e107_themes/leaf/theme.php 0.7.16.src/e107_themes/leaf/theme.php
--- 0.7.15.src/e107_themes/leaf/theme.php	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_themes/leaf/theme.php	2009-06-11 14:16:53.000000000 -0500
@@ -11,8 +11,8 @@
 |	GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_themes/leaf/theme.php,v $
-|     $Revision: 1.19 $
-|     $Date: 2007/05/28 16:52:49 $
+|     $Revision: 1.20 $
+|     $Date: 2009/06/11 19:17:17 $
 |     $Author: e107steved $
 +---------------------------------------------------------------+
 */
@@ -45,7 +45,6 @@
 define("THEME_DISCLAIMER", "<br /><i>".$themeinfo."</i>");
 
 // [page defines used for css controll on per page basis]
-define("e_PAGE", substr(strrchr($_SERVER['PHP_SELF'], "/"), 1));
 define("e_PAGECLASS", str_replace(substr(strrchr(e_PAGE, "."), 0), "", e_PAGE));
 
 // [navigation]
diff -x .svn -aruN 0.7.15.src/e107_themes/reline/admin_template.php 0.7.16.src/e107_themes/reline/admin_template.php
--- 0.7.15.src/e107_themes/reline/admin_template.php	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_themes/reline/admin_template.php	2009-08-03 14:40:20.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_themes/reline/admin_template.php,v $
-|     $Revision: 1.1 $
-|     $Date: 2006/04/29 06:00:37 $
-|     $Author: sweetas $
+|     $Revision: 1.2 $
+|     $Date: 2009/08/03 19:40:44 $
+|     $Author: marj_nl_fr $
 +----------------------------------------------------------------------------+
 */
 
@@ -52,7 +52,6 @@
 {ADMIN_ICON}
 <br />
 {ADMIN_SEL_LAN}
-{ADMIN_USERLAN}
 </td>
 </tr>
 </table>
diff -x .svn -aruN 0.7.15.src/e107_themes/reline/theme.php 0.7.16.src/e107_themes/reline/theme.php
--- 0.7.15.src/e107_themes/reline/theme.php	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_themes/reline/theme.php	2009-07-18 10:53:18.000000000 -0500
@@ -11,9 +11,9 @@
 |	GNU General Public License (http://gnu.org).
 |
 |	$Source: /cvsroot/e107/e107_0.7/e107_themes/reline/theme.php,v $
-|	$Revision: 1.20 $
-|	$Date: 2008/11/22 15:10:03 $
-|	$Author: e107steved $
+|	$Revision: 1.21 $
+|	$Date: 2009/07/18 15:53:42 $
+|	$Author: marj_nl_fr $
 |
 +----------------------------------------------------------------------------+
 |	Photo Credits
@@ -39,8 +39,7 @@
 
 
 // Get language definition files for this theme
-@include_once(e_THEME."reline/languages/".e_LANGUAGE.".php");
-@include_once(e_THEME."reline/languages/English.php");
+include_lan(e_THEME."reline/languages/".e_LANGUAGE.".php");
 
 
 // Set theme info
diff -x .svn -aruN 0.7.15.src/e107_themes/sebes/languages/English.php 0.7.16.src/e107_themes/sebes/languages/English.php
--- 0.7.15.src/e107_themes/sebes/languages/English.php	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_themes/sebes/languages/English.php	2009-02-21 05:23:18.000000000 -0600
@@ -11,16 +11,17 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_themes/sebes/languages/English.php,v $
-|     $Revision: 1.1 $
-|     $Date: 2005/03/21 12:11:00 $
-|     $Author: stevedunstan $
+|     $Revision: 1.2 $
+|     $Date: 2009/02/21 11:23:42 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 
-define("LAN_THEME_1", "'sebes' by <a href='http://e107.org' rel='external'>jalist</a>");
-define("LAN_THEME_2", "Read/Post Comment: ");
-define("LAN_THEME_3", "Comments are turned off for this item");
-define("LAN_THEME_4", "Read the rest ...");
-define("LAN_THEME_5", "Trackbacks: ");
+define('LAN_THEME_1', "'sebes' by <a href='http://e107.org' rel='external'>jalist</a>");
+define('LAN_THEME_2', 'Read/Post Comment: ');
+define('LAN_THEME_3', 'Comments are turned off for this item');
+define('LAN_THEME_4', 'Read the rest ...');
+define('LAN_THEME_5', 'Trackbacks: ');
+define('LAN_THEME_6', ' on ');
 
 ?>
diff -x .svn -aruN 0.7.15.src/e107_themes/sebes/theme.php 0.7.16.src/e107_themes/sebes/theme.php
--- 0.7.15.src/e107_themes/sebes/theme.php	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_themes/sebes/theme.php	2009-07-18 10:53:19.000000000 -0500
@@ -14,8 +14,7 @@
 if (!defined('e107_INIT')) { exit; }
 
 // [multilanguage]
-@include_once(e_THEME."sebes/languages/".e_LANGUAGE.".php");
-@include_once(e_THEME."sebes/languages/English.php");
+include_lan(e_THEME."sebes/languages/".e_LANGUAGE.".php");
 
 // [theme]
 $themename = "sebes";
@@ -95,7 +94,7 @@
 
 $NEWSSTYLE = "
 <div class='captiontext'><img src='".THEME_ABS."images/marrow.png' alt='' /> {NEWSTITLE}</div>
-<div class='smalltext'>{NEWSAUTHOR} on {NEWSDATE} | {NEWSCOMMENTS}{TRACKBACK}
+<div class='smalltext'>{NEWSAUTHOR}".LAN_THEME_6."{NEWSDATE} | {NEWSCOMMENTS}{TRACKBACK}
 </div>
 {NEWSBODY}
 {EXTENDED}
diff -x .svn -aruN 0.7.15.src/e107_themes/templates/admin_template.php 0.7.16.src/e107_themes/templates/admin_template.php
--- 0.7.15.src/e107_themes/templates/admin_template.php	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_themes/templates/admin_template.php	2009-08-03 14:40:20.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_themes/templates/admin_template.php,v $
-|     $Revision: 1.15 $
-|     $Date: 2006/12/19 14:20:09 $
-|     $Author: e107coders $
+|     $Revision: 1.16 $
+|     $Date: 2009/08/03 19:40:44 $
+|     $Author: marj_nl_fr $
 +----------------------------------------------------------------------------+
 */
 
@@ -24,7 +24,6 @@
 <br />
 {ADMIN_LOGGED}
 {ADMIN_SEL_LAN}
-{ADMIN_USERLAN}
 </div>
 <table style='width:100%' cellspacing='10' cellpadding='10'>
 <tr>
diff -x .svn -aruN 0.7.15.src/e107_themes/templates/contact_template.php 0.7.16.src/e107_themes/templates/contact_template.php
--- 0.7.15.src/e107_themes/templates/contact_template.php	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_themes/templates/contact_template.php	2009-07-27 23:09:52.000000000 -0500
@@ -1,15 +1,16 @@
 <?php
-// $Id: contact_template.php,v 1.9 2007/12/06 21:36:02 e107steved Exp $
+// $Id: contact_template.php,v 1.11 2009/07/28 04:10:16 marj_nl_fr Exp $
 
 if (!defined('e107_INIT')) { exit; }
 if (!defined("USER_WIDTH")){ define("USER_WIDTH","width:97%"); }
 
 if(!isset($CONTACT_INFO))
 {
-  $CONTACT_INFO = "
+	$CONTACT_INFO = "
 	<table style='".USER_WIDTH."' cellpadding='1' cellspacing='7'>
 	<tr>
-		<td>{SITECONTACTINFO}
+		<td>
+		{SITECONTACTINFO}
 		<br />
 		</td>
 	</tr>
diff -x .svn -aruN 0.7.15.src/e107_themes/templates/email_template.php 0.7.16.src/e107_themes/templates/email_template.php
--- 0.7.15.src/e107_themes/templates/email_template.php	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_themes/templates/email_template.php	2009-07-06 02:48:48.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_themes/templates/email_template.php,v $
-|     $Revision: 1.11 $
-|     $Date: 2008/07/17 19:24:51 $
-|     $Author: e107steved $
+|     $Revision: 1.12 $
+|     $Date: 2009/07/06 07:49:12 $
+|     $Author: marj_nl_fr $
 +----------------------------------------------------------------------------+
 */
 if (!defined('e107_INIT')) { exit; }
@@ -55,13 +55,13 @@
 ".LAN_EMAIL_01." {USERNAME},<br />
 <br />".
 LAN_403." {SITENAME}<br />
-".LAN_SIGNUP_21.":<br />
+".LAN_SIGNUP_21."<br />
 <br />
 {ACTIVATION_LINK}<br />
 <br />
 ".LAN_SIGNUP_59."<br />
 <br />
-".LAN_SIGNUP_18.":<br />
+".LAN_SIGNUP_18."<br />
 <br />
 ".LAN_LOGINNAME.": <b> {LOGINNAME} </b><br />
 ".LAN_PASSWORD.": <b> {PASSWORD} </b><br />
diff -x .svn -aruN 0.7.15.src/e107_themes/templates/footer_default.php 0.7.16.src/e107_themes/templates/footer_default.php
--- 0.7.15.src/e107_themes/templates/footer_default.php	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_themes/templates/footer_default.php	2009-07-11 22:27:57.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_themes/templates/footer_default.php,v $
-|     $Revision: 1.53 $
-|     $Date: 2007/08/13 19:56:35 $
-|     $Author: e107steved $
+|     $Revision: 1.54 $
+|     $Date: 2009/07/12 03:28:21 $
+|     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
 if (!defined('e107_INIT')) { exit; }
@@ -145,10 +145,10 @@
 	}
 }
 
-if((ADMIN == true || $pref['developer']) && $error_handler->debug == true) {
+if((ADMIN == true || $pref['developer']) && count($error_handler->errors) && $error_handler->debug == true) 
+{
 	echo "
-	<br /><br />
-	<div>
+	<div class='e107_debug php_err block-text'>
 		<h3>PHP Errors:</h3><br />
 		".$error_handler->return_errors()."
 	</div>
@@ -160,7 +160,7 @@
 //
 if (function_exists('theme_foot'))
 {
-	echo theme_foot();
+   	echo theme_foot();
 }
 
 //
diff -x .svn -aruN 0.7.15.src/e107_themes/templates/header_default.php 0.7.16.src/e107_themes/templates/header_default.php
--- 0.7.15.src/e107_themes/templates/header_default.php	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_themes/templates/header_default.php	2009-07-13 05:17:17.000000000 -0500
@@ -6,9 +6,9 @@
 |     Released under the terms and conditions of the GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_themes/templates/header_default.php,v $
-|     $Revision: 1.111 $
-|     $Date: 2008/08/26 21:24:15 $
-|     $Author: e107steved $
+|     $Revision: 1.112 $
+|     $Date: 2009/07/13 10:17:41 $
+|     $Author: marj_nl_fr $
 +-----------------------------------------------------------------------------------------------+
 */
 
@@ -83,10 +83,14 @@
 //
 // C: Send start of HTML
 //
-
 echo "<html xmlns='http://www.w3.org/1999/xhtml'".(defined("TEXTDIRECTION") ? " dir='".TEXTDIRECTION."'" : "").(defined("CORE_LC") ? " xml:lang=\"".CORE_LC."\"" : "").">
 <head>
-<title>".SITENAME.(defined("e_PAGETITLE") ? ": ".e_PAGETITLE : (defined("PAGE_NAME") ? ": ".PAGE_NAME : ""))."</title>\n";
+<meta http-equiv='content-type' content='text/html; charset=".CHARSET."' />
+<meta http-equiv='content-style-type' content='text/css' />
+";
+echo (defined("CORE_LC")) ? "<meta http-equiv='content-language' content='".CORE_LC."' />\n" : "";
+echo "<title>".SITENAME.(defined("e_PAGETITLE") ? ": ".e_PAGETITLE : (defined("PAGE_NAME") ? ": ".PAGE_NAME : ""))."</title>\n";
+
 
 //
 // D: Send JS
@@ -215,13 +219,6 @@
 //
 echo "<!-- *META* -->\n";
 
-// Multi-Language meta-tags with merge and override option.
-
-echo "<meta http-equiv='content-type' content='text/html; charset=".CHARSET."' />
-<meta http-equiv='content-style-type' content='text/css' />\n";
-
-echo (defined("CORE_LC")) ? "<meta http-equiv='content-language' content='".CORE_LC."' />\n" : "";
-
 // --- Load plugin Meta files and eplug_ before others --------
 if (is_array($pref['e_meta_list']))
 {
diff -x .svn -aruN 0.7.15.src/e107_themes/templates/user_template.php 0.7.16.src/e107_themes/templates/user_template.php
--- 0.7.15.src/e107_themes/templates/user_template.php	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_themes/templates/user_template.php	2009-07-27 23:19:46.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_themes/templates/user_template.php,v $
-|     $Revision: 1.17 $
-|     $Date: 2007/09/20 21:35:52 $
-|     $Author: e107steved $
+|     $Revision: 1.19 $
+|     $Date: 2009/07/28 04:20:10 $
+|     $Author: marj_nl_fr $
 +----------------------------------------------------------------------------+
 */
 
@@ -46,8 +46,8 @@
 	{USER_FORM_START}
 	<p>".LAN_419.": {USER_FORM_RECORDS} ".LAN_139." {USER_FORM_ORDER}
 	{USER_FORM_SUBMIT}
-	{USER_FORM_END}
 	</p>
+	{USER_FORM_END}
 	</div>
 	<br />
 	<br />
@@ -84,7 +84,7 @@
 $sc_style['USER_UPDATE_LINK']['pre'] = "<tr><td colspan='2' class='forumheader3' style='text-align:center'>";
 $sc_style['USER_UPDATE_LINK']['post'] = "</td></tr>";
 
-$sc_style['USER_RATING']['pre'] = "<tr><td colspan='2' style='width:100%' class='forumheader3'><span style='float:left'>".LAN_406."</span></span><span style='float:right;'>";
+$sc_style['USER_RATING']['pre'] = "<tr><td colspan='2' style='width:100%' class='forumheader3'><span style='float:left'>".LAN_406."</span><span style='float:right;'>";
 $sc_style['USER_RATING']['post'] = "</span></td></tr>";
 
 $sc_style['USER_LOGINNAME']['pre'] = " : ";
diff -x .svn -aruN 0.7.15.src/e107_themes/vekna_blue/style.css 0.7.16.src/e107_themes/vekna_blue/style.css
--- 0.7.15.src/e107_themes/vekna_blue/style.css	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_themes/vekna_blue/style.css	2009-08-29 18:10:05.000000000 -0500
@@ -1,10 +1,12 @@
 body {
-	background: url(images/bg.gif) #e5e5e5 fixed no-repeat left bottom; margin: 10px; text-align: left
-}
-body {
+	background: url(images/bg.gif) #e5e5e5 fixed no-repeat left bottom; margin: 10px; text-align: left;
 	font: 10px verdana, arial, sans-serif
 }
 
+img {
+	border: none;
+}
+
 #logo {
 	background-image: url(images/logo4.jpg);
 	border: 1px solid #999;
@@ -83,14 +85,11 @@
 	border-right: #5e5d63 1px solid; border-top: #5e5d63 1px solid; font-size: 10px; background-image: url(images/button.png); border-left: #5e5d63 1px solid; color: #000; border-bottom: #5e5d63 1px solid; text-align: center
 }
 .button:hover {
-	background-image: url(images/button_hover2.png); color: #fff
+	color: #fff
 }
 .nextprev {
 	border-right: #77a 1px solid; padding-right: 1px; border-top: #77a 1px solid; padding-left: 1px; font-size: 9px; background-image: url(images/button.png); padding-bottom: 1px; border-left: #77a 1px solid; color: #000; padding-top: 1px; border-bottom: #77a 1px solid; background-color: #fcfcfc; text-align: center
 }
-.nextprev:hover {
-	background-image: url(images/button_hover.png)
-}
 form {
 	margin: 2px 0px 0px
 }
@@ -105,7 +104,7 @@
 }
 
 .infobar {
-	border-right: #ccc 1px solid; padding-right: 4px; border-top: #fff 1px solid; padding-left: 4px; font-size: 10px; background-image: url(images/cap1.gif); padding-bottom: 4px; border-left: #fff 1px solid; color: #000; padding-top: 2px; border-bottom: #ccc 1px solid; background-color: #e2e2e2
+	border-right: #ccc 1px solid; padding-right: 4px; border-top: #fff 1px solid; padding-left: 4px; font-size: 10px; background-image: url(images/cap.gif); padding-bottom: 4px; border-left: #fff 1px solid; color: #000; padding-top: 2px; border-bottom: #ccc 1px solid; background-color: #e2e2e2
 }
 p {
 	margin-top: 0px
@@ -144,7 +143,9 @@
 	background: #cccccc; color: #fff
 }
 .finfobar {
-	border-right: #c3bdbd 1px solid; padding-right: 4px; border-top: #c3bdbd 1px solid; padding-left: 4px; background-image: url(forum/finfobar.png); padding-bottom: 4px; border-left: #c3bdbd 1px solid; color: #000; padding-top: 4px; border-bottom: #c3bdbd 1px solid; background-color: #ccc8c8
+	border-right: #c3bdbd 1px solid; padding-right: 4px; border-top: #c3bdbd 1px solid; padding-left: 4px;
+/*	background-image: url(forum/finfobar.png); */
+	padding-bottom: 4px; border-left: #c3bdbd 1px solid; color: #000; padding-top: 4px; border-bottom: #c3bdbd 1px solid; background-color: #ccc8c8
 }
 a.forumlink {
 	color: #333; text-decoration: none
diff -x .svn -aruN 0.7.15.src/e107_themes/vekna_blue/theme.php 0.7.16.src/e107_themes/vekna_blue/theme.php
--- 0.7.15.src/e107_themes/vekna_blue/theme.php	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/e107_themes/vekna_blue/theme.php	2009-08-21 13:35:42.000000000 -0500
@@ -15,8 +15,7 @@
 if (!defined('e107_INIT')) { exit; }
 
 // [multilanguage]
-@include_once(e_THEME."vekna_blue/languages/".e_LANGUAGE.".php");
-@include_once(e_THEME."vekna_blue/languages/English.php");
+include_lan(e_THEME."vekna_blue/languages/".e_LANGUAGE.".php");
 
 // [theme]
 $themename = "vekna blue";
@@ -33,7 +32,7 @@
 
 define("THEME_DISCLAIMER", "<br /><i>".LAN_THEME_1."</i>");
 
-function theme_head() 
+function theme_head()
 {
   return "<link rel='stylesheet' href='".THEME_ABS."nav_menu.css' type='text/css' />\n";
 }
@@ -51,7 +50,7 @@
 */
 
 $HEADER = "
-<table id='wrapptable' cellspacing='2' cellpadding='2' style='width: 800'> 
+<table id='wrapptable' cellspacing='2' cellpadding='2' style='width: 800'>
 <tr>
 <td colspan='2'>
 <div>{SITELINKS_ALT=no_icons}</div>
@@ -83,7 +82,7 @@
 ";
 
 $CUSTOMHEADER = "
-<table id='wrapptable' cellspacing='2' cellpadding='2' style='width: 800'> 
+<table id='wrapptable' cellspacing='2' cellpadding='2' style='width: 800'>
 <tr>
 <td colspan='2'>
 <div>{SITELINKS_ALT=no_icons}</div>
@@ -152,17 +151,17 @@
 	global $style;
 	if($style == "menu")
 	{
-		echo "<div class='spacer'><div class='caption'><div class='captionpadder'><h4>{$caption}</h4></div></div><div class='menubody'><div class='menupadder'>{$text}</div></div><div class='menubottom'></div></div>";	
+		echo "<div class='spacer'><div class='caption'><div class='captionpadder'><h4>{$caption}</h4></div></div><div class='menubody'><div class='menupadder'>{$text}</div></div><div class='menubottom'></div></div>";
 	}
 	else
 	{
 		if($caption)
 		{
-			echo "<div class='spacer'>\n<div class='borderx'><div class='line2'>{$caption}</div>\n<div class='incontent'>{$text}</div>\n</div>\n";
+			echo "<div class='spacer'>\n<div class='borderx'><div class='line2'>{$caption}</div>\n<div class='incontent'>{$text}</div>\n</div>\n</div>\n";
 		}
 		else
 		{
-			echo "<div class='spacer'>\n<div class='borderx'>\n<div class='incontent'>{$text}</div>\n</div>\n";
+			echo "<div class='spacer'>\n<div class='borderx'>\n<div class='incontent'>{$text}</div>\n</div>\n</div>\n";
 		}
 	}
 }
diff -x .svn -aruN 0.7.15.src/error.php 0.7.16.src/error.php
--- 0.7.15.src/error.php	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/error.php	2009-06-04 15:02:36.000000000 -0500
@@ -11,8 +11,8 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/error.php,v $
-|     $Revision: 1.16 $
-|     $Date: 2008/07/25 20:12:44 $
+|     $Revision: 1.17 $
+|     $Date: 2009/06/04 20:03:00 $
 |     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
@@ -73,9 +73,8 @@
 	}
 	else
 	{
-	  echo "<script type='text/javascript'>document.location.href='index.php'</script>\n";
-	  header("location: ".e_HTTP."index.php");
-	  exit;
+		header("location: ".e_HTTP."index.php");
+		exit;
 	}
 	break;
   default :
diff -x .svn -aruN 0.7.15.src/install.php 0.7.16.src/install.php
--- 0.7.15.src/install.php	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/install.php	1969-12-31 18:00:00.000000000 -0600
@@ -1,2026 +0,0 @@
-<?php
-/*
-+----------------------------------------------------------------------------+
-|     e107 website system
-|
-|     ©Steve Dunstan 2001-2002
-|     http://e107.org
-|     jalist@e107.org
-|
-|     Released under the terms and conditions of the
-|     GNU General Public License (http://gnu.org).
-|
-|     $Source: /cvsroot/e107/e107_0.7/install_.php,v $
-|     $Revision: 1.65 $
-|     $Date: 2008/07/09 21:38:14 $
-|     $Author: e107steved $
-+----------------------------------------------------------------------------+
-*/
-
-/* Default Options and Paths for Installer */
-$MySQLPrefix	     = 'e107_';
-
-$ADMIN_DIRECTORY     = "e107_admin/";
-$FILES_DIRECTORY     = "e107_files/";
-$IMAGES_DIRECTORY    = "e107_images/";
-$THEMES_DIRECTORY    = "e107_themes/";
-$PLUGINS_DIRECTORY   = "e107_plugins/";
-$HANDLERS_DIRECTORY  = "e107_handlers/";
-$LANGUAGES_DIRECTORY = "e107_languages/";
-$HELP_DIRECTORY      = "e107_docs/help/";
-$DOWNLOADS_DIRECTORY = "e107_files/downloads/";
-
-/* End configurable variables */
-
-if(isset($_GET['object'])) {
-	get_object($_GET['object']);
-	die();
-}
-
-define("e107_INIT", TRUE);
-define("e_UC_ADMIN", 254);
-
-error_reporting(E_ALL);
-
-function e107_ini_set($var, $value){
-	if (function_exists('ini_set')){
-		ini_set($var, $value);
-	}
-}
-
-// setup some php options
-e107_ini_set('magic_quotes_runtime',     0);
-e107_ini_set('magic_quotes_sybase',      0);
-e107_ini_set('arg_separator.output',     '&amp;');
-e107_ini_set('session.use_only_cookies', 1);
-e107_ini_set('session.use_trans_sid',    0);
-
-
-if(!function_exists("file_get_contents")) {
-	die("e107 requires PHP 4.3 or greater to work correctly.");
-}
-
-//  Ensure that '.' is the first part of the include path
-$inc_path = explode(PATH_SEPARATOR, ini_get('include_path'));
-if($inc_path[0] != ".") {
-	array_unshift($inc_path, ".");
-	$inc_path = implode(PATH_SEPARATOR, $inc_path);
-	e107_ini_set("include_path", $inc_path);
-}
-unset($inc_path);
-
-if(!function_exists("mysql_connect")) {
-	die("e107 requires PHP to be installed or compiled with the MySQL extension to work correctly, please see the MySQL manual for more information.");
-}
-
-# Check for the realpath(). Some hosts (I'm looking at you, Awardspace) are totally dumb and
-# they think that disabling realpath() will somehow (I'm assuming) help improve their pathetic
-# local security. Fact is, it just prevents apps from doing their proper local inclusion security
-# checks. So, we refuse to work with these people.
-$functions_ok = true;
-$disabled_functions = ini_get('disable_functions');
-if (trim($disabled_functions) != '') {
-	$disabled_functions = explode( ',', $disabled_functions );
-	foreach ($disabled_functions as $function) {
-		if(trim($function) == "realpath") {
-			$functions_ok = false;
-		}
-	}
-}
-if($functions_ok == true && function_exists("realpath") == false) {
-	$functions_ok = false;
-}
-if($functions_ok == false) {
-	die("e107 requires the realpath() function to be enabled and your host appears to have disabled it. This function is required for some <b>important</b> security checks and <b>There is NO workaround</b>. Please contact your host for more information.");
-}
-
-if(!function_exists("print_a")) {
-	function print_a($var) {
-		return '<pre>'.htmlentities(print_r($var, true), null, "UTF-8").'</pre>';
-	}
-}
-
-header("Content-type: text/html; charset=utf-8");
-
-$installer_folder_name = 'e107_install';
-
-include_once("./{$HANDLERS_DIRECTORY}e107_class.php");
-
-$e107_paths = compact('ADMIN_DIRECTORY', 'FILES_DIRECTORY', 'IMAGES_DIRECTORY', 'THEMES_DIRECTORY', 'PLUGINS_DIRECTORY', 'HANDLERS_DIRECTORY', 'LANGUAGES_DIRECTORY', 'HELP_DIRECTORY', 'DOWNLOADS_DIRECTORY');
-$e107 = new e107($e107_paths, realpath(dirname(__FILE__)));
-unset($e107_paths);
-
-$e107->e107_dirs['INSTALLER'] = "{$installer_folder_name}/";
-
-$e_install = new e_install();
-$e_forms = new e_forms();
-
-$e_install->template->SetTag("installer_css_http", $_SERVER['PHP_SELF']."?object=stylesheet");
-$e_install->template->SetTag("installer_folder_http", e_HTTP.$installer_folder_name."/");
-$e_install->template->SetTag("files_dir_http", e_FILE_ABS);
-
-if(!isset($_POST['stage'])) {
-	$_POST['stage'] = 1;
-}
-$_POST['stage'] = intval($_POST['stage']);
-
-switch ($_POST['stage']) {
-	case 1:
-		$e_install->stage_1();
-		break;
-	case 2:
-		$e_install->stage_2();
-		break;
-	case 3:
-		$e_install->stage_3();
-		break;
-	case 4:
-		$e_install->stage_4();
-		break;
-	case 5:
-		$e_install->stage_5();
-		break;
-	case 6:
-		$e_install->stage_6();
-		break;
-	case 7:
-		$e_install->stage_7();
-		break;
-	default:
-		$e_install->raise_error("Install stage information from client makes no sense to me.");
-}
-
-if($_SERVER['QUERY_STRING'] == "debug"){
-	$e_install->template->SetTag("debug_info", print_a($e_install));
-} else {
-	$e_install->template->SetTag("debug_info", (count($e_install->debug_info) ? print_a($e_install->debug_info)."Backtrace:<br />".print_a($e_install) : ""));
-}
-
-echo $e_install->template->ParseTemplate(template_data(), TEMPLATE_TYPE_DATA);
-
-
-
-class e_install {
-
-	var $required_php = "4.3";
-
-	var $paths;
-	var $template;
-	var $debug_info;
-	var $e107;
-	var $previous_steps;
-	var $stage;
-	var $post_data;
-
-	function e_install() {
-		$this->template = new SimpleTemplate();
-		while (@ob_end_clean());
-		global $e107;
-		$this->e107 = $e107;
-		if(isset($_POST['previous_steps'])) {
-			$this->previous_steps = unserialize(base64_decode($_POST['previous_steps']));
-			unset($_POST['previous_steps']);
-		} else {
-			$this->previous_steps = array();
-		}
-		$this->post_data = $_POST;
-	}
-
-	function raise_error($details){
-		$this->debug_info[] = array (
-		'info' => array (
-		'details' => $details,
-		'backtrace' => debug_backtrace()
-		)
-		);
-	}
-
-	function stage_1(){
-		global $e_forms;
-		$this->stage = 1;
-		$this->get_lan_file();
-		$this->template->SetTag("installation_heading", LANINS_001);
-		$this->template->SetTag("stage_pre", LANINS_002);
-		$this->template->SetTag("stage_num", LANINS_003);
-		$this->template->SetTag("stage_title", LANINS_004);
-		$e_forms->start_form("language_select", $_SERVER['PHP_SELF'].($_SERVER['QUERY_STRING'] == "debug" ? "?debug" : ""));
-		$e_forms->add_select_item("language", $this->get_languages(), "English");
-		$this->finish_form();
-		$e_forms->add_button("submit", LANINS_006);
-		$this->template->SetTag("stage_content", "<div style='text-align: center;'><label for='language'>".LANINS_005."</label>\n<br /><br /><br />\n".$e_forms->return_form()."</div>");
-	}
-
-	function stage_2(){
-		global $e_forms;
-		$this->stage = 2;
-		$this->previous_steps['language'] = $_POST['language'];
-		$this->get_lan_file();
-		$this->template->SetTag("installation_heading", LANINS_001);
-		$this->template->SetTag("stage_pre", LANINS_002);
-		$this->template->SetTag("stage_num", LANINS_021);
-		$this->template->SetTag("stage_title", LANINS_022);
-		$page_info = nl2br(LANINS_023);
-		$e_forms->start_form("versions", $_SERVER['PHP_SELF'].($_SERVER['QUERY_STRING'] == "debug" ? "?debug" : ""));
-		$output = "
-			<br /><br />
-			<div style='width: 100%; padding-left: auto; padding-right: auto;'>
-			  <table cellspacing='0'>
-			    <tr>
-			      <td style='border-top: 1px solid #999;' class='row-border'><label for='server'>".LANINS_024."</label></td>
-			      <td style='border-top: 1px solid #999;' class='row-border'><input class='tbox' type='text' id='server' name='server' size='40' value='localhost' maxlength='100' /></td>
-				  <td style='width: 40%; border-top: 1px solid #999;' class='row-border'>".LANINS_030."</td>
-			    </tr>
-			    <tr>
-			      <td class='row-border'><label for='name'>".LANINS_025."</label></td>
-			      <td class='row-border'><input class='tbox' type='text' name='name' id='name' size='40' value='' maxlength='100' /></td>
-				  <td class='row-border'>".LANINS_031."</td>
-			    </tr>
-			    <tr>
-			      <td class='row-border'><label for='password'>".LANINS_026."</label></td>
-			      <td class='row-border'><input class='tbox' type='password' name='password' size='40' id='password' value='' maxlength='100' /></td>
-				  <td class='row-border'>".LANINS_032."</td>
-			    </tr>
-			    <tr>
-			      <td class='row-border'><label for='db'>".LANINS_027."</label></td>
-			      <td class='row-border'><input type='text' name='db' size='20' id='db' value='' maxlength='100' />
-			      <label class='defaulttext'><input type='checkbox' name='createdb' value='1' />".LANINS_028."</label></td>
-				  <td class='row-border'>".LANINS_033."</td>
-			    </tr>
-			    <tr>
-			      <td class='row-border'><label for='prefix'>".LANINS_029."</label></td>
-			      <td class='row-border'><input type='text' name='prefix' size='20' id='prefix' value='e107_'  maxlength='100' /></td>
-				  <td class='row-border'>".LANINS_034."</td>
-			    </tr>
-			  </table>
-			</div>
-			<br /><br />\n";
-		$e_forms->add_plain_html($output);
-		$this->finish_form();
-		$e_forms->add_button("submit", LANINS_035);
-		$this->template->SetTag("stage_content", $page_info.$e_forms->return_form());
-	}
-
-
-	function stage_3()
-	{
-		global $e_forms;
-		$success = true;
-		$this->stage = 3;
-		$this->get_lan_file();
-		$this->template->SetTag("installation_heading", LANINS_001);
-		$this->template->SetTag("stage_pre", LANINS_002);
-		$this->template->SetTag("stage_num", LANINS_036);
-		$this->previous_steps['mysql']['server'] = trim($_POST['server']);
-		$this->previous_steps['mysql']['user'] = trim($_POST['name']);
-		$this->previous_steps['mysql']['password'] = $_POST['password'];
-		$this->previous_steps['mysql']['db'] = trim($_POST['db']);
-		$this->previous_steps['mysql']['createdb'] = (isset($_POST['createdb']) && $_POST['createdb'] == true ? true : false);
-		$this->previous_steps['mysql']['prefix'] = trim($_POST['prefix']);
-		$success = $this->check_name($this->previous_steps['mysql']['db'],FALSE) && $this->check_name($this->previous_steps['mysql']['prefix'],TRUE);
-		if(!$success || $this->previous_steps['mysql']['server'] == "" || $this->previous_steps['mysql']['user'] == "") 
-		{
-			$this->stage = 3;
-			$this->template->SetTag("stage_num", LANINS_021);
-			$e_forms->start_form("versions", $_SERVER['PHP_SELF'].($_SERVER['QUERY_STRING'] == "debug" ? "?debug" : ""));
-			$head = LANINS_039."<br /><br />\n";
-			$output = "
-			<br /><br />
-			<div style='width: 100%; padding-left: auto; padding-right: auto;'>
-			  <table cellspacing='0'>
-			    <tr>
-			      <td style='border-top: 1px solid #999;' class='row-border'><label for='server'>".LANINS_024."</label></td>
-			      <td style='border-top: 1px solid #999;' class='row-border'><input class='tbox' type='text' id='server' name='server' size='40' value='{$this->previous_steps['mysql']['server']}' maxlength='100' /></td>
-				  <td style='width: 40%; border-top: 1px solid #999;' class='row-border'>".LANINS_030."</td>
-			    </tr>
-			    <tr>
-			      <td class='row-border'><label for='name'>".LANINS_025."</label></td>
-			      <td class='row-border'><input class='tbox' type='text' name='name' id='name' size='40' value='{$this->previous_steps['mysql']['user']}' maxlength='100' /></td>
-				  <td class='row-border'>".LANINS_031."</td>
-			    </tr>
-			    <tr>
-			      <td class='row-border'><label for='password'>".LANINS_026."</label></td>
-			      <td class='row-border'><input class='tbox' type='password' name='password' id='password' size='40' value='{$this->previous_steps['mysql']['password']}' maxlength='100' /></td>
-				  <td class='row-border'>".LANINS_032."</td>
-			    </tr>
-			    <tr>
-			      <td class='row-border'><label for='db'>".LANINS_027."</label></td>
-			      <td class='row-border'><input type='text' name='db' id='db' size='20' value='{$this->previous_steps['mysql']['db']}' maxlength='100' />
-			        <label class='defaulttext'><input type='checkbox' name='createdb'".($this->previous_steps['mysql']['createdb'] == 1 ? " checked='checked'" : "")." value='1' />".LANINS_028."</label></td>
-				  <td class='row-border'>".LANINS_033."</td>
-			    </tr>
-			    <tr>
-			      <td class='row-border'><label for='prefix'>".LANINS_029."</label></td>
-			      <td class='row-border'><input type='text' name='prefix' id='prefix' size='20' value='{$this->previous_steps['mysql']['prefix']}'  maxlength='100' /></td>
-				  <td class='row-border'>".LANINS_034."</td>
-			    </tr>";
-			if (!$success)
-			{
-			  $output .= "<tr><td class='row-border' colspan='3'>".LANINS_105."</td></tr>";
-			}
-			$output .= "
-			  </table>
-			</div>
-			<br /><br />\n";
-			$e_forms->add_plain_html($output);
-			$e_forms->add_button("submit", LANINS_035);
-			$this->template->SetTag("stage_title", LANINS_040);
-		} 
-		else 
-		{
-		  $this->template->SetTag("stage_title", LANINS_037.($this->previous_steps['mysql']['createdb'] == 1 ? LANINS_038 : ""));
-		  if (!@mysql_connect($this->previous_steps['mysql']['server'], $this->previous_steps['mysql']['user'], $this->previous_steps['mysql']['password'])) 
-		  {
-			$success = false;
-			$page_content = LANINS_041.nl2br("\n\n<b>".LANINS_083."\n</b><i>".mysql_error()."</i>");
-		  } 
-		  else 
-		  {
-			$page_content = LANINS_042;
-			if($this->previous_steps['mysql']['createdb'] == 1) 
-			{
-			  if (!mysql_query("CREATE DATABASE ".$this->previous_steps['mysql']['db'])) 
-			  {
-				$success = false;
-				$page_content .= "<br /><br />".LANINS_043.nl2br("\n\n<b>".LANINS_083."\n</b><i>".mysql_error()."</i>");
-			  } 
-			  else 
-			  {
-				$page_content .= "<br /><br />".LANINS_044;
-			  }
-			}
-		  }
-		  if($success)
-		  {
-			$e_forms->start_form("versions", $_SERVER['PHP_SELF'].($_SERVER['QUERY_STRING'] == "debug" ? "?debug" : ""));
-			$page_content .= "<br /><br />".LANINS_045."<br /><br />";
-			$e_forms->add_button("submit", LANINS_035);
-		  }
-		  $head = $page_content;
-		}
-		if ($success) $this->finish_form(); else $this->finish_form(3);
-		$this->template->SetTag("stage_content", $head.$e_forms->return_form());
-	}
-
-	function stage_4()
-	{
-		global $e_forms;
-		$this->stage = 4;
-		$this->get_lan_file();
-		$this->template->SetTag("installation_heading", LANINS_001);
-		$this->template->SetTag("stage_pre", LANINS_002);
-		$this->template->SetTag("stage_num", LANINS_007);
-		$this->template->SetTag("stage_title", LANINS_008);
-		$not_writable = $this->check_writable_perms('must_write');		// Some directories MUST be writable
-		$opt_writable = $this->check_writable_perms('can_write');		// Some directories CAN optionally be writable
-		$version_fail = false;
-		$perms_errors = "";
-		if(count($not_writable)) 
-		{
-		  $perms_pass = false;
-		  foreach ($not_writable as $file) 
-		  {
-			$perms_errors .= (substr($file, -1) == "/" ? LANINS_010a : LANINS_010)."...<br /><b>{$file}</b><br />\n";
-		  }
-		  $perms_notes = LANINS_018;
-		} 
-		elseif (count($opt_writable))
-		{
-		  $perms_pass = true;
-		  foreach ($opt_writable as $file) 
-		  {
-			$perms_errors .= (substr($file, -1) == "/" ? LANINS_010a : LANINS_010)."...<br /><b>{$file}</b><br />\n";
-		  }
-		  $perms_notes = LANINS_106;
-		}
-		else
-		{
-		  $perms_pass = true;
-		  $perms_errors = "&nbsp;";
-		  $perms_notes = LANINS_017;
-		}
-
-		if(!function_exists("mysql_connect")) 
-		{
-			$version_fail = true;
-			$mysql_note = LANINS_011;
-			$mysql_help = LANINS_012;
-		} elseif (!@mysql_connect($this->previous_steps['mysql']['server'], $this->previous_steps['mysql']['user'], $this->previous_steps['mysql']['password'])) 
-		{
-			$mysql_note = LANINS_011;
-			$mysql_help = LANINS_013;
-		} 
-		else 
-		{
-			$mysql_note = mysql_get_server_info();
-			$mysql_help = LANINS_017;
-		}
-		if(!function_exists("utf8_encode")) 
-		{
-		  $xml_installed = false;
-		} 
-		else 
-		{
-		  $xml_installed = true;
-		}
-
-		$php_version = phpversion();
-		if(version_compare($php_version, $this->required_php, ">=")) {
-			$php_help = LANINS_017;
-		} else {
-			$php_help = LANINS_019;
-		}
-		$e_forms->start_form("versions", $_SERVER['PHP_SELF'].($_SERVER['QUERY_STRING'] == "debug" ? "?debug" : ""));
-		if(!$perms_pass) {
-			$e_forms->add_button("retest_perms", LANINS_009);
-			$this->stage = 3; // make the installer jump back a step
-		} elseif ($perms_pass && !$version_fail && $xml_installed) {
-			$e_forms->add_button("continue_install", LANINS_020);
-		}
-		$output = "
-			<table style='width: 100%; margin-left: auto; margin-right: auto;'>
-			  <tr>
-			    <td style='width: 20%;'>".LANINS_014."</td>
-			    <td style='width: 40%;'>{$perms_errors}</td>
-			    <td style='width: 40%;'>{$perms_notes}</td>
-			  </tr>
-			  <tr>
-			    <td>".LANINS_015."</td>
-			    <td>{$php_version}</td>
-			    <td>{$php_help}</td>
-			  </tr>
-			  <tr>
-			    <td>".LANINS_016."</td>
-			    <td>{$mysql_note}</td>
-			    <td>{$mysql_help}</td>
-			  </tr>
-			  <tr>
-			    <td>".LANINS_050."</td>
-			    <td>".($xml_installed ? LANINS_051 : LANINS_052)."</td>
-			    <td>".($xml_installed ? LANINS_017 : LANINS_053."<a href='http://php.net/manual/en/ref.xml.php' target='_blank'>php.net</a>".LANINS_054)."</td>
-			  </tr>
-			</table>\n<br /><br />\n\n";
-		$this->finish_form();
-		$this->template->SetTag("stage_content", $output.$e_forms->return_form());
-	}
-
-
-
-	function stage_5(){
-		global $e_forms;
-		$this->stage = 5;
-		$this->get_lan_file();
-		$this->template->SetTag("installation_heading", LANINS_001);
-		$this->template->SetTag("stage_pre", LANINS_002);
-		$this->template->SetTag("stage_num", LANINS_046);
-		$this->template->SetTag("stage_title", LANINS_047);
-		$e_forms->start_form("admin_info", $_SERVER['PHP_SELF'].($_SERVER['QUERY_STRING'] == "debug" ? "?debug" : ""));
-		$output = "
-			<div style='width: 100%; padding-left: auto; padding-right: auto;'>
-			  <table cellspacing='0'>
-			    <tr>
-			      <td class='row-border'><label for='u_name'>".LANINS_072."</label></td>
-			      <td class='row-border'><input class='tbox' type='text' name='u_name' id='u_name' size='30' value='".(isset($this->previous_steps['admin']['user']) ? $this->previous_steps['admin']['user'] : "")."' maxlength='60' /></td>
-				  <td class='row-border'>".LANINS_073."</td>
-			    </tr>
-			    <tr>
-			      <td class='row-border'><label for='d_name'>".LANINS_074."</label></td>
-			      <td class='row-border'><input class='tbox' type='text' name='d_name' id='d_name' size='30' value='".(isset($this->previous_steps['admin']['display']) ? $this->previous_steps['admin']['display'] : "")."' maxlength='60' /></td>
-				  <td class='row-border'>".LANINS_075."</td>
-			    </tr>
-			    <tr>
-			      <td class='row-border'><label for='pass1'>".LANINS_076."</label></td>
-			      <td class='row-border'><input type='password' name='pass1' size='30' id='pass1' value='' maxlength='60' /></td>
-				  <td class='row-border'>".LANINS_077."</td>
-			    </tr>
-			    <tr>
-			      <td class='row-border'><label for='pass2'>".LANINS_078."</label></td>
-			      <td class='row-border'><input type='password' name='pass2' size='30' id='pass2' value='' maxlength='60' /></td>
-				  <td class='row-border'>".LANINS_079."</td>
-			    </tr>
-			    <tr>
-			      <td class='row-border'><label for='email'>".LANINS_080."</label></td>
-			      <td class='row-border'><input type='text' name='email' size='30' id='email' value='".(isset($this->previous_steps['admin']['email']) ? $this->previous_steps['admin']['email'] : LANINS_082)."' maxlength='100' /></td>
-				  <td class='row-border'>".LANINS_081."</td>
-			    </tr>
-			  </table>
-			</div>
-			<br /><br />\n";
-		$e_forms->add_plain_html($output);
-		$this->finish_form();
-		$e_forms->add_button("submit", LANINS_035);
-		$this->template->SetTag("stage_content", $e_forms->return_form());
-	}
-
-	function stage_6(){
-		global $e_forms;
-		$this->get_lan_file();
-		$this->stage = 6;
-
-		$_POST['u_name'] = str_replace(array("'", '"'), "", $_POST['u_name']);
-		$_POST['d_name'] = str_replace(array("'", '"'), "", $_POST['d_name']);
-
-		$this->previous_steps['admin']['user'] = $_POST['u_name'];
-		if ($_POST['d_name'] == "") {
-			$this->previous_steps['admin']['display'] = $_POST['u_name'];
-		} else {
-			$this->previous_steps['admin']['display'] = $_POST['d_name'];
-		}
-		$this->previous_steps['admin']['email'] = $_POST['email'];
-		$this->previous_steps['admin']['password'] = $_POST['pass1'];
-
-		if(trim($_POST['u_name']) == "" || trim($_POST['email']) == "" || trim($_POST['pass1']) == "") {
-			$this->template->SetTag("installation_heading", LANINS_001);
-			$this->template->SetTag("stage_num", LANINS_046);
-			$this->template->SetTag("stage_pre", LANINS_002);
-			$this->template->SetTag("stage_title", LANINS_047);
-			$e_forms->start_form("admin_info", $_SERVER['PHP_SELF'].($_SERVER['QUERY_STRING'] == "debug" ? "?debug" : ""));
-			$page = LANINS_086."<br />".($_SERVER['QUERY_STRING'] == "debug" ? print_a($_POST, true) : "")."<br />";
-
-			$this->finish_form(5);
-			$e_forms->add_button("submit", LANINS_048);
-		} elseif($_POST['pass1'] != $_POST['pass2']) {
-			$this->template->SetTag("installation_heading", LANINS_001);
-			$this->template->SetTag("stage_num", LANINS_046);
-			$this->template->SetTag("stage_pre", LANINS_002);
-			$this->template->SetTag("stage_title", LANINS_047);
-			$e_forms->start_form("admin_info", $_SERVER['PHP_SELF'].($_SERVER['QUERY_STRING'] == "debug" ? "?debug" : ""));
-			$page = LANINS_049."<br />".($_SERVER['QUERY_STRING'] == "debug" ? print_a($_POST, true) : "")."<br />";
-
-			$this->finish_form(5);
-			$e_forms->add_button("submit", LANINS_048);
-		} else {
-
-			$this->template->SetTag("installation_heading", LANINS_001);
-			$this->template->SetTag("stage_pre", LANINS_002);
-			$this->template->SetTag("stage_num", LANINS_056);
-			$this->template->SetTag("stage_title", LANINS_055);
-
-			$e_forms->start_form("confirmation", $_SERVER['PHP_SELF'].($_SERVER['QUERY_STRING'] == "debug" ? "?debug" : ""));
-			$page = nl2br(LANINS_057);
-			$this->finish_form();
-			$e_forms->add_button("submit", LANINS_035);
-		}
-
-		$this->template->SetTag("stage_content", $page.$e_forms->return_form());
-	}
-
-	function stage_7(){
-		global $e_forms;
-		$this->get_lan_file();
-
-		$this->stage = 7;
-
-		$this->template->SetTag("installation_heading", LANINS_001);
-		$this->template->SetTag("stage_pre", LANINS_002);
-		$this->template->SetTag("stage_num", LANINS_058);
-		$this->template->SetTag("stage_title", LANINS_071);
-
-		$config_file = "<?php
-
-/*
-+----------------------------------------------------+
-|   e107 website system
-|   e107_config.php
-|
-|   ©Steve Dunstan 2001-2002
-|   http://e107.org
-|   jalist@e107.org
-|
-|   Released under the terms and conditions of the
-|   GNU General Public License (http://gnu.org).
-+----------------------------------------------------+
-This file has been generated by the installation script.
-*/
-
-\$mySQLserver    = '{$this->previous_steps['mysql']['server']}';
-\$mySQLuser      = '{$this->previous_steps['mysql']['user']}';
-\$mySQLpassword  = '{$this->previous_steps['mysql']['password']}';
-\$mySQLdefaultdb = '{$this->previous_steps['mysql']['db']}';
-\$mySQLprefix    = '{$this->previous_steps['mysql']['prefix']}';
-
-\$ADMIN_DIRECTORY     = \"{$this->e107->e107_dirs['ADMIN_DIRECTORY']}\";
-\$FILES_DIRECTORY     = \"{$this->e107->e107_dirs['FILES_DIRECTORY']}\";
-\$IMAGES_DIRECTORY    = \"{$this->e107->e107_dirs['IMAGES_DIRECTORY']}\";
-\$THEMES_DIRECTORY    = \"{$this->e107->e107_dirs['THEMES_DIRECTORY']}\";
-\$PLUGINS_DIRECTORY   = \"{$this->e107->e107_dirs['PLUGINS_DIRECTORY']}\";
-\$HANDLERS_DIRECTORY  = \"{$this->e107->e107_dirs['HANDLERS_DIRECTORY']}\";
-\$LANGUAGES_DIRECTORY = \"{$this->e107->e107_dirs['LANGUAGES_DIRECTORY']}\";
-\$HELP_DIRECTORY      = \"{$this->e107->e107_dirs['HELP_DIRECTORY']}\";
-\$DOWNLOADS_DIRECTORY = \"{$this->e107->e107_dirs['DOWNLOADS_DIRECTORY']}\";
-
-?>";
-
-		$config_result = $this->write_config($config_file);
-		$e_forms->start_form("confirmation", "index.php");
-		if ($config_result) {
-			$page = $config_result."<br />";
-		} else {
-			$errors = $this->create_tables();
-			if ($errors == true) {
-				$page = $errors."<br />";
-			} else {
-				$page = nl2br(LANINS_069)."<br />";
-				$e_forms->add_button("submit", LANINS_035);
-			}
-		}
-		$this->finish_form();
-		$this->template->SetTag("stage_content", $page.$e_forms->return_form());
-	}
-
-
-	// Check a DB name or table prefix - anything starting with a numeric followed by 'e' causes problems.
-	// Return TRUE if acceptable, FALSE if unacceptable
-	// Empty string returns the value of $blank_ok (caller should set TRUE for prefix, FALSE for DB name)
-	function check_name($str,$blank_ok = FALSE)
-	{
-	  if ($str == '') return $blank_ok;
-	  if (preg_match("#^\d+[e|E]#",$str)) return FALSE;
-	  return TRUE;
-	}
-
-
-	function get_lan_file(){
-		if(!isset($this->previous_steps['language'])) {
-			$this->previous_steps['language'] = "English";
-		}
-		$this->lan_file = "{$this->e107->e107_dirs['LANGUAGES_DIRECTORY']}{$this->previous_steps['language']}/lan_installer.php";
-		if(is_readable($this->lan_file)){
-			include($this->lan_file);
-		} elseif(is_readable("{$this->e107->e107_dirs['LANGUAGES_DIRECTORY']}English/lan_installer.php")) {
-			include("{$this->e107->e107_dirs['LANGUAGES_DIRECTORY']}English/lan_installer.php");
-		} else {
-			$this->raise_error("Fatal: Could not get valid language file for installation.");
-		}
-	}
-
-	function get_languages() {
-		$handle = opendir("{$this->e107->e107_dirs['LANGUAGES_DIRECTORY']}");
-		while ($file = readdir($handle)) {
-			if ($file != "." && $file != ".." && $file != "/" && $file != "CVS") {
-				if(file_exists("./{$this->e107->e107_dirs['LANGUAGES_DIRECTORY']}{$file}/lan_installer.php")){
-					$lanlist[] = $file;
-				}
-			}
-		}
-		closedir($handle);
-		return $lanlist;
-	}
-
-	function finish_form($force_stage = false) {
-		global $e_forms;
-		if($this->previous_steps) {
-			$e_forms->add_hidden_data("previous_steps", base64_encode(serialize($this->previous_steps)));
-		}
-		$e_forms->add_hidden_data("stage", ($force_stage ? $force_stage : ($this->stage + 1)));
-	}
-
-	function check_writable_perms($list = 'must_write')
-	{
-		$bad_files = array();
-		$data['must_write'] = 'e107_config.php';
-		$data['can_write'] = '{$FILES_DIRECTORY}cache/|{$FILES_DIRECTORY}public/|{$FILES_DIRECTORY}public/avatars/|{$PLUGINS_DIRECTORY}|{$THEMES_DIRECTORY}';
-		if (!isset($data[$list])) return $bad_files;
-		foreach ($this->e107->e107_dirs as $dir_name => $value) 
-		{
-		  $find[] = "{\${$dir_name}}";
-		  $replace[] = "./$value";
-		}
-		$data[$list] = str_replace($find, $replace, $data[$list]);
-		$files = explode("|", trim($data[$list]));
-		foreach ($files as $file) 
-		{
-		  if(!is_writable($file)) 
-		  {
-			$bad_files[] = str_replace("./", "", $file);
-		  }
-		}
-		return $bad_files;
-	}
-
-	function create_tables() {
-
-		$link = mysql_connect($this->previous_steps['mysql']['server'], $this->previous_steps['mysql']['user'], $this->previous_steps['mysql']['password']);
-		if(!$link) {
-			return nl2br(LANINS_084."\n\n<b>".LANINS_083."\n</b><i>".mysql_error($link)."</i>");
-		}
-
-		$db_selected = mysql_select_db($this->previous_steps['mysql']['db'], $link);
-		if(!$db_selected) {
-			return nl2br(LANINS_085." '{$this->previous_steps['mysql']['db']}'\n\n<b>".LANINS_083."\n</b><i>".mysql_error($link)."</i>");
-		}
-
-		$filename = "{$this->e107->e107_dirs['ADMIN_DIRECTORY']}sql/core_sql.php";
-		$fd = fopen ($filename, "r");
-		$sql_data = fread($fd, filesize($filename));
-		fclose ($fd);
-
-		if (!$sql_data) {
-			return nl2br(LANINS_060)."<br /><br />";
-		}
-
-		preg_match_all("/create(.*?)myisam;/si", $sql_data, $result );
-
-		foreach ($result[0] as $sql_table) {
-			preg_match("/CREATE TABLE\s(.*?)\s\(/si", $sql_table, $match);
-			$tablename = $match[1];
-			preg_match_all("/create(.*?)myisam;/si", $sql_data, $result );
-			$sql_table = preg_replace("/create table\s/si", "CREATE TABLE {$this->previous_steps['mysql']['prefix']}", $sql_table);
-			if (!mysql_query($sql_table, $link)) {
-				return nl2br(LANINS_061."\n\n<b>".LANINS_083."\n</b><i>".mysql_error($link)."</i>");
-			}
-		}
-
-		$datestamp = time();
-
-		mysql_query("INSERT INTO {$this->previous_steps['mysql']['prefix']}news VALUES (0, '".LANINS_063."', '".LANINS_062."', '', '{$datestamp}', '0', '1', 1, 0, 0, 0, 0, '0', '', 'welcome.png', 0) ");
-		mysql_query("INSERT INTO {$this->previous_steps['mysql']['prefix']}news_category VALUES (0, '".LANINS_087."', 'icon26.png') ");
-		mysql_query("INSERT INTO {$this->previous_steps['mysql']['prefix']}links VALUES (0, '".LANINS_088."', 'index.php', '', '', 1, 1, 0, 0, 0) ");
-		mysql_query("INSERT INTO {$this->previous_steps['mysql']['prefix']}links VALUES (0, '".LANINS_089."', 'download.php', '', '', 1, 2, 0, 0, 0) ");
-		mysql_query("INSERT INTO {$this->previous_steps['mysql']['prefix']}links VALUES (0, '".LANINS_090."', 'user.php', '', '', 1, 3, 0, 0, 0) ");
-		mysql_query("INSERT INTO {$this->previous_steps['mysql']['prefix']}links VALUES (0, '".LANINS_091."', 'submitnews.php', '', '', 1, 4, 0, 0, 0) ");
-		mysql_query("INSERT INTO {$this->previous_steps['mysql']['prefix']}links VALUES (0, '".LANINS_092."', 'contact.php', '', '', 1, 5, 0, 0, 0) ");
-
-		$udirs = "admin/|plugins/|temp";
-		$e_SELF = $_SERVER['PHP_SELF'];
-		$e_HTTP = preg_replace("#".$udirs."#i", "", substr($e_SELF, 0, strrpos($e_SELF, "/"))."/");
-
-		$pref_language = isset($this->previous_steps['language']) ? $this->previous_steps['language'] : "English";
-
-		if (file_exists($this->e107->e107_dirs['LANGUAGES_DIRECTORY'].$pref_language."/lan_prefs.php")) {
-			include_once($this->e107->e107_dirs['LANGUAGES_DIRECTORY'].$pref_language."/lan_prefs.php");
-		} else {
-			include_once($this->e107->e107_dirs['LANGUAGES_DIRECTORY']."English/lan_prefs.php");
-		}
-
-		$site_admin_user = $this->previous_steps['admin']['display'];
-		$site_admin_email = $this->previous_steps['admin']['email'];
-
-		require_once("{$this->e107->e107_dirs['FILES_DIRECTORY']}def_e107_prefs.php");
-
-		include_once("{$this->e107->e107_dirs['HANDLERS_DIRECTORY']}arraystorage_class.php");
-
-		$tmp = ArrayData::WriteArray($pref);
-
-		mysql_query("INSERT INTO {$this->previous_steps['mysql']['prefix']}core VALUES ('SitePrefs', '{$tmp}')");
-		mysql_query("INSERT INTO {$this->previous_steps['mysql']['prefix']}core VALUES ('SitePrefs_Backup', '{$tmp}')");
-
-		$emote = 'a:60:{i:0;a:1:{s:2:"&|";s:7:"cry.png";}i:1;a:1:{s:3:"&-|";s:7:"cry.png";}i:2;a:1:{s:3:"&o|";s:7:"cry.png";}i:3;a:1:{s:3:":((";s:7:"cry.png";}i:4;a:1:{s:3:"~:(";s:7:"mad.png";}i:5;a:1:{s:4:"~:o(";s:7:"mad.png";}i:6;a:1:{s:4:"~:-(";s:7:"mad.png";}i:7;a:1:{s:2:":)";s:9:"smile.png";}i:8;a:1:{s:3:":o)";s:9:"smile.png";}i:9;a:1:{s:3:":-)";s:9:"smile.png";}i:10;a:1:{s:2:":(";s:9:"frown.png";}i:11;a:1:{s:3:":o(";s:9:"frown.png";}i:12;a:1:{s:3:":-(";s:9:"frown.png";}i:13;a:1:{s:2:":D";s:8:"grin.png";}i:14;a:1:{s:3:":oD";s:8:"grin.png";}i:15;a:1:{s:3:":-D";s:8:"grin.png";}i:16;a:1:{s:2:":?";s:12:"confused.png";}i:17;a:1:{s:3:":o?";s:12:"confused.png";}i:18;a:1:{s:3:":-?";s:12:"confused.png";}i:19;a:1:{s:3:"%-6";s:11:"special.png";}i:20;a:1:{s:2:"x)";s:8:"dead.png";}i:21;a:1:{s:3:"xo)";s:8:"dead.png";}i:22;a:1:{s:3:"x-)";s:8:"dead.png";}i:23;a:1:{s:2:"x(";s:8:"dead.png";}i:24;a:1:{s:3:"xo(";s:8:"dead.png";}i:25;a:1:{s:3:"x-(";s:8:"dead.png";}i:26;a:1:{s:2:":@";s:7:"gah.png";}i:27;a:1:{s:3:":o@";s:7:"gah.png";}i:28;a:1:{s:3:":-@";s:7:"gah.png";}i:29;a:1:{s:2:":!";s:8:"idea.png";}i:30;a:1:{s:3:":o!";s:8:"idea.png";}i:31;a:1:{s:3:":-!";s:8:"idea.png";}i:32;a:1:{s:2:":|";s:11:"neutral.png";}i:33;a:1:{s:3:":o|";s:11:"neutral.png";}i:34;a:1:{s:3:":-|";s:11:"neutral.png";}i:35;a:1:{s:2:"?!";s:12:"question.png";}i:36;a:1:{s:2:"B)";s:12:"rolleyes.png";}i:37;a:1:{s:3:"Bo)";s:12:"rolleyes.png";}i:38;a:1:{s:3:"B-)";s:12:"rolleyes.png";}i:39;a:1:{s:2:"8)";s:10:"shades.png";}i:40;a:1:{s:3:"8o)";s:10:"shades.png";}i:41;a:1:{s:3:"8-)";s:10:"shades.png";}i:42;a:1:{s:2:":O";s:12:"suprised.png";}i:43;a:1:{s:3:":oO";s:12:"suprised.png";}i:44;a:1:{s:3:":-O";s:12:"suprised.png";}i:45;a:1:{s:2:":p";s:10:"tongue.png";}i:46;a:1:{s:3:":op";s:10:"tongue.png";}i:47;a:1:{s:3:":-p";s:10:"tongue.png";}i:48;a:1:{s:2:":P";s:10:"tongue.png";}i:49;a:1:{s:3:":oP";s:10:"tongue.png";}i:50;a:1:{s:3:":-P";s:10:"tongue.png";}i:51;a:1:{s:2:";)";s:8:"wink.png";}i:52;a:1:{s:3:";o)";s:8:"wink.png";}i:53;a:1:{s:3:";-)";s:8:"wink.png";}i:54;a:1:{s:4:"!ill";s:7:"ill.png";}i:55;a:1:{s:7:"!amazed";s:10:"amazed.png";}i:56;a:1:{s:4:"!cry";s:7:"cry.png";}i:57;a:1:{s:6:"!dodge";s:9:"dodge.png";}i:58;a:1:{s:6:"!alien";s:9:"alien.png";}i:59;a:1:{s:6:"!heart";s:9:"heart.png";}}';
-		mysql_query("INSERT INTO {$this->previous_steps['mysql']['prefix']}core VALUES ('emote', '{$emote}') ");
-
-		// Set up the menu prefs so they can be 'lanned'
-		$new_block = Array ( 
-				'comment_caption' 		=> LANINS_096,		// 'Latest Comments'
-				'comment_display' 		=> '10',
-				'comment_characters' 	=> '50',
-				'comment_postfix' 		=> LANINS_097,		// '[more ...]'
-				'comment_title' 		=> 0,
-				'article_caption' 		=> LANINS_098,		// 'Articles'
-				'articles_display' 		=> '10',
-				'articles_mainlink' 	=> LANINS_099,		// 'Articles Front Page ...'
-				'newforumposts_caption' => LANINS_100,		// 'Latest Forum Posts'
-				'newforumposts_display' => '10',
-				'forum_no_characters' 	=> '20',
-				'forum_postfix' 		=> LANINS_097,		// '[more ...]'
-				'update_menu' 			=> LANINS_101,		// 'Update menu Settings'
-				'forum_show_topics' 	=> '1',
-				'newforumposts_characters' => '50',
-				'newforumposts_postfix' => LANINS_097,		// '[more ...]'
-				'newforumposts_title' 	=> 0,
-				'clock_caption' 		=> LANINS_102,		// 'Date / Time'
-				'reviews_caption'		=> LANINS_103,		// 'Reviews'
-				'reviews_display'		=> '10',
-				'reviews_parents'		=> '1',
-				'reviews_mainlink'		=> LANINS_104,		// 'Review Front Page ...'
-				'articles_parents' 		=> '1' 
-				);
-
-		$menu_conf = serialize($new_block);
-//		$menu_conf = 'a:23:{s:15:"comment_caption";s:15:"Latest Comments";s:15:"comment_display";s:2:"10";s:18:"comment_characters";s:2:"50";s:15:"comment_postfix";s:12:"[ more ... ]";s:13:"comment_title";i:0;s:15:"article_caption";s:8:"Articles";s:16:"articles_display";s:2:"10";s:17:"articles_mainlink";s:23:"Articles Front Page ...";s:21:"newforumposts_caption";s:18:"Latest Forum Posts";s:21:"newforumposts_display";s:2:"10";s:19:"forum_no_characters";s:2:"20";s:13:"forum_postfix";s:10:"[more ...]";s:11:"update_menu";s:20:"Update menu Settings";s:17:"forum_show_topics";s:1:"1";s:24:"newforumposts_characters";s:2:"50";s:21:"newforumposts_postfix";s:10:"[more ...]";s:19:"newforumposts_title";i:0;s:13:"clock_caption";s:11:"Date / Time";s:15:"reviews_caption";s:7:"Reviews";s:15:"reviews_display";s:2:"10";s:15:"reviews_parents";s:1:"1";s:16:"reviews_mainlink";s:21:"Review Front Page ...";s:16:"articles_parents";s:1:"1";}';
-		mysql_query("INSERT INTO {$this->previous_steps['mysql']['prefix']}core VALUES ('menu_pref', '{$menu_conf}') ");
-
-		preg_match("/^(.*?)($|-)/", mysql_get_server_info(), $mysql_version);
-		if (version_compare($mysql_version[1], '4.0.1', '<')) {
-			$search_prefs = 'a:12:{s:11:\"user_select\";s:1:\"1\";s:9:\"time_secs\";s:2:\"60\";s:13:\"time_restrict\";s:1:\"0\";s:8:\"selector\";s:1:\"2\";s:9:\"relevance\";s:1:\"0\";s:13:\"plug_handlers\";N;s:10:\"mysql_sort\";b:0;s:11:\"multisearch\";s:1:\"1\";s:6:\"google\";s:1:\"0\";s:13:\"core_handlers\";a:5:{s:4:\"news\";a:6:{s:5:\"class\";s:1:\"0\";s:9:\"pre_title\";s:1:\"0\";s:13:\"pre_title_alt\";s:0:\"\";s:5:\"chars\";s:3:\"150\";s:7:\"results\";s:2:\"10\";s:5:\"order\";s:1:\"1\";}s:8:\"comments\";a:6:{s:5:\"class\";s:1:\"0\";s:9:\"pre_title\";s:1:\"1\";s:13:\"pre_title_alt\";s:0:\"\";s:5:\"chars\";s:3:\"150\";s:7:\"results\";s:2:\"10\";s:5:\"order\";s:1:\"2\";}s:5:\"users\";a:6:{s:5:\"class\";s:1:\"0\";s:9:\"pre_title\";s:1:\"1\";s:13:\"pre_title_alt\";s:0:\"\";s:5:\"chars\";s:3:\"150\";s:7:\"results\";s:2:\"10\";s:5:\"order\";s:1:\"3\";}s:9:\"downloads\";a:6:{s:5:\"class\";s:1:\"0\";s:9:\"pre_title\";s:1:\"1\";s:13:\"pre_title_alt\";s:0:\"\";s:5:\"chars\";s:3:\"150\";s:7:\"results\";s:2:\"10\";s:5:\"order\";s:1:\"4\";}s:5:\"pages\";a:6:{s:5:\"class\";s:1:\"0\";s:5:\"chars\";s:3:\"150\";s:7:\"results\";s:2:\"10\";s:9:\"pre_title\";s:1:\"0\";s:13:\"pre_title_alt\";s:0:\"\";s:5:\"order\";s:1:\"5\";}}s:17:\"comments_handlers\";a:2:{s:4:\"news\";a:3:{s:2:\"id\";i:0;s:3:\"dir\";s:4:\"core\";s:5:\"class\";s:1:\"0\";}s:8:\"download\";a:3:{s:2:\"id\";i:2;s:3:\"dir\";s:4:\"core\";s:5:\"class\";s:1:\"0\";}}s:9:\"php_limit\";s:0:\"\";}';
-		} else {
-			$search_prefs = 'a:12:{s:11:\"user_select\";s:1:\"1\";s:9:\"time_secs\";s:2:\"60\";s:13:\"time_restrict\";s:1:\"0\";s:8:\"selector\";s:1:\"2\";s:9:\"relevance\";s:1:\"0\";s:13:\"plug_handlers\";N;s:10:\"mysql_sort\";b:1;s:11:\"multisearch\";s:1:\"1\";s:6:\"google\";s:1:\"0\";s:13:\"core_handlers\";a:5:{s:4:\"news\";a:6:{s:5:\"class\";s:1:\"0\";s:9:\"pre_title\";s:1:\"0\";s:13:\"pre_title_alt\";s:0:\"\";s:5:\"chars\";s:3:\"150\";s:7:\"results\";s:2:\"10\";s:5:\"order\";s:1:\"1\";}s:8:\"comments\";a:6:{s:5:\"class\";s:1:\"0\";s:9:\"pre_title\";s:1:\"1\";s:13:\"pre_title_alt\";s:0:\"\";s:5:\"chars\";s:3:\"150\";s:7:\"results\";s:2:\"10\";s:5:\"order\";s:1:\"2\";}s:5:\"users\";a:6:{s:5:\"class\";s:1:\"0\";s:9:\"pre_title\";s:1:\"1\";s:13:\"pre_title_alt\";s:0:\"\";s:5:\"chars\";s:3:\"150\";s:7:\"results\";s:2:\"10\";s:5:\"order\";s:1:\"3\";}s:9:\"downloads\";a:6:{s:5:\"class\";s:1:\"0\";s:9:\"pre_title\";s:1:\"1\";s:13:\"pre_title_alt\";s:0:\"\";s:5:\"chars\";s:3:\"150\";s:7:\"results\";s:2:\"10\";s:5:\"order\";s:1:\"4\";}s:5:\"pages\";a:6:{s:5:\"class\";s:1:\"0\";s:5:\"chars\";s:3:\"150\";s:7:\"results\";s:2:\"10\";s:9:\"pre_title\";s:1:\"0\";s:13:\"pre_title_alt\";s:0:\"\";s:5:\"order\";s:1:\"5\";}}s:17:\"comments_handlers\";a:2:{s:4:\"news\";a:3:{s:2:\"id\";i:0;s:3:\"dir\";s:4:\"core\";s:5:\"class\";s:1:\"0\";}s:8:\"download\";a:3:{s:2:\"id\";i:2;s:3:\"dir\";s:4:\"core\";s:5:\"class\";s:1:\"0\";}}s:9:\"php_limit\";s:0:\"\";}';
-		}
-		mysql_query("INSERT INTO {$this->previous_steps['mysql']['prefix']}core VALUES ('search_prefs', '{$search_prefs}') ");
-
-		$notify_prefs = mysql_real_escape_string("array ('event' => array ('usersup' => array ('type' => 'off', 'class' => '254', 'email' => '',),'userveri' => array ( 'type' => 'off', 'class' => '254', 'email' => '', ), 'login' => array ( 'type' => 'off', 'class' => '254', 'email' => '', ), 'logout' => array ( 'type' => 'off', 'class' => '254', 'email' => '', ), 'flood' => array ( 'type' => 'off', 'class' => '254', 'email' => '', ), 'subnews' => array ( 'type' => 'off', 'class' => '254', 'email' => '', ), 'newspost' => array ( 'type' => 'off', 'class' => '254', 'email' => '', ), 'newsupd' => array ( 'type' => 'off', 'class' => '254', 'email' => '', ), 'newsdel' => array ( 'type' => 'off', 'class' => '254', 'email' => '', ), ), )");
-		mysql_query("INSERT INTO {$this->previous_steps['mysql']['prefix']}core VALUES ('notify_prefs', '{$notify_prefs}') ");
-
-		mysql_query("INSERT INTO {$this->previous_steps['mysql']['prefix']}banner VALUES (0, 'e107', 'e107login', 'e107password', 'banner1.png', 'http://e107.org', 0, 0, 0, 0, 0, 0, '', 'campaign_one') ");
-		mysql_query("INSERT INTO {$this->previous_steps['mysql']['prefix']}banner VALUES (0, 'e107', 'e107login', 'e107password', 'banner2.png', 'http://e107.org', 0, 0, 0, 0, 0, 0, '', 'campaign_one') ");
-		mysql_query("INSERT INTO {$this->previous_steps['mysql']['prefix']}banner VALUES (0, 'e107', 'e107login', 'e107password', 'banner3.png', 'http://e107.org', 0, 0, 0, 0, 0, 0, '', 'campaign_one') ");
-
-		mysql_query("INSERT INTO `{$this->previous_steps['mysql']['prefix']}menus` VALUES (1, 'login_menu', 1, 1, '0', '', 'login_menu/')");
-		mysql_query("INSERT INTO `{$this->previous_steps['mysql']['prefix']}menus` VALUES (3, 'online_menu', 0, 0, '0', '', 'online_menu/')");
-		mysql_query("INSERT INTO `{$this->previous_steps['mysql']['prefix']}menus` VALUES (4, 'blogcalendar_menu', 0, 0, '0', '', 'blogcalendar_menu/')");
-		mysql_query("INSERT INTO `{$this->previous_steps['mysql']['prefix']}menus` VALUES (5, 'tree_menu', 0, 0, '0', '', 'tree_menu/')");
-		mysql_query("INSERT INTO `{$this->previous_steps['mysql']['prefix']}menus` VALUES (6, 'search_menu', 0, 0, '0', '', 'search_menu/')");
-		mysql_query("INSERT INTO `{$this->previous_steps['mysql']['prefix']}menus` VALUES (7, 'compliance_menu', 0, 0, '0', '', 'compliance_menu/')");
-		mysql_query("INSERT INTO `{$this->previous_steps['mysql']['prefix']}menus` VALUES (8, 'userlanguage_menu', 0, 0, '0', '', 'userlanguage_menu/')");
-		mysql_query("INSERT INTO `{$this->previous_steps['mysql']['prefix']}menus` VALUES (9, 'powered_by_menu', 2, 2, '0', '', 'powered_by_menu/')");
-		mysql_query("INSERT INTO `{$this->previous_steps['mysql']['prefix']}menus` VALUES (10, 'counter_menu', 0, 0, '0', '', 'counter_menu/')");
-		mysql_query("INSERT INTO `{$this->previous_steps['mysql']['prefix']}menus` VALUES (11, 'usertheme_menu', 0, 0, '0', '', 'usertheme_menu/')");
-		mysql_query("INSERT INTO `{$this->previous_steps['mysql']['prefix']}menus` VALUES (12, 'banner_menu', 0, 0, '0', '', 'banner_menu/')");
-		mysql_query("INSERT INTO `{$this->previous_steps['mysql']['prefix']}menus` VALUES (13, 'online_extended_menu', 2, 1, '0', '', 'online_extended_menu/')");
-		mysql_query("INSERT INTO `{$this->previous_steps['mysql']['prefix']}menus` VALUES (14, 'clock_menu', 0, 0, '0', '', 'clock_menu/')");
-		mysql_query("INSERT INTO `{$this->previous_steps['mysql']['prefix']}menus` VALUES (15, 'sitebutton_menu', 0, 0, '0', '', 'sitebutton_menu/')");
-		mysql_query("INSERT INTO `{$this->previous_steps['mysql']['prefix']}menus` VALUES (16, 'comment_menu', 0, 0, '0', '', 'comment_menu/')");
-		mysql_query("INSERT INTO `{$this->previous_steps['mysql']['prefix']}menus` VALUES (17, 'lastseen_menu', 0, 0, '0', '', 'lastseen/')");
-		mysql_query("INSERT INTO `{$this->previous_steps['mysql']['prefix']}menus` VALUES (18, 'other_news_menu', 0, 0, '0', '', 'other_news_menu/')");
-		mysql_query("INSERT INTO `{$this->previous_steps['mysql']['prefix']}menus` VALUES (19, 'other_news2_menu', 0, 0, '0', '', 'other_news_menu/')");
-		mysql_query("INSERT INTO `{$this->previous_steps['mysql']['prefix']}menus` VALUES (20, 'admin_menu', 0, 0, '0', '', 'admin_menu/')");
-//		mysql_query("INSERT INTO `{$this->previous_steps['mysql']['prefix']}menus` VALUES (21, 'rss_menu', 5, 1, '0', '', 'rss_menu/')");
-		mysql_query("INSERT INTO `{$this->previous_steps['mysql']['prefix']}menus` VALUES (22, 'PCMag', 3, 1, '0', '', '1')");
-
-		mysql_query("INSERT INTO {$this->previous_steps['mysql']['prefix']}userclass_classes VALUES (1, 'PRIVATEMENU', '".LANINS_093."',".e_UC_ADMIN.")");
-		mysql_query("INSERT INTO {$this->previous_steps['mysql']['prefix']}userclass_classes VALUES (2, 'PRIVATEFORUM1', '".LANINS_094."',".e_UC_ADMIN.")");
-//		mysql_query("INSERT INTO {$this->previous_steps['mysql']['prefix']}plugin VALUES (0, '".LANINS_095."', '0.03', 'Integrity Check', 1, '') ");
-
-		mysql_query("INSERT INTO {$this->previous_steps['mysql']['prefix']}generic VALUES (0, 'wmessage', 1145848343, 1, '', 0, '[center]<img src=&#039;{e_IMAGE}splash.jpg&#039; style=&#039;width: 412px; height: 275px&#039; alt=&#039;&#039; />[/center]')");
-
-		mysql_query("INSERT INTO {$this->previous_steps['mysql']['prefix']}page VALUES (1, '', '[img]{e_IMAGE}pcmag.png[/img] ', 0, 1145843485, 0, 0, '', '', '', 'PCMag')");
-
-		// Create the admin user
-		$ip = $_SERVER['REMOTE_ADDR'];
-		$userp = "1, '{$this->previous_steps['admin']['display']}', '{$this->previous_steps['admin']['user']}', '', '".md5($this->previous_steps['admin']['password'])."', '', '{$this->previous_steps['admin']['email']}', '', '', '', 0, ".time().", 0, 0, 0, 0, 0, 0, '{$ip}', 0, '', '', '', 0, 1, '', '', '0', '', ".time().", ''";
-		mysql_query("INSERT INTO {$this->previous_steps['mysql']['prefix']}user VALUES ({$userp})" );
-		mysql_close();
-
-		return false;
-	}
-
-	function write_config($data) {
-		$fp = @fopen("e107_config.php", "w");
-		if (!@fwrite($fp, $data)) {
-			@fclose ($fp);
-			return nl2br(LANINS_070);
-		}
-		@fclose ($fp);
-		return false;
-	}
-}
-
-class e_forms {
-
-	var $form;
-	var $opened;
-
-	function start_form($id, $action, $method = "post" ) {
-		$this->form = "\n<form method='{$method}' id='{$id}' action='{$action}'>\n";
-		$this->opened = true;
-	}
-
-	function add_select_item($id, $labels, $selected) {
-		$this->form .= "
-		<select name='{$id}' id='{$id}'>\n";
-		foreach ($labels as $label) {
-			$this->form .= "<option".($label == $selected ? " selected='selected'" : "").">{$label}</option>\n";
-		}
-		$this->form .= "</select>\n";
-	}
-
-	function add_button($id, $title, $align = "right", $type = "submit") {
-		$this->form .= "<div style='text-align: {$align}; z-index: 10;'><input type='{$type}' id='{$id}' value='{$title}' /></div>\n";
-	}
-
-	function add_hidden_data($id, $data) {
-		$this->form .= "<input type='hidden' name='{$id}' value='{$data}' />\n";
-	}
-
-	function add_plain_html($html_data) {
-		$this->form .= $html_data;
-	}
-
-	function return_form() {
-		if($this->opened == true) {
-			$this->form .= "</form>\n";
-		}
-		$this->opened = false;
-		return $this->form;
-	}
-}
-
-class SimpleTemplate {
-
-	var $Tags = array();
-	var $open_tag = "{";
-	var $close_tag = "}";
-
-	function SimpleTemplate() {
-		define("TEMPLATE_TYPE_FILE", 0);
-		define("TEMPLATE_TYPE_DATA", 1);
-	}
-
-	function SetTag($TagName, $Data) {
-		$this->Tags[$TagName] = array(	'Tag'  => $TagName,
-		'Data' => $Data
-		);
-	}
-
-	function RemoveTag($TagName) {
-		unset($this->Tags[$TagName]);
-	}
-
-	function ClearTags() {
-		$this->Tags = array();
-	}
-
-	function ParseTemplate($Template, $template_type = TEMPLATE_TYPE_FILE) {
-		if($template_type == TEMPLATE_TYPE_DATA) {
-			$TemplateData = $Template;
-		} else {
-			$TemplateData = file_get_contents($Template);
-		}
-		foreach ($this->Tags as $Tag) {
-			$TemplateData = str_replace($this->open_tag.$Tag['Tag'].$this->close_tag, $Tag['Data'], $TemplateData);
-		}
-		return $TemplateData;
-	}
-}
-
-function template_data() {
-	$data = "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.1//EN\" \"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd\">
-<html xmlns=\"http://www.w3.org/1999/xhtml\">
-<head>
-<title>{installation_heading}</title>
-<meta http-equiv=\"Content-type\" content=\"text/html; charset=utf-8\" />
-<meta http-equiv=\"content-style-type\" content=\"text/css\" />
-<link rel=\"stylesheet\" href=\"{installer_css_http}\" type=\"text/css\" />
-</head>
-<body>
-<!-- Installer theme is a ripped version of 'Leaf' by Que, based on the nucleus cms theme by Ivan Fong aka Stanch. -->
-<div id=\"header\">
-  <h1>{installation_heading}</h1>
-</div>
-<div id=\"wrapper\">
-  <div id=\"container\">
-    <div id=\"content\">
-      <div class=\"contentbody\">
-        <h3>{stage_pre}{stage_num} - {stage_title}</h3>
-		<br />
-        <p>{stage_content}</p>
-		{debug_info}
-      </div>
-    </div>
-  </div>
-  <div class=\"clearing\">&nbsp;</div>
-</div>
-<div id=\"footer\">&nbsp;</div>
-
-</body>
-</html>";
-	return $data;
-}
-
-function get_object($name) {
-	switch ($name) {
-		case "stylesheet";
-		header("Content-type: text/css");
-		echo "#container{
-	float:left;
-	margin-right : -230px;
-	width : 670px;
-}
-#content{
-margin: 15px 0px 0px -15px;
-}
-#footer{
-	background : url({$_SERVER['PHP_SELF']}?object=01_footer.jpg) top no-repeat;
-	margin : auto;
-	padding : 20px 0 0 0;
-	width : 700px;
-}
-#header h1{
-	font-size : 20px;
-	left : 18px;
-	line-height : 20px;
-	margin : 0;
-	position : absolute;
-	top : 17px;
-}
-#header{
-	background : url({$_SERVER['PHP_SELF']}?object=01_header01.jpg) no-repeat;
-	height : 151px;
-	margin : auto;
-	position : relative;
-	width : 700px;
-}
-#wrapper{
-	background : white url({$_SERVER['PHP_SELF']}?object=01_bodybg.jpg) repeat-y;
-	margin : auto;
-	text-align:left;
-	width : 700px;
-}
-.clearing{
-	clear : both;
-	height : 0;
-}
-.contentbody{
-	margin : 0px;
-	padding : 0 5px 20px 43px;
-}
-a:hover, a:active{
-	color : black;
-}
-a:link, a:visited{
-	color : #23598C;
-	text-decoration : none;
-}
-h1 {
-	color : #23598C;
-}
-body{
-	background : #123454 url(images/01_bg.gif) top repeat-x;
-	color : #4C4C4C;
-	font-family : Trebuchet MS, \"Lucida Sans Unicode\", Arial, Lucida Sans, Tahoma, Sans-Serif;
-	font-size : 13px;
-	padding : 20px 0 20px 0;
-	text-align : center;
-}
-h3{
-	color : #3E565F;
-	font-size : 16px;
-	margin : 0 0 8px 0;
-}
-img{
-	border : none;
-}
-
-.logoimage {
-	padding-left: 600px;
-	padding-top: 65px;
-}
-
-td {
-	vertical-align: top;
-}
-
-.row-border {
-	border-bottom: 1px solid #999;
-	padding: 6px 3px 6px 3px;
-}";
-		break;
-
-		/* The following data is base64 encoded to preserve binary state in ASCII file */
-
-		case "01_footer.jpg":
-			header("Content-type: image/jpeg");
-			echo trim(base64_decode("
-/9j/4AAQSkZJRgABAgEASABIAAD/4QPgRXhpZgAATU0AKgAAAAgABwESAAMAAAABAAEAAAEaAAUA
-AAABAAAAYgEbAAUAAAABAAAAagEoAAMAAAABAAIAAAExAAIAAAAUAAAAcgEyAAIAAAAUAAAAhodp
-AAQAAAABAAAAnAAAAMgAAABIAAAAAQAAAEgAAAABQWRvYmUgUGhvdG9zaG9wIDcuMAAyMDA1OjAy
-OjI2IDA0OjE2OjUyAAAAAAOgAQADAAAAAf//AACgAgAEAAAAAQAAArygAwAEAAAAAQAAAA0AAAAA
-AAAABgEDAAMAAAABAAYAAAEaAAUAAAABAAABFgEbAAUAAAABAAABHgEoAAMAAAABAAIAAAIBAAQA
-AAABAAABJgICAAQAAAABAAACsgAAAAAAAABIAAAAAQAAAEgAAAAB/9j/4AAQSkZJRgABAgEASABI
-AAD/7QAMQWRvYmVfQ00AAv/uAA5BZG9iZQBkgAAAAAH/2wCEAAwICAgJCAwJCQwRCwoLERUPDAwP
-FRgTExUTExgRDAwMDAwMEQwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwBDQsLDQ4NEA4OEBQO
-Dg4UFA4ODg4UEQwMDAwMEREMDAwMDAwRDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDP/AABEI
-AAIAgAMBIgACEQEDEQH/3QAEAAj/xAE/AAABBQEBAQEBAQAAAAAAAAADAAECBAUGBwgJCgsBAAEF
-AQEBAQEBAAAAAAAAAAEAAgMEBQYHCAkKCxAAAQQBAwIEAgUHBggFAwwzAQACEQMEIRIxBUFRYRMi
-cYEyBhSRobFCIyQVUsFiMzRygtFDByWSU/Dh8WNzNRaisoMmRJNUZEXCo3Q2F9JV4mXys4TD03Xj
-80YnlKSFtJXE1OT0pbXF1eX1VmZ2hpamtsbW5vY3R1dnd4eXp7fH1+f3EQACAgECBAQDBAUGBwcG
-BTUBAAIRAyExEgRBUWFxIhMFMoGRFKGxQiPBUtHwMyRi4XKCkkNTFWNzNPElBhaisoMHJjXC0kST
-VKMXZEVVNnRl4vKzhMPTdePzRpSkhbSVxNTk9KW1xdXl9VZmdoaWprbG1ub2JzdHV2d3h5ent8f/
-2gAMAwEAAhEDEQA/ANro3/I+D/y9/R6v5v6H0W/zf/B/6P8A4NXP/rhXgiSkO5WDZ97/APrhS/8A
-rhXgiSSn3v8A+uFL/wCuFeCJJKfe/wD64Uv/AK4V4Ikkp97/APrhS/8ArhXgiSSn3v8A+uFL/wCu
-FeCJJKfe/wD64Uv/AK4V4Ikkp97/APrhQM7+g5P/AIoP5qzn+q5eFpJBRf/Z/+0ImFBob3Rvc2hv
-cCAzLjAAOEJJTQQlAAAAAAAQAAAAAAAAAAAAAAAAAAAAADhCSU0D7QAAAAAAEABIAAAAAQABAEgA
-AAABAAE4QklNBCYAAAAAAA4AAAAAAAAAAAAAP4AAADhCSU0EDQAAAAAABAAAAHg4QklNBBkAAAAA
-AAQAAAAeOEJJTQPzAAAAAAAJAAAAAAAAAAABADhCSU0ECgAAAAAAAQAAOEJJTScQAAAAAAAKAAEA
-AAAAAAAAAThCSU0D9QAAAAAASAAvZmYAAQBsZmYABgAAAAAAAQAvZmYAAQChmZoABgAAAAAAAQAy
-AAAAAQBaAAAABgAAAAAAAQA1AAAAAQAtAAAABgAAAAAAAThCSU0D+AAAAAAAcAAA////////////
-/////////////////wPoAAAAAP////////////////////////////8D6AAAAAD/////////////
-////////////////A+gAAAAA/////////////////////////////wPoAAA4QklNBAAAAAAAAAIA
-ADhCSU0EAgAAAAAAAgAAOEJJTQQIAAAAAAAQAAAAAQAAAkAAAAJAAAAAADhCSU0EHgAAAAAABAAA
-AAA4QklNBBoAAAAAA0kAAAAGAAAAAAAAAAAAAAANAAACvAAAAAoAVQBuAHQAaQB0AGwAZQBkAC0A
-NAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAACvAAAAA0AAAAAAAAAAAAAAAAAAAAA
-AQAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAQAAAAAAAG51bGwAAAACAAAABmJvdW5kc09iamMAAAAB
-AAAAAAAAUmN0MQAAAAQAAAAAVG9wIGxvbmcAAAAAAAAAAExlZnRsb25nAAAAAAAAAABCdG9tbG9u
-ZwAAAA0AAAAAUmdodGxvbmcAAAK8AAAABnNsaWNlc1ZsTHMAAAABT2JqYwAAAAEAAAAAAAVzbGlj
-ZQAAABIAAAAHc2xpY2VJRGxvbmcAAAAAAAAAB2dyb3VwSURsb25nAAAAAAAAAAZvcmlnaW5lbnVt
-AAAADEVTbGljZU9yaWdpbgAAAA1hdXRvR2VuZXJhdGVkAAAAAFR5cGVlbnVtAAAACkVTbGljZVR5
-cGUAAAAASW1nIAAAAAZib3VuZHNPYmpjAAAAAQAAAAAAAFJjdDEAAAAEAAAAAFRvcCBsb25nAAAA
-AAAAAABMZWZ0bG9uZwAAAAAAAAAAQnRvbWxvbmcAAAANAAAAAFJnaHRsb25nAAACvAAAAAN1cmxU
-RVhUAAAAAQAAAAAAAG51bGxURVhUAAAAAQAAAAAAAE1zZ2VURVhUAAAAAQAAAAAABmFsdFRhZ1RF
-WFQAAAABAAAAAAAOY2VsbFRleHRJc0hUTUxib29sAQAAAAhjZWxsVGV4dFRFWFQAAAABAAAAAAAJ
-aG9yekFsaWduZW51bQAAAA9FU2xpY2VIb3J6QWxpZ24AAAAHZGVmYXVsdAAAAAl2ZXJ0QWxpZ25l
-bnVtAAAAD0VTbGljZVZlcnRBbGlnbgAAAAdkZWZhdWx0AAAAC2JnQ29sb3JUeXBlZW51bQAAABFF
-U2xpY2VCR0NvbG9yVHlwZQAAAABOb25lAAAACXRvcE91dHNldGxvbmcAAAAAAAAACmxlZnRPdXRz
-ZXRsb25nAAAAAAAAAAxib3R0b21PdXRzZXRsb25nAAAAAAAAAAtyaWdodE91dHNldGxvbmcAAAAA
-ADhCSU0EEQAAAAAAAQEAOEJJTQQUAAAAAAAEAAAAAzhCSU0EDAAAAAACzgAAAAEAAACAAAAAAgAA
-AYAAAAMAAAACsgAYAAH/2P/gABBKRklGAAECAQBIAEgAAP/tAAxBZG9iZV9DTQAC/+4ADkFkb2Jl
-AGSAAAAAAf/bAIQADAgICAkIDAkJDBELCgsRFQ8MDA8VGBMTFRMTGBEMDAwMDAwRDAwMDAwMDAwM
-DAwMDAwMDAwMDAwMDAwMDAwMDAENCwsNDg0QDg4QFA4ODhQUDg4ODhQRDAwMDAwREQwMDAwMDBEM
-DAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwM/8AAEQgAAgCAAwEiAAIRAQMRAf/dAAQACP/EAT8A
-AAEFAQEBAQEBAAAAAAAAAAMAAQIEBQYHCAkKCwEAAQUBAQEBAQEAAAAAAAAAAQACAwQFBgcICQoL
-EAABBAEDAgQCBQcGCAUDDDMBAAIRAwQhEjEFQVFhEyJxgTIGFJGhsUIjJBVSwWIzNHKC0UMHJZJT
-8OHxY3M1FqKygyZEk1RkRcKjdDYX0lXiZfKzhMPTdePzRieUpIW0lcTU5PSltcXV5fVWZnaGlqa2
-xtbm9jdHV2d3h5ent8fX5/cRAAICAQIEBAMEBQYHBwYFNQEAAhEDITESBEFRYXEiEwUygZEUobFC
-I8FS0fAzJGLhcoKSQ1MVY3M08SUGFqKygwcmNcLSRJNUoxdkRVU2dGXi8rOEw9N14/NGlKSFtJXE
-1OT0pbXF1eX1VmZ2hpamtsbW5vYnN0dXZ3eHl6e3x//aAAwDAQACEQMRAD8A2ujf8j4P/L39Hq/m
-/ofRb/N/8H/o/wDg1c/+uFeCJKQ7lYNn3v8A+uFL/wCuFeCJJKfe/wD64Uv/AK4V4Ikkp97/APrh
-S/8ArhXgiSSn3v8A+uFL/wCuFeCJJKfe/wD64Uv/AK4V4Ikkp97/APrhS/8ArhXgiSSn3v8A+uFA
-zv6Dk/8Aig/mrOf6rl4WkkFF/9k4QklNBCEAAAAAAFUAAAABAQAAAA8AQQBkAG8AYgBlACAAUABo
-AG8AdABvAHMAaABvAHAAAAATAEEAZABvAGIAZQAgAFAAaABvAHQAbwBzAGgAbwBwACAANwAuADAA
-AAABADhCSU0EBgAAAAAABwAIAAAAAQEA/+ESSGh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8A
-PD94cGFja2V0IGJlZ2luPSfvu78nIGlkPSdXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQnPz4KPD9h
-ZG9iZS14YXAtZmlsdGVycyBlc2M9IkNSIj8+Cjx4OnhhcG1ldGEgeG1sbnM6eD0nYWRvYmU6bnM6
-bWV0YS8nIHg6eGFwdGs9J1hNUCB0b29sa2l0IDIuOC4yLTMzLCBmcmFtZXdvcmsgMS41Jz4KPHJk
-ZjpSREYgeG1sbnM6cmRmPSdodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgt
-bnMjJyB4bWxuczppWD0naHR0cDovL25zLmFkb2JlLmNvbS9pWC8xLjAvJz4KCiA8cmRmOkRlc2Ny
-aXB0aW9uIGFib3V0PSd1dWlkOjM4ZWY1NGQ0LTg3ZjAtMTFkOS1hMDM2LWFlYWQ3YjZlYzZhMycK
-ICB4bWxuczp4YXBNTT0naHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyc+CiAgPHhhcE1N
-OkRvY3VtZW50SUQ+YWRvYmU6ZG9jaWQ6cGhvdG9zaG9wOjM4ZWY1NGQyLTg3ZjAtMTFkOS1hMDM2
-LWFlYWQ3YjZlYzZhMzwveGFwTU06RG9jdW1lbnRJRD4KIDwvcmRmOkRlc2NyaXB0aW9uPgoKPC9y
-ZGY6UkRGPgo8L3g6eGFwbWV0YT4KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAK
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-IAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAog
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgCjw/eHBhY2tldCBlbmQ9J3cnPz7/7gAOQWRvYmUAZEAAAAAB/9sAhAABAQEB
-AQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAgICAgICAgICAgIDAwMDAwMD
-AwMDAQEBAQEBAQEBAQECAgECAgMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMD
-AwMDAwMDAwMDAwP/wAARCAANArwDAREAAhEBAxEB/90ABABY/8QBogAAAAYCAwEAAAAAAAAAAAAA
-BwgGBQQJAwoCAQALAQAABgMBAQEAAAAAAAAAAAAGBQQDBwIIAQkACgsQAAIBAwQBAwMCAwMDAgYJ
-dQECAwQRBRIGIQcTIgAIMRRBMiMVCVFCFmEkMxdScYEYYpElQ6Gx8CY0cgoZwdE1J+FTNoLxkqJE
-VHNFRjdHYyhVVlcassLS4vJkg3SThGWjs8PT4yk4ZvN1Kjk6SElKWFlaZ2hpanZ3eHl6hYaHiImK
-lJWWl5iZmqSlpqeoqaq0tba3uLm6xMXGx8jJytTV1tfY2drk5ebn6Onq9PX29/j5+hEAAgEDAgQE
-AwUEBAQGBgVtAQIDEQQhEgUxBgAiE0FRBzJhFHEIQoEjkRVSoWIWMwmxJMHRQ3LwF+GCNCWSUxhj
-RPGisiY1GVQ2RWQnCnODk0Z0wtLi8lVldVY3hIWjs8PT4/MpGpSktMTU5PSVpbXF1eX1KEdXZjh2
-hpamtsbW5vZnd4eXp7fH1+f3SFhoeIiYqLjI2Oj4OUlZaXmJmam5ydnp+So6SlpqeoqaqrrK2ur6
-/9oADAMBAAIRAxEAPwA6v/CWPvHYuU+M/wAjvitDkUpO3tsd9v8AIjGYOqqKKOfeGyN59dbH6+rP
-7s0b1SV1fVbQyPW0kuS0RsIo8lRBQTKdMie4tjOl/a34WsDR6K+jKzHP2hsetD1HvIV5C9jdWOr/
-ABhZNdPUFQuPsK5+0dbXeM3aKRWpqrVBNCzRSwzK0csUkZKyRuj2ZGVxYggEEe45qPz6HoJHTx/f
-Sm/46J/tz73+fVtR69/fSm/46J/tz79+fXtR69/fSm/46J/tz79+fXtR69/fSm/46J/tz79+fXtR
-69/fSm/46J/tz79+fXtR69/fSm/46J/tz79+fXtR69/fSm/46J/tz79+fXtR69/fSm/46J/tz79+
-fXtR69/fSm/46J/tz79+fXtR69/fSm/46J/tz79+fXtR69/fSm/46J/tz79+fXtR69/fSm/46J/t
-z79+fXtR69/fSm/46J/tz79+fXtR69/fSm/46J/tz79+fXtR69/fSm/46J/tz79+fXtR69/fSm/4
-6J/tz79+fXtR69/fSm/46J/tz79+fXtR69/fSm/46J/tz79+fXtR69/fSm/46J/tz79+fXtR69/f
-Sm/46J/tz79+fXtR69/fSm/46J/tz79+fXtR69/fSm/46J/tz79+fXtR69/fSm/46J/tz79+fXtR
-69/fSm/46J/tz79+fXtR69/fSm/46J/tz79+fXtR69/fSm/46J/tz79+fXtR69/fSm/46J/tz79+
-fXtR69/fSm/46J/tz79+fXtR69/fSm/46J/tz79+fXtR69/fSm/46J/tz79+fXtR69/fSm/46J/t
-z79+fXtR69/fSm/46J/tz79+fXtR69/fSm/46J/tz79+fXtR69/fSm/46J/tz79+fXtR69/fSm/4
-6J/tz79+fXtR69/fSm/46J/tz79+fXtR69/fSm/46J/tz79+fXtR69/fSm/46J/tz79+fXtR69/f
-Sm/46J/tz79+fXtR69/fSm/46J/tz79+fXtR69/fSm/46J/tz79+fXtR69/fSm/46J/tz79+fXtR
-69/fSm/46J/tz79+fXtR69/fSm/46J/tz79+fXtR69/fSm/46J/tz79+fXtR69/fSm/46J/tz79+
-fXtR69/fSm/46J/tz79+fXtR69/fSm/46J/tz79+fXtR69/fSm/46J/tz79+fXtR69/fSm/46J/t
-z79+fXtR69/fSm/46J/tz79+fXtR69/fSm/46J/tz79+fXtR69/fSm/46J/tz79+fXtR69/fSm/4
-6J/tz79+fXtR69/fSm/46J/tz79+fXtR69/fSm/46J/tz79+fXtR69/fSm/46J/tz79+fXtR69/f
-Sm/46J/tz79+fXtR69/fSm/46J/tz79+fXtR69/fSm/46J/tz79+fXtR69/fSm/46J/tz79+fXtR
-69/fSm/46J/tz79+fXtR69/fSm/46J/tz79+fXtR69/fSm/46J/tz79+fXtR69/fSm/46J/tz79+
-fXtR69/fSm/46J/tz79+fXtR69/fSm/46J/tz79+fXtR69/fSm/46J/tz79+fXtR69/fSm/46J/t
-z79+fXtR69/fSm/46J/tz79+fXtR69/fSm/46J/tz79+fXtR69/fSm/46J/tz79+fXtR69/fSm/4
-6J/tz79+fXtR69/fSm/46J/tz79+fXtR69/fSm/46J/tz79+fXtR69/fSm/46J/tz79+fXtR69/f
-Sm/46J/tz79+fXtR69/fSm/46J/tz79+fXtR69/fSm/46J/tz79+fXtR69/fSm/46J/tz79+fXtR
-69/fSm/46J/tz79+fXtR69/fSm/46J/tz79+fXtR69/fSm/46J/tz79+fXtR64Sb1pgjfup9P6/X
-/b+/fn1rUekJmt34TC0uQ3/vHN4/aewNjU1Vundu8s9UQ4/b2DxOAiGSrKnIZKrlgpoI0RF1eouq
-vqCkC3u0cck0iRRIWdjQAZJPoOqO6Rq0srBY1FSTwAHz6+XX/s1Gxv8Ah03/AGef+Dbg/wBGn/Dh
-v+za/wB3/DS/3r/uJ/syP+mL+D+D7j7L+8H93/2NHl8X3PGrTz7yE/dc39Wf3ZUeP9L4dfLV4emv
-2V6gv94xf1h/edD4H1XiU86eJqp9tOv/0Ncz4+/7ML/pi2d/sqf+mD/T197L/cX/AEEDdh7N+7+3
-k+8/gX9ySNweL7Lyfc+P9r7bX5f2tXvJvdP3d9LJ+8vD+l89dNP56sfZ8+HWOW3/AF31MX7v8T6q
-uNFdX5Uz9vy49bYdAP8AhYh/D6D7Nsr9r9lS/bfxFf5X/wDEPB4I/D9//GX/AIv9747eX7r/ACnX
-fyevV7jB/wDW51Ghbj5C4p/h6kZP9cHSMClP+Xf/AC5/b1Jt/wALGv8AVVP/ACR/Kt/6+e6U9uvV
-/wBlx/n6t/zED0H/AGb/AObr1v8AhY1/qqn/AJI/lW/9fPfqe3Xq/wCy4/z9e/5iB6D/ALN/83Xr
-f8LGv9VU/wDJH8q3/r579T269X/Zcf5+vf8AMQPQf9m/+br1v+FjX+qqf+SP5Vv/AF89+p7der/s
-uP8AP17/AJiB6D/s3/zdet/wsa/1VT/yR/Kt/wCvnv1Pbr1f9lx/n69/zED0H/Zv/m69b/hY1/qq
-n/kj+Vb/ANfPfqe3Xq/7Lj/P17/mIHoP+zf/ADdet/wsa/1VT/yR/Kt/6+e/U9uvV/2XH+fr3/MQ
-PQf9m/8Am69b/hY1/qqn/kj+Vb/189+p7der/suP8/Xv+Ygeg/7N/wDN163/AAsa/wBVU/8AJH8q
-3/r579T269X/AGXH+fr3/MQPQf8AZv8A5uvW/wCFjX+qqf8Akj+Vb/189+p7der/ALLj/P17/mIH
-oP8As3/zdet/wsa/1VT/AMkfyrf+vnv1Pbr1f9lx/n69/wAxA9B/2b/5uvW/4WNf6qp/5I/lW/8A
-Xz36nt16v+y4/wA/Xv8AmIHoP+zf/N163/Cxr/VVP/JH8q3/AK+e/U9uvV/2XH+fr3/MQPQf9m/+
-br1v+FjX+qqf+SP5Vv8A189+p7der/suP8/Xv+Ygeg/7N/8AN163/Cxr/VVP/JH8q3/r579T269X
-/Zcf5+vf8xA9B/2b/wCbr1v+FjX+qqf+SP5Vv/Xz36nt16v+y4/z9e/5iB6D/s3/AM3Xrf8ACxr/
-AFVT/wAkfyrf+vnv1Pbr1f8AZcf5+vf8xA9B/wBm/wDm69b/AIWNf6qp/wCSP5Vv/Xz36nt16v8A
-suP8/Xv+Ygeg/wCzf/N163/Cxr/VVP8AyR/Kt/6+e/U9uvV/2XH+fr3/ADED0H/Zv/m69b/hY1/q
-qn/kj+Vb/wBfPfqe3Xq/7Lj/AD9e/wCYgeg/7N/83Xrf8LGv9VU/8kfyrf8Ar579T269X/Zcf5+v
-f8xA9B/2b/5uvW/4WNf6qp/5I/lW/wDXz36nt16v+y4/z9e/5iB6D/s3/wA3Xrf8LGv9VU/8kfyr
-f+vnv1Pbr1f9lx/n69/zED0H/Zv/AJuvW/4WNf6qp/5I/lW/9fPfqe3Xq/7Lj/P17/mIHoP+zf8A
-zdet/wALGv8AVVP/ACR/Kt/6+e/U9uvV/wBlx/n69/zED0H/AGb/AObr1v8AhY1/qqn/AJI/lW/9
-fPfqe3Xq/wCy4/z9e/5iB6D/ALN/83Xrf8LGv9VU/wDJH8q3/r579T269X/Zcf5+vf8AMQPQf9m/
-+br1v+FjX+qqf+SP5Vv/AF89+p7der/suP8AP17/AJiB6D/s3/zdet/wsa/1VT/yR/Kt/wCvnv1P
-br1f9lx/n69/zED0H/Zv/m69b/hY1/qqn/kj+Vb/ANfPfqe3Xq/7Lj/P17/mIHoP+zf/ADdet/ws
-a/1VT/yR/Kt/6+e/U9uvV/2XH+fr3/MQPQf9m/8Am69b/hY1/qqn/kj+Vb/189+p7der/suP8/Xv
-+Ygeg/7N/wDN163/AAsa/wBVU/8AJH8q3/r579T269X/AGXH+fr3/MQPQf8AZv8A5uvW/wCFjX+q
-qf8Akj+Vb/189+p7der/ALLj/P17/mIHoP8As3/zdet/wsa/1VT/AMkfyrf+vnv1Pbr1f9lx/n69
-/wAxA9B/2b/5uvW/4WNf6qp/5I/lW/8AXz36nt16v+y4/wA/Xv8AmIHoP+zf/N163/Cxr/VVP/JH
-8q3/AK+e/U9uvV/2XH+fr3/MQPQf9m/+br1v+FjX+qqf+SP5Vv8A189+p7der/suP8/Xv+Ygeg/7
-N/8AN163/Cxr/VVP/JH8q3/r579T269X/Zcf5+vf8xA9B/2b/wCbr1v+FjX+qqf+SP5Vv/Xz36nt
-16v+y4/z9e/5iB6D/s3/AM3Xrf8ACxr/AFVT/wAkfyrf+vnv1Pbr1f8AZcf5+vf8xA9B/wBm/wDm
-69b/AIWNf6qp/wCSP5Vv/Xz36nt16v8AsuP8/Xv+Ygeg/wCzf/N163/Cxr/VVP8AyR/Kt/6+e/U9
-uvV/2XH+fr3/ADED0H/Zv/m69b/hY1/qqn/kj+Vb/wBfPfqe3Xq/7Lj/AD9e/wCYgeg/7N/83Xrf
-8LGv9VU/8kfyrf8Ar579T269X/Zcf5+vf8xA9B/2b/5uvW/4WNf6qp/5I/lW/wDXz36nt16v+y4/
-z9e/5iB6D/s3/wA3Xrf8LGv9VU/8kfyrf+vnv1Pbr1f9lx/n69/zED0H/Zv/AJuvW/4WNf6qp/5I
-/lW/9fPfqe3Xq/7Lj/P17/mIHoP+zf8Azdet/wALGv8AVVP/ACR/Kt/6+e/U9uvV/wBlx/n69/zE
-D0H/AGb/AObr1v8AhY1/qqn/AJI/lW/9fPfqe3Xq/wCy4/z9e/5iB6D/ALN/83Xrf8LGv9VU/wDJ
-H8q3/r579T269X/Zcf5+vf8AMQPQf9m/+br1v+FjX+qqf+SP5Vv/AF89+p7der/suP8AP17/AJiB
-6D/s3/zdet/wsa/1VT/yR/Kt/wCvnv1Pbr1f9lx/n69/zED0H/Zv/m69b/hY1/qqn/kj+Vb/ANfP
-fqe3Xq/7Lj/P17/mIHoP+zf/ADdet/wsa/1VT/yR/Kt/6+e/U9uvV/2XH+fr3/MQPQf9m/8Am69b
-/hY1/qqn/kj+Vb/189+p7der/suP8/Xv+Ygeg/7N/wDN163/AAsa/wBVU/8AJH8q3/r579T269X/
-AGXH+fr3/MQPQf8AZv8A5uvW/wCFjX+qqf8Akj+Vb/189+p7der/ALLj/P17/mIHoP8As3/zdet/
-wsa/1VT/AMkfyrf+vnv1Pbr1f9lx/n69/wAxA9B/2b/5uvW/4WNf6qp/5I/lW/8AXz36nt16v+y4
-/wA/Xv8AmIHoP+zf/N163/Cxr/VVP/JH8q3/AK+e/U9uvV/2XH+fr3/MQPQf9m/+br1v+FjX+qqf
-+SP5Vv8A189+p7der/suP8/Xv+Ygeg/7N/8AN163/Cxr/VVP/JH8q3/r579T269X/Zcf5+vf8xA9
-B/2b/wCbr1v+FjX+qqf+SP5Vv/Xz36nt16v+y4/z9e/5iB6D/s3/AM3Xrf8ACxr/AFVT/wAkfyrf
-+vnv1Pbr1f8AZcf5+vf8xA9B/wBm/wDm69b/AIWNf6qp/wCSP5Vv/Xz36nt16v8AsuP8/Xv+Ygeg
-/wCzf/N163/Cxr/VVP8AyR/Kt/6+e/U9uvV/2XH+fr3/ADED0H/Zv/m69b/hY1/qqn/kj+Vb/wBf
-Pfqe3Xq/7Lj/AD9e/wCYgeg/7N/83Xrf8LGv9VU/8kfyrf8Ar579T269X/Zcf5+vf8xA9B/2b/5u
-vW/4WNf6qp/5I/lW/wDXz36nt16v+y4/z9e/5iB6D/s3/wA3Xrf8LGv9VU/8kfyrf+vnv1Pbr1f9
-lx/n69/zED0H/Zv/AJuvW/4WNf6qp/5I/lW/9fPfqe3Xq/7Lj/P17/mIHoP+zf8Azdet/wALGv8A
-VVP/ACR/Kt/6+e/U9uvV/wBlx/n69/zED0H/AGb/AObr1v8AhY1/qqn/AJI/lW/9fPfqe3Xq/wCy
-4/z9e/5iB6D/ALN/83Xrf8LGv9VU/wDJH8q3/r579T269X/Zcf5+vf8AMQPQf9m/+br1v+FjX+qq
-f+SP5Vv/AF89+p7der/suP8AP17/AJiB6D/s3/zdet/wsa/1VT/yR/Kt/wCvnv1Pbr1f9lx/n69/
-zED0H/Zv/m69b/hY1/qqn/kj+Vb/ANfPfqe3Xq/7Lj/P17/mIHoP+zf/ADdet/wsa/1VT/yR/Kt/
-6+e/U9uvV/2XH+fr3/MQPQf9m/8Am69b/hY1/qqn/kj+Vb/189+p7der/suP8/Xv+Ygeg/7N/wDN
-163/AAsa/wBVU/8AJH8q3/r579T269X/AGXH+fr3/MQPQf8AZv8A5uvW/wCFjX+qqf8Akj+Vb/18
-9+p7der/ALLj/P17/mIHoP8As3/zdet/wsa/1VT/AMkfyrf+vnv1Pbr1f9lx/n69/wAxA9B/2b/5
-uvW/4WM/6qp/5I/lW/8AR/v3/MOvV/2XH+fr3/MQfQf9m/VYX8z7/oIK/wBF+L/4cdPeP+hH9z7/
-APuevSo6i1/fUP2n+lT/AGU9jsj7j+JeH+G/3r9flv8AZ86/Yj5e/qZ9T/upKfVeWrVq/wBr4meH
-HT+fQf37+t/04/e2v6Xz06dP+28PH2avy6oK/b8f+0e5A7dPy6BWdXz6/9k=
-"));
-		break;
-		case "01_bodybg.jpg":
-			header("Content-type: image/jpeg");
-			echo trim(base64_decode("
-/9j/4AAQSkZJRgABAgEASABIAAD/4QOnRXhpZgAATU0AKgAAAAgABwESAAMAAAABAAEAAAEaAAUA
-AAABAAAAYgEbAAUAAAABAAAAagEoAAMAAAABAAIAAAExAAIAAAAUAAAAcgEyAAIAAAAUAAAAhodp
-AAQAAAABAAAAnAAAAMgAAABIAAAAAQAAAEgAAAABQWRvYmUgUGhvdG9zaG9wIDcuMAAyMDA1OjAy
-OjI2IDA0OjE2OjIwAAAAAAOgAQADAAAAAf//AACgAgAEAAAAAQAAArygAwAEAAAAAQAAAAEAAAAA
-AAAABgEDAAMAAAABAAYAAAEaAAUAAAABAAABFgEbAAUAAAABAAABHgEoAAMAAAABAAIAAAIBAAQA
-AAABAAABJgICAAQAAAABAAACeQAAAAAAAABIAAAAAQAAAEgAAAAB/9j/4AAQSkZJRgABAgEASABI
-AAD/7QAMQWRvYmVfQ00AAv/uAA5BZG9iZQBkgAAAAAH/2wCEAAwICAgJCAwJCQwRCwoLERUPDAwP
-FRgTExUTExgRDAwMDAwMEQwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwBDQsLDQ4NEA4OEBQO
-Dg4UFA4ODg4UEQwMDAwMEREMDAwMDAwRDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDP/AABEI
-AAEAgAMBIgACEQEDEQH/3QAEAAj/xAE/AAABBQEBAQEBAQAAAAAAAAADAAECBAUGBwgJCgsBAAEF
-AQEBAQEBAAAAAAAAAAEAAgMEBQYHCAkKCxAAAQQBAwIEAgUHBggFAwwzAQACEQMEIRIxBUFRYRMi
-cYEyBhSRobFCIyQVUsFiMzRygtFDByWSU/Dh8WNzNRaisoMmRJNUZEXCo3Q2F9JV4mXys4TD03Xj
-80YnlKSFtJXE1OT0pbXF1eX1VmZ2hpamtsbW5vY3R1dnd4eXp7fH1+f3EQACAgECBAQDBAUGBwcG
-BTUBAAIRAyExEgRBUWFxIhMFMoGRFKGxQiPBUtHwMyRi4XKCkkNTFWNzNPElBhaisoMHJjXC0kST
-VKMXZEVVNnRl4vKzhMPTdePzRpSkhbSVxNTk9KW1xdXl9VZmdoaWprbG1ub2JzdHV2d3h5ent8f/
-2gAMAwEAAhEDEQA/APRug/8AIfTv/CtP/ntivr5VSRO5QNg/VSS+VUkEv1UkvlVJJT9VJL5VSSU/
-VSS+VUklP1UkvlVJJT9VJL5VSSU/VSp9Y/5Izv8Awvb/ANQ5fMKSQ3Udn//Z/+0IYFBob3Rvc2hv
-cCAzLjAAOEJJTQQlAAAAAAAQAAAAAAAAAAAAAAAAAAAAADhCSU0D7QAAAAAAEABIAAAAAQABAEgA
-AAABAAE4QklNBCYAAAAAAA4AAAAAAAAAAAAAP4AAADhCSU0EDQAAAAAABAAAAHg4QklNBBkAAAAA
-AAQAAAAeOEJJTQPzAAAAAAAJAAAAAAAAAAABADhCSU0ECgAAAAAAAQAAOEJJTScQAAAAAAAKAAEA
-AAAAAAAAAThCSU0D9QAAAAAASAAvZmYAAQBsZmYABgAAAAAAAQAvZmYAAQChmZoABgAAAAAAAQAy
-AAAAAQBaAAAABgAAAAAAAQA1AAAAAQAtAAAABgAAAAAAAThCSU0D+AAAAAAAcAAA////////////
-/////////////////wPoAAAAAP////////////////////////////8D6AAAAAD/////////////
-////////////////A+gAAAAA/////////////////////////////wPoAAA4QklNBAAAAAAAAAIA
-ADhCSU0EAgAAAAAAAgAAOEJJTQQIAAAAAAAQAAAAAQAAAkAAAAJAAAAAADhCSU0EHgAAAAAABAAA
-AAA4QklNBBoAAAAAA0kAAAAGAAAAAAAAAAAAAAABAAACvAAAAAoAVQBuAHQAaQB0AGwAZQBkAC0A
-MwAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAACvAAAAAEAAAAAAAAAAAAAAAAAAAAA
-AQAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAQAAAAAAAG51bGwAAAACAAAABmJvdW5kc09iamMAAAAB
-AAAAAAAAUmN0MQAAAAQAAAAAVG9wIGxvbmcAAAAAAAAAAExlZnRsb25nAAAAAAAAAABCdG9tbG9u
-ZwAAAAEAAAAAUmdodGxvbmcAAAK8AAAABnNsaWNlc1ZsTHMAAAABT2JqYwAAAAEAAAAAAAVzbGlj
-ZQAAABIAAAAHc2xpY2VJRGxvbmcAAAAAAAAAB2dyb3VwSURsb25nAAAAAAAAAAZvcmlnaW5lbnVt
-AAAADEVTbGljZU9yaWdpbgAAAA1hdXRvR2VuZXJhdGVkAAAAAFR5cGVlbnVtAAAACkVTbGljZVR5
-cGUAAAAASW1nIAAAAAZib3VuZHNPYmpjAAAAAQAAAAAAAFJjdDEAAAAEAAAAAFRvcCBsb25nAAAA
-AAAAAABMZWZ0bG9uZwAAAAAAAAAAQnRvbWxvbmcAAAABAAAAAFJnaHRsb25nAAACvAAAAAN1cmxU
-RVhUAAAAAQAAAAAAAG51bGxURVhUAAAAAQAAAAAAAE1zZ2VURVhUAAAAAQAAAAAABmFsdFRhZ1RF
-WFQAAAABAAAAAAAOY2VsbFRleHRJc0hUTUxib29sAQAAAAhjZWxsVGV4dFRFWFQAAAABAAAAAAAJ
-aG9yekFsaWduZW51bQAAAA9FU2xpY2VIb3J6QWxpZ24AAAAHZGVmYXVsdAAAAAl2ZXJ0QWxpZ25l
-bnVtAAAAD0VTbGljZVZlcnRBbGlnbgAAAAdkZWZhdWx0AAAAC2JnQ29sb3JUeXBlZW51bQAAABFF
-U2xpY2VCR0NvbG9yVHlwZQAAAABOb25lAAAACXRvcE91dHNldGxvbmcAAAAAAAAACmxlZnRPdXRz
-ZXRsb25nAAAAAAAAAAxib3R0b21PdXRzZXRsb25nAAAAAAAAAAtyaWdodE91dHNldGxvbmcAAAAA
-ADhCSU0EEQAAAAAAAQEAOEJJTQQUAAAAAAAEAAAAAzhCSU0EDAAAAAAClQAAAAEAAACAAAAAAQAA
-AYAAAAGAAAACeQAYAAH/2P/gABBKRklGAAECAQBIAEgAAP/tAAxBZG9iZV9DTQAC/+4ADkFkb2Jl
-AGSAAAAAAf/bAIQADAgICAkIDAkJDBELCgsRFQ8MDA8VGBMTFRMTGBEMDAwMDAwRDAwMDAwMDAwM
-DAwMDAwMDAwMDAwMDAwMDAwMDAENCwsNDg0QDg4QFA4ODhQUDg4ODhQRDAwMDAwREQwMDAwMDBEM
-DAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwM/8AAEQgAAQCAAwEiAAIRAQMRAf/dAAQACP/EAT8A
-AAEFAQEBAQEBAAAAAAAAAAMAAQIEBQYHCAkKCwEAAQUBAQEBAQEAAAAAAAAAAQACAwQFBgcICQoL
-EAABBAEDAgQCBQcGCAUDDDMBAAIRAwQhEjEFQVFhEyJxgTIGFJGhsUIjJBVSwWIzNHKC0UMHJZJT
-8OHxY3M1FqKygyZEk1RkRcKjdDYX0lXiZfKzhMPTdePzRieUpIW0lcTU5PSltcXV5fVWZnaGlqa2
-xtbm9jdHV2d3h5ent8fX5/cRAAICAQIEBAMEBQYHBwYFNQEAAhEDITESBEFRYXEiEwUygZEUobFC
-I8FS0fAzJGLhcoKSQ1MVY3M08SUGFqKygwcmNcLSRJNUoxdkRVU2dGXi8rOEw9N14/NGlKSFtJXE
-1OT0pbXF1eX1VmZ2hpamtsbW5vYnN0dXZ3eHl6e3x//aAAwDAQACEQMRAD8A9G6D/wAh9O/8K0/+
-e2K+vlVJE7lA2D9VJL5VSQS/VSS+VUklP1UkvlVJJT9VJL5VSSU/VSS+VUklP1UkvlVJJT9VKn1j
-/kjO/wDC9v8A1Dl8wpJDdR2f/9kAOEJJTQQhAAAAAABVAAAAAQEAAAAPAEEAZABvAGIAZQAgAFAA
-aABvAHQAbwBzAGgAbwBwAAAAEwBBAGQAbwBiAGUAIABQAGgAbwB0AG8AcwBoAG8AcAAgADcALgAw
-AAAAAQA4QklNBAYAAAAAAAcACAAAAAEBAP/hEkhodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAv
-ADw/eHBhY2tldCBiZWdpbj0n77u/JyBpZD0nVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkJz8+Cjw/
-YWRvYmUteGFwLWZpbHRlcnMgZXNjPSJDUiI/Pgo8eDp4YXBtZXRhIHhtbG5zOng9J2Fkb2JlOm5z
-Om1ldGEvJyB4OnhhcHRrPSdYTVAgdG9vbGtpdCAyLjguMi0zMywgZnJhbWV3b3JrIDEuNSc+Cjxy
-ZGY6UkRGIHhtbG5zOnJkZj0naHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4
-LW5zIycgeG1sbnM6aVg9J2h0dHA6Ly9ucy5hZG9iZS5jb20vaVgvMS4wLyc+CgogPHJkZjpEZXNj
-cmlwdGlvbiBhYm91dD0ndXVpZDozOGVmNTRkMC04N2YwLTExZDktYTAzNi1hZWFkN2I2ZWM2YTMn
-CiAgeG1sbnM6eGFwTU09J2h0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8nPgogIDx4YXBN
-TTpEb2N1bWVudElEPmFkb2JlOmRvY2lkOnBob3Rvc2hvcDo2ZTEwMWQwMy04N2VlLTExZDktYTAz
-Ni1hZWFkN2I2ZWM2YTM8L3hhcE1NOkRvY3VtZW50SUQ+CiA8L3JkZjpEZXNjcmlwdGlvbj4KCjwv
-cmRmOlJERj4KPC94OnhhcG1ldGE+CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAK
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgIAo8P3hwYWNrZXQgZW5kPSd3Jz8+/+4ADkFkb2JlAGRAAAAAAf/bAIQAAQEB
-AQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQICAgICAgICAgICAwMDAwMD
-AwMDAwEBAQEBAQEBAQEBAgIBAgIDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMD
-AwMDAwMDAwMDAwMD/8AAEQgAAQK8AwERAAIRAQMRAf/dAAQAWP/EAaIAAAAGAgMBAAAAAAAAAAAA
-AAcIBgUECQMKAgEACwEAAAYDAQEBAAAAAAAAAAAABgUEAwcCCAEJAAoLEAACAQMEAQMDAgMDAwIG
-CXUBAgMEEQUSBiEHEyIACDEUQTIjFQlRQhZhJDMXUnGBGGKRJUOhsfAmNHIKGcHRNSfhUzaC8ZKi
-RFRzRUY3R2MoVVZXGrLC0uLyZIN0k4Rlo7PD0+MpOGbzdSo5OkhJSlhZWmdoaWp2d3h5eoWGh4iJ
-ipSVlpeYmZqkpaanqKmqtLW2t7i5usTFxsfIycrU1dbX2Nna5OXm5+jp6vT19vf4+foRAAIBAwIE
-BAMFBAQEBgYFbQECAxEEIRIFMQYAIhNBUQcyYRRxCEKBI5EVUqFiFjMJsSTB0UNy8BfhgjQlklMY
-Y0TxorImNRlUNkVkJwpzg5NGdMLS4vJVZXVWN4SFo7PD0+PzKRqUpLTE1OT0laW1xdXl9ShHV2Y4
-doaWprbG1ub2Z3eHl6e3x9fn90hYaHiImKi4yNjo+DlJWWl5iZmpucnZ6fkqOkpaanqKmqq6ytrq
-+v/aAAwDAQACEQMRAD8As/8A+EtP/btzt3/xfbf/AP8AA+fHz2OPcD/kuRf80F/4/J0CeRv+SNN/
-z0H/AI5H1tO4X/gPF/wX2B/Xoarw6fPfut9e9+691737r3Xvfuvde9+691737r3Xvfuvde9+6917
-37r3Xvfuvde9+691737r3Xvfuvde9+691737r3Xvfuvde9+691737r3Xvfuvde9+691737r3Xvfu
-vde9+691737r3Xvfuvde9+691737r3Xvfuvde9+691737r3Xvfuvde9+691737r3Xvfuvde9+691
-737r3Xvfuvde9+691737r3Xvfuvde9+691737r3Xvfuvde9+691737r3Xvfuvde9+691737r3Xvf
-uvde9+691737r3Xvfuvde9+691737r3Xvfuvde9+691737r3Xvfuvde9+691737r3Xvfuvde9+69
-1737r3Xvfuvde9+691737r3Xvfuvde9+691737r3Xvfuvde9+691737r3Xvfuvde9+691737r3Xv
-fuvde9+691737r3Xvfuvde9+691737r3Xvfuvde9+691wk/Q3+t7917oNMz/AMXvDf8Aa4xf/uZD
-715fn1T8Q+3r5of/AHcT/wDmbn/5+73OP/Okf9QH/WHqGv8Ancf+o/8A6zdf/9k="));
-		break;
-
-		case "01_header01.jpg":
-			header("Content-type: image/jpeg");
-			echo trim(base64_decode("
-/9j/4AAQSkZJRgABAgEASABIAAD/4QhMRXhpZgAATU0AKgAAAAgABwESAAMAAAABAAEAAAEaAAUA
-AAABAAAAYgEbAAUAAAABAAAAagEoAAMAAAABAAIAAAExAAIAAAAcAAAAcgEyAAIAAAAUAAAAjodp
-AAQAAAABAAAApAAAANAACvyAAAAnEAAK/IAAACcQQWRvYmUgUGhvdG9zaG9wIENTMiBXaW5kb3dz
-ADIwMDU6MDY6MTYgMTc6Mzc6MzkAAAAAA6ABAAMAAAAB//8AAKACAAQAAAABAAACvKADAAQAAAAB
-AAAAlwAAAAAAAAAGAQMAAwAAAAEABgAAARoABQAAAAEAAAEeARsABQAAAAEAAAEmASgAAwAAAAEA
-AgAAAgEABAAAAAEAAAEuAgIABAAAAAEAAAcWAAAAAAAAAEgAAAABAAAASAAAAAH/2P/gABBKRklG
-AAECAABIAEgAAP/tAAxBZG9iZV9DTQAC/+4ADkFkb2JlAGSAAAAAAf/bAIQADAgICAkIDAkJDBEL
-CgsRFQ8MDA8VGBMTFRMTGBEMDAwMDAwRDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAENCwsN
-Dg0QDg4QFA4ODhQUDg4ODhQRDAwMDAwREQwMDAwMDBEMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwM
-DAwM/8AAEQgAIwCgAwEiAAIRAQMRAf/dAAQACv/EAT8AAAEFAQEBAQEBAAAAAAAAAAMAAQIEBQYH
-CAkKCwEAAQUBAQEBAQEAAAAAAAAAAQACAwQFBgcICQoLEAABBAEDAgQCBQcGCAUDDDMBAAIRAwQh
-EjEFQVFhEyJxgTIGFJGhsUIjJBVSwWIzNHKC0UMHJZJT8OHxY3M1FqKygyZEk1RkRcKjdDYX0lXi
-ZfKzhMPTdePzRieUpIW0lcTU5PSltcXV5fVWZnaGlqa2xtbm9jdHV2d3h5ent8fX5/cRAAICAQIE
-BAMEBQYHBwYFNQEAAhEDITESBEFRYXEiEwUygZEUobFCI8FS0fAzJGLhcoKSQ1MVY3M08SUGFqKy
-gwcmNcLSRJNUoxdkRVU2dGXi8rOEw9N14/NGlKSFtJXE1OT0pbXF1eX1VmZ2hpamtsbW5vYnN0dX
-Z3eHl6e3x//aAAwDAQACEQMRAD8A7boHQOhO6F05zunYrnOxaXOc6mskk1sc5znOYXOc5x3Oc5X/
-APm90H/ytxP+2K//ACCxOmdevxumYdDK63Nrx6WgkukxXXzAVn/nLlf6Gr/Od/5FQnm8QkQZHQkb
-SQKdL/m90H/ytxP+2K//ACCX/N7oP/lbif8AbFf/AJBZv/ObL/0NX+c7/wAioH605c6UVf5zv/Ip
-DmsR2kfskokB1f8Am90H/wArcT/tiv8A8gl/ze6D/wCVuJ/2xX/5BZQ+tGaeKKv853/kU/8AznzB
-zRV/nO/8il96xfvH7Cix/IOp/wA3ug/+VuJ/2xX/AOQS/wCb3Qf/ACtxP+2K/wDyCyv+dOZ2oqP9
-p3/kUv8AnRmd6Kh/ad/5FH7zj/eP2FHFH+QdX/m90H/ytxP+2K//ACCX/N7oP/lbif8AbFf/AJBZ
-X/OnL/0NX+c7/wAil/zpy/8AQVf5zv8AyKP3iHc/YVccf5B1f+b3Qf8AytxP+2K//IJf83ug/wDl
-bif9sV/+QWV/zpy/9BV/nO/8il/zpzP9BV/nO/8AIoHmcY/SP2FPFH+QdX/m90H/AMrcT/tiv/yC
-X/N7oP8A5W4n/bFf/kFlf86Mv/QVf5zv/Ipf86Mz/QVf5zv/ACKX3nH3P2FXFF1f+b3Qf/K3E/7Y
-r/8AIJf83ug/+VuJ/wBsV/8AkFlf86cz/QVf5zv/ACKX/OjM70Vf5zv/ACKB5rGP0j9klcUXV/5v
-dB/8rcT/ALYr/wDIJf8AN7oP/lbif9sV/wDkFlf86Mz/AEFX+c7/AMipj6zZZ/wNX+c7/wAigebx
-DeR+ySRRdL/m90H/AMrcT/tiv/yCodf6B0JvQuoub07Fa5uLcWltNYIIre5rmuazc1zXDc1zVD/n
-Ll9qav8AOd/5FV+p9dyMjpmZQ+qsNsx7mktJkTVZxISjzuEyAEjZIG0lGn//0L9FsY9DR2pq/wDP
-daJ6p7qgLXBlbewrqH/gdaXqErKyRPHPUfNL81tt19+nKgLZKpusM8pvU80YgALSdW+cgAQCo+uD
-3kqn6rRymOQe2gThEDog2W76x+SXrKj6x8UvWTqRTe9YJesFQ9bzT+sjSqb3rJesFRFpPCffHP3B
-NpVN31uw1S9Ydz8gqXqnjgeCXqeaVKpu+v4aJesqPqFSFpHJTZBNN31CSq+dnHDpZYdDZY2rcQXB
-m4Pe659dZbZb6ba/5qt7N/8ApFAZBQ8gsyKwxxLdrg5rhBhwBb9E/Sbte5qUfmjxj0WOKv3Uir3W
-yfrF0nGrY7GuvuvMgtsdv+0H+TjM2sw9v5lmP6NNbP6RXetK28WYtpHD6LDHxqeVztHTGU5dmQGs
-ZY8Bvq/Sgf8AAsd+f/Lu+h/wq0m2AVuYNGiqxoHkKrAFPmjhOTGcQF2OLhFR/R4Ukh//0Yu3e2N0
-bK+Nv+jr8VE7/wCX8ti8uSWXP+clt8x3R0fTjvn87/oqLt/8v/orzNJSQ+jG+l+/+V/0Uvf/ACv+
-ivNEk77FPpfv/lf9FL3/AMr/AKK80SR+xT6X7/5X/RUhv/lf9FeZJIFIfT/ft/P+WxQ9/wDL/wCi
-vM0kB9FPpnv/AJf/AEUhv8/ntXmaSR+iC+ne/wDlf9FL3/yv+ivMUk37FPp3v/lf9FL3/wAr/orz
-FJI7dFPpvv8A5X/RTt3SZ3Rss52x/N2eC8xSTsfzR23Cer//2f/tDnhQaG90b3Nob3AgMy4wADhC
-SU0EBAAAAAAABxwCAAACAAIAOEJJTQQlAAAAAAAQRgzyiSa4VtqwnAGhsKeQdzhCSU0D7QAAAAAA
-EABIAAAAAQACAEgAAAABAAI4QklNBCYAAAAAAA4AAAAAAAAAAAAAP4AAADhCSU0EDQAAAAAABAAA
-AHg4QklNBBkAAAAAAAQAAAAeOEJJTQPzAAAAAAAJAAAAAAAAAAABADhCSU0ECgAAAAAAAQAAOEJJ
-TScQAAAAAAAKAAEAAAAAAAAAAThCSU0D9QAAAAAASAAvZmYAAQBsZmYABgAAAAAAAQAvZmYAAQCh
-mZoABgAAAAAAAQAyAAAAAQBaAAAABgAAAAAAAQA1AAAAAQAtAAAABgAAAAAAAThCSU0D+AAAAAAA
-cAAA/////////////////////////////wPoAAAAAP////////////////////////////8D6AAA
-AAD/////////////////////////////A+gAAAAA/////////////////////////////wPoAAA4
-QklNBAAAAAAAAAIAAThCSU0EAgAAAAAABAAAAAA4QklNBDAAAAAAAAIBAThCSU0ELQAAAAAABgAB
-AAAABDhCSU0ECAAAAAAAEAAAAAEAAAJAAAACQAAAAAA4QklNBB4AAAAAAAQAAAAAOEJJTQQaAAAA
-AANLAAAABgAAAAAAAAAAAAAAlwAAArwAAAALADAAMQBfAGgAZQBhAGQAZQByADAAMQAAAAEAAAAA
-AAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAACvAAAAJcAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAA
-AAAAAAAAAAAAAAAQAAAAAQAAAAAAAG51bGwAAAACAAAABmJvdW5kc09iamMAAAABAAAAAAAAUmN0
-MQAAAAQAAAAAVG9wIGxvbmcAAAAAAAAAAExlZnRsb25nAAAAAAAAAABCdG9tbG9uZwAAAJcAAAAA
-UmdodGxvbmcAAAK8AAAABnNsaWNlc1ZsTHMAAAABT2JqYwAAAAEAAAAAAAVzbGljZQAAABIAAAAH
-c2xpY2VJRGxvbmcAAAAAAAAAB2dyb3VwSURsb25nAAAAAAAAAAZvcmlnaW5lbnVtAAAADEVTbGlj
-ZU9yaWdpbgAAAA1hdXRvR2VuZXJhdGVkAAAAAFR5cGVlbnVtAAAACkVTbGljZVR5cGUAAAAASW1n
-IAAAAAZib3VuZHNPYmpjAAAAAQAAAAAAAFJjdDEAAAAEAAAAAFRvcCBsb25nAAAAAAAAAABMZWZ0
-bG9uZwAAAAAAAAAAQnRvbWxvbmcAAACXAAAAAFJnaHRsb25nAAACvAAAAAN1cmxURVhUAAAAAQAA
-AAAAAG51bGxURVhUAAAAAQAAAAAAAE1zZ2VURVhUAAAAAQAAAAAABmFsdFRhZ1RFWFQAAAABAAAA
-AAAOY2VsbFRleHRJc0hUTUxib29sAQAAAAhjZWxsVGV4dFRFWFQAAAABAAAAAAAJaG9yekFsaWdu
-ZW51bQAAAA9FU2xpY2VIb3J6QWxpZ24AAAAHZGVmYXVsdAAAAAl2ZXJ0QWxpZ25lbnVtAAAAD0VT
-bGljZVZlcnRBbGlnbgAAAAdkZWZhdWx0AAAAC2JnQ29sb3JUeXBlZW51bQAAABFFU2xpY2VCR0Nv
-bG9yVHlwZQAAAABOb25lAAAACXRvcE91dHNldGxvbmcAAAAAAAAACmxlZnRPdXRzZXRsb25nAAAA
-AAAAAAxib3R0b21PdXRzZXRsb25nAAAAAAAAAAtyaWdodE91dHNldGxvbmcAAAAAADhCSU0EKAAA
-AAAADAAAAAE/8AAAAAAAADhCSU0EEQAAAAAAAQEAOEJJTQQUAAAAAAAEAAAABDhCSU0EDAAAAAAH
-MgAAAAEAAACgAAAAIwAAAeAAAEGgAAAHFgAYAAH/2P/gABBKRklGAAECAABIAEgAAP/tAAxBZG9i
-ZV9DTQAC/+4ADkFkb2JlAGSAAAAAAf/bAIQADAgICAkIDAkJDBELCgsRFQ8MDA8VGBMTFRMTGBEM
-DAwMDAwRDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAENCwsNDg0QDg4QFA4ODhQUDg4ODhQR
-DAwMDAwREQwMDAwMDBEMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwM/8AAEQgAIwCgAwEiAAIR
-AQMRAf/dAAQACv/EAT8AAAEFAQEBAQEBAAAAAAAAAAMAAQIEBQYHCAkKCwEAAQUBAQEBAQEAAAAA
-AAAAAQACAwQFBgcICQoLEAABBAEDAgQCBQcGCAUDDDMBAAIRAwQhEjEFQVFhEyJxgTIGFJGhsUIj
-JBVSwWIzNHKC0UMHJZJT8OHxY3M1FqKygyZEk1RkRcKjdDYX0lXiZfKzhMPTdePzRieUpIW0lcTU
-5PSltcXV5fVWZnaGlqa2xtbm9jdHV2d3h5ent8fX5/cRAAICAQIEBAMEBQYHBwYFNQEAAhEDITES
-BEFRYXEiEwUygZEUobFCI8FS0fAzJGLhcoKSQ1MVY3M08SUGFqKygwcmNcLSRJNUoxdkRVU2dGXi
-8rOEw9N14/NGlKSFtJXE1OT0pbXF1eX1VmZ2hpamtsbW5vYnN0dXZ3eHl6e3x//aAAwDAQACEQMR
-AD8A7boHQOhO6F05zunYrnOxaXOc6mskk1sc5znOYXOc5x3Oc5X/APm90H/ytxP+2K//ACCxOmde
-vxumYdDK63Nrx6WgkukxXXzAVn/nLlf6Gr/Od/5FQnm8QkQZHQkbSQKdL/m90H/ytxP+2K//ACCX
-/N7oP/lbif8AbFf/AJBZv/ObL/0NX+c7/wAioH605c6UVf5zv/IpDmsR2kfskokB1f8Am90H/wAr
-cT/tiv8A8gl/ze6D/wCVuJ/2xX/5BZQ+tGaeKKv853/kU/8AznzBzRV/nO/8il96xfvH7Cix/IOp
-/wA3ug/+VuJ/2xX/AOQS/wCb3Qf/ACtxP+2K/wDyCyv+dOZ2oqP9p3/kUv8AnRmd6Kh/ad/5FH7z
-j/eP2FHFH+QdX/m90H/ytxP+2K//ACCX/N7oP/lbif8AbFf/AJBZX/OnL/0NX+c7/wAil/zpy/8A
-QVf5zv8AyKP3iHc/YVccf5B1f+b3Qf8AytxP+2K//IJf83ug/wDlbif9sV/+QWV/zpy/9BV/nO/8
-il/zpzP9BV/nO/8AIoHmcY/SP2FPFH+QdX/m90H/AMrcT/tiv/yCX/N7oP8A5W4n/bFf/kFlf86M
-v/QVf5zv/Ipf86Mz/QVf5zv/ACKX3nH3P2FXFF1f+b3Qf/K3E/7Yr/8AIJf83ug/+VuJ/wBsV/8A
-kFlf86cz/QVf5zv/ACKX/OjM70Vf5zv/ACKB5rGP0j9klcUXV/5vdB/8rcT/ALYr/wDIJf8AN7oP
-/lbif9sV/wDkFlf86Mz/AEFX+c7/AMipj6zZZ/wNX+c7/wAigebxDeR+ySRRdL/m90H/AMrcT/ti
-v/yCodf6B0JvQuoub07Fa5uLcWltNYIIre5rmuazc1zXDc1zVD/nLl9qav8AOd/5FV+p9dyMjpmZ
-Q+qsNsx7mktJkTVZxISjzuEyAEjZIG0lGn//0L9FsY9DR2pq/wDPdaJ6p7qgLXBlbewrqH/gdaXq
-ErKyRPHPUfNL81tt19+nKgLZKpusM8pvU80YgALSdW+cgAQCo+uD3kqn6rRymOQe2gThEDog2W76
-x+SXrKj6x8UvWTqRTe9YJesFQ9bzT+sjSqb3rJesFRFpPCffHP3BNpVN31uw1S9Ydz8gqXqnjgeC
-XqeaVKpu+v4aJesqPqFSFpHJTZBNN31CSq+dnHDpZYdDZY2rcQXBm4Pe659dZbZb6ba/5qt7N/8A
-pFAZBQ8gsyKwxxLdrg5rhBhwBb9E/Sbte5qUfmjxj0WOKv3Uir3WyfrF0nGrY7GuvuvMgtsdv+0H
-+TjM2sw9v5lmP6NNbP6RXetK28WYtpHD6LDHxqeVztHTGU5dmQGsZY8Bvq/Sgf8AAsd+f/Lu+h/w
-q0m2AVuYNGiqxoHkKrAFPmjhOTGcQF2OLhFR/R4Ukh//0Yu3e2N0bK+Nv+jr8VE7/wCX8ti8uSWX
-P+clt8x3R0fTjvn87/oqLt/8v/orzNJSQ+jG+l+/+V/0Uvf/ACv+ivNEk77FPpfv/lf9FL3/AMr/
-AKK80SR+xT6X7/5X/RUhv/lf9FeZJIFIfT/ft/P+WxQ9/wDL/wCivM0kB9FPpnv/AJf/AEUhv8/n
-tXmaSR+iC+ne/wDlf9FL3/yv+ivMUk37FPp3v/lf9FL3/wAr/orzFJI7dFPpvv8A5X/RTt3SZ3Rs
-s52x/N2eC8xSTsfzR23Cer//2ThCSU0EIQAAAAAAVQAAAAEBAAAADwBBAGQAbwBiAGUAIABQAGgA
-bwB0AG8AcwBoAG8AcAAAABMAQQBkAG8AYgBlACAAUABoAG8AdABvAHMAaABvAHAAIABDAFMAMgAA
-AAEAOEJJTQ+gAAAAAAD4bWFuaUlSRlIAAADsOEJJTUFuRHMAAADMAAAAEAAAAAEAAAAAAABudWxs
-AAAAAwAAAABBRlN0bG9uZwAAAAAAAAAARnJJblZsTHMAAAABT2JqYwAAAAEAAAAAAABudWxsAAAA
-AQAAAABGcklEbG9uZ14Sb90AAAAARlN0c1ZsTHMAAAABT2JqYwAAAAEAAAAAAABudWxsAAAABAAA
-AABGc0lEbG9uZwAAAAAAAAAAQUZybWxvbmcAAAAAAAAAAEZzRnJWbExzAAAAAWxvbmdeEm/dAAAA
-AExDbnRsb25nAAAAAAAAOEJJTVJvbGwAAAAIAAAAAAAAAAA4QklND6EAAAAAABxtZnJpAAAAAgAA
-ABAAAAABAAAAAAAAAAEAAAAAOEJJTQQGAAAAAAAHAAIAAAABAQD/4TpqaHR0cDovL25zLmFkb2Jl
-LmNvbS94YXAvMS4wLwA8P3hwYWNrZXQgYmVnaW49Iu+7vyIgaWQ9Ilc1TTBNcENlaGlIenJlU3pO
-VGN6a2M5ZCI/Pgo8eDp4bXBtZXRhIHhtbG5zOng9ImFkb2JlOm5zOm1ldGEvIiB4OnhtcHRrPSIz
-LjEuMS0xMTEiPgogICA8cmRmOlJERiB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkv
-MDIvMjItcmRmLXN5bnRheC1ucyMiPgogICAgICA8cmRmOkRlc2NyaXB0aW9uIHJkZjphYm91dD0i
-IgogICAgICAgICAgICB4bWxuczp4YXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21t
-LyIKICAgICAgICAgICAgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9z
-VHlwZS9SZXNvdXJjZVJlZiMiPgogICAgICAgICA8eGFwTU06RG9jdW1lbnRJRD51dWlkOkM2M0I1
-Q0Q1ODRERUQ5MTFCRDI1RUZFMTZCQzU3QkMzPC94YXBNTTpEb2N1bWVudElEPgogICAgICAgICA8
-eGFwTU06SW5zdGFuY2VJRD51dWlkOkM3M0I1Q0Q1ODRERUQ5MTFCRDI1RUZFMTZCQzU3QkMzPC94
-YXBNTTpJbnN0YW5jZUlEPgogICAgICAgICA8eGFwTU06RGVyaXZlZEZyb20gcmRmOnBhcnNlVHlw
-ZT0iUmVzb3VyY2UiPgogICAgICAgICAgICA8c3RSZWY6aW5zdGFuY2VJRD51dWlkOkM0M0I1Q0Q1
-ODRERUQ5MTFCRDI1RUZFMTZCQzU3QkMzPC9zdFJlZjppbnN0YW5jZUlEPgogICAgICAgICAgICA8
-c3RSZWY6ZG9jdW1lbnRJRD51dWlkOkMzM0I1Q0Q1ODRERUQ5MTFCRDI1RUZFMTZCQzU3QkMzPC9z
-dFJlZjpkb2N1bWVudElEPgogICAgICAgICA8L3hhcE1NOkRlcml2ZWRGcm9tPgogICAgICA8L3Jk
-ZjpEZXNjcmlwdGlvbj4KICAgICAgPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIKICAgICAg
-ICAgICAgeG1sbnM6dGlmZj0iaHR0cDovL25zLmFkb2JlLmNvbS90aWZmLzEuMC8iPgogICAgICAg
-ICA8dGlmZjpPcmllbnRhdGlvbj4xPC90aWZmOk9yaWVudGF0aW9uPgogICAgICAgICA8dGlmZjpY
-UmVzb2x1dGlvbj43MjAwMDAvMTAwMDA8L3RpZmY6WFJlc29sdXRpb24+CiAgICAgICAgIDx0aWZm
-OllSZXNvbHV0aW9uPjcyMDAwMC8xMDAwMDwvdGlmZjpZUmVzb2x1dGlvbj4KICAgICAgICAgPHRp
-ZmY6UmVzb2x1dGlvblVuaXQ+MjwvdGlmZjpSZXNvbHV0aW9uVW5pdD4KICAgICAgICAgPHRpZmY6
-TmF0aXZlRGlnZXN0PjI1NiwyNTcsMjU4LDI1OSwyNjIsMjc0LDI3NywyODQsNTMwLDUzMSwyODIs
-MjgzLDI5NiwzMDEsMzE4LDMxOSw1MjksNTMyLDMwNiwyNzAsMjcxLDI3MiwzMDUsMzE1LDMzNDMy
-Ozk4M0M1QkM5MkRENEI4NzZEMjQyOTczQzUyQTEzOUJGPC90aWZmOk5hdGl2ZURpZ2VzdD4KICAg
-ICAgPC9yZGY6RGVzY3JpcHRpb24+CiAgICAgIDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIi
-CiAgICAgICAgICAgIHhtbG5zOnhhcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyI+CiAg
-ICAgICAgIDx4YXA6TW9kaWZ5RGF0ZT4yMDA1LTA2LTE2VDE3OjM3OjM5KzAxOjAwPC94YXA6TW9k
-aWZ5RGF0ZT4KICAgICAgICAgPHhhcDpDcmVhdG9yVG9vbD5BZG9iZSBQaG90b3Nob3AgQ1MyIFdp
-bmRvd3M8L3hhcDpDcmVhdG9yVG9vbD4KICAgICAgICAgPHhhcDpDcmVhdGVEYXRlPjIwMDUtMDYt
-MTZUMTc6Mzc6MzkrMDE6MDA8L3hhcDpDcmVhdGVEYXRlPgogICAgICAgICA8eGFwOk1ldGFkYXRh
-RGF0ZT4yMDA1LTA2LTE2VDE3OjM3OjM5KzAxOjAwPC94YXA6TWV0YWRhdGFEYXRlPgogICAgICA8
-L3JkZjpEZXNjcmlwdGlvbj4KICAgICAgPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIKICAg
-ICAgICAgICAgeG1sbnM6ZXhpZj0iaHR0cDovL25zLmFkb2JlLmNvbS9leGlmLzEuMC8iPgogICAg
-ICAgICA8ZXhpZjpDb2xvclNwYWNlPi0xPC9leGlmOkNvbG9yU3BhY2U+CiAgICAgICAgIDxleGlm
-OlBpeGVsWERpbWVuc2lvbj43MDA8L2V4aWY6UGl4ZWxYRGltZW5zaW9uPgogICAgICAgICA8ZXhp
-ZjpQaXhlbFlEaW1lbnNpb24+MTUxPC9leGlmOlBpeGVsWURpbWVuc2lvbj4KICAgICAgICAgPGV4
-aWY6TmF0aXZlRGlnZXN0PjM2ODY0LDQwOTYwLDQwOTYxLDM3MTIxLDM3MTIyLDQwOTYyLDQwOTYz
-LDM3NTEwLDQwOTY0LDM2ODY3LDM2ODY4LDMzNDM0LDMzNDM3LDM0ODUwLDM0ODUyLDM0ODU1LDM0
-ODU2LDM3Mzc3LDM3Mzc4LDM3Mzc5LDM3MzgwLDM3MzgxLDM3MzgyLDM3MzgzLDM3Mzg0LDM3Mzg1
-LDM3Mzg2LDM3Mzk2LDQxNDgzLDQxNDg0LDQxNDg2LDQxNDg3LDQxNDg4LDQxNDkyLDQxNDkzLDQx
-NDk1LDQxNzI4LDQxNzI5LDQxNzMwLDQxOTg1LDQxOTg2LDQxOTg3LDQxOTg4LDQxOTg5LDQxOTkw
-LDQxOTkxLDQxOTkyLDQxOTkzLDQxOTk0LDQxOTk1LDQxOTk2LDQyMDE2LDAsMiw0LDUsNiw3LDgs
-OSwxMCwxMSwxMiwxMywxNCwxNSwxNiwxNywxOCwyMCwyMiwyMywyNCwyNSwyNiwyNywyOCwzMDs1
-N0U1QjRCMDVFNjY5RjYzNjY4NTJCNjgxNzMyRTY3NzwvZXhpZjpOYXRpdmVEaWdlc3Q+CiAgICAg
-IDwvcmRmOkRlc2NyaXB0aW9uPgogICAgICA8cmRmOkRlc2NyaXB0aW9uIHJkZjphYm91dD0iIgog
-ICAgICAgICAgICB4bWxuczpkYz0iaHR0cDovL3B1cmwub3JnL2RjL2VsZW1lbnRzLzEuMS8iPgog
-ICAgICAgICA8ZGM6Zm9ybWF0PmltYWdlL2pwZWc8L2RjOmZvcm1hdD4KICAgICAgPC9yZGY6RGVz
-Y3JpcHRpb24+CiAgICAgIDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiCiAgICAgICAgICAg
-IHhtbG5zOnBob3Rvc2hvcD0iaHR0cDovL25zLmFkb2JlLmNvbS9waG90b3Nob3AvMS4wLyI+CiAg
-ICAgICAgIDxwaG90b3Nob3A6Q29sb3JNb2RlPjM8L3Bob3Rvc2hvcDpDb2xvck1vZGU+CiAgICAg
-ICAgIDxwaG90b3Nob3A6SGlzdG9yeS8+CiAgICAgIDwvcmRmOkRlc2NyaXB0aW9uPgogICA8L3Jk
-ZjpSREY+CjwveDp4bXBtZXRhPgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAog
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAK
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-IAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAog
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAK
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-IAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
-ICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgIAo8P3hwYWNrZXQgZW5kPSJ3
-Ij8+/+4ADkFkb2JlAGSAAAAAAf/bAIQACAYGBgYGCAYGCAwIBwgMDgoICAoOEA0NDg0NEBEMDAwM
-DAwRDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAEJCAgJCgkLCQkLDgsNCw4RDg4ODhERDAwM
-DAwREQwMDAwMDBEMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwM/8AAEQgAlwK8AwEiAAIRAQMR
-Af/dAAQALP/EAaIAAAAHAQEBAQEAAAAAAAAAAAQFAwIGAQAHCAkKCwEAAgIDAQEBAQEAAAAAAAAA
-AQACAwQFBgcICQoLEAACAQMDAgQCBgcDBAIGAnMBAgMRBAAFIRIxQVEGE2EicYEUMpGhBxWxQiPB
-UtHhMxZi8CRygvElQzRTkqKyY3PCNUQnk6OzNhdUZHTD0uIIJoMJChgZhJRFRqS0VtNVKBry4/PE
-1OT0ZXWFlaW1xdXl9WZ2hpamtsbW5vY3R1dnd4eXp7fH1+f3OEhYaHiImKi4yNjo+Ck5SVlpeYmZ
-qbnJ2en5KjpKWmp6ipqqusra6voRAAICAQIDBQUEBQYECAMDbQEAAhEDBCESMUEFURNhIgZxgZEy
-obHwFMHR4SNCFVJicvEzJDRDghaSUyWiY7LCB3PSNeJEgxdUkwgJChgZJjZFGidkdFU38qOzwygp
-0+PzhJSktMTU5PRldYWVpbXF1eX1RlZmdoaWprbG1ub2R1dnd4eXp7fH1+f3OEhYaHiImKi4yNjo
-+DlJWWl5iZmpucnZ6fkqOkpaanqKmqq6ytrq+v/aAAwDAQACEQMRAD8AhnkbyNe+dr2aKKYWljaB
-WvLxl58edeCIlV5u/Fv2s6sv5G+TSADe6oxHVhJbgE+IBt835GqP8G3pGxbVJAx7kC3tyAc6rHGK
-ZbkyS4iAapqxwjwgkXbyz/lRfkz/AJbNV/5G23/ZPm/5UX5M/wCWzVf+Rtt/2T51f0x4ZvTHhkPE
-n3lnwR7g8o/5UX5M/wCWzVf+Rtt/2T5v+VF+TP8Als1X/kbbf9k+dX9MeGb0x4Y+JPvK8Ee4PKP+
-VF+TP+WzVf8Akbbf9k+b/lRfkz/ls1X/AJG23/ZPnV/THhm9MeGPiT7yvBHuDyj/AJUX5M/5bNV/
-5G23/ZPm/wCVF+TP+WzVf+Rtt/2T51f0x4ZvTHhj4k+8rwR7g8o/5UX5M/5bNV/5G23/AGT5v+VF
-+TP+WzVf+Rtt/wBk+dX9MeGb0x4Y+JPvK8Ee4PKP+VF+TP8Als1X/kbbf9k+b/lRfkz/AJbNV/5G
-23/ZPnV/THhm9MeGPiT7yvBHuDyj/lRfkz/ls1X/AJG23/ZPm/5UX5M/5bNV/wCRtt/2T51f0x4Z
-vTHhj4k+8rwR7g8o/wCVF+TP+WzVf+Rtt/2T5v8AlRfkz/ls1X/kbbf9k+dX9MeGb0x4Y+JPvK8E
-e4PKP+VF+TP+WzVf+Rtt/wBk+b/lRfkz/ls1X/kbbf8AZPnV/THhm9MeGPiT7yvBHuDyj/lRfkz/
-AJbNV/5G23/ZPm/5UX5M/wCWzVf+Rtt/2T51f0x4ZvTHhj4k+8rwR7g8o/5UX5M/5bNV/wCRtt/2
-T5v+VF+TP+WzVf8Akbbf9k+dX9MeGb0x4Y+JPvK8Ee4PKP8AlRfkz/ls1X/kbbf9k+b/AJUX5M/5
-bNV/5G23/ZPnV/THhm9MeGPiT7yvBHuDyj/lRfkz/ls1X/kbbf8AZPm/5UX5M/5bNV/5G23/AGT5
-1f0x4ZvTHhj4k+8rwR7g8o/5UX5M/wCWzVf+Rtt/2T5v+VF+TP8Als1X/kbbf9k+dX9MeGb0x4Y+
-JPvK8Ee4PKP+VF+TP+WzVf8Akbbf9k+b/lRfkz/ls1X/AJG23/ZPnV/THhm9MeGPiT7yvBHuDyj/
-AJUX5M/5bNV/5G23/ZPm/wCVF+TP+WzVf+Rtt/2T51f0x4ZvTHhj4k+8rwR7g8o/5UX5M/5bNV/5
-G23/AGT5v+VF+TP+WzVf+Rtt/wBk+dX9MeGb0x4Y+JPvK8Ee4PKP+VF+TP8Als1X/kbbf9k+b/lR
-fkz/AJbNV/5G23/ZPnV/THhm9MeGPiT7yvBHuDyj/lRfkz/ls1X/AJG23/ZPm/5UX5M/5bNV/wCR
-tt/2T51f0x4ZvTHhj4k+8rwR7g8o/wCVF+TP+WzVf+Rtt/2T5v8AlRfkz/ls1X/kbbf9k+dX9MeG
-b0x4Y+JPvK8Ee4PKP+VF+TP+WzVf+Rtt/wBk+b/lRfkz/ls1X/kbbf8AZPnV/THhm9MeGPiT7yvB
-HuDyj/lRfkz/AJbNV/5G23/ZPm/5UX5M/wCWzVf+Rtt/2T51f0x4ZvTHhj4k+8rwR7g8o/5UX5M/
-5bNV/wCRtt/2T5v+VF+TP+WzVf8Akbbf9k+dX9MeGb0x4Y+JPvK8Ee4PKP8AlRfkz/ls1X/kbbf9
-k+b/AJUX5M/5bNV/5G23/ZPnV/THhm9MeGPiT7yvBHuDyj/lRfkz/ls1X/kbbf8AZPm/5UX5M/5b
-NV/5G23/AGT51f0x4ZvTHhj4k+8rwR7g8o/5UX5M/wCWzVf+Rtt/2T5v+VF+TP8Als1X/kbbf9k+
-dX9MeGb0x4Y+JPvK8Ee4PKP+VF+TP+WzVf8Akbbf9k+b/lRfkz/ls1X/AJG23/ZPnV/THhm9MeGP
-iT7yvBHuDyj/AJUX5M/5bNV/5G23/ZPm/wCVF+TP+WzVf+Rtt/2T51f0x4ZvTHhj4k+8rwR7g8o/
-5UX5M/5bNV/5G23/AGT5v+VF+TP+WzVf+Rtt/wBk+dX9MeGb0x4Y+JPvK8Ee4PKP+VF+TP8Als1X
-/kbbf9k+b/lRfkz/AJbNV/5G23/ZPnV/THhm9MeGPiT7yvBHuDyj/lRfkz/ls1X/AJG23/ZPm/5U
-X5M/5bNV/wCRtt/2T51f0x4ZvTHhj4k+8rwR7g8o/wCVF+TP+WzVf+Rtt/2T5v8AlRfkz/ls1X/k
-bbf9k+dX9MeGb0x4Y+JPvK8Ee4PKP+VF+TP+WzVf+Rtt/wBk+b/lRfkz/ls1X/kbbf8AZPnV/THh
-m9MeGPiT7yvBHuDyj/lRfkz/AJbNV/5G23/ZPm/5UX5M/wCWzVf+Rtt/2T51f0x4ZvTHhj4k+8rw
-R7g8o/5UX5M/5bNV/wCRtt/2T5v+VF+TP+WzVf8Akbbf9k+dX9MeGb0x4Y+JPvK8Ee4PKP8AlRfk
-z/ls1X/kbbf9k+b/AJUX5M/5bNV/5G23/ZPnV/THhm9MeGPiT7yvBHuDyj/lRfkz/ls1X/kbbf8A
-ZPm/5UX5M/5bNV/5G23/AGT51f0x4ZvTHhj4k+8rwR7g8o/5UX5M/wCWzVf+Rtt/2T5v+VF+TP8A
-ls1X/kbbf9k+dX9MeGb0x4Y+JPvK8Ee4PKP+VF+TP+WzVf8Akbbf9k+b/lRfkz/ls1X/AJG23/ZP
-nV/THhm9MeGPiT7yvBHuDyj/AJUX5M/5bNV/5G23/ZPm/wCVF+TP+WzVf+Rtt/2T51f0x4ZvTHhj
-4k+8rwR7g8o/5UX5M/5bNV/5G23/AGT5v+VF+TP+WzVf+Rtt/wBk+dX9MeGb0x4Y+JPvK8Ee4PKP
-+VF+TP8Als1X/kbbf9k+V/yozyZ/y2ar/wAjbf8A7J86x6Y8MoximPiT7yvBHuDxHzB+R1mtk8/l
-a+uJLyJS31O99NvVpvxjliWERt/rK/L/ACM4rRq8aHlWnGm9fCme0GTjKhG3xD8TnmLgn/K3fT4j
-h/iXjwptT6/SlMmMkuGW/Kt2BhHijtzvZ//Qkv5Gf8oZef8AbVl/6h7fOrx9BnKPyM/5Qy8/7asv
-/UPb51ePoMnk+uXvY4/oHuX5s2bIMnZs2bFXZs2bFXZs2bFXZs2bFXZs2bFXZs2bFXZs2bFXZs2b
-FXZs2bFXZs2bFXZs2bFXZs2bFXZs2bFXZs2bFXZs2bFXZs2bFXZs2bFXZs2bFXZs2bFXZs2bFXZs
-2bFXZs2bFXZs2bFXZs2bFXZs2bFXZs2bFXZs2bFXZs2bFXZs2bFXZs2bFXZs2bFXZs2bFXZs2bFX
-Zs2bFXZs2bFXZs2bFXZs2bFXZs2bFXZs2bFXZs2bFXZj0zZj0xVCyf3qf6w/XnmL/wArB/4M3/Y/
-np2T+9T/AFh+vPMX/lYP/Bm/7H8nH6Ze4fewl9Ufefuf/9GS/kb/AMobef8AbVl/6h7fOrx9BnKP
-yN/5Q28/7asv/UPb51ePoMlk+uXvYw+ke5fmzZsiydmzZsVdmzZsVdmzZsVdmzZsVdmzZsVdmzZs
-VdmzZsVdmzZsVdmzZsVdmzZsVdmzZsVdmzZsVdmzZsVdmzZsVdmzZsVdmzZsVdmzZsVdmzZsVdmz
-ZsVdmzZsVdmzZsVdmzZsVdmzZsVdmzZsVdmzZsVdmzZsVdmzZsVdmzZsVdmzZsVdmzZsVdmzZsVd
-mzZsVdmzZsVdmzZsVdmzZsVdmzZsVdmzZsVdmzZsVdmzZsVdmzZsVdmPTNmPTFULJ/ep/rD9eeYv
-/Kv/APgzf9j+enZP71P9YfrzzH/5V/8A8Gb/ALH8nH6Z+4fewl9Ufefuf//SMPyuu7qy/L28mtJP
-SlOsuvKitsbeCuzBhksXXdfoKXtP+ecX/NGQz8uSB+XV0O7a0wH0WsLfqGSVWAUVzU9q5csdSRCc
-4ihsCQGED6I+5H/p7zD/AMtx/wCRcP8A1Tzfp7zD/wAt3/JOH/mjABkGN9TwzBGfU/6rP/TFNpj+
-nfMP/Ld/yTh/6p5X6f8AMA/4/wD/AJJRf80YXczm5ZIZ8/8Aqs/9MVtMD5g8wf8ALcf+RcX/ADRl
-f4g8w/8ALb/yTi/5owByzcsP5jN/qk/9MVtH/wCIPMP/AC2/8k4v+aM3+IPMP/Lb/wAk4v8AmjAH
-LNyw/mM3+qT/ANMVso//ABB5h/5bf+ScX/NGb/EHmH/lt/5Jxf8ANGF/PL5Y/mM/+qS/0xW0f/iD
-zD/y2/8AJOL/AJozHzB5h/5bf+ScX/NGF5bGlqe+EZ83+qz/ANMUElHt5j8xA7Xu3/GOL/mjGnzJ
-5j/5bv8AknF/zRhazb7Zq5cM2T+fL/TFrMpd6Y/4k8x/8t3/ACTi/wCaMv8AxJ5j/wCW7/knD/zR
-hbyzcsPj5f58vmUcUu8pl/iTzH/y3f8AJKL/AKp5v8SeY/8Alu/5Jxf9U8LeW2X16YPHy/z5fMrc
-u8pj/iPzH/y3f8k4v+qeX/iPzHSv17/knF/1Twuocep+nIHU5BynL5lkOLvKNHmTzGf+P3/klF/z
-Rm/xH5j/AOW7/klF/wBU8BUFa5hsdhj+Zy/z5fMpqXeUd/iLzJ2vv+SUX/VPMfMXmMf8f3/JKL/m
-jAJIrTNyWuI1OX+fL5ld+8/NG/4j8x/8t3/JKL/qnm/xH5j/AOW7/klF/wBU8AFhTYdMZzrkxny/
-zpfMsSZd5TL/ABH5j/5bv+SUX/VPN/iPzH/y3f8AJKL/AJowt5ZXMfPD4+X+fL5ljxS7ymf+JPMf
-/Ld/ySi/5ozf4k8xf8t3/JOL/mjC34z7Y4IO+5x8fJ/Pl80ccu8o/wDxL5j7XxP/ADyi/wCaMseY
-vMp631P+eUX/AFTwCKDpmx8fL/Pl8yjjl3lMP8ReY/8Alv8A+SUP/VPN/iHzJ/y3/wDJKH/qnhfy
-AyvUHYY+Nm/ny+ZXin3lMf8AEPmP/lv/AOSUP/VPN/iHzF3v/wDklD/1TwtMhOVywjJl/wBUl8yn
-il3n5pkfMfmL/lu/5JQ/9U8r/EfmP/lu/wCSUX/NGF1c1aZMZMn8+XzK8cu8/NMf8R+Y/wDlu/5J
-xf8AVPN/iTzH/wAt3/JOL/qnhbyzcsPiZP50vmV45d5TL/EnmP8A5bv+ScX/AFTzf4k8x/8ALd/y
-Ti/6p4W8s3LB4uT+fL5rxS7ymX+I/Mf/AC3f8kov+aMx8yeYh/x/f8kov+aMLeWWCo7VPicHi5f5
-8vmV45d5TJfMXmU7/XqD/jFD/wBU8v8AxF5jHW//AOSUP/VPCwuTlVweLk/ny+ZXil3lMv8AEfmL
-/luP/IqH/qnm/wAR+Y/+W7/klF/zRhdyyuWROeY/jl8ykSl3lMv8SeY/+W7/AJJRf80ZX+JPMf8A
-y3f8k4v+qeF1cuuR/MZek5fMpuXeUxHmPzH/AMt3/JOL/qnl/wCI/Mfe+/5Jxf8ANGFtc1cRnzH+
-OXzK8Uu8pl/iPzH/AMt3/JOL/mjN/iPzF/y3f8kov+aMLeWblkvGy/z5fMo4pd5TL/EfmP8A5bv+
-ScX/ADRm/wAR+Y/+W7/knF/zRhbyzcsPi5f58vmV4pd5TL/EfmP/AJbv+ScX/NGb/EfmP/lu/wCS
-cX/NGFvLNyx8bL/Pl8yvFLvKY/4k8x9r7/knF/zRmHmTzH/y3f8AJOL/AKp4Xcs1cHi5f58vmU8R
-7ymP+JPMf/Ld/wAk4v8AmjMfMnmL/lu/5JRf80YXVrmr7YDly/6pL5leM95TH/EnmP8A5bf+ScX/
-ADRm/wASeY/+W7/knF/1TwtLAZviboKD3yEs+Uf5SX+mKeM95TL/ABJ5j/5bv+ScX/NGV/iXzH2v
-Sf8AnlF/zRgARgbnc5ZKjIfmM/Scv9MV4z3lHjzF5lPW+p/zyi/6p44+YvMY63//ACSh/wCqeFvq
-HttlVxGbPe+Sf+mK3LvKY/4k8x/8t3/JKH/qnm/xJ5i/5bj/AMiov+qeFtcvc5Z4+X/VJf6Yrcu8
-pj/iTzH/AMt3/JOL/qnm/wAR+Y/+W7/klF/1TwBscsHscTqcvScvmUji7yjx5i8yf8tv/JOL/mjF
-P8QeYu99t/xji/5owvDDLBGUy1OfpkkP84tg96Yfp/zDX/e7b/jHF/zRl/p/zB/y2/8AJOL/AJow
-vrmrlX5rUf6rP/TFkmH6f8wf8tv/ACTi/wCaM36f8wf8tv8AyTi/5owvrmrj+Zz/AOqz/wBMVTD9
-P+YP+W3/AJJxf80Zv8QeYP8Alt/5Jxf80YX1yuVdhucH5rP/AKrP/TFUefMHmEf8fv8AyTi/5oyx
-r/mJv+P3b/jHF/zRgEL3brjq4fzec8sk/wDTFCO/T3mH/lu/5JRf80Zv075h/wCW4/8AIuH/AKp4
-Brmrj+a1H+qz/wBMUJlY6zrUuqWUNxdepFJKquvCMVBPiqA5xf8A8q//AODN/wBj+db04/7mNP8A
-+M6frzkn/lX/APwZf+x/Nhhy5T2fqJmcjIGNGzY9UerGR3j7z9z/AP/TW/Lw0/Lyb/ttyf8AUFHh
-+G2GR/8AL/b8u5v+23J/1Bx4eK2wzVdq/wCM/wCaP0tcPpj7lXkM3LE+Qzcs19MlTlm5YnyzcsaV
-U5ZuWJ8s3LGlVOWblifLNywqqcs3LE+WUWxpVzPTGNICNsTLeOVXLYxDUSv5ZqjE65dclbFfyy69
-sT5ZYJ+eAlICquPAodsYG9svllRkS2CIVKjNyGJ8hjTIMFFkrcsrn9+IGUeNMazknYfwyQh3sTIK
-xl7d8Yzj5YnRjuWAy6J33ywRrkGsytv1PDfHDke1MbyUdBm9Q5IRLEkrwg774+qjbbEC5OblhEEU
-r818coyDsMR5ZVclwhaVvUPyyi2JcsuuGlX1GaoxlcrliqpUZuWMqc1ThCaX1zcsZmrhtFL+WVyx
-lc1cbVU5ZuWJ1zcsiSmlTlmrifLNyyNrSpyGblifLNywFVSozVGJ1zVyFMlXkM3IYlXNywgIVSwz
-chiXLNyyQCFXkM3IYlyzcsKqvLNyGJVy+WKqnLNyxLlm5Yqq8s3LES/0nLAY9TQYCQFXlx/YMscm
-9hlAKvTLLgdN8iSTyQqKoG/68xcDpiBcnNyrkOHfdkArGQnKrvviZbbbbxyg+Gk0q1HhmDDEueVy
-xpVYv3yuY7dcS5Zq4eELasJNsrmOmJVzVxoLat6lPc44S0wPXNXBKAKRIoj1QSfwxwl364F5ZXOh
-yo4wy4yjfUqNs3LxwKjE+2E2p+Zkt7tdI0aA6trUnwpZwbhD/NO/2Y1X9r/jXIRw5Jy4MceIlmJ2
-yRQW67DFBRRtkXu08+eVUj1DzDDFqenTAPcGxWj2hP7JWi+pGv8Avz4v+MmHGn6pZapbi5sZlmjP
-h1Hsy9VOHPos+EjxAKPUbxZE0j+WbliXKuauViDC1WuauJVzVyQACLRemn/czp//ABnT9ecn/wDK
-v/8Agy/9j+dV0w/7mtO/4zp+vOV/+Ve/8GX/ALH82OH/AIztT/Wj/uoIP8PvP3P/1H+Qdvy6n/7b
-cn/UHHhwrbDCbyJt+XE//bcf/qDjw0DbDNZ2p/jJ9w/S1w+iPuVuWbliXLNyzAZKvLNyxHnljkeg
-yJICq3LK5Yzie5pm+Ae+DiHRNL+den4ZdT3xPn4bZXLHiWlWuMJI743njGfJRsnkiVALiT3yq4ly
-yuRy4RPUtRVuWavviXI98wO+HhQr9KY8HEg22+XypkCCWYpV5ZuWIlvDGl9vbEQSZK7PjC2JFvfG
-8snGADAyKtXNyOJcs3LJ0xVa++bliPLNywgIVuWbliPPNzwqrcs3LEeeVz98VV+Wbl74hyJ7ZfxH
-rQY2FVuWVzxPYd65sFrSpyxwrscSBy+YG2RJPRkB3qtTm54iXp0yuZwgFSVbllcsS5ZuWSpiq8s3
-LEeWblgKq3LNyxLlm5YKSq8s3LEuWVyxVW5Zq4lyzcsgVVa5uWJcsrliAqtyzcsR5ZfLJUqryzcs
-S5ZuWFCryzcsR5ZueKVblm5YhzJ6b5YBP2j9GAkIVedem+WATux+jGggdMxkAyO5VVFB0GYuBgcy
-E5uWERWlYuTlcsS5ZuWGkqtc1cS5ZuWRKVXl75q4lyzcsCqtc1cS5Zq4qq1zcsS5ZuWSCFWubliQ
-bKrh2VV5ZuXviY5N0298cFA365EkKuBLe2JXd5Z6dbvd3sywwRiryOaAf1P+TivLOd69Ol35xe21
-RGutPsoo3itOVI+bBSXZOjn4v2slp8Jz5eC6HM+5MY8RpPILrXvO0noaMH0rRSaSalIKTzL3+rp+
-yp/n/wCG/YzonlnQdE8q23o6ZAFkenrXDfFLIR3kkO7f8Q/ycjmn+YdOe2H1ZljRAAU6Up2ply+Z
-O0P/AATf0ze4tPDFHhxiu89S3gAbB6A+oJIpWShU9Qc5/rXleziuW1Ty3cLYXpJMkKH9zJ3oyDZf
-9j/wOBJNZll+3KT7V2+7E/0n/lZYcYIIkLB5g8kq1jrxMostViNpeDbf7D+6N74dBwe+c813zTYS
-j6jDGt7c148wfhiNdzzHVv8AIXJF5bu5prORJW5ei/BSetKVzS67QwxDxMRoXRj3X3FhIVuyHllh
-sQD5fLNbVMUdpRrrenf8Z0/XnL//ACr3/gy/9j+dM0hq67pv/GdP15zP/wAq9/4Mv/Y/mfh/4z9T
-/Wj/ALqKn+H3n7n/1b8jmn5bz/8Abcf/AKg48MFLECgwB5G/8lndnw1s0/6RoRhgrbDNT2tKQ1JA
-HQMMf0R9y4Kx6mmWEXvvjDIBjTKTmu4Znmz2V6quUZPDA/PK5ZIYiiwr8z45XLEeXvlVyYxravyy
-uWI1y+WSEEWqF8Yz9uvvjC2M5ZZGIYSKpXNXEuWblllMFXllhsR5ZfPbEqiA1O+Vz7jpiHP3yufv
-ka702rF65XLEuROb4j2w7MVXlm5YnRvGmXTxONhV3LNz98oKPnjqAdseMK1yr75Y5HtT55uXhmLE
-4OMq2Q3jlhfE4wuBjTJj6j1VVCjL5KMQLk5XLDw960rmQ9srnU74jyzcsNJVuWbniPLNyxpVbnlc
-sS5ZuWEBCryzcsS5ZuWSVV5ZuWJcs3LAtKvLNyxLlm5ZFVXlm5YlyzcsU0q8s3I4lyzcsBWlXlm5
-YlyzcsFWqryzcsRqc1cNLStyzcsSrlchiqtzyueJAk9B9OOCjvvgJQu5FugrjgpP2jlA5RemDcqq
-9M3MDEC5yuWERVWMhOVXEuWblkqSq8s3LEuWblihV5ZuWJcs3LAUqvLNyxOublkUqoIrvl96Ylzr
-juXvkTaQAv28cvvtifOvTtjuYyJkQyEQvG25yq++UKn2GOAAyHifFPC4KxPgMeFCjxOVyyq48RKK
-Cpt0yiKjfrjK5fLGyig7fIBqUXqeb9QNP90Rf8RTJ/XIfNEJPNl+fGCOn3Jmd2Yb1P8AmH7wyhGi
-lEkcsD+pESjDuO/zxyao/wBmX4W8exw0ubXrthNdWvXbN6bHJmqzavFbxmWaQIg6k/w8cjt3r1/q
-zG3tuVvanYkH43H+Uf2V/wAlcBX9pLPqJjYkxoF4g9BUZINJ0jdfhyu5SNcla0nSQOJ49N8nPlo8
-YbkH/fv/ABqM2n6WEiZ2AAVSSTsBtjPL5pHc/wDGX/jUZi9oRAwAf0gwyfT8WQcwOhx4auBOWPVx
-mkmNmuPNM9GNde0z/jOn685z/wCVe/8ABl/7H86FojV1/TP+YhP15z3/AMq9/wCDL/2P5lYT/rfq
-f60f91FnIbx95+5//9avJZp+Ws5/7Xj/APUHHgkOaDfAnk7b8s7j/tuP/wBQceKhthmv7SAOpPuD
-VD6Y+5V5ZuWJcjm5HMOmSryzcsS5ZuRxpCryzcsS55uRxVV5ZuWJ/Ee2XxbxwWFbLHEy2WVA6muV
-sOmTiWEi7lXL+LwzVpm5e+EyQ2Ae5pl08TjeWblkTJV9FHbLqPDE65uWCyVVOWblidcwJw0hUrjg
-ab98TBA3JzGUD3wbnkyEVUttjS9O+INITjeWSEO9BVzJ4Y0uTiXLNyydBVTlmrifLNywqqVzVxPl
-m5YqqVzVxPlm5YqqVzVxPlm5Yqqcs3LEq5q4VVeWbliVc1cKFXlmriVcvlgKVSuauJ8s3LAqpXNX
-E+WbljSqlc1cT5ZuWAgpVK5q4nyOUWwiKFXllcsTFT02x4AHXc4EWuBJ6fjjgAOu5xtcrmBgolVW
-ub1AMQLk5VcRAdU0qmQnK5Yz5ZvbJbJpfXNXGjNjstLq5q43NXBaaXVzVxhJ65VThRSpyzcsT5Zu
-RyJVU5ZuWJcvfLBPbIqqcswemMC+JxwoOmRMlXgufYY8NQUHXxxLlm5ZAi+i2Vb1DjvUrgctm5Y8
-IXiKJ55fLA3OnzyxIfHHgTxIjlm5YH5nN6h8ceAp4giA2FWr6NHqDLdQsYb2Mfu5V2rTscGiQ+Ob
-1DvvjDjxzE4HhI6p4wx9LqaNvq2ppwlGwmp8Le5xlzbVFRuD0OHtxDFdR+nMvIePcH2wnltLixqU
-Pq2/h3GbrTa+OQCGWoy7/wCE/qZCYKRppvq3rPx60yTW8Ntp8QluSFFKhe5wvN9DbAeipe4k+woF
-T9AxaDS57thPqjVB3FuDUf7M/tZkZtRjwjc2TyA5pMgObct7f60fRsx6NoDvJ+z9Ff7xvf7OG1la
-RWUIhiqd6szGpJPUnHIFjUIgCqNgBl8s0+fUZMx9WwHIDk1SkSq1y1eh9sR5ZfLMcjZiE20B6+Yd
-M/5iE/XkD/8AKvf+DL/2P5NfL7U8xaWT0+sxj7zT+OQv/wAq7/4Mv/Y/mXhj/gOoHnH/AHUWRP0+
-8/c//9dvk7/yV95/22z/ANQ0OPFCBXGeT/8AyV95/wBtz/sWhywdhmu7S/xg+5qj9MfcuI8Mogj3
-yq5q5hXXVk4Bj7ZfHxOauavvgMvNVwCjLrjKjMWAyNrSpXKDYnz2xpcYRZQaXscbyxOuauTAYFUr
-mridc1caQqVzVxOuUWHjkhFVWubliJkxvInJiC0rlwM3qHtiFc1clwhKqXJyuRxOuauNKqVzVxOu
-auGlVK5VTjK5q4qqVzVxOuVXFVSpy64nXNXFV9cuuJVy64qqVzVxOuVXFVTlm5YnXNXJIVOWblid
-c1cVVOWblidc1cFKqcs3LGZsdglUrmrjR08c21cBkvCurlVOZQT7Y8Ko3yPGmltGPtjwoG/U5eVy
-AwcRKOFcMxNMTMmNDg4pEQqlq9MbWvtjOQzcgcU0F+XXEw2bkMO60FSuauJFxlc8aW1blm5Ylyyu
-XhjS2rcs3LEOVM3LDSLVuWauIgsdsdTxODZbX8vDLoT7Y2oGblkTaLXgAe+XXGcq5VcFd6FSubkM
-TrmrjwhVSuauJ1zVwcKqlc3LE65q4KVUrm5YnXNXJBVTlm5YnXNXCqpXNXE65q5EhVTlmridc3LI
-0lattbxyGVIlWQ9WAFcVLYnXNXJLS+uauMrmrhpC+uXXGVyi3bHhVMtBYf4h0sf8vUP/ACcXIf8A
-+Vc/8GX/ALH8lfl818xaV/zFQ/8AJxcin/lW/wDwZP8AsfzMxD/A8484/wC6ik/w+8/c/wD/0E/K
-Rp+V14aV/wBzfQf8w0OJiY0/u2+45wfNms7Ur8ybvkGGP6I+57x6x/323/AnL9Y/77b/AIE5wbNm
-B6fNm949Y/77b/gTm9dv99t/wJzg+bEcPmr3czt2jb/gTjfXfvG//AnOFZsmOGmBe5md6/3bf8Cc
-r1m/kb/gTnDc2WDh82D3P1m/kb/gTm9Zv5G/4E5wzNh9KHufrN/I3/AnKM7f77f/AIE5w3Nk48C7
-PcDM/wDI3/AnK9Zv5G/4E5xDNk9le3es38jf8Cc3rN/I3/AnOI5sOyXt3rN/I3/AnN6zfyN/wJzi
-ObHZXt3rN/I3/AnN6zfyN/wJziObHZXt3rN/I3/AnN6zfyN/wJziObHZD271m/kb/gTm9Zv99t9x
-ziObBsuz271W7o33HN6x/kb7jnEc2Oyvb/Wb+Rv+BOV6zfyN/wACc4jmw7K9u9Zv5G/4E5vWb+Rv
-+BOcRzY7Je3es38jf8Cc3rN/I33HOI5sdkPbvVb+RvuOX6zfyN9xziGbDsr271m/kb7jm9Y/yN9x
-ziObHZXt3rN/I33HL9Y/yN9xziGbHZXuHrH+RvuOX6zf77b/AIE5w7NkTTJ7iJmI+wwHyOOE1P2G
-P+xOcMzZA8KHuvrt/vtv+BOYzsB/duf9ic4Vmwenqr3P6xJ/vt6f6p/pjDO/++2/4E5w/NkvSnd7
-f6zV2Rv+BOb1mr9hv+BOcQzYfSh7f6zfyN/wJzes38jf8Cc4hmw7K9v9Zv5G/wCBOb1m/kb/AIE5
-xDNjsr271m/kb7jl+s38jf8AAnOIZsdkPbvWb+RvuOb1m/3233HOI5sTXRXt4kPdW+444TeCN9xz
-h2bImuqvc/WP8jf8Ccr1m/kb/gTnDc2D0q9z9Zv99t/wJzesf5G/4E5wzNkTwrs9z9Y/yN/wJzes
-38jf8Cc4ZmxFea7PcvWP8jf8Cc3rN/I3/AnOG5slsuz3P1j/ACN/wJyvWb+Rv+BOcNzY+ldnuXrH
-+Rv+BOb1j/I3/AnOG5sfSh7l6zfyN/wJzes38jf8Cc4bmx9KvcvWP8jf8Cc3rH+Rv+BOcNzY+lXu
-XrH+Rv8AgTm9Zv8Afbf8Cc4bmwGk7PcvWb+Rv+BOV6x/kb7jnDs2Q9Pml7l6zfyN9xzesf5G/wCB
-OcNzZIcKC9y9Y/yN/wACc3rN/I33HOG5sl6V2e5Gdu0bf8Ccb6p7o33HOH5sJrokU+gvLjlvMelD
-iR/pUPUH/fi5F/8AyrX/AIMn/Y/nJc2ZOL/FM/vj/uoplVx95+5//9k="));
-		break;
-		case "01_hdot.gif":
-			header("Content-type: image/gif");
-			echo trim(base64_decode("
-R0lGODlhAwABAJEAAAAAAP///1xcXP///yH5BAEAAAMALAAAAAADAAEAAAIC1FYAOw=="));
-		break;
-	}
-}
-?>
diff -x .svn -aruN 0.7.15.src/login.php 0.7.16.src/login.php
--- 0.7.15.src/login.php	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/login.php	2009-05-26 15:14:05.000000000 -0500
@@ -11,22 +11,30 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/login.php,v $
-|     $Revision: 1.13 $
-|     $Date: 2008/08/20 12:34:50 $
-|     $Author: mcfly_e107 $
+|     $Revision: 1.14 $
+|     $Date: 2009/05/26 20:14:29 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 
 require_once("class2.php");
+if (USER)
+{
+	header('location:'.e_BASE.'index.php');      
+	exit();
+}
+
 $HEADER = "";
 require_once(HEADERF);
 $use_imagecode = ($pref['logcode'] && extension_loaded("gd"));
-if ($use_imagecode) {
+if ($use_imagecode) 
+{
 	require_once(e_HANDLER."secure_img_handler.php");
 	$sec_img = new secure_image;
 }
 
-if (!USER) {
+if (!USER) 
+{
 	require_once(e_HANDLER."form_handler.php");
 	$rs = new form;
 	$text = "";
@@ -67,13 +75,7 @@
 	{
 		$LOGIN_TABLE_FOOTER_USERREG = "<a href='".e_SIGNUP."'>".LAN_LOGIN_11."</a>";
 	}
-		echo preg_replace("/\{([^ ]*?)\}/e", 'varset($\1,"\1")', $LOGIN_TABLE_FOOTER);
-
-}
-else
-{
-	echo "<script type='text/javascript'>document.location.href='".e_BASE."index.php'</script>\n";
-	exit;
+	echo preg_replace("/\{([^ ]*?)\}/e", 'varset($\1,"\1")', $LOGIN_TABLE_FOOTER);
 }
 
 echo "</body></html>";
diff -x .svn -aruN 0.7.15.src/news.php 0.7.16.src/news.php
--- 0.7.15.src/news.php	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/news.php	2009-07-10 15:29:37.000000000 -0500
@@ -11,8 +11,8 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/news.php,v $
-|     $Revision: 1.126 $
-|     $Date: 2008/11/29 15:35:23 $
+|     $Revision: 1.127 $
+|     $Date: 2009/07/10 20:30:01 $
 |     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
@@ -28,7 +28,7 @@
   exit;
 }
 
-$cacheString = 'news.php_'.e_QUERY;
+$cacheString = 'news.php_default_';
 $action = '';
 $sub_action = '';
 $order = "news_datestamp";
@@ -46,6 +46,7 @@
   $sub_action = varset($tmp[1],'');			// Usually a numeric category, but don't presume yet
   $id = varset($tmp[2],'');					// ID of specific news item where required
   $newsfrom = intval(varset($tmp[2],0));	// Item number for first item on multi-page lists
+  $cacheString = 'news.php_'.e_QUERY;
 }
 
 //$newsfrom = (!is_numeric($action) || !e_QUERY ? 0 : ($action ? $action : e_QUERY));
@@ -330,8 +331,10 @@
 		AND n.news_render_type<2 AND n.news_datestamp > {$startdate} AND n.news_datestamp < {$enddate}");
 	break;
 
+  case 'default' :
   default :
     $action = '';
+	$cacheString = 'news.php_default_';		// Make sure its sensible
 	$news_total = $sql->db_Count("news", "(*)", "WHERE news_class REGEXP '".e_CLASS_REGEXP."' AND NOT (news_class REGEXP ".$nobody_regexp.") AND news_start < ".time()." AND (news_end=0 || news_end>".time().") AND news_render_type<2" );
 
 	if(!isset($pref['newsposts_archive']))
diff -x .svn -aruN 0.7.15.src/page.php 0.7.16.src/page.php
--- 0.7.15.src/page.php	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/page.php	2009-08-23 05:39:27.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/page.php,v $
-|     $Revision: 1.48 $
-|     $Date: 2008/04/07 20:18:25 $
-|     $Author: secretr $
+|     $Revision: 1.50 $
+|     $Date: 2009/08/23 10:39:51 $
+|     $Author: marj_nl_fr $
 |
 +----------------------------------------------------------------------------+
 */
@@ -60,7 +60,7 @@
 		if ($e107_core_custom_pages['cachecontrol'] == TRUE)
 		{
 			ob_start();
-			$ns -> tablerender($e107_core_custom_pages['title'], $e107_core_custom_pages['text']);
+			$ns -> tablerender($e107_core_custom_pages['title'], $e107_core_custom_pages['text'],"cpage");
 			$cache_data = ob_get_flush();
 			$e107cache->set($cacheString, $cache_data);
 			$e107cache->set($cachePageTitle, $e107_core_custom_pages['title']."^".$e107_core_custom_pages['comment_flag']);
@@ -98,7 +98,7 @@
 	var $title;                         /* title of page, it if has one (as defined in [newpage=title] tag */
 
 
-	function pageClass($debug=FALSE)
+	function pageClass($debug = FALSE)
 	{
 		/* constructor */
 
@@ -106,18 +106,14 @@
 		$this -> pageID = intval($tmp[0]);
 		$this -> pageSelected = (isset($tmp[1]) ? intval($tmp[1]) : 0);
 		$this -> pageTitles = array();
-		if(defined("BULLET"))
+		$this->bullet = '';
+		if(defined('BULLET'))
 		{
-			$this -> bullet = "<img src='".THEME."images/".BULLET."' alt='' style='vertical-align: middle;' />";
+			$this->bullet = '<img src="'.THEME.'images/'.BULLET.'" alt="" style="vertical-align: middle;" />';
 		}
-		elseif(file_exists(THEME."images/bullet2.gif"))
-		{
-			$this -> bullet = "<img src='".THEME."images/bullet2.gif' alt='bullet' style='vertical-align: middle;' />";
-
-		}
-		else
+		elseif(file_exists(THEME.'images/bullet2.gif'))
 		{
-			$this -> bullet = "";
+			$this->bullet = '<img src="'.THEME.'images/bullet2.gif" alt="" style="vertical-align: middle;" />';
 		}
 
 		$this -> debug = $debug;
diff -x .svn -aruN 0.7.15.src/request.php 0.7.16.src/request.php
--- 0.7.15.src/request.php	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/request.php	2009-03-29 04:11:56.000000000 -0500
@@ -12,57 +12,73 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/request.php,v $
-|     $Revision: 1.44 $
-|     $Date: 2008/07/04 20:23:11 $
+|     $Revision: 1.46 $
+|     $Date: 2009/03/29 09:12:20 $
 |     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 
+// ********************************** SEE HIGHLIGHTED AND NUMBERED QUERIES *****************************
+
 require_once("class2.php");
 include_lan(e_LANGUAGEDIR.e_LANGUAGE."/lan_download.php");
 
-if (!e_QUERY || isset($_POST['userlogin'])) {
+if (!e_QUERY || isset($_POST['userlogin'])) 
+{
 	header("location: {$e107->base_path}");
 	exit();
 }
 
 $id = FALSE;
-if (!is_numeric(e_QUERY)) {
-	if ($sql->db_Select("download", "download_id", "download_url='".$tp -> toDB(e_QUERY)."'")) {
+if (!is_numeric(e_QUERY)) 
+{
+	if ($sql->db_Select('download', 'download_id', "download_url='".$tp -> toDB(e_QUERY)."'")) 
+	{
 		$row = $sql->db_Fetch();
-		$type = "file";
+		$type = 'file';
 		$id = $row['download_id'];
-	} else if(strstr(e_QUERY, "http://") || strstr(e_QUERY, "ftp://" || strstr(e_QUERY, "https://"))) {
+	} 
+	elseif((strpos(e_QUERY, "http://") === 0) || (strpos(e_QUERY, "ftp://") === 0) || (strpos(e_QUERY, "https://") === 0)) 
+	{
 		header("location: ".e_QUERY);
 		exit();
-	} else if(file_exists($DOWNLOADS_DIRECTORY.e_QUERY)) {
+	} 
+	elseif(file_exists($DOWNLOADS_DIRECTORY.e_QUERY)) 		// 1 - should we allow this?
+	{
 		send_file($DOWNLOADS_DIRECTORY.e_QUERY);
 		exit();
 	}
 }
 
-if(strstr(e_QUERY, "mirror")) {
+
+if(strstr(e_QUERY, "mirror")) 
+{	// Download from mirror
 	list($action, $download_id, $mirror_id) = explode(".", e_QUERY);
 	$download_id = intval($download_id);
 	$mirror_id = intval($mirror_id);
 	$qry = "SELECT d.*, dc.download_category_class FROM #download as d LEFT JOIN #download_category AS dc ON dc.download_category_id = d.download_category WHERE d.download_id = {$download_id}";
-	if ($sql->db_Select_gen($qry)) {
+	if ($sql->db_Select_gen($qry)) 
+	{
 		$row = $sql->db_Fetch();
 		extract($row);
 		if (check_class($download_category_class) && check_class($download_class)) 
 		{
-			if($pref['download_limits'] && $download_active == 1) {
+			if($pref['download_limits'] && $download_active == 1) 
+			{
 				check_download_limits();
 			}
 			$mirrorList = explode(chr(1), $download_mirror);
 			$mstr = "";
-			foreach($mirrorList as $mirror) {
-				if($mirror) {
+			foreach($mirrorList as $mirror) 
+			{
+				if($mirror) 
+				{
 					$tmp = explode(",", $mirror);
 					$mid = intval($tmp[0]);
 					$address = $tmp[1];
 					$requests = $tmp[2];
-					if($tmp[0] == $mirror_id) {
+					if($tmp[0] == $mirror_id) 
+					{
 						$gaddress = trim($address);
 						$requests ++;
 					}
@@ -80,16 +96,21 @@
 }
 
 $tmp = explode(".", e_QUERY);
-if (!$tmp[1] || strstr(e_QUERY, "pub_")) {
+if (!$tmp[1] || strstr(e_QUERY, "pub_")) 
+{
 	$id = intval($tmp[0]);
 	$type = "file";
-} else {
+} 
+else 
+{
 	$table = preg_replace("#\W#", "", $tp -> toDB($tmp[0], true));
 	$id = intval($tmp[1]);
 	$type = "image";
 }
 
-if (preg_match("#.*\.[a-z,A-Z]{3,4}#", e_QUERY)) {
+
+if (preg_match("#.*\.[a-z,A-Z]{3,4}#", e_QUERY)) 
+{
 	if(strstr(e_QUERY, "pub_"))
 	{
 		$bid = str_replace("pub_", "", e_QUERY);
@@ -99,7 +120,8 @@
 			exit();
 		}
 	}
-	if (file_exists($DOWNLOADS_DIRECTORY.e_QUERY)) {
+	if (file_exists($DOWNLOADS_DIRECTORY.e_QUERY)) 
+	{
 		send_file($DOWNLOADS_DIRECTORY.e_QUERY);
 		exit();
 	}
@@ -114,25 +136,28 @@
 	$qry = "SELECT d.*, dc.download_category_class FROM #download as d LEFT JOIN #download_category AS dc ON dc.download_category_id = d.download_category WHERE d.download_id = {$id}";
 	if ($sql->db_Select_gen($qry)) 
 	{
-	  $row = $sql->db_Fetch();
-	  if (check_class($row['download_category_class']) && check_class($row['download_class'])) 
-	  {
-		if ($row['download_active'] == 0)
-		{  // Inactive download - don't allow
-		  require_once(HEADERF);
-		  $ns -> tablerender(LAN_dl_61, "<div style='text-align:center'>".str_replace('--LINK--',"<a href='".e_HTTP.'download.php'."'>",LAN_dl_78).'</div>');
-		  require_once(FOOTERF);
-		  exit();
-		}
+		$row = $sql->db_Fetch();
+		if (check_class($row['download_category_class']) && check_class($row['download_class'])) 
+		{
+			if ($row['download_active'] == 0)
+			{  // Inactive download - don't allow
+				require_once(HEADERF);
+				$ns -> tablerender(LAN_dl_61, "<div style='text-align:center'>".str_replace('--LINK--',"<a href='".e_HTTP.'download.php'."'>",LAN_dl_78).'</div>');
+				require_once(FOOTERF);
+				exit();
+			}
 
-			if($pref['download_limits'] && $row['download_active'] == 1) {
+			if($pref['download_limits'] && $row['download_active'] == 1) 
+			{
 				check_download_limits();
 			}
 			extract($row);
-			if($download_mirror) {
+			if($download_mirror) 
+			{
 				$array = explode(chr(1), $download_mirror);
 				$c = (count($array)-1);
-				for ($i=1; $i < $c; $i++) {
+				for ($i=1; $i < $c; $i++) 
+				{
 					$d = mt_rand(0, $i);
 					$tmp = $array[$i];
 					$array[$i] = $array[$d];
@@ -141,16 +166,18 @@
 				$tmp = explode(",", $array[0]);
 				$mirror_id = $tmp[0];
 				$mstr = "";
-				foreach($array as $mirror) {
-					if($mirror) {
+				foreach($array as $mirror) 
+				{
+					if($mirror) 
+					{
 						$tmp = explode(",", $mirror);
 						$mid = $tmp[0];
 						$address = $tmp[1];
 						$requests = $tmp[2];
 						if($tmp[0] == $mirror_id) 
 						{
-						  $gaddress = trim($address);
-						  $requests ++;
+							$gaddress = trim($address);
+							$requests ++;
 						}
 					  $mstr .= $mid.",".$address.",".$requests.chr(1);
 					}
@@ -169,7 +196,8 @@
 			$request_data = "'0', '{$user_id}', '{$ip}', '{$id}', '".time()."'";
 			//add request info to db
 			$sql->db_Insert("download_requests", $request_data, FALSE);
-			if (preg_match("/Binary\s(.*?)\/.*/", $download_url, $result)) {
+			if (preg_match("/Binary\s(.*?)\/.*/", $download_url, $result)) 
+			{
 				$bid = $result[1];
 				$result = @mysql_query("SELECT * FROM ".MPREFIX."rbinary WHERE binary_id = '{$bid}'");
 				$binary_data = @mysql_result($result, 0, "binary_data");
@@ -185,11 +213,16 @@
 			if (strstr($download_url, "http://") || strstr($download_url, "ftp://") || strstr($download_url, "https://")) {
 				header("Location: {$download_url}");
 				exit();
-			} else {
-				if (file_exists($DOWNLOADS_DIRECTORY.$download_url)) {
+			} 
+			else 
+			{
+				if (file_exists($DOWNLOADS_DIRECTORY.$download_url)) 
+				{
 					send_file($DOWNLOADS_DIRECTORY.$download_url);
 					exit();
-				} else if(file_exists(e_FILE."public/{$download_url}")) {
+				} 
+				elseif(file_exists(e_FILE."public/{$download_url}")) 
+				{
 					send_file(e_FILE."public/{$download_url}");
 					exit();
 				}
@@ -197,26 +230,21 @@
 		} 
 		else 
 		{	// Download Access Denied.
-		  if((!strpos($pref['download_denied'],".php") &&
-			!strpos($pref['download_denied'],".htm") &&
-			!strpos($pref['download_denied'],".html") &&
-			!strpos($pref['download_denied'],".shtml") ||
-			(strpos($pref['download_denied'],"signup.php") && USER == TRUE)
-			))
-		  {
-			header("Location: ".e_BASE."download.php?error.{$id}.1");
-			exit;
-/*				require_once(HEADERF);
-				$denied_message = ($pref['download_denied'] && !strpos($pref['download_denied'],"signup.php")) ? $tp->toHTML($pref['download_denied'],"","defs") : LAN_dl_63;
-				$ns -> tablerender(LAN_dl_61, $denied_message);
-				require_once(FOOTERF);  
-				exit();  */
-		  }
-		  else
-		  {
-			header("Location: ".trim($pref['download_denied']));
-			exit;
-		  }
+			if((!strpos($pref['download_denied'],".php") &&
+				!strpos($pref['download_denied'],".htm") &&
+				!strpos($pref['download_denied'],".html") &&
+				!strpos($pref['download_denied'],".shtml") ||
+				(strpos($pref['download_denied'],"signup.php") && USER == TRUE)
+				))
+			{
+				header("Location: ".e_BASE."download.php?error.{$id}.1");
+				exit();
+			}
+			else
+			{
+				header("Location: ".trim($pref['download_denied']));
+				exit();
+			}
 		}
 	}
 	else if(strstr(e_QUERY, "pub_"))
@@ -247,7 +275,8 @@
 $row = $sql->db_Fetch();
 extract($row);
 $image = ($table == "upload" ? $upload_ss : $download_image);
-if (preg_match("/Binary\s(.*?)\/.*/", $image, $result)) {
+if (preg_match("/Binary\s(.*?)\/.*/", $image, $result)) 
+{
 	$bid = $result[1];
 	$result = @mysql_query("SELECT * FROM ".MPREFIX."rbinary WHERE binary_id = '{$bid}'");
 	$binary_data = @mysql_result($result, 0, "binary_data");
@@ -259,32 +288,47 @@
 	exit();
 }
 
+
 $image = ($table == "upload" ? $upload_ss : $download_image);
 
-if (strpos($image, "http") !== FALSE) {
+if (strpos($image, "http") !== FALSE) 
+{
 	header("Location: {$image}");
 	exit();
-} else {
-	if ($table == "download") {
+} 
+else 
+{
+	if ($table == "download") 
+	{
 		require_once(HEADERF);
-		if (file_exists(e_FILE."download/{$image}")) {
+		if (file_exists(e_FILE."download/{$image}")) 
+		{
 			$disp = "<div style='text-align:center'><img src='".e_FILE."download/{$image}' alt='' /></div>";
 		}
-		else if(file_exists(e_FILE."downloadimages/{$image}")) {
+		else if(file_exists(e_FILE."downloadimages/{$image}")) 
+		{
 			$disp = "<div style='text-align:center'><img src='".e_FILE."downloadimages/{$image}' alt='' /></div>";
-		} else {
+		} 
+		else 
+		{
 			$disp = "<div style='text-align:center'><img src='".e_FILE."public/{$image}' alt='' /></div>";
 		}
 		$disp .= "<br /><div style='text-align:center'><a href='javascript:history.back(1)'>".LAN_dl_64."</a></div>";
 		$ns->tablerender($image, $disp);
 
 		require_once(FOOTERF);
-	} else {
-		if (is_file(e_FILE."public/{$image}")) {
+	} else 
+	{
+		if (is_file(e_FILE."public/{$image}")) 
+		{
 			echo "<img src='".e_FILE."public/{$image}' alt='' />";
-		} elseif(is_file(e_FILE."downloadimages/{$image}")) {
+		} 
+		elseif(is_file(e_FILE."downloadimages/{$image}")) 
+		{
 			echo "<img src='".e_FILE."downloadimages/{$image}' alt='' />";
-		} else {
+		} 
+		else 
+		{
 			require_once(HEADERF);
 			$ns -> tablerender(LAN_dl_61, "<div style='text-align:center'>".LAN_dl_65."<br /><br /><a href='javascript:history.back(1)'>".LAN_dl_64."</a></div>");
 			require_once(FOOTERF);
@@ -294,8 +338,11 @@
 	}
 }
 
+
+
 // File retrieval function. by Cam.
-function send_file($file) {
+function send_file($file) 
+{
 	global $pref, $DOWNLOADS_DIRECTORY,$FILES_DIRECTORY, $e107;
 	if (!$pref['download_php'])
 	{
@@ -310,17 +357,25 @@
 	$path = realpath($filename);
 	$path_downloads = realpath($DOWNLOADS_DIRECTORY);
 	$path_public = realpath($FILES_DIRECTORY."public/");
-	if(!strstr($path, $path_downloads) && !strstr($path,$path_public)) {
-        if(E107_DEBUG_LEVEL > 0 && ADMIN){
+	if(!strstr($path, $path_downloads) && !strstr($path,$path_public)) 
+	{
+        if(E107_DEBUG_LEVEL > 0 && ADMIN)
+		{
 			echo "Failed to Download <b>".$file."</b><br />";
 			echo "The file-path <b>".$path."<b> didn't match with either <b>{$path_downloads}</b> or <b>{$path_public}</b><br />";
 			exit();
-        }else{
+        }
+		else
+		{
 			header("location: {$e107->base_path}");
 			exit();
 		}
-	} else {
-		if (is_file($filename) && is_readable($filename) && connection_status() == 0) {
+	} 
+	else 
+	{
+		if (is_file($filename) && is_readable($filename) && connection_status() == 0) 
+		{
+			$seek = 0;
 			if (strstr($_SERVER['HTTP_USER_AGENT'], "MSIE"))
 			{
 				$file = preg_replace('/\./', '%2e', $file, substr_count($file, '.') - 1);
@@ -359,19 +414,25 @@
 				$data_len -= $bufsize;
 			}
 			fclose($res);
-		} else {
-
-            if(E107_DEBUG_LEVEL > 0 && ADMIN){
+		} 
+		else 
+		{
+            if(E107_DEBUG_LEVEL > 0 && ADMIN)
+			{
               	echo "file failed =".$file."<br />";
 				echo "path =".$path."<br />";
                 exit();
-			}else{
+			}
+			else
+			{
 			  	header("location: ".e_BASE."index.php");
 				exit();
 			}
 		}
 	}
 }
+
+
 function check_download_limits() 
 {
 	global $pref, $sql, $ns, $HEADER, $e107, $tp;
diff -x .svn -aruN 0.7.15.src/robots.txt 0.7.16.src/robots.txt
--- 0.7.15.src/robots.txt	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/robots.txt	1969-12-31 18:00:00.000000000 -0600
@@ -1,5 +0,0 @@
-User-agent: *
-Disallow: /e107_admin/
-Disallow: /e107_handlers/
-Disallow: /e107_files/cache/
-Disallow: /e107_files/public/avatars/
diff -x .svn -aruN 0.7.15.src/signup.php 0.7.16.src/signup.php
--- 0.7.15.src/signup.php	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/signup.php	2009-08-09 03:38:40.000000000 -0500
@@ -11,14 +11,15 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/signup.php,v $
-|     $Revision: 1.122 $
-|     $Date: 2008/12/04 21:32:40 $
-|     $Author: e107steved $
+|     $Revision: 1.133 $
+|     $Date: 2009/08/09 08:39:04 $
+|     $Author: marj_nl_fr $
 +----------------------------------------------------------------------------+
 */
 
 require_once("class2.php");
 $qs = explode(".", e_QUERY);
+//@TODO what fix?
 if($qs[0] != "activate"){   // multi-language fix.
 	e107_include_once(e_LANGUAGEDIR.e_LANGUAGE."/lan_signup.php");
 	e107_include_once(e_LANGUAGEDIR."English/lan_signup.php");
@@ -195,22 +196,26 @@
 	if(e_QUERY == "preview.aftersignup")
 	{
 		require_once(HEADERF);
+		$srch = array("[sitename]","[email]");
+		$repl = array(SITENAME,"<b>example@email.com</b>");
+
 		if(trim($pref['signup_text_after']))
 		{
-			$text = $tp->toHTML($pref['signup_text_after'], TRUE, 'parse_sc,defs')."<br />";
+			$text = str_replace($srch,$repl,$tp->toHTML($pref['signup_text_after'], TRUE, 'parse_sc,defs'))."<br />"; 
 		}
 		else
 		{
-			if ($pref['user_reg_veri'] == 2)
-			{
-				$text = LAN_SIGNUP_37;
-			}
-			else
-			{
-				$text = LAN_405;
-			}
+            $LAN_AFTERSIGNUP = defined("LAN_SIGNUP_72") ? LAN_SIGNUP_72 : LAN_405;
+			$text = ($pref['user_reg_veri'] == 2) ? LAN_SIGNUP_37 : str_replace($srch,$repl,$LAN_AFTERSIGNUP);  // Admin Approval / Email Approval
 		}
-		$ns->tablerender(LAN_406, $text);
+
+		$caption_arr = array();
+		$caption_arr[0] = LAN_406; // Thank you!  (No Approval).
+		$caption_arr[1] = defined("LAN_SIGNUP_98") ? LAN_SIGNUP_98 : LAN_406; // Confirm Email (Email Confirmation)
+		$caption_arr[2] = defined("LAN_SIGNUP_100") ? LAN_SIGNUP_100 : LAN_406; // Approval Pending (Admin Approval)
+        $caption = $caption_arr[$pref['user_reg_veri']];
+
+		$ns->tablerender($caption, $text);
 		require_once(FOOTERF);
 		exit;
 	}
@@ -283,8 +288,8 @@
 		if($qs[3] && strlen($qs[3]) == 2 )
 		{
 			require_once(e_HANDLER."language_class.php");
-			$lng = new language;
-			$the_language = $lng->convert($qs[3]);
+			$slng = new language;
+			$the_language = $slng->convert($qs[3]);
 			if(is_readable(e_LANGUAGEDIR.$the_language."/lan_signup.php"))
 			{
 				include(e_LANGUAGEDIR.$the_language."/lan_signup.php");
@@ -325,7 +330,7 @@
 
 if (isset($_POST['register']))
 {
-  $_POST['xupexist'] = trim(varset($_POST['xupexist'],''));
+	$_POST['xupexist'] = trim(varset($_POST['xupexist'],''));
 	$e107cache->clear("online_menu_totals");
 	$error_message = "";
 	require_once(e_HANDLER."message_handler.php");
@@ -362,6 +367,7 @@
 
 		$_POST['name'] = $xup['NICKNAME'];
 		$_POST['email'] = $xup['EMAIL'];
+		$_POST['email_confirm'] = $xup['EMAIL'];
 		$_POST['signature'] = $xup['SIG'];
 		$_POST['hideemail'] = $xup['EMAILHIDE'];
 		$_POST['timezone'] = $xup['TZ'];
@@ -461,6 +467,7 @@
 		$error = TRUE;
 	}
 
+
 	// check for multiple signups from the same IP address.
 	if($ipcount = $sql->db_Select("user", "*", "user_ip='".$e107->getip()."' and user_ban !='2' "))
 	{
@@ -551,32 +558,35 @@
 	// Email address checks
 	//--------------------------------------
 	// Email syntax validation.
-	if ($do_email_validate && (!$_POST['email'] || !check_email($_POST['email'])))
+	if ($do_email_validate)
 	{
-	  $error_message .= LAN_106."\\n";
-	  $error = TRUE;
-	  $email_address_OK = FALSE;
-	}
-	else
-	{
-		// Check Email against banlist.
-		$wc = make_email_query($_POST['email']);
-		if ($wc) $wc = ' OR '.$wc;
-
-		if (($wc === FALSE) || ($do_email_validate && $sql->db_Select("banlist", "*", "banlist_ip='".$_POST['email']."'".$wc)))
+		if (!$_POST['email'] || !check_email($_POST['email']))
 		{
-			$email_address_OK = FALSE;
-			$brow = $sql -> db_Fetch();
+			$error_message .= LAN_106."\\n";
 			$error = TRUE;
-			if($brow['banlist_reason'])
-			{
-				$repl = array("\n","\r","<br />");
-				$error_message = str_replace($repl,"\\n",$tp->toHTML($brow['banlist_reason'],"","nobreak, defs"))."\\n";
-				$email = "";
-			}
-			else
+			$email_address_OK = FALSE;
+		}
+		else
+		{
+			// Check Email against banlist.
+			$wc = make_email_query($_POST['email']);
+			if ($wc) $wc = ' OR '.$wc;
+	
+			if (($wc === FALSE) || ($do_email_validate && $sql->db_Select("banlist", "*", "banlist_ip='".$_POST['email']."'".$wc)))
 			{
-				exit;
+				$email_address_OK = FALSE;
+				$brow = $sql -> db_Fetch();
+				$error = TRUE;
+				if($brow['banlist_reason'])
+				{
+					$repl = array("\n","\r","<br />");
+					$error_message = str_replace($repl,"\\n",$tp->toHTML($brow['banlist_reason'],"","nobreak, defs"))."\\n";
+					$email = "";
+				}
+				else
+				{
+					exit;
+				}
 			}
 		}
 	}
@@ -620,38 +630,85 @@
 		}
 	}
 
+
+	// Avatar validation (already checked if compulsory field not filled in)
+	if ((varset($pref['signup_option_image'],0) > 0) && $_POST['image'])
+	{
+		$_POST['image'] = str_replace(array('\'', '"', '(', ')'), '', $_POST['image']);   // these are invalid anyway, so why allow them? (XSS Fix)
+		$avName = $tp -> toDB($_POST['image']);
+		if ($size = getimagesize($avName))
+		{
+			$avwidth = $size[0];
+			$avheight = $size[1];
+			$avmsg = "";
+	
+			$pref['im_width'] = varset($pref['im_width'], 120);
+			$pref['im_height'] = varset($pref['im_height'], 100);
+			if ($avwidth > $pref['im_width']) 
+			{
+				$avmsg .= LAN_USET_1." ({$avwidth})<br />".LAN_USET_2.": {$pref['im_width']}<br /><br />";
+			}
+			if ($avheight > $pref['im_height']) 
+			{
+				$avmsg .= LAN_USET_3." ({$avheight})<br />".LAN_USET_4.": {$pref['im_height']}";
+			}
+		}
+		else
+		{
+			$avmsg = LAN_SIGNUP_60;			// Error accessing avatar
+		}
+		if ($avmsg) 
+		{
+			$_POST['image'] = "";
+			$error_message .= $avmsg;
+			$error = TRUE;
+		}
+	}
+	else
+	{
+		$_POST['image'] = "";
+	}
+
+
 	// Extended Field validation
 	$extList = $usere->user_extended_get_fieldList();
+	$eufVals = array();
 
 	foreach($extList as $ext)
 	{
-		if(isset($_POST['ue']['user_'.$ext['user_extended_struct_name']]))
+		$eufName = 'user_'.$ext['user_extended_struct_name'];
+		if(isset($_POST['ue'][$eufName]) || ($ext['user_extended_struct_required'] == 1))
 		{
-			$newval = trim($_POST['ue']['user_'.$ext['user_extended_struct_name']]);
+			$newval = trim(varset($_POST['ue'][$eufName],''));
+//			echo "Vetting field ".'user_'.$ext['user_extended_struct_name'].": {$newval} = ".trim($_POST['ue']['user_'.$ext['user_extended_struct_name']])."<br />";
 			if($ext['user_extended_struct_required'] == 1 && (($newval == "") || (($ext['user_extended_struct_type'] == 7) && ($newval == '0000-00-00')) ))
-			{
+			{	// Required field not present
 				$_ftext = (defined($ext['user_extended_struct_text']) ? constant($ext['user_extended_struct_text']) : $ext['user_extended_struct_text']);
 				$error_message .= LAN_SIGNUP_6.$_ftext.LAN_SIGNUP_7."\\n";
 				$error = TRUE;
 			}
-			$parms = explode("^,^", $ext['user_extended_struct_parms']);
-			$regex = (isset($parms[1]) ? $tp->toText($parms[1]) : "");
-			$regexfail = (isset($parms[2]) ? trim($tp->toText($parms[2])) : "");
-
-			if($regexfail == "")
+			else
 			{
-				$regexfail = $ext['user_extended_struct_name']." ".LAN_SIGNUP_53;
-			}
+				$parms = explode("^,^", $ext['user_extended_struct_parms']);
+				$regex = (isset($parms[1]) ? $tp->toText($parms[1]) : "");
+				$regexfail = (isset($parms[2]) ? trim($tp->toText($parms[2])) : "");
+
+				if($regexfail == "")
+				{
+					$regexfail = $ext['user_extended_struct_name']." ".LAN_SIGNUP_53;
+				}
 
-			if(defined($regexfail)) {$regexfail = constant($regexfail);}
+				if(defined($regexfail)) {$regexfail = constant($regexfail);}
 
-			if($regex != "" && $newval != "")
-			{
-				if(!preg_match($regex, $newval))
+				if($regex != "" && $newval != "" && !preg_match($regex, $newval))
 				{
 					$error_message .= $regexfail."\\n";
 					$error = TRUE;
 				}
+				else
+				{
+					$eufVals[$eufName] = $newval;
+				}
 			}
 		}
 	}
@@ -659,8 +716,9 @@
 
 	if($error_message)
 	{
-	  message_handler("P_ALERT", $error_message);
-	  $error_message = '';
+		require_once(HEADERF);
+		message_handler("P_ALERT", $error_message);
+		$error_message = '';
 	}
 
 	// ========== End of verification.. ====================================================
@@ -685,10 +743,10 @@
 		$ip = $e107->getip();
 
 		$ue_fields = "";
-		foreach($_POST['ue'] as $key => $val)
+		if (count($eufVals))
 		{
-			if (isset($extList[$key]))
-			{	// Only allow valid keys
+			foreach($eufVals as $key => $val)	// We've already ensured only valid keys here
+			{
 				$key = $tp->toDB($key);
 				$val = $tp->toDB($val);
 				$ue_fields .= ($ue_fields) ? ", " : "";
@@ -746,26 +804,33 @@
 			$e_event->trigger("usersup", $_POST);  // send everything in the template, including extended fields.
 
 			require_once(HEADERF);
-			if($pref['signup_text_after'])
+
+            $srch = array("[sitename]","[email]");
+			$repl = array(SITENAME,"<b>".$_POST['email']."</b>");
+
+			if(trim($pref['signup_text_after']))
 			{
-				$text = $tp->toHTML($pref['signup_text_after'], TRUE, 'parse_sc,defs')."<br />";
+				$text = str_replace($srch,$repl,$tp->toHTML($pref['signup_text_after'], TRUE, 'parse_sc,defs'))."<br />";
 			}
 			else
 			{
-				if ($pref['user_reg_veri'] == 2)
-				{
-					$text = LAN_SIGNUP_37;
-				}
-				else
-				{
-					$text = LAN_405;
-				}
+	            $LAN_AFTERSIGNUP = defined("LAN_SIGNUP_72") ? LAN_SIGNUP_72 : LAN_405;
+				$text = ($pref['user_reg_veri'] == 2) ? LAN_SIGNUP_37 : str_replace($srch,$repl,$LAN_AFTERSIGNUP);  // Admin Approval / Email Approval
 			}
+
+			$caption_arr = array();
+			$caption_arr[0] = LAN_406; // Thank you!  (No Approval).
+			$caption_arr[1] = defined("LAN_SIGNUP_98") ? LAN_SIGNUP_98 : LAN_406; // Confirm Email (Email Confirmation)
+			$caption_arr[2] = defined("LAN_SIGNUP_100") ? LAN_SIGNUP_100 : LAN_406; // Approval Pending (Admin Approval)
+	        $caption = $caption_arr[$pref['user_reg_veri']];
+
 			if($error_message)
 			{
 				$text = "<br /><b>".$error_message."</b><br />";	// Just display the error message
+                $caption = defined("LAN_SIGNUP_99") ? LAN_SIGNUP_99 : LAN_406; // Problem Detected  // Default for backwards compat.
 			}
-			$ns->tablerender(LAN_406, $text);
+
+			$ns->tablerender($caption, $text);
 			require_once(FOOTERF);
 			exit;
 		}
diff -x .svn -aruN 0.7.15.src/sitedown.php 0.7.16.src/sitedown.php
--- 0.7.15.src/sitedown.php	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/sitedown.php	2009-08-15 06:54:05.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/sitedown.php,v $
-|     $Revision: 1.9 $
-|     $Date: 2006/06/30 04:16:39 $
-|     $Author: e107coders $
+|     $Revision: 1.10 $
+|     $Date: 2009/08/15 11:54:29 $
+|     $Author: marj_nl_fr $
 +----------------------------------------------------------------------------+
 */
 require_once("class2.php");
@@ -21,8 +21,7 @@
 global $pref;
 global $tp;
 
-e107_include_once(e_LANGUAGEDIR.e_LANGUAGE."/lan_sitedown.php");
-e107_include_once(e_LANGUAGEDIR."English/lan_sitedown.php");
+include_lan(e_LANGUAGEDIR.e_LANGUAGE."/lan_sitedown.php");
 
 if (!$pref['maintainance_flag'] )
 {
diff -x .svn -aruN 0.7.15.src/submitnews.php 0.7.16.src/submitnews.php
--- 0.7.15.src/submitnews.php	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/submitnews.php	2009-08-17 14:21:52.000000000 -0500
@@ -11,163 +11,196 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/submitnews.php,v $
-|     $Revision: 1.22 $
-|     $Date: 2008/06/02 18:29:09 $
+|     $Revision: 1.24 $
+|     $Date: 2009/08/17 19:22:16 $
 |     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
-require_once("class2.php");
-
-$e_wysiwyg = varsettrue($pref['subnews_htmlarea']) ? 'e107_submitnews_item' : '';
 
+require_once("class2.php");
+$e_wysiwyg = varsettrue($pref['subnews_htmlarea']) ? "submitnews_item" : "";
 require_once(HEADERF);
 
 if (!isset($pref['subnews_class']))
 {
-    $pref['subnews_class'] = "0";
+	$pref['subnews_class'] = '0';
 }
+
 if (!check_class($pref['subnews_class']))
 {
-    $ns->tablerender(NWSLAN_12, NWSLAN_11);
-    require_once(FOOTERF);
-    exit;
-}
-
-$author_name = $tp->toDB($_POST['author_name']);
-$author_email = $tp->toDB(check_email($_POST['author_email']));
+	$ns->tablerender(NWSLAN_12, NWSLAN_11);
+	require_once(FOOTERF);
+	exit;
+}
+
+if (isset($_POST['submitnews_submit']) && $_POST['submitnews_title'] && $_POST['submitnews_item'])
+{
+	$ip = $e107->getip();
+	$fp = new floodprotect;
+	if ($fp->flood("submitnews", "submitnews_datestamp") == FALSE)
+	{
+		header("location:".e_BASE."index.php");
+		exit;
+	}
+
+	$submitnews_user  = (USER ? USERNAME  : trim($tp->toDB($_POST['submitnews_name'])));
+	$submitnews_email = (USER ? USEREMAIL : trim(check_email($tp->toDB($_POST['submitnews_email']))));
+	$submitnews_title = $tp->toDB($_POST['submitnews_title']);
+	$submitnews_item  = $tp->toDB($_POST['submitnews_item']);
+	$submitnews_item  = str_replace("src=&quot;e107_images", "src=&quot;".SITEURL."e107_images", $submitnews_item);
+	$submitnews_file  = "";
+	$submitnews_error = FALSE;
+	if (!$submitnews_user || !$submitnews_email)
+	{
+		$message = SUBNEWSLAN_7;
+		$submitnews_error = TRUE;
+	}
+
+	// ==== Process File Upload ====
+	if (FILE_UPLOADS && $_FILES['file_userfile'] && varsettrue($pref['subnews_attach']) && varsettrue($pref['upload_enabled']) && check_class($pref['upload_class']))
+	{
+		require_once(e_HANDLER.'upload_handler.php');
+		$uploaded = process_uploaded_files(e_IMAGE . 'newspost_images/', FALSE, array('file_mask' => 'jpg,gif,png', 'max_file_count' => 1));
 
-if (isset($_POST['submit']))
-{
-    $user = (USER ? USERNAME : $author_name);
-    $email = (USER ? USEREMAIL : $author_email);
+/*	
+		if ($filename && $fileext != "jpg" && $fileext != "gif" && $fileext != "png")
+		{
+			$message = SUBNEWSLAN_3;
+			$submitnews_error = TRUE;
+		}
+	
+		if (!$pref['upload_maxfilesize'])
+		{
+			$pref['upload_maxfilesize'] = ini_get('upload_max_filesize') * 1048576;
+		}
 
-    if ($user && $email)
-    {
-        $ip = $e107->getip();
-        $fp = new floodprotect;
-        if ($fp->flood("submitnews", "submitnews_datestamp") == false)
-        {
-            header("location:" . e_BASE . "index.php");
-            exit;
-        }
-        $itemtitle = $tp->toDB($_POST['itemtitle']);
-        $item = $tp->toDB($_POST['e107_submitnews_item']);
-        $item = str_replace("src=&quot;e107_images", "src=&quot;" . SITEURL . "e107_images", $item);
-        // Process File Upload    =================================================
-        if ($_FILES['file_userfile'] && $pref['subnews_attach'] && $pref['upload_enabled'] && check_class($pref['upload_class']) && FILE_UPLOADS)
-        {
-            require_once(e_HANDLER . "upload_handler.php");
-            $uploaded = file_upload(e_IMAGE . "newspost_images/");
-            $file = $uploaded[0]['name'];
-            $filetype = $uploaded[0]['type'];
-            $filesize = $uploaded[0]['size'];
-            $fileext = substr(strrchr($file, "."), 1);
-
-            if (!$pref['upload_maxfilesize'])
-            {
-                $pref['upload_maxfilesize'] = ini_get('upload_max_filesize') * 1048576;
-            }
-
-            if ($uploaded && $fileext != "jpg" && $fileext != "gif" && $fileext != "png")
-            {
-                $message = SUBNEWSLAN_3;
-                $error = true;
-            }
-
-            if ($filesize > $pref['upload_maxfilesize'])
-            {
-                $message = SUBNEWSLAN_4;
-                $error = true;
-            }
-
-            if (!$error)
-            {
-                // $numberoffiles = count($uploaded);
-                $today = getdate();
-                $newname = USERID . "_" . $today[0] . "_" . str_replace(" ", "_", substr($itemtitle, 0, 6)) . "." . $fileext;
-                if ($file && $pref['subnews_resize'])
-                {
-                    require_once(e_HANDLER . "resize_handler.php");
-                    $rezwidth = $pref['subnews_resize'];
-                    if (!resize_image(e_IMAGE . "newspost_images/" . $file, e_IMAGE . "newspost_images/" . $newname, $rezwidth))
-                    {
-                        rename(e_IMAGE . "newspost_images/" . $file, e_IMAGE . "newspost_images/" . $newname);
-                    }
-                } elseif ($file)
-                {
-                    rename(e_IMAGE . "newspost_images/" . $file, e_IMAGE . "newspost_images/" . $newname);
-                }
-            }
-        }
-
-        if ($error == false)
-        {
-            if (!file_exists(e_IMAGE . "newspost_images/" . $newname))
-            {
-                $newname = "";
-            }
-            $sql->db_Insert("submitnews", "0, '$user', '$email', '$itemtitle', '".intval($_POST['cat_id'])."','$item', '" . time() . "', '$ip', '0', '$newname' ");
-            $edata_sn = array("user" => $user, "email" => $email, "itemtitle" => $itemtitle, "catid" => intval($_POST['cat_id']), "item" => $item, "ip" => $ip, "newname" => $newname);
-            $e_event->trigger("subnews", $edata_sn);
-            $ns->tablerender(LAN_133, "<div style='text-align:center'>" . LAN_134 . "</div>");
-            require_once(FOOTERF);
-            exit;
-        }
-        else
-        {
-            require_once(e_HANDLER . "message_handler.php");
-            message_handler("P_ALERT", $message);
-        }
-    }
-}
+		if ($filesize > $pref['upload_maxfilesize'])
+		{
+			$message = SUBNEWSLAN_4;
+			$submitnews_error = TRUE;
+		}
+*/
+		if (($uploaded === FALSE) || !is_array($uploaded))
+		{	// Non-specific error
+			$submitnews_error = TRUE;
+			$message = SUBNEWSLAN_8;
+		}
+		elseif (varset($uploaded[0]['error'],0) != 0)
+		{
+			$submitnews_error = TRUE;
+			$message = handle_upload_messages($uploaded);
+		}
+		else
+		{
+			$filename = $uploaded[0]['name'];
+			$filetype = $uploaded[0]['type'];
+			$filesize = $uploaded[0]['size'];
+			$fileext  = substr(strrchr($filename, "."), 1);
+			$today = getdate();
+			$submitnews_file = USERID."_".$today[0]."_".str_replace(" ", "_", substr($submitnews_title, 0, 6)).".".$fileext;
+			if (is_numeric($pref['subnews_resize']) && ($pref['subnews_resize'] > 30)  && ($pref['subnews_resize'] < 5000))
+			{
+				require_once(e_HANDLER.'resize_handler.php');
+		
+				if (!resize_image(e_IMAGE.'newspost_images/'.$filename, e_IMAGE.'newspost_images/'.$submitnews_file, $pref['subnews_resize']))
+				{
+				  rename(e_IMAGE.'newspost_images/'.$filename, e_IMAGE.'newspost_images/'.$submitnews_file);
+				}
+			}
+			elseif ($filename)
+			{
+				rename(e_IMAGE.'newspost_images/'.$filename, e_IMAGE.'newspost_images/'.$submitnews_file);
+			}
+		}
+	
+		if ($filename && !file_exists(e_IMAGE."newspost_images/".$submitnews_file))
+		{
+			$submitnews_file = "";
+		}
+	}
 
-if (!defined("USER_WIDTH")){ define("USER_WIDTH","width:95%"); }
+	if ($submitnews_error === FALSE)
+	{
+		$sql->db_Insert("submitnews", "0, '$submitnews_user', '$submitnews_email', '$submitnews_title', '".intval($_POST['cat_id'])."', '$submitnews_item', '".time()."', '$ip', '0', '$submitnews_file' ");
+		$edata_sn = array("user" => $submitnews_user, "email" => $submitnews_email, "itemtitle" => $submitnews_title, "catid" => intval($_POST['cat_id']), "item" => $submitnews_item, "ip" => $ip, "newname" => $submitnews_file);
+		$e_event->trigger("subnews", $edata_sn);
+		$ns->tablerender(LAN_133, "<div style='text-align:center'>".LAN_134."</div>");
+		require_once(FOOTERF);
+		exit;
+	}
+	else
+	{
+		require_once(e_HANDLER."message_handler.php");
+		message_handler("P_ALERT", $message);
+	}
+}
+
+if (!defined("USER_WIDTH")) { define("USER_WIDTH","width:95%"); }
+
+$text = "
+<div style='text-align:center'>
+  <form id='dataform' method='post' action='".e_SELF."' enctype='multipart/form-data' onsubmit='return frmVerify()'>
+    <table style='".USER_WIDTH."' class='fborder'>";
 
-$text = "<div style='text-align:center'>
-	<form id='dataform' method='post' action='" . e_SELF . "' enctype='multipart/form-data' onsubmit='return frmVerify()'>\n
-	<table style='".USER_WIDTH."' class='fborder'>";
-if (!USER)
+if (!empty($pref['news_subheader']))
 {
-    $text .= "<tr>\n<td style='width:20%' class='forumheader3'>" . LAN_7 . "</td>\n<td style='width:80%' class='forumheader3'>\n<input class='tbox' type='text' name='author_name' size='60' value='$author_name' maxlength='100' />\n</td>\n</tr>\n<tr>\n<td style='width:20%' class='forumheader3'>" . LAN_112 . "</td>\n<td style='width:80%' class='forumheader3'>\n<input class='tbox' type='text' name='author_email' size='60' value='$author_email' maxlength='100' />\n</td>\n</tr>";
+  $text .= "
+  <tr>
+    <td colspan='2' class='forumheader3'>".$tp->toHTML($pref['news_subheader'], TRUE, "TITLE")."<br /></td>
+  </tr>";
 }
 
-if (!empty($pref['news_subheader']))
+if (!USER)
 {
-    $text .= " <tr>
-	<td colspan='2' class='forumheader3'>" . $tp->toHTML($pref['news_subheader'], TRUE,'TITLE') . "</td>
-	</tr>";
+  $text .= "
+  <tr>
+    <td style='width:20%' class='forumheader3'>".LAN_7."</td>
+    <td style='width:80%' class='forumheader3'>
+      <input class='tbox' type='text' name='submitnews_name' size='60' value='".$tp->toHTML($submitnews_user,FALSE,'USER_TITLE')."' maxlength='100' />
+    </td>
+  </tr>
+  <tr>
+    <td style='width:20%' class='forumheader3'>".LAN_112."</td>
+    <td style='width:80%' class='forumheader3'>
+      <input class='tbox' type='text' name='submitnews_email' size='60' value='".$tp->toHTML($submitnews_email, FALSE, 'LINKTEXT')."' maxlength='100' />
+    </td>
+  </tr>";
 }
 
-$text .= " <tr>
-	<td style='width:20%' class='forumheader3'>" . NWSLAN_6 . ": </td>
+$text .= "
+<tr>
+  <td style='width:20%' class='forumheader3'>".NWSLAN_6.": </td>
 	<td style='width:80%' class='forumheader3'>";
+
 if (!$sql->db_Select("news_category"))
 {
-    $text .= NWSLAN_10;
+	$text .= NWSLAN_10;
 }
 else
 {
-    $text .= "
-	<select name='cat_id' class='tbox'>";
-    while (list($cat_id, $cat_name, $cat_icon) = $sql->db_Fetch())
-    {
-		$sel = ($_POST['cat_id'] == $cat_id) ? "selected='selected'" : "";
-        $text .= "<option value='{$cat_id}' {$sel}>" . $tp->toHTML($cat_name,FALSE,"defs") . "</option>";
-    }
-    $text .= "</select>";
+	$text .= "
+		<select name='submitnews_category' class='tbox'>";
+	while (list($cat_id, $cat_name, $cat_icon) = $sql->db_Fetch())
+	{
+		$sel = ($_POST['submitnews_category'] == $cat_id) ? "selected='selected'" : "";
+		$text .= "<option value='{$cat_id}' {$sel}>".$tp->toHTML($cat_name, FALSE, "defs")."</option>";
+	}
+	$text .= "</select>";
 }
-$text .= "</td>
-	</tr><tr>
-	<td style='width:20%' class='forumheader3'>" . LAN_62 . "</td>
+
+$text .= "
+  </td>
+</tr>
+<tr>
+  <td style='width:20%' class='forumheader3'>".LAN_62."</td>
 	<td style='width:80%' class='forumheader3'>
-	<input class='tbox' type='text' id='itemtitle' name='itemtitle' size='60' value='{$itemtitle}' maxlength='200' style='width:90%' />
+    <input class='tbox' type='text' id='submitnews_title' name='submitnews_title' size='60' value='".$tp->toHTML($_POST['submitnews_title'],TRUE,'USER_TITLE')."' maxlength='200' style='width:90%' />
 	</td>
-	</tr>";
-
+</tr>";
 
 if (e_WYSIWYG)
 {
-  $insertjs = "rows='25' ";
+  $insertjs = "rows='25'";
 }
 else
 {
@@ -176,62 +209,67 @@
 }
 
 $text .= "
-	<tr>
-	<td style='width:20%' class='forumheader3'>" . LAN_135 . "</td>
+<tr>
+  <td style='width:20%' class='forumheader3'>".LAN_135."</td>
 	<td style='width:80%' class='forumheader3'>
-	<textarea class='tbox' id='e107_submitnews_item' name='e107_submitnews_item'  cols='80'  style='max-width:95%' {$insertjs}></textarea><br />";
+    <textarea class='tbox' id='submitnews_item' name='submitnews_item' cols='80' style='max-width:95%' {$insertjs}>".$tp->toHTML($_POST['submitnews_item'],TRUE,'USER_BODY')."</textarea><br />";
 
 if (!e_WYSIWYG)
 {
   $text .= display_help("helpb","submitnews");
 }
-$text .= "	</td>
-	</tr>\n";
+
+$text .= "
+  </td>
+</tr>";
+
 if ($pref['subnews_attach'] && $pref['upload_enabled'] && check_class($pref['upload_class']) && FILE_UPLOADS)
 {
-    $text .= "
-		<tr>
-		<td style='width:20%' class='forumheader3'>" . SUBNEWSLAN_5 . "<br /><span class='smalltext'>" . SUBNEWSLAN_6 . "</span></td>
-		<td style='width:80%' class='forumheader3'>
-		<input class='tbox' type='file' name='file_userfile[]' style='width:90%' />
-		</td>
-		</tr>\n";
+  $text .= "
+  <tr>
+    <td style='width:20%' class='forumheader3'>".SUBNEWSLAN_5."<br /><span class='smalltext'>".SUBNEWSLAN_6."</span></td>
+    <td style='width:80%' class='forumheader3'>
+      <input class='tbox' type='file' name='file_userfile[]' style='width:90%' />
+    </td>
+  </tr>";
 }
 
 $text .= "
-	<tr>
-	<td colspan='2' style='text-align:center' class='forumheader'>
-	<input class='button' type='submit' name='submit' value='" . LAN_136 . "' />
-	</td>
-	</tr>
-	</table>
-	</form>
-	</div>";
+      <tr>
+        <td colspan='2' style='text-align:center' class='forumheader'>
+          <input class='button' type='submit' name='submitnews_submit' value='".LAN_136."' />
+        </td>
+      </tr>
+    </table>
+  </form>
+</div>";
+
 $ns->tablerender(LAN_136, $text);
 require_once(FOOTERF);
 
 function headerjs()
 {
-  $adder = '';
+  $adder = "";
   if (e_WYSIWYG) $adder = 'tinyMCE.triggerSave();';
-  $script = "<script type=\"text/javascript\">
-		function frmVerify()
-		{
-		  {$adder}
-		  if(document.getElementById('itemtitle').value == \"\")
-		  {
-			alert('" . SUBNEWSLAN_1 . "');
-			return false;
-		  }
-
-		  if(document.getElementById('e107_submitnews_item').value == \"\")
-		  {
-			alert('" . SUBNEWSLAN_2 . "');
-			return false;
-		  }
-		}
-		</script>";
-    return $script;
+  $script = "
+  <script type=\"text/javascript\">
+  function frmVerify()
+  {
+    {$adder}
+    if(document.getElementById('submitnews_title').value == \"\")
+    {
+    alert('".SUBNEWSLAN_1."');
+    return false;
+    }
+
+    if(document.getElementById('submitnews_item').value == \"\")
+    {
+    alert('".SUBNEWSLAN_2."');
+    return false;
+    }
+  }
+  </script>";
+  return $script;
 }
 
 ?>
diff -x .svn -aruN 0.7.15.src/upload.php 0.7.16.src/upload.php
--- 0.7.15.src/upload.php	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/upload.php	2009-07-22 14:17:59.000000000 -0500
@@ -11,8 +11,8 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/upload.php,v $
-|     $Revision: 1.19 $
-|     $Date: 2008/12/08 21:15:40 $
+|     $Revision: 1.20 $
+|     $Date: 2009/07/22 19:18:23 $
 |     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
@@ -266,7 +266,7 @@
 			var errorMessages = new Array('".LAN_UL_032."', '".LAN_UL_033."', '".LAN_UL_034."', '".LAN_UL_036."', '".LAN_UL_035."');
 			var temp;
 			var i;
-			for (i = 0; i < 4; i++)
+			for (i = 0; i < 5; i++)
 			{
 				temp = document.getElementById(testObjects[i]);
 				if (temp && (temp.value == \"\"))
diff -x .svn -aruN 0.7.15.src/userposts.php 0.7.16.src/userposts.php
--- 0.7.15.src/userposts.php	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/userposts.php	2009-08-23 05:39:27.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/userposts.php,v $
-|     $Revision: 1.30 $
-|     $Date: 2008/07/03 20:06:56 $
-|     $Author: e107steved $
+|     $Revision: 1.31 $
+|     $Date: 2009/08/23 10:39:51 $
+|     $Author: marj_nl_fr $
 +----------------------------------------------------------------------------+
 */
 require_once("class2.php");
@@ -217,7 +217,16 @@
 
 	$gen = new convert;
 	$datestamp = $gen->convert_date($row['comment_datestamp'], "short");
-	$USERPOSTS_COMMENTS_ICON		= "<img src='".THEME."images/".BULLET."' alt='' />";
+	$bullet = '';
+	if(defined('BULLET'))
+	{
+		$bullet = '<img src="'.THEME.'images/'.BULLET.'" alt="" style="vertical-align: middle;" />';
+	}
+	elseif(file_exists(THEME.'images/bullet2.gif'))
+	{
+		$bullet = '<img src="'.THEME.'images/bullet2.gif" alt="" style="vertical-align: middle;" />';
+	}
+	$USERPOSTS_COMMENTS_ICON		= $bullet;
 	$USERPOSTS_COMMENTS_DATESTAMP	= UP_LAN_11." ".$datestamp;
 	$USERPOSTS_COMMENTS_HEADING		= $row['comment_title'];
 	$USERPOSTS_COMMENTS_COMMENT		= $row['comment_comment'];
diff -x .svn -aruN 0.7.15.src/usersettings.php 0.7.16.src/usersettings.php
--- 0.7.15.src/usersettings.php	2008-12-10 12:41:05.000000000 -0600
+++ 0.7.16.src/usersettings.php	2009-07-14 14:26:00.000000000 -0500
@@ -11,12 +11,11 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/usersettings.php,v $
-|     $Revision: 1.104 $
-|     $Date: 2008/11/22 10:19:58 $
+|     $Revision: 1.111 $
+|     $Date: 2009/07/14 19:26:24 $
 |     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
-
 require_once("class2.php");
 require_once(e_HANDLER."ren_help.php");
 require_once(e_HANDLER."user_extended_class.php");
@@ -50,13 +49,35 @@
 
 require_once(e_HANDLER."calendar/calendar_class.php");
 $cal = new DHTML_Calendar(true);
-$_uid = is_numeric(e_QUERY) ? intval(e_QUERY) : "";
 $sesschange = '';						// Notice removal
 $photo_to_delete = '';
 $avatar_to_delete = '';
 
-require_once(HEADERF);
+$inp = USERID;
+$_uid = false;
+if(is_numeric(e_QUERY))
+{
+	if(ADMIN)
+	{
+		$inp = (int)e_QUERY;
+		$_uid = $inp;
+		$info = get_user_data($inp);
+		//Only site admin is able to change setting for other admins
+		if(!is_array($info) || ($info['user_admin'] == 1 && (!defined('ADMINPERMS') || ADMINPERMS !== '0')))
+		{
+			header('location:'.e_BASE.'index.php');
+  		exit;
+		}
+	}
+	else
+	{
+		//Non admin attempting to edit another user's ID
+		header('location:'.e_BASE.'index.php');
+	  exit;
+	}
+}
 
+require_once(HEADERF);
 
 // Given an array of user data, return a comma separated string which includes public, admin, member classes etc as appropriate.
 function addCommonClasses($udata)
@@ -95,6 +116,7 @@
 		$_POST['password2'] = '';
 	}
 
+/*
 	if ($_uid && ADMIN)
 	{	// Admin logged in and editing another user's settings - so editing a different ID
 	  $inp = $_uid;
@@ -104,6 +126,9 @@
 	{	// Current user logged in - use their ID
 	  $inp = USERID;
 	}
+*/
+
+//	echo "inp = $inp <br />";
 	$udata = get_user_data($inp);				// Get all the user data, including any extended fields
 	$peer = ($inp == USERID ? false : true);
 	$udata['user_classlist'] = addCommonClasses($udata);
@@ -227,7 +252,7 @@
 	// Check Email address against banlist.
 	$wc = make_email_query($_POST['email']);
 	if ($wc) $wc = ' OR '.$wc;
-	
+
 	if (($wc === FALSE) || ($do_email_validate && $sql->db_Select("banlist", "*", "banlist_ip='".$_POST['email']."'".$wc)))
 	{
 	  $error .= LAN_106."\\n";
@@ -334,17 +359,17 @@
 
 
     // Validate Extended User Fields.
+	$ue_fields = "";
 	if($_POST['ue'])
 	{
-	  if($sql->db_Select('user_extended_struct'))	
-	  {
-		while($row = $sql->db_Fetch())
+		if($sql->db_Select('user_extended_struct'))
 		{
-		  $extList["user_".$row['user_extended_struct_name']] = $row;
+			while($row = $sql->db_Fetch())
+			{
+			  $extList["user_".$row['user_extended_struct_name']] = $row;
+			}
 		}
-	  }
 
-		$ue_fields = "";
 		foreach($_POST['ue'] as $key => $val)
 		{
 			if (isset($extList[$key]))
@@ -367,6 +392,15 @@
 				}
 			}
 		}
+
+		$ueHide = array();
+		foreach (array_keys($_POST['hide']) as $key)
+		{
+			if (isset($extList[$key]))
+			{
+				$ueHide[] = $tp->toDB($key);
+			}
+		}
     }
 
 
@@ -378,8 +412,8 @@
 	{
 	  unset($_POST['password1']);
 	  unset($_POST['password2']);
-	  
-	  
+
+
       $_POST['user_id'] = intval($inp);
 
 
@@ -413,7 +447,7 @@
 //			if (isset($_POST['username']) && check_class($pref['displayname_class']))
 		if (isset($_POST['username']) && check_class($pref['displayname_class'], $udata['user_classlist'], $peer))
 		{	// Allow change of display name if in right class
-		  $username = strip_tags($_POST['username']);
+		  $username = trim(strip_tags($_POST['username']));
 		  $username = $tp->toDB(substr($username, 0, $pref['displayname_maxlength']));
 		  $new_username = "user_name = '{$username}', ";
 		}
@@ -425,19 +459,19 @@
 		$new_customtitle = "";
 		if(isset($_POST['customtitle']) && ($pref['forum_user_customtitle'] || ADMIN))
 		{
-		  $new_customtitle = ", user_customtitle = '".$tp->toDB($_POST['customtitle'])."' ";
+			$new_customtitle = ", user_customtitle = '".$tp->toDB($_POST['customtitle'])."' ";
 		}
 
 
 		// Extended fields - handle any hidden fields
 		if($ue_fields)
 		{
-		  $hidden_fields = implode("^", array_keys($_POST['hide']));
-		  if($hidden_fields != "")
-		  {
-			$hidden_fields = "^".$hidden_fields."^";
-		  }
-		  $ue_fields .= ", user_hidden_fields = '".$hidden_fields."'";
+			$hiddenFields = implode("^", $ueHide);
+			if($hiddenFields != "")
+			{
+				$hiddenFields = "^".$hiddenFields."^";
+			}
+			$ue_fields .= ", user_hidden_fields = '".$hiddenFields."'";
 		}
 
 
@@ -484,7 +518,7 @@
 			$cur_classes = explode(",", $udata['user_class']);			// Current class membership
 			$newclist = array_flip($cur_classes);						// Array keys are now the class IDs
 
-			// Update class list - we must take care to only change those classes a user can edit themselves 
+			// Update class list - we must take care to only change those classes a user can edit themselves
 			foreach ($ucList as $c)
 			{
 			  $cid = $c['userclass_id'];
@@ -516,14 +550,14 @@
 		$e_event->trigger("postuserset", $_POST);
 
 
-		if(e_QUERY == "update") 
+		if(e_QUERY == "update")
 		{
           header("Location: index.php");
 		}
 		$message = "<div style='text-align:center'>".LAN_150."</div>";
 		$caption = LAN_151;
-	  } 
-	  else 
+	  }
+	  else
 	  {	// Invalid data
 		$message = "<div style='text-align:center'>".$ret."</div>";
 		$caption = LAN_151;
@@ -561,15 +595,15 @@
 $curVal=$sql->db_Fetch();
 $curVal['userclass_list'] = addCommonClasses($curVal);
 
-if($_POST)
+if($_POST && $error)
 {     // Fix for all the values being lost when an error occurred.
 	foreach($_POST as $key => $val)
 	{
-		$curVal["user_".$key] = $val;
+		$curVal["user_".$key] = $tp->post_toForm($val);
 	}
 	foreach($_POST['ue'] as $key => $val)
 	{
-		$curVal[$key] = $val;
+		$curVal[$key] = $tp->post_toForm($val);
 	}
 }
 
@@ -593,8 +627,32 @@
 	";
 
 $ns->tablerender(LAN_155, $text);
+
+deleteExpired(ADMIN);			// This will clean up the user and user_extended databases
+
 require_once(FOOTERF);
 
+
+
+// Delete 'expired' user records, clean up user_extended DB
+function deleteExpired($force = FALSE)
+{
+	global $pref, $sql;
+	$temp1 = 0;
+	if (isset($pref['del_unv']) && $pref['del_unv'] && $pref['user_reg_veri'] != 2)
+	{
+		$threshold= intval(time() - ($pref['del_unv'] * 60));
+		if (($temp1 = $sql->db_Delete('user', 'user_ban = 2 AND user_join < '.$threshold)) > 0) { $force = TRUE; }
+	}
+	if ($force)
+	{	// Remove 'orphaned' extended user field records
+		$sql->db_Select_gen("DELETE `#user_extended` FROM `#user_extended` LEFT JOIN `#user` ON `#user_extended`.`user_extended_id`=`#user`.`user_id`
+				WHERE `#user`.`user_id` IS NULL");
+	}
+	return $temp1;
+}
+
+
 //------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------//
 
 function req($field) {
@@ -617,12 +675,12 @@
 {
   global $sql;
   if (!$fname) return FALSE;
-  
-  if (preg_match("#Binary (.*?)/#", $fname, $match)) 
+
+  if (preg_match("#Binary (.*?)/#", $fname, $match))
   {
 	return $sql -> db_Delete("rbinary", "binary_id='".$tp -> toDB($match[1])."'");
   }
-  elseif (file_exists(e_FILE."public/".$dir.$fname)) 
+  elseif (file_exists(e_FILE."public/".$dir.$fname))
   {
 	unlink(e_FILE."public/".$dir.$fname);
 	return TRUE;
