diff -x .svn -aruN 0.7.24.src/class2.php 0.7.26.src/class2.php
--- 0.7.24.src/class2.php	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/class2.php	2011-08-12 14:26:16.000000000 -0500
@@ -10,9 +10,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $URL: https://e107.svn.sourceforge.net/svnroot/e107/trunk/e107_0.7/class2.php $
-|     $Revision: 11786 $
-|     $Id: class2.php 11786 2010-09-15 22:12:49Z e107coders $
-|     $Author: e107coders $
+|     $Revision: 12328 $
+|     $Id: class2.php 12328 2011-08-12 19:26:40Z nlstart $
+|     $Author: nlstart $
 +----------------------------------------------------------------------------+
 */
 //
@@ -44,11 +44,11 @@
 $eTimingStart = microtime();					// preserve these when destroying globals in step C
 $oblev_before_start = ob_get_level();
 
-// Filter common bad agents / queries. 
-if(strpos($_SERVER['QUERY_STRING'],"=http")!==FALSE || strpos($_SERVER["HTTP_USER_AGENT"],"libwww-perl")!==FALSE)
-{
-	exit();
-}
+// Block common bad agents / queries / php issues. 
+array_walk($_SERVER,  'e107_filter', '_SERVER');
+if (isset($_GET)) array_walk($_GET,     'e107_filter', '_GET');
+if (isset($_POST)) array_walk($_POST,    'e107_filter', '_POST');
+if (isset($_COOKIE)) array_walk($_COOKIE,  'e107_filter', '_COOKIE');
 
 //
 // B: Remove all output buffering
@@ -77,7 +77,7 @@
 }
 
 
-if(($pos = strpos($_SERVER['PHP_SELF'], ".php/")) !== false) // redirect bad URLs to the correct one.
+if(($pos = strpos(strtolower($_SERVER['PHP_SELF']), ".php/")) !== false) // redirect bad URLs to the correct one.
 {
 	$new_url = substr($_SERVER['PHP_SELF'], 0, $pos+4);
 	$new_loc = ($_SERVER['QUERY_STRING']) ? $new_url."?".$_SERVER['QUERY_STRING'] : $new_url;
@@ -85,7 +85,7 @@
 	exit();
 }
 // If url contains a .php in it, PHP_SELF is set wrong (imho), affecting all paths.  We need to 'fix' it if it does.
-$_SERVER['PHP_SELF'] = (($pos = strpos($_SERVER['PHP_SELF'], ".php")) !== false ? substr($_SERVER['PHP_SELF'], 0, $pos+4) : $_SERVER['PHP_SELF']);
+$_SERVER['PHP_SELF'] = (($pos = strpos(strtolower($_SERVER['PHP_SELF']), ".php")) !== false ? substr($_SERVER['PHP_SELF'], 0, $pos+4) : $_SERVER['PHP_SELF']);
 unset($pos);
 //
 // D: Setup PHP error handling
@@ -108,6 +108,7 @@
 
 
 
+
 if(isset($retrieve_prefs) && is_array($retrieve_prefs)) {
 	foreach ($retrieve_prefs as $key => $pref_name) {
 		 $retrieve_prefs[$key] = preg_replace("/\W/", '', $pref_name);
@@ -139,7 +140,7 @@
 		$domain = FALSE; //invalid domain
 	}
 	
-	$replace = array(".".$domain,"www.","www");
+	$replace = array(".".$domain,"www.","www",$domain);
 	$subdomain = str_replace($replace,'',$_SERVER['HTTP_HOST']);
 }
 
@@ -199,7 +200,20 @@
 }
 unset($inArray);
 
-// Session start. 
+/**
+ * NEW - system security levels
+ * Could be overridden by e107_config.php OR $CLASS2_INCLUDE script (if not set earlier)
+ * 
+ * 0 (disabled)
+ * 5 (balanced) - token value once per session
+ * 8 (high) - token value regenerated on every page load
+ * 10 (insane) - #8 + regenerate SID on every page load
+ * default is 5
+ */
+if(!defined('e_SECURITY_LEVEL')) 
+{
+	define('e_SECURITY_LEVEL', 5);
+}
 
 /**
  * G: Retrieve Query data from URI
@@ -397,7 +411,12 @@
 //
 define("SITEURLBASE", ($pref['ssl_enabled'] == '1' ? "https://" : "http://").$_SERVER['HTTP_HOST']);
 define("SITEURL", SITEURLBASE.e_HTTP);
-define("e_SELF", ($pref['ssl_enabled'] == '1' ? "https://".$_SERVER['HTTP_HOST'] : "http://".$_SERVER['HTTP_HOST']) . ($_SERVER['PHP_SELF'] ? $_SERVER['PHP_SELF'] : $_SERVER['SCRIPT_FILENAME']));
+
+if(!defined('e_SELF')) // user override option 
+{
+	define("e_SELF", ($pref['ssl_enabled'] == '1' ? "https://".$_SERVER['HTTP_HOST'] : "http://".$_SERVER['HTTP_HOST']) . ($_SERVER['PHP_SELF'] ? $_SERVER['PHP_SELF'] : $_SERVER['SCRIPT_FILENAME']));	
+}
+
 $page = substr(strrchr($_SERVER['PHP_SELF'], "/"), 1);
 define("e_PAGE", $page);
 	  
@@ -455,20 +474,38 @@
 	session_cache_limiter("must-revalidate");	
 }
 
+$SESS_NAME = strtoupper(preg_replace("/[\W_]/","",$pref['cookie_name'])); // clean-up characters.  
+session_name('SESS'.$SESS_NAME); // avoid session conflicts with separate sites within subdomains
+unset($SESS_NAME);
+
 // Start session after $prefs are available.
 session_start(); // Needs to be started after language detection (session.cookie_domain) to avoid multi-language 'access-denied' issues. 
 header("Cache-Control: must-revalidate");	
 // TODO - maybe add IP as well?
 define('e_TOKEN_NAME', 'e107_token_'.md5($_SERVER['HTTP_HOST'].e_HTTP));
 
-if(isset($_SESSION) && isset($_POST['e-token']) && ($_POST['e-token'] != $_SESSION[e_TOKEN_NAME]) && $_POST['ajax_used']!=1)
+// Ajax calls should be handled manual at this time (set e_TOKEN_FREEZE in Ajax scripts before the API is loaded)
+if(e_SECURITY_LEVEL > 0 && session_id() && isset($_POST['e-token']) && ($_POST['e-token'] != varset($_SESSION[e_TOKEN_NAME]))/* && $_POST['ajax_used']!=1*/)
 {
-	// do not redirect, prevent dead loop, save server resources
+	if(defsettrue('e_DEBUG'))
+	{		
+		$details = "HOST: ".$_SERVER['HTTP_HOST']."\n";
+		$details .= "REQUEST_URI: ".$_SERVER['REQUEST_URI']."\n";		
+		$details .= "_SESSION:\n";
+		$details .= print_r($_SESSION,true);
+		$details .= "\n_POST:\n";
+		$details .= print_r($_POST,true);
+		$details .= "\nPlugins:\n";
+		$details .= print_r($pref['plug_installed'],true);
+			
+		$admin_log->log_event("Access denied", $details, E_LOG_WARNING);				
+	}	
+		// do not redirect, prevent dead loop, save server resources
 	die('Access denied');
-}	
+}
 
-// Create new token only if not exists or session id is regenerated (footer.php)
-if(!isset($_SESSION[e_TOKEN_NAME]) || (isset($_SESSION['regenerate_'.e_TOKEN_NAME]) && !defsettrue('e_TOKEN_FREEZE')))
+// Create new token only if not exists or session id is regenerated (footer.php), respect security level
+if(!isset($_SESSION[e_TOKEN_NAME]) || (e_SECURITY_LEVEL >= 8 && isset($_SESSION['regenerate_'.e_TOKEN_NAME]) && !defsettrue('e_TOKEN_FREEZE')))
 {
 	// we should not break ajax calls this way
 	$_SESSION[e_TOKEN_NAME] = uniqid(md5(rand()), true);
@@ -562,6 +599,7 @@
 include_lan(e_LANGUAGEDIR.e_LANGUAGE."/".e_LANGUAGE.".php");
 include_lan(e_LANGUAGEDIR.e_LANGUAGE."/".e_LANGUAGE."_custom.php");
 
+define('e_LOCALE',(strtolower(CORE_LC)."-".strtoupper(CORE_LC2)));
 //
 // N: misc setups: online user tracking, cache
 //
@@ -572,18 +610,20 @@
 $e107cache = new ecache;
 
 
-if (isset($pref['del_unv']) && $pref['del_unv'] && $pref['user_reg_veri'] != 2) {
-	$threshold=(time() - ($pref['del_unv'] * 60));
-	$sql->db_Delete("user", "user_ban = 2 AND user_join < '{$threshold}' ");
+if (isset($pref['del_unv']) && $pref['del_unv'] && $pref['user_reg_veri'] != 2) 
+{
+	$threshold = intval(time() - ($pref['del_unv'] * 60));
+	$sql->db_Delete('user', "user_ban = 2 AND user_join < ".$threshold);
 }
 
-e107_require_once(e_HANDLER."override_class.php");
+e107_require_once(e_HANDLER.'override_class.php');
 $override=new override;
 
-e107_require_once(e_HANDLER."event_class.php");
+e107_require_once(e_HANDLER.'event_class.php');
 $e_event=new e107_event;
 
-if (isset($pref['notify']) && $pref['notify'] == true) {
+if (isset($pref['notify']) && $pref['notify'] == true) 
+{
 	e107_require_once(e_HANDLER.'notify_class.php');
 }
 
@@ -594,7 +634,7 @@
 init_session();
 
 // for multi-language these definitions needs to come after the language loaded.
-define("SITENAME", trim($tp->toHTML($pref['sitename'], "", 'USER_TITLE,value,defs')));
+define("SITENAME", trim($tp->toHTML($pref['sitename'], "", 'USER_TITLE,defs')));
 define("SITEBUTTON", $pref['sitebutton']);
 define("SITETAG", $tp->toHTML($pref['sitetag'], FALSE, "emotes_off, defs"));
 define("SITEDESCRIPTION", $tp->toHTML($pref['sitedescription'], "", "emotes_off,defs"));
@@ -748,9 +788,15 @@
 $sql->db_Mark_Time('Start: Signup/splash/admin');
 
 define("e_SIGNUP", e_BASE.(file_exists(e_BASE."customsignup.php") ? "customsignup.php" : "signup.php"));
-define("e_LOGIN", e_BASE.(file_exists(e_BASE."customlogin.php") ? "customlogin.php" : "login.php"));
 
-if ($pref['membersonly_enabled'] && !USER && e_SELF != SITEURL.e_SIGNUP && e_SELF != SITEURL."index.php" && e_SELF != SITEURL."fpw.php" && e_SELF != SITEURL.e_LOGIN && strpos(e_PAGE, "admin") === FALSE && e_SELF != SITEURL.'membersonly.php' && e_SELF != SITEURL.'sitedown.php') {
+if(!defined('e_LOGIN')) // customizable via e107_config.php
+{
+	define("e_LOGIN", e_BASE.(file_exists(e_BASE."customlogin.php") ? "customlogin.php" : "login.php"));	
+}
+
+
+if ($pref['membersonly_enabled'] && !USER && e_SELF != SITEURL.e_SIGNUP && e_SELF != SITEURL."index.php" && e_SELF != SITEURL."fpw.php" && e_SELF != SITEURL.e_LOGIN && strpos(e_PAGE, "admin") === FALSE && e_SELF != SITEURL.'membersonly.php' && e_SELF != SITEURL.'sitedown.php')
+{
 	header("Location: ".e_HTTP."membersonly.php");
 	exit();
 }
@@ -760,7 +806,7 @@
 
 
 if (varset($pref['maintainance_flag'])
- && strpos(e_SELF, 'admin.php') === FALSE && strpos(e_SELF, 'sitedown.php') === FALSE)
+ && strpos(e_SELF, 'admin.php') === FALSE && strpos(e_SELF, 'sitedown.php') === FALSE && strpos(e_SELF, '/secure_img_render.php') === FALSE)
 {
 	if(!ADMIN || ($pref['maintainance_flag'] == e_UC_MAINADMIN && !getperms('0')))
 	{
@@ -781,7 +827,10 @@
 {
 	$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 (isset($pref['track_online']) && $pref['track_online'])
+	{
+		$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')
 	{
@@ -813,7 +862,7 @@
 
 if (isset($_COOKIE['e107_tdOffset'])) {
 	// Actual seconds of delay. See e107.js and footer_default.php
-	$e_deltaTime = $_COOKIE['e107_tdOffset'];
+	$e_deltaTime = (15*floor((($_COOKIE['e107_tdOffset'] + 450)/60)/15))*60; // Delay in seconds rounded to the nearest quarter hour
 }
 
 if (isset($_COOKIE['e107_tzOffset'])) {
@@ -1175,7 +1224,7 @@
 		}
 	}
 
-	$var = $sql->db_Fetch();
+	$var = $sql->db_Fetch(MYSQL_ASSOC);
 	$extended_struct = getcachedvars("extended_struct");
 	if(!$extended_struct)
 	{
@@ -1183,7 +1232,7 @@
 		$qry = "SHOW COLUMNS FROM #user_extended ";
 		if($sql->db_Select_gen($qry))
 		{
-			while($row = $sql->db_Fetch())
+			while($row = $sql->db_Fetch(MYSQL_ASSOC))
 			{
 				if($row['Default'] != "")
 				{
@@ -1465,15 +1514,15 @@
 			$update_ip = ($result['user_ip'] != USERIP ? ", user_ip = '".USERIP."'" : "");
 
 			if($result['user_currentvisit'] + 3600 < time() || !$result['user_lastvisit'])
-			{
+			{	// New visit
 				$result['user_lastvisit'] = $result['user_currentvisit'];
 				$result['user_currentvisit'] = time();
-				$sql->db_Update("user", "user_visits = user_visits + 1, user_lastvisit = '{$result['user_lastvisit']}', user_currentvisit = '{$result['user_currentvisit']}', user_viewed = ''{$update_ip} WHERE user_id='".USERID."' ");
+				$sql->db_Update('user', "user_visits = user_visits + 1, user_lastvisit = '{$result['user_lastvisit']}', user_currentvisit = '{$result['user_currentvisit']}', user_viewed = ''{$update_ip} WHERE user_id=".USERID);
 			}
 			else
 			{
 				$result['user_currentvisit'] = time();
-				$sql->db_Update("user", "user_currentvisit = '{$result['user_currentvisit']}'{$update_ip} WHERE user_id='".USERID."' ");
+				$sql->db_Update('user', "user_currentvisit = '{$result['user_currentvisit']}'{$update_ip} WHERE user_id=".USERID);
 			}
 
 			$currentUser = $result;
@@ -1673,7 +1722,88 @@
 	return $ret;
 }
 
-function include_lan($path, $force = false)
+function e107_filter($input,$key,$type,$base64=FALSE)
+{
+	if(is_string($input) && trim($input)=="")
+	{
+		return;
+	}
+		
+	if(is_array($input))
+	{
+		return array_walk($input, 'e107_filter', $type);	
+	} 
+			
+	if($type == "_POST" || ($type == "_SERVER" && ($key == "QUERY_STRING")))
+	{
+		if($type == "_POST" && ($base64 == FALSE))
+		{
+			$input = preg_replace("/(\[code\])(.*?)(\[\/code\])/is","",$input);
+		}
+	
+		$regex = "/(document\.write|base64_decode|chr|php_uname|fwrite|fopen|fputs|passthru|popen|proc_open|shell_exec|exec|proc_nice|proc_terminate|proc_get_status|proc_close|pfsockopen|apache_child_terminate|posix_kill|posix_mkfifo|posix_setpgid|posix_setsid|posix_setuid|phpinfo) *?\((.*) ?\;?/i";
+		if(preg_match($regex,$input))
+		{
+			header('HTTP/1.0 400 Bad Request', true, 400);
+			exit();
+		}
+		
+		if(preg_match("/system *?\((.*);.*\)/i",$input))
+		{
+			header('HTTP/1.0 400 Bad Request', true, 400);
+			exit();	
+		}
+		
+		$regex = "/(wget |curl -o |fetch |lwp-download|onmouse)/i";
+		if(preg_match($regex,$input))
+		{
+			header('HTTP/1.0 400 Bad Request', true, 400);
+			exit();
+		}
+	
+	}
+	
+	if($type == "_SERVER")
+	{	
+
+		if(($key == "QUERY_STRING") && (
+			strpos(strtolower($input),"../../")!==FALSE 
+			|| strpos(strtolower($input),"=http")!==FALSE 
+			|| strpos(strtolower($input),"http%3A%2F%2F")!==FALSE
+			|| strpos(strtolower($input),"php://")!==FALSE  
+			|| strpos(strtolower($input),"data://")!==FALSE
+			))
+		{
+			header('HTTP/1.0 400 Bad Request', true, 400);
+			exit();
+		}
+					
+		if(($key == "HTTP_USER_AGENT") && strpos($input,"libwww-perl")!==FALSE)
+		{
+			header('HTTP/1.0 400 Bad Request', true, 400);
+			exit();	
+		}
+		
+						
+	}
+		
+	if(strpos(str_replace('.', '', $input), '22250738585072011') !== FALSE) // php-bug 53632
+	{
+		header('HTTP/1.0 400 Bad Request', true, 400);
+		exit();
+	} 
+	
+	if($base64 != TRUE)
+	{
+		e107_filter(base64_decode($input),$key,$type,TRUE);
+	}
+	
+}
+
+
+
+
+function include_lan($path, $force = FALSE)
 {
 	if ( ! is_readable($path))
 	{
diff -x .svn -aruN 0.7.24.src/comment.php 0.7.26.src/comment.php
--- 0.7.24.src/comment.php	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/comment.php	2011-05-04 16:34:30.000000000 -0500
@@ -10,8 +10,8 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $URL: https://e107.svn.sourceforge.net/svnroot/e107/trunk/e107_0.7/comment.php $
-|     $Revision: 11708 $
-|     $Id: comment.php 11708 2010-08-27 06:53:48Z e107steved $
+|     $Revision: 12190 $
+|     $Id: comment.php 12190 2011-05-04 21:34:54Z e107steved $
 |     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
@@ -356,7 +356,7 @@
 			$e_comment = $cobj->get_e_comment();
 			if ($table == $e_comment[$table]['eplug_comment_ids'])
 			{
-				if ($sql->db_Select($table,$e_comment[$table]['db_title'],$e_comment[$table]['db_id']."={$id} "))
+				if ($sql->db_Select($e_comment[$table]['db_table'],$e_comment[$table]['db_title'],$e_comment[$table]['db_id']."={$id} "))
 				{
 				  $row = $sql->db_Fetch();
 				  $subject = $row[$e_comment[$table]['db_title']];
diff -x .svn -aruN 0.7.24.src/contact.php 0.7.26.src/contact.php
--- 0.7.24.src/contact.php	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/contact.php	2011-03-12 06:37:53.000000000 -0600
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $URL: https://e107.svn.sourceforge.net/svnroot/e107/trunk/e107_0.7/contact.php $
-|     $Revision: 11678 $
-|     $Id: contact.php 11678 2010-08-22 00:43:45Z e107coders $
-|     $Author: e107coders $
+|     $Revision: 12098 $
+|     $Id: contact.php 12098 2011-03-12 12:38:17Z e107steved $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 
@@ -30,7 +30,7 @@
 	require_once(e_HANDLER."secure_img_handler.php");
 	$sec_img = new secure_image;
 
-if (!$CONTACT_FORM)
+if (!isset($CONTACT_FORM) || !$CONTACT_FORM)
 {
 	if (file_exists(THEME."contact_template.php"))
 	{
@@ -167,6 +167,7 @@
 
 if(SITECONTACTINFO && $CONTACT_INFO)
 {
+	require_once(e_FILE."shortcode/batch/contact_shortcodes.php");
 	$text = $tp->parseTemplate($CONTACT_INFO, TRUE, $contact_shortcodes);
 	$ns -> tablerender(LANCONTACT_01, $text,"contact");
 }
diff -x .svn -aruN 0.7.24.src/download.php 0.7.26.src/download.php
--- 0.7.24.src/download.php	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/download.php	2011-07-18 13:28:15.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $URL: https://e107.svn.sourceforge.net/svnroot/e107/trunk/e107_0.7/download.php $
-|     $Revision: 11678 $
-|     $Id: download.php 11678 2010-08-22 00:43:45Z e107coders $
-|     $Author: e107coders $
+|     $Revision: 12321 $
+|     $Id: download.php 12321 2011-07-18 18:28:39Z nlstart $
+|     $Author: nlstart $
 |
 +----------------------------------------------------------------------------+
 */
@@ -101,7 +101,7 @@
 				extract($row);
 				$type = $download_category_name;
 				$type .= ($download_category_description) ? " [ ".$download_category_description." ]" : "";
-				define("e_PAGETITLE", PAGE_NAME." / ".$download_category_name);
+				define("e_PAGETITLE", $download_category_name." / ".PAGE_NAME);
 			}
 			else
 			{  // No access to this category
@@ -199,7 +199,7 @@
 
 //	$download_cat_table_start = preg_replace("/\{(.*?)\}/e", '$\1', $DOWNLOAD_CAT_TABLE_START);
 	$download_cat_table_start = $tp->simpleParse($DOWNLOAD_CAT_TABLE_START);
-	
+
 	$DOWNLOAD_CAT_NEWDOWNLOAD_TEXT = "<img src='".IMAGE_NEW."' alt='' style='vertical-align:middle' /> ".LAN_dl_36;
 	$DOWNLOAD_CAT_SEARCH = "
 		<form method='get' action='".e_BASE."search.php'>
@@ -212,7 +212,7 @@
 
 //	$download_cat_table_end = preg_replace("/\{(.*?)\}/e", '$\1', $DOWNLOAD_CAT_TABLE_END);
 	$download_cat_table_end = $tp->simpleParse($DOWNLOAD_CAT_TABLE_END);
-	
+
 	$dl_text = $download_cat_table_start.$download_cat_table_string.$download_cat_table_end;
 
 	ob_start();
@@ -265,7 +265,17 @@
 {
 	$total_downloads = $sql->db_Count("download", "(*)", "WHERE download_category = '{$id}' AND download_active > 0 AND download_visible REGEXP '".e_CLASS_REGEXP."'");
 
+	// Auto-meta descr.
+	if(!empty($row['download_category_description']))
+	{
+		define("META_DESCRIPTION", $tp->text_truncate(
+			str_replace(
+				array('"', "'"), '', strip_tags($tp->toHTML($row['download_category_description']))
+		), 250, '...'));
+	}
+
 	require_once(HEADERF);
+
 	$text = '';
 
 	/* SHOW SUBCATS ... */
@@ -364,7 +374,7 @@
 
 //	$download_list_table_start = preg_replace("/\{(.*?)\}/e", '$\1', $DOWNLOAD_LIST_TABLE_START);
 	$download_list_table_start = $tp->simpleParse($DOWNLOAD_LIST_TABLE_START);
-	
+
 //	$download_list_table_end = preg_replace("/\{(.*?)\}/e", '$\1', $DOWNLOAD_LIST_TABLE_END);
 	$download_list_table_end = $tp->simpleParse($DOWNLOAD_LIST_TABLE_END);
 	$text .= $download_list_table_start.$download_list_table_string.$download_list_table_end;
@@ -437,12 +447,19 @@
 	if(!defined("DL_IMAGESTYLE")){ define("DL_IMAGESTYLE","border:0px");}
     if(!isset($DL_VIEW_PAGETITLE))
 	{
-    	$DL_VIEW_PAGETITLE = PAGE_NAME." / {DOWNLOAD_CATEGORY} / {DOWNLOAD_VIEW_NAME}";
+    	$DL_VIEW_PAGETITLE = "{DOWNLOAD_VIEW_NAME} / {DOWNLOAD_CATEGORY} / ".PAGE_NAME;
 	}
 
     $DL_TITLE = $tp->parseTemplate($DL_VIEW_PAGETITLE, TRUE, $download_shortcodes);
 
 	define("e_PAGETITLE", $DL_TITLE);
+	// Auto-meta descr.
+	if($dl['download_description'])
+	define("META_DESCRIPTION", $tp->text_truncate(
+		str_replace(
+			array('"', "'"), '', strip_tags($tp->parseTemplate('{DOWNLOAD_VIEW_DESCRIPTION}', TRUE, $download_shortcodes))
+		), 250, '...')
+	);
 
 	require_once(HEADERF);
 	$DL_TEMPLATE = varset($DOWNLOAD_VIEW_TABLE_START, '').$DOWNLOAD_VIEW_TABLE.varset($DOWNLOAD_VIEW_TABLE_END, '');
@@ -521,14 +538,14 @@
 
 		$sql->db_Insert('generic', "0, 'Broken Download', ".time().",'".USERID."', '{$download_name}', {$id}, '{$report_add}'");
 
-		define("e_PAGETITLE", PAGE_NAME." / ".LAN_dl_47);
+		define("e_PAGETITLE", LAN_dl_47." / ".PAGE_NAME);
 		require_once(HEADERF);
 
-		$text = LAN_dl_48."<br /><br /><a href='".e_BASE."download.php?view.".$download_id."'>".LAN_dl_49."</a";
+		$text = LAN_dl_48."<br /><br /><a href='".e_BASE."download.php?view.".$download_id."'>".LAN_dl_49."</a>";
 		$ns->tablerender(LAN_dl_50, $text);
 
 	} else {
-		define("e_PAGETITLE", PAGE_NAME." / ".LAN_dl_51." ".$download_name);
+		define("e_PAGETITLE", LAN_dl_51." ".$download_name." / ".PAGE_NAME);
 		require_once(HEADERF);
 
 		$text = "<form action='".e_SELF."?report.{$download_id}' method='post'>
@@ -612,7 +629,7 @@
 		$download_mirror_start = $tp->simpleParse($DOWNLOAD_MIRROR_START);
 //		$download_mirror_end = preg_replace("/\{(.*?)\}/e", '$\1', $DOWNLOAD_MIRROR_END);
 		$download_mirror_end = $tp->simpleParse($DOWNLOAD_MIRROR_END);
-		
+
 		$text = $download_mirror_start.$download_mirror.$download_mirror_end;
 
 		if($DOWNLOAD_MIRROR_RENDERPLAIN) {
@@ -688,6 +705,7 @@
 
 	$template = ($current_row == 1) ? $DOWNLOAD_CAT_PARENT_TABLE : str_replace("forumheader3","forumheader3 forumheader3_alt",$DOWNLOAD_CAT_PARENT_TABLE);
 
+	$tVars['DOWNLOAD_CAT_MAIN_ID'] = '';
 	$tVars['DOWNLOAD_CAT_MAIN_ICON'] = '';
 	$tVars['DOWNLOAD_CAT_MAIN_NAME'] = '';
 	$tVars['DOWNLOAD_CAT_MAIN_DESCRIPTION'] = '';
@@ -698,6 +716,7 @@
 		{
 			list($download_category_icon, $download_category_icon_empty) = explode(chr(1), $download_category_icon);
 		}
+		$tVars['DOWNLOAD_CAT_MAIN_ID'] = $row['download_category_id'];
 		$tVars['DOWNLOAD_CAT_MAIN_ICON'] = ($download_category_icon ? "<img src='".e_IMAGE."icons/".$download_category_icon."' alt='' style='float: left' />" : "&nbsp;");
 		$tVars['DOWNLOAD_CAT_MAIN_NAME'] = $tp->toHTML($download_category_name,FALSE,'TITLE');
 		$tVars['DOWNLOAD_CAT_MAIN_DESCRIPTION'] = $tp->toHTML($row['download_category_description'],TRUE,'DESCRIPTION');
@@ -735,6 +754,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);
 
+	$tVars['DOWNLOAD_CAT_SUB_ID'] = $row['download_category_id'];
 	$tVars['DOWNLOAD_CAT_SUB_ICON'] = get_cat_icons($row['download_category_icon'],$row['d_count']);
 	$tVars['DOWNLOAD_CAT_SUB_NEW_ICON'] = check_new_download($row['d_last_subs']);
 	$dcatname=$tp->toHTML($row['download_category_name'],FALSE,'TITLE');
diff -x .svn -aruN 0.7.24.src/e107_admin/admin_log.php 0.7.26.src/e107_admin/admin_log.php
--- 0.7.24.src/e107_admin/admin_log.php	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_admin/admin_log.php	2010-10-09 05:03:39.000000000 -0500
@@ -11,8 +11,8 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $URL: https://e107.svn.sourceforge.net/svnroot/e107/trunk/e107_0.7/e107_admin/admin_log.php $
-|     $Revision: 11678 $
-|     $Id: admin_log.php 11678 2010-08-22 00:43:45Z e107coders $
+|     $Revision: 11866 $
+|     $Id: admin_log.php 11866 2010-10-09 10:04:03Z e107coders $
 |     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
@@ -60,7 +60,7 @@
 	$text .= "    <td style='width: 16px;'>{$image}</td>\n";
 	$text .= "    <td>{$datestamp}</td>\n";
 	$text .= "    <td>".$tp->toHtml($row['dblog_title'],FALSE,"defs")."</td>\n";
-	$text .= "    <td>".$tp->toHtml($row['dblog_remarks'],FALSE,"defs")."</td>\n";
+	$text .= "    <td><pre>".$tp->toHtml($row['dblog_remarks'],TRUE,"defs")."</pre></td>\n";
 	$text .= "    <td>{$row['dblog_ip']}</td>\n";
 	$text .= ($row['user_name']) ? "    <td><a href='".e_BASE."user.php?id.{$row['dblog_user_id']}'>{$row['user_name']}</a></td>\n" : "    <td>{$row['dblog_user_id']}</td>\n";
 	$text .= "  </tr>\n";
diff -x .svn -aruN 0.7.24.src/e107_admin/admin.php 0.7.26.src/e107_admin/admin.php
--- 0.7.24.src/e107_admin/admin.php	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_admin/admin.php	2011-07-07 23:16:34.000000000 -0500
@@ -11,8 +11,8 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $URL: https://e107.svn.sourceforge.net/svnroot/e107/trunk/e107_0.7/e107_admin/admin.php $
-|     $Revision: 11772 $
-|     $Id: admin.php 11772 2010-09-09 21:36:35Z e107coders $
+|     $Revision: 12316 $
+|     $Id: admin.php 12316 2011-07-08 04:16:58Z e107coders $
 |     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
@@ -24,11 +24,49 @@
 // --- check for 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(LAN_WARNING, $text);
+	$text = "<table class='admin-warning' style='margin-left:0px;border:0px'>
+	<tr>
+	<td style='width:40px;vertical-align:top'>".ADMIN_WARNING_ICON."</td>
+	<td>".ADLAN_ERR_2."<br /><br /><ul><li>".
+	$HANDLERS_DIRECTORY."htmlarea/</li><li>".$ADMIN_DIRECTORY."htmlarea/</li></ul>
+	</td>
+	</tr></table>";
+	$ns ->tablerender(LAN_WARNING, $text);
 }
 
+// --- check for Malware/Trojans -----------
+
+$mal_paths = array(e_FILE."thumbs.php",e_FILE.'ok.txt',e_FILE."css.php",e_PLUGIN."css.php");
+$mal_list = array();
+foreach($mal_paths as $pth)
+{
+	if(file_exists($pth))
+	{
+		$mal_list[] = str_replace("../","",$pth);		
+	}
+}
+
+	$insp_srch = array('[',']');
+	$insp_repl = array("<a href='".e_ADMIN."fileinspector.php'>","</a>");
+
+if(count($mal_list))
+{
+	// Too important to rely on translations. ;-)
+	$ADLAN_ERR_7 = (defined("ADLAN_ERR_7")) ? ADLAN_ERR_7 : "Malicious files have been detected on your server. They should be deleted [b]immediately[/b].";
+	$ADLAN_ERR_8 = (defined("ADLAN_ERR_8")) ? ADLAN_ERR_8 : "Please run [File inspector] to check for core files that may have been modified.";
+
+	$text = "<table class='admin-warning' style='margin-left:0px;border:0px'>
+	<tr>
+	<td style='width:40px;vertical-align:top'>".ADMIN_WARNING_ICON."</td>
+	<td>".$tp->toHtml($ADLAN_ERR_7,TRUE)."<br /><br /><ul><li>".implode("</li><li>",$mal_list)."</li></ul>
+	<br />".str_replace($insp_srch, $insp_repl, $ADLAN_ERR_8)."</td>
+	</tr></table>";
+	$ns -> tablerender(LAN_WARNING, $text);	
+}
+
+
+
+
 // check for old modules.
 if(getperms('0') && isset($pref['modules']) && $pref['modules'] && $sql->db_Field("plugin",5) == "plugin_addons"){
 
@@ -45,7 +83,8 @@
 	if($mod_found)
 	{
     	$text = ADLAN_ERR_5." <b>".$thef."</b>:<br /><br /><ul>";
-		foreach($mod_found as $val){
+		foreach($mod_found as $val)
+		{
 			$text .= "<li>".str_replace("../","",$val)."</li>\n";
 		}
 		$text .="</ul><br />
@@ -95,18 +134,19 @@
 
 if (isset($potential))
 {
-	$text = ADLAN_ERR_3."<br /><br />";
-
-	foreach ($potential as $p_file)
-	{
-		$text .= $p_file.'<br />';
-	}
+	$text = "<table class='admin-warning' style='margin-left:0px;border:0px'>
+	<tr>
+	<td style='width:40px;vertical-align:top'>".ADMIN_WARNING_ICON."</td>
+	<td>".$tp->toHtml(ADLAN_ERR_3,TRUE)."<br /><br /><ul><li>".implode("</li><li>",$potential)."</li></ul>
+	<br />".str_replace($insp_srch,$insp_repl,ADLAN_ERR_8)."</td>
+	</tr></table>";
 
 	$ns -> tablerender(LAN_WARNING, $text);
 }
 
-// More visible update check
-echo $tp->parseTemplate('{ADMIN_UPDATE}', true);
+unset($insp_srch,$insp_repl,$text);
+// Moved to admin_template
+//echo $tp->parseTemplate('{ADMIN_UPDATE}', true);
 
 
 // update users using old layout names to their new names
diff -x .svn -aruN 0.7.24.src/e107_admin/banner.php 0.7.26.src/e107_admin/banner.php
--- 0.7.24.src/e107_admin/banner.php	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_admin/banner.php	2011-02-27 08:49:43.000000000 -0600
@@ -11,11 +11,14 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $URL: https://e107.svn.sourceforge.net/svnroot/e107/trunk/e107_0.7/e107_admin/banner.php $
-|     $Revision: 11678 $
-|     $Id: banner.php 11678 2010-08-22 00:43:45Z e107coders $
-|     $Author: e107coders $
+|     $Id: banner.php 12086 2011-02-27 14:50:07Z e107steved $
 +----------------------------------------------------------------------------+
 */
+if(!empty($_POST) && !isset($_POST['e-token']))
+{
+	// set e-token so it can be processed by class2
+	$_POST['e-token'] = ''; 
+}
 require_once("../class2.php");
 if (!getperms("D")) 
 {
@@ -24,6 +27,13 @@
 }
 
 $e_sub_cat = 'banner';
+
+if(e_QUERY) // must be before auth.php
+{
+	list($action, $sub_action, $id) = explode(".", e_QUERY);
+	$id = intval($id);
+}
+
 require_once("auth.php");
 require_once(e_HANDLER."form_handler.php");
 $rs = new form;
@@ -36,10 +46,7 @@
 include_lan(e_PLUGIN."banner_menu/languages/".e_LANGUAGE.".php");
 
 
-if(e_QUERY)
-{
-	list($action, $sub_action, $id) = explode(".", e_QUERY);
-}
+
 
 //$reject = array('$.','$..','/','CVS','thumbs.db','*._$',"thumb_", 'index', '.DS_Store');
 //$images = $fl->get_files(e_IMAGE."banners/","",$reject);
@@ -70,11 +77,11 @@
 if ($_POST['createbanner'] || $_POST['updatebanner'])
 {
 
-	$start_date = (!$_POST['startmonth'] || !$_POST['startday'] || !$_POST['startyear'] ? 0 : mktime (0, 0, 0, $_POST['startmonth'], $_POST['startday'], $_POST['startyear']));
+	$start_date = (int) (!$_POST['startmonth'] || !$_POST['startday'] || !$_POST['startyear'] ? 0 : mktime (0, 0, 0, $_POST['startmonth'], $_POST['startday'], $_POST['startyear']));
 
-	$end_date = (!$_POST['endmonth'] || !$_POST['endday'] || !$_POST['endyear'] ? 0 : mktime (0, 0, 0, $_POST['endmonth'], $_POST['endday'], $_POST['endyear']));
+	$end_date = (int) (!$_POST['endmonth'] || !$_POST['endday'] || !$_POST['endyear'] ? 0 : mktime (0, 0, 0, $_POST['endmonth'], $_POST['endday'], $_POST['endyear']));
 
-	$cli = ($_POST['client_name'] ? $_POST['client_name'] : $_POST['banner_client_sel']);
+	$cli = $tp->toDB($_POST['client_name'] ? $_POST['client_name'] : $_POST['banner_client_sel']);
 
 	if ($_POST['banner_pages']) {
 		$postcampaign = ($_POST['banner_campaign'] ? $_POST['banner_campaign'] : $_POST['banner_campaign_sel']);
@@ -92,16 +99,21 @@
 		$cam = ($_POST['banner_campaign'] ? $_POST['banner_campaign'] : $_POST['banner_campaign_sel']);
 	}
 
-	if ($_POST['createbanner']) {
-		admin_update($sql->db_Insert("banner", "0, '".$cli."', '".$_POST['client_login']."', '".$_POST['client_password']."', '".$_POST['banner_image']."', '".$_POST['click_url']."', '".intval($_POST['impressions_purchased'])."', '$start_date', '$end_date', '".$_POST['banner_class']."', 0, 0, '', '".$cam."'"), 'insert', BNRLAN_63);
-	} else {
-		admin_update($sql->db_Update("banner", "banner_clientname='".$cli."', banner_clientlogin='".$_POST['client_login']."', banner_clientpassword='".$_POST['client_password']."', banner_image='".$_POST['banner_image']."', banner_clickurl='".$_POST['click_url']."', banner_impurchased='".intval($_POST['impressions_purchased'])."', banner_startdate='$start_date', banner_enddate='$end_date', banner_active='".$_POST['banner_class']."', banner_campaign='".$cam."' WHERE banner_id='".$_POST['eid']."'"), 'update', BNRLAN_64);
+	$clickURL = $tp->toDB($_POST['click_url']);
+	unset($_POST['click_url']);
+	if ($_POST['createbanner']) 
+	{
+		admin_update($sql->db_Insert("banner", "0, '".$cli."', '".$tp->toDB($_POST['client_login'])."', '".$tp->toDB($_POST['client_password'])."', '".rawurlencode($_POST['banner_image'])."', '".$clickURL."', '".intval($_POST['impressions_purchased'])."', '$start_date', '$end_date', '".intval($_POST['banner_class'])."', 0, 0, '', '".$tp->toDB($cam)."'"), 'insert', BNRLAN_63);
+	} 
+	else 
+	{
+		admin_update($sql->db_Update("banner", "banner_clientname='".$cli."', banner_clientlogin='".$tp->toDB($_POST['client_login'])."', banner_clientpassword='".$tp->toDB($_POST['client_password'])."', banner_image='".rawurlencode($_POST['banner_image'])."', banner_clickurl='".$clickURL."', banner_impurchased='".intval($_POST['impressions_purchased'])."', banner_startdate='$start_date', banner_enddate='$end_date', banner_active='".intval($_POST['banner_class'])."', banner_campaign='".$tp->toDB($cam)."' WHERE banner_id='".intval($_POST['eid'])."'"), 'update', BNRLAN_64);
 	}
-	unset($_POST['client_name'], $_POST['client_login'], $_POST['client_password'], $_POST['banner_image'], $_POST['click_url'], $_POST['impressions_purchased'], $start_date, $end_date, $_POST['banner_enabled'], $_POST['startday'], $_POST['startmonth'], $_POST['startyear'], $_POST['endday'], $_POST['endmonth'], $_POST['endyear'], $_POST['banner_class'], $_POST['banner_pages'], $_POST['banner_listtype']);
+	unset($_POST['client_name'], $_POST['client_login'], $_POST['client_password'], $_POST['banner_image'], $_POST['impressions_purchased'], $start_date, $end_date, $_POST['banner_enabled'], $_POST['startday'], $_POST['startmonth'], $_POST['startyear'], $_POST['endday'], $_POST['endmonth'], $_POST['endyear'], $_POST['banner_class'], $_POST['banner_pages'], $_POST['banner_listtype']);
 }
 
 if (isset($_POST['confirm'])) {
-	admin_update($sql->db_Delete("banner", "banner_id='".$_POST['id']."' "), 'delete', BNRLAN_1);
+	admin_update($sql->db_Delete("banner", "banner_id='".intval($_POST['id'])."' "), 'delete', BNRLAN_1);
 }
 
 if ($action == "delete" && $sub_action) {
@@ -109,9 +121,10 @@
 		<b>".BNRLAN_2."</b>
 		<br /><br />
 		<form method='post' action='".e_SELF."'>
+		<input type='hidden' name='e-token' value='".e_TOKEN."' />
 		<input class='button' type='submit' name='cancel' value='".LAN_CANCEL."' />
 		<input class='button' type='submit' name='confirm' value='".LAN_CONFDELETE."' />
-		<input type='hidden' name='id' value='".$sub_action."' />
+		<input type='hidden' name='id' value='".intval($sub_action)."' />
 		</form>
 		</div>";
 	$ns->tablerender(BNRLAN_5, $text);
@@ -228,8 +241,8 @@
 				$_POST['client_name'] = $banner_clientname;
 				$_POST['client_login'] = $banner_clientlogin;
 				$_POST['client_password'] = $banner_clientpassword;
-				$_POST['banner_image'] = $banner_image;
-				$_POST['click_url'] = $banner_clickurl;
+				$_POST['banner_image'] = rawurldecode($banner_image);
+				$_POST['click_url'] = rawurldecode($banner_clickurl);
 				$_POST['impressions_purchased'] = $banner_impurchased;
 				$_POST['banner_campaign'] = $banner_campaign;
 				$_POST['banner_active'] = $banner_active;
@@ -446,7 +459,8 @@
 
 
 
-		<tr><td colspan='2' style='text-align:center' class='forumheader'>";
+		<tr><td colspan='2' style='text-align:center' class='forumheader'>
+		<input type='hidden' name='e-token' value='".e_TOKEN."' />";
 	$text .= ($sub_action == "edit" && $id ? "<input class='button' type='submit' name='updatebanner' value='".BNRLAN_40."' /><input type='hidden' name='eid' value='".$id."' />" : "<input class='button' type='submit' name='createbanner' value='".BNRLAN_41."' />");
 
 	$text .= "</td></tr></table>
@@ -549,7 +563,10 @@
 	</tr>
 
 	<tr>
-	<td colspan='2' class='forumheader' style='text-align:center'><input class='button' type='submit' name='update_menu' value='".BANNER_MENU_L18."' /></td>
+	<td colspan='2' class='forumheader' style='text-align:center'>
+	<input type='hidden' name='e-token' value='".e_TOKEN."' />
+	<input class='button' type='submit' name='update_menu' value='".BANNER_MENU_L18."' />
+	</td>
 	</tr>
 
 	</table>
diff -x .svn -aruN 0.7.24.src/e107_admin/core_image.php 0.7.26.src/e107_admin/core_image.php
--- 0.7.24.src/e107_admin/core_image.php	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_admin/core_image.php	2011-09-14 00:39:12.000000000 -0500
@@ -10,7 +10,7 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $URL: https://e107.svn.sourceforge.net/svnroot/e107/trunk/e107_0.7/e107_admin/core_image.php $
-|     $Id: core_image.php 11812 2010-09-22 21:22:08Z e107coders $
+|     $Id: core_image.php 12350 2011-09-14 05:39:36Z e107coders $
 +----------------------------------------------------------------------------+
 */
 
@@ -35,21 +35,21 @@
         'index.html' => 'd41d8cd98f00b204e9800998ecf8427e',
       ),
       'core_pg.php' => '48084454a6eaf05faca4b4afcc435c0b',
-      'core_sql.php' => 'c7d2cf0d936c5ba9e75f5621140044da',
-      'extended_country.php' => 'fa47c74f9b7d57fe5ea24787d972f8b8',
+      'core_sql.php' => '03fbdc6930452734558146cd9cf4728b',
+      'extended_country.php' => 'a0d285e0ed6c9db3eb10fd7d06c47af7',
     ),
     'ad_links.php' => 'e6e818f7dded90dcb20f57ea7ebd17b8',
-    'admin.php' => '79b0a68d6c6b38271d8875c72c536014',
+    'admin.php' => 'fa57d18b04384ec9a5c6354a93c524bb',
     'admin_classis.php' => '1ad9a3d24d76efdc2e5320caeb2b6e12',
     'admin_combo.php' => '72ed3c4ca9c6e348af758323cface540',
     'admin_etalkers.php' => '4606fdf97453273e37f0fd973e64c1d6',
-    'admin_log.php' => 'eb4a084f1cca7d868cefcc5d2a53edfe',
+    'admin_log.php' => '25773504f8afc13dbcf0025c97e65c95',
     'adminb.php' => '34fba5666d40d75b4a433cfb670ab33b',
     'administrator.php' => 'ca893ed78fcfa45d3305d29ece36c100',
     'article.php' => '718991e8d07f3af22917c6babcb16d18',
     'auth.php' => '677c9b2f80a2b85b0895b212db602a7b',
     'banlist.php' => 'aca33bf3e75b23310458df1051dfcf88',
-    'banner.php' => '216713ad90861a0894595b79703f2dbb',
+    'banner.php' => '4cd98ff7f8fd4350621e37114308fc69',
     'cache.php' => 'c835e2706424650a9dec0c67663e8b21',
     'cascade.php' => '426121b4aead34a87af264c23d76cf76',
     'categories.php' => '4332e8d5772bf47eb564d4860f0cfefd',
@@ -59,52 +59,52 @@
     'comment.php' => '64e8eb798697c404ca7d9551680606e6',
     'compact.php' => 'ec130bd289f9c97fa3aa2174b717cedc',
     'content.php' => '393ac3283845587d8c9fde0cc60afb3e',
-    'core_image.php' => 'd81e9c541f148f1f0ca699c22ebfbf2a',
-    'cpage.php' => '5b082a899902280f04eba7bef2b9fb84',
-    'credits.php' => 'ca0a6d2aaf7bfc1ea3a46d04e12ec23a',
+    'core_image.php' => '1a93e05c9ee9f74e694f158c011c80da',
+    'cpage.php' => '201e77b9624ee1c25de780c0611dd581',
+    'credits.php' => '2e09de126300c76a97ceefd28c496cd9',
     'db.php' => '74139e11c3664555bdf7cf8080ab26bf',
-    'db_verify.php' => 'e40fba3af6bf5dee8154dfcbabe67045',
-    'docs.php' => 'e2a1bcb11e4d89f27bc51d68f68e9ddb',
-    'download.php' => '694e08c3d8137fed8610603542017f76',
+    'db_verify.php' => 'e811e73c73dfd3d3333f12999c0b2564',
+    'docs.php' => 'f664d88854f00b622ef94d5058f6d409',
+    'download.php' => '9bc411b3158953bf26ba35511491993a',
     'e107_update.php' => 'f732438744e472390a1b439465d7f0e8',
-    'emoticon.php' => 'e460aa583debaaa672f685cb87648efe',
+    'emoticon.php' => '4ead8f97b1ac650d03bac44687ef8732',
     'fileinspector.php' => '71450f515e8134573897e6b2fbf3d065',
-    'filemanager.php' => 'a2a9c088f88c0543613ad88bee9e8621',
+    'filemanager.php' => '709081d738ba42ebee6579647a3aaec6',
     'filetypes_.php' => 'f951037335e993337792606cc1475cec',
     'fla.php' => '1aefd4e013f1d4d38dde69f5e801d8a4',
-    'footer.php' => '8672ad69eadf94d079c5ff5470afa6a2',
+    'footer.php' => '5ff1291325a04e4d63c72b26f5c77fbb',
     'frontpage.php' => '878bc7ca908b88c7441a242c2baf3ae2',
-    'header.php' => 'f231642623e2e446924b04b5a801964e',
+    'header.php' => '2f8c43f98a6c58fdbe4b51ec3b72bc9b',
     'image.php' => '7cdd8e6b6589e93bd18979752da4d3bd',
     'index.php' => '26700800ddf746629a55e2747b9e8e0f',
-    'lancheck.php' => '078dd73a761257ace5db71d9f1bf9f46',
-    'language.php' => '01a9174ea0c85fae6ec48232c831e99f',
-    'links.php' => '0bcf8139abef130a3a1757431499f61a',
-    'mailout.php' => '3922ee2695c6ce849c99a14670ed53b4',
+    'lancheck.php' => 'cc9bf73f69694041e9e472281fb58ca7',
+    'language.php' => 'e255fb03c3c33499722bd2f6c2097918',
+    'links.php' => 'a3483cbb5a0710284e877be44a202eb3',
+    'mailout.php' => '5e2df321b542f6da7be9811a8c902dfb',
     'menus.php' => '0873f17e7aa314d3ae6eff79ef745a74',
     'message.php' => '5f69b7440db09e5bee30288241bdad35',
     'meta.php' => '0371c24cac6be53833b0e9feea1f5d1f',
     'modcomment.php' => 'dbf112846aea17d36c03d66206bc5a15',
-    'newspost.php' => '242943f0430b5b4adfbf022095e44806',
+    'newspost.php' => '4d1268fec76fc70f766c5076b32809ee',
     'notify.php' => '07e00910ee8ac60951a0b83b9fcb2fd7',
-    'phpinfo.php' => 'd3c66ce0cab07f5cee3785aea83715eb',
-    'plugin.php' => 'b273b824d822b2061a91583fd4fabf29',
-    'prefs.php' => 'b1fd027d3fe828786f0b462decc981c5',
+    'phpinfo.php' => 'f1153cdf730e14f0ed22b13806183875',
+    'plugin.php' => '71646ef1775f46d4bf697ff79596697d',
+    'prefs.php' => '0184f2610b784c2010f576b04881c7bd',
     'review.php' => 'b7ec4170f13068a622d1ec2582c21a6f',
-    'search.php' => 'e00c2c48924ad495fd30c4038cac528b',
+    'search.php' => '55b03caa1435222f0675f713dcd3dae7',
     'theme.php' => 'a3f8219bacbc8028a7ffd21c798f4f8b',
     'ugflag.php' => '6bceb5eef44d91cf2929b92fd1854432',
-    'update_routines.php' => '7daebcc3e444cd7b56772dc65cb475ce',
+    'update_routines.php' => '63d626d0546b49db8551b04613305485',
     'updateadmin.php' => '3f0c55903abcffc20e8ae612c9adb3fd',
     'upload.php' => 'eb45f5e64818c2a33c32db5e737a3bcb',
-    'userclass.php' => 'c40e5632d0bbab50c65ac2579af5bdb5',
-    'userclass2.php' => '269f823b152807bf1398b253bbd736c8',
+    'userclass.php' => '46791da1459ae7df9b4c0adb14ccbecf',
+    'userclass2.php' => 'ea33cb3a5dadd33a5c85d4f04d77c2d9',
     'userinfo.php' => '86461ecfae44ebdbaa1f710acc63cf13',
-    'users.php' => '1970e65dfca7db868304091da6ad8260',
-    'users_extended.php' => '6ad395eafa94e6e91eb65594f75c07b3',
+    'users.php' => '87bd4455f63de8ac7f334cad46a7103c',
+    'users_extended.php' => 'c788d3532e058496c4f4d0caf47e7147',
     'users_extended_predefined.php' => 'a7f1f96f56cbb0b1f4a0b71126318597',
-    'ver.php' => 'f1c83078dbf998d02cdb7a1aa6516d95',
-    'wmessage.php' => 'daa79a46b4bb9ba70dd816f4a61df0db',
+    'ver.php' => '47c6de94535262ad9a952833398ca541',
+    'wmessage.php' => 'eae41daa06adf50107d3652e173f568d',
   ),
   $coredir['docs'] => 
   array (
@@ -146,7 +146,7 @@
     'bbcode' => 
     array (
       'b.bb' => '467bfb5e80f460fcebcdc2e6a3a8d38b',
-      'bb_youtube.php' => '43da1cd1f7df6d70d5aa3cedc85bac51',
+      'bb_youtube.php' => 'e7d620653fc108d9593700e36fceb936',
       'blockquote.bb' => '2cfbbd3ab3fe2872d1a9873223d21522',
       'br.bb' => 'cb8d211703f0459735baa8dfbebb4bb4',
       'center.bb' => '5a1957946e3d8898a0b3d86650771809',
@@ -164,7 +164,7 @@
       'left.bb' => '990ddba32b14bea648745cc373035bde',
       'link.bb' => 'b8189cfeece6331b0ead2665e41204eb',
       'list.bb' => 'b8a3e5c98d6ebc1f1ca1a122bd7ced0e',
-      'php.bb' => 'a118b04688efa7c626f9bb35acb16423',
+      'php.bb' => 'b6afb99a8b52877e56e43efc54b9e5bb',
       'quote.bb' => '12bfbba32661e309a33972e388b0e912',
       'right.bb' => '9bd60ca738b30f35742a0049c5efc191',
       'sanitised.bb' => '7e6fb575a630bb52731ca8c4d371e755',
@@ -240,19 +240,19 @@
         'download_shortcodes.php' => 'ddc28b227ed55098bc2a085585bc73af',
         'index.html' => 'd41d8cd98f00b204e9800998ecf8427e',
         'news_archives.php' => '17478354b5a68bfcac46e46484b7e4ce',
-        'news_shortcodes.php' => '08a89107dd0a49e014da316363a9a164',
+        'news_shortcodes.php' => '6f543bf4f6231e3a6bdec912c6ac9dd3',
         'signup_shortcodes.php' => '85c54e5e3c3f7d90312b0f91fc2a9dab',
         'sitedown_shortcodes.php' => '2e795ea320860124c884606926e37219',
-        'user_shortcodes.php' => '6982214d71b081add81d61629d6ff8f7',
+        'user_shortcodes.php' => 'fb17c7e2754da7bc9204c87995eca7ba',
         'usersettings_shortcodes.php' => 'c89a0e5127175befca158cb3b16ef0a2',
       ),
       'admin_alt_nav.sc' => '17f82050dadf0bcc51f36e9bcfab58d9',
       'admin_credits.sc' => '1b7e691941c78f4a1d2cca5c7a81e839',
       'admin_docs.sc' => 'b010b7ac7618fa669c8777754a8337c6',
-      'admin_help.sc' => '32247c5afa0c6afcd7f58ef51c5f105f',
+      'admin_help.sc' => '6bcd7a3280c9eb76cd0bbddb7cc4660a',
       'admin_icon.sc' => '4843c11cc5e5e14db4d5cacd537569c2',
-      'admin_lang.sc' => 'dcc988d7b2fa49c3053610f11daf19ec',
-      'admin_latest.sc' => 'b016f49367d62c5237fa9461517bf963',
+      'admin_lang.sc' => 'c40da4411969e89998cd5030fc3f1eda',
+      'admin_latest.sc' => '9adad38428f14921a576aeee6c641c74',
       'admin_log.sc' => '9ed4a14759eb20032fb3e953b3374ce3',
       'admin_logged.sc' => 'dec16fb0a9f5485db6ca1b4955753c2e',
       'admin_logo.sc' => 'a97a3ad7bd7a505373ca5b794310a7ff',
@@ -260,12 +260,12 @@
       'admin_msg.sc' => '1906530f20e337964878fd144b1047c5',
       'admin_nav.sc' => 'c22be64cb31ee333f0510f6dd8778363',
       'admin_plugins.sc' => 'd2a629cdf1bda821867e4177bd4999e1',
-      'admin_preset.sc' => '57769dcbc4c658c8b14fbc0b19b94a28',
-      'admin_pword.sc' => '242c091ee9825a4cf76674a7a0fb3b06',
-      'admin_sel_lan.sc' => 'f84e6de20d1e6def2675c77f90b0d710',
-      'admin_siteinfo.sc' => 'c0de6b2a460e232bfd112a57f1ba4703',
-      'admin_status.sc' => '3f44636d054f74e4d3c5b61844f015ea',
-      'admin_update.sc' => '7ce1c1df06592fabb2cf6fcc29a96b70',
+      'admin_preset.sc' => '4d330a7b56e4870a7fe954580fe2b587',
+      'admin_pword.sc' => '043dd84f51c5349bce4488ec89671cee',
+      'admin_sel_lan.sc' => '0d011beac7113c9cd8e0b31fd73ebdd0',
+      'admin_siteinfo.sc' => '64b9b7289a7794b4dbea603ca7ede2ab',
+      'admin_status.sc' => '0d29c1581183a9e0010cc440f0e407e8',
+      'admin_update.sc' => '80b99041946daf2b7339d55129ad7fa4',
       'admin_userlan.sc' => 'd1ced8f4235d221877e47efcaaecc835',
       'banner.sc' => '9f40612195bb3a863615b06f059b9ab1',
       'breadcrumb.sc' => '0591ee7dc26ded7ac9a359dea4b8fdf6',
@@ -278,7 +278,7 @@
       'extended_icon.sc' => 'db16dbaa0dfa2f8fc944ba87c15a09d1',
       'extended_text.sc' => '5a1426815f88bb2239912638af30beb0',
       'extended_value.sc' => '1b720e5d3155c6d4a1464fc1e9cac5f1',
-      'imageselector.sc' => '558b028f8a4978f7845224387a141fd6',
+      'imageselector.sc' => '66351b388d5e2700cb1ef2b0dbd1b4e9',
       'index.html' => 'd41d8cd98f00b204e9800998ecf8427e',
       'languagelinks.sc' => '86777cfae68e873ef74d41c3ffd8a767',
       'linkstyle.sc' => '5ed64d972bc892a798f80179878f1266',
@@ -289,7 +289,7 @@
       'news_category.sc' => '25596ffed2cf4bed831b80397c77e295',
       'newsfile.sc' => '6f2f1591deaac955082369a610096aa0',
       'newsimage.sc' => '9d887c7ae3e14839b7b0ecd13e8d40ed',
-      'nextprev.sc' => '85bade909702980372c5c1c0b728dc1d',
+      'nextprev.sc' => 'd9c84a726fb8e588211d1a42815edcd8',
       'picture.sc' => 'aa9bc096ad37b40df413638f8d259fc9',
       'plugin.sc' => 'be06266acd86f06b244dd27266df8f12',
       'print_item.sc' => 'fb3b5508fed60548689a5c496d45e1b3',
@@ -303,26 +303,26 @@
       'sitelinks_alt.sc' => '5701cc59ee7bf1aa413f3b3dfe83378b',
       'sitename.sc' => 'a62bd1e1600931a2585f16b611fd0c6b',
       'sitetag.sc' => '338e16589e67c9fe45613e3c6dbb9b0d',
-      'stylesheet.sc' => 'fff86593b238e374763dab535f6f40a3',
+      'stylesheet.sc' => 'bc460ebf776e08e73fac2af52f376aec',
       'theme_disclaimer.sc' => '606d98f47c1a64b179d9baf6e6930dbc',
       'uploadfile.sc' => 'f25209c2ea67bf30c50c18548c245be2',
       'user_avatar.sc' => '1501550f2414900d47edee2621b2e624',
-      'user_extended.sc' => 'cea27d6ef17122c2368703c67b3cb363',
+      'user_extended.sc' => 'fa0c0db13bf38c94f7ae2c58576d879c',
       'wmessage.sc' => '7e6ca101862dab61e56e748431bfb561',
     ),
-    'def_e107_prefs.php' => '3fcc3a9820e3e45a07a1dacbdcf926eb',
+    'def_e107_prefs.php' => '9864d0cdc52059d0750425ba22d2f4ab',
     'e107.css' => 'e5cfa4047831f19def7df032ef8bc830',
-    'e107.js' => '5062e4aa13b548e5c2f04e2652183678',
+    'e107.js' => '6bbab5925033c771476843ab5c34fced',
     'e_ajax.js' => 'b583773e72852158e27af8a9bba7c97f',
     'index.html' => 'd41d8cd98f00b204e9800998ecf8427e',
     'nav_menu.css' => '58ca165986f7428fb05e8b7b82c2ee13',
     'nav_menu.js' => 'f6345dfb29d05884a5017ff17ed36387',
     'nav_menu_alt.js' => 'cbfeb53bb0dfc7136f097c00265731ff',
-    'popup.js' => 'd09d2c542ac320a8b9690a36aebdb0c4',
+    'popup.js' => 'e5aae66b69a505cb78fa98a1da646a72',
     'resetcore.php' => '7b84e386c94ec3917d61882fcc197ff7',
     'sleight_img.gif' => '7616b49c48ca0cd6cbd15e9f747c8886',
     'sleight_js.php' => 'ff8a781186a4c37b0104111b25f00b6b',
-    'thumb.php' => '8157312818272ea549198fdc6b958e65',
+    'thumb.php' => '11bb26e0f5f69182116c2fa0be4caa1e',
   ),
   $coredir['handlers'] => 
   array (
@@ -353,8 +353,8 @@
       'class.phpmailer.php' => '4b87656ccbdc865d24bedc6262b7f4e4',
       'class.pop3.php' => '4ee33629dec2b6c217792d2d75f83b51',
       'class.smtp.php' => '3703c67c81f61a223cd6bc1c10687dbf',
-      'e107.htaccess' => '507de3fb6f951cafa6b1a346d232604f',
-      'mailout_process.php' => 'd0f1255f8676dfd70b97e3282add3b11',
+      'e107.htaccess' => '1daeb6ab4cf6596d7807834d2189bbaa',
+      'mailout_process.php' => '70ef9d91d9ba63e5d1d436bd911668b9',
     ),
     'search' => 
     array (
@@ -379,7 +379,7 @@
     array (
       'langs' => 
       array (
-        'en.js' => 'b8a3157ba03ebce3bb977a37c71d452e',
+        'en.js' => 'b4181af2804b6b384931372aad8cbd48',
       ),
       'plugins' => 
       array (
@@ -399,8 +399,8 @@
             'spacer.gif' => '12bf9e19374920de3146a64775f46a5e',
           ),
           'contextmenu.css' => '93ad8b3e8a5e1a48bf6ed727ca0384e2',
-          'editor_plugin.js' => '615aede93687b7373e0518026a69d65f',
-          'editor_plugin_src.js' => 'b256009ed61926f05000339423fc60b0',
+          'editor_plugin.js' => '33823d4ec2c7f493b5b9ad66171e0e3a',
+          'editor_plugin_src.js' => 'bd32bdf199580f66c4446932d08e20b5',
         ),
         'emoticons' => 
         array (
@@ -413,7 +413,7 @@
             'en.js' => '4e72c7cd68a7fb3a6b8f1e1cd6eeac8a',
           ),
           'editor_plugin.js' => 'f7e74630e641e122b5b71503ea58fc8c',
-          'emoticons.php' => '092e4135dbcbe2a9261d26d3d261653b',
+          'emoticons.php' => '34c4ed307e5fe45ddc0a80cb0214eaca',
           'index.html' => 'd41d8cd98f00b204e9800998ecf8427e',
         ),
         'ibrowser' => 
@@ -432,19 +432,19 @@
           ),
           'config.php' => '4e178e32efb96453c26523ded26f6ee7',
           'editor_plugin.js' => 'da29c9b99d2509ac620533ea4e1fee14',
-          'ibrowser.php' => '8b921158cef045e9ee4682371849ddfd',
+          'ibrowser.php' => 'ad6fe6f720ac8e3e9147d25d3cff4fe1',
         ),
         'iespell' => 
         array (
           'editor_plugin.js' => '22526393cacb6447a0e3bfff2fb47773',
-          'editor_plugin_src.js' => '1430b2af9ec352aa6166a66a5405626b',
+          'editor_plugin_src.js' => 'f3c80c2f415b73b91e5f336dec338c26',
         ),
         'media' => 
         array (
           'css' => 
           array (
             'content.css' => '3135bdacabceae466c3b643e33dc3e17',
-            'media.css' => 'b7d62f5bcf41bb15ddc82206ad11664d',
+            'media.css' => '925fd1583204468ed685deaf2bc91de1',
           ),
           'images' => 
           array (
@@ -468,7 +468,7 @@
           'js' => 
           array (
             'embed.js' => '2288f2d23b707283921aaeff2dfeb005',
-            'media.js' => 'c56e5dfcee7cd5d177df8fa248d29083',
+            'media.js' => '2cad38c1432ab01600c2182e62f1eaf6',
           ),
           'jscripts' => 
           array (
@@ -477,11 +477,25 @@
           ),
           'langs' => 
           array (
-            'en_dlg.js' => '3439c7545446063966919aaaf8c9bc93',
+            'en_dlg.js' => 'c2e2d9994c2b1bc101560c80dd11ca88',
           ),
-          'editor_plugin.js' => 'bcd5c851ca50eee87904b410c13c6d8c',
-          'editor_plugin_src.js' => 'e7a2cb92e6cc4a33dab11184147921bd',
-          'media.htm' => 'ac37ca5e4be99e68ade8f8032e9042f1',
+          'editor_plugin.js' => 'cc97fbc2bc892884a3fc3e3cab3b9aba',
+          'editor_plugin_src.js' => '07889a41f5b7406c27454e90c05e6637',
+          'media.htm' => '29486341f52da1a84cdaf154a0fb33b1',
+        ),
+        'paste' => 
+        array (
+          'js' => 
+          array (
+            'pastetext.js' => 'ca57055e0f47fc42ac4f2e6d49605cd1',
+            'pasteword.js' => 'b0abc03a8223eb98e572d597cdae0a9f',
+          ),
+          'langs' => 
+          array (
+            'en_dlg.js' => '83e31108dcecfeb84650a60e8734840a',
+          ),
+          'editor_plugin.js' => 'c513165512b7f547106f5c713bb30a90',
+          'editor_plugin_src.js' => '6473847c2f7ba00f71fc949425e49e02',
         ),
         'table' => 
         array (
@@ -509,10 +523,10 @@
           ),
           'js' => 
           array (
-            'cell.js' => 'd445d72fffdcbb12318d6019be4d1a53',
-            'merge_cells.js' => 'cd321e3350c013d4123ec52ea8ca6173',
-            'row.js' => '47978778bbc411d5dff43d1b437c4b70',
-            'table.js' => '8adaeae2fb56ed12588839a231654775',
+            'cell.js' => '17609fd761d902c543747e563a20ea37',
+            'merge_cells.js' => '2fa2cbbf3adcc15354cf63cc204277ee',
+            'row.js' => 'a0aa30a57ca4293838029888e4f9b68e',
+            'table.js' => 'd4b3d67217775a98633e8fa43fae4715',
           ),
           'jscripts' => 
           array (
@@ -523,14 +537,14 @@
           ),
           'langs' => 
           array (
-            'en_dlg.js' => 'c1b41c798f4b9c6de38fdd28c9e7c2e2',
+            'en_dlg.js' => 'cc0716e27eec0ab6a14ef7340f825a22',
           ),
-          'cell.htm' => '8897de52c93d9291d6b4312f6fa5b06f',
-          'editor_plugin.js' => 'b7789df41d0e9d67b532c4dd6a236b8e',
-          'editor_plugin_src.js' => '916737bf52517b328d4abd3eb909d1f6',
-          'merge_cells.htm' => 'e186ab851531e109edfe36463de1194c',
-          'row.htm' => '9c2f070ff15d6d76d86159c183432d44',
-          'table.htm' => 'd834be5d0d403f36ca024aee92454e6f',
+          'cell.htm' => '809d7d5d8e3be13824d00e97f952e132',
+          'editor_plugin.js' => 'b2716161a4f7904ad2c4d9f95a8a4845',
+          'editor_plugin_src.js' => '0eb885bf2360edbcf01b9c77bf7d92d1',
+          'merge_cells.htm' => '6a38cd801c48f419c0f61357aaff015f',
+          'row.htm' => 'de8e0048183374d3b2f471f777674a75',
+          'table.htm' => 'c09ac2ce7cfdf538c44ead7dc6a57887',
         ),
         'zoom' => 
         array (
@@ -657,17 +671,17 @@
           'img' => 
           array (
             'colorpicker.jpg' => '35246246c8889992f3a2a42d501f8bfe',
-            'icons.gif' => '0709a7b61683ff5f347466cf14aa1f8e',
+            'icons.gif' => 'a9ef6e48ea2f231052bb7cdd45ef1f6c',
           ),
           'js' => 
           array (
-            'about.js' => '7bf0a479da2e4c9a6cafda7626b98322',
-            'anchor.js' => '84df40a014548a495c806ff29688605d',
-            'charmap.js' => 'c2efdc6070e8d49ab61179d086512749',
-            'color_picker.js' => 'cd77c90f08f79f0653ea74efb104fdcf',
-            'image.js' => '466f1e7b127166b8bb865f5006d280b0',
-            'link.js' => 'c32414e9afb8d7887903a182c6886517',
-            'source_editor.js' => '9e10d96960c09241fef4ee2e0024411e',
+            'about.js' => 'df58ed30ec67f2613d0cecf8075532fb',
+            'anchor.js' => '44501b7e6b4eabfc765e26cb9c1f6f3a',
+            'charmap.js' => '649992a33abc026dd84e508a24fb6539',
+            'color_picker.js' => 'b1804c4c0ac93ee1969082a12f207c7f',
+            'image.js' => 'c47c78fcc61531555f64c56318d92363',
+            'link.js' => 'a696883dbf03011bcff1c5179e8afac0',
+            'source_editor.js' => 'aed34941d3644083cca88148078d52de',
           ),
           'jscripts' => 
           array (
@@ -681,8 +695,8 @@
           ),
           'langs' => 
           array (
-            'en.js' => 'f576640731578339d587b1b227d4449d',
-            'en_dlg.js' => '9e74c0e060e1a209644191c5b090d02b',
+            'en.js' => 'd1e3c3505d46e73fdd45214521844b7e',
+            'en_dlg.js' => '58f531fcf2b62c980b1791f6d6f51e7d',
           ),
           'skins' => 
           array (
@@ -697,74 +711,74 @@
                 'progress.gif' => '208a0e0f39c548fd938680b564ea3bd1',
                 'tabs.gif' => '47ef3b1cf81bd4cc7b27aed88af21533',
               ),
-              'content.css' => 'fc86d84321a23cbd31f6936c3809eba2',
-              'dialog.css' => '71f6cefa23b6223e85d7bffcf0934412',
-              'ui.css' => '9bafd419c8ff293320e0d7b6c49cf24a',
+              'content.css' => 'ff089cfc8553222a3a76fa061f2fd8c2',
+              'dialog.css' => '0ac841fc13582f90b6a031c752895d1f',
+              'ui.css' => 'f713449f13e50501d330dd0c19ed5b8c',
             ),
           ),
-          'about.htm' => '866230a747a5dc27812b6fc80f5edc6a',
-          'anchor.htm' => '89fc96bc71b8f51c409ebeef480b148a',
-          'charmap.htm' => 'c9f33a629f80fe46c4012dc17948576f',
-          'color_picker.htm' => 'd3e7193150c1c4dae2eff6102663a1e1',
+          'about.htm' => '6bc9ec57ef916969d978cec4e6b1018d',
+          'anchor.htm' => 'f5683e39d2477e89186ef2a6387eda3d',
+          'charmap.htm' => 'd91b19f15c3651b59cff8075913e894d',
+          'color_picker.htm' => '8ad6db3a03ed31b641761770ccb60887',
           'editor_content.css' => '99f256c087e16872937f6cf9e4ea0c32',
           'editor_popup.css' => 'a2bbb5f95ba2d3422c1666222170d700',
-          'editor_template.js' => 'e4f47b78c98d99433c91ec4a145f7ff5',
-          'editor_template_src.js' => '5c22a2f9266dae1e439c3050ef5284b8',
+          'editor_template.js' => 'c5d7988cec2d1be2a55ff4c271193954',
+          'editor_template_src.js' => '8374ce406af556f9773e59d08475dc80',
           'editor_ui.css' => '62632779c868eddf46f3a8e121083d31',
-          'image.htm' => '8453941b410a1a31f5d79e2ac8a41e0e',
-          'link.htm' => 'de02c48a8f1664f083bae483b57e4781',
-          'source_editor.htm' => 'a34324fc81ac5bdd3afc5f986dc3cd3f',
+          'image.htm' => '9cff4955ae75a87fb6b66d3c7431ba26',
+          'link.htm' => 'f3989d2bf0a0b735698b514c27efc656',
+          'source_editor.htm' => '104fc81bd65c1414ad94d8e74885d44d',
         ),
       ),
       'utils' => 
       array (
-        'editable_selects.js' => 'fed66fbd97da928ad855ab40214ca7a3',
-        'form_utils.js' => 'e7174e00c3dd859b36fc76c0d463680e',
+        'editable_selects.js' => '4a7b89cf5ae0b0c22f8c7a2b2c74ab2e',
+        'form_utils.js' => 'cc3af39dea773af8ecff73f4c43384c2',
         'mclayer.js' => '9db8de8efcf4da4694f65f8b64873b55',
-        'mctabs.js' => 'e25bdbe8e208ea443f0688809c491cc5',
-        'validate.js' => '49cf8ea372e8cce1b89c04f0a9e228a2',
+        'mctabs.js' => 'c7d01d9f8b9322d9597d9e5fc0276df2',
+        'validate.js' => '9ebff5e1ee4dbe4391f6fb1b9732855e',
       ),
       'blank.htm' => '72406c871a9be7972922686221a885a2',
       'filelist.php' => 'da02decd86335cc0d179df0cd3886bdd',
       'index.html' => 'd41d8cd98f00b204e9800998ecf8427e',
-      'tiny_mce.js' => '9f93010a684382a5ff180c275f0ee985',
+      'tiny_mce.js' => '9d30ab9d3d465b38a9263014881ed942',
       'tiny_mce_gzip.js' => 'ea730144f7836073b9dcc0bd09c3ab5d',
       'tiny_mce_gzip.php' => 'def6c78847a3a181cfed52b93d8d5f06',
-      'tiny_mce_popup.js' => '8ccd8e1ecd2700cb83ee770337b3b542',
-      'tiny_mce_src.js' => '3e0019162c45c999336c2fa811e4f522',
-      'wysiwyg.php' => 'a9b679b4e34a9976c412d61d9aca6b7d',
+      'tiny_mce_popup.js' => '309ec618f86dc6a95854de0027d1791f',
+      'tiny_mce_src.js' => '90b04c1c92f22fa6df3ee38fe2124c76',
+      'wysiwyg.php' => 'd27d9e53ccb6ea2ebd281a0346f42660',
     ),
     'admin_handler.php' => '2d593943e40bf02d5d46cf6b6af6b7e7',
-    'admin_log_class.php' => '9034da754aeeb72e53c35be0ead6341b',
+    'admin_log_class.php' => 'fd0dd236d400f018fe0fce8dd8c4c1e8',
     'arraystorage_class.php' => '6993bf8a62b1b6139abd00dc8b6af3ea',
     'avatar_handler.php' => 'd62b4eec902a6f0100c5fe5817d99357',
-    'bbcode_handler.php' => '6fe04fed7c16db8771b2e5ab1dfd920e',
+    'bbcode_handler.php' => '30316e2e59935e3e097a5821693a741a',
     'cache_handler.php' => '000f6cdd45fac48adb59fdf7fce8af03',
-    'comment_class.php' => 'd2876885adf9c6327b45fa4a4039c4f4',
+    'comment_class.php' => '57702fe87ea44df14464c271e34648a4',
     'date_handler.php' => 'e2edc265b7b99e277de5a3785a26e3a4',
-    'db_debug_class.php' => 'c5cb881fec744974a35803de7efbf533',
+    'db_debug_class.php' => '8312fa01b2bdfc41cb4b4a7a61f05a55',
     'debug_handler.php' => '8eda3a044b71ab7cd9550a14a216e08b',
     'e107_Compat_handler.php' => 'b927ac5a004fec8506e7d51b4e79a00f',
-    'e107_class.php' => '2183865a9909046ab949b2c1cb7b41ca',
-    'e_parse_class.php' => '6237b42534b837fb282e71dad1c550d0',
-    'emailprint_class.php' => 'fdc1d1304afadfc022463a51cba67850',
-    'emote.php' => '857db28d115c7d77587ee70b738d70ff',
+    'e107_class.php' => '5fba52d2321e3ffe9b8f0dd86a9c4776',
+    'e_parse_class.php' => '9cbb472840958799895393b1613f1455',
+    'emailprint_class.php' => 'db7b892f5b103d8f3e1198ca82fba358',
+    'emote.php' => 'cdf1bbc5f815f499f2c7c52340032084',
     'emote_filter.php' => '32f03814a155ab2d48517384c4f23efa',
     'encrypt_handler.php' => '71f05d8bee660dbfd299d8cf4feea2f8',
-    'event_class.php' => '9f64cdc6ebd03ccb1b65293e2d9ee978',
-    'file_class.php' => '9c60d3e3499f38912e26c71d95aa54f7',
+    'event_class.php' => '43fca82aa03cad1e2b2ff26421f79d00',
+    'file_class.php' => 'd2436ed2a026b7a90c0c7fa80d9c78c3',
     'form_handler.php' => '4906a6c2c2fe2d7a00df746d5313e8cc',
     'index.html' => 'd41d8cd98f00b204e9800998ecf8427e',
-    'language_class.php' => 'dc2b8410bf1e36ed7c0d2e2ae0f32780',
+    'language_class.php' => '21993a290543af1e43a68f96b2182170',
     'level_handler.php' => '51a6554eb18f8296fea49ad222a7b0e5',
-    'login.php' => '8039ef7a6544ae55c1e9f58433c7c65b',
+    'login.php' => '21e58440d4f92cd27f4adb97475c9afe',
     'magpie_rss.php' => 'a04efb623cda4635cf46d9fe7c327d44',
-    'mail.php' => 'e36efef6ad8d8195763f438b43385a68',
+    'mail.php' => '1d76764021e3ab599dcb42aa5280438a',
     'mail_validation_class.php' => '044d1da8377818835c55833aeae32d12',
     'message_handler.php' => '8a02bc87ac579485d1c944d96bea5325',
-    'mysql_class.php' => '082469dececf5d56f7be912b1db35f05',
+    'mysql_class.php' => 'f83025bc85b6c21050489e943282a5a2',
     'news_class.php' => '4823c2a7a079b39bb5cfedb04a0b1da4',
-    'notify_class.php' => '68b8dd12b3f2f1eaff692d3d65ad22b4',
+    'notify_class.php' => '51ce6c2477d82024582d7132ae72046b',
     'np_class.php' => '20b3571a82960caaa4ce83c5e7c72e37',
     'override_class.php' => '8c3cb1c429d3473909fec59fe9fd877b',
     'parser_functions.php' => '8f94e2d568edaaf56dc5c21e87b8fa73',
@@ -772,34 +786,34 @@
     'pclerror.lib.php' => '7b1498a7efb4524dd899c954526c3ca2',
     'pcltar.lib.php' => 'b9313066aad3049bb0041099137a648e',
     'pcltrace.lib.php' => 'eb165fe908cc30c85975b7d35614990b',
-    'pclzip.lib.php' => '7c5bc3eb535a051df497e2be6311a075',
-    'php_compatibility_handler.php' => 'ecf9d5fe532b21465d6d8f6b119a85ef',
+    'pclzip.lib.php' => 'fd0b9105112482b69bfe65dc937f393a',
+    'php_compatibility_handler.php' => 'bfedef3a7293b057c714f1298aa29020',
     'plugin_class.php' => '453ea0efe227064fe8d28db3aa7e1fd4',
     'pop3_class.php' => 'c2c157306f6c670ca8f085a041ea2b3a',
     'popup_handler.php' => '2b1fce18c47ee2645594ebf9a1a89170',
     'pref_class.php' => 'd054715028bcff3608e735ba1793f739',
     'preset_class.php' => 'e1ba0054fafb162bba13960acf66aaf6',
-    'profanity_filter.php' => '0337741876d3f8046db4aa8a4663ff0c',
+    'profanity_filter.php' => '7ad95608ae69c52042b0e27c96c6b293',
     'rate_class.php' => '5ab1d2b83bff6a28489d50534d69c460',
-    'ren_help.php' => '581be213fe256b4f611dfd348b90c781',
+    'ren_help.php' => 'f48fd86873af8daa59499899867924e2',
     'resize_handler.php' => 'ae885747b6f474b67b4a930c38e2e1e7',
     'search_class.php' => '584d45a8308a89c2a46e445a8d7e66e4',
-    'secure_img_handler.php' => 'cb5fa5bc549034d808887e62dc4bfcbd',
-    'secure_img_render.php' => 'd99724f791f92c408ad20d4f0e6a32a6',
+    'secure_img_handler.php' => '05fb734037c47bced5454ba2bbca0c16',
+    'secure_img_render.php' => 'c8fb615bbcb3d22fe0e0e943e0b88d0e',
     'session_handler.php' => '6609d7029789a7e977c601fc7d80b11b',
     'shortcode_handler.php' => 'ca69b5c2084f3183d1e6e0abf7f63e7e',
-    'sitelinks_class.php' => 'bc4735caccd43eef146f0866fb175386',
+    'sitelinks_class.php' => '9b5b58152182ce45c36808c32f1034bd',
     'smtp.php' => 'e3802cca9a715e79e93569750c0459fc',
     'theme_handler.php' => '008360ee83ad9b0b9a39c6285d09045e',
     'traffic_class.php' => 'eef68f1158a5059ee6e0c87367ac9f97',
     'traffic_class_display.php' => 'c31381644d311d086744dbec0a69ba29',
     'upload_handler.php' => 'f64d44e059aeaf76e0876175b9f57c7d',
-    'user_extended_class.php' => 'fc0b890fa298a4595b65c7f31339c5b5',
+    'user_extended_class.php' => 'b3826e1d3bd69eeaaae10dbff63b078e',
     'user_func.php' => '6885908b955e072bb78fef95e0a40f87',
-    'user_select_class.php' => '6e55690ca9c33aa3c21c7f1985e881f4',
+    'user_select_class.php' => 'e5bf8f03d63b4401b1ffbda8ef467694',
     'userclass_class.php' => '117e778284aad0e8f4b344ca0d4189dd',
     'usersession_class.php' => '582e2228f8e563a930f11199f27b019d',
-    'xml_class.php' => '6b5d44c500020607985ec73449c8cdea',
+    'xml_class.php' => 'c42d033b8519633f7942810aa5ba8096',
   ),
   $coredir['images'] => 
   array (
@@ -1255,7 +1269,7 @@
     'logo_template_large.png' => 'cce83a8f84255d2bab00522b73a4e6d4',
     'pcmag.png' => 'abe521ccc3a89a43ff641ab3daf1f37d',
     'splash.jpg' => '7f749391cb6d31dcf9c9145f3d30df4d',
-    'thumb.php' => '7ea9b612f755c6f9b20a745a13e309fd',
+    'thumb.php' => '80f502f1b01f5dfc98ff91bf599ff136',
   ),
   $coredir['languages'] => 
   array (
@@ -1270,7 +1284,7 @@
           'cache.php' => 'e39c676c25b85a53965357a81b3875d0',
           'cpage.php' => '4e28f25d204f1fdc72f4a9dd20dc31ce',
           'db.php' => 'eef37b09ed2c21fdfeb96a4f2e588879',
-          'download.php' => '60b363fdc6b9b17148c7f2c744dd00a2',
+          'download.php' => '9e2eaeeba7afe29eeaeed34d21b16f22',
           'emoticon.php' => '61824db751de09f20fe9cb887a89ca83',
           'fileinspector.php' => '86a5044a9a9f6815cb5a2e2f3b59990b',
           'filemanager.php' => 'aaff4f5a22db796d3dfff72a741461c1',
@@ -1297,50 +1311,50 @@
           'users_extended.php' => 'af8d62ff77304e40c10ac365ecb8a8a9',
           'wmessage.php' => '06be89e920e35429e90adc5f54445053',
         ),
-        'lan_admin.php' => '667d58f988183a8d8a148d69e12511d5',
+        'lan_admin.php' => '4824c80560bbc3385db24673864507e9',
         'lan_admin_log.php' => 'da9d4f6af4ab0dafce14408b88e5a7ae',
         'lan_administrator.php' => '3eaf0d0b14adca57a4606b73c7a7be24',
         'lan_banlist.php' => '260b7e19f84798e1ca6371a71db1d294',
         'lan_banner.php' => 'f64903cbc17497df42f471f327c382d8',
         'lan_cache.php' => 'e4e9c1785e92595921252e2cf6a099e7',
         'lan_check_user.php' => 'b09d1a34a5623f2533bf060fe85359ed',
-        'lan_cpage.php' => 'cf782edd1b07b9429623853ffbd4356c',
-        'lan_credits.php' => '7b004b945a1a480cd8b72ac0df2a474f',
+        'lan_cpage.php' => '434d39456bb17cf612e5bf60631c9360',
+        'lan_credits.php' => 'f02d425cb8e986e7fdec9a464640f31c',
         'lan_db.php' => '2dd4d09c54c7e466732ff15b59b6c1cf',
         'lan_db_verify.php' => 'a7a5f80f124cb104a6e60166f2589877',
         'lan_docs.php' => '9df02b4a6fafef4e9be2962bfeaed509',
-        'lan_download.php' => '53b2f1f75ea8797518c8e54ccf3acbbd',
+        'lan_download.php' => '57af709ca30866083b2fdcaef09783dc',
         'lan_e107_update.php' => '06e75a49b55733d7e5ffa6a968113af3',
         'lan_emoticon.php' => 'c3a9e4cd7c0cab4f2cdbb4f24620b538',
         'lan_fileinspector.php' => 'aa6ec8442d1205564ecfca27becc63fa',
         'lan_filemanager.php' => 'a32d1274437c68f7038ba006af0862bb',
         'lan_fla.php' => '841218087aecbf68c9629ff0cefa490a',
-        'lan_footer.php' => '5a8da94b888ea3c452166664c182c461',
+        'lan_footer.php' => 'e9986abfba7458c4605b9986b915db5b',
         'lan_frontpage.php' => 'e3a2e085730ab8e74d4dc62446bf54ff',
         'lan_header.php' => 'fe9b76d39a11a579566670879b12bf63',
         'lan_image.php' => 'a1928159cec5539caf1d32c1b8fbac23',
         'lan_lancheck.php' => '9eea32afd605d6d03b28e064da067b61',
-        'lan_language.php' => '3c9d4f20079c9720ae7a19dca05f69de',
+        'lan_language.php' => '7397cb9caa694a1e8033308ec326ce1c',
         'lan_links.php' => 'c8f88fbfbbd6e3e9d0d18d7955b7ffac',
-        'lan_mailout.php' => '28e2d186c18e910852d4485900d4d51d',
+        'lan_mailout.php' => '49972c5b43fe4341e1419d2a94dee864',
         'lan_menus.php' => '907505caa943ce9469b882e82fef72f2',
         'lan_message.php' => '9b5dc4ec9230bc114644188187272371',
         'lan_meta.php' => 'fb0068f9717c59b8973508d405121344',
         'lan_modcomment.php' => 'd96f55439d8cd9779766d3c4393dc6c5',
-        'lan_newspost.php' => 'edffe6d60264679c26cbef87a86baff4',
+        'lan_newspost.php' => '34b17c81ac3bbc4bee72f644624c813d',
         'lan_notify.php' => '6f7a252b6ac7e78a2325f5cddca153e0',
-        'lan_plugin.php' => 'f3dffb02c7f8ae898b1b6e423e0d95ee',
-        'lan_prefs.php' => '3c6c33f6a06ea4fbed06e77cb0d836fb',
+        'lan_plugin.php' => '381bf223550b49b03001809c2384a85c',
+        'lan_prefs.php' => '01ed0800386a060cc41292f447139606',
         'lan_search.php' => 'aefebce7e8e000cf23cdfa7ef97e9a4c',
         'lan_theme.php' => '23db85c43ac49cde3fc728e5277d808d',
         'lan_ugflag.php' => 'a7ee88dde31b32f021ff98419bee0fc2',
         'lan_updateadmin.php' => '64f87bc7886028efd69cffed750510db',
         'lan_upload.php' => 'b5d2d8c5eb9ca5367b2bd0a9021fb5d0',
         'lan_userclass.php' => '6c1291c06699d573c5a3d8bb9e84ac4d',
-        'lan_userclass2.php' => 'bea7b61cf91cb9cc3f35da1e5b2c75a9',
+        'lan_userclass2.php' => '6f4d7fe63fc3c5d78e026e25b59a729a',
         'lan_userinfo.php' => 'eca9060238e2fabd6bf427f61ed48c6c',
-        'lan_users.php' => '5e59f35f0c2c3361d56fd9d692d7a5aa',
-        'lan_users_extended.php' => 'e4595bdf2f139be5c4e50bd87714d6e9',
+        'lan_users.php' => 'f2b83ff85ccfee477ac5f4f19c4a441b',
+        'lan_users_extended.php' => 'd09d843ddef35897d81cf5e930e2d8ba',
         'lan_wmessage.php' => '2977457ef1a96253bd352b2618fc6886',
       ),
       'English.php' => '000e2b68e79b11c182fa2728f45f4078',
@@ -1348,9 +1362,9 @@
       'lan_comment.php' => '683a6bf1de72f9e40c5c94f08bb8d915',
       'lan_contact.php' => 'e6b05827065cfc1f4f88f8d474b2f4e4',
       'lan_date.php' => 'cb650a1f0bc9be44631de0211aceaf70',
-      'lan_download.php' => '2ab49af9ddd9c08ae72d417ae38b1b57',
+      'lan_download.php' => 'ef5d6dfed05c3eb59dbc66ca8e2a4931',
       'lan_email.php' => 'e73a709f16284cd9b2e94230ea19f30e',
-      'lan_error.php' => 'f7b189e16fe30da69bfbdbf55c5c65c9',
+      'lan_error.php' => '70191ace1f300a2cbce74d2f1bd67637',
       'lan_fpw.php' => '0325398c51a1f1f62672f3debb214c36',
       'lan_installer.php' => '600b229f8295ab22d95494d1658cdd49',
       'lan_login.php' => '4da79429580b285e2adbc5a5a5bc3ee0',
@@ -1367,7 +1381,7 @@
       'lan_rate.php' => 'd577ab20dfb0808349e88bd700c9f1be',
       'lan_ren_help.php' => '451b7b3280cd773378c0d970e6f0d18d',
       'lan_search.php' => '40965d93b14de91581baab8aabbff435',
-      'lan_signup.php' => '9803007ffb955b3932947563ee230c3d',
+      'lan_signup.php' => '9de49abb143444ec342112d446cec915',
       'lan_sitedown.php' => 'e6d66b456800b64f0ea5b0b2b593dd2f',
       'lan_sitelinks.php' => '4121c0f45c6f010c3bb8a395ad7333a9',
       'lan_submitnews.php' => 'e7c789529e202c28b56aa3a06ad73fa5',
@@ -1379,7 +1393,7 @@
       'lan_user_select.php' => 'cd5e96d51d480caf4db510d5fa524233',
       'lan_userclass.php' => '0f52a39b5ca88ee357edaf2d111f568f',
       'lan_userposts.php' => 'c1b849be22e0e930e52131c16f20bc83',
-      'lan_usersettings.php' => 'b920d4c22f69563c281735b85bcfcf62',
+      'lan_usersettings.php' => 'f20d15a09094bc922dc6e7ec6effa6a1',
     ),
     'index.html' => 'd41d8cd98f00b204e9800998ecf8427e',
   ),
@@ -1413,7 +1427,7 @@
       'ldap_conf.php' => 'f5d3c58e8e292ad1d6b515886e46330a',
       'otherdb_auth.php' => 'b5f874d3cf8faa136b5b5216fb981647',
       'otherdb_conf.php' => 'dec34880c2f4fdeb20ab578ccbaa7bae',
-      'plugin.php' => '0881fea148038bb4fa6aa6e65984a073',
+      'plugin.php' => '4c7bab7cda917b808fb991813a847558',
     ),
     'alt_news' => 
     array (
@@ -1490,20 +1504,20 @@
         'search_parser.php' => 'b3df07f489ba4425967baec9696dd4e6',
       ),
       'admin_config.php' => 'e1b294952369db59f5ff277c320258bb',
-      'calendar.php' => '163440a1b1382c160343120c1b66a443',
+      'calendar.php' => '299b7b46c8bd137ac0434b6a488fc364',
       'calendar_menu.php' => '898974d7e3c17bbb6f410fd7a9f81c36',
-      'calendar_shortcodes.php' => 'e550ad169523b4092b1564931cf3c1dc',
-      'calendar_sql.php' => '39899457df794d8b56c58d3b1c8db88e',
+      'calendar_shortcodes.php' => '073fe43cf84ba08fc672d5bf3052c679',
+      'calendar_sql.php' => 'e7f2857c7c54dac999c443283e05940c',
       'calendar_template.php' => 'd2ee2bc496017ec083e191ba05846521',
       'e_list.php' => '645f43cf7f01952906dbb83b8cb13cc0',
       'e_notify.php' => 'c2ee50281865bce1a764ee34eb2475d1',
       'e_rss.php' => '077b415bf70aaae7b8de3d55a5912632',
       'e_search.php' => '2c9d89dbe14cf0240c681dc99aec0df5',
-      'ecal_class.php' => '1b5c7f75be14a51894250ff35c459682',
+      'ecal_class.php' => '2899fcaf7a18fa5b5b0f905a3ee37786',
       'event.php' => '9e7ac615ce4b86b39364f5a1dbab8357',
       'index.html' => 'd41d8cd98f00b204e9800998ecf8427e',
       'next_event_menu.php' => 'fc2d7d490814d906f5f636729cf5d2c2',
-      'plugin.php' => 'aa7d7043edbdc031bebf799bf26620c1',
+      'plugin.php' => '2235e731a057a00cfbc851412a6b1c30',
       'subs_menu.php' => 'ba5b881e8344dd4986a3b0df8169beab',
       'subscribe.php' => 'b2d2811791d4967f6121ea44ecf3c4b7',
     ),
@@ -1530,16 +1544,16 @@
         'search_parser.php' => 'b13719aa6145bdefa5b7af2d11c8b885',
       ),
       'admin_chatbox.php' => 'a4b459c321bd8bfbf16262354cce4d7b',
-      'chat.php' => '3f5ea8df6f86f557778adb38170bb989',
+      'chat.php' => '7fcfad2a7f3f6a2cb974d688c0eafb09',
       'chat_template.php' => '14c2ebf62352cf10f2b0b83e100ae856',
-      'chatbox_menu.php' => 'b7aa50bf2742c18799afd3e85dea4d56',
-      'chatbox_sql.php' => 'aeb0d501ff23212e304f7f9a83d6926d',
+      'chatbox_menu.php' => 'b77eabb1a932a241e60d3893cc254006',
+      'chatbox_sql.php' => '8f0b99b08c14602234943d11d61c482e',
       'e_list.php' => '11fde3fe8b58bec52bc6220053498509',
       'e_notify.php' => '0a2933c585217bdbe973704be60775a6',
       'e_rss.php' => 'e48224955d484055c9c662f430d529ae',
       'e_search.php' => 'd1438d8ba352df93c5fcdcf67805c229',
       'e_status.php' => 'ec7b5b0100e4be7210ea7e786096eeee',
-      'plugin.php' => '58f992ae75af09acefdf3298049b850b',
+      'plugin.php' => 'a7ec104323ef4afc54ae5fbd8424aacf',
     ),
     'clock_menu' => 
     array (
@@ -1552,7 +1566,7 @@
         'English.php' => '35c0f1f40f6863bea2cdff628b49ec4a',
       ),
       'clock.js' => '98871f097e7b77f981df163421edb721',
-      'clock_menu.php' => '833e619455af1ab81898ee216f96bdae',
+      'clock_menu.php' => '56f455a14097c438f40b2051ef2871d2',
       'config.php' => '1e7acf130ffd49fa280793d32657cf44',
     ),
     'comment_menu' => 
@@ -1584,10 +1598,10 @@
       'handlers' => 
       array (
         'content_class.php' => '19c7c014733cddcf656088210bd879a8',
-        'content_convert_class.php' => '7835e9c8569bd60d332bc9da629f251c',
+        'content_convert_class.php' => 'efb3baae82fd0aa890d7b288f306720d',
         'content_db_class.php' => '36e1239b945ea5f23868f66560d88ae7',
         'content_defines.php' => '17705ead3b96dabdd746a32c8f29935f',
-        'content_form_class.php' => '01bb29c84ee4e88f242873c925bfc059',
+        'content_form_class.php' => '21df2a946fb4e2230455c2247a7f4393',
         'content_preset.php' => 'f3061b1451c85ffa473bf5520d41b49a',
       ),
       'images' => 
@@ -1705,27 +1719,27 @@
         'content_submit_type_template.php' => '58eb0863e060770ef4c59d28f51b8ccb',
         'content_type_template.php' => '5018177cc8fde34aeba62a2b04887322',
       ),
-      'admin_content_config.php' => '974dbd9eb0f960606718ef84624899b9',
+      'admin_content_config.php' => '412c40999f0d23c299508d0dc9ed03c4',
       'content.js' => 'd41d8cd98f00b204e9800998ecf8427e',
-      'content.php' => '7c04b74b491528d0ee979b1d6c0f4696',
-      'content_manager.php' => '8b4566cf318e663436cea4893dedf995',
+      'content.php' => 'fce17190563f678c19c24c2f402ae810',
+      'content_manager.php' => '3041be3c78fcbd9d47eec36681b60d0e',
       'content_shortcodes.php' => '6fe643a18d7f1b8a877eed93f82bb165',
-      'content_sql.php' => '51447fa07fd2deb63586a2aae081a842',
+      'content_sql.php' => 'd7a84ed35a0d9d8a671bfeb1006ca5eb',
       'content_submit.php' => '57fa063db6a52dcbc28d6afacd301eef',
-      'content_update.php' => '0de1b8f4e2e547422dbc97ff9d958b0d',
+      'content_update.php' => '4aae0d6c228ff659e8ea93dc975b3d21',
       'content_update_check.php' => 'b26a684630318dd56aa2ddeae77786e3',
       'e_comment.php' => 'd1f4f87a428c69c499818721d0f48331',
-      'e_emailprint.php' => 'aa8753897ec82ed8fda64d5ce2492eae',
+      'e_emailprint.php' => '01348b97b84991e787adbdc5fc0a0ad0',
       'e_frontpage.php' => 'fe4139040c268b13517b9a78fa35f190',
       'e_help.php' => '4320e5f811fd90d98d2339b11575d57c',
       'e_latest.php' => 'dad7101dbd2063723e94300723e67c2e',
       'e_list.php' => '179fdb2049690d93d67b50629c92e5e3',
-      'e_meta.php' => 'd6cd1f915a8f3b7cb8e51d8a55494459',
+      'e_meta.php' => '2faf335cd609b5a35474893aee550273',
       'e_notify.php' => '56f5e191f1e39a30a0a3bc28f3e8d612',
       'e_rss.php' => '76954b881d598f26ecaebb4422f87696',
       'e_search.php' => '4018912931e0edd7377caaa4b8c1071b',
       'e_status.php' => 'cf12158206b16c94292788fb9771c478',
-      'plugin.php' => '6cb25aa05aafd3fac9e8f97eaa08108b',
+      'plugin.php' => 'c96ed0aed58933d6d23952f7a4021da0',
     ),
     'counter_menu' => 
     array (
@@ -1754,7 +1768,7 @@
       'admin_config.php' => '98c7e14afe71526f246128f66c01a21d',
       'e_rss.php' => 'e3b277cca6f5262dcee948434aacfc5e',
       'featurebox.php' => 'd2bae775a6f99daa1237d86d7c6651e5',
-      'plugin.php' => '73ce45b596e721d672168519d6656780',
+      'plugin.php' => '956d518af8bf120f2fe041c7e6e9a350',
     ),
     'forum' => 
     array (
@@ -1876,7 +1890,7 @@
         'English' => 
         array (
           'lan_forum.php' => '49a0d82c1ae146419d52ad4d08786bb2',
-          'lan_forum_admin.php' => 'cfbfe03ae3eb1d955fb6d32ad6a93c9b',
+          'lan_forum_admin.php' => '0eb27907ec2f619515f82b3a653f3c02',
           'lan_forum_conf.php' => '0e5d0da729ab0ad41f90ce8dfc23fae1',
           'lan_forum_frontpage.php' => '80f99c88f4e92429d8ca40c439fd68d3',
           'lan_forum_notify.php' => 'd5ba57c5a1a59e72e726d0d04c8c5fce',
@@ -1904,35 +1918,35 @@
         'forum_viewforum_template.php' => '275b8e0b7d657c0eba59afdb2f7343b0',
         'forum_viewtopic_template.php' => 'fee1235c37efb4ba3130b52e27895fd9',
       ),
-      'e_emailprint.php' => '8a41fe10faf7c2293a65bd66e598dd82',
+      'e_emailprint.php' => 'eaa58e545ce417d316551d966cedd0f5',
       'e_frontpage.php' => '47fc49f7f27140d518eb73932b6023c6',
       'e_latest.php' => 'ba485c38b9ab90c0f572a2397b49c9f5',
       'e_linkgen.php' => 'ef62f12a9f61803c7f58ea7f3045d236',
-      'e_list.php' => '8c318e2f3a838ca643e1434a199a11f7',
+      'e_list.php' => '0639a65a7c2d737364dda03cac4b5910',
       'e_notify.php' => '2dd2a34be7570aade6d1e7f18a3b8b88',
       'e_rss.php' => 'cf96fbd5d8ae9f83f6ca2b98ac069970',
       'e_search.php' => 'f0c6eabebb2359afd8bc4557bbc3dd02',
       'e_status.php' => 'e707e64a960612d443e16906faaf0e22',
-      'forum.php' => 'd927a84a7fd8835e7eb4fc03a4f31272',
-      'forum_admin.php' => '479d473f1f0c5edf4305d4f2b0bffa9a',
-      'forum_class.php' => 'bbd3791f40a8092244579fedfe51c536',
-      'forum_conf.php' => 'ce062ed4be8151a64d7beaec2b237dd9',
+      'forum.php' => 'c953a361a1497f246d994a331569ea68',
+      'forum_admin.php' => '1a1cecdeddf2b485d945bedd8e236a0c',
+      'forum_class.php' => '73b910e41a07ad0aed085fb4e119384e',
+      'forum_conf.php' => '2e9e8b1060173d5c1f376f5a1ba3b3ca',
       'forum_mod.php' => 'd32054b1725ca2c28e5995917093b37b',
-      'forum_post.php' => '10003e81be4d6b260529ed6d507eb1dc',
+      'forum_post.php' => '50a3946ce4a17fee48dedb5875e65293',
       'forum_post_shortcodes.php' => '58d0390a6fa95d713603a203025eb3f2',
-      'forum_shortcodes.php' => 'dce37f018fa3be3a2bb67c740fe4725f',
-      'forum_sql.php' => '3355b8219c200d8d669ce08e59053465',
-      'forum_stats.php' => '703dbb90653630a2edce005bee3923a3',
+      'forum_shortcodes.php' => 'c4070dc6e1eb25284f844e46a7a9cdcb',
+      'forum_sql.php' => '5a3560b2363ea1d679036aa0a4eb2d2f',
+      'forum_stats.php' => 'ee30808987cbaa6d233601cfab8b7c39',
       'forum_test.php' => 'ed668e3268952cb268b3f4aca0d2e37a',
       'forum_update.php' => 'de3c213e1522e6b28a93a75d8e1f8f93',
       'forum_update_check.php' => '7993cc7314f4927f61b4e2b21f073dff',
-      'forum_uploads.php' => '56b8c599d14702bee8fcff7b218e4d47',
-      'forum_viewforum.php' => '9125cf13da0cb36a6c3d9c761332ddf8',
-      'forum_viewtopic.php' => 'c3b48f0c45341a1e4e660e55a1b7db4c',
+      'forum_uploads.php' => 'ab0c1c7f46c9f73890e8906b2091d36b',
+      'forum_viewforum.php' => 'ed767c56e70025fb5fa11e6fd6b8fbec',
+      'forum_viewtopic.php' => '3021473340f93d9df4057e70853324bd',
       'index.php' => 'c7fcd091b1a82fd885b7d193595c7ad8',
-      'newforumposts_menu.php' => 'fd8930876dab1da6d96f889c3526e6b9',
+      'newforumposts_menu.php' => '953569947c1522075f110ddcc0561dc6',
       'newforumposts_menu_config.php' => 'ffd1b077ee3529706ce587892e112bdb',
-      'plugin.php' => '4845eda9ce5780cf269f6ce346fb8fc2',
+      'plugin.php' => '3eccbbc3e0adcc145b0f4aea2a25f0cf',
     ),
     'gsitemap' => 
     array (
@@ -1946,8 +1960,8 @@
         'gsitemap_English.php' => '3ef04f9ce48cf9bd6ea602525ee98465',
       ),
       'admin_config.php' => '8e979ca0655c04bdf9d90564330a9022',
-      'gsitemap_sql.php' => '81a34608c8cdd19c51fece5a25109159',
-      'plugin.php' => '4f808c30e31f7be66d597ef1e23f3b3b',
+      'gsitemap_sql.php' => '1b113956d7964d2b44a027cb8bcc91bb',
+      'plugin.php' => '8b1ab5750ee9bba949ba6b52bd48fe03',
     ),
     'integrity_check' => 
     array (
@@ -2000,7 +2014,7 @@
         'search_comments.php' => 'f887861124deb8c3b087359cb9f3210c',
         'search_parser.php' => '20039d017a7341b7902a80a44dd0df7f',
       ),
-      'admin_linkspage_config.php' => 'edd9432952c2ca5fd4e225d518b7339f',
+      'admin_linkspage_config.php' => 'd828bf4cb8f599cd64c2b73e333f3d48',
       'e_comment.php' => '13b0aa38e21d08a535276a7526cedde2',
       'e_frontpage.php' => 'afdc379a04c4918247d26559dfc4d4e2',
       'e_help.php' => '8358d0abfac6d1ed475bfca52a259b06',
@@ -2012,12 +2026,12 @@
       'e_status.php' => 'e1b28e610e6f89277440430a2f8747d8',
       'link_class.php' => 'ca56a4af2cabb5092f8591da60f0a309',
       'link_defines.php' => 'c74dab30a2b3f330a05e4ac95a6c068a',
-      'link_menu.php' => '2bf6afd0218a170b8d27b6a48c6b1320',
-      'link_shortcodes.php' => '0f5e9fd5e457177a51096a5952c3a15a',
+      'link_menu.php' => '4d088d2e0770954afcd78ac56456765b',
+      'link_shortcodes.php' => '259ec21b4f86cd9ccf1b9d18aa7ad983',
       'links.php' => 'fa8e533d0b48f82edb3854dfcf3ddd8f',
-      'links_page_sql.php' => 'cf7dc235d5246d755b1f231223cce3cd',
+      'links_page_sql.php' => '25d000b7df2b32e190cdde75be17e19f',
       'links_template.php' => '0db68fac6783d782ec188fc7ad5a486e',
-      'plugin.php' => 'ed58cc7b12ecdcf56c69c9ac3e17de11',
+      'plugin.php' => 'fa8cc14316a027f2a5e69dac5ee58587',
     ),
     'linkwords' => 
     array (
@@ -2032,8 +2046,8 @@
       ),
       'admin_config.php' => 'fb96cbde42a8d6ae8e7d41f84f5cea1c',
       'linkwords.php' => 'f17376241f88a9d978b9f9122bf21f15',
-      'linkwords_sql.php' => '33f4d40e8da9aa758c512d4847f6d5d7',
-      'plugin.php' => 'cd0082ce754a27901e04314db82f604d',
+      'linkwords_sql.php' => 'a846d028cfeeb778e7db62b1799962a1',
+      'plugin.php' => 'ea8b844abebf6cad40a90dd1cd480ef6',
     ),
     'list_new' => 
     array (
@@ -2069,11 +2083,11 @@
       ),
       'admin_list_config.php' => '02d59542009fc531bd2cd803f02eac32',
       'list.php' => 'd944b381d79ba194ed8f3e816c07dfb7',
-      'list_class.php' => '3dec1cdf02add19090a80d379ef68a6b',
-      'list_new_menu.php' => 'a971c834704a390b275237f691b03a65',
-      'list_recent_menu.php' => '521f3ac6b51d9feb88b97a6b03fa48f3',
-      'list_shortcodes.php' => '1c4972d09e83f1945c6652126bba6248',
-      'list_template.php' => 'ca73750411b19f1b8df71c5111fe1789',
+      'list_class.php' => 'cd9f009b8c720ed7955b93fcce3f368f',
+      'list_new_menu.php' => 'b47f1cb3fe0c97dd00635a45375e4acb',
+      'list_recent_menu.php' => '50435ceb28a41e66f2adee448c3b1c7a',
+      'list_shortcodes.php' => 'a633155a8d4377b4f2d7a8d5c54ea415',
+      'list_template.php' => 'bacc9eddc152f839efdf842c569c34a5',
       'plugin.php' => 'b1e1a641faa99690f826efb8e29ead63',
     ),
     'log' => 
@@ -2082,6 +2096,7 @@
       array (
         'abrowse.png' => 'da9925bf3cee78bb965c668857bb7225',
         'amaya.png' => '974a9fb5ae38e4d592aec302594ba58f',
+        'android.png' => '7d876f7346a7c108324c43062d20a2b8',
         'ant.png' => 'f667945ec89b7883922828deec0e2fd2',
         'aol.png' => '5681ae48b5ab3fca312ade1b42658ee2',
         'aol2.png' => '5681ae48b5ab3fca312ade1b42658ee2',
@@ -2094,6 +2109,7 @@
         'blazer.png' => '681d0c56db0d9eeec59e3b804dc809a8',
         'camino.png' => 'bcf331c02452984bada0f73534e15578',
         'chimera.png' => '6a6ad07a8495264fc00798ee298f3c04',
+        'chrome.png' => 'ba29192f2ff209f103742281a2efc244',
         'columbus.png' => 'd24df5eebe796dddf95eb6630f1ce1d3',
         'crazybrowser.png' => '96283b3c49fe550c35b96c595167670a',
         'curl.png' => 'c17099e14ae52777d46079cb126349ea',
@@ -2133,6 +2149,7 @@
         'netpositive.png' => 'f3bf2146aa97c9821ce096f5d38d9ee5',
         'netscape.png' => '4dda4c2e4c32cc5f1e7cdb5b56156f5c',
         'netscape2.png' => '4dda4c2e4c32cc5f1e7cdb5b56156f5c',
+        'nokia.png' => '3daa3619b7ee467cfc8964e70cac46c5',
         'omniweb.png' => '6b1d71fb7d85a3a5739bf33fa7646031',
         'openbsd.png' => '36a1043bb8aacd3ea0a85c5f4de3130a',
         'opera.png' => '8892071cd4ecb31298ec08373d1491dc',
@@ -2167,7 +2184,7 @@
       array (
         'admin' => 
         array (
-          'English.php' => '554794ee0ce8a50a53dda14b05db5ffe',
+          'English.php' => 'c9ce83c6e3ebed29d412446001ea2d49',
         ),
         'English.php' => '3d94fa3cc0585a517e6b7a27fe7c838e',
       ),
@@ -2175,16 +2192,16 @@
       array (
         'null.txt' => 'd41d8cd98f00b204e9800998ecf8427e',
       ),
-      'admin_config.php' => 'e7167d07a71e6754378124ca0ed4621c',
+      'admin_config.php' => 'f5b386d9f28260b3c6bfaa8d5ab91ddd',
       'consolidate.php' => '4ad263421a3173059c6e3b37e2131890',
       'e_meta.php' => 'c7c1bff20fb308d2461bf3bf9ac89d45',
-      'log.php' => 'b9ef4aeb2e3d4e9e2de0bc9cdf4c6581',
-      'log_sql.php' => '6593acd37950a8e486b0fc1490cf1750',
+      'log.php' => '30dc9d881572f1db10f770711969656a',
+      'log_sql.php' => 'd2f48ba525c87b3f11cf5758e68cc9d2',
       'log_update.php' => '96ffd24abbaadb7086b49d19feeb3763',
       'log_update_check.php' => '98648cff5205b2b3791648d955e979fc',
-      'loginfo.php' => '5d0933ca88d9ffedd804ba5f17c130d1',
-      'plugin.php' => '8383bfb720a079fe053b657de38492a8',
-      'stats.php' => '5d002151b5264e5e428071476cd3c360',
+      'loginfo.php' => 'fc7c1a0fb5b7d3f52db77353893e70dd',
+      'plugin.php' => 'd5ea7569683aded9c803c0a0094934d6',
+      'stats.php' => 'aac77f50ecb2e10ea74735ef16c43dca',
     ),
     'login_menu' => 
     array (
@@ -2194,7 +2211,7 @@
       ),
       'config.php' => '73b9b2256e5e2b6cd1086b659bf46991',
       'login_menu.php' => 'e6fecb0ad4389d44d3b49f6a26f1321d',
-      'login_menu_shortcodes.php' => 'cb02d921c79e066f9cfd986e5100260a',
+      'login_menu_shortcodes.php' => 'ae457a306c7f6e9a7313077dbf6437c5',
       'login_menu_template.php' => 'a284e126919afb2e92b22cdb8c2770b2',
     ),
     'newforumposts_main' => 
@@ -2211,7 +2228,7 @@
       ),
       'admin_config.php' => '443dff595b79b2037a58658302bf6bf1',
       'newforumposts.sc' => '29784d1f53f650fa7327e367878217d3',
-      'newforumposts_main.php' => '3ca22c338c43190e630f8026a44dc1a1',
+      'newforumposts_main.php' => '782a991a03f1defe81ad45fe5bdc4ebe',
       'plugin.php' => 'd3822b3a28c79a4209a4851882e1dbeb',
     ),
     'newsfeed' => 
@@ -2234,10 +2251,10 @@
       'admin_config.php' => 'eecd350cffde4af23cc1a7366b5e949c',
       'e_frontpage.php' => 'e382f0f562128593eb6f92ec404fa6e3',
       'e_help.php' => '3127973c339216ff9f080cc5edc51474',
-      'newsfeed.php' => '5a04876cd3461477a2f2c861b9e7fb68',
-      'newsfeed_functions.php' => 'd6a9fd24a98a50c69516921c001d2a53',
+      'newsfeed.php' => 'e4d7d6b2a4c3da4d0f1f5ab6d023ffeb',
+      'newsfeed_functions.php' => '930aa10475d1d72ed130e4a726c5fd17',
       'newsfeed_menu.php' => 'f2ca9780e96d8a86da73e4ca35fa66eb',
-      'plugin.php' => '33f8f85e8481de7e4c0f4758cb48e3ac',
+      'plugin.php' => '5bbfc89b2d9caf58cc2aa91f92c94918',
     ),
     'newsletter' => 
     array (
@@ -2252,7 +2269,7 @@
       ),
       'admin_config.php' => '428d4dc89338733129a2fce35ea9bdf3',
       'newsletter_menu.php' => 'f00e460efd1269ce59d751add07fc9c7',
-      'plugin.php' => '0959f4b60efb06f027bd782232bedf11',
+      'plugin.php' => '5ee1421f28cd726ad28757e367c52989',
     ),
     'online_extended_menu' => 
     array (
@@ -2264,7 +2281,7 @@
       array (
         'English.php' => 'c36800efbb062cba2b899cf4650406d6',
       ),
-      'online_extended_menu.php' => '8a496cbb1369c1a24ec2d6fa10cc995a',
+      'online_extended_menu.php' => '0f6de5340745d85cfaf6d22c2aea1574',
     ),
     'online_menu' => 
     array (
@@ -2337,7 +2354,7 @@
       'fpdf.css' => '35c07d5049ac6e55b8ab473c6dc38bf0',
       'fpdf.php' => 'da7385d29345f1c12fe85b6cacf5e905',
       'pdf.php' => '913314caf7dce67dc08c0001879dc203',
-      'pdf.sc' => 'c6d60562a17736112f283861a44cd186',
+      'pdf.sc' => '9f274b5cc658c20a825d0d438a623900',
       'plugin.php' => '6796823038ad4e146e9365ebbb8bc59a',
       'ufpdf.php' => 'ba87afe3cb2f777f921ea8a3a0457abd',
     ),
@@ -2371,17 +2388,17 @@
         'English.php' => '8d2a4b55dbf033d50c674566a6ec9886',
       ),
       'index.html' => 'd41d8cd98f00b204e9800998ecf8427e',
-      'plugin.php' => 'bd0afd6c64e848f160f36c45d455f46f',
+      'plugin.php' => 'b7826793483f664065dff50d24f531b9',
       'pm.php' => '78e6fcfb4199245e645ae1d366e8657a',
-      'pm_class.php' => 'b5495386de49cfb85db679865e03e8d9',
+      'pm_class.php' => '96ed74be4d9eb87e875fe2dd658124ad',
       'pm_conf.php' => 'd6361a48ae2f9b3f30c38db472af1667',
       'pm_default.php' => 'b7981b895e3afc6bc95a2198f0c40423',
       'pm_func.php' => '4bb013a88ec8427ff15a4465709ac74f',
       'pm_notes.txt' => 'df26332907da1f35c4731d8893aea23e',
-      'pm_shortcodes.php' => '3fb3da1be9ef990f0fffc10745c124d7',
-      'pm_sql.php' => '4608486c1027c6485dc32674fd536dc5',
+      'pm_shortcodes.php' => '57cad23452d1f067a94e5e6cbf994449',
+      'pm_sql.php' => '66ada71d90d805291baa039f8176d0dd',
       'pm_template.php' => '049aa90af2a2b9d67aff528c13dc19cc',
-      'pm_update.php' => '6917b98de87c50b06daa362a2b58a9f1',
+      'pm_update.php' => 'c659882bcdf4d3d7b42ffc48442d04e8',
       'pm_update_check.php' => 'b2f23237307926d599ecf314f59c10bc',
       'private_msg_menu.php' => '6f8432a627f0e4541fc99cda65b76922',
       'sendpm.sc' => '67d107ca6fc1d9016d81abc9d8943a7f',
@@ -2410,11 +2427,11 @@
       ),
       'admin_config.php' => 'c9cc387b19cb5564389aeac876fb629c',
       'oldpolls.php' => 'fe6a2ec02800ba66c32cb75989d2d673',
-      'plugin.php' => '7bc8615d433848974c9b2f696b68ab55',
-      'poll.php' => 'f4aca5b645b46b0e1ec69bfa05efd406',
-      'poll_class.php' => '51f2a20a5b5d1af4240d5756547600c5',
+      'plugin.php' => 'e5d97ec3cdef45310fbe7f782cb18b52',
+      'poll.php' => 'ae1668754554ee22e5d8034307f83dc4',
+      'poll_class.php' => '6f461c10b2f3ba115cc1998627239d02',
       'poll_menu.php' => 'b1c5f9f2665b8c0fd7379fa8e50ca0fd',
-      'poll_sql.php' => 'ffe53748dbd1504f7c4204027814064a',
+      'poll_sql.php' => '3a1e474ba7f75b9b41429ae7b410ff76',
     ),
     'powered_by_menu' => 
     array (
@@ -2440,12 +2457,12 @@
         'English.php' => '7b08065b4fbdf50f5a4029261da3745c',
       ),
       'admin_prefs.php' => '582724f64ea297983075a72cbe1e1082',
-      'e_meta.php' => '9ce294ce774363509e738a203fc62c77',
-      'plugin.php' => '53548c74c6fdb33f580afa957d3aa71a',
-      'rss.php' => '35f6da3ea626e57732b8abca9cf9103a',
+      'e_meta.php' => '6fea117a6384ef5b5f6961c9bbb0b9a3',
+      'plugin.php' => 'cb3db0a83a7ed75cff7023a85d294c3c',
+      'rss.php' => 'e9b5d4168356874041c4fbba24bc80f7',
       'rss_menu.php' => '3353de9a34750d02abb48c449290bcf1',
-      'rss_shortcodes.php' => '349873d68c904be89422f464f2be5d4c',
-      'rss_sql.php' => 'efee18037cab9fbf35cdf81f97efc2a3',
+      'rss_shortcodes.php' => 'd66fbaf1e6078a78a553e11fe308edd5',
+      'rss_sql.php' => '41e90f089b97a3d72c50b3e7f5ced10b',
       'rss_template.php' => '023614657d162b0f155fbe50e6e3dce2',
     ),
     'search_menu' => 
@@ -2483,8 +2500,8 @@
       'admin_config.php' => '089c10ff6fd21d4e26ed4a5621677001',
       'e_meta.php' => '6ed50a8d0f26319e064e9cded604f5fa',
       'modtrackback.php' => '0d65e174ffa687c8381a6c98314be491',
-      'plugin.php' => '1eadec3e108b9bd2affa6d9988e6d4a1',
-      'trackback.php' => '0803ed6318485616312f2a86a139d127',
+      'plugin.php' => '6ebb042e4410b11dac4d051379fb46f6',
+      'trackback.php' => '4de37ed8d07fffa5c8cfb1466171b01f',
       'trackbackClass.php' => 'cab7058e11dee6dca3b1492e270b7f36',
     ),
     'tree_menu' => 
@@ -2494,7 +2511,7 @@
         'English.php' => 'dfec891322965a34ef5124a129e18d88',
       ),
       'config.php' => 'e82d3bf28f3762cb42163b1670015e51',
-      'tree_menu.php' => 'cec264ed4e6f99e4cf17255c0c0f68be',
+      'tree_menu.php' => 'aaba586aba1546a0d1f5d80198564d6f',
     ),
     'userlanguage_menu' => 
     array (
@@ -2729,7 +2746,7 @@
       array (
         'English.php' => '258ebc1d1646d31492f8a24d2def8d90',
       ),
-      'admin_template.php' => 'd0bf5aeabe1313d9e367ad5bc4121974',
+      'admin_template.php' => 'aeac542bd47ca8a7cc2864d22ad5e07f',
       'canvas.css' => 'acdfee6441e3dc292657ca469b669df4',
       'index.html' => 'd41d8cd98f00b204e9800998ecf8427e',
       'nav_menu.css' => 'ac9d2df99166eb5ce87c16bb146bc413',
@@ -2783,7 +2800,7 @@
       'news_template.php' => '8ff2236ab7990c45d7072f5ff626ad5f',
       'poll_template.php' => 'c01388206c3cf373ff04e01c38485d99',
       'preview.png' => 'b164565b63d086a6a5a28fd76097487c',
-      'style.css' => 'be699284eb74ccbd6543eac6f60754ea',
+      'style.css' => 'd016e088e8195dea98c686b0c96321d2',
       'theme.php' => '7677cfd9619f4ead59e389a96772a76f',
     ),
     'kubrick' => 
@@ -3004,20 +3021,21 @@
     ),
     'templates' => 
     array (
-      'admin_template.php' => '605423b5a95430eef0e309d29c2d22ec',
+      'admin_template.php' => '27cf0f3b18fc7cf2c2c999461aa5ca60',
       'banner_template.php' => 'df1a7cc8e987130f21f604123484b109',
       'bbcode_template.php' => 'c050275c3bd261857d5c492da11b7edf',
       'comment_template.php' => 'd4623fdca9b82801ad9ace0347f527fe',
-      'contact_template.php' => '130fbecbfd4a8a89e3515feb658263f9',
-      'download_template.php' => '1da4f99e2dfef2734271ebaaa7dfbe95',
+      'contact_template.php' => 'e5e3c69021c04c13918d4d166b642728',
+      'download_template.php' => 'aec0e423eba7c807f677acd40dbf8314',
       'email_template.php' => '41869d37035cb352d450090e0e0237d0',
-      'footer_default.php' => 'f9b10d772f16113328719fa74f89a380',
-      'fpw_template.php' => 'd3cb36082e7c0450f48f6f844f1ba2f0',
-      'header_default.php' => '8004f2010869d9a132f9696c0b11f229',
+      'footer_default.php' => 'c177167d6a9eee3d9515d73744d5fa5c',
+      'fpw_template.php' => '1431ea272c9ff92a6263f0f229aafeff',
+      'header_default.php' => '99309900774876b679b94690ca72ed7c',
       'index.html' => 'd41d8cd98f00b204e9800998ecf8427e',
-      'login_template.php' => '17768e7adc245a95975467f7194aa4b8',
-      'membersonly_template.php' => '4302b449b4cdfa7f4779134679dccc61',
+      'login_template.php' => 'b33580598a6638c7f26370a56b4a030b',
+      'membersonly_template.php' => '676ea2c380313007d32c89c62f83e6a7',
       'online_template.php' => 'd30fad967e63d6bcfdbdabcd13faec0b',
+      'request_template.php' => '1af389b9e817c29452965d5d135dddb6',
       'search_template.php' => '100782de2e0ac37b7286bc2a1f65a2c2',
       'signup_template.php' => 'b9d75024f729a7158ca3a1946f3afa36',
       'sitedown_template.php' => 'ec76cbe48296ce511afc4e4d9dd05728',
@@ -3058,41 +3076,41 @@
   ),
   'article.php' => '99ff41edab6c0488b360b34db5264b11',
   'banner.php' => '1103034d2d9220f93aa7511952c9c79a',
-  'class2.php' => '85e216b6d39181fca7e611b83a0b5b3f',
-  'comment.php' => 'b87376d301bea9b876302199c31e64da',
-  'contact.php' => '1b6b5e12fe61812235511527e30c0233',
+  'class2.php' => '3aef44e19cb82c29d8f6f7144c0acb18',
+  'comment.php' => '8ac267b76a39a29f183041e988efd33b',
+  'contact.php' => 'ea2c1d44da9b4d1963ca5d79b5e6f21b',
   'content.php' => 'f7c62efce19e34901f7d3366cd3855ce',
-  'download.php' => 'a517d26069e47e82bbdc20b29e14f431',
+  'download.php' => '9b6c309e14133ab5dae05d59d39a8778',
   'e107.htaccess' => '49bf72c8e632a176fb926adee458e359',
   'e107.robots.txt' => '3f7b0f4a9348e494b4cbc1ff8ce84831',
-  'email.php' => '981933d4f454b3fb8f0b0935124d9656',
+  'email.php' => '6df63589a2bc9cfa296cca70c15a9ba7',
   'error.php' => 'fe3e610ee485874fc633c3d11ac51f4b',
   'favicon.ico' => '5fceb78b9124ddae4027396d7cfcd328',
   'forum.php' => '3c10184d52685d7c9a6906a967b7e3d8',
   'forum_viewforum.php' => '4b9fcc3a820ed2f93b4dc707c3ebe3b4',
   'forum_viewtopic.php' => '5fea10d40850fd6f72cfbec7a328e120',
-  'fpw.php' => 'f10add7cb8970f00beb7f76a5f4a7dc2',
+  'fpw.php' => 'e7558d38ec73e5fde8b090dfcb66d3d8',
   'gsitemap.php' => '418c9afee5e3fab04839f5a8cecfbcbc',
   'index.php' => 'e6cb2faf6f50270396a271913b78ed55',
   'links.php' => 'bed206fc2abe8f1307ef4db3b7fee63e',
-  'login.php' => '499052a375e55c3b8ffa837dce63f660',
-  'membersonly.php' => 'f0a4427c20008fb14f819a89ecc7ab25',
-  'news.php' => 'a9293a4f9305da18a22e8be839de81b0',
+  'login.php' => 'd3864019b3d0d21446f0006a32ce1ebe',
+  'membersonly.php' => '9ddbd174e30439869f144bb7dc41f677',
+  'news.php' => '37e239533b5ea7807f1a48615ed0fe2d',
   'online.php' => 'dedde4aafef396cbc2f145fb3f6ba020',
-  'page.php' => '07f60c2d767999581fe52b3acea260e4',
+  'page.php' => 'a36ce021eeed2c78cf4f9d02a3ca2a50',
   'print.php' => 'ff80b3a7061f43d2d17a87339c20abcd',
   'rate.php' => '6a28db191f8bb1ebca3b060d867647eb',
-  'request.php' => '9370500f0b4572630997ffff319dece6',
-  'search.php' => '0b7b88a857d3aa55970f57f423bbeae3',
-  'signup.php' => 'b75228557e632967ab1858404305d400',
-  'sitedown.php' => 'abdca2b0abb281008d3529f5e1b6ae3f',
+  'request.php' => '70a5ff9866c53204cab4077a87bdd90e',
+  'search.php' => '4a659b16ee93b16e8dc0e9422c305ed4',
+  'signup.php' => '699b74e3acf37f7b4007f808acb199a6',
+  'sitedown.php' => 'b4ed625d7fccd4bac6cb0564af53e549',
   'subcontent.php' => '13134ebbb9c45234963500e05d9e692f',
-  'submitnews.php' => '26cdb029ceb7ce79bbd952fdde168543',
-  'top.php' => 'f810a42faf161f41a3691560ef5f4686',
+  'submitnews.php' => 'ce1763c73637a115b0a77d788f62ae62',
+  'top.php' => '3c867538a84f198070d95fcd0e8acf61',
   'upload.php' => 'badeb3149719c8cff9e0a64f823fa873',
   'user.php' => '53b6cc32a2d529bf413df24d531b9854',
   'userposts.php' => '9f2d0dc13036ab8daa71ff8d07962d90',
-  'usersettings.php' => 'a6e29cec4c1cd11bdebdcd6da5e8052e',
+  'usersettings.php' => '427c15362380e70d04b8ddaa8c67742f',
 );
 
 $deprecated_image = array (
diff -x .svn -aruN 0.7.24.src/e107_admin/cpage.php 0.7.26.src/e107_admin/cpage.php
--- 0.7.24.src/e107_admin/cpage.php	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_admin/cpage.php	2011-04-18 20:29:21.000000000 -0500
@@ -11,8 +11,8 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $URL: https://e107.svn.sourceforge.net/svnroot/e107/trunk/e107_0.7/e107_admin/cpage.php $
-|     $Revision: 11678 $
-|     $Id: cpage.php 11678 2010-08-22 00:43:45Z e107coders $
+|     $Revision: 12145 $
+|     $Id: cpage.php 12145 2011-04-19 01:29:45Z e107coders $
 |     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
@@ -25,19 +25,21 @@
 $e_wysiwyg = "data";
 $page = new page;
 
-require_once("auth.php");
-// require_once(e_HANDLER."ren_help.php");
-require_once(e_HANDLER."userclass_class.php");
-
-if (e_QUERY)
+if (e_QUERY) 
 {
 	$tmp        = explode(".", e_QUERY);
-	$action     = $tmp[0];
+	$action     = $tmp[0]; // must be set before auth.php is loaded. 
 	$sub_action = $tmp[1];
 	$id         = $tmp[2];
 	$from       = varset($tmp[3],0);
 }
 
+require_once("auth.php");
+// require_once(e_HANDLER."ren_help.php");
+require_once(e_HANDLER."userclass_class.php");
+
+
+
 if(isset($_POST['submitPage']))
 {
 	$page -> submitPage();
@@ -432,7 +434,7 @@
 		$pref['listPages'] = $_POST['listPages'];
 		$pref['pageCookieExpire'] = $_POST['pageCookieExpire'];
 		save_prefs();
-		$this -> message = "Settings saved.";
+		$this -> message = LAN_SETSAVED;
 	}
 
 	function show_options($action)
diff -x .svn -aruN 0.7.24.src/e107_admin/credits.php 0.7.26.src/e107_admin/credits.php
--- 0.7.24.src/e107_admin/credits.php	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_admin/credits.php	2011-01-06 07:28:51.000000000 -0600
@@ -11,9 +11,7 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $URL: https://e107.svn.sourceforge.net/svnroot/e107/trunk/e107_0.7/e107_admin/credits.php $
-|     $Revision: 11678 $
-|     $Id: credits.php 11678 2010-08-22 00:43:45Z e107coders $
-|     $Author: e107coders $
+|     $Id: credits.php 12030 2011-01-06 13:29:15Z nlstart $
 +----------------------------------------------------------------------------+
 */
 
@@ -32,7 +30,7 @@
 	array(	"name" => "PCLZip",
 				"url" => "http://www.phpconcept.net/pclzip/",
 				"description" => CRELAN_11,
-				"version" => "2.3",
+				"version" => "2.8.2",
 				"licence" => "GPL"
 			),
 	array(	"name" => "PCLTar",
@@ -44,7 +42,7 @@
 	array(	"name" => "TinyMCE",
 				"url" => "http://tinymce.moxiecode.com/",
 				"description" => CRELAN_13,
-				"version" => "2.08",
+				"version" => "3.3.9.2",
 				"licence" => "GPL"
 			),
 	array(	"name" => "Nuvolo Icons",
@@ -56,7 +54,7 @@
 	array(	"name" => "PHPMailer",
 				"url" => "http://phpmailer.sourceforge.net/",
 				"description" => CRELAN_15,
-				"version" => "1.72",
+				"version" => "2.0.4",
 				"licence" => "GPL"
 			),
 	array(	"name" => "Brainjar DHTML Menu",
@@ -85,17 +83,19 @@
 			),
 	);
 
-$contentA = array(
+$contentA = array( // ORDER BY FirstName ASC ;)
 	"<h3>".CRELAN_6."<\/h3>",
-	"<h1>Carl Cedergren<\/h1>[ asperon ]<br /><br /><br />".CRELAN_20,
 	"<h1>Cameron Hanly<\/h1>[ CaMer0n ]<br /><br /><br />".CRELAN_21,
-	"<h1>Steve Dunstan<\/h1>[ jalist ]<br /><br /><br />".CRELAN_22,
+	"<h1>Carl Cedergren<\/h1>[ asperon ]<br /><br /><br />".CRELAN_20,
 	"<h1>Eric Vanderfeesten<\/h1> [ lisa ]<br /><br /><br />".CRELAN_23,
+	"<h1>James Currie<\/h1>[ SweetAs ]<br /><br /><br />".CRELAN_27,
+	"<h1>Martin Nicholls<\/h1>[ streaky ]<br /><br /><br />".CRELAN_26,
+	"<h1>Miroslav Yovchev<\/h1>[ SecretR ]<br /><br /><br />".defset('CRELAN_29'),
+	"<h1>Pete Holzmann<\/h1>[ MrPete ]<br /><br /><br />".CRELAN_28,
+	"<h1>Steve Dunstan<\/h1>[ jalist ]<br /><br /><br />".CRELAN_22,
+	"<h1>Steven Davies<\/h1>[ steved ]<br /><br /><br />".defset('CRELAN_30'),
 	"<h1>Thom Michelbrink<\/h1>[ McFly ]<br /><br /><br />".CRELAN_24,
 	"<h1>William Moffett<\/h1>[ que ]<br /><br /><br />".CRELAN_25,
-	"<h1>Martin Nicholls<\/h1>[ streaky ]<br /><br /><br />".CRELAN_26,
-	"<h1>James Currie<\/h1>[ SweetAs ]<br /><br /><br />".CRELAN_27,
-	"<h1>Pete Holzmann<\/h1>[ MrPete ]<br /><br /><br />".CRELAN_28
 );
 
 echo "<?xml version='1.0' encoding='".CHARSET."' ?><!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.1//EN\" \"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd\">
diff -x .svn -aruN 0.7.24.src/e107_admin/db_verify.php 0.7.26.src/e107_admin/db_verify.php
--- 0.7.24.src/e107_admin/db_verify.php	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_admin/db_verify.php	2011-05-02 15:45:16.000000000 -0500
@@ -11,8 +11,8 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $URL: https://e107.svn.sourceforge.net/svnroot/e107/trunk/e107_0.7/e107_admin/db_verify.php $
-|     $Revision: 11691 $
-|     $Id: db_verify.php 11691 2010-08-23 17:14:39Z e107steved $
+|     $Revision: 12178 $
+|     $Id: db_verify.php 12178 2011-05-02 20:45:40Z e107steved $
 |     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
@@ -78,7 +78,8 @@
 				}
 			}
 
-			if (strpos($line, "TYPE=") !== FALSE) {
+			if ((strpos($line, "TYPE=") !== FALSE) || (strpos($line, "ENGINE=") !== FALSE))
+			{
 				$current_table = "";
 			}
 
@@ -402,11 +403,11 @@
 
 		if($mode == "create")
 		{
-			//$query = "CREATE TABLE ".MPREFIX.$table." ($newval) TYPE=MyISAM;";
+			//$query = "CREATE TABLE ".MPREFIX.$table." ($newval) ENGINE=MyISAM;";
 			$query = "CREATE TABLE `".MPREFIX.$table."` ({$newval}";
 			if (!preg_match('#.*?\s+?(?:TYPE|ENGINE)\s*\=\s*(.*?);#is', $newval))
 			{
-				$query .= ') TYPE=MyISAM;';
+				$query .= ') ENGINE=MyISAM;';
 			}
 		}
 
diff -x .svn -aruN 0.7.24.src/e107_admin/docs.php 0.7.26.src/e107_admin/docs.php
--- 0.7.24.src/e107_admin/docs.php	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_admin/docs.php	2010-10-09 05:04:20.000000000 -0500
@@ -11,8 +11,8 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $URL: https://e107.svn.sourceforge.net/svnroot/e107/trunk/e107_0.7/e107_admin/docs.php $
-|     $Revision: 11678 $
-|     $Id: docs.php 11678 2010-08-22 00:43:45Z e107coders $
+|     $Revision: 11867 $
+|     $Id: docs.php 11867 2010-10-09 10:04:44Z e107coders $
 |     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
@@ -31,8 +31,9 @@
 	$handle = opendir(e_DOCS."English/");
 }
 	
-while ($file = readdir($handle)) {
-	if ($file != "." && $file != ".." && $file != "CVS") {
+while ($file = readdir($handle))
+{
+	if ($file != "." && $file != ".." && $file != "CVS" && $file != ".svn") {
 		$helplist[$i] = $file;
 		$i++;
 	}
diff -x .svn -aruN 0.7.24.src/e107_admin/download.php 0.7.26.src/e107_admin/download.php
--- 0.7.24.src/e107_admin/download.php	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_admin/download.php	2010-10-09 06:50:45.000000000 -0500
@@ -10,9 +10,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $URL: https://e107.svn.sourceforge.net/svnroot/e107/trunk/e107_0.7/e107_admin/download.php $
-|     $Revision: 11807 $
-|     $Id: download.php 11807 2010-09-21 12:54:22Z e107steved $
-|     $Author: e107steved $
+|     $Revision: 11868 $
+|     $Id: download.php 11868 2010-10-09 11:51:09Z e107coders $
+|     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
 
@@ -157,6 +157,8 @@
 	$pref['agree_flag'] = $_POST['agree_flag'];
 	$pref['download_email'] = $_POST['download_email'];
 	$pref['download_nomultiple'] = $_POST['download_nomultiple'];
+	$pref['download_splashdelay'] = $_POST['download_splashdelay'];
+
 	$pref['agree_text'] = $tp->toDB($_POST['agree_text']);
 	$pref['download_denied'] = $tp->toDB($_POST['download_denied']);
 	$pref['download_reportbroken'] = $_POST['download_reportbroken'];
@@ -169,7 +171,7 @@
 
 if(isset($_POST['addlimit']))
 {
-	if($sql->db_Select('generic','gen_id',"gen_type = 'download_limit' AND gen_datestamp = {$_POST['newlimit_class']}"))
+	if($sql->db_Select('generic','gen_id',"gen_type = 'download_limit' AND gen_datestamp = ".intval($_POST['newlimit_class'])))
 	{
 		$message = DOWLAN_116;
 	}
@@ -375,6 +377,11 @@
 		<td class='forumheader3' style='text-align:left'>". ($pref['download_nomultiple'] ? "<input type='checkbox' name='download_nomultiple' value='1' checked='checked' />" : "<input type='checkbox' name='download_nomultiple' value='1' />")."</td>
 		</tr>
 
+		<tr>
+		<td class='forumheader3'>".DOWLAN_161."</td>
+		<td class='forumheader3' style='text-align:left'>". ($pref['download_splashdelay'] ? "<input type='checkbox' name='download_splashdelay' value='1' checked='checked' />" : "<input type='checkbox' name='download_splashdelay' value='1' />")."</td>
+		</tr>
+
 
 
 		<tr><td class='forumheader3'>
@@ -1902,7 +1909,7 @@
 
 function download_adminmenu($parms) {
 	global $download;
-	global $action;
+	list($action) = explode('.',e_QUERY);
 	$download->show_options($action);
 }
 
diff -x .svn -aruN 0.7.24.src/e107_admin/emoticon.php 0.7.26.src/e107_admin/emoticon.php
--- 0.7.24.src/e107_admin/emoticon.php	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_admin/emoticon.php	2010-10-09 05:04:20.000000000 -0500
@@ -11,8 +11,8 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $URL: https://e107.svn.sourceforge.net/svnroot/e107/trunk/e107_0.7/e107_admin/emoticon.php $
-|     $Revision: 11797 $
-|     $Id: emoticon.php 11797 2010-09-17 21:58:27Z e107coders $
+|     $Revision: 11867 $
+|     $Id: emoticon.php 11867 2010-10-09 10:04:44Z e107coders $
 |     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
@@ -145,10 +145,10 @@
 		<form method='post' action='".e_SELF."'>
 		<table style='".ADMIN_WIDTH."' class='fborder'>
 		<tr>
-		<td class='forumheader' style='width: 20%;'>".EMOLAN_2."</td>
-		<td class='forumheader' style='width: 50%;'>".EMOLAN_3."</td>
-		<td class='forumheader' style='width: 10%; text-align: center;'>".EMOLAN_8."</td>
-		<td class='forumheader' style='width: 20%;'>".EMOLAN_9."</td>
+		<td class='fcaption' style='width: 20%;'>".EMOLAN_2."</td>
+		<td class='fcaption' style='width: 50%;'>".EMOLAN_3."</td>
+		<td class='fcaption' style='width: 10%; text-align: center;'>".EMOLAN_8."</td>
+		<td class='fcaption' style='width: 20%;'>".EMOLAN_9."</td>
 		</tr>
 		";
 
@@ -160,8 +160,8 @@
 
 			$text .= "
 			<tr>
-			<td class='forumheader' style='width: 20%;'>{$pack}</td>
-			<td class='forumheader' style='width: 20%;'>
+			<td class='forumheader3' style='width: 20%;'>{$pack}</td>
+			<td class='forumheader3' style='width: 20%;'>
 			";
 
 			foreach($emoteArray as $emote)
diff -x .svn -aruN 0.7.24.src/e107_admin/filemanager.php 0.7.26.src/e107_admin/filemanager.php
--- 0.7.24.src/e107_admin/filemanager.php	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_admin/filemanager.php	2010-10-04 13:36:21.000000000 -0500
@@ -11,8 +11,8 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $URL: https://e107.svn.sourceforge.net/svnroot/e107/trunk/e107_0.7/e107_admin/filemanager.php $
-|     $Revision: 11790 $
-|     $Id: filemanager.php 11790 2010-09-16 20:02:09Z e107steved $
+|     $Revision: 11845 $
+|     $Id: filemanager.php 11845 2010-10-04 18:36:45Z e107steved $
 |     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
@@ -249,6 +249,7 @@
 $text = "<form enctype=\"multipart/form-data\" action=\"".e_SELF.(e_QUERY ? "?".e_QUERY : "")."\" method=\"post\">
 	<div style=\"text-align:center\">
 	<input type=\"hidden\" name=\"MAX_FILE_SIZE\" value=\"2000000\" />
+	<input type='hidden' name='e-token' value='".e_TOKEN."' />\n
 	<table class='fborder' style=\"".ADMIN_WIDTH."\">";
 
 $text .= "<tr>
diff -x .svn -aruN 0.7.24.src/e107_admin/footer.php 0.7.26.src/e107_admin/footer.php
--- 0.7.24.src/e107_admin/footer.php	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_admin/footer.php	2011-01-30 13:22:23.000000000 -0600
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $URL: https://e107.svn.sourceforge.net/svnroot/e107/trunk/e107_0.7/e107_admin/footer.php $
-|     $Revision: 11753 $
-|     $Id: footer.php 11753 2010-09-06 20:59:15Z e107coders $
-|     $Author: e107coders $
+|     $Revision: 12060 $
+|     $Id: footer.php 12060 2011-01-30 19:22:47Z secretr $
+|     $Author: secretr $
 +----------------------------------------------------------------------------+
 */
 if (!defined('e107_INIT')) { exit; }
@@ -25,28 +25,35 @@
 		session_start(); // restart
 	}
 
-// give 3rd party code a way to prevent token/session re-generation
-if(!defsettrue('e_TOKEN_FREEZE'))
-{
-	// regenerate SID
-	$oldSID = session_id(); // old SID
-	$oldSData = $_SESSION; // old session data
-	session_regenerate_id(false); // true don't work on php4 - so time to move on people!	
-	$newSID = session_id(); // new SID
-	
-	// Clean
-	session_id($oldSID); // switch to the old session
-	session_destroy(); // destroy it
-	
-	// set new ID, reopen the session, set saved data
-	session_id($newSID);
-	session_start();
-	$_SESSION = $oldSData;
-	$_SESSION['regenerate_'.e_TOKEN_NAME] = time(); // class2 have to re-create token on the next request
-	unset($oldSID, $newSID, $oldSData);
-}
+// give 3rd party code a way to prevent token/session re-generation, respect security level
+	if(!defsettrue('e_TOKEN_FREEZE'))
+	{	
+		if(defset('e_SECURITY_LEVEL', 5) >= 10)
+		{
+			// regenerate SID
+			$oldSID = session_id(); // old SID
+			$oldSData = $_SESSION; // old session data
+			session_regenerate_id(false); // true don't work on php4 - so time to move on people!	
+			$newSID = session_id(); // new SID
+			
+			// Clean
+			session_id($oldSID); // switch to the old session
+			session_destroy(); // destroy it
+			
+			// set new ID, reopen the session, set saved data
+			session_id($newSID);
+			session_start();
+			$_SESSION = $oldSData;
+			
+			unset($oldSID, $newSID, $oldSData);
+		}
+		if(defset('e_SECURITY_LEVEL', 5) >= 8)
+		{
+			$_SESSION['regenerate_'.e_TOKEN_NAME] = time(); // class2 have to re-create token on the next request
+		}
+	}
 // write session data
-session_write_close();
+	session_write_close();
 // SESSION End
 
 global $eTraffic, $error_handler, $db_time, $sql, $mySQLserver, $mySQLuser, $mySQLpassword, $mySQLdefaultdb, $ADMIN_FOOTER, $e107, $pref;
@@ -265,7 +272,7 @@
 	
 	$data = "IF_NON_MATCH = ".$IF_NONE_MATCH;
 	$data .= "\nEtag = ".$etag;
-	file_put_contents(e_ADMIN."etag_log.txt",$data);
+	//file_put_contents(e_ADMIN."etag_log.txt",$data);
 
 	
 	if($IF_NONE_MATCH == $etag || ($IF_NONE_MATCH == ($etag."-gzip")))
diff -x .svn -aruN 0.7.24.src/e107_admin/header.php 0.7.26.src/e107_admin/header.php
--- 0.7.24.src/e107_admin/header.php	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_admin/header.php	2011-07-07 22:02:10.000000000 -0500
@@ -10,9 +10,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $URL: https://e107.svn.sourceforge.net/svnroot/e107/trunk/e107_0.7/e107_admin/header.php $
-|     $Revision: 11760 $
-|     $Id: header.php 11760 2010-09-07 17:02:27Z e107steved $
-|     $Author: e107steved $
+|     $Revision: 12315 $
+|     $Id: header.php 12315 2011-07-08 03:02:34Z e107coders $
+|     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
 
@@ -105,6 +105,12 @@
 	define("ADMIN_DELETE_ICON_PATH", e_IMAGE."admin_images/delete_16.png");
 }
 
+if (!defined('ADMIN_WARNING_ICON'))
+{
+	define("ADMIN_WARNING_ICON", "<img src='".e_IMAGE_ABS."admin_images/nopreview.png' alt='' title='".LAN_WARNING."' style='border:0px' />");
+	define("ADMIN_WARNING_ICON_PATH", e_IMAGE."admin_images/nopreview.png");
+}
+
 //
 // C: Send start of HTML
 //
@@ -127,7 +133,9 @@
 if (varset($pref['wysiwyg'],FALSE) && check_class($pref['post_html']) && varset($e_wysiwyg) != "") {
 	require_once(e_HANDLER."tiny_mce/wysiwyg.php");
 	define("e_WYSIWYG",TRUE);
-	echo wysiwyg($e_wysiwyg);
+	$wy = new wysiwyg($e_wysiwyg);
+	$wy->render();
+	// echo wysiwyg($e_wysiwyg);
 }else{
 	define("e_WYSIWYG",FALSE);
 }
@@ -301,6 +309,7 @@
 	function show_admin_menu($title, $active_page, $e107_vars, $js = FALSE, $sub_link = FALSE, $sortlist = FALSE) {
 		global $ns, $BUTTON, $BUTTON_OVER, $BUTTONS_START, $BUTTONS_END, $SUB_BUTTON, $SUB_BUTTON_OVER, $SUB_BUTTONS_START, $SUB_BUTTONS_END;
 		$id_title = "yop_".str_replace(" ", "", $title);
+						
 		if (!isset($BUTTONS_START)) {
 			$BUTTONS_START = "<div style='text-align:center; width:100%'><table class='fborder' style='width:98%;'>\n";
 		}
diff -x .svn -aruN 0.7.24.src/e107_admin/lancheck.php 0.7.26.src/e107_admin/lancheck.php
--- 0.7.24.src/e107_admin/lancheck.php	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_admin/lancheck.php	2010-10-09 06:50:45.000000000 -0500
@@ -11,8 +11,8 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $URL: https://e107.svn.sourceforge.net/svnroot/e107/trunk/e107_0.7/e107_admin/lancheck.php $
-|     $Revision: 11810 $
-|     $Id: lancheck.php 11810 2010-09-22 21:02:57Z e107coders $
+|     $Revision: 11868 $
+|     $Id: lancheck.php 11868 2010-10-09 11:51:09Z e107coders $
 |     $Author: e107coders $
 |	  With code from Izydor and Lolo.
 +----------------------------------------------------------------------------+
@@ -26,9 +26,15 @@
 require_once("auth.php");
 
 $qry = explode("|",e_QUERY);
-$f = $qry[0];
-$lan = $qry[1];
-$mode = $qry[2];
+$f = varset($qry[0]);
+$lan = varset($qry[1]);
+$mode = varset($qry[2]);
+
+if($f == "tools" || $f == "db" || $f == "modify")
+{
+	$f = "";
+	
+}
 
 // Write the language file.
 if(isset($_POST['submit']))
@@ -187,7 +193,9 @@
 "khatru","kubrick","lamb","leaf","reline","sebes","vekna_blue");
 
 
-if(isset($_POST['language_sel']) && isset($_POST['language'])){
+if(isset($_POST['language_sel'])){
+	
+	$_POST['language'] = key($_POST['language_sel']);
 
 	$_SESSION['lancheck_'.$_POST['language']] = array();
 	$_SESSION['lancheck_'.$_POST['language']]['file']	= 0;
@@ -251,10 +259,10 @@
     <input type='submit' name='just_go' value=\"".$just_go_diz."\" class='button' />
 	</span>
     </form>
-	<form name='refresh' method='post' action='".e_SELF."'>
+	<form name='refresh' method='post' action='".e_SELF."?tools'>
 	<span>
 	<input type='hidden' name='language' value='".$_POST['language']."' />
-    <input type='submit' name='language_sel' value=\"".$lang_sel_diz."\" class='button' />
+    <input type='submit' name='language_sel[".$_POST['language']."]' value=\"".$lang_sel_diz."\" class='button' />
 	</span>
     </form>
 	</div>";
@@ -272,13 +280,17 @@
 
 
 function check_core_lanfiles($checklan,$subdir=''){
-	global $lanfiles,$_POST;
+	global $lanfiles,$_POST,$sql;
 
+//	$sql->db_Mark_Time('Start Get Core Lan Phrases English');
 	$English = get_comp_lan_phrases(e_LANGUAGEDIR."English/".$subdir,$checklan);
+	
+//	$sql->db_Mark_Time('End Get Core Lan Phrases English');
+	
 	$check = get_comp_lan_phrases(e_LANGUAGEDIR.$checklan."/".$subdir,$checklan);
 	
-	//print_a($check);
-	//return;
+//	print_a($check);
+//	return;
 	
 
 	$text .= "<table class='fborder' style='".ADMIN_WIDTH."'>
@@ -367,7 +379,7 @@
 	// return $eng_line."<br />".$trans_line."<br /><br />";
 		
 	$error = array();
-	
+		
 	if((!array_key_exists($def,$translation) && $eng_line != "") || (trim($trans_line) == "" && $eng_line != ""))
 	{
 		checkLog('def',1);
@@ -430,9 +442,9 @@
 
 	if(is_file($fname))
 	{
-		$data = file($fname);
-		$ret=$ret + fill_phrases_array($data,$type);
-		if(substr($data[0],0,5) != "<?php")
+		$data = file_get_contents($fname);
+		$ret= $ret + fill_phrases_array($data,$type);
+		if(substr($data,0,5) != "<?php")
 		{
 			$key = str_replace(".php","",$fname);
 			$ret['bom'][$key] = $fname;
@@ -444,9 +456,9 @@
 
 	if(is_file($fname))
 	{
-		$data = file($fname);
+		$data = file_get_contents($fname);
 		$ret=$ret + fill_phrases_array($data,$type);
-		if(substr($data[0],0,5) != "<?php")
+		if(substr($data,0,5) != "<?php")
 		{
 			$key = str_replace(".php","",$fname);
 			$ret['bom'][$key] = $fname;
@@ -515,7 +527,7 @@
 				$f['fname'] = "English_custom.php";  // change the key for the main language file.
 			}
 
-			$ret=$ret + fill_phrases_array($data,$relpath.$f['fname']);
+			$ret=$ret + fill_phrases_array($allData,$relpath.$f['fname']);
 
 		}
 	}
@@ -703,8 +715,8 @@
 	$text .= "<form method='post' action='".e_SELF."' id='select_lang'>
 	<div style='text-align:center'><br />";
 	$text .= (!$writable) ? "<br />".$dir2.$f2.LAN_NOTWRITABLE : "";
-	$text .= "<br /><br /><input class='button' type='submit' name='language_sel' value=\"".LAN_BACK."\" />
-	<input type='hidden' name='language' value='$lan' /></div></form>";
+	$text .= "<br /><br /><input class='button' type='submit' name='language_sel[{$lan}]' value=\"".LAN_BACK."\" />
+	</div></form>";
 
 
 	$caption = LAN_CHECK_3." <b>".$dir2.$f2."</b> -> <b>".$lan."</b>";
@@ -715,62 +727,39 @@
 }
 
 function fill_phrases_array($data,$type)
-{
-
-	$inComment = FALSE;
-
+{	
 	$retloc = array();
 	
-	foreach($data as $line)
+	if(preg_match_all('/(\/\*[\s\S]*?\*\/)/i',$data, $multiComment))
 	{
-		$line = trim($line);
-		
-		if(strpos($line,"/*")!==FALSE && strpos($line,"*/")!==FALSE ) // ie. /* and */ on the same line. 
-		{
-			preg_match('#\/\*(.+?)\*\/#s', $line, $match);
-			$srch = "/*".$match[1]."*/";
-			$line = trim(str_replace($srch,'',$line));
-		}
-				
-		if(strpos($line,"/*")!==FALSE ) // grab any text prior to /*
-		{
-			$inComment = TRUE;
-			$line = trim(strstr($line,"/*",TRUE));
-		}
-		
-		if(strpos($line,"*/")!==FALSE ) // grab any text after */
-		{
-			$inComment = FALSE;
-			$line =  trim(substr(strstr($line,"*/"),2));	
-		}
+		$data = str_replace($multiComment[1],'',$data);	// strip multi-line comments. 	
+	}
 				
-		if (strlen($line) == 0 || substr($line,0,2) == "//" || $inComment==TRUE )
-		{
-			continue;	
-		} 
-						
-		if(strpos($line,"setlocale(") !== FALSE)
-		{
-			$pos = substr(strstr($line,","),1);
-			$rep = array(");","\n",'""');
-			$val = str_replace($rep,"",$pos);
-			$retloc[$type]['LC_ALL']= $val;
-			continue;
-		}
+	if(preg_match('/^\s*?setlocale\s*?\(\s*?([\w]+)\s*?,\s*?(.+)\s*?\)\s*?;/im',$data,$locale)) // check for setlocale();
+	{
+		$retloc[$type][$locale[1]]= $locale[2];	
+	}
 			
-		// Steve's magic. 			
-		if(preg_match('~^DEFINE\s*\(\s*(\'|\")(.+?)(?:\\1)\s*\,\s*(\'|\")(.+?)(?:\\3\)\s*;)~i', $line, $matches))
+	if(preg_match_all('/^\s*?define\s*?\(\s*?(\'|\")([\w]+)(\'|\")\s*?,\s*?(\'|\")([\s\S]*?)\s*?(\'|\")\s*?\)\s*?;/im',$data,$matches))
+	{
+		$def = $matches[2];
+		$values = $matches[5];	
+
+		foreach($def as $k=>$d)
 		{
-			if(!isset($retloc[$type][$matches[2]]))
-			{
-				$retloc[$type][$matches[2]]= $ndef.$matches[4];
-				// echo "get_lan -->".$matches[2]." :: ".$ndef.$matches[4]."<br />";
-			}	
+			$retloc[$type][$d]= $values[$k];
 		}	
-	
 	}
-	
+		
 	return $retloc;
+	
+	/*
+	echo "<h2>Raw Data ".$type."</h2><pre>";
+	echo htmlentities($data);
+	echo "</pre>";	
+
+	*/
+		
 }
 
 //--------------------------------------------------------------------
@@ -789,29 +778,3 @@
 }
 
 
-function lancheck_adminmenu() {
-
-	include_lan(e_LANGUAGEDIR.e_LANGUAGE."/admin/lan_language.php");
-
-	global $action,$pref;
-	if ($action == "") {
-		$action = "tools";
-	}
-
-	if($action == "modify"){
-		$action = "db";
-	}
-	$var['main']['text'] = LAN_PREFS;
-	$var['main']['link'] = e_ADMIN."language.php";
-
-	if(isset($pref['multilanguage']) && $pref['multilanguage']){
-		$var['db']['text'] = LANG_LAN_03;
-		$var['db']['link'] = e_ADMIN."language.php?db";
-	}
-
-	$var['tools']['text'] = ADLAN_CL_6;
-	$var['tools']['link'] = e_ADMIN."language.php?tools";
-
-
-	show_admin_menu(ADLAN_132, $action, $var);
-}
diff -x .svn -aruN 0.7.24.src/e107_admin/language.php 0.7.26.src/e107_admin/language.php
--- 0.7.24.src/e107_admin/language.php	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_admin/language.php	2011-04-11 05:38:41.000000000 -0500
@@ -10,8 +10,8 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $URL: https://e107.svn.sourceforge.net/svnroot/e107/trunk/e107_0.7/e107_admin/language.php $
-|     $Revision: 11810 $
-|     $Id: language.php 11810 2010-09-22 21:02:57Z e107coders $
+|     $Revision: 12128 $
+|     $Id: language.php 12128 2011-04-11 10:39:05Z e107coders $
 |     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
@@ -24,10 +24,22 @@
 
 $e_sub_cat = 'language';
 
+if (e_QUERY) 
+{ 
+    $tmp = explode('.', e_QUERY);
+    $action = $tmp[0]; // must be set before auth.php is loaded. 
+    $sub_action = varset($tmp[1]);
+    $id = varset($tmp[2]);
+    unset($tmp);
+}
+
 require_once("auth.php");
+include_lan(e_LANGUAGEDIR.e_LANGUAGE."/admin/lan_lancheck.php");
+require_once(e_ADMIN."lancheck.php");
 require_once(e_HANDLER."form_handler.php");
 require_once(e_HANDLER."file_class.php");
 require_once(e_HANDLER."language_class.php");
+
 $ln = new language;
 $fl = new e_file;
 $rs = new form;
@@ -40,13 +52,7 @@
 
 
 
-if (e_QUERY) {
-    $tmp = explode('.', e_QUERY);
-    $action = $tmp[0];
-    $sub_action = $tmp[1];
-    $id = $tmp[2];
-    unset($tmp);
-}
+
 
 if (isset($_POST['submit_prefs']) && isset($_POST['mainsitelanguage'])) {
 
@@ -113,8 +119,21 @@
 
 
 
-if (varset($_POST['ziplang']) && varset($_POST['language']))
+if (varset($_POST['ziplang']))
 {
+	$certVal = isset($_POST['contribute_pack']) ? 1 : 0;
+	if(!varset($_COOKIE['e107_certified']))
+	{
+		cookie('e107_certified',$certVal,(time() + 3600 * 24 * 30));	
+	}
+	else
+	{
+		$_COOKIE['e107_certified'] = $certVal; 	
+	}
+		
+		
+	$_POST['language'] = key($_POST['ziplang']);
+	
 		$status = zip_up_lang($_POST['language']);
 		if($status['error']==FALSE)
 		{	
@@ -163,7 +182,9 @@
 	<br />Bom Errors : ".$_SESSION['lancheck_'.$_POST['language']]['bom']."
 	<br />UTF Errors : ".$_SESSION['lancheck_'.$_POST['language']]['utf']."
 	<br />Definition Errors : ".$_SESSION['lancheck_'.$_POST['language']]['def']."
-	<br />Total Errors: ".$_SESSION['lancheck_'.$_POST['language']]['total'];
+	<br />Total Errors: ".$_SESSION['lancheck_'.$_POST['language']]['total']."
+	<br />
+	<br />XML file: ".$_SESSION['lancheck_'.$_POST['language']]['xml'];
 	
 	
 	
@@ -210,16 +231,15 @@
 }
 
 
+
 if($action == "tools"){
     show_tools();
 }
 
 
-
-
-
 // Grab Language configuration. ---
-if ($_POST['edit_existing']) {
+if (isset($_POST['edit_existing']))
+{
 
     $text .= "
     <form method='post' action='".e_SELF."?db' >
@@ -335,6 +355,104 @@
     $ns->tablerender($caption, $text);
 }
 
+/**
+ * List the installed language packs. 
+ * @return 
+ */
+function show_tools()
+{
+	global $ns,$tp;
+	
+	if(is_readable(e_ADMIN."ver.php"))
+	{
+		include(e_ADMIN."ver.php");
+		list($ver, $tmp) = explode(" ", $e107info['e107_version']);
+	}
+		
+	$lans = getLanList();
+	
+	$release_diz = defined("LANG_LAN_30") ? LANG_LAN_30 : "Release Date";
+	$compat_diz = defined("LANG_LAN_31") ?  LANG_LAN_31 : "Compatibility";
+	
+	$text = "<form id='lancheck' method='post' action='".e_SELF."?tools'>
+			<table class='fborder' style='".ADMIN_WIDTH."'>";
+	$text .= "
+		<tr>
+		<td class='fcaption'>".ADLAN_132."</td>
+		<td class='fcaption'>".$release_diz."</td>		
+		<td class='fcaption'>".$compat_diz."</td>
+		<td class='fcaption' style='text-align:center'>".ADLAN_134."</td>
+		<td class='fcaption' style='text-align:center;width:25%;white-space:nowrap'>".LAN_OPTIONS."</td>
+		</tr>
+		";
+	
+	require_once(e_HANDLER."xml_class.php");
+	$xm = new XMLParse();
+	
+	foreach($lans as $language)
+	{
+		if($language == "English")
+		{
+			continue;
+		}
+		$metaFile = e_LANGUAGEDIR.$language."/".$language.".xml";
+		
+		if(is_readable($metaFile))
+		{
+			$rawData = file_get_contents($metaFile);
+			if($rawData)
+			{
+				$array = $xm->parse($rawData);
+				$value = $array['e107Language']['attributes'];	
+			}
+			else
+			{
+				$value = array(
+				'date' 			=> "&nbsp;",
+				'compatibility' => '&nbsp;'
+			);		
+			}			
+		}
+		else
+		{
+			$value = array(
+				'date' 			=> "&nbsp;",
+				'compatibility' => '&nbsp;'
+			);	
+		}
+						
+		$text .= "<tr>
+			<td class='forumheader3' >".$language."</td>
+			<td class='forumheader3' >".$value['date']."</td>
+			<td class='forumheader3' >".$value['compatibility']."</td>
+			<td class='forumheader3' style='text-align:center' >".($ver == $value['compatibility'] || varset($_SESSION['lancheck_'.$language]['total']) =='0' ? ADMIN_TRUE_ICON : ADMIN_FALSE_ICON)."</td>
+			<td class='forumheader3' style='text-align:center'><input type='submit' name='language_sel[{$language}]' value=\"".LAN_CHECK_2."\" class='button' />
+			<input type='submit' name='ziplang[{$language}]' value=\"".LANG_LAN_23."\" class='button' /></td>	
+			</tr>";
+		}
+		
+		$srch = array("[","]");
+		$repl = array("<a rel='external' href='http://e107.org/news.php?extend.876.1'>","</a>");
+		$diz = (defsettrue("LANG_LAN_28")) ? LANG_LAN_28 : "Check this box if you're an [e107 certified translator].";
+	
+		$checked = varset($_COOKIE['e107_certified']) == 1 ? "checked='checked'" : "";
+		$text .= "<tr><td class='forumheader' colspan='5' style='text-align:center'>
+		 <input type='checkbox' name='contribute_pack' value='1' {$checked} />".str_replace($srch,$repl,$diz);
+				
+		$text .= "</td></tr></table>";
+		
+		
+		$text .= "</form>";
+		
+	$text .= "<div class='smalltext' style='padding-top:50px;text-align:center'>".LANG_LAN_AGR."</div>";	
+	$ns->tablerender(LANG_LAN_32, $text);		
+	return;
+		
+}
+
+
+
+
 // ----------------------------------------------------------------------------
 
 function db_Table_exists($table)
@@ -483,76 +601,6 @@
 
 // ----------------------------------------------------------------------------
 
-function show_tools()
-{
-    global $ns;
-
-    include_lan(e_LANGUAGEDIR.e_LANGUAGE."/admin/lan_lancheck.php");
-
-    $text .= "
-    <form id='lancheck' method='post' action='".e_ADMIN."lancheck.php'>
-    <table class='fborder' style='".ADMIN_WIDTH."'>
-    <tr>
-    <td class='fcaption' style='width:30%'>".LAN_CHECK_1."</td>
-    <td class='forumheader3'>
-    <select name='language' class='tbox'>
-    <option value=''>".LAN_SELECT."</option>";
-
-    $languages = getLanList();
-
-    foreach($languages as $lang)
-    {
-        if($lang != "English")
-        {
-        	
-            $text .= "<option value='{$lang}'>{$lang}</option>\n";
-        }
-    }
-
-    $text .= "
-    </select>
-    <input type='submit' name='language_sel' value=\"".LAN_CHECK_2."\" class='button' />
-    </td></tr>
-    </table></form>";
-	
-	  $text .= "
-    <form id='tools' method='post' action='".e_SELF."?tools'>
-    <table class='fborder' style='".ADMIN_WIDTH."'>
-    <tr>
-    <td class='fcaption' style='width:30%'>".LANG_LAN_23."</td>
-    <td class='forumheader3' >
-    <select name='language' class='tbox'>
-    <option value=''>".LAN_SELECT."</option>";
-
-  
-
-    foreach($languages as $lang)
-    {
-        if($lang != "English")
-        {
-        	$sel = ($_POST['language']==$lang) ? "selected='selected'" : "";
-            $text .= "<option value='{$lang}' {$sel}>{$lang}</option>\n";
-        }
-    }
-
-    $text .= "
-    </select>
-    <input type='submit' name='ziplang' value=\"".LANG_LAN_24."\" class='button' />";
-	
-	$srch = array("[","]");
-	$repl = array("<a rel='external' href='http://e107.org/news.php?extend.876.1'>","</a>");
-	$diz = (defsettrue("LANG_LAN_28")) ? LANG_LAN_28 : "Check this box if you're an [e107 certified translator].";
-	
-	$text .= " <input type='checkbox' name='contribute_pack' value='1' />".str_replace($srch,$repl,$diz);
-	
-	$text .= "
-    </td></tr>
-    </table></form>";
-	
-	$text .= "<div class='smalltext' style='padding-top:50px;text-align:center'>".LANG_LAN_AGR."</div>";
-
-    $ns->tablerender(LANG_LAN_21, $text);
-}
 
 function find_locale($language)
 {
@@ -603,6 +651,15 @@
 		return $ret;	
 	}
 	
+	if(varset($_POST['contribute_pack']) && varset($_SESSION['lancheck_'.$language]['total']) !='0')
+	{
+		$ret['error'] = TRUE;
+		$ret['message'] = (defined("LANG_LAN_29")) ? LANG_LAN_29 : "You should correct the remaining errors before contributing your language pack.";	
+		$ret['message']	 .= "<br />";
+		$ret['message']	 .= (defined('LANG_LAN_27')) ? LANG_LAN_27 : "Please verify your language files ('Verify') then try again.";
+		return $ret;
+	}
+	
 		
 	if(!is_writable(e_FILE."public"))
 	{
@@ -652,6 +709,7 @@
 	$newfile = e_FILE."public/e107_".$ver."_".$language."_".$locale."-utf8.zip";
 	
 	$archive = new PclZip($newfile);
+ 
 	$core = grab_lans(e_LANGUAGEDIR.$language."/", $language,'',0);
 	$core_admin = grab_lans(e_BASE.$LANGUAGES_DIRECTORY.$language."/admin/", $language,'',2);
 	$plugs = grab_lans(e_BASE.$PLUGINS_DIRECTORY, $language, $core_plugins); // standardized path. 
@@ -662,7 +720,7 @@
 	$file = array_merge($core,$core_admin, $plugs, $theme, $docs, $handlers);
 	$data = implode(",", $file);
 				
-	if ($archive->create($data) == 0)
+	if ($archive->create($data,PCLZIP_OPT_REMOVE_PATH,e_BASE) == 0)
 	{		
 		$ret['error'] = TRUE;
 		$ret['message'] = $archive->errorInfo(true);
@@ -670,7 +728,30 @@
 	}
 	else
 	{
-	
+		if($_POST['contribute_pack'])
+		{
+			
+			$fileName = e_FILE."public/".$language.".xml";
+			@unlink($fileName);
+		$fileData = '<?xml version="1.0" encoding="utf-8"?>
+<e107Language name="'.$language.'" compatibility="'.$ver.'" date="'.date("Y-m-d").'" >
+<author name ="'.USERNAME.'" email="'.USEREMAIL.'" url="'.SITEURL.'" />
+</e107Language>';
+
+			if(file_put_contents($fileName,$fileData))
+			{
+				$addTag = $archive->add($fileName, PCLZIP_OPT_ADD_PATH, 'e107_languages/'.$language, PCLZIP_OPT_REMOVE_PATH, e_FILE.'public/');				
+				$_SESSION['lancheck_'.$language]['xml'] = "Yes";
+			}
+			@unlink($fileName);	
+		}
+		else
+		{
+			$_SESSION['lancheck_'.$language]['xml'] = "No";
+			// echo "NO CONTRIBUTE";
+		}
+
+		
 		$ret['file']  = $newfile; 
 		$ret['message'] = str_replace("../", "", e_FILE.'public/')."<a href='".$newfile."' >".basename($newfile)."</a>"; 
 		$ret['error'] = FALSE;
@@ -678,6 +759,7 @@
 	}
 }
 
+
 function getLanList()
 {
 	global $ln;
@@ -702,7 +784,11 @@
 {
 	global $fl,$ln;
 	
-	if ($lanlist = $fl->get_files($path, "^[\w]+(\.php|\.js){0,1}$", "standard", $depth))
+	$isocode = $ln->convert($language);
+	
+	$regexp = "^[\w]+(\.lang-".$isocode.")?+(\.php|\.js){0,1}$";
+	
+	if ($lanlist = $fl->get_files($path, $regexp, "standard", $depth))
 	{
 		sort($lanlist);
 	}
@@ -714,32 +800,30 @@
 	
 	$pzip = array();
 	
-	$isocode = $ln->convert($language);
 	
-
+	
+	$phpmailer = "phpmailer.lang-".$isocode.".php";
+	$tinyMce1 = "/langs/".$isocode.".js";
+	$tinyMce2 = "/langs/".$isocode."_dlg.js";
 	
 	foreach ($lanlist as $p)
 	{	
 		$fullpath = $p['path'].$p['fname'];
 						
-		if($p['fname'] == ($language."_custom.php") || ($p['fname'] == ($language."_config.php")))
+		if($p['fname'] == ($language."_custom.php") || ($fullpath == e_LANGUAGEDIR.$language."/".$language."_config.php"))
 		{
 			continue;
-		}
-		
-		$phpmailer = "phpmailer.lang-".$isocode.".php";
-		$tinyMce1 = "/langs/".$isocode.".js";
-		$tinyMce2 = "/langs/".$isocode."_dlg.js";
-		
-		
+		}		
+
 		if (strpos($fullpath, $language) !== FALSE || strpos($fullpath,$phpmailer)!==FALSE || strpos($fullpath,$tinyMce1)!==FALSE || strpos($fullpath,$tinyMce2)!==FALSE)
 		{
+						
 			if(is_array($filter))
 			{
 				$dir =  basename(dirname($p['path']));
 				foreach($filter as $val)
 				{
-					if(strpos($fullpath,$val)!==FALSE)
+					if(strpos($fullpath,'/'.$val.'/')!==FALSE)
 					{
 						$pzip[] = $fullpath;	
 					}
@@ -753,7 +837,6 @@
 			
 		}
 	}
-	
 	return $pzip;
 }
 
@@ -778,11 +861,12 @@
         $var['db']['text'] = LANG_LAN_03;
         $var['db']['link'] = e_SELF."?db";
     }
+	
 
     $lcnt = explode(",",e_LANLIST);
     if(count($lcnt) > 1)
     {
-        $var['tools']['text'] = ADLAN_CL_6;
+        $var['tools']['text'] = LANG_LAN_21;
         $var['tools']['link'] = e_SELF."?tools";
     }
 
diff -x .svn -aruN 0.7.24.src/e107_admin/links.php 0.7.26.src/e107_admin/links.php
--- 0.7.24.src/e107_admin/links.php	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_admin/links.php	2010-10-09 06:50:45.000000000 -0500
@@ -11,8 +11,8 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $URL: https://e107.svn.sourceforge.net/svnroot/e107/trunk/e107_0.7/e107_admin/links.php $
-|     $Revision: 11678 $
-|     $Id: links.php 11678 2010-08-22 00:43:45Z e107coders $
+|     $Revision: 11868 $
+|     $Id: links.php 11868 2010-10-09 11:51:09Z e107coders $
 |     $Author: e107coders $
 |
 | links.php?debug shows stored data for each link after name (before constant conversion)
@@ -36,6 +36,17 @@
 $pst->form = "linkform";
 $pst->page = "links.php?create";
 $pst->id = "admin_links";
+
+$action = '';
+if (e_QUERY)
+{
+  $tmp = explode('.', e_QUERY);
+  $action = $tmp[0]; // must be set before auth.php is loaded. 
+  $sub_action = $tmp[1];
+  $id = $tmp[2];
+  unset($tmp);
+}
+
 require_once('auth.php');
 // --------------------
 $pst->save_preset();
@@ -46,15 +57,7 @@
 $rs = new form;
 $linkpost = new links;
 
-$action = '';
-if (e_QUERY)
-{
-  $tmp = explode('.', e_QUERY);
-  $action = $tmp[0];
-  $sub_action = $tmp[1];
-  $id = $tmp[2];
-  unset($tmp);
-}
+
 
 define("URL_SEPARATOR",'X');		// Used in names of 'inc' and 'dec' fields
 
@@ -837,8 +840,8 @@
 	$var['opt']['text'] = LAN_OPTIONS;
 	$var['opt']['link'] = e_SELF."?opt";
 
-	$var['sub']['text'] = LINKLAN_4;
-	$var['sub']['link'] = e_SELF."?sublinks";
+	$var['sublinks']['text'] = LINKLAN_4;
+	$var['sublinks']['link'] = e_SELF."?sublinks";
 
 //	$var['debug']['text'] = "List DB";
 //	$var['debug']['link'] = e_SELF."?debug";
diff -x .svn -aruN 0.7.24.src/e107_admin/mailout.php 0.7.26.src/e107_admin/mailout.php
--- 0.7.24.src/e107_admin/mailout.php	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_admin/mailout.php	2011-06-05 04:28:01.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $URL: https://e107.svn.sourceforge.net/svnroot/e107/trunk/e107_0.7/e107_admin/mailout.php $
-|     $Revision: 11678 $
-|     $Id: mailout.php 11678 2010-08-22 00:43:45Z e107coders $
-|     $Author: e107coders $
+|     $Revision: 12247 $
+|     $Id: mailout.php 12247 2011-06-05 09:28:25Z e107steved $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 
@@ -227,7 +227,7 @@
 
 		$text .="
  		<tr>
-			<td class='forumheader3' colspan='2'>".stripslashes($tp->toHTML($_POST['email_body'],TRUE))."</td>
+			<td class='forumheader3' colspan='2'>".stripslashes($tp->toHTML($_POST['email_body'],TRUE, 'E_BODY', '', FALSE))."</td>
 		</tr>
 
 	</table>
@@ -489,7 +489,9 @@
 	if(e_WYSIWYG) {
 		$text .="<span style='vertical-align: super;margin-left:5%;margin-bottom:auto;margin-top:auto'><input type='button' class='button' name='usrname' value=\"".MAILAN_16."\" onclick=\"tinyMCE.selectedInstance.execCommand('mceInsertContent',0,'|USERNAME|')\" />
 		<input type='button' class='button' name='usrlink' value=\"".MAILAN_17."\" onclick=\"tinyMCE.selectedInstance.execCommand('mceInsertContent',0,'|SIGNUP_LINK|')\" />
-		<input type='button' class='button' name='usrid' value=\"".MAILAN_18."\" onclick=\"tinyMCE.selectedInstance.execCommand('mceInsertContent',0,'|USERID|')\" /></span>";
+		<input type='button' class='button' name='usrid' value=\"".MAILAN_18."\" onclick=\"tinyMCE.selectedInstance.execCommand('mceInsertContent',0,'|USERID|')\" />
+		<input type='button' class='button' name='usrlogin' value=\"".MAILAN_69."\" onclick=\"tinyMCE.selectedInstance.execCommand('mceInsertContent',0,'|USER_LOGIN|')\" />
+		<input type='button' class='button' name='usremail' value=\"".MAILAN_70."\" onclick=\"tinyMCE.selectedInstance.execCommand('mceInsertContent',0,'|USER_EMAIL|')\" /></span>";
 	}
 
  	$text .="
@@ -529,7 +531,7 @@
 	<tr>
 	<td style='width:30%' class='forumheader3'>".PRFLAN_63."<br /></td>
 	<td style='width:70%; text-align:right' class='forumheader3'><input class='button' type='submit' name='testemail' value=\"".PRFLAN_65."\" />
-	<input name='testaddress' class='tbox' type='text' value=\"".SITEADMINEMAIL."\" />
+	<input name='testaddress' class='tbox' size='40' type='text' value=\"".SITEADMINEMAIL."\" />
 	</td>
 	</tr>
 
@@ -782,7 +784,9 @@
 	$sc = array(
 		"|USERNAME|" => MAILAN_16,
         "|SIGNUP_LINK|" => MAILAN_17,
-        "|USERID|" => MAILAN_18
+        "|USERID|" => MAILAN_18,
+        "|USER_LOGIN|" => MAILAN_69,
+        "|USER_EMAIL|" => MAILAN_70
 	);
 
 	foreach($sc as $key=>$val){
diff -x .svn -aruN 0.7.24.src/e107_admin/newspost.php 0.7.26.src/e107_admin/newspost.php
--- 0.7.24.src/e107_admin/newspost.php	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_admin/newspost.php	2011-01-30 15:41:51.000000000 -0600
@@ -10,9 +10,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $URL: https://e107.svn.sourceforge.net/svnroot/e107/trunk/e107_0.7/e107_admin/newspost.php $
-|     $Revision: 11789 $
-|     $Id: newspost.php 11789 2010-09-16 17:16:49Z nlstart $
-|     $Author: nlstart $
+|     $Revision: 12061 $
+|     $Id: newspost.php 12061 2011-01-30 21:42:15Z e107coders $
+|     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
 require_once('../class2.php');
@@ -42,6 +42,18 @@
 // ------------------------------
 
 $newspost = new newspost;
+
+if (e_QUERY) 
+{
+	$tmp 		= explode('.', e_QUERY);
+	$action 	= $tmp[0]; // must be set before auth.php is loaded. 
+	$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);
+}
+
 require_once('auth.php');
 $pst->save_preset('news_datestamp'); // save and render result using unique name. Don't save item datestamp
 require_once(e_HANDLER.'userclass_class.php');
@@ -54,16 +66,7 @@
 $rs = new form;
 $ix = new news;
 
-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);
-}
+
 $from = ($from ? $from : 0);
 $amount = 10;
 
@@ -379,8 +382,8 @@
 
 	function show_options($action) 
 	{
-		global $sql;
-
+		global $sql,$action;
+				
 		if ($action == '') {
 			$action = 'main';
 		}
@@ -428,12 +431,28 @@
 					if (substr($_POST['data'],-7,7) == '[/html]') $_POST['data'] = substr($_POST['data'],0,-7);
 					if (substr($_POST['data'],0,6) == '[html]') $_POST['data'] = substr($_POST['data'],6);
 					$_POST['data'] .= '<br /><b>'.NWSLAN_49.' '.$submitnews_name.'</b>';
-					$_POST['data'] .= ($submitnews_file)? "<br /><br /><img src='{e_IMAGE}newspost_images/".$submitnews_file."' style='float:right; margin-left:5px;margin-right:5px;margin-top:5px;margin-bottom:5px; border:1px solid' />":'';
+					if($submitnews_file)
+					{
+						$tmp = explode(',',$submitnews_file);
+						foreach($tmp as $imgfile)
+						{
+							$_POST['data'] .= ($imgfile)? "<br /><br /><img src='{e_IMAGE}newspost_images/".$imgfile."' style='float:right; margin-left:5px;margin-right:5px;margin-top:5px;margin-bottom:5px; border:1px solid' alt='".$imgfile."' />":'';
+						}
+					}
+					
 				}
 				else
 				{
 					$_POST['data'] .= "\n[[b]".NWSLAN_49.' '.$submitnews_name.'[/b]]';
-					$_POST['data'] .= ($submitnews_file)?"\n\n[img]{e_IMAGE}newspost_images/".$submitnews_file.'[/img]': '';
+					if($submitnews_file)
+					{
+						$tmp = explode(',',$submitnews_file);
+						foreach($tmp as $imgfile)
+						{
+							$_POST['data'] .= "\n\n[img]{e_IMAGE}newspost_images/".$imgfile.'[/img]';				
+						}
+					}
+					
 				}
 				$_POST['cat_id'] = $submitnews_category;
 				$_POST['data'] = $tp->dataFilter($_POST['data']);		// Filter any nasties
@@ -1141,7 +1160,16 @@
 	function submitted_news($sub_action, $id) 
 	{
 		global $rs, $ns, $tp;
+		
+				
 		$sql2 = new db;
+		
+		$sql2->db_Select('news_category');
+		while($row = $sql2->db_Fetch())
+		{
+			$newsCat[$row['category_id']] = $row['category_name'];
+		}
+		
 		$text = "<div style='text-align: center'>";
 		if ($category_total = $sql2->db_Select('submitnews', '*', "submitnews_id !='' ORDER BY submitnews_id DESC")) 
 		{
@@ -1149,8 +1177,13 @@
 			<table class='fborder' style='".ADMIN_WIDTH."'>
 				<tr>
 					<td style='width:5%' class='fcaption'>ID</td>
-					<td style='width:70%' class='fcaption'>".NWSLAN_57."</td>
-					<td style='width:25%; text-align:center' class='fcaption'>".LAN_OPTIONS."</td>
+					<td style='width:60%' class='fcaption'>".NWSLAN_57."</td>
+					<td style='width:15%' class='fcaption'>".LAN_DATE."</td>
+					<td style='width:10%' class='fcaption'>".LAN_NEWS_55."</td>
+					<td class='fcaption'>".NWSLAN_6."</td>
+					<td class='fcaption'>".LAN_NEWS_56."</td>
+					
+					<td style='width:20%; text-align:center' class='fcaption'>".LAN_OPTIONS."</td>
 				</tr>";
 			while ($row = $sql2->db_Fetch()) 
 			{
@@ -1162,14 +1195,38 @@
 				$text .= "
 				<tr>
 					<td style='width:5%; text-align:center; vertical-align:top' class='forumheader3'>$submitnews_id</td>
-					<td style='width:70%' class='forumheader3'>";
-				$text .= ($submitnews_auth == 0)? '<b>'.$tp->toHTML($submitnews_title,FALSE,'emotes_off, no_make_clickable').'</b>': $tp->toHTML($submitnews_title,FALSE,'emotes_off, no_make_clickable');
-				$text .= ' [ '.NWSLAN_104.' '.$submitnews_name.' '.NWSLAN_108.' '.date('D dS M y, g:ia', $submitnews_datestamp).']<br />'.$tp->toHTML($submitnews_item).
-				"</td><td style='width:25%; text-align:right; vertical-align:top' class='forumheader3'>";
+					<td style='width:60%' class='forumheader3'><a href=\"javascript:expandit('submitted_".$submitnews_id."')\">";
+				$text .= $tp->toHTML($submitnews_title,FALSE,'emotes_off, no_make_clickable');
+				$text .= '</a>';
+			//	$text .=  [ '.NWSLAN_104.' '.$submitnews_name.' '.NWSLAN_108.' '.date('D dS M y, g:ia', $submitnews_datestamp).']<br />';
+				$text .= "<div id='submitted_".$submitnews_id."' style='display:none'>".$tp->toHTML($submitnews_item,TRUE);
+				
+				if($submitnews_file)
+				{
+					$tmp = explode(',',$submitnews_file);
+					$text .= "<br />";
+					foreach($tmp as $imgfile)
+					{
+						$text .= "<br /><img src='".e_IMAGE_ABS."newspost_images/".$imgfile."' alt='".$imgfile."' />";					
+					}
+				}
+				$text .= "
+				</div>";
+				
+				
+				$text .= "</td>";
+				
+				$text .= "<td style='vertical-align:top' class='forumheader3'>".date('D jS M, Y, g:ia', $submitnews_datestamp)."</td>
+				<td style='vertical-align:top' class='forumheader3'><a href=\"mailto:".$submitnews_email."?subject=[".SITENAME."] ".trim($submitnews_title)."\" title='".$submitnews_email."'>".$submitnews_name."</a></td>
+				<td style='vertical-align:top' class='forumheader3'>".$tp->toHTML($newsCat[$submitnews_category],TRUE,'defs')."</td>
+				<td style='text-align:center; vertical-align:top' class='forumheader3'>".($submitnews_auth == 0 ?  "&nbsp;" : ADMIN_TRUE_ICON)."</td>
+				<td style='width:20%;  text-align:right; vertical-align:top' class='forumheader3'>";
 				$buttext = ($submitnews_auth == 0)? NWSLAN_58 :	NWSLAN_103;
-				$text .= $rs->form_open('post', e_SELF.'?sn', 'myform__{$submitnews_id}', '', '', " onsubmit=\"return jsconfirm('".$tp->toJS(NWSLAN_38." [ID: {$submitnews_id} ]")."')\"   ")
-				."<div>".$rs->form_button('button', 'category_edit_'.$submitnews_id, $buttext, "onclick=\"document.location='".e_SELF."?create.sn.{$submitnews_id}'\"")."
-				".$rs->form_button('submit', 'delete[sn_'.$submitnews_id.']', LAN_DELETE)."
+				$text .= $rs->form_open('post', e_SELF.'?sn', 'myform__'.$submitnews_id, '', '', " onsubmit=\"return jsconfirm('".$tp->toJS(NWSLAN_38." [ID: {$submitnews_id} ]")."')\"   ")
+				."<div style='white-space:nowrap'>".
+				$rs->form_button('button', 'category_view_'.$submitnews_id, NWSLAN_27, "onclick=\"expandit('submitted_".$submitnews_id."')\"").
+				$rs->form_button('button', 'category_edit_'.$submitnews_id, $buttext, "onclick=\"document.location='".e_SELF."?create.sn.{$submitnews_id}'\"")."
+				<input type='submit' class='button' name='delete[sn_".$submitnews_id."]' value=\"".LAN_DELETE."\" />
 				</div>".$rs->form_close()."
 				</td>
 				</tr>\n";
diff -x .svn -aruN 0.7.24.src/e107_admin/phpinfo.php 0.7.26.src/e107_admin/phpinfo.php
--- 0.7.24.src/e107_admin/phpinfo.php	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_admin/phpinfo.php	2011-06-28 20:49:25.000000000 -0500
@@ -11,8 +11,8 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $URL: https://e107.svn.sourceforge.net/svnroot/e107/trunk/e107_0.7/e107_admin/phpinfo.php $
-|     $Revision: 11678 $
-|     $Id: phpinfo.php 11678 2010-08-22 00:43:45Z e107coders $
+|     $Revision: 12291 $
+|     $Id: phpinfo.php 12291 2011-06-29 01:49:49Z e107coders $
 |     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
@@ -23,11 +23,42 @@
 }
 $e_sub_cat = 'phpinfo';
 require_once("auth.php");
-	
+
 ob_start();
 phpinfo();
 $phpinfo .= ob_get_contents();
 $phpinfo = preg_replace("#^.*<body>#is", "", $phpinfo);
+$phpinfo = str_replace("font","span",$phpinfo);
+$phpinfo = str_replace("</body></html>","",$phpinfo);
+$phpinfo = str_replace('border="0"','class="fborder"',$phpinfo);
+$phpinfo = str_replace('name=','id=',$phpinfo);
+$phpinfo = str_replace('class="e"','class="forumheader2"',$phpinfo);
+$phpinfo = str_replace('class="v"','class="forumheader3"',$phpinfo);
+$phpinfo = str_replace('class="v"','class="forumheader3"',$phpinfo);
+$phpinfo = str_replace('class="h"','class="fcaption"',$phpinfo);
+
+
+
+$security_risks = array(
+	"allow_url_fopen"	=> 'If you have Curl enabled, you should consider disabling this feature.',
+	"allow_url_include"	=> 'This is a security risk and is not needed by e107.',
+	"display_errors"	=> 'On a production server, it is better to disable the displaying of errors in the browser.',
+	"expose_php"		=> 'Disabling this will hide your PHP version from browsers.',
+	"register_globals"	=> 'This is a security risk and should be disabled.'
+	);
+
+	foreach($security_risks as $risk=>$diz)
+	{
+		if(ini_get($risk))
+		{
+			$srch = '<tr><td class="forumheader2">'.$risk.'</td><td class="forumheader3">';
+			$repl = '<tr><td class="forumheader2">'.$risk.'</td><td title="'.$diz.'" class="forumheader3" style="background-color:red">';
+			$phpinfo = str_replace($srch,$repl,$phpinfo);	
+		}	
+	}
+
+
+// $phpinfo = preg_replace("#^.*<body>#is", "", $phpinfo);
 ob_end_clean();
 $ns->tablerender("PHPInfo", $phpinfo);
 require_once("footer.php");
diff -x .svn -aruN 0.7.24.src/e107_admin/plugin.php 0.7.26.src/e107_admin/plugin.php
--- 0.7.24.src/e107_admin/plugin.php	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_admin/plugin.php	2011-05-01 10:57:20.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $URL: https://e107.svn.sourceforge.net/svnroot/e107/trunk/e107_0.7/e107_admin/plugin.php $
-|     $Revision: 11678 $
-|     $Id: plugin.php 11678 2010-08-22 00:43:45Z e107coders $
-|     $Author: e107coders $
+|     $Revision: 12174 $
+|     $Id: plugin.php 12174 2011-05-01 15:57:44Z e107steved $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 
@@ -270,7 +270,7 @@
 			include_once(e_HANDLER."file_class.php");
 			$fi = new e_file;
 			$result = $fi->rmtree(e_PLUGIN.$eplug_folder);
-			$text .= ($result ? "<br />All files removed from ".e_PLUGIN.$eplug_folder : '<br />File deletion failed<br />'.EPL_ADLAN_31.' <b>'.e_PLUGIN.$eplug_folder.'</b> '.EPL_ADLAN_32);
+			$text .= '<br />'.($result ? EPL_ADLAN_64.e_PLUGIN.$eplug_folder : EPL_ADLAN_65.'<br />'.EPL_ADLAN_31.' <b>'.e_PLUGIN.$eplug_folder.'</b> '.EPL_ADLAN_32);
 		}
 		else
 		{
@@ -514,11 +514,11 @@
 
 		$text .= "
 		<tr>
-		<td class='forumheader3' style='width:160px; text-align:center; vertical-align:top'>
-		<table style='width:100%'><tr><td style='text-align:left;width:40px;vertical-align:top'>
-		".$plugin_icon."
+		<td class='forumheader3' style='width:25%; text-align:left; vertical-align:top'>
+		<table style='width:100%'><tr><td style='text-align:left;width:50px;vertical-align:top'>
+		<span class='plugin-manager-icon'>".$plugin_icon."</span>
 		</td><td>
-		$img <b>".$tp->toHTML($plug['plugin_name'],FALSE,"defs,emotes_off, no_make_clickable")."</b><br />".EPL_ADLAN_11." {$plug['plugin_version']}
+		<span class='plugin-manager-status'>$img </span><b>".$tp->toHTML($plug['plugin_name'],FALSE,"defs,emotes_off, no_make_clickable")."</b><br />".EPL_ADLAN_11." {$plug['plugin_version']}
 		<br />";
 
 		$text .="</td>
@@ -545,7 +545,7 @@
 
 
 		$text .= "</table></td>";
-		$text .= "<td class='forumheader3' style='width:70px;text-align:center'>";
+		$text .= "<td class='forumheader3' style='width:25%;text-align:center'>";
     	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."' />");
 		} 
@@ -567,7 +567,7 @@
 		}
 
 		if ($plug['plugin_version'] != $eplug_version && $plug['plugin_installflag']) {
-			$text .= "<br /><input type='button' class='button' onclick=\"location.href='".e_SELF."?upgrade.{$plug['plugin_id']}'\" title='".EPL_UPGRADE." to v".$eplug_version."' value='".EPL_UPGRADE."' />";
+			$text .= "<input type='button' class='button' onclick=\"location.href='".e_SELF."?upgrade.{$plug['plugin_id']}'\" title='".EPL_UPGRADE." to v".$eplug_version."' value='".EPL_UPGRADE."' />";
 		}
 
 		$text .="</td>";
diff -x .svn -aruN 0.7.24.src/e107_admin/prefs.php 0.7.26.src/e107_admin/prefs.php
--- 0.7.24.src/e107_admin/prefs.php	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_admin/prefs.php	2011-06-28 23:20:43.000000000 -0500
@@ -10,8 +10,8 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $URL: https://e107.svn.sourceforge.net/svnroot/e107/trunk/e107_0.7/e107_admin/prefs.php $
-|     $Revision: 11797 $
-|     $Id: prefs.php 11797 2010-09-17 21:58:27Z e107coders $
+|     $Revision: 12295 $
+|     $Id: prefs.php 12295 2011-06-29 04:21:07Z e107coders $
 |     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
@@ -45,7 +45,7 @@
 require_once(e_HANDLER."form_handler.php");
 $rs = new form;
 
-if ($_POST['submit_resetdisplaynames'])
+if (isset($_POST['submit_resetdisplaynames']))
 {
     $sql -> db_Update("user", "user_name=user_loginname");
 	$message = PRFLAN_157;
@@ -117,7 +117,8 @@
 	}
 }
 
-if ($authlist) {
+if (isset($authlist)  && is_array($authlist))
+{
 	$auth_dropdown .= "<select class='tbox' name='auth_method'>\n";
 	foreach($authlist as $a) {
 		$s = ($pref['auth_method'] == $a ? " selected='selected' " : "");
@@ -702,6 +703,14 @@
 	</tr>\n
 
     <tr>
+	<td class='forumheader3' style='width:50%;'>".PRFLAN_220.":  <div class='smalltext'>".PRFLAN_221."</div></td>
+	<td class='forumheader3' style='width:50%; text-align: right;'>
+	<input type='radio' name='html_abuse' value='1'".(varset($pref['html_abuse'], 1) ? " checked='checked'" : "")." /> ".PRFLAN_112."&nbsp;&nbsp;
+	<input type='radio' name='html_abuse' value='0'".(!varset($pref['html_abuse'], 1) ? " checked='checked'" : "")." /> ".PRFLAN_113."
+	</td>
+	</tr>\n
+
+    <tr>
 	<td class='forumheader3' style='width:50%;'>".PRFLAN_122.":  <div class='smalltext'>".PRFLAN_123."</div></td>
 	<td class='forumheader3' style='width:50%; text-align: right;'>
 	<input type='radio' name='wysiwyg' value='1'".($pref['wysiwyg'] ? " checked='checked'" : "")." /> ".PRFLAN_112."&nbsp;&nbsp;
@@ -716,15 +725,16 @@
 	<input type='radio' name='old_np' value='0'".(!$pref['old_np'] ? " checked='checked'" : "")." /> ".PRFLAN_113."
 	</td>
 	</tr>
+";
+	// Deprecated as of 0.7.16
+	// <tr>
+	// <td class='forumheader3' style='width:50%;'>".PRFLAN_131.":  <div class='smalltext'>".PRFLAN_132."</div></td>
+	// <td class='forumheader3' style='width:50%; text-align: right;'>
+	// ".r_userclass('php_bbcode',$pref['php_bbcode'],'off','nobody,admin,main,classes')."
+	// </td>
+	// </tr>\n
 
-	<tr>
-	<td class='forumheader3' style='width:50%;'>".PRFLAN_131.":  <div class='smalltext'>".PRFLAN_132."</div></td>
-	<td class='forumheader3' style='width:50%; text-align: right;'>
-	".r_userclass('php_bbcode',$pref['php_bbcode'],'off','nobody,admin,main,classes')."
-	</td>
-	</tr>\n
 
-";
 
 	if(file_exists(e_PLUGIN."geshi/geshi.php")) {
 		$text .= "<tr>
@@ -1062,6 +1072,6 @@
 	$var['security']['text'] = PRFLAN_47;
 	$var['comments']['text'] = PRFLAN_210;
 	$var['advanced']['text'] = PRFLAN_149;
-	show_admin_menu(LAN_OPTIONS, $action, $var, TRUE);
+	show_admin_menu(LAN_OPTIONS, '', $var, TRUE);
 }
 ?>
\ No newline at end of file
diff -x .svn -aruN 0.7.24.src/e107_admin/search.php 0.7.26.src/e107_admin/search.php
--- 0.7.24.src/e107_admin/search.php	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_admin/search.php	2010-10-09 06:50:45.000000000 -0500
@@ -11,8 +11,8 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $URL: https://e107.svn.sourceforge.net/svnroot/e107/trunk/e107_0.7/e107_admin/search.php $
-|     $Revision: 11678 $
-|     $Id: search.php 11678 2010-08-22 00:43:45Z e107coders $
+|     $Revision: 11868 $
+|     $Id: search.php 11868 2010-10-09 11:51:09Z e107coders $
 |     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
@@ -23,10 +23,13 @@
 	exit;
 }
 $e_sub_cat = 'search';
+
+$query = explode('.', e_QUERY); // must be set before auth.php is loaded. 
+
 require_once('auth.php');
 require_once(e_HANDLER.'userclass_class.php');
 
-$query = explode('.', e_QUERY);
+
 
 $search_prefs = $sysprefs -> getArray('search_prefs');
 
@@ -287,10 +290,10 @@
 	</tr>";
 
 	$text .= "<tr>
-	<td class='forumheader'>".SEALAN_24."</td>
-	<td class='forumheader'>".SEALAN_25."</td>
-	<td class='forumheader'>".LAN_ORDER."</td>
-	<td class='forumheader'>".LAN_EDIT."</td>
+	<td class='fcaption'>".SEALAN_24."</td>
+	<td class='fcaption'>".SEALAN_25."</td>
+	<td class='fcaption'>".LAN_ORDER."</td>
+	<td class='fcaption'>".LAN_EDIT."</td>
 	</tr>";
 
 	foreach($search_handlers as $key => $value) {
@@ -358,8 +361,8 @@
 	</tr>";
 
 	$text .= "<tr>
-	<td class='forumheader'>".SEALAN_24."</td>
-	<td class='forumheader'>".SEALAN_25."</td>
+	<td class='fcaption'>".SEALAN_24."</td>
+	<td class='fcaption'>".SEALAN_25."</td>
 	</tr>";
 
 	foreach ($search_prefs['comments_handlers'] as $key => $value) {
diff -x .svn -aruN 0.7.24.src/e107_admin/sql/core_sql.php 0.7.26.src/e107_admin/sql/core_sql.php
--- 0.7.24.src/e107_admin/sql/core_sql.php	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_admin/sql/core_sql.php	2011-02-07 16:25:20.000000000 -0600
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $URL: https://e107.svn.sourceforge.net/svnroot/e107/trunk/e107_0.7/e107_admin/sql/core_sql.php $
-|     $Revision: 11678 $
-|     $Id: core_sql.php 11678 2010-08-22 00:43:45Z e107coders $
-|     $Author: e107coders $
+|     $Revision: 12063 $
+|     $Id: core_sql.php 12063 2011-02-07 22:25:44Z e107steved $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 header("location:../index.php");
@@ -43,7 +43,7 @@
   banlist_admin smallint(5) unsigned NOT NULL default '0',
   banlist_reason tinytext NOT NULL,
   PRIMARY KEY  (banlist_ip)
-) TYPE=MyISAM;
+) ENGINE=MyISAM;
 # --------------------------------------------------------
 
 #
@@ -66,7 +66,7 @@
   banner_ip text NOT NULL,
   banner_campaign varchar(150) NOT NULL default '',
   PRIMARY KEY  (banner_id)
-) TYPE=MyISAM;
+) ENGINE=MyISAM;
 # --------------------------------------------------------
 
 #
@@ -87,7 +87,7 @@
   comment_type varchar(10) NOT NULL default '0',
   comment_lock tinyint(1) unsigned NOT NULL default '0',
   PRIMARY KEY  (comment_id)
-) TYPE=MyISAM;
+) ENGINE=MyISAM;
 # --------------------------------------------------------
 
 #
@@ -97,7 +97,7 @@
   e107_name varchar(100) NOT NULL default '',
   e107_value text NOT NULL,
   PRIMARY KEY  (e107_name)
-) TYPE=MyISAM;
+) ENGINE=MyISAM;
 # --------------------------------------------------------
 
 #
@@ -112,7 +112,7 @@
   dblog_title varchar(255) NOT NULL default '',
   dblog_remarks text NOT NULL,
   PRIMARY KEY  (dblog_id)
-) TYPE=MyISAM;
+) ENGINE=MyISAM;
 # --------------------------------------------------------
 
 #
@@ -142,7 +142,7 @@
   PRIMARY KEY  (download_id),
   UNIQUE KEY download_name (download_name),
   KEY download_category (download_category)
-) TYPE=MyISAM;
+) ENGINE=MyISAM;
 # --------------------------------------------------------
 
 #
@@ -158,7 +158,7 @@
   download_category_class varchar(255) NOT NULL default '0',
   download_category_order int(10) unsigned NOT NULL default '0',
   PRIMARY KEY  (download_category_id)
-) TYPE=MyISAM;
+) ENGINE=MyISAM;
 # --------------------------------------------------------
 
 #
@@ -174,7 +174,7 @@
   mirror_description text NOT NULL,
   mirror_count int(10) unsigned NOT NULL default '0',
   PRIMARY KEY  (mirror_id)
-) TYPE=MyISAM;
+) ENGINE=MyISAM;
 # --------------------------------------------------------
 
 #
@@ -189,7 +189,7 @@
   PRIMARY KEY  (download_request_id),
   KEY download_request_userid (download_request_userid),
   KEY download_request_download_id (download_request_download_id)
-) TYPE=MyISAM;
+) ENGINE=MyISAM;
 # --------------------------------------------------------
 
 
@@ -200,7 +200,7 @@
 CREATE TABLE flood (
   flood_url text NOT NULL,
   flood_time int(10) unsigned NOT NULL default '0'
-) TYPE=MyISAM;
+) ENGINE=MyISAM;
 # --------------------------------------------------------
 
 #
@@ -216,7 +216,7 @@
   headline_image varchar(100) NOT NULL default '',
   headline_active tinyint(1) unsigned NOT NULL default '0',
   PRIMARY KEY  (headline_id)
-) TYPE=MyISAM;
+) ENGINE=MyISAM;
 
 # --------------------------------------------------------
 
@@ -236,7 +236,7 @@
   link_open tinyint(1) unsigned NOT NULL default '0',
   link_class varchar(255) NOT NULL default '0',
   PRIMARY KEY  (link_id)
-) TYPE=MyISAM;
+) ENGINE=MyISAM;
 
 # --------------------------------------------------------
 
@@ -253,7 +253,7 @@
   menu_pages text NOT NULL,
   menu_path varchar(100) NOT NULL default '',
   PRIMARY KEY  (menu_id)
-) TYPE=MyISAM;
+) ENGINE=MyISAM;
 # --------------------------------------------------------
 
 #
@@ -278,7 +278,7 @@
   news_thumbnail text NOT NULL,
   news_sticky tinyint(3) unsigned NOT NULL default '0',
   PRIMARY KEY  (news_id)
-) TYPE=MyISAM;
+) ENGINE=MyISAM;
 
 
 
@@ -295,7 +295,7 @@
   category_name varchar(200) NOT NULL default '',
   category_icon varchar(250) NOT NULL default '',
   PRIMARY KEY  (category_id)
-) TYPE=MyISAM;
+) ENGINE=MyISAM;
 # --------------------------------------------------------
 
 #
@@ -309,8 +309,9 @@
   online_ip varchar(15) NOT NULL default '',
   online_location varchar(100) NOT NULL default '',
   online_pagecount tinyint(3) unsigned NOT NULL default '0',
-  online_active int(10) unsigned NOT NULL default '0'
-) TYPE=MyISAM;
+  online_active int(10) unsigned NOT NULL default '0',
+  KEY online_ip (online_ip)
+) ENGINE=InnoDB;
 # --------------------------------------------------------
 
 #
@@ -330,7 +331,7 @@
   page_ip_restrict text NOT NULL,
   page_theme varchar(50) NOT NULL default '',
   PRIMARY KEY  (page_id)
-) TYPE=MyISAM;
+) ENGINE=MyISAM;
 # --------------------------------------------------------
 
 #
@@ -346,7 +347,7 @@
   plugin_addons text NOT NULL,
   PRIMARY KEY  (plugin_id),
   UNIQUE KEY plugin_path (plugin_path)
-) TYPE=MyISAM;
+) ENGINE=MyISAM;
 
 # --------------------------------------------------------
 
@@ -360,7 +361,7 @@
   preset_field varchar(80) NOT NULL default '',
   preset_value varchar(255) NOT NULL default '',
   PRIMARY KEY  (preset_id)
-) TYPE=MyISAM;
+) ENGINE=MyISAM;
 
 # --------------------------------------------------------
 
@@ -376,7 +377,7 @@
   rate_votes int(10) unsigned NOT NULL default '0',
   rate_voters text NOT NULL,
   PRIMARY KEY  (rate_id)
-) TYPE=MyISAM;
+) ENGINE=MyISAM;
 # --------------------------------------------------------
 
 #
@@ -389,7 +390,7 @@
   binary_filetype varchar(100) NOT NULL default '',
   binary_data longblob NOT NULL,
   PRIMARY KEY  (binary_id)
-) TYPE=MyISAM;
+) ENGINE=MyISAM;
 # --------------------------------------------------------
 
 #
@@ -402,7 +403,7 @@
   session_datestamp int(10) unsigned NOT NULL default '0',
   session_ip varchar(200) NOT NULL default '',
   session_data text NOT NULL
-) TYPE=MyISAM;
+) ENGINE=MyISAM;
 
 # --------------------------------------------------------
 
@@ -422,7 +423,7 @@
   submitnews_auth tinyint(3) unsigned NOT NULL default '0',
   submitnews_file varchar(100) NOT NULL default '',
   PRIMARY KEY  (submitnews_id)
-) TYPE=MyISAM;
+) ENGINE=MyISAM;
 # --------------------------------------------------------
 
 #
@@ -434,7 +435,7 @@
   tmp_time int(10) unsigned NOT NULL default '0',
   tmp_info text NOT NULL,
   KEY tmp_ip (tmp_ip)
-) TYPE=MyISAM;
+) ENGINE=MyISAM;
 # --------------------------------------------------------
 
 #
@@ -458,7 +459,7 @@
   upload_category tinyint(3) unsigned NOT NULL default '0',
   PRIMARY KEY  (upload_id),
   KEY upload_active (upload_active)
-) TYPE=MyISAM;
+) ENGINE=MyISAM;
 
 # --------------------------------------------------------
 
@@ -502,7 +503,7 @@
   UNIQUE KEY user_name (user_name),
   UNIQUE KEY user_loginname (user_loginname),
   KEY user_ban_index (user_ban)
-) TYPE=MyISAM;
+) ENGINE=MyISAM;
 # --------------------------------------------------------
 
 #
@@ -514,7 +515,7 @@
   userclass_description varchar(250) NOT NULL default '',
   userclass_editclass tinyint(3) unsigned NOT NULL default '0',
   PRIMARY KEY  (userclass_id)
-) TYPE=MyISAM;
+) ENGINE=MyISAM;
 # --------------------------------------------------------
 
 #
@@ -525,7 +526,7 @@
   user_extended_id int(10) unsigned NOT NULL default '0',
   user_hidden_fields text NOT NULL,
   PRIMARY KEY  (user_extended_id)
-) TYPE=MyISAM;
+) ENGINE=MyISAM;
 # --------------------------------------------------------
 
 
@@ -549,7 +550,7 @@
   user_extended_struct_order int(10) unsigned NOT NULL default '0',
   user_extended_struct_parent int(10) unsigned NOT NULL default '0',
   PRIMARY KEY  (user_extended_struct_id)
-) TYPE=MyISAM;
+) ENGINE=MyISAM;
 # --------------------------------------------------------
 
 
@@ -566,5 +567,5 @@
   gen_chardata text NOT NULL,
   PRIMARY KEY  (gen_id),
   KEY gen_type (gen_type)
-) TYPE=MyISAM;
+) ENGINE=MyISAM;
 # --------------------------------------------------------
diff -x .svn -aruN 0.7.24.src/e107_admin/sql/extended_country.php 0.7.26.src/e107_admin/sql/extended_country.php
--- 0.7.24.src/e107_admin/sql/extended_country.php	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_admin/sql/extended_country.php	2011-05-02 15:45:16.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $URL: https://e107.svn.sourceforge.net/svnroot/e107/trunk/e107_0.7/e107_admin/sql/extended_country.php $
-|     $Revision: 11678 $
-|     $Id: extended_country.php 11678 2010-08-22 00:43:45Z e107coders $
-|     $Author: e107coders $
+|     $Revision: 12178 $
+|     $Id: extended_country.php 12178 2011-05-02 20:45:40Z e107steved $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 header("location:../index.php");
@@ -28,7 +28,7 @@
   country_iso char(2) NOT NULL default '',
   PRIMARY KEY  (country_code),
   KEY country_iso (country_iso)
-) TYPE=MyISAM;
+) ENGINE=MyISAM;
 
 INSERT INTO user_extended_country VALUES('AFG', 'Afghanistan', 'Asia', 'Southern and Central Asia', 'AF');
 INSERT INTO user_extended_country VALUES('NLD', 'Netherlands', 'Europe', 'Western Europe', 'NL');
diff -x .svn -aruN 0.7.24.src/e107_admin/update_routines.php 0.7.26.src/e107_admin/update_routines.php
--- 0.7.24.src/e107_admin/update_routines.php	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_admin/update_routines.php	2011-05-02 15:45:16.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $URL: https://e107.svn.sourceforge.net/svnroot/e107/trunk/e107_0.7/e107_admin/update_routines.php $
-|     $Revision: 11678 $
-|     $Id: update_routines.php 11678 2010-08-22 00:43:45Z e107coders $
-|     $Author: e107coders $
+|     $Revision: 12178 $
+|     $Id: update_routines.php 12178 2011-05-02 20:45:40Z e107steved $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 
@@ -345,7 +345,7 @@
 			poll_vote_userclass tinyint(3) unsigned NOT NULL default '0',
 			poll_storage_method tinyint(1) unsigned NOT NULL default '0',
 			PRIMARY KEY  (poll_id)
-			) TYPE=MyISAM;";
+			) ENGINE=MyISAM;";
 			$sql->db_Select_gen($query);
 			catch_error();
 			if($sql -> db_Select("poll"))
@@ -397,7 +397,7 @@
 			newsfeed_active tinyint(1) unsigned NOT NULL default '0',
 			newsfeed_updateint int(10) unsigned NOT NULL default '0',
 			PRIMARY KEY  (newsfeed_id)
-			) TYPE=MyISAM;");
+			) ENGINE=MyISAM;");
 			catch_error();
 		}
 
@@ -433,7 +433,7 @@
 			mirror_description text NOT NULL,
 			mirror_count int(10) unsigned NOT NULL default '0',
 			PRIMARY KEY  (mirror_id)
-			) TYPE=MyISAM;";
+			) ENGINE=MyISAM;";
 			$sql->db_Select_gen($query);
 			catch_error();
 			mysql_query("ALTER TABLE ".MPREFIX."download ADD download_class TINYINT ( 3 ) UNSIGNED NOT NULL");
@@ -470,7 +470,7 @@
 		  	page_ip_restrict text NOT NULL,
 		  	page_theme varchar(50) NOT NULL default '',
 		  	PRIMARY KEY  (page_id)
-			) TYPE=MyISAM;");
+			) ENGINE=MyISAM;");
 			catch_error();
 			mysql_query("ALTER TABLE ".MPREFIX."page CHANGE page_class page_class varchar(250) NOT NULL default ''");
 			catch_error();
@@ -488,7 +488,7 @@
 				link_category_description varchar(250) NOT NULL default '',
 				link_category_icon varchar(100) NOT NULL default '',
 				PRIMARY KEY  (link_category_id)
-				) TYPE=MyISAM;");
+				) ENGINE=MyISAM;");
 				catch_error();
 				$sql->db_Select_gen("CREATE TABLE ".MPREFIX."links_page (
 				link_id int(10) unsigned NOT NULL auto_increment,
@@ -502,7 +502,7 @@
 				link_open tinyint(1) unsigned NOT NULL default '0',
 				link_class tinyint(3) unsigned NOT NULL default '0',
 				PRIMARY KEY  (link_id)
-				) TYPE=MyISAM;");
+				) ENGINE=MyISAM;");
 				catch_error();
 				$new_cat_id = 1;
 				$sql->db_Select("link_category", "*", "link_category_id!=1 ORDER BY link_category_id");
@@ -585,7 +585,7 @@
 			dblog_query text NOT NULL,
 			dblog_remarks varchar(255) NOT NULL default '',
 			PRIMARY KEY  (dblog_id)
-			) TYPE=MyISAM;");
+			) ENGINE=MyISAM;");
 			catch_error();
 		}
 
@@ -600,7 +600,7 @@
 			gen_intdata int(10) unsigned NOT NULL default '0',
 			gen_chardata text NOT NULL,
 			PRIMARY KEY  (gen_id)
-			) TYPE=MyISAM;");
+			) ENGINE=MyISAM;");
 			catch_error();
 		}
 
@@ -608,7 +608,7 @@
 			$sql->db_Select_gen("CREATE TABLE ".MPREFIX."user_extended (
 			user_extended_id int(10) unsigned NOT NULL default '0',
 			PRIMARY KEY  (user_extended_id)
-			) TYPE=MyISAM;");
+			) ENGINE=MyISAM;");
 			catch_error();
 
 			$sql->db_Select_gen("CREATE TABLE ".MPREFIX."user_extended_struct (
@@ -624,7 +624,7 @@
 			user_extended_struct_required tinyint(3) unsigned NOT NULL default '0',
 			user_extended_struct_signup tinyint(3) unsigned NOT NULL default '0',
 			PRIMARY KEY  (user_extended_struct_id)
-			) TYPE=MyISAM;");
+			) ENGINE=MyISAM;");
 			catch_error();
 
 			$sql->db_Select_gen("ALTER TABLE #user_extended_struct ADD user_extended_struct_applicable tinyint(3) unsigned NOT NULL default '0'");
@@ -806,7 +806,7 @@
 			preset_field varchar(80) NOT NULL default '',
 			preset_value varchar(255) NOT NULL default '',
 			PRIMARY KEY  (preset_id)
-			) TYPE=MyISAM;");
+			) ENGINE=MyISAM;");
 			catch_error();
 		}
 
@@ -835,7 +835,7 @@
 			download_request_download_id int(10) unsigned NOT NULL default '0',
 			download_request_datestamp int(10) unsigned NOT NULL default '0',
 			PRIMARY KEY  (download_request_id)
-			) TYPE=MyISAM;");
+			) ENGINE=MyISAM;");
 			catch_error();
 		}
 
@@ -913,7 +913,7 @@
 				log_data longtext NOT NULL,
 				PRIMARY KEY  (log_uniqueid),
 				UNIQUE KEY log_id (log_id)
-				) TYPE=MyISAM;");
+				) ENGINE=MyISAM;");
 				catch_error();
 			}
 
@@ -1374,7 +1374,7 @@
 					event_userid int(10) unsigned NOT NULL default '0',
 					event_cat int(10) unsigned NOT NULL default '0',
 					PRIMARY KEY (event_subid)
-					) TYPE=MyISAM;");
+					) ENGINE=MyISAM;");
 
 				$row = $sql->db_Fetch();
 				if($row['plugin_version'] != '3.5'){
diff -x .svn -aruN 0.7.24.src/e107_admin/userclass2.php 0.7.26.src/e107_admin/userclass2.php
--- 0.7.24.src/e107_admin/userclass2.php	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_admin/userclass2.php	2011-06-04 09:14:02.000000000 -0500
@@ -10,9 +10,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $URL: https://e107.svn.sourceforge.net/svnroot/e107/trunk/e107_0.7/e107_admin/userclass2.php $
-|     $Revision: 11794 $
-|     $Id: userclass2.php 11794 2010-09-17 13:28:28Z e107coders $
-|     $Author: e107coders $
+|     $Revision: 12246 $
+|     $Id: userclass2.php 12246 2011-06-04 14:14:26Z nlstart $
+|     $Author: nlstart $
 +----------------------------------------------------------------------------+
 */
 
@@ -50,6 +50,37 @@
 	}
 }
 
+if (isset($_POST['disp']))
+{
+	$class_id = intval($_POST['userclass_id']);
+	check_allowed($class_id);
+	$class_name = $tp->toDB($_POST['userclass_name']);
+	$text = "<br />
+		<div style='text-align:center'>
+		<table class='fborder' style='".ADMIN_WIDTH."'>
+		<tr>
+			<td class='fcaption'>".UCSLAN_25."</td>
+			<td class='fcaption'>".UCSLAN_26."</td>
+		</tr>";
+	if ($sql->db_Select('user', 'user_id, user_name', "user_class = '{$class_id}' OR user_class REGEXP('^{$class_id},') OR user_class REGEXP(',{$class_id},') OR user_class REGEXP(',{$class_id}$') ORDER BY user_id"))
+	{
+		while ($row = $sql->db_Fetch())
+		{
+			$text .= "
+		<tr>
+			<td class='forumheader3'><a href='".SITEURL."user.php?id.".$row['user_id']."' alt=''>".$row['user_id']."</a></td>
+			<td class='forumheader3'>".$row['user_name']."</td>
+		</tr>";
+		}
+	}
+	$text .= "
+		</table>
+		<br /><a href='".e_ADMIN."userclass2.php' alt=''><span class='button'>&nbsp;".UCSLAN_27."&nbsp;</span></a>
+		</div>";
+	$ns->tablerender($class_name, $text);
+	exit;
+}
+
 if (strstr(e_QUERY, 'clear'))
 {
 	$tmp = explode('.', e_QUERY);
@@ -346,9 +377,17 @@
 	<td class='fcaption'>".UCSLAN_12."</td>
 	<td class='fcaption'>".UCSLAN_24."</td>
 	<td class='fcaption'>".UCSLAN_13."</td>
+	<td class='fcaption' style='text-align:center;'>#</td>
 	</tr>
 	";
 
+function users_in_class($p_class_list)
+{
+	$sql_tmp = new db;
+	$class_count = $sql_tmp->db_Count("user", "(*)", "WHERE user_class = '{$p_class_list}' OR user_class REGEXP('^{$p_class_list},') OR user_class REGEXP(',{$p_class_list},') OR user_class REGEXP(',{$p_class_list}$')");	
+	return $class_count;
+}
+	
 if ($class_total == "0")
 {
 	$text .= "<tr><td colspan='3'>".UCSLAN_7."</td></tr>";
@@ -364,12 +403,23 @@
 			{
 				$rEditClass = e_UC_ADMIN;
 			}
-
+			$users_in_class = users_in_class($row['userclass_id']);
+			$disp_form = 0;
+			if($users_in_class > 0)
+			{	// Only display a link if there is something to show
+				$disp_form = "<form method='post' action='".e_SELF."' id='classdisp'>
+								<input type='hidden' name='userclass_id' value='".$row['userclass_id']."' />
+								<input type='hidden' name='userclass_name' value='".$row['userclass_name']."' />
+								<input class='button' type='submit' name='disp' value='".$users_in_class."' />
+								<input type='hidden' name='e-token' value='".e_TOKEN."' />
+							  </form>";
+			}
 			$text .= "
 			<tr>
 			<td class='forumheader3'>{$row['userclass_name']}</td>
 			<td class='forumheader3'>".r_userclass_name($rEditClass)."</td>
 			<td class='forumheader3'>{$row['userclass_description']}</td>
+			<td class='forumheader3' style='text-align:center;'>".$disp_form."</td>
 			</tr>";
 		}
 	}
diff -x .svn -aruN 0.7.24.src/e107_admin/userclass.php 0.7.26.src/e107_admin/userclass.php
--- 0.7.24.src/e107_admin/userclass.php	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_admin/userclass.php	2011-05-17 14:45:23.000000000 -0500
@@ -11,49 +11,76 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $URL: https://e107.svn.sourceforge.net/svnroot/e107/trunk/e107_0.7/e107_admin/userclass.php $
-|     $Revision: 11678 $
-|     $Id: userclass.php 11678 2010-08-22 00:43:45Z e107coders $
-|     $Author: e107coders $
+|     $Revision: 12214 $
+|     $Id: userclass.php 12214 2011-05-17 19:45:47Z e107steved $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 require_once("../class2.php");
-if (!getperms("4")) {
+if (!getperms("4")) 
+{
 	header("location:".e_BASE."index.php");
-	 exit;
+	exit();
 }
 
-if (!e_QUERY) {
-  	header("location:".e_ADMIN."admin.php");
-	exit;
-} else {
+$id = 0;
+if (e_QUERY) 
+{
     $qs = explode(".", e_QUERY);
-	$id = $qs[0];
+	$id = intval($qs[0]);
+}
+if ($id == 0) 
+{
+  	header("location:".e_ADMIN."admin.php");
+	exit();
+}
+
+$e_sub_cat = 'userclass';
+
+require_once('auth.php');
+
+// Get class membership for user now - we may need to udpate it
+$sql->db_Select('user', '*', 'user_id='.$id);
+$row = $sql->db_Fetch();
+$row['user_class'] = trim($row['user_class']);
+$currentClasses = array();
+if ($row['user_class'])
+{
+	$currentClasses = array_flip(explode(',', $row['user_class']));			// Current class membership for user (class ID as key)
 }
 
-$sql->db_Select("userclass_classes");
+$sql->db_Select('userclass_classes');
 $c = 0;
-while ($row = $sql->db_Fetch()) {
-	if (getperms("0") || check_class($row['userclass_editclass'])) {
-		$class[$c][0] = $row['userclass_id'];
-		$class[$c][1] = $row['userclass_name'];
-		$class[$c][2] = $row['userclass_description'];
+$class = array();
+while ($crow = $sql->db_Fetch()) 
+{
+	if (getperms("0") || check_class($crow['userclass_editclass'])) 
+	{
+		$class[$c][0] = $crow['userclass_id'];
+		$class[$c][1] = $crow['userclass_name'];
+		$class[$c][2] = $crow['userclass_description'];
 		$c++;
+		if (isset($currentClasses[$crow['userclass_id']])) unset($currentClasses[$crow['userclass_id']]);
 	}
 }
 
+
 if (isset($_POST['updateclass'])) 
 {
 	$remuser = TRUE;
 	$classcount = count($_POST['userclass'])-1;
-	for($a = 0; $a <= $classcount; $a++) {
-		check_allowed($_POST['userclass'][$a]);
-		$svar .= $_POST['userclass'][$a];
-		$svar .= ($a < $classcount ) ? "," : "";
+	$currentClasses = array_flip($currentClasses);		// Back to having class number in data value
+	for($a = 0; $a <= $classcount; $a++) 
+	{
+		$tmp = intval($_POST['userclass'][$a]);
+		check_allowed($tmp);
+		$currentClasses[] = $tmp;
 	}
+	$svar = implode(',', $currentClasses);
+	$row['user_class'] = $svar;					// Get updated list back into user data
 	$sql->db_Update("user", "user_class='$svar' WHERE user_id='$id' ");
-        $message = UCSLAN_9;
-	$sql->db_Select("user", "*", "user_id='$id' ");
-	$row = $sql->db_Fetch();
+	$message = UCSLAN_9;
+
 	if ($_POST['notifyuser']) 
 	{
 		$message .= "<br />".UCSLAN_1.":</b> ".$row['user_name']."<br />";
@@ -74,19 +101,13 @@
 	}
 
 
-	 header("location: ".$_POST['adminreturn']);
-	 echo "location redirect failed.";
-     exit;
+	header("location: ".$_POST['adminreturn']);
+	echo "location redirect failed.";
+	exit();
 }
 
 
-$e_sub_cat = 'userclass';
-require_once("auth.php");
-
-
 
-$sql->db_Select("user", "*", "user_id='$id' ");
-$row = $sql->db_Fetch();
 
 $caption = UCSLAN_6." <b>".$row['user_name']."</b> (".$row['user_class'].")";
 
@@ -107,7 +128,11 @@
 $adminreturn = e_ADMIN.'users.php?cu';
 if (isset($qs[1]))
 {
-	$adminreturn .= '.'.$qs[1].(isset($qs[2]) ? ".{$qs[2]}.{$qs[3]}.{$qs[4]}" : "");
+	if (($qs[1] != 'main') && ($qs[1] != 'cu'))
+	{
+		$adminreturn .= '.'.$qs[1];
+	}
+	$adminreturn .= (isset($qs[2]) && $qs[2] ? ".{$qs[2]}.{$qs[3]}.{$qs[4]}" : '');
 }
 
 $text .= "	<tr><td class='forumheader' colspan='2' style='text-align:center'>
@@ -128,15 +153,18 @@
 
 // ----------------------------------------------------------
 
-function check_allowed($class_id) {
+function check_allowed($class_id) 
+{
 	global $sql;
-	if (!$sql->db_Select("userclass_classes", "*", "userclass_id = {$class_id}")) {
+	if (!$sql->db_Select("userclass_classes", "*", "userclass_id = {$class_id}")) 
+	{
 		header("location:".SITEURL);
 		exit;
 	}
 	$row = $sql->db_Fetch();
 	extract($row);
-	if (!getperms("0") && !check_class($userclass_editclass)) {
+	if (!getperms("0") && !check_class($userclass_editclass)) 
+	{
 		header("location:".SITEURL);
 		exit;
 	}
diff -x .svn -aruN 0.7.24.src/e107_admin/users_extended.php 0.7.26.src/e107_admin/users_extended.php
--- 0.7.24.src/e107_admin/users_extended.php	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_admin/users_extended.php	2011-07-06 08:42:46.000000000 -0500
@@ -10,14 +10,12 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $URL: https://e107.svn.sourceforge.net/svnroot/e107/trunk/e107_0.7/e107_admin/users_extended.php $
-|     $Revision: 11678 $
-|     $Id: users_extended.php 11678 2010-08-22 00:43:45Z e107coders $
-|     $Author: e107coders $
+|     $Id: users_extended.php 12306 2011-07-06 13:43:10Z secretr $
 +----------------------------------------------------------------------------+
 */
 
 // Experimental e-token
-if(isset($_POST['eu_action']) && !isset($_POST['e-token']))
+if(!empty($_POST) && !isset($_POST['e-token']))
 {
 	// set e-token so it can be processed by class2
 	$_POST['e-token'] = '';
@@ -45,31 +43,48 @@
 $curtype = '1';
 require_once(e_HANDLER."calendar/calendar_class.php");
 $cal = new DHTML_Calendar(true);
-require_once("auth.php");
-require_once(e_HANDLER."user_extended_class.php");
-require_once(e_HANDLER."userclass_class.php");
-
-
-$ue = new e107_user_extended;
-$message = '';
 
 if (e_QUERY)
 {
 	$tmp = explode(".", e_QUERY);
-	$action = $tmp[0];
+	$action = $tmp[0]; // must be set before auth.php is loaded.
 	$sub_action = varset($tmp[1],'');
 	$id = varset($tmp[2],0);
 	unset($tmp);
 }
 
 
+require_once("auth.php");
+require_once(e_HANDLER."user_extended_class.php");
+require_once(e_HANDLER."userclass_class.php");
+
+
+$ue = new e107_user_extended;
+$message = $user->prepare($_POST);
+if($message)
+{
+	if(defsettrue('E107_DEBUG_LEVEL'))
+	{
+		$message[] = EXTLAN_79;
+		$message = implode('<br />', $message);
+	}
+	else $message = EXTLAN_79;
+
+	$ns->tablerender("", "<div style='text-align:center'><b>".$message."</b></div>");
+	$user->show_extended();
+	require_once("footer.php");
+	exit;
+}
+
+
+
 
 if (isset($_POST['up_x']))
 {
 	$qs = explode(".", $_POST['id']);
-	$_id = $qs[0];
-	$_order = $qs[1];
-	$_parent = $qs[2];
+	$_id = intval($qs[0]);
+	$_order = intval($qs[1]);
+	$_parent = intval($qs[2]);
 	$sql->db_Update("user_extended_struct", "user_extended_struct_order=user_extended_struct_order+1 WHERE user_extended_struct_type > 0 AND user_extended_struct_parent = {$_parent} AND user_extended_struct_order ='".($_order-1)."'");
 	$sql->db_Update("user_extended_struct", "user_extended_struct_order=user_extended_struct_order-1 WHERE user_extended_struct_type > 0 AND user_extended_struct_parent = {$_parent} AND user_extended_struct_id='".$_id."'");
 }
@@ -78,9 +93,9 @@
 if (isset($_POST['down_x']))
 {
 	$qs = explode(".", $_POST['id']);
-	$_id = $qs[0];
-	$_order = $qs[1];
-	$_parent = $qs[2];
+	$_id = intval($qs[0]);
+	$_order = intval($qs[1]);
+	$_parent = intval($qs[2]);
 	$sql->db_Update("user_extended_struct", "user_extended_struct_order=user_extended_struct_order-1 WHERE user_extended_struct_type > 0 AND user_extended_struct_parent = {$_parent} AND user_extended_struct_order='".($_order+1)."'");
 	$sql->db_Update("user_extended_struct", "user_extended_struct_order=user_extended_struct_order+1 WHERE user_extended_struct_type > 0 AND user_extended_struct_parent = {$_parent} AND user_extended_struct_id='".$_id."'");
 }
@@ -89,8 +104,8 @@
 if (isset($_POST['catup_x']))
 {
 	$qs = explode(".", $_POST['id']);
-	$_id = $qs[0];
-	$_order = $qs[1];
+	$_id = intval($qs[0]);
+	$_order = intval($qs[1]);
 	$sql->db_Update("user_extended_struct", "user_extended_struct_order=user_extended_struct_order+1 WHERE user_extended_struct_type = 0 AND user_extended_struct_order='".($_order-1)."'");
 	$sql->db_Update("user_extended_struct", "user_extended_struct_order=user_extended_struct_order-1 WHERE user_extended_struct_type = 0 AND user_extended_struct_id='".$_id."'");
 }
@@ -99,8 +114,8 @@
 if (isset($_POST['catdown_x']))
 {
 	$qs = explode(".", $_POST['id']);
-	$_id = $qs[0];
-	$_order = $qs[1];
+	$_id = intval($qs[0]);
+	$_order = intval($qs[1]);
 	$sql->db_Update("user_extended_struct", "user_extended_struct_order=user_extended_struct_order-1 WHERE user_extended_struct_type = 0 AND user_extended_struct_order='".($_order+1)."'");
 	$sql->db_Update("user_extended_struct", "user_extended_struct_order=user_extended_struct_order+1 WHERE user_extended_struct_type = 0 AND user_extended_struct_id='".$_id."'");
 }
@@ -108,8 +123,8 @@
 
 if (isset($_POST['add_field']))
 {
-  $ue_field_name = str_replace(' ','_',trim($_POST['user_field']));		// Replace space with underscore - better security
-  if (preg_match('#^\w+$#',$ue_field_name) === 1)						// Check for allowed characters, finite field length
+  $ue_field_name = str_replace(' ','_',trim($_POST['user_field'])); // Replace space with underscore - better security
+  if (preg_match('#^\w+$#',$ue_field_name) === 1)					// Check for allowed characters, finite field length
   {
 	if($_POST['user_type']==4)
 	{
@@ -141,26 +156,47 @@
 
 if (isset($_POST['update_field']))
 {
-	if($_POST['user_type']==4){
-    	$_POST['user_values'] = array($_POST['table_db'],$_POST['field_id'],$_POST['field_value'],$_POST['field_order']);
+	if (preg_match('#^\w+$#',$_POST['user_field']))
+	{
+		if($_POST['user_type']==4){
+	    	$_POST['user_values'] = array($_POST['table_db'],$_POST['field_id'],$_POST['field_value'],$_POST['field_order']);
+		}
+		$upd_values = make_delimited($_POST['user_values']);
+		$upd_parms = $tp->toDB($_POST['user_include']."^,^".$_POST['user_regex']."^,^".$_POST['user_regexfail']."^,^".$_POST['user_hide']);
+		admin_update($ue->user_extended_modify($sub_action, $_POST['user_field'], $_POST['user_text'], $_POST['user_type'], $upd_parms, $upd_values, $_POST['user_default'], $_POST['user_required'], $_POST['user_read'], $_POST['user_write'], $_POST['user_applicable'], $_POST['user_parent']), 'update', EXTLAN_29);
+	}
+	else
+	{
+		$message = EXTLAN_76." : ".$tp->toHTML($ue_field_name);
 	}
-	$upd_values = make_delimited($_POST['user_values']);
-	$upd_parms = $tp->toDB($_POST['user_include']."^,^".$_POST['user_regex']."^,^".$_POST['user_regexfail']."^,^".$_POST['user_hide']);
-	admin_update($ue->user_extended_modify($sub_action, $_POST['user_field'], $_POST['user_text'], $_POST['user_type'], $upd_parms, $upd_values, $_POST['user_default'], $_POST['user_required'], $_POST['user_read'], $_POST['user_write'], $_POST['user_applicable'], $_POST['user_parent']), 'update', EXTLAN_29);
 }
 
 
 if (isset($_POST['update_category']))
 {
-	$name = trim($tp->toHTML($_POST['user_field']));
-	admin_update($sql->db_Update("user_extended_struct","user_extended_struct_name = '{$name}', user_extended_struct_read = '{$_POST['user_read']}', user_extended_struct_write = '{$_POST['user_write']}', user_extended_struct_applicable = '{$_POST['user_applicable']}' WHERE user_extended_struct_id = '{$sub_action}'"), 'update', EXTLAN_43);
+	if (preg_match('#^\w+$#', $_POST['user_field']) === 1) // Check for allowed characters, finite field length
+  	{
+		$name = trim($tp->toDB($_POST['user_field']));
+		admin_update($sql->db_Update("user_extended_struct","user_extended_struct_name = '{$name}', user_extended_struct_read = '{$_POST['user_read']}', user_extended_struct_write = '{$_POST['user_write']}', user_extended_struct_applicable = '{$_POST['user_applicable']}' WHERE user_extended_struct_id = '{$sub_action}'"), 'update', EXTLAN_43);
+  	}
+  	else
+  	{
+  		$message = EXTLAN_79;
+  	}
 }
 
 
 if (isset($_POST['add_category']))
 {
-	$name = $tp->toHTML($_POST['user_field']);
-	admin_update($sql->db_Insert("user_extended_struct","'0', '$name', '', 0, '', '', '', '{$_POST['user_read']}', '{$_POST['user_write']}', '0', '0', '{$_POST['user_applicable']}', '0', '0'"), 'insert', EXTLAN_40);
+	if (preg_match('#^\w+$#', $_POST['user_field']) === 1) // Check for allowed characters, finite field length
+  	{
+		$name = $tp->toDB($_POST['user_field']);
+		admin_update($sql->db_Insert("user_extended_struct","'0', '$name', '', 0, '', '', '', '{$_POST['user_read']}', '{$_POST['user_write']}', '0', '0', '{$_POST['user_applicable']}', '0', '0'"), 'insert', EXTLAN_40);
+  	}
+  	else
+  	{
+  		$message = EXTLAN_79;
+  	}
 }
 
 
@@ -220,7 +256,8 @@
 	$ns->tablerender("", "<div style='text-align:center'><b>".$message."</b></div>");
 }
 
-if(isset($_POST['table_db']) && !$_POST['add_field'] && !$_POST['update_field']){
+if(isset($_POST['table_db']) && !$_POST['add_field'] && !$_POST['update_field'])
+{
 	$action = "continue";
 	$current['user_extended_struct_name'] = $_POST['user_field'];
     $current['user_extended_struct_parms'] = $_POST['user_include']."^,^".$_POST['user_regex']."^,^".$_POST['user_regexfail']."^,^".$_POST['user_hide'];
@@ -321,6 +358,7 @@
 					<td class='forumheader3'>".r_userclass_name($ext['user_extended_struct_write'])."</td>
 					<td class='forumheader3' style='width:5px'>
 					<form method='post' action='".e_SELF."'>
+					<input type='hidden' name='e-token' value='".e_TOKEN."' />
 					<input type='hidden' name='id' value='{$ext['user_extended_struct_id']}.{$ext['user_extended_struct_order']}.{$ext['user_extended_struct_parent']}' />
 					";
 			  if($i > 0)
@@ -635,7 +673,9 @@
 			";
 
 			$text .= "<tr>
-			<td colspan='4' style='text-align:center' class='forumheader'>";
+			<td colspan='4' style='text-align:center' class='forumheader'>
+			<input type='hidden' name='e-token' value='".e_TOKEN."' />
+			";
 
 //			if ((!is_array($current) || $action == "continue") && $sub_action == "")
 			if ((($mode == 'new') || $action == "continue") && $sub_action == "")
@@ -702,6 +742,7 @@
 				<td class='forumheader3'>
 				<form method='post' action='".e_SELF."?cat'>
 				<input type='hidden' name='id' value='{$ext['user_extended_struct_id']}.{$ext['user_extended_struct_order']}' />
+				<input type='hidden' name='e-token' value='".e_TOKEN."' />
 				";
 				if($i > 0)
 				{
@@ -722,6 +763,7 @@
 				<input type='hidden' name='key' value='{$ext['user_extended_struct_id']},{$ext['user_extended_struct_name']}' />
 				<a style='text-decoration:none' href='".e_SELF."?cat.{$ext['user_extended_struct_id']}'>".ADMIN_EDIT_ICON."</a>
 				<input type='image' title='".LAN_DELETE."' name='eudel' src='".ADMIN_DELETE_ICON_PATH."' />
+				<input type='hidden' name='e-token' value='".e_TOKEN."' />
 				</form>
 				</td>
 				</tr>
@@ -777,7 +819,8 @@
 
 
 		$text .= "<tr>
-		<td colspan='4' style='text-align:center' class='forumheader'>";
+		<td colspan='4' style='text-align:center' class='forumheader'>
+		<input type='hidden' name='e-token' value='".e_TOKEN."' />";
 
 		if (!is_array($current))
 		{
@@ -800,6 +843,58 @@
 		$ns->tablerender(EXTLAN_9, $text);
 	}
 
+	function prepare(&$vars)
+	{
+		if(empty($vars)) return '';
+		$messages = array();
+		// input extra check, user_field is checked outside
+		foreach ($vars as $key => $value)
+		{
+			$value = trim($value);
+			if(empty($value)) continue;
+			switch ($key)
+			{
+				case 'user_include':
+					if(preg_match('/<|&gt;|\(|\)/', $value)) //tags/js not allowed
+					{
+						$vars['user_include'] = '';
+						$messages[] = 'user_include Validation error';
+					}
+				break;
+
+				case 'user_regexfail':
+					if(preg_match('/<|&gt;/', $value)) //tags/js not allowed
+					{
+						$vars['user_regexfail'] = '';
+						$messages[] = 'user_regexfail Validation error';
+					}
+				break;
+
+				case 'user_values':
+					$values = make_delimited($value);
+					if(preg_match('/<|&gt;/', $values)) //tags/js not allowed
+					{
+						$vars['user_values'] = array();
+						$messages[] = 'user_values Validation error';
+					}
+				break;
+
+				case 'table_db':
+				case 'field_id':
+				case 'field_value':
+				case 'field_order':
+					if(!preg_match('/^\w+$/', $value)) //tags/js not allowed
+					{
+						$vars[$key] = '';
+						$messages[] = $key.' Validation error';
+					}
+				break;
+			}
+		}
+
+		return $messages;
+	}
+
 
 	function show_options($action)
 	{
@@ -903,7 +998,10 @@
 
 	$txt .= "
 	<tr>
-	<td class='fcaption' colspan='4'>".EXTLAN_58."</td>
+	<td class='fcaption' colspan='4'>
+		".EXTLAN_58."
+		<input type='hidden' name='e-token' value='".e_TOKEN."' />
+	</td>
 	</tr>
 	";
 	foreach($inactive as $a)
diff -x .svn -aruN 0.7.24.src/e107_admin/users.php 0.7.26.src/e107_admin/users.php
--- 0.7.24.src/e107_admin/users.php	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_admin/users.php	2011-06-28 03:52:44.000000000 -0500
@@ -10,25 +10,25 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $URL: https://e107.svn.sourceforge.net/svnroot/e107/trunk/e107_0.7/e107_admin/users.php $
-|     $Revision: 11797 $
-|     $Id: users.php 11797 2010-09-17 21:58:27Z e107coders $
-|     $Author: e107coders $
+|     $Revision: 12284 $
+|     $Id: users.php 12284 2011-06-28 08:53:08Z secretr $
+|     $Author: secretr $
 +----------------------------------------------------------------------------+
 */
 
 // Experimental e-token
-if(isset($_POST['useraction']) || isset($_POST['adduser']) && !isset($_POST['e-token']))
+if((isset($_POST['useraction']) || isset($_POST['adduser'])) && !isset($_POST['e-token']))
 {
 	// set e-token so it can be processed by class2
-	unset($_POST['e-token']);
+	$_POST['e-token'] = '';
 }
 
 require_once("../class2.php");
 
-if (!getperms("4"))
+if (!getperms('4'))
 {
-  header("location:".e_BASE."index.php");
-  exit;
+	header("location:".e_BASE."index.php");
+	exit;
 }
 
 
@@ -54,6 +54,20 @@
 
 $e_sub_cat = 'users';
 $user = new users;
+$action = '';
+$id = 0;
+$sub_action = '';
+
+if (e_QUERY)
+{
+	$tmp = explode(".", e_QUERY);
+	$action = $tmp[0]; // must be set before auth.php is loaded.
+	$sub_action = varset($tmp[1],'');
+	$id = varset($tmp[2],0);
+	$from = varset($tmp[3],0);
+	unset($tmp);
+}
+
 require_once("auth.php");
 
 require_once(e_HANDLER."form_handler.php");
@@ -61,15 +75,7 @@
 
 $rs = new form;
 
-if (e_QUERY)
-{
-	$tmp = explode(".", e_QUERY);
-	$action = $tmp[0];
-  $sub_action = varset($tmp[1],'');
-  $id = varset($tmp[2],0);
-  $from = varset($tmp[3],0);
-	unset($tmp);
-}
+
 
 $from = varset($from, 0);
 $amount = 30;
@@ -203,29 +209,39 @@
 		message_handler("P_ALERT", USRLAN_92);
 		$error = TRUE;
 	}
+
 	$_POST['name'] = trim(str_replace("&nbsp;", "", $_POST['name']));
 	if ($_POST['name'] == "Anonymous")
 	{
 		message_handler("P_ALERT", USRLAN_65);
 		$error = TRUE;
 	}
-	if ($sql->db_Select("user", "*", "user_name='".$_POST['name']."' "))
+	elseif ($sql->db_Select("user", "*", "user_name='".$_POST['name']."' "))
 	{
 		message_handler("P_ALERT", USRLAN_66);
 		$error = TRUE;
 	}
-	if ($sql->db_Select("user", "user_loginname", "user_loginname='".$_POST['loginname']."' "))
+
+	$loginname = strip_tags($_POST['loginname']);
+	$temp_name = str_replace('--', '', trim(preg_replace("/[\^\*\|\/;:#=\$'\"!#`\s\(\)%\?<>\\{}]/", '', strip_tags($_POST['loginname']))));
+	if ($loginname != $temp_name)
+	{
+		message_handler('P_ALERT', USRLAN_157);
+		$error = TRUE;
+	}
+	elseif ($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 ($loginname == '' || $_POST['name'] == "" || $_POST['password1'] == "" || $_POST['password2'] == "")
 	{
 		message_handler("P_ALERT", USRLAN_68);
 		$error = TRUE;
@@ -258,15 +274,32 @@
 
 	if (!$error)
 	{
-		$username = strip_tags($_POST['name']);
-		$loginname = strip_tags($_POST['loginname']);
+		$username = trim(strip_tags($_POST['name']));
+		$username = $tp->toDB(substr($username, 0, $pref['displayname_maxlength']));
 
-//		extract($_POST);
-//		for($a = 0; $a <= (count($_POST['userclass'])-1); $a++) {
-//			$svar .= $userclass[$a].".";
-//		}
 		$svar = implode(",", $_POST['userclass']);
-		admin_update($sql -> db_Insert("user", "0, '$username', '$loginname',  '', '".md5($_POST['password1'])."', '$key', '".$_POST['email']."', '".$_POST['signature']."', '".$_POST['image']."', '".$_POST['timezone']."', '1', '".time()."', '".time()."', '".time()."', '0', '0', '0', '0', '0', '0', '0', '', '', '0', '0', '".$_POST['realname']."', '".$svar."', '', '', '".time()."', ''"), 'insert', USRLAN_70);
+		$now = time();
+		$newUserData = array(
+			'user_name' => $username,
+			'user_loginname' => $loginname,
+			'user_password' => md5($_POST['password1']),
+			//'user_sess' => $key,
+			'user_email' => $_POST['email'],
+			'user_signature' => '',
+			'user_hideemail' => 1,
+			'user_join' => $now,
+			'user_lastvisit' => $now,
+			'user_currentvisit' => $now,
+			'user_prefs' => '',
+			'user_new' => '',
+			'user_viewed' => '',
+			//'user_login' => $_POST['realname'],
+			'user_class' => $svar,
+			'user_perms' => '',
+			'user_realm' => '',
+			'user_pwchange' => $now
+		);
+		admin_update($sql -> db_Insert("user", $newUserData), 'insert', USRLAN_70);
 	}
 }
 
@@ -307,8 +340,8 @@
 		}
 		else
 		{
-			if($sql->db_Count("user", "(*)", "WHERE user_ip = '{$row['user_ip']}'") > 1)
-		  {	// Multiple users have same IP address
+			if($sql->db_Count('user', '(*)', "WHERE user_ip = '{$row['user_ip']}' AND user_ban=0 AND user_id <> {$_POST['userid']}") > 0)
+			{	// Other unbanned users have same IP address
 				$user->show_message(str_replace("{IP}", $row['user_ip'], USRLAN_136));
 			}
 			else
@@ -378,11 +411,11 @@
 }
 
 // ------- Delete User --------------
-if (isset($_POST['useraction']) && $_POST['useraction'] == 'deluser') 
+if (isset($_POST['useraction']) && $_POST['useraction'] == 'deluser')
 {
-	if ($_POST['confirm']) 
+	if ($_POST['confirm'])
 	{
-		if ($sql->db_Delete("user", "user_id='".$_POST['userid']."' AND user_perms != '0' AND user_perms != '0.'")) 
+		if ($sql->db_Delete("user", "user_id='".$_POST['userid']."' AND user_perms != '0' AND user_perms != '0.'"))
 		{
 		   $sql->db_Delete("user_extended", "user_extended_id='".$_POST['userid']."' ");
 		   $e_event->trigger('userdel', intval($_POST['userid']));
@@ -393,7 +426,7 @@
 	}
 	else
 	{	// Put up confirmation
-		if ($sql->db_Select("user", "*", "user_id='".$_POST['userid']."' ")) 
+		if ($sql->db_Select("user", "*", "user_id='".$_POST['userid']."' "))
 		{
 			$row = $sql->db_Fetch();
 			$qry = (e_QUERY) ? "?".e_QUERY : "";
@@ -862,7 +895,7 @@
 		{
 			if($m == 0)
 			{
-				$text .= "<tr>";	
+				$text .= "<tr>";
 			}
 			$checked = (in_array($fcol,$search_display)) ? "checked='checked'" : "";
 			$text .= "<td style='text-align:left; padding:0px'>";
@@ -1043,8 +1076,10 @@
 		$ns->tablerender(USRLAN_55, $text);
 	}
 
-	function add_user() {
-		global $rs, $ns, $pref;
+	function add_user()
+	{
+		global $rs, $ns, $pref,$tp;
+
 		$text = "<div style='text-align:center'>". $rs->form_open("post", e_SELF.'?create', "adduserform")."
 			<table style='".ADMIN_WIDTH."' class='fborder'>
 			<tr>
@@ -1081,24 +1116,27 @@
 			</tr>";
 
 
-		if (!is_object($sql)) $sql = new db;
-		if ($sql->db_Select("userclass_classes")) {
+		$ucSql = new db;
+		if ($ucSql->db_Select("userclass_classes"))
+		{
 			$text .= "<tr style='vertical-align:top'>
-				<td colspan='2' style='text-align:center' class='forumheader'>
+				<td colspan='2' style='text-align:center' class='forumheader2'>
 				".USRLAN_120."
 				</td>
 				</tr>";
 			$c = 0;
-			while ($row = $sql->db_Fetch()) {
+			while ($row = $ucSql->db_Fetch())
+			{
 				$class[$c][0] = $row['userclass_id'];
 				$class[$c][1] = $row['userclass_name'];
 				$class[$c][2] = $row['userclass_description'];
 				$c++;
 			}
-			for($a = 0; $a <= (count($class)-1); $a++) {
-				$text .= "<tr><td style='width:30%' class='forumheader'>
-					<input type='checkbox' name='userclass[]' value='".$class[$a][0]."' />".$class[$a][1]."
-					</td><td style='width:70%' class='forumheader3'> ".$class[$a][2]."</td></tr>";
+			for($a = 0; $a <= (count($class)-1); $a++)
+			{
+				$text .= "<tr><td style='width:30%' class='forumheader3'>
+					<input type='checkbox' name='userclass[]' value='".$class[$a][0]."' />".$tp->toHtml($class[$a][1],FALSE,'defs')."
+					</td><td style='width:70%' class='forumheader3'> ".$tp->toHtml($class[$a][2],FALSE,'defs')."</td></tr>";
 			}
 		}
 		$text .= "
diff -x .svn -aruN 0.7.24.src/e107_admin/ver.php 0.7.26.src/e107_admin/ver.php
--- 0.7.24.src/e107_admin/ver.php	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_admin/ver.php	2011-09-14 00:38:53.000000000 -0500
@@ -1,13 +1,13 @@
 <?php
 /*
-* Copyright (c) 2010 e107 Inc e107.org, Licensed under GNU GPL (http://www.gnu.org/licenses/gpl.txt)
+* Copyright (c) 2011 e107 Inc e107.org, Licensed under GNU GPL (http://www.gnu.org/licenses/gpl.txt)
 * $URL: https://e107.svn.sourceforge.net/svnroot/e107/trunk/e107_0.7/e107_admin/ver.php $
-* $Id: ver.php 11811 2010-09-22 21:21:50Z e107coders $
+* $Id: ver.php 12349 2011-09-14 05:39:17Z e107coders $
 *
 * Version file
 */
 
 if (!defined('e107_INIT')) { exit; }
 
-$e107info['e107_version'] = "0.7.24";
+$e107info['e107_version'] = "0.7.26";
 ?>
diff -x .svn -aruN 0.7.24.src/e107_admin/wmessage.php 0.7.26.src/e107_admin/wmessage.php
--- 0.7.24.src/e107_admin/wmessage.php	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_admin/wmessage.php	2010-10-09 06:50:45.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $URL: https://e107.svn.sourceforge.net/svnroot/e107/trunk/e107_0.7/e107_admin/wmessage.php $
-|     $Revision: 11759 $
-|     $Id: wmessage.php 11759 2010-09-07 13:00:58Z e107steved $
-|     $Author: e107steved $
+|     $Revision: 11868 $
+|     $Id: wmessage.php 11868 2010-10-09 11:51:09Z e107coders $
+|     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
 
@@ -37,6 +37,18 @@
 $pst->form = "wmform";
 $pst->page = "wmessage.php?create";
 $pst->id = "admin_wmessage";
+
+$action = '';
+if (e_QUERY) 
+{
+	$tmp = explode('.', e_QUERY);
+	$action = $tmp[0]; // must be set before auth.php is loaded. 
+	$sub_action = varset($tmp[1], '');
+	$id = intval(varset($tmp[2], 0));
+	unset($tmp);
+}
+
+
 require_once("auth.php");
 $pst->save_preset();  // save and render result
 
@@ -46,15 +58,7 @@
 
 $rs = new form;
 
-$action = '';
-if (e_QUERY) 
-{
-	$tmp = explode('.', e_QUERY);
-	$action = $tmp[0];
-	$sub_action = varset($tmp[1], '');
-	$id = varset($tmp[2], 0);
-	unset($tmp);
-}
+
 
 if($_POST)
 {
diff -x .svn -aruN 0.7.24.src/e107_files/bbcode/bb_youtube.php 0.7.26.src/e107_files/bbcode/bb_youtube.php
--- 0.7.24.src/e107_files/bbcode/bb_youtube.php	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_files/bbcode/bb_youtube.php	2010-12-17 09:58:12.000000000 -0600
@@ -22,9 +22,14 @@
 /**
  *	Youtube handling
  *
- * [youtube=tiny|small|medium|big|huge or width,height|nofull&norel&border&privacy&hd]ID[/youtube]
+ * [youtube=tiny|small|medium|large|huge or width,height]ID{&query options}[/youtube]
+ * 
+ * examples: 
+ * [youtube=560,340]N2wivHYCRho?hd=1&color1=&color2=&cc_load_policy=0&autoplay=0[/youtube]
+ * [youtube=big|privacy]N2wivHYCRho?hd=1&hl=en[/youtube]
+ * 
+ * Will also convert Youtube embed code, and youtube 'watch' urls. (http://www.youtube.com/watch?v=)
  * Youtube ID is the only required data!
- * TODO - more: http://code.google.com/apis/youtube/player_parameters.html
  * TODO - use swfobject JS - XHTML validation
  */
 
@@ -51,13 +56,24 @@
 		$bbpars = array();
 		$widthString = '';
 		$parm = trim($parm);
+		
+		// Convert Simple URLs. 
+		if(strpos($code_text,"youtube.com/watch?v=")!==FALSE || strpos($code_text,"youtube.com/watch#!v=")!==FALSE )
+		{
+			$validUrls = array("http://","www.","youtube.com/watch?v=","youtube.com/watch#!v=");
+			$tmp = str_replace($validUrls,'',$code_text);
+			$qrs = explode("&",$tmp);		
+			$code_text = $qrs[0];
+			unset($qrs);		
+		}
+			
 		if ($parm)
 		{
 			if (strpos($parm, '|') !== FALSE)
 			{
 				list($widthString, $parm) = explode('|', $parm);
 			}
-			elseif (in_array($parm, array('tiny', 'small', 'medium', 'big', 'huge')) || (strpos($parm, ',') !== FALSE))
+			elseif (in_array($parm, array('tiny', 'small', 'medium','large', 'big', 'huge')) || (strpos($parm, ',') !== FALSE))
 			{	// Assume we're just setting a width
 				$widthString = $parm;
 				$parm = '';
@@ -67,6 +83,13 @@
 				$bbpars = explode('&', $parm);
 			}
 		}
+		
+		/*
+		echo '<br />Parm= '.$parm;
+		echo "<br />COde= ".htmlspecialchars($code_text);
+		echo "<br />Width= ".$widthString;
+		*/
+		
 		$params = array();										// Accumulator for parameters from youtube code
 		$ok = 0;
 		if (strpos($code_text, '<') === FALSE)
@@ -116,21 +139,48 @@
 			list($url, $query) = explode('?', $target['src']);
 			if (strpos($url, 'youtube-nocookie.com') !== FALSE)
 			{
-				$params[] = 'privacy';
+				$bb_params[] = 'privacy';
 			}
+			
 			parse_str($query, $vals);		// Various options set here
+												
 			if (varset($vals['allowfullscreen'], 'true') != 'true')
 			{
-				$params[] = 'nofull';
+				$params[] = 'fs=0';
 			}
 			if (varset($vals['border'], 0) != 0)
 			{
-				$params[] = 'border';
+				$params[] = 'border=1';
+			}
+			if (varset($vals['rel'], 1) != 1)
+			{
+				$params[] = 'rel='.intval($vals['rel']);
+			}
+			if (varset($vals['hd'], 1) != 0)
+			{
+				$params[] = 'hd='.intval($vals['hd']);
+			}
+			if (varset($vals['hl'], 1) != 0)
+			{
+				$params[] = 'hl='.$vals['hl'];
+			}
+			if (varset($vals['color1'], 1) != 0)
+			{
+				$params[] = 'color1='.$vals['color1'];
 			}
-			if (varset($vals['rel'], 1) == 0)
+			if (varset($vals['color2'], 1) != 0)
 			{
-				$params[] = 'norel';
+				$params[] = 'color2='.$vals['color2'];
 			}
+			if (varset($vals['cc_load_policy'], 1) != 0)
+			{
+				$params[] = 'cc_load_policy='.intval($vals['cc_load_policy']);
+			}
+			if (ADMIN && varset($vals['autoplay'], 1) != 0)
+			{
+				$params[] = 'autoplay='.intval($vals['autoplay']);
+			}
+
 			$picRef = substr($url, strrpos($url, '/') + 1);
 		}
 
@@ -139,11 +189,19 @@
 		if (($yID != $picRef) || (strlen($yID) > 20))
 		{	// Possible hack attempt
 		}
-		$params = array_merge($params, $bbpars);			// Any parameters set in bbcode override those in HTML
+	//	$params = array_merge($params, $bbpars);			// Any parameters set in bbcode override those in HTML
 		// Could check for valid array indices here
 		$paramString = implode('&', $params);
-		if ($paramString) $widthString .= '|'.$paramString;
-		$ans = '[youtube='.$widthString.']'.$picRef.'[/youtube]';
+		if ($paramString) $picRef .= '?'.$paramString;
+		if($widthString)
+		{
+			$widthString = "=".$widthString;
+			if(count($bbpars))
+			{
+				$widthString .= "|".implode("&",$bbpars);
+			}
+		}
+		$ans = '[youtube'.$widthString.']'.$picRef.'[/youtube]';
 		return $ans;
 	}
 
@@ -156,79 +214,153 @@
 	{
 		if(empty($code_text)) return '';
 
-		$parms = explode('|', $parm, 2);
+		list($dimensions,$tmp) = explode('|', $parm, 2);
+		
+		if($tmp)
+		{
+			parse_str(varset($tmp, ''), $bbparm);
+		}
+		
+		if(strpos($code_text,"&")!==FALSE && strpos($code_text,"?")===FALSE) // DEPRECATED
+		{
+			$parms = explode('&', $code_text, 2);	
+		}
+		else
+		{
+			$parms = explode('?', $code_text, 2);	// CORRECT SEPARATOR
+		}
+		
+
+		$code_text = $parms[0];
+			
 		parse_str(varset($parms[1], ''), $params);
+		
+	//	print_a($params);
 
-		if(empty($parms[0])) $parms[0] = 'small';
+		if(empty($dimensions)) $dimensions = 'medium'; // (default as per YouTube spec)
+		// formula: width x (height+25px)
 
-		switch ($parms[0]) 
+		switch ($dimensions) 
 		{
 			case 'tiny':
-				$params['w'] = 200;
-				$params['h'] = 180;
+				$params['w'] = 320; // 200;
+				$params['h'] = 205; // 180;
 			break;
 			
 			case 'small':
-				$params['w'] = 445;
-				$params['h'] = 364;
+				$params['w'] = 560; // 445;
+				$params['h'] = 340; // 364;
 			break;
 			
 			case 'medium':
-				$params['w'] = 500;
-				$params['h'] = 405;
+				$params['w'] = 640; // 500;
+				$params['h'] = 385; // 405;
 			break;
 			
 			case 'big':
-				$params['w'] = 660;
-				$params['h'] = 525;
+			case 'large':
+				$params['w'] = 853; // 660;
+				$params['h'] = 505; // 525;
 			break;
 			
 			case 'huge':
-				$params['w'] = 980;
-				$params['h'] = 765;
+				$params['w'] = 1280; // 980;
+				$params['h'] = 745; // 765;
 			break;
 			
-			default:
-				$dim = explode(',', $parms[0], 2);
+			default: // maximum 1920 x 1080 (+25)
+				$dim = explode(',', $dimensions, 2);
 				$params['w'] = (integer) varset($dim[0], 445);
-				if($params['w'] > 980 || $params['w'] < 200) $params['w'] = 445;
+				if($params['w'] > 1920 || $params['w'] < 200) $params['w'] = 640;
 				
 				$params['h'] = (integer) varset($dim[1], 364);
-				if($params['h'] > 765 || $params['h'] < 180) $params['h'] = 364;
+				if($params['h'] > 1105 || $params['h'] < 137) $params['h'] = 385;
 			break;
 		}
+	
+	
+		$yID = preg_replace('/[^0-9a-z\-_\&\?]/i', '', $code_text);
 
-		$yID = preg_replace('/[^0-9a-z\-_\&]/i', '', $code_text);
-
-		$url = isset($params['privacy']) ? 'http://www.youtube-nocookie.com/v/' : 'http://www.youtube.com/v/';
+		$url = isset($bbparm['privacy']) ? 'http://www.youtube-nocookie.com/v/' : 'http://www.youtube.com/v/';
 		$url .= $yID.'?';
 
-		if(isset($params['nofull'])) 
+		if(isset($params['nofull']) || !varset($params['fs'])) 
 		{
 			$fscr = 'false';
-			$url = $url.'fs=0';
+			$url = $url.'fs='.intval($params['fs']);
 		} 
 		else 
 		{
 			$fscr = 'true';
 			$url = $url.'fs=1';
 		}
-		if(isset($params['border'])) $url = $url.'&amp;border=1';
-		if(isset($params['norel'])) $url = $url.'&amp;rel=0';
-		if(isset($params['hd'])) $url = $url.'&amp;hd=1';
+		
 
-		$ret = ' 
-		<object width="'.$params['w'].'" height="'.$params['h'].'">
+		
+		if(isset($params['border'])) $url = $url.'&amp;border='.intval($params['border']);
+		if(isset($params['norel'])) // BC non-standard val. 
+		{
+			$url = $url.'&amp;rel=0';	
+		} 
+		elseif(isset($params['rel']))
+		{
+			$url = $url.'&amp;rel='.intval($params['rel']);	
+		}
+		
+		if(isset($params['hd'])) $url = $url.'&amp;hd='.intval($params['hd']);
+		
+		$hl = 'en_US';
+		
+		if(isset($params['hl']))
+		{
+			$params['hl'] = preg_replace('/[^0-9a-z\-_]/i', '', $params['hl']);
+			if(strlen($params['hl']) == 2 || strlen($params['hl']) == 5)
+			{
+				$hl = $params['hl'];
+			}
+		}
+		
+		$url = $url.'&amp;hl='.$hl;
+		$color = array();
+		if(isset($params['color1'])) $color[1] = $params['color1'];
+		if(isset($params['color2'])) $color[2] = $params['color2'];
+		foreach ($color as $key => $value)
+		{
+			if (ctype_xdigit($value) && strlen($value) == 6)
+			{
+				$url = $url.'&amp;color'.$key.'='.$value;
+			}
+		}
+		
+		if(isset($params['cc_load_policy']))
+		{
+			$url .= "&amp;cc_load_policy=".intval($params['cc_load_policy']);
+		}
+		
+		if(isset($params['autoplay']))
+		{
+			$url .= "&amp;autoplay=".intval($params['autoplay']);
+		}
+		
+		$ret = '
+		
+<!-- Start YouTube --> 
+		
+		<object width="'.$params['w'].'" height="'.$params['h'].'" >
 			<param name="movie" value="'.$url.'"></param>
 			<param name="allowFullScreen" value="'.$fscr.'"></param>
 			<param name="allowscriptaccess" value="always"></param>
 			<param name="wmode" value="transparent"></param>
-			<embed src="'.$url.'" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="'.$fscr.'" wmode="transparent" width="'.$params['w'].'" height="'.$params['h'].'"></embed>
-		</object>
-		';
+		';		
+	// Not XHTML - but needed for compatibility. 
+		$ret .= '<embed src="'.$url.'" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="'.$fscr.'" wmode="transparent" width="'.$params['w'].'" height="'.$params['h'].'"></embed>';
+		$ret .= '</object>';
+		$ret .= '
+<!-- End YouTube -->
 
+';
 		return $ret;
 	}
 }
 
-?>
+?>
\ No newline at end of file
diff -x .svn -aruN 0.7.24.src/e107_files/bbcode/php.bb 0.7.26.src/e107_files/bbcode/php.bb
--- 0.7.24.src/e107_files/bbcode/php.bb	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_files/bbcode/php.bb	2011-06-28 23:20:43.000000000 -0500
@@ -1,8 +1,8 @@
-global $pref;
-if($pref['php_bbcode'] == e_UC_NOBODY) return '';
-
-if($sep != '' || $parm != '') { return $full_text; }
-$search = array("&quot;", "&#039;", "&#036;", '<br />', E_NL, "-&gt;");
-$replace = array('"', "'", "$", "\n", "\n", "->");
-$code_text = str_replace($search, $replace, $code_text);
-return eval($code_text);
+//<?php
+/*
+ * This bbcode has been removed for increased security within e107. 
+ * If you know PHP, it is recommended that instead of using a php bbcode, you write your own bbcode, shortcode or .php script.
+ * For more details, please see the documentation (wiki) at www.e107.org
+ * 
+ */
+return "No Longer Supported";
diff -x .svn -aruN 0.7.24.src/e107_files/def_e107_prefs.php 0.7.26.src/e107_files/def_e107_prefs.php
--- 0.7.24.src/e107_files/def_e107_prefs.php	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_files/def_e107_prefs.php	2010-12-18 16:54:58.000000000 -0600
@@ -11,8 +11,8 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $URL: https://e107.svn.sourceforge.net/svnroot/e107/trunk/e107_0.7/e107_files/def_e107_prefs.php $
-|     $Revision: 11681 $
-|     $Id: def_e107_prefs.php 11681 2010-08-22 21:26:21Z e107steved $
+|     $Revision: 12013 $
+|     $Id: def_e107_prefs.php 12013 2010-12-18 22:55:22Z e107steved $
 |     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
@@ -146,6 +146,7 @@
   'post_html' => '250',
   'post_script' => '250',
   'filter_script' => '1',
+  'html_abuse' => '1',
   'redirectsiteurl' => '0',
   'admin_alerts_uniquemenu' => '0',
   'null' => '',
diff -x .svn -aruN 0.7.24.src/e107_files/e107.js 0.7.26.src/e107_files/e107.js
--- 0.7.24.src/e107_files/e107.js	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_files/e107.js	2011-09-02 08:19:40.000000000 -0500
@@ -1,17 +1,16 @@
 <!--
-
 /*
 + ----------------------------------------------------------------------------+
 |	e107 website system - Javascript File.
 |
 |	$URL: https://e107.svn.sourceforge.net/svnroot/e107/trunk/e107_0.7/e107_files/e107.js $
-|	$Revision: 11678 $
-|	$Id: e107.js 11678 2010-08-22 00:43:45Z e107coders $
+|	$Revision: 12346 $
+|	$Id: e107.js 12346 2011-09-02 13:20:04Z secretr $
 +----------------------------------------------------------------------------+
 */
 
 /*
- * NOTE: KEEP THIS AT THE TOP OF E107.JS!
+ * NOTE: KEEP THIS AT THE TOP OF E107.JS !!
  * localTime is recorded ASAP after page load; SyncWithServerTime is called at the END
  * of page processing. We want localTime and serverTime set in close chronological order.
  * Page Processing order is as follows:
@@ -59,10 +58,10 @@
 	if(document.getElementById(curobj)) {
   		folder=document.getElementById(curobj).style;
 	} else {
-		if(ns6==1||operaaa==true) {
-			folder=curobj.nextSibling.nextSibling.style;
+		if(ns6==1||operaaa==true || typeof curobj['nextSibling'] != 'undefined' ) {
+			folder= typeof curobj.nextSibling.tagName != 'undefined' ? curobj.nextSibling.style : curobj.nextSibling.nextSibling.style;
 		} else {
-			folder=document.all[curobj.sourceIndex+1].style;
+			folder=document.all[curobj.sourceIndex+1].style; 
 		}
    }
 	if(folder.display=="none")
@@ -236,7 +235,7 @@
 	if (!window.e107_selectedInputArea) {
 		return; //[SecretR] TODO - alert the user 
 	}
-		
+
 	var eField = e107_selectedInputArea;	
 	var eSelection 	= false;  
 	var tagOpen = '';
@@ -257,6 +256,7 @@
 
 	// Windows user  
 	if (document.selection) {
+	
 		eSelection = document.selection.createRange().text;
 		eField.focus();
 		if (eSelection) {
@@ -277,9 +277,11 @@
 	var selLength = eField.textLength;
 	var selStart = eField.selectionStart;
 	var selEnd = eField.selectionEnd; 
-	if (selEnd <= 2 && typeof(selLength) != 'undefined') {
+	
+	if (selEnd <= 2 && typeof(selLength) != 'undefined' && (selStart != selEnd)) {
 		selEnd = selLength;
 	}
+	
 	var sel1 = (eField.value).substring(0,selStart);
 	var sel2 = (eField.value).substring(selStart, selEnd);
 	var sel3 = (eField.value).substring(selEnd, selLength);
diff -x .svn -aruN 0.7.24.src/e107_files/popup.js 0.7.26.src/e107_files/popup.js
--- 0.7.24.src/e107_files/popup.js	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_files/popup.js	2011-07-07 16:57:52.000000000 -0500
@@ -1,6 +1,6 @@
 window.defaultStatus = "";
 
-//get reference object for popup
+//get reference object for popup!
 function getRefToDivMod( divID, oDoc ) {
 	if( !oDoc ) { oDoc = document; }
 	if( document.layers ) {
diff -x .svn -aruN 0.7.24.src/e107_files/shortcode/admin_help.sc 0.7.26.src/e107_files/shortcode/admin_help.sc
--- 0.7.24.src/e107_files/shortcode/admin_help.sc	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_files/shortcode/admin_help.sc	2010-09-30 16:42:46.000000000 -0500
@@ -1,3 +1,5 @@
+/* $Id: admin_help.sc 11836 2010-09-30 21:43:10Z e107coders $ */
+//<?
 if (!ADMIN) return '';
 
   $helpfile = '';
diff -x .svn -aruN 0.7.24.src/e107_files/shortcode/admin_lang.sc 0.7.26.src/e107_files/shortcode/admin_lang.sc
--- 0.7.24.src/e107_files/shortcode/admin_lang.sc	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_files/shortcode/admin_lang.sc	2010-10-04 02:38:25.000000000 -0500
@@ -1,4 +1,4 @@
-/* $Id: admin_lang.sc 11771 2010-09-09 21:34:57Z e107coders $ */
+/* $Id: admin_lang.sc 11841 2010-10-04 07:38:49Z e107coders $ */
 //<?
 if(ADMIN)
 {
@@ -19,16 +19,16 @@
 		if(!getperms($sql->mySQLlanguage) && $lanperms)
 		{
 			$sql->mySQLlanguage = ($lanperms[0] != $pref['sitelanguage']) ? $lanperms[0] : "";
-			if(defset('MULTILANG_SUBDOMAIN')==TRUE)
+			if(defset('MULTILANG_SUBDOMAIN')==TRUE && !in_array(e_LANGUAGE,$lanperms))
 			{
 				$_SESSION['e_language'] = $lanperms[0];
 				header("Location:".$lng->subdomainUrl($lanperms[0]));
 			}
 			else
 			{
-				$_SESSION['e_language'] = $lanperms[0];
-				setcookie('e107_language', $lanperms[0], time() + 86400, '/');
-				$_COOKIE['e107_language'] = $lanperms[0];
+			//	$_SESSION['e_language'] = $lanperms[0];
+			//	setcookie('e107_language', $lanperms[0], time() + 86400, '/');
+			//	$_COOKIE['e107_language'] = $lanperms[0];
 			}
 		}
 		
@@ -94,11 +94,12 @@
 			$text .= "</select>
 			<br /><br />
 	   		<input class='button' type='submit' name='setlanguage' value='".UTHEME_MENU_L1."' />
+			<input type='hidden' name='e-token' value='".e_TOKEN."' /> 
 			</div>
 				</form>
 			</div>";
 		}
 		
-		return $ns->tablerender(UTHEME_MENU_L2, $text, '', TRUE);
+		return $ns->tablerender(UTHEME_MENU_L2, $text, 'admin_lang', TRUE);
 	}
 }
diff -x .svn -aruN 0.7.24.src/e107_files/shortcode/admin_latest.sc 0.7.26.src/e107_files/shortcode/admin_latest.sc
--- 0.7.24.src/e107_files/shortcode/admin_latest.sc	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_files/shortcode/admin_latest.sc	2010-09-30 16:42:46.000000000 -0500
@@ -1,4 +1,5 @@
-// $Id: admin_latest.sc 11711 2010-08-27 13:06:38Z e107steved $
+// $Id: admin_latest.sc 11836 2010-09-30 21:43:10Z e107coders $
+//<?
 if (ADMIN) 
 {
 	if (!function_exists('admin_latest')) 
@@ -36,7 +37,7 @@
 				$text .= "<br /><b><a href='".e_ADMIN_ABS."message.php'>".ADLAN_LAT_8." [".$amount."]</a></b>";
 			}
 
-			return $ns -> tablerender(ADLAN_LAT_1, $text, '', TRUE);
+			return $ns -> tablerender(ADLAN_LAT_1, $text, 'admin_latest', TRUE);
 		}
 	}
 
diff -x .svn -aruN 0.7.24.src/e107_files/shortcode/admin_preset.sc 0.7.26.src/e107_files/shortcode/admin_preset.sc
--- 0.7.24.src/e107_files/shortcode/admin_preset.sc	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_files/shortcode/admin_preset.sc	2010-09-30 16:42:46.000000000 -0500
@@ -1,3 +1,5 @@
+// $Id: admin_preset.sc 11836 2010-09-30 21:43:10Z e107coders $
+//<?
 if(ADMIN && getperms("0"))
 {
 	global $sql,$pst,$ns,$tp,$e_wysiwyg,$pref;
@@ -33,7 +35,7 @@
 				<input type='submit' class='button' name='delete_preset' value='".LAN_DELETE."' onclick=\"return jsconfirm('".$tp->toJS(LAN_PRESET_CONFIRMDEL." [".$existing."]")."')\" />";
 			}
 			$pst_text .= "</div></form>";
-			return $ns -> tablerender(LAN_PRESET, $pst_text, '', TRUE);
+			return $ns -> tablerender(LAN_PRESET, $pst_text, 'admin_preset', TRUE);
 		}
 	}
 }
\ No newline at end of file
diff -x .svn -aruN 0.7.24.src/e107_files/shortcode/admin_pword.sc 0.7.26.src/e107_files/shortcode/admin_pword.sc
--- 0.7.24.src/e107_files/shortcode/admin_pword.sc	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_files/shortcode/admin_pword.sc	2010-09-30 16:42:46.000000000 -0500
@@ -1,7 +1,9 @@
+// $Id: admin_pword.sc 11836 2010-09-30 21:43:10Z e107coders $
+// <?
 if (ADMIN && ADMINPERMS == "0") {
 	global $ns;
 	if ($pref['adminpwordchange'] && ((ADMINPWCHANGE+2592000) < time())) {
 		$text = "<div style='mediumtext; text-align:center'>".ADLAN_102." <a href='".e_ADMIN_ABS."updateadmin.php'>".ADLAN_103."</a></div>";
-		return $ns -> tablerender(ADLAN_104, $text, '', TRUE);
+		return $ns -> tablerender(ADLAN_104, $text, 'admin_pword', TRUE);
 	}
 }
diff -x .svn -aruN 0.7.24.src/e107_files/shortcode/admin_sel_lan.sc 0.7.26.src/e107_files/shortcode/admin_sel_lan.sc
--- 0.7.24.src/e107_files/shortcode/admin_sel_lan.sc	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_files/shortcode/admin_sel_lan.sc	2010-09-30 16:42:46.000000000 -0500
@@ -1,4 +1,5 @@
-//<? $Id: admin_sel_lan.sc 11346 2010-02-17 18:56:14Z secretr $
+// $Id: admin_sel_lan.sc 11836 2010-09-30 21:43:10Z e107coders $
+//<? 
 if (ADMIN && $pref['multilanguage'])
 {
 	$language = ($pref['sitelanguage'] == e_LANGUAGE) ? ADLAN_133 : e_LANGUAGE;
diff -x .svn -aruN 0.7.24.src/e107_files/shortcode/admin_siteinfo.sc 0.7.26.src/e107_files/shortcode/admin_siteinfo.sc
--- 0.7.24.src/e107_files/shortcode/admin_siteinfo.sc	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_files/shortcode/admin_siteinfo.sc	2011-01-30 13:22:23.000000000 -0600
@@ -1,3 +1,5 @@
+// $Id: admin_siteinfo.sc 12060 2011-01-30 19:22:47Z secretr $
+//<?
 if (ADMIN) 
 {
 	global $ns, $pref, $themename, $themeversion, $themeauthor, $themedate, $themeinfo, $mySQLdefaultdb;
@@ -6,6 +8,14 @@
 	{ 
 		include(e_ADMIN."ver.php"); 
 	}
+	
+	if($parm == "version")
+	{
+		return $e107info['e107_version'];
+	}
+	
+	
+	
 
 	$obj = new convert;
 	$install_date = $obj->convert_date($pref['install_date'], "long");
@@ -23,6 +33,10 @@
 	<br />
 	".FOOTLAN_3." ".$e107info['e107_version']."
 	<br /><br />
+	<b>".FOOTLAN_20."</b>
+	<br />
+	[".e_SECURITY_LEVEL."] ".defset('LAN_SECURITYL_'.e_SECURITY_LEVEL, 'n/a')." 
+	<br /><br />
 	<b>".FOOTLAN_18."</b>
 	<br />".$pref['sitetheme']."<br /><br />
 	<b>".FOOTLAN_5."</b>
@@ -56,5 +70,5 @@
 	<br /><br />
 	<b>".FOOTLAN_17."</b>
 	<br />".CHARSET;
-	return $ns -> tablerender(FOOTLAN_13, $text, '', TRUE);
+	return $ns -> tablerender(FOOTLAN_13, $text, 'admin_siteinfo', TRUE);
 }
\ No newline at end of file
diff -x .svn -aruN 0.7.24.src/e107_files/shortcode/admin_status.sc 0.7.26.src/e107_files/shortcode/admin_status.sc
--- 0.7.24.src/e107_files/shortcode/admin_status.sc	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_files/shortcode/admin_status.sc	2010-09-30 16:42:46.000000000 -0500
@@ -1,4 +1,5 @@
-// $Id: admin_status.sc 11711 2010-08-27 13:06:38Z e107steved $
+// $Id: admin_status.sc 11836 2010-09-30 21:43:10Z e107coders $
+//<?
 if (getperms('0') || getperms('4')) 
 {
 	if (!function_exists('admin_status')) 
@@ -34,7 +35,7 @@
 				$text .= "<img src='".e_IMAGE_ABS."admin_images/failedlogin_16.png' alt='' style='vertical-align: middle;' /> <a href='".e_ADMIN_ABS."fla.php'>".ADLAN_146.": $flo</a>";
 			}
 
-			return $ns -> tablerender(ADLAN_134, $text, '', TRUE);
+			return $ns -> tablerender(ADLAN_134, $text, 'admin_status', TRUE);
 		}
 	}
 
diff -x .svn -aruN 0.7.24.src/e107_files/shortcode/admin_update.sc 0.7.26.src/e107_files/shortcode/admin_update.sc
--- 0.7.24.src/e107_files/shortcode/admin_update.sc	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_files/shortcode/admin_update.sc	2011-04-13 14:45:07.000000000 -0500
@@ -1,4 +1,4 @@
-// $Id: admin_update.sc 11796 2010-09-17 21:30:53Z e107coders $
+// $Id: admin_update.sc 12135 2011-04-13 19:45:31Z e107steved $
 //<?
 
 	if (!ADMIN) return "";
@@ -7,6 +7,16 @@
 	
   	if (!varset($pref['check_updates'], FALSE)) return "";
 	
+	if($parm == "adminpanel" && (strpos(e_SELF,e_ADMIN_ABS."admin.php")===FALSE))
+	{ 
+		return;
+	}
+	if(($parm == "notadminpanel") && (strpos(e_SELF,e_ADMIN_ABS."admin.php")!==FALSE))
+	{
+		return;
+	}
+	
+	
 	if (is_readable(e_ADMIN."ver.php"))
 	{
 		include(e_ADMIN."ver.php");
@@ -20,7 +30,9 @@
 	
     if($cacheData)
     {
-   	  	return ($cacheData !='up-to-date') ? $ns -> tablerender(LAN_NEWVERSION, $cacheData) : "";
+		if ($cacheData == 'up-to-date') return '';
+		$tmp = explode('|', $cacheData);
+   	  	return $ns -> tablerender($tmp[0], $tmp[1],'admin_update');
     }
 	
 	// Keep commented out to be sure it continues to work under all circumstances.
@@ -32,7 +44,7 @@
 	$xml = new parseXml;
 	$xm = new XMLParse();
 	
-    $ftext = "";
+    $ftext = '';
 	
 	if($rawData = $xml -> getRemoteXmlFile($feed,5))
 	{	
@@ -62,20 +74,22 @@
 				break;
 			}
 		}
+		$caption = LAN_NEWVERSION;
 	}
 	else // Error getting data
-	{  
-	  $ftext = ADLAN_154;
+	{
+		$ftext = ADLAN_154;
+		$caption = LAN_NEWVERSION_CHECK_ERROR;
 	}
 
 	if($ftext)
 	{
-		$e107cache->set("releasecheck", $ftext, TRUE);
-		return $ns -> tablerender(LAN_NEWVERSION, $ftext);
+		$e107cache->set("releasecheck", $caption.'|'.$ftext, TRUE);
+		return $ns -> tablerender($caption, $ftext,'admin_update');
 	}
 	else
 	{
 		$e107cache->set("releasecheck", 'up-to-date', TRUE);
 	}
-
+unset ($ftext, $caption);
 
diff -x .svn -aruN 0.7.24.src/e107_files/shortcode/batch/news_shortcodes.php 0.7.26.src/e107_files/shortcode/batch/news_shortcodes.php
--- 0.7.24.src/e107_files/shortcode/batch/news_shortcodes.php	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_files/shortcode/batch/news_shortcodes.php	2011-07-05 03:31:19.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $URL: https://e107.svn.sourceforge.net/svnroot/e107/trunk/e107_0.7/e107_files/shortcode/batch/news_shortcodes.php $
-|     $Revision: 11678 $
-|     $Id: news_shortcodes.php 11678 2010-08-22 00:43:45Z e107coders $
-|     $Author: e107coders $
+|     $Revision: 12304 $
+|     $Id: news_shortcodes.php 12304 2011-07-05 08:31:43Z secretr $
+|     $Author: secretr $
 +----------------------------------------------------------------------------+
 */
 if (!defined('e107_INIT')) { exit; }
@@ -36,7 +36,7 @@
 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;
+    $news_body .= '<div class="e-news-extend">'.$news_extended.'</div>';
 }
 return $news_body;
 SC_END
diff -x .svn -aruN 0.7.24.src/e107_files/shortcode/batch/user_shortcodes.php 0.7.26.src/e107_files/shortcode/batch/user_shortcodes.php
--- 0.7.24.src/e107_files/shortcode/batch/user_shortcodes.php	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_files/shortcode/batch/user_shortcodes.php	2010-11-09 14:53:34.000000000 -0600
@@ -11,8 +11,8 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $URL: https://e107.svn.sourceforge.net/svnroot/e107/trunk/e107_0.7/e107_files/shortcode/batch/user_shortcodes.php $
-|     $Revision: 11687 $
-|     $Id: user_shortcodes.php 11687 2010-08-23 07:25:47Z e107steved $
+|     $Revision: 11956 $
+|     $Id: user_shortcodes.php 11956 2010-11-09 20:53:58Z e107steved $
 |     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
@@ -136,7 +136,7 @@
 SC_BEGIN USER_LASTVISIT_LAPSE
 global $user;
 $gen = new convert;
-return $user['user_currentvisit'] ? "( ".$gen -> computeLapse($user['user_currentvisit'])." ".LAN_426." )" : "<i>".LAN_401."</i>";
+return $user['user_currentvisit'] ? "( ".$gen -> computeLapse($user['user_currentvisit'])." ".LAN_426." )" : '';
 SC_END
 
 SC_BEGIN USER_VISITS
diff -x .svn -aruN 0.7.24.src/e107_files/shortcode/imageselector.sc 0.7.26.src/e107_files/shortcode/imageselector.sc
--- 0.7.24.src/e107_files/shortcode/imageselector.sc	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_files/shortcode/imageselector.sc	2011-01-21 20:14:03.000000000 -0600
@@ -1,5 +1,5 @@
-// $Id: imageselector.sc 11346 2010-02-17 18:56:14Z secretr $
-
+// $Id: imageselector.sc 12055 2011-01-22 02:14:27Z e107coders $
+// <?
 global $sql,$parm;
 
 	if(strstr($parm,"=")){  // query style parms.
@@ -15,7 +15,8 @@
 
   //	$paths = explode("|",$path);
     $recurse = ($subdirs) ? $subdirs : 0;
-	if($imagelist = $fl->get_files($path,".jpg|.gif|.png|.JPG|.GIF|.PNG", 'standard', $recurse)){
+	if($imagelist = $fl->get_files($path,'\.jpg|\.gif|\.png|\.JPG|\.GIF|\.PNG|\.jpeg|\.JPEG|\.svg|\.SVG', 'standard', $recurse))
+	{
 		sort($imagelist);
 	}
 
@@ -24,7 +25,7 @@
     $height = ($height) ? $height : "*";
     $label = ($label) ? $label : " -- -- ";
 
-	$text .= "<select {$multi} class='tbox' name='$name' id='$name' onchange=\"preview_image('$name','$path','".e_IMAGE_ABS."generic/blank.gif');\">
+	$text .= "<select {$multi} class='tbox sc-imageselector' name='$name' id='$name' onchange=\"preview_image('$name','$path','".e_IMAGE_ABS."generic/blank.gif');\">
 	<option value=''>".$label."</option>\n";
 	foreach($imagelist as $icon)
 	{
diff -x .svn -aruN 0.7.24.src/e107_files/shortcode/nextprev.sc 0.7.26.src/e107_files/shortcode/nextprev.sc
--- 0.7.24.src/e107_files/shortcode/nextprev.sc	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_files/shortcode/nextprev.sc	2011-02-11 07:55:42.000000000 -0600
@@ -1,198 +1,203 @@
-
-global $pref;
-
-include_lan(e_LANGUAGEDIR.e_LANGUAGE."/lan_np.php");
-
-$parm_count = substr_count($parm, ",");
-
-while($parm_count < 5)
-{
-    $parm .= ",";
-    $parm_count++;
-}
-
-$p = explode(",", $parm, 6);
-
-$total_items = intval($p[0]);
-$perpage = intval($p[1]);
-$current_start = intval($p[2]);
-$url = trim($p[3]);
-$caption = trim($p[4]);
-$pagetitle = explode("|",trim($p[5]));
-
-if($total_items < $perpage) {   return ""; }
-
-$caption = (!$caption || $caption == "off") ? NP_3."&nbsp;" : $caption;
-
-while(substr($url, -1) == ".")
-{
-    $url=substr($url, 0, -1);
-}
-
-$current_page = ($current_start/$perpage) + 1;
-$total_pages = ceil($total_items/$perpage);
-
-if($total_pages > 1)
-{
-    if(isset($pref['old_np']) && $pref['old_np'])
-    {
-
-        $NP_PRE_ACTIVE = "";
-        $NP_POST_ACTIVE = "";
-        $NP_STYLE = "";
-
-        if(!defined("NEXTPREV_NOSTYLE") || NEXTPREV_NOSTYLE==FALSE){
-            $NP_PRE_ACTIVE = "[";
-            $NP_POST_ACTIVE = "] ";
-            $NP_STYLE = "style='text-decoration:underline'";
-        }
-
-
-        //  Use OLD nextprev method
-        $nppage = '';
-        $nppage .= "\n\n<!-- Start of Next/Prev -->\n\n";
-        if ($total_pages > 10)
-        {
-            $current_page = ($current_start/$perpage)+1;
-
-            for($c = 0; $c <= 2; $c++)
-            {
-                if($perpage * $c == $current_start)
-                {
-                    $nppage .= $NP_PRE_ACTIVE."<span class='nextprev_current' {$NP_STYLE} >".($c+1)."</span>".$NP_POST_ACTIVE."\n";
-                }
-                else
-                {
-                    $link = str_replace("[FROM]", ($perpage * $c), $url);
-                    $nppage .= "<a class='nextprev_link' href='{$link}'>".($c+1)."</a> \n";
-
-                }
-            }
-
-            if ($current_page >= 3 && $current_page <= 5)
-            {
-                for($c = 3; $c <= $current_page; $c++)
-                {
-                    if($perpage * $c == $current_start)
-                    {
-                        $nppage .= $NP_PRE_ACTIVE."<span class='nextprev_current' {$NP_STYLE} >".($c+1)."</span>".$NP_POST_ACTIVE."\n";
-                    }
-                    else
-                    {
-                        $link = str_replace("[FROM]", ($perpage * $c), $url);
-                        $nppage .= "<a class='nextprev_link' href='{$link}'>".($c+1)."</a> \n";
-                    }
-                }
-            }
-            else if($current_page >= 6 && $current_page <= ($total_pages-5))
-            {
-                $nppage .= " ... ";
-                for($c = ($current_page-2); $c <= $current_page; $c++)
-                {
-                    if($perpage * $c == $current_start)
-                    {
-                        $nppage .= $NP_PRE_ACTIVE."<span class='nextprev_current' {$NP_STYLE} >".($c+1)."</span>".$NP_POST_ACTIVE."\n";
-                    }
-                    else
-                    {
-                        $link = str_replace("[FROM]", ($perpage * $c), $url);
-                        $nppage .= "<a class='nextprev_link' href='{$link}'>".($c+1)."</a> \n";
-                    }
-                }
-            }
-            $nppage .= " ... ";
-
-            if (($current_page+5) > $total_pages && $current_page != $total_pages)
-            {
-                $tmp = ($current_page-2);
-            }
-            else
-            {
-                $tmp = $total_pages-3;
-            }
-
-            for($c = $tmp; $c <= ($total_pages-1); $c++)
-            {
-                if($perpage * $c == $current_start)
-                {
-                    $nppage .= $NP_PRE_ACTIVE."<span class='nextprev_current' {$NP_STYLE} >".($c+1)."</span>".$NP_POST_ACTIVE."\n";
-                }
-                else
-                {
-                    $link = str_replace("[FROM]", ($perpage * $c), $url);
-                    $nppage .= "<a class='nextprev_link' href='{$link}'>".($c+1)."</a> \n";
-                }
-            }
-
-        }
-        else
-        {
-            for($c = 0; $c < $total_pages; $c++)
-            {
-                if($perpage * $c == $current_start)
-                {
-                    $nppage .= $NP_PRE_ACTIVE."<span class='nextprev_current' {$NP_STYLE} >".($c+1)."</span>".$NP_POST_ACTIVE."\n";
-                }
-                else
-                {
-                    $link = str_replace("[FROM]", ($perpage * $c), $url);
-                    $nppage .= "<a class='nextprev_link' href='{$link}'>".($c+1)."</a> \n";
-                }
-            }
-        }
-        $nppage .= "\n\n<!-- End of Next/Prev -->\n\n";
-        return $caption.$nppage;
-    }
-
-    // Use NEW nextprev method
-    $np_parm['template'] = "[PREV]&nbsp;&nbsp;[DROPDOWN]&nbsp;&nbsp;[NEXT]";
-    $np_parms['prev'] = "&nbsp;&nbsp;&lt;&lt;&nbsp;&nbsp;";
-    $np_parms['next'] = "&nbsp;&nbsp;&gt;&gt;&nbsp;&nbsp;";
-    $np_parms['np_class'] = 'tbox npbutton';
-    $np_parms['dropdown_class'] = 'tbox npdropdown';
-
-    if($cached_parms = getcachedvars('nextprev'))
-    {
-        $tmp = $cached_parms;
-        foreach($tmp as $key => $val)
-        {
-            $np_parms[$key]=$val;
-        }
-    }
-
-    $prev="";
-    $next="";
-    if($current_page > 1)
-    {
-        $prevstart = ($current_start - $perpage);
-        $link = str_replace("[FROM]", $prevstart, $url);
-        $prev = "<a class='{$np_parms['np_class']}' style='text-decoration:none' href='{$link}'>{$np_parms['prev']}</a>";
-    }
-    if($current_page < $total_pages)
-    {
-        $nextstart = ($current_start + $perpage);
-        $link = str_replace("[FROM]", $nextstart, $url);
-        $next = "<a class='{$np_parms['np_class']}' style='text-decoration:none' href='{$link}'>{$np_parms['next']}</a>";
-    }
-    $dropdown = "<select class='{$np_parms['dropdown_class']}' name='pageSelect' onchange='location.href=this.options[selectedIndex].value'>";
-    for($i = 1; $i <= $total_pages; $i++)
-    {
-        $sel = "";
-        if($current_page == $i)
-        {
-            $sel = " selected='selected' ";
-        }
-        $newstart = ($i-1)*$perpage;
-        $link = str_replace("[FROM]", $newstart, $url);
-        $c = $i-1;
-        $title = ($pagetitle[$c]) ? $pagetitle[$c] : $i;
-        $dropdown .= "<option value='{$link}' {$sel}>{$title}</option>\n";
-    }
-    $dropdown .= "</select>";
-    $ret = $np_parm['template'];
-    $ret = str_replace('[DROPDOWN]', $dropdown, $ret);
-    $ret = str_replace('[PREV]', $prev, $ret);
-    $ret = str_replace('[NEXT]', $next, $ret);
-    return $caption.$ret;
-}
-return "";
+
+global $pref;
+
+include_lan(e_LANGUAGEDIR.e_LANGUAGE."/lan_np.php");
+
+$parm_count = substr_count($parm, ",");
+
+while($parm_count < 5)
+{
+    $parm .= ",";
+    $parm_count++;
+}
+
+$p = explode(",", $parm, 6);
+
+$total_items = intval($p[0]);
+$perpage = intval($p[1]);
+$current_start = intval($p[2]);
+$url = trim($p[3]);
+$caption = trim($p[4]);
+$pagetitle = explode("|",trim($p[5]));
+
+if($total_items < $perpage) {   return ""; }
+
+$caption = (!$caption || $caption == "off") ? NP_3."&nbsp;" : $caption;
+
+while(substr($url, -1) == ".")
+{
+    $url=substr($url, 0, -1);
+}
+
+$current_page = ($current_start/$perpage) + 1;
+$total_pages = ceil($total_items/$perpage);
+
+if($total_pages > 1)
+{
+    if(isset($pref['old_np']) && $pref['old_np'])
+    {
+
+        $NP_PRE_ACTIVE = "";
+        $NP_POST_ACTIVE = "";
+        $NP_STYLE = "";
+
+        if(!defined("NEXTPREV_NOSTYLE") || NEXTPREV_NOSTYLE==FALSE)
+		{
+            $NP_PRE_ACTIVE = "[";
+            $NP_POST_ACTIVE = "] ";
+            $NP_STYLE = "style='text-decoration:underline'";
+        }
+
+
+        //  Use OLD nextprev method
+        $nppage = '';
+        $nppage .= "\n\n<!-- Start of Next/Prev -->\n\n";
+        if ($total_pages > 10)
+        {
+            $current_page = ($current_start/$perpage)+1;
+
+            for($c = 0; $c <= 2; $c++)
+            {
+                if($perpage * $c == $current_start)
+                {
+                    $nppage .= $NP_PRE_ACTIVE."<span class='nextprev_current' {$NP_STYLE} >".($c+1)."</span>".$NP_POST_ACTIVE."\n";
+                }
+                else
+                {
+                    $link = str_replace("[FROM]", ($perpage * $c), $url);
+                    $nppage .= "<a class='nextprev_link' href='{$link}'>".($c+1)."</a> \n";
+
+                }
+            }
+
+            if ($current_page >= 3 && $current_page <= 5)
+            {
+                for($c = 3; $c <= $current_page; $c++)
+                {
+                    if($perpage * $c == $current_start)
+                    {
+                        $nppage .= $NP_PRE_ACTIVE."<span class='nextprev_current' {$NP_STYLE} >".($c+1)."</span>".$NP_POST_ACTIVE."\n";
+                    }
+                    else
+                    {
+                        $link = str_replace("[FROM]", ($perpage * $c), $url);
+                        $nppage .= "<a class='nextprev_link' href='{$link}'>".($c+1)."</a> \n";
+                    }
+                }
+            }
+            else if($current_page >= 6 && $current_page <= ($total_pages-5))
+            {
+                $nppage .= " ... ";
+                for($c = ($current_page-2); $c <= $current_page; $c++)
+                {
+                    if($perpage * $c == $current_start)
+                    {
+                        $nppage .= $NP_PRE_ACTIVE."<span class='nextprev_current' {$NP_STYLE} >".($c+1)."</span>".$NP_POST_ACTIVE."\n";
+                    }
+                    else
+                    {
+                        $link = str_replace("[FROM]", ($perpage * $c), $url);
+                        $nppage .= "<a class='nextprev_link' href='{$link}'>".($c+1)."</a> \n";
+                    }
+                }
+            }
+            $nppage .= " ... ";
+
+            if (($current_page+5) > $total_pages && $current_page != $total_pages)
+            {
+                $tmp = ($current_page-2);
+            }
+            else
+            {
+                $tmp = $total_pages-3;
+            }
+
+            for($c = $tmp; $c <= ($total_pages-1); $c++)
+            {
+                if($perpage * $c == $current_start)
+                {
+                    $nppage .= $NP_PRE_ACTIVE."<span class='nextprev_current' {$NP_STYLE} >".($c+1)."</span>".$NP_POST_ACTIVE."\n";
+                }
+                else
+                {
+                    $link = str_replace("[FROM]", ($perpage * $c), $url);
+                    $nppage .= "<a class='nextprev_link' href='{$link}'>".($c+1)."</a> \n";
+                }
+            }
+
+        }
+        else
+        {
+            for($c = 0; $c < $total_pages; $c++)
+            {
+                if($perpage * $c == $current_start)
+                {
+                    $nppage .= $NP_PRE_ACTIVE."<span class='nextprev_current' {$NP_STYLE} >".($c+1)."</span>".$NP_POST_ACTIVE."\n";
+                }
+                else
+                {
+                    $link = str_replace("[FROM]", ($perpage * $c), $url);
+                    $nppage .= "<a class='nextprev_link' href='{$link}'>".($c+1)."</a> \n";
+                }
+            }
+        }
+        $nppage .= "\n\n<!-- End of Next/Prev -->\n\n";
+        return $caption.$nppage;
+    }
+
+    // Use NEW nextprev method
+    $np_parm['template'] = "[PREV]&nbsp;&nbsp;[DROPDOWN]&nbsp;&nbsp;[NEXT]";		// Default template
+    $np_parms['prev'] = "&nbsp;&nbsp;&lt;&lt;&nbsp;&nbsp;";
+    $np_parms['next'] = "&nbsp;&nbsp;&gt;&gt;&nbsp;&nbsp;";
+    $np_parms['np_class'] = 'tbox npbutton';
+    $np_parms['dropdown_class'] = 'tbox npdropdown';
+
+    if($cached_parms = getcachedvars('nextprev'))
+    {
+        $tmp = $cached_parms;
+        foreach($tmp as $key => $val)
+        {
+            $np_parms[$key]=$val;
+        }
+    }
+
+    $prev="";
+    $next="";
+    if($current_page > 1)
+    {
+        $prevstart = ($current_start - $perpage);
+        $link = str_replace("[FROM]", $prevstart, $url);
+        $prev = "<a class='{$np_parms['np_class']}' style='text-decoration:none' href='{$link}'>{$np_parms['prev']}</a>";
+    }
+    if($current_page < $total_pages)
+    {
+        $nextstart = ($current_start + $perpage);
+        $link = str_replace("[FROM]", $nextstart, $url);
+        $next = "<a class='{$np_parms['np_class']}' style='text-decoration:none' href='{$link}'>{$np_parms['next']}</a>";
+    }
+    $dropdown = "<select class='{$np_parms['dropdown_class']}' name='pageSelect' onchange='location.href=this.options[selectedIndex].value'>";
+    for($i = 1; $i <= $total_pages; $i++)
+    {
+        $sel = "";
+        if($current_page == $i)
+        {
+            $sel = " selected='selected' ";
+        }
+        $newstart = ($i-1)*$perpage;
+        $link = str_replace("[FROM]", $newstart, $url);
+        $c = $i-1;
+        $title = (isset($pagetitle[$c]) && $pagetitle[$c]) ? $pagetitle[$c] : $i;
+        $dropdown .= "<option value='{$link}' {$sel}>{$title}</option>\n";
+    }
+    $dropdown .= "</select>";
+    $ret = $np_parm['template'];		// Set default
+	if (isset($np_parms['template']) && $np_parms['template'])
+	{
+		$ret = $np_parms['template'];				// Use override
+	}
+    $ret = str_replace('[DROPDOWN]', $dropdown, $ret);
+    $ret = str_replace('[PREV]', $prev, $ret);
+    $ret = str_replace('[NEXT]', $next, $ret);
+    return $caption.$ret;
+}
+return "";
diff -x .svn -aruN 0.7.24.src/e107_files/shortcode/stylesheet.sc 0.7.26.src/e107_files/shortcode/stylesheet.sc
--- 0.7.24.src/e107_files/shortcode/stylesheet.sc	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_files/shortcode/stylesheet.sc	2010-09-28 14:28:32.000000000 -0500
@@ -1,4 +1,6 @@
-// $Id: stylesheet.sc 11346 2010-02-17 18:56:14Z secretr $
+// $Id: stylesheet.sc 11831 2010-09-28 19:28:56Z e107steved $
+
+global $THEMES_DIRECTORY;
 
 $css = file_get_contents(THEME."style.css");
 $search = array("url(images","url('images");
diff -x .svn -aruN 0.7.24.src/e107_files/shortcode/user_extended.sc 0.7.26.src/e107_files/shortcode/user_extended.sc
--- 0.7.24.src/e107_files/shortcode/user_extended.sc	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_files/shortcode/user_extended.sc	2010-10-16 15:12:49.000000000 -0500
@@ -1,124 +1,124 @@
-//USAGE:  {EXTENDED=<field_name>.[text|value|icon|text_value].<user_id>}
-//EXAMPLE: {EXTENDED=gender.value.5}  will show the value of the extended field user_gender for user #5
-include(e_LANGUAGEDIR.e_LANGUAGE."/lan_user_extended.php");
-$parms = explode(".", $parm);
-global $currentUser, $tp, $loop_uid, $e107, $sc_style;
-if(isset($loop_uid) && intval($loop_uid) == 0) { return ""; }
-$key = $parms[0].".".$parms[1];
-$sc_style['USER_EXTENDED']['pre'] = (isset($sc_style['USER_EXTENDED'][$key]['pre']) ? $sc_style['USER_EXTENDED'][$key]['pre'] : "");
-$sc_style['USER_EXTENDED']['post'] = (isset($sc_style['USER_EXTENDED'][$key]['post']) ? $sc_style['USER_EXTENDED'][$key]['post'] : "");
-include_once(e_HANDLER."user_extended_class.php");
-$ueStruct = e107_user_extended::user_extended_getStruct();
-
-$uid = intval($parms[2]);
-if($uid == 0)
-{
-	if(isset($loop_uid) && intval($loop_uid) > 0)
-	{
-		$uid = $loop_uid;
-	}
-	else
-	{
-		$uid = USERID;
-	}
-}
-
-$udata = get_user_data($uid);
-
-$udata['user_class'] .= ($udata['user_class'] == "" ? "" : ",");
-$udata['user_class'] .= e_UC_PUBLIC.",".e_UC_MEMBER;
-if($udata['user_admin'] == 1)
-{
-  $udata['user_class'].= ",".e_UC_ADMIN;
-}
-
-
-// Need to pick up the 'miscellaneous' category - anything which isn't in a named category. Have to control visibility on a field by field basis
-if ($parms[0] != LAN_410)
-{
-  $ret_cause = 0;
-  if (!check_class($ueStruct["user_".$parms[0]]['user_extended_struct_applicable'], $udata['user_class'])) $ret_cause = 1;
-  if (!check_class($ueStruct["user_".$parms[0]]['user_extended_struct_read'], $udata['user_class'])) $ret_cause = 2;
-  if (($ueStruct["user_".$parms[0]]['user_extended_struct_read'] == e_UC_READONLY && (!ADMIN && $udata['user_id'] != USERID))) $ret_cause = 3;
-  if ((!ADMIN && substr($ueStruct["user_".$parms[0]]['user_extended_struct_parms'], -1) == 1 
-	&& strpos($udata['user_hidden_fields'], "^user_".$parms[0]."^") !== FALSE && $uid != USERID)) $ret_cause = 4;
-  if ($ret_cause != 0)
-  {
-	return FALSE;
-  }
-}
-
-if($parms[1] == 'text_value')
-{
-	$_value = $tp->parseTemplate("{USER_EXTENDED={$parms[0]}.value}");
-	if($_value)
-	{
-		$__pre = (isset($sc_style['USER_EXTENDED'][$key]['pre']) ? $sc_style['USER_EXTENDED'][$key]['pre'] : "");
-		$__post = (isset($sc_style['USER_EXTENDED'][$key]['post']) ? $sc_style['USER_EXTENDED'][$key]['post'] : "");
-		$_text = $tp->parseTemplate("{USER_EXTENDED={$parms[0]}.text}");
-		$_mid = (isset($sc_style['USER_EXTENDED'][$key]['mid']) ? $sc_style['USER_EXTENDED'][$key]['mid'] : "");
-		return $__pre.$_text.$_mid.$_value.$__post;
-	}
-	return false;
-}
-
-if ($parms[1] == 'text')
-{
-  $text_val = $ueStruct["user_".$parms[0]]['user_extended_struct_text'];
-  if($text_val)
-  {
-	return (defined($text_val) ? constant($text_val) : $text_val);
-  }
-  else
-  {
-	return TRUE;
-  }
-}
-
-if ($parms[1] == 'icon')
-{
-	if(defined(strtoupper($parms[0])."_ICON"))
-	{
-		return constant(strtoupper($parms[0])."_ICON");
-	}
-	elseif(file_exists(e_IMAGE."user_icons/{$parms[0]}.png"))
-	{
-		return "<img src='".e_IMAGE_ABS."user_icons/{$parms[0]}.png' style='width:16px; height:16px' alt='' />";
-	}
-	return "";
-}
-
-if ($parms[1] == 'value')
-{
-	$uVal = str_replace(chr(1), "", $udata['user_'.$parms[0]]);
-	// check for db_lookup type
-	if($ueStruct["user_".$parms[0]]['user_extended_struct_type'] == '4')
-	{
-		$tmp = explode(",",$ueStruct["user_".$parms[0]]['user_extended_struct_values']);
-		$sql_ue = new db;			// Use our own DB object to avoid conflicts
-		if($sql_ue->db_Select($tmp[0],"{$tmp[1]}, {$tmp[2]}","{$tmp[1]} = '{$uVal}'"))
-		{
-			$row = $sql_ue->db_Fetch();
-			$ret_data = $row[$tmp[2]];
-		}
-		else
-		{
-			$ret_data = FALSE;
-		}
-	}
-	else
-	{
-		//check for 0000-00-00 in date field
-		if($ueStruct["user_".$parms[0]]['user_extended_struct_type'] == '7')
-		{
-			if($uVal == "0000-00-00") { $uVal = ""; }
-		}
-		$ret_data = $uVal;
-	}
-	if($ret_data != "")
-	{
-		return $tp->toHTML($ret_data, TRUE, "no_make_clickable", "class:{$udata['user_class']}");
-	}
-	return FALSE;
-}
-return FALSE;
+//USAGE:  {EXTENDED=<field_name>.[text|value|icon|text_value].<user_id>}
+//EXAMPLE: {EXTENDED=gender.value.5}  will show the value of the extended field user_gender for user #5
+include_lan(e_LANGUAGEDIR.e_LANGUAGE."/lan_user_extended.php");
+$parms = explode(".", $parm);
+global $currentUser, $tp, $loop_uid, $e107, $sc_style;
+if(isset($loop_uid) && intval($loop_uid) == 0) { return ""; }
+$key = $parms[0].".".$parms[1];
+$sc_style['USER_EXTENDED']['pre'] = (isset($sc_style['USER_EXTENDED'][$key]['pre']) ? $sc_style['USER_EXTENDED'][$key]['pre'] : "");
+$sc_style['USER_EXTENDED']['post'] = (isset($sc_style['USER_EXTENDED'][$key]['post']) ? $sc_style['USER_EXTENDED'][$key]['post'] : "");
+include_once(e_HANDLER."user_extended_class.php");
+$ueStruct = e107_user_extended::user_extended_getStruct();
+
+$uid = intval($parms[2]);
+if($uid == 0)
+{
+	if(isset($loop_uid) && intval($loop_uid) > 0)
+	{
+		$uid = $loop_uid;
+	}
+	else
+	{
+		$uid = USERID;
+	}
+}
+
+$udata = get_user_data($uid);
+
+$udata['user_class'] .= ($udata['user_class'] == "" ? "" : ",");
+$udata['user_class'] .= e_UC_PUBLIC.",".e_UC_MEMBER;
+if($udata['user_admin'] == 1)
+{
+  $udata['user_class'].= ",".e_UC_ADMIN;
+}
+
+
+// Need to pick up the 'miscellaneous' category - anything which isn't in a named category. Have to control visibility on a field by field basis
+if ($parms[0] != LAN_410)
+{
+  $ret_cause = 0;
+  if (!check_class($ueStruct["user_".$parms[0]]['user_extended_struct_applicable'], $udata['user_class'])) $ret_cause = 1;
+  if (!check_class($ueStruct["user_".$parms[0]]['user_extended_struct_read'], $udata['user_class'])) $ret_cause = 2;
+  if (($ueStruct["user_".$parms[0]]['user_extended_struct_read'] == e_UC_READONLY && (!ADMIN && $udata['user_id'] != USERID))) $ret_cause = 3;
+  if ((!ADMIN && substr($ueStruct["user_".$parms[0]]['user_extended_struct_parms'], -1) == 1 
+	&& strpos($udata['user_hidden_fields'], "^user_".$parms[0]."^") !== FALSE && $uid != USERID)) $ret_cause = 4;
+  if ($ret_cause != 0)
+  {
+	return FALSE;
+  }
+}
+
+if($parms[1] == 'text_value')
+{
+	$_value = $tp->parseTemplate("{USER_EXTENDED={$parms[0]}.value}");
+	if($_value)
+	{
+		$__pre = (isset($sc_style['USER_EXTENDED'][$key]['pre']) ? $sc_style['USER_EXTENDED'][$key]['pre'] : "");
+		$__post = (isset($sc_style['USER_EXTENDED'][$key]['post']) ? $sc_style['USER_EXTENDED'][$key]['post'] : "");
+		$_text = $tp->parseTemplate("{USER_EXTENDED={$parms[0]}.text}");
+		$_mid = (isset($sc_style['USER_EXTENDED'][$key]['mid']) ? $sc_style['USER_EXTENDED'][$key]['mid'] : "");
+		return $__pre.$_text.$_mid.$_value.$__post;
+	}
+	return false;
+}
+
+if ($parms[1] == 'text')
+{
+  $text_val = $ueStruct["user_".$parms[0]]['user_extended_struct_text'];
+  if($text_val)
+  {
+	return (defined($text_val) ? constant($text_val) : $text_val);
+  }
+  else
+  {
+	return TRUE;
+  }
+}
+
+if ($parms[1] == 'icon')
+{
+	if(defined(strtoupper($parms[0])."_ICON"))
+	{
+		return constant(strtoupper($parms[0])."_ICON");
+	}
+	elseif(file_exists(e_IMAGE."user_icons/{$parms[0]}.png"))
+	{
+		return "<img src='".e_IMAGE_ABS."user_icons/{$parms[0]}.png' style='width:16px; height:16px' alt='' />";
+	}
+	return "";
+}
+
+if ($parms[1] == 'value')
+{
+	$uVal = str_replace(chr(1), "", $udata['user_'.$parms[0]]);
+	// check for db_lookup type
+	if($ueStruct["user_".$parms[0]]['user_extended_struct_type'] == '4')
+	{
+		$tmp = explode(",",$ueStruct["user_".$parms[0]]['user_extended_struct_values']);
+		$sql_ue = new db;			// Use our own DB object to avoid conflicts
+		if($sql_ue->db_Select($tmp[0],"{$tmp[1]}, {$tmp[2]}","{$tmp[1]} = '{$uVal}'"))
+		{
+			$row = $sql_ue->db_Fetch();
+			$ret_data = $row[$tmp[2]];
+		}
+		else
+		{
+			$ret_data = FALSE;
+		}
+	}
+	else
+	{
+		//check for 0000-00-00 in date field
+		if($ueStruct["user_".$parms[0]]['user_extended_struct_type'] == '7')
+		{
+			if($uVal == "0000-00-00") { $uVal = ""; }
+		}
+		$ret_data = $uVal;
+	}
+	if($ret_data != "")
+	{
+		return $tp->toHTML($ret_data, TRUE, "no_make_clickable", "class:{$udata['user_class']}");
+	}
+	return FALSE;
+}
+return FALSE;
diff -x .svn -aruN 0.7.24.src/e107_files/thumb.php 0.7.26.src/e107_files/thumb.php
--- 0.7.24.src/e107_files/thumb.php	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_files/thumb.php	2011-03-14 16:09:36.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $URL: https://e107.svn.sourceforge.net/svnroot/e107/trunk/e107_0.7/e107_files/thumb.php $
-|     $Revision: 11678 $
-|     $Id: thumb.php 11678 2010-08-22 00:43:45Z e107coders $
-|     $Author: e107coders $
+|     $Revision: 12104 $
+|     $Id: thumb.php 12104 2011-03-14 21:10:00Z e107steved $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 /*
@@ -61,6 +61,7 @@
 	$opts = varset($tmp[2],'upsize');
 	if(!resize_image($source, 'stdout', $newsize, $opts))
 	{
+		$source = $tp->toDB($source);
 		echo "Couldn't find: {$source}<br />";
 	} 
 } 
diff -x .svn -aruN 0.7.24.src/e107_handlers/admin_log_class.php 0.7.26.src/e107_handlers/admin_log_class.php
--- 0.7.24.src/e107_handlers/admin_log_class.php	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_handlers/admin_log_class.php	2010-10-09 00:19:06.000000000 -0500
@@ -12,8 +12,8 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $URL: https://e107.svn.sourceforge.net/svnroot/e107/trunk/e107_0.7/e107_handlers/admin_log_class.php $
-|     $Revision: 11678 $
-|     $Id: admin_log_class.php 11678 2010-08-22 00:43:45Z e107coders $
+|     $Revision: 11864 $
+|     $Id: admin_log_class.php 11864 2010-10-09 05:19:30Z e107coders $
 |     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
@@ -93,12 +93,16 @@
 			$event_detail = $tp -> toDB($event_detail, true,false,'no_html');
 			$event_type = $tp -> toDB($event_type, true,false,'no_html');
 			$time_stamp = time();
-			$uid = (USER) ? USERID : '0';
+			$uid = defined('USERID') ? USERID : '0';
 			$ip = $e107->getip();
 			if($this->_options['backtrace'] == true) {
 				$event_detail .= "\n\n".debug_backtrace();
 			}
-			$sql->db_Insert('dblog', "'', '{$event_type}', {$time_stamp}, {$uid}, '{$ip}', '{$event_title}', '{$event_detail}' ");
+			if(!$sql->db_Insert('dblog', "'', '{$event_type}', {$time_stamp}, {$uid}, '{$ip}', '{$event_title}', '{$event_detail}' "))
+			{
+				trigger_error("Couldn't insert into dblog table",E_USER_ERROR);
+			}
+			
 		}
 	}
 
diff -x .svn -aruN 0.7.24.src/e107_handlers/bbcode_handler.php 0.7.26.src/e107_handlers/bbcode_handler.php
--- 0.7.24.src/e107_handlers/bbcode_handler.php	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_handlers/bbcode_handler.php	2011-03-21 06:57:26.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $URL: https://e107.svn.sourceforge.net/svnroot/e107/trunk/e107_0.7/e107_handlers/bbcode_handler.php $
-|     $Revision: 11799 $
-|     $Id: bbcode_handler.php 11799 2010-09-18 14:32:12Z e107steved $
-|     $Author: e107steved $
+|     $Revision: 12112 $
+|     $Id: bbcode_handler.php 12112 2011-03-21 11:57:50Z secretr $
+|     $Author: secretr $
 +----------------------------------------------------------------------------+
 */
 
@@ -86,7 +86,7 @@
 			{
 				$this->preProcess = TRUE;
 				unset($strip_array[0]);
-				if (count($strip_array) == 0) 
+				if (count($strip_array) == 0)
 				{
 					$bbStrip = FALSE;
 				}
@@ -94,7 +94,7 @@
 				{
 					$bbStrip = TRUE;
 				}
-				
+
 			}
 		}
 		$pattern = '#^\[(/?)([A-Za-z_]+)(\d*)([=:]?)(.*?)]$#i';	// Pattern to split up bbcodes
@@ -119,7 +119,7 @@
 					$bbparam = (isset($matches[5])) ? $matches[5] : '';
 					$bbword = (isset($matches[2])) ? $matches[2] : '';
 					if($cont[1] != '/')
-					{ 
+					{
 						$bbsep = varset($matches[4]);
 					}
 					if ($force_lower) $bbword = strtolower($bbword);
@@ -259,19 +259,42 @@
 		return $result;
 	}
 
+	/**
+	 * Filter bbcode Input
+	 * @param string $input [optional]
+	 * @return string
+	 */
+	function filter($input='')
+	{
+		if(!$input)
+		{
+			return;
+		}
+
+		// filter is breaking bbcodes with - input is modified with strtolower()
+		//$input = strtolower($input);
+		//$search = array('document.cookie','location.href','onload');
+		//return str_replace($search,"",$input);
+
+		// a quick fix attempt - basic filtering
+		return preg_replace('/(document\.cookie|location\.href|onload)/i', '', $input);
+	}
 
 
+	/**
+	 * Invoke the actual bbcode handler
+	 * @param string $code - textual value of the bbcode (already begins with '_' if a single code)
+	 * @param string $param1 - any text after '=' in the opening code
+	 * @param string $code_text_par - text between the opening and closing codes
+	 * @param string $param2 - any text after '=' for the closing code
+	 * @param string $sep - character separating bbcode name and any parameters
+	 * @param string $full_text - the 'raw' text between, and including, the opening and closing bbcode tags
+	 * @return
+	 */
 	function proc_bbcode($code, $param1='',$code_text_par='', $param2='', $sep='', $full_text='')
-	// Invoke an actual bbcode handler
-	// $code - textual value of the bbcode (already begins with '_' if a single code)
-	// $param1 - any text after '=' in the opening code
-	// $code_text_par - text between the opening and closing codes
-	// $param2 - any text after '=' for the closing code
-	// $sep - character separating bbcode name and any parameters
-	// $full_text - the 'raw' text between, and including, the opening and closing bbcode tags
 	{
 		global $tp, $postID, $code_text, $parm;
-		$parm = $param1;
+		$parm = $this->filter($param1);
 
 		$code_text = $code_text_par;
 
diff -x .svn -aruN 0.7.24.src/e107_handlers/comment_class.php 0.7.26.src/e107_handlers/comment_class.php
--- 0.7.24.src/e107_handlers/comment_class.php	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_handlers/comment_class.php	2010-11-01 17:10:04.000000000 -0500
@@ -12,9 +12,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $URL: https://e107.svn.sourceforge.net/svnroot/e107/trunk/e107_0.7/e107_handlers/comment_class.php $
-|     $Revision: 11678 $
-|     $Id: comment_class.php 11678 2010-08-22 00:43:45Z e107coders $
-|     $Author: e107coders $
+|     $Revision: 11941 $
+|     $Id: comment_class.php 11941 2010-11-01 22:10:28Z e107steved $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 
@@ -639,8 +639,8 @@
 	function get_e_comment()
 	{
 		$data = getcachedvars('e_comment');
-	  if($data!==FALSE)
-	  {
+		if($data!==FALSE)
+		{
 			return $data;
 		}
 
@@ -650,18 +650,24 @@
 		$omit = array('^\.$','^\.\.$','^\/$','^CVS$','thumbs\.db','.*\._$','.bak$');
 		$files = $fl->get_files(e_PLUGIN, 'e_comment.php', $omit, 1, 0);
 
-		foreach($files as $file){
+		foreach($files as $file)
+		{
 			unset($e_comment, $key);
 			include($file['path'].$file['fname']);
-			if($e_comment && is_array($e_comment)){
+			if(isset($e_comment) && is_array($e_comment))
+			{
 				$key = $e_comment['eplug_comment_ids'];
-				if(isset($key) && $key!=''){
+				if(isset($key) && $key!='')
+				{
 					$data[$key] = $e_comment;
 				}
-			}else{
+			}
+			else
+			{
 				//convert old method variables into the same array method
 				$key = $e_plug_table;
-				if(isset($key) && $key!=''){
+				if(isset($key) && $key!='')
+				{
 					$e_comment['eplug_comment_ids']	= $e_plug_table;
 					$e_comment['plugin_name']		= $plugin_name;
 					$e_comment['plugin_path']		= $plugin_path;
@@ -844,7 +850,7 @@
 					  }
 					}
 				  }		// End Switch
-				  if($ret['comment_title'])
+				  if(varset($ret['comment_title']))
 				  {
 					$reta[] = $ret;
 					$valid++;
diff -x .svn -aruN 0.7.24.src/e107_handlers/db_debug_class.php 0.7.26.src/e107_handlers/db_debug_class.php
--- 0.7.24.src/e107_handlers/db_debug_class.php	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_handlers/db_debug_class.php	2010-10-08 19:06:15.000000000 -0500
@@ -11,8 +11,8 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $URL: https://e107.svn.sourceforge.net/svnroot/e107/trunk/e107_0.7/e107_handlers/db_debug_class.php $
-|     $Revision: 11678 $
-|     $Id: db_debug_class.php 11678 2010-08-22 00:43:45Z e107coders $
+|     $Revision: 11860 $
+|     $Id: db_debug_class.php 11860 2010-10-09 00:06:39Z e107coders $
 |     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
@@ -573,7 +573,7 @@
 
 function e107_debug_shutdown()
 {
-global $error_handler,$e107_Clean_Exit,$In_e107_Footer,$ADMIN_DIRECTORY;
+	global $error_handler,$e107_Clean_Exit,$In_e107_Footer,$ADMIN_DIRECTORY;
 	if (isset($e107_Clean_Exit)) return;
 
 	if (!isset($In_e107_Footer))
@@ -581,11 +581,24 @@
 		if (defset('ADMIN_AREA'))
 		{
 			$filewanted=realpath(dirname(__FILE__)).'/../'.$ADMIN_DIRECTORY.'footer.php';
-			require_once($filewanted);
-		} else if (defset('USER_AREA'))
+			
+		}
+		elseif(defset('USER_AREA'))
+		{
+			// $filewanted=realpath(dirname(__FILE__)).'/../'.FOOTERF;	(fails when in plugin dir)
+			$filewanted=realpath(FOOTERF);		
+		}
+		
+		if($filewanted)
 		{
-			$filewanted=realpath(dirname(__FILE__)).'/../'.FOOTERF;
-			require_once($filewanted);
+			if(is_readable($filewanted))
+			{
+				require_once($filewanted);	
+			}
+			else
+			{
+				trigger_error("Couldn't load ".$filewanted, E_USER_ERROR);
+			}
 		}
 	}
 // 
diff -x .svn -aruN 0.7.24.src/e107_handlers/e107_class.php 0.7.26.src/e107_handlers/e107_class.php
--- 0.7.24.src/e107_handlers/e107_class.php	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_handlers/e107_class.php	2010-10-21 13:03:07.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $URL: https://e107.svn.sourceforge.net/svnroot/e107/trunk/e107_0.7/e107_handlers/e107_class.php $
-|     $Revision: 11678 $
-|     $Id: e107_class.php 11678 2010-08-22 00:43:45Z e107coders $
-|     $Author: e107coders $
+|     $Revision: 11909 $
+|     $Id: e107_class.php 11909 2010-10-21 18:03:31Z e107steved $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 
@@ -186,35 +186,31 @@
 	 */
 	function getip() 
 	{
-	  if(!$this->_ip_cache)
-	  {
-		if (getenv('HTTP_X_FORWARDED_FOR')) 
+		if(!$this->_ip_cache)
 		{
-		  $ip=$_SERVER['REMOTE_ADDR'];
-		  if (preg_match("/^([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)/", getenv('HTTP_X_FORWARDED_FOR'), $ip3)) 
-		  {
-			$ip2 = array('#^0\..*#', 
-					'#^127\..*#', 							// Local loopbacks
-					'#^192\.168\..*#', 						// RFC1918 - Private Network
-					'#^172\.(?:1[6789]|2\d|3[01])\..*#', 	// RFC1918 - Private network
-					'#^10\..*#', 							// RFC1918 - Private Network
-					'#^169\.254\..*#', 						// RFC3330 - Link-local, auto-DHCP 
-					'#^2(?:2[456789]|[345][0-9])\..*#'		// Single check for Class D and Class E
-					);
-			$ip = preg_replace($ip2, $ip, $ip3[1]);
-		  }
-		} 
-		else 
-		{
-		  $ip = $_SERVER['REMOTE_ADDR'];
-		}
-		if ($ip == "") 
-		{
-		  $ip = "x.x.x.x";
+			$ip=$_SERVER['REMOTE_ADDR'];
+			if (getenv('HTTP_X_FORWARDED_FOR')) 
+			{
+				if (preg_match("/^([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)/", getenv('HTTP_X_FORWARDED_FOR'), $ip3)) 
+				{
+					$ip2 = array('#^0\..*#', 
+							'#^127\..*#', 							// Local loopbacks
+							'#^192\.168\..*#', 						// RFC1918 - Private Network
+							'#^172\.(?:1[6789]|2\d|3[01])\..*#', 	// RFC1918 - Private network
+							'#^10\..*#', 							// RFC1918 - Private Network
+							'#^169\.254\..*#', 						// RFC3330 - Link-local, auto-DHCP 
+							'#^2(?:2[456789]|[345][0-9])\..*#'		// Single check for Class D and Class E
+							);
+					$ip = preg_replace($ip2, $ip3[1], $ip);
+				}
+			} 
+			if ($ip == "") 
+			{
+				$ip = "x.x.x.x";
+			}
+			$this->_ip_cache = $ip;
 		}
-		$this->_ip_cache = $ip;
-	  }
-	  return $this->_ip_cache;
+		return $this->_ip_cache;
 	}
 
 	function get_host_name($ip_address) 
diff -x .svn -aruN 0.7.24.src/e107_handlers/emailprint_class.php 0.7.26.src/e107_handlers/emailprint_class.php
--- 0.7.24.src/e107_handlers/emailprint_class.php	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_handlers/emailprint_class.php	2010-11-01 17:10:04.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $URL: https://e107.svn.sourceforge.net/svnroot/e107/trunk/e107_0.7/e107_handlers/emailprint_class.php $
-|     $Revision: 11678 $
-|     $Id: emailprint_class.php 11678 2010-08-22 00:43:45Z e107coders $
-|     $Author: e107coders $
+|     $Revision: 11941 $
+|     $Id: emailprint_class.php 11941 2010-11-01 22:10:28Z e107steved $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 
@@ -59,12 +59,12 @@
 
 		if ($look == 0 || $look == 1) 
 		{
-			$ico_mail = (file_exists(THEME."images/".ICONMAIL) ? THEME_ABS."images/".ICONMAIL : e_IMAGE_ABS."generic/".IMODE."/email.png");
+			$ico_mail = ((defined('ICONMAIL') && file_exists(THEME."images/".ICONMAIL)) ? THEME_ABS."images/".ICONMAIL : e_IMAGE_ABS."generic/".IMODE."/email.png");
 			$text_emailprint .= "<a href='".e_HTTP."email.php?".$email.".".$id."'><img src='".$ico_mail."' style='border:0' alt='".LAN_EMAIL_7."' title='".LAN_EMAIL_7."' /></a> ";
 		}
 		if ($look == 0 || $look == 2) 
 		{
-			$ico_print = (file_exists(THEME."images/".ICONPRINT) ? THEME_ABS."images/".ICONPRINT : e_IMAGE_ABS."generic/".IMODE."/printer.png");
+			$ico_print = ((defined('ICONPRINT') && file_exists(THEME."images/".ICONPRINT)) ? THEME_ABS."images/".ICONPRINT : e_IMAGE_ABS."generic/".IMODE."/printer.png");
 			$text_emailprint .= "<a href='".e_HTTP."print.php?".$print.".".$id."'><img src='".$ico_print."' style='border:0' alt='".LAN_PRINT_1."' title='".LAN_PRINT_1."' /></a>";
 		}
 		return $text_emailprint;
diff -x .svn -aruN 0.7.24.src/e107_handlers/emote.php 0.7.26.src/e107_handlers/emote.php
--- 0.7.24.src/e107_handlers/emote.php	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_handlers/emote.php	2011-07-08 01:53:57.000000000 -0500
@@ -11,8 +11,8 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $URL: https://e107.svn.sourceforge.net/svnroot/e107/trunk/e107_0.7/e107_handlers/emote.php $
-|     $Revision: 11678 $
-|     $Id: emote.php 11678 2010-08-22 00:43:45Z e107coders $
+|     $Revision: 12317 $
+|     $Id: emote.php 12317 2011-07-08 06:54:21Z e107coders $
 |     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
@@ -38,7 +38,8 @@
 		$value2 = substr($value, 0, strpos($value, " "));
 		$value = ($value2 ? $value2 : $value);
 		$value = ($value == '&|') ? ':((' : $value;
-		$str .= "\n<a href=\"javascript:addtext('$value',true)\"><img src='$key' style='border:0; padding-top:2px;' alt='' /></a> ";
+
+		$str .= "\n<a href=\"javascript:addtext(' $value ',true)\"><img src='$key' style='border:0; padding-top:2px;' alt='' /></a> ";
 	}
 
 	return "<div class='spacer'>".$str."</div>";
diff -x .svn -aruN 0.7.24.src/e107_handlers/e_parse_class.php 0.7.26.src/e107_handlers/e_parse_class.php
--- 0.7.24.src/e107_handlers/e_parse_class.php	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_handlers/e_parse_class.php	2011-07-13 14:42:41.000000000 -0500
@@ -11,8 +11,8 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $URL: https://e107.svn.sourceforge.net/svnroot/e107/trunk/e107_0.7/e107_handlers/e_parse_class.php $
-|     $Revision: 11804 $
-|     $Id: e_parse_class.php 11804 2010-09-21 07:38:40Z e107steved $
+|     $Revision: 12319 $
+|     $Id: e_parse_class.php 12319 2011-07-13 19:43:05Z e107steved $
 |     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
@@ -86,11 +86,23 @@
 				'body' =>					// text is 'body' or 'bulk' text (e.g. custom page body, content body)
 					array(
 						// no changes to default-on items
-						'defs'=>TRUE, 'constants'=>TRUE, 'parse_sc'=>TRUE),
+						//'defs'=>TRUE, 'constants'=>TRUE, 'parse_sc'=>TRUE),
+						'defs'=>TRUE, 'constants'=>'full', 'parse_sc'=>TRUE),
 
 				'user_body' =>					// text is user-entered (i.e. untrusted)'body' or 'bulk' text (e.g. custom page body, content body)
 					array(
-						'constants'=>TRUE
+						'constants'=>'full'
+						),
+
+				// text is 'body' of email or similar - being sent 'off-site' so don't rely on server availability
+				'e_body' =>
+					array(
+						'defs'=>TRUE, 'constants'=>'full', 'parse_sc'=>TRUE,'emotes_off'=>TRUE, 'link_click' => FALSE
+						),
+				// text is text-only 'body' of email or similar - being sent 'off-site' so don't rely on server availability
+				'e_body_plain' =>
+					array(
+						'defs'=>TRUE, 'constants'=>'full', 'parse_sc'=>TRUE,'emotes_off'=>TRUE, 'link_click' => FALSE, 'retain_nl' => TRUE, 'no_tags' => TRUE
 						),
 
 				'linktext' =>			// text is the 'content' of a link (A tag, etc)
@@ -159,6 +171,10 @@
 			{
 				$no_encode = TRUE;
 			}
+			if (!isset($pref['html_abuse']) || $pref['html_abuse'])
+			{
+				if ($this->htmlAbuseFilter($data)) $no_encode = FALSE;
+			}
 			if ($no_encode === TRUE && $mod != 'no_html')
 			{
 				$search = array('$', '"', "'", '\\', '<?');
@@ -182,11 +198,46 @@
 
 
 
+	/**
+	 *	Check for HTML closing tag for input elements, without corresponding opening tag
+	 *
+	 *	@param string $data
+	 *	@param string $tagList - if empty, uses default list of input tags. Otherwise a CSV list of tags to check (any type)
+	 *
+	 *	@return boolean TRUE if an unopened closing tag found
+	 *					FALSE if nothing found
+	 */
+	function htmlAbuseFilter($data, $tagList = '')
+	{
+		if ($tagList == '')
+		{
+			$checkTags = array('textarea', 'input', 'td', 'tr', 'table');
+		}
+		else
+		{
+			$checkTags = explode(',', $tagList);
+		}
+		$data = preg_replace('#\[code\].*?\[\/code\]#i', '', $data);		// Ignore code blocks
+		foreach ($checkTags as $tag)
+		{
+			if (($pos = stripos($data, '</'.$tag)) !== FALSE)
+			{
+				if ((($bPos = stripos($data, '<'.$tag )) === FALSE) || ($bPos > $pos))
+				{
+					return TRUE;		// Potentially abusive HTML found
+				}
+			}
+		}
+		return FALSE;		// Nothing detected
+	}
+
+
+
 	function dataFilter($data)
 	{
 		$ans = '';
 		$vetWords = array('<applet', '<body', '<embed', '<frame', '<script', '<frameset', '<html', '<iframe', 
-					'<style', '<layer', '<link', '<ilayer', '<meta', '<object', 'javascript:', 'vbscript:');
+					'<style', '<layer', '<link', '<ilayer', '<meta', '<object', '<plaintext', 'javascript:', 'vbscript:');
 
 		$ret = preg_split('#(\[code.*?\[/code.*?])#mis', $data, -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE );
 
@@ -219,12 +270,24 @@
 					$s = preg_replace_callback('#('.implode('|', $vl).')#mis', array($this, 'modtag'), $t);
 				}
 			}
+			$s = preg_replace('#(?:onmouse.+?|onclick|onfocus)\s*?\=#i', '[sanitised]$0[/sanitised]', $s);
+			$s = preg_replace_callback('#base64([,\(])(.+?)([\)\'\"])#mis', array($this, 'proc64'), $s);
 			$ans .= $s;
 		}
 		return $ans;
 	}
 
 
+	/**
+	 * Check base-64 encoded code
+	 */
+	function proc64($match)
+	{
+		$decode = base64_decode($match[2]);
+		return 'base64'.$match[1].base64_encode($this->dataFilter($decode)).$match[3];
+	}
+
+
 	function modTag($match)
 	{
 		$ans = '';
@@ -837,7 +900,18 @@
 	}
 
 
-	function toHTML($text, $parseBB = FALSE, $modifiers = "", $postID = "", $wrap=FALSE) {
+
+
+
+	/**
+	 *		HTML Parser function - converts DB-stored text for display
+	 *
+	 *	@param integer|boolean $wrap - if false, no word wrap is performed
+	 *				- if numeric, value used as maximum length of a word
+	 *				- if non-boolean evaluating to false, set to configured value of word wrap for pages
+	 */
+	function toHTML($text, $parseBB = FALSE, $modifiers = "", $postID = "", $wrap=FALSE) 
+	{
 		if ($text == '')
 		{
 			return $text;
@@ -926,7 +1000,7 @@
 		}
 
 
-		if(!$wrap && $pref['main_wordwrap']) $wrap = $pref['main_wordwrap'];
+		if (($wrap !== FALSE) && !$wrap && $pref['main_wordwrap']) $wrap = $pref['main_wordwrap'];
         $text = " ".$text;
 
 
@@ -944,23 +1018,24 @@
 		{
             if ($pref['link_replace'] && !$opts['no_replace'])
 			{
-              $_ext = ($pref['links_new_window'] ? " rel=\"external\"" : "");
-// 			  $text = preg_replace("#(^|[\n ])([\w]+?://[^ \"\n\r\t<,]*)#is", "\\1<a href=\"\\2\" {$_ext}>".$pref['link_text']."</a>", $text);
-              $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);
+				$_ext = ($pref['links_new_window'] ? " rel=\"external\"" : "");
+//				$text = preg_replace("#(^|[\s])([\w]+?://(?:[\w-%]+?)(?:\.[\w-%]+?)+.*?)(?=$|[\s()[\]<]|\.\s|\.$|,\s|,$)#is", "\\1<a href=\"\\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);
+				$text = preg_replace("#(^|[\s])([\w]+?://(?:[\w-%]+?)(?:\.[\w-%]+?)+.*?)(?=$|[\s[\]<]|\.\s|\.$|,\s|,$)#is", "\\1<a href=\"\\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);
 
-			  $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);
+				$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("#(^|[\s])([\w]+?://(?:[\w-%]+?)(?:\.[\w-%]+?)+.*?)(?=$|[\s()[\]<]|\.\s|\.$|,\s|,$)#is", "\\1<a href=\"\\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("#(^|[\s])([\w]+?://(?:[\w-%]+?)(?:\.[\w-%]+?)+.*?)(?=$|[\s[\]<]|\.\s|\.$|,\s|,$)#is", "\\1<a href=\"\\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);
+				
 	           	$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);
 			}
         }
@@ -1019,7 +1094,7 @@
 		// replace all {e_XXX} constants with their e107 value AFTER the bbcodes have been parsed.
 		if ($opts['constants'])
 		{
-		   	$text = $this->replaceConstants($text);
+		   	$text = $this->replaceConstants($text, $opts['constants']);
 		}
 
 		// profanity filter
@@ -1141,21 +1216,21 @@
 		return $text;
 	}
 
-//
-// $nonrelative:
-//   "full" = produce absolute URL path, e.g. http://sitename.com/e107_plugins/etc
-//   TRUE = produce truncated URL path, e.g. e107plugins/etc
-//   "" (default) = URL's get relative path e.g. ../e107_plugins/etc
-//
-// $all - if TRUE, then
-//		when $nonrelative is "full" or TRUE, USERID is also replaced...
-//		when $nonrelative is "" (default), ALL other e107 constants are replaced
-//
-// only an ADMIN user can convert {e_ADMIN}
-//
+	/**
+	 * Convert e107 Path Constants (eg. {e_PLUGIN}) to real paths
+	 * @param object $text
+	 * @param object $nonrelative [optional] 
+	 * "full" = produce absolute URL path, e.g. http://sitename.com/e107_plugins/etc
+	 * TRUE = produce truncated URL path, e.g. e107plugins/etc
+	 * '' (default) = URL's get relative path e.g. ../e107_plugins/etc
+	 * @param object $all [optional] if TRUE, then
+	 * when $nonrelative is "full" or TRUE, USERID is also replaced...
+	 * when $nonrelative is "" (default) or FALSE, ALL other e107 constants are replaced
+	 * @return string
+	 */
 	function replaceConstants($text, $nonrelative = "", $all = false)
 	{
-		if($nonrelative != "")
+		if (($nonrelative != "") && ($nonrelative !== FALSE))
 		{
 			global $IMAGES_DIRECTORY, $PLUGINS_DIRECTORY, $FILES_DIRECTORY, $THEMES_DIRECTORY,$DOWNLOADS_DIRECTORY,$ADMIN_DIRECTORY;
 			$replace_relative = array("",
diff -x .svn -aruN 0.7.24.src/e107_handlers/event_class.php 0.7.26.src/e107_handlers/event_class.php
--- 0.7.24.src/e107_handlers/event_class.php	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_handlers/event_class.php	2011-02-03 01:37:06.000000000 -0600
@@ -10,8 +10,8 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $URL: https://e107.svn.sourceforge.net/svnroot/e107/trunk/e107_0.7/e107_handlers/event_class.php $
-|     $Revision: 11769 $
-|     $Id: event_class.php 11769 2010-09-09 10:03:49Z e107coders $
+|     $Revision: 12062 $
+|     $Id: event_class.php 12062 2011-02-03 07:37:30Z e107coders $
 |     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
@@ -50,6 +50,11 @@
 	 */
 	function register($eventname, $function, $include='')
 	{
+		if(!$_SESSION) 
+		{
+			$this->logData("There is no _SESSION");
+		}
+				
 		if(!isset($_SESSION['e_EVENT_functions'][$eventname])) // Notice removal
 		{
 			$_SESSION['e_EVENT_functions'][$eventname] = array();		
@@ -62,6 +67,7 @@
 		
 		if ($include!='')
 		{
+			$include = realpath($include); // make paths consistent to avoid duplicates
 			// $this->includes[$eventname][] = $include;
 			if(!in_array($include,$_SESSION['e_EVENT_includes'][$eventname]))
 			{
@@ -90,8 +96,20 @@
 			{
 				if (file_exists($evt_inc))
 				{
-					include_once($evt_inc);
+					if(!include_once($evt_inc))
+					{
+						$this->logData("Couldn't Include file: ".$evt_inc);		
+					}
+					else
+					{
+						$this->logData("Included file: ".$evt_inc);		
+					}
+				}
+				else
+				{
+					$this->logData("Couldn't find file: ".$evt_inc);	
 				}
+				
 			}
 		}
 		if (isset($this -> functions[$eventname]))
@@ -104,6 +122,7 @@
 					$this->logData($evt_func);
 					if ($ret!='')
 					{
+						$this->logData("Stopped Processing during: ".$evt_func ."(".$ret.")");
 						break;
 					}
 				}
diff -x .svn -aruN 0.7.24.src/e107_handlers/file_class.php 0.7.26.src/e107_handlers/file_class.php
--- 0.7.24.src/e107_handlers/file_class.php	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_handlers/file_class.php	2010-09-24 07:02:49.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $URL: https://e107.svn.sourceforge.net/svnroot/e107/trunk/e107_0.7/e107_handlers/file_class.php $
-|     $Revision: 11678 $
-|     $Id: file_class.php 11678 2010-08-22 00:43:45Z e107coders $
-|     $Author: e107coders $
+|     $Revision: 11819 $
+|     $Id: file_class.php 11819 2010-09-24 12:03:13Z e107steved $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 
@@ -99,7 +99,7 @@
 		}
 		if($omit == 'standard')
 		{
-			$rejectArray = array('^\.$','^\.\.$','^\/$','^CVS$','thumbs\.db','.*\._$');
+			$rejectArray = array('^\.$','^\.\.$','^\/$','^\.svn','^CVS$','thumbs\.db','.*\._$');
 		}
 		else
 		{
diff -x .svn -aruN 0.7.24.src/e107_handlers/language_class.php 0.7.26.src/e107_handlers/language_class.php
--- 0.7.24.src/e107_handlers/language_class.php	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_handlers/language_class.php	2011-02-26 13:12:34.000000000 -0600
@@ -4,8 +4,8 @@
 |     e107 website system - Language Class.
 |
 |     $URL: https://e107.svn.sourceforge.net/svnroot/e107/trunk/e107_0.7/e107_handlers/language_class.php $
-|     $Revision: 11782 $
-|     $Id: language_class.php 11782 2010-09-12 00:47:57Z e107coders $
+|     $Revision: 12076 $
+|     $Id: language_class.php 12076 2011-02-26 19:12:58Z e107coders $
 |     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
@@ -190,12 +190,14 @@
 			"ChineseSimp"  	=> "简体中文",
 			"Dutch"			=> "Nederlands",
 			"English"		=> "English",
+			"Estonian"		=> "Eesti",
 			"Finnish"		=> "Suomi",
 			"French"		=> "Français",
 			"German"		=> "Deutsch",
 			"Greek"			=> "Ελληνικά",
 			"Hebrew"		=> "עִבְרִית",
 			"Hungarian"		=> "Magyar",
+			"Indonesian"	=> "Bahasa Indonesia",
 			"Italian"		=> "Italiano",
 			"Japanese"		=> "日本語",
 			"Korean"		=> "한국어",
@@ -215,7 +217,8 @@
 			"Slovak"		=> "Slovensky",
 			"Swedish"		=> "Svenska",
 			"Thai"			=> "ภาษาไทย",
-			"Turkish"		=> "Türkçe"
+			"Turkish"		=> "Türkçe",
+			"Vietnamese"	=> "Tiếng Việt"
 		);
 
 
@@ -382,7 +385,10 @@
 		if(varsettrue($pref['multilanguage_subdomain']) && $this->isLangDomain(e_DOMAIN) && (defset('MULTILANG_SUBDOMAIN') !== FALSE)) 
 		{
 			$detect_language = (e_SUBDOMAIN) ? $this->isValid(e_SUBDOMAIN) : $pref['sitelanguage'];
-			e107_ini_set("session.cookie_domain", ".".e_DOMAIN); // Must be before session_start()
+			if(e_DOMAIN)
+			{
+				e107_ini_set("session.cookie_domain", ".".e_DOMAIN); // Must be before session_start()
+			}
 			define('MULTILANG_SUBDOMAIN',TRUE);
 		}
 		elseif(e_MENU && ($detect_language = $this->isValid(e_MENU))) // 
@@ -407,7 +413,10 @@
 			$detect_language = FALSE; // ie. No Change. 
 		}
 		
-		e107_ini_set("session.cookie_path", e_HTTP);
+		if(e_HTTP)
+		{
+			e107_ini_set("session.cookie_path", e_HTTP);	
+		}
 
 		
 		$this->detect = $detect_language;	
diff -x .svn -aruN 0.7.24.src/e107_handlers/login.php 0.7.26.src/e107_handlers/login.php
--- 0.7.24.src/e107_handlers/login.php	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_handlers/login.php	2011-02-08 01:38:31.000000000 -0600
@@ -12,8 +12,8 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $URL: https://e107.svn.sourceforge.net/svnroot/e107/trunk/e107_0.7/e107_handlers/login.php $
-|     $Revision: 11678 $
-|     $Id: login.php 11678 2010-08-22 00:43:45Z e107coders $
+|     $Revision: 12065 $
+|     $Id: login.php 12065 2011-02-08 07:38:55Z e107coders $
 |     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
@@ -118,6 +118,7 @@
 				$user_name = $lode['user_name'];
 				$user_xup = $lode['user_xup'];
 				$user_admin = $lode['user_admin'];
+				$user_email = $lode['user_email'];
 
 				/* restrict more than one person logging in using same us/pw */
 				if($pref['disallowMultiLogin']) {
@@ -143,7 +144,8 @@
 						cookie($pref['cookie_name'], $cookieval);
 					}
 				}
-				$edata_li = array("user_id" => $user_id, "user_name" => $username, "user_admin"=> $user_admin);
+				$edata_li = array("user_id" => $user_id, "user_name" => $username, "user_admin"=> $user_admin, "user_email"=> $user_email);
+				
 				$e_event->trigger("login", $edata_li);
 				$redir = str_replace('&amp;','&',(e_QUERY ? e_SELF."?".e_QUERY : e_SELF));
 
@@ -216,4 +218,4 @@
 	}
 }
 
-?>
+?>
\ No newline at end of file
diff -x .svn -aruN 0.7.24.src/e107_handlers/mail.php 0.7.26.src/e107_handlers/mail.php
--- 0.7.24.src/e107_handlers/mail.php	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_handlers/mail.php	2011-02-26 13:11:30.000000000 -0600
@@ -11,14 +11,16 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $URL: https://e107.svn.sourceforge.net/svnroot/e107/trunk/e107_0.7/e107_handlers/mail.php $
-|     $Revision: 11678 $
-|     $Id: mail.php 11678 2010-08-22 00:43:45Z e107coders $
+|     $Revision: 12075 $
+|     $Id: mail.php 12075 2011-02-26 19:11:54Z e107coders $
 |     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
 
 if (!defined('e107_INIT')) { exit; }
 
+/*
+Mustn't load this here - it can provoke loading of the shortcode handler before the theme and its shortcodes have been loaded.
 	if(is_readable(THEME."email_template.php"))
 	{
     	require(THEME."email_template.php");
@@ -32,6 +34,8 @@
 		$EMAIL_HEADER = $tp->parseTemplate($EMAIL_HEADER);
 		$EMAIL_FOOTER = $tp->parseTemplate($EMAIL_FOOTER);
 	}
+*/
+
 /*
 Please note that mailed attachments have been found to be corrupted using php 4.3.3
 php 4.3.6 does NOT have this problem.
@@ -102,7 +106,7 @@
 	if (preg_match('/<(font|br|a|img|b)/i', $message)) {
 		$Html = $message; // Assume html if it begins with one of these tags
 	} else {
-		$Html = htmlspecialchars($message);
+		$Html = htmlspecialchars($message,ENT_QUOTES,CHARSET);
 		$Html = preg_replace('%(http|ftp|https)(://\S+)%', '<a href="\1\2">\1\2</a>', $Html);
 		$Html = preg_replace('/([[:space:]()[{}])(www.[-a-zA-Z0-9@:%_\+.~#?&\/\/=]+)/i', '\\1<a href="http://\\2">\\2</a>', $Html);
 		$Html = preg_replace('/([_\.0-9a-z-]+@([0-9a-z][0-9a-z-]+\.)+[a-z]{2,3})/i', '<a href="mailto:\\1">\\1</a>', $Html);
@@ -211,4 +215,4 @@
 
 
 
-?>
+?>
\ No newline at end of file
diff -x .svn -aruN 0.7.24.src/e107_handlers/mysql_class.php 0.7.26.src/e107_handlers/mysql_class.php
--- 0.7.24.src/e107_handlers/mysql_class.php	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_handlers/mysql_class.php	2011-01-16 16:06:49.000000000 -0600
@@ -12,8 +12,8 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $URL: https://e107.svn.sourceforge.net/svnroot/e107/trunk/e107_0.7/e107_handlers/mysql_class.php $
-|     $Revision: 11766 $
-|     $Id: mysql_class.php 11766 2010-09-08 04:45:11Z e107coders $
+|     $Revision: 12047 $
+|     $Id: mysql_class.php 12047 2011-01-16 22:07:13Z e107coders $
 |     $Author: e107coders $
 |
 +----------------------------------------------------------------------------+
@@ -30,7 +30,7 @@
 * MySQL Abstraction class
 *
 * @package e107
-* @version $Revision: 11766 $
+* @version $Revision: 12047 $
 * @author $Author: e107coders $
 */
 class db {
@@ -333,6 +333,7 @@
 		{
 			$keyList= "`".implode("`,`", array_keys($arg))."`";
 			$valList= "'".implode("','", $arg)."'";
+			$valList = str_replace(",'NULL'",",NULL",$valList); // Handle NULL correctly. 
 			$query = "INSERT INTO `".MPREFIX."{$table}` ({$keyList}) VALUES ({$valList})";
 		}
 		else
diff -x .svn -aruN 0.7.24.src/e107_handlers/notify_class.php 0.7.26.src/e107_handlers/notify_class.php
--- 0.7.24.src/e107_handlers/notify_class.php	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_handlers/notify_class.php	2011-01-30 15:41:51.000000000 -0600
@@ -11,8 +11,8 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $URL: https://e107.svn.sourceforge.net/svnroot/e107/trunk/e107_0.7/e107_handlers/notify_class.php $
-|     $Revision: 11678 $
-|     $Id: notify_class.php 11678 2010-08-22 00:43:45Z e107coders $
+|     $Revision: 12061 $
+|     $Id: notify_class.php 12061 2011-01-30 21:42:15Z e107coders $
 |     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
@@ -22,6 +22,7 @@
 class notify {
 
 	var $notify_prefs;
+	var $debug = FALSE;
 
 	function notify() {
 		global $sysprefs, $e_event, $eArrayStorage;
@@ -39,11 +40,21 @@
 	function send($id, $subject, $message) 
 	{
 		global $sql, $tp;
+				
+		$this->logData("Initiate Send - ".$id. " :: Subject: ".$tp->toEmail($subject));
+		
 		e107_require_once(e_HANDLER.'mail.php');
 		$subject = SITENAME.': '.$subject;
 		if ($this -> notify_prefs['event'][$id]['type'] == 'main')
 		{
-			sendemail(SITEADMINEMAIL, $tp->toEmail($subject), $tp->toEmail($message));
+			if(!sendemail(SITEADMINEMAIL, $tp->toEmail($subject), $tp->toEmail($message)))
+			{
+				$this->logData("Error - ".SITEADMINEMAIL. " :: Subject: ".$tp->toEmail($subject));
+			}
+			else
+			{
+				$this->logData("Success - ".SITEADMINEMAIL. " :: Subject: ".$tp->toEmail($subject));	
+			}
 		}
 		elseif ($this -> notify_prefs['event'][$id]['type'] == 'class')
 		{
@@ -61,14 +72,45 @@
 			}
 			while ($email = $sql -> db_Fetch())
 			{
-				sendemail($email['user_email'], $tp->toEmail($subject), $tp->toEmail($message));
+				if(!sendemail($email['user_email'], $tp->toEmail($subject), $tp->toEmail($message)))
+				{
+					$this->logData("Error - ".$email['user_email']. " :: Subject: ".$tp->toEmail($subject));
+				}
+				else
+				{
+					$this->logData("Success - ".$email['user_email']. " :: Subject: ".$tp->toEmail($subject));	
+				}
 			}
 		}
 		elseif ($this -> notify_prefs['event'][$id]['type'] == 'email')
 		{
-			sendemail($this -> notify_prefs['event'][$id]['email'], $tp->toEmail($subject), $tp->toEmail($message));
+			if(!sendemail($this -> notify_prefs['event'][$id]['email'], $tp->toEmail($subject), $tp->toEmail($message)))
+			{
+				$this->logData("Error - ".$this -> notify_prefs['event'][$id]['email']. " subject: ".$tp->toEmail($subject));	
+			}
+			else
+			{
+				$this->logData("Success - ".$this -> notify_prefs['event'][$id]['email']. " :: Subject: ".$tp->toEmail($subject));	
+			}
 		}
 	}
+	
+	
+	
+	/**
+	 * Log Notify Info for debugging
+	 * @param object $message
+	 * @return 
+	 */
+	function logData($message)
+	{
+		if($this->debug == FALSE){ return; }
+		if($fp = @fopen(e_HANDLER."notify.log","a+"))
+		{	
+			$contents = @fwrite($fp, date('r')." :: ".$message ." \n");
+			@fclose($fp);
+		}			
+	}
 }
 
 global $nt;
@@ -106,9 +148,25 @@
 
 function notify_login($data) {
 	global $nt;
+	
+	$theIP = $_SERVER["REMOTE_ADDR"]." (". gethostbyaddr($_SERVER['REMOTE_ADDR']).")";
+	
+	$message = "<br /><br /><table style='width:70%'>
+	<tr><td>User ID:</td><td>".$data['user_id']."</td></tr>
+	<tr><td>Username:</td><td>".$data['user_name']."</td></tr>
+	<tr><td>Admin:</td><td>".($data['user_admin'] ? "Yes" : "No")."</td></tr>
+    <tr><td>IP:</td><td>".$theIP."</td></tr>
+	<tr><td>URL:</td><td>".$_SERVER["SCRIPT_NAME"]."</td></tr>
+	<tr><td>Referer:</td><td>".$_SERVER["HTTP_REFERER"]."</td></tr>
+	<tr><td>UserAgent:</td><td>".$_SERVER["HTTP_USER_AGENT"]."</td></tr>
+    <tr><td>Time:</td><td>".date("r")."</td></tr>";
+	
+	/*	
 	foreach ($data as $key => $value) {
 		$message .= $key.': '.$value.'<br />';
 	}
+	*/
+	
 	$nt -> send('login', NT_LAN_LI_1, $message);
 }
 
@@ -124,10 +182,22 @@
 
 function notify_subnews($data) {
 	global $nt,$tp;
-	foreach ($data as $key => $value) {
+	foreach ($data as $key => $value)
+	{
 		$message .= $key.': '.$value.'<br />';
 	}
-	$nt -> send('subnews', NT_LAN_SN_1, $message);
+	
+	if($data['image'])
+	{
+		$tmp = explode(",",$data['image']);
+		foreach($tmp as $image)
+		{
+			$message .= "<br /><img src='{e_IMAGE}newspost_images/".$image."' alt='' /><br />";
+			$message .= "src: {e_IMAGE}newspost_images/".$image;	
+		}
+	}
+		
+	$nt -> send('subnews', NT_LAN_SN_1." : ".$data['itemtitle'], $message);
 }
 
 function notify_newspost($data) {
@@ -166,6 +236,8 @@
 	$nt -> send('fileupload', $data['upload_name'], $message);
 }
 
+
+
 if (isset($nt -> notify_prefs['plugins'])) {
 	foreach ($nt -> notify_prefs['plugins'] as $plugin_id => $plugin_settings) {
 		if(is_readable(e_PLUGIN.$plugin_id.'/e_notify.php'))
diff -x .svn -aruN 0.7.24.src/e107_handlers/pclzip.lib.php 0.7.26.src/e107_handlers/pclzip.lib.php
--- 0.7.24.src/e107_handlers/pclzip.lib.php	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_handlers/pclzip.lib.php	2010-10-21 08:07:59.000000000 -0500
@@ -1,5209 +1,5696 @@
-<?php
-if (!defined('e107_INIT')) { exit; }
-
-// --------------------------------------------------------------------------------
-// PhpConcept Library - Zip Module 2.3
-// --------------------------------------------------------------------------------
-// License GNU/LGPL - Vincent Blavet - November 2004
-// http://www.phpconcept.net
-// --------------------------------------------------------------------------------
-//
-// Presentation :
-//   PclZip is a PHP library that manage ZIP archives.
-//   So far tests show that archives generated by PclZip are readable by
-//   WinZip application and other tools.
-//
-// Description :
-//   See readme.txt and http://www.phpconcept.net
-//
-// Warning :
-//   This library and the associated files are non commercial, non professional
-//   work.
-//   It should not have unexpected results. However if any damage is caused by
-//   this software the author can not be responsible.
-//   The use of this software is at the risk of the user.
-//
-// --------------------------------------------------------------------------------
-// $Id: pclzip.lib.php 11346 2010-02-17 18:56:14Z secretr $
-// --------------------------------------------------------------------------------
-
-  // ----- Constants
-  define( 'PCLZIP_READ_BLOCK_SIZE', 2048 );
-  
-  // ----- File list separator
-  // In version 1.x of PclZip, the separator for file list is a space
-  // (which is not a very smart choice, specifically for windows paths !).
-  // A better separator should be a comma (,). This constant gives you the
-  // abilty to change that.
-  // However notice that changing this value, may have impact on existing
-  // scripts, using space separated filenames.
-  // Recommanded values for compatibility with older versions :
-  //define( 'PCLZIP_SEPARATOR', ' ' );
-  // Recommanded values for smart separation of filenames.
-  define( 'PCLZIP_SEPARATOR', ',' );
-
-  // ----- Error configuration
-  // 0 : PclZip Class integrated error handling
-  // 1 : PclError external library error handling. By enabling this
-  //     you must ensure that you have included PclError library.
-  // [2,...] : reserved for futur use
-  define( 'PCLZIP_ERROR_EXTERNAL', 0 );
-
-  // ----- Optional static temporary directory
-  //       By default temporary files are generated in the script current
-  //       path.
-  //       If defined :
-  //       - MUST BE terminated by a '/'.
-  //       - MUST be a valid, already created directory
-  //       Samples :
-  // define( 'PCLZIP_TEMPORARY_DIR', '/temp/' );
-  // define( 'PCLZIP_TEMPORARY_DIR', 'C:/Temp/' );
-  define( 'PCLZIP_TEMPORARY_DIR', '' );
-
-// --------------------------------------------------------------------------------
-// ***** UNDER THIS LINE NOTHING NEEDS TO BE MODIFIED *****
-// --------------------------------------------------------------------------------
-
-  // ----- Global variables
-  $g_pclzip_version = "2.3";
-
-  // ----- Error codes
-  //   -1 : Unable to open file in binary write mode
-  //   -2 : Unable to open file in binary read mode
-  //   -3 : Invalid parameters
-  //   -4 : File does not exist
-  //   -5 : Filename is too long (max. 255)
-  //   -6 : Not a valid zip file
-  //   -7 : Invalid extracted file size
-  //   -8 : Unable to create directory
-  //   -9 : Invalid archive extension
-  //  -10 : Invalid archive format
-  //  -11 : Unable to delete file (unlink)
-  //  -12 : Unable to rename file (rename)
-  //  -13 : Invalid header checksum
-  //  -14 : Invalid archive size
-  define( 'PCLZIP_ERR_USER_ABORTED', 2 );
-  define( 'PCLZIP_ERR_NO_ERROR', 0 );
-  define( 'PCLZIP_ERR_WRITE_OPEN_FAIL', -1 );
-  define( 'PCLZIP_ERR_READ_OPEN_FAIL', -2 );
-  define( 'PCLZIP_ERR_INVALID_PARAMETER', -3 );
-  define( 'PCLZIP_ERR_MISSING_FILE', -4 );
-  define( 'PCLZIP_ERR_FILENAME_TOO_LONG', -5 );
-  define( 'PCLZIP_ERR_INVALID_ZIP', -6 );
-  define( 'PCLZIP_ERR_BAD_EXTRACTED_FILE', -7 );
-  define( 'PCLZIP_ERR_DIR_CREATE_FAIL', -8 );
-  define( 'PCLZIP_ERR_BAD_EXTENSION', -9 );
-  define( 'PCLZIP_ERR_BAD_FORMAT', -10 );
-  define( 'PCLZIP_ERR_DELETE_FILE_FAIL', -11 );
-  define( 'PCLZIP_ERR_RENAME_FILE_FAIL', -12 );
-  define( 'PCLZIP_ERR_BAD_CHECKSUM', -13 );
-  define( 'PCLZIP_ERR_INVALID_ARCHIVE_ZIP', -14 );
-  define( 'PCLZIP_ERR_MISSING_OPTION_VALUE', -15 );
-  define( 'PCLZIP_ERR_INVALID_OPTION_VALUE', -16 );
-  define( 'PCLZIP_ERR_ALREADY_A_DIRECTORY', -17 );
-  define( 'PCLZIP_ERR_UNSUPPORTED_COMPRESSION', -18 );
-  define( 'PCLZIP_ERR_UNSUPPORTED_ENCRYPTION', -19 );
-
-  // ----- Options values
-  define( 'PCLZIP_OPT_PATH', 77001 );
-  define( 'PCLZIP_OPT_ADD_PATH', 77002 );
-  define( 'PCLZIP_OPT_REMOVE_PATH', 77003 );
-  define( 'PCLZIP_OPT_REMOVE_ALL_PATH', 77004 );
-  define( 'PCLZIP_OPT_SET_CHMOD', 77005 );
-  define( 'PCLZIP_OPT_EXTRACT_AS_STRING', 77006 );
-  define( 'PCLZIP_OPT_NO_COMPRESSION', 77007 );
-  define( 'PCLZIP_OPT_BY_NAME', 77008 );
-  define( 'PCLZIP_OPT_BY_INDEX', 77009 );
-  define( 'PCLZIP_OPT_BY_EREG', 77010 );
-  define( 'PCLZIP_OPT_BY_PREG', 77011 );
-  define( 'PCLZIP_OPT_COMMENT', 77012 );
-  define( 'PCLZIP_OPT_ADD_COMMENT', 77013 );
-  define( 'PCLZIP_OPT_PREPEND_COMMENT', 77014 );
-  define( 'PCLZIP_OPT_EXTRACT_IN_OUTPUT', 77015 );
-  define( 'PCLZIP_OPT_REPLACE_NEWER', 77016 );
-  define( 'PCLZIP_OPT_STOP_ON_ERROR', 77017 );
-  // Having big trouble with crypt. Need to multiply 2 long int
-  // which is not correctly supported by PHP ...
-  //define( 'PCLZIP_OPT_CRYPT', 77018 );
-
-  // ----- Call backs values
-  define( 'PCLZIP_CB_PRE_EXTRACT', 78001 );
-  define( 'PCLZIP_CB_POST_EXTRACT', 78002 );
-  define( 'PCLZIP_CB_PRE_ADD', 78003 );
-  define( 'PCLZIP_CB_POST_ADD', 78004 );
-  /* For futur use
-  define( 'PCLZIP_CB_PRE_LIST', 78005 );
-  define( 'PCLZIP_CB_POST_LIST', 78006 );
-  define( 'PCLZIP_CB_PRE_DELETE', 78007 );
-  define( 'PCLZIP_CB_POST_DELETE', 78008 );
-  */
-
-  // --------------------------------------------------------------------------------
-  // Class : PclZip
-  // Description :
-  //   PclZip is the class that represent a Zip archive.
-  //   The public methods allow the manipulation of the archive.
-  // Attributes :
-  //   Attributes must not be accessed directly.
-  // Methods :
-  //   PclZip() : Object creator
-  //   create() : Creates the Zip archive
-  //   listContent() : List the content of the Zip archive
-  //   extract() : Extract the content of the archive
-  //   properties() : List the properties of the archive
-  // --------------------------------------------------------------------------------
-   class PclZip
-  {
-    // ----- Filename of the zip file
-    var $zipname = '';
-
-    // ----- File descriptor of the zip file
-    var $zip_fd = 0;
-
-    // ----- Internal error handling
-    var $error_code = 1;
-    var $error_string = '';
-
-  // --------------------------------------------------------------------------------
-  // Function : PclZip()
-  // Description :
-  //   Creates a PclZip object and set the name of the associated Zip archive
-  //   filename.
-  //   Note that no real action is taken, if the archive does not exist it is not
-  //   created. Use create() for that.
-  // --------------------------------------------------------------------------------
-  function PclZip($p_zipname)
-  {
-    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, 'PclZip::PclZip', "zipname=$p_zipname");
-
-    // ----- Tests the zlib
-    if (!function_exists('gzopen'))
-    {
-      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 1, "zlib extension seems to be missing");
-      die('Abort '.basename(__FILE__).' : Missing zlib extensions');
-    }
-
-    // ----- Set the attributes
-    $this->zipname = $p_zipname;
-    $this->zip_fd = 0;
-
-    // ----- Return
-    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 1);
-    return;
-  }
-  // --------------------------------------------------------------------------------
-
-  // --------------------------------------------------------------------------------
-  // Function :
-  //   create($p_filelist, $p_add_dir="", $p_remove_dir="")
-  //   create($p_filelist, $p_option, $p_option_value, ...)
-  // Description :
-  //   This method supports two different synopsis. The first one is historical.
-  //   This method creates a Zip Archive. The Zip file is created in the
-  //   filesystem. The files and directories indicated in $p_filelist
-  //   are added in the archive. See the parameters description for the
-  //   supported format of $p_filelist.
-  //   When a directory is in the list, the directory and its content is added
-  //   in the archive.
-  //   In this synopsis, the function takes an optional variable list of
-  //   options. See bellow the supported options.
-  // Parameters :
-  //   $p_filelist : An array containing file or directory names, or
-  //                 a string containing one filename or one directory name, or
-  //                 a string containing a list of filenames and/or directory
-  //                 names separated by spaces.
-  //   $p_add_dir : A path to add before the real path of the archived file,
-  //                in order to have it memorized in the archive.
-  //   $p_remove_dir : A path to remove from the real path of the file to archive,
-  //                   in order to have a shorter path memorized in the archive.
-  //                   When $p_add_dir and $p_remove_dir are set, $p_remove_dir
-  //                   is removed first, before $p_add_dir is added.
-  // Options :
-  //   PCLZIP_OPT_ADD_PATH :
-  //   PCLZIP_OPT_REMOVE_PATH :
-  //   PCLZIP_OPT_REMOVE_ALL_PATH :
-  //   PCLZIP_OPT_COMMENT :
-  //   PCLZIP_CB_PRE_ADD :
-  //   PCLZIP_CB_POST_ADD :
-  // Return Values :
-  //   0 on failure,
-  //   The list of the added files, with a status of the add action.
-  //   (see PclZip::listContent() for list entry format)
-  // --------------------------------------------------------------------------------
-//  function create($p_filelist, $p_add_dir="", $p_remove_dir="")
-  function create($p_filelist /*, options */)
-  {
-    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, 'PclZip::create', "filelist='$p_filelist', ...");
-    $v_result=1;
-
-    // ----- Reset the error handler
-    $this->privErrorReset();
-
-    // ----- Set default values
-    $v_options = array();
-    $v_add_path = "";
-    $v_remove_path = "";
-    $v_remove_all_path = false;
-    $v_options[PCLZIP_OPT_NO_COMPRESSION] = FALSE;
-
-    // ----- Look for variable options arguments
-    $v_size = func_num_args();
-    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "$v_size arguments passed to the method");
-
-    // ----- Look for arguments
-    if ($v_size > 1) {
-      // ----- Get the arguments
-      $v_arg_list = &func_get_args();
-
-      // ----- Remove form the options list the first argument
-      array_shift($v_arg_list);
-      $v_size--;
-
-      // ----- Look for first arg
-      if ((is_integer($v_arg_list[0])) && ($v_arg_list[0] > 77000)) {
-        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Variable list of options detected");
-
-        // ----- Parse the options
-        $v_result = $this->privParseOptions($v_arg_list, $v_size, $v_options,
-                                            array (PCLZIP_OPT_REMOVE_PATH => 'optional',
-                                                   PCLZIP_OPT_REMOVE_ALL_PATH => 'optional',
-                                                   PCLZIP_OPT_ADD_PATH => 'optional',
-                                                   PCLZIP_CB_PRE_ADD => 'optional',
-                                                   PCLZIP_CB_POST_ADD => 'optional',
-                                                   PCLZIP_OPT_NO_COMPRESSION => 'optional',
-                                                   PCLZIP_OPT_COMMENT => 'optional'
-                                                   //, PCLZIP_OPT_CRYPT => 'optional'
-												   ));
-        if ($v_result != 1) {
-          //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0);
-          return 0;
-        }
-
-        // ----- Set the arguments
-        if (isset($v_options[PCLZIP_OPT_ADD_PATH])) {
-          $v_add_path = $v_options[PCLZIP_OPT_ADD_PATH];
-        }
-        if (isset($v_options[PCLZIP_OPT_REMOVE_PATH])) {
-          $v_remove_path = $v_options[PCLZIP_OPT_REMOVE_PATH];
-        }
-        if (isset($v_options[PCLZIP_OPT_REMOVE_ALL_PATH])) {
-          $v_remove_all_path = $v_options[PCLZIP_OPT_REMOVE_ALL_PATH];
-        }
-      }
-
-      // ----- Look for 2 args
-      // Here we need to support the first historic synopsis of the
-      // method.
-      else {
-        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Static synopsis");
-
-        // ----- Get the first argument
-        $v_add_path = $v_arg_list[0];
-
-        // ----- Look for the optional second argument
-        if ($v_size == 2) {
-          $v_remove_path = $v_arg_list[1];
-        }
-        else if ($v_size > 2) {
-          // ----- Error log
-          PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER,
-		                       "Invalid number / type of arguments");
-
-          // ----- Return
-          //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
-          return 0;
-        }
-      }
-    }
-
-    // ----- Trace
-    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "add_path='$v_add_path', remove_path='$v_remove_path', remove_all_path='".($v_remove_all_path?'true':'false')."'");
-
-    // ----- Look if the $p_filelist is really an array
-    $p_result_list = array();
-    if (is_array($p_filelist))
-    {
-      // ----- Call the create fct
-      $v_result = $this->privCreate($p_filelist, $p_result_list, $v_add_path, $v_remove_path, $v_remove_all_path, $v_options);
-    }
-
-    // ----- Look if the $p_filelist is a string
-    else if (is_string($p_filelist))
-    {
-      // ----- Create a list with the elements from the string
-      $v_list = explode(PCLZIP_SEPARATOR, $p_filelist);
-
-      // ----- Call the create fct
-      $v_result = $this->privCreate($v_list, $p_result_list, $v_add_path, $v_remove_path, $v_remove_all_path, $v_options);
-    }
-
-    // ----- Invalid variable
-    else
-    {
-      // ----- Error log
-      PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid variable type p_filelist");
-      $v_result = PCLZIP_ERR_INVALID_PARAMETER;
-    }
-
-    if ($v_result != 1)
-    {
-      // ----- Return
-      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0);
-      return 0;
-    }
-
-    // ----- Return
-    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $p_result_list);
-    return $p_result_list;
-  }
-  // --------------------------------------------------------------------------------
-
-  // --------------------------------------------------------------------------------
-  // Function :
-  //   add($p_filelist, $p_add_dir="", $p_remove_dir="")
-  //   add($p_filelist, $p_option, $p_option_value, ...)
-  // Description :
-  //   This method supports two synopsis. The first one is historical.
-  //   This methods add the list of files in an existing archive.
-  //   If a file with the same name already exists, it is added at the end of the
-  //   archive, the first one is still present.
-  //   If the archive does not exist, it is created.
-  // Parameters :
-  //   $p_filelist : An array containing file or directory names, or
-  //                 a string containing one filename or one directory name, or
-  //                 a string containing a list of filenames and/or directory
-  //                 names separated by spaces.
-  //   $p_add_dir : A path to add before the real path of the archived file,
-  //                in order to have it memorized in the archive.
-  //   $p_remove_dir : A path to remove from the real path of the file to archive,
-  //                   in order to have a shorter path memorized in the archive.
-  //                   When $p_add_dir and $p_remove_dir are set, $p_remove_dir
-  //                   is removed first, before $p_add_dir is added.
-  // Options :
-  //   PCLZIP_OPT_ADD_PATH :
-  //   PCLZIP_OPT_REMOVE_PATH :
-  //   PCLZIP_OPT_REMOVE_ALL_PATH :
-  //   PCLZIP_OPT_COMMENT :
-  //   PCLZIP_OPT_ADD_COMMENT :
-  //   PCLZIP_OPT_PREPEND_COMMENT :
-  //   PCLZIP_CB_PRE_ADD :
-  //   PCLZIP_CB_POST_ADD :
-  // Return Values :
-  //   0 on failure,
-  //   The list of the added files, with a status of the add action.
-  //   (see PclZip::listContent() for list entry format)
-  // --------------------------------------------------------------------------------
-//  function add($p_filelist, $p_add_dir="", $p_remove_dir="")
-  function add($p_filelist /* options */)
-  {
-    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, 'PclZip::add', "filelist='$p_filelist', ...");
-    $v_result=1;
-
-    // ----- Reset the error handler
-    $this->privErrorReset();
-
-    // ----- Set default values
-    $v_options = array();
-    $v_add_path = "";
-    $v_remove_path = "";
-    $v_remove_all_path = false;
-    $v_options[PCLZIP_OPT_NO_COMPRESSION] = FALSE;
-
-    // ----- Look for variable options arguments
-    $v_size = func_num_args();
-    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "$v_size arguments passed to the method");
-
-    // ----- Look for arguments
-    if ($v_size > 1) {
-      // ----- Get the arguments
-      $v_arg_list = &func_get_args();
-
-      // ----- Remove form the options list the first argument
-      array_shift($v_arg_list);
-      $v_size--;
-
-      // ----- Look for first arg
-      if ((is_integer($v_arg_list[0])) && ($v_arg_list[0] > 77000)) {
-        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Variable list of options detected");
-
-        // ----- Parse the options
-        $v_result = $this->privParseOptions($v_arg_list, $v_size, $v_options,
-                                            array (PCLZIP_OPT_REMOVE_PATH => 'optional',
-                                                   PCLZIP_OPT_REMOVE_ALL_PATH => 'optional',
-                                                   PCLZIP_OPT_ADD_PATH => 'optional',
-                                                   PCLZIP_CB_PRE_ADD => 'optional',
-                                                   PCLZIP_CB_POST_ADD => 'optional',
-                                                   PCLZIP_OPT_NO_COMPRESSION => 'optional',
-                                                   PCLZIP_OPT_COMMENT => 'optional',
-                                                   PCLZIP_OPT_ADD_COMMENT => 'optional',
-                                                   PCLZIP_OPT_PREPEND_COMMENT => 'optional'
-                                                   //, PCLZIP_OPT_CRYPT => 'optional'
-												   ));
-        if ($v_result != 1) {
-          //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0);
-          return 0;
-        }
-
-        // ----- Set the arguments
-        if (isset($v_options[PCLZIP_OPT_ADD_PATH])) {
-          $v_add_path = $v_options[PCLZIP_OPT_ADD_PATH];
-        }
-        if (isset($v_options[PCLZIP_OPT_REMOVE_PATH])) {
-          $v_remove_path = $v_options[PCLZIP_OPT_REMOVE_PATH];
-        }
-        if (isset($v_options[PCLZIP_OPT_REMOVE_ALL_PATH])) {
-          $v_remove_all_path = $v_options[PCLZIP_OPT_REMOVE_ALL_PATH];
-        }
-      }
-
-      // ----- Look for 2 args
-      // Here we need to support the first historic synopsis of the
-      // method.
-      else {
-        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Static synopsis");
-
-        // ----- Get the first argument
-        $v_add_path = $v_arg_list[0];
-
-        // ----- Look for the optional second argument
-        if ($v_size == 2) {
-          $v_remove_path = $v_arg_list[1];
-        }
-        else if ($v_size > 2) {
-          // ----- Error log
-          PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid number / type of arguments");
-
-          // ----- Return
-          //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
-          return 0;
-        }
-      }
-    }
-
-    // ----- Trace
-    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "add_path='$v_add_path', remove_path='$v_remove_path', remove_all_path='".($v_remove_all_path?'true':'false')."'");
-
-    // ----- Look if the $p_filelist is really an array
-    $p_result_list = array();
-    if (is_array($p_filelist))
-    {
-      // ----- Call the create fct
-      $v_result = $this->privAdd($p_filelist, $p_result_list, $v_add_path, $v_remove_path, $v_remove_all_path, $v_options);
-    }
-
-    // ----- Look if the $p_filelist is a string
-    else if (is_string($p_filelist))
-    {
-      // ----- Create a list with the elements from the string
-      $v_list = explode(PCLZIP_SEPARATOR, $p_filelist);
-
-      // ----- Call the create fct
-      $v_result = $this->privAdd($v_list, $p_result_list, $v_add_path, $v_remove_path, $v_remove_all_path, $v_options);
-    }
-
-    // ----- Invalid variable
-    else
-    {
-      // ----- Error log
-      PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid variable type p_filelist");
-      $v_result = PCLZIP_ERR_INVALID_PARAMETER;
-    }
-
-    if ($v_result != 1)
-    {
-      // ----- Return
-      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0);
-      return 0;
-    }
-
-    // ----- Return
-    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $p_result_list);
-    return $p_result_list;
-  }
-  // --------------------------------------------------------------------------------
-
-  // --------------------------------------------------------------------------------
-  // Function : listContent()
-  // Description :
-  //   This public method, gives the list of the files and directories, with their
-  //   properties.
-  //   The properties of each entries in the list are (used also in other functions) :
-  //     filename : Name of the file. For a create or add action it is the filename
-  //                given by the user. For an extract function it is the filename
-  //                of the extracted file.
-  //     stored_filename : Name of the file / directory stored in the archive.
-  //     size : Size of the stored file.
-  //     compressed_size : Size of the file's data compressed in the archive
-  //                       (without the headers overhead)
-  //     mtime : Last known modification date of the file (UNIX timestamp)
-  //     comment : Comment associated with the file
-  //     folder : true | false
-  //     index : index of the file in the archive
-  //     status : status of the action (depending of the action) :
-  //              Values are :
-  //                ok : OK !
-  //                filtered : the file / dir is not extracted (filtered by user)
-  //                already_a_directory : the file can not be extracted because a
-  //                                      directory with the same name already exists
-  //                write_protected : the file can not be extracted because a file
-  //                                  with the same name already exists and is
-  //                                  write protected
-  //                newer_exist : the file was not extracted because a newer file exists
-  //                path_creation_fail : the file is not extracted because the folder
-  //                                     does not exists and can not be created
-  //                write_error : the file was not extracted because there was a
-  //                              error while writing the file
-  //                read_error : the file was not extracted because there was a error
-  //                             while reading the file
-  //                invalid_header : the file was not extracted because of an archive
-  //                                 format error (bad file header)
-  //   Note that each time a method can continue operating when there
-  //   is an action error on a file, the error is only logged in the file status.
-  // Return Values :
-  //   0 on an unrecoverable failure,
-  //   The list of the files in the archive.
-  // --------------------------------------------------------------------------------
-  function listContent()
-  {
-    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, 'PclZip::listContent', "");
-    $v_result=1;
-
-    // ----- Reset the error handler
-    $this->privErrorReset();
-
-    // ----- Check archive
-    if (!$this->privCheckFormat()) {
-      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0);
-      return(0);
-    }
-
-    // ----- Call the extracting fct
-    $p_list = array();
-    if (($v_result = $this->privList($p_list)) != 1)
-    {
-      unset($p_list);
-      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0, PclZip::errorInfo());
-      return(0);
-    }
-
-    // ----- Return
-    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $p_list);
-    return $p_list;
-  }
-  // --------------------------------------------------------------------------------
-
-  // --------------------------------------------------------------------------------
-  // Function :
-  //   extract($p_path="./", $p_remove_path="")
-  //   extract([$p_option, $p_option_value, ...])
-  // Description :
-  //   This method supports two synopsis. The first one is historical.
-  //   This method extract all the files / directories from the archive to the
-  //   folder indicated in $p_path.
-  //   If you want to ignore the 'root' part of path of the memorized files
-  //   you can indicate this in the optional $p_remove_path parameter.
-  //   By default, if a newer file with the same name already exists, the
-  //   file is not extracted.
-  //
-  //   If both PCLZIP_OPT_PATH and PCLZIP_OPT_ADD_PATH aoptions
-  //   are used, the path indicated in PCLZIP_OPT_ADD_PATH is append
-  //   at the end of the path value of PCLZIP_OPT_PATH.
-  // Parameters :
-  //   $p_path : Path where the files and directories are to be extracted
-  //   $p_remove_path : First part ('root' part) of the memorized path
-  //                    (if any similar) to remove while extracting.
-  // Options :
-  //   PCLZIP_OPT_PATH :
-  //   PCLZIP_OPT_ADD_PATH :
-  //   PCLZIP_OPT_REMOVE_PATH :
-  //   PCLZIP_OPT_REMOVE_ALL_PATH :
-  //   PCLZIP_CB_PRE_EXTRACT :
-  //   PCLZIP_CB_POST_EXTRACT :
-  // Return Values :
-  //   0 or a negative value on failure,
-  //   The list of the extracted files, with a status of the action.
-  //   (see PclZip::listContent() for list entry format)
-  // --------------------------------------------------------------------------------
-  //function extract($p_path="./", $p_remove_path="")
-  function extract(/* options */)
-  {
-    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::extract", "");
-    $v_result=1;
-
-    // ----- Reset the error handler
-    $this->privErrorReset();
-
-    // ----- Check archive
-    if (!$this->privCheckFormat()) {
-      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0);
-      return(0);
-    }
-
-    // ----- Set default values
-    $v_options = array();
-    $v_path = "./";
-    $v_remove_path = "";
-    $v_remove_all_path = false;
-
-    // ----- Look for variable options arguments
-    $v_size = func_num_args();
-    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "$v_size arguments passed to the method");
-
-    // ----- Default values for option
-    $v_options[PCLZIP_OPT_EXTRACT_AS_STRING] = FALSE;
-
-    // ----- Look for arguments
-    if ($v_size > 0) {
-      // ----- Get the arguments
-      $v_arg_list = &func_get_args();
-
-      // ----- Look for first arg
-      if ((is_integer($v_arg_list[0])) && ($v_arg_list[0] > 77000)) {
-        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Variable list of options");
-
-        // ----- Parse the options
-        $v_result = $this->privParseOptions($v_arg_list, $v_size, $v_options,
-                                            array (PCLZIP_OPT_PATH => 'optional',
-                                                   PCLZIP_OPT_REMOVE_PATH => 'optional',
-                                                   PCLZIP_OPT_REMOVE_ALL_PATH => 'optional',
-                                                   PCLZIP_OPT_ADD_PATH => 'optional',
-                                                   PCLZIP_CB_PRE_EXTRACT => 'optional',
-                                                   PCLZIP_CB_POST_EXTRACT => 'optional',
-                                                   PCLZIP_OPT_SET_CHMOD => 'optional',
-                                                   PCLZIP_OPT_BY_NAME => 'optional',
-                                                   PCLZIP_OPT_BY_EREG => 'optional',
-                                                   PCLZIP_OPT_BY_PREG => 'optional',
-                                                   PCLZIP_OPT_BY_INDEX => 'optional',
-                                                   PCLZIP_OPT_EXTRACT_AS_STRING => 'optional',
-                                                   PCLZIP_OPT_EXTRACT_IN_OUTPUT => 'optional',
-                                                   PCLZIP_OPT_REPLACE_NEWER => 'optional'
-                                                   ,PCLZIP_OPT_STOP_ON_ERROR => 'optional'
-												    ));
-        if ($v_result != 1) {
-          //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0);
-          return 0;
-        }
-
-        // ----- Set the arguments
-        if (isset($v_options[PCLZIP_OPT_PATH])) {
-          $v_path = $v_options[PCLZIP_OPT_PATH];
-        }
-        if (isset($v_options[PCLZIP_OPT_REMOVE_PATH])) {
-          $v_remove_path = $v_options[PCLZIP_OPT_REMOVE_PATH];
-        }
-        if (isset($v_options[PCLZIP_OPT_REMOVE_ALL_PATH])) {
-          $v_remove_all_path = $v_options[PCLZIP_OPT_REMOVE_ALL_PATH];
-        }
-        if (isset($v_options[PCLZIP_OPT_ADD_PATH])) {
-          // ----- Check for '/' in last path char
-          if ((strlen($v_path) > 0) && (substr($v_path, -1) != '/')) {
-            $v_path .= '/';
-          }
-          $v_path .= $v_options[PCLZIP_OPT_ADD_PATH];
-        }
-      }
-
-      // ----- Look for 2 args
-      // Here we need to support the first historic synopsis of the
-      // method.
-      else {
-        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Static synopsis");
-
-        // ----- Get the first argument
-        $v_path = $v_arg_list[0];
-
-        // ----- Look for the optional second argument
-        if ($v_size == 2) {
-          $v_remove_path = $v_arg_list[1];
-        }
-        else if ($v_size > 2) {
-          // ----- Error log
-          PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid number / type of arguments");
-
-          // ----- Return
-          //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0, PclZip::errorInfo());
-          return 0;
-        }
-      }
-    }
-
-    // ----- Trace
-    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "path='$v_path', remove_path='$v_remove_path', remove_all_path='".($v_remove_path?'true':'false')."'");
-
-    // ----- Call the extracting fct
-    $p_list = array();
-    $v_result = $this->privExtractByRule($p_list, $v_path, $v_remove_path,
-	                                     $v_remove_all_path, $v_options);
-    if ($v_result < 1) {
-      unset($p_list);
-      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0, PclZip::errorInfo());
-      return(0);
-    }
-
-    // ----- Return
-    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $p_list);
-    return $p_list;
-  }
-  // --------------------------------------------------------------------------------
-
-
-  // --------------------------------------------------------------------------------
-  // Function :
-  //   extractByIndex($p_index, $p_path="./", $p_remove_path="")
-  //   extractByIndex($p_index, [$p_option, $p_option_value, ...])
-  // Description :
-  //   This method supports two synopsis. The first one is historical.
-  //   This method is doing a partial extract of the archive.
-  //   The extracted files or folders are identified by their index in the
-  //   archive (from 0 to n).
-  //   Note that if the index identify a folder, only the folder entry is
-  //   extracted, not all the files included in the archive.
-  // Parameters :
-  //   $p_index : A single index (integer) or a string of indexes of files to
-  //              extract. The form of the string is "0,4-6,8-12" with only numbers
-  //              and '-' for range or ',' to separate ranges. No spaces or ';'
-  //              are allowed.
-  //   $p_path : Path where the files and directories are to be extracted
-  //   $p_remove_path : First part ('root' part) of the memorized path
-  //                    (if any similar) to remove while extracting.
-  // Options :
-  //   PCLZIP_OPT_PATH :
-  //   PCLZIP_OPT_ADD_PATH :
-  //   PCLZIP_OPT_REMOVE_PATH :
-  //   PCLZIP_OPT_REMOVE_ALL_PATH :
-  //   PCLZIP_OPT_EXTRACT_AS_STRING : The files are extracted as strings and
-  //     not as files.
-  //     The resulting content is in a new field 'content' in the file
-  //     structure.
-  //     This option must be used alone (any other options are ignored).
-  //   PCLZIP_CB_PRE_EXTRACT :
-  //   PCLZIP_CB_POST_EXTRACT :
-  // Return Values :
-  //   0 on failure,
-  //   The list of the extracted files, with a status of the action.
-  //   (see PclZip::listContent() for list entry format)
-  // --------------------------------------------------------------------------------
-  function extractByIndex($p_index /* $options */)
-  {
-    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::extractByIndex", "index='$p_index', ...");
-    $v_result=1;
-
-    // ----- Reset the error handler
-    $this->privErrorReset();
-
-    // ----- Check archive
-    if (!$this->privCheckFormat()) {
-      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0);
-      return(0);
-    }
-
-    // ----- Set default values
-    $v_options = array();
-    $v_path = "./";
-    $v_remove_path = "";
-    $v_remove_all_path = false;
-
-    // ----- Look for variable options arguments
-    $v_size = func_num_args();
-    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "$v_size arguments passed to the method");
-
-    // ----- Default values for option
-    $v_options[PCLZIP_OPT_EXTRACT_AS_STRING] = FALSE;
-
-    // ----- Look for arguments
-    if ($v_size > 1) {
-      // ----- Get the arguments
-      $v_arg_list = &func_get_args();
-
-      // ----- Remove form the options list the first argument
-      array_shift($v_arg_list);
-      $v_size--;
-
-      // ----- Look for first arg
-      if ((is_integer($v_arg_list[0])) && ($v_arg_list[0] > 77000)) {
-        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Variable list of options");
-
-        // ----- Parse the options
-        $v_result = $this->privParseOptions($v_arg_list, $v_size, $v_options,
-                                            array (PCLZIP_OPT_PATH => 'optional',
-                                                   PCLZIP_OPT_REMOVE_PATH => 'optional',
-                                                   PCLZIP_OPT_REMOVE_ALL_PATH => 'optional',
-                                                   PCLZIP_OPT_EXTRACT_AS_STRING => 'optional',
-                                                   PCLZIP_OPT_ADD_PATH => 'optional',
-                                                   PCLZIP_CB_PRE_EXTRACT => 'optional',
-                                                   PCLZIP_CB_POST_EXTRACT => 'optional',
-                                                   PCLZIP_OPT_SET_CHMOD => 'optional',
-                                                   PCLZIP_OPT_REPLACE_NEWER => 'optional'
-                                                   ,PCLZIP_OPT_STOP_ON_ERROR => 'optional'
-												   ));
-        if ($v_result != 1) {
-          //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0);
-          return 0;
-        }
-
-        // ----- Set the arguments
-        if (isset($v_options[PCLZIP_OPT_PATH])) {
-          $v_path = $v_options[PCLZIP_OPT_PATH];
-        }
-        if (isset($v_options[PCLZIP_OPT_REMOVE_PATH])) {
-          $v_remove_path = $v_options[PCLZIP_OPT_REMOVE_PATH];
-        }
-        if (isset($v_options[PCLZIP_OPT_REMOVE_ALL_PATH])) {
-          $v_remove_all_path = $v_options[PCLZIP_OPT_REMOVE_ALL_PATH];
-        }
-        if (isset($v_options[PCLZIP_OPT_ADD_PATH])) {
-          // ----- Check for '/' in last path char
-          if ((strlen($v_path) > 0) && (substr($v_path, -1) != '/')) {
-            $v_path .= '/';
-          }
-          $v_path .= $v_options[PCLZIP_OPT_ADD_PATH];
-        }
-        if (!isset($v_options[PCLZIP_OPT_EXTRACT_AS_STRING])) {
-          $v_options[PCLZIP_OPT_EXTRACT_AS_STRING] = FALSE;
-          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Option PCLZIP_OPT_EXTRACT_AS_STRING not set.");
-        }
-        else {
-            //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Option PCLZIP_OPT_EXTRACT_AS_STRING set.");
-        }
-      }
-
-      // ----- Look for 2 args
-      // Here we need to support the first historic synopsis of the
-      // method.
-      else {
-        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Static synopsis");
-
-        // ----- Get the first argument
-        $v_path = $v_arg_list[0];
-
-        // ----- Look for the optional second argument
-        if ($v_size == 2) {
-          $v_remove_path = $v_arg_list[1];
-        }
-        else if ($v_size > 2) {
-          // ----- Error log
-          PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid number / type of arguments");
-
-          // ----- Return
-          //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
-          return 0;
-        }
-      }
-    }
-
-    // ----- Trace
-    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "index='$p_index', path='$v_path', remove_path='$v_remove_path', remove_all_path='".($v_remove_path?'true':'false')."'");
-
-    // ----- Trick
-    // Here I want to reuse extractByRule(), so I need to parse the $p_index
-    // with privParseOptions()
-    $v_arg_trick = array (PCLZIP_OPT_BY_INDEX, $p_index);
-    $v_options_trick = array();
-    $v_result = $this->privParseOptions($v_arg_trick, sizeof($v_arg_trick), $v_options_trick,
-                                        array (PCLZIP_OPT_BY_INDEX => 'optional' ));
-    if ($v_result != 1) {
-        //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0);
-        return 0;
-    }
-    $v_options[PCLZIP_OPT_BY_INDEX] = $v_options_trick[PCLZIP_OPT_BY_INDEX];
-
-    // ----- Call the extracting fct
-    if (($v_result = $this->privExtractByRule($p_list, $v_path, $v_remove_path, $v_remove_all_path, $v_options)) < 1) {
-        //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0, PclZip::errorInfo());
-        return(0);
-    }
-
-    // ----- Return
-    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $p_list);
-    return $p_list;
-  }
-  // --------------------------------------------------------------------------------
-
-  // --------------------------------------------------------------------------------
-  // Function :
-  //   delete([$p_option, $p_option_value, ...])
-  // Description :
-  // Parameters :
-  //   None
-  // Options :
-  //   PCLZIP_OPT_BY_INDEX :
-  // Return Values :
-  //   0 on failure,
-  //   The list of the files which are still present in the archive.
-  //   (see PclZip::listContent() for list entry format)
-  // --------------------------------------------------------------------------------
-  function delete(/* options */)
-  {
-    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::delete", "");
-    $v_result=1;
-
-    // ----- Reset the error handler
-    $this->privErrorReset();
-
-    // ----- Check archive
-    if (!$this->privCheckFormat()) {
-      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0);
-      return(0);
-    }
-
-    // ----- Set default values
-    $v_options = array();
-
-    // ----- Look for variable options arguments
-    $v_size = func_num_args();
-    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "$v_size arguments passed to the method");
-
-    // ----- Look for no arguments
-    if ($v_size <= 0) {
-        // ----- Error log
-        PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Missing arguments");
-
-        // ----- Return
-        //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0, PclZip::errorInfo());
-        return 0;
-    }
-
-    // ----- Get the arguments
-    $v_arg_list = &func_get_args();
-
-    // ----- Parse the options
-    $v_result = $this->privParseOptions($v_arg_list, $v_size, $v_options,
-                                        array (PCLZIP_OPT_BY_NAME => 'optional',
-                                               PCLZIP_OPT_BY_EREG => 'optional',
-                                               PCLZIP_OPT_BY_PREG => 'optional',
-                                               PCLZIP_OPT_BY_INDEX => 'optional' ));
-    if ($v_result != 1) {
-        //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0);
-        return 0;
-    }
-
-    // ----- Check that at least one rule is set
-    if (   (!isset($v_options[PCLZIP_OPT_BY_NAME]))
-        && (!isset($v_options[PCLZIP_OPT_BY_EREG]))
-        && (!isset($v_options[PCLZIP_OPT_BY_PREG]))
-        && (!isset($v_options[PCLZIP_OPT_BY_INDEX]))) {
-        // ----- Error log
-        PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "At least one filtering rule must be set");
-
-        // ----- Return
-        //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0, PclZip::errorInfo());
-        return 0;
-    }
-
-    // ----- Call the delete fct
-    $v_list = array();
-    if (($v_result = $this->privDeleteByRule($v_list, $v_options)) != 1)
-    {
-      unset($v_list);
-      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0, PclZip::errorInfo());
-      return(0);
-    }
-
-    // ----- Return
-    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_list);
-    return $v_list;
-  }
-  // --------------------------------------------------------------------------------
-
-  // --------------------------------------------------------------------------------
-  // Function : deleteByIndex()
-  // Description :
-  //   ***** Deprecated *****
-  //   delete(PCLZIP_OPT_BY_INDEX, $p_index) should be prefered.
-  // --------------------------------------------------------------------------------
-  function deleteByIndex($p_index)
-  {
-    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::deleteByIndex", "index='$p_index'");
-    
-    $p_list = $this->delete(PCLZIP_OPT_BY_INDEX, $p_index);
-
-    // ----- Return
-    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $p_list);
-    return $p_list;
-  }
-  // --------------------------------------------------------------------------------
-
-  // --------------------------------------------------------------------------------
-  // Function : properties()
-  // Description :
-  //   This method gives the properties of the archive.
-  //   The properties are :
-  //     nb : Number of files in the archive
-  //     comment : Comment associated with the archive file
-  //     status : not_exist, ok
-  // Parameters :
-  //   None
-  // Return Values :
-  //   0 on failure,
-  //   An array with the archive properties.
-  // --------------------------------------------------------------------------------
-  function properties()
-  {
-    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::properties", "");
-
-    // ----- Reset the error handler
-    $this->privErrorReset();
-
-    // ----- Check archive
-    if (!$this->privCheckFormat()) {
-      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0);
-      return(0);
-    }
-
-    // ----- Default properties
-    $v_prop = array();
-    $v_prop['comment'] = '';
-    $v_prop['nb'] = 0;
-    $v_prop['status'] = 'not_exist';
-
-    // ----- Look if file exists
-    if (@is_file($this->zipname))
-    {
-      // ----- Open the zip file
-      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Open file in binary read mode");
-      if (($this->zip_fd = @fopen($this->zipname, 'rb')) == 0)
-      {
-        // ----- Error log
-        PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open archive \''.$this->zipname.'\' in binary read mode');
-
-        // ----- Return
-        //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), 0);
-        return 0;
-      }
-
-      // ----- Read the central directory informations
-      $v_central_dir = array();
-      if (($v_result = $this->privReadEndCentralDir($v_central_dir)) != 1)
-      {
-        //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0);
-        return 0;
-      }
-
-      // ----- Close the zip file
-      $this->privCloseFd();
-
-      // ----- Set the user attributes
-      $v_prop['comment'] = $v_central_dir['comment'];
-      $v_prop['nb'] = $v_central_dir['entries'];
-      $v_prop['status'] = 'ok';
-    }
-
-    // ----- Return
-    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_prop);
-    return $v_prop;
-  }
-  // --------------------------------------------------------------------------------
-
-  // --------------------------------------------------------------------------------
-  // Function : duplicate()
-  // Description :
-  //   This method creates an archive by copying the content of an other one. If
-  //   the archive already exist, it is replaced by the new one without any warning.
-  // Parameters :
-  //   $p_archive : The filename of a valid archive, or
-  //                a valid PclZip object.
-  // Return Values :
-  //   1 on success.
-  //   0 or a negative value on error (error code).
-  // --------------------------------------------------------------------------------
-  function duplicate($p_archive)
-  {
-    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::duplicate", "");
-    $v_result = 1;
-
-    // ----- Reset the error handler
-    $this->privErrorReset();
-
-    // ----- Look if the $p_archive is a PclZip object
-    if ((is_object($p_archive)) && (get_class($p_archive) == 'pclzip'))
-    {
-      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "The parameter is valid PclZip object '".$p_archive->zipname."'");
-
-      // ----- Duplicate the archive
-      $v_result = $this->privDuplicate($p_archive->zipname);
-    }
-
-    // ----- Look if the $p_archive is a string (so a filename)
-    else if (is_string($p_archive))
-    {
-      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "The parameter is a filename '$p_archive'");
-
-      // ----- Check that $p_archive is a valid zip file
-      // TBC : Should also check the archive format
-      if (!is_file($p_archive)) {
-        // ----- Error log
-        PclZip::privErrorLog(PCLZIP_ERR_MISSING_FILE, "No file with filename '".$p_archive."'");
-        $v_result = PCLZIP_ERR_MISSING_FILE;
-      }
-      else {
-        // ----- Duplicate the archive
-        $v_result = $this->privDuplicate($p_archive);
-      }
-    }
-
-    // ----- Invalid variable
-    else
-    {
-      // ----- Error log
-      PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid variable type p_archive_to_add");
-      $v_result = PCLZIP_ERR_INVALID_PARAMETER;
-    }
-
-    // ----- Return
-    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
-    return $v_result;
-  }
-  // --------------------------------------------------------------------------------
-
-  // --------------------------------------------------------------------------------
-  // Function : merge()
-  // Description :
-  //   This method merge the $p_archive_to_add archive at the end of the current
-  //   one ($this).
-  //   If the archive ($this) does not exist, the merge becomes a duplicate.
-  //   If the $p_archive_to_add archive does not exist, the merge is a success.
-  // Parameters :
-  //   $p_archive_to_add : It can be directly the filename of a valid zip archive,
-  //                       or a PclZip object archive.
-  // Return Values :
-  //   1 on success,
-  //   0 or negative values on error (see below).
-  // --------------------------------------------------------------------------------
-  function merge($p_archive_to_add)
-  {
-    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::merge", "");
-    $v_result = 1;
-
-    // ----- Reset the error handler
-    $this->privErrorReset();
-
-    // ----- Check archive
-    if (!$this->privCheckFormat()) {
-      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0);
-      return(0);
-    }
-
-    // ----- Look if the $p_archive_to_add is a PclZip object
-    if ((is_object($p_archive_to_add)) && (get_class($p_archive_to_add) == 'pclzip'))
-    {
-      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "The parameter is valid PclZip object");
-
-      // ----- Merge the archive
-      $v_result = $this->privMerge($p_archive_to_add);
-    }
-
-    // ----- Look if the $p_archive_to_add is a string (so a filename)
-    else if (is_string($p_archive_to_add))
-    {
-      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "The parameter is a filename");
-
-      // ----- Create a temporary archive
-      $v_object_archive = new PclZip($p_archive_to_add);
-
-      // ----- Merge the archive
-      $v_result = $this->privMerge($v_object_archive);
-    }
-
-    // ----- Invalid variable
-    else
-    {
-      // ----- Error log
-      PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid variable type p_archive_to_add");
-      $v_result = PCLZIP_ERR_INVALID_PARAMETER;
-    }
-
-    // ----- Return
-    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
-    return $v_result;
-  }
-  // --------------------------------------------------------------------------------
-
-
-
-  // --------------------------------------------------------------------------------
-  // Function : errorCode()
-  // Description :
-  // Parameters :
-  // --------------------------------------------------------------------------------
-  function errorCode()
-  {
-    if (PCLZIP_ERROR_EXTERNAL == 1) {
-      return(PclErrorCode());
-    }
-    else {
-      return($this->error_code);
-    }
-  }
-  // --------------------------------------------------------------------------------
-
-  // --------------------------------------------------------------------------------
-  // Function : errorName()
-  // Description :
-  // Parameters :
-  // --------------------------------------------------------------------------------
-  function errorName($p_with_code=false)
-  {
-    $v_name = array ( PCLZIP_ERR_NO_ERROR => 'PCLZIP_ERR_NO_ERROR',
-                      PCLZIP_ERR_WRITE_OPEN_FAIL => 'PCLZIP_ERR_WRITE_OPEN_FAIL',
-                      PCLZIP_ERR_READ_OPEN_FAIL => 'PCLZIP_ERR_READ_OPEN_FAIL',
-                      PCLZIP_ERR_INVALID_PARAMETER => 'PCLZIP_ERR_INVALID_PARAMETER',
-                      PCLZIP_ERR_MISSING_FILE => 'PCLZIP_ERR_MISSING_FILE',
-                      PCLZIP_ERR_FILENAME_TOO_LONG => 'PCLZIP_ERR_FILENAME_TOO_LONG',
-                      PCLZIP_ERR_INVALID_ZIP => 'PCLZIP_ERR_INVALID_ZIP',
-                      PCLZIP_ERR_BAD_EXTRACTED_FILE => 'PCLZIP_ERR_BAD_EXTRACTED_FILE',
-                      PCLZIP_ERR_DIR_CREATE_FAIL => 'PCLZIP_ERR_DIR_CREATE_FAIL',
-                      PCLZIP_ERR_BAD_EXTENSION => 'PCLZIP_ERR_BAD_EXTENSION',
-                      PCLZIP_ERR_BAD_FORMAT => 'PCLZIP_ERR_BAD_FORMAT',
-                      PCLZIP_ERR_DELETE_FILE_FAIL => 'PCLZIP_ERR_DELETE_FILE_FAIL',
-                      PCLZIP_ERR_RENAME_FILE_FAIL => 'PCLZIP_ERR_RENAME_FILE_FAIL',
-                      PCLZIP_ERR_BAD_CHECKSUM => 'PCLZIP_ERR_BAD_CHECKSUM',
-                      PCLZIP_ERR_INVALID_ARCHIVE_ZIP => 'PCLZIP_ERR_INVALID_ARCHIVE_ZIP',
-                      PCLZIP_ERR_MISSING_OPTION_VALUE => 'PCLZIP_ERR_MISSING_OPTION_VALUE',
-                      PCLZIP_ERR_INVALID_OPTION_VALUE => 'PCLZIP_ERR_INVALID_OPTION_VALUE',
-                      PCLZIP_ERR_UNSUPPORTED_COMPRESSION => 'PCLZIP_ERR_UNSUPPORTED_COMPRESSION',
-                      PCLZIP_ERR_UNSUPPORTED_ENCRYPTION => 'PCLZIP_ERR_UNSUPPORTED_ENCRYPTION' );
-
-    if (isset($v_name[$this->error_code])) {
-      $v_value = $v_name[$this->error_code];
-    }
-    else {
-      $v_value = 'NoName';
-    }
-
-    if ($p_with_code) {
-      return($v_value.' ('.$this->error_code.')');
-    }
-    else {
-      return($v_value);
-    }
-  }
-  // --------------------------------------------------------------------------------
-
-  // --------------------------------------------------------------------------------
-  // Function : errorInfo()
-  // Description :
-  // Parameters :
-  // --------------------------------------------------------------------------------
-  function errorInfo($p_full=false)
-  {
-    if (PCLZIP_ERROR_EXTERNAL == 1) {
-      return(PclErrorString());
-    }
-    else {
-      if ($p_full) {
-        return($this->errorName(true)." : ".$this->error_string);
-      }
-      else {
-        return($this->error_string." [code ".$this->error_code."]");
-      }
-    }
-  }
-  // --------------------------------------------------------------------------------
-
-
-// --------------------------------------------------------------------------------
-// ***** UNDER THIS LINE ARE DEFINED PRIVATE INTERNAL FUNCTIONS *****
-// *****                                                        *****
-// *****       THESES FUNCTIONS MUST NOT BE USED DIRECTLY       *****
-// --------------------------------------------------------------------------------
-
-
-
-  // --------------------------------------------------------------------------------
-  // Function : privCheckFormat()
-  // Description :
-  //   This method check that the archive exists and is a valid zip archive.
-  //   Several level of check exists. (futur)
-  // Parameters :
-  //   $p_level : Level of check. Default 0.
-  //              0 : Check the first bytes (magic codes) (default value))
-  //              1 : 0 + Check the central directory (futur)
-  //              2 : 1 + Check each file header (futur)
-  // Return Values :
-  //   true on success,
-  //   false on error, the error code is set.
-  // --------------------------------------------------------------------------------
-  function privCheckFormat($p_level=0)
-  {
-    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privCheckFormat", "");
-    $v_result = true;
-
-	// ----- Reset the file system cache
-    clearstatcache();
-
-    // ----- Reset the error handler
-    $this->privErrorReset();
-
-    // ----- Look if the file exits
-    if (!is_file($this->zipname)) {
-      // ----- Error log
-      PclZip::privErrorLog(PCLZIP_ERR_MISSING_FILE, "Missing archive file '".$this->zipname."'");
-      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, false, PclZip::errorInfo());
-      return(false);
-    }
-
-    // ----- Check that the file is readeable
-    if (!is_readable($this->zipname)) {
-      // ----- Error log
-      PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, "Unable to read archive '".$this->zipname."'");
-      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, false, PclZip::errorInfo());
-      return(false);
-    }
-
-    // ----- Check the magic code
-    // TBC
-
-    // ----- Check the central header
-    // TBC
-
-    // ----- Check each file header
-    // TBC
-
-    // ----- Return
-    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
-    return $v_result;
-  }
-  // --------------------------------------------------------------------------------
-
-  // --------------------------------------------------------------------------------
-  // Function : privParseOptions()
-  // Description :
-  //   This internal methods reads the variable list of arguments ($p_options_list,
-  //   $p_size) and generate an array with the options and values ($v_result_list).
-  //   $v_requested_options contains the options that can be present and those that
-  //   must be present.
-  //   $v_requested_options is an array, with the option value as key, and 'optional',
-  //   or 'mandatory' as value.
-  // Parameters :
-  //   See above.
-  // Return Values :
-  //   1 on success.
-  //   0 on failure.
-  // --------------------------------------------------------------------------------
-  function privParseOptions(&$p_options_list, $p_size, &$v_result_list, $v_requested_options=false)
-  {
-    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privParseOptions", "");
-    $v_result=1;
-
-    // ----- Read the options
-    $i=0;
-    while ($i<$p_size) {
-      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Looking for table index $i, option = '".PclZipUtilOptionText($p_options_list[$i])."(".$p_options_list[$i].")'");
-
-      // ----- Check if the option is requested
-      if (!isset($v_requested_options[$p_options_list[$i]])) {
-        // ----- Error log
-        PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid optional parameter '".$p_options_list[$i]."' for this method");
-
-        // ----- Return
-        //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
-        return PclZip::errorCode();
-      }
-
-      // ----- Look for next option
-      switch ($p_options_list[$i]) {
-        // ----- Look for options that request a path value
-        case PCLZIP_OPT_PATH :
-        case PCLZIP_OPT_REMOVE_PATH :
-        case PCLZIP_OPT_ADD_PATH :
-          // ----- Check the number of parameters
-          if (($i+1) >= $p_size) {
-            // ----- Error log
-            PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'");
-
-            // ----- Return
-            //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
-            return PclZip::errorCode();
-          }
-
-          // ----- Get the value
-          $v_result_list[$p_options_list[$i]] = PclZipUtilTranslateWinPath($p_options_list[$i+1], false);
-          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "".PclZipUtilOptionText($p_options_list[$i])." = '".$v_result_list[$p_options_list[$i]]."'");
-          $i++;
-        break;
-
-        // ----- Look for options that request an array of string for value
-        case PCLZIP_OPT_BY_NAME :
-          // ----- Check the number of parameters
-          if (($i+1) >= $p_size) {
-            // ----- Error log
-            PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'");
-
-            // ----- Return
-            //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
-            return PclZip::errorCode();
-          }
-
-          // ----- Get the value
-          if (is_string($p_options_list[$i+1])) {
-              $v_result_list[$p_options_list[$i]][0] = $p_options_list[$i+1];
-          }
-          else if (is_array($p_options_list[$i+1])) {
-              $v_result_list[$p_options_list[$i]] = $p_options_list[$i+1];
-          }
-          else {
-            // ----- Error log
-            PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE, "Wrong parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'");
-
-            // ----- Return
-            //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
-            return PclZip::errorCode();
-          }
-          ////--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "".PclZipUtilOptionText($p_options_list[$i])." = '".$v_result_list[$p_options_list[$i]]."'");
-          $i++;
-        break;
-
-        // ----- Look for options that request an EREG or PREG expression
-        case PCLZIP_OPT_BY_EREG :
-        case PCLZIP_OPT_BY_PREG :
-        //case PCLZIP_OPT_CRYPT :
-          // ----- Check the number of parameters
-          if (($i+1) >= $p_size) {
-            // ----- Error log
-            PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'");
-
-            // ----- Return
-            //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
-            return PclZip::errorCode();
-          }
-
-          // ----- Get the value
-          if (is_string($p_options_list[$i+1])) {
-              $v_result_list[$p_options_list[$i]] = $p_options_list[$i+1];
-          }
-          else {
-            // ----- Error log
-            PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE, "Wrong parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'");
-
-            // ----- Return
-            //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
-            return PclZip::errorCode();
-          }
-          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "".PclZipUtilOptionText($p_options_list[$i])." = '".$v_result_list[$p_options_list[$i]]."'");
-          $i++;
-        break;
-
-        // ----- Look for options that takes a string
-        case PCLZIP_OPT_COMMENT :
-        case PCLZIP_OPT_ADD_COMMENT :
-        case PCLZIP_OPT_PREPEND_COMMENT :
-          // ----- Check the number of parameters
-          if (($i+1) >= $p_size) {
-            // ----- Error log
-            PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE,
-			                     "Missing parameter value for option '"
-								 .PclZipUtilOptionText($p_options_list[$i])
-								 ."'");
-
-            // ----- Return
-            //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
-            return PclZip::errorCode();
-          }
-
-          // ----- Get the value
-          if (is_string($p_options_list[$i+1])) {
-              $v_result_list[$p_options_list[$i]] = $p_options_list[$i+1];
-          }
-          else {
-            // ----- Error log
-            PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE,
-			                     "Wrong parameter value for option '"
-								 .PclZipUtilOptionText($p_options_list[$i])
-								 ."'");
-
-            // ----- Return
-            //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
-            return PclZip::errorCode();
-          }
-          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "".PclZipUtilOptionText($p_options_list[$i])." = '".$v_result_list[$p_options_list[$i]]."'");
-          $i++;
-        break;
-
-        // ----- Look for options that request an array of index
-        case PCLZIP_OPT_BY_INDEX :
-          // ----- Check the number of parameters
-          if (($i+1) >= $p_size) {
-            // ----- Error log
-            PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'");
-
-            // ----- Return
-            //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
-            return PclZip::errorCode();
-          }
-
-          // ----- Get the value
-          $v_work_list = array();
-          if (is_string($p_options_list[$i+1])) {
-              //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Index value is a string '".$p_options_list[$i+1]."'");
-
-              // ----- Remove spaces
-              $p_options_list[$i+1] = strtr($p_options_list[$i+1], ' ', '');
-
-              // ----- Parse items
-              $v_work_list = explode(",", $p_options_list[$i+1]);
-          }
-          else if (is_integer($p_options_list[$i+1])) {
-              //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Index value is an integer '".$p_options_list[$i+1]."'");
-              $v_work_list[0] = $p_options_list[$i+1].'-'.$p_options_list[$i+1];
-          }
-          else if (is_array($p_options_list[$i+1])) {
-              //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Index value is an array");
-              $v_work_list = $p_options_list[$i+1];
-          }
-          else {
-            // ----- Error log
-            PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE, "Value must be integer, string or array for option '".PclZipUtilOptionText($p_options_list[$i])."'");
-
-            // ----- Return
-            //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
-            return PclZip::errorCode();
-          }
-          
-          // ----- Reduce the index list
-          // each index item in the list must be a couple with a start and
-          // an end value : [0,3], [5-5], [8-10], ...
-          // ----- Check the format of each item
-          $v_sort_flag=false;
-          $v_sort_value=0;
-          for ($j=0; $j<sizeof($v_work_list); $j++) {
-              // ----- Explode the item
-              $v_item_list = explode("-", $v_work_list[$j]);
-              $v_size_item_list = sizeof($v_item_list);
-              
-              // ----- TBC : Here we might check that each item is a
-              // real integer ...
-              
-              // ----- Look for single value
-              if ($v_size_item_list == 1) {
-                  // ----- Set the option value
-                  $v_result_list[$p_options_list[$i]][$j]['start'] = $v_item_list[0];
-                  $v_result_list[$p_options_list[$i]][$j]['end'] = $v_item_list[0];
-              }
-              elseif ($v_size_item_list == 2) {
-                  // ----- Set the option value
-                  $v_result_list[$p_options_list[$i]][$j]['start'] = $v_item_list[0];
-                  $v_result_list[$p_options_list[$i]][$j]['end'] = $v_item_list[1];
-              }
-              else {
-                  // ----- Error log
-                  PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE, "Too many values in index range for option '".PclZipUtilOptionText($p_options_list[$i])."'");
-
-                  // ----- Return
-                  //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
-                  return PclZip::errorCode();
-              }
-
-              //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Extracted index item = [".$v_result_list[$p_options_list[$i]][$j]['start'].",".$v_result_list[$p_options_list[$i]][$j]['end']."]");
-
-              // ----- Look for list sort
-              if ($v_result_list[$p_options_list[$i]][$j]['start'] < $v_sort_value) {
-                  //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "The list should be sorted ...");
-                  $v_sort_flag=true;
-
-                  // ----- TBC : An automatic sort should be writen ...
-                  // ----- Error log
-                  PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE, "Invalid order of index range for option '".PclZipUtilOptionText($p_options_list[$i])."'");
-
-                  // ----- Return
-                  //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
-                  return PclZip::errorCode();
-              }
-              $v_sort_value = $v_result_list[$p_options_list[$i]][$j]['start'];
-          }
-          
-          // ----- Sort the items
-          if ($v_sort_flag) {
-              // TBC : To Be Completed
-              //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "List sorting is not yet write ...");
-          }
-
-          // ----- Next option
-          $i++;
-        break;
-
-        // ----- Look for options that request no value
-        case PCLZIP_OPT_REMOVE_ALL_PATH :
-        case PCLZIP_OPT_EXTRACT_AS_STRING :
-        case PCLZIP_OPT_NO_COMPRESSION :
-        case PCLZIP_OPT_EXTRACT_IN_OUTPUT :
-        case PCLZIP_OPT_REPLACE_NEWER :
-        case PCLZIP_OPT_STOP_ON_ERROR :
-          $v_result_list[$p_options_list[$i]] = true;
-          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "".PclZipUtilOptionText($p_options_list[$i])." = '".$v_result_list[$p_options_list[$i]]."'");
-        break;
-
-        // ----- Look for options that request an octal value
-        case PCLZIP_OPT_SET_CHMOD :
-          // ----- Check the number of parameters
-          if (($i+1) >= $p_size) {
-            // ----- Error log
-            PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'");
-
-            // ----- Return
-            //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
-            return PclZip::errorCode();
-          }
-
-          // ----- Get the value
-          $v_result_list[$p_options_list[$i]] = $p_options_list[$i+1];
-          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "".PclZipUtilOptionText($p_options_list[$i])." = '".$v_result_list[$p_options_list[$i]]."'");
-          $i++;
-        break;
-
-        // ----- Look for options that request a call-back
-        case PCLZIP_CB_PRE_EXTRACT :
-        case PCLZIP_CB_POST_EXTRACT :
-        case PCLZIP_CB_PRE_ADD :
-        case PCLZIP_CB_POST_ADD :
-        /* for futur use
-        case PCLZIP_CB_PRE_DELETE :
-        case PCLZIP_CB_POST_DELETE :
-        case PCLZIP_CB_PRE_LIST :
-        case PCLZIP_CB_POST_LIST :
-        */
-          // ----- Check the number of parameters
-          if (($i+1) >= $p_size) {
-            // ----- Error log
-            PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'");
-
-            // ----- Return
-            //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
-            return PclZip::errorCode();
-          }
-
-          // ----- Get the value
-          $v_function_name = $p_options_list[$i+1];
-          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "call-back ".PclZipUtilOptionText($p_options_list[$i])." = '".$v_function_name."'");
-
-          // ----- Check that the value is a valid existing function
-          if (!function_exists($v_function_name)) {
-            // ----- Error log
-            PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE, "Function '".$v_function_name."()' is not an existing function for option '".PclZipUtilOptionText($p_options_list[$i])."'");
-
-            // ----- Return
-            //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
-            return PclZip::errorCode();
-          }
-
-          // ----- Set the attribute
-          $v_result_list[$p_options_list[$i]] = $v_function_name;
-          $i++;
-        break;
-
-        default :
-          // ----- Error log
-          PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER,
-		                       "Unknown parameter '"
-							   .$p_options_list[$i]."'");
-
-          // ----- Return
-          //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
-          return PclZip::errorCode();
-      }
-
-      // ----- Next options
-      $i++;
-    }
-
-    // ----- Look for mandatory options
-    if ($v_requested_options !== false) {
-      for ($key=reset($v_requested_options); $key=key($v_requested_options); $key=next($v_requested_options)) {
-        // ----- Look for mandatory option
-        if ($v_requested_options[$key] == 'mandatory') {
-          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Detect a mandatory option : ".PclZipUtilOptionText($key)."(".$key.")");
-          // ----- Look if present
-          if (!isset($v_result_list[$key])) {
-            // ----- Error log
-            PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Missing mandatory parameter ".PclZipUtilOptionText($key)."(".$key.")");
-
-            // ----- Return
-            //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
-            return PclZip::errorCode();
-          }
-        }
-      }
-    }
-
-    // ----- Return
-    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
-    return $v_result;
-  }
-  // --------------------------------------------------------------------------------
-
-  // --------------------------------------------------------------------------------
-  // Function : privCreate()
-  // Description :
-  // Parameters :
-  // Return Values :
-  // --------------------------------------------------------------------------------
-  function privCreate($p_list, &$p_result_list, $p_add_dir, $p_remove_dir, $p_remove_all_dir, &$p_options)
-  {
-    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privCreate", "list, result_list, add_dir='$p_add_dir', remove_dir='$p_remove_dir'");
-    $v_result=1;
-    $v_list_detail = array();
-
-    // ----- Open the file in write mode
-    if (($v_result = $this->privOpenFd('wb')) != 1)
-    {
-      // ----- Return
-      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
-      return $v_result;
-    }
-
-    // ----- Add the list of files
-    $v_result = $this->privAddList($p_list, $p_result_list, $p_add_dir, $p_remove_dir, $p_remove_all_dir, $p_options);
-
-    // ----- Close
-    $this->privCloseFd();
-
-    // ----- Return
-    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
-    return $v_result;
-  }
-  // --------------------------------------------------------------------------------
-
-  // --------------------------------------------------------------------------------
-  // Function : privAdd()
-  // Description :
-  // Parameters :
-  // Return Values :
-  // --------------------------------------------------------------------------------
-  function privAdd($p_list, &$p_result_list, $p_add_dir, $p_remove_dir, $p_remove_all_dir, &$p_options)
-  {
-    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privAdd", "list, result_list, add_dir='$p_add_dir', remove_dir='$p_remove_dir'");
-    $v_result=1;
-    $v_list_detail = array();
-
-    // ----- Look if the archive exists or is empty
-    if ((!is_file($this->zipname)) || (filesize($this->zipname) == 0))
-    {
-      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Archive does not exist, or is empty, create it.");
-
-      // ----- Do a create
-      $v_result = $this->privCreate($p_list, $p_result_list, $p_add_dir, $p_remove_dir, $p_remove_all_dir, $p_options);
-
-      // ----- Return
-      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
-      return $v_result;
-    }
-
-    // ----- Open the zip file
-    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Open file in binary read mode");
-    if (($v_result=$this->privOpenFd('rb')) != 1)
-    {
-      // ----- Return
-      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
-      return $v_result;
-    }
-
-    // ----- Read the central directory informations
-    $v_central_dir = array();
-    if (($v_result = $this->privReadEndCentralDir($v_central_dir)) != 1)
-    {
-      $this->privCloseFd();
-      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
-      return $v_result;
-    }
-
-    // ----- Go to beginning of File
-    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Position in file : ".ftell($this->zip_fd)."'");
-    @rewind($this->zip_fd);
-    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Position in file : ".ftell($this->zip_fd)."'");
-
-    // ----- Creates a temporay file
-    $v_zip_temp_name = PCLZIP_TEMPORARY_DIR.uniqid('pclzip-').'.tmp';
-
-    // ----- Open the temporary file in write mode
-    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Open file in binary read mode");
-    if (($v_zip_temp_fd = @fopen($v_zip_temp_name, 'wb')) == 0)
-    {
-      $this->privCloseFd();
-
-      PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open temporary file \''.$v_zip_temp_name.'\' in binary write mode');
-
-      // ----- Return
-      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
-      return PclZip::errorCode();
-    }
-
-    // ----- Copy the files from the archive to the temporary file
-    // TBC : Here I should better append the file and go back to erase the central dir
-    $v_size = $v_central_dir['offset'];
-    while ($v_size != 0)
-    {
-      $v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE);
-      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Read $v_read_size bytes");
-      $v_buffer = fread($this->zip_fd, $v_read_size);
-      @fwrite($v_zip_temp_fd, $v_buffer, $v_read_size);
-      $v_size -= $v_read_size;
-    }
-
-    // ----- Swap the file descriptor
-    // Here is a trick : I swap the temporary fd with the zip fd, in order to use
-    // the following methods on the temporary fil and not the real archive
-    $v_swap = $this->zip_fd;
-    $this->zip_fd = $v_zip_temp_fd;
-    $v_zip_temp_fd = $v_swap;
-
-    // ----- Add the files
-    $v_header_list = array();
-    if (($v_result = $this->privAddFileList($p_list, $v_header_list, $p_add_dir, $p_remove_dir, $p_remove_all_dir, $p_options)) != 1)
-    {
-      fclose($v_zip_temp_fd);
-      $this->privCloseFd();
-      @unlink($v_zip_temp_name);
-
-      // ----- Return
-      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
-      return $v_result;
-    }
-
-    // ----- Store the offset of the central dir
-    $v_offset = @ftell($this->zip_fd);
-    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "New offset of central dir : $v_offset");
-
-    // ----- Copy the block of file headers from the old archive
-    $v_size = $v_central_dir['size'];
-    while ($v_size != 0)
-    {
-      $v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE);
-      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Read $v_read_size bytes");
-      $v_buffer = @fread($v_zip_temp_fd, $v_read_size);
-      @fwrite($this->zip_fd, $v_buffer, $v_read_size);
-      $v_size -= $v_read_size;
-    }
-
-    // ----- Create the Central Dir files header
-    for ($i=0, $v_count=0; $i<sizeof($v_header_list); $i++)
-    {
-      // ----- Create the file header
-      if ($v_header_list[$i]['status'] == 'ok') {
-        if (($v_result = $this->privWriteCentralFileHeader($v_header_list[$i])) != 1) {
-          fclose($v_zip_temp_fd);
-          $this->privCloseFd();
-          @unlink($v_zip_temp_name);
-
-          // ----- Return
-          //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
-          return $v_result;
-        }
-        $v_count++;
-      }
-
-      // ----- Transform the header to a 'usable' info
-      $this->privConvertHeader2FileInfo($v_header_list[$i], $p_result_list[$i]);
-    }
-
-    // ----- Zip file comment
-    $v_comment = $v_central_dir['comment'];
-    if (isset($p_options[PCLZIP_OPT_COMMENT])) {
-      $v_comment = $p_options[PCLZIP_OPT_COMMENT];
-    }
-    if (isset($p_options[PCLZIP_OPT_ADD_COMMENT])) {
-      $v_comment = $v_comment.$p_options[PCLZIP_OPT_ADD_COMMENT];
-    }
-    if (isset($p_options[PCLZIP_OPT_PREPEND_COMMENT])) {
-      $v_comment = $p_options[PCLZIP_OPT_PREPEND_COMMENT].$v_comment;
-    }
-
-    // ----- Calculate the size of the central header
-    $v_size = @ftell($this->zip_fd)-$v_offset;
-
-    // ----- Create the central dir footer
-    if (($v_result = $this->privWriteCentralHeader($v_count+$v_central_dir['entries'], $v_size, $v_offset, $v_comment)) != 1)
-    {
-      // ----- Reset the file list
-      unset($v_header_list);
-
-      // ----- Return
-      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
-      return $v_result;
-    }
-
-    // ----- Swap back the file descriptor
-    $v_swap = $this->zip_fd;
-    $this->zip_fd = $v_zip_temp_fd;
-    $v_zip_temp_fd = $v_swap;
-
-    // ----- Close
-    $this->privCloseFd();
-
-    // ----- Close the temporary file
-    @fclose($v_zip_temp_fd);
-
-    // ----- Delete the zip file
-    // TBC : I should test the result ...
-    @unlink($this->zipname);
-
-    // ----- Rename the temporary file
-    // TBC : I should test the result ...
-    //@rename($v_zip_temp_name, $this->zipname);
-    PclZipUtilRename($v_zip_temp_name, $this->zipname);
-
-    // ----- Return
-    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
-    return $v_result;
-  }
-  // --------------------------------------------------------------------------------
-
-  // --------------------------------------------------------------------------------
-  // Function : privOpenFd()
-  // Description :
-  // Parameters :
-  // --------------------------------------------------------------------------------
-  function privOpenFd($p_mode)
-  {
-    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privOpenFd", 'mode='.$p_mode);
-    $v_result=1;
-
-    // ----- Look if already open
-    if ($this->zip_fd != 0)
-    {
-      // ----- Error log
-      PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Zip file \''.$this->zipname.'\' already open');
-
-      // ----- Return
-      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
-      return PclZip::errorCode();
-    }
-
-    // ----- Open the zip file
-    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Open file in '.$p_mode.' mode');
-    if (($this->zip_fd = @fopen($this->zipname, $p_mode)) == 0)
-    {
-      // ----- Error log
-      PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open archive \''.$this->zipname.'\' in '.$p_mode.' mode');
-
-      // ----- Return
-      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
-      return PclZip::errorCode();
-    }
-
-    // ----- Return
-    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
-    return $v_result;
-  }
-  // --------------------------------------------------------------------------------
-
-  // --------------------------------------------------------------------------------
-  // Function : privCloseFd()
-  // Description :
-  // Parameters :
-  // --------------------------------------------------------------------------------
-  function privCloseFd()
-  {
-    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privCloseFd", "");
-    $v_result=1;
-
-    if ($this->zip_fd != 0)
-      @fclose($this->zip_fd);
-    $this->zip_fd = 0;
-
-    // ----- Return
-    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
-    return $v_result;
-  }
-  // --------------------------------------------------------------------------------
-
-  // --------------------------------------------------------------------------------
-  // Function : privAddList()
-  // Description :
-  //   $p_add_dir and $p_remove_dir will give the ability to memorize a path which is
-  //   different from the real path of the file. This is usefull if you want to have PclTar
-  //   running in any directory, and memorize relative path from an other directory.
-  // Parameters :
-  //   $p_list : An array containing the file or directory names to add in the tar
-  //   $p_result_list : list of added files with their properties (specially the status field)
-  //   $p_add_dir : Path to add in the filename path archived
-  //   $p_remove_dir : Path to remove in the filename path archived
-  // Return Values :
-  // --------------------------------------------------------------------------------
-  function privAddList($p_list, &$p_result_list, $p_add_dir, $p_remove_dir, $p_remove_all_dir, &$p_options)
-  {
-    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privAddList", "list, add_dir='$p_add_dir', remove_dir='$p_remove_dir'");
-    $v_result=1;
-
-    // ----- Add the files
-    $v_header_list = array();
-    if (($v_result = $this->privAddFileList($p_list, $v_header_list, $p_add_dir, $p_remove_dir, $p_remove_all_dir, $p_options)) != 1)
-    {
-      // ----- Return
-      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
-      return $v_result;
-    }
-
-    // ----- Store the offset of the central dir
-    $v_offset = @ftell($this->zip_fd);
-
-    // ----- Create the Central Dir files header
-    for ($i=0,$v_count=0; $i<sizeof($v_header_list); $i++)
-    {
-      // ----- Create the file header
-      if ($v_header_list[$i]['status'] == 'ok') {
-        if (($v_result = $this->privWriteCentralFileHeader($v_header_list[$i])) != 1) {
-          // ----- Return
-          //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
-          return $v_result;
-        }
-        $v_count++;
-      }
-
-      // ----- Transform the header to a 'usable' info
-      $this->privConvertHeader2FileInfo($v_header_list[$i], $p_result_list[$i]);
-    }
-
-    // ----- Zip file comment
-    $v_comment = '';
-    if (isset($p_options[PCLZIP_OPT_COMMENT])) {
-      $v_comment = $p_options[PCLZIP_OPT_COMMENT];
-    }
-
-    // ----- Calculate the size of the central header
-    $v_size = @ftell($this->zip_fd)-$v_offset;
-
-    // ----- Create the central dir footer
-    if (($v_result = $this->privWriteCentralHeader($v_count, $v_size, $v_offset, $v_comment)) != 1)
-    {
-      // ----- Reset the file list
-      unset($v_header_list);
-
-      // ----- Return
-      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
-      return $v_result;
-    }
-
-    // ----- Return
-    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
-    return $v_result;
-  }
-  // --------------------------------------------------------------------------------
-
-  // --------------------------------------------------------------------------------
-  // Function : privAddFileList()
-  // Description :
-  //   $p_add_dir and $p_remove_dir will give the ability to memorize a path which is
-  //   different from the real path of the file. This is usefull if you want to
-  //   run the lib in any directory, and memorize relative path from an other directory.
-  // Parameters :
-  //   $p_list : An array containing the file or directory names to add in the tar
-  //   $p_result_list : list of added files with their properties (specially the status field)
-  //   $p_add_dir : Path to add in the filename path archived
-  //   $p_remove_dir : Path to remove in the filename path archived
-  // Return Values :
-  // --------------------------------------------------------------------------------
-  function privAddFileList($p_list, &$p_result_list, $p_add_dir, $p_remove_dir, $p_remove_all_dir, &$p_options)
-  {
-    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privAddFileList", "list, add_dir='$p_add_dir', remove_dir='$p_remove_dir'");
-    $v_result=1;
-    $v_header = array();
-
-    // ----- Recuperate the current number of elt in list
-    $v_nb = sizeof($p_result_list);
-    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Before add, list have $v_nb elements");
-
-    // ----- Loop on the files
-    for ($j=0; ($j<count($p_list)) && ($v_result==1); $j++)
-    {
-      // ----- Recuperate the filename
-      $p_filename = PclZipUtilTranslateWinPath($p_list[$j], false);
-
-      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Looking for file [$p_filename]");
-
-      // ----- Skip empty file names
-      if ($p_filename == "")
-      {
-        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Skip empty filename");
-        continue;
-      }
-
-      // ----- Check the filename
-      if (!file_exists($p_filename))
-      {
-        // ----- Error log
-        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "File '$p_filename' does not exists");
-        PclZip::privErrorLog(PCLZIP_ERR_MISSING_FILE, "File '$p_filename' does not exists");
-
-        // ----- Return
-        //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
-        return PclZip::errorCode();
-      }
-
-      /* This test is done later
-      // ----- Check the path length
-      if (strlen($p_filename) > 0xFF)
-      {
-        // ----- Error log
-        PclZip::privErrorLog(-5, "File name is too long (max. 255) : '$p_filename'");
-
-        // ----- Return
-        //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
-        return PclZip::errorCode();
-      }
-      */
-
-      // ----- Look if it is a file or a dir with no all pathnre move
-      if ((is_file($p_filename)) || ((is_dir($p_filename)) && !$p_remove_all_dir)) {
-        // ----- Add the file
-        if (($v_result = $this->privAddFile($p_filename, $v_header, $p_add_dir, $p_remove_dir, $p_remove_all_dir, $p_options)) != 1)
-        {
-          // ----- Return status
-          //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
-          return $v_result;
-        }
-
-        // ----- Store the file infos
-        $p_result_list[$v_nb++] = $v_header;
-      }
-
-      // ----- Look for directory
-      if (@is_dir($p_filename))
-      {
-        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "$p_filename is a directory");
-
-        // ----- Look for path
-        if ($p_filename != ".")
-          $v_path = $p_filename."/";
-        else
-          $v_path = "";
-
-        // ----- Read the directory for files and sub-directories
-        if ($p_hdir = @opendir($p_filename)) {
-          $p_hitem = @readdir($p_hdir); // '.' directory
-          $p_hitem = @readdir($p_hdir); // '..' directory
-          while (($p_hitem = @readdir($p_hdir)) !== false) {
-            //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Looking for $p_hitem in the directory");
-
-            // ----- Look for a file
-            if (is_file($v_path.$p_hitem)) {
-              //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Add the file '".$v_path.$p_hitem."'");
-
-              // ----- Add the file
-              if (($v_result = $this->privAddFile($v_path.$p_hitem, $v_header, $p_add_dir, $p_remove_dir, $p_remove_all_dir, $p_options)) != 1) {
-                // ----- Return status
-                //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
-                return $v_result;
-              }
-
-              // ----- Store the file infos
-              $p_result_list[$v_nb++] = $v_header;
-            }
-
-            // ----- Recursive call to privAddFileList()
-            else {
-              //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Add the directory '".$v_path.$p_hitem."'");
-
-              // ----- Need an array as parameter
-              $p_temp_list[0] = $v_path.$p_hitem;
-              $v_result = $this->privAddFileList($p_temp_list, $p_result_list, $p_add_dir, $p_remove_dir, $p_remove_all_dir, $p_options);
-
-              // ----- Update the number of elements of the list
-              $v_nb = sizeof($p_result_list);
-            }
-          }
-        }
-
-        // ----- Free memory for the recursive loop
-        unset($p_temp_list);
-        unset($p_hdir);
-        unset($p_hitem);
-      }
-    }
-
-    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "After add, list have $v_nb elements");
-
-    // ----- Return
-    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
-    return $v_result;
-  }
-  // --------------------------------------------------------------------------------
-
-  // --------------------------------------------------------------------------------
-  // Function : privAddFile()
-  // Description :
-  // Parameters :
-  // Return Values :
-  // --------------------------------------------------------------------------------
-  function privAddFile($p_filename, &$p_header, $p_add_dir, $p_remove_dir, $p_remove_all_dir, &$p_options)
-  {
-    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privAddFile", "filename='$p_filename', add_dir='$p_add_dir', remove_dir='$p_remove_dir'");
-    $v_result=1;
-
-    if ($p_filename == "")
-    {
-      // ----- Error log
-      PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid file list parameter (invalid or empty list)");
-
-      // ----- Return
-      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
-      return PclZip::errorCode();
-    }
-
-    // ----- Calculate the stored filename
-    $v_stored_filename = $p_filename;
-
-    // ----- Look for all path to remove
-    if ($p_remove_all_dir) {
-      $v_stored_filename = basename($p_filename);
-    }
-    // ----- Look for partial path remove
-    else if ($p_remove_dir != "")
-    {
-      if (substr($p_remove_dir, -1) != '/')
-        $p_remove_dir .= "/";
-
-      if ((substr($p_filename, 0, 2) == "./") || (substr($p_remove_dir, 0, 2) == "./"))
-      {
-        if ((substr($p_filename, 0, 2) == "./") && (substr($p_remove_dir, 0, 2) != "./"))
-          $p_remove_dir = "./".$p_remove_dir;
-        if ((substr($p_filename, 0, 2) != "./") && (substr($p_remove_dir, 0, 2) == "./"))
-          $p_remove_dir = substr($p_remove_dir, 2);
-      }
-
-      $v_compare = PclZipUtilPathInclusion($p_remove_dir, $p_filename);
-      if ($v_compare > 0)
-//      if (substr($p_filename, 0, strlen($p_remove_dir)) == $p_remove_dir)
-      {
-
-        if ($v_compare == 2) {
-          $v_stored_filename = "";
-          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Path to remove is the current folder");
-        }
-        else {
-          $v_stored_filename = substr($p_filename, strlen($p_remove_dir));
-          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Remove path '$p_remove_dir' in file '$p_filename' = '$v_stored_filename'");
-        }
-      }
-    }
-    // ----- Look for path to add
-    if ($p_add_dir != "")
-    {
-      if (substr($p_add_dir, -1) == "/")
-        $v_stored_filename = $p_add_dir.$v_stored_filename;
-      else
-        $v_stored_filename = $p_add_dir."/".$v_stored_filename;
-      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Add path '$p_add_dir' in file '$p_filename' = '$v_stored_filename'");
-    }
-
-    // ----- Filename (reduce the path of stored name)
-    $v_stored_filename = PclZipUtilPathReduction($v_stored_filename);
-
-    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Filename (reduced) '$v_stored_filename', strlen ".strlen($v_stored_filename));
-
-    // ----- Set the file properties
-    clearstatcache();
-    $p_header['version'] = 20;
-    $p_header['version_extracted'] = 10;
-    $p_header['flag'] = 0;
-    $p_header['compression'] = 0;
-    $p_header['mtime'] = filemtime($p_filename);
-    $p_header['crc'] = 0;
-    $p_header['compressed_size'] = 0;
-    $p_header['size'] = filesize($p_filename);
-    $p_header['filename_len'] = strlen($p_filename);
-    $p_header['extra_len'] = 0;
-    $p_header['comment_len'] = 0;
-    $p_header['disk'] = 0;
-    $p_header['internal'] = 0;
-//    $p_header['external'] = (is_file($p_filename)?0xFE49FFE0:0x41FF0010);
-    $p_header['external'] = (is_file($p_filename)?0x00000000:0x00000010);
-    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Header external extension '".sprintf("0x%X",$p_header['external'])."'");
-    $p_header['offset'] = 0;
-    $p_header['filename'] = $p_filename;
-    $p_header['stored_filename'] = $v_stored_filename;
-    $p_header['extra'] = '';
-    $p_header['comment'] = '';
-    $p_header['status'] = 'ok';
-    $p_header['index'] = -1;
-
-
-    // ----- Look for pre-add callback
-    if (isset($p_options[PCLZIP_CB_PRE_ADD])) {
-      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "A pre-callback '".$p_options[PCLZIP_CB_PRE_ADD]."()') is defined for the extraction");
-
-      // ----- Generate a local information
-      $v_local_header = array();
-      $this->privConvertHeader2FileInfo($p_header, $v_local_header);
-
-      // ----- Call the callback
-      // Here I do not use call_user_func() because I need to send a reference to the
-      // header.
-      eval('$v_result = '.$p_options[PCLZIP_CB_PRE_ADD].'(PCLZIP_CB_PRE_ADD, $v_local_header);');
-      if ($v_result == 0) {
-        // ----- Change the file status
-        $p_header['status'] = "skipped";
-        $v_result = 1;
-      }
-
-      // ----- Update the informations
-      // Only some fields can be modified
-      if ($p_header['stored_filename'] != $v_local_header['stored_filename']) {
-        $p_header['stored_filename'] = PclZipUtilPathReduction($v_local_header['stored_filename']);
-        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "New stored filename is '".$p_header['stored_filename']."'");
-      }
-    }
-
-    // ----- Look for empty stored filename
-    if ($p_header['stored_filename'] == "") {
-      $p_header['status'] = "filtered";
-    }
-    
-    // ----- Check the path length
-    if (strlen($p_header['stored_filename']) > 0xFF) {
-      $p_header['status'] = 'filename_too_long';
-    }
-
-    // ----- Look if no error, or file not skipped
-    if ($p_header['status'] == 'ok') {
-
-      // ----- Look for a file
-      if (is_file($p_filename))
-      {
-        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "'".$p_filename."' is a file");
-        // ----- Open the source file
-        if (($v_file = @fopen($p_filename, "rb")) == 0) {
-          PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, "Unable to open file '$p_filename' in binary read mode");
-          //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
-          return PclZip::errorCode();
-        }
-
-        if ($p_options[PCLZIP_OPT_NO_COMPRESSION]) {
-          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "File will not be compressed");
-          // ----- Read the file content
-          $v_content_compressed = @fread($v_file, $p_header['size']);
-
-          // ----- Calculate the CRC
-          $p_header['crc'] = @crc32($v_content_compressed);
-
-          // ----- Set header parameters
-          $p_header['compressed_size'] = $p_header['size'];
-          $p_header['compression'] = 0;
-        }
-        else {
-          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "File will be compressed");
-          // ----- Read the file content
-          $v_content = @fread($v_file, $p_header['size']);
-
-          // ----- Calculate the CRC
-          $p_header['crc'] = @crc32($v_content);
-
-          // ----- Compress the file
-          $v_content_compressed = @gzdeflate($v_content);
-
-          // ----- Set header parameters
-          $p_header['compressed_size'] = strlen($v_content_compressed);
-          $p_header['compression'] = 8;
-        }
-        
-        // ----- Look for encryption
-        /*
-        if ((isset($p_options[PCLZIP_OPT_CRYPT]))
-		    && ($p_options[PCLZIP_OPT_CRYPT] != "")) {
-          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "File need to be crypted ....");
-          
-          // Should be a random header
-          $v_header = 'xxxxxxxxxxxx';
-	      $v_content_compressed = PclZipUtilZipEncrypt($v_content_compressed,
-		                                           $p_header['compressed_size'],
-	                                               $v_header,
-												   $p_header['crc'],
-												   "test");
-												   
-          $p_header['compressed_size'] += 12;
-          $p_header['flag'] = 1;
-          
-          // ----- Add the header to the data
-          $v_content_compressed = $v_header.$v_content_compressed;
-          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Size after header : ".strlen($v_content_compressed)."");
-        }
-        */
-
-        // ----- Call the header generation
-        if (($v_result = $this->privWriteFileHeader($p_header)) != 1) {
-          @fclose($v_file);
-          //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
-          return $v_result;
-        }
-
-        // ----- Write the compressed (or not) content
-        $v_binary_data = pack('a'.$p_header['compressed_size'],
-		                      $v_content_compressed);
-        @fwrite($this->zip_fd, $v_binary_data, $p_header['compressed_size']);
-        
-        // ----- Close the file
-        @fclose($v_file);
-      }
-
-      // ----- Look for a directory
-      else {
-        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "'".$p_filename."' is a folder");
-        // ----- Look for directory last '/'
-        if (@substr($p_header['stored_filename'], -1) != '/') {
-          $p_header['stored_filename'] .= '/';
-        }
-
-        // ----- Set the file properties
-        $p_header['size'] = 0;
-        //$p_header['external'] = 0x41FF0010;   // Value for a folder : to be checked
-        $p_header['external'] = 0x00000010;   // Value for a folder : to be checked
-
-        // ----- Call the header generation
-        if (($v_result = $this->privWriteFileHeader($p_header)) != 1)
-        {
-          //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
-          return $v_result;
-        }
-      }
-    }
-
-    // ----- Look for pre-add callback
-    if (isset($p_options[PCLZIP_CB_POST_ADD])) {
-      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "A post-callback '".$p_options[PCLZIP_CB_POST_ADD]."()') is defined for the extraction");
-
-      // ----- Generate a local information
-      $v_local_header = array();
-      $this->privConvertHeader2FileInfo($p_header, $v_local_header);
-
-      // ----- Call the callback
-      // Here I do not use call_user_func() because I need to send a reference to the
-      // header.
-      eval('$v_result = '.$p_options[PCLZIP_CB_POST_ADD].'(PCLZIP_CB_POST_ADD, $v_local_header);');
-      if ($v_result == 0) {
-        // ----- Ignored
-        $v_result = 1;
-      }
-
-      // ----- Update the informations
-      // Nothing can be modified
-    }
-
-    // ----- Return
-    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
-    return $v_result;
-  }
-  // --------------------------------------------------------------------------------
-
-  // --------------------------------------------------------------------------------
-  // Function : privWriteFileHeader()
-  // Description :
-  // Parameters :
-  // Return Values :
-  // --------------------------------------------------------------------------------
-  function privWriteFileHeader(&$p_header)
-  {
-    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privWriteFileHeader", 'file="'.$p_header['filename'].'", stored as "'.$p_header['stored_filename'].'"');
-    $v_result=1;
-
-    // TBC
-    //for(reset($p_header); $key = key($p_header); next($p_header)) {
-    //  //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "header[$key] = ".$p_header[$key]);
-    //}
-
-    // ----- Store the offset position of the file
-    $p_header['offset'] = ftell($this->zip_fd);
-    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, 'File offset of the header :'.$p_header['offset']);
-
-    // ----- Transform UNIX mtime to DOS format mdate/mtime
-    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Date : \''.date("d/m/y H:i:s", $p_header['mtime']).'\'');
-    $v_date = getdate($p_header['mtime']);
-    $v_mtime = ($v_date['hours']<<11) + ($v_date['minutes']<<5) + $v_date['seconds']/2;
-    $v_mdate = (($v_date['year']-1980)<<9) + ($v_date['mon']<<5) + $v_date['mday'];
-
-    // ----- Packed data
-    $v_binary_data = pack("VvvvvvVVVvv", 0x04034b50,
-	                      $p_header['version_extracted'], $p_header['flag'],
-                          $p_header['compression'], $v_mtime, $v_mdate,
-                          $p_header['crc'], $p_header['compressed_size'],
-						  $p_header['size'],
-                          strlen($p_header['stored_filename']),
-						  $p_header['extra_len']);
-
-    // ----- Write the first 148 bytes of the header in the archive
-    fputs($this->zip_fd, $v_binary_data, 30);
-
-    // ----- Write the variable fields
-    if (strlen($p_header['stored_filename']) != 0)
-    {
-      fputs($this->zip_fd, $p_header['stored_filename'], strlen($p_header['stored_filename']));
-    }
-    if ($p_header['extra_len'] != 0)
-    {
-      fputs($this->zip_fd, $p_header['extra'], $p_header['extra_len']);
-    }
-
-    // ----- Return
-    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
-    return $v_result;
-  }
-  // --------------------------------------------------------------------------------
-
-  // --------------------------------------------------------------------------------
-  // Function : privWriteCentralFileHeader()
-  // Description :
-  // Parameters :
-  // Return Values :
-  // --------------------------------------------------------------------------------
-  function privWriteCentralFileHeader(&$p_header)
-  {
-    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privWriteCentralFileHeader", 'file="'.$p_header['filename'].'", stored as "'.$p_header['stored_filename'].'"');
-    $v_result=1;
-
-    // TBC
-    //for(reset($p_header); $key = key($p_header); next($p_header)) {
-    //  //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "header[$key] = ".$p_header[$key]);
-    //}
-
-    // ----- Transform UNIX mtime to DOS format mdate/mtime
-    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Date : \''.date("d/m/y H:i:s", $p_header['mtime']).'\'');
-    $v_date = getdate($p_header['mtime']);
-    $v_mtime = ($v_date['hours']<<11) + ($v_date['minutes']<<5) + $v_date['seconds']/2;
-    $v_mdate = (($v_date['year']-1980)<<9) + ($v_date['mon']<<5) + $v_date['mday'];
-
-    // ----- Packed data
-    $v_binary_data = pack("VvvvvvvVVVvvvvvVV", 0x02014b50,
-	                      $p_header['version'], $p_header['version_extracted'],
-                          $p_header['flag'], $p_header['compression'],
-						  $v_mtime, $v_mdate, $p_header['crc'],
-                          $p_header['compressed_size'], $p_header['size'],
-                          strlen($p_header['stored_filename']),
-						  $p_header['extra_len'], $p_header['comment_len'],
-                          $p_header['disk'], $p_header['internal'],
-						  $p_header['external'], $p_header['offset']);
-
-    // ----- Write the 42 bytes of the header in the zip file
-    fputs($this->zip_fd, $v_binary_data, 46);
-
-    // ----- Write the variable fields
-    if (strlen($p_header['stored_filename']) != 0)
-    {
-      fputs($this->zip_fd, $p_header['stored_filename'], strlen($p_header['stored_filename']));
-    }
-    if ($p_header['extra_len'] != 0)
-    {
-      fputs($this->zip_fd, $p_header['extra'], $p_header['extra_len']);
-    }
-    if ($p_header['comment_len'] != 0)
-    {
-      fputs($this->zip_fd, $p_header['comment'], $p_header['comment_len']);
-    }
-
-    // ----- Return
-    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
-    return $v_result;
-  }
-  // --------------------------------------------------------------------------------
-
-  // --------------------------------------------------------------------------------
-  // Function : privWriteCentralHeader()
-  // Description :
-  // Parameters :
-  // Return Values :
-  // --------------------------------------------------------------------------------
-  function privWriteCentralHeader($p_nb_entries, $p_size, $p_offset, $p_comment)
-  {
-    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privWriteCentralHeader", 'nb_entries='.$p_nb_entries.', size='.$p_size.', offset='.$p_offset.', comment="'.$p_comment.'"');
-    $v_result=1;
-
-    // ----- Packed data
-    $v_binary_data = pack("VvvvvVVv", 0x06054b50, 0, 0, $p_nb_entries,
-	                      $p_nb_entries, $p_size,
-						  $p_offset, strlen($p_comment));
-
-    // ----- Write the 22 bytes of the header in the zip file
-    fputs($this->zip_fd, $v_binary_data, 22);
-
-    // ----- Write the variable fields
-    if (strlen($p_comment) != 0)
-    {
-      fputs($this->zip_fd, $p_comment, strlen($p_comment));
-    }
-
-    // ----- Return
-    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
-    return $v_result;
-  }
-  // --------------------------------------------------------------------------------
-
-  // --------------------------------------------------------------------------------
-  // Function : privList()
-  // Description :
-  // Parameters :
-  // Return Values :
-  // --------------------------------------------------------------------------------
-  function privList(&$p_list)
-  {
-    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privList", "list");
-    $v_result=1;
-
-    // ----- Open the zip file
-    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Open file in binary read mode");
-    if (($this->zip_fd = @fopen($this->zipname, 'rb')) == 0)
-    {
-      // ----- Error log
-      PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open archive \''.$this->zipname.'\' in binary read mode');
-
-      // ----- Return
-      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
-      return PclZip::errorCode();
-    }
-
-    // ----- Read the central directory informations
-    $v_central_dir = array();
-    if (($v_result = $this->privReadEndCentralDir($v_central_dir)) != 1)
-    {
-      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
-      return $v_result;
-    }
-
-    // ----- Go to beginning of Central Dir
-    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Offset : ".$v_central_dir['offset']."'");
-    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Position in file : ".ftell($this->zip_fd)."'");
-    @rewind($this->zip_fd);
-    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Position in file : ".ftell($this->zip_fd)."'");
-    if (@fseek($this->zip_fd, $v_central_dir['offset']))
-    {
-      // ----- Error log
-      PclZip::privErrorLog(PCLZIP_ERR_INVALID_ARCHIVE_ZIP, 'Invalid archive size');
-
-      // ----- Return
-      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
-      return PclZip::errorCode();
-    }
-    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Position in file : ".ftell($this->zip_fd)."'");
-
-    // ----- Read each entry
-    for ($i=0; $i<$v_central_dir['entries']; $i++)
-    {
-      // ----- Read the file header
-      if (($v_result = $this->privReadCentralFileHeader($v_header)) != 1)
-      {
-        //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
-        return $v_result;
-      }
-      $v_header['index'] = $i;
-
-      // ----- Get the only interesting attributes
-      $this->privConvertHeader2FileInfo($v_header, $p_list[$i]);
-      unset($v_header);
-    }
-
-    // ----- Close the zip file
-    $this->privCloseFd();
-
-    // ----- Return
-    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
-    return $v_result;
-  }
-  // --------------------------------------------------------------------------------
-
-  // --------------------------------------------------------------------------------
-  // Function : privConvertHeader2FileInfo()
-  // Description :
-  //   This function takes the file informations from the central directory
-  //   entries and extract the interesting parameters that will be given back.
-  //   The resulting file infos are set in the array $p_info
-  //     $p_info['filename'] : Filename with full path. Given by user (add),
-  //                           extracted in the filesystem (extract).
-  //     $p_info['stored_filename'] : Stored filename in the archive.
-  //     $p_info['size'] = Size of the file.
-  //     $p_info['compressed_size'] = Compressed size of the file.
-  //     $p_info['mtime'] = Last modification date of the file.
-  //     $p_info['comment'] = Comment associated with the file.
-  //     $p_info['folder'] = true/false : indicates if the entry is a folder or not.
-  //     $p_info['status'] = status of the action on the file.
-  // Parameters :
-  // Return Values :
-  // --------------------------------------------------------------------------------
-  function privConvertHeader2FileInfo($p_header, &$p_info)
-  {
-    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privConvertHeader2FileInfo", "Filename='".$p_header['filename']."'");
-    $v_result=1;
-
-    // ----- Get the interesting attributes
-    $p_info['filename'] = $p_header['filename'];
-    $p_info['stored_filename'] = $p_header['stored_filename'];
-    $p_info['size'] = $p_header['size'];
-    $p_info['compressed_size'] = $p_header['compressed_size'];
-    $p_info['mtime'] = $p_header['mtime'];
-    $p_info['comment'] = $p_header['comment'];
-    $p_info['folder'] = (($p_header['external']&0x00000010)==0x00000010);
-    $p_info['index'] = $p_header['index'];
-    $p_info['status'] = $p_header['status'];
-
-    // ----- Return
-    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
-    return $v_result;
-  }
-  // --------------------------------------------------------------------------------
-
-  // --------------------------------------------------------------------------------
-  // Function : privExtractByRule()
-  // Description :
-  //   Extract a file or directory depending of rules (by index, by name, ...)
-  // Parameters :
-  //   $p_file_list : An array where will be placed the properties of each
-  //                  extracted file
-  //   $p_path : Path to add while writing the extracted files
-  //   $p_remove_path : Path to remove (from the file memorized path) while writing the
-  //                    extracted files. If the path does not match the file path,
-  //                    the file is extracted with its memorized path.
-  //                    $p_remove_path does not apply to 'list' mode.
-  //                    $p_path and $p_remove_path are commulative.
-  // Return Values :
-  //   1 on success,0 or less on error (see error code list)
-  // --------------------------------------------------------------------------------
-  function privExtractByRule(&$p_file_list, $p_path, $p_remove_path, $p_remove_all_path, &$p_options)
-  {
-    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privExtractByRule", "path='$p_path', remove_path='$p_remove_path', remove_all_path='".($p_remove_all_path?'true':'false')."'");
-    $v_result=1;
-
-    // ----- Check the path
-    if (($p_path == "") || ((substr($p_path, 0, 1) != "/") && (substr($p_path, 0, 3) != "../") && (substr($p_path,1,2)!=":/")))
-      $p_path = "./".$p_path;
-
-    // ----- Reduce the path last (and duplicated) '/'
-    if (($p_path != "./") && ($p_path != "/"))
-    {
-      // ----- Look for the path end '/'
-      while (substr($p_path, -1) == "/")
-      {
-        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Destination path [$p_path] ends by '/'");
-        $p_path = substr($p_path, 0, strlen($p_path)-1);
-        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Modified to [$p_path]");
-      }
-    }
-
-    // ----- Look for path to remove format (should end by /)
-    if (($p_remove_path != "") && (substr($p_remove_path, -1) != '/'))
-    {
-      $p_remove_path .= '/';
-    }
-    $p_remove_path_size = strlen($p_remove_path);
-
-    // ----- Open the zip file
-    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Open file in binary read mode");
-    if (($v_result = $this->privOpenFd('rb')) != 1)
-    {
-      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
-      return $v_result;
-    }
-
-    // ----- Read the central directory informations
-    $v_central_dir = array();
-    if (($v_result = $this->privReadEndCentralDir($v_central_dir)) != 1)
-    {
-      // ----- Close the zip file
-      $this->privCloseFd();
-
-      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
-      return $v_result;
-    }
-
-    // ----- Start at beginning of Central Dir
-    $v_pos_entry = $v_central_dir['offset'];
-
-    // ----- Read each entry
-    $j_start = 0;
-    for ($i=0, $v_nb_extracted=0; $i<$v_central_dir['entries']; $i++)
-    {
-      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Read next file header entry : '$i'");
-
-      // ----- Read next Central dir entry
-      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Position before rewind : ".ftell($this->zip_fd)."'");
-      @rewind($this->zip_fd);
-      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Position after rewind : ".ftell($this->zip_fd)."'");
-      if (@fseek($this->zip_fd, $v_pos_entry))
-      {
-        // ----- Close the zip file
-        $this->privCloseFd();
-
-        // ----- Error log
-        PclZip::privErrorLog(PCLZIP_ERR_INVALID_ARCHIVE_ZIP, 'Invalid archive size');
-
-        // ----- Return
-        //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
-        return PclZip::errorCode();
-      }
-      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Position after fseek : ".ftell($this->zip_fd)."'");
-
-      // ----- Read the file header
-      $v_header = array();
-      if (($v_result = $this->privReadCentralFileHeader($v_header)) != 1)
-      {
-        // ----- Close the zip file
-        $this->privCloseFd();
-
-        //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
-        return $v_result;
-      }
-
-      // ----- Store the index
-      $v_header['index'] = $i;
-
-      // ----- Store the file position
-      $v_pos_entry = ftell($this->zip_fd);
-
-      // ----- Look for the specific extract rules
-      $v_extract = false;
-
-      // ----- Look for extract by name rule
-      if (   (isset($p_options[PCLZIP_OPT_BY_NAME]))
-          && ($p_options[PCLZIP_OPT_BY_NAME] != 0)) {
-          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Extract with rule 'ByName'");
-
-          // ----- Look if the filename is in the list
-          for ($j=0; ($j<sizeof($p_options[PCLZIP_OPT_BY_NAME])) && (!$v_extract); $j++) {
-              //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Compare with file '".$p_options[PCLZIP_OPT_BY_NAME][$j]."'");
-
-              // ----- Look for a directory
-              if (substr($p_options[PCLZIP_OPT_BY_NAME][$j], -1) == "/") {
-                  //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "The searched item is a directory");
-
-                  // ----- Look if the directory is in the filename path
-                  if (   (strlen($v_header['stored_filename']) > strlen($p_options[PCLZIP_OPT_BY_NAME][$j]))
-                      && (substr($v_header['stored_filename'], 0, strlen($p_options[PCLZIP_OPT_BY_NAME][$j])) == $p_options[PCLZIP_OPT_BY_NAME][$j])) {
-                      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "The directory is in the file path");
-                      $v_extract = true;
-                  }
-              }
-              // ----- Look for a filename
-              elseif ($v_header['stored_filename'] == $p_options[PCLZIP_OPT_BY_NAME][$j]) {
-                  //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "The file is the right one.");
-                  $v_extract = true;
-              }
-          }
-      }
-
-      // ----- Look for extract by ereg rule
-      else if (   (isset($p_options[PCLZIP_OPT_BY_EREG]))
-               && ($p_options[PCLZIP_OPT_BY_EREG] != "")) {
-          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Extract by ereg '".$p_options[PCLZIP_OPT_BY_EREG]."'");
-
-          if (ereg($p_options[PCLZIP_OPT_BY_EREG], $v_header['stored_filename'])) {
-              //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Filename match the regular expression");
-              $v_extract = true;
-          }
-      }
-
-      // ----- Look for extract by preg rule
-      else if (   (isset($p_options[PCLZIP_OPT_BY_PREG]))
-               && ($p_options[PCLZIP_OPT_BY_PREG] != "")) {
-          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Extract with rule 'ByEreg'");
-
-          if (preg_match($p_options[PCLZIP_OPT_BY_PREG], $v_header['stored_filename'])) {
-              //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Filename match the regular expression");
-              $v_extract = true;
-          }
-      }
-
-      // ----- Look for extract by index rule
-      else if (   (isset($p_options[PCLZIP_OPT_BY_INDEX]))
-               && ($p_options[PCLZIP_OPT_BY_INDEX] != 0)) {
-          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Extract with rule 'ByIndex'");
-          
-          // ----- Look if the index is in the list
-          for ($j=$j_start; ($j<sizeof($p_options[PCLZIP_OPT_BY_INDEX])) && (!$v_extract); $j++) {
-              //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Look if index '$i' is in [".$p_options[PCLZIP_OPT_BY_INDEX][$j]['start'].",".$p_options[PCLZIP_OPT_BY_INDEX][$j]['end']."]");
-
-              if (($i>=$p_options[PCLZIP_OPT_BY_INDEX][$j]['start']) && ($i<=$p_options[PCLZIP_OPT_BY_INDEX][$j]['end'])) {
-                  //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Found as part of an index range");
-                  $v_extract = true;
-              }
-              if ($i>=$p_options[PCLZIP_OPT_BY_INDEX][$j]['end']) {
-                  //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Do not look this index range for next loop");
-                  $j_start = $j+1;
-              }
-
-              if ($p_options[PCLZIP_OPT_BY_INDEX][$j]['start']>$i) {
-                  //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Index range is greater than index, stop loop");
-                  break;
-              }
-          }
-      }
-
-      // ----- Look for no rule, which means extract all the archive
-      else {
-          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Extract with no rule (extract all)");
-          $v_extract = true;
-      }
-
-	  // ----- Check compression method
-	  if (   ($v_extract)
-	      && (   ($v_header['compression'] != 8)
-		      && ($v_header['compression'] != 0))) {
-          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Unsupported compression method (".$v_header['compression'].")");
-          $v_header['status'] = 'unsupported_compression';
-
-          // ----- Look for PCLZIP_OPT_STOP_ON_ERROR
-          if (   (isset($p_options[PCLZIP_OPT_STOP_ON_ERROR]))
-		      && ($p_options[PCLZIP_OPT_STOP_ON_ERROR]===true)) {
-              //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "PCLZIP_OPT_STOP_ON_ERROR is selected, extraction will be stopped");
-
-              PclZip::privErrorLog(PCLZIP_ERR_UNSUPPORTED_COMPRESSION,
-			                       "Filename '".$v_header['stored_filename']."' is "
-				  	    	  	   ."compressed by an unsupported compression "
-				  	    	  	   ."method (".$v_header['compression'].") ");
-
-              //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
-              return PclZip::errorCode();
-		  }
-	  }
-	  
-	  // ----- Check encrypted files
-	  if (($v_extract) && (($v_header['flag'] & 1) == 1)) {
-          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Unsupported file encryption");
-          $v_header['status'] = 'unsupported_encryption';
-
-          // ----- Look for PCLZIP_OPT_STOP_ON_ERROR
-          if (   (isset($p_options[PCLZIP_OPT_STOP_ON_ERROR]))
-		      && ($p_options[PCLZIP_OPT_STOP_ON_ERROR]===true)) {
-              //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "PCLZIP_OPT_STOP_ON_ERROR is selected, extraction will be stopped");
-
-              PclZip::privErrorLog(PCLZIP_ERR_UNSUPPORTED_ENCRYPTION,
-			                       "Unsupported encryption for "
-				  	    	  	   ." filename '".$v_header['stored_filename']
-								   ."'");
-
-              //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
-              return PclZip::errorCode();
-		  }
-	  }
-
-      // ----- Look for real extraction
-      if (($v_extract) && ($v_header['status'] != 'ok')) {
-          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "No need for extract");
-          $v_result = $this->privConvertHeader2FileInfo($v_header,
-		                                        $p_file_list[$v_nb_extracted++]);
-          if ($v_result != 1) {
-              $this->privCloseFd();
-              //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
-              return $v_result;
-          }
-
-          $v_extract = false;
-      }
-      
-      // ----- Look for real extraction
-      if ($v_extract)
-      {
-        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Extracting file '".$v_header['filename']."', index '$i'");
-
-        // ----- Go to the file position
-        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Position before rewind : ".ftell($this->zip_fd)."'");
-        @rewind($this->zip_fd);
-        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Position after rewind : ".ftell($this->zip_fd)."'");
-        if (@fseek($this->zip_fd, $v_header['offset']))
-        {
-          // ----- Close the zip file
-          $this->privCloseFd();
-
-          // ----- Error log
-          PclZip::privErrorLog(PCLZIP_ERR_INVALID_ARCHIVE_ZIP, 'Invalid archive size');
-
-          // ----- Return
-          //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
-          return PclZip::errorCode();
-        }
-        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Position after fseek : ".ftell($this->zip_fd)."'");
-
-        // ----- Look for extraction as string
-        if ($p_options[PCLZIP_OPT_EXTRACT_AS_STRING]) {
-
-          // ----- Extracting the file
-          $v_result1 = $this->privExtractFileAsString($v_header, $v_string);
-          if ($v_result1 < 1) {
-            $this->privCloseFd();
-            //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result1);
-            return $v_result1;
-          }
-
-          // ----- Get the only interesting attributes
-          if (($v_result = $this->privConvertHeader2FileInfo($v_header, $p_file_list[$v_nb_extracted])) != 1)
-          {
-            // ----- Close the zip file
-            $this->privCloseFd();
-
-            //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
-            return $v_result;
-          }
-
-          // ----- Set the file content
-          $p_file_list[$v_nb_extracted]['content'] = $v_string;
-
-          // ----- Next extracted file
-          $v_nb_extracted++;
-          
-          // ----- Look for user callback abort
-          if ($v_result1 == 2) {
-          	break;
-          }
-        }
-        // ----- Look for extraction in standard output
-        elseif (   (isset($p_options[PCLZIP_OPT_EXTRACT_IN_OUTPUT]))
-		        && ($p_options[PCLZIP_OPT_EXTRACT_IN_OUTPUT])) {
-          // ----- Extracting the file in standard output
-          $v_result1 = $this->privExtractFileInOutput($v_header, $p_options);
-          if ($v_result1 < 1) {
-            $this->privCloseFd();
-            //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result1);
-            return $v_result1;
-          }
-
-          // ----- Get the only interesting attributes
-          if (($v_result = $this->privConvertHeader2FileInfo($v_header, $p_file_list[$v_nb_extracted++])) != 1) {
-            $this->privCloseFd();
-            //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
-            return $v_result;
-          }
-
-          // ----- Look for user callback abort
-          if ($v_result1 == 2) {
-          	break;
-          }
-        }
-        // ----- Look for normal extraction
-        else {
-          // ----- Extracting the file
-          $v_result1 = $this->privExtractFile($v_header,
-		                                      $p_path, $p_remove_path,
-											  $p_remove_all_path,
-											  $p_options);
-          if ($v_result1 < 1) {
-            $this->privCloseFd();
-            //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result1);
-            return $v_result1;
-          }
-
-          // ----- Get the only interesting attributes
-          if (($v_result = $this->privConvertHeader2FileInfo($v_header, $p_file_list[$v_nb_extracted++])) != 1)
-          {
-            // ----- Close the zip file
-            $this->privCloseFd();
-
-            //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
-            return $v_result;
-          }
-
-          // ----- Look for user callback abort
-          if ($v_result1 == 2) {
-          	break;
-          }
-        }
-      }
-    }
-
-    // ----- Close the zip file
-    $this->privCloseFd();
-
-    // ----- Return
-    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
-    return $v_result;
-  }
-  // --------------------------------------------------------------------------------
-
-  // --------------------------------------------------------------------------------
-  // Function : privExtractFile()
-  // Description :
-  // Parameters :
-  // Return Values :
-  //
-  // 1 : ... ?
-  // PCLZIP_ERR_USER_ABORTED(2) : User ask for extraction stop in callback
-  // --------------------------------------------------------------------------------
-  function privExtractFile(&$p_entry, $p_path, $p_remove_path, $p_remove_all_path, &$p_options)
-  {
-    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, 'PclZip::privExtractFile', "path='$p_path', remove_path='$p_remove_path', remove_all_path='".($p_remove_all_path?'true':'false')."'");
-    $v_result=1;
-
-    // ----- Read the file header
-    if (($v_result = $this->privReadFileHeader($v_header)) != 1)
-    {
-      // ----- Return
-      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
-      return $v_result;
-    }
-
-    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Found file '".$v_header['filename']."', size '".$v_header['size']."'");
-
-    // ----- Check that the file header is coherent with $p_entry info
-    if ($this->privCheckFileHeaders($v_header, $p_entry) != 1) {
-        // TBC
-    }
-
-    // ----- Look for all path to remove
-    if ($p_remove_all_path == true) {
-        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "All path is removed");
-        // ----- Get the basename of the path
-        $p_entry['filename'] = basename($p_entry['filename']);
-    }
-
-    // ----- Look for path to remove
-    else if ($p_remove_path != "")
-    {
-      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Look for some path to remove");
-      if (PclZipUtilPathInclusion($p_remove_path, $p_entry['filename']) == 2)
-      {
-        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "The folder is the same as the removed path '".$p_entry['filename']."'");
-
-        // ----- Change the file status
-        $p_entry['status'] = "filtered";
-
-        // ----- Return
-        //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
-        return $v_result;
-      }
-
-      $p_remove_path_size = strlen($p_remove_path);
-      if (substr($p_entry['filename'], 0, $p_remove_path_size) == $p_remove_path)
-      {
-        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Found path '$p_remove_path' to remove in file '".$p_entry['filename']."'");
-
-        // ----- Remove the path
-        $p_entry['filename'] = substr($p_entry['filename'], $p_remove_path_size);
-
-        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Resulting file is '".$p_entry['filename']."'");
-      }
-    }
-
-    // ----- Add the path
-    if ($p_path != '')
-    {
-      $p_entry['filename'] = $p_path."/".$p_entry['filename'];
-    }
-
-    // ----- Look for pre-extract callback
-    if (isset($p_options[PCLZIP_CB_PRE_EXTRACT])) {
-      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "A pre-callback '".$p_options[PCLZIP_CB_PRE_EXTRACT]."()') is defined for the extraction");
-
-      // ----- Generate a local information
-      $v_local_header = array();
-      $this->privConvertHeader2FileInfo($p_entry, $v_local_header);
-
-      // ----- Call the callback
-      // Here I do not use call_user_func() because I need to send a reference to the
-      // header.
-      eval('$v_result = '.$p_options[PCLZIP_CB_PRE_EXTRACT].'(PCLZIP_CB_PRE_EXTRACT, $v_local_header);');
-      if ($v_result == 0) {
-        // ----- Change the file status
-        $p_entry['status'] = "skipped";
-        $v_result = 1;
-      }
-      
-      // ----- Look for abort result
-      if ($v_result == 2) {
-        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "User callback abort the extraction");
-        // ----- This status is internal and will be changed in 'skipped'
-        $p_entry['status'] = "aborted";
-      	$v_result = PCLZIP_ERR_USER_ABORTED;
-      }
-
-      // ----- Update the informations
-      // Only some fields can be modified
-      $p_entry['filename'] = $v_local_header['filename'];
-      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "New filename is '".$p_entry['filename']."'");
-    }
-
-    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Extracting file (with path) '".$p_entry['filename']."', size '$v_header[size]'");
-
-    // ----- Look if extraction should be done
-    if ($p_entry['status'] == 'ok') {
-
-    // ----- Look for specific actions while the file exist
-    if (file_exists($p_entry['filename']))
-    {
-      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "File '".$p_entry['filename']."' already exists");
-
-      // ----- Look if file is a directory
-      if (is_dir($p_entry['filename']))
-      {
-        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Existing file '".$p_entry['filename']."' is a directory");
-
-        // ----- Change the file status
-        $p_entry['status'] = "already_a_directory";
-        
-        // ----- Look for PCLZIP_OPT_STOP_ON_ERROR
-        // For historical reason first PclZip implementation does not stop
-        // when this kind of error occurs.
-        if (   (isset($p_options[PCLZIP_OPT_STOP_ON_ERROR]))
-		    && ($p_options[PCLZIP_OPT_STOP_ON_ERROR]===true)) {
-            //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "PCLZIP_OPT_STOP_ON_ERROR is selected, extraction will be stopped");
-
-            PclZip::privErrorLog(PCLZIP_ERR_ALREADY_A_DIRECTORY,
-			                     "Filename '".$p_entry['filename']."' is "
-								 ."already used by an existing directory");
-
-            //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
-            return PclZip::errorCode();
-		}
-      }
-      // ----- Look if file is write protected
-      else if (!is_writeable($p_entry['filename']))
-      {
-        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Existing file '".$p_entry['filename']."' is write protected");
-
-        // ----- Change the file status
-        $p_entry['status'] = "write_protected";
-
-        // ----- Look for PCLZIP_OPT_STOP_ON_ERROR
-        // For historical reason first PclZip implementation does not stop
-        // when this kind of error occurs.
-        if (   (isset($p_options[PCLZIP_OPT_STOP_ON_ERROR]))
-		    && ($p_options[PCLZIP_OPT_STOP_ON_ERROR]===true)) {
-            //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "PCLZIP_OPT_STOP_ON_ERROR is selected, extraction will be stopped");
-
-            PclZip::privErrorLog(PCLZIP_ERR_WRITE_OPEN_FAIL,
-			                     "Filename '".$p_entry['filename']."' exists "
-								 ."and is write protected");
-
-            //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
-            return PclZip::errorCode();
-		}
-      }
-
-      // ----- Look if the extracted file is older
-      else if (filemtime($p_entry['filename']) > $p_entry['mtime'])
-      {
-        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Existing file '".$p_entry['filename']."' is newer (".date("l dS of F Y h:i:s A", filemtime($p_entry['filename'])).") than the extracted file (".date("l dS of F Y h:i:s A", $p_entry['mtime']).")");
-        // ----- Change the file status
-        if (   (isset($p_options[PCLZIP_OPT_REPLACE_NEWER]))
-		    && ($p_options[PCLZIP_OPT_REPLACE_NEWER]===true)) {
-            //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "PCLZIP_OPT_REPLACE_NEWER is selected, file will be replaced");
-		}
-		else {
-            //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "File will not be replaced");
-            $p_entry['status'] = "newer_exist";
-
-            // ----- Look for PCLZIP_OPT_STOP_ON_ERROR
-            // For historical reason first PclZip implementation does not stop
-            // when this kind of error occurs.
-            if (   (isset($p_options[PCLZIP_OPT_STOP_ON_ERROR]))
-		        && ($p_options[PCLZIP_OPT_STOP_ON_ERROR]===true)) {
-                //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "PCLZIP_OPT_STOP_ON_ERROR is selected, extraction will be stopped");
-
-                PclZip::privErrorLog(PCLZIP_ERR_WRITE_OPEN_FAIL,
-			             "Newer version of '".$p_entry['filename']."' exists "
-					    ."and option PCLZIP_OPT_REPLACE_NEWER is not selected");
-
-                //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
-                return PclZip::errorCode();
-		    }
-		}
-      }
-      else {
-        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Existing file '".$p_entry['filename']."' is older than the extrated one - will be replaced by the extracted one (".date("l dS of F Y h:i:s A", filemtime($p_entry['filename'])).") than the extracted file (".date("l dS of F Y h:i:s A", $p_entry['mtime']).")");
-      }
-    }
-
-    // ----- Check the directory availability and create it if necessary
-    else {
-      if ((($p_entry['external']&0x00000010)==0x00000010) || (substr($p_entry['filename'], -1) == '/'))
-        $v_dir_to_check = $p_entry['filename'];
-      else if (!strstr($p_entry['filename'], "/"))
-        $v_dir_to_check = "";
-      else
-        $v_dir_to_check = dirname($p_entry['filename']);
-
-      if (($v_result = $this->privDirCheck($v_dir_to_check, (($p_entry['external']&0x00000010)==0x00000010))) != 1) {
-        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Unable to create path for '".$p_entry['filename']."'");
-
-        // ----- Change the file status
-        $p_entry['status'] = "path_creation_fail";
-
-        // ----- Return
-        ////--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
-        //return $v_result;
-        $v_result = 1;
-      }
-    }
-    }
-
-    // ----- Look if extraction should be done
-    if ($p_entry['status'] == 'ok') {
-
-      // ----- Do the extraction (if not a folder)
-      if (!(($p_entry['external']&0x00000010)==0x00000010))
-      {
-        // ----- Look for not compressed file
-        if ($p_entry['compression'] == 0) {
-          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Extracting an un-compressed file");
-
-		  // ----- Opening destination file
-          if (($v_dest_file = @fopen($p_entry['filename'], 'wb')) == 0)
-          {
-            //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Error while opening '".$p_entry['filename']."' in write binary mode");
-
-            // ----- Change the file status
-            $p_entry['status'] = "write_error";
-
-            // ----- Return
-            //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
-            return $v_result;
-          }
-
-          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Read '".$p_entry['size']."' bytes");
-
-          // ----- Read the file by PCLZIP_READ_BLOCK_SIZE octets blocks
-          $v_size = $p_entry['compressed_size'];
-          while ($v_size != 0)
-          {
-            $v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE);
-            //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Read $v_read_size bytes");
-            $v_buffer = fread($this->zip_fd, $v_read_size);
-            $v_binary_data = pack('a'.$v_read_size, $v_buffer);
-            @fwrite($v_dest_file, $v_binary_data, $v_read_size);
-            $v_size -= $v_read_size;
-          }
-
-          // ----- Closing the destination file
-          fclose($v_dest_file);
-
-          // ----- Change the file mtime
-          touch($p_entry['filename'], $p_entry['mtime']);
-          
-
-        }
-        else {
-          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Extracting a compressed file (Compression method ".$p_entry['compression'].")");
-          // ----- TBC
-          // Need to be finished
-          if (($p_entry['flag'] & 1) == 1) {
-              //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "File is encrypted");
-            /*
-              // ----- Read the encryption header
-              //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Read 12 encryption header bytes");
-              $v_encryption_header = @fread($this->zip_fd, 12);
-              
-              // ----- Read the encrypted & compressed file in a buffer
-              //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Read '".($p_entry['compressed_size']-12)."' compressed & encrypted bytes");
-              $v_buffer = @fread($this->zip_fd, $p_entry['compressed_size']-12);
-              
-              // ----- Decrypt the buffer
-              $this->privDecrypt($v_encryption_header, $v_buffer,
-			                     $p_entry['compressed_size']-12, $p_entry['crc']);
-              //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Buffer is '".$v_buffer."'");
-              */
-          }
-          else {
-              //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Read '".$p_entry['compressed_size']."' compressed bytes");
-              // ----- Read the compressed file in a buffer (one shot)
-              $v_buffer = @fread($this->zip_fd, $p_entry['compressed_size']);
-          }
-          
-          // ----- Decompress the file
-          $v_file_content = @gzinflate($v_buffer);
-          unset($v_buffer);
-          if ($v_file_content === FALSE) {
-            //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Unable to inflate compressed file");
-
-            // ----- Change the file status
-            // TBC
-            $p_entry['status'] = "error";
-            
-            //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
-            return $v_result;
-          }
-          
-          // ----- Opening destination file
-          if (($v_dest_file = @fopen($p_entry['filename'], 'wb')) == 0) {
-            //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Error while opening '".$p_entry['filename']."' in write binary mode");
-
-            // ----- Change the file status
-            $p_entry['status'] = "write_error";
-
-            //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
-            return $v_result;
-          }
-
-          // ----- Write the uncompressed data
-          @fwrite($v_dest_file, $v_file_content, $p_entry['size']);
-          unset($v_file_content);
-
-          // ----- Closing the destination file
-          @fclose($v_dest_file);
-
-          // ----- Change the file mtime
-          @touch($p_entry['filename'], $p_entry['mtime']);
-        }
-
-        // ----- Look for chmod option
-        if (isset($p_options[PCLZIP_OPT_SET_CHMOD])) {
-          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "chmod option activated '".$p_options[PCLZIP_OPT_SET_CHMOD]."'");
-
-          // ----- Change the mode of the file
-          @chmod($p_entry['filename'], $p_options[PCLZIP_OPT_SET_CHMOD]);
-        }
-
-        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Extraction done");
-      }
-    }
-
-	// ----- Change abort status
-	if ($p_entry['status'] == "aborted") {
-      $p_entry['status'] = "skipped";
-	}
-	
-    // ----- Look for post-extract callback
-    elseif (isset($p_options[PCLZIP_CB_POST_EXTRACT])) {
-      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "A post-callback '".$p_options[PCLZIP_CB_POST_EXTRACT]."()') is defined for the extraction");
-
-      // ----- Generate a local information
-      $v_local_header = array();
-      $this->privConvertHeader2FileInfo($p_entry, $v_local_header);
-
-      // ----- Call the callback
-      // Here I do not use call_user_func() because I need to send a reference to the
-      // header.
-      eval('$v_result = '.$p_options[PCLZIP_CB_POST_EXTRACT].'(PCLZIP_CB_POST_EXTRACT, $v_local_header);');
-
-      // ----- Look for abort result
-      if ($v_result == 2) {
-        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "User callback abort the extraction");
-      	$v_result = PCLZIP_ERR_USER_ABORTED;
-      }
-    }
-
-    // ----- Return
-    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
-    return $v_result;
-  }
-  // --------------------------------------------------------------------------------
-
-  // --------------------------------------------------------------------------------
-  // Function : privExtractFileInOutput()
-  // Description :
-  // Parameters :
-  // Return Values :
-  // --------------------------------------------------------------------------------
-  function privExtractFileInOutput(&$p_entry, &$p_options)
-  {
-    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, 'PclZip::privExtractFileInOutput', "");
-    $v_result=1;
-
-    // ----- Read the file header
-    if (($v_result = $this->privReadFileHeader($v_header)) != 1) {
-      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
-      return $v_result;
-    }
-
-    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Found file '".$v_header['filename']."', size '".$v_header['size']."'");
-
-    // ----- Check that the file header is coherent with $p_entry info
-    if ($this->privCheckFileHeaders($v_header, $p_entry) != 1) {
-        // TBC
-    }
-
-    // ----- Look for pre-extract callback
-    if (isset($p_options[PCLZIP_CB_PRE_EXTRACT])) {
-      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "A pre-callback '".$p_options[PCLZIP_CB_PRE_EXTRACT]."()') is defined for the extraction");
-
-      // ----- Generate a local information
-      $v_local_header = array();
-      $this->privConvertHeader2FileInfo($p_entry, $v_local_header);
-
-      // ----- Call the callback
-      // Here I do not use call_user_func() because I need to send a reference to the
-      // header.
-      eval('$v_result = '.$p_options[PCLZIP_CB_PRE_EXTRACT].'(PCLZIP_CB_PRE_EXTRACT, $v_local_header);');
-      if ($v_result == 0) {
-        // ----- Change the file status
-        $p_entry['status'] = "skipped";
-        $v_result = 1;
-      }
-
-      // ----- Look for abort result
-      if ($v_result == 2) {
-        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "User callback abort the extraction");
-        // ----- This status is internal and will be changed in 'skipped'
-        $p_entry['status'] = "aborted";
-      	$v_result = PCLZIP_ERR_USER_ABORTED;
-      }
-
-      // ----- Update the informations
-      // Only some fields can be modified
-      $p_entry['filename'] = $v_local_header['filename'];
-      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "New filename is '".$p_entry['filename']."'");
-    }
-
-    // ----- Trace
-    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Extracting file (with path) '".$p_entry['filename']."', size '$v_header[size]'");
-
-    // ----- Look if extraction should be done
-    if ($p_entry['status'] == 'ok') {
-
-      // ----- Do the extraction (if not a folder)
-      if (!(($p_entry['external']&0x00000010)==0x00000010)) {
-        // ----- Look for not compressed file
-        if ($p_entry['compressed_size'] == $p_entry['size']) {
-          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Extracting an un-compressed file");
-          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Reading '".$p_entry['size']."' bytes");
-
-          // ----- Read the file in a buffer (one shot)
-          $v_buffer = @fread($this->zip_fd, $p_entry['compressed_size']);
-
-          // ----- Send the file to the output
-          echo $v_buffer;
-          unset($v_buffer);
-        }
-        else {
-          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Extracting a compressed file");
-          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Reading '".$p_entry['size']."' bytes");
-
-          // ----- Read the compressed file in a buffer (one shot)
-          $v_buffer = @fread($this->zip_fd, $p_entry['compressed_size']);
-          
-          // ----- Decompress the file
-          $v_file_content = gzinflate($v_buffer);
-          unset($v_buffer);
-
-          // ----- Send the file to the output
-          echo $v_file_content;
-          unset($v_file_content);
-        }
-        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Extraction done");
-      }
-    }
-
-	// ----- Change abort status
-	if ($p_entry['status'] == "aborted") {
-      $p_entry['status'] = "skipped";
-	}
-
-    // ----- Look for post-extract callback
-    elseif (isset($p_options[PCLZIP_CB_POST_EXTRACT])) {
-      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "A post-callback '".$p_options[PCLZIP_CB_POST_EXTRACT]."()') is defined for the extraction");
-
-      // ----- Generate a local information
-      $v_local_header = array();
-      $this->privConvertHeader2FileInfo($p_entry, $v_local_header);
-
-      // ----- Call the callback
-      // Here I do not use call_user_func() because I need to send a reference to the
-      // header.
-      eval('$v_result = '.$p_options[PCLZIP_CB_POST_EXTRACT].'(PCLZIP_CB_POST_EXTRACT, $v_local_header);');
-
-      // ----- Look for abort result
-      if ($v_result == 2) {
-        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "User callback abort the extraction");
-      	$v_result = PCLZIP_ERR_USER_ABORTED;
-      }
-    }
-
-    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
-    return $v_result;
-  }
-  // --------------------------------------------------------------------------------
-
-  // --------------------------------------------------------------------------------
-  // Function : privExtractFileAsString()
-  // Description :
-  // Parameters :
-  // Return Values :
-  // --------------------------------------------------------------------------------
-  function privExtractFileAsString(&$p_entry, &$p_string)
-  {
-    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, 'PclZip::privExtractFileAsString', "p_entry['filename']='".$p_entry['filename']."'");
-    $v_result=1;
-
-    // ----- Read the file header
-    $v_header = array();
-    if (($v_result = $this->privReadFileHeader($v_header)) != 1)
-    {
-      // ----- Return
-      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
-      return $v_result;
-    }
-
-    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Found file '".$v_header['filename']."', size '".$v_header['size']."'");
-
-    // ----- Check that the file header is coherent with $p_entry info
-    if ($this->privCheckFileHeaders($v_header, $p_entry) != 1) {
-        // TBC
-    }
-
-    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Extracting file in string (with path) '".$p_entry['filename']."', size '$v_header[size]'");
-
-    // ----- Do the extraction (if not a folder)
-    if (!(($p_entry['external']&0x00000010)==0x00000010))
-    {
-      // ----- Look for not compressed file
-      if ($p_entry['compressed_size'] == $p_entry['size'])
-      {
-        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Extracting an un-compressed file");
-        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Reading '".$p_entry['size']."' bytes");
-
-        // ----- Reading the file
-        $p_string = @fread($this->zip_fd, $p_entry['compressed_size']);
-      }
-      else
-      {
-        // ----- Trace
-        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Extracting a compressed file");
-
-        // ----- Reading the file
-        $v_data = @fread($this->zip_fd, $p_entry['compressed_size']);
-        
-        // ----- Decompress the file
-        if (($p_string = @gzinflate($v_data)) === FALSE) {
-            // TBC
-        }
-      }
-
-      // ----- Trace
-      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Extraction done");
-    }
-    else {
-        // TBC : error : can not extract a folder in a string
-    }
-
-    // ----- Return
-    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
-    return $v_result;
-  }
-  // --------------------------------------------------------------------------------
-
-  // --------------------------------------------------------------------------------
-  // Function : privReadFileHeader()
-  // Description :
-  // Parameters :
-  // Return Values :
-  // --------------------------------------------------------------------------------
-  function privReadFileHeader(&$p_header)
-  {
-    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privReadFileHeader", "");
-    $v_result=1;
-
-    // ----- Read the 4 bytes signature
-    $v_binary_data = @fread($this->zip_fd, 4);
-    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Binary data is : '".sprintf("%08x", $v_binary_data)."'");
-    $v_data = unpack('Vid', $v_binary_data);
-    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Binary signature is : '".sprintf("0x%08x", $v_data['id'])."'");
-
-    // ----- Check signature
-    if ($v_data['id'] != 0x04034b50)
-    {
-      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Invalid File header");
-
-      // ----- Error log
-      PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, 'Invalid archive structure');
-
-      // ----- Return
-      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
-      return PclZip::errorCode();
-    }
-
-    // ----- Read the first 42 bytes of the header
-    $v_binary_data = fread($this->zip_fd, 26);
-
-    // ----- Look for invalid block size
-    if (strlen($v_binary_data) != 26)
-    {
-      $p_header['filename'] = "";
-      $p_header['status'] = "invalid_header";
-      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Invalid block size : ".strlen($v_binary_data));
-
-      // ----- Error log
-      PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, "Invalid block size : ".strlen($v_binary_data));
-
-      // ----- Return
-      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
-      return PclZip::errorCode();
-    }
-
-    // ----- Extract the values
-    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Header : '".$v_binary_data."'");
-    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Header (Hex) : '".bin2hex($v_binary_data)."'");
-    $v_data = unpack('vversion/vflag/vcompression/vmtime/vmdate/Vcrc/Vcompressed_size/Vsize/vfilename_len/vextra_len', $v_binary_data);
-
-    // ----- Get filename
-    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "File name length : ".$v_data['filename_len']);
-    $p_header['filename'] = fread($this->zip_fd, $v_data['filename_len']);
-    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Filename : \''.$p_header['filename'].'\'');
-
-    // ----- Get extra_fields
-    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Extra field length : ".$v_data['extra_len']);
-    if ($v_data['extra_len'] != 0) {
-      $p_header['extra'] = fread($this->zip_fd, $v_data['extra_len']);
-    }
-    else {
-      $p_header['extra'] = '';
-    }
-    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Extra field : \''.bin2hex($p_header['extra']).'\'');
-
-    // ----- Extract properties
-    $p_header['version_extracted'] = $v_data['version'];
-    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 'Version need to extract : ('.$p_header['version_extracted'].') \''.($p_header['version_extracted']/10).'.'.($p_header['version_extracted']%10).'\'');
-    $p_header['compression'] = $v_data['compression'];
-    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Compression method : \''.$p_header['compression'].'\'');
-    $p_header['size'] = $v_data['size'];
-    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Size : \''.$p_header['size'].'\'');
-    $p_header['compressed_size'] = $v_data['compressed_size'];
-    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Compressed Size : \''.$p_header['compressed_size'].'\'');
-    $p_header['crc'] = $v_data['crc'];
-    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'CRC : \''.sprintf("0x%X", $p_header['crc']).'\'');
-    $p_header['flag'] = $v_data['flag'];
-    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Flag : \''.$p_header['flag'].'\'');
-
-    // ----- Recuperate date in UNIX format
-    $p_header['mdate'] = $v_data['mdate'];
-    $p_header['mtime'] = $v_data['mtime'];
-    if ($p_header['mdate'] && $p_header['mtime'])
-    {
-      // ----- Extract time
-      $v_hour = ($p_header['mtime'] & 0xF800) >> 11;
-      $v_minute = ($p_header['mtime'] & 0x07E0) >> 5;
-      $v_seconde = ($p_header['mtime'] & 0x001F)*2;
-
-      // ----- Extract date
-      $v_year = (($p_header['mdate'] & 0xFE00) >> 9) + 1980;
-      $v_month = ($p_header['mdate'] & 0x01E0) >> 5;
-      $v_day = $p_header['mdate'] & 0x001F;
-
-      // ----- Get UNIX date format
-      $p_header['mtime'] = mktime($v_hour, $v_minute, $v_seconde, $v_month, $v_day, $v_year);
-
-      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Date : \''.date("d/m/y H:i:s", $p_header['mtime']).'\'');
-    }
-    else
-    {
-      $p_header['mtime'] = time();
-      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Date is actual : \''.date("d/m/y H:i:s", $p_header['mtime']).'\'');
-    }
-
-    // TBC
-    //for(reset($v_data); $key = key($v_data); next($v_data)) {
-    //  //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Attribut[$key] = ".$v_data[$key]);
-    //}
-
-    // ----- Set the stored filename
-    $p_header['stored_filename'] = $p_header['filename'];
-
-    // ----- Set the status field
-    $p_header['status'] = "ok";
-
-    // ----- Return
-    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
-    return $v_result;
-  }
-  // --------------------------------------------------------------------------------
-
-  // --------------------------------------------------------------------------------
-  // Function : privReadCentralFileHeader()
-  // Description :
-  // Parameters :
-  // Return Values :
-  // --------------------------------------------------------------------------------
-  function privReadCentralFileHeader(&$p_header)
-  {
-    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privReadCentralFileHeader", "");
-    $v_result=1;
-
-    // ----- Read the 4 bytes signature
-    $v_binary_data = @fread($this->zip_fd, 4);
-    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Binary data is : '".sprintf("%08x", $v_binary_data)."'");
-    $v_data = unpack('Vid', $v_binary_data);
-    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Binary signature is : '".sprintf("0x%08x", $v_data['id'])."'");
-
-    // ----- Check signature
-    if ($v_data['id'] != 0x02014b50)
-    {
-      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Invalid Central Dir File signature");
-
-      // ----- Error log
-      PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, 'Invalid archive structure');
-
-      // ----- Return
-      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
-      return PclZip::errorCode();
-    }
-
-    // ----- Read the first 42 bytes of the header
-    $v_binary_data = fread($this->zip_fd, 42);
-
-    // ----- Look for invalid block size
-    if (strlen($v_binary_data) != 42)
-    {
-      $p_header['filename'] = "";
-      $p_header['status'] = "invalid_header";
-      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Invalid block size : ".strlen($v_binary_data));
-
-      // ----- Error log
-      PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, "Invalid block size : ".strlen($v_binary_data));
-
-      // ----- Return
-      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
-      return PclZip::errorCode();
-    }
-
-    // ----- Extract the values
-    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Header : '".$v_binary_data."'");
-    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Header (Hex) : '".bin2hex($v_binary_data)."'");
-    $p_header = unpack('vversion/vversion_extracted/vflag/vcompression/vmtime/vmdate/Vcrc/Vcompressed_size/Vsize/vfilename_len/vextra_len/vcomment_len/vdisk/vinternal/Vexternal/Voffset', $v_binary_data);
-
-    // ----- Get filename
-    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "File name length : ".$p_header['filename_len']);
-    if ($p_header['filename_len'] != 0)
-      $p_header['filename'] = fread($this->zip_fd, $p_header['filename_len']);
-    else
-      $p_header['filename'] = '';
-    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 'Filename : \''.$p_header['filename'].'\'');
-
-    // ----- Get extra
-    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Extra length : ".$p_header['extra_len']);
-    if ($p_header['extra_len'] != 0)
-      $p_header['extra'] = fread($this->zip_fd, $p_header['extra_len']);
-    else
-      $p_header['extra'] = '';
-    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 'Extra : \''.$p_header['extra'].'\'');
-
-    // ----- Get comment
-    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Comment length : ".$p_header['comment_len']);
-    if ($p_header['comment_len'] != 0)
-      $p_header['comment'] = fread($this->zip_fd, $p_header['comment_len']);
-    else
-      $p_header['comment'] = '';
-    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 'Comment : \''.$p_header['comment'].'\'');
-
-    // ----- Extract properties
-    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 'Version : \''.($p_header['version']/10).'.'.($p_header['version']%10).'\'');
-    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 'Version need to extract : \''.($p_header['version_extracted']/10).'.'.($p_header['version_extracted']%10).'\'');
-    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 'Size : \''.$p_header['size'].'\'');
-    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 'Compressed Size : \''.$p_header['compressed_size'].'\'');
-    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 'CRC : \''.sprintf("0x%X", $p_header['crc']).'\'');
-    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 'Flag : \''.$p_header['flag'].'\'');
-    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 'Offset : \''.$p_header['offset'].'\'');
-
-    // ----- Recuperate date in UNIX format
-    if ($p_header['mdate'] && $p_header['mtime'])
-    {
-      // ----- Extract time
-      $v_hour = ($p_header['mtime'] & 0xF800) >> 11;
-      $v_minute = ($p_header['mtime'] & 0x07E0) >> 5;
-      $v_seconde = ($p_header['mtime'] & 0x001F)*2;
-
-      // ----- Extract date
-      $v_year = (($p_header['mdate'] & 0xFE00) >> 9) + 1980;
-      $v_month = ($p_header['mdate'] & 0x01E0) >> 5;
-      $v_day = $p_header['mdate'] & 0x001F;
-
-      // ----- Get UNIX date format
-      $p_header['mtime'] = mktime($v_hour, $v_minute, $v_seconde, $v_month, $v_day, $v_year);
-
-      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 'Date : \''.date("d/m/y H:i:s", $p_header['mtime']).'\'');
-    }
-    else
-    {
-      $p_header['mtime'] = time();
-      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 'Date is actual : \''.date("d/m/y H:i:s", $p_header['mtime']).'\'');
-    }
-
-    // ----- Set the stored filename
-    $p_header['stored_filename'] = $p_header['filename'];
-
-    // ----- Set default status to ok
-    $p_header['status'] = 'ok';
-
-    // ----- Look if it is a directory
-    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Internal (Hex) : '".sprintf("Ox%04X", $p_header['internal'])."'");
-    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "External (Hex) : '".sprintf("Ox%04X", $p_header['external'])."' (".(($p_header['external']&0x00000010)==0x00000010?'is a folder':'is a file').')');
-    if (substr($p_header['filename'], -1) == '/') {
-      //$p_header['external'] = 0x41FF0010;
-      $p_header['external'] = 0x00000010;
-      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 'Force folder external : \''.sprintf("Ox%04X", $p_header['external']).'\'');
-    }
-
-    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Header of filename : \''.$p_header['filename'].'\'');
-
-    // ----- Return
-    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
-    return $v_result;
-  }
-  // --------------------------------------------------------------------------------
-
-  // --------------------------------------------------------------------------------
-  // Function : privCheckFileHeaders()
-  // Description :
-  // Parameters :
-  // Return Values :
-  //   1 on success,
-  //   0 on error;
-  // --------------------------------------------------------------------------------
-  function privCheckFileHeaders(&$p_local_header, &$p_central_header)
-  {
-    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privCheckFileHeaders", "");
-    $v_result=1;
-
-	// ----- Check the static values
-	// TBC
-	if ($p_local_header['filename'] != $p_central_header['filename']) {
-        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Bad check "filename" : TBC To Be Completed');
-	}
-	if ($p_local_header['version_extracted'] != $p_central_header['version_extracted']) {
-        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Bad check "version_extracted" : TBC To Be Completed');
-	}
-	if ($p_local_header['flag'] != $p_central_header['flag']) {
-        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Bad check "flag" : TBC To Be Completed');
-	}
-	if ($p_local_header['compression'] != $p_central_header['compression']) {
-        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Bad check "compression" : TBC To Be Completed');
-	}
-	if ($p_local_header['mtime'] != $p_central_header['mtime']) {
-        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Bad check "mtime" : TBC To Be Completed');
-	}
-	if ($p_local_header['filename_len'] != $p_central_header['filename_len']) {
-        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Bad check "filename_len" : TBC To Be Completed');
-	}
-
-	// ----- Look for flag bit 3
-	if (($p_local_header['flag'] & 8) == 8) {
-        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Purpose bit flag bit 3 set !');
-        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'File size, compression size and crc found in central header');
-        $p_local_header['size'] = $p_central_header['size'];
-        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Size : \''.$p_local_header['size'].'\'');
-        $p_local_header['compressed_size'] = $p_central_header['compressed_size'];
-        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Compressed Size : \''.$p_local_header['compressed_size'].'\'');
-        $p_local_header['crc'] = $p_central_header['crc'];
-        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'CRC : \''.sprintf("0x%X", $p_local_header['crc']).'\'');
-	}
-
-    // ----- Return
-    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
-    return $v_result;
-  }
-  // --------------------------------------------------------------------------------
-
-  // --------------------------------------------------------------------------------
-  // Function : privReadEndCentralDir()
-  // Description :
-  // Parameters :
-  // Return Values :
-  // --------------------------------------------------------------------------------
-  function privReadEndCentralDir(&$p_central_dir)
-  {
-    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privReadEndCentralDir", "");
-    $v_result=1;
-
-    // ----- Go to the end of the zip file
-    $v_size = filesize($this->zipname);
-    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Size of the file :$v_size");
-    @fseek($this->zip_fd, $v_size);
-    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 'Position at end of zip file : \''.ftell($this->zip_fd).'\'');
-    if (@ftell($this->zip_fd) != $v_size)
-    {
-      // ----- Error log
-      PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, 'Unable to go to the end of the archive \''.$this->zipname.'\'');
-
-      // ----- Return
-      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
-      return PclZip::errorCode();
-    }
-
-    // ----- First try : look if this is an archive with no commentaries (most of the time)
-    // in this case the end of central dir is at 22 bytes of the file end
-    $v_found = 0;
-    if ($v_size > 26) {
-      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 'Look for central dir with no comment');
-      @fseek($this->zip_fd, $v_size-22);
-      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 'Position after min central position : \''.ftell($this->zip_fd).'\'');
-      if (($v_pos = @ftell($this->zip_fd)) != ($v_size-22))
-      {
-        // ----- Error log
-        PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, 'Unable to seek back to the middle of the archive \''.$this->zipname.'\'');
-
-        // ----- Return
-        //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
-        return PclZip::errorCode();
-      }
-
-      // ----- Read for bytes
-      $v_binary_data = @fread($this->zip_fd, 4);
-      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Binary data is : '".sprintf("%08x", $v_binary_data)."'");
-      $v_data = @unpack('Vid', $v_binary_data);
-      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Binary signature is : '".sprintf("0x%08x", $v_data['id'])."'");
-
-      // ----- Check signature
-      if ($v_data['id'] == 0x06054b50) {
-        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Found central dir at the default position.");
-        $v_found = 1;
-      }
-
-      $v_pos = ftell($this->zip_fd);
-    }
-
-    // ----- Go back to the maximum possible size of the Central Dir End Record
-    if (!$v_found) {
-      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 'Start extended search of end central dir');
-      $v_maximum_size = 65557; // 0xFFFF + 22;
-      if ($v_maximum_size > $v_size)
-        $v_maximum_size = $v_size;
-      @fseek($this->zip_fd, $v_size-$v_maximum_size);
-      if (@ftell($this->zip_fd) != ($v_size-$v_maximum_size))
-      {
-        // ----- Error log
-        PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, 'Unable to seek back to the middle of the archive \''.$this->zipname.'\'');
-
-        // ----- Return
-        //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
-        return PclZip::errorCode();
-      }
-      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 'Position after max central position : \''.ftell($this->zip_fd).'\'');
-
-      // ----- Read byte per byte in order to find the signature
-      $v_pos = ftell($this->zip_fd);
-      $v_bytes = 0x00000000;
-      while ($v_pos < $v_size)
-      {
-        // ----- Read a byte
-        $v_byte = @fread($this->zip_fd, 1);
-
-        // -----  Add the byte
-        $v_bytes = ($v_bytes << 8) | Ord($v_byte);
-
-        // ----- Compare the bytes
-        if ($v_bytes == 0x504b0506)
-        {
-          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 'Found End Central Dir signature at position : \''.ftell($this->zip_fd).'\'');
-          $v_pos++;
-          break;
-        }
-
-        $v_pos++;
-      }
-
-      // ----- Look if not found end of central dir
-      if ($v_pos == $v_size)
-      {
-        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Unable to find End of Central Dir Record signature");
-
-        // ----- Error log
-        PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, "Unable to find End of Central Dir Record signature");
-
-        // ----- Return
-        //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
-        return PclZip::errorCode();
-      }
-    }
-
-    // ----- Read the first 18 bytes of the header
-    $v_binary_data = fread($this->zip_fd, 18);
-
-    // ----- Look for invalid block size
-    if (strlen($v_binary_data) != 18)
-    {
-      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Invalid End of Central Dir Record size : ".strlen($v_binary_data));
-
-      // ----- Error log
-      PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, "Invalid End of Central Dir Record size : ".strlen($v_binary_data));
-
-      // ----- Return
-      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
-      return PclZip::errorCode();
-    }
-
-    // ----- Extract the values
-    ////--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Central Dir Record : '".$v_binary_data."'");
-    ////--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Central Dir Record (Hex) : '".bin2hex($v_binary_data)."'");
-    $v_data = unpack('vdisk/vdisk_start/vdisk_entries/ventries/Vsize/Voffset/vcomment_size', $v_binary_data);
-
-    // ----- Check the global size
-    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Comment length : ".$v_data['comment_size']);
-    if (($v_pos + $v_data['comment_size'] + 18) != $v_size) {
-      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "The central dir is not at the end of the archive. Some trailing bytes exists after the archive.");
-
-	  // ----- Removed in release 2.2 see readme file
-	  // The check of the file size is a little too strict.
-	  // Some bugs where found when a zip is encrypted/decrypted with 'crypt'.
-	  // While decrypted, zip has training 0 bytes
-	  if (0) {
-      // ----- Error log
-      PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT,
-	                       'The central dir is not at the end of the archive.'
-						   .' Some trailing bytes exists after the archive.');
-
-      // ----- Return
-      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
-      return PclZip::errorCode();
-	  }
-    }
-
-    // ----- Get comment
-    if ($v_data['comment_size'] != 0)
-      $p_central_dir['comment'] = fread($this->zip_fd, $v_data['comment_size']);
-    else
-      $p_central_dir['comment'] = '';
-    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Comment : \''.$p_central_dir['comment'].'\'');
-
-    $p_central_dir['entries'] = $v_data['entries'];
-    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Nb of entries : \''.$p_central_dir['entries'].'\'');
-    $p_central_dir['disk_entries'] = $v_data['disk_entries'];
-    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Nb of entries for this disk : \''.$p_central_dir['disk_entries'].'\'');
-    $p_central_dir['offset'] = $v_data['offset'];
-    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Offset of Central Dir : \''.$p_central_dir['offset'].'\'');
-    $p_central_dir['size'] = $v_data['size'];
-    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Size of Central Dir : \''.$p_central_dir['size'].'\'');
-    $p_central_dir['disk'] = $v_data['disk'];
-    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Disk number : \''.$p_central_dir['disk'].'\'');
-    $p_central_dir['disk_start'] = $v_data['disk_start'];
-    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Start disk number : \''.$p_central_dir['disk_start'].'\'');
-
-    // TBC
-    //for(reset($p_central_dir); $key = key($p_central_dir); next($p_central_dir)) {
-    //  //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "central_dir[$key] = ".$p_central_dir[$key]);
-    //}
-
-    // ----- Return
-    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
-    return $v_result;
-  }
-  // --------------------------------------------------------------------------------
-
-  // --------------------------------------------------------------------------------
-  // Function : privDeleteByRule()
-  // Description :
-  // Parameters :
-  // Return Values :
-  // --------------------------------------------------------------------------------
-  function privDeleteByRule(&$p_result_list, &$p_options)
-  {
-    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privDeleteByRule", "");
-    $v_result=1;
-    $v_list_detail = array();
-
-    // ----- Open the zip file
-    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Open file in binary read mode");
-    if (($v_result=$this->privOpenFd('rb')) != 1)
-    {
-      // ----- Return
-      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
-      return $v_result;
-    }
-
-    // ----- Read the central directory informations
-    $v_central_dir = array();
-    if (($v_result = $this->privReadEndCentralDir($v_central_dir)) != 1)
-    {
-      $this->privCloseFd();
-      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
-      return $v_result;
-    }
-
-    // ----- Go to beginning of File
-    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Position in file : ".ftell($this->zip_fd)."'");
-    @rewind($this->zip_fd);
-    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Position in file : ".ftell($this->zip_fd)."'");
-
-    // ----- Scan all the files
-    // ----- Start at beginning of Central Dir
-    $v_pos_entry = $v_central_dir['offset'];
-    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Position before rewind : ".ftell($this->zip_fd)."'");
-    @rewind($this->zip_fd);
-    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Position after rewind : ".ftell($this->zip_fd)."'");
-    if (@fseek($this->zip_fd, $v_pos_entry))
-    {
-      // ----- Close the zip file
-      $this->privCloseFd();
-
-      // ----- Error log
-      PclZip::privErrorLog(PCLZIP_ERR_INVALID_ARCHIVE_ZIP, 'Invalid archive size');
-
-      // ----- Return
-      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
-      return PclZip::errorCode();
-    }
-    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Position after fseek : ".ftell($this->zip_fd)."'");
-
-    // ----- Read each entry
-    $v_header_list = array();
-    $j_start = 0;
-    for ($i=0, $v_nb_extracted=0; $i<$v_central_dir['entries']; $i++)
-    {
-      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Read next file header entry (index '$i')");
-
-      // ----- Read the file header
-      $v_header_list[$v_nb_extracted] = array();
-      if (($v_result = $this->privReadCentralFileHeader($v_header_list[$v_nb_extracted])) != 1)
-      {
-        // ----- Close the zip file
-        $this->privCloseFd();
-
-        //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
-        return $v_result;
-      }
-
-      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Filename (index '$i') : '".$v_header_list[$v_nb_extracted]['stored_filename']."'");
-
-      // ----- Store the index
-      $v_header_list[$v_nb_extracted]['index'] = $i;
-
-      // ----- Look for the specific extract rules
-      $v_found = false;
-
-      // ----- Look for extract by name rule
-      if (   (isset($p_options[PCLZIP_OPT_BY_NAME]))
-          && ($p_options[PCLZIP_OPT_BY_NAME] != 0)) {
-          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Extract with rule 'ByName'");
-
-          // ----- Look if the filename is in the list
-          for ($j=0; ($j<sizeof($p_options[PCLZIP_OPT_BY_NAME])) && (!$v_found); $j++) {
-              //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Compare with file '".$p_options[PCLZIP_OPT_BY_NAME][$j]."'");
-
-              // ----- Look for a directory
-              if (substr($p_options[PCLZIP_OPT_BY_NAME][$j], -1) == "/") {
-                  //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "The searched item is a directory");
-
-                  // ----- Look if the directory is in the filename path
-                  if (   (strlen($v_header_list[$v_nb_extracted]['stored_filename']) > strlen($p_options[PCLZIP_OPT_BY_NAME][$j]))
-                      && (substr($v_header_list[$v_nb_extracted]['stored_filename'], 0, strlen($p_options[PCLZIP_OPT_BY_NAME][$j])) == $p_options[PCLZIP_OPT_BY_NAME][$j])) {
-                      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "The directory is in the file path");
-                      $v_found = true;
-                  }
-                  elseif (   (($v_header_list[$v_nb_extracted]['external']&0x00000010)==0x00000010) /* Indicates a folder */
-                          && ($v_header_list[$v_nb_extracted]['stored_filename'].'/' == $p_options[PCLZIP_OPT_BY_NAME][$j])) {
-                      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "The entry is the searched directory");
-                      $v_found = true;
-                  }
-              }
-              // ----- Look for a filename
-              elseif ($v_header_list[$v_nb_extracted]['stored_filename'] == $p_options[PCLZIP_OPT_BY_NAME][$j]) {
-                  //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "The file is the right one.");
-                  $v_found = true;
-              }
-          }
-      }
-
-      // ----- Look for extract by ereg rule
-      else if (   (isset($p_options[PCLZIP_OPT_BY_EREG]))
-               && ($p_options[PCLZIP_OPT_BY_EREG] != "")) {
-          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Extract by ereg '".$p_options[PCLZIP_OPT_BY_EREG]."'");
-
-          if (ereg($p_options[PCLZIP_OPT_BY_EREG], $v_header_list[$v_nb_extracted]['stored_filename'])) {
-              //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Filename match the regular expression");
-              $v_found = true;
-          }
-      }
-
-      // ----- Look for extract by preg rule
-      else if (   (isset($p_options[PCLZIP_OPT_BY_PREG]))
-               && ($p_options[PCLZIP_OPT_BY_PREG] != "")) {
-          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Extract with rule 'ByEreg'");
-
-          if (preg_match($p_options[PCLZIP_OPT_BY_PREG], $v_header_list[$v_nb_extracted]['stored_filename'])) {
-              //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Filename match the regular expression");
-              $v_found = true;
-          }
-      }
-
-      // ----- Look for extract by index rule
-      else if (   (isset($p_options[PCLZIP_OPT_BY_INDEX]))
-               && ($p_options[PCLZIP_OPT_BY_INDEX] != 0)) {
-          //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Extract with rule 'ByIndex'");
-
-          // ----- Look if the index is in the list
-          for ($j=$j_start; ($j<sizeof($p_options[PCLZIP_OPT_BY_INDEX])) && (!$v_found); $j++) {
-              //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Look if index '$i' is in [".$p_options[PCLZIP_OPT_BY_INDEX][$j]['start'].",".$p_options[PCLZIP_OPT_BY_INDEX][$j]['end']."]");
-
-              if (($i>=$p_options[PCLZIP_OPT_BY_INDEX][$j]['start']) && ($i<=$p_options[PCLZIP_OPT_BY_INDEX][$j]['end'])) {
-                  //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Found as part of an index range");
-                  $v_found = true;
-              }
-              if ($i>=$p_options[PCLZIP_OPT_BY_INDEX][$j]['end']) {
-                  //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Do not look this index range for next loop");
-                  $j_start = $j+1;
-              }
-
-              if ($p_options[PCLZIP_OPT_BY_INDEX][$j]['start']>$i) {
-                  //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Index range is greater than index, stop loop");
-                  break;
-              }
-          }
-      }
-
-      // ----- Look for deletion
-      if ($v_found)
-      {
-        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "File '".$v_header_list[$v_nb_extracted]['stored_filename']."', index '$i' need to be deleted");
-        unset($v_header_list[$v_nb_extracted]);
-      }
-      else
-      {
-        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "File '".$v_header_list[$v_nb_extracted]['stored_filename']."', index '$i' will not be deleted");
-        $v_nb_extracted++;
-      }
-    }
-
-    // ----- Look if something need to be deleted
-    if ($v_nb_extracted > 0) {
-
-        // ----- Creates a temporay file
-        $v_zip_temp_name = PCLZIP_TEMPORARY_DIR.uniqid('pclzip-').'.tmp';
-
-        // ----- Creates a temporary zip archive
-        $v_temp_zip = new PclZip($v_zip_temp_name);
-
-        // ----- Open the temporary zip file in write mode
-        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Open file in binary write mode");
-        if (($v_result = $v_temp_zip->privOpenFd('wb')) != 1) {
-            $this->privCloseFd();
-
-            // ----- Return
-            //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
-            return $v_result;
-        }
-
-        // ----- Look which file need to be kept
-        for ($i=0; $i<sizeof($v_header_list); $i++) {
-            //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Keep entry index '$i' : '".$v_header_list[$i]['filename']."'");
-
-            // ----- Calculate the position of the header
-            //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Offset='". $v_header_list[$i]['offset']."'");
-            //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Position before rewind : ".ftell($this->zip_fd)."'");
-            @rewind($this->zip_fd);
-            //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Position after rewind : ".ftell($this->zip_fd)."'");
-            if (@fseek($this->zip_fd,  $v_header_list[$i]['offset'])) {
-                // ----- Close the zip file
-                $this->privCloseFd();
-                $v_temp_zip->privCloseFd();
-                @unlink($v_zip_temp_name);
-
-                // ----- Error log
-                PclZip::privErrorLog(PCLZIP_ERR_INVALID_ARCHIVE_ZIP, 'Invalid archive size');
-
-                // ----- Return
-                //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
-                return PclZip::errorCode();
-            }
-            //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Position after fseek : ".ftell($this->zip_fd)."'");
-
-            // ----- Read the file header
-            $v_local_header = array();
-            if (($v_result = $this->privReadFileHeader($v_local_header)) != 1) {
-                // ----- Close the zip file
-                $this->privCloseFd();
-                $v_temp_zip->privCloseFd();
-                @unlink($v_zip_temp_name);
-
-                // ----- Return
-                //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
-                return $v_result;
-            }
-            
-            // ----- Check that local file header is same as central file header
-            if ($this->privCheckFileHeaders($v_local_header,
-			                                $v_header_list[$i]) != 1) {
-                // TBC
-            }
-            unset($v_local_header);
-
-            // ----- Write the file header
-            if (($v_result = $v_temp_zip->privWriteFileHeader($v_header_list[$i])) != 1) {
-                // ----- Close the zip file
-                $this->privCloseFd();
-                $v_temp_zip->privCloseFd();
-                @unlink($v_zip_temp_name);
-
-                // ----- Return
-                //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
-                return $v_result;
-            }
-            //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Offset for this file is '".$v_header_list[$i]['offset']."'");
-
-            // ----- Read/write the data block
-            if (($v_result = PclZipUtilCopyBlock($this->zip_fd, $v_temp_zip->zip_fd, $v_header_list[$i]['compressed_size'])) != 1) {
-                // ----- Close the zip file
-                $this->privCloseFd();
-                $v_temp_zip->privCloseFd();
-                @unlink($v_zip_temp_name);
-
-                // ----- Return
-                //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
-                return $v_result;
-            }
-        }
-
-        // ----- Store the offset of the central dir
-        $v_offset = @ftell($v_temp_zip->zip_fd);
-        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "New offset of central dir : $v_offset");
-
-        // ----- Re-Create the Central Dir files header
-        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Creates the new central directory");
-        for ($i=0; $i<sizeof($v_header_list); $i++) {
-            // ----- Create the file header
-            //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Offset of file : ".$v_header_list[$i]['offset']);
-            if (($v_result = $v_temp_zip->privWriteCentralFileHeader($v_header_list[$i])) != 1) {
-                $v_temp_zip->privCloseFd();
-                $this->privCloseFd();
-                @unlink($v_zip_temp_name);
-
-                // ----- Return
-                //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
-                return $v_result;
-            }
-
-            // ----- Transform the header to a 'usable' info
-            $v_temp_zip->privConvertHeader2FileInfo($v_header_list[$i], $p_result_list[$i]);
-        }
-
-        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Creates the central directory footer");
-
-        // ----- Zip file comment
-        $v_comment = '';
-        if (isset($p_options[PCLZIP_OPT_COMMENT])) {
-          $v_comment = $p_options[PCLZIP_OPT_COMMENT];
-        }
-
-        // ----- Calculate the size of the central header
-        $v_size = @ftell($v_temp_zip->zip_fd)-$v_offset;
-
-        // ----- Create the central dir footer
-        if (($v_result = $v_temp_zip->privWriteCentralHeader(sizeof($v_header_list), $v_size, $v_offset, $v_comment)) != 1) {
-            // ----- Reset the file list
-            unset($v_header_list);
-            $v_temp_zip->privCloseFd();
-            $this->privCloseFd();
-            @unlink($v_zip_temp_name);
-
-            // ----- Return
-            //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
-            return $v_result;
-        }
-
-        // ----- Close
-        $v_temp_zip->privCloseFd();
-        $this->privCloseFd();
-
-        // ----- Delete the zip file
-        // TBC : I should test the result ...
-        @unlink($this->zipname);
-
-        // ----- Rename the temporary file
-        // TBC : I should test the result ...
-        //@rename($v_zip_temp_name, $this->zipname);
-        PclZipUtilRename($v_zip_temp_name, $this->zipname);
-    
-        // ----- Destroy the temporary archive
-        unset($v_temp_zip);
-    }
-    
-    // ----- Remove every files : reset the file
-    else if ($v_central_dir['entries'] != 0) {
-        $this->privCloseFd();
-
-        if (($v_result = $this->privOpenFd('wb')) != 1) {
-          //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
-          return $v_result;
-        }
-
-        if (($v_result = $this->privWriteCentralHeader(0, 0, 0, '')) != 1) {
-          //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
-          return $v_result;
-        }
-
-        $this->privCloseFd();
-    }
-
-    // ----- Return
-    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
-    return $v_result;
-  }
-  // --------------------------------------------------------------------------------
-
-  // --------------------------------------------------------------------------------
-  // Function : privDirCheck()
-  // Description :
-  //   Check if a directory exists, if not it creates it and all the parents directory
-  //   which may be useful.
-  // Parameters :
-  //   $p_dir : Directory path to check.
-  // Return Values :
-  //    1 : OK
-  //   -1 : Unable to create directory
-  // --------------------------------------------------------------------------------
-  function privDirCheck($p_dir, $p_is_dir=false)
-  {
-    $v_result = 1;
-
-    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privDirCheck", "entry='$p_dir', is_dir='".($p_is_dir?"true":"false")."'");
-
-    // ----- Remove the final '/'
-    if (($p_is_dir) && (substr($p_dir, -1)=='/'))
-    {
-      $p_dir = substr($p_dir, 0, strlen($p_dir)-1);
-    }
-    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Looking for entry '$p_dir'");
-
-    // ----- Check the directory availability
-    if ((is_dir($p_dir)) || ($p_dir == ""))
-    {
-      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, "'$p_dir' is a directory");
-      return 1;
-    }
-
-    // ----- Extract parent directory
-    $p_parent_dir = dirname($p_dir);
-    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Parent directory is '$p_parent_dir'");
-
-    // ----- Just a check
-    if ($p_parent_dir != $p_dir)
-    {
-      // ----- Look for parent directory
-      if ($p_parent_dir != "")
-      {
-        if (($v_result = $this->privDirCheck($p_parent_dir)) != 1)
-        {
-          //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
-          return $v_result;
-        }
-      }
-    }
-
-    // ----- Create the directory
-    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Create directory '$p_dir'");
-    if (!@mkdir($p_dir, 0777))
-    {
-      // ----- Error log
-      PclZip::privErrorLog(PCLZIP_ERR_DIR_CREATE_FAIL, "Unable to create directory '$p_dir'");
-
-      // ----- Return
-      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
-      return PclZip::errorCode();
-    }
-
-    // ----- Return
-    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result, "Directory '$p_dir' created");
-    return $v_result;
-  }
-  // --------------------------------------------------------------------------------
-
-  // --------------------------------------------------------------------------------
-  // Function : privMerge()
-  // Description :
-  //   If $p_archive_to_add does not exist, the function exit with a success result.
-  // Parameters :
-  // Return Values :
-  // --------------------------------------------------------------------------------
-  function privMerge(&$p_archive_to_add)
-  {
-    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privMerge", "archive='".$p_archive_to_add->zipname."'");
-    $v_result=1;
-
-    // ----- Look if the archive_to_add exists
-    if (!is_file($p_archive_to_add->zipname))
-    {
-      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Archive to add does not exist. End of merge.");
-
-      // ----- Nothing to merge, so merge is a success
-      $v_result = 1;
-
-      // ----- Return
-      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
-      return $v_result;
-    }
-
-    // ----- Look if the archive exists
-    if (!is_file($this->zipname))
-    {
-      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Archive does not exist, duplicate the archive_to_add.");
-
-      // ----- Do a duplicate
-      $v_result = $this->privDuplicate($p_archive_to_add->zipname);
-
-      // ----- Return
-      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
-      return $v_result;
-    }
-
-    // ----- Open the zip file
-    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Open file in binary read mode");
-    if (($v_result=$this->privOpenFd('rb')) != 1)
-    {
-      // ----- Return
-      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
-      return $v_result;
-    }
-
-    // ----- Read the central directory informations
-    $v_central_dir = array();
-    if (($v_result = $this->privReadEndCentralDir($v_central_dir)) != 1)
-    {
-      $this->privCloseFd();
-      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
-      return $v_result;
-    }
-
-    // ----- Go to beginning of File
-    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Position in zip : ".ftell($this->zip_fd)."'");
-    @rewind($this->zip_fd);
-    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Position in zip : ".ftell($this->zip_fd)."'");
-
-    // ----- Open the archive_to_add file
-    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Open archive_to_add in binary read mode");
-    if (($v_result=$p_archive_to_add->privOpenFd('rb')) != 1)
-    {
-      $this->privCloseFd();
-
-      // ----- Return
-      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
-      return $v_result;
-    }
-
-    // ----- Read the central directory informations
-    $v_central_dir_to_add = array();
-    if (($v_result = $p_archive_to_add->privReadEndCentralDir($v_central_dir_to_add)) != 1)
-    {
-      $this->privCloseFd();
-      $p_archive_to_add->privCloseFd();
-
-      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
-      return $v_result;
-    }
-
-    // ----- Go to beginning of File
-    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Position in archive_to_add : ".ftell($p_archive_to_add->zip_fd)."'");
-    @rewind($p_archive_to_add->zip_fd);
-    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Position in archive_to_add : ".ftell($p_archive_to_add->zip_fd)."'");
-
-    // ----- Creates a temporay file
-    $v_zip_temp_name = PCLZIP_TEMPORARY_DIR.uniqid('pclzip-').'.tmp';
-
-    // ----- Open the temporary file in write mode
-    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Open file in binary read mode");
-    if (($v_zip_temp_fd = @fopen($v_zip_temp_name, 'wb')) == 0)
-    {
-      $this->privCloseFd();
-      $p_archive_to_add->privCloseFd();
-
-      PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open temporary file \''.$v_zip_temp_name.'\' in binary write mode');
-
-      // ----- Return
-      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
-      return PclZip::errorCode();
-    }
-
-    // ----- Copy the files from the archive to the temporary file
-    // TBC : Here I should better append the file and go back to erase the central dir
-    $v_size = $v_central_dir['offset'];
-    while ($v_size != 0)
-    {
-      $v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE);
-      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Read $v_read_size bytes");
-      $v_buffer = fread($this->zip_fd, $v_read_size);
-      @fwrite($v_zip_temp_fd, $v_buffer, $v_read_size);
-      $v_size -= $v_read_size;
-    }
-
-    // ----- Copy the files from the archive_to_add into the temporary file
-    $v_size = $v_central_dir_to_add['offset'];
-    while ($v_size != 0)
-    {
-      $v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE);
-      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Read $v_read_size bytes");
-      $v_buffer = fread($p_archive_to_add->zip_fd, $v_read_size);
-      @fwrite($v_zip_temp_fd, $v_buffer, $v_read_size);
-      $v_size -= $v_read_size;
-    }
-
-    // ----- Store the offset of the central dir
-    $v_offset = @ftell($v_zip_temp_fd);
-    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "New offset of central dir : $v_offset");
-
-    // ----- Copy the block of file headers from the old archive
-    $v_size = $v_central_dir['size'];
-    while ($v_size != 0)
-    {
-      $v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE);
-      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Read $v_read_size bytes");
-      $v_buffer = @fread($this->zip_fd, $v_read_size);
-      @fwrite($v_zip_temp_fd, $v_buffer, $v_read_size);
-      $v_size -= $v_read_size;
-    }
-
-    // ----- Copy the block of file headers from the archive_to_add
-    $v_size = $v_central_dir_to_add['size'];
-    while ($v_size != 0)
-    {
-      $v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE);
-      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Read $v_read_size bytes");
-      $v_buffer = @fread($p_archive_to_add->zip_fd, $v_read_size);
-      @fwrite($v_zip_temp_fd, $v_buffer, $v_read_size);
-      $v_size -= $v_read_size;
-    }
-
-    // ----- Merge the file comments
-    $v_comment = $v_central_dir['comment'].' '.$v_central_dir_to_add['comment'];
-
-    // ----- Calculate the size of the (new) central header
-    $v_size = @ftell($v_zip_temp_fd)-$v_offset;
-
-    // ----- Swap the file descriptor
-    // Here is a trick : I swap the temporary fd with the zip fd, in order to use
-    // the following methods on the temporary fil and not the real archive fd
-    $v_swap = $this->zip_fd;
-    $this->zip_fd = $v_zip_temp_fd;
-    $v_zip_temp_fd = $v_swap;
-
-    // ----- Create the central dir footer
-    if (($v_result = $this->privWriteCentralHeader($v_central_dir['entries']+$v_central_dir_to_add['entries'], $v_size, $v_offset, $v_comment)) != 1)
-    {
-      $this->privCloseFd();
-      $p_archive_to_add->privCloseFd();
-      @fclose($v_zip_temp_fd);
-      $this->zip_fd = null;
-
-      // ----- Reset the file list
-      unset($v_header_list);
-
-      // ----- Return
-      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
-      return $v_result;
-    }
-
-    // ----- Swap back the file descriptor
-    $v_swap = $this->zip_fd;
-    $this->zip_fd = $v_zip_temp_fd;
-    $v_zip_temp_fd = $v_swap;
-
-    // ----- Close
-    $this->privCloseFd();
-    $p_archive_to_add->privCloseFd();
-
-    // ----- Close the temporary file
-    @fclose($v_zip_temp_fd);
-
-    // ----- Delete the zip file
-    // TBC : I should test the result ...
-    @unlink($this->zipname);
-
-    // ----- Rename the temporary file
-    // TBC : I should test the result ...
-    //@rename($v_zip_temp_name, $this->zipname);
-    PclZipUtilRename($v_zip_temp_name, $this->zipname);
-
-    // ----- Return
-    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
-    return $v_result;
-  }
-  // --------------------------------------------------------------------------------
-
-  // --------------------------------------------------------------------------------
-  // Function : privDuplicate()
-  // Description :
-  // Parameters :
-  // Return Values :
-  // --------------------------------------------------------------------------------
-  function privDuplicate($p_archive_filename)
-  {
-    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privDuplicate", "archive_filename='$p_archive_filename'");
-    $v_result=1;
-
-    // ----- Look if the $p_archive_filename exists
-    if (!is_file($p_archive_filename))
-    {
-      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Archive to duplicate does not exist. End of duplicate.");
-
-      // ----- Nothing to duplicate, so duplicate is a success.
-      $v_result = 1;
-
-      // ----- Return
-      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
-      return $v_result;
-    }
-
-    // ----- Open the zip file
-    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Open file in binary read mode");
-    if (($v_result=$this->privOpenFd('wb')) != 1)
-    {
-      // ----- Return
-      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
-      return $v_result;
-    }
-
-    // ----- Open the temporary file in write mode
-    //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Open file in binary read mode");
-    if (($v_zip_temp_fd = @fopen($p_archive_filename, 'rb')) == 0)
-    {
-      $this->privCloseFd();
-
-      PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open archive file \''.$p_archive_filename.'\' in binary write mode');
-
-      // ----- Return
-      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
-      return PclZip::errorCode();
-    }
-
-    // ----- Copy the files from the archive to the temporary file
-    // TBC : Here I should better append the file and go back to erase the central dir
-    $v_size = filesize($p_archive_filename);
-    while ($v_size != 0)
-    {
-      $v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE);
-      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Read $v_read_size bytes");
-      $v_buffer = fread($v_zip_temp_fd, $v_read_size);
-      @fwrite($this->zip_fd, $v_buffer, $v_read_size);
-      $v_size -= $v_read_size;
-    }
-
-    // ----- Close
-    $this->privCloseFd();
-
-    // ----- Close the temporary file
-    @fclose($v_zip_temp_fd);
-
-    // ----- Return
-    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
-    return $v_result;
-  }
-  // --------------------------------------------------------------------------------
-
-  // --------------------------------------------------------------------------------
-  // Function : privErrorLog()
-  // Description :
-  // Parameters :
-  // --------------------------------------------------------------------------------
-  function privErrorLog($p_error_code=0, $p_error_string='')
-  {
-    if (PCLZIP_ERROR_EXTERNAL == 1) {
-      PclError($p_error_code, $p_error_string);
-    }
-    else {
-      $this->error_code = $p_error_code;
-      $this->error_string = $p_error_string;
-    }
-  }
-  // --------------------------------------------------------------------------------
-
-  // --------------------------------------------------------------------------------
-  // Function : privErrorReset()
-  // Description :
-  // Parameters :
-  // --------------------------------------------------------------------------------
-  function privErrorReset()
-  {
-    if (PCLZIP_ERROR_EXTERNAL == 1) {
-      PclErrorReset();
-    }
-    else {
-      $this->error_code = 0;
-      $this->error_string = '';
-    }
-  }
-  // --------------------------------------------------------------------------------
-
-  // --------------------------------------------------------------------------------
-  // Function : privDecrypt()
-  // Description :
-  // Parameters :
-  // Return Values :
-  // --------------------------------------------------------------------------------
-  function privDecrypt($p_encryption_header, &$p_buffer, $p_size, $p_crc)
-  {
-    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, 'PclZip::privDecrypt', "size=".$p_size."");
-    $v_result=1;
-    
-    // ----- To Be Modified ;-)
-    $v_pwd = "test";
-    
-    $p_buffer = PclZipUtilZipDecrypt($p_buffer, $p_size, $p_encryption_header,
-	                                 $p_crc, $v_pwd);
-    
-    // ----- Return
-    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
-    return $v_result;
-  }
-  // --------------------------------------------------------------------------------
-
-  }
-  // End of class
-  // --------------------------------------------------------------------------------
-
-  // --------------------------------------------------------------------------------
-  // Function : PclZipUtilPathReduction()
-  // Description :
-  // Parameters :
-  // Return Values :
-  // --------------------------------------------------------------------------------
-  function PclZipUtilPathReduction($p_dir)
-  {
-    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZipUtilPathReduction", "dir='$p_dir'");
-    $v_result = "";
-
-    // ----- Look for not empty path
-    if ($p_dir != "")
-    {
-      // ----- Explode path by directory names
-      $v_list = explode("/", $p_dir);
-
-      // ----- Study directories from last to first
-      for ($i=sizeof($v_list)-1; $i>=0; $i--)
-      {
-        // ----- Look for current path
-        if ($v_list[$i] == ".")
-        {
-          // ----- Ignore this directory
-          // Should be the first $i=0, but no check is done
-        }
-        else if ($v_list[$i] == "..")
-        {
-          // ----- Ignore it and ignore the $i-1
-          $i--;
-        }
-        else if (($v_list[$i] == "") && ($i!=(sizeof($v_list)-1)) && ($i!=0))
-        {
-          // ----- Ignore only the double '//' in path,
-          // but not the first and last '/'
-        }
-        else
-        {
-          $v_result = $v_list[$i].($i!=(sizeof($v_list)-1)?"/".$v_result:"");
-        }
-      }
-    }
-
-    // ----- Return
-    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
-    return $v_result;
-  }
-  // --------------------------------------------------------------------------------
-
-  // --------------------------------------------------------------------------------
-  // Function : PclZipUtilPathInclusion()
-  // Description :
-  //   This function indicates if the path $p_path is under the $p_dir tree. Or,
-  //   said in an other way, if the file or sub-dir $p_path is inside the dir
-  //   $p_dir.
-  //   The function indicates also if the path is exactly the same as the dir.
-  //   This function supports path with duplicated '/' like '//', but does not
-  //   support '.' or '..' statements.
-  // Parameters :
-  // Return Values :
-  //   0 if $p_path is not inside directory $p_dir
-  //   1 if $p_path is inside directory $p_dir
-  //   2 if $p_path is exactly the same as $p_dir
-  // --------------------------------------------------------------------------------
-  function PclZipUtilPathInclusion($p_dir, $p_path)
-  {
-    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZipUtilPathInclusion", "dir='$p_dir', path='$p_path'");
-    $v_result = 1;
-
-    // ----- Explode dir and path by directory separator
-    $v_list_dir = explode("/", $p_dir);
-    $v_list_dir_size = sizeof($v_list_dir);
-    $v_list_path = explode("/", $p_path);
-    $v_list_path_size = sizeof($v_list_path);
-
-    // ----- Study directories paths
-    $i = 0;
-    $j = 0;
-    while (($i < $v_list_dir_size) && ($j < $v_list_path_size) && ($v_result)) {
-      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Working on dir($i)='".$v_list_dir[$i]."' and path($j)='".$v_list_path[$j]."'");
-
-      // ----- Look for empty dir (path reduction)
-      if ($v_list_dir[$i] == '') {
-        $i++;
-        continue;
-      }
-      if ($v_list_path[$j] == '') {
-        $j++;
-        continue;
-      }
-
-      // ----- Compare the items
-      if (($v_list_dir[$i] != $v_list_path[$j]) && ($v_list_dir[$i] != '') && ( $v_list_path[$j] != ''))  {
-        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Items ($i,$j) are different");
-        $v_result = 0;
-      }
-
-      // ----- Next items
-      $i++;
-      $j++;
-    }
-
-    // ----- Look if everything seems to be the same
-    if ($v_result) {
-      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Look for tie break");
-      // ----- Skip all the empty items
-      while (($j < $v_list_path_size) && ($v_list_path[$j] == '')) $j++;
-      while (($i < $v_list_dir_size) && ($v_list_dir[$i] == '')) $i++;
-      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Looking on dir($i)='".($i < $v_list_dir_size?$v_list_dir[$i]:'')."' and path($j)='".($j < $v_list_path_size?$v_list_path[$j]:'')."'");
-
-      if (($i >= $v_list_dir_size) && ($j >= $v_list_path_size)) {
-        // ----- There are exactly the same
-        $v_result = 2;
-      }
-      else if ($i < $v_list_dir_size) {
-        // ----- The path is shorter than the dir
-        $v_result = 0;
-      }
-    }
-
-    // ----- Return
-    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
-    return $v_result;
-  }
-  // --------------------------------------------------------------------------------
-
-  // --------------------------------------------------------------------------------
-  // Function : PclZipUtilCopyBlock()
-  // Description :
-  // Parameters :
-  //   $p_mode : read/write compression mode
-  //             0 : src & dest normal
-  //             1 : src gzip, dest normal
-  //             2 : src normal, dest gzip
-  //             3 : src & dest gzip
-  // Return Values :
-  // --------------------------------------------------------------------------------
-  function PclZipUtilCopyBlock($p_src, $p_dest, $p_size, $p_mode=0)
-  {
-    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZipUtilCopyBlock", "size=$p_size, mode=$p_mode");
-    $v_result = 1;
-
-    if ($p_mode==0)
-    {
-      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Src offset before read :".(@ftell($p_src)));
-      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Dest offset before write :".(@ftell($p_dest)));
-      while ($p_size != 0)
-      {
-        $v_read_size = ($p_size < PCLZIP_READ_BLOCK_SIZE ? $p_size : PCLZIP_READ_BLOCK_SIZE);
-        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Read $v_read_size bytes");
-        $v_buffer = @fread($p_src, $v_read_size);
-        @fwrite($p_dest, $v_buffer, $v_read_size);
-        $p_size -= $v_read_size;
-      }
-      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Src offset after read :".(@ftell($p_src)));
-      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Dest offset after write :".(@ftell($p_dest)));
-    }
-    else if ($p_mode==1)
-    {
-      while ($p_size != 0)
-      {
-        $v_read_size = ($p_size < PCLZIP_READ_BLOCK_SIZE ? $p_size : PCLZIP_READ_BLOCK_SIZE);
-        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Read $v_read_size bytes");
-        $v_buffer = @gzread($p_src, $v_read_size);
-        @fwrite($p_dest, $v_buffer, $v_read_size);
-        $p_size -= $v_read_size;
-      }
-    }
-    else if ($p_mode==2)
-    {
-      while ($p_size != 0)
-      {
-        $v_read_size = ($p_size < PCLZIP_READ_BLOCK_SIZE ? $p_size : PCLZIP_READ_BLOCK_SIZE);
-        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Read $v_read_size bytes");
-        $v_buffer = @fread($p_src, $v_read_size);
-        @gzwrite($p_dest, $v_buffer, $v_read_size);
-        $p_size -= $v_read_size;
-      }
-    }
-    else if ($p_mode==3)
-    {
-      while ($p_size != 0)
-      {
-        $v_read_size = ($p_size < PCLZIP_READ_BLOCK_SIZE ? $p_size : PCLZIP_READ_BLOCK_SIZE);
-        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Read $v_read_size bytes");
-        $v_buffer = @gzread($p_src, $v_read_size);
-        @gzwrite($p_dest, $v_buffer, $v_read_size);
-        $p_size -= $v_read_size;
-      }
-    }
-
-    // ----- Return
-    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
-    return $v_result;
-  }
-  // --------------------------------------------------------------------------------
-
-  // --------------------------------------------------------------------------------
-  // Function : PclZipUtilRename()
-  // Description :
-  //   This function tries to do a simple rename() function. If it fails, it
-  //   tries to copy the $p_src file in a new $p_dest file and then unlink the
-  //   first one.
-  // Parameters :
-  //   $p_src : Old filename
-  //   $p_dest : New filename
-  // Return Values :
-  //   1 on success, 0 on failure.
-  // --------------------------------------------------------------------------------
-  function PclZipUtilRename($p_src, $p_dest)
-  {
-    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZipUtilRename", "source=$p_src, destination=$p_dest");
-    $v_result = 1;
-
-    // ----- Try to rename the files
-    if (!@rename($p_src, $p_dest)) {
-      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Fail to rename file, try copy+unlink");
-
-      // ----- Try to copy & unlink the src
-      if (!@copy($p_src, $p_dest)) {
-        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Fail to copy file");
-        $v_result = 0;
-      }
-      else if (!@unlink($p_src)) {
-        //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Fail to unlink old filename");
-        $v_result = 0;
-      }
-    }
-
-    // ----- Return
-    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
-    return $v_result;
-  }
-  // --------------------------------------------------------------------------------
-
-  // --------------------------------------------------------------------------------
-  // Function : PclZipUtilOptionText()
-  // Description :
-  //   Translate option value in text. Mainly for debug purpose.
-  // Parameters :
-  //   $p_option : the option value.
-  // Return Values :
-  //   The option text value.
-  // --------------------------------------------------------------------------------
-  function PclZipUtilOptionText($p_option)
-  {
-    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZipUtilOptionText", "option='".$p_option."'");
-    
-    $v_list = get_defined_constants();
-    for (reset($v_list); $v_key = key($v_list); next($v_list)) {
-	  $v_prefix = substr($v_key, 0, 10);
-	  if ((($v_prefix == 'PCLZIP_OPT') || ($v_prefix == 'PCLZIP_CB_'))
-	      && ($v_list[$v_key] == $p_option)) {
-          //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_key);
-          return $v_key;
-	    }
-    }
-    
-    $v_result = 'Unknown';
-
-    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
-    return $v_result;
-  }
-  // --------------------------------------------------------------------------------
-
-  // --------------------------------------------------------------------------------
-  // Function : PclZipUtilTranslateWinPath()
-  // Description :
-  //   Translate windows path by replacing '\' by '/' and optionally removing
-  //   drive letter.
-  // Parameters :
-  //   $p_path : path to translate.
-  //   $p_remove_disk_letter : true | false
-  // Return Values :
-  //   The path translated.
-  // --------------------------------------------------------------------------------
-  function PclZipUtilTranslateWinPath($p_path, $p_remove_disk_letter=true)
-  {
-    if (stristr(php_uname(), 'windows')) {
-      // ----- Look for potential disk letter
-      if (($p_remove_disk_letter) && (($v_position = strpos($p_path, ':')) != false)) {
-          $p_path = substr($p_path, $v_position+1);
-      }
-      // ----- Change potential windows directory separator
-      if ((strpos($p_path, '\\') > 0) || (substr($p_path, 0,1) == '\\')) {
-          $p_path = strtr($p_path, '\\', '/');
-      }
-    }
-    return $p_path;
-  }
-  // --------------------------------------------------------------------------------
-
-
-?>
+<?php
+if (!defined('e107_INIT')) { exit; }
+
+// --------------------------------------------------------------------------------
+// PhpConcept Library - Zip Module 2.8.2
+// --------------------------------------------------------------------------------
+// License GNU/LGPL - Vincent Blavet - August 2009
+// http://www.phpconcept.net
+// --------------------------------------------------------------------------------
+//
+// Presentation :
+//   PclZip is a PHP library that manage ZIP archives.
+//   So far tests show that archives generated by PclZip are readable by
+//   WinZip application and other tools.
+//
+// Description :
+//   See readme.txt and http://www.phpconcept.net
+//
+// Warning :
+//   This library and the associated files are non commercial, non professional
+//   work.
+//   It should not have unexpected results. However if any damage is caused by
+//   this software the author can not be responsible.
+//   The use of this software is at the risk of the user.
+//
+// --------------------------------------------------------------------------------
+// $Id: pclzip.lib.php 11905 2010-10-21 13:08:23Z e107steved $
+// --------------------------------------------------------------------------------
+
+  // ----- Constants
+  if (!defined('PCLZIP_READ_BLOCK_SIZE')) {
+    define( 'PCLZIP_READ_BLOCK_SIZE', 2048 );
+  }
+  
+  // ----- File list separator
+  // In version 1.x of PclZip, the separator for file list is a space
+  // (which is not a very smart choice, specifically for windows paths !).
+  // A better separator should be a comma (,). This constant gives you the
+  // abilty to change that.
+  // However notice that changing this value, may have impact on existing
+  // scripts, using space separated filenames.
+  // Recommanded values for compatibility with older versions :
+  //define( 'PCLZIP_SEPARATOR', ' ' );
+  // Recommanded values for smart separation of filenames.
+  if (!defined('PCLZIP_SEPARATOR')) {
+    define( 'PCLZIP_SEPARATOR', ',' );
+  }
+
+  // ----- Error configuration
+  // 0 : PclZip Class integrated error handling
+  // 1 : PclError external library error handling. By enabling this
+  //     you must ensure that you have included PclError library.
+  // [2,...] : reserved for futur use
+  if (!defined('PCLZIP_ERROR_EXTERNAL')) {
+    define( 'PCLZIP_ERROR_EXTERNAL', 0 );
+  }
+
+  // ----- Optional static temporary directory
+  //       By default temporary files are generated in the script current
+  //       path.
+  //       If defined :
+  //       - MUST BE terminated by a '/'.
+  //       - MUST be a valid, already created directory
+  //       Samples :
+  // define( 'PCLZIP_TEMPORARY_DIR', '/temp/' );
+  // define( 'PCLZIP_TEMPORARY_DIR', 'C:/Temp/' );
+  if (!defined('PCLZIP_TEMPORARY_DIR')) {
+    define( 'PCLZIP_TEMPORARY_DIR', '' );
+  }
+
+  // ----- Optional threshold ratio for use of temporary files
+  //       Pclzip sense the size of the file to add/extract and decide to
+  //       use or not temporary file. The algorythm is looking for 
+  //       memory_limit of PHP and apply a ratio.
+  //       threshold = memory_limit * ratio.
+  //       Recommended values are under 0.5. Default 0.47.
+  //       Samples :
+  // define( 'PCLZIP_TEMPORARY_FILE_RATIO', 0.5 );
+  if (!defined('PCLZIP_TEMPORARY_FILE_RATIO')) {
+    define( 'PCLZIP_TEMPORARY_FILE_RATIO', 0.47 );
+  }
+
+// --------------------------------------------------------------------------------
+// ***** UNDER THIS LINE NOTHING NEEDS TO BE MODIFIED *****
+// --------------------------------------------------------------------------------
+
+  // ----- Global variables
+  $g_pclzip_version = "2.8.2";
+
+  // ----- Error codes
+  //   -1 : Unable to open file in binary write mode
+  //   -2 : Unable to open file in binary read mode
+  //   -3 : Invalid parameters
+  //   -4 : File does not exist
+  //   -5 : Filename is too long (max. 255)
+  //   -6 : Not a valid zip file
+  //   -7 : Invalid extracted file size
+  //   -8 : Unable to create directory
+  //   -9 : Invalid archive extension
+  //  -10 : Invalid archive format
+  //  -11 : Unable to delete file (unlink)
+  //  -12 : Unable to rename file (rename)
+  //  -13 : Invalid header checksum
+  //  -14 : Invalid archive size
+  define( 'PCLZIP_ERR_USER_ABORTED', 2 );
+  define( 'PCLZIP_ERR_NO_ERROR', 0 );
+  define( 'PCLZIP_ERR_WRITE_OPEN_FAIL', -1 );
+  define( 'PCLZIP_ERR_READ_OPEN_FAIL', -2 );
+  define( 'PCLZIP_ERR_INVALID_PARAMETER', -3 );
+  define( 'PCLZIP_ERR_MISSING_FILE', -4 );
+  define( 'PCLZIP_ERR_FILENAME_TOO_LONG', -5 );
+  define( 'PCLZIP_ERR_INVALID_ZIP', -6 );
+  define( 'PCLZIP_ERR_BAD_EXTRACTED_FILE', -7 );
+  define( 'PCLZIP_ERR_DIR_CREATE_FAIL', -8 );
+  define( 'PCLZIP_ERR_BAD_EXTENSION', -9 );
+  define( 'PCLZIP_ERR_BAD_FORMAT', -10 );
+  define( 'PCLZIP_ERR_DELETE_FILE_FAIL', -11 );
+  define( 'PCLZIP_ERR_RENAME_FILE_FAIL', -12 );
+  define( 'PCLZIP_ERR_BAD_CHECKSUM', -13 );
+  define( 'PCLZIP_ERR_INVALID_ARCHIVE_ZIP', -14 );
+  define( 'PCLZIP_ERR_MISSING_OPTION_VALUE', -15 );
+  define( 'PCLZIP_ERR_INVALID_OPTION_VALUE', -16 );
+  define( 'PCLZIP_ERR_ALREADY_A_DIRECTORY', -17 );
+  define( 'PCLZIP_ERR_UNSUPPORTED_COMPRESSION', -18 );
+  define( 'PCLZIP_ERR_UNSUPPORTED_ENCRYPTION', -19 );
+  define( 'PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE', -20 );
+  define( 'PCLZIP_ERR_DIRECTORY_RESTRICTION', -21 );
+
+  // ----- Options values
+  define( 'PCLZIP_OPT_PATH', 77001 );
+  define( 'PCLZIP_OPT_ADD_PATH', 77002 );
+  define( 'PCLZIP_OPT_REMOVE_PATH', 77003 );
+  define( 'PCLZIP_OPT_REMOVE_ALL_PATH', 77004 );
+  define( 'PCLZIP_OPT_SET_CHMOD', 77005 );
+  define( 'PCLZIP_OPT_EXTRACT_AS_STRING', 77006 );
+  define( 'PCLZIP_OPT_NO_COMPRESSION', 77007 );
+  define( 'PCLZIP_OPT_BY_NAME', 77008 );
+  define( 'PCLZIP_OPT_BY_INDEX', 77009 );
+  define( 'PCLZIP_OPT_BY_EREG', 77010 );
+  define( 'PCLZIP_OPT_BY_PREG', 77011 );
+  define( 'PCLZIP_OPT_COMMENT', 77012 );
+  define( 'PCLZIP_OPT_ADD_COMMENT', 77013 );
+  define( 'PCLZIP_OPT_PREPEND_COMMENT', 77014 );
+  define( 'PCLZIP_OPT_EXTRACT_IN_OUTPUT', 77015 );
+  define( 'PCLZIP_OPT_REPLACE_NEWER', 77016 );
+  define( 'PCLZIP_OPT_STOP_ON_ERROR', 77017 );
+  // Having big trouble with crypt. Need to multiply 2 long int
+  // which is not correctly supported by PHP ...
+  //define( 'PCLZIP_OPT_CRYPT', 77018 );
+  define( 'PCLZIP_OPT_EXTRACT_DIR_RESTRICTION', 77019 );
+  define( 'PCLZIP_OPT_TEMP_FILE_THRESHOLD', 77020 );
+  define( 'PCLZIP_OPT_ADD_TEMP_FILE_THRESHOLD', 77020 ); // alias
+  define( 'PCLZIP_OPT_TEMP_FILE_ON', 77021 );
+  define( 'PCLZIP_OPT_ADD_TEMP_FILE_ON', 77021 ); // alias
+  define( 'PCLZIP_OPT_TEMP_FILE_OFF', 77022 );
+  define( 'PCLZIP_OPT_ADD_TEMP_FILE_OFF', 77022 ); // alias
+  
+  // ----- File description attributes
+  define( 'PCLZIP_ATT_FILE_NAME', 79001 );
+  define( 'PCLZIP_ATT_FILE_NEW_SHORT_NAME', 79002 );
+  define( 'PCLZIP_ATT_FILE_NEW_FULL_NAME', 79003 );
+  define( 'PCLZIP_ATT_FILE_MTIME', 79004 );
+  define( 'PCLZIP_ATT_FILE_CONTENT', 79005 );
+  define( 'PCLZIP_ATT_FILE_COMMENT', 79006 );
+
+  // ----- Call backs values
+  define( 'PCLZIP_CB_PRE_EXTRACT', 78001 );
+  define( 'PCLZIP_CB_POST_EXTRACT', 78002 );
+  define( 'PCLZIP_CB_PRE_ADD', 78003 );
+  define( 'PCLZIP_CB_POST_ADD', 78004 );
+  /* For futur use
+  define( 'PCLZIP_CB_PRE_LIST', 78005 );
+  define( 'PCLZIP_CB_POST_LIST', 78006 );
+  define( 'PCLZIP_CB_PRE_DELETE', 78007 );
+  define( 'PCLZIP_CB_POST_DELETE', 78008 );
+  */
+
+  // --------------------------------------------------------------------------------
+  // Class : PclZip
+  // Description :
+  //   PclZip is the class that represent a Zip archive.
+  //   The public methods allow the manipulation of the archive.
+  // Attributes :
+  //   Attributes must not be accessed directly.
+  // Methods :
+  //   PclZip() : Object creator
+  //   create() : Creates the Zip archive
+  //   listContent() : List the content of the Zip archive
+  //   extract() : Extract the content of the archive
+  //   properties() : List the properties of the archive
+  // --------------------------------------------------------------------------------
+  class PclZip
+  {
+    // ----- Filename of the zip file
+    var $zipname = '';
+
+    // ----- File descriptor of the zip file
+    var $zip_fd = 0;
+
+    // ----- Internal error handling
+    var $error_code = 1;
+    var $error_string = '';
+    
+    // ----- Current status of the magic_quotes_runtime
+    // This value store the php configuration for magic_quotes
+    // The class can then disable the magic_quotes and reset it after
+    var $magic_quotes_status;
+
+  // --------------------------------------------------------------------------------
+  // Function : PclZip()
+  // Description :
+  //   Creates a PclZip object and set the name of the associated Zip archive
+  //   filename.
+  //   Note that no real action is taken, if the archive does not exist it is not
+  //   created. Use create() for that.
+  // --------------------------------------------------------------------------------
+  function PclZip($p_zipname)
+  {
+
+    // ----- Tests the zlib
+    if (!function_exists('gzopen'))
+    {
+      die('Abort '.basename(__FILE__).' : Missing zlib extensions');
+    }
+
+    // ----- Set the attributes
+    $this->zipname = $p_zipname;
+    $this->zip_fd = 0;
+    $this->magic_quotes_status = -1;
+
+    // ----- Return
+    return;
+  }
+  // --------------------------------------------------------------------------------
+
+  // --------------------------------------------------------------------------------
+  // Function :
+  //   create($p_filelist, $p_add_dir="", $p_remove_dir="")
+  //   create($p_filelist, $p_option, $p_option_value, ...)
+  // Description :
+  //   This method supports two different synopsis. The first one is historical.
+  //   This method creates a Zip Archive. The Zip file is created in the
+  //   filesystem. The files and directories indicated in $p_filelist
+  //   are added in the archive. See the parameters description for the
+  //   supported format of $p_filelist.
+  //   When a directory is in the list, the directory and its content is added
+  //   in the archive.
+  //   In this synopsis, the function takes an optional variable list of
+  //   options. See bellow the supported options.
+  // Parameters :
+  //   $p_filelist : An array containing file or directory names, or
+  //                 a string containing one filename or one directory name, or
+  //                 a string containing a list of filenames and/or directory
+  //                 names separated by spaces.
+  //   $p_add_dir : A path to add before the real path of the archived file,
+  //                in order to have it memorized in the archive.
+  //   $p_remove_dir : A path to remove from the real path of the file to archive,
+  //                   in order to have a shorter path memorized in the archive.
+  //                   When $p_add_dir and $p_remove_dir are set, $p_remove_dir
+  //                   is removed first, before $p_add_dir is added.
+  // Options :
+  //   PCLZIP_OPT_ADD_PATH :
+  //   PCLZIP_OPT_REMOVE_PATH :
+  //   PCLZIP_OPT_REMOVE_ALL_PATH :
+  //   PCLZIP_OPT_COMMENT :
+  //   PCLZIP_CB_PRE_ADD :
+  //   PCLZIP_CB_POST_ADD :
+  // Return Values :
+  //   0 on failure,
+  //   The list of the added files, with a status of the add action.
+  //   (see PclZip::listContent() for list entry format)
+  // --------------------------------------------------------------------------------
+  function create($p_filelist)
+  {
+    $v_result=1;
+
+    // ----- Reset the error handler
+    $this->privErrorReset();
+
+    // ----- Set default values
+    $v_options = array();
+    $v_options[PCLZIP_OPT_NO_COMPRESSION] = FALSE;
+
+    // ----- Look for variable options arguments
+    $v_size = func_num_args();
+
+    // ----- Look for arguments
+    if ($v_size > 1) {
+      // ----- Get the arguments
+      $v_arg_list = func_get_args();
+
+      // ----- Remove from the options list the first argument
+      array_shift($v_arg_list);
+      $v_size--;
+
+      // ----- Look for first arg
+      if ((is_integer($v_arg_list[0])) && ($v_arg_list[0] > 77000)) {
+
+        // ----- Parse the options
+        $v_result = $this->privParseOptions($v_arg_list, $v_size, $v_options,
+                                            array (PCLZIP_OPT_REMOVE_PATH => 'optional',
+                                                   PCLZIP_OPT_REMOVE_ALL_PATH => 'optional',
+                                                   PCLZIP_OPT_ADD_PATH => 'optional',
+                                                   PCLZIP_CB_PRE_ADD => 'optional',
+                                                   PCLZIP_CB_POST_ADD => 'optional',
+                                                   PCLZIP_OPT_NO_COMPRESSION => 'optional',
+                                                   PCLZIP_OPT_COMMENT => 'optional',
+                                                   PCLZIP_OPT_TEMP_FILE_THRESHOLD => 'optional',
+                                                   PCLZIP_OPT_TEMP_FILE_ON => 'optional',
+                                                   PCLZIP_OPT_TEMP_FILE_OFF => 'optional'
+                                                   //, PCLZIP_OPT_CRYPT => 'optional'
+                                             ));
+        if ($v_result != 1) {
+          return 0;
+        }
+      }
+
+      // ----- Look for 2 args
+      // Here we need to support the first historic synopsis of the
+      // method.
+      else {
+
+        // ----- Get the first argument
+        $v_options[PCLZIP_OPT_ADD_PATH] = $v_arg_list[0];
+
+        // ----- Look for the optional second argument
+        if ($v_size == 2) {
+          $v_options[PCLZIP_OPT_REMOVE_PATH] = $v_arg_list[1];
+        }
+        else if ($v_size > 2) {
+          PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER,
+		                       "Invalid number / type of arguments");
+          return 0;
+        }
+      }
+    }
+    
+    // ----- Look for default option values
+    $this->privOptionDefaultThreshold($v_options);
+
+    // ----- Init
+    $v_string_list = array();
+    $v_att_list = array();
+    $v_filedescr_list = array();
+    $p_result_list = array();
+    
+    // ----- Look if the $p_filelist is really an array
+    if (is_array($p_filelist)) {
+    
+      // ----- Look if the first element is also an array
+      //       This will mean that this is a file description entry
+      if (isset($p_filelist[0]) && is_array($p_filelist[0])) {
+        $v_att_list = $p_filelist;
+      }
+      
+      // ----- The list is a list of string names
+      else {
+        $v_string_list = $p_filelist;
+      }
+    }
+
+    // ----- Look if the $p_filelist is a string
+    else if (is_string($p_filelist)) {
+      // ----- Create a list from the string
+      $v_string_list = explode(PCLZIP_SEPARATOR, $p_filelist);
+    }
+
+    // ----- Invalid variable type for $p_filelist
+    else {
+      PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid variable type p_filelist");
+      return 0;
+    }
+    
+    // ----- Reformat the string list
+    if (sizeof($v_string_list) != 0) {
+      foreach ($v_string_list as $v_string) {
+        if ($v_string != '') {
+          $v_att_list[][PCLZIP_ATT_FILE_NAME] = $v_string;
+        }
+        else {
+        }
+      }
+    }
+    
+    // ----- For each file in the list check the attributes
+    $v_supported_attributes
+    = array ( PCLZIP_ATT_FILE_NAME => 'mandatory'
+             ,PCLZIP_ATT_FILE_NEW_SHORT_NAME => 'optional'
+             ,PCLZIP_ATT_FILE_NEW_FULL_NAME => 'optional'
+             ,PCLZIP_ATT_FILE_MTIME => 'optional'
+             ,PCLZIP_ATT_FILE_CONTENT => 'optional'
+             ,PCLZIP_ATT_FILE_COMMENT => 'optional'
+						);
+    foreach ($v_att_list as $v_entry) {
+      $v_result = $this->privFileDescrParseAtt($v_entry,
+                                               $v_filedescr_list[],
+                                               $v_options,
+                                               $v_supported_attributes);
+      if ($v_result != 1) {
+        return 0;
+      }
+    }
+
+    // ----- Expand the filelist (expand directories)
+    $v_result = $this->privFileDescrExpand($v_filedescr_list, $v_options);
+    if ($v_result != 1) {
+      return 0;
+    }
+
+    // ----- Call the create fct
+    $v_result = $this->privCreate($v_filedescr_list, $p_result_list, $v_options);
+    if ($v_result != 1) {
+      return 0;
+    }
+
+    // ----- Return
+    return $p_result_list;
+  }
+  // --------------------------------------------------------------------------------
+
+  // --------------------------------------------------------------------------------
+  // Function :
+  //   add($p_filelist, $p_add_dir="", $p_remove_dir="")
+  //   add($p_filelist, $p_option, $p_option_value, ...)
+  // Description :
+  //   This method supports two synopsis. The first one is historical.
+  //   This methods add the list of files in an existing archive.
+  //   If a file with the same name already exists, it is added at the end of the
+  //   archive, the first one is still present.
+  //   If the archive does not exist, it is created.
+  // Parameters :
+  //   $p_filelist : An array containing file or directory names, or
+  //                 a string containing one filename or one directory name, or
+  //                 a string containing a list of filenames and/or directory
+  //                 names separated by spaces.
+  //   $p_add_dir : A path to add before the real path of the archived file,
+  //                in order to have it memorized in the archive.
+  //   $p_remove_dir : A path to remove from the real path of the file to archive,
+  //                   in order to have a shorter path memorized in the archive.
+  //                   When $p_add_dir and $p_remove_dir are set, $p_remove_dir
+  //                   is removed first, before $p_add_dir is added.
+  // Options :
+  //   PCLZIP_OPT_ADD_PATH :
+  //   PCLZIP_OPT_REMOVE_PATH :
+  //   PCLZIP_OPT_REMOVE_ALL_PATH :
+  //   PCLZIP_OPT_COMMENT :
+  //   PCLZIP_OPT_ADD_COMMENT :
+  //   PCLZIP_OPT_PREPEND_COMMENT :
+  //   PCLZIP_CB_PRE_ADD :
+  //   PCLZIP_CB_POST_ADD :
+  // Return Values :
+  //   0 on failure,
+  //   The list of the added files, with a status of the add action.
+  //   (see PclZip::listContent() for list entry format)
+  // --------------------------------------------------------------------------------
+  function add($p_filelist)
+  {
+    $v_result=1;
+
+    // ----- Reset the error handler
+    $this->privErrorReset();
+
+    // ----- Set default values
+    $v_options = array();
+    $v_options[PCLZIP_OPT_NO_COMPRESSION] = FALSE;
+
+    // ----- Look for variable options arguments
+    $v_size = func_num_args();
+
+    // ----- Look for arguments
+    if ($v_size > 1) {
+      // ----- Get the arguments
+      $v_arg_list = func_get_args();
+
+      // ----- Remove form the options list the first argument
+      array_shift($v_arg_list);
+      $v_size--;
+
+      // ----- Look for first arg
+      if ((is_integer($v_arg_list[0])) && ($v_arg_list[0] > 77000)) {
+
+        // ----- Parse the options
+        $v_result = $this->privParseOptions($v_arg_list, $v_size, $v_options,
+                                            array (PCLZIP_OPT_REMOVE_PATH => 'optional',
+                                                   PCLZIP_OPT_REMOVE_ALL_PATH => 'optional',
+                                                   PCLZIP_OPT_ADD_PATH => 'optional',
+                                                   PCLZIP_CB_PRE_ADD => 'optional',
+                                                   PCLZIP_CB_POST_ADD => 'optional',
+                                                   PCLZIP_OPT_NO_COMPRESSION => 'optional',
+                                                   PCLZIP_OPT_COMMENT => 'optional',
+                                                   PCLZIP_OPT_ADD_COMMENT => 'optional',
+                                                   PCLZIP_OPT_PREPEND_COMMENT => 'optional',
+                                                   PCLZIP_OPT_TEMP_FILE_THRESHOLD => 'optional',
+                                                   PCLZIP_OPT_TEMP_FILE_ON => 'optional',
+                                                   PCLZIP_OPT_TEMP_FILE_OFF => 'optional'
+                                                   //, PCLZIP_OPT_CRYPT => 'optional'
+												   ));
+        if ($v_result != 1) {
+          return 0;
+        }
+      }
+
+      // ----- Look for 2 args
+      // Here we need to support the first historic synopsis of the
+      // method.
+      else {
+
+        // ----- Get the first argument
+        $v_options[PCLZIP_OPT_ADD_PATH] = $v_add_path = $v_arg_list[0];
+
+        // ----- Look for the optional second argument
+        if ($v_size == 2) {
+          $v_options[PCLZIP_OPT_REMOVE_PATH] = $v_arg_list[1];
+        }
+        else if ($v_size > 2) {
+          // ----- Error log
+          PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid number / type of arguments");
+
+          // ----- Return
+          return 0;
+        }
+      }
+    }
+
+    // ----- Look for default option values
+    $this->privOptionDefaultThreshold($v_options);
+
+    // ----- Init
+    $v_string_list = array();
+    $v_att_list = array();
+    $v_filedescr_list = array();
+    $p_result_list = array();
+    
+    // ----- Look if the $p_filelist is really an array
+    if (is_array($p_filelist)) {
+    
+      // ----- Look if the first element is also an array
+      //       This will mean that this is a file description entry
+      if (isset($p_filelist[0]) && is_array($p_filelist[0])) {
+        $v_att_list = $p_filelist;
+      }
+      
+      // ----- The list is a list of string names
+      else {
+        $v_string_list = $p_filelist;
+      }
+    }
+
+    // ----- Look if the $p_filelist is a string
+    else if (is_string($p_filelist)) {
+      // ----- Create a list from the string
+      $v_string_list = explode(PCLZIP_SEPARATOR, $p_filelist);
+    }
+
+    // ----- Invalid variable type for $p_filelist
+    else {
+      PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid variable type '".gettype($p_filelist)."' for p_filelist");
+      return 0;
+    }
+    
+    // ----- Reformat the string list
+    if (sizeof($v_string_list) != 0) {
+      foreach ($v_string_list as $v_string) {
+        $v_att_list[][PCLZIP_ATT_FILE_NAME] = $v_string;
+      }
+    }
+    
+    // ----- For each file in the list check the attributes
+    $v_supported_attributes
+    = array ( PCLZIP_ATT_FILE_NAME => 'mandatory'
+             ,PCLZIP_ATT_FILE_NEW_SHORT_NAME => 'optional'
+             ,PCLZIP_ATT_FILE_NEW_FULL_NAME => 'optional'
+             ,PCLZIP_ATT_FILE_MTIME => 'optional'
+             ,PCLZIP_ATT_FILE_CONTENT => 'optional'
+             ,PCLZIP_ATT_FILE_COMMENT => 'optional'
+						);
+    foreach ($v_att_list as $v_entry) {
+      $v_result = $this->privFileDescrParseAtt($v_entry,
+                                               $v_filedescr_list[],
+                                               $v_options,
+                                               $v_supported_attributes);
+      if ($v_result != 1) {
+        return 0;
+      }
+    }
+
+    // ----- Expand the filelist (expand directories)
+    $v_result = $this->privFileDescrExpand($v_filedescr_list, $v_options);
+    if ($v_result != 1) {
+      return 0;
+    }
+
+    // ----- Call the create fct
+    $v_result = $this->privAdd($v_filedescr_list, $p_result_list, $v_options);
+    if ($v_result != 1) {
+      return 0;
+    }
+
+    // ----- Return
+    return $p_result_list;
+  }
+  // --------------------------------------------------------------------------------
+
+  // --------------------------------------------------------------------------------
+  // Function : listContent()
+  // Description :
+  //   This public method, gives the list of the files and directories, with their
+  //   properties.
+  //   The properties of each entries in the list are (used also in other functions) :
+  //     filename : Name of the file. For a create or add action it is the filename
+  //                given by the user. For an extract function it is the filename
+  //                of the extracted file.
+  //     stored_filename : Name of the file / directory stored in the archive.
+  //     size : Size of the stored file.
+  //     compressed_size : Size of the file's data compressed in the archive
+  //                       (without the headers overhead)
+  //     mtime : Last known modification date of the file (UNIX timestamp)
+  //     comment : Comment associated with the file
+  //     folder : true | false
+  //     index : index of the file in the archive
+  //     status : status of the action (depending of the action) :
+  //              Values are :
+  //                ok : OK !
+  //                filtered : the file / dir is not extracted (filtered by user)
+  //                already_a_directory : the file can not be extracted because a
+  //                                      directory with the same name already exists
+  //                write_protected : the file can not be extracted because a file
+  //                                  with the same name already exists and is
+  //                                  write protected
+  //                newer_exist : the file was not extracted because a newer file exists
+  //                path_creation_fail : the file is not extracted because the folder
+  //                                     does not exist and can not be created
+  //                write_error : the file was not extracted because there was a
+  //                              error while writing the file
+  //                read_error : the file was not extracted because there was a error
+  //                             while reading the file
+  //                invalid_header : the file was not extracted because of an archive
+  //                                 format error (bad file header)
+  //   Note that each time a method can continue operating when there
+  //   is an action error on a file, the error is only logged in the file status.
+  // Return Values :
+  //   0 on an unrecoverable failure,
+  //   The list of the files in the archive.
+  // --------------------------------------------------------------------------------
+  function listContent()
+  {
+    $v_result=1;
+
+    // ----- Reset the error handler
+    $this->privErrorReset();
+
+    // ----- Check archive
+    if (!$this->privCheckFormat()) {
+      return(0);
+    }
+
+    // ----- Call the extracting fct
+    $p_list = array();
+    if (($v_result = $this->privList($p_list)) != 1)
+    {
+      unset($p_list);
+      return(0);
+    }
+
+    // ----- Return
+    return $p_list;
+  }
+  // --------------------------------------------------------------------------------
+
+  // --------------------------------------------------------------------------------
+  // Function :
+  //   extract($p_path="./", $p_remove_path="")
+  //   extract([$p_option, $p_option_value, ...])
+  // Description :
+  //   This method supports two synopsis. The first one is historical.
+  //   This method extract all the files / directories from the archive to the
+  //   folder indicated in $p_path.
+  //   If you want to ignore the 'root' part of path of the memorized files
+  //   you can indicate this in the optional $p_remove_path parameter.
+  //   By default, if a newer file with the same name already exists, the
+  //   file is not extracted.
+  //
+  //   If both PCLZIP_OPT_PATH and PCLZIP_OPT_ADD_PATH aoptions
+  //   are used, the path indicated in PCLZIP_OPT_ADD_PATH is append
+  //   at the end of the path value of PCLZIP_OPT_PATH.
+  // Parameters :
+  //   $p_path : Path where the files and directories are to be extracted
+  //   $p_remove_path : First part ('root' part) of the memorized path
+  //                    (if any similar) to remove while extracting.
+  // Options :
+  //   PCLZIP_OPT_PATH :
+  //   PCLZIP_OPT_ADD_PATH :
+  //   PCLZIP_OPT_REMOVE_PATH :
+  //   PCLZIP_OPT_REMOVE_ALL_PATH :
+  //   PCLZIP_CB_PRE_EXTRACT :
+  //   PCLZIP_CB_POST_EXTRACT :
+  // Return Values :
+  //   0 or a negative value on failure,
+  //   The list of the extracted files, with a status of the action.
+  //   (see PclZip::listContent() for list entry format)
+  // --------------------------------------------------------------------------------
+  function extract()
+  {
+    $v_result=1;
+
+    // ----- Reset the error handler
+    $this->privErrorReset();
+
+    // ----- Check archive
+    if (!$this->privCheckFormat()) {
+      return(0);
+    }
+
+    // ----- Set default values
+    $v_options = array();
+//    $v_path = "./";
+    $v_path = '';
+    $v_remove_path = "";
+    $v_remove_all_path = false;
+
+    // ----- Look for variable options arguments
+    $v_size = func_num_args();
+
+    // ----- Default values for option
+    $v_options[PCLZIP_OPT_EXTRACT_AS_STRING] = FALSE;
+
+    // ----- Look for arguments
+    if ($v_size > 0) {
+      // ----- Get the arguments
+      $v_arg_list = func_get_args();
+
+      // ----- Look for first arg
+      if ((is_integer($v_arg_list[0])) && ($v_arg_list[0] > 77000)) {
+
+        // ----- Parse the options
+        $v_result = $this->privParseOptions($v_arg_list, $v_size, $v_options,
+                                            array (PCLZIP_OPT_PATH => 'optional',
+                                                   PCLZIP_OPT_REMOVE_PATH => 'optional',
+                                                   PCLZIP_OPT_REMOVE_ALL_PATH => 'optional',
+                                                   PCLZIP_OPT_ADD_PATH => 'optional',
+                                                   PCLZIP_CB_PRE_EXTRACT => 'optional',
+                                                   PCLZIP_CB_POST_EXTRACT => 'optional',
+                                                   PCLZIP_OPT_SET_CHMOD => 'optional',
+                                                   PCLZIP_OPT_BY_NAME => 'optional',
+                                                   PCLZIP_OPT_BY_EREG => 'optional',
+                                                   PCLZIP_OPT_BY_PREG => 'optional',
+                                                   PCLZIP_OPT_BY_INDEX => 'optional',
+                                                   PCLZIP_OPT_EXTRACT_AS_STRING => 'optional',
+                                                   PCLZIP_OPT_EXTRACT_IN_OUTPUT => 'optional',
+                                                   PCLZIP_OPT_REPLACE_NEWER => 'optional'
+                                                   ,PCLZIP_OPT_STOP_ON_ERROR => 'optional'
+                                                   ,PCLZIP_OPT_EXTRACT_DIR_RESTRICTION => 'optional',
+                                                   PCLZIP_OPT_TEMP_FILE_THRESHOLD => 'optional',
+                                                   PCLZIP_OPT_TEMP_FILE_ON => 'optional',
+                                                   PCLZIP_OPT_TEMP_FILE_OFF => 'optional'
+												    ));
+        if ($v_result != 1) {
+          return 0;
+        }
+
+        // ----- Set the arguments
+        if (isset($v_options[PCLZIP_OPT_PATH])) {
+          $v_path = $v_options[PCLZIP_OPT_PATH];
+        }
+        if (isset($v_options[PCLZIP_OPT_REMOVE_PATH])) {
+          $v_remove_path = $v_options[PCLZIP_OPT_REMOVE_PATH];
+        }
+        if (isset($v_options[PCLZIP_OPT_REMOVE_ALL_PATH])) {
+          $v_remove_all_path = $v_options[PCLZIP_OPT_REMOVE_ALL_PATH];
+        }
+        if (isset($v_options[PCLZIP_OPT_ADD_PATH])) {
+          // ----- Check for '/' in last path char
+          if ((strlen($v_path) > 0) && (substr($v_path, -1) != '/')) {
+            $v_path .= '/';
+          }
+          $v_path .= $v_options[PCLZIP_OPT_ADD_PATH];
+        }
+      }
+
+      // ----- Look for 2 args
+      // Here we need to support the first historic synopsis of the
+      // method.
+      else {
+
+        // ----- Get the first argument
+        $v_path = $v_arg_list[0];
+
+        // ----- Look for the optional second argument
+        if ($v_size == 2) {
+          $v_remove_path = $v_arg_list[1];
+        }
+        else if ($v_size > 2) {
+          // ----- Error log
+          PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid number / type of arguments");
+
+          // ----- Return
+          return 0;
+        }
+      }
+    }
+
+    // ----- Look for default option values
+    $this->privOptionDefaultThreshold($v_options);
+
+    // ----- Trace
+
+    // ----- Call the extracting fct
+    $p_list = array();
+    $v_result = $this->privExtractByRule($p_list, $v_path, $v_remove_path,
+	                                     $v_remove_all_path, $v_options);
+    if ($v_result < 1) {
+      unset($p_list);
+      return(0);
+    }
+
+    // ----- Return
+    return $p_list;
+  }
+  // --------------------------------------------------------------------------------
+
+
+  // --------------------------------------------------------------------------------
+  // Function :
+  //   extractByIndex($p_index, $p_path="./", $p_remove_path="")
+  //   extractByIndex($p_index, [$p_option, $p_option_value, ...])
+  // Description :
+  //   This method supports two synopsis. The first one is historical.
+  //   This method is doing a partial extract of the archive.
+  //   The extracted files or folders are identified by their index in the
+  //   archive (from 0 to n).
+  //   Note that if the index identify a folder, only the folder entry is
+  //   extracted, not all the files included in the archive.
+  // Parameters :
+  //   $p_index : A single index (integer) or a string of indexes of files to
+  //              extract. The form of the string is "0,4-6,8-12" with only numbers
+  //              and '-' for range or ',' to separate ranges. No spaces or ';'
+  //              are allowed.
+  //   $p_path : Path where the files and directories are to be extracted
+  //   $p_remove_path : First part ('root' part) of the memorized path
+  //                    (if any similar) to remove while extracting.
+  // Options :
+  //   PCLZIP_OPT_PATH :
+  //   PCLZIP_OPT_ADD_PATH :
+  //   PCLZIP_OPT_REMOVE_PATH :
+  //   PCLZIP_OPT_REMOVE_ALL_PATH :
+  //   PCLZIP_OPT_EXTRACT_AS_STRING : The files are extracted as strings and
+  //     not as files.
+  //     The resulting content is in a new field 'content' in the file
+  //     structure.
+  //     This option must be used alone (any other options are ignored).
+  //   PCLZIP_CB_PRE_EXTRACT :
+  //   PCLZIP_CB_POST_EXTRACT :
+  // Return Values :
+  //   0 on failure,
+  //   The list of the extracted files, with a status of the action.
+  //   (see PclZip::listContent() for list entry format)
+  // --------------------------------------------------------------------------------
+  //function extractByIndex($p_index, options...)
+  function extractByIndex($p_index)
+  {
+    $v_result=1;
+
+    // ----- Reset the error handler
+    $this->privErrorReset();
+
+    // ----- Check archive
+    if (!$this->privCheckFormat()) {
+      return(0);
+    }
+
+    // ----- Set default values
+    $v_options = array();
+//    $v_path = "./";
+    $v_path = '';
+    $v_remove_path = "";
+    $v_remove_all_path = false;
+
+    // ----- Look for variable options arguments
+    $v_size = func_num_args();
+
+    // ----- Default values for option
+    $v_options[PCLZIP_OPT_EXTRACT_AS_STRING] = FALSE;
+
+    // ----- Look for arguments
+    if ($v_size > 1) {
+      // ----- Get the arguments
+      $v_arg_list = func_get_args();
+
+      // ----- Remove form the options list the first argument
+      array_shift($v_arg_list);
+      $v_size--;
+
+      // ----- Look for first arg
+      if ((is_integer($v_arg_list[0])) && ($v_arg_list[0] > 77000)) {
+
+        // ----- Parse the options
+        $v_result = $this->privParseOptions($v_arg_list, $v_size, $v_options,
+                                            array (PCLZIP_OPT_PATH => 'optional',
+                                                   PCLZIP_OPT_REMOVE_PATH => 'optional',
+                                                   PCLZIP_OPT_REMOVE_ALL_PATH => 'optional',
+                                                   PCLZIP_OPT_EXTRACT_AS_STRING => 'optional',
+                                                   PCLZIP_OPT_ADD_PATH => 'optional',
+                                                   PCLZIP_CB_PRE_EXTRACT => 'optional',
+                                                   PCLZIP_CB_POST_EXTRACT => 'optional',
+                                                   PCLZIP_OPT_SET_CHMOD => 'optional',
+                                                   PCLZIP_OPT_REPLACE_NEWER => 'optional'
+                                                   ,PCLZIP_OPT_STOP_ON_ERROR => 'optional'
+                                                   ,PCLZIP_OPT_EXTRACT_DIR_RESTRICTION => 'optional',
+                                                   PCLZIP_OPT_TEMP_FILE_THRESHOLD => 'optional',
+                                                   PCLZIP_OPT_TEMP_FILE_ON => 'optional',
+                                                   PCLZIP_OPT_TEMP_FILE_OFF => 'optional'
+												   ));
+        if ($v_result != 1) {
+          return 0;
+        }
+
+        // ----- Set the arguments
+        if (isset($v_options[PCLZIP_OPT_PATH])) {
+          $v_path = $v_options[PCLZIP_OPT_PATH];
+        }
+        if (isset($v_options[PCLZIP_OPT_REMOVE_PATH])) {
+          $v_remove_path = $v_options[PCLZIP_OPT_REMOVE_PATH];
+        }
+        if (isset($v_options[PCLZIP_OPT_REMOVE_ALL_PATH])) {
+          $v_remove_all_path = $v_options[PCLZIP_OPT_REMOVE_ALL_PATH];
+        }
+        if (isset($v_options[PCLZIP_OPT_ADD_PATH])) {
+          // ----- Check for '/' in last path char
+          if ((strlen($v_path) > 0) && (substr($v_path, -1) != '/')) {
+            $v_path .= '/';
+          }
+          $v_path .= $v_options[PCLZIP_OPT_ADD_PATH];
+        }
+        if (!isset($v_options[PCLZIP_OPT_EXTRACT_AS_STRING])) {
+          $v_options[PCLZIP_OPT_EXTRACT_AS_STRING] = FALSE;
+        }
+        else {
+        }
+      }
+
+      // ----- Look for 2 args
+      // Here we need to support the first historic synopsis of the
+      // method.
+      else {
+
+        // ----- Get the first argument
+        $v_path = $v_arg_list[0];
+
+        // ----- Look for the optional second argument
+        if ($v_size == 2) {
+          $v_remove_path = $v_arg_list[1];
+        }
+        else if ($v_size > 2) {
+          // ----- Error log
+          PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid number / type of arguments");
+
+          // ----- Return
+          return 0;
+        }
+      }
+    }
+
+    // ----- Trace
+
+    // ----- Trick
+    // Here I want to reuse extractByRule(), so I need to parse the $p_index
+    // with privParseOptions()
+    $v_arg_trick = array (PCLZIP_OPT_BY_INDEX, $p_index);
+    $v_options_trick = array();
+    $v_result = $this->privParseOptions($v_arg_trick, sizeof($v_arg_trick), $v_options_trick,
+                                        array (PCLZIP_OPT_BY_INDEX => 'optional' ));
+    if ($v_result != 1) {
+        return 0;
+    }
+    $v_options[PCLZIP_OPT_BY_INDEX] = $v_options_trick[PCLZIP_OPT_BY_INDEX];
+
+    // ----- Look for default option values
+    $this->privOptionDefaultThreshold($v_options);
+
+    // ----- Call the extracting fct
+    if (($v_result = $this->privExtractByRule($p_list, $v_path, $v_remove_path, $v_remove_all_path, $v_options)) < 1) {
+        return(0);
+    }
+
+    // ----- Return
+    return $p_list;
+  }
+  // --------------------------------------------------------------------------------
+
+  // --------------------------------------------------------------------------------
+  // Function :
+  //   delete([$p_option, $p_option_value, ...])
+  // Description :
+  //   This method removes files from the archive.
+  //   If no parameters are given, then all the archive is emptied.
+  // Parameters :
+  //   None or optional arguments.
+  // Options :
+  //   PCLZIP_OPT_BY_INDEX :
+  //   PCLZIP_OPT_BY_NAME :
+  //   PCLZIP_OPT_BY_EREG : 
+  //   PCLZIP_OPT_BY_PREG :
+  // Return Values :
+  //   0 on failure,
+  //   The list of the files which are still present in the archive.
+  //   (see PclZip::listContent() for list entry format)
+  // --------------------------------------------------------------------------------
+  function delete()
+  {
+    $v_result=1;
+
+    // ----- Reset the error handler
+    $this->privErrorReset();
+
+    // ----- Check archive
+    if (!$this->privCheckFormat()) {
+      return(0);
+    }
+
+    // ----- Set default values
+    $v_options = array();
+
+    // ----- Look for variable options arguments
+    $v_size = func_num_args();
+
+    // ----- Look for arguments
+    if ($v_size > 0) {
+      // ----- Get the arguments
+      $v_arg_list = func_get_args();
+
+      // ----- Parse the options
+      $v_result = $this->privParseOptions($v_arg_list, $v_size, $v_options,
+                                        array (PCLZIP_OPT_BY_NAME => 'optional',
+                                               PCLZIP_OPT_BY_EREG => 'optional',
+                                               PCLZIP_OPT_BY_PREG => 'optional',
+                                               PCLZIP_OPT_BY_INDEX => 'optional' ));
+      if ($v_result != 1) {
+          return 0;
+      }
+    }
+
+    // ----- Magic quotes trick
+    $this->privDisableMagicQuotes();
+
+    // ----- Call the delete fct
+    $v_list = array();
+    if (($v_result = $this->privDeleteByRule($v_list, $v_options)) != 1) {
+      $this->privSwapBackMagicQuotes();
+      unset($v_list);
+      return(0);
+    }
+
+    // ----- Magic quotes trick
+    $this->privSwapBackMagicQuotes();
+
+    // ----- Return
+    return $v_list;
+  }
+  // --------------------------------------------------------------------------------
+
+  // --------------------------------------------------------------------------------
+  // Function : deleteByIndex()
+  // Description :
+  //   ***** Deprecated *****
+  //   delete(PCLZIP_OPT_BY_INDEX, $p_index) should be prefered.
+  // --------------------------------------------------------------------------------
+  function deleteByIndex($p_index)
+  {
+    
+    $p_list = $this->delete(PCLZIP_OPT_BY_INDEX, $p_index);
+
+    // ----- Return
+    return $p_list;
+  }
+  // --------------------------------------------------------------------------------
+
+  // --------------------------------------------------------------------------------
+  // Function : properties()
+  // Description :
+  //   This method gives the properties of the archive.
+  //   The properties are :
+  //     nb : Number of files in the archive
+  //     comment : Comment associated with the archive file
+  //     status : not_exist, ok
+  // Parameters :
+  //   None
+  // Return Values :
+  //   0 on failure,
+  //   An array with the archive properties.
+  // --------------------------------------------------------------------------------
+  function properties()
+  {
+
+    // ----- Reset the error handler
+    $this->privErrorReset();
+
+    // ----- Magic quotes trick
+    $this->privDisableMagicQuotes();
+
+    // ----- Check archive
+    if (!$this->privCheckFormat()) {
+      $this->privSwapBackMagicQuotes();
+      return(0);
+    }
+
+    // ----- Default properties
+    $v_prop = array();
+    $v_prop['comment'] = '';
+    $v_prop['nb'] = 0;
+    $v_prop['status'] = 'not_exist';
+
+    // ----- Look if file exists
+    if (@is_file($this->zipname))
+    {
+      // ----- Open the zip file
+      if (($this->zip_fd = @fopen($this->zipname, 'rb')) == 0)
+      {
+        $this->privSwapBackMagicQuotes();
+        
+        // ----- Error log
+        PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open archive \''.$this->zipname.'\' in binary read mode');
+
+        // ----- Return
+        return 0;
+      }
+
+      // ----- Read the central directory informations
+      $v_central_dir = array();
+      if (($v_result = $this->privReadEndCentralDir($v_central_dir)) != 1)
+      {
+        $this->privSwapBackMagicQuotes();
+        return 0;
+      }
+
+      // ----- Close the zip file
+      $this->privCloseFd();
+
+      // ----- Set the user attributes
+      $v_prop['comment'] = $v_central_dir['comment'];
+      $v_prop['nb'] = $v_central_dir['entries'];
+      $v_prop['status'] = 'ok';
+    }
+
+    // ----- Magic quotes trick
+    $this->privSwapBackMagicQuotes();
+
+    // ----- Return
+    return $v_prop;
+  }
+  // --------------------------------------------------------------------------------
+
+  // --------------------------------------------------------------------------------
+  // Function : duplicate()
+  // Description :
+  //   This method creates an archive by copying the content of an other one. If
+  //   the archive already exist, it is replaced by the new one without any warning.
+  // Parameters :
+  //   $p_archive : The filename of a valid archive, or
+  //                a valid PclZip object.
+  // Return Values :
+  //   1 on success.
+  //   0 or a negative value on error (error code).
+  // --------------------------------------------------------------------------------
+  function duplicate($p_archive)
+  {
+    $v_result = 1;
+
+    // ----- Reset the error handler
+    $this->privErrorReset();
+
+    // ----- Look if the $p_archive is a PclZip object
+    if ((is_object($p_archive)) && (get_class($p_archive) == 'pclzip'))
+    {
+
+      // ----- Duplicate the archive
+      $v_result = $this->privDuplicate($p_archive->zipname);
+    }
+
+    // ----- Look if the $p_archive is a string (so a filename)
+    else if (is_string($p_archive))
+    {
+
+      // ----- Check that $p_archive is a valid zip file
+      // TBC : Should also check the archive format
+      if (!is_file($p_archive)) {
+        // ----- Error log
+        PclZip::privErrorLog(PCLZIP_ERR_MISSING_FILE, "No file with filename '".$p_archive."'");
+        $v_result = PCLZIP_ERR_MISSING_FILE;
+      }
+      else {
+        // ----- Duplicate the archive
+        $v_result = $this->privDuplicate($p_archive);
+      }
+    }
+
+    // ----- Invalid variable
+    else
+    {
+      // ----- Error log
+      PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid variable type p_archive_to_add");
+      $v_result = PCLZIP_ERR_INVALID_PARAMETER;
+    }
+
+    // ----- Return
+    return $v_result;
+  }
+  // --------------------------------------------------------------------------------
+
+  // --------------------------------------------------------------------------------
+  // Function : merge()
+  // Description :
+  //   This method merge the $p_archive_to_add archive at the end of the current
+  //   one ($this).
+  //   If the archive ($this) does not exist, the merge becomes a duplicate.
+  //   If the $p_archive_to_add archive does not exist, the merge is a success.
+  // Parameters :
+  //   $p_archive_to_add : It can be directly the filename of a valid zip archive,
+  //                       or a PclZip object archive.
+  // Return Values :
+  //   1 on success,
+  //   0 or negative values on error (see below).
+  // --------------------------------------------------------------------------------
+  function merge($p_archive_to_add)
+  {
+    $v_result = 1;
+
+    // ----- Reset the error handler
+    $this->privErrorReset();
+
+    // ----- Check archive
+    if (!$this->privCheckFormat()) {
+      return(0);
+    }
+
+    // ----- Look if the $p_archive_to_add is a PclZip object
+    if ((is_object($p_archive_to_add)) && (get_class($p_archive_to_add) == 'pclzip'))
+    {
+
+      // ----- Merge the archive
+      $v_result = $this->privMerge($p_archive_to_add);
+    }
+
+    // ----- Look if the $p_archive_to_add is a string (so a filename)
+    else if (is_string($p_archive_to_add))
+    {
+
+      // ----- Create a temporary archive
+      $v_object_archive = new PclZip($p_archive_to_add);
+
+      // ----- Merge the archive
+      $v_result = $this->privMerge($v_object_archive);
+    }
+
+    // ----- Invalid variable
+    else
+    {
+      // ----- Error log
+      PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid variable type p_archive_to_add");
+      $v_result = PCLZIP_ERR_INVALID_PARAMETER;
+    }
+
+    // ----- Return
+    return $v_result;
+  }
+  // --------------------------------------------------------------------------------
+
+
+
+  // --------------------------------------------------------------------------------
+  // Function : errorCode()
+  // Description :
+  // Parameters :
+  // --------------------------------------------------------------------------------
+  function errorCode()
+  {
+    if (PCLZIP_ERROR_EXTERNAL == 1) {
+      return(PclErrorCode());
+    }
+    else {
+      return($this->error_code);
+    }
+  }
+  // --------------------------------------------------------------------------------
+
+  // --------------------------------------------------------------------------------
+  // Function : errorName()
+  // Description :
+  // Parameters :
+  // --------------------------------------------------------------------------------
+  function errorName($p_with_code=false)
+  {
+    $v_name = array ( PCLZIP_ERR_NO_ERROR => 'PCLZIP_ERR_NO_ERROR',
+                      PCLZIP_ERR_WRITE_OPEN_FAIL => 'PCLZIP_ERR_WRITE_OPEN_FAIL',
+                      PCLZIP_ERR_READ_OPEN_FAIL => 'PCLZIP_ERR_READ_OPEN_FAIL',
+                      PCLZIP_ERR_INVALID_PARAMETER => 'PCLZIP_ERR_INVALID_PARAMETER',
+                      PCLZIP_ERR_MISSING_FILE => 'PCLZIP_ERR_MISSING_FILE',
+                      PCLZIP_ERR_FILENAME_TOO_LONG => 'PCLZIP_ERR_FILENAME_TOO_LONG',
+                      PCLZIP_ERR_INVALID_ZIP => 'PCLZIP_ERR_INVALID_ZIP',
+                      PCLZIP_ERR_BAD_EXTRACTED_FILE => 'PCLZIP_ERR_BAD_EXTRACTED_FILE',
+                      PCLZIP_ERR_DIR_CREATE_FAIL => 'PCLZIP_ERR_DIR_CREATE_FAIL',
+                      PCLZIP_ERR_BAD_EXTENSION => 'PCLZIP_ERR_BAD_EXTENSION',
+                      PCLZIP_ERR_BAD_FORMAT => 'PCLZIP_ERR_BAD_FORMAT',
+                      PCLZIP_ERR_DELETE_FILE_FAIL => 'PCLZIP_ERR_DELETE_FILE_FAIL',
+                      PCLZIP_ERR_RENAME_FILE_FAIL => 'PCLZIP_ERR_RENAME_FILE_FAIL',
+                      PCLZIP_ERR_BAD_CHECKSUM => 'PCLZIP_ERR_BAD_CHECKSUM',
+                      PCLZIP_ERR_INVALID_ARCHIVE_ZIP => 'PCLZIP_ERR_INVALID_ARCHIVE_ZIP',
+                      PCLZIP_ERR_MISSING_OPTION_VALUE => 'PCLZIP_ERR_MISSING_OPTION_VALUE',
+                      PCLZIP_ERR_INVALID_OPTION_VALUE => 'PCLZIP_ERR_INVALID_OPTION_VALUE',
+                      PCLZIP_ERR_UNSUPPORTED_COMPRESSION => 'PCLZIP_ERR_UNSUPPORTED_COMPRESSION',
+                      PCLZIP_ERR_UNSUPPORTED_ENCRYPTION => 'PCLZIP_ERR_UNSUPPORTED_ENCRYPTION'
+                      ,PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE => 'PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE'
+                      ,PCLZIP_ERR_DIRECTORY_RESTRICTION => 'PCLZIP_ERR_DIRECTORY_RESTRICTION'
+                    );
+
+    if (isset($v_name[$this->error_code])) {
+      $v_value = $v_name[$this->error_code];
+    }
+    else {
+      $v_value = 'NoName';
+    }
+
+    if ($p_with_code) {
+      return($v_value.' ('.$this->error_code.')');
+    }
+    else {
+      return($v_value);
+    }
+  }
+  // --------------------------------------------------------------------------------
+
+  // --------------------------------------------------------------------------------
+  // Function : errorInfo()
+  // Description :
+  // Parameters :
+  // --------------------------------------------------------------------------------
+  function errorInfo($p_full=false)
+  {
+    if (PCLZIP_ERROR_EXTERNAL == 1) {
+      return(PclErrorString());
+    }
+    else {
+      if ($p_full) {
+        return($this->errorName(true)." : ".$this->error_string);
+      }
+      else {
+        return($this->error_string." [code ".$this->error_code."]");
+      }
+    }
+  }
+  // --------------------------------------------------------------------------------
+
+
+// --------------------------------------------------------------------------------
+// ***** UNDER THIS LINE ARE DEFINED PRIVATE INTERNAL FUNCTIONS *****
+// *****                                                        *****
+// *****       THESES FUNCTIONS MUST NOT BE USED DIRECTLY       *****
+// --------------------------------------------------------------------------------
+
+
+
+  // --------------------------------------------------------------------------------
+  // Function : privCheckFormat()
+  // Description :
+  //   This method check that the archive exists and is a valid zip archive.
+  //   Several level of check exists. (futur)
+  // Parameters :
+  //   $p_level : Level of check. Default 0.
+  //              0 : Check the first bytes (magic codes) (default value))
+  //              1 : 0 + Check the central directory (futur)
+  //              2 : 1 + Check each file header (futur)
+  // Return Values :
+  //   true on success,
+  //   false on error, the error code is set.
+  // --------------------------------------------------------------------------------
+  function privCheckFormat($p_level=0)
+  {
+    $v_result = true;
+
+	// ----- Reset the file system cache
+    clearstatcache();
+
+    // ----- Reset the error handler
+    $this->privErrorReset();
+
+    // ----- Look if the file exits
+    if (!is_file($this->zipname)) {
+      // ----- Error log
+      PclZip::privErrorLog(PCLZIP_ERR_MISSING_FILE, "Missing archive file '".$this->zipname."'");
+      return(false);
+    }
+
+    // ----- Check that the file is readeable
+    if (!is_readable($this->zipname)) {
+      // ----- Error log
+      PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, "Unable to read archive '".$this->zipname."'");
+      return(false);
+    }
+
+    // ----- Check the magic code
+    // TBC
+
+    // ----- Check the central header
+    // TBC
+
+    // ----- Check each file header
+    // TBC
+
+    // ----- Return
+    return $v_result;
+  }
+  // --------------------------------------------------------------------------------
+
+  // --------------------------------------------------------------------------------
+  // Function : privParseOptions()
+  // Description :
+  //   This internal methods reads the variable list of arguments ($p_options_list,
+  //   $p_size) and generate an array with the options and values ($v_result_list).
+  //   $v_requested_options contains the options that can be present and those that
+  //   must be present.
+  //   $v_requested_options is an array, with the option value as key, and 'optional',
+  //   or 'mandatory' as value.
+  // Parameters :
+  //   See above.
+  // Return Values :
+  //   1 on success.
+  //   0 on failure.
+  // --------------------------------------------------------------------------------
+  function privParseOptions(&$p_options_list, $p_size, &$v_result_list, $v_requested_options=false)
+  {
+    $v_result=1;
+    
+    // ----- Read the options
+    $i=0;
+    while ($i<$p_size) {
+
+      // ----- Check if the option is supported
+      if (!isset($v_requested_options[$p_options_list[$i]])) {
+        // ----- Error log
+        PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid optional parameter '".$p_options_list[$i]."' for this method");
+
+        // ----- Return
+        return PclZip::errorCode();
+      }
+
+      // ----- Look for next option
+      switch ($p_options_list[$i]) {
+        // ----- Look for options that request a path value
+        case PCLZIP_OPT_PATH :
+        case PCLZIP_OPT_REMOVE_PATH :
+        case PCLZIP_OPT_ADD_PATH :
+          // ----- Check the number of parameters
+          if (($i+1) >= $p_size) {
+            // ----- Error log
+            PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'");
+
+            // ----- Return
+            return PclZip::errorCode();
+          }
+
+          // ----- Get the value
+          $v_result_list[$p_options_list[$i]] = PclZipUtilTranslateWinPath($p_options_list[$i+1], FALSE);
+          $i++;
+        break;
+
+        case PCLZIP_OPT_TEMP_FILE_THRESHOLD :
+          // ----- Check the number of parameters
+          if (($i+1) >= $p_size) {
+            PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'");
+            return PclZip::errorCode();
+          }
+          
+          // ----- Check for incompatible options
+          if (isset($v_result_list[PCLZIP_OPT_TEMP_FILE_OFF])) {
+            PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Option '".PclZipUtilOptionText($p_options_list[$i])."' can not be used with option 'PCLZIP_OPT_TEMP_FILE_OFF'");
+            return PclZip::errorCode();
+          }
+          
+          // ----- Check the value
+          $v_value = $p_options_list[$i+1];
+          if ((!is_integer($v_value)) || ($v_value<0)) {
+            PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE, "Integer expected for option '".PclZipUtilOptionText($p_options_list[$i])."'");
+            return PclZip::errorCode();
+          }
+
+          // ----- Get the value (and convert it in bytes)
+          $v_result_list[$p_options_list[$i]] = $v_value*1048576;
+          $i++;
+        break;
+
+        case PCLZIP_OPT_TEMP_FILE_ON :
+          // ----- Check for incompatible options
+          if (isset($v_result_list[PCLZIP_OPT_TEMP_FILE_OFF])) {
+            PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Option '".PclZipUtilOptionText($p_options_list[$i])."' can not be used with option 'PCLZIP_OPT_TEMP_FILE_OFF'");
+            return PclZip::errorCode();
+          }
+          
+          $v_result_list[$p_options_list[$i]] = true;
+        break;
+
+        case PCLZIP_OPT_TEMP_FILE_OFF :
+          // ----- Check for incompatible options
+          if (isset($v_result_list[PCLZIP_OPT_TEMP_FILE_ON])) {
+            PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Option '".PclZipUtilOptionText($p_options_list[$i])."' can not be used with option 'PCLZIP_OPT_TEMP_FILE_ON'");
+            return PclZip::errorCode();
+          }
+          // ----- Check for incompatible options
+          if (isset($v_result_list[PCLZIP_OPT_TEMP_FILE_THRESHOLD])) {
+            PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Option '".PclZipUtilOptionText($p_options_list[$i])."' can not be used with option 'PCLZIP_OPT_TEMP_FILE_THRESHOLD'");
+            return PclZip::errorCode();
+          }
+          
+          $v_result_list[$p_options_list[$i]] = true;
+        break;
+
+        case PCLZIP_OPT_EXTRACT_DIR_RESTRICTION :
+          // ----- Check the number of parameters
+          if (($i+1) >= $p_size) {
+            // ----- Error log
+            PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'");
+
+            // ----- Return
+            return PclZip::errorCode();
+          }
+
+          // ----- Get the value
+          if (   is_string($p_options_list[$i+1])
+              && ($p_options_list[$i+1] != '')) {
+            $v_result_list[$p_options_list[$i]] = PclZipUtilTranslateWinPath($p_options_list[$i+1], FALSE);
+            $i++;
+          }
+          else {
+          }
+        break;
+
+        // ----- Look for options that request an array of string for value
+        case PCLZIP_OPT_BY_NAME :
+          // ----- Check the number of parameters
+          if (($i+1) >= $p_size) {
+            // ----- Error log
+            PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'");
+
+            // ----- Return
+            return PclZip::errorCode();
+          }
+
+          // ----- Get the value
+          if (is_string($p_options_list[$i+1])) {
+              $v_result_list[$p_options_list[$i]][0] = $p_options_list[$i+1];
+          }
+          else if (is_array($p_options_list[$i+1])) {
+              $v_result_list[$p_options_list[$i]] = $p_options_list[$i+1];
+          }
+          else {
+            // ----- Error log
+            PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE, "Wrong parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'");
+
+            // ----- Return
+            return PclZip::errorCode();
+          }
+          $i++;
+        break;
+
+        // ----- Look for options that request an EREG or PREG expression
+        case PCLZIP_OPT_BY_EREG :
+          // ereg() is deprecated starting with PHP 5.3. Move PCLZIP_OPT_BY_EREG
+          // to PCLZIP_OPT_BY_PREG
+          $p_options_list[$i] = PCLZIP_OPT_BY_PREG;
+        case PCLZIP_OPT_BY_PREG :
+        //case PCLZIP_OPT_CRYPT :
+          // ----- Check the number of parameters
+          if (($i+1) >= $p_size) {
+            // ----- Error log
+            PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'");
+
+            // ----- Return
+            return PclZip::errorCode();
+          }
+
+          // ----- Get the value
+          if (is_string($p_options_list[$i+1])) {
+              $v_result_list[$p_options_list[$i]] = $p_options_list[$i+1];
+          }
+          else {
+            // ----- Error log
+            PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE, "Wrong parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'");
+
+            // ----- Return
+            return PclZip::errorCode();
+          }
+          $i++;
+        break;
+
+        // ----- Look for options that takes a string
+        case PCLZIP_OPT_COMMENT :
+        case PCLZIP_OPT_ADD_COMMENT :
+        case PCLZIP_OPT_PREPEND_COMMENT :
+          // ----- Check the number of parameters
+          if (($i+1) >= $p_size) {
+            // ----- Error log
+            PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE,
+			                     "Missing parameter value for option '"
+								 .PclZipUtilOptionText($p_options_list[$i])
+								 ."'");
+
+            // ----- Return
+            return PclZip::errorCode();
+          }
+
+          // ----- Get the value
+          if (is_string($p_options_list[$i+1])) {
+              $v_result_list[$p_options_list[$i]] = $p_options_list[$i+1];
+          }
+          else {
+            // ----- Error log
+            PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE,
+			                     "Wrong parameter value for option '"
+								 .PclZipUtilOptionText($p_options_list[$i])
+								 ."'");
+
+            // ----- Return
+            return PclZip::errorCode();
+          }
+          $i++;
+        break;
+
+        // ----- Look for options that request an array of index
+        case PCLZIP_OPT_BY_INDEX :
+          // ----- Check the number of parameters
+          if (($i+1) >= $p_size) {
+            // ----- Error log
+            PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'");
+
+            // ----- Return
+            return PclZip::errorCode();
+          }
+
+          // ----- Get the value
+          $v_work_list = array();
+          if (is_string($p_options_list[$i+1])) {
+
+              // ----- Remove spaces
+              $p_options_list[$i+1] = strtr($p_options_list[$i+1], ' ', '');
+
+              // ----- Parse items
+              $v_work_list = explode(",", $p_options_list[$i+1]);
+          }
+          else if (is_integer($p_options_list[$i+1])) {
+              $v_work_list[0] = $p_options_list[$i+1].'-'.$p_options_list[$i+1];
+          }
+          else if (is_array($p_options_list[$i+1])) {
+              $v_work_list = $p_options_list[$i+1];
+          }
+          else {
+            // ----- Error log
+            PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE, "Value must be integer, string or array for option '".PclZipUtilOptionText($p_options_list[$i])."'");
+
+            // ----- Return
+            return PclZip::errorCode();
+          }
+          
+          // ----- Reduce the index list
+          // each index item in the list must be a couple with a start and
+          // an end value : [0,3], [5-5], [8-10], ...
+          // ----- Check the format of each item
+          $v_sort_flag=false;
+          $v_sort_value=0;
+          for ($j=0; $j<sizeof($v_work_list); $j++) {
+              // ----- Explode the item
+              $v_item_list = explode("-", $v_work_list[$j]);
+              $v_size_item_list = sizeof($v_item_list);
+              
+              // ----- TBC : Here we might check that each item is a
+              // real integer ...
+              
+              // ----- Look for single value
+              if ($v_size_item_list == 1) {
+                  // ----- Set the option value
+                  $v_result_list[$p_options_list[$i]][$j]['start'] = $v_item_list[0];
+                  $v_result_list[$p_options_list[$i]][$j]['end'] = $v_item_list[0];
+              }
+              elseif ($v_size_item_list == 2) {
+                  // ----- Set the option value
+                  $v_result_list[$p_options_list[$i]][$j]['start'] = $v_item_list[0];
+                  $v_result_list[$p_options_list[$i]][$j]['end'] = $v_item_list[1];
+              }
+              else {
+                  // ----- Error log
+                  PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE, "Too many values in index range for option '".PclZipUtilOptionText($p_options_list[$i])."'");
+
+                  // ----- Return
+                  return PclZip::errorCode();
+              }
+
+
+              // ----- Look for list sort
+              if ($v_result_list[$p_options_list[$i]][$j]['start'] < $v_sort_value) {
+                  $v_sort_flag=true;
+
+                  // ----- TBC : An automatic sort should be writen ...
+                  // ----- Error log
+                  PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE, "Invalid order of index range for option '".PclZipUtilOptionText($p_options_list[$i])."'");
+
+                  // ----- Return
+                  return PclZip::errorCode();
+              }
+              $v_sort_value = $v_result_list[$p_options_list[$i]][$j]['start'];
+          }
+          
+          // ----- Sort the items
+          if ($v_sort_flag) {
+              // TBC : To Be Completed
+          }
+
+          // ----- Next option
+          $i++;
+        break;
+
+        // ----- Look for options that request no value
+        case PCLZIP_OPT_REMOVE_ALL_PATH :
+        case PCLZIP_OPT_EXTRACT_AS_STRING :
+        case PCLZIP_OPT_NO_COMPRESSION :
+        case PCLZIP_OPT_EXTRACT_IN_OUTPUT :
+        case PCLZIP_OPT_REPLACE_NEWER :
+        case PCLZIP_OPT_STOP_ON_ERROR :
+          $v_result_list[$p_options_list[$i]] = true;
+        break;
+
+        // ----- Look for options that request an octal value
+        case PCLZIP_OPT_SET_CHMOD :
+          // ----- Check the number of parameters
+          if (($i+1) >= $p_size) {
+            // ----- Error log
+            PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'");
+
+            // ----- Return
+            return PclZip::errorCode();
+          }
+
+          // ----- Get the value
+          $v_result_list[$p_options_list[$i]] = $p_options_list[$i+1];
+          $i++;
+        break;
+
+        // ----- Look for options that request a call-back
+        case PCLZIP_CB_PRE_EXTRACT :
+        case PCLZIP_CB_POST_EXTRACT :
+        case PCLZIP_CB_PRE_ADD :
+        case PCLZIP_CB_POST_ADD :
+        /* for futur use
+        case PCLZIP_CB_PRE_DELETE :
+        case PCLZIP_CB_POST_DELETE :
+        case PCLZIP_CB_PRE_LIST :
+        case PCLZIP_CB_POST_LIST :
+        */
+          // ----- Check the number of parameters
+          if (($i+1) >= $p_size) {
+            // ----- Error log
+            PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'");
+
+            // ----- Return
+            return PclZip::errorCode();
+          }
+
+          // ----- Get the value
+          $v_function_name = $p_options_list[$i+1];
+
+          // ----- Check that the value is a valid existing function
+          if (!function_exists($v_function_name)) {
+            // ----- Error log
+            PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE, "Function '".$v_function_name."()' is not an existing function for option '".PclZipUtilOptionText($p_options_list[$i])."'");
+
+            // ----- Return
+            return PclZip::errorCode();
+          }
+
+          // ----- Set the attribute
+          $v_result_list[$p_options_list[$i]] = $v_function_name;
+          $i++;
+        break;
+
+        default :
+          // ----- Error log
+          PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER,
+		                       "Unknown parameter '"
+							   .$p_options_list[$i]."'");
+
+          // ----- Return
+          return PclZip::errorCode();
+      }
+
+      // ----- Next options
+      $i++;
+    }
+
+    // ----- Look for mandatory options
+    if ($v_requested_options !== false) {
+      for ($key=reset($v_requested_options); $key=key($v_requested_options); $key=next($v_requested_options)) {
+        // ----- Look for mandatory option
+        if ($v_requested_options[$key] == 'mandatory') {
+          // ----- Look if present
+          if (!isset($v_result_list[$key])) {
+            // ----- Error log
+            PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Missing mandatory parameter ".PclZipUtilOptionText($key)."(".$key.")");
+
+            // ----- Return
+            return PclZip::errorCode();
+          }
+        }
+      }
+    }
+    
+    // ----- Look for default values
+    if (!isset($v_result_list[PCLZIP_OPT_TEMP_FILE_THRESHOLD])) {
+      
+    }
+
+    // ----- Return
+    return $v_result;
+  }
+  // --------------------------------------------------------------------------------
+
+  // --------------------------------------------------------------------------------
+  // Function : privOptionDefaultThreshold()
+  // Description :
+  // Parameters :
+  // Return Values :
+  // --------------------------------------------------------------------------------
+  function privOptionDefaultThreshold(&$p_options)
+  {
+    $v_result=1;
+    
+    if (isset($p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD])
+        || isset($p_options[PCLZIP_OPT_TEMP_FILE_OFF])) {
+      return $v_result;
+    }
+    
+    // ----- Get 'memory_limit' configuration value
+    $v_memory_limit = ini_get('memory_limit');
+    $v_memory_limit = trim($v_memory_limit);
+    $last = strtolower(substr($v_memory_limit, -1));
+ 
+    if($last == 'g')
+        //$v_memory_limit = $v_memory_limit*1024*1024*1024;
+        $v_memory_limit = $v_memory_limit*1073741824;
+    if($last == 'm')
+        //$v_memory_limit = $v_memory_limit*1024*1024;
+        $v_memory_limit = $v_memory_limit*1048576;
+    if($last == 'k')
+        $v_memory_limit = $v_memory_limit*1024;
+            
+    $p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD] = floor($v_memory_limit*PCLZIP_TEMPORARY_FILE_RATIO);
+    
+
+    // ----- Sanity check : No threshold if value lower than 1M
+    if ($p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD] < 1048576) {
+      unset($p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD]);
+    }
+          
+    // ----- Return
+    return $v_result;
+  }
+  // --------------------------------------------------------------------------------
+
+  // --------------------------------------------------------------------------------
+  // Function : privFileDescrParseAtt()
+  // Description :
+  // Parameters :
+  // Return Values :
+  //   1 on success.
+  //   0 on failure.
+  // --------------------------------------------------------------------------------
+  function privFileDescrParseAtt(&$p_file_list, &$p_filedescr, $v_options, $v_requested_options=false)
+  {
+    $v_result=1;
+    
+    // ----- For each file in the list check the attributes
+    foreach ($p_file_list as $v_key => $v_value) {
+    
+      // ----- Check if the option is supported
+      if (!isset($v_requested_options[$v_key])) {
+        // ----- Error log
+        PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid file attribute '".$v_key."' for this file");
+
+        // ----- Return
+        return PclZip::errorCode();
+      }
+
+      // ----- Look for attribute
+      switch ($v_key) {
+        case PCLZIP_ATT_FILE_NAME :
+          if (!is_string($v_value)) {
+            PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid type ".gettype($v_value).". String expected for attribute '".PclZipUtilOptionText($v_key)."'");
+            return PclZip::errorCode();
+          }
+
+          $p_filedescr['filename'] = PclZipUtilPathReduction($v_value);
+          
+          if ($p_filedescr['filename'] == '') {
+            PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid empty filename for attribute '".PclZipUtilOptionText($v_key)."'");
+            return PclZip::errorCode();
+          }
+
+        break;
+
+        case PCLZIP_ATT_FILE_NEW_SHORT_NAME :
+          if (!is_string($v_value)) {
+            PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid type ".gettype($v_value).". String expected for attribute '".PclZipUtilOptionText($v_key)."'");
+            return PclZip::errorCode();
+          }
+
+          $p_filedescr['new_short_name'] = PclZipUtilPathReduction($v_value);
+
+          if ($p_filedescr['new_short_name'] == '') {
+            PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid empty short filename for attribute '".PclZipUtilOptionText($v_key)."'");
+            return PclZip::errorCode();
+          }
+        break;
+
+        case PCLZIP_ATT_FILE_NEW_FULL_NAME :
+          if (!is_string($v_value)) {
+            PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid type ".gettype($v_value).". String expected for attribute '".PclZipUtilOptionText($v_key)."'");
+            return PclZip::errorCode();
+          }
+
+          $p_filedescr['new_full_name'] = PclZipUtilPathReduction($v_value);
+
+          if ($p_filedescr['new_full_name'] == '') {
+            PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid empty full filename for attribute '".PclZipUtilOptionText($v_key)."'");
+            return PclZip::errorCode();
+          }
+        break;
+
+        // ----- Look for options that takes a string
+        case PCLZIP_ATT_FILE_COMMENT :
+          if (!is_string($v_value)) {
+            PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid type ".gettype($v_value).". String expected for attribute '".PclZipUtilOptionText($v_key)."'");
+            return PclZip::errorCode();
+          }
+
+          $p_filedescr['comment'] = $v_value;
+        break;
+
+        case PCLZIP_ATT_FILE_MTIME :
+          if (!is_integer($v_value)) {
+            PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid type ".gettype($v_value).". Integer expected for attribute '".PclZipUtilOptionText($v_key)."'");
+            return PclZip::errorCode();
+          }
+
+          $p_filedescr['mtime'] = $v_value;
+        break;
+
+        case PCLZIP_ATT_FILE_CONTENT :
+          $p_filedescr['content'] = $v_value;
+        break;
+
+        default :
+          // ----- Error log
+          PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER,
+		                           "Unknown parameter '".$v_key."'");
+
+          // ----- Return
+          return PclZip::errorCode();
+      }
+
+      // ----- Look for mandatory options
+      if ($v_requested_options !== false) {
+        for ($key=reset($v_requested_options); $key=key($v_requested_options); $key=next($v_requested_options)) {
+          // ----- Look for mandatory option
+          if ($v_requested_options[$key] == 'mandatory') {
+            // ----- Look if present
+            if (!isset($p_file_list[$key])) {
+              PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Missing mandatory parameter ".PclZipUtilOptionText($key)."(".$key.")");
+              return PclZip::errorCode();
+            }
+          }
+        }
+      }
+    
+    // end foreach
+    }
+    
+    // ----- Return
+    return $v_result;
+  }
+  // --------------------------------------------------------------------------------
+
+  // --------------------------------------------------------------------------------
+  // Function : privFileDescrExpand()
+  // Description :
+  //   This method look for each item of the list to see if its a file, a folder
+  //   or a string to be added as file. For any other type of files (link, other)
+  //   just ignore the item.
+  //   Then prepare the information that will be stored for that file.
+  //   When its a folder, expand the folder with all the files that are in that 
+  //   folder (recursively).
+  // Parameters :
+  // Return Values :
+  //   1 on success.
+  //   0 on failure.
+  // --------------------------------------------------------------------------------
+  function privFileDescrExpand(&$p_filedescr_list, &$p_options)
+  {
+    $v_result=1;
+    
+    // ----- Create a result list
+    $v_result_list = array();
+    
+    // ----- Look each entry
+    for ($i=0; $i<sizeof($p_filedescr_list); $i++) {
+      
+      // ----- Get filedescr
+      $v_descr = $p_filedescr_list[$i];
+      
+      // ----- Reduce the filename
+      $v_descr['filename'] = PclZipUtilTranslateWinPath($v_descr['filename'], false);
+      $v_descr['filename'] = PclZipUtilPathReduction($v_descr['filename']);
+      
+      // ----- Look for real file or folder
+      if (file_exists($v_descr['filename'])) {
+        if (@is_file($v_descr['filename'])) {
+          $v_descr['type'] = 'file';
+        }
+        else if (@is_dir($v_descr['filename'])) {
+          $v_descr['type'] = 'folder';
+        }
+        else if (@is_link($v_descr['filename'])) {
+          // skip
+          continue;
+        }
+        else {
+          // skip
+          continue;
+        }
+      }
+      
+      // ----- Look for string added as file
+      else if (isset($v_descr['content'])) {
+        $v_descr['type'] = 'virtual_file';
+      }
+      
+      // ----- Missing file
+      else {
+        // ----- Error log
+        PclZip::privErrorLog(PCLZIP_ERR_MISSING_FILE, "File '".$v_descr['filename']."' does not exist");
+
+        // ----- Return
+        return PclZip::errorCode();
+      }
+      
+      // ----- Calculate the stored filename
+      $this->privCalculateStoredFilename($v_descr, $p_options);
+      
+      // ----- Add the descriptor in result list
+      $v_result_list[sizeof($v_result_list)] = $v_descr;
+      
+      // ----- Look for folder
+      if ($v_descr['type'] == 'folder') {
+        // ----- List of items in folder
+        $v_dirlist_descr = array();
+        $v_dirlist_nb = 0;
+        if ($v_folder_handler = @opendir($v_descr['filename'])) {
+          while (($v_item_handler = @readdir($v_folder_handler)) !== false) {
+
+            // ----- Skip '.' and '..'
+            if (($v_item_handler == '.') || ($v_item_handler == '..')) {
+                continue;
+            }
+            
+            // ----- Compose the full filename
+            $v_dirlist_descr[$v_dirlist_nb]['filename'] = $v_descr['filename'].'/'.$v_item_handler;
+            
+            // ----- Look for different stored filename
+            // Because the name of the folder was changed, the name of the
+            // files/sub-folders also change
+            if (($v_descr['stored_filename'] != $v_descr['filename'])
+                 && (!isset($p_options[PCLZIP_OPT_REMOVE_ALL_PATH]))) {
+              if ($v_descr['stored_filename'] != '') {
+                $v_dirlist_descr[$v_dirlist_nb]['new_full_name'] = $v_descr['stored_filename'].'/'.$v_item_handler;
+              }
+              else {
+                $v_dirlist_descr[$v_dirlist_nb]['new_full_name'] = $v_item_handler;
+              }
+            }
+      
+            $v_dirlist_nb++;
+          }
+          
+          @closedir($v_folder_handler);
+        }
+        else {
+          // TBC : unable to open folder in read mode
+        }
+        
+        // ----- Expand each element of the list
+        if ($v_dirlist_nb != 0) {
+          // ----- Expand
+          if (($v_result = $this->privFileDescrExpand($v_dirlist_descr, $p_options)) != 1) {
+            return $v_result;
+          }
+          
+          // ----- Concat the resulting list
+          $v_result_list = array_merge($v_result_list, $v_dirlist_descr);
+        }
+        else {
+        }
+          
+        // ----- Free local array
+        unset($v_dirlist_descr);
+      }
+    }
+    
+    // ----- Get the result list
+    $p_filedescr_list = $v_result_list;
+
+    // ----- Return
+    return $v_result;
+  }
+  // --------------------------------------------------------------------------------
+
+  // --------------------------------------------------------------------------------
+  // Function : privCreate()
+  // Description :
+  // Parameters :
+  // Return Values :
+  // --------------------------------------------------------------------------------
+  function privCreate($p_filedescr_list, &$p_result_list, &$p_options)
+  {
+    $v_result=1;
+    $v_list_detail = array();
+    
+    // ----- Magic quotes trick
+    $this->privDisableMagicQuotes();
+
+    // ----- Open the file in write mode
+    if (($v_result = $this->privOpenFd('wb')) != 1)
+    {
+      // ----- Return
+      return $v_result;
+    }
+
+    // ----- Add the list of files
+    $v_result = $this->privAddList($p_filedescr_list, $p_result_list, $p_options);
+
+    // ----- Close
+    $this->privCloseFd();
+
+    // ----- Magic quotes trick
+    $this->privSwapBackMagicQuotes();
+
+    // ----- Return
+    return $v_result;
+  }
+  // --------------------------------------------------------------------------------
+
+  // --------------------------------------------------------------------------------
+  // Function : privAdd()
+  // Description :
+  // Parameters :
+  // Return Values :
+  // --------------------------------------------------------------------------------
+  function privAdd($p_filedescr_list, &$p_result_list, &$p_options)
+  {
+    $v_result=1;
+    $v_list_detail = array();
+
+    // ----- Look if the archive exists or is empty
+    if ((!is_file($this->zipname)) || (filesize($this->zipname) == 0))
+    {
+
+      // ----- Do a create
+      $v_result = $this->privCreate($p_filedescr_list, $p_result_list, $p_options);
+
+      // ----- Return
+      return $v_result;
+    }
+    // ----- Magic quotes trick
+    $this->privDisableMagicQuotes();
+
+    // ----- Open the zip file
+    if (($v_result=$this->privOpenFd('rb')) != 1)
+    {
+      // ----- Magic quotes trick
+      $this->privSwapBackMagicQuotes();
+
+      // ----- Return
+      return $v_result;
+    }
+
+    // ----- Read the central directory informations
+    $v_central_dir = array();
+    if (($v_result = $this->privReadEndCentralDir($v_central_dir)) != 1)
+    {
+      $this->privCloseFd();
+      $this->privSwapBackMagicQuotes();
+      return $v_result;
+    }
+
+    // ----- Go to beginning of File
+    @rewind($this->zip_fd);
+
+    // ----- Creates a temporay file
+    $v_zip_temp_name = PCLZIP_TEMPORARY_DIR.uniqid('pclzip-').'.tmp';
+
+    // ----- Open the temporary file in write mode
+    if (($v_zip_temp_fd = @fopen($v_zip_temp_name, 'wb')) == 0)
+    {
+      $this->privCloseFd();
+      $this->privSwapBackMagicQuotes();
+
+      PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open temporary file \''.$v_zip_temp_name.'\' in binary write mode');
+
+      // ----- Return
+      return PclZip::errorCode();
+    }
+
+    // ----- Copy the files from the archive to the temporary file
+    // TBC : Here I should better append the file and go back to erase the central dir
+    $v_size = $v_central_dir['offset'];
+    while ($v_size != 0)
+    {
+      $v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE);
+      $v_buffer = fread($this->zip_fd, $v_read_size);
+      @fwrite($v_zip_temp_fd, $v_buffer, $v_read_size);
+      $v_size -= $v_read_size;
+    }
+
+    // ----- Swap the file descriptor
+    // Here is a trick : I swap the temporary fd with the zip fd, in order to use
+    // the following methods on the temporary fil and not the real archive
+    $v_swap = $this->zip_fd;
+    $this->zip_fd = $v_zip_temp_fd;
+    $v_zip_temp_fd = $v_swap;
+
+    // ----- Add the files
+    $v_header_list = array();
+    if (($v_result = $this->privAddFileList($p_filedescr_list, $v_header_list, $p_options)) != 1)
+    {
+      fclose($v_zip_temp_fd);
+      $this->privCloseFd();
+      @unlink($v_zip_temp_name);
+      $this->privSwapBackMagicQuotes();
+
+      // ----- Return
+      return $v_result;
+    }
+
+    // ----- Store the offset of the central dir
+    $v_offset = @ftell($this->zip_fd);
+
+    // ----- Copy the block of file headers from the old archive
+    $v_size = $v_central_dir['size'];
+    while ($v_size != 0)
+    {
+      $v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE);
+      $v_buffer = @fread($v_zip_temp_fd, $v_read_size);
+      @fwrite($this->zip_fd, $v_buffer, $v_read_size);
+      $v_size -= $v_read_size;
+    }
+
+    // ----- Create the Central Dir files header
+    for ($i=0, $v_count=0; $i<sizeof($v_header_list); $i++)
+    {
+      // ----- Create the file header
+      if ($v_header_list[$i]['status'] == 'ok') {
+        if (($v_result = $this->privWriteCentralFileHeader($v_header_list[$i])) != 1) {
+          fclose($v_zip_temp_fd);
+          $this->privCloseFd();
+          @unlink($v_zip_temp_name);
+          $this->privSwapBackMagicQuotes();
+
+          // ----- Return
+          return $v_result;
+        }
+        $v_count++;
+      }
+
+      // ----- Transform the header to a 'usable' info
+      $this->privConvertHeader2FileInfo($v_header_list[$i], $p_result_list[$i]);
+    }
+
+    // ----- Zip file comment
+    $v_comment = $v_central_dir['comment'];
+    if (isset($p_options[PCLZIP_OPT_COMMENT])) {
+      $v_comment = $p_options[PCLZIP_OPT_COMMENT];
+    }
+    if (isset($p_options[PCLZIP_OPT_ADD_COMMENT])) {
+      $v_comment = $v_comment.$p_options[PCLZIP_OPT_ADD_COMMENT];
+    }
+    if (isset($p_options[PCLZIP_OPT_PREPEND_COMMENT])) {
+      $v_comment = $p_options[PCLZIP_OPT_PREPEND_COMMENT].$v_comment;
+    }
+
+    // ----- Calculate the size of the central header
+    $v_size = @ftell($this->zip_fd)-$v_offset;
+
+    // ----- Create the central dir footer
+    if (($v_result = $this->privWriteCentralHeader($v_count+$v_central_dir['entries'], $v_size, $v_offset, $v_comment)) != 1)
+    {
+      // ----- Reset the file list
+      unset($v_header_list);
+      $this->privSwapBackMagicQuotes();
+
+      // ----- Return
+      return $v_result;
+    }
+
+    // ----- Swap back the file descriptor
+    $v_swap = $this->zip_fd;
+    $this->zip_fd = $v_zip_temp_fd;
+    $v_zip_temp_fd = $v_swap;
+
+    // ----- Close
+    $this->privCloseFd();
+
+    // ----- Close the temporary file
+    @fclose($v_zip_temp_fd);
+
+    // ----- Magic quotes trick
+    $this->privSwapBackMagicQuotes();
+
+    // ----- Delete the zip file
+    // TBC : I should test the result ...
+    @unlink($this->zipname);
+
+    // ----- Rename the temporary file
+    // TBC : I should test the result ...
+    //@rename($v_zip_temp_name, $this->zipname);
+    PclZipUtilRename($v_zip_temp_name, $this->zipname);
+
+    // ----- Return
+    return $v_result;
+  }
+  // --------------------------------------------------------------------------------
+
+  // --------------------------------------------------------------------------------
+  // Function : privOpenFd()
+  // Description :
+  // Parameters :
+  // --------------------------------------------------------------------------------
+  function privOpenFd($p_mode)
+  {
+    $v_result=1;
+
+    // ----- Look if already open
+    if ($this->zip_fd != 0)
+    {
+      // ----- Error log
+      PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Zip file \''.$this->zipname.'\' already open');
+
+      // ----- Return
+      return PclZip::errorCode();
+    }
+
+    // ----- Open the zip file
+    if (($this->zip_fd = @fopen($this->zipname, $p_mode)) == 0)
+    {
+      // ----- Error log
+      PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open archive \''.$this->zipname.'\' in '.$p_mode.' mode');
+
+      // ----- Return
+      return PclZip::errorCode();
+    }
+
+    // ----- Return
+    return $v_result;
+  }
+  // --------------------------------------------------------------------------------
+
+  // --------------------------------------------------------------------------------
+  // Function : privCloseFd()
+  // Description :
+  // Parameters :
+  // --------------------------------------------------------------------------------
+  function privCloseFd()
+  {
+    $v_result=1;
+
+    if ($this->zip_fd != 0)
+      @fclose($this->zip_fd);
+    $this->zip_fd = 0;
+
+    // ----- Return
+    return $v_result;
+  }
+  // --------------------------------------------------------------------------------
+
+  // --------------------------------------------------------------------------------
+  // Function : privAddList()
+  // Description :
+  //   $p_add_dir and $p_remove_dir will give the ability to memorize a path which is
+  //   different from the real path of the file. This is usefull if you want to have PclTar
+  //   running in any directory, and memorize relative path from an other directory.
+  // Parameters :
+  //   $p_list : An array containing the file or directory names to add in the tar
+  //   $p_result_list : list of added files with their properties (specially the status field)
+  //   $p_add_dir : Path to add in the filename path archived
+  //   $p_remove_dir : Path to remove in the filename path archived
+  // Return Values :
+  // --------------------------------------------------------------------------------
+//  function privAddList($p_list, &$p_result_list, $p_add_dir, $p_remove_dir, $p_remove_all_dir, &$p_options)
+  function privAddList($p_filedescr_list, &$p_result_list, &$p_options)
+  {
+    $v_result=1;
+
+    // ----- Add the files
+    $v_header_list = array();
+    if (($v_result = $this->privAddFileList($p_filedescr_list, $v_header_list, $p_options)) != 1)
+    {
+      // ----- Return
+      return $v_result;
+    }
+
+    // ----- Store the offset of the central dir
+    $v_offset = @ftell($this->zip_fd);
+
+    // ----- Create the Central Dir files header
+    for ($i=0,$v_count=0; $i<sizeof($v_header_list); $i++)
+    {
+      // ----- Create the file header
+      if ($v_header_list[$i]['status'] == 'ok') {
+        if (($v_result = $this->privWriteCentralFileHeader($v_header_list[$i])) != 1) {
+          // ----- Return
+          return $v_result;
+        }
+        $v_count++;
+      }
+
+      // ----- Transform the header to a 'usable' info
+      $this->privConvertHeader2FileInfo($v_header_list[$i], $p_result_list[$i]);
+    }
+
+    // ----- Zip file comment
+    $v_comment = '';
+    if (isset($p_options[PCLZIP_OPT_COMMENT])) {
+      $v_comment = $p_options[PCLZIP_OPT_COMMENT];
+    }
+
+    // ----- Calculate the size of the central header
+    $v_size = @ftell($this->zip_fd)-$v_offset;
+
+    // ----- Create the central dir footer
+    if (($v_result = $this->privWriteCentralHeader($v_count, $v_size, $v_offset, $v_comment)) != 1)
+    {
+      // ----- Reset the file list
+      unset($v_header_list);
+
+      // ----- Return
+      return $v_result;
+    }
+
+    // ----- Return
+    return $v_result;
+  }
+  // --------------------------------------------------------------------------------
+
+  // --------------------------------------------------------------------------------
+  // Function : privAddFileList()
+  // Description :
+  // Parameters :
+  //   $p_filedescr_list : An array containing the file description 
+  //                      or directory names to add in the zip
+  //   $p_result_list : list of added files with their properties (specially the status field)
+  // Return Values :
+  // --------------------------------------------------------------------------------
+  function privAddFileList($p_filedescr_list, &$p_result_list, &$p_options)
+  {
+    $v_result=1;
+    $v_header = array();
+
+    // ----- Recuperate the current number of elt in list
+    $v_nb = sizeof($p_result_list);
+
+    // ----- Loop on the files
+    for ($j=0; ($j<sizeof($p_filedescr_list)) && ($v_result==1); $j++) {
+      // ----- Format the filename
+      $p_filedescr_list[$j]['filename']
+      = PclZipUtilTranslateWinPath($p_filedescr_list[$j]['filename'], false);
+      
+
+      // ----- Skip empty file names
+      // TBC : Can this be possible ? not checked in DescrParseAtt ?
+      if ($p_filedescr_list[$j]['filename'] == "") {
+        continue;
+      }
+
+      // ----- Check the filename
+      if (   ($p_filedescr_list[$j]['type'] != 'virtual_file')
+          && (!file_exists($p_filedescr_list[$j]['filename']))) {
+        PclZip::privErrorLog(PCLZIP_ERR_MISSING_FILE, "File '".$p_filedescr_list[$j]['filename']."' does not exist");
+        return PclZip::errorCode();
+      }
+
+      // ----- Look if it is a file or a dir with no all path remove option
+      // or a dir with all its path removed
+//      if (   (is_file($p_filedescr_list[$j]['filename']))
+//          || (   is_dir($p_filedescr_list[$j]['filename'])
+      if (   ($p_filedescr_list[$j]['type'] == 'file')
+          || ($p_filedescr_list[$j]['type'] == 'virtual_file')
+          || (   ($p_filedescr_list[$j]['type'] == 'folder')
+              && (   !isset($p_options[PCLZIP_OPT_REMOVE_ALL_PATH])
+                  || !$p_options[PCLZIP_OPT_REMOVE_ALL_PATH]))
+          ) {
+
+        // ----- Add the file
+        $v_result = $this->privAddFile($p_filedescr_list[$j], $v_header,
+                                       $p_options);
+        if ($v_result != 1) {
+          return $v_result;
+        }
+
+        // ----- Store the file infos
+        $p_result_list[$v_nb++] = $v_header;
+      }
+    }
+
+    // ----- Return
+    return $v_result;
+  }
+  // --------------------------------------------------------------------------------
+
+  // --------------------------------------------------------------------------------
+  // Function : privAddFile()
+  // Description :
+  // Parameters :
+  // Return Values :
+  // --------------------------------------------------------------------------------
+  function privAddFile($p_filedescr, &$p_header, &$p_options)
+  {
+    $v_result=1;
+    
+    // ----- Working variable
+    $p_filename = $p_filedescr['filename'];
+
+    // TBC : Already done in the fileAtt check ... ?
+    if ($p_filename == "") {
+      // ----- Error log
+      PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid file list parameter (invalid or empty list)");
+
+      // ----- Return
+      return PclZip::errorCode();
+    }
+  
+    // ----- Look for a stored different filename 
+    /* TBC : Removed
+    if (isset($p_filedescr['stored_filename'])) {
+      $v_stored_filename = $p_filedescr['stored_filename'];
+    }
+    else {
+      $v_stored_filename = $p_filedescr['stored_filename'];
+    }
+    */
+
+    // ----- Set the file properties
+    clearstatcache();
+    $p_header['version'] = 20;
+    $p_header['version_extracted'] = 10;
+    $p_header['flag'] = 0;
+    $p_header['compression'] = 0;
+    $p_header['crc'] = 0;
+    $p_header['compressed_size'] = 0;
+    $p_header['filename_len'] = strlen($p_filename);
+    $p_header['extra_len'] = 0;
+    $p_header['disk'] = 0;
+    $p_header['internal'] = 0;
+    $p_header['offset'] = 0;
+    $p_header['filename'] = $p_filename;
+// TBC : Removed    $p_header['stored_filename'] = $v_stored_filename;
+    $p_header['stored_filename'] = $p_filedescr['stored_filename'];
+    $p_header['extra'] = '';
+    $p_header['status'] = 'ok';
+    $p_header['index'] = -1;
+
+    // ----- Look for regular file
+    if ($p_filedescr['type']=='file') {
+      $p_header['external'] = 0x00000000;
+      $p_header['size'] = filesize($p_filename);
+    }
+    
+    // ----- Look for regular folder
+    else if ($p_filedescr['type']=='folder') {
+      $p_header['external'] = 0x00000010;
+      $p_header['mtime'] = filemtime($p_filename);
+      $p_header['size'] = filesize($p_filename);
+    }
+    
+    // ----- Look for virtual file
+    else if ($p_filedescr['type'] == 'virtual_file') {
+      $p_header['external'] = 0x00000000;
+      $p_header['size'] = strlen($p_filedescr['content']);
+    }
+    
+
+    // ----- Look for filetime
+    if (isset($p_filedescr['mtime'])) {
+      $p_header['mtime'] = $p_filedescr['mtime'];
+    }
+    else if ($p_filedescr['type'] == 'virtual_file') {
+      $p_header['mtime'] = time();
+    }
+    else {
+      $p_header['mtime'] = filemtime($p_filename);
+    }
+
+    // ------ Look for file comment
+    if (isset($p_filedescr['comment'])) {
+      $p_header['comment_len'] = strlen($p_filedescr['comment']);
+      $p_header['comment'] = $p_filedescr['comment'];
+    }
+    else {
+      $p_header['comment_len'] = 0;
+      $p_header['comment'] = '';
+    }
+
+    // ----- Look for pre-add callback
+    if (isset($p_options[PCLZIP_CB_PRE_ADD])) {
+
+      // ----- Generate a local information
+      $v_local_header = array();
+      $this->privConvertHeader2FileInfo($p_header, $v_local_header);
+
+      // ----- Call the callback
+      // Here I do not use call_user_func() because I need to send a reference to the
+      // header.
+//      eval('$v_result = '.$p_options[PCLZIP_CB_PRE_ADD].'(PCLZIP_CB_PRE_ADD, $v_local_header);');
+      $v_result = $p_options[PCLZIP_CB_PRE_ADD](PCLZIP_CB_PRE_ADD, $v_local_header);
+      if ($v_result == 0) {
+        // ----- Change the file status
+        $p_header['status'] = "skipped";
+        $v_result = 1;
+      }
+
+      // ----- Update the informations
+      // Only some fields can be modified
+      if ($p_header['stored_filename'] != $v_local_header['stored_filename']) {
+        $p_header['stored_filename'] = PclZipUtilPathReduction($v_local_header['stored_filename']);
+      }
+    }
+
+    // ----- Look for empty stored filename
+    if ($p_header['stored_filename'] == "") {
+      $p_header['status'] = "filtered";
+    }
+    
+    // ----- Check the path length
+    if (strlen($p_header['stored_filename']) > 0xFF) {
+      $p_header['status'] = 'filename_too_long';
+    }
+
+    // ----- Look if no error, or file not skipped
+    if ($p_header['status'] == 'ok') {
+
+      // ----- Look for a file
+      if ($p_filedescr['type'] == 'file') {
+        // ----- Look for using temporary file to zip
+        if ( (!isset($p_options[PCLZIP_OPT_TEMP_FILE_OFF])) 
+            && (isset($p_options[PCLZIP_OPT_TEMP_FILE_ON])
+                || (isset($p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD])
+                    && ($p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD] <= $p_header['size'])) ) ) {
+          $v_result = $this->privAddFileUsingTempFile($p_filedescr, $p_header, $p_options);
+          if ($v_result < PCLZIP_ERR_NO_ERROR) {
+            return $v_result;
+          }
+        }
+        
+        // ----- Use "in memory" zip algo
+        else {
+
+        // ----- Open the source file
+        if (($v_file = @fopen($p_filename, "rb")) == 0) {
+          PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, "Unable to open file '$p_filename' in binary read mode");
+          return PclZip::errorCode();
+        }
+
+        // ----- Read the file content
+        $v_content = @fread($v_file, $p_header['size']);
+
+        // ----- Close the file
+        @fclose($v_file);
+
+        // ----- Calculate the CRC
+        $p_header['crc'] = @crc32($v_content);
+        
+        // ----- Look for no compression
+        if ($p_options[PCLZIP_OPT_NO_COMPRESSION]) {
+          // ----- Set header parameters
+          $p_header['compressed_size'] = $p_header['size'];
+          $p_header['compression'] = 0;
+        }
+        
+        // ----- Look for normal compression
+        else {
+          // ----- Compress the content
+          $v_content = @gzdeflate($v_content);
+
+          // ----- Set header parameters
+          $p_header['compressed_size'] = strlen($v_content);
+          $p_header['compression'] = 8;
+        }
+        
+        // ----- Call the header generation
+        if (($v_result = $this->privWriteFileHeader($p_header)) != 1) {
+          @fclose($v_file);
+          return $v_result;
+        }
+
+        // ----- Write the compressed (or not) content
+        @fwrite($this->zip_fd, $v_content, $p_header['compressed_size']);
+
+        }
+
+      }
+
+      // ----- Look for a virtual file (a file from string)
+      else if ($p_filedescr['type'] == 'virtual_file') {
+          
+        $v_content = $p_filedescr['content'];
+
+        // ----- Calculate the CRC
+        $p_header['crc'] = @crc32($v_content);
+        
+        // ----- Look for no compression
+        if ($p_options[PCLZIP_OPT_NO_COMPRESSION]) {
+          // ----- Set header parameters
+          $p_header['compressed_size'] = $p_header['size'];
+          $p_header['compression'] = 0;
+        }
+        
+        // ----- Look for normal compression
+        else {
+          // ----- Compress the content
+          $v_content = @gzdeflate($v_content);
+
+          // ----- Set header parameters
+          $p_header['compressed_size'] = strlen($v_content);
+          $p_header['compression'] = 8;
+        }
+        
+        // ----- Call the header generation
+        if (($v_result = $this->privWriteFileHeader($p_header)) != 1) {
+          @fclose($v_file);
+          return $v_result;
+        }
+
+        // ----- Write the compressed (or not) content
+        @fwrite($this->zip_fd, $v_content, $p_header['compressed_size']);
+      }
+
+      // ----- Look for a directory
+      else if ($p_filedescr['type'] == 'folder') {
+        // ----- Look for directory last '/'
+        if (@substr($p_header['stored_filename'], -1) != '/') {
+          $p_header['stored_filename'] .= '/';
+        }
+
+        // ----- Set the file properties
+        $p_header['size'] = 0;
+        //$p_header['external'] = 0x41FF0010;   // Value for a folder : to be checked
+        $p_header['external'] = 0x00000010;   // Value for a folder : to be checked
+
+        // ----- Call the header generation
+        if (($v_result = $this->privWriteFileHeader($p_header)) != 1)
+        {
+          return $v_result;
+        }
+      }
+    }
+
+    // ----- Look for post-add callback
+    if (isset($p_options[PCLZIP_CB_POST_ADD])) {
+
+      // ----- Generate a local information
+      $v_local_header = array();
+      $this->privConvertHeader2FileInfo($p_header, $v_local_header);
+
+      // ----- Call the callback
+      // Here I do not use call_user_func() because I need to send a reference to the
+      // header.
+//      eval('$v_result = '.$p_options[PCLZIP_CB_POST_ADD].'(PCLZIP_CB_POST_ADD, $v_local_header);');
+      $v_result = $p_options[PCLZIP_CB_POST_ADD](PCLZIP_CB_POST_ADD, $v_local_header);
+      if ($v_result == 0) {
+        // ----- Ignored
+        $v_result = 1;
+      }
+
+      // ----- Update the informations
+      // Nothing can be modified
+    }
+
+    // ----- Return
+    return $v_result;
+  }
+  // --------------------------------------------------------------------------------
+
+  // --------------------------------------------------------------------------------
+  // Function : privAddFileUsingTempFile()
+  // Description :
+  // Parameters :
+  // Return Values :
+  // --------------------------------------------------------------------------------
+  function privAddFileUsingTempFile($p_filedescr, &$p_header, &$p_options)
+  {
+    $v_result=PCLZIP_ERR_NO_ERROR;
+    
+    // ----- Working variable
+    $p_filename = $p_filedescr['filename'];
+
+
+    // ----- Open the source file
+    if (($v_file = @fopen($p_filename, "rb")) == 0) {
+      PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, "Unable to open file '$p_filename' in binary read mode");
+      return PclZip::errorCode();
+    }
+
+    // ----- Creates a compressed temporary file
+    $v_gzip_temp_name = PCLZIP_TEMPORARY_DIR.uniqid('pclzip-').'.gz';
+    if (($v_file_compressed = @gzopen($v_gzip_temp_name, "wb")) == 0) {
+      fclose($v_file);
+      PclZip::privErrorLog(PCLZIP_ERR_WRITE_OPEN_FAIL, 'Unable to open temporary file \''.$v_gzip_temp_name.'\' in binary write mode');
+      return PclZip::errorCode();
+    }
+
+    // ----- Read the file by PCLZIP_READ_BLOCK_SIZE octets blocks
+    $v_size = filesize($p_filename);
+    while ($v_size != 0) {
+      $v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE);
+      $v_buffer = @fread($v_file, $v_read_size);
+      //$v_binary_data = pack('a'.$v_read_size, $v_buffer);
+      @gzputs($v_file_compressed, $v_buffer, $v_read_size);
+      $v_size -= $v_read_size;
+    }
+
+    // ----- Close the file
+    @fclose($v_file);
+    @gzclose($v_file_compressed);
+
+    // ----- Check the minimum file size
+    if (filesize($v_gzip_temp_name) < 18) {
+      PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, 'gzip temporary file \''.$v_gzip_temp_name.'\' has invalid filesize - should be minimum 18 bytes');
+      return PclZip::errorCode();
+    }
+
+    // ----- Extract the compressed attributes
+    if (($v_file_compressed = @fopen($v_gzip_temp_name, "rb")) == 0) {
+      PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open temporary file \''.$v_gzip_temp_name.'\' in binary read mode');
+      return PclZip::errorCode();
+    }
+
+    // ----- Read the gzip file header
+    $v_binary_data = @fread($v_file_compressed, 10);
+    $v_data_header = unpack('a1id1/a1id2/a1cm/a1flag/Vmtime/a1xfl/a1os', $v_binary_data);
+
+    // ----- Check some parameters
+    $v_data_header['os'] = bin2hex($v_data_header['os']);
+
+    // ----- Read the gzip file footer
+    @fseek($v_file_compressed, filesize($v_gzip_temp_name)-8);
+    $v_binary_data = @fread($v_file_compressed, 8);
+    $v_data_footer = unpack('Vcrc/Vcompressed_size', $v_binary_data);
+
+    // ----- Set the attributes
+    $p_header['compression'] = ord($v_data_header['cm']);
+    //$p_header['mtime'] = $v_data_header['mtime'];
+    $p_header['crc'] = $v_data_footer['crc'];
+    $p_header['compressed_size'] = filesize($v_gzip_temp_name)-18;
+
+    // ----- Close the file
+    @fclose($v_file_compressed);
+
+    // ----- Call the header generation
+    if (($v_result = $this->privWriteFileHeader($p_header)) != 1) {
+      return $v_result;
+    }
+
+    // ----- Add the compressed data
+    if (($v_file_compressed = @fopen($v_gzip_temp_name, "rb")) == 0)
+    {
+      PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open temporary file \''.$v_gzip_temp_name.'\' in binary read mode');
+      return PclZip::errorCode();
+    }
+
+    // ----- Read the file by PCLZIP_READ_BLOCK_SIZE octets blocks
+    fseek($v_file_compressed, 10);
+    $v_size = $p_header['compressed_size'];
+    while ($v_size != 0)
+    {
+      $v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE);
+      $v_buffer = @fread($v_file_compressed, $v_read_size);
+      //$v_binary_data = pack('a'.$v_read_size, $v_buffer);
+      @fwrite($this->zip_fd, $v_buffer, $v_read_size);
+      $v_size -= $v_read_size;
+    }
+
+    // ----- Close the file
+    @fclose($v_file_compressed);
+
+    // ----- Unlink the temporary file
+    @unlink($v_gzip_temp_name);
+    
+    // ----- Return
+    return $v_result;
+  }
+  // --------------------------------------------------------------------------------
+
+  // --------------------------------------------------------------------------------
+  // Function : privCalculateStoredFilename()
+  // Description :
+  //   Based on file descriptor properties and global options, this method
+  //   calculate the filename that will be stored in the archive.
+  // Parameters :
+  // Return Values :
+  // --------------------------------------------------------------------------------
+  function privCalculateStoredFilename(&$p_filedescr, &$p_options)
+  {
+    $v_result=1;
+    
+    // ----- Working variables
+    $p_filename = $p_filedescr['filename'];
+    if (isset($p_options[PCLZIP_OPT_ADD_PATH])) {
+      $p_add_dir = $p_options[PCLZIP_OPT_ADD_PATH];
+    }
+    else {
+      $p_add_dir = '';
+    }
+    if (isset($p_options[PCLZIP_OPT_REMOVE_PATH])) {
+      $p_remove_dir = $p_options[PCLZIP_OPT_REMOVE_PATH];
+    }
+    else {
+      $p_remove_dir = '';
+    }
+    if (isset($p_options[PCLZIP_OPT_REMOVE_ALL_PATH])) {
+      $p_remove_all_dir = $p_options[PCLZIP_OPT_REMOVE_ALL_PATH];
+    }
+    else {
+      $p_remove_all_dir = 0;
+    }
+
+
+    // ----- Look for full name change
+    if (isset($p_filedescr['new_full_name'])) {
+      // ----- Remove drive letter if any
+      $v_stored_filename = PclZipUtilTranslateWinPath($p_filedescr['new_full_name']);
+    }
+    
+    // ----- Look for path and/or short name change
+    else {
+
+      // ----- Look for short name change
+      // Its when we cahnge just the filename but not the path
+      if (isset($p_filedescr['new_short_name'])) {
+        $v_path_info = pathinfo($p_filename);
+        $v_dir = '';
+        if ($v_path_info['dirname'] != '') {
+          $v_dir = $v_path_info['dirname'].'/';
+        }
+        $v_stored_filename = $v_dir.$p_filedescr['new_short_name'];
+      }
+      else {
+        // ----- Calculate the stored filename
+        $v_stored_filename = $p_filename;
+      }
+
+      // ----- Look for all path to remove
+      if ($p_remove_all_dir) {
+        $v_stored_filename = basename($p_filename);
+      }
+      // ----- Look for partial path remove
+      else if ($p_remove_dir != "") {
+        if (substr($p_remove_dir, -1) != '/')
+          $p_remove_dir .= "/";
+
+        if (   (substr($p_filename, 0, 2) == "./")
+            || (substr($p_remove_dir, 0, 2) == "./")) {
+            
+          if (   (substr($p_filename, 0, 2) == "./")
+              && (substr($p_remove_dir, 0, 2) != "./")) {
+            $p_remove_dir = "./".$p_remove_dir;
+          }
+          if (   (substr($p_filename, 0, 2) != "./")
+              && (substr($p_remove_dir, 0, 2) == "./")) {
+            $p_remove_dir = substr($p_remove_dir, 2);
+          }
+        }
+
+        $v_compare = PclZipUtilPathInclusion($p_remove_dir,
+                                             $v_stored_filename);
+        if ($v_compare > 0) {
+          if ($v_compare == 2) {
+            $v_stored_filename = "";
+          }
+          else {
+            $v_stored_filename = substr($v_stored_filename,
+                                        strlen($p_remove_dir));
+          }
+        }
+      }
+      
+      // ----- Remove drive letter if any
+      $v_stored_filename = PclZipUtilTranslateWinPath($v_stored_filename);
+      
+      // ----- Look for path to add
+      if ($p_add_dir != "") {
+        if (substr($p_add_dir, -1) == "/")
+          $v_stored_filename = $p_add_dir.$v_stored_filename;
+        else
+          $v_stored_filename = $p_add_dir."/".$v_stored_filename;
+      }
+    }
+
+    // ----- Filename (reduce the path of stored name)
+    $v_stored_filename = PclZipUtilPathReduction($v_stored_filename);
+    $p_filedescr['stored_filename'] = $v_stored_filename;
+    
+    // ----- Return
+    return $v_result;
+  }
+  // --------------------------------------------------------------------------------
+
+  // --------------------------------------------------------------------------------
+  // Function : privWriteFileHeader()
+  // Description :
+  // Parameters :
+  // Return Values :
+  // --------------------------------------------------------------------------------
+  function privWriteFileHeader(&$p_header)
+  {
+    $v_result=1;
+
+    // ----- Store the offset position of the file
+    $p_header['offset'] = ftell($this->zip_fd);
+
+    // ----- Transform UNIX mtime to DOS format mdate/mtime
+    $v_date = getdate($p_header['mtime']);
+    $v_mtime = ($v_date['hours']<<11) + ($v_date['minutes']<<5) + $v_date['seconds']/2;
+    $v_mdate = (($v_date['year']-1980)<<9) + ($v_date['mon']<<5) + $v_date['mday'];
+
+    // ----- Packed data
+    $v_binary_data = pack("VvvvvvVVVvv", 0x04034b50,
+	                      $p_header['version_extracted'], $p_header['flag'],
+                          $p_header['compression'], $v_mtime, $v_mdate,
+                          $p_header['crc'], $p_header['compressed_size'],
+						  $p_header['size'],
+                          strlen($p_header['stored_filename']),
+						  $p_header['extra_len']);
+
+    // ----- Write the first 148 bytes of the header in the archive
+    fputs($this->zip_fd, $v_binary_data, 30);
+
+    // ----- Write the variable fields
+    if (strlen($p_header['stored_filename']) != 0)
+    {
+      fputs($this->zip_fd, $p_header['stored_filename'], strlen($p_header['stored_filename']));
+    }
+    if ($p_header['extra_len'] != 0)
+    {
+      fputs($this->zip_fd, $p_header['extra'], $p_header['extra_len']);
+    }
+
+    // ----- Return
+    return $v_result;
+  }
+  // --------------------------------------------------------------------------------
+
+  // --------------------------------------------------------------------------------
+  // Function : privWriteCentralFileHeader()
+  // Description :
+  // Parameters :
+  // Return Values :
+  // --------------------------------------------------------------------------------
+  function privWriteCentralFileHeader(&$p_header)
+  {
+    $v_result=1;
+
+    // TBC
+    //for(reset($p_header); $key = key($p_header); next($p_header)) {
+    //}
+
+    // ----- Transform UNIX mtime to DOS format mdate/mtime
+    $v_date = getdate($p_header['mtime']);
+    $v_mtime = ($v_date['hours']<<11) + ($v_date['minutes']<<5) + $v_date['seconds']/2;
+    $v_mdate = (($v_date['year']-1980)<<9) + ($v_date['mon']<<5) + $v_date['mday'];
+
+
+    // ----- Packed data
+    $v_binary_data = pack("VvvvvvvVVVvvvvvVV", 0x02014b50,
+	                      $p_header['version'], $p_header['version_extracted'],
+                          $p_header['flag'], $p_header['compression'],
+						  $v_mtime, $v_mdate, $p_header['crc'],
+                          $p_header['compressed_size'], $p_header['size'],
+                          strlen($p_header['stored_filename']),
+						  $p_header['extra_len'], $p_header['comment_len'],
+                          $p_header['disk'], $p_header['internal'],
+						  $p_header['external'], $p_header['offset']);
+
+    // ----- Write the 42 bytes of the header in the zip file
+    fputs($this->zip_fd, $v_binary_data, 46);
+
+    // ----- Write the variable fields
+    if (strlen($p_header['stored_filename']) != 0)
+    {
+      fputs($this->zip_fd, $p_header['stored_filename'], strlen($p_header['stored_filename']));
+    }
+    if ($p_header['extra_len'] != 0)
+    {
+      fputs($this->zip_fd, $p_header['extra'], $p_header['extra_len']);
+    }
+    if ($p_header['comment_len'] != 0)
+    {
+      fputs($this->zip_fd, $p_header['comment'], $p_header['comment_len']);
+    }
+
+    // ----- Return
+    return $v_result;
+  }
+  // --------------------------------------------------------------------------------
+
+  // --------------------------------------------------------------------------------
+  // Function : privWriteCentralHeader()
+  // Description :
+  // Parameters :
+  // Return Values :
+  // --------------------------------------------------------------------------------
+  function privWriteCentralHeader($p_nb_entries, $p_size, $p_offset, $p_comment)
+  {
+    $v_result=1;
+
+    // ----- Packed data
+    $v_binary_data = pack("VvvvvVVv", 0x06054b50, 0, 0, $p_nb_entries,
+	                      $p_nb_entries, $p_size,
+						  $p_offset, strlen($p_comment));
+
+    // ----- Write the 22 bytes of the header in the zip file
+    fputs($this->zip_fd, $v_binary_data, 22);
+
+    // ----- Write the variable fields
+    if (strlen($p_comment) != 0)
+    {
+      fputs($this->zip_fd, $p_comment, strlen($p_comment));
+    }
+
+    // ----- Return
+    return $v_result;
+  }
+  // --------------------------------------------------------------------------------
+
+  // --------------------------------------------------------------------------------
+  // Function : privList()
+  // Description :
+  // Parameters :
+  // Return Values :
+  // --------------------------------------------------------------------------------
+  function privList(&$p_list)
+  {
+    $v_result=1;
+
+    // ----- Magic quotes trick
+    $this->privDisableMagicQuotes();
+
+    // ----- Open the zip file
+    if (($this->zip_fd = @fopen($this->zipname, 'rb')) == 0)
+    {
+      // ----- Magic quotes trick
+      $this->privSwapBackMagicQuotes();
+      
+      // ----- Error log
+      PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open archive \''.$this->zipname.'\' in binary read mode');
+
+      // ----- Return
+      return PclZip::errorCode();
+    }
+
+    // ----- Read the central directory informations
+    $v_central_dir = array();
+    if (($v_result = $this->privReadEndCentralDir($v_central_dir)) != 1)
+    {
+      $this->privSwapBackMagicQuotes();
+      return $v_result;
+    }
+
+    // ----- Go to beginning of Central Dir
+    @rewind($this->zip_fd);
+    if (@fseek($this->zip_fd, $v_central_dir['offset']))
+    {
+      $this->privSwapBackMagicQuotes();
+
+      // ----- Error log
+      PclZip::privErrorLog(PCLZIP_ERR_INVALID_ARCHIVE_ZIP, 'Invalid archive size');
+
+      // ----- Return
+      return PclZip::errorCode();
+    }
+
+    // ----- Read each entry
+    for ($i=0; $i<$v_central_dir['entries']; $i++)
+    {
+      // ----- Read the file header
+      if (($v_result = $this->privReadCentralFileHeader($v_header)) != 1)
+      {
+        $this->privSwapBackMagicQuotes();
+        return $v_result;
+      }
+      $v_header['index'] = $i;
+
+      // ----- Get the only interesting attributes
+      $this->privConvertHeader2FileInfo($v_header, $p_list[$i]);
+      unset($v_header);
+    }
+
+    // ----- Close the zip file
+    $this->privCloseFd();
+
+    // ----- Magic quotes trick
+    $this->privSwapBackMagicQuotes();
+
+    // ----- Return
+    return $v_result;
+  }
+  // --------------------------------------------------------------------------------
+
+  // --------------------------------------------------------------------------------
+  // Function : privConvertHeader2FileInfo()
+  // Description :
+  //   This function takes the file informations from the central directory
+  //   entries and extract the interesting parameters that will be given back.
+  //   The resulting file infos are set in the array $p_info
+  //     $p_info['filename'] : Filename with full path. Given by user (add),
+  //                           extracted in the filesystem (extract).
+  //     $p_info['stored_filename'] : Stored filename in the archive.
+  //     $p_info['size'] = Size of the file.
+  //     $p_info['compressed_size'] = Compressed size of the file.
+  //     $p_info['mtime'] = Last modification date of the file.
+  //     $p_info['comment'] = Comment associated with the file.
+  //     $p_info['folder'] = true/false : indicates if the entry is a folder or not.
+  //     $p_info['status'] = status of the action on the file.
+  //     $p_info['crc'] = CRC of the file content.
+  // Parameters :
+  // Return Values :
+  // --------------------------------------------------------------------------------
+  function privConvertHeader2FileInfo($p_header, &$p_info)
+  {
+    $v_result=1;
+
+    // ----- Get the interesting attributes
+    $v_temp_path = PclZipUtilPathReduction($p_header['filename']);
+    $p_info['filename'] = $v_temp_path;
+    $v_temp_path = PclZipUtilPathReduction($p_header['stored_filename']);
+    $p_info['stored_filename'] = $v_temp_path;
+    $p_info['size'] = $p_header['size'];
+    $p_info['compressed_size'] = $p_header['compressed_size'];
+    $p_info['mtime'] = $p_header['mtime'];
+    $p_info['comment'] = $p_header['comment'];
+    $p_info['folder'] = (($p_header['external']&0x00000010)==0x00000010);
+    $p_info['index'] = $p_header['index'];
+    $p_info['status'] = $p_header['status'];
+    $p_info['crc'] = $p_header['crc'];
+
+    // ----- Return
+    return $v_result;
+  }
+  // --------------------------------------------------------------------------------
+
+  // --------------------------------------------------------------------------------
+  // Function : privExtractByRule()
+  // Description :
+  //   Extract a file or directory depending of rules (by index, by name, ...)
+  // Parameters :
+  //   $p_file_list : An array where will be placed the properties of each
+  //                  extracted file
+  //   $p_path : Path to add while writing the extracted files
+  //   $p_remove_path : Path to remove (from the file memorized path) while writing the
+  //                    extracted files. If the path does not match the file path,
+  //                    the file is extracted with its memorized path.
+  //                    $p_remove_path does not apply to 'list' mode.
+  //                    $p_path and $p_remove_path are commulative.
+  // Return Values :
+  //   1 on success,0 or less on error (see error code list)
+  // --------------------------------------------------------------------------------
+  function privExtractByRule(&$p_file_list, $p_path, $p_remove_path, $p_remove_all_path, &$p_options)
+  {
+    $v_result=1;
+
+    // ----- Magic quotes trick
+    $this->privDisableMagicQuotes();
+
+    // ----- Check the path
+    if (   ($p_path == "")
+	    || (   (substr($p_path, 0, 1) != "/")
+		    && (substr($p_path, 0, 3) != "../")
+			&& (substr($p_path,1,2)!=":/")))
+      $p_path = "./".$p_path;
+
+    // ----- Reduce the path last (and duplicated) '/'
+    if (($p_path != "./") && ($p_path != "/"))
+    {
+      // ----- Look for the path end '/'
+      while (substr($p_path, -1) == "/")
+      {
+        $p_path = substr($p_path, 0, strlen($p_path)-1);
+      }
+    }
+
+    // ----- Look for path to remove format (should end by /)
+    if (($p_remove_path != "") && (substr($p_remove_path, -1) != '/'))
+    {
+      $p_remove_path .= '/';
+    }
+    $p_remove_path_size = strlen($p_remove_path);
+
+    // ----- Open the zip file
+    if (($v_result = $this->privOpenFd('rb')) != 1)
+    {
+      $this->privSwapBackMagicQuotes();
+      return $v_result;
+    }
+
+    // ----- Read the central directory informations
+    $v_central_dir = array();
+    if (($v_result = $this->privReadEndCentralDir($v_central_dir)) != 1)
+    {
+      // ----- Close the zip file
+      $this->privCloseFd();
+      $this->privSwapBackMagicQuotes();
+
+      return $v_result;
+    }
+
+    // ----- Start at beginning of Central Dir
+    $v_pos_entry = $v_central_dir['offset'];
+
+    // ----- Read each entry
+    $j_start = 0;
+    for ($i=0, $v_nb_extracted=0; $i<$v_central_dir['entries']; $i++)
+    {
+
+      // ----- Read next Central dir entry
+      @rewind($this->zip_fd);
+      if (@fseek($this->zip_fd, $v_pos_entry))
+      {
+        // ----- Close the zip file
+        $this->privCloseFd();
+        $this->privSwapBackMagicQuotes();
+
+        // ----- Error log
+        PclZip::privErrorLog(PCLZIP_ERR_INVALID_ARCHIVE_ZIP, 'Invalid archive size');
+
+        // ----- Return
+        return PclZip::errorCode();
+      }
+
+      // ----- Read the file header
+      $v_header = array();
+      if (($v_result = $this->privReadCentralFileHeader($v_header)) != 1)
+      {
+        // ----- Close the zip file
+        $this->privCloseFd();
+        $this->privSwapBackMagicQuotes();
+
+        return $v_result;
+      }
+
+      // ----- Store the index
+      $v_header['index'] = $i;
+
+      // ----- Store the file position
+      $v_pos_entry = ftell($this->zip_fd);
+
+      // ----- Look for the specific extract rules
+      $v_extract = false;
+
+      // ----- Look for extract by name rule
+      if (   (isset($p_options[PCLZIP_OPT_BY_NAME]))
+          && ($p_options[PCLZIP_OPT_BY_NAME] != 0)) {
+
+          // ----- Look if the filename is in the list
+          for ($j=0; ($j<sizeof($p_options[PCLZIP_OPT_BY_NAME])) && (!$v_extract); $j++) {
+
+              // ----- Look for a directory
+              if (substr($p_options[PCLZIP_OPT_BY_NAME][$j], -1) == "/") {
+
+                  // ----- Look if the directory is in the filename path
+                  if (   (strlen($v_header['stored_filename']) > strlen($p_options[PCLZIP_OPT_BY_NAME][$j]))
+                      && (substr($v_header['stored_filename'], 0, strlen($p_options[PCLZIP_OPT_BY_NAME][$j])) == $p_options[PCLZIP_OPT_BY_NAME][$j])) {
+                      $v_extract = true;
+                  }
+              }
+              // ----- Look for a filename
+              elseif ($v_header['stored_filename'] == $p_options[PCLZIP_OPT_BY_NAME][$j]) {
+                  $v_extract = true;
+              }
+          }
+      }
+
+      // ----- Look for extract by ereg rule
+      // ereg() is deprecated with PHP 5.3
+      /* 
+      else if (   (isset($p_options[PCLZIP_OPT_BY_EREG]))
+               && ($p_options[PCLZIP_OPT_BY_EREG] != "")) {
+
+          if (ereg($p_options[PCLZIP_OPT_BY_EREG], $v_header['stored_filename'])) {
+              $v_extract = true;
+          }
+      }
+      */
+
+      // ----- Look for extract by preg rule
+      else if (   (isset($p_options[PCLZIP_OPT_BY_PREG]))
+               && ($p_options[PCLZIP_OPT_BY_PREG] != "")) {
+
+          if (preg_match($p_options[PCLZIP_OPT_BY_PREG], $v_header['stored_filename'])) {
+              $v_extract = true;
+          }
+      }
+
+      // ----- Look for extract by index rule
+      else if (   (isset($p_options[PCLZIP_OPT_BY_INDEX]))
+               && ($p_options[PCLZIP_OPT_BY_INDEX] != 0)) {
+          
+          // ----- Look if the index is in the list
+          for ($j=$j_start; ($j<sizeof($p_options[PCLZIP_OPT_BY_INDEX])) && (!$v_extract); $j++) {
+
+              if (($i>=$p_options[PCLZIP_OPT_BY_INDEX][$j]['start']) && ($i<=$p_options[PCLZIP_OPT_BY_INDEX][$j]['end'])) {
+                  $v_extract = true;
+              }
+              if ($i>=$p_options[PCLZIP_OPT_BY_INDEX][$j]['end']) {
+                  $j_start = $j+1;
+              }
+
+              if ($p_options[PCLZIP_OPT_BY_INDEX][$j]['start']>$i) {
+                  break;
+              }
+          }
+      }
+
+      // ----- Look for no rule, which means extract all the archive
+      else {
+          $v_extract = true;
+      }
+
+	  // ----- Check compression method
+	  if (   ($v_extract)
+	      && (   ($v_header['compression'] != 8)
+		      && ($v_header['compression'] != 0))) {
+          $v_header['status'] = 'unsupported_compression';
+
+          // ----- Look for PCLZIP_OPT_STOP_ON_ERROR
+          if (   (isset($p_options[PCLZIP_OPT_STOP_ON_ERROR]))
+		      && ($p_options[PCLZIP_OPT_STOP_ON_ERROR]===true)) {
+
+              $this->privSwapBackMagicQuotes();
+              
+              PclZip::privErrorLog(PCLZIP_ERR_UNSUPPORTED_COMPRESSION,
+			                       "Filename '".$v_header['stored_filename']."' is "
+				  	    	  	   ."compressed by an unsupported compression "
+				  	    	  	   ."method (".$v_header['compression'].") ");
+
+              return PclZip::errorCode();
+		  }
+	  }
+	  
+	  // ----- Check encrypted files
+	  if (($v_extract) && (($v_header['flag'] & 1) == 1)) {
+          $v_header['status'] = 'unsupported_encryption';
+
+          // ----- Look for PCLZIP_OPT_STOP_ON_ERROR
+          if (   (isset($p_options[PCLZIP_OPT_STOP_ON_ERROR]))
+		      && ($p_options[PCLZIP_OPT_STOP_ON_ERROR]===true)) {
+
+              $this->privSwapBackMagicQuotes();
+
+              PclZip::privErrorLog(PCLZIP_ERR_UNSUPPORTED_ENCRYPTION,
+			                       "Unsupported encryption for "
+				  	    	  	   ." filename '".$v_header['stored_filename']
+								   ."'");
+
+              return PclZip::errorCode();
+		  }
+    }
+
+      // ----- Look for real extraction
+      if (($v_extract) && ($v_header['status'] != 'ok')) {
+          $v_result = $this->privConvertHeader2FileInfo($v_header,
+		                                        $p_file_list[$v_nb_extracted++]);
+          if ($v_result != 1) {
+              $this->privCloseFd();
+              $this->privSwapBackMagicQuotes();
+              return $v_result;
+          }
+
+          $v_extract = false;
+      }
+      
+      // ----- Look for real extraction
+      if ($v_extract)
+      {
+
+        // ----- Go to the file position
+        @rewind($this->zip_fd);
+        if (@fseek($this->zip_fd, $v_header['offset']))
+        {
+          // ----- Close the zip file
+          $this->privCloseFd();
+
+          $this->privSwapBackMagicQuotes();
+
+          // ----- Error log
+          PclZip::privErrorLog(PCLZIP_ERR_INVALID_ARCHIVE_ZIP, 'Invalid archive size');
+
+          // ----- Return
+          return PclZip::errorCode();
+        }
+
+        // ----- Look for extraction as string
+        if ($p_options[PCLZIP_OPT_EXTRACT_AS_STRING]) {
+
+          $v_string = '';
+
+          // ----- Extracting the file
+          $v_result1 = $this->privExtractFileAsString($v_header, $v_string, $p_options);
+          if ($v_result1 < 1) {
+            $this->privCloseFd();
+            $this->privSwapBackMagicQuotes();
+            return $v_result1;
+          }
+
+          // ----- Get the only interesting attributes
+          if (($v_result = $this->privConvertHeader2FileInfo($v_header, $p_file_list[$v_nb_extracted])) != 1)
+          {
+            // ----- Close the zip file
+            $this->privCloseFd();
+            $this->privSwapBackMagicQuotes();
+
+            return $v_result;
+          }
+
+          // ----- Set the file content
+          $p_file_list[$v_nb_extracted]['content'] = $v_string;
+
+          // ----- Next extracted file
+          $v_nb_extracted++;
+          
+          // ----- Look for user callback abort
+          if ($v_result1 == 2) {
+          	break;
+          }
+        }
+        // ----- Look for extraction in standard output
+        elseif (   (isset($p_options[PCLZIP_OPT_EXTRACT_IN_OUTPUT]))
+		        && ($p_options[PCLZIP_OPT_EXTRACT_IN_OUTPUT])) {
+          // ----- Extracting the file in standard output
+          $v_result1 = $this->privExtractFileInOutput($v_header, $p_options);
+          if ($v_result1 < 1) {
+            $this->privCloseFd();
+            $this->privSwapBackMagicQuotes();
+            return $v_result1;
+          }
+
+          // ----- Get the only interesting attributes
+          if (($v_result = $this->privConvertHeader2FileInfo($v_header, $p_file_list[$v_nb_extracted++])) != 1) {
+            $this->privCloseFd();
+            $this->privSwapBackMagicQuotes();
+            return $v_result;
+          }
+
+          // ----- Look for user callback abort
+          if ($v_result1 == 2) {
+          	break;
+          }
+        }
+        // ----- Look for normal extraction
+        else {
+          // ----- Extracting the file
+          $v_result1 = $this->privExtractFile($v_header,
+		                                      $p_path, $p_remove_path,
+											  $p_remove_all_path,
+											  $p_options);
+          if ($v_result1 < 1) {
+            $this->privCloseFd();
+            $this->privSwapBackMagicQuotes();
+            return $v_result1;
+          }
+
+          // ----- Get the only interesting attributes
+          if (($v_result = $this->privConvertHeader2FileInfo($v_header, $p_file_list[$v_nb_extracted++])) != 1)
+          {
+            // ----- Close the zip file
+            $this->privCloseFd();
+            $this->privSwapBackMagicQuotes();
+
+            return $v_result;
+          }
+
+          // ----- Look for user callback abort
+          if ($v_result1 == 2) {
+          	break;
+          }
+        }
+      }
+    }
+
+    // ----- Close the zip file
+    $this->privCloseFd();
+    $this->privSwapBackMagicQuotes();
+
+    // ----- Return
+    return $v_result;
+  }
+  // --------------------------------------------------------------------------------
+
+  // --------------------------------------------------------------------------------
+  // Function : privExtractFile()
+  // Description :
+  // Parameters :
+  // Return Values :
+  //
+  // 1 : ... ?
+  // PCLZIP_ERR_USER_ABORTED(2) : User ask for extraction stop in callback
+  // --------------------------------------------------------------------------------
+  function privExtractFile(&$p_entry, $p_path, $p_remove_path, $p_remove_all_path, &$p_options)
+  {
+    $v_result=1;
+
+    // ----- Read the file header
+    if (($v_result = $this->privReadFileHeader($v_header)) != 1)
+    {
+      // ----- Return
+      return $v_result;
+    }
+
+
+    // ----- Check that the file header is coherent with $p_entry info
+    if ($this->privCheckFileHeaders($v_header, $p_entry) != 1) {
+        // TBC
+    }
+
+    // ----- Look for all path to remove
+    if ($p_remove_all_path == true) {
+        // ----- Look for folder entry that not need to be extracted
+        if (($p_entry['external']&0x00000010)==0x00000010) {
+
+            $p_entry['status'] = "filtered";
+
+            return $v_result;
+        }
+
+        // ----- Get the basename of the path
+        $p_entry['filename'] = basename($p_entry['filename']);
+    }
+
+    // ----- Look for path to remove
+    else if ($p_remove_path != "")
+    {
+      if (PclZipUtilPathInclusion($p_remove_path, $p_entry['filename']) == 2)
+      {
+
+        // ----- Change the file status
+        $p_entry['status'] = "filtered";
+
+        // ----- Return
+        return $v_result;
+      }
+
+      $p_remove_path_size = strlen($p_remove_path);
+      if (substr($p_entry['filename'], 0, $p_remove_path_size) == $p_remove_path)
+      {
+
+        // ----- Remove the path
+        $p_entry['filename'] = substr($p_entry['filename'], $p_remove_path_size);
+
+      }
+    }
+
+    // ----- Add the path
+    if ($p_path != '') {
+      $p_entry['filename'] = $p_path."/".$p_entry['filename'];
+    }
+    
+    // ----- Check a base_dir_restriction
+    if (isset($p_options[PCLZIP_OPT_EXTRACT_DIR_RESTRICTION])) {
+      $v_inclusion
+      = PclZipUtilPathInclusion($p_options[PCLZIP_OPT_EXTRACT_DIR_RESTRICTION],
+                                $p_entry['filename']); 
+      if ($v_inclusion == 0) {
+
+        PclZip::privErrorLog(PCLZIP_ERR_DIRECTORY_RESTRICTION,
+			                     "Filename '".$p_entry['filename']."' is "
+								 ."outside PCLZIP_OPT_EXTRACT_DIR_RESTRICTION");
+
+        return PclZip::errorCode();
+      }
+    }
+
+    // ----- Look for pre-extract callback
+    if (isset($p_options[PCLZIP_CB_PRE_EXTRACT])) {
+
+      // ----- Generate a local information
+      $v_local_header = array();
+      $this->privConvertHeader2FileInfo($p_entry, $v_local_header);
+
+      // ----- Call the callback
+      // Here I do not use call_user_func() because I need to send a reference to the
+      // header.
+//      eval('$v_result = '.$p_options[PCLZIP_CB_PRE_EXTRACT].'(PCLZIP_CB_PRE_EXTRACT, $v_local_header);');
+      $v_result = $p_options[PCLZIP_CB_PRE_EXTRACT](PCLZIP_CB_PRE_EXTRACT, $v_local_header);
+      if ($v_result == 0) {
+        // ----- Change the file status
+        $p_entry['status'] = "skipped";
+        $v_result = 1;
+      }
+      
+      // ----- Look for abort result
+      if ($v_result == 2) {
+        // ----- This status is internal and will be changed in 'skipped'
+        $p_entry['status'] = "aborted";
+      	$v_result = PCLZIP_ERR_USER_ABORTED;
+      }
+
+      // ----- Update the informations
+      // Only some fields can be modified
+      $p_entry['filename'] = $v_local_header['filename'];
+    }
+
+
+    // ----- Look if extraction should be done
+    if ($p_entry['status'] == 'ok') {
+
+    // ----- Look for specific actions while the file exist
+    if (file_exists($p_entry['filename']))
+    {
+
+      // ----- Look if file is a directory
+      if (is_dir($p_entry['filename']))
+      {
+
+        // ----- Change the file status
+        $p_entry['status'] = "already_a_directory";
+        
+        // ----- Look for PCLZIP_OPT_STOP_ON_ERROR
+        // For historical reason first PclZip implementation does not stop
+        // when this kind of error occurs.
+        if (   (isset($p_options[PCLZIP_OPT_STOP_ON_ERROR]))
+		    && ($p_options[PCLZIP_OPT_STOP_ON_ERROR]===true)) {
+
+            PclZip::privErrorLog(PCLZIP_ERR_ALREADY_A_DIRECTORY,
+			                     "Filename '".$p_entry['filename']."' is "
+								 ."already used by an existing directory");
+
+            return PclZip::errorCode();
+		    }
+      }
+      // ----- Look if file is write protected
+      else if (!is_writeable($p_entry['filename']))
+      {
+
+        // ----- Change the file status
+        $p_entry['status'] = "write_protected";
+
+        // ----- Look for PCLZIP_OPT_STOP_ON_ERROR
+        // For historical reason first PclZip implementation does not stop
+        // when this kind of error occurs.
+        if (   (isset($p_options[PCLZIP_OPT_STOP_ON_ERROR]))
+		    && ($p_options[PCLZIP_OPT_STOP_ON_ERROR]===true)) {
+
+            PclZip::privErrorLog(PCLZIP_ERR_WRITE_OPEN_FAIL,
+			                     "Filename '".$p_entry['filename']."' exists "
+								 ."and is write protected");
+
+            return PclZip::errorCode();
+		    }
+      }
+
+      // ----- Look if the extracted file is older
+      else if (filemtime($p_entry['filename']) > $p_entry['mtime'])
+      {
+        // ----- Change the file status
+        if (   (isset($p_options[PCLZIP_OPT_REPLACE_NEWER]))
+		    && ($p_options[PCLZIP_OPT_REPLACE_NEWER]===true)) {
+	  	  }
+		    else {
+            $p_entry['status'] = "newer_exist";
+
+            // ----- Look for PCLZIP_OPT_STOP_ON_ERROR
+            // For historical reason first PclZip implementation does not stop
+            // when this kind of error occurs.
+            if (   (isset($p_options[PCLZIP_OPT_STOP_ON_ERROR]))
+		        && ($p_options[PCLZIP_OPT_STOP_ON_ERROR]===true)) {
+
+                PclZip::privErrorLog(PCLZIP_ERR_WRITE_OPEN_FAIL,
+			             "Newer version of '".$p_entry['filename']."' exists "
+					    ."and option PCLZIP_OPT_REPLACE_NEWER is not selected");
+
+                return PclZip::errorCode();
+		      }
+		    }
+      }
+      else {
+      }
+    }
+
+    // ----- Check the directory availability and create it if necessary
+    else {
+      if ((($p_entry['external']&0x00000010)==0x00000010) || (substr($p_entry['filename'], -1) == '/'))
+        $v_dir_to_check = $p_entry['filename'];
+      else if (!strstr($p_entry['filename'], "/"))
+        $v_dir_to_check = "";
+      else
+        $v_dir_to_check = dirname($p_entry['filename']);
+
+        if (($v_result = $this->privDirCheck($v_dir_to_check, (($p_entry['external']&0x00000010)==0x00000010))) != 1) {
+  
+          // ----- Change the file status
+          $p_entry['status'] = "path_creation_fail";
+  
+          // ----- Return
+          //return $v_result;
+          $v_result = 1;
+        }
+      }
+    }
+
+    // ----- Look if extraction should be done
+    if ($p_entry['status'] == 'ok') {
+
+      // ----- Do the extraction (if not a folder)
+      if (!(($p_entry['external']&0x00000010)==0x00000010))
+      {
+        // ----- Look for not compressed file
+        if ($p_entry['compression'] == 0) {
+
+    		  // ----- Opening destination file
+          if (($v_dest_file = @fopen($p_entry['filename'], 'wb')) == 0)
+          {
+
+            // ----- Change the file status
+            $p_entry['status'] = "write_error";
+
+            // ----- Return
+            return $v_result;
+          }
+
+
+          // ----- Read the file by PCLZIP_READ_BLOCK_SIZE octets blocks
+          $v_size = $p_entry['compressed_size'];
+          while ($v_size != 0)
+          {
+            $v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE);
+            $v_buffer = @fread($this->zip_fd, $v_read_size);
+            /* Try to speed up the code
+            $v_binary_data = pack('a'.$v_read_size, $v_buffer);
+            @fwrite($v_dest_file, $v_binary_data, $v_read_size);
+            */
+            @fwrite($v_dest_file, $v_buffer, $v_read_size);            
+            $v_size -= $v_read_size;
+          }
+
+          // ----- Closing the destination file
+          fclose($v_dest_file);
+
+          // ----- Change the file mtime
+          touch($p_entry['filename'], $p_entry['mtime']);
+          
+
+        }
+        else {
+          // ----- TBC
+          // Need to be finished
+          if (($p_entry['flag'] & 1) == 1) {
+            PclZip::privErrorLog(PCLZIP_ERR_UNSUPPORTED_ENCRYPTION, 'File \''.$p_entry['filename'].'\' is encrypted. Encrypted files are not supported.');
+            return PclZip::errorCode();
+          }
+
+
+          // ----- Look for using temporary file to unzip
+          if ( (!isset($p_options[PCLZIP_OPT_TEMP_FILE_OFF])) 
+              && (isset($p_options[PCLZIP_OPT_TEMP_FILE_ON])
+                  || (isset($p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD])
+                      && ($p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD] <= $p_entry['size'])) ) ) {
+            $v_result = $this->privExtractFileUsingTempFile($p_entry, $p_options);
+            if ($v_result < PCLZIP_ERR_NO_ERROR) {
+              return $v_result;
+            }
+          }
+          
+          // ----- Look for extract in memory
+          else {
+
+          
+            // ----- Read the compressed file in a buffer (one shot)
+            $v_buffer = @fread($this->zip_fd, $p_entry['compressed_size']);
+            
+            // ----- Decompress the file
+            $v_file_content = @gzinflate($v_buffer);
+            unset($v_buffer);
+            if ($v_file_content === FALSE) {
+  
+              // ----- Change the file status
+              // TBC
+              $p_entry['status'] = "error";
+              
+              return $v_result;
+            }
+            
+            // ----- Opening destination file
+            if (($v_dest_file = @fopen($p_entry['filename'], 'wb')) == 0) {
+  
+              // ----- Change the file status
+              $p_entry['status'] = "write_error";
+  
+              return $v_result;
+            }
+  
+            // ----- Write the uncompressed data
+            @fwrite($v_dest_file, $v_file_content, $p_entry['size']);
+            unset($v_file_content);
+  
+            // ----- Closing the destination file
+            @fclose($v_dest_file);
+            
+          }
+
+          // ----- Change the file mtime
+          @touch($p_entry['filename'], $p_entry['mtime']);
+        }
+
+        // ----- Look for chmod option
+        if (isset($p_options[PCLZIP_OPT_SET_CHMOD])) {
+
+          // ----- Change the mode of the file
+          @chmod($p_entry['filename'], $p_options[PCLZIP_OPT_SET_CHMOD]);
+        }
+
+      }
+    }
+
+  	// ----- Change abort status
+  	if ($p_entry['status'] == "aborted") {
+        $p_entry['status'] = "skipped";
+  	}
+	
+    // ----- Look for post-extract callback
+    elseif (isset($p_options[PCLZIP_CB_POST_EXTRACT])) {
+
+      // ----- Generate a local information
+      $v_local_header = array();
+      $this->privConvertHeader2FileInfo($p_entry, $v_local_header);
+
+      // ----- Call the callback
+      // Here I do not use call_user_func() because I need to send a reference to the
+      // header.
+//      eval('$v_result = '.$p_options[PCLZIP_CB_POST_EXTRACT].'(PCLZIP_CB_POST_EXTRACT, $v_local_header);');
+      $v_result = $p_options[PCLZIP_CB_POST_EXTRACT](PCLZIP_CB_POST_EXTRACT, $v_local_header);
+
+      // ----- Look for abort result
+      if ($v_result == 2) {
+      	$v_result = PCLZIP_ERR_USER_ABORTED;
+      }
+    }
+
+    // ----- Return
+    return $v_result;
+  }
+  // --------------------------------------------------------------------------------
+
+  // --------------------------------------------------------------------------------
+  // Function : privExtractFileUsingTempFile()
+  // Description :
+  // Parameters :
+  // Return Values :
+  // --------------------------------------------------------------------------------
+  function privExtractFileUsingTempFile(&$p_entry, &$p_options)
+  {
+    $v_result=1;
+        
+    // ----- Creates a temporary file
+    $v_gzip_temp_name = PCLZIP_TEMPORARY_DIR.uniqid('pclzip-').'.gz';
+    if (($v_dest_file = @fopen($v_gzip_temp_name, "wb")) == 0) {
+      fclose($v_file);
+      PclZip::privErrorLog(PCLZIP_ERR_WRITE_OPEN_FAIL, 'Unable to open temporary file \''.$v_gzip_temp_name.'\' in binary write mode');
+      return PclZip::errorCode();
+    }
+
+
+    // ----- Write gz file format header
+    $v_binary_data = pack('va1a1Va1a1', 0x8b1f, Chr($p_entry['compression']), Chr(0x00), time(), Chr(0x00), Chr(3));
+    @fwrite($v_dest_file, $v_binary_data, 10);
+
+    // ----- Read the file by PCLZIP_READ_BLOCK_SIZE octets blocks
+    $v_size = $p_entry['compressed_size'];
+    while ($v_size != 0)
+    {
+      $v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE);
+      $v_buffer = @fread($this->zip_fd, $v_read_size);
+      //$v_binary_data = pack('a'.$v_read_size, $v_buffer);
+      @fwrite($v_dest_file, $v_buffer, $v_read_size);
+      $v_size -= $v_read_size;
+    }
+
+    // ----- Write gz file format footer
+    $v_binary_data = pack('VV', $p_entry['crc'], $p_entry['size']);
+    @fwrite($v_dest_file, $v_binary_data, 8);
+
+    // ----- Close the temporary file
+    @fclose($v_dest_file);
+
+    // ----- Opening destination file
+    if (($v_dest_file = @fopen($p_entry['filename'], 'wb')) == 0) {
+      $p_entry['status'] = "write_error";
+      return $v_result;
+    }
+
+    // ----- Open the temporary gz file
+    if (($v_src_file = @gzopen($v_gzip_temp_name, 'rb')) == 0) {
+      @fclose($v_dest_file);
+      $p_entry['status'] = "read_error";
+      PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open temporary file \''.$v_gzip_temp_name.'\' in binary read mode');
+      return PclZip::errorCode();
+    }
+
+
+    // ----- Read the file by PCLZIP_READ_BLOCK_SIZE octets blocks
+    $v_size = $p_entry['size'];
+    while ($v_size != 0) {
+      $v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE);
+      $v_buffer = @gzread($v_src_file, $v_read_size);
+      //$v_binary_data = pack('a'.$v_read_size, $v_buffer);
+      @fwrite($v_dest_file, $v_buffer, $v_read_size);
+      $v_size -= $v_read_size;
+    }
+    @fclose($v_dest_file);
+    @gzclose($v_src_file);
+
+    // ----- Delete the temporary file
+    @unlink($v_gzip_temp_name);
+    
+    // ----- Return
+    return $v_result;
+  }
+  // --------------------------------------------------------------------------------
+
+  // --------------------------------------------------------------------------------
+  // Function : privExtractFileInOutput()
+  // Description :
+  // Parameters :
+  // Return Values :
+  // --------------------------------------------------------------------------------
+  function privExtractFileInOutput(&$p_entry, &$p_options)
+  {
+    $v_result=1;
+
+    // ----- Read the file header
+    if (($v_result = $this->privReadFileHeader($v_header)) != 1) {
+      return $v_result;
+    }
+
+
+    // ----- Check that the file header is coherent with $p_entry info
+    if ($this->privCheckFileHeaders($v_header, $p_entry) != 1) {
+        // TBC
+    }
+
+    // ----- Look for pre-extract callback
+    if (isset($p_options[PCLZIP_CB_PRE_EXTRACT])) {
+
+      // ----- Generate a local information
+      $v_local_header = array();
+      $this->privConvertHeader2FileInfo($p_entry, $v_local_header);
+
+      // ----- Call the callback
+      // Here I do not use call_user_func() because I need to send a reference to the
+      // header.
+//      eval('$v_result = '.$p_options[PCLZIP_CB_PRE_EXTRACT].'(PCLZIP_CB_PRE_EXTRACT, $v_local_header);');
+      $v_result = $p_options[PCLZIP_CB_PRE_EXTRACT](PCLZIP_CB_PRE_EXTRACT, $v_local_header);
+      if ($v_result == 0) {
+        // ----- Change the file status
+        $p_entry['status'] = "skipped";
+        $v_result = 1;
+      }
+
+      // ----- Look for abort result
+      if ($v_result == 2) {
+        // ----- This status is internal and will be changed in 'skipped'
+        $p_entry['status'] = "aborted";
+      	$v_result = PCLZIP_ERR_USER_ABORTED;
+      }
+
+      // ----- Update the informations
+      // Only some fields can be modified
+      $p_entry['filename'] = $v_local_header['filename'];
+    }
+
+    // ----- Trace
+
+    // ----- Look if extraction should be done
+    if ($p_entry['status'] == 'ok') {
+
+      // ----- Do the extraction (if not a folder)
+      if (!(($p_entry['external']&0x00000010)==0x00000010)) {
+        // ----- Look for not compressed file
+        if ($p_entry['compressed_size'] == $p_entry['size']) {
+
+          // ----- Read the file in a buffer (one shot)
+          $v_buffer = @fread($this->zip_fd, $p_entry['compressed_size']);
+
+          // ----- Send the file to the output
+          echo $v_buffer;
+          unset($v_buffer);
+        }
+        else {
+
+          // ----- Read the compressed file in a buffer (one shot)
+          $v_buffer = @fread($this->zip_fd, $p_entry['compressed_size']);
+          
+          // ----- Decompress the file
+          $v_file_content = gzinflate($v_buffer);
+          unset($v_buffer);
+
+          // ----- Send the file to the output
+          echo $v_file_content;
+          unset($v_file_content);
+        }
+      }
+    }
+
+	// ----- Change abort status
+	if ($p_entry['status'] == "aborted") {
+      $p_entry['status'] = "skipped";
+	}
+
+    // ----- Look for post-extract callback
+    elseif (isset($p_options[PCLZIP_CB_POST_EXTRACT])) {
+
+      // ----- Generate a local information
+      $v_local_header = array();
+      $this->privConvertHeader2FileInfo($p_entry, $v_local_header);
+
+      // ----- Call the callback
+      // Here I do not use call_user_func() because I need to send a reference to the
+      // header.
+//      eval('$v_result = '.$p_options[PCLZIP_CB_POST_EXTRACT].'(PCLZIP_CB_POST_EXTRACT, $v_local_header);');
+      $v_result = $p_options[PCLZIP_CB_POST_EXTRACT](PCLZIP_CB_POST_EXTRACT, $v_local_header);
+
+      // ----- Look for abort result
+      if ($v_result == 2) {
+      	$v_result = PCLZIP_ERR_USER_ABORTED;
+      }
+    }
+
+    return $v_result;
+  }
+  // --------------------------------------------------------------------------------
+
+  // --------------------------------------------------------------------------------
+  // Function : privExtractFileAsString()
+  // Description :
+  // Parameters :
+  // Return Values :
+  // --------------------------------------------------------------------------------
+  function privExtractFileAsString(&$p_entry, &$p_string, &$p_options)
+  {
+    $v_result=1;
+
+    // ----- Read the file header
+    $v_header = array();
+    if (($v_result = $this->privReadFileHeader($v_header)) != 1)
+    {
+      // ----- Return
+      return $v_result;
+    }
+
+
+    // ----- Check that the file header is coherent with $p_entry info
+    if ($this->privCheckFileHeaders($v_header, $p_entry) != 1) {
+        // TBC
+    }
+
+    // ----- Look for pre-extract callback
+    if (isset($p_options[PCLZIP_CB_PRE_EXTRACT])) {
+
+      // ----- Generate a local information
+      $v_local_header = array();
+      $this->privConvertHeader2FileInfo($p_entry, $v_local_header);
+
+      // ----- Call the callback
+      // Here I do not use call_user_func() because I need to send a reference to the
+      // header.
+//      eval('$v_result = '.$p_options[PCLZIP_CB_PRE_EXTRACT].'(PCLZIP_CB_PRE_EXTRACT, $v_local_header);');
+      $v_result = $p_options[PCLZIP_CB_PRE_EXTRACT](PCLZIP_CB_PRE_EXTRACT, $v_local_header);
+      if ($v_result == 0) {
+        // ----- Change the file status
+        $p_entry['status'] = "skipped";
+        $v_result = 1;
+      }
+      
+      // ----- Look for abort result
+      if ($v_result == 2) {
+        // ----- This status is internal and will be changed in 'skipped'
+        $p_entry['status'] = "aborted";
+      	$v_result = PCLZIP_ERR_USER_ABORTED;
+      }
+
+      // ----- Update the informations
+      // Only some fields can be modified
+      $p_entry['filename'] = $v_local_header['filename'];
+    }
+
+
+    // ----- Look if extraction should be done
+    if ($p_entry['status'] == 'ok') {
+
+      // ----- Do the extraction (if not a folder)
+      if (!(($p_entry['external']&0x00000010)==0x00000010)) {
+        // ----- Look for not compressed file
+  //      if ($p_entry['compressed_size'] == $p_entry['size'])
+        if ($p_entry['compression'] == 0) {
+  
+          // ----- Reading the file
+          $p_string = @fread($this->zip_fd, $p_entry['compressed_size']);
+        }
+        else {
+  
+          // ----- Reading the file
+          $v_data = @fread($this->zip_fd, $p_entry['compressed_size']);
+          
+          // ----- Decompress the file
+          if (($p_string = @gzinflate($v_data)) === FALSE) {
+              // TBC
+          }
+        }
+  
+        // ----- Trace
+      }
+      else {
+          // TBC : error : can not extract a folder in a string
+      }
+      
+    }
+
+  	// ----- Change abort status
+  	if ($p_entry['status'] == "aborted") {
+        $p_entry['status'] = "skipped";
+  	}
+	
+    // ----- Look for post-extract callback
+    elseif (isset($p_options[PCLZIP_CB_POST_EXTRACT])) {
+
+      // ----- Generate a local information
+      $v_local_header = array();
+      $this->privConvertHeader2FileInfo($p_entry, $v_local_header);
+      
+      // ----- Swap the content to header
+      $v_local_header['content'] = $p_string;
+      $p_string = '';
+
+      // ----- Call the callback
+      // Here I do not use call_user_func() because I need to send a reference to the
+      // header.
+//      eval('$v_result = '.$p_options[PCLZIP_CB_POST_EXTRACT].'(PCLZIP_CB_POST_EXTRACT, $v_local_header);');
+      $v_result = $p_options[PCLZIP_CB_POST_EXTRACT](PCLZIP_CB_POST_EXTRACT, $v_local_header);
+
+      // ----- Swap back the content to header
+      $p_string = $v_local_header['content'];
+      unset($v_local_header['content']);
+
+      // ----- Look for abort result
+      if ($v_result == 2) {
+      	$v_result = PCLZIP_ERR_USER_ABORTED;
+      }
+    }
+
+    // ----- Return
+    return $v_result;
+  }
+  // --------------------------------------------------------------------------------
+
+  // --------------------------------------------------------------------------------
+  // Function : privReadFileHeader()
+  // Description :
+  // Parameters :
+  // Return Values :
+  // --------------------------------------------------------------------------------
+  function privReadFileHeader(&$p_header)
+  {
+    $v_result=1;
+
+    // ----- Read the 4 bytes signature
+    $v_binary_data = @fread($this->zip_fd, 4);
+    $v_data = unpack('Vid', $v_binary_data);
+
+    // ----- Check signature
+    if ($v_data['id'] != 0x04034b50)
+    {
+
+      // ----- Error log
+      PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, 'Invalid archive structure');
+
+      // ----- Return
+      return PclZip::errorCode();
+    }
+
+    // ----- Read the first 42 bytes of the header
+    $v_binary_data = fread($this->zip_fd, 26);
+
+    // ----- Look for invalid block size
+    if (strlen($v_binary_data) != 26)
+    {
+      $p_header['filename'] = "";
+      $p_header['status'] = "invalid_header";
+
+      // ----- Error log
+      PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, "Invalid block size : ".strlen($v_binary_data));
+
+      // ----- Return
+      return PclZip::errorCode();
+    }
+
+    // ----- Extract the values
+    $v_data = unpack('vversion/vflag/vcompression/vmtime/vmdate/Vcrc/Vcompressed_size/Vsize/vfilename_len/vextra_len', $v_binary_data);
+
+    // ----- Get filename
+    $p_header['filename'] = fread($this->zip_fd, $v_data['filename_len']);
+
+    // ----- Get extra_fields
+    if ($v_data['extra_len'] != 0) {
+      $p_header['extra'] = fread($this->zip_fd, $v_data['extra_len']);
+    }
+    else {
+      $p_header['extra'] = '';
+    }
+
+    // ----- Extract properties
+    $p_header['version_extracted'] = $v_data['version'];
+    $p_header['compression'] = $v_data['compression'];
+    $p_header['size'] = $v_data['size'];
+    $p_header['compressed_size'] = $v_data['compressed_size'];
+    $p_header['crc'] = $v_data['crc'];
+    $p_header['flag'] = $v_data['flag'];
+    $p_header['filename_len'] = $v_data['filename_len'];
+
+    // ----- Recuperate date in UNIX format
+    $p_header['mdate'] = $v_data['mdate'];
+    $p_header['mtime'] = $v_data['mtime'];
+    if ($p_header['mdate'] && $p_header['mtime'])
+    {
+      // ----- Extract time
+      $v_hour = ($p_header['mtime'] & 0xF800) >> 11;
+      $v_minute = ($p_header['mtime'] & 0x07E0) >> 5;
+      $v_seconde = ($p_header['mtime'] & 0x001F)*2;
+
+      // ----- Extract date
+      $v_year = (($p_header['mdate'] & 0xFE00) >> 9) + 1980;
+      $v_month = ($p_header['mdate'] & 0x01E0) >> 5;
+      $v_day = $p_header['mdate'] & 0x001F;
+
+      // ----- Get UNIX date format
+      $p_header['mtime'] = @mktime($v_hour, $v_minute, $v_seconde, $v_month, $v_day, $v_year);
+
+    }
+    else
+    {
+      $p_header['mtime'] = time();
+    }
+
+    // TBC
+    //for(reset($v_data); $key = key($v_data); next($v_data)) {
+    //}
+
+    // ----- Set the stored filename
+    $p_header['stored_filename'] = $p_header['filename'];
+
+    // ----- Set the status field
+    $p_header['status'] = "ok";
+
+    // ----- Return
+    return $v_result;
+  }
+  // --------------------------------------------------------------------------------
+
+  // --------------------------------------------------------------------------------
+  // Function : privReadCentralFileHeader()
+  // Description :
+  // Parameters :
+  // Return Values :
+  // --------------------------------------------------------------------------------
+  function privReadCentralFileHeader(&$p_header)
+  {
+    $v_result=1;
+
+    // ----- Read the 4 bytes signature
+    $v_binary_data = @fread($this->zip_fd, 4);
+    $v_data = unpack('Vid', $v_binary_data);
+
+    // ----- Check signature
+    if ($v_data['id'] != 0x02014b50)
+    {
+
+      // ----- Error log
+      PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, 'Invalid archive structure');
+
+      // ----- Return
+      return PclZip::errorCode();
+    }
+
+    // ----- Read the first 42 bytes of the header
+    $v_binary_data = fread($this->zip_fd, 42);
+
+    // ----- Look for invalid block size
+    if (strlen($v_binary_data) != 42)
+    {
+      $p_header['filename'] = "";
+      $p_header['status'] = "invalid_header";
+
+      // ----- Error log
+      PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, "Invalid block size : ".strlen($v_binary_data));
+
+      // ----- Return
+      return PclZip::errorCode();
+    }
+
+    // ----- Extract the values
+    $p_header = unpack('vversion/vversion_extracted/vflag/vcompression/vmtime/vmdate/Vcrc/Vcompressed_size/Vsize/vfilename_len/vextra_len/vcomment_len/vdisk/vinternal/Vexternal/Voffset', $v_binary_data);
+
+    // ----- Get filename
+    if ($p_header['filename_len'] != 0)
+      $p_header['filename'] = fread($this->zip_fd, $p_header['filename_len']);
+    else
+      $p_header['filename'] = '';
+
+    // ----- Get extra
+    if ($p_header['extra_len'] != 0)
+      $p_header['extra'] = fread($this->zip_fd, $p_header['extra_len']);
+    else
+      $p_header['extra'] = '';
+
+    // ----- Get comment
+    if ($p_header['comment_len'] != 0)
+      $p_header['comment'] = fread($this->zip_fd, $p_header['comment_len']);
+    else
+      $p_header['comment'] = '';
+
+    // ----- Extract properties
+
+    // ----- Recuperate date in UNIX format
+    //if ($p_header['mdate'] && $p_header['mtime'])
+    // TBC : bug : this was ignoring time with 0/0/0
+    if (1)
+    {
+      // ----- Extract time
+      $v_hour = ($p_header['mtime'] & 0xF800) >> 11;
+      $v_minute = ($p_header['mtime'] & 0x07E0) >> 5;
+      $v_seconde = ($p_header['mtime'] & 0x001F)*2;
+
+      // ----- Extract date
+      $v_year = (($p_header['mdate'] & 0xFE00) >> 9) + 1980;
+      $v_month = ($p_header['mdate'] & 0x01E0) >> 5;
+      $v_day = $p_header['mdate'] & 0x001F;
+
+      // ----- Get UNIX date format
+      $p_header['mtime'] = @mktime($v_hour, $v_minute, $v_seconde, $v_month, $v_day, $v_year);
+
+    }
+    else
+    {
+      $p_header['mtime'] = time();
+    }
+
+    // ----- Set the stored filename
+    $p_header['stored_filename'] = $p_header['filename'];
+
+    // ----- Set default status to ok
+    $p_header['status'] = 'ok';
+
+    // ----- Look if it is a directory
+    if (substr($p_header['filename'], -1) == '/') {
+      //$p_header['external'] = 0x41FF0010;
+      $p_header['external'] = 0x00000010;
+    }
+
+
+    // ----- Return
+    return $v_result;
+  }
+  // --------------------------------------------------------------------------------
+
+  // --------------------------------------------------------------------------------
+  // Function : privCheckFileHeaders()
+  // Description :
+  // Parameters :
+  // Return Values :
+  //   1 on success,
+  //   0 on error;
+  // --------------------------------------------------------------------------------
+  function privCheckFileHeaders(&$p_local_header, &$p_central_header)
+  {
+    $v_result=1;
+
+  	// ----- Check the static values
+  	// TBC
+  	if ($p_local_header['filename'] != $p_central_header['filename']) {
+  	}
+  	if ($p_local_header['version_extracted'] != $p_central_header['version_extracted']) {
+  	}
+  	if ($p_local_header['flag'] != $p_central_header['flag']) {
+  	}
+  	if ($p_local_header['compression'] != $p_central_header['compression']) {
+  	}
+  	if ($p_local_header['mtime'] != $p_central_header['mtime']) {
+  	}
+  	if ($p_local_header['filename_len'] != $p_central_header['filename_len']) {
+  	}
+  
+  	// ----- Look for flag bit 3
+  	if (($p_local_header['flag'] & 8) == 8) {
+          $p_local_header['size'] = $p_central_header['size'];
+          $p_local_header['compressed_size'] = $p_central_header['compressed_size'];
+          $p_local_header['crc'] = $p_central_header['crc'];
+  	}
+
+    // ----- Return
+    return $v_result;
+  }
+  // --------------------------------------------------------------------------------
+
+  // --------------------------------------------------------------------------------
+  // Function : privReadEndCentralDir()
+  // Description :
+  // Parameters :
+  // Return Values :
+  // --------------------------------------------------------------------------------
+  function privReadEndCentralDir(&$p_central_dir)
+  {
+    $v_result=1;
+
+    // ----- Go to the end of the zip file
+    $v_size = filesize($this->zipname);
+    @fseek($this->zip_fd, $v_size);
+    if (@ftell($this->zip_fd) != $v_size)
+    {
+      // ----- Error log
+      PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, 'Unable to go to the end of the archive \''.$this->zipname.'\'');
+
+      // ----- Return
+      return PclZip::errorCode();
+    }
+
+    // ----- First try : look if this is an archive with no commentaries (most of the time)
+    // in this case the end of central dir is at 22 bytes of the file end
+    $v_found = 0;
+    if ($v_size > 26) {
+      @fseek($this->zip_fd, $v_size-22);
+      if (($v_pos = @ftell($this->zip_fd)) != ($v_size-22))
+      {
+        // ----- Error log
+        PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, 'Unable to seek back to the middle of the archive \''.$this->zipname.'\'');
+
+        // ----- Return
+        return PclZip::errorCode();
+      }
+
+      // ----- Read for bytes
+      $v_binary_data = @fread($this->zip_fd, 4);
+      $v_data = @unpack('Vid', $v_binary_data);
+
+      // ----- Check signature
+      if ($v_data['id'] == 0x06054b50) {
+        $v_found = 1;
+      }
+
+      $v_pos = ftell($this->zip_fd);
+    }
+
+    // ----- Go back to the maximum possible size of the Central Dir End Record
+    if (!$v_found) {
+      $v_maximum_size = 65557; // 0xFFFF + 22;
+      if ($v_maximum_size > $v_size)
+        $v_maximum_size = $v_size;
+      @fseek($this->zip_fd, $v_size-$v_maximum_size);
+      if (@ftell($this->zip_fd) != ($v_size-$v_maximum_size))
+      {
+        // ----- Error log
+        PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, 'Unable to seek back to the middle of the archive \''.$this->zipname.'\'');
+
+        // ----- Return
+        return PclZip::errorCode();
+      }
+
+      // ----- Read byte per byte in order to find the signature
+      $v_pos = ftell($this->zip_fd);
+      $v_bytes = 0x00000000;
+      while ($v_pos < $v_size)
+      {
+        // ----- Read a byte
+        $v_byte = @fread($this->zip_fd, 1);
+
+        // -----  Add the byte
+        //$v_bytes = ($v_bytes << 8) | Ord($v_byte);
+        // Note we mask the old value down such that once shifted we can never end up with more than a 32bit number 
+        // Otherwise on systems where we have 64bit integers the check below for the magic number will fail. 
+        $v_bytes = ( ($v_bytes & 0xFFFFFF) << 8) | Ord($v_byte); 
+
+        // ----- Compare the bytes
+        if ($v_bytes == 0x504b0506)
+        {
+          $v_pos++;
+          break;
+        }
+
+        $v_pos++;
+      }
+
+      // ----- Look if not found end of central dir
+      if ($v_pos == $v_size)
+      {
+
+        // ----- Error log
+        PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, "Unable to find End of Central Dir Record signature");
+
+        // ----- Return
+        return PclZip::errorCode();
+      }
+    }
+
+    // ----- Read the first 18 bytes of the header
+    $v_binary_data = fread($this->zip_fd, 18);
+
+    // ----- Look for invalid block size
+    if (strlen($v_binary_data) != 18)
+    {
+
+      // ----- Error log
+      PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, "Invalid End of Central Dir Record size : ".strlen($v_binary_data));
+
+      // ----- Return
+      return PclZip::errorCode();
+    }
+
+    // ----- Extract the values
+    $v_data = unpack('vdisk/vdisk_start/vdisk_entries/ventries/Vsize/Voffset/vcomment_size', $v_binary_data);
+
+    // ----- Check the global size
+    if (($v_pos + $v_data['comment_size'] + 18) != $v_size) {
+
+	  // ----- Removed in release 2.2 see readme file
+	  // The check of the file size is a little too strict.
+	  // Some bugs where found when a zip is encrypted/decrypted with 'crypt'.
+	  // While decrypted, zip has training 0 bytes
+	  if (0) {
+      // ----- Error log
+      PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT,
+	                       'The central dir is not at the end of the archive.'
+						   .' Some trailing bytes exists after the archive.');
+
+      // ----- Return
+      return PclZip::errorCode();
+	  }
+    }
+
+    // ----- Get comment
+    if ($v_data['comment_size'] != 0) {
+      $p_central_dir['comment'] = fread($this->zip_fd, $v_data['comment_size']);
+    }
+    else
+      $p_central_dir['comment'] = '';
+
+    $p_central_dir['entries'] = $v_data['entries'];
+    $p_central_dir['disk_entries'] = $v_data['disk_entries'];
+    $p_central_dir['offset'] = $v_data['offset'];
+    $p_central_dir['size'] = $v_data['size'];
+    $p_central_dir['disk'] = $v_data['disk'];
+    $p_central_dir['disk_start'] = $v_data['disk_start'];
+
+    // TBC
+    //for(reset($p_central_dir); $key = key($p_central_dir); next($p_central_dir)) {
+    //}
+
+    // ----- Return
+    return $v_result;
+  }
+  // --------------------------------------------------------------------------------
+
+  // --------------------------------------------------------------------------------
+  // Function : privDeleteByRule()
+  // Description :
+  // Parameters :
+  // Return Values :
+  // --------------------------------------------------------------------------------
+  function privDeleteByRule(&$p_result_list, &$p_options)
+  {
+    $v_result=1;
+    $v_list_detail = array();
+
+    // ----- Open the zip file
+    if (($v_result=$this->privOpenFd('rb')) != 1)
+    {
+      // ----- Return
+      return $v_result;
+    }
+
+    // ----- Read the central directory informations
+    $v_central_dir = array();
+    if (($v_result = $this->privReadEndCentralDir($v_central_dir)) != 1)
+    {
+      $this->privCloseFd();
+      return $v_result;
+    }
+
+    // ----- Go to beginning of File
+    @rewind($this->zip_fd);
+
+    // ----- Scan all the files
+    // ----- Start at beginning of Central Dir
+    $v_pos_entry = $v_central_dir['offset'];
+    @rewind($this->zip_fd);
+    if (@fseek($this->zip_fd, $v_pos_entry))
+    {
+      // ----- Close the zip file
+      $this->privCloseFd();
+
+      // ----- Error log
+      PclZip::privErrorLog(PCLZIP_ERR_INVALID_ARCHIVE_ZIP, 'Invalid archive size');
+
+      // ----- Return
+      return PclZip::errorCode();
+    }
+
+    // ----- Read each entry
+    $v_header_list = array();
+    $j_start = 0;
+    for ($i=0, $v_nb_extracted=0; $i<$v_central_dir['entries']; $i++)
+    {
+
+      // ----- Read the file header
+      $v_header_list[$v_nb_extracted] = array();
+      if (($v_result = $this->privReadCentralFileHeader($v_header_list[$v_nb_extracted])) != 1)
+      {
+        // ----- Close the zip file
+        $this->privCloseFd();
+
+        return $v_result;
+      }
+
+
+      // ----- Store the index
+      $v_header_list[$v_nb_extracted]['index'] = $i;
+
+      // ----- Look for the specific extract rules
+      $v_found = false;
+
+      // ----- Look for extract by name rule
+      if (   (isset($p_options[PCLZIP_OPT_BY_NAME]))
+          && ($p_options[PCLZIP_OPT_BY_NAME] != 0)) {
+
+          // ----- Look if the filename is in the list
+          for ($j=0; ($j<sizeof($p_options[PCLZIP_OPT_BY_NAME])) && (!$v_found); $j++) {
+
+              // ----- Look for a directory
+              if (substr($p_options[PCLZIP_OPT_BY_NAME][$j], -1) == "/") {
+
+                  // ----- Look if the directory is in the filename path
+                  if (   (strlen($v_header_list[$v_nb_extracted]['stored_filename']) > strlen($p_options[PCLZIP_OPT_BY_NAME][$j]))
+                      && (substr($v_header_list[$v_nb_extracted]['stored_filename'], 0, strlen($p_options[PCLZIP_OPT_BY_NAME][$j])) == $p_options[PCLZIP_OPT_BY_NAME][$j])) {
+                      $v_found = true;
+                  }
+                  elseif (   (($v_header_list[$v_nb_extracted]['external']&0x00000010)==0x00000010) /* Indicates a folder */
+                          && ($v_header_list[$v_nb_extracted]['stored_filename'].'/' == $p_options[PCLZIP_OPT_BY_NAME][$j])) {
+                      $v_found = true;
+                  }
+              }
+              // ----- Look for a filename
+              elseif ($v_header_list[$v_nb_extracted]['stored_filename'] == $p_options[PCLZIP_OPT_BY_NAME][$j]) {
+                  $v_found = true;
+              }
+          }
+      }
+
+      // ----- Look for extract by ereg rule
+      // ereg() is deprecated with PHP 5.3
+      /*
+      else if (   (isset($p_options[PCLZIP_OPT_BY_EREG]))
+               && ($p_options[PCLZIP_OPT_BY_EREG] != "")) {
+
+          if (ereg($p_options[PCLZIP_OPT_BY_EREG], $v_header_list[$v_nb_extracted]['stored_filename'])) {
+              $v_found = true;
+          }
+      }
+      */
+
+      // ----- Look for extract by preg rule
+      else if (   (isset($p_options[PCLZIP_OPT_BY_PREG]))
+               && ($p_options[PCLZIP_OPT_BY_PREG] != "")) {
+
+          if (preg_match($p_options[PCLZIP_OPT_BY_PREG], $v_header_list[$v_nb_extracted]['stored_filename'])) {
+              $v_found = true;
+          }
+      }
+
+      // ----- Look for extract by index rule
+      else if (   (isset($p_options[PCLZIP_OPT_BY_INDEX]))
+               && ($p_options[PCLZIP_OPT_BY_INDEX] != 0)) {
+
+          // ----- Look if the index is in the list
+          for ($j=$j_start; ($j<sizeof($p_options[PCLZIP_OPT_BY_INDEX])) && (!$v_found); $j++) {
+
+              if (($i>=$p_options[PCLZIP_OPT_BY_INDEX][$j]['start']) && ($i<=$p_options[PCLZIP_OPT_BY_INDEX][$j]['end'])) {
+                  $v_found = true;
+              }
+              if ($i>=$p_options[PCLZIP_OPT_BY_INDEX][$j]['end']) {
+                  $j_start = $j+1;
+              }
+
+              if ($p_options[PCLZIP_OPT_BY_INDEX][$j]['start']>$i) {
+                  break;
+              }
+          }
+      }
+      else {
+      	$v_found = true;
+      }
+
+      // ----- Look for deletion
+      if ($v_found)
+      {
+        unset($v_header_list[$v_nb_extracted]);
+      }
+      else
+      {
+        $v_nb_extracted++;
+      }
+    }
+
+    // ----- Look if something need to be deleted
+    if ($v_nb_extracted > 0) {
+
+        // ----- Creates a temporay file
+        $v_zip_temp_name = PCLZIP_TEMPORARY_DIR.uniqid('pclzip-').'.tmp';
+
+        // ----- Creates a temporary zip archive
+        $v_temp_zip = new PclZip($v_zip_temp_name);
+
+        // ----- Open the temporary zip file in write mode
+        if (($v_result = $v_temp_zip->privOpenFd('wb')) != 1) {
+            $this->privCloseFd();
+
+            // ----- Return
+            return $v_result;
+        }
+
+        // ----- Look which file need to be kept
+        for ($i=0; $i<sizeof($v_header_list); $i++) {
+
+            // ----- Calculate the position of the header
+            @rewind($this->zip_fd);
+            if (@fseek($this->zip_fd,  $v_header_list[$i]['offset'])) {
+                // ----- Close the zip file
+                $this->privCloseFd();
+                $v_temp_zip->privCloseFd();
+                @unlink($v_zip_temp_name);
+
+                // ----- Error log
+                PclZip::privErrorLog(PCLZIP_ERR_INVALID_ARCHIVE_ZIP, 'Invalid archive size');
+
+                // ----- Return
+                return PclZip::errorCode();
+            }
+
+            // ----- Read the file header
+            $v_local_header = array();
+            if (($v_result = $this->privReadFileHeader($v_local_header)) != 1) {
+                // ----- Close the zip file
+                $this->privCloseFd();
+                $v_temp_zip->privCloseFd();
+                @unlink($v_zip_temp_name);
+
+                // ----- Return
+                return $v_result;
+            }
+            
+            // ----- Check that local file header is same as central file header
+            if ($this->privCheckFileHeaders($v_local_header,
+			                                $v_header_list[$i]) != 1) {
+                // TBC
+            }
+            unset($v_local_header);
+
+            // ----- Write the file header
+            if (($v_result = $v_temp_zip->privWriteFileHeader($v_header_list[$i])) != 1) {
+                // ----- Close the zip file
+                $this->privCloseFd();
+                $v_temp_zip->privCloseFd();
+                @unlink($v_zip_temp_name);
+
+                // ----- Return
+                return $v_result;
+            }
+
+            // ----- Read/write the data block
+            if (($v_result = PclZipUtilCopyBlock($this->zip_fd, $v_temp_zip->zip_fd, $v_header_list[$i]['compressed_size'])) != 1) {
+                // ----- Close the zip file
+                $this->privCloseFd();
+                $v_temp_zip->privCloseFd();
+                @unlink($v_zip_temp_name);
+
+                // ----- Return
+                return $v_result;
+            }
+        }
+
+        // ----- Store the offset of the central dir
+        $v_offset = @ftell($v_temp_zip->zip_fd);
+
+        // ----- Re-Create the Central Dir files header
+        for ($i=0; $i<sizeof($v_header_list); $i++) {
+            // ----- Create the file header
+            if (($v_result = $v_temp_zip->privWriteCentralFileHeader($v_header_list[$i])) != 1) {
+                $v_temp_zip->privCloseFd();
+                $this->privCloseFd();
+                @unlink($v_zip_temp_name);
+
+                // ----- Return
+                return $v_result;
+            }
+
+            // ----- Transform the header to a 'usable' info
+            $v_temp_zip->privConvertHeader2FileInfo($v_header_list[$i], $p_result_list[$i]);
+        }
+
+
+        // ----- Zip file comment
+        $v_comment = '';
+        if (isset($p_options[PCLZIP_OPT_COMMENT])) {
+          $v_comment = $p_options[PCLZIP_OPT_COMMENT];
+        }
+
+        // ----- Calculate the size of the central header
+        $v_size = @ftell($v_temp_zip->zip_fd)-$v_offset;
+
+        // ----- Create the central dir footer
+        if (($v_result = $v_temp_zip->privWriteCentralHeader(sizeof($v_header_list), $v_size, $v_offset, $v_comment)) != 1) {
+            // ----- Reset the file list
+            unset($v_header_list);
+            $v_temp_zip->privCloseFd();
+            $this->privCloseFd();
+            @unlink($v_zip_temp_name);
+
+            // ----- Return
+            return $v_result;
+        }
+
+        // ----- Close
+        $v_temp_zip->privCloseFd();
+        $this->privCloseFd();
+
+        // ----- Delete the zip file
+        // TBC : I should test the result ...
+        @unlink($this->zipname);
+
+        // ----- Rename the temporary file
+        // TBC : I should test the result ...
+        //@rename($v_zip_temp_name, $this->zipname);
+        PclZipUtilRename($v_zip_temp_name, $this->zipname);
+    
+        // ----- Destroy the temporary archive
+        unset($v_temp_zip);
+    }
+    
+    // ----- Remove every files : reset the file
+    else if ($v_central_dir['entries'] != 0) {
+        $this->privCloseFd();
+
+        if (($v_result = $this->privOpenFd('wb')) != 1) {
+          return $v_result;
+        }
+
+        if (($v_result = $this->privWriteCentralHeader(0, 0, 0, '')) != 1) {
+          return $v_result;
+        }
+
+        $this->privCloseFd();
+    }
+
+    // ----- Return
+    return $v_result;
+  }
+  // --------------------------------------------------------------------------------
+
+  // --------------------------------------------------------------------------------
+  // Function : privDirCheck()
+  // Description :
+  //   Check if a directory exists, if not it creates it and all the parents directory
+  //   which may be useful.
+  // Parameters :
+  //   $p_dir : Directory path to check.
+  // Return Values :
+  //    1 : OK
+  //   -1 : Unable to create directory
+  // --------------------------------------------------------------------------------
+  function privDirCheck($p_dir, $p_is_dir=false)
+  {
+    $v_result = 1;
+
+
+    // ----- Remove the final '/'
+    if (($p_is_dir) && (substr($p_dir, -1)=='/'))
+    {
+      $p_dir = substr($p_dir, 0, strlen($p_dir)-1);
+    }
+
+    // ----- Check the directory availability
+    if ((is_dir($p_dir)) || ($p_dir == ""))
+    {
+      return 1;
+    }
+
+    // ----- Extract parent directory
+    $p_parent_dir = dirname($p_dir);
+
+    // ----- Just a check
+    if ($p_parent_dir != $p_dir)
+    {
+      // ----- Look for parent directory
+      if ($p_parent_dir != "")
+      {
+        if (($v_result = $this->privDirCheck($p_parent_dir)) != 1)
+        {
+          return $v_result;
+        }
+      }
+    }
+
+    // ----- Create the directory
+    if (!@mkdir($p_dir, 0777))
+    {
+      // ----- Error log
+      PclZip::privErrorLog(PCLZIP_ERR_DIR_CREATE_FAIL, "Unable to create directory '$p_dir'");
+
+      // ----- Return
+      return PclZip::errorCode();
+    }
+
+    // ----- Return
+    return $v_result;
+  }
+  // --------------------------------------------------------------------------------
+
+  // --------------------------------------------------------------------------------
+  // Function : privMerge()
+  // Description :
+  //   If $p_archive_to_add does not exist, the function exit with a success result.
+  // Parameters :
+  // Return Values :
+  // --------------------------------------------------------------------------------
+  function privMerge(&$p_archive_to_add)
+  {
+    $v_result=1;
+
+    // ----- Look if the archive_to_add exists
+    if (!is_file($p_archive_to_add->zipname))
+    {
+
+      // ----- Nothing to merge, so merge is a success
+      $v_result = 1;
+
+      // ----- Return
+      return $v_result;
+    }
+
+    // ----- Look if the archive exists
+    if (!is_file($this->zipname))
+    {
+
+      // ----- Do a duplicate
+      $v_result = $this->privDuplicate($p_archive_to_add->zipname);
+
+      // ----- Return
+      return $v_result;
+    }
+
+    // ----- Open the zip file
+    if (($v_result=$this->privOpenFd('rb')) != 1)
+    {
+      // ----- Return
+      return $v_result;
+    }
+
+    // ----- Read the central directory informations
+    $v_central_dir = array();
+    if (($v_result = $this->privReadEndCentralDir($v_central_dir)) != 1)
+    {
+      $this->privCloseFd();
+      return $v_result;
+    }
+
+    // ----- Go to beginning of File
+    @rewind($this->zip_fd);
+
+    // ----- Open the archive_to_add file
+    if (($v_result=$p_archive_to_add->privOpenFd('rb')) != 1)
+    {
+      $this->privCloseFd();
+
+      // ----- Return
+      return $v_result;
+    }
+
+    // ----- Read the central directory informations
+    $v_central_dir_to_add = array();
+    if (($v_result = $p_archive_to_add->privReadEndCentralDir($v_central_dir_to_add)) != 1)
+    {
+      $this->privCloseFd();
+      $p_archive_to_add->privCloseFd();
+
+      return $v_result;
+    }
+
+    // ----- Go to beginning of File
+    @rewind($p_archive_to_add->zip_fd);
+
+    // ----- Creates a temporay file
+    $v_zip_temp_name = PCLZIP_TEMPORARY_DIR.uniqid('pclzip-').'.tmp';
+
+    // ----- Open the temporary file in write mode
+    if (($v_zip_temp_fd = @fopen($v_zip_temp_name, 'wb')) == 0)
+    {
+      $this->privCloseFd();
+      $p_archive_to_add->privCloseFd();
+
+      PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open temporary file \''.$v_zip_temp_name.'\' in binary write mode');
+
+      // ----- Return
+      return PclZip::errorCode();
+    }
+
+    // ----- Copy the files from the archive to the temporary file
+    // TBC : Here I should better append the file and go back to erase the central dir
+    $v_size = $v_central_dir['offset'];
+    while ($v_size != 0)
+    {
+      $v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE);
+      $v_buffer = fread($this->zip_fd, $v_read_size);
+      @fwrite($v_zip_temp_fd, $v_buffer, $v_read_size);
+      $v_size -= $v_read_size;
+    }
+
+    // ----- Copy the files from the archive_to_add into the temporary file
+    $v_size = $v_central_dir_to_add['offset'];
+    while ($v_size != 0)
+    {
+      $v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE);
+      $v_buffer = fread($p_archive_to_add->zip_fd, $v_read_size);
+      @fwrite($v_zip_temp_fd, $v_buffer, $v_read_size);
+      $v_size -= $v_read_size;
+    }
+
+    // ----- Store the offset of the central dir
+    $v_offset = @ftell($v_zip_temp_fd);
+
+    // ----- Copy the block of file headers from the old archive
+    $v_size = $v_central_dir['size'];
+    while ($v_size != 0)
+    {
+      $v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE);
+      $v_buffer = @fread($this->zip_fd, $v_read_size);
+      @fwrite($v_zip_temp_fd, $v_buffer, $v_read_size);
+      $v_size -= $v_read_size;
+    }
+
+    // ----- Copy the block of file headers from the archive_to_add
+    $v_size = $v_central_dir_to_add['size'];
+    while ($v_size != 0)
+    {
+      $v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE);
+      $v_buffer = @fread($p_archive_to_add->zip_fd, $v_read_size);
+      @fwrite($v_zip_temp_fd, $v_buffer, $v_read_size);
+      $v_size -= $v_read_size;
+    }
+
+    // ----- Merge the file comments
+    $v_comment = $v_central_dir['comment'].' '.$v_central_dir_to_add['comment'];
+
+    // ----- Calculate the size of the (new) central header
+    $v_size = @ftell($v_zip_temp_fd)-$v_offset;
+
+    // ----- Swap the file descriptor
+    // Here is a trick : I swap the temporary fd with the zip fd, in order to use
+    // the following methods on the temporary fil and not the real archive fd
+    $v_swap = $this->zip_fd;
+    $this->zip_fd = $v_zip_temp_fd;
+    $v_zip_temp_fd = $v_swap;
+
+    // ----- Create the central dir footer
+    if (($v_result = $this->privWriteCentralHeader($v_central_dir['entries']+$v_central_dir_to_add['entries'], $v_size, $v_offset, $v_comment)) != 1)
+    {
+      $this->privCloseFd();
+      $p_archive_to_add->privCloseFd();
+      @fclose($v_zip_temp_fd);
+      $this->zip_fd = null;
+
+      // ----- Reset the file list
+      unset($v_header_list);
+
+      // ----- Return
+      return $v_result;
+    }
+
+    // ----- Swap back the file descriptor
+    $v_swap = $this->zip_fd;
+    $this->zip_fd = $v_zip_temp_fd;
+    $v_zip_temp_fd = $v_swap;
+
+    // ----- Close
+    $this->privCloseFd();
+    $p_archive_to_add->privCloseFd();
+
+    // ----- Close the temporary file
+    @fclose($v_zip_temp_fd);
+
+    // ----- Delete the zip file
+    // TBC : I should test the result ...
+    @unlink($this->zipname);
+
+    // ----- Rename the temporary file
+    // TBC : I should test the result ...
+    //@rename($v_zip_temp_name, $this->zipname);
+    PclZipUtilRename($v_zip_temp_name, $this->zipname);
+
+    // ----- Return
+    return $v_result;
+  }
+  // --------------------------------------------------------------------------------
+
+  // --------------------------------------------------------------------------------
+  // Function : privDuplicate()
+  // Description :
+  // Parameters :
+  // Return Values :
+  // --------------------------------------------------------------------------------
+  function privDuplicate($p_archive_filename)
+  {
+    $v_result=1;
+
+    // ----- Look if the $p_archive_filename exists
+    if (!is_file($p_archive_filename))
+    {
+
+      // ----- Nothing to duplicate, so duplicate is a success.
+      $v_result = 1;
+
+      // ----- Return
+      return $v_result;
+    }
+
+    // ----- Open the zip file
+    if (($v_result=$this->privOpenFd('wb')) != 1)
+    {
+      // ----- Return
+      return $v_result;
+    }
+
+    // ----- Open the temporary file in write mode
+    if (($v_zip_temp_fd = @fopen($p_archive_filename, 'rb')) == 0)
+    {
+      $this->privCloseFd();
+
+      PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open archive file \''.$p_archive_filename.'\' in binary write mode');
+
+      // ----- Return
+      return PclZip::errorCode();
+    }
+
+    // ----- Copy the files from the archive to the temporary file
+    // TBC : Here I should better append the file and go back to erase the central dir
+    $v_size = filesize($p_archive_filename);
+    while ($v_size != 0)
+    {
+      $v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE);
+      $v_buffer = fread($v_zip_temp_fd, $v_read_size);
+      @fwrite($this->zip_fd, $v_buffer, $v_read_size);
+      $v_size -= $v_read_size;
+    }
+
+    // ----- Close
+    $this->privCloseFd();
+
+    // ----- Close the temporary file
+    @fclose($v_zip_temp_fd);
+
+    // ----- Return
+    return $v_result;
+  }
+  // --------------------------------------------------------------------------------
+
+  // --------------------------------------------------------------------------------
+  // Function : privErrorLog()
+  // Description :
+  // Parameters :
+  // --------------------------------------------------------------------------------
+  function privErrorLog($p_error_code=0, $p_error_string='')
+  {
+    if (PCLZIP_ERROR_EXTERNAL == 1) {
+      PclError($p_error_code, $p_error_string);
+    }
+    else {
+      $this->error_code = $p_error_code;
+      $this->error_string = $p_error_string;
+    }
+  }
+  // --------------------------------------------------------------------------------
+
+  // --------------------------------------------------------------------------------
+  // Function : privErrorReset()
+  // Description :
+  // Parameters :
+  // --------------------------------------------------------------------------------
+  function privErrorReset()
+  {
+    if (PCLZIP_ERROR_EXTERNAL == 1) {
+      PclErrorReset();
+    }
+    else {
+      $this->error_code = 0;
+      $this->error_string = '';
+    }
+  }
+  // --------------------------------------------------------------------------------
+
+  // --------------------------------------------------------------------------------
+  // Function : privDisableMagicQuotes()
+  // Description :
+  // Parameters :
+  // Return Values :
+  // --------------------------------------------------------------------------------
+  function privDisableMagicQuotes()
+  {
+    $v_result=1;
+
+    // ----- Look if function exists
+    if (   (!function_exists("get_magic_quotes_runtime"))
+	    || (!function_exists("set_magic_quotes_runtime"))) {
+      return $v_result;
+	}
+
+    // ----- Look if already done
+    if ($this->magic_quotes_status != -1) {
+      return $v_result;
+	}
+
+	// ----- Get and memorize the magic_quote value
+	$this->magic_quotes_status = @get_magic_quotes_runtime();
+
+	// ----- Disable magic_quotes
+	if ($this->magic_quotes_status == 1) {
+	  @set_magic_quotes_runtime(0);
+	}
+
+    // ----- Return
+    return $v_result;
+  }
+  // --------------------------------------------------------------------------------
+
+  // --------------------------------------------------------------------------------
+  // Function : privSwapBackMagicQuotes()
+  // Description :
+  // Parameters :
+  // Return Values :
+  // --------------------------------------------------------------------------------
+  function privSwapBackMagicQuotes()
+  {
+    $v_result=1;
+
+    // ----- Look if function exists
+    if (   (!function_exists("get_magic_quotes_runtime"))
+	    || (!function_exists("set_magic_quotes_runtime"))) {
+      return $v_result;
+	}
+
+    // ----- Look if something to do
+    if ($this->magic_quotes_status != -1) {
+      return $v_result;
+	}
+
+	// ----- Swap back magic_quotes
+	if ($this->magic_quotes_status == 1) {
+  	  @set_magic_quotes_runtime($this->magic_quotes_status);
+	}
+
+    // ----- Return
+    return $v_result;
+  }
+  // --------------------------------------------------------------------------------
+
+  }
+  // End of class
+  // --------------------------------------------------------------------------------
+
+  // --------------------------------------------------------------------------------
+  // Function : PclZipUtilPathReduction()
+  // Description :
+  // Parameters :
+  // Return Values :
+  // --------------------------------------------------------------------------------
+  function PclZipUtilPathReduction($p_dir)
+  {
+    $v_result = "";
+
+    // ----- Look for not empty path
+    if ($p_dir != "") {
+      // ----- Explode path by directory names
+      $v_list = explode("/", $p_dir);
+
+      // ----- Study directories from last to first
+      $v_skip = 0;
+      for ($i=sizeof($v_list)-1; $i>=0; $i--) {
+        // ----- Look for current path
+        if ($v_list[$i] == ".") {
+          // ----- Ignore this directory
+          // Should be the first $i=0, but no check is done
+        }
+        else if ($v_list[$i] == "..") {
+		  $v_skip++;
+        }
+        else if ($v_list[$i] == "") {
+		  // ----- First '/' i.e. root slash
+		  if ($i == 0) {
+            $v_result = "/".$v_result;
+		    if ($v_skip > 0) {
+		        // ----- It is an invalid path, so the path is not modified
+		        // TBC
+		        $v_result = $p_dir;
+                $v_skip = 0;
+		    }
+		  }
+		  // ----- Last '/' i.e. indicates a directory
+		  else if ($i == (sizeof($v_list)-1)) {
+            $v_result = $v_list[$i];
+		  }
+		  // ----- Double '/' inside the path
+		  else {
+            // ----- Ignore only the double '//' in path,
+            // but not the first and last '/'
+		  }
+        }
+        else {
+		  // ----- Look for item to skip
+		  if ($v_skip > 0) {
+		    $v_skip--;
+		  }
+		  else {
+            $v_result = $v_list[$i].($i!=(sizeof($v_list)-1)?"/".$v_result:"");
+		  }
+        }
+      }
+      
+      // ----- Look for skip
+      if ($v_skip > 0) {
+        while ($v_skip > 0) {
+            $v_result = '../'.$v_result;
+            $v_skip--;
+        }
+      }
+    }
+
+    // ----- Return
+    return $v_result;
+  }
+  // --------------------------------------------------------------------------------
+
+  // --------------------------------------------------------------------------------
+  // Function : PclZipUtilPathInclusion()
+  // Description :
+  //   This function indicates if the path $p_path is under the $p_dir tree. Or,
+  //   said in an other way, if the file or sub-dir $p_path is inside the dir
+  //   $p_dir.
+  //   The function indicates also if the path is exactly the same as the dir.
+  //   This function supports path with duplicated '/' like '//', but does not
+  //   support '.' or '..' statements.
+  // Parameters :
+  // Return Values :
+  //   0 if $p_path is not inside directory $p_dir
+  //   1 if $p_path is inside directory $p_dir
+  //   2 if $p_path is exactly the same as $p_dir
+  // --------------------------------------------------------------------------------
+  function PclZipUtilPathInclusion($p_dir, $p_path)
+  {
+    $v_result = 1;
+    
+    // ----- Look for path beginning by ./
+    if (   ($p_dir == '.')
+        || ((strlen($p_dir) >=2) && (substr($p_dir, 0, 2) == './'))) {
+      $p_dir = PclZipUtilTranslateWinPath(getcwd(), FALSE).'/'.substr($p_dir, 1);
+    }
+    if (   ($p_path == '.')
+        || ((strlen($p_path) >=2) && (substr($p_path, 0, 2) == './'))) {
+      $p_path = PclZipUtilTranslateWinPath(getcwd(), FALSE).'/'.substr($p_path, 1);
+    }
+
+    // ----- Explode dir and path by directory separator
+    $v_list_dir = explode("/", $p_dir);
+    $v_list_dir_size = sizeof($v_list_dir);
+    $v_list_path = explode("/", $p_path);
+    $v_list_path_size = sizeof($v_list_path);
+
+    // ----- Study directories paths
+    $i = 0;
+    $j = 0;
+    while (($i < $v_list_dir_size) && ($j < $v_list_path_size) && ($v_result)) {
+
+      // ----- Look for empty dir (path reduction)
+      if ($v_list_dir[$i] == '') {
+        $i++;
+        continue;
+      }
+      if ($v_list_path[$j] == '') {
+        $j++;
+        continue;
+      }
+
+      // ----- Compare the items
+      if (($v_list_dir[$i] != $v_list_path[$j]) && ($v_list_dir[$i] != '') && ( $v_list_path[$j] != ''))  {
+        $v_result = 0;
+      }
+
+      // ----- Next items
+      $i++;
+      $j++;
+    }
+
+    // ----- Look if everything seems to be the same
+    if ($v_result) {
+      // ----- Skip all the empty items
+      while (($j < $v_list_path_size) && ($v_list_path[$j] == '')) $j++;
+      while (($i < $v_list_dir_size) && ($v_list_dir[$i] == '')) $i++;
+
+      if (($i >= $v_list_dir_size) && ($j >= $v_list_path_size)) {
+        // ----- There are exactly the same
+        $v_result = 2;
+      }
+      else if ($i < $v_list_dir_size) {
+        // ----- The path is shorter than the dir
+        $v_result = 0;
+      }
+    }
+
+    // ----- Return
+    return $v_result;
+  }
+  // --------------------------------------------------------------------------------
+
+  // --------------------------------------------------------------------------------
+  // Function : PclZipUtilCopyBlock()
+  // Description :
+  // Parameters :
+  //   $p_mode : read/write compression mode
+  //             0 : src & dest normal
+  //             1 : src gzip, dest normal
+  //             2 : src normal, dest gzip
+  //             3 : src & dest gzip
+  // Return Values :
+  // --------------------------------------------------------------------------------
+  function PclZipUtilCopyBlock($p_src, $p_dest, $p_size, $p_mode=0)
+  {
+    $v_result = 1;
+
+    if ($p_mode==0)
+    {
+      while ($p_size != 0)
+      {
+        $v_read_size = ($p_size < PCLZIP_READ_BLOCK_SIZE ? $p_size : PCLZIP_READ_BLOCK_SIZE);
+        $v_buffer = @fread($p_src, $v_read_size);
+        @fwrite($p_dest, $v_buffer, $v_read_size);
+        $p_size -= $v_read_size;
+      }
+    }
+    else if ($p_mode==1)
+    {
+      while ($p_size != 0)
+      {
+        $v_read_size = ($p_size < PCLZIP_READ_BLOCK_SIZE ? $p_size : PCLZIP_READ_BLOCK_SIZE);
+        $v_buffer = @gzread($p_src, $v_read_size);
+        @fwrite($p_dest, $v_buffer, $v_read_size);
+        $p_size -= $v_read_size;
+      }
+    }
+    else if ($p_mode==2)
+    {
+      while ($p_size != 0)
+      {
+        $v_read_size = ($p_size < PCLZIP_READ_BLOCK_SIZE ? $p_size : PCLZIP_READ_BLOCK_SIZE);
+        $v_buffer = @fread($p_src, $v_read_size);
+        @gzwrite($p_dest, $v_buffer, $v_read_size);
+        $p_size -= $v_read_size;
+      }
+    }
+    else if ($p_mode==3)
+    {
+      while ($p_size != 0)
+      {
+        $v_read_size = ($p_size < PCLZIP_READ_BLOCK_SIZE ? $p_size : PCLZIP_READ_BLOCK_SIZE);
+        $v_buffer = @gzread($p_src, $v_read_size);
+        @gzwrite($p_dest, $v_buffer, $v_read_size);
+        $p_size -= $v_read_size;
+      }
+    }
+
+    // ----- Return
+    return $v_result;
+  }
+  // --------------------------------------------------------------------------------
+
+  // --------------------------------------------------------------------------------
+  // Function : PclZipUtilRename()
+  // Description :
+  //   This function tries to do a simple rename() function. If it fails, it
+  //   tries to copy the $p_src file in a new $p_dest file and then unlink the
+  //   first one.
+  // Parameters :
+  //   $p_src : Old filename
+  //   $p_dest : New filename
+  // Return Values :
+  //   1 on success, 0 on failure.
+  // --------------------------------------------------------------------------------
+  function PclZipUtilRename($p_src, $p_dest)
+  {
+    $v_result = 1;
+
+    // ----- Try to rename the files
+    if (!@rename($p_src, $p_dest)) {
+
+      // ----- Try to copy & unlink the src
+      if (!@copy($p_src, $p_dest)) {
+        $v_result = 0;
+      }
+      else if (!@unlink($p_src)) {
+        $v_result = 0;
+      }
+    }
+
+    // ----- Return
+    return $v_result;
+  }
+  // --------------------------------------------------------------------------------
+
+  // --------------------------------------------------------------------------------
+  // Function : PclZipUtilOptionText()
+  // Description :
+  //   Translate option value in text. Mainly for debug purpose.
+  // Parameters :
+  //   $p_option : the option value.
+  // Return Values :
+  //   The option text value.
+  // --------------------------------------------------------------------------------
+  function PclZipUtilOptionText($p_option)
+  {
+    
+    $v_list = get_defined_constants();
+    for (reset($v_list); $v_key = key($v_list); next($v_list)) {
+	    $v_prefix = substr($v_key, 0, 10);
+	    if ((   ($v_prefix == 'PCLZIP_OPT')
+           || ($v_prefix == 'PCLZIP_CB_')
+           || ($v_prefix == 'PCLZIP_ATT'))
+	        && ($v_list[$v_key] == $p_option)) {
+        return $v_key;
+	    }
+    }
+    
+    $v_result = 'Unknown';
+
+    return $v_result;
+  }
+  // --------------------------------------------------------------------------------
+
+  // --------------------------------------------------------------------------------
+  // Function : PclZipUtilTranslateWinPath()
+  // Description :
+  //   Translate windows path by replacing '\' by '/' and optionally removing
+  //   drive letter.
+  // Parameters :
+  //   $p_path : path to translate.
+  //   $p_remove_disk_letter : true | false
+  // Return Values :
+  //   The path translated.
+  // --------------------------------------------------------------------------------
+  function PclZipUtilTranslateWinPath($p_path, $p_remove_disk_letter=true)
+  {
+    if (stristr(php_uname(), 'windows')) {
+      // ----- Look for potential disk letter
+      if (($p_remove_disk_letter) && (($v_position = strpos($p_path, ':')) != false)) {
+          $p_path = substr($p_path, $v_position+1);
+      }
+      // ----- Change potential windows directory separator
+      if ((strpos($p_path, '\\') > 0) || (substr($p_path, 0,1) == '\\')) {
+          $p_path = strtr($p_path, '\\', '/');
+      }
+    }
+    return $p_path;
+  }
+  // --------------------------------------------------------------------------------
+
+
+?>
diff -x .svn -aruN 0.7.24.src/e107_handlers/phpmailer/e107.htaccess 0.7.26.src/e107_handlers/phpmailer/e107.htaccess
--- 0.7.24.src/e107_handlers/phpmailer/e107.htaccess	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_handlers/phpmailer/e107.htaccess	2011-04-07 14:28:18.000000000 -0500
@@ -1 +1,3 @@
-mod_gzip_on Off
\ No newline at end of file
+<FilesMatch \.php$>
+    SetEnv no-gzip 1
+</FilesMatch>
\ No newline at end of file
diff -x .svn -aruN 0.7.24.src/e107_handlers/phpmailer/mailout_process.php 0.7.26.src/e107_handlers/phpmailer/mailout_process.php
--- 0.7.24.src/e107_handlers/phpmailer/mailout_process.php	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_handlers/phpmailer/mailout_process.php	2011-06-28 20:09:22.000000000 -0500
@@ -11,8 +11,8 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $URL: https://e107.svn.sourceforge.net/svnroot/e107/trunk/e107_0.7/e107_handlers/phpmailer/mailout_process.php $
-|     $Revision: 11678 $
-|     $Id: mailout_process.php 11678 2010-08-22 00:43:45Z e107coders $
+|     $Revision: 12290 $
+|     $Id: mailout_process.php 12290 2011-06-29 01:09:46Z e107coders $
 |     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
@@ -25,6 +25,7 @@
 define("e_PAGETITLE",MAILAN_60);
 require_once(HEADERF);
 set_time_limit(18000);
+ignore_user_abort(true);
 session_write_close();
 
 
@@ -212,8 +213,8 @@
 		$activator = (substr(SITEURL, -1) == "/" ? SITEURL."signup.php?activate.".$row['user_id'].".".$row['user_sess'] : SITEURL."/signup.php?activate.".$row['user_id'].".".$row['user_sess']);
         $signup_link = ($row['user_sess']) ? "<a href='$activator'>$activator</a>" : "";
 
-		$search = array("|USERNAME|","|USERID|","|SIGNUP_LINK|");
-		$replace = array($row['user_name'],$row['user_id'],$signup_link);
+		$search = array("|USERNAME|","|USERID|","|SIGNUP_LINK|","|USER_LOGIN|","|USER_EMAIL|");
+		$replace = array($row['user_name'],$row['user_id'],$signup_link,$row['user_loginname'],$row['user_email']);
 
         $mes_body = str_replace($search,$replace,$message_body);
 		$alt_body = str_replace($search,$replace,stripslashes($tp->toText($_POST['email_body'])));
diff -x .svn -aruN 0.7.24.src/e107_handlers/profanity_filter.php 0.7.26.src/e107_handlers/profanity_filter.php
--- 0.7.24.src/e107_handlers/profanity_filter.php	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_handlers/profanity_filter.php	2011-02-26 17:07:02.000000000 -0600
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $URL: https://e107.svn.sourceforge.net/svnroot/e107/trunk/e107_0.7/e107_handlers/profanity_filter.php $
-|     $Revision: 11678 $
-|     $Id: profanity_filter.php 11678 2010-08-22 00:43:45Z e107coders $
-|     $Author: e107coders $
+|     $Revision: 12080 $
+|     $Id: profanity_filter.php 12080 2011-02-26 23:07:26Z e107steved $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 
@@ -35,6 +35,10 @@
 			if($word != "")
 			{
 				$word_array[] = $word;
+				if (strpos($word, '&#036;') !== FALSE)
+				{
+					$word_array[] = str_replace('&#036;', '\$', $word);		// Special case - '$' may be 'in clear' or as entity
+				}
 			}
 		}
 		if(count($word_array))
diff -x .svn -aruN 0.7.24.src/e107_handlers/ren_help.php 0.7.26.src/e107_handlers/ren_help.php
--- 0.7.24.src/e107_handlers/ren_help.php	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_handlers/ren_help.php	2011-01-21 20:14:03.000000000 -0600
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $URL: https://e107.svn.sourceforge.net/svnroot/e107/trunk/e107_0.7/e107_handlers/ren_help.php $
-|     $Revision: 11759 $
-|     $Id: ren_help.php 11759 2010-09-07 13:00:58Z e107steved $
-|     $Author: e107steved $
+|     $Revision: 12055 $
+|     $Id: ren_help.php 12055 2011-01-22 02:14:27Z e107coders $
+|     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
 
@@ -99,7 +99,7 @@
 	$text .="<div style='position:absolute; bottom:30px; right:125px'>";
 	$text .= "<table class='fborder' style='background-color: #fff'>
 	<tr><td class='forumheader3'>
-	<select class='tbox' name='preimageselect' onchange=\"addtext(this.value); expandit('{$formid}')\">
+	<select class='tbox bb-sizeselect' name='sizeselect' onchange=\"addtext(this.value); expandit('{$formid}')\">
 	<option value=''>".LANHELP_41."</option>";
 
 	$sizes = array(7,8,9,10,11,12,14,15,18,20,22,24,26,28,30,36);
@@ -199,9 +199,9 @@
     sort($imagelist);
 
 	$text ="<!-- Start of PreImage selector -->
-	<div style='margin-left:0px;margin-right:0px; position:relative;z-index:1000;float:right;display:none' id='{$formid}'>";
+	<div class='bb-preimageselect' style='margin-left:0px;margin-right:100px; position:relative;z-index:999;float:right;display:none' id='{$formid}'>";
 	$text .="<div style='position:absolute; bottom:30px; right:100px'>";
-	$text .= "<table class='fborder' style='background-color: #fff'>
+	$text .= "<table class='fborder bb-preimageselect' style='background-color: #fff'>
 	<tr><td class='forumheader3' style='white-space: nowrap'>";
 
 	if(!count($imagelist))
@@ -211,7 +211,7 @@
 	}
 	else
 	{
-		$text .= "<select class='tbox' name='preimageselect' onchange=\"addtext(this.value, true); expandit('{$formid}')\">
+		$text .= "<select class='tbox bb-preimageselect' name='preimageselect' onchange=\"addtext(this.value, true); expandit('{$formid}')\">
 		<option value=''>".LANHELP_42."</option>";
 		foreach($imagelist as $image)
 		{
@@ -223,21 +223,23 @@
 				if(file_exists($path.$fi))
 				{
 					// thumb and main image found
-					$text .= "<option value=\"[link=".$e_path.$fi."][img]".$e_path.$image['fname']."[/img][/link]\">".$showpath.$image['fname']." (".LANHELP_38.")</option>\n
+					$text .= "<option value=\"[link=".$e_path.$fi."][img]".$e_path.$image['fname']."[/img][/link]\">".$tp->text_truncate($showpath.$image['fname'],50)." **</option>\n
 					";
 				}
 				else
 				{
-					$text .= "<option value=\"[img]".$e_path.$image['fname']."[/img]\">".$showpath.$image['fname']."</option>\n
+					$text .= "<option value=\"[img]".$e_path.$image['fname']."[/img]\">".$tp->text_truncate($showpath.$image['fname'],50)."</option>\n
 					";
 				}
 			}
 			else
 			{
-				$text .= "<option value=\"[img]".$e_path.$image['fname']."[/img]\">".$showpath.$image['fname']."</option>\n";
+				$text .= "<option value=\"[img]".$e_path.$image['fname']."[/img]\">".$tp->text_truncate($showpath.$image['fname'],50)."</option>\n";
 			}
 		}
 		$text .="</select>";
+		$text .= "<div style='padding:5px;text-align:center'>** = ".LANHELP_38."
+		<a style='float:right' href=\"javascript:expandit('{$formid}')\">X</a></div>";
 	}
 	$text .="</td></tr>	\n </table></div>
 	</div>\n<!-- End of PreImage selector -->\n";
@@ -271,9 +273,9 @@
 		}
 	}
 	$text ="<!-- Start of PreFile selector -->
-	<div style='margin-left:0px;margin-right:0px; position:relative;z-index:1000;float:right;display:none' id='{$formid}'>";
+	<div class='bb-prefileselect' style='margin-left:0px;margin-right:100px; position:relative;z-index:1000;float:right;display:none' id='{$formid}'>";
 	$text .="<div style='position:absolute; bottom:30px; right:75px'>";
-	$text .= "<table class='fborder' style='background-color: #fff'>
+	$text .= "<table class='fborder bb-prefileselect' style='background-color: #fff'>
 	<tr><td class='forumheader3' style='white-space: nowrap'>";
 
 
@@ -283,7 +285,7 @@
 	}
 	else
 	{
-		$text .= "<select class='tbox' name='prefileselect' onchange=\"addtext(this.value); expandit('{$formid}')\">
+		$text .= "<select class='tbox bb-prefileselect' name='prefileselect' onchange=\"addtext(this.value); expandit('{$formid}')\">
 				<option value=''>".LANHELP_43."</option>";
 		foreach($filelist as $file)
 		{
@@ -308,7 +310,8 @@
 			}
 
 		}
-		$text .="</select>";
+		$text .="</select><br />";
+		$text .= "<a style='float:right' href=\"javascript:expandit('{$formid}')\">X</a>";
 	}
 
 	$text .="</td></tr>	\n </table></div>
diff -x .svn -aruN 0.7.24.src/e107_handlers/secure_img_handler.php 0.7.26.src/e107_handlers/secure_img_handler.php
--- 0.7.24.src/e107_handlers/secure_img_handler.php	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_handlers/secure_img_handler.php	2011-07-07 21:54:43.000000000 -0500
@@ -11,36 +11,55 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $URL: https://e107.svn.sourceforge.net/svnroot/e107/trunk/e107_0.7/e107_handlers/secure_img_handler.php $
-|     $Revision: 11678 $
-|     $Id: secure_img_handler.php 11678 2010-08-22 00:43:45Z e107coders $
+|     $Revision: 12314 $
+|     $Id: secure_img_handler.php 12314 2011-07-08 02:55:07Z e107coders $
 |     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
 
 if (!defined('e107_INIT')) { exit; }
 
-class secure_image {
+
+class secure_image
+{
 	var $random_number;
+	var $HANDLERS_DIRECTORY;
+	var $IMAGES_DIRECTORY;
+	var $MYSQL_INFO;
+	var $THIS_DIR;
+	var $BASE_DIR;
 
-	function secure_image() {
+	function secure_image()
+	{
 		list($usec, $sec) = explode(" ", microtime());
 		$this->random_number = str_replace(".", "", $sec.$usec);
+
+		$imgp = dirname(__FILE__);
+		if (substr($imgp,-1,1) != DIRECTORY_SEPARATOR) $imgp .= DIRECTORY_SEPARATOR;
+		$imgp = str_replace('/', DIRECTORY_SEPARATOR, $imgp);
+		@include($imgp.'..'.DIRECTORY_SEPARATOR.'e107_config.php');
+		if(!isset($mySQLserver))
+		{
+			if(defined('e_DEBUG'))
+			{
+				echo "FAILED TO LOAD e107_config.php in secure_img_handler.php";
+			}
+			exit;
+		}
+
+		$this->THIS_DIR 			= $imgp;
+		$this->BASE_DIR 			= realpath($imgp.'..'.DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR;
+		$this->HANDLERS_DIRECTORY 	= $HANDLERS_DIRECTORY;
+		$this->IMAGES_DIRECTORY 	= str_replace('/', DIRECTORY_SEPARATOR, $IMAGES_DIRECTORY);
+		$this->MYSQL_INFO = array('db' => $mySQLdefaultdb, 'server' => $mySQLserver, 'user' => $mySQLuser, 'password' => $mySQLpassword, 'prefix' => $mySQLprefix);
 	}
 
-	function create_code() {
-		global $pref, $sql, $IMAGES_DIRECTORY, $HANDLERS_DIRECTORY;
 
-/*
-		require_once('e107_class.php');
-		$e107 = new e107(false, false);
-		$e107->set_paths();
+	function create_code()
+	{
+		global $pref, $sql;
 
-		$imgpy = str_replace($HANDLERS_DIRECTORY, "", $e107->file_path);
-*/
-		$imgp = dirname(__FILE__);
-		if (substr($imgp,-1,1) != '/') $imgp .= '/';
-		if (!isset($HANDLERS_DIRECTORY)) require_once($imgp.'../e107_config.php');
-		$imgp = str_replace($HANDLERS_DIRECTORY,$IMAGES_DIRECTORY,$imgp);
+		//$imgp = addslashes($this->BASE_DIR.$this->IMAGES_DIRECTORY); // removed
 
 		mt_srand ((double)microtime() * 1000000);
 		$maxran = 1000000;
@@ -50,25 +69,168 @@
 		$code = substr($rcode, 2, 6);
 		$recnum = $this->random_number;
 		$del_time = time()+1200;
-		$sql->db_Insert("tmp", "'{$recnum}',{$del_time},'{$code},{$imgp}'");
+		//$sql->db_Insert("tmp", "'{$recnum}',{$del_time},'{$code},{$imgp}'"); // unsure why $imgp is included here
+		$sql->db_Insert("tmp", "'{$recnum}',{$del_time},'{$code}'"); // $imgp removed
 		return $recnum;
 	}
 
-	function verify_code($rec_num, $checkstr) {
+
+	function verify_code($rec_num, $checkstr)
+	{
 		global $sql, $tp;
-		if ($sql->db_Select("tmp", "tmp_info", "tmp_ip = '".$tp -> toDB($rec_num)."'")) {
-			$row = $sql->db_Fetch();
+
+		if(!is_numeric($rec_num))
+		{
+			return FALSE;
+		}
+		
+		if ($sql->db_Select("tmp", "tmp_info", "tmp_ip = '".$tp -> toDB($rec_num)."'"))
+		{
+			$row = $sql->db_Fetch(MYSQL_ASSOC);
 			$sql->db_Delete("tmp", "tmp_ip = '".$tp -> toDB($rec_num)."'");
-			list($code, $path) = explode(",", $row[0]);
+			//list($code, $path) = explode(",", $row['tmp_ip']);
+			$code = intval($row['tmp_info']);
 			return ($checkstr == $code);
 		}
+
 		return FALSE;
 	}
 
-	function r_image() {
-		global $HANDLERS_DIRECTORY;
+
+	/**
+	 * Render Img Tag
+	 */
+	function r_image()
+	{
 		$code = $this->create_code();
-		return "<img src='".e_BASE.$HANDLERS_DIRECTORY."secure_img_render.php?{$code}' alt='' />";
+		return "<img src='".e_HTTP.$this->HANDLERS_DIRECTORY."secure_img_render.php?{$code}' alt='' />";
 	}
+
+
+
+	/**
+	 * Render the generated Image. Called without class2 environment (standalone).
+	 */
+	function render($qcode)
+	{
+		if(!is_numeric($qcode)){ exit; }
+		$recnum = preg_replace('#\D#',"",$qcode);
+
+		$imgtypes = array('jpg'=>"jpeg",'png'=>"png",'gif'=>"gif");
+
+		@mysql_connect($this->MYSQL_INFO['server'], $this->MYSQL_INFO['user'],  $this->MYSQL_INFO['password']) || die('db connection failed');
+		@mysql_select_db($this->MYSQL_INFO['db']);
+
+		$result = mysql_query("SELECT tmp_info FROM {$this->MYSQL_INFO['prefix']}tmp WHERE tmp_ip = '{$recnum}'");
+		if(!$result || !($row = mysql_fetch_array($result, MYSQL_ASSOC)))
+		{
+			// echo "Render Failed";
+			// echo "SELECT tmp_info FROM {$this->MYSQL_INFO['prefix']}tmp WHERE tmp_ip = '{$recnum}'";
+			exit;
+		}
+
+		$code = intval($row['tmp_info']); // new value
+
+		$type = "none";
+
+		foreach($imgtypes as $k=>$t)
+		{
+			if(function_exists("imagecreatefrom".$t))
+			{
+				$ext = ".".$k;
+				$type = $t;
+				break;
+			}
+		}
+
+		$path = $this->BASE_DIR.$this->IMAGES_DIRECTORY;
+		$secureimg = array();
+
+		if(is_readable($path."secure_image_custom.php"))
+		{
+
+			require_once($path."secure_image_custom.php");
+			/*   Example secure_image_custom.php file:
+
+			$secureimg['image'] = "code_bg_custom";  // filename excluding the .ext
+			$secureimg['size']	= "15";
+			$secureimg['angle']	= "0";
+			$secureimg['x']		= "6";
+			$secureimg['y']		= "22";
+			$secureimg['font'] 	= "imagecode.ttf";
+			$secureimg['color'] = "90,90,90"; // red,green,blue
+
+			*/
+			$bg_file = $secureimg['image'];
+
+			if(!is_readable($path.$secureimg['font']))
+			{
+				echo "Font missing"; // for debug only. translation not necessary.
+				exit;
+			}
+
+			if(!is_readable($path.$secureimg['image'].$ext))
+			{
+				echo "Missing Background-Image: ".$secureimg['image'].$ext; // for debug only. translation not necessary.
+				exit;
+			}
+			// var_dump($secureimg);
+		}
+		else
+		{
+			$bg_file = "generic/code_bg";
+		}
+
+		switch($type)
+		{
+			case "jpeg":
+				$image = ImageCreateFromJPEG($path.$bg_file.".jpg");
+				break;
+			case "png":
+				$image = ImageCreateFromPNG($path.$bg_file.".png");
+				break;
+			case "gif":
+				$image = ImageCreateFromGIF($path.$bg_file.".gif");
+				break;
+		}
+
+
+
+		if(isset($secureimg['color']))
+		{
+			$tmp = explode(",",$secureimg['color']);
+			$text_color = ImageColorAllocate($image,$tmp[0],$tmp[1],$tmp[2]);
+		}
+		else
+		{
+			$text_color = ImageColorAllocate($image, 90, 90, 90);
+		}
+
+		header("Content-type: image/{$type}");
+
+		if(isset($secureimg['font']) && is_readable($path.$secureimg['font']))
+		{
+			imagettftext($image, $secureimg['size'],$secureimg['angle'], $secureimg['x'], $secureimg['y'], $text_color,$path.$secureimg['font'], $code);
+		}
+		else
+		{
+			imagestring ($image, 5, 12, 2, $code, $text_color);
+		}
+
+		switch($type)
+		{
+			case "jpeg":
+				imagejpeg($image);
+				break;
+			case "png":
+				imagepng($image);
+				break;
+			case "gif":
+				imagegif($image);
+				break;
+		}
+
+
+	}
+
 }
-?>
diff -x .svn -aruN 0.7.24.src/e107_handlers/secure_img_render.php 0.7.26.src/e107_handlers/secure_img_render.php
--- 0.7.24.src/e107_handlers/secure_img_render.php	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_handlers/secure_img_render.php	2011-06-30 05:49:14.000000000 -0500
@@ -11,154 +11,19 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $URL: https://e107.svn.sourceforge.net/svnroot/e107/trunk/e107_0.7/e107_handlers/secure_img_render.php $
-|     $Revision: 11678 $
-|     $Id: secure_img_render.php 11678 2010-08-22 00:43:45Z e107coders $
-|     $Author: e107coders $
+|     $Revision: 12299 $
+|     $Id: secure_img_render.php 12299 2011-06-30 10:49:38Z secretr $
+|     $Author: secretr $
 +----------------------------------------------------------------------------+
 */
 
-while (@ob_end_clean());
-ob_start();
-function e107_ini_set($var, $value)
-{
-	if (function_exists('ini_set'))
-	{
-		ini_set($var, $value);
-	}
-}
+define('e107_INIT', true);
+require_once(realpath(dirname(__FILE__)."/secure_img_handler.php"));
 
-// 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);
+$sim = new secure_image();
+$sim->render($_SERVER['QUERY_STRING']);
 
-while (list($global) = each($GLOBALS))
-{
-	if (!preg_match('/^(_SERVER|GLOBALS)$/', $global))
-	{
-		unset($$global);
-	}
-}
+exit;
 
-unset($global);
 
-$imgtypes = array("jpeg", "png", "gif");
-
-define("e_QUERY", preg_replace("#&|/?PHPSESSID.*#i", "", $_SERVER['QUERY_STRING']));
-
-$recnum = preg_replace("#\D#","",e_QUERY);
-
-if($recnum == false){ exit; }
-
-$mySQLserver = "";
-
-$a = 0;
-$p = "";
-
-$ifile = dirname(__FILE__);
-if (substr($ifile,-1,1) != '/') $ifile .= '/';
-@include_once($ifile."e107_config.php");
-
-while(!$mySQLserver && $a < 5)
-{
-  $a ++;
-  $p .= "../";
-  @include_once($ifile.$p.'e107_config.php');		// *** Revised
-}
-
-mysql_connect($mySQLserver, $mySQLuser, $mySQLpassword);
-mysql_select_db($mySQLdefaultdb);
-
-$result = mysql_query("SELECT tmp_info FROM {$mySQLprefix}tmp WHERE tmp_ip = '{$recnum}'");
-if(!$row = mysql_fetch_array($result))
-{
-	exit;
-}
-
-list($code, $url) = explode(",",$row['tmp_info']);
-
-$type = "none";
-
-foreach($imgtypes as $t)
-{
-	if(function_exists("imagecreatefrom".$t))
-	{
-		$type = $t;
-		break;
-	}
-}
-
-$path = realpath(dirname(__FILE__)."/../")."/".$IMAGES_DIRECTORY;
-
-if(is_readable($path."secure_image_custom.php"))
-{
-	require_once($path."secure_image_custom.php");
-	/*   Example secure_image_custom.php file:
-
-	$secureimg['image'] = "code_bg_custom";  // filename excluding the .ext
-	$secureimg['size']	= "15";
-	$secureimg['angle']	= "0";
-	$secureimg['x']		= "6";
-	$secureimg['y']		= "22";
-	$secureimg['font'] 	= "imagecode.ttf";
-	$secureimg['color'] = "90,90,90"; // red,green,blue
-
-	*/
-	$bg_file = $secureimg['image'];
-}
-else
-{
-	$bg_file = "generic/code_bg";
-}
-
-switch($type)
-{
-	case "jpeg":
-		$image = ImageCreateFromJPEG($path.$bg_file.".jpg");
-		break;
-	case "png":
-		$image = ImageCreateFromPNG($path.$bg_file.".png");
-		break;
-	case "gif":
-		$image = ImageCreateFromGIF($path.$bg_file.".gif");
-		break;
-}
-
-if(isset($secureimg['color']))
-{
-	$tmp = explode(",",$secureimg['color']);
-	$text_color = ImageColorAllocate($image,$tmp[0],$tmp[1],$tmp[2]);
-}
-else
-{
-	$text_color = ImageColorAllocate($image, 90, 90, 90);
-}
-
-header("Content-type: image/{$type}");
-
-if(isset($secureimg['font']) && is_readable($path.$secureimg['font']))
-{
-	imagettftext($image, $secureimg['size'],$secureimg['angle'], $secureimg['x'], $secureimg['y'], $text_color,$path.$secureimg['font'], $code);
-}
-else
-{
-	imagestring ($image, 5, 12, 2, $code, $text_color);
-}
-
-ob_end_clean();
-switch($type)
-{
-	case "jpeg":
-		imagejpeg($image);
-		break;
-	case "png":
-		imagepng($image);
-		break;
-	case "gif":
-		imagegif($image);
-		break;
-}
-
-imagedestroy($image);
+?>
\ No newline at end of file
diff -x .svn -aruN 0.7.24.src/e107_handlers/sitelinks_class.php 0.7.26.src/e107_handlers/sitelinks_class.php
--- 0.7.24.src/e107_handlers/sitelinks_class.php	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_handlers/sitelinks_class.php	2011-04-11 19:33:50.000000000 -0500
@@ -12,15 +12,13 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $URL: https://e107.svn.sourceforge.net/svnroot/e107/trunk/e107_0.7/e107_handlers/sitelinks_class.php $
-|     $Revision: 11678 $
-|     $Id: sitelinks_class.php 11678 2010-08-22 00:43:45Z e107coders $
+|     $Revision: 12129 $
+|     $Id: sitelinks_class.php 12129 2011-04-12 00:34:14Z e107coders $
 |     $Author: e107coders $
 +---------------------------------------------------------------+
 */
-
 if (!defined('e107_INIT')) { exit; }
-
-include_lan(e_LANGUAGEDIR.e_LANGUAGE."/lan_sitelinks.php");
+include_lan(e_LANGUAGEDIR.e_LANGUAGE.'/lan_sitelinks.php');
 
 /**
 * @return void
@@ -29,60 +27,63 @@
 
 class sitelinks
 {
-
     var $eLinkList;
-
+	var $eSubLinkLevel=0;
+	
     function getlinks($cat=1)
     {
-
         global $sql;
-        if ($sql->db_Select('links', '*', "link_category = ".intval($cat)." and link_class IN (".USERCLASS_LIST.") ORDER BY link_order ASC")){
+        if ($sql->db_Select('links', '*', "link_category = ".intval($cat)." and link_class IN (".USERCLASS_LIST.") ORDER BY link_order ASC"))
+		{
             while ($row = $sql->db_Fetch())
             {
-            //  if (substr($row['link_name'], 0, 8) == 'submenu.'){
-            //      $tmp=explode('.', $row['link_name'], 3);
-             //     $this->eLinkList[$tmp[1]][]=$row;
-                if (isset($row['link_parent']) && $row['link_parent'] != 0){
-                    $this->eLinkList['sub_'.$row['link_parent']][]=$row;
-                }else{
+				//  if (substr($row['link_name'], 0, 8) == 'submenu.'){
+				//      $tmp=explode('.', $row['link_name'], 3);
+				//     $this->eLinkList[$tmp[1]][]=$row;
+				if (isset($row['link_parent']) && $row['link_parent'] != 0)
+				{
+					$this->eLinkList['sub_'.$row['link_parent']][]=$row;
+                }
+				else
+				{
                     $this->eLinkList['head_menu'][] = $row;
                 }
             }
         }
-
     }
 
     function get($cat=1, $style='', $css_class = false)
     {
         global $pref, $ns, $e107cache, $linkstyle;
         $usecache = ((trim(defset('LINKSTART_HILITE')) != "" || trim(defset('LINKCLASS_HILITE')) != "") ? false : true);
-
         if ($usecache && !strpos(e_SELF, e_ADMIN) && ($data = $e107cache->retrieve('sitelinks_'.$cat.md5($linkstyle.e_PAGE.e_QUERY)))) 
 		{
-          return $data;
+			return $data;
         }
-
-        if (LINKDISPLAY == 4) {
+        if (LINKDISPLAY == 4) 
+		{
             require_once(e_PLUGIN.'ypslide_menu/ypslide_menu.php');
             return;
         }
-
         $this->getlinks($cat);
-
+		
         // are these defines used at all ?
 
-        if(!defined('PRELINKTITLE')){
+        if(!defined('PRELINKTITLE'))
+		{
             define('PRELINKTITLE', '');
         }
-        if(!defined('PRELINKTITLE')){
+        if(!defined('PRELINKTITLE'))
+		{
             define('POSTLINKTITLE', '');
         }
         // -----------------------------
 
         // where did link alignment go?
-        if (!defined('LINKALIGN')) { define(LINKALIGN, ''); }
+        if (!defined('LINKALIGN')) { define('LINKALIGN', ''); }
 
-        if(!$style){
+        if(!$style)
+		{
             $style['prelink'] = defined('PRELINK') ? PRELINK : '';
             $style['postlink'] = defined('POSTLINK') ? POSTLINK : '';
             $style['linkclass'] = defined('LINKCLASS') ? LINKCLASS : "";
@@ -93,55 +94,46 @@
             $style['linkend'] = defined('LINKEND') ? LINKEND : '';
             $style['linkseparator'] = defined('LINKSEPARATOR') ? LINKSEPARATOR : '';
         }
+		
+		if(!varset($style['linkseparator']))
+		{
+			$style['linkseparator'] = "";
+		}
 
-    // Sublink styles.- replacing the tree-menu.
-        if(isset($style['sublinkdisplay']) || isset($style['subindent']) || isset($style['sublinkclass']) || isset($style['sublinkstart']) || isset($style['sublinkend']) || isset($style['subpostlink'])){
-            foreach($style as $key=>$val){
+		// Sublink styles.- replacing the tree-menu.
+        if(isset($style['sublinkdisplay']) || isset($style['subindent']) || isset($style['sublinkclass']) || isset($style['sublinkstart']) || isset($style['sublinkend']) || isset($style['subpostlink']))
+		{
+            foreach($style as $key=>$val)
+			{
                 $aSubStyle[$key] = (isset($style["sub".$key])) ? $style["sub".$key] : $style[$key];
             }
-        }else{
-                $style['subindent'] = "&nbsp;&nbsp;";
-                $aSubStyle = $style;
+        }
+		else
+		{
+			$style['subindent'] = "&nbsp;&nbsp;";
+			$aSubStyle = $style;
         }
 
+
         $text = "\n\n\n<!-- Sitelinks ($cat) -->\n\n\n".$style['prelink'];
 
-        if ($style['linkdisplay'] != 3) {
-            foreach ($this->eLinkList['head_menu'] as $key => $link){
+        if ($style['linkdisplay'] != 3) 
+		{
+            foreach ($this->eLinkList['head_menu'] as $key => $link)
+			{
                 $main_linkid = "sub_".$link['link_id'];
-
-                $link['link_expand'] = ((isset($pref['sitelinks_expandsub']) && $pref['sitelinks_expandsub']) && !$style['linkmainonly'] && !defined("LINKSRENDERONLYMAIN") && isset($this->eLinkList[$main_linkid]) && is_array($this->eLinkList[$main_linkid])) ?  TRUE : FALSE;
-
+                $link['link_expand'] = ((isset($pref['sitelinks_expandsub']) && $pref['sitelinks_expandsub']) && !varsettrue($style['linkmainonly']) && !defined("LINKSRENDERONLYMAIN") && isset($this->eLinkList[$main_linkid]) && is_array($this->eLinkList[$main_linkid])) ?  TRUE : FALSE;
                 $render_link[$key] = $this->makeLink($link,'', $style, $css_class);
 
                 if(!defined("LINKSRENDERONLYMAIN") && !varset($style['linkmainonly']))  /* if this is defined in theme.php only main links will be rendered */
                 {
-
-                    // if there's a submenu. :
-                    if (isset($this->eLinkList[$main_linkid]) && is_array($this->eLinkList[$main_linkid])){
-                        foreach($this->eLinkList[$main_linkid] as $val) // check that something in the submenu is actually selected.
-                        {
-                            if($this->hilite($val['link_url'],TRUE)== TRUE || $link['link_expand'] == FALSE)
-                            {
-                                $substyle = "compact";
-                                break;
-                            }
-                            else
-                            {
-                                $substyle = "none";
-                            }
-                        }
-                        $render_link[$key] .= "\n\n<div id='{$main_linkid}' style='display:$substyle' class='d_sublink'>\n";
-                        foreach ($this->eLinkList[$main_linkid] as $sub){
-                            $render_link[$key] .= $this->makeLink($sub, TRUE, $aSubStyle, $css_class);
-                        }
-                        $render_link[$key] .= "\n</div>\n\n";
-                    }
+					$render_link[$key] .= $this->subLink($main_linkid,$aSubStyle,$css_class);
                 }
             }
             $text .= implode($style['linkseparator'], $render_link);
             $text .= $style['postlink'];
-            if ($style['linkdisplay'] == 2) {
+            if ($style['linkdisplay'] == 2) 
+			{
                 $text = $ns->tablerender(LAN_SITELINKS_183, $text, 'sitelinks', TRUE);
             }
         }
@@ -177,14 +169,72 @@
         }
         return $text;
     }
+	
+	/**
+	 * Manage Sublink Rendering
+	 * @param object $main_linkid
+	 * @param object $aSubStyle
+	 * @param object $css_class
+	 * @param object $level [optional]
+	 * @return 
+	 */
+	function subLink($main_linkid,$aSubStyle,$css_class='',$level=0)
+	{
+		global $pref;
+		if(!isset($this->eLinkList[$main_linkid]) || !is_array($this->eLinkList[$main_linkid]))
+		{
+			return;
+		}
+		$sub['link_expand'] = ((isset($pref['sitelinks_expandsub']) && $pref['sitelinks_expandsub']) && !varsettrue($style['linkmainonly']) && !defined("LINKSRENDERONLYMAIN") && isset($this->eLinkList[$main_linkid]) && is_array($this->eLinkList[$main_linkid])) ?  TRUE : FALSE;              		
+						
+		foreach($this->eLinkList[$main_linkid] as $val) // check that something in the submenu is actually selected.
+ 		{
+			if($this->hilite($val['link_url'],TRUE)== TRUE || $sub['link_expand'] == FALSE)
+         	{
+         		$substyle = "block"; // previously (non-W3C compliant): compact
+          		break;
+        	}
+			else
+			{
+				$substyle = "none";
+			}
+		}
+
+		$text = "";
+		$text .= "\n\n<div id='{$main_linkid}' style='display:$substyle' class='d_sublink'>\n";
+		foreach ($this->eLinkList[$main_linkid] as $sub)
+		{
+			$id = "sub_".$sub['link_id'];
+			$sub['link_expand'] = ((isset($pref['sitelinks_expandsub']) && $pref['sitelinks_expandsub']) && !varsettrue($style['linkmainonly']) && !defined("LINKSRENDERONLYMAIN") && isset($this->eLinkList[$id]) && is_array($this->eLinkList[$id])) ?  TRUE : FALSE;              		
+			$class = "sublink-level-".($level+1); // preferred class to use. 
+			$class .= ($css_class) ? " ".$css_class : "";
+			$class .= ($aSubStyle['sublinkclass']) ? " ".$aSubStyle['sublinkclass'] : ""; // backwards compatible
+			$text .= $this->makeLink($sub, TRUE, $aSubStyle,$class );
+			$text .= $this->subLink($id,$aSubStyle,$css_class,($level+1));				
+		}
+		$text .= "\n</div>\n\n";
+
+		return $text;	
+	}
+	
+	
 
     function makeLink($linkInfo, $submenu = FALSE, $style='', $css_class = false)
     {
         global $pref,$tp;
-
         // Start with an empty link
         $linkstart = $indent = $linkadd = $screentip = $href = $link_append = '';
         $highlighted = FALSE;
+		
+		if(!isset($style['linkstart_hilite'])) // Notice removal
+		{
+			$style['linkstart_hilite'] = "";	
+		}
+		
+		if(!isset($style['linkclass_hilite']))
+		{
+			$style['linkclass_hilite'] = "";	
+		}
 
         // If submenu: Fix Name, Add Indentation.
         if ($submenu == TRUE) {
@@ -192,13 +242,14 @@
                 $tmp = explode('.', $linkInfo['link_name'], 3);
                 $linkInfo['link_name'] = $tmp[2];
             }
-            $indent = ($style['linkdisplay'] != 3) ? $style['subindent'] : "";
+            $indent = (varset($style['linkdisplay']) != 3) ? varset($style['subindent']) : "";
         }
 
         // Convert any {e_XXX} to absolute URLs (relative ones sometimes get broken by adding e_HTTP at the front)
         $linkInfo['link_url'] = $tp -> replaceConstants($linkInfo['link_url'], TRUE, TRUE); // replace {e_xxxx}
 
-        if(strpos($linkInfo['link_url'],"{") !== FALSE){
+        if(strpos($linkInfo['link_url'],"{") !== FALSE)
+		{
             $linkInfo['link_url'] = $tp->parseTemplate($linkInfo['link_url'], TRUE); // shortcode in URL support - dynamic urls for multilanguage.
         }
         // By default links are not highlighted.
@@ -207,41 +258,49 @@
         $linkadd = ($css_class) ? " class='".$css_class."'" : $linkadd;
 
         // Check for screentip regardless of URL.
-        if (isset($pref['linkpage_screentip']) && $pref['linkpage_screentip'] && $linkInfo['link_description']){
+        if (isset($pref['linkpage_screentip']) && $pref['linkpage_screentip'] && $linkInfo['link_description'])
+		{
             $screentip = " title = \"".$tp->toHTML($linkInfo['link_description'],"","value, emotes_off, defs, no_hook")."\"";
         }
 
         // Check if its expandable first. It should override its URL.
-        if (isset($linkInfo['link_expand']) && $linkInfo['link_expand']){
+        if (isset($linkInfo['link_expand']) && $linkInfo['link_expand'])
+		{
             $href = " href=\"javascript:expandit('sub_".$linkInfo['link_id']."')\"";
-        } elseif ($linkInfo['link_url']){
-
+        }
+		elseif ($linkInfo['link_url'])
+		{
             // Only add the e_BASE if it actually has an URL.
             $linkInfo['link_url'] = (strpos($linkInfo['link_url'], '://') === FALSE && strpos($linkInfo['link_url'], 'mailto:') !== 0 ? e_HTTP.$linkInfo['link_url'] : $linkInfo['link_url']);
 
             // Only check if its highlighted if it has an URL
-            if ($this->hilite($linkInfo['link_url'], $style['linkstart_hilite'])== TRUE) {
+            if ($this->hilite($linkInfo['link_url'], $style['linkstart_hilite'])== TRUE) 
+			{
                 $linkstart = (isset($style['linkstart_hilite'])) ? $style['linkstart_hilite'] : "";
                 $highlighted = TRUE;
             }
-            if ($this->hilite($linkInfo['link_url'], $style['linkclass_hilite'])== TRUE) {
+            if ($this->hilite($linkInfo['link_url'], $style['linkclass_hilite'])== TRUE) 
+			{
                 $linkadd = (isset($style['linkclass_hilite'])) ? " class='".$style['linkclass_hilite']."'" : "";
                 $highlighted = TRUE;
             }
 
-            if ($linkInfo['link_open'] == 4 || $linkInfo['link_open'] == 5){
+            if ($linkInfo['link_open'] == 4 || $linkInfo['link_open'] == 5)
+			{
                 $dimen = ($linkInfo['link_open'] == 4) ? "600,400" : "800,600";
                 $href = " href=\"javascript:open_window('".$linkInfo['link_url']."',{$dimen})\"";
-            } else {
+            }
+			else 
+			{
                 $href = " href='".$linkInfo['link_url']."'";
             }
-
             // Open link in a new window.  (equivalent of target='_blank' )
             $link_append = ($linkInfo['link_open'] == 1) ? " rel='external'" : "";
         }
 
         // Remove default images if its a button and add new image at the start.
-        if ($linkInfo['link_button']){
+        if ($linkInfo['link_button'])
+		{
             $linkstart = preg_replace('/\<img.*\>/si', '', $linkstart);
             $linkstart .= "<img src='".e_IMAGE_ABS."icons/".$linkInfo['link_button']."' alt='' style='vertical-align:middle' />";
         }
@@ -253,160 +312,173 @@
         // If its a link.. make a link
         $_link = "";
         $_link .= $accessdigit;
-        if (!empty($href) && ((varset($style['hilite_nolink']) && $highlighted)!=TRUE)){
+        if (!empty($href) && ((varset($style['hilite_nolink']) && $highlighted)!=TRUE))
+		{
             $_link .= "<a".$linkadd.$screentip.$href.$link_append.$accesskey.">".$tp->toHTML($linkInfo['link_name'],"","emotes_off, defs, no_hook")."</a>";
-        // If its not a link, but has a class or screentip do span:
-        }elseif (!empty($linkadd) || !empty($screentip)){
+        }
+		elseif (!empty($linkadd) || !empty($screentip))
+		{
+			// If its not a link, but has a class or screentip do span:
             $_link .= "<span".$linkadd.$screentip.">".$tp->toHTML($linkInfo['link_name'],"","emotes_off, defs, no_hook")."</span>";
+        }
+		else 
+		{
             // Else just the name:
-        }else {
             $_link .= $tp->toHTML($linkInfo['link_name'],"","emotes_off, defs, no_hook");
         }
-
         $_link = $linkstart.$indent.$_link;
-
         return $_link.$style['linkend']."\n";
     }
 
+	function hilite($link,$enabled='')
+	{
+		global $PLUGINS_DIRECTORY,$tp,$pref;
+		if(!$enabled){ return FALSE; }
+
+		$link = $tp->replaceConstants($link, '', TRUE);
+		$tmp = explode("?",$link);
+		$link_qry = (isset($tmp[1])) ? $tmp[1] : "";
+		$link_slf = (isset($tmp[0])) ? $tmp[0] : "";
+		$link_pge = basename($link_slf);
+		$link_match = (empty($tmp[0])) ? "": strpos(e_SELF,$tmp[0]);	// e_SELF is the actual displayed page
 
+		if(e_MENU == "debug" && getperms('0'))
+		{
+			echo "<br />link= ".$link;
+			echo "<br />link_q= ".$link_qry;
+			echo "<br />url= ".e_PAGE;
+			echo "<br />url_query= ".e_QUERY."<br />";
 
+		}
 
+		// ----------- highlight overriding - set the link matching in the page itself.
+		if(defined("HILITE"))
+		{
+			if(strpos($link,HILITE))
+			{
+				return TRUE;
+			}
+		}
+
+		// --------------- highlighting for 'HOME'. ----------------
+		global $pref;
+		if (isset($pref['frontpage']['all']))
+		{
+			list($fp,$fp_q) = explode("?",$pref['frontpage']['all']."?");
+			if (strpos(e_SELF,"/".$pref['frontpage']['all'])!== FALSE && $fp_q == varset($tmp[1],'') && $link == e_HTTP."index.php")
+			{
+				return TRUE;
+			}
+		}
 
-function hilite($link,$enabled=''){
-    global $PLUGINS_DIRECTORY,$tp,$pref;
-    if(!$enabled){ return FALSE; }
-
-    $link = $tp->replaceConstants($link, '', TRUE);
-    $tmp = explode("?",$link);
-    $link_qry = (isset($tmp[1])) ? $tmp[1] : "";
-    $link_slf = (isset($tmp[0])) ? $tmp[0] : "";
-    $link_pge = basename($link_slf);
-	$link_match = (empty($tmp[0])) ? "": strpos(e_SELF,$tmp[0]);	// e_SELF is the actual displayed page
-
-    if(e_MENU == "debug" && getperms('0'))
-    {
-        echo "<br />link= ".$link;
-        echo "<br />link_q= ".$link_qry;
-        echo "<br />url= ".e_PAGE;
-        echo "<br />url_query= ".e_QUERY."<br />";
-
-    }
-
-// ----------- highlight overriding - set the link matching in the page itself.
-
-    if(defined("HILITE")){
-        if(strpos($link,HILITE)){
-            return TRUE;
-        }
-    }
-
-
-// --------------- highlighting for 'HOME'. ----------------
-    global $pref;
-    if (isset($pref['frontpage']['all']))
-    {
-      list($fp,$fp_q) = explode("?",$pref['frontpage']['all']."?");
-      if (strpos(e_SELF,"/".$pref['frontpage']['all'])!== FALSE && $fp_q == varset($tmp[1],'') && $link == e_HTTP."index.php")
-      {
-        return TRUE;
-      }
-    }
-
-// --------------- highlighting for plugins. ----------------
-        if(stristr($link, $PLUGINS_DIRECTORY) !== FALSE && stristr($link, "custompages") === FALSE){
-
+		// --------------- highlighting for plugins. ----------------
+        if(stristr($link, $PLUGINS_DIRECTORY) !== FALSE && stristr($link, "custompages") === FALSE)
+		{
             if($link_qry)
             {  // plugin links with queries
                 $subq = explode("?",$link);
-                if(strpos(e_SELF,$subq[0]) && e_QUERY == $subq[1]){
+                if(strpos(e_SELF,$subq[0]) && e_QUERY == $subq[1])
+				{
                     return TRUE;
-                }else{
+                }
+				else
+				{
                     return FALSE;
                 }
             }
             else
             {  // plugin links without queries
                 $link = str_replace("../", "", $link);
-                if(stristr(dirname(e_SELF), dirname($link)) !== FALSE){
+                if(stristr(dirname(e_SELF), dirname($link)) !== FALSE)
+				{
                     return TRUE;
                 }
             }
             return FALSE;
         }
 
-// --------------- highlight for news items.----------------
-// eg. news.php, news.php?list.1 or news.php?cat.2 etc
-    if(substr(basename($link),0,8) == "news.php")
-    {
-
-        if (strpos($link, "news.php?") !== FALSE && strpos(e_SELF,"/news.php")!==FALSE) {
-
-            $lnk = explode(".",$link_qry); // link queries.
-            $qry = explode(".",e_QUERY); // current page queries.
-
-            if($qry[0] == "item")
-            {
-                return ($qry[2] == $lnk[1]) ? TRUE : FALSE;
-            }
-
-            if($qry[0] == "all" && $lnk[0] == "all")
-            {
-                return TRUE;
-            }
-
-            if($lnk[0] == $qry[0] && $lnk[1] == $qry[1])
-            {
-                return TRUE;
-            }
-
-            if($qry[1] == "list" && $lnk[0] == "list" && $lnk[1] == $qry[2])
-            {
-                return TRUE;
-            }
-
-        }
-        elseif (!e_QUERY && e_PAGE == "news.php")
-        {
-
-            return TRUE;
-        }
+		// --------------- highlight for news items.----------------
+		// eg. news.php, news.php?list.1 or news.php?cat.2 etc
+		if(substr(basename($link),0,8) == "news.php")
+		{
+			if (strpos($link, "news.php?") !== FALSE && strpos(e_SELF,"/news.php")!==FALSE) 
+			{
+				$lnk = explode(".",$link_qry); // link queries.
+				$qry = explode(".",e_QUERY); // current page queries.
+				if($qry[0] == "item")
+				{
+					return ($qry[2] == $lnk[1]) ? TRUE : FALSE;
+				}
+
+				if($qry[0] == "all" && $lnk[0] == "all")
+				{
+					return TRUE;
+				}
+
+				if($lnk[0] == $qry[0] && $lnk[1] == $qry[1])
+				{
+					return TRUE;
+				}
+
+				if($qry[1] == "list" && $lnk[0] == "list" && $lnk[1] == $qry[2])
+				{
+					return TRUE;
+				}
+			}
+			elseif (!e_QUERY && e_PAGE == "news.php")
+			{
+				return TRUE;
+			}
             return FALSE;
+		}
 
-    }
-// --------------- highlight for Custom Pages.----------------
-// eg. page.php?1
-
-        if (strpos($link, "page.php?") !== FALSE && strpos(e_SELF,"/page.php")) {
+		// --------------- highlight for Custom Pages.----------------
+		// eg. page.php?1
+        if (strpos($link, "page.php?") !== FALSE && strpos(e_SELF,"/page.php")) 
+		{
             list($custom,$page) = explode(".",$link_qry);
             list($q_custom,$q_page) = explode(".",e_QUERY);
-            if($custom == $q_custom){
+            if($custom == $q_custom)
+			{
                 return TRUE;
-            }else{
+            }
+			else
+			{
                 return FALSE;
             }
         }
 
-// --------------- highlight default ----------------
-        if(strpos($link, "?") !== FALSE){
-
+		// --------------- highlight default ----------------
+        if(strpos($link, "?") !== FALSE)
+		{
             $thelink = str_replace("../", "", $link);
-            if((strpos(e_SELF,$thelink) !== false) && (strpos(e_QUERY,$link_qry) !== false)){
+            if((strpos(e_SELF,$thelink) !== false) && (strpos(e_QUERY,$link_qry) !== false))
+			{
                 return true;
             }
         }
-		if(!preg_match("/all|item|cat|list/", e_QUERY) && (empty($link) == false) && (strpos(e_SELF, str_replace("../", "",$link)) !== false)){
+
+		if(!preg_match("/all|item|cat|list/", e_QUERY) && (empty($link) == false) && (strpos(e_SELF, str_replace("../", "",$link)) !== false))
+		{
             return true;
         }
 
-		if((!$link_qry && !e_QUERY) && (empty($link) == FALSE) && (strpos(e_SELF,$link) !== FALSE)){
+		if((!$link_qry && !e_QUERY) && (empty($link) == FALSE) && (strpos(e_SELF,$link) !== FALSE))
+		{
             return TRUE;
         }
 
-		if(($link_slf == e_SELF && !link_qry) || (e_QUERY && empty($link) == FALSE && strpos(e_SELF."?".e_QUERY,$link)!== FALSE) ){
+		if(($link_slf == e_SELF && !link_qry) || (e_QUERY && empty($link) == FALSE && strpos(e_SELF."?".e_QUERY,$link)!== FALSE) )
+		{
             return TRUE;
         }
-
+		
+		if($link_pge == basename($_SERVER['REQUEST_URI'])) // mod_rewrite support
+		{
+			return TRUE;
+		}
+		
         return FALSE;
     }
 }
-?>
+?>
\ No newline at end of file
diff -x .svn -aruN 0.7.24.src/e107_handlers/tiny_mce/langs/en.js 0.7.26.src/e107_handlers/tiny_mce/langs/en.js
--- 0.7.24.src/e107_handlers/tiny_mce/langs/en.js	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_handlers/tiny_mce/langs/en.js	2011-03-12 04:48:11.000000000 -0600
@@ -1,154 +1,222 @@
-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
+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:"{#field} is invalid",
+invalid_data_number:"{#field} must be a number",
+invalid_data_min:"{#field} must be a number greater than {#min}",
+invalid_data_size:"{#field} must be a number or percentage",
+more_colors:"More colors"
+},
+colors:{
+'000000':'Black',
+'993300':'Burnt orange',
+'333300':'Dark olive',
+'003300':'Dark green',
+'003366':'Dark azure',
+'000080':'Navy Blue',
+'333399':'Indigo',
+'333333':'Very dark gray',
+'800000':'Maroon',
+'FF6600':'Orange',
+'808000':'Olive',
+'008000':'Green',
+'008080':'Teal',
+'0000FF':'Blue',
+'666699':'Grayish blue',
+'808080':'Gray',
+'FF0000':'Red',
+'FF9900':'Amber',
+'99CC00':'Yellow green',
+'339966':'Sea green',
+'33CCCC':'Turquoise',
+'3366FF':'Royal blue',
+'800080':'Purple',
+'999999':'Medium gray',
+'FF00FF':'Magenta',
+'FFCC00':'Gold',
+'FFFF00':'Yellow',
+'00FF00':'Lime',
+'00FFFF':'Aqua',
+'00CCFF':'Sky blue',
+'993366':'Brown',
+'C0C0C0':'Silver',
+'FF99CC':'Pink',
+'FFCC99':'Peach',
+'FFFF99':'Light yellow',
+'CCFFCC':'Pale green',
+'CCFFFF':'Pale cyan',
+'99CCFF':'Light sky blue',
+'CC99FF':'Plum',
+'FFFFFF':'White'
+},
+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",
+plaintext_mode_sticky:"Paste is now in plain text mode. Click again to toggle back to regular paste mode. After you paste something you will be returned to regular paste mode.",
+plaintext_mode:"Paste is now in plain text mode. Click again to toggle back to regular paste mode."
+},
+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.",
+restore_content:"Restore auto-saved content.",
+warning_message:"If you restore the saved content, you will lose all the content that is currently in the editor.\n\nAre you sure you want to restore the saved content?."
+},
+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."
+},
+advlist:{
+types:"Types",
+def:"Default",
+lower_alpha:"Lower alpha",
+lower_greek:"Lower greek",
+lower_roman:"Lower roman",
+upper_alpha:"Upper alpha",
+upper_roman:"Upper roman",
+circle:"Circle",
+disc:"Disc",
+square:"Square"
+},
+aria:{
+rich_text_area:"Rich Text Area"
+},
+wordcount:{
+words: 'Words: '
+}
+}});
\ No newline at end of file
diff -x .svn -aruN 0.7.24.src/e107_handlers/tiny_mce/plugins/contextmenu/editor_plugin.js 0.7.26.src/e107_handlers/tiny_mce/plugins/contextmenu/editor_plugin.js
--- 0.7.24.src/e107_handlers/tiny_mce/plugins/contextmenu/editor_plugin.js	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_handlers/tiny_mce/plugins/contextmenu/editor_plugin.js	2011-03-30 03:22:40.000000000 -0500
@@ -1 +1 @@
-(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
+(function(){var a=tinymce.dom.Event,c=tinymce.each,b=tinymce.DOM;tinymce.create("tinymce.plugins.ContextMenu",{init:function(e){var h=this,i,f,d;h.editor=e;d=e.settings.contextmenu_never_use_native;h.onContextMenu=new tinymce.util.Dispatcher(this);f=e.onContextMenu.add(function(j,k){if(k.ctrlKey&&!d){return}if(i){j.selection.setRng(i)}h._getMenu(j).showMenu(k.clientX||k.pageX,k.clientY||k.pageX);a.add(j.getDoc(),"click",function(l){g(j,l)});a.cancel(k)});e.onRemove.add(function(){if(h._menu){h._menu.removeAll()}});function g(j,k){i=null;if(k&&k.button==2){i=j.selection.getRng();return}if(h._menu){h._menu.removeAll();h._menu.destroy();a.remove(j.getDoc(),"click",g)}}e.onMouseDown.add(g);e.onKeyDown.add(g);e.onKeyDown.add(function(j,k){if(k.shiftKey&&!k.ctrlKey&&!k.altKey&&k.keyCode===121){a.cancel(k);f(j,k)}})},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,keyboard_focus:true});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.24.src/e107_handlers/tiny_mce/plugins/contextmenu/editor_plugin_src.js 0.7.26.src/e107_handlers/tiny_mce/plugins/contextmenu/editor_plugin_src.js
--- 0.7.24.src/e107_handlers/tiny_mce/plugins/contextmenu/editor_plugin_src.js	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_handlers/tiny_mce/plugins/contextmenu/editor_plugin_src.js	2011-03-30 03:22:40.000000000 -0500
@@ -1,95 +1,156 @@
-/**
- * $Id: editor_plugin_src.js 11346 2010-02-17 18:56:14Z secretr $
- *
- * @author Moxiecode
- * @copyright Copyright  2004-2008, Moxiecode Systems AB, All rights reserved.
- */
-
-(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);
-				}
-			});
-
-			function hide() {
-				if (t._menu) {
-					t._menu.removeAll();
-					t._menu.destroy();
-					Event.remove(ed.getDoc(), 'click', hide);
-				}
-			};
-
-			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();
-			}
-
-			p1 = DOM.getPos(ed.getContentAreaContainer());
-			p2 = DOM.getPos(ed.getContainer());
-
-			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'});
-			}
-
-			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'});
-
-			t.onContextMenu.dispatch(t, m, el, col);
-
-			return m;
-		}
-	});
-
-	// Register plugin
-	tinymce.PluginManager.add('contextmenu', tinymce.plugins.ContextMenu);
-})();
\ No newline at end of file
+/**
+ * editor_plugin_src.js
+ *
+ * Copyright 2009, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://tinymce.moxiecode.com/license
+ * Contributing: http://tinymce.moxiecode.com/contributing
+ */
+
+(function() {
+	var Event = tinymce.dom.Event, each = tinymce.each, DOM = tinymce.DOM;
+
+	/**
+	 * This plugin a context menu to TinyMCE editor instances.
+	 *
+	 * @class tinymce.plugins.ContextMenu
+	 */
+	tinymce.create('tinymce.plugins.ContextMenu', {
+		/**
+		 * 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.
+		 *
+		 * @method init
+		 * @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) {
+			var t = this, lastRng, showMenu, contextmenuNeverUseNative;
+
+			t.editor = ed;
+
+			contextmenuNeverUseNative = ed.settings.contextmenu_never_use_native;
+
+			/**
+			 * This event gets fired when the context menu is shown.
+			 *
+			 * @event onContextMenu
+			 * @param {tinymce.plugins.ContextMenu} sender Plugin instance sending the event.
+			 * @param {tinymce.ui.DropMenu} menu Drop down menu to fill with more items if needed.
+			 */
+			t.onContextMenu = new tinymce.util.Dispatcher(this);
+
+			showMenu = ed.onContextMenu.add(function(ed, e) {
+				if (e.ctrlKey && !contextmenuNeverUseNative) return;
+
+				// Restore the last selection since it was removed
+				if (lastRng)
+					ed.selection.setRng(lastRng);
+
+				t._getMenu(ed).showMenu(e.clientX || e.pageX, e.clientY || e.pageX);
+				Event.add(ed.getDoc(), 'click', function(e) {
+					hide(ed, e);
+				});
+				Event.cancel(e);
+			});
+
+			ed.onRemove.add(function() {
+				if (t._menu)
+					t._menu.removeAll();
+			});
+
+			function hide(ed, e) {
+				lastRng = null;
+
+				// Since the contextmenu event moves
+				// the selection we need to store it away
+				if (e && e.button == 2) {
+					lastRng = ed.selection.getRng();
+					return;
+				}
+
+				if (t._menu) {
+					t._menu.removeAll();
+					t._menu.destroy();
+					Event.remove(ed.getDoc(), 'click', hide);
+				}
+			};
+
+			ed.onMouseDown.add(hide);
+			ed.onKeyDown.add(hide);
+			ed.onKeyDown.add(function(ed, e) {
+				if (e.shiftKey && !e.ctrlKey && !e.altKey && e.keyCode === 121) {
+					Event.cancel(e);
+					showMenu(ed, e);
+				}
+			});
+		},
+
+		/**
+		 * Returns information about the plugin as a name/value array.
+		 * The current keys are longname, author, authorurl, infourl and version.
+		 *
+		 * @method getInfo
+		 * @return {Object} Name/value array containing information about the plugin.
+		 */
+		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();
+			}
+
+			p1 = DOM.getPos(ed.getContentAreaContainer());
+			p2 = DOM.getPos(ed.getContainer());
+
+			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,
+				keyboard_focus: true
+			});
+
+			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'});
+			}
+
+			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'});
+
+			t.onContextMenu.dispatch(t, m, el, col);
+
+			return m;
+		}
+	});
+
+	// Register plugin
+	tinymce.PluginManager.add('contextmenu', tinymce.plugins.ContextMenu);
+})();
diff -x .svn -aruN 0.7.24.src/e107_handlers/tiny_mce/plugins/emoticons/emoticons.php 0.7.26.src/e107_handlers/tiny_mce/plugins/emoticons/emoticons.php
--- 0.7.24.src/e107_handlers/tiny_mce/plugins/emoticons/emoticons.php	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_handlers/tiny_mce/plugins/emoticons/emoticons.php	2010-10-09 17:21:36.000000000 -0500
@@ -10,13 +10,22 @@
 
 	$emotes = $sysprefs->getArray("emote_".$pref['emotepack']);
 	$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);
-		$value2 = substr($value, 0, strpos($value, " "));
-		$value = ($value2 ? $value2 : $value);
-		$str .= "\n<a href='javascript:void(0);' onmousedown=\"javascript:insertEmotion('$key')\"><img src=\"".e_IMAGE_ABS."emotes/" . $pref['emotepack'] . "/$key\" style=\"border:0; padding-top:2px;\" alt=\"\" /></a> ";
+	if($emotes)
+	{
+		foreach($emotes as $key => $value)
+		{
+			$key = str_replace("!", ".", $key);
+			$key = preg_replace("#_(\w{3})$#", ".\\1", $key);
+			$value2 = substr($value, 0, strpos($value, " "));
+			$value = ($value2 ? $value2 : $value);
+			$str .= "\n<a href='javascript:void(0);' onmousedown=\"javascript:insertEmotion('$key')\"><img src=\"".e_IMAGE_ABS."emotes/" . $pref['emotepack'] . "/$key\" style=\"border:0; padding-top:2px;\" alt=\"\" /></a> ";
+		}	
 	}
+	else
+	{
+		$str .= "Are emoticons enabled in your preferences?";
+	}
+
 
 	$str .= "</div>";
 
diff -x .svn -aruN 0.7.24.src/e107_handlers/tiny_mce/plugins/ibrowser/ibrowser.php 0.7.26.src/e107_handlers/tiny_mce/plugins/ibrowser/ibrowser.php
--- 0.7.24.src/e107_handlers/tiny_mce/plugins/ibrowser/ibrowser.php	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_handlers/tiny_mce/plugins/ibrowser/ibrowser.php	2011-03-14 23:16:09.000000000 -0500
@@ -13,8 +13,8 @@
 // ================================================
 //
 // $URL: https://e107.svn.sourceforge.net/svnroot/e107/trunk/e107_0.7/e107_handlers/tiny_mce/plugins/ibrowser/ibrowser.php $
-// $Revision: 11716 $
-// $Id: ibrowser.php 11716 2010-08-29 11:14:49Z secretr $
+// $Revision: 12106 $
+// $Id: ibrowser.php 12106 2011-03-15 04:16:33Z e107coders $
 // +----------------------------------------------------------------------------+
 // Major Re-work by CaMer0n
 
@@ -35,7 +35,7 @@
 include 'config.php';
 
 
-$request_uri = urldecode(empty($_POST['request_uri'])?(empty($_GET['request_uri'])?'':$_GET['request_uri']):$_POST['request_uri']);
+// $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
 if (!empty($tinyMCE_imglib_include))
@@ -227,8 +227,8 @@
 			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;
-
+			document.getElementById('imgpreview').src =  formObj.src.value;
+			// alert(document.getElementById('imgpreview').src);
 			updateStyle();
 		}
 
@@ -294,9 +294,8 @@
     window.name = 'imglibrary';
 </script>
 
-<form id=\"libbrowser\" method=\"post\" action=\"ibrowser.php?request_uri=".$_GET['request_uri']."\" enctype=\"multipart/form-data\" target=\"imglibrary\">
+<form id=\"libbrowser\" method=\"post\" action=\"ibrowser.php\" 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>
@@ -514,4 +513,4 @@
 	return round($size, $dec) . ' ' . $sizes[$i];
 }
 
-?>
+?>
\ No newline at end of file
diff -x .svn -aruN 0.7.24.src/e107_handlers/tiny_mce/plugins/iespell/editor_plugin_src.js 0.7.26.src/e107_handlers/tiny_mce/plugins/iespell/editor_plugin_src.js
--- 0.7.24.src/e107_handlers/tiny_mce/plugins/iespell/editor_plugin_src.js	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_handlers/tiny_mce/plugins/iespell/editor_plugin_src.js	2010-10-09 17:21:36.000000000 -0500
@@ -1,51 +1,54 @@
-/**
- * $Id: editor_plugin_src.js 11346 2010-02-17 18:56:14Z secretr $
- *
- * @author Moxiecode
- * @copyright Copyright  2004-2008, Moxiecode Systems AB, All rights reserved.
- */
-
-(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
-			};
-		}
-	});
-
-	// Register plugin
-	tinymce.PluginManager.add('iespell', tinymce.plugins.IESpell);
+/**
+ * editor_plugin_src.js
+ *
+ * Copyright 2009, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://tinymce.moxiecode.com/license
+ * Contributing: http://tinymce.moxiecode.com/contributing
+ */
+
+(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
+			};
+		}
+	});
+
+	// Register plugin
+	tinymce.PluginManager.add('iespell', tinymce.plugins.IESpell);
 })();
\ No newline at end of file
diff -x .svn -aruN 0.7.24.src/e107_handlers/tiny_mce/plugins/media/css/content.css 0.7.26.src/e107_handlers/tiny_mce/plugins/media/css/content.css
--- 0.7.24.src/e107_handlers/tiny_mce/plugins/media/css/content.css	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_handlers/tiny_mce/plugins/media/css/content.css	2010-10-09 17:21:36.000000000 -0500
@@ -1,6 +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(../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);}
+.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.24.src/e107_handlers/tiny_mce/plugins/media/css/media.css 0.7.26.src/e107_handlers/tiny_mce/plugins/media/css/media.css
--- 0.7.24.src/e107_handlers/tiny_mce/plugins/media/css/media.css	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_handlers/tiny_mce/plugins/media/css/media.css	2011-03-12 04:48:11.000000000 -0600
@@ -1,16 +1,17 @@
-#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 }
+#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, #html5_altsource1, #html5_altsource2, #html5_poster { width: 240px }
+#width, #height { width: 40px }
+#src, #media_type { width: 250px }
+#class { width: 120px }
+#prev { margin: 0; border: 1px solid black; width: 380px; height: 260px; overflow: auto }
+.panel_wrapper div.current { height: 420px; 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 }
+iframe {border: 1px solid gray}
diff -x .svn -aruN 0.7.24.src/e107_handlers/tiny_mce/plugins/media/editor_plugin.js 0.7.26.src/e107_handlers/tiny_mce/plugins/media/editor_plugin.js
--- 0.7.24.src/e107_handlers/tiny_mce/plugins/media/editor_plugin.js	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_handlers/tiny_mce/plugins/media/editor_plugin.js	2011-03-12 04:48:11.000000000 -0600
@@ -1 +1 @@
-(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&&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","data"];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}if(!f.src){f.src=f.data;delete f.data}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
+(function(){var d=tinymce.explode("id,name,width,height,style,align,class,hspace,vspace,bgcolor,type"),h=tinymce.makeMap(d.join(",")),b=tinymce.html.Node,f,a,g=tinymce.util.JSON,e;f=[["Flash","d27cdb6e-ae6d-11cf-96b8-444553540000","application/x-shockwave-flash","http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"],["ShockWave","166b1bca-3f9c-11cf-8075-444553540000","application/x-director","http://download.macromedia.com/pub/shockwave/cabs/director/sw.cab#version=8,5,1,0"],["WindowsMedia","6bf52a52-394a-11d3-b153-00c04f79faa6,22d6f312-b0f6-11d0-94ab-0080c74c7e95,05589fa1-c356-11ce-bf01-00aa0055595a","application/x-mplayer2","http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701"],["QuickTime","02bf25d5-8c17-4b23-bc80-d3488abddc6b","video/quicktime","http://www.apple.com/qtactivex/qtplugin.cab#version=6,0,2,0"],["RealMedia","cfcdaa03-8be4-11cf-b84b-0020afbbccfa","audio/x-pn-realaudio-plugin","http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"],["Java","8ad9c840-044e-11d1-b3e9-00805f499d93","application/x-java-applet","http://java.sun.com/products/plugin/autodl/jinstall-1_5_0-windows-i586.cab#Version=1,5,0,0"],["Silverlight","dfeaf541-f3e1-4c24-acac-99c30715084a","application/x-silverlight-2"],["Iframe"],["Video"]];function c(m){var l,j,k;if(m&&!m.splice){j=[];for(k=0;true;k++){if(m[k]){j[k]=m[k]}else{break}}return j}return m}tinymce.create("tinymce.plugins.MediaPlugin",{init:function(n,j){var r=this,l={},m,p,q,k;function o(i){return i&&i.nodeName==="IMG"&&n.dom.hasClass(i,"mceItemMedia")}r.editor=n;r.url=j;a="";for(m=0;m<f.length;m++){k=f[m][0];q={name:k,clsids:tinymce.explode(f[m][1]||""),mimes:tinymce.explode(f[m][2]||""),codebase:f[m][3]};for(p=0;p<q.clsids.length;p++){l["clsid:"+q.clsids[p]]=q}for(p=0;p<q.mimes.length;p++){l[q.mimes[p]]=q}l["mceItem"+k]=q;l[k.toLowerCase()]=q;a+=(a?"|":"")+k}tinymce.each(n.getParam("media_types","video=mp4,m4v,ogv,webm;silverlight=xap;flash=swf,flv;shockwave=dcr;quicktime=mov,qt,mpg,mp3,mpeg;shockwave=dcr;windowsmedia=avi,wmv,wm,asf,asx,wmx,wvx;realmedia=rm,ra,ram;java=jar").split(";"),function(v){var s,u,t;v=v.split(/=/);u=tinymce.explode(v[1].toLowerCase());for(s=0;s<u.length;s++){t=l[v[0].toLowerCase()];if(t){l[u[s]]=t}}});a=new RegExp("write("+a+")\\(([^)]+)\\)");r.lookup=l;n.onPreInit.add(function(){n.schema.addValidElements("object[id|style|width|height|classid|codebase|*],param[name|value],embed[id|style|width|height|type|src|*],video[*],audio[*],source[*]");n.parser.addNodeFilter("object,embed,video,audio,script,iframe",function(s){var t=s.length;while(t--){r.objectToImg(s[t])}});n.serializer.addNodeFilter("img",function(s,u,t){var v=s.length,w;while(v--){w=s[v];if((w.attr("class")||"").indexOf("mceItemMedia")!==-1){r.imgToObject(w,t)}}})});n.onInit.add(function(){if(n.theme&&n.theme.onResolveName){n.theme.onResolveName.add(function(i,s){if(s.name==="img"&&n.dom.hasClass(s.node,"mceItemMedia")){s.name="media"}})}if(n&&n.plugins.contextmenu){n.plugins.contextmenu.onContextMenu.add(function(s,t,i){if(i.nodeName==="IMG"&&i.className.indexOf("mceItemMedia")!==-1){t.add({title:"media.edit",icon:"media",cmd:"mceMedia"})}})}});n.addCommand("mceMedia",function(){var s,i;i=n.selection.getNode();if(o(i)){s=g.parse(n.dom.getAttrib(i,"data-mce-json"));tinymce.each(d,function(t){var u=n.dom.getAttrib(i,t);if(u){s[t]=u}});s.type=r.getType(i.className).name.toLowerCase()}if(!s){s={type:"flash",video:{sources:[]},params:{}}}n.windowManager.open({file:j+"/media.htm",width:430+parseInt(n.getLang("media.delta_width",0)),height:500+parseInt(n.getLang("media.delta_height",0)),inline:1},{plugin_url:j,data:s})});n.addButton("media",{title:"media.desc",cmd:"mceMedia"});n.onNodeChange.add(function(s,i,t){i.setActive("media",o(t))})},convertUrl:function(k,n){var j=this,m=j.editor,l=m.settings,o=l.url_converter,i=l.url_converter_scope||j;if(!k){return k}if(n){return m.documentBaseURI.toAbsolute(k)}return o.call(i,k,"src","object")},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}},dataToImg:function(m,k){var r=this,o=r.editor,p=o.documentBaseURI,j,q,n,l;m.params.src=r.convertUrl(m.params.src,k);q=m.video.attrs;if(q){q.src=r.convertUrl(q.src,k)}if(q){q.poster=r.convertUrl(q.poster,k)}j=c(m.video.sources);if(j){for(l=0;l<j.length;l++){j[l].src=r.convertUrl(j[l].src,k)}}n=r.editor.dom.create("img",{id:m.id,style:m.style,align:m.align,src:r.editor.theme.url+"/img/trans.gif","class":"mceItemMedia mceItem"+r.getType(m.type).name,"data-mce-json":g.serialize(m,"'")});n.width=m.width||"320";n.height=m.height||"240";return n},dataToHtml:function(i,j){return this.editor.serializer.serialize(this.dataToImg(i,j),{force_absolute:j})},htmlToData:function(k){var j,i,l;l={type:"flash",video:{sources:[]},params:{}};j=this.editor.parser.parse(k);i=j.getAll("img")[0];if(i){l=g.parse(i.attr("data-mce-json"));l.type=this.getType(i.attr("class")).name.toLowerCase();tinymce.each(d,function(m){var n=i.attr(m);if(n){l[m]=n}})}return l},getType:function(m){var k,j,l;j=tinymce.explode(m," ");for(k=0;k<j.length;k++){l=this.lookup[j[k]];if(l){return l}}},imgToObject:function(x,n){var t=this,o=t.editor,A,E,j,s,F,w,D,u,k,C,r,p,y,B,m,v,l,z;function q(i,G){var K,J,L,I,H;H=o.getParam("flash_video_player_url",t.convertUrl(t.url+"/moxieplayer.swf"));if(H){K=o.documentBaseURI;D.params.src=H;if(o.getParam("flash_video_player_absvideourl",true)){i=K.toAbsolute(i||"",true);G=K.toAbsolute(G||"",true)}L="";J=o.getParam("flash_video_player_flashvars",{url:"$url",poster:"$poster"});tinymce.each(J,function(N,M){N=N.replace(/\$url/,i||"");N=N.replace(/\$poster/,G||"");if(N.length>0){L+=(L?"&":"")+M+"="+escape(N)}});if(L.length){D.params.flashvars=L}I=o.getParam("flash_video_player_params",{allowfullscreen:true,allowscriptaccess:true});tinymce.each(I,function(N,M){D.params[M]=""+N})}}D=g.parse(x.attr("data-mce-json"));p=this.getType(x.attr("class"));z=x.attr("data-mce-style");if(!z){z=x.attr("style");if(z){z=o.dom.serializeStyle(o.dom.parseStyle(z,"img"))}}if(p.name==="Iframe"){v=new b("iframe",1);tinymce.each(d,function(i){var G=x.attr(i);if(i=="class"&&G){G=G.replace(/mceItem.+ ?/g,"")}if(G&&G.length>0){v.attr(i,G)}});for(F in D.params){v.attr(F,D.params[F])}v.attr({style:z,src:D.params.src});x.replace(v);return}if(this.editor.settings.media_use_script){v=new b("script",1).attr("type","text/javascript");w=new b("#text",3);w.value="write"+p.name+"("+g.serialize(tinymce.extend(D.params,{width:x.attr("width"),height:x.attr("height")}))+");";v.append(w);x.replace(v);return}if(p.name==="Video"&&D.video.sources[0]){A=new b("video",1).attr(tinymce.extend({id:x.attr("id"),width:x.attr("width"),height:x.attr("height"),style:z},D.video.attrs));if(D.video.attrs){l=D.video.attrs.poster}k=D.video.sources=c(D.video.sources);for(y=0;y<k.length;y++){if(/\.mp4$/.test(k[y].src)){m=k[y].src}}if(!k[0].type){A.attr("src",k[0].src);k.splice(0,1)}for(y=0;y<k.length;y++){u=new b("source",1).attr(k[y]);u.shortEnded=true;A.append(u)}if(m){q(m,l);p=t.getType("flash")}else{D.params.src=""}}if(D.params.src){if(/\.flv$/i.test(D.params.src)){q(D.params.src,"")}if(n&&n.force_absolute){D.params.src=o.documentBaseURI.toAbsolute(D.params.src)}E=new b("object",1).attr({id:x.attr("id"),width:x.attr("width"),height:x.attr("height"),style:z});tinymce.each(d,function(i){if(D[i]&&i!="type"){E.attr(i,D[i])}});for(F in D.params){r=new b("param",1);r.shortEnded=true;w=D.params[F];if(F==="src"&&p.name==="WindowsMedia"){F="url"}r.attr({name:F,value:w});E.append(r)}if(this.editor.getParam("media_strict",true)){E.attr({data:D.params.src,type:p.mimes[0]})}else{E.attr({classid:"clsid:"+p.clsids[0],codebase:p.codebase});j=new b("embed",1);j.shortEnded=true;j.attr({id:x.attr("id"),width:x.attr("width"),height:x.attr("height"),style:z,type:p.mimes[0]});for(F in D.params){j.attr(F,D.params[F])}tinymce.each(d,function(i){if(D[i]&&i!="type"){j.attr(i,D[i])}});E.append(j)}if(D.object_html){w=new b("#text",3);w.raw=true;w.value=D.object_html;E.append(w)}if(A){A.append(E)}}if(A){if(D.video_html){w=new b("#text",3);w.raw=true;w.value=D.video_html;A.append(w)}}if(A||E){x.replace(A||E)}else{x.remove()}},objectToImg:function(y){var F,j,A,p,G,H,u,w,t,B,z,q,o,D,x,k,E,n,C=this.lookup,l,v,s=this.editor.settings.url_converter,m=this.editor.settings.url_converter_scope;function r(i){return new tinymce.html.Serializer({inner:true,validate:false}).serialize(i)}if(!y.parent){return}if(y.name==="script"){if(y.firstChild){l=a.exec(y.firstChild.value)}if(!l){return}n=l[1];E={video:{},params:g.parse(l[2])};w=E.params.width;t=E.params.height}E=E||{video:{},params:{}};G=new b("img",1);G.attr({src:this.editor.theme.url+"/img/trans.gif"});H=y.name;if(H==="video"){A=y;F=y.getAll("object")[0];j=y.getAll("embed")[0];w=A.attr("width");t=A.attr("height");u=A.attr("id");E.video={attrs:{},sources:[]};v=E.video.attrs;for(H in A.attributes.map){v[H]=A.attributes.map[H]}x=y.attr("src");if(x){E.video.sources.push({src:s.call(m,x,"src","video")})}k=A.getAll("source");for(z=0;z<k.length;z++){x=k[z].remove();E.video.sources.push({src:s.call(m,x.attr("src"),"src","source"),type:x.attr("type"),media:x.attr("media")})}if(v.poster){v.poster=s.call(m,v.poster,"poster","video")}}if(y.name==="object"){F=y;j=y.getAll("embed")[0]}if(y.name==="embed"){j=y}if(y.name==="iframe"){p=y;n="Iframe"}if(F){w=w||F.attr("width");t=t||F.attr("height");B=B||F.attr("style");u=u||F.attr("id");D=F.getAll("param");for(z=0;z<D.length;z++){o=D[z];H=o.remove().attr("name");if(!h[H]){E.params[H]=o.attr("value")}}E.params.src=E.params.src||F.attr("data")}if(j){w=w||j.attr("width");t=t||j.attr("height");B=B||j.attr("style");u=u||j.attr("id");for(H in j.attributes.map){if(!h[H]&&!E.params[H]){E.params[H]=j.attributes.map[H]}}}if(p){w=p.attr("width");t=p.attr("height");B=B||p.attr("style");u=p.attr("id");tinymce.each(d,function(i){G.attr(i,p.attr(i))});for(H in p.attributes.map){if(!h[H]&&!E.params[H]){E.params[H]=p.attributes.map[H]}}}if(E.params.movie){E.params.src=E.params.src||E.params.movie;delete E.params.movie}if(E.params.src){E.params.src=s.call(m,E.params.src,"src","object")}if(A){n=C.video.name}if(F&&!n){n=(C[(F.attr("clsid")||"").toLowerCase()]||C[(F.attr("type")||"").toLowerCase()]||{}).name}if(j&&!n){n=(C[(j.attr("type")||"").toLowerCase()]||{}).name}y.replace(G);if(j){j.remove()}if(F){q=r(F.remove());if(q){E.object_html=q}}if(A){q=r(A.remove());if(q){E.video_html=q}}G.attr({id:u,"class":"mceItemMedia mceItem"+(n||"Flash"),style:B,width:w||"320",height:t||"240","data-mce-json":g.serialize(E,"'")})}});tinymce.PluginManager.add("media",tinymce.plugins.MediaPlugin)})();
\ No newline at end of file
diff -x .svn -aruN 0.7.24.src/e107_handlers/tiny_mce/plugins/media/editor_plugin_src.js 0.7.26.src/e107_handlers/tiny_mce/plugins/media/editor_plugin_src.js
--- 0.7.24.src/e107_handlers/tiny_mce/plugins/media/editor_plugin_src.js	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_handlers/tiny_mce/plugins/media/editor_plugin_src.js	2011-03-12 04:48:11.000000000 -0600
@@ -1,411 +1,770 @@
-/**
- * $Id: editor_plugin_src.js 11346 2010-02-17 18:56:14Z secretr $
- *
- * @author Moxiecode
- * @copyright Copyright  2004-2008, Moxiecode Systems AB, All rights reserved.
- */
-
-(function() {
-	var each = tinymce.each;
-
-	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
-				});
-			});
-
-			// Register buttons
-			ed.addButton('media', {title : 'media.desc', cmd : 'mceMedia'});
-
-			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'
-				};
-
-				ed.selection.onSetContent.add(function() {
-					t._spansToImgs(ed.getBody());
-				});
-
-				ed.selection.onBeforeSetContent.add(t._objectsToSpans, t);
-
-				if (ed.settings.content_css !== false)
-					ed.dom.loadCSS(url + "/css/content.css");
-
-				if (ed.theme && 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;
-								}
-							});
-						}
-					});
-				}
-
-				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'});
-						}
-					});
-				}
-			});
-
-			ed.onBeforeSetContent.add(t._objectsToSpans, t);
-
-			ed.onSetContent.add(function() {
-				t._spansToImgs(ed.getBody());
-			});
-
-			ed.onPreProcess.add(function(ed, o) {
-				var dom = ed.dom;
-
-				if (o.set) {
-					t._spansToImgs(o.node);
-
-					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));
-						}
-					});
-				}
-
-				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');
-
-							return;
-						}
-
-						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';
-								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 = 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';
-								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 (ci) {
-							dom.replace(t._buildObj({
-								classid : ci,
-								codebase : cb,
-								type : mt
-							}, n), n);
-						}
-					});
-				}
-			});
-
-			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>';
-						}
-
-						return im;
-					});
-				}
-			});
-		},
-
-		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
-				});
-			}
-
-			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';
-
-					if (v)
-						dom.add(ob, 'span', {mce_name : 'param', name : k, '_mce_value' : v});
-				}
-			});
-
-			if (!stc)
-				dom.add(ob, 'span', tinymce.extend({mce_name : 'embed', type : o.type, style : dom.getAttrib(n, 'style')}, p));
-
-			return ob;
-		},
-
-		_spansToImgs : function(p) {
-			var t = this, dom = t.editor.dom, im, ci;
-
-			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, '');
-
-					switch (ci) {
-						case 'clsid:d27cdb6e-ae6d-11cf-96b8-444553540000':
-							dom.replace(t._createImg('mceItemFlash', n), n);
-							break;
-
-						case 'clsid:166b1bca-3f9c-11cf-8075-444553540000':
-							dom.replace(t._createImg('mceItemShockWave', n), n);
-							break;
-
-						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;
-
-						case 'clsid:02bf25d5-8c17-4b23-bc80-d3488abddc6b':
-							dom.replace(t._createImg('mceItemQuickTime', n), n);
-							break;
-
-						case 'clsid:cfcdaa03-8be4-11cf-b84b-0020afbbccfa':
-							dom.replace(t._createImg('mceItemRealMedia', n), n);
-							break;
-
-						default:
-							dom.replace(t._createImg('mceItemFlash', n), n);
-					}
-					
-					return;
-				}
-
-				// 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;
-
-						case 'application/x-director':
-							dom.replace(t._createImg('mceItemShockWave', n), n);
-							break;
-
-						case 'application/x-mplayer2':
-							dom.replace(t._createImg('mceItemWindowsMedia', n), n);
-							break;
-
-						case 'video/quicktime':
-							dom.replace(t._createImg('mceItemQuickTime', n), n);
-							break;
-
-						case 'audio/x-pn-realaudio-plugin':
-							dom.replace(t._createImg('mceItemRealMedia', n), n);
-							break;
-
-						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', 'data'];	
-
-			// 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;
-			}
-
-			// No src try data
-			if (!pa.src) {
-				pa.src = pa.data;
-				delete pa.data;
-			}
-
-			// Merge with embed args
-			n = dom.select('.mceItemEmbed', n)[0];
-			if (n) {
-				each(args, function(na) {
-					var v = dom.getAttrib(n, na);
-
-					if (v && !pa[na])
-						pa[na] = v;
-				});
-			}
-
-			delete pa.width;
-			delete pa.height;
-
-			im.title = this._serialize(pa);
-
-			return im;
-		},
-
-		_parse : function(s) {
-			return tinymce.util.JSON.parse('{' + s + '}');
-		},
-
-		_serialize : function(o) {
-			return tinymce.util.JSON.serialize(o).replace(/[{}]/g, '');
-		}
-	});
-
-	// Register plugin
-	tinymce.PluginManager.add('media', tinymce.plugins.MediaPlugin);
+/**
+ * editor_plugin_src.js
+ *
+ * Copyright 2009, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://tinymce.moxiecode.com/license
+ * Contributing: http://tinymce.moxiecode.com/contributing
+ */
+
+(function() {
+	var rootAttributes = tinymce.explode('id,name,width,height,style,align,class,hspace,vspace,bgcolor,type'), excludedAttrs = tinymce.makeMap(rootAttributes.join(',')), Node = tinymce.html.Node,
+		mediaTypes, scriptRegExp, JSON = tinymce.util.JSON, mimeTypes;
+
+	// Media types supported by this plugin
+	mediaTypes = [
+		// Type, clsid:s, mime types, codebase
+		["Flash", "d27cdb6e-ae6d-11cf-96b8-444553540000", "application/x-shockwave-flash", "http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"],
+		["ShockWave", "166b1bca-3f9c-11cf-8075-444553540000", "application/x-director", "http://download.macromedia.com/pub/shockwave/cabs/director/sw.cab#version=8,5,1,0"],
+		["WindowsMedia", "6bf52a52-394a-11d3-b153-00c04f79faa6,22d6f312-b0f6-11d0-94ab-0080c74c7e95,05589fa1-c356-11ce-bf01-00aa0055595a", "application/x-mplayer2", "http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701"],
+		["QuickTime", "02bf25d5-8c17-4b23-bc80-d3488abddc6b", "video/quicktime", "http://www.apple.com/qtactivex/qtplugin.cab#version=6,0,2,0"],
+		["RealMedia", "cfcdaa03-8be4-11cf-b84b-0020afbbccfa", "audio/x-pn-realaudio-plugin", "http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"],
+		["Java", "8ad9c840-044e-11d1-b3e9-00805f499d93", "application/x-java-applet", "http://java.sun.com/products/plugin/autodl/jinstall-1_5_0-windows-i586.cab#Version=1,5,0,0"],
+		["Silverlight", "dfeaf541-f3e1-4c24-acac-99c30715084a", "application/x-silverlight-2"],
+		["Iframe"],
+		["Video"]
+	];
+
+	function toArray(obj) {
+		var undef, out, i;
+
+		if (obj && !obj.splice) {
+			out = [];
+
+			for (i = 0; true; i++) {
+				if (obj[i])
+					out[i] = obj[i];
+				else
+					break;
+			}
+
+			return out;
+		}
+
+		return obj;
+	};
+
+	tinymce.create('tinymce.plugins.MediaPlugin', {
+		init : function(ed, url) {
+			var self = this, lookup = {}, i, y, item, name;
+
+			function isMediaImg(node) {
+				return node && node.nodeName === 'IMG' && ed.dom.hasClass(node, 'mceItemMedia');
+			};
+
+			self.editor = ed;
+			self.url = url;
+
+			// Parse media types into a lookup table
+			scriptRegExp = '';
+			for (i = 0; i < mediaTypes.length; i++) {
+				name = mediaTypes[i][0];
+
+				item = {
+					name : name,
+					clsids : tinymce.explode(mediaTypes[i][1] || ''),
+					mimes : tinymce.explode(mediaTypes[i][2] || ''),
+					codebase : mediaTypes[i][3]
+				};
+
+				for (y = 0; y < item.clsids.length; y++)
+					lookup['clsid:' + item.clsids[y]] = item;
+
+				for (y = 0; y < item.mimes.length; y++)
+					lookup[item.mimes[y]] = item;
+
+				lookup['mceItem' + name] = item;
+				lookup[name.toLowerCase()] = item;
+
+				scriptRegExp += (scriptRegExp ? '|' : '') + name;
+			}
+
+			// Handle the media_types setting
+			tinymce.each(ed.getParam("media_types",
+				"video=mp4,m4v,ogv,webm;" +
+				"silverlight=xap;" +
+				"flash=swf,flv;" +
+				"shockwave=dcr;" +
+				"quicktime=mov,qt,mpg,mp3,mpeg;" +
+				"shockwave=dcr;" +
+				"windowsmedia=avi,wmv,wm,asf,asx,wmx,wvx;" +
+				"realmedia=rm,ra,ram;" +
+				"java=jar"
+			).split(';'), function(item) {
+				var i, extensions, type;
+
+				item = item.split(/=/);
+				extensions = tinymce.explode(item[1].toLowerCase());
+				for (i = 0; i < extensions.length; i++) {
+					type = lookup[item[0].toLowerCase()];
+
+					if (type)
+						lookup[extensions[i]] = type;
+				}
+			});
+
+			scriptRegExp = new RegExp('write(' + scriptRegExp + ')\\(([^)]+)\\)');
+			self.lookup = lookup;
+
+			ed.onPreInit.add(function() {
+				// Allow video elements
+				ed.schema.addValidElements('object[id|style|width|height|classid|codebase|*],param[name|value],embed[id|style|width|height|type|src|*],video[*],audio[*],source[*]');
+
+				// Convert video elements to image placeholder
+				ed.parser.addNodeFilter('object,embed,video,audio,script,iframe', function(nodes) {
+					var i = nodes.length;
+
+					while (i--)
+						self.objectToImg(nodes[i]);
+				});
+
+				// Convert image placeholders to video elements
+				ed.serializer.addNodeFilter('img', function(nodes, name, args) {
+					var i = nodes.length, node;
+
+					while (i--) {
+						node = nodes[i];
+						if ((node.attr('class') || '').indexOf('mceItemMedia') !== -1)
+							self.imgToObject(node, args);
+					}
+				});
+			});
+
+			ed.onInit.add(function() {
+				// Display "media" instead of "img" in element path
+				if (ed.theme && ed.theme.onResolveName) {
+					ed.theme.onResolveName.add(function(theme, path_object) {
+						if (path_object.name === 'img' && ed.dom.hasClass(path_object.node, 'mceItemMedia'))
+							path_object.name = 'media';
+					});
+				}
+
+				// Add contect menu if it's loaded
+				if (ed && ed.plugins.contextmenu) {
+					ed.plugins.contextmenu.onContextMenu.add(function(plugin, menu, element) {
+						if (element.nodeName === 'IMG' && element.className.indexOf('mceItemMedia') !== -1)
+							menu.add({title : 'media.edit', icon : 'media', cmd : 'mceMedia'});
+					});
+				}
+			});
+
+			// Register commands
+			ed.addCommand('mceMedia', function() {
+				var data, img;
+
+				img = ed.selection.getNode();
+				if (isMediaImg(img)) {
+					data = JSON.parse(ed.dom.getAttrib(img, 'data-mce-json'));
+
+					// Add some extra properties to the data object
+					tinymce.each(rootAttributes, function(name) {
+						var value = ed.dom.getAttrib(img, name);
+
+						if (value)
+							data[name] = value;
+					});
+
+					data.type = self.getType(img.className).name.toLowerCase();
+				}
+
+				if (!data) {
+					data = {
+						type : 'flash',
+						video: {sources:[]},
+						params: {}
+					};
+				}
+
+				ed.windowManager.open({
+					file : url + '/media.htm',
+					width : 430 + parseInt(ed.getLang('media.delta_width', 0)),
+					height : 500 + parseInt(ed.getLang('media.delta_height', 0)),
+					inline : 1
+				}, {
+					plugin_url : url,
+					data : data
+				});
+			});
+
+			// Register buttons
+			ed.addButton('media', {title : 'media.desc', cmd : 'mceMedia'});
+
+			// Update media selection status
+			ed.onNodeChange.add(function(ed, cm, node) {
+				cm.setActive('media', isMediaImg(node));
+			});
+		},
+
+		convertUrl : function(url, force_absolute) {
+			var self = this, editor = self.editor, settings = editor.settings,
+				urlConverter = settings.url_converter,
+				urlConverterScope = settings.url_converter_scope || self;
+
+			if (!url)
+				return url;
+
+			if (force_absolute)
+				return editor.documentBaseURI.toAbsolute(url);
+
+			return urlConverter.call(urlConverterScope, url, 'src', 'object');
+		},
+
+		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
+			};
+		},
+
+		/**
+		 * Converts the JSON data object to an img node.
+		 */
+		dataToImg : function(data, force_absolute) {
+			var self = this, editor = self.editor, baseUri = editor.documentBaseURI, sources, attrs, img, i;
+
+			data.params.src = self.convertUrl(data.params.src, force_absolute);
+
+			attrs = data.video.attrs;
+			if (attrs)
+				attrs.src = self.convertUrl(attrs.src, force_absolute);
+
+			if (attrs)
+				attrs.poster = self.convertUrl(attrs.poster, force_absolute);
+
+			sources = toArray(data.video.sources);
+			if (sources) {
+				for (i = 0; i < sources.length; i++)
+					sources[i].src = self.convertUrl(sources[i].src, force_absolute);
+			}
+
+			img = self.editor.dom.create('img', {
+				id : data.id,
+				style : data.style,
+				align : data.align,
+				src : self.editor.theme.url + '/img/trans.gif',
+				'class' : 'mceItemMedia mceItem' + self.getType(data.type).name,
+				'data-mce-json' : JSON.serialize(data, "'")
+			});
+
+			img.width = data.width || "320";
+			img.height = data.height || "240";
+
+			return img;
+		},
+
+		/**
+		 * Converts the JSON data object to a HTML string.
+		 */
+		dataToHtml : function(data, force_absolute) {
+			return this.editor.serializer.serialize(this.dataToImg(data, force_absolute), {force_absolute : force_absolute});
+		},
+
+		/**
+		 * Converts the JSON data object to a HTML string.
+		 */
+		htmlToData : function(html) {
+			var fragment, img, data;
+
+			data = {
+				type : 'flash',
+				video: {sources:[]},
+				params: {}
+			};
+
+			fragment = this.editor.parser.parse(html);
+			img = fragment.getAll('img')[0];
+
+			if (img) {
+				data = JSON.parse(img.attr('data-mce-json'));
+				data.type = this.getType(img.attr('class')).name.toLowerCase();
+
+				// Add some extra properties to the data object
+				tinymce.each(rootAttributes, function(name) {
+					var value = img.attr(name);
+
+					if (value)
+						data[name] = value;
+				});
+			}
+
+			return data;
+		},
+
+		/**
+		 * Get type item by extension, class, clsid or mime type.
+		 *
+		 * @method getType
+		 * @param {String} value Value to get type item by.
+		 * @return {Object} Type item object or undefined.
+		 */
+		getType : function(value) {
+			var i, values, typeItem;
+
+			// Find type by checking the classes
+			values = tinymce.explode(value, ' ');
+			for (i = 0; i < values.length; i++) {
+				typeItem = this.lookup[values[i]];
+
+				if (typeItem)
+					return typeItem;
+			}
+		},
+
+		/**
+		 * Converts a tinymce.html.Node image element to video/object/embed.
+		 */
+		imgToObject : function(node, args) {
+			var self = this, editor = self.editor, video, object, embed, iframe, name, value, data,
+				source, sources, params, param, typeItem, i, item, mp4Source, replacement,
+				posterSrc, style;
+
+			// Adds the flash player
+			function addPlayer(video_src, poster_src) {
+				var baseUri, flashVars, flashVarsOutput, params, flashPlayer;
+
+				flashPlayer = editor.getParam('flash_video_player_url', self.convertUrl(self.url + '/moxieplayer.swf'));
+				if (flashPlayer) {
+					baseUri = editor.documentBaseURI;
+					data.params.src = flashPlayer;
+
+					// Convert the movie url to absolute urls
+					if (editor.getParam('flash_video_player_absvideourl', true)) {
+						video_src = baseUri.toAbsolute(video_src || '', true);
+						poster_src = baseUri.toAbsolute(poster_src || '', true);
+					}
+
+					// Generate flash vars
+					flashVarsOutput = '';
+					flashVars = editor.getParam('flash_video_player_flashvars', {url : '$url', poster : '$poster'});
+					tinymce.each(flashVars, function(value, name) {
+						// Replace $url and $poster variables in flashvars value
+						value = value.replace(/\$url/, video_src || '');
+						value = value.replace(/\$poster/, poster_src || '');
+
+						if (value.length > 0)
+							flashVarsOutput += (flashVarsOutput ? '&' : '') + name + '=' + escape(value);
+					});
+
+					if (flashVarsOutput.length)
+						data.params.flashvars = flashVarsOutput;
+
+					params = editor.getParam('flash_video_player_params', {
+						allowfullscreen: true,
+						allowscriptaccess: true
+					});
+
+					tinymce.each(params, function(value, name) {
+						data.params[name] = "" + value;
+					});
+				}
+			};
+
+			data = JSON.parse(node.attr('data-mce-json'));
+			typeItem = this.getType(node.attr('class'));
+
+			style = node.attr('data-mce-style')
+			if (!style) {
+				style = node.attr('style');
+
+				if (style)
+					style = editor.dom.serializeStyle(editor.dom.parseStyle(style, 'img'));
+			}
+
+			// Handle iframe
+			if (typeItem.name === 'Iframe') {
+				replacement = new Node('iframe', 1);
+
+				tinymce.each(rootAttributes, function(name) {
+					var value = node.attr(name);
+
+					if (name == 'class' && value)
+						value = value.replace(/mceItem.+ ?/g, '');
+
+					if (value && value.length > 0)
+						replacement.attr(name, value);
+				});
+
+				for (name in data.params)
+					replacement.attr(name, data.params[name]);
+
+				replacement.attr({
+					style: style,
+					src: data.params.src
+				});
+
+				node.replace(replacement);
+
+				return;
+			}
+
+			// Handle scripts
+			if (this.editor.settings.media_use_script) {
+				replacement = new Node('script', 1).attr('type', 'text/javascript');
+
+				value = new Node('#text', 3);
+				value.value = 'write' + typeItem.name + '(' + JSON.serialize(tinymce.extend(data.params, {
+					width: node.attr('width'),
+					height: node.attr('height')
+				})) + ');';
+
+				replacement.append(value);
+				node.replace(replacement);
+
+				return;
+			}
+
+			// Add HTML5 video element
+			if (typeItem.name === 'Video' && data.video.sources[0]) {
+				// Create new object element
+				video = new Node('video', 1).attr(tinymce.extend({
+					id : node.attr('id'),
+					width: node.attr('width'),
+					height: node.attr('height'),
+					style : style
+				}, data.video.attrs));
+
+				// Get poster source and use that for flash fallback
+				if (data.video.attrs)
+					posterSrc = data.video.attrs.poster;
+
+				sources = data.video.sources = toArray(data.video.sources);
+				for (i = 0; i < sources.length; i++) {
+					if (/\.mp4$/.test(sources[i].src))
+						mp4Source = sources[i].src;
+				}
+
+				if (!sources[0].type) {
+					video.attr('src', sources[0].src);
+					sources.splice(0, 1);
+				}
+
+				for (i = 0; i < sources.length; i++) {
+					source = new Node('source', 1).attr(sources[i]);
+					source.shortEnded = true;
+					video.append(source);
+				}
+
+				// Create flash fallback for video if we have a mp4 source
+				if (mp4Source) {
+					addPlayer(mp4Source, posterSrc);
+					typeItem = self.getType('flash');
+				} else
+					data.params.src = '';
+			}
+
+			// Do we have a params src then we can generate object
+			if (data.params.src) {
+				// Is flv movie add player for it
+				if (/\.flv$/i.test(data.params.src))
+					addPlayer(data.params.src, '');
+
+				if (args && args.force_absolute)
+					data.params.src = editor.documentBaseURI.toAbsolute(data.params.src);
+
+				// Create new object element
+				object = new Node('object', 1).attr({
+					id : node.attr('id'),
+					width: node.attr('width'),
+					height: node.attr('height'),
+					style : style
+				});
+
+				tinymce.each(rootAttributes, function(name) {
+					if (data[name] && name != 'type')
+						object.attr(name, data[name]);
+				});
+
+				// Add params
+				for (name in data.params) {
+					param = new Node('param', 1);
+					param.shortEnded = true;
+					value = data.params[name];
+
+					// Windows media needs to use url instead of src for the media URL
+					if (name === 'src' && typeItem.name === 'WindowsMedia')
+						name = 'url';
+
+					param.attr({name: name, value: value});
+					object.append(param);
+				}
+
+				// Setup add type and classid if strict is disabled
+				if (this.editor.getParam('media_strict', true)) {
+					object.attr({
+						data: data.params.src,
+						type: typeItem.mimes[0]
+					});
+				} else {
+					object.attr({
+						classid: "clsid:" + typeItem.clsids[0],
+						codebase: typeItem.codebase
+					});
+
+					embed = new Node('embed', 1);
+					embed.shortEnded = true;
+					embed.attr({
+						id: node.attr('id'),
+						width: node.attr('width'),
+						height: node.attr('height'),
+						style : style,
+						type: typeItem.mimes[0]
+					});
+
+					for (name in data.params)
+						embed.attr(name, data.params[name]);
+
+					tinymce.each(rootAttributes, function(name) {
+						if (data[name] && name != 'type')
+							embed.attr(name, data[name]);
+					});
+
+					object.append(embed);
+				}
+
+				// Insert raw HTML
+				if (data.object_html) {
+					value = new Node('#text', 3);
+					value.raw = true;
+					value.value = data.object_html;
+					object.append(value);
+				}
+
+				// Append object to video element if it exists
+				if (video)
+					video.append(object);
+			}
+
+			if (video) {
+				// Insert raw HTML
+				if (data.video_html) {
+					value = new Node('#text', 3);
+					value.raw = true;
+					value.value = data.video_html;
+					video.append(value);
+				}
+			}
+
+			if (video || object)
+				node.replace(video || object);
+			else
+				node.remove();
+		},
+
+		/**
+		 * Converts a tinymce.html.Node video/object/embed to an img element.
+		 *
+		 * The video/object/embed will be converted into an image placeholder with a JSON data attribute like this:
+		 * <img class="mceItemMedia mceItemFlash" width="100" height="100" data-mce-json="{..}" />
+		 *
+		 * The JSON structure will be like this:
+		 * {'params':{'flashvars':'something','quality':'high','src':'someurl'}, 'video':{'sources':[{src: 'someurl', type: 'video/mp4'}]}}
+		 */
+		objectToImg : function(node) {
+			var object, embed, video, iframe, img, name, id, width, height, style, i, html,
+				param, params, source, sources, data, type, lookup = this.lookup,
+				matches, attrs, urlConverter = this.editor.settings.url_converter,
+				urlConverterScope = this.editor.settings.url_converter_scope;
+
+			function getInnerHTML(node) {
+				return new tinymce.html.Serializer({
+					inner: true,
+					validate: false
+				}).serialize(node);
+			};
+
+			// If node isn't in document
+			if (!node.parent)
+				return;
+
+			// Handle media scripts
+			if (node.name === 'script') {
+				if (node.firstChild)
+					matches = scriptRegExp.exec(node.firstChild.value);
+
+				if (!matches)
+					return;
+
+				type = matches[1];
+				data = {video : {}, params : JSON.parse(matches[2])};
+				width = data.params.width;
+				height = data.params.height;
+			}
+
+			// Setup data objects
+			data = data || {
+				video : {},
+				params : {}
+			};
+
+			// Setup new image object
+			img = new Node('img', 1);
+			img.attr({
+				src : this.editor.theme.url + '/img/trans.gif'
+			});
+
+			// Video element
+			name = node.name;
+			if (name === 'video') {
+				video = node;
+				object = node.getAll('object')[0];
+				embed = node.getAll('embed')[0];
+				width = video.attr('width');
+				height = video.attr('height');
+				id = video.attr('id');
+				data.video = {attrs : {}, sources : []};
+
+				// Get all video attributes
+				attrs = data.video.attrs;
+				for (name in video.attributes.map)
+					attrs[name] = video.attributes.map[name];
+
+				source = node.attr('src');
+				if (source)
+					data.video.sources.push({src : urlConverter.call(urlConverterScope, source, 'src', 'video')});
+
+				// Get all sources
+				sources = video.getAll("source");
+				for (i = 0; i < sources.length; i++) {
+					source = sources[i].remove();
+
+					data.video.sources.push({
+						src: urlConverter.call(urlConverterScope, source.attr('src'), 'src', 'source'),
+						type: source.attr('type'),
+						media: source.attr('media')
+					});
+				}
+
+				// Convert the poster URL
+				if (attrs.poster)
+					attrs.poster = urlConverter.call(urlConverterScope, attrs.poster, 'poster', 'video');
+			}
+
+			// Object element
+			if (node.name === 'object') {
+				object = node;
+				embed = node.getAll('embed')[0];
+			}
+
+			// Embed element
+			if (node.name === 'embed')
+				embed = node;
+
+			// Iframe element
+			if (node.name === 'iframe') {
+				iframe = node;
+				type = 'Iframe';
+			}
+
+			if (object) {
+				// Get width/height
+				width = width || object.attr('width');
+				height = height || object.attr('height');
+				style = style || object.attr('style');
+				id = id || object.attr('id');
+
+				// Get all object params
+				params = object.getAll("param");
+				for (i = 0; i < params.length; i++) {
+					param = params[i];
+					name = param.remove().attr('name');
+
+					if (!excludedAttrs[name])
+						data.params[name] = param.attr('value');
+				}
+
+				data.params.src = data.params.src || object.attr('data');
+			}
+
+			if (embed) {
+				// Get width/height
+				width = width || embed.attr('width');
+				height = height || embed.attr('height');
+				style = style || embed.attr('style');
+				id = id || embed.attr('id');
+
+				// Get all embed attributes
+				for (name in embed.attributes.map) {
+					if (!excludedAttrs[name] && !data.params[name])
+						data.params[name] = embed.attributes.map[name];
+				}
+			}
+
+			if (iframe) {
+				// Get width/height
+				width = iframe.attr('width');
+				height = iframe.attr('height');
+				style = style || iframe.attr('style');
+				id = iframe.attr('id');
+
+				tinymce.each(rootAttributes, function(name) {
+					img.attr(name, iframe.attr(name));
+				});
+
+				// Get all iframe attributes
+				for (name in iframe.attributes.map) {
+					if (!excludedAttrs[name] && !data.params[name])
+						data.params[name] = iframe.attributes.map[name];
+				}
+			}
+
+			// Use src not movie
+			if (data.params.movie) {
+				data.params.src = data.params.src || data.params.movie;
+				delete data.params.movie;
+			}
+
+			// Convert the URL to relative/absolute depending on configuration
+			if (data.params.src)
+				data.params.src = urlConverter.call(urlConverterScope, data.params.src, 'src', 'object');
+
+			if (video)
+				type = lookup.video.name;
+
+			if (object && !type)
+				type = (lookup[(object.attr('clsid') || '').toLowerCase()] || lookup[(object.attr('type') || '').toLowerCase()] || {}).name;
+
+			if (embed && !type)
+				type = (lookup[(embed.attr('type') || '').toLowerCase()] || {}).name;
+
+			// Replace the video/object/embed element with a placeholder image containing the data
+			node.replace(img);
+
+			// Remove embed
+			if (embed)
+				embed.remove();
+
+			// Serialize the inner HTML of the object element
+			if (object) {
+				html = getInnerHTML(object.remove());
+
+				if (html)
+					data.object_html = html;
+			}
+
+			// Serialize the inner HTML of the video element
+			if (video) {
+				html = getInnerHTML(video.remove());
+
+				if (html)
+					data.video_html = html;
+			}
+
+			// Set width/height of placeholder
+			img.attr({
+				id : id,
+				'class' : 'mceItemMedia mceItem' + (type || 'Flash'),
+				style : style,
+				width : width || "320",
+				height : height || "240",
+				"data-mce-json" : JSON.serialize(data, "'")
+			});
+		}
+	});
+
+	// Register plugin
+	tinymce.PluginManager.add('media', tinymce.plugins.MediaPlugin);
 })();
\ No newline at end of file
diff -x .svn -aruN 0.7.24.src/e107_handlers/tiny_mce/plugins/media/js/embed.js 0.7.26.src/e107_handlers/tiny_mce/plugins/media/js/embed.js
--- 0.7.24.src/e107_handlers/tiny_mce/plugins/media/js/embed.js	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_handlers/tiny_mce/plugins/media/js/embed.js	2010-10-09 17:21:36.000000000 -0500
@@ -1,73 +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);
-}
+/**
+ * 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.24.src/e107_handlers/tiny_mce/plugins/media/js/media.js 0.7.26.src/e107_handlers/tiny_mce/plugins/media/js/media.js
--- 0.7.24.src/e107_handlers/tiny_mce/plugins/media/js/media.js	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_handlers/tiny_mce/plugins/media/js/media.js	2011-03-30 03:22:40.000000000 -0500
@@ -1,630 +1,354 @@
-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);
+(function() {
+	var 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 get(id) {
+		return document.getElementById(id);
+	}
+
+	function getVal(id) {
+		var elm = get(id);
+
+		if (elm.nodeName == "SELECT")
+			return elm.options[elm.selectedIndex].value;
+
+		if (elm.type == "checkbox")
+			return elm.checked;
+
+		return elm.value;
+	}
+
+	function setVal(id, value) {
+		if (typeof(value) != 'undefined') {
+			var elm = get(id);
+
+			if (elm.nodeName == "SELECT")
+				selectByValue(document.forms[0], id, value);
+			else if (elm.type == "checkbox") {
+				if (typeof(value) == 'string')
+					elm.checked = value.toLowerCase() === 'true' ? true : false;
+				else
+					elm.checked = !!value;
+			} else
+				elm.value = value;
+		}
+	}
+
+	window.Media = {
+		init : function() {
+			var html, editor;
+
+			this.editor = editor = tinyMCEPopup.editor;
+
+			// Setup file browsers and color pickers
+			get('filebrowsercontainer').innerHTML = getBrowserHTML('filebrowser','src','media','media');
+			get('qtsrcfilebrowsercontainer').innerHTML = getBrowserHTML('qtsrcfilebrowser','quicktime_qtsrc','media','media');
+			get('bgcolor_pickcontainer').innerHTML = getColorPickerHTML('bgcolor_pick','bgcolor');
+			get('video_altsource1_filebrowser').innerHTML = getBrowserHTML('filebrowser_altsource1','video_altsource1','media','media');
+			get('video_altsource2_filebrowser').innerHTML = getBrowserHTML('filebrowser_altsource2','video_altsource2','media','media');
+			get('video_poster_filebrowser').innerHTML = getBrowserHTML('filebrowser_poster','video_poster','media','image');
+
+			html = this.getMediaListHTML('medialist', 'src', 'media', 'media');
+			if (html == "")
+				get("linklistrow").style.display = 'none';
+			else
+				get("linklistcontainer").innerHTML = html;
+
+			if (isVisible('filebrowser'))
+				get('src').style.width = '230px';
+
+			if (isVisible('filebrowser_altsource1'))
+				get('video_altsource1').style.width = '220px';
+
+			if (isVisible('filebrowser_altsource2'))
+				get('video_altsource2').style.width = '220px';
+
+			if (isVisible('filebrowser_poster'))
+				get('video_poster').style.width = '220px';
+
+			this.data = tinyMCEPopup.getWindowArg('data');
+			this.dataToForm();
+			this.preview();
+		},
+
+		insert : function() {
+			var editor = tinyMCEPopup.editor;
+
+			this.formToData();
+			editor.execCommand('mceRepaint');
+			tinyMCEPopup.restoreSelection();
+			editor.selection.setNode(editor.plugins.media.dataToImg(this.data));
+			tinyMCEPopup.close();
+		},
+
+		preview : function() {
+			get('prev').innerHTML = this.editor.plugins.media.dataToHtml(this.data, true);
+		},
+
+		moveStates : function(to_form, field) {
+			var data = this.data, editor = this.editor, data = this.data,
+				mediaPlugin = editor.plugins.media, ext, src, typeInfo, defaultStates, src;
+
+			defaultStates = {
+				// QuickTime
+				quicktime_autoplay : true,
+				quicktime_controller : true,
+
+				// Flash
+				flash_play : true,
+				flash_loop : true,
+				flash_menu : true,
+
+				// WindowsMedia
+				windowsmedia_autostart : true,
+				windowsmedia_enablecontextmenu : true,
+				windowsmedia_invokeurls : true,
+
+				// RealMedia
+				realmedia_autogotourl : true,
+				realmedia_imagestatus : true
+			};
+
+			function parseQueryParams(str) {
+				var out = {};
+
+				if (str) {
+					tinymce.each(str.split('&'), function(item) {
+						var parts = item.split('=');
+
+						out[unescape(parts[0])] = unescape(parts[1]);
+					});
+				}
+
+				return out;
+			};
+
+			function setOptions(type, names) {
+				var i, name, formItemName, value, list;
+
+				if (type == data.type || type == 'global') {
+					names = tinymce.explode(names);
+					for (i = 0; i < names.length; i++) {
+						name = names[i];
+						formItemName = type == 'global' ? name : type + '_' + name;
+
+						if (type == 'global')
+							list = data;
+						else if (type == 'video') {
+							list = data.video.attrs;
+
+							if (!list && !to_form)
+								data.video.attrs = list = {};
+						} else
+							list = data.params;
+
+						if (list) {
+							if (to_form) {
+								setVal(formItemName, list[name]);
+							} else {
+								delete list[name];
+
+								value = getVal(formItemName);
+								if (type == 'video' && value === true)
+									value = name;
+
+								if (defaultStates[formItemName]) {
+									if (value !== defaultStates[formItemName]) {
+										value = "" + value;
+										list[name] = value;
+									}
+								} else if (value) {
+									value = "" + value;
+									list[name] = value;
+								}
+							}
+						}
+					}
+				}
+			}
+
+			if (!to_form) {
+				data.type = get('media_type').options[get('media_type').selectedIndex].value;
+				data.width = getVal('width');
+				data.height = getVal('height');
+
+				// Switch type based on extension
+				src = getVal('src');
+				if (field == 'src') {
+					ext = src.replace(/^.*\.([^.]+)$/, '$1');
+					if (typeInfo = mediaPlugin.getType(ext))
+						data.type = typeInfo.name.toLowerCase();
+
+					setVal('media_type', data.type);
+				}
+
+				if (data.type == "video") {
+					if (!data.video.sources)
+						data.video.sources = [];
+
+					data.video.sources[0] = {src: getVal('src')};
+				}
+			}
+
+			// Hide all fieldsets and show the one active
+			get('video_options').style.display = 'none';
+			get('flash_options').style.display = 'none';
+			get('quicktime_options').style.display = 'none';
+			get('shockwave_options').style.display = 'none';
+			get('windowsmedia_options').style.display = 'none';
+			get('realmedia_options').style.display = 'none';
+
+			if (get(data.type + '_options'))
+				get(data.type + '_options').style.display = 'block';
+
+			setVal('media_type', data.type);
+
+			setOptions('flash', 'play,loop,menu,swliveconnect,quality,scale,salign,wmode,base,flashvars');
+			setOptions('quicktime', 'loop,autoplay,cache,controller,correction,enablejavascript,kioskmode,autohref,playeveryframe,targetcache,scale,starttime,endtime,target,qtsrcchokespeed,volume,qtsrc');
+			setOptions('shockwave', 'sound,progress,autostart,swliveconnect,swvolume,swstretchstyle,swstretchhalign,swstretchvalign');
+			setOptions('windowsmedia', 'autostart,enabled,enablecontextmenu,fullscreen,invokeurls,mute,stretchtofit,windowlessvideo,balance,baseurl,captioningid,currentmarker,currentposition,defaultframe,playcount,rate,uimode,volume');
+			setOptions('realmedia', 'autostart,loop,autogotourl,center,imagestatus,maintainaspect,nojava,prefetch,shuffle,console,controls,numloop,scriptcallbacks');
+			setOptions('video', 'poster,autoplay,loop,preload,controls');
+			setOptions('global', 'id,name,vspace,hspace,bgcolor,align,width,height');
+
+			if (to_form) {
+				if (data.type == 'video') {
+					if (data.video.sources[0])
+						setVal('src', data.video.sources[0].src);
+
+					src = data.video.sources[1];
+					if (src)
+						setVal('video_altsource1', src.src);
+
+					src = data.video.sources[2];
+					if (src)
+						setVal('video_altsource2', src.src);
+				} else {
+					// Check flash vars
+					if (data.type == 'flash') {
+						tinymce.each(editor.getParam('flash_video_player_flashvars', {url : '$url', poster : '$poster'}), function(value, name) {
+							if (value == '$url')
+								data.params.src = parseQueryParams(data.params.flashvars)[name] || data.params.src;
+						});
+					}
+
+					setVal('src', data.params.src);
+				}
+			} else {
+				src = getVal("src");
+	
+				// YouTube
+				if (src.match(/youtube.com(.+)v=([^&]+)/)) {
+					data.width = 425;
+					data.height = 350;
+					data.params.frameborder = '0';
+					data.type = 'iframe';
+					src = 'http://www.youtube.com/embed/' + src.match(/v=([^&]+)/)[1];
+					setVal('src', src);
+					setVal('media_type', data.type);
+				}
+
+				// Google video
+				if (src.match(/video.google.com(.+)docid=([^&]+)/)) {
+					data.width = 425;
+					data.height = 326;
+					data.type = 'flash';
+					src = 'http://video.google.com/googleplayer.swf?docId=' + src.match(/docid=([^&]+)/)[1] + '&hl=en';
+					setVal('src', src);
+					setVal('media_type', data.type);
+				}
+
+				if (data.type == 'video') {
+					if (!data.video.sources)
+						data.video.sources = [];
+
+					data.video.sources[0] = {src : src};
+
+					src = getVal("video_altsource1");
+					if (src)
+						data.video.sources[1] = {src : src};
+
+					src = getVal("video_altsource2");
+					if (src)
+						data.video.sources[2] = {src : src};
+				} else
+					data.params.src = src;
+
+				// Set default size
+				setVal('width', data.width || 320);
+				setVal('height', data.height || 240);
+			}
+		},
+
+		dataToForm : function() {
+			this.moveStates(true);
+		},
+
+		formToData : function(field) {
+			if (field == "width" || field == "height")
+				this.changeSize(field);
+
+			if (field == 'source') {
+				this.moveStates(false, field);
+				setVal('source', this.editor.plugins.media.dataToHtml(this.data));
+				this.panel = 'source';
+			} else {
+				if (this.panel == 'source') {
+					this.data = this.editor.plugins.media.htmlToData(getVal('source'));
+					this.dataToForm();
+					this.panel = '';
+				}
+
+				this.moveStates(false, field);
+				this.preview();
+			}
+		},
+
+		beforeResize : function() {
+			this.width = parseInt(getVal('width') || "320", 10);
+			this.height = parseInt(getVal('height') || "240", 10);
+		},
+
+		changeSize : function(type) {
+			var width, height, scale, size;
+
+			if (get('constrain').checked) {
+				width = parseInt(getVal('width') || "320", 10);
+				height = parseInt(getVal('height') || "240", 10);
+
+				if (type == 'width') {
+					this.height = Math.round((width / this.width) * height);
+					setVal('height', this.height);
+				} else {
+					this.width = Math.round((height / this.height) * width);
+					setVal('width', this.width);
+				}
+			}
+		},
+
+		getMediaListHTML : function() {
+			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;Media.formToData(\'src\');">';
+				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 "";
+		}
+	};
+
+	tinyMCEPopup.requireLangPack();
+	tinyMCEPopup.onInit.add(function() {
+		Media.init();
+	});
+})();
\ No newline at end of file
diff -x .svn -aruN 0.7.24.src/e107_handlers/tiny_mce/plugins/media/langs/en_dlg.js 0.7.26.src/e107_handlers/tiny_mce/plugins/media/langs/en_dlg.js
--- 0.7.24.src/e107_handlers/tiny_mce/plugins/media/langs/en_dlg.js	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_handlers/tiny_mce/plugins/media/langs/en_dlg.js	2011-03-12 04:48:11.000000000 -0600
@@ -1,103 +1,109 @@
-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"
+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_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",
+html5_video_options:"HTML5 Video Options",
+altsource1:"Alternative source 1",
+altsource2:"Alternative source 2",
+preload:"Preload",
+poster:"Poster",
+
+source:"Source"
 });
\ No newline at end of file
diff -x .svn -aruN 0.7.24.src/e107_handlers/tiny_mce/plugins/media/media.htm 0.7.26.src/e107_handlers/tiny_mce/plugins/media/media.htm
--- 0.7.24.src/e107_handlers/tiny_mce/plugins/media/media.htm	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_handlers/tiny_mce/plugins/media/media.htm	2011-03-30 03:22:40.000000000 -0500
@@ -1,822 +1,812 @@
-<!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>{#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" />
-</head>
-<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;">{#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>{#media_dlg.general}</legend>
-
-					<table border="0" cellpadding="4" cellspacing="0">
-							<tr>
-								<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">Shockwave</option>
-										<option value="wmp">Windows Media</option>
-										<option value="rmp">Real Media</option>
-									</select>
-								</td>
-							</tr>
-							<tr>
-							<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="" class="mceFocus" onchange="switchType(this.value);generatePreview();" /></td>
-										<td id="filebrowsercontainer">&nbsp;</td>
-									  </tr>
-									</table>
-								</td>
-							</tr>
-							<tr id="linklistrow">
-								<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">{#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">{#media_dlg.constrain_proportions}</label></td>
-										</tr>
-									</table>
-								</td>
-							</tr>
-					</table>
-				</fieldset>
-
-				<fieldset>
-					<legend>{#media_dlg.preview}</legend>
-					<div id="prev"></div>
-				</fieldset>
-			</div>
-
-			<div id="advanced_panel" class="panel">
-				<fieldset>
-					<legend>{#media_dlg.advanced}</legend>
-
-					<table border="0" cellpadding="4" cellspacing="0" width="100%">
-						<tr>
-							<td><label for="id">{#media_dlg.id}</label></td>
-							<td><input type="text" id="id" name="id" onchange="generatePreview();" /></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">{#media_dlg.align}</label></td>
-							<td>
-								<select id="align" name="align" onchange="generatePreview();">
-									<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">{#media_dlg.bgcolor}</label></td>
-							<td>
-								<table border="0" cellpadding="0" cellspacing="0">
-									<tr>
-										<td><input id="bgcolor" name="bgcolor" type="text" value="" size="9" onchange="updateColor('bgcolor_pick','bgcolor');generatePreview();" /></td>
-										<td id="bgcolor_pickcontainer">&nbsp;</td>
-									</tr>
-								</table>
-							</td>
-						</tr>
-
-						<tr>
-							<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">{#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>{#media_dlg.flash_options}</legend>
-
-					<table border="0" cellpadding="4" cellspacing="0">
-						<tr>
-							<td><label for="flash_quality">{#media_dlg.quality}</label></td>
-							<td>
-								<select id="flash_quality" name="flash_quality" onchange="generatePreview();">
-									<option value="">{#not_set}</option> 
-									<option value="high">high</option>
-									<option value="low">low</option>
-									<option value="autolow">autolow</option>
-									<option value="autohigh">autohigh</option>
-									<option value="best">best</option>
-								</select>
-							</td>
-
-							<td><label for="flash_scale">{#media_dlg.scale}</label></td>
-							<td>
-								<select id="flash_scale" name="flash_scale" onchange="generatePreview();">
-									<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">{#media_dlg.wmode}</label></td>
-							<td>
-								<select id="flash_wmode" name="flash_wmode" onchange="generatePreview();">
-									<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">{#media_dlg.salign}</label></td>
-							<td>
-								<select id="flash_salign" name="flash_salign" onchange="generatePreview();">
-									<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>
-
-						<tr>
-							<td colspan="2">
-								<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">{#media_dlg.play}</label></td>
-									</tr>
-								</table>
-							</td>
-
-							<td colspan="2">
-								<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">{#media_dlg.loop}</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="flash_menu" name="flash_menu" checked="checked" onchange="generatePreview();" /></td>
-										<td><label for="flash_menu">{#media_dlg.menu}</label></td>
-									</tr>
-								</table>
-							</td>
-
-							<td colspan="2">
-								<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">{#media_dlg.liveconnect}</label></td>
-									</tr>
-								</table>
-							</td>
-						</tr>
-					</table>
-
-					<table>
-						<tr>
-							<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">{#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>{#media_dlg.qt_options}</legend>
-
-					<table border="0" cellpadding="4" cellspacing="0">
-						<tr>
-							<td colspan="2">
-								<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">{#media_dlg.loop}</label></td>
-									</tr>
-								</table>
-							</td>
-
-							<td colspan="2">
-								<table border="0" cellpadding="0" cellspacing="0">
-									<tr>
-										<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>
-						</tr>
-
-						<tr>
-							<td colspan="2">
-								<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">{#media_dlg.cache}</label></td>
-									</tr>
-								</table>
-							</td>
-
-							<td colspan="2">
-								<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">{#media_dlg.controller}</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="qt_correction" name="qt_correction" onchange="generatePreview();" /></td>
-										<td><label for="qt_correction">{#media_dlg.correction}</label></td>
-									</tr>
-								</table>
-							</td>
-
-							<td colspan="2">
-								<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">{#media_dlg.enablejavascript}</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="qt_kioskmode" name="qt_kioskmode" onchange="generatePreview();" /></td>
-										<td><label for="qt_kioskmode">{#media_dlg.kioskmode}</label></td>
-									</tr>
-								</table>
-							</td>
-
-							<td colspan="2">
-								<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">{#media_dlg.autohref}</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="qt_playeveryframe" name="qt_playeveryframe" onchange="generatePreview();" /></td>
-										<td><label for="qt_playeveryframe">{#media_dlg.playeveryframe}</label></td>
-									</tr>
-								</table>
-							</td>
-
-							<td colspan="2">
-								<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">{#media_dlg.targetcache}</label></td>
-									</tr>
-								</table>
-							</td>
-						</tr>
-
-						<tr>
-							<td><label for="qt_scale">{#media_dlg.scale}</label></td>
-							<td><select id="qt_scale" name="qt_scale" class="mceEditableSelect" onchange="generatePreview();">
-									<option value="">{#not_set}</option> 
-									<option value="tofit">tofit</option>
-									<option value="aspect">aspect</option>
-								</select>
-							</td>
-
-							<td colspan="2">&nbsp;</td>
-						</tr>
-
-						<tr>
-							<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">{#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">{#media_dlg.target}</label></td>
-							<td><input type="text" id="qt_target" name="qt_target" onchange="generatePreview();" /></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">{#media_dlg.qtsrcchokespeed}</label></td>
-							<td><input type="text" id="qt_qtsrcchokespeed" name="qt_qtsrcchokespeed" onchange="generatePreview();" /></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">{#media_dlg.qtsrc}</label></td>
-							<td colspan="4">
-							<table border="0" cellspacing="0" cellpadding="0">
-								  <tr>
-									<td><input type="text" id="qt_qtsrc" name="qt_qtsrc" onchange="generatePreview();" /></td>
-									<td id="qtsrcfilebrowsercontainer">&nbsp;</td>
-								  </tr>
-							</table>
-							</td>
-						</tr>
-					</table>
-				</fieldset>
-
-				<fieldset id="wmp_options">
-					<legend>{#media_dlg.wmp_options}</legend>
-
-					<table border="0" cellpadding="4" cellspacing="0">
-						<tr>
-							<td colspan="2">
-								<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">{#media_dlg.autostart}</label></td>
-									</tr>
-								</table>
-							</td>
-
-							<td colspan="2">
-								<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">{#media_dlg.enabled}</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="wmp_enablecontextmenu" name="wmp_enablecontextmenu" checked="checked" onchange="generatePreview();" /></td>
-										<td><label for="wmp_enablecontextmenu">{#media_dlg.menu}</label></td>
-									</tr>
-								</table>
-							</td>
-
-							<td colspan="2">
-								<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">{#media_dlg.fullscreen}</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="wmp_invokeurls" name="wmp_invokeurls" checked="checked" onchange="generatePreview();" /></td>
-										<td><label for="wmp_invokeurls">{#media_dlg.invokeurls}</label></td>
-									</tr>
-								</table>
-							</td>
-
-							<td colspan="2">
-								<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">{#media_dlg.mute}</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="wmp_stretchtofit" name="wmp_stretchtofit" onchange="generatePreview();" /></td>
-										<td><label for="wmp_stretchtofit">{#media_dlg.stretchtofit}</label></td>
-									</tr>
-								</table>
-							</td>
-
-							<td colspan="2">
-								<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">{#media_dlg.windowlessvideo}</label></td>
-									</tr>
-								</table>
-							</td>
-						</tr>
-
-						<tr>
-							<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">{#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">{#media_dlg.captioningid}</label></td>
-							<td><input type="text" id="wmp_captioningid" name="wmp_captioningid" onchange="generatePreview();" /></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">{#media_dlg.currentposition}</label></td>
-							<td><input type="text" id="wmp_currentposition" name="wmp_currentposition" onchange="generatePreview();" /></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">{#media_dlg.playcount}</label></td>
-							<td><input type="text" id="wmp_playcount" name="wmp_playcount" onchange="generatePreview();" /></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">{#media_dlg.uimode}</label></td>
-							<td><input type="text" id="wmp_uimode" name="wmp_uimode" onchange="generatePreview();" /></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>
-
-					</table>
-				</fieldset>
-
-				<fieldset id="rmp_options">
-					<legend>{#media_dlg.rmp_options}</legend>
-
-					<table border="0" cellpadding="4" cellspacing="0">
-						<tr>
-							<td colspan="2">
-								<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">{#media_dlg.autostart}</label></td>
-									</tr>
-								</table>
-							</td>
-
-							<td colspan="2">
-								<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">{#media_dlg.loop}</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="rmp_autogotourl" name="rmp_autogotourl" checked="checked" onchange="generatePreview();" /></td>
-										<td><label for="rmp_autogotourl">{#media_dlg.autogotourl}</label></td>
-									</tr>
-								</table>
-							</td>
-
-							<td colspan="2">
-								<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">{#media_dlg.center}</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="rmp_imagestatus" name="rmp_imagestatus" checked="checked" onchange="generatePreview();" /></td>
-										<td><label for="rmp_imagestatus">{#media_dlg.imagestatus}</label></td>
-									</tr>
-								</table>
-							</td>
-
-							<td colspan="2">
-								<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">{#media_dlg.maintainaspect}</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="rmp_nojava" name="rmp_nojava" onchange="generatePreview();" /></td>
-										<td><label for="rmp_nojava">{#media_dlg.nojava}</label></td>
-									</tr>
-								</table>
-							</td>
-
-							<td colspan="2">
-								<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">{#media_dlg.prefetch}</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="rmp_shuffle" name="rmp_shuffle" onchange="generatePreview();" /></td>
-										<td><label for="rmp_shuffle">{#media_dlg.shuffle}</label></td>
-									</tr>
-								</table>
-							</td>
-
-							<td colspan="2">
-								&nbsp;
-							</td>
-						</tr>
-
-						<tr>
-							<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">{#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">{#media_dlg.numloop}</label></td>
-							<td><input type="text" id="rmp_numloop" name="rmp_numloop" onchange="generatePreview();" /></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>{#media_dlg.shockwave_options}</legend>
-
-					<table border="0" cellpadding="4" cellspacing="0">
-						<tr>
-							<td><label for="shockwave_swstretchstyle">{#media_dlg.swstretchstyle}</label></td>
-							<td>
-								<select id="shockwave_swstretchstyle" name="shockwave_swstretchstyle" onchange="generatePreview();">
-									<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">{#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">{#media_dlg.swstretchhalign}</label></td>
-							<td>
-								<select id="shockwave_swstretchhalign" name="shockwave_swstretchhalign" onchange="generatePreview();">
-									<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">{#media_dlg.swstretchvalign}</label></td>
-							<td>
-								<select id="shockwave_swstretchvalign" name="shockwave_swstretchvalign" onchange="generatePreview();">
-									<option value="none">{#not_set}</option>
-									<option value="meet">Meet</option>
-									<option value="fill">Fill</option>
-									<option value="stage">Stage</option>
-								</select>
-							</td>
-						</tr>
-
-						<tr>
-							<td colspan="2">
-								<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">{#media_dlg.autostart}</label></td>
-									</tr>
-								</table>
-							</td>
-
-							<td colspan="2">
-								<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">{#media_dlg.sound}</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="shockwave_swliveconnect" name="shockwave_swliveconnect" onchange="generatePreview();" /></td>
-										<td><label for="shockwave_swliveconnect">{#media_dlg.liveconnect}</label></td>
-									</tr>
-								</table>
-							</td>
-
-							<td colspan="2">
-								<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">{#media_dlg.progress}</label></td>
-									</tr>
-								</table>
-							</td>
-						</tr>
-					</table>
-				</fieldset>
-			</div>
-		</div>
-
-		<div class="mceActionPanel">
-			<div style="float: left">
-				<input type="submit" id="insert" name="insert" value="{#insert}" />
-			</div>
-
-			<div style="float: right">
-				<input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />
-			</div>
-		</div>
-	</form>
-</body>
-</html>
+<!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>{#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" />
+</head>
+<body style="display: none" role="application">
+<form onsubmit="Media.insert();return false;" action="#">
+		<div class="tabs" role="presentation">
+			<ul>
+				<li id="general_tab" class="current" aria-controls="general_panel"><span><a href="javascript:mcTabs.displayTab('general_tab','general_panel');Media.formToData();" onmousedown="return false;">{#media_dlg.general}</a></span></li>
+				<li id="advanced_tab" aria-controls="advanced_panel"><span><a href="javascript:mcTabs.displayTab('advanced_tab','advanced_panel');Media.formToData();" onmousedown="return false;">{#media_dlg.advanced}</a></span></li>
+				<li id="source_tab" aria-controls="source_panel"><span><a href="javascript:mcTabs.displayTab('source_tab','source_panel');Media.formToData('source');" onmousedown="return false;">{#media_dlg.source}</a></span></li>
+			</ul>
+		</div>
+
+		<div class="panel_wrapper">
+			<div id="general_panel" class="panel current">
+				<fieldset>
+					<legend>{#media_dlg.general}</legend>
+
+					<table role="presentation" border="0" cellpadding="4" cellspacing="0">
+							<tr>
+								<td><label for="media_type">{#media_dlg.type}</label></td>
+								<td>
+									<select id="media_type" name="media_type" onchange="Media.formToData('type');">
+										<option value="video">HTML5 Video</option>
+										<option value="flash">Flash</option>
+										<option value="quicktime">QuickTime</option>
+										<option value="shockwave">Shockwave</option>
+										<option value="windowsmedia">Windows Media</option>
+										<option value="realmedia">Real Media</option>
+										<option value="iframe">Iframe</option>
+									</select>
+								</td>
+							</tr>
+							<tr>
+							<td><label for="src">{#media_dlg.file}</label></td>
+								<td>
+									<table role="presentation" border="0" cellspacing="0" cellpadding="0">
+									<tr>
+										<td><input id="src" name="src" type="text" value="" class="mceFocus" onchange="Media.formToData();" /></td>
+										<td id="filebrowsercontainer">&nbsp;</td>
+									</tr>
+									</table>
+								</td>
+							</tr>
+							<tr id="linklistrow">
+								<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">{#media_dlg.size}</label></td>
+								<td>
+									<table role="presentation" border="0" cellpadding="0" cellspacing="0">
+										<tr>
+											<td><input type="text" id="width" name="width" value="" class="size" onchange="Media.formToData('width');" onfocus="Media.beforeResize();" /> x <input type="text" id="height" name="height" value="" class="size" onfocus="Media.beforeResize();" onchange="Media.formToData('height');" /></td>
+											<td>&nbsp;&nbsp;<input id="constrain" type="checkbox" name="constrain" class="checkbox" checked="checked" /></td>
+											<td><label id="constrainlabel" for="constrain">{#media_dlg.constrain_proportions}</label></td>
+										</tr>
+									</table>
+								</td>
+							</tr>
+					</table>
+				</fieldset>
+
+				<fieldset>
+					<legend>{#media_dlg.preview}</legend>
+					<div id="prev"></div>
+				</fieldset>
+			</div>
+
+			<div id="advanced_panel" class="panel">
+				<fieldset>
+					<legend>{#media_dlg.advanced}</legend>
+
+					<table role="presentation" border="0" cellpadding="4" cellspacing="0" width="100%">
+						<tr>
+							<td><label for="id">{#media_dlg.id}</label></td>
+							<td><input type="text" id="id" name="id" onchange="Media.formToData();" /></td>
+							<td><label for="name">{#media_dlg.name}</label></td>
+							<td><input type="text" id="name" name="name" onchange="Media.formToData();" /></td>
+						</tr>
+
+						<tr>
+							<td><label for="align">{#media_dlg.align}</label></td>
+							<td>
+								<select id="align" name="align" onchange="Media.formToData();">
+									<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">{#media_dlg.bgcolor}</label></td>
+							<td>
+								<table role="presentation" border="0" cellpadding="0" cellspacing="0">
+									<tr>
+										<td><input id="bgcolor" name="bgcolor" type="text" value="" size="9" onchange="updateColor('bgcolor_pick','bgcolor');Media.formToData();" /></td>
+										<td id="bgcolor_pickcontainer">&nbsp;</td>
+									</tr>
+								</table>
+							</td>
+						</tr>
+
+						<tr>
+							<td><label for="vspace">{#media_dlg.vspace}</label></td>
+							<td><input type="text" id="vspace" name="vspace" class="number" onchange="Media.formToData();" /></td>
+							<td><label for="hspace">{#media_dlg.hspace}</label></td>
+							<td><input type="text" id="hspace" name="hspace" class="number" onchange="Media.formToData();" /></td>
+						</tr>
+					</table>
+				</fieldset>
+
+				<fieldset id="video_options">
+					<legend>{#media_dlg.html5_video_options}</legend>
+
+					<table role="presentation">
+						<tr>
+							<td><label for="video_altsource1">{#media_dlg.altsource1}</label></td>
+							<td>
+								<table role="presentation" border="0" cellspacing="0" cellpadding="0">
+									<tr>
+										<td><input type="text" id="video_altsource1" name="video_altsource1" onchange="Media.formToData();" style="width: 240px" /></td>
+										<td id="video_altsource1_filebrowser">&nbsp;</td>
+									</tr>
+								</table>
+							</td>
+						</tr>
+
+						<tr>
+							<td><label for="video_altsource2">{#media_dlg.altsource2}</label></td>
+							<td>
+								<table role="presentation" border="0" cellspacing="0" cellpadding="0">
+									<tr>
+										<td><input type="text" id="video_altsource2" name="video_altsource2" onchange="Media.formToData();" style="width: 240px" /></td>
+										<td id="video_altsource2_filebrowser">&nbsp;</td>
+									</tr>
+								</table>
+							</td>
+						</tr>
+
+						<tr>
+							<td><label for="video_poster">{#media_dlg.poster}</label></td>
+							<td>
+								<table role="presentation" border="0" cellspacing="0" cellpadding="0">
+									<tr>
+										<td><input type="text" id="video_poster" name="video_poster" onchange="Media.formToData();" style="width: 240px" /></td>
+										<td id="video_poster_filebrowser">&nbsp;</td>
+									</tr>
+								</table>
+							</td>
+						</tr>
+					</table>
+
+					<table role="presentation" border="0" cellpadding="4" cellspacing="0">
+						<tr>
+							<td>
+								<table role="presentation" border="0" cellpadding="0" cellspacing="0">
+									<tr>
+										<td><input type="checkbox" class="checkbox" id="video_autoplay" name="video_autoplay" onchange="Media.formToData();" /></td>
+										<td><label for="video_autoplay">{#media_dlg.play}</label></td>
+									</tr>
+								</table>
+							</td>
+
+							<td>
+								<table role="presentation" border="0" cellpadding="0" cellspacing="0">
+									<tr>
+										<td><input type="checkbox" class="checkbox" id="video_loop" name="video_loop" onchange="Media.formToData();" /></td>
+										<td><label for="video_loop">{#media_dlg.loop}</label></td>
+									</tr>
+								</table>
+							</td>
+
+							<td>
+								<table role="presentation" border="0" cellpadding="0" cellspacing="0">
+									<tr>
+										<td><input type="checkbox" class="checkbox" id="video_preload" name="video_preload" onchange="Media.formToData();" /></td>
+										<td><label for="video_preload">{#media_dlg.preload}</label></td>
+									</tr>
+								</table>
+							</td>
+
+							<td>
+								<table role="presentation" border="0" cellpadding="0" cellspacing="0">
+									<tr>
+										<td><input type="checkbox" class="checkbox" id="video_controls" name="video_controls" onchange="Media.formToData();" /></td>
+										<td><label for="video_controls">{#media_dlg.controls}</label></td>
+									</tr>
+								</table>
+							</td>
+						</tr>
+					</table>
+				</fieldset>
+
+				<fieldset id="flash_options">
+					<legend>{#media_dlg.flash_options}</legend>
+
+					<table role="presentation" border="0" cellpadding="4" cellspacing="0">
+						<tr>
+							<td><label for="flash_quality">{#media_dlg.quality}</label></td>
+							<td>
+								<select id="flash_quality" name="flash_quality" onchange="Media.formToData();">
+									<option value="">{#not_set}</option> 
+									<option value="high">high</option>
+									<option value="low">low</option>
+									<option value="autolow">autolow</option>
+									<option value="autohigh">autohigh</option>
+									<option value="best">best</option>
+								</select>
+							</td>
+
+							<td><label for="flash_scale">{#media_dlg.scale}</label></td>
+							<td>
+								<select id="flash_scale" name="flash_scale" onchange="Media.formToData();">
+									<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">{#media_dlg.wmode}</label></td>
+							<td>
+								<select id="flash_wmode" name="flash_wmode" onchange="Media.formToData();">
+									<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">{#media_dlg.salign}</label></td>
+							<td>
+								<select id="flash_salign" name="flash_salign" onchange="Media.formToData();">
+									<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>
+
+						<tr>
+							<td colspan="2">
+								<table role="presentation" border="0" cellpadding="0" cellspacing="0">
+									<tr>
+										<td><input type="checkbox" class="checkbox" id="flash_play" name="flash_play" checked="checked" onchange="Media.formToData();" /></td>
+										<td><label for="flash_play">{#media_dlg.play}</label></td>
+									</tr>
+								</table>
+							</td>
+
+							<td colspan="2">
+								<table role="presentation" border="0" cellpadding="0" cellspacing="0">
+									<tr>
+										<td><input type="checkbox" class="checkbox" id="flash_loop" name="flash_loop" checked="checked" onchange="Media.formToData();" /></td>
+										<td><label for="flash_loop">{#media_dlg.loop}</label></td>
+									</tr>
+								</table>
+							</td>
+						</tr>
+
+						<tr>
+							<td colspan="2">
+								<table role="presentation" border="0" cellpadding="0" cellspacing="0">
+									<tr>
+										<td><input type="checkbox" class="checkbox" id="flash_menu" name="flash_menu" checked="checked" onchange="Media.formToData();" /></td>
+										<td><label for="flash_menu">{#media_dlg.menu}</label></td>
+									</tr>
+								</table>
+							</td>
+
+							<td colspan="2">
+								<table role="presentation" border="0" cellpadding="0" cellspacing="0">
+									<tr>
+										<td><input type="checkbox" class="checkbox" id="flash_swliveconnect" name="flash_swliveconnect" onchange="Media.formToData();" /></td>
+										<td><label for="flash_swliveconnect">{#media_dlg.liveconnect}</label></td>
+									</tr>
+								</table>
+							</td>
+						</tr>
+					</table>
+
+					<table role="presentation">
+						<tr>
+							<td><label for="flash_base">{#media_dlg.base}</label></td>
+							<td><input type="text" id="flash_base" name="flash_base" onchange="Media.formToData();" /></td>
+						</tr>
+
+						<tr>
+							<td><label for="flash_flashvars">{#media_dlg.flashvars}</label></td>
+							<td><input type="text" id="flash_flashvars" name="flash_flashvars" onchange="Media.formToData();" /></td>
+						</tr>
+					</table>
+				</fieldset>
+
+				<fieldset id="quicktime_options">
+					<legend>{#media_dlg.qt_options}</legend>
+
+					<table role="presentation" border="0" cellpadding="4" cellspacing="0">
+						<tr>
+							<td colspan="2">
+								<table role="presentation" border="0" cellpadding="0" cellspacing="0">
+									<tr>
+										<td><input type="checkbox" class="checkbox" id="quicktime_loop" name="quicktime_loop" onchange="Media.formToData();" /></td>
+										<td><label for="quicktime_loop">{#media_dlg.loop}</label></td>
+									</tr>
+								</table>
+							</td>
+
+							<td colspan="2">
+								<table role="presentation" border="0" cellpadding="0" cellspacing="0">
+									<tr>
+										<td><input type="checkbox" class="checkbox" id="quicktime_autoplay" name="quicktime_autoplay" checked="checked" onchange="Media.formToData();" /></td>
+										<td><label for="quicktime_autoplay">{#media_dlg.play}</label></td>
+									</tr>
+								</table>
+							</td>
+						</tr>
+
+						<tr>
+							<td colspan="2">
+								<table role="presentation" border="0" cellpadding="0" cellspacing="0">
+									<tr>
+										<td><input type="checkbox" class="checkbox" id="quicktime_cache" name="quicktime_cache" onchange="Media.formToData();" /></td>
+										<td><label for="quicktime_cache">{#media_dlg.cache}</label></td>
+									</tr>
+								</table>
+							</td>
+
+							<td colspan="2">
+								<table role="presentation" border="0" cellpadding="0" cellspacing="0">
+									<tr>
+										<td><input type="checkbox" class="checkbox" id="quicktime_controller" name="quicktime_controller" checked="checked" onchange="Media.formToData();" /></td>
+										<td><label for="quicktime_controller">{#media_dlg.controller}</label></td>
+									</tr>
+								</table>
+							</td>
+						</tr>
+
+						<tr>
+							<td colspan="2">
+								<table role="presentation" border="0" cellpadding="0" cellspacing="0">
+									<tr>
+										<td><input type="checkbox" class="checkbox" id="quicktime_correction" name="quicktime_correction" onchange="Media.formToData();" /></td>
+										<td><label for="quicktime_correction">{#media_dlg.correction}</label></td>
+									</tr>
+								</table>
+							</td>
+
+							<td colspan="2">
+								<table role="presentation" border="0" cellpadding="0" cellspacing="0">
+									<tr>
+										<td><input type="checkbox" class="checkbox" id="quicktime_enablejavascript" name="quicktime_enablejavascript" onchange="Media.formToData();" /></td>
+										<td><label for="quicktime_enablejavascript">{#media_dlg.enablejavascript}</label></td>
+									</tr>
+								</table>
+							</td>
+						</tr>
+
+						<tr>
+							<td colspan="2">
+								<table role="presentation" border="0" cellpadding="0" cellspacing="0">
+									<tr>
+										<td><input type="checkbox" class="checkbox" id="quicktime_kioskmode" name="quicktime_kioskmode" onchange="Media.formToData();" /></td>
+										<td><label for="quicktime_kioskmode">{#media_dlg.kioskmode}</label></td>
+									</tr>
+								</table>
+							</td>
+
+							<td colspan="2">
+								<table role="presentation" border="0" cellpadding="0" cellspacing="0">
+									<tr>
+										<td><input type="checkbox" class="checkbox" id="quicktime_autohref" name="quicktime_autohref" onchange="Media.formToData();" /></td>
+										<td><label for="quicktime_autohref">{#media_dlg.autohref}</label></td>
+									</tr>
+								</table>
+							</td>
+						</tr>
+
+						<tr>
+							<td colspan="2">
+								<table role="presentation" border="0" cellpadding="0" cellspacing="0">
+									<tr>
+										<td><input type="checkbox" class="checkbox" id="quicktime_playeveryframe" name="quicktime_playeveryframe" onchange="Media.formToData();" /></td>
+										<td><label for="quicktime_playeveryframe">{#media_dlg.playeveryframe}</label></td>
+									</tr>
+								</table>
+							</td>
+
+							<td colspan="2">
+								<table role="presentation" border="0" cellpadding="0" cellspacing="0">
+									<tr>
+										<td><input type="checkbox" class="checkbox" id="quicktime_targetcache" name="quicktime_targetcache" onchange="Media.formToData();" /></td>
+										<td><label for="quicktime_targetcache">{#media_dlg.targetcache}</label></td>
+									</tr>
+								</table>
+							</td>
+						</tr>
+
+						<tr>
+							<td><label for="quicktime_scale">{#media_dlg.scale}</label></td>
+							<td><select id="quicktime_scale" name="quicktime_scale" class="mceEditableSelect" onchange="Media.formToData();">
+									<option value="">{#not_set}</option> 
+									<option value="tofit">tofit</option>
+									<option value="aspect">aspect</option>
+								</select>
+							</td>
+
+							<td colspan="2">&nbsp;</td>
+						</tr>
+
+						<tr>
+							<td><label for="quicktime_starttime">{#media_dlg.starttime}</label></td>
+							<td><input type="text" id="quicktime_starttime" name="quicktime_starttime" onchange="Media.formToData();" /></td>
+
+							<td><label for="quicktime_endtime">{#media_dlg.endtime}</label></td>
+							<td><input type="text" id="quicktime_endtime" name="quicktime_endtime" onchange="Media.formToData();" /></td>
+						</tr>
+
+						<tr>
+							<td><label for="quicktime_target">{#media_dlg.target}</label></td>
+							<td><input type="text" id="quicktime_target" name="quicktime_target" onchange="Media.formToData();" /></td>
+
+							<td><label for="quicktime_href">{#media_dlg.href}</label></td>
+							<td><input type="text" id="quicktime_href" name="quicktime_href" onchange="Media.formToData();" /></td>
+						</tr>
+
+						<tr>
+							<td><label for="quicktime_qtsrcchokespeed">{#media_dlg.qtsrcchokespeed}</label></td>
+							<td><input type="text" id="quicktime_qtsrcchokespeed" name="quicktime_qtsrcchokespeed" onchange="Media.formToData();" /></td>
+
+							<td><label for="quicktime_volume">{#media_dlg.volume}</label></td>
+							<td><input type="text" id="quicktime_volume" name="quicktime_volume" onchange="Media.formToData();" /></td>
+						</tr>
+
+						<tr>
+							<td><label for="quicktime_qtsrc">{#media_dlg.qtsrc}</label></td>
+							<td colspan="4">
+								<table role="presentation" border="0" cellspacing="0" cellpadding="0">
+									<tr>
+										<td><input type="text" id="quicktime_qtsrc" name="quicktime_qtsrc" onchange="Media.formToData();" /></td>
+										<td id="qtsrcfilebrowsercontainer">&nbsp;</td>
+									</tr>
+								</table>
+							</td>
+						</tr>
+					</table>
+				</fieldset>
+
+				<fieldset id="windowsmedia_options">
+					<legend>{#media_dlg.wmp_options}</legend>
+
+					<table role="presentation" border="0" cellpadding="4" cellspacing="0">
+						<tr>
+							<td colspan="2">
+								<table role="presentation" border="0" cellpadding="0" cellspacing="0">
+									<tr>
+										<td><input type="checkbox" class="checkbox" id="windowsmedia_autostart" name="windowsmedia_autostart" checked="checked" onchange="Media.formToData();" /></td>
+										<td><label for="windowsmedia_autostart">{#media_dlg.autostart}</label></td>
+									</tr>
+								</table>
+							</td>
+
+							<td colspan="2">
+								<table role="presentation" border="0" cellpadding="0" cellspacing="0">
+									<tr>
+										<td><input type="checkbox" class="checkbox" id="windowsmedia_enabled" name="windowsmedia_enabled" onchange="Media.formToData();" /></td>
+										<td><label for="windowsmedia_enabled">{#media_dlg.enabled}</label></td>
+									</tr>
+								</table>
+							</td>
+						</tr>
+
+						<tr>
+							<td colspan="2">
+								<table role="presentation" border="0" cellpadding="0" cellspacing="0">
+									<tr>
+										<td><input type="checkbox" class="checkbox" id="windowsmedia_enablecontextmenu" name="windowsmedia_enablecontextmenu" checked="checked" onchange="Media.formToData();" /></td>
+										<td><label for="windowsmedia_enablecontextmenu">{#media_dlg.menu}</label></td>
+									</tr>
+								</table>
+							</td>
+
+							<td colspan="2">
+								<table role="presentation" border="0" cellpadding="0" cellspacing="0">
+									<tr>
+										<td><input type="checkbox" class="checkbox" id="windowsmedia_fullscreen" name="windowsmedia_fullscreen" onchange="Media.formToData();" /></td>
+										<td><label for="windowsmedia_fullscreen">{#media_dlg.fullscreen}</label></td>
+									</tr>
+								</table>
+							</td>
+						</tr>
+
+						<tr>
+							<td colspan="2">
+								<table role="presentation" border="0" cellpadding="0" cellspacing="0">
+									<tr>
+										<td><input type="checkbox" class="checkbox" id="windowsmedia_invokeurls" name="windowsmedia_invokeurls" checked="checked" onchange="Media.formToData();" /></td>
+										<td><label for="windowsmedia_invokeurls">{#media_dlg.invokeurls}</label></td>
+									</tr>
+								</table>
+							</td>
+
+							<td colspan="2">
+								<table role="presentation" border="0" cellpadding="0" cellspacing="0">
+									<tr>
+										<td><input type="checkbox" class="checkbox" id="windowsmedia_mute" name="windowsmedia_mute" onchange="Media.formToData();" /></td>
+										<td><label for="windowsmedia_mute">{#media_dlg.mute}</label></td>
+									</tr>
+								</table>
+							</td>
+						</tr>
+
+						<tr>
+							<td colspan="2">
+								<table role="presentation" border="0" cellpadding="0" cellspacing="0">
+									<tr>
+										<td><input type="checkbox" class="checkbox" id="windowsmedia_stretchtofit" name="windowsmedia_stretchtofit" onchange="Media.formToData();" /></td>
+										<td><label for="windowsmedia_stretchtofit">{#media_dlg.stretchtofit}</label></td>
+									</tr>
+								</table>
+							</td>
+
+							<td colspan="2">
+								<table role="presentation" border="0" cellpadding="0" cellspacing="0">
+									<tr>
+										<td><input type="checkbox" class="checkbox" id="windowsmedia_windowlessvideo" name="windowsmedia_windowlessvideo" onchange="Media.formToData();" /></td>
+										<td><label for="windowsmedia_windowlessvideo">{#media_dlg.windowlessvideo}</label></td>
+									</tr>
+								</table>
+							</td>
+						</tr>
+
+						<tr>
+							<td><label for="windowsmedia_balance">{#media_dlg.balance}</label></td>
+							<td><input type="text" id="windowsmedia_balance" name="windowsmedia_balance" onchange="Media.formToData();" /></td>
+
+							<td><label for="windowsmedia_baseurl">{#media_dlg.baseurl}</label></td>
+							<td><input type="text" id="windowsmedia_baseurl" name="windowsmedia_baseurl" onchange="Media.formToData();" /></td>
+						</tr>
+
+						<tr>
+							<td><label for="windowsmedia_captioningid">{#media_dlg.captioningid}</label></td>
+							<td><input type="text" id="windowsmedia_captioningid" name="windowsmedia_captioningid" onchange="Media.formToData();" /></td>
+
+							<td><label for="windowsmedia_currentmarker">{#media_dlg.currentmarker}</label></td>
+							<td><input type="text" id="windowsmedia_currentmarker" name="windowsmedia_currentmarker" onchange="Media.formToData();" /></td>
+						</tr>
+
+						<tr>
+							<td><label for="windowsmedia_currentposition">{#media_dlg.currentposition}</label></td>
+							<td><input type="text" id="windowsmedia_currentposition" name="windowsmedia_currentposition" onchange="Media.formToData();" /></td>
+
+							<td><label for="windowsmedia_defaultframe">{#media_dlg.defaultframe}</label></td>
+							<td><input type="text" id="windowsmedia_defaultframe" name="windowsmedia_defaultframe" onchange="Media.formToData();" /></td>
+						</tr>
+
+						<tr>
+							<td><label for="windowsmedia_playcount">{#media_dlg.playcount}</label></td>
+							<td><input type="text" id="windowsmedia_playcount" name="windowsmedia_playcount" onchange="Media.formToData();" /></td>
+
+							<td><label for="windowsmedia_rate">{#media_dlg.rate}</label></td>
+							<td><input type="text" id="windowsmedia_rate" name="windowsmedia_rate" onchange="Media.formToData();" /></td>
+						</tr>
+
+						<tr>
+							<td><label for="windowsmedia_uimode">{#media_dlg.uimode}</label></td>
+							<td><input type="text" id="windowsmedia_uimode" name="windowsmedia_uimode" onchange="Media.formToData();" /></td>
+
+							<td><label for="windowsmedia_volume">{#media_dlg.volume}</label></td>
+							<td><input type="text" id="windowsmedia_volume" name="windowsmedia_volume" onchange="Media.formToData();" /></td>
+						</tr>
+
+					</table>
+				</fieldset>
+
+				<fieldset id="realmedia_options">
+					<legend>{#media_dlg.rmp_options}</legend>
+
+					<table role="presentation" border="0" cellpadding="4" cellspacing="0">
+						<tr>
+							<td colspan="2">
+								<table role="presentation" border="0" cellpadding="0" cellspacing="0">
+									<tr>
+										<td><input type="checkbox" class="checkbox" id="realmedia_autostart" name="realmedia_autostart" onchange="Media.formToData();" /></td>
+										<td><label for="realmedia_autostart">{#media_dlg.autostart}</label></td>
+									</tr>
+								</table>
+							</td>
+
+							<td colspan="2">
+								<table role="presentation" border="0" cellpadding="0" cellspacing="0">
+									<tr>
+										<td><input type="checkbox" class="checkbox" id="realmedia_loop" name="realmedia_loop" onchange="Media.formToData();" /></td>
+										<td><label for="realmedia_loop">{#media_dlg.loop}</label></td>
+									</tr>
+								</table>
+							</td>
+						</tr>
+
+						<tr>
+							<td colspan="2">
+								<table role="presentation" border="0" cellpadding="0" cellspacing="0">
+									<tr>
+										<td><input type="checkbox" class="checkbox" id="realmedia_autogotourl" name="realmedia_autogotourl" checked="checked" onchange="Media.formToData();" /></td>
+										<td><label for="realmedia_autogotourl">{#media_dlg.autogotourl}</label></td>
+									</tr>
+								</table>
+							</td>
+
+							<td colspan="2">
+								<table role="presentation" border="0" cellpadding="0" cellspacing="0">
+									<tr>
+										<td><input type="checkbox" class="checkbox" id="realmedia_center" name="realmedia_center" onchange="Media.formToData();" /></td>
+										<td><label for="realmedia_center">{#media_dlg.center}</label></td>
+									</tr>
+								</table>
+							</td>
+						</tr>
+
+						<tr>
+							<td colspan="2">
+								<table role="presentation" border="0" cellpadding="0" cellspacing="0">
+									<tr>
+										<td><input type="checkbox" class="checkbox" id="realmedia_imagestatus" name="realmedia_imagestatus" checked="checked" onchange="Media.formToData();" /></td>
+										<td><label for="realmedia_imagestatus">{#media_dlg.imagestatus}</label></td>
+									</tr>
+								</table>
+							</td>
+
+							<td colspan="2">
+								<table role="presentation" border="0" cellpadding="0" cellspacing="0">
+									<tr>
+										<td><input type="checkbox" class="checkbox" id="realmedia_maintainaspect" name="realmedia_maintainaspect" onchange="Media.formToData();" /></td>
+										<td><label for="realmedia_maintainaspect">{#media_dlg.maintainaspect}</label></td>
+									</tr>
+								</table>
+							</td>
+						</tr>
+
+						<tr>
+							<td colspan="2">
+								<table role="presentation" border="0" cellpadding="0" cellspacing="0">
+									<tr>
+										<td><input type="checkbox" class="checkbox" id="realmedia_nojava" name="realmedia_nojava" onchange="Media.formToData();" /></td>
+										<td><label for="realmedia_nojava">{#media_dlg.nojava}</label></td>
+									</tr>
+								</table>
+							</td>
+
+							<td colspan="2">
+								<table role="presentation" border="0" cellpadding="0" cellspacing="0">
+									<tr>
+										<td><input type="checkbox" class="checkbox" id="realmedia_prefetch" name="realmedia_prefetch" onchange="Media.formToData();" /></td>
+										<td><label for="realmedia_prefetch">{#media_dlg.prefetch}</label></td>
+									</tr>
+								</table>
+							</td>
+						</tr>
+
+						<tr>
+							<td colspan="2">
+								<table role="presentation" border="0" cellpadding="0" cellspacing="0">
+									<tr>
+										<td><input type="checkbox" class="checkbox" id="realmedia_shuffle" name="realmedia_shuffle" onchange="Media.formToData();" /></td>
+										<td><label for="realmedia_shuffle">{#media_dlg.shuffle}</label></td>
+									</tr>
+								</table>
+							</td>
+
+							<td colspan="2">
+								&nbsp;
+							</td>
+						</tr>
+
+						<tr>
+							<td><label for="realmedia_console">{#media_dlg.console}</label></td>
+							<td><input type="text" id="realmedia_console" name="realmedia_console" onchange="Media.formToData();" /></td>
+
+							<td><label for="realmedia_controls">{#media_dlg.controls}</label></td>
+							<td><input type="text" id="realmedia_controls" name="realmedia_controls" onchange="Media.formToData();" /></td>
+						</tr>
+
+						<tr>
+							<td><label for="realmedia_numloop">{#media_dlg.numloop}</label></td>
+							<td><input type="text" id="realmedia_numloop" name="realmedia_numloop" onchange="Media.formToData();" /></td>
+
+							<td><label for="realmedia_scriptcallbacks">{#media_dlg.scriptcallbacks}</label></td>
+							<td><input type="text" id="realmedia_scriptcallbacks" name="realmedia_scriptcallbacks" onchange="Media.formToData();" /></td>
+						</tr>
+					</table>
+				</fieldset>
+
+				<fieldset id="shockwave_options">
+					<legend>{#media_dlg.shockwave_options}</legend>
+
+					<table role="presentation" border="0" cellpadding="4" cellspacing="0">
+						<tr>
+							<td><label for="shockwave_swstretchstyle">{#media_dlg.swstretchstyle}</label></td>
+							<td>
+								<select id="shockwave_swstretchstyle" name="shockwave_swstretchstyle" onchange="Media.formToData();">
+									<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">{#media_dlg.volume}</label></td>
+							<td><input type="text" id="shockwave_swvolume" name="shockwave_swvolume" onchange="Media.formToData();" /></td>
+						</tr>
+
+						<tr>
+							<td><label for="shockwave_swstretchhalign">{#media_dlg.swstretchhalign}</label></td>
+							<td>
+								<select id="shockwave_swstretchhalign" name="shockwave_swstretchhalign" onchange="Media.formToData();">
+									<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">{#media_dlg.swstretchvalign}</label></td>
+							<td>
+								<select id="shockwave_swstretchvalign" name="shockwave_swstretchvalign" onchange="Media.formToData();">
+									<option value="none">{#not_set}</option>
+									<option value="meet">Meet</option>
+									<option value="fill">Fill</option>
+									<option value="stage">Stage</option>
+								</select>
+							</td>
+						</tr>
+
+						<tr>
+							<td colspan="2">
+								<table role="presentation" border="0" cellpadding="0" cellspacing="0">
+									<tr>
+										<td><input type="checkbox" class="checkbox" id="shockwave_autostart" name="shockwave_autostart" onchange="Media.formToData();" checked="checked" /></td>
+										<td><label for="shockwave_autostart">{#media_dlg.autostart}</label></td>
+									</tr>
+								</table>
+							</td>
+
+							<td colspan="2">
+								<table role="presentation" border="0" cellpadding="0" cellspacing="0">
+									<tr>
+										<td><input type="checkbox" class="checkbox" id="shockwave_sound" name="shockwave_sound" onchange="Media.formToData();" checked="checked" /></td>
+										<td><label for="shockwave_sound">{#media_dlg.sound}</label></td>
+									</tr>
+								</table>
+							</td>
+						</tr>
+
+
+						<tr>
+							<td colspan="2">
+								<table role="presentation" border="0" cellpadding="0" cellspacing="0">
+									<tr>
+										<td><input type="checkbox" class="checkbox" id="shockwave_swliveconnect" name="shockwave_swliveconnect" onchange="Media.formToData();" /></td>
+										<td><label for="shockwave_swliveconnect">{#media_dlg.liveconnect}</label></td>
+									</tr>
+								</table>
+							</td>
+
+							<td colspan="2">
+								<table role="presentation" border="0" cellpadding="0" cellspacing="0">
+									<tr>
+										<td><input type="checkbox" class="checkbox" id="shockwave_progress" name="shockwave_progress" onchange="Media.formToData();" checked="checked" /></td>
+										<td><label for="shockwave_progress">{#media_dlg.progress}</label></td>
+									</tr>
+								</table>
+							</td>
+						</tr>
+					</table>
+				</fieldset>
+			</div>
+
+			<div id="source_panel" class="panel">
+				<fieldset>
+					<legend>{#media_dlg.source}</legend>
+					<textarea id="source" style="width: 100%; height: 390px"></textarea>
+				</fieldset>
+			</div>
+		</div>
+
+		<div class="mceActionPanel">
+			<input type="submit" id="insert" name="insert" value="{#insert}" />
+			<input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />
+		</div>
+	</form>
+</body>
+</html>
diff -x .svn -aruN 0.7.24.src/e107_handlers/tiny_mce/plugins/paste/editor_plugin.js 0.7.26.src/e107_handlers/tiny_mce/plugins/paste/editor_plugin.js
--- 0.7.24.src/e107_handlers/tiny_mce/plugins/paste/editor_plugin.js	1969-12-31 18:00:00.000000000 -0600
+++ 0.7.26.src/e107_handlers/tiny_mce/plugins/paste/editor_plugin.js	2011-03-30 03:22:40.000000000 -0500
@@ -0,0 +1 @@
+(function(){var c=tinymce.each,a={paste_auto_cleanup_on_paste:true,paste_enable_default_filters:true,paste_block_drop:false,paste_retain_style_properties:"none",paste_strip_class_attributes:"mso",paste_remove_spans:false,paste_remove_styles:false,paste_remove_styles_if_webkit:true,paste_convert_middot_lists:true,paste_convert_headers_to_strong:false,paste_dialog_width:"450",paste_dialog_height:"400",paste_text_use_dialog:false,paste_text_sticky:false,paste_text_notifyalways:false,paste_text_linebreaktype:"p",paste_text_replacements:[[/\u2026/g,"..."],[/[\x93\x94\u201c\u201d]/g,'"'],[/[\x60\x91\x92\u2018\u2019]/g,"'"]]};function b(d,e){return d.getParam(e,a[e])}tinymce.create("tinymce.plugins.PastePlugin",{init:function(d,e){var f=this;f.editor=d;f.url=e;f.onPreProcess=new tinymce.util.Dispatcher(f);f.onPostProcess=new tinymce.util.Dispatcher(f);f.onPreProcess.add(f._preProcess);f.onPostProcess.add(f._postProcess);f.onPreProcess.add(function(i,j){d.execCallback("paste_preprocess",i,j)});f.onPostProcess.add(function(i,j){d.execCallback("paste_postprocess",i,j)});d.onKeyDown.addToTop(function(i,j){if(((tinymce.isMac?j.metaKey:j.ctrlKey)&&j.keyCode==86)||(j.shiftKey&&j.keyCode==45)){return false}});d.pasteAsPlainText=false;function h(m,k){var l=d.dom,i,j;f.onPreProcess.dispatch(f,m);m.node=l.create("div",0,m.content);if(tinymce.isGecko){i=d.selection.getRng(true);if(i.startContainer==i.endContainer&&i.startContainer.nodeType==3){j=l.select("p,h1,h2,h3,h4,h5,h6,pre",m.node);if(j.length==1&&m.content.indexOf("__MCE_ITEM__")===-1){l.remove(j.reverse(),true)}}}f.onPostProcess.dispatch(f,m);m.content=d.serializer.serialize(m.node,{getInner:1});if((!k)&&(d.pasteAsPlainText)){f._insertPlainText(d,l,m.content);if(!b(d,"paste_text_sticky")){d.pasteAsPlainText=false;d.controlManager.setActive("pastetext",false)}}else{f._insert(m.content)}}d.addCommand("mceInsertClipboardContent",function(i,j){h(j,true)});if(!b(d,"paste_text_use_dialog")){d.addCommand("mcePasteText",function(j,i){var k=tinymce.util.Cookie;d.pasteAsPlainText=!d.pasteAsPlainText;d.controlManager.setActive("pastetext",d.pasteAsPlainText);if((d.pasteAsPlainText)&&(!k.get("tinymcePasteText"))){if(b(d,"paste_text_sticky")){d.windowManager.alert(d.translate("paste.plaintext_mode_sticky"))}else{d.windowManager.alert(d.translate("paste.plaintext_mode_sticky"))}if(!b(d,"paste_text_notifyalways")){k.set("tinymcePasteText","1",new Date(new Date().getFullYear()+1,12,31))}}})}d.addButton("pastetext",{title:"paste.paste_text_desc",cmd:"mcePasteText"});d.addButton("selectall",{title:"paste.selectall_desc",cmd:"selectall"});function g(s){var l,p,j,t,k=d.selection,o=d.dom,q=d.getBody(),i,r;if(s.clipboardData||o.doc.dataTransfer){r=(s.clipboardData||o.doc.dataTransfer).getData("Text");if(d.pasteAsPlainText){s.preventDefault();h({content:r.replace(/\r?\n/g,"<br />")});return}}if(o.get("_mcePaste")){return}l=o.add(q,"div",{id:"_mcePaste","class":"mcePaste","data-mce-bogus":"1"},'\uFEFF\uFEFF<br data-mce-bogus="1">');if(q!=d.getDoc().body){i=o.getPos(d.selection.getStart(),q).y}else{i=q.scrollTop+o.getViewPort().y}o.setStyles(l,{position:"absolute",left:-10000,top:i,width:1,height:1,overflow:"hidden"});if(tinymce.isIE){t=k.getRng();j=o.doc.body.createTextRange();j.moveToElementText(l);j.execCommand("Paste");o.remove(l);if(l.innerHTML==="\uFEFF"){d.execCommand("mcePasteWord");s.preventDefault();return}k.setRng(t);k.setContent("");setTimeout(function(){h({content:l.innerHTML})},0);return tinymce.dom.Event.cancel(s)}else{function m(n){n.preventDefault()}o.bind(d.getDoc(),"mousedown",m);o.bind(d.getDoc(),"keydown",m);p=d.selection.getRng();l=l.firstChild;j=d.getDoc().createRange();j.setStart(l,0);j.setEnd(l,1);k.setRng(j);window.setTimeout(function(){var u="",n;if(!o.select("div.mcePaste > div.mcePaste").length){n=o.select("div.mcePaste");c(n,function(w){var v=w.firstChild;if(v&&v.nodeName=="DIV"&&v.style.marginTop&&v.style.backgroundColor){o.remove(v,1)}c(o.select("span.Apple-style-span",w),function(x){o.remove(x,1)});c(o.select("br[data-mce-bogus]",w),function(x){o.remove(x)});if(w.parentNode.className!="mcePaste"){u+=w.innerHTML}})}else{u="<pre>"+o.encode(r).replace(/\r?\n/g,"<br />")+"</pre>"}c(o.select("div.mcePaste"),function(v){o.remove(v)});if(p){k.setRng(p)}h({content:u});o.unbind(d.getDoc(),"mousedown",m);o.unbind(d.getDoc(),"keydown",m)},0)}}if(b(d,"paste_auto_cleanup_on_paste")){if(tinymce.isOpera||/Firefox\/2/.test(navigator.userAgent)){d.onKeyDown.addToTop(function(i,j){if(((tinymce.isMac?j.metaKey:j.ctrlKey)&&j.keyCode==86)||(j.shiftKey&&j.keyCode==45)){g(j)}})}else{d.onPaste.addToTop(function(i,j){return g(j)})}}if(b(d,"paste_block_drop")){d.onInit.add(function(){d.dom.bind(d.getBody(),["dragend","dragover","draggesture","dragdrop","drop","drag"],function(i){i.preventDefault();i.stopPropagation();return false})})}f._legacySupport()},getInfo:function(){return{longname:"Paste text/word",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/paste",version:tinymce.majorVersion+"."+tinymce.minorVersion}},_preProcess:function(g,e){var k=this.editor,j=e.content,p=tinymce.grep,n=tinymce.explode,f=tinymce.trim,l,i;function d(h){c(h,function(o){if(o.constructor==RegExp){j=j.replace(o,"")}else{j=j.replace(o[0],o[1])}})}if(k.settings.paste_enable_default_filters==false){return}if(tinymce.isIE&&document.documentMode>=9){d([[/(?:<br>&nbsp;[\s\r\n]+|<br>)*(<\/?(h[1-6r]|p|div|address|pre|form|table|tbody|thead|tfoot|th|tr|td|li|ol|ul|caption|blockquote|center|dl|dt|dd|dir|fieldset)[^>]*>)(?:<br>&nbsp;[\s\r\n]+|<br>)*/g,"$1"]])}if(/class="?Mso|style="[^"]*\bmso-|w:WordDocument/i.test(j)||e.wordContent){e.wordContent=true;d([/^\s*(&nbsp;)+/gi,/(&nbsp;|<br[^>]*>)+\s*$/gi]);if(b(k,"paste_convert_headers_to_strong")){j=j.replace(/<p [^>]*class="?MsoHeading"?[^>]*>(.*?)<\/p>/gi,"<p><strong>$1</strong></p>")}if(b(k,"paste_convert_middot_lists")){d([[/<!--\[if !supportLists\]-->/gi,"$&__MCE_ITEM__"],[/(<span[^>]+(?:mso-list:|:\s*symbol)[^>]+>)/gi,"$1__MCE_ITEM__"],[/(<p[^>]+(?:MsoListParagraph)[^>]+>)/gi,"$1__MCE_ITEM__"]])}d([/<!--[\s\S]+?-->/gi,/<(!|script[^>]*>.*?<\/script(?=[>\s])|\/?(\?xml(:\w+)?|img|meta|link|style|\w:\w+)(?=[\s\/>]))[^>]*>/gi,[/<(\/?)s>/gi,"<$1strike>"],[/&nbsp;/gi,"\u00a0"]]);do{l=j.length;j=j.replace(/(<[a-z][^>]*\s)(?:id|name|language|type|on\w+|\w+:\w+)=(?:"[^"]*"|\w+)\s?/gi,"$1")}while(l!=j.length);if(b(k,"paste_retain_style_properties").replace(/^none$/i,"").length==0){j=j.replace(/<\/?span[^>]*>/gi,"")}else{d([[/<span\s+style\s*=\s*"\s*mso-spacerun\s*:\s*yes\s*;?\s*"\s*>([\s\u00a0]*)<\/span>/gi,function(o,h){return(h.length>0)?h.replace(/./," ").slice(Math.floor(h.length/2)).split("").join("\u00a0"):""}],[/(<[a-z][^>]*)\sstyle="([^"]*)"/gi,function(t,h,r){var u=[],o=0,q=n(f(r).replace(/&quot;/gi,"'"),";");c(q,function(s){var w,y,z=n(s,":");function x(A){return A+((A!=="0")&&(/\d$/.test(A)))?"px":""}if(z.length==2){w=z[0].toLowerCase();y=z[1].toLowerCase();switch(w){case"mso-padding-alt":case"mso-padding-top-alt":case"mso-padding-right-alt":case"mso-padding-bottom-alt":case"mso-padding-left-alt":case"mso-margin-alt":case"mso-margin-top-alt":case"mso-margin-right-alt":case"mso-margin-bottom-alt":case"mso-margin-left-alt":case"mso-table-layout-alt":case"mso-height":case"mso-width":case"mso-vertical-align-alt":u[o++]=w.replace(/^mso-|-alt$/g,"")+":"+x(y);return;case"horiz-align":u[o++]="text-align:"+y;return;case"vert-align":u[o++]="vertical-align:"+y;return;case"font-color":case"mso-foreground":u[o++]="color:"+y;return;case"mso-background":case"mso-highlight":u[o++]="background:"+y;return;case"mso-default-height":u[o++]="min-height:"+x(y);return;case"mso-default-width":u[o++]="min-width:"+x(y);return;case"mso-padding-between-alt":u[o++]="border-collapse:separate;border-spacing:"+x(y);return;case"text-line-through":if((y=="single")||(y=="double")){u[o++]="text-decoration:line-through"}return;case"mso-zero-height":if(y=="yes"){u[o++]="display:none"}return}if(/^(mso|column|font-emph|lang|layout|line-break|list-image|nav|panose|punct|row|ruby|sep|size|src|tab-|table-border|text-(?!align|decor|indent|trans)|top-bar|version|vnd|word-break)/.test(w)){return}u[o++]=w+":"+z[1]}});if(o>0){return h+' style="'+u.join(";")+'"'}else{return h}}]])}}if(b(k,"paste_convert_headers_to_strong")){d([[/<h[1-6][^>]*>/gi,"<p><strong>"],[/<\/h[1-6][^>]*>/gi,"</strong></p>"]])}d([[/Version:[\d.]+\nStartHTML:\d+\nEndHTML:\d+\nStartFragment:\d+\nEndFragment:\d+/gi,""]]);i=b(k,"paste_strip_class_attributes");if(i!=="none"){function m(q,o){if(i==="all"){return""}var h=p(n(o.replace(/^(["'])(.*)\1$/,"$2")," "),function(r){return(/^(?!mso)/i.test(r))});return h.length?' class="'+h.join(" ")+'"':""}j=j.replace(/ class="([^"]+)"/gi,m);j=j.replace(/ class=([\-\w]+)/gi,m)}if(b(k,"paste_remove_spans")){j=j.replace(/<\/?span[^>]*>/gi,"")}e.content=j},_postProcess:function(g,i){var f=this,e=f.editor,h=e.dom,d;if(e.settings.paste_enable_default_filters==false){return}if(i.wordContent){c(h.select("a",i.node),function(j){if(!j.href||j.href.indexOf("#_Toc")!=-1){h.remove(j,1)}});if(b(e,"paste_convert_middot_lists")){f._convertLists(g,i)}d=b(e,"paste_retain_style_properties");if((tinymce.is(d,"string"))&&(d!=="all")&&(d!=="*")){d=tinymce.explode(d.replace(/^none$/i,""));c(h.select("*",i.node),function(m){var n={},k=0,l,o,j;if(d){for(l=0;l<d.length;l++){o=d[l];j=h.getStyle(m,o);if(j){n[o]=j;k++}}}h.setAttrib(m,"style","");if(d&&k>0){h.setStyles(m,n)}else{if(m.nodeName=="SPAN"&&!m.className){h.remove(m,true)}}})}}if(b(e,"paste_remove_styles")||(b(e,"paste_remove_styles_if_webkit")&&tinymce.isWebKit)){c(h.select("*[style]",i.node),function(j){j.removeAttribute("style");j.removeAttribute("data-mce-style")})}else{if(tinymce.isWebKit){c(h.select("*",i.node),function(j){j.removeAttribute("data-mce-style")})}}},_convertLists:function(g,e){var i=g.editor.dom,h,l,d=-1,f,m=[],k,j;c(i.select("p",e.node),function(t){var q,u="",s,r,n,o;for(q=t.firstChild;q&&q.nodeType==3;q=q.nextSibling){u+=q.nodeValue}u=t.innerHTML.replace(/<\/?\w+[^>]*>/gi,"").replace(/&nbsp;/g,"\u00a0");if(/^(__MCE_ITEM__)+[\u2022\u00b7\u00a7\u00d8o\u25CF]\s*\u00a0*/.test(u)){s="ul"}if(/^__MCE_ITEM__\s*\w+\.\s*\u00a0+/.test(u)){s="ol"}if(s){f=parseFloat(t.style.marginLeft||0);if(f>d){m.push(f)}if(!h||s!=k){h=i.create(s);i.insertAfter(h,t)}else{if(f>d){h=l.appendChild(i.create(s))}else{if(f<d){n=tinymce.inArray(m,f);o=i.getParents(h.parentNode,s);h=o[o.length-1-n]||h}}}c(i.select("span",t),function(v){var p=v.innerHTML.replace(/<\/?\w+[^>]*>/gi,"");if(s=="ul"&&/^__MCE_ITEM__[\u2022\u00b7\u00a7\u00d8o\u25CF]/.test(p)){i.remove(v)}else{if(/^__MCE_ITEM__[\s\S]*\w+\.(&nbsp;|\u00a0)*\s*/.test(p)){i.remove(v)}}});r=t.innerHTML;if(s=="ul"){r=t.innerHTML.replace(/__MCE_ITEM__/g,"").replace(/^[\u2022\u00b7\u00a7\u00d8o\u25CF]\s*(&nbsp;|\u00a0)+\s*/,"")}else{r=t.innerHTML.replace(/__MCE_ITEM__/g,"").replace(/^\s*\w+\.(&nbsp;|\u00a0)+\s*/,"")}l=h.appendChild(i.create("li",0,r));i.remove(t);d=f;k=s}else{h=d=0}});j=e.node.innerHTML;if(j.indexOf("__MCE_ITEM__")!=-1){e.node.innerHTML=j.replace(/__MCE_ITEM__/g,"")}},_insert:function(f,d){var e=this.editor,g=e.selection.getRng();if(!e.selection.isCollapsed()&&g.startContainer!=g.endContainer){e.getDoc().execCommand("Delete",false,null)}e.execCommand("mceInsertContent",false,f,{skip_undo:d})},_insertPlainText:function(j,x,v){var t,u,l,k,r,e,p,f,n=j.getWin(),z=j.getDoc(),s=j.selection,m=tinymce.is,y=tinymce.inArray,g=b(j,"paste_text_linebreaktype"),o=b(j,"paste_text_replacements");function q(d){c(d,function(h){if(h.constructor==RegExp){v=v.replace(h,"")}else{v=v.replace(h[0],h[1])}})}if((typeof(v)==="string")&&(v.length>0)){if(/<(?:p|br|h[1-6]|ul|ol|dl|table|t[rdh]|div|blockquote|fieldset|pre|address|center)[^>]*>/i.test(v)){q([/[\n\r]+/g])}else{q([/\r+/g])}q([[/<\/(?:p|h[1-6]|ul|ol|dl|table|div|blockquote|fieldset|pre|address|center)>/gi,"\n\n"],[/<br[^>]*>|<\/tr>/gi,"\n"],[/<\/t[dh]>\s*<t[dh][^>]*>/gi,"\t"],/<[a-z!\/?][^>]*>/gi,[/&nbsp;/gi," "],[/(?:(?!\n)\s)*(\n+)(?:(?!\n)\s)*/gi,"$1"],[/\n{3,}/g,"\n\n"],/^\s+|\s+$/g]);v=x.decode(tinymce.html.Entities.encodeRaw(v));if(!s.isCollapsed()){z.execCommand("Delete",false,null)}if(m(o,"array")||(m(o,"array"))){q(o)}else{if(m(o,"string")){q(new RegExp(o,"gi"))}}if(g=="none"){q([[/\n+/g," "]])}else{if(g=="br"){q([[/\n/g,"<br />"]])}else{q([/^\s+|\s+$/g,[/\n\n/g,"</p><p>"],[/\n/g,"<br />"]])}}if((l=v.indexOf("</p><p>"))!=-1){k=v.lastIndexOf("</p><p>");r=s.getNode();e=[];do{if(r.nodeType==1){if(r.nodeName=="TD"||r.nodeName=="BODY"){break}e[e.length]=r}}while(r=r.parentNode);if(e.length>0){p=v.substring(0,l);f="";for(t=0,u=e.length;t<u;t++){p+="</"+e[t].nodeName.toLowerCase()+">";f+="<"+e[e.length-t-1].nodeName.toLowerCase()+">"}if(l==k){v=p+f+v.substring(l+7)}else{v=p+v.substring(l+4,k+4)+f+v.substring(k+7)}}}j.execCommand("mceInsertRawHTML",false,v+'<span id="_plain_text_marker">&nbsp;</span>');window.setTimeout(function(){var d=x.get("_plain_text_marker"),A,h,w,i;s.select(d,false);z.execCommand("Delete",false,null);d=null;A=s.getStart();h=x.getViewPort(n);w=x.getPos(A).y;i=A.clientHeight;if((w<h.y)||(w+i>h.y+h.h)){z.body.scrollTop=w<h.y?w:w-h.h+25}},0)}},_legacySupport:function(){var e=this,d=e.editor;d.addCommand("mcePasteWord",function(){d.windowManager.open({file:e.url+"/pasteword.htm",width:parseInt(b(d,"paste_dialog_width")),height:parseInt(b(d,"paste_dialog_height")),inline:1})});if(b(d,"paste_text_use_dialog")){d.addCommand("mcePasteText",function(){d.windowManager.open({file:e.url+"/pastetext.htm",width:parseInt(b(d,"paste_dialog_width")),height:parseInt(b(d,"paste_dialog_height")),inline:1})})}d.addButton("pasteword",{title:"paste.paste_word_desc",cmd:"mcePasteWord"})}});tinymce.PluginManager.add("paste",tinymce.plugins.PastePlugin)})();
\ No newline at end of file
diff -x .svn -aruN 0.7.24.src/e107_handlers/tiny_mce/plugins/paste/editor_plugin_src.js 0.7.26.src/e107_handlers/tiny_mce/plugins/paste/editor_plugin_src.js
--- 0.7.24.src/e107_handlers/tiny_mce/plugins/paste/editor_plugin_src.js	1969-12-31 18:00:00.000000000 -0600
+++ 0.7.26.src/e107_handlers/tiny_mce/plugins/paste/editor_plugin_src.js	2011-03-30 03:22:40.000000000 -0500
@@ -0,0 +1,930 @@
+/**
+ * editor_plugin_src.js
+ *
+ * Copyright 2009, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://tinymce.moxiecode.com/license
+ * Contributing: http://tinymce.moxiecode.com/contributing
+ */
+
+(function() {
+	var each = tinymce.each,
+		defs = {
+			paste_auto_cleanup_on_paste : true,
+			paste_enable_default_filters : true,
+			paste_block_drop : false,
+			paste_retain_style_properties : "none",
+			paste_strip_class_attributes : "mso",
+			paste_remove_spans : false,
+			paste_remove_styles : false,
+			paste_remove_styles_if_webkit : true,
+			paste_convert_middot_lists : true,
+			paste_convert_headers_to_strong : false,
+			paste_dialog_width : "450",
+			paste_dialog_height : "400",
+			paste_text_use_dialog : false,
+			paste_text_sticky : false,
+			paste_text_notifyalways : false,
+			paste_text_linebreaktype : "p",
+			paste_text_replacements : [
+				[/\u2026/g, "..."],
+				[/[\x93\x94\u201c\u201d]/g, '"'],
+				[/[\x60\x91\x92\u2018\u2019]/g, "'"]
+			]
+		};
+
+	function getParam(ed, name) {
+		return ed.getParam(name, defs[name]);
+	}
+
+	tinymce.create('tinymce.plugins.PastePlugin', {
+		init : function(ed, url) {
+			var t = this;
+
+			t.editor = ed;
+			t.url = url;
+
+			// Setup plugin events
+			t.onPreProcess = new tinymce.util.Dispatcher(t);
+			t.onPostProcess = new tinymce.util.Dispatcher(t);
+
+			// Register default handlers
+			t.onPreProcess.add(t._preProcess);
+			t.onPostProcess.add(t._postProcess);
+
+			// Register optional preprocess handler
+			t.onPreProcess.add(function(pl, o) {
+				ed.execCallback('paste_preprocess', pl, o);
+			});
+
+			// Register optional postprocess
+			t.onPostProcess.add(function(pl, o) {
+				ed.execCallback('paste_postprocess', pl, o);
+			});
+
+			ed.onKeyDown.addToTop(function(ed, e) {
+				// Block ctrl+v from adding an undo level since the default logic in tinymce.Editor will add that
+				if (((tinymce.isMac ? e.metaKey : e.ctrlKey) && e.keyCode == 86) || (e.shiftKey && e.keyCode == 45))
+					return false; // Stop other listeners
+			});
+
+			// Initialize plain text flag
+			ed.pasteAsPlainText = false;
+
+			// This function executes the process handlers and inserts the contents
+			// force_rich overrides plain text mode set by user, important for pasting with execCommand
+			function process(o, force_rich) {
+				var dom = ed.dom, rng, nodes;
+
+				// Execute pre process handlers
+				t.onPreProcess.dispatch(t, o);
+
+				// Create DOM structure
+				o.node = dom.create('div', 0, o.content);
+
+				// If pasting inside the same element and the contents is only one block
+				// remove the block and keep the text since Firefox will copy parts of pre and h1-h6 as a pre element
+				if (tinymce.isGecko) {
+					rng = ed.selection.getRng(true);
+					if (rng.startContainer == rng.endContainer && rng.startContainer.nodeType == 3) {
+						nodes = dom.select('p,h1,h2,h3,h4,h5,h6,pre', o.node);
+
+						// Is only one block node and it doesn't contain word stuff
+						if (nodes.length == 1 && o.content.indexOf('__MCE_ITEM__') === -1)
+							dom.remove(nodes.reverse(), true);
+					}
+				}
+
+				// Execute post process handlers
+				t.onPostProcess.dispatch(t, o);
+
+				// Serialize content
+				o.content = ed.serializer.serialize(o.node, {getInner : 1});
+
+				// Plain text option active?
+				if ((!force_rich) && (ed.pasteAsPlainText)) {
+					t._insertPlainText(ed, dom, o.content);
+
+					if (!getParam(ed, "paste_text_sticky")) {
+						ed.pasteAsPlainText = false;
+						ed.controlManager.setActive("pastetext", false);
+					}
+				} else {
+					t._insert(o.content);
+				}
+			}
+
+			// Add command for external usage
+			ed.addCommand('mceInsertClipboardContent', function(u, o) {
+				process(o, true);
+			});
+
+			if (!getParam(ed, "paste_text_use_dialog")) {
+				ed.addCommand('mcePasteText', function(u, v) {
+					var cookie = tinymce.util.Cookie;
+
+					ed.pasteAsPlainText = !ed.pasteAsPlainText;
+					ed.controlManager.setActive('pastetext', ed.pasteAsPlainText);
+
+					if ((ed.pasteAsPlainText) && (!cookie.get("tinymcePasteText"))) {
+						if (getParam(ed, "paste_text_sticky")) {
+							ed.windowManager.alert(ed.translate('paste.plaintext_mode_sticky'));
+						} else {
+							ed.windowManager.alert(ed.translate('paste.plaintext_mode_sticky'));
+						}
+
+						if (!getParam(ed, "paste_text_notifyalways")) {
+							cookie.set("tinymcePasteText", "1", new Date(new Date().getFullYear() + 1, 12, 31))
+						}
+					}
+				});
+			}
+
+			ed.addButton('pastetext', {title: 'paste.paste_text_desc', cmd: 'mcePasteText'});
+			ed.addButton('selectall', {title: 'paste.selectall_desc', cmd: 'selectall'});
+
+			// This function grabs the contents from the clipboard by adding a
+			// hidden div and placing the caret inside it and after the browser paste
+			// is done it grabs that contents and processes that
+			function grabContent(e) {
+				var n, or, rng, oldRng, sel = ed.selection, dom = ed.dom, body = ed.getBody(), posY, textContent;
+
+				// Check if browser supports direct plaintext access
+				if (e.clipboardData || dom.doc.dataTransfer) {
+					textContent = (e.clipboardData || dom.doc.dataTransfer).getData('Text');
+
+					if (ed.pasteAsPlainText) {
+						e.preventDefault();
+						process({content : textContent.replace(/\r?\n/g, '<br />')});
+						return;
+					}
+				}
+
+				if (dom.get('_mcePaste'))
+					return;
+
+				// Create container to paste into
+				n = dom.add(body, 'div', {id : '_mcePaste', 'class' : 'mcePaste', 'data-mce-bogus' : '1'}, '\uFEFF\uFEFF<br data-mce-bogus="1">');
+
+				// If contentEditable mode we need to find out the position of the closest element
+				if (body != ed.getDoc().body)
+					posY = dom.getPos(ed.selection.getStart(), body).y;
+				else
+					posY = body.scrollTop + dom.getViewPort().y;
+
+				// Styles needs to be applied after the element is added to the document since WebKit will otherwise remove all styles
+				dom.setStyles(n, {
+					position : 'absolute',
+					left : -10000,
+					top : posY,
+					width : 1,
+					height : 1,
+					overflow : 'hidden'
+				});
+
+				if (tinymce.isIE) {
+					// Store away the old range
+					oldRng = sel.getRng();
+
+					// Select the container
+					rng = dom.doc.body.createTextRange();
+					rng.moveToElementText(n);
+					rng.execCommand('Paste');
+
+					// Remove container
+					dom.remove(n);
+
+					// Check if the contents was changed, if it wasn't then clipboard extraction failed probably due
+					// to IE security settings so we pass the junk though better than nothing right
+					if (n.innerHTML === '\uFEFF') {
+						ed.execCommand('mcePasteWord');
+						e.preventDefault();
+						return;
+					}
+
+					// Restore the old range and clear the contents before pasting
+					sel.setRng(oldRng);
+					sel.setContent('');
+
+					// For some odd reason we need to detach the the mceInsertContent call from the paste event
+					// It's like IE has a reference to the parent element that you paste in and the selection gets messed up
+					// when it tries to restore the selection
+					setTimeout(function() {
+						// Process contents
+						process({content : n.innerHTML});
+					}, 0);
+
+					// Block the real paste event
+					return tinymce.dom.Event.cancel(e);
+				} else {
+					function block(e) {
+						e.preventDefault();
+					};
+
+					// Block mousedown and click to prevent selection change
+					dom.bind(ed.getDoc(), 'mousedown', block);
+					dom.bind(ed.getDoc(), 'keydown', block);
+
+					or = ed.selection.getRng();
+
+					// Move caret into hidden div
+					n = n.firstChild;
+					rng = ed.getDoc().createRange();
+					rng.setStart(n, 0);
+					rng.setEnd(n, 1);
+					sel.setRng(rng);
+
+					// Wait a while and grab the pasted contents
+					window.setTimeout(function() {
+						var h = '', nl;
+
+						// Paste divs duplicated in paste divs seems to happen when you paste plain text so lets first look for that broken behavior in WebKit
+						if (!dom.select('div.mcePaste > div.mcePaste').length) {
+							nl = dom.select('div.mcePaste');
+
+							// WebKit will split the div into multiple ones so this will loop through then all and join them to get the whole HTML string
+							each(nl, function(n) {
+								var child = n.firstChild;
+
+								// WebKit inserts a DIV container with lots of odd styles
+								if (child && child.nodeName == 'DIV' && child.style.marginTop && child.style.backgroundColor) {
+									dom.remove(child, 1);
+								}
+
+								// Remove apply style spans
+								each(dom.select('span.Apple-style-span', n), function(n) {
+									dom.remove(n, 1);
+								});
+
+								// Remove bogus br elements
+								each(dom.select('br[data-mce-bogus]', n), function(n) {
+									dom.remove(n);
+								});
+
+								// WebKit will make a copy of the DIV for each line of plain text pasted and insert them into the DIV
+								if (n.parentNode.className != 'mcePaste')
+									h += n.innerHTML;
+							});
+						} else {
+							// Found WebKit weirdness so force the content into plain text mode
+							h = '<pre>' + dom.encode(textContent).replace(/\r?\n/g, '<br />') + '</pre>';
+						}
+
+						// Remove the nodes
+						each(dom.select('div.mcePaste'), function(n) {
+							dom.remove(n);
+						});
+
+						// Restore the old selection
+						if (or)
+							sel.setRng(or);
+
+						process({content : h});
+
+						// Unblock events ones we got the contents
+						dom.unbind(ed.getDoc(), 'mousedown', block);
+						dom.unbind(ed.getDoc(), 'keydown', block);
+					}, 0);
+				}
+			}
+
+			// Check if we should use the new auto process method			
+			if (getParam(ed, "paste_auto_cleanup_on_paste")) {
+				// Is it's Opera or older FF use key handler
+				if (tinymce.isOpera || /Firefox\/2/.test(navigator.userAgent)) {
+					ed.onKeyDown.addToTop(function(ed, e) {
+						if (((tinymce.isMac ? e.metaKey : e.ctrlKey) && e.keyCode == 86) || (e.shiftKey && e.keyCode == 45))
+							grabContent(e);
+					});
+				} else {
+					// Grab contents on paste event on Gecko and WebKit
+					ed.onPaste.addToTop(function(ed, e) {
+						return grabContent(e);
+					});
+				}
+			}
+
+			// Block all drag/drop events
+			if (getParam(ed, "paste_block_drop")) {
+				ed.onInit.add(function() {
+					ed.dom.bind(ed.getBody(), ['dragend', 'dragover', 'draggesture', 'dragdrop', 'drop', 'drag'], function(e) {
+						e.preventDefault();
+						e.stopPropagation();
+
+						return false;
+					});
+				});
+			}
+
+			// Add legacy support
+			t._legacySupport();
+		},
+
+		getInfo : function() {
+			return {
+				longname : 'Paste text/word',
+				author : 'Moxiecode Systems AB',
+				authorurl : 'http://tinymce.moxiecode.com',
+				infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/paste',
+				version : tinymce.majorVersion + "." + tinymce.minorVersion
+			};
+		},
+
+		_preProcess : function(pl, o) {
+			var ed = this.editor,
+				h = o.content,
+				grep = tinymce.grep,
+				explode = tinymce.explode,
+				trim = tinymce.trim,
+				len, stripClass;
+
+			//console.log('Before preprocess:' + o.content);
+
+			function process(items) {
+				each(items, function(v) {
+					// Remove or replace
+					if (v.constructor == RegExp)
+						h = h.replace(v, '');
+					else
+						h = h.replace(v[0], v[1]);
+				});
+			}
+			
+			if (ed.settings.paste_enable_default_filters == false) {
+				return;
+			}
+
+			// IE9 adds BRs before/after block elements when contents is pasted from word or for example another browser
+			if (tinymce.isIE && document.documentMode >= 9)
+				process([[/(?:<br>&nbsp;[\s\r\n]+|<br>)*(<\/?(h[1-6r]|p|div|address|pre|form|table|tbody|thead|tfoot|th|tr|td|li|ol|ul|caption|blockquote|center|dl|dt|dd|dir|fieldset)[^>]*>)(?:<br>&nbsp;[\s\r\n]+|<br>)*/g, '$1']]);
+
+			// Detect Word content and process it more aggressive
+			if (/class="?Mso|style="[^"]*\bmso-|w:WordDocument/i.test(h) || o.wordContent) {
+				o.wordContent = true;			// Mark the pasted contents as word specific content
+				//console.log('Word contents detected.');
+
+				// Process away some basic content
+				process([
+					/^\s*(&nbsp;)+/gi,				// &nbsp; entities at the start of contents
+					/(&nbsp;|<br[^>]*>)+\s*$/gi		// &nbsp; entities at the end of contents
+				]);
+
+				if (getParam(ed, "paste_convert_headers_to_strong")) {
+					h = h.replace(/<p [^>]*class="?MsoHeading"?[^>]*>(.*?)<\/p>/gi, "<p><strong>$1</strong></p>");
+				}
+
+				if (getParam(ed, "paste_convert_middot_lists")) {
+					process([
+						[/<!--\[if !supportLists\]-->/gi, '$&__MCE_ITEM__'],					// Convert supportLists to a list item marker
+						[/(<span[^>]+(?:mso-list:|:\s*symbol)[^>]+>)/gi, '$1__MCE_ITEM__'],		// Convert mso-list and symbol spans to item markers
+						[/(<p[^>]+(?:MsoListParagraph)[^>]+>)/gi, '$1__MCE_ITEM__']				// Convert mso-list and symbol paragraphs to item markers (FF)
+					]);
+				}
+
+				process([
+					// Word comments like conditional comments etc
+					/<!--[\s\S]+?-->/gi,
+
+					// Remove comments, scripts (e.g., msoShowComment), XML tag, VML content, MS Office namespaced tags, and a few other tags
+					/<(!|script[^>]*>.*?<\/script(?=[>\s])|\/?(\?xml(:\w+)?|img|meta|link|style|\w:\w+)(?=[\s\/>]))[^>]*>/gi,
+
+					// Convert <s> into <strike> for line-though
+					[/<(\/?)s>/gi, "<$1strike>"],
+
+					// Replace nsbp entites to char since it's easier to handle
+					[/&nbsp;/gi, "\u00a0"]
+				]);
+
+				// Remove bad attributes, with or without quotes, ensuring that attribute text is really inside a tag.
+				// If JavaScript had a RegExp look-behind, we could have integrated this with the last process() array and got rid of the loop. But alas, it does not, so we cannot.
+				do {
+					len = h.length;
+					h = h.replace(/(<[a-z][^>]*\s)(?:id|name|language|type|on\w+|\w+:\w+)=(?:"[^"]*"|\w+)\s?/gi, "$1");
+				} while (len != h.length);
+
+				// Remove all spans if no styles is to be retained
+				if (getParam(ed, "paste_retain_style_properties").replace(/^none$/i, "").length == 0) {
+					h = h.replace(/<\/?span[^>]*>/gi, "");
+				} else {
+					// We're keeping styles, so at least clean them up.
+					// CSS Reference: http://msdn.microsoft.com/en-us/library/aa155477.aspx
+
+					process([
+						// Convert <span style="mso-spacerun:yes">___</span> to string of alternating breaking/non-breaking spaces of same length
+						[/<span\s+style\s*=\s*"\s*mso-spacerun\s*:\s*yes\s*;?\s*"\s*>([\s\u00a0]*)<\/span>/gi,
+							function(str, spaces) {
+								return (spaces.length > 0)? spaces.replace(/./, " ").slice(Math.floor(spaces.length/2)).split("").join("\u00a0") : "";
+							}
+						],
+
+						// Examine all styles: delete junk, transform some, and keep the rest
+						[/(<[a-z][^>]*)\sstyle="([^"]*)"/gi,
+							function(str, tag, style) {
+								var n = [],
+									i = 0,
+									s = explode(trim(style).replace(/&quot;/gi, "'"), ";");
+
+								// Examine each style definition within the tag's style attribute
+								each(s, function(v) {
+									var name, value,
+										parts = explode(v, ":");
+
+									function ensureUnits(v) {
+										return v + ((v !== "0") && (/\d$/.test(v)))? "px" : "";
+									}
+
+									if (parts.length == 2) {
+										name = parts[0].toLowerCase();
+										value = parts[1].toLowerCase();
+
+										// Translate certain MS Office styles into their CSS equivalents
+										switch (name) {
+											case "mso-padding-alt":
+											case "mso-padding-top-alt":
+											case "mso-padding-right-alt":
+											case "mso-padding-bottom-alt":
+											case "mso-padding-left-alt":
+											case "mso-margin-alt":
+											case "mso-margin-top-alt":
+											case "mso-margin-right-alt":
+											case "mso-margin-bottom-alt":
+											case "mso-margin-left-alt":
+											case "mso-table-layout-alt":
+											case "mso-height":
+											case "mso-width":
+											case "mso-vertical-align-alt":
+												n[i++] = name.replace(/^mso-|-alt$/g, "") + ":" + ensureUnits(value);
+												return;
+
+											case "horiz-align":
+												n[i++] = "text-align:" + value;
+												return;
+
+											case "vert-align":
+												n[i++] = "vertical-align:" + value;
+												return;
+
+											case "font-color":
+											case "mso-foreground":
+												n[i++] = "color:" + value;
+												return;
+
+											case "mso-background":
+											case "mso-highlight":
+												n[i++] = "background:" + value;
+												return;
+
+											case "mso-default-height":
+												n[i++] = "min-height:" + ensureUnits(value);
+												return;
+
+											case "mso-default-width":
+												n[i++] = "min-width:" + ensureUnits(value);
+												return;
+
+											case "mso-padding-between-alt":
+												n[i++] = "border-collapse:separate;border-spacing:" + ensureUnits(value);
+												return;
+
+											case "text-line-through":
+												if ((value == "single") || (value == "double")) {
+													n[i++] = "text-decoration:line-through";
+												}
+												return;
+
+											case "mso-zero-height":
+												if (value == "yes") {
+													n[i++] = "display:none";
+												}
+												return;
+										}
+
+										// Eliminate all MS Office style definitions that have no CSS equivalent by examining the first characters in the name
+										if (/^(mso|column|font-emph|lang|layout|line-break|list-image|nav|panose|punct|row|ruby|sep|size|src|tab-|table-border|text-(?!align|decor|indent|trans)|top-bar|version|vnd|word-break)/.test(name)) {
+											return;
+										}
+
+										// If it reached this point, it must be a valid CSS style
+										n[i++] = name + ":" + parts[1];		// Lower-case name, but keep value case
+									}
+								});
+
+								// If style attribute contained any valid styles the re-write it; otherwise delete style attribute.
+								if (i > 0) {
+									return tag + ' style="' + n.join(';') + '"';
+								} else {
+									return tag;
+								}
+							}
+						]
+					]);
+				}
+			}
+
+			// Replace headers with <strong>
+			if (getParam(ed, "paste_convert_headers_to_strong")) {
+				process([
+					[/<h[1-6][^>]*>/gi, "<p><strong>"],
+					[/<\/h[1-6][^>]*>/gi, "</strong></p>"]
+				]);
+			}
+
+			process([
+				// Copy paste from Java like Open Office will produce this junk on FF
+				[/Version:[\d.]+\nStartHTML:\d+\nEndHTML:\d+\nStartFragment:\d+\nEndFragment:\d+/gi, '']
+			]);
+
+			// Class attribute options are: leave all as-is ("none"), remove all ("all"), or remove only those starting with mso ("mso").
+			// Note:-  paste_strip_class_attributes: "none", verify_css_classes: true is also a good variation.
+			stripClass = getParam(ed, "paste_strip_class_attributes");
+
+			if (stripClass !== "none") {
+				function removeClasses(match, g1) {
+						if (stripClass === "all")
+							return '';
+
+						var cls = grep(explode(g1.replace(/^(["'])(.*)\1$/, "$2"), " "),
+							function(v) {
+								return (/^(?!mso)/i.test(v));
+							}
+						);
+
+						return cls.length ? ' class="' + cls.join(" ") + '"' : '';
+				};
+
+				h = h.replace(/ class="([^"]+)"/gi, removeClasses);
+				h = h.replace(/ class=([\-\w]+)/gi, removeClasses);
+			}
+
+			// Remove spans option
+			if (getParam(ed, "paste_remove_spans")) {
+				h = h.replace(/<\/?span[^>]*>/gi, "");
+			}
+
+			//console.log('After preprocess:' + h);
+
+			o.content = h;
+		},
+
+		/**
+		 * Various post process items.
+		 */
+		_postProcess : function(pl, o) {
+			var t = this, ed = t.editor, dom = ed.dom, styleProps;
+
+			if (ed.settings.paste_enable_default_filters == false) {
+				return;
+			}
+			
+			if (o.wordContent) {
+				// Remove named anchors or TOC links
+				each(dom.select('a', o.node), function(a) {
+					if (!a.href || a.href.indexOf('#_Toc') != -1)
+						dom.remove(a, 1);
+				});
+
+				if (getParam(ed, "paste_convert_middot_lists")) {
+					t._convertLists(pl, o);
+				}
+
+				// Process styles
+				styleProps = getParam(ed, "paste_retain_style_properties"); // retained properties
+
+				// Process only if a string was specified and not equal to "all" or "*"
+				if ((tinymce.is(styleProps, "string")) && (styleProps !== "all") && (styleProps !== "*")) {
+					styleProps = tinymce.explode(styleProps.replace(/^none$/i, ""));
+
+					// Retains some style properties
+					each(dom.select('*', o.node), function(el) {
+						var newStyle = {}, npc = 0, i, sp, sv;
+
+						// Store a subset of the existing styles
+						if (styleProps) {
+							for (i = 0; i < styleProps.length; i++) {
+								sp = styleProps[i];
+								sv = dom.getStyle(el, sp);
+
+								if (sv) {
+									newStyle[sp] = sv;
+									npc++;
+								}
+							}
+						}
+
+						// Remove all of the existing styles
+						dom.setAttrib(el, 'style', '');
+
+						if (styleProps && npc > 0)
+							dom.setStyles(el, newStyle); // Add back the stored subset of styles
+						else // Remove empty span tags that do not have class attributes
+							if (el.nodeName == 'SPAN' && !el.className)
+								dom.remove(el, true);
+					});
+				}
+			}
+
+			// Remove all style information or only specifically on WebKit to avoid the style bug on that browser
+			if (getParam(ed, "paste_remove_styles") || (getParam(ed, "paste_remove_styles_if_webkit") && tinymce.isWebKit)) {
+				each(dom.select('*[style]', o.node), function(el) {
+					el.removeAttribute('style');
+					el.removeAttribute('data-mce-style');
+				});
+			} else {
+				if (tinymce.isWebKit) {
+					// We need to compress the styles on WebKit since if you paste <img border="0" /> it will become <img border="0" style="... lots of junk ..." />
+					// Removing the mce_style that contains the real value will force the Serializer engine to compress the styles
+					each(dom.select('*', o.node), function(el) {
+						el.removeAttribute('data-mce-style');
+					});
+				}
+			}
+		},
+
+		/**
+		 * Converts the most common bullet and number formats in Office into a real semantic UL/LI list.
+		 */
+		_convertLists : function(pl, o) {
+			var dom = pl.editor.dom, listElm, li, lastMargin = -1, margin, levels = [], lastType, html;
+
+			// Convert middot lists into real semantic lists
+			each(dom.select('p', o.node), function(p) {
+				var sib, val = '', type, html, idx, parents;
+
+				// Get text node value at beginning of paragraph
+				for (sib = p.firstChild; sib && sib.nodeType == 3; sib = sib.nextSibling)
+					val += sib.nodeValue;
+
+				val = p.innerHTML.replace(/<\/?\w+[^>]*>/gi, '').replace(/&nbsp;/g, '\u00a0');
+
+				// Detect unordered lists look for bullets
+				if (/^(__MCE_ITEM__)+[\u2022\u00b7\u00a7\u00d8o\u25CF]\s*\u00a0*/.test(val))
+					type = 'ul';
+
+				// Detect ordered lists 1., a. or ixv.
+				if (/^__MCE_ITEM__\s*\w+\.\s*\u00a0+/.test(val))
+					type = 'ol';
+
+				// Check if node value matches the list pattern: o&nbsp;&nbsp;
+				if (type) {
+					margin = parseFloat(p.style.marginLeft || 0);
+
+					if (margin > lastMargin)
+						levels.push(margin);
+
+					if (!listElm || type != lastType) {
+						listElm = dom.create(type);
+						dom.insertAfter(listElm, p);
+					} else {
+						// Nested list element
+						if (margin > lastMargin) {
+							listElm = li.appendChild(dom.create(type));
+						} else if (margin < lastMargin) {
+							// Find parent level based on margin value
+							idx = tinymce.inArray(levels, margin);
+							parents = dom.getParents(listElm.parentNode, type);
+							listElm = parents[parents.length - 1 - idx] || listElm;
+						}
+					}
+
+					// Remove middot or number spans if they exists
+					each(dom.select('span', p), function(span) {
+						var html = span.innerHTML.replace(/<\/?\w+[^>]*>/gi, '');
+
+						// Remove span with the middot or the number
+						if (type == 'ul' && /^__MCE_ITEM__[\u2022\u00b7\u00a7\u00d8o\u25CF]/.test(html))
+							dom.remove(span);
+						else if (/^__MCE_ITEM__[\s\S]*\w+\.(&nbsp;|\u00a0)*\s*/.test(html))
+							dom.remove(span);
+					});
+
+					html = p.innerHTML;
+
+					// Remove middot/list items
+					if (type == 'ul')
+						html = p.innerHTML.replace(/__MCE_ITEM__/g, '').replace(/^[\u2022\u00b7\u00a7\u00d8o\u25CF]\s*(&nbsp;|\u00a0)+\s*/, '');
+					else
+						html = p.innerHTML.replace(/__MCE_ITEM__/g, '').replace(/^\s*\w+\.(&nbsp;|\u00a0)+\s*/, '');
+
+					// Create li and add paragraph data into the new li
+					li = listElm.appendChild(dom.create('li', 0, html));
+					dom.remove(p);
+
+					lastMargin = margin;
+					lastType = type;
+				} else
+					listElm = lastMargin = 0; // End list element
+			});
+
+			// Remove any left over makers
+			html = o.node.innerHTML;
+			if (html.indexOf('__MCE_ITEM__') != -1)
+				o.node.innerHTML = html.replace(/__MCE_ITEM__/g, '');
+		},
+
+		/**
+		 * Inserts the specified contents at the caret position.
+		 */
+		_insert : function(h, skip_undo) {
+			var ed = this.editor, r = ed.selection.getRng();
+
+			// First delete the contents seems to work better on WebKit when the selection spans multiple list items or multiple table cells.
+			if (!ed.selection.isCollapsed() && r.startContainer != r.endContainer)
+				ed.getDoc().execCommand('Delete', false, null);
+
+			ed.execCommand('mceInsertContent', false, h, {skip_undo : skip_undo});
+		},
+
+		/**
+		 * Instead of the old plain text method which tried to re-create a paste operation, the
+		 * new approach adds a plain text mode toggle switch that changes the behavior of paste.
+		 * This function is passed the same input that the regular paste plugin produces.
+		 * It performs additional scrubbing and produces (and inserts) the plain text.
+		 * This approach leverages all of the great existing functionality in the paste
+		 * plugin, and requires minimal changes to add the new functionality.
+		 * Speednet - June 2009
+		 */
+		_insertPlainText : function(ed, dom, h) {
+			var i, len, pos, rpos, node, breakElms, before, after,
+				w = ed.getWin(),
+				d = ed.getDoc(),
+				sel = ed.selection,
+				is = tinymce.is,
+				inArray = tinymce.inArray,
+				linebr = getParam(ed, "paste_text_linebreaktype"),
+				rl = getParam(ed, "paste_text_replacements");
+
+			function process(items) {
+				each(items, function(v) {
+					if (v.constructor == RegExp)
+						h = h.replace(v, "");
+					else
+						h = h.replace(v[0], v[1]);
+				});
+			};
+
+			if ((typeof(h) === "string") && (h.length > 0)) {
+				// If HTML content with line-breaking tags, then remove all cr/lf chars because only tags will break a line
+				if (/<(?:p|br|h[1-6]|ul|ol|dl|table|t[rdh]|div|blockquote|fieldset|pre|address|center)[^>]*>/i.test(h)) {
+					process([
+						/[\n\r]+/g
+					]);
+				} else {
+					// Otherwise just get rid of carriage returns (only need linefeeds)
+					process([
+						/\r+/g
+					]);
+				}
+
+				process([
+					[/<\/(?:p|h[1-6]|ul|ol|dl|table|div|blockquote|fieldset|pre|address|center)>/gi, "\n\n"],		// Block tags get a blank line after them
+					[/<br[^>]*>|<\/tr>/gi, "\n"],				// Single linebreak for <br /> tags and table rows
+					[/<\/t[dh]>\s*<t[dh][^>]*>/gi, "\t"],		// Table cells get tabs betweem them
+					/<[a-z!\/?][^>]*>/gi,						// Delete all remaining tags
+					[/&nbsp;/gi, " "],							// Convert non-break spaces to regular spaces (remember, *plain text*)
+					[/(?:(?!\n)\s)*(\n+)(?:(?!\n)\s)*/gi, "$1"],	// Cool little RegExp deletes whitespace around linebreak chars.
+					[/\n{3,}/g, "\n\n"],							// Max. 2 consecutive linebreaks
+					/^\s+|\s+$/g									// Trim the front & back
+				]);
+
+				h = dom.decode(tinymce.html.Entities.encodeRaw(h));
+
+				// Delete any highlighted text before pasting
+				if (!sel.isCollapsed()) {
+					d.execCommand("Delete", false, null);
+				}
+
+				// Perform default or custom replacements
+				if (is(rl, "array") || (is(rl, "array"))) {
+					process(rl);
+				}
+				else if (is(rl, "string")) {
+					process(new RegExp(rl, "gi"));
+				}
+
+				// Treat paragraphs as specified in the config
+				if (linebr == "none") {
+					process([
+						[/\n+/g, " "]
+					]);
+				}
+				else if (linebr == "br") {
+					process([
+						[/\n/g, "<br />"]
+					]);
+				}
+				else {
+					process([
+						/^\s+|\s+$/g,
+						[/\n\n/g, "</p><p>"],
+						[/\n/g, "<br />"]
+					]);
+				}
+
+				// This next piece of code handles the situation where we're pasting more than one paragraph of plain
+				// text, and we are pasting the content into the middle of a block node in the editor.  The block
+				// node gets split at the selection point into "Para A" and "Para B" (for the purposes of explaining).
+				// The first paragraph of the pasted text is appended to "Para A", and the last paragraph of the
+				// pasted text is prepended to "Para B".  Any other paragraphs of pasted text are placed between
+				// "Para A" and "Para B".  This code solves a host of problems with the original plain text plugin and
+				// now handles styles correctly.  (Pasting plain text into a styled paragraph is supposed to make the
+				// plain text take the same style as the existing paragraph.)
+				if ((pos = h.indexOf("</p><p>")) != -1) {
+					rpos = h.lastIndexOf("</p><p>");
+					node = sel.getNode(); 
+					breakElms = [];		// Get list of elements to break 
+
+					do {
+						if (node.nodeType == 1) {
+							// Don't break tables and break at body
+							if (node.nodeName == "TD" || node.nodeName == "BODY") {
+								break;
+							}
+
+							breakElms[breakElms.length] = node;
+						}
+					} while (node = node.parentNode);
+
+					// Are we in the middle of a block node?
+					if (breakElms.length > 0) {
+						before = h.substring(0, pos);
+						after = "";
+
+						for (i=0, len=breakElms.length; i<len; i++) {
+							before += "</" + breakElms[i].nodeName.toLowerCase() + ">";
+							after += "<" + breakElms[breakElms.length-i-1].nodeName.toLowerCase() + ">";
+						}
+
+						if (pos == rpos) {
+							h = before + after + h.substring(pos+7);
+						}
+						else {
+							h = before + h.substring(pos+4, rpos+4) + after + h.substring(rpos+7);
+						}
+					}
+				}
+
+				// Insert content at the caret, plus add a marker for repositioning the caret
+				ed.execCommand("mceInsertRawHTML", false, h + '<span id="_plain_text_marker">&nbsp;</span>');
+
+				// Reposition the caret to the marker, which was placed immediately after the inserted content.
+				// Needs to be done asynchronously (in window.setTimeout) or else it doesn't work in all browsers.
+				// The second part of the code scrolls the content up if the caret is positioned off-screen.
+				// This is only necessary for WebKit browsers, but it doesn't hurt to use for all.
+				window.setTimeout(function() {
+					var marker = dom.get('_plain_text_marker'),
+						elm, vp, y, elmHeight;
+
+					sel.select(marker, false);
+					d.execCommand("Delete", false, null);
+					marker = null;
+
+					// Get element, position and height
+					elm = sel.getStart();
+					vp = dom.getViewPort(w);
+					y = dom.getPos(elm).y;
+					elmHeight = elm.clientHeight;
+
+					// Is element within viewport if not then scroll it into view
+					if ((y < vp.y) || (y + elmHeight > vp.y + vp.h)) {
+						d.body.scrollTop = y < vp.y ? y : y - vp.h + 25;
+					}
+				}, 0);
+			}
+		},
+
+		/**
+		 * This method will open the old style paste dialogs. Some users might want the old behavior but still use the new cleanup engine.
+		 */
+		_legacySupport : function() {
+			var t = this, ed = t.editor;
+
+			// Register command(s) for backwards compatibility
+			ed.addCommand("mcePasteWord", function() {
+				ed.windowManager.open({
+					file: t.url + "/pasteword.htm",
+					width: parseInt(getParam(ed, "paste_dialog_width")),
+					height: parseInt(getParam(ed, "paste_dialog_height")),
+					inline: 1
+				});
+			});
+
+			if (getParam(ed, "paste_text_use_dialog")) {
+				ed.addCommand("mcePasteText", function() {
+					ed.windowManager.open({
+						file : t.url + "/pastetext.htm",
+						width: parseInt(getParam(ed, "paste_dialog_width")),
+						height: parseInt(getParam(ed, "paste_dialog_height")),
+						inline : 1
+					});
+				});
+			}
+
+			// Register button for backwards compatibility
+			ed.addButton("pasteword", {title : "paste.paste_word_desc", cmd : "mcePasteWord"});
+		}
+	});
+
+	// Register plugin
+	tinymce.PluginManager.add("paste", tinymce.plugins.PastePlugin);
+})();
diff -x .svn -aruN 0.7.24.src/e107_handlers/tiny_mce/plugins/paste/js/pastetext.js 0.7.26.src/e107_handlers/tiny_mce/plugins/paste/js/pastetext.js
--- 0.7.24.src/e107_handlers/tiny_mce/plugins/paste/js/pastetext.js	1969-12-31 18:00:00.000000000 -0600
+++ 0.7.26.src/e107_handlers/tiny_mce/plugins/paste/js/pastetext.js	2010-10-09 17:21:36.000000000 -0500
@@ -0,0 +1,36 @@
+tinyMCEPopup.requireLangPack();
+
+var PasteTextDialog = {
+	init : function() {
+		this.resize();
+	},
+
+	insert : function() {
+		var h = tinyMCEPopup.dom.encode(document.getElementById('content').value), lines;
+
+		// Convert linebreaks into paragraphs
+		if (document.getElementById('linebreaks').checked) {
+			lines = h.split(/\r?\n/);
+			if (lines.length > 1) {
+				h = '';
+				tinymce.each(lines, function(row) {
+					h += '<p>' + row + '</p>';
+				});
+			}
+		}
+
+		tinyMCEPopup.editor.execCommand('mceInsertClipboardContent', false, {content : h});
+		tinyMCEPopup.close();
+	},
+
+	resize : function() {
+		var vp = tinyMCEPopup.dom.getViewPort(window), el;
+
+		el = document.getElementById('content');
+
+		el.style.width  = (vp.w - 20) + 'px';
+		el.style.height = (vp.h - 90) + 'px';
+	}
+};
+
+tinyMCEPopup.onInit.add(PasteTextDialog.init, PasteTextDialog);
diff -x .svn -aruN 0.7.24.src/e107_handlers/tiny_mce/plugins/paste/js/pasteword.js 0.7.26.src/e107_handlers/tiny_mce/plugins/paste/js/pasteword.js
--- 0.7.24.src/e107_handlers/tiny_mce/plugins/paste/js/pasteword.js	1969-12-31 18:00:00.000000000 -0600
+++ 0.7.26.src/e107_handlers/tiny_mce/plugins/paste/js/pasteword.js	2010-10-09 17:21:36.000000000 -0500
@@ -0,0 +1,51 @@
+tinyMCEPopup.requireLangPack();
+
+var PasteWordDialog = {
+	init : function() {
+		var ed = tinyMCEPopup.editor, el = document.getElementById('iframecontainer'), ifr, doc, css, cssHTML = '';
+
+		// Create iframe
+		el.innerHTML = '<iframe id="iframe" src="javascript:\'\';" frameBorder="0" style="border: 1px solid gray"></iframe>';
+		ifr = document.getElementById('iframe');
+		doc = ifr.contentWindow.document;
+
+		// Force absolute CSS urls
+		css = [ed.baseURI.toAbsolute("themes/" + ed.settings.theme + "/skins/" + ed.settings.skin + "/content.css")];
+		css = css.concat(tinymce.explode(ed.settings.content_css) || []);
+		tinymce.each(css, function(u) {
+			cssHTML += '<link href="' + ed.documentBaseURI.toAbsolute('' + u) + '" rel="stylesheet" type="text/css" />';
+		});
+
+		// Write content into iframe
+		doc.open();
+		doc.write('<html><head>' + cssHTML + '</head><body class="mceContentBody" spellcheck="false"></body></html>');
+		doc.close();
+
+		doc.designMode = 'on';
+		this.resize();
+
+		window.setTimeout(function() {
+			ifr.contentWindow.focus();
+		}, 10);
+	},
+
+	insert : function() {
+		var h = document.getElementById('iframe').contentWindow.document.body.innerHTML;
+
+		tinyMCEPopup.editor.execCommand('mceInsertClipboardContent', false, {content : h, wordContent : true});
+		tinyMCEPopup.close();
+	},
+
+	resize : function() {
+		var vp = tinyMCEPopup.dom.getViewPort(window), el;
+
+		el = document.getElementById('iframe');
+
+		if (el) {
+			el.style.width  = (vp.w - 20) + 'px';
+			el.style.height = (vp.h - 90) + 'px';
+		}
+	}
+};
+
+tinyMCEPopup.onInit.add(PasteWordDialog.init, PasteWordDialog);
diff -x .svn -aruN 0.7.24.src/e107_handlers/tiny_mce/plugins/paste/langs/en_dlg.js 0.7.26.src/e107_handlers/tiny_mce/plugins/paste/langs/en_dlg.js
--- 0.7.24.src/e107_handlers/tiny_mce/plugins/paste/langs/en_dlg.js	1969-12-31 18:00:00.000000000 -0600
+++ 0.7.26.src/e107_handlers/tiny_mce/plugins/paste/langs/en_dlg.js	2010-10-09 17:21:36.000000000 -0500
@@ -0,0 +1,5 @@
+tinyMCE.addI18n('en.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."
+});
\ No newline at end of file
diff -x .svn -aruN 0.7.24.src/e107_handlers/tiny_mce/plugins/table/cell.htm 0.7.26.src/e107_handlers/tiny_mce/plugins/table/cell.htm
--- 0.7.24.src/e107_handlers/tiny_mce/plugins/table/cell.htm	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_handlers/tiny_mce/plugins/table/cell.htm	2011-03-12 04:48:11.000000000 -0600
@@ -1,183 +1,178 @@
-<!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>{#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" />
-</head>
-<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;">{#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>{#table_dlg.general_props}</legend>
-
-					<table border="0" cellpadding="4" cellspacing="0">
-						<tr>
-							<td><label for="align">{#table_dlg.align}</label></td>
-							<td>
-								<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">{#table_dlg.cell_type}</label></td>
-							<td>
-								<select id="celltype" name="celltype">
-									<option value="td">{#table_dlg.td}</option>
-									<option value="th">{#table_dlg.th}</option>
-								</select>
-							</td>
-						</tr>
-
-						<tr>
-							<td><label for="valign">{#table_dlg.valign}</label></td>
-							<td>
-								<select id="valign" name="valign">
-									<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">{#table_dlg.scope}</label></td>
-							<td>
-								<select id="scope" name="scope">
-									<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">{#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">{#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">{#class_name}</label></td>
-							<td colspan="3">
-								<select id="class" name="class" class="mceEditableSelect">
-									<option value="" selected="selected">{#not_set}</option>
-								</select>
-							</td>
-						</tr>
-					</table>
-				</fieldset>
-			</div>
-
-			<div id="advanced_panel" class="panel">
-				<fieldset>
-					<legend>{#table_dlg.advanced_props}</legend>
-
-					<table border="0" cellpadding="0" cellspacing="4">
-						<tr>
-							<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">{#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">{#table_dlg.langdir}</label></td> 
-							<td>
-								<select id="dir" name="dir" style="width: 200px"> 
-										<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">{#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">{#table_dlg.bgimage}</label></td> 
-							<td>
-								<table border="0" cellpadding="0" cellspacing="0">
-									<tr>
-										<td><input id="backgroundimage" name="backgroundimage" type="text" value="" style="width: 200px" onchange="changedBackgroundImage();" /></td>
-										<td id="backgroundimagebrowsercontainer">&nbsp;</td>
-									</tr>
-								</table>
-							</td> 
-						</tr>
-
-						<tr>
-							<td class="column1"><label for="bordercolor">{#table_dlg.bordercolor}</label></td> 
-							<td>
-								<table border="0" cellpadding="0" cellspacing="0">
-									<tr>
-										<td><input id="bordercolor" name="bordercolor" type="text" value="" size="9" onchange="updateColor('bordercolor_pick','bordercolor');changedColor();" /></td>
-										<td id="bordercolor_pickcontainer">&nbsp;</td>
-									</tr>
-								</table>
-							</td> 
-						</tr>
-
-						<tr>
-							<td class="column1"><label for="bgcolor">{#table_dlg.bgcolor}</label></td> 
-							<td>
-								<table border="0" cellpadding="0" cellspacing="0">
-									<tr>
-										<td><input id="bgcolor" name="bgcolor" type="text" value="" size="9" onchange="updateColor('bgcolor_pick','bgcolor');changedColor();" /></td>
-										<td id="bgcolor_pickcontainer">&nbsp;</td>
-									</tr>
-								</table>
-							</td> 
-						</tr>
-					</table>
-				</fieldset>
-			</div>
-		</div>
-
-		<div class="mceActionPanel">
-			<div>
-				<select id="action" name="action">
-					<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="submit" id="insert" name="insert" value="{#update}" /></div>
-			</div>
-
-			<div style="float: right">
-				<input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />
-			</div>
-		</div>
-	</form>
-</body>
-</html>
+<!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>{#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" />
+</head>
+<body id="tablecell" style="display: none" role="application">
+	<form onsubmit="updateAction();return false;" action="#">
+		<div class="tabs">
+			<ul>
+				<li id="general_tab" class="current" aria-controls="general_panel"><span><a href="javascript:mcTabs.displayTab('general_tab','general_panel');" onmousedown="return false;">{#table_dlg.general_tab}</a></span></li>
+				<li id="advanced_tab" aria-controls="advanced_panel"><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>{#table_dlg.general_props}</legend>
+
+					<table role="presentation" border="0" cellpadding="4" cellspacing="0">
+						<tr>
+							<td><label for="align">{#table_dlg.align}</label></td>
+							<td>
+								<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">{#table_dlg.cell_type}</label></td>
+							<td>
+								<select id="celltype" name="celltype">
+									<option value="td">{#table_dlg.td}</option>
+									<option value="th">{#table_dlg.th}</option>
+								</select>
+							</td>
+						</tr>
+
+						<tr>
+							<td><label for="valign">{#table_dlg.valign}</label></td>
+							<td>
+								<select id="valign" name="valign">
+									<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">{#table_dlg.scope}</label></td>
+							<td>
+								<select id="scope" name="scope">
+									<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">{#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">{#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">{#class_name}</label></td>
+							<td colspan="3">
+								<select id="class" name="class" class="mceEditableSelect">
+									<option value="" selected="selected">{#not_set}</option>
+								</select>
+							</td>
+						</tr>
+					</table>
+				</fieldset>
+			</div>
+
+			<div id="advanced_panel" class="panel">
+				<fieldset>
+					<legend>{#table_dlg.advanced_props}</legend>
+
+					<table role="presentation" border="0" cellpadding="0" cellspacing="4">
+						<tr>
+							<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">{#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">{#table_dlg.langdir}</label></td> 
+							<td>
+								<select id="dir" name="dir" style="width: 200px"> 
+										<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">{#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">{#table_dlg.bgimage}</label></td> 
+							<td>
+								<table role="presentation" border="0" cellpadding="0" cellspacing="0">
+									<tr>
+										<td><input id="backgroundimage" name="backgroundimage" type="text" value="" style="width: 200px" onchange="changedBackgroundImage();" /></td>
+										<td id="backgroundimagebrowsercontainer">&nbsp;</td>
+									</tr>
+								</table>
+							</td> 
+						</tr>
+
+						<tr role="group" aria-labelledby="bordercolor_label">
+							<td class="column1"><label id="bordercolor_label" for="bordercolor">{#table_dlg.bordercolor}</label></td> 
+							<td>
+								<table role="presentation" border="0" cellpadding="0" cellspacing="0">
+									<tr>
+										<td><input id="bordercolor" name="bordercolor" type="text" value="" size="9" onchange="updateColor('bordercolor_pick','bordercolor');changedColor();" /></td>
+										<td id="bordercolor_pickcontainer">&nbsp;</td>
+									</tr>
+								</table>
+							</td> 
+						</tr>
+
+						<tr role="group" aria-labelledby="bgcolor_label">
+							<td class="column1"><label id="bgcolor_label" for="bgcolor">{#table_dlg.bgcolor}</label></td> 
+							<td>
+								<table role="presentation" border="0" cellpadding="0" cellspacing="0">
+									<tr>
+										<td><input id="bgcolor" name="bgcolor" type="text" value="" size="9" onchange="updateColor('bgcolor_pick','bgcolor');changedColor();" /></td>
+										<td id="bgcolor_pickcontainer">&nbsp;</td>
+									</tr>
+								</table>
+							</td> 
+						</tr>
+					</table>
+				</fieldset>
+			</div>
+		</div>
+
+		<div class="mceActionPanel">
+			<div>
+				<select id="action" name="action">
+					<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>
+
+			<input type="submit" id="insert" name="insert" value="{#update}" />
+			<input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />
+		</div>
+	</form>
+</body>
+</html>
diff -x .svn -aruN 0.7.24.src/e107_handlers/tiny_mce/plugins/table/css/cell.css 0.7.26.src/e107_handlers/tiny_mce/plugins/table/css/cell.css
--- 0.7.24.src/e107_handlers/tiny_mce/plugins/table/css/cell.css	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_handlers/tiny_mce/plugins/table/css/cell.css	2010-10-09 17:21:36.000000000 -0500
@@ -1,17 +1,17 @@
-/* CSS file for cell dialog in the table plugin */
-
-.panel_wrapper div.current {
-	height: 200px;
-}
-
-.advfield {
-	width: 200px;
-}
-
-#action {
-	margin-bottom: 3px;
-}
-
-#class {
-	width: 150px;
+/* CSS file for cell dialog in the table plugin */
+
+.panel_wrapper div.current {
+	height: 200px;
+}
+
+.advfield {
+	width: 200px;
+}
+
+#action {
+	margin-bottom: 3px;
+}
+
+#class {
+	width: 150px;
 }
\ No newline at end of file
diff -x .svn -aruN 0.7.24.src/e107_handlers/tiny_mce/plugins/table/css/row.css 0.7.26.src/e107_handlers/tiny_mce/plugins/table/css/row.css
--- 0.7.24.src/e107_handlers/tiny_mce/plugins/table/css/row.css	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_handlers/tiny_mce/plugins/table/css/row.css	2010-10-09 17:21:36.000000000 -0500
@@ -1,25 +1,25 @@
-/* CSS file for row dialog in the table plugin */
-
-.panel_wrapper div.current {
-	height: 200px;
-}
-
-.advfield {
-	width: 200px;
-}
-
-#action {
-	margin-bottom: 3px;
-}
-
-#rowtype,#align,#valign,#class,#height {
-	width: 150px;
-}
-
-#height {
-	width: 50px;	
-}
-
-.col2 {
-	padding-left: 20px;
-}
+/* CSS file for row dialog in the table plugin */
+
+.panel_wrapper div.current {
+	height: 200px;
+}
+
+.advfield {
+	width: 200px;
+}
+
+#action {
+	margin-bottom: 3px;
+}
+
+#rowtype,#align,#valign,#class,#height {
+	width: 150px;
+}
+
+#height {
+	width: 50px;	
+}
+
+.col2 {
+	padding-left: 20px;
+}
diff -x .svn -aruN 0.7.24.src/e107_handlers/tiny_mce/plugins/table/css/table.css 0.7.26.src/e107_handlers/tiny_mce/plugins/table/css/table.css
--- 0.7.24.src/e107_handlers/tiny_mce/plugins/table/css/table.css	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_handlers/tiny_mce/plugins/table/css/table.css	2010-10-09 17:21:36.000000000 -0500
@@ -1,13 +1,13 @@
-/* CSS file for table dialog in the table plugin */
-
-.panel_wrapper div.current {
-	height: 245px;
-}
-
-.advfield {
-	width: 200px;
-}
-
-#class {
-	width: 150px;
-}
+/* CSS file for table dialog in the table plugin */
+
+.panel_wrapper div.current {
+	height: 245px;
+}
+
+.advfield {
+	width: 200px;
+}
+
+#class {
+	width: 150px;
+}
diff -x .svn -aruN 0.7.24.src/e107_handlers/tiny_mce/plugins/table/editor_plugin.js 0.7.26.src/e107_handlers/tiny_mce/plugins/table/editor_plugin.js
--- 0.7.24.src/e107_handlers/tiny_mce/plugins/table/editor_plugin.js	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_handlers/tiny_mce/plugins/table/editor_plugin.js	2011-03-30 03:22:40.000000000 -0500
@@ -1 +1 @@
-(function(){var b=tinymce.each;function a(d,e){var f=e.ownerDocument,c=f.createRange(),g;c.setStartBefore(e);c.setEnd(d.endContainer,d.endOffset);g=f.createElement("body");g.appendChild(c.cloneContents());return g.innerHTML.replace(/<(br|img|object|embed|input|textarea)[^>]*>/gi,"-").replace(/<[^>]+>/g,"").length==0}tinymce.create("tinymce.plugins.TablePlugin",{init:function(c,d){var e=this;e.editor=c;e.url=d;b([["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(f){c.addButton(f[0],{title:f[1],cmd:f[2],ui:f[3]})});if(c.getParam("inline_styles")){c.onPreProcess.add(function(f,h){var g=f.dom;b(g.select("table",h.node),function(j){var i;if(i=g.getAttrib(j,"width")){g.setStyle(j,"width",i);g.setAttrib(j,"width")}if(i=g.getAttrib(j,"height")){g.setStyle(j,"height",i);g.setAttrib(j,"height")}})})}c.onInit.add(function(){if(!tinymce.isIE&&c.getParam("forced_root_block")){function f(){var g=c.getBody().lastChild;if(g&&g.nodeName=="TABLE"){c.dom.add(c.getBody(),"p",null,'<br mce_bogus="1" />')}}if(tinymce.isGecko){c.onKeyDown.add(function(h,j){var g,i,k=h.dom;if(j.keyCode==37||j.keyCode==38){g=h.selection.getRng();i=k.getParent(g.startContainer,"table");if(i&&h.getBody().firstChild==i){if(a(g,i)){g=k.createRng();g.setStartBefore(i);g.setEndBefore(i);h.selection.setRng(g);j.preventDefault()}}}})}c.onKeyUp.add(f);c.onSetContent.add(f);c.onVisualAid.add(f);c.onPreProcess.add(function(g,i){var h=i.node.lastChild;if(h&&h.childNodes.length==1&&h.firstChild.nodeName=="BR"){g.dom.remove(h)}});f()}if(c&&c.plugins.contextmenu){c.plugins.contextmenu.onContextMenu.add(function(i,g,k){var l,j=c.selection,h=j.getNode()||c.getBody();if(c.dom.getParent(k,"td")||c.dom.getParent(k,"th")){g.removeAll();if(h.nodeName=="A"&&!c.dom.getAttrib(h,"name")){g.add({title:"advanced.link_desc",icon:"link",cmd:c.plugins.advlink?"mceAdvLink":"mceLink",ui:true});g.add({title:"advanced.unlink_desc",icon:"unlink",cmd:"UnLink"});g.addSeparator()}if(h.nodeName=="IMG"&&h.className.indexOf("mceItem")==-1){g.add({title:"advanced.image_desc",icon:"image",cmd:c.plugins.advimage?"mceAdvImage":"mceImage",ui:true});g.addSeparator()}g.add({title:"table.desc",icon:"table",cmd:"mceInsertTable",ui:true,value:{action:"insert"}});g.add({title:"table.props_desc",icon:"table_props",cmd:"mceInsertTable",ui:true});g.add({title:"table.del",icon:"delete_table",cmd:"mceTableDelete",ui:true});g.addSeparator();l=g.addMenu({title:"table.cell"});l.add({title:"table.cell_desc",icon:"cell_props",cmd:"mceTableCellProps",ui:true});l.add({title:"table.split_cells_desc",icon:"split_cells",cmd:"mceTableSplitCells",ui:true});l.add({title:"table.merge_cells_desc",icon:"merge_cells",cmd:"mceTableMergeCells",ui:true});l=g.addMenu({title:"table.row"});l.add({title:"table.row_desc",icon:"row_props",cmd:"mceTableRowProps",ui:true});l.add({title:"table.row_before_desc",icon:"row_before",cmd:"mceTableInsertRowBefore"});l.add({title:"table.row_after_desc",icon:"row_after",cmd:"mceTableInsertRowAfter"});l.add({title:"table.delete_row_desc",icon:"delete_row",cmd:"mceTableDeleteRow"});l.addSeparator();l.add({title:"table.cut_row_desc",icon:"cut",cmd:"mceTableCutRow"});l.add({title:"table.copy_row_desc",icon:"copy",cmd:"mceTableCopyRow"});l.add({title:"table.paste_row_before_desc",icon:"paste",cmd:"mceTablePasteRowBefore"});l.add({title:"table.paste_row_after_desc",icon:"paste",cmd:"mceTablePasteRowAfter"});l=g.addMenu({title:"table.col"});l.add({title:"table.col_before_desc",icon:"col_before",cmd:"mceTableInsertColBefore"});l.add({title:"table.col_after_desc",icon:"col_after",cmd:"mceTableInsertColAfter"});l.add({title:"table.delete_col_desc",icon:"delete_col",cmd:"mceTableDeleteCol"})}else{g.add({title:"table.desc",icon:"table",cmd:"mceInsertTable",ui:true})}})}});c.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(c.getParam("table_selection",true)){c.onClick.add(function(f,g){g=g.target;if(g.nodeName==="TABLE"){f.selection.select(g)}})}}c.onNodeChange.add(function(g,f,i){var h=g.dom.getParent(i,"td,th,caption");f.setActive("table",i.nodeName==="TABLE"||!!h);if(h&&h.nodeName==="CAPTION"){h=null}f.setDisabled("delete_table",!h);f.setDisabled("delete_col",!h);f.setDisabled("delete_table",!h);f.setDisabled("delete_row",!h);f.setDisabled("col_after",!h);f.setDisabled("col_before",!h);f.setDisabled("row_after",!h);f.setDisabled("row_before",!h);f.setDisabled("row_props",!h);f.setDisabled("cell_props",!h);f.setDisabled("split_cells",!h||(parseInt(g.dom.getAttrib(h,"colspan","1"))<2&&parseInt(g.dom.getAttrib(h,"rowspan","1"))<2));f.setDisabled("merge_cells",!h)});if(!tinymce.isIE){c.onBeforeSetContent.add(function(f,g){if(g.initial){g.content=g.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(s,aa,af){var W=this.editor,av=W,h=this.url;var o=W.selection.getNode();var X=W.dom.getParent(o,"tr");var ar=W.dom.getParent(o,"td,th");var G=W.dom.getParent(o,"table");var l=W.contentWindow.document;var aw=G?G.getAttribute("border"):"";if(X&&ar==null){ar=X.cells[0]}function aq(y,x){for(var ay=0;ay<y.length;ay++){if(y[ay].length>0&&aq(y[ay],x)){return true}if(y[ay]==x){return true}}return false}function ak(x,i){var y;ae=f(G);x=x||0;i=i||0;x=Math.max(p.cellindex+x,0);i=Math.max(p.rowindex+i,0);W.execCommand("mceRepaint");y=e(ae,i,x);if(y){W.selection.select(y.firstChild||y);W.selection.collapse(1)}}function ai(){var i=l.createElement("td");if(!tinymce.isIE){i.innerHTML='<br mce_bogus="1"/>'}}function k(y){var x=W.dom.getAttrib(y,"colspan");var i=W.dom.getAttrib(y,"rowspan");x=x==""?1:parseInt(x);i=i==""?1:parseInt(i);return{colspan:x,rowspan:i}}function am(ay,aA){var i,az;for(az=0;az<ay.length;az++){for(i=0;i<ay[az].length;i++){if(ay[az][i]==aA){return{cellindex:i,rowindex:az}}}}return null}function e(x,y,i){if(x[y]&&x[y][i]){return x[y][i]}return null}function B(aD,ay){var aA=[],y=0,aB,az,ay,aC;for(aB=0;aB<aD.rows.length;aB++){for(az=0;az<aD.rows[aB].cells.length;az++,y++){aA[y]=aD.rows[aB].cells[az]}}for(aB=0;aB<aA.length;aB++){if(aA[aB]==ay){if(aC=aA[aB+1]){return aC}}}}function f(aF){var i=[],aG=aF.rows,aD,aC,az,aA,aE,ay,aB;for(aC=0;aC<aG.length;aC++){for(aD=0;aD<aG[aC].cells.length;aD++){az=aG[aC].cells[aD];aA=k(az);for(aE=aD;i[aC]&&i[aC][aE];aE++){}for(aB=aC;aB<aC+aA.rowspan;aB++){if(!i[aB]){i[aB]=[]}for(ay=aE;ay<aE+aA.colspan;ay++){i[aB][ay]=az}}}}return i}function n(aH,aE,az,ay){var y=f(aH),aG=am(y,az);var aI,aD;if(ay.cells.length!=aE.childNodes.length){aI=aE.childNodes;aD=null;for(var aF=0;az=e(y,aG.rowindex,aF);aF++){var aB=true;var aC=k(az);if(aq(aI,az)){ay.childNodes[aF]._delete=true}else{if((aD==null||az!=aD)&&aC.colspan>1){for(var aA=aF;aA<aF+az.colSpan;aA++){ay.childNodes[aA]._delete=true}}}if((aD==null||az!=aD)&&aC.rowspan>1){az.rowSpan=aC.rowspan+1}aD=az}C(G)}}function P(x,i){while((x=x.previousSibling)!=null){if(x.nodeName==i){return x}}return null}function ag(ay,az){var x=az.split(",");while((ay=ay.nextSibling)!=null){for(var y=0;y<x.length;y++){if(ay.nodeName.toLowerCase()==x[y].toLowerCase()){return ay}}}return null}function C(ay){if(ay.rows==0){return}var y=ay.rows[0];do{var x=ag(y,"TR");if(y._delete){y.parentNode.removeChild(y);continue}var az=y.cells[0];if(az.cells>1){do{var i=ag(az,"TD,TH");if(az._delete){az.parentNode.removeChild(az)}}while((az=i)!=null)}}while((y=x)!=null)}function q(ay,aB,aA){ay.rowSpan=1;var x=ag(aB,"TR");for(var az=1;az<aA&&x;az++){var y=l.createElement("td");if(!tinymce.isIE){y.innerHTML='<br mce_bogus="1"/>'}if(tinymce.isIE){x.insertBefore(y,x.cells(ay.cellIndex))}else{x.insertBefore(y,x.cells[ay.cellIndex])}x=ag(x,"TR")}}function T(aG,aI,aC){var y=f(aI);var ay=aC.cloneNode(false);var aH=am(y,aC.cells[0]);var aD=null;var aB=W.dom.getAttrib(aI,"border");var aA=null;for(var aF=0;aA=e(y,aH.rowindex,aF);aF++){var aE=null;if(aD!=aA){for(var az=0;az<aC.cells.length;az++){if(aA==aC.cells[az]){aE=aA.cloneNode(true);break}}}if(aE==null){aE=aG.createElement("td");if(!tinymce.isIE){aE.innerHTML='<br mce_bogus="1"/>'}}aE.colSpan=1;aE.rowSpan=1;ay.appendChild(aE);aD=aA}return ay}switch(s){case"mceTableMoveToNextRow":var M=B(G,ar);if(!M){W.execCommand("mceTableInsertRowAfter",ar);M=B(G,ar)}W.selection.select(M);W.selection.collapse(true);return true;case"mceTableRowProps":if(X==null){return true}if(aa){W.windowManager.open({url:h+"/row.htm",width:400+parseInt(W.getLang("table.rowprops_delta_width",0)),height:295+parseInt(W.getLang("table.rowprops_delta_height",0)),inline:1},{plugin_url:h})}return true;case"mceTableCellProps":if(ar==null){return true}if(aa){W.windowManager.open({url:h+"/cell.htm",width:400+parseInt(W.getLang("table.cellprops_delta_width",0)),height:295+parseInt(W.getLang("table.cellprops_delta_height",0)),inline:1},{plugin_url:h})}return true;case"mceInsertTable":if(aa){W.windowManager.open({url:h+"/table.htm",width:400+parseInt(W.getLang("table.table_delta_width",0)),height:320+parseInt(W.getLang("table.table_delta_height",0)),inline:1},{plugin_url:h,action:af?af.action:0})}return true;case"mceTableDelete":var H=W.dom.getParent(W.selection.getNode(),"table");if(H){H.parentNode.removeChild(H);W.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(!G){return true}if(X&&G!=X.parentNode){G=X.parentNode}if(G&&X){switch(s){case"mceTableCutRow":if(!X||!ar){return true}W.tableRowClipboard=T(l,G,X);W.execCommand("mceTableDeleteRow");break;case"mceTableCopyRow":if(!X||!ar){return true}W.tableRowClipboard=T(l,G,X);break;case"mceTablePasteRowBefore":if(!X||!ar){return true}var w=W.tableRowClipboard.cloneNode(true);var j=P(X,"TR");if(j!=null){n(G,j,j.cells[0],w)}X.parentNode.insertBefore(w,X);break;case"mceTablePasteRowAfter":if(!X||!ar){return true}var Y=ag(X,"TR");var w=W.tableRowClipboard.cloneNode(true);n(G,X,ar,w);if(Y==null){X.parentNode.appendChild(w)}else{Y.parentNode.insertBefore(w,Y)}break;case"mceTableInsertRowBefore":if(!X||!ar){return true}var ae=f(G);var p=am(ae,ar);var w=l.createElement("tr");var v=null;p.rowindex--;if(p.rowindex<0){p.rowindex=0}for(var ad=0;ar=e(ae,p.rowindex,ad);ad++){if(ar!=v){var F=k(ar);if(F.rowspan==1){var K=l.createElement("td");if(!tinymce.isIE){K.innerHTML='<br mce_bogus="1"/>'}K.colSpan=ar.colSpan;w.appendChild(K)}else{ar.rowSpan=F.rowspan+1}v=ar}}X.parentNode.insertBefore(w,X);ak(0,1);break;case"mceTableInsertRowAfter":if(!X||!ar){return true}var ae=f(G);var p=am(ae,ar);var w=l.createElement("tr");var v=null;for(var ad=0;ar=e(ae,p.rowindex,ad);ad++){if(ar!=v){var F=k(ar);if(F.rowspan==1){var K=l.createElement("td");if(!tinymce.isIE){K.innerHTML='<br mce_bogus="1"/>'}K.colSpan=ar.colSpan;w.appendChild(K)}else{ar.rowSpan=F.rowspan+1}v=ar}}if(w.hasChildNodes()){var Y=ag(X,"TR");if(Y){Y.parentNode.insertBefore(w,Y)}else{G.appendChild(w)}}ak(0,1);break;case"mceTableDeleteRow":if(!X||!ar){return true}var ae=f(G);var p=am(ae,ar);if(ae.length==1&&G.nodeName=="TBODY"){W.dom.remove(W.dom.getParent(G,"table"));return true}var E=X.cells;var Y=ag(X,"TR");for(var ad=0;ad<E.length;ad++){if(E[ad].rowSpan>1){var K=E[ad].cloneNode(true);var F=k(E[ad]);K.rowSpan=F.rowspan-1;var al=Y.cells[ad];if(al==null){Y.appendChild(K)}else{Y.insertBefore(K,al)}}}var v=null;for(var ad=0;ar=e(ae,p.rowindex,ad);ad++){if(ar!=v){var F=k(ar);if(F.rowspan>1){ar.rowSpan=F.rowspan-1}else{X=ar.parentNode;if(X.parentNode){X._delete=true}}v=ar}}C(G);ak(0,-1);break;case"mceTableInsertColBefore":if(!X||!ar){return true}var ae=f(W.dom.getParent(G,"table"));var p=am(ae,ar);var v=null;for(var ab=0;ar=e(ae,ab,p.cellindex);ab++){if(ar!=v){var F=k(ar);if(F.colspan==1){var K=l.createElement(ar.nodeName);if(!tinymce.isIE){K.innerHTML='<br mce_bogus="1"/>'}K.rowSpan=ar.rowSpan;ar.parentNode.insertBefore(K,ar)}else{ar.colSpan++}v=ar}}ak();break;case"mceTableInsertColAfter":if(!X||!ar){return true}var ae=f(W.dom.getParent(G,"table"));var p=am(ae,ar);var v=null;for(var ab=0;ar=e(ae,ab,p.cellindex);ab++){if(ar!=v){var F=k(ar);if(F.colspan==1){var K=l.createElement(ar.nodeName);if(!tinymce.isIE){K.innerHTML='<br mce_bogus="1"/>'}K.rowSpan=ar.rowSpan;var al=ag(ar,"TD,TH");if(al==null){ar.parentNode.appendChild(K)}else{al.parentNode.insertBefore(K,al)}}else{ar.colSpan++}v=ar}}ak(1);break;case"mceTableDeleteCol":if(!X||!ar){return true}var ae=f(G);var p=am(ae,ar);var v=null;if((ae.length>1&&ae[0].length<=1)&&G.nodeName=="TBODY"){W.dom.remove(W.dom.getParent(G,"table"));return true}for(var ab=0;ar=e(ae,ab,p.cellindex);ab++){if(ar!=v){var F=k(ar);if(F.colspan>1){ar.colSpan=F.colspan-1}else{if(ar.parentNode){ar.parentNode.removeChild(ar)}}v=ar}}ak(-1);break;case"mceTableSplitCells":if(!X||!ar){return true}var m=k(ar);var D=m.colspan;var I=m.rowspan;if(D>1||I>1){ar.colSpan=1;for(var an=1;an<D;an++){var K=l.createElement("td");if(!tinymce.isIE){K.innerHTML='<br mce_bogus="1"/>'}X.insertBefore(K,ag(ar,"TD,TH"));if(I>1){q(K,X,I)}}q(ar,X,I)}G=W.dom.getParent(W.selection.getNode(),"table");break;case"mceTableMergeCells":var ap=[];var S=W.selection.getSel();var ae=f(G);if(tinymce.isIE||S.rangeCount==1){if(aa){var u=k(ar);W.windowManager.open({url:h+"/merge_cells.htm",width:240+parseInt(W.getLang("table.merge_cells_delta_width",0)),height:110+parseInt(W.getLang("table.merge_cells_delta_height",0)),inline:1},{action:"update",numcols:u.colspan,numrows:u.rowspan,plugin_url:h});return true}else{var V=parseInt(af.numrows);var d=parseInt(af.numcols);var p=am(ae,ar);if((""+V)=="NaN"){V=1}if((""+d)=="NaN"){d=1}var c=G.rows;for(var ab=p.rowindex;ab<ae.length;ab++){var ah=[];for(var ad=p.cellindex;ad<ae[ab].length;ad++){var g=e(ae,ab,ad);if(g&&!aq(ap,g)&&!aq(ah,g)){var O=am(ae,g);if(O.cellindex<p.cellindex+d&&O.rowindex<p.rowindex+V){ah[ah.length]=g}}}if(ah.length>0){ap[ap.length]=ah}var g=e(ae,p.rowindex,p.cellindex);b(av.dom.select("br",g),function(y,x){if(x>0&&av.dom.getAttrib("mce_bogus")){av.dom.remove(y)}})}}}else{var E=[];var S=W.selection.getSel();var Z=null;var ao=null;var A=-1,ax=-1,z,au;if(S.rangeCount<2){return true}for(var an=0;an<S.rangeCount;an++){var aj=S.getRangeAt(an);var ar=aj.startContainer.childNodes[aj.startOffset];if(!ar){break}if(ar.nodeName=="TD"||ar.nodeName=="TH"){E[E.length]=ar}}var c=G.rows;for(var ab=0;ab<c.length;ab++){var ah=[];for(var ad=0;ad<c[ab].cells.length;ad++){var g=c[ab].cells[ad];for(var an=0;an<E.length;an++){if(g==E[an]){ah[ah.length]=g}}}if(ah.length>0){ap[ap.length]=ah}}var ao=[];var Z=null;for(var ab=0;ab<ae.length;ab++){for(var ad=0;ad<ae[ab].length;ad++){ae[ab][ad]._selected=false;for(var an=0;an<E.length;an++){if(ae[ab][ad]==E[an]){if(A==-1){A=ad;ax=ab}z=ad;au=ab;ae[ab][ad]._selected=true}}}}for(var ab=ax;ab<=au;ab++){for(var ad=A;ad<=z;ad++){if(!ae[ab][ad]._selected){alert("Invalid selection for merge.");return true}}}}var t=1,r=1;var U=-1;for(var ab=0;ab<ap.length;ab++){var J=0;for(var ad=0;ad<ap[ab].length;ad++){var F=k(ap[ab][ad]);J+=F.colspan;if(U!=-1&&F.rowspan!=U){alert("Invalid selection for merge.");return true}U=F.rowspan}if(J>r){r=J}U=-1}var R=-1;for(var ad=0;ad<ap[0].length;ad++){var N=0;for(var ab=0;ab<ap.length;ab++){var F=k(ap[ab][ad]);N+=F.rowspan;if(R!=-1&&F.colspan!=R){alert("Invalid selection for merge.");return true}R=F.colspan}if(N>t){t=N}R=-1}ar=ap[0][0];ar.rowSpan=t;ar.colSpan=r;for(var ab=0;ab<ap.length;ab++){for(var ad=0;ad<ap[ab].length;ad++){var Q=ap[ab][ad].innerHTML;var L=Q.replace(/[ \t\r\n]/g,"");if(L!="<br/>"&&L!="<br>"&&L!='<br mce_bogus="1"/>'&&(ad+ab>0)){ar.innerHTML+=Q}if(ap[ab][ad]!=ar&&!ap[ab][ad]._deleted){var p=am(ae,ap[ab][ad]);var at=ap[ab][ad].parentNode;at.removeChild(ap[ab][ad]);ap[ab][ad]._deleted=true;if(!at.hasChildNodes()){at.parentNode.removeChild(at);var ac=null;for(var ad=0;cellElm=e(ae,p.rowindex,ad);ad++){if(cellElm!=ac&&cellElm.rowSpan>1){cellElm.rowSpan--}ac=cellElm}if(ar.rowSpan>1){ar.rowSpan--}}}}}b(av.dom.select("br",ar),function(y,x){if(x>0&&av.dom.getAttrib(y,"mce_bogus")){av.dom.remove(y)}});break}G=W.dom.getParent(W.selection.getNode(),"table");W.addVisual(G);W.nodeChanged()}return true}return false}});tinymce.PluginManager.add("table",tinymce.plugins.TablePlugin)})();
\ No newline at end of file
+(function(c){var d=c.each;function b(f,g){var h=g.ownerDocument,e=h.createRange(),j;e.setStartBefore(g);e.setEnd(f.endContainer,f.endOffset);j=h.createElement("body");j.appendChild(e.cloneContents());return j.innerHTML.replace(/<(br|img|object|embed|input|textarea)[^>]*>/gi,"-").replace(/<[^>]+>/g,"").length==0}function a(H,G,K){var f,L,D,o;t();o=G.getParent(K.getStart(),"th,td");if(o){L=F(o);D=I();o=z(L.x,L.y)}function A(N,M){N=N.cloneNode(M);N.removeAttribute("id");return N}function t(){var M=0;f=[];d(["thead","tbody","tfoot"],function(N){var O=G.select("> "+N+" tr",H);d(O,function(P,Q){Q+=M;d(G.select("> td, > th",P),function(W,R){var S,T,U,V;if(f[Q]){while(f[Q][R]){R++}}U=h(W,"rowspan");V=h(W,"colspan");for(T=Q;T<Q+U;T++){if(!f[T]){f[T]=[]}for(S=R;S<R+V;S++){f[T][S]={part:N,real:T==Q&&S==R,elm:W,rowspan:U,colspan:V}}}})});M+=O.length})}function z(M,O){var N;N=f[O];if(N){return N[M]}}function h(N,M){return parseInt(N.getAttribute(M)||1)}function s(O,M,N){if(O){N=parseInt(N);if(N===1){O.removeAttribute(M,1)}else{O.setAttribute(M,N,1)}}}function j(M){return M&&(G.hasClass(M.elm,"mceSelected")||M==o)}function k(){var M=[];d(H.rows,function(N){d(N.cells,function(O){if(G.hasClass(O,"mceSelected")||O==o.elm){M.push(N);return false}})});return M}function r(){var M=G.createRng();M.setStartAfter(H);M.setEndAfter(H);K.setRng(M);G.remove(H)}function e(M){var N;c.walk(M,function(P){var O;if(P.nodeType==3){d(G.getParents(P.parentNode,null,M).reverse(),function(Q){Q=A(Q,false);if(!N){N=O=Q}else{if(O){O.appendChild(Q)}}O=Q});if(O){O.innerHTML=c.isIE?"&nbsp;":'<br data-mce-bogus="1" />'}return false}},"childNodes");M=A(M,false);s(M,"rowspan",1);s(M,"colspan",1);if(N){M.appendChild(N)}else{if(!c.isIE){M.innerHTML='<br data-mce-bogus="1" />'}}return M}function q(){var M=G.createRng();d(G.select("tr",H),function(N){if(N.cells.length==0){G.remove(N)}});if(G.select("tr",H).length==0){M.setStartAfter(H);M.setEndAfter(H);K.setRng(M);G.remove(H);return}d(G.select("thead,tbody,tfoot",H),function(N){if(N.rows.length==0){G.remove(N)}});t();row=f[Math.min(f.length-1,L.y)];if(row){K.select(row[Math.min(row.length-1,L.x)].elm,true);K.collapse(true)}}function u(S,Q,U,R){var P,N,M,O,T;P=f[Q][S].elm.parentNode;for(M=1;M<=U;M++){P=G.getNext(P,"tr");if(P){for(N=S;N>=0;N--){T=f[Q+M][N].elm;if(T.parentNode==P){for(O=1;O<=R;O++){G.insertAfter(e(T),T)}break}}if(N==-1){for(O=1;O<=R;O++){P.insertBefore(e(P.cells[0]),P.cells[0])}}}}}function C(){d(f,function(M,N){d(M,function(P,O){var S,R,T,Q;if(j(P)){P=P.elm;S=h(P,"colspan");R=h(P,"rowspan");if(S>1||R>1){s(P,"rowspan",1);s(P,"colspan",1);for(Q=0;Q<S-1;Q++){G.insertAfter(e(P),P)}u(O,N,R-1,S)}}})})}function p(V,S,Y){var P,O,X,W,U,R,T,M,V,N,Q;if(V){pos=F(V);P=pos.x;O=pos.y;X=P+(S-1);W=O+(Y-1)}else{P=L.x;O=L.y;X=D.x;W=D.y}T=z(P,O);M=z(X,W);if(T&&M&&T.part==M.part){C();t();T=z(P,O).elm;s(T,"colspan",(X-P)+1);s(T,"rowspan",(W-O)+1);for(R=O;R<=W;R++){for(U=P;U<=X;U++){if(!f[R]||!f[R][U]){continue}V=f[R][U].elm;if(V!=T){N=c.grep(V.childNodes);d(N,function(Z){T.appendChild(Z)});if(N.length){N=c.grep(T.childNodes);Q=0;d(N,function(Z){if(Z.nodeName=="BR"&&G.getAttrib(Z,"data-mce-bogus")&&Q++<N.length-1){T.removeChild(Z)}})}G.remove(V)}}}q()}}function l(Q){var M,S,P,R,T,U,N,V,O;d(f,function(W,X){d(W,function(Z,Y){if(j(Z)){Z=Z.elm;T=Z.parentNode;U=A(T,false);M=X;if(Q){return false}}});if(Q){return !M}});for(R=0;R<f[0].length;R++){if(!f[M][R]){continue}S=f[M][R].elm;if(S!=P){if(!Q){O=h(S,"rowspan");if(O>1){s(S,"rowspan",O+1);continue}}else{if(M>0&&f[M-1][R]){V=f[M-1][R].elm;O=h(V,"rowspan");if(O>1){s(V,"rowspan",O+1);continue}}}N=e(S);s(N,"colspan",S.colSpan);U.appendChild(N);P=S}}if(U.hasChildNodes()){if(!Q){G.insertAfter(U,T)}else{T.parentNode.insertBefore(U,T)}}}function g(N){var O,M;d(f,function(P,Q){d(P,function(S,R){if(j(S)){O=R;if(N){return false}}});if(N){return !O}});d(f,function(S,T){var P,Q,R;if(!S[O]){return}P=S[O].elm;if(P!=M){R=h(P,"colspan");Q=h(P,"rowspan");if(R==1){if(!N){G.insertAfter(e(P),P);u(O,T,Q-1,R)}else{P.parentNode.insertBefore(e(P),P);u(O,T,Q-1,R)}}else{s(P,"colspan",P.colSpan+1)}M=P}})}function n(){var M=[];d(f,function(N,O){d(N,function(Q,P){if(j(Q)&&c.inArray(M,P)===-1){d(f,function(T){var R=T[P].elm,S;S=h(R,"colspan");if(S>1){s(R,"colspan",S-1)}else{G.remove(R)}});M.push(P)}})});q()}function m(){var N;function M(Q){var P,R,O;P=G.getNext(Q,"tr");d(Q.cells,function(S){var T=h(S,"rowspan");if(T>1){s(S,"rowspan",T-1);R=F(S);u(R.x,R.y,1,1)}});R=F(Q.cells[0]);d(f[R.y],function(S){var T;S=S.elm;if(S!=O){T=h(S,"rowspan");if(T<=1){G.remove(S)}else{s(S,"rowspan",T-1)}O=S}})}N=k();d(N.reverse(),function(O){M(O)});q()}function E(){var M=k();G.remove(M);q();return M}function J(){var M=k();d(M,function(O,N){M[N]=A(O,true)});return M}function B(O,N){var P=k(),M=P[N?0:P.length-1],Q=M.cells.length;d(f,function(S){var R;Q=0;d(S,function(U,T){if(U.real){Q+=U.colspan}if(U.elm.parentNode==M){R=1}});if(R){return false}});if(!N){O.reverse()}d(O,function(T){var S=T.cells.length,R;for(i=0;i<S;i++){R=T.cells[i];s(R,"colspan",1);s(R,"rowspan",1)}for(i=S;i<Q;i++){T.appendChild(e(T.cells[S-1]))}for(i=Q;i<S;i++){G.remove(T.cells[i])}if(N){M.parentNode.insertBefore(T,M)}else{G.insertAfter(T,M)}})}function F(M){var N;d(f,function(O,P){d(O,function(R,Q){if(R.elm==M){N={x:Q,y:P};return false}});return !N});return N}function w(M){L=F(M)}function I(){var O,N,M;N=M=0;d(f,function(P,Q){d(P,function(S,R){var U,T;if(j(S)){S=f[Q][R];if(R>N){N=R}if(Q>M){M=Q}if(S.real){U=S.colspan-1;T=S.rowspan-1;if(U){if(R+U>N){N=R+U}}if(T){if(Q+T>M){M=Q+T}}}}})});return{x:N,y:M}}function v(S){var P,O,U,T,N,M,Q,R;D=F(S);if(L&&D){P=Math.min(L.x,D.x);O=Math.min(L.y,D.y);U=Math.max(L.x,D.x);T=Math.max(L.y,D.y);N=U;M=T;for(y=O;y<=M;y++){S=f[y][P];if(!S.real){if(P-(S.colspan-1)<P){P-=S.colspan-1}}}for(x=P;x<=N;x++){S=f[O][x];if(!S.real){if(O-(S.rowspan-1)<O){O-=S.rowspan-1}}}for(y=O;y<=T;y++){for(x=P;x<=U;x++){S=f[y][x];if(S.real){Q=S.colspan-1;R=S.rowspan-1;if(Q){if(x+Q>N){N=x+Q}}if(R){if(y+R>M){M=y+R}}}}}G.removeClass(G.select("td.mceSelected,th.mceSelected"),"mceSelected");for(y=O;y<=M;y++){for(x=P;x<=N;x++){if(f[y][x]){G.addClass(f[y][x].elm,"mceSelected")}}}}}c.extend(this,{deleteTable:r,split:C,merge:p,insertRow:l,insertCol:g,deleteCols:n,deleteRows:m,cutRows:E,copyRows:J,pasteRows:B,getPos:F,setStartCell:w,setEndCell:v})}c.create("tinymce.plugins.TablePlugin",{init:function(f,g){var e,k;function j(n){var m=f.selection,l=f.dom.getParent(n||m.getNode(),"table");if(l){return new a(l,f.dom,m)}}function h(){f.getBody().style.webkitUserSelect="";f.dom.removeClass(f.dom.select("td.mceSelected,th.mceSelected"),"mceSelected")}d([["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(l){f.addButton(l[0],{title:l[1],cmd:l[2],ui:l[3]})});if(!c.isIE){f.onClick.add(function(l,m){m=m.target;if(m.nodeName==="TABLE"){l.selection.select(m);l.nodeChanged()}})}f.onPreProcess.add(function(m,n){var l,o,p,r=m.dom,q;l=r.select("table",n.node);o=l.length;while(o--){p=l[o];r.setAttrib(p,"data-mce-style","");if((q=r.getAttrib(p,"width"))){r.setStyle(p,"width",q);r.setAttrib(p,"width","")}if((q=r.getAttrib(p,"height"))){r.setStyle(p,"height",q);r.setAttrib(p,"height","")}}});f.onNodeChange.add(function(m,l,q){var o;q=m.selection.getStart();o=m.dom.getParent(q,"td,th,caption");l.setActive("table",q.nodeName==="TABLE"||!!o);if(o&&o.nodeName==="CAPTION"){o=0}l.setDisabled("delete_table",!o);l.setDisabled("delete_col",!o);l.setDisabled("delete_table",!o);l.setDisabled("delete_row",!o);l.setDisabled("col_after",!o);l.setDisabled("col_before",!o);l.setDisabled("row_after",!o);l.setDisabled("row_before",!o);l.setDisabled("row_props",!o);l.setDisabled("cell_props",!o);l.setDisabled("split_cells",!o);l.setDisabled("merge_cells",!o)});f.onInit.add(function(m){var l,p,q=m.dom,n;e=m.windowManager;m.onMouseDown.add(function(r,s){if(s.button!=2){h();p=q.getParent(s.target,"td,th");l=q.getParent(p,"table")}});q.bind(m.getDoc(),"mouseover",function(u){var s,r,t=u.target;if(p&&(n||t!=p)&&(t.nodeName=="TD"||t.nodeName=="TH")){r=q.getParent(t,"table");if(r==l){if(!n){n=j(r);n.setStartCell(p);m.getBody().style.webkitUserSelect="none"}n.setEndCell(t)}s=m.selection.getSel();if(s.removeAllRanges){s.removeAllRanges()}else{s.empty()}u.preventDefault()}});m.onMouseUp.add(function(A,B){var s,u=A.selection,C,D=u.getSel(),r,v,t,z;if(p){if(n){A.getBody().style.webkitUserSelect=""}function w(E,G){var F=new c.dom.TreeWalker(E,E);do{if(E.nodeType==3&&c.trim(E.nodeValue).length!=0){if(G){s.setStart(E,0)}else{s.setEnd(E,E.nodeValue.length)}return}if(E.nodeName=="BR"){if(G){s.setStartBefore(E)}else{s.setEndBefore(E)}return}}while(E=(G?F.next():F.prev()))}C=q.select("td.mceSelected,th.mceSelected");if(C.length>0){s=q.createRng();v=C[0];z=C[C.length-1];w(v,1);r=new c.dom.TreeWalker(v,q.getParent(C[0],"table"));do{if(v.nodeName=="TD"||v.nodeName=="TH"){if(!q.hasClass(v,"mceSelected")){break}t=v}}while(v=r.next());w(t);u.setRng(s)}A.nodeChanged();p=n=l=null}});m.onKeyUp.add(function(r,s){h()});if(m&&m.plugins.contextmenu){m.plugins.contextmenu.onContextMenu.add(function(t,r,v){var w,u=m.selection,s=u.getNode()||m.getBody();if(m.dom.getParent(v,"td")||m.dom.getParent(v,"th")||m.dom.select("td.mceSelected,th.mceSelected").length){r.removeAll();if(s.nodeName=="A"&&!m.dom.getAttrib(s,"name")){r.add({title:"advanced.link_desc",icon:"link",cmd:m.plugins.advlink?"mceAdvLink":"mceLink",ui:true});r.add({title:"advanced.unlink_desc",icon:"unlink",cmd:"UnLink"});r.addSeparator()}if(s.nodeName=="IMG"&&s.className.indexOf("mceItem")==-1){r.add({title:"advanced.image_desc",icon:"image",cmd:m.plugins.advimage?"mceAdvImage":"mceImage",ui:true});r.addSeparator()}r.add({title:"table.desc",icon:"table",cmd:"mceInsertTable",value:{action:"insert"}});r.add({title:"table.props_desc",icon:"table_props",cmd:"mceInsertTable"});r.add({title:"table.del",icon:"delete_table",cmd:"mceTableDelete"});r.addSeparator();w=r.addMenu({title:"table.cell"});w.add({title:"table.cell_desc",icon:"cell_props",cmd:"mceTableCellProps"});w.add({title:"table.split_cells_desc",icon:"split_cells",cmd:"mceTableSplitCells"});w.add({title:"table.merge_cells_desc",icon:"merge_cells",cmd:"mceTableMergeCells"});w=r.addMenu({title:"table.row"});w.add({title:"table.row_desc",icon:"row_props",cmd:"mceTableRowProps"});w.add({title:"table.row_before_desc",icon:"row_before",cmd:"mceTableInsertRowBefore"});w.add({title:"table.row_after_desc",icon:"row_after",cmd:"mceTableInsertRowAfter"});w.add({title:"table.delete_row_desc",icon:"delete_row",cmd:"mceTableDeleteRow"});w.addSeparator();w.add({title:"table.cut_row_desc",icon:"cut",cmd:"mceTableCutRow"});w.add({title:"table.copy_row_desc",icon:"copy",cmd:"mceTableCopyRow"});w.add({title:"table.paste_row_before_desc",icon:"paste",cmd:"mceTablePasteRowBefore"}).setDisabled(!k);w.add({title:"table.paste_row_after_desc",icon:"paste",cmd:"mceTablePasteRowAfter"}).setDisabled(!k);w=r.addMenu({title:"table.col"});w.add({title:"table.col_before_desc",icon:"col_before",cmd:"mceTableInsertColBefore"});w.add({title:"table.col_after_desc",icon:"col_after",cmd:"mceTableInsertColAfter"});w.add({title:"table.delete_col_desc",icon:"delete_col",cmd:"mceTableDeleteCol"})}else{r.add({title:"table.desc",icon:"table",cmd:"mceInsertTable"})}})}if(!c.isIE){function o(){var r;for(r=m.getBody().lastChild;r&&r.nodeType==3&&!r.nodeValue.length;r=r.previousSibling){}if(r&&r.nodeName=="TABLE"){m.dom.add(m.getBody(),"p",null,'<br mce_bogus="1" />')}}if(c.isGecko){m.onKeyDown.add(function(s,u){var r,t,v=s.dom;if(u.keyCode==37||u.keyCode==38){r=s.selection.getRng();t=v.getParent(r.startContainer,"table");if(t&&s.getBody().firstChild==t){if(b(r,t)){r=v.createRng();r.setStartBefore(t);r.setEndBefore(t);s.selection.setRng(r);u.preventDefault()}}}})}m.onKeyUp.add(o);m.onSetContent.add(o);m.onVisualAid.add(o);m.onPreProcess.add(function(r,t){var s=t.node.lastChild;if(s&&s.childNodes.length==1&&s.firstChild.nodeName=="BR"){r.dom.remove(s)}});o()}});d({mceTableSplitCells:function(l){l.split()},mceTableMergeCells:function(m){var n,o,l;l=f.dom.getParent(f.selection.getNode(),"th,td");if(l){n=l.rowSpan;o=l.colSpan}if(!f.dom.select("td.mceSelected,th.mceSelected").length){e.open({url:g+"/merge_cells.htm",width:240+parseInt(f.getLang("table.merge_cells_delta_width",0)),height:110+parseInt(f.getLang("table.merge_cells_delta_height",0)),inline:1},{rows:n,cols:o,onaction:function(p){m.merge(l,p.cols,p.rows)},plugin_url:g})}else{m.merge()}},mceTableInsertRowBefore:function(l){l.insertRow(true)},mceTableInsertRowAfter:function(l){l.insertRow()},mceTableInsertColBefore:function(l){l.insertCol(true)},mceTableInsertColAfter:function(l){l.insertCol()},mceTableDeleteCol:function(l){l.deleteCols()},mceTableDeleteRow:function(l){l.deleteRows()},mceTableCutRow:function(l){k=l.cutRows()},mceTableCopyRow:function(l){k=l.copyRows()},mceTablePasteRowBefore:function(l){l.pasteRows(k,true)},mceTablePasteRowAfter:function(l){l.pasteRows(k)},mceTableDelete:function(l){l.deleteTable()}},function(m,l){f.addCommand(l,function(){var n=j();if(n){m(n);f.execCommand("mceRepaint");h()}})});d({mceInsertTable:function(l){e.open({url:g+"/table.htm",width:400+parseInt(f.getLang("table.table_delta_width",0)),height:320+parseInt(f.getLang("table.table_delta_height",0)),inline:1},{plugin_url:g,action:l?l.action:0})},mceTableRowProps:function(){e.open({url:g+"/row.htm",width:400+parseInt(f.getLang("table.rowprops_delta_width",0)),height:295+parseInt(f.getLang("table.rowprops_delta_height",0)),inline:1},{plugin_url:g})},mceTableCellProps:function(){e.open({url:g+"/cell.htm",width:400+parseInt(f.getLang("table.cellprops_delta_width",0)),height:295+parseInt(f.getLang("table.cellprops_delta_height",0)),inline:1},{plugin_url:g})}},function(m,l){f.addCommand(l,function(n,o){m(o)})})}});c.PluginManager.add("table",c.plugins.TablePlugin)})(tinymce);
\ No newline at end of file
diff -x .svn -aruN 0.7.24.src/e107_handlers/tiny_mce/plugins/table/editor_plugin_src.js 0.7.26.src/e107_handlers/tiny_mce/plugins/table/editor_plugin_src.js
--- 0.7.24.src/e107_handlers/tiny_mce/plugins/table/editor_plugin_src.js	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_handlers/tiny_mce/plugins/table/editor_plugin_src.js	2011-03-30 03:22:40.000000000 -0500
@@ -1,1202 +1,1198 @@
-/**
- * $Id: editor_plugin_src.js 11346 2010-02-17 18:56:14Z secretr $
- *
- * @author Moxiecode
- * @copyright Copyright  2004-2008, Moxiecode Systems AB, All rights reserved.
- */
-
-(function() {
-	var each = tinymce.each;
-
-	// Checks if the selection/caret is at the start of the specified block element
-	function isAtStart(rng, par) {
-		var doc = par.ownerDocument, rng2 = doc.createRange(), elm;
-
-		rng2.setStartBefore(par);
-		rng2.setEnd(rng.endContainer, rng.endOffset);
-
-		elm = doc.createElement('body');
-		elm.appendChild(rng2.cloneContents());
-
-		// Check for text characters of other elements that should be treated as content
-		return elm.innerHTML.replace(/<(br|img|object|embed|input|textarea)[^>]*>/gi, '-').replace(/<[^>]+>/g, '').length == 0;
-	};
-
-	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');
-						}
-
-						if (v = dom.getAttrib(n, 'height')) {
-							dom.setStyle(n, 'height', v);
-							dom.setAttrib(n, 'height');
-						}
-					});
-				});
-			}
-
-			ed.onInit.add(function() {
-				// Fixes an issue on Gecko where it's impossible to place the caret behind a table
-				// This fix will force a paragraph element after the table but only when the forced_root_block setting is enabled
-				if (!tinymce.isIE && ed.getParam('forced_root_block')) {
-					function fixTableCaretPos() {
-						var last = ed.getBody().lastChild;
-
-						if (last && last.nodeName == 'TABLE')
-							ed.dom.add(ed.getBody(), 'p', null, '<br mce_bogus="1" />');
-					};
-
-					// Fixes an bug where it's impossible to place the caret before a table in Gecko
-					// this fix solves it by detecting when the caret is at the beginning of such a table
-					// and then manually moves the caret infront of the table
-					if (tinymce.isGecko) {
-						ed.onKeyDown.add(function(ed, e) {
-							var rng, table, dom = ed.dom;
-
-							// On gecko it's not possible to place the caret before a table
-							if (e.keyCode == 37 || e.keyCode == 38) {
-								rng = ed.selection.getRng();
-								table = dom.getParent(rng.startContainer, 'table');
-
-								if (table && ed.getBody().firstChild == table) {
-									if (isAtStart(rng, table)) {
-										rng = dom.createRng();
-
-										rng.setStartBefore(table);
-										rng.setEndBefore(table);
-
-										ed.selection.setRng(rng);
-
-										e.preventDefault();
-									}
-								}
-							}
-						});
-					}
-
-					ed.onKeyUp.add(fixTableCaretPos);
-					ed.onSetContent.add(fixTableCaretPos);
-					ed.onVisualAid.add(fixTableCaretPos);
-
-					ed.onPreProcess.add(function(ed, o) {
-						var last = o.node.lastChild;
-
-						if (last && last.childNodes.length == 1 && last.firstChild.nodeName == 'BR')
-							ed.dom.remove(last);
-					});
-
-					fixTableCaretPos();
-				}
-
-				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 (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();
-							}
-
-							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});
-					});
-				}
-			});
-
-			// 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);
-					}
-
-					ed.undoManager.add();
-				}
-			});
-
-			// 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);
-					});
-				}
-			}
-
-			ed.onNodeChange.add(function(ed, cm, n) {
-				var p = ed.dom.getParent(n, 'td,th,caption');
-
-				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>');
-				});
-			}
-		},
-
-		execCommand : function(cmd, ui, val) {
-			var ed = this.editor, b;
-
-			// 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');
-
-					return true;
-			}
-
-			// Pass to next handler in chain
-			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
-			};
-		},
-
-		// 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;
-				}
-
-				return false;
-			}
-
-			function select(dx, dy) {
-				var td;
-
-				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);
-				}
-			};
-
-			function makeTD() {
-				var newTD = doc.createElement("td");
-
-				if (!tinymce.isIE)
-					newTD.innerHTML = '<br mce_bogus="1"/>';
-			}
-
-			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);
-
-				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 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 = [], 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] = [];
-
-							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;
-
-				// 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;
-					}
-
-					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");
-
-					// 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 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]);
-
-					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 = 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;
-							}
-						}
-					}
-
-					if (newTD == null) {
-						newTD = doc.createElement("td");
-
-						if (!tinymce.isIE)
-							newTD.innerHTML = '<br mce_bogus="1"/>';
-					}
-
-					// Reset col/row span
-					newTD.colSpan = 1;
-					newTD.rowSpan = 1;
-
-					newTR.appendChild(newTD);
-
-					lastCell = tdElm;
-				}
-
-				return newTR;
-			}
-
-			// ---- Commands -----
-
-			// Handle commands
-			switch (command) {
-				case "mceTableMoveToNextRow":
-					var nextCell = getNextCell(tableElm, tdElm);
-
-					if (!nextCell) {
-						inst.execCommand("mceTableInsertRowAfter", tdElm);
-						nextCell = getNextCell(tableElm, tdElm);
-					}
-
-					inst.selection.select(nextCell);
-					inst.selection.collapse(true);
-
-					return true;
-
-				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
-						});
-					}
-
-					return true;
-
-				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;
-
-				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
-						});
-					}
-
-					return true;
-
-				case "mceTableDelete":
-					var table = inst.dom.getParent(inst.selection.getNode(), "table");
-					if (table) {
-						table.parentNode.removeChild(table);
-						inst.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":
-					// 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;
-
-								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;
-
-								// 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");
-
-											if (!tinymce.isIE)
-												newTD.innerHTML = '<br mce_bogus="1"/>';
-
-											newTD.colSpan = tdElm.colSpan;
-
-											newTR.appendChild(newTD);
-										} else
-											tdElm.rowSpan = sd['rowspan'] + 1;
-
-										lastTDElm = tdElm;
-									}
-								}
-
-								trElm.parentNode.insertBefore(newTR, trElm);
-								select(0, 1);
-							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;
-
-								// 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");
-
-											if (!tinymce.isIE)
-												newTD.innerHTML = '<br mce_bogus="1"/>';
-
-											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);
-								}
-
-								select(0, 1);
-							break;
-
-							case "mceTableDeleteRow":
-								if (!trElm || !tdElm)
-									return true;
-
-								var grid = getTableGrid(tableElm);
-								var cpos = getCellPos(grid, tdElm);
-
-								// 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]);
-
-										newTD.rowSpan = sd.rowspan - 1;
-
-										var nextTD = nextTR.cells[x];
-
-										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;
-
-											if (trElm.parentNode)
-												trElm._delete = true;
-										}
-
-										lastTDElm = tdElm;
-									}
-								}
-
-								deleteMarked(tableElm);
-
-								select(0, -1);
-							break;
-
-							case "mceTableInsertColBefore":
-								if (!trElm || !tdElm)
-									return true;
-
-								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);
-
-										if (sd['colspan'] == 1) {
-											var newTD = doc.createElement(tdElm.nodeName);
-
-											if (!tinymce.isIE)
-												newTD.innerHTML = '<br mce_bogus="1"/>';
-
-											newTD.rowSpan = tdElm.rowSpan;
-
-											tdElm.parentNode.insertBefore(newTD, tdElm);
-										} else
-											tdElm.colSpan++;
-
-										lastTDElm = tdElm;
-									}
-								}
-
-								select();
-							break;
-
-							case "mceTableInsertColAfter":
-								if (!trElm || !tdElm)
-									return true;
-
-								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);
-
-										if (sd['colspan'] == 1) {
-											var newTD = doc.createElement(tdElm.nodeName);
-
-											if (!tinymce.isIE)
-												newTD.innerHTML = '<br mce_bogus="1"/>';
-
-											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;
-									}
-								}
-
-								select(1);
-							break;
-
-							case "mceTableDeleteCol":
-								if (!trElm || !tdElm)
-									return true;
-
-								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.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);
-										}
-
-										lastTDElm = tdElm;
-									}
-								}
-
-								select(-1);
-							break;
-
-						case "mceTableSplitCells":
-							if (!trElm || !tdElm)
-								return true;
-
-							var spandata = getColRowSpan(tdElm);
-
-							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");
-
-									if (!tinymce.isIE)
-										newTD.innerHTML = '<br mce_bogus="1"/>';
-
-									trElm.insertBefore(newTD, nextElm(tdElm, "TD,TH"));
-
-									if (rowspan > 1)
-										addRows(newTD, trElm, rowspan);
-								}
-
-								addRows(tdElm, trElm, rowspan);
-							}
-
-							// Apply visual aids
-							tableElm = inst.dom.getParent(inst.selection.getNode(), "table");
-							break;
-
-						case "mceTableMergeCells":
-							var rows = [];
-							var sel = inst.selection.getSel();
-							var grid = getTableGrid(tableElm);
-
-							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;
-								} 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 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;
-
-								// 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;
-
-									if (tdElm.nodeName == "TD" || tdElm.nodeName == "TH")
-										cells[cells.length] = tdElm;
-								}
-
-								// Get rows and cells
-								var tRows = tableElm.rows;
-								for (var y=0; y<tRows.length; y++) {
-									var rowCells = [];
-
-									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;
-								}
-
-								// 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;
-
-												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;
-										}
-									}
-								}
-							}
-
-							// 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;
-
-								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;
-							}
-
-							// 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]);
-
-									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;
-							}
-
-							// 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 = 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--;
-
-												lastCell = cellElm;
-											}
-
-											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;
-						}
-
-						tableElm = inst.dom.getParent(inst.selection.getNode(), "table");
-						inst.addVisual(tableElm);
-						inst.nodeChanged();
-					}
-
-				return true;
-			}
-
-			// Pass to next handler in chain
-			return false;
-		}
-	});
-
-	// Register plugin
-	tinymce.PluginManager.add('table', tinymce.plugins.TablePlugin);
-})();
\ No newline at end of file
+/**
+ * editor_plugin_src.js
+ *
+ * Copyright 2009, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://tinymce.moxiecode.com/license
+ * Contributing: http://tinymce.moxiecode.com/contributing
+ */
+
+(function(tinymce) {
+	var each = tinymce.each;
+
+	// Checks if the selection/caret is at the start of the specified block element
+	function isAtStart(rng, par) {
+		var doc = par.ownerDocument, rng2 = doc.createRange(), elm;
+
+		rng2.setStartBefore(par);
+		rng2.setEnd(rng.endContainer, rng.endOffset);
+
+		elm = doc.createElement('body');
+		elm.appendChild(rng2.cloneContents());
+
+		// Check for text characters of other elements that should be treated as content
+		return elm.innerHTML.replace(/<(br|img|object|embed|input|textarea)[^>]*>/gi, '-').replace(/<[^>]+>/g, '').length == 0;
+	};
+
+	/**
+	 * Table Grid class.
+	 */
+	function TableGrid(table, dom, selection) {
+		var grid, startPos, endPos, selectedCell;
+
+		buildGrid();
+		selectedCell = dom.getParent(selection.getStart(), 'th,td');
+		if (selectedCell) {
+			startPos = getPos(selectedCell);
+			endPos = findEndPos();
+			selectedCell = getCell(startPos.x, startPos.y);
+		}
+
+		function cloneNode(node, children) {
+			node = node.cloneNode(children);
+			node.removeAttribute('id');
+
+			return node;
+		}
+
+		function buildGrid() {
+			var startY = 0;
+
+			grid = [];
+
+			each(['thead', 'tbody', 'tfoot'], function(part) {
+				var rows = dom.select('> ' + part + ' tr', table);
+
+				each(rows, function(tr, y) {
+					y += startY;
+
+					each(dom.select('> td, > th', tr), function(td, x) {
+						var x2, y2, rowspan, colspan;
+
+						// Skip over existing cells produced by rowspan
+						if (grid[y]) {
+							while (grid[y][x])
+								x++;
+						}
+
+						// Get col/rowspan from cell
+						rowspan = getSpanVal(td, 'rowspan');
+						colspan = getSpanVal(td, 'colspan');
+
+						// Fill out rowspan/colspan right and down
+						for (y2 = y; y2 < y + rowspan; y2++) {
+							if (!grid[y2])
+								grid[y2] = [];
+
+							for (x2 = x; x2 < x + colspan; x2++) {
+								grid[y2][x2] = {
+									part : part,
+									real : y2 == y && x2 == x,
+									elm : td,
+									rowspan : rowspan,
+									colspan : colspan
+								};
+							}
+						}
+					});
+				});
+
+				startY += rows.length;
+			});
+		};
+
+		function getCell(x, y) {
+			var row;
+
+			row = grid[y];
+			if (row)
+				return row[x];
+		};
+
+		function getSpanVal(td, name) {
+			return parseInt(td.getAttribute(name) || 1);
+		};
+
+		function setSpanVal(td, name, val) {
+			if (td) {
+				val = parseInt(val);
+
+				if (val === 1)
+					td.removeAttribute(name, 1);
+				else
+					td.setAttribute(name, val, 1);
+			}
+		}
+
+		function isCellSelected(cell) {
+			return cell && (dom.hasClass(cell.elm, 'mceSelected') || cell == selectedCell);
+		};
+
+		function getSelectedRows() {
+			var rows = [];
+
+			each(table.rows, function(row) {
+				each(row.cells, function(cell) {
+					if (dom.hasClass(cell, 'mceSelected') || cell == selectedCell.elm) {
+						rows.push(row);
+						return false;
+					}
+				});
+			});
+
+			return rows;
+		};
+
+		function deleteTable() {
+			var rng = dom.createRng();
+
+			rng.setStartAfter(table);
+			rng.setEndAfter(table);
+
+			selection.setRng(rng);
+
+			dom.remove(table);
+		};
+
+		function cloneCell(cell) {
+			var formatNode;
+
+			// Clone formats
+			tinymce.walk(cell, function(node) {
+				var curNode;
+
+				if (node.nodeType == 3) {
+					each(dom.getParents(node.parentNode, null, cell).reverse(), function(node) {
+						node = cloneNode(node, false);
+
+						if (!formatNode)
+							formatNode = curNode = node;
+						else if (curNode)
+							curNode.appendChild(node);
+
+						curNode = node;
+					});
+
+					// Add something to the inner node
+					if (curNode)
+						curNode.innerHTML = tinymce.isIE ? '&nbsp;' : '<br data-mce-bogus="1" />';
+
+					return false;
+				}
+			}, 'childNodes');
+
+			cell = cloneNode(cell, false);
+			setSpanVal(cell, 'rowspan', 1);
+			setSpanVal(cell, 'colspan', 1);
+
+			if (formatNode) {
+				cell.appendChild(formatNode);
+			} else {
+				if (!tinymce.isIE)
+					cell.innerHTML = '<br data-mce-bogus="1" />';
+			}
+
+			return cell;
+		};
+
+		function cleanup() {
+			var rng = dom.createRng();
+
+			// Empty rows
+			each(dom.select('tr', table), function(tr) {
+				if (tr.cells.length == 0)
+					dom.remove(tr);
+			});
+
+			// Empty table
+			if (dom.select('tr', table).length == 0) {
+				rng.setStartAfter(table);
+				rng.setEndAfter(table);
+				selection.setRng(rng);
+				dom.remove(table);
+				return;
+			}
+
+			// Empty header/body/footer
+			each(dom.select('thead,tbody,tfoot', table), function(part) {
+				if (part.rows.length == 0)
+					dom.remove(part);
+			});
+
+			// Restore selection to start position if it still exists
+			buildGrid();
+
+			// Restore the selection to the closest table position
+			row = grid[Math.min(grid.length - 1, startPos.y)];
+			if (row) {
+				selection.select(row[Math.min(row.length - 1, startPos.x)].elm, true);
+				selection.collapse(true);
+			}
+		};
+
+		function fillLeftDown(x, y, rows, cols) {
+			var tr, x2, r, c, cell;
+
+			tr = grid[y][x].elm.parentNode;
+			for (r = 1; r <= rows; r++) {
+				tr = dom.getNext(tr, 'tr');
+
+				if (tr) {
+					// Loop left to find real cell
+					for (x2 = x; x2 >= 0; x2--) {
+						cell = grid[y + r][x2].elm;
+
+						if (cell.parentNode == tr) {
+							// Append clones after
+							for (c = 1; c <= cols; c++)
+								dom.insertAfter(cloneCell(cell), cell);
+
+							break;
+						}
+					}
+
+					if (x2 == -1) {
+						// Insert nodes before first cell
+						for (c = 1; c <= cols; c++)
+							tr.insertBefore(cloneCell(tr.cells[0]), tr.cells[0]);
+					}
+				}
+			}
+		};
+
+		function split() {
+			each(grid, function(row, y) {
+				each(row, function(cell, x) {
+					var colSpan, rowSpan, newCell, i;
+
+					if (isCellSelected(cell)) {
+						cell = cell.elm;
+						colSpan = getSpanVal(cell, 'colspan');
+						rowSpan = getSpanVal(cell, 'rowspan');
+
+						if (colSpan > 1 || rowSpan > 1) {
+							setSpanVal(cell, 'rowspan', 1);
+							setSpanVal(cell, 'colspan', 1);
+
+							// Insert cells right
+							for (i = 0; i < colSpan - 1; i++)
+								dom.insertAfter(cloneCell(cell), cell);
+
+							fillLeftDown(x, y, rowSpan - 1, colSpan);
+						}
+					}
+				});
+			});
+		};
+
+		function merge(cell, cols, rows) {
+			var startX, startY, endX, endY, x, y, startCell, endCell, cell, children, count;
+
+			// Use specified cell and cols/rows
+			if (cell) {
+				pos = getPos(cell);
+				startX = pos.x;
+				startY = pos.y;
+				endX = startX + (cols - 1);
+				endY = startY + (rows - 1);
+			} else {
+				// Use selection
+				startX = startPos.x;
+				startY = startPos.y;
+				endX = endPos.x;
+				endY = endPos.y;
+			}
+
+			// Find start/end cells
+			startCell = getCell(startX, startY);
+			endCell = getCell(endX, endY);
+
+			// Check if the cells exists and if they are of the same part for example tbody = tbody
+			if (startCell && endCell && startCell.part == endCell.part) {
+				// Split and rebuild grid
+				split();
+				buildGrid();
+
+				// Set row/col span to start cell
+				startCell = getCell(startX, startY).elm;
+				setSpanVal(startCell, 'colspan', (endX - startX) + 1);
+				setSpanVal(startCell, 'rowspan', (endY - startY) + 1);
+
+				// Remove other cells and add it's contents to the start cell
+				for (y = startY; y <= endY; y++) {
+					for (x = startX; x <= endX; x++) {
+						if (!grid[y] || !grid[y][x])
+							continue;
+
+						cell = grid[y][x].elm;
+
+						if (cell != startCell) {
+							// Move children to startCell
+							children = tinymce.grep(cell.childNodes);
+							each(children, function(node) {
+								startCell.appendChild(node);
+							});
+
+							// Remove bogus nodes if there is children in the target cell
+							if (children.length) {
+								children = tinymce.grep(startCell.childNodes);
+								count = 0;
+								each(children, function(node) {
+									if (node.nodeName == 'BR' && dom.getAttrib(node, 'data-mce-bogus') && count++ < children.length - 1)
+										startCell.removeChild(node);
+								});
+							}
+							
+							// Remove cell
+							dom.remove(cell);
+						}
+					}
+				}
+
+				// Remove empty rows etc and restore caret location
+				cleanup();
+			}
+		};
+
+		function insertRow(before) {
+			var posY, cell, lastCell, x, rowElm, newRow, newCell, otherCell, rowSpan;
+
+			// Find first/last row
+			each(grid, function(row, y) {
+				each(row, function(cell, x) {
+					if (isCellSelected(cell)) {
+						cell = cell.elm;
+						rowElm = cell.parentNode;
+						newRow = cloneNode(rowElm, false);
+						posY = y;
+
+						if (before)
+							return false;
+					}
+				});
+
+				if (before)
+					return !posY;
+			});
+
+			for (x = 0; x < grid[0].length; x++) {
+				// Cell not found could be because of an invalid table structure
+				if (!grid[posY][x])
+					continue;
+
+				cell = grid[posY][x].elm;
+
+				if (cell != lastCell) {
+					if (!before) {
+						rowSpan = getSpanVal(cell, 'rowspan');
+						if (rowSpan > 1) {
+							setSpanVal(cell, 'rowspan', rowSpan + 1);
+							continue;
+						}
+					} else {
+						// Check if cell above can be expanded
+						if (posY > 0 && grid[posY - 1][x]) {
+							otherCell = grid[posY - 1][x].elm;
+							rowSpan = getSpanVal(otherCell, 'rowspan');
+							if (rowSpan > 1) {
+								setSpanVal(otherCell, 'rowspan', rowSpan + 1);
+								continue;
+							}
+						}
+					}
+
+					// Insert new cell into new row
+					newCell = cloneCell(cell);
+					setSpanVal(newCell, 'colspan', cell.colSpan);
+
+					newRow.appendChild(newCell);
+
+					lastCell = cell;
+				}
+			}
+
+			if (newRow.hasChildNodes()) {
+				if (!before)
+					dom.insertAfter(newRow, rowElm);
+				else
+					rowElm.parentNode.insertBefore(newRow, rowElm);
+			}
+		};
+
+		function insertCol(before) {
+			var posX, lastCell;
+
+			// Find first/last column
+			each(grid, function(row, y) {
+				each(row, function(cell, x) {
+					if (isCellSelected(cell)) {
+						posX = x;
+
+						if (before)
+							return false;
+					}
+				});
+
+				if (before)
+					return !posX;
+			});
+
+			each(grid, function(row, y) {
+				var cell, rowSpan, colSpan;
+
+				if (!row[posX])
+					return;
+
+				cell = row[posX].elm;
+				if (cell != lastCell) {
+					colSpan = getSpanVal(cell, 'colspan');
+					rowSpan = getSpanVal(cell, 'rowspan');
+
+					if (colSpan == 1) {
+						if (!before) {
+							dom.insertAfter(cloneCell(cell), cell);
+							fillLeftDown(posX, y, rowSpan - 1, colSpan);
+						} else {
+							cell.parentNode.insertBefore(cloneCell(cell), cell);
+							fillLeftDown(posX, y, rowSpan - 1, colSpan);
+						}
+					} else
+						setSpanVal(cell, 'colspan', cell.colSpan + 1);
+
+					lastCell = cell;
+				}
+			});
+		};
+
+		function deleteCols() {
+			var cols = [];
+
+			// Get selected column indexes
+			each(grid, function(row, y) {
+				each(row, function(cell, x) {
+					if (isCellSelected(cell) && tinymce.inArray(cols, x) === -1) {
+						each(grid, function(row) {
+							var cell = row[x].elm, colSpan;
+
+							colSpan = getSpanVal(cell, 'colspan');
+
+							if (colSpan > 1)
+								setSpanVal(cell, 'colspan', colSpan - 1);
+							else
+								dom.remove(cell);
+						});
+
+						cols.push(x);
+					}
+				});
+			});
+
+			cleanup();
+		};
+
+		function deleteRows() {
+			var rows;
+
+			function deleteRow(tr) {
+				var nextTr, pos, lastCell;
+
+				nextTr = dom.getNext(tr, 'tr');
+
+				// Move down row spanned cells
+				each(tr.cells, function(cell) {
+					var rowSpan = getSpanVal(cell, 'rowspan');
+
+					if (rowSpan > 1) {
+						setSpanVal(cell, 'rowspan', rowSpan - 1);
+						pos = getPos(cell);
+						fillLeftDown(pos.x, pos.y, 1, 1);
+					}
+				});
+
+				// Delete cells
+				pos = getPos(tr.cells[0]);
+				each(grid[pos.y], function(cell) {
+					var rowSpan;
+
+					cell = cell.elm;
+
+					if (cell != lastCell) {
+						rowSpan = getSpanVal(cell, 'rowspan');
+
+						if (rowSpan <= 1)
+							dom.remove(cell);
+						else
+							setSpanVal(cell, 'rowspan', rowSpan - 1);
+
+						lastCell = cell;
+					}
+				});
+			};
+
+			// Get selected rows and move selection out of scope
+			rows = getSelectedRows();
+
+			// Delete all selected rows
+			each(rows.reverse(), function(tr) {
+				deleteRow(tr);
+			});
+
+			cleanup();
+		};
+
+		function cutRows() {
+			var rows = getSelectedRows();
+
+			dom.remove(rows);
+			cleanup();
+
+			return rows;
+		};
+
+		function copyRows() {
+			var rows = getSelectedRows();
+
+			each(rows, function(row, i) {
+				rows[i] = cloneNode(row, true);
+			});
+
+			return rows;
+		};
+
+		function pasteRows(rows, before) {
+			var selectedRows = getSelectedRows(),
+				targetRow = selectedRows[before ? 0 : selectedRows.length - 1],
+				targetCellCount = targetRow.cells.length;
+
+			// Calc target cell count
+			each(grid, function(row) {
+				var match;
+
+				targetCellCount = 0;
+				each(row, function(cell, x) {
+					if (cell.real)
+						targetCellCount += cell.colspan;
+
+					if (cell.elm.parentNode == targetRow)
+						match = 1;
+				});
+
+				if (match)
+					return false;
+			});
+
+			if (!before)
+				rows.reverse();
+
+			each(rows, function(row) {
+				var cellCount = row.cells.length, cell;
+
+				// Remove col/rowspans
+				for (i = 0; i < cellCount; i++) {
+					cell = row.cells[i];
+					setSpanVal(cell, 'colspan', 1);
+					setSpanVal(cell, 'rowspan', 1);
+				}
+
+				// Needs more cells
+				for (i = cellCount; i < targetCellCount; i++)
+					row.appendChild(cloneCell(row.cells[cellCount - 1]));
+
+				// Needs less cells
+				for (i = targetCellCount; i < cellCount; i++)
+					dom.remove(row.cells[i]);
+
+				// Add before/after
+				if (before)
+					targetRow.parentNode.insertBefore(row, targetRow);
+				else
+					dom.insertAfter(row, targetRow);
+			});
+		};
+
+		function getPos(target) {
+			var pos;
+
+			each(grid, function(row, y) {
+				each(row, function(cell, x) {
+					if (cell.elm == target) {
+						pos = {x : x, y : y};
+						return false;
+					}
+				});
+
+				return !pos;
+			});
+
+			return pos;
+		};
+
+		function setStartCell(cell) {
+			startPos = getPos(cell);
+		};
+
+		function findEndPos() {
+			var pos, maxX, maxY;
+
+			maxX = maxY = 0;
+
+			each(grid, function(row, y) {
+				each(row, function(cell, x) {
+					var colSpan, rowSpan;
+
+					if (isCellSelected(cell)) {
+						cell = grid[y][x];
+
+						if (x > maxX)
+							maxX = x;
+
+						if (y > maxY)
+							maxY = y;
+
+						if (cell.real) {
+							colSpan = cell.colspan - 1;
+							rowSpan = cell.rowspan - 1;
+
+							if (colSpan) {
+								if (x + colSpan > maxX)
+									maxX = x + colSpan;
+							}
+
+							if (rowSpan) {
+								if (y + rowSpan > maxY)
+									maxY = y + rowSpan;
+							}
+						}
+					}
+				});
+			});
+
+			return {x : maxX, y : maxY};
+		};
+
+		function setEndCell(cell) {
+			var startX, startY, endX, endY, maxX, maxY, colSpan, rowSpan;
+
+			endPos = getPos(cell);
+
+			if (startPos && endPos) {
+				// Get start/end positions
+				startX = Math.min(startPos.x, endPos.x);
+				startY = Math.min(startPos.y, endPos.y);
+				endX = Math.max(startPos.x, endPos.x);
+				endY = Math.max(startPos.y, endPos.y);
+
+				// Expand end positon to include spans
+				maxX = endX;
+				maxY = endY;
+
+				// Expand startX
+				for (y = startY; y <= maxY; y++) {
+					cell = grid[y][startX];
+
+					if (!cell.real) {
+						if (startX - (cell.colspan - 1) < startX)
+							startX -= cell.colspan - 1;
+					}
+				}
+
+				// Expand startY
+				for (x = startX; x <= maxX; x++) {
+					cell = grid[startY][x];
+
+					if (!cell.real) {
+						if (startY - (cell.rowspan - 1) < startY)
+							startY -= cell.rowspan - 1;
+					}
+				}
+
+				// Find max X, Y
+				for (y = startY; y <= endY; y++) {
+					for (x = startX; x <= endX; x++) {
+						cell = grid[y][x];
+
+						if (cell.real) {
+							colSpan = cell.colspan - 1;
+							rowSpan = cell.rowspan - 1;
+
+							if (colSpan) {
+								if (x + colSpan > maxX)
+									maxX = x + colSpan;
+							}
+
+							if (rowSpan) {
+								if (y + rowSpan > maxY)
+									maxY = y + rowSpan;
+							}
+						}
+					}
+				}
+
+				// Remove current selection
+				dom.removeClass(dom.select('td.mceSelected,th.mceSelected'), 'mceSelected');
+
+				// Add new selection
+				for (y = startY; y <= maxY; y++) {
+					for (x = startX; x <= maxX; x++) {
+						if (grid[y][x])
+							dom.addClass(grid[y][x].elm, 'mceSelected');
+					}
+				}
+			}
+		};
+
+		// Expose to public
+		tinymce.extend(this, {
+			deleteTable : deleteTable,
+			split : split,
+			merge : merge,
+			insertRow : insertRow,
+			insertCol : insertCol,
+			deleteCols : deleteCols,
+			deleteRows : deleteRows,
+			cutRows : cutRows,
+			copyRows : copyRows,
+			pasteRows : pasteRows,
+			getPos : getPos,
+			setStartCell : setStartCell,
+			setEndCell : setEndCell
+		});
+	};
+
+	tinymce.create('tinymce.plugins.TablePlugin', {
+		init : function(ed, url) {
+			var winMan, clipboardRows;
+
+			function createTableGrid(node) {
+				var selection = ed.selection, tblElm = ed.dom.getParent(node || selection.getNode(), 'table');
+
+				if (tblElm)
+					return new TableGrid(tblElm, ed.dom, selection);
+			};
+
+			function cleanup() {
+				// Restore selection possibilities
+				ed.getBody().style.webkitUserSelect = '';
+				ed.dom.removeClass(ed.dom.select('td.mceSelected,th.mceSelected'), 'mceSelected');
+			};
+
+			// 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]});
+			});
+
+			// Select whole table is a table border is clicked
+			if (!tinymce.isIE) {
+				ed.onClick.add(function(ed, e) {
+					e = e.target;
+
+					if (e.nodeName === 'TABLE') {
+						ed.selection.select(e);
+						ed.nodeChanged();
+					}
+				});
+			}
+
+			ed.onPreProcess.add(function(ed, args) {
+				var nodes, i, node, dom = ed.dom, value;
+
+				nodes = dom.select('table', args.node);
+				i = nodes.length;
+				while (i--) {
+					node = nodes[i];
+					dom.setAttrib(node, 'data-mce-style', '');
+
+					if ((value = dom.getAttrib(node, 'width'))) {
+						dom.setStyle(node, 'width', value);
+						dom.setAttrib(node, 'width', '');
+					}
+
+					if ((value = dom.getAttrib(node, 'height'))) {
+						dom.setStyle(node, 'height', value);
+						dom.setAttrib(node, 'height', '');
+					}
+				}
+			});
+
+			// Handle node change updates
+			ed.onNodeChange.add(function(ed, cm, n) {
+				var p;
+
+				n = ed.selection.getStart();
+				p = ed.dom.getParent(n, 'td,th,caption');
+				cm.setActive('table', n.nodeName === 'TABLE' || !!p);
+
+				// Disable table tools if we are in caption
+				if (p && p.nodeName === 'CAPTION')
+					p = 0;
+
+				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);
+				cm.setDisabled('merge_cells', !p);
+			});
+
+			ed.onInit.add(function(ed) {
+				var startTable, startCell, dom = ed.dom, tableGrid;
+
+				winMan = ed.windowManager;
+
+				// Add cell selection logic
+				ed.onMouseDown.add(function(ed, e) {
+					if (e.button != 2) {
+						cleanup();
+
+						startCell = dom.getParent(e.target, 'td,th');
+						startTable = dom.getParent(startCell, 'table');
+					}
+				});
+
+				dom.bind(ed.getDoc(), 'mouseover', function(e) {
+					var sel, table, target = e.target;
+
+					if (startCell && (tableGrid || target != startCell) && (target.nodeName == 'TD' || target.nodeName == 'TH')) {
+						table = dom.getParent(target, 'table');
+						if (table == startTable) {
+							if (!tableGrid) {
+								tableGrid = createTableGrid(table);
+								tableGrid.setStartCell(startCell);
+
+								ed.getBody().style.webkitUserSelect = 'none';
+							}
+
+							tableGrid.setEndCell(target);
+						}
+
+						// Remove current selection
+						sel = ed.selection.getSel();
+
+						if (sel.removeAllRanges)
+							sel.removeAllRanges();
+						else
+							sel.empty();
+
+						e.preventDefault();
+					}
+				});
+
+				ed.onMouseUp.add(function(ed, e) {
+					var rng, sel = ed.selection, selectedCells, nativeSel = sel.getSel(), walker, node, lastNode, endNode;
+
+					// Move selection to startCell
+					if (startCell) {
+						if (tableGrid)
+							ed.getBody().style.webkitUserSelect = '';
+
+						function setPoint(node, start) {
+							var walker = new tinymce.dom.TreeWalker(node, node);
+
+							do {
+								// Text node
+								if (node.nodeType == 3 && tinymce.trim(node.nodeValue).length != 0) {
+									if (start)
+										rng.setStart(node, 0);
+									else
+										rng.setEnd(node, node.nodeValue.length);
+
+									return;
+								}
+
+								// BR element
+								if (node.nodeName == 'BR') {
+									if (start)
+										rng.setStartBefore(node);
+									else
+										rng.setEndBefore(node);
+
+									return;
+								}
+							} while (node = (start ? walker.next() : walker.prev()));
+						};
+
+						// Try to expand text selection as much as we can only Gecko supports cell selection
+						selectedCells = dom.select('td.mceSelected,th.mceSelected');
+						if (selectedCells.length > 0) {
+							rng = dom.createRng();
+							node = selectedCells[0];
+							endNode = selectedCells[selectedCells.length - 1];
+
+							setPoint(node, 1);
+							walker = new tinymce.dom.TreeWalker(node, dom.getParent(selectedCells[0], 'table'));
+
+							do {
+								if (node.nodeName == 'TD' || node.nodeName == 'TH') {
+									if (!dom.hasClass(node, 'mceSelected'))
+										break;
+
+									lastNode = node;
+								}
+							} while (node = walker.next());
+
+							setPoint(lastNode);
+
+							sel.setRng(rng);
+						}
+
+						ed.nodeChanged();
+						startCell = tableGrid = startTable = null;
+					}
+				});
+
+				ed.onKeyUp.add(function(ed, e) {
+					cleanup();
+				});
+
+				// Add context menu
+				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') || ed.dom.select('td.mceSelected,th.mceSelected').length) {
+							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 (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();
+							}
+
+							m.add({title : 'table.desc', icon : 'table', cmd : 'mceInsertTable', value : {action : 'insert'}});
+							m.add({title : 'table.props_desc', icon : 'table_props', cmd : 'mceInsertTable'});
+							m.add({title : 'table.del', icon : 'delete_table', cmd : 'mceTableDelete'});
+							m.addSeparator();
+
+							// Cell menu
+							sm = m.addMenu({title : 'table.cell'});
+							sm.add({title : 'table.cell_desc', icon : 'cell_props', cmd : 'mceTableCellProps'});
+							sm.add({title : 'table.split_cells_desc', icon : 'split_cells', cmd : 'mceTableSplitCells'});
+							sm.add({title : 'table.merge_cells_desc', icon : 'merge_cells', cmd : 'mceTableMergeCells'});
+
+							// Row menu
+							sm = m.addMenu({title : 'table.row'});
+							sm.add({title : 'table.row_desc', icon : 'row_props', cmd : 'mceTableRowProps'});
+							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'}).setDisabled(!clipboardRows);
+							sm.add({title : 'table.paste_row_after_desc', icon : 'paste', cmd : 'mceTablePasteRowAfter'}).setDisabled(!clipboardRows);
+
+							// 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'});
+					});
+				}
+
+				// Fixes an issue on Gecko where it's impossible to place the caret behind a table
+				// This fix will force a paragraph element after the table but only when the forced_root_block setting is enabled
+				if (!tinymce.isIE) {
+					function fixTableCaretPos() {
+						var last;
+
+						// Skip empty text nodes form the end
+						for (last = ed.getBody().lastChild; last && last.nodeType == 3 && !last.nodeValue.length; last = last.previousSibling) ;
+
+						if (last && last.nodeName == 'TABLE')
+							ed.dom.add(ed.getBody(), 'p', null, '<br mce_bogus="1" />');
+					};
+
+					// Fixes an bug where it's impossible to place the caret before a table in Gecko
+					// this fix solves it by detecting when the caret is at the beginning of such a table
+					// and then manually moves the caret infront of the table
+					if (tinymce.isGecko) {
+						ed.onKeyDown.add(function(ed, e) {
+							var rng, table, dom = ed.dom;
+
+							// On gecko it's not possible to place the caret before a table
+							if (e.keyCode == 37 || e.keyCode == 38) {
+								rng = ed.selection.getRng();
+								table = dom.getParent(rng.startContainer, 'table');
+
+								if (table && ed.getBody().firstChild == table) {
+									if (isAtStart(rng, table)) {
+										rng = dom.createRng();
+
+										rng.setStartBefore(table);
+										rng.setEndBefore(table);
+
+										ed.selection.setRng(rng);
+
+										e.preventDefault();
+									}
+								}
+							}
+						});
+					}
+
+					ed.onKeyUp.add(fixTableCaretPos);
+					ed.onSetContent.add(fixTableCaretPos);
+					ed.onVisualAid.add(fixTableCaretPos);
+
+					ed.onPreProcess.add(function(ed, o) {
+						var last = o.node.lastChild;
+
+						if (last && last.childNodes.length == 1 && last.firstChild.nodeName == 'BR')
+							ed.dom.remove(last);
+					});
+
+					fixTableCaretPos();
+				}
+			});
+
+			// Register action commands
+			each({
+				mceTableSplitCells : function(grid) {
+					grid.split();
+				},
+
+				mceTableMergeCells : function(grid) {
+					var rowSpan, colSpan, cell;
+
+					cell = ed.dom.getParent(ed.selection.getNode(), 'th,td');
+					if (cell) {
+						rowSpan = cell.rowSpan;
+						colSpan = cell.colSpan;
+					}
+
+					if (!ed.dom.select('td.mceSelected,th.mceSelected').length) {
+						winMan.open({
+							url : url + '/merge_cells.htm',
+							width : 240 + parseInt(ed.getLang('table.merge_cells_delta_width', 0)),
+							height : 110 + parseInt(ed.getLang('table.merge_cells_delta_height', 0)),
+							inline : 1
+						}, {
+							rows : rowSpan,
+							cols : colSpan,
+							onaction : function(data) {
+								grid.merge(cell, data.cols, data.rows);
+							},
+							plugin_url : url
+						});
+					} else
+						grid.merge();
+				},
+
+				mceTableInsertRowBefore : function(grid) {
+					grid.insertRow(true);
+				},
+
+				mceTableInsertRowAfter : function(grid) {
+					grid.insertRow();
+				},
+
+				mceTableInsertColBefore : function(grid) {
+					grid.insertCol(true);
+				},
+
+				mceTableInsertColAfter : function(grid) {
+					grid.insertCol();
+				},
+
+				mceTableDeleteCol : function(grid) {
+					grid.deleteCols();
+				},
+
+				mceTableDeleteRow : function(grid) {
+					grid.deleteRows();
+				},
+
+				mceTableCutRow : function(grid) {
+					clipboardRows = grid.cutRows();
+				},
+
+				mceTableCopyRow : function(grid) {
+					clipboardRows = grid.copyRows();
+				},
+
+				mceTablePasteRowBefore : function(grid) {
+					grid.pasteRows(clipboardRows, true);
+				},
+
+				mceTablePasteRowAfter : function(grid) {
+					grid.pasteRows(clipboardRows);
+				},
+
+				mceTableDelete : function(grid) {
+					grid.deleteTable();
+				}
+			}, function(func, name) {
+				ed.addCommand(name, function() {
+					var grid = createTableGrid();
+
+					if (grid) {
+						func(grid);
+						ed.execCommand('mceRepaint');
+						cleanup();
+					}
+				});
+			});
+
+			// Register dialog commands
+			each({
+				mceInsertTable : function(val) {
+					winMan.open({
+						url : url + '/table.htm',
+						width : 400 + parseInt(ed.getLang('table.table_delta_width', 0)),
+						height : 320 + parseInt(ed.getLang('table.table_delta_height', 0)),
+						inline : 1
+					}, {
+						plugin_url : url,
+						action : val ? val.action : 0
+					});
+				},
+
+				mceTableRowProps : function() {
+					winMan.open({
+						url : url + '/row.htm',
+						width : 400 + parseInt(ed.getLang('table.rowprops_delta_width', 0)),
+						height : 295 + parseInt(ed.getLang('table.rowprops_delta_height', 0)),
+						inline : 1
+					}, {
+						plugin_url : url
+					});
+				},
+
+				mceTableCellProps : function() {
+					winMan.open({
+						url : url + '/cell.htm',
+						width : 400 + parseInt(ed.getLang('table.cellprops_delta_width', 0)),
+						height : 295 + parseInt(ed.getLang('table.cellprops_delta_height', 0)),
+						inline : 1
+					}, {
+						plugin_url : url
+					});
+				}
+			}, function(func, name) {
+				ed.addCommand(name, function(ui, val) {
+					func(val);
+				});
+			});
+		}
+	});
+
+	// Register plugin
+	tinymce.PluginManager.add('table', tinymce.plugins.TablePlugin);
+})(tinymce);
\ No newline at end of file
diff -x .svn -aruN 0.7.24.src/e107_handlers/tiny_mce/plugins/table/js/cell.js 0.7.26.src/e107_handlers/tiny_mce/plugins/table/js/cell.js
--- 0.7.24.src/e107_handlers/tiny_mce/plugins/table/js/cell.js	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_handlers/tiny_mce/plugins/table/js/cell.js	2011-03-12 04:48:11.000000000 -0600
@@ -1,269 +1,284 @@
-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);
+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.getStart(), "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();
+
+	if (!ed.dom.hasClass(tdElm, 'mceSelected')) {
+		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');
+	} else
+		tinyMCEPopup.dom.hide('action');
+}
+
+function updateAction() {
+	var el, inst = ed, tdElm, trElm, tableElm, formObj = document.forms[0];
+
+	tinyMCEPopup.restoreSelection();
+	el = ed.selection.getStart();
+	tdElm = ed.dom.getParent(el, "td,th");
+	trElm = ed.dom.getParent(el, "tr");
+	tableElm = ed.dom.getParent(el, "table");
+
+	// Cell is selected
+	if (ed.dom.hasClass(tdElm, 'mceSelected')) {
+		// Update all selected sells
+		tinymce.each(ed.dom.select('td.mceSelected,th.mceSelected'), function(td) {
+			updateCell(td);
+		});
+
+		ed.addVisual();
+		ed.nodeChanged();
+		inst.execCommand('mceEndUndoLevel');
+		tinyMCEPopup.close();
+		return;
+	}
+
+	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)
+		dom.setAttrib(td, 'id', formObj.id.value);
+
+	dom.setAttrib(td, 'align', formObj.align.value);
+	dom.setAttrib(td, 'vAlign', formObj.valign.value);
+	dom.setAttrib(td, 'lang', formObj.lang.value);
+	dom.setAttrib(td, 'dir', getSelectValue(formObj, 'dir'));
+	dom.setAttrib(td, 'style', ed.dom.serializeStyle(ed.dom.parseStyle(formObj.style.value)));
+	dom.setAttrib(td, 'scope', formObj.scope.value);
+	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.24.src/e107_handlers/tiny_mce/plugins/table/js/merge_cells.js 0.7.26.src/e107_handlers/tiny_mce/plugins/table/js/merge_cells.js
--- 0.7.24.src/e107_handlers/tiny_mce/plugins/table/js/merge_cells.js	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_handlers/tiny_mce/plugins/table/js/merge_cells.js	2010-10-09 17:21:36.000000000 -0500
@@ -1,29 +1,27 @@
-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);
+tinyMCEPopup.requireLangPack();
+
+var MergeCellsDialog = {
+	init : function() {
+		var f = document.forms[0];
+
+		f.numcols.value = tinyMCEPopup.getWindowArg('cols', 1);
+		f.numrows.value = tinyMCEPopup.getWindowArg('rows', 1);
+	},
+
+	merge : function() {
+		var func, f = document.forms[0];
+
+		tinyMCEPopup.restoreSelection();
+
+		func = tinyMCEPopup.getWindowArg('onaction');
+
+		func({
+			cols : f.numcols.value,
+			rows : f.numrows.value
+		});
+
+		tinyMCEPopup.close();
+	}
+};
+
+tinyMCEPopup.onInit.add(MergeCellsDialog.init, MergeCellsDialog);
diff -x .svn -aruN 0.7.24.src/e107_handlers/tiny_mce/plugins/table/js/row.js 0.7.26.src/e107_handlers/tiny_mce/plugins/table/js/row.js
--- 0.7.24.src/e107_handlers/tiny_mce/plugins/table/js/row.js	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_handlers/tiny_mce/plugins/table/js/row.js	2011-03-12 04:48:11.000000000 -0600
@@ -1,212 +1,232 @@
-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);
+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.getStart(), "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');
+
+	selectByValue(formObj, 'rowtype', rowtype);
+
+	// Any cells selected
+	if (dom.select('td.mceSelected,th.mceSelected', trElm).length == 0) {
+		// 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, 'dir', dir);
+
+		// Resize some elements
+		if (isVisible('backgroundimagebrowser'))
+			document.getElementById('backgroundimage').style.width = '180px';
+
+		updateColor('bgcolor_pick', 'bgcolor');
+	} else
+		tinyMCEPopup.dom.hide('action');
+}
+
+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.getStart(), "tr");
+	tableElm = dom.getParent(inst.selection.getStart(), "table");
+
+	// Update all selected rows
+	if (dom.select('td.mceSelected,th.mceSelected', trElm).length > 0) {
+		tinymce.each(tableElm.rows, function(tr) {
+			var i;
+
+			for (i = 0; i < tr.cells.length; i++) {
+				if (dom.hasClass(tr.cells[i], 'mceSelected')) {
+					updateRow(tr, true);
+					return;
+				}
+			}
+		});
+
+		inst.addVisual();
+		inst.nodeChanged();
+		inst.execCommand('mceEndUndoLevel');
+		tinyMCEPopup.close();
+		return;
+	}
+
+	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)
+		dom.setAttrib(tr_elm, 'id', formObj.id.value);
+
+	dom.setAttrib(tr_elm, 'align', getSelectValue(formObj, 'align'));
+	dom.setAttrib(tr_elm, 'vAlign', getSelectValue(formObj, 'valign'));
+	dom.setAttrib(tr_elm, 'lang', formObj.lang.value);
+	dom.setAttrib(tr_elm, 'dir', getSelectValue(formObj, 'dir'));
+	dom.setAttrib(tr_elm, 'style', dom.serializeStyle(dom.parseStyle(formObj.style.value)));
+	dom.setAttrib(tr_elm, 'class', getSelectValue(formObj, 'class'));
+
+	// Clear deprecated attributes
+	dom.setAttrib(tr_elm, 'background', '');
+	dom.setAttrib(tr_elm, 'bgColor', '');
+	dom.setAttrib(tr_elm, '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 (theTable.firstChild.nodeName == 'CAPTION')
+				inst.dom.insertAfter(newParent, theTable.firstChild);
+			else
+				theTable.insertBefore(newParent, theTable.firstChild);
+		}
+
+		// 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.24.src/e107_handlers/tiny_mce/plugins/table/js/table.js 0.7.26.src/e107_handlers/tiny_mce/plugins/table/js/table.js
--- 0.7.24.src/e107_handlers/tiny_mce/plugins/table/js/table.js	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_handlers/tiny_mce/plugins/table/js/table.js	2011-03-12 04:48:11.000000000 -0600
@@ -1,440 +1,450 @@
-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 = getSelectValue(formObj, "align");
-	frame = getSelectValue(formObj, "tframe");
-	rules = getSelectValue(formObj, "rules");
-	width = formObj.elements['width'].value;
-	height = formObj.elements['height'].value;
-	bordercolor = formObj.elements['bordercolor'].value;
-	bgcolor = formObj.elements['bgcolor'].value;
-	className = getSelectValue(formObj, "class");
-	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);
+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(AutoValidator.getErrorMessages(formObj).join('. ') + '.');
+		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 = getSelectValue(formObj, "align");
+	frame = getSelectValue(formObj, "tframe");
+	rules = getSelectValue(formObj, "rules");
+	width = formObj.elements['width'].value;
+	height = formObj.elements['height'].value;
+	bordercolor = formObj.elements['bordercolor'].value;
+	bgcolor = formObj.elements['bgcolor'].value;
+	className = getSelectValue(formObj, "class");
+	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") {
+		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 data-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);
+	html += makeAttrib('data-mce-new', '1');
+
+	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 data-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 data-mce-bogus="1"/></td>';
+			else
+				html += '<td></td>';
+		}
+
+		html += "</tr>";
+	}
+
+	html += "</table>";
+
+	// Move table
+	if (inst.settings.fix_table_elements) {
+		var patt = '';
+
+		inst.focus();
+		inst.selection.setContent('<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('br._mce_marker')[0], html);
+	} else
+		inst.execCommand('mceInsertContent', false, html);
+
+	tinymce.each(dom.select('table[data-mce-new]'), function(node) {
+		var td = dom.select('td', node);
+
+		try {
+			// IE9 might fail to do this selection
+			inst.selection.select(td[0], true);
+			inst.selection.collapse();
+		} catch (ex) {
+			// Ignore
+		}
+
+		dom.setAttrib(node, 'data-mce-new', '');
+	});
+
+	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.24.src/e107_handlers/tiny_mce/plugins/table/langs/en_dlg.js 0.7.26.src/e107_handlers/tiny_mce/plugins/table/langs/en_dlg.js
--- 0.7.24.src/e107_handlers/tiny_mce/plugins/table/langs/en_dlg.js	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_handlers/tiny_mce/plugins/table/langs/en_dlg.js	2011-03-12 04:48:11.000000000 -0600
@@ -1,74 +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"
+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:"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",
+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.24.src/e107_handlers/tiny_mce/plugins/table/merge_cells.htm 0.7.26.src/e107_handlers/tiny_mce/plugins/table/merge_cells.htm
--- 0.7.24.src/e107_handlers/tiny_mce/plugins/table/merge_cells.htm	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_handlers/tiny_mce/plugins/table/merge_cells.htm	2011-03-12 04:48:11.000000000 -0600
@@ -1,37 +1,32 @@
-<!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>{#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 style="margin: 8px">
-<form onsubmit="mergeCells();return false;" action="#">
-	<fieldset>
-		<legend>{#table_dlg.merge_cells_title}</legend>
-		  <table border="0" cellpadding="0" cellspacing="3" width="100%">
-			  <tr>
-				<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>{#table_dlg.rows}:</td>
-				<td align="right"><input type="text" name="numrows" value="" class="number min1" style="width: 30px" /></td>
-			  </tr>
-		  </table>
-	</fieldset>
-
-	<div class="mceActionPanel">
-		<div style="float: left">
-			<input type="submit" id="insert" name="insert" value="{#update}" />
-		</div>
-
-		<div style="float: right">
-			<input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />
-		</div>
-	</div>
-</form>
-</body>
-</html>
+<!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>{#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 style="margin: 8px" role="application">
+<form onsubmit="MergeCellsDialog.merge();return false;" action="#">
+	<fieldset>
+		<legend>{#table_dlg.merge_cells_title}</legend>
+		<table role="presentation" border="0" cellpadding="0" cellspacing="3" width="100%">
+			<tr>
+				<td><label for="numcols">{#table_dlg.cols}</label>:</td>
+				<td align="right"><input type="text" id="numcols" name="numcols" value="" class="number min1 mceFocus" style="width: 30px" aria-required="true" /></td>
+			</tr>
+			<tr>
+				<td><label for="numrows">{#table_dlg.rows}</label>:</td>
+				<td align="right"><input type="text" id="numrows" name="numrows" value="" class="number min1" style="width: 30px" aria-required="true" /></td>
+			</tr>
+		</table>
+	</fieldset>
+
+	<div class="mceActionPanel">
+		<input type="submit" id="insert" name="insert" value="{#update}" />
+		<input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />
+	</div>
+</form>
+</body>
+</html>
diff -x .svn -aruN 0.7.24.src/e107_handlers/tiny_mce/plugins/table/row.htm 0.7.26.src/e107_handlers/tiny_mce/plugins/table/row.htm
--- 0.7.24.src/e107_handlers/tiny_mce/plugins/table/row.htm	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_handlers/tiny_mce/plugins/table/row.htm	2011-03-12 04:48:11.000000000 -0600
@@ -1,160 +1,157 @@
-<!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>{#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" />
-</head>
-<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;">{#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>{#table_dlg.general_props}</legend>
-
-					<table border="0" cellpadding="4" cellspacing="0">
-						<tr>
-							<td><label for="rowtype">{#table_dlg.rowtype}</label></td>
-							<td class="col2">
-								<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">{#table_dlg.align}</label></td>
-							<td class="col2">
-								<select id="align" name="align">
-									<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">{#table_dlg.valign}</label></td>
-							<td class="col2">
-								<select id="valign" name="valign">
-									<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">{#class_name}</label></td>
-							<td class="col2">
-								<select id="class" name="class" class="mceEditableSelect">
-									<option value="" selected="selected">{#not_set}</option>
-								</select>
-							</td>
-						</tr>
-
-						<tr>
-							<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>
-				</fieldset>
-			</div>
-
-			<div id="advanced_panel" class="panel">
-				<fieldset>
-					<legend>{#table_dlg.advanced_props}</legend>
-
-					<table border="0" cellpadding="0" cellspacing="4">
-						<tr>
-							<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">{#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">{#table_dlg.langdir}</label></td> 
-							<td>
-								<select id="dir" name="dir" style="width: 200px"> 
-										<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">{#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">{#table_dlg.bgimage}</label></td> 
-							<td>
-								<table border="0" cellpadding="0" cellspacing="0">
-									<tr>
-										<td><input id="backgroundimage" name="backgroundimage" type="text" value="" style="width: 200px" onchange="changedBackgroundImage();" /></td>
-										<td id="backgroundimagebrowsercontainer">&nbsp;</td>
-									</tr>
-								</table>
-							</td> 
-						</tr>
-
-						<tr>
-							<td class="column1"><label for="bgcolor">{#table_dlg.bgcolor}</label></td> 
-							<td>
-								<table border="0" cellpadding="0" cellspacing="0">
-									<tr>
-										<td><input id="bgcolor" name="bgcolor" type="text" value="" size="9" onchange="updateColor('bgcolor_pick','bgcolor');changedColor();" /></td>
-										<td id="bgcolor_pickcontainer">&nbsp;</td>
-									</tr>
-								</table>
-							</td> 
-						</tr>
-					</table>
-				</fieldset>
-			</div>
-		</div>
-
-		<div class="mceActionPanel">
-			<div>
-				<select id="action" name="action">
-					<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="submit" id="insert" name="insert" value="{#update}" /></div>
-			</div>
-
-			<div style="float: right">
-				<input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />
-			</div>
-		</div>
-	</form>
-</body>
-</html>
+<!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>{#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" />
+</head>
+<body id="tablerow" style="display: none" role="application">
+	<form onsubmit="updateAction();return false;" action="#">
+		<div class="tabs">
+			<ul>
+				<li id="general_tab" class="current" aria-controls="general_panel"><span><a href="javascript:mcTabs.displayTab('general_tab','general_panel');" onmousedown="return false;">{#table_dlg.general_tab}</a></span></li>
+				<li id="advanced_tab" aria-controls="advanced_panel"><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>{#table_dlg.general_props}</legend>
+
+					<table role="presentation" border="0" cellpadding="4" cellspacing="0">
+						<tr>
+							<td><label for="rowtype">{#table_dlg.rowtype}</label></td>
+							<td class="col2">
+								<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">{#table_dlg.align}</label></td>
+							<td class="col2">
+								<select id="align" name="align">
+									<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">{#table_dlg.valign}</label></td>
+							<td class="col2">
+								<select id="valign" name="valign">
+									<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">{#class_name}</label></td>
+							<td class="col2">
+								<select id="class" name="class" class="mceEditableSelect">
+									<option value="" selected="selected">{#not_set}</option>
+								</select>
+							</td>
+						</tr>
+
+						<tr>
+							<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>
+				</fieldset>
+			</div>
+
+			<div id="advanced_panel" class="panel">
+				<fieldset>
+					<legend>{#table_dlg.advanced_props}</legend>
+
+					<table role="presentation" border="0" cellpadding="0" cellspacing="4">
+						<tr>
+							<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">{#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">{#table_dlg.langdir}</label></td> 
+							<td>
+								<select id="dir" name="dir" style="width: 200px"> 
+										<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">{#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">{#table_dlg.bgimage}</label></td> 
+							<td>
+								<table role="presentation" border="0" cellpadding="0" cellspacing="0">
+									<tr>
+										<td><input id="backgroundimage" name="backgroundimage" type="text" value="" style="width: 200px" onchange="changedBackgroundImage();" /></td>
+										<td id="backgroundimagebrowsercontainer">&nbsp;</td>
+									</tr>
+								</table>
+							</td> 
+						</tr>
+
+						<tr>
+							<td class="column1"><label for="bgcolor" id="bgcolor_label">{#table_dlg.bgcolor}</label></td> 
+							<td>
+								<span role="group" aria-labelledby="bgcolor_label">
+								<table role="presentation" border="0" cellpadding="0" cellspacing="0">
+									<tr>
+										<td><input id="bgcolor" name="bgcolor" type="text" value="" size="9" onchange="updateColor('bgcolor_pick','bgcolor');changedColor();" /></td>
+										<td id="bgcolor_pickcontainer">&nbsp;</td>
+									</tr>
+								</table>
+								</span>
+							</td> 
+						</tr>
+					</table>
+				</fieldset>
+			</div>
+		</div>
+
+		<div class="mceActionPanel">
+			<div>
+				<select id="action" name="action">
+					<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>
+
+			<input type="submit" id="insert" name="insert" value="{#update}" />
+			<input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />
+		</div>
+	</form>
+</body>
+</html>
diff -x .svn -aruN 0.7.24.src/e107_handlers/tiny_mce/plugins/table/table.htm 0.7.26.src/e107_handlers/tiny_mce/plugins/table/table.htm
--- 0.7.24.src/e107_handlers/tiny_mce/plugins/table/table.htm	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_handlers/tiny_mce/plugins/table/table.htm	2011-03-12 04:48:11.000000000 -0600
@@ -1,192 +1,188 @@
-<!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>{#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" />
-</head>
-<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;">{#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>{#table_dlg.general_props}</legend>
-					  <table border="0" cellpadding="4" cellspacing="0" width="100%">
-							  <tr>
-								<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">{#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">{#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">{#table_dlg.align}</label></td>
-								<td><select id="align" name="align">
-									<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">{#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">{#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">{#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">{#class_name}</label></td>
-								<td colspan="3">
-								 <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>{#table_dlg.advanced_props}</legend>
-
-					<table border="0" cellpadding="0" cellspacing="4">
-						<tr>
-							<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">{#table_dlg.summary}</label></td> 
-							<td><input id="summary" name="summary" type="text" value="" class="advfield" /></td> 
-						</tr>
-
-						<tr>
-							<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 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">{#table_dlg.bgimage}</label></td> 
-							<td>
-								<table border="0" cellpadding="0" cellspacing="0">
-									<tr>
-										<td><input id="backgroundimage" name="backgroundimage" type="text" value="" class="advfield" onchange="changedBackgroundImage();" /></td>
-										<td id="backgroundimagebrowsercontainer">&nbsp;</td>
-									</tr>
-								</table>
-							</td> 
-						</tr>
-
-						<tr>
-							<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>
-										<td><input id="bordercolor" name="bordercolor" type="text" value="" size="9" onchange="updateColor('bordercolor_pick','bordercolor');changedColor();" /></td>
-										<td id="bordercolor_pickcontainer">&nbsp;</td>
-									</tr>
-								</table>
-							</td> 
-						</tr>
-
-						<tr>
-							<td class="column1"><label for="bgcolor">{#table_dlg.bgcolor}</label></td> 
-							<td>
-								<table border="0" cellpadding="0" cellspacing="0">
-									<tr>
-										<td><input id="bgcolor" name="bgcolor" type="text" value="" size="9" onchange="updateColor('bgcolor_pick','bgcolor');changedColor();" /></td>
-										<td id="bgcolor_pickcontainer">&nbsp;</td>
-									</tr>
-								</table>
-							</td> 
-						</tr>
-					</table>
-				</fieldset>
-			</div>
-		</div>
-
-		<div class="mceActionPanel">
-			<div style="float: left">
-				<input type="submit" id="insert" name="insert" value="{#insert}" />
-			</div>
-
-			<div style="float: right">
-				<input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />
-			</div>
-		</div>
-	</form>
-</body>
-</html>
+<!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>{#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" />
+</head>
+<body id="table" style="display: none" role="application" aria-labelledby="app_title">
+	<span style="display:none;" id="app_title">{#table_dlg.title}</span>
+	<form onsubmit="insertTable();return false;" action="#">
+		<div class="tabs">
+			<ul>
+				<li id="general_tab" aria-controls="general_panel" 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" aria-controls="advanced_panel"><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>{#table_dlg.general_props}</legend>
+					<table role="presentation" border="0" cellpadding="4" cellspacing="0" width="100%">
+						<tr>
+							<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" aria-required="true" /></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" aria-required="true" /></td>
+						</tr>
+						<tr>
+							<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">{#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">{#table_dlg.align}</label></td>
+							<td><select id="align" name="align">
+								<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">{#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">{#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">{#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">{#class_name}</label></td>
+							<td colspan="3" >
+							 <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>{#table_dlg.advanced_props}</legend>
+
+					<table role="presentation" border="0" cellpadding="0" cellspacing="4">
+						<tr>
+							<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">{#table_dlg.summary}</label></td> 
+							<td><input id="summary" name="summary" type="text" value="" class="advfield" /></td> 
+						</tr>
+
+						<tr>
+							<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 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">{#table_dlg.bgimage}</label></td> 
+							<td>
+								<table role="presentation" aria-labelledby="backgroundimage_label" border="0" cellpadding="0" cellspacing="0">
+									<tr>
+										<td><input id="backgroundimage" name="backgroundimage" type="text" value="" class="advfield" onchange="changedBackgroundImage();" /></td>
+										<td id="backgroundimagebrowsercontainer">&nbsp;</td>
+									</tr>
+								</table>
+							</td> 
+						</tr>
+
+						<tr>
+							<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 role="group" aria-labelledby="bordercolor_label">
+							<td class="column1"><label id="bordercolor_label" for="bordercolor">{#table_dlg.bordercolor}</label></td> 
+							<td>
+								<table role="presentation" border="0" cellpadding="0" cellspacing="0">
+									<tr>
+										<td><input id="bordercolor" name="bordercolor" type="text" value="" size="9" onchange="updateColor('bordercolor_pick','bordercolor');changedColor();" /></td>
+										<td id="bordercolor_pickcontainer">&nbsp;</td>
+									</tr>
+								</table>
+							</td> 
+						</tr>
+
+						<tr role="group" aria-labelledby="bgcolor_label">
+							<td class="column1"><label id="bgcolor_label" for="bgcolor">{#table_dlg.bgcolor}</label></td> 
+							<td>
+								<table role="presentation" border="0" cellpadding="0" cellspacing="0">
+									<tr>
+										<td><input id="bgcolor" name="bgcolor" type="text" value="" size="9" onchange="updateColor('bgcolor_pick','bgcolor');changedColor();" /></td>
+										<td id="bgcolor_pickcontainer">&nbsp;</td>
+									</tr>
+								</table>
+							</td> 
+						</tr>
+					</table>
+				</fieldset>
+			</div>
+		</div>
+
+		<div class="mceActionPanel">
+			<input type="submit" id="insert" name="insert" value="{#insert}" />
+			<input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />
+		</div>
+	</form>
+</body>
+</html>
diff -x .svn -aruN 0.7.24.src/e107_handlers/tiny_mce/themes/advanced/about.htm 0.7.26.src/e107_handlers/tiny_mce/themes/advanced/about.htm
--- 0.7.24.src/e107_handlers/tiny_mce/themes/advanced/about.htm	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_handlers/tiny_mce/themes/advanced/about.htm	2011-03-12 04:48:11.000000000 -0600
@@ -1,56 +1,52 @@
-<!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>{#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" 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;">{#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>{#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-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">
-					<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>{#advanced_dlg.about_loaded}</h3>
-
-					<div id="plugintablecontainer">
-					</div>
-
-					<p>&nbsp;</p>
-				</div>
-			</div>
-
-			<div id="help_panel" class="panel noscroll" style="overflow: visible;">
-				<div id="iframecontainer"></div>
-			</div>
-		</div>
-
-		<div class="mceActionPanel">
-			<div style="float: right">
-				<input type="button" id="cancel" name="cancel" value="{#close}" onclick="tinyMCEPopup.close();" />
-			</div>
-		</div>
-</body>
-</html>
+<!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>{#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" style="display: none">
+		<div class="tabs">
+			<ul>
+				<li id="general_tab" class="current" aria-controls="general_panel"><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" aria-hidden="true" aria-controls="help_panel"><span><a href="javascript:mcTabs.displayTab('help_tab','help_panel');" onmousedown="return false;">{#advanced_dlg.about_help}</a></span></li>
+				<li id="plugins_tab" aria-controls="plugins_panel"><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>{#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-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">
+					<a href="http://www.moxiecode.com" target="_blank"><img src="http://tinymce.moxiecode.com/images/gotmoxie.png" alt="Got Moxie?" border="0" /></a>
+				</div>
+			</div>
+
+			<div id="plugins_panel" class="panel">
+				<div id="pluginscontainer">
+					<h3>{#advanced_dlg.about_loaded}</h3>
+
+					<div id="plugintablecontainer">
+					</div>
+
+					<p>&nbsp;</p>
+				</div>
+			</div>
+
+			<div id="help_panel" class="panel noscroll" style="overflow: visible;">
+				<div id="iframecontainer"></div>
+			</div>
+		</div>
+
+		<div class="mceActionPanel">
+			<input type="button" id="cancel" name="cancel" value="{#close}" onclick="tinyMCEPopup.close();" />
+		</div>
+</body>
+</html>
diff -x .svn -aruN 0.7.24.src/e107_handlers/tiny_mce/themes/advanced/anchor.htm 0.7.26.src/e107_handlers/tiny_mce/themes/advanced/anchor.htm
--- 0.7.24.src/e107_handlers/tiny_mce/themes/advanced/anchor.htm	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_handlers/tiny_mce/themes/advanced/anchor.htm	2011-03-12 04:48:11.000000000 -0600
@@ -1,31 +1,26 @@
-<!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>{#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 style="display: none">
-<form onsubmit="AnchorDialog.update();return false;" action="#">
-	<table border="0" cellpadding="4" cellspacing="0">
-		<tr>
-			<td colspan="2" class="title">{#advanced_dlg.anchor_title}</td>
-		</tr>
-		<tr>
-			<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="submit" id="insert" name="insert" value="{#update}" />
-		</div>
-
-		<div style="float: right">
-			<input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />
-		</div>
-	</div>
-</form>
-</body>
-</html>
+<!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>{#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 style="display: none" role="application" aria-labelledby="app_title">
+<form onsubmit="AnchorDialog.update();return false;" action="#">
+	<table border="0" cellpadding="4" cellspacing="0" role="presentation">
+		<tr>
+			<td colspan="2" class="title" id="app_title">{#advanced_dlg.anchor_title}</td>
+		</tr>
+		<tr>
+			<td class="nowrap"><label for="anchorName">{#advanced_dlg.anchor_name}:</label></td>
+			<td><input name="anchorName" type="text" class="mceFocus" id="anchorName" value="" style="width: 200px" aria-required="true" /></td>
+		</tr>
+	</table>
+
+	<div class="mceActionPanel">
+		<input type="submit" id="insert" name="insert" value="{#update}" />
+		<input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />
+	</div>
+</form>
+</body>
+</html>
diff -x .svn -aruN 0.7.24.src/e107_handlers/tiny_mce/themes/advanced/charmap.htm 0.7.26.src/e107_handlers/tiny_mce/themes/advanced/charmap.htm
--- 0.7.24.src/e107_handlers/tiny_mce/themes/advanced/charmap.htm	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_handlers/tiny_mce/themes/advanced/charmap.htm	2011-03-12 04:48:11.000000000 -0600
@@ -1,53 +1,51 @@
-<!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>{#advanced_dlg.charmap_title}</title>
-	<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
-	<script type="text/javascript" src="../../tiny_mce_popup.js"></script>
-	<script type="text/javascript" src="js/charmap.js"></script>
-</head>
-<body id="charmap" style="display:none">
-<table align="center" border="0" cellspacing="0" cellpadding="2">
-    <tr>
-        <td colspan="2" class="title">{#advanced_dlg.charmap_title}</td>
-    </tr>
-    <tr>
-        <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">
-                <tr>
-                    <td id="codeV">&nbsp;</td>
-                </tr>
-                <tr>
-                    <td id="codeN">&nbsp;</td>
-                </tr>
-            </table>
-        </td>
-    </tr>
-    <tr>
-        <td valign="bottom" style="padding-bottom: 3px;">
-            <table width="100" align="center" border="0" cellpadding="2" cellspacing="0">
-                <tr>
-                    <td align="center" style="border-left: 1px solid #666699; border-top: 1px solid #666699; border-right: 1px solid #666699;">HTML-Code</td>
-                </tr>
-                <tr>
-                    <td style="font-size: 16px; font-weight: bold; border-left: 1px solid #666699; border-bottom: 1px solid #666699; border-right: 1px solid #666699;" id="codeA" align="center">&nbsp;</td>
-                </tr>
-                <tr>
-                    <td style="font-size: 1px;">&nbsp;</td>
-                </tr>
-                <tr>
-                    <td align="center" style="border-left: 1px solid #666699; border-top: 1px solid #666699; border-right: 1px solid #666699;">NUM-Code</td>
-                </tr>
-                <tr>
-                    <td style="font-size: 16px; font-weight: bold; border-left: 1px solid #666699; border-bottom: 1px solid #666699; border-right: 1px solid #666699;" id="codeB" align="center">&nbsp;</td>
-                </tr>
-            </table>
-        </td>
-    </tr>
-</table>
-
-</body>
-</html>
+<!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>{#advanced_dlg.charmap_title}</title>
+	<script type="text/javascript" src="../../tiny_mce_popup.js"></script>
+	<script type="text/javascript" src="js/charmap.js"></script>
+</head>
+<body id="charmap" style="display:none">
+<table align="center" border="0" cellspacing="0" cellpadding="2" role="presentation">
+	<tr>
+		<td colspan="2" class="title" ><label for="charmapView" id="charmap_label">{#advanced_dlg.charmap_title}</label></td>
+	</tr>
+	<tr>
+		<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" role="presentation">
+				<tr>
+					<td id="codeV">&nbsp;</td>
+				</tr>
+				<tr>
+					<td id="codeN">&nbsp;</td>
+				</tr>
+			</table>
+		</td>
+	</tr>
+	<tr>
+		<td valign="bottom" style="padding-bottom: 3px;">
+			<table width="100" align="center" border="0" cellpadding="2" cellspacing="0" role="presentation">
+				<tr>
+					<td align="center" style="border-left: 1px solid #666699; border-top: 1px solid #666699; border-right: 1px solid #666699;"><label for="codeA">HTML-Code</label></td>
+				</tr>
+				<tr>
+					<td style="font-size: 16px; font-weight: bold; border-left: 1px solid #666699; border-bottom: 1px solid #666699; border-right: 1px solid #666699;" id="codeA" align="center">&nbsp;</td>
+				</tr>
+				<tr>
+					<td style="font-size: 1px;">&nbsp;</td>
+				</tr>
+				<tr>
+					<td align="center" style="border-left: 1px solid #666699; border-top: 1px solid #666699; border-right: 1px solid #666699;"><label for="codeB">NUM-Code</label></td>
+				</tr>
+				<tr>
+					<td style="font-size: 16px; font-weight: bold; border-left: 1px solid #666699; border-bottom: 1px solid #666699; border-right: 1px solid #666699;" id="codeB" align="center">&nbsp;</td>
+				</tr>
+			</table>
+		</td>
+	</tr>
+</table>
+</body>
+</html>
diff -x .svn -aruN 0.7.24.src/e107_handlers/tiny_mce/themes/advanced/color_picker.htm 0.7.26.src/e107_handlers/tiny_mce/themes/advanced/color_picker.htm
--- 0.7.24.src/e107_handlers/tiny_mce/themes/advanced/color_picker.htm	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_handlers/tiny_mce/themes/advanced/color_picker.htm	2011-03-12 04:48:11.000000000 -0600
@@ -1,75 +1,74 @@
-<!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>{#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 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>
+<!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>{#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 id="colorpicker" style="display: none" role="application" aria-labelledby="app_label">
+	<span class="mceVoiceLabel" id="app_label" style="display:none;">{#advanced_dlg.colorpicker_title}</span>
+<form onsubmit="insertAction();return false" action="#">
+	<div class="tabs">
+		<ul>
+			<li id="picker_tab" aria-controls="picker_panel" 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" aria-controls="rgb_panel"><span><a href="javascript:;" onclick="mcTabs.displayTab('rgb_tab','rgb_panel');" onmousedown="return false;">{#advanced_dlg.colorpicker_palette_tab}</a></span></li>
+			<li id="named_tab" aria-controls="named_panel"><span><a  href="javascript:;" onclick="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 id="webcolors_title">{#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 id="named_picker_label">
+				<legend id="named_title">{#advanced_dlg.colorpicker_named_title}</legend>
+				<div id="namedcolors" role="listbox" tabindex="0" aria-labelledby="named_picker_label">
+					<!-- 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">
+		<input type="submit" id="insert" name="insert" value="{#apply}" />
+
+		<div id="preview"></div>
+
+		<div id="previewblock">
+			<label for="color">{#advanced_dlg.colorpicker_color}</label> <input id="color" type="text" size="8" class="text mceFocus" aria-required="true" />
+		</div>
+	</div>
+</form>
+</body>
+</html>
diff -x .svn -aruN 0.7.24.src/e107_handlers/tiny_mce/themes/advanced/editor_template.js 0.7.26.src/e107_handlers/tiny_mce/themes/advanced/editor_template.js
--- 0.7.24.src/e107_handlers/tiny_mce/themes/advanced/editor_template.js	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_handlers/tiny_mce/themes/advanced/editor_template.js	2011-03-30 03:22:40.000000000 -0500
@@ -1 +1 @@
-(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
+(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);j.forcedHighContrastMode=j.settings.detect_highcontrast&&l._isHighContrast();j.settings.skin=j.forcedHighContrastMode?"highcontrast":j.settings.skin;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",theme_advanced_font_selector:"span",theme_advanced_show_current_color:0,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)";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}if(j.settings.content_css!==false){j.contentCSS.push(j.baseURI.toAbsolute(k+"/skins/"+j.settings.skin+"/content.css"))}j.onInit.add(function(){if(!j.settings.readonly){j.onNodeChange.add(l._nodeChanged,l);j.onKeyUp.add(l._updateUndoStatus,l);j.onMouseUp.add(l._updateUndoStatus,l);j.dom.bind(j.dom.getRoot(),"dragend",function(){l._updateUndoStatus(j)})}});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")}},_isHighContrast:function(){var i,j=d.add(d.getRoot(),"div",{style:"background-color: rgb(171,239,86);"});i=(d.getStyle(j,"background-color",true)+"").toLowerCase().replace(/ /g,"");d.remove(j);return i!="rgb(171,239,86)"&&i!="#abef56"},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(k){var i=this.editor,j=i.controlManager.get("styleselect");if(j.getLength()==0){f(i.dom.getClasses(),function(n,l){var m="style_"+l;i.formatter.register(m,{inline:"span",attributes:{"class":n["class"]},selector:"*"});j.add(n["class"],m)})}},_createStyleSelect:function(m){var k=this,i=k.editor,j=i.controlManager,l;l=j.createListBox("styleselect",{title:"advanced.style_select",onselect:function(o){var p,n=[];f(l.items,function(q){n.push(q.value)});i.focus();i.undoManager.add();p=i.formatter.matchAll(n);if(!o||p[0]==o){if(p[0]){i.formatter.remove(p[0])}}else{i.formatter.apply(o)}i.undoManager.add();i.nodeChanged();return false}});i.onInit.add(function(){var o=0,n=i.getParam("style_formats");if(n){f(n,function(p){var q,r=0;f(p,function(){r++});if(r>1){q=p.name=p.name||"style_"+(o++);i.formatter.register(q,p);l.add(p.title,q)}else{l.add(p.title)}})}else{f(i.getParam("theme_advanced_styles","","hash"),function(r,q){var p;if(r){p="style_"+(o++);i.formatter.register(p,{inline:"span",classes:r,selector:"*"});l.add(k.editor.translate(q),p)}})}});if(l.getLength()==0){l.onPostRender.add(function(o,p){if(!l.NativeListBox){b.add(p.id+"_text","focus",k._importClasses,k);b.add(p.id+"_text","mousedown",k._importClasses,k);b.add(p.id+"_open","focus",k._importClasses,k);b.add(p.id+"_open","mousedown",k._importClasses,k)}else{b.add(p.id,"focus",k._importClasses,k)}})}return l},_createFontSelect:function(){var k,j=this,i=j.editor;k=i.controlManager.createListBox("fontselect",{title:"advanced.fontdefault",onselect:function(l){var m=k.items[k.selectedIndex];if(!l&&m){i.execCommand("FontName",false,m.value);return}i.execCommand("FontName",false,l);k.select(function(n){return l==n});if(m&&m.value==l){k.select(null)}return false}});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){var o=n.items[n.selectedIndex];if(!i&&o){o=o.value;if(o["class"]){k.formatter.toggle("fontsize_class",{value:o["class"]});k.undoManager.add();k.nodeChanged()}else{k.execCommand("FontSize",false,o.fontSize)}return}if(i["class"]){k.focus();k.undoManager.add();k.formatter.toggle("fontsize_class",{value:i["class"]});k.undoManager.add();k.nodeChanged()}else{k.execCommand("FontSize",false,i.fontSize)}n.select(function(p){return i==p});if(o&&(o.value.fontSize==i.fontSize||o.value["class"]==i["class"])){n.select(null)}return false}});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",onselect:function(l){j.editor.execCommand("FormatBlock",false,l);return false}});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;if(r.settings){r.settings.aria_label=w.aria_label+r.getLang("advanced.help_shortcut")}m=j=d.create("span",{role:"application","aria-labelledby":r.id+"_voice",id:r.id+"_parent","class":"mceEditor "+r.settings.skin+"Skin"+(w.skin_variant?" "+r.settings.skin+"Skin"+v._ufirst(w.skin_variant):"")});d.add(m,"span",{"class":"mceVoiceLabel",style:"display:none;",id:r.id+"_voice"},w.aria_label);if(!d.boxModel){m=d.add(m,"div",{"class":"mceOldBoxModel"})}m=u=d.add(m,"table",{role:"presentation",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=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;r.onKeyDown.add(function(p,n){var s=121,o=122;if(n.altKey){if(n.keyCode===s){v.toolbarGroup.focus();return b.cancel(n)}else{if(n.keyCode===o){d.get(p.id+"_path_row").focus();return b.cancel(n)}}}});r.addShortcut("alt+0","","mceShortcuts",v);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+"_ifr");this.resizeTo(k.clientWidth+i,k.clientHeight+j)},resizeTo:function(i,m,k){var j=this.editor,l=this.settings,n=d.get(j.id+"_tbl"),o=d.get(j.id+"_ifr");i=Math.max(l.theme_advanced_resizing_min_width||100,i);m=Math.max(l.theme_advanced_resizing_min_height||100,m);i=Math.min(l.theme_advanced_resizing_max_width||65535,i);m=Math.min(l.theme_advanced_resizing_max_height||65535,m);d.setStyle(n,"height","");d.setStyle(o,"height",m);if(l.theme_advanced_resize_horizontal){d.setStyle(n,"width","");d.setStyle(o,"width",i);if(i<n.clientWidth){i=n.clientWidth;d.setStyle(o,"width",n.clientWidth)}}if(k&&l.theme_advanced_resizing_use_cookie){a.setHash("TinyMCE_"+j.id+"_size",{cw:i,ch:m})}},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(x,k){var A=this,p,m,r=A.editor,B=A.settings,z,j=r.controlManager,u,l,q=[],y,w;w=j.createToolbarGroup("toolbargroup",{name:r.getLang("advanced.toolbar"),tab_focus_toolbar:r.getParam("theme_advanced_tab_focus_toolbar")});A.toolbarGroup=w;y=B.theme_advanced_toolbar_align.toLowerCase();y="mce"+A._ufirst(y);l=d.add(d.add(x,"tr",{role:"presentation"}),"td",{"class":"mceToolbar "+y,role:"presentation"});for(p=1;(z=B["theme_advanced_buttons"+p]);p++){m=j.createToolbar("toolbar"+p,{"class":"mceToolbarRow"+p});if(B["theme_advanced_buttons"+p+"_add"]){z+=","+B["theme_advanced_buttons"+p+"_add"]}if(B["theme_advanced_buttons"+p+"_add_before"]){z=B["theme_advanced_buttons"+p+"_add_before"]+","+z}A._addControls(z,m);w.add(m);k.deltaHeight-=B.theme_advanced_row_height}q.push(w.renderHTML());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",role:"group","aria-labelledby":p.id+"_path_voice"});if(w.theme_advanced_path){d.add(k,"span",{id:p.id+"_path_voice"},p.translate("advanced.path"));d.add(k,"span",{},": ")}else{d.add(k,"span",{},"&#160;")}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}v.resizeTo(n.cw,n.ch)})}p.onPostRender.add(function(){b.add(p.id+"_resize","click",function(n){n.preventDefault()});b.add(p.id+"_resize","mousedown",function(D){var t,r,s,o,C,z,A,F,n,E,x;function y(G){G.preventDefault();n=A+(G.screenX-C);E=F+(G.screenY-z);v.resizeTo(n,E)}function B(G){b.remove(d.doc,"mousemove",t);b.remove(p.getDoc(),"mousemove",r);b.remove(d.doc,"mouseup",s);b.remove(p.getDoc(),"mouseup",o);n=A+(G.screenX-C);E=F+(G.screenY-z);v.resizeTo(n,E,true)}D.preventDefault();C=D.screenX;z=D.screenY;x=d.get(v.editor.id+"_ifr");A=n=x.clientWidth;F=E=x.clientHeight;t=b.add(d.doc,"mousemove",y);r=b.add(p.getDoc(),"mousemove",y);s=b.add(d.doc,"mouseup",B);o=b.add(p.getDoc(),"mouseup",B)})})}j.deltaHeight-=21;k=m=null},_updateUndoStatus:function(j){var i=j.controlManager;i.setDisabled("undo",!j.undoManager.hasUndo()&&!j.typing);i.setDisabled("redo",!j.undoManager.hasRedo())},_nodeChanged:function(m,r,D,q,E){var y=this,C,F=0,x,G,z=y.settings,w,k,u,B,l,j,i;e.each(y.stateControls,function(n){r.setActive(n,m.queryCommandState(y.controls[n][1]))});function o(p){var s,n=E.parents,t=p;if(typeof(p)=="string"){t=function(v){return v.nodeName==p}}for(s=0;s<n.length;s++){if(t(n[s])){return n[s]}}}r.setActive("visualaid",m.hasVisual);y._updateUndoStatus(m);r.setDisabled("outdent",!m.queryCommandState("Outdent"));C=o("A");if(G=r.get("link")){if(!C||!C.name){G.setDisabled(!C&&q);G.setActive(!!C)}}if(G=r.get("unlink")){G.setDisabled(!C&&q);G.setActive(!!C&&!C.name)}if(G=r.get("anchor")){G.setActive(!q&&!!C&&C.name)}C=o("IMG");if(G=r.get("image")){G.setActive(!q&&!!C&&D.className.indexOf("mceItem")==-1)}if(G=r.get("styleselect")){y._importClasses();j=[];f(G.items,function(n){j.push(n.value)});i=m.formatter.matchAll(j);G.select(i[0])}if(G=r.get("formatselect")){C=o(d.isBlock);if(C){G.select(C.nodeName.toLowerCase())}}o(function(p){if(p.nodeName==="SPAN"){if(!w&&p.className){w=p.className}}if(m.dom.is(p,z.theme_advanced_font_selector)){if(!k&&p.style.fontSize){k=p.style.fontSize}if(!u&&p.style.fontFamily){u=p.style.fontFamily.replace(/[\"\']+/g,"").replace(/^([^,]+).*/,"$1").toLowerCase()}if(!B&&p.style.color){B=p.style.color}if(!l&&p.style.backgroundColor){l=p.style.backgroundColor}}return false});if(G=r.get("fontselect")){G.select(function(n){return n.replace(/^([^,]+).*/,"$1").toLowerCase()==u})}if(G=r.get("fontsizeselect")){if(z.theme_advanced_runtime_fontsize&&!k&&!w){k=m.dom.getStyle(D,"fontSize",true)}G.select(function(n){if(n.fontSize&&n.fontSize===k){return true}if(n["class"]&&n["class"]===w){return true}})}if(z.theme_advanced_show_current_color){function A(p,n){if(G=r.get(p)){if(!n){n=G.settings.default_color}if(n!==G.value){G.displayColor(n)}}}A("forecolor",B);A("backcolor",l)}if(z.theme_advanced_show_current_color){function A(p,n){if(G=r.get(p)){if(!n){n=G.settings.default_color}if(n!==G.value){G.displayColor(n)}}}A("forecolor",B);A("backcolor",l)}if(z.theme_advanced_path&&z.theme_advanced_statusbar_location){C=d.get(m.id+"_path")||d.add(m.id+"_path_row","span",{id:m.id+"_path"});if(y.statusKeyboardNavigation){y.statusKeyboardNavigation.destroy();y.statusKeyboardNavigation=null}d.setHTML(C,"");o(function(H){var p=H.nodeName.toLowerCase(),s,v,t="";if(H.getAttribute("data-mce-bogus")){return}if(H.nodeType!=1||H.nodeName==="BR"||(d.hasClass(H,"mceItemHidden")||d.hasClass(H,"mceItemRemoved"))){return}if(e.isIE&&H.scopeName!=="HTML"){p=H.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(H,"src")){t+="src: "+x+" "}break;case"a":if(x=d.getAttrib(H,"name")){t+="name: "+x+" ";p+="#"+x}if(x=d.getAttrib(H,"href")){t+="href: "+x+" "}break;case"font":if(x=d.getAttrib(H,"face")){t+="font: "+x+" "}if(x=d.getAttrib(H,"size")){t+="size: "+x+" "}if(x=d.getAttrib(H,"color")){t+="color: "+x+" "}break;case"span":if(x=d.getAttrib(H,"style")){t+="style: "+x+" "}break}if(x=d.getAttrib(H,"id")){t+="id: "+x+" "}if(x=H.className){x=x.replace(/\b\s*(webkit|mce|Apple-)\w+\s*\b/g,"");if(x){t+="class: "+x+" ";if(d.isBlock(H)||p=="img"||p=="span"){p+="."+x}}}p=p.replace(/(html:)/g,"");p={name:p,node:H,title:t};y.onResolveName.dispatch(y,p);t=p.title;p=p.name;v=d.create("a",{href:"javascript:;",role:"button",onmousedown:"return false;",title:t,"class":"mcePath_"+(F++)},p);if(C.hasChildNodes()){C.insertBefore(d.create("span",{"aria-hidden":"true"},"\u00a0\u00bb "),C.firstChild);C.insertBefore(v,C.firstChild)}else{C.appendChild(v)}},m.getBody());if(d.select("a",C).length>0){y.statusKeyboardNavigation=new e.ui.KeyboardNavigation({root:m.id+"_path_row",items:d.select("a",C),excludeFromTabOrder:true,onCancel:function(){m.focus()}},d)}}},_sel:function(i){this.editor.execCommand("mceSelectNodeDepth",false,i)},_mceInsertAnchor:function(k,j){var i=this.editor;i.windowManager.open({url:this.url+"/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:this.url+"/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:this.url+"/about.htm",width:480,height:380,inline:true},{theme_url:this.url})},_mceShortcuts:function(){var i=this.editor;i.windowManager.open({url:this.url+"/shortcuts.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:this.url+"/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:this.url+"/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:this.url+"/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:this.url+"/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.24.src/e107_handlers/tiny_mce/themes/advanced/editor_template_src.js 0.7.26.src/e107_handlers/tiny_mce/themes/advanced/editor_template_src.js
--- 0.7.24.src/e107_handlers/tiny_mce/themes/advanced/editor_template_src.js	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_handlers/tiny_mce/themes/advanced/editor_template_src.js	2011-03-30 03:22:40.000000000 -0500
@@ -1,1153 +1,1360 @@
-/**
- * $Id: editor_template_src.js 11346 2010-02-17 18:56:14Z secretr $
- *
- * @author Moxiecode
- * @copyright Copyright  2004-2008, Moxiecode Systems AB, All rights reserved.
- */
-
-(function(tinymce) {
-	var DOM = tinymce.DOM, Event = tinymce.dom.Event, extend = tinymce.extend, each = tinymce.each, Cookie = tinymce.util.Cookie, lastExtID, explode = tinymce.explode;
-
-	// Tell it to load theme specific language pack(s)
-	tinymce.ThemeManager.requireLangPack('advanced');
-
-	tinymce.create('tinymce.themes.AdvancedTheme', {
-		sizes : [8, 10, 12, 14, 18, 24, 36],
-
-		// 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');
-						}
-					}
-
-					if (/^\s*\./.test(v))
-						cl = v.replace(/\./g, '');
-
-					o[k] = cl ? {'class' : cl} : {fontSize : v};
-				});
-
-				s.theme_advanced_font_sizes = o;
-			}
-
-			if ((v = s.theme_advanced_path_location) && v != 'none')
-				s.theme_advanced_statusbar_location = s.theme_advanced_path_location;
-
-			if (s.theme_advanced_statusbar_location == 'none')
-				s.theme_advanced_statusbar_location = 0;
-
-			// 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);
-				}
-			});
-
-			DOM.loadCSS(s.editor_css ? ed.documentBaseURI.toAbsolute(s.editor_css) : url + "/skins/" + ed.settings.skin + "/ui.css");
-
-			if (s.skin_variant)
-				DOM.loadCSS(url + "/skins/" + ed.settings.skin + "/ui_" + s.skin_variant + ".css");
-		},
-
-		createControl : function(n, cf) {
-			var cd, c;
-
-			if (c = cf.createControl(n))
-				return c;
-
-			switch (n) {
-				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 ((cd = this.controls[n]))
-				return cf.createButton(n, {title : "advanced." + cd[0], cmd : cd[1], ui : cd[2], value : cd[3]});
-		},
-
-		execCommand : function(cmd, ui, val) {
-			var f = this['_' + cmd];
-
-			if (f) {
-				f.call(this, ui, val);
-				return true;
-			}
-
-			return false;
-		},
-
-		_importClasses : function(e) {
-			var ed = this.editor, c = ed.controlManager.get('styleselect');
-
-			if (c.getLength() == 0) {
-				each(ed.dom.getClasses(), function(o) {
-					c.add(o['class'], o['class']);
-				});
-			}
-		},
-
-		_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);
-				});
-
-				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);
-				});
-			}
-
-			return c;
-		},
-
-		_createFontSelect : function() {
-			var c, t = this, ed = t.editor;
-
-			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 : ''});
-				});
-			}
-
-			return c;
-		},
-
-		_createFontSizeSelect : function() {
-			var t = this, ed = t.editor, c, i = 0, cl = [];
-
-			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']);
-					});
-
-					ed.editorCommands._applyInlineStyle('span', {'class' : v['class']}, {check_classes : cl});
-				}
-			}});
-
-			if (c) {
-				each(t.settings.theme_advanced_font_sizes, function(v, k) {
-					var fz = v.fontSize;
-
-					if (fz >= 1 && fz <= 7)
-						fz = t.sizes[parseInt(fz) - 1] + 'pt';
-
-					c.add(k, v, {'style' : 'font-size:' + fz, 'class' : 'mceFontSize' + (i++) + (' ' + (v['class'] || ''))});
-				});
-			}
-
-			return c;
-		},
-
-		_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});
-				});
-			}
-
-			return c;
-		},
-
-		_createForeColorMenu : 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);
-						}
-					});
-				};
-			}
-
-			if (v = s.theme_advanced_text_colors)
-				o.colors = v;
-
-			if (s.theme_advanced_default_foreground_color)
-				o.default_color = s.theme_advanced_default_foreground_color;
-
-			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);
-						}
-					});
-				};
-			}
-
-			if (v = s.theme_advanced_background_colors)
-				o.colors = v;
-
-			if (s.theme_advanced_default_background_color)
-				o.default_color = s.theme_advanced_default_background_color;
-
-			o.title = 'advanced.backcolor_desc';
-			o.cmd = 'HiliteColor';
-			o.scope = this;
-
-			c = t.editor.controlManager.createColorSplitButton('backcolor', o);
-
-			return c;
-		},
-
-		renderUI : function(o) {
-			var n, ic, tb, t = this, ed = t.editor, s = t.settings, sc, p, nl;
-
-			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) : '')});
-
-			if (!DOM.boxModel)
-				n = DOM.add(n, 'div', {'class' : 'mceOldBoxModel'});
-
-			n = sc = DOM.add(n, 'table', {id : ed.id + '_tbl', 'class' : 'mceLayout', cellSpacing : 0, cellPadding : 0});
-			n = tb = DOM.add(n, 'tbody');
-
-			switch ((s.theme_advanced_layout_manager || '').toLowerCase()) {
-				case "rowlayout":
-					ic = t._rowLayout(s, tb, o);
-					break;
-
-				case "customlayout":
-					ic = ed.execCallback("theme_advanced_custom_layout", s, tb, o, p);
-					break;
-
-				default:
-					ic = t._simpleLayout(s, tb, o, p);
-			}
-
-			n = o.targetNode;
-
-			// 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 (DOM.get(s.theme_advanced_toolbar_container))
-				DOM.get(s.theme_advanced_toolbar_container).appendChild(p);
-			else
-				DOM.insertAfter(p, n);
-
-			Event.add(ed.id + '_path_row', 'click', function(e) {
-				e = e.target;
-
-				if (e.nodeName == 'A') {
-					t._sel(e.className.replace(/^.*mcePath_([0-9]+).*$/, '$1'));
-
-					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);
-					}
-				});
-
-				Event.add(ed.id + '_tbl', 'mouseout', function(e) {
-					if (t.lastPath) {
-						DOM.setHTML(ed.id + '_path_row', t.lastPath);
-						t.lastPath = 0;
-					}
-				});
-			}
-*/
-
-			if (!ed.getParam('accessibility_focus'))
-				Event.add(DOM.add(p, 'a', {href : '#'}, '<!-- IE -->'), 'focus', function() {tinyMCE.get(ed.id).focus();});
-
-			if (s.theme_advanced_toolbar_location == 'external')
-				o.deltaHeight = 0;
-
-			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
-			}
-		},
-
-		resizeBy : function(dw, dh) {
-			var e = DOM.get(this.editor.id + '_tbl');
-
-			this.resizeTo(e.clientWidth + dw, e.clientHeight + dh);
-		},
-
-		resizeTo : function(w, h) {
-			var ed = this.editor, s = ed.settings, e = DOM.get(ed.id + '_tbl'), ifr = DOM.get(ed.id + '_ifr'), dh;
-
-			// 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);
-
-			// Calc difference between iframe and container
-			dh = e.clientHeight - ifr.clientHeight;
-
-			// Resize iframe and container
-			DOM.setStyle(ifr, 'height', h - dh);
-			DOM.setStyles(e, {width : w, height : h});
-		},
-
-		destroy : function() {
-			var id = this.editor.id;
-
-			Event.clear(id + '_resize');
-			Event.clear(id + '_path_row');
-			Event.clear(id + '_external_close');
-		},
-
-		// Internal functions
-
-		_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;
-
-			if (s.readonly) {
-				n = DOM.add(tb, 'tr');
-				n = ic = DOM.add(n, 'td', {'class' : 'mceIframeContainer'});
-				return ic;
-			}
-
-			// 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');
-
-				if (p.firstChild.className == 'mceOldBoxModel')
-					p.firstChild.appendChild(c);
-				else
-					p.insertBefore(c, p.firstChild);
-
-				t._addToolbars(etb, o);
-
-				ed.onMouseUp.add(function() {
-					var e = DOM.get(ed.id + '_external');
-					DOM.show(e);
-
-					DOM.hide(lastExtID);
-
-					var f = Event.add(ed.id + '_external_close', 'click', function() {
-						DOM.hide(ed.id + '_external');
-						Event.remove(ed.id + '_external_close', 'click', f);
-					});
-
-					DOM.show(e);
-					DOM.setStyle(e, 'top', 0 - DOM.getRect(ed.id + '_tblext').h - 1);
-
-					// Fixes IE rendering bug
-					DOM.hide(e);
-					DOM.show(e);
-					e.style.filter = '';
-
-					lastExtID = ed.id + '_external';
-
-					e = null;
-				});
-			}
-
-			if (sl == 'top')
-				t._addStatusBar(tb, o);
-
-			// Create iframe container
-			if (!s.theme_advanced_toolbar_container) {
-				n = DOM.add(tb, 'tr');
-				n = ic = DOM.add(n, 'td', {'class' : 'mceIframeContainer'});
-			}
-
-			// Create toolbar container at bottom
-			if (lo == 'bottom')
-				t._addToolbars(tb, o);
-
-			if (sl == 'bottom')
-				t._addStatusBar(tb, o);
-
-			return ic;
-		},
-
-		_rowLayout : function(s, tb, o) {
-			var t = this, ed = t.editor, dc, da, cf = ed.controlManager, n, ic, to, a;
-
-			dc = s.theme_advanced_containers_default_class || '';
-			da = s.theme_advanced_containers_default_align || 'center';
-
-			each(explode(s.theme_advanced_containers || ''), function(c, i) {
-				var v = s['theme_advanced_container_' + c] || '';
-
-				switch (v.toLowerCase()) {
-					case 'mceeditor':
-						n = DOM.add(tb, 'tr');
-						n = ic = DOM.add(n, 'td', {'class' : 'mceIframeContainer'});
-						break;
-
-					case 'mceelementpath':
-						t._addStatusBar(tb, o);
-						break;
-
-					default:
-						a = (s['theme_advanced_container_' + c + '_align'] || da).toLowerCase();
-						a = 'mce' + t._ufirst(a);
-
-						n = DOM.add(DOM.add(tb, 'tr'), 'td', {
-							'class' : 'mceToolbar ' + (s['theme_advanced_container_' + c + '_class'] || dc) + ' ' + a || da
-						});
-
-						to = cf.createToolbar("toolbar" + i);
-						t._addControls(v, to);
-						DOM.setHTML(n, to.renderHTML());
-						o.deltaHeight -= s.theme_advanced_row_height;
-				}
-			});
-
-			return ic;
-		},
-
-		_addControls : function(v, tb) {
-			var t = this, s = t.settings, di, cf = t.editor.controlManager;
-
-			if (s.theme_advanced_disable && !t._disabled) {
-				di = {};
-
-				each(explode(s.theme_advanced_disable), function(v) {
-					di[v] = 1;
-				});
-
-				t._disabled = di;
-			} else
-				di = t._disabled;
-
-			each(explode(v), function(n) {
-				var c;
-
-				if (di && di[n])
-					return;
-
-				// 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);
-
-						if (n)
-							tb.add(n);
-					});
-
-					return;
-				}
-
-				c = t.createControl(n, cf);
-
-				if (c)
-					tb.add(c);
-			});
-		},
-
-		_addToolbars : function(c, o) {
-			var t = this, i, tb, ed = t.editor, s = t.settings, v, cf = ed.controlManager, di, n, h = [], a;
-
-			a = s.theme_advanced_toolbar_align.toLowerCase();
-			a = 'mce' + t._ufirst(a);
-
-			n = DOM.add(DOM.add(c, 'tr'), 'td', {'class' : 'mceToolbar ' + a});
-
-			if (!ed.getParam('accessibility_focus'))
-				h.push(DOM.createHTML('a', {href : '#', onfocus : 'tinyMCE.get(\'' + ed.id + '\').focus();'}, '<!-- IE -->'));
-
-			h.push(DOM.createHTML('a', {href : '#', accesskey : 'q', title : ed.getLang("advanced.toolbar_focus")}, '<!-- IE -->'));
-
-			// 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 (s['theme_advanced_buttons' + i + '_add'])
-					v += ',' + s['theme_advanced_buttons' + i + '_add'];
-
-				if (s['theme_advanced_buttons' + i + '_add_before'])
-					v = s['theme_advanced_buttons' + i + '_add_before'] + ',' + v;
-
-				t._addControls(v, tb);
-
-				//n.appendChild(n = tb.render());
-				h.push(tb.renderHTML());
-
-				o.deltaHeight -= s.theme_advanced_row_height;
-			}
-
-			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(''));
-		},
-
-		_addStatusBar : function(tb, o) {
-			var n, t = this, ed = t.editor, s = t.settings, r, mf, me, td;
-
-			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 (s.theme_advanced_resizing) {
-				DOM.add(td, 'a', {id : ed.id + '_resize', href : 'javascript:;', onclick : "return false;", 'class' : 'mceResize'});
-
-				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 (!o)
-							return;
-
-						if (s.theme_advanced_resize_horizontal)
-							c.style.width = Math.max(10, o.cw) + 'px';
-
-						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';
-					});
-				}
-
-				ed.onPostRender.add(function() {
-					Event.add(ed.id + '_resize', 'mousedown', function(e) {
-						var c, p, w, h, n, pa;
-
-						// Measure container
-						c = DOM.get(ed.id + '_tbl');
-						w = c.clientWidth;
-						h = c.clientHeight;
-
-						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;
-
-						// Setup placeholder
-						p = DOM.add(DOM.get(ed.id + '_parent'), 'div', {'class' : 'mcePlaceHolder'});
-						DOM.setStyles(p, {width : w, height : h});
-
-						// Replace with placeholder
-						DOM.hide(c);
-						DOM.show(p);
-
-						// Create internal resize obj
-						r = {
-							x : e.screenX,
-							y : e.screenY,
-							w : w,
-							h : h,
-							dx : null,
-							dy : null
-						};
-
-						// Start listening
-						mf = Event.add(DOM.doc, 'mousemove', function(e) {
-							var w, h;
-
-							// Calc delta values
-							r.dx = e.screenX - r.x;
-							r.dy = e.screenY - r.y;
-
-							// 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);
-
-							// Resize placeholder
-							if (s.theme_advanced_resize_horizontal)
-								p.style.width = w + 'px';
-
-							p.style.height = h + 'px';
-
-							return Event.cancel(e);
-						});
-
-						me = Event.add(DOM.doc, 'mouseup', function(e) {
-							var ifr;
-
-							// Stop listening
-							Event.remove(DOM.doc, 'mousemove', mf);
-							Event.remove(DOM.doc, 'mouseup', me);
-
-							c.style.display = '';
-							DOM.remove(p);
-
-							if (r.dx === null)
-								return;
-
-							ifr = DOM.get(ed.id + '_ifr');
-
-							if (s.theme_advanced_resize_horizontal)
-								c.style.width = Math.max(10, r.w + r.dx) + 'px';
-
-							c.style.height = Math.max(10, r.h + r.dy) + 'px';
-							ifr.style.height = Math.max(10, ifr.clientHeight + r.dy) + 'px';
-
-							if (s.theme_advanced_resizing_use_cookie) {
-								Cookie.setHash("TinyMCE_" + ed.id + "_size", {
-									cw : r.w + r.dx,
-									ch : r.h + r.dy
-								});
-							}
-						});
-
-						return Event.cancel(e);
-					});
-				});
-			}
-
-			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);
-				}
-			}
-
-			if (c = cm.get('unlink')) {
-				c.setDisabled(!p && co);
-				c.setActive(!!p && !p.name);
-			}
-
-			if (c = cm.get('anchor')) {
-				c.setActive(!!p && p.name);
-
-				if (tinymce.isWebKit) {
-					p = DOM.getParent(n, 'IMG');
-					c.setActive(!!p && DOM.getAttrib(p, 'mce_name') == 'a');
-				}
-			}
-
-			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();
-			}
-
-			if (c = cm.get('formatselect')) {
-				p = DOM.getParent(n, DOM.isBlock);
-
-				if (p)
-					c.select(p.nodeName.toLowerCase());
-			}
-
-			if (ed.settings.convert_fonts_to_spans) {
-				ed.dom.getParent(n, function(n) {
-					if (n.nodeName === 'SPAN') {
-						if (!cl && n.className)
-							cl = n.className;
-
-						if (!fz && n.style.fontSize)
-							fz = n.style.fontSize;
-
-						if (!fn && n.style.fontFamily)
-							fn = n.style.fontFamily.replace(/[\"\']+/g, '').replace(/^([^,]+).*/, '$1').toLowerCase();
-					}
-
-					return false;
-				});
-
-				if (c = cm.get('fontselect')) {
-					c.select(function(v) {
-						return v.replace(/^([^,]+).*/, '$1').toLowerCase() == fn;
-					});
-				}
-
-				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'));
-
-				if (c = cm.get('fontsizeselect')) {
-					v = ed.queryCommandValue('FontSize');
-					c.select(function(iv) {
-						return iv.fontSize == v;
-					});
-				}
-			}
-
-			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;
-
-						case 'i':
-							na = 'em';
-							break;
-
-						case 'img':
-							if (v = DOM.getAttrib(n, 'src'))
-								ti += 'src: ' + v + ' ';
-
-							break;
-
-						case 'a':
-							if (v = DOM.getAttrib(n, 'name')) {
-								ti += 'name: ' + v + ' ';
-								na += '#' + v;
-							}
-
-							if (v = DOM.getAttrib(n, 'href'))
-								ti += 'href: ' + v + ' ';
-
-							break;
-
-						case 'font':
-							if (s.convert_fonts_to_spans)
-								na = 'span';
-
-							if (v = DOM.getAttrib(n, 'face'))
-								ti += 'font: ' + v + ' ';
-
-							if (v = DOM.getAttrib(n, 'size'))
-								ti += 'size: ' + v + ' ';
-
-							if (v = DOM.getAttrib(n, 'color'))
-								ti += 'color: ' + v + ' ';
-
-							break;
-
-						case 'span':
-							if (v = DOM.getAttrib(n, 'style'))
-								ti += 'style: ' + v + ' ';
-
-							break;
-					}
-
-					if (v = DOM.getAttrib(n, 'id'))
-						ti += 'id: ' + v + ' ';
-
-					if (v = n.className) {
-						v = v.replace(/(webkit-[\w\-]+|Apple-[\w\-]+|mceItem\w+|mceVisualAid)/g, '');
-
-						if (v && v.indexOf('mceItem') == -1) {
-							ti += 'class: ' + v + ' ';
-
-							if (DOM.isBlock(n) || na == 'img' || na == 'span')
-								na += '.' + v;
-						}
-					}
-
-					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());
-			}
-		},
-
-		// Commands gets called by execCommand
-
-		_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);
-				}
-			});
-		},
-
-		_ufirst : function(s) {
-			return s.substring(0, 1).toUpperCase() + s.substring(1);
-		}
-	});
-
-	tinymce.ThemeManager.add('advanced', tinymce.themes.AdvancedTheme);
-}(tinymce));
\ No newline at end of file
+/**
+ * editor_template_src.js
+ *
+ * Copyright 2009, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://tinymce.moxiecode.com/license
+ * Contributing: http://tinymce.moxiecode.com/contributing
+ */
+
+(function(tinymce) {
+	var DOM = tinymce.DOM, Event = tinymce.dom.Event, extend = tinymce.extend, each = tinymce.each, Cookie = tinymce.util.Cookie, lastExtID, explode = tinymce.explode;
+
+	// Tell it to load theme specific language pack(s)
+	tinymce.ThemeManager.requireLangPack('advanced');
+
+	tinymce.create('tinymce.themes.AdvancedTheme', {
+		sizes : [8, 10, 12, 14, 18, 24, 36],
+
+		// 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);
+
+			ed.forcedHighContrastMode = ed.settings.detect_highcontrast && t._isHighContrast();
+			ed.settings.skin = ed.forcedHighContrastMode ? 'highcontrast' : ed.settings.skin;
+
+			// 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",
+				theme_advanced_font_selector : "span",
+				theme_advanced_show_current_color: 0,
+				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)';
+						cl = s.font_size_classes[v - 1];
+						v = s.font_size_style_values[v - 1] || (t.sizes[v - 1] + 'pt');
+					}
+
+					if (/^\s*\./.test(v))
+						cl = v.replace(/\./g, '');
+
+					o[k] = cl ? {'class' : cl} : {fontSize : v};
+				});
+
+				s.theme_advanced_font_sizes = o;
+			}
+
+			if ((v = s.theme_advanced_path_location) && v != 'none')
+				s.theme_advanced_statusbar_location = s.theme_advanced_path_location;
+
+			if (s.theme_advanced_statusbar_location == 'none')
+				s.theme_advanced_statusbar_location = 0;
+
+			if (ed.settings.content_css !== false)
+				ed.contentCSS.push(ed.baseURI.toAbsolute(url + "/skins/" + ed.settings.skin + "/content.css"));
+
+			// Init editor
+			ed.onInit.add(function() {
+				if (!ed.settings.readonly) {
+					ed.onNodeChange.add(t._nodeChanged, t);
+					ed.onKeyUp.add(t._updateUndoStatus, t);
+					ed.onMouseUp.add(t._updateUndoStatus, t);
+					ed.dom.bind(ed.dom.getRoot(), 'dragend', function() {
+						t._updateUndoStatus(ed);
+					});
+				}
+			});
+
+			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);
+				}
+			});
+
+			DOM.loadCSS(s.editor_css ? ed.documentBaseURI.toAbsolute(s.editor_css) : url + "/skins/" + ed.settings.skin + "/ui.css");
+
+			if (s.skin_variant)
+				DOM.loadCSS(url + "/skins/" + ed.settings.skin + "/ui_" + s.skin_variant + ".css");
+		},
+
+		_isHighContrast : function() {
+			var actualColor, div = DOM.add(DOM.getRoot(), 'div', {'style': 'background-color: rgb(171,239,86);'});
+
+			actualColor = (DOM.getStyle(div, 'background-color', true) + '').toLowerCase().replace(/ /g, '');
+			DOM.remove(div);
+
+			return actualColor != 'rgb(171,239,86)' && actualColor != '#abef56';
+		},
+
+		createControl : function(n, cf) {
+			var cd, c;
+
+			if (c = cf.createControl(n))
+				return c;
+
+			switch (n) {
+				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 ((cd = this.controls[n]))
+				return cf.createButton(n, {title : "advanced." + cd[0], cmd : cd[1], ui : cd[2], value : cd[3]});
+		},
+
+		execCommand : function(cmd, ui, val) {
+			var f = this['_' + cmd];
+
+			if (f) {
+				f.call(this, ui, val);
+				return true;
+			}
+
+			return false;
+		},
+
+		_importClasses : function(e) {
+			var ed = this.editor, ctrl = ed.controlManager.get('styleselect');
+
+			if (ctrl.getLength() == 0) {
+				each(ed.dom.getClasses(), function(o, idx) {
+					var name = 'style_' + idx;
+
+					ed.formatter.register(name, {
+						inline : 'span',
+						attributes : {'class' : o['class']},
+						selector : '*'
+					});
+
+					ctrl.add(o['class'], name);
+				});
+			}
+		},
+
+		_createStyleSelect : function(n) {
+			var t = this, ed = t.editor, ctrlMan = ed.controlManager, ctrl;
+
+			// Setup style select box
+			ctrl = ctrlMan.createListBox('styleselect', {
+				title : 'advanced.style_select',
+				onselect : function(name) {
+					var matches, formatNames = [];
+
+					each(ctrl.items, function(item) {
+						formatNames.push(item.value);
+					});
+
+					ed.focus();
+					ed.undoManager.add();
+
+					// Toggle off the current format
+					matches = ed.formatter.matchAll(formatNames);
+					if (!name || matches[0] == name) {
+						if (matches[0]) 
+							ed.formatter.remove(matches[0]);
+					} else
+						ed.formatter.apply(name);
+
+					ed.undoManager.add();
+					ed.nodeChanged();
+
+					return false; // No auto select
+				}
+			});
+
+			// Handle specified format
+			ed.onInit.add(function() {
+				var counter = 0, formats = ed.getParam('style_formats');
+
+				if (formats) {
+					each(formats, function(fmt) {
+						var name, keys = 0;
+
+						each(fmt, function() {keys++;});
+
+						if (keys > 1) {
+							name = fmt.name = fmt.name || 'style_' + (counter++);
+							ed.formatter.register(name, fmt);
+							ctrl.add(fmt.title, name);
+						} else
+							ctrl.add(fmt.title);
+					});
+				} else {
+					each(ed.getParam('theme_advanced_styles', '', 'hash'), function(val, key) {
+						var name;
+
+						if (val) {
+							name = 'style_' + (counter++);
+
+							ed.formatter.register(name, {
+								inline : 'span',
+								classes : val,
+								selector : '*'
+							});
+
+							ctrl.add(t.editor.translate(key), name);
+						}
+					});
+				}
+			});
+
+			// Auto import classes if the ctrl box is empty
+			if (ctrl.getLength() == 0) {
+				ctrl.onPostRender.add(function(ed, n) {
+					if (!ctrl.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);
+				});
+			}
+
+			return ctrl;
+		},
+
+		_createFontSelect : function() {
+			var c, t = this, ed = t.editor;
+
+			c = ed.controlManager.createListBox('fontselect', {
+				title : 'advanced.fontdefault',
+				onselect : function(v) {
+					var cur = c.items[c.selectedIndex];
+
+					if (!v && cur) {
+						ed.execCommand('FontName', false, cur.value);
+						return;
+					}
+
+					ed.execCommand('FontName', false, v);
+
+					// Fake selection, execCommand will fire a nodeChange and update the selection
+					c.select(function(sv) {
+						return v == sv;
+					});
+
+					if (cur && cur.value == v) {
+						c.select(null);
+					}
+
+					return false; // No auto select
+				}
+			});
+
+			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 : ''});
+				});
+			}
+
+			return c;
+		},
+
+		_createFontSizeSelect : function() {
+			var t = this, ed = t.editor, c, i = 0, cl = [];
+
+			c = ed.controlManager.createListBox('fontsizeselect', {title : 'advanced.font_size', onselect : function(v) {
+				var cur = c.items[c.selectedIndex];
+
+				if (!v && cur) {
+					cur = cur.value;
+
+					if (cur['class']) {
+						ed.formatter.toggle('fontsize_class', {value : cur['class']});
+						ed.undoManager.add();
+						ed.nodeChanged();
+					} else {
+						ed.execCommand('FontSize', false, cur.fontSize);
+					}
+
+					return;
+				}
+
+				if (v['class']) {
+					ed.focus();
+					ed.undoManager.add();
+					ed.formatter.toggle('fontsize_class', {value : v['class']});
+					ed.undoManager.add();
+					ed.nodeChanged();
+				} else
+					ed.execCommand('FontSize', false, v.fontSize);
+
+				// Fake selection, execCommand will fire a nodeChange and update the selection
+				c.select(function(sv) {
+					return v == sv;
+				});
+
+				if (cur && (cur.value.fontSize == v.fontSize || cur.value['class'] == v['class'])) {
+					c.select(null);
+				}
+
+				return false; // No auto select
+			}});
+
+			if (c) {
+				each(t.settings.theme_advanced_font_sizes, function(v, k) {
+					var fz = v.fontSize;
+
+					if (fz >= 1 && fz <= 7)
+						fz = t.sizes[parseInt(fz) - 1] + 'pt';
+
+					c.add(k, v, {'style' : 'font-size:' + fz, 'class' : 'mceFontSize' + (i++) + (' ' + (v['class'] || ''))});
+				});
+			}
+
+			return c;
+		},
+
+		_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', onselect : function(v) {
+				t.editor.execCommand('FormatBlock', false, v);
+				return false;
+			}});
+
+			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});
+				});
+			}
+
+			return c;
+		},
+
+		_createForeColorMenu : 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);
+						}
+					});
+				};
+			}
+
+			if (v = s.theme_advanced_text_colors)
+				o.colors = v;
+
+			if (s.theme_advanced_default_foreground_color)
+				o.default_color = s.theme_advanced_default_foreground_color;
+
+			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);
+						}
+					});
+				};
+			}
+
+			if (v = s.theme_advanced_background_colors)
+				o.colors = v;
+
+			if (s.theme_advanced_default_background_color)
+				o.default_color = s.theme_advanced_default_background_color;
+
+			o.title = 'advanced.backcolor_desc';
+			o.cmd = 'HiliteColor';
+			o.scope = this;
+
+			c = t.editor.controlManager.createColorSplitButton('backcolor', o);
+
+			return c;
+		},
+
+		renderUI : function(o) {
+			var n, ic, tb, t = this, ed = t.editor, s = t.settings, sc, p, nl;
+
+			if (ed.settings) {
+				ed.settings.aria_label = s.aria_label + ed.getLang('advanced.help_shortcut');
+			}
+
+			// TODO: ACC Should have an aria-describedby attribute which is user-configurable to describe what this field is actually for.
+			// Maybe actually inherit it from the original textara?
+			n = p = DOM.create('span', {role : 'application', 'aria-labelledby' : ed.id + '_voice', id : ed.id + '_parent', 'class' : 'mceEditor ' + ed.settings.skin + 'Skin' + (s.skin_variant ? ' ' + ed.settings.skin + 'Skin' + t._ufirst(s.skin_variant) : '')});
+			DOM.add(n, 'span', {'class': 'mceVoiceLabel', 'style': 'display:none;', id: ed.id + '_voice'}, s.aria_label);
+
+			if (!DOM.boxModel)
+				n = DOM.add(n, 'div', {'class' : 'mceOldBoxModel'});
+
+			n = sc = DOM.add(n, 'table', {role : "presentation", id : ed.id + '_tbl', 'class' : 'mceLayout', cellSpacing : 0, cellPadding : 0});
+			n = tb = DOM.add(n, 'tbody');
+
+			switch ((s.theme_advanced_layout_manager || '').toLowerCase()) {
+				case "rowlayout":
+					ic = t._rowLayout(s, tb, o);
+					break;
+
+				case "customlayout":
+					ic = ed.execCallback("theme_advanced_custom_layout", s, tb, o, p);
+					break;
+
+				default:
+					ic = t._simpleLayout(s, tb, o, p);
+			}
+
+			n = o.targetNode;
+
+			// Add classes to first and last TRs
+			nl = sc.rows;
+			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 (DOM.get(s.theme_advanced_toolbar_container))
+				DOM.get(s.theme_advanced_toolbar_container).appendChild(p);
+			else
+				DOM.insertAfter(p, n);
+
+			Event.add(ed.id + '_path_row', 'click', function(e) {
+				e = e.target;
+
+				if (e.nodeName == 'A') {
+					t._sel(e.className.replace(/^.*mcePath_([0-9]+).*$/, '$1'));
+
+					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);
+					}
+				});
+
+				Event.add(ed.id + '_tbl', 'mouseout', function(e) {
+					if (t.lastPath) {
+						DOM.setHTML(ed.id + '_path_row', t.lastPath);
+						t.lastPath = 0;
+					}
+				});
+			}
+*/
+
+			if (!ed.getParam('accessibility_focus'))
+				Event.add(DOM.add(p, 'a', {href : '#'}, '<!-- IE -->'), 'focus', function() {tinyMCE.get(ed.id).focus();});
+
+			if (s.theme_advanced_toolbar_location == 'external')
+				o.deltaHeight = 0;
+
+			t.deltaHeight = o.deltaHeight;
+			o.targetNode = null;
+
+			ed.onKeyDown.add(function(ed, evt) {
+				var DOM_VK_F10 = 121, DOM_VK_F11 = 122;
+
+				if (evt.altKey) {
+		 			if (evt.keyCode === DOM_VK_F10) {
+						t.toolbarGroup.focus();
+						return Event.cancel(evt);
+					} else if (evt.keyCode === DOM_VK_F11) {
+						DOM.get(ed.id + '_path_row').focus();
+						return Event.cancel(evt);
+					}
+				}
+			});
+
+			// alt+0 is the UK recommended shortcut for accessing the list of access controls.
+			ed.addShortcut('alt+0', '', 'mceShortcuts', t);
+
+			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
+			}
+		},
+
+		resizeBy : function(dw, dh) {
+			var e = DOM.get(this.editor.id + '_ifr');
+
+			this.resizeTo(e.clientWidth + dw, e.clientHeight + dh);
+		},
+
+		resizeTo : function(w, h, store) {
+			var ed = this.editor, s = this.settings, e = DOM.get(ed.id + '_tbl'), ifr = DOM.get(ed.id + '_ifr');
+
+			// 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);
+
+			// Resize iframe and container
+			DOM.setStyle(e, 'height', '');
+			DOM.setStyle(ifr, 'height', h);
+
+			if (s.theme_advanced_resize_horizontal) {
+				DOM.setStyle(e, 'width', '');
+				DOM.setStyle(ifr, 'width', w);
+
+				// Make sure that the size is never smaller than the over all ui
+				if (w < e.clientWidth) {
+					w = e.clientWidth;
+					DOM.setStyle(ifr, 'width', e.clientWidth);
+				}
+			}
+
+			// Store away the size
+			if (store && s.theme_advanced_resizing_use_cookie) {
+				Cookie.setHash("TinyMCE_" + ed.id + "_size", {
+					cw : w,
+					ch : h
+				});
+			}
+		},
+
+		destroy : function() {
+			var id = this.editor.id;
+
+			Event.clear(id + '_resize');
+			Event.clear(id + '_path_row');
+			Event.clear(id + '_external_close');
+		},
+
+		// Internal functions
+
+		_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;
+
+			if (s.readonly) {
+				n = DOM.add(tb, 'tr');
+				n = ic = DOM.add(n, 'td', {'class' : 'mceIframeContainer'});
+				return ic;
+			}
+
+			// 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');
+
+				if (p.firstChild.className == 'mceOldBoxModel')
+					p.firstChild.appendChild(c);
+				else
+					p.insertBefore(c, p.firstChild);
+
+				t._addToolbars(etb, o);
+
+				ed.onMouseUp.add(function() {
+					var e = DOM.get(ed.id + '_external');
+					DOM.show(e);
+
+					DOM.hide(lastExtID);
+
+					var f = Event.add(ed.id + '_external_close', 'click', function() {
+						DOM.hide(ed.id + '_external');
+						Event.remove(ed.id + '_external_close', 'click', f);
+					});
+
+					DOM.show(e);
+					DOM.setStyle(e, 'top', 0 - DOM.getRect(ed.id + '_tblext').h - 1);
+
+					// Fixes IE rendering bug
+					DOM.hide(e);
+					DOM.show(e);
+					e.style.filter = '';
+
+					lastExtID = ed.id + '_external';
+
+					e = null;
+				});
+			}
+
+			if (sl == 'top')
+				t._addStatusBar(tb, o);
+
+			// Create iframe container
+			if (!s.theme_advanced_toolbar_container) {
+				n = DOM.add(tb, 'tr');
+				n = ic = DOM.add(n, 'td', {'class' : 'mceIframeContainer'});
+			}
+
+			// Create toolbar container at bottom
+			if (lo == 'bottom')
+				t._addToolbars(tb, o);
+
+			if (sl == 'bottom')
+				t._addStatusBar(tb, o);
+
+			return ic;
+		},
+
+		_rowLayout : function(s, tb, o) {
+			var t = this, ed = t.editor, dc, da, cf = ed.controlManager, n, ic, to, a;
+
+			dc = s.theme_advanced_containers_default_class || '';
+			da = s.theme_advanced_containers_default_align || 'center';
+
+			each(explode(s.theme_advanced_containers || ''), function(c, i) {
+				var v = s['theme_advanced_container_' + c] || '';
+
+				switch (v.toLowerCase()) {
+					case 'mceeditor':
+						n = DOM.add(tb, 'tr');
+						n = ic = DOM.add(n, 'td', {'class' : 'mceIframeContainer'});
+						break;
+
+					case 'mceelementpath':
+						t._addStatusBar(tb, o);
+						break;
+
+					default:
+						a = (s['theme_advanced_container_' + c + '_align'] || da).toLowerCase();
+						a = 'mce' + t._ufirst(a);
+
+						n = DOM.add(DOM.add(tb, 'tr'), 'td', {
+							'class' : 'mceToolbar ' + (s['theme_advanced_container_' + c + '_class'] || dc) + ' ' + a || da
+						});
+
+						to = cf.createToolbar("toolbar" + i);
+						t._addControls(v, to);
+						DOM.setHTML(n, to.renderHTML());
+						o.deltaHeight -= s.theme_advanced_row_height;
+				}
+			});
+
+			return ic;
+		},
+
+		_addControls : function(v, tb) {
+			var t = this, s = t.settings, di, cf = t.editor.controlManager;
+
+			if (s.theme_advanced_disable && !t._disabled) {
+				di = {};
+
+				each(explode(s.theme_advanced_disable), function(v) {
+					di[v] = 1;
+				});
+
+				t._disabled = di;
+			} else
+				di = t._disabled;
+
+			each(explode(v), function(n) {
+				var c;
+
+				if (di && di[n])
+					return;
+
+				// 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);
+
+						if (n)
+							tb.add(n);
+					});
+
+					return;
+				}
+
+				c = t.createControl(n, cf);
+
+				if (c)
+					tb.add(c);
+			});
+		},
+
+		_addToolbars : function(c, o) {
+			var t = this, i, tb, ed = t.editor, s = t.settings, v, cf = ed.controlManager, di, n, h = [], a, toolbarGroup;
+
+			toolbarGroup = cf.createToolbarGroup('toolbargroup', {
+				'name': ed.getLang('advanced.toolbar'),
+				'tab_focus_toolbar':ed.getParam('theme_advanced_tab_focus_toolbar')
+			});
+
+			t.toolbarGroup = toolbarGroup;
+
+			a = s.theme_advanced_toolbar_align.toLowerCase();
+			a = 'mce' + t._ufirst(a);
+
+			n = DOM.add(DOM.add(c, 'tr', {role: 'presentation'}), 'td', {'class' : 'mceToolbar ' + a, "role":"presentation"});
+
+			// 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 (s['theme_advanced_buttons' + i + '_add'])
+					v += ',' + s['theme_advanced_buttons' + i + '_add'];
+
+				if (s['theme_advanced_buttons' + i + '_add_before'])
+					v = s['theme_advanced_buttons' + i + '_add_before'] + ',' + v;
+
+				t._addControls(v, tb);
+				toolbarGroup.add(tb);
+
+				o.deltaHeight -= s.theme_advanced_row_height;
+			}
+			h.push(toolbarGroup.renderHTML());
+			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(''));
+		},
+
+		_addStatusBar : function(tb, o) {
+			var n, t = this, ed = t.editor, s = t.settings, r, mf, me, td;
+
+			n = DOM.add(tb, 'tr');
+			n = td = DOM.add(n, 'td', {'class' : 'mceStatusbar'}); 
+			n = DOM.add(n, 'div', {id : ed.id + '_path_row', 'role': 'group', 'aria-labelledby': ed.id + '_path_voice'});
+			if (s.theme_advanced_path) {
+				DOM.add(n, 'span', {id: ed.id + '_path_voice'}, ed.translate('advanced.path'));
+				DOM.add(n, 'span', {}, ': ');
+			} else {
+				DOM.add(n, 'span', {}, '&#160;');
+			}
+			
+
+			if (s.theme_advanced_resizing) {
+				DOM.add(td, 'a', {id : ed.id + '_resize', href : 'javascript:;', onclick : "return false;", 'class' : 'mceResize'});
+
+				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 (!o)
+							return;
+
+						t.resizeTo(o.cw, o.ch);
+					});
+				}
+
+				ed.onPostRender.add(function() {
+					Event.add(ed.id + '_resize', 'click', function(e) {
+						e.preventDefault();
+					});
+
+					Event.add(ed.id + '_resize', 'mousedown', function(e) {
+						var mouseMoveHandler1, mouseMoveHandler2,
+							mouseUpHandler1, mouseUpHandler2,
+							startX, startY, startWidth, startHeight, width, height, ifrElm;
+
+						function resizeOnMove(e) {
+							e.preventDefault();
+
+							width = startWidth + (e.screenX - startX);
+							height = startHeight + (e.screenY - startY);
+
+							t.resizeTo(width, height);
+						};
+
+						function endResize(e) {
+							// Stop listening
+							Event.remove(DOM.doc, 'mousemove', mouseMoveHandler1);
+							Event.remove(ed.getDoc(), 'mousemove', mouseMoveHandler2);
+							Event.remove(DOM.doc, 'mouseup', mouseUpHandler1);
+							Event.remove(ed.getDoc(), 'mouseup', mouseUpHandler2);
+
+							width = startWidth + (e.screenX - startX);
+							height = startHeight + (e.screenY - startY);
+							t.resizeTo(width, height, true);
+						};
+
+						e.preventDefault();
+
+						// Get the current rect size
+						startX = e.screenX;
+						startY = e.screenY;
+						ifrElm = DOM.get(t.editor.id + '_ifr');
+						startWidth = width = ifrElm.clientWidth;
+						startHeight = height = ifrElm.clientHeight;
+
+						// Register envent handlers
+						mouseMoveHandler1 = Event.add(DOM.doc, 'mousemove', resizeOnMove);
+						mouseMoveHandler2 = Event.add(ed.getDoc(), 'mousemove', resizeOnMove);
+						mouseUpHandler1 = Event.add(DOM.doc, 'mouseup', endResize);
+						mouseUpHandler2 = Event.add(ed.getDoc(), 'mouseup', endResize);
+					});
+				});
+			}
+
+			o.deltaHeight -= 21;
+			n = tb = null;
+		},
+
+		_updateUndoStatus : function(ed) {
+			var cm = ed.controlManager;
+
+			cm.setDisabled('undo', !ed.undoManager.hasUndo() && !ed.typing);
+			cm.setDisabled('redo', !ed.undoManager.hasRedo());
+		},
+
+		_nodeChanged : function(ed, cm, n, co, ob) {
+			var t = this, p, de = 0, v, c, s = t.settings, cl, fz, fn, fc, bc, formatNames, matches;
+
+			tinymce.each(t.stateControls, function(c) {
+				cm.setActive(c, ed.queryCommandState(t.controls[c][1]));
+			});
+
+			function getParent(name) {
+				var i, parents = ob.parents, func = name;
+
+				if (typeof(name) == 'string') {
+					func = function(node) {
+						return node.nodeName == name;
+					};
+				}
+
+				for (i = 0; i < parents.length; i++) {
+					if (func(parents[i]))
+						return parents[i];
+				}
+			};
+
+			cm.setActive('visualaid', ed.hasVisual);
+			t._updateUndoStatus(ed);
+			cm.setDisabled('outdent', !ed.queryCommandState('Outdent'));
+
+			p = getParent('A');
+			if (c = cm.get('link')) {
+				if (!p || !p.name) {
+					c.setDisabled(!p && co);
+					c.setActive(!!p);
+				}
+			}
+
+			if (c = cm.get('unlink')) {
+				c.setDisabled(!p && co);
+				c.setActive(!!p && !p.name);
+			}
+
+			if (c = cm.get('anchor')) {
+				c.setActive(!co && !!p && p.name);
+			}
+
+			p = getParent('IMG');
+			if (c = cm.get('image'))
+				c.setActive(!co && !!p && n.className.indexOf('mceItem') == -1);
+
+			if (c = cm.get('styleselect')) {
+				t._importClasses();
+
+				formatNames = [];
+				each(c.items, function(item) {
+					formatNames.push(item.value);
+				});
+
+				matches = ed.formatter.matchAll(formatNames);
+				c.select(matches[0]);
+			}
+
+			if (c = cm.get('formatselect')) {
+				p = getParent(DOM.isBlock);
+
+				if (p)
+					c.select(p.nodeName.toLowerCase());
+			}
+
+			// Find out current fontSize, fontFamily and fontClass
+			getParent(function(n) {
+				if (n.nodeName === 'SPAN') {
+					if (!cl && n.className)
+						cl = n.className;
+				}
+
+				if (ed.dom.is(n, s.theme_advanced_font_selector)) {
+					if (!fz && n.style.fontSize)
+						fz = n.style.fontSize;
+
+					if (!fn && n.style.fontFamily)
+						fn = n.style.fontFamily.replace(/[\"\']+/g, '').replace(/^([^,]+).*/, '$1').toLowerCase();
+					
+					if (!fc && n.style.color)
+						fc = n.style.color;
+
+					if (!bc && n.style.backgroundColor)
+						bc = n.style.backgroundColor;
+				}
+
+				return false;
+			});
+
+			if (c = cm.get('fontselect')) {
+				c.select(function(v) {
+					return v.replace(/^([^,]+).*/, '$1').toLowerCase() == fn;
+				});
+			}
+
+			// Select font size
+			if (c = cm.get('fontsizeselect')) {
+				// Use computed style
+				if (s.theme_advanced_runtime_fontsize && !fz && !cl)
+					fz = ed.dom.getStyle(n, 'fontSize', true);
+
+				c.select(function(v) {
+					if (v.fontSize && v.fontSize === fz)
+						return true;
+
+					if (v['class'] && v['class'] === cl)
+						return true;
+				});
+			}
+			
+			if (s.theme_advanced_show_current_color) {
+				function updateColor(controlId, color) {
+					if (c = cm.get(controlId)) {
+						if (!color)
+							color = c.settings.default_color;
+						if (color !== c.value) {
+							c.displayColor(color);
+						}
+					}
+				}
+				updateColor('forecolor', fc);
+				updateColor('backcolor', bc);
+			}
+
+			if (s.theme_advanced_show_current_color) {
+				function updateColor(controlId, color) {
+					if (c = cm.get(controlId)) {
+						if (!color)
+							color = c.settings.default_color;
+						if (color !== c.value) {
+							c.displayColor(color);
+						}
+					}
+				};
+
+				updateColor('forecolor', fc);
+				updateColor('backcolor', bc);
+			}
+
+			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'});
+
+				if (t.statusKeyboardNavigation) {
+					t.statusKeyboardNavigation.destroy();
+					t.statusKeyboardNavigation = null;
+				}
+
+				DOM.setHTML(p, '');
+
+				getParent(function(n) {
+					var na = n.nodeName.toLowerCase(), u, pi, ti = '';
+
+					if (n.getAttribute('data-mce-bogus'))
+						return;
+
+					// Ignore non element and hidden elements
+					if (n.nodeType != 1 || n.nodeName === 'BR' || (DOM.hasClass(n, 'mceItemHidden') || DOM.hasClass(n, 'mceItemRemoved')))
+						return;
+
+					// 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;
+
+						case 'i':
+							na = 'em';
+							break;
+
+						case 'img':
+							if (v = DOM.getAttrib(n, 'src'))
+								ti += 'src: ' + v + ' ';
+
+							break;
+
+						case 'a':
+							if (v = DOM.getAttrib(n, 'name')) {
+								ti += 'name: ' + v + ' ';
+								na += '#' + v;
+							}
+
+							if (v = DOM.getAttrib(n, 'href'))
+								ti += 'href: ' + v + ' ';
+
+							break;
+
+						case 'font':
+							if (v = DOM.getAttrib(n, 'face'))
+								ti += 'font: ' + v + ' ';
+
+							if (v = DOM.getAttrib(n, 'size'))
+								ti += 'size: ' + v + ' ';
+
+							if (v = DOM.getAttrib(n, 'color'))
+								ti += 'color: ' + v + ' ';
+
+							break;
+
+						case 'span':
+							if (v = DOM.getAttrib(n, 'style'))
+								ti += 'style: ' + v + ' ';
+
+							break;
+					}
+
+					if (v = DOM.getAttrib(n, 'id'))
+						ti += 'id: ' + v + ' ';
+
+					if (v = n.className) {
+						v = v.replace(/\b\s*(webkit|mce|Apple-)\w+\s*\b/g, '')
+
+						if (v) {
+							ti += 'class: ' + v + ' ';
+
+							if (DOM.isBlock(n) || na == 'img' || na == 'span')
+								na += '.' + v;
+						}
+					}
+
+					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:;", role: 'button', onmousedown : "return false;", title : ti, 'class' : 'mcePath_' + (de++)}, na);
+
+					if (p.hasChildNodes()) {
+						p.insertBefore(DOM.create('span', {'aria-hidden': 'true'}, '\u00a0\u00bb '), p.firstChild);
+						p.insertBefore(pi, p.firstChild);
+					} else
+						p.appendChild(pi);
+				}, ed.getBody());
+
+				if (DOM.select('a', p).length > 0) {
+					t.statusKeyboardNavigation = new tinymce.ui.KeyboardNavigation({
+						root: ed.id + "_path_row",
+						items: DOM.select('a', p),
+						excludeFromTabOrder: true,
+						onCancel: function() {
+							ed.focus();
+						}
+					}, DOM);
+				}
+			}
+		},
+
+		// Commands gets called by execCommand
+
+		_sel : function(v) {
+			this.editor.execCommand('mceSelectNodeDepth', false, v);
+		},
+
+		_mceInsertAnchor : function(ui, v) {
+			var ed = this.editor;
+
+			ed.windowManager.open({
+				url : this.url + '/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 : this.url + '/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 : this.url + '/about.htm',
+				width : 480,
+				height : 380,
+				inline : true
+			}, {
+				theme_url : this.url
+			});
+		},
+
+		_mceShortcuts : function() {
+			var ed = this.editor;
+			ed.windowManager.open({
+				url: this.url + '/shortcuts.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 : this.url + '/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 : this.url + '/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 : this.url + '/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 : this.url + '/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);
+				}
+			});
+		},
+
+		_ufirst : function(s) {
+			return s.substring(0, 1).toUpperCase() + s.substring(1);
+		}
+	});
+
+	tinymce.ThemeManager.add('advanced', tinymce.themes.AdvancedTheme);
+}(tinymce));
diff -x .svn -aruN 0.7.24.src/e107_handlers/tiny_mce/themes/advanced/image.htm 0.7.26.src/e107_handlers/tiny_mce/themes/advanced/image.htm
--- 0.7.24.src/e107_handlers/tiny_mce/themes/advanced/image.htm	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_handlers/tiny_mce/themes/advanced/image.htm	2011-03-12 04:48:11.000000000 -0600
@@ -1,85 +1,80 @@
-<!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>{#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" 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;">{#advanced_dlg.image_title}</a></span></li>
-		</ul>
-	</div>
-
-	<div class="panel_wrapper">
-		<div id="general_panel" class="panel current">
-     <table border="0" cellpadding="4" cellspacing="0">
-          <tr>
-            <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" class="mceFocus" value="" style="width: 200px" onchange="ImageDialog.getImageData();" /></td>
-                  <td id="srcbrowsercontainer">&nbsp;</td>
-                </tr>
-              </table></td>
-          </tr>
-		  <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 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="5" /></td>
-          </tr>
-          <tr>
-            <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 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 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>
-	</div>
-
-	<div class="mceActionPanel">
-		<div style="float: left">
-			<input type="submit" id="insert" name="insert" value="{#insert}" />
-		</div>
-
-		<div style="float: right">
-			<input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />
-		</div>
-	</div>
-</form>
-</body>
-</html>
+<!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>{#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" 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;">{#advanced_dlg.image_title}</a></span></li>
+		</ul>
+	</div>
+
+	<div class="panel_wrapper">
+		<div id="general_panel" class="panel current">
+			<table border="0" cellpadding="4" cellspacing="0">
+				<tr>
+					<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" class="mceFocus" value="" style="width: 200px" onchange="ImageDialog.getImageData();" /></td>
+							<td id="srcbrowsercontainer">&nbsp;</td>
+						</tr>
+					</table></td>
+				</tr>
+				<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 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="5" /></td>
+				</tr>
+				<tr>
+				<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 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 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>
+	</div>
+
+	<div class="mceActionPanel">
+		<input type="submit" id="insert" name="insert" value="{#insert}" />
+		<input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />
+	</div>
+</form>
+</body>
+</html>
diff -x .svn -aruN 0.7.24.src/e107_handlers/tiny_mce/themes/advanced/img/icons.gif 0.7.26.src/e107_handlers/tiny_mce/themes/advanced/img/icons.gif
--- 0.7.24.src/e107_handlers/tiny_mce/themes/advanced/img/icons.gif	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_handlers/tiny_mce/themes/advanced/img/icons.gif	2010-10-09 17:21:36.000000000 -0500
@@ -75,4 +75,5 @@
 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
+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?_xHB@YMwwwxZ^(HF+N O_xxxxzg(+Wy#Bxxoyy^w'H+h7JJH7rz/z?z=_+  $XzzzO@(t hO;X@{{cY{{?$XUŇ!Ƴ{ȏ|ɟ|B Xz}F|}/}gO}]fTKO0}}7zWgWKgTF=Ym_~o~wOXOGY~~vwG׆[ouxx|~LOHjD ],h 
+2l!Ĉ'Rh"ƌ7r#Ȑ"G,i$ʔ*WX׃2gʬp..\tMh'РB-j(ҤJ2m#_4D*֬Zr+ذbǒ-k,ڴjײm-ܸrҭk.޼z/ ;
\ No newline at end of file
diff -x .svn -aruN 0.7.24.src/e107_handlers/tiny_mce/themes/advanced/js/about.js 0.7.26.src/e107_handlers/tiny_mce/themes/advanced/js/about.js
--- 0.7.24.src/e107_handlers/tiny_mce/themes/advanced/js/about.js	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_handlers/tiny_mce/themes/advanced/js/about.js	2011-03-12 04:48:11.000000000 -0600
@@ -1,72 +1,73 @@
-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);
+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';
+		document.getElementById('help_tab').setAttribute("aria-hidden", "false");
+	}
+}
+
+tinyMCEPopup.onInit.add(init);
diff -x .svn -aruN 0.7.24.src/e107_handlers/tiny_mce/themes/advanced/js/anchor.js 0.7.26.src/e107_handlers/tiny_mce/themes/advanced/js/anchor.js
--- 0.7.24.src/e107_handlers/tiny_mce/themes/advanced/js/anchor.js	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_handlers/tiny_mce/themes/advanced/js/anchor.js	2011-03-12 04:48:11.000000000 -0600
@@ -1,37 +1,42 @@
-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);
+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');
+		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, elm, name = document.forms[0].anchorName.value;
+
+		if (!name || !/^[a-z][a-z0-9\-\_:\.]*$/i.test(name)) {
+			tinyMCEPopup.alert('advanced_dlg.anchor_invalid');
+			return;
+		}
+
+		tinyMCEPopup.restoreSelection();
+
+		if (this.action != 'update')
+			ed.selection.collapse(1);
+
+		elm = ed.dom.getParent(ed.selection.getNode(), 'A');
+		if (elm)
+			elm.name = name;
+		else
+			ed.execCommand('mceInsertContent', 0, ed.dom.createHTML('a', {name : name, 'class' : 'mceItemAnchor'}, ''));
+
+		tinyMCEPopup.close();
+	}
+};
+
+tinyMCEPopup.onInit.add(AnchorDialog.init, AnchorDialog);
diff -x .svn -aruN 0.7.24.src/e107_handlers/tiny_mce/themes/advanced/js/charmap.js 0.7.26.src/e107_handlers/tiny_mce/themes/advanced/js/charmap.js
--- 0.7.24.src/e107_handlers/tiny_mce/themes/advanced/js/charmap.js	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_handlers/tiny_mce/themes/advanced/js/charmap.js	2011-03-30 03:22:40.000000000 -0500
@@ -1,325 +1,355 @@
-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;
-}
+/**
+ * charmap.js
+ *
+ * Copyright 2009, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://tinymce.moxiecode.com/license
+ * Contributing: http://tinymce.moxiecode.com/contributing
+ */
+
+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;', true, '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());
+	addKeyboardNavigation();
+});
+
+function addKeyboardNavigation(){
+	var tableElm, cells, settings;
+
+	cells = tinyMCEPopup.dom.select(".charmaplink", "charmapgroup");
+
+	settings ={
+		root: "charmapgroup",
+		items: cells
+	};
+
+	tinyMCEPopup.editor.windowManager.createInstance('tinymce.ui.KeyboardNavigation', settings, tinyMCEPopup.dom);
+}
+
+function renderCharMapHTML() {
+	var charsPerRow = 20, tdWidth=20, tdHeight=20, i;
+	var html = '<div id="charmapgroup" aria-labelledby="charmap_label" tabindex="0" role="listbox">'+
+	'<table role="presentation" border="0" cellspacing="1" cellpadding="0" width="' + (tdWidth*charsPerRow) + 
+	'"><tr height="' + tdHeight + '">';
+	var cols=-1;
+
+	for (i=0; i<charmap.length; i++) {
+		var previewCharFn;
+
+		if (charmap[i][2]==true) {
+			cols++;
+			previewCharFn = 'previewChar(\'' + charmap[i][1].substring(1,charmap[i][1].length) + '\',\'' + charmap[i][0].substring(1,charmap[i][0].length) + '\',\'' + charmap[i][3] + '\');';
+			html += ''
+				+ '<td class="charmap">'
+				+ '<a class="charmaplink" role="button" onmouseover="'+previewCharFn+'" onfocus="'+previewCharFn+'" 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></div>';
+	html = html.replace(/<tr height="20"><\/tr>/g, '');
+
+	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.24.src/e107_handlers/tiny_mce/themes/advanced/js/color_picker.js 0.7.26.src/e107_handlers/tiny_mce/themes/advanced/js/color_picker.js
--- 0.7.24.src/e107_handlers/tiny_mce/themes/advanced/js/color_picker.js	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_handlers/tiny_mce/themes/advanced/js/color_picker.js	2011-03-12 04:48:11.000000000 -0600
@@ -1,253 +1,329 @@
-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);
+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':'Alice Blue','#FAEBD7':'Antique White','#00FFFF':'Aqua','#7FFFD4':'Aquamarine','#F0FFFF':'Azure','#F5F5DC':'Beige',
+	'#FFE4C4':'Bisque','#000000':'Black','#FFEBCD':'Blanched Almond','#0000FF':'Blue','#8A2BE2':'Blue Violet','#A52A2A':'Brown',
+	'#DEB887':'Burly Wood','#5F9EA0':'Cadet Blue','#7FFF00':'Chartreuse','#D2691E':'Chocolate','#FF7F50':'Coral','#6495ED':'Cornflower Blue',
+	'#FFF8DC':'Cornsilk','#DC143C':'Crimson','#00FFFF':'Cyan','#00008B':'Dark Blue','#008B8B':'Dark Cyan','#B8860B':'Dark Golden Rod',
+	'#A9A9A9':'Dark Gray','#A9A9A9':'Dark Grey','#006400':'Dark Green','#BDB76B':'Dark Khaki','#8B008B':'Dark Magenta','#556B2F':'Dark Olive Green',
+	'#FF8C00':'Darkorange','#9932CC':'Dark Orchid','#8B0000':'Dark Red','#E9967A':'Dark Salmon','#8FBC8F':'Dark Sea Green','#483D8B':'Dark Slate Blue',
+	'#2F4F4F':'Dark Slate Gray','#2F4F4F':'Dark Slate Grey','#00CED1':'Dark Turquoise','#9400D3':'Dark Violet','#FF1493':'Deep Pink','#00BFFF':'Deep Sky Blue',
+	'#696969':'Dim Gray','#696969':'Dim Grey','#1E90FF':'Dodger Blue','#B22222':'Fire Brick','#FFFAF0':'Floral White','#228B22':'Forest Green',
+	'#FF00FF':'Fuchsia','#DCDCDC':'Gainsboro','#F8F8FF':'Ghost White','#FFD700':'Gold','#DAA520':'Golden Rod','#808080':'Gray','#808080':'Grey',
+	'#008000':'Green','#ADFF2F':'Green Yellow','#F0FFF0':'Honey Dew','#FF69B4':'Hot Pink','#CD5C5C':'Indian Red','#4B0082':'Indigo','#FFFFF0':'Ivory',
+	'#F0E68C':'Khaki','#E6E6FA':'Lavender','#FFF0F5':'Lavender Blush','#7CFC00':'Lawn Green','#FFFACD':'Lemon Chiffon','#ADD8E6':'Light Blue',
+	'#F08080':'Light Coral','#E0FFFF':'Light Cyan','#FAFAD2':'Light Golden Rod Yellow','#D3D3D3':'Light Gray','#D3D3D3':'Light Grey','#90EE90':'Light Green',
+	'#FFB6C1':'Light Pink','#FFA07A':'Light Salmon','#20B2AA':'Light Sea Green','#87CEFA':'Light Sky Blue','#778899':'Light Slate Gray','#778899':'Light Slate Grey',
+	'#B0C4DE':'Light Steel Blue','#FFFFE0':'Light Yellow','#00FF00':'Lime','#32CD32':'Lime Green','#FAF0E6':'Linen','#FF00FF':'Magenta','#800000':'Maroon',
+	'#66CDAA':'Medium Aqua Marine','#0000CD':'Medium Blue','#BA55D3':'Medium Orchid','#9370D8':'Medium Purple','#3CB371':'Medium Sea Green','#7B68EE':'Medium Slate Blue',
+	'#00FA9A':'Medium Spring Green','#48D1CC':'Medium Turquoise','#C71585':'Medium Violet Red','#191970':'Midnight Blue','#F5FFFA':'Mint Cream','#FFE4E1':'Misty Rose','#FFE4B5':'Moccasin',
+	'#FFDEAD':'Navajo White','#000080':'Navy','#FDF5E6':'Old Lace','#808000':'Olive','#6B8E23':'Olive Drab','#FFA500':'Orange','#FF4500':'Orange Red','#DA70D6':'Orchid',
+	'#EEE8AA':'Pale Golden Rod','#98FB98':'Pale Green','#AFEEEE':'Pale Turquoise','#D87093':'Pale Violet Red','#FFEFD5':'Papaya Whip','#FFDAB9':'Peach Puff',
+	'#CD853F':'Peru','#FFC0CB':'Pink','#DDA0DD':'Plum','#B0E0E6':'Powder Blue','#800080':'Purple','#FF0000':'Red','#BC8F8F':'Rosy Brown','#4169E1':'Royal Blue',
+	'#8B4513':'Saddle Brown','#FA8072':'Salmon','#F4A460':'Sandy Brown','#2E8B57':'Sea Green','#FFF5EE':'Sea Shell','#A0522D':'Sienna','#C0C0C0':'Silver',
+	'#87CEEB':'Sky Blue','#6A5ACD':'Slate Blue','#708090':'Slate Gray','#708090':'Slate Grey','#FFFAFA':'Snow','#00FF7F':'Spring Green',
+	'#4682B4':'Steel Blue','#D2B48C':'Tan','#008080':'Teal','#D8BFD8':'Thistle','#FF6347':'Tomato','#40E0D0':'Turquoise','#EE82EE':'Violet',
+	'#F5DEB3':'Wheat','#FFFFFF':'White','#F5F5F5':'White Smoke','#FFFF00':'Yellow','#9ACD32':'Yellow Green'
+};
+
+var namedLookup = {};
+
+function init() {
+	var inputColor = convertRGBToHex(tinyMCEPopup.getWindowArg('input_color')), key, value;
+
+	tinyMCEPopup.resizeToInnerSize();
+
+	generatePicker();
+	generateWebColors();
+	generateNamedColors();
+
+	if (inputColor) {
+		changeFinalColor(inputColor);
+
+		col = convertHexToRGB(inputColor);
+
+		if (col)
+			updateLight(col.r, col.g, col.b);
+	}
+	
+	for (key in named) {
+		value = named[key];
+		namedLookup[value.replace(/\s+/, '').toLowerCase()] = key.replace(/#/, '').toLowerCase();
+	}
+}
+
+function toHexColor(color) {
+	var matches, red, green, blue, toInt = parseInt;
+
+	function hex(value) {
+		value = parseInt(value).toString(16);
+
+		return value.length > 1 ? value : '0' + value; // Padd with leading zero
+	};
+
+	color = color.replace(/[\s#]+/g, '').toLowerCase();
+	color = namedLookup[color] || color;
+	matches = /^rgb\((\d{1,3}),(\d{1,3}),(\d{1,3})\)|([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})|([a-f0-9])([a-f0-9])([a-f0-9])$/.exec(color);
+
+	if (matches) {
+		if (matches[1]) {
+			red = toInt(matches[1]);
+			green = toInt(matches[2]);
+			blue = toInt(matches[3]);
+		} else if (matches[4]) {
+			red = toInt(matches[4], 16);
+			green = toInt(matches[5], 16);
+			blue = toInt(matches[6], 16);
+		} else if (matches[7]) {
+			red = toInt(matches[7] + matches[7], 16);
+			green = toInt(matches[8] + matches[8], 16);
+			blue = toInt(matches[9] + matches[9], 16);
+		}
+
+		return '#' + hex(red) + hex(green) + hex(blue);
+	}
+
+	return '';
+}
+
+function insertAction() {
+	var color = document.getElementById("color").value, f = tinyMCEPopup.getWindowArg('func');
+
+	tinyMCEPopup.restoreSelection();
+
+	if (f)
+		f(toHexColor(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.toUpperCase();
+}
+
+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;
+
+	// TODO: VoiceOver doesn't seem to support legend as a label referenced by labelledby.
+	h += '<div role="listbox" aria-labelledby="webcolors_title" tabindex="0"><table role="presentation" 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();" role="option" tabindex="-1" aria-labelledby="web_colors_' + i + '" onfocus="showColor(\'' + colors[i] + '\');" onmouseover="showColor(\'' + colors[i] + '\');" style="display:block;width:10px;height:10px;overflow:hidden;">';
+		if (tinyMCEPopup.editor.forcedHighContrastMode) {
+			h += '<canvas class="mceColorSwatch" height="10" width="10" data-color="' + colors[i] + '"></canvas>';
+		}
+		h += '<span class="mceVoiceLabel" style="display:none;" id="web_colors_' + i + '">' + colors[i].toUpperCase() + '</span>';
+		h += '</a></td>';
+		if ((i+1) % 18 == 0)
+			h += '</tr><tr>';
+	}
+
+	h += '</table></div>';
+
+	el.innerHTML = h;
+	el.className = 'generated';
+
+	paintCanvas(el);
+	enableKeyboardNavigation(el.firstChild);
+}
+
+function paintCanvas(el) {
+	tinyMCEPopup.getWin().tinymce.each(tinyMCEPopup.dom.select('canvas.mceColorSwatch', el), function(canvas) {
+		var context;
+		if (canvas.getContext && (context = canvas.getContext("2d"))) {
+			context.fillStyle = canvas.getAttribute('data-color');
+			context.fillRect(0, 0, 10, 10);
+		}
+	});
+}
+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();" role="option" tabindex="-1" aria-labelledby="named_colors_' + i + '" onfocus="showColor(\'' + n + '\',\'' + v + '\');" onmouseover="showColor(\'' + n + '\',\'' + v + '\');" style="background-color: ' + n + '">';
+		if (tinyMCEPopup.editor.forcedHighContrastMode) {
+			h += '<canvas class="mceColorSwatch" height="10" width="10" data-color="' + colors[i] + '"></canvas>';
+		}
+		h += '<span class="mceVoiceLabel" style="display:none;" id="named_colors_' + i + '">' + v + '</span>';
+		h += '</a>';
+		i++;
+	}
+
+	el.innerHTML = h;
+	el.className = 'generated';
+
+	paintCanvas(el);
+	enableKeyboardNavigation(el);
+}
+
+function enableKeyboardNavigation(el) {
+	tinyMCEPopup.editor.windowManager.createInstance('tinymce.ui.KeyboardNavigation', {
+		root: el,
+		items: tinyMCEPopup.dom.select('a', el)
+	}, tinyMCEPopup.dom);
+}
+
+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.24.src/e107_handlers/tiny_mce/themes/advanced/js/image.js 0.7.26.src/e107_handlers/tiny_mce/themes/advanced/js/image.js
--- 0.7.24.src/e107_handlers/tiny_mce/themes/advanced/js/image.js	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_handlers/tiny_mce/themes/advanced/js/image.js	2011-03-12 04:48:11.000000000 -0600
@@ -1,245 +1,247 @@
-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);
+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.replace(/ /g, '%20'),
+			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);
+			tinyMCEPopup.editor.execCommand('mceRepaint');
+			tinyMCEPopup.editor.focus();
+		} 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), 'img');
+			this.styleVal = dom.serializeStyle(st, 'img');
+		}
+	},
+
+	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.24.src/e107_handlers/tiny_mce/themes/advanced/js/link.js 0.7.26.src/e107_handlers/tiny_mce/themes/advanced/js/link.js
--- 0.7.24.src/e107_handlers/tiny_mce/themes/advanced/js/link.js	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_handlers/tiny_mce/themes/advanced/js/link.js	2011-03-12 04:48:11.000000000 -0600
@@ -1,156 +1,153 @@
-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 ? getSelectValue(f, "target_list") : null,
-						'class' : f.class_list ? getSelectValue(f, "class_list") : null
-					});
-				}
-			});
-		} else {
-			ed.dom.setAttribs(e, {
-				href : f.href.value,
-				title : f.linktitle.value,
-				target : f.target_list ? getSelectValue(f, "target_list") : null,
-				'class' : f.class_list ? getSelectValue(f, "class_list") : 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);
+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, href = f.href.value.replace(/ /g, '%20');
+
+		tinyMCEPopup.restoreSelection();
+		e = ed.dom.getParent(ed.selection.getNode(), 'A');
+
+		// Remove element if there is no href
+		if (!f.href.value) {
+			if (e) {
+				b = ed.selection.getBookmark();
+				ed.dom.remove(e, 1);
+				ed.selection.moveToBookmark(b);
+				tinyMCEPopup.execCommand("mceEndUndoLevel");
+				tinyMCEPopup.close();
+				return;
+			}
+		}
+
+		// Create new anchor elements
+		if (e == null) {
+			ed.getDoc().execCommand("unlink", false, null);
+			tinyMCEPopup.execCommand("mceInsertLink", 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 : href,
+						title : f.linktitle.value,
+						target : f.target_list ? getSelectValue(f, "target_list") : null,
+						'class' : f.class_list ? getSelectValue(f, "class_list") : null
+					});
+				}
+			});
+		} else {
+			ed.dom.setAttribs(e, {
+				href : href,
+				title : f.linktitle.value,
+				target : f.target_list ? getSelectValue(f, "target_list") : null,
+				'class' : f.class_list ? getSelectValue(f, "class_list") : 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.24.src/e107_handlers/tiny_mce/themes/advanced/js/source_editor.js 0.7.26.src/e107_handlers/tiny_mce/themes/advanced/js/source_editor.js
--- 0.7.24.src/e107_handlers/tiny_mce/themes/advanced/js/source_editor.js	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_handlers/tiny_mce/themes/advanced/js/source_editor.js	2011-03-12 04:48:11.000000000 -0600
@@ -1,62 +1,56 @@
-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';
-}
+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');
+}
+
+function resizeInputs() {
+	var vp = tinyMCEPopup.dom.getViewPort(window), el;
+
+	el = document.getElementById('htmlSource');
+
+	if (el) {
+		el.style.width = (vp.w - 20) + 'px';
+		el.style.height = (vp.h - 65) + 'px';
+	}
+}
diff -x .svn -aruN 0.7.24.src/e107_handlers/tiny_mce/themes/advanced/langs/en_dlg.js 0.7.26.src/e107_handlers/tiny_mce/themes/advanced/langs/en_dlg.js
--- 0.7.24.src/e107_handlers/tiny_mce/themes/advanced/langs/en_dlg.js	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_handlers/tiny_mce/themes/advanced/langs/en_dlg.js	2011-03-30 03:22:40.000000000 -0500
@@ -1,51 +1,54 @@
-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"
+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",
+anchor_invalid:"Please specify a valid 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 be an external link. Do you want to add the required http:// prefix?",
+link_list:"Link list",
+accessibility_help:"Accessibility Help",
+accessibility_usage_title:"General Usage"
 });
\ No newline at end of file
diff -x .svn -aruN 0.7.24.src/e107_handlers/tiny_mce/themes/advanced/langs/en.js 0.7.26.src/e107_handlers/tiny_mce/themes/advanced/langs/en.js
--- 0.7.24.src/e107_handlers/tiny_mce/themes/advanced/langs/en.js	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_handlers/tiny_mce/themes/advanced/langs/en.js	2011-03-12 04:48:11.000000000 -0600
@@ -1,62 +1,68 @@
-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
+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",
+
+// Accessibility Strings
+shortcuts_desc:'Accessibility Help',
+help_shortcut:'. Press ALT F10 for toolbar. Press ALT 0 for help.',
+rich_text_area:"Rich Text Area",
+toolbar:"Toolbar"
+});
diff -x .svn -aruN 0.7.24.src/e107_handlers/tiny_mce/themes/advanced/link.htm 0.7.26.src/e107_handlers/tiny_mce/themes/advanced/link.htm
--- 0.7.24.src/e107_handlers/tiny_mce/themes/advanced/link.htm	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_handlers/tiny_mce/themes/advanced/link.htm	2011-03-12 04:48:11.000000000 -0600
@@ -1,63 +1,57 @@
-<!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>{#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" 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;">{#advanced_dlg.link_title}</a></span></li>
-		</ul>
-	</div>
-
-	<div class="panel_wrapper">
-		<div id="general_panel" class="panel current">
-
-		<table border="0" cellpadding="4" cellspacing="0">
-          <tr>
-            <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" class="mceFocus" value="" style="width: 200px" onchange="LinkDialog.checkPrefix(this);" /></td> 
-					<td id="hrefbrowsercontainer">&nbsp;</td>
-				  </tr> 
-				</table></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 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="submit" id="insert" name="insert" value="{#insert}" />
-		</div>
-
-		<div style="float: right">
-			<input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />
-		</div>
-	</div>
-</form>
-</body>
-</html>
+<!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>{#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" 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;">{#advanced_dlg.link_title}</a></span></li>
+		</ul>
+	</div>
+
+	<div class="panel_wrapper">
+		<div id="general_panel" class="panel current">
+			<table border="0" cellpadding="4" cellspacing="0">
+				<tr>
+					<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" class="mceFocus" value="" style="width: 200px" onchange="LinkDialog.checkPrefix(this);" /></td> 
+							<td id="hrefbrowsercontainer">&nbsp;</td>
+						</tr> 
+					</table></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 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">
+		<input type="submit" id="insert" name="insert" value="{#insert}" />
+		<input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />
+	</div>
+</form>
+</body>
+</html>
diff -x .svn -aruN 0.7.24.src/e107_handlers/tiny_mce/themes/advanced/skins/default/content.css 0.7.26.src/e107_handlers/tiny_mce/themes/advanced/skins/default/content.css
--- 0.7.24.src/e107_handlers/tiny_mce/themes/advanced/skins/default/content.css	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_handlers/tiny_mce/themes/advanced/skins/default/content.css	2011-03-12 04:48:11.000000000 -0600
@@ -1,32 +1,47 @@
-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;
-}
+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;}
+body.mceBrowserDefaults {background:transparent; color:inherit; font-size:inherit; font-family:inherit;}
+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 {display:inline-block; width:11px !important; height:11px  !important; background:url(img/items.gif) no-repeat 0 0;}
+span.mceItemNbsp {background: #DDD}
+td.mceSelected, th.mceSelected {background-color:#3399ff !important}
+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 {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;
+}
+
+img:-moz-broken {-moz-force-broken-image-icon:1; width:24px; height:24px}
+font[face=mceinline] {font-family:inherit !important}
+
+.mceItemMedia {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)}
+.mceItemVideo {background-image:url(../../img/video.gif)}
+.mceItemIframe {background-image:url(../../img/iframe.gif)}
+.mcePageBreak {display:block;border:0;width:100%;height:12px;border-top:1px dotted #ccc;margin-top:15px;background:#fff url(../../img/pagebreak.gif) no-repeat center top;}
diff -x .svn -aruN 0.7.24.src/e107_handlers/tiny_mce/themes/advanced/skins/default/dialog.css 0.7.26.src/e107_handlers/tiny_mce/themes/advanced/skins/default/dialog.css
--- 0.7.24.src/e107_handlers/tiny_mce/themes/advanced/skins/default/dialog.css	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_handlers/tiny_mce/themes/advanced/skins/default/dialog.css	2010-10-09 17:21:36.000000000 -0500
@@ -1,116 +1,117 @@
-/* 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
+/* 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;
+float:left;
+}
+
+#insert {background:url(img/buttons.png) 0 -52px}
+#cancel {background:url(img/buttons.png) 0 0; float:right}
+
+/* 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;}
diff -x .svn -aruN 0.7.24.src/e107_handlers/tiny_mce/themes/advanced/skins/default/ui.css 0.7.26.src/e107_handlers/tiny_mce/themes/advanced/skins/default/ui.css
--- 0.7.24.src/e107_handlers/tiny_mce/themes/advanced/skins/default/ui.css	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_handlers/tiny_mce/themes/advanced/skins/default/ui.css	2011-03-30 03:22:40.000000000 -0500
@@ -1,214 +1,213 @@
-/* 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}
+/* 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 {direction:ltr;background:transparent}
+.defaultSkin iframe {display:block;}
+.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 {background:#F0F0EE; padding-top:1px; vertical-align:top}
+.defaultSkin .mceIframeContainer {border-top:1px solid #CCC; border-bottom:1px solid #CCC}
+.defaultSkin .mceStatusbar {background:#F0F0EE; 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; outline:0}
+.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, .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-image:url(../../img/icons.gif);}
+.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}
+
+/* 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 span.mce_restoredraft {background-position:-20px -40px}
+.defaultSkin span.mce_spellchecker {background-position:-540px -20px}
diff -x .svn -aruN 0.7.24.src/e107_handlers/tiny_mce/themes/advanced/source_editor.htm 0.7.26.src/e107_handlers/tiny_mce/themes/advanced/source_editor.htm
--- 0.7.24.src/e107_handlers/tiny_mce/themes/advanced/source_editor.htm	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_handlers/tiny_mce/themes/advanced/source_editor.htm	2011-03-12 04:48:11.000000000 -0600
@@ -1,31 +1,25 @@
-<html xmlns="http://www.w3.org/1999/xhtml">
-<head>
-	<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
-	<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 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">{#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,monospace; font-size: 12px;" dir="ltr" wrap="off" class="mceFocus"></textarea>
-
-		<div class="mceActionPanel">
-			<div style="float: left">
-				<input type="submit" name="insert" value="{#update}" id="insert" />
-			</div>
-
-			<div style="float: right">
-				<input type="button" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" id="cancel" />
-			</div>
-		</div>
-	</form>
-</body>
-</html>
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+	<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 onresize="resizeInputs();" style="display:none; overflow:hidden;">
+	<form name="source" onsubmit="saveContent();return false;" action="#">
+		<div style="float: left" class="title"><label for="htmlSource">{#advanced_dlg.code_title}</label></div>
+
+		<div id="wrapline" style="float: right">
+			<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,monospace; font-size: 12px;" dir="ltr" wrap="off" class="mceFocus"></textarea>
+
+		<div class="mceActionPanel">
+			<input type="submit" role="button" name="insert" value="{#update}" id="insert" />
+			<input type="button" role="button" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" id="cancel" />
+		</div>
+	</form>
+</body>
+</html>
diff -x .svn -aruN 0.7.24.src/e107_handlers/tiny_mce/tiny_mce.js 0.7.26.src/e107_handlers/tiny_mce/tiny_mce.js
--- 0.7.24.src/e107_handlers/tiny_mce/tiny_mce.js	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_handlers/tiny_mce/tiny_mce.js	2011-03-30 03:22:40.000000000 -0500
@@ -1 +1 @@
-var tinymce={majorVersion:"3",minorVersion:"2.7",releaseDate:"2009-09-22",_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.indexOf("/")!==0){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|data):/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&&this.protocol==b.protocol?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,h=[],d,g;d=/\/$/.test(f)?"/":"";e=e.split("/");f=f.split("/");a(e,function(i){if(i){h.push(i)}});e=h;for(c=f.length-1,h=[];c>=0;c--){if(f[c].length==0||f[c]=="."){continue}if(f[c]==".."){b++;continue}if(b>0){b--;continue}h.push(f[c])}c=e.length-b;if(c<=0){g=h.reverse().join("/")}else{g=e.slice(0,c).join("/")+"/"+h.reverse().join("/")}if(g.indexOf("/")!==0){g="/"+g}if(d&&g.lastIndexOf("/")!==g.length-1){g+=d}return g},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.setRequestHeader("X-Requested-With","XMLHttpRequest");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},getNext:function(g,f){return this._findSib(g,f,"nextSibling")},getPrev:function(g,f){return this._findSib(g,f,"previousSibling")},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(/^(checked|compact|declare|defer|disabled|ismap|multiple|nohref|noshade|nowrap|readonly|selected)$/.test(j)){if(i[g.props[j]]===true&&f===""){return j}return f?j:""}if(i.nodeName==="FORM"&&i.getAttributeNode(j)){return i.getAttributeNode(j).nodeValue}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>/ig,'<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,k=[];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/i.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>/gi,function(h,m,l){if(!m){m=' type="text/javascript"'}m=m.replace(/src=\"([^\"]+)\"?/i,function(n,o){if(i.url_converter){o=g.encode(i.url_converter.call(i.url_converter_scope||g,g.decode(o),"src","script"))}return'mce_src="'+o+'"'});if(c.trim(l)){k.push(f(l));l="<!--\nMCE_SCRIPT:"+(k.length-1)+"\n// -->"}return"<mce:script"+m+">"+l+"</mce:script>"});j=j.replace(/<style([^>]+|)>([\s\S]*?)<\/style>/gi,function(h,m,l){if(l){k.push(f(l));l="<!--\nMCE_SCRIPT:"+(k.length-1)+"\n-->"}return"<mce:style"+m+">"+l+"</mce:style><style "+m+' mce_bogus="1">'+l+"</style>"});j=j.replace(/<noscript([^>]+|)>([\s\S]*?)<\/noscript>/g,function(h,m,l){return"<mce:noscript"+m+"><!--"+g.encode(l).replace(/--/g,"&#45;&#45;")+"--></mce:noscript>"})}j=j.replace(/<!\[CDATA\[([\s\S]+)\]\]>/g,"<!--[CDATA[$1]]-->");j=j.replace(/<([\w:]+) [^>]*(checked|compact|declare|defer|disabled|ismap|multiple|nohref|noshade|nowrap|readonly|selected)[^>]*>/gi,function(l){function h(o,m,n){if(n==="false"||n==="0"){return""}return" "+m+'="'+m+'"'}l=l.replace(/ (checked|compact|declare|defer|disabled|ismap|multiple|nohref|noshade|nowrap|readonly|selected)=[\"]([^\"]+)[\"]/gi,h);l=l.replace(/ (checked|compact|declare|defer|disabled|ismap|multiple|nohref|noshade|nowrap|readonly|selected)=[\']([^\']+)[\']/gi,h);l=l.replace(/ (checked|compact|declare|defer|disabled|ismap|multiple|nohref|noshade|nowrap|readonly|selected)=([^\s\"\'>]+)/gi,h);l=l.replace(/ (checked|compact|declare|defer|disabled|ismap|multiple|nohref|noshade|nowrap|readonly|selected)([\s>])/gi,' $1="$1"$2');return l});j=j.replace(/<([\w:]+) [^>]*(src|href|style|shape|coords)[^>]*>/gi,function(h,m){function l(o,n,q){var p=q;if(h.indexOf("mce_"+n)!=-1){return o}if(n=="style"){if(g._isRes(q)){return o}p=g.encode(g.serializeStyle(g.parseStyle(p)))}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,m))}}}return" "+n+'="'+q+'" mce_'+n+'="'+p+'"'}h=h.replace(/ (src|href|style|coords|shape)=[\"]([^\"]+)[\"]/gi,l);h=h.replace(/ (src|href|style|coords|shape)=[\']([^\']+)[\']/gi,l);return h.replace(/ (src|href|style|coords|shape)=([^\s\"\'>]+)/gi,l)});j=j.replace(/MCE_SCRIPT:([0-9]+)/g,function(l,h){return k[h]})}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(j,g,k){var f=this;function i(m,l,p){var q,o;o=p.createElement("body");o.innerHTML=l;q=o.lastChild;while(q){f.insertAfter(q.cloneNode(true),m);q=q.previousSibling}f.remove(m)}return this.run(j,function(l){l=f.get(l);if(l.nodeType==1){k=k||l.ownerDocument||f.doc;if(a){try{if(a&&l.nodeType==1){l.outerHTML=g}else{i(l,g,k)}}catch(h){i(l,g,k)}}else{i(l,g,k)}}})},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|TH|TBODY|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}if(g.nodeName==="OPTION"&&this.getAttrib(g,"selected")){f.push({specified:1,nodeName:"selected"})}g.cloneNode(false).outerHTML.replace(/<\/?[\w:]+ ?|=[\"][^\"]+\"|=\'[^\']+\'|=\w+|>/gi,"").replace(/[\w:]+/gi,function(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(l,k,o){var p=this,f=p.createRng(),m,j,n;function g(r,q){r=r[q];if(r&&r[q]&&r[q].nodeType==1&&i(r[q])){p.remove(r[q])}}function i(q){q=p.getOuterHTML(q);q=q.replace(/<(img|hr|table)/gi,"-");q=q.replace(/<[^>]+>/g,"");return q.replace(/[ \t\r\n]+|&nbsp;|&#160;/g,"")==""}function h(r){var q=0;while(r.previousSibling){q++;r=r.previousSibling}return q}if(l&&k){f.setStart(l.parentNode,h(l));f.setEnd(k.parentNode,h(k));m=f.extractContents();f=p.createRng();f.setStart(k.parentNode,h(k)+1);f.setEnd(l.parentNode,h(l)+1);j=f.extractContents();n=l.parentNode;g(m,"lastChild");if(!i(m)){n.insertBefore(m,l)}if(o){n.replaceChild(o,k)}else{n.insertBefore(k,l)}g(j,"firstChild");if(!i(j)){n.insertBefore(j,l)}p.remove(l);return o||k}},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)},_findSib:function(j,g,h){var i=this,k=g;if(j){if(b(k,"string")){k=function(f){return i.is(f,g)}}for(j=j[h];j;j=j[h]){if(k(j)){return j}}}return null},_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=m.createTextRange();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){o.tridentSel.destroy();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",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){if(!e.isOpera||opera.buildNumber()>=1767){f(i.dom.select("p table",l.node).reverse(),function(p){var o=i.dom.getParent(p.parentNode,"table,p");if(o.nodeName!="TABLE"){try{i.dom.split(o,p)}catch(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(r,q){var m,k=this,p,i,j,l;k._setup();q=q||{};q.format=q.format||"html";k.processObj=q;if(d){l=[];f(r.getElementsByTagName("option"),function(o){var h=k.dom.getAttrib(o,"selected");l.push(h?h:null)})}r=r.cloneNode(true);if(d){f(r.getElementsByTagName("option"),function(o,h){k.dom.setAttrib(o,"selected",l[h])})}j=r.ownerDocument.implementation;if(j.createHTMLDocument&&(e.isOpera&&opera.buildNumber()>=1767)){p=j.createHTMLDocument("");f(r.nodeName=="BODY"?r.childNodes:[r],function(h){p.body.appendChild(p.importNode(h,true))});if(r.nodeName!="BODY"){r=p.body.firstChild}else{r=p.body}i=k.dom.doc;k.dom.doc=p}k.key=""+(parseInt(k.key)+1);if(!q.no_events){q.node=r;k.onPreProcess.dispatch(k,q)}k.writer.reset();k._serializeNode(r,q.getInner);q.content=k.writer.getContent();if(i){k.dom.doc=i}if(!q.no_events){k.onPostProcess.dispatch(k,q)}k._postProcess(q);q.node=null;return e.trim(q.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]]>");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);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);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.isNotDirty=false;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,-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|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()}})}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(f(A,{valid_elements:A.verify_html===false?"*[*]":A.valid_elements,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(i){var h,c,a,b,g,f;h=i.dom.Event;c=i.isIE;a=i.isGecko;b=i.isOpera;g=i.each;f=i.extend;function e(k,l){var j=l.ownerDocument.createRange();j.setStart(k.endContainer,k.endOffset);j.setEndAfter(l);return j.cloneContents().textContent.length==0}function d(j){j=j.innerHTML;j=j.replace(/<(img|hr|table|input|select|textarea)[ \>]/gi,"-");j=j.replace(/<[^>]+>/g,"");return j.replace(/[ \t\r\n]+/g,"")==""}i.create("tinymce.ForceBlocks",{ForceBlocks:function(k){var l=this,m=k.settings,n;l.editor=k;l.dom=k.dom;n=(m.forced_root_block||"p").toLowerCase();m.element=n.toUpperCase();k.onPreInit.add(l.setup,l);l.reOpera=new RegExp("(\\u00a0|&#160;|&nbsp;)</"+n+">","gi");l.rePadd=new RegExp("<p( )([^>]+)><\\/p>|<p( )([^>]+)\\/>|<p( )([^>]+)>\\s+<\\/p>|<p><\\/p>|<p\\/>|<p>\\s+<\\/p>".replace(/p/g,n),"gi");l.reNbsp2BR1=new RegExp("<p( )([^>]+)>[\\s\\u00a0]+<\\/p>|<p>[\\s\\u00a0]+<\\/p>".replace(/p/g,n),"gi");l.reNbsp2BR2=new RegExp("<%p()([^>]+)>(&nbsp;|&#160;)<\\/%p>|<%p>(&nbsp;|&#160;)<\\/%p>".replace(/%p/g,n),"gi");l.reBR2Nbsp=new RegExp("<p( )([^>]+)>\\s*<br \\/>\\s*<\\/p>|<p>\\s*<br \\/>\\s*<\\/p>".replace(/p/g,n),"gi");function j(p,q){if(b){q.content=q.content.replace(l.reOpera,"</"+n+">")}q.content=q.content.replace(l.rePadd,"<"+n+"$1$2$3$4$5$6>\u00a0</"+n+">");if(!c&&!b&&q.set){q.content=q.content.replace(l.reNbsp2BR1,"<"+n+"$1$2><br /></"+n+">");q.content=q.content.replace(l.reNbsp2BR2,"<"+n+"$1$2><br /></"+n+">")}else{q.content=q.content.replace(l.reBR2Nbsp,"<"+n+"$1$2>\u00a0</"+n+">")}}k.onBeforeSetContent.add(j);k.onPostProcess.add(j);if(m.forced_root_block){k.onInit.add(l.forceRoots,l);k.onSetContent.add(l.forceRoots,l);k.onBeforeGetContent.add(l.forceRoots,l)}},setup:function(){var k=this,j=k.editor,l=j.settings;if(l.forced_root_block){j.onKeyUp.add(k.forceRoots,k);j.onPreProcess.add(k.forceRoots,k)}if(l.force_br_newlines){if(c){j.onKeyPress.add(function(o,q){var r,p=o.selection;if(q.keyCode==13&&p.getNode().nodeName!="LI"){p.setContent('<br id="__" /> ',{format:"raw"});r=o.dom.get("__");r.removeAttribute("id");p.select(r);p.collapse();return h.cancel(q)}})}return}if(!c&&l.force_p_newlines){j.onKeyPress.add(function(n,o){if(o.keyCode==13&&!o.shiftKey){if(!k.insertPara(o)){h.cancel(o)}}});if(a){j.onKeyDown.add(function(n,o){if((o.keyCode==8||o.keyCode==46)&&!o.shiftKey){k.backspaceDelete(o,o.keyCode==8)}})}}function m(o,n){var p=j.dom.create(n);g(o.attributes,function(q){if(q.specified&&q.nodeValue){p.setAttribute(q.nodeName.toLowerCase(),q.nodeValue)}});g(o.childNodes,function(q){p.appendChild(q.cloneNode(true))});o.parentNode.replaceChild(p,o);return p}j.onPreProcess.add(function(n,p){g(n.dom.select("p,h1,h2,h3,h4,h5,h6,div",p.node),function(o){if(d(o)){g(n.dom.select("span,em,strong,b,i",p.node),function(q){if(!q.hasChildNodes()){q.appendChild(n.getDoc().createTextNode("\u00a0"));return false}})}})});if(c){if(l.element!="P"){j.onKeyPress.add(function(n,o){k.lastElm=n.selection.getNode().nodeName});j.onKeyUp.add(function(p,r){var t,q=p.selection,s=q.getNode(),o=p.getBody();if(o.childNodes.length===1&&s.nodeName=="P"){s=m(s,l.element);q.select(s);q.collapse();p.nodeChanged()}else{if(r.keyCode==13&&!r.shiftKey&&k.lastElm!="P"){t=p.dom.getParent(s,"p");if(t){m(t,l.element);p.nodeChanged()}}}})}}},find:function(p,l,m){var k=this.editor,j=k.getDoc().createTreeWalker(p,4,null,false),o=-1;while(p=j.nextNode()){o++;if(l==0&&p==m){return o}if(l==1&&o==m){return p}}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&&!/^(script|mce:script|style|mce:style)$/i.test(G.nodeName))){if(!l){if(G.nodeType!=3||/[^\s]/g.test(G.nodeValue)){if(I==-2&&w){if(!c){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(n){return n===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);G.parentNode.replaceChild(l,G);l.appendChild(G)}}else{if(l.hasChildNodes()){l.insertBefore(G,l.firstChild)}else{l.appendChild(G)}}}else{l=null}}if(I!=-2){if(!c){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(!c&&(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(k){var j=this.dom;return j.getParent(k,j.isBlock)},insertPara:function(N){var B=this,p=B.editor,J=p.dom,O=p.getDoc(),S=p.settings,C=p.selection.getSel(),D=C.getRangeAt(0),R=O.body;var G,H,E,L,K,m,k,o,u,j,z,Q,l,q,F,I=J.getViewPort(p.getWin()),x,A,w;G=O.createRange();G.setStart(C.anchorNode,C.anchorOffset);G.collapse(true);H=O.createRange();H.setStart(C.focusNode,C.focusOffset);H.collapse(true);E=G.compareBoundaryPoints(G.START_TO_END,H)<0;L=E?C.anchorNode:C.focusNode;K=E?C.anchorOffset:C.focusOffset;m=E?C.focusNode:C.anchorNode;k=E?C.focusOffset:C.anchorOffset;if(L===m&&/^(TD|TH)$/.test(L.nodeName)){if(L.firstChild.nodeName=="BR"){J.remove(L.firstChild)}if(L.childNodes.length==0){p.dom.add(L,S.element,null,"<br />");Q=p.dom.add(L,S.element,null,"<br />")}else{F=L.innerHTML;L.innerHTML="";p.dom.add(L,S.element,null,F);Q=p.dom.add(L,S.element,null,"<br />")}D=O.createRange();D.selectNodeContents(Q);D.collapse(1);p.selection.setRng(D);return false}if(L==R&&m==R&&R.firstChild&&p.dom.isBlock(R.firstChild)){L=m=L.firstChild;K=k=0;G=O.createRange();G.setStart(L,0);H=O.createRange();H.setStart(m,0)}L=L.nodeName=="HTML"?O.body:L;L=L.nodeName=="BODY"?L.firstChild:L;m=m.nodeName=="HTML"?O.body:m;m=m.nodeName=="BODY"?m.firstChild:m;o=B.getParentBlock(L);u=B.getParentBlock(m);j=o?o.nodeName:S.element;if(B.dom.getParent(o,"ol,ul,pre")){return true}if(o&&(o.nodeName=="CAPTION"||/absolute|relative|fixed/gi.test(J.getStyle(o,"position",1)))){j=S.element;o=null}if(u&&(u.nodeName=="CAPTION"||/absolute|relative|fixed/gi.test(J.getStyle(o,"position",1)))){j=S.element;u=null}if(/(TD|TABLE|TH|CAPTION)/.test(j)||(o&&j=="DIV"&&/left|right/gi.test(J.getStyle(o,"float",1)))){j=S.element;o=u=null}z=(o&&o.nodeName==j)?o.cloneNode(0):p.dom.create(j);Q=(u&&u.nodeName==j)?u.cloneNode(0):p.dom.create(j);Q.removeAttribute("id");if(/^(H[1-6])$/.test(j)&&e(D,o)){Q=p.dom.create(S.element)}F=l=L;do{if(F==R||F.nodeType==9||B.dom.isBlock(F)||/(TD|TABLE|TH|CAPTION)/.test(F.nodeName)){break}l=F}while((F=F.previousSibling?F.previousSibling:F.parentNode));F=q=m;do{if(F==R||F.nodeType==9||B.dom.isBlock(F)||/(TD|TABLE|TH|CAPTION)/.test(F.nodeName)){break}q=F}while((F=F.nextSibling?F.nextSibling:F.parentNode));if(l.nodeName==j){G.setStart(l,0)}else{G.setStartBefore(l)}G.setEnd(L,K);z.appendChild(G.cloneContents()||O.createTextNode(""));try{H.setEndAfter(q)}catch(M){}H.setStart(m,k);Q.appendChild(H.cloneContents()||O.createTextNode(""));D=O.createRange();if(!l.previousSibling&&l.parentNode.nodeName==j){D.setStartBefore(l.parentNode)}else{if(G.startContainer.nodeName==j&&G.startOffset==0){D.setStartBefore(G.startContainer)}else{D.setStart(G.startContainer,G.startOffset)}}if(!q.nextSibling&&q.parentNode.nodeName==j){D.setEndAfter(q.parentNode)}else{D.setEnd(H.endContainer,H.endOffset)}D.deleteContents();if(b){p.getWin().scrollTo(0,I.y)}if(z.firstChild&&z.firstChild.nodeName==j){z.innerHTML=z.firstChild.innerHTML}if(Q.firstChild&&Q.firstChild.nodeName==j){Q.innerHTML=Q.firstChild.innerHTML}if(d(z)){z.innerHTML="<br />"}function P(y,s){var r=[],U,T,t;y.innerHTML="";if(S.keep_styles){T=s;do{if(/^(SPAN|STRONG|B|EM|I|FONT|STRIKE|U)$/.test(T.nodeName)){U=T.cloneNode(false);J.setAttrib(U,"id","");r.push(U)}}while(T=T.parentNode)}if(r.length>0){for(t=r.length-1,U=y;t>=0;t--){U=U.appendChild(r[t])}r[0].innerHTML=b?"&nbsp;":"<br />";return r[0]}else{y.innerHTML=b?"&nbsp;":"<br />"}}if(d(Q)){w=P(Q,m)}if(b&&parseFloat(opera.version())<9.5){D.insertNode(z);D.insertNode(Q)}else{D.insertNode(Q);D.insertNode(z)}Q.normalize();z.normalize();function v(r){return O.createTreeWalker(r,NodeFilter.SHOW_TEXT,null,false).nextNode()||r}D=O.createRange();D.selectNodeContents(a?v(w||Q):w||Q);D.collapse(1);C.removeAllRanges();C.addRange(D);x=p.dom.getPos(Q).y;A=Q.clientHeight;if(x<I.y||x+A>I.y+I.h){p.getWin().scrollTo(0,x<I.y?x:x-I.h+25)}return false},backspaceDelete:function(o,x){var z=this,m=z.editor,s=m.getBody(),l=m.dom,k,p=m.selection,j=p.getRng(),q=j.startContainer,k,u,v;if(q&&m.dom.isBlock(q)&&!/^(TD|TH)$/.test(q.nodeName)&&x){if(q.childNodes.length==0||(q.childNodes.length==1&&q.firstChild.nodeName=="BR")){k=q;while((k=k.previousSibling)&&!m.dom.isBlock(k)){}if(k){if(q!=s.firstChild){u=m.dom.doc.createTreeWalker(k,NodeFilter.SHOW_TEXT,null,false);while(v=u.nextNode()){k=v}j=m.getDoc().createRange();j.setStart(k,k.nodeValue?k.nodeValue.length:0);j.setEnd(k,k.nodeValue?k.nodeValue.length:0);p.setRng(j);m.dom.remove(q)}return h.cancel(o)}}}function y(n){var r;n=n.target;if(n&&n.parentNode&&n.nodeName=="BR"&&(k=z.getParentBlock(n))){r=n.previousSibling;h.remove(s,"DOMNodeInserted",y);if(r&&r.nodeType==3&&/\s+$/.test(r.nodeValue)){return}if(n.previousSibling||n.nextSibling){m.dom.remove(n)}}}h._add(s,"DOMNodeInserted",y);window.setTimeout(function(){h._remove(s,"DOMNodeInserted",y)},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.queryCommandEnabled(b)){throw"Error"}}catch(d){if(a.isGecko){c.windowManager.confirm(c.getLang("clipboard_msg"),function(f){if(f){open("http://www.mozilla.org/editor/midasdemo/securityprefs.html","_blank")}})}else{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
+(function(d){var a=/^\s*|\s*$/g,e,c="B".replace(/A(.)|B/,"$1")==="$1";var b={majorVersion:"3",minorVersion:"4.1",releaseDate:"2011-03-24",_init:function(){var s=this,q=document,o=navigator,g=o.userAgent,m,f,l,k,j,r;s.isOpera=d.opera&&opera.buildNumber;s.isWebKit=/WebKit/.test(g);s.isIE=!s.isWebKit&&!s.isOpera&&(/MSIE/gi).test(g)&&(/Explorer/gi).test(o.appName);s.isIE6=s.isIE&&/MSIE [56]/.test(g);s.isGecko=!s.isWebKit&&/Gecko/.test(g);s.isMac=g.indexOf("Mac")!=-1;s.isAir=/adobeair/i.test(g);s.isIDevice=/(iPad|iPhone)/.test(g);if(d.tinyMCEPreInit){s.suffix=tinyMCEPreInit.suffix;s.baseURL=tinyMCEPreInit.base;s.query=tinyMCEPreInit.query;return}s.suffix="";f=q.getElementsByTagName("base");for(m=0;m<f.length;m++){if(r=f[m].href){if(/^https?:\/\/[^\/]+$/.test(r)){r+="/"}k=r?r.match(/.*\//)[0]:""}}function h(i){if(i.src&&/tiny_mce(|_gzip|_jquery|_prototype|_full)(_dev|_src)?.js/.test(i.src)){if(/_(src|dev)\.js/g.test(i.src)){s.suffix="_src"}if((j=i.src.indexOf("?"))!=-1){s.query=i.src.substring(j+1)}s.baseURL=i.src.substring(0,i.src.lastIndexOf("/"));if(k&&s.baseURL.indexOf("://")==-1&&s.baseURL.indexOf("/")!==0){s.baseURL=k+s.baseURL}return s.baseURL}return null}f=q.getElementsByTagName("script");for(m=0;m<f.length;m++){if(h(f[m])){return}}l=q.getElementsByTagName("head")[0];if(l){f=l.getElementsByTagName("script");for(m=0;m<f.length;m++){if(h(f[m])){return}}}return},is:function(g,f){if(!f){return g!==e}if(f=="array"&&(g.hasOwnProperty&&g instanceof Array)){return true}return typeof(g)==f},makeMap:function(f,j,h){var g;f=f||[];j=j||",";if(typeof(f)=="string"){f=f.split(j)}h=h||{};g=f.length;while(g--){h[f[g]]={}}return h},each:function(i,f,h){var j,g;if(!i){return 0}h=h||i;if(i.length!==e){for(j=0,g=i.length;j<g;j++){if(f.call(h,i[j],j,i)===false){return 0}}}else{for(j in i){if(i.hasOwnProperty(j)){if(f.call(h,i[j],j,i)===false){return 0}}}}return 1},map:function(g,h){var i=[];b.each(g,function(f){i.push(h(f))});return i},grep:function(g,h){var i=[];b.each(g,function(f){if(!h||h(f)){i.push(f)}});return i},inArray:function(g,h){var j,f;if(g){for(j=0,f=g.length;j<f;j++){if(g[j]===h){return j}}}return -1},extend:function(k,j){var h,g,f=arguments;for(h=1,g=f.length;h<g;h++){j=f[h];b.each(j,function(i,l){if(i!==e){k[l]=i}})}return k},trim:function(f){return(f?""+f:"").replace(a,"")},create:function(o,f,j){var n=this,g,i,k,l,h,m=0;o=/^((static) )?([\w.]+)(:([\w.]+))?/.exec(o);k=o[3].match(/(^|\.)(\w+)$/i)[2];i=n.createNS(o[3].replace(/\.\w+$/,""),j);if(i[k]){return}if(o[2]=="static"){i[k]=f;if(this.onCreate){this.onCreate(o[2],o[3],i[k])}return}if(!f[k]){f[k]=function(){};m=1}i[k]=f[k];n.extend(i[k].prototype,f);if(o[5]){g=n.resolve(o[5]).prototype;l=o[5].match(/\.(\w+)$/i)[1];h=i[k];if(m){i[k]=function(){return g[l].apply(this,arguments)}}else{i[k]=function(){this.parent=g[l];return h.apply(this,arguments)}}i[k].prototype[k]=i[k];n.each(g,function(p,q){i[k].prototype[q]=g[q]});n.each(f,function(p,q){if(g[q]){i[k].prototype[q]=function(){this.parent=g[q];return p.apply(this,arguments)}}else{if(q!=k){i[k].prototype[q]=p}}})}n.each(f["static"],function(p,q){i[k][q]=p});if(this.onCreate){this.onCreate(o[2],o[3],i[k].prototype)}},walk:function(i,h,j,g){g=g||this;if(i){if(j){i=i[j]}b.each(i,function(k,f){if(h.call(g,k,f,j)===false){return false}b.walk(k,h,j,g)})}},createNS:function(j,h){var g,f;h=h||d;j=j.split(".");for(g=0;g<j.length;g++){f=j[g];if(!h[f]){h[f]={}}h=h[f]}return h},resolve:function(j,h){var g,f;h=h||d;j=j.split(".");for(g=0,f=j.length;g<f;g++){h=h[j[g]];if(!h){break}}return h},addUnload:function(j,i){var h=this;j={func:j,scope:i||this};if(!h.unloads){function g(){var f=h.unloads,l,m;if(f){for(m in f){l=f[m];if(l&&l.func){l.func.call(l.scope,1)}}if(d.detachEvent){d.detachEvent("onbeforeunload",k);d.detachEvent("onunload",g)}else{if(d.removeEventListener){d.removeEventListener("unload",g,false)}}h.unloads=l=f=w=g=0;if(d.CollectGarbage){CollectGarbage()}}}function k(){var l=document;if(l.readyState=="interactive"){function f(){l.detachEvent("onstop",f);if(g){g()}l=0}if(l){l.attachEvent("onstop",f)}d.setTimeout(function(){if(l){l.detachEvent("onstop",f)}},0)}}if(d.attachEvent){d.attachEvent("onunload",g);d.attachEvent("onbeforeunload",k)}else{if(d.addEventListener){d.addEventListener("unload",g,false)}}h.unloads=[j]}else{h.unloads.push(j)}return j},removeUnload:function(i){var g=this.unloads,h=null;b.each(g,function(j,f){if(j&&j.func==i){g.splice(f,1);h=i;return false}});return h},explode:function(f,g){return f?b.map(f.split(g||","),b.trim):f},_addVer:function(g){var f;if(!this.query){return g}f=(g.indexOf("?")==-1?"?":"&")+this.query;if(g.indexOf("#")==-1){return g+f}return g.replace("#",f+"#")},_replace:function(h,f,g){if(c){return g.replace(h,function(){var l=f,j=arguments,k;for(k=0;k<j.length-2;k++){if(j[k]===e){l=l.replace(new RegExp("\\$"+k,"g"),"")}else{l=l.replace(new RegExp("\\$"+k,"g"),j[k])}}return l})}return g.replace(h,f)}};b._init();d.tinymce=d.tinyMCE=b})(window);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|data):/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&&this.protocol==b.protocol?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,h=[],d,g;d=/\/$/.test(f)?"/":"";e=e.split("/");f=f.split("/");a(e,function(i){if(i){h.push(i)}});e=h;for(c=f.length-1,h=[];c>=0;c--){if(f[c].length==0||f[c]=="."){continue}if(f[c]==".."){b++;continue}if(b>0){b--;continue}h.push(f[c])}c=e.length-b;if(c<=0){g=h.reverse().join("/")}else{g=e.slice(0,c).join("/")+"/"+h.reverse().join("/")}if(g.indexOf("/")!==0){g="/"+g}if(d&&g.lastIndexOf("/")!==g.length-1){g+=d}return g},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)}})})();(function(){function serialize(o,quote){var i,v,t;quote=quote||'"';if(o==null){return"null"}t=typeof o;if(t=="string"){v="\bb\tt\nn\ff\rr\"\"''\\\\";return quote+o.replace(/([\u0080-\uFFFF\x00-\x1f\"\'\\])/g,function(a,b){if(quote==='"'&&a==="'"){return a}i=v.indexOf(b);if(i+1){return"\\"+v.charAt(i+1)}a=b.charCodeAt().toString(16);return"\\u"+"0000".substring(a.length)+a})+quote}if(t=="object"){if(o.hasOwnProperty&&o instanceof Array){for(i=0,v="[";i<o.length;i++){v+=(i>0?",":"")+serialize(o[i],quote)}return v+"]"}v="{";for(i in o){v+=typeof o[i]!="function"?(v.length>1?","+quote:quote)+i+quote+":"+serialize(o[i],quote):""}return v+"}"}return""+o}tinymce.util.JSON={serialize:serialize,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.setRequestHeader("X-Requested-With","XMLHttpRequest");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){if(e){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(j){var a,g,d,k=/[&\"\u007E-\uD7FF]|[\uD800-\uDBFF][\uDC00-\uDFFF]/g,b=/[<>&\u007E-\uD7FF]|[\uD800-\uDBFF][\uDC00-\uDFFF]/g,f=/[<>&\"\']/g,c=/&(#)?([\w]+);/g,i={128:"\u20AC",130:"\u201A",131:"\u0192",132:"\u201E",133:"\u2026",134:"\u2020",135:"\u2021",136:"\u02C6",137:"\u2030",138:"\u0160",139:"\u2039",140:"\u0152",142:"\u017D",145:"\u2018",146:"\u2019",147:"\u201C",148:"\u201D",149:"\u2022",150:"\u2013",151:"\u2014",152:"\u02DC",153:"\u2122",154:"\u0161",155:"\u203A",156:"\u0153",158:"\u017E",159:"\u0178"};g={'"':"&quot;","'":"&#39;","<":"&lt;",">":"&gt;","&":"&amp;"};d={"&lt;":"<","&gt;":">","&amp;":"&","&quot;":'"',"&apos;":"'"};function h(l){var m;m=document.createElement("div");m.innerHTML=l;return m.textContent||m.innerText||l}function e(m,p){var n,o,l,q={};if(m){m=m.split(",");p=p||10;for(n=0;n<m.length;n+=2){o=String.fromCharCode(parseInt(m[n],p));if(!g[o]){l="&"+m[n+1]+";";q[o]=l;q[l]=o}}return q}}a=e("50,nbsp,51,iexcl,52,cent,53,pound,54,curren,55,yen,56,brvbar,57,sect,58,uml,59,copy,5a,ordf,5b,laquo,5c,not,5d,shy,5e,reg,5f,macr,5g,deg,5h,plusmn,5i,sup2,5j,sup3,5k,acute,5l,micro,5m,para,5n,middot,5o,cedil,5p,sup1,5q,ordm,5r,raquo,5s,frac14,5t,frac12,5u,frac34,5v,iquest,60,Agrave,61,Aacute,62,Acirc,63,Atilde,64,Auml,65,Aring,66,AElig,67,Ccedil,68,Egrave,69,Eacute,6a,Ecirc,6b,Euml,6c,Igrave,6d,Iacute,6e,Icirc,6f,Iuml,6g,ETH,6h,Ntilde,6i,Ograve,6j,Oacute,6k,Ocirc,6l,Otilde,6m,Ouml,6n,times,6o,Oslash,6p,Ugrave,6q,Uacute,6r,Ucirc,6s,Uuml,6t,Yacute,6u,THORN,6v,szlig,70,agrave,71,aacute,72,acirc,73,atilde,74,auml,75,aring,76,aelig,77,ccedil,78,egrave,79,eacute,7a,ecirc,7b,euml,7c,igrave,7d,iacute,7e,icirc,7f,iuml,7g,eth,7h,ntilde,7i,ograve,7j,oacute,7k,ocirc,7l,otilde,7m,ouml,7n,divide,7o,oslash,7p,ugrave,7q,uacute,7r,ucirc,7s,uuml,7t,yacute,7u,thorn,7v,yuml,ci,fnof,sh,Alpha,si,Beta,sj,Gamma,sk,Delta,sl,Epsilon,sm,Zeta,sn,Eta,so,Theta,sp,Iota,sq,Kappa,sr,Lambda,ss,Mu,st,Nu,su,Xi,sv,Omicron,t0,Pi,t1,Rho,t3,Sigma,t4,Tau,t5,Upsilon,t6,Phi,t7,Chi,t8,Psi,t9,Omega,th,alpha,ti,beta,tj,gamma,tk,delta,tl,epsilon,tm,zeta,tn,eta,to,theta,tp,iota,tq,kappa,tr,lambda,ts,mu,tt,nu,tu,xi,tv,omicron,u0,pi,u1,rho,u2,sigmaf,u3,sigma,u4,tau,u5,upsilon,u6,phi,u7,chi,u8,psi,u9,omega,uh,thetasym,ui,upsih,um,piv,812,bull,816,hellip,81i,prime,81j,Prime,81u,oline,824,frasl,88o,weierp,88h,image,88s,real,892,trade,89l,alefsym,8cg,larr,8ch,uarr,8ci,rarr,8cj,darr,8ck,harr,8dl,crarr,8eg,lArr,8eh,uArr,8ei,rArr,8ej,dArr,8ek,hArr,8g0,forall,8g2,part,8g3,exist,8g5,empty,8g7,nabla,8g8,isin,8g9,notin,8gb,ni,8gf,prod,8gh,sum,8gi,minus,8gn,lowast,8gq,radic,8gt,prop,8gu,infin,8h0,ang,8h7,and,8h8,or,8h9,cap,8ha,cup,8hb,int,8hk,there4,8hs,sim,8i5,cong,8i8,asymp,8j0,ne,8j1,equiv,8j4,le,8j5,ge,8k2,sub,8k3,sup,8k4,nsub,8k6,sube,8k7,supe,8kl,oplus,8kn,otimes,8l5,perp,8m5,sdot,8o8,lceil,8o9,rceil,8oa,lfloor,8ob,rfloor,8p9,lang,8pa,rang,9ea,loz,9j0,spades,9j3,clubs,9j5,hearts,9j6,diams,ai,OElig,aj,oelig,b0,Scaron,b1,scaron,bo,Yuml,m6,circ,ms,tilde,802,ensp,803,emsp,809,thinsp,80c,zwnj,80d,zwj,80e,lrm,80f,rlm,80j,ndash,80k,mdash,80o,lsquo,80p,rsquo,80q,sbquo,80s,ldquo,80t,rdquo,80u,bdquo,810,dagger,811,Dagger,81g,permil,81p,lsaquo,81q,rsaquo,85c,euro",32);j.html=j.html||{};j.html.Entities={encodeRaw:function(m,l){return m.replace(l?k:b,function(n){return g[n]||n})},encodeAllRaw:function(l){return(""+l).replace(f,function(m){return g[m]||m})},encodeNumeric:function(m,l){return m.replace(l?k:b,function(n){if(n.length>1){return"&#"+(((n.charCodeAt(0)-55296)*1024)+(n.charCodeAt(1)-56320)+65536)+";"}return g[n]||"&#"+n.charCodeAt(0)+";"})},encodeNamed:function(n,l,m){m=m||a;return n.replace(l?k:b,function(o){return g[o]||m[o]||o})},getEncodeFunc:function(l,o){var p=j.html.Entities;o=e(o)||a;function m(r,q){return r.replace(q?k:b,function(s){return g[s]||o[s]||"&#"+s.charCodeAt(0)+";"||s})}function n(r,q){return p.encodeNamed(r,q,o)}l=j.makeMap(l.replace(/\+/g,","));if(l.named&&l.numeric){return m}if(l.named){if(o){return n}return p.encodeNamed}if(l.numeric){return p.encodeNumeric}return p.encodeRaw},decode:function(l){return l.replace(c,function(n,m,o){if(m){o=parseInt(o);if(o>65535){o-=65536;return String.fromCharCode(55296+(o>>10),56320+(o&1023))}else{return i[o]||String.fromCharCode(o)}}return d[n]||a[n]||h(n)})}}})(tinymce);tinymce.html.Styles=function(d,f){var k=/rgb\s*\(\s*([0-9]+)\s*,\s*([0-9]+)\s*,\s*([0-9]+)\s*\)/gi,h=/(?:url(?:(?:\(\s*\"([^\"]+)\"\s*\))|(?:\(\s*\'([^\']+)\'\s*\))|(?:\(\s*([^)\s]+)\s*\))))|(?:\'([^\']+)\')|(?:\"([^\"]+)\")/gi,b=/\s*([^:]+):\s*([^;]+);?/g,l=/\s+$/,m=/rgb/,e,g,a={},j;d=d||{};j="\\\" \\' \\; \\: ; : _".split(" ");for(g=0;g<j.length;g++){a[j[g]]="_"+g;a["_"+g]=j[g]}function c(n,q,p,i){function o(r){r=parseInt(r).toString(16);return r.length>1?r:"0"+r}return"#"+o(q)+o(p)+o(i)}return{toHex:function(i){return i.replace(k,c)},parse:function(r){var y={},p,n,v,q,u=d.url_converter,x=d.url_converter_scope||this;function o(C,F){var E,B,A,D;E=y[C+"-top"+F];if(!E){return}B=y[C+"-right"+F];if(E!=B){return}A=y[C+"-bottom"+F];if(B!=A){return}D=y[C+"-left"+F];if(A!=D){return}y[C+F]=D;delete y[C+"-top"+F];delete y[C+"-right"+F];delete y[C+"-bottom"+F];delete y[C+"-left"+F]}function t(B){var C=y[B],A;if(!C||C.indexOf(" ")<0){return}C=C.split(" ");A=C.length;while(A--){if(C[A]!==C[0]){return false}}y[B]=C[0];return true}function z(C,B,A,D){if(!t(B)){return}if(!t(A)){return}if(!t(D)){return}y[C]=y[B]+" "+y[A]+" "+y[D];delete y[B];delete y[A];delete y[D]}function s(A){q=true;return a[A]}function i(B,A){if(q){B=B.replace(/_[0-9]/g,function(C){return a[C]})}if(!A){B=B.replace(/\\([\'\";:])/g,"$1")}return B}if(r){r=r.replace(/\\[\"\';:_]/g,s).replace(/\"[^\"]+\"|\'[^\']+\'/g,function(A){return A.replace(/[;:]/g,s)});while(p=b.exec(r)){n=p[1].replace(l,"").toLowerCase();v=p[2].replace(l,"");if(n&&v.length>0){if(n==="font-weight"&&v==="700"){v="bold"}else{if(n==="color"||n==="background-color"){v=v.toLowerCase()}}v=v.replace(k,c);v=v.replace(h,function(B,A,E,D,F,C){F=F||C;if(F){F=i(F);return"'"+F.replace(/\'/g,"\\'")+"'"}A=i(A||E||D);if(u){A=u.call(x,A,"style")}return"url('"+A.replace(/\'/g,"\\'")+"')"});y[n]=q?i(v,true):v}b.lastIndex=p.index+p[0].length}o("border","");o("border","-width");o("border","-color");o("border","-style");o("padding","");o("margin","");z("border","border-width","border-style","border-color");if(y.border==="medium none"){delete y.border}}return y},serialize:function(p,r){var o="",n,q;function i(t){var x,u,s,t,v;x=f.styles[t];if(x){for(u=0,s=x.length;u<s;u++){t=x[u];v=p[t];if(v!==e){o+=(o.length>0?" ":"")+t+": "+v+";"}}}}if(r&&f&&f.styles){i("*");i(n)}else{for(n in p){q=p[n];if(q!==e){o+=(o.length>0?" ":"")+n+": "+q+";"}}}return o}}};(function(l){var g={},i,k,f,d,b,e,c=l.makeMap,j=l.each;function h(n,m){return n.split(m||",")}function a(q,p){var n,o={};function m(r){return r.replace(/[A-Z]+/g,function(s){return m(q[s])})}for(n in q){if(q.hasOwnProperty(n)){q[n]=m(q[n])}}m(p).replace(/#/g,"#text").replace(/(\w+)\[([^\]]+)\]\[([^\]]*)\]/g,function(u,s,r,t){r=h(r,"|");o[s]={attributes:c(r),attributesOrder:r,children:c(t,"|",{"#comment":{}})}});return o}k="h1,h2,h3,h4,h5,h6,hr,p,div,address,pre,form,table,tbody,thead,tfoot,th,tr,td,li,ol,ul,caption,blockquote,center,dl,dt,dd,dir,fieldset,noscript,menu,isindex,samp,header,footer,article,section,hgroup";k=c(k,",",c(k.toUpperCase()));g=a({Z:"H|K|N|O|P",Y:"X|form|R|Q",ZG:"E|span|width|align|char|charoff|valign",X:"p|T|div|U|W|isindex|fieldset|table",ZF:"E|align|char|charoff|valign",W:"pre|hr|blockquote|address|center|noframes",ZE:"abbr|axis|headers|scope|rowspan|colspan|align|char|charoff|valign|nowrap|bgcolor|width|height",ZD:"[E][S]",U:"ul|ol|dl|menu|dir",ZC:"p|Y|div|U|W|table|br|span|bdo|object|applet|img|map|K|N|Q",T:"h1|h2|h3|h4|h5|h6",ZB:"X|S|Q",S:"R|P",ZA:"a|G|J|M|O|P",R:"a|H|K|N|O",Q:"noscript|P",P:"ins|del|script",O:"input|select|textarea|label|button",N:"M|L",M:"em|strong|dfn|code|q|samp|kbd|var|cite|abbr|acronym",L:"sub|sup",K:"J|I",J:"tt|i|b|u|s|strike",I:"big|small|font|basefont",H:"G|F",G:"br|span|bdo",F:"object|applet|img|map|iframe",E:"A|B|C",D:"accesskey|tabindex|onfocus|onblur",C:"onclick|ondblclick|onmousedown|onmouseup|onmouseover|onmousemove|onmouseout|onkeypress|onkeydown|onkeyup",B:"lang|xml:lang|dir",A:"id|class|style|title"},"script[id|charset|type|language|src|defer|xml:space][]style[B|id|type|media|title|xml:space][]object[E|declare|classid|codebase|data|type|codetype|archive|standby|width|height|usemap|name|tabindex|align|border|hspace|vspace][#|param|Y]param[id|name|value|valuetype|type][]p[E|align][#|S]a[E|D|charset|type|name|href|hreflang|rel|rev|shape|coords|target][#|Z]br[A|clear][]span[E][#|S]bdo[A|C|B][#|S]applet[A|codebase|archive|code|object|alt|name|width|height|align|hspace|vspace][#|param|Y]h1[E|align][#|S]img[E|src|alt|name|longdesc|width|height|usemap|ismap|align|border|hspace|vspace][]map[B|C|A|name][X|form|Q|area]h2[E|align][#|S]iframe[A|longdesc|name|src|frameborder|marginwidth|marginheight|scrolling|align|width|height][#|Y]h3[E|align][#|S]tt[E][#|S]i[E][#|S]b[E][#|S]u[E][#|S]s[E][#|S]strike[E][#|S]big[E][#|S]small[E][#|S]font[A|B|size|color|face][#|S]basefont[id|size|color|face][]em[E][#|S]strong[E][#|S]dfn[E][#|S]code[E][#|S]q[E|cite][#|S]samp[E][#|S]kbd[E][#|S]var[E][#|S]cite[E][#|S]abbr[E][#|S]acronym[E][#|S]sub[E][#|S]sup[E][#|S]input[E|D|type|name|value|checked|disabled|readonly|size|maxlength|src|alt|usemap|onselect|onchange|accept|align][]select[E|name|size|multiple|disabled|tabindex|onfocus|onblur|onchange][optgroup|option]optgroup[E|disabled|label][option]option[E|selected|disabled|label|value][]textarea[E|D|name|rows|cols|disabled|readonly|onselect|onchange][]label[E|for|accesskey|onfocus|onblur][#|S]button[E|D|name|value|type|disabled][#|p|T|div|U|W|table|G|object|applet|img|map|K|N|Q]h4[E|align][#|S]ins[E|cite|datetime][#|Y]h5[E|align][#|S]del[E|cite|datetime][#|Y]h6[E|align][#|S]div[E|align][#|Y]ul[E|type|compact][li]li[E|type|value][#|Y]ol[E|type|compact|start][li]dl[E|compact][dt|dd]dt[E][#|S]dd[E][#|Y]menu[E|compact][li]dir[E|compact][li]pre[E|width|xml:space][#|ZA]hr[E|align|noshade|size|width][]blockquote[E|cite][#|Y]address[E][#|S|p]center[E][#|Y]noframes[E][#|Y]isindex[A|B|prompt][]fieldset[E][#|legend|Y]legend[E|accesskey|align][#|S]table[E|summary|width|border|frame|rules|cellspacing|cellpadding|align|bgcolor][caption|col|colgroup|thead|tfoot|tbody|tr]caption[E|align][#|S]col[ZG][]colgroup[ZG][col]thead[ZF][tr]tr[ZF|bgcolor][th|td]th[E|ZE][#|Y]form[E|action|method|name|enctype|onsubmit|onreset|accept|accept-charset|target][#|X|R|Q]noscript[E][#|Y]td[E|ZE][#|Y]tfoot[ZF][tr]tbody[ZF][tr]area[E|D|shape|coords|href|nohref|alt|target][]base[id|href|target][]body[E|onload|onunload|background|bgcolor|text|link|vlink|alink][#|Y]");i=c("checked,compact,declare,defer,disabled,ismap,multiple,nohref,noresize,noshade,nowrap,readonly,selected,preload,autoplay,loop,controls");f=c("area,base,basefont,br,col,frame,hr,img,input,isindex,link,meta,param,embed,source");d=l.extend(c("td,th,iframe,video,object"),f);b=c("pre,script,style");e=c("colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr");l.html.Schema=function(p){var x=this,m={},n={},u=[],o;p=p||{};if(p.verify_html===false){p.valid_elements="*[*]"}if(p.valid_styles){o={};j(p.valid_styles,function(z,y){o[y]=l.explode(z)})}function v(y){return new RegExp("^"+y.replace(/([?+*])/g,".$1")+"$")}function r(F){var E,A,T,P,U,z,C,O,R,K,S,W,I,D,Q,y,M,B,V,X,J,N,H=/^([#+-])?([^\[\/]+)(?:\/([^\[]+))?(?:\[([^\]]+)\])?$/,L=/^([!\-])?(\w+::\w+|[^=:<]+)?(?:([=:<])(.*))?$/,G=/[*?+]/;if(F){F=h(F);if(m["@"]){M=m["@"].attributes;B=m["@"].attributesOrder}for(E=0,A=F.length;E<A;E++){z=H.exec(F[E]);if(z){Q=z[1];K=z[2];y=z[3];R=z[4];I={};D=[];C={attributes:I,attributesOrder:D};if(Q==="#"){C.paddEmpty=true}if(Q==="-"){C.removeEmpty=true}if(M){for(X in M){I[X]=M[X]}D.push.apply(D,B)}if(R){R=h(R,"|");for(T=0,P=R.length;T<P;T++){z=L.exec(R[T]);if(z){O={};W=z[1];S=z[2].replace(/::/g,":");Q=z[3];N=z[4];if(W==="!"){C.attributesRequired=C.attributesRequired||[];C.attributesRequired.push(S);O.required=true}if(W==="-"){delete I[S];D.splice(l.inArray(D,S),1);continue}if(Q){if(Q==="="){C.attributesDefault=C.attributesDefault||[];C.attributesDefault.push({name:S,value:N});O.defaultValue=N}if(Q===":"){C.attributesForced=C.attributesForced||[];C.attributesForced.push({name:S,value:N});O.forcedValue=N}if(Q==="<"){O.validValues=c(N,"?")}}if(G.test(S)){C.attributePatterns=C.attributePatterns||[];O.pattern=v(S);C.attributePatterns.push(O)}else{if(!I[S]){D.push(S)}I[S]=O}}}}if(!M&&K=="@"){M=I;B=D}if(y){C.outputName=K;m[y]=C}if(G.test(K)){C.pattern=v(K);u.push(C)}else{m[K]=C}}}}}function t(y){m={};u=[];r(y);j(g,function(A,z){n[z]=A.children})}function q(z){var y=/^(~)?(.+)$/;if(z){j(h(z),function(C){var B=y.exec(C),D=B[1]==="~"?"span":"div",A=B[2];n[A]=n[D];j(n,function(E,F){if(E[D]){E[A]=E[D]}})})}}function s(z){var y=/^([+\-]?)(\w+)\[([^\]]+)\]$/;if(z){j(h(z),function(D){var C=y.exec(D),A,B;if(C){B=C[1];if(B){A=n[C[2]]}else{A=n[C[2]]={"#comment":{}}}A=n[C[2]];j(h(C[3],"|"),function(E){if(B==="-"){delete A[E]}else{A[E]={}}})}})}}if(!p.valid_elements){j(g,function(z,y){m[y]={attributes:z.attributes,attributesOrder:z.attributesOrder};n[y]=z.children});j(h("strong/b,em/i"),function(y){y=h(y,"/");m[y[1]].outputName=y[0]});m.img.attributesDefault=[{name:"alt",value:""}];j(h("ol,ul,li,sub,sup,blockquote,tr,div,span,font,a,table,tbody"),function(y){m[y].removeEmpty=true});j(h("p,h1,h2,h3,h4,h5,h6,th,td,pre,div,address,caption"),function(y){m[y].paddEmpty=true})}else{t(p.valid_elements)}q(p.custom_elements);s(p.valid_children);r(p.extended_valid_elements);s("+ol[ul|ol],+ul[ul|ol]");if(p.invalid_elements){l.each(l.explode(p.invalid_elements),function(y){if(m[y]){delete m[y]}})}x.children=n;x.styles=o;x.getBoolAttrs=function(){return i};x.getBlockElements=function(){return k};x.getShortEndedElements=function(){return f};x.getSelfClosingElements=function(){return e};x.getNonEmptyElements=function(){return d};x.getWhiteSpaceElements=function(){return b};x.isValidChild=function(y,A){var z=n[y];return !!(z&&z[A])};x.getElementRule=function(y){var A=m[y],z;if(A){return A}z=u.length;while(z--){A=u[z];if(A.pattern.test(y)){return A}}};x.addValidElements=r;x.setValidElements=t;x.addCustomElements=q;x.addValidChildren=s};l.html.Schema.boolAttrMap=i;l.html.Schema.blockElementsMap=k})(tinymce);(function(a){a.html.SaxParser=function(c,e){var b=this,d=function(){};c=c||{};b.schema=e=e||new a.html.Schema();if(c.fix_self_closing!==false){c.fix_self_closing=true}a.each("comment cdata text start end pi doctype".split(" "),function(f){if(f){b[f]=c[f]||d}});b.parse=function(q){var A=this,f,m=0,G,j,l=[],B,K,t,N,F,k,p,x,I,r,E,o,J,n,H,M,L,z,D,h,g,u,s=0,v=a.html.Entities.decode,y;function C(O){var Q,P;Q=l.length;while(Q--){if(l[Q].name===O){break}}if(Q>=0){for(P=l.length-1;P>=Q;P--){O=l[P];if(O.valid){A.end(O.name)}}l.length=Q}}D=new RegExp("<(?:(?:!--([\\w\\W]*?)-->)|(?:!\\[CDATA\\[([\\w\\W]*?)\\]\\]>)|(?:!DOCTYPE([\\w\\W]*?)>)|(?:\\?([^\\s\\/<>]+) ?([\\w\\W]*?)[?/]>)|(?:\\/([^>]+)>)|(?:([^\\s\\/<>]+)\\s*((?:[^\"'>]+(?:(?:\"[^\"]*\")|(?:'[^']*')|[^>]*))*)>))","g");h=/([\w:\-]+)(?:\s*=\s*(?:(?:\"((?:\\.|[^\"])*)\")|(?:\'((?:\\.|[^\'])*)\')|([^>\s]+)))?/g;g={script:/<\/script[^>]*>/gi,style:/<\/style[^>]*>/gi,noscript:/<\/noscript[^>]*>/gi};F=e.getShortEndedElements();z=e.getSelfClosingElements();k=e.getBoolAttrs();x=c.validate;y=c.fix_self_closing;while(f=D.exec(q)){if(m<f.index){A.text(v(q.substr(m,f.index-m)))}if(G=f[6]){C(G.toLowerCase())}else{if(G=f[7]){G=G.toLowerCase();p=G in F;if(y&&z[G]&&l.length>0&&l[l.length-1].name===G){C(G)}if(!x||(I=e.getElementRule(G))){r=true;if(x){J=I.attributes;n=I.attributePatterns}if(o=f[8]){B=[];B.map={};o.replace(h,function(P,O,T,S,R){var U,Q;O=O.toLowerCase();T=O in k?O:v(T||S||R||"");if(x&&O.indexOf("data-")!==0){U=J[O];if(!U&&n){Q=n.length;while(Q--){U=n[Q];if(U.pattern.test(O)){break}}if(Q===-1){U=null}}if(!U){return}if(U.validValues&&!(T in U.validValues)){return}}B.map[O]=T;B.push({name:O,value:T})})}else{B=[];B.map={}}if(x){H=I.attributesRequired;M=I.attributesDefault;L=I.attributesForced;if(L){K=L.length;while(K--){E=L[K];N=E.name;u=E.value;if(u==="{$uid}"){u="mce_"+s++}B.map[N]=u;B.push({name:N,value:u})}}if(M){K=M.length;while(K--){E=M[K];N=E.name;if(!(N in B.map)){u=E.value;if(u==="{$uid}"){u="mce_"+s++}B.map[N]=u;B.push({name:N,value:u})}}}if(H){K=H.length;while(K--){if(H[K] in B.map){break}}if(K===-1){r=false}}if(B.map["data-mce-bogus"]){r=false}}if(r){A.start(G,B,p)}}else{r=false}if(j=g[G]){j.lastIndex=m=f.index+f[0].length;if(f=j.exec(q)){if(r){t=q.substr(m,f.index-m)}m=f.index+f[0].length}else{t=q.substr(m);m=q.length}if(r&&t.length>0){A.text(t,true)}if(r){A.end(G)}D.lastIndex=m;continue}if(!p){if(!o||o.indexOf("/")!=o.length-1){l.push({name:G,valid:r})}else{if(r){A.end(G)}}}}else{if(G=f[1]){A.comment(G)}else{if(G=f[2]){A.cdata(G)}else{if(G=f[3]){A.doctype(G)}else{if(G=f[4]){A.pi(G,f[5])}}}}}}m=f.index+f[0].length}if(m<q.length){A.text(v(q.substr(m)))}for(K=l.length-1;K>=0;K--){G=l[K];if(G.valid){A.end(G.name)}}}}})(tinymce);(function(d){var c=/^[ \t\r\n]*$/,e={"#text":3,"#comment":8,"#cdata":4,"#pi":7,"#doctype":10,"#document-fragment":11};function a(k,l,j){var i,h,f=j?"lastChild":"firstChild",g=j?"prev":"next";if(k[f]){return k[f]}if(k!==l){i=k[g];if(i){return i}for(h=k.parent;h&&h!==l;h=h.parent){i=h[g];if(i){return i}}}}function b(f,g){this.name=f;this.type=g;if(g===1){this.attributes=[];this.attributes.map={}}}d.extend(b.prototype,{replace:function(g){var f=this;if(g.parent){g.remove()}f.insert(g,f);f.remove();return f},attr:function(h,l){var f=this,g,j,k;if(typeof h!=="string"){for(j in h){f.attr(j,h[j])}return f}if(g=f.attributes){if(l!==k){if(l===null){if(h in g.map){delete g.map[h];j=g.length;while(j--){if(g[j].name===h){g=g.splice(j,1);return f}}}return f}if(h in g.map){j=g.length;while(j--){if(g[j].name===h){g[j].value=l;break}}}else{g.push({name:h,value:l})}g.map[h]=l;return f}else{return g.map[h]}}},clone:function(){var g=this,n=new b(g.name,g.type),h,f,m,j,k;if(m=g.attributes){k=[];k.map={};for(h=0,f=m.length;h<f;h++){j=m[h];if(j.name!=="id"){k[k.length]={name:j.name,value:j.value};k.map[j.name]=j.value}}n.attributes=k}n.value=g.value;n.shortEnded=g.shortEnded;return n},wrap:function(g){var f=this;f.parent.insert(g,f);g.append(f);return f},unwrap:function(){var f=this,h,g;for(h=f.firstChild;h;){g=h.next;f.insert(h,f,true);h=g}f.remove()},remove:function(){var f=this,h=f.parent,g=f.next,i=f.prev;if(h){if(h.firstChild===f){h.firstChild=g;if(g){g.prev=null}}else{i.next=g}if(h.lastChild===f){h.lastChild=i;if(i){i.next=null}}else{g.prev=i}f.parent=f.next=f.prev=null}return f},append:function(h){var f=this,g;if(h.parent){h.remove()}g=f.lastChild;if(g){g.next=h;h.prev=g;f.lastChild=h}else{f.lastChild=f.firstChild=h}h.parent=f;return h},insert:function(h,f,i){var g;if(h.parent){h.remove()}g=f.parent||this;if(i){if(f===g.firstChild){g.firstChild=h}else{f.prev.next=h}h.prev=f.prev;h.next=f;f.prev=h}else{if(f===g.lastChild){g.lastChild=h}else{f.next.prev=h}h.next=f.next;h.prev=f;f.next=h}h.parent=g;return h},getAll:function(g){var f=this,h,i=[];for(h=f.firstChild;h;h=a(h,f)){if(h.name===g){i.push(h)}}return i},empty:function(){var g=this,f,h,j;if(g.firstChild){f=[];for(j=g.firstChild;j;j=a(j,g)){f.push(j)}h=f.length;while(h--){j=f[h];j.parent=j.firstChild=j.lastChild=j.next=j.prev=null}}g.firstChild=g.lastChild=null;return g},isEmpty:function(j){var f=this,h=f.firstChild,g;if(h){do{if(h.type===1){if(h.attributes.map["data-mce-bogus"]){continue}if(j[h.name]){return false}g=h.attributes.length;while(g--){if(h.attributes[g].name.indexOf("data-")===0){return false}}}if((h.type===3&&!c.test(h.value))){return false}}while(h=a(h,f))}return true}});d.extend(b,{create:function(g,f){var i,h;i=new b(g,e[g]||1);if(f){for(h in f){i.attr(h,f[h])}}return i}});d.html.Node=b})(tinymce);(function(b){var a=b.html.Node;b.html.DomParser=function(g,h){var f=this,e={},d=[],i={},c={};g=g||{};g.root_name=g.root_name||"body";f.schema=h=h||new b.html.Schema();function j(m){var o,p,x,v,z,n,q,l,t,u,k,s,y,r;s=b.makeMap("tr,td,th,tbody,thead,tfoot,table");k=h.getNonEmptyElements();for(o=0;o<m.length;o++){p=m[o];if(!p.parent){continue}v=[p];for(x=p.parent;x&&!h.isValidChild(x.name,p.name)&&!s[x.name];x=x.parent){v.push(x)}if(x&&v.length>1){v.reverse();z=n=f.filterNode(v[0].clone());for(t=0;t<v.length-1;t++){if(h.isValidChild(n.name,v[t].name)){q=f.filterNode(v[t].clone());n.append(q)}else{q=n}for(l=v[t].firstChild;l&&l!=v[t+1];){r=l.next;q.append(l);l=r}n=q}if(!z.isEmpty(k)){x.insert(z,v[0],true);x.insert(p,z)}else{x.insert(p,v[0],true)}x=v[0];if(x.isEmpty(k)||x.firstChild===x.lastChild&&x.firstChild.name==="br"){x.empty().remove()}}else{if(p.parent){if(p.name==="li"){y=p.prev;if(y&&(y.name==="ul"||y.name==="ul")){y.append(p);continue}y=p.next;if(y&&(y.name==="ul"||y.name==="ul")){y.insert(p,y.firstChild,true);continue}p.wrap(f.filterNode(new a("ul",1)));continue}if(h.isValidChild(p.parent.name,"div")&&h.isValidChild("div",p.name)){p.wrap(f.filterNode(new a("div",1)))}else{if(p.name==="style"||p.name==="script"){p.empty().remove()}else{p.unwrap()}}}}}}f.filterNode=function(m){var l,k,n;if(k in e){n=i[k];if(n){n.push(m)}else{i[k]=[m]}}l=d.length;while(l--){k=d[l].name;if(k in m.attributes.map){n=c[k];if(n){n.push(m)}else{c[k]=[m]}}}return m};f.addNodeFilter=function(k,l){b.each(b.explode(k),function(m){var n=e[m];if(!n){e[m]=n=[]}n.push(l)})};f.addAttributeFilter=function(k,l){b.each(b.explode(k),function(m){var n;for(n=0;n<d.length;n++){if(d[n].name===m){d[n].callbacks.push(l);return}}d.push({name:m,callbacks:[l]})})};f.parse=function(u,m){var n,D,y,x,A,z,v,q,C,G,o,B,F=[],s,k,r,p,t;m=m||{};i={};c={};o=b.extend(b.makeMap("script,style,head,title,meta,param"),h.getBlockElements());t=h.getNonEmptyElements();p=h.children;r=h.getWhiteSpaceElements();B=/^[ \t\r\n]+/;s=/[ \t\r\n]+$/;k=/[ \t\r\n]+/g;function E(l,H){var I=new a(l,H),J;if(l in e){J=i[l];if(J){J.push(I)}else{i[l]=[I]}}return I}n=new b.html.SaxParser({validate:g.validate,fix_self_closing:false,cdata:function(l){y.append(E("#cdata",4)).value=l},text:function(I,l){var H;if(!r[y.name]){I=I.replace(k," ");if(y.lastChild&&o[y.lastChild.name]){I=I.replace(B,"")}}if(I.length!==0){H=E("#text",3);H.raw=!!l;y.append(H).value=I}},comment:function(l){y.append(E("#comment",8)).value=l},pi:function(l,H){y.append(E(l,7)).value=H},doctype:function(l){y.append(E("#doctype",10)).value=l},start:function(l,P,I){var N,K,J,H,L,Q,O,M;J=h.getElementRule(l);if(J){N=E(J.outputName||l,1);N.attributes=P;N.shortEnded=I;y.append(N);M=p[y.name];if(M&&p[N.name]&&!M[N.name]){F.push(N)}K=d.length;while(K--){L=d[K].name;if(L in P.map){C=c[L];if(C){C.push(N)}else{c[L]=[N]}}}if(o[l]){for(H=N.prev;H&&H.type===3;){Q=H.value.replace(s,"");if(Q.length>0){H.value=Q;H=H.prev}else{O=H.prev;H.remove();H=O}}}if(!I){y=N}}},end:function(l){var L,I,K,H,J;I=h.getElementRule(l);if(I){if(o[l]){if(!r[y.name]){for(L=y.firstChild;L&&L.type===3;){K=L.value.replace(B,"");if(K.length>0){L.value=K;L=L.next}else{H=L.next;L.remove();L=H}}for(L=y.lastChild;L&&L.type===3;){K=L.value.replace(s,"");if(K.length>0){L.value=K;L=L.prev}else{H=L.prev;L.remove();L=H}}}L=y.prev;if(L&&L.type===3){K=L.value.replace(B,"");if(K.length>0){L.value=K}else{L.remove()}}}if(I.removeEmpty||I.paddEmpty){if(y.isEmpty(t)){if(I.paddEmpty){y.empty().append(new a("#text","3")).value="\u00a0"}else{if(!y.attributes.map.name){J=y.parent;y.empty().remove();y=J;return}}}}y=y.parent}}},h);D=y=new a(g.root_name,11);n.parse(u);j(F);for(G in i){C=e[G];x=i[G];v=x.length;while(v--){if(!x[v].parent){x.splice(v,1)}}for(A=0,z=C.length;A<z;A++){C[A](x,G,m)}}for(A=0,z=d.length;A<z;A++){C=d[A];if(C.name in c){x=c[C.name];v=x.length;while(v--){if(!x[v].parent){x.splice(v,1)}}for(v=0,q=C.callbacks.length;v<q;v++){C.callbacks[v](x,C.name,m)}}}return D};if(g.remove_trailing_brs){f.addNodeFilter("br",function(n,m){var r,q=n.length,o,u=h.getBlockElements(),k=h.getNonEmptyElements(),s,p,t;for(r=0;r<q;r++){o=n[r];s=o.parent;if(u[o.parent.name]&&o===s.lastChild){p=o.prev;while(p){t=p.name;if(t!=="span"||p.attr("data-mce-type")!=="bookmark"){if(t!=="br"){break}if(t==="br"){o=null;break}}p=p.prev}if(o){o.remove();if(s.isEmpty(k)){elementRule=h.getElementRule(s.name);if(elementRule.removeEmpty){s.remove()}else{if(elementRule.paddEmpty){s.empty().append(new b.html.Node("#text",3)).value="\u00a0"}}}}}}})}}})(tinymce);tinymce.html.Writer=function(e){var c=[],a,b,d,f,g;e=e||{};a=e.indent;b=tinymce.makeMap(e.indent_before||"");d=tinymce.makeMap(e.indent_after||"");f=tinymce.html.Entities.getEncodeFunc(e.entity_encoding||"raw",e.entities);g=e.element_format=="html";return{start:function(m,k,p){var n,j,h,o;if(a&&b[m]&&c.length>0){o=c[c.length-1];if(o.length>0&&o!=="\n"){c.push("\n")}}c.push("<",m);if(k){for(n=0,j=k.length;n<j;n++){h=k[n];c.push(" ",h.name,'="',f(h.value,true),'"')}}if(!p||g){c[c.length]=">"}else{c[c.length]=" />"}},end:function(h){var i;c.push("</",h,">");if(a&&d[h]&&c.length>0){i=c[c.length-1];if(i.length>0&&i!=="\n"){c.push("\n")}}},text:function(i,h){if(i.length>0){c[c.length]=h?i:f(i)}},cdata:function(h){c.push("<![CDATA[",h,"]]>")},comment:function(h){c.push("<!--",h,"-->")},pi:function(h,i){if(i){c.push("<?",h," ",i,"?>")}else{c.push("<?",h,"?>")}},doctype:function(h){c.push("<!DOCTYPE",h,">")},reset:function(){c.length=0},getContent:function(){return c.join("").replace(/\n$/,"")}}};(function(a){a.html.Serializer=function(c,d){var b=this,e=new a.html.Writer(c);c=c||{};c.validate="validate" in c?c.validate:true;b.schema=d=d||new a.html.Schema();b.writer=e;b.serialize=function(h){var g,i;i=c.validate;g={3:function(k,j){e.text(k.value,k.raw)},8:function(j){e.comment(j.value)},7:function(j){e.pi(j.name,j.value)},10:function(j){e.doctype(j.value)},4:function(j){e.cdata(j.value)},11:function(j){if((j=j.firstChild)){do{f(j)}while(j=j.next)}}};e.reset();function f(k){var t=g[k.type],j,o,s,r,p,u,n,m,q;if(!t){j=k.name;o=k.shortEnded;s=k.attributes;if(i&&s&&s.length>1){u=[];u.map={};q=d.getElementRule(k.name);for(n=0,m=q.attributesOrder.length;n<m;n++){r=q.attributesOrder[n];if(r in s.map){p=s.map[r];u.map[r]=p;u.push({name:r,value:p})}}for(n=0,m=s.length;n<m;n++){r=s[n].name;if(!(r in u.map)){p=s.map[r];u.map[r]=p;u.push({name:r,value:p})}}s=u}e.start(k.name,s,o);if(!o){if((k=k.firstChild)){do{f(k)}while(k=k.next)}e.end(j)}}else{t(k)}}if(h.type==1&&!c.inner){f(h)}else{g[11](h)}return e.getContent()}}})(tinymce);(function(d){var f=d.each,c=d.is,e=d.isWebKit,a=d.isIE,h=d.html.Entities,b=/^([a-z0-9],?)+$/i,g=d.html.Schema.blockElementsMap;d.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(m,k){var j=this,i;j.doc=m;j.win=window;j.files={};j.cssFlicker=false;j.counter=0;j.stdMode=!d.isIE||m.documentMode>=8;j.boxModel=!d.isIE||m.compatMode=="CSS1Compat"||j.stdMode;j.hasOuterHTML="outerHTML" in m.createElement("a");j.settings=k=d.extend({keep_values:false,hex_colors:1},k);j.styles=new d.html.Styles({url_converter:k.url_converter,url_converter_scope:k.url_converter_scope},k.schema);if(d.isIE6){try{m.execCommand("BackgroundImageCache",false,true)}catch(l){j.cssFlicker=true}}if(a){("abbr article aside audio canvas details figcaption figure footer header hgroup mark menu meter nav output progress section summary time video").replace(/\w+/g,function(n){m.createElement(n)})}d.addUnload(j.destroy,j)},getRoot:function(){var i=this,j=i.settings;return(j&&i.get(j.root_element))||i.doc.body},getViewPort:function(j){var k,i;j=!j?this.win:j;k=j.document;i=this.boxModel?k.documentElement:k.body;return{x:j.pageXOffset||i.scrollLeft,y:j.pageYOffset||i.scrollTop,w:j.innerWidth||i.clientWidth,h:j.innerHeight||i.clientHeight}},getRect:function(l){var k,i=this,j;l=i.get(l);k=i.getPos(l);j=i.getSize(l);return{x:k.x,y:k.y,w:j.w,h:j.h}},getSize:function(l){var j=this,i,k;l=j.get(l);i=j.getStyle(l,"width");k=j.getStyle(l,"height");if(i.indexOf("px")===-1){i=0}if(k.indexOf("px")===-1){k=0}return{w:parseInt(i)||l.offsetWidth||l.clientWidth,h:parseInt(k)||l.offsetHeight||l.clientHeight}},getParent:function(k,j,i){return this.getParents(k,j,i,false)},getParents:function(s,m,k,q){var j=this,i,l=j.settings,p=[];s=j.get(s);q=q===undefined;if(l.strict_root){k=k||j.getRoot()}if(c(m,"string")){i=m;if(m==="*"){m=function(o){return o.nodeType==1}}else{m=function(o){return j.is(o,i)}}}while(s){if(s==k||!s.nodeType||s.nodeType===9){break}if(!m||m(s)){if(q){p.push(s)}else{return s}}s=s.parentNode}return q?p:null},get:function(i){var j;if(i&&this.doc&&typeof(i)=="string"){j=i;i=this.doc.getElementById(i);if(i&&i.id!==j){return this.doc.getElementsByName(j)[1]}}return i},getNext:function(j,i){return this._findSib(j,i,"nextSibling")},getPrev:function(j,i){return this._findSib(j,i,"previousSibling")},select:function(k,j){var i=this;return d.dom.Sizzle(k,i.get(j)||i.get(i.settings.root_element)||i.doc,[])},is:function(l,j){var k;if(l.length===undefined){if(j==="*"){return l.nodeType==1}if(b.test(j)){j=j.toLowerCase().split(/,/);l=l.nodeName.toLowerCase();for(k=j.length-1;k>=0;k--){if(j[k]==l){return true}}return false}}return d.dom.Sizzle.matches(j,l.nodeType?[l]:l).length>0},add:function(l,o,i,k,m){var j=this;return this.run(l,function(r){var q,n;q=c(o,"string")?j.doc.createElement(o):o;j.setAttribs(q,i);if(k){if(k.nodeType){q.appendChild(k)}else{j.setHTML(q,k)}}return !m?r.appendChild(q):q})},create:function(k,i,j){return this.add(this.doc.createElement(k),k,i,j,1)},createHTML:function(q,i,m){var p="",l=this,j;p+="<"+q;for(j in i){if(i.hasOwnProperty(j)){p+=" "+j+'="'+l.encode(i[j])+'"'}}if(typeof(m)!="undefined"){return p+">"+m+"</"+q+">"}return p+" />"},remove:function(i,j){return this.run(i,function(l){var k,m;k=l.parentNode;if(!k){return null}if(j){while(m=l.firstChild){if(!d.isIE||m.nodeType!==3||m.nodeValue){k.insertBefore(m,l)}else{l.removeChild(m)}}}return k.removeChild(l)})},setStyle:function(l,i,j){var k=this;return k.run(l,function(o){var n,m;n=o.style;i=i.replace(/-(\D)/g,function(q,p){return p.toUpperCase()});if(k.pixelStyles.test(i)&&(d.is(j,"number")||/^[\-0-9\.]+$/.test(j))){j+="px"}switch(i){case"opacity":if(a){n.filter=j===""?"":"alpha(opacity="+(j*100)+")";if(!l.currentStyle||!l.currentStyle.hasLayout){n.display="inline-block"}}n[i]=n["-moz-opacity"]=n["-khtml-opacity"]=j||"";break;case"float":a?n.styleFloat=j:n.cssFloat=j;break;default:n[i]=j||""}if(k.settings.update_styles){k.setAttrib(o,"data-mce-style")}})},getStyle:function(l,i,k){l=this.get(l);if(!l){return false}if(this.doc.defaultView&&k){i=i.replace(/[A-Z]/g,function(m){return"-"+m});try{return this.doc.defaultView.getComputedStyle(l,null).getPropertyValue(i)}catch(j){return null}}i=i.replace(/-(\D)/g,function(n,m){return m.toUpperCase()});if(i=="float"){i=a?"styleFloat":"cssFloat"}if(l.currentStyle&&k){return l.currentStyle[i]}return l.style[i]},setStyles:function(l,m){var j=this,k=j.settings,i;i=k.update_styles;k.update_styles=0;f(m,function(o,p){j.setStyle(l,p,o)});k.update_styles=i;if(k.update_styles){j.setAttrib(l,k.cssText)}},removeAllAttribs:function(i){return this.run(i,function(l){var j=l.attributes;for(var k=j.length-1;k>=0;k--){l.removeAttributeNode(j.item(k))}})},setAttrib:function(k,l,i){var j=this;if(!k||!l){return}if(j.settings.strict){l=l.toLowerCase()}return this.run(k,function(n){var m=j.settings;switch(l){case"style":if(!c(i,"string")){f(i,function(o,p){j.setStyle(n,p,o)});return}if(m.keep_values){if(i&&!j._isRes(i)){n.setAttribute("data-mce-style",i,2)}else{n.removeAttribute("data-mce-style",2)}}n.style.cssText=i;break;case"class":n.className=i||"";break;case"src":case"href":if(m.keep_values){if(m.url_converter){i=m.url_converter.call(m.url_converter_scope||j,i,l,n)}j.setAttrib(n,"data-mce-"+l,i,2)}break;case"shape":n.setAttribute("data-mce-style",i);break}if(c(i)&&i!==null&&i.length!==0){n.setAttribute(l,""+i,2)}else{n.removeAttribute(l,2)}})},setAttribs:function(j,k){var i=this;return this.run(j,function(l){f(k,function(m,o){i.setAttrib(l,o,m)})})},getAttrib:function(l,m,k){var i,j=this;l=j.get(l);if(!l||l.nodeType!==1){return false}if(!c(k)){k=""}if(/^(src|href|style|coords|shape)$/.test(m)){i=l.getAttribute("data-mce-"+m);if(i){return i}}if(a&&j.props[m]){i=l[j.props[m]];i=i&&i.nodeValue?i.nodeValue:i}if(!i){i=l.getAttribute(m,2)}if(/^(checked|compact|declare|defer|disabled|ismap|multiple|nohref|noshade|nowrap|readonly|selected)$/.test(m)){if(l[j.props[m]]===true&&i===""){return m}return i?m:""}if(l.nodeName==="FORM"&&l.getAttributeNode(m)){return l.getAttributeNode(m).nodeValue}if(m==="style"){i=i||l.style.cssText;if(i){i=j.serializeStyle(j.parseStyle(i),l.nodeName);if(j.settings.keep_values&&!j._isRes(i)){l.setAttribute("data-mce-style",i)}}}if(e&&m==="class"&&i){i=i.replace(/(apple|webkit)\-[a-z\-]+/gi,"")}if(a){switch(m){case"rowspan":case"colspan":if(i===1){i=""}break;case"size":if(i==="+0"||i===20||i===0){i=""}break;case"width":case"height":case"vspace":case"checked":case"disabled":case"readonly":if(i===0){i=""}break;case"hspace":if(i===-1){i=""}break;case"maxlength":case"tabindex":if(i===32768||i===2147483647||i==="32768"){i=""}break;case"multiple":case"compact":case"noshade":case"nowrap":if(i===65535){return m}return k;case"shape":i=i.toLowerCase();break;default:if(m.indexOf("on")===0&&i){i=d._replace(/^function\s+\w+\(\)\s+\{\s+(.*)\s+\}$/,"$1",""+i)}}}return(i!==undefined&&i!==null&&i!=="")?""+i:k},getPos:function(q,l){var j=this,i=0,p=0,m,o=j.doc,k;q=j.get(q);l=l||o.body;if(q){if(a&&!j.stdMode){q=q.getBoundingClientRect();m=j.boxModel?o.documentElement:o.body;i=j.getStyle(j.select("html")[0],"borderWidth");i=(i=="medium"||j.boxModel&&!j.isIE6)&&2||i;return{x:q.left+m.scrollLeft-i,y:q.top+m.scrollTop-i}}k=q;while(k&&k!=l&&k.nodeType){i+=k.offsetLeft||0;p+=k.offsetTop||0;k=k.offsetParent}k=q.parentNode;while(k&&k!=l&&k.nodeType){i-=k.scrollLeft||0;p-=k.scrollTop||0;k=k.parentNode}}return{x:i,y:p}},parseStyle:function(i){return this.styles.parse(i)},serializeStyle:function(j,i){return this.styles.serialize(j,i)},loadCSS:function(i){var k=this,l=k.doc,j;if(!i){i=""}j=k.select("head")[0];f(i.split(","),function(m){var n;if(k.files[m]){return}k.files[m]=true;n=k.create("link",{rel:"stylesheet",href:d._addVer(m)});if(a&&l.documentMode&&l.recalc){n.onload=function(){if(l.recalc){l.recalc()}n.onload=null}}j.appendChild(n)})},addClass:function(i,j){return this.run(i,function(k){var l;if(!j){return 0}if(this.hasClass(k,j)){return k.className}l=this.removeClass(k,j);return k.className=(l!=""?(l+" "):"")+j})},removeClass:function(k,l){var i=this,j;return i.run(k,function(n){var m;if(i.hasClass(n,l)){if(!j){j=new RegExp("(^|\\s+)"+l+"(\\s+|$)","g")}m=n.className.replace(j," ");m=d.trim(m!=" "?m:"");n.className=m;if(!m){n.removeAttribute("class");n.removeAttribute("className")}return m}return n.className})},hasClass:function(j,i){j=this.get(j);if(!j||!i){return false}return(" "+j.className+" ").indexOf(" "+i+" ")!==-1},show:function(i){return this.setStyle(i,"display","block")},hide:function(i){return this.setStyle(i,"display","none")},isHidden:function(i){i=this.get(i);return !i||i.style.display=="none"||this.getStyle(i,"display")=="none"},uniqueId:function(i){return(!i?"mce_":i)+(this.counter++)},setHTML:function(k,j){var i=this;return i.run(k,function(m){if(a){while(m.firstChild){m.removeChild(m.firstChild)}try{m.innerHTML="<br />"+j;m.removeChild(m.firstChild)}catch(l){m=i.create("div");m.innerHTML="<br />"+j;f(m.childNodes,function(o,n){if(n){m.appendChild(o)}})}}else{m.innerHTML=j}return j})},getOuterHTML:function(k){var j,i=this;k=i.get(k);if(!k){return null}if(k.nodeType===1&&i.hasOuterHTML){return k.outerHTML}j=(k.ownerDocument||i.doc).createElement("body");j.appendChild(k.cloneNode(true));return j.innerHTML},setOuterHTML:function(l,j,m){var i=this;function k(p,o,r){var s,q;q=r.createElement("body");q.innerHTML=o;s=q.lastChild;while(s){i.insertAfter(s.cloneNode(true),p);s=s.previousSibling}i.remove(p)}return this.run(l,function(o){o=i.get(o);if(o.nodeType==1){m=m||o.ownerDocument||i.doc;if(a){try{if(a&&o.nodeType==1){o.outerHTML=j}else{k(o,j,m)}}catch(n){k(o,j,m)}}else{k(o,j,m)}}})},decode:h.decode,encode:h.encodeAllRaw,insertAfter:function(i,j){j=this.get(j);return this.run(i,function(l){var k,m;k=j.parentNode;m=j.nextSibling;if(m){k.insertBefore(l,m)}else{k.appendChild(l)}return l})},isBlock:function(j){var i=j.nodeType;if(i){return !!(i===1&&g[j.nodeName])}return !!g[j]},replace:function(m,l,i){var j=this;if(c(l,"array")){m=m.cloneNode(true)}return j.run(l,function(k){if(i){f(d.grep(k.childNodes),function(n){m.appendChild(n)})}return k.parentNode.replaceChild(m,k)})},rename:function(l,i){var k=this,j;if(l.nodeName!=i.toUpperCase()){j=k.create(i);f(k.getAttribs(l),function(m){k.setAttrib(j,m.nodeName,k.getAttrib(l,m.nodeName))});k.replace(j,l,1)}return j||l},findCommonAncestor:function(k,i){var l=k,j;while(l){j=i;while(j&&l!=j){j=j.parentNode}if(l==j){break}l=l.parentNode}if(!l&&k.ownerDocument){return k.ownerDocument.documentElement}return l},toHex:function(i){var k=/^\s*rgb\s*?\(\s*?([0-9]+)\s*?,\s*?([0-9]+)\s*?,\s*?([0-9]+)\s*?\)\s*$/i.exec(i);function j(l){l=parseInt(l).toString(16);return l.length>1?l:"0"+l}if(k){i="#"+j(k[1])+j(k[2])+j(k[3]);return i}return i},getClasses:function(){var n=this,j=[],m,o={},p=n.settings.class_filter,l;if(n.classes){return n.classes}function q(i){f(i.imports,function(s){q(s)});f(i.cssRules||i.rules,function(s){switch(s.type||1){case 1:if(s.selectorText){f(s.selectorText.split(","),function(r){r=r.replace(/^\s*|\s*$|^\s\./g,"");if(/\.mce/.test(r)||!/\.[\w\-]+$/.test(r)){return}l=r;r=d._replace(/.*\.([a-z0-9_\-]+).*/i,"$1",r);if(p&&!(r=p(r,l))){return}if(!o[r]){j.push({"class":r});o[r]=1}})}break;case 3:q(s.styleSheet);break}})}try{f(n.doc.styleSheets,q)}catch(k){}if(j.length>0){n.classes=j}return j},run:function(l,k,j){var i=this,m;if(i.doc&&typeof(l)==="string"){l=i.get(l)}if(!l){return false}j=j||this;if(!l.nodeType&&(l.length||l.length===0)){m=[];f(l,function(o,n){if(o){if(typeof(o)=="string"){o=i.doc.getElementById(o)}m.push(k.call(j,o,n))}});return m}return k.call(j,l)},getAttribs:function(j){var i;j=this.get(j);if(!j){return[]}if(a){i=[];if(j.nodeName=="OBJECT"){return j.attributes}if(j.nodeName==="OPTION"&&this.getAttrib(j,"selected")){i.push({specified:1,nodeName:"selected"})}j.cloneNode(false).outerHTML.replace(/<\/?[\w:\-]+ ?|=[\"][^\"]+\"|=\'[^\']+\'|=[\w\-]+|>/gi,"").replace(/[\w:\-]+/gi,function(k){i.push({specified:1,nodeName:k})});return i}return j.attributes},destroy:function(j){var i=this;if(i.events){i.events.destroy()}i.win=i.doc=i.root=i.events=null;if(!j){d.removeUnload(i.destroy)}},createRng:function(){var i=this.doc;return i.createRange?i.createRange():new d.dom.Range(this)},nodeIndex:function(n,o){var i=0,l,m,k,j;if(n){for(l=n.nodeType,n=n.previousSibling,m=n;n;n=n.previousSibling){k=n.nodeType;if(o&&k==3){j=false;try{j=n.nodeValue.length}catch(p){}if(k==l||!j){continue}}i++;l=k}}return i},split:function(m,l,p){var q=this,i=q.createRng(),n,k,o;function j(t){var s,r=t.childNodes;if(t.nodeType==1&&t.getAttribute("data-mce-type")=="bookmark"){return}for(s=r.length-1;s>=0;s--){j(r[s])}if(t.nodeType!=9){if(t.nodeType==3&&t.nodeValue.length>0){if(!q.isBlock(t.parentNode)||d.trim(t.nodeValue).length>0){return}}if(t.nodeType==1){r=t.childNodes;if(r.length==1&&r[0]&&r[0].nodeType==1&&r[0].getAttribute("data-mce-type")=="bookmark"){t.parentNode.insertBefore(r[0],t)}if(r.length||/^(br|hr|input|img)$/i.test(t.nodeName)){return}}q.remove(t)}return t}if(m&&l){i.setStart(m.parentNode,q.nodeIndex(m));i.setEnd(l.parentNode,q.nodeIndex(l));n=i.extractContents();i=q.createRng();i.setStart(l.parentNode,q.nodeIndex(l)+1);i.setEnd(m.parentNode,q.nodeIndex(m)+1);k=i.extractContents();o=m.parentNode;o.insertBefore(j(n),m);if(p){o.replaceChild(p,l)}else{o.insertBefore(l,m)}o.insertBefore(j(k),m);q.remove(m);return p||l}},bind:function(m,i,l,k){var j=this;if(!j.events){j.events=new d.dom.EventUtils()}return j.events.add(m,i,l,k||this)},unbind:function(l,i,k){var j=this;if(!j.events){j.events=new d.dom.EventUtils()}return j.events.remove(l,i,k)},_findSib:function(l,i,j){var k=this,m=i;if(l){if(c(m,"string")){m=function(n){return k.is(n,i)}}for(l=l[j];l;l=l[j]){if(m(l)){return l}}}return null},_isRes:function(i){return/^(top|left|bottom|right|width|height)/i.test(i)||/;\s*(top|left|bottom|right|width|height)/i.test(i)}});d.DOM=new d.dom.DOMUtils(document,{process_html:0})})(tinymce);(function(a){function b(c){var N=this,e=c.doc,S=0,E=1,j=2,D=true,R=false,U="startOffset",h="startContainer",P="endContainer",z="endOffset",k=tinymce.extend,n=c.nodeIndex;k(N,{startContainer:e,startOffset:0,endContainer:e,endOffset:0,collapsed:D,commonAncestorContainer:e,START_TO_START:0,START_TO_END:1,END_TO_END:2,END_TO_START:3,setStart:q,setEnd:s,setStartBefore:g,setStartAfter:I,setEndBefore:J,setEndAfter:u,collapse:A,selectNode:x,selectNodeContents:F,compareBoundaryPoints:v,deleteContents:p,extractContents:H,cloneContents:d,insertNode:C,surroundContents:M,cloneRange:K});function q(V,t){B(D,V,t)}function s(V,t){B(R,V,t)}function g(t){q(t.parentNode,n(t))}function I(t){q(t.parentNode,n(t)+1)}function J(t){s(t.parentNode,n(t))}function u(t){s(t.parentNode,n(t)+1)}function A(t){if(t){N[P]=N[h];N[z]=N[U]}else{N[h]=N[P];N[U]=N[z]}N.collapsed=D}function x(t){g(t);u(t)}function F(t){q(t,0);s(t,t.nodeType===1?t.childNodes.length:t.nodeValue.length)}function v(Y,t){var ab=N[h],W=N[U],aa=N[P],V=N[z],Z=t.startContainer,ad=t.startOffset,X=t.endContainer,ac=t.endOffset;if(Y===0){return G(ab,W,Z,ad)}if(Y===1){return G(aa,V,Z,ad)}if(Y===2){return G(aa,V,X,ac)}if(Y===3){return G(ab,W,X,ac)}}function p(){m(j)}function H(){return m(S)}function d(){return m(E)}function C(Y){var V=this[h],t=this[U],X,W;if((V.nodeType===3||V.nodeType===4)&&V.nodeValue){if(!t){V.parentNode.insertBefore(Y,V)}else{if(t>=V.nodeValue.length){c.insertAfter(Y,V)}else{X=V.splitText(t);V.parentNode.insertBefore(Y,X)}}}else{if(V.childNodes.length>0){W=V.childNodes[t]}if(W){V.insertBefore(Y,W)}else{V.appendChild(Y)}}}function M(V){var t=N.extractContents();N.insertNode(V);V.appendChild(t);N.selectNode(V)}function K(){return k(new b(c),{startContainer:N[h],startOffset:N[U],endContainer:N[P],endOffset:N[z],collapsed:N.collapsed,commonAncestorContainer:N.commonAncestorContainer})}function O(t,V){var W;if(t.nodeType==3){return t}if(V<0){return t}W=t.firstChild;while(W&&V>0){--V;W=W.nextSibling}if(W){return W}return t}function l(){return(N[h]==N[P]&&N[U]==N[z])}function G(X,Z,V,Y){var aa,W,t,ab,ad,ac;if(X==V){if(Z==Y){return 0}if(Z<Y){return -1}return 1}aa=V;while(aa&&aa.parentNode!=X){aa=aa.parentNode}if(aa){W=0;t=X.firstChild;while(t!=aa&&W<Z){W++;t=t.nextSibling}if(Z<=W){return -1}return 1}aa=X;while(aa&&aa.parentNode!=V){aa=aa.parentNode}if(aa){W=0;t=V.firstChild;while(t!=aa&&W<Y){W++;t=t.nextSibling}if(W<Y){return -1}return 1}ab=c.findCommonAncestor(X,V);ad=X;while(ad&&ad.parentNode!=ab){ad=ad.parentNode}if(!ad){ad=ab}ac=V;while(ac&&ac.parentNode!=ab){ac=ac.parentNode}if(!ac){ac=ab}if(ad==ac){return 0}t=ab.firstChild;while(t){if(t==ad){return -1}if(t==ac){return 1}t=t.nextSibling}}function B(V,Y,X){var t,W;if(V){N[h]=Y;N[U]=X}else{N[P]=Y;N[z]=X}t=N[P];while(t.parentNode){t=t.parentNode}W=N[h];while(W.parentNode){W=W.parentNode}if(W==t){if(G(N[h],N[U],N[P],N[z])>0){N.collapse(V)}}else{N.collapse(V)}N.collapsed=l();N.commonAncestorContainer=c.findCommonAncestor(N[h],N[P])}function m(ab){var aa,X=0,ad=0,V,Z,W,Y,t,ac;if(N[h]==N[P]){return f(ab)}for(aa=N[P],V=aa.parentNode;V;aa=V,V=V.parentNode){if(V==N[h]){return r(aa,ab)}++X}for(aa=N[h],V=aa.parentNode;V;aa=V,V=V.parentNode){if(V==N[P]){return T(aa,ab)}++ad}Z=ad-X;W=N[h];while(Z>0){W=W.parentNode;Z--}Y=N[P];while(Z<0){Y=Y.parentNode;Z++}for(t=W.parentNode,ac=Y.parentNode;t!=ac;t=t.parentNode,ac=ac.parentNode){W=t;Y=ac}return o(W,Y,ab)}function f(Z){var ab,Y,X,aa,t,W,V;if(Z!=j){ab=e.createDocumentFragment()}if(N[U]==N[z]){return ab}if(N[h].nodeType==3){Y=N[h].nodeValue;X=Y.substring(N[U],N[z]);if(Z!=E){N[h].deleteData(N[U],N[z]-N[U]);N.collapse(D)}if(Z==j){return}ab.appendChild(e.createTextNode(X));return ab}aa=O(N[h],N[U]);t=N[z]-N[U];while(t>0){W=aa.nextSibling;V=y(aa,Z);if(ab){ab.appendChild(V)}--t;aa=W}if(Z!=E){N.collapse(D)}return ab}function r(ab,Y){var aa,Z,V,t,X,W;if(Y!=j){aa=e.createDocumentFragment()}Z=i(ab,Y);if(aa){aa.appendChild(Z)}V=n(ab);t=V-N[U];if(t<=0){if(Y!=E){N.setEndBefore(ab);N.collapse(R)}return aa}Z=ab.previousSibling;while(t>0){X=Z.previousSibling;W=y(Z,Y);if(aa){aa.insertBefore(W,aa.firstChild)}--t;Z=X}if(Y!=E){N.setEndBefore(ab);N.collapse(R)}return aa}function T(Z,Y){var ab,V,aa,t,X,W;if(Y!=j){ab=e.createDocumentFragment()}aa=Q(Z,Y);if(ab){ab.appendChild(aa)}V=n(Z);++V;t=N[z]-V;aa=Z.nextSibling;while(t>0){X=aa.nextSibling;W=y(aa,Y);if(ab){ab.appendChild(W)}--t;aa=X}if(Y!=E){N.setStartAfter(Z);N.collapse(D)}return ab}function o(Z,t,ac){var W,ae,Y,aa,ab,V,ad,X;if(ac!=j){ae=e.createDocumentFragment()}W=Q(Z,ac);if(ae){ae.appendChild(W)}Y=Z.parentNode;aa=n(Z);ab=n(t);++aa;V=ab-aa;ad=Z.nextSibling;while(V>0){X=ad.nextSibling;W=y(ad,ac);if(ae){ae.appendChild(W)}ad=X;--V}W=i(t,ac);if(ae){ae.appendChild(W)}if(ac!=E){N.setStartAfter(Z);N.collapse(D)}return ae}function i(aa,ab){var W=O(N[P],N[z]-1),ac,Z,Y,t,V,X=W!=N[P];if(W==aa){return L(W,X,R,ab)}ac=W.parentNode;Z=L(ac,R,R,ab);while(ac){while(W){Y=W.previousSibling;t=L(W,X,R,ab);if(ab!=j){Z.insertBefore(t,Z.firstChild)}X=D;W=Y}if(ac==aa){return Z}W=ac.previousSibling;ac=ac.parentNode;V=L(ac,R,R,ab);if(ab!=j){V.appendChild(Z)}Z=V}}function Q(aa,ab){var X=O(N[h],N[U]),Y=X!=N[h],ac,Z,W,t,V;if(X==aa){return L(X,Y,D,ab)}ac=X.parentNode;Z=L(ac,R,D,ab);while(ac){while(X){W=X.nextSibling;t=L(X,Y,D,ab);if(ab!=j){Z.appendChild(t)}Y=D;X=W}if(ac==aa){return Z}X=ac.nextSibling;ac=ac.parentNode;V=L(ac,R,D,ab);if(ab!=j){V.appendChild(Z)}Z=V}}function L(t,Y,ab,ac){var X,W,Z,V,aa;if(Y){return y(t,ac)}if(t.nodeType==3){X=t.nodeValue;if(ab){V=N[U];W=X.substring(V);Z=X.substring(0,V)}else{V=N[z];W=X.substring(0,V);Z=X.substring(V)}if(ac!=E){t.nodeValue=Z}if(ac==j){return}aa=t.cloneNode(R);aa.nodeValue=W;return aa}if(ac==j){return}return t.cloneNode(R)}function y(V,t){if(t!=j){return t==E?V.cloneNode(D):V}V.parentNode.removeChild(V)}}a.Range=b})(tinymce.dom);(function(){function a(g){var i=this,j="\uFEFF",e,h,d=g.dom,c=true,f=false;function b(){var n=g.getRng(),k=d.createRng(),m,o;m=n.item?n.item(0):n.parentElement();if(m.ownerDocument!=d.doc){return k}o=g.isCollapsed();if(n.item||!m.hasChildNodes()){if(o){k.setStart(m,0);k.setEnd(m,0)}else{k.setStart(m.parentNode,d.nodeIndex(m));k.setEnd(k.startContainer,k.startOffset+1)}return k}function l(s){var u,q,t,p,A=0,x,y,z,r,v;r=n.duplicate();r.collapse(s);u=d.create("a");z=r.parentElement();if(!z.hasChildNodes()){k[s?"setStart":"setEnd"](z,0);return}z.appendChild(u);r.moveToElementText(u);v=n.compareEndPoints(s?"StartToStart":"EndToEnd",r);if(v>0){k[s?"setStartAfter":"setEndAfter"](z);d.remove(u);return}p=tinymce.grep(z.childNodes);x=p.length-1;while(A<=x){y=Math.floor((A+x)/2);z.insertBefore(u,p[y]);r.moveToElementText(u);v=n.compareEndPoints(s?"StartToStart":"EndToEnd",r);if(v>0){A=y+1}else{if(v<0){x=y-1}else{found=true;break}}}q=v>0||y==0?u.nextSibling:u.previousSibling;if(q.nodeType==1){d.remove(u);t=d.nodeIndex(q);q=q.parentNode;if(!s||y>0){t++}}else{if(v>0||y==0){r.setEndPoint(s?"StartToStart":"EndToEnd",n);t=r.text.length}else{r.setEndPoint(s?"StartToStart":"EndToEnd",n);t=q.nodeValue.length-r.text.length}d.remove(u)}k[s?"setStart":"setEnd"](q,t)}l(true);if(!o){l()}return k}this.addRange=function(k){var p,n,m,r,u,s,t=g.dom.doc,o=t.body;function l(B){var x,A,v,z,y;v=d.create("a");x=B?m:u;A=B?r:s;z=p.duplicate();if(x==t||x==t.documentElement){x=o;A=0}if(x.nodeType==3){x.parentNode.insertBefore(v,x);z.moveToElementText(v);z.moveStart("character",A);d.remove(v);p.setEndPoint(B?"StartToStart":"EndToEnd",z)}else{y=x.childNodes;if(y.length){if(A>=y.length){d.insertAfter(v,y[y.length-1])}else{x.insertBefore(v,y[A])}z.moveToElementText(v)}else{v=t.createTextNode(j);x.appendChild(v);z.moveToElementText(v.parentNode);z.collapse(c)}p.setEndPoint(B?"StartToStart":"EndToEnd",z);d.remove(v)}}this.destroy();m=k.startContainer;r=k.startOffset;u=k.endContainer;s=k.endOffset;p=o.createTextRange();if(m==u&&m.nodeType==1&&r==s-1){if(r==s-1){try{n=o.createControlRange();n.addElement(m.childNodes[r]);n.select();return}catch(q){}}}l(true);l();p.select()};this.getRangeAt=function(){if(!e||!tinymce.dom.RangeUtils.compareRanges(h,g.getRng())){e=b();h=g.getRng()}try{e.startContainer.nextSibling}catch(k){e=b();h=null}return e};this.destroy=function(){h=e=null}}tinymce.dom.TridentSelection=a})();(function(){var p=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,j=0,d=Object.prototype.toString,o=false,i=true;[0,0].sort(function(){i=false;return 0});var b=function(v,e,z,A){z=z||[];e=e||document;var C=e;if(e.nodeType!==1&&e.nodeType!==9){return[]}if(!v||typeof v!=="string"){return z}var x=[],s,E,H,r,u=true,t=b.isXML(e),B=v,D,G,F,y;do{p.exec("");s=p.exec(B);if(s){B=s[3];x.push(s[1]);if(s[2]){r=s[3];break}}}while(s);if(x.length>1&&k.exec(v)){if(x.length===2&&f.relative[x[0]]){E=h(x[0]+x[1],e)}else{E=f.relative[x[0]]?[e]:b(x.shift(),e);while(x.length){v=x.shift();if(f.relative[v]){v+=x.shift()}E=h(v,E)}}}else{if(!A&&x.length>1&&e.nodeType===9&&!t&&f.match.ID.test(x[0])&&!f.match.ID.test(x[x.length-1])){D=b.find(x.shift(),e,t);e=D.expr?b.filter(D.expr,D.set)[0]:D.set[0]}if(e){D=A?{expr:x.pop(),set:a(A)}:b.find(x.pop(),x.length===1&&(x[0]==="~"||x[0]==="+")&&e.parentNode?e.parentNode:e,t);E=D.expr?b.filter(D.expr,D.set):D.set;if(x.length>0){H=a(E)}else{u=false}while(x.length){G=x.pop();F=G;if(!f.relative[G]){G=""}else{F=x.pop()}if(F==null){F=e}f.relative[G](H,F,t)}}else{H=x=[]}}if(!H){H=E}if(!H){b.error(G||v)}if(d.call(H)==="[object Array]"){if(!u){z.push.apply(z,H)}else{if(e&&e.nodeType===1){for(y=0;H[y]!=null;y++){if(H[y]&&(H[y]===true||H[y].nodeType===1&&b.contains(e,H[y]))){z.push(E[y])}}}else{for(y=0;H[y]!=null;y++){if(H[y]&&H[y].nodeType===1){z.push(E[y])}}}}}else{a(H,z)}if(r){b(r,C,z,A);b.uniqueSort(z)}return z};b.uniqueSort=function(r){if(c){o=i;r.sort(c);if(o){for(var e=1;e<r.length;e++){if(r[e]===r[e-1]){r.splice(e--,1)}}}}return r};b.matches=function(e,r){return b(e,null,null,r)};b.find=function(y,e,z){var x;if(!y){return[]}for(var t=0,s=f.order.length;t<s;t++){var v=f.order[t],u;if((u=f.leftMatch[v].exec(y))){var r=u[1];u.splice(1,1);if(r.substr(r.length-1)!=="\\"){u[1]=(u[1]||"").replace(/\\/g,"");x=f.find[v](u,e,z);if(x!=null){y=y.replace(f.match[v],"");break}}}}if(!x){x=e.getElementsByTagName("*")}return{set:x,expr:y}};b.filter=function(C,B,F,u){var s=C,H=[],z=B,x,e,y=B&&B[0]&&b.isXML(B[0]);while(C&&B.length){for(var A in f.filter){if((x=f.leftMatch[A].exec(C))!=null&&x[2]){var r=f.filter[A],G,E,t=x[1];e=false;x.splice(1,1);if(t.substr(t.length-1)==="\\"){continue}if(z===H){H=[]}if(f.preFilter[A]){x=f.preFilter[A](x,z,F,H,u,y);if(!x){e=G=true}else{if(x===true){continue}}}if(x){for(var v=0;(E=z[v])!=null;v++){if(E){G=r(E,x,v,z);var D=u^!!G;if(F&&G!=null){if(D){e=true}else{z[v]=false}}else{if(D){H.push(E);e=true}}}}}if(G!==undefined){if(!F){z=H}C=C.replace(f.match[A],"");if(!e){return[]}break}}}if(C===s){if(e==null){b.error(C)}else{break}}s=C}return z};b.error=function(e){throw"Syntax error, unrecognized expression: "+e};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\))?/},leftMatch:{},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(e){return e.getAttribute("href")}},relative:{"+":function(x,r){var t=typeof r==="string",v=t&&!/\W/.test(r),y=t&&!v;if(v){r=r.toLowerCase()}for(var s=0,e=x.length,u;s<e;s++){if((u=x[s])){while((u=u.previousSibling)&&u.nodeType!==1){}x[s]=y||u&&u.nodeName.toLowerCase()===r?u||false:u===r}}if(y){b.filter(r,x,true)}},">":function(x,r){var u=typeof r==="string",v,s=0,e=x.length;if(u&&!/\W/.test(r)){r=r.toLowerCase();for(;s<e;s++){v=x[s];if(v){var t=v.parentNode;x[s]=t.nodeName.toLowerCase()===r?t:false}}}else{for(;s<e;s++){v=x[s];if(v){x[s]=u?v.parentNode:v.parentNode===r}}if(u){b.filter(r,x,true)}}},"":function(t,r,v){var s=j++,e=q,u;if(typeof r==="string"&&!/\W/.test(r)){r=r.toLowerCase();u=r;e=n}e("parentNode",r,s,t,u,v)},"~":function(t,r,v){var s=j++,e=q,u;if(typeof r==="string"&&!/\W/.test(r)){r=r.toLowerCase();u=r;e=n}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){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,x,y){t=" "+t[1].replace(/\\/g,"")+" ";if(y){return t}for(var u=0,v;(v=r[u])!=null;u++){if(v){if(x^(v.className&&(" "+v.className+" ").replace(/[\t\n]/g," ").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){return r[1].toLowerCase()},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]=j++;return e},ATTR:function(u,r,s,e,v,x){var t=u[1].replace(/\\/g,"");if(!x&&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((p.exec(u[3])||"").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.toLowerCase()==="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(s,y,x,z){var e=y[1],r=f.filters[e];if(r){return r(s,x,y,z)}else{if(e==="contains"){return(s.textContent||s.innerText||b.getText([s])||"").indexOf(y[3])>=0}else{if(e==="not"){var t=y[3];for(var v=0,u=t.length;v<u;v++){if(t[v]===s){return false}}return true}else{b.error("Syntax error, unrecognized expression: "+e)}}}},CHILD:function(e,t){var x=t[1],r=e;switch(x){case"only":case"first":while((r=r.previousSibling)){if(r.nodeType===1){return false}}if(x==="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],A=t[3];if(s===1&&A===0){return true}var v=t[0],z=e.parentNode;if(z&&(z.sizcache!==v||!e.nodeIndex)){var u=0;for(r=z.firstChild;r;r=r.nextSibling){if(r.nodeType===1){r.nodeIndex=++u}}z.sizcache=v}var y=e.nodeIndex-A;if(s===0){return y===0}else{return(y%s===0&&y/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.toLowerCase()===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),x=e+"",u=t[2],r=t[4];return e==null?u==="!=":u==="="?x===r:u==="*="?x.indexOf(r)>=0:u==="~="?(" "+x+" ").indexOf(r)>=0:!r?x&&e!==false:u==="!="?x!==r:u==="^="?x.indexOf(r)===0:u==="$="?x.substr(x.length-r.length)===r:u==="|="?x===r||x.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 k=f.match.POS,g=function(r,e){return"\\"+(e-0+1)};for(var m in f.match){f.match[m]=new RegExp(f.match[m].source+(/(?![^\[]*\])(?![^\(]*\))/.source));f.leftMatch[m]=new RegExp(/(^(?:.|\r|\n)*?)/.source+f.match[m].source.replace(/\\(\d+)/g,g))}var a=function(r,e){r=Array.prototype.slice.call(r,0);if(e){e.push.apply(e,r);return e}return r};try{Array.prototype.slice.call(document.documentElement.childNodes,0)[0].nodeType}catch(l){a=function(u,t){var r=t||[],s=0;if(d.call(u)==="[object Array]"){Array.prototype.push.apply(r,u)}else{if(typeof u.length==="number"){for(var e=u.length;s<e;s++){r.push(u[s])}}else{for(;u[s];s++){r.push(u[s])}}}return r}}var c;if(document.documentElement.compareDocumentPosition){c=function(r,e){if(!r.compareDocumentPosition||!e.compareDocumentPosition){if(r==e){o=true}return r.compareDocumentPosition?-1:1}var s=r.compareDocumentPosition(e)&4?-1:r===e?0:1;if(s===0){o=true}return s}}else{if("sourceIndex" in document.documentElement){c=function(r,e){if(!r.sourceIndex||!e.sourceIndex){if(r==e){o=true}return r.sourceIndex?-1:1}var s=r.sourceIndex-e.sourceIndex;if(s===0){o=true}return s}}else{if(document.createRange){c=function(t,r){if(!t.ownerDocument||!r.ownerDocument){if(t==r){o=true}return t.ownerDocument?-1:1}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){o=true}return u}}}}b.getText=function(e){var r="",t;for(var s=0;e[s];s++){t=e[s];if(t.nodeType===3||t.nodeType===4){r+=t.nodeValue}else{if(t.nodeType!==8){r+=b.getText(t.childNodes)}}}return r};(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,x){if(typeof v.getElementById!=="undefined"&&!x){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);e=r=null})();(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)}}e=null})();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(x,v,t,u){v=v||document;if(!u&&v.nodeType===9&&!b.isXML(v)){try{return a(v.querySelectorAll(x),t)}catch(y){}}return e(x,v,t,u)};for(var r in e){b[r]=e[r]}s=null})()}(function(){var e=document.createElement("div");e.innerHTML="<div class='test e'></div><div class='test'></div>";if(!e.getElementsByClassName||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])}};e=null})();function n(r,x,v,A,y,z){for(var t=0,s=A.length;t<s;t++){var e=A[t];if(e){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.toLowerCase()===x){u=e;break}e=e[r]}A[t]=u}}}function q(r,x,v,A,y,z){for(var t=0,s=A.length;t<s;t++){var e=A[t];if(e){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 x!=="string"){if(e===x){u=true;break}}else{if(b.filter(x,[e]).length>0){u=e;break}}}e=e[r]}A[t]=u}}}b.contains=document.compareDocumentPosition?function(r,e){return !!(r.compareDocumentPosition(e)&16)}:function(r,e){return r!==e&&(r.contains?r.contains(e):true)};b.isXML=function(e){var r=(e?e.ownerDocument||e:0).documentElement;return r?r.nodeName!=="HTML":false};var h=function(e,y){var t=[],u="",v,s=y.nodeType?[y]:y;while((v=f.match.PSEUDO.exec(e))){u+=v[0];e=e.replace(f.match.PSEUDO,"")}e=f.relative[e]?e+"*":e;for(var x=0,r=s.length;x<r;x++){b(e,s[x],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){a.dom.Element=function(f,d){var b=this,e,c;b.settings=d=d||{};b.id=f;b.dom=e=d.dom||a.DOM;if(!a.isIE){c=e.get(b.id)}a.each(("getPos,getRect,getParent,add,setStyle,getStyle,setStyles,setAttrib,setAttribs,getAttrib,addClass,removeClass,hasClass,getOuterHTML,setOuterHTML,remove,show,hide,isHidden,setHTML,get").split(/,/),function(g){b[g]=function(){var h=[f],j;for(j=0;j<arguments.length;j++){h.push(arguments[j])}h=e[g].apply(e,h);b.update(g);return h}});a.extend(b,{on:function(i,h,g){return a.dom.Event.add(b.id,i,h,g)},getXY:function(){return{x:parseInt(b.getStyle("left")),y:parseInt(b.getStyle("top"))}},getSize:function(){var g=e.get(b.id);return{w:parseInt(b.getStyle("width")||g.clientWidth),h:parseInt(b.getStyle("height")||g.clientHeight)}},moveTo:function(g,h){b.setStyles({left:g,top:h})},moveBy:function(g,i){var h=b.getXY();b.moveTo(h.x+g,h.y+i)},resizeTo:function(g,i){b.setStyles({width:g,height:i})},resizeBy:function(g,j){var i=b.getSize();b.resizeTo(i.w+g,i.h+j)},update:function(h){var g;if(a.isIE6&&d.blocker){h=h||"";if(h.indexOf("get")===0||h.indexOf("has")===0||h.indexOf("is")===0){return}if(h=="remove"){e.remove(b.blocker);return}if(!b.blocker){b.blocker=e.uniqueId();g=e.add(d.container||e.getRoot(),"iframe",{id:b.blocker,style:"position:absolute;",frameBorder:0,src:'javascript:""'});e.setStyle(g,"opacity",0)}else{g=e.get(b.blocker)}e.setStyles(g,{left:b.getStyle("left",1),top:b.getStyle("top",1),width:b.getStyle("width",1),height:b.getStyle("height",1),display:b.getStyle("display",1),zIndex:parseInt(b.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)}if(c.isIE&&i.boxModel){this._fixIESelection()}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(k,j){var h=this,f=h.getRng(),i,l=h.win.document,m,g;j=j||{format:"html"};j.set=true;k=j.content=k;if(!j.no_events){h.onBeforeSetContent.dispatch(h,j)}k=j.content;if(f.insertNode){k+='<span id="__caret">_</span>';if(f.startContainer==l&&f.endContainer==l){l.body.innerHTML=k}else{f.deleteContents();if(l.body.childNodes.length==0){l.body.innerHTML=k}else{if(f.createContextualFragment){f.insertNode(f.createContextualFragment(k))}else{m=l.createDocumentFragment();g=l.createElement("div");m.appendChild(g);g.outerHTML=k;f.insertNode(m)}}}i=h.dom.get("__caret");f=l.createRange();f.setStartBefore(i);f.setEndBefore(i);h.setRng(f);h.dom.remove("__caret");h.setRng(f)}else{if(f.item){l.execCommand("Delete",false,null);f=h.getRng()}f.pasteHTML(k)}if(!j.no_events){h.onSetContent.dispatch(h,j)}},getStart:function(){var g=this.getRng(),h,f,j,i;if(g.duplicate||g.item){if(g.item){return g.item(0)}j=g.duplicate();j.collapse(1);h=j.parentElement();f=i=g.parentElement();while(i=i.parentNode){if(i==h){h=f;break}}return h}else{h=g.startContainer;if(h.nodeType==1&&h.hasChildNodes()){h=h.childNodes[Math.min(h.childNodes.length-1,g.startOffset)]}if(h&&h.nodeType==3){return h.parentNode}return h}},getEnd:function(){var g=this,h=g.getRng(),i,f;if(h.duplicate||h.item){if(h.item){return h.item(0)}h=h.duplicate();h.collapse(0);i=h.parentElement();if(i&&i.nodeName=="BODY"){return i.lastChild||i}return i}else{i=h.endContainer;f=h.endOffset;if(i.nodeType==1&&i.hasChildNodes()){i=i.childNodes[f>0?f-1:f]}if(i&&i.nodeType==3){return i.parentNode}return i}},getBookmark:function(r,s){var v=this,m=v.dom,g,j,i,n,h,o,p,l="\uFEFF",u;function f(x,y){var t=0;d(m.select(x),function(A,z){if(A==y){t=z}});return t}if(r==2){function k(){var x=v.getRng(true),t=m.getRoot(),y={};function z(C,H){var B=C[H?"startContainer":"endContainer"],G=C[H?"startOffset":"endOffset"],A=[],D,F,E=0;if(B.nodeType==3){if(s){for(D=B.previousSibling;D&&D.nodeType==3;D=D.previousSibling){G+=D.nodeValue.length}}A.push(G)}else{F=B.childNodes;if(G>=F.length&&F.length){E=1;G=Math.max(0,F.length-1)}A.push(v.dom.nodeIndex(F[G],s)+E)}for(;B&&B!=t;B=B.parentNode){A.push(v.dom.nodeIndex(B,s))}return A}y.start=z(x,true);if(!v.isCollapsed()){y.end=z(x)}return y}return k()}if(r){return{rng:v.getRng()}}g=v.getRng();i=m.uniqueId();n=tinyMCE.activeEditor.selection.isCollapsed();u="overflow:hidden;line-height:0px";if(g.duplicate||g.item){if(!g.item){j=g.duplicate();try{g.collapse();g.pasteHTML('<span data-mce-type="bookmark" id="'+i+'_start" style="'+u+'">'+l+"</span>");if(!n){j.collapse(false);g.moveToElementText(j.parentElement());if(g.compareEndPoints("StartToEnd",j)==0){j.move("character",-1)}j.pasteHTML('<span data-mce-type="bookmark" id="'+i+'_end" style="'+u+'">'+l+"</span>")}}catch(q){return null}}else{o=g.item(0);h=o.nodeName;return{name:h,index:f(h,o)}}}else{o=v.getNode();h=o.nodeName;if(h=="IMG"){return{name:h,index:f(h,o)}}j=g.cloneRange();if(!n){j.collapse(false);j.insertNode(m.create("span",{"data-mce-type":"bookmark",id:i+"_end",style:u},l))}g.collapse(true);g.insertNode(m.create("span",{"data-mce-type":"bookmark",id:i+"_start",style:u},l))}v.moveToBookmark({id:i,keep:1});return{id:i}},moveToBookmark:function(n){var r=this,l=r.dom,i,h,f,q,j,s,o,p;if(r.tridentSel){r.tridentSel.destroy()}if(n){if(n.start){f=l.createRng();q=l.getRoot();function g(z){var t=n[z?"start":"end"],v,x,y,u;if(t){y=t[0];for(x=q,v=t.length-1;v>=1;v--){u=x.childNodes;if(t[v]>u.length-1){return}x=u[t[v]]}if(x.nodeType===3){y=Math.min(t[0],x.nodeValue.length)}if(x.nodeType===1){y=Math.min(t[0],x.childNodes.length)}if(z){f.setStart(x,y)}else{f.setEnd(x,y)}}return true}if(g(true)&&g()){r.setRng(f)}}else{if(n.id){function k(A){var u=l.get(n.id+"_"+A),z,t,x,y,v=n.keep;if(u){z=u.parentNode;if(A=="start"){if(!v){t=l.nodeIndex(u)}else{z=u.firstChild;t=1}j=s=z;o=p=t}else{if(!v){t=l.nodeIndex(u)}else{z=u.firstChild;t=1}s=z;p=t}if(!v){y=u.previousSibling;x=u.nextSibling;d(c.grep(u.childNodes),function(B){if(B.nodeType==3){B.nodeValue=B.nodeValue.replace(/\uFEFF/g,"")}});while(u=l.get(n.id+"_"+A)){l.remove(u,1)}if(y&&x&&y.nodeType==x.nodeType&&y.nodeType==3&&!c.isOpera){t=y.nodeValue.length;y.appendData(x.nodeValue);l.remove(x);if(A=="start"){j=s=y;o=p=t}else{s=y;p=t}}}}}function m(t){if(l.isBlock(t)&&!t.innerHTML){t.innerHTML=!a?'<br data-mce-bogus="1" />':" "}return t}k("start");k("end");if(j){f=l.createRng();f.setStart(m(j),o);f.setEnd(m(s),p);r.setRng(f)}}else{if(n.name){r.select(l.select(n.name)[n.index])}else{if(n.rng){r.setRng(n.rng)}}}}}},select:function(k,j){var i=this,l=i.dom,g=l.createRng(),f;if(k){f=l.nodeIndex(k);g.setStart(k.parentNode,f);g.setEnd(k.parentNode,f+1);if(j){function h(m,o){var n=new c.dom.TreeWalker(m,m);do{if(m.nodeType==3&&c.trim(m.nodeValue).length!=0){if(o){g.setStart(m,0)}else{g.setEnd(m,m.nodeValue.length)}return}if(m.nodeName=="BR"){if(o){g.setStartBefore(m)}else{g.setEndBefore(m)}return}}while(m=(o?n.next():n.prev()))}h(k,1);h(k)}i.setRng(g)}return k},isCollapsed:function(){var f=this,h=f.getRng(),g=f.getSel();if(!h||h.item){return false}if(h.compareEndPoints){return h.compareEndPoints("StartToEnd",h)===0}return !g||h.collapsed},collapse:function(f){var h=this,g=h.getRng(),i;if(g.item){i=g.item(0);g=h.win.document.body.createTextRange();g.moveToElementText(i)}g.collapse(!!f);h.setRng(g)},getSel:function(){var g=this,f=this.win;return f.getSelection?f.getSelection():f.document.selection},getRng:function(l){var g=this,h,i,k,j=g.win.document;if(l&&g.tridentSel){return g.tridentSel.getRangeAt(0)}try{if(h=g.getSel()){i=h.rangeCount>0?h.getRangeAt(0):(h.createRange?h.createRange():j.createRange())}}catch(f){}if(c.isIE&&i&&i.setStart&&j.selection.createRange().item){k=j.selection.createRange().item(0);i=j.createRange();i.setStartBefore(k);i.setEndAfter(k)}if(!i){i=j.createRange?j.createRange():j.body.createTextRange()}if(g.selectedRange&&g.explicitRange){if(i.compareBoundaryPoints(i.START_TO_START,g.selectedRange)===0&&i.compareBoundaryPoints(i.END_TO_END,g.selectedRange)===0){i=g.explicitRange}else{g.selectedRange=null;g.explicitRange=null}}return i},setRng:function(i){var h,g=this;if(!g.tridentSel){h=g.getSel();if(h){g.explicitRange=i;h.removeAllRanges();h.addRange(i);g.selectedRange=h.getRangeAt(0)}}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 h=this,g=h.getRng(),i=h.getSel(),l,k=g.startContainer,f=g.endContainer;if(!g){return h.dom.getRoot()}if(g.setStart){l=g.commonAncestorContainer;if(!g.collapsed){if(g.startContainer==g.endContainer){if(g.endOffset-g.startOffset<2){if(g.startContainer.hasChildNodes()){l=g.startContainer.childNodes[g.startOffset]}}}if(k.nodeType===3&&f.nodeType===3){function j(p,m){var o=p;while(p&&p.nodeType===3&&p.length===0){p=m?p.nextSibling:p.previousSibling}return p||o}if(k.length===g.startOffset){k=j(k.nextSibling,true)}else{k=k.parentNode}if(g.endOffset===0){f=j(f.previousSibling,false)}else{f=f.parentNode}if(k&&k===f){return k}}}if(l&&l.nodeType==3){return l.parentNode}return l}return g.item?g.item(0):g.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)}},_fixIESelection:function(){var g=this.dom,m=g.doc,h=m.body,j,n,f;m.documentElement.unselectable=true;function i(o,r){var p=h.createTextRange();try{p.moveToPoint(o,r)}catch(q){p=null}return p}function l(p){var o;if(p.button){o=i(p.x,p.y);if(o){if(o.compareEndPoints("StartToStart",n)>0){o.setEndPoint("StartToStart",n)}else{o.setEndPoint("EndToEnd",n)}o.select()}}else{k()}}function k(){var o=m.selection.createRange();if(n&&!o.item&&o.compareEndPoints("StartToEnd",o)===0){n.select()}g.unbind(m,"mouseup",k);g.unbind(m,"mousemove",l);n=j=0}g.bind(m,["mousedown","contextmenu"],function(o){if(o.target.nodeName==="HTML"){if(j){k()}f=m.documentElement;if(f.scrollHeight>f.clientHeight){return}j=1;n=i(o.x,o.y);if(n){g.bind(m,"mouseup",k);g.bind(m,"mousemove",l);g.win.focus();n.select()}}})}})})(tinymce);(function(a){a.dom.Serializer=function(e,i,f){var h,b,d=a.isIE,g=a.each,c;if(!e.apply_source_formatting){e.indent=false}e.remove_trailing_brs=true;i=i||a.DOM;f=f||new a.html.Schema(e);e.entity_encoding=e.entity_encoding||"named";h=new a.util.Dispatcher(self);b=new a.util.Dispatcher(self);c=new a.html.DomParser(e,f);c.addAttributeFilter("src,href,style",function(k,j){var o=k.length,l,q,n="data-mce-"+j,p=e.url_converter,r=e.url_converter_scope,m;while(o--){l=k[o];q=l.attributes.map[n];if(q!==m){l.attr(j,q.length>0?q:null);l.attr(n,null)}else{q=l.attributes.map[j];if(j==="style"){q=i.serializeStyle(i.parseStyle(q),l.name)}else{if(p){q=p.call(r,q,j,l.name)}}l.attr(j,q.length>0?q:null)}}});c.addAttributeFilter("class",function(j,k){var l=j.length,m,n;while(l--){m=j[l];n=m.attr("class").replace(/\s*mce(Item\w+|Selected)\s*/g,"");m.attr("class",n.length>0?n:null)}});c.addAttributeFilter("data-mce-type",function(j,l,k){var m=j.length,n;while(m--){n=j[m];if(n.attributes.map["data-mce-type"]==="bookmark"&&!k.cleanup){n.remove()}}});c.addNodeFilter("script,style",function(k,l){var m=k.length,n,o;function j(p){return p.replace(/(<!--\[CDATA\[|\]\]-->)/g,"\n").replace(/^[\r\n]*|[\r\n]*$/g,"").replace(/^\s*(\/\/\s*<!--|\/\/\s*<!\[CDATA\[|<!--|<!\[CDATA\[)[\r\n]*/g,"").replace(/\s*(\/\/\s*\]\]>|\/\/\s*-->|\]\]>|-->|\]\]-->)\s*$/g,"")}while(m--){n=k[m];o=n.firstChild?n.firstChild.value:"";if(l==="script"){n.attr("type",(n.attr("type")||"text/javascript").replace(/^mce\-/,""));if(o.length>0){n.firstChild.value="// <![CDATA[\n"+j(o)+"\n// ]]>"}}else{if(o.length>0){n.firstChild.value="<!--\n"+j(o)+"\n-->"}}}});c.addNodeFilter("#comment",function(j,k){var l=j.length,m;while(l--){m=j[l];if(m.value.indexOf("[CDATA[")===0){m.name="#cdata";m.type=4;m.value=m.value.replace(/^\[CDATA\[|\]\]$/g,"")}else{if(m.value.indexOf("mce:protected ")===0){m.name="#text";m.type=3;m.raw=true;m.value=unescape(m.value).substr(14)}}}});c.addNodeFilter("xml:namespace,input",function(j,k){var l=j.length,m;while(l--){m=j[l];if(m.type===7){m.remove()}else{if(m.type===1){if(k==="input"&&!("type" in m.attributes.map)){m.attr("type","text")}}}}});if(e.fix_list_elements){c.addNodeFilter("ul,ol",function(k,l){var m=k.length,n,j;while(m--){n=k[m];j=n.parent;if(j.name==="ul"||j.name==="ol"){if(n.prev&&n.prev.name==="li"){n.prev.append(n)}}}})}c.addAttributeFilter("data-mce-src,data-mce-href,data-mce-style",function(j,k){var l=j.length;while(l--){j[l].attr(k,null)}});return{schema:f,addNodeFilter:c.addNodeFilter,addAttributeFilter:c.addAttributeFilter,onPreProcess:h,onPostProcess:b,serialize:function(o,m){var l,p,k,j,n;if(d&&i.select("script,style,select").length>0){n=o.innerHTML;o=o.cloneNode(false);i.setHTML(o,n)}else{o=o.cloneNode(true)}l=o.ownerDocument.implementation;if(l.createHTMLDocument){p=l.createHTMLDocument("");g(o.nodeName=="BODY"?o.childNodes:[o],function(q){p.body.appendChild(p.importNode(q,true))});if(o.nodeName!="BODY"){o=p.body.firstChild}else{o=p.body}k=i.doc;i.doc=p}m=m||{};m.format=m.format||"html";if(!m.no_events){m.node=o;h.dispatch(self,m)}j=new a.html.Serializer(e,f);m.content=j.serialize(c.parse(m.getInner?o.innerHTML:a.trim(i.getOuterHTML(o),m),m));if(!m.no_events){b.dispatch(self,m)}if(k){i.doc=k}m.node=null;return m.content},addRules:function(j){f.addValidElements(j)},setRules:function(j){f.setValidElements(j)}}}})(tinymce);(function(a){a.dom.ScriptLoader=function(h){var c=0,k=1,i=2,l={},j=[],f={},d=[],g=0,e;function b(m,v){var x=this,q=a.DOM,s,o,r,n;function p(){q.remove(n);if(s){s.onreadystatechange=s.onload=s=null}v()}function u(){if(typeof(console)!=="undefined"&&console.log){console.log("Failed to load: "+m)}}n=q.uniqueId();if(a.isIE6){o=new a.util.URI(m);r=location;if(o.host==r.hostname&&o.port==r.port&&(o.protocol+":")==r.protocol&&o.protocol.toLowerCase()!="file"){a.util.XHR.send({url:a._addVer(o.getURI()),success:function(y){var t=q.create("script",{type:"text/javascript"});t.text=y;document.getElementsByTagName("head")[0].appendChild(t);q.remove(t);p()},error:u});return}}s=q.create("script",{id:n,type:"text/javascript",src:a._addVer(m)});if(!a.isIE){s.onload=p}s.onerror=u;if(!a.isOpera){s.onreadystatechange=function(){var t=s.readyState;if(t=="complete"||t=="loaded"){p()}}}(document.getElementsByTagName("head")[0]||document.body).appendChild(s)}this.isDone=function(m){return l[m]==i};this.markDone=function(m){l[m]=i};this.add=this.load=function(m,q,n){var o,p=l[m];if(p==e){j.push(m);l[m]=c}if(q){if(!f[m]){f[m]=[]}f[m].push({func:q,scope:n||this})}};this.loadQueue=function(n,m){this.loadScripts(j,n,m)};this.loadScripts=function(m,q,p){var o;function n(r){a.each(f[r],function(s){s.func.call(s.scope)});f[r]=e}d.push({func:q,scope:p||this});o=function(){var r=a.grep(m);m.length=0;a.each(r,function(s){if(l[s]==i){n(s);return}if(l[s]!=k){l[s]=k;g++;b(s,function(){l[s]=i;g--;n(s);o()})}});if(!g){a.each(d,function(s){s.func.call(s.scope)});d.length=0}};o()}};a.ScriptLoader=new a.dom.ScriptLoader()})(tinymce);tinymce.dom.TreeWalker=function(a,c){var b=a;function d(i,f,e,j){var h,g;if(i){if(!j&&i[f]){return i[f]}if(i!=c){h=i[e];if(h){return h}for(g=i.parentNode;g&&g!=c;g=g.parentNode){h=g[e];if(h){return h}}}}}this.current=function(){return b};this.next=function(e){return(b=d(b,"firstChild","nextSibling",e))};this.prev=function(e){return(b=d(b,"lastChild","previousSibling",e))}};(function(a){a.dom.RangeUtils=function(c){var b="\uFEFF";this.walk=function(d,r){var h=d.startContainer,k=d.startOffset,s=d.endContainer,l=d.endOffset,i,f,n,g,q,p,e;e=c.select("td.mceSelected,th.mceSelected");if(e.length>0){a.each(e,function(t){r([t])});return}function o(v,u,t){var x=[];for(;v&&v!=t;v=v[u]){x.push(v)}return x}function m(u,t){do{if(u.parentNode==t){return u}u=u.parentNode}while(u)}function j(v,u,x){var t=x?"nextSibling":"previousSibling";for(g=v,q=g.parentNode;g&&g!=u;g=q){q=g.parentNode;p=o(g==v?g:g[t],t);if(p.length){if(!x){p.reverse()}r(p)}}}if(h.nodeType==1&&h.hasChildNodes()){h=h.childNodes[k]}if(s.nodeType==1&&s.hasChildNodes()){s=s.childNodes[Math.min(l-1,s.childNodes.length-1)]}i=c.findCommonAncestor(h,s);if(h==s){return r([h])}for(g=h;g;g=g.parentNode){if(g==s){return j(h,i,true)}if(g==i){break}}for(g=s;g;g=g.parentNode){if(g==h){return j(s,i)}if(g==i){break}}f=m(h,i)||h;n=m(s,i)||s;j(h,f,true);p=o(f==h?f:f.nextSibling,"nextSibling",n==s?n.nextSibling:n);if(p.length){r(p)}j(s,n)}};a.dom.RangeUtils.compareRanges=function(c,b){if(c&&b){if(c.item||c.duplicate){if(c.item&&b.item&&c.item(0)===b.item(0)){return true}if(c.isEqual&&b.isEqual&&b.isEqual(c)){return true}}else{return c.startContainer==b.startContainer&&c.startOffset==b.startOffset}}return false}})(tinymce);(function(b){var a=b.dom.Event,c=b.each;b.create("tinymce.ui.KeyboardNavigation",{KeyboardNavigation:function(e,f){var p=this,m=e.root,l=e.items,n=e.enableUpDown,i=e.enableLeftRight||!e.enableUpDown,k=e.excludeFromTabOrder,j,h,o,d,g;f=f||b.DOM;j=function(q){g=q.target.id};h=function(q){f.setAttrib(q.target.id,"tabindex","-1")};d=function(q){var r=f.get(g);f.setAttrib(r,"tabindex","0");r.focus()};p.focus=function(){f.get(g).focus()};p.destroy=function(){c(l,function(q){f.unbind(f.get(q.id),"focus",j);f.unbind(f.get(q.id),"blur",h)});f.unbind(f.get(m),"focus",d);f.unbind(f.get(m),"keydown",o);l=f=m=p.focus=j=h=o=d=null;p.destroy=function(){}};p.moveFocus=function(u,r){var q=-1,t=p.controls,s;if(!g){return}c(l,function(x,v){if(x.id===g){q=v;return false}});q+=u;if(q<0){q=l.length-1}else{if(q>=l.length){q=0}}s=l[q];f.setAttrib(g,"tabindex","-1");f.setAttrib(s.id,"tabindex","0");f.get(s.id).focus();if(e.actOnFocus){e.onAction(s.id)}if(r){a.cancel(r)}};o=function(y){var u=37,t=39,x=38,z=40,q=27,s=14,r=13,v=32;switch(y.keyCode){case u:if(i){p.moveFocus(-1)}break;case t:if(i){p.moveFocus(1)}break;case x:if(n){p.moveFocus(-1)}break;case z:if(n){p.moveFocus(1)}break;case q:if(e.onCancel){e.onCancel();a.cancel(y)}break;case s:case r:case v:if(e.onAction){e.onAction(g);a.cancel(y)}break}};c(l,function(s,q){var r;if(!s.id){s.id=f.uniqueId("_mce_item_")}if(k){f.bind(s.id,"blur",h);r="-1"}else{r=(q===0?"0":"-1")}f.setAttrib(s.id,"tabindex",r);f.bind(f.get(s.id),"focus",j)});if(l[0]){g=l[0].id}f.setAttrib(m,"tabindex","-1");f.bind(f.get(m),"focus",d);f.bind(f.get(m),"keydown",o)}})})(tinymce);(function(c){var b=c.DOM,a=c.is;c.create("tinymce.ui.Control",{Control:function(f,e,d){this.id=f;this.settings=e=e||{};this.rendered=false;this.onRender=new c.util.Dispatcher(this);this.classPrefix="";this.scope=e.scope||this;this.disabled=0;this.active=0;this.editor=d},setAriaProperty:function(f,e){var d=b.get(this.id+"_aria")||b.get(this.id);if(d){b.setAttrib(d,"aria-"+f,!!e)}},focus:function(){b.get(this.id).focus()},setDisabled:function(d){if(d!=this.disabled){this.setAriaProperty("disabled",d);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;this.setAriaProperty("pressed",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(c,b,a){this.parent(c,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";this.setDisabled(true)},renderHTML:function(){return tinymce.DOM.createHTML("span",{"class":this.classPrefix,role:"separator","aria-orientation":"vertical",tabindex:"-1"})}});(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.setAriaProperty("checked",!!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;j.keyboard_focus=i.keyboard_focus;g=new e.ui.DropMenu(j.id||c.uniqueId(),j);g.onAddItem.add(h.onAddItem.dispatch,h.onAddItem);return g},focus:function(){var g=this;if(g.keyboardNav){g.keyboardNav.focus()}},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(x){var h,t,s;x=x.target;if(x&&(x=c.getParent(x,"tr"))){h=z.items[x.id];if(z.lastMenu){z.lastMenu.collapse(1)}if(h.isDisabled()){return}if(x&&c.hasClass(x,m+"ItemSub")){t=c.getRect(x);h.showMenu((t.x+t.w-i),t.y-i,t.x);z.lastMenu=h;c.addClass(c.get(h.id).firstChild,m+"ItemActive")}}})}a.add(o,"keydown",z._keyHandler,z);z.onShowMenu.dispatch(z);if(A.keyboard_focus){z._setupKeyboardNav()}},hideMenu:function(j){var g=this,i=c.get("menu_"+g.id),h;if(!g.isMenuVisible){return}if(g.keyboardNav){g.keyboardNav.destroy()}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);if(g.keyboardNav){g.keyboardNav.destroy()}a.remove(h,"mouseover",g.mouseOverFunc);a.remove(c.select("a",h),"focus",g.mouseOverFunc);a.remove(h,"click",g.mouseClickFunc);a.remove(h,"keydown",g._keyHandler);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",{role:"listbox",id:"menu_"+i.id,"class":j["class"],style:"position:absolute;left:0;top:0;z-index:200000;outline:0"});if(i.settings.parent){c.setAttrib(g,"aria-parent","menu_"+i.settings.parent.id)}k=c.add(g,"div",{role:"presentation",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",{role:"presentation",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},_setupKeyboardNav:function(){var i,h,g=this;i=c.select("#menu_"+g.id)[0];h=c.select("a[role=option]","menu_"+g.id);h.splice(0,0,i);g.keyboardNav=new e.ui.KeyboardNavigation({root:"menu_"+g.id,items:h,onCancel:function(){g.hideMenu()},enableUpDown:true});i.focus()},_keyHandler:function(g){var h=this,i;switch(g.keyCode){case 37:if(h.settings.parent){h.hideMenu();h.settings.parent.focus();a.cancel(g)}break;case 39:if(h.mouseOverFunc){h.mouseOverFunc(g)}break}},_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,q.titleItem?"th":"td");i=p=c.add(i,"a",{id:h.id+"_aria",role:q.titleItem?"presentation":"option",href:"javascript:;",onclick:"return false;",onmousedown:"return false;"});if(q.parent){c.setAttrib(p,"aria-haspopup","true");c.setAttrib(p,"aria-owns","menu_"+h.id)}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(e,d,c){this.parent(e,d,c);this.classPrefix="mceButton"},renderHTML:function(){var f=this.classPrefix,e=this.settings,d,c;c=a.encode(e.label||"");d='<a role="button" id="'+this.id+'" href="javascript:;" class="'+f+" "+f+"Enabled "+e["class"]+(c?" "+f+"Labeled":"")+'" onmousedown="return false;" onclick="return false;" aria-labelledby="'+this.id+'_voice" title="'+a.encode(e.title)+'">';if(e.image){d+='<img class="mceIcon" src="'+e.image+'" alt="'+a.encode(e.title)+'" />'+c}else{d+='<span class="mceIcon '+e["class"]+'"></span>'+(c?'<span class="'+f+'Label">'+c+"</span>":"")}d+='<span class="mceVoiceLabel mceIconOnly" style="display: none;" id="'+this.id+'_voice">'+e.title+"</span>";d+="</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(i,h,f){var g=this;g.parent(i,h,f);g.items=[];g.onChange=new a(g);g.onPostRender=new a(g);g.onAdd=new a(g);g.onRenderMenu=new d.util.Dispatcher(this);g.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");c.setAttrib(g.id,"aria-valuenow",i.title)}else{c.setHTML(h,c.encode(g.settings.title));c.addClass(h,"mceTitle");g.selectedValue=g.selectedIndex=null;c.setAttrib(g.id,"aria-valuenow",g.settings.title)}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='<span role="button" aria-haspopup="true" aria-labelledby="'+f.id+'_text" aria-describedby="'+f.id+'_voiceDesc"><table role="presentation" tabindex="0" id="'+f.id+'" cellpadding="0" cellspacing="0" class="'+j+" "+j+"Enabled"+(g["class"]?(" "+g["class"]):"")+'"><tbody><tr>';i+="<td>"+c.createHTML("span",{id:f.id+"_voiceDesc","class":"voiceLabel",style:"display:none;"},f.settings.title);i+=c.createHTML("a",{id:f.id+"_text",tabindex:-1,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 style="display:none;" class="mceIconOnly" aria-hidden="true">\u25BC</span></span>')+"</td>";i+="</tr></tbody></table></span>";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(f.menu&&f.menu.isMenuVisible){c.removeClass(f.id,f.classPrefix+"Selected");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);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(function(){g.hideMenu();g.focus()});f.add({title:g.settings.title,"class":"mceMenuItemTitle",onclick:function(){if(g.settings.onselect("")!==false){g.select("")}}});e(g.items,function(h){if(h.value===undefined){f.add({title:h.title,"class":"mceMenuItemTitle",onclick:function(){if(g.settings.onselect("")!==false){g.select("")}}})}else{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,"keydown",function(h){if(h.keyCode==32){f.showMenu(h);b.cancel(h)}});b.add(f.id,"focus",function(){if(!f._focused){f.keyDownHandler=b.add(f.id,"keydown",function(h){if(h.keyCode==40){f.showMenu();b.cancel(h)}});f.keyPressHandler=b.add(f.id,"keypress",function(i){var h;if(i.keyCode==13){h=f.selectedValue;f.selectedValue=null;b.cancel(i);f.settings.onselect(h)}})}f._focused=1});b.add(f.id,"blur",function(){b.remove(f.id,"keydown",f.keyDownHandler);b.remove(f.id,"keypress",f.keyPressHandler);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;this.setAriaProperty("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 this.items.length},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","aria-labelledby":f.id+"_aria"},g);g+=c.createHTML("span",{id:f.id+"_aria",style:"display: none"},f.settings.title);return g},postRender:function(){var g=this,h,i=true;g.rendered=true;function f(k){var j=g.items[k.target.selectedIndex-1];if(j&&(j=j.value)){g.onChange.dispatch(g,j);if(g.settings.onselect){g.settings.onselect(j)}}}b.add(g.id,"change",f);b.add(g.id,"keydown",function(k){var j;b.remove(g.id,"change",h);i=false;j=b.add(g.id,"blur",function(){if(i){return}i=true;b.add(g.id,"change",f);b.remove(g.id,"blur",j)});if(k.keyCode==13||k.keyCode==32){f(k);return b.cancel(k)}});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(g,f,e){this.parent(g,f,e);this.onRenderMenu=new c.util.Dispatcher(this);f.menu_container=f.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(function(){f.hideMenu();f.focus()});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(g,f,e){this.parent(g,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,role:"presentation","class":"mceAction "+g["class"]})}else{e=b.createHTML("span",{"class":"mceAction "+g["class"]},"")}e+=b.createHTML("span",{"class":"mceVoiceLabel mceIconOnly",id:f.id+"_voice",style:"display:none;"},g.title);i+="<td >"+b.createHTML("a",{role:"button",id:f.id+"_action",tabindex:"-1",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"]},'<span style="display:none;" class="mceIconOnly" aria-hidden="true">\u25BC</span>');i+="<td >"+b.createHTML("a",{role:"button",id:f.id+"_open",tabindex:"-1",href:"javascript:;","class":"mceOpen "+g["class"],onclick:"return false;",onmousedown:"return false;",title:g.title},e)+"</td>";i+="</tr></tbody>";i=b.createHTML("table",{id:f.id,role:"presentation",tabindex:"0","class":"mceSplitButton mceSplitButtonEnabled "+g["class"],cellpadding:"0",cellspacing:"0",title:g.title},i);return b.createHTML("span",{role:"button","aria-labelledby":f.id+"_voice","aria-haspopup":"true"},i)},postRender:function(){var e=this,g=e.settings,f;if(g.onclick){f=function(h){if(!e.isDisabled()){g.onclick(e.value);a.cancel(h)}};a.add(e.id+"_action","click",f);a.add(e.id,["click","keydown"],function(h){var k=32,m=14,i=13,j=38,l=40;if((h.keyCode===32||h.keyCode===13||h.keyCode===14)&&!h.altKey&&!h.ctrlKey&&!h.metaKey){f();a.cancel(h)}else{if(h.type==="click"||h.keyCode===l){e.showMenu();a.cancel(h)}}})}a.add(e.id+"_open","click",function(h){e.showMenu();a.cancel(h)});a.add([e.id,e.id+"_open"],"focus",function(){e._focused=1});a.add([e.id,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");a.clear(this.id)}})})(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(i,h,f){var g=this;g.parent(i,h,f);g.settings=h=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"},g.settings);g.onShowMenu=new d.util.Dispatcher(g);g.onHideMenu=new d.util.Dispatcher(g);g.value=h.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;f.editor.focus()},renderMenu:function(){var p=this,h,k=0,q=p.settings,g,j,l,o,f;o=c.add(q.menu_container,"div",{role:"listbox",id:p.id+"_menu","class":q.menu_class+" "+q["class"],style:"position:absolute;left:0;top:-1000px;"});h=c.add(o,"div",{"class":q["class"]+" mceSplitButtonMenu"});c.add(h,"span",{"class":"mceMenuLine"});g=c.add(h,"table",{role:"presentation","class":"mceColorSplitMenu"});j=c.add(g,"tbody");k=0;e(b(q.colors,"array")?q.colors:q.colors.split(","),function(i){i=i.replace(/^#/,"");if(!k--){l=c.add(j,"tr");k=q.grid_width-1}g=c.add(l,"td");g=c.add(g,"a",{role:"option",href:"javascript:;",style:{backgroundColor:"#"+i},title:p.editor.getLang("colors."+i,i),"data-mce-color":"#"+i});if(p.editor.forcedHighContrastMode){g=c.add(g,"canvas",{width:16,height:16,"aria-hidden":"true"});if(g.getContext&&(f=g.getContext("2d"))){f.fillStyle="#"+i;f.fillRect(0,0,16,16)}else{c.remove(g)}}});if(q.more_colors_func){g=c.add(j,"tr");g=c.add(g,"td",{colspan:q.grid_width,"class":"mceMoreColors"});g=c.add(g,"a",{role:"option",id:p.id+"_more",href:"javascript:;",onclick:"return false;","class":"mceMoreColors"},q.more_colors_title);a.add(g,"click",function(i){q.more_colors_func.call(q.more_colors_scope||this);return a.cancel(i)})}c.addClass(h,"mceColorSplitMenu");new d.ui.KeyboardNavigation({root:p.id+"_menu",items:c.select("a",p.id+"_menu"),onCancel:function(){p.hideMenu();p.focus()}});a.add(p.id+"_menu","mousedown",function(i){return a.cancel(i)});a.add(p.id+"_menu","click",function(i){var m;i=c.getParent(i.target,"a",j);if(i&&i.nodeName.toLowerCase()=="a"&&(m=i.getAttribute("data-mce-color"))){p.setColor(m)}return a.cancel(i)});return o},setColor:function(f){this.displayColor(f);this.hideMenu();this.settings.onselect(f)},displayColor:function(g){var f=this;c.setStyle(f.id+"_preview","backgroundColor",g);f.value=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);(function(b){var d=b.DOM,c=b.each,a=b.dom.Event;b.create("tinymce.ui.ToolbarGroup:tinymce.ui.Container",{renderHTML:function(){var f=this,i=[],e=f.controls,j=b.each,g=f.settings;i.push('<div id="'+f.id+'" role="group" aria-labelledby="'+f.id+'_voice">');i.push("<span role='application'>");i.push('<span id="'+f.id+'_voice" class="mceVoiceLabel" style="display:none;">'+d.encode(g.name)+"</span>");j(e,function(h){i.push(h.renderHTML())});i.push("</span>");i.push("</div>");return i.join("")},focus:function(){this.keyNav.focus()},postRender:function(){var f=this,e=[];c(f.controls,function(g){c(g.controls,function(h){if(h.id){e.push(h)}})});f.keyNav=new b.ui.KeyboardNavigation({root:f.id,items:e,onCancel:function(){f.editor.focus()},excludeFromTabOrder:!f.settings.tab_focus_toolbar})},destroy:function(){var e=this;e.parent();e.keyNav.destroy();a.clear(e.id)}})})(tinymce);(function(a){var c=a.DOM,b=a.each;a.create("tinymce.ui.Toolbar:tinymce.ui.Container",{renderHTML:function(){var m=this,f="",j,k,n=m.settings,e,d,g,l;l=m.controls;for(e=0;e<l.length;e++){k=l[e];d=l[e-1];g=l[e+1];if(e===0){j="mceToolbarStart";if(k.Button){j+=" mceToolbarStartButton"}else{if(k.SplitButton){j+=" mceToolbarStartSplitButton"}else{if(k.ListBox){j+=" mceToolbarStartListBox"}}}f+=c.createHTML("td",{"class":j},c.createHTML("span",null,"<!-- IE -->"))}if(d&&k.ListBox){if(d.Button||d.SplitButton){f+=c.createHTML("td",{"class":"mceToolbarEnd"},c.createHTML("span",null,"<!-- IE -->"))}}if(c.stdMode){f+='<td style="position: relative">'+k.renderHTML()+"</td>"}else{f+="<td>"+k.renderHTML()+"</td>"}if(g&&k.ListBox){if(g.Button||g.SplitButton){f+=c.createHTML("td",{"class":"mceToolbarStart"},c.createHTML("span",null,"<!-- IE -->"))}}}j="mceToolbarEnd";if(k.Button){j+=" mceToolbarEndButton"}else{if(k.SplitButton){j+=" mceToolbarEndSplitButton"}else{if(k.ListBox){j+=" mceToolbarEndListBox"}}}f+=c.createHTML("td",{"class":j},c.createHTML("span",null,"<!-- IE -->"));return c.createHTML("table",{id:m.id,"class":"mceToolbar"+(n["class"]?" "+n["class"]:""),cellpadding:"0",cellspacing:"0",align:m.settings.align||"",role:"presentation",tabindex:"-1"},"<tbody><tr>"+f+"</tr></tbody>")}})})(tinymce);(function(b){var a=b.util.Dispatcher,c=b.each;b.create("tinymce.AddOnManager",{AddOnManager:function(){var d=this;d.items=[];d.urls={};d.lookup={};d.onAdd=new a(d)},get:function(d){return this.lookup[d]},requireLangPack:function(e){var d=b.settings;if(d&&d.language&&d.language_load!==false){b.ScriptLoader.add(this.urls[e]+"/langs/"+d.language+".js")}},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("/"));if(!f.lookup[h]){b.ScriptLoader.add(e,d,g)}}});b.PluginManager=new b.AddOnManager();b.ThemeManager=new b.AddOnManager()}(tinymce));(function(j){var g=j.each,d=j.extend,k=j.DOM,i=j.dom.Event,f=j.ThemeManager,b=j.PluginManager,e=j.explode,h=j.util.Dispatcher,a,c=0;j.documentBaseURL=window.location.href.replace(/[\?#].*$/,"").replace(/[\/\\][^\/]+$/,"");if(!/[\/\\]$/.test(j.documentBaseURL)){j.documentBaseURL+="/"}j.baseURL=new j.util.URI(j.documentBaseURL).toAbsolute(j.baseURL);j.baseURI=new j.util.URI(j.baseURL);j.onBeforeUnload=new h(j);i.add(window,"beforeunload",function(l){j.onBeforeUnload.dispatch(j,l)});j.onAddEditor=new h(j);j.onRemoveEditor=new h(j);j.EditorManager=d(j,{editors:[],i18n:{},activeEditor:null,init:function(q){var n=this,p,l=j.ScriptLoader,u,o=[],m;function r(x,y,t){var v=x[y];if(!v){return}if(j.is(v,"string")){t=v.replace(/\.\w+$/,"");t=t?j.resolve(t):0;v=j.resolve(v)}return v.apply(t||this,Array.prototype.slice.call(arguments,2))}q=d({theme:"simple",language:"en"},q);n.settings=q;i.add(document,"init",function(){var s,v;r(q,"onpageload");switch(q.mode){case"exact":s=q.elements||"";if(s.length>0){g(e(s),function(x){if(k.get(x)){m=new j.Editor(x,q);o.push(m);m.render(1)}else{g(document.forms,function(y){g(y.elements,function(z){if(z.name===x){x="mce_editor_"+c++;k.setAttrib(z,"id",x);m=new j.Editor(x,q);o.push(m);m.render(1)}})})}})}break;case"textareas":case"specific_textareas":function t(y,x){return x.constructor===RegExp?x.test(y.className):k.hasClass(y,x)}g(k.select("textarea"),function(x){if(q.editor_deselector&&t(x,q.editor_deselector)){return}if(!q.editor_selector||t(x,q.editor_selector)){u=k.get(x.name);if(!x.id&&!u){x.id=x.name}if(!x.id||n.get(x.id)){x.id=k.uniqueId()}m=new j.Editor(x.id,q);o.push(m);m.render(1)}});break}if(q.oninit){s=v=0;g(o,function(x){v++;if(!x.initialized){x.onInit.add(function(){s++;if(s==v){r(q,"oninit")}})}else{s++}if(s==v){r(q,"oninit")}})}})},get:function(l){if(l===a){return this.editors}return this.editors[l]},getInstanceById:function(l){return this.get(l)},add:function(m){var l=this,n=l.editors;n[m.id]=m;n.push(m);l._setActive(m);l.onAddEditor.dispatch(l,m);return m},remove:function(n){var m=this,l,o=m.editors;if(!o[n.id]){return null}delete o[n.id];for(l=0;l<o.length;l++){if(o[l]==n){o.splice(l,1);break}}if(m.activeEditor==n){m._setActive(o[0])}n.destroy();m.onRemoveEditor.dispatch(m,n);return n},execCommand:function(r,p,o){var q=this,n=q.get(o),l;switch(r){case"mceFocus":n.focus();return true;case"mceAddEditor":case"mceAddControl":if(!q.get(o)){new j.Editor(o,q.settings).render()}return true;case"mceAddFrameControl":l=o.window;l.tinyMCE=tinyMCE;l.tinymce=j;j.DOM.doc=l.document;j.DOM.win=l;n=new j.Editor(o.element_id,o);n.render();if(j.isIE){function m(){n.destroy();l.detachEvent("onunload",m);l=l.tinyMCE=l.tinymce=null}l.attachEvent("onunload",m)}o.page_window=null;return true;case"mceRemoveEditor":case"mceRemoveControl":if(n){n.remove()}return true;case"mceToggleEditor":if(!n){q.execCommand("mceAddControl",0,o);return true}if(n.isHidden()){n.show()}else{n.hide()}return true}if(q.activeEditor){return q.activeEditor.execCommand(r,p,o)}return false},execInstanceCommand:function(p,o,n,m){var l=this.get(p);if(l){return l.execCommand(o,n,m)}return false},triggerSave:function(){g(this.editors,function(l){l.save()})},addI18n:function(n,q){var l,m=this.i18n;if(!j.is(n,"string")){g(n,function(r,p){g(r,function(t,s){g(t,function(v,u){if(s==="common"){m[p+"."+u]=v}else{m[p+"."+s+"."+u]=v}})})})}else{g(q,function(r,p){m[n+"."+p]=r})}},_setActive:function(l){this.selectedInstance=this.activeEditor=l}})})(tinymce);(function(m){var n=m.DOM,j=m.dom.Event,f=m.extend,k=m.util.Dispatcher,i=m.each,a=m.isGecko,b=m.isIE,e=m.isWebKit,d=m.is,h=m.ThemeManager,c=m.PluginManager,o=m.inArray,l=m.grep,g=m.explode;m.create("tinymce.Editor",{Editor:function(r,q){var p=this;p.id=p.editorId=r;p.execCommands={};p.queryStateCommands={};p.queryValueCommands={};p.isNotDirty=false;p.plugins={};i(["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){p[s]=new k(p)});p.settings=q=f({id:r,language:"en",docs_language:"en",theme:"simple",skin:"default",delta_width:0,delta_height:0,popup_css:"",plugins:"",document_base_url:m.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:m.isIE6?'<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">':"<!DOCTYPE>",visual_table_class:"mceItemTable",visual:1,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",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,inline_styles:1,convert_fonts_to_spans:true,indent:"simple",indent_before:"p,h1,h2,h3,h4,h5,h6,blockquote,div,title,style,pre,script,td,ul,li,area,table,thead,tfoot,tbody,tr",indent_after:"p,h1,h2,h3,h4,h5,h6,blockquote,div,title,style,pre,script,td,ul,li,area,table,thead,tfoot,tbody,tr",validate:true,entity_encoding:"named",url_converter:p.convertURL,url_converter_scope:p,ie7_compat:true},q);p.documentBaseURI=new m.util.URI(q.document_base_url||m.documentBaseURL,{base_uri:tinyMCE.baseURI});p.baseURI=m.baseURI;p.contentCSS=[];p.execCallback("setup",p)},render:function(r){var u=this,v=u.settings,x=u.id,p=m.ScriptLoader;if(!j.domLoaded){j.add(document,"init",function(){u.render()});return}tinyMCE.settings=v;if(!u.getElement()){return}if(m.isIDevice){return}if(!/TEXTAREA|INPUT/i.test(u.getElement().nodeName)&&v.hidden_input&&n.getParent(x,"form")){n.insertAfter(n.create("input",{type:"hidden",name:x}),x)}if(m.WindowManager){u.windowManager=new m.WindowManager(u)}if(v.encoding=="xml"){u.onGetContent.add(function(s,t){if(t.save){t.content=n.encode(t.content)}})}if(v.add_form_submit_trigger){u.onSubmit.addToTop(function(){if(u.initialized){u.save();u.isNotDirty=1}})}if(v.add_unload_trigger){u._beforeUnload=tinyMCE.onBeforeUnload.add(function(){if(u.initialized&&!u.destroyed&&!u.isHidden()){u.save({format:"raw",no_events:true})}})}m.addUnload(u.destroy,u);if(v.submit_patch){u.onBeforeRenderUI.add(function(){var s=u.getElement().form;if(!s){return}if(s._mceOldSubmit){return}if(!s.submit.nodeType&&!s.submit.length){u.formElement=s;s._mceOldSubmit=s.submit;s.submit=function(){m.triggerSave();u.isNotDirty=1;return u.formElement._mceOldSubmit(u.formElement)}}s=null})}function q(){if(v.language&&v.language_load!==false){p.add(m.baseURL+"/langs/"+v.language+".js")}if(v.theme&&v.theme.charAt(0)!="-"&&!h.urls[v.theme]){h.load(v.theme,"themes/"+v.theme+"/editor_template"+m.suffix+".js")}i(g(v.plugins),function(s){if(s&&s.charAt(0)!="-"&&!c.urls[s]){if(s=="safari"){return}c.load(s,"plugins/"+s+"/editor_plugin"+m.suffix+".js")}});p.loadQueue(function(){if(!u.removed){u.init()}})}q()},init:function(){var r,F=this,G=F.settings,C,z,B=F.getElement(),q,p,D,x,A,E,y;m.add(F);G.aria_label=G.aria_label||n.getAttrib(B,"aria-label",F.getLang("aria.rich_text_area"));if(G.theme){G.theme=G.theme.replace(/-/,"");q=h.get(G.theme);F.theme=new q();if(F.theme.init&&G.init_theme){F.theme.init(F,h.urls[G.theme]||m.documentBaseURL.replace(/\/$/,""))}}i(g(G.plugins.replace(/\-/g,"")),function(H){var I=c.get(H),t=c.urls[H]||m.documentBaseURL.replace(/\/$/,""),s;if(I){s=new I(F,t);F.plugins[H]=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 m.ControlManager(F);if(G.custom_undo_redo){F.onBeforeExecCommand.add(function(t,H,u,I,s){if(H!="Undo"&&H!="Redo"&&H!="mceRepaint"&&(!s||!s.skip_undo)){F.undoManager.beforeChange()}});F.onExecCommand.add(function(t,H,u,I,s){if(H!="Undo"&&H!="Redo"&&H!="mceRepaint"&&(!s||!s.skip_undo)){F.undoManager.add()}})}F.onExecCommand.add(function(s,t){if(!/^(FontName|FontSize)$/.test(t)){F.nodeChanged()}});if(a){function v(s,t){if(!t||!t.initial){F.execCommand("mceRepaint")}}F.onUndo.add(v);F.onRedo.add(v);F.onSetContent.add(v)}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)+(q.deltaWidth||0),100)}if(E.test(""+z)){z=Math.max(parseInt(z)+(q.deltaHeight||0),100)}q=F.theme.renderUI({targetNode:B,width:C,height:z,deltaWidth:G.delta_width,deltaHeight:G.delta_height});F.editorContainer=q.editorContainer}if(document.domain&&location.hostname!=document.domain){m.relaxedDomain=document.domain}n.setStyles(q.sizeContainer||q.editorContainer,{width:C,height:z});if(G.content_css){m.each(g(G.content_css),function(s){F.contentCSS.push(F.documentBaseURI.toAbsolute(s))})}z=(q.iframeHeight||z)+(typeof(z)=="number"?(q.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!=m.documentBaseURL){F.iframeHTML+='<base href="'+F.documentBaseURI.getURI()+'" />'}if(G.ie7_compat){F.iframeHTML+='<meta http-equiv="X-UA-Compatible" content="IE=7" />'}else{F.iframeHTML+='<meta http-equiv="X-UA-Compatible" content="IE=edge" />'}F.iframeHTML+='<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />';if(!a||!/Firefox\/2/.test(navigator.userAgent)){for(y=0;y<F.contentCSS.length;y++){F.iframeHTML+='<link type="text/css" rel="stylesheet" href="'+F.contentCSS[y]+'" />'}F.contentCSS=[]}x=G.body_id||"tinymce";if(x.indexOf("=")!=-1){x=F.getParam("body_id","","hash");x=x[F.id]||x}A=G.body_class||"";if(A.indexOf("=")!=-1){A=F.getParam("body_class","","hash");A=A[F.id]||""}F.iframeHTML+='</head><body id="'+x+'" class="mceContentBody '+A+'"></body></html>';if(m.relaxedDomain&&(b||(m.isOpera&&parseFloat(opera.version())<11))){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();})()'}r=n.add(q.iframeContainer,"iframe",{id:F.id+"_ifr",src:D||'javascript:""',frameBorder:"0",title:G.aria_label,style:{width:"100%",height:z}});F.contentAreaContainer=q.iframeContainer;n.get(q.editorContainer).style.display=F.orgDisplay;n.get(F.id).style.display="none";n.setAttrib(F.id,"aria-hidden",true);if(!m.relaxedDomain||!D){F.setupIframe()}B=r=q=null},setupIframe:function(){var r=this,x=r.settings,y=n.get(r.id),z=r.getDoc(),v,p;if(!b||!m.relaxedDomain){z.open();z.write(r.iframeHTML);z.close();if(m.relaxedDomain){z.domain=m.relaxedDomain}}if(!b){try{if(!x.readonly){z.designMode="On"}}catch(q){}}if(b){p=r.getBody();n.hide(p);if(!x.readonly){p.contentEditable=true}n.show(p)}r.schema=new m.html.Schema(x);r.dom=new m.dom.DOMUtils(r.getDoc(),{keep_values:true,url_converter:r.convertURL,url_converter_scope:r,hex_colors:x.force_hex_style_colors,class_filter:x.class_filter,update_styles:1,fix_ie_paragraphs:1,schema:r.schema});r.parser=new m.html.DomParser(x,r.schema);r.parser.addAttributeFilter("name",function(s,t){var B=s.length,D,A,C,E;while(B--){E=s[B];if(E.name==="a"&&E.firstChild){C=E.parent;D=E.lastChild;do{A=D.prev;C.insert(D,E);D=A}while(D)}}});r.parser.addAttributeFilter("src,href,style",function(s,t){var A=s.length,B,D=r.dom,C;while(A--){B=s[A];C=B.attr(t);if(t==="style"){B.attr("data-mce-style",D.serializeStyle(D.parseStyle(C),B.name))}else{B.attr("data-mce-"+t,r.convertURL(C,t,B.name))}}});r.parser.addNodeFilter("script",function(s,t){var A=s.length;while(A--){s[A].attr("type","mce-text/javascript")}});r.parser.addNodeFilter("#cdata",function(s,t){var A=s.length,B;while(A--){B=s[A];B.type=8;B.name="#comment";B.value="[CDATA["+B.value+"]]"}});r.parser.addNodeFilter("p,h1,h2,h3,h4,h5,h6,div",function(t,A){var B=t.length,C,s=r.schema.getNonEmptyElements();while(B--){C=t[B];if(C.isEmpty(s)){C.empty().append(new m.html.Node("br",1)).shortEnded=true}}});r.serializer=new m.dom.Serializer(x,r.dom,r.schema);r.selection=new m.dom.Selection(r.dom,r.getWin(),r.serializer);r.formatter=new m.Formatter(this);r.formatter.register({alignleft:[{selector:"p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li",styles:{textAlign:"left"}},{selector:"img,table",collapsed:false,styles:{"float":"left"}}],aligncenter:[{selector:"p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li",styles:{textAlign:"center"}},{selector:"img",collapsed:false,styles:{display:"block",marginLeft:"auto",marginRight:"auto"}},{selector:"table",collapsed:false,styles:{marginLeft:"auto",marginRight:"auto"}}],alignright:[{selector:"p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li",styles:{textAlign:"right"}},{selector:"img,table",collapsed:false,styles:{"float":"right"}}],alignfull:[{selector:"p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li",styles:{textAlign:"justify"}}],bold:[{inline:"strong",remove:"all"},{inline:"span",styles:{fontWeight:"bold"}},{inline:"b",remove:"all"}],italic:[{inline:"em",remove:"all"},{inline:"span",styles:{fontStyle:"italic"}},{inline:"i",remove:"all"}],underline:[{inline:"span",styles:{textDecoration:"underline"},exact:true},{inline:"u",remove:"all"}],strikethrough:[{inline:"span",styles:{textDecoration:"line-through"},exact:true},{inline:"strike",remove:"all"}],forecolor:{inline:"span",styles:{color:"%value"},wrap_links:false},hilitecolor:{inline:"span",styles:{backgroundColor:"%value"},wrap_links:false},fontname:{inline:"span",styles:{fontFamily:"%value"}},fontsize:{inline:"span",styles:{fontSize:"%value"}},fontsize_class:{inline:"span",attributes:{"class":"%value"}},blockquote:{block:"blockquote",wrapper:1,remove:"all"},subscript:{inline:"sub"},superscript:{inline:"sup"},removeformat:[{selector:"b,strong,em,i,font,u,strike",remove:"all",split:true,expand:false,block_expand:true,deep:true},{selector:"span",attributes:["style","class"],remove:"empty",split:true,expand:false,deep:true},{selector:"*",attributes:["style","class"],split:false,expand:false,deep:true}]});i("p h1 h2 h3 h4 h5 h6 div address pre div code dt dd samp".split(/\s/),function(s){r.formatter.register(s,{block:s,remove:"all"})});r.formatter.register(r.settings.formats);r.undoManager=new m.UndoManager(r);r.undoManager.onAdd.add(function(t,s){if(t.hasUndo()){return r.onChange.dispatch(r,s,t)}});r.undoManager.onUndo.add(function(t,s){return r.onUndo.dispatch(r,s,t)});r.undoManager.onRedo.add(function(t,s){return r.onRedo.dispatch(r,s,t)});r.forceBlocks=new m.ForceBlocks(r,{forced_root_block:x.forced_root_block});r.editorCommands=new m.EditorCommands(r);r.serializer.onPreProcess.add(function(s,t){return r.onPreProcess.dispatch(r,t,s)});r.serializer.onPostProcess.add(function(s,t){return r.onPostProcess.dispatch(r,t,s)});r.onPreInit.dispatch(r);if(!x.gecko_spellcheck){r.getBody().spellcheck=0}if(!x.readonly){r._addEvents()}r.controlManager.onPostRender.dispatch(r,r.controlManager);r.onPostRender.dispatch(r);if(x.directionality){r.getBody().dir=x.directionality}if(x.nowrap){r.getBody().style.whiteSpace="nowrap"}if(x.handle_node_change_callback){r.onNodeChange.add(function(t,s,A){r.execCallback("handle_node_change_callback",r.id,A,-1,-1,true,r.selection.isCollapsed())})}if(x.save_callback){r.onSaveContent.add(function(s,A){var t=r.execCallback("save_callback",r.id,A.content,r.getBody());if(t){A.content=t}})}if(x.onchange_callback){r.onChange.add(function(t,s){r.execCallback("onchange_callback",r,s)})}if(x.protect){r.onBeforeSetContent.add(function(s,t){if(x.protect){i(x.protect,function(A){t.content=t.content.replace(A,function(B){return"<!--mce:protected "+escape(B)+"-->"})})}})}if(x.convert_newlines_to_brs){r.onBeforeSetContent.add(function(s,t){if(t.initial){t.content=t.content.replace(/\r?\n/g,"<br />")}})}if(x.preformatted){r.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(x.verify_css_classes){r.serializer.attribValueFilter=function(C,A){var B,t;if(C=="class"){if(!r.classesRE){t=r.dom.getClasses();if(t.length>0){B="";i(t,function(s){B+=(B?"|":"")+s["class"]});r.classesRE=new RegExp("("+B+")","gi")}}return !r.classesRE||/(\bmceItem\w+\b|\bmceTemp\w+\b)/g.test(A)||r.classesRE.test(A)?A:""}return A}}if(x.cleanup_callback){r.onBeforeSetContent.add(function(s,t){t.content=r.execCallback("cleanup_callback","insert_to_editor",t.content,t)});r.onPreProcess.add(function(s,t){if(t.set){r.execCallback("cleanup_callback","insert_to_editor_dom",t.node,t)}if(t.get){r.execCallback("cleanup_callback","get_from_editor_dom",t.node,t)}});r.onPostProcess.add(function(s,t){if(t.set){t.content=r.execCallback("cleanup_callback","insert_to_editor",t.content,t)}if(t.get){t.content=r.execCallback("cleanup_callback","get_from_editor",t.content,t)}})}if(x.save_callback){r.onGetContent.add(function(s,t){if(t.save){t.content=r.execCallback("save_callback",r.id,t.content,r.getBody())}})}if(x.handle_event_callback){r.onEvent.add(function(s,t,A){if(r.execCallback("handle_event_callback",t,s,A)===false){j.cancel(t)}})}r.onSetContent.add(function(){r.addVisual(r.getBody())});if(x.padd_empty_editor){r.onPostProcess.add(function(s,t){t.content=t.content.replace(/^(<p[^>]*>(&nbsp;|&#160;|\s|\u00a0|)<\/p>[\r\n]*|<br \/>[\r\n]*)$/,"")})}if(a){function u(s,t){i(s.dom.select("a"),function(B){var A=B.parentNode;if(s.dom.isBlock(A)&&A.lastChild===B){s.dom.add(A,"br",{"data-mce-bogus":1})}})}r.onExecCommand.add(function(s,t){if(t==="CreateLink"){u(s)}});r.onSetContent.add(r.selection.onSetContent.add(u));if(!x.readonly){try{z.designMode="Off";z.designMode="On"}catch(q){}}}setTimeout(function(){if(r.removed){return}r.load({initial:true,format:"html"});r.startContent=r.getContent({format:"raw"});r.undoManager.add();r.initialized=true;r.onInit.dispatch(r);r.execCallback("setupcontent_callback",r.id,r.getBody(),r.getDoc());r.execCallback("init_instance_callback",r);r.focus(true);r.nodeChanged({initial:1});i(r.contentCSS,function(s){r.dom.loadCSS(s)});if(x.auto_focus){setTimeout(function(){var s=m.get(x.auto_focus);s.selection.select(s.getBody(),1);s.selection.collapse(1);s.getWin().focus()},100)}},1);y=null},focus:function(s){var x,q=this,v=q.settings.content_editable,r,p,u=q.getDoc();if(!s){r=q.selection.getRng();if(r.item){p=r.item(0)}if(!v){q.getWin().focus()}if(p&&p.ownerDocument==u){r=u.body.createControlRange();r.addElement(p);r.select()}}if(m.activeEditor!=q){if((x=m.activeEditor)!=null){x.onDeactivate.dispatch(x,q)}q.onActivate.dispatch(q,x)}m._setActive(q)},execCallback:function(u){var p=this,r=p.settings[u],q;if(!r){return}if(p.callbackLookup&&(q=p.callbackLookup[u])){r=q.func;q=q.scope}if(d(r,"string")){q=r.replace(/\.\w+$/,"");q=q?m.resolve(q):0;r=m.resolve(r);p.callbackLookup=p.callbackLookup||{};p.callbackLookup[u]={func:r,scope:q}}return r.apply(q||p,Array.prototype.slice.call(arguments,1))},translate:function(p){var r=this.settings.language||"en",q=m.i18n;if(!p){return""}return q[r+"."+p]||p.replace(/{\#([^}]+)\}/g,function(t,s){return q[r+"."+s]||"{#"+s+"}"})},getLang:function(q,p){return m.i18n[(this.settings.language||"en")+"."+q]||(d(p)?p:"{#"+q+"}")},getParam:function(u,r,p){var s=m.trim,q=d(this.settings[u])?this.settings[u]:r,t;if(p==="hash"){t={};if(d(q,"string")){i(q.indexOf("=")>0?q.split(/[;,](?![^=;,]*(?:[;,]|$))/):q.split(","),function(x){x=x.split("=");if(x.length>1){t[s(x[0])]=s(x[1])}else{t[s(x[0])]=s(x)}})}else{t=q}return t}return q},nodeChanged:function(r){var p=this,q=p.selection,u=q.getStart()||p.getBody();if(p.initialized){r=r||{};u=b&&u.ownerDocument!=p.getDoc()?p.getBody():u;r.parents=[];p.dom.getParent(u,function(s){if(s.nodeName=="BODY"){return true}r.parents.push(s)});p.onNodeChange.dispatch(p,r?r.controlManager||p.controlManager:p.controlManager,u,q.isCollapsed(),r)}},addButton:function(r,q){var p=this;p.buttons=p.buttons||{};p.buttons[r]=q},addCommand:function(p,r,q){this.execCommands[p]={func:r,scope:q||this}},addQueryStateHandler:function(p,r,q){this.queryStateCommands[p]={func:r,scope:q||this}},addQueryValueHandler:function(p,r,q){this.queryValueCommands[p]={func:r,scope:q||this}},addShortcut:function(r,u,p,s){var q=this,v;if(!q.settings.custom_shortcuts){return false}q.shortcuts=q.shortcuts||{};if(d(p,"string")){v=p;p=function(){q.execCommand(v,false,null)}}if(d(p,"object")){v=p;p=function(){q.execCommand(v[0],v[1],v[2])}}i(g(r),function(t){var x={func:p,scope:s||this,desc:u,alt:false,ctrl:false,shift:false};i(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)}});q.shortcuts[(x.ctrl?"ctrl":"")+","+(x.alt?"alt":"")+","+(x.shift?"shift":"")+","+x.keyCode]=x});return true},execCommand:function(x,v,z,p){var r=this,u=0,y,q;if(!/^(mceAddUndoLevel|mceEndUndoLevel|mceBeginUndoLevel|mceRepaint|SelectAll)$/.test(x)&&(!p||!p.skip_focus)){r.focus()}y={};r.onBeforeExecCommand.dispatch(r,x,v,z,y);if(y.terminate){return false}if(r.execCallback("execcommand_callback",r.id,r.selection.getNode(),x,v,z)){r.onExecCommand.dispatch(r,x,v,z,p);return true}if(y=r.execCommands[x]){q=y.func.call(y.scope,v,z);if(q!==true){r.onExecCommand.dispatch(r,x,v,z,p);return q}}i(r.plugins,function(s){if(s.execCommand&&s.execCommand(x,v,z)){r.onExecCommand.dispatch(r,x,v,z,p);u=1;return false}});if(u){return true}if(r.theme&&r.theme.execCommand&&r.theme.execCommand(x,v,z)){r.onExecCommand.dispatch(r,x,v,z,p);return true}if(r.editorCommands.execCommand(x,v,z)){r.onExecCommand.dispatch(r,x,v,z,p);return true}r.getDoc().execCommand(x,v,z);r.onExecCommand.dispatch(r,x,v,z,p)},queryCommandState:function(u){var q=this,v,r;if(q._isHidden()){return}if(v=q.queryStateCommands[u]){r=v.func.call(v.scope);if(r!==true){return r}}v=q.editorCommands.queryCommandState(u);if(v!==-1){return v}try{return this.getDoc().queryCommandState(u)}catch(p){}},queryCommandValue:function(v){var q=this,u,r;if(q._isHidden()){return}if(u=q.queryValueCommands[v]){r=u.func.call(u.scope);if(r!==true){return r}}u=q.editorCommands.queryCommandValue(v);if(d(u)){return u}try{return this.getDoc().queryCommandValue(v)}catch(p){}},show:function(){var p=this;n.show(p.getContainer());n.hide(p.id);p.load()},hide:function(){var p=this,q=p.getDoc();if(b&&q){q.execCommand("SelectAll")}p.save();n.hide(p.getContainer());n.setStyle(p.id,"display",p.orgDisplay)},isHidden:function(){return !n.isHidden(this.id)},setProgressState:function(p,q,r){this.onSetProgressState.dispatch(this,p,q,r);return p},load:function(s){var p=this,r=p.getElement(),q;if(r){s=s||{};s.load=true;q=p.setContent(d(r.value)?r.value:r.innerHTML,s);s.element=r;if(!s.no_events){p.onLoadContent.dispatch(p,s)}s.element=r=null;return q}},save:function(u){var p=this,s=p.getElement(),q,r;if(!s||!p.initialized){return}u=u||{};u.save=true;if(!u.no_events){p.undoManager.typing=false;p.undoManager.add()}u.element=s;q=u.content=p.getContent(u);if(!u.no_events){p.onSaveContent.dispatch(p,u)}q=u.content;if(!/TEXTAREA|INPUT/i.test(s.nodeName)){s.innerHTML=q;if(r=n.getParent(p.id,"form")){i(r.elements,function(t){if(t.name==p.id){t.value=q;return false}})}}else{s.value=q}u.element=s=null;return q},setContent:function(t,s){var r=this,q,p=r.getBody();s=s||{};s.format=s.format||"html";s.set=true;s.content=t;if(!s.no_events){r.onBeforeSetContent.dispatch(r,s)}t=s.content;if(!m.isIE&&(t.length===0||/^\s+$/.test(t))){p.innerHTML='<br data-mce-bogus="1" />';return}if(s.format!=="raw"){t=new m.html.Serializer({},r.schema).serialize(r.parser.parse(t))}s.content=m.trim(t);r.dom.setHTML(p,s.content);if(!s.no_events){r.onSetContent.dispatch(r,s)}return s.content},getContent:function(q){var p=this,r;q=q||{};q.format=q.format||"html";q.get=true;if(!q.no_events){p.onBeforeGetContent.dispatch(p,q)}if(q.format=="raw"){r=p.getBody().innerHTML}else{r=p.serializer.serialize(p.getBody(),q)}q.content=m.trim(r);if(!q.no_events){p.onGetContent.dispatch(p,q)}return q.content},isDirty:function(){var p=this;return m.trim(p.startContent)!=m.trim(p.getContent({format:"raw",no_events:1}))&&!p.isNotDirty},getContainer:function(){var p=this;if(!p.container){p.container=n.get(p.editorContainer||p.id+"_parent")}return p.container},getContentAreaContainer:function(){return this.contentAreaContainer},getElement:function(){return n.get(this.settings.content_element||this.id)},getWin:function(){var p=this,q;if(!p.contentWindow){q=n.get(p.id+"_ifr");if(q){p.contentWindow=q.contentWindow}}return p.contentWindow},getDoc:function(){var q=this,p;if(!q.contentDocument){p=q.getWin();if(p){q.contentDocument=p.document}}return q.contentDocument},getBody:function(){return this.bodyElement||this.getDoc().body},convertURL:function(p,x,v){var q=this,r=q.settings;if(r.urlconverter_callback){return q.execCallback("urlconverter_callback",p,v,true,x)}if(!r.convert_urls||(v&&v.nodeName=="LINK")||p.indexOf("file:")===0){return p}if(r.relative_urls){return q.documentBaseURI.toRelative(p)}p=q.documentBaseURI.toAbsolute(p,r.remove_script_host);return p},addVisual:function(r){var p=this,q=p.settings;r=r||p.getBody();if(!d(p.hasVisual)){p.hasVisual=q.visual}i(p.dom.select("table,a",r),function(t){var s;switch(t.nodeName){case"TABLE":s=p.dom.getAttrib(t,"border");if(!s||s=="0"){if(p.hasVisual){p.dom.addClass(t,q.visual_table_class)}else{p.dom.removeClass(t,q.visual_table_class)}}return;case"A":s=p.dom.getAttrib(t,"name");if(s){if(p.hasVisual){p.dom.addClass(t,"mceItemAnchor")}else{p.dom.removeClass(t,"mceItemAnchor")}}return}});p.onVisualAid.dispatch(p,r,p.hasVisual)},remove:function(){var p=this,q=p.getContainer();p.removed=1;p.hide();p.execCallback("remove_instance_callback",p);p.onRemove.dispatch(p);p.onExecCommand.listeners=[];m.remove(p);n.remove(q)},destroy:function(q){var p=this;if(p.destroyed){return}if(!q){m.removeUnload(p.destroy);tinyMCE.onBeforeUnload.remove(p._beforeUnload);if(p.theme&&p.theme.destroy){p.theme.destroy()}p.controlManager.destroy();p.selection.destroy();p.dom.destroy();if(!p.settings.content_editable){j.clear(p.getWin());j.clear(p.getDoc())}j.clear(p.getBody());j.clear(p.formElement)}if(p.formElement){p.formElement.submit=p.formElement._mceOldSubmit;p.formElement._mceOldSubmit=null}p.contentAreaContainer=p.formElement=p.container=p.settings.content_element=p.bodyElement=p.contentDocument=p.contentWindow=null;if(p.selection){p.selection=p.selection.win=p.selection.dom=p.selection.dom.doc=null}p.destroyed=1},_addEvents:function(){var B=this,r,C=B.settings,q=B.dom,x={mouseup:"onMouseUp",mousedown:"onMouseDown",click:"onClick",keyup:"onKeyUp",keydown:"onKeyDown",keypress:"onKeyPress",submit:"onSubmit",reset:"onReset",contextmenu:"onContextMenu",dblclick:"onDblClick",paste:"onPaste"};function p(t,D){var s=t.type;if(B.removed){return}if(B.onEvent.dispatch(B,t,D)!==false){B[x[t.fakeType||t.type]].dispatch(B,t,D)}}i(x,function(t,s){switch(s){case"contextmenu":q.bind(B.getDoc(),s,p);break;case"paste":q.bind(B.getBody(),s,function(D){p(D)});break;case"submit":case"reset":q.bind(B.getElement().form||n.getParent(B.id,"form"),s,p);break;default:q.bind(C.content_editable?B.getBody():B.getDoc(),s,p)}});q.bind(C.content_editable?B.getBody():(a?B.getDoc():B.getWin()),"focus",function(s){B.focus(true)});if(m.isGecko){q.bind(B.getDoc(),"DOMNodeInserted",function(t){var s;t=t.target;if(t.nodeType===1&&t.nodeName==="IMG"&&(s=t.getAttribute("data-mce-src"))){t.src=B.documentBaseURI.toAbsolute(s)}})}if(a){function u(){var E=this,G=E.getDoc(),F=E.settings;if(a&&!F.readonly){if(E._isHidden()){try{if(!F.content_editable){G.designMode="On"}}catch(D){}}try{G.execCommand("styleWithCSS",0,false)}catch(D){if(!E._isHidden()){try{G.execCommand("useCSS",0,true)}catch(D){}}}if(!F.table_inline_editing){try{G.execCommand("enableInlineTableEditing",false,false)}catch(D){}}if(!F.object_resizing){try{G.execCommand("enableObjectResizing",false,false)}catch(D){}}}}B.onBeforeExecCommand.add(u);B.onMouseDown.add(u)}if(m.isWebKit){B.onClick.add(function(s,t){t=t.target;if(t.nodeName=="IMG"||(t.nodeName=="A"&&q.hasClass(t,"mceItemAnchor"))){B.selection.getSel().setBaseAndExtent(t,0,t,1);B.nodeChanged()}})}B.onMouseUp.add(B.nodeChanged);B.onKeyUp.add(function(s,t){var D=t.keyCode;if((D>=33&&D<=36)||(D>=37&&D<=40)||D==13||D==45||D==46||D==8||(m.isMac&&(D==91||D==93))||t.ctrlKey){B.nodeChanged()}});B.onReset.add(function(){B.setContent(B.startContent,{format:"raw"})});if(C.custom_shortcuts){if(C.custom_undo_redo_keyboard_shortcuts){B.addShortcut("ctrl+z",B.getLang("undo_desc"),"Undo");B.addShortcut("ctrl+y",B.getLang("redo_desc"),"Redo")}B.addShortcut("ctrl+b",B.getLang("bold_desc"),"Bold");B.addShortcut("ctrl+i",B.getLang("italic_desc"),"Italic");B.addShortcut("ctrl+u",B.getLang("underline_desc"),"Underline");for(r=1;r<=6;r++){B.addShortcut("ctrl+"+r,"",["FormatBlock",false,"h"+r])}B.addShortcut("ctrl+7","",["FormatBlock",false,"<p>"]);B.addShortcut("ctrl+8","",["FormatBlock",false,"<div>"]);B.addShortcut("ctrl+9","",["FormatBlock",false,"<address>"]);function v(t){var s=null;if(!t.altKey&&!t.ctrlKey&&!t.metaKey){return s}i(B.shortcuts,function(D){if(m.isMac&&D.ctrl!=t.metaKey){return}else{if(!m.isMac&&D.ctrl!=t.ctrlKey){return}}if(D.alt!=t.altKey){return}if(D.shift!=t.shiftKey){return}if(t.keyCode==D.keyCode||(t.charCode&&t.charCode==D.charCode)){s=D;return false}});return s}B.onKeyUp.add(function(s,t){var D=v(t);if(D){return j.cancel(t)}});B.onKeyPress.add(function(s,t){var D=v(t);if(D){return j.cancel(t)}});B.onKeyDown.add(function(s,t){var D=v(t);if(D){D.func.call(D.scope);return j.cancel(t)}})}if(m.isIE){q.bind(B.getDoc(),"controlselect",function(D){var t=B.resizeInfo,s;D=D.target;if(D.nodeName!=="IMG"){return}if(t){q.unbind(t.node,t.ev,t.cb)}if(!q.hasClass(D,"mceItemNoResize")){ev="resizeend";s=q.bind(D,ev,function(F){var E;F=F.target;if(E=q.getStyle(F,"width")){q.setAttrib(F,"width",E.replace(/[^0-9%]+/g,""));q.setStyle(F,"width","")}if(E=q.getStyle(F,"height")){q.setAttrib(F,"height",E.replace(/[^0-9%]+/g,""));q.setStyle(F,"height","")}})}else{ev="resizestart";s=q.bind(D,"resizestart",j.cancel,j)}t=B.resizeInfo={node:D,ev:ev,cb:s}});B.onKeyDown.add(function(s,D){var t;switch(D.keyCode){case 8:t=B.getDoc().selection;if(t.createRange&&t.createRange().item){s.dom.remove(t.createRange().item(0));return j.cancel(D)}}})}if(m.isOpera){B.onClick.add(function(s,t){j.prevent(t)})}if(C.custom_undo_redo){function y(){B.undoManager.typing=false;B.undoManager.add()}q.bind(B.getDoc(),"focusout",function(s){if(!B.removed&&B.undoManager.typing){y()}});B.dom.bind(B.dom.getRoot(),"dragend",function(s){y()});B.onKeyUp.add(function(t,F){var s,E,D;if(b&&F.keyCode==8){s=B.selection.getRng();if(s.parentElement){E=s.parentElement();D=B.selection.getBookmark();E.innerHTML=E.innerHTML;B.selection.moveToBookmark(D)}}if((F.keyCode>=33&&F.keyCode<=36)||(F.keyCode>=37&&F.keyCode<=40)||F.keyCode==13||F.keyCode==45||F.ctrlKey){y()}});B.onKeyDown.add(function(t,H){var s,F,E,G=H.keyCode;if(b&&G==46){s=B.selection.getRng();if(s.parentElement){F=s.parentElement();if(!B.undoManager.typing){B.undoManager.beforeChange();B.undoManager.typing=true;B.undoManager.add()}if(H.ctrlKey){s.moveEnd("word",1);s.select()}B.selection.getSel().clear();if(s.parentElement()==F){E=B.selection.getBookmark();try{F.innerHTML=F.innerHTML}catch(D){}B.selection.moveToBookmark(E)}H.preventDefault();return}}if((G>=33&&G<=36)||(G>=37&&G<=40)||G==13||G==45){if(m.isIE&&G==13){B.undoManager.beforeChange()}if(B.undoManager.typing){y()}return}if((G<16||G>20)&&G!=224&&G!=91&&!B.undoManager.typing){B.undoManager.beforeChange();B.undoManager.add();B.undoManager.typing=true}});B.onMouseDown.add(function(){if(B.undoManager.typing){y()}})}if(m.isGecko){function A(){var s=B.dom.getAttribs(B.selection.getStart().cloneNode(false));return function(){var t=B.selection.getStart();B.dom.removeAllAttribs(t);i(s,function(D){t.setAttributeNode(D.cloneNode(true))})}}function z(){var t=B.selection;return !t.isCollapsed()&&t.getStart()!=t.getEnd()}B.onKeyPress.add(function(s,D){var t;if((D.keyCode==8||D.keyCode==46)&&z()){t=A();B.getDoc().execCommand("delete",false,null);t();return j.cancel(D)}});B.dom.bind(B.getDoc(),"cut",function(t){var s;if(z()){s=A();B.onKeyUp.addToTop(j.cancel,j);setTimeout(function(){s();B.onKeyUp.remove(j.cancel,j)},0)}})}},_isHidden:function(){var p;if(!a){return 0}p=this.selection.getSel();return(!p||!p.rangeCount||p.rangeCount==0)}})})(tinymce);(function(c){var d=c.each,e,a=true,b=false;c.EditorCommands=function(n){var l=n.dom,p=n.selection,j={state:{},exec:{},value:{}},k=n.settings,o;function q(y,x,v){var u;y=y.toLowerCase();if(u=j.exec[y]){u(y,x,v);return a}return b}function m(v){var u;v=v.toLowerCase();if(u=j.state[v]){return u(v)}return -1}function h(v){var u;v=v.toLowerCase();if(u=j.value[v]){return u(v)}return b}function t(u,v){v=v||"exec";d(u,function(y,x){d(x.toLowerCase().split(","),function(z){j[v][z]=y})})}c.extend(this,{execCommand:q,queryCommandState:m,queryCommandValue:h,addCommands:t});function f(x,v,u){if(v===e){v=b}if(u===e){u=null}return n.getDoc().execCommand(x,v,u)}function s(u){return n.formatter.match(u)}function r(u,v){n.formatter.toggle(u,v?{value:v}:e)}function i(u){o=p.getBookmark(u)}function g(){p.moveToBookmark(o)}t({"mceResetDesignMode,mceBeginUndoLevel":function(){},"mceEndUndoLevel,mceAddUndoLevel":function(){n.undoManager.add()},"Cut,Copy,Paste":function(y){var x=n.getDoc(),u;try{f(y)}catch(v){u=a}if(u||!x.queryCommandSupported(y)){if(c.isGecko){n.windowManager.confirm(n.getLang("clipboard_msg"),function(z){if(z){open("http://www.mozilla.org/editor/midasdemo/securityprefs.html","_blank")}})}else{n.windowManager.alert(n.getLang("clipboard_no_support"))}}},unlink:function(u){if(p.isCollapsed()){p.select(p.getNode())}f(u);p.collapse(b)},"JustifyLeft,JustifyCenter,JustifyRight,JustifyFull":function(u){var v=u.substring(7);d("left,center,right,full".split(","),function(x){if(v!=x){n.formatter.remove("align"+x)}});r("align"+v);q("mceRepaint")},"InsertUnorderedList,InsertOrderedList":function(x){var u,v;f(x);u=l.getParent(p.getNode(),"ol,ul");if(u){v=u.parentNode;if(/^(H[1-6]|P|ADDRESS|PRE)$/.test(v.nodeName)){i();l.split(v,u);g()}}},"Bold,Italic,Underline,Strikethrough,Superscript,Subscript":function(u){r(u)},"ForeColor,HiliteColor,FontName":function(x,v,u){r(x,u)},FontSize:function(y,x,v){var u,z;if(v>=1&&v<=7){z=c.explode(k.font_size_style_values);u=c.explode(k.font_size_classes);if(u){v=u[v-1]||v}else{v=z[v-1]||v}}r(y,v)},RemoveFormat:function(u){n.formatter.remove(u)},mceBlockQuote:function(u){r("blockquote")},FormatBlock:function(x,v,u){return r(u||"p")},mceCleanup:function(){var u=p.getBookmark();n.setContent(n.getContent({cleanup:a}),{cleanup:a});p.moveToBookmark(u)},mceRemoveNode:function(y,x,v){var u=v||p.getNode();if(u!=n.getBody()){i();n.dom.remove(u,a);g()}},mceSelectNodeDepth:function(y,x,v){var u=0;l.getParent(p.getNode(),function(z){if(z.nodeType==1&&u++==v){p.select(z);return b}},n.getBody())},mceSelectNode:function(x,v,u){p.select(u)},mceInsertContent:function(z,D,E){var C,u,x,F,y,u,A,G,B;function v(H,J){var I,K=new c.dom.TreeWalker(H,J);while((I=K.current())){if((I.nodeType==3&&c.trim(I.nodeValue).length)||I.nodeName=="BR"||I.nodeName=="IMG"){return I}K.prev()}}B={content:E,format:"html"};p.onBeforeSetContent.dispatch(p,B);E=B.content;if(E.indexOf("{$caret}")==-1){E+="{$caret}"}p.setContent('<span id="__mce">\uFEFF</span>',{no_events:false});l.setOuterHTML("__mce",E.replace(/\{\$caret\}/,'<span data-mce-type="bookmark" id="__mce">\uFEFF</span>'));C=l.select("#__mce")[0];x=l.getRoot();if(C.previousSibling&&l.isBlock(C.previousSibling)||C.parentNode==x){y=v(C.previousSibling,x);if(y){if(y.nodeName=="BR"){y.parentNode.insertBefore(C,y)}else{l.insertAfter(C,y)}}}while(C){if(C===x){l.setOuterHTML(F,new c.html.Serializer({},n.schema).serialize(new c.html.DomParser({remove_trailing_brs:true},n.schema).parse(l.getOuterHTML(F))));break}F=C;C=C.parentNode}C=l.select("#__mce")[0];if(C){y=v(C.previousSibling,x);l.remove(C);if(y){u=l.createRng();if(y.nodeType==3){u.setStart(y,y.length);u.setEnd(y,y.length)}else{if(y.nodeName=="BR"){u.setStartBefore(y);u.setEndBefore(y)}else{u.setStartAfter(y);u.setEndAfter(y)}}p.setRng(u);if(!c.isIE){y=l.create("span",null,"\u00a0");u.insertNode(y);A=l.getRect(y);G=l.getViewPort(n.getWin());if((A.y>G.y+G.h||A.y<G.y)||(A.x>G.x+G.w||A.x<G.x)){n.getBody().scrollLeft=A.x;n.getBody().scrollTop=A.y}l.remove(y)}p.collapse(true)}}p.onSetContent.dispatch(p,B);n.addVisual()},mceInsertRawHTML:function(x,v,u){p.setContent("tiny_mce_marker");n.setContent(n.getContent().replace(/tiny_mce_marker/g,function(){return u}))},mceSetContent:function(x,v,u){n.setContent(u)},"Indent,Outdent":function(y){var v,u,x;v=k.indentation;u=/[a-z%]+$/i.exec(v);v=parseInt(v);if(!m("InsertUnorderedList")&&!m("InsertOrderedList")){d(p.getSelectedBlocks(),function(z){if(y=="outdent"){x=Math.max(0,parseInt(z.style.paddingLeft||0)-v);l.setStyle(z,"paddingLeft",x?x+u:"")}else{l.setStyle(z,"paddingLeft",(parseInt(z.style.paddingLeft||0)+v)+u)}})}else{f(y)}},mceRepaint:function(){var v;if(c.isGecko){try{i(a);if(p.getSel()){p.getSel().selectAllChildren(n.getBody())}p.collapse(a);g()}catch(u){}}},mceToggleFormat:function(x,v,u){n.formatter.toggle(u)},InsertHorizontalRule:function(){n.execCommand("mceInsertContent",false,"<hr />")},mceToggleVisualAid:function(){n.hasVisual=!n.hasVisual;n.addVisual()},mceReplaceContent:function(x,v,u){n.execCommand("mceInsertContent",false,p.setContent(u.replace(/\{\$selection\}/g,p.getContent({format:"text"}))))},mceInsertLink:function(A,z,y){var x=l.getParent(p.getNode(),"a"),v,u;if(c.is(y,"string")){y={href:y}}y.href=y.href.replace(" ","%20");if(!x){if(c.isWebKit){v=l.getParent(p.getNode(),"img");if(v){u=v.style.cssFloat;v.style.cssFloat=null}}f("CreateLink",b,"javascript:mctmp(0);");if(u){v.style.cssFloat=u}d(l.select("a[href='javascript:mctmp(0);']"),function(B){l.setAttribs(B,y)})}else{if(y.href){l.setAttribs(x,y)}else{n.dom.remove(x,a)}}},selectAll:function(){var v=l.getRoot(),u=l.createRng();u.setStart(v,0);u.setEnd(v,v.childNodes.length);n.selection.setRng(u)}});t({"JustifyLeft,JustifyCenter,JustifyRight,JustifyFull":function(u){return s("align"+u.substring(7))},"Bold,Italic,Underline,Strikethrough,Superscript,Subscript":function(u){return s(u)},mceBlockQuote:function(){return s("blockquote")},Outdent:function(){var u;if(k.inline_styles){if((u=l.getParent(p.getStart(),l.isBlock))&&parseInt(u.style.paddingLeft)>0){return a}if((u=l.getParent(p.getEnd(),l.isBlock))&&parseInt(u.style.paddingLeft)>0){return a}}return m("InsertUnorderedList")||m("InsertOrderedList")||(!k.inline_styles&&!!l.getParent(p.getNode(),"BLOCKQUOTE"))},"InsertUnorderedList,InsertOrderedList":function(u){return l.getParent(p.getNode(),u=="insertunorderedlist"?"UL":"OL")}},"state");t({"FontSize,FontName":function(x){var v=0,u;if(u=l.getParent(p.getNode(),"span")){if(x=="fontsize"){v=u.style.fontSize}else{v=u.style.fontFamily.replace(/, /g,",").replace(/[\'\"]/g,"").toLowerCase()}}return v}},"value");if(k.custom_undo_redo){t({Undo:function(){n.undoManager.undo()},Redo:function(){n.undoManager.redo()}})}}})(tinymce);(function(b){var a=b.util.Dispatcher;b.UndoManager=function(e){var c,d=0,g=[];function f(){return b.trim(e.getContent({format:"raw",no_events:1}))}return c={typing:false,onAdd:new a(c),onUndo:new a(c),onRedo:new a(c),beforeChange:function(){if(g[d]){g[d].beforeBookmark=e.selection.getBookmark(2,true)}},add:function(l){var h,j=e.settings,k;l=l||{};l.content=f();k=g[d];if(k&&k.content==l.content){return null}if(j.custom_undo_redo_levels){if(g.length>j.custom_undo_redo_levels){for(h=0;h<g.length-1;h++){g[h]=g[h+1]}g.length--;d=g.length}}l.bookmark=e.selection.getBookmark(2,true);if(d<g.length-1){g.length=d+1}g.push(l);d=g.length-1;c.onAdd.dispatch(c,l);e.isNotDirty=0;return l},undo:function(){var j,h;if(c.typing){c.add();c.typing=false}if(d>0){j=g[--d];e.setContent(j.content,{format:"raw"});e.selection.moveToBookmark(j.beforeBookmark);c.onUndo.dispatch(c,j)}return j},redo:function(){var h;if(d<g.length-1){h=g[++d];e.setContent(h.content,{format:"raw"});e.selection.moveToBookmark(h.bookmark);c.onRedo.dispatch(c,h)}return h},clear:function(){g=[];d=0;c.typing=false},hasUndo:function(){return d>0||this.typing},hasRedo:function(){return d<g.length-1&&!this.typing}}}})(tinymce);(function(m){var k=m.dom.Event,c=m.isIE,a=m.isGecko,b=m.isOpera,j=m.each,i=m.extend,d=true,h=false;function l(p){var q,o,n;do{if(/^(SPAN|STRONG|B|EM|I|FONT|STRIKE|U)$/.test(p.nodeName)){if(q){o=p.cloneNode(false);o.appendChild(q);q=o}else{q=n=p.cloneNode(false)}q.removeAttribute("id")}}while(p=p.parentNode);if(q){return{wrapper:q,inner:n}}}function g(o,p){var n=p.ownerDocument.createRange();n.setStart(o.endContainer,o.endOffset);n.setEndAfter(p);return n.cloneContents().textContent.length==0}function f(o){o=o.innerHTML;o=o.replace(/<(img|hr|table|input|select|textarea)[ \>]/gi,"-");o=o.replace(/<[^>]+>/g,"");return o.replace(/[ \u00a0\t\r\n]+/g,"")==""}function e(p,r,n){var o,q;if(f(n)){o=r.getParent(n,"ul,ol");if(!r.getParent(o.parentNode,"ul,ol")){r.split(o,n);q=r.create("p",0,'<br data-mce-bogus="1" />');r.replace(q,n);p.select(q,1)}return h}return d}m.create("tinymce.ForceBlocks",{ForceBlocks:function(n){var o=this,p=n.settings,q;o.editor=n;o.dom=n.dom;q=(p.forced_root_block||"p").toLowerCase();p.element=q.toUpperCase();n.onPreInit.add(o.setup,o);if(p.forced_root_block){n.onInit.add(o.forceRoots,o);n.onSetContent.add(o.forceRoots,o);n.onBeforeGetContent.add(o.forceRoots,o);n.onExecCommand.add(function(r,s){if(s=="mceInsertContent"){o.forceRoots();r.nodeChanged()}})}},setup:function(){var o=this,n=o.editor,q=n.settings,u=n.dom,p=n.selection;if(q.forced_root_block){n.onBeforeExecCommand.add(o.forceRoots,o);n.onKeyUp.add(o.forceRoots,o);n.onPreProcess.add(o.forceRoots,o)}if(q.force_br_newlines){if(c){n.onKeyPress.add(function(s,t){var v;if(t.keyCode==13&&p.getNode().nodeName!="LI"){p.setContent('<br id="__" /> ',{format:"raw"});v=u.get("__");v.removeAttribute("id");p.select(v);p.collapse();return k.cancel(t)}})}}if(q.force_p_newlines){if(!c){n.onKeyPress.add(function(s,t){if(t.keyCode==13&&!t.shiftKey&&!o.insertPara(t)){k.cancel(t)}})}else{m.addUnload(function(){o._previousFormats=0});n.onKeyPress.add(function(s,t){o._previousFormats=0;if(t.keyCode==13&&!t.shiftKey&&s.selection.isCollapsed()&&q.keep_styles){o._previousFormats=l(s.selection.getStart())}});n.onKeyUp.add(function(t,x){if(x.keyCode==13&&!x.shiftKey){var v=t.selection.getStart(),s=o._previousFormats;if(!v.hasChildNodes()&&s){v=u.getParent(v,u.isBlock);if(v&&v.nodeName!="LI"){v.innerHTML="";if(o._previousFormats){v.appendChild(s.wrapper);s.inner.innerHTML="\uFEFF"}else{v.innerHTML="\uFEFF"}p.select(v,1);p.collapse(true);t.getDoc().execCommand("Delete",false,null);o._previousFormats=0}}}})}if(a){n.onKeyDown.add(function(s,t){if((t.keyCode==8||t.keyCode==46)&&!t.shiftKey){o.backspaceDelete(t,t.keyCode==8)}})}}if(m.isWebKit){function r(t){var s=p.getRng(),v,z=u.create("div",null," "),y,x=u.getViewPort(t.getWin()).h;s.insertNode(v=u.create("br"));s.setStartAfter(v);s.setEndAfter(v);p.setRng(s);if(p.getSel().focusNode==v.previousSibling){p.select(u.insertAfter(u.doc.createTextNode("\u00a0"),v));p.collapse(d)}u.insertAfter(z,v);y=u.getPos(z).y;u.remove(z);if(y>x){t.getWin().scrollTo(0,y)}}n.onKeyPress.add(function(s,t){if(t.keyCode==13&&(t.shiftKey||(q.force_br_newlines&&!u.getParent(p.getNode(),"h1,h2,h3,h4,h5,h6,ol,ul")))){r(s);k.cancel(t)}})}if(c){if(q.element!="P"){n.onKeyPress.add(function(s,t){o.lastElm=p.getNode().nodeName});n.onKeyUp.add(function(t,v){var y,x=p.getNode(),s=t.getBody();if(s.childNodes.length===1&&x.nodeName=="P"){x=u.rename(x,q.element);p.select(x);p.collapse();t.nodeChanged()}else{if(v.keyCode==13&&!v.shiftKey&&o.lastElm!="P"){y=u.getParent(x,"p");if(y){u.rename(y,q.element);t.nodeChanged()}}}})}}},find:function(v,q,r){var p=this.editor,o=p.getDoc().createTreeWalker(v,4,null,h),u=-1;while(v=o.nextNode()){u++;if(q==0&&v==r){return u}if(q==1&&u==r){return v}}return -1},forceRoots:function(x,I){var z=this,x=z.editor,M=x.getBody(),J=x.getDoc(),P=x.selection,A=P.getSel(),B=P.getRng(),N=-2,v,G,o,p,K=-16777215;var L,q,O,F,C,u=M.childNodes,E,D,y;for(E=u.length-1;E>=0;E--){L=u[E];if(L.nodeType===1&&L.getAttribute("data-mce-type")){q=null;continue}if(L.nodeType===3||(!z.dom.isBlock(L)&&L.nodeType!==8&&!/^(script|mce:script|style|mce:style)$/i.test(L.nodeName))){if(!q){if(L.nodeType!=3||/[^\s]/g.test(L.nodeValue)){if(N==-2&&B){if(!c||B.setStart){if(B.startContainer.nodeType==1&&(D=B.startContainer.childNodes[B.startOffset])&&D.nodeType==1){y=D.getAttribute("id");D.setAttribute("id","__mce")}else{if(x.dom.getParent(B.startContainer,function(n){return n===M})){G=B.startOffset;o=B.endOffset;N=z.find(M,0,B.startContainer);v=z.find(M,0,B.endContainer)}}}else{if(B.item){p=J.body.createTextRange();p.moveToElementText(B.item(0));B=p}p=J.body.createTextRange();p.moveToElementText(M);p.collapse(1);O=p.move("character",K)*-1;p=B.duplicate();p.collapse(1);F=p.move("character",K)*-1;p=B.duplicate();p.collapse(0);C=(p.move("character",K)*-1)-F;N=F-O;v=C}}q=x.dom.create(x.settings.forced_root_block);L.parentNode.replaceChild(q,L);q.appendChild(L)}}else{if(q.hasChildNodes()){q.insertBefore(L,q.firstChild)}else{q.appendChild(L)}}}else{q=null}}if(N!=-2){if(!c||B.setStart){q=M.getElementsByTagName(x.settings.element)[0];B=J.createRange();if(N!=-1){B.setStart(z.find(M,1,N),G)}else{B.setStart(q,0)}if(v!=-1){B.setEnd(z.find(M,1,v),o)}else{B.setEnd(q,0)}if(A){A.removeAllRanges();A.addRange(B)}}else{try{B=A.createRange();B.moveToElementText(M);B.collapse(1);B.moveStart("character",N);B.moveEnd("character",v);B.select()}catch(H){}}}else{if((!c||B.setStart)&&(D=x.dom.get("__mce"))){if(y){D.setAttribute("id",y)}else{D.removeAttribute("id")}B=J.createRange();B.setStartBefore(D);B.setEndBefore(D);P.setRng(B)}}},getParentBlock:function(p){var o=this.dom;return o.getParent(p,o.isBlock)},insertPara:function(S){var G=this,x=G.editor,O=x.dom,T=x.getDoc(),X=x.settings,H=x.selection.getSel(),I=H.getRangeAt(0),W=T.body;var L,M,J,Q,P,u,p,v,A,o,E,V,q,z,K,N=O.getViewPort(x.getWin()),D,F,C;x.undoManager.beforeChange();L=T.createRange();L.setStart(H.anchorNode,H.anchorOffset);L.collapse(d);M=T.createRange();M.setStart(H.focusNode,H.focusOffset);M.collapse(d);J=L.compareBoundaryPoints(L.START_TO_END,M)<0;Q=J?H.anchorNode:H.focusNode;P=J?H.anchorOffset:H.focusOffset;u=J?H.focusNode:H.anchorNode;p=J?H.focusOffset:H.anchorOffset;if(Q===u&&/^(TD|TH)$/.test(Q.nodeName)){if(Q.firstChild.nodeName=="BR"){O.remove(Q.firstChild)}if(Q.childNodes.length==0){x.dom.add(Q,X.element,null,"<br />");V=x.dom.add(Q,X.element,null,"<br />")}else{K=Q.innerHTML;Q.innerHTML="";x.dom.add(Q,X.element,null,K);V=x.dom.add(Q,X.element,null,"<br />")}I=T.createRange();I.selectNodeContents(V);I.collapse(1);x.selection.setRng(I);return h}if(Q==W&&u==W&&W.firstChild&&x.dom.isBlock(W.firstChild)){Q=u=Q.firstChild;P=p=0;L=T.createRange();L.setStart(Q,0);M=T.createRange();M.setStart(u,0)}Q=Q.nodeName=="HTML"?T.body:Q;Q=Q.nodeName=="BODY"?Q.firstChild:Q;u=u.nodeName=="HTML"?T.body:u;u=u.nodeName=="BODY"?u.firstChild:u;v=G.getParentBlock(Q);A=G.getParentBlock(u);o=v?v.nodeName:X.element;if(K=G.dom.getParent(v,"li,pre")){if(K.nodeName=="LI"){return e(x.selection,G.dom,K)}return d}if(v&&(v.nodeName=="CAPTION"||/absolute|relative|fixed/gi.test(O.getStyle(v,"position",1)))){o=X.element;v=null}if(A&&(A.nodeName=="CAPTION"||/absolute|relative|fixed/gi.test(O.getStyle(v,"position",1)))){o=X.element;A=null}if(/(TD|TABLE|TH|CAPTION)/.test(o)||(v&&o=="DIV"&&/left|right/gi.test(O.getStyle(v,"float",1)))){o=X.element;v=A=null}E=(v&&v.nodeName==o)?v.cloneNode(0):x.dom.create(o);V=(A&&A.nodeName==o)?A.cloneNode(0):x.dom.create(o);V.removeAttribute("id");if(/^(H[1-6])$/.test(o)&&g(I,v)){V=x.dom.create(X.element)}K=q=Q;do{if(K==W||K.nodeType==9||G.dom.isBlock(K)||/(TD|TABLE|TH|CAPTION)/.test(K.nodeName)){break}q=K}while((K=K.previousSibling?K.previousSibling:K.parentNode));K=z=u;do{if(K==W||K.nodeType==9||G.dom.isBlock(K)||/(TD|TABLE|TH|CAPTION)/.test(K.nodeName)){break}z=K}while((K=K.nextSibling?K.nextSibling:K.parentNode));if(q.nodeName==o){L.setStart(q,0)}else{L.setStartBefore(q)}L.setEnd(Q,P);E.appendChild(L.cloneContents()||T.createTextNode(""));try{M.setEndAfter(z)}catch(R){}M.setStart(u,p);V.appendChild(M.cloneContents()||T.createTextNode(""));I=T.createRange();if(!q.previousSibling&&q.parentNode.nodeName==o){I.setStartBefore(q.parentNode)}else{if(L.startContainer.nodeName==o&&L.startOffset==0){I.setStartBefore(L.startContainer)}else{I.setStart(L.startContainer,L.startOffset)}}if(!z.nextSibling&&z.parentNode.nodeName==o){I.setEndAfter(z.parentNode)}else{I.setEnd(M.endContainer,M.endOffset)}I.deleteContents();if(b){x.getWin().scrollTo(0,N.y)}if(E.firstChild&&E.firstChild.nodeName==o){E.innerHTML=E.firstChild.innerHTML}if(V.firstChild&&V.firstChild.nodeName==o){V.innerHTML=V.firstChild.innerHTML}if(f(E)){E.innerHTML="<br />"}function U(y,s){var r=[],Z,Y,t;y.innerHTML="";if(X.keep_styles){Y=s;do{if(/^(SPAN|STRONG|B|EM|I|FONT|STRIKE|U)$/.test(Y.nodeName)){Z=Y.cloneNode(h);O.setAttrib(Z,"id","");r.push(Z)}}while(Y=Y.parentNode)}if(r.length>0){for(t=r.length-1,Z=y;t>=0;t--){Z=Z.appendChild(r[t])}r[0].innerHTML=b?"\u00a0":"<br />";return r[0]}else{y.innerHTML=b?"\u00a0":"<br />"}}if(f(V)){C=U(V,u)}if(b&&parseFloat(opera.version())<9.5){I.insertNode(E);I.insertNode(V)}else{I.insertNode(V);I.insertNode(E)}V.normalize();E.normalize();function B(r){return T.createTreeWalker(r,NodeFilter.SHOW_TEXT,null,h).nextNode()||r}I=T.createRange();I.selectNodeContents(a?B(C||V):C||V);I.collapse(1);H.removeAllRanges();H.addRange(I);D=x.dom.getPos(V).y;if(D<N.y||D+25>N.y+N.h){x.getWin().scrollTo(0,D<N.y?D:D-N.h+25)}x.undoManager.add();return h},backspaceDelete:function(v,C){var D=this,u=D.editor,z=u.getBody(),s=u.dom,q,x=u.selection,p=x.getRng(),y=p.startContainer,q,A,B,o;if(!C&&p.collapsed&&y.nodeType==1&&p.startOffset==y.childNodes.length){o=new m.dom.TreeWalker(y.lastChild,y);for(q=y.lastChild;q;q=o.prev()){if(q.nodeType==3){p.setStart(q,q.nodeValue.length);p.collapse(true);x.setRng(p);return}}}if(y&&u.dom.isBlock(y)&&!/^(TD|TH)$/.test(y.nodeName)&&C){if(y.childNodes.length==0||(y.childNodes.length==1&&y.firstChild.nodeName=="BR")){q=y;while((q=q.previousSibling)&&!u.dom.isBlock(q)){}if(q){if(y!=z.firstChild){A=u.dom.doc.createTreeWalker(q,NodeFilter.SHOW_TEXT,null,h);while(B=A.nextNode()){q=B}p=u.getDoc().createRange();p.setStart(q,q.nodeValue?q.nodeValue.length:0);p.setEnd(q,q.nodeValue?q.nodeValue.length:0);x.setRng(p);u.dom.remove(y)}return k.cancel(v)}}}}})})(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){if(p.cmd){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,g)}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);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));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);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,g.editor);if(g.get(k)){return null}return g.add(i)},createToolbarGroup:function(k,h,j){var i,g=this,f;k=g.prefix+k;f=j||this._cls.toolbarGroup||c.ui.ToolbarGroup;i=new f(k,h,g.editor);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)}},resizeBy:function(f,g,h){h.resizeBy(f,g)},_decode:function(f){return d.DOM.decode(f).replace(/\\n/g,"\n")}})}(tinymce));(function(a){a.Formatter=function(V){var M={},O=a.each,c=V.dom,q=V.selection,t=a.dom.TreeWalker,K=new a.dom.RangeUtils(c),d=V.schema.isValidChild,F=c.isBlock,l=V.settings.forced_root_block,s=c.nodeIndex,E="\uFEFF",e=/^(src|href|style)$/,S=false,B=true,p,P={apply:[],remove:[]};function z(W){return W instanceof Array}function m(X,W){return c.getParents(X,W,c.getRoot())}function b(W){return W.nodeType===1&&(W.face==="mceinline"||W.style.fontFamily==="mceinline")}function R(W){return W?M[W]:M}function k(W,X){if(W){if(typeof(W)!=="string"){O(W,function(Z,Y){k(Y,Z)})}else{X=X.length?X:[X];O(X,function(Y){if(Y.deep===p){Y.deep=!Y.selector}if(Y.split===p){Y.split=!Y.selector||Y.inline}if(Y.remove===p&&Y.selector&&!Y.inline){Y.remove="none"}if(Y.selector&&Y.inline){Y.mixed=true;Y.block_expand=true}if(typeof(Y.classes)==="string"){Y.classes=Y.classes.split(/\s+/)}});M[W]=X}}}var i=function(X){var W;V.dom.getParent(X,function(Y){W=V.dom.getStyle(Y,"text-decoration");return W&&W!=="none"});return W};var I=function(W){var X;if(W.nodeType===1&&W.parentNode&&W.parentNode.nodeType===1){X=i(W.parentNode);if(V.dom.getStyle(W,"color")&&X){V.dom.setStyle(W,"text-decoration",X)}else{if(V.dom.getStyle(W,"textdecoration")===X){V.dom.setStyle(W,"text-decoration",null)}}}};function T(Y,af,aa){var ab=R(Y),ag=ab[0],ae,X,ad,ac=q.isCollapsed();function Z(ak){var aj=ak.startContainer,an=ak.startOffset,am,al;if(aj.nodeType==1||aj.nodeValue===""){aj=aj.nodeType==1?aj.childNodes[an]:aj;if(aj){am=new t(aj,aj.parentNode);for(al=am.current();al;al=am.next()){if(al.nodeType==3&&!f(al)){ak.setStart(al,0);break}}}}return ak}function W(ak,aj){aj=aj||ag;if(ak){O(aj.styles,function(am,al){c.setStyle(ak,al,r(am,af))});O(aj.attributes,function(am,al){c.setAttrib(ak,al,r(am,af))});O(aj.classes,function(al){al=r(al,af);if(!c.hasClass(ak,al)){c.addClass(ak,al)}})}}function ah(ak){var aj=[],am,al;am=ag.inline||ag.block;al=c.create(am);W(al);K.walk(ak,function(an){var ao;function ap(aq){var au=aq.nodeName.toLowerCase(),at=aq.parentNode.nodeName.toLowerCase(),ar;if(g(au,"br")){ao=0;if(ag.block){c.remove(aq)}return}if(ag.wrapper&&x(aq,Y,af)){ao=0;return}if(ag.block&&!ag.wrapper&&G(au)){aq=c.rename(aq,am);W(aq);aj.push(aq);ao=0;return}if(ag.selector){O(ab,function(av){if("collapsed" in av&&av.collapsed!==ac){return}if(c.is(aq,av.selector)&&!b(aq)){W(aq,av);ar=true}});if(!ag.inline||ar){ao=0;return}}if(d(am,au)&&d(at,am)&&!(aq.nodeType===3&&aq.nodeValue.length===1&&aq.nodeValue.charCodeAt(0)===65279)){if(!ao){ao=al.cloneNode(S);aq.parentNode.insertBefore(ao,aq);aj.push(ao)}ao.appendChild(aq)}else{ao=0;O(a.grep(aq.childNodes),ap);ao=0}}O(an,ap)});if(ag.wrap_links===false){O(aj,function(an){function ao(at){var ar,aq,ap;if(at.nodeName==="A"){aq=al.cloneNode(S);aj.push(aq);ap=a.grep(at.childNodes);for(ar=0;ar<ap.length;ar++){aq.appendChild(ap[ar])}at.appendChild(aq)}O(a.grep(at.childNodes),ao)}ao(an)})}O(aj,function(ap){var an;function aq(at){var ar=0;O(at.childNodes,function(au){if(!f(au)&&!H(au)){ar++}});return ar}function ao(ar){var au,at;O(ar.childNodes,function(av){if(av.nodeType==1&&!H(av)&&!b(av)){au=av;return S}});if(au&&h(au,ag)){at=au.cloneNode(S);W(at);c.replace(at,ar,B);c.remove(au,1)}return at||ar}an=aq(ap);if((aj.length>1||!F(ap))&&an===0){c.remove(ap,1);return}if(ag.inline||ag.wrapper){if(!ag.exact&&an===1){ap=ao(ap)}O(ab,function(ar){O(c.select(ar.inline,ap),function(au){var at;if(ar.wrap_links===false){at=au.parentNode;do{if(at.nodeName==="A"){return}}while(at=at.parentNode)}U(ar,af,au,ar.exact?au:null)})});if(x(ap.parentNode,Y,af)){c.remove(ap,1);ap=0;return B}if(ag.merge_with_parents){c.getParent(ap.parentNode,function(ar){if(x(ar,Y,af)){c.remove(ap,1);ap=0;return B}})}if(ap){ap=u(C(ap),ap);ap=u(ap,C(ap,B))}}})}if(ag){if(aa){X=c.createRng();X.setStartBefore(aa);X.setEndAfter(aa);ah(o(X,ab))}else{if(!ac||!ag.inline||c.select("td.mceSelected,th.mceSelected").length){var ai=V.selection.getNode();ae=q.getBookmark();ah(o(q.getRng(B),ab));if(ag.styles&&(ag.styles.color||ag.styles.textDecoration)){a.walk(ai,I,"childNodes");I(ai)}q.moveToBookmark(ae);q.setRng(Z(q.getRng(B)));V.nodeChanged()}else{Q("apply",Y,af)}}}}function A(Y,ah,ab){var ac=R(Y),aj=ac[0],ag,af,X;function aa(am){var al=am.startContainer,ar=am.startOffset,aq,ap,an,ao;if(al.nodeType==3&&ar>=al.nodeValue.length-1){al=al.parentNode;ar=s(al)+1}if(al.nodeType==1){an=al.childNodes;al=an[Math.min(ar,an.length-1)];aq=new t(al);if(ar>an.length-1){aq.next()}for(ap=aq.current();ap;ap=aq.next()){if(ap.nodeType==3&&!f(ap)){ao=c.create("a",null,E);ap.parentNode.insertBefore(ao,ap);am.setStart(ap,0);q.setRng(am);c.remove(ao);return}}}}function Z(ao){var an,am,al;an=a.grep(ao.childNodes);for(am=0,al=ac.length;am<al;am++){if(U(ac[am],ah,ao,ao)){break}}if(aj.deep){for(am=0,al=an.length;am<al;am++){Z(an[am])}}}function ad(al){var am;O(m(al.parentNode).reverse(),function(an){var ao;if(!am&&an.id!="_start"&&an.id!="_end"){ao=x(an,Y,ah);if(ao&&ao.split!==false){am=an}}});return am}function W(ao,al,aq,au){var av,at,ar,an,ap,am;if(ao){am=ao.parentNode;for(av=al.parentNode;av&&av!=am;av=av.parentNode){at=av.cloneNode(S);for(ap=0;ap<ac.length;ap++){if(U(ac[ap],ah,at,at)){at=0;break}}if(at){if(ar){at.appendChild(ar)}if(!an){an=at}ar=at}}if(au&&(!aj.mixed||!F(ao))){al=c.split(ao,al)}if(ar){aq.parentNode.insertBefore(ar,aq);an.appendChild(aq)}}return al}function ai(al){return W(ad(al),al,al,true)}function ae(an){var am=c.get(an?"_start":"_end"),al=am[an?"firstChild":"lastChild"];if(H(al)){al=al[an?"firstChild":"lastChild"]}c.remove(am,true);return al}function ak(al){var am,an;al=o(al,ac,B);if(aj.split){am=J(al,B);an=J(al);if(am!=an){am=N(am,"span",{id:"_start","data-mce-type":"bookmark"});an=N(an,"span",{id:"_end","data-mce-type":"bookmark"});ai(am);ai(an);am=ae(B);an=ae()}else{am=an=ai(am)}al.startContainer=am.parentNode;al.startOffset=s(am);al.endContainer=an.parentNode;al.endOffset=s(an)+1}K.walk(al,function(ao){O(ao,function(ap){Z(ap);if(ap.nodeType===1&&V.dom.getStyle(ap,"text-decoration")==="underline"&&ap.parentNode&&i(ap.parentNode)==="underline"){U({deep:false,exact:true,inline:"span",styles:{textDecoration:"underline"}},null,ap)}})})}if(ab){X=c.createRng();X.setStartBefore(ab);X.setEndAfter(ab);ak(X);return}if(!q.isCollapsed()||!aj.inline||c.select("td.mceSelected,th.mceSelected").length){ag=q.getBookmark();ak(q.getRng(B));q.moveToBookmark(ag);if(j(Y,ah,q.getStart())){aa(q.getRng(true))}V.nodeChanged()}else{Q("remove",Y,ah)}}function D(X,Z,Y){var W=R(X);if(j(X,Z,Y)&&(!("toggle" in W[0])||W[0]["toggle"])){A(X,Z,Y)}else{T(X,Z,Y)}}function x(X,W,ac,aa){var Y=R(W),ad,ab,Z;function ae(ai,ak,al){var ah,aj,af=ak[al],ag;if(af){if(af.length===p){for(ah in af){if(af.hasOwnProperty(ah)){if(al==="attributes"){aj=c.getAttrib(ai,ah)}else{aj=L(ai,ah)}if(aa&&!aj&&!ak.exact){return}if((!aa||ak.exact)&&!g(aj,r(af[ah],ac))){return}}}}else{for(ag=0;ag<af.length;ag++){if(al==="attributes"?c.getAttrib(ai,af[ag]):L(ai,af[ag])){return ak}}}}return ak}if(Y&&X){for(ab=0;ab<Y.length;ab++){ad=Y[ab];if(h(X,ad)&&ae(X,ad,"attributes")&&ae(X,ad,"styles")){if(Z=ad.classes){for(ab=0;ab<Z.length;ab++){if(!c.hasClass(X,Z[ab])){return}}}return ad}}}}function j(Y,ab,aa){var X,Z;function W(ac){ac=c.getParent(ac,function(ad){return !!x(ad,Y,ab,true)});return x(ac,Y,ab)}if(aa){return W(aa)}if(q.isCollapsed()){for(Z=P.apply.length-1;Z>=0;Z--){if(P.apply[Z].name==Y){return true}}for(Z=P.remove.length-1;Z>=0;Z--){if(P.remove[Z].name==Y){return false}}return W(q.getNode())}aa=q.getNode();if(W(aa)){return B}X=q.getStart();if(X!=aa){if(W(X)){return B}}return S}function v(ad,ac){var aa,ab=[],Z={},Y,X,W;if(q.isCollapsed()){for(X=0;X<ad.length;X++){for(Y=P.remove.length-1;Y>=0;Y--){W=ad[X];if(P.remove[Y].name==W){Z[W]=true;break}}}for(Y=P.apply.length-1;Y>=0;Y--){for(X=0;X<ad.length;X++){W=ad[X];if(!Z[W]&&P.apply[Y].name==W){Z[W]=true;ab.push(W)}}}}aa=q.getStart();c.getParent(aa,function(ag){var af,ae;for(af=0;af<ad.length;af++){ae=ad[af];if(!Z[ae]&&x(ag,ae,ac)){Z[ae]=true;ab.push(ae)}}});return ab}function y(aa){var ac=R(aa),Z,Y,ab,X,W;if(ac){Z=q.getStart();Y=m(Z);for(X=ac.length-1;X>=0;X--){W=ac[X].selector;if(!W){return B}for(ab=Y.length-1;ab>=0;ab--){if(c.is(Y[ab],W)){return B}}}}return S}a.extend(this,{get:R,register:k,apply:T,remove:A,toggle:D,match:j,matchAll:v,matchNode:x,canApply:y});function h(W,X){if(g(W,X.inline)){return B}if(g(W,X.block)){return B}if(X.selector){return c.is(W,X.selector)}}function g(X,W){X=X||"";W=W||"";X=""+(X.nodeName||X);W=""+(W.nodeName||W);return X.toLowerCase()==W.toLowerCase()}function L(X,W){var Y=c.getStyle(X,W);if(W=="color"||W=="backgroundColor"){Y=c.toHex(Y)}if(W=="fontWeight"&&Y==700){Y="bold"}return""+Y}function r(W,X){if(typeof(W)!="string"){W=W(X)}else{if(X){W=W.replace(/%(\w+)/g,function(Z,Y){return X[Y]||Z})}}return W}function f(W){return W&&W.nodeType===3&&/^([\s\r\n]+|)$/.test(W.nodeValue)}function N(Y,X,W){var Z=c.create(X,W);Y.parentNode.insertBefore(Z,Y);Z.appendChild(Y);return Z}function o(W,ag,Z){var Y=W.startContainer,ad=W.startOffset,aj=W.endContainer,ae=W.endOffset,ai,af,ac;function ah(am,an,ak,al){var ao,ap;al=al||c.getRoot();for(;;){ao=am.parentNode;if(ao==al||(!ag[0].block_expand&&F(ao))){return am}for(ai=ao[an];ai&&ai!=am;ai=ai[ak]){if(ai.nodeType==1&&!H(ai)){return am}if(ai.nodeType==3&&!f(ai)){return am}}am=am.parentNode}return am}function ab(ak,al){if(al===p){al=ak.nodeType===3?ak.length:ak.childNodes.length}while(ak&&ak.hasChildNodes()){ak=ak.childNodes[al];if(ak){al=ak.nodeType===3?ak.length:ak.childNodes.length}}return{node:ak,offset:al}}if(Y.nodeType==1&&Y.hasChildNodes()){af=Y.childNodes.length-1;Y=Y.childNodes[ad>af?af:ad];if(Y.nodeType==3){ad=0}}if(aj.nodeType==1&&aj.hasChildNodes()){af=aj.childNodes.length-1;aj=aj.childNodes[ae>af?af:ae-1];if(aj.nodeType==3){ae=aj.nodeValue.length}}if(H(Y.parentNode)){Y=Y.parentNode}if(H(Y)){Y=Y.nextSibling||Y}if(H(aj.parentNode)){ae=c.nodeIndex(aj);aj=aj.parentNode}if(H(aj)&&aj.previousSibling){aj=aj.previousSibling;ae=aj.length}if(ag[0].inline){ac=ab(aj,ae);if(ac.node){while(ac.node&&ac.offset===0&&ac.node.previousSibling){ac=ab(ac.node.previousSibling)}if(ac.node&&ac.offset>0&&ac.node.nodeType===3&&ac.node.nodeValue.charAt(ac.offset-1)===" "){if(ac.offset>1){aj=ac.node;aj.splitText(ac.offset-1)}else{if(ac.node.previousSibling){aj=ac.node.previousSibling}}}}}if(ag[0].inline||ag[0].block_expand){Y=ah(Y,"firstChild","nextSibling");aj=ah(aj,"lastChild","previousSibling")}if(ag[0].selector&&ag[0].expand!==S&&!ag[0].inline){function aa(al,ak){var am,an,ap,ao;if(al.nodeType==3&&al.nodeValue.length==0&&al[ak]){al=al[ak]}am=m(al);for(an=0;an<am.length;an++){for(ap=0;ap<ag.length;ap++){ao=ag[ap];if("collapsed" in ao&&ao.collapsed!==W.collapsed){continue}if(c.is(am[an],ao.selector)){return am[an]}}}return al}Y=aa(Y,"previousSibling");aj=aa(aj,"nextSibling")}if(ag[0].block||ag[0].selector){function X(al,ak,an){var am;if(!ag[0].wrapper){am=c.getParent(al,ag[0].block)}if(!am){am=c.getParent(al.nodeType==3?al.parentNode:al,F)}if(am&&ag[0].wrapper){am=m(am,"ul,ol").reverse()[0]||am}if(!am){am=al;while(am[ak]&&!F(am[ak])){am=am[ak];if(g(am,"br")){break}}}return am||al}Y=X(Y,"previousSibling");aj=X(aj,"nextSibling");if(ag[0].block){if(!F(Y)){Y=ah(Y,"firstChild","nextSibling")}if(!F(aj)){aj=ah(aj,"lastChild","previousSibling")}}}if(Y.nodeType==1){ad=s(Y);Y=Y.parentNode}if(aj.nodeType==1){ae=s(aj)+1;aj=aj.parentNode}return{startContainer:Y,startOffset:ad,endContainer:aj,endOffset:ae}}function U(ac,ab,Z,W){var Y,X,aa;if(!h(Z,ac)){return S}if(ac.remove!="all"){O(ac.styles,function(ae,ad){ae=r(ae,ab);if(typeof(ad)==="number"){ad=ae;W=0}if(!W||g(L(W,ad),ae)){c.setStyle(Z,ad,"")}aa=1});if(aa&&c.getAttrib(Z,"style")==""){Z.removeAttribute("style");Z.removeAttribute("data-mce-style")}O(ac.attributes,function(af,ad){var ae;af=r(af,ab);if(typeof(ad)==="number"){ad=af;W=0}if(!W||g(c.getAttrib(W,ad),af)){if(ad=="class"){af=c.getAttrib(Z,ad);if(af){ae="";O(af.split(/\s+/),function(ag){if(/mce\w+/.test(ag)){ae+=(ae?" ":"")+ag}});if(ae){c.setAttrib(Z,ad,ae);return}}}if(ad=="class"){Z.removeAttribute("className")}if(e.test(ad)){Z.removeAttribute("data-mce-"+ad)}Z.removeAttribute(ad)}});O(ac.classes,function(ad){ad=r(ad,ab);if(!W||c.hasClass(W,ad)){c.removeClass(Z,ad)}});X=c.getAttribs(Z);for(Y=0;Y<X.length;Y++){if(X[Y].nodeName.indexOf("_")!==0){return S}}}if(ac.remove!="none"){n(Z,ac);return B}}function n(Y,Z){var W=Y.parentNode,X;if(Z.block){if(!l){function aa(ac,ab,ad){ac=C(ac,ab,ad);return !ac||(ac.nodeName=="BR"||F(ac))}if(F(Y)&&!F(W)){if(!aa(Y,S)&&!aa(Y.firstChild,B,1)){Y.insertBefore(c.create("br"),Y.firstChild)}if(!aa(Y,B)&&!aa(Y.lastChild,S,1)){Y.appendChild(c.create("br"))}}}else{if(W==c.getRoot()){if(!Z.list_block||!g(Y,Z.list_block)){O(a.grep(Y.childNodes),function(ab){if(d(l,ab.nodeName.toLowerCase())){if(!X){X=N(ab,l)}else{X.appendChild(ab)}}else{X=0}})}}}}if(Z.selector&&Z.inline&&!g(Z.inline,Y)){return}c.remove(Y,1)}function C(X,W,Y){if(X){W=W?"nextSibling":"previousSibling";for(X=Y?X:X[W];X;X=X[W]){if(X.nodeType==1||!f(X)){return X}}}}function H(W){return W&&W.nodeType==1&&W.getAttribute("data-mce-type")=="bookmark"}function u(aa,Z){var W,Y,X;function ac(af,ae){if(af.nodeName!=ae.nodeName){return S}function ad(ah){var ai={};O(c.getAttribs(ah),function(aj){var ak=aj.nodeName.toLowerCase();if(ak.indexOf("_")!==0&&ak!=="style"){ai[ak]=c.getAttrib(ah,ak)}});return ai}function ag(ak,aj){var ai,ah;for(ah in ak){if(ak.hasOwnProperty(ah)){ai=aj[ah];if(ai===p){return S}if(ak[ah]!=ai){return S}delete aj[ah]}}for(ah in aj){if(aj.hasOwnProperty(ah)){return S}}return B}if(!ag(ad(af),ad(ae))){return S}if(!ag(c.parseStyle(c.getAttrib(af,"style")),c.parseStyle(c.getAttrib(ae,"style")))){return S}return B}if(aa&&Z){function ab(ae,ad){for(Y=ae;Y;Y=Y[ad]){if(Y.nodeType==3&&Y.nodeValue.length!==0){return ae}if(Y.nodeType==1&&!H(Y)){return Y}}return ae}aa=ab(aa,"previousSibling");Z=ab(Z,"nextSibling");if(ac(aa,Z)){for(Y=aa.nextSibling;Y&&Y!=Z;){X=Y;Y=Y.nextSibling;aa.appendChild(X)}c.remove(Z);O(a.grep(Z.childNodes),function(ad){aa.appendChild(ad)});return aa}}return Z}function G(W){return/^(h[1-6]|p|div|pre|address|dl|dt|dd)$/.test(W)}function J(X,aa){var W,Z,Y;W=X[aa?"startContainer":"endContainer"];Z=X[aa?"startOffset":"endOffset"];if(W.nodeType==1){Y=W.childNodes.length-1;if(!aa&&Z){Z--}W=W.childNodes[Z>Y?Y:Z]}return W}function Q(ab,X,aa){var Y,W=P[ab],ac=P[ab=="apply"?"remove":"apply"];function ad(){return P.apply.length||P.remove.length}function Z(){P.apply=[];P.remove=[]}function ae(af){O(P.apply.reverse(),function(ag){T(ag.name,ag.vars,af);if(ag.name==="forecolor"&&ag.vars.value){I(af.parentNode)}});O(P.remove.reverse(),function(ag){A(ag.name,ag.vars,af)});c.remove(af,1);Z()}for(Y=W.length-1;Y>=0;Y--){if(W[Y].name==X){return}}W.push({name:X,vars:aa});for(Y=ac.length-1;Y>=0;Y--){if(ac[Y].name==X){ac.splice(Y,1)}}if(ad()){V.getDoc().execCommand("FontName",false,"mceinline");P.lastRng=q.getRng();O(c.select("font,span"),function(ag){var af;if(b(ag)){af=q.getBookmark();ae(ag);q.moveToBookmark(af);V.nodeChanged()}});if(!P.isListening&&ad()){P.isListening=true;O("onKeyDown,onKeyUp,onKeyPress,onMouseUp".split(","),function(af){V[af].addToTop(function(ag,ah){if(ad()&&!a.dom.RangeUtils.compareRanges(P.lastRng,q.getRng())){O(c.select("font,span"),function(aj){var ak,ai;if(b(aj)){ak=aj.firstChild;if(ak){ae(aj);ai=c.createRng();ai.setStart(ak,ak.nodeValue.length);ai.setEnd(ak,ak.nodeValue.length);q.setRng(ai);ag.nodeChanged()}else{c.remove(aj)}}});if(ah.type=="keyup"||ah.type=="mouseup"){Z()}}})})}}}}})(tinymce);tinymce.onAddEditor.add(function(e,a){var d,h,g,c=a.settings;if(c.inline_styles){h=e.explode(c.font_size_style_values);function b(j,i){e.each(i,function(l,k){if(l){g.setStyle(j,k,l)}});g.rename(j,"span")}d={font:function(j,i){b(i,{backgroundColor:i.style.backgroundColor,color:i.color,fontFamily:i.face,fontSize:h[parseInt(i.size)-1]})},u:function(j,i){b(i,{textDecoration:"underline"})},strike:function(j,i){b(i,{textDecoration:"line-through"})}};function f(i,j){g=i.dom;if(c.convert_fonts_to_spans){e.each(g.select("font,u,strike",j.node),function(k){d[k.nodeName.toLowerCase()](a.dom,k)})}}a.onPreProcess.add(f);a.onSetContent.add(f);a.onInit.add(function(){a.selection.onSetContent.add(f)})}});
\ No newline at end of file
diff -x .svn -aruN 0.7.24.src/e107_handlers/tiny_mce/tiny_mce_popup.js 0.7.26.src/e107_handlers/tiny_mce/tiny_mce_popup.js
--- 0.7.24.src/e107_handlers/tiny_mce/tiny_mce_popup.js	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_handlers/tiny_mce/tiny_mce_popup.js	2011-03-12 04:48:11.000000000 -0600
@@ -2,4 +2,4 @@
 // Uncomment and change this document.domain value if you are loading the script cross subdomains
 // document.domain = 'moxiecode.com';
 
-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.frameElement&&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
+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.frameElement&&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 a=this;setTimeout(function(){var b=a.dom.getViewPort(window);a.editor.windowManager.resizeBy(a.getWindowArg("mce_width")-b.w,a.getWindowArg("mce_height")-b.h,a.id||window)},10)},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&&b.editor.settings.language_load!==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}}if(!b.editor.getParam("browser_preferred_colors",false)||!b.isWindow){b.dom.addClass(document.body,"forceColors")}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.24.src/e107_handlers/tiny_mce/tiny_mce_src.js 0.7.26.src/e107_handlers/tiny_mce/tiny_mce_src.js
--- 0.7.24.src/e107_handlers/tiny_mce/tiny_mce_src.js	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_handlers/tiny_mce/tiny_mce_src.js	2011-03-30 03:22:40.000000000 -0500
@@ -1,13231 +1,15752 @@
-var tinymce = {
-	majorVersion : '3',
-	minorVersion : '2.7',
-	releaseDate : '2009-09-22',
-
-	_init : function() {
-		var t = this, d = document, w = window, na = navigator, ua = na.userAgent, i, nl, n, base, p, v;
-
-		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;
-		}
-
-		// Get suffix and base
-		t.suffix = '';
-
-		// 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 += '/';
-
-				base = v ? v.match(/.*\//)[0] : ''; // Get only directory
-			}
-		}
-
-		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';
-
-				if ((p = n.src.indexOf('?')) != -1)
-					t.query = n.src.substring(p + 1);
-
-				t.baseURL = n.src.substring(0, n.src.lastIndexOf('/'));
-
-				// If path to script is relative and a base href was found add that one infront
-				// the src property will always be an absolute one on non IE browsers and IE 8
-				// so this logic will basically only be executed on older IE versions
-				if (base && t.baseURL.indexOf('://') == -1 && t.baseURL.indexOf('/') !== 0)
-					t.baseURL = base + t.baseURL;
-
-				return t.baseURL;
-			}
-
-			return null;
-		};
-
-		// Check document
-		nl = d.getElementsByTagName('script');
-		for (i=0; i<nl.length; i++) {
-			if (getBase(nl[i]))
-				return;
-		}
-
-		// Check head
-		n = d.getElementsByTagName('head')[0];
-		if (n) {
-			nl = n.getElementsByTagName('script');
-			for (i=0; i<nl.length; i++) {
-				if (getBase(nl[i]))
-					return;
-			}
-		}
-
-		return;
-	},
-
-	is : function(o, t) {
-		var n = typeof(o);
-
-		if (!t)
-			return n != 'undefined';
-
-		if (t == 'array' && (o.hasOwnProperty && o instanceof Array))
-			return true;
-
-		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;
-				}
-			}
-		}
-
-		return 1;
-	},
-
-
-	map : function(a, f) {
-		var o = [];
-
-		tinymce.each(a, function(v) {
-			o.push(f(v));
-		});
-
-		return o;
-	},
-
-	grep : function(a, f) {
-		var o = [];
-
-		tinymce.each(a, function(v) {
-			if (!f || f(v))
-				o.push(v);
-		});
-
-		return o;
-	},
-
-	inArray : function(a, v) {
-		var i, l;
-
-		if (a) {
-			for (i = 0, l = a.length; i < l; i++) {
-				if (a[i] === v)
-					return i;
-			}
-		}
-
-		return -1;
-	},
-
-	extend : function(o, e) {
-		var i, a = arguments;
-
-		for (i=1; i<a.length; i++) {
-			e = a[i];
-
-			tinymce.each(e, function(v, n) {
-				if (typeof(v) !== 'undefined')
-					o[n] = v;
-			});
-		}
-
-		return o;
-	},
-
-
-	trim : function(s) {
-		return (s ? '' + s : '').replace(/^\s*|\s*$/g, '');
-	},
-
-	create : function(s, p) {
-		var t = this, sp, ns, cn, scn, c, de = 0;
-
-		// Parse : <prefix> <class>:<super class>
-		s = /^((static) )?([\w.]+)(:([\w.]+))?/.exec(s);
-		cn = s[3].match(/(^|\.)(\w+)$/i)[2]; // Class name
-
-		// Create namespace for new class
-		ns = t.createNS(s[3].replace(/\.\w+$/, ''));
-
-		// Class already exists
-		if (ns[cn])
-			return;
-
-		// Make pure static class
-		if (s[2] == 'static') {
-			ns[cn] = p;
-
-			if (this.onCreate)
-				this.onCreate(s[2], s[3], ns[cn]);
-
-			return;
-		}
-
-		// 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);
-				};
-			}
-			ns[cn].prototype[cn] = ns[cn];
-
-			// Add super methods
-			t.each(sp, function(f, n) {
-				ns[cn].prototype[n] = sp[n];
-			});
-
-			// 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;
-				}
-			});
-		}
-
-		// Add static methods
-		t.each(p['static'], function(f, n) {
-			ns[cn][n] = f;
-		});
-
-		if (this.onCreate)
-			this.onCreate(s[2], s[3], ns[cn].prototype);
-	},
-
-	walk : function(o, f, n, s) {
-		s = s || this;
-
-		if (o) {
-			if (n)
-				o = o[n];
-
-			tinymce.each(o, function(o, i) {
-				if (f.call(s, o, i, n) === false)
-					return false;
-
-				tinymce.walk(o, f, n, s);
-			});
-		}
-	},
-
-	createNS : function(n, o) {
-		var i, v;
-
-		o = o || window;
-
-		n = n.split('.');
-		for (i=0; i<n.length; i++) {
-			v = n[i];
-
-			if (!o[v])
-				o[v] = {};
-
-			o = o[v];
-		}
-
-		return o;
-	},
-
-	resolve : function(n, o) {
-		var i, l;
-
-		o = o || window;
-
-		n = n.split('.');
-		for (i = 0, l = n.length; i < l; i++) {
-			o = o[n[i]];
-
-			if (!o)
-				break;
-		}
-
-		return o;
-	},
-
-	addUnload : function(f, s) {
-		var t = this, w = window;
-
-		f = {func : f, scope : s || this};
-
-		if (!t.unloads) {
-			function unload() {
-				var li = t.unloads, o, n;
-
-				if (li) {
-					// Call unload handlers
-					for (n in li) {
-						o = li[n];
-
-						if (o && o.func)
-							o.func.call(o.scope, 1); // Send in one arg to distinct unload and user destroy
-					}
-
-					// Detach unload function
-					if (w.detachEvent) {
-						w.detachEvent('onbeforeunload', fakeUnload);
-						w.detachEvent('onunload', unload);
-					} else if (w.removeEventListener)
-						w.removeEventListener('unload', unload, false);
-
-					// Destroy references
-					t.unloads = o = li = w = unload = 0;
-
-					// Run garbarge collector on IE
-					if (window.CollectGarbage)
-						window.CollectGarbage();
-				}
-			};
-
-			function fakeUnload() {
-				var d = document;
-
-				// 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);
-				}
-			};
-
-			// Attach unload handler
-			if (w.attachEvent) {
-				w.attachEvent('onunload', unload);
-				w.attachEvent('onbeforeunload', fakeUnload);
-			} else if (w.addEventListener)
-				w.addEventListener('unload', unload, false);
-
-			// Setup initial unload handler array
-			t.unloads = [f];
-		} else
-			t.unloads.push(f);
-
-		return f;
-	},
-
-	removeUnload : function(f) {
-		var u = this.unloads, r = null;
-
-		tinymce.each(u, function(o, i) {
-			if (o && o.func == f) {
-				u.splice(i, 1);
-				r = f;
-				return false;
-			}
-		});
-
-		return r;
-	},
-
-	explode : function(s, d) {
-		return s ? tinymce.map(s.split(d || ','), tinymce.trim) : s;
-	},
-
-	_addVer : function(u) {
-		var v;
-
-		if (!this.query)
-			return u;
-
-		v = (u.indexOf('?') == -1 ? '?' : '&') + this.query;
-
-		if (u.indexOf('#') == -1)
-			return u + v;
-
-		return u.replace('#', v + '#');
-	}
-
-	};
-
-// Required for GZip AJAX loading
-window.tinymce = tinymce;
-
-// Initialize the API
-tinymce._init();
-tinymce.create('tinymce.util.Dispatcher', {
-	scope : null,
-	listeners : null,
-
-	Dispatcher : function(s) {
-		this.scope = s || this;
-		this.listeners = [];
-	},
-
-	add : function(cb, s) {
-		this.listeners.push({cb : cb, scope : s || this.scope});
-
-		return cb;
-	},
-
-	addToTop : function(cb, s) {
-		this.listeners.unshift({cb : cb, scope : s || this.scope});
-
-		return cb;
-	},
-
-	remove : function(cb) {
-		var l = this.listeners, o = null;
-
-		tinymce.each(l, function(c, i) {
-			if (cb == c.cb) {
-				o = cb;
-				l.splice(i, 1);
-				return false;
-			}
-		});
-
-		return o;
-	},
-
-	dispatch : function() {
-		var s, a = arguments, i, li = this.listeners, c;
-
-		// 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);
-
-			if (s === false)
-				break;
-		}
-
-		return s;
-	}
-
-	});
-(function() {
-	var each = tinymce.each;
-
-	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|data):/i.test(u) || /^\s*#/.test(u)) {
-				t.source = u;
-				return;
-			}
-
-			// 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, '@@');
-
-				t[v] = s;
-			});
-
-			if (b = s.base_uri) {
-				if (!t.protocol)
-					t.protocol = b.protocol;
-
-				if (!t.userInfo)
-					t.userInfo = b.userInfo;
-
-				if (!t.port && t.host == 'mce_host')
-					t.port = b.port;
-
-				if (!t.host || t.host == 'mce_host')
-					t.host = b.host;
-
-				t.source = '';
-			}
-
-			//t.path = t.path || '/';
-		},
-
-		setPath : function(p) {
-			var t = this;
-
-			p = /^(.*?)\/?(\w+)?$/.exec(p);
-
-			// Update path parts
-			t.path = p[0];
-			t.directory = p[1];
-			t.file = p[2];
-
-			// Rebuild source
-			t.source = '';
-			t.getURI();
-		},
-
-		toRelative : function(u) {
-			var t = this, o;
-
-			if (u === "./")
-				return u;
-
-			u = new tinymce.util.URI(u, {base_uri : t});
-
-			// 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();
-
-			o = t.toRelPath(t.path, u.path);
-
-			// Add query
-			if (u.query)
-				o += '?' + u.query;
-
-			// Add anchor
-			if (u.anchor)
-				o += '#' + u.anchor;
-
-			return o;
-		},
-	
-		toAbsolute : function(u, nh) {
-			var u = new tinymce.util.URI(u, {base_uri : this});
-
-			return u.getURI(this.host == u.host && this.protocol == u.protocol ? nh : 0);
-		},
-
-		toRelPath : function(base, path) {
-			var items, bp = 0, out = '', i, l;
-
-			// 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;
-					}
-				}
-			}
-
-			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;
-					}
-				}
-			}
-
-			if (bp == 1)
-				return path;
-
-			for (i = 0, l = base.length - (bp - 1); i < l; i++)
-				out += "../";
-
-			for (i = bp - 1, l = items.length; i < l; i++) {
-				if (i != bp - 1)
-					out += "/" + items[i];
-				else
-					out += items[i];
-			}
-
-			return out;
-		},
-
-		toAbsPath : function(base, path) {
-			var i, nb = 0, o = [], tr, outPath;
-
-			// Split paths
-			tr = /\/$/.test(path) ? '/' : '';
-			base = base.split('/');
-			path = path.split('/');
-
-			// Remove empty chunks
-			each(base, function(k) {
-				if (k)
-					o.push(k);
-			});
-
-			base = o;
-
-			// Merge relURLParts chunks
-			for (i = path.length - 1, o = []; i >= 0; i--) {
-				// Ignore empty or .
-				if (path[i].length == 0 || path[i] == ".")
-					continue;
-
-				// Is parent
-				if (path[i] == '..') {
-					nb++;
-					continue;
-				}
-
-				// Move up
-				if (nb > 0) {
-					nb--;
-					continue;
-				}
-
-				o.push(path[i]);
-			}
-
-			i = base.length - nb;
-
-			// If /a/b/c or /
-			if (i <= 0)
-				outPath = o.reverse().join('/');
-			else
-				outPath = base.slice(0, i).join('/') + '/' + o.reverse().join('/');
-
-			// Add front / if it's needed
-			if (outPath.indexOf('/') !== 0)
-				outPath = '/' + outPath;
-
-			// Add traling / if it's needed
-			if (tr && outPath.lastIndexOf('/') !== outPath.length - 1)
-				outPath += tr;
-
-			return outPath;
-		},
-
-		getURI : function(nh) {
-			var s, t = this;
-
-			// Rebuild source
-			if (!t.source || nh) {
-				s = '';
-
-				if (!nh) {
-					if (t.protocol)
-						s += t.protocol + '://';
-
-					if (t.userInfo)
-						s += t.userInfo + '@';
-
-					if (t.host)
-						s += t.host;
-
-					if (t.port)
-						s += ':' + t.port;
-				}
-
-				if (t.path)
-					s += t.path;
-
-				if (t.query)
-					s += '?' + t.query;
-
-				if (t.anchor)
-					s += '#' + t.anchor;
-
-				t.source = s;
-			}
-
-			return t.source;
-		}
-	});
-})();
-(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 = '';
-
-			each(v, function(v, k) {
-				o += (!o ? '' : '&') + escape(k) + '=' + escape(v);
-			});
-
-			this.set(n, o, e, p, d, s);
-		},
-
-		get : function(n) {
-			var c = document.cookie, e, p = n + "=", b;
-
-			// Strict mode
-			if (!c)
-				return;
-
-			b = c.indexOf("; " + p);
-
-			if (b == -1) {
-				b = c.indexOf(p);
-
-				if (b != 0)
-					return null;
-			} else
-				b += 2;
-
-			e = c.indexOf(";", b);
-
-			if (e == -1)
-				e = c.length;
-
-			return unescape(c.substring(b + p.length, e));
-		},
-
-		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" : "");
-		},
-
-		remove : function(n, p) {
-			var d = new Date();
-
-			d.setTime(d.getTime() - 1000);
-
-			this.set(n, '', d, p, d);
-		}
-	});
-})();
-tinymce.create('static tinymce.util.JSON', {
-	serialize : function(o) {
-		var i, v, s = tinymce.util.JSON.serialize, t;
-
-		if (o == null)
-			return 'null';
-
-		t = typeof o;
-
-		if (t == 'string') {
-			v = '\bb\tt\nn\ff\rr\""\'\'\\\\';
-
-			return '"' + o.replace(/([\u0080-\uFFFF\x00-\x1f\"])/g, function(a, b) {
-				i = v.indexOf(b);
-
-				if (i + 1)
-					return '\\' + v.charAt(i + 1);
-
-				a = b.charCodeAt().toString(16);
-
-				return '\\u' + '0000'.substring(a.length) + a;
-			}) + '"';
-		}
-
-		if (t == 'object') {
-			if (o.hasOwnProperty && o instanceof Array) {
-					for (i=0, v = '['; i<o.length; i++)
-						v += (i > 0 ? ',' : '') + s(o[i]);
-
-					return v + ']';
-				}
-
-				v = '{';
-
-				for (i in o)
-					v += typeof o[i] != 'function' ? (v.length > 1 ? ',"' : '"') + i + '":' + s(o[i]) : '';
-
-				return v + '}';
-		}
-
-		return '' + o;
-	},
-
-	parse : function(s) {
-		try {
-			return eval('(' + s + ')');
-		} catch (ex) {
-			// Ignore
-		}
-	}
-
-	});
-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 || '';
-
-		function get(s) {
-			x = 0;
-
-			try {
-				x = new ActiveXObject(s);
-			} catch (ex) {
-			}
-
-			return x;
-		};
-
-		x = w.XMLHttpRequest ? new XMLHttpRequest() : get('Microsoft.XMLHTTP') || get('Msxml2.XMLHTTP');
-
-		if (x) {
-			if (x.overrideMimeType)
-				x.overrideMimeType(o.content_type);
-
-			x.open(o.type || (o.data ? 'POST' : 'GET'), o.url, o.async);
-
-			if (o.content_type)
-				x.setRequestHeader('Content-Type', o.content_type);
-
-			x.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
-
-			x.send(o.data);
-
-			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);
-
-					x = null;
-				} else
-					w.setTimeout(ready, 10);
-			};
-
-			// Syncronous request
-			if (!o.async)
-				return ready();
-
-			// Wait for response, onReadyStateChange can not be used since it leaks memory in IE
-			t = w.setTimeout(ready, 10);
-		}
-	}
-});
-(function() {
-	var extend = tinymce.extend, JSON = tinymce.util.JSON, XHR = tinymce.util.XHR;
-
-	tinymce.create('tinymce.util.JSONRequest', {
-		JSONRequest : function(s) {
-			this.settings = extend({
-			}, s);
-			this.count = 0;
-		},
-
-		send : function(o) {
-			var ecb = o.error, scb = o.success;
-
-			o = extend(this.settings, o);
-
-			o.success = function(c, x) {
-				c = JSON.parse(c);
-
-				if (typeof(c) == 'undefined') {
-					c = {
-						error : 'JSON Parse error.'
-					};
-				}
-
-				if (c.error)
-					ecb.call(o.error_scope || o.scope, c.error, x);
-				else
-					scb.call(o.success_scope || o.scope, c.result);
-			};
-
-			o.error = function(ty, x) {
-				ecb.call(o.error_scope || o.scope, ty, x);
-			};
-
-			o.data = JSON.serialize({
-				id : o.id || 'c' + (this.count++),
-				method : o.method,
-				params : o.params
-			});
-
-			// JSON content type for Ruby on rails. Bug: #1883287
-			o.content_type = 'application/json';
-
-			XHR.send(o);
-		},
-
-		'static' : {
-			sendRPC : function(o) {
-				return new tinymce.util.JSONRequest().send(o);
-			}
-		}
-	});
-}());(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;
-				}
-			}
-
-			tinymce.addUnload(t.destroy, t);
-		},
-
-		getRoot : function() {
-			var t = this, s = t.settings;
-
-			return (s && t.get(s.root_element)) || t.doc.body;
-		},
-
-		getViewPort : function(w) {
-			var d, b;
-
-			w = !w ? this.win : w;
-			d = w.document;
-			b = this.boxModel ? d.documentElement : d.body;
-
-			// 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
-			};
-		},
-
-		getRect : function(e) {
-			var p, t = this, sr;
-
-			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
-			};
-		},
-
-		getSize : function(e) {
-			var t = this, w, h;
-
-			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
-			};
-		},
-
-		getParent : function(n, f, r) {
-			return this.getParents(n, f, r, false);
-		},
-
-		getParents : function(n, f, r, c) {
-			var t = this, na, se = t.settings, o = [];
-
-			n = t.get(n);
-			c = c === undefined;
-
-			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 {
-					f = function(n) {
-						return t.is(n, na);
-					};
-				}
-			}
-
-			while (n) {
-				if (n == r || !n.nodeType || n.nodeType === 9)
-					break;
-
-				if (!f || f(n)) {
-					if (c)
-						o.push(n);
-					else
-						return n;
-				}
-
-				n = n.parentNode;
-			}
-
-			return c ? o : null;
-		},
-
-		get : function(e) {
-			var n;
-
-			if (e && this.doc && typeof(e) == 'string') {
-				n = e;
-				e = this.doc.getElementById(e);
-
-				// 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];
-			}
-
-			return e;
-		},
-
-		getNext : function(node, selector) {
-			return this._findSib(node, selector, 'nextSibling');
-		},
-
-		getPrev : function(node, selector) {
-			return this._findSib(node, selector, 'previousSibling');
-		},
-
-
-		select : function(pa, s) {
-			var t = this;
-
-			return tinymce.dom.Sizzle(pa, t.get(s) || t.get(t.settings.root_element) || t.doc, []);
-		},
-
-		is : function(n, patt) {
-			return tinymce.dom.Sizzle.matches(patt, n.nodeType ? [n] : n).length > 0;
-		},
-
-
-		add : function(p, n, a, h, c) {
-			var t = this;
-
-			return this.run(p, function(p) {
-				var e, k;
-
-				e = is(n, 'string') ? t.doc.createElement(n) : n;
-				t.setAttribs(e, a);
-
-				if (h) {
-					if (h.nodeType)
-						e.appendChild(h);
-					else
-						t.setHTML(e, h);
-				}
-
-				return !c ? p.appendChild(e) : e;
-			});
-		},
-
-		create : function(n, a, h) {
-			return this.add(this.doc.createElement(n), n, a, h, 1);
-		},
-
-		createHTML : function(n, a, h) {
-			var o = '', t = this, k;
-
-			o += '<' + n;
-
-			for (k in a) {
-				if (a.hasOwnProperty(k))
-					o += ' ' + k + '="' + t.encode(a[k]) + '"';
-			}
-
-			if (tinymce.is(h))
-				return o + '>' + h + '</' + n + '>';
-
-			return o + ' />';
-		},
-
-		remove : function(n, k) {
-			var t = this;
-
-			return this.run(n, function(n) {
-				var p, g, i;
-
-				p = n.parentNode;
-
-				if (!p)
-					return null;
-
-				if (k) {
-					for (i = n.childNodes.length - 1; i >= 0; i--)
-						t.insertAfter(n.childNodes[i], n);
-
-					//each(n.childNodes, function(c) {
-					//	p.insertBefore(c.cloneNode(true), n);
-					//});
-				}
-
-				// 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 = '';
-
-					return p;
-				}
-
-				return p.removeChild(n);
-			});
-		},
-
-		setStyle : function(n, na, v) {
-			var t = this;
-
-			return t.run(n, function(e) {
-				var s, i;
-
-				s = e.style;
-
-				// Camelcase it, if needed
-				na = na.replace(/-(\D)/g, function(a, b){
-					return b.toUpperCase();
-				});
-
-				// 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) + ")";
-
-							if (!n.currentStyle || !n.currentStyle.hasLayout)
-								s.display = 'inline-block';
-						}
-
-						// Fix for older browsers
-						s[na] = s['-moz-opacity'] = s['-khtml-opacity'] = v || '';
-						break;
-
-					case 'float':
-						isIE ? s.styleFloat = v : s.cssFloat = v;
-						break;
-					
-					default:
-						s[na] = v || '';
-				}
-
-				// Force update of the style data
-				if (t.settings.update_styles)
-					t.setAttrib(e, 'mce_style');
-			});
-		},
-
-		getStyle : function(n, na, c) {
-			n = this.get(n);
-
-			if (!n)
-				return false;
-
-			// Gecko
-			if (this.doc.defaultView && c) {
-				// Remove camelcase
-				na = na.replace(/[A-Z]/g, function(a){
-					return '-' + a;
-				});
-
-				try {
-					return this.doc.defaultView.getComputedStyle(n, null).getPropertyValue(na);
-				} catch (ex) {
-					// Old safari might fail
-					return null;
-				}
-			}
-
-			// Camelcase it, if needed
-			na = na.replace(/-(\D)/g, function(a, b){
-				return b.toUpperCase();
-			});
-
-			if (na == 'float')
-				na = isIE ? 'styleFloat' : 'cssFloat';
-
-			// IE & Opera
-			if (n.currentStyle && c)
-				return n.currentStyle[na];
-
-			return n.style[na];
-		},
-
-		setStyles : function(e, o) {
-			var t = this, s = t.settings, ol;
-
-			ol = s.update_styles;
-			s.update_styles = 0;
-
-			each(o, function(v, n) {
-				t.setStyle(e, n, v);
-			});
-
-			// Update style info
-			s.update_styles = ol;
-			if (s.update_styles)
-				t.setAttrib(e, s.cssText);
-		},
-
-		setAttrib : function(e, n, v) {
-			var t = this;
-
-			// Whats the point
-			if (!e || !n)
-				return;
-
-			// 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);
-							});
-
-							return;
-						}
-
-						// 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);
-						}
-
-						e.style.cssText = v;
-						break;
-
-					case "class":
-						e.className = v || ''; // Fix IE null bug
-						break;
-
-					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);
-
-							t.setAttrib(e, 'mce_' + n, v, 2);
-						}
-
-						break;
-					
-					case "shape":
-						e.setAttribute('mce_style', v);
-						break;
-				}
-
-				if (is(v) && v !== null && v.length !== 0)
-					e.setAttribute(n, '' + v, 2);
-				else
-					e.removeAttribute(n, 2);
-			});
-		},
-
-		setAttribs : function(e, o) {
-			var t = this;
-
-			return this.run(e, function(e) {
-				each(o, function(v, n) {
-					t.setAttrib(e, n, v);
-				});
-			});
-		},
-
-		getAttrib : function(e, n, dv) {
-			var v, t = this;
-
-			e = t.get(e);
-
-			if (!e || e.nodeType !== 1)
-				return false;
-
-			if (!is(dv))
-				dv = '';
-
-			// Try the mce variant for these
-			if (/^(src|href|style|coords|shape)$/.test(n)) {
-				v = e.getAttribute("mce_" + n);
-
-				if (v)
-					return v;
-			}
-
-			if (isIE && t.props[n]) {
-				v = e[t.props[n]];
-				v = v && v.nodeValue ? v.nodeValue : v;
-			}
-
-			if (!v)
-				v = e.getAttribute(n, 2);
-
-			// Check boolean attribs
-			if (/^(checked|compact|declare|defer|disabled|ismap|multiple|nohref|noshade|nowrap|readonly|selected)$/.test(n)) {
-				if (e[t.props[n]] === true && v === '')
-					return n;
-
-				return v ? n : '';
-			}
-
-			// Inner input elements will override attributes on form elements
-			if (e.nodeName === "FORM" && e.getAttributeNode(n))
-				return e.getAttributeNode(n).nodeValue;
-
-			if (n === 'style') {
-				v = v || e.style.cssText;
-
-				if (v) {
-					v = t.serializeStyle(t.parseStyle(v));
-
-					if (t.settings.keep_values && !t._isRes(v))
-						e.setAttribute('mce_style', v);
-				}
-			}
-
-			// Remove Apple and WebKit stuff
-			if (isWebKit && n === "class" && v)
-				v = v.replace(/(apple|webkit)\-[a-z\-]+/gi, '');
-
-			// Handle IE issues
-			if (isIE) {
-				switch (n) {
-					case 'rowspan':
-					case 'colspan':
-						// IE returns 1 as default value
-						if (v === 1)
-							v = '';
-
-						break;
-
-					case 'size':
-						// IE returns +0 as default value for size
-						if (v === '+0' || v === 20 || v === 0)
-							v = '';
-
-						break;
-
-					case 'width':
-					case 'height':
-					case 'vspace':
-					case 'checked':
-					case 'disabled':
-					case 'readonly':
-						if (v === 0)
-							v = '';
-
-						break;
-
-					case 'hspace':
-						// IE returns -1 as default value
-						if (v === -1)
-							v = '';
-
-						break;
-
-					case 'maxlength':
-					case 'tabindex':
-						// IE returns default value
-						if (v === 32768 || v === 2147483647 || v === '32768')
-							v = '';
-
-						break;
-
-					case 'multiple':
-					case 'compact':
-					case 'noshade':
-					case 'nowrap':
-						if (v === 65535)
-							return n;
-
-						return dv;
-
-					case 'shape':
-						v = v.toLowerCase();
-						break;
-
-					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');
-				}
-			}
-
-			return (v !== undefined && v !== null && v !== '') ? '' + v : dv;
-		},
-
-		getPos : function(n, ro) {
-			var t = this, x = 0, y = 0, e, d = t.doc, r;
-
-			n = t.get(n);
-			ro = ro || d.body;
-
-			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
-
-					return {x : n.left + e.scrollLeft - x, y : n.top + e.scrollTop - x};
-				}
-
-				r = n;
-				while (r && r != ro && r.nodeType) {
-					x += r.offsetLeft || 0;
-					y += r.offsetTop || 0;
-					r = r.offsetParent;
-				}
-
-				r = n.parentNode;
-				while (r && r != ro && r.nodeType) {
-					x -= r.scrollLeft || 0;
-					y -= r.scrollTop || 0;
-					r = r.parentNode;
-				}
-			}
-
-			return {x : x, y : y};
-		},
-
-		parseStyle : function(st) {
-			var t = this, s = t.settings, o = {};
-
-			if (!st)
-				return o;
-
-			function compress(p, s, ot) {
-				var t, r, b, l;
-
-				// Get values and check it it needs compressing
-				t = o[p + '-top' + s];
-				if (!t)
-					return;
-
-				r = o[p + '-right' + s];
-				if (t != r)
-					return;
-
-				b = o[p + '-bottom' + s];
-				if (r != b)
-					return;
-
-				l = o[p + '-left' + s];
-				if (b != l)
-					return;
-
-				// Compress
-				o[ot] = l;
-				delete o[p + '-top' + s];
-				delete o[p + '-right' + s];
-				delete o[p + '-bottom' + s];
-				delete o[p + '-left' + s];
-			};
-
-			function compress2(ta, a, b, c) {
-				var t;
-
-				t = o[a];
-				if (!t)
-					return;
-
-				t = o[b];
-				if (!t)
-					return;
-
-				t = o[c];
-				if (!t)
-					return;
-
-				// Compress
-				o[ta] = o[a] + ' ' + o[b] + ' ' + o[c];
-				delete o[a];
-				delete o[b];
-				delete o[c];
-			};
-
-			st = st.replace(/&(#?[a-z0-9]+);/g, '&$1_MCE_SEMI_'); // Protect entities
-
-			each(st.split(';'), function(v) {
-				var sv, ur = [];
-
-				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];});
-
-					sv = sv.replace(/rgb\([^\)]+\)/g, function(v) {
-						return t.toHex(v);
-					});
-
-					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;
-				}
-			});
-
-			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;
-
-					switch (k) {
-						case 'color':
-						case 'background-color':
-							v = v.toLowerCase();
-							break;
-					}
-
-					s += (s ? ' ' : '') + k + ': ' + v + ';';
-				}
-			});
-
-			return s;
-		},
-
-		loadCSS : function(u) {
-			var t = this, d = t.doc, head;
-
-			if (!u)
-				u = '';
-
-			head = t.select('head')[0];
-
-			each(u.split(','), function(u) {
-				var link;
-
-				if (t.files[u])
-					return;
-
-				t.files[u] = true;
-				link = t.create('link', {rel : 'stylesheet', href : tinymce._addVer(u)});
-
-				// 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;
-					};
-				}
-
-				head.appendChild(link);
-			});
-		},
-
-		addClass : function(e, c) {
-			return this.run(e, function(e) {
-				var o;
-
-				if (!c)
-					return 0;
-
-				if (this.hasClass(e, c))
-					return e.className;
-
-				o = this.removeClass(e, c);
-
-				return e.className = (o != '' ? (o + ' ') : '') + c;
-			});
-		},
-
-		removeClass : function(e, c) {
-			var t = this, re;
-
-			return t.run(e, function(e) {
-				var v;
-
-				if (t.hasClass(e, c)) {
-					if (!re)
-						re = new RegExp("(^|\\s+)" + c + "(\\s+|$)", "g");
-
-					v = e.className.replace(re, ' ');
-
-					return e.className = tinymce.trim(v != ' ' ? v : '');
-				}
-
-				return e.className;
-			});
-		},
-
-		hasClass : function(n, c) {
-			n = this.get(n);
-
-			if (!n || !c)
-				return false;
-
-			return (' ' + n.className + ' ').indexOf(' ' + c + ' ') !== -1;
-		},
-
-		show : function(e) {
-			return this.setStyle(e, 'display', 'block');
-		},
-
-		hide : function(e) {
-			return this.setStyle(e, 'display', 'none');
-		},
-
-		isHidden : function(e) {
-			e = this.get(e);
-
-			return !e || e.style.display == 'none' || this.getStyle(e, 'display') == 'none';
-		},
-
-		uniqueId : function(p) {
-			return (!p ? 'mce_' : p) + (this.counter++);
-		},
-
-		setHTML : function(e, h) {
-			var t = this;
-
-			return this.run(e, function(e) {
-				var x, i, nl, n, p, x;
-
-				h = t.processHTML(h);
-
-				if (isIE) {
-					function set() {
-						try {
-							// 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);
-							});
-						}
-					};
-
-					// 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;
-								}
-
-								n.removeAttribute('mce_keep');
-							}
-						}
-					}
-
-					// 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>/ig, '<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));
-
-									// Replace div with new paragraph
-									n.swapNode(p);
-								}
-							}
-						}
-					}
-				} else
-					e.innerHTML = h;
-
-				return h;
-			});
-		},
-
-		processHTML : function(h) {
-			var t = this, s = t.settings, codeBlocks = [];
-
-			if (!s.process_html)
-				return h;
-
-			// 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/i.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>/gi, function(v, attribs, text) {
-						// Force type attribute
-						if (!attribs)
-							attribs = ' type="text/javascript"';
-
-						// Convert the src attribute of the scripts
-						attribs = attribs.replace(/src=\"([^\"]+)\"?/i, 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)) {
-							codeBlocks.push(trim(text));
-							text = '<!--\nMCE_SCRIPT:' + (codeBlocks.length - 1) + '\n// -->';
-						}
-
-						return '<mce:script' + attribs + '>' + text + '</mce:script>';
-					});
-
-					// Wrap style elements
-					h = h.replace(/<style([^>]+|)>([\s\S]*?)<\/style>/gi, function(v, attribs, text) {
-						// Wrap text contents
-						if (text) {
-							codeBlocks.push(trim(text));
-							text = '<!--\nMCE_SCRIPT:' + (codeBlocks.length - 1) + '\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]]-->');
-
-				// Remove false bool attributes and force attributes into xhtml style attr="attr"
-				h = h.replace(/<([\w:]+) [^>]*(checked|compact|declare|defer|disabled|ismap|multiple|nohref|noshade|nowrap|readonly|selected)[^>]*>/gi, function(val) {
-					function handle(val, name, value) {
-						// Remove false/0 attribs
-						if (value === 'false' || value === '0')
-							return '';
-
-						return ' ' + name + '="' + name + '"';
-					};
-
-					val = val.replace(/ (checked|compact|declare|defer|disabled|ismap|multiple|nohref|noshade|nowrap|readonly|selected)=[\"]([^\"]+)[\"]/gi, handle); // W3C
-					val = val.replace(/ (checked|compact|declare|defer|disabled|ismap|multiple|nohref|noshade|nowrap|readonly|selected)=[\']([^\']+)[\']/gi, handle); // W3C
-					val = val.replace(/ (checked|compact|declare|defer|disabled|ismap|multiple|nohref|noshade|nowrap|readonly|selected)=([^\s\"\'>]+)/gi, handle); // IE
-					val = val.replace(/ (checked|compact|declare|defer|disabled|ismap|multiple|nohref|noshade|nowrap|readonly|selected)([\s>])/gi, ' $1="$1"$2'); // Force attr="attr"
-
-					return val;
-				});
-
-				// 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;
-
-							// Parse and serialize the style to convert for example uppercase styles like "BORDER: 1px"
-							u = t.encode(t.serializeStyle(t.parseStyle(u)));
-						} 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));
-						}
-
-						return ' ' + b + '="' + c + '" mce_' + b + '="' + u + '"';
-					};
-
-					a = a.replace(/ (src|href|style|coords|shape)=[\"]([^\"]+)[\"]/gi, handle); // W3C
-					a = a.replace(/ (src|href|style|coords|shape)=[\']([^\']+)[\']/gi, handle); // W3C
-
-					return a.replace(/ (src|href|style|coords|shape)=([^\s\"\'>]+)/gi, handle); // IE
-				});
-
-				// Restore script blocks
-				h = h.replace(/MCE_SCRIPT:([0-9]+)/g, function(val, idx) {
-					return codeBlocks[idx];
-				});
-			}
-
-			return h;
-		},
-
-		getOuterHTML : function(e) {
-			var d;
-
-			e = this.get(e);
-
-			if (!e)
-				return null;
-
-			if (e.outerHTML !== undefined)
-				return e.outerHTML;
-
-			d = (e.ownerDocument || this.doc).createElement("body");
-			d.appendChild(e.cloneNode(true));
-
-			return d.innerHTML;
-		},
-
-		setOuterHTML : function(e, h, d) {
-			var t = this;
-
-			function setHTML(e, h, d) {
-				var n, tp;
-				
-				tp = d.createElement("body");
-				tp.innerHTML = h;
-
-				n = tp.lastChild;
-				while (n) {
-					t.insertAfter(n.cloneNode(true), e);
-					n = n.previousSibling;
-				}
-
-				t.remove(e);
-			};
-
-			return this.run(e, function(e) {
-				e = t.get(e);
-
-				// Only set HTML on elements
-				if (e.nodeType == 1) {
-					d = d || e.ownerDocument || t.doc;
-
-					if (isIE) {
-						try {
-							// Try outerHTML for IE it sometimes produces an unknown runtime error
-							if (isIE && e.nodeType == 1)
-								e.outerHTML = h;
-							else
-								setHTML(e, h, d);
-						} catch (ex) {
-							// Fix for unknown runtime error
-							setHTML(e, h, d);
-						}
-					} else
-						setHTML(e, h, d);
-				}
-			});
-		},
-
-		decode : function(s) {
-			var e, n, v;
-
-			// 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 = '';
-
-				if (n) {
-					do {
-						v += n.nodeValue;
-					} while (n.nextSibling);
-				}
-
-				return v || s;
-			}
-
-			return s;
-		},
-
-		encode : function(s) {
-			return s ? ('' + s).replace(/[<>&\"]/g, function (c, b) {
-				switch (c) {
-					case '&':
-						return '&amp;';
-
-					case '"':
-						return '&quot;';
-
-					case '<':
-						return '&lt;';
-
-					case '>':
-						return '&gt;';
-				}
-
-				return c;
-			}) : s;
-		},
-
-		insertAfter : function(n, r) {
-			var t = this;
-
-			r = t.get(r);
-
-			return this.run(n, function(n) {
-				var p, ns;
-
-				p = r.parentNode;
-				ns = r.nextSibling;
-
-				if (ns)
-					p.insertBefore(n, ns);
-				else
-					p.appendChild(n);
-
-				return n;
-			});
-		},
-
-		isBlock : function(n) {
-			if (n.nodeType && n.nodeType !== 1)
-				return false;
-
-			n = n.nodeName || n;
-
-			return /^(H[1-6]|HR|P|DIV|ADDRESS|PRE|FORM|TABLE|LI|OL|UL|TH|TBODY|TR|TD|CAPTION|BLOCKQUOTE|CENTER|DL|DT|DD|DIR|FIELDSET|NOSCRIPT|NOFRAMES|MENU|ISINDEX|SAMP)$/.test(n);
-		},
-
-		replace : function(n, o, k) {
-			var t = this;
-
-			if (is(o, 'array'))
-				n = n.cloneNode(true);
-
-			return t.run(o, function(o) {
-				if (k) {
-					each(o.childNodes, function(c) {
-						n.appendChild(c.cloneNode(true));
-					});
-				}
-
-				// 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;
-				}
-
-				return o.parentNode.replaceChild(n, o);
-			});
-		},
-
-		findCommonAncestor : function(a, b) {
-			var ps = a, pe;
-
-			while (ps) {
-				pe = b;
-
-				while (pe && ps != pe)
-					pe = pe.parentNode;
-
-				if (ps == pe)
-					break;
-
-				ps = ps.parentNode;
-			}
-
-			if (!ps && a.ownerDocument)
-				return a.ownerDocument.documentElement;
-
-			return ps;
-		},
-
-		toHex : function(s) {
-			var c = /^\s*rgb\s*?\(\s*?([0-9]+)\s*?,\s*?([0-9]+)\s*?,\s*?([0-9]+)\s*?\)\s*$/i.exec(s);
-
-			function hex(s) {
-				s = parseInt(s).toString(16);
-
-				return s.length > 1 ? s : '0' + s; // 0 -> 00
-			};
-
-			if (c) {
-				s = '#' + hex(c[1]) + hex(c[2]) + hex(c[3]);
-
-				return s;
-			}
-
-			return s;
-		},
-
-		getClasses : function() {
-			var t = this, cl = [], i, lo = {}, f = t.settings.class_filter, ov;
-
-			if (t.classes)
-				return t.classes;
-
-			function addClasses(s) {
-				// IE style imports
-				each(s.imports, function(r) {
-					addClasses(r);
-				});
-
-				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;
-
-						// Import
-						case 3:
-							addClasses(r.styleSheet);
-							break;
-					}
-				});
-			};
-
-			try {
-				each(t.doc.styleSheets, addClasses);
-			} catch (ex) {
-				// Ignore
-			}
-
-			if (cl.length > 0)
-				t.classes = cl;
-
-			return cl;
-		},
-
-		run : function(e, f, s) {
-			var t = this, o;
-
-			if (t.doc && typeof(e) === 'string')
-				e = t.get(e);
-
-			if (!e)
-				return false;
-
-			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);
-
-						o.push(f.call(s, e, i));
-					}
-				});
-
-				return o;
-			}
-
-			return f.call(s, e);
-		},
-
-		getAttribs : function(n) {
-			var o;
-
-			n = this.get(n);
-
-			if (!n)
-				return [];
-
-			if (isIE) {
-				o = [];
-
-				// Object will throw exception in IE
-				if (n.nodeName == 'OBJECT')
-					return n.attributes;
-
-				// IE doesn't keep the selected attribute if you clone option elements
-				if (n.nodeName === 'OPTION' && this.getAttrib(n, 'selected'))
-					o.push({specified : 1, nodeName : 'selected'});
-
-				// 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(/<\/?[\w:]+ ?|=[\"][^\"]+\"|=\'[^\']+\'|=\w+|>/gi, '').replace(/[\w:]+/gi, function(a) {
-					o.push({specified : 1, nodeName : a});
-				});
-
-				return o;
-			}
-
-			return n.attributes;
-		},
-
-		destroy : function(s) {
-			var t = this;
-
-			if (t.events)
-				t.events.destroy();
-
-			t.win = t.doc = t.root = t.events = null;
-
-			// Manual destroy then remove unload handler
-			if (!s)
-				tinymce.removeUnload(t.destroy);
-		},
-
-		createRng : function() {
-			var d = this.doc;
-
-			return d.createRange ? d.createRange() : new tinymce.dom.Range(this);
-		},
-
-		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];
-
-				if (n && n[na] && n[na].nodeType == 1 && isEmpty(n[na]))
-					t.remove(n[na]);
-			};
-
-			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
-
-				return n.replace(/[ \t\r\n]+|&nbsp;|&#160;/g, '') == '';
-			};
-
-			// Added until Gecko can create real HTML documents using implementation.createHTMLDocument
-			// this is to future proof it if Gecko decides to implement the error checking for range methods.
-			function nodeIndex(n) {
-				var i = 0;
-
-				while (n.previousSibling) {
-					i++;
-					n = n.previousSibling;
-				}
-
-				return i;
-			};
-
-			if (pe && e) {
-				// Get before chunk
-				r.setStart(pe.parentNode, nodeIndex(pe));
-				r.setEnd(e.parentNode, nodeIndex(e));
-				bef = r.extractContents();
-
-				// Get after chunk
-				r = t.createRng();
-				r.setStart(e.parentNode, nodeIndex(e) + 1);
-				r.setEnd(pe.parentNode, nodeIndex(pe) + 1);
-				aft = r.extractContents();
-
-				// Insert chunks and remove parent
-				pa = pe.parentNode;
-
-				// Remove right side edge of the before contents
-				trimEdge(bef, 'lastChild');
-
-				if (!isEmpty(bef))
-					pa.insertBefore(bef, pe);
-
-				if (re)
-					pa.replaceChild(re, e);
-				else
-					pa.insertBefore(e, pe);
-
-				// Remove left site edge of the after contents
-				trimEdge(aft, 'firstChild');
-
-				if (!isEmpty(aft))
-					pa.insertBefore(aft, pe);
-
-				t.remove(pe);
-
-				return re || e;
-			}
-		},
-
-		bind : function(target, name, func, scope) {
-			var t = this;
-
-			if (!t.events)
-				t.events = new tinymce.dom.EventUtils();
-
-			return t.events.add(target, name, func, scope || this);
-		},
-
-		unbind : function(target, name, func) {
-			var t = this;
-
-			if (!t.events)
-				t.events = new tinymce.dom.EventUtils();
-
-			return t.events.remove(target, name, func);
-		},
-
-
-		_findSib : function(node, selector, name) {
-			var t = this, f = selector;
-
-			if (node) {
-				// If expression make a function of it using is
-				if (is(f, 'string')) {
-					f = function(node) {
-						return t.is(node, selector);
-					};
-				}
-
-				// Loop all siblings
-				for (node = node[name]; node; node = node[name]) {
-					if (f(node))
-						return node;
-				}
-			}
-
-			return null;
-		},
-
-		_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);
-		}
-
-		/*
-		walk : function(n, f, s) {
-			var d = this.doc, w;
-
-			if (d.createTreeWalker) {
-				w = d.createTreeWalker(n, NodeFilter.SHOW_TEXT, null, false);
-
-				while ((n = w.nextNode()) != null)
-					f.call(s || this, n);
-			} else
-				tinymce.walk(n, f, 'childNodes', s);
-		}
-		*/
-
-		/*
-		toRGB : function(s) {
-			var c = /^\s*?#([0-9A-F]{2})([0-9A-F]{1,2})([0-9A-F]{2})?\s*?$/.exec(s);
-
-			if (c) {
-				// #FFF -> #FFFFFF
-				if (!is(c[3]))
-					c[3] = c[2] = c[1];
-
-				return "rgb(" + parseInt(c[1], 16) + "," + parseInt(c[2], 16) + "," + parseInt(c[3], 16) + ")";
-			}
-
-			return s;
-		}
-		*/
-	});
-
-	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;
-
-		if (child.parentNode != parent)
-			return -1;
-
-		for (node = parent.firstChild, i = 0; node != child; node = node.nextSibling)
-			i++;
-
-		return i;
-	};
-
-	function nodeIndex(n) {
-		var i = 0;
-
-		while (n.previousSibling) {
-			i++;
-			n = n.previousSibling;
-		}
-
-		return i;
-	};
-
-	function getSelectedNode(container, offset) {
-		var child;
-
-		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;
-		}
-
-		if (child != null)
-			return child;
-
-		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
-		});
-	};
-
-	// 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;
-			}
-
-			t.collapsed = true;
-		},
-
-		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
-			});
-		},
-
-/*
-		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
-				}
-			}
-
-			// 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;
-
-				while (n != c && offsetC < offsetA) {
-					offsetC++;
-					n = n.nextSibling;
-				}
-
-				if (offsetA <= offsetC) {
-					return -1; // before
-				} else {
-					return 1; // after
-				}
-			}
-
-			// 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;
-			}
-
-			if (c) {
-				offsetC = 0;
-				n = containerB.firstChild;
-
-				while (n != c && offsetC < offsetB) {
-					offsetC++;
-					n = n.nextSibling;
-				}
-
-				if (offsetC < offsetB) {
-					return -1; // before
-				} else {
-					return 1; // after
-				}
-			}
-
-			// 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;
-
-			while (childA && childA.parentNode != cmnRoot) {
-				childA = childA.parentNode;  
-			}
-
-			if (!childA) {
-				childA = cmnRoot;
-			}
-
-			childB = containerB;
-			while (childB && childB.parentNode != cmnRoot) {
-				childB = childB.parentNode;
-			}
-
-			if (!childB) {
-				childB = cmnRoot;
-			}
-
-			if (childA == childB) {
-				return 0; // equal
-			}
-
-			n = cmnRoot.firstChild;
-			while (n) {
-				if (n == childA) {
-					return -1; // before
-				}
-
-				if (n == childB) {
-					return 1; // after
-				}
-
-				n = n.nextSibling;
-			}
-		},
-
-		_setEndPoint : function(st, n, o) {
-			var t = this, ec, sc;
-
-			if (st) {
-				t.startContainer = n;
-				t.startOffset = o;
-			} else {
-				t.endContainer = n;
-				t.endOffset = o;
-			}
-
-			// 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;
-
-			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);
-			}
-
-			t.collapsed = t._isCollapsed();
-			t.commonAncestorContainer = t.dom.findCommonAncestor(t.startContainer, t.endContainer);
-		},
-
-		// This code is heavily "inspired" by the Apache Xerces implementation. I hope they don't mind. :)
-
-		_traverse : function(how) {
-			var t = this, c, endContainerDepth = 0, startContainerDepth = 0, p, depthDiff, startNode, endNode, sp, ep;
-
-			if (t.startContainer == t.endContainer)
-				return t._traverseSameContainer(how);
-
-			for (c = t.endContainer, p = c.parentNode; p != null; c = p, p = p.parentNode) {
-				if (p == t.startContainer)
-					return t._traverseCommonStartContainer(c, how);
-
-				++endContainerDepth;
-			}
-
-			for (c = t.startContainer, p = c.parentNode; p != null; c = p, p = p.parentNode) {
-				if (p == t.endContainer)
-					return t._traverseCommonEndContainer(c, how);
-
-				++startContainerDepth;
-			}
-
-			depthDiff = startContainerDepth - endContainerDepth;
-
-			startNode = t.startContainer;
-			while (depthDiff > 0) {
-				startNode = startNode.parentNode;
-				depthDiff--;
-			}
-
-			endNode = t.endContainer;
-			while (depthDiff < 0) {
-				endNode = endNode.parentNode;
-				depthDiff++;
-			}
-
-			// 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;
-			}
-
-			return t._traverseCommonAncestors(startNode, endNode, how);
-		},
-
-		_traverseSameContainer : function(how) {
-			var t = this, frag, s, sub, n, cnt, sibling, xferNode;
-
-			if (how != DELETE)
-				frag = t.dom.doc.createDocumentFragment();
-
-			// If selection is empty, just return the fragment
-			if (t.startOffset == t.endOffset)
-				return frag;
-
-			// 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);
-
-				// set the original text node to its new value
-				if (how != CLONE) {
-					t.startContainer.deleteData(t.startOffset, t.endOffset - t.startOffset);
-
-					// Nothing is partially selected, so collapse to start point
-					t.collapse(true);
-				}
-
-				if (how == DELETE)
-					return null;
-
-				frag.appendChild(t.dom.doc.createTextNode(sub));
-				return frag;
-			}
-
-			// Copy nodes between the start/end offsets.
-			n = getSelectedNode(t.startContainer, t.startOffset);
-			cnt = t.endOffset - t.startOffset;
-
-			while (cnt > 0) {
-				sibling = n.nextSibling;
-				xferNode = t._traverseFullySelected(n, how);
-
-				if (frag)
-					frag.appendChild( xferNode );
-
-				--cnt;
-				n = sibling;
-			}
-
-			// Nothing is partially selected, so collapse to start point
-			if (how != CLONE)
-				t.collapse(true);
-
-			return frag;
-		},
-
-		_traverseCommonStartContainer : function(endAncestor, how) {
-			var t = this, frag, n, endIdx, cnt, sibling, xferNode;
-
-			if (how != DELETE)
-				frag = t.dom.doc.createDocumentFragment();
-
-			n = t._traverseRightBoundary(endAncestor, how);
-
-			if (frag)
-				frag.appendChild(n);
-
-			endIdx = indexOf(endAncestor, t.startContainer);
-			cnt = endIdx - t.startOffset;
-
-			if (cnt <= 0) {
-				// Collapse to just before the endAncestor, which 
-				// is partially selected.
-				if (how != CLONE) {
-					t.setEndBefore(endAncestor);
-					t.collapse(false);
-				}
-
-				return frag;
-			}
-
-			n = endAncestor.previousSibling;
-			while (cnt > 0) {
-				sibling = n.previousSibling;
-				xferNode = t._traverseFullySelected(n, how);
-
-				if (frag)
-					frag.insertBefore(xferNode, frag.firstChild);
-
-				--cnt;
-				n = sibling;
-			}
-
-			// Collapse to just before the endAncestor, which 
-			// is partially selected.
-			if (how != CLONE) {
-				t.setEndBefore(endAncestor);
-				t.collapse(false);
-			}
-
-			return frag;
-		},
-
-		_traverseCommonEndContainer : function(startAncestor, how) {
-			var t = this, frag, startIdx, n, cnt, sibling, xferNode;
-
-			if (how != DELETE)
-				frag = t.dom.doc.createDocumentFragment();
-
-			n = t._traverseLeftBoundary(startAncestor, how);
-			if (frag)
-				frag.appendChild(n);
-
-			startIdx = indexOf(startAncestor, t.endContainer);
-			++startIdx;  // Because we already traversed it....
-
-			cnt = t.endOffset - startIdx;
-			n = startAncestor.nextSibling;
-			while (cnt > 0) {
-				sibling = n.nextSibling;
-				xferNode = t._traverseFullySelected(n, how);
-
-				if (frag)
-					frag.appendChild(xferNode);
-
-				--cnt;
-				n = sibling;
-			}
-
-			if (how != CLONE) {
-				t.setStartAfter(startAncestor);
-				t.collapse(true);
-			}
-
-			return frag;
-		},
-
-		_traverseCommonAncestors : function(startAncestor, endAncestor, how) {
-			var t = this, n, frag, commonParent, startOffset, endOffset, cnt, sibling, nextSibling;
-
-			if (how != DELETE)
-				frag = t.dom.doc.createDocumentFragment();
-
-			n = t._traverseLeftBoundary(startAncestor, how);
-			if (frag)
-				frag.appendChild(n);
-
-			commonParent = startAncestor.parentNode;
-			startOffset = indexOf(startAncestor, commonParent);
-			endOffset = indexOf(endAncestor, commonParent);
-			++startOffset;
-
-			cnt = endOffset - startOffset;
-			sibling = startAncestor.nextSibling;
-
-			while (cnt > 0) {
-				nextSibling = sibling.nextSibling;
-				n = t._traverseFullySelected(sibling, how);
-
-				if (frag)
-					frag.appendChild(n);
-
-				sibling = nextSibling;
-				--cnt;
-			}
-
-			n = t._traverseRightBoundary(endAncestor, how);
-
-			if (frag)
-				frag.appendChild(n);
-
-			if (how != CLONE) {
-				t.setStartAfter(startAncestor);
-				t.collapse(true);
-			}
-
-			return frag;
-		},
-
-		_traverseRightBoundary : function(root, how) {
-			var t = this, next = getSelectedNode(t.endContainer, t.endOffset - 1), parent, clonedParent, prevSibling, clonedChild, clonedGrandParent;
-			var isFullySelected = next != t.endContainer;
-
-			if (next == root)
-				return t._traverseNode(next, isFullySelected, false, how);
-
-			parent = next.parentNode;
-			clonedParent = t._traverseNode(parent, false, false, how);
-
-			while (parent != null) {
-				while (next != null) {
-					prevSibling = next.previousSibling;
-					clonedChild = t._traverseNode(next, isFullySelected, false, how);
-
-					if (how != DELETE)
-						clonedParent.insertBefore(clonedChild, clonedParent.firstChild);
-
-					isFullySelected = true;
-					next = prevSibling;
-				}
-
-				if (parent == root)
-					return clonedParent;
-
-				next = parent.previousSibling;
-				parent = parent.parentNode;
-
-				clonedGrandParent = t._traverseNode(parent, false, false, how);
-
-				if (how != DELETE)
-					clonedGrandParent.appendChild(clonedParent);
-
-				clonedParent = clonedGrandParent;
-			}
-
-			// should never occur
-			return null;
-		},
-
-		_traverseLeftBoundary : function(root, how) {
-			var t = this, next = getSelectedNode(t.startContainer, t.startOffset);
-			var isFullySelected = next != t.startContainer, parent, clonedParent, nextSibling, clonedChild, clonedGrandParent;
-
-			if (next == root)
-				return t._traverseNode(next, isFullySelected, true, how);
-
-			parent = next.parentNode;
-			clonedParent = t._traverseNode(parent, false, true, how);
-
-			while (parent != null) {
-				while (next != null) {
-					nextSibling = next.nextSibling;
-					clonedChild = t._traverseNode(next, isFullySelected, true, how);
-
-					if (how != DELETE)
-						clonedParent.appendChild(clonedChild);
-
-					isFullySelected = true;
-					next = nextSibling;
-				}
-
-				if (parent == root)
-					return clonedParent;
-
-				next = parent.nextSibling;
-				parent = parent.parentNode;
-
-				clonedGrandParent = t._traverseNode(parent, false, true, how);
-
-				if (how != DELETE)
-					clonedGrandParent.appendChild(clonedParent);
-
-				clonedParent = clonedGrandParent;
-			}
-
-			// should never occur
-			return null;
-		},
-
-		_traverseNode : function(n, isFullySelected, isLeft, how) {
-			var t = this, txtValue, newNodeValue, oldNodeValue, offset, newNode;
-
-			if (isFullySelected)
-				return t._traverseFullySelected(n, how);
-
-			if (n.nodeType == 3 /* TEXT_NODE */) {
-				txtValue = n.nodeValue;
-
-				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);
-				}
-
-				if (how != CLONE)
-					n.nodeValue = oldNodeValue;
-
-				if (how == DELETE)
-					return null;
-
-				newNode = n.cloneNode(false);
-				newNode.nodeValue = newNodeValue;
-
-				return newNode;
-			}
-
-			if (how == DELETE)
-				return null;
-
-			return n.cloneNode(false);
-		},
-
-		_traverseFullySelected : function(n, how) {
-			var t = this;
-
-			if (how != DELETE)
-				return how == CLONE ? n.cloneNode(true) : n;
-
-			n.parentNode.removeChild(n);
-			return null;
-		}
-	});
-
-	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;
-			}
-
-			return 0;
-		};
-
-		function getRange() {
-			var dom = selection.dom, ieRange = selection.getRng(), domRange = dom.createRng(), startPos, endPos, element, sc, ec, collapsed;
-
-			function findIndex(element) {
-				var nl = element.parentNode.childNodes, i;
-
-				for (i = nl.length - 1; i >= 0; i--) {
-					if (nl[i] == element)
-						return i;
-				}
-
-				return -1;
-			};
-
-			function findEndPoint(start) {
-				var rng = ieRange.duplicate(), parent, i, nl, n, offset = 0, index = 0, pos, tmpRng;
-
-				// 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;
-						}
-
-						offset += n.nodeValue.length;
-					} else
-						offset = 0;
-				}
-
-				// Remove marker character
-				rng.moveStart('character', -1);
-				rng.text = '';
-
-				return {index : index, offset : offset, parent : parent};
-			};
-
-			// 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;
-
-			// 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);
-
-				return domRange;
-			}
-
-			// Check collapsed state
-			collapsed = selection.isCollapsed();
-
-			// Find start and end pos index and offset
-			startPos = findEndPoint(true);
-			endPos = findEndPoint(false);
-
-			// Normalize the elements to avoid fragmented dom
-			startPos.parent.normalize();
-			endPos.parent.normalize();
-
-			// Set start container and offset
-			sc = startPos.parent.childNodes[Math.min(startPos.index, startPos.parent.childNodes.length - 1)];
-
-			if (sc.nodeType != 3)
-				domRange.setStart(startPos.parent, startPos.index);
-			else
-				domRange.setStart(startPos.parent.childNodes[startPos.index], startPos.offset);
-
-			// Set end container and offset
-			ec = endPos.parent.childNodes[Math.min(endPos.index, endPos.parent.childNodes.length - 1)];
-
-			if (ec.nodeType != 3) {
-				if (!collapsed)
-					endPos.index++;
-
-				domRange.setEnd(endPos.parent, endPos.index);
-			} else
-				domRange.setEnd(endPos.parent.childNodes[endPos.index], endPos.offset);
-
-			// 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));
-
-				ec = domRange.endContainer;
-				if (ec.nodeType == 1)
-					domRange.setEnd(ec, Math.min(domRange.endOffset, ec.childNodes.length));
-			}
-
-			// Restore selection to new range
-			t.addRange(domRange);
-
-			return domRange;
-		};
-
-		this.addRange = function(rng) {
-			var ieRng, body = selection.dom.doc.body, startPos, endPos, sc, so, ec, eo;
-
-			// 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();
-
-					// Padd empty elements with invisible character
-					if (!sc.hasChildNodes() && sc.canHaveHTML)
-						sc.innerHTML = invisibleChar;
-
-					// Select element contents
-					ieRng.moveToElementText(sc);
-
-					// If it's only containing a padding remove it so the caret remains
-					if (sc.innerHTML == invisibleChar) {
-						ieRng.collapse(true);
-						sc.removeChild(sc.firstChild);
-					}
-				}
-
-				if (so == eo)
-					ieRng.collapse(eo <= rng.endContainer.childNodes.length - 1);
-
-				ieRng.select();
-
-				return;
-			}
-
-			function getCharPos(container, offset) {
-				var nodeVal, rng, pos;
-
-				if (container.nodeType != 3)
-					return -1;
-
-				nodeVal = container.nodeValue;
-				rng = body.createTextRange();
-
-				// Insert marker at offset position
-				container.nodeValue = nodeVal.substring(0, offset) + invisibleChar + nodeVal.substring(offset);
-
-				// 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;
-
-				return pos;
-			};
-
-			// Collapsed range
-			if (rng.collapsed) {
-				pos = getCharPos(sc, so);
-
-				ieRng = body.createTextRange();
-				ieRng.move('character', pos);
-				ieRng.select();
-
-				return;
-			} else {
-				// If same text container
-				if (sc == ec && sc.nodeType == 3) {
-					startPos = getCharPos(sc, so);
-
-					ieRng = body.createTextRange();
-					ieRng.move('character', startPos);
-					ieRng.moveEnd('character', eo - so);
-					ieRng.select();
-
-					return;
-				}
-
-				// 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);
-
-				// Move end of range to end character position or end element
-				tmpRng = body.createTextRange();
-
-				if (endPos == -1)
-					tmpRng.moveToElementText(ec);
-				else
-					tmpRng.move('character', endPos);
-
-				ieRng.setEndPoint('EndToEnd', tmpRng);
-				ieRng.select();
-
-				return;
-			}
-		};
-
-		this.getRangeAt = function() {
-			// Setup new range if the cache is empty
-			if (!range || !compareRanges(lastIERng, selection.getRng())) {
-				range = getRange();
-
-				// Store away text range for next call
-				lastIERng = selection.getRng();
-			}
-
-			// Return cached range
-			return range;
-		};
-
-		this.destroy = function() {
-			// Destroy cached range and last IE range to avoid memory leaks
-			lastIERng = range = null;
-		};
-	};
-
-	// Expose the selection object
-	tinymce.dom.TridentSelection = Selection;
-})();
-
-/*
- * 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 ( context.nodeType !== 1 && context.nodeType !== 9 ) {
-		return [];
-	}
-	
-	if ( !selector || typeof selector !== "string" ) {
-		return results;
-	}
-
-	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;
-		}
-	}
-
-	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 );
-
-			while ( parts.length ) {
-				selector = parts.shift();
-
-				if ( Expr.relative[ selector ] )
-					selector += parts.shift();
-
-				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;
-
-			if ( parts.length > 0 ) {
-				checkSet = makeArray(set);
-			} else {
-				prune = false;
-			}
-
-			while ( parts.length ) {
-				var cur = parts.pop(), pop = cur;
-
-				if ( !Expr.relative[ cur ] ) {
-					cur = "";
-				} else {
-					pop = parts.pop();
-				}
-
-				if ( pop == null ) {
-					pop = context;
-				}
-
-				Expr.relative[ cur ]( checkSet, pop, contextXML );
-			}
-		} else {
-			checkSet = parts = [];
-		}
-	}
-
-	if ( !checkSet ) {
-		checkSet = set;
-	}
-
-	if ( !checkSet ) {
-		throw "Syntax error, unrecognized expression: " + (cur || selector);
-	}
-
-	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 {
-			for ( var i = 0; checkSet[i] != null; i++ ) {
-				if ( checkSet[i] && checkSet[i].nodeType === 1 ) {
-					results.push( set[i] );
-				}
-			}
-		}
-	} else {
-		makeArray( checkSet, results );
-	}
-
-	if ( extra ) {
-		Sizzle( extra, origContext, results, seed );
-		Sizzle.uniqueSort( results );
-	}
-
-	return results;
-};
-
-Sizzle.uniqueSort = function(results){
-	if ( sortOrder ) {
-		hasDuplicate = false;
-		results.sort(sortOrder);
-
-		if ( hasDuplicate ) {
-			for ( var i = 1; i < results.length; i++ ) {
-				if ( results[i] === results[i-1] ) {
-					results.splice(i--, 1);
-				}
-			}
-		}
-	}
-};
-
-Sizzle.matches = function(expr, set){
-	return Sizzle(expr, null, null, set);
-};
-
-Sizzle.find = function(expr, context, isXML){
-	var set, match;
-
-	if ( !expr ) {
-		return [];
-	}
-
-	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;
-
-			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;
-				}
-			}
-		}
-	}
-
-	if ( !set ) {
-		set = context.getElementsByTagName("*");
-	}
-
-	return {set: set, expr: expr};
-};
-
-Sizzle.filter = function(expr, set, inplace, not){
-	var old = expr, result = [], curLoop = set, match, anyFound,
-		isXMLFilter = set && set[0] && isXML(set[0]);
-
-	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;
-
-				if ( curLoop == result ) {
-					result = [];
-				}
-
-				if ( Expr.preFilter[ type ] ) {
-					match = Expr.preFilter[ type ]( match, curLoop, inplace, result, not, isXMLFilter );
-
-					if ( !match ) {
-						anyFound = found = true;
-					} else if ( match === true ) {
-						continue;
-					}
-				}
-
-				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;
-							}
-						}
-					}
-				}
-
-				if ( found !== undefined ) {
-					if ( !inplace ) {
-						curLoop = result;
-					}
-
-					expr = expr.replace( Expr.match[ type ], "" );
-
-					if ( !anyFound ) {
-						return [];
-					}
-
-					break;
-				}
-			}
-		}
-
-		// Improper expression
-		if ( expr == old ) {
-			if ( anyFound == null ) {
-				throw "Syntax error, unrecognized expression: " + expr;
-			} else {
-				break;
-			}
-		}
-
-		old = expr;
-	}
-
-	return curLoop;
-};
-
-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;
-
-			if ( isTag && !isXML ) {
-				part = part.toUpperCase();
-			}
-
-			for ( var i = 0, l = checkSet.length, elem; i < l; i++ ) {
-				if ( (elem = checkSet[i]) ) {
-					while ( (elem = elem.previousSibling) && elem.nodeType !== 1 ) {}
-
-					checkSet[i] = isPartStrNotTag || elem && elem.nodeName === part ?
-						elem || false :
-						elem === part;
-				}
-			}
-
-			if ( isPartStrNotTag ) {
-				Sizzle.filter( part, checkSet, true );
-			}
-		},
-		">": function(checkSet, part, isXML){
-			var isPartStr = typeof part === "string";
-
-			if ( isPartStr && !/\W/.test(part) ) {
-				part = isXML ? part : part.toUpperCase();
-
-				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;
-					}
-				}
-
-				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;
-			}
-
-			checkFn("parentNode", part, doneName, checkSet, nodeCheck, isXML);
-		},
-		"~": function(checkSet, part, isXML){
-			var doneName = done++, checkFn = dirCheck;
-
-			if ( typeof part === "string" && !part.match(/\W/) ) {
-				var nodeCheck = part = isXML ? part : part.toUpperCase();
-				checkFn = dirNodeCheck;
-			}
-
-			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]);
-
-				for ( var i = 0, l = results.length; i < l; i++ ) {
-					if ( results[i].getAttribute("name") === match[1] ) {
-						ret.push( results[i] );
-					}
-				}
-
-				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, "") + " ";
-
-			if ( isXML ) {
-				return match;
-			}
-
-			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;
-					}
-				}
-			}
-
-			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];
-
-				for ( var i = 0, l = not.length; i < l; i++ ) {
-					if ( not[i] === elem ) {
-						return false;
-					}
-				}
-
-				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 ( 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 origPOS = Expr.match.POS;
-
-for ( var type in Expr.match ) {
-	Expr.match[ type ] = new RegExp( Expr.match[ type ].source + /(?![^\[]*\])(?![^\(]*\))/.source );
-}
-
-var makeArray = function(array, results) {
-	array = Array.prototype.slice.call( array );
-
-	if ( results ) {
-		results.push.apply( results, array );
-		return results;
-	}
-	
-	return array;
-};
-
-// 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 );
-
-// Provide a fallback method if it does not work
-} catch(e){
-	makeArray = function(array, results) {
-		var ret = results || [];
-
-		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] );
-				}
-			}
-		}
-
-		return ret;
-	};
-}
-
-var sortOrder;
-
-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;
-	};
-}
-
-// 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 : [];
-			}
-		};
-
-		Expr.filter.ID = function(elem, match){
-			var node = typeof elem.getAttributeNode !== "undefined" && elem.getAttributeNode("id");
-			return elem.nodeType === 1 && node && node.nodeValue === match;
-		};
-	}
-
-	root.removeChild( form );
-})();
-
-(function(){
-	// Check to see if the browser returns only elements
-	// when doing getElementsByTagName("*")
-
-	// Create a fake element
-	var div = document.createElement("div");
-	div.appendChild( document.createComment("") );
-
-	// Make sure no comments are found
-	if ( div.getElementsByTagName("*").length > 0 ) {
-		Expr.find.TAG = function(match, context){
-			var results = context.getElementsByTagName(match[1]);
-
-			// Filter out possible comments
-			if ( match[1] === "*" ) {
-				var tmp = [];
-
-				for ( var i = 0; results[i]; i++ ) {
-					if ( results[i].nodeType === 1 ) {
-						tmp.push( results[i] );
-					}
-				}
-
-				results = tmp;
-			}
-
-			return results;
-		};
-	}
-
-	// 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 ( 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;
-
-		// 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);
-	};
-
-	for ( var prop in oldSizzle ) {
-		Sizzle[ prop ] = oldSizzle[ prop ];
-	}
-})();
-
-if ( document.getElementsByClassName && document.documentElement.getElementsByClassName ) (function(){
-	var div = document.createElement("div");
-	div.innerHTML = "<div class='test e'></div><div class='test'></div>";
-
-	// Opera can't find a second classname (in 9.6)
-	if ( div.getElementsByClassName("e").length === 0 )
-		return;
-
-	// Safari caches class attributes, doesn't catch changes (in 3.2)
-	div.lastChild.className = "e";
-
-	if ( div.getElementsByClassName("e").length === 1 )
-		return;
-
-	Expr.order.splice(1, 0, "CLASS");
-	Expr.find.CLASS = function(match, context, isXML) {
-		if ( typeof context.getElementsByClassName !== "undefined" && !isXML ) {
-			return context.getElementsByClassName(match[1]);
-		}
-	};
-})();
-
-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;
-				}
-
-				if ( elem.nodeType === 1 && !isXML ){
-					elem.sizcache = doneName;
-					elem.sizset = i;
-				}
-
-				if ( elem.nodeName === cur ) {
-					match = elem;
-					break;
-				}
-
-				elem = elem[dir];
-			}
-
-			checkSet[i] = match;
-		}
-	}
-}
-
-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 ( elem.nodeType === 1 ) {
-					if ( !isXML ) {
-						elem.sizcache = doneName;
-						elem.sizset = i;
-					}
-					if ( typeof cur !== "string" ) {
-						if ( elem === cur ) {
-							match = true;
-							break;
-						}
-
-					} else if ( Sizzle.filter( cur, [elem] ).length > 0 ) {
-						match = elem;
-						break;
-					}
-				}
-
-				elem = elem[dir];
-			}
-
-			checkSet[i] = match;
-		}
-	}
-}
-
-var contains = document.compareDocumentPosition ?  function(a, b){
-	return a.compareDocumentPosition(b) & 16;
-} : function(a, b){
-	return a !== b && (a.contains ? a.contains(b) : true);
-};
-
-var isXML = function(elem){
-	return elem.nodeType === 9 && elem.documentElement.nodeName !== "HTML" ||
-		!!elem.ownerDocument && elem.ownerDocument.documentElement.nodeName !== "HTML";
-};
-
-var posProcess = function(selector, context){
-	var tmpSet = [], later = "", match,
-		root = context.nodeType ? [context] : context;
-
-	// 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, "" );
-	}
-
-	selector = Expr.relative[selector] ? selector + "*" : selector;
-
-	for ( var i = 0, l = root.length; i < l; i++ ) {
-		Sizzle( selector, root[i], tmpSet );
-	}
-
-	return Sizzle.filter( later, tmpSet );
-};
-
-// EXPOSE
-
-window.tinymce.dom.Sizzle = Sizzle;
-
-})();
-
-(function(tinymce) {
-	// Shorten names
-	var each = tinymce.each, DOM = tinymce.DOM, isIE = tinymce.isIE, isWebKit = tinymce.isWebKit, Event;
-
-	tinymce.create('tinymce.dom.EventUtils', {
-		EventUtils : function() {
-			this.inits = [];
-			this.events = [];
-		},
-
-		add : function(o, n, f, s) {
-			var cb, t = this, el = t.events, r;
-
-			if (n instanceof Array) {
-				r = [];
-
-				each(n, function(n) {
-					r.push(t.add(o, n, f, s));
-				});
-
-				return r;
-			}
-
-			// Handle array
-			if (o && o.hasOwnProperty && o instanceof Array) {
-				r = [];
-
-				each(o, function(o) {
-					o = DOM.get(o);
-					r.push(t.add(o, n, f, s));
-				});
-
-				return r;
-			}
-
-			o = DOM.get(o);
-
-			if (!o)
-				return;
-
-			// Setup event callback
-			cb = function(e) {
-				// Is all events disabled
-				if (t.disabled)
-					return;
-
-				e = e || window.event;
-
-				// Patch in target, preventDefault and stopPropagation in IE it's W3C valid
-				if (e && isIE) {
-					if (!e.target)
-						e.target = e.srcElement;
-
-					// Patch in preventDefault, stopPropagation methods for W3C compatibility
-					tinymce.extend(e, t._stoppers);
-				}
-
-				if (!s)
-					return f(e);
-
-				return f.call(s, e);
-			};
-
-			if (n == 'unload') {
-				tinymce.unloads.unshift({func : cb});
-				return cb;
-			}
-
-			if (n == 'init') {
-				if (t.domLoaded)
-					cb();
-				else
-					t.inits.push(cb);
-
-				return cb;
-			}
-
-			// Store away listener reference
-			el.push({
-				obj : o,
-				name : n,
-				func : f,
-				cfunc : cb,
-				scope : s
-			});
-
-			t._add(o, n, cb);
-
-			return f;
-		},
-
-		remove : function(o, n, f) {
-			var t = this, a = t.events, s = false, r;
-
-			// Handle array
-			if (o && o.hasOwnProperty && o instanceof Array) {
-				r = [];
-
-				each(o, function(o) {
-					o = DOM.get(o);
-					r.push(t.remove(o, n, f));
-				});
-
-				return r;
-			}
-
-			o = DOM.get(o);
-
-			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;
-				}
-			});
-
-			return s;
-		},
-
-		clear : function(o) {
-			var t = this, a = t.events, i, e;
-
-			if (o) {
-				o = DOM.get(o);
-
-				for (i = a.length - 1; i >= 0; i--) {
-					e = a[i];
-
-					if (e.obj === o) {
-						t._remove(e.obj, e.name, e.cfunc);
-						e.obj = e.cfunc = null;
-						a.splice(i, 1);
-					}
-				}
-			}
-		},
-
-		cancel : function(e) {
-			if (!e)
-				return false;
-
-			this.stop(e);
-
-			return this.prevent(e);
-		},
-
-		stop : function(e) {
-			if (e.stopPropagation)
-				e.stopPropagation();
-			else
-				e.cancelBubble = true;
-
-			return false;
-		},
-
-		prevent : function(e) {
-			if (e.preventDefault)
-				e.preventDefault();
-			else
-				e.returnValue = false;
-
-			return false;
-		},
-
-		destroy : function() {
-			var t = this;
-
-			each(t.events, function(e, i) {
-				t._remove(e.obj, e.name, e.cfunc);
-				e.obj = e.cfunc = null;
-			});
-
-			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;
-		},
-
-		_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;
-
-			// Keep it from running more than once
-			if (t.domLoaded)
-				return;
-
-			t.domLoaded = true;
-
-			each(t.inits, function(c) {
-				c();
-			});
-
-			t.inits = [];
-		},
-
-		_wait : function(win) {
-			var t = this, doc = win.document;
-
-			// No need since the document is already loaded
-			if (win.tinyMCE_GZ && tinyMCE_GZ.loaded) {
-				t.domLoaded = 1;
-				return;
-			}
-
-			// Use IE method
-			if (doc.attachEvent) {
-				doc.attachEvent("onreadystatechange", function() {
-					if (doc.readyState === "complete") {
-						doc.detachEvent("onreadystatechange", arguments.callee);
-						t._pageInit(win);
-					}
-				});
-
-				if (doc.documentElement.doScroll && win == win.top) {
-					(function() {
-						if (t.domLoaded)
-							return;
-
-						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;
-						}
-
-						t._pageInit(win);
-					})();
-				}
-			} else if (doc.addEventListener) {
-				t._add(win, 'DOMContentLoaded', function() {
-					t._pageInit(win);
-				});
-			}
-
-			t._add(win, 'load', function() {
-				t._pageInit(win);
-			});
-		},
-
-		_stoppers : {
-			preventDefault :  function() {
-				this.returnValue = false;
-			},
-
-			stopPropagation : function() {
-				this.cancelBubble = true;
-			}
-		}
-	});
-
-	Event = tinymce.dom.Event = new tinymce.dom.EventUtils();
-
-	// Dispatch DOM content loaded event for IE and Safari
-	Event._wait(window);
-
-	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;
-
-					for (i = 0; i < arguments.length; i++)
-						a.push(arguments[i]);
-
-					a = dom[k].apply(dom, a);
-					t.update(k);
-
-					return a;
-				};
-			});
-		},
-
-		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'))
-			};
-		},
-
-		getSize : function() {
-			var n = this.dom.get(this.id);
-
-			return {
-				w : parseInt(this.getStyle('width') || n.clientWidth),
-				h : parseInt(this.getStyle('height') || n.clientHeight)
-			};
-		},
-
-		moveTo : function(x, y) {
-			this.setStyles({left : x, top : y});
-		},
-
-		moveBy : function(x, y) {
-			var p = this.getXY();
-
-			this.moveTo(p.x + x, p.y + y);
-		},
-
-		resizeTo : function(w, h) {
-			this.setStyles({width : w, height : h});
-		},
-
-		resizeBy : function(w, h) {
-			var s = this.getSize();
-
-			this.resizeTo(s.w + w, s.h + h);
-		},
-
-		update : function(k) {
-			var t = this, b, dom = t.dom;
-
-			if (tinymce.isIE6 && t.settings.blocker) {
-				k = k || '';
-
-				// Ignore getters
-				if (k.indexOf('get') === 0 || k.indexOf('has') === 0 || k.indexOf('is') === 0)
-					return;
-
-				// Remove blocker on remove
-				if (k == 'remove') {
-					dom.remove(t.blocker);
-					return;
-				}
-
-				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);
-
-				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);
-			}
-		}
-	});
-})(tinymce);
-(function(tinymce) {
-	function trimNl(s) {
-		return s.replace(/[\n\r]+/g, '');
-	};
-
-	// Shorten names
-	var is = tinymce.is, isIE = tinymce.isIE, each = tinymce.each;
-
-	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);
-			});
-
-			// 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();
-
-			// Keep whitespace before and after
-			if (/^\s/.test(e.innerHTML))
-				wb = ' ';
-
-			if (/\s+$/.test(e.innerHTML))
-				wa = ' ';
-
-			s.getInner = true;
-
-			s.content = t.isCollapsed() ? '' : wb + t.serializer.serialize(e, s) + wa;
-			t.onGetContent.dispatch(t, s);
-
-			return s.content;
-		},
-
-		setContent : function(h, s) {
-			var t = this, r = t.getRng(), c, d = t.win.document;
-
-			s = s || {format : 'html'};
-			s.set = true;
-			h = s.content = t.dom.processHTML(h);
-
-			// Dispatch before set content event
-			t.onBeforeSetContent.dispatch(t, s);
-			h = s.content;
-
-			if (r.insertNode) {
-				// Make caret marker since insertNode places the caret in the beginning of text after insert
-				h += '<span id="__caret">_</span>';
-
-				// Delete and insert new node
-				r.deleteContents();
-				r.insertNode(t.getRng().createContextualFragment(h));
-
-				// Move to caret marker
-				c = t.dom.get('__caret');
-
-				// 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);
-
-				// 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);
-
-				// 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();
-				}
-
-				r.pasteHTML(h);
-			}
-
-			// Dispatch set content event
-			t.onSetContent.dispatch(t, s);
-		},
-
-		getStart : function() {
-			var t = this, r = t.getRng(), e;
-
-			if (isIE) {
-				if (r.item)
-					return r.item(0);
-
-				r = r.duplicate();
-				r.collapse(1);
-				e = r.parentElement();
-
-				if (e && e.nodeName == 'BODY')
-					return e.firstChild;
-
-				return e;
-			} else {
-				e = r.startContainer;
-
-				if (e.nodeName == 'BODY')
-					return e.firstChild;
-
-				return t.dom.getParent(e, '*');
-			}
-		},
-
-		getEnd : function() {
-			var t = this, r = t.getRng(), e;
-
-			if (isIE) {
-				if (r.item)
-					return r.item(0);
-
-				r = r.duplicate();
-				r.collapse(0);
-				e = r.parentElement();
-
-				if (e && e.nodeName == 'BODY')
-					return e.lastChild;
-
-				return e;
-			} else {
-				e = r.endContainer;
-
-				if (e.nodeName == 'BODY')
-					return e.lastChild;
-
-				return t.dom.getParent(e, '*');
-			}
-		},
-
-		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;
-
-			// Simple bookmark fast but not as persistent
-			if (si)
-				return {rng : r, scrollX : sx, scrollY : sy};
-
-			// Handle IE
-			if (isIE) {
-				// Control selection
-				if (r.item) {
-					e = r.item(0);
-
-					each(t.dom.select(e.nodeName), function(n, i) {
-						if (e == n) {
-							sp = i;
-							return false;
-						}
-					});
-
-					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;
-
-				return {
-					start : sp - bp,
-					length : le,
-					scrollX : sx,
-					scrollY : sy
-				};
-			}
-
-			// Handle W3C
-			e = t.getNode();
-			s = t.getSel();
-
-			if (!s)
-				return null;
-
-			// Image selection
-			if (e && e.nodeName == 'IMG') {
-				return {
-					scrollX : sx,
-					scrollY : sy
-				};
-			}
-
-			// Text selection
-
-			function getPos(r, sn, en) {
-				var w = t.dom.doc.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 += trimNl(n.nodeValue || '').length;
-				}
-
-				return null;
-			};
-
-			// Caret or selection
-			if (s.anchorNode == s.focusNode && s.anchorOffset == s.focusOffset) {
-				e = getPos(ro, s.anchorNode, s.focusNode);
-
-				if (!e)
-					return {scrollX : sx, scrollY : sy};
-
-				// Count whitespace before
-				trimNl(s.anchorNode.nodeValue || '').replace(/^\s+/, function(a) {wb = a.length;});
-
-				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);
-
-				// 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;});
-
-				if (!e)
-					return {scrollX : sx, scrollY : sy};
-
-				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
-				};
-			}
-		},
-
-		moveToBookmark : function(b) {
-			var t = this, r = t.getRng(), s = t.getSel(), ro = t.dom.getRoot(), sd, nvl, nv;
-
-			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;
-
-				while ((n = w.nextNode()) != null) {
-					wa = wb = 0;
-
-					nv = n.nodeValue || '';
-					//nv.replace(/^\s+[^\s]/, function(a) {wb = a.length - 1;});
-					//nv.replace(/[^\s]\s+$/, function(a) {wa = a.length - 1;});
-
-					nvl = trimNl(nv).length;
-					p += nvl;
-
-					if (p >= sp && !d.startNode) {
-						o = sp - (p - nvl);
-
-						// Fix for odd quirk in FF
-						if (b.beg && o >= nvl)
-							continue;
-
-						d.startNode = n;
-						d.startOffset = o + wb;
-					}
-
-					if (p >= ep) {
-						d.endNode = n;
-						d.endOffset = ep - (p - nvl) + wb;
-						return d;
-					}
-				}
-
-				return null;
-			};
-
-			if (!b)
-				return false;
-
-			t.win.scrollTo(b.scrollX, b.scrollY);
-
-			// Handle explorer
-			if (isIE) {
-				t.tridentSel.destroy();
-
-				// Handle simple
-				if (r = b.rng) {
-					try {
-						r.select();
-					} catch (ex) {
-						// Ignore
-					}
-
-					return true;
-				}
-
-				t.win.focus();
-
-				// 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 = s.createRange();
-						r.moveToElementText(ro);
-						r.collapse(true);
-						r.moveStart('character', b.start);
-						r.moveEnd('character', b.length);
-					} catch (ex2) {
-						return true;
-					}
-				}
-
-				try {
-					r.select();
-				} catch (ex) {
-					// Needed for some odd IE bug #1843306
-				}
-
-				return true;
-			}
-
-			// Handle W3C
-			if (!s)
-				return false;
-
-			// 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);
-
-						if (sd) {
-							r = t.dom.doc.createRange();
-							r.setStart(sd.startNode, sd.startOffset);
-							r.setEnd(sd.endNode, sd.endOffset);
-							s.removeAllRanges();
-							s.addRange(r);
-						}
-
-						if (!tinymce.isOpera)
-							t.win.focus();
-					} catch (ex) {
-						// Ignore
-					}
-				}
-			}
-		},
-
-		select : function(n, c) {
-			var t = this, r = t.getRng(), s = t.getSel(), b, fn, ln, d = t.win.document;
-
-			function find(n, start) {
-				var walker, o;
-
-				if (n) {
-					walker = d.createTreeWalker(n, NodeFilter.SHOW_TEXT, null, false);
-
-					// Find first/last non empty text node
-					while (n = walker.nextNode()) {
-						o = n;
-
-						if (tinymce.trim(n.nodeValue).length != 0) {
-							if (start)
-								return n;
-							else
-								o = n;
-						}
-					}
-				}
-
-				return o;
-			};
-
-			if (isIE) {
-				try {
-					b = d.body;
-
-					if (/^(IMG|TABLE)$/.test(n.nodeName)) {
-						r = b.createControlRange();
-						r.addElement(n);
-					} else {
-						r = b.createTextRange();
-						r.moveToElementText(n);
-					}
-
-					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);
-			}
-
-			return n;
-		},
-
-		isCollapsed : function() {
-			var t = this, r = t.getRng(), s = t.getSel();
-
-			if (!r || r.item)
-				return false;
-
-			return !s || r.boundingWidth == 0 || r.collapsed;
-		},
-
-		collapse : function(b) {
-			var t = this, r = t.getRng(), n;
-
-			// Control range on IE
-			if (r.item) {
-				n = r.item(0);
-				r = this.win.document.body.createTextRange();
-				r.moveToElementText(n);
-			}
-
-			r.collapse(!!b);
-			t.setRng(r);
-		},
-
-		getSel : function() {
-			var t = this, w = this.win;
-
-			return w.getSelection ? w.getSelection() : w.document.selection;
-		},
-
-		getRng : function(w3c) {
-			var t = this, s, r;
-
-			// Found tridentSel object then we need to use that one
-			if (w3c && t.tridentSel)
-				return t.tridentSel.getRangeAt(0);
-
-			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
-			}
-
-			// 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 r;
-		},
-
-		setRng : function(r) {
-			var s, t = this;
-
-			if (!t.tridentSel) {
-				s = t.getSel();
-
-				if (s) {
-					s.removeAllRanges();
-					s.addRange(r);
-				}
-			} else {
-				// Is W3C Range
-				if (r.cloneRange) {
-					t.tridentSel.addRange(r);
-					return;
-				}
-
-				// Is IE specific range
-				try {
-					r.select();
-				} catch (ex) {
-					// Needed for some odd IE bug #1843306
-				}
-			}
-		},
-
-		setNode : function(n) {
-			var t = this;
-
-			t.setContent(t.dom.getOuterHTML(n));
-
-			return n;
-		},
-
-		getNode : function() {
-			var t = this, r = t.getRng(), s = t.getSel(), e;
-
-			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];
-						}
-					}
-				}
-
-				return t.dom.getParent(e, '*');
-			}
-
-			return r.item ? r.item(0) : r.parentElement();
-		},
-
-		getSelectedBlocks : function(st, en) {
-			var t = this, dom = t.dom, sb, eb, n, bl = [];
-
-			sb = dom.getParent(st || t.getStart(), dom.isBlock);
-			eb = dom.getParent(en || t.getEnd(), dom.isBlock);
-
-			if (sb)
-				bl.push(sb);
-
-			if (sb && eb && sb != eb) {
-				n = sb;
-
-				while ((n = n.nextSibling) && n != eb) {
-					if (dom.isBlock(n))
-						bl.push(n);
-				}
-			}
-
-			if (eb && sb != eb)
-				bl.push(eb);
-
-			return bl;
-		},
-
-		destroy : function(s) {
-			var t = this;
-
-			t.win = null;
-
-			if (t.tridentSel)
-				t.tridentSel.destroy();
-
-			// Manual destroy then remove unload handler
-			if (!s)
-				tinymce.removeUnload(t.destroy);
-		}
-	});
-})(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);
-			};
-
-			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;
-
-			this.reset();
-		},
-
-		reset : function() {
-			var t = this, d = t.doc;
-
-			if (d.firstChild)
-				d.removeChild(d.firstChild);
-
-			t.node = d.appendChild(d.createElement("html"));
-		},
-
-		writeStartElement : function(n) {
-			var t = this;
-
-			t.node = t.node.appendChild(t.doc.createElement(n));
-		},
-
-		writeAttribute : function(n, v) {
-			if (this.valid)
-				v = v.replace(/>/g, '%MCGT%');
-
-			this.node.setAttribute(n, v);
-		},
-
-		writeEndElement : function() {
-			this.node = this.node.parentNode;
-		},
-
-		writeFullEndElement : function() {
-			var t = this, n = t.node;
-
-			n.appendChild(t.doc.createTextNode(""));
-			t.node = n.parentNode;
-		},
-
-		writeText : function(v) {
-			if (this.valid)
-				v = v.replace(/>/g, '%MCGT%');
-
-			this.node.appendChild(this.doc.createTextNode(v));
-		},
-
-		writeCDATA : function(v) {
-			this.node.appendChild(this.doc.createCDATASection(v));
-		},
-
-		writeComment : function(v) {
-			// Fix for bug #2035694
-			if (tinymce.isIE)
-				v = v.replace(/^\-|\-$/g, ' ');
-
-			this.node.appendChild(this.doc.createComment(v.replace(/\-\-/g, ' ')));
-		},
-
-		getContent : function() {
-			var h;
-
-			h = this.doc.xml || new XMLSerializer().serializeToString(this.doc);
-			h = h.replace(/<\?[^?]+\?>|<html>|<\/html>|<html\/>|<!DOCTYPE[^>]+>/g, '');
-			h = h.replace(/ ?\/>/g, ' />');
-
-			if (this.valid)
-				h = h.replace(/\%MCGT%/g, '&gt;');
-
-			return h;
-		}
-	});
-})(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;';
-
-					case '&':
-						return '&amp;';
-
-					case '"':
-						return '&quot;';
-				}
-
-				return v;
-			});
-		},
-
-		getContent : function() {
-			return this.str;
-		},
-
-		_writeAttributesEnd : function(s) {
-			if (!this.inAttr)
-				return;
-
-			this.inAttr = false;
-
-			if (s && this.elementCount == this.count) {
-				this.writeRaw(' />');
-				return false;
-			}
-
-			this.writeRaw('>');
-
-			return true;
-		}
-	});
-})(tinymce);
-(function(tinymce) {
-	// Shorten names
-	var extend = tinymce.extend, each = tinymce.each, Dispatcher = tinymce.util.Dispatcher, isIE = tinymce.isIE, isGecko = tinymce.isGecko;
-
-	function wildcardToRE(s) {
-		return s.replace(/([?+*])/g, '.$1');
-	};
-
-	tinymce.create('tinymce.dom.Serializer', {
-		Serializer : function(s) {
-			var t = this;
-
-			t.key = 0;
-			t.onPreProcess = new Dispatcher(t);
-			t.onPostProcess = new Dispatcher(t);
-
-			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();
-			}
-
-			// 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',
-				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 + '>';
-
-						return a;
-					});
-				});
-			}
-
-			// 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 (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 null;
-					};
-
-					for (x=0; x<a.length; x++) {
-						nl = t.dom.select(a[x], o.node);
-
-						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);
-							}
-						}
-					}
-				});
-			}
-
-			if (s.fix_table_elements) {
-				t.onPreProcess.add(function(se, o) {
-					// Since Opera will crash if you attach the node to a dynamic document we need to brrowser sniff a specific build
-					// so Opera users with an older version will have to live with less compaible output not much we can do here
-					if (!tinymce.isOpera || opera.buildNumber() >= 1767) {
-						each(t.dom.select('p table', o.node).reverse(), function(n) {
-							var parent = t.dom.getParent(n.parentNode, 'table,p');
-
-							if (parent.nodeName != 'TABLE') {
-								try {
-									t.dom.split(parent, n);
-								} catch (ex) {
-									// IE can sometimes fire an unknown runtime error so we just ignore it
-								}
-							}
-						});
-					}
-				});
-			}
-		},
-
-		setEntities : function(s) {
-			var t = this, a, i, l = {}, re = '', v;
-
-			// No need to setup more than once
-			if (t.entityLookup)
-				return;
-
-			// Build regex and lookup array
-			a = s.split(',');
-			for (i = 0; i < a.length; i += 2) {
-				v = a[i];
-
-				// Don't add default &amp; &quot; etc.
-				if (v == 34 || v == 38 || v == 60 || v == 62)
-					continue;
-
-				l[String.fromCharCode(a[i])] = a[i + 1];
-
-				v = parseInt(a[i]).toString(16);
-				re += '\\u' + '0000'.substring(v.length) + v;
-			}
-
-			if (!re) {
-				t.settings.entity_encoding = 'raw';
-				return;
-			}
-
-			t.entitiesRE = new RegExp('[' + re + ']', 'g');
-			t.entityLookup = l;
-		},
-
-		setValidChildRules : function(s) {
-			this.childRules = null;
-			this.addValidChildRules(s);
-		},
-
-		addValidChildRules : function(s) {
-			var t = this, inst, intr, bloc;
-
-			if (!s)
-				return;
-
-			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;
-
-						case '%itrans_na':
-							v = intr.substring(2);
-							break;
-
-						case '%istrict':
-							v = inst;
-							break;
-
-						case '%istrict_na':
-							v = inst.substring(2);
-							break;
-
-						case '%btrans':
-							v = bloc;
-							break;
-
-						case '%bstrict':
-							v = bloc;
-							break;
-					}
-
-					s += v;
-				});
-				re = new RegExp('^(' + s.toLowerCase() + ')$', 'i');
-
-				each(p[0].split('/'), function(s) {
-					t.childRules = t.childRules || {};
-					t.childRules[s] = re;
-				});
-			});
-
-			// Build regex
-			s = '';
-			each(t.childRules, function(v, k) {
-				if (s)
-					s += '|';
-
-				s += k;
-			});
-
-			t.parentElementsRE = new RegExp('^(' + s.toLowerCase() + ')$', 'i');
-
-			/*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 t.addRules(s);
-		},
-
-		addRules : function(s) {
-			var t = this, dr;
-
-			if (!s)
-				return;
-
-			t._setup();
-
-			each(s.split(','), function(s) {
-				var p = s.split(/\[|\]/), tn = p[0].split('/'), ra, at, wat, va = [];
-
-				// Extend with default rules
-				if (dr)
-					at = tinymce.extend([], dr.attribs);
-
-				// Parse attributes
-				if (p.length > 1) {
-					each(p[1].split('|'), function(s) {
-						var ar = {}, i;
-
-						at = at || [];
-
-						// 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]);
-						}
-
-						// Remove inherited attributes
-						if (s[1] == '-') {
-							for (i = 0; i <at.length; i++) {
-								if (at[i].name == s[2]) {
-									at.splice(i, 1);
-									return;
-								}
-							}
-						}
-
-						switch (s[3]) {
-							// Add default attrib values
-							case '=':
-								ar.defaultVal = s[4] || '';
-								break;
-
-							// Add forced attrib values
-							case ':':
-								ar.forcedVal = s[4];
-								break;
-
-							// Add validation values
-							case '<':
-								ar.validVals = s[4].split('?');
-								break;
-						}
-
-						if (/[*.?]/.test(s[2])) {
-							wat = wat || [];
-							ar.nameRE = new RegExp('^' + wildcardToRE(s[2]) + '$');
-							wat.push(ar);
-						} else {
-							ar.name = s[2];
-							at.push(ar);
-						}
-
-						va.push(s[2]);
-					});
-				}
-
-				// Handle element names
-				each(tn, function(s, i) {
-					var pr = s.charAt(0), x = 1, ru = {};
-
-					// Extend with default rule data
-					if (dr) {
-						if (dr.noEmpty)
-							ru.noEmpty = dr.noEmpty;
-
-						if (dr.fullEnd)
-							ru.fullEnd = dr.fullEnd;
-
-						if (dr.padd)
-							ru.padd = dr.padd;
-					}
-
-					// Handle prefixes
-					switch (pr) {
-						case '-':
-							ru.noEmpty = true;
-							break;
-
-						case '+':
-							ru.fullEnd = true;
-							break;
-
-						case '#':
-							ru.padd = true;
-							break;
-
-						default:
-							x = 0;
-					}
-
-					tn[i] = s = s.substring(x);
-					t.validElements[s] = 1;
-
-					// 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];
-
-						// Store away default rule
-						if (tn[0] == '@')
-							dr = ru;
-
-						t.rules[s] = ru;
-					}
-
-					ru.attribs = at;
-
-					if (ra)
-						ru.requiredAttribs = ra;
-
-					if (wat) {
-						// Build valid attributes regexp
-						s = '';
-						each(va, function(v) {
-							if (s)
-								s += '|';
-
-							s += '(' + wildcardToRE(v) + ')';
-						});
-						ru.validAttribsRE = new RegExp('^' + s.toLowerCase() + '$');
-						ru.wildAttribs = wat;
-					}
-				});
-			});
-
-			// Build valid elements regexp
-			s = '';
-			each(t.validElements, function(v, k) {
-				if (s)
-					s += '|';
-
-				if (k != '@')
-					s += k;
-			});
-			t.validElementsRE = new RegExp('^(' + wildcardToRE(s.toLowerCase()) + ')$');
-
-			//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 null;
-		},
-
-		findAttribRule : function(ru, n) {
-			var i, wa = ru.wildAttribs;
-
-			for (i = 0; i < wa.length; i++) {
-				if (wa[i].nameRE.test(n))
-					return wa[i];
-			}
-
-			return null;
-		},
-
-		serialize : function(n, o) {
-			var h, t = this, doc, oldDoc, impl, selected;
-
-			t._setup();
-			o = o || {};
-			o.format = o.format || 'html';
-			t.processObj = o;
-
-			// IE looses the selected attribute on option elements so we need to store it
-			// See: http://support.microsoft.com/kb/829907
-			if (isIE) {
-				selected = [];
-				each(n.getElementsByTagName('option'), function(n) {
-					var v = t.dom.getAttrib(n, 'selected');
-
-					selected.push(v ? v : null);
-				});
-			}
-
-			n = n.cloneNode(true);
-
-			// IE looses the selected attribute on option elements so we need to restore it
-			if (isIE) {
-				each(n.getElementsByTagName('option'), function(n, i) {
-					t.dom.setAttrib(n, 'selected', selected[i]);
-				});
-			}
-
-			// Nodes needs to be attached to something in WebKit/Opera
-			// Older builds of Opera crashes if you attach the node to an document created dynamically
-			// and since we can't feature detect a crash we need to sniff the acutal build number
-			// This fix will make DOM ranges and make Sizzle happy!
-			impl = n.ownerDocument.implementation;
-			if (impl.createHTMLDocument && (tinymce.isOpera && opera.buildNumber() >= 1767)) {
-				// Create an empty HTML document
-				doc = impl.createHTMLDocument("");
-
-				// Add the element or it's children if it's a body element to the new document
-				each(n.nodeName == 'BODY' ? n.childNodes : [n], function(node) {
-					doc.body.appendChild(doc.importNode(node, true));
-				});
-
-				// Grab first child or body element for serialization
-				if (n.nodeName != 'BODY')
-					n = doc.body.firstChild;
-				else
-					n = doc.body;
-
-				// set the new document in DOMUtils so createElement etc works
-				oldDoc = t.dom.doc;
-				t.dom.doc = doc;
-			}
-
-			t.key = '' + (parseInt(t.key) + 1);
-
-			// Pre process
-			if (!o.no_events) {
-				o.node = n;
-				t.onPreProcess.dispatch(t, o);
-			}
-
-			// Serialize HTML DOM into a string
-			t.writer.reset();
-			t._serializeNode(n, o.getInner);
-
-			// Post process
-			o.content = t.writer.getContent();
-
-			// Restore the old document if it was changed
-			if (oldDoc)
-				t.dom.doc = oldDoc;
-
-			if (!o.no_events)
-				t.onPostProcess.dispatch(t, o);
-
-			t._postProcess(o);
-			o.node = null;
-
-			return tinymce.trim(o.content);
-		},
-
-		// Internal functions
-
-		_postProcess : function(o) {
-			var t = this, s = t.settings, h = o.content, sc = [], p;
-
-			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}
-					]
-				});
-
-				h = p.content;
-
-				// 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>');*/
-
-				// 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>');
-
-					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
-					}
-
-					// 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');
-					}
-				}
-
-				h = t._unprotect(h, p);
-
-				// Restore CDATA sections
-				h = h.replace(/<!--\[CDATA\[([\s\S]+)\]\]-->/g, '<![CDATA[$1]]>');
-
-				// 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>');
-
-				// 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>';
-				});
-			}
-
-			o.content = h;
-		},
-
-		_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;
-
-			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;
-						}
-
-						// 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;
-						}
-
-						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;
-
-								n.mce_serialized = t.key;
-							}
-
-							// 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;
-						}
-
-						// Check if valid child
-						if (t.childRules) {
-							if (t.parentElementsRE.test(t.elementName)) {
-								if (!t.childRules[t.elementName].test(nn)) {
-									iv = true;
-									break;
-								}
-							}
-
-							t.elementName = nn;
-						}
-
-						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;
-						}
-
-						// Check required
-						if (ru.requiredAttribs) {
-							a = ru.requiredAttribs;
-
-							for (i = a.length - 1; i >= 0; i--) {
-								if (this.dom.getAttrib(n, a[i]) !== '')
-									break;
-							}
-
-							// None of the required was there
-							if (i == -1) {
-								iv = true;
-								break;
-							}
-						}
-
-						w.writeStartElement(nn);
-
-						// 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);
-
-								if (v !== null)
-									w.writeAttribute(a.name, v);
-							}
-						}
-
-						// 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();
-
-									if (s.invalid_attrs.test(a) || !ru.validAttribsRE.test(a))
-										continue;
-
-									ar = t.findAttribRule(ru, a);
-									v = t._getAttrib(n, ar, a);
-
-									if (v !== null)
-										w.writeAttribute(a, v);
-								}
-							}
-						}
-
-						// 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;
-						}
-
-						// 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
-						}
-
-						break;
-
-					case 3: // Text
-						// Check if valid child
-						if (t.childRules && t.parentElementsRE.test(t.elementName)) {
-							if (!t.childRules[t.elementName].test(n.nodeName))
-								return;
-						}
-
-						return w.writeText(n.nodeValue);
-
-					case 4: // CDATA
-						return w.writeCDATA(n.nodeValue);
-
-					case 8: // Comment
-						return w.writeComment(n.nodeValue);
-				}
-			} else if (n.nodeType == 1)
-				hc = n.hasChildNodes();
-
-			if (hc && !closed) {
-				cn = n.firstChild;
-
-				while (cn) {
-					t._serializeNode(cn);
-					t.elementName = nn;
-					cn = cn.nextSibling;
-				}
-			}
-
-			// Write element end
-			if (!iv) {
-				if (!closed)
-					w.writeFullEndElement();
-				else
-					w.writeEndElement();
-			}
-		},
-
-		_protect : function(o) {
-			var t = this;
-
-			o.items = o.items || [];
-
-			function enc(s) {
-				return s.replace(/[\r\n\\]/g, function(c) {
-					if (c === '\n')
-						return '\\n';
-					else if (c === '\\')
-						return '\\\\';
-
-					return '\\r';
-				});
-			};
-
-			function dec(s) {
-				return s.replace(/\\[\\rn]/g, function(c) {
-					if (c === '\\n')
-						return '\n';
-					else if (c === '\\\\')
-						return '\\';
-
-					return '\r';
-				});
-			};
-
-			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;
-				}));
-			});
-
-			return o;
-		},
-
-		_unprotect : function(h, o) {
-			h = h.replace(/\<!--mce:([0-9]+)--\>/g, function(a, b) {
-				return o.items[parseInt(b)];
-			});
-
-			o.items = [];
-
-			return h;
-		},
-
-		_encode : function(h) {
-			var t = this, s = t.settings, l;
-
-			// Entity encode
-			if (s.entity_encoding !== 'raw') {
-				if (s.entity_encoding.indexOf('named') != -1) {
-					t.setEntities(s.entities);
-					l = t.entityLookup;
-
-					h = h.replace(t.entitiesRE, function(a) {
-						var v;
-
-						if (v = l[a])
-							a = '&' + v + ';';
-
-						return a;
-					});
-				}
-
-				if (s.entity_encoding.indexOf('numeric') != -1) {
-					h = h.replace(/[\u007E-\uFFFF]/g, function(a) {
-						return '&#' + a.charCodeAt(0) + ';';
-					});
-				}
-			}
-
-			return h;
-		},
-
-		_setup : function() {
-			var t = this, s = this.settings;
-
-			if (t.done)
-				return;
-
-			t.done = 1;
-
-			t.setRules(s.valid_elements);
-			t.addRules(s.extended_valid_elements);
-			t.addValidChildRules(s.valid_child_elements);
-
-			if (s.invalid_elements)
-				t.invalidElementsRE = new RegExp('^(' + wildcardToRE(s.invalid_elements.replace(/,/g, '|').toLowerCase()) + ')$');
-
-			if (s.attrib_value_filter)
-				t.attribValueFilter = s.attribValueFilter;
-		},
-
-		_getAttrib : function(n, a, na) {
-			var i, v;
-
-			na = na || a.name;
-
-			if (a.forcedVal && (v = a.forcedVal)) {
-				if (v === '{$uid}')
-					return this.dom.uniqueId();
-
-				return v;
-			}
-
-			v = this.dom.getAttrib(n, na);
-
-			switch (na) {
-				case 'rowspan':
-				case 'colspan':
-					// Whats the point? Remove usless attribute value
-					if (v == '1')
-						v = '';
-
-					break;
-			}
-
-			if (this.attribValueFilter)
-				v = this.attribValueFilter(na, v, n);
-
-			if (a.validVals) {
-				for (i = a.validVals.length - 1; i >= 0; i--) {
-					if (v == a.validVals[i])
-						break;
-				}
-
-				if (i == -1)
-					return null;
-			}
-
-			if (v === '' && typeof(a.defaultVal) != 'undefined') {
-				v = a.defaultVal;
-
-				if (v === '{$uid}')
-					return this.dom.uniqueId();
-
-				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 (v === '')
-				return null;
-
-
-			return v;
-		}
-	});
-})(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]) {
-				// Is loaded fire callback
-				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]) {
-				// Is loaded fire callback
-				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;
-
-			// Evaluate script
-			if (!w.execScript) {
-				try {
-					eval.call(w, co);
-				} catch (ex) {
-					eval(co, w); // Firefox 3.0a8
-				}
-			} else
-				w.execScript(co); // IE
-		},
-
-		loadScripts : function(sc, cb, s) {
-			var t = this, lo = t.lookup;
-
-			function done(o) {
-				o.state = 2; // Has been loaded
-
-				// Run callback
-				if (o.func)
-					o.func.call(o.scope || t);
-			};
-
-			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();
-					}
-				});
-				*/
-			};
-
-			each(sc, function(o) {
-				var u = o.url;
-
-				// Add to queue if needed
-				if (!lo[u]) {
-					lo[u] = o;
-					t.queue.push(o);
-				} else
-					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);
-			});
-
-			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);
-				}
-			}
-		}
-	});
-
-	// 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;
-		},
-
-		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() {
-		},
-
-		renderTo : function(n) {
-			DOM.setHTML(n, this.renderHTML());
-		},
-
-		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 = {};
-	},
-
-	add : function(c) {
-		this.lookup[c.id] = c;
-		this.controls.push(c);
-
-		return c;
-	},
-
-	get : function(n) {
-		return this.lookup[n];
-	}
-});
-
-tinymce.create('tinymce.ui.Separator:tinymce.ui.Control', {
-	Separator : function(id, s) {
-		this.parent(id, s);
-		this.classPrefix = 'mceSeparator';
-	},
-
-	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;
-
-	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 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);
-
-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.isNotDirty = false;
-
-			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);
-			});
-
-			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,-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|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);
-
-			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();
-				});
-			};
-
-			loadScripts();
-		},
-
-		init : function() {
-			var n, t = this, s = t.settings, w, h, e = t.getElement(), o, ti, u, bi, bc, re;
-
-			EditorManager.add(t);
-
-			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);
-
-			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);
-			}
-
-			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(extend(s, {
-				valid_elements : s.verify_html === false ? '*[*]' : s.valid_elements,
-				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;
-
-	// Checks if the selection/caret is at the end of the specified block element
-	function isAtEnd(rng, par) {
-		var rng2 = par.ownerDocument.createRange();
-
-		rng2.setStart(rng.endContainer, rng.endOffset);
-		rng2.setEndAfter(par);
-
-		// Get number of characters to the right of the cursor if it's zero then we are at the end and need to merge the next block element
-		return rng2.cloneContents().textContent.length == 0;
-	};
-
-	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 && !/^(script|mce:script|style|mce:style)$/i.test(nx.nodeName))) {
-					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;
-								}
-							}
-
-							// Uses replaceChild instead of cloneNode since it removes selected attribute from option elements on IE
-							// See: http://support.microsoft.com/kb/829907
-							bl = ed.dom.create(ed.settings.forced_root_block);
-							nx.parentNode.replaceChild(bl, nx);
-							bl.appendChild(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;
-			}
-
-			// 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);
-
-			// Remove id from after clone
-			aft.removeAttribute('id');
-
-			// Is header and cursor is at the end, then force paragraph under
-			if (/^(H[1-6])$/.test(bn) && isAtEnd(r, sb))
-				aft = ed.dom.create(se.element);
-
-			// 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;
-
-				sc = n;
-			} while ((n = n.previousSibling ? n.previousSibling : n.parentNode));
-
-			// 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;
-
-				ec = n;
-			} while ((n = n.nextSibling ? n.nextSibling : n.parentNode));
-
-			// Place first chop part into before block element
-			if (sc.nodeName == bn)
-				rb.setStart(sc, 0);
-			else
-				rb.setStartBefore(sc);
-
-			rb.setEnd(sn, so);
-			bef.appendChild(rb.cloneContents() || d.createTextNode('')); // Empty text node needed for Safari
-
-			// Place secnd chop part within new block element
-			try {
-				ra.setEndAfter(ec);
-			} catch(ex) {
-				//console.debug(s.focusNode, s.focusOffset);
-			}
-
-			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);
-			}
-
-			if (!ec.nextSibling && ec.parentNode.nodeName == bn)
-				r.setEndAfter(ec.parentNode);
-			else
-				r.setEnd(ra.endContainer, ra.endOffset);
-
-			// Delete and replace it with new block elements
-			r.deleteContents();
-
-			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;
-
-			if (aft.firstChild && aft.firstChild.nodeName == bn)
-				aft.innerHTML = aft.firstChild.innerHTML;
-
-			// Padd empty blocks
-			if (isEmpty(bef))
-				bef.innerHTML = '<br />';
-
-			function appendStyles(e, en) {
-				var nl = [], nn, n, i;
-
-				e.innerHTML = '';
-
-				// 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);
-				}
-
-				// Append style elements to aft
-				if (nl.length > 0) {
-					for (i = nl.length - 1, nn = e; i >= 0; i--)
-						nn = nn.appendChild(nl[i]);
-
-					// 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
-			};
-
-			// 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);
-			}
-
-			// Normalize
-			aft.normalize();
-			bef.normalize();
-
-			function first(n) {
-				return d.createTreeWalker(n, NodeFilter.SHOW_TEXT, null, false).nextNode() || n;
-			};
-
-			// 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));
-			}
-
-			return false;
-		},
-
-		backspaceDelete : function(e, bs) {
-			var t = this, ed = t.editor, b = ed.getBody(), dom = ed.dom, n, se = ed.selection, r = se.getRng(), sc = r.startContainer, n, w, tn;
-
-			/*
-			var par, rng, nextBlock;
-
-			// Delete key will not merge paragraphs on Gecko so we need to do this manually
-			// Hitting the delete key at the following caret position doesn't merge the elements <p>A|</p><p>B</p>
-			// This logic will merge them into this: <p>A|B</p>
-			if (e.keyCode == 46) {
-				if (r.collapsed) {
-					par = dom.getParent(sc, 'p,h1,h2,h3,h4,h5,h6,div');
-
-					if (par) {
-						rng = dom.createRng();
-
-						rng.setStart(sc, r.startOffset);
-						rng.setEndAfter(par);
-
-						// Get number of characters to the right of the cursor if it's zero then we are at the end and need to merge the next block element
-						if (dom.getOuterHTML(rng.cloneContents()).replace(/<[^>]+>/g, '').length == 0) {
-							nextBlock = dom.getNext(par, 'p,h1,h2,h3,h4,h5,h6,div');
-
-							// Copy all children from next sibling block and remove it
-							if (nextBlock) {
-								each(nextBlock.childNodes, function(node) {
-									par.appendChild(node.cloneNode(true));
-								});
-
-								dom.remove(nextBlock);
-							}
-
-							// Block the default even since the Gecko team might eventually fix this
-							// We will remove this logic once they do we can't feature detect this one
-							e.preventDefault();
-							return;
-						}
-					}
-				}
-			}
-			*/
-
-			// 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);
-
-							// Remove the target container
-							ed.dom.remove(sc);
-						}
-
-						return Event.cancel(e);
-					}
-				}
-			}
-
-			// Gecko generates BR elements here and there, we don't like those so lets remove them
-			function handler(e) {
-				var pr;
-
-				e = e.target;
-
-				// 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;
-
-					Event.remove(b, 'DOMNodeInserted', handler);
-
-					// 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;
-
-					// Only remove BR elements that got inserted in the middle of the text
-					if (e.previousSibling || e.nextSibling)
-						ed.dom.remove(e);
-				}
-			};
-
-			// Listen for new nodes
-			Event._add(b, 'DOMNodeInserted', handler);
-
-			// 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();
-				});
-			});
-		},
-
-		get : function(id) {
-			return this.controls[this.prefix + id] || this.controls[id];
-		},
-
-		setActive : function(id, s) {
-			var c = null;
-
-			if (c = this.get(id))
-				c.setActive(s);
-
-			return c;
-		},
-
-		setDisabled : function(id, s) {
-			var c = null;
-
-			if (c = this.get(id))
-				c.setDisabled(s);
-
-			return c;
-		},
-
-		add : function(c) {
-			var t = this;
-
-			if (c) {
-				t.controls[c.id] = c;
-				t.onAdd.dispatch(c, t);
-			}
-
-			return c;
-		},
-
-		createControl : function(n) {
-			var c, t = this, ed = t.editor;
-
-			each(ed.plugins, function(p) {
-				if (p.createControl) {
-					c = p.createControl(n, t);
-
-					if (c)
-						return false;
-				}
-			});
-
-			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);
-					};
-				}
-			});
-
-			ed.onRemove.add(function() {
-				c.destroy();
-			});
-
-			// 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);
-				});
-
-				c.onHideMenu.add(function() {
-					if (bm) {
-						ed.selection.moveToBookmark(bm);
-						bm = 0;
-					}
-				});
-			}
-
-			return t.add(c);
-		},
-
-		createListBox : function(id, s, cc) {
-			var t = this, ed = t.editor, cmd, c, cls;
-
-			if (t.get(id))
-				return null;
-
-			s.title = ed.translate(s.title);
-			s.scope = s.scope || ed;
-
-			if (!s.onselect) {
-				s.onselect = function(v) {
-					ed.execCommand(s.cmd, s.ui || false, v || s.value);
-				};
-			}
-
-			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;
-					});
-				});
-			}
-
-			if (c.hideMenu)
-				ed.onMouseDown.add(c.hideMenu, c);
-
-			return t.add(c);
-		},
-
-		createButton : function(id, s, cc) {
-			var t = this, ed = t.editor, o, c, cls;
-
-			if (t.get(id))
-				return null;
-
-			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);
-				};
-			}
-
-			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 {
-				cls = t._cls.button || tinymce.ui.Button;
-				c = new cls(id, s);
-			}
-
-			return t.add(c);
-		},
-
-		createMenuButton : function(id, s, cc) {
-			s = s || {};
-			s.menu_button = 1;
-
-			return this.createButton(id, s, cc);
-		},
-
-		createSplitButton : function(id, s, cc) {
-			var t = this, ed = t.editor, cmd, c, cls;
-
-			if (t.get(id))
-				return null;
-
-			s.title = ed.translate(s.title);
-			s.scope = s.scope || ed;
-
-			if (!s.onclick) {
-				s.onclick = function(v) {
-					ed.execCommand(s.cmd, s.ui || false, v || s.value);
-				};
-			}
-
-			if (!s.onselect) {
-				s.onselect = function(v) {
-					ed.execCommand(s.cmd, s.ui || false, v || s.value);
-				};
-			}
-
-			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);
-
-			return c;
-		},
-
-		createColorSplitButton : function(id, s, cc) {
-			var t = this, ed = t.editor, cmd, c, cls, bm;
-
-			if (t.get(id))
-				return null;
-
-			s.title = ed.translate(s.title);
-			s.scope = s.scope || ed;
-
-			if (!s.onclick) {
-				s.onclick = function(v) {
-					if (tinymce.isIE)
-						bm = ed.selection.getBookmark(1);
-
-					ed.execCommand(s.cmd, s.ui || false, v || s.value);
-				};
-			}
-
-			if (!s.onselect) {
-				s.onselect = function(v) {
-					ed.execCommand(s.cmd, s.ui || false, v || s.value);
-				};
-			}
-
-			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();
-			});
-
-			// 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);
-				});
-
-				c.onHideMenu.add(function() {
-					if (bm) {
-						ed.selection.moveToBookmark(bm);
-						bm = 0;
-					}
-				});
-			}
-
-			return t.add(c);
-		},
-
-		createToolbar : function(id, s, cc) {
-			var c, t = this, cls;
-
-			id = t.prefix + id;
-			cls = cc || t._cls.toolbar || tinymce.ui.Toolbar;
-			c = new cls(id, s);
-
-			if (t.get(id))
-				return null;
-
-			return t.add(c);
-		},
-
-		createSeparator : function(cc) {
-			var cls = cc || this._cls.separator || tinymce.ui.Separator;
-
-			return new cls();
-		},
-
-		setControlType : function(n, c) {
-			return this._cls[n.toLowerCase()] = c;
-		},
-	
-		destroy : function() {
-			each(this.controls, function(c) {
-				c.destroy();
-			});
-
-			this.controls = null;
-		}
-	});
-})(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;
-				}
-			}
-
-			// 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;
-				}
-			});
-
-			t.features = s;
-			t.params = p;
-			t.onOpen.dispatch(t, s, p);
-
-			u = s.url || s.file;
-			u = tinymce._addVer(u);
-
-			try {
-				if (isIE && mo) {
-					w = 1;
-					window.showModalDialog(u, window, f);
-				} else
-					w = window.open(u, s.name, f);
-			} catch (ex) {
-				// Ignore
-			}
-
-			if (!w)
-				alert(t.editor.getLang('popup_blocked'));
-		},
-
-		close : function(w) {
-			w.close();
-			this.onClose.dispatch(this);
-		},
-
-		createInstance : function(cl, a, b, c, d, e) {
-			var f = tinymce.resolve(cl);
-
-			return new f(a, b, c, d, e);
-		},
-
-		confirm : function(t, cb, s, w) {
-			w = w || window;
-
-			cb.call(s || this, w.confirm(this._decode(this.editor.getLang(t, t))));
-		},
-
-		alert : function(tx, cb, s, w) {
-			var t = this;
-
-			w = w || window;
-			w.alert(t._decode(t.editor.getLang(tx, tx)));
-
-			if (cb)
-				cb.call(s || t);
-		},
-
-		// Internal functions
-
-		_decode : function(s) {
-			return tinymce.DOM.decode(s).replace(/\\n/g, '\n');
-		}
-	});
-}(tinymce));(function(tinymce) {
-	tinymce.CommandManager = function() {
-		var execCommands = {}, queryStateCommands = {}, queryValueCommands = {};
-
-		function add(collection, cmd, func, scope) {
-			if (typeof(cmd) == 'string')
-				cmd = [cmd];
-
-			tinymce.each(cmd, function(cmd) {
-				collection[cmd.toLowerCase()] = {func : func, scope : scope};
-			});
-		};
-
-		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;
-				}
-			},
-
-			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);
-			}
-		});
-	};
-
-	tinymce.GlobalCommands = new tinymce.CommandManager();
-})(tinymce);(function(tinymce) {
-	function processRange(dom, start, end, callback) {
-		var ancestor, n, startPoint, endPoint, sib;
-
-		function findEndPoint(n, c) {
-			do {
-				if (n.parentNode == c)
-					return n;
-
-				n = n.parentNode;
-			} while(n);
-		};
-
-		function process(n) {
-			callback(n);
-			tinymce.walk(n, callback, 'childNodes');
-		};
-
-		// 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);
-		}
-
-		// 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);
-
-		// Process right leaf
-		for (n = end; n && n != endPoint; n = n.parentNode) {
-			for (sib = n.previousSibling; sib; sib = sib.previousSibling)
-				process(sib);
-		}
-	};
-
-	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;
-
-		function findFormatRoot(n) {
-			var sp;
-
-			dom.getParent(n, function(n) {
-				if (dom.is(n, ed.getParam('removeformat_selector')))
-					sp = n;
-
-				return dom.isBlock(n);
-			}, ed.getBody());
-
-			return sp;
-		};
-
-		function collect(n) {
-			if (dom.is(n, ed.getParam('removeformat_selector')))
-				nodes.push(n);
-		};
-
-		function walk(n) {
-			collect(n);
-			tinymce.walk(n, collect, 'childNodes');
-		};
-
-		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);
-
-					s.moveToBookmark(bm);
-				}
-
-				return;
-			}
-
-			// Handle single element
-			walk(dom.split(start, sc) || sc);
-		} else {
-			// Find start/end format root
-			start = findFormatRoot(sc);
-			end = findFormatRoot(ec);
-
-			// 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
-
-					sc = sc.splitText(so);
-				}
-			}
-
-			// Split end text node
-			if (end) {
-				if (ec.nodeType == 3) // TEXT
-					ec.splitText(eo);
-			}
-
-			// 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);
-
-			// Split all start containers down to the format root
-			if (start)
-				start = dom.split(start, sc);
-			else
-				start = sc;
-
-			// If there is a span wrapper use that one instead
-			if (n = dom.get('__end')) {
-				ec = n;
-				end = findFormatRoot(ec);
-			}
-
-			// Split all end containers down to the format root
-			if (end)
-				end = dom.split(end, ec);
-			else
-				end = ec;
-
-			// Collect nodes in between
-			processRange(dom, start, end, collect);
-
-			// Remove invisible character for IE workaround if we find it
-			if (sc.nodeValue == '\uFEFF')
-				sc.nodeValue = '';
-
-			// Process start/end container elements
-			walk(ec);
-			walk(sc);
-		}
-
-		// Remove all collected nodes
-		tinymce.each(nodes, function(n) {
-			dom.remove(n, 1);
-		});
-
-		// Remove leftover wrapper
-		dom.remove('__end', 1);
-
-		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;
-
-		function getBQ(e) {
-			return dom.getParent(e, function(n) {return n.nodeName === 'BLOCKQUOTE';});
-		};
-
-		// 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);
-
-					// 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);
-
-			return;
-		}
-
-		// 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;
-		}
-
-		if (!sb || !eb)
-			return;
-
-		// 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;
-			}
-
-			// No BQ found, create one
-			if (!bq) {
-				bq = dom.create('blockquote');
-				e.parentNode.insertBefore(bq, e);
-			}
-
-			// Add children from existing BQ
-			if (e.nodeName == 'BLOCKQUOTE' && bq) {
-				n = e.firstChild;
-
-				while (n) {
-					bq.appendChild(n.cloneNode(true));
-					n = n.nextSibling;
-				}
-
-				dom.remove(e);
-				return;
-			}
-
-			// Add non BQ element to BQ
-			bq.appendChild(dom.remove(e));
-		});
-
-		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();
-
-			try {
-				doc.execCommand(cmd, false, null);
-
-				// On WebKit the command will just be ignored if it's not enabled
-				if (!doc.queryCommandEnabled(cmd))
-					throw 'Error';
-			} catch (ex) {
-				if (tinymce.isGecko) {
-					ed.windowManager.confirm(ed.getLang('clipboard_msg'), function(s) {
-						if (s)
-							open('http://www.mozilla.org/editor/midasdemo/securityprefs.html', '_blank');
-					});
-				} else
-					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, '');
-
-		this.selection.setContent('<hr />');
-	});
-})(tinymce);
-(function() {
-	var cmds = tinymce.GlobalCommands;
-
-	cmds.add(['mceEndUndoLevel', 'mceAddUndoLevel'], function() {
-		this.undoManager.add();
-	});
-
-	cmds.add('Undo', function() {
-		var ed = this;
-
-		if (ed.settings.custom_undo_redo) {
-			ed.undoManager.undo();
-			ed.nodeChanged();
-			return true;
-		}
-
-		return false; // Run browser command
-	});
-
-	cmds.add('Redo', function() {
-		var ed = this;
-
-		if (ed.settings.custom_undo_redo) {
-			ed.undoManager.redo();
-			ed.nodeChanged();
-			return true;
-		}
-
-		return false; // Run browser command
-	});
-})();
+(function(win) {
+	var whiteSpaceRe = /^\s*|\s*$/g,
+		undefined, isRegExpBroken = 'B'.replace(/A(.)|B/, '$1') === '$1';
+
+	var tinymce = {
+		majorVersion : '3',
+
+		minorVersion : '4.1',
+
+		releaseDate : '2011-03-24',
+
+		_init : function() {
+			var t = this, d = document, na = navigator, ua = na.userAgent, i, nl, n, base, p, v;
+
+			t.isOpera = win.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);
+
+			t.isIDevice = /(iPad|iPhone)/.test(ua);
+
+			// TinyMCE .NET webcontrol might be setting the values for TinyMCE
+			if (win.tinyMCEPreInit) {
+				t.suffix = tinyMCEPreInit.suffix;
+				t.baseURL = tinyMCEPreInit.base;
+				t.query = tinyMCEPreInit.query;
+				return;
+			}
+
+			// Get suffix and base
+			t.suffix = '';
+
+			// 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 += '/';
+
+					base = v ? v.match(/.*\//)[0] : ''; // Get only directory
+				}
+			}
+
+			function getBase(n) {
+				if (n.src && /tiny_mce(|_gzip|_jquery|_prototype|_full)(_dev|_src)?.js/.test(n.src)) {
+					if (/_(src|dev)\.js/g.test(n.src))
+						t.suffix = '_src';
+
+					if ((p = n.src.indexOf('?')) != -1)
+						t.query = n.src.substring(p + 1);
+
+					t.baseURL = n.src.substring(0, n.src.lastIndexOf('/'));
+
+					// If path to script is relative and a base href was found add that one infront
+					// the src property will always be an absolute one on non IE browsers and IE 8
+					// so this logic will basically only be executed on older IE versions
+					if (base && t.baseURL.indexOf('://') == -1 && t.baseURL.indexOf('/') !== 0)
+						t.baseURL = base + t.baseURL;
+
+					return t.baseURL;
+				}
+
+				return null;
+			};
+
+			// Check document
+			nl = d.getElementsByTagName('script');
+			for (i=0; i<nl.length; i++) {
+				if (getBase(nl[i]))
+					return;
+			}
+
+			// Check head
+			n = d.getElementsByTagName('head')[0];
+			if (n) {
+				nl = n.getElementsByTagName('script');
+				for (i=0; i<nl.length; i++) {
+					if (getBase(nl[i]))
+						return;
+				}
+			}
+
+			return;
+		},
+
+		is : function(o, t) {
+			if (!t)
+				return o !== undefined;
+
+			if (t == 'array' && (o.hasOwnProperty && o instanceof Array))
+				return true;
+
+			return typeof(o) == t;
+		},
+
+		makeMap : function(items, delim, map) {
+			var i;
+
+			items = items || [];
+			delim = delim || ',';
+
+			if (typeof(items) == "string")
+				items = items.split(delim);
+
+			map = map || {};
+
+			i = items.length;
+			while (i--)
+				map[items[i]] = {};
+
+			return map;
+		},
+
+		each : function(o, cb, s) {
+			var n, l;
+
+			if (!o)
+				return 0;
+
+			s = s || o;
+
+			if (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;
+					}
+				}
+			}
+
+			return 1;
+		},
+
+
+		map : function(a, f) {
+			var o = [];
+
+			tinymce.each(a, function(v) {
+				o.push(f(v));
+			});
+
+			return o;
+		},
+
+		grep : function(a, f) {
+			var o = [];
+
+			tinymce.each(a, function(v) {
+				if (!f || f(v))
+					o.push(v);
+			});
+
+			return o;
+		},
+
+		inArray : function(a, v) {
+			var i, l;
+
+			if (a) {
+				for (i = 0, l = a.length; i < l; i++) {
+					if (a[i] === v)
+						return i;
+				}
+			}
+
+			return -1;
+		},
+
+		extend : function(o, e) {
+			var i, l, a = arguments;
+
+			for (i = 1, l = a.length; i < l; i++) {
+				e = a[i];
+
+				tinymce.each(e, function(v, n) {
+					if (v !== undefined)
+						o[n] = v;
+				});
+			}
+
+			return o;
+		},
+
+
+		trim : function(s) {
+			return (s ? '' + s : '').replace(whiteSpaceRe, '');
+		},
+
+		create : function(s, p, root) {
+			var t = this, sp, ns, cn, scn, c, de = 0;
+
+			// Parse : <prefix> <class>:<super class>
+			s = /^((static) )?([\w.]+)(:([\w.]+))?/.exec(s);
+			cn = s[3].match(/(^|\.)(\w+)$/i)[2]; // Class name
+
+			// Create namespace for new class
+			ns = t.createNS(s[3].replace(/\.\w+$/, ''), root);
+
+			// Class already exists
+			if (ns[cn])
+				return;
+
+			// Make pure static class
+			if (s[2] == 'static') {
+				ns[cn] = p;
+
+				if (this.onCreate)
+					this.onCreate(s[2], s[3], ns[cn]);
+
+				return;
+			}
+
+			// 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);
+					};
+				}
+				ns[cn].prototype[cn] = ns[cn];
+
+				// Add super methods
+				t.each(sp, function(f, n) {
+					ns[cn].prototype[n] = sp[n];
+				});
+
+				// 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;
+					}
+				});
+			}
+
+			// Add static methods
+			t.each(p['static'], function(f, n) {
+				ns[cn][n] = f;
+			});
+
+			if (this.onCreate)
+				this.onCreate(s[2], s[3], ns[cn].prototype);
+		},
+
+		walk : function(o, f, n, s) {
+			s = s || this;
+
+			if (o) {
+				if (n)
+					o = o[n];
+
+				tinymce.each(o, function(o, i) {
+					if (f.call(s, o, i, n) === false)
+						return false;
+
+					tinymce.walk(o, f, n, s);
+				});
+			}
+		},
+
+		createNS : function(n, o) {
+			var i, v;
+
+			o = o || win;
+
+			n = n.split('.');
+			for (i=0; i<n.length; i++) {
+				v = n[i];
+
+				if (!o[v])
+					o[v] = {};
+
+				o = o[v];
+			}
+
+			return o;
+		},
+
+		resolve : function(n, o) {
+			var i, l;
+
+			o = o || win;
+
+			n = n.split('.');
+			for (i = 0, l = n.length; i < l; i++) {
+				o = o[n[i]];
+
+				if (!o)
+					break;
+			}
+
+			return o;
+		},
+
+		addUnload : function(f, s) {
+			var t = this;
+
+			f = {func : f, scope : s || this};
+
+			if (!t.unloads) {
+				function unload() {
+					var li = t.unloads, o, n;
+
+					if (li) {
+						// Call unload handlers
+						for (n in li) {
+							o = li[n];
+
+							if (o && o.func)
+								o.func.call(o.scope, 1); // Send in one arg to distinct unload and user destroy
+						}
+
+						// Detach unload function
+						if (win.detachEvent) {
+							win.detachEvent('onbeforeunload', fakeUnload);
+							win.detachEvent('onunload', unload);
+						} else if (win.removeEventListener)
+							win.removeEventListener('unload', unload, false);
+
+						// Destroy references
+						t.unloads = o = li = w = unload = 0;
+
+						// Run garbarge collector on IE
+						if (win.CollectGarbage)
+							CollectGarbage();
+					}
+				};
+
+				function fakeUnload() {
+					var d = document;
+
+					// 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
+						win.setTimeout(function() {
+							if (d)
+								d.detachEvent('onstop', stop);
+						}, 0);
+					}
+				};
+
+				// Attach unload handler
+				if (win.attachEvent) {
+					win.attachEvent('onunload', unload);
+					win.attachEvent('onbeforeunload', fakeUnload);
+				} else if (win.addEventListener)
+					win.addEventListener('unload', unload, false);
+
+				// Setup initial unload handler array
+				t.unloads = [f];
+			} else
+				t.unloads.push(f);
+
+			return f;
+		},
+
+		removeUnload : function(f) {
+			var u = this.unloads, r = null;
+
+			tinymce.each(u, function(o, i) {
+				if (o && o.func == f) {
+					u.splice(i, 1);
+					r = f;
+					return false;
+				}
+			});
+
+			return r;
+		},
+
+		explode : function(s, d) {
+			return s ? tinymce.map(s.split(d || ','), tinymce.trim) : s;
+		},
+
+		_addVer : function(u) {
+			var v;
+
+			if (!this.query)
+				return u;
+
+			v = (u.indexOf('?') == -1 ? '?' : '&') + this.query;
+
+			if (u.indexOf('#') == -1)
+				return u + v;
+
+			return u.replace('#', v + '#');
+		},
+
+		// Fix function for IE 9 where regexps isn't working correctly
+		// Todo: remove me once MS fixes the bug
+		_replace : function(find, replace, str) {
+			// On IE9 we have to fake $x replacement
+			if (isRegExpBroken) {
+				return str.replace(find, function() {
+					var val = replace, args = arguments, i;
+
+					for (i = 0; i < args.length - 2; i++) {
+						if (args[i] === undefined) {
+							val = val.replace(new RegExp('\\$' + i, 'g'), '');
+						} else {
+							val = val.replace(new RegExp('\\$' + i, 'g'), args[i]);
+						}
+					}
+
+					return val;
+				});
+			}
+
+			return str.replace(find, replace);
+		}
+
+		};
+
+	// Initialize the API
+	tinymce._init();
+
+	// Expose tinymce namespace to the global namespace (window)
+	win.tinymce = win.tinyMCE = tinymce;
+
+	// Describe the different namespaces
+
+	})(window);
+
+
+tinymce.create('tinymce.util.Dispatcher', {
+	scope : null,
+	listeners : null,
+
+	Dispatcher : function(s) {
+		this.scope = s || this;
+		this.listeners = [];
+	},
+
+	add : function(cb, s) {
+		this.listeners.push({cb : cb, scope : s || this.scope});
+
+		return cb;
+	},
+
+	addToTop : function(cb, s) {
+		this.listeners.unshift({cb : cb, scope : s || this.scope});
+
+		return cb;
+	},
+
+	remove : function(cb) {
+		var l = this.listeners, o = null;
+
+		tinymce.each(l, function(c, i) {
+			if (cb == c.cb) {
+				o = cb;
+				l.splice(i, 1);
+				return false;
+			}
+		});
+
+		return o;
+	},
+
+	dispatch : function() {
+		var s, a = arguments, i, li = this.listeners, c;
+
+		// 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);
+
+			if (s === false)
+				break;
+		}
+
+		return s;
+	}
+
+	});
+
+(function() {
+	var each = tinymce.each;
+
+	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|data):/i.test(u) || /^\s*#/.test(u)) {
+				t.source = u;
+				return;
+			}
+
+			// 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, '@@');
+
+				t[v] = s;
+			});
+
+			if (b = s.base_uri) {
+				if (!t.protocol)
+					t.protocol = b.protocol;
+
+				if (!t.userInfo)
+					t.userInfo = b.userInfo;
+
+				if (!t.port && t.host == 'mce_host')
+					t.port = b.port;
+
+				if (!t.host || t.host == 'mce_host')
+					t.host = b.host;
+
+				t.source = '';
+			}
+
+			//t.path = t.path || '/';
+		},
+
+		setPath : function(p) {
+			var t = this;
+
+			p = /^(.*?)\/?(\w+)?$/.exec(p);
+
+			// Update path parts
+			t.path = p[0];
+			t.directory = p[1];
+			t.file = p[2];
+
+			// Rebuild source
+			t.source = '';
+			t.getURI();
+		},
+
+		toRelative : function(u) {
+			var t = this, o;
+
+			if (u === "./")
+				return u;
+
+			u = new tinymce.util.URI(u, {base_uri : t});
+
+			// 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();
+
+			o = t.toRelPath(t.path, u.path);
+
+			// Add query
+			if (u.query)
+				o += '?' + u.query;
+
+			// Add anchor
+			if (u.anchor)
+				o += '#' + u.anchor;
+
+			return o;
+		},
+	
+		toAbsolute : function(u, nh) {
+			var u = new tinymce.util.URI(u, {base_uri : this});
+
+			return u.getURI(this.host == u.host && this.protocol == u.protocol ? nh : 0);
+		},
+
+		toRelPath : function(base, path) {
+			var items, bp = 0, out = '', i, l;
+
+			// 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;
+					}
+				}
+			}
+
+			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;
+					}
+				}
+			}
+
+			if (bp == 1)
+				return path;
+
+			for (i = 0, l = base.length - (bp - 1); i < l; i++)
+				out += "../";
+
+			for (i = bp - 1, l = items.length; i < l; i++) {
+				if (i != bp - 1)
+					out += "/" + items[i];
+				else
+					out += items[i];
+			}
+
+			return out;
+		},
+
+		toAbsPath : function(base, path) {
+			var i, nb = 0, o = [], tr, outPath;
+
+			// Split paths
+			tr = /\/$/.test(path) ? '/' : '';
+			base = base.split('/');
+			path = path.split('/');
+
+			// Remove empty chunks
+			each(base, function(k) {
+				if (k)
+					o.push(k);
+			});
+
+			base = o;
+
+			// Merge relURLParts chunks
+			for (i = path.length - 1, o = []; i >= 0; i--) {
+				// Ignore empty or .
+				if (path[i].length == 0 || path[i] == ".")
+					continue;
+
+				// Is parent
+				if (path[i] == '..') {
+					nb++;
+					continue;
+				}
+
+				// Move up
+				if (nb > 0) {
+					nb--;
+					continue;
+				}
+
+				o.push(path[i]);
+			}
+
+			i = base.length - nb;
+
+			// If /a/b/c or /
+			if (i <= 0)
+				outPath = o.reverse().join('/');
+			else
+				outPath = base.slice(0, i).join('/') + '/' + o.reverse().join('/');
+
+			// Add front / if it's needed
+			if (outPath.indexOf('/') !== 0)
+				outPath = '/' + outPath;
+
+			// Add traling / if it's needed
+			if (tr && outPath.lastIndexOf('/') !== outPath.length - 1)
+				outPath += tr;
+
+			return outPath;
+		},
+
+		getURI : function(nh) {
+			var s, t = this;
+
+			// Rebuild source
+			if (!t.source || nh) {
+				s = '';
+
+				if (!nh) {
+					if (t.protocol)
+						s += t.protocol + '://';
+
+					if (t.userInfo)
+						s += t.userInfo + '@';
+
+					if (t.host)
+						s += t.host;
+
+					if (t.port)
+						s += ':' + t.port;
+				}
+
+				if (t.path)
+					s += t.path;
+
+				if (t.query)
+					s += '?' + t.query;
+
+				if (t.anchor)
+					s += '#' + t.anchor;
+
+				t.source = s;
+			}
+
+			return t.source;
+		}
+	});
+})();
+
+(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 = '';
+
+			each(v, function(v, k) {
+				o += (!o ? '' : '&') + escape(k) + '=' + escape(v);
+			});
+
+			this.set(n, o, e, p, d, s);
+		},
+
+		get : function(n) {
+			var c = document.cookie, e, p = n + "=", b;
+
+			// Strict mode
+			if (!c)
+				return;
+
+			b = c.indexOf("; " + p);
+
+			if (b == -1) {
+				b = c.indexOf(p);
+
+				if (b != 0)
+					return null;
+			} else
+				b += 2;
+
+			e = c.indexOf(";", b);
+
+			if (e == -1)
+				e = c.length;
+
+			return unescape(c.substring(b + p.length, e));
+		},
+
+		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" : "");
+		},
+
+		remove : function(n, p) {
+			var d = new Date();
+
+			d.setTime(d.getTime() - 1000);
+
+			this.set(n, '', d, p, d);
+		}
+	});
+})();
+
+(function() {
+	function serialize(o, quote) {
+		var i, v, t;
+
+		quote = quote || '"';
+
+		if (o == null)
+			return 'null';
+
+		t = typeof o;
+
+		if (t == 'string') {
+			v = '\bb\tt\nn\ff\rr\""\'\'\\\\';
+
+			return quote + o.replace(/([\u0080-\uFFFF\x00-\x1f\"\'\\])/g, function(a, b) {
+				// Make sure single quotes never get encoded inside double quotes for JSON compatibility
+				if (quote === '"' && a === "'")
+					return a;
+
+				i = v.indexOf(b);
+
+				if (i + 1)
+					return '\\' + v.charAt(i + 1);
+
+				a = b.charCodeAt().toString(16);
+
+				return '\\u' + '0000'.substring(a.length) + a;
+			}) + quote;
+		}
+
+		if (t == 'object') {
+			if (o.hasOwnProperty && o instanceof Array) {
+					for (i=0, v = '['; i<o.length; i++)
+						v += (i > 0 ? ',' : '') + serialize(o[i], quote);
+
+					return v + ']';
+				}
+
+				v = '{';
+
+				for (i in o)
+					v += typeof o[i] != 'function' ? (v.length > 1 ? ',' + quote : quote) + i + quote +':' + serialize(o[i], quote) : '';
+
+				return v + '}';
+		}
+
+		return '' + o;
+	};
+
+	tinymce.util.JSON = {
+		serialize: serialize,
+
+		parse: function(s) {
+			try {
+				return eval('(' + s + ')');
+			} catch (ex) {
+				// Ignore
+			}
+		}
+
+		};
+})();
+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 || '';
+
+		function get(s) {
+			x = 0;
+
+			try {
+				x = new ActiveXObject(s);
+			} catch (ex) {
+			}
+
+			return x;
+		};
+
+		x = w.XMLHttpRequest ? new XMLHttpRequest() : get('Microsoft.XMLHTTP') || get('Msxml2.XMLHTTP');
+
+		if (x) {
+			if (x.overrideMimeType)
+				x.overrideMimeType(o.content_type);
+
+			x.open(o.type || (o.data ? 'POST' : 'GET'), o.url, o.async);
+
+			if (o.content_type)
+				x.setRequestHeader('Content-Type', o.content_type);
+
+			x.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
+
+			x.send(o.data);
+
+			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);
+
+					x = null;
+				} else
+					w.setTimeout(ready, 10);
+			};
+
+			// Syncronous request
+			if (!o.async)
+				return ready();
+
+			// Wait for response, onReadyStateChange can not be used since it leaks memory in IE
+			t = w.setTimeout(ready, 10);
+		}
+	}
+});
+
+(function() {
+	var extend = tinymce.extend, JSON = tinymce.util.JSON, XHR = tinymce.util.XHR;
+
+	tinymce.create('tinymce.util.JSONRequest', {
+		JSONRequest : function(s) {
+			this.settings = extend({
+			}, s);
+			this.count = 0;
+		},
+
+		send : function(o) {
+			var ecb = o.error, scb = o.success;
+
+			o = extend(this.settings, o);
+
+			o.success = function(c, x) {
+				c = JSON.parse(c);
+
+				if (typeof(c) == 'undefined') {
+					c = {
+						error : 'JSON Parse error.'
+					};
+				}
+
+				if (c.error)
+					ecb.call(o.error_scope || o.scope, c.error, x);
+				else
+					scb.call(o.success_scope || o.scope, c.result);
+			};
+
+			o.error = function(ty, x) {
+				if (ecb)
+					ecb.call(o.error_scope || o.scope, ty, x);
+			};
+
+			o.data = JSON.serialize({
+				id : o.id || 'c' + (this.count++),
+				method : o.method,
+				params : o.params
+			});
+
+			// JSON content type for Ruby on rails. Bug: #1883287
+			o.content_type = 'application/json';
+
+			XHR.send(o);
+		},
+
+		'static' : {
+			sendRPC : function(o) {
+				return new tinymce.util.JSONRequest().send(o);
+			}
+		}
+	});
+}());
+(function(tinymce) {
+	var namedEntities, baseEntities, reverseEntities,
+		attrsCharsRegExp = /[&\"\u007E-\uD7FF]|[\uD800-\uDBFF][\uDC00-\uDFFF]/g,
+		textCharsRegExp = /[<>&\u007E-\uD7FF]|[\uD800-\uDBFF][\uDC00-\uDFFF]/g,
+		rawCharsRegExp = /[<>&\"\']/g,
+		entityRegExp = /&(#)?([\w]+);/g,
+		asciiMap = {
+				128 : "\u20AC", 130 : "\u201A", 131 : "\u0192", 132 : "\u201E", 133 : "\u2026", 134 : "\u2020",
+				135 : "\u2021", 136 : "\u02C6", 137 : "\u2030", 138 : "\u0160", 139 : "\u2039", 140 : "\u0152",
+				142 : "\u017D", 145 : "\u2018", 146 : "\u2019", 147 : "\u201C", 148 : "\u201D", 149 : "\u2022",
+				150 : "\u2013", 151 : "\u2014", 152 : "\u02DC", 153 : "\u2122", 154 : "\u0161", 155 : "\u203A",
+				156 : "\u0153", 158 : "\u017E", 159 : "\u0178"
+		};
+
+	// Raw entities
+	baseEntities = {
+		'"' : '&quot;',
+		"'" : '&#39;',
+		'<' : '&lt;',
+		'>' : '&gt;',
+		'&' : '&amp;'
+	};
+
+	// Reverse lookup table for raw entities
+	reverseEntities = {
+		'&lt;' : '<',
+		'&gt;' : '>',
+		'&amp;' : '&',
+		'&quot;' : '"',
+		'&apos;' : "'"
+	};
+
+	// Decodes text by using the browser
+	function nativeDecode(text) {
+		var elm;
+
+		elm = document.createElement("div");
+		elm.innerHTML = text;
+
+		return elm.textContent || elm.innerText || text;
+	};
+
+	// Build a two way lookup table for the entities
+	function buildEntitiesLookup(items, radix) {
+		var i, chr, entity, lookup = {};
+
+		if (items) {
+			items = items.split(',');
+			radix = radix || 10;
+
+			// Build entities lookup table
+			for (i = 0; i < items.length; i += 2) {
+				chr = String.fromCharCode(parseInt(items[i], radix));
+
+				// Only add non base entities
+				if (!baseEntities[chr]) {
+					entity = '&' + items[i + 1] + ';';
+					lookup[chr] = entity;
+					lookup[entity] = chr;
+				}
+			}
+
+			return lookup;
+		}
+	};
+
+	// Unpack entities lookup where the numbers are in radix 32 to reduce the size
+	namedEntities = buildEntitiesLookup(
+		'50,nbsp,51,iexcl,52,cent,53,pound,54,curren,55,yen,56,brvbar,57,sect,58,uml,59,copy,' +
+		'5a,ordf,5b,laquo,5c,not,5d,shy,5e,reg,5f,macr,5g,deg,5h,plusmn,5i,sup2,5j,sup3,5k,acute,' +
+		'5l,micro,5m,para,5n,middot,5o,cedil,5p,sup1,5q,ordm,5r,raquo,5s,frac14,5t,frac12,5u,frac34,' +
+		'5v,iquest,60,Agrave,61,Aacute,62,Acirc,63,Atilde,64,Auml,65,Aring,66,AElig,67,Ccedil,' +
+		'68,Egrave,69,Eacute,6a,Ecirc,6b,Euml,6c,Igrave,6d,Iacute,6e,Icirc,6f,Iuml,6g,ETH,6h,Ntilde,' +
+		'6i,Ograve,6j,Oacute,6k,Ocirc,6l,Otilde,6m,Ouml,6n,times,6o,Oslash,6p,Ugrave,6q,Uacute,' +
+		'6r,Ucirc,6s,Uuml,6t,Yacute,6u,THORN,6v,szlig,70,agrave,71,aacute,72,acirc,73,atilde,74,auml,' +
+		'75,aring,76,aelig,77,ccedil,78,egrave,79,eacute,7a,ecirc,7b,euml,7c,igrave,7d,iacute,7e,icirc,' +
+		'7f,iuml,7g,eth,7h,ntilde,7i,ograve,7j,oacute,7k,ocirc,7l,otilde,7m,ouml,7n,divide,7o,oslash,' +
+		'7p,ugrave,7q,uacute,7r,ucirc,7s,uuml,7t,yacute,7u,thorn,7v,yuml,ci,fnof,sh,Alpha,si,Beta,' +
+		'sj,Gamma,sk,Delta,sl,Epsilon,sm,Zeta,sn,Eta,so,Theta,sp,Iota,sq,Kappa,sr,Lambda,ss,Mu,' +
+		'st,Nu,su,Xi,sv,Omicron,t0,Pi,t1,Rho,t3,Sigma,t4,Tau,t5,Upsilon,t6,Phi,t7,Chi,t8,Psi,' +
+		't9,Omega,th,alpha,ti,beta,tj,gamma,tk,delta,tl,epsilon,tm,zeta,tn,eta,to,theta,tp,iota,' +
+		'tq,kappa,tr,lambda,ts,mu,tt,nu,tu,xi,tv,omicron,u0,pi,u1,rho,u2,sigmaf,u3,sigma,u4,tau,' +
+		'u5,upsilon,u6,phi,u7,chi,u8,psi,u9,omega,uh,thetasym,ui,upsih,um,piv,812,bull,816,hellip,' +
+		'81i,prime,81j,Prime,81u,oline,824,frasl,88o,weierp,88h,image,88s,real,892,trade,89l,alefsym,' +
+		'8cg,larr,8ch,uarr,8ci,rarr,8cj,darr,8ck,harr,8dl,crarr,8eg,lArr,8eh,uArr,8ei,rArr,8ej,dArr,' +
+		'8ek,hArr,8g0,forall,8g2,part,8g3,exist,8g5,empty,8g7,nabla,8g8,isin,8g9,notin,8gb,ni,8gf,prod,' +
+		'8gh,sum,8gi,minus,8gn,lowast,8gq,radic,8gt,prop,8gu,infin,8h0,ang,8h7,and,8h8,or,8h9,cap,8ha,cup,' +
+		'8hb,int,8hk,there4,8hs,sim,8i5,cong,8i8,asymp,8j0,ne,8j1,equiv,8j4,le,8j5,ge,8k2,sub,8k3,sup,8k4,' +
+		'nsub,8k6,sube,8k7,supe,8kl,oplus,8kn,otimes,8l5,perp,8m5,sdot,8o8,lceil,8o9,rceil,8oa,lfloor,8ob,' +
+		'rfloor,8p9,lang,8pa,rang,9ea,loz,9j0,spades,9j3,clubs,9j5,hearts,9j6,diams,ai,OElig,aj,oelig,b0,' +
+		'Scaron,b1,scaron,bo,Yuml,m6,circ,ms,tilde,802,ensp,803,emsp,809,thinsp,80c,zwnj,80d,zwj,80e,lrm,' +
+		'80f,rlm,80j,ndash,80k,mdash,80o,lsquo,80p,rsquo,80q,sbquo,80s,ldquo,80t,rdquo,80u,bdquo,810,dagger,' +
+		'811,Dagger,81g,permil,81p,lsaquo,81q,rsaquo,85c,euro'
+	, 32);
+
+	tinymce.html = tinymce.html || {};
+
+	tinymce.html.Entities = {
+		encodeRaw : function(text, attr) {
+			return text.replace(attr ? attrsCharsRegExp : textCharsRegExp, function(chr) {
+				return baseEntities[chr] || chr;
+			});
+		},
+
+		encodeAllRaw : function(text) {
+			return ('' + text).replace(rawCharsRegExp, function(chr) {
+				return baseEntities[chr] || chr;
+			});
+		},
+
+		encodeNumeric : function(text, attr) {
+			return text.replace(attr ? attrsCharsRegExp : textCharsRegExp, function(chr) {
+				// Multi byte sequence convert it to a single entity
+				if (chr.length > 1)
+					return '&#' + (((chr.charCodeAt(0) - 0xD800) * 0x400) + (chr.charCodeAt(1) - 0xDC00) + 0x10000) + ';';
+
+				return baseEntities[chr] || '&#' + chr.charCodeAt(0) + ';';
+			});
+		},
+
+		encodeNamed : function(text, attr, entities) {
+			entities = entities || namedEntities;
+
+			return text.replace(attr ? attrsCharsRegExp : textCharsRegExp, function(chr) {
+				return baseEntities[chr] || entities[chr] || chr;
+			});
+		},
+
+		getEncodeFunc : function(name, entities) {
+			var Entities = tinymce.html.Entities;
+
+			entities = buildEntitiesLookup(entities) || namedEntities;
+
+			function encodeNamedAndNumeric(text, attr) {
+				return text.replace(attr ? attrsCharsRegExp : textCharsRegExp, function(chr) {
+					return baseEntities[chr] || entities[chr] || '&#' + chr.charCodeAt(0) + ';' || chr;
+				});
+			};
+
+			function encodeCustomNamed(text, attr) {
+				return Entities.encodeNamed(text, attr, entities);
+			};
+
+			// Replace + with , to be compatible with previous TinyMCE versions
+			name = tinymce.makeMap(name.replace(/\+/g, ','));
+
+			// Named and numeric encoder
+			if (name.named && name.numeric)
+				return encodeNamedAndNumeric;
+
+			// Named encoder
+			if (name.named) {
+				// Custom names
+				if (entities)
+					return encodeCustomNamed;
+
+				return Entities.encodeNamed;
+			}
+
+			// Numeric
+			if (name.numeric)
+				return Entities.encodeNumeric;
+
+			// Raw encoder
+			return Entities.encodeRaw;
+		},
+
+		decode : function(text) {
+			return text.replace(entityRegExp, function(all, numeric, value) {
+				if (numeric) {
+					value = parseInt(value);
+
+					// Support upper UTF
+					if (value > 0xFFFF) {
+						value -= 0x10000;
+
+						return String.fromCharCode(0xD800 + (value >> 10), 0xDC00 + (value & 0x3FF));
+					} else
+						return asciiMap[value] || String.fromCharCode(value);
+				}
+
+				return reverseEntities[all] || namedEntities[all] || nativeDecode(all);
+			});
+		}
+	};
+})(tinymce);
+
+tinymce.html.Styles = function(settings, schema) {
+	var rgbRegExp = /rgb\s*\(\s*([0-9]+)\s*,\s*([0-9]+)\s*,\s*([0-9]+)\s*\)/gi,
+		urlOrStrRegExp = /(?:url(?:(?:\(\s*\"([^\"]+)\"\s*\))|(?:\(\s*\'([^\']+)\'\s*\))|(?:\(\s*([^)\s]+)\s*\))))|(?:\'([^\']+)\')|(?:\"([^\"]+)\")/gi,
+		styleRegExp = /\s*([^:]+):\s*([^;]+);?/g,
+		trimRightRegExp = /\s+$/,
+		urlColorRegExp = /rgb/,
+		undef, i, encodingLookup = {}, encodingItems;
+
+	settings = settings || {};
+
+	encodingItems = '\\" \\\' \\; \\: ; : _'.split(' ');
+	for (i = 0; i < encodingItems.length; i++) {
+		encodingLookup[encodingItems[i]] = '_' + i;
+		encodingLookup['_' + i] = encodingItems[i];
+	}
+
+	function toHex(match, r, g, b) {
+		function hex(val) {
+			val = parseInt(val).toString(16);
+
+			return val.length > 1 ? val : '0' + val; // 0 -> 00
+		};
+
+		return '#' + hex(r) + hex(g) + hex(b);
+	};
+
+	return {
+		toHex : function(color) {
+			return color.replace(rgbRegExp, toHex);
+		},
+
+		parse : function(css) {
+			var styles = {}, matches, name, value, isEncoded, urlConverter = settings.url_converter, urlConverterScope = settings.url_converter_scope || this;
+
+			function compress(prefix, suffix) {
+				var top, right, bottom, left;
+
+				// Get values and check it it needs compressing
+				top = styles[prefix + '-top' + suffix];
+				if (!top)
+					return;
+
+				right = styles[prefix + '-right' + suffix];
+				if (top != right)
+					return;
+
+				bottom = styles[prefix + '-bottom' + suffix];
+				if (right != bottom)
+					return;
+
+				left = styles[prefix + '-left' + suffix];
+				if (bottom != left)
+					return;
+
+				// Compress
+				styles[prefix + suffix] = left;
+				delete styles[prefix + '-top' + suffix];
+				delete styles[prefix + '-right' + suffix];
+				delete styles[prefix + '-bottom' + suffix];
+				delete styles[prefix + '-left' + suffix];
+			};
+
+			function canCompress(key) {
+				var value = styles[key], i;
+
+				if (!value || value.indexOf(' ') < 0)
+					return;
+
+				value = value.split(' ');
+				i = value.length;
+				while (i--) {
+					if (value[i] !== value[0])
+						return false;
+				}
+
+				styles[key] = value[0];
+
+				return true;
+			};
+
+			function compress2(target, a, b, c) {
+				if (!canCompress(a))
+					return;
+
+				if (!canCompress(b))
+					return;
+
+				if (!canCompress(c))
+					return;
+
+				// Compress
+				styles[target] = styles[a] + ' ' + styles[b] + ' ' + styles[c];
+				delete styles[a];
+				delete styles[b];
+				delete styles[c];
+			};
+
+			// Encodes the specified string by replacing all \" \' ; : with _<num>
+			function encode(str) {
+				isEncoded = true;
+
+				return encodingLookup[str];
+			};
+
+			// Decodes the specified string by replacing all _<num> with it's original value \" \' etc
+			// It will also decode the \" \' if keep_slashes is set to fale or omitted
+			function decode(str, keep_slashes) {
+				if (isEncoded) {
+					str = str.replace(/_[0-9]/g, function(str) {
+						return encodingLookup[str];
+					});
+				}
+
+				if (!keep_slashes)
+					str = str.replace(/\\([\'\";:])/g, "$1");
+
+				return str;
+			}
+
+			if (css) {
+				// Encode \" \' % and ; and : inside strings so they don't interfere with the style parsing
+				css = css.replace(/\\[\"\';:_]/g, encode).replace(/\"[^\"]+\"|\'[^\']+\'/g, function(str) {
+					return str.replace(/[;:]/g, encode);
+				});
+
+				// Parse styles
+				while (matches = styleRegExp.exec(css)) {
+					name = matches[1].replace(trimRightRegExp, '').toLowerCase();
+					value = matches[2].replace(trimRightRegExp, '');
+
+					if (name && value.length > 0) {
+						// Opera will produce 700 instead of bold in their style values
+						if (name === 'font-weight' && value === '700')
+							value = 'bold';
+						else if (name === 'color' || name === 'background-color') // Lowercase colors like RED
+							value = value.toLowerCase();		
+
+						// Convert RGB colors to HEX
+						value = value.replace(rgbRegExp, toHex);
+
+						// Convert URLs and force them into url('value') format
+						value = value.replace(urlOrStrRegExp, function(match, url, url2, url3, str, str2) {
+							str = str || str2;
+
+							if (str) {
+								str = decode(str);
+
+								// Force strings into single quote format
+								return "'" + str.replace(/\'/g, "\\'") + "'";
+							}
+
+							url = decode(url || url2 || url3);
+
+							// Convert the URL to relative/absolute depending on config
+							if (urlConverter)
+								url = urlConverter.call(urlConverterScope, url, 'style');
+
+							// Output new URL format
+							return "url('" + url.replace(/\'/g, "\\'") + "')";
+						});
+
+						styles[name] = isEncoded ? decode(value, true) : value;
+					}
+
+					styleRegExp.lastIndex = matches.index + matches[0].length;
+				}
+
+				// Compress the styles to reduce it's size for example IE will expand styles
+				compress("border", "");
+				compress("border", "-width");
+				compress("border", "-color");
+				compress("border", "-style");
+				compress("padding", "");
+				compress("margin", "");
+				compress2('border', 'border-width', 'border-style', 'border-color');
+
+				// Remove pointless border, IE produces these
+				if (styles.border === 'medium none')
+					delete styles.border;
+			}
+
+			return styles;
+		},
+
+		serialize : function(styles, element_name) {
+			var css = '', name, value;
+
+			function serializeStyles(name) {
+				var styleList, i, l, name, value;
+
+				styleList = schema.styles[name];
+				if (styleList) {
+					for (i = 0, l = styleList.length; i < l; i++) {
+						name = styleList[i];
+						value = styles[name];
+
+						if (value !== undef)
+							css += (css.length > 0 ? ' ' : '') + name + ': ' + value + ';';
+					}
+				}
+			};
+
+			// Serialize styles according to schema
+			if (element_name && schema && schema.styles) {
+				// Serialize global styles and element specific styles
+				serializeStyles('*');
+				serializeStyles(name);
+			} else {
+				// Output the styles in the order they are inside the object
+				for (name in styles) {
+					value = styles[name];
+
+					if (value !== undef)
+						css += (css.length > 0 ? ' ' : '') + name + ': ' + value + ';';
+				}
+			}
+
+			return css;
+		}
+	};
+};
+
+(function(tinymce) {
+	var transitional = {}, boolAttrMap, blockElementsMap, shortEndedElementsMap, nonEmptyElementsMap,
+		whiteSpaceElementsMap, selfClosingElementsMap, makeMap = tinymce.makeMap, each = tinymce.each;
+
+	function split(str, delim) {
+		return str.split(delim || ',');
+	};
+
+	function unpack(lookup, data) {
+		var key, elements = {};
+
+		function replace(value) {
+			return value.replace(/[A-Z]+/g, function(key) {
+				return replace(lookup[key]);
+			});
+		};
+
+		// Unpack lookup
+		for (key in lookup) {
+			if (lookup.hasOwnProperty(key))
+				lookup[key] = replace(lookup[key]);
+		}
+
+		// Unpack and parse data into object map
+		replace(data).replace(/#/g, '#text').replace(/(\w+)\[([^\]]+)\]\[([^\]]*)\]/g, function(str, name, attributes, children) {
+			attributes = split(attributes, '|');
+
+			elements[name] = {
+				attributes : makeMap(attributes),
+				attributesOrder : attributes,
+				children : makeMap(children, '|', {'#comment' : {}})
+			}
+		});
+
+		return elements;
+	};
+
+	// Build a lookup table for block elements both lowercase and uppercase
+	blockElementsMap = 'h1,h2,h3,h4,h5,h6,hr,p,div,address,pre,form,table,tbody,thead,tfoot,' + 
+						'th,tr,td,li,ol,ul,caption,blockquote,center,dl,dt,dd,dir,fieldset,' + 
+						'noscript,menu,isindex,samp,header,footer,article,section,hgroup';
+	blockElementsMap = makeMap(blockElementsMap, ',', makeMap(blockElementsMap.toUpperCase()));
+
+	// This is the XHTML 1.0 transitional elements with it's attributes and children packed to reduce it's size
+	transitional = unpack({
+		Z : 'H|K|N|O|P',
+		Y : 'X|form|R|Q',
+		ZG : 'E|span|width|align|char|charoff|valign',
+		X : 'p|T|div|U|W|isindex|fieldset|table',
+		ZF : 'E|align|char|charoff|valign',
+		W : 'pre|hr|blockquote|address|center|noframes',
+		ZE : 'abbr|axis|headers|scope|rowspan|colspan|align|char|charoff|valign|nowrap|bgcolor|width|height',
+		ZD : '[E][S]',
+		U : 'ul|ol|dl|menu|dir',
+		ZC : 'p|Y|div|U|W|table|br|span|bdo|object|applet|img|map|K|N|Q',
+		T : 'h1|h2|h3|h4|h5|h6',
+		ZB : 'X|S|Q',
+		S : 'R|P',
+		ZA : 'a|G|J|M|O|P',
+		R : 'a|H|K|N|O',
+		Q : 'noscript|P',
+		P : 'ins|del|script',
+		O : 'input|select|textarea|label|button',
+		N : 'M|L',
+		M : 'em|strong|dfn|code|q|samp|kbd|var|cite|abbr|acronym',
+		L : 'sub|sup',
+		K : 'J|I',
+		J : 'tt|i|b|u|s|strike',
+		I : 'big|small|font|basefont',
+		H : 'G|F',
+		G : 'br|span|bdo',
+		F : 'object|applet|img|map|iframe',
+		E : 'A|B|C',
+		D : 'accesskey|tabindex|onfocus|onblur',
+		C : 'onclick|ondblclick|onmousedown|onmouseup|onmouseover|onmousemove|onmouseout|onkeypress|onkeydown|onkeyup',
+		B : 'lang|xml:lang|dir',
+		A : 'id|class|style|title'
+	}, 'script[id|charset|type|language|src|defer|xml:space][]' + 
+		'style[B|id|type|media|title|xml:space][]' + 
+		'object[E|declare|classid|codebase|data|type|codetype|archive|standby|width|height|usemap|name|tabindex|align|border|hspace|vspace][#|param|Y]' + 
+		'param[id|name|value|valuetype|type][]' + 
+		'p[E|align][#|S]' + 
+		'a[E|D|charset|type|name|href|hreflang|rel|rev|shape|coords|target][#|Z]' + 
+		'br[A|clear][]' + 
+		'span[E][#|S]' + 
+		'bdo[A|C|B][#|S]' + 
+		'applet[A|codebase|archive|code|object|alt|name|width|height|align|hspace|vspace][#|param|Y]' + 
+		'h1[E|align][#|S]' + 
+		'img[E|src|alt|name|longdesc|width|height|usemap|ismap|align|border|hspace|vspace][]' + 
+		'map[B|C|A|name][X|form|Q|area]' + 
+		'h2[E|align][#|S]' + 
+		'iframe[A|longdesc|name|src|frameborder|marginwidth|marginheight|scrolling|align|width|height][#|Y]' + 
+		'h3[E|align][#|S]' + 
+		'tt[E][#|S]' + 
+		'i[E][#|S]' + 
+		'b[E][#|S]' + 
+		'u[E][#|S]' + 
+		's[E][#|S]' + 
+		'strike[E][#|S]' + 
+		'big[E][#|S]' + 
+		'small[E][#|S]' + 
+		'font[A|B|size|color|face][#|S]' + 
+		'basefont[id|size|color|face][]' + 
+		'em[E][#|S]' + 
+		'strong[E][#|S]' + 
+		'dfn[E][#|S]' + 
+		'code[E][#|S]' + 
+		'q[E|cite][#|S]' + 
+		'samp[E][#|S]' + 
+		'kbd[E][#|S]' + 
+		'var[E][#|S]' + 
+		'cite[E][#|S]' + 
+		'abbr[E][#|S]' + 
+		'acronym[E][#|S]' + 
+		'sub[E][#|S]' + 
+		'sup[E][#|S]' + 
+		'input[E|D|type|name|value|checked|disabled|readonly|size|maxlength|src|alt|usemap|onselect|onchange|accept|align][]' + 
+		'select[E|name|size|multiple|disabled|tabindex|onfocus|onblur|onchange][optgroup|option]' + 
+		'optgroup[E|disabled|label][option]' + 
+		'option[E|selected|disabled|label|value][]' + 
+		'textarea[E|D|name|rows|cols|disabled|readonly|onselect|onchange][]' + 
+		'label[E|for|accesskey|onfocus|onblur][#|S]' + 
+		'button[E|D|name|value|type|disabled][#|p|T|div|U|W|table|G|object|applet|img|map|K|N|Q]' + 
+		'h4[E|align][#|S]' + 
+		'ins[E|cite|datetime][#|Y]' + 
+		'h5[E|align][#|S]' + 
+		'del[E|cite|datetime][#|Y]' + 
+		'h6[E|align][#|S]' + 
+		'div[E|align][#|Y]' + 
+		'ul[E|type|compact][li]' + 
+		'li[E|type|value][#|Y]' + 
+		'ol[E|type|compact|start][li]' + 
+		'dl[E|compact][dt|dd]' + 
+		'dt[E][#|S]' + 
+		'dd[E][#|Y]' + 
+		'menu[E|compact][li]' + 
+		'dir[E|compact][li]' + 
+		'pre[E|width|xml:space][#|ZA]' + 
+		'hr[E|align|noshade|size|width][]' + 
+		'blockquote[E|cite][#|Y]' + 
+		'address[E][#|S|p]' + 
+		'center[E][#|Y]' + 
+		'noframes[E][#|Y]' + 
+		'isindex[A|B|prompt][]' + 
+		'fieldset[E][#|legend|Y]' + 
+		'legend[E|accesskey|align][#|S]' + 
+		'table[E|summary|width|border|frame|rules|cellspacing|cellpadding|align|bgcolor][caption|col|colgroup|thead|tfoot|tbody|tr]' + 
+		'caption[E|align][#|S]' + 
+		'col[ZG][]' + 
+		'colgroup[ZG][col]' + 
+		'thead[ZF][tr]' + 
+		'tr[ZF|bgcolor][th|td]' + 
+		'th[E|ZE][#|Y]' + 
+		'form[E|action|method|name|enctype|onsubmit|onreset|accept|accept-charset|target][#|X|R|Q]' + 
+		'noscript[E][#|Y]' + 
+		'td[E|ZE][#|Y]' + 
+		'tfoot[ZF][tr]' + 
+		'tbody[ZF][tr]' + 
+		'area[E|D|shape|coords|href|nohref|alt|target][]' + 
+		'base[id|href|target][]' + 
+		'body[E|onload|onunload|background|bgcolor|text|link|vlink|alink][#|Y]'
+	);
+
+	boolAttrMap = makeMap('checked,compact,declare,defer,disabled,ismap,multiple,nohref,noresize,noshade,nowrap,readonly,selected,preload,autoplay,loop,controls');
+	shortEndedElementsMap = makeMap('area,base,basefont,br,col,frame,hr,img,input,isindex,link,meta,param,embed,source');
+	nonEmptyElementsMap = tinymce.extend(makeMap('td,th,iframe,video,object'), shortEndedElementsMap);
+	whiteSpaceElementsMap = makeMap('pre,script,style');
+	selfClosingElementsMap = makeMap('colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr');
+
+	tinymce.html.Schema = function(settings) {
+		var self = this, elements = {}, children = {}, patternElements = [], validStyles;
+
+		settings = settings || {};
+
+		// Allow all elements and attributes if verify_html is set to false
+		if (settings.verify_html === false)
+			settings.valid_elements = '*[*]';
+
+		// Build styles list
+		if (settings.valid_styles) {
+			validStyles = {};
+
+			// Convert styles into a rule list
+			each(settings.valid_styles, function(value, key) {
+				validStyles[key] = tinymce.explode(value);
+			});
+		}
+
+		// Converts a wildcard expression string to a regexp for example *a will become /.*a/.
+		function patternToRegExp(str) {
+			return new RegExp('^' + str.replace(/([?+*])/g, '.$1') + '$');
+		};
+
+		// Parses the specified valid_elements string and adds to the current rules
+		// This function is a bit hard to read since it's heavily optimized for speed
+		function addValidElements(valid_elements) {
+			var ei, el, ai, al, yl, matches, element, attr, attrData, elementName, attrName, attrType, attributes, attributesOrder,
+				prefix, outputName, globalAttributes, globalAttributesOrder, transElement, key, childKey, value,
+				elementRuleRegExp = /^([#+-])?([^\[\/]+)(?:\/([^\[]+))?(?:\[([^\]]+)\])?$/,
+				attrRuleRegExp = /^([!\-])?(\w+::\w+|[^=:<]+)?(?:([=:<])(.*))?$/,
+				hasPatternsRegExp = /[*?+]/;
+
+			if (valid_elements) {
+				// Split valid elements into an array with rules
+				valid_elements = split(valid_elements);
+
+				if (elements['@']) {
+					globalAttributes = elements['@'].attributes;
+					globalAttributesOrder = elements['@'].attributesOrder;
+				}
+
+				// Loop all rules
+				for (ei = 0, el = valid_elements.length; ei < el; ei++) {
+					// Parse element rule
+					matches = elementRuleRegExp.exec(valid_elements[ei]);
+					if (matches) {
+						// Setup local names for matches
+						prefix = matches[1];
+						elementName = matches[2];
+						outputName = matches[3];
+						attrData = matches[4];
+
+						// Create new attributes and attributesOrder
+						attributes = {};
+						attributesOrder = [];
+
+						// Create the new element
+						element = {
+							attributes : attributes,
+							attributesOrder : attributesOrder
+						};
+
+						// Padd empty elements prefix
+						if (prefix === '#')
+							element.paddEmpty = true;
+
+						// Remove empty elements prefix
+						if (prefix === '-')
+							element.removeEmpty = true;
+
+						// Copy attributes from global rule into current rule
+						if (globalAttributes) {
+							for (key in globalAttributes)
+								attributes[key] = globalAttributes[key];
+
+							attributesOrder.push.apply(attributesOrder, globalAttributesOrder);
+						}
+
+						// Attributes defined
+						if (attrData) {
+							attrData = split(attrData, '|');
+							for (ai = 0, al = attrData.length; ai < al; ai++) {
+								matches = attrRuleRegExp.exec(attrData[ai]);
+								if (matches) {
+									attr = {};
+									attrType = matches[1];
+									attrName = matches[2].replace(/::/g, ':');
+									prefix = matches[3];
+									value = matches[4];
+
+									// Required
+									if (attrType === '!') {
+										element.attributesRequired = element.attributesRequired || [];
+										element.attributesRequired.push(attrName);
+										attr.required = true;
+									}
+
+									// Denied from global
+									if (attrType === '-') {
+										delete attributes[attrName];
+										attributesOrder.splice(tinymce.inArray(attributesOrder, attrName), 1);
+										continue;
+									}
+
+									// Default value
+									if (prefix) {
+										// Default value
+										if (prefix === '=') {
+											element.attributesDefault = element.attributesDefault || [];
+											element.attributesDefault.push({name: attrName, value: value});
+											attr.defaultValue = value;
+										}
+
+										// Forced value
+										if (prefix === ':') {
+											element.attributesForced = element.attributesForced || [];
+											element.attributesForced.push({name: attrName, value: value});
+											attr.forcedValue = value;
+										}
+
+										// Required values
+										if (prefix === '<')
+											attr.validValues = makeMap(value, '?');
+									}
+
+									// Check for attribute patterns
+									if (hasPatternsRegExp.test(attrName)) {
+										element.attributePatterns = element.attributePatterns || [];
+										attr.pattern = patternToRegExp(attrName);
+										element.attributePatterns.push(attr);
+									} else {
+										// Add attribute to order list if it doesn't already exist
+										if (!attributes[attrName])
+											attributesOrder.push(attrName);
+
+										attributes[attrName] = attr;
+									}
+								}
+							}
+						}
+
+						// Global rule, store away these for later usage
+						if (!globalAttributes && elementName == '@') {
+							globalAttributes = attributes;
+							globalAttributesOrder = attributesOrder;
+						}
+
+						// Handle substitute elements such as b/strong
+						if (outputName) {
+							element.outputName = elementName;
+							elements[outputName] = element;
+						}
+
+						// Add pattern or exact element
+						if (hasPatternsRegExp.test(elementName)) {
+							element.pattern = patternToRegExp(elementName);
+							patternElements.push(element);
+						} else
+							elements[elementName] = element;
+					}
+				}
+			}
+		};
+
+		function setValidElements(valid_elements) {
+			elements = {};
+			patternElements = [];
+
+			addValidElements(valid_elements);
+
+			each(transitional, function(element, name) {
+				children[name] = element.children;
+			});
+		};
+
+		// Adds custom non HTML elements to the schema
+		function addCustomElements(custom_elements) {
+			var customElementRegExp = /^(~)?(.+)$/;
+
+			if (custom_elements) {
+				each(split(custom_elements), function(rule) {
+					var matches = customElementRegExp.exec(rule),
+						cloneName = matches[1] === '~' ? 'span' : 'div',
+						name = matches[2];
+
+					children[name] = children[cloneName];
+
+					// Add custom elements at span/div positions
+					each(children, function(element, child) {
+						if (element[cloneName])
+							element[name] = element[cloneName];
+					});
+				});
+			}
+		};
+
+		// Adds valid children to the schema object
+		function addValidChildren(valid_children) {
+			var childRuleRegExp = /^([+\-]?)(\w+)\[([^\]]+)\]$/;
+
+			if (valid_children) {
+				each(split(valid_children), function(rule) {
+					var matches = childRuleRegExp.exec(rule), parent, prefix;
+
+					if (matches) {
+						prefix = matches[1];
+
+						// Add/remove items from default
+						if (prefix)
+							parent = children[matches[2]];
+						else
+							parent = children[matches[2]] = {'#comment' : {}};
+
+						parent = children[matches[2]];
+
+						each(split(matches[3], '|'), function(child) {
+							if (prefix === '-')
+								delete parent[child];
+							else
+								parent[child] = {};
+						});
+					}
+				});
+			}
+		}
+
+		if (!settings.valid_elements) {
+			// No valid elements defined then clone the elements from the transitional spec
+			each(transitional, function(element, name) {
+				elements[name] = {
+					attributes : element.attributes,
+					attributesOrder : element.attributesOrder
+				};
+
+				children[name] = element.children;
+			});
+
+			// Switch these
+			each(split('strong/b,em/i'), function(item) {
+				item = split(item, '/');
+				elements[item[1]].outputName = item[0];
+			});
+
+			// Add default alt attribute for images
+			elements.img.attributesDefault = [{name: 'alt', value: ''}];
+
+			// Remove these if they are empty by default
+			each(split('ol,ul,li,sub,sup,blockquote,tr,div,span,font,a,table,tbody'), function(name) {
+				elements[name].removeEmpty = true;
+			});
+
+			// Padd these by default
+			each(split('p,h1,h2,h3,h4,h5,h6,th,td,pre,div,address,caption'), function(name) {
+				elements[name].paddEmpty = true;
+			});
+		} else
+			setValidElements(settings.valid_elements);
+
+		addCustomElements(settings.custom_elements);
+		addValidChildren(settings.valid_children);
+		addValidElements(settings.extended_valid_elements);
+
+		// Todo: Remove this when we fix list handling to be valid
+		addValidChildren('+ol[ul|ol],+ul[ul|ol]');
+
+		// Delete invalid elements
+		if (settings.invalid_elements) {
+			tinymce.each(tinymce.explode(settings.invalid_elements), function(item) {
+				if (elements[item])
+					delete elements[item];
+			});
+		}
+
+		self.children = children;
+
+		self.styles = validStyles;
+
+		self.getBoolAttrs = function() {
+			return boolAttrMap;
+		};
+
+		self.getBlockElements = function() {
+			return blockElementsMap;
+		};
+
+		self.getShortEndedElements = function() {
+			return shortEndedElementsMap;
+		};
+
+		self.getSelfClosingElements = function() {
+			return selfClosingElementsMap;
+		};
+
+		self.getNonEmptyElements = function() {
+			return nonEmptyElementsMap;
+		};
+
+		self.getWhiteSpaceElements = function() {
+			return whiteSpaceElementsMap;
+		};
+
+		self.isValidChild = function(name, child) {
+			var parent = children[name];
+
+			return !!(parent && parent[child]);
+		};
+
+		self.getElementRule = function(name) {
+			var element = elements[name], i;
+
+			// Exact match found
+			if (element)
+				return element;
+
+			// No exact match then try the patterns
+			i = patternElements.length;
+			while (i--) {
+				element = patternElements[i];
+
+				if (element.pattern.test(name))
+					return element;
+			}
+		};
+
+		self.addValidElements = addValidElements;
+
+		self.setValidElements = setValidElements;
+
+		self.addCustomElements = addCustomElements;
+
+		self.addValidChildren = addValidChildren;
+	};
+
+	// Expose boolMap and blockElementMap as static properties for usage in DOMUtils
+	tinymce.html.Schema.boolAttrMap = boolAttrMap;
+	tinymce.html.Schema.blockElementsMap = blockElementsMap;
+})(tinymce);
+
+(function(tinymce) {
+	tinymce.html.SaxParser = function(settings, schema) {
+		var self = this, noop = function() {};
+
+		settings = settings || {};
+		self.schema = schema = schema || new tinymce.html.Schema();
+
+		if (settings.fix_self_closing !== false)
+			settings.fix_self_closing = true;
+
+		// Add handler functions from settings and setup default handlers
+		tinymce.each('comment cdata text start end pi doctype'.split(' '), function(name) {
+			if (name)
+				self[name] = settings[name] || noop;
+		});
+
+		self.parse = function(html) {
+			var self = this, matches, index = 0, value, endRegExp, stack = [], attrList, i, text, name,
+				shortEndedElements, fillAttrsMap, isShortEnded, validate, elementRule, isValidElement, attr, attribsValue,
+				validAttributesMap, validAttributePatterns, attributesRequired, attributesDefault, attributesForced, selfClosing,
+				tokenRegExp, attrRegExp, specialElements, attrValue, idCount = 0, decode = tinymce.html.Entities.decode, fixSelfClosing;
+
+			function processEndTag(name) {
+				var pos, i;
+
+				// Find position of parent of the same type
+				pos = stack.length;
+				while (pos--) {
+					if (stack[pos].name === name)
+						break;						
+				}
+
+				// Found parent
+				if (pos >= 0) {
+					// Close all the open elements
+					for (i = stack.length - 1; i >= pos; i--) {
+						name = stack[i];
+
+						if (name.valid)
+							self.end(name.name);
+					}
+
+					// Remove the open elements from the stack
+					stack.length = pos;
+				}
+			};
+
+			// Precompile RegExps and map objects
+			tokenRegExp = new RegExp('<(?:' +
+				'(?:!--([\\w\\W]*?)-->)|' + // Comment
+				'(?:!\\[CDATA\\[([\\w\\W]*?)\\]\\]>)|' + // CDATA
+				'(?:!DOCTYPE([\\w\\W]*?)>)|' + // DOCTYPE
+				'(?:\\?([^\\s\\/<>]+) ?([\\w\\W]*?)[?/]>)|' + // PI
+				'(?:\\/([^>]+)>)|' + // End element
+				'(?:([^\\s\\/<>]+)\\s*((?:[^"\'>]+(?:(?:"[^"]*")|(?:\'[^\']*\')|[^>]*))*)>)' + // Start element
+			')', 'g');
+
+			attrRegExp = /([\w:\-]+)(?:\s*=\s*(?:(?:\"((?:\\.|[^\"])*)\")|(?:\'((?:\\.|[^\'])*)\')|([^>\s]+)))?/g;
+			specialElements = {
+				'script' : /<\/script[^>]*>/gi,
+				'style' : /<\/style[^>]*>/gi,
+				'noscript' : /<\/noscript[^>]*>/gi
+			};
+
+			// Setup lookup tables for empty elements and boolean attributes
+			shortEndedElements = schema.getShortEndedElements();
+			selfClosing = schema.getSelfClosingElements();
+			fillAttrsMap = schema.getBoolAttrs();
+			validate = settings.validate;
+			fixSelfClosing = settings.fix_self_closing;
+
+			while (matches = tokenRegExp.exec(html)) {
+				// Text
+				if (index < matches.index)
+					self.text(decode(html.substr(index, matches.index - index)));
+
+				if (value = matches[6]) { // End element
+					processEndTag(value.toLowerCase());
+				} else if (value = matches[7]) { // Start element
+					value = value.toLowerCase();
+					isShortEnded = value in shortEndedElements;
+
+					// Is self closing tag for example an <li> after an open <li>
+					if (fixSelfClosing && selfClosing[value] && stack.length > 0 && stack[stack.length - 1].name === value)
+						processEndTag(value);
+
+					// Validate element
+					if (!validate || (elementRule = schema.getElementRule(value))) {
+						isValidElement = true;
+
+						// Grab attributes map and patters when validation is enabled
+						if (validate) {
+							validAttributesMap = elementRule.attributes;
+							validAttributePatterns = elementRule.attributePatterns;
+						}
+
+						// Parse attributes
+						if (attribsValue = matches[8]) {
+							attrList = [];
+							attrList.map = {};
+
+							attribsValue.replace(attrRegExp, function(match, name, value, val2, val3) {
+								var attrRule, i;
+
+								name = name.toLowerCase();
+								value = name in fillAttrsMap ? name : decode(value || val2 || val3 || ''); // Handle boolean attribute than value attribute
+
+								// Validate name and value
+								if (validate && name.indexOf('data-') !== 0) {
+									attrRule = validAttributesMap[name];
+
+									// Find rule by pattern matching
+									if (!attrRule && validAttributePatterns) {
+										i = validAttributePatterns.length;
+										while (i--) {
+											attrRule = validAttributePatterns[i];
+											if (attrRule.pattern.test(name))
+												break;
+										}
+
+										// No rule matched
+										if (i === -1)
+											attrRule = null;
+									}
+
+									// No attribute rule found
+									if (!attrRule)
+										return;
+
+									// Validate value
+									if (attrRule.validValues && !(value in attrRule.validValues))
+										return;
+								}
+
+								// Add attribute to list and map
+								attrList.map[name] = value;
+								attrList.push({
+									name: name,
+									value: value
+								});
+							});
+						} else {
+							attrList = [];
+							attrList.map = {};
+						}
+
+						// Process attributes if validation is enabled
+						if (validate) {
+							attributesRequired = elementRule.attributesRequired;
+							attributesDefault = elementRule.attributesDefault;
+							attributesForced = elementRule.attributesForced;
+
+							// Handle forced attributes
+							if (attributesForced) {
+								i = attributesForced.length;
+								while (i--) {
+									attr = attributesForced[i];
+									name = attr.name;
+									attrValue = attr.value;
+
+									if (attrValue === '{$uid}')
+										attrValue = 'mce_' + idCount++;
+
+									attrList.map[name] = attrValue;
+									attrList.push({name: name, value: attrValue});
+								}
+							}
+
+							// Handle default attributes
+							if (attributesDefault) {
+								i = attributesDefault.length;
+								while (i--) {
+									attr = attributesDefault[i];
+									name = attr.name;
+
+									if (!(name in attrList.map)) {
+										attrValue = attr.value;
+
+										if (attrValue === '{$uid}')
+											attrValue = 'mce_' + idCount++;
+
+										attrList.map[name] = attrValue;
+										attrList.push({name: name, value: attrValue});
+									}
+								}
+							}
+
+							// Handle required attributes
+							if (attributesRequired) {
+								i = attributesRequired.length;
+								while (i--) {
+									if (attributesRequired[i] in attrList.map)
+										break;
+								}
+
+								// None of the required attributes where found
+								if (i === -1)
+									isValidElement = false;
+							}
+
+							// Invalidate element if it's marked as bogus
+							if (attrList.map['data-mce-bogus'])
+								isValidElement = false;
+						}
+
+						if (isValidElement)
+							self.start(value, attrList, isShortEnded);
+					} else
+						isValidElement = false;
+
+					// Treat script, noscript and style a bit different since they may include code that looks like elements
+					if (endRegExp = specialElements[value]) {
+						endRegExp.lastIndex = index = matches.index + matches[0].length;
+
+						if (matches = endRegExp.exec(html)) {
+							if (isValidElement)
+								text = html.substr(index, matches.index - index);
+
+							index = matches.index + matches[0].length;
+						} else {
+							text = html.substr(index);
+							index = html.length;
+						}
+
+						if (isValidElement && text.length > 0)
+							self.text(text, true);
+
+						if (isValidElement)
+							self.end(value);
+
+						tokenRegExp.lastIndex = index;
+						continue;
+					}
+
+					// Push value on to stack
+					if (!isShortEnded) {
+						if (!attribsValue || attribsValue.indexOf('/') != attribsValue.length - 1)
+							stack.push({name: value, valid: isValidElement});
+						else if (isValidElement)
+							self.end(value);
+					}
+				} else if (value = matches[1]) { // Comment
+					self.comment(value);
+				} else if (value = matches[2]) { // CDATA
+					self.cdata(value);
+				} else if (value = matches[3]) { // DOCTYPE
+					self.doctype(value);
+				} else if (value = matches[4]) { // PI
+					self.pi(value, matches[5]);
+				}
+
+				index = matches.index + matches[0].length;
+			}
+
+			// Text
+			if (index < html.length)
+				self.text(decode(html.substr(index)));
+
+			// Close any open elements
+			for (i = stack.length - 1; i >= 0; i--) {
+				value = stack[i];
+
+				if (value.valid)
+					self.end(value.name);
+			}
+		};
+	}
+})(tinymce);
+
+(function(tinymce) {
+	var whiteSpaceRegExp = /^[ \t\r\n]*$/, typeLookup = {
+		'#text' : 3,
+		'#comment' : 8,
+		'#cdata' : 4,
+		'#pi' : 7,
+		'#doctype' : 10,
+		'#document-fragment' : 11
+	};
+
+	// Walks the tree left/right
+	function walk(node, root_node, prev) {
+		var sibling, parent, startName = prev ? 'lastChild' : 'firstChild', siblingName = prev ? 'prev' : 'next';
+
+		// Walk into nodes if it has a start
+		if (node[startName])
+			return node[startName];
+
+		// Return the sibling if it has one
+		if (node !== root_node) {
+			sibling = node[siblingName];
+
+			if (sibling)
+				return sibling;
+
+			// Walk up the parents to look for siblings
+			for (parent = node.parent; parent && parent !== root_node; parent = parent.parent) {
+				sibling = parent[siblingName];
+
+				if (sibling)
+					return sibling;
+			}
+		}
+	};
+
+	function Node(name, type) {
+		this.name = name;
+		this.type = type;
+
+		if (type === 1) {
+			this.attributes = [];
+			this.attributes.map = {};
+		}
+	}
+
+	tinymce.extend(Node.prototype, {
+		replace : function(node) {
+			var self = this;
+
+			if (node.parent)
+				node.remove();
+
+			self.insert(node, self);
+			self.remove();
+
+			return self;
+		},
+
+		attr : function(name, value) {
+			var self = this, attrs, i, undef;
+
+			if (typeof name !== "string") {
+				for (i in name)
+					self.attr(i, name[i]);
+
+				return self;
+			}
+
+			if (attrs = self.attributes) {
+				if (value !== undef) {
+					// Remove attribute
+					if (value === null) {
+						if (name in attrs.map) {
+							delete attrs.map[name];
+
+							i = attrs.length;
+							while (i--) {
+								if (attrs[i].name === name) {
+									attrs = attrs.splice(i, 1);
+									return self;
+								}
+							}
+						}
+
+						return self;
+					}
+
+					// Set attribute
+					if (name in attrs.map) {
+						// Set attribute
+						i = attrs.length;
+						while (i--) {
+							if (attrs[i].name === name) {
+								attrs[i].value = value;
+								break;
+							}
+						}
+					} else
+						attrs.push({name: name, value: value});
+
+					attrs.map[name] = value;
+
+					return self;
+				} else {
+					return attrs.map[name];
+				}
+			}
+		},
+
+		clone : function() {
+			var self = this, clone = new Node(self.name, self.type), i, l, selfAttrs, selfAttr, cloneAttrs;
+
+			// Clone element attributes
+			if (selfAttrs = self.attributes) {
+				cloneAttrs = [];
+				cloneAttrs.map = {};
+
+				for (i = 0, l = selfAttrs.length; i < l; i++) {
+					selfAttr = selfAttrs[i];
+
+					// Clone everything except id
+					if (selfAttr.name !== 'id') {
+						cloneAttrs[cloneAttrs.length] = {name: selfAttr.name, value: selfAttr.value};
+						cloneAttrs.map[selfAttr.name] = selfAttr.value;
+					}
+				}
+
+				clone.attributes = cloneAttrs;
+			}
+
+			clone.value = self.value;
+			clone.shortEnded = self.shortEnded;
+
+			return clone;
+		},
+
+		wrap : function(wrapper) {
+			var self = this;
+
+			self.parent.insert(wrapper, self);
+			wrapper.append(self);
+
+			return self;
+		},
+
+		unwrap : function() {
+			var self = this, node, next;
+
+			for (node = self.firstChild; node; ) {
+				next = node.next;
+				self.insert(node, self, true);
+				node = next;
+			}
+
+			self.remove();
+		},
+
+		remove : function() {
+			var self = this, parent = self.parent, next = self.next, prev = self.prev;
+
+			if (parent) {
+				if (parent.firstChild === self) {
+					parent.firstChild = next;
+
+					if (next)
+						next.prev = null;
+				} else {
+					prev.next = next;
+				}
+
+				if (parent.lastChild === self) {
+					parent.lastChild = prev;
+
+					if (prev)
+						prev.next = null;
+				} else {
+					next.prev = prev;
+				}
+
+				self.parent = self.next = self.prev = null;
+			}
+
+			return self;
+		},
+
+		append : function(node) {
+			var self = this, last;
+
+			if (node.parent)
+				node.remove();
+
+			last = self.lastChild;
+			if (last) {
+				last.next = node;
+				node.prev = last;
+				self.lastChild = node;
+			} else
+				self.lastChild = self.firstChild = node;
+
+			node.parent = self;
+
+			return node;
+		},
+
+		insert : function(node, ref_node, before) {
+			var parent;
+
+			if (node.parent)
+				node.remove();
+
+			parent = ref_node.parent || this;
+
+			if (before) {
+				if (ref_node === parent.firstChild)
+					parent.firstChild = node;
+				else
+					ref_node.prev.next = node;
+
+				node.prev = ref_node.prev;
+				node.next = ref_node;
+				ref_node.prev = node;
+			} else {
+				if (ref_node === parent.lastChild)
+					parent.lastChild = node;
+				else
+					ref_node.next.prev = node;
+
+				node.next = ref_node.next;
+				node.prev = ref_node;
+				ref_node.next = node;
+			}
+
+			node.parent = parent;
+
+			return node;
+		},
+
+		getAll : function(name) {
+			var self = this, node, collection = [];
+
+			for (node = self.firstChild; node; node = walk(node, self)) {
+				if (node.name === name)
+					collection.push(node);
+			}
+
+			return collection;
+		},
+
+		empty : function() {
+			var self = this, nodes, i, node;
+
+			// Remove all children
+			if (self.firstChild) {
+				nodes = [];
+
+				// Collect the children
+				for (node = self.firstChild; node; node = walk(node, self))
+					nodes.push(node);
+
+				// Remove the children
+				i = nodes.length;
+				while (i--) {
+					node = nodes[i];
+					node.parent = node.firstChild = node.lastChild = node.next = node.prev = null;
+				}
+			}
+
+			self.firstChild = self.lastChild = null;
+
+			return self;
+		},
+
+		isEmpty : function(elements) {
+			var self = this, node = self.firstChild, i;
+
+			if (node) {
+				do {
+					if (node.type === 1) {
+						if (node.attributes.map['data-mce-bogus'])
+							continue;
+
+						// Keep empty elements like <img />
+						if (elements[node.name])
+							return false;
+
+						// Keep elements with data attributes
+						i = node.attributes.length;
+						while (i--) {
+							if (node.attributes[i].name.indexOf('data-') === 0)
+								return false;
+						}
+					}
+
+					// Keep non whitespace text nodes
+					if ((node.type === 3 && !whiteSpaceRegExp.test(node.value)))
+						return false;
+				} while (node = walk(node, self));
+			}
+
+			return true;
+		}
+	});
+
+	tinymce.extend(Node, {
+		create : function(name, attrs) {
+			var node, attrName;
+
+			// Create node
+			node = new Node(name, typeLookup[name] || 1);
+
+			// Add attributes if needed
+			if (attrs) {
+				for (attrName in attrs)
+					node.attr(attrName, attrs[attrName]);
+			}
+
+			return node;
+		}
+	});
+
+	tinymce.html.Node = Node;
+})(tinymce);
+
+(function(tinymce) {
+	var Node = tinymce.html.Node;
+
+	tinymce.html.DomParser = function(settings, schema) {
+		var self = this, nodeFilters = {}, attributeFilters = [], matchedNodes = {}, matchedAttributes = {};
+
+		settings = settings || {};
+		settings.root_name = settings.root_name || 'body';
+		self.schema = schema = schema || new tinymce.html.Schema();
+
+		function fixInvalidChildren(nodes) {
+			var ni, node, parent, parents, newParent, currentNode, tempNode, childNode, i,
+				childClone, nonEmptyElements, nonSplitableElements, sibling, nextNode;
+
+			nonSplitableElements = tinymce.makeMap('tr,td,th,tbody,thead,tfoot,table');
+			nonEmptyElements = schema.getNonEmptyElements();
+
+			for (ni = 0; ni < nodes.length; ni++) {
+				node = nodes[ni];
+
+				// Already removed
+				if (!node.parent)
+					continue;
+
+				// Get list of all parent nodes until we find a valid parent to stick the child into
+				parents = [node];
+				for (parent = node.parent; parent && !schema.isValidChild(parent.name, node.name) && !nonSplitableElements[parent.name]; parent = parent.parent)
+					parents.push(parent);
+
+				// Found a suitable parent
+				if (parent && parents.length > 1) {
+					// Reverse the array since it makes looping easier
+					parents.reverse();
+
+					// Clone the related parent and insert that after the moved node
+					newParent = currentNode = self.filterNode(parents[0].clone());
+
+					// Start cloning and moving children on the left side of the target node
+					for (i = 0; i < parents.length - 1; i++) {
+						if (schema.isValidChild(currentNode.name, parents[i].name)) {
+							tempNode = self.filterNode(parents[i].clone());
+							currentNode.append(tempNode);
+						} else
+							tempNode = currentNode;
+
+						for (childNode = parents[i].firstChild; childNode && childNode != parents[i + 1]; ) {
+							nextNode = childNode.next;
+							tempNode.append(childNode);
+							childNode = nextNode;
+						}
+
+						currentNode = tempNode;
+					}
+
+					if (!newParent.isEmpty(nonEmptyElements)) {
+						parent.insert(newParent, parents[0], true);
+						parent.insert(node, newParent);
+					} else {
+						parent.insert(node, parents[0], true);
+					}
+
+					// Check if the element is empty by looking through it's contents and special treatment for <p><br /></p>
+					parent = parents[0];
+					if (parent.isEmpty(nonEmptyElements) || parent.firstChild === parent.lastChild && parent.firstChild.name === 'br') {
+						parent.empty().remove();
+					}
+				} else if (node.parent) {
+					// If it's an LI try to find a UL/OL for it or wrap it
+					if (node.name === 'li') {
+						sibling = node.prev;
+						if (sibling && (sibling.name === 'ul' || sibling.name === 'ul')) {
+							sibling.append(node);
+							continue;
+						}
+
+						sibling = node.next;
+						if (sibling && (sibling.name === 'ul' || sibling.name === 'ul')) {
+							sibling.insert(node, sibling.firstChild, true);
+							continue;
+						}
+
+						node.wrap(self.filterNode(new Node('ul', 1)));
+						continue;
+					}
+
+					// Try wrapping the element in a DIV
+					if (schema.isValidChild(node.parent.name, 'div') && schema.isValidChild('div', node.name)) {
+						node.wrap(self.filterNode(new Node('div', 1)));
+					} else {
+						// We failed wrapping it, then remove or unwrap it
+						if (node.name === 'style' || node.name === 'script')
+							node.empty().remove();
+						else
+							node.unwrap();
+					}
+				}
+			}
+		};
+
+		self.filterNode = function(node) {
+			var i, name, list;
+
+			// Run element filters
+			if (name in nodeFilters) {
+				list = matchedNodes[name];
+
+				if (list)
+					list.push(node);
+				else
+					matchedNodes[name] = [node];
+			}
+
+			// Run attribute filters
+			i = attributeFilters.length;
+			while (i--) {
+				name = attributeFilters[i].name;
+
+				if (name in node.attributes.map) {
+					list = matchedAttributes[name];
+
+					if (list)
+						list.push(node);
+					else
+						matchedAttributes[name] = [node];
+				}
+			}
+
+			return node;
+		};
+
+		self.addNodeFilter = function(name, callback) {
+			tinymce.each(tinymce.explode(name), function(name) {
+				var list = nodeFilters[name];
+
+				if (!list)
+					nodeFilters[name] = list = [];
+
+				list.push(callback);
+			});
+		};
+
+		self.addAttributeFilter = function(name, callback) {
+			tinymce.each(tinymce.explode(name), function(name) {
+				var i;
+
+				for (i = 0; i < attributeFilters.length; i++) {
+					if (attributeFilters[i].name === name) {
+						attributeFilters[i].callbacks.push(callback);
+						return;
+					}
+				}
+
+				attributeFilters.push({name: name, callbacks: [callback]});
+			});
+		};
+
+		self.parse = function(html, args) {
+			var parser, rootNode, node, nodes, i, l, fi, fl, list, name,
+				blockElements, startWhiteSpaceRegExp, invalidChildren = [],
+				endWhiteSpaceRegExp, allWhiteSpaceRegExp, whiteSpaceElements, children, nonEmptyElements;
+
+			args = args || {};
+			matchedNodes = {};
+			matchedAttributes = {};
+			blockElements = tinymce.extend(tinymce.makeMap('script,style,head,title,meta,param'), schema.getBlockElements());
+			nonEmptyElements = schema.getNonEmptyElements();
+			children = schema.children;
+
+			whiteSpaceElements = schema.getWhiteSpaceElements();
+			startWhiteSpaceRegExp = /^[ \t\r\n]+/;
+			endWhiteSpaceRegExp = /[ \t\r\n]+$/;
+			allWhiteSpaceRegExp = /[ \t\r\n]+/g;
+
+			function createNode(name, type) {
+				var node = new Node(name, type), list;
+
+				if (name in nodeFilters) {
+					list = matchedNodes[name];
+
+					if (list)
+						list.push(node);
+					else
+						matchedNodes[name] = [node];
+				}
+
+				return node;
+			};
+
+			parser = new tinymce.html.SaxParser({
+				validate : settings.validate,
+				fix_self_closing : false, // Let the DOM parser handle <li> in <li> or <p> in <p> for better results
+
+				cdata: function(text) {
+					node.append(createNode('#cdata', 4)).value = text;
+				},
+
+				text: function(text, raw) {
+					var textNode;
+
+					// Trim all redundant whitespace on non white space elements
+					if (!whiteSpaceElements[node.name]) {
+						text = text.replace(allWhiteSpaceRegExp, ' ');
+
+						if (node.lastChild && blockElements[node.lastChild.name])
+							text = text.replace(startWhiteSpaceRegExp, '');
+					}
+
+					// Do we need to create the node
+					if (text.length !== 0) {
+						textNode = createNode('#text', 3);
+						textNode.raw = !!raw;
+						node.append(textNode).value = text;
+					}
+				},
+
+				comment: function(text) {
+					node.append(createNode('#comment', 8)).value = text;
+				},
+
+				pi: function(name, text) {
+					node.append(createNode(name, 7)).value = text;
+				},
+
+				doctype: function(text) {
+					node.append(createNode('#doctype', 10)).value = text;
+				},
+
+				start: function(name, attrs, empty) {
+					var newNode, attrFiltersLen, elementRule, textNode, attrName, text, sibling, parent;
+
+					elementRule = schema.getElementRule(name);
+					if (elementRule) {
+						newNode = createNode(elementRule.outputName || name, 1);
+						newNode.attributes = attrs;
+						newNode.shortEnded = empty;
+
+						node.append(newNode);
+
+						// Check if node is valid child of the parent node is the child is
+						// unknown we don't collect it since it's probably a custom element
+						parent = children[node.name];
+						if (parent && children[newNode.name] && !parent[newNode.name])
+							invalidChildren.push(newNode);
+
+						attrFiltersLen = attributeFilters.length;
+						while (attrFiltersLen--) {
+							attrName = attributeFilters[attrFiltersLen].name;
+
+							if (attrName in attrs.map) {
+								list = matchedAttributes[attrName];
+
+								if (list)
+									list.push(newNode);
+								else
+									matchedAttributes[attrName] = [newNode];
+							}
+						}
+
+						// Trim whitespace before block
+						if (blockElements[name]) {
+							for (textNode = newNode.prev; textNode && textNode.type === 3; ) {
+								text = textNode.value.replace(endWhiteSpaceRegExp, '');
+
+								if (text.length > 0) {
+									textNode.value = text;
+									textNode = textNode.prev;
+								} else {
+									sibling = textNode.prev;
+									textNode.remove();
+									textNode = sibling;
+								}
+							}
+						}
+
+						// Change current node if the element wasn't empty i.e not <br /> or <img />
+						if (!empty)
+							node = newNode;
+					}
+				},
+
+				end: function(name) {
+					var textNode, elementRule, text, sibling, tempNode;
+
+					elementRule = schema.getElementRule(name);
+					if (elementRule) {
+						if (blockElements[name]) {
+							if (!whiteSpaceElements[node.name]) {
+								// Trim whitespace at beginning of block
+								for (textNode = node.firstChild; textNode && textNode.type === 3; ) {
+									text = textNode.value.replace(startWhiteSpaceRegExp, '');
+
+									if (text.length > 0) {
+										textNode.value = text;
+										textNode = textNode.next;
+									} else {
+										sibling = textNode.next;
+										textNode.remove();
+										textNode = sibling;
+									}
+								}
+
+								// Trim whitespace at end of block
+								for (textNode = node.lastChild; textNode && textNode.type === 3; ) {
+									text = textNode.value.replace(endWhiteSpaceRegExp, '');
+
+									if (text.length > 0) {
+										textNode.value = text;
+										textNode = textNode.prev;
+									} else {
+										sibling = textNode.prev;
+										textNode.remove();
+										textNode = sibling;
+									}
+								}
+							}
+
+							// Trim start white space
+							textNode = node.prev;
+							if (textNode && textNode.type === 3) {
+								text = textNode.value.replace(startWhiteSpaceRegExp, '');
+
+								if (text.length > 0)
+									textNode.value = text;
+								else
+									textNode.remove();
+							}
+						}
+
+						// Handle empty nodes
+						if (elementRule.removeEmpty || elementRule.paddEmpty) {
+							if (node.isEmpty(nonEmptyElements)) {
+								if (elementRule.paddEmpty)
+									node.empty().append(new Node('#text', '3')).value = '\u00a0';
+								else {
+									// Leave nodes that have a name like <a name="name">
+									if (!node.attributes.map.name) {
+										tempNode = node.parent;
+										node.empty().remove();
+										node = tempNode;
+										return;
+									}
+								}
+							}
+						}
+
+						node = node.parent;
+					}
+				}
+			}, schema);
+
+			rootNode = node = new Node(settings.root_name, 11);
+
+			parser.parse(html);
+
+			fixInvalidChildren(invalidChildren);
+
+			// Run node filters
+			for (name in matchedNodes) {
+				list = nodeFilters[name];
+				nodes = matchedNodes[name];
+
+				// Remove already removed children
+				fi = nodes.length;
+				while (fi--) {
+					if (!nodes[fi].parent)
+						nodes.splice(fi, 1);
+				}
+
+				for (i = 0, l = list.length; i < l; i++)
+					list[i](nodes, name, args);
+			}
+
+			// Run attribute filters
+			for (i = 0, l = attributeFilters.length; i < l; i++) {
+				list = attributeFilters[i];
+
+				if (list.name in matchedAttributes) {
+					nodes = matchedAttributes[list.name];
+
+					// Remove already removed children
+					fi = nodes.length;
+					while (fi--) {
+						if (!nodes[fi].parent)
+							nodes.splice(fi, 1);
+					}
+
+					for (fi = 0, fl = list.callbacks.length; fi < fl; fi++)
+						list.callbacks[fi](nodes, list.name, args);
+				}
+			}
+
+			return rootNode;
+		};
+
+		// Remove <br> at end of block elements Gecko and WebKit injects BR elements to
+		// make it possible to place the caret inside empty blocks. This logic tries to remove
+		// these elements and keep br elements that where intended to be there intact
+		if (settings.remove_trailing_brs) {
+			self.addNodeFilter('br', function(nodes, name) {
+				var i, l = nodes.length, node, blockElements = schema.getBlockElements(),
+					nonEmptyElements = schema.getNonEmptyElements(), parent, prev, prevName;
+
+				// Must loop forwards since it will otherwise remove all brs in <p>a<br><br><br></p>
+				for (i = 0; i < l; i++) {
+					node = nodes[i];
+					parent = node.parent;
+
+					if (blockElements[node.parent.name] && node === parent.lastChild) {
+						// Loop all nodes to the right of the current node and check for other BR elements
+						// excluding bookmarks since they are invisible
+						prev = node.prev;
+						while (prev) {
+							prevName = prev.name;
+
+							// Ignore bookmarks
+							if (prevName !== "span" || prev.attr('data-mce-type') !== 'bookmark') {
+								// Found a non BR element
+								if (prevName !== "br")
+									break;
+	
+								// Found another br it's a <br><br> structure then don't remove anything
+								if (prevName === 'br') {
+									node = null;
+									break;
+								}
+							}
+
+							prev = prev.prev;
+						}
+
+						if (node) {
+							node.remove();
+
+							// Is the parent to be considered empty after we removed the BR
+							if (parent.isEmpty(nonEmptyElements)) {
+								elementRule = schema.getElementRule(parent.name);
+
+								// Remove or padd the element depending on schema rule
+								if (elementRule.removeEmpty)
+									parent.remove();
+								else if (elementRule.paddEmpty) 
+									parent.empty().append(new tinymce.html.Node('#text', 3)).value = '\u00a0';
+							}
+						}
+					}
+				}
+			});
+		}
+	}
+})(tinymce);
+
+tinymce.html.Writer = function(settings) {
+	var html = [], indent, indentBefore, indentAfter, encode, htmlOutput;
+
+	settings = settings || {};
+	indent = settings.indent;
+	indentBefore = tinymce.makeMap(settings.indent_before || '');
+	indentAfter = tinymce.makeMap(settings.indent_after || '');
+	encode = tinymce.html.Entities.getEncodeFunc(settings.entity_encoding || 'raw', settings.entities);
+	htmlOutput = settings.element_format == "html";
+
+	return {
+		start: function(name, attrs, empty) {
+			var i, l, attr, value;
+
+			if (indent && indentBefore[name] && html.length > 0) {
+				value = html[html.length - 1];
+
+				if (value.length > 0 && value !== '\n')
+					html.push('\n');
+			}
+
+			html.push('<', name);
+
+			if (attrs) {
+				for (i = 0, l = attrs.length; i < l; i++) {
+					attr = attrs[i];
+					html.push(' ', attr.name, '="', encode(attr.value, true), '"');
+				}
+			}
+
+			if (!empty || htmlOutput)
+				html[html.length] = '>';
+			else
+				html[html.length] = ' />';
+
+			/*if (indent && indentAfter[name])
+				html.push('\n');*/
+		},
+
+		end: function(name) {
+			var value;
+
+			/*if (indent && indentBefore[name] && html.length > 0) {
+				value = html[html.length - 1];
+
+				if (value.length > 0 && value !== '\n')
+					html.push('\n');
+			}*/
+
+			html.push('</', name, '>');
+
+			if (indent && indentAfter[name] && html.length > 0) {
+				value = html[html.length - 1];
+
+				if (value.length > 0 && value !== '\n')
+					html.push('\n');
+			}
+		},
+
+		text: function(text, raw) {
+			if (text.length > 0)
+				html[html.length] = raw ? text : encode(text);
+		},
+
+		cdata: function(text) {
+			html.push('<![CDATA[', text, ']]>');
+		},
+
+		comment: function(text) {
+			html.push('<!--', text, '-->');
+		},
+
+		pi: function(name, text) {
+			if (text)
+				html.push('<?', name, ' ', text, '?>');
+			else
+				html.push('<?', name, '?>');
+		},
+
+		doctype: function(text) {
+			html.push('<!DOCTYPE', text, '>');
+		},
+
+		reset: function() {
+			html.length = 0;
+		},
+
+		getContent: function() {
+			return html.join('').replace(/\n$/, '');
+		}
+	};
+};
+
+(function(tinymce) {
+	tinymce.html.Serializer = function(settings, schema) {
+		var self = this, writer = new tinymce.html.Writer(settings);
+
+		settings = settings || {};
+		settings.validate = "validate" in settings ? settings.validate : true;
+
+		self.schema = schema = schema || new tinymce.html.Schema();
+		self.writer = writer;
+
+		self.serialize = function(node) {
+			var handlers, validate;
+
+			validate = settings.validate;
+
+			handlers = {
+				// #text
+				3: function(node, raw) {
+					writer.text(node.value, node.raw);
+				},
+
+				// #comment
+				8: function(node) {
+					writer.comment(node.value);
+				},
+
+				// Processing instruction
+				7: function(node) {
+					writer.pi(node.name, node.value);
+				},
+
+				// Doctype
+				10: function(node) {
+					writer.doctype(node.value);
+				},
+
+				// CDATA
+				4: function(node) {
+					writer.cdata(node.value);
+				},
+
+ 				// Document fragment
+				11: function(node) {
+					if ((node = node.firstChild)) {
+						do {
+							walk(node);
+						} while (node = node.next);
+					}
+				}
+			};
+
+			writer.reset();
+
+			function walk(node) {
+				var handler = handlers[node.type], name, isEmpty, attrs, attrName, attrValue, sortedAttrs, i, l, elementRule;
+
+				if (!handler) {
+					name = node.name;
+					isEmpty = node.shortEnded;
+					attrs = node.attributes;
+
+					// Sort attributes
+					if (validate && attrs && attrs.length > 1) {
+						sortedAttrs = [];
+						sortedAttrs.map = {};
+
+						elementRule = schema.getElementRule(node.name);
+						for (i = 0, l = elementRule.attributesOrder.length; i < l; i++) {
+							attrName = elementRule.attributesOrder[i];
+
+							if (attrName in attrs.map) {
+								attrValue = attrs.map[attrName];
+								sortedAttrs.map[attrName] = attrValue;
+								sortedAttrs.push({name: attrName, value: attrValue});
+							}
+						}
+
+						for (i = 0, l = attrs.length; i < l; i++) {
+							attrName = attrs[i].name;
+
+							if (!(attrName in sortedAttrs.map)) {
+								attrValue = attrs.map[attrName];
+								sortedAttrs.map[attrName] = attrValue;
+								sortedAttrs.push({name: attrName, value: attrValue});
+							}
+						}
+
+						attrs = sortedAttrs;
+					}
+
+					writer.start(node.name, attrs, isEmpty);
+
+					if (!isEmpty) {
+						if ((node = node.firstChild)) {
+							do {
+								walk(node);
+							} while (node = node.next);
+						}
+
+						writer.end(name);
+					}
+				} else
+					handler(node);
+			}
+
+			// Serialize element and treat all non elements as fragments
+			if (node.type == 1 && !settings.inner)
+				walk(node);
+			else
+				handlers[11](node);
+
+			return writer.getContent();
+		};
+	}
+})(tinymce);
+
+(function(tinymce) {
+	// Shorten names
+	var each = tinymce.each,
+		is = tinymce.is,
+		isWebKit = tinymce.isWebKit,
+		isIE = tinymce.isIE,
+		Entities = tinymce.html.Entities,
+		simpleSelectorRe = /^([a-z0-9],?)+$/i,
+		blockElementsMap = tinymce.html.Schema.blockElementsMap;
+
+	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, globalStyle;
+
+			t.doc = d;
+			t.win = window;
+			t.files = {};
+			t.cssFlicker = false;
+			t.counter = 0;
+			t.stdMode = !tinymce.isIE || d.documentMode >= 8;
+			t.boxModel = !tinymce.isIE || d.compatMode == "CSS1Compat" || t.stdMode;
+			t.hasOuterHTML = "outerHTML" in d.createElement("a");
+
+			t.settings = s = tinymce.extend({
+				keep_values : false,
+				hex_colors : 1
+			}, s);
+
+			t.styles = new tinymce.html.Styles({
+				url_converter : s.url_converter,
+				url_converter_scope : s.url_converter_scope
+			}, s.schema);
+
+			// Fix IE6SP2 flicker and check it failed for pre SP2
+			if (tinymce.isIE6) {
+				try {
+					d.execCommand('BackgroundImageCache', false, true);
+				} catch (e) {
+					t.cssFlicker = true;
+				}
+			}
+
+			if (isIE) {
+				// Add missing HTML 4/5 elements to IE
+				('abbr article aside audio canvas ' +
+				'details figcaption figure footer ' +
+				'header hgroup mark menu meter nav ' +
+				'output progress section summary ' +
+				'time video').replace(/\w+/g, function(name) {
+					d.createElement(name);
+				});
+			}
+
+			tinymce.addUnload(t.destroy, t);
+		},
+
+		getRoot : function() {
+			var t = this, s = t.settings;
+
+			return (s && t.get(s.root_element)) || t.doc.body;
+		},
+
+		getViewPort : function(w) {
+			var d, b;
+
+			w = !w ? this.win : w;
+			d = w.document;
+			b = this.boxModel ? d.documentElement : d.body;
+
+			// 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
+			};
+		},
+
+		getRect : function(e) {
+			var p, t = this, sr;
+
+			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
+			};
+		},
+
+		getSize : function(e) {
+			var t = this, w, h;
+
+			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
+			};
+		},
+
+		getParent : function(n, f, r) {
+			return this.getParents(n, f, r, false);
+		},
+
+		getParents : function(n, f, r, c) {
+			var t = this, na, se = t.settings, o = [];
+
+			n = t.get(n);
+			c = c === undefined;
+
+			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 {
+					f = function(n) {
+						return t.is(n, na);
+					};
+				}
+			}
+
+			while (n) {
+				if (n == r || !n.nodeType || n.nodeType === 9)
+					break;
+
+				if (!f || f(n)) {
+					if (c)
+						o.push(n);
+					else
+						return n;
+				}
+
+				n = n.parentNode;
+			}
+
+			return c ? o : null;
+		},
+
+		get : function(e) {
+			var n;
+
+			if (e && this.doc && typeof(e) == 'string') {
+				n = e;
+				e = this.doc.getElementById(e);
+
+				// 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];
+			}
+
+			return e;
+		},
+
+		getNext : function(node, selector) {
+			return this._findSib(node, selector, 'nextSibling');
+		},
+
+		getPrev : function(node, selector) {
+			return this._findSib(node, selector, 'previousSibling');
+		},
+
+
+		select : function(pa, s) {
+			var t = this;
+
+			return tinymce.dom.Sizzle(pa, t.get(s) || t.get(t.settings.root_element) || t.doc, []);
+		},
+
+		is : function(n, selector) {
+			var i;
+
+			// If it isn't an array then try to do some simple selectors instead of Sizzle for to boost performance
+			if (n.length === undefined) {
+				// Simple all selector
+				if (selector === '*')
+					return n.nodeType == 1;
+
+				// Simple selector just elements
+				if (simpleSelectorRe.test(selector)) {
+					selector = selector.toLowerCase().split(/,/);
+					n = n.nodeName.toLowerCase();
+
+					for (i = selector.length - 1; i >= 0; i--) {
+						if (selector[i] == n)
+							return true;
+					}
+
+					return false;
+				}
+			}
+
+			return tinymce.dom.Sizzle.matches(selector, n.nodeType ? [n] : n).length > 0;
+		},
+
+
+		add : function(p, n, a, h, c) {
+			var t = this;
+
+			return this.run(p, function(p) {
+				var e, k;
+
+				e = is(n, 'string') ? t.doc.createElement(n) : n;
+				t.setAttribs(e, a);
+
+				if (h) {
+					if (h.nodeType)
+						e.appendChild(h);
+					else
+						t.setHTML(e, h);
+				}
+
+				return !c ? p.appendChild(e) : e;
+			});
+		},
+
+		create : function(n, a, h) {
+			return this.add(this.doc.createElement(n), n, a, h, 1);
+		},
+
+		createHTML : function(n, a, h) {
+			var o = '', t = this, k;
+
+			o += '<' + n;
+
+			for (k in a) {
+				if (a.hasOwnProperty(k))
+					o += ' ' + k + '="' + t.encode(a[k]) + '"';
+			}
+
+			// A call to tinymce.is doesn't work for some odd reason on IE9 possible bug inside their JS runtime
+			if (typeof(h) != "undefined")
+				return o + '>' + h + '</' + n + '>';
+
+			return o + ' />';
+		},
+
+		remove : function(node, keep_children) {
+			return this.run(node, function(node) {
+				var parent, child;
+
+				parent = node.parentNode;
+
+				if (!parent)
+					return null;
+
+				if (keep_children) {
+					while (child = node.firstChild) {
+						// IE 8 will crash if you don't remove completely empty text nodes
+						if (!tinymce.isIE || child.nodeType !== 3 || child.nodeValue)
+							parent.insertBefore(child, node);
+						else
+							node.removeChild(child);
+					}
+				}
+
+				return parent.removeChild(node);
+			});
+		},
+
+		setStyle : function(n, na, v) {
+			var t = this;
+
+			return t.run(n, function(e) {
+				var s, i;
+
+				s = e.style;
+
+				// Camelcase it, if needed
+				na = na.replace(/-(\D)/g, function(a, b){
+					return b.toUpperCase();
+				});
+
+				// 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) + ")";
+
+							if (!n.currentStyle || !n.currentStyle.hasLayout)
+								s.display = 'inline-block';
+						}
+
+						// Fix for older browsers
+						s[na] = s['-moz-opacity'] = s['-khtml-opacity'] = v || '';
+						break;
+
+					case 'float':
+						isIE ? s.styleFloat = v : s.cssFloat = v;
+						break;
+					
+					default:
+						s[na] = v || '';
+				}
+
+				// Force update of the style data
+				if (t.settings.update_styles)
+					t.setAttrib(e, 'data-mce-style');
+			});
+		},
+
+		getStyle : function(n, na, c) {
+			n = this.get(n);
+
+			if (!n)
+				return false;
+
+			// Gecko
+			if (this.doc.defaultView && c) {
+				// Remove camelcase
+				na = na.replace(/[A-Z]/g, function(a){
+					return '-' + a;
+				});
+
+				try {
+					return this.doc.defaultView.getComputedStyle(n, null).getPropertyValue(na);
+				} catch (ex) {
+					// Old safari might fail
+					return null;
+				}
+			}
+
+			// Camelcase it, if needed
+			na = na.replace(/-(\D)/g, function(a, b){
+				return b.toUpperCase();
+			});
+
+			if (na == 'float')
+				na = isIE ? 'styleFloat' : 'cssFloat';
+
+			// IE & Opera
+			if (n.currentStyle && c)
+				return n.currentStyle[na];
+
+			return n.style[na];
+		},
+
+		setStyles : function(e, o) {
+			var t = this, s = t.settings, ol;
+
+			ol = s.update_styles;
+			s.update_styles = 0;
+
+			each(o, function(v, n) {
+				t.setStyle(e, n, v);
+			});
+
+			// Update style info
+			s.update_styles = ol;
+			if (s.update_styles)
+				t.setAttrib(e, s.cssText);
+		},
+
+		removeAllAttribs: function(e) {
+			return this.run(e, function(e) {
+				var attrs = e.attributes;
+				for (var i = attrs.length - 1; i >= 0; i--) {
+					e.removeAttributeNode(attrs.item(i));
+				}
+			});
+		},
+
+		setAttrib : function(e, n, v) {
+			var t = this;
+
+			// Whats the point
+			if (!e || !n)
+				return;
+
+			// 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);
+							});
+
+							return;
+						}
+
+						// 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('data-mce-style', v, 2);
+							else
+								e.removeAttribute('data-mce-style', 2);
+						}
+
+						e.style.cssText = v;
+						break;
+
+					case "class":
+						e.className = v || ''; // Fix IE null bug
+						break;
+
+					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);
+
+							t.setAttrib(e, 'data-mce-' + n, v, 2);
+						}
+
+						break;
+					
+					case "shape":
+						e.setAttribute('data-mce-style', v);
+						break;
+				}
+
+				if (is(v) && v !== null && v.length !== 0)
+					e.setAttribute(n, '' + v, 2);
+				else
+					e.removeAttribute(n, 2);
+			});
+		},
+
+		setAttribs : function(e, o) {
+			var t = this;
+
+			return this.run(e, function(e) {
+				each(o, function(v, n) {
+					t.setAttrib(e, n, v);
+				});
+			});
+		},
+
+		getAttrib : function(e, n, dv) {
+			var v, t = this;
+
+			e = t.get(e);
+
+			if (!e || e.nodeType !== 1)
+				return false;
+
+			if (!is(dv))
+				dv = '';
+
+			// Try the mce variant for these
+			if (/^(src|href|style|coords|shape)$/.test(n)) {
+				v = e.getAttribute("data-mce-" + n);
+
+				if (v)
+					return v;
+			}
+
+			if (isIE && t.props[n]) {
+				v = e[t.props[n]];
+				v = v && v.nodeValue ? v.nodeValue : v;
+			}
+
+			if (!v)
+				v = e.getAttribute(n, 2);
+
+			// Check boolean attribs
+			if (/^(checked|compact|declare|defer|disabled|ismap|multiple|nohref|noshade|nowrap|readonly|selected)$/.test(n)) {
+				if (e[t.props[n]] === true && v === '')
+					return n;
+
+				return v ? n : '';
+			}
+
+			// Inner input elements will override attributes on form elements
+			if (e.nodeName === "FORM" && e.getAttributeNode(n))
+				return e.getAttributeNode(n).nodeValue;
+
+			if (n === 'style') {
+				v = v || e.style.cssText;
+
+				if (v) {
+					v = t.serializeStyle(t.parseStyle(v), e.nodeName);
+
+					if (t.settings.keep_values && !t._isRes(v))
+						e.setAttribute('data-mce-style', v);
+				}
+			}
+
+			// Remove Apple and WebKit stuff
+			if (isWebKit && n === "class" && v)
+				v = v.replace(/(apple|webkit)\-[a-z\-]+/gi, '');
+
+			// Handle IE issues
+			if (isIE) {
+				switch (n) {
+					case 'rowspan':
+					case 'colspan':
+						// IE returns 1 as default value
+						if (v === 1)
+							v = '';
+
+						break;
+
+					case 'size':
+						// IE returns +0 as default value for size
+						if (v === '+0' || v === 20 || v === 0)
+							v = '';
+
+						break;
+
+					case 'width':
+					case 'height':
+					case 'vspace':
+					case 'checked':
+					case 'disabled':
+					case 'readonly':
+						if (v === 0)
+							v = '';
+
+						break;
+
+					case 'hspace':
+						// IE returns -1 as default value
+						if (v === -1)
+							v = '';
+
+						break;
+
+					case 'maxlength':
+					case 'tabindex':
+						// IE returns default value
+						if (v === 32768 || v === 2147483647 || v === '32768')
+							v = '';
+
+						break;
+
+					case 'multiple':
+					case 'compact':
+					case 'noshade':
+					case 'nowrap':
+						if (v === 65535)
+							return n;
+
+						return dv;
+
+					case 'shape':
+						v = v.toLowerCase();
+						break;
+
+					default:
+						// IE has odd anonymous function for event attributes
+						if (n.indexOf('on') === 0 && v)
+							v = tinymce._replace(/^function\s+\w+\(\)\s+\{\s+(.*)\s+\}$/, '$1', '' + v);
+				}
+			}
+
+			return (v !== undefined && v !== null && v !== '') ? '' + v : dv;
+		},
+
+		getPos : function(n, ro) {
+			var t = this, x = 0, y = 0, e, d = t.doc, r;
+
+			n = t.get(n);
+			ro = ro || d.body;
+
+			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;
+
+					return {x : n.left + e.scrollLeft - x, y : n.top + e.scrollTop - x};
+				}
+
+				r = n;
+				while (r && r != ro && r.nodeType) {
+					x += r.offsetLeft || 0;
+					y += r.offsetTop || 0;
+					r = r.offsetParent;
+				}
+
+				r = n.parentNode;
+				while (r && r != ro && r.nodeType) {
+					x -= r.scrollLeft || 0;
+					y -= r.scrollTop || 0;
+					r = r.parentNode;
+				}
+			}
+
+			return {x : x, y : y};
+		},
+
+		parseStyle : function(st) {
+			return this.styles.parse(st);
+		},
+
+		serializeStyle : function(o, name) {
+			return this.styles.serialize(o, name);
+		},
+
+		loadCSS : function(u) {
+			var t = this, d = t.doc, head;
+
+			if (!u)
+				u = '';
+
+			head = t.select('head')[0];
+
+			each(u.split(','), function(u) {
+				var link;
+
+				if (t.files[u])
+					return;
+
+				t.files[u] = true;
+				link = t.create('link', {rel : 'stylesheet', href : tinymce._addVer(u)});
+
+				// 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 && d.recalc) {
+					link.onload = function() {
+						if (d.recalc)
+							d.recalc();
+
+						link.onload = null;
+					};
+				}
+
+				head.appendChild(link);
+			});
+		},
+
+		addClass : function(e, c) {
+			return this.run(e, function(e) {
+				var o;
+
+				if (!c)
+					return 0;
+
+				if (this.hasClass(e, c))
+					return e.className;
+
+				o = this.removeClass(e, c);
+
+				return e.className = (o != '' ? (o + ' ') : '') + c;
+			});
+		},
+
+		removeClass : function(e, c) {
+			var t = this, re;
+
+			return t.run(e, function(e) {
+				var v;
+
+				if (t.hasClass(e, c)) {
+					if (!re)
+						re = new RegExp("(^|\\s+)" + c + "(\\s+|$)", "g");
+
+					v = e.className.replace(re, ' ');
+					v = tinymce.trim(v != ' ' ? v : '');
+
+					e.className = v;
+
+					// Empty class attr
+					if (!v) {
+						e.removeAttribute('class');
+						e.removeAttribute('className');
+					}
+
+					return v;
+				}
+
+				return e.className;
+			});
+		},
+
+		hasClass : function(n, c) {
+			n = this.get(n);
+
+			if (!n || !c)
+				return false;
+
+			return (' ' + n.className + ' ').indexOf(' ' + c + ' ') !== -1;
+		},
+
+		show : function(e) {
+			return this.setStyle(e, 'display', 'block');
+		},
+
+		hide : function(e) {
+			return this.setStyle(e, 'display', 'none');
+		},
+
+		isHidden : function(e) {
+			e = this.get(e);
+
+			return !e || e.style.display == 'none' || this.getStyle(e, 'display') == 'none';
+		},
+
+		uniqueId : function(p) {
+			return (!p ? 'mce_' : p) + (this.counter++);
+		},
+
+		setHTML : function(element, html) {
+			var self = this;
+
+			return self.run(element, function(element) {
+				if (isIE) {
+					// Remove all child nodes, IE keeps empty text nodes in DOM
+					while (element.firstChild)
+						element.removeChild(element.firstChild);
+
+					try {
+						// IE will remove comments from the beginning
+						// unless you padd the contents with something
+						element.innerHTML = '<br />' + html;
+						element.removeChild(element.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
+
+						// Create new div with HTML contents and a BR infront to keep comments
+						element = self.create('div');
+						element.innerHTML = '<br />' + html;
+
+						// Add all children from div to target
+						each (element.childNodes, function(node, i) {
+							// Skip br element
+							if (i)
+								element.appendChild(node);
+						});
+					}
+				} else
+					element.innerHTML = html;
+
+				return html;
+			});
+		},
+
+		getOuterHTML : function(elm) {
+			var doc, self = this;
+
+			elm = self.get(elm);
+
+			if (!elm)
+				return null;
+
+			if (elm.nodeType === 1 && self.hasOuterHTML)
+				return elm.outerHTML;
+
+			doc = (elm.ownerDocument || self.doc).createElement("body");
+			doc.appendChild(elm.cloneNode(true));
+
+			return doc.innerHTML;
+		},
+
+		setOuterHTML : function(e, h, d) {
+			var t = this;
+
+			function setHTML(e, h, d) {
+				var n, tp;
+
+				tp = d.createElement("body");
+				tp.innerHTML = h;
+
+				n = tp.lastChild;
+				while (n) {
+					t.insertAfter(n.cloneNode(true), e);
+					n = n.previousSibling;
+				}
+
+				t.remove(e);
+			};
+
+			return this.run(e, function(e) {
+				e = t.get(e);
+
+				// Only set HTML on elements
+				if (e.nodeType == 1) {
+					d = d || e.ownerDocument || t.doc;
+
+					if (isIE) {
+						try {
+							// Try outerHTML for IE it sometimes produces an unknown runtime error
+							if (isIE && e.nodeType == 1)
+								e.outerHTML = h;
+							else
+								setHTML(e, h, d);
+						} catch (ex) {
+							// Fix for unknown runtime error
+							setHTML(e, h, d);
+						}
+					} else
+						setHTML(e, h, d);
+				}
+			});
+		},
+
+		decode : Entities.decode,
+
+		encode : Entities.encodeAllRaw,
+
+		insertAfter : function(node, reference_node) {
+			reference_node = this.get(reference_node);
+
+			return this.run(node, function(node) {
+				var parent, nextSibling;
+
+				parent = reference_node.parentNode;
+				nextSibling = reference_node.nextSibling;
+
+				if (nextSibling)
+					parent.insertBefore(node, nextSibling);
+				else
+					parent.appendChild(node);
+
+				return node;
+			});
+		},
+
+		isBlock : function(node) {
+			var type = node.nodeType;
+
+			// If it's a node then check the type and use the nodeName
+			if (type)
+				return !!(type === 1 && blockElementsMap[node.nodeName]);
+
+			return !!blockElementsMap[node];
+		},
+
+		replace : function(n, o, k) {
+			var t = this;
+
+			if (is(o, 'array'))
+				n = n.cloneNode(true);
+
+			return t.run(o, function(o) {
+				if (k) {
+					each(tinymce.grep(o.childNodes), function(c) {
+						n.appendChild(c);
+					});
+				}
+
+				return o.parentNode.replaceChild(n, o);
+			});
+		},
+
+		rename : function(elm, name) {
+			var t = this, newElm;
+
+			if (elm.nodeName != name.toUpperCase()) {
+				// Rename block element
+				newElm = t.create(name);
+
+				// Copy attribs to new block
+				each(t.getAttribs(elm), function(attr_node) {
+					t.setAttrib(newElm, attr_node.nodeName, t.getAttrib(elm, attr_node.nodeName));
+				});
+
+				// Replace block
+				t.replace(newElm, elm, 1);
+			}
+
+			return newElm || elm;
+		},
+
+		findCommonAncestor : function(a, b) {
+			var ps = a, pe;
+
+			while (ps) {
+				pe = b;
+
+				while (pe && ps != pe)
+					pe = pe.parentNode;
+
+				if (ps == pe)
+					break;
+
+				ps = ps.parentNode;
+			}
+
+			if (!ps && a.ownerDocument)
+				return a.ownerDocument.documentElement;
+
+			return ps;
+		},
+
+		toHex : function(s) {
+			var c = /^\s*rgb\s*?\(\s*?([0-9]+)\s*?,\s*?([0-9]+)\s*?,\s*?([0-9]+)\s*?\)\s*$/i.exec(s);
+
+			function hex(s) {
+				s = parseInt(s).toString(16);
+
+				return s.length > 1 ? s : '0' + s; // 0 -> 00
+			};
+
+			if (c) {
+				s = '#' + hex(c[1]) + hex(c[2]) + hex(c[3]);
+
+				return s;
+			}
+
+			return s;
+		},
+
+		getClasses : function() {
+			var t = this, cl = [], i, lo = {}, f = t.settings.class_filter, ov;
+
+			if (t.classes)
+				return t.classes;
+
+			function addClasses(s) {
+				// IE style imports
+				each(s.imports, function(r) {
+					addClasses(r);
+				});
+
+				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 = tinymce._replace(/.*\.([a-z0-9_\-]+).*/i, '$1', v);
+
+									// Filter classes
+									if (f && !(v = f(v, ov)))
+										return;
+
+									if (!lo[v]) {
+										cl.push({'class' : v});
+										lo[v] = 1;
+									}
+								});
+							}
+							break;
+
+						// Import
+						case 3:
+							addClasses(r.styleSheet);
+							break;
+					}
+				});
+			};
+
+			try {
+				each(t.doc.styleSheets, addClasses);
+			} catch (ex) {
+				// Ignore
+			}
+
+			if (cl.length > 0)
+				t.classes = cl;
+
+			return cl;
+		},
+
+		run : function(e, f, s) {
+			var t = this, o;
+
+			if (t.doc && typeof(e) === 'string')
+				e = t.get(e);
+
+			if (!e)
+				return false;
+
+			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);
+
+						o.push(f.call(s, e, i));
+					}
+				});
+
+				return o;
+			}
+
+			return f.call(s, e);
+		},
+
+		getAttribs : function(n) {
+			var o;
+
+			n = this.get(n);
+
+			if (!n)
+				return [];
+
+			if (isIE) {
+				o = [];
+
+				// Object will throw exception in IE
+				if (n.nodeName == 'OBJECT')
+					return n.attributes;
+
+				// IE doesn't keep the selected attribute if you clone option elements
+				if (n.nodeName === 'OPTION' && this.getAttrib(n, 'selected'))
+					o.push({specified : 1, nodeName : 'selected'});
+
+				// 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(/<\/?[\w:\-]+ ?|=[\"][^\"]+\"|=\'[^\']+\'|=[\w\-]+|>/gi, '').replace(/[\w:\-]+/gi, function(a) {
+					o.push({specified : 1, nodeName : a});
+				});
+
+				return o;
+			}
+
+			return n.attributes;
+		},
+
+		destroy : function(s) {
+			var t = this;
+
+			if (t.events)
+				t.events.destroy();
+
+			t.win = t.doc = t.root = t.events = null;
+
+			// Manual destroy then remove unload handler
+			if (!s)
+				tinymce.removeUnload(t.destroy);
+		},
+
+		createRng : function() {
+			var d = this.doc;
+
+			return d.createRange ? d.createRange() : new tinymce.dom.Range(this);
+		},
+
+		nodeIndex : function(node, normalized) {
+			var idx = 0, lastNodeType, lastNode, nodeType, nodeValueExists;
+
+			if (node) {
+				for (lastNodeType = node.nodeType, node = node.previousSibling, lastNode = node; node; node = node.previousSibling) {
+					nodeType = node.nodeType;
+
+					// Normalize text nodes
+					if (normalized && nodeType == 3) {
+						// ensure that text nodes that have been removed are handled correctly in Internet Explorer.
+						// (the nodeValue attribute will not exist, and will error here).
+						nodeValueExists = false;
+						try {nodeValueExists = node.nodeValue.length} catch (c) {}
+						if (nodeType == lastNodeType || !nodeValueExists)
+							continue;
+					}
+					idx++;
+					lastNodeType = nodeType;
+				}
+			}
+
+			return idx;
+		},
+
+		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 sense
+			// but we don't want that in our code since it serves no purpose for the end user
+			// 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 trim(node) {
+				var i, children = node.childNodes;
+
+				if (node.nodeType == 1 && node.getAttribute('data-mce-type') == 'bookmark')
+					return;
+
+				for (i = children.length - 1; i >= 0; i--)
+					trim(children[i]);
+
+				if (node.nodeType != 9) {
+					// Keep non whitespace text nodes
+					if (node.nodeType == 3 && node.nodeValue.length > 0) {
+						// If parent element isn't a block or there isn't any useful contents for example "<p>   </p>"
+						if (!t.isBlock(node.parentNode) || tinymce.trim(node.nodeValue).length > 0)
+							return;
+					}
+
+					if (node.nodeType == 1) {
+						// If the only child is a bookmark then move it up
+						children = node.childNodes;
+						if (children.length == 1 && children[0] && children[0].nodeType == 1 && children[0].getAttribute('data-mce-type') == 'bookmark')
+							node.parentNode.insertBefore(children[0], node);
+
+						// Keep non empty elements or img, hr etc
+						if (children.length || /^(br|hr|input|img)$/i.test(node.nodeName))
+							return;
+					}
+
+					t.remove(node);
+				}
+
+				return node;
+			};
+
+			if (pe && e) {
+				// Get before chunk
+				r.setStart(pe.parentNode, t.nodeIndex(pe));
+				r.setEnd(e.parentNode, t.nodeIndex(e));
+				bef = r.extractContents();
+
+				// Get after chunk
+				r = t.createRng();
+				r.setStart(e.parentNode, t.nodeIndex(e) + 1);
+				r.setEnd(pe.parentNode, t.nodeIndex(pe) + 1);
+				aft = r.extractContents();
+
+				// Insert before chunk
+				pa = pe.parentNode;
+				pa.insertBefore(trim(bef), pe);
+
+				// Insert middle chunk
+				if (re)
+					pa.replaceChild(re, e);
+				else
+					pa.insertBefore(e, pe);
+
+				// Insert after chunk
+				pa.insertBefore(trim(aft), pe);
+				t.remove(pe);
+
+				return re || e;
+			}
+		},
+
+		bind : function(target, name, func, scope) {
+			var t = this;
+
+			if (!t.events)
+				t.events = new tinymce.dom.EventUtils();
+
+			return t.events.add(target, name, func, scope || this);
+		},
+
+		unbind : function(target, name, func) {
+			var t = this;
+
+			if (!t.events)
+				t.events = new tinymce.dom.EventUtils();
+
+			return t.events.remove(target, name, func);
+		},
+
+
+		_findSib : function(node, selector, name) {
+			var t = this, f = selector;
+
+			if (node) {
+				// If expression make a function of it using is
+				if (is(f, 'string')) {
+					f = function(node) {
+						return t.is(node, selector);
+					};
+				}
+
+				// Loop all siblings
+				for (node = node[name]; node; node = node[name]) {
+					if (f(node))
+						return node;
+				}
+			}
+
+			return null;
+		},
+
+		_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);
+		}
+
+		/*
+		walk : function(n, f, s) {
+			var d = this.doc, w;
+
+			if (d.createTreeWalker) {
+				w = d.createTreeWalker(n, NodeFilter.SHOW_TEXT, null, false);
+
+				while ((n = w.nextNode()) != null)
+					f.call(s || this, n);
+			} else
+				tinymce.walk(n, f, 'childNodes', s);
+		}
+		*/
+
+		/*
+		toRGB : function(s) {
+			var c = /^\s*?#([0-9A-F]{2})([0-9A-F]{1,2})([0-9A-F]{2})?\s*?$/.exec(s);
+
+			if (c) {
+				// #FFF -> #FFFFFF
+				if (!is(c[3]))
+					c[3] = c[2] = c[1];
+
+				return "rgb(" + parseInt(c[1], 16) + "," + parseInt(c[2], 16) + "," + parseInt(c[3], 16) + ")";
+			}
+
+			return s;
+		}
+		*/
+	});
+
+	tinymce.DOM = new tinymce.dom.DOMUtils(document, {process_html : 0});
+})(tinymce);
+
+(function(ns) {
+	// Range constructor
+	function Range(dom) {
+		var t = this,
+			doc = dom.doc,
+			EXTRACT = 0,
+			CLONE = 1,
+			DELETE = 2,
+			TRUE = true,
+			FALSE = false,
+			START_OFFSET = 'startOffset',
+			START_CONTAINER = 'startContainer',
+			END_CONTAINER = 'endContainer',
+			END_OFFSET = 'endOffset',
+			extend = tinymce.extend,
+			nodeIndex = dom.nodeIndex;
+
+		extend(t, {
+			// Inital states
+			startContainer : doc,
+			startOffset : 0,
+			endContainer : doc,
+			endOffset : 0,
+			collapsed : TRUE,
+			commonAncestorContainer : doc,
+
+			// Range constants
+			START_TO_START : 0,
+			START_TO_END : 1,
+			END_TO_END : 2,
+			END_TO_START : 3,
+
+			// Public methods
+			setStart : setStart,
+			setEnd : setEnd,
+			setStartBefore : setStartBefore,
+			setStartAfter : setStartAfter,
+			setEndBefore : setEndBefore,
+			setEndAfter : setEndAfter,
+			collapse : collapse,
+			selectNode : selectNode,
+			selectNodeContents : selectNodeContents,
+			compareBoundaryPoints : compareBoundaryPoints,
+			deleteContents : deleteContents,
+			extractContents : extractContents,
+			cloneContents : cloneContents,
+			insertNode : insertNode,
+			surroundContents : surroundContents,
+			cloneRange : cloneRange
+		});
+
+		function setStart(n, o) {
+			_setEndPoint(TRUE, n, o);
+		};
+
+		function setEnd(n, o) {
+			_setEndPoint(FALSE, n, o);
+		};
+
+		function setStartBefore(n) {
+			setStart(n.parentNode, nodeIndex(n));
+		};
+
+		function setStartAfter(n) {
+			setStart(n.parentNode, nodeIndex(n) + 1);
+		};
+
+		function setEndBefore(n) {
+			setEnd(n.parentNode, nodeIndex(n));
+		};
+
+		function setEndAfter(n) {
+			setEnd(n.parentNode, nodeIndex(n) + 1);
+		};
+
+		function collapse(ts) {
+			if (ts) {
+				t[END_CONTAINER] = t[START_CONTAINER];
+				t[END_OFFSET] = t[START_OFFSET];
+			} else {
+				t[START_CONTAINER] = t[END_CONTAINER];
+				t[START_OFFSET] = t[END_OFFSET];
+			}
+
+			t.collapsed = TRUE;
+		};
+
+		function selectNode(n) {
+			setStartBefore(n);
+			setEndAfter(n);
+		};
+
+		function selectNodeContents(n) {
+			setStart(n, 0);
+			setEnd(n, n.nodeType === 1 ? n.childNodes.length : n.nodeValue.length);
+		};
+
+		function compareBoundaryPoints(h, r) {
+			var sc = t[START_CONTAINER], so = t[START_OFFSET], ec = t[END_CONTAINER], eo = t[END_OFFSET],
+			rsc = r.startContainer, rso = r.startOffset, rec = r.endContainer, reo = r.endOffset;
+
+			// Check START_TO_START
+			if (h === 0)
+				return _compareBoundaryPoints(sc, so, rsc, rso);
+	
+			// Check START_TO_END
+			if (h === 1)
+				return _compareBoundaryPoints(ec, eo, rsc, rso);
+	
+			// Check END_TO_END
+			if (h === 2)
+				return _compareBoundaryPoints(ec, eo, rec, reo);
+	
+			// Check END_TO_START
+			if (h === 3) 
+				return _compareBoundaryPoints(sc, so, rec, reo);
+		};
+
+		function deleteContents() {
+			_traverse(DELETE);
+		};
+
+		function extractContents() {
+			return _traverse(EXTRACT);
+		};
+
+		function cloneContents() {
+			return _traverse(CLONE);
+		};
+
+		function insertNode(n) {
+			var startContainer = this[START_CONTAINER],
+				startOffset = this[START_OFFSET], nn, o;
+
+			// Node is TEXT_NODE or CDATA
+			if ((startContainer.nodeType === 3 || startContainer.nodeType === 4) && startContainer.nodeValue) {
+				if (!startOffset) {
+					// At the start of text
+					startContainer.parentNode.insertBefore(n, startContainer);
+				} else if (startOffset >= startContainer.nodeValue.length) {
+					// At the end of text
+					dom.insertAfter(n, startContainer);
+				} else {
+					// Middle, need to split
+					nn = startContainer.splitText(startOffset);
+					startContainer.parentNode.insertBefore(n, nn);
+				}
+			} else {
+				// Insert element node
+				if (startContainer.childNodes.length > 0)
+					o = startContainer.childNodes[startOffset];
+
+				if (o)
+					startContainer.insertBefore(n, o);
+				else
+					startContainer.appendChild(n);
+			}
+		};
+
+		function surroundContents(n) {
+			var f = t.extractContents();
+
+			t.insertNode(n);
+			n.appendChild(f);
+			t.selectNode(n);
+		};
+
+		function cloneRange() {
+			return extend(new Range(dom), {
+				startContainer : t[START_CONTAINER],
+				startOffset : t[START_OFFSET],
+				endContainer : t[END_CONTAINER],
+				endOffset : t[END_OFFSET],
+				collapsed : t.collapsed,
+				commonAncestorContainer : t.commonAncestorContainer
+			});
+		};
+
+		// Private methods
+
+		function _getSelectedNode(container, offset) {
+			var child;
+
+			if (container.nodeType == 3 /* TEXT_NODE */)
+				return container;
+
+			if (offset < 0)
+				return container;
+
+			child = container.firstChild;
+			while (child && offset > 0) {
+				--offset;
+				child = child.nextSibling;
+			}
+
+			if (child)
+				return child;
+
+			return container;
+		};
+
+		function _isCollapsed() {
+			return (t[START_CONTAINER] == t[END_CONTAINER] && t[START_OFFSET] == t[END_OFFSET]);
+		};
+
+		function _compareBoundaryPoints(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
+
+				if (offsetA < offsetB)
+					return -1; // before
+
+				return 1; // after
+			}
+
+			// 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;
+
+				while (n != c && offsetC < offsetA) {
+					offsetC++;
+					n = n.nextSibling;
+				}
+
+				if (offsetA <= offsetC)
+					return -1; // before
+
+				return 1; // after
+			}
+
+			// 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;
+			}
+
+			if (c) {
+				offsetC = 0;
+				n = containerB.firstChild;
+
+				while (n != c && offsetC < offsetB) {
+					offsetC++;
+					n = n.nextSibling;
+				}
+
+				if (offsetC < offsetB)
+					return -1; // before
+
+				return 1; // after
+			}
+
+			// 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 = dom.findCommonAncestor(containerA, containerB);
+			childA = containerA;
+
+			while (childA && childA.parentNode != cmnRoot)
+				childA = childA.parentNode;
+
+			if (!childA)
+				childA = cmnRoot;
+
+			childB = containerB;
+			while (childB && childB.parentNode != cmnRoot)
+				childB = childB.parentNode;
+
+			if (!childB)
+				childB = cmnRoot;
+
+			if (childA == childB)
+				return 0; // equal
+
+			n = cmnRoot.firstChild;
+			while (n) {
+				if (n == childA)
+					return -1; // before
+
+				if (n == childB)
+					return 1; // after
+
+				n = n.nextSibling;
+			}
+		};
+
+		function _setEndPoint(st, n, o) {
+			var ec, sc;
+
+			if (st) {
+				t[START_CONTAINER] = n;
+				t[START_OFFSET] = o;
+			} else {
+				t[END_CONTAINER] = n;
+				t[END_OFFSET] = o;
+			}
+
+			// 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[END_CONTAINER];
+			while (ec.parentNode)
+				ec = ec.parentNode;
+
+			sc = t[START_CONTAINER];
+			while (sc.parentNode)
+				sc = sc.parentNode;
+
+			if (sc == ec) {
+				// 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 (_compareBoundaryPoints(t[START_CONTAINER], t[START_OFFSET], t[END_CONTAINER], t[END_OFFSET]) > 0)
+					t.collapse(st);
+			} else
+				t.collapse(st);
+
+			t.collapsed = _isCollapsed();
+			t.commonAncestorContainer = dom.findCommonAncestor(t[START_CONTAINER], t[END_CONTAINER]);
+		};
+
+		function _traverse(how) {
+			var c, endContainerDepth = 0, startContainerDepth = 0, p, depthDiff, startNode, endNode, sp, ep;
+
+			if (t[START_CONTAINER] == t[END_CONTAINER])
+				return _traverseSameContainer(how);
+
+			for (c = t[END_CONTAINER], p = c.parentNode; p; c = p, p = p.parentNode) {
+				if (p == t[START_CONTAINER])
+					return _traverseCommonStartContainer(c, how);
+
+				++endContainerDepth;
+			}
+
+			for (c = t[START_CONTAINER], p = c.parentNode; p; c = p, p = p.parentNode) {
+				if (p == t[END_CONTAINER])
+					return _traverseCommonEndContainer(c, how);
+
+				++startContainerDepth;
+			}
+
+			depthDiff = startContainerDepth - endContainerDepth;
+
+			startNode = t[START_CONTAINER];
+			while (depthDiff > 0) {
+				startNode = startNode.parentNode;
+				depthDiff--;
+			}
+
+			endNode = t[END_CONTAINER];
+			while (depthDiff < 0) {
+				endNode = endNode.parentNode;
+				depthDiff++;
+			}
+
+			// 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;
+			}
+
+			return _traverseCommonAncestors(startNode, endNode, how);
+		};
+
+		 function _traverseSameContainer(how) {
+			var frag, s, sub, n, cnt, sibling, xferNode;
+
+			if (how != DELETE)
+				frag = doc.createDocumentFragment();
+
+			// If selection is empty, just return the fragment
+			if (t[START_OFFSET] == t[END_OFFSET])
+				return frag;
+
+			// Text node needs special case handling
+			if (t[START_CONTAINER].nodeType == 3 /* TEXT_NODE */) {
+				// get the substring
+				s = t[START_CONTAINER].nodeValue;
+				sub = s.substring(t[START_OFFSET], t[END_OFFSET]);
+
+				// set the original text node to its new value
+				if (how != CLONE) {
+					t[START_CONTAINER].deleteData(t[START_OFFSET], t[END_OFFSET] - t[START_OFFSET]);
+
+					// Nothing is partially selected, so collapse to start point
+					t.collapse(TRUE);
+				}
+
+				if (how == DELETE)
+					return;
+
+				frag.appendChild(doc.createTextNode(sub));
+				return frag;
+			}
+
+			// Copy nodes between the start/end offsets.
+			n = _getSelectedNode(t[START_CONTAINER], t[START_OFFSET]);
+			cnt = t[END_OFFSET] - t[START_OFFSET];
+
+			while (cnt > 0) {
+				sibling = n.nextSibling;
+				xferNode = _traverseFullySelected(n, how);
+
+				if (frag)
+					frag.appendChild( xferNode );
+
+				--cnt;
+				n = sibling;
+			}
+
+			// Nothing is partially selected, so collapse to start point
+			if (how != CLONE)
+				t.collapse(TRUE);
+
+			return frag;
+		};
+
+		function _traverseCommonStartContainer(endAncestor, how) {
+			var frag, n, endIdx, cnt, sibling, xferNode;
+
+			if (how != DELETE)
+				frag = doc.createDocumentFragment();
+
+			n = _traverseRightBoundary(endAncestor, how);
+
+			if (frag)
+				frag.appendChild(n);
+
+			endIdx = nodeIndex(endAncestor);
+			cnt = endIdx - t[START_OFFSET];
+
+			if (cnt <= 0) {
+				// Collapse to just before the endAncestor, which
+				// is partially selected.
+				if (how != CLONE) {
+					t.setEndBefore(endAncestor);
+					t.collapse(FALSE);
+				}
+
+				return frag;
+			}
+
+			n = endAncestor.previousSibling;
+			while (cnt > 0) {
+				sibling = n.previousSibling;
+				xferNode = _traverseFullySelected(n, how);
+
+				if (frag)
+					frag.insertBefore(xferNode, frag.firstChild);
+
+				--cnt;
+				n = sibling;
+			}
+
+			// Collapse to just before the endAncestor, which
+			// is partially selected.
+			if (how != CLONE) {
+				t.setEndBefore(endAncestor);
+				t.collapse(FALSE);
+			}
+
+			return frag;
+		};
+
+		function _traverseCommonEndContainer(startAncestor, how) {
+			var frag, startIdx, n, cnt, sibling, xferNode;
+
+			if (how != DELETE)
+				frag = doc.createDocumentFragment();
+
+			n = _traverseLeftBoundary(startAncestor, how);
+			if (frag)
+				frag.appendChild(n);
+
+			startIdx = nodeIndex(startAncestor);
+			++startIdx; // Because we already traversed it
+
+			cnt = t[END_OFFSET] - startIdx;
+			n = startAncestor.nextSibling;
+			while (cnt > 0) {
+				sibling = n.nextSibling;
+				xferNode = _traverseFullySelected(n, how);
+
+				if (frag)
+					frag.appendChild(xferNode);
+
+				--cnt;
+				n = sibling;
+			}
+
+			if (how != CLONE) {
+				t.setStartAfter(startAncestor);
+				t.collapse(TRUE);
+			}
+
+			return frag;
+		};
+
+		function _traverseCommonAncestors(startAncestor, endAncestor, how) {
+			var n, frag, commonParent, startOffset, endOffset, cnt, sibling, nextSibling;
+
+			if (how != DELETE)
+				frag = doc.createDocumentFragment();
+
+			n = _traverseLeftBoundary(startAncestor, how);
+			if (frag)
+				frag.appendChild(n);
+
+			commonParent = startAncestor.parentNode;
+			startOffset = nodeIndex(startAncestor);
+			endOffset = nodeIndex(endAncestor);
+			++startOffset;
+
+			cnt = endOffset - startOffset;
+			sibling = startAncestor.nextSibling;
+
+			while (cnt > 0) {
+				nextSibling = sibling.nextSibling;
+				n = _traverseFullySelected(sibling, how);
+
+				if (frag)
+					frag.appendChild(n);
+
+				sibling = nextSibling;
+				--cnt;
+			}
+
+			n = _traverseRightBoundary(endAncestor, how);
+
+			if (frag)
+				frag.appendChild(n);
+
+			if (how != CLONE) {
+				t.setStartAfter(startAncestor);
+				t.collapse(TRUE);
+			}
+
+			return frag;
+		};
+
+		function _traverseRightBoundary(root, how) {
+			var next = _getSelectedNode(t[END_CONTAINER], t[END_OFFSET] - 1), parent, clonedParent, prevSibling, clonedChild, clonedGrandParent, isFullySelected = next != t[END_CONTAINER];
+
+			if (next == root)
+				return _traverseNode(next, isFullySelected, FALSE, how);
+
+			parent = next.parentNode;
+			clonedParent = _traverseNode(parent, FALSE, FALSE, how);
+
+			while (parent) {
+				while (next) {
+					prevSibling = next.previousSibling;
+					clonedChild = _traverseNode(next, isFullySelected, FALSE, how);
+
+					if (how != DELETE)
+						clonedParent.insertBefore(clonedChild, clonedParent.firstChild);
+
+					isFullySelected = TRUE;
+					next = prevSibling;
+				}
+
+				if (parent == root)
+					return clonedParent;
+
+				next = parent.previousSibling;
+				parent = parent.parentNode;
+
+				clonedGrandParent = _traverseNode(parent, FALSE, FALSE, how);
+
+				if (how != DELETE)
+					clonedGrandParent.appendChild(clonedParent);
+
+				clonedParent = clonedGrandParent;
+			}
+		};
+
+		function _traverseLeftBoundary(root, how) {
+			var next = _getSelectedNode(t[START_CONTAINER], t[START_OFFSET]), isFullySelected = next != t[START_CONTAINER], parent, clonedParent, nextSibling, clonedChild, clonedGrandParent;
+
+			if (next == root)
+				return _traverseNode(next, isFullySelected, TRUE, how);
+
+			parent = next.parentNode;
+			clonedParent = _traverseNode(parent, FALSE, TRUE, how);
+
+			while (parent) {
+				while (next) {
+					nextSibling = next.nextSibling;
+					clonedChild = _traverseNode(next, isFullySelected, TRUE, how);
+
+					if (how != DELETE)
+						clonedParent.appendChild(clonedChild);
+
+					isFullySelected = TRUE;
+					next = nextSibling;
+				}
+
+				if (parent == root)
+					return clonedParent;
+
+				next = parent.nextSibling;
+				parent = parent.parentNode;
+
+				clonedGrandParent = _traverseNode(parent, FALSE, TRUE, how);
+
+				if (how != DELETE)
+					clonedGrandParent.appendChild(clonedParent);
+
+				clonedParent = clonedGrandParent;
+			}
+		};
+
+		function _traverseNode(n, isFullySelected, isLeft, how) {
+			var txtValue, newNodeValue, oldNodeValue, offset, newNode;
+
+			if (isFullySelected)
+				return _traverseFullySelected(n, how);
+
+			if (n.nodeType == 3 /* TEXT_NODE */) {
+				txtValue = n.nodeValue;
+
+				if (isLeft) {
+					offset = t[START_OFFSET];
+					newNodeValue = txtValue.substring(offset);
+					oldNodeValue = txtValue.substring(0, offset);
+				} else {
+					offset = t[END_OFFSET];
+					newNodeValue = txtValue.substring(0, offset);
+					oldNodeValue = txtValue.substring(offset);
+				}
+
+				if (how != CLONE)
+					n.nodeValue = oldNodeValue;
+
+				if (how == DELETE)
+					return;
+
+				newNode = n.cloneNode(FALSE);
+				newNode.nodeValue = newNodeValue;
+
+				return newNode;
+			}
+
+			if (how == DELETE)
+				return;
+
+			return n.cloneNode(FALSE);
+		};
+
+		function _traverseFullySelected(n, how) {
+			if (how != DELETE)
+				return how == CLONE ? n.cloneNode(TRUE) : n;
+
+			n.parentNode.removeChild(n);
+		};
+	};
+
+	ns.Range = Range;
+})(tinymce.dom);
+
+(function() {
+	function Selection(selection) {
+		var t = this, invisibleChar = '\uFEFF', range, lastIERng, dom = selection.dom, TRUE = true, FALSE = false;
+
+		// Returns a W3C DOM compatible range object by using the IE Range API
+		function getRange() {
+			var ieRange = selection.getRng(), domRange = dom.createRng(), element, collapsed;
+
+			// 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;
+
+			collapsed = selection.isCollapsed();
+
+			// Handle control selection or text selection of a image
+			if (ieRange.item || !element.hasChildNodes()) {
+				if (collapsed) {
+					domRange.setStart(element, 0);
+					domRange.setEnd(element, 0);
+				} else {
+					domRange.setStart(element.parentNode, dom.nodeIndex(element));
+					domRange.setEnd(domRange.startContainer, domRange.startOffset + 1);
+				}
+
+				return domRange;
+			}
+
+			function findEndPoint(start) {
+				var marker, container, offset, nodes, startIndex = 0, endIndex, index, parent, checkRng, position;
+
+				// Setup temp range and collapse it
+				checkRng = ieRange.duplicate();
+				checkRng.collapse(start);
+
+				// Create marker and insert it at the end of the endpoints parent
+				marker = dom.create('a');
+				parent = checkRng.parentElement();
+
+				// If parent doesn't have any children then set the container to that parent and the index to 0
+				if (!parent.hasChildNodes()) {
+					domRange[start ? 'setStart' : 'setEnd'](parent, 0);
+					return;
+				}
+
+				parent.appendChild(marker);
+				checkRng.moveToElementText(marker);
+				position = ieRange.compareEndPoints(start ? 'StartToStart' : 'EndToEnd', checkRng);
+				if (position > 0) {
+					// The position is after the end of the parent element.
+					// This is the case where IE puts the caret to the left edge of a table.
+					domRange[start ? 'setStartAfter' : 'setEndAfter'](parent);
+					dom.remove(marker);
+					return;
+				}
+
+				// Setup node list and endIndex
+				nodes = tinymce.grep(parent.childNodes);
+				endIndex = nodes.length - 1;
+				// Perform a binary search for the position
+				while (startIndex <= endIndex) {
+					index = Math.floor((startIndex + endIndex) / 2);
+
+					// Insert marker and check it's position relative to the selection
+					parent.insertBefore(marker, nodes[index]);
+					checkRng.moveToElementText(marker);
+					position = ieRange.compareEndPoints(start ? 'StartToStart' : 'EndToEnd', checkRng);
+					if (position > 0) {
+						// Marker is to the right
+						startIndex = index + 1;
+					} else if (position < 0) {
+						// Marker is to the left
+						endIndex = index - 1;
+					} else {
+						// Maker is where we are
+						found = true;
+						break;
+					}
+				}
+
+				// Setup container
+				container = position > 0 || index == 0 ? marker.nextSibling : marker.previousSibling;
+
+				// Handle element selection
+				if (container.nodeType == 1) {
+					dom.remove(marker);
+
+					// Find offset and container
+					offset = dom.nodeIndex(container);
+					container = container.parentNode;
+
+					// Move the offset if we are setting the end or the position is after an element
+					if (!start || index > 0)
+						offset++;
+				} else {
+					// Calculate offset within text node
+					if (position > 0 || index == 0) {
+						checkRng.setEndPoint(start ? 'StartToStart' : 'EndToEnd', ieRange);
+						offset = checkRng.text.length;
+					} else {
+						checkRng.setEndPoint(start ? 'StartToStart' : 'EndToEnd', ieRange);
+						offset = container.nodeValue.length - checkRng.text.length;
+					}
+
+					dom.remove(marker);
+				}
+
+				domRange[start ? 'setStart' : 'setEnd'](container, offset);
+			};
+
+			// Find start point
+			findEndPoint(true);
+
+			// Find end point if needed
+			if (!collapsed)
+				findEndPoint();
+
+			return domRange;
+		};
+
+		this.addRange = function(rng) {
+			var ieRng, ctrlRng, startContainer, startOffset, endContainer, endOffset, doc = selection.dom.doc, body = doc.body;
+
+			function setEndPoint(start) {
+				var container, offset, marker, tmpRng, nodes;
+
+				marker = dom.create('a');
+				container = start ? startContainer : endContainer;
+				offset = start ? startOffset : endOffset;
+				tmpRng = ieRng.duplicate();
+
+				if (container == doc || container == doc.documentElement) {
+					container = body;
+					offset = 0;
+				}
+
+				if (container.nodeType == 3) {
+					container.parentNode.insertBefore(marker, container);
+					tmpRng.moveToElementText(marker);
+					tmpRng.moveStart('character', offset);
+					dom.remove(marker);
+					ieRng.setEndPoint(start ? 'StartToStart' : 'EndToEnd', tmpRng);
+				} else {
+					nodes = container.childNodes;
+
+					if (nodes.length) {
+						if (offset >= nodes.length) {
+							dom.insertAfter(marker, nodes[nodes.length - 1]);
+						} else {
+							container.insertBefore(marker, nodes[offset]);
+						}
+
+						tmpRng.moveToElementText(marker);
+					} else {
+						// Empty node selection for example <div>|</div>
+						marker = doc.createTextNode(invisibleChar);
+						container.appendChild(marker);
+						tmpRng.moveToElementText(marker.parentNode);
+						tmpRng.collapse(TRUE);
+					}
+
+					ieRng.setEndPoint(start ? 'StartToStart' : 'EndToEnd', tmpRng);
+					dom.remove(marker);
+				}
+			}
+
+			// Destroy cached range
+			this.destroy();
+
+			// Setup some shorter versions
+			startContainer = rng.startContainer;
+			startOffset = rng.startOffset;
+			endContainer = rng.endContainer;
+			endOffset = rng.endOffset;
+			ieRng = body.createTextRange();
+
+			// If single element selection then try making a control selection out of it
+			if (startContainer == endContainer && startContainer.nodeType == 1 && startOffset == endOffset - 1) {
+				if (startOffset == endOffset - 1) {
+					try {
+						ctrlRng = body.createControlRange();
+						ctrlRng.addElement(startContainer.childNodes[startOffset]);
+						ctrlRng.select();
+						return;
+					} catch (ex) {
+						// Ignore
+					}
+				}
+			}
+
+			// Set start/end point of selection
+			setEndPoint(true);
+			setEndPoint();
+
+			// Select the new range and scroll it into view
+			ieRng.select();
+		};
+
+		this.getRangeAt = function() {
+			// Setup new range if the cache is empty
+			if (!range || !tinymce.dom.RangeUtils.compareRanges(lastIERng, selection.getRng())) {
+				range = getRange();
+
+				// Store away text range for next call
+				lastIERng = selection.getRng();
+			}
+
+			// IE will say that the range is equal then produce an invalid argument exception
+			// if you perform specific operations in a keyup event. For example Ctrl+Del.
+			// This hack will invalidate the range cache if the exception occurs
+			try {
+				range.startContainer.nextSibling;
+			} catch (ex) {
+				range = getRange();
+				lastIERng = null;
+			}
+
+			// Return cached range
+			return range;
+		};
+
+		this.destroy = function() {
+			// Destroy cached range and last IE range to avoid memory leaks
+			lastIERng = range = null;
+		};
+	};
+
+	// Expose the selection object
+	tinymce.dom.TridentSelection = Selection;
+})();
+
+
+/*
+ * 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*)?((?:.|\r|\n)*)/g,
+	done = 0,
+	toString = Object.prototype.toString,
+	hasDuplicate = false,
+	baseHasDuplicate = true;
+
+// Here we check if the JavaScript engine is using some sort of
+// optimization where it does not always call our comparision
+// function. If that is the case, discard the hasDuplicate value.
+//   Thus far that includes Google Chrome.
+[0, 0].sort(function(){
+	baseHasDuplicate = false;
+	return 0;
+});
+
+var Sizzle = function(selector, context, results, seed) {
+	results = results || [];
+	context = context || document;
+
+	var origContext = context;
+
+	if ( context.nodeType !== 1 && context.nodeType !== 9 ) {
+		return [];
+	}
+	
+	if ( !selector || typeof selector !== "string" ) {
+		return results;
+	}
+
+	var parts = [], m, set, checkSet, extra, prune = true, contextXML = Sizzle.isXML(context),
+		soFar = selector, ret, cur, pop, i;
+	
+	// Reset the position of the chunker regexp (start from head)
+	do {
+		chunker.exec("");
+		m = chunker.exec(soFar);
+
+		if ( m ) {
+			soFar = m[3];
+		
+			parts.push( m[1] );
+		
+			if ( m[2] ) {
+				extra = m[3];
+				break;
+			}
+		}
+	} while ( m );
+
+	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 );
+
+			while ( parts.length ) {
+				selector = parts.shift();
+
+				if ( Expr.relative[ selector ] ) {
+					selector += parts.shift();
+				}
+				
+				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]) ) {
+			ret = Sizzle.find( parts.shift(), context, contextXML );
+			context = ret.expr ? Sizzle.filter( ret.expr, ret.set )[0] : ret.set[0];
+		}
+
+		if ( context ) {
+			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;
+
+			if ( parts.length > 0 ) {
+				checkSet = makeArray(set);
+			} else {
+				prune = false;
+			}
+
+			while ( parts.length ) {
+				cur = parts.pop();
+				pop = cur;
+
+				if ( !Expr.relative[ cur ] ) {
+					cur = "";
+				} else {
+					pop = parts.pop();
+				}
+
+				if ( pop == null ) {
+					pop = context;
+				}
+
+				Expr.relative[ cur ]( checkSet, pop, contextXML );
+			}
+		} else {
+			checkSet = parts = [];
+		}
+	}
+
+	if ( !checkSet ) {
+		checkSet = set;
+	}
+
+	if ( !checkSet ) {
+		Sizzle.error( cur || selector );
+	}
+
+	if ( toString.call(checkSet) === "[object Array]" ) {
+		if ( !prune ) {
+			results.push.apply( results, checkSet );
+		} else if ( context && context.nodeType === 1 ) {
+			for ( i = 0; checkSet[i] != null; i++ ) {
+				if ( checkSet[i] && (checkSet[i] === true || checkSet[i].nodeType === 1 && Sizzle.contains(context, checkSet[i])) ) {
+					results.push( set[i] );
+				}
+			}
+		} else {
+			for ( i = 0; checkSet[i] != null; i++ ) {
+				if ( checkSet[i] && checkSet[i].nodeType === 1 ) {
+					results.push( set[i] );
+				}
+			}
+		}
+	} else {
+		makeArray( checkSet, results );
+	}
+
+	if ( extra ) {
+		Sizzle( extra, origContext, results, seed );
+		Sizzle.uniqueSort( results );
+	}
+
+	return results;
+};
+
+Sizzle.uniqueSort = function(results){
+	if ( sortOrder ) {
+		hasDuplicate = baseHasDuplicate;
+		results.sort(sortOrder);
+
+		if ( hasDuplicate ) {
+			for ( var i = 1; i < results.length; i++ ) {
+				if ( results[i] === results[i-1] ) {
+					results.splice(i--, 1);
+				}
+			}
+		}
+	}
+
+	return results;
+};
+
+Sizzle.matches = function(expr, set){
+	return Sizzle(expr, null, null, set);
+};
+
+Sizzle.find = function(expr, context, isXML){
+	var set;
+
+	if ( !expr ) {
+		return [];
+	}
+
+	for ( var i = 0, l = Expr.order.length; i < l; i++ ) {
+		var type = Expr.order[i], match;
+		
+		if ( (match = Expr.leftMatch[ type ].exec( expr )) ) {
+			var left = match[1];
+			match.splice(1,1);
+
+			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;
+				}
+			}
+		}
+	}
+
+	if ( !set ) {
+		set = context.getElementsByTagName("*");
+	}
+
+	return {set: set, expr: expr};
+};
+
+Sizzle.filter = function(expr, set, inplace, not){
+	var old = expr, result = [], curLoop = set, match, anyFound,
+		isXMLFilter = set && set[0] && Sizzle.isXML(set[0]);
+
+	while ( expr && set.length ) {
+		for ( var type in Expr.filter ) {
+			if ( (match = Expr.leftMatch[ type ].exec( expr )) != null && match[2] ) {
+				var filter = Expr.filter[ type ], found, item, left = match[1];
+				anyFound = false;
+
+				match.splice(1,1);
+
+				if ( left.substr( left.length - 1 ) === "\\" ) {
+					continue;
+				}
+
+				if ( curLoop === result ) {
+					result = [];
+				}
+
+				if ( Expr.preFilter[ type ] ) {
+					match = Expr.preFilter[ type ]( match, curLoop, inplace, result, not, isXMLFilter );
+
+					if ( !match ) {
+						anyFound = found = true;
+					} else if ( match === true ) {
+						continue;
+					}
+				}
+
+				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;
+							}
+						}
+					}
+				}
+
+				if ( found !== undefined ) {
+					if ( !inplace ) {
+						curLoop = result;
+					}
+
+					expr = expr.replace( Expr.match[ type ], "" );
+
+					if ( !anyFound ) {
+						return [];
+					}
+
+					break;
+				}
+			}
+		}
+
+		// Improper expression
+		if ( expr === old ) {
+			if ( anyFound == null ) {
+				Sizzle.error( expr );
+			} else {
+				break;
+			}
+		}
+
+		old = expr;
+	}
+
+	return curLoop;
+};
+
+Sizzle.error = function( msg ) {
+	throw "Syntax error, unrecognized expression: " + msg;
+};
+
+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\))?/
+	},
+	leftMatch: {},
+	attrMap: {
+		"class": "className",
+		"for": "htmlFor"
+	},
+	attrHandle: {
+		href: function(elem){
+			return elem.getAttribute("href");
+		}
+	},
+	relative: {
+		"+": function(checkSet, part){
+			var isPartStr = typeof part === "string",
+				isTag = isPartStr && !/\W/.test(part),
+				isPartStrNotTag = isPartStr && !isTag;
+
+			if ( isTag ) {
+				part = part.toLowerCase();
+			}
+
+			for ( var i = 0, l = checkSet.length, elem; i < l; i++ ) {
+				if ( (elem = checkSet[i]) ) {
+					while ( (elem = elem.previousSibling) && elem.nodeType !== 1 ) {}
+
+					checkSet[i] = isPartStrNotTag || elem && elem.nodeName.toLowerCase() === part ?
+						elem || false :
+						elem === part;
+				}
+			}
+
+			if ( isPartStrNotTag ) {
+				Sizzle.filter( part, checkSet, true );
+			}
+		},
+		">": function(checkSet, part){
+			var isPartStr = typeof part === "string",
+				elem, i = 0, l = checkSet.length;
+
+			if ( isPartStr && !/\W/.test(part) ) {
+				part = part.toLowerCase();
+
+				for ( ; i < l; i++ ) {
+					elem = checkSet[i];
+					if ( elem ) {
+						var parent = elem.parentNode;
+						checkSet[i] = parent.nodeName.toLowerCase() === part ? parent : false;
+					}
+				}
+			} else {
+				for ( ; i < l; i++ ) {
+					elem = checkSet[i];
+					if ( elem ) {
+						checkSet[i] = isPartStr ?
+							elem.parentNode :
+							elem.parentNode === part;
+					}
+				}
+
+				if ( isPartStr ) {
+					Sizzle.filter( part, checkSet, true );
+				}
+			}
+		},
+		"": function(checkSet, part, isXML){
+			var doneName = done++, checkFn = dirCheck, nodeCheck;
+
+			if ( typeof part === "string" && !/\W/.test(part) ) {
+				part = part.toLowerCase();
+				nodeCheck = part;
+				checkFn = dirNodeCheck;
+			}
+
+			checkFn("parentNode", part, doneName, checkSet, nodeCheck, isXML);
+		},
+		"~": function(checkSet, part, isXML){
+			var doneName = done++, checkFn = dirCheck, nodeCheck;
+
+			if ( typeof part === "string" && !/\W/.test(part) ) {
+				part = part.toLowerCase();
+				nodeCheck = part;
+				checkFn = dirNodeCheck;
+			}
+
+			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){
+			if ( typeof context.getElementsByName !== "undefined" ) {
+				var ret = [], results = context.getElementsByName(match[1]);
+
+				for ( var i = 0, l = results.length; i < l; i++ ) {
+					if ( results[i].getAttribute("name") === match[1] ) {
+						ret.push( results[i] );
+					}
+				}
+
+				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, "") + " ";
+
+			if ( isXML ) {
+				return match;
+			}
+
+			for ( var i = 0, elem; (elem = curLoop[i]) != null; i++ ) {
+				if ( elem ) {
+					if ( not ^ (elem.className && (" " + elem.className + " ").replace(/[\t\n]/g, " ").indexOf(match) >= 0) ) {
+						if ( !inplace ) {
+							result.push( elem );
+						}
+					} else if ( inplace ) {
+						curLoop[i] = false;
+					}
+				}
+			}
+
+			return false;
+		},
+		ID: function(match){
+			return match[1].replace(/\\/g, "");
+		},
+		TAG: function(match, curLoop){
+			return match[1].toLowerCase();
+		},
+		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 ( ( chunker.exec(match[3]) || "" ).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.toLowerCase() === "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 || Sizzle.getText([ elem ]) || "").indexOf(match[3]) >= 0;
+			} else if ( name === "not" ) {
+				var not = match[3];
+
+				for ( var j = 0, l = not.length; j < l; j++ ) {
+					if ( not[j] === elem ) {
+						return false;
+					}
+				}
+
+				return true;
+			} else {
+				Sizzle.error( "Syntax error, unrecognized expression: " + name );
+			}
+		},
+		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 ( 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.toLowerCase() === 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 origPOS = Expr.match.POS,
+	fescape = function(all, num){
+		return "\\" + (num - 0 + 1);
+	};
+
+for ( var type in Expr.match ) {
+	Expr.match[ type ] = new RegExp( Expr.match[ type ].source + (/(?![^\[]*\])(?![^\(]*\))/.source) );
+	Expr.leftMatch[ type ] = new RegExp( /(^(?:.|\r|\n)*?)/.source + Expr.match[ type ].source.replace(/\\(\d+)/g, fescape) );
+}
+
+var makeArray = function(array, results) {
+	array = Array.prototype.slice.call( array, 0 );
+
+	if ( results ) {
+		results.push.apply( results, array );
+		return results;
+	}
+	
+	return array;
+};
+
+// Perform a simple check to determine if the browser is capable of
+// converting a NodeList to an array using builtin methods.
+// Also verifies that the returned array holds DOM nodes
+// (which is not the case in the Blackberry browser)
+try {
+	Array.prototype.slice.call( document.documentElement.childNodes, 0 )[0].nodeType;
+
+// Provide a fallback method if it does not work
+} catch(e){
+	makeArray = function(array, results) {
+		var ret = results || [], i = 0;
+
+		if ( toString.call(array) === "[object Array]" ) {
+			Array.prototype.push.apply( ret, array );
+		} else {
+			if ( typeof array.length === "number" ) {
+				for ( var l = array.length; i < l; i++ ) {
+					ret.push( array[i] );
+				}
+			} else {
+				for ( ; array[i]; i++ ) {
+					ret.push( array[i] );
+				}
+			}
+		}
+
+		return ret;
+	};
+}
+
+var sortOrder;
+
+if ( document.documentElement.compareDocumentPosition ) {
+	sortOrder = function( a, b ) {
+		if ( !a.compareDocumentPosition || !b.compareDocumentPosition ) {
+			if ( a == b ) {
+				hasDuplicate = true;
+			}
+			return a.compareDocumentPosition ? -1 : 1;
+		}
+
+		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 ) {
+		if ( !a.sourceIndex || !b.sourceIndex ) {
+			if ( a == b ) {
+				hasDuplicate = true;
+			}
+			return a.sourceIndex ? -1 : 1;
+		}
+
+		var ret = a.sourceIndex - b.sourceIndex;
+		if ( ret === 0 ) {
+			hasDuplicate = true;
+		}
+		return ret;
+	};
+} else if ( document.createRange ) {
+	sortOrder = function( a, b ) {
+		if ( !a.ownerDocument || !b.ownerDocument ) {
+			if ( a == b ) {
+				hasDuplicate = true;
+			}
+			return a.ownerDocument ? -1 : 1;
+		}
+
+		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;
+	};
+}
+
+// Utility function for retreiving the text value of an array of DOM nodes
+Sizzle.getText = function( elems ) {
+	var ret = "", elem;
+
+	for ( var i = 0; elems[i]; i++ ) {
+		elem = elems[i];
+
+		// Get the text from text nodes and CDATA nodes
+		if ( elem.nodeType === 3 || elem.nodeType === 4 ) {
+			ret += elem.nodeValue;
+
+		// Traverse everything else, except comment nodes
+		} else if ( elem.nodeType !== 8 ) {
+			ret += Sizzle.getText( elem.childNodes );
+		}
+	}
+
+	return ret;
+};
+
+// 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 : [];
+			}
+		};
+
+		Expr.filter.ID = function(elem, match){
+			var node = typeof elem.getAttributeNode !== "undefined" && elem.getAttributeNode("id");
+			return elem.nodeType === 1 && node && node.nodeValue === match;
+		};
+	}
+
+	root.removeChild( form );
+	root = form = null; // release memory in IE
+})();
+
+(function(){
+	// Check to see if the browser returns only elements
+	// when doing getElementsByTagName("*")
+
+	// Create a fake element
+	var div = document.createElement("div");
+	div.appendChild( document.createComment("") );
+
+	// Make sure no comments are found
+	if ( div.getElementsByTagName("*").length > 0 ) {
+		Expr.find.TAG = function(match, context){
+			var results = context.getElementsByTagName(match[1]);
+
+			// Filter out possible comments
+			if ( match[1] === "*" ) {
+				var tmp = [];
+
+				for ( var i = 0; results[i]; i++ ) {
+					if ( results[i].nodeType === 1 ) {
+						tmp.push( results[i] );
+					}
+				}
+
+				results = tmp;
+			}
+
+			return results;
+		};
+	}
+
+	// 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);
+		};
+	}
+
+	div = null; // release memory in IE
+})();
+
+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;
+
+			// Only use querySelectorAll on non-XML documents
+			// (ID selectors don't work in non-HTML documents)
+			if ( !seed && context.nodeType === 9 && !Sizzle.isXML(context) ) {
+				try {
+					return makeArray( context.querySelectorAll(query), extra );
+				} catch(e){}
+			}
+		
+			return oldSizzle(query, context, extra, seed);
+		};
+
+		for ( var prop in oldSizzle ) {
+			Sizzle[ prop ] = oldSizzle[ prop ];
+		}
+
+		div = null; // release memory in IE
+	})();
+}
+
+(function(){
+	var div = document.createElement("div");
+
+	div.innerHTML = "<div class='test e'></div><div class='test'></div>";
+
+	// Opera can't find a second classname (in 9.6)
+	// Also, make sure that getElementsByClassName actually exists
+	if ( !div.getElementsByClassName || div.getElementsByClassName("e").length === 0 ) {
+		return;
+	}
+
+	// Safari caches class attributes, doesn't catch changes (in 3.2)
+	div.lastChild.className = "e";
+
+	if ( div.getElementsByClassName("e").length === 1 ) {
+		return;
+	}
+	
+	Expr.order.splice(1, 0, "CLASS");
+	Expr.find.CLASS = function(match, context, isXML) {
+		if ( typeof context.getElementsByClassName !== "undefined" && !isXML ) {
+			return context.getElementsByClassName(match[1]);
+		}
+	};
+
+	div = null; // release memory in IE
+})();
+
+function dirNodeCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) {
+	for ( var i = 0, l = checkSet.length; i < l; i++ ) {
+		var elem = checkSet[i];
+		if ( elem ) {
+			elem = elem[dir];
+			var match = false;
+
+			while ( elem ) {
+				if ( elem.sizcache === doneName ) {
+					match = checkSet[elem.sizset];
+					break;
+				}
+
+				if ( elem.nodeType === 1 && !isXML ){
+					elem.sizcache = doneName;
+					elem.sizset = i;
+				}
+
+				if ( elem.nodeName.toLowerCase() === cur ) {
+					match = elem;
+					break;
+				}
+
+				elem = elem[dir];
+			}
+
+			checkSet[i] = match;
+		}
+	}
+}
+
+function dirCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) {
+	for ( var i = 0, l = checkSet.length; i < l; i++ ) {
+		var elem = checkSet[i];
+		if ( elem ) {
+			elem = elem[dir];
+			var match = false;
+
+			while ( elem ) {
+				if ( elem.sizcache === doneName ) {
+					match = checkSet[elem.sizset];
+					break;
+				}
+
+				if ( elem.nodeType === 1 ) {
+					if ( !isXML ) {
+						elem.sizcache = doneName;
+						elem.sizset = i;
+					}
+					if ( typeof cur !== "string" ) {
+						if ( elem === cur ) {
+							match = true;
+							break;
+						}
+
+					} else if ( Sizzle.filter( cur, [elem] ).length > 0 ) {
+						match = elem;
+						break;
+					}
+				}
+
+				elem = elem[dir];
+			}
+
+			checkSet[i] = match;
+		}
+	}
+}
+
+Sizzle.contains = document.compareDocumentPosition ? function(a, b){
+	return !!(a.compareDocumentPosition(b) & 16);
+} : function(a, b){
+	return a !== b && (a.contains ? a.contains(b) : true);
+};
+
+Sizzle.isXML = function(elem){
+	// documentElement is verified for cases where it doesn't yet exist
+	// (such as loading iframes in IE - #4833) 
+	var documentElement = (elem ? elem.ownerDocument || elem : 0).documentElement;
+	return documentElement ? documentElement.nodeName !== "HTML" : false;
+};
+
+var posProcess = function(selector, context){
+	var tmpSet = [], later = "", match,
+		root = context.nodeType ? [context] : context;
+
+	// 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, "" );
+	}
+
+	selector = Expr.relative[selector] ? selector + "*" : selector;
+
+	for ( var i = 0, l = root.length; i < l; i++ ) {
+		Sizzle( selector, root[i], tmpSet );
+	}
+
+	return Sizzle.filter( later, tmpSet );
+};
+
+// EXPOSE
+
+window.tinymce.dom.Sizzle = Sizzle;
+
+})();
+
+
+(function(tinymce) {
+	// Shorten names
+	var each = tinymce.each, DOM = tinymce.DOM, isIE = tinymce.isIE, isWebKit = tinymce.isWebKit, Event;
+
+	tinymce.create('tinymce.dom.EventUtils', {
+		EventUtils : function() {
+			this.inits = [];
+			this.events = [];
+		},
+
+		add : function(o, n, f, s) {
+			var cb, t = this, el = t.events, r;
+
+			if (n instanceof Array) {
+				r = [];
+
+				each(n, function(n) {
+					r.push(t.add(o, n, f, s));
+				});
+
+				return r;
+			}
+
+			// Handle array
+			if (o && o.hasOwnProperty && o instanceof Array) {
+				r = [];
+
+				each(o, function(o) {
+					o = DOM.get(o);
+					r.push(t.add(o, n, f, s));
+				});
+
+				return r;
+			}
+
+			o = DOM.get(o);
+
+			if (!o)
+				return;
+
+			// Setup event callback
+			cb = function(e) {
+				// Is all events disabled
+				if (t.disabled)
+					return;
+
+				e = e || window.event;
+
+				// Patch in target, preventDefault and stopPropagation in IE it's W3C valid
+				if (e && isIE) {
+					if (!e.target)
+						e.target = e.srcElement;
+
+					// Patch in preventDefault, stopPropagation methods for W3C compatibility
+					tinymce.extend(e, t._stoppers);
+				}
+
+				if (!s)
+					return f(e);
+
+				return f.call(s, e);
+			};
+
+			if (n == 'unload') {
+				tinymce.unloads.unshift({func : cb});
+				return cb;
+			}
+
+			if (n == 'init') {
+				if (t.domLoaded)
+					cb();
+				else
+					t.inits.push(cb);
+
+				return cb;
+			}
+
+			// Store away listener reference
+			el.push({
+				obj : o,
+				name : n,
+				func : f,
+				cfunc : cb,
+				scope : s
+			});
+
+			t._add(o, n, cb);
+
+			return f;
+		},
+
+		remove : function(o, n, f) {
+			var t = this, a = t.events, s = false, r;
+
+			// Handle array
+			if (o && o.hasOwnProperty && o instanceof Array) {
+				r = [];
+
+				each(o, function(o) {
+					o = DOM.get(o);
+					r.push(t.remove(o, n, f));
+				});
+
+				return r;
+			}
+
+			o = DOM.get(o);
+
+			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;
+				}
+			});
+
+			return s;
+		},
+
+		clear : function(o) {
+			var t = this, a = t.events, i, e;
+
+			if (o) {
+				o = DOM.get(o);
+
+				for (i = a.length - 1; i >= 0; i--) {
+					e = a[i];
+
+					if (e.obj === o) {
+						t._remove(e.obj, e.name, e.cfunc);
+						e.obj = e.cfunc = null;
+						a.splice(i, 1);
+					}
+				}
+			}
+		},
+
+		cancel : function(e) {
+			if (!e)
+				return false;
+
+			this.stop(e);
+
+			return this.prevent(e);
+		},
+
+		stop : function(e) {
+			if (e.stopPropagation)
+				e.stopPropagation();
+			else
+				e.cancelBubble = true;
+
+			return false;
+		},
+
+		prevent : function(e) {
+			if (e.preventDefault)
+				e.preventDefault();
+			else
+				e.returnValue = false;
+
+			return false;
+		},
+
+		destroy : function() {
+			var t = this;
+
+			each(t.events, function(e, i) {
+				t._remove(e.obj, e.name, e.cfunc);
+				e.obj = e.cfunc = null;
+			});
+
+			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;
+		},
+
+		_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;
+
+			// Keep it from running more than once
+			if (t.domLoaded)
+				return;
+
+			t.domLoaded = true;
+
+			each(t.inits, function(c) {
+				c();
+			});
+
+			t.inits = [];
+		},
+
+		_wait : function(win) {
+			var t = this, doc = win.document;
+
+			// No need since the document is already loaded
+			if (win.tinyMCE_GZ && tinyMCE_GZ.loaded) {
+				t.domLoaded = 1;
+				return;
+			}
+
+			// Use IE method
+			if (doc.attachEvent) {
+				doc.attachEvent("onreadystatechange", function() {
+					if (doc.readyState === "complete") {
+						doc.detachEvent("onreadystatechange", arguments.callee);
+						t._pageInit(win);
+					}
+				});
+
+				if (doc.documentElement.doScroll && win == win.top) {
+					(function() {
+						if (t.domLoaded)
+							return;
+
+						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;
+						}
+
+						t._pageInit(win);
+					})();
+				}
+			} else if (doc.addEventListener) {
+				t._add(win, 'DOMContentLoaded', function() {
+					t._pageInit(win);
+				});
+			}
+
+			t._add(win, 'load', function() {
+				t._pageInit(win);
+			});
+		},
+
+		_stoppers : {
+			preventDefault : function() {
+				this.returnValue = false;
+			},
+
+			stopPropagation : function() {
+				this.cancelBubble = true;
+			}
+		}
+	});
+
+	Event = tinymce.dom.Event = new tinymce.dom.EventUtils();
+
+	// Dispatch DOM content loaded event for IE and Safari
+	Event._wait(window);
+
+	tinymce.addUnload(function() {
+		Event.destroy();
+	});
+})(tinymce);
+
+(function(tinymce) {
+	tinymce.dom.Element = function(id, settings) {
+		var t = this, dom, el;
+
+		t.settings = settings = settings || {};
+		t.id = id;
+		t.dom = dom = settings.dom || tinymce.DOM;
+
+		// Only IE leaks DOM references, this is a lot faster
+		if (!tinymce.isIE)
+			el = dom.get(t.id);
+
+		tinymce.each(
+				('getPos,getRect,getParent,add,setStyle,getStyle,setStyles,' + 
+				'setAttrib,setAttribs,getAttrib,addClass,removeClass,' + 
+				'hasClass,getOuterHTML,setOuterHTML,remove,show,hide,' + 
+				'isHidden,setHTML,get').split(/,/)
+			, function(k) {
+				t[k] = function() {
+					var a = [id], i;
+
+					for (i = 0; i < arguments.length; i++)
+						a.push(arguments[i]);
+
+					a = dom[k].apply(dom, a);
+					t.update(k);
+
+					return a;
+				};
+		});
+
+		tinymce.extend(t, {
+			on : function(n, f, s) {
+				return tinymce.dom.Event.add(t.id, n, f, s);
+			},
+
+			getXY : function() {
+				return {
+					x : parseInt(t.getStyle('left')),
+					y : parseInt(t.getStyle('top'))
+				};
+			},
+
+			getSize : function() {
+				var n = dom.get(t.id);
+
+				return {
+					w : parseInt(t.getStyle('width') || n.clientWidth),
+					h : parseInt(t.getStyle('height') || n.clientHeight)
+				};
+			},
+
+			moveTo : function(x, y) {
+				t.setStyles({left : x, top : y});
+			},
+
+			moveBy : function(x, y) {
+				var p = t.getXY();
+
+				t.moveTo(p.x + x, p.y + y);
+			},
+
+			resizeTo : function(w, h) {
+				t.setStyles({width : w, height : h});
+			},
+
+			resizeBy : function(w, h) {
+				var s = t.getSize();
+
+				t.resizeTo(s.w + w, s.h + h);
+			},
+
+			update : function(k) {
+				var b;
+
+				if (tinymce.isIE6 && settings.blocker) {
+					k = k || '';
+
+					// Ignore getters
+					if (k.indexOf('get') === 0 || k.indexOf('has') === 0 || k.indexOf('is') === 0)
+						return;
+
+					// Remove blocker on remove
+					if (k == 'remove') {
+						dom.remove(t.blocker);
+						return;
+					}
+
+					if (!t.blocker) {
+						t.blocker = dom.uniqueId();
+						b = dom.add(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);
+
+					dom.setStyles(b, {
+						left : t.getStyle('left', 1),
+						top : t.getStyle('top', 1),
+						width : t.getStyle('width', 1),
+						height : t.getStyle('height', 1),
+						display : t.getStyle('display', 1),
+						zIndex : parseInt(t.getStyle('zIndex', 1) || 0) - 1
+					});
+				}
+			}
+		});
+	};
+})(tinymce);
+
+(function(tinymce) {
+	function trimNl(s) {
+		return s.replace(/[\n\r]+/g, '');
+	};
+
+	// Shorten names
+	var is = tinymce.is, isIE = tinymce.isIE, each = tinymce.each;
+
+	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);
+			});
+
+			// No W3C Range support
+			if (!t.win.getSelection)
+				t.tridentSel = new tinymce.dom.TridentSelection(t);
+
+			if (tinymce.isIE && dom.boxModel)
+				this._fixIESelection();
+
+			// 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();
+
+			// Keep whitespace before and after
+			if (/^\s/.test(e.innerHTML))
+				wb = ' ';
+
+			if (/\s+$/.test(e.innerHTML))
+				wa = ' ';
+
+			s.getInner = true;
+
+			s.content = t.isCollapsed() ? '' : wb + t.serializer.serialize(e, s) + wa;
+			t.onGetContent.dispatch(t, s);
+
+			return s.content;
+		},
+
+		setContent : function(content, args) {
+			var self = this, rng = self.getRng(), caretNode, doc = self.win.document, frag, temp;
+
+			args = args || {format : 'html'};
+			args.set = true;
+			content = args.content = content;
+
+			// Dispatch before set content event
+			if (!args.no_events)
+				self.onBeforeSetContent.dispatch(self, args);
+
+			content = args.content;
+
+			if (rng.insertNode) {
+				// Make caret marker since insertNode places the caret in the beginning of text after insert
+				content += '<span id="__caret">_</span>';
+
+				// Delete and insert new node
+				if (rng.startContainer == doc && rng.endContainer == doc) {
+					// WebKit will fail if the body is empty since the range is then invalid and it can't insert contents
+					doc.body.innerHTML = content;
+				} else {
+					rng.deleteContents();
+
+					if (doc.body.childNodes.length == 0) {
+						doc.body.innerHTML = content;
+					} else {
+						// createContextualFragment doesn't exists in IE 9 DOMRanges
+						if (rng.createContextualFragment) {
+							rng.insertNode(rng.createContextualFragment(content));
+						} else {
+							// Fake createContextualFragment call in IE 9
+							frag = doc.createDocumentFragment();
+							temp = doc.createElement('div');
+
+							frag.appendChild(temp);
+							temp.outerHTML = content;
+
+							rng.insertNode(frag);
+						}
+					}
+				}
+
+				// Move to caret marker
+				caretNode = self.dom.get('__caret');
+
+				// Make sure we wrap it compleatly, Opera fails with a simple select call
+				rng = doc.createRange();
+				rng.setStartBefore(caretNode);
+				rng.setEndBefore(caretNode);
+				self.setRng(rng);
+
+				// Remove the caret position
+				self.dom.remove('__caret');
+				self.setRng(rng);
+			} else {
+				if (rng.item) {
+					// Delete content and get caret text selection
+					doc.execCommand('Delete', false, null);
+					rng = self.getRng();
+				}
+
+				rng.pasteHTML(content);
+			}
+
+			// Dispatch set content event
+			if (!args.no_events)
+				self.onSetContent.dispatch(self, args);
+		},
+
+		getStart : function() {
+			var rng = this.getRng(), startElement, parentElement, checkRng, node;
+
+			if (rng.duplicate || rng.item) {
+				// Control selection, return first item
+				if (rng.item)
+					return rng.item(0);
+
+				// Get start element
+				checkRng = rng.duplicate();
+				checkRng.collapse(1);
+				startElement = checkRng.parentElement();
+
+				// Check if range parent is inside the start element, then return the inner parent element
+				// This will fix issues when a single element is selected, IE would otherwise return the wrong start element
+				parentElement = node = rng.parentElement();
+				while (node = node.parentNode) {
+					if (node == startElement) {
+						startElement = parentElement;
+						break;
+					}
+				}
+
+				return startElement;
+			} else {
+				startElement = rng.startContainer;
+
+				if (startElement.nodeType == 1 && startElement.hasChildNodes())
+					startElement = startElement.childNodes[Math.min(startElement.childNodes.length - 1, rng.startOffset)];
+
+				if (startElement && startElement.nodeType == 3)
+					return startElement.parentNode;
+
+				return startElement;
+			}
+		},
+
+		getEnd : function() {
+			var t = this, r = t.getRng(), e, eo;
+
+			if (r.duplicate || r.item) {
+				if (r.item)
+					return r.item(0);
+
+				r = r.duplicate();
+				r.collapse(0);
+				e = r.parentElement();
+
+				if (e && e.nodeName == 'BODY')
+					return e.lastChild || e;
+
+				return e;
+			} else {
+				e = r.endContainer;
+				eo = r.endOffset;
+
+				if (e.nodeType == 1 && e.hasChildNodes())
+					e = e.childNodes[eo > 0 ? eo - 1 : eo];
+
+				if (e && e.nodeType == 3)
+					return e.parentNode;
+
+				return e;
+			}
+		},
+
+		getBookmark : function(type, normalized) {
+			var t = this, dom = t.dom, rng, rng2, id, collapsed, name, element, index, chr = '\uFEFF', styles;
+
+			function findIndex(name, element) {
+				var index = 0;
+
+				each(dom.select(name), function(node, i) {
+					if (node == element)
+						index = i;
+				});
+
+				return index;
+			};
+
+			if (type == 2) {
+				function getLocation() {
+					var rng = t.getRng(true), root = dom.getRoot(), bookmark = {};
+
+					function getPoint(rng, start) {
+						var container = rng[start ? 'startContainer' : 'endContainer'],
+							offset = rng[start ? 'startOffset' : 'endOffset'], point = [], node, childNodes, after = 0;
+
+						if (container.nodeType == 3) {
+							if (normalized) {
+								for (node = container.previousSibling; node && node.nodeType == 3; node = node.previousSibling)
+									offset += node.nodeValue.length;
+							}
+
+							point.push(offset);
+						} else {
+							childNodes = container.childNodes;
+
+							if (offset >= childNodes.length && childNodes.length) {
+								after = 1;
+								offset = Math.max(0, childNodes.length - 1);
+							}
+
+							point.push(t.dom.nodeIndex(childNodes[offset], normalized) + after);
+						}
+
+						for (; container && container != root; container = container.parentNode)
+							point.push(t.dom.nodeIndex(container, normalized));
+
+						return point;
+					};
+
+					bookmark.start = getPoint(rng, true);
+
+					if (!t.isCollapsed())
+						bookmark.end = getPoint(rng);
+
+					return bookmark;
+				};
+
+				return getLocation();
+			}
+
+			// Handle simple range
+			if (type)
+				return {rng : t.getRng()};
+
+			rng = t.getRng();
+			id = dom.uniqueId();
+			collapsed = tinyMCE.activeEditor.selection.isCollapsed();
+			styles = 'overflow:hidden;line-height:0px';
+
+			// Explorer method
+			if (rng.duplicate || rng.item) {
+				// Text selection
+				if (!rng.item) {
+					rng2 = rng.duplicate();
+
+					try {
+						// Insert start marker
+						rng.collapse();
+						rng.pasteHTML('<span data-mce-type="bookmark" id="' + id + '_start" style="' + styles + '">' + chr + '</span>');
+
+						// Insert end marker
+						if (!collapsed) {
+							rng2.collapse(false);
+
+							// Detect the empty space after block elements in IE and move the end back one character <p></p>] becomes <p>]</p>
+							rng.moveToElementText(rng2.parentElement());
+							if (rng.compareEndPoints('StartToEnd', rng2) == 0)
+								rng2.move('character', -1);
+
+							rng2.pasteHTML('<span data-mce-type="bookmark" id="' + id + '_end" style="' + styles + '">' + chr + '</span>');
+						}
+					} catch (ex) {
+						// IE might throw unspecified error so lets ignore it
+						return null;
+					}
+				} else {
+					// Control selection
+					element = rng.item(0);
+					name = element.nodeName;
+
+					return {name : name, index : findIndex(name, element)};
+				}
+			} else {
+				element = t.getNode();
+				name = element.nodeName;
+				if (name == 'IMG')
+					return {name : name, index : findIndex(name, element)};
+
+				// W3C method
+				rng2 = rng.cloneRange();
+
+				// Insert end marker
+				if (!collapsed) {
+					rng2.collapse(false);
+					rng2.insertNode(dom.create('span', {'data-mce-type' : "bookmark", id : id + '_end', style : styles}, chr));
+				}
+
+				rng.collapse(true);
+				rng.insertNode(dom.create('span', {'data-mce-type' : "bookmark", id : id + '_start', style : styles}, chr));
+			}
+
+			t.moveToBookmark({id : id, keep : 1});
+
+			return {id : id};
+		},
+
+		moveToBookmark : function(bookmark) {
+			var t = this, dom = t.dom, marker1, marker2, rng, root, startContainer, endContainer, startOffset, endOffset;
+
+			// Clear selection cache
+			if (t.tridentSel)
+				t.tridentSel.destroy();
+
+			if (bookmark) {
+				if (bookmark.start) {
+					rng = dom.createRng();
+					root = dom.getRoot();
+
+					function setEndPoint(start) {
+						var point = bookmark[start ? 'start' : 'end'], i, node, offset, children;
+
+						if (point) {
+							offset = point[0];
+
+							// Find container node
+							for (node = root, i = point.length - 1; i >= 1; i--) {
+								children = node.childNodes;
+
+								if (point[i] > children.length - 1)
+									return;
+
+								node = children[point[i]];
+							}
+
+							// Move text offset to best suitable location
+							if (node.nodeType === 3)
+								offset = Math.min(point[0], node.nodeValue.length);
+
+							// Move element offset to best suitable location
+							if (node.nodeType === 1)
+								offset = Math.min(point[0], node.childNodes.length);
+
+							// Set offset within container node
+							if (start)
+								rng.setStart(node, offset);
+							else
+								rng.setEnd(node, offset);
+						}
+
+						return true;
+					};
+
+					if (setEndPoint(true) && setEndPoint()) {
+						t.setRng(rng);
+					}
+				} else if (bookmark.id) {
+					function restoreEndPoint(suffix) {
+						var marker = dom.get(bookmark.id + '_' + suffix), node, idx, next, prev, keep = bookmark.keep;
+
+						if (marker) {
+							node = marker.parentNode;
+
+							if (suffix == 'start') {
+								if (!keep) {
+									idx = dom.nodeIndex(marker);
+								} else {
+									node = marker.firstChild;
+									idx = 1;
+								}
+
+								startContainer = endContainer = node;
+								startOffset = endOffset = idx;
+							} else {
+								if (!keep) {
+									idx = dom.nodeIndex(marker);
+								} else {
+									node = marker.firstChild;
+									idx = 1;
+								}
+
+								endContainer = node;
+								endOffset = idx;
+							}
+
+							if (!keep) {
+								prev = marker.previousSibling;
+								next = marker.nextSibling;
+
+								// Remove all marker text nodes
+								each(tinymce.grep(marker.childNodes), function(node) {
+									if (node.nodeType == 3)
+										node.nodeValue = node.nodeValue.replace(/\uFEFF/g, '');
+								});
+
+								// Remove marker but keep children if for example contents where inserted into the marker
+								// Also remove duplicated instances of the marker for example by a split operation or by WebKit auto split on paste feature
+								while (marker = dom.get(bookmark.id + '_' + suffix))
+									dom.remove(marker, 1);
+
+								// If siblings are text nodes then merge them unless it's Opera since it some how removes the node
+								// and we are sniffing since adding a lot of detection code for a browser with 3% of the market isn't worth the effort. Sorry, Opera but it's just a fact
+								if (prev && next && prev.nodeType == next.nodeType && prev.nodeType == 3 && !tinymce.isOpera) {
+									idx = prev.nodeValue.length;
+									prev.appendData(next.nodeValue);
+									dom.remove(next);
+
+									if (suffix == 'start') {
+										startContainer = endContainer = prev;
+										startOffset = endOffset = idx;
+									} else {
+										endContainer = prev;
+										endOffset = idx;
+									}
+								}
+							}
+						}
+					};
+
+					function addBogus(node) {
+						// Adds a bogus BR element for empty block elements or just a space on IE since it renders BR elements incorrectly
+						if (dom.isBlock(node) && !node.innerHTML)
+							node.innerHTML = !isIE ? '<br data-mce-bogus="1" />' : ' ';
+
+						return node;
+					};
+
+					// Restore start/end points
+					restoreEndPoint('start');
+					restoreEndPoint('end');
+
+					if (startContainer) {
+						rng = dom.createRng();
+						rng.setStart(addBogus(startContainer), startOffset);
+						rng.setEnd(addBogus(endContainer), endOffset);
+						t.setRng(rng);
+					}
+				} else if (bookmark.name) {
+					t.select(dom.select(bookmark.name)[bookmark.index]);
+				} else if (bookmark.rng)
+					t.setRng(bookmark.rng);
+			}
+		},
+
+		select : function(node, content) {
+			var t = this, dom = t.dom, rng = dom.createRng(), idx;
+
+			if (node) {
+				idx = dom.nodeIndex(node);
+				rng.setStart(node.parentNode, idx);
+				rng.setEnd(node.parentNode, idx + 1);
+
+				// Find first/last text node or BR element
+				if (content) {
+					function setPoint(node, start) {
+						var walker = new tinymce.dom.TreeWalker(node, node);
+
+						do {
+							// Text node
+							if (node.nodeType == 3 && tinymce.trim(node.nodeValue).length != 0) {
+								if (start)
+									rng.setStart(node, 0);
+								else
+									rng.setEnd(node, node.nodeValue.length);
+
+								return;
+							}
+
+							// BR element
+							if (node.nodeName == 'BR') {
+								if (start)
+									rng.setStartBefore(node);
+								else
+									rng.setEndBefore(node);
+
+								return;
+							}
+						} while (node = (start ? walker.next() : walker.prev()));
+					};
+
+					setPoint(node, 1);
+					setPoint(node);
+				}
+
+				t.setRng(rng);
+			}
+
+			return node;
+		},
+
+		isCollapsed : function() {
+			var t = this, r = t.getRng(), s = t.getSel();
+
+			if (!r || r.item)
+				return false;
+
+			if (r.compareEndPoints)
+				return r.compareEndPoints('StartToEnd', r) === 0;
+
+			return !s || r.collapsed;
+		},
+
+		collapse : function(to_start) {
+			var self = this, rng = self.getRng(), node;
+
+			// Control range on IE
+			if (rng.item) {
+				node = rng.item(0);
+				rng = self.win.document.body.createTextRange();
+				rng.moveToElementText(node);
+			}
+
+			rng.collapse(!!to_start);
+			self.setRng(rng);
+		},
+
+		getSel : function() {
+			var t = this, w = this.win;
+
+			return w.getSelection ? w.getSelection() : w.document.selection;
+		},
+
+		getRng : function(w3c) {
+			var t = this, s, r, elm, doc = t.win.document;
+
+			// Found tridentSel object then we need to use that one
+			if (w3c && t.tridentSel)
+				return t.tridentSel.getRangeAt(0);
+
+			try {
+				if (s = t.getSel())
+					r = s.rangeCount > 0 ? s.getRangeAt(0) : (s.createRange ? s.createRange() : doc.createRange());
+			} catch (ex) {
+				// IE throws unspecified error here if TinyMCE is placed in a frame/iframe
+			}
+
+			// We have W3C ranges and it's IE then fake control selection since IE9 doesn't handle that correctly yet
+			if (tinymce.isIE && r && r.setStart && doc.selection.createRange().item) {
+				elm = doc.selection.createRange().item(0);
+				r = doc.createRange();
+				r.setStartBefore(elm);
+				r.setEndAfter(elm);
+			}
+
+			// 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 = doc.createRange ? doc.createRange() : doc.body.createTextRange();
+
+			if (t.selectedRange && t.explicitRange) {
+				if (r.compareBoundaryPoints(r.START_TO_START, t.selectedRange) === 0 && r.compareBoundaryPoints(r.END_TO_END, t.selectedRange) === 0) {
+					// Safari, Opera and Chrome only ever select text which causes the range to change.
+					// This lets us use the originally set range if the selection hasn't been changed by the user.
+					r = t.explicitRange;
+				} else {
+					t.selectedRange = null;
+					t.explicitRange = null;
+				}
+			}
+
+			return r;
+		},
+
+		setRng : function(r) {
+			var s, t = this;
+			
+			if (!t.tridentSel) {
+				s = t.getSel();
+
+				if (s) {
+					t.explicitRange = r;
+					s.removeAllRanges();
+					s.addRange(r);
+					t.selectedRange = s.getRangeAt(0);
+				}
+			} else {
+				// Is W3C Range
+				if (r.cloneRange) {
+					t.tridentSel.addRange(r);
+					return;
+				}
+
+				// Is IE specific range
+				try {
+					r.select();
+				} catch (ex) {
+					// Needed for some odd IE bug #1843306
+				}
+			}
+		},
+
+		setNode : function(n) {
+			var t = this;
+
+			t.setContent(t.dom.getOuterHTML(n));
+
+			return n;
+		},
+
+		getNode : function() {
+			var t = this, rng = t.getRng(), sel = t.getSel(), elm, start = rng.startContainer, end = rng.endContainer;
+
+			// Range maybe lost after the editor is made visible again
+			if (!rng)
+				return t.dom.getRoot();
+
+			if (rng.setStart) {
+				elm = rng.commonAncestorContainer;
+
+				// Handle selection a image or other control like element such as anchors
+				if (!rng.collapsed) {
+					if (rng.startContainer == rng.endContainer) {
+						if (rng.endOffset - rng.startOffset < 2) {
+							if (rng.startContainer.hasChildNodes())
+								elm = rng.startContainer.childNodes[rng.startOffset];
+						}
+					}
+
+					// If the anchor node is a element instead of a text node then return this element
+					//if (tinymce.isWebKit && sel.anchorNode && sel.anchorNode.nodeType == 1) 
+					//	return sel.anchorNode.childNodes[sel.anchorOffset];
+
+					// Handle cases where the selection is immediately wrapped around a node and return that node instead of it's parent.
+					// This happens when you double click an underlined word in FireFox.
+					if (start.nodeType === 3 && end.nodeType === 3) {
+						function skipEmptyTextNodes(n, forwards) {
+							var orig = n;
+							while (n && n.nodeType === 3 && n.length === 0) {
+								n = forwards ? n.nextSibling : n.previousSibling;
+							}
+							return n || orig;
+						}
+						if (start.length === rng.startOffset) {
+							start = skipEmptyTextNodes(start.nextSibling, true);
+						} else {
+							start = start.parentNode;
+						}
+						if (rng.endOffset === 0) {
+							end = skipEmptyTextNodes(end.previousSibling, false);
+						} else {
+							end = end.parentNode;
+						}
+
+						if (start && start === end)
+							return start;
+					}
+				}
+
+				if (elm && elm.nodeType == 3)
+					return elm.parentNode;
+
+				return elm;
+			}
+
+			return rng.item ? rng.item(0) : rng.parentElement();
+		},
+
+		getSelectedBlocks : function(st, en) {
+			var t = this, dom = t.dom, sb, eb, n, bl = [];
+
+			sb = dom.getParent(st || t.getStart(), dom.isBlock);
+			eb = dom.getParent(en || t.getEnd(), dom.isBlock);
+
+			if (sb)
+				bl.push(sb);
+
+			if (sb && eb && sb != eb) {
+				n = sb;
+
+				while ((n = n.nextSibling) && n != eb) {
+					if (dom.isBlock(n))
+						bl.push(n);
+				}
+			}
+
+			if (eb && sb != eb)
+				bl.push(eb);
+
+			return bl;
+		},
+
+		destroy : function(s) {
+			var t = this;
+
+			t.win = null;
+
+			if (t.tridentSel)
+				t.tridentSel.destroy();
+
+			// Manual destroy then remove unload handler
+			if (!s)
+				tinymce.removeUnload(t.destroy);
+		},
+
+		// IE has an issue where you can't select/move the caret by clicking outside the body if the document is in standards mode
+		_fixIESelection : function() {
+			var dom = this.dom, doc = dom.doc, body = doc.body, started, startRng, htmlElm;
+
+			// Make HTML element unselectable since we are going to handle selection by hand
+			doc.documentElement.unselectable = true;
+
+			// Return range from point or null if it failed
+			function rngFromPoint(x, y) {
+				var rng = body.createTextRange();
+
+				try {
+					rng.moveToPoint(x, y);
+				} catch (ex) {
+					// IE sometimes throws and exception, so lets just ignore it
+					rng = null;
+				}
+
+				return rng;
+			};
+
+			// Fires while the selection is changing
+			function selectionChange(e) {
+				var pointRng;
+
+				// Check if the button is down or not
+				if (e.button) {
+					// Create range from mouse position
+					pointRng = rngFromPoint(e.x, e.y);
+
+					if (pointRng) {
+						// Check if pointRange is before/after selection then change the endPoint
+						if (pointRng.compareEndPoints('StartToStart', startRng) > 0)
+							pointRng.setEndPoint('StartToStart', startRng);
+						else
+							pointRng.setEndPoint('EndToEnd', startRng);
+
+						pointRng.select();
+					}
+				} else
+					endSelection();
+			}
+
+			// Removes listeners
+			function endSelection() {
+				var rng = doc.selection.createRange();
+
+				// If the range is collapsed then use the last start range
+				if (startRng && !rng.item && rng.compareEndPoints('StartToEnd', rng) === 0)
+					startRng.select();
+
+				dom.unbind(doc, 'mouseup', endSelection);
+				dom.unbind(doc, 'mousemove', selectionChange);
+				startRng = started = 0;
+			};
+
+			// Detect when user selects outside BODY
+			dom.bind(doc, ['mousedown', 'contextmenu'], function(e) {
+				if (e.target.nodeName === 'HTML') {
+					if (started)
+						endSelection();
+
+					// Detect vertical scrollbar, since IE will fire a mousedown on the scrollbar and have target set as HTML
+					htmlElm = doc.documentElement;
+					if (htmlElm.scrollHeight > htmlElm.clientHeight)
+						return;
+
+					started = 1;
+					// Setup start position
+					startRng = rngFromPoint(e.x, e.y);
+					if (startRng) {
+						// Listen for selection change events
+						dom.bind(doc, 'mouseup', endSelection);
+						dom.bind(doc, 'mousemove', selectionChange);
+
+						dom.win.focus();
+						startRng.select();
+					}
+				}
+			});
+		}
+	});
+})(tinymce);
+
+(function(tinymce) {
+	tinymce.dom.Serializer = function(settings, dom, schema) {
+		var onPreProcess, onPostProcess, isIE = tinymce.isIE, each = tinymce.each, htmlParser;
+
+		// Support the old apply_source_formatting option
+		if (!settings.apply_source_formatting)
+			settings.indent = false;
+
+		settings.remove_trailing_brs = true;
+
+		// Default DOM and Schema if they are undefined
+		dom = dom || tinymce.DOM;
+		schema = schema || new tinymce.html.Schema(settings);
+		settings.entity_encoding = settings.entity_encoding || 'named';
+
+		onPreProcess = new tinymce.util.Dispatcher(self);
+
+		onPostProcess = new tinymce.util.Dispatcher(self);
+
+		htmlParser = new tinymce.html.DomParser(settings, schema);
+
+		// Convert move data-mce-src, data-mce-href and data-mce-style into nodes or process them if needed
+		htmlParser.addAttributeFilter('src,href,style', function(nodes, name) {
+			var i = nodes.length, node, value, internalName = 'data-mce-' + name, urlConverter = settings.url_converter, urlConverterScope = settings.url_converter_scope, undef;
+
+			while (i--) {
+				node = nodes[i];
+
+				value = node.attributes.map[internalName];
+				if (value !== undef) {
+					// Set external name to internal value and remove internal
+					node.attr(name, value.length > 0 ? value : null);
+					node.attr(internalName, null);
+				} else {
+					// No internal attribute found then convert the value we have in the DOM
+					value = node.attributes.map[name];
+
+					if (name === "style")
+						value = dom.serializeStyle(dom.parseStyle(value), node.name);
+					else if (urlConverter)
+						value = urlConverter.call(urlConverterScope, value, name, node.name);
+
+					node.attr(name, value.length > 0 ? value : null);
+				}
+			}
+		});
+
+		// Remove internal classes mceItem<..>
+		htmlParser.addAttributeFilter('class', function(nodes, name) {
+			var i = nodes.length, node, value;
+
+			while (i--) {
+				node = nodes[i];
+				value = node.attr('class').replace(/\s*mce(Item\w+|Selected)\s*/g, '');
+				node.attr('class', value.length > 0 ? value : null);
+			}
+		});
+
+		// Remove bookmark elements
+		htmlParser.addAttributeFilter('data-mce-type', function(nodes, name, args) {
+			var i = nodes.length, node;
+
+			while (i--) {
+				node = nodes[i];
+
+				if (node.attributes.map['data-mce-type'] === 'bookmark' && !args.cleanup)
+					node.remove();
+			}
+		});
+
+		// Force script into CDATA sections and remove the mce- prefix also add comments around styles
+		htmlParser.addNodeFilter('script,style', function(nodes, name) {
+			var i = nodes.length, node, value;
+
+			function trim(value) {
+				return value.replace(/(<!--\[CDATA\[|\]\]-->)/g, '\n')
+						.replace(/^[\r\n]*|[\r\n]*$/g, '')
+						.replace(/^\s*(\/\/\s*<!--|\/\/\s*<!\[CDATA\[|<!--|<!\[CDATA\[)[\r\n]*/g, '')
+						.replace(/\s*(\/\/\s*\]\]>|\/\/\s*-->|\]\]>|-->|\]\]-->)\s*$/g, '');
+			};
+
+			while (i--) {
+				node = nodes[i];
+				value = node.firstChild ? node.firstChild.value : '';
+
+				if (name === "script") {
+					// Remove mce- prefix from script elements
+					node.attr('type', (node.attr('type') || 'text/javascript').replace(/^mce\-/, ''));
+
+					if (value.length > 0)
+						node.firstChild.value = '// <![CDATA[\n' + trim(value) + '\n// ]]>';
+				} else {
+					if (value.length > 0)
+						node.firstChild.value = '<!--\n' + trim(value) + '\n-->';
+				}
+			}
+		});
+
+		// Convert comments to cdata and handle protected comments
+		htmlParser.addNodeFilter('#comment', function(nodes, name) {
+			var i = nodes.length, node;
+
+			while (i--) {
+				node = nodes[i];
+
+				if (node.value.indexOf('[CDATA[') === 0) {
+					node.name = '#cdata';
+					node.type = 4;
+					node.value = node.value.replace(/^\[CDATA\[|\]\]$/g, '');
+				} else if (node.value.indexOf('mce:protected ') === 0) {
+					node.name = "#text";
+					node.type = 3;
+					node.raw = true;
+					node.value = unescape(node.value).substr(14);
+				}
+			}
+		});
+
+		htmlParser.addNodeFilter('xml:namespace,input', function(nodes, name) {
+			var i = nodes.length, node;
+
+			while (i--) {
+				node = nodes[i];
+				if (node.type === 7)
+					node.remove();
+				else if (node.type === 1) {
+					if (name === "input" && !("type" in node.attributes.map))
+						node.attr('type', 'text');
+				}
+			}
+		});
+
+		// Fix list elements, TODO: Replace this later
+		if (settings.fix_list_elements) {
+			htmlParser.addNodeFilter('ul,ol', function(nodes, name) {
+				var i = nodes.length, node, parentNode;
+
+				while (i--) {
+					node = nodes[i];
+					parentNode = node.parent;
+
+					if (parentNode.name === 'ul' || parentNode.name === 'ol') {
+						if (node.prev && node.prev.name === 'li') {
+							node.prev.append(node);
+						}
+					}
+				}
+			});
+		}
+
+		// Remove internal data attributes
+		htmlParser.addAttributeFilter('data-mce-src,data-mce-href,data-mce-style', function(nodes, name) {
+			var i = nodes.length;
+
+			while (i--) {
+				nodes[i].attr(name, null);
+			}
+		});
+
+		// Return public methods
+		return {
+			schema : schema,
+
+			addNodeFilter : htmlParser.addNodeFilter,
+
+			addAttributeFilter : htmlParser.addAttributeFilter,
+
+			onPreProcess : onPreProcess,
+
+			onPostProcess : onPostProcess,
+
+			serialize : function(node, args) {
+				var impl, doc, oldDoc, htmlSerializer, content;
+
+				// Explorer won't clone contents of script and style and the
+				// selected index of select elements are cleared on a clone operation.
+				if (isIE && dom.select('script,style,select').length > 0) {
+					content = node.innerHTML;
+					node = node.cloneNode(false);
+					dom.setHTML(node, content);
+				} else
+					node = node.cloneNode(true);
+
+				// Nodes needs to be attached to something in WebKit/Opera
+				// Older builds of Opera crashes if you attach the node to an document created dynamically
+				// and since we can't feature detect a crash we need to sniff the acutal build number
+				// This fix will make DOM ranges and make Sizzle happy!
+				impl = node.ownerDocument.implementation;
+				if (impl.createHTMLDocument) {
+					// Create an empty HTML document
+					doc = impl.createHTMLDocument("");
+
+					// Add the element or it's children if it's a body element to the new document
+					each(node.nodeName == 'BODY' ? node.childNodes : [node], function(node) {
+						doc.body.appendChild(doc.importNode(node, true));
+					});
+
+					// Grab first child or body element for serialization
+					if (node.nodeName != 'BODY')
+						node = doc.body.firstChild;
+					else
+						node = doc.body;
+
+					// set the new document in DOMUtils so createElement etc works
+					oldDoc = dom.doc;
+					dom.doc = doc;
+				}
+
+				args = args || {};
+				args.format = args.format || 'html';
+
+				// Pre process
+				if (!args.no_events) {
+					args.node = node;
+					onPreProcess.dispatch(self, args);
+				}
+
+				// Setup serializer
+				htmlSerializer = new tinymce.html.Serializer(settings, schema);
+
+				// Parse and serialize HTML
+				args.content = htmlSerializer.serialize(
+					htmlParser.parse(args.getInner ? node.innerHTML : tinymce.trim(dom.getOuterHTML(node), args), args)
+				);
+
+				// Post process
+				if (!args.no_events)
+					onPostProcess.dispatch(self, args);
+
+				// Restore the old document if it was changed
+				if (oldDoc)
+					dom.doc = oldDoc;
+
+				args.node = null;
+
+				return args.content;
+			},
+
+			addRules : function(rules) {
+				schema.addValidElements(rules);
+			},
+
+			setRules : function(rules) {
+				schema.setValidElements(rules);
+			}
+		};
+	};
+})(tinymce);
+(function(tinymce) {
+	tinymce.dom.ScriptLoader = function(settings) {
+		var QUEUED = 0,
+			LOADING = 1,
+			LOADED = 2,
+			states = {},
+			queue = [],
+			scriptLoadedCallbacks = {},
+			queueLoadedCallbacks = [],
+			loading = 0,
+			undefined;
+
+		function loadScript(url, callback) {
+			var t = this, dom = tinymce.DOM, elm, uri, loc, id;
+
+			// Execute callback when script is loaded
+			function done() {
+				dom.remove(id);
+
+				if (elm)
+					elm.onreadystatechange = elm.onload = elm = null;
+
+				callback();
+			};
+			
+			function error() {
+				// Report the error so it's easier for people to spot loading errors
+				if (typeof(console) !== "undefined" && console.log)
+					console.log("Failed to load: " + url);
+
+				// We can't mark it as done if there is a load error since
+				// A) We don't want to produce 404 errors on the server and
+				// B) the onerror event won't fire on all browsers.
+				// done();
+			};
+
+			id = dom.uniqueId();
+
+			if (tinymce.isIE6) {
+				uri = new tinymce.util.URI(url);
+				loc = location;
+
+				// If script is from same domain and we
+				// use IE 6 then use XHR since it's more reliable
+				if (uri.host == loc.hostname && uri.port == loc.port && (uri.protocol + ':') == loc.protocol && uri.protocol.toLowerCase() != 'file') {
+					tinymce.util.XHR.send({
+						url : tinymce._addVer(uri.getURI()),
+						success : function(content) {
+							// Create new temp script element
+							var script = dom.create('script', {
+								type : 'text/javascript'
+							});
+
+							// Evaluate script in global scope
+							script.text = content;
+							document.getElementsByTagName('head')[0].appendChild(script);
+							dom.remove(script);
+
+							done();
+						},
+						
+						error : error
+					});
+
+					return;
+				}
+			}
+
+			// Create new script element
+			elm = dom.create('script', {
+				id : id,
+				type : 'text/javascript',
+				src : tinymce._addVer(url)
+			});
+
+			// Add onload listener for non IE browsers since IE9
+			// fires onload event before the script is parsed and executed
+			if (!tinymce.isIE)
+				elm.onload = done;
+
+			// Add onerror event will get fired on some browsers but not all of them
+			elm.onerror = error;
+
+			// Opera 9.60 doesn't seem to fire the onreadystate event at correctly
+			if (!tinymce.isOpera) {
+				elm.onreadystatechange = function() {
+					var state = elm.readyState;
+
+					// Loaded state is passed on IE 6 however there
+					// are known issues with this method but we can't use
+					// XHR in a cross domain loading
+					if (state == 'complete' || state == 'loaded')
+						done();
+				};
+			}
+
+			// Most browsers support this feature so we report errors
+			// for those at least to help users track their missing plugins etc
+			// todo: Removed since it produced error if the document is unloaded by navigating away, re-add it as an option
+			/*elm.onerror = function() {
+				alert('Failed to load: ' + url);
+			};*/
+
+			// Add script to document
+			(document.getElementsByTagName('head')[0] || document.body).appendChild(elm);
+		};
+
+		this.isDone = function(url) {
+			return states[url] == LOADED;
+		};
+
+		this.markDone = function(url) {
+			states[url] = LOADED;
+		};
+
+		this.add = this.load = function(url, callback, scope) {
+			var item, state = states[url];
+
+			// Add url to load queue
+			if (state == undefined) {
+				queue.push(url);
+				states[url] = QUEUED;
+			}
+
+			if (callback) {
+				// Store away callback for later execution
+				if (!scriptLoadedCallbacks[url])
+					scriptLoadedCallbacks[url] = [];
+
+				scriptLoadedCallbacks[url].push({
+					func : callback,
+					scope : scope || this
+				});
+			}
+		};
+
+		this.loadQueue = function(callback, scope) {
+			this.loadScripts(queue, callback, scope);
+		};
+
+		this.loadScripts = function(scripts, callback, scope) {
+			var loadScripts;
+
+			function execScriptLoadedCallbacks(url) {
+				// Execute URL callback functions
+				tinymce.each(scriptLoadedCallbacks[url], function(callback) {
+					callback.func.call(callback.scope);
+				});
+
+				scriptLoadedCallbacks[url] = undefined;
+			};
+
+			queueLoadedCallbacks.push({
+				func : callback,
+				scope : scope || this
+			});
+
+			loadScripts = function() {
+				var loadingScripts = tinymce.grep(scripts);
+
+				// Current scripts has been handled
+				scripts.length = 0;
+
+				// Load scripts that needs to be loaded
+				tinymce.each(loadingScripts, function(url) {
+					// Script is already loaded then execute script callbacks directly
+					if (states[url] == LOADED) {
+						execScriptLoadedCallbacks(url);
+						return;
+					}
+
+					// Is script not loading then start loading it
+					if (states[url] != LOADING) {
+						states[url] = LOADING;
+						loading++;
+
+						loadScript(url, function() {
+							states[url] = LOADED;
+							loading--;
+
+							execScriptLoadedCallbacks(url);
+
+							// Load more scripts if they where added by the recently loaded script
+							loadScripts();
+						});
+					}
+				});
+
+				// No scripts are currently loading then execute all pending queue loaded callbacks
+				if (!loading) {
+					tinymce.each(queueLoadedCallbacks, function(callback) {
+						callback.func.call(callback.scope);
+					});
+
+					queueLoadedCallbacks.length = 0;
+				}
+			};
+
+			loadScripts();
+		};
+	};
+
+	// Global script loader
+	tinymce.ScriptLoader = new tinymce.dom.ScriptLoader();
+})(tinymce);
+
+tinymce.dom.TreeWalker = function(start_node, root_node) {
+	var node = start_node;
+
+	function findSibling(node, start_name, sibling_name, shallow) {
+		var sibling, parent;
+
+		if (node) {
+			// Walk into nodes if it has a start
+			if (!shallow && node[start_name])
+				return node[start_name];
+
+			// Return the sibling if it has one
+			if (node != root_node) {
+				sibling = node[sibling_name];
+				if (sibling)
+					return sibling;
+
+				// Walk up the parents to look for siblings
+				for (parent = node.parentNode; parent && parent != root_node; parent = parent.parentNode) {
+					sibling = parent[sibling_name];
+					if (sibling)
+						return sibling;
+				}
+			}
+		}
+	};
+
+	this.current = function() {
+		return node;
+	};
+
+	this.next = function(shallow) {
+		return (node = findSibling(node, 'firstChild', 'nextSibling', shallow));
+	};
+
+	this.prev = function(shallow) {
+		return (node = findSibling(node, 'lastChild', 'previousSibling', shallow));
+	};
+};
+
+(function(tinymce) {
+	tinymce.dom.RangeUtils = function(dom) {
+		var INVISIBLE_CHAR = '\uFEFF';
+
+		this.walk = function(rng, callback) {
+			var startContainer = rng.startContainer,
+				startOffset = rng.startOffset,
+				endContainer = rng.endContainer,
+				endOffset = rng.endOffset,
+				ancestor, startPoint,
+				endPoint, node, parent, siblings, nodes;
+
+			// Handle table cell selection the table plugin enables
+			// you to fake select table cells and perform formatting actions on them
+			nodes = dom.select('td.mceSelected,th.mceSelected');
+			if (nodes.length > 0) {
+				tinymce.each(nodes, function(node) {
+					callback([node]);
+				});
+
+				return;
+			}
+
+			function collectSiblings(node, name, end_node) {
+				var siblings = [];
+
+				for (; node && node != end_node; node = node[name])
+					siblings.push(node);
+
+				return siblings;
+			};
+
+			function findEndPoint(node, root) {
+				do {
+					if (node.parentNode == root)
+						return node;
+
+					node = node.parentNode;
+				} while(node);
+			};
+
+			function walkBoundary(start_node, end_node, next) {
+				var siblingName = next ? 'nextSibling' : 'previousSibling';
+
+				for (node = start_node, parent = node.parentNode; node && node != end_node; node = parent) {
+					parent = node.parentNode;
+					siblings = collectSiblings(node == start_node ? node : node[siblingName], siblingName);
+
+					if (siblings.length) {
+						if (!next)
+							siblings.reverse();
+
+						callback(siblings);
+					}
+				}
+			};
+
+			// If index based start position then resolve it
+			if (startContainer.nodeType == 1 && startContainer.hasChildNodes())
+				startContainer = startContainer.childNodes[startOffset];
+
+			// If index based end position then resolve it
+			if (endContainer.nodeType == 1 && endContainer.hasChildNodes())
+				endContainer = endContainer.childNodes[Math.min(endOffset - 1, endContainer.childNodes.length - 1)];
+
+			// Find common ancestor and end points
+			ancestor = dom.findCommonAncestor(startContainer, endContainer);
+
+			// Same container
+			if (startContainer == endContainer)
+				return callback([startContainer]);
+
+			// Process left side
+			for (node = startContainer; node; node = node.parentNode) {
+				if (node == endContainer)
+					return walkBoundary(startContainer, ancestor, true);
+
+				if (node == ancestor)
+					break;
+			}
+
+			// Process right side
+			for (node = endContainer; node; node = node.parentNode) {
+				if (node == startContainer)
+					return walkBoundary(endContainer, ancestor);
+
+				if (node == ancestor)
+					break;
+			}
+
+			// Find start/end point
+			startPoint = findEndPoint(startContainer, ancestor) || startContainer;
+			endPoint = findEndPoint(endContainer, ancestor) || endContainer;
+
+			// Walk left leaf
+			walkBoundary(startContainer, startPoint, true);
+
+			// Walk the middle from start to end point
+			siblings = collectSiblings(
+				startPoint == startContainer ? startPoint : startPoint.nextSibling,
+				'nextSibling',
+				endPoint == endContainer ? endPoint.nextSibling : endPoint
+			);
+
+			if (siblings.length)
+				callback(siblings);
+
+			// Walk right leaf
+			walkBoundary(endContainer, endPoint);
+		};
+
+		/*		this.split = function(rng) {
+			var startContainer = rng.startContainer,
+				startOffset = rng.startOffset,
+				endContainer = rng.endContainer,
+				endOffset = rng.endOffset;
+
+			function splitText(node, offset) {
+				if (offset == node.nodeValue.length)
+					node.appendData(INVISIBLE_CHAR);
+
+				node = node.splitText(offset);
+
+				if (node.nodeValue === INVISIBLE_CHAR)
+					node.nodeValue = '';
+
+				return node;
+			};
+
+			// Handle single text node
+			if (startContainer == endContainer) {
+				if (startContainer.nodeType == 3) {
+					if (startOffset != 0)
+						startContainer = endContainer = splitText(startContainer, startOffset);
+
+					if (endOffset - startOffset != startContainer.nodeValue.length)
+						splitText(startContainer, endOffset - startOffset);
+				}
+			} else {
+				// Split startContainer text node if needed
+				if (startContainer.nodeType == 3 && startOffset != 0) {
+					startContainer = splitText(startContainer, startOffset);
+					startOffset = 0;
+				}
+
+				// Split endContainer text node if needed
+				if (endContainer.nodeType == 3 && endOffset != endContainer.nodeValue.length) {
+					endContainer = splitText(endContainer, endOffset).previousSibling;
+					endOffset = endContainer.nodeValue.length;
+				}
+			}
+
+			return {
+				startContainer : startContainer,
+				startOffset : startOffset,
+				endContainer : endContainer,
+				endOffset : endOffset
+			};
+		};
+*/
+	};
+
+	tinymce.dom.RangeUtils.compareRanges = function(rng1, rng2) {
+		if (rng1 && rng2) {
+			// Compare native IE ranges
+			if (rng1.item || rng1.duplicate) {
+				// Both are control ranges and the selected element matches
+				if (rng1.item && rng2.item && rng1.item(0) === rng2.item(0))
+					return true;
+
+				// Both are text ranges and the range matches
+				if (rng1.isEqual && rng2.isEqual && rng2.isEqual(rng1))
+					return true;
+			} else {
+				// Compare w3c ranges
+				return rng1.startContainer == rng2.startContainer && rng1.startOffset == rng2.startOffset;
+			}
+		}
+
+		return false;
+	};
+})(tinymce);
+
+(function(tinymce) {
+	var Event = tinymce.dom.Event, each = tinymce.each;
+
+	tinymce.create('tinymce.ui.KeyboardNavigation', {
+		KeyboardNavigation: function(settings, dom) {
+			var t = this, root = settings.root, items = settings.items,
+					enableUpDown = settings.enableUpDown, enableLeftRight = settings.enableLeftRight || !settings.enableUpDown,
+					excludeFromTabOrder = settings.excludeFromTabOrder,
+					itemFocussed, itemBlurred, rootKeydown, rootFocussed, focussedId;
+
+			dom = dom || tinymce.DOM;
+
+			itemFocussed = function(evt) {
+				focussedId = evt.target.id;
+			};
+			
+			itemBlurred = function(evt) {
+				dom.setAttrib(evt.target.id, 'tabindex', '-1');
+			};
+			
+			rootFocussed = function(evt) {
+				var item = dom.get(focussedId);
+				dom.setAttrib(item, 'tabindex', '0');
+				item.focus();
+			};
+			
+			t.focus = function() {
+				dom.get(focussedId).focus();
+			};
+
+			t.destroy = function() {
+				each(items, function(item) {
+					dom.unbind(dom.get(item.id), 'focus', itemFocussed);
+					dom.unbind(dom.get(item.id), 'blur', itemBlurred);
+				});
+
+				dom.unbind(dom.get(root), 'focus', rootFocussed);
+				dom.unbind(dom.get(root), 'keydown', rootKeydown);
+
+				items = dom = root = t.focus = itemFocussed = itemBlurred = rootKeydown = rootFocussed = null;
+				t.destroy = function() {};
+			};
+			
+			t.moveFocus = function(dir, evt) {
+				var idx = -1, controls = t.controls, newFocus;
+
+				if (!focussedId)
+					return;
+
+				each(items, function(item, index) {
+					if (item.id === focussedId) {
+						idx = index;
+						return false;
+					}
+				});
+
+				idx += dir;
+				if (idx < 0) {
+					idx = items.length - 1;
+				} else if (idx >= items.length) {
+					idx = 0;
+				}
+				
+				newFocus = items[idx];
+				dom.setAttrib(focussedId, 'tabindex', '-1');
+				dom.setAttrib(newFocus.id, 'tabindex', '0');
+				dom.get(newFocus.id).focus();
+
+				if (settings.actOnFocus) {
+					settings.onAction(newFocus.id);
+				}
+
+				if (evt)
+					Event.cancel(evt);
+			};
+			
+			rootKeydown = function(evt) {
+				var DOM_VK_LEFT = 37, DOM_VK_RIGHT = 39, DOM_VK_UP = 38, DOM_VK_DOWN = 40, DOM_VK_ESCAPE = 27, DOM_VK_ENTER = 14, DOM_VK_RETURN = 13, DOM_VK_SPACE = 32;
+				
+				switch (evt.keyCode) {
+					case DOM_VK_LEFT:
+						if (enableLeftRight) t.moveFocus(-1);
+						break;
+	
+					case DOM_VK_RIGHT:
+						if (enableLeftRight) t.moveFocus(1);
+						break;
+	
+					case DOM_VK_UP:
+						if (enableUpDown) t.moveFocus(-1);
+						break;
+
+					case DOM_VK_DOWN:
+						if (enableUpDown) t.moveFocus(1);
+						break;
+
+					case DOM_VK_ESCAPE:
+						if (settings.onCancel) {
+							settings.onCancel();
+							Event.cancel(evt);
+						}
+						break;
+
+					case DOM_VK_ENTER:
+					case DOM_VK_RETURN:
+					case DOM_VK_SPACE:
+						if (settings.onAction) {
+							settings.onAction(focussedId);
+							Event.cancel(evt);
+						}
+						break;
+				}
+			};
+
+			// Set up state and listeners for each item.
+			each(items, function(item, idx) {
+				var tabindex;
+
+				if (!item.id) {
+					item.id = dom.uniqueId('_mce_item_');
+				}
+
+				if (excludeFromTabOrder) {
+					dom.bind(item.id, 'blur', itemBlurred);
+					tabindex = '-1';
+				} else {
+					tabindex = (idx === 0 ? '0' : '-1');
+				}
+
+				dom.setAttrib(item.id, 'tabindex', tabindex);
+				dom.bind(dom.get(item.id), 'focus', itemFocussed);
+			});
+			
+			// Setup initial state for root element.
+			if (items[0]){
+				focussedId = items[0].id;
+			}
+
+			dom.setAttrib(root, 'tabindex', '-1');
+			
+			// Setup listeners for root element.
+			dom.bind(dom.get(root), 'focus', rootFocussed);
+			dom.bind(dom.get(root), 'keydown', rootKeydown);
+		}
+	});
+})(tinymce);
+(function(tinymce) {
+	// Shorten class names
+	var DOM = tinymce.DOM, is = tinymce.is;
+
+	tinymce.create('tinymce.ui.Control', {
+		Control : function(id, s, editor) {
+			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;
+			this.editor = editor;
+		},
+		
+		setAriaProperty : function(property, value) {
+			var element = DOM.get(this.id + '_aria') || DOM.get(this.id);
+			if (element) {
+				DOM.setAttrib(element, 'aria-' + property, !!value);
+			}
+		},
+		
+		focus : function() {
+			DOM.get(this.id).focus();
+		},
+
+		setDisabled : function(s) {
+			if (s != this.disabled) {
+				this.setAriaProperty('disabled', s);
+
+				this.setState('Disabled', s);
+				this.setState('Enabled', !s);
+				this.disabled = s;
+			}
+		},
+
+		isDisabled : function() {
+			return this.disabled;
+		},
+
+		setActive : function(s) {
+			if (s != this.active) {
+				this.setState('Active', s);
+				this.active = s;
+				this.setAriaProperty('pressed', 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() {
+		},
+
+		renderTo : function(n) {
+			DOM.setHTML(n, this.renderHTML());
+		},
+
+		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, editor) {
+		this.parent(id, s, editor);
+
+		this.controls = [];
+
+		this.lookup = {};
+	},
+
+	add : function(c) {
+		this.lookup[c.id] = c;
+		this.controls.push(c);
+
+		return c;
+	},
+
+	get : function(n) {
+		return this.lookup[n];
+	}
+});
+
+
+tinymce.create('tinymce.ui.Separator:tinymce.ui.Control', {
+	Separator : function(id, s) {
+		this.parent(id, s);
+		this.classPrefix = 'mceSeparator';
+		this.setDisabled(true);
+	},
+
+	renderHTML : function() {
+		return tinymce.DOM.createHTML('span', {'class' : this.classPrefix, role : 'separator', 'aria-orientation' : 'vertical', tabindex : '-1'});
+	}
+});
+
+(function(tinymce) {
+	var is = tinymce.is, DOM = tinymce.DOM, each = tinymce.each, walk = tinymce.walk;
+
+	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.setAriaProperty('checked', !!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;
+			s.keyboard_focus = cs.keyboard_focus;
+			m = new tinymce.ui.DropMenu(s.id || DOM.uniqueId(), s);
+
+			m.onAddItem.add(t.onAddItem.dispatch, t.onAddItem);
+
+			return m;
+		},
+		
+		focus : function() {
+			var t = this;
+			if (t.keyboardNav) {
+				t.keyboardNav.focus();
+			}
+		},
+
+		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');
+						}
+					}
+				});
+			}
+			
+			Event.add(co, 'keydown', t._keyHandler, t);
+
+			t.onShowMenu.dispatch(t);
+
+			if (s.keyboard_focus) { 
+				t._setupKeyboardNav(); 
+			}
+		},
+
+		hideMenu : function(c) {
+			var t = this, co = DOM.get('menu_' + t.id), e;
+
+			if (!t.isMenuVisible)
+				return;
+
+			if (t.keyboardNav) t.keyboardNav.destroy();
+			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);
+
+			if (t.keyboardNav) t.keyboardNav.destroy();
+			Event.remove(co, 'mouseover', t.mouseOverFunc);
+			Event.remove(DOM.select('a', co), 'focus', t.mouseOverFunc);
+			Event.remove(co, 'click', t.mouseClickFunc);
+			Event.remove(co, 'keydown', t._keyHandler);
+
+			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', {role: 'listbox', id : 'menu_' + t.id, 'class' : s['class'], 'style' : 'position:absolute;left:0;top:0;z-index:200000;outline:0'});
+			if (t.settings.parent) {
+				DOM.setAttrib(w, 'aria-parent', 'menu_' + t.settings.parent.id);
+			}
+			co = DOM.add(w, 'div', {role: 'presentation', 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', {role: 'presentation', 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
+		_setupKeyboardNav : function(){
+			var contextMenu, menuItems, t=this; 
+			contextMenu = DOM.select('#menu_' + t.id)[0];
+			menuItems = DOM.select('a[role=option]', 'menu_' + t.id);
+			menuItems.splice(0,0,contextMenu);
+			t.keyboardNav = new tinymce.ui.KeyboardNavigation({
+				root: 'menu_' + t.id,
+				items: menuItems,
+				onCancel: function() {
+					t.hideMenu();
+				},
+				enableUpDown: true
+			});
+			contextMenu.focus();
+		},
+
+		_keyHandler : function(evt) {
+			var t = this, e;
+			switch (evt.keyCode) {
+				case 37: // Left
+					if (t.settings.parent) {
+						t.hideMenu();
+						t.settings.parent.focus();
+						Event.cancel(evt);
+					}
+					break;
+				case 39: // Right
+					if (t.mouseOverFunc)
+						t.mouseOverFunc(evt);
+					break;
+			}
+		},
+
+		_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, s.titleItem ? 'th' : 'td');
+			n = a = DOM.add(n, 'a', {id: o.id + '_aria',  role: s.titleItem ? 'presentation' : 'option', href : 'javascript:;', onclick : "return false;", onmousedown : 'return false;'});
+
+			if (s.parent) {
+				DOM.setAttrib(a, 'aria-haspopup', 'true');
+				DOM.setAttrib(a, 'aria-owns', 'menu_' + o.id);
+			}
+
+			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, ed) {
+			this.parent(id, s, ed);
+			this.classPrefix = 'mceButton';
+		},
+
+		renderHTML : function() {
+			var cp = this.classPrefix, s = this.settings, h, l;
+
+			l = DOM.encode(s.label || '');
+			h = '<a role="button" id="' + this.id + '" href="javascript:;" class="' + cp + ' ' + cp + 'Enabled ' + s['class'] + (l ? ' ' + cp + 'Labeled' : '') +'" onmousedown="return false;" onclick="return false;" aria-labelledby="' + this.id + '_voice" title="' + DOM.encode(s.title) + '">';
+
+			if (s.image)
+				h += '<img class="mceIcon" src="' + s.image + '" alt="' + DOM.encode(s.title) + '" />' + l;
+			else
+				h += '<span class="mceIcon ' + s['class'] + '"></span>' + (l ? '<span class="' + cp + 'Label">' + l + '</span>' : '');
+
+			h += '<span class="mceVoiceLabel mceIconOnly" style="display: none;" id="' + this.id + '_voice">' + s.title + '</span>'; 
+			h += '</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, ed) {
+			var t = this;
+
+			t.parent(id, s, ed);
+
+			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');
+					DOM.setAttrib(t.id, 'aria-valuenow', o.title);
+				} else {
+					DOM.setHTML(e, DOM.encode(t.settings.title));
+					DOM.addClass(e, 'mceTitle');
+					t.selectedValue = t.selectedIndex = null;
+					DOM.setAttrib(t.id, 'aria-valuenow', t.settings.title);
+				}
+				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 = '<span role="button" aria-haspopup="true" aria-labelledby="' + t.id +'_text" aria-describedby="' + t.id + '_voiceDesc"><table role="presentation" tabindex="0" id="' + t.id + '" cellpadding="0" cellspacing="0" class="' + cp + ' ' + cp + 'Enabled' + (s['class'] ? (' ' + s['class']) : '') + '"><tbody><tr>';
+			h += '<td>' + DOM.createHTML('span', {id: t.id + '_voiceDesc', 'class': 'voiceLabel', style:'display:none;'}, t.settings.title); 
+			h += DOM.createHTML('a', {id : t.id + '_text', tabindex : -1, 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 style="display:none;" class="mceIconOnly" aria-hidden="true">\u25BC</span></span>') + '</td>';
+			h += '</tr></tbody></table></span>';
+
+			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;
+
+			if (t.menu && t.menu.isMenuVisible) {
+				DOM.removeClass(t.id, t.classPrefix + 'Selected');
+
+				// 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);
+					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(function() {
+				t.hideMenu();
+				t.focus();
+			});
+
+			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) {
+				// No value then treat it as a title
+				if (o.value === undefined) {
+					m.add({
+						title : o.title,
+						'class' : 'mceMenuItemTitle',
+						onclick : function() {
+							if (t.settings.onselect('') !== false)
+								t.select(''); // Must be runned after
+						}
+					});
+				} else {
+					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, 'keydown', function(evt) {
+				if (evt.keyCode == 32) { // Space
+					t.showMenu(evt);
+					Event.cancel(evt);
+				}
+			});
+			Event.add(t.id, 'focus', function() {
+				if (!t._focused) {
+					t.keyDownHandler = Event.add(t.id, 'keydown', function(e) {
+						if (e.keyCode == 40) {
+							t.showMenu();
+							Event.cancel(e);
+						}
+					});
+					t.keyPressHandler = Event.add(t.id, 'keypress', function(e) {
+						var v;
+						if (e.keyCode == 13) {
+							// Fake select on enter
+							v = t.selectedValue;
+							t.selectedValue = null; // Needs to be null to fake change
+							Event.cancel(e);
+							t.settings.onselect(v);
+						}
+					});
+				}
+
+				t._focused = 1;
+			});
+			Event.add(t.id, 'blur', function() {
+				Event.remove(t.id, 'keydown', t.keyDownHandler);
+				Event.remove(t.id, 'keypress', t.keyPressHandler);
+				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;
+			this.setAriaProperty('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 this.items.length;
+		},
+
+		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', 'aria-labelledby': t.id + '_aria'}, h);
+			h += DOM.createHTML('span', {id : t.id + '_aria', 'style': 'display: none'}, t.settings.title);
+			return h;
+		},
+
+		postRender : function() {
+			var t = this, ch, changeListenerAdded = true;
+
+			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);
+				changeListenerAdded = false;
+
+				bf = Event.add(t.id, 'blur', function() {
+					if (changeListenerAdded) return;
+					changeListenerAdded = true;
+					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, ed) {
+			this.parent(id, s, ed);
+
+			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(function() {
+				t.hideMenu();
+				t.focus();
+			});
+
+			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, ed) {
+			this.parent(id, s, ed);
+			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, role: 'presentation', 'class' : 'mceAction ' + s['class']});
+			else
+				h1 = DOM.createHTML('span', {'class' : 'mceAction ' + s['class']}, '');
+
+			h1 += DOM.createHTML('span', {'class': 'mceVoiceLabel mceIconOnly', id: t.id + '_voice', style: 'display:none;'}, s.title);
+			h += '<td >' + DOM.createHTML('a', {role: 'button', id : t.id + '_action', tabindex: '-1', 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']}, '<span style="display:none;" class="mceIconOnly" aria-hidden="true">\u25BC</span>');
+			h += '<td >' + DOM.createHTML('a', {role: 'button', id : t.id + '_open', tabindex: '-1', href : 'javascript:;', 'class' : 'mceOpen ' + s['class'], onclick : "return false;", onmousedown : 'return false;', title : s.title}, h1) + '</td>';
+
+			h += '</tr></tbody>';
+			h = DOM.createHTML('table', {id : t.id, role: 'presentation', tabindex: '0',  'class' : 'mceSplitButton mceSplitButtonEnabled ' + s['class'], cellpadding : '0', cellspacing : '0', title : s.title}, h);
+			return DOM.createHTML('span', {role: 'button', 'aria-labelledby': t.id + '_voice', 'aria-haspopup': 'true'}, h);
+		},
+
+		postRender : function() {
+			var t = this, s = t.settings, activate;
+
+			if (s.onclick) {
+				activate = function(evt) {
+					if (!t.isDisabled()) {
+						s.onclick(t.value);
+						Event.cancel(evt);
+					}
+				};
+				Event.add(t.id + '_action', 'click', activate);
+				Event.add(t.id, ['click', 'keydown'], function(evt) {
+					var DOM_VK_SPACE = 32, DOM_VK_ENTER = 14, DOM_VK_RETURN = 13, DOM_VK_UP = 38, DOM_VK_DOWN = 40;
+					if ((evt.keyCode === 32 || evt.keyCode === 13 || evt.keyCode === 14) && !evt.altKey && !evt.ctrlKey && !evt.metaKey) {
+						activate();
+						Event.cancel(evt);
+					} else if (evt.type === 'click' || evt.keyCode === DOM_VK_DOWN) {
+						t.showMenu();
+						Event.cancel(evt);
+					}
+				});
+			}
+
+			Event.add(t.id + '_open', 'click', function (evt) {
+				t.showMenu();
+				Event.cancel(evt);
+			});
+			Event.add([t.id, t.id + '_open'], 'focus', function() {t._focused = 1;});
+			Event.add([t.id, 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');
+			Event.clear(this.id);
+		}
+	});
+})(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, ed) {
+			var t = this;
+
+			t.parent(id, s, ed);
+
+			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;
+			t.editor.focus();
+		},
+
+		renderMenu : function() {
+			var t = this, m, i = 0, s = t.settings, n, tb, tr, w, context;
+
+			w = DOM.add(s.menu_container, 'div', {role: 'listbox', 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', {role: 'presentation', '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', {
+					role : 'option',
+					href : 'javascript:;',
+					style : {
+						backgroundColor : '#' + c
+					},
+					'title': t.editor.getLang('colors.' + c, c),
+					'data-mce-color' : '#' + c
+				});
+
+				if (t.editor.forcedHighContrastMode) {
+					n = DOM.add(n, 'canvas', { width: 16, height: 16, 'aria-hidden': 'true' });
+					if (n.getContext && (context = n.getContext("2d"))) {
+						context.fillStyle = '#' + c;
+						context.fillRect(0, 0, 16, 16);
+					} else {
+						// No point leaving a canvas element around if it's not supported for drawing on anyway.
+						DOM.remove(n);
+					}
+				}
+			});
+
+			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', {role: 'option', 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');
+			
+			new tinymce.ui.KeyboardNavigation({
+				root: t.id + '_menu',
+				items: DOM.select('a', t.id + '_menu'),
+				onCancel: function() {
+					t.hideMenu();
+					t.focus();
+				}
+			});
+
+			// Prevent IE from scrolling and hindering click to occur #4019
+			Event.add(t.id + '_menu', 'mousedown', function(e) {return Event.cancel(e);});
+
+			Event.add(t.id + '_menu', 'click', function(e) {
+				var c;
+
+				e = DOM.getParent(e.target, 'a', tb);
+
+				if (e && e.nodeName.toLowerCase() == 'a' && (c = e.getAttribute('data-mce-color')))
+					t.setColor(c);
+
+				return Event.cancel(e); // Prevent IE auto save warning
+			});
+
+			return w;
+		},
+
+		setColor : function(c) {
+			this.displayColor(c);
+			this.hideMenu();
+			this.settings.onselect(c);
+		},
+		
+		displayColor : function(c) {
+			var t = this;
+
+			DOM.setStyle(t.id + '_preview', 'backgroundColor', c);
+
+			t.value = 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);
+
+(function(tinymce) {
+// Shorten class names
+var dom = tinymce.DOM, each = tinymce.each, Event = tinymce.dom.Event;
+tinymce.create('tinymce.ui.ToolbarGroup:tinymce.ui.Container', {
+	renderHTML : function() {
+		var t = this, h = [], controls = t.controls, each = tinymce.each, settings = t.settings;
+
+		h.push('<div id="' + t.id + '" role="group" aria-labelledby="' + t.id + '_voice">');
+		//TODO: ACC test this out - adding a role = application for getting the landmarks working well.
+		h.push("<span role='application'>");
+		h.push('<span id="' + t.id + '_voice" class="mceVoiceLabel" style="display:none;">' + dom.encode(settings.name) + '</span>');
+		each(controls, function(toolbar) {
+			h.push(toolbar.renderHTML());
+		});
+		h.push("</span>");
+		h.push('</div>');
+
+		return h.join('');
+	},
+	
+	focus : function() {
+		this.keyNav.focus();
+	},
+	
+	postRender : function() {
+		var t = this, items = [];
+
+		each(t.controls, function(toolbar) {
+			each (toolbar.controls, function(control) {
+				if (control.id) {
+					items.push(control);
+				}
+			});
+		});
+
+		t.keyNav = new tinymce.ui.KeyboardNavigation({
+			root: t.id,
+			items: items,
+			onCancel: function() {
+				t.editor.focus();
+			},
+			excludeFromTabOrder: !t.settings.tab_focus_toolbar
+		});
+	},
+	
+	destroy : function() {
+		var self = this;
+
+		self.parent();
+		self.keyNav.destroy();
+		Event.clear(self.id);
+	}
+});
+})(tinymce);
+
+(function(tinymce) {
+// Shorten class names
+var dom = tinymce.DOM, each = tinymce.each
+tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', {
+	renderHTML : function() {
+		var t = this, h = '', c, co, 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 || '', role: 'presentation', tabindex: '-1'}, '<tbody><tr>' + h + '</tr></tbody>');
+	}
+});
+})(tinymce);
+
+(function(tinymce) {
+	var Dispatcher = tinymce.util.Dispatcher, each = tinymce.each;
+
+	tinymce.create('tinymce.AddOnManager', {
+		AddOnManager : function() {
+			var self = this;
+
+			self.items = [];
+			self.urls = {};
+			self.lookup = {};
+			self.onAdd = new Dispatcher(self);
+		},
+
+		get : function(n) {
+			return this.lookup[n];
+		},
+
+		requireLangPack : function(n) {
+			var s = tinymce.settings;
+
+			if (s && s.language && s.language_load !== false)
+				tinymce.ScriptLoader.add(this.urls[n] + '/langs/' + s.language + '.js');
+		},
+
+		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('/'));
+
+			if (!t.lookup[n])
+				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,
+		Dispatcher = tinymce.util.Dispatcher, undefined, instanceCounter = 0;
+
+	// Setup some URLs where the editor API is located and where the document is
+	tinymce.documentBaseURL = window.location.href.replace(/[\?#].*$/, '').replace(/[\/\\][^\/]+$/, '');
+	if (!/[\/\\]$/.test(tinymce.documentBaseURL))
+		tinymce.documentBaseURL += '/';
+
+	tinymce.baseURL = new tinymce.util.URI(tinymce.documentBaseURL).toAbsolute(tinymce.baseURL);
+
+	tinymce.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
+	tinymce.onBeforeUnload = new Dispatcher(tinymce);
+
+	// Must be on window or IE will leak if the editor is placed in frame or iframe
+	Event.add(window, 'beforeunload', function(e) {
+		tinymce.onBeforeUnload.dispatch(tinymce, e);
+	});
+
+	tinymce.onAddEditor = new Dispatcher(tinymce);
+
+	tinymce.onRemoveEditor = new Dispatcher(tinymce);
+
+	tinymce.EditorManager = extend(tinymce, {
+		editors : [],
+
+		i18n : {},
+
+		activeEditor : null,
+
+		init : function(s) {
+			var t = this, pl, sl = tinymce.ScriptLoader, 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"
+			}, s);
+
+			t.settings = s;
+
+			// Legacy call
+			Event.add(document, 'init', function() {
+				var l, co;
+
+				execCallback(s, 'onpageload');
+
+				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 {
+									each(document.forms, function(f) {
+										each(f.elements, function(e) {
+											if (e.name === v) {
+												v = 'mce_editor_' + instanceCounter++;
+												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) {
+			if (id === undefined)
+				return this.editors;
+
+			return this.editors[id];
+		},
+
+		getInstanceById : function(id) {
+			return this.get(id);
+		},
+
+		add : function(editor) {
+			var self = this, editors = self.editors;
+
+			// Add named and index editor instance
+			editors[editor.id] = editor;
+			editors.push(editor);
+
+			self._setActive(editor);
+			self.onAddEditor.dispatch(self, editor);
+
+
+			return editor;
+		},
+
+		remove : function(editor) {
+			var t = this, i, editors = t.editors;
+
+			// Not in the collection
+			if (!editors[editor.id])
+				return null;
+
+			delete editors[editor.id];
+
+			for (i = 0; i < editors.length; i++) {
+				if (editors[i] == editor) {
+					editors.splice(i, 1);
+					break;
+				}
+			}
+
+			// Select another editor since the active one was removed
+			if (t.activeEditor == editor)
+				t._setActive(editors[0]);
+
+			editor.destroy();
+			t.onRemoveEditor.dispatch(t, editor);
+
+			return editor;
+		},
+
+		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(editor) {
+			this.selectedInstance = this.activeEditor = editor;
+		}
+	});
+})(tinymce);
+
+(function(tinymce) {
+	// Shorten these names
+	var DOM = tinymce.DOM, Event = tinymce.dom.Event, extend = tinymce.extend,
+		Dispatcher = tinymce.util.Dispatcher, each = tinymce.each, isGecko = tinymce.isGecko,
+		isIE = tinymce.isIE, isWebKit = tinymce.isWebKit, is = tinymce.is,
+		ThemeManager = tinymce.ThemeManager, PluginManager = tinymce.PluginManager,
+		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.isNotDirty = false;
+
+			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);
+			});
+
+			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 : tinymce.isIE6 ? '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">' : '<!DOCTYPE>', // Use old doctype on IE 6 to avoid horizontal scroll
+				visual_table_class : 'mceItemTable',
+				visual : 1,
+				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',
+				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,
+				inline_styles : 1,
+				convert_fonts_to_spans : true,
+				indent : 'simple',
+				indent_before : 'p,h1,h2,h3,h4,h5,h6,blockquote,div,title,style,pre,script,td,ul,li,area,table,thead,tfoot,tbody,tr',
+				indent_after : 'p,h1,h2,h3,h4,h5,h6,blockquote,div,title,style,pre,script,td,ul,li,area,table,thead,tfoot,tbody,tr',
+				validate : true,
+				entity_encoding : 'named',
+				url_converter : t.convertURL,
+				url_converter_scope : t,
+				ie7_compat : true
+			}, s);
+
+			t.documentBaseURI = new tinymce.util.URI(s.document_base_url || tinymce.documentBaseURL, {
+				base_uri : tinyMCE.baseURI
+			});
+
+			t.baseURI = tinymce.baseURI;
+
+			t.contentCSS = [];
+
+			// 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;
+			}
+
+			tinyMCE.settings = s;
+
+			// Element not found, then skip initialization
+			if (!t.getElement())
+				return;
+
+			// Is a iPad/iPhone, then skip initialization. We need to sniff here since the
+			// browser says it has contentEditable support but there is no visible caret
+			// We will remove this check ones Apple implements full contentEditable support
+			if (tinymce.isIDevice)
+				return;
+
+			// 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
+							tinymce.triggerSave();
+							t.isNotDirty = 1;
+
+							return t.formElement._mceOldSubmit(t.formElement);
+						};
+					}
+
+					n = null;
+				});
+			}
+
+			// Load scripts
+			function loadScripts() {
+				if (s.language && s.language_load !== false)
+					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, since it is removed as of 3.3b1
+						if (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();
+				});
+			};
+
+			loadScripts();
+		},
+
+		init : function() {
+			var n, t = this, s = t.settings, w, h, e = t.getElement(), o, ti, u, bi, bc, re, i;
+
+			tinymce.add(t);
+
+			s.aria_label = s.aria_label || DOM.getAttrib(e, 'aria-label', t.getLang('aria.rich_text_area'));
+
+			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);
+
+			t.controlManager = new tinymce.ControlManager(t);
+
+			if (s.custom_undo_redo) {
+				t.onBeforeExecCommand.add(function(ed, cmd, ui, val, a) {
+					if (cmd != 'Undo' && cmd != 'Redo' && cmd != 'mceRepaint' && (!a || !a.skip_undo))
+						t.undoManager.beforeChange();
+				});
+
+				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
+			});
+
+			// Load specified content CSS last
+			if (s.content_css) {
+				tinymce.each(explode(s.content_css), function(u) {
+					t.contentCSS.push(t.documentBaseURI.toAbsolute(u));
+				});
+			}
+
+			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() + '" />';
+
+			// IE8 doesn't support carets behind images setting ie7_compat would force IE8+ to run in IE7 compat mode.
+			if (s.ie7_compat)
+				t.iframeHTML += '<meta http-equiv="X-UA-Compatible" content="IE=7" />';
+			else
+				t.iframeHTML += '<meta http-equiv="X-UA-Compatible" content="IE=edge" />';
+
+			t.iframeHTML += '<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />';
+
+			// Firefox 2 doesn't load stylesheets correctly this way
+			if (!isGecko || !/Firefox\/2/.test(navigator.userAgent)) {
+				for (i = 0; i < t.contentCSS.length; i++)
+					t.iframeHTML += '<link type="text/css" rel="stylesheet" href="' + t.contentCSS[i] + '" />';
+
+				t.contentCSS = [];
+			}
+
+			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 && (isIE || (tinymce.isOpera && parseFloat(opera.version()) < 11))) {
+				// We need to write the contents here in IE since multiple writes messes up refresh button and back button
+				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();})()';				
+			}
+
+			// Create iframe
+			// TODO: ACC add the appropriate description on this.
+			n = DOM.add(o.iframeContainer, 'iframe', { 
+				id : t.id + "_ifr",
+				src : u || 'javascript:""', // Workaround for HTTPS warning in IE6/7
+				frameBorder : '0', 
+				title : s.aria_label,
+				style : {
+					width : '100%',
+					height : h
+				}
+			});
+
+			t.contentAreaContainer = o.iframeContainer;
+			DOM.get(o.editorContainer).style.display = t.orgDisplay;
+			DOM.get(t.id).style.display = 'none';
+			DOM.setAttrib(t.id, 'aria-hidden', true);
+
+			if (!tinymce.relaxedDomain || !u)
+				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();
+
+				if (tinymce.relaxedDomain)
+					d.domain = tinymce.relaxedDomain;
+			}
+
+			// 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);
+			}
+
+			t.schema = new tinymce.html.Schema(s);
+
+			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,
+				schema : t.schema
+			});
+
+			t.parser = new tinymce.html.DomParser(s, t.schema);
+
+			// Force anchor names closed
+			t.parser.addAttributeFilter('name', function(nodes, name) {
+				var i = nodes.length, sibling, prevSibling, parent, node;
+
+				while (i--) {
+					node = nodes[i];
+					if (node.name === 'a' && node.firstChild) {
+						parent = node.parent;
+
+						// Move children after current node
+						sibling = node.lastChild;
+						do {
+							prevSibling = sibling.prev;
+							parent.insert(sibling, node);
+							sibling = prevSibling;
+						} while (sibling);
+					}
+				}
+			});
+
+			// Convert src and href into data-mce-src, data-mce-href and data-mce-style
+			t.parser.addAttributeFilter('src,href,style', function(nodes, name) {
+				var i = nodes.length, node, dom = t.dom, value;
+
+				while (i--) {
+					node = nodes[i];
+					value = node.attr(name);
+
+					if (name === "style")
+						node.attr('data-mce-style', dom.serializeStyle(dom.parseStyle(value), node.name));
+					else
+						node.attr('data-mce-' + name, t.convertURL(value, name, node.name));
+				}
+			});
+
+			// Keep scripts from executing
+			t.parser.addNodeFilter('script', function(nodes, name) {
+				var i = nodes.length;
+
+				while (i--)
+					nodes[i].attr('type', 'mce-text/javascript');
+			});
+
+			t.parser.addNodeFilter('#cdata', function(nodes, name) {
+				var i = nodes.length, node;
+
+				while (i--) {
+					node = nodes[i];
+					node.type = 8;
+					node.name = '#comment';
+					node.value = '[CDATA[' + node.value + ']]';
+				}
+			});
+
+			t.parser.addNodeFilter('p,h1,h2,h3,h4,h5,h6,div', function(nodes, name) {
+				var i = nodes.length, node, nonEmptyElements = t.schema.getNonEmptyElements();
+
+				while (i--) {
+					node = nodes[i];
+
+					if (node.isEmpty(nonEmptyElements))
+						node.empty().append(new tinymce.html.Node('br', 1)).shortEnded = true;
+				}
+			});
+
+			t.serializer = new tinymce.dom.Serializer(s, t.dom, t.schema);
+
+			t.selection = new tinymce.dom.Selection(t.dom, t.getWin(), t.serializer);
+
+			t.formatter = new tinymce.Formatter(this);
+
+			// Register default formats
+			t.formatter.register({
+				alignleft : [
+					{selector : 'p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li', styles : {textAlign : 'left'}},
+					{selector : 'img,table', collapsed : false, styles : {'float' : 'left'}}
+				],
+
+				aligncenter : [
+					{selector : 'p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li', styles : {textAlign : 'center'}},
+					{selector : 'img', collapsed : false, styles : {display : 'block', marginLeft : 'auto', marginRight : 'auto'}},
+					{selector : 'table', collapsed : false, styles : {marginLeft : 'auto', marginRight : 'auto'}}
+				],
+
+				alignright : [
+					{selector : 'p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li', styles : {textAlign : 'right'}},
+					{selector : 'img,table', collapsed : false, styles : {'float' : 'right'}}
+				],
+
+				alignfull : [
+					{selector : 'p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li', styles : {textAlign : 'justify'}}
+				],
+
+				bold : [
+					{inline : 'strong', remove : 'all'},
+					{inline : 'span', styles : {fontWeight : 'bold'}},
+					{inline : 'b', remove : 'all'}
+				],
+
+				italic : [
+					{inline : 'em', remove : 'all'},
+					{inline : 'span', styles : {fontStyle : 'italic'}},
+					{inline : 'i', remove : 'all'}
+				],
+
+				underline : [
+					{inline : 'span', styles : {textDecoration : 'underline'}, exact : true},
+					{inline : 'u', remove : 'all'}
+				],
+
+				strikethrough : [
+					{inline : 'span', styles : {textDecoration : 'line-through'}, exact : true},
+					{inline : 'strike', remove : 'all'}
+				],
+
+				forecolor : {inline : 'span', styles : {color : '%value'}, wrap_links : false},
+				hilitecolor : {inline : 'span', styles : {backgroundColor : '%value'}, wrap_links : false},
+				fontname : {inline : 'span', styles : {fontFamily : '%value'}},
+				fontsize : {inline : 'span', styles : {fontSize : '%value'}},
+				fontsize_class : {inline : 'span', attributes : {'class' : '%value'}},
+				blockquote : {block : 'blockquote', wrapper : 1, remove : 'all'},
+				subscript : {inline : 'sub'},
+				superscript : {inline : 'sup'},
+
+				removeformat : [
+					{selector : 'b,strong,em,i,font,u,strike', remove : 'all', split : true, expand : false, block_expand : true, deep : true},
+					{selector : 'span', attributes : ['style', 'class'], remove : 'empty', split : true, expand : false, deep : true},
+					{selector : '*', attributes : ['style', 'class'], split : false, expand : false, deep : true}
+				]
+			});
+
+			// Register default block formats
+			each('p h1 h2 h3 h4 h5 h6 div address pre div code dt dd samp'.split(/\s/), function(name) {
+				t.formatter.register(name, {block : name, remove : 'all'});
+			});
+
+			// Register user defined formats
+			t.formatter.register(t.settings.formats);
+
+			t.undoManager = new tinymce.UndoManager(t);
+
+			// Pass through
+			t.undoManager.onAdd.add(function(um, l) {
+				if (um.hasUndo())
+					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);
+			});
+
+			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.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.protect) {
+				t.onBeforeSetContent.add(function(ed, o) {
+					if (s.protect) {
+						each(s.protect, function(pattern) {
+							o.content = o.content.replace(pattern, function(str) {
+								return '<!--mce:protected ' + escape(str) + '-->';
+							});
+						});
+					}
+				});
+			}
+
+			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.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.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', {'data-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 : 'html'});
+				t.startContent = t.getContent({format : 'raw'});
+				t.undoManager.add();
+				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
+				each(t.contentCSS, function(u) {
+					t.dom.loadCSS(u);
+				});
+
+				// Handle auto focus
+				if (s.auto_focus) {
+					setTimeout(function () {
+						var ed = tinymce.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, ieRng, controlElm, doc = t.getDoc();
+
+			if (!sf) {
+				// Get selected control element
+				ieRng = t.selection.getRng();
+				if (ieRng.item) {
+					controlElm = ieRng.item(0);
+				}
+
+				// Is not content editable
+				if (!ce)
+					t.getWin().focus();
+
+				// Restore selected control element
+				// This is needed when for example an image is selected within a
+				// layer a call to focus will then remove the control selection
+				if (controlElm && controlElm.ownerDocument == doc) {
+					ieRng = doc.body.createControlRange();
+					ieRng.addElement(controlElm);
+					ieRng.select();
+				}
+
+			}
+
+			if (tinymce.activeEditor != t) {
+				if ((oed = tinymce.activeEditor) != null)
+					oed.onDeactivate.dispatch(oed, t);
+
+				t.onActivate.dispatch(t, oed);
+			}
+
+			tinymce._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 = tinymce.i18n;
+
+			if (!s)
+				return '';
+
+			return i18n[c + '.' + s] || s.replace(/{\#([^}]+)\}/g, function(a, b) {
+				return i18n[c + '.' + b] || '{#' + b + '}';
+			});
+		},
+
+		getLang : function(n, dv) {
+			return tinymce.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.getStart() || t.getBody();
+
+			// Fix for bug #1896577 it seems that this can not be fired while the editor is loading
+			if (t.initialized) {
+				o = o || {};
+				n = isIE && n.ownerDocument != t.getDoc() ? t.getBody() : n; // Fix for IE initial state
+
+				// Get parents and add them to object
+				o.parents = [];
+				t.dom.getParent(n, function(node) {
+					if (node.nodeName == 'BODY')
+						return true;
+
+					o.parents.push(node);
+				});
+
+				t.onNodeChange.dispatch(
+					t,
+					o ? o.controlManager || t.controlManager : t.controlManager,
+					n,
+					s.isCollapsed(),
+					o
+				);
+			}
+		},
+
+		addButton : function(n, s) {
+			var t = this;
+
+			t.buttons = t.buttons || {};
+			t.buttons[n] = s;
+		},
+
+		addCommand : function(name, callback, scope) {
+			this.execCommands[name] = {func : callback, scope : scope || this};
+		},
+
+		addQueryStateHandler : function(name, callback, scope) {
+			this.queryStateCommands[name] = {func : callback, scope : scope || this};
+		},
+
+		addQueryValueHandler : function(name, callback, scope) {
+			this.queryValueCommands[name] = {func : callback, scope : scope || 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;
+			}
+
+			// 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(cmd) {
+			var t = this, o, s;
+
+			// Is hidden then return undefined
+			if (t._isHidden())
+				return;
+
+			// Registred commands
+			if (o = t.queryStateCommands[cmd]) {
+				s = o.func.call(o.scope);
+
+				// Fall though on true
+				if (s !== true)
+					return s;
+			}
+
+			// Registred commands
+			o = t.editorCommands.queryCommandState(cmd);
+			if (o !== -1)
+				return o;
+
+			// Browser commands
+			try {
+				return this.getDoc().queryCommandState(cmd);
+			} 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 = false;
+				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(content, args) {
+			var self = this, rootNode, body = self.getBody();
+
+			// Setup args object
+			args = args || {};
+			args.format = args.format || 'html';
+			args.set = true;
+			args.content = content;
+
+			// Do preprocessing
+			if (!args.no_events)
+				self.onBeforeSetContent.dispatch(self, args);
+
+			content = args.content;
+
+			// 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 && (content.length === 0 || /^\s+$/.test(content))) {
+				body.innerHTML = '<br data-mce-bogus="1" />';
+				return;
+			}
+
+			// Parse and serialize the html
+			if (args.format !== 'raw') {
+				content = new tinymce.html.Serializer({}, self.schema).serialize(
+					self.parser.parse(content)
+				);
+			}
+
+			// Set the new cleaned contents to the editor
+			args.content = tinymce.trim(content);
+			self.dom.setHTML(body, args.content);
+
+			// Do post processing
+			if (!args.no_events)
+				self.onSetContent.dispatch(self, args);
+
+			return args.content;
+		},
+
+		getContent : function(args) {
+			var self = this, content;
+
+			// Setup args object
+			args = args || {};
+			args.format = args.format || 'html';
+			args.get = true;
+
+			// Do preprocessing
+			if (!args.no_events)
+				self.onBeforeGetContent.dispatch(self, args);
+
+			// Get raw contents or by default the cleaned contents
+			if (args.format == 'raw')
+				content = self.getBody().innerHTML;
+			else
+				content = self.serializer.serialize(self.getBody(), args);
+
+			args.content = tinymce.trim(content);
+
+			// Do post processing
+			if (!args.no_events)
+				self.onGetContent.dispatch(self, args);
+
+			return args.content;
+		},
+
+		isDirty : function() {
+			var self = this;
+
+			return tinymce.trim(self.startContent) != tinymce.trim(self.getContent({format : 'raw', no_events : 1})) && !self.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 = [];
+
+			tinymce.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, dom = t.dom, 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':
+						dom.bind(t.getDoc(), k, eventHandler);
+						break;
+
+					case 'paste':
+						dom.bind(t.getBody(), k, function(e) {
+							eventHandler(e);
+						});
+						break;
+
+					case 'submit':
+					case 'reset':
+						dom.bind(t.getElement().form || DOM.getParent(t.id, 'form'), k, eventHandler);
+						break;
+
+					default:
+						dom.bind(s.content_editable ? t.getBody() : t.getDoc(), k, eventHandler);
+				}
+			});
+
+			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) {
+				dom.bind(t.getDoc(), 'DOMNodeInserted', function(e) {
+					var v;
+
+					e = e.target;
+
+					if (e.nodeType === 1 && e.nodeName === 'IMG' && (v = e.getAttribute('data-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);
+			}
+
+			// Workaround for bug, http://bugs.webkit.org/show_bug.cgi?id=12250
+			// WebKit can't even do simple things like selecting an image
+			// This also fixes so it's possible to select mceItemAnchors
+			if (tinymce.isWebKit) {
+				t.onClick.add(function(ed, e) {
+					e = e.target;
+
+					// Needs tobe the setBaseAndExtend or it will fail to select floated images
+					if (e.nodeName == 'IMG' || (e.nodeName == 'A' && dom.hasClass(e, 'mceItemAnchor'))) {
+						t.selection.getSel().setBaseAndExtent(e, 0, e, 1);
+						t.nodeChanged();
+					}
+				});
+			}
+
+			// 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
+				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
+				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)
+						dom.unbind(re.node, re.ev, re.cb);
+
+					if (!dom.hasClass(e, 'mceItemNoResize')) {
+						ev = 'resizeend';
+						cb = dom.bind(e, ev, function(e) {
+							var v;
+
+							e = e.target;
+
+							if (v = dom.getStyle(e, 'width')) {
+								dom.setAttrib(e, 'width', v.replace(/[^0-9%]+/g, ''));
+								dom.setStyle(e, 'width', '');
+							}
+
+							if (v = dom.getStyle(e, 'height')) {
+								dom.setAttrib(e, 'height', v.replace(/[^0-9%]+/g, ''));
+								dom.setStyle(e, 'height', '');
+							}
+						});
+					} else {
+						ev = 'resizestart';
+						cb = dom.bind(e, 'resizestart', Event.cancel, Event);
+					}
+
+					re = t.resizeInfo = {
+						node : e,
+						ev : ev,
+						cb : cb
+					};
+				});
+
+				t.onKeyDown.add(function(ed, e) {
+					var sel;
+
+					switch (e.keyCode) {
+						case 8:
+							sel = t.getDoc().selection;
+
+							// Fix IE control + backspace browser bug
+							if (sel.createRange && sel.createRange().item) {
+								ed.dom.remove(sel.createRange().item(0));
+								return Event.cancel(e);
+							}
+					}
+				});
+			}
+
+			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 = false;
+					t.undoManager.add();
+				};
+
+				dom.bind(t.getDoc(), 'focusout', function(e) {
+					if (!t.removed && t.undoManager.typing)
+						addUndo();
+				});
+
+				// Add undo level when contents is drag/dropped within the editor
+				t.dom.bind(t.dom.getRoot(), 'dragend', function(e) {
+					addUndo();
+				});
+
+				t.onKeyUp.add(function(ed, e) {
+					var rng, parent, bookmark;
+
+					// Fix for bug #3168, to remove odd ".." nodes from the DOM we need to get/set the HTML of the parent node.
+					if (isIE && e.keyCode == 8) {
+						rng = t.selection.getRng();
+						if (rng.parentElement) {
+							parent = rng.parentElement();
+							bookmark = t.selection.getBookmark();
+							parent.innerHTML = parent.innerHTML;
+							t.selection.moveToBookmark(bookmark);
+						}
+					}
+
+					if ((e.keyCode >= 33 && e.keyCode <= 36) || (e.keyCode >= 37 && e.keyCode <= 40) || e.keyCode == 13 || e.keyCode == 45 || e.ctrlKey)
+						addUndo();
+				});
+
+				t.onKeyDown.add(function(ed, e) {
+					var rng, parent, bookmark, keyCode = e.keyCode;
+
+					// IE has a really odd bug where the DOM might include an node that doesn't have
+					// a proper structure. If you try to access nodeValue it would throw an illegal value exception.
+					// This seems to only happen when you delete contents and it seems to be avoidable if you refresh the element
+					// after you delete contents from it. See: #3008923
+					if (isIE && keyCode == 46) {
+						rng = t.selection.getRng();
+
+						if (rng.parentElement) {
+							parent = rng.parentElement();
+
+							if (!t.undoManager.typing) {
+								t.undoManager.beforeChange();
+								t.undoManager.typing = true;
+								t.undoManager.add();
+							}
+
+							// Select next word when ctrl key is used in combo with delete
+							if (e.ctrlKey) {
+								rng.moveEnd('word', 1);
+								rng.select();
+							}
+
+							// Delete contents
+							t.selection.getSel().clear();
+
+							// Check if we are within the same parent
+							if (rng.parentElement() == parent) {
+								bookmark = t.selection.getBookmark();
+
+								try {
+									// Update the HTML and hopefully it will remove the artifacts
+									parent.innerHTML = parent.innerHTML;
+								} catch (ex) {
+									// And since it's IE it can sometimes produce an unknown runtime error
+								}
+
+								// Restore the caret position
+								t.selection.moveToBookmark(bookmark);
+							}
+
+							// Block the default delete behavior since it might be broken
+							e.preventDefault();
+							return;
+						}
+					}
+
+					// Is caracter positon keys left,right,up,down,home,end,pgdown,pgup,enter
+					if ((keyCode >= 33 && keyCode <= 36) || (keyCode >= 37 && keyCode <= 40) || keyCode == 13 || keyCode == 45) {
+						// Add position before enter key is pressed, used by IE since it still uses the default browser behavior
+						// Todo: Remove this once we normalize enter behavior on IE
+						if (tinymce.isIE && keyCode == 13)
+							t.undoManager.beforeChange();
+
+						if (t.undoManager.typing)
+							addUndo();
+
+						return;
+					}
+
+					// If key isn't shift,ctrl,alt,capslock,metakey
+					if ((keyCode < 16 || keyCode > 20) && keyCode != 224 && keyCode != 91 && !t.undoManager.typing) {
+						t.undoManager.beforeChange();
+						t.undoManager.add();
+						t.undoManager.typing = true;
+					}
+				});
+
+				t.onMouseDown.add(function() {
+					if (t.undoManager.typing)
+						addUndo();
+				});
+			}
+			
+			// Bug fix for FireFox keeping styles from end of selection instead of start.
+			if (tinymce.isGecko) {
+				function getAttributeApplyFunction() {
+					var template = t.dom.getAttribs(t.selection.getStart().cloneNode(false));
+
+					return function() {
+						var target = t.selection.getStart();
+						t.dom.removeAllAttribs(target);
+						each(template, function(attr) {
+							target.setAttributeNode(attr.cloneNode(true));
+						});
+					};
+				}
+
+				function isSelectionAcrossElements() {
+					var s = t.selection;
+
+					return !s.isCollapsed() && s.getStart() != s.getEnd();
+				}
+
+				t.onKeyPress.add(function(ed, e) {
+					var applyAttributes;
+
+					if ((e.keyCode == 8 || e.keyCode == 46) && isSelectionAcrossElements()) {
+						applyAttributes = getAttributeApplyFunction();
+						t.getDoc().execCommand('delete', false, null);
+						applyAttributes();
+
+						return Event.cancel(e);
+					}
+				});
+
+				t.dom.bind(t.getDoc(), 'cut', function(e) {
+					var applyAttributes;
+
+					if (isSelectionAcrossElements()) {
+						applyAttributes = getAttributeApplyFunction();
+						t.onKeyUp.addToTop(Event.cancel, Event);
+
+						setTimeout(function() {
+							applyAttributes();
+							t.onKeyUp.remove(Event.cancel, Event);
+						}, 0);
+					}
+				});
+			}
+		},
+
+		_isHidden : function() {
+			var s;
+
+			if (!isGecko)
+				return 0;
+
+			// Weird, wheres that cursor selection?
+			s = this.selection.getSel();
+			return (!s || !s.rangeCount || s.rangeCount == 0);
+		}
+	});
+})(tinymce);
+
+(function(tinymce) {
+	// Added for compression purposes
+	var each = tinymce.each, undefined, TRUE = true, FALSE = false;
+
+	tinymce.EditorCommands = function(editor) {
+		var dom = editor.dom,
+			selection = editor.selection,
+			commands = {state: {}, exec : {}, value : {}},
+			settings = editor.settings,
+			bookmark;
+
+		function execCommand(command, ui, value) {
+			var func;
+
+			command = command.toLowerCase();
+			if (func = commands.exec[command]) {
+				func(command, ui, value);
+				return TRUE;
+			}
+
+			return FALSE;
+		};
+
+		function queryCommandState(command) {
+			var func;
+
+			command = command.toLowerCase();
+			if (func = commands.state[command])
+				return func(command);
+
+			return -1;
+		};
+
+		function queryCommandValue(command) {
+			var func;
+
+			command = command.toLowerCase();
+			if (func = commands.value[command])
+				return func(command);
+
+			return FALSE;
+		};
+
+		function addCommands(command_list, type) {
+			type = type || 'exec';
+
+			each(command_list, function(callback, command) {
+				each(command.toLowerCase().split(','), function(command) {
+					commands[type][command] = callback;
+				});
+			});
+		};
+
+		// Expose public methods
+		tinymce.extend(this, {
+			execCommand : execCommand,
+			queryCommandState : queryCommandState,
+			queryCommandValue : queryCommandValue,
+			addCommands : addCommands
+		});
+
+		// Private methods
+
+		function execNativeCommand(command, ui, value) {
+			if (ui === undefined)
+				ui = FALSE;
+
+			if (value === undefined)
+				value = null;
+
+			return editor.getDoc().execCommand(command, ui, value);
+		};
+
+		function isFormatMatch(name) {
+			return editor.formatter.match(name);
+		};
+
+		function toggleFormat(name, value) {
+			editor.formatter.toggle(name, value ? {value : value} : undefined);
+		};
+
+		function storeSelection(type) {
+			bookmark = selection.getBookmark(type);
+		};
+
+		function restoreSelection() {
+			selection.moveToBookmark(bookmark);
+		};
+
+		// Add execCommand overrides
+		addCommands({
+			// Ignore these, added for compatibility
+			'mceResetDesignMode,mceBeginUndoLevel' : function() {},
+
+			// Add undo manager logic
+			'mceEndUndoLevel,mceAddUndoLevel' : function() {
+				editor.undoManager.add();
+			},
+
+			'Cut,Copy,Paste' : function(command) {
+				var doc = editor.getDoc(), failed;
+
+				// Try executing the native command
+				try {
+					execNativeCommand(command);
+				} catch (ex) {
+					// Command failed
+					failed = TRUE;
+				}
+
+				// Present alert message about clipboard access not being available
+				if (failed || !doc.queryCommandSupported(command)) {
+					if (tinymce.isGecko) {
+						editor.windowManager.confirm(editor.getLang('clipboard_msg'), function(state) {
+							if (state)
+								open('http://www.mozilla.org/editor/midasdemo/securityprefs.html', '_blank');
+						});
+					} else
+						editor.windowManager.alert(editor.getLang('clipboard_no_support'));
+				}
+			},
+
+			// Override unlink command
+			unlink : function(command) {
+				if (selection.isCollapsed())
+					selection.select(selection.getNode());
+
+				execNativeCommand(command);
+				selection.collapse(FALSE);
+			},
+
+			// Override justify commands to use the text formatter engine
+			'JustifyLeft,JustifyCenter,JustifyRight,JustifyFull' : function(command) {
+				var align = command.substring(7);
+
+				// Remove all other alignments first
+				each('left,center,right,full'.split(','), function(name) {
+					if (align != name)
+						editor.formatter.remove('align' + name);
+				});
+
+				toggleFormat('align' + align);
+				execCommand('mceRepaint');
+			},
+
+			// Override list commands to fix WebKit bug
+			'InsertUnorderedList,InsertOrderedList' : function(command) {
+				var listElm, listParent;
+
+				execNativeCommand(command);
+
+				// WebKit produces lists within block elements so we need to split them
+				// we will replace the native list creation logic to custom logic later on
+				// TODO: Remove this when the list creation logic is removed
+				listElm = dom.getParent(selection.getNode(), 'ol,ul');
+				if (listElm) {
+					listParent = listElm.parentNode;
+
+					// If list is within a text block then split that block
+					if (/^(H[1-6]|P|ADDRESS|PRE)$/.test(listParent.nodeName)) {
+						storeSelection();
+						dom.split(listParent, listElm);
+						restoreSelection();
+					}
+				}
+			},
+
+			// Override commands to use the text formatter engine
+			'Bold,Italic,Underline,Strikethrough,Superscript,Subscript' : function(command) {
+				toggleFormat(command);
+			},
+
+			// Override commands to use the text formatter engine
+			'ForeColor,HiliteColor,FontName' : function(command, ui, value) {
+				toggleFormat(command, value);
+			},
+
+			FontSize : function(command, ui, value) {
+				var fontClasses, fontSizes;
+
+				// Convert font size 1-7 to styles
+				if (value >= 1 && value <= 7) {
+					fontSizes = tinymce.explode(settings.font_size_style_values);
+					fontClasses = tinymce.explode(settings.font_size_classes);
+
+					if (fontClasses)
+						value = fontClasses[value - 1] || value;
+					else
+						value = fontSizes[value - 1] || value;
+				}
+
+				toggleFormat(command, value);
+			},
+
+			RemoveFormat : function(command) {
+				editor.formatter.remove(command);
+			},
+
+			mceBlockQuote : function(command) {
+				toggleFormat('blockquote');
+			},
+
+			FormatBlock : function(command, ui, value) {
+				return toggleFormat(value || 'p');
+			},
+
+			mceCleanup : function() {
+				var bookmark = selection.getBookmark();
+
+				editor.setContent(editor.getContent({cleanup : TRUE}), {cleanup : TRUE});
+
+				selection.moveToBookmark(bookmark);
+			},
+
+			mceRemoveNode : function(command, ui, value) {
+				var node = value || selection.getNode();
+
+				// Make sure that the body node isn't removed
+				if (node != editor.getBody()) {
+					storeSelection();
+					editor.dom.remove(node, TRUE);
+					restoreSelection();
+				}
+			},
+
+			mceSelectNodeDepth : function(command, ui, value) {
+				var counter = 0;
+
+				dom.getParent(selection.getNode(), function(node) {
+					if (node.nodeType == 1 && counter++ == value) {
+						selection.select(node);
+						return FALSE;
+					}
+				}, editor.getBody());
+			},
+
+			mceSelectNode : function(command, ui, value) {
+				selection.select(value);
+			},
+
+			mceInsertContent : function(command, ui, value) {
+				var caretNode, rng, rootNode, parent, node, rng, nodeRect, viewPortRect, args;
+
+				function findSuitableCaretNode(start_node, root_node) {
+					var node, walker = new tinymce.dom.TreeWalker(start_node, root_node);
+
+					while ((node = walker.current())) {
+						if ((node.nodeType == 3 && tinymce.trim(node.nodeValue).length) || node.nodeName == 'BR' || node.nodeName == 'IMG')
+							return node;
+
+						walker.prev();
+					}
+				};
+
+				args = {content: value, format: 'html'};
+				selection.onBeforeSetContent.dispatch(selection, args);
+				value = args.content;
+
+				// Add caret at end of contents if it's missing
+				if (value.indexOf('{$caret}') == -1)
+					value += '{$caret}';
+
+				// Set the content at selection to a span and replace it's contents with the value
+				selection.setContent('<span id="__mce">\uFEFF</span>', {no_events : false});
+				dom.setOuterHTML('__mce', value.replace(/\{\$caret\}/, '<span data-mce-type="bookmark" id="__mce">\uFEFF</span>'));
+
+				caretNode = dom.select('#__mce')[0];
+				rootNode = dom.getRoot();
+
+				// Move the caret into the last suitable location within the previous sibling if it's a block since the block might be split
+				if (caretNode.previousSibling && dom.isBlock(caretNode.previousSibling) || caretNode.parentNode == rootNode) {
+					node = findSuitableCaretNode(caretNode.previousSibling, rootNode);
+					if (node) {
+						if (node.nodeName == 'BR')
+							node.parentNode.insertBefore(caretNode, node);
+						else
+							dom.insertAfter(caretNode, node);
+					}
+				}
+
+				// Find caret root parent and clean it up using the serializer to avoid nesting
+				while (caretNode) {
+					if (caretNode === rootNode) {
+						// Clean up the parent element by parsing and serializing it
+						// This will remove invalid elements/attributes and fix nesting issues
+						dom.setOuterHTML(parent, 
+							new tinymce.html.Serializer({}, editor.schema).serialize(
+								new tinymce.html.DomParser({
+									remove_trailing_brs : true
+								}, editor.schema).parse(dom.getOuterHTML(parent))
+							)
+						);
+
+						break;
+					}
+
+					parent = caretNode;
+					caretNode = caretNode.parentNode;
+				}
+
+				// Find caret after cleanup and move selection to that location
+				caretNode = dom.select('#__mce')[0];
+				if (caretNode) {
+					node = findSuitableCaretNode(caretNode.previousSibling, rootNode);
+					dom.remove(caretNode);
+
+					if (node) {
+						rng = dom.createRng();
+
+						if (node.nodeType == 3) {
+							rng.setStart(node, node.length);
+							rng.setEnd(node, node.length);
+						} else {
+							if (node.nodeName == 'BR') {
+								rng.setStartBefore(node);
+								rng.setEndBefore(node);
+							} else {
+								rng.setStartAfter(node);
+								rng.setEndAfter(node);
+							}
+						}
+
+						selection.setRng(rng);
+
+						// Scroll range into view scrollIntoView on element can't be used since it will scroll the main view port as well
+						if (!tinymce.isIE) {
+							node = dom.create('span', null, '\u00a0');
+							rng.insertNode(node);
+							nodeRect = dom.getRect(node);
+							viewPortRect = dom.getViewPort(editor.getWin());
+
+							// Check if node is out side the viewport if it is then scroll to it
+							if ((nodeRect.y > viewPortRect.y + viewPortRect.h || nodeRect.y < viewPortRect.y) ||
+								(nodeRect.x > viewPortRect.x + viewPortRect.w || nodeRect.x < viewPortRect.x)) {
+								editor.getBody().scrollLeft = nodeRect.x;
+								editor.getBody().scrollTop = nodeRect.y;
+							}
+
+							dom.remove(node);
+						}
+
+						// Make sure that the selection is collapsed after we removed the node fixes a WebKit bug
+						// where WebKit would place the endContainer/endOffset at a different location than the startContainer/startOffset
+						selection.collapse(true);
+					}
+				}
+
+				selection.onSetContent.dispatch(selection, args);
+				editor.addVisual();
+			},
+
+			mceInsertRawHTML : function(command, ui, value) {
+				selection.setContent('tiny_mce_marker');
+				editor.setContent(editor.getContent().replace(/tiny_mce_marker/g, function() { return value }));
+			},
+
+			mceSetContent : function(command, ui, value) {
+				editor.setContent(value);
+			},
+
+			'Indent,Outdent' : function(command) {
+				var intentValue, indentUnit, value;
+
+				// Setup indent level
+				intentValue = settings.indentation;
+				indentUnit = /[a-z%]+$/i.exec(intentValue);
+				intentValue = parseInt(intentValue);
+
+				if (!queryCommandState('InsertUnorderedList') && !queryCommandState('InsertOrderedList')) {
+					each(selection.getSelectedBlocks(), function(element) {
+						if (command == 'outdent') {
+							value = Math.max(0, parseInt(element.style.paddingLeft || 0) - intentValue);
+							dom.setStyle(element, 'paddingLeft', value ? value + indentUnit : '');
+						} else
+							dom.setStyle(element, 'paddingLeft', (parseInt(element.style.paddingLeft || 0) + intentValue) + indentUnit);
+					});
+				} else
+					execNativeCommand(command);
+			},
+
+			mceRepaint : function() {
+				var bookmark;
+
+				if (tinymce.isGecko) {
+					try {
+						storeSelection(TRUE);
+
+						if (selection.getSel())
+							selection.getSel().selectAllChildren(editor.getBody());
+
+						selection.collapse(TRUE);
+						restoreSelection();
+					} catch (ex) {
+						// Ignore
+					}
+				}
+			},
+
+			mceToggleFormat : function(command, ui, value) {
+				editor.formatter.toggle(value);
+			},
+
+			InsertHorizontalRule : function() {
+				editor.execCommand('mceInsertContent', false, '<hr />');
+			},
+
+			mceToggleVisualAid : function() {
+				editor.hasVisual = !editor.hasVisual;
+				editor.addVisual();
+			},
+
+			mceReplaceContent : function(command, ui, value) {
+				editor.execCommand('mceInsertContent', false, selection.setContent(value.replace(/\{\$selection\}/g, selection.getContent({format : 'text'}))));
+			},
+
+			mceInsertLink : function(command, ui, value) {
+				var link = dom.getParent(selection.getNode(), 'a'), img, floatVal;
+
+				if (tinymce.is(value, 'string'))
+					value = {href : value};
+
+				// Spaces are never valid in URLs and it's a very common mistake for people to make so we fix it here.
+				value.href = value.href.replace(' ', '%20');
+
+				if (!link) {
+					// WebKit can't create links on float images for some odd reason so just remove it and restore it later
+					if (tinymce.isWebKit) {
+						img = dom.getParent(selection.getNode(), 'img');
+
+						if (img) {
+							floatVal = img.style.cssFloat;
+							img.style.cssFloat = null;
+						}
+					}
+
+					execNativeCommand('CreateLink', FALSE, 'javascript:mctmp(0);');
+
+					// Restore float value
+					if (floatVal)
+						img.style.cssFloat = floatVal;
+
+					each(dom.select("a[href='javascript:mctmp(0);']"), function(link) {
+						dom.setAttribs(link, value);
+					});
+				} else {
+					if (value.href)
+						dom.setAttribs(link, value);
+					else
+						editor.dom.remove(link, TRUE);
+				}
+			},
+			
+			selectAll : function() {
+				var root = dom.getRoot(), rng = dom.createRng();
+
+				rng.setStart(root, 0);
+				rng.setEnd(root, root.childNodes.length);
+
+				editor.selection.setRng(rng);
+			}
+		});
+
+		// Add queryCommandState overrides
+		addCommands({
+			// Override justify commands
+			'JustifyLeft,JustifyCenter,JustifyRight,JustifyFull' : function(command) {
+				return isFormatMatch('align' + command.substring(7));
+			},
+
+			'Bold,Italic,Underline,Strikethrough,Superscript,Subscript' : function(command) {
+				return isFormatMatch(command);
+			},
+
+			mceBlockQuote : function() {
+				return isFormatMatch('blockquote');
+			},
+
+			Outdent : function() {
+				var node;
+
+				if (settings.inline_styles) {
+					if ((node = dom.getParent(selection.getStart(), dom.isBlock)) && parseInt(node.style.paddingLeft) > 0)
+						return TRUE;
+
+					if ((node = dom.getParent(selection.getEnd(), dom.isBlock)) && parseInt(node.style.paddingLeft) > 0)
+						return TRUE;
+				}
+
+				return queryCommandState('InsertUnorderedList') || queryCommandState('InsertOrderedList') || (!settings.inline_styles && !!dom.getParent(selection.getNode(), 'BLOCKQUOTE'));
+			},
+
+			'InsertUnorderedList,InsertOrderedList' : function(command) {
+				return dom.getParent(selection.getNode(), command == 'insertunorderedlist' ? 'UL' : 'OL');
+			}
+		}, 'state');
+
+		// Add queryCommandValue overrides
+		addCommands({
+			'FontSize,FontName' : function(command) {
+				var value = 0, parent;
+
+				if (parent = dom.getParent(selection.getNode(), 'span')) {
+					if (command == 'fontsize')
+						value = parent.style.fontSize;
+					else
+						value = parent.style.fontFamily.replace(/, /g, ',').replace(/[\'\"]/g, '').toLowerCase();
+				}
+
+				return value;
+			}
+		}, 'value');
+
+		// Add undo manager logic
+		if (settings.custom_undo_redo) {
+			addCommands({
+				Undo : function() {
+					editor.undoManager.undo();
+				},
+
+				Redo : function() {
+					editor.undoManager.redo();
+				}
+			});
+		}
+	};
+})(tinymce);
+
+(function(tinymce) {
+	var Dispatcher = tinymce.util.Dispatcher;
+
+	tinymce.UndoManager = function(editor) {
+		var self, index = 0, data = [];
+
+		function getContent() {
+			return tinymce.trim(editor.getContent({format : 'raw', no_events : 1}));
+		};
+
+		return self = {
+			typing : false,
+
+			onAdd : new Dispatcher(self),
+
+			onUndo : new Dispatcher(self),
+
+			onRedo : new Dispatcher(self),
+
+			beforeChange : function() {
+				// Set before bookmark on previous level
+				if (data[index])
+					data[index].beforeBookmark = editor.selection.getBookmark(2, true);
+			},
+
+			add : function(level) {
+				var i, settings = editor.settings, lastLevel;
+
+				level = level || {};
+				level.content = getContent();
+
+				// Add undo level if needed
+				lastLevel = data[index];
+				if (lastLevel && lastLevel.content == level.content)
+					return null;
+
+				// Time to compress
+				if (settings.custom_undo_redo_levels) {
+					if (data.length > settings.custom_undo_redo_levels) {
+						for (i = 0; i < data.length - 1; i++)
+							data[i] = data[i + 1];
+
+						data.length--;
+						index = data.length;
+					}
+				}
+
+				// Get a non intrusive normalized bookmark
+				level.bookmark = editor.selection.getBookmark(2, true);
+
+				// Crop array if needed
+				if (index < data.length - 1)
+					data.length = index + 1;
+
+				data.push(level);
+				index = data.length - 1;
+
+				self.onAdd.dispatch(self, level);
+				editor.isNotDirty = 0;
+
+				return level;
+			},
+
+			undo : function() {
+				var level, i;
+
+				if (self.typing) {
+					self.add();
+					self.typing = false;
+				}
+
+				if (index > 0) {
+					level = data[--index];
+
+					editor.setContent(level.content, {format : 'raw'});
+					editor.selection.moveToBookmark(level.beforeBookmark);
+
+					self.onUndo.dispatch(self, level);
+				}
+
+				return level;
+			},
+
+			redo : function() {
+				var level;
+
+				if (index < data.length - 1) {
+					level = data[++index];
+
+					editor.setContent(level.content, {format : 'raw'});
+					editor.selection.moveToBookmark(level.bookmark);
+
+					self.onRedo.dispatch(self, level);
+				}
+
+				return level;
+			},
+
+			clear : function() {
+				data = [];
+				index = 0;
+				self.typing = false;
+			},
+
+			hasUndo : function() {
+				return index > 0 || this.typing;
+			},
+
+			hasRedo : function() {
+				return index < data.length - 1 && !this.typing;
+			}
+		};
+	};
+})(tinymce);
+
+(function(tinymce) {
+	// Shorten names
+	var Event = tinymce.dom.Event,
+		isIE = tinymce.isIE,
+		isGecko = tinymce.isGecko,
+		isOpera = tinymce.isOpera,
+		each = tinymce.each,
+		extend = tinymce.extend,
+		TRUE = true,
+		FALSE = false;
+
+	function cloneFormats(node) {
+		var clone, temp, inner;
+
+		do {
+			if (/^(SPAN|STRONG|B|EM|I|FONT|STRIKE|U)$/.test(node.nodeName)) {
+				if (clone) {
+					temp = node.cloneNode(false);
+					temp.appendChild(clone);
+					clone = temp;
+				} else {
+					clone = inner = node.cloneNode(false);
+				}
+
+				clone.removeAttribute('id');
+			}
+		} while (node = node.parentNode);
+
+		if (clone)
+			return {wrapper : clone, inner : inner};
+	};
+
+	// Checks if the selection/caret is at the end of the specified block element
+	function isAtEnd(rng, par) {
+		var rng2 = par.ownerDocument.createRange();
+
+		rng2.setStart(rng.endContainer, rng.endOffset);
+		rng2.setEndAfter(par);
+
+		// Get number of characters to the right of the cursor if it's zero then we are at the end and need to merge the next block element
+		return rng2.cloneContents().textContent.length == 0;
+	};
+
+	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(/[ \u00a0\t\r\n]+/g, '') == '';
+	};
+
+	function splitList(selection, dom, li) {
+		var listBlock, block;
+
+		if (isEmpty(li)) {
+			listBlock = dom.getParent(li, 'ul,ol');
+
+			if (!dom.getParent(listBlock.parentNode, 'ul,ol')) {
+				dom.split(listBlock, li);
+				block = dom.create('p', 0, '<br data-mce-bogus="1" />');
+				dom.replace(block, li);
+				selection.select(block, 1);
+			}
+
+			return FALSE;
+		}
+
+		return TRUE;
+	};
+
+	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);
+
+			if (s.forced_root_block) {
+				ed.onInit.add(t.forceRoots, t);
+				ed.onSetContent.add(t.forceRoots, t);
+				ed.onBeforeGetContent.add(t.forceRoots, t);
+				ed.onExecCommand.add(function(ed, cmd) {
+					if (cmd == 'mceInsertContent') {
+						t.forceRoots();
+						ed.nodeChanged();
+					}
+				});
+			}
+		},
+
+		setup : function() {
+			var t = this, ed = t.editor, s = ed.settings, dom = ed.dom, selection = ed.selection;
+
+			// Force root blocks when typing and when getting output
+			if (s.forced_root_block) {
+				ed.onBeforeExecCommand.add(t.forceRoots, t);
+				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;
+
+						if (e.keyCode == 13 && selection.getNode().nodeName != 'LI') {
+							selection.setContent('<br id="__" /> ', {format : 'raw'});
+							n = dom.get('__');
+							n.removeAttribute('id');
+							selection.select(n);
+							selection.collapse();
+							return Event.cancel(e);
+						}
+					});
+				}
+			}
+
+			if (s.force_p_newlines) {
+				if (!isIE) {
+					ed.onKeyPress.add(function(ed, e) {
+						if (e.keyCode == 13 && !e.shiftKey && !t.insertPara(e))
+							Event.cancel(e);
+					});
+				} else {
+					// Ungly hack to for IE to preserve the formatting when you press
+					// enter at the end of a block element with formatted contents
+					// This logic overrides the browsers default logic with
+					// custom logic that enables us to control the output
+					tinymce.addUnload(function() {
+						t._previousFormats = 0; // Fix IE leak
+					});
+
+					ed.onKeyPress.add(function(ed, e) {
+						t._previousFormats = 0;
+
+						// Clone the current formats, this will later be applied to the new block contents
+						if (e.keyCode == 13 && !e.shiftKey && ed.selection.isCollapsed() && s.keep_styles)
+							t._previousFormats = cloneFormats(ed.selection.getStart());
+					});
+
+					ed.onKeyUp.add(function(ed, e) {
+						// Let IE break the element and the wrap the new caret location in the previous formats
+						if (e.keyCode == 13 && !e.shiftKey) {
+							var parent = ed.selection.getStart(), fmt = t._previousFormats;
+
+							// Parent is an empty block
+							if (!parent.hasChildNodes() && fmt) {
+								parent = dom.getParent(parent, dom.isBlock);
+
+								if (parent && parent.nodeName != 'LI') {
+									parent.innerHTML = '';
+
+									if (t._previousFormats) {
+										parent.appendChild(fmt.wrapper);
+										fmt.inner.innerHTML = '\uFEFF';
+									} else
+										parent.innerHTML = '\uFEFF';
+
+									selection.select(parent, 1);
+									selection.collapse(true);
+									ed.getDoc().execCommand('Delete', false, null);
+									t._previousFormats = 0;
+								}
+							}
+						}
+					});
+				}
+
+				if (isGecko) {
+					ed.onKeyDown.add(function(ed, e) {
+						if ((e.keyCode == 8 || e.keyCode == 46) && !e.shiftKey)
+							t.backspaceDelete(e, e.keyCode == 8);
+					});
+				}
+			}
+
+			// Workaround for missing shift+enter support, http://bugs.webkit.org/show_bug.cgi?id=16973
+			if (tinymce.isWebKit) {
+				function insertBr(ed) {
+					var rng = selection.getRng(), br, div = dom.create('div', null, ' '), divYPos, vpHeight = dom.getViewPort(ed.getWin()).h;
+
+					// Insert BR element
+					rng.insertNode(br = dom.create('br'));
+
+					// Place caret after BR
+					rng.setStartAfter(br);
+					rng.setEndAfter(br);
+					selection.setRng(rng);
+
+					// Could not place caret after BR then insert an nbsp entity and move the caret
+					if (selection.getSel().focusNode == br.previousSibling) {
+						selection.select(dom.insertAfter(dom.doc.createTextNode('\u00a0'), br));
+						selection.collapse(TRUE);
+					}
+
+					// Create a temporary DIV after the BR and get the position as it
+					// seems like getPos() returns 0 for text nodes and BR elements.
+					dom.insertAfter(div, br);
+					divYPos = dom.getPos(div).y;
+					dom.remove(div);
+
+					// Scroll to new position, scrollIntoView can't be used due to bug: http://bugs.webkit.org/show_bug.cgi?id=16117
+					if (divYPos > vpHeight) // It is not necessary to scroll if the DIV is inside the view port.
+						ed.getWin().scrollTo(0, divYPos);
+				};
+
+				ed.onKeyPress.add(function(ed, e) {
+					if (e.keyCode == 13 && (e.shiftKey || (s.force_br_newlines && !dom.getParent(selection.getNode(), 'h1,h2,h3,h4,h5,h6,ol,ul')))) {
+						insertBr(ed);
+						Event.cancel(e);
+					}
+				});
+			}
+
+			// 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 = selection.getNode().nodeName;
+					});
+
+					ed.onKeyUp.add(function(ed, e) {
+						var bl, n = selection.getNode(), b = ed.getBody();
+
+						if (b.childNodes.length === 1 && n.nodeName == 'P') {
+							n = dom.rename(n, s.element);
+							selection.select(n);
+							selection.collapse();
+							ed.nodeChanged();
+						} else if (e.keyCode == 13 && !e.shiftKey && t.lastElm != 'P') {
+							bl = dom.getParent(n, 'p');
+
+							if (bl) {
+								dom.rename(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];
+
+				// Ignore internal elements
+				if (nx.nodeType === 1 && nx.getAttribute('data-mce-type')) {
+					bl = null;
+					continue;
+				}
+
+				// Is text or non block element
+				if (nx.nodeType === 3 || (!t.dom.isBlock(nx) && nx.nodeType !== 8 && !/^(script|mce:script|style|mce:style)$/i.test(nx.nodeName))) {
+					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 || r.setStart) {
+									// 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 {
+									// Force control range into text range
+									if (r.item) {
+										tr = d.body.createTextRange();
+										tr.moveToElementText(r.item(0));
+										r = tr;
+									}
+
+									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;
+								}
+							}
+
+							// Uses replaceChild instead of cloneNode since it removes selected attribute from option elements on IE
+							// See: http://support.microsoft.com/kb/829907
+							bl = ed.dom.create(ed.settings.forced_root_block);
+							nx.parentNode.replaceChild(bl, nx);
+							bl.appendChild(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 || r.setStart) {
+					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 || r.setStart) && (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;
+
+			ed.undoManager.beforeChange();
+
+			// 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 (n = t.dom.getParent(sb, 'li,pre')) {
+				if (n.nodeName == 'LI')
+					return splitList(ed.selection, t.dom, n);
+
+				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;
+			}
+
+			// 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);
+
+			// Remove id from after clone
+			aft.removeAttribute('id');
+
+			// Is header and cursor is at the end, then force paragraph under
+			if (/^(H[1-6])$/.test(bn) && isAtEnd(r, sb))
+				aft = ed.dom.create(se.element);
+
+			// 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;
+
+				sc = n;
+			} while ((n = n.previousSibling ? n.previousSibling : n.parentNode));
+
+			// 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;
+
+				ec = n;
+			} while ((n = n.nextSibling ? n.nextSibling : n.parentNode));
+
+			// Place first chop part into before block element
+			if (sc.nodeName == bn)
+				rb.setStart(sc, 0);
+			else
+				rb.setStartBefore(sc);
+
+			rb.setEnd(sn, so);
+			bef.appendChild(rb.cloneContents() || d.createTextNode('')); // Empty text node needed for Safari
+
+			// Place secnd chop part within new block element
+			try {
+				ra.setEndAfter(ec);
+			} catch(ex) {
+				//console.debug(s.focusNode, s.focusOffset);
+			}
+
+			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);
+			}
+
+			if (!ec.nextSibling && ec.parentNode.nodeName == bn)
+				r.setEndAfter(ec.parentNode);
+			else
+				r.setEnd(ra.endContainer, ra.endOffset);
+
+			// Delete and replace it with new block elements
+			r.deleteContents();
+
+			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;
+
+			if (aft.firstChild && aft.firstChild.nodeName == bn)
+				aft.innerHTML = aft.firstChild.innerHTML;
+
+			// Padd empty blocks
+			if (isEmpty(bef))
+				bef.innerHTML = '<br />';
+
+			function appendStyles(e, en) {
+				var nl = [], nn, n, i;
+
+				e.innerHTML = '';
+
+				// 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);
+				}
+
+				// Append style elements to aft
+				if (nl.length > 0) {
+					for (i = nl.length - 1, nn = e; i >= 0; i--)
+						nn = nn.appendChild(nl[i]);
+
+					// Padd most inner style element
+					nl[0].innerHTML = isOpera ? '\u00a0' : '<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 ? '\u00a0' : '<br />'; // Extra space for Opera so that the caret can move there
+			};
+
+			// 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);
+			}
+
+			// Normalize
+			aft.normalize();
+			bef.normalize();
+
+			function first(n) {
+				return d.createTreeWalker(n, NodeFilter.SHOW_TEXT, null, FALSE).nextNode() || n;
+			};
+
+			// 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 + 25 > 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(
+					'Element: y=' + y + ', h=' + ch + ', ' +
+					'Viewport: y=' + vp.y + ", h=" + vp.h + ', bottom=' + (vp.y + vp.h)
+				);*/
+			}
+
+			ed.undoManager.add();
+
+			return FALSE;
+		},
+
+		backspaceDelete : function(e, bs) {
+			var t = this, ed = t.editor, b = ed.getBody(), dom = ed.dom, n, se = ed.selection, r = se.getRng(), sc = r.startContainer, n, w, tn, walker;
+
+			// Delete when caret is behind a element doesn't work correctly on Gecko see #3011651
+			if (!bs && r.collapsed && sc.nodeType == 1 && r.startOffset == sc.childNodes.length) {
+				walker = new tinymce.dom.TreeWalker(sc.lastChild, sc);
+
+				// Walk the dom backwards until we find a text node
+				for (n = sc.lastChild; n; n = walker.prev()) {
+					if (n.nodeType == 3) {
+						r.setStart(n, n.nodeValue.length);
+						r.collapse(true);
+						se.setRng(r);
+						return;
+					}
+				}
+			}
+
+			// 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);
+
+							// Remove the target container
+							ed.dom.remove(sc);
+						}
+
+						return Event.cancel(e);
+					}
+				}
+			}
+		}
+	});
+})(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();
+				});
+			});
+		},
+
+		get : function(id) {
+			return this.controls[this.prefix + id] || this.controls[id];
+		},
+
+		setActive : function(id, s) {
+			var c = null;
+
+			if (c = this.get(id))
+				c.setActive(s);
+
+			return c;
+		},
+
+		setDisabled : function(id, s) {
+			var c = null;
+
+			if (c = this.get(id))
+				c.setDisabled(s);
+
+			return c;
+		},
+
+		add : function(c) {
+			var t = this;
+
+			if (c) {
+				t.controls[c.id] = c;
+				t.onAdd.dispatch(c, t);
+			}
+
+			return c;
+		},
+
+		createControl : function(n) {
+			var c, t = this, ed = t.editor;
+
+			each(ed.plugins, function(p) {
+				if (p.createControl) {
+					c = p.createControl(n, t);
+
+					if (c)
+						return false;
+				}
+			});
+
+			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) {
+						if (s.cmd)
+							ed.execCommand(s.cmd, s.ui || false, s.value);
+					};
+				}
+			});
+
+			ed.onRemove.add(function() {
+				c.destroy();
+			});
+
+			// 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);
+				});
+
+				c.onHideMenu.add(function() {
+					if (bm) {
+						ed.selection.moveToBookmark(bm);
+						bm = 0;
+					}
+				});
+			}
+
+			return t.add(c);
+		},
+
+		createListBox : function(id, s, cc) {
+			var t = this, ed = t.editor, cmd, c, cls;
+
+			if (t.get(id))
+				return null;
+
+			s.title = ed.translate(s.title);
+			s.scope = s.scope || ed;
+
+			if (!s.onselect) {
+				s.onselect = function(v) {
+					ed.execCommand(s.cmd, s.ui || false, v || s.value);
+				};
+			}
+
+			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, ed);
+			}
+
+			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;
+					});
+				});
+			}
+
+			if (c.hideMenu)
+				ed.onMouseDown.add(c.hideMenu, c);
+
+			return t.add(c);
+		},
+
+		createButton : function(id, s, cc) {
+			var t = this, ed = t.editor, o, c, cls;
+
+			if (t.get(id))
+				return null;
+
+			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);
+				};
+			}
+
+			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);
+				ed.onMouseDown.add(c.hideMenu, c);
+			} else {
+				cls = t._cls.button || tinymce.ui.Button;
+				c = new cls(id, s);
+			}
+
+			return t.add(c);
+		},
+
+		createMenuButton : function(id, s, cc) {
+			s = s || {};
+			s.menu_button = 1;
+
+			return this.createButton(id, s, cc);
+		},
+
+		createSplitButton : function(id, s, cc) {
+			var t = this, ed = t.editor, cmd, c, cls;
+
+			if (t.get(id))
+				return null;
+
+			s.title = ed.translate(s.title);
+			s.scope = s.scope || ed;
+
+			if (!s.onclick) {
+				s.onclick = function(v) {
+					ed.execCommand(s.cmd, s.ui || false, v || s.value);
+				};
+			}
+
+			if (!s.onselect) {
+				s.onselect = function(v) {
+					ed.execCommand(s.cmd, s.ui || false, v || s.value);
+				};
+			}
+
+			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));
+			ed.onMouseDown.add(c.hideMenu, c);
+
+			return c;
+		},
+
+		createColorSplitButton : function(id, s, cc) {
+			var t = this, ed = t.editor, cmd, c, cls, bm;
+
+			if (t.get(id))
+				return null;
+
+			s.title = ed.translate(s.title);
+			s.scope = s.scope || ed;
+
+			if (!s.onclick) {
+				s.onclick = function(v) {
+					if (tinymce.isIE)
+						bm = ed.selection.getBookmark(1);
+
+					ed.execCommand(s.cmd, s.ui || false, v || s.value);
+				};
+			}
+
+			if (!s.onselect) {
+				s.onselect = function(v) {
+					ed.execCommand(s.cmd, s.ui || false, v || s.value);
+				};
+			}
+
+			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);
+			ed.onMouseDown.add(c.hideMenu, c);
+
+			// Remove the menu element when the editor is removed
+			ed.onRemove.add(function() {
+				c.destroy();
+			});
+
+			// 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);
+				});
+
+				c.onHideMenu.add(function() {
+					if (bm) {
+						ed.selection.moveToBookmark(bm);
+						bm = 0;
+					}
+				});
+			}
+
+			return t.add(c);
+		},
+
+		createToolbar : function(id, s, cc) {
+			var c, t = this, cls;
+
+			id = t.prefix + id;
+			cls = cc || t._cls.toolbar || tinymce.ui.Toolbar;
+			c = new cls(id, s, t.editor);
+
+			if (t.get(id))
+				return null;
+
+			return t.add(c);
+		},
+		
+		createToolbarGroup : function(id, s, cc) {
+			var c, t = this, cls;
+			id = t.prefix + id;
+			cls = cc || this._cls.toolbarGroup || tinymce.ui.ToolbarGroup;
+			c = new cls(id, s, t.editor);
+			
+			if (t.get(id))
+				return null;
+			
+			return t.add(c);
+		},
+
+		createSeparator : function(cc) {
+			var cls = cc || this._cls.separator || tinymce.ui.Separator;
+
+			return new cls();
+		},
+
+		setControlType : function(n, c) {
+			return this._cls[n.toLowerCase()] = c;
+		},
+	
+		destroy : function() {
+			each(this.controls, function(c) {
+				c.destroy();
+			});
+
+			this.controls = null;
+		}
+	});
+})(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;
+				}
+			}
+
+			// 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;
+				}
+			});
+
+			t.features = s;
+			t.params = p;
+			t.onOpen.dispatch(t, s, p);
+
+			u = s.url || s.file;
+			u = tinymce._addVer(u);
+
+			try {
+				if (isIE && mo) {
+					w = 1;
+					window.showModalDialog(u, window, f);
+				} else
+					w = window.open(u, s.name, f);
+			} catch (ex) {
+				// Ignore
+			}
+
+			if (!w)
+				alert(t.editor.getLang('popup_blocked'));
+		},
+
+		close : function(w) {
+			w.close();
+			this.onClose.dispatch(this);
+		},
+
+		createInstance : function(cl, a, b, c, d, e) {
+			var f = tinymce.resolve(cl);
+
+			return new f(a, b, c, d, e);
+		},
+
+		confirm : function(t, cb, s, w) {
+			w = w || window;
+
+			cb.call(s || this, w.confirm(this._decode(this.editor.getLang(t, t))));
+		},
+
+		alert : function(tx, cb, s, w) {
+			var t = this;
+
+			w = w || window;
+			w.alert(t._decode(t.editor.getLang(tx, tx)));
+
+			if (cb)
+				cb.call(s || t);
+		},
+
+		resizeBy : function(dw, dh, win) {
+			win.resizeBy(dw, dh);
+		},
+
+		// Internal functions
+
+		_decode : function(s) {
+			return tinymce.DOM.decode(s).replace(/\\n/g, '\n');
+		}
+	});
+}(tinymce));
+(function(tinymce) {
+	tinymce.Formatter = function(ed) {
+		var formats = {},
+			each = tinymce.each,
+			dom = ed.dom,
+			selection = ed.selection,
+			TreeWalker = tinymce.dom.TreeWalker,
+			rangeUtils = new tinymce.dom.RangeUtils(dom),
+			isValid = ed.schema.isValidChild,
+			isBlock = dom.isBlock,
+			forcedRootBlock = ed.settings.forced_root_block,
+			nodeIndex = dom.nodeIndex,
+			INVISIBLE_CHAR = '\uFEFF',
+			MCE_ATTR_RE = /^(src|href|style)$/,
+			FALSE = false,
+			TRUE = true,
+			undefined,
+			pendingFormats = {apply : [], remove : []};
+
+		function isArray(obj) {
+			return obj instanceof Array;
+		};
+
+		function getParents(node, selector) {
+			return dom.getParents(node, selector, dom.getRoot());
+		};
+
+		function isCaretNode(node) {
+			return node.nodeType === 1 && (node.face === 'mceinline' || node.style.fontFamily === 'mceinline');
+		};
+
+		// Public functions
+
+		function get(name) {
+			return name ? formats[name] : formats;
+		};
+
+		function register(name, format) {
+			if (name) {
+				if (typeof(name) !== 'string') {
+					each(name, function(format, name) {
+						register(name, format);
+					});
+				} else {
+					// Force format into array and add it to internal collection
+					format = format.length ? format : [format];
+
+					each(format, function(format) {
+						// Set deep to false by default on selector formats this to avoid removing
+						// alignment on images inside paragraphs when alignment is changed on paragraphs
+						if (format.deep === undefined)
+							format.deep = !format.selector;
+
+						// Default to true
+						if (format.split === undefined)
+							format.split = !format.selector || format.inline;
+
+						// Default to true
+						if (format.remove === undefined && format.selector && !format.inline)
+							format.remove = 'none';
+
+						// Mark format as a mixed format inline + block level
+						if (format.selector && format.inline) {
+							format.mixed = true;
+							format.block_expand = true;
+						}
+
+						// Split classes if needed
+						if (typeof(format.classes) === 'string')
+							format.classes = format.classes.split(/\s+/);
+					});
+
+					formats[name] = format;
+				}
+			}
+		};
+
+		var getTextDecoration = function(node) {
+			var decoration;
+
+			ed.dom.getParent(node, function(n) {
+				decoration = ed.dom.getStyle(n, 'text-decoration');
+				return decoration && decoration !== 'none';
+			});
+
+			return decoration;
+		};
+
+		var processUnderlineAndColor = function(node) {
+			var textDecoration;
+			if (node.nodeType === 1 && node.parentNode && node.parentNode.nodeType === 1) {
+				textDecoration = getTextDecoration(node.parentNode);
+				if (ed.dom.getStyle(node, 'color') && textDecoration) {
+					ed.dom.setStyle(node, 'text-decoration', textDecoration);
+				} else if (ed.dom.getStyle(node, 'textdecoration') === textDecoration) {
+					ed.dom.setStyle(node, 'text-decoration', null);
+				}
+			}
+		};
+
+		function apply(name, vars, node) {
+			var formatList = get(name), format = formatList[0], bookmark, rng, i, isCollapsed = selection.isCollapsed();
+
+			function moveStart(rng) {
+				var container = rng.startContainer,
+					offset = rng.startOffset,
+					walker, node;
+
+				// Move startContainer/startOffset in to a suitable node
+				if (container.nodeType == 1 || container.nodeValue === "") {
+					container = container.nodeType == 1 ? container.childNodes[offset] : container;
+
+					// Might fail if the offset is behind the last element in it's container
+					if (container) {
+						walker = new TreeWalker(container, container.parentNode);
+						for (node = walker.current(); node; node = walker.next()) {
+							if (node.nodeType == 3 && !isWhiteSpaceNode(node)) {
+								rng.setStart(node, 0);
+								break;
+							}
+						}
+					}
+				}
+
+				return rng;
+			};
+
+			function setElementFormat(elm, fmt) {
+				fmt = fmt || format;
+
+				if (elm) {
+					each(fmt.styles, function(value, name) {
+						dom.setStyle(elm, name, replaceVars(value, vars));
+					});
+
+					each(fmt.attributes, function(value, name) {
+						dom.setAttrib(elm, name, replaceVars(value, vars));
+					});
+
+					each(fmt.classes, function(value) {
+						value = replaceVars(value, vars);
+
+						if (!dom.hasClass(elm, value))
+							dom.addClass(elm, value);
+					});
+				}
+			};
+
+			function applyRngStyle(rng) {
+				var newWrappers = [], wrapName, wrapElm;
+
+				// Setup wrapper element
+				wrapName = format.inline || format.block;
+				wrapElm = dom.create(wrapName);
+				setElementFormat(wrapElm);
+
+				rangeUtils.walk(rng, function(nodes) {
+					var currentWrapElm;
+
+					function process(node) {
+						var nodeName = node.nodeName.toLowerCase(), parentName = node.parentNode.nodeName.toLowerCase(), found;
+
+						// Stop wrapping on br elements
+						if (isEq(nodeName, 'br')) {
+							currentWrapElm = 0;
+
+							// Remove any br elements when we wrap things
+							if (format.block)
+								dom.remove(node);
+
+							return;
+						}
+
+						// If node is wrapper type
+						if (format.wrapper && matchNode(node, name, vars)) {
+							currentWrapElm = 0;
+							return;
+						}
+
+						// Can we rename the block
+						if (format.block && !format.wrapper && isTextBlock(nodeName)) {
+							node = dom.rename(node, wrapName);
+							setElementFormat(node);
+							newWrappers.push(node);
+							currentWrapElm = 0;
+							return;
+						}
+
+						// Handle selector patterns
+						if (format.selector) {
+							// Look for matching formats
+							each(formatList, function(format) {
+								// Check collapsed state if it exists
+								if ('collapsed' in format && format.collapsed !== isCollapsed) {
+									return;
+								}
+
+								if (dom.is(node, format.selector) && !isCaretNode(node)) {
+									setElementFormat(node, format);
+									found = true;
+								}
+							});
+
+							// Continue processing if a selector match wasn't found and a inline element is defined
+							if (!format.inline || found) {
+								currentWrapElm = 0;
+								return;
+							}
+						}
+
+						// Is it valid to wrap this item
+						if (isValid(wrapName, nodeName) && isValid(parentName, wrapName) &&
+								!(node.nodeType === 3 && node.nodeValue.length === 1 && node.nodeValue.charCodeAt(0) === 65279)) {
+							// Start wrapping
+							if (!currentWrapElm) {
+								// Wrap the node
+								currentWrapElm = wrapElm.cloneNode(FALSE);
+								node.parentNode.insertBefore(currentWrapElm, node);
+								newWrappers.push(currentWrapElm);
+							}
+
+							currentWrapElm.appendChild(node);
+						} else {
+							// Start a new wrapper for possible children
+							currentWrapElm = 0;
+
+							each(tinymce.grep(node.childNodes), process);
+
+							// End the last wrapper
+							currentWrapElm = 0;
+						}
+					};
+
+					// Process siblings from range
+					each(nodes, process);
+				});
+
+				// Wrap links inside as well, for example color inside a link when the wrapper is around the link
+				if (format.wrap_links === false) {
+					each(newWrappers, function(node) {
+						function process(node) {
+							var i, currentWrapElm, children;
+
+							if (node.nodeName === 'A') {
+								currentWrapElm = wrapElm.cloneNode(FALSE);
+								newWrappers.push(currentWrapElm);
+
+								children = tinymce.grep(node.childNodes);
+								for (i = 0; i < children.length; i++)
+									currentWrapElm.appendChild(children[i]);
+
+								node.appendChild(currentWrapElm);
+							}
+
+							each(tinymce.grep(node.childNodes), process);
+						};
+
+						process(node);
+					});
+				}
+
+				// Cleanup
+				each(newWrappers, function(node) {
+					var childCount;
+
+					function getChildCount(node) {
+						var count = 0;
+
+						each(node.childNodes, function(node) {
+							if (!isWhiteSpaceNode(node) && !isBookmarkNode(node))
+								count++;
+						});
+
+						return count;
+					};
+
+					function mergeStyles(node) {
+						var child, clone;
+
+						each(node.childNodes, function(node) {
+							if (node.nodeType == 1 && !isBookmarkNode(node) && !isCaretNode(node)) {
+								child = node;
+								return FALSE; // break loop
+							}
+						});
+
+						// If child was found and of the same type as the current node
+						if (child && matchName(child, format)) {
+							clone = child.cloneNode(FALSE);
+							setElementFormat(clone);
+
+							dom.replace(clone, node, TRUE);
+							dom.remove(child, 1);
+						}
+
+						return clone || node;
+					};
+
+					childCount = getChildCount(node);
+
+					// Remove empty nodes but only if there is multiple wrappers and they are not block
+					// elements so never remove single <h1></h1> since that would remove the currrent empty block element where the caret is at
+					if ((newWrappers.length > 1 || !isBlock(node)) && childCount === 0) {
+						dom.remove(node, 1);
+						return;
+					}
+
+					if (format.inline || format.wrapper) {
+						// Merges the current node with it's children of similar type to reduce the number of elements
+						if (!format.exact && childCount === 1)
+							node = mergeStyles(node);
+
+						// Remove/merge children
+						each(formatList, function(format) {
+							// Merge all children of similar type will move styles from child to parent
+							// this: <span style="color:red"><b><span style="color:red; font-size:10px">text</span></b></span>
+							// will become: <span style="color:red"><b><span style="font-size:10px">text</span></b></span>
+							each(dom.select(format.inline, node), function(child) {
+								var parent;
+
+								// When wrap_links is set to false we don't want
+								// to remove the format on children within links
+								if (format.wrap_links === false) {
+									parent = child.parentNode;
+
+									do {
+										if (parent.nodeName === 'A')
+											return;
+									} while (parent = parent.parentNode);
+								}
+
+								removeFormat(format, vars, child, format.exact ? child : null);
+							});
+						});
+
+						// Remove child if direct parent is of same type
+						if (matchNode(node.parentNode, name, vars)) {
+							dom.remove(node, 1);
+							node = 0;
+							return TRUE;
+						}
+
+						// Look for parent with similar style format
+						if (format.merge_with_parents) {
+							dom.getParent(node.parentNode, function(parent) {
+								if (matchNode(parent, name, vars)) {
+									dom.remove(node, 1);
+									node = 0;
+									return TRUE;
+								}
+							});
+						}
+
+						// Merge next and previous siblings if they are similar <b>text</b><b>text</b> becomes <b>texttext</b>
+						if (node) {
+							node = mergeSiblings(getNonWhiteSpaceSibling(node), node);
+							node = mergeSiblings(node, getNonWhiteSpaceSibling(node, TRUE));
+						}
+					}
+				});
+			};
+
+			if (format) {
+				if (node) {
+					rng = dom.createRng();
+
+					rng.setStartBefore(node);
+					rng.setEndAfter(node);
+
+					applyRngStyle(expandRng(rng, formatList));
+				} else {
+					if (!isCollapsed || !format.inline || dom.select('td.mceSelected,th.mceSelected').length) {
+						// Obtain selection node before selection is unselected by applyRngStyle()
+						var curSelNode = ed.selection.getNode();
+
+						// Apply formatting to selection
+						bookmark = selection.getBookmark();
+						applyRngStyle(expandRng(selection.getRng(TRUE), formatList));
+
+						// Colored nodes should be underlined so that the color of the underline matches the text color.
+						if (format.styles && (format.styles.color || format.styles.textDecoration)) {
+							tinymce.walk(curSelNode, processUnderlineAndColor, 'childNodes');
+							processUnderlineAndColor(curSelNode);
+						}
+
+						selection.moveToBookmark(bookmark);
+						selection.setRng(moveStart(selection.getRng(TRUE)));
+						ed.nodeChanged();
+					} else
+						performCaretAction('apply', name, vars);
+				}
+			}
+		};
+
+		function remove(name, vars, node) {
+			var formatList = get(name), format = formatList[0], bookmark, i, rng;
+
+			function moveStart(rng) {
+				var container = rng.startContainer,
+					offset = rng.startOffset,
+					walker, node, nodes, tmpNode;
+
+				// Convert text node into index if possible
+				if (container.nodeType == 3 && offset >= container.nodeValue.length - 1) {
+					container = container.parentNode;
+					offset = nodeIndex(container) + 1;
+				}
+
+				// Move startContainer/startOffset in to a suitable node
+				if (container.nodeType == 1) {
+					nodes = container.childNodes;
+					container = nodes[Math.min(offset, nodes.length - 1)];
+					walker = new TreeWalker(container);
+
+					// If offset is at end of the parent node walk to the next one
+					if (offset > nodes.length - 1)
+						walker.next();
+
+					for (node = walker.current(); node; node = walker.next()) {
+						if (node.nodeType == 3 && !isWhiteSpaceNode(node)) {
+							// IE has a "neat" feature where it moves the start node into the closest element
+							// we can avoid this by inserting an element before it and then remove it after we set the selection
+							tmpNode = dom.create('a', null, INVISIBLE_CHAR);
+							node.parentNode.insertBefore(tmpNode, node);
+
+							// Set selection and remove tmpNode
+							rng.setStart(node, 0);
+							selection.setRng(rng);
+							dom.remove(tmpNode);
+
+							return;
+						}
+					}
+				}
+			};
+
+			// Merges the styles for each node
+			function process(node) {
+				var children, i, l;
+
+				// Grab the children first since the nodelist might be changed
+				children = tinymce.grep(node.childNodes);
+
+				// Process current node
+				for (i = 0, l = formatList.length; i < l; i++) {
+					if (removeFormat(formatList[i], vars, node, node))
+						break;
+				}
+
+				// Process the children
+				if (format.deep) {
+					for (i = 0, l = children.length; i < l; i++)
+						process(children[i]);
+				}
+			};
+
+			function findFormatRoot(container) {
+				var formatRoot;
+
+				// Find format root
+				each(getParents(container.parentNode).reverse(), function(parent) {
+					var format;
+
+					// Find format root element
+					if (!formatRoot && parent.id != '_start' && parent.id != '_end') {
+						// Is the node matching the format we are looking for
+						format = matchNode(parent, name, vars);
+						if (format && format.split !== false)
+							formatRoot = parent;
+					}
+				});
+
+				return formatRoot;
+			};
+
+			function wrapAndSplit(format_root, container, target, split) {
+				var parent, clone, lastClone, firstClone, i, formatRootParent;
+
+				// Format root found then clone formats and split it
+				if (format_root) {
+					formatRootParent = format_root.parentNode;
+
+					for (parent = container.parentNode; parent && parent != formatRootParent; parent = parent.parentNode) {
+						clone = parent.cloneNode(FALSE);
+
+						for (i = 0; i < formatList.length; i++) {
+							if (removeFormat(formatList[i], vars, clone, clone)) {
+								clone = 0;
+								break;
+							}
+						}
+
+						// Build wrapper node
+						if (clone) {
+							if (lastClone)
+								clone.appendChild(lastClone);
+
+							if (!firstClone)
+								firstClone = clone;
+
+							lastClone = clone;
+						}
+					}
+
+					// Never split block elements if the format is mixed
+					if (split && (!format.mixed || !isBlock(format_root)))
+						container = dom.split(format_root, container);
+
+					// Wrap container in cloned formats
+					if (lastClone) {
+						target.parentNode.insertBefore(lastClone, target);
+						firstClone.appendChild(target);
+					}
+				}
+
+				return container;
+			};
+
+			function splitToFormatRoot(container) {
+				return wrapAndSplit(findFormatRoot(container), container, container, true);
+			};
+
+			function unwrap(start) {
+				var node = dom.get(start ? '_start' : '_end'),
+					out = node[start ? 'firstChild' : 'lastChild'];
+
+				// If the end is placed within the start the result will be removed
+				// So this checks if the out node is a bookmark node if it is it
+				// checks for another more suitable node
+				if (isBookmarkNode(out))
+					out = out[start ? 'firstChild' : 'lastChild'];
+
+				dom.remove(node, true);
+
+				return out;
+			};
+
+			function removeRngStyle(rng) {
+				var startContainer, endContainer;
+
+				rng = expandRng(rng, formatList, TRUE);
+
+				if (format.split) {
+					startContainer = getContainer(rng, TRUE);
+					endContainer = getContainer(rng);
+
+					if (startContainer != endContainer) {
+						// Wrap start/end nodes in span element since these might be cloned/moved
+						startContainer = wrap(startContainer, 'span', {id : '_start', 'data-mce-type' : 'bookmark'});
+						endContainer = wrap(endContainer, 'span', {id : '_end', 'data-mce-type' : 'bookmark'});
+
+						// Split start/end
+						splitToFormatRoot(startContainer);
+						splitToFormatRoot(endContainer);
+
+						// Unwrap start/end to get real elements again
+						startContainer = unwrap(TRUE);
+						endContainer = unwrap();
+					} else
+						startContainer = endContainer = splitToFormatRoot(startContainer);
+
+					// Update range positions since they might have changed after the split operations
+					rng.startContainer = startContainer.parentNode;
+					rng.startOffset = nodeIndex(startContainer);
+					rng.endContainer = endContainer.parentNode;
+					rng.endOffset = nodeIndex(endContainer) + 1;
+				}
+
+				// Remove items between start/end
+				rangeUtils.walk(rng, function(nodes) {
+					each(nodes, function(node) {
+						process(node);
+
+						// Remove parent span if it only contains text-decoration: underline, yet a parent node is also underlined.
+						if (node.nodeType === 1 && ed.dom.getStyle(node, 'text-decoration') === 'underline' && node.parentNode && getTextDecoration(node.parentNode) === 'underline') {
+							removeFormat({'deep': false, 'exact': true, 'inline': 'span', 'styles': {'textDecoration' : 'underline'}}, null, node);
+						}
+					});
+				});
+			};
+
+			// Handle node
+			if (node) {
+				rng = dom.createRng();
+				rng.setStartBefore(node);
+				rng.setEndAfter(node);
+				removeRngStyle(rng);
+				return;
+			}
+
+			if (!selection.isCollapsed() || !format.inline || dom.select('td.mceSelected,th.mceSelected').length) {
+				bookmark = selection.getBookmark();
+				removeRngStyle(selection.getRng(TRUE));
+				selection.moveToBookmark(bookmark);
+
+				// Check if start element still has formatting then we are at: "<b>text|</b>text" and need to move the start into the next text node
+				if (match(name, vars, selection.getStart())) {
+					moveStart(selection.getRng(true));
+				}
+
+				ed.nodeChanged();
+			} else
+				performCaretAction('remove', name, vars);
+		};
+
+		function toggle(name, vars, node) {
+			var fmt = get(name);
+
+			if (match(name, vars, node) && (!('toggle' in fmt[0]) || fmt[0]['toggle']))
+				remove(name, vars, node);
+			else
+				apply(name, vars, node);
+		};
+
+		function matchNode(node, name, vars, similar) {
+			var formatList = get(name), format, i, classes;
+
+			function matchItems(node, format, item_name) {
+				var key, value, items = format[item_name], i;
+
+				// Check all items
+				if (items) {
+					// Non indexed object
+					if (items.length === undefined) {
+						for (key in items) {
+							if (items.hasOwnProperty(key)) {
+								if (item_name === 'attributes')
+									value = dom.getAttrib(node, key);
+								else
+									value = getStyle(node, key);
+
+								if (similar && !value && !format.exact)
+									return;
+
+								if ((!similar || format.exact) && !isEq(value, replaceVars(items[key], vars)))
+									return;
+							}
+						}
+					} else {
+						// Only one match needed for indexed arrays
+						for (i = 0; i < items.length; i++) {
+							if (item_name === 'attributes' ? dom.getAttrib(node, items[i]) : getStyle(node, items[i]))
+								return format;
+						}
+					}
+				}
+
+				return format;
+			};
+
+			if (formatList && node) {
+				// Check each format in list
+				for (i = 0; i < formatList.length; i++) {
+					format = formatList[i];
+
+					// Name name, attributes, styles and classes
+					if (matchName(node, format) && matchItems(node, format, 'attributes') && matchItems(node, format, 'styles')) {
+						// Match classes
+						if (classes = format.classes) {
+							for (i = 0; i < classes.length; i++) {
+								if (!dom.hasClass(node, classes[i]))
+									return;
+							}
+						}
+
+						return format;
+					}
+				}
+			}
+		};
+
+		function match(name, vars, node) {
+			var startNode, i;
+
+			function matchParents(node) {
+				// Find first node with similar format settings
+				node = dom.getParent(node, function(node) {
+					return !!matchNode(node, name, vars, true);
+				});
+
+				// Do an exact check on the similar format element
+				return matchNode(node, name, vars);
+			};
+
+			// Check specified node
+			if (node)
+				return matchParents(node);
+
+			// Check pending formats
+			if (selection.isCollapsed()) {
+				for (i = pendingFormats.apply.length - 1; i >= 0; i--) {
+					if (pendingFormats.apply[i].name == name)
+						return true;
+				}
+
+				for (i = pendingFormats.remove.length - 1; i >= 0; i--) {
+					if (pendingFormats.remove[i].name == name)
+						return false;
+				}
+
+				return matchParents(selection.getNode());
+			}
+
+			// Check selected node
+			node = selection.getNode();
+			if (matchParents(node))
+				return TRUE;
+
+			// Check start node if it's different
+			startNode = selection.getStart();
+			if (startNode != node) {
+				if (matchParents(startNode))
+					return TRUE;
+			}
+
+			return FALSE;
+		};
+
+		function matchAll(names, vars) {
+			var startElement, matchedFormatNames = [], checkedMap = {}, i, ni, name;
+
+			// If the selection is collapsed then check pending formats
+			if (selection.isCollapsed()) {
+				for (ni = 0; ni < names.length; ni++) {
+					// If the name is to be removed, then stop it from being added
+					for (i = pendingFormats.remove.length - 1; i >= 0; i--) {
+						name = names[ni];
+
+						if (pendingFormats.remove[i].name == name) {
+							checkedMap[name] = true;
+							break;
+						}
+					}
+				}
+
+				// If the format is to be applied
+				for (i = pendingFormats.apply.length - 1; i >= 0; i--) {
+					for (ni = 0; ni < names.length; ni++) {
+						name = names[ni];
+
+						if (!checkedMap[name] && pendingFormats.apply[i].name == name) {
+							checkedMap[name] = true;
+							matchedFormatNames.push(name);
+						}
+					}
+				}
+			}
+
+			// Check start of selection for formats
+			startElement = selection.getStart();
+			dom.getParent(startElement, function(node) {
+				var i, name;
+
+				for (i = 0; i < names.length; i++) {
+					name = names[i];
+
+					if (!checkedMap[name] && matchNode(node, name, vars)) {
+						checkedMap[name] = true;
+						matchedFormatNames.push(name);
+					}
+				}
+			});
+
+			return matchedFormatNames;
+		};
+
+		function canApply(name) {
+			var formatList = get(name), startNode, parents, i, x, selector;
+
+			if (formatList) {
+				startNode = selection.getStart();
+				parents = getParents(startNode);
+
+				for (x = formatList.length - 1; x >= 0; x--) {
+					selector = formatList[x].selector;
+
+					// Format is not selector based, then always return TRUE
+					if (!selector)
+						return TRUE;
+
+					for (i = parents.length - 1; i >= 0; i--) {
+						if (dom.is(parents[i], selector))
+							return TRUE;
+					}
+				}
+			}
+
+			return FALSE;
+		};
+
+		// Expose to public
+		tinymce.extend(this, {
+			get : get,
+			register : register,
+			apply : apply,
+			remove : remove,
+			toggle : toggle,
+			match : match,
+			matchAll : matchAll,
+			matchNode : matchNode,
+			canApply : canApply
+		});
+
+		// Private functions
+
+		function matchName(node, format) {
+			// Check for inline match
+			if (isEq(node, format.inline))
+				return TRUE;
+
+			// Check for block match
+			if (isEq(node, format.block))
+				return TRUE;
+
+			// Check for selector match
+			if (format.selector)
+				return dom.is(node, format.selector);
+		};
+
+		function isEq(str1, str2) {
+			str1 = str1 || '';
+			str2 = str2 || '';
+
+			str1 = '' + (str1.nodeName || str1);
+			str2 = '' + (str2.nodeName || str2);
+
+			return str1.toLowerCase() == str2.toLowerCase();
+		};
+
+		function getStyle(node, name) {
+			var styleVal = dom.getStyle(node, name);
+
+			// Force the format to hex
+			if (name == 'color' || name == 'backgroundColor')
+				styleVal = dom.toHex(styleVal);
+
+			// Opera will return bold as 700
+			if (name == 'fontWeight' && styleVal == 700)
+				styleVal = 'bold';
+
+			return '' + styleVal;
+		};
+
+		function replaceVars(value, vars) {
+			if (typeof(value) != "string")
+				value = value(vars);
+			else if (vars) {
+				value = value.replace(/%(\w+)/g, function(str, name) {
+					return vars[name] || str;
+				});
+			}
+
+			return value;
+		};
+
+		function isWhiteSpaceNode(node) {
+			return node && node.nodeType === 3 && /^([\s\r\n]+|)$/.test(node.nodeValue);
+		};
+
+		function wrap(node, name, attrs) {
+			var wrapper = dom.create(name, attrs);
+
+			node.parentNode.insertBefore(wrapper, node);
+			wrapper.appendChild(node);
+
+			return wrapper;
+		};
+
+		function expandRng(rng, format, remove) {
+			var startContainer = rng.startContainer,
+				startOffset = rng.startOffset,
+				endContainer = rng.endContainer,
+				endOffset = rng.endOffset, sibling, lastIdx, leaf;
+
+			// This function walks up the tree if there is no siblings before/after the node
+			function findParentContainer(container, child_name, sibling_name, root) {
+				var parent, child;
+
+				root = root || dom.getRoot();
+
+				for (;;) {
+					// Check if we can move up are we at root level or body level
+					parent = container.parentNode;
+
+					// Stop expanding on block elements or root depending on format
+					if (parent == root || (!format[0].block_expand && isBlock(parent)))
+						return container;
+
+					for (sibling = parent[child_name]; sibling && sibling != container; sibling = sibling[sibling_name]) {
+						if (sibling.nodeType == 1 && !isBookmarkNode(sibling))
+							return container;
+
+						if (sibling.nodeType == 3 && !isWhiteSpaceNode(sibling))
+							return container;
+					}
+
+					container = container.parentNode;
+				}
+
+				return container;
+			};
+
+			// This function walks down the tree to find the leaf at the selection.
+			// The offset is also returned as if node initially a leaf, the offset may be in the middle of the text node.
+			function findLeaf(node, offset) {
+				if (offset === undefined)
+					offset = node.nodeType === 3 ? node.length : node.childNodes.length;
+				while (node && node.hasChildNodes()) {
+					node = node.childNodes[offset];
+					if (node)
+						offset = node.nodeType === 3 ? node.length : node.childNodes.length;
+				}
+				return { node: node, offset: offset };
+			}
+
+			// If index based start position then resolve it
+			if (startContainer.nodeType == 1 && startContainer.hasChildNodes()) {
+				lastIdx = startContainer.childNodes.length - 1;
+				startContainer = startContainer.childNodes[startOffset > lastIdx ? lastIdx : startOffset];
+
+				if (startContainer.nodeType == 3)
+					startOffset = 0;
+			}
+
+			// If index based end position then resolve it
+			if (endContainer.nodeType == 1 && endContainer.hasChildNodes()) {
+				lastIdx = endContainer.childNodes.length - 1;
+				endContainer = endContainer.childNodes[endOffset > lastIdx ? lastIdx : endOffset - 1];
+
+				if (endContainer.nodeType == 3)
+					endOffset = endContainer.nodeValue.length;
+			}
+
+			// Exclude bookmark nodes if possible
+			if (isBookmarkNode(startContainer.parentNode))
+				startContainer = startContainer.parentNode;
+
+			if (isBookmarkNode(startContainer))
+				startContainer = startContainer.nextSibling || startContainer;
+
+			if (isBookmarkNode(endContainer.parentNode)) {
+				endOffset = dom.nodeIndex(endContainer);
+				endContainer = endContainer.parentNode;
+			}
+
+			if (isBookmarkNode(endContainer) && endContainer.previousSibling) {
+				endContainer = endContainer.previousSibling;
+				endOffset = endContainer.length;
+			}
+
+			if (format[0].inline) {
+				// Avoid applying formatting to a trailing space.
+				leaf = findLeaf(endContainer, endOffset);
+				if (leaf.node) {
+					while (leaf.node && leaf.offset === 0 && leaf.node.previousSibling)
+						leaf = findLeaf(leaf.node.previousSibling);
+
+					if (leaf.node && leaf.offset > 0 && leaf.node.nodeType === 3 &&
+							leaf.node.nodeValue.charAt(leaf.offset - 1) === ' ') {
+
+						if (leaf.offset > 1) {
+							endContainer = leaf.node;
+							endContainer.splitText(leaf.offset - 1);
+						} else if (leaf.node.previousSibling) {
+							endContainer = leaf.node.previousSibling;
+						}
+					}
+				}
+			}
+			
+			// Move start/end point up the tree if the leaves are sharp and if we are in different containers
+			// Example * becomes !: !<p><b><i>*text</i><i>text*</i></b></p>!
+			// This will reduce the number of wrapper elements that needs to be created
+			// Move start point up the tree
+			if (format[0].inline || format[0].block_expand) {
+				startContainer = findParentContainer(startContainer, 'firstChild', 'nextSibling');
+				endContainer = findParentContainer(endContainer, 'lastChild', 'previousSibling');
+			}
+
+			// Expand start/end container to matching selector
+			if (format[0].selector && format[0].expand !== FALSE && !format[0].inline) {
+				function findSelectorEndPoint(container, sibling_name) {
+					var parents, i, y, curFormat;
+
+					if (container.nodeType == 3 && container.nodeValue.length == 0 && container[sibling_name])
+						container = container[sibling_name];
+
+					parents = getParents(container);
+					for (i = 0; i < parents.length; i++) {
+						for (y = 0; y < format.length; y++) {
+							curFormat = format[y];
+
+							// If collapsed state is set then skip formats that doesn't match that
+							if ("collapsed" in curFormat && curFormat.collapsed !== rng.collapsed)
+								continue;
+
+							if (dom.is(parents[i], curFormat.selector))
+								return parents[i];
+						}
+					}
+
+					return container;
+				};
+
+				// Find new startContainer/endContainer if there is better one
+				startContainer = findSelectorEndPoint(startContainer, 'previousSibling');
+				endContainer = findSelectorEndPoint(endContainer, 'nextSibling');
+			}
+
+			// Expand start/end container to matching block element or text node
+			if (format[0].block || format[0].selector) {
+				function findBlockEndPoint(container, sibling_name, sibling_name2) {
+					var node;
+
+					// Expand to block of similar type
+					if (!format[0].wrapper)
+						node = dom.getParent(container, format[0].block);
+
+					// Expand to first wrappable block element or any block element
+					if (!node)
+						node = dom.getParent(container.nodeType == 3 ? container.parentNode : container, isBlock);
+
+					// Exclude inner lists from wrapping
+					if (node && format[0].wrapper)
+						node = getParents(node, 'ul,ol').reverse()[0] || node;
+
+					// Didn't find a block element look for first/last wrappable element
+					if (!node) {
+						node = container;
+
+						while (node[sibling_name] && !isBlock(node[sibling_name])) {
+							node = node[sibling_name];
+
+							// Break on BR but include it will be removed later on
+							// we can't remove it now since we need to check if it can be wrapped
+							if (isEq(node, 'br'))
+								break;
+						}
+					}
+
+					return node || container;
+				};
+
+				// Find new startContainer/endContainer if there is better one
+				startContainer = findBlockEndPoint(startContainer, 'previousSibling');
+				endContainer = findBlockEndPoint(endContainer, 'nextSibling');
+
+				// Non block element then try to expand up the leaf
+				if (format[0].block) {
+					if (!isBlock(startContainer))
+						startContainer = findParentContainer(startContainer, 'firstChild', 'nextSibling');
+
+					if (!isBlock(endContainer))
+						endContainer = findParentContainer(endContainer, 'lastChild', 'previousSibling');
+				}
+			}
+
+			// Setup index for startContainer
+			if (startContainer.nodeType == 1) {
+				startOffset = nodeIndex(startContainer);
+				startContainer = startContainer.parentNode;
+			}
+
+			// Setup index for endContainer
+			if (endContainer.nodeType == 1) {
+				endOffset = nodeIndex(endContainer) + 1;
+				endContainer = endContainer.parentNode;
+			}
+
+			// Return new range like object
+			return {
+				startContainer : startContainer,
+				startOffset : startOffset,
+				endContainer : endContainer,
+				endOffset : endOffset
+			};
+		}
+
+		function removeFormat(format, vars, node, compare_node) {
+			var i, attrs, stylesModified;
+
+			// Check if node matches format
+			if (!matchName(node, format))
+				return FALSE;
+
+			// Should we compare with format attribs and styles
+			if (format.remove != 'all') {
+				// Remove styles
+				each(format.styles, function(value, name) {
+					value = replaceVars(value, vars);
+
+					// Indexed array
+					if (typeof(name) === 'number') {
+						name = value;
+						compare_node = 0;
+					}
+
+					if (!compare_node || isEq(getStyle(compare_node, name), value))
+						dom.setStyle(node, name, '');
+
+					stylesModified = 1;
+				});
+
+				// Remove style attribute if it's empty
+				if (stylesModified && dom.getAttrib(node, 'style') == '') {
+					node.removeAttribute('style');
+					node.removeAttribute('data-mce-style');
+				}
+
+				// Remove attributes
+				each(format.attributes, function(value, name) {
+					var valueOut;
+
+					value = replaceVars(value, vars);
+
+					// Indexed array
+					if (typeof(name) === 'number') {
+						name = value;
+						compare_node = 0;
+					}
+
+					if (!compare_node || isEq(dom.getAttrib(compare_node, name), value)) {
+						// Keep internal classes
+						if (name == 'class') {
+							value = dom.getAttrib(node, name);
+							if (value) {
+								// Build new class value where everything is removed except the internal prefixed classes
+								valueOut = '';
+								each(value.split(/\s+/), function(cls) {
+									if (/mce\w+/.test(cls))
+										valueOut += (valueOut ? ' ' : '') + cls;
+								});
+
+								// We got some internal classes left
+								if (valueOut) {
+									dom.setAttrib(node, name, valueOut);
+									return;
+								}
+							}
+						}
+
+						// IE6 has a bug where the attribute doesn't get removed correctly
+						if (name == "class")
+							node.removeAttribute('className');
+
+						// Remove mce prefixed attributes
+						if (MCE_ATTR_RE.test(name))
+							node.removeAttribute('data-mce-' + name);
+
+						node.removeAttribute(name);
+					}
+				});
+
+				// Remove classes
+				each(format.classes, function(value) {
+					value = replaceVars(value, vars);
+
+					if (!compare_node || dom.hasClass(compare_node, value))
+						dom.removeClass(node, value);
+				});
+
+				// Check for non internal attributes
+				attrs = dom.getAttribs(node);
+				for (i = 0; i < attrs.length; i++) {
+					if (attrs[i].nodeName.indexOf('_') !== 0)
+						return FALSE;
+				}
+			}
+
+			// Remove the inline child if it's empty for example <b> or <span>
+			if (format.remove != 'none') {
+				removeNode(node, format);
+				return TRUE;
+			}
+		};
+
+		function removeNode(node, format) {
+			var parentNode = node.parentNode, rootBlockElm;
+
+			if (format.block) {
+				if (!forcedRootBlock) {
+					function find(node, next, inc) {
+						node = getNonWhiteSpaceSibling(node, next, inc);
+
+						return !node || (node.nodeName == 'BR' || isBlock(node));
+					};
+
+					// Append BR elements if needed before we remove the block
+					if (isBlock(node) && !isBlock(parentNode)) {
+						if (!find(node, FALSE) && !find(node.firstChild, TRUE, 1))
+							node.insertBefore(dom.create('br'), node.firstChild);
+
+						if (!find(node, TRUE) && !find(node.lastChild, FALSE, 1))
+							node.appendChild(dom.create('br'));
+					}
+				} else {
+					// Wrap the block in a forcedRootBlock if we are at the root of document
+					if (parentNode == dom.getRoot()) {
+						if (!format.list_block || !isEq(node, format.list_block)) {
+							each(tinymce.grep(node.childNodes), function(node) {
+								if (isValid(forcedRootBlock, node.nodeName.toLowerCase())) {
+									if (!rootBlockElm)
+										rootBlockElm = wrap(node, forcedRootBlock);
+									else
+										rootBlockElm.appendChild(node);
+								} else
+									rootBlockElm = 0;
+							});
+						}
+					}
+				}
+			}
+
+			// Never remove nodes that isn't the specified inline element if a selector is specified too
+			if (format.selector && format.inline && !isEq(format.inline, node))
+				return;
+
+			dom.remove(node, 1);
+		};
+
+		function getNonWhiteSpaceSibling(node, next, inc) {
+			if (node) {
+				next = next ? 'nextSibling' : 'previousSibling';
+
+				for (node = inc ? node : node[next]; node; node = node[next]) {
+					if (node.nodeType == 1 || !isWhiteSpaceNode(node))
+						return node;
+				}
+			}
+		};
+
+		function isBookmarkNode(node) {
+			return node && node.nodeType == 1 && node.getAttribute('data-mce-type') == 'bookmark';
+		};
+
+		function mergeSiblings(prev, next) {
+			var marker, sibling, tmpSibling;
+
+			function compareElements(node1, node2) {
+				// Not the same name
+				if (node1.nodeName != node2.nodeName)
+					return FALSE;
+
+				function getAttribs(node) {
+					var attribs = {};
+
+					each(dom.getAttribs(node), function(attr) {
+						var name = attr.nodeName.toLowerCase();
+
+						// Don't compare internal attributes or style
+						if (name.indexOf('_') !== 0 && name !== 'style')
+							attribs[name] = dom.getAttrib(node, name);
+					});
+
+					return attribs;
+				};
+
+				function compareObjects(obj1, obj2) {
+					var value, name;
+
+					for (name in obj1) {
+						// Obj1 has item obj2 doesn't have
+						if (obj1.hasOwnProperty(name)) {
+							value = obj2[name];
+
+							// Obj2 doesn't have obj1 item
+							if (value === undefined)
+								return FALSE;
+
+							// Obj2 item has a different value
+							if (obj1[name] != value)
+								return FALSE;
+
+							// Delete similar value
+							delete obj2[name];
+						}
+					}
+
+					// Check if obj 2 has something obj 1 doesn't have
+					for (name in obj2) {
+						// Obj2 has item obj1 doesn't have
+						if (obj2.hasOwnProperty(name))
+							return FALSE;
+					}
+
+					return TRUE;
+				};
+
+				// Attribs are not the same
+				if (!compareObjects(getAttribs(node1), getAttribs(node2)))
+					return FALSE;
+
+				// Styles are not the same
+				if (!compareObjects(dom.parseStyle(dom.getAttrib(node1, 'style')), dom.parseStyle(dom.getAttrib(node2, 'style'))))
+					return FALSE;
+
+				return TRUE;
+			};
+
+			// Check if next/prev exists and that they are elements
+			if (prev && next) {
+				function findElementSibling(node, sibling_name) {
+					for (sibling = node; sibling; sibling = sibling[sibling_name]) {
+						if (sibling.nodeType == 3 && sibling.nodeValue.length !== 0)
+							return node;
+
+						if (sibling.nodeType == 1 && !isBookmarkNode(sibling))
+							return sibling;
+					}
+
+					return node;
+				};
+
+				// If previous sibling is empty then jump over it
+				prev = findElementSibling(prev, 'previousSibling');
+				next = findElementSibling(next, 'nextSibling');
+
+				// Compare next and previous nodes
+				if (compareElements(prev, next)) {
+					// Append nodes between
+					for (sibling = prev.nextSibling; sibling && sibling != next;) {
+						tmpSibling = sibling;
+						sibling = sibling.nextSibling;
+						prev.appendChild(tmpSibling);
+					}
+
+					// Remove next node
+					dom.remove(next);
+
+					// Move children into prev node
+					each(tinymce.grep(next.childNodes), function(node) {
+						prev.appendChild(node);
+					});
+
+					return prev;
+				}
+			}
+
+			return next;
+		};
+
+		function isTextBlock(name) {
+			return /^(h[1-6]|p|div|pre|address|dl|dt|dd)$/.test(name);
+		};
+
+		function getContainer(rng, start) {
+			var container, offset, lastIdx;
+
+			container = rng[start ? 'startContainer' : 'endContainer'];
+			offset = rng[start ? 'startOffset' : 'endOffset'];
+
+			if (container.nodeType == 1) {
+				lastIdx = container.childNodes.length - 1;
+
+				if (!start && offset)
+					offset--;
+
+				container = container.childNodes[offset > lastIdx ? lastIdx : offset];
+			}
+
+			return container;
+		};
+
+		function performCaretAction(type, name, vars) {
+			var i, currentPendingFormats = pendingFormats[type],
+				otherPendingFormats = pendingFormats[type == 'apply' ? 'remove' : 'apply'];
+
+			function hasPending() {
+				return pendingFormats.apply.length || pendingFormats.remove.length;
+			};
+
+			function resetPending() {
+				pendingFormats.apply = [];
+				pendingFormats.remove = [];
+			};
+
+			function perform(caret_node) {
+				// Apply pending formats
+				each(pendingFormats.apply.reverse(), function(item) {
+					apply(item.name, item.vars, caret_node);
+
+					// Colored nodes should be underlined so that the color of the underline matches the text color.
+					if (item.name === 'forecolor' && item.vars.value)
+						processUnderlineAndColor(caret_node.parentNode);
+				});
+
+				// Remove pending formats
+				each(pendingFormats.remove.reverse(), function(item) {
+					remove(item.name, item.vars, caret_node);
+				});
+
+				dom.remove(caret_node, 1);
+				resetPending();
+			};
+
+			// Check if it already exists then ignore it
+			for (i = currentPendingFormats.length - 1; i >= 0; i--) {
+				if (currentPendingFormats[i].name == name)
+					return;
+			}
+
+			currentPendingFormats.push({name : name, vars : vars});
+
+			// Check if it's in the other type, then remove it
+			for (i = otherPendingFormats.length - 1; i >= 0; i--) {
+				if (otherPendingFormats[i].name == name)
+					otherPendingFormats.splice(i, 1);
+			}
+
+			// Pending apply or remove formats
+			if (hasPending()) {
+				ed.getDoc().execCommand('FontName', false, 'mceinline');
+				pendingFormats.lastRng = selection.getRng();
+
+				// IE will convert the current word
+				each(dom.select('font,span'), function(node) {
+					var bookmark;
+
+					if (isCaretNode(node)) {
+						bookmark = selection.getBookmark();
+						perform(node);
+						selection.moveToBookmark(bookmark);
+						ed.nodeChanged();
+					}
+				});
+
+				// Only register listeners once if we need to
+				if (!pendingFormats.isListening && hasPending()) {
+					pendingFormats.isListening = true;
+
+					each('onKeyDown,onKeyUp,onKeyPress,onMouseUp'.split(','), function(event) {
+						ed[event].addToTop(function(ed, e) {
+							// Do we have pending formats and is the selection moved has moved
+							if (hasPending() && !tinymce.dom.RangeUtils.compareRanges(pendingFormats.lastRng, selection.getRng())) {
+								each(dom.select('font,span'), function(node) {
+									var textNode, rng;
+
+									// Look for marker
+									if (isCaretNode(node)) {
+										textNode = node.firstChild;
+
+										if (textNode) {
+											perform(node);
+
+											rng = dom.createRng();
+											rng.setStart(textNode, textNode.nodeValue.length);
+											rng.setEnd(textNode, textNode.nodeValue.length);
+											selection.setRng(rng);
+											ed.nodeChanged();
+										} else
+											dom.remove(node);
+									}
+								});
+
+								// Always unbind and clear pending styles on keyup
+								if (e.type == 'keyup' || e.type == 'mouseup')
+									resetPending();
+							}
+						});
+					});
+				}
+			}
+		};
+	};
+})(tinymce);
+
+tinymce.onAddEditor.add(function(tinymce, ed) {
+	var filters, fontSizes, dom, settings = ed.settings;
+
+	if (settings.inline_styles) {
+		fontSizes = tinymce.explode(settings.font_size_style_values);
+
+		function replaceWithSpan(node, styles) {
+			tinymce.each(styles, function(value, name) {
+				if (value)
+					dom.setStyle(node, name, value);
+			});
+
+			dom.rename(node, 'span');
+		};
+
+		filters = {
+			font : function(dom, node) {
+				replaceWithSpan(node, {
+					backgroundColor : node.style.backgroundColor,
+					color : node.color,
+					fontFamily : node.face,
+					fontSize : fontSizes[parseInt(node.size) - 1]
+				});
+			},
+
+			u : function(dom, node) {
+				replaceWithSpan(node, {
+					textDecoration : 'underline'
+				});
+			},
+
+			strike : function(dom, node) {
+				replaceWithSpan(node, {
+					textDecoration : 'line-through'
+				});
+			}
+		};
+
+		function convert(editor, params) {
+			dom = editor.dom;
+
+			if (settings.convert_fonts_to_spans) {
+				tinymce.each(dom.select('font,u,strike', params.node), function(node) {
+					filters[node.nodeName.toLowerCase()](ed.dom, node);
+				});
+			}
+		};
+
+		ed.onPreProcess.add(convert);
+		ed.onSetContent.add(convert);
+
+		ed.onInit.add(function() {
+			ed.selection.onSetContent.add(convert);
+		});
+	}
+});
+
diff -x .svn -aruN 0.7.24.src/e107_handlers/tiny_mce/utils/editable_selects.js 0.7.26.src/e107_handlers/tiny_mce/utils/editable_selects.js
--- 0.7.24.src/e107_handlers/tiny_mce/utils/editable_selects.js	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_handlers/tiny_mce/utils/editable_selects.js	2010-10-09 17:21:36.000000000 -0500
@@ -1,69 +1,70 @@
-/**
- * $Id: editable_selects.js 11346 2010-02-17 18:56:14Z secretr $
- *
- * Makes select boxes editable.
- *
- * @author Moxiecode
- * @copyright Copyright  2004-2008, Moxiecode Systems AB, All rights reserved.
- */
-
-var TinyMCE_EditableSelects = {
-	editSelectElm : null,
-
-	init : function() {
-		var nl = document.getElementsByTagName("select"), i, d = document, o;
-
-		for (i=0; i<nl.length; i++) {
-			if (nl[i].className.indexOf('mceEditableSelect') != -1) {
-				o = new Option('(value)', '__mce_add_custom__');
-
-				o.className = 'mceAddSelectValue';
-
-				nl[i].options[nl[i].options.length] = o;
-				nl[i].onchange = TinyMCE_EditableSelects.onChangeEditableSelect;
-			}
-		}
-	},
-
-	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");
-			ne.id = se.id + "_custom";
-			ne.name = se.name + "_custom";
-			ne.type = "text";
-
-			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;
-		}
-	},
-
-	onBlurEditableSelectInput : function() {
-		var se = TinyMCE_EditableSelects.editSelectElm;
-
-		if (se) {
-			if (se.previousSibling.value != '') {
-				addSelectValue(document.forms[0], se.id, se.previousSibling.value, se.previousSibling.value);
-				selectByValue(document.forms[0], se.id, se.previousSibling.value);
-			} else
-				selectByValue(document.forms[0], se.id, '');
-
-			se.style.display = 'inline';
-			se.parentNode.removeChild(se.previousSibling);
-			TinyMCE_EditableSelects.editSelectElm = null;
-		}
-	},
-
-	onKeyDown : function(e) {
-		e = e || window.event;
-
-		if (e.keyCode == 13)
-			TinyMCE_EditableSelects.onBlurEditableSelectInput();
-	}
-};
+/**
+ * editable_selects.js
+ *
+ * Copyright 2009, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://tinymce.moxiecode.com/license
+ * Contributing: http://tinymce.moxiecode.com/contributing
+ */
+
+var TinyMCE_EditableSelects = {
+	editSelectElm : null,
+
+	init : function() {
+		var nl = document.getElementsByTagName("select"), i, d = document, o;
+
+		for (i=0; i<nl.length; i++) {
+			if (nl[i].className.indexOf('mceEditableSelect') != -1) {
+				o = new Option('(value)', '__mce_add_custom__');
+
+				o.className = 'mceAddSelectValue';
+
+				nl[i].options[nl[i].options.length] = o;
+				nl[i].onchange = TinyMCE_EditableSelects.onChangeEditableSelect;
+			}
+		}
+	},
+
+	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");
+			ne.id = se.id + "_custom";
+			ne.name = se.name + "_custom";
+			ne.type = "text";
+
+			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;
+		}
+	},
+
+	onBlurEditableSelectInput : function() {
+		var se = TinyMCE_EditableSelects.editSelectElm;
+
+		if (se) {
+			if (se.previousSibling.value != '') {
+				addSelectValue(document.forms[0], se.id, se.previousSibling.value, se.previousSibling.value);
+				selectByValue(document.forms[0], se.id, se.previousSibling.value);
+			} else
+				selectByValue(document.forms[0], se.id, '');
+
+			se.style.display = 'inline';
+			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.24.src/e107_handlers/tiny_mce/utils/form_utils.js 0.7.26.src/e107_handlers/tiny_mce/utils/form_utils.js
--- 0.7.24.src/e107_handlers/tiny_mce/utils/form_utils.js	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_handlers/tiny_mce/utils/form_utils.js	2011-03-30 03:22:40.000000000 -0500
@@ -1,199 +1,210 @@
-/**
- * $Id: form_utils.js 11346 2010-02-17 18:56:14Z secretr $
- *
- * Various form utilitiy functions.
- *
- * @author Moxiecode
- * @copyright Copyright  2004-2008, Moxiecode Systems AB, All rights reserved.
- */
-
-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:;" 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 updateColor(img_id, form_element_id) {
-	document.getElementById(img_id).style.backgroundColor = document.forms[0].elements[form_element_id].value;
-}
-
-function setBrowserDisabled(id, state) {
-	var img = document.getElementById(id);
-	var lnk = document.getElementById(id + "_link");
-
-	if (lnk) {
-		if (state) {
-			lnk.setAttribute("realhref", lnk.getAttribute("href"));
-			lnk.removeAttribute("href");
-			tinyMCEPopup.dom.addClass(img, 'disabled');
-		} else {
-			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", cb, html;
-
-	cb = tinyMCEPopup.getParam(option, tinyMCEPopup.getParam("file_browser_callback"));
-
-	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 openBrowser(img_id, target_form_element, type, option) {
-	var img = document.getElementById(img_id);
-
-	if (img.className != "mceButtonDisabled")
-		tinyMCEPopup.openBrowser(target_form_element, type, option);
-}
-
-function selectByValue(form_obj, field_name, value, add_custom, ignore_case) {
-	if (!form_obj || !form_obj.elements[field_name])
-		return;
-
-	var sel = form_obj.elements[field_name];
-
-	var found = false;
-	for (var i=0; i<sel.options.length; i++) {
-		var option = sel.options[i];
-
-		if (option.value == value || (ignore_case && option.value.toLowerCase() == value.toLowerCase())) {
-			option.selected = true;
-			found = true;
-		} else
-			option.selected = false;
-	}
-
-	if (!found && add_custom && value != '') {
-		var option = new Option(value, value);
-		option.selected = true;
-		sel.options[sel.options.length] = option;
-		sel.selectedIndex = sel.options.length - 1;
-	}
-
-	return found;
-}
-
-function getSelectValue(form_obj, field_name) {
-	var elm = form_obj.elements[field_name];
-
-	if (elm == null || elm.options == null || elm.selectedIndex === -1)
-		return "";
-
-	return elm.options[elm.selectedIndex].value;
-}
-
-function addSelectValue(form_obj, field_name, name, value) {
-	var s = form_obj.elements[field_name];
-	var o = new Option(name, value);
-	s.options[s.options.length] = o;
-}
-
-function addClassesToList(list_id, specific_option) {
-	// Setup class droplist
-	var styleSelectElm = document.getElementById(list_id);
-	var styles = tinyMCEPopup.getParam('theme_advanced_styles', false);
-	styles = tinyMCEPopup.getParam(specific_option, styles);
-
-	if (styles) {
-		var stylesAr = styles.split(';');
-
-		for (var i=0; i<stylesAr.length; i++) {
-			if (stylesAr != "") {
-				var key, value;
-
-				key = stylesAr[i].split('=')[0];
-				value = stylesAr[i].split('=')[1];
-
-				styleSelectElm.options[styleSelectElm.length] = new Option(key, value);
-			}
-		}
-	} else {
-		tinymce.each(tinyMCEPopup.editor.dom.getClasses(), function(o) {
-			styleSelectElm.options[styleSelectElm.length] = new Option(o.title || o['class'], o['class']);
-		});
-	}
-}
-
-function isVisible(element_id) {
-	var elm = document.getElementById(element_id);
-
-	return elm && elm.style.display != "none";
-}
-
-function convertRGBToHex(col) {
-	var re = new RegExp("rgb\\s*\\(\\s*([0-9]+).*,\\s*([0-9]+).*,\\s*([0-9]+).*\\)", "gi");
-
-	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 "rgb(" + r + "," + g + "," + b + ")";
-	}
-
-	return col;
-}
-
-function trimSize(size) {
-	return size.replace(/([0-9\.]+)px|(%|in|cm|mm|em|ex|pt|pc)/, '$1$2');
-}
-
-function getCSSSize(size) {
-	size = trimSize(size);
-
-	if (size == "")
-		return "";
-
-	// Add px
-	if (/^[0-9]+$/.test(size))
-		size += 'px';
-
-	return size;
-}
-
-function getStyle(elm, attrib, style) {
-	var val = tinyMCEPopup.dom.getAttrib(elm, attrib);
-
-	if (val != '')
-		return '' + val;
-
-	if (typeof(style) == 'undefined')
-		style = attrib;
-
-	return tinyMCEPopup.dom.getStyle(elm, style);
-}
+/**
+ * form_utils.js
+ *
+ * Copyright 2009, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://tinymce.moxiecode.com/license
+ * Contributing: http://tinymce.moxiecode.com/contributing
+ */
+
+var themeBaseURL = tinyMCEPopup.editor.baseURI.toAbsolute('themes/' + tinyMCEPopup.getParam("theme"));
+
+function getColorPickerHTML(id, target_form_element) {
+	var h = "", dom = tinyMCEPopup.dom;
+
+	if (label = dom.select('label[for=' + target_form_element + ']')[0]) {
+		label.id = label.id || dom.uniqueId();
+	}
+
+	h += '<a role="button" aria-labelledby="' + id + '_label" 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 id="' + id + '_label" class="mceVoiceLabel mceIconOnly" style="display:none;">' + tinyMCEPopup.getLang('browse') + '</span></span></a>';
+
+	return h;
+}
+
+function updateColor(img_id, form_element_id) {
+	document.getElementById(img_id).style.backgroundColor = document.forms[0].elements[form_element_id].value;
+}
+
+function setBrowserDisabled(id, state) {
+	var img = document.getElementById(id);
+	var lnk = document.getElementById(id + "_link");
+
+	if (lnk) {
+		if (state) {
+			lnk.setAttribute("realhref", lnk.getAttribute("href"));
+			lnk.removeAttribute("href");
+			tinyMCEPopup.dom.addClass(img, 'disabled');
+		} else {
+			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", cb, html;
+
+	cb = tinyMCEPopup.getParam(option, tinyMCEPopup.getParam("file_browser_callback"));
+
+	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 openBrowser(img_id, target_form_element, type, option) {
+	var img = document.getElementById(img_id);
+
+	if (img.className != "mceButtonDisabled")
+		tinyMCEPopup.openBrowser(target_form_element, type, option);
+}
+
+function selectByValue(form_obj, field_name, value, add_custom, ignore_case) {
+	if (!form_obj || !form_obj.elements[field_name])
+		return;
+
+	if (!value)
+		value = "";
+
+	var sel = form_obj.elements[field_name];
+
+	var found = false;
+	for (var i=0; i<sel.options.length; i++) {
+		var option = sel.options[i];
+
+		if (option.value == value || (ignore_case && option.value.toLowerCase() == value.toLowerCase())) {
+			option.selected = true;
+			found = true;
+		} else
+			option.selected = false;
+	}
+
+	if (!found && add_custom && value != '') {
+		var option = new Option(value, value);
+		option.selected = true;
+		sel.options[sel.options.length] = option;
+		sel.selectedIndex = sel.options.length - 1;
+	}
+
+	return found;
+}
+
+function getSelectValue(form_obj, field_name) {
+	var elm = form_obj.elements[field_name];
+
+	if (elm == null || elm.options == null || elm.selectedIndex === -1)
+		return "";
+
+	return elm.options[elm.selectedIndex].value;
+}
+
+function addSelectValue(form_obj, field_name, name, value) {
+	var s = form_obj.elements[field_name];
+	var o = new Option(name, value);
+	s.options[s.options.length] = o;
+}
+
+function addClassesToList(list_id, specific_option) {
+	// Setup class droplist
+	var styleSelectElm = document.getElementById(list_id);
+	var styles = tinyMCEPopup.getParam('theme_advanced_styles', false);
+	styles = tinyMCEPopup.getParam(specific_option, styles);
+
+	if (styles) {
+		var stylesAr = styles.split(';');
+
+		for (var i=0; i<stylesAr.length; i++) {
+			if (stylesAr != "") {
+				var key, value;
+
+				key = stylesAr[i].split('=')[0];
+				value = stylesAr[i].split('=')[1];
+
+				styleSelectElm.options[styleSelectElm.length] = new Option(key, value);
+			}
+		}
+	} else {
+		tinymce.each(tinyMCEPopup.editor.dom.getClasses(), function(o) {
+			styleSelectElm.options[styleSelectElm.length] = new Option(o.title || o['class'], o['class']);
+		});
+	}
+}
+
+function isVisible(element_id) {
+	var elm = document.getElementById(element_id);
+
+	return elm && elm.style.display != "none";
+}
+
+function convertRGBToHex(col) {
+	var re = new RegExp("rgb\\s*\\(\\s*([0-9]+).*,\\s*([0-9]+).*,\\s*([0-9]+).*\\)", "gi");
+
+	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 "rgb(" + r + "," + g + "," + b + ")";
+	}
+
+	return col;
+}
+
+function trimSize(size) {
+	return size.replace(/([0-9\.]+)(px|%|in|cm|mm|em|ex|pt|pc)/i, '$1$2');
+}
+
+function getCSSSize(size) {
+	size = trimSize(size);
+
+	if (size == "")
+		return "";
+
+	// Add px
+	if (/^[0-9]+$/.test(size))
+		size += 'px';
+	// Sanity check, IE doesn't like broken values
+	else if (!(/^[0-9\.]+(px|%|in|cm|mm|em|ex|pt|pc)$/i.test(size)))
+		return "";
+
+	return size;
+}
+
+function getStyle(elm, attrib, style) {
+	var val = tinyMCEPopup.dom.getAttrib(elm, attrib);
+
+	if (val != '')
+		return '' + val;
+
+	if (typeof(style) == 'undefined')
+		style = attrib;
+
+	return tinyMCEPopup.dom.getStyle(elm, style);
+}
diff -x .svn -aruN 0.7.24.src/e107_handlers/tiny_mce/utils/mctabs.js 0.7.26.src/e107_handlers/tiny_mce/utils/mctabs.js
--- 0.7.24.src/e107_handlers/tiny_mce/utils/mctabs.js	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_handlers/tiny_mce/utils/mctabs.js	2011-03-12 04:48:11.000000000 -0600
@@ -1,76 +1,162 @@
-/**
- * $Id: mctabs.js 11346 2010-02-17 18:56:14Z secretr $
- *
- * Moxiecode DHTML Tabs script.
- *
- * @author Moxiecode
- * @copyright Copyright  2004-2008, Moxiecode Systems AB, All rights reserved.
- */
-
-function MCTabs() {
-	this.settings = [];
-};
-
-MCTabs.prototype.init = function(settings) {
-	this.settings = settings;
-};
-
-MCTabs.prototype.getParam = function(name, default_value) {
-	var value = null;
-
-	value = (typeof(this.settings[name]) == "undefined") ? default_value : this.settings[name];
-
-	// Fix bool values
-	if (value == "true" || value == "false")
-		return (value == "true");
-
-	return value;
-};
-
-MCTabs.prototype.displayTab = function(tab_id, panel_id) {
-	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) {
-		nodes = tabContainerElm.childNodes;
-
-		// Hide all other tabs
-		for (i = 0; i < nodes.length; i++) {
-			if (nodes[i].nodeName == "LI")
-				nodes[i].className = '';
-		}
-
-		// Show selected tab
-		tabElm.className = 'current';
-	}
-
-	if (panelElm && panelContainerElm) {
-		nodes = panelContainerElm.childNodes;
-
-		// Hide all other panels
-		for (i = 0; i < nodes.length; i++) {
-			if (nodes[i].nodeName == "DIV")
-				nodes[i].className = 'panel';
-		}
-
-		// Show selected panel
-		panelElm.className = 'current';
-	}
-};
-
-MCTabs.prototype.getAnchor = function() {
-	var pos, url = document.location.href;
-
-	if ((pos = url.lastIndexOf('#')) != -1)
-		return url.substring(pos + 1);
-
-	return "";
-};
-
-// Global instance
-var mcTabs = new MCTabs();
+/**
+ * mctabs.js
+ *
+ * Copyright 2009, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://tinymce.moxiecode.com/license
+ * Contributing: http://tinymce.moxiecode.com/contributing
+ */
+
+function MCTabs() {
+	this.settings = [];
+	this.onChange = tinyMCEPopup.editor.windowManager.createInstance('tinymce.util.Dispatcher');
+};
+
+MCTabs.prototype.init = function(settings) {
+	this.settings = settings;
+};
+
+MCTabs.prototype.getParam = function(name, default_value) {
+	var value = null;
+
+	value = (typeof(this.settings[name]) == "undefined") ? default_value : this.settings[name];
+
+	// Fix bool values
+	if (value == "true" || value == "false")
+		return (value == "true");
+
+	return value;
+};
+
+MCTabs.prototype.showTab =function(tab){
+	tab.className = 'current';
+	tab.setAttribute("aria-selected", true);
+	tab.setAttribute("aria-expanded", true);
+	tab.tabIndex = 0;
+};
+
+MCTabs.prototype.hideTab =function(tab){
+	var t=this;
+
+	tab.className = '';
+	tab.setAttribute("aria-selected", false);
+	tab.setAttribute("aria-expanded", false);
+	tab.tabIndex = -1;
+};
+
+MCTabs.prototype.showPanel = function(panel) {
+	panel.className = 'current'; 
+	panel.setAttribute("aria-hidden", false);
+};
+
+MCTabs.prototype.hidePanel = function(panel) {
+	panel.className = 'panel';
+	panel.setAttribute("aria-hidden", true);
+}; 
+
+MCTabs.prototype.getPanelForTab = function(tabElm) {
+	return tinyMCEPopup.dom.getAttrib(tabElm, "aria-controls");
+};
+
+MCTabs.prototype.displayTab = function(tab_id, panel_id, avoid_focus) {
+	var panelElm, panelContainerElm, tabElm, tabContainerElm, selectionClass, nodes, i, t = this;
+
+	tabElm = document.getElementById(tab_id);
+
+	if (panel_id === undefined) {
+		panel_id = t.getPanelForTab(tabElm);
+	}
+
+	panelElm= document.getElementById(panel_id);
+	panelContainerElm = panelElm ? panelElm.parentNode : null;
+	tabContainerElm = tabElm ? tabElm.parentNode : null;
+	selectionClass = t.getParam('selection_class', 'current');
+
+	if (tabElm && tabContainerElm) {
+		nodes = tabContainerElm.childNodes;
+
+		// Hide all other tabs
+		for (i = 0; i < nodes.length; i++) {
+			if (nodes[i].nodeName == "LI") {
+				t.hideTab(nodes[i]);
+			}
+		}
+
+		// Show selected tab
+		t.showTab(tabElm);
+	}
+
+	if (panelElm && panelContainerElm) {
+		nodes = panelContainerElm.childNodes;
+
+		// Hide all other panels
+		for (i = 0; i < nodes.length; i++) {
+			if (nodes[i].nodeName == "DIV")
+				t.hidePanel(nodes[i]);
+		}
+
+		if (!avoid_focus) { 
+			tabElm.focus();
+		}
+
+		// Show selected panel
+		t.showPanel(panelElm);
+	}
+};
+
+MCTabs.prototype.getAnchor = function() {
+	var pos, url = document.location.href;
+
+	if ((pos = url.lastIndexOf('#')) != -1)
+		return url.substring(pos + 1);
+
+	return "";
+};
+
+
+//Global instance
+var mcTabs = new MCTabs();
+
+tinyMCEPopup.onInit.add(function() {
+	var tinymce = tinyMCEPopup.getWin().tinymce, dom = tinyMCEPopup.dom, each = tinymce.each;
+
+	each(dom.select('div.tabs'), function(tabContainerElm) {
+		var keyNav;
+
+		dom.setAttrib(tabContainerElm, "role", "tablist"); 
+
+		var items = tinyMCEPopup.dom.select('li', tabContainerElm);
+		var action = function(id) {
+			mcTabs.displayTab(id, mcTabs.getPanelForTab(id));
+			mcTabs.onChange.dispatch(id);
+		};
+
+		each(items, function(item) {
+			dom.setAttrib(item, 'role', 'tab');
+			dom.bind(item, 'click', function(evt) {
+				action(item.id);
+			});
+		});
+
+		dom.bind(dom.getRoot(), 'keydown', function(evt) {
+			if (evt.keyCode === 9 && evt.ctrlKey && !evt.altKey) { // Tab
+				keyNav.moveFocus(evt.shiftKey ? -1 : 1);
+				tinymce.dom.Event.cancel(evt);
+			}
+		});
+
+		each(dom.select('a', tabContainerElm), function(a) {
+			dom.setAttrib(a, 'tabindex', '-1');
+		});
+
+		keyNav = tinyMCEPopup.editor.windowManager.createInstance('tinymce.ui.KeyboardNavigation', {
+			root: tabContainerElm,
+			items: items,
+			onAction: action,
+			actOnFocus: true,
+			enableLeftRight: true,
+			enableUpDown: true
+		}, tinyMCEPopup.dom);
+	});
+});
\ No newline at end of file
diff -x .svn -aruN 0.7.24.src/e107_handlers/tiny_mce/utils/validate.js 0.7.26.src/e107_handlers/tiny_mce/utils/validate.js
--- 0.7.24.src/e107_handlers/tiny_mce/utils/validate.js	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_handlers/tiny_mce/utils/validate.js	2011-03-12 04:48:11.000000000 -0600
@@ -1,219 +1,252 @@
-/**
- * $Id: validate.js 11346 2010-02-17 18:56:14Z secretr $
- *
- * Various form validation methods.
- *
- * @author Moxiecode
- * @copyright Copyright  2004-2008, Moxiecode Systems AB, All rights reserved.
- */
-
-/**
-	// String validation:
-
-	if (!Validator.isEmail('myemail'))
-		alert('Invalid email.');
-
-	// Form validation:
-
-	var f = document.forms['myform'];
-
-	if (!Validator.isEmail(f.myemail))
-		alert('Invalid email.');
-*/
-
-var Validator = {
-	isEmail : function(s) {
-		return this.test(s, '^[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+@[-!#$%&\'*+\\/0-9=?A-Z^_`a-z{|}~]+\.[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+$');
-	},
-
-	isAbsUrl : function(s) {
-		return this.test(s, '^(news|telnet|nttp|file|http|ftp|https)://[-A-Za-z0-9\\.]+\\/?.*$');
-	},
-
-	isSize : function(s) {
-		return this.test(s, '^[0-9]+(%|in|cm|mm|em|ex|pt|pc|px)?$');
-	},
-
-	isId : function(s) {
-		return this.test(s, '^[A-Za-z_]([A-Za-z0-9_])*$');
-	},
-
-	isEmpty : function(s) {
-		var nl, i;
-
-		if (s.nodeName == 'SELECT' && s.selectedIndex < 1)
-			return true;
-
-		if (s.type == 'checkbox' && !s.checked)
-			return true;
-
-		if (s.type == 'radio') {
-			for (i=0, nl = s.form.elements; i<nl.length; i++) {
-				if (nl[i].type == "radio" && nl[i].name == s.name && nl[i].checked)
-					return false;
-			}
-
-			return true;
-		}
-
-		return new RegExp('^\\s*$').test(s.nodeType == 1 ? s.value : s);
-	},
-
-	isNumber : function(s, d) {
-		return !isNaN(s.nodeType == 1 ? s.value : s) && (!d || !this.test(s, '^-?[0-9]*\\.[0-9]*$'));
-	},
-
-	test : function(s, p) {
-		s = s.nodeType == 1 ? s.value : s;
-
-		return s == '' || new RegExp(p).test(s);
-	}
-};
-
-var AutoValidator = {
-	settings : {
-		id_cls : 'id',
-		int_cls : 'int',
-		url_cls : 'url',
-		number_cls : 'number',
-		email_cls : 'email',
-		size_cls : 'size',
-		required_cls : 'required',
-		invalid_cls : 'invalid',
-		min_cls : 'min',
-		max_cls : 'max'
-	},
-
-	init : function(s) {
-		var n;
-
-		for (n in s)
-			this.settings[n] = s[n];
-	},
-
-	validate : function(f) {
-		var i, nl, s = this.settings, c = 0;
-
-		nl = this.tags(f, 'label');
-		for (i=0; i<nl.length; i++)
-			this.removeClass(nl[i], s.invalid_cls);
-
-		c += this.validateElms(f, 'input');
-		c += this.validateElms(f, 'select');
-		c += this.validateElms(f, 'textarea');
-
-		return c == 3;
-	},
-
-	invalidate : function(n) {
-		this.mark(n.form, n);
-	},
-
-	reset : function(e) {
-		var t = ['label', 'input', 'select', 'textarea'];
-		var i, j, nl, s = this.settings;
-
-		if (e == null)
-			return;
-
-		for (i=0; i<t.length; i++) {
-			nl = this.tags(e.form ? e.form : e, t[i]);
-			for (j=0; j<nl.length; j++)
-				this.removeClass(nl[j], s.invalid_cls);
-		}
-	},
-
-	validateElms : function(f, e) {
-		var nl, i, n, s = this.settings, st = true, va = Validator, v;
-
-		nl = this.tags(f, e);
-		for (i=0; i<nl.length; i++) {
-			n = nl[i];
-
-			this.removeClass(n, s.invalid_cls);
-
-			if (this.hasClass(n, s.required_cls) && va.isEmpty(n))
-				st = this.mark(f, n);
-
-			if (this.hasClass(n, s.number_cls) && !va.isNumber(n))
-				st = this.mark(f, n);
-
-			if (this.hasClass(n, s.int_cls) && !va.isNumber(n, true))
-				st = this.mark(f, n);
-
-			if (this.hasClass(n, s.url_cls) && !va.isAbsUrl(n))
-				st = this.mark(f, n);
-
-			if (this.hasClass(n, s.email_cls) && !va.isEmail(n))
-				st = this.mark(f, n);
-
-			if (this.hasClass(n, s.size_cls) && !va.isSize(n))
-				st = this.mark(f, n);
-
-			if (this.hasClass(n, s.id_cls) && !va.isId(n))
-				st = this.mark(f, n);
-
-			if (this.hasClass(n, s.min_cls, true)) {
-				v = this.getNum(n, s.min_cls);
-
-				if (isNaN(v) || parseInt(n.value) < parseInt(v))
-					st = this.mark(f, n);
-			}
-
-			if (this.hasClass(n, s.max_cls, true)) {
-				v = this.getNum(n, s.max_cls);
-
-				if (isNaN(v) || parseInt(n.value) > parseInt(v))
-					st = this.mark(f, n);
-			}
-		}
-
-		return st;
-	},
-
-	hasClass : function(n, c, d) {
-		return new RegExp('\\b' + c + (d ? '[0-9]+' : '') + '\\b', 'g').test(n.className);
-	},
-
-	getNum : function(n, c) {
-		c = n.className.match(new RegExp('\\b' + c + '([0-9]+)\\b', 'g'))[0];
-		c = c.replace(/[^0-9]/g, '');
-
-		return c;
-	},
-
-	addClass : function(n, c, b) {
-		var o = this.removeClass(n, c);
-		n.className = b ? c + (o != '' ? (' ' + o) : '') : (o != '' ? (o + ' ') : '') + c;
-	},
-
-	removeClass : function(n, c) {
-		c = n.className.replace(new RegExp("(^|\\s+)" + c + "(\\s+|$)"), ' ');
-		return n.className = c != ' ' ? c : '';
-	},
-
-	tags : function(f, s) {
-		return f.getElementsByTagName(s);
-	},
-
-	mark : function(f, n) {
-		var s = this.settings;
-
-		this.addClass(n, s.invalid_cls);
-		this.markLabels(f, n, s.invalid_cls);
-
-		return false;
-	},
-
-	markLabels : function(f, n, ic) {
-		var nl, i;
-
-		nl = this.tags(f, "label");
-		for (i=0; i<nl.length; i++) {
-			if (nl[i].getAttribute("for") == n.id || nl[i].htmlFor == n.id)
-				this.addClass(nl[i], ic);
-		}
-
-		return null;
-	}
-};
+/**
+ * validate.js
+ *
+ * Copyright 2009, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://tinymce.moxiecode.com/license
+ * Contributing: http://tinymce.moxiecode.com/contributing
+ */
+
+/**
+	// String validation:
+
+	if (!Validator.isEmail('myemail'))
+		alert('Invalid email.');
+
+	// Form validation:
+
+	var f = document.forms['myform'];
+
+	if (!Validator.isEmail(f.myemail))
+		alert('Invalid email.');
+*/
+
+var Validator = {
+	isEmail : function(s) {
+		return this.test(s, '^[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+@[-!#$%&\'*+\\/0-9=?A-Z^_`a-z{|}~]+\.[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+$');
+	},
+
+	isAbsUrl : function(s) {
+		return this.test(s, '^(news|telnet|nttp|file|http|ftp|https)://[-A-Za-z0-9\\.]+\\/?.*$');
+	},
+
+	isSize : function(s) {
+		return this.test(s, '^[0-9]+(%|in|cm|mm|em|ex|pt|pc|px)?$');
+	},
+
+	isId : function(s) {
+		return this.test(s, '^[A-Za-z_]([A-Za-z0-9_])*$');
+	},
+
+	isEmpty : function(s) {
+		var nl, i;
+
+		if (s.nodeName == 'SELECT' && s.selectedIndex < 1)
+			return true;
+
+		if (s.type == 'checkbox' && !s.checked)
+			return true;
+
+		if (s.type == 'radio') {
+			for (i=0, nl = s.form.elements; i<nl.length; i++) {
+				if (nl[i].type == "radio" && nl[i].name == s.name && nl[i].checked)
+					return false;
+			}
+
+			return true;
+		}
+
+		return new RegExp('^\\s*$').test(s.nodeType == 1 ? s.value : s);
+	},
+
+	isNumber : function(s, d) {
+		return !isNaN(s.nodeType == 1 ? s.value : s) && (!d || !this.test(s, '^-?[0-9]*\\.[0-9]*$'));
+	},
+
+	test : function(s, p) {
+		s = s.nodeType == 1 ? s.value : s;
+
+		return s == '' || new RegExp(p).test(s);
+	}
+};
+
+var AutoValidator = {
+	settings : {
+		id_cls : 'id',
+		int_cls : 'int',
+		url_cls : 'url',
+		number_cls : 'number',
+		email_cls : 'email',
+		size_cls : 'size',
+		required_cls : 'required',
+		invalid_cls : 'invalid',
+		min_cls : 'min',
+		max_cls : 'max'
+	},
+
+	init : function(s) {
+		var n;
+
+		for (n in s)
+			this.settings[n] = s[n];
+	},
+
+	validate : function(f) {
+		var i, nl, s = this.settings, c = 0;
+
+		nl = this.tags(f, 'label');
+		for (i=0; i<nl.length; i++) {
+			this.removeClass(nl[i], s.invalid_cls);
+			nl[i].setAttribute('aria-invalid', false);
+		}
+
+		c += this.validateElms(f, 'input');
+		c += this.validateElms(f, 'select');
+		c += this.validateElms(f, 'textarea');
+
+		return c == 3;
+	},
+
+	invalidate : function(n) {
+		this.mark(n.form, n);
+	},
+	
+	getErrorMessages : function(f) {
+		var nl, i, s = this.settings, field, msg, values, messages = [], ed = tinyMCEPopup.editor;
+		nl = this.tags(f, "label");
+		for (i=0; i<nl.length; i++) {
+			if (this.hasClass(nl[i], s.invalid_cls)) {
+				field = document.getElementById(nl[i].getAttribute("for"));
+				values = { field: nl[i].textContent };
+				if (this.hasClass(field, s.min_cls, true)) {
+					message = ed.getLang('invalid_data_min');
+					values.min = this.getNum(field, s.min_cls);
+				} else if (this.hasClass(field, s.number_cls)) {
+					message = ed.getLang('invalid_data_number');
+				} else if (this.hasClass(field, s.size_cls)) {
+					message = ed.getLang('invalid_data_size');
+				} else {
+					message = ed.getLang('invalid_data');
+				}
+				
+				message = message.replace(/{\#([^}]+)\}/g, function(a, b) {
+					return values[b] || '{#' + b + '}';
+				});
+				messages.push(message);
+			}
+		}
+		return messages;
+	},
+
+	reset : function(e) {
+		var t = ['label', 'input', 'select', 'textarea'];
+		var i, j, nl, s = this.settings;
+
+		if (e == null)
+			return;
+
+		for (i=0; i<t.length; i++) {
+			nl = this.tags(e.form ? e.form : e, t[i]);
+			for (j=0; j<nl.length; j++) {
+				this.removeClass(nl[j], s.invalid_cls);
+				nl[j].setAttribute('aria-invalid', false);
+			}
+		}
+	},
+
+	validateElms : function(f, e) {
+		var nl, i, n, s = this.settings, st = true, va = Validator, v;
+
+		nl = this.tags(f, e);
+		for (i=0; i<nl.length; i++) {
+			n = nl[i];
+
+			this.removeClass(n, s.invalid_cls);
+
+			if (this.hasClass(n, s.required_cls) && va.isEmpty(n))
+				st = this.mark(f, n);
+
+			if (this.hasClass(n, s.number_cls) && !va.isNumber(n))
+				st = this.mark(f, n);
+
+			if (this.hasClass(n, s.int_cls) && !va.isNumber(n, true))
+				st = this.mark(f, n);
+
+			if (this.hasClass(n, s.url_cls) && !va.isAbsUrl(n))
+				st = this.mark(f, n);
+
+			if (this.hasClass(n, s.email_cls) && !va.isEmail(n))
+				st = this.mark(f, n);
+
+			if (this.hasClass(n, s.size_cls) && !va.isSize(n))
+				st = this.mark(f, n);
+
+			if (this.hasClass(n, s.id_cls) && !va.isId(n))
+				st = this.mark(f, n);
+
+			if (this.hasClass(n, s.min_cls, true)) {
+				v = this.getNum(n, s.min_cls);
+
+				if (isNaN(v) || parseInt(n.value) < parseInt(v))
+					st = this.mark(f, n);
+			}
+
+			if (this.hasClass(n, s.max_cls, true)) {
+				v = this.getNum(n, s.max_cls);
+
+				if (isNaN(v) || parseInt(n.value) > parseInt(v))
+					st = this.mark(f, n);
+			}
+		}
+
+		return st;
+	},
+
+	hasClass : function(n, c, d) {
+		return new RegExp('\\b' + c + (d ? '[0-9]+' : '') + '\\b', 'g').test(n.className);
+	},
+
+	getNum : function(n, c) {
+		c = n.className.match(new RegExp('\\b' + c + '([0-9]+)\\b', 'g'))[0];
+		c = c.replace(/[^0-9]/g, '');
+
+		return c;
+	},
+
+	addClass : function(n, c, b) {
+		var o = this.removeClass(n, c);
+		n.className = b ? c + (o != '' ? (' ' + o) : '') : (o != '' ? (o + ' ') : '') + c;
+	},
+
+	removeClass : function(n, c) {
+		c = n.className.replace(new RegExp("(^|\\s+)" + c + "(\\s+|$)"), ' ');
+		return n.className = c != ' ' ? c : '';
+	},
+
+	tags : function(f, s) {
+		return f.getElementsByTagName(s);
+	},
+
+	mark : function(f, n) {
+		var s = this.settings;
+
+		this.addClass(n, s.invalid_cls);
+		n.setAttribute('aria-invalid', 'true');
+		this.markLabels(f, n, s.invalid_cls);
+
+		return false;
+	},
+
+	markLabels : function(f, n, ic) {
+		var nl, i;
+
+		nl = this.tags(f, "label");
+		for (i=0; i<nl.length; i++) {
+			if (nl[i].getAttribute("for") == n.id || nl[i].htmlFor == n.id)
+				this.addClass(nl[i], ic);
+		}
+
+		return null;
+	}
+};
diff -x .svn -aruN 0.7.24.src/e107_handlers/tiny_mce/wysiwyg.php 0.7.26.src/e107_handlers/tiny_mce/wysiwyg.php
--- 0.7.24.src/e107_handlers/tiny_mce/wysiwyg.php	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_handlers/tiny_mce/wysiwyg.php	2011-04-20 15:43:25.000000000 -0500
@@ -4,206 +4,231 @@
 |     e107 website system - Tiny MCE controller file.
 |
 |     $URL: https://e107.svn.sourceforge.net/svnroot/e107/trunk/e107_0.7/e107_handlers/tiny_mce/wysiwyg.php $
-|     $Revision: 11716 $
-|     $Id: wysiwyg.php 11716 2010-08-29 11:14:49Z secretr $
-|     $Author: secretr $
+|     $Revision: 12152 $
+|     $Id: wysiwyg.php 12152 2011-04-20 20:43:49Z e107coders $
+|     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
-
-function wysiwyg($formids)
+class wysiwyg
 {
-global $pref,$HANDLERS_DIRECTORY,$PLUGINS_DIRECTORY,$IMAGES_DIRECTORY;
-$lang = e_LANGUAGE;
-$tinylang = array(
-	"Arabic" 	=> "ar",
-	"Danish" 	=> "da",
-	"Dutch" 		=> "nl",
-	"English" 	=> "en",
-	"Farsi" 		=> "fa",
-	"French" 	=> "fr",
-	"German"		=> "de",
-	"Greek" 		=> "el",
-	"Hebrew" 	=> " ",
-	"Hungarian" => "hu",
-	"Italian" 	=> "it",
-	"Japanese" 	=> "ja",
-	"Korean" 	=> "ko",
-	"Norwegian" => "nb",
-	"Polish" 	=> "pl",
-	"Russian" 	=> "ru",
-	"Slovak" 	=> "sk",
-	"Spanish" 	=> "es",
-	"Swedish" 	=> "sv"
-);
+	var $js;
+	var $config = array();
+	
+	
+	function wysiwyg($formids)
+	{
+		global $pref,$PLUGINS_DIRECTORY,$IMAGES_DIRECTORY,$lng;
+		
+		$tinylang = $lng->convert(e_LANGUAGE);
+
+		if(!$tinylang)
+		{
+			$tinylang = "en";
+		}
+
+		$mce_plugins = array();
+		$mce_plugins[0]	= "table";
+		$mce_plugins[1]	= "contextmenu";
+		$mce_plugins[2]	= ($pref['smiley_activate']) ? "emoticons" : "";		// 'emotions' for the tinyMCE plugin, 'emoticons' for ours
+		$mce_plugins[3]	= "iespell";
+		$mce_plugins[4]	= "media";
+		$mce_plugins[5]	= (ADMIN) ? "ibrowser" : "";				// Third party plugins - 'image' may not be a valid plugin name
+		//$mce_plugins[6]	= "compat2x";					// May well not be needed - mostly for if we have our own code
+		$mce_plugins[7]	= "paste";
+
+		if(strstr(varset($_SERVER["HTTP_ACCEPT_ENCODING"],""), "gzip") && (ini_get("zlib.output_compression") == false) && file_exists(e_HANDLER."tiny_mce/tiny_mce_gzip.php"))
+		{
+			$text = "<script type='text/javascript' src='".e_HANDLER_ABS."tiny_mce/tiny_mce_gzip.js'></script>
+		
+			<script type='text/javascript'>
+			tinyMCE_GZ.init({
+				plugins : '".implode(",",$mce_plugins)."',
+				themes : 'advanced',
+				languages : '".$tinylang."',
+				disk_cache : false,
+				debug : false
+			});
+			</script>
+			";
+		}
+		else
+		{
+			$text = "<script type='text/javascript' src='".e_HANDLER."tiny_mce/tiny_mce.js'></script>\n";	
+		}
+
+
+		$text .= "
+			<script type='text/javascript'>
+			tinyMCE.init({
+				language : '".$tinylang."',
+				mode : 'exact',
+				elements : '".$formids."',
+				theme : 'advanced',
+				plugins : '".implode(",",$mce_plugins)."'\n";
+		
+
+
+		$text .= ",theme_advanced_buttons1 : 'fontsizeselect,separator,bold,italic,underline,separator,justifyleft,justifycenter,justifyright,justifyfull,separator,bullist,numlist,outdent, indent,separator, forecolor,cut,copy,paste,pastetext,pasteword'";
+		
+		$text .= ",theme_advanced_buttons2   : 'tablecontrols,separator,undo,redo,separator,link,unlink";
+		$text .= ($pref['smiley_activate']) ? ",emoticons" : "";
+		$text .= ",charmap,iespell,media";
+		$text .= (ADMIN) ? ",ibrowser" : ",image";
+		$text .= (ADMIN) ? ",code" : "";
+		$text .= "',"; // end of buttons 2
+		
+		$text .= $this->tinyMce_config();
+		
+	
+		$text .= "
+		
+			});
+		
+		function tinymce_html_bbcode_control(type, source) {
+					
+		    switch (type) {
+		
+		        case 'get_from_editor':
+		            // Convert HTML to e107-BBcode
+		            source = source.replace(/target=\"_blank\"/, 'rel=\"external\"');
+		            source = source.replace(/^\s*|\s*$/g,'');
+		            if(source != '')
+		            {
+		                source = '[html]\\n' + source + '\\n[/html]';";
+		/*
+						source = source.replace(/<\/strong>/gi,'[/b]');
+		                source = source.replace(/<strong>/gi,'[b]');
+		                source = source.replace(/<\/em>/gi,'[/i]');
+		                source = source.replace(/<em>/gi,'[i]');
+		                source = source.replace(/<\/u>/gi,'[/u]');
+		                source = source.replace(/<u>/gi,'[u]');
+		                source = source.replace(/<\/strong>/gi,'[/b]');
+		                source = source.replace(/<img/gi,'[img');
+		                source = source.replace(/<\/strong>/gi,'[/b]');
+						source = source.replace(/<a href=\"(.*?)\"(.*?)>(.*?)<\/a>/gi,'[link=$1 $2]$3[/link]');
+		*/
+		$text .= "
+		            }
+		
+				// Convert e107 paths.
+		                source = source.replace(/\"".str_replace("/","\/",$IMAGES_DIRECTORY)."/g,'\"{e_IMAGE}');
+						source = source.replace(/\"".str_replace("/","\/",$PLUGINS_DIRECTORY)."/g,'\"{e_PLUGIN}');
+						source = source.replace(/\'".str_replace("/","\/",$IMAGES_DIRECTORY)."/g,'\'{e_IMAGE}');
+						source = source.replace(/\'".str_replace("/","\/",$PLUGINS_DIRECTORY)."/g,'\'{e_PLUGIN}');
+		
+		            break;
+		
+		        case 'insert_to_editor':
+				// Convert e107-BBcode to HTML
+		            source = source.replace(/rel=\"external\"/, 'target=\"_blank\"');
+		
+		            html_bbcode_check = source.slice(0,6);
+		
+		            if (html_bbcode_check == '[html]') {
+		                source = source.slice(6);
+		            }
+		
+		            html_bbcode_check = source.slice(-7);
+		
+		            if (html_bbcode_check == '[/html]') {
+		                source = source.slice(0, -7);
+		            }";
+		/*
+					source = source.replace(/\[b\]/gi,'<strong>');
+					source = source.replace(/\[\/b\]/gi,'<\/strong>');
+		*/
+		$text .= "
+					source = source.replace(/\{e_IMAGE\}/gi,'".$IMAGES_DIRECTORY."');
+					source = source.replace(/\{e_PLUGIN\}/gi,'".$PLUGINS_DIRECTORY."');
+		
+		            break;
+		    }
+		
+		    return source;
+		}
+		
+		
+		</script>\n
+		";
+	
+		$this->js = $text;	
+	}
+
+	function tinyMce_config()
+	{
+		$text = "";
+		
+		$this->getConfig();
+		
+		$newConfig = array();
+		
+		foreach($this->config as $key=>$val)
+		{
+			if($val != 'true' && $val !='false')
+			{
+				$val = "'".$val."'";
+			}
+			$newConfig[] = "\t\t  ".$key." : ".$val;
+		}
+		
+		return implode(",\n",$newConfig);
+		
+	}
+	
+	
+	function getConfig()
+	{
+		$this->config = array(
+			'theme_advanced_buttons3' 			=> '',
+			'theme_advanced_toolbar_location' 	=> 'top',
+			'extended_valid_elements' 			=> '',
+			'invalid_elements' 					=> 'p,font,align,script,applet,iframe',
+		//	'auto_cleanup_word'					=> 'true',
+			'convert_fonts_to_spans'			=> 'true',
+			'trim_span_elements'				=> 'true',
+			'inline_styles'						=> 'true',
+			'debug'								=> 'false',
+			'force_br_newlines'					=> 'false',
+			'forced_root_block'					=> 'div', // div required for styling. 
+			'force_p_newlines'					=> 'false',
+			'entity_encoding'					=> 'raw',
+			'convert_fonts_to_styles'			=> 'true',
+			'remove_script_host'				=> 'true',
+			'relative_urls'						=> 'true',
+			'document_base_url'					=> SITEURL,
+			'theme_advanced_styles'				=> 'border=border;fborder=fborder;tbox=tbox;caption=caption;fcaption=fcaption;forumheader=forumheader;forumheader3=forumheader3',
+			//'popup_css'						=> '".THEME_ABS."style.css',
+			'verify_css_classes'				=> 'false',
+			'cleanup_callback'					 => 'tinymce_html_bbcode_control',
+			'verify_css_classes'				=> 'false'
+		);
+		
+		// Paste Plugin
+		
+		$this->config += array(
+			
+			'remove_linebreaks'						=> 'false', // remove line break stripping by tinyMCE so that we can read the HTML
+ 			'paste_create_paragraphs'				=> 'false',	// for paste plugin - double linefeeds are converted to paragraph elements
+ 			'paste_create_linebreaks'				=> 'false',	// for paste plugin - single linefeeds are converted to hard line break elements
+ 			'paste_use_dialog'						=> 'true',	// for paste plugin - Mozilla and MSIE will present a paste dialog if true
+ 			'paste_auto_cleanup_on_paste'			=> 'true',	// for paste plugin - word paste will be executed when the user copy/paste content
+ 			'paste_convert_middot_lists'			=> 'false',	// for paste plugin - middot lists are converted into UL lists
+ 			'paste_unindented_list_class'			=> 'unindentedList', // for paste plugin - specify what class to assign to the UL list of middot cl's
+ 			'paste_convert_headers_to_strong'		=> 'true',	// for paste plugin - converts H1-6 elements to strong elements on paste
+ 			'paste_insert_word_content_callback'	=> 'convertWord', // for paste plugin - This callback is executed when the user pastes word content
+			'auto_cleanup_word'						=> 'false'	// auto clean pastes from Word 
+		);
+		
+		if(ADMIN)
+		{
+			$this->config['external_link_list_url'] = e_HANDLER_ABS."tiny_mce/filelist.php";	
+		}
+	}
+	
+	function render()
+	{
+		echo $this->js;
+	}
 
-if(!$tinylang[$lang])
-{
- $tinylang[$lang] = "en";
 }
-
-$mce_plugins = array();
-$mce_plugins[0]	= "table";
-$mce_plugins[1]	= "contextmenu";
-$mce_plugins[2]	= ($pref['smiley_activate']) ? "emoticons" : "";
-$mce_plugins[4]	= (ADMIN) ? "ibrowser" : "image";
-$mce_plugins[5]	= "contextmenu";
-$mce_plugins[6]	= "iespell";
-$mce_plugins[7]	= "zoom";
-$mce_plugins[8]	= "media";
-$mce_plugins[9]	= "compat2x";
-
-
-if(strstr(varset($_SERVER["HTTP_ACCEPT_ENCODING"],""), "gzip") && (ini_get("zlib.output_compression") == false) && file_exists(e_HANDLER."tiny_mce/tiny_mce_gzip.php"))
-{
-	unset($mce_plugins[7]); // 'zoom' causes an error with the gzip version. 
-	$text = "<script type='text/javascript' src='".e_HANDLER_ABS."tiny_mce/tiny_mce_gzip.js'></script>
-
-	<script type='text/javascript'>
-	tinyMCE_GZ.init({
-		plugins : '".implode(",",$mce_plugins)."',
-		themes : 'advanced',
-		languages : '".$tinylang[$lang]."',
-		disk_cache : false,
-		debug : false
-	});
-	</script>
-	";
-}
-else
-{
-	$text = "<script type='text/javascript' src='".e_HANDLER."tiny_mce/tiny_mce.js'></script>\n";	
-}
-
-
-
-$text .= "
-	<script type='text/javascript'>
-	tinyMCE.init({
-		language : '".$tinylang[$lang]."',
-		mode : 'exact',
-		elements : '".$formids."',
-		theme : 'advanced',
-		plugins : '".implode(",",$mce_plugins)."'\n";
-
-
-/*$text .= ",plugins : 'table,contextmenu";
-
-$text .= ($pref['smiley_activate']) ? ",emoticons" : "";
-$text .= (ADMIN) ? ",ibrowser" : ",image";
-$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'";
-
-$text .= ",theme_advanced_buttons2   : 'tablecontrols,separator,undo,redo,separator,link,unlink";
-$text .= ($pref['smiley_activate']) ? ",emoticons" : "";
-$text .= ",charmap,iespell,media";
-$text .= (ADMIN) ? ",ibrowser" : ",image";
-$text .= (ADMIN) ? ",code" : "";
-$text .= "'"; // end of buttons 2
-
-$text .= ",theme_advanced_buttons3 : ''";
-$text .= ",theme_advanced_toolbar_location : 'top'";
-$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";
-$text .= ",trim_span_elements: true\n";
-$text .= ",inline_styles: true\n";
-$text .= ",debug: false\n";
-$text .= ",force_br_newlines: false\n";
-$text .= ",forced_root_block : ''\n";
-$text .= ",force_p_newlines: false\n";
-$text .= ",entity_encoding: \"raw\" \n";
-$text .= ",convert_fonts_to_styles: true\n";
-$text .= ",remove_script_host : true\n";
-$text .= ",relative_urls: true\n";
-$text .= ",document_base_url: '".SITEURL."'\n";
-$text .= ",theme_advanced_styles: 'border=border;fborder=fborder;tbox=tbox;caption=caption;fcaption=fcaption;forumheader=forumheader;forumheader3=forumheader3'\n";
-//$text .= ",popup_css: '".THEME_ABS."style.css'\n";
-$text .= ",verify_css_classes : false\n";
-$text .= ",cleanup_callback : \"tinymce_html_bbcode_control\" \n";
-$text .= (ADMIN) ? "\n, external_link_list_url: '../".$HANDLERS_DIRECTORY."tiny_mce/filelist.php'\n" : "";
-
-$text .= "
-
-	});
-
-function tinymce_html_bbcode_control(type, source) {
-
-    switch (type) {
-
-        case 'get_from_editor':
-            // Convert HTML to e107-BBcode
-            source = source.replace(/target=\"_blank\"/, 'rel=\"external\"');
-            source = source.replace(/^\s*|\s*$/g,'');
-            if(source != '')
-            {
-                source = '[html]\\n' + source + '\\n[/html]';";
-/*
-				source = source.replace(/<\/strong>/gi,'[/b]');
-                source = source.replace(/<strong>/gi,'[b]');
-                source = source.replace(/<\/em>/gi,'[/i]');
-                source = source.replace(/<em>/gi,'[i]');
-                source = source.replace(/<\/u>/gi,'[/u]');
-                source = source.replace(/<u>/gi,'[u]');
-                source = source.replace(/<\/strong>/gi,'[/b]');
-                source = source.replace(/<img/gi,'[img');
-                source = source.replace(/<\/strong>/gi,'[/b]');
-				source = source.replace(/<a href=\"(.*?)\"(.*?)>(.*?)<\/a>/gi,'[link=$1 $2]$3[/link]');
-*/
-$text .= "
-            }
-
-		// Convert e107 paths.
-                source = source.replace(/\"".str_replace("/","\/",$IMAGES_DIRECTORY)."/g,'\"{e_IMAGE}');
-				source = source.replace(/\"".str_replace("/","\/",$PLUGINS_DIRECTORY)."/g,'\"{e_PLUGIN}');
-				source = source.replace(/\'".str_replace("/","\/",$IMAGES_DIRECTORY)."/g,'\'{e_IMAGE}');
-				source = source.replace(/\'".str_replace("/","\/",$PLUGINS_DIRECTORY)."/g,'\'{e_PLUGIN}');
-
-            break;
-
-        case 'insert_to_editor':
-		// Convert e107-BBcode to HTML
-            source = source.replace(/rel=\"external\"/, 'target=\"_blank\"');
-
-            html_bbcode_check = source.slice(0,6);
-
-            if (html_bbcode_check == '[html]') {
-                source = source.slice(6);
-            }
-
-            html_bbcode_check = source.slice(-7);
-
-            if (html_bbcode_check == '[/html]') {
-                source = source.slice(0, -7);
-            }";
-/*
-			source = source.replace(/\[b\]/gi,'<strong>');
-			source = source.replace(/\[\/b\]/gi,'<\/strong>');
-*/
-$text .= "
-			source = source.replace(/\{e_IMAGE\}/gi,'".$IMAGES_DIRECTORY."');
-			source = source.replace(/\{e_PLUGIN\}/gi,'".$PLUGINS_DIRECTORY."');
-
-            break;
-    }
-
-    return source;
-}
-
-
-</script>\n
-";
-
-return $text;
-
-}
-
-
 ?>
\ No newline at end of file
diff -x .svn -aruN 0.7.24.src/e107_handlers/user_extended_class.php 0.7.26.src/e107_handlers/user_extended_class.php
--- 0.7.24.src/e107_handlers/user_extended_class.php	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_handlers/user_extended_class.php	2010-10-05 16:20:31.000000000 -0500
@@ -11,8 +11,8 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $URL: https://e107.svn.sourceforge.net/svnroot/e107/trunk/e107_0.7/e107_handlers/user_extended_class.php $
-|     $Revision: 11695 $
-|     $Id: user_extended_class.php 11695 2010-08-23 18:12:30Z e107steved $
+|     $Revision: 11853 $
+|     $Id: user_extended_class.php 11853 2010-10-05 21:20:55Z e107steved $
 |     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
@@ -324,11 +324,12 @@
 		$regex = $tp->toText($parms[1]);
 		$regexfail = $tp->toText($parms[2]);
 		$fname = "ue[user_".$struct['user_extended_struct_name']."]";
-	  if(strpos($include, 'class') === FALSE)	
-	  {
+		if(strpos($include, 'class') === FALSE)	
+		{
 			$include .= " class='tbox' ";
 		}
 
+		$ret = '';
 		switch($struct['user_extended_struct_type'])
 		{
 			case 1:  //textbox
@@ -342,7 +343,7 @@
 				{
 					$choice = trim($choice);
 					$chk = ($curval == $choice)? " checked='checked' " : "";
-					$ret = "<input {$include} type='radio' name='{$fname}' value='{$choice}' {$chk} /> {$choice}";
+					$ret .= "<input {$include} type='radio' name='{$fname}' value='{$choice}' {$chk} /> {$choice}";
 				}
 				return $ret;
 				break;
diff -x .svn -aruN 0.7.24.src/e107_handlers/user_select_class.php 0.7.26.src/e107_handlers/user_select_class.php
--- 0.7.24.src/e107_handlers/user_select_class.php	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_handlers/user_select_class.php	2011-01-12 08:12:08.000000000 -0600
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $URL: https://e107.svn.sourceforge.net/svnroot/e107/trunk/e107_0.7/e107_handlers/user_select_class.php $
-|     $Revision: 11678 $
-|     $Id: user_select_class.php 11678 2010-08-22 00:43:45Z e107coders $
-|     $Author: e107coders $
+|     $Revision: 12033 $
+|     $Id: user_select_class.php 12033 2011-01-12 14:12:32Z e107steved $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 
@@ -26,9 +26,10 @@
 
 include_lan(e_LANGUAGEDIR.e_LANGUAGE."/lan_user_select.php");
 
-class user_select {
-
-	function user_list($class, $form_name='user', $display='user_name', $val = 'user_name') {
+class user_select 
+{
+	function user_list($class, $form_name='user', $display='user_name', $val = 'user_name') 
+	{
 		global $pref, $sql, $tp;
 		if($class === FALSE) { $class = e_UC_MEMBER;}
 		switch ($class)
@@ -61,32 +62,64 @@
 		return $text;
 	}
 
-	function class_list($class, $form_name) {
+
+	/**
+	 *	Display selection dropdown of all user classes
+	 *
+	 *	@param int $class - if its e_UC_MEMBER, all classes are shown. Otherwise only the class matching the value is shown.
+	 */
+	function class_list($class, $form_name) 
+	{
 		global $pref, $sql;
 		$text = "<select class='tbox' id='class' name='class' onchange=\"uc_switch('user')\">";
 		$text .= "<option value=''>".US_LAN_2."</option>";
-		if (ADMINPERMS == '0' && $class == e_UC_MEMBER) {
+		if (ADMINPERMS == '0' && $class == e_UC_MEMBER) 
+		{
 			$text .= "<option value='all'>".US_LAN_3."</option>";
 		}
-		if ($class == e_UC_MEMBER) {
+		if ($class == e_UC_MEMBER) 
+		{
 			$sql -> db_Select("userclass_classes", "userclass_id, userclass_name", "ORDER BY userclass_name", "nowhere");
-			while ($row = $sql -> db_Fetch()) {
-				if (check_class($row['userclass_id']) || ADMINPERMS == '0') {
+			while ($row = $sql -> db_Fetch()) 
+			{
+				if (check_class($row['userclass_id']) || ADMINPERMS == '0') 
+				{
 					$text .= "<option value='".$row['userclass_id'].":".$row['userclass_name']."'>".$row['userclass_name']."</option>";
 				}
 			}
-		} else {
+		} 
+		else 
+		{
 			$sql -> db_Select("userclass_classes", "userclass_id, userclass_name", "userclass_id='".intval($class)."' ORDER BY userclass_name");
-			while ($row = $sql -> db_Fetch()) {
+			while ($row = $sql -> db_Fetch()) 
+			{
 				$text .= "<option value='".$row['userclass_id'].":".$row['userclass_name']."'>".$row['userclass_name']."</option>";
 			}
 		}
 		return $text;
 	}
 
-	function select_form($type, $user_form, $user_value = '', $class_form = false, $class_value = '', $class = false) 
+
+	/**
+	 *	Put up user selection form
+	 *
+	 *	@param string $type  (list|popup) - determines type of display
+	 *	@param string $user_form - type.name (textarea|input).name of text box or text area to accept user name (popups only)
+	 *	@param string $user_value - initial value of user input box
+	 *	@param int|boolean $class - if non-false, userclass ID to filter list (was unused parameter called $class_form)
+	 *	@param string $dummy - unused parameter (was called $class_value)
+	 *	@param int|boolean $oldClass - unused parameter; for legacy purposes, if non-false, overrides $class
+	 *
+	 *	@return string html for display
+	 *
+	 *	@todo remove unused parameters when possible
+	 *	N.B. Only used by pm plugin in 0.7 core distribution
+	 */
+//	function select_form($type, $user_form, $user_value = '', $class_form = false, $class_value = '', $class = false) 
+	function select_form($type, $user_form, $user_value = '', $class = false, $dummy = '', $oldClass = FALSE) 
 	{
 		global $tp;
+		if ($oldClass !== FALSE) $class = $oldClass;		// Handle legacy position of $class
 		$text = "<script type='text/javascript'>
 		<!--
 		function uc_switch(uctype) {
@@ -98,7 +131,8 @@
 		list($form_type, $form_id) = explode(".", $user_form);
 		if($form_id == "") { $form_id = $form_type; }
 
-		if ($type == 'list') {
+		if ($type == 'list') 
+		{
 			$text .= $this -> user_list($class, 'user');
 		}
 		else if ($type == 'popup')
@@ -116,24 +150,34 @@
 			title='".US_LAN_4."...' onclick=\"window.open('".e_HANDLER_ABS."user_select_class.php?".$user_form."','user_search', 'toolbar=no,location=no,status=yes,scrollbars=yes,resizable=yes,width=300,height=200,left=100,top=100'); return false;\" />";
 		}
 
-		if ($class !== false) {
-			if (($class < e_UC_NOBODY && USERCLASS) || ADMINPERMS == '0') {
+		/*
+		This appears to duplicate other functionality, in an unhelpful way!
+		if ($class !== false) 
+		{
+			if (($class < e_UC_NOBODY && USERCLASS) || ADMINPERMS == '0') 
+			{
 				$text .= ' '.$this -> class_list($class, 'class');
 			}
 		}
+		*/
 
 		return $text;
 	}
 
-	function real_name($_id) {
+
+
+	function real_name($_id) 
+	{
 		global $sql;
 		$sql -> db_Select("user", "user_name", "user_id='".intval($_id)."' ");
-		if ($row = $sql -> db_Fetch()) {
+		if ($row = $sql -> db_Fetch()) 
+		{
 			return $row['user_name'];
 		}
 	}
 
-	function popup() {
+	function popup() 
+	{
 		global $ns, $tp;
 		list($elementType, $elementID) = explode(".", e_QUERY);
 		if($elementType == 'textarea')
@@ -190,7 +234,8 @@
 			</form>
 			";
 
-		if ($_POST['dosrch']) {
+		if (isset($_POST['dosrch'])) 
+		{
 			$userlist = $this -> findusers($_POST['srch']);
 			if($userlist == FALSE)
 			{
diff -x .svn -aruN 0.7.24.src/e107_handlers/xml_class.php 0.7.26.src/e107_handlers/xml_class.php
--- 0.7.24.src/e107_handlers/xml_class.php	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_handlers/xml_class.php	2011-06-28 20:07:04.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $URL: https://e107.svn.sourceforge.net/svnroot/e107/trunk/e107_0.7/e107_handlers/xml_class.php $
-|     $Revision: 11804 $
-|     $Id: xml_class.php 11804 2010-09-21 07:38:40Z e107steved $
-|     $Author: e107steved $
+|     $Revision: 12289 $
+|     $Id: xml_class.php 12289 2011-06-29 01:07:28Z e107coders $
+|     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
 
@@ -75,7 +75,7 @@
 				return $data;
 			}
 		}
-		if (function_exists("curl_init"))
+		if (function_exists("curl_init") && function_exists("curl_exec"))
 		{
 			$cu = curl_init();
 			curl_setopt($cu, CURLOPT_URL, $address);
diff -x .svn -aruN 0.7.24.src/e107_images/thumb.php 0.7.26.src/e107_images/thumb.php
--- 0.7.24.src/e107_images/thumb.php	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_images/thumb.php	2011-03-14 16:09:36.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $URL: https://e107.svn.sourceforge.net/svnroot/e107/trunk/e107_0.7/e107_images/thumb.php $
-|     $Revision: 11678 $
-|     $Id: thumb.php 11678 2010-08-22 00:43:45Z e107coders $
-|     $Author: e107coders $
+|     $Revision: 12104 $
+|     $Id: thumb.php 12104 2011-03-14 21:10:00Z e107steved $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 /*
@@ -60,6 +60,7 @@
 	$opts = varset($tmp[2],'upsize');
 	if(!resize_image($source, 'stdout', $newsize, $opts))
 	{
+		$source = $tp->toDB($source);
 		echo "Couldn't find: {$source}<br />";
 	} 
 } 
diff -x .svn -aruN 0.7.24.src/e107_languages/English/admin/help/download.php 0.7.26.src/e107_languages/English/admin/help/download.php
--- 0.7.24.src/e107_languages/English/admin/help/download.php	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_languages/English/admin/help/download.php	2011-04-12 16:25:07.000000000 -0500
@@ -11,15 +11,15 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $URL: https://e107.svn.sourceforge.net/svnroot/e107/trunk/e107_0.7/e107_languages/English/admin/help/download.php $
-|     $Revision: 11678 $
-|     $Id: download.php 11678 2010-08-22 00:43:45Z e107coders $
-|     $Author: e107coders $
+|     $Revision: 12132 $
+|     $Id: download.php 12132 2011-04-12 21:25:31Z e107steved $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 
 if (!defined('e107_INIT')) { exit; }
 
-$text = "Please upload your files into the ".e_FILE."downloads folder, your images into the ".e_FILE."downloadimages folder and thumbnail images into the ".e_FILE."downloadthumbs folder.
+$text = "Please upload your files into the ".e_DOWNLOAD." folder, your images into the ".e_FILE."downloadimages folder and thumbnail images into the ".e_FILE."downloadthumbs folder.
 <br /><br />
 To submit a download, first create a parent, then create a category under that parent, you will then be able to make the download available.";
 $ns -> tablerender("Download Help", $text);
diff -x .svn -aruN 0.7.24.src/e107_languages/English/admin/lan_admin.php 0.7.26.src/e107_languages/English/admin/lan_admin.php
--- 0.7.24.src/e107_languages/English/admin/lan_admin.php	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_languages/English/admin/lan_admin.php	2011-07-07 22:02:10.000000000 -0500
@@ -4,8 +4,8 @@
 |     e107 website system - Language File.
 |
 |     $URL: https://e107.svn.sourceforge.net/svnroot/e107/trunk/e107_0.7/e107_languages/English/admin/lan_admin.php $
-|     $Revision: 11678 $
-|     $Id: lan_admin.php 11678 2010-08-22 00:43:45Z e107coders $
+|     $Revision: 12315 $
+|     $Id: lan_admin.php 12315 2011-07-08 03:02:34Z e107coders $
 |     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
@@ -200,7 +200,8 @@
 define("ADLAN_ERR_4", "Deprecated plugin file(s) found");
 define("ADLAN_ERR_5", "The following files need to be renamed to");
 define("ADLAN_ERR_6", "Then, click here to re-scan your plugin folders.");
-
+define("ADLAN_ERR_7", "Malicious files have been detected on your server. They should be deleted [b]immediately[/b].");
+define("ADLAN_ERR_8", "Please run [File inspector] to check for core files that may have been modified.");
 
 // Common Terms
 define("LAN_EDIT","Edit");
@@ -275,4 +276,10 @@
 define("LAN_NEWVERSION","New Version Available");
 define("LAN_NEWVERSION_MORE","learn more");
 define("LAN_NEWVERSION_DLD","Download %s from SF.net");
+define('LAN_NEWVERSION_CHECK_ERROR', 'Version check error');
+
+define("LAN_SECURITYL_0", "Looking for troubles (none)");
+define("LAN_SECURITYL_5", "Balanced");
+define("LAN_SECURITYL_8", "High");
+define("LAN_SECURITYL_10", "Insane");
 ?>
\ No newline at end of file
diff -x .svn -aruN 0.7.24.src/e107_languages/English/admin/lan_cpage.php 0.7.26.src/e107_languages/English/admin/lan_cpage.php
--- 0.7.24.src/e107_languages/English/admin/lan_cpage.php	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_languages/English/admin/lan_cpage.php	2011-04-18 20:29:21.000000000 -0500
@@ -4,8 +4,8 @@
 |     e107 website system - Language File.
 |
 |     $URL: https://e107.svn.sourceforge.net/svnroot/e107/trunk/e107_0.7/e107_languages/English/admin/lan_cpage.php $
-|     $Revision: 11678 $
-|     $Id: lan_cpage.php 11678 2010-08-22 00:43:45Z e107coders $
+|     $Revision: 12145 $
+|     $Id: lan_cpage.php 12145 2011-04-19 01:29:45Z e107coders $
 |     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
@@ -54,4 +54,5 @@
 define('CUSLAN_43', 'untitled menu: ');
 define('CUSLAN_44', 'untitled page');
 
+
 ?>
\ No newline at end of file
diff -x .svn -aruN 0.7.24.src/e107_languages/English/admin/lan_credits.php 0.7.26.src/e107_languages/English/admin/lan_credits.php
--- 0.7.24.src/e107_languages/English/admin/lan_credits.php	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_languages/English/admin/lan_credits.php	2010-11-23 05:26:02.000000000 -0600
@@ -4,9 +4,9 @@
 |     e107 website system - Language File.
 |
 |     $URL: https://e107.svn.sourceforge.net/svnroot/e107/trunk/e107_0.7/e107_languages/English/admin/lan_credits.php $
-|     $Revision: 11678 $
-|     $Id: lan_credits.php 11678 2010-08-22 00:43:45Z e107coders $
-|     $Author: e107coders $
+|     $Revision: 11975 $
+|     $Id: lan_credits.php 11975 2010-11-23 11:26:26Z secretr $
+|     $Author: secretr $
 +----------------------------------------------------------------------------+
 */
 
@@ -48,6 +48,10 @@
 define("CRELAN_26", ""); // streaky
 define("CRELAN_27", "\"Wot? No tea?? 0_0\""); // SweetAs
 define("CRELAN_28", ""); // MrPete
+define("CRELAN_29", "Up and forward!"); // SecretR
+define("CRELAN_30", ""); // steved
+//define("CRELAN_31", "");
+//define("CRELAN_32", "");
 
 // end dev team
 
diff -x .svn -aruN 0.7.24.src/e107_languages/English/admin/lan_download.php 0.7.26.src/e107_languages/English/admin/lan_download.php
--- 0.7.24.src/e107_languages/English/admin/lan_download.php	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_languages/English/admin/lan_download.php	2011-04-12 16:25:07.000000000 -0500
@@ -4,9 +4,9 @@
 |     e107 website system - Language File.
 |
 |     $URL: https://e107.svn.sourceforge.net/svnroot/e107/trunk/e107_0.7/e107_languages/English/admin/lan_download.php $
-|     $Revision: 11678 $
-|     $Id: lan_download.php 11678 2010-08-22 00:43:45Z e107coders $
-|     $Author: e107coders $
+|     $Revision: 12132 $
+|     $Id: lan_download.php 12132 2011-04-12 21:25:31Z e107steved $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 define("DOWLAN_1", "Download added to database.");
@@ -116,7 +116,7 @@
 define("DOWLAN_137", "Are you sure you want to delete this mirror?");
 define("DOWLAN_138", "Existing Mirrors");
 define("DOWLAN_139", "Address");
-define("DOWLAN_140", "Upload local images to e107_files/downloadimages to show them here, or enter full address if image is remote");
+define("DOWLAN_140", "Upload local images to ".e_FILE."downloadimages to show them here, or enter full address if image is remote");
 define("DOWLAN_141", "Location");
 define("DOWLAN_142", "Update Mirror");
 define("DOWLAN_143", "Create Mirror");
@@ -145,5 +145,5 @@
 define("DOWLAN_159", "Include sub-sub-category counts in subcategory counts");
 
 define("DOWLAN_160", "Prevent simultaneous downloads by individual users");
-
+define("DOWLAN_161", "Using a splash page to delay the downloading of files");
 ?>
\ No newline at end of file
diff -x .svn -aruN 0.7.24.src/e107_languages/English/admin/lan_footer.php 0.7.26.src/e107_languages/English/admin/lan_footer.php
--- 0.7.24.src/e107_languages/English/admin/lan_footer.php	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_languages/English/admin/lan_footer.php	2011-01-30 13:22:23.000000000 -0600
@@ -4,9 +4,9 @@
 |     e107 website system - Language File.
 |
 |     $URL: https://e107.svn.sourceforge.net/svnroot/e107/trunk/e107_0.7/e107_languages/English/admin/lan_footer.php $
-|     $Revision: 11728 $
-|     $Id: lan_footer.php 11728 2010-08-31 19:10:07Z e107coders $
-|     $Author: e107coders $
+|     $Revision: 12060 $
+|     $Id: lan_footer.php 12060 2011-01-30 19:22:47Z secretr $
+|     $Author: secretr $
 +----------------------------------------------------------------------------+
 */
 define("FOOTLAN_1", "Site");
@@ -28,5 +28,5 @@
 define("FOOTLAN_17", "Charset");
 define("FOOTLAN_18", "Site Theme");
 define("FOOTLAN_19", "Current Server Time");
-
+define("FOOTLAN_20", "Security level");
 ?>
\ No newline at end of file
diff -x .svn -aruN 0.7.24.src/e107_languages/English/admin/lan_language.php 0.7.26.src/e107_languages/English/admin/lan_language.php
--- 0.7.24.src/e107_languages/English/admin/lan_language.php	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_languages/English/admin/lan_language.php	2010-10-04 02:42:51.000000000 -0500
@@ -4,8 +4,8 @@
 |     e107 website system - Language File.
 |
 |     $URL: https://e107.svn.sourceforge.net/svnroot/e107/trunk/e107_0.7/e107_languages/English/admin/lan_language.php $
-|     $Revision: 11786 $
-|     $Id: lan_language.php 11786 2010-09-15 22:12:49Z e107coders $
+|     $Revision: 11842 $
+|     $Id: lan_language.php 11842 2010-10-04 07:43:15Z e107coders $
 |     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
@@ -15,7 +15,7 @@
 define("LANG_LAN_02","couldn't be deleted");
 define("LANG_LAN_03","Tables");
 
-define("LANG_LAN_05","Not Installed");
+define("LANG_LAN_05", "Not Installed");
 define("LANG_LAN_06", "Create tables");
 define("LANG_LAN_07", "Drop existing tables?");
 define("LANG_LAN_08", "Replace existing tables (data will be lost).");
@@ -31,10 +31,10 @@
 define("LANG_LAN_19", "e.g. The domain fr.mydomain.com would set the language to French.");
 define("LANG_LAN_20", "Enter one domain per line. eg. mydomain.com etc. or leave blank to disable.");
 
-define("LANG_LAN_21", "Language Tools");
+define("LANG_LAN_21", "Language-Packs");
 
 define("LANG_LAN_23", "Create Language-Pack (zip)");
-define("LANG_LAN_24", "Generate");
+define("LANG_LAN_24", "Create Pack");
 
 define("LANG_LAN_AGR", "Note: By using these tools you agree to share your language pack(s) with the e107 community.");
 define("LANG_LAN_EML", "Please email your language pack to:");
@@ -44,5 +44,9 @@
 define("LANG_LAN_27", "Please verify your language files ('Verify') then try again.");
 define("LANG_LAN_28", "Check this box if you're an [e107 certified translator].");
 
+define("LANG_LAN_29", "You should correct the remaining errors before contributing your language pack.");
+define("LANG_LAN_30", "Release Date");
+define("LANG_LAN_31", "Compatibility");
+define("LANG_LAN_32", "Installed Languages");
 
 ?>
\ No newline at end of file
diff -x .svn -aruN 0.7.24.src/e107_languages/English/admin/lan_mailout.php 0.7.26.src/e107_languages/English/admin/lan_mailout.php
--- 0.7.24.src/e107_languages/English/admin/lan_mailout.php	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_languages/English/admin/lan_mailout.php	2011-05-02 16:09:21.000000000 -0500
@@ -4,9 +4,9 @@
 |     e107 website system - Language File.
 |
 |     $URL: https://e107.svn.sourceforge.net/svnroot/e107/trunk/e107_0.7/e107_languages/English/admin/lan_mailout.php $
-|     $Revision: 11678 $
-|     $Id: lan_mailout.php 11678 2010-08-22 00:43:45Z e107coders $
-|     $Author: e107coders $
+|     $Revision: 12180 $
+|     $Id: lan_mailout.php 12180 2011-05-02 21:09:45Z e107steved $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 define("PRFLAN_52", "Save Changes");
@@ -95,9 +95,8 @@
 define("MAILAN_66", "Cancelled Successfully");
 define("MAILAN_67", "Use 'POP before SMTP' authentication"); 
 define('MAILAN_68', 'Test address');
-
-
-
+define("MAILAN_69","user login");
+define("MAILAN_70","user email");
 
 
 
diff -x .svn -aruN 0.7.24.src/e107_languages/English/admin/lan_newspost.php 0.7.26.src/e107_languages/English/admin/lan_newspost.php
--- 0.7.24.src/e107_languages/English/admin/lan_newspost.php	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_languages/English/admin/lan_newspost.php	2011-01-04 03:38:22.000000000 -0600
@@ -4,9 +4,9 @@
 |     e107 website system - Language File.
 |
 |     $URL: https://e107.svn.sourceforge.net/svnroot/e107/trunk/e107_0.7/e107_languages/English/admin/lan_newspost.php $
-|     $Revision: 11705 $
-|     $Id: lan_newspost.php 11705 2010-08-26 21:08:37Z e107steved $
-|     $Author: e107steved $
+|     $Revision: 12024 $
+|     $Id: lan_newspost.php 12024 2011-01-04 09:38:46Z e107coders $
+|     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
 define("NWSLAN_1", "News story deleted.");
@@ -176,5 +176,6 @@
 define('LAN_NEWS_53', 'Update complete');
 define('LAN_NEWS_54', 'News Maintenance');
 define('LAN_NEWS_55', 'Author (Posted by)');
+define('LAN_NEWS_56', 'Posted');
 
-?>
+?>
\ No newline at end of file
diff -x .svn -aruN 0.7.24.src/e107_languages/English/admin/lan_plugin.php 0.7.26.src/e107_languages/English/admin/lan_plugin.php
--- 0.7.24.src/e107_languages/English/admin/lan_plugin.php	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_languages/English/admin/lan_plugin.php	2011-05-01 10:57:20.000000000 -0500
@@ -4,9 +4,9 @@
 |     e107 website system - Language File.
 |
 |     $URL: https://e107.svn.sourceforge.net/svnroot/e107/trunk/e107_0.7/e107_languages/English/admin/lan_plugin.php $
-|     $Revision: 11678 $
-|     $Id: lan_plugin.php 11678 2010-08-22 00:43:45Z e107coders $
-|     $Author: e107coders $
+|     $Revision: 12174 $
+|     $Id: lan_plugin.php 12174 2011-05-01 15:57:44Z e107steved $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 define("EPL_ADLAN_0", "Install");
@@ -84,6 +84,8 @@
 // define("EPL_ADLAN_61", "Confirm uninstall"); // duplicated. can be deleted.
 define("EPL_ADLAN_62", "Cancel uninstall");
 define("EPL_ADLAN_63", "Uninstall:");
+define('EPL_ADLAN_64', 'All files removed from ');
+define('EPL_ADLAN_65', 'File deletion failed');
 
 define("LAN_UPGRADE_SUCCESSFUL", "Upgrade Successful");
 define("LAN_INSTALL_SUCCESSFUL", "Installation Successful");
diff -x .svn -aruN 0.7.24.src/e107_languages/English/admin/lan_prefs.php 0.7.26.src/e107_languages/English/admin/lan_prefs.php
--- 0.7.24.src/e107_languages/English/admin/lan_prefs.php	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_languages/English/admin/lan_prefs.php	2010-12-18 16:54:58.000000000 -0600
@@ -10,7 +10,7 @@
  * Site preferences - language file
  *
  * $URL: https://e107.svn.sourceforge.net/svnroot/e107/trunk/e107_0.7/e107_languages/English/admin/lan_prefs.php $
- * $Id: lan_prefs.php 11670 2010-08-20 12:59:41Z e107steved $
+ * $Id: lan_prefs.php 12013 2010-12-18 22:55:22Z e107steved $
  */
 
 define("PRFLAN_1", "Site Information");
@@ -196,6 +196,9 @@
 define('PRFLAN_216', '(Requires HTML posting rights as well)');
 define('PRFLAN_217', 'Filter HTML content');
 define('PRFLAN_218', 'If \'off\', puts users at increased risk of XSS exploits posted by members of the above class, or prior to 0.7.24');
+// Gap for 0.8 compatibility
+define('PRFLAN_220', 'HTML Abuse filter (experimental)');
+define('PRFLAN_221', 'Blocks some unmatched tags for those allowed to post HTML');
 
 
 ?>
\ No newline at end of file
diff -x .svn -aruN 0.7.24.src/e107_languages/English/admin/lan_userclass2.php 0.7.26.src/e107_languages/English/admin/lan_userclass2.php
--- 0.7.24.src/e107_languages/English/admin/lan_userclass2.php	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_languages/English/admin/lan_userclass2.php	2011-06-04 09:14:02.000000000 -0500
@@ -4,9 +4,9 @@
 |     e107 website system - Language File.
 |
 |     $URL: https://e107.svn.sourceforge.net/svnroot/e107/trunk/e107_0.7/e107_languages/English/admin/lan_userclass2.php $
-|     $Revision: 11678 $
-|     $Id: lan_userclass2.php 11678 2010-08-22 00:43:45Z e107coders $
-|     $Author: e107coders $
+|     $Revision: 12246 $
+|     $Id: lan_userclass2.php 12246 2011-06-04 14:14:26Z nlstart $
+|     $Author: nlstart $
 +----------------------------------------------------------------------------+
 */
 define("UCSLAN_1", "Cleared all users from class.");
@@ -37,5 +37,8 @@
 
 define("UCSLAN_24", "Who can manage class");
 
+define("UCSLAN_25", "ID");
+define("UCSLAN_26", "Username");
+define("UCSLAN_27", "Return");
 
 ?>
\ No newline at end of file
diff -x .svn -aruN 0.7.24.src/e107_languages/English/admin/lan_users_extended.php 0.7.26.src/e107_languages/English/admin/lan_users_extended.php
--- 0.7.24.src/e107_languages/English/admin/lan_users_extended.php	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_languages/English/admin/lan_users_extended.php	2011-07-06 08:42:46.000000000 -0500
@@ -4,9 +4,7 @@
 |     e107 website system - Language File.
 |
 |     $URL: https://e107.svn.sourceforge.net/svnroot/e107/trunk/e107_0.7/e107_languages/English/admin/lan_users_extended.php $
-|     $Revision: 11678 $
-|     $Id: lan_users_extended.php 11678 2010-08-22 00:43:45Z e107coders $
-|     $Author: e107coders $
+|     $Id: lan_users_extended.php 12306 2011-07-06 13:43:10Z secretr $
 +----------------------------------------------------------------------------+
 */
 define("EXTLAN_1", "Name");
@@ -91,6 +89,7 @@
 define("EXTLAN_76", "Invalid characters in field name - only A-Z, a-z, 0-9, '_' allowed.");
 define("EXTLAN_77", "Category not deleted - must delete fields in category first: ");
 define('EXTLAN_78', 'Cannot find file --FILE-- needed to create data table');
+define('EXTLAN_79', 'Validation error - aborted.');
 
 
 //textbox
diff -x .svn -aruN 0.7.24.src/e107_languages/English/admin/lan_users.php 0.7.26.src/e107_languages/English/admin/lan_users.php
--- 0.7.24.src/e107_languages/English/admin/lan_users.php	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_languages/English/admin/lan_users.php	2010-10-16 15:12:49.000000000 -0500
@@ -4,9 +4,9 @@
 |     e107 website system - Language File.
 |
 |     $URL: https://e107.svn.sourceforge.net/svnroot/e107/trunk/e107_0.7/e107_languages/English/admin/lan_users.php $
-|     $Revision: 11678 $
-|     $Id: lan_users.php 11678 2010-08-22 00:43:45Z e107coders $
-|     $Author: e107coders $
+|     $Revision: 11897 $
+|     $Id: lan_users.php 11897 2010-10-16 20:13:13Z e107steved $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 define("USRLAN_1", "Options Saved.");
@@ -95,7 +95,7 @@
 
 define("USRLAN_90", "Search/Refresh");
 define("USRLAN_91", "Class");
-define("USRLAN_92", "Invalid characters in username");
+define("USRLAN_92", "Invalid characters in display name");
 
 define("USRLAN_93", "Delete unverified users");
 define("USRLAN_94", "Delete signups if unverified after this amount of time - leave blank to not use this option <br />This option is ignored if user signups are admin moderated");
@@ -157,9 +157,10 @@
 define("USRLAN_154", "Clear email for checked");
 define("USRLAN_155", "Total {TOTAL} emails found. {DELCOUNT} deleted through options.<br />{DELUSER} users marked as 'bounced' (out of {FOUND} emails)");
 define("USRLAN_156", "Email address is already in use");
+define('USRLAN_157', 'Invalid characters in login name');
 
 define("LAN_MAINADMIN","Main Admin");
-define("LAN_ADMIN","Admin");
+//define("LAN_ADMIN","Admin");
 define("LAN_NOTVERIFIED","Not Verified");
 define("LAN_BANNED","Banned");
 define("LAN_BOUNCED","Bounced");
diff -x .svn -aruN 0.7.24.src/e107_languages/English/lan_download.php 0.7.26.src/e107_languages/English/lan_download.php
--- 0.7.24.src/e107_languages/English/lan_download.php	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_languages/English/lan_download.php	2011-01-21 20:11:15.000000000 -0600
@@ -4,8 +4,8 @@
 |     e107 website system - Language File.
 |
 |     $URL: https://e107.svn.sourceforge.net/svnroot/e107/trunk/e107_0.7/e107_languages/English/lan_download.php $
-|     $Revision: 11678 $
-|     $Id: lan_download.php 11678 2010-08-22 00:43:45Z e107coders $
+|     $Revision: 12054 $
+|     $Id: lan_download.php 12054 2011-01-22 02:11:39Z e107coders $
 |     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
@@ -105,5 +105,9 @@
 define("LAN_dl_81", "Cookies Required");
 define("LAN_dl_82", "Please Wait");
 
+//0.7.25
+
+define("LAN_dl_83", "Your download will begin in a moment...");
+define("LAN_dl_84", "If your download doesn't start within a few seconds, please [click here].");
 
 ?>
\ No newline at end of file
diff -x .svn -aruN 0.7.24.src/e107_languages/English/lan_error.php 0.7.26.src/e107_languages/English/lan_error.php
--- 0.7.24.src/e107_languages/English/lan_error.php	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_languages/English/lan_error.php	2010-10-10 14:44:47.000000000 -0500
@@ -4,19 +4,21 @@
 |     e107 website system - Language File.
 |
 |     $URL: https://e107.svn.sourceforge.net/svnroot/e107/trunk/e107_0.7/e107_languages/English/lan_error.php $
-|     $Revision: 11721 $
-|     $Id: lan_error.php 11721 2010-08-30 16:59:06Z e107steved $
+|     $Revision: 11875 $
+|     $Id: lan_error.php 11875 2010-10-10 19:45:11Z e107steved $
 |     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 define("PAGE_NAME", "Error");
 
-define("LAN_ERROR_1", "Error 401 - Permission Denied");
-define("LAN_ERROR_2", "You do not have permission to retrieve the URL or link you requested.");
+define("LAN_ERROR_1", "Error 401 - Authentication Failed");
+define("LAN_ERROR_2", "The URL you've requested requires a correct username and password. Either you entered an incorrect username/password, or your browser doesn't support this feature.");
 define("LAN_ERROR_3", "Please inform the administrator of the referring page if you think this error page has been shown by mistake.");
-define("LAN_ERROR_4", "Error 403 - Authentication Failed");
-define("LAN_ERROR_5", "The URL you've requested requires a correct username and password. Either you entered an incorrect username/password, or your browser doesn't support this feature.");
+
+define("LAN_ERROR_4", "Error 403 - Access forbidden");
+define("LAN_ERROR_5", "You are not permitted to retrieve the URL or link you requested.");
 define("LAN_ERROR_6", "Please inform the administrator of the referring page if you think this error page has been shown by mistake.");
+
 define("LAN_ERROR_7", "Error 404 - Document Not Found");
 define("LAN_ERROR_9", "Please inform the administrator of the referring page if you think this error message has been shown by mistake.");
 define("LAN_ERROR_10", "Error 500 - Malformed Header");
diff -x .svn -aruN 0.7.24.src/e107_languages/English/lan_signup.php 0.7.26.src/e107_languages/English/lan_signup.php
--- 0.7.24.src/e107_languages/English/lan_signup.php	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_languages/English/lan_signup.php	2011-04-12 16:09:21.000000000 -0500
@@ -4,8 +4,8 @@
 |     e107 website system - Language File.
 |
 |     $URL: https://e107.svn.sourceforge.net/svnroot/e107/trunk/e107_0.7/e107_languages/English/lan_signup.php $
-|     $Revision: 11760 $
-|     $Id: lan_signup.php 11760 2010-09-07 17:02:27Z e107steved $
+|     $Revision: 12130 $
+|     $Id: lan_signup.php 12130 2011-04-12 21:09:45Z e107steved $
 |     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
@@ -132,7 +132,8 @@
 
 define('LAN_SIGNUP_102', 'Signup refused');
 define('LAN_SIGNUP_103', 'Too many users already using IP address: ');
-
-
+define('LAN_SIGNUP_104', 'Invalid avatar name');
+define('LAN_SIGNUP_105', 'Unable to action your request - please contact the site administrator');		// Two people with same password.
+define('LAN_SIGNUP_106', 'Unable to action your request - do you already have an account here?');		// Trying to set email same as existing
 
 ?>
\ No newline at end of file
diff -x .svn -aruN 0.7.24.src/e107_languages/English/lan_usersettings.php 0.7.26.src/e107_languages/English/lan_usersettings.php
--- 0.7.24.src/e107_languages/English/lan_usersettings.php	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_languages/English/lan_usersettings.php	2011-05-04 15:37:37.000000000 -0500
@@ -4,8 +4,8 @@
 |     e107 website system - Language File.
 |
 |     $URL: https://e107.svn.sourceforge.net/svnroot/e107/trunk/e107_0.7/e107_languages/English/lan_usersettings.php $
-|     $Revision: 11679 $
-|     $Id: lan_usersettings.php 11679 2010-08-22 18:40:32Z e107steved $
+|     $Revision: 12188 $
+|     $Id: lan_usersettings.php 12188 2011-05-04 20:38:01Z e107steved $
 |     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
@@ -89,13 +89,11 @@
 
 // v.616
 define("LAN_CUSTOMTITLE", "Custom Title");
-//define("LAN_ICQNUMBER", "ICQ number must contain only numbers");
 
 //v.617
 define("LAN_408", "A user with that email address already exists. ");
 define("MAX_AVWIDTH", "Maximum avatar size (wxh) is ");
 define("MAX_AVHEIGHT", " x ");
-// define("GIF_RESIZE", "Please resize gif image or convert to different format");
 define("RESIZE_NOT_SUPPORTED", "Resize method not supported by this server. Please resize image or choose another. File has been deleted.");
 
 // v0.7
@@ -112,5 +110,8 @@
 define("LAN_USET_15", "Display name too long. Please choose another");
 define("LAN_USET_16", "Tick box to delete existing photo without uploading another");
 define("LAN_USET_17", "Display name already used. Please choose another");
+define('LAN_USET_18', 'Invalid name for avatar');
+define('LAN_USET_19', 'Avatar cannot be accessed');
+define('LAN_USET_20', 'Cannot get image information');
 
 ?>
\ No newline at end of file
diff -x .svn -aruN 0.7.24.src/e107_plugins/alt_auth/plugin.php 0.7.26.src/e107_plugins/alt_auth/plugin.php
--- 0.7.24.src/e107_plugins/alt_auth/plugin.php	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_plugins/alt_auth/plugin.php	2011-03-11 12:49:32.000000000 -0600
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $URL: https://e107.svn.sourceforge.net/svnroot/e107/trunk/e107_0.7/e107_plugins/alt_auth/plugin.php $
-|     $Revision: 11678 $
-|     $Id: plugin.php 11678 2010-08-22 00:43:45Z e107coders $
-|     $Author: e107coders $
+|     $Revision: 12092 $
+|     $Id: plugin.php 12092 2011-03-11 18:49:56Z e107steved $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 
@@ -58,7 +58,7 @@
   auth_type varchar(20) NOT NULL default '',
   auth_parmname varchar(30) NOT NULL default '',
   auth_parmval varchar(120) NOT NULL default ''
-) TYPE=MyISAM;");
+) ENGINE=MyISAM;");
 
 
 
diff -x .svn -aruN 0.7.24.src/e107_plugins/calendar_menu/calendar.php 0.7.26.src/e107_plugins/calendar_menu/calendar.php
--- 0.7.24.src/e107_plugins/calendar_menu/calendar.php	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_plugins/calendar_menu/calendar.php	2011-03-12 06:37:53.000000000 -0600
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $URL: https://e107.svn.sourceforge.net/svnroot/e107/trunk/e107_0.7/e107_plugins/calendar_menu/calendar.php $
-|     $Revision: 11678 $
-|     $Id: calendar.php 11678 2010-08-22 00:43:45Z e107coders $
-|     $Author: e107coders $
+|     $Revision: 12098 $
+|     $Id: calendar.php 12098 2011-03-12 12:38:17Z e107steved $
+|     $Author: e107steved $
 |
 | 11.11.06 - steved - mods for next CVS release
 |
@@ -123,6 +123,8 @@
 $nowyear	= $ecal_class->cal_date['year'];
 $nowday		= $ecal_class->cal_date['mday'];
 
+$events = array();
+
 // time switch buttons
 $cal_text = $tp -> parseTemplate($CALENDAR_TIME_TABLE, FALSE, $calendar_shortcodes);
 
diff -x .svn -aruN 0.7.24.src/e107_plugins/calendar_menu/calendar_shortcodes.php 0.7.26.src/e107_plugins/calendar_menu/calendar_shortcodes.php
--- 0.7.24.src/e107_plugins/calendar_menu/calendar_shortcodes.php	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_plugins/calendar_menu/calendar_shortcodes.php	2010-10-25 11:58:08.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $URL: https://e107.svn.sourceforge.net/svnroot/e107/trunk/e107_0.7/e107_plugins/calendar_menu/calendar_shortcodes.php $
-|     $Revision: 11678 $
-|     $Id: calendar_shortcodes.php 11678 2010-08-22 00:43:45Z e107coders $
-|     $Author: e107coders $
+|     $Revision: 11915 $
+|     $Id: calendar_shortcodes.php 11915 2010-10-25 16:58:32Z e107steved $
+|     $Author: e107steved $
 |
 | 10.11.06 - mods for next CVS release
 +----------------------------------------------------------------------------+
@@ -167,18 +167,11 @@
 	}
 	if($ev['startofevent'])
 	{
-	  if (isset($ev['is_recent']))
-	  {
-	    return "<b><a title='{$ev['event_title']}' href='".e_PLUGIN."calendar_menu/event.php?".$linkut.".event.".$ev['event_id']."'><span class='mediumtext'>".$show_title."</span></a></b>";
-	  }
-	  else
-	  {
-	    return "<b><a title='{$ev['event_title']}' href='".e_PLUGIN."calendar_menu/event.php?".$linkut.".event.".$ev['event_id']."'><span class='mediumtext'>".$show_title."</span></a></b>";
-	  }
+	    return "<b><a title='{$ev['event_title']}' href='".e_PLUGIN_ABS."calendar_menu/event.php?".$linkut.".event.".$ev['event_id']."'><span class='mediumtext'>".$show_title."</span></a></b>";
 	}
 	else
 	{
-	  return "<a title='{$ev['event_title']}' href='".e_PLUGIN."calendar_menu/event.php?".$linkut.".event.".$ev['event_id']."'><span class='smalltext'>".$show_title."</span></a>";
+	  return "<a title='{$ev['event_title']}' href='".e_PLUGIN_ABS."calendar_menu/event.php?".$linkut.".event.".$ev['event_id']."'><span class='smalltext'>".$show_title."</span></a>";
 	}
 SC_END
 
@@ -210,17 +203,17 @@
 
 SC_BEGIN CALENDAR_CALENDAR_DAY_TODAY_HEADING
 	global $CALENDAR_CALENDAR_DAY_TODAY_HEADING, $startt, $c, $days;
-	return "<b><a href='".e_PLUGIN."calendar_menu/event.php?".$startt."'>".$days[($c-1)]."</a></b> <span class='smalltext'>[".EC_LAN_TODAY."]</span>";
+	return "<b><a href='".e_PLUGIN_ABS."calendar_menu/event.php?".$startt."'>".$days[($c-1)]."</a></b> <span class='smalltext'>[".EC_LAN_TODAY."]</span>";
 SC_END
 
 SC_BEGIN CALENDAR_CALENDAR_DAY_EVENT_HEADING
 	global $CALENDAR_CALENDAR_DAY_EVENT_HEADING, $startt, $c, $days;
-	return "<a href='".e_PLUGIN."calendar_menu/event.php?".$startt.".one'>".$days[($c-1)]."</a>";
+	return "<a href='".e_PLUGIN_ABS."calendar_menu/event.php?".$startt.".one'>".$days[($c-1)]."</a>";
 SC_END
 
 SC_BEGIN CALENDAR_CALENDAR_DAY_EMPTY_HEADING
 	global $CALENDAR_CALENDAR_DAY_EMPTY_HEADING, $startt, $c, $days;
-	return "<a href='".e_PLUGIN."calendar_menu/event.php?".$startt."'>".$days[($c-1)]."</a>";
+	return "<a href='".e_PLUGIN_ABS."calendar_menu/event.php?".$startt."'>".$days[($c-1)]."</a>";
 SC_END
 
 
diff -x .svn -aruN 0.7.24.src/e107_plugins/calendar_menu/calendar_sql.php 0.7.26.src/e107_plugins/calendar_menu/calendar_sql.php
--- 0.7.24.src/e107_plugins/calendar_menu/calendar_sql.php	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_plugins/calendar_menu/calendar_sql.php	2011-03-11 12:49:32.000000000 -0600
@@ -15,7 +15,7 @@
 	event_rec_m tinyint(2) unsigned NOT NULL default '0',
 	event_rec_y tinyint(2) unsigned NOT NULL default '0',
 	PRIMARY KEY  (event_id)
-	) TYPE=MyISAM;,
+	) ENGINE=MyISAM;,
 	CREATE TABLE event_cat (
 	event_cat_id smallint(5) unsigned NOT NULL auto_increment,
 	event_cat_name varchar(100) NOT NULL default '',
@@ -33,10 +33,10 @@
 	event_cat_description text,
 	event_cat_force_class int(10) unsigned NOT NULL default '0',
 	PRIMARY KEY  (event_cat_id)
-	) TYPE=MyISAM;,
+	) ENGINE=MyISAM;,
 	CREATE TABLE event_subs (
 	event_subid int(10) unsigned NOT NULL auto_increment,
 	event_userid  int(10) unsigned NOT NULL default '0',
 	event_cat  int(10) unsigned NOT NULL default '0',
 	PRIMARY KEY  (event_subid)
-	) TYPE=MyISAM;
+	) ENGINE=MyISAM;
diff -x .svn -aruN 0.7.24.src/e107_plugins/calendar_menu/ecal_class.php 0.7.26.src/e107_plugins/calendar_menu/ecal_class.php
--- 0.7.24.src/e107_plugins/calendar_menu/ecal_class.php	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_plugins/calendar_menu/ecal_class.php	2011-09-02 05:37:40.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $URL: https://e107.svn.sourceforge.net/svnroot/e107/trunk/e107_0.7/e107_plugins/calendar_menu/ecal_class.php $
-|     $Revision: 11678 $
-|     $Id: ecal_class.php 11678 2010-08-22 00:43:45Z e107coders $
-|     $Author: e107coders $
+|     $Revision: 12341 $
+|     $Id: ecal_class.php 12341 2011-09-02 10:38:04Z secretr $
+|     $Author: secretr $
 |
 | Event calendar class for gradual enhancement
 | (Some bits may be usefully transferred to common code later)
@@ -208,8 +208,7 @@
 	   //	2 - edit event
 	   //	3 - delete event
 	   // 	4 - Bulk delete
-	  global $pref, $admin_log, $e_event;
-	  
+	  global $pref, $admin_log, $e_event, $e107;
 	  $log_titles = array(	'1' => 'Event Calendar - add event',
 							'2' => 'Event Calendar - edit event',
 							'3' => 'Event Calendar - delete event',
@@ -221,7 +220,7 @@
 	    $cmessage .= "Event Start: ".strftime("%d-%B-%Y",$event_start)."<br />";
 	  else
 	    $cmessage .= "Event Start unknown<br />";
-	  $edata_ec = array("cmessage" => $cmessage, "ip" => getip());
+	  $edata_ec = array("cmessage" => $cmessage, "ip" => $e107->getip());
 	  switch ($event_type)
 	  {
 	    case 1 : $e_event -> trigger("ecalnew", $edata_ec);
diff -x .svn -aruN 0.7.24.src/e107_plugins/calendar_menu/plugin.php 0.7.26.src/e107_plugins/calendar_menu/plugin.php
--- 0.7.24.src/e107_plugins/calendar_menu/plugin.php	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_plugins/calendar_menu/plugin.php	2011-05-02 15:45:16.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $URL: https://e107.svn.sourceforge.net/svnroot/e107/trunk/e107_0.7/e107_plugins/calendar_menu/plugin.php $
-|     $Revision: 11678 $ - with mods to hopefully trigger upgrade to new version
-|     $Id: plugin.php 11678 2010-08-22 00:43:45Z e107coders $
-|     $Author: e107coders $
+|     $Revision: 12178 $ - with mods to hopefully trigger upgrade to new version
+|     $Id: plugin.php 12178 2011-05-02 20:45:40Z e107steved $
+|     $Author: e107steved $
 |
 | 22.07.06 - Mods for V3.6 upgrade, including log directory
 | 02.08.06 - Support for category icon display added
@@ -117,7 +117,7 @@
 	event_rec_m tinyint(2) unsigned NOT NULL default '0',
 	event_rec_y tinyint(2) unsigned NOT NULL default '0',
 	PRIMARY KEY  (event_id)
-	) TYPE=MyISAM;",
+	) ENGINE=MyISAM;",
 	"CREATE TABLE ".MPREFIX."event_cat (
 	event_cat_id smallint(5) unsigned NOT NULL auto_increment,
 	event_cat_name varchar(100) NOT NULL default '',
@@ -135,14 +135,14 @@
 	event_cat_description text,
 	event_cat_force_class int(10) unsigned NOT NULL default '0',
 	PRIMARY KEY  (event_cat_id)
-	) TYPE=MyISAM;"
+	) ENGINE=MyISAM;"
 	,
 	"CREATE TABLE ".MPREFIX."event_subs (
 	event_subid int(10) unsigned NOT NULL auto_increment,
 	event_userid  int(10) unsigned NOT NULL default '0',
 	event_cat  int(10) unsigned NOT NULL default '0',
 	PRIMARY KEY  (event_subid)
-	) TYPE=MyISAM;");
+	) ENGINE=MyISAM;");
 
 
 // Create a link in main menu (yes=TRUE, no=FALSE) -------------------------------------------------------------
@@ -224,7 +224,7 @@
 	event_userid  int(10) unsigned NOT NULL default '0',
 	event_cat  int(10) unsigned NOT NULL default '0',
 	PRIMARY KEY  (event_subid)
-	) TYPE=MyISAM;"
+	) ENGINE=MyISAM;"
 );
 $version_notes .= "<u>3.5</u><br />".EC_ADLAN_A156."<br />";
 }
diff -x .svn -aruN 0.7.24.src/e107_plugins/chatbox_menu/chatbox_menu.php 0.7.26.src/e107_plugins/chatbox_menu/chatbox_menu.php
--- 0.7.24.src/e107_plugins/chatbox_menu/chatbox_menu.php	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_plugins/chatbox_menu/chatbox_menu.php	2010-09-24 04:01:32.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $URL: https://e107.svn.sourceforge.net/svnroot/e107/trunk/e107_0.7/e107_plugins/chatbox_menu/chatbox_menu.php $
-|     $Revision: 11678 $
-|     $Id: chatbox_menu.php 11678 2010-08-22 00:43:45Z e107coders $
-|     $Author: e107coders $
+|     $Revision: 11818 $
+|     $Id: chatbox_menu.php 11818 2010-09-24 09:01:56Z secretr $
+|     $Author: secretr $
 +----------------------------------------------------------------------------+
 */
 
@@ -23,6 +23,7 @@
 {
 	if(isset($_POST['chat_submit']))
 	{
+		define('e_TOKEN_FREEZE', true);
 		include_once("../../class2.php");
 
 		//Normally the menu.sc file will auto-load the language file, this is needed in case
diff -x .svn -aruN 0.7.24.src/e107_plugins/chatbox_menu/chatbox_sql.php 0.7.26.src/e107_plugins/chatbox_menu/chatbox_sql.php
--- 0.7.24.src/e107_plugins/chatbox_menu/chatbox_sql.php	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_plugins/chatbox_menu/chatbox_sql.php	2011-03-11 12:49:32.000000000 -0600
@@ -6,4 +6,4 @@
 	cb_blocked tinyint(3) unsigned NOT NULL default '0',
 	cb_ip varchar(15) NOT NULL default '',
 	PRIMARY KEY  (cb_id)
-	) TYPE=MyISAM;
\ No newline at end of file
+	) ENGINE=MyISAM;
\ No newline at end of file
diff -x .svn -aruN 0.7.24.src/e107_plugins/chatbox_menu/chat.php 0.7.26.src/e107_plugins/chatbox_menu/chat.php
--- 0.7.24.src/e107_plugins/chatbox_menu/chat.php	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_plugins/chatbox_menu/chat.php	2011-01-14 12:28:33.000000000 -0600
@@ -4,19 +4,25 @@
 |     e107 website system
 |
 |     Copyright (C) 2001-2002 Steve Dunstan (jalist@e107.org)
-|     Copyright (C) 2008-2010 e107 Inc (e107.org)
+|     Copyright (C) 2008-2011 e107 Inc (e107.org)
 |
 |
 |     Released under the terms and conditions of the
 |     GNU General Public License (http://gnu.org).
 |
 |     $URL: https://e107.svn.sourceforge.net/svnroot/e107/trunk/e107_0.7/e107_plugins/chatbox_menu/chat.php $
-|     $Revision: 11678 $
-|     $Id: chat.php 11678 2010-08-22 00:43:45Z e107coders $
-|     $Author: e107coders $
+|     $Revision: 12040 $
+|     $Id: chat.php 12040 2011-01-14 18:28:57Z e107steved $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 require_once("../../class2.php");
+if (!isset($pref['plug_installed']['chatbox_menu']))
+{
+	header('Location: '.e_BASE.'index.php');
+	exit;
+}
+
 include_lan(e_PLUGIN."chatbox_menu/languages/".e_LANGUAGE."/".e_LANGUAGE.".php");
 
 require_once(HEADERF);
diff -x .svn -aruN 0.7.24.src/e107_plugins/chatbox_menu/plugin.php 0.7.26.src/e107_plugins/chatbox_menu/plugin.php
--- 0.7.24.src/e107_plugins/chatbox_menu/plugin.php	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_plugins/chatbox_menu/plugin.php	2011-05-02 15:45:16.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $URL: https://e107.svn.sourceforge.net/svnroot/e107/trunk/e107_0.7/e107_plugins/chatbox_menu/plugin.php $
-|     $Revision: 11678 $
-|     $Id: plugin.php 11678 2010-08-22 00:43:45Z e107coders $
-|     $Author: e107coders $
+|     $Revision: 12178 $
+|     $Id: plugin.php 12178 2011-05-02 20:45:40Z e107steved $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 
@@ -70,7 +70,7 @@
 	cb_blocked tinyint(3) unsigned NOT NULL default '0',
 	cb_ip varchar(15) NOT NULL default '',
 	PRIMARY KEY  (cb_id)
-	) TYPE=MyISAM;"
+	) ENGINE=MyISAM;"
 );
 
 // Create a link in main menu (yes=TRUE, no=FALSE) -------------------------------------------------------------
diff -x .svn -aruN 0.7.24.src/e107_plugins/clock_menu/clock_menu.php 0.7.26.src/e107_plugins/clock_menu/clock_menu.php
--- 0.7.24.src/e107_plugins/clock_menu/clock_menu.php	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_plugins/clock_menu/clock_menu.php	2010-12-18 16:23:33.000000000 -0600
@@ -17,9 +17,9 @@
 | GNU General Public License (http://gnu.org).
 |
 |     $URL: https://e107.svn.sourceforge.net/svnroot/e107/trunk/e107_0.7/e107_plugins/clock_menu/clock_menu.php $
-|     $Revision: 11678 $
-|     $Id: clock_menu.php 11678 2010-08-22 00:43:45Z e107coders $
-|     $Author: e107coders $
+|     $Revision: 12012 $
+|     $Id: clock_menu.php 12012 2010-12-18 22:23:57Z e107steved $
+|     $Author: e107steved $
 +---------------------------------------------------------------+
 */
 
@@ -59,7 +59,7 @@
 </script>
 <?php
 echo "
-<script type='text/javascript' src='".e_PLUGIN."clock_menu/clock.js'></script>
+<script type='text/javascript' src='".e_PLUGIN_ABS."clock_menu/clock.js'></script>
 
 <script type=\"text/javascript\">\nwindow.setTimeout(\"tick('".$menu_pref['clock_dateprefix']."', '".$menu_pref['clock_format']."', '".$menu_pref['clock_datesuffix1']."', '".$menu_pref['clock_datesuffix2']."', '".$menu_pref['clock_datesuffix3']."', '".$menu_pref['clock_datesuffix4']."')\",150);\n</script>
 <!-- ### end clock ### //-->\n\n";
diff -x .svn -aruN 0.7.24.src/e107_plugins/content/admin_content_config.php 0.7.26.src/e107_plugins/content/admin_content_config.php
--- 0.7.24.src/e107_plugins/content/admin_content_config.php	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_plugins/content/admin_content_config.php	2010-10-09 06:51:25.000000000 -0500
@@ -10,9 +10,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $URL: https://e107.svn.sourceforge.net/svnroot/e107/trunk/e107_0.7/e107_plugins/content/admin_content_config.php $
-|     $Revision: 11729 $
-|     $Id: admin_content_config.php 11729 2010-08-31 19:25:08Z e107steved $
-|     $Author: e107steved $
+|     $Revision: 11869 $
+|     $Id: admin_content_config.php 11869 2010-10-09 11:51:49Z e107coders $
+|     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
 
@@ -30,6 +30,10 @@
 require_once(e_HANDLER."calendar/calendar_class.php");
 $cal = new DHTML_Calendar(true);
 
+if(e_QUERY){
+	$qs = explode(".", e_QUERY);
+}
+
 require_once(e_ADMIN."auth.php");
 require_once(e_HANDLER."form_handler.php");
 $rs = new form;
@@ -52,9 +56,7 @@
 $deltest = array_flip($_POST);
 
 // check query
-if(e_QUERY){
-	$qs = explode(".", e_QUERY);
-}
+
 
 if(isset($_POST['delete']))
 {
diff -x .svn -aruN 0.7.24.src/e107_plugins/content/content_manager.php 0.7.26.src/e107_plugins/content/content_manager.php
--- 0.7.24.src/e107_plugins/content/content_manager.php	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_plugins/content/content_manager.php	2011-01-14 12:41:30.000000000 -0600
@@ -10,9 +10,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $URL: https://e107.svn.sourceforge.net/svnroot/e107/trunk/e107_0.7/e107_plugins/content/content_manager.php $
-|     $Revision: 11678 $
-|     $Id: content_manager.php 11678 2010-08-22 00:43:45Z e107coders $
-|     $Author: e107coders $
+|     $Revision: 12042 $
+|     $Id: content_manager.php 12042 2011-01-14 18:41:54Z e107steved $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 
@@ -34,6 +34,10 @@
 $eArrayStorage = new ArrayData();
 require_once(e_HANDLER."file_class.php");
 $fl = new e_file;
+
+require_once(e_HANDLER."calendar/calendar_class.php");
+$cal = new DHTML_Calendar(true);
+
 require_once($plugindir."handlers/content_class.php");
 $aa = new content;
 require_once($plugindir."handlers/content_db_class.php");
@@ -77,6 +81,8 @@
 function headerjs()
 {
 	echo "<script type='text/javascript' src='".e_FILE."popup.js'></script>\n";
+	global $cal;
+	return $cal->load_files();
 }
 // ##### DB ---------------------------------------------------------------------------------------
 
diff -x .svn -aruN 0.7.24.src/e107_plugins/content/content.php 0.7.26.src/e107_plugins/content/content.php
--- 0.7.24.src/e107_plugins/content/content.php	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_plugins/content/content.php	2011-05-28 07:06:35.000000000 -0500
@@ -10,9 +10,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $URL: https://e107.svn.sourceforge.net/svnroot/e107/trunk/e107_0.7/e107_plugins/content/content.php $
-|     $Revision: 11678 $
-|     $Id: content.php 11678 2010-08-22 00:43:45Z e107coders $
-|     $Author: e107coders $
+|     $Revision: 12232 $
+|     $Id: content.php 12232 2011-05-28 12:06:59Z e107steved $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 
@@ -1139,14 +1139,15 @@
 }
 
 // ##### CONTENT ITEM ------------------------------------------
-function show_content_item(){
+function show_content_item()
+{
 		global $pref, $content_pref, $content_icon_path, $content_image_path, $content_file_path, $custom, $plugindir, $plugintable, $array, $content_shortcodes, $datequery, $order, $nextprevquery, $from, $number, $row, $qs, $gen, $sql, $aa, $tp, $rs, $cobj, $e107, $e107cache, $eArrayStorage, $ns, $rater, $ep, $row, $authordetails, $mainparent; 
 		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') )
+		if (isset($qs[2]) && ($qs[2]=='rated' || (is_numeric($qs[2]) && $qs[3]=='rated') ))
 		{
 			$e107cache->clear("$plugintable.content.$qs[1]");
 			$e107cache->clear("comment.$plugintable.$qs[1]");
@@ -1209,7 +1210,15 @@
 				}
 			}
 
-			if(!isset($qs[2])){ $cacheid = 1; }else{ $cacheid = $qs[2]; }
+			if(!isset($qs[2]) || ($qs[2] = intval($qs[2])) <= 0)
+			{ 
+				$cacheid = 1; 
+				$qs[2] = 1;			// Force first page
+			}
+			else
+			{ 
+				$cacheid = $qs[2]; 
+			}
 			$cachestr = "$plugintable.content.$qs[1].$cacheid";
 			$cachecheck = CachePre($cachestr);
 			if($cachecheck)
@@ -1260,8 +1269,16 @@
 
 					$CONTENT_CONTENT_TABLE_TEXT = $pages[(!$qs[2] ? 0 : $qs[2]-1)];
 					$options = "";
-					for ($i=0; $i < count($pages); $i++) {
-						if(!isset($qs[2])){ $idp = 1; }else{ $idp = $qs[2]; }
+					for ($i=0; $i < count($pages); $i++) 
+					{
+						if(!isset($qs[2]))
+						{ 
+							$idp = 1; 
+						}
+						else
+						{ 
+							$idp = $qs[2]; 
+						}
 						if($idp == $i+1){ $pre = CONTENT_LAN_92; }else{ $pre = ""; }
 						if($matches[0][$i] == "[newpage]"){
 							$pagename[$i] = CONTENT_LAN_78;
diff -x .svn -aruN 0.7.24.src/e107_plugins/content/content_sql.php 0.7.26.src/e107_plugins/content/content_sql.php
--- 0.7.24.src/e107_plugins/content/content_sql.php	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_plugins/content/content_sql.php	2011-03-11 12:49:32.000000000 -0600
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $URL: https://e107.svn.sourceforge.net/svnroot/e107/trunk/e107_0.7/e107_plugins/content/content_sql.php $
-|     $Revision: 11678 $
-|     $Id: content_sql.php 11678 2010-08-22 00:43:45Z e107coders $
-|     $Author: e107coders $
+|     $Revision: 12092 $
+|     $Id: content_sql.php 12092 2011-03-11 18:49:56Z e107steved $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 header("location:../index.php");
@@ -46,6 +46,6 @@
   content_meta text NOT NULL,
   content_layout varchar(255) NOT NULL default '',
   PRIMARY KEY  (content_id)
-) TYPE=MyISAM;
+) ENGINE=MyISAM;
 # --------------------------------------------------------
 
diff -x .svn -aruN 0.7.24.src/e107_plugins/content/content_update.php 0.7.26.src/e107_plugins/content/content_update.php
--- 0.7.24.src/e107_plugins/content/content_update.php	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_plugins/content/content_update.php	2011-05-02 15:45:16.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $URL: https://e107.svn.sourceforge.net/svnroot/e107/trunk/e107_0.7/e107_plugins/content/content_update.php $
-|     $Revision: 11678 $
-|     $Id: content_update.php 11678 2010-08-22 00:43:45Z e107coders $
-|     $Author: e107coders $
+|     $Revision: 12178 $
+|     $Id: content_update.php 12178 2011-05-02 20:45:40Z e107steved $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 if (!defined('e107_INIT')) { exit; }
@@ -66,7 +66,7 @@
 	content_meta text NOT NULL,
 	content_layout varchar(255) NOT NULL default '',
 	PRIMARY KEY  (content_id)
-	) TYPE=MyISAM;";
+	) ENGINE=MyISAM;";
 	
 	$sql->db_Select_gen($query);
 }
diff -x .svn -aruN 0.7.24.src/e107_plugins/content/e_emailprint.php 0.7.26.src/e107_plugins/content/e_emailprint.php
--- 0.7.24.src/e107_plugins/content/e_emailprint.php	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_plugins/content/e_emailprint.php	2011-04-18 07:32:10.000000000 -0500
@@ -1,5 +1,5 @@
 <?php
-/* $Id: e_emailprint.php 11581 2010-06-20 20:05:23Z e107steved $ */
+/* $Id: e_emailprint.php 12141 2011-04-18 12:32:34Z e107steved $ */
 
 if (!defined('e107_INIT')) { exit; }
 
@@ -26,7 +26,7 @@
 		$row['content_heading']		= $tp -> toHTML($row['content_heading']);
 		$row['content_subheading']	= $tp -> toHTML($row['content_subheading']);
 		$row['content_text']		= $tp -> replaceConstants($row['content_text']);
-		$row['content_text']		= preg_replace("/\{EMAILPRINT\}|\[newpage\]/", "", $tp -> toHTML($row['content_text'], TRUE));
+		$row['content_text']		= preg_replace("/\{EMAILPRINT\}|\[newpage(?:\=.*?){0,1}\]/", "", $tp -> toHTML($row['content_text'], TRUE));
 		$authordetails				= $aa -> getAuthor($row['content_author']);
 		$row['content_datestamp']	= $con -> convert_date($row['content_datestamp'], "long");
 
diff -x .svn -aruN 0.7.24.src/e107_plugins/content/e_meta.php 0.7.26.src/e107_plugins/content/e_meta.php
--- 0.7.24.src/e107_plugins/content/e_meta.php	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_plugins/content/e_meta.php	2011-04-15 13:03:42.000000000 -0500
@@ -11,13 +11,15 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $URL: https://e107.svn.sourceforge.net/svnroot/e107/trunk/e107_0.7/e107_plugins/content/e_meta.php $
-|     $Revision: 11678 $
-|     $Id: e_meta.php 11678 2010-08-22 00:43:45Z e107coders $
-|     $Author: e107coders $
+|     $Revision: 12136 $
+|     $Id: e_meta.php 12136 2011-04-15 18:04:06Z e107steved $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 if (!defined('e107_INIT')) { exit; }
 
+if (substr(e_PAGE, 0, 7) != 'content') return;
+
 echo "<script type='text/javascript' src='".e_FILE."popup.js'></script>\n";
 
 if(e_QUERY){
diff -x .svn -aruN 0.7.24.src/e107_plugins/content/handlers/content_convert_class.php 0.7.26.src/e107_plugins/content/handlers/content_convert_class.php
--- 0.7.24.src/e107_plugins/content/handlers/content_convert_class.php	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_plugins/content/handlers/content_convert_class.php	2011-06-28 20:07:04.000000000 -0500
@@ -10,14 +10,18 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $URL: https://e107.svn.sourceforge.net/svnroot/e107/trunk/e107_0.7/e107_plugins/content/handlers/content_convert_class.php $
-|     $Revision: 11678 $
-|     $Id: content_convert_class.php 11678 2010-08-22 00:43:45Z e107coders $
+|     $Revision: 12289 $
+|     $Id: content_convert_class.php 12289 2011-06-29 01:07:28Z e107coders $
 |     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
 
 if (!defined('e107_INIT')) { exit; }
-
+if (!isset($pref['plug_installed']['content']))
+{
+	header('location:'.e_BASE.'index.php');
+	exit;
+}
 $plugindir		= e_PLUGIN."content/";
 $plugintable	= "pcontent";		//name of the table used in this plugin (never remove this, as it's being used throughout the plugin !!)
 $datequery		= " AND content_datestamp < ".time()." AND (content_enddate=0 || content_enddate>".time().") ";
diff -x .svn -aruN 0.7.24.src/e107_plugins/content/handlers/content_form_class.php 0.7.26.src/e107_plugins/content/handlers/content_form_class.php
--- 0.7.24.src/e107_plugins/content/handlers/content_form_class.php	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_plugins/content/handlers/content_form_class.php	2011-06-28 20:07:04.000000000 -0500
@@ -10,13 +10,18 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $URL: https://e107.svn.sourceforge.net/svnroot/e107/trunk/e107_0.7/e107_plugins/content/handlers/content_form_class.php $
-|     $Revision: 11729 $
-|     $Id: content_form_class.php 11729 2010-08-31 19:25:08Z e107steved $
-|     $Author: e107steved $
+|     $Revision: 12289 $
+|     $Id: content_form_class.php 12289 2011-06-29 01:07:28Z e107coders $
+|     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
 
 if (!defined('e107_INIT')) { exit; }
+if (!isset($pref['plug_installed']['content']))
+{
+	header('location:'.e_BASE.'index.php');
+	exit;
+}
 
 $plugindir		= e_PLUGIN."content/";
 $plugintable	= "pcontent";		//name of the table used in this plugin (never remove this, as it's being used throughout the plugin !!)
diff -x .svn -aruN 0.7.24.src/e107_plugins/content/plugin.php 0.7.26.src/e107_plugins/content/plugin.php
--- 0.7.24.src/e107_plugins/content/plugin.php	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_plugins/content/plugin.php	2011-05-02 15:45:16.000000000 -0500
@@ -10,9 +10,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $URL: https://e107.svn.sourceforge.net/svnroot/e107/trunk/e107_0.7/e107_plugins/content/plugin.php $
-|     $Revision: 11678 $
-|     $Id: plugin.php 11678 2010-08-22 00:43:45Z e107coders $
-|     $Author: e107coders $
+|     $Revision: 12178 $
+|     $Id: plugin.php 12178 2011-05-02 20:45:40Z e107steved $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 
@@ -83,7 +83,7 @@
 	content_meta text NOT NULL,
 	content_layout varchar(255) NOT NULL default '',
 	PRIMARY KEY  (content_id)
-	) TYPE=MyISAM;",
+	) ENGINE=MyISAM;",
 	"INSERT INTO ".MPREFIX."pcontent VALUES (1, 'content', '', '', '', '1', '', '', '', '0', '0', '0', '0', '', '".time()."', '0', '0', '', '1', '0', '', '')",
 	"INSERT INTO ".MPREFIX."pcontent VALUES (2, 'article', '', '', '', '1', '', '', '', '0', '0', '0', '0', '', '".time()."', '0', '0', '', '2', '0', '', '')",
 	"INSERT INTO ".MPREFIX."pcontent VALUES (3, 'review', '', '', '', '1', '', '', '', '0', '0', '0', '0', '', '".time()."', '0', '0', '', '3', '0', '', '')"
diff -x .svn -aruN 0.7.24.src/e107_plugins/featurebox/plugin.php 0.7.26.src/e107_plugins/featurebox/plugin.php
--- 0.7.24.src/e107_plugins/featurebox/plugin.php	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_plugins/featurebox/plugin.php	2011-05-02 15:45:16.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $URL: https://e107.svn.sourceforge.net/svnroot/e107/trunk/e107_0.7/e107_plugins/featurebox/plugin.php $
-|     $Revision: 11678 $
-|     $Id: plugin.php 11678 2010-08-22 00:43:45Z e107coders $
-|     $Author: e107coders $
+|     $Revision: 12178 $
+|     $Id: plugin.php 12178 2011-05-02 20:45:40Z e107steved $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 
@@ -63,7 +63,7 @@
   fb_rendertype tinyint(1) unsigned NOT NULL default '0',
   fb_template varchar(50) NOT NULL default '',
   PRIMARY KEY  (fb_id)
-) TYPE=MyISAM AUTO_INCREMENT=1 ;");
+) ENGINE=MyISAM AUTO_INCREMENT=1 ;");
 
 // Create a link in main menu (yes=TRUE, no=FALSE) -------------------------------------------------------------
 $eplug_link = FALSE;
diff -x .svn -aruN 0.7.24.src/e107_plugins/forum/e_emailprint.php 0.7.26.src/e107_plugins/forum/e_emailprint.php
--- 0.7.24.src/e107_plugins/forum/e_emailprint.php	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_plugins/forum/e_emailprint.php	2010-10-07 14:00:06.000000000 -0500
@@ -1,57 +1,67 @@
-<?php
-if (!defined('e107_INIT')) { exit; }
-
-function print_item($thread_id)
-{
-	global $tp;
-	$gen = new convert;
-	include_once(e_PLUGIN.'forum/forum_class.php');
-	$forum = new e107forum;
-	$thread_info = $forum->thread_get($thread_id,0,999);
-	$thread_name = $tp -> toHTML($thread_info[0]['thread_name'], TRUE);
-	$text = "<b>".$thread_name."</b><br />
-	".$thread_info[0]['user_name'].", ".$gen->convert_date($thread_info[0]['thread_datestamp'], "forum")."<br /><br />
-	".$tp -> toHTML($thread_info[0]['thread_thread'], TRUE);
-
-
-	$count = 1;
-	
-	unset($thread_info[0], $thread_info['head']);
-	foreach($thread_info as $reply)
-	{
-		$text .= "<br /><br />Re: <b>".$thread_name."</b><br />
-		".$reply['user_name'].", ".$gen->convert_date($reply['thread_datestamp'], "forum")."<br /><br />
-		".$tp -> toHTML($reply['thread_thread'], TRUE);
-	}
-
-
-//	return "<pre>".print_r($thread_info,TRUE)."</pre>";
-	return $text;
-}
-
-function email_item($thread_id)
-{
-	global $tp;
-	$gen = new convert;
-	include_once(e_PLUGIN.'forum/forum_class.php');
-	$forum = new e107forum;
-	$thread_info = $forum->thread_get($thread_id,0,999);
-
-	$thread_name = $tp -> toHTML($thread_info[0]['thread_name'], TRUE);
-	$text = "<b>".$thread_name."</b><br />
-	".$thread_info[0]['user_name'].", ".$gen->convert_date($thread_info[0]['thread_datestamp'], "forum")."<br /><br />
-	".$tp -> toHTML($thread_info[0]['thread_thread'], TRUE);
-
-	$count = 1;
-
-	unset($thread_info[0], $thread_info['head']);
-	foreach($thread_info as $reply)
-	{
-		$text .= "<br /><br />Re: <b>".$thread_name."</b><br />
-		".$reply['user_name'].", ".$gen->convert_date($reply['thread_datestamp'], "forum")."<br /><br />
-		".$tp -> toHTML($reply['thread_thread'], TRUE);
-	}
-	return $text;
-}
-
+<?php
+if (!defined('e107_INIT')) { exit; }
+
+function print_item($thread_id)
+{
+	global $tp;
+	$gen = new convert;
+	include_once(e_PLUGIN.'forum/forum_class.php');
+	$forum = new e107forum;
+	if (!$forum->thread_get_allowed($thread_id))
+	{
+		echo "Insufficient permissions";
+		exit;
+	}
+	$thread_info = $forum->thread_get($thread_id,0,999);
+	$thread_name = $tp -> toHTML($thread_info[0]['thread_name'], TRUE);
+	$text = "<b>".$thread_name."</b><br />
+	".$thread_info[0]['user_name'].", ".$gen->convert_date($thread_info[0]['thread_datestamp'], "forum")."<br /><br />
+	".$tp -> toHTML($thread_info[0]['thread_thread'], TRUE);
+
+
+	$count = 1;
+	
+	unset($thread_info[0], $thread_info['head']);
+	foreach($thread_info as $reply)
+	{
+		$text .= "<br /><br />Re: <b>".$thread_name."</b><br />
+		".$reply['user_name'].", ".$gen->convert_date($reply['thread_datestamp'], "forum")."<br /><br />
+		".$tp -> toHTML($reply['thread_thread'], TRUE);
+	}
+
+
+//	return "<pre>".print_r($thread_info,TRUE)."</pre>";
+	return $text;
+}
+
+function email_item($thread_id)
+{
+	global $tp;
+	$gen = new convert;
+	include_once(e_PLUGIN.'forum/forum_class.php');
+	$forum = new e107forum;
+	if (!$forum->thread_get_allowed($thread_id))
+	{
+		echo "Insufficient permissions";
+		exit;
+	}
+	$thread_info = $forum->thread_get($thread_id,0,999);
+
+	$thread_name = $tp -> toHTML($thread_info[0]['thread_name'], TRUE);
+	$text = "<b>".$thread_name."</b><br />
+	".$thread_info[0]['user_name'].", ".$gen->convert_date($thread_info[0]['thread_datestamp'], "forum")."<br /><br />
+	".$tp -> toHTML($thread_info[0]['thread_thread'], TRUE);
+
+	$count = 1;
+
+	unset($thread_info[0], $thread_info['head']);
+	foreach($thread_info as $reply)
+	{
+		$text .= "<br /><br />Re: <b>".$thread_name."</b><br />
+		".$reply['user_name'].", ".$gen->convert_date($reply['thread_datestamp'], "forum")."<br /><br />
+		".$tp -> toHTML($reply['thread_thread'], TRUE);
+	}
+	return $text;
+}
+
 ?>
\ No newline at end of file
diff -x .svn -aruN 0.7.24.src/e107_plugins/forum/e_list.php 0.7.26.src/e107_plugins/forum/e_list.php
--- 0.7.24.src/e107_plugins/forum/e_list.php	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_plugins/forum/e_list.php	2011-05-29 05:35:53.000000000 -0500
@@ -7,14 +7,14 @@
 * GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
 *
 * $URL: https://e107.svn.sourceforge.net/svnroot/e107/trunk/e107_0.7/e107_plugins/forum/e_list.php $
-* $Id: e_list.php 11479 2010-04-16 02:35:56Z mcfly_e107 $
+* $Id: e_list.php 12237 2011-05-29 10:36:17Z e107steved $
 *
 */
 
 /**
 *	@package e107
 *	@subpackage	forum
-*	@version $Id: e_list.php 11479 2010-04-16 02:35:56Z mcfly_e107 $;
+*	@version $Id: e_list.php 12237 2011-05-29 10:36:17Z e107steved $;
 *
 */
 if (!defined('e107_INIT')) { exit; }
@@ -34,8 +34,8 @@
 	FROM #forum_t AS t
 	LEFT JOIN #forum_t AS tp ON t.thread_parent = tp.thread_id
 	LEFT JOIN #forum AS f ON f.forum_id = t.thread_forum_id
-	LEFT JOIN #user AS u ON t.thread_user = u.user_id
-	LEFT JOIN #user AS lp ON tp.thread_lastuser = lp.user_id
+	LEFT JOIN #user AS u ON SUBSTRING_INDEX(t.thread_user,'.',1) = u.user_id
+	LEFT JOIN #user AS lp ON SUBSTRING_INDEX(t.thread_lastuser,'.',1) = lp.user_id
 	WHERE f.forum_class REGEXP '".e_CLASS_REGEXP."'
 	AND t.thread_datestamp > $lvisit
 	ORDER BY t.thread_datestamp DESC LIMIT 0,".intval($arr[7]);
@@ -46,8 +46,8 @@
 	SELECT t.thread_id, t.thread_name AS parent_name, t.thread_datestamp, t.thread_user, t.thread_views, t.thread_lastpost, t.thread_lastuser, t.thread_total_replies, f.forum_id, f.forum_name, f.forum_class, u.user_name, lp.user_name AS lp_name
 	FROM #forum_t AS t
 	LEFT JOIN #forum AS f ON f.forum_id = t.thread_forum_id
-	LEFT JOIN #user AS u ON t.thread_user = u.user_id
-	LEFT JOIN #user AS lp ON t.thread_lastuser = lp.user_id
+	LEFT JOIN #user AS u ON SUBSTRING_INDEX(t.thread_user,'.',1) = u.user_id
+	LEFT JOIN #user AS lp ON SUBSTRING_INDEX(t.thread_lastuser,'.',1) = lp.user_id
 	WHERE t.thread_parent=0 AND f.forum_class REGEXP '".e_CLASS_REGEXP."'
 	ORDER BY t.thread_lastpost DESC LIMIT 0,".intval($arr[7]);
 }
@@ -65,10 +65,11 @@
 	{
 		extract($forumInfo);
 
-		//last user
+		//last poster
 		$r_id = substr($thread_lastuser, 0, strpos($thread_lastuser, "."));
 		$r_name = substr($thread_lastuser, (strpos($thread_lastuser, ".")+1));
-		if (strstr($thread_lastuser, chr(1))) {
+		if (strstr($thread_lastuser, chr(1))) 
+		{
 			$tmp = explode(chr(1), $thread_lastuser);
 			$r_name = $tmp[0];
 		}
@@ -79,24 +80,19 @@
 		$u_name = substr($thread_user, (strpos($thread_user, ".")+1));
 		$thread_user = $u_id;
 
-		if ($thread_anon) {
-			$tmp = explode(chr(1), $thread_anon);
-			$thread_user = $tmp[0];
-			$thread_user_ip = $tmp[1];
-		}
 
 		$gen = new convert;
 		$r_datestamp = $gen->convert_date($thread_lastpost, "short");
 		if($thread_total_replies)
 		{
-			$LASTPOST = "";
-			if($lp_name)
+			$LASTPOST = '';
+			if($r_name)
 			{
-				$LASTPOST = "<a href='".e_BASE."user.php?id.{$thread_lastuser}'>$lp_name</a>";
+				$LASTPOST = "<a href='".e_BASE."user.php?id.{$thread_lastuser}'>$r_name</a>";
 			}
 			else
 			{
-				if($thread_lastuser{0} == "0")
+				if (substr($thread_lastuser, 0, 1) == '0')
 				{
 					$LASTPOST = substr($thread_lastuser, 2);
 				}
@@ -110,7 +106,7 @@
 		else
 		{
 			$LASTPOST		= " - ";
-			$LASTPOSTDATE	= "";
+			$LASTPOSTDATE	= '';
 		}
 
 		if($parent_name == "")
@@ -118,7 +114,7 @@
 			$parent_name = $thread_name;
 		}
 		$rowheading	= $this -> parse_heading($parent_name, $mode);
-		if($parent_id)
+		if (isset($parent_id) && $parent_id)
 		{
 			$lnk = $thread_id.".post";
 		}
@@ -127,11 +123,11 @@
 			$lnk = $thread_id;
 		}
 		$HEADING	= "<a href='".$path."forum_viewtopic.php?$lnk' title='".$parent_name."'>".$rowheading."</a>";
-		$AUTHOR		= ($arr[3] ? ($thread_anon ? $thread_user : "<a href='".e_BASE."user.php?id.$thread_user'>$user_name</a>") : "");
+		$AUTHOR		= ($arr[3] ? ( "<a href='".e_BASE."user.php?id.$thread_user'>$user_name</a>") : "");
 		$CATEGORY	= ($arr[4] ? "<a href='".$path."forum_viewforum.php?$forum_id'>$forum_name</a>" : "");
 		$DATE		= ($arr[5] ? $this -> getListDate($thread_datestamp, $mode) : "");
 		$ICON		= $bullet;
-		$VIEWS		= $thread_views;
+		$VIEWS		= $thread_views ? $thread_views : $tviews;		// Cound seems to vary depending on whether there's been a reply to thread
 		$REPLIES	= $thread_total_replies;
 		if($thread_total_replies)
 		{
diff -x .svn -aruN 0.7.24.src/e107_plugins/forum/forum_admin.php 0.7.26.src/e107_plugins/forum/forum_admin.php
--- 0.7.24.src/e107_plugins/forum/forum_admin.php	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_plugins/forum/forum_admin.php	2011-06-02 14:58:44.000000000 -0500
@@ -11,12 +11,17 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $URL: https://e107.svn.sourceforge.net/svnroot/e107/trunk/e107_0.7/e107_plugins/forum/forum_admin.php $
-|     $Revision: 11678 $
-|     $Id: forum_admin.php 11678 2010-08-22 00:43:45Z e107coders $
-|     $Author: e107coders $
+|     $Revision: 12242 $
+|     $Id: forum_admin.php 12242 2011-06-02 19:59:08Z e107steved $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 $eplug_admin = true;
+if(!empty($_POST) && !isset($_POST['e-token']))
+{
+	// set e-token so it can be processed by class2
+	$_POST['e-token'] = ''; // TODO - regenerate token value just after access denied?
+}
 require_once("../../class2.php");
 include_lan(e_PLUGIN.'forum/languages/'.e_LANGUAGE.'/lan_forum_admin.php');
 
@@ -28,6 +33,16 @@
 $e_sub_cat = 'forum';
 
 $forum = new forum;
+
+if (e_QUERY)
+{
+	$tmp = explode(".", e_QUERY);
+	$action = $tmp[0]; //needed by auth.php
+	$sub_action = varset($tmp[1]);
+	$id = intval(varset($tmp[2], 0));
+	unset($tmp);
+}
+
 require_once(e_ADMIN.'auth.php');
 require_once(e_HANDLER."userclass_class.php");
 require_once(e_HANDLER."form_handler.php");
@@ -40,25 +55,20 @@
 define("IMAGE_nosub", "<img src='".e_PLUGIN."forum/images/sub_forums_16.png' alt='".FORLAN_145."' title='".FORLAN_145."' style='border:0' />");
 
 $deltest = array_flip($_POST);
-if (e_QUERY)
-{
-	$tmp = explode(".", e_QUERY);
-	$action = $tmp[0];
-	$sub_action = $tmp[1];
-	$id = $tmp[2];
-	unset($tmp);
-}
+
 
 if(isset($_POST['delete']))
 {
 	$tmp = array_pop(array_flip($_POST['delete']));
 	list($delete, $del_id) = explode("_", $tmp);
+	$del_id = intval($del_id);
 }
 
 if(isset($_POST['setMods']))
 {
 	foreach($_POST['mods'] as $fid => $modid)
 	{
+		$fid = intval($fid); $modid = intval($modid);
 		$sql->db_Update('forum',"forum_moderators = '{$modid}' WHERE forum_id = {$fid}");
 	}
 	$forum->show_message(FORLAN_144);
@@ -200,7 +210,7 @@
 	while (list($key, $id) = each($forum_order))
 	{
 		$tmp = explode(".", $id);
-		$sql->db_Update("forum", "forum_order=".$tmp[1]." WHERE forum_id=".$tmp[0]);
+		$sql->db_Update("forum", "forum_order=".intval($tmp[1])." WHERE forum_id=".intval($tmp[0]));
 	}
 	$forum->show_message(FORLAN_73);
 }
@@ -226,6 +236,8 @@
 	$pref['forum_hilightsticky'] = $_POST['forum_hilightsticky'];
 	$pref['forum_maxwidth'] = $_POST['forum_maxwidth'];
 	$pref['forum_linkimg'] = $_POST['forum_linkimg'];
+	$pref['forum_posts_sig'] = $_POST['forum_posts_sig'];
+	$pref['forum_class_sig'] = $_POST['forum_class_sig'];
 	save_prefs();
 	$forum->show_message(FORLAN_10);
 }
@@ -557,6 +569,7 @@
 		<form method='post' action='".e_SELF."?".e_QUERY."'>
 		<div style='text-align:center'>".FORLAN_180."<br /><br />
 		<input type='submit' class='button' name='confirm' value='".FORLAN_181."' />
+		<input type='hidden' name='e-token' value='".e_TOKEN."' />
 		</div>
 		</form>
 		";
@@ -608,7 +621,7 @@
 		{
 			$txt .= "<tr><td colspan='5' class='forumheader3' style='text-align:center'>".FORLAN_146."</td>";
 		}
-
+		// e-token hidden added - protects both create and update subs
 		$txt .= "
 		<tr>
 		<td class='fcaption'>".FORLAN_151."</td>
@@ -625,7 +638,7 @@
 		<td class='forumheader2'>&nbsp;</td>
 		</tr>
 		<tr>
-		<td class='forumheader3' colspan='5' style='text-align:center'><input type='submit' class='button' name='create_sub' value='".FORLAN_148."' /></td>
+		<td class='forumheader3' colspan='5' style='text-align:center'><input type='submit' class='button' name='create_sub' value='".FORLAN_148."' /><input type='hidden' name='e-token' value='".e_TOKEN."' /></td>
 		</tr>
 		</table>
 		</form>
@@ -757,7 +770,7 @@
 		}
 		else
 		{
-			$text .= "<tr>\n<td colspan='4' style='text-align:center' class='forumheader'>\n<input class='button' type='submit' name='update_order' value='".FORLAN_72."' />\n</td>\n</tr>\n</table>\n</form>";
+			$text .= "<tr>\n<td colspan='4' style='text-align:center' class='forumheader'>\n<input type='hidden' name='e-token' value='".e_TOKEN."' />\n<input class='button' type='submit' name='update_order' value='".FORLAN_72."' />\n</td>\n</tr>\n</table>\n</form>";
 			$ns->tablerender(FORLAN_37, $text);
 		}
 
@@ -797,7 +810,8 @@
 		</tr>
 
 		<tr style='vertical-align:top'>
-		<td colspan='2'  style='text-align:center' class='forumheader'>";
+		<td colspan='2'  style='text-align:center' class='forumheader'>
+		<input type='hidden' name='e-token' value='".e_TOKEN."' />";
 
 		if ($sub_action == "edit")
 		{
@@ -901,7 +915,8 @@
 		</tr>
 
 		<tr style='vertical-align:top'>
-		<td colspan='2'  style='text-align:center' class='forumheader'>";
+		<td colspan='2'  style='text-align:center' class='forumheader'>
+		<input type='hidden' name='e-token' value='".e_TOKEN."' />";
 		if ($sub_action == "edit")
 		{
 			$text .= "<input class='button' type='submit' name='update_forum' value='".FORLAN_35."' />";
@@ -935,6 +950,7 @@
 		</tr>
 		<tr>
 		<td class='forumheader3'>
+		<input type='hidden' name='e-token' value='".e_TOKEN."' />
 		";
 		if($sql->db_Select("forum", "*", "1 ORDER BY forum_order"))
 		{
@@ -1115,7 +1131,18 @@
 		</tr>
 
 		<tr>
+		<td style='width:75%' class='forumheader3'>".FORLAN_67."<br /><span class='smalltext'>".FORLAN_68."</span></td>
+		<td style='width:25%;text-align:center' class='forumheader3' ><input class='tbox' type='text' name='forum_posts_sig' size='3' value='".$pref['forum_posts_sig']."' maxlength='3' /></td>
+		</tr>
+
+		<tr>
+		<td style='width:75%' class='forumheader3'>".FORLAN_69."<br /></td>
+		<td style='width:25%;text-align:center' class='forumheader3' >" . r_userclass("forum_class_sig", $pref['forum_class_sig'], 'off', 'nobody,member,admin,classes') . "</td>
+		</tr>
+
+		<tr>
 		<td colspan='2'  style='text-align:center' class='forumheader'>
+		<input type='hidden' name='e-token' value='".e_TOKEN."' />
 		<input class='button' type='submit' name='updateoptions' value='".FORLAN_61."' />
 		</td>
 		</tr>
@@ -1178,6 +1205,7 @@
 			<tr>
 			<td style='text-align:center' class='forumheader' colspan='2'>
 			".$rs->form_open("post", e_SELF."?sr", "", "", "", " onsubmit=\"return confirm_('sr',".$row['gen_datestamp'].")\"")."
+			<input type='hidden' name='e-token' value='".e_TOKEN."' />
 			".$rs->form_button("submit", "delete[reported_{$row['gen_id']}]", FORLAN_172)."
 			".$rs->form_close()."
 			</td>
@@ -1200,6 +1228,7 @@
 					<td style='width:80%' class='forumheader3'><a href='".e_SELF."?sr.".$row['gen_id']."'>".FORLAN_171." #".$row['gen_intdata']."</a></td>
 					<td style='width:20%; text-align:center; vertical-align:top; white-space: nowrap' class='forumheader3'>
 					".$rs->form_open("post", e_SELF."?sr", "", "", "", " onsubmit=\"return confirm_('sr',".$row['gen_datestamp'].")\"")."
+					<input type='hidden' name='e-token' value='".e_TOKEN."' />
 					".$rs->form_button("submit", "delete[reported_{$row['gen_id']}]", FORLAN_172)."
 					".$rs->form_close()."
 					</td>
@@ -1266,6 +1295,7 @@
 
 		$text .= "<tr>
 		<td colspan='2'  style='text-align:center' class='forumheader'>
+		<input type='hidden' name='e-token' value='".e_TOKEN."' />
 		<input class='button' type='submit' name='do_prune' value='".FORLAN_5."' />
 		</td>
 		</tr>
@@ -1331,6 +1361,7 @@
 
 		$text .= "<tr>
 		<td colspan='3'  style='text-align:center' class='forumheader'>
+		<input type='hidden' name='e-token' value='".e_TOKEN."' />
 		<input class='button' type='submit' name='set_ranks' value='".FORLAN_94."' />
 		</td>
 		</tr>
@@ -1377,6 +1408,7 @@
 			$txt .= "
 			<tr>
 			<td colspan='2' class='fcaption' style='text-align:center'>
+			<input type='hidden' name='e-token' value='".e_TOKEN."' />
 			<input class='button' type='submit' name='setMods' value='".WMGLAN_4." ".FORLAN_33."' />
 			</td>
 			</tr>
@@ -1489,6 +1521,7 @@
 			<tr style='vertical-align:top'>
 			<td class='forumheader'>&nbsp;</td>
 			<td style='width:60%' class='forumheader'>
+			<input type='hidden' name='e-token' value='".e_TOKEN."' />
 			<input class='button' type='submit' name='frsubmit' value='".WMGLAN_4."' />
 			</td>
 			</tr>
diff -x .svn -aruN 0.7.24.src/e107_plugins/forum/forum_class.php 0.7.26.src/e107_plugins/forum/forum_class.php
--- 0.7.24.src/e107_plugins/forum/forum_class.php	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_plugins/forum/forum_class.php	2011-01-27 13:14:39.000000000 -0600
@@ -9,7 +9,7 @@
  * Forum plugin - thread classes
  *
  * $URL: https://e107.svn.sourceforge.net/svnroot/e107/trunk/e107_0.7/e107_plugins/forum/forum_class.php $
- * $Id: forum_class.php 11670 2010-08-20 12:59:41Z e107steved $
+ * $Id: forum_class.php 12059 2011-01-27 19:15:03Z nlstart $
  */
 if (!defined('e107_INIT')) { exit; }
 
@@ -17,7 +17,7 @@
 {
 	var $filterNasties = TRUE;
 
-	
+
 	function e107forum()
 	{
 		global $pref;
@@ -141,7 +141,7 @@
 			}
 		}
 	}
-	
+
 	function forum_markasread($forum_id)
 	{
 	  global $sql;
@@ -596,20 +596,51 @@
 		if ($sql->db_Select_gen($qry))
 		{
 			$row = $sql->db_Fetch();
+			if ($this->filterNasties)
+			{
+				$row['thread_name'] = $tp->dataFilter($row['thread_name']);
+				$row['thread_thread'] = $tp->dataFilter($row['thread_thread']);
+			}
 			$ret['head'] = $row;
 			if (!array_key_exists(0, $ret))
 			{
-				if ($this->filterNasties)
-				{
-					$row['thread_name'] = $tp->dataFilter($row['thread_name']);
-					$row['thread_thread'] = $tp->dataFilter($row['thread_thread']);
-				}
 				$ret[0] = $row;
 			}
 		}
 		return $ret;
 	}
 
+
+	/**
+	 *	Determine whether current user has access to the specified thread.
+	 *
+	 *	@param int $thread_id
+	 *
+	 *	@return boolean TRUE if access allowed, FALSE if denied
+	 */
+	function thread_get_allowed($thread_id)
+	{
+		global $sql;
+		$thread_id = intval($thread_id);
+		$qry = "
+		SELECT t.thread_id from #forum_t as t
+		JOIN #forum AS f ON f.forum_id = t.thread_forum_id
+		LEFT JOIN #forum AS fp ON fp.forum_id = f.forum_parent
+		WHERE t.thread_id = {$thread_id}
+		AND f.forum_parent != 0
+		AND fp.forum_class IN (".USERCLASS_LIST.")
+		AND f.forum_class IN (".USERCLASS_LIST.")
+		LIMIT 0,1
+		";
+
+		if ($sql->db_Select_gen($qry))
+		{
+			return TRUE;
+		}
+		return FALSE;
+	}
+
+
 	function thread_count($thread_id)
 	{
 		$thread_id = intval($thread_id);
@@ -707,7 +738,7 @@
 	{
 		global $sql, $tp, $pref, $e107;
 		global $PLUGINS_DIRECTORY;
-		
+
 		$forum_info = '';
 		$post_time = time();
 		$forum_sub = intval($forum_sub);
@@ -771,7 +802,7 @@
 				$sql->db_Select('user', 'user_admin, user_perms, user_class, user_ban', 'user_id = '.$parent_thread[0]['user_id']);
 				$thread_owner = $sql->db_Fetch(MYSQL_ASSOC);
 				$forum_info = $this->forum_get($parent_thread[0]['thread_forum_id']);
-				
+
 				//Ensure owner is not banned and has permissions to view forum and forum parent
 				if(
 					$thread_owner['user_ban'] == 0 &&
@@ -856,7 +887,7 @@
 		}
 		return $ret;
 	}
-	
+
 	//*** added by marj
         function postGetOldestNew($count = 50, $userviewed = USERVIEWED)
         {
@@ -951,13 +982,12 @@
 		$sql->db_Update("forum", "forum_threads='$threads', forum_replies='$replies' WHERE forum_id=".$forumID);
 		if($recalc_threads == true)
 		{
-			$sql->db_Select("forum_t", "thread_parent, count(*) as replies", "thread_forum_id = $forumID GROUP BY thread_parent");
-			$tlist = $sql->db_getList();
-			foreach($tlist as $t)
-			{
-				$tid = $t['thread_parent'];
-				$replies = intval($t['replies']);
-				$sql->db_Update("forum_t", "thread_total_replies='$replies' WHERE thread_id=".$tid);
+			$sql->db_Select('forum_t', 'thread_id', "thread_forum_id = {$forumID} AND thread_parent=0");
+			$tList = $sql->db_getList();
+			foreach($tList as $t) {
+				$sql->db_Select('forum_t', 'count(*) as replies', "thread_parent = {$t['thread_id']}");
+				$row = $sql->db_Fetch(MYSQL_ASSOC);
+				$sql->db_Update('forum_t', "thread_total_replies={$row['replies']} WHERE thread_id={$t['thread_id']}");
 			}
 		}
 	}
@@ -983,7 +1013,7 @@
 		}
 		return FALSE;
 	}
-	
+
 	/*
 	 * set bread crumb
 	 * $forum_href override ONLY applies when template is missing FORUM_CRUMB
@@ -993,17 +1023,17 @@
 	{
 		global $FORUM_CRUMB,$forum_info,$thread_info,$tp;
 		global $BREADCRUMB,$BACKLINK;  // Eventually we should deprecate BACKLINK
-		
+
 		if(is_array($FORUM_CRUMB))
 		{
 			$search 	= array("{SITENAME}", "{SITENAME_HREF}");
 			$replace 	= array(SITENAME, "href='".e_BASE."index.php'");
 			$FORUM_CRUMB['sitename']['value'] = str_replace($search, $replace, $FORUM_CRUMB['sitename']['value']);
-		
+
 			$search 	= array("{FORUMS_TITLE}", "{FORUMS_HREF}");
 			$replace 	= array(LAN_01, "href='".e_PLUGIN."forum/forum.php'");
 			$FORUM_CRUMB['forums']['value'] = str_replace($search, $replace, $FORUM_CRUMB['forums']['value']);
-		
+
 			$search 	= "{PARENT_TITLE}";
 			$replace 	= $tp->toHTML($forum_info['parent_name']);
 			$FORUM_CRUMB['parent']['value'] = str_replace($search, $replace, $FORUM_CRUMB['parent']['value']);
@@ -1050,7 +1080,7 @@
 				$forum_sub_parent = (substr($forum_info['sub_parent'], 0, 1) == "*" ? substr($forum_info['sub_parent'], 1) : $forum_info['sub_parent']);
 				$BREADCRUMB .= "<a class='forumlink' href='".e_PLUGIN."forum/forum_viewforum.php?{$forum_info['forum_sub']}'>{$forum_sub_parent}</a>".$dfltsep;
 			}
-			
+
 			$tmpFname = $forum_info['forum_name'];
 			if(substr($tmpFname, 0, 1) == "*") { $tmpFname = substr($tmpFname, 1); }
 			if ($forum_href)
diff -x .svn -aruN 0.7.24.src/e107_plugins/forum/forum_conf.php 0.7.26.src/e107_plugins/forum/forum_conf.php
--- 0.7.24.src/e107_plugins/forum/forum_conf.php	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_plugins/forum/forum_conf.php	2011-03-13 09:15:19.000000000 -0500
@@ -10,12 +10,22 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $URL: https://e107.svn.sourceforge.net/svnroot/e107/trunk/e107_0.7/e107_plugins/forum/forum_conf.php $
-|     $Revision: 11741 $
-|     $Id: forum_conf.php 11741 2010-09-04 08:32:42Z e107steved $
-|     $Author: e107steved $
+|     $Id: forum_conf.php 12100 2011-03-13 14:15:43Z e107steved $
 +----------------------------------------------------------------------------+
 */
+
+if(!empty($_POST) && !isset($_POST['e-token']))
+{
+	// set e-token so it can be processed by class2
+	$_POST['e-token'] = '';
+}
+
 require_once("../../class2.php");
+if (!isset($pref['plug_installed']['forum']))
+{
+	header('Location: '.e_BASE.'index.php');
+	exit;
+}
 include_lan(e_PLUGIN.'forum/languages/'.e_LANGUAGE.'/lan_forum_conf.php');
 
 $e_sub_cat = 'forum';
@@ -131,6 +141,7 @@
 		".FORLAN_13."
 		<br /><br />
 		<form method='post' action='".e_SELF."?".e_QUERY."'>
+		<input type='hidden' name='e-token' value='".e_TOKEN."' />
 		<input class='button' type='submit' name='deletecancel' value='".FORLAN_14."' />
 		<input class='button' type='submit' name='deletepollconfirm' value='".FORLAN_15."' />
 		</form>
@@ -189,6 +200,7 @@
 		</tr>
 		<tr style='vertical-align: top;'>
 		<td colspan='2'  style='text-align:center'><br />
+		<input type='hidden' name='e-token' value='".e_TOKEN."' />
 		<input class='button' type='submit' name='move' value='".FORLAN_25."' />
 		<input class='button' type='submit' name='movecancel' value='".FORLAN_14."' />
 		</td>
diff -x .svn -aruN 0.7.24.src/e107_plugins/forum/forum.php 0.7.26.src/e107_plugins/forum/forum.php
--- 0.7.24.src/e107_plugins/forum/forum.php	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_plugins/forum/forum.php	2011-01-14 12:28:33.000000000 -0600
@@ -4,21 +4,27 @@
 |     e107 website system
 |
 |     ?Steve Dunstan 2001-2002
-|     Copyright (C) 2008-2010 e107 Inc (e107.org)
+|     Copyright (C) 2008-2011 e107 Inc (e107.org)
 |
 |
 |     Released under the terms and conditions of the
 |     GNU General Public License (http://gnu.org).
 |
 |     $URL: https://e107.svn.sourceforge.net/svnroot/e107/trunk/e107_0.7/e107_plugins/forum/forum.php $
-|     $Revision: 11678 $
-|     $Id: forum.php 11678 2010-08-22 00:43:45Z e107coders $
-|     $Author: e107coders $
+|     $Revision: 12040 $
+|     $Id: forum.php 12040 2011-01-14 18:28:57Z e107steved $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
-if(!defined("e107_INIT")) {
+if(!defined("e107_INIT")) 
+{
 	require_once("../../class2.php");
 }
+if (!isset($pref['plug_installed']['forum']))
+{
+	header('Location: '.e_BASE.'index.php');
+	exit;
+}
 
 include_lan(e_PLUGIN.'forum/languages/'.e_LANGUAGE.'/lan_forum.php');
 
diff -x .svn -aruN 0.7.24.src/e107_plugins/forum/forum_post.php 0.7.26.src/e107_plugins/forum/forum_post.php
--- 0.7.24.src/e107_plugins/forum/forum_post.php	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_plugins/forum/forum_post.php	2011-03-13 09:15:19.000000000 -0500
@@ -11,8 +11,8 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $URL: https://e107.svn.sourceforge.net/svnroot/e107/trunk/e107_0.7/e107_plugins/forum/forum_post.php $
-|     $Revision: 11741 $
-|     $Id: forum_post.php 11741 2010-09-04 08:32:42Z e107steved $
+|     $Revision: 12100 $
+|     $Id: forum_post.php 12100 2011-03-13 14:15:43Z e107steved $
 |     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
@@ -25,6 +25,11 @@
 }
 
 require_once("../../class2.php");
+if (!isset($pref['plug_installed']['forum']))
+{
+	header('Location: '.e_BASE.'index.php');
+	exit;
+}
 $e_wysiwyg = "post";
 include_lan(e_PLUGIN.'forum/languages/'.e_LANGUAGE.'/lan_forum_post.php');
 
@@ -56,12 +61,12 @@
 	}
 	else
 	{
-	  $forum_info = $forum->forum_get($thread_info['head']['thread_forum_id']);
+		$forum_info = $forum->forum_get($thread_info['head']['thread_forum_id']);
 	}
 }
 elseif ($action == 'nt')
 {
-	// New post
+	// New thread
 	$forum_info = $forum->forum_get($id);
 }
 elseif ($action == 'quote' || $action == 'edit')
@@ -433,18 +438,24 @@
 	}
 	$post = preg_replace("/&lt;span class=&#39;smallblacktext&#39;.*\span\>/", "", $post);
 
-	if ($action == 'quote') {
+	if ($action == 'quote') 
+	{
 		$post = preg_replace("#\[hide].*?\[/hide]#s", "", $post);
 		$tmp = explode(chr(1), $thread_info[0]['user_name']);
 		$timeStamp = time();
 		$post = "[quote{$timeStamp}={$tmp[0]}]\n".$post."\n[/quote{$timeStamp}]\n";
 		$eaction = FALSE;
 		$action = 'reply';
-	} else {
+	} 
+	else 
+	{
 		$eaction = TRUE;
-		if ($thread_info['0']['thread_parent']) {
+		if ($thread_info['0']['thread_parent']) 
+		{
 			$action = "reply";
-		} else {
+		} 
+		else 
+		{
 			$action = "nt";
 			$sact = "canc";	// added to override the bugtracker query below
 		}
@@ -456,31 +467,31 @@
 
 if (!$FORUMPOST)
 {
-  if (is_readable(THEME."forum_post_template.php"))
-  {
-    include_once(THEME."forum_post_template.php");
-  }
-  else
-  {
-  include_once(e_PLUGIN."forum/templates/forum_post_template.php");
-  }
+	if (is_readable(THEME."forum_post_template.php"))
+	{
+		include_once(THEME."forum_post_template.php");
+	}
+	else
+	{
+		include_once(e_PLUGIN."forum/templates/forum_post_template.php");
+	}
 }
 /* check post access (bugtracker #1424) */
 
 if($action == "rp" && !$sql -> db_Select("forum_t", "*", "thread_id='{$id}'"))
 {
 	$ns -> tablerender(LAN_20, "<div style='text-align:center'>".LAN_399."</div>");
-	 require_once(FOOTERF);
+	require_once(FOOTERF);
 	exit;
 }
 elseif($action == "nt")
 {
-  if (!$sact && !$sql -> db_Select("forum", "*", "forum_id='{$id}'"))
-  {
-	$ns -> tablerender(LAN_20, "<div style='text-align:center'>".LAN_399."</div>");
-	require_once(FOOTERF);
-	exit;
-  }
+	if (!$sact && !$sql -> db_Select("forum", "*", "forum_id='{$id}'"))
+	{
+		$ns -> tablerender(LAN_20, "<div style='text-align:center'>".LAN_399."</div>");
+		require_once(FOOTERF);
+		exit;
+	}
 }
 else
 {
@@ -513,6 +524,8 @@
 	echo $text;
 }
 
+
+
 function isAuthor()
 {
 	global $thread_info;
diff -x .svn -aruN 0.7.24.src/e107_plugins/forum/forum_post_shortcodes.php 0.7.26.src/e107_plugins/forum/forum_post_shortcodes.php
--- 0.7.24.src/e107_plugins/forum/forum_post_shortcodes.php	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_plugins/forum/forum_post_shortcodes.php	2010-10-12 15:24:32.000000000 -0500
@@ -1,157 +1,157 @@
-<?php
-if (!defined('e107_INIT')) { exit; }
-include_once(e_HANDLER.'shortcode_handler.php');
-$forum_post_shortcodes = $tp -> e_sc -> parse_scbatch(__FILE__);
-
-/*
-SC_BEGIN LATESTPOSTS
-global $thread_info, $action, $gen, $tp, $forum_shortcodes, $post_info;
-global $LATESTPOSTS_START, $LATESTPOSTS_END, $LATESTPOSTS_POST;
-$txt = $tp->parseTemplate($LATESTPOSTS_START, TRUE, $forum_shortcodes);
-for($i = count($thread_info)-2; $i>0; $i--)
-{
-	$post_info = $thread_info[$i];
-	$txt .= $tp->parseTemplate($LATESTPOSTS_POST, TRUE, $forum_shortcodes);
-}
-$txt .= $tp->parseTemplate($LATESTPOSTS_END, TRUE, $forum_shortcodes);
-return $txt;
-SC_END
-
-
-SC_BEGIN LATESTPOSTSCOUNT
-  return;			// Null return as placeholder
-SC_END
-
-SC_BEGIN THREADTOPIC
-global $thread_info, $action, $gen, $tp, $post_info, $forum_shortcodes, $THREADTOPIC_REPLY;
-$post_info = $thread_info['head'];
-return $tp->parseTemplate($THREADTOPIC_REPLY, TRUE, $forum_shortcodes);
-SC_END
-
-SC_BEGIN FORMSTART
-return "<form enctype='multipart/form-data' method='post' action='".e_SELF."?".e_QUERY."' id='dataform'>";
-SC_END
-
-SC_BEGIN FORMEND
-return "</form>";
-SC_END
-
-SC_BEGIN FORUMJUMP
-return forumjump();
-SC_END
-
-SC_BEGIN USERBOX
-global $userbox;
-return (USER == FALSE ? $userbox : "");
-SC_END
-
-SC_BEGIN SUBJECTBOX
-global $subjectbox, $action;
-return ($action == "nt" ? $subjectbox : "");
-SC_END
-
-SC_BEGIN POSTTYPE
-global $action;
-return ($action == "nt" ? LAN_63 : LAN_73);
-SC_END
-
-SC_BEGIN POSTBOX
-global $post, $pref;
-$rows = (e_WYSIWYG) ? 15 : 10;
-$ret = "<textarea class='tbox' id='post' name='post' cols='70' rows='{$rows}' style='width:95%' onselect='storeCaret(this);' onclick='storeCaret(this);' onkeyup='storeCaret(this);'>$post</textarea>\n<br />\n";
-if(!e_WYSIWYG)
-{
-	$ret .= display_help('helpb', 'forum');
-}
-return $ret;
-SC_END
-
-SC_BEGIN BUTTONS
-global $action, $eaction;
-$ret = "<input class='button' type='submit' name='fpreview' value='".LAN_323."' /> ";
-if ($action != "nt")
-{
-	$ret .= ($eaction ? "<input class='button' type='submit' name='update_reply' value='".LAN_78."' />" : "<input class='button' type='submit' name='reply' value='".LAN_74."' />");
-}
-else
-{
-	$ret .= ($eaction ? "<input class='button' type='submit' name='update_thread' value='".LAN_77."' />" : "<input class='button' type='submit' name='newthread' value='".LAN_64."' />");
-}
-return $ret;
-SC_END
-
-SC_BEGIN FILEATTACH
-global $pref, $fileattach, $fileattach_alert;
-
-if ($pref['forum_attach'] && strpos(e_QUERY, "edit") === FALSE && (check_class($pref['upload_class']) || getperms('0')))
-{
-	if (is_writable(e_FILE."public"))
-	{
-		return $fileattach;
-	}
-	else
-	{
-		$FILEATTACH = "";
-		if(ADMIN)
-		{
-			if(!$fileattach_alert)
-			{
-				$fileattach_alert = "<tr><td colspan='2' class='nforumcaption2'>".($pref['image_post'] ? LAN_390 : LAN_416)."</td></tr><tr><td colspan='2' class='forumheader3'>".LAN_FORUM_1."</td></tr>\n";
-			}
-			return $fileattach_alert;
-		}
-	}
-}
-SC_END
-
-SC_BEGIN POSTTHREADAS
-global $action, $thread_info;
-if (MODERATOR && $action == "nt")
-{
-	$thread_s = (isset($_POST['threadtype']) ? $_POST['threadtype'] : $thread_info['head']['thread_s']);
-	return "<br /><span class='defaulttext'>".LAN_400."<input name='threadtype' type='radio' value='0' ".(!$thread_s ? "checked='checked' " : "")." />".LAN_1."&nbsp;<input name='threadtype' type='radio' value='1' ".($thread_s == 1 ? "checked='checked' " : "")." />".LAN_2."&nbsp;<input name='threadtype' type='radio' value='2' ".($thread_s == 2 ? "checked='checked' " : "")." />".LAN_3."</span>";
-}
-return "";
-SC_END
-
-SC_BEGIN BACKLINK
-global $forum, $thread_info,$eaction, $action,$BREADCRUMB;
-$forum->set_crumb(TRUE,($action == "nt" ? ($eaction ? LAN_77 : LAN_60) : ($eaction ? LAN_78 : LAN_406." ".$thread_info['head']['thread_name'])));
-return $BREADCRUMB;
-SC_END
-
-SC_BEGIN EMAILNOTIFY
-global $pref, $thread_info, $action;
-if ($pref['email_notify'] && $action == "nt" && USER)
-{
-	if(isset($_POST['fpreview']))
-	{
-		$chk = ($_POST['email_notify'] ? "checked = 'checked'" : "");
-	}
-	else
-	{
-		if(isset($thread_info))
-		{
-			$chk = ($thread_info['head']['thread_active'] == 99 ? "checked='checked'" : "");
-		}
-		else
-		{
-			$chk = ($pref['email_notify_on'] ? "checked='checked'" : "");
-		}
-	}
-	return "<span class='defaulttext'>".LAN_380."</span><input type='checkbox' name='email_notify' value='1' {$chk} />";
-}
-return "";
-SC_END
-
-SC_BEGIN POLL
-global $poll_form, $action, $pref;
-if ($action == "nt" && $pref['forum_poll'] && strpos(e_QUERY, "edit") === FALSE)
-{
-	return $poll_form;
-}
-return "";
-SC_END
-
-*/
+<?php
+if (!defined('e107_INIT')) { exit; }
+include_once(e_HANDLER.'shortcode_handler.php');
+$forum_post_shortcodes = $tp -> e_sc -> parse_scbatch(__FILE__);
+
+/*
+SC_BEGIN LATESTPOSTS
+global $thread_info, $action, $gen, $tp, $forum_shortcodes, $post_info;
+global $LATESTPOSTS_START, $LATESTPOSTS_END, $LATESTPOSTS_POST;
+$txt = $tp->parseTemplate($LATESTPOSTS_START, TRUE, $forum_shortcodes);
+for($i = count($thread_info)-2; $i>0; $i--)
+{
+	$post_info = $thread_info[$i];
+	$txt .= $tp->parseTemplate($LATESTPOSTS_POST, TRUE, $forum_shortcodes);
+}
+$txt .= $tp->parseTemplate($LATESTPOSTS_END, TRUE, $forum_shortcodes);
+return $txt;
+SC_END
+
+
+SC_BEGIN LATESTPOSTSCOUNT
+  return;			// Null return as placeholder
+SC_END
+
+SC_BEGIN THREADTOPIC
+global $thread_info, $action, $gen, $tp, $post_info, $forum_shortcodes, $THREADTOPIC_REPLY;
+$post_info = $thread_info['head'];
+return $tp->parseTemplate($THREADTOPIC_REPLY, TRUE, $forum_shortcodes);
+SC_END
+
+SC_BEGIN FORMSTART
+return "<form enctype='multipart/form-data' method='post' action='".e_SELF."?".e_QUERY."' id='dataform'>";
+SC_END
+
+SC_BEGIN FORMEND
+return "</form>";
+SC_END
+
+SC_BEGIN FORUMJUMP
+return forumjump();
+SC_END
+
+SC_BEGIN USERBOX
+global $userbox;
+return (USER == FALSE ? $userbox : "");
+SC_END
+
+SC_BEGIN SUBJECTBOX
+global $subjectbox, $action;
+return ($action == "nt" ? $subjectbox : "");
+SC_END
+
+SC_BEGIN POSTTYPE
+global $action;
+return ($action == "nt" ? LAN_63 : LAN_73);
+SC_END
+
+SC_BEGIN POSTBOX
+global $post, $pref;
+$rows = (e_WYSIWYG) ? 15 : 10;
+$ret = "<textarea class='tbox' id='post' name='post' cols='70' rows='{$rows}' style='width:95%' onselect='storeCaret(this);' onclick='storeCaret(this);' onkeyup='storeCaret(this);'>$post</textarea>\n<br />\n";
+if(!e_WYSIWYG)
+{
+	$ret .= display_help('helpb', 'forum');
+}
+return $ret;
+SC_END
+
+SC_BEGIN BUTTONS
+global $action, $eaction;
+$ret = "<input class='button' type='submit' name='fpreview' value='".LAN_323."' /> ";
+if ($action != "nt")
+{
+	$ret .= ($eaction ? "<input class='button' type='submit' name='update_reply' value='".LAN_78."' />" : "<input class='button' type='submit' name='reply' value='".LAN_74."' />");
+}
+else
+{
+	$ret .= ($eaction ? "<input class='button' type='submit' name='update_thread' value='".LAN_77."' />" : "<input class='button' type='submit' name='newthread' value='".LAN_64."' />");
+}
+return $ret;
+SC_END
+
+SC_BEGIN FILEATTACH
+global $pref, $fileattach, $fileattach_alert;
+
+if ($pref['forum_attach'] && strpos(e_QUERY, "edit") === FALSE && (check_class($pref['upload_class']) || getperms('0')))
+{
+	if (is_writable(e_FILE."public"))
+	{
+		return $fileattach;
+	}
+	else
+	{
+		$FILEATTACH = "";
+		if(ADMIN)
+		{
+			if(!$fileattach_alert)
+			{
+				$fileattach_alert = "<tr><td colspan='2' class='nforumcaption2'>".($pref['image_post'] ? LAN_390 : LAN_416)."</td></tr><tr><td colspan='2' class='forumheader3'>".LAN_FORUM_1."</td></tr>\n";
+			}
+			return $fileattach_alert;
+		}
+	}
+}
+SC_END
+
+SC_BEGIN POSTTHREADAS
+global $action, $thread_info;
+if (MODERATOR && $action == "nt")
+{
+	$thread_s = (isset($_POST['threadtype']) ? $_POST['threadtype'] : $thread_info['head']['thread_s']);
+	return "<br /><span class='defaulttext'>".LAN_400."<input name='threadtype' type='radio' value='0' ".(!$thread_s ? "checked='checked' " : "")." />".LAN_1."&nbsp;<input name='threadtype' type='radio' value='1' ".($thread_s == 1 ? "checked='checked' " : "")." />".LAN_2."&nbsp;<input name='threadtype' type='radio' value='2' ".($thread_s == 2 ? "checked='checked' " : "")." />".LAN_3."</span>";
+}
+return "";
+SC_END
+
+SC_BEGIN BACKLINK
+global $forum, $thread_info,$eaction, $action,$BREADCRUMB;
+$forum->set_crumb(TRUE,($action == "nt" ? ($eaction ? LAN_77 : LAN_60) : ($eaction ? LAN_78 : LAN_406." ".$thread_info['head']['thread_name'])));
+return $BREADCRUMB;
+SC_END
+
+SC_BEGIN EMAILNOTIFY
+global $pref, $thread_info, $action;
+if ($pref['email_notify'] && $action == "nt" && USER)
+{
+	if(isset($_POST['fpreview']))
+	{
+		$chk = ($_POST['email_notify'] ? "checked = 'checked'" : "");
+	}
+	else
+	{
+		if(isset($thread_info))
+		{
+			$chk = ($thread_info['head']['thread_active'] == 99 ? "checked='checked'" : "");
+		}
+		else
+		{
+			$chk = ($pref['email_notify_on'] ? "checked='checked'" : "");
+		}
+	}
+	return "<span class='defaulttext'>".LAN_380."</span><input type='checkbox' name='email_notify' value='1' {$chk} />";
+}
+return "";
+SC_END
+
+SC_BEGIN POLL
+global $poll_form, $action, $pref;
+if ($action == "nt" && $pref['forum_poll'] && strpos(e_QUERY, "edit") === FALSE)
+{
+	return $poll_form;
+}
+return "";
+SC_END
+
+*/
 ?>
\ No newline at end of file
diff -x .svn -aruN 0.7.24.src/e107_plugins/forum/forum_shortcodes.php 0.7.26.src/e107_plugins/forum/forum_shortcodes.php
--- 0.7.24.src/e107_plugins/forum/forum_shortcodes.php	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_plugins/forum/forum_shortcodes.php	2011-06-02 14:58:44.000000000 -0500
@@ -109,7 +109,9 @@
 	
 SC_BEGIN SIGNATURE
 global $post_info, $tp;
+if ($post_info['user_forums'] >= $pref['forum_posts_sig'] && check_class($pref['forum_class_sig'], $post_info['user_class'])) {
 return ($post_info['user_signature'] ? "<br /><hr style='width:15%; text-align:left' /><span class='smalltext'>".$tp->toHTML($post_info['user_signature'],TRUE)."</span>" : "");
+}
 SC_END
 	
 SC_BEGIN PROFILEIMG
@@ -258,4 +260,4 @@
 SC_END
 
 */
-?>
\ No newline at end of file
+?>
diff -x .svn -aruN 0.7.24.src/e107_plugins/forum/forum_sql.php 0.7.26.src/e107_plugins/forum/forum_sql.php
--- 0.7.24.src/e107_plugins/forum/forum_sql.php	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_plugins/forum/forum_sql.php	2011-03-11 12:49:32.000000000 -0600
@@ -14,7 +14,7 @@
 	forum_order int(10) unsigned NOT NULL default '0',
 	forum_postclass tinyint(3) unsigned NOT NULL default '0',
 	PRIMARY KEY  (forum_id)
-	) TYPE=MyISAM AUTO_INCREMENT=1
+	) ENGINE=MyISAM AUTO_INCREMENT=1
 
 CREATE TABLE forum_t (
 	thread_id int(10) unsigned NOT NULL auto_increment,
@@ -35,5 +35,5 @@
 	KEY thread_parent (thread_parent),
 	KEY thread_datestamp (thread_datestamp),
 	KEY thread_forum_id (thread_forum_id)
-	) TYPE=MyISAM AUTO_INCREMENT=1;
+	) ENGINE=MyISAM AUTO_INCREMENT=1;
 
diff -x .svn -aruN 0.7.24.src/e107_plugins/forum/forum_stats.php 0.7.26.src/e107_plugins/forum/forum_stats.php
--- 0.7.24.src/e107_plugins/forum/forum_stats.php	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_plugins/forum/forum_stats.php	2011-03-13 09:15:19.000000000 -0500
@@ -11,13 +11,18 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $URL: https://e107.svn.sourceforge.net/svnroot/e107/trunk/e107_0.7/e107_plugins/forum/forum_stats.php $
-|     $Revision: 11678 $
-|     $Id: forum_stats.php 11678 2010-08-22 00:43:45Z e107coders $
-|     $Author: e107coders $
+|     $Revision: 12100 $
+|     $Id: forum_stats.php 12100 2011-03-13 14:15:43Z e107steved $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 
 require_once('../../class2.php');
+if (!isset($pref['plug_installed']['forum']))
+{
+	header('Location: '.e_BASE.'index.php');
+	exit;
+}
 
 include_lan(e_PLUGIN.'forum/languages/'.e_LANGUAGE.'/lan_forum_stats.php');
 @require_once(e_PLUGIN.'forum/forum_class.php');
diff -x .svn -aruN 0.7.24.src/e107_plugins/forum/forum_uploads.php 0.7.26.src/e107_plugins/forum/forum_uploads.php
--- 0.7.24.src/e107_plugins/forum/forum_uploads.php	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_plugins/forum/forum_uploads.php	2011-03-13 09:15:19.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $URL: https://e107.svn.sourceforge.net/svnroot/e107/trunk/e107_0.7/e107_plugins/forum/forum_uploads.php $
-|     $Revision: 11678 $
-|     $Id: forum_uploads.php 11678 2010-08-22 00:43:45Z e107coders $
-|     $Author: e107coders $
+|     $Revision: 12100 $
+|     $Id: forum_uploads.php 12100 2011-03-13 14:15:43Z e107steved $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 
@@ -25,6 +25,11 @@
 }
 
 require_once("../../class2.php");
+if (!isset($pref['plug_installed']['forum']))
+{
+	header('Location: '.e_BASE.'index.php');
+	exit;
+}
 
 if(!USER)
 {
diff -x .svn -aruN 0.7.24.src/e107_plugins/forum/forum_viewforum.php 0.7.26.src/e107_plugins/forum/forum_viewforum.php
--- 0.7.24.src/e107_plugins/forum/forum_viewforum.php	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_plugins/forum/forum_viewforum.php	2011-03-13 09:15:19.000000000 -0500
@@ -11,14 +11,24 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $URL: https://e107.svn.sourceforge.net/svnroot/e107/trunk/e107_0.7/e107_plugins/forum/forum_viewforum.php $
-|     $Revision: 11678 $
-|     $Id: forum_viewforum.php 11678 2010-08-22 00:43:45Z e107coders $
-|     $Author: e107coders $
+|     $Id: forum_viewforum.php 12100 2011-03-13 14:15:43Z e107steved $
 +----------------------------------------------------------------------------+
 */
 
+if(in_array('thread_action', $_POST) && !isset($_POST['e-token']))
+{
+	// set e-token so it can be processed by class2
+	$_POST['e-token'] = '';
+}
+
 require_once("../../class2.php");
-if (isset($_POST['fjsubmit'])) {
+if (!isset($pref['plug_installed']['forum']))
+{
+	header('Location: '.e_BASE.'index.php');
+	exit;
+}
+if (isset($_POST['fjsubmit'])) 
+{
 	header("location:".e_PLUGIN."forum/forum_viewforum.php?".$_POST['forumjump']);
 	exit();
 }
@@ -419,6 +429,7 @@
 		$thread_id = $thread_info['thread_id'];
 		$ADMIN_ICONS = "
 			<form method='post' action='".e_SELF."?{$forum_id}' id='frmMod_{$forum_id}_{$thread_id}' style='margin:0;'><div>
+			<input type='hidden' name='e-token' value='".e_TOKEN."' />
 			";
 
 		$ADMIN_ICONS .= "<input type='image' ".IMAGE_admin_delete." name='delete_$thread_id' value='thread_action' onclick=\"return confirm_($thread_id)\" /> \n";
diff -x .svn -aruN 0.7.24.src/e107_plugins/forum/forum_viewtopic.php 0.7.26.src/e107_plugins/forum/forum_viewtopic.php
--- 0.7.24.src/e107_plugins/forum/forum_viewtopic.php	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_plugins/forum/forum_viewtopic.php	2011-03-13 09:15:19.000000000 -0500
@@ -11,11 +11,22 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $URL: https://e107.svn.sourceforge.net/svnroot/e107/trunk/e107_0.7/e107_plugins/forum/forum_viewtopic.php $
-|     $Id: forum_viewtopic.php 11678 2010-08-22 00:43:45Z e107coders $
+|     $Id: forum_viewtopic.php 12100 2011-03-13 14:15:43Z e107steved $
 +----------------------------------------------------------------------------+
 */
 
+if((isset($_POST['report_thread']) || in_array('thread_action', $_POST)) && !isset($_POST['e-token']))
+{
+	// set e-token so it can be processed by class2
+	$_POST['e-token'] = '';
+}
+
 require_once('../../class2.php');
+if (!isset($pref['plug_installed']['forum']))
+{
+	header('Location: '.e_BASE.'index.php');
+	exit;
+}
 
 include_lan(e_PLUGIN.'forum/languages/'.e_LANGUAGE.'/lan_forum_viewtopic.php');
 include_once(e_PLUGIN.'forum/forum_class.php');
@@ -40,17 +51,17 @@
 
 if (!e_QUERY)
 {
-	//No paramters given, redirect to forum home
+	//No paramaters given, redirect to forum home
 	header("Location:".e_PLUGIN."forum/forum.php");
 	exit;
 }
 else
 {
 	$tmp = explode(".", e_QUERY);
-	$thread_id = varset($tmp[0]);
+	$thread_id = intval(varset($tmp[0], 0));
 	$topic_from = varset($tmp[1], 0);
 	$action = varset($tmp[2]);
-	if (!$thread_id || !is_numeric($thread_id))
+	if (!$thread_id)
 	{
 		header("Location:".e_PLUGIN."forum/forum.php");
 		exit;
@@ -141,7 +152,7 @@
 		$text = LAN_424."<br /><br /><a href='forum_viewtopic.php?".$thread_id.".post'>".LAN_429."</a";
 		$ns->tablerender(LAN_414, $text, array('forum_viewtopic', 'report'));
 	} else {
-		$thread_name = $tp -> toHTML($thread_info['head']['thread_name'], TRUE, 'no_hook, emotes_off');
+		$thread_name = $tp -> toHTML($thread_info['head']['thread_name'], TRUE, 'USER_TITLE');
 		define("e_PAGETITLE", LAN_01." / ".LAN_426." ".$thread_name);
 		require_once(HEADERF);
 		$text = "<form action='".e_PLUGIN."forum/forum_viewtopic.php?".e_QUERY."' method='post'> <table style='width:100%'>
@@ -162,6 +173,7 @@
 			</tr>
 			<tr>
 			<td colspan='2' style='text-align:center;'><br />
+			<input type='hidden' name='e-token' value='".e_TOKEN."' />
 			<input class='button' type='submit' name='report_thread' value='".LAN_419."' />
 			</td>
 			</tr>
@@ -199,7 +211,7 @@
 
 $forum->thread_incview($thread_id);
 
-define("e_PAGETITLE", LAN_01." / ".$tp->toHTML($forum_info['forum_name'], TRUE, 'no_hook, emotes_off')." / ".$tp->toHTML($thread_info['head']['thread_name'], TRUE, 'no_hook, emotes_off'));
+define("e_PAGETITLE", LAN_01." / ".$tp->toHTML($forum_info['forum_name'], TRUE, 'USER_TITLE')." / ".$tp->toHTML($thread_info['head']['thread_name'], TRUE, 'USER_TITLE'));
 //define("MODERATOR", (preg_match("/".preg_quote(ADMINNAME)."/", $forum_info['forum_moderators']) && getperms('A') ? TRUE : FALSE));
 define("MODERATOR", $forum_info['forum_moderators'] != "" && check_class($forum_info['forum_moderators']));
 $modArray = $forum->forum_getmods($forum_info['forum_moderators']);
@@ -249,12 +261,12 @@
 	}
 }
 
-$forum_info['forum_name'] = $tp -> toHTML($forum_info['forum_name'], TRUE,'no_hook,emotes_off');
+$forum_info['forum_name'] = $tp -> toHTML($forum_info['forum_name'], TRUE,'USER_TITLE');
 
 // get info for main thread -------------------------------------------------------------------------------------------------------------------------------------------------------------------
 
 $forum->set_crumb(TRUE); // Set $BREADCRUMB (and BACKLINK)
-$THREADNAME = $tp->toHTML($thread_info['head']['thread_name'], TRUE, 'TITLE');
+$THREADNAME = $tp->toHTML($thread_info['head']['thread_name'], TRUE, 'USER_TITLE');
 $NEXTPREV = "&lt;&lt; <a href='".e_SELF."?{$thread_id}.{$forum_info['forum_id']}.prev'>".LAN_389."</a>";
 $NEXTPREV .= " | ";
 $NEXTPREV .= "<a href='".e_SELF."?{$thread_id}.{$forum_info['forum_id']}.next'>".LAN_390."</a> &gt;&gt;";
@@ -397,6 +409,7 @@
 		<div>
 		<a href='".e_PLUGIN."forum/forum_post.php?edit.{$post_info['thread_id']}.{$topic_from}'>".IMAGE_admin_edit."</a>
 		<input type='image' ".IMAGE_admin_delete." name='delete_{$post_info['thread_id']}' value='thread_action' onclick=\"return confirm_('{$type}', {$forum_id}, {$thread_id}, '{$post_info['user_name']}')\" />
+		<input type='hidden' name='e-token' value='".e_TOKEN."' />
 		";
 	if ($type == 'thread')
 	{
diff -x .svn -aruN 0.7.24.src/e107_plugins/forum/languages/English/lan_forum_admin.php 0.7.26.src/e107_plugins/forum/languages/English/lan_forum_admin.php
--- 0.7.24.src/e107_plugins/forum/languages/English/lan_forum_admin.php	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_plugins/forum/languages/English/lan_forum_admin.php	2011-06-02 14:58:44.000000000 -0500
@@ -4,9 +4,9 @@
 |     e107 website system - Language File.
 |
 |     $URL: https://e107.svn.sourceforge.net/svnroot/e107/trunk/e107_0.7/e107_plugins/forum/languages/English/lan_forum_admin.php $
-|     $Revision: 11678 $
-|     $Id: lan_forum_admin.php 11678 2010-08-22 00:43:45Z e107coders $
-|     $Author: e107coders $
+|     $Revision: 12242 $
+|     $Id: lan_forum_admin.php 12242 2011-06-02 19:59:08Z e107steved $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 define("FORLAN_1", "You must enter the number of days you wish to prune.");
@@ -75,6 +75,9 @@
 define("FORLAN_64", "Enter your levels here, if left blank generic stars will be used to denote level. Separate levels with comma. Maximum of 10 levels, lowest first.");
 define("FORLAN_65", "Forum Title");
 define("FORLAN_66", "Poll plugin not installed");
+define("FORLAN_67", "Posts to activate signature:");
+define("FORLAN_68", "The number of posts needed to allow someone's signature to show on the forums. (0 means none)");
+define("FORLAN_69", "Class whose signature is displayed in forums:");
 
 define("FORLAN_70", "Enable file / image attachments");
 define("FORLAN_71", "Allow users to upload file or image with their forum post,");
@@ -206,4 +209,4 @@
 define("FORLAN_182", "also recalculate replies for all threads in selected forum");
 define("FORLAN_183", "(this function is not allowed when selecting 'all forums' due to the number of queries it will generate)");
 
-?>
\ No newline at end of file
+?>
diff -x .svn -aruN 0.7.24.src/e107_plugins/forum/newforumposts_menu.php 0.7.26.src/e107_plugins/forum/newforumposts_menu.php
--- 0.7.24.src/e107_plugins/forum/newforumposts_menu.php	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_plugins/forum/newforumposts_menu.php	2011-05-29 07:08:17.000000000 -0500
@@ -11,14 +11,14 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $URL: https://e107.svn.sourceforge.net/svnroot/e107/trunk/e107_0.7/e107_plugins/forum/newforumposts_menu.php $
-|     $Revision: 11678 $
-|     $Id: newforumposts_menu.php 11678 2010-08-22 00:43:45Z e107coders $
-|     $Author: e107coders $
+|     $Revision: 12238 $
+|     $Id: newforumposts_menu.php 12238 2011-05-29 12:08:41Z e107steved $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 if (!defined('e107_INIT')) { exit; }
 
-global $tp;
+global $tp, $menu_pref;
 $gen = new convert;
 
 include_lan(e_PLUGIN."forum/languages/".e_LANGUAGE."/lan_newforumposts_menu.php");
@@ -29,7 +29,7 @@
 SELECT tp.thread_name AS parent_name, 
 t.thread_datestamp , t.thread_thread, t.thread_name, t.thread_id, t.thread_user, 
 f.forum_id, f.forum_name, f.forum_class, u.user_name, fp.forum_class FROM #forum_t AS t 
-LEFT JOIN #user AS u ON t.thread_user = u.user_id
+LEFT JOIN #user AS u ON SUBSTRING_INDEX(t.thread_user,'.',1) = u.user_id
 LEFT JOIN #forum_t AS tp ON t.thread_parent = tp.thread_id
 LEFT JOIN #forum AS f ON (f.forum_id = t.thread_forum_id AND f.forum_class IN (".USERCLASS_LIST."))
 LEFT JOIN #forum AS fp ON f.forum_parent = fp.forum_id
@@ -80,20 +80,20 @@
 		$bullet = '';
 		if(defined('BULLET'))
 		{
-			$bullet = '<img src="'.THEME.'images/'.BULLET.'" alt="" style="vertical-align: middle;" />';
+			$bullet = '<img src="'.THEME_ABS.'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="vertical-align: middle;" />';
 		}
 
 		if ($menu_pref['newforumposts_title'])
 		{
-			$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 />";
+			$text .= $bullet." <a href='".e_PLUGIN_ABS."forum/forum_viewtopic.php?{$id}.post'>".$topic."</a><br />".$fi['thread_thread']."<br />".NFP_11." ".$poster."<br />".$datestamp."<br /><br />";
 		}
 		else
 		{
-			$text .= $bullet." <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_ABS."forum/forum_viewtopic.php?{$id}.post'>".NFP_11." ".$poster."</a><br />".$fi['thread_thread']."<br />".$datestamp."<br/><br />";
 		}
 	}
 }
diff -x .svn -aruN 0.7.24.src/e107_plugins/forum/plugin.php 0.7.26.src/e107_plugins/forum/plugin.php
--- 0.7.24.src/e107_plugins/forum/plugin.php	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_plugins/forum/plugin.php	2011-05-02 15:45:16.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $URL: https://e107.svn.sourceforge.net/svnroot/e107/trunk/e107_0.7/e107_plugins/forum/plugin.php $
-|     $Revision: 11678 $
-|     $Id: plugin.php 11678 2010-08-22 00:43:45Z e107coders $
-|     $Author: e107coders $
+|     $Revision: 12178 $
+|     $Id: plugin.php 12178 2011-05-02 20:45:40Z e107steved $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 
@@ -84,7 +84,7 @@
 	forum_order int(10) unsigned NOT NULL default '0',
 	forum_postclass tinyint(3) unsigned NOT NULL default '0',
 	PRIMARY KEY  (forum_id)
-	) TYPE=MyISAM AUTO_INCREMENT=1;",
+	) ENGINE=MyISAM AUTO_INCREMENT=1;",
 	"CREATE TABLE ".MPREFIX."forum_t (
 	thread_id int(10) unsigned NOT NULL auto_increment,
 	thread_name varchar(250) NOT NULL default '',
@@ -104,7 +104,7 @@
 	KEY thread_parent (thread_parent),
 	KEY thread_datestamp (thread_datestamp),
 	KEY thread_forum_id (thread_forum_id)
-	) TYPE=MyISAM AUTO_INCREMENT=1;");
+	) ENGINE=MyISAM AUTO_INCREMENT=1;");
 
 // Create a link in main menu (yes=TRUE, no=FALSE) -------------------------------------------------------------
 $eplug_link = TRUE;
diff -x .svn -aruN 0.7.24.src/e107_plugins/gsitemap/gsitemap_sql.php 0.7.26.src/e107_plugins/gsitemap/gsitemap_sql.php
--- 0.7.24.src/e107_plugins/gsitemap/gsitemap_sql.php	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_plugins/gsitemap/gsitemap_sql.php	2011-03-11 12:49:32.000000000 -0600
@@ -10,4 +10,4 @@
 	gsitemap_img varchar(50) NOT NULL default '',
 	gsitemap_active int(3) NOT NULL default '0',
 	PRIMARY KEY  (gsitemap_id)
-) TYPE=MyISAM;
\ No newline at end of file
+) ENGINE=MyISAM;
\ No newline at end of file
diff -x .svn -aruN 0.7.24.src/e107_plugins/gsitemap/plugin.php 0.7.26.src/e107_plugins/gsitemap/plugin.php
--- 0.7.24.src/e107_plugins/gsitemap/plugin.php	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_plugins/gsitemap/plugin.php	2011-05-02 15:45:16.000000000 -0500
@@ -10,9 +10,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $URL: https://e107.svn.sourceforge.net/svnroot/e107/trunk/e107_0.7/e107_plugins/gsitemap/plugin.php $
-|     $Revision: 11677 $
-|     $Id: plugin.php 11677 2010-08-22 00:31:58Z e107coders $
-|     $Author: e107coders $
+|     $Revision: 12178 $
+|     $Id: plugin.php 12178 2011-05-02 20:45:40Z e107steved $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 
@@ -25,7 +25,7 @@
 
 $eplug_url = "http://e107coders.org";
 $eplug_email = "cameron@e107coders.org";
-$eplug_description = "Google Sitemap. For more information on the Google Sitemap protocol, go to <a href='http://www.google.com/webmasters/sitemaps/docs/en/protocol.html'>http://www.google.com/webmasters/sitemaps/docs/en/protocol.html</a>";
+$eplug_description = "Google Sitemap. For more information on the Sitemap protocol, go to <a href='http://www.sitemaps.org/'>http://www.sitemaps.org/</a> or <a href='http://www.google.com/support/webmasters/bin/answer.py?answer=156184'>Google's page About Sitemaps</a>";
 $eplug_compatible = "e107 v0.7";
 $eplug_readme = "";        // leave blank if no readme file
 
@@ -65,7 +65,7 @@
 	gsitemap_img varchar(50) NOT NULL default '',
 	gsitemap_active int(3) NOT NULL default '0',
 	PRIMARY KEY  (gsitemap_id)
-) TYPE=MyISAM;"
+) ENGINE=MyISAM;"
 );
 
 
@@ -82,17 +82,11 @@
 
 // upgrading ... //
 
-$upgrade_add_prefs = "";
-
-$upgrade_remove_prefs = "";
-
-$upgrade_alter_tables = "";
-
-$eplug_upgrade_done = "";
-
-
-
+$upgrade_add_prefs = '';
 
+$upgrade_remove_prefs = '';
 
+$upgrade_alter_tables = '';
 
+$eplug_upgrade_done = '';
 ?>
\ No newline at end of file
diff -x .svn -aruN 0.7.24.src/e107_plugins/links_page/admin_linkspage_config.php 0.7.26.src/e107_plugins/links_page/admin_linkspage_config.php
--- 0.7.24.src/e107_plugins/links_page/admin_linkspage_config.php	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_plugins/links_page/admin_linkspage_config.php	2010-10-09 06:51:25.000000000 -0500
@@ -10,8 +10,8 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $URL: https://e107.svn.sourceforge.net/svnroot/e107/trunk/e107_0.7/e107_plugins/links_page/admin_linkspage_config.php $
-|     $Revision: 11678 $
-|     $Id: admin_linkspage_config.php 11678 2010-08-22 00:43:45Z e107coders $
+|     $Revision: 11869 $
+|     $Id: admin_linkspage_config.php 11869 2010-10-09 11:51:49Z e107coders $
 |     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
@@ -22,6 +22,16 @@
 }
 require_once(e_PLUGIN.'links_page/link_shortcodes.php');
 require_once(e_PLUGIN.'links_page/link_defines.php');
+if(e_QUERY){
+	$qs = explode(".", e_QUERY);
+
+	if(is_numeric($qs[0])){
+		$from = array_shift($qs);
+	}else{
+		$from = "0";
+	}
+}
+
 require_once(e_ADMIN."auth.php");
 require_once(e_HANDLER."userclass_class.php");
 require_once(e_HANDLER."form_handler.php");
@@ -42,15 +52,7 @@
 //if (e_QUERY) {
 //	$qs = explode(".", e_QUERY);
 //}
-if(e_QUERY){
-	$qs = explode(".", e_QUERY);
 
-	if(is_numeric($qs[0])){
-		$from = array_shift($qs);
-	}else{
-		$from = "0";
-	}
-}
 if(isset($_POST['delete'])){
 	$tmp = array_pop($tmp = array_flip($_POST['delete']));
 	list($delete, $del_id) = explode("_", $tmp);
diff -x .svn -aruN 0.7.24.src/e107_plugins/links_page/link_menu.php 0.7.26.src/e107_plugins/links_page/link_menu.php
--- 0.7.24.src/e107_plugins/links_page/link_menu.php	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_plugins/links_page/link_menu.php	2011-01-05 17:30:23.000000000 -0600
@@ -20,11 +20,11 @@
 $bullet = '';
 if(defined('BULLET'))
 {
-	$bullet = '<img src="'.THEME.'images/'.BULLET.'" alt="" style="vertical-align: middle;" />';
+	$bullet = '<img src="'.THEME_ABS.'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="vertical-align: middle;" />';
 }
 
 global $linkspage_pref;
@@ -33,7 +33,7 @@
 //navigator -------------------------
 $mains = "";
 $text = "";
-$baseurl = e_PLUGIN."links_page/links.php";
+$baseurl = e_PLUGIN_ABS."links_page/links.php";
 if(isset($linkspage_pref['link_menu_navigator_frontpage']) && $linkspage_pref['link_menu_navigator_frontpage']){
 	if(isset($linkspage_pref['link_menu_navigator_rendertype']) && $linkspage_pref['link_menu_navigator_rendertype'] == "1"){
 		$mains .= $rs -> form_option(LAN_LINKS_14, "0", $baseurl, "");
@@ -105,7 +105,7 @@
 	$mains = "";
 	$cap = (isset($linkspage_pref['link_menu_category_caption']) && $linkspage_pref['link_menu_category_caption'] ? $linkspage_pref['link_menu_category_caption'] : LCLAN_OPT_83);
 	$sqlc = new db; $sql2 = new db;
-	if ($sqlc->db_Select("links_page_cat", "link_category_id, link_category_name", "link_category_class REGEXP '".e_CLASS_REGEXP."' ORDER BY link_category_name")){
+	if ($sqlc->db_Select("links_page_cat", "link_category_id, link_category_name", "link_category_class REGEXP '".e_CLASS_REGEXP."' ORDER BY link_category_order")){
 		while ($rowc = $sqlc->db_Fetch()){
 			if(isset($linkspage_pref['link_menu_category_amount']) && $linkspage_pref['link_menu_category_amount']){
 				$amount = $sql2 -> db_Count("links_page", "(*)", "WHERE link_category = '".$rowc['link_category_id']."' AND link_class REGEXP '".e_CLASS_REGEXP."' ");
diff -x .svn -aruN 0.7.24.src/e107_plugins/links_page/link_shortcodes.php 0.7.26.src/e107_plugins/links_page/link_shortcodes.php
--- 0.7.24.src/e107_plugins/links_page/link_shortcodes.php	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_plugins/links_page/link_shortcodes.php	2010-11-01 17:19:46.000000000 -0500
@@ -1,481 +1,481 @@
-<?php
-if (!defined('e107_INIT')) { exit; }
-include_once(e_HANDLER.'shortcode_handler.php');
-$link_shortcodes = $tp -> e_sc -> parse_scbatch(__FILE__);
-/*
-
-SC_BEGIN LINK_NAVIGATOR
-global $LINK_NAVIGATOR, $rs, $linkspage_pref, $qs;
-$mains = "";
-$baseurl = e_PLUGIN."links_page/links.php";
-if(isset($linkspage_pref['link_navigator_frontpage']) && $linkspage_pref['link_navigator_frontpage']){
-	$mains .= $rs -> form_option(LAN_LINKS_14, "0", $baseurl, "");
-}
-if(isset($linkspage_pref['link_navigator_refer']) && $linkspage_pref['link_navigator_refer']){
-	$mains .= $rs -> form_option(LAN_LINKS_12, "0", $baseurl."?top", "");
-}
-if(isset($linkspage_pref['link_navigator_rated']) && $linkspage_pref['link_navigator_rated']){
-	$mains .= $rs -> form_option(LAN_LINKS_13, "0", $baseurl."?rated", "");
-}
-if(isset($linkspage_pref['link_navigator_category']) && $linkspage_pref['link_navigator_category']){
-	$mains .= $rs -> form_option(LAN_LINKS_43, "0", $baseurl."?cat", "");
-}
-if(isset($linkspage_pref['link_navigator_links']) && $linkspage_pref['link_navigator_links']){
-	$mains .= $rs -> form_option(LCLAN_OPT_68, "0", $baseurl."?all", "");
-}
-if(isset($linkspage_pref['link_navigator_submit']) && $linkspage_pref['link_navigator_submit'] && isset($linkspage_pref['link_submit']) && $linkspage_pref['link_submit'] && check_class($linkspage_pref['link_submit_class'])){
-	$mains .= $rs -> form_option(LAN_LINKS_27, "0", $baseurl."?submit", "");
-}
-if(isset($linkspage_pref['link_navigator_manager']) && $linkspage_pref['link_navigator_manager'] && isset($linkspage_pref['link_manager']) && $linkspage_pref['link_manager'] && check_class($linkspage_pref['link_manager_class'])){
-	$mains .= $rs -> form_option(LCLAN_ITEM_35, "0", $baseurl."?manage", "");
-}
-if(isset($linkspage_pref['link_navigator_allcat']) && $linkspage_pref['link_navigator_allcat']){
-	$sqlc = new db;
-	if ($sqlc->db_Select("links_page_cat", "link_category_id, link_category_name", "link_category_class REGEXP '".e_CLASS_REGEXP."' ORDER BY link_category_name")){
-		$mains .= $rs -> form_option("&nbsp;", "0", "", "");
-		$mains .= $rs -> form_option(LAN_LINKS_48, "0", "", "");
-		while ($rowc = $sqlc->db_Fetch()){
-			$mains .= $rs -> form_option($rowc['link_category_name'], "0", $baseurl."?cat.".$rowc['link_category_id'], "");
-		}
-	}
-}
-
-if($mains){
-	$main = "";
-
-	$selectjs = " onchange=\"if(this.options[this.selectedIndex].value.indexOf('-') &amp;&amp; this.options[this.selectedIndex].value != '' &amp;&amp; this.options[this.selectedIndex].value != '&nbsp;'){ return document.location=this.options[this.selectedIndex].value; }\" ";
-
-//	$selectjs = " onchange=\"if(this.options[this.selectedIndex].value != '-- view category --' || this.options[this.selectedIndex].value != '&nbsp;'){ return document.location=this.options[this.selectedIndex].value; }\" ";
-	$main .= $rs -> form_select_open("navigator", $selectjs);
-	$main .= $rs -> form_option(LAN_LINKS_47, "0", "", "");
-	$main .= $mains;
-	$main .= $rs -> form_select_close();
-	return $main;
-}
-SC_END
-
-SC_BEGIN LINK_SORTORDER
-global $LINK_SORTORDER;
-return $LINK_SORTORDER;
-SC_END
-
-SC_BEGIN LINK_NAVIGATOR_TABLE_PRE
-global $LINK_NAVIGATOR_TABLE_PRE;
-if($LINK_NAVIGATOR_TABLE_PRE === TRUE){
-$LINK_NAVIGATOR_TABLE_PRE = " ";
-return $LINK_NAVIGATOR_TABLE_PRE;
-}
-SC_END
-SC_BEGIN LINK_NAVIGATOR_TABLE_POST
-global $LINK_NAVIGATOR_TABLE_POST;
-if($LINK_NAVIGATOR_TABLE_POST === TRUE){
-$LINK_NAVIGATOR_TABLE_POST = " ";
-return $LINK_NAVIGATOR_TABLE_POST;
-}
-SC_END
-
-
-
-SC_BEGIN LINK_NEXTPREV
-global $LINK_NEXTPREV;
-return $LINK_NEXTPREV;
-SC_END
-
-
-
-
-
-
-
-
-
-
-
-
-
-// LINK_TABLE_MANAGER ------------------------------------------------
-SC_BEGIN LINK_MANAGE_ICON
-global $LINK_MANAGE_ICON, $row;
-$LINK_MANAGE_ICON = "";
-return $LINK_MANAGE_ICON;
-SC_END
-
-SC_BEGIN LINK_MANAGE_NAME
-global $LINK_MANAGE_NAME, $row, $tp;
-return $tp->toHTML($row['link_name'], TRUE);
-SC_END
-
-SC_BEGIN LINK_MANAGE_OPTIONS
-global $LINK_MANAGE_OPTIONS, $row, $tp, $linkspage_pref;
-$linkid = $row['link_id'];
-$LINK_MANAGE_OPTIONS = "<a href='".e_SELF."?manage.edit.".$linkid."' title='".LCLAN_ITEM_31."'>".LINK_ICON_EDIT."</a>";
-if (isset($linkspage_pref['link_directdelete']) && $linkspage_pref['link_directdelete']){
-	$LINK_MANAGE_OPTIONS .= " <input type='image' title='delete' name='delete[main_{$linkid}]' alt='".LCLAN_ITEM_32."' src='".LINK_ICON_DELETE_BASE."' onclick=\"return jsconfirm('".$tp->toJS(LCLAN_ITEM_33." [ ".$row['link_name']." ]")."')\" style='vertical-align:top;' />";
-}
-return $LINK_MANAGE_OPTIONS;
-SC_END
-
-SC_BEGIN LINK_MANAGE_CAT
-global $LINK_MANAGE_CAT, $tp, $row;
-return $tp->toHTML($row['link_category_name'], TRUE);
-SC_END
-
-SC_BEGIN LINK_MANAGE_NEWLINK
-global $LINK_MANAGE_NEWLINK;
-return "<a href='".e_SELF."?manage'>".LAN_LINKS_MANAGER_3."</a>";
-SC_END
-
-
-
-
-
-
-
-// LINK_MAIN_TABLE ------------------------------------------------
-SC_BEGIN LINK_MAIN_HEADING
-global $LINK_MAIN_HEADING, $rowl, $tp;
-return (!$rowl['total_links'] ? $rowl['link_category_name'] : "<a href='links.php?cat.".$rowl['link_category_id']."'>".$tp->toHTML($rowl['link_category_name'], TRUE)."</a>");
-SC_END
-
-SC_BEGIN LINK_MAIN_DESC
-global $LINK_MAIN_DESC, $rowl, $linkspage_pref, $tp;
-return (isset($linkspage_pref['link_cat_desc']) && $linkspage_pref['link_cat_desc'] ? $tp->toHTML($rowl['link_category_description'], TRUE,'description') : "");
-SC_END
-
-SC_BEGIN LINK_MAIN_NUMBER
-global $LINK_MAIN_NUMBER, $rowl, $linkspage_pref;
-if(isset($linkspage_pref['link_cat_amount']) && $linkspage_pref['link_cat_amount']){
-$LINK_MAIN_NUMBER = $rowl['total_links']." ".($rowl['total_links'] == 1 ? LAN_LINKS_17 : LAN_LINKS_18)." ".LAN_LINKS_16;
-}else{
-$LINK_MAIN_NUMBER = "";
-}
-return $LINK_MAIN_NUMBER;
-SC_END
-
-SC_BEGIN LINK_MAIN_ICON
-global $LINK_MAIN_ICON, $rowl, $linkspage_pref;
-$LINK_MAIN_ICON = "";
-$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']))
-			{
-			$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 = $bullet;
-				}
-			}
-		}
-	}
-	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>";
-	}
-}
-return $LINK_MAIN_ICON;
-SC_END
-
-SC_BEGIN LINK_MAIN_TOTAL
-global $LINK_MAIN_TOTAL, $sql, $category_total, $linkspage_pref, $alllinks;
-if(isset($linkspage_pref['link_cat_total']) && $linkspage_pref['link_cat_total']){
-$LINK_MAIN_TOTAL = LAN_LINKS_21." ".($alllinks == 1 ? LAN_LINKS_22 : LAN_LINKS_23)." ".$alllinks." ".($alllinks == 1 ? LAN_LINKS_17 : LAN_LINKS_18)." ".LAN_LINKS_24." ".$category_total." ".($category_total == 1 ? LAN_LINKS_20 : LAN_LINKS_19);
-}else{
-$LINK_MAIN_TOTAL = "";
-}
-return $LINK_MAIN_TOTAL;
-SC_END
-
-SC_BEGIN LINK_MAIN_SHOWALL
-global $LINK_MAIN_SHOWALL, $linkspage_pref;
-return (isset($linkspage_pref['link_cat_total']) && $linkspage_pref['link_cat_total'] ? "<a href='".e_PLUGIN_ABS."links_page/links.php?cat.all'>".LAN_LINKS_25."</a>" : "");
-SC_END
-
-
-
-
-// LINK_TABLE ------------------------------------------------
-SC_BEGIN LINK_BUTTON
-global $LINK_BUTTON, $linkspage_pref, $rowl, $LINK_NAME, $LINK_APPEND;
-
-if(!$linkspage_pref['link_icon']){
-	return "";
-}
-$LINK_BUTTON = "&nbsp;";
-if(isset($linkspage_pref['link_icon']) && $linkspage_pref['link_icon']){
-	if ($rowl['link_button']) {
-		if (strpos($rowl['link_button'], "http://") !== FALSE) {
-			$LINK_BUTTON = $LINK_APPEND."\n<img class='linkspage_button' src='".$rowl['link_button']."' alt='' /></a>";
-		} else {
-			if(strstr($rowl['link_button'], "/")){
-				if(file_exists(e_BASE.$rowl['link_button'])){
-					$LINK_BUTTON = $LINK_APPEND."\n<img class='linkspage_button' src='".e_BASE.$rowl['link_button']."' alt='' /></a>";
-				} else {
-					if(isset($linkspage_pref['link_icon_empty']) && $linkspage_pref['link_icon_empty']){
-						$LINK_BUTTON = $LINK_APPEND."\n<img class='linkspage_button' style='width: 88px; height: 31px;' src='".e_PLUGIN_ABS."links_page/images/generic.png' alt='' /></a>";
-					}
-				}
-			}else{
-				if(file_exists(e_PLUGIN."links_page/link_images/".$rowl['link_button'])){
-					$LINK_BUTTON = $LINK_APPEND."\n<img class='linkspage_button' src='".e_PLUGIN_ABS."links_page/link_images/".$rowl['link_button']."' alt='' /></a>";
-				}else{
-					if(isset($linkspage_pref['link_icon_empty']) && $linkspage_pref['link_icon_empty']){
-					$LINK_BUTTON = $LINK_APPEND."\n<img class='linkspage_button' style='width: 88px; height: 31px;' src='".e_PLUGIN_ABS."links_page/images/generic.png' alt='' /></a>";
-					}
-				}
-			}
-		}
-	} else {
-		if(isset($linkspage_pref['link_icon_empty']) && $linkspage_pref['link_icon_empty']){
-			$LINK_BUTTON = $LINK_APPEND."\n<img class='linkspage_button' style='width: 88px; height: 31px;' src='".e_PLUGIN_ABS."links_page/images/generic.png' alt='' /></a>";
-		}
-	}
-}else{
-	if(isset($linkspage_pref['link_icon_empty']) && $linkspage_pref['link_icon_empty']){
-		$LINK_BUTTON = $LINK_APPEND."\n<img class='linkspage_button' style='width: 88px; height: 31px;' src='".e_PLUGIN_ABS."links_page/images/generic.png' alt='' /></a>";
-	}
-}
-return $LINK_BUTTON;
-SC_END
-
-SC_BEGIN BUTTON_COLUMN
-global $linkbutton_count,$linkspage_pref;
-return ($linkspage_pref['link_icon']) ? 2 : 1;
-SC_END
-
-SC_BEGIN LINK_APPEND
-global $LINK_APPEND;
-return $LINK_APPEND;
-SC_END
-
-SC_BEGIN LINK_NAME
-global $LINK_NAME, $rowl;
-return $rowl['link_name'];
-SC_END
-
-SC_BEGIN LINK_URL
-global $LINK_URL, $linkspage_pref, $rowl;
-if(!$linkspage_pref['link_url'])
-{
-	return "";
-}
-return ($parm == "link") ? "<a class='linkspage_url' href=\"".$rowl['link_url']."\" rel='external' title=\"".$rowl['link_description']."\">".$rowl['link_url']."</a>" : $rowl['link_url'];
-SC_END
-
-SC_BEGIN LINK_REFER
-global $LINK_REFER, $linkspage_pref, $rowl;
-return (isset($linkspage_pref['link_referal']) && $linkspage_pref['link_referal'] ? $rowl['link_refer'] : "");
-SC_END
-
-SC_BEGIN LINK_COMMENT
-global $LINK_COMMENT, $linkspage_pref, $rowl;
-return (isset($linkspage_pref['link_comment']) && $linkspage_pref['link_comment'] ? "<a href='".e_SELF."?comment.".$rowl['link_id']."'>".($rowl['link_comment'] ? $rowl['link_comment'] : "0")."</a>" : "");
-SC_END
-
-SC_BEGIN LINK_DESC
-global $LINK_DESC, $linkspage_pref, $tp, $rowl;
-return (isset($linkspage_pref['link_desc']) && $linkspage_pref['link_desc'] ? $tp->toHTML($rowl['link_description'], TRUE,'BODY') : "");
-SC_END
-
-SC_BEGIN LINK_RATING
-global $LINK_RATING, $LINK_RATED_RATING, $linkspage_pref, $rater, $rowl, $qs;
-$LINK_RATING = "";
-if(isset($linkspage_pref['link_rating']) && $linkspage_pref['link_rating']){
-$LINK_RATING = $rater->composerating("links_page", $rowl['link_id'], $enter=TRUE, $userid=FALSE);
-}
-return $LINK_RATING;
-SC_END
-
-SC_BEGIN LINK_NEW
-global $LINK_NEW, $linkspage_pref, $qs, $rowl;
-$LINK_NEW = "";
-if(USER && $rowl['link_datestamp'] > USERLV){
-$LINK_NEW = "<img class='linkspage_new' src='".IMAGE_NEW."' alt='' style='vertical-align:middle' />";
-}
-return $LINK_NEW;
-SC_END
-
-SC_BEGIN LINK_CAT_NAME
-global $rowl;
-return $rowl['link_category_name'];
-SC_END
-
-SC_BEGIN LINK_CAT_DESC
-global $rowl;
-return $rowl['link_category_description'];
-SC_END
-
-SC_BEGIN LINK_CAT_TOTAL
-global $link_category_total;
-return " (<span title='".(ADMIN ? LAN_LINKS_2 : LAN_LINKS_1)."' >".$link_category_total."</span>".(ADMIN ? "/<span title='".(ADMIN ? LAN_LINKS_1 : "" )."' >".$link_category_total."</span>" : "").") ";
-SC_END
-
-SC_BEGIN LINK_REFER_LAN
-global $linkspage_pref;
-return (isset($linkspage_pref['link_referal']) && $linkspage_pref['link_referal'] ? LAN_LINKS_26 : "");
-SC_END
-
-SC_BEGIN LINK_COMMENT_LAN
-global $linkspage_pref;
-return (isset($linkspage_pref['link_comment']) && $linkspage_pref['link_comment'] ? LAN_LINKS_37 : "");
-SC_END
-
-SC_BEGIN LINK_RATING_LAN
-global $linkspage_pref;
-if(isset($linkspage_pref['link_rating']) && $linkspage_pref['link_rating']){
-    return LCLAN_ITEM_39;
-}
-return "";
-SC_END
-
-SC_BEGIN NAVIGATOR
-return displayNavigator('');
-SC_END
-
-
-// LINK_TOP_TABLE ------------------------------------------------
-
-
-
-// LINK_RATED_TABLE ------------------------------------------------
-SC_BEGIN LINK_RATED_RATING
-global $LINK_RATED_RATING, $rowl;
-$tmp = explode(".", $rowl['rate_avg']);
-$one = $tmp[0];
-$two = round($tmp[1],1);
-$rating = $one.".".$two." ";
-for($c=1; $c<= $one; $c++){
-	$rating .= "<img src='".e_IMAGE_ABS."rate/box.png' alt='' style='height:8px; vertical-align:middle' />";
-}
-if($one < 10){
-	for($c=9; $c>=$one; $c--){
-		$rating .= "<img src='".e_IMAGE_ABS."rate/empty.png' alt='' style='height:8px; vertical-align:middle' />";
-	}
-}
-$rating .= "<img src='".e_IMAGE_ABS."rate/boxend.png' alt='' style='height:8px; vertical-align:middle' />";
-return $rating;
-SC_END
-
-SC_BEGIN LINK_RATED_BUTTON
-global $LINK_RATED_BUTTON, $linkspage_pref, $rowl, $LINK_RATED_NAME, $LINK_RATED_APPEND;
-if(isset($linkspage_pref['link_icon']) && $linkspage_pref['link_icon']){
-	if ($rowl['link_button']) {
-		if (strpos($rowl['link_button'], "http://") !== FALSE) {
-			$LINK_RATED_BUTTON = $LINK_RATED_APPEND."\n<img style='border:0;' src='".$rowl['link_button']."' alt='".$LINK_RATED_NAME."' /></a>";
-		} else {
-			if(strstr($rowl['link_button'], "/")){
-				$LINK_RATED_BUTTON = $LINK_RATED_APPEND."\n<img style='border:0;' src='".e_BASE.$rowl['link_button']."' alt='".$LINK_RATED_NAME."' /></a>";
-			}else{
-				$LINK_RATED_BUTTON = $LINK_RATED_APPEND."\n<img style='border:0' src='".e_PLUGIN_ABS."links_page/link_images/".$rowl['link_button']."' alt='".$LINK_RATED_NAME."' /></a>";
-			}
-		}
-	} else {
-		if(isset($linkspage_pref['link_icon_empty']) && $linkspage_pref['link_icon_empty']){
-			$LINK_RATED_BUTTON = $LINK_RATED_APPEND."\n<img style='border:0; width: 88px; height: 31px;' src='".e_PLUGIN_ABS."links_page/images/generic.png' alt='".$LINK_RATED_NAME."' /></a>";
-		}else{
-			$LINK_RATED_BUTTON = "";
-		}
-	}
-}else{
-	if(isset($linkspage_pref['link_icon_empty']) && $linkspage_pref['link_icon_empty']){
-		$LINK_RATED_BUTTON = $LINK_RATED_APPEND."\n<img style='border:0; width: 88px; height: 31px;' src='".e_PLUGIN_ABS."links_page/images/generic.png' alt='".$LINK_RATED_NAME."' /></a>";
-	}else{
-		$LINK_RATED_BUTTON = "";
-	}
-}
-return $LINK_RATED_BUTTON;
-SC_END
-
-SC_BEGIN LINK_RATED_APPEND
-global $LINK_RATED_APPEND;
-return $LINK_RATED_APPEND;
-SC_END
-
-SC_BEGIN LINK_RATED_CATEGORY
-global $LINK_RATED_CATEGORY, $rowl, $qs, $tp;
-if(!isset($qs[1])){
-$LINK_RATED_CATEGORY = "<a href='".e_SELF."?cat.".$rowl['link_category_id']."'>".$tp->toHTML($rowl['link_category_name'], TRUE)."</a>";
-}
-return $LINK_RATED_CATEGORY;
-SC_END
-
-SC_BEGIN LINK_RATED_NAME
-global $LINK_RATED_NAME, $rowl;
-return $rowl['link_name'];
-SC_END
-
-SC_BEGIN LINK_RATED_URL
-global $LINK_RATED_URL, $linkspage_pref, $rowl;
-return (isset($linkspage_pref['link_url']) && $linkspage_pref['link_url'] ? $rowl['link_url'] : "");
-SC_END
-
-SC_BEGIN LINK_RATED_REFER
-global $LINK_RATED_REFER, $linkspage_pref, $rowl;
-return (isset($linkspage_pref['link_referal']) && $linkspage_pref['link_referal'] ? LAN_LINKS_26." ".$rowl['link_refer'] : "");
-SC_END
-
-SC_BEGIN LINK_RATED_DESC
-global $LINK_RATED_DESC, $linkspage_pref, $tp, $rowl;
-return (isset($linkspage_pref['link_desc']) && $linkspage_pref['link_desc'] ? $tp->toHTML($rowl['link_description'], TRUE) : "");
-SC_END
-
-
-
-
-
-// LINK_SUBMIT_TABLE ------------------------------------------------
-SC_BEGIN LINK_SUBMIT_CAT
-global $LINK_SUBMIT_CAT;
-return $LINK_SUBMIT_CAT;
-SC_END
-
-SC_BEGIN LINK_SUBMIT_PRETEXT
-global $LINK_SUBMIT_PRETEXT, $linkspage_pref;
-if(isset($linkspage_pref['link_submit_directpost']) && $linkspage_pref['link_submit_directpost']){
-return "";
-}else{
-return LCLAN_SL_9;
-}
-
-SC_END
-
-
-*/
-?>
+<?php
+if (!defined('e107_INIT')) { exit; }
+include_once(e_HANDLER.'shortcode_handler.php');
+$link_shortcodes = $tp -> e_sc -> parse_scbatch(__FILE__);
+/*
+
+SC_BEGIN LINK_NAVIGATOR
+global $LINK_NAVIGATOR, $rs, $linkspage_pref, $qs;
+$mains = "";
+$baseurl = e_PLUGIN."links_page/links.php";
+if(isset($linkspage_pref['link_navigator_frontpage']) && $linkspage_pref['link_navigator_frontpage']){
+	$mains .= $rs -> form_option(LAN_LINKS_14, "0", $baseurl, "");
+}
+if(isset($linkspage_pref['link_navigator_refer']) && $linkspage_pref['link_navigator_refer']){
+	$mains .= $rs -> form_option(LAN_LINKS_12, "0", $baseurl."?top", "");
+}
+if(isset($linkspage_pref['link_navigator_rated']) && $linkspage_pref['link_navigator_rated']){
+	$mains .= $rs -> form_option(LAN_LINKS_13, "0", $baseurl."?rated", "");
+}
+if(isset($linkspage_pref['link_navigator_category']) && $linkspage_pref['link_navigator_category']){
+	$mains .= $rs -> form_option(LAN_LINKS_43, "0", $baseurl."?cat", "");
+}
+if(isset($linkspage_pref['link_navigator_links']) && $linkspage_pref['link_navigator_links']){
+	$mains .= $rs -> form_option(LCLAN_OPT_68, "0", $baseurl."?all", "");
+}
+if(isset($linkspage_pref['link_navigator_submit']) && $linkspage_pref['link_navigator_submit'] && isset($linkspage_pref['link_submit']) && $linkspage_pref['link_submit'] && check_class($linkspage_pref['link_submit_class'])){
+	$mains .= $rs -> form_option(LAN_LINKS_27, "0", $baseurl."?submit", "");
+}
+if(isset($linkspage_pref['link_navigator_manager']) && $linkspage_pref['link_navigator_manager'] && isset($linkspage_pref['link_manager']) && $linkspage_pref['link_manager'] && check_class($linkspage_pref['link_manager_class'])){
+	$mains .= $rs -> form_option(LCLAN_ITEM_35, "0", $baseurl."?manage", "");
+}
+if(isset($linkspage_pref['link_navigator_allcat']) && $linkspage_pref['link_navigator_allcat']){
+	$sqlc = new db;
+	if ($sqlc->db_Select("links_page_cat", "link_category_id, link_category_name", "link_category_class REGEXP '".e_CLASS_REGEXP."' ORDER BY link_category_name")){
+		$mains .= $rs -> form_option("&nbsp;", "0", "", "");
+		$mains .= $rs -> form_option(LAN_LINKS_48, "0", "", "");
+		while ($rowc = $sqlc->db_Fetch()){
+			$mains .= $rs -> form_option($rowc['link_category_name'], "0", $baseurl."?cat.".$rowc['link_category_id'], "");
+		}
+	}
+}
+
+if($mains){
+	$main = "";
+
+	$selectjs = " onchange=\"if(this.options[this.selectedIndex].value.indexOf('-') &amp;&amp; this.options[this.selectedIndex].value != '' &amp;&amp; this.options[this.selectedIndex].value != '&nbsp;'){ return document.location=this.options[this.selectedIndex].value; }\" ";
+
+//	$selectjs = " onchange=\"if(this.options[this.selectedIndex].value != '-- view category --' || this.options[this.selectedIndex].value != '&nbsp;'){ return document.location=this.options[this.selectedIndex].value; }\" ";
+	$main .= $rs -> form_select_open("navigator", $selectjs);
+	$main .= $rs -> form_option(LAN_LINKS_47, "0", "", "");
+	$main .= $mains;
+	$main .= $rs -> form_select_close();
+	return $main;
+}
+SC_END
+
+SC_BEGIN LINK_SORTORDER
+global $LINK_SORTORDER;
+return $LINK_SORTORDER;
+SC_END
+
+SC_BEGIN LINK_NAVIGATOR_TABLE_PRE
+global $LINK_NAVIGATOR_TABLE_PRE;
+if($LINK_NAVIGATOR_TABLE_PRE === TRUE){
+$LINK_NAVIGATOR_TABLE_PRE = " ";
+return $LINK_NAVIGATOR_TABLE_PRE;
+}
+SC_END
+SC_BEGIN LINK_NAVIGATOR_TABLE_POST
+global $LINK_NAVIGATOR_TABLE_POST;
+if($LINK_NAVIGATOR_TABLE_POST === TRUE){
+$LINK_NAVIGATOR_TABLE_POST = " ";
+return $LINK_NAVIGATOR_TABLE_POST;
+}
+SC_END
+
+
+
+SC_BEGIN LINK_NEXTPREV
+global $LINK_NEXTPREV;
+return $LINK_NEXTPREV;
+SC_END
+
+
+
+
+
+
+
+
+
+
+
+
+
+// LINK_TABLE_MANAGER ------------------------------------------------
+SC_BEGIN LINK_MANAGE_ICON
+global $LINK_MANAGE_ICON, $row;
+$LINK_MANAGE_ICON = "";
+return $LINK_MANAGE_ICON;
+SC_END
+
+SC_BEGIN LINK_MANAGE_NAME
+global $LINK_MANAGE_NAME, $row, $tp;
+return $tp->toHTML($row['link_name'], TRUE);
+SC_END
+
+SC_BEGIN LINK_MANAGE_OPTIONS
+global $LINK_MANAGE_OPTIONS, $row, $tp, $linkspage_pref;
+$linkid = $row['link_id'];
+$LINK_MANAGE_OPTIONS = "<a href='".e_SELF."?manage.edit.".$linkid."' title='".LCLAN_ITEM_31."'>".LINK_ICON_EDIT."</a>";
+if (isset($linkspage_pref['link_directdelete']) && $linkspage_pref['link_directdelete']){
+	$LINK_MANAGE_OPTIONS .= " <input type='image' title='delete' name='delete[main_{$linkid}]' alt='".LCLAN_ITEM_32."' src='".LINK_ICON_DELETE_BASE."' onclick=\"return jsconfirm('".$tp->toJS(LCLAN_ITEM_33." [ ".$row['link_name']." ]")."')\" style='vertical-align:top;' />";
+}
+return $LINK_MANAGE_OPTIONS;
+SC_END
+
+SC_BEGIN LINK_MANAGE_CAT
+global $LINK_MANAGE_CAT, $tp, $row;
+return $tp->toHTML($row['link_category_name'], TRUE);
+SC_END
+
+SC_BEGIN LINK_MANAGE_NEWLINK
+global $LINK_MANAGE_NEWLINK;
+return "<a href='".e_SELF."?manage'>".LAN_LINKS_MANAGER_3."</a>";
+SC_END
+
+
+
+
+
+
+
+// LINK_MAIN_TABLE ------------------------------------------------
+SC_BEGIN LINK_MAIN_HEADING
+global $LINK_MAIN_HEADING, $rowl, $tp;
+return (!$rowl['total_links'] ? $rowl['link_category_name'] : "<a href='links.php?cat.".$rowl['link_category_id']."'>".$tp->toHTML($rowl['link_category_name'], TRUE)."</a>");
+SC_END
+
+SC_BEGIN LINK_MAIN_DESC
+global $LINK_MAIN_DESC, $rowl, $linkspage_pref, $tp;
+return (isset($linkspage_pref['link_cat_desc']) && $linkspage_pref['link_cat_desc'] ? $tp->toHTML($rowl['link_category_description'], TRUE,'description') : "");
+SC_END
+
+SC_BEGIN LINK_MAIN_NUMBER
+global $LINK_MAIN_NUMBER, $rowl, $linkspage_pref;
+if(isset($linkspage_pref['link_cat_amount']) && $linkspage_pref['link_cat_amount']){
+$LINK_MAIN_NUMBER = $rowl['total_links']." ".($rowl['total_links'] == 1 ? LAN_LINKS_17 : LAN_LINKS_18)." ".LAN_LINKS_16;
+}else{
+$LINK_MAIN_NUMBER = "";
+}
+return $LINK_MAIN_NUMBER;
+SC_END
+
+SC_BEGIN LINK_MAIN_ICON
+global $LINK_MAIN_ICON, $rowl, $linkspage_pref;
+$LINK_MAIN_ICON = "";
+$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']))
+			{
+			$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 = $bullet;
+				}
+			}
+		}
+	}
+	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>";
+	}
+}
+return $LINK_MAIN_ICON;
+SC_END
+
+SC_BEGIN LINK_MAIN_TOTAL
+global $LINK_MAIN_TOTAL, $sql, $category_total, $linkspage_pref, $alllinks;
+if(isset($linkspage_pref['link_cat_total']) && $linkspage_pref['link_cat_total']){
+$LINK_MAIN_TOTAL = LAN_LINKS_21." ".($alllinks == 1 ? LAN_LINKS_22 : LAN_LINKS_23)." ".$alllinks." ".($alllinks == 1 ? LAN_LINKS_17 : LAN_LINKS_18)." ".LAN_LINKS_24." ".$category_total." ".($category_total == 1 ? LAN_LINKS_20 : LAN_LINKS_19);
+}else{
+$LINK_MAIN_TOTAL = "";
+}
+return $LINK_MAIN_TOTAL;
+SC_END
+
+SC_BEGIN LINK_MAIN_SHOWALL
+global $LINK_MAIN_SHOWALL, $linkspage_pref;
+return (isset($linkspage_pref['link_cat_total']) && $linkspage_pref['link_cat_total'] ? "<a href='".e_PLUGIN_ABS."links_page/links.php?cat.all'>".LAN_LINKS_25."</a>" : "");
+SC_END
+
+
+
+
+// LINK_TABLE ------------------------------------------------
+SC_BEGIN LINK_BUTTON
+global $LINK_BUTTON, $linkspage_pref, $rowl, $LINK_NAME, $LINK_APPEND;
+
+if(!$linkspage_pref['link_icon']){
+	return "";
+}
+$LINK_BUTTON = "&nbsp;";
+if(isset($linkspage_pref['link_icon']) && $linkspage_pref['link_icon']){
+	if ($rowl['link_button']) {
+		if (strpos($rowl['link_button'], "http://") !== FALSE) {
+			$LINK_BUTTON = $LINK_APPEND."\n<img class='linkspage_button' src='".$rowl['link_button']."' alt='' /></a>";
+		} else {
+			if(strstr($rowl['link_button'], "/")){
+				if(file_exists(e_BASE.$rowl['link_button'])){
+					$LINK_BUTTON = $LINK_APPEND."\n<img class='linkspage_button' src='".e_BASE.$rowl['link_button']."' alt='' /></a>";
+				} else {
+					if(isset($linkspage_pref['link_icon_empty']) && $linkspage_pref['link_icon_empty']){
+						$LINK_BUTTON = $LINK_APPEND."\n<img class='linkspage_button' style='width: 88px; height: 31px;' src='".e_PLUGIN_ABS."links_page/images/generic.png' alt='' /></a>";
+					}
+				}
+			}else{
+				if(file_exists(e_PLUGIN."links_page/link_images/".$rowl['link_button'])){
+					$LINK_BUTTON = $LINK_APPEND."\n<img class='linkspage_button' src='".e_PLUGIN_ABS."links_page/link_images/".$rowl['link_button']."' alt='' /></a>";
+				}else{
+					if(isset($linkspage_pref['link_icon_empty']) && $linkspage_pref['link_icon_empty']){
+					$LINK_BUTTON = $LINK_APPEND."\n<img class='linkspage_button' style='width: 88px; height: 31px;' src='".e_PLUGIN_ABS."links_page/images/generic.png' alt='' /></a>";
+					}
+				}
+			}
+		}
+	} else {
+		if(isset($linkspage_pref['link_icon_empty']) && $linkspage_pref['link_icon_empty']){
+			$LINK_BUTTON = $LINK_APPEND."\n<img class='linkspage_button' style='width: 88px; height: 31px;' src='".e_PLUGIN_ABS."links_page/images/generic.png' alt='' /></a>";
+		}
+	}
+}else{
+	if(isset($linkspage_pref['link_icon_empty']) && $linkspage_pref['link_icon_empty']){
+		$LINK_BUTTON = $LINK_APPEND."\n<img class='linkspage_button' style='width: 88px; height: 31px;' src='".e_PLUGIN_ABS."links_page/images/generic.png' alt='' /></a>";
+	}
+}
+return $LINK_BUTTON;
+SC_END
+
+SC_BEGIN BUTTON_COLUMN
+global $linkbutton_count,$linkspage_pref;
+return ($linkspage_pref['link_icon']) ? 2 : 1;
+SC_END
+
+SC_BEGIN LINK_APPEND
+global $LINK_APPEND;
+return $LINK_APPEND;
+SC_END
+
+SC_BEGIN LINK_NAME
+global $LINK_NAME, $rowl;
+return $rowl['link_name'];
+SC_END
+
+SC_BEGIN LINK_URL
+global $LINK_URL, $linkspage_pref, $rowl;
+if(!isset($linkspage_pref['link_url']))
+{
+	return "";
+}
+return ($parm == "link") ? "<a class='linkspage_url' href=\"".$rowl['link_url']."\" rel='external' title=\"".$rowl['link_description']."\">".$rowl['link_url']."</a>" : $rowl['link_url'];
+SC_END
+
+SC_BEGIN LINK_REFER
+global $LINK_REFER, $linkspage_pref, $rowl;
+return (isset($linkspage_pref['link_referal']) && $linkspage_pref['link_referal'] ? $rowl['link_refer'] : "");
+SC_END
+
+SC_BEGIN LINK_COMMENT
+global $LINK_COMMENT, $linkspage_pref, $rowl;
+return (isset($linkspage_pref['link_comment']) && $linkspage_pref['link_comment'] ? "<a href='".e_SELF."?comment.".$rowl['link_id']."'>".($rowl['link_comment'] ? $rowl['link_comment'] : "0")."</a>" : "");
+SC_END
+
+SC_BEGIN LINK_DESC
+global $LINK_DESC, $linkspage_pref, $tp, $rowl;
+return (isset($linkspage_pref['link_desc']) && $linkspage_pref['link_desc'] ? $tp->toHTML($rowl['link_description'], TRUE,'BODY') : "");
+SC_END
+
+SC_BEGIN LINK_RATING
+global $LINK_RATING, $LINK_RATED_RATING, $linkspage_pref, $rater, $rowl, $qs;
+$LINK_RATING = "";
+if(isset($linkspage_pref['link_rating']) && $linkspage_pref['link_rating']){
+$LINK_RATING = $rater->composerating("links_page", $rowl['link_id'], $enter=TRUE, $userid=FALSE);
+}
+return $LINK_RATING;
+SC_END
+
+SC_BEGIN LINK_NEW
+global $LINK_NEW, $linkspage_pref, $qs, $rowl;
+$LINK_NEW = "";
+if(USER && $rowl['link_datestamp'] > USERLV){
+$LINK_NEW = "<img class='linkspage_new' src='".IMAGE_NEW."' alt='' style='vertical-align:middle' />";
+}
+return $LINK_NEW;
+SC_END
+
+SC_BEGIN LINK_CAT_NAME
+global $rowl;
+return $rowl['link_category_name'];
+SC_END
+
+SC_BEGIN LINK_CAT_DESC
+global $rowl;
+return $rowl['link_category_description'];
+SC_END
+
+SC_BEGIN LINK_CAT_TOTAL
+global $link_category_total;
+return " (<span title='".(ADMIN ? LAN_LINKS_2 : LAN_LINKS_1)."' >".$link_category_total."</span>".(ADMIN ? "/<span title='".(ADMIN ? LAN_LINKS_1 : "" )."' >".$link_category_total."</span>" : "").") ";
+SC_END
+
+SC_BEGIN LINK_REFER_LAN
+global $linkspage_pref;
+return (isset($linkspage_pref['link_referal']) && $linkspage_pref['link_referal'] ? LAN_LINKS_26 : "");
+SC_END
+
+SC_BEGIN LINK_COMMENT_LAN
+global $linkspage_pref;
+return (isset($linkspage_pref['link_comment']) && $linkspage_pref['link_comment'] ? LAN_LINKS_37 : "");
+SC_END
+
+SC_BEGIN LINK_RATING_LAN
+global $linkspage_pref;
+if(isset($linkspage_pref['link_rating']) && $linkspage_pref['link_rating']){
+    return LCLAN_ITEM_39;
+}
+return "";
+SC_END
+
+SC_BEGIN NAVIGATOR
+return displayNavigator('');
+SC_END
+
+
+// LINK_TOP_TABLE ------------------------------------------------
+
+
+
+// LINK_RATED_TABLE ------------------------------------------------
+SC_BEGIN LINK_RATED_RATING
+global $LINK_RATED_RATING, $rowl;
+$tmp = explode(".", $rowl['rate_avg']);
+$one = $tmp[0];
+$two = round($tmp[1],1);
+$rating = $one.".".$two." ";
+for($c=1; $c<= $one; $c++){
+	$rating .= "<img src='".e_IMAGE_ABS."rate/box.png' alt='' style='height:8px; vertical-align:middle' />";
+}
+if($one < 10){
+	for($c=9; $c>=$one; $c--){
+		$rating .= "<img src='".e_IMAGE_ABS."rate/empty.png' alt='' style='height:8px; vertical-align:middle' />";
+	}
+}
+$rating .= "<img src='".e_IMAGE_ABS."rate/boxend.png' alt='' style='height:8px; vertical-align:middle' />";
+return $rating;
+SC_END
+
+SC_BEGIN LINK_RATED_BUTTON
+global $LINK_RATED_BUTTON, $linkspage_pref, $rowl, $LINK_RATED_NAME, $LINK_RATED_APPEND;
+if(isset($linkspage_pref['link_icon']) && $linkspage_pref['link_icon']){
+	if ($rowl['link_button']) {
+		if (strpos($rowl['link_button'], "http://") !== FALSE) {
+			$LINK_RATED_BUTTON = $LINK_RATED_APPEND."\n<img style='border:0;' src='".$rowl['link_button']."' alt='".$LINK_RATED_NAME."' /></a>";
+		} else {
+			if(strstr($rowl['link_button'], "/")){
+				$LINK_RATED_BUTTON = $LINK_RATED_APPEND."\n<img style='border:0;' src='".e_BASE.$rowl['link_button']."' alt='".$LINK_RATED_NAME."' /></a>";
+			}else{
+				$LINK_RATED_BUTTON = $LINK_RATED_APPEND."\n<img style='border:0' src='".e_PLUGIN_ABS."links_page/link_images/".$rowl['link_button']."' alt='".$LINK_RATED_NAME."' /></a>";
+			}
+		}
+	} else {
+		if(isset($linkspage_pref['link_icon_empty']) && $linkspage_pref['link_icon_empty']){
+			$LINK_RATED_BUTTON = $LINK_RATED_APPEND."\n<img style='border:0; width: 88px; height: 31px;' src='".e_PLUGIN_ABS."links_page/images/generic.png' alt='".$LINK_RATED_NAME."' /></a>";
+		}else{
+			$LINK_RATED_BUTTON = "";
+		}
+	}
+}else{
+	if(isset($linkspage_pref['link_icon_empty']) && $linkspage_pref['link_icon_empty']){
+		$LINK_RATED_BUTTON = $LINK_RATED_APPEND."\n<img style='border:0; width: 88px; height: 31px;' src='".e_PLUGIN_ABS."links_page/images/generic.png' alt='".$LINK_RATED_NAME."' /></a>";
+	}else{
+		$LINK_RATED_BUTTON = "";
+	}
+}
+return $LINK_RATED_BUTTON;
+SC_END
+
+SC_BEGIN LINK_RATED_APPEND
+global $LINK_RATED_APPEND;
+return $LINK_RATED_APPEND;
+SC_END
+
+SC_BEGIN LINK_RATED_CATEGORY
+global $LINK_RATED_CATEGORY, $rowl, $qs, $tp;
+if(!isset($qs[1])){
+$LINK_RATED_CATEGORY = "<a href='".e_SELF."?cat.".$rowl['link_category_id']."'>".$tp->toHTML($rowl['link_category_name'], TRUE)."</a>";
+}
+return $LINK_RATED_CATEGORY;
+SC_END
+
+SC_BEGIN LINK_RATED_NAME
+global $LINK_RATED_NAME, $rowl;
+return $rowl['link_name'];
+SC_END
+
+SC_BEGIN LINK_RATED_URL
+global $LINK_RATED_URL, $linkspage_pref, $rowl;
+return (isset($linkspage_pref['link_url']) && $linkspage_pref['link_url'] ? $rowl['link_url'] : "");
+SC_END
+
+SC_BEGIN LINK_RATED_REFER
+global $LINK_RATED_REFER, $linkspage_pref, $rowl;
+return (isset($linkspage_pref['link_referal']) && $linkspage_pref['link_referal'] ? LAN_LINKS_26." ".$rowl['link_refer'] : "");
+SC_END
+
+SC_BEGIN LINK_RATED_DESC
+global $LINK_RATED_DESC, $linkspage_pref, $tp, $rowl;
+return (isset($linkspage_pref['link_desc']) && $linkspage_pref['link_desc'] ? $tp->toHTML($rowl['link_description'], TRUE) : "");
+SC_END
+
+
+
+
+
+// LINK_SUBMIT_TABLE ------------------------------------------------
+SC_BEGIN LINK_SUBMIT_CAT
+global $LINK_SUBMIT_CAT;
+return $LINK_SUBMIT_CAT;
+SC_END
+
+SC_BEGIN LINK_SUBMIT_PRETEXT
+global $LINK_SUBMIT_PRETEXT, $linkspage_pref;
+if(isset($linkspage_pref['link_submit_directpost']) && $linkspage_pref['link_submit_directpost']){
+return "";
+}else{
+return LCLAN_SL_9;
+}
+
+SC_END
+
+
+*/
+?>
diff -x .svn -aruN 0.7.24.src/e107_plugins/links_page/links_page_sql.php 0.7.26.src/e107_plugins/links_page/links_page_sql.php
--- 0.7.24.src/e107_plugins/links_page/links_page_sql.php	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_plugins/links_page/links_page_sql.php	2011-03-11 12:49:32.000000000 -0600
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $URL: https://e107.svn.sourceforge.net/svnroot/e107/trunk/e107_0.7/e107_plugins/links_page/links_page_sql.php $
-|     $Revision: 11678 $
-|     $Id: links_page_sql.php 11678 2010-08-22 00:43:45Z e107coders $
-|     $Author: e107coders $
+|     $Revision: 12092 $
+|     $Id: links_page_sql.php 12092 2011-03-11 18:49:56Z e107steved $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 header("location:../index.php");
@@ -30,7 +30,7 @@
   link_category_class varchar(100) NOT NULL default '0',
   link_category_datestamp int(10) unsigned NOT NULL default '0',
   PRIMARY KEY  (link_category_id)
-) TYPE=MyISAM;
+) ENGINE=MyISAM;
 # --------------------------------------------------------
 
 # Table structure for table `links_page`
@@ -49,5 +49,5 @@
   link_datestamp int(10) unsigned NOT NULL default '0',
   link_author varchar(255) NOT NULL default '',
   PRIMARY KEY  (link_id)
-) TYPE=MyISAM;
+) ENGINE=MyISAM;
 # --------------------------------------------------------
diff -x .svn -aruN 0.7.24.src/e107_plugins/links_page/plugin.php 0.7.26.src/e107_plugins/links_page/plugin.php
--- 0.7.24.src/e107_plugins/links_page/plugin.php	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_plugins/links_page/plugin.php	2011-05-02 15:45:16.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $URL: https://e107.svn.sourceforge.net/svnroot/e107/trunk/e107_0.7/e107_plugins/links_page/plugin.php $
-|     $Revision: 11678 $
-|     $Id: plugin.php 11678 2010-08-22 00:43:45Z e107coders $
-|     $Author: e107coders $
+|     $Revision: 12178 $
+|     $Id: plugin.php 12178 2011-05-02 20:45:40Z e107steved $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 
@@ -67,7 +67,7 @@
 	link_category_class varchar(100) NOT NULL default '0',
 	link_category_datestamp int(10) unsigned NOT NULL default '0',
 	PRIMARY KEY  (link_category_id)
-	) TYPE=MyISAM;",
+	) ENGINE=MyISAM;",
 
 	"CREATE TABLE ".MPREFIX."links_page (
 	link_id int(10) unsigned NOT NULL auto_increment,
@@ -83,7 +83,7 @@
 	link_datestamp int(10) unsigned NOT NULL default '0',
 	link_author varchar(255) NOT NULL default '',
 	PRIMARY KEY  (link_id)
-	) TYPE=MyISAM;" );
+	) ENGINE=MyISAM;" );
 
 // Create a link in main menu (yes=TRUE, no=FALSE) -------------------------------------------------------------
 $eplug_link = TRUE;
diff -x .svn -aruN 0.7.24.src/e107_plugins/linkwords/linkwords_sql.php 0.7.26.src/e107_plugins/linkwords/linkwords_sql.php
--- 0.7.24.src/e107_plugins/linkwords/linkwords_sql.php	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_plugins/linkwords/linkwords_sql.php	2011-03-11 12:49:32.000000000 -0600
@@ -4,4 +4,4 @@
 linkword_word varchar(100) NOT NULL default '',
 linkword_link varchar(150) NOT NULL default '',
 PRIMARY KEY  (linkword_id)
-) TYPE=MyISAM AUTO_INCREMENT=1;
\ No newline at end of file
+) ENGINE=MyISAM AUTO_INCREMENT=1;
\ No newline at end of file
diff -x .svn -aruN 0.7.24.src/e107_plugins/linkwords/plugin.php 0.7.26.src/e107_plugins/linkwords/plugin.php
--- 0.7.24.src/e107_plugins/linkwords/plugin.php	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_plugins/linkwords/plugin.php	2011-05-02 15:45:16.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $URL: https://e107.svn.sourceforge.net/svnroot/e107/trunk/e107_0.7/e107_plugins/linkwords/plugin.php $
-|     $Revision: 11678 $
-|     $Id: plugin.php 11678 2010-08-22 00:43:45Z e107coders $
-|     $Author: e107coders $
+|     $Revision: 12178 $
+|     $Id: plugin.php 12178 2011-05-02 20:45:40Z e107steved $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 
@@ -79,7 +79,7 @@
 	linkword_word varchar(100) NOT NULL default '',
 	linkword_link varchar(150) NOT NULL default '',
 	PRIMARY KEY ( linkword_id )
-	) TYPE=MyISAM AUTO_INCREMENT=1;"
+	) ENGINE=MyISAM AUTO_INCREMENT=1;"
 );
 
 
diff -x .svn -aruN 0.7.24.src/e107_plugins/list_new/list_class.php 0.7.26.src/e107_plugins/list_new/list_class.php
--- 0.7.24.src/e107_plugins/list_new/list_class.php	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_plugins/list_new/list_class.php	2011-05-28 06:13:14.000000000 -0500
@@ -10,9 +10,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $URL: https://e107.svn.sourceforge.net/svnroot/e107/trunk/e107_0.7/e107_plugins/list_new/list_class.php $
-|     $Revision: 11678 $
-|     $Id: list_class.php 11678 2010-08-22 00:43:45Z e107coders $
-|     $Author: e107coders $
+|     $Revision: 12229 $
+|     $Id: list_class.php 12229 2011-05-28 11:13:38Z e107steved $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 if (!defined('e107_INIT')) { exit(); }
@@ -321,7 +321,7 @@
 	function show_section_list($arr, $mode, $max="")
 	{
 		global $pref, $tp, $listplugindir, $list_shortcodes, $sql, $list_pref, $defaultarray, $content_types, $content_name;
-		global $LIST_ICON, $LIST_DATE, $LIST_HEADING, $LIST_AUTHOR, $LIST_CATEGORY, $LIST_INFO;
+		global $LIST_ICON, $LIST_DATE, $LIST_HEADING, $LIST_AUTHOR, $LIST_CATEGORY, $LIST_INFO, $LIST_RECENT_ID;
 		global $LIST_DISPLAYSTYLE, $LIST_CAPTION, $LIST_STYLE_CAPTION, $LIST_STYLE_BODY;
 		global $LIST_PAGE_NEW, $LIST_PAGE_RECENT, $LIST_MENU_NEW, $LIST_MENU_RECENT, $LIST_PAGE_NEW_START, $LIST_PAGE_RECENT_START, $LIST_MENU_NEW_START, $LIST_MENU_RECENT_START, $LIST_PAGE_NEW_END, $LIST_PAGE_RECENT_END, $LIST_MENU_NEW_END, $LIST_MENU_RECENT_END;
 
@@ -362,6 +362,18 @@
 		$start = "";
 		$end = "";
 
+		// profanity filter
+        if ($pref['profanity_filter']) 
+		{
+            if (!is_object($tp->e_pf)) 
+			{
+                require_once(e_HANDLER.'profanity_filter.php');
+                $tp->e_pf = new e_profanityFilter;
+            }
+        }
+
+		$LIST_RECENT_ID = 'list_'.$mode.'_'.$arr[9];
+
 		$LIST_ICON = "";
 		$LIST_DATE = "";
 		$LIST_HEADING = "";
@@ -372,36 +384,54 @@
 		//$LIST_CAPTION = (isset($list_pref[$mode."_caption"]) && $list_pref[$mode."_caption"] ? $list_pref[$mode."_caption"] : "");
 		//echo $list_pref["$arr_{$mode}_caption"];
 
-		if(is_array($LIST_DATA)){			//if it is an array, data exists and data is not empty
-			for($i=0;$i<count($LIST_DATA[$mode]);$i++)
+		if(is_array($LIST_DATA))
+		{			//if it is an array, data exists and data is not empty
+		//print_a($LIST_DATA);
+			for($i=0; $i<count($LIST_DATA[$mode]); $i++)
 			{
 				$LIST_ICON		= $LIST_DATA[$mode][$i][0];
-				$LIST_HEADING	= $LIST_DATA[$mode][$i][1];
+				if ($pref['profanity_filter']) 
+				{
+					$LIST_HEADING = $tp->e_pf->filterProfanities($LIST_DATA[$mode][$i][1]);
+				}
+				else
+				{
+					$LIST_HEADING	= $LIST_DATA[$mode][$i][1];
+				}
 				$LIST_AUTHOR	= $LIST_DATA[$mode][$i][2];
 				$LIST_CATEGORY	= $LIST_DATA[$mode][$i][3];
 				$LIST_DATE		= $LIST_DATA[$mode][$i][4];
 				$LIST_INFO		= $LIST_DATA[$mode][$i][5];
 
-				if($mode == "recent_menu"){
+				if($mode == "recent_menu")
+				{
 					global $sc_style;
 					$LIST_AUTHOR	= ($LIST_AUTHOR ? $sc_style['LIST_AUTHOR']['pre'].$LIST_AUTHOR.$sc_style['LIST_AUTHOR']['post'] : "");
 					$LIST_CATEGORY	= ($LIST_CATEGORY ? $sc_style['LIST_CATEGORY']['pre'].$LIST_CATEGORY.$sc_style['LIST_CATEGORY']['post'] : "");
 					$menutext .= preg_replace("/\{(.*?)\}/e", '$\1', $LIST_MENU_RECENT);
 
-				}elseif($mode == "new_menu"){
+				}
+				elseif($mode == "new_menu")
+				{
 					global $sc_style;
 					$LIST_AUTHOR	= ($LIST_AUTHOR ? $sc_style['LIST_AUTHOR']['pre'].$LIST_AUTHOR.$sc_style['LIST_AUTHOR']['post'] : "");
 					$LIST_CATEGORY	= ($LIST_CATEGORY ? $sc_style['LIST_CATEGORY']['pre'].$LIST_CATEGORY.$sc_style['LIST_CATEGORY']['post'] : "");
 					$menutext .= preg_replace("/\{(.*?)\}/e", '$\1', $LIST_MENU_NEW);
 
-				}elseif($mode == "recent_page"){
+				}
+				elseif($mode == "recent_page")
+				{
 					$menutext .= $tp -> parseTemplate($LIST_PAGE_RECENT, FALSE, $list_shortcodes);
 
-				}elseif($mode == "new_page"){
+				}
+				elseif($mode == "new_page")
+				{
 					$menutext .= $tp -> parseTemplate($LIST_PAGE_NEW, FALSE, $list_shortcodes);
 				}
 			}
-		}elseif(!is_array($LIST_DATA) && $LIST_DATA != ""){
+		}
+		elseif(!is_array($LIST_DATA) && $LIST_DATA != "")
+		{
 			$LIST_HEADING = $LIST_DATA;
 			if($mode == "recent_menu"){
 				if($list_pref[$mode."_showempty"]){
@@ -465,29 +495,31 @@
 	function getlvisit()
 	{
 		global $qs, $list_pref;
+		
+		$lvisit = defined('USERLV') ? USERLV : time() + 1000;			// Set default value
 
 		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']) && $list_pref['new_page_timelapse_days']){
+			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']) && $list_pref['new_page_timelapse_days'])
+				{
 					$days = $list_pref['new_page_timelapse_days'];
-				}else{
+				}
+				else
+				{
 					$days = "30";
 				}
-				if(isset($qs[1]) && is_numeric($qs[1]) && $qs[1] <= $days){
+				if(isset($qs[1]) && is_numeric($qs[1]) && $qs[1] <= $days)
+				{
 					$lvisit = time()-$qs[1]*86400;
-				}else{
-					$lvisit = USERLV;
 				}
-			}else{
-				$lvisit = USERLV;
 			}
-		}else{
-			$lvisit = USERLV;
 		}
 		return $lvisit;
 	}
 
+
 	function getBullet($sectionicon, $mode)
 	{
 		global $list_pref, $listplugindir;
diff -x .svn -aruN 0.7.24.src/e107_plugins/list_new/list_new_menu.php 0.7.26.src/e107_plugins/list_new/list_new_menu.php
--- 0.7.24.src/e107_plugins/list_new/list_new_menu.php	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_plugins/list_new/list_new_menu.php	2011-04-10 16:26:48.000000000 -0500
@@ -10,9 +10,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $URL: https://e107.svn.sourceforge.net/svnroot/e107/trunk/e107_0.7/e107_plugins/list_new/list_new_menu.php $
-|     $Revision: 11678 $
-|     $Id: list_new_menu.php 11678 2010-08-22 00:43:45Z e107coders $
-|     $Author: e107coders $
+|     $Revision: 12126 $
+|     $Id: list_new_menu.php 12126 2011-04-10 21:27:12Z e107steved $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 
@@ -60,7 +60,10 @@
 }
 
 $caption = (isset($list_pref[$mode."_caption"]) && $list_pref[$mode."_caption"] ? $list_pref[$mode."_caption"] : LIST_MENU_1);
+$caption = $tp->toHtml($caption, FALSE, 'USER_TITLE');
+$text = $tp->toHtml($text, TRUE, 'USER_BODY');
 $ns->tablerender($caption, $text, 'list_new');
+unset($caption);
 unset($text);
 
 ?>
\ No newline at end of file
diff -x .svn -aruN 0.7.24.src/e107_plugins/list_new/list_recent_menu.php 0.7.26.src/e107_plugins/list_new/list_recent_menu.php
--- 0.7.24.src/e107_plugins/list_new/list_recent_menu.php	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_plugins/list_new/list_recent_menu.php	2011-04-10 16:26:48.000000000 -0500
@@ -10,9 +10,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $URL: https://e107.svn.sourceforge.net/svnroot/e107/trunk/e107_0.7/e107_plugins/list_new/list_recent_menu.php $
-|     $Revision: 11678 $
-|     $Id: list_recent_menu.php 11678 2010-08-22 00:43:45Z e107coders $
-|     $Author: e107coders $
+|     $Revision: 12126 $
+|     $Id: list_recent_menu.php 12126 2011-04-10 21:27:12Z e107steved $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 
@@ -60,7 +60,10 @@
 }
 
 $caption = (isset($list_pref[$mode."_caption"]) && $list_pref[$mode."_caption"] ? $list_pref[$mode."_caption"] : LIST_MENU_1);
+$caption = $tp->toHtml($caption, FALSE, 'USER_TITLE');
+$text = $tp->toHtml($text, TRUE, 'USER_BODY');
 $ns -> tablerender($caption, $text, 'list_recent');
+unset($caption);
 unset($text);
 
 ?>
\ No newline at end of file
diff -x .svn -aruN 0.7.24.src/e107_plugins/list_new/list_shortcodes.php 0.7.26.src/e107_plugins/list_new/list_shortcodes.php
--- 0.7.24.src/e107_plugins/list_new/list_shortcodes.php	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_plugins/list_new/list_shortcodes.php	2011-05-02 13:20:10.000000000 -0500
@@ -1,38 +1,43 @@
-<?php
-if (!defined('e107_INIT')) { exit; }
-include_once(e_HANDLER.'shortcode_handler.php');
-$list_shortcodes = $tp -> e_sc -> parse_scbatch(__FILE__);
-/*
-SC_BEGIN LIST_DATE
-global $LIST_DATE;
-return $LIST_DATE;
-SC_END
-
-SC_BEGIN LIST_ICON
-global $LIST_ICON;
-return $LIST_ICON;
-SC_END
-
-SC_BEGIN LIST_HEADING
-global $LIST_HEADING;
-return $LIST_HEADING;
-SC_END
-
-SC_BEGIN LIST_AUTHOR
-global $LIST_AUTHOR;
-return $LIST_AUTHOR;
-SC_END
-
-SC_BEGIN LIST_CATEGORY
-global $LIST_CATEGORY;
-return $LIST_CATEGORY;
-SC_END
-
-SC_BEGIN LIST_INFO
-global $LIST_INFO;
-return $LIST_INFO;
-SC_END
-
-
-*/
+<?php
+if (!defined('e107_INIT')) { exit; }
+include_once(e_HANDLER.'shortcode_handler.php');
+$list_shortcodes = $tp -> e_sc -> parse_scbatch(__FILE__);
+/*
+SC_BEGIN LIST_DATE
+global $LIST_DATE;
+return $LIST_DATE;
+SC_END
+
+SC_BEGIN LIST_ICON
+global $LIST_ICON;
+return $LIST_ICON;
+SC_END
+
+SC_BEGIN LIST_HEADING
+global $LIST_HEADING;
+return $LIST_HEADING;
+SC_END
+
+SC_BEGIN LIST_AUTHOR
+global $LIST_AUTHOR;
+return $LIST_AUTHOR;
+SC_END
+
+SC_BEGIN LIST_CATEGORY
+global $LIST_CATEGORY;
+return $LIST_CATEGORY;
+SC_END
+
+SC_BEGIN LIST_INFO
+global $LIST_INFO;
+return $LIST_INFO;
+SC_END
+
+
+SC_BEGIN LIST_RECENT_ID
+global $LIST_RECENT_ID;
+return $LIST_RECENT_ID;
+SC_END
+
+*/
 ?>
\ No newline at end of file
diff -x .svn -aruN 0.7.24.src/e107_plugins/list_new/list_template.php 0.7.26.src/e107_plugins/list_new/list_template.php
--- 0.7.24.src/e107_plugins/list_new/list_template.php	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_plugins/list_new/list_template.php	2011-05-02 13:20:10.000000000 -0500
@@ -1,86 +1,86 @@
-<?php
-
-if (!defined('e107_INIT')) { exit; }
-
-global $sc_style, $list_shortcodes;
-$sc_style['LIST_DATE']['pre'] = "";
-$sc_style['LIST_DATE']['post'] = " ";
-
-$sc_style['LIST_ICON']['pre'] = "";
-$sc_style['LIST_ICON']['post'] = " ";
-
-$sc_style['LIST_HEADING']['pre'] = "";
-$sc_style['LIST_HEADING']['post'] = " ";
-
-$sc_style['LIST_AUTHOR']['pre'] = LIST_MENU_2.": ";
-$sc_style['LIST_AUTHOR']['post'] = " ";
-
-$sc_style['LIST_CATEGORY']['pre'] = LIST_MENU_4.": ";
-$sc_style['LIST_CATEGORY']['post'] = " ";
-
-$sc_style['LIST_INFO']['pre'] = "";
-$sc_style['LIST_INFO']['post'] = " ";
-
-
-//LIST_MENU_NEW TEMPLATE -------------------------------------------------------------------------
-$LIST_MENU_NEW_START = "
-<div class='fcaption' style='cursor:pointer;' onclick='expandit(this);'>{LIST_CAPTION}</div>
-<div class='forumheader' style='margin-bottom:5px; display:{LIST_DISPLAYSTYLE};'>\n";
-$LIST_MENU_NEW = "
-<div>
-{LIST_ICON} {LIST_DATE} {LIST_HEADING} {LIST_AUTHOR} {LIST_CATEGORY}
-</div>";
-$LIST_MENU_NEW_END = "
-</div>\n";
-
-//LIST_MENU_RECENT TEMPLATE -------------------------------------------------------------------------
-$LIST_MENU_RECENT_START = "
-<div class='fcaption' style='cursor:pointer;' onclick='expandit(this);'>{LIST_CAPTION}</div>
-<div class='forumheader' style='margin-bottom:5px; display:{LIST_DISPLAYSTYLE};'>\n";
-$LIST_MENU_RECENT = "
-<div>
-{LIST_ICON} {LIST_DATE} {LIST_HEADING} {LIST_AUTHOR} {LIST_CATEGORY}
-</div>";
-$LIST_MENU_RECENT_END = "
-</div>\n";
-
-
-//PAGE TEMPLATE -------------------------------------------------------------------------
-$LIST_PAGE_RECENT_START = "
-<div class='fcaption' style='cursor:pointer;' onclick='expandit(this);'>{LIST_CAPTION}</div>
-<div class='forumheader' style='margin-bottom:10px; display:{LIST_DISPLAYSTYLE};'>\n";
-$LIST_PAGE_RECENT = "
-<div>
-{LIST_ICON} {LIST_DATE} {LIST_HEADING} {LIST_AUTHOR} {LIST_CATEGORY} {LIST_INFO}
-</div>";
-$LIST_PAGE_RECENT_END = "
-</div>\n";
-
-
-//NEW TEMPLATE -------------------------------------------------------------------------
-$LIST_PAGE_NEW_START = "
-<div class='fcaption' style='cursor:pointer;' onclick='expandit(this);'>{LIST_CAPTION}</div>
-<div class='forumheader' style='margin-bottom:10px; display:{LIST_DISPLAYSTYLE};'>\n";
-$LIST_PAGE_NEW = "
-<div>
-{LIST_ICON} {LIST_DATE} {LIST_HEADING} {LIST_AUTHOR} {LIST_CATEGORY} {LIST_INFO}
-</div>";
-$LIST_PAGE_NEW_END = "
-</div>\n";
-
-
-//MULTI COLOMNS LAYOUT MASTER -----------------------------------------------------------
-$LIST_COL_START = "
-<div style='text-align:center;'>
-<table class='fborder' style='width:100%;' cellspacing='0' cellpadding='0'>
-<tr>";
-$LIST_COL_WELCOME = "<td colspan='{LIST_COL_COLS}' class='forumheader'>{LIST_COL_WELCOMETEXT}<br /><br /></td>";
-$LIST_COL_ROWSWITCH = "</tr><tr>";
-$LIST_COL_CELL_START = "<td style='width:{LIST_COL_CELLWIDTH}%; padding-right:5px; vertical-align:top;'>";
-$LIST_COL_CELL_END = "</td>";
-$LIST_COL_END = "</tr></table></div>";
-
-//TIMELAPSE SELECT -----------------------------------------------------------
-$LIST_TIMELAPSE_TABLE = "<div class='forumheader3' style='margin-bottom:20px;'>{LIST_TIMELAPSE}</div>";
-
+<?php
+
+if (!defined('e107_INIT')) { exit; }
+
+global $sc_style, $list_shortcodes;
+$sc_style['LIST_DATE']['pre'] = "";
+$sc_style['LIST_DATE']['post'] = " ";
+
+$sc_style['LIST_ICON']['pre'] = "";
+$sc_style['LIST_ICON']['post'] = " ";
+
+$sc_style['LIST_HEADING']['pre'] = "";
+$sc_style['LIST_HEADING']['post'] = " ";
+
+$sc_style['LIST_AUTHOR']['pre'] = LIST_MENU_2.": ";
+$sc_style['LIST_AUTHOR']['post'] = " ";
+
+$sc_style['LIST_CATEGORY']['pre'] = LIST_MENU_4.": ";
+$sc_style['LIST_CATEGORY']['post'] = " ";
+
+$sc_style['LIST_INFO']['pre'] = "";
+$sc_style['LIST_INFO']['post'] = " ";
+
+
+//LIST_MENU_NEW TEMPLATE -------------------------------------------------------------------------
+$LIST_MENU_NEW_START = "
+<div class='fcaption' style='cursor:pointer;' onclick='expandit(\"{LIST_RECENT_ID}\");'>{LIST_CAPTION}</div>\n
+<div class='forumheader' id='{LIST_RECENT_ID}' style='margin-bottom:5px; display:{LIST_DISPLAYSTYLE};'>\n";
+$LIST_MENU_NEW = "
+<div>
+{LIST_ICON} {LIST_DATE} {LIST_HEADING} {LIST_AUTHOR} {LIST_CATEGORY}
+</div>";
+$LIST_MENU_NEW_END = "
+</div>\n";
+
+//LIST_MENU_RECENT TEMPLATE -------------------------------------------------------------------------
+$LIST_MENU_RECENT_START = "
+<div class='fcaption' style='cursor:pointer;' onclick='expandit(\"{LIST_RECENT_ID}\");'>{LIST_CAPTION}</div>\n
+<div class='forumheader' id='{LIST_RECENT_ID}' style='margin-bottom:5px; display:{LIST_DISPLAYSTYLE};'>\n";
+$LIST_MENU_RECENT = "
+<div>
+{LIST_ICON} {LIST_DATE} {LIST_HEADING} {LIST_AUTHOR} {LIST_CATEGORY}
+</div>";
+$LIST_MENU_RECENT_END = "
+</div>\n";
+
+
+//PAGE TEMPLATE -------------------------------------------------------------------------
+$LIST_PAGE_RECENT_START = "
+<div class='fcaption' style='cursor:pointer;' onclick='expandit(\"{LIST_RECENT_ID}\");'>{LIST_CAPTION}</div>\n
+<div class='forumheader' id='{LIST_RECENT_ID}' style='margin-bottom:10px; display:{LIST_DISPLAYSTYLE};'>\n";
+$LIST_PAGE_RECENT = "
+<div>
+{LIST_ICON} {LIST_DATE} {LIST_HEADING} {LIST_AUTHOR} {LIST_CATEGORY} {LIST_INFO}
+</div>";
+$LIST_PAGE_RECENT_END = "
+</div>\n";
+
+
+//NEW TEMPLATE -------------------------------------------------------------------------
+$LIST_PAGE_NEW_START = "
+<div class='fcaption' style='cursor:pointer;' onclick='expandit(\"{LIST_RECENT_ID}\");'>{LIST_CAPTION}</div>\n
+<div class='forumheader' id='{LIST_RECENT_ID}' style='margin-bottom:10px; display:{LIST_DISPLAYSTYLE};'>\n";
+$LIST_PAGE_NEW = "
+<div>
+{LIST_ICON} {LIST_DATE} {LIST_HEADING} {LIST_AUTHOR} {LIST_CATEGORY} {LIST_INFO}
+</div>";
+$LIST_PAGE_NEW_END = "
+</div>\n";
+
+
+//MULTI COLUMN LAYOUT MASTER -----------------------------------------------------------
+$LIST_COL_START = "
+<div style='text-align:center;'>
+<table class='fborder' style='width:100%;' cellspacing='0' cellpadding='0'>
+<tr>";
+$LIST_COL_WELCOME = "<td colspan='{LIST_COL_COLS}' class='forumheader'>{LIST_COL_WELCOMETEXT}<br /><br /></td>";
+$LIST_COL_ROWSWITCH = "</tr><tr>";
+$LIST_COL_CELL_START = "<td style='width:{LIST_COL_CELLWIDTH}%; padding-right:5px; vertical-align:top;'>";
+$LIST_COL_CELL_END = "</td>";
+$LIST_COL_END = "</tr></table></div>";
+
+//TIMELAPSE SELECT -----------------------------------------------------------
+$LIST_TIMELAPSE_TABLE = "<div class='forumheader3' style='margin-bottom:20px;'>{LIST_TIMELAPSE}</div>";
+
 ?>
\ No newline at end of file
diff -x .svn -aruN 0.7.24.src/e107_plugins/log/admin_config.php 0.7.26.src/e107_plugins/log/admin_config.php
--- 0.7.24.src/e107_plugins/log/admin_config.php	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_plugins/log/admin_config.php	2011-04-20 16:23:21.000000000 -0500
@@ -11,15 +11,16 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $URL: https://e107.svn.sourceforge.net/svnroot/e107/trunk/e107_0.7/e107_plugins/log/admin_config.php $
-|     $Revision: 11678 $
-|     $Id: admin_config.php 11678 2010-08-22 00:43:45Z e107coders $
-|     $Author: e107coders $
+|     $Revision: 12153 $
+|     $Id: admin_config.php 12153 2011-04-20 21:23:45Z e107steved $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 require_once("../../class2.php");
-if (!getperms("P")) {
+if (!getperms("P")) 
+{
 	header("location:../../index.php");
-	 exit;
+	exit;
 }
 
 if (isset($_POST['updateStats']))
@@ -92,6 +93,7 @@
 	$pref['statCountAdmin'] = $_POST['statCountAdmin'];
 	$pref['statUserclass'] = $_POST['statUserclass'];
 	$pref['statBrowser'] = $_POST['statBrowser'];
+	($_POST['statBrowser'] == 1)?($pref['statBrowserDispCompr'] = $_POST['statBrowserDispCompr']):$pref['statBrowserDispCompr']=0;
 	$pref['statOs'] = $_POST['statOs'];
 	$pref['statScreen'] = $_POST['statScreen'];
 	$pref['statDomain'] = $_POST['statDomain'];
@@ -147,7 +149,7 @@
 	".ADSTAT_L6."&nbsp;&nbsp;
 	<input type='radio' name='statBrowser' value='1'".($pref['statBrowser'] ? " checked='checked'" : "")." /> ".ADSTAT_ON."&nbsp;&nbsp;
 	<input type='radio' name='statBrowser' value='0'".(!$pref['statBrowser'] ? " checked='checked'" : "")." /> ".ADSTAT_OFF."<br />
-
+	
 	".ADSTAT_L7."&nbsp;&nbsp;
 	<input type='radio' name='statOs' value='1'".($pref['statOs'] ? " checked='checked'" : "")." /> ".ADSTAT_ON."&nbsp;&nbsp;
 	<input type='radio' name='statOs' value='0'".(!$pref['statOs'] ? " checked='checked'" : "")." /> ".ADSTAT_OFF."<br />
@@ -174,7 +176,21 @@
 
 	</td>
 	</tr>
+";
 
+if ($pref['statBrowser'] == 1)
+{	// Only display option to show browser stats in a compact way if stats on browser is actived
+$text .= "
+	<tr>
+	<td style='width:50%' class='forumheader3'>".ADSTAT_L35."</td>
+	<td style='width:50%; text-align: right;' class='forumheader3'>
+	<input type='radio' name='statBrowserDispCompr' value='1'".($pref['statBrowserDispCompr'] ? " checked='checked'" : "")." /> ".ADSTAT_ON."&nbsp;&nbsp;
+	<input type='radio' name='statBrowserDispCompr' value='0'".(!$pref['statBrowserDispCompr'] ? " checked='checked'" : "")." /> ".ADSTAT_OFF."<br />
+	</td>
+	</tr>";
+}
+	
+$text .= "
 	<tr>
 	<td style='width:50%' class='forumheader3'>".ADSTAT_L12."<br /><span class='smalltext'>".ADSTAT_L13."</span></td>
 	<td style='width:50%; text-align: right;' class='forumheader3'>
diff -x .svn -aruN 0.7.24.src/e107_plugins/log/images/android.png 0.7.26.src/e107_plugins/log/images/android.png
--- 0.7.24.src/e107_plugins/log/images/android.png	1969-12-31 18:00:00.000000000 -0600
+++ 0.7.26.src/e107_plugins/log/images/android.png	2011-01-24 12:56:20.000000000 -0600
@@ -0,0 +1,5 @@
+PNG
+
+   
IHDR         a   sBIT|d   	pHYs    ~   tEXtSoftware Adobe Fireworks CS5q6  "IDAT8c?:^t\D/<l
+d,<bWCWˀ̀%G6^eg]ZphP\@
sy9S>_q+⧀,HZ_t?X
 J4
+ n@|>	
p
a3; `~ 	ppH`3T!~{\apqb"@܎+L$`@'k rh{؎`^ *bjXgC&De&BAP !P 5X΃́ /o7.    IENDB`
\ No newline at end of file
diff -x .svn -aruN 0.7.24.src/e107_plugins/log/images/chrome.png 0.7.26.src/e107_plugins/log/images/chrome.png
--- 0.7.24.src/e107_plugins/log/images/chrome.png	1969-12-31 18:00:00.000000000 -0600
+++ 0.7.26.src/e107_plugins/log/images/chrome.png	2011-01-24 12:56:20.000000000 -0600
@@ -0,0 +1,5 @@
+PNG
+
+   
IHDR         a   sBIT|d   	pHYs    ~   tEXtSoftware Adobe Fireworks CS5q6  +IDAT8˅}Lu ƿ+,MD!"$8_wɥgŋ/!&E$˗uh:t7hm vk0_9xy<&W6˲K\5;u3Zͬ뺔4ޮO]^l]5jPw6V[!tGNh:,OϜ[[<OE-}NdfM8ܻN:ϖِYAH5bJMKtϞ d26
+Wm^SE~Y"oěclBNT,Ǭ^g
jް	r^bS/8Bhw(K8927x `K!F	KVcAIs?q;nׯ)y&r8R!dg4TT^b(Q1+]y4qG
+x}TXVD٘L^g6"^f|^g(񖍿[R/,ZU"L2},\Ίj)fE;ʕU}o;FyqV8HOďW8*UiWDW*HhXIGjrlB)8<r0kUqf1Uг`9/&5N0ɔ?)gEYz!Yes)tv}-~~I_8uV/?h>eZgw+ג[P,̟?ȸs%=H,f<2Le.ۋFM햋__oG˶lV7>GS;kLo\/fB    IENDB`
\ No newline at end of file
diff -x .svn -aruN 0.7.24.src/e107_plugins/log/images/nokia.png 0.7.26.src/e107_plugins/log/images/nokia.png
--- 0.7.24.src/e107_plugins/log/images/nokia.png	1969-12-31 18:00:00.000000000 -0600
+++ 0.7.26.src/e107_plugins/log/images/nokia.png	2011-01-24 12:56:20.000000000 -0600
@@ -0,0 +1,6 @@
+PNG
+
+   
IHDR         (-S   PLTE    < > = > = > < > > = < < @ B = = = < > = > = = = > = > > > = = A >? = > = = =V? = = = = ? = = = = = > > = = =ǯ   5tRNS 3  q}gb ~-  LY23 pc   IDATx^uG@C?$!{??YĊ% ^LNryB6jXD!)
+lU Tj
+`2H"rbEV
tRr1<H\K
+Ǖp>$*d>96Ս    IENDB`
\ No newline at end of file
diff -x .svn -aruN 0.7.24.src/e107_plugins/log/languages/admin/English.php 0.7.26.src/e107_plugins/log/languages/admin/English.php
--- 0.7.24.src/e107_plugins/log/languages/admin/English.php	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_plugins/log/languages/admin/English.php	2011-01-21 15:59:32.000000000 -0600
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $URL: https://e107.svn.sourceforge.net/svnroot/e107/trunk/e107_0.7/e107_plugins/log/languages/admin/English.php $
-|     $Revision: 11678 $
-|     $Id: English.php 11678 2010-08-22 00:43:45Z e107coders $
-|     $Author: e107coders $
+|     $Revision: 12053 $
+|     $Id: English.php 12053 2011-01-21 21:59:56Z nlstart $
+|     $Author: nlstart $
 +----------------------------------------------------------------------------+
 */
 	
@@ -53,8 +53,7 @@
 define("ADSTAT_L32", "Page Tidy");
 define("ADSTAT_L33", "Configure Statistics Logging");
 define("ADSTAT_L34", "Site Stats");
+define("ADSTAT_L35", "View compact browser info in stats");
 
 define('ADSTAT_L38', "You must set the e107_plugins/log/logs folder to be writable");	// Constant compatible with 0.8
-
-
 ?>
\ No newline at end of file
diff -x .svn -aruN 0.7.24.src/e107_plugins/log/loginfo.php 0.7.26.src/e107_plugins/log/loginfo.php
--- 0.7.24.src/e107_plugins/log/loginfo.php	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_plugins/log/loginfo.php	2010-10-15 06:27:44.000000000 -0500
@@ -3,7 +3,7 @@
 + ----------------------------------------------------------------------------+
 |     e107 website system
 |
-|     ?Steve Dunstan 2001-2002
+|     Steve Dunstan 2001-2002
 |     Copyright (C) 2008-2010 e107 Inc (e107.org)
 |
 |
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $URL: https://e107.svn.sourceforge.net/svnroot/e107/trunk/e107_0.7/e107_plugins/log/loginfo.php $
-|     $Revision: 11678 $
-|     $Id: loginfo.php 11678 2010-08-22 00:43:45Z e107coders $
-|     $Author: e107coders $
+|     $Revision: 11894 $
+|     $Id: loginfo.php 11894 2010-10-15 11:28:08Z secretr $
+|     $Author: secretr $
 |
 | File locking added
 |
@@ -146,10 +146,16 @@
 	// All "root" browsers must come at the end of the list, unfortunately.
 	// Otherwise, browsers based on them will never be seen.
 	//(But #1997)
-	//
+	// http://www.zytrax.com/tech/web/browser_ids.htm
 	$browsers = array(
 		"netcaptor"    => array('name' => 'Netcaptor',         'rule' => 'netcaptor[ /]([0-9.]{1,10})'),
-		"opera"        => array('name' => 'Opera',             'rule' => 'opera[ /]([0-9.]{1,10})'),
+		"opera"        => array('name' => 'Opera Mini',        'rule' => 'Opera[ /]([0-9.]{1,10})(.*)Opera Mini'),
+		"opera1"       => array('name' => 'Opera Mobile',      'rule' => 'Opera[ /]([0-9.]{1,10})(.*)Opera Mobi'),
+		"opera2"       => array('name' => 'Opera',             'rule' => 'opera[ /]([0-9.]{1,10})'),
+		"chrome"       => array('name' => 'Chrome',            'rule' => 'Chrome[ /]([0-9.+]{1,10})'),
+		"nokia"        => array('name' => 'Nokia Browser',     'rule' => 'Nokia([^/]+)/([^ SP]+)'),
+		"nokia1"       => array('name' => 'Nokia Browser',     'rule' => 'Series60|S60/([0-9.]{1,10})'),
+		"nokia2"       => array('name' => 'Nokia Browser',     'rule' => 'Mozilla(.*)SymbianOS(.*)AppleWebKit'), // catch it or it'll become a safari hit!
 		"aol"          => array('name' => 'AOL',               'rule' => 'aol[ /\-]([0-9.]{1,10})'),
 		"aol2"         => array('name' => 'AOL',               'rule' => 'aol[ /\-]?browser'),
 		"mosaic"       => array('name' => 'Mosaic',            'rule' => 'mosaic[ /]([0-9.]{1,10})'),
@@ -158,7 +164,6 @@
 		"avantbrowser" => array('name' => 'Avant Browser',     'rule' => 'Avant[ ]?Browser'),
 		"avantgo"      => array('name' => 'AvantGo',           'rule' => 'AvantGo[ /]([0-9.]{1,10})'),
 		"proxomitron"  => array('name' => 'Proxomitron',       'rule' => 'Space[ ]?Bison/[0-9.]{1,10}'),
-		"safari"       => array('name' => 'Safari',            'rule' => 'safari/([0-9.]{1,10})'),
 		"lynx"         => array('name' => 'Lynx',              'rule' => 'lynx/([0-9a-z.]{1,10})'),
 		"links"        => array('name' => 'Links',             'rule' => 'Links[ /]\(([0-9.]{1,10})'),
 		"galeon"       => array('name' => 'Galeon',            'rule' => 'galeon/([0-9.]{1,10})'),
@@ -206,6 +211,7 @@
 		"webtv"        => array('name' => 'Webtv',             'rule' => 'webtv[ /]([0-9.]{1,10})'),
 		"xiino"        => array('name' => 'Xiino',             'rule' => '^Xiino[ /]([0-9a-z.]{1,10})'),
 		"explorer"     => array('name' => 'Internet Explorer', 'rule' => '\(compatible; MSIE[ /]([0-9.]{1,10})'),
+		"safari"       => array('name' => 'Safari',            'rule' => 'safari/([0-9.]{1,10})'),
 		"firefox"      => array('name' => 'Firefox',           'rule' => 'Firefox/([0-9.+]{1,10})'),
 		"netscape"     => array('name' => 'Netscape',          'rule' => 'netscape[0-9]?/([0-9.]{1,10})'),
 		"netscape2"    => array('name' => 'Netscape',          'rule' => '^mozilla/([0-4]\.[0-9.]{1,10})'),
@@ -214,18 +220,41 @@
 		"firebird"     => array('name' => 'Firebird',          'rule' => 'Firebird/([0-9.+]{1,10})'),
 	);
 	$browser = "";
-	foreach($browsers as $info) {
-		if (preg_match("#".$info['rule']."#i", $agent, $results)) {
-			return ($info['name']." v".$results[1]);
+	foreach($browsers as $key => $info) 
+	{
+		if (preg_match("#".$info['rule']."#i", $agent, $results)) 
+		{
+			switch ($key) 
+			{
+				case 'nokia':
+				case 'nokia1':
+				case 'nokia2':
+					if(strpos(strtolower($agent), 'series60') !== false || strpos($agent, 'S60') !== false ) 
+					{
+						$info['name'] = 'Nokia S60 OSS Browser';
+					}
+					return ($info['name'].(isset($results[2]) && $results[2] ? ' v'.$results[2] : ''));
+				break;
+				
+				default:
+					return ($info['name'].(isset($results[1]) && $results[1] ? ' v'.$results[1] : ''));
+				break;
+			}
 		}
 	}
 	return ("Unknown");
 }
 
 function getOs($agent) {
+	// http://www.zytrax.com/tech/web/browser_ids.htm
 	$os = array(
-		"windows7" 		=> array('name' => 'Windows 7', 'rule' => 'wi(n|ndows)[ \-]?nt[ /]?6\.1'),
-		"windowsvista" => array('name' => 'Windows Vista', 'rule' => 'wi(n|ndows)[ \-]?nt[ /]?6\.0'),
+		// mobile come first - latest rules could break the check
+		"android"     => array('name' => 'Android',   	 'rule' => 'Android\s([0-9.]{1,10})'),
+		"symbian"     => array('name' => 'Symbian',   	 'rule' => 'symbianOS[ /]?([0-9.]{1,10})'),
+		"symbian1"    => array('name' => 'Symbian',   	 'rule' => 'series60[ /]'),
+		"symbian2"    => array('name' => 'Symbian',   	 'rule' => 'Symbian OS Series'),
+		"windows7" 	  => array('name' => 'Windows 7', 	 'rule' => 'wi(n|ndows)[ \-]?nt[ /]?6\.1'),
+		"windowsvista"=> array('name' => 'Windows Vista','rule' => 'wi(n|ndows)[ \-]?nt[ /]?6\.0'),
 		"windows2003" => array('name' => 'Windows 2003', 'rule' => 'wi(n|ndows)[ \-]?(2003|nt[ /]?5\.2)'),
 		"windowsxp"   => array('name' => 'Windows XP',   'rule' => 'Windows XP'),
 		"windowsxp2"  => array('name' => 'Windows XP',   'rule' => 'wi(n|ndows)[ \-]?nt[ /]?5\.1'),
@@ -256,7 +285,7 @@
 		"openbsd"     => array('name' => 'OpenBSD',      'rule' => 'open[ \-]?bsd[ /]([a-z0-9.]{1,10})'),
 		"openbsd2"    => array('name' => 'OpenBSD',      'rule' => 'open[ \-]?bsd'),
 		"palm"        => array('name' => 'PalmOS',       'rule' => 'Palm[ \-]?(Source|OS)[ /]?([0-9.]{1,10})'),
-		"palm2"       => array('name' => 'PalmOS',       'rule' => 'Palm[ \-]?(Source|OS)')
+		"palm2"       => array('name' => 'PalmOS',       'rule' => 'Palm[ \-]?(Source|OS)'),
 	);
 	foreach($os as $key => $info) 
 	{
@@ -275,4 +304,4 @@
 	return ("Unspecified");
 }
 
-?>
+?>
\ No newline at end of file
diff -x .svn -aruN 0.7.24.src/e107_plugins/log/log.php 0.7.26.src/e107_plugins/log/log.php
--- 0.7.24.src/e107_plugins/log/log.php	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_plugins/log/log.php	2011-05-28 04:04:43.000000000 -0500
@@ -9,7 +9,7 @@
 * Site access logging - 'receiver'
 *
 * $URL: https://e107.svn.sourceforge.net/svnroot/e107/trunk/e107_0.7/e107_plugins/log/log.php $
-* $Id: log.php 11731 2010-09-01 12:48:59Z e107steved $
+* $Id: log.php 12227 2011-05-28 09:05:07Z e107steved $
 *
 */
 
@@ -31,6 +31,14 @@
 parse_str($logVals, $vals);
 
 
+// We MUST have a timezone set in PHP >= 5.3. This should work for PHP >= 5.1:
+if (function_exists('date_default_timezone_get'))
+{
+// Just set a default - it should default to UTC if no timezone set
+	date_default_timezone_set(@date_default_timezone_get());
+}
+
+
 header('Cache-Control: no-cache, must-revalidate');		// See if this discourages browser caching
 header('Expires: Sat, 26 Jul 1997 05:00:00 GMT');		// Date in the past
 
diff -x .svn -aruN 0.7.24.src/e107_plugins/log/log_sql.php 0.7.26.src/e107_plugins/log/log_sql.php
--- 0.7.24.src/e107_plugins/log/log_sql.php	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_plugins/log/log_sql.php	2011-05-02 15:45:16.000000000 -0500
@@ -1,7 +1,7 @@
-CREATE TABLE logstats (
-  log_uniqueid int(11) NOT NULL auto_increment,
-  log_id varchar(50) NOT NULL default '',
-  log_data longtext NOT NULL,
-  PRIMARY KEY  (log_uniqueid),
-  UNIQUE KEY log_id (log_id)
-) TYPE=MyISAM;
\ No newline at end of file
+CREATE TABLE logstats (
+  log_uniqueid int(11) NOT NULL auto_increment,
+  log_id varchar(50) NOT NULL default '',
+  log_data longtext NOT NULL,
+  PRIMARY KEY  (log_uniqueid),
+  UNIQUE KEY log_id (log_id)
+) ENGINE=MyISAM;
\ No newline at end of file
diff -x .svn -aruN 0.7.24.src/e107_plugins/log/plugin.php 0.7.26.src/e107_plugins/log/plugin.php
--- 0.7.24.src/e107_plugins/log/plugin.php	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_plugins/log/plugin.php	2011-05-31 12:32:09.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $URL: https://e107.svn.sourceforge.net/svnroot/e107/trunk/e107_0.7/e107_plugins/log/plugin.php $
-|     $Revision: 11678 $
-|     $Id: plugin.php 11678 2010-08-22 00:43:45Z e107coders $
-|     $Author: e107coders $
+|     $Revision: 12241 $
+|     $Id: plugin.php 12241 2011-05-31 17:32:33Z e107steved $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 
@@ -47,7 +47,7 @@
 $eplug_caption = ADSTAT_L33;
 	
 // List of preferences -----------------------------------------------------------------------------------------------
-$eplug_prefTable = "menu_pref";
+//$eplug_prefTable = "menu_pref";
 $eplug_prefs = array(
 		"statActivate" => 0, 
 		"statUserclass" => "", 
@@ -72,7 +72,7 @@
   log_data longtext NOT NULL,
   PRIMARY KEY  (log_uniqueid),
   UNIQUE KEY log_id (log_id)
-) TYPE=MyISAM ");
+) ENGINE=MyISAM ");
 	
 	
 // Create a link in main menu (yes=TRUE, no=FALSE) -------------------------------------------------------------
diff -x .svn -aruN 0.7.24.src/e107_plugins/log/stats.php 0.7.26.src/e107_plugins/log/stats.php
--- 0.7.24.src/e107_plugins/log/stats.php	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_plugins/log/stats.php	2011-05-10 16:27:02.000000000 -0500
@@ -3,7 +3,7 @@
 + ----------------------------------------------------------------------------+
 |     e107 website system
 |
-|     ©Steve Dunstan 2001-2002
+|     Steve Dunstan 2001-2002
 |     Copyright (C) 2008-2010 e107 Inc (e107.org)
 |
 |
@@ -11,12 +11,17 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $URL: https://e107.svn.sourceforge.net/svnroot/e107/trunk/e107_0.7/e107_plugins/log/stats.php $
-|     $Revision: 11678 $
-|     $Id: stats.php 11678 2010-08-22 00:43:45Z e107coders $
-|     $Author: e107coders $
+|     $Revision: 12206 $
+|     $Id: stats.php 12206 2011-05-10 21:27:26Z e107steved $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 require_once("../../class2.php");
+if (!isset($pref['plug_installed']['log']))
+{
+	header('Location: '.e_BASE.'index.php');
+	exit;
+}
 
 include_lan(e_PLUGIN."log/languages/".e_LANGUAGE.".php");
 
@@ -24,7 +29,7 @@
 	$bar = (file_exists(THEME."images/bar.png") ? THEME."images/bar.png" : e_IMAGE."generic/bar.png");
 	return "<style type='text/css'>
 <!--
-.b { background-image: url(".$bar."); border: 1px solid #999; height: 10px; font-size: 0px }
+.b { background-image: url('".$bar."'); border: 1px solid #999; height: 10px; font-size: 0px }
 -->
 </style>";
 }
@@ -125,6 +130,9 @@
 'w3m'               => "w3m",
 'Webtv'             => "webtv",
 'Xiino'             => "xiino",
+'Chrome'            => "chrome",
+'Nokia S60 OSS Browser' => "nokia",
+'Nokia Browser'     => "nokia",
 );
 
 $country["arpa"] = "ARPANet";
@@ -426,7 +434,7 @@
 	break;
 	case 3:
 	if($pref['statBrowser']) {
-		$text .= $stat -> renderBrowsers();
+		$text .= $stat -> renderBrowsers($pref['statBrowserDispCompr']);
 	} else {
 		$text .= ADSTAT_L7;
 	}
@@ -521,8 +529,6 @@
 ($action != 13 ? "<a href='{$path}?13'>".ADSTAT_L44."</a>" : "<b>".ADSTAT_L44."</b>");
 $links .= "</div><br /><br />";
 
-
-
 $ns->tablerender(ADSTAT_L6, $links.$text);
 require_once(FOOTERF);
 
@@ -631,12 +637,12 @@
 		$totalu = 0;
 		foreach ($this -> fileInfo as $k => $v)
 		{
-		  $found = (strpos($k,'error/') === 0);
-		  if ($do_errors XOR !$found) 
-		  {
-		    $totalArray[$k] = $v;
-			$total += $v['ttlv'];
-		  }
+			$found = (strpos($k,'error/') === 0);
+			if ($do_errors XOR !$found) 
+			{
+				$totalArray[$k] = $v;
+				if (isset($v['ttlv'])) $total += $v['ttlv'];
+			}
 		}
 		$totalArray = $this -> arraySort($totalArray, "ttl");
 
@@ -672,6 +678,7 @@
 		$row = $sql -> db_Fetch();
 		$pageTotal = unserialize($row['log_data']);
 		$total = 0;
+		$text = '';
 
 		$can_delete = ADMIN && getperms("P");
 		$do_errors = $do_errors && $can_delete;
@@ -757,7 +764,7 @@
 
 	/* -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/
 
-	function renderBrowsers() {
+	function renderBrowsers($compress = FALSE) {
 		global $sql, $browser_map;
 
 		if($entries = $sql -> db_Select("logstats", "*", "log_id='statBrowser'")) {
@@ -774,6 +781,24 @@
 			return "<div style='text-align: center;'>".ADSTAT_L25."</div>";
 		}
 
+		if($compress) {
+			$tempArray = array();
+			foreach($statBrowser as $k => $v) {
+				$found = false;
+				foreach(array_keys($browser_map) as $br) {
+					if(stripos($k, $br) === 0) {
+						$tempArray[$br] = (isset($tempArray[$br]) ? $tempArray[$br]+$v : $v);
+						$found = true;
+						break;  //We found what we wanted, break from foreach
+					}
+				}
+				if(!$found) {
+					$tempArray[$k] = $v;
+				}
+			}
+			$statBrowser = $tempArray;
+		}
+
 		if(is_array($statBrowser)) {
 			if($this -> order) {
 				ksort($statBrowser);
@@ -807,7 +832,7 @@
 		}
 		return $text;
 	}
-
+	
 	/* -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/
 
 	function renderOses() {
@@ -841,15 +866,16 @@
 
 			$image = "";
 			if(strstr($key, "Windows")) {	$image = "windows.png"; }
-			if(strstr($key, "Mac")) {	$image = "mac.png"; }
-			if(strstr($key, "Linux")) {	$image = "linux.png"; }
-			if(strstr($key, "BeOS")) {	$image = "beos.png"; }
-			if(strstr($key, "FreeBSD")) {	$image = "freebsd.png"; }
-			if(strstr($key, "NetBSD")) {	$image = "netbsd.png"; }
-			if(strstr($key, "Unspecified")) {	$image = "unspecified.png"; }
-			if(strstr($key, "OpenBSD")) {	$image = "openbsd.png"; }
-			if(strstr($key, "Unix")) {	$image = "unix.png"; }
-			if(strstr($key, "Spiders")) {	$image = "spiders.png"; }
+			elseif(strstr($key, "Mac")) {	$image = "mac.png"; }
+			elseif(strstr($key, "Linux")) {	$image = "linux.png"; }
+			elseif(strstr($key, "BeOS")) {	$image = "beos.png"; }
+			elseif(strstr($key, "FreeBSD")) {	$image = "freebsd.png"; }
+			elseif(strstr($key, "NetBSD")) {	$image = "netbsd.png"; }
+			elseif(strstr($key, "Unspecified")) {	$image = "unspecified.png"; }
+			elseif(strstr($key, "OpenBSD")) {	$image = "openbsd.png"; }
+			elseif(strstr($key, "Unix")) {	$image = "unix.png"; }
+			elseif(strstr($key, "Spiders")) {	$image = "spiders.png"; }
+			elseif(stristr($key, "Android")) {	$image = "android.png"; }
 
 			$percentage = round(($info/$total) * 100, 2);
 			$text .= "<tr>
diff -x .svn -aruN 0.7.24.src/e107_plugins/login_menu/login_menu_shortcodes.php 0.7.26.src/e107_plugins/login_menu/login_menu_shortcodes.php
--- 0.7.24.src/e107_plugins/login_menu/login_menu_shortcodes.php	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_plugins/login_menu/login_menu_shortcodes.php	2010-12-18 16:23:33.000000000 -0600
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $URL: https://e107.svn.sourceforge.net/svnroot/e107/trunk/e107_0.7/e107_plugins/login_menu/login_menu_shortcodes.php $
-|     $Revision: 11678 $
-|     $Id: login_menu_shortcodes.php 11678 2010-08-22 00:43:45Z e107coders $
-|     $Author: e107coders $
+|     $Revision: 12012 $
+|     $Id: login_menu_shortcodes.php 12012 2010-12-18 22:23:57Z e107steved $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 if (!defined('e107_INIT')) { exit; }
@@ -107,11 +107,11 @@
 {
 	if(defined('BULLET'))
 	{
-		$bullet = '<img src="'.THEME.'images/'.BULLET.'" alt="" style="vertical-align: middle;" />';
+		$bullet = '<img src="'.THEME_ABS.'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="vertical-align: middle;" />';
 	}
 }
 return $bullet;
@@ -140,11 +140,11 @@
 $bullet = '';
 if(defined('BULLET'))
 {
-	$bullet = '<img src="'.THEME.'images/'.BULLET.'" alt="" style="vertical-align: middle;" />';
+	$bullet = '<img src="'.THEME_ABS.'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="vertical-align: middle;" />';
 }
 return $bullet;
 SC_END
diff -x .svn -aruN 0.7.24.src/e107_plugins/newforumposts_main/newforumposts_main.php 0.7.26.src/e107_plugins/newforumposts_main/newforumposts_main.php
--- 0.7.24.src/e107_plugins/newforumposts_main/newforumposts_main.php	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_plugins/newforumposts_main/newforumposts_main.php	2010-10-05 02:12:45.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $URL: https://e107.svn.sourceforge.net/svnroot/e107/trunk/e107_0.7/e107_plugins/newforumposts_main/newforumposts_main.php $
-|     $Revision: 11678 $
-|     $Id: newforumposts_main.php 11678 2010-08-22 00:43:45Z e107coders $
-|     $Author: e107coders $
+|     $Revision: 11849 $
+|     $Id: newforumposts_main.php 11849 2010-10-05 07:13:09Z e107steved $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 if (!defined('e107_INIT')) { exit; }
@@ -74,7 +74,7 @@
 LEFT JOIN #forum AS fp ON f.forum_parent = fp.forum_id
 WHERE f.forum_id = t.thread_forum_id AND t.thread_parent=0 AND f.forum_class IN (".USERCLASS_LIST.")
 AND fp.forum_class IN (".USERCLASS_LIST.")
-ORDER BY t.$query DESC LIMIT 0, ".$pref['nfp_amount']);
+ORDER BY t.{$query} DESC LIMIT 0, ".intval($pref['nfp_amount']));
 
 $forumArray = $sql->db_getList();
 
@@ -93,8 +93,8 @@
   $ICON = "<img src='".e_PLUGIN_ABS."forum/images/".IMODE."/new_small.png' alt='' />";
 }
 */
-$TOTAL_TOPICS = $sql->db_Count("forum_t", "(*)", " WHERE thread_parent='0' ");
-$TOTAL_REPLIES = $sql->db_Count("forum_t", "(*)", " WHERE thread_parent!='0' ");
+$TOTAL_TOPICS = $sql->db_Count("forum_t", "(*)", " WHERE thread_parent=0 ");
+$TOTAL_REPLIES = $sql->db_Count("forum_t", "(*)", " WHERE thread_parent!=0 ");
 $sql->db_Select_gen("SELECT sum(thread_views) FROM ".MPREFIX."forum_t");
 $tmp = $sql->db_Fetch();
 $TOTAL_VIEWS = $tmp[0];
diff -x .svn -aruN 0.7.24.src/e107_plugins/newsfeed/newsfeed_functions.php 0.7.26.src/e107_plugins/newsfeed/newsfeed_functions.php
--- 0.7.24.src/e107_plugins/newsfeed/newsfeed_functions.php	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_plugins/newsfeed/newsfeed_functions.php	2010-12-30 19:04:18.000000000 -0600
@@ -11,8 +11,8 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $URL: https://e107.svn.sourceforge.net/svnroot/e107/trunk/e107_0.7/e107_plugins/newsfeed/newsfeed_functions.php $
-|     $Revision: 11678 $
-|     $Id: newsfeed_functions.php 11678 2010-08-22 00:43:45Z e107coders $
+|     $Revision: 12021 $
+|     $Id: newsfeed_functions.php 12021 2010-12-31 01:04:42Z e107coders $
 |     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
@@ -107,14 +107,14 @@
 				$numtoshow = (intval($numtoshow) > 0 ? $numtoshow : 999);
 				$rss = unserialize($newsfeed_data);
 
-				$FEEDNAME = "<a href='".e_SELF."?show.$newsfeed_id'>$newsfeed_name</a>";
+				$FEEDNAME = "<a class='newsfeed-name' href='".e_SELF."?show.$newsfeed_id'>$newsfeed_name</a>";
 				$FEEDDESCRIPTION = $newsfeed_description;
 				if($newsfeed_image == "default")
 				{
 					if($file = fopen ($rss -> image['url'], "r"))
 					{
 						/* remote image exists - use it! */
-						$FEEDIMAGE = "<a href='".$rss -> image['link']."' rel='external'><img src='".$rss -> image['url']."' alt='".$rss -> image['title']."' style='border: 0; vertical-align: middle;' /></a>";
+						$FEEDIMAGE = "<a class='newsfeed-image' href='".$rss -> image['link']."' rel='external'><img src='".$rss -> image['url']."' alt='".$rss -> image['title']."' style='border: 0; vertical-align: middle;' /></a>";
 					}
 					else
 					{
@@ -124,7 +124,7 @@
 				}
 				else if ($newsfeed_image)
 				{
-					$FEEDIMAGE = "<img src='".$newsfeed_image."' alt='' />";
+					$FEEDIMAGE = "<img class='newsfeed-image' src='".$newsfeed_image."' alt='' />";
 				}
 				else
 				{
@@ -147,7 +147,7 @@
 
 				$FEEDLASTBUILDDATE = NFLAN_33.$pubbed;
 				$FEEDCOPYRIGHT = $tp -> toHTML($rss -> channel['copyright'], TRUE);
-				$FEEDTITLE = "<a href='".$rss -> channel['link']."' rel='external'>".$rss -> channel['title']."</a>";
+				$FEEDTITLE = "<a class='newsfeed-title' href='".$rss -> channel['link']."' rel='external'>".$rss -> channel['title']."</a>";
 				$FEEDLINK = $rss -> channel['link'];
 				if($newsfeed_active == 2 or $newsfeed_active == 3)
 				{
@@ -168,7 +168,7 @@
 				while($i < $numtoshow && $item_total[$i])
 				{
 					$item = $item_total[$i];
-					$FEEDITEMLINK = "<a href='".$item['link']."' rel='external'>".$tp -> toHTML($item['title'], TRUE)."</a>\n";
+					$FEEDITEMLINK = "<a class='newsfeed-itemlink' href='".$item['link']."' rel='external'>".$tp -> toHTML($item['title'], TRUE)."</a>\n";
 					$FEEDITEMLINK = str_replace('&', '&amp;', $FEEDITEMLINK);
 					$feeditemtext = preg_replace("#\[[a-z0-9=]+\]|\[\/[a-z]+\]|\{[A-Z_]+\}#si", "", strip_tags($item['description']));
 					$FEEDITEMTEXT = $tp->text_truncate($feeditemtext, $truncate, $truncate_string);
@@ -178,7 +178,7 @@
 					$i++;
 				}
 
-				$BACKLINK = "<a href='".e_SELF."'>".NFLAN_31."</a>";
+				$BACKLINK = "<a class='newsfeed-backlink' href='".e_SELF."'>".NFLAN_31."</a>";
 				$text .= preg_replace("/\{(.*?)\}/e", '$\1', $NEWSFEED_MENU_START) . $data . preg_replace("/\{(.*?)\}/e", '$\1', $NEWSFEED_MENU_END);
 			}
 		}
@@ -198,4 +198,4 @@
 }
 
 
-?>
+?>
\ No newline at end of file
diff -x .svn -aruN 0.7.24.src/e107_plugins/newsfeed/newsfeed.php 0.7.26.src/e107_plugins/newsfeed/newsfeed.php
--- 0.7.24.src/e107_plugins/newsfeed/newsfeed.php	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_plugins/newsfeed/newsfeed.php	2011-01-14 12:28:33.000000000 -0600
@@ -11,12 +11,15 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $URL: https://e107.svn.sourceforge.net/svnroot/e107/trunk/e107_0.7/e107_plugins/newsfeed/newsfeed.php $
-|     $Revision: 11678 $
-|     $Id: newsfeed.php 11678 2010-08-22 00:43:45Z e107coders $
-|     $Author: e107coders $
+|     $Id: newsfeed.php 12040 2011-01-14 18:28:57Z e107steved $
 +----------------------------------------------------------------------------+
 */
-require_once("../../class2.php");
+require_once('../../class2.php');
+if (!isset($pref['plug_installed']['newsfeed']))
+{
+	header('Location: '.e_BASE.'index.php');
+	exit;
+}
 
 include_lan(e_PLUGIN."newsfeed/languages/".e_LANGUAGE.".php");
 
diff -x .svn -aruN 0.7.24.src/e107_plugins/newsfeed/plugin.php 0.7.26.src/e107_plugins/newsfeed/plugin.php
--- 0.7.24.src/e107_plugins/newsfeed/plugin.php	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_plugins/newsfeed/plugin.php	2011-03-11 12:49:32.000000000 -0600
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $URL: https://e107.svn.sourceforge.net/svnroot/e107/trunk/e107_0.7/e107_plugins/newsfeed/plugin.php $
-|     $Revision: 11678 $
-|     $Id: plugin.php 11678 2010-08-22 00:43:45Z e107coders $
-|     $Author: e107coders $
+|     $Revision: 12092 $
+|     $Id: plugin.php 12092 2011-03-11 18:49:56Z e107steved $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 
@@ -64,7 +64,7 @@
   newsfeed_active tinyint(1) unsigned NOT NULL default '0',
   newsfeed_updateint int(10) unsigned NOT NULL default '0',
   PRIMARY KEY  (newsfeed_id)
-) TYPE=MyISAM;");
+) ENGINE=MyISAM;");
 
 // Create a link in main menu (yes=TRUE, no=FALSE) -------------------------------------------------------------
 $eplug_link = TRUE;
diff -x .svn -aruN 0.7.24.src/e107_plugins/newsletter/plugin.php 0.7.26.src/e107_plugins/newsletter/plugin.php
--- 0.7.24.src/e107_plugins/newsletter/plugin.php	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_plugins/newsletter/plugin.php	2011-03-11 12:49:32.000000000 -0600
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $URL: https://e107.svn.sourceforge.net/svnroot/e107/trunk/e107_0.7/e107_plugins/newsletter/plugin.php $
-|     $Revision: 11678 $
-|     $Id: plugin.php 11678 2010-08-22 00:43:45Z e107coders $
-|     $Author: e107coders $
+|     $Revision: 12092 $
+|     $Id: plugin.php 12092 2011-03-11 18:49:56Z e107steved $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 
@@ -66,7 +66,7 @@
   newsletter_flag tinyint(4) NOT NULL,
   newsletter_issue varchar(100) NOT NULL,
   PRIMARY KEY  (newsletter_id)
-  ) TYPE=MyISAM;");
+  ) ENGINE=MyISAM;");
 
 
 // Create a link in main menu (yes=TRUE, no=FALSE) -------------------------------------------------------------
diff -x .svn -aruN 0.7.24.src/e107_plugins/online_extended_menu/online_extended_menu.php 0.7.26.src/e107_plugins/online_extended_menu/online_extended_menu.php
--- 0.7.24.src/e107_plugins/online_extended_menu/online_extended_menu.php	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_plugins/online_extended_menu/online_extended_menu.php	2011-02-13 03:53:19.000000000 -0600
@@ -11,18 +11,20 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $URL: https://e107.svn.sourceforge.net/svnroot/e107/trunk/e107_0.7/e107_plugins/online_extended_menu/online_extended_menu.php $
-|     $Revision: 11678 $
-|     $Id: online_extended_menu.php 11678 2010-08-22 00:43:45Z e107coders $
-|     $Author: e107coders $
+|     $Revision: 12071 $
+|     $Id: online_extended_menu.php 12071 2011-02-13 09:53:43Z e107steved $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 if (!defined('e107_INIT')) { exit; }
 
-if(!defined("e_TRACKING_DISABLED") && (isset($pref['track_online']) && $pref['track_online'])) {
+if(!defined("e_TRACKING_DISABLED") && (isset($pref['track_online']) && $pref['track_online'])) 
+{
 	$text = ONLINE_EL1.GUESTS_ONLINE.", ";
 	$text .= ONLINE_EL2.MEMBERS_ONLINE." ...<br />";
 
-	if (MEMBERS_ONLINE) {
+	if (MEMBERS_ONLINE) 
+	{
 		global $listuserson, $ADMIN_DIRECTORY;
 		foreach($listuserson as $uinfo => $pinfo) {
 
@@ -53,15 +55,20 @@
 		}
 	}
 
-	if ((MEMBERS_ONLINE + GUESTS_ONLINE) > ($menu_pref['most_members_online'] + $menu_pref['most_guests_online'])) {
+	// Update details of maximum members online if appropriate
+	// The check for (count($menu_pref) > 3) is to try and prevent DB updates if the host does something nasty to earlier queries - can end up with $menu_pref empty
+	if (((MEMBERS_ONLINE + GUESTS_ONLINE) > ($menu_pref['most_members_online'] + $menu_pref['most_guests_online'])) && (count($menu_pref) > 3))
+	{
+		global $sysprefs;
 		$menu_pref['most_members_online'] = MEMBERS_ONLINE;
 		$menu_pref['most_guests_online'] = GUESTS_ONLINE;
 		$menu_pref['most_online_datestamp'] = time();
-		$tmp = addslashes(serialize($menu_pref));
-		$sql->db_Update("core", "e107_value='$tmp' WHERE e107_name='menu_pref' ");
+		$sysprefs->setArray('menu_pref');
 	}
+
     global $gen;
-	if (!is_object($gen)) {
+	if (!is_object($gen)) 
+	{
 		$gen = new convert;
 	}
 
diff -x .svn -aruN 0.7.24.src/e107_plugins/pdf/pdf.sc 0.7.26.src/e107_plugins/pdf/pdf.sc
--- 0.7.24.src/e107_plugins/pdf/pdf.sc	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_plugins/pdf/pdf.sc	2011-06-28 20:07:04.000000000 -0500
@@ -1,6 +1,19 @@
 /*
- * e107 website system (c) 2001-2008 Steve Dunstan (e107.org)
- * $Id: pdf.sc 11346 2010-02-17 18:56:14Z secretr $
++ ----------------------------------------------------------------------------+
+|     e107 website system
+|
+|     Copyright (C) 2001-2002 Steve Dunstan (jalist@e107.org)
+|     Copyright (C) 2008-2010 e107 Inc (e107.org)
+|
+|
+|     Released under the terms and conditions of the
+|     GNU General Public License (http://gnu.org).
+|
+|     $URL: https://e107.svn.sourceforge.net/svnroot/e107/trunk/e107_0.7/e107_plugins/pdf/pdf.sc $
+|     $Revision: 12289 $
+|     $Id: pdf.sc 12289 2011-06-29 01:07:28Z e107coders $
+|     $Author: e107coders $
++----------------------------------------------------------------------------+
 */
 
 if (defined("ICONPRINTPDF") && file_exists(THEME."images/".ICONPRINTPDF)) 
diff -x .svn -aruN 0.7.24.src/e107_plugins/pm/plugin.php 0.7.26.src/e107_plugins/pm/plugin.php
--- 0.7.24.src/e107_plugins/pm/plugin.php	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_plugins/pm/plugin.php	2011-05-02 15:45:16.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $URL: https://e107.svn.sourceforge.net/svnroot/e107/trunk/e107_0.7/e107_plugins/pm/plugin.php $
-|     $Revision: 11678 $
-|     $Id: plugin.php 11678 2010-08-22 00:43:45Z e107coders $
-|     $Author: e107coders $
+|     $Revision: 12178 $
+|     $Id: plugin.php 12178 2011-05-02 20:45:40Z e107steved $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 
@@ -69,7 +69,7 @@
   pm_option varchar(250) NOT NULL default '',
   pm_size int(10) unsigned NOT NULL default '0',
   PRIMARY KEY  (pm_id)
-) TYPE=MyISAM AUTO_INCREMENT=1 ;",
+) ENGINE=MyISAM AUTO_INCREMENT=1 ;",
 "CREATE TABLE ".MPREFIX."private_msg_block (
   pm_block_id int(10) unsigned NOT NULL auto_increment,
   pm_block_from int(10) unsigned NOT NULL default '0',
@@ -77,7 +77,7 @@
   pm_block_datestamp int(10) unsigned NOT NULL default '0',
   pm_block_count int(10) unsigned NOT NULL default '0',
   PRIMARY KEY  (pm_block_id)
-) TYPE=MyISAM AUTO_INCREMENT=1 ;"
+) ENGINE=MyISAM AUTO_INCREMENT=1 ;"
 );
 
 // Create a link in main menu (yes=TRUE, no=FALSE) -------------------------------------------------------------
diff -x .svn -aruN 0.7.24.src/e107_plugins/pm/pm_class.php 0.7.26.src/e107_plugins/pm/pm_class.php
--- 0.7.24.src/e107_plugins/pm/pm_class.php	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_plugins/pm/pm_class.php	2011-04-18 12:44:18.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $URL: https://e107.svn.sourceforge.net/svnroot/e107/trunk/e107_0.7/e107_plugins/pm/pm_class.php $
-|     $Revision: 11678 $
-|     $Id: pm_class.php 11678 2010-08-22 00:43:45Z e107coders $
-|     $Author: e107coders $
+|     $Revision: 12144 $
+|     $Id: pm_class.php 12144 2011-04-18 17:44:42Z e107steved $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 
@@ -337,8 +337,9 @@
 	function pm_getuid($var)
 	{
 		global $sql, $tp;
-		$var = trim($var);
-		$result = $sql->db_Select("user", "user_id, user_name, user_class, user_email", "user_name LIKE '".$sql -> escape($var, TRUE)."'");
+		$var = strip_if_magic($var);
+		$var = str_replace("'", '&#039;', trim($var));		// Display name uses entities for apostrophe
+		$result = $sql->db_Select("user", "user_id, user_name, user_class, user_email", "user_name LIKE '".$sql -> escape($var, FALSE)."'");
 		if ($result === FALSE) return FALSE;
 		$firstRow = $sql->db_Fetch();
 		if (($result == 1) || ($firstRow['user_name'] == $var))
diff -x .svn -aruN 0.7.24.src/e107_plugins/pm/pm_shortcodes.php 0.7.26.src/e107_plugins/pm/pm_shortcodes.php
--- 0.7.24.src/e107_plugins/pm/pm_shortcodes.php	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_plugins/pm/pm_shortcodes.php	2011-01-12 08:12:08.000000000 -0600
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $URL: https://e107.svn.sourceforge.net/svnroot/e107/trunk/e107_0.7/e107_plugins/pm/pm_shortcodes.php $
-|     $Revision: 11678 $
-|     $Id: pm_shortcodes.php 11678 2010-08-22 00:43:45Z e107coders $
-|     $Author: e107coders $
+|     $Revision: 12033 $
+|     $Id: pm_shortcodes.php 12033 2011-01-12 14:12:32Z e107steved $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 if (!defined('e107_INIT')) { exit; }
@@ -33,11 +33,11 @@
 $type = ($pm_prefs['dropdown'] == TRUE ? 'list' : 'popup');
 if(check_class($pm_prefs['multi_class']))
 {
-	$ret = $us->select_form($type, 'textarea.pm_to');
+	$ret = $us->select_form($type, 'textarea.pm_to', '', $pm_prefs['pm_class']);
 }
 else
 {
-	$ret = $us->select_form($type, 'pm_to');
+	$ret = $us->select_form($type, 'pm_to', '', $pm_prefs['pm_class']);
 }
 return $ret;
 SC_END
diff -x .svn -aruN 0.7.24.src/e107_plugins/pm/pm_sql.php 0.7.26.src/e107_plugins/pm/pm_sql.php
--- 0.7.24.src/e107_plugins/pm/pm_sql.php	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_plugins/pm/pm_sql.php	2011-03-11 12:49:32.000000000 -0600
@@ -12,7 +12,7 @@
   pm_option varchar(250) NOT NULL default '',
   pm_size int(10) unsigned NOT NULL default '0',
   PRIMARY KEY  (pm_id)
-) TYPE=MyISAM AUTO_INCREMENT=1 ;
+) ENGINE=MyISAM AUTO_INCREMENT=1 ;
 
 CREATE TABLE private_msg_block (
   pm_block_id int(10) unsigned NOT NULL auto_increment,
@@ -21,4 +21,4 @@
   pm_block_datestamp int(10) unsigned NOT NULL default '0',
   pm_block_count int(10) unsigned NOT NULL default '0',
   PRIMARY KEY  (pm_block_id)
-) TYPE=MyISAM AUTO_INCREMENT=1 ;
+) ENGINE=MyISAM AUTO_INCREMENT=1 ;
diff -x .svn -aruN 0.7.24.src/e107_plugins/pm/pm_update.php 0.7.26.src/e107_plugins/pm/pm_update.php
--- 0.7.24.src/e107_plugins/pm/pm_update.php	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_plugins/pm/pm_update.php	2011-05-02 15:45:16.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $URL: https://e107.svn.sourceforge.net/svnroot/e107/trunk/e107_0.7/e107_plugins/pm/pm_update.php $
-|     $Revision: 11678 $
-|     $Id: pm_update.php 11678 2010-08-22 00:43:45Z e107coders $
-|     $Author: e107coders $
+|     $Revision: 12178 $
+|     $Id: pm_update.php 12178 2011-05-02 20:45:40Z e107steved $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 
@@ -43,7 +43,7 @@
 pm_option varchar(250) NOT NULL default '',
 pm_size int(10) unsigned NOT NULL default '0',
 PRIMARY KEY  (pm_id)
-) TYPE=MyISAM AUTO_INCREMENT=1 ;");
+) ENGINE=MyISAM AUTO_INCREMENT=1 ;");
 			
 $sql -> db_Select_gen("
 CREATE TABLE ".MPREFIX."private_msg_block (
@@ -53,7 +53,7 @@
 pm_block_datestamp int(10) unsigned NOT NULL default '0',
 pm_block_count int(10) unsigned NOT NULL default '0',
 PRIMARY KEY  (pm_block_id)
-) TYPE=MyISAM AUTO_INCREMENT=1 ;");
+) ENGINE=MyISAM AUTO_INCREMENT=1 ;");
 
 $plugin -> manage_plugin_prefs('add', 'plug_sc', 'pm', 'SENDPM');
 
diff -x .svn -aruN 0.7.24.src/e107_plugins/poll/plugin.php 0.7.26.src/e107_plugins/poll/plugin.php
--- 0.7.24.src/e107_plugins/poll/plugin.php	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_plugins/poll/plugin.php	2011-05-02 15:45:16.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $URL: https://e107.svn.sourceforge.net/svnroot/e107/trunk/e107_0.7/e107_plugins/poll/plugin.php $
-|     $Revision: 11678 $
-|     $Id: plugin.php 11678 2010-08-22 00:43:45Z e107coders $
-|     $Author: e107coders $
+|     $Revision: 12178 $
+|     $Id: plugin.php 12178 2011-05-02 20:45:40Z e107steved $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 
@@ -74,7 +74,7 @@
   poll_vote_userclass tinyint(3) unsigned NOT NULL default '0',
   poll_storage_method tinyint(1) unsigned NOT NULL default '0',
   PRIMARY KEY  (poll_id)
-) TYPE=MyISAM;");
+) ENGINE=MyISAM;");
 
 // Create a link in main menu (yes=TRUE, no=FALSE) -------------------------------------------------------------
 $eplug_link = FALSE;
diff -x .svn -aruN 0.7.24.src/e107_plugins/poll/poll_class.php 0.7.26.src/e107_plugins/poll/poll_class.php
--- 0.7.24.src/e107_plugins/poll/poll_class.php	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_plugins/poll/poll_class.php	2011-08-12 14:36:45.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $URL: https://e107.svn.sourceforge.net/svnroot/e107/trunk/e107_0.7/e107_plugins/poll/poll_class.php $
-|     $Revision: 11678 $
-|     $Id: poll_class.php 11678 2010-08-22 00:43:45Z e107coders $
-|     $Author: e107coders $
+|     $Revision: 12330 $
+|     $Id: poll_class.php 12330 2011-08-12 19:37:09Z nlstart $
+|     $Author: nlstart $
 +----------------------------------------------------------------------------+
 */
 if (!defined('e107_INIT')) { exit; }
@@ -247,7 +247,7 @@
 					$votep = implode(chr(1), $votes);
 					$pollArray['poll_votes'] = $votep;
 
-					$sql->db_Update("polls", "poll_votes = '$votep', poll_ip='".$poll_ip.$userid."^' WHERE poll_id=".$poll_id);
+					$sql->db_Update("polls", "poll_votes = '$votep'".($pollArray['poll_storage_method'] != POLL_MODE_COOKIE ? ", poll_ip='".$poll_ip.$userid."^'" : '')." WHERE poll_id=".$poll_id);
 					echo "
 				<script type='text/javascript'>
 				<!--
@@ -414,7 +414,7 @@
 			  foreach($optionArray as $option)
 			  {
 				$OPTION = $tp->toHTML($option, TRUE);
-				$BAR = ($percentage[$count] ? "<div style='width: 100%'><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]) : 90)."%; height: 14px; float: left;'></div><div style='background-image: url($barr); width: 5px; height: 14px; float: left;'></div></div>" : "");
+				$BAR = ($percentage[$count] ? "<div style='width: 100%'><div style='background-image: url($barl); width: 5px; height: 14px; float: left;'></div><div style='background-image: url($bar); width: ".min(intval($percentage[$count]), 90)."%; height: 14px; float: left;'></div><div style='background-image: url($barr); width: 5px; height: 14px; float: left;'></div></div>" : "");
 				$PERCENTAGE = $percentage[$count]."%";
 				$VOTES = POLLAN_31.": ".$voteArray[$count];
 				$text .= preg_replace("/\{(.*?)\}/e", '$\1', ($type == "forum" ? $POLL_FORUM_VOTED_LOOP : $POLL_VOTED_LOOP));
diff -x .svn -aruN 0.7.24.src/e107_plugins/poll/poll.php 0.7.26.src/e107_plugins/poll/poll.php
--- 0.7.24.src/e107_plugins/poll/poll.php	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_plugins/poll/poll.php	2011-01-14 12:28:33.000000000 -0600
@@ -4,22 +4,27 @@
 |     e107 website system
 |
 |     Copyright (C) 2001-2002 Steve Dunstan (jalist@e107.org)
-|     Copyright (C) 2008-2010 e107 Inc (e107.org)
+|     Copyright (C) 2008-2011 e107 Inc (e107.org)
 |
 |
 |     Released under the terms and conditions of the
 |     GNU General Public License (http://gnu.org).
 |
 |     $URL: https://e107.svn.sourceforge.net/svnroot/e107/trunk/e107_0.7/e107_plugins/poll/poll.php $
-|     $Revision: 11678 $
-|     $Id: poll.php 11678 2010-08-22 00:43:45Z e107coders $
-|     $Author: e107coders $
+|     $Revision: 12040 $
+|     $Id: poll.php 12040 2011-01-14 18:28:57Z e107steved $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
-require_once("../../class2.php");
+require_once('../../class2.php');
+if (!isset($pref['plug_installed']['poll']))
+{
+	header('Location: '.e_BASE.'index.php');
+	exit;
+}
 require_once(HEADERF);
 
-require_once(e_PLUGIN."poll/poll_menu.php");
+require(e_PLUGIN.'poll/poll_menu.php');
 
 
 require_once(FOOTERF);
diff -x .svn -aruN 0.7.24.src/e107_plugins/poll/poll_sql.php 0.7.26.src/e107_plugins/poll/poll_sql.php
--- 0.7.24.src/e107_plugins/poll/poll_sql.php	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_plugins/poll/poll_sql.php	2011-03-11 12:49:32.000000000 -0600
@@ -15,4 +15,4 @@
   poll_vote_userclass tinyint(3) unsigned NOT NULL default '0',
   poll_storage_method tinyint(1) unsigned NOT NULL default '0',
   PRIMARY KEY  (poll_id)
-) TYPE=MyISAM;
\ No newline at end of file
+) ENGINE=MyISAM;
\ No newline at end of file
diff -x .svn -aruN 0.7.24.src/e107_plugins/rss_menu/e_meta.php 0.7.26.src/e107_plugins/rss_menu/e_meta.php
--- 0.7.24.src/e107_plugins/rss_menu/e_meta.php	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_plugins/rss_menu/e_meta.php	2011-01-15 06:10:47.000000000 -0600
@@ -4,15 +4,15 @@
 |     e107 website system
 |
 |     Steve Dunstan 2001-2002
-|     Copyright (C) 2008-2010 e107 Inc (e107.org)
+|     Copyright (C) 2008-2011 e107 Inc (e107.org)
 |
 |
 |     Released under the terms and conditions of the
 |     GNU General Public License (http://gnu.org).
 |
 |     $URL: https://e107.svn.sourceforge.net/svnroot/e107/trunk/e107_0.7/e107_plugins/rss_menu/e_meta.php $
-|     $Revision: 11678 $
-|     $Id: e_meta.php 11678 2010-08-22 00:43:45Z e107coders $
+|     $Revision: 12044 $
+|     $Id: e_meta.php 12044 2011-01-15 12:11:11Z e107coders $
 |     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
@@ -20,17 +20,69 @@
 
 global $tp,$PLUGINS_DIRECTORY;
 
-	if($sql->db_Select("rss", "*", "rss_class='0' AND rss_limit>0 ORDER BY rss_name"))
+include_lan(e_PLUGIN."rss_menu/languages/".e_LANGUAGE.".php"); // multilanguage fix. 
+
+$rssQuery = "rss_class='0' AND rss_limit>0 ";
+
+// Feed links should display on their corresponding pages. 
+
+// News and it's Categories
+if(e_PAGE  == "news.php")
+{
+	if(e_QUERY)
+	{
+		$var = explode(".",e_QUERY);
+	}
+	
+	$rssQuery .= "AND (rss_url = 'news' OR rss_url = '1') ";	
+	
+	if(($var[0] == "list" || $var[0] == "cat") && isset($var[1]))
+	{
+		$rssQuery .= " AND rss_topicid = ".intval($var[1]);
+	}
+	else
+	{
+		$rssQuery .= " AND rss_topicid = 0";	
+	}
+}
+
+if(e_PAGE == "download.php")
+{
+	if(e_QUERY)
+	{
+		$var = explode(".",e_QUERY);
+	}
+	
+	
+	$rssQuery .= "AND (rss_url = 'download' OR rss_url = '12') ";	
+	
+	if(($var[0] == "list") && isset($var[1]))
+	{
+		$rssQuery .= " AND rss_topicid = ".intval($var[1]);
+	}
+	else
+	{
+		$rssQuery .= " AND rss_topicid = 0";	
+	}
+	
+}
+
+
+$rssQuery .= " ORDER BY rss_url,rss_topicid";	
+
+	if($sql->db_Select("rss", "*", $rssQuery))
 	{
    		while($row=$sql->db_Fetch()){
 	  		//wildcard topic_id's should not be listed
 	   		if(strpos($row['rss_url'], "*")===FALSE){
 		  		$url = SITEURL.$PLUGINS_DIRECTORY."rss_menu/rss.php?".$tp->toHTML($row['rss_url'], TRUE, 'constants, no_hook, emotes_off').".2";
 				$url .= ($row['rss_topicid']) ? ".".$row['rss_topicid'] : "";
-		  		$name = $tp->toHTML($row['rss_name'], TRUE, 'no_hook, emotes_off');
+		  		$name = $tp->toHTML($row['rss_name'], TRUE, 'no_hook, emotes_off,defs');
 		   		echo "<link rel='alternate' type='application/rss+xml' title='".htmlspecialchars(SITENAME, ENT_QUOTES, CHARSET)." ".htmlspecialchars($name, ENT_QUOTES, CHARSET)."' href='".$url."' />\n";
+				
 			}
 		}
 	}
-
+unset($rssQuery,$var);	
+echo "\n\n";
 ?>
\ No newline at end of file
diff -x .svn -aruN 0.7.24.src/e107_plugins/rss_menu/plugin.php 0.7.26.src/e107_plugins/rss_menu/plugin.php
--- 0.7.24.src/e107_plugins/rss_menu/plugin.php	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_plugins/rss_menu/plugin.php	2011-05-02 15:45:16.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $URL: https://e107.svn.sourceforge.net/svnroot/e107/trunk/e107_0.7/e107_plugins/rss_menu/plugin.php $
-|     $Revision: 11678 $
-|     $Id: plugin.php 11678 2010-08-22 00:43:45Z e107coders $
-|     $Author: e107coders $
+|     $Revision: 12178 $
+|     $Id: plugin.php 12178 2011-05-02 20:45:40Z e107steved $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 if (!defined('e107_INIT')) { exit(); }
@@ -66,7 +66,7 @@
 	rss_class tinyint(1) unsigned NOT NULL default '0',
 	rss_limit tinyint(3) unsigned NOT NULL default '0',
 	PRIMARY KEY (rss_id)
-	) TYPE=MyISAM;",
+	) ENGINE=MyISAM;",
 
 	"INSERT INTO ".MPREFIX."rss VALUES
 	(0, '".RSS_NEWS."', 'news', '', 'news', '".RSS_PLUGIN_LAN_7."', '".time()."', 0, 9),
@@ -97,7 +97,7 @@
 	rss_class tinyint(1) unsigned NOT NULL default '0',
 	rss_limit tinyint(3) unsigned NOT NULL default '0',
 	PRIMARY KEY (rss_id)
-	) TYPE=MyISAM;",
+	) ENGINE=MyISAM;",
 
 	"INSERT INTO ".MPREFIX."rss VALUES
 	(0, '".RSS_NEWS."', 'news', '', 'news', '".RSS_PLUGIN_LAN_7."', '".time()."', 0, 9),
diff -x .svn -aruN 0.7.24.src/e107_plugins/rss_menu/rss.php 0.7.26.src/e107_plugins/rss_menu/rss.php
--- 0.7.24.src/e107_plugins/rss_menu/rss.php	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_plugins/rss_menu/rss.php	2011-02-25 15:23:47.000000000 -0600
@@ -1,721 +1,765 @@
-<?php
-/*
-+ ----------------------------------------------------------------------------+
-|     e107 website system
-|
-|     Copyright (C) 2001-2002 Steve Dunstan (jalist@e107.org)
-|     Copyright (C) 2008-2010 e107 Inc (e107.org)
-|
-|     Released under the terms and conditions of the
-|     GNU General Public License (http://gnu.org).
-|
-|     $URL: https://e107.svn.sourceforge.net/svnroot/e107/trunk/e107_0.7/e107_plugins/rss_menu/rss.php $
-|     $Revision: 11678 $
-|     $Id: rss.php 11678 2010-08-22 00:43:45Z e107coders $
-|     $Author: e107coders $
-+----------------------------------------------------------------------------+
-*/
-
-/*
-Query string: content_type.rss_type.[topic id]
-1: news
-5: comments
-12: downloads (option: specify category)
-
-Plugins should use an e_rss.php file in their plugin folder
-----------------------------------------------------------------
-*/
-
-require_once("../../class2.php");
-
-global $tp;
-
-require_once(e_PLUGIN."rss_menu/rss_shortcodes.php");
-require_once(e_HANDLER."userclass_class.php");
-
-if (!is_object($tp->e_bb)) {
-	require_once(e_HANDLER.'bbcode_handler.php');
-	$tp->e_bb = new e_bbcode;
-}
-
-//get language file
-if (is_readable(e_PLUGIN."rss_menu/languages/".e_LANGUAGE.".php")) {
-	include_once(e_PLUGIN."rss_menu/languages/".e_LANGUAGE.".php");
-} else {
-	include_once(e_PLUGIN."rss_menu/languages/English.php");
-}
-
-//get template
-if (is_readable(THEME."rss_template.php")) {
-	require_once(THEME."rss_template.php");
-	} else {
-	require_once(e_PLUGIN."rss_menu/rss_template.php");
-}
-
-//query handler
-if (e_QUERY)
-{
-	$tmp = explode(".", e_QUERY);
-	$content_type = $tp->toDB($tmp[0]);
-	$rss_type = intval(varset($tmp[1],0));
-	$topic_id = $tp->toDB($tmp[2],'');
-}
-
-//list available rss feeds
-if (!$rss_type) 
-{
-	require_once(HEADERF);
- 	require_once(e_PLUGIN."rss_menu/rss_template.php");
-
-	if(!$sql->db_Select("rss", "*", "`rss_class`='0' AND `rss_limit`>0 AND `rss_topicid` NOT REGEXP ('\\\*') ORDER BY `rss_name`"))
-	{
-		$ns->tablerender(LAN_ERROR, RSS_LAN_ERROR_4);
-	}
-	else
-	{
-		$text = $RSS_LIST_HEADER;
-		while($row=$sql->db_Fetch())
-		{
-			$text .= $tp -> parseTemplate($RSS_LIST_TABLE, FALSE, $rss_shortcodes);
-		}
-		$text .= $RSS_LIST_FOOTER;
-		$ns->tablerender(RSS_MENU_L2, $text);
-	}
-
- 	require_once(FOOTERF);
-	exit;
-}
-
-//conversion table for old urls -------
-$conversion[1] = "news";
-$conversion[5] = "comments";
-$conversion[10] = "bugtracker";
-$conversion[12] = "download";
-//-------------------------------------
-
-//convert certain old urls so we can check the db entries ---------------------
-if($topic_id)
-{	//rss.php?1.2.14 (news, rss-2, cat=14)
-	if(is_numeric($content_type) && isset($conversion[$content_type]) )
-	{
-		$content_type = $conversion[$content_type];
-	}
-}
-else
-{	//rss.php?1.2 (news, rss-2) --> check = news (check conversion table)
-	if(is_numeric($content_type) && isset($conversion[$content_type]) )
-	{
-		$content_type = $conversion[$content_type];
-	}
-}
-
-$check_topic = ($topic_id ? " AND rss_topicid = '".$topic_id."' " : "");
-
-if(!$sql -> db_Select("rss", "*", "rss_class!='2' AND rss_url='".$content_type."' ".$check_topic." AND rss_limit>0 "))
-{
-	//check if wildcard present for topic_id
-	$check_topic = ($topic_id ? " AND rss_topicid = '".str_replace($topic_id, "*", $topic_id)."' " : "");
-	if(!$sql -> db_Select("rss", "*", "rss_class!='2' AND rss_url='".$content_type."' ".$check_topic." AND rss_limit>0 "))
-	{
-		require_once(HEADERF);
-		$ns->tablerender("", RSS_LAN_ERROR_1);
-		require_once(FOOTERF);
-		exit;
-	}
-	else
-	{
-		$row = $sql->db_Fetch();
-	}
-}
-else
-{
-	$row = $sql->db_Fetch();
-}
-
-//debugging
-//echo $check." - ".$content_type." - ".$rss_type." - ".$topic_id."<br />";
-//exit;
-
-// ----------------------------------------------------------------------------
-
-if($rss = new rssCreate($content_type, $rss_type, $topic_id, $row)){
-	$rss_title = ($rss->contentType ? $rss->contentType : ucfirst($content_type));
-	$rss->buildRss ($rss_title);
-}else{
-	require_once(HEADERF);
-	$ns->tablerender(RSS_LAN_ERROR_0, RSS_LAN_ERROR_1);
-	require_once(FOOTERF);
-	exit;
-}
-
-class rssCreate {
-
-	var $contentType;
-	var $rssType;
-	var $path;
-	var $parm;
-	var $rssItems;
-	var $rssQuery;
-	var $topicid;
-	var $offset;
-	var $rssNamespace;
-	var $rssCustomChannel;
-
-	function rssCreate($content_type, $rss_type, $topic_id, $row) {
-		// constructor
-		$sql_rs = new db;
-		global $tp, $sql, $e107, $PLUGINS_DIRECTORY, $pref, $rssgen;
-		$this -> path = e_PLUGIN."rss_menu/";
-		$this -> rssType = $rss_type;
-		$this -> topicid = $topic_id;
-		$this -> offset = $pref['time_offset'] * 3600;
-		$this -> limit = $row['rss_limit'];
-		$this -> contentType = $row['rss_name'];
-
-		if(!is_numeric($content_type)){
-			$path = e_PLUGIN.$row['rss_path']."/e_rss.php";
-		}
-		if(strpos($row['rss_path'],'|')!==FALSE){
-			$tmp = explode("|", $row['rss_path']);
-			$path = e_PLUGIN.$tmp[0]."/e_rss.php";
-			$this -> parm = $tmp[1];	//parm is used in e_rss.php to define which feed you need to prepare
-		}
-
-		switch ($content_type) {
-			case 'news' :
-			case 1:
-				if($topic_id && is_numeric($topic_id))
-				{
-					$topic = " AND news_category = ".intval($topic_id);
-				}
-				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 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();
-				$loop=0;
-				foreach($tmp as $value) {
-					$this -> rssItems[$loop]['title'] = $value['news_title'];
-					$this -> rssItems[$loop]['link'] = "http://".$_SERVER['HTTP_HOST'].e_HTTP."news.php?item.".$value['news_id'].".".$value['news_category'];
-                    if($value['news_summary'])
-                    {
-                        	$this -> rssItems[$loop]['description'] = $value['news_summary'];
-					}else{
-						$this -> rssItems[$loop]['description'] = $value['news_body'];
-                    }
-					$this -> rssItems[$loop]['author'] = $value['user_name'];
-                    $this -> rssItems[$loop]['author_email'] = $value['user_email'];
-					$this -> rssItems[$loop]['category'] = "<category domain='".SITEURL."news.php?cat.".$value['news_category']."'>".$value['category_name']."</category>";
-
-					if($value['news_allow_comments'] && $pref['comments_disabled'] != 1){
-						$this -> rssItems[$loop]['comment'] = "http://".$_SERVER['HTTP_HOST'].e_HTTP."comment.php?comment.news.".$value['news_id'];
-                    }
-					$this -> rssItems[$loop]['pubdate'] = $value['news_datestamp'];
-
-					$loop++;
-				}
-				break;
-			case 2:
-				$path='';
-				$this -> contentType = "articles";
-				break;
-			case 3:
-				$path='';
-				$this -> contentType = "reviews";
-				break;
-			case 4:
-				$path='';
-				$this -> contentType = "content";
-				break;
-			case 'comments' :
-			case 5:
-				$path='';
-				$this -> rssQuery = "SELECT * FROM `#comments` WHERE `comment_blocked` = 0 ORDER BY `comment_datestamp` DESC LIMIT 0,".$this -> limit;
-				$sql->db_Select_gen($this -> rssQuery);
-				$tmp = $sql->db_getList();
-				$this -> rssItems = array();
-				$loop=0;
-				foreach($tmp as $value) 
-				{
-					$this -> rssItems[$loop]['title'] = $value['comment_subject'];
-					$this -> rssItems[$loop]['pubdate'] = $value['comment_datestamp'];
-
-					switch ($value['comment_type']) 
-					{
-						case 0 :
-						case 'news' :
-							$this -> rssItems[$loop]['link'] = "http://".$_SERVER['HTTP_HOST'].e_HTTP."comment.php?comment.news.".$value['comment_item_id'];
-							break;
-						case 2 :
-						case 'download' :
-							$this -> rssItems[$loop]['link'] = "http://".$_SERVER['HTTP_HOST'].e_HTTP."comment.php?comment.download.".$value['comment_item_id'];
-							break;
-						case 4:
-						case 'poll' :
-							$this -> rssItems[$loop]['link'] = "http://".$_SERVER['HTTP_HOST'].e_HTTP."comment.php?comment.poll.".$value['comment_item_id'];
-							break;
-					}
-
-					$this -> rssItems[$loop]['description'] = $value['comment_comment'];
-					$this -> rssItems[$loop]['author'] = substr($value['comment_author'], (strpos($value['comment_author'], ".")+1));
-					$loop++;
-				}
-				break;
-
-			case 6:
-			case 7:
-				$path = e_PLUGIN."forum/e_rss.php";
-				break;
-
-			case 8:
-				if(!$this -> topicid) {
-					return FALSE;
-				}
-				$path = e_PLUGIN."forum/e_rss.php";
-				break;
-
-			/*
-			case 10:
-				$this -> limit = '9';
-				$path='';
-				$this -> contentType = "bugtracker reports";
-				$sql->db_Select("bugtrack2_bugs", "*", "bugtrack2_bugs_status=0 ORDER BY bugtrack2_bugs_datestamp LIMIT 0,".$this -> limit);
-				$tmp = $sql->db_getList();
-				$this -> rssItems = array();
-				$loop=0;
-				foreach($tmp as $value) {
-					$nick = preg_replace("/[0-9]+\./", "", $value['bugtrack2_bugs_poster']);
-					$this -> rssItems[$loop]['author'] = $nick;
-					$this -> rssItems[$loop]['title'] = $value['bugtrack2_bugs_summary'];
-					$this -> rssItems[$loop]['link'] = $e107->base_path.$PLUGINS_DIRECTORY."bugtracker2/bugtracker2.php?0.bug.".$value['bugtrack2_bugs_id'];
-					$this -> rssItems[$loop]['description'] = $value['bugtrack2_bugs_description'];
-					$loop++;
-				}
-				break;
-			*/
-
-			case 11:
-				if(!$this -> topicid) {
-					return FALSE;
-				}
-				$path = e_PLUGIN."forum/e_rss.php";
-				break;
-
-			case download:
-			case 12:
-				if($topic_id && is_numeric($topic_id)){
-					$topic = "d.download_category='".intval($topic_id)."' AND ";
-				}else{
-					$topic = "";
-				}
-				$path='';
-				$class_list = "0,251,252,253";
-                $query = "SELECT d.*, dc.* FROM #download AS d LEFT JOIN #download_category AS dc ON d.download_category = dc.download_category_id WHERE {$topic} d.download_active > 0 AND d.download_class IN (".$class_list.") ORDER BY d.download_datestamp DESC LIMIT 0,".$this -> limit;
-                $sql -> db_Select_gen($query);
-
-			 //	$sql->db_Select("download", "*", "{$topic} download_active > 0 AND download_class IN (".$class_list.") ORDER BY download_datestamp DESC LIMIT 0,".$this -> limit);
-				$tmp = $sql->db_getList();
-				$this -> rssItems = array();
-				$loop=0;
-				foreach($tmp as $value) {
-					if($value['download_author']){
-				   		$nick = preg_replace("/[0-9]+\./", "", $value['download_author']);
-						$this -> rssItems[$loop]['author'] = $nick;
-					}
-					$this -> rssItems[$loop]['author_email'] = $value['download_author_email'];
-					$this -> rssItems[$loop]['title'] = $value['download_name'];
-					$this -> rssItems[$loop]['link'] = $e107->base_path."download.php?view.".$value['download_id'];
-					$this -> rssItems[$loop]['description'] = ($rss_type == 3 ? $value['download_description'] : $value['download_description']);
-                    $this -> rssItems[$loop]['category_name'] = $value['download_category_name'];
-                    $this -> rssItems[$loop]['category_link'] = $e107->base_path."download.php?list.".$value['download_category_id'];
-					$this -> rssItems[$loop]['enc_url'] = $e107->base_path."request.php?".$value['download_id'];
-					$this -> rssItems[$loop]['enc_leng'] = $value['download_filesize'];
-					$this -> rssItems[$loop]['enc_type'] = $this->getmime($value['download_url']);
-					$this -> rssItems[$loop]['pubdate'] = $value['download_datestamp'];
-					$loop++;
-				}
-				break;
-		}
-
-
-		if(isset($path) && $path!=''){
-
-			//new rss reader from e_rss.php in plugin folder
-			if (is_readable($path)) {
-				require_once($path);
-				foreach($eplug_rss_data as $key=>$rs){
-					foreach($rs as $k=>$row){
-						$this -> rssItems[$k]['author'] = $row['author'];
-						$this -> rssItems[$k]['author_email'] = $row['author_email'];
-						$this -> rssItems[$k]['title'] = $row['title'];
-						if($row['link']){
-							if(eregi("http",$row['link'])){
-								$this -> rssItems[$k]['link'] = $row['link'];
-							}else{
-								$this -> rssItems[$k]['link'] = $e107->base_path.$PLUGINS_DIRECTORY.$row['link'];
-							}
-						}
-						$this -> rssItems[$k]['description'] = $row['description'];
-						if($row['enc_url']){
-							$this -> rssItems[$k]['enc_url'] = $e107->base_path.$PLUGINS_DIRECTORY.$row['enc_url'].$row['item_id'];
-						}
-						if($row['enc_leng']){
-							$this -> rssItems[$k]['enc_leng'] = $row['enc_leng'];
-						}
-
-						if($eplug_rss['enc_type']){
-							$this -> rssItems[$k]['enc_type'] = $this->getmime($eplug_rss['enc_type']);
-						}elseif($row['enc_type']){
-							$this -> rssItems[$k]['enc_type'] = $row['enc_type'];
-						}
-
-						$this -> rssItems[$k]['category_name'] = $row['category_name'];
-						if($row['category_link']){
-							if(eregi("http",$row['category_link'])){
-								$this -> rssItems[$k]['category_link'] = $row['category_link'];
-							}else{
-								$this -> rssItems[$k]['category_link'] = $e107->base_path.$PLUGINS_DIRECTORY.$row['category_link'];
-							}
-						}
-						if($row['datestamp']){
-							$this -> rssItems[$k]['pubdate'] = $row['datestamp'];
-						}
-						
-						if($row['custom']){
-							$this -> rssItems[$k]['custom'] = $row['custom'];
-						}
-					}
-				}
-			}
-		}
-
-	}
-
-	function buildRss($rss_title) {
-		global $sql, $pref, $tp, $e107, $PLUGINS_DIRECTORY,$topic_id ;
-		header('Content-type: application/xml', TRUE);
-
-		$rss_title = $tp->toRss($pref['sitename']." : ".$rss_title);
-        $rss_namespace = ($this->rssNamespace) ? "xmlns:".$this->rssNamespace : "";
-        $rss_custom_channel = ($this->rssCustomChannel) ? $this->rssCustomChannel : "";
-		
-	
-		$time = time();
-		switch ($this -> rssType) {
-			case 1:		// Rss 1.0
-				echo "<?xml version=\"1.0\" encoding=\"".CHARSET."\" ?>
-						<!-- generator=\"e107\" -->
-						<!-- content type=\"".$this -> contentType."\" -->
-						<rss version=\"0.92\">
-						<channel>
-						<title>".$tp->toRss($rss_title)."</title>
-						<link>".$pref['siteurl']."</link>
-						<description>".$tp->toRss($pref['sitedescription'])."</description>
-						<lastBuildDate>".$itemdate = date("r", ($time + $this -> offset))."</lastBuildDate>
-						<docs>http://backend.userland.com/rss092</docs>\n";
-
-					foreach($this -> rssItems as $value)
-					{
-
-                    	// Multi-language rss links.
-						$link 		= (e_LANQRY) ? str_replace("?","?".e_LANQRY,$value['link']) : $value['link'];
-
-						echo "
-							<item>
-							<title>".$tp->toRss($value['title'])."</title>
-							<description>".substr($tp->toRss($value['description']),0,150)."</description>
-							<author>".$value['author']."&lt;".$this->nospam($value['author_email'])."&gt;</author>
-							<link>".$link."</link>
-							</item>";
-					}
-					echo "
-						</channel>
-						</rss>";
-			break;
-
-			case 2: // rss 2.0
-				$sitebutton = (strstr(SITEBUTTON, "http:") ? SITEBUTTON : SITEURL.str_replace("../", "", e_IMAGE).SITEBUTTON);
-				echo "<?xml version=\"1.0\" encoding=\"".CHARSET."\"?>
-				<!-- generator=\"e107\" -->
-				<!-- content type=\"".$this -> contentType."\" -->
-				<rss {$rss_namespace} version=\"2.0\">
-				<channel>
-				<title>".$tp->toRss($rss_title)."</title>
-				<link>".$pref['siteurl']."</link>
-				<description>".$tp->toRss($pref['sitedescription'])."</description>\n";
-
-				echo $tp->toHtml($rss_custom_channel,FALSE)."\n"; // CDATA and toRss() must not be used for $rss_custom_channel. 
-
-				echo "<language>".CORE_LC.(defined("CORE_LC2") ? "-".CORE_LC2 : "")."</language>
-				<copyright>".preg_replace("#\<br \/\>|\n|\r#si", "", SITEDISCLAIMER)."</copyright>
-				<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>";
-				}
-
-				// 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.
-					$link 		= (e_LANQRY) ? str_replace("?","?".e_LANQRY,$value['link']) : $value['link'];
-                    $catlink	= (e_LANQRY) ? str_replace("?","?".e_LANQRY,$value['category_link']) : $value['category_link'];
-
-					echo "
-						<item>
-						<title>".$tp->toRss($value['title'])."</title>\n";
-
-					if($link){
-						echo "<link>".$link."</link>\n";
-					}
-
-					echo "<description>".$tp->toRss($value['description'],TRUE)."</description>\n";
-
-					if($value['category_name'] && $catlink){
-						echo "<category domain='".$catlink."'>".$tp -> toRss($value['category_name'])."</category>\n";
-					}
-
-					if($value['comment']){
-						//echo "<comments>".$tp->toRss($value['comment'])."</comments>\n";
-						echo "<comments>".$value['comment']."</comments>\n";
-					}
-
-					if($value['author']){
-						echo "<author>".$this->nospam($value['author_email'])." (".$value['author'].")</author>\n";
-					}
-
-					// enclosure support for podcasting etc.
-					if($value['enc_url'] && $value['enc_leng'] && $value['enc_type']){
-						echo "<enclosure url=\"".$value['enc_url']."\" length=\"".$value['enc_leng']."\" type=\"".$value['enc_type']."\"   />\n";
-					}
-
-					echo "<pubDate>".date("r", ($value['pubdate'] + $this -> offset))."</pubDate>\n";
-
-					if($link){
-						echo "<guid isPermaLink=\"true\">".$link."</guid>\n";
-					}
-					
-					if(isset($value['custom'])) // custom tags. (podcasts etc)
-					{
-						foreach($value['custom'] as $cKey => $cVal)
-						{
-							echo "<".$cKey.">".$tp->toRss($cVal)."</".$cKey.">\n";	
-						}		
-					}
-
-					echo "</item>";
-				}
-		   //		echo "<atom:link href=\"".e_SELF."?".($this -> contentType).".4.".$this -> topicId ."\" rel=\"self\" type=\"application/rss+xml\" />";
-				echo "
-				</channel>
-				</rss>";
-			break;
-
-			case 3: // rdf
-				echo "<?xml version=\"1.0\" encoding=\"".CHARSET."\" ?>
-				<!-- generator=\"e107\" -->
-				<!-- content type=\"".$this -> contentType."\" -->
-				<rdf:RDF xmlns=\"http://purl.org/rss/1.0/\" xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\" xmlns:dc=\"http://purl.org/dc/elements/1.1/\" xmlns:sy=\"http://purl.org/rss/1.0/modules/syndication/\" xmlns:admin=\"http://webns.net/mvcb/\" xmlns:content=\"http://purl.org/rss/1.0/modules/content/\">
-				<channel rdf:about=\"".$pref['siteurl']."\">
-				<title>".$tp->toRss($rss_title)."</title>
-				<link>".$pref['siteurl']."</link>
-				<description>".$tp->toRss($pref['sitedescription'])."</description>
-				<dc:language>".CORE_LC.(defined("CORE_LC2") ? "-".CORE_LC2 : "")."</dc:language>
-				<dc:date>".$this->get_iso_8601_date($time + $this -> offset). "</dc:date>
-				<dc:creator>".$this->nospam($pref['siteadminemail'])."</dc:creator>
-				<admin:generatorAgent rdf:resource=\"http://e107.org\" />
-				<admin:errorReportsTo rdf:resource=\"mailto:".$this->nospam($pref['siteadminemail'])."\" />
-				<sy:updatePeriod>hourly</sy:updatePeriod>
-				<sy:updateFrequency>1</sy:updateFrequency>
-				<sy:updateBase>2000-01-01T12:00+00:00</sy:updateBase>
-				<items>
-				<rdf:Seq>";
-
-				foreach($this -> rssItems as $value)
-				{
-
-                    // Multi-language rss links.
-					$link = (e_LANQRY) ? str_replace("?","?".e_LANQRY,$value['link']) : $value['link'];
-
-					echo "
-						<rdf:li rdf:resource=\"".$link."\" />";
-				}
-
-				echo "
-				</rdf:Seq>
-				</items>
-				</channel>";
-
-				reset($this -> rssItems);
-				unset($link);
-				foreach($this -> rssItems as $value)
-				{
-
-                    // Multi-language rss links.
-					$link = (e_LANQRY) ? str_replace("?","?".e_LANQRY,$value['link']) : $value['link'];
-
-					echo "
-						<item rdf:about=\"".$link."\">
-						<title>".$tp->toRss($value['title'])."</title>
-						<link>".$link."</link>
-						<dc:date>".$this->get_iso_8601_date($time + $this -> offset)."</dc:date>
-						<dc:creator>".$value['author']."</dc:creator>
-						<dc:subject>".$tp->toRss($value['category_name'])."</dc:subject>
-						<description>".$tp->toRss($value['description'])."</description>
-						</item>";
-				}
-				echo "
-				</rdf:RDF>";
-			break;
-
-			//new feed for atom - still in development, and not yet tested
-			case 4:
-				echo "<?xml version='1.0' encoding='".CHARSET."'?>\n
-				<feed xmlns='http://www.w3.org/2005/Atom'>\n";
-				/*
-				<feed version='0.3'
-				  xmlns='http://purl.org/atom/ns#'
-				  xmlns:dc='http://purl.org/dc/elements/1.1/'
-				  xml:lang='".CORE_LC.(defined("CORE_LC2") ? "-".CORE_LC2 : "")."'>\n";
-				  */
-
-					//required
-					echo "
-					<id>".$pref['siteurl']."</id>\n
-					<title type='text'>".$tp->toRss($rss_title)."</title>\n
-					<updated>".$this->get_iso_8601_date($time + $this -> offset)."</updated>\n";
-
-					//recommended
-					echo "
-					<author>\n
-						<name>e107</name>\n";
-						//<email></email>\n
-						echo "
-						<uri>http://e107.org/</uri>\n
-					</author>\n
-					<link rel='self' href='".$e107->base_path.$PLUGINS_DIRECTORY."rss_menu/".e_PAGE."?".e_QUERY."' />\n";
-
-					//optional
-					include(e_ADMIN."ver.php");
-					echo "
-					<category term='e107'/>\n
-					<contributor>\n
-						<name>e107</name>\n
-					</contributor>\n
-					<generator uri='http://e107.org/' version='".$e107info['e107_version']."'>e107</generator>\n";
-					//<icon>/icon.jpg</icon>\n
-					echo "
-					<logo>".(strstr(SITEBUTTON, "http:") ? SITEBUTTON : SITEURL.str_replace("../", "", e_IMAGE).SITEBUTTON)."</logo>\n
-					<rights type='html'>".$pref['siteadmin']." - ".$this->nospam($pref['siteadminemail'])."</rights>\n";
-					if($pref['sitedescription']){
-					echo "
-					<subtitle type='text'>".$pref['sitedescription']."</subtitle>\n";
-                    }
-					foreach($this -> rssItems as $value) {
-					echo "
-					<entry>\n";
-
-						//required
-						echo "
-						<id>".$value['link']."</id>\n
-						<title type='text'>".$tp->toRss($value['title'])."</title>\n
-						<updated>".$this->get_iso_8601_date($value['pubdate'] + $this -> offset)."</updated>\n";
-
-						//recommended
-                        $author = ($value['author']) ? $value['author'] : "unknown";
-
-						echo "
-						<author>\n";
-						echo "
-						<name>".$author."</name>\n";
-						echo ($value['author_email']) ? "\t\t\t\t\t\t<email>".$this->nospam($value['author_email'])."</email>\n" : "";
-						echo "</author>\n";
-						//<content>complete story here</content>\n
-						echo "
-						<link rel='alternate' type='text/html' href='".$value['link']."' />\n
-						<summary type='text'>".$tp->toRss($value['description'])."</summary>\n";
-
-						//optional
-						if($value['category_name']){
-							echo "<category term='".$tp -> toRss($value['category_name'])."'/>\n";
-						}
-						//<contributor>
-						//	<name>Jane Doe</name>
-						//</contributor>
-						echo "<published>".$this->get_iso_8601_date($value['pubdate'] + $this -> offset)."</published>\n";
-						//<source>
-						//	<id>http://example.org/</id>
-						//	<title>Fourty-Two</title>
-						//	<updated>2003-12-13T18:30:02Z</updated>
-						//	<rights>� 2005 Example, Inc.</rights>
-						//</source>
-						//<rights type='html'>&amp;copy; 2005 John Doe</rights>
-						echo "
-					</entry>\n";
-					}
-				echo "
-				</feed>\n";
-
-			break;
-		}
-	}
-
-	function getmime($file){
-		$ext = strtolower(str_replace(".","",strrchr(basename($file), ".")));
-		$mime["mp3"] = "audio/mpeg";
-		return $mime[$ext];
-	}
-
-	function get_iso_8601_date($int_date) {
-		//$int_date: current date in UNIX timestamp
-		$date_mod = date('Y-m-d\TH:i:s', $int_date);
-		$pre_timezone = date('O', $int_date);
-		$time_zone = substr($pre_timezone, 0, 3).":".substr($pre_timezone, 3, 2);
-		$date_mod .= $time_zone;
-		return $date_mod;
-	}
-
-	function nospam($text){
-		$tmp = explode("@",$text);
-		return ($tmp[0] != "") ? $tmp[0].RSS_LAN_2 : RSS_LAN_3;
-	}
-
-}
-
-?>
+<?php
+/*
++ ----------------------------------------------------------------------------+
+|     e107 website system
+|
+|     Copyright (C) 2001-2002 Steve Dunstan (jalist@e107.org)
+|     Copyright (C) 2008-2010 e107 Inc (e107.org)
+|
+|     Released under the terms and conditions of the
+|     GNU General Public License (http://gnu.org).
+|
+|     $URL: https://e107.svn.sourceforge.net/svnroot/e107/trunk/e107_0.7/e107_plugins/rss_menu/rss.php $
+|     $Revision: 12074 $
+|     $Id: rss.php 12074 2011-02-25 21:24:11Z e107coders $
+|     $Author: e107coders $
++----------------------------------------------------------------------------+
+*/
+
+/*
+Query string: content_type.rss_type.[topic id]
+1: news
+5: comments
+12: downloads (option: specify category)
+
+Plugins should use an e_rss.php file in their plugin folder
+----------------------------------------------------------------
+*/
+
+require_once("../../class2.php");
+if (!isset($pref['plug_installed']['rss_menu']))
+{
+	header('Location: '.e_BASE.'index.php');
+	exit;
+}
+
+global $tp;
+
+require_once(e_PLUGIN."rss_menu/rss_shortcodes.php");
+require_once(e_HANDLER."userclass_class.php");
+
+if (!is_object($tp->e_bb)) {
+	require_once(e_HANDLER.'bbcode_handler.php');
+	$tp->e_bb = new e_bbcode;
+}
+
+//get language file
+if (is_readable(e_PLUGIN."rss_menu/languages/".e_LANGUAGE.".php")) {
+	include_once(e_PLUGIN."rss_menu/languages/".e_LANGUAGE.".php");
+} else {
+	include_once(e_PLUGIN."rss_menu/languages/English.php");
+}
+
+//get template
+if (is_readable(THEME."rss_template.php")) {
+	require_once(THEME."rss_template.php");
+	} else {
+	require_once(e_PLUGIN."rss_menu/rss_template.php");
+}
+
+//query handler
+if (e_QUERY)
+{
+	$tmp = explode(".", e_QUERY);
+	$content_type = $tp->toDB($tmp[0]);
+	$rss_type = intval(varset($tmp[1],0));
+	$topic_id = $tp->toDB($tmp[2],'');
+}
+
+//list available rss feeds
+if (!$rss_type) 
+{
+	require_once(HEADERF);
+ 	require_once(e_PLUGIN."rss_menu/rss_template.php");
+
+	if(!$sql->db_Select("rss", "*", "`rss_class`='0' AND `rss_limit`>0 AND `rss_topicid` NOT REGEXP ('\\\*') ORDER BY `rss_name`"))
+	{
+		$ns->tablerender(LAN_ERROR, RSS_LAN_ERROR_4);
+	}
+	else
+	{
+		$text = $RSS_LIST_HEADER;
+		while($row=$sql->db_Fetch())
+		{
+			$text .= $tp -> parseTemplate($RSS_LIST_TABLE, FALSE, $rss_shortcodes);
+		}
+		$text .= $RSS_LIST_FOOTER;
+		$ns->tablerender(RSS_MENU_L2, $text);
+	}
+
+ 	require_once(FOOTERF);
+	exit;
+}
+
+//conversion table for old urls -------
+$conversion[1] = "news";
+$conversion[5] = "comments";
+$conversion[10] = "bugtracker";
+$conversion[12] = "download";
+//-------------------------------------
+
+//convert certain old urls so we can check the db entries ---------------------
+if($topic_id)
+{	//rss.php?1.2.14 (news, rss-2, cat=14)
+	if(is_numeric($content_type) && isset($conversion[$content_type]) )
+	{
+		$content_type = $conversion[$content_type];
+	}
+}
+else
+{	//rss.php?1.2 (news, rss-2) --> check = news (check conversion table)
+	if(is_numeric($content_type) && isset($conversion[$content_type]) )
+	{
+		$content_type = $conversion[$content_type];
+	}
+}
+
+$check_topic = ($topic_id ? " AND rss_topicid = '".$topic_id."' " : "");
+
+if(!$sql -> db_Select("rss", "*", "rss_class!='2' AND rss_url='".$content_type."' ".$check_topic." AND rss_limit>0 "))
+{
+	//check if wildcard present for topic_id
+	$check_topic = ($topic_id ? " AND rss_topicid = '".str_replace($topic_id, "*", $topic_id)."' " : "");
+	if(!$sql -> db_Select("rss", "*", "rss_class!='2' AND rss_url='".$content_type."' ".$check_topic." AND rss_limit>0 "))
+	{
+		require_once(HEADERF);
+		$ns->tablerender("", RSS_LAN_ERROR_1);
+		require_once(FOOTERF);
+		exit;
+	}
+	else
+	{
+		$row = $sql->db_Fetch();
+	}
+}
+else
+{
+	$row = $sql->db_Fetch();
+}
+
+//debugging
+//echo $check." - ".$content_type." - ".$rss_type." - ".$topic_id."<br />";
+//exit;
+
+// ----------------------------------------------------------------------------
+
+if($rss = new rssCreate($content_type, $rss_type, $topic_id, $row)){
+	$rss_title = ($rss->contentType ? $rss->contentType : ucfirst($content_type));
+	$rss->buildRss ($rss_title);
+}else{
+	require_once(HEADERF);
+	$ns->tablerender(RSS_LAN_ERROR_0, RSS_LAN_ERROR_1);
+	require_once(FOOTERF);
+	exit;
+}
+
+class rssCreate {
+
+	var $contentType;
+	var $rssType;
+	var $path;
+	var $parm;
+	var $rssItems;
+	var $rssQuery;
+	var $topicid;
+	var $offset;
+	var $rssNamespace;
+	var $rssCustomChannel;
+
+	function rssCreate($content_type, $rss_type, $topic_id, $row) {
+		// constructor
+		$sql_rs = new db;
+		global $tp, $sql, $e107, $PLUGINS_DIRECTORY, $pref, $rssgen;
+		$this -> path = e_PLUGIN."rss_menu/";
+		$this -> rssType = $rss_type;
+		$this -> topicid = $topic_id;
+		$this -> offset = $pref['time_offset'] * 3600;
+		$this -> limit = $row['rss_limit'];
+		$this -> contentType = $row['rss_name'];
+
+		if(!is_numeric($content_type)){
+			$path = e_PLUGIN.$row['rss_path']."/e_rss.php";
+		}
+		if(strpos($row['rss_path'],'|')!==FALSE){
+			$tmp = explode("|", $row['rss_path']);
+			$path = e_PLUGIN.$tmp[0]."/e_rss.php";
+			$this -> parm = $tmp[1];	//parm is used in e_rss.php to define which feed you need to prepare
+		}
+
+		switch ($content_type) {
+			case 'news' :
+			case 1:
+				if($topic_id && is_numeric($topic_id))
+				{
+					$topic = " AND news_category = ".intval($topic_id);
+				}
+				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 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 n.news_datestamp DESC LIMIT 0,".$this -> limit;
+				$sql->db_Select_gen($this -> rssQuery);
+				$tmp = $sql->db_getList();
+				
+				$this -> rssItems = array();
+				$loop=0;
+				foreach($tmp as $value) {
+					$this -> rssItems[$loop]['title'] = $value['news_title'];
+					$this -> rssItems[$loop]['link'] = "http://".$_SERVER['HTTP_HOST'].e_HTTP."news.php?item.".$value['news_id'].".".$value['news_category'];
+                    if($value['news_summary'])
+                    {
+                        	$this -> rssItems[$loop]['description'] = $value['news_summary'];
+							$this -> rssItems[$loop]['content_encoded'] = ($value['news_body']."<br />".$value['news_extended']);
+					}
+					else
+					{
+						$this -> rssItems[$loop]['description'] = ($value['news_body']."<br />".$value['news_extended']);
+						$this -> rssItems[$loop]['content_encoded'] = ($value['news_body']."<br />".$value['news_extended']);
+                    }
+					
+					if($value['news_thumbnail'])
+					{
+						$this -> rssItems[$loop]['media_content_url'][] = "http://".$_SERVER['HTTP_HOST'].e_HTTP.e_IMAGE."newspost_images/".$news_item['news_thumbnail'];
+						$this -> rssItems[$loop]['media_content_type'][] = "image";
+					}
+					
+					$this -> rssItems[$loop]['author'] = $value['user_name'];
+                    $this -> rssItems[$loop]['author_email'] = $value['user_email'];
+
+					$this -> rssItems[$loop]['category_name'] = $tp->toHTML($value['category_name'],TRUE,'defs');
+                    $this -> rssItems[$loop]['category_link'] = $e107->base_path."news.php?cat.".$value['news_category'];
+
+					if($value['news_allow_comments'] && $pref['comments_disabled'] != 1){
+						$this -> rssItems[$loop]['comment'] = "http://".$_SERVER['HTTP_HOST'].e_HTTP."comment.php?comment.news.".$value['news_id'];
+                    }
+					$this -> rssItems[$loop]['pubdate'] = $value['news_datestamp'];
+
+					$loop++;
+				}
+				break;
+			case 2:
+				$path='';
+				$this -> contentType = "articles";
+				break;
+			case 3:
+				$path='';
+				$this -> contentType = "reviews";
+				break;
+			case 4:
+				$path='';
+				$this -> contentType = "content";
+				break;
+			case 'comments' :
+			case 5:
+				$path='';
+				$this -> rssQuery = "SELECT * FROM `#comments` WHERE `comment_blocked` = 0 ORDER BY `comment_datestamp` DESC LIMIT 0,".$this -> limit;
+				$sql->db_Select_gen($this -> rssQuery);
+				$tmp = $sql->db_getList();
+				$this -> rssItems = array();
+				$loop=0;
+				foreach($tmp as $value) 
+				{
+					$this -> rssItems[$loop]['title'] = $value['comment_subject'];
+					$this -> rssItems[$loop]['pubdate'] = $value['comment_datestamp'];
+
+					switch ($value['comment_type']) 
+					{
+						case 0 :
+						case 'news' :
+							$this -> rssItems[$loop]['link'] = "http://".$_SERVER['HTTP_HOST'].e_HTTP."comment.php?comment.news.".$value['comment_item_id'];
+							break;
+						case 2 :
+						case 'download' :
+							$this -> rssItems[$loop]['link'] = "http://".$_SERVER['HTTP_HOST'].e_HTTP."comment.php?comment.download.".$value['comment_item_id'];
+							break;
+						case 4:
+						case 'poll' :
+							$this -> rssItems[$loop]['link'] = "http://".$_SERVER['HTTP_HOST'].e_HTTP."comment.php?comment.poll.".$value['comment_item_id'];
+							break;
+					}
+
+					$this -> rssItems[$loop]['description'] = $value['comment_comment'];
+					$this -> rssItems[$loop]['author'] = substr($value['comment_author'], (strpos($value['comment_author'], ".")+1));
+					$loop++;
+				}
+				break;
+
+			case 6:
+			case 7:
+				$path = e_PLUGIN."forum/e_rss.php";
+				break;
+
+			case 8:
+				if(!$this -> topicid) {
+					return FALSE;
+				}
+				$path = e_PLUGIN."forum/e_rss.php";
+				break;
+
+			/*
+			case 10:
+				$this -> limit = '9';
+				$path='';
+				$this -> contentType = "bugtracker reports";
+				$sql->db_Select("bugtrack2_bugs", "*", "bugtrack2_bugs_status=0 ORDER BY bugtrack2_bugs_datestamp LIMIT 0,".$this -> limit);
+				$tmp = $sql->db_getList();
+				$this -> rssItems = array();
+				$loop=0;
+				foreach($tmp as $value) {
+					$nick = preg_replace("/[0-9]+\./", "", $value['bugtrack2_bugs_poster']);
+					$this -> rssItems[$loop]['author'] = $nick;
+					$this -> rssItems[$loop]['title'] = $value['bugtrack2_bugs_summary'];
+					$this -> rssItems[$loop]['link'] = $e107->base_path.$PLUGINS_DIRECTORY."bugtracker2/bugtracker2.php?0.bug.".$value['bugtrack2_bugs_id'];
+					$this -> rssItems[$loop]['description'] = $value['bugtrack2_bugs_description'];
+					$loop++;
+				}
+				break;
+			*/
+
+			case 11:
+				if(!$this -> topicid) {
+					return FALSE;
+				}
+				$path = e_PLUGIN."forum/e_rss.php";
+				break;
+
+			case download:
+			case 12:
+				if($topic_id && is_numeric($topic_id)){
+					$topic = "d.download_category='".intval($topic_id)."' AND ";
+				}else{
+					$topic = "";
+				}
+				$path='';
+				$class_list = "0,251,252,253";
+                $query = "SELECT d.*, dc.* FROM #download AS d LEFT JOIN #download_category AS dc ON d.download_category = dc.download_category_id WHERE {$topic} d.download_active > 0 AND d.download_class IN (".$class_list.") ORDER BY d.download_datestamp DESC LIMIT 0,".$this -> limit;
+                $sql -> db_Select_gen($query);
+
+			 //	$sql->db_Select("download", "*", "{$topic} download_active > 0 AND download_class IN (".$class_list.") ORDER BY download_datestamp DESC LIMIT 0,".$this -> limit);
+				$tmp = $sql->db_getList();
+				$this -> rssItems = array();
+				$loop=0;
+				foreach($tmp as $value) {
+					if($value['download_author']){
+				   		$nick = preg_replace("/[0-9]+\./", "", $value['download_author']);
+						$this -> rssItems[$loop]['author'] = $nick;
+					}
+					$this -> rssItems[$loop]['author_email'] = $value['download_author_email'];
+					$this -> rssItems[$loop]['title'] = $value['download_name'];
+					$this -> rssItems[$loop]['link'] = $e107->base_path."download.php?view.".$value['download_id'];
+					$this -> rssItems[$loop]['description'] = ($rss_type == 3 ? $value['download_description'] : $value['download_description']);
+                    $this -> rssItems[$loop]['category_name'] = $value['download_category_name'];
+                    $this -> rssItems[$loop]['category_link'] = $e107->base_path."download.php?list.".$value['download_category_id'];
+					$this -> rssItems[$loop]['enc_url'] = $e107->base_path."request.php?".$value['download_id'];
+					$this -> rssItems[$loop]['enc_leng'] = $value['download_filesize'];
+					$this -> rssItems[$loop]['enc_type'] = $this->getmime($value['download_url']);
+					$this -> rssItems[$loop]['pubdate'] = $value['download_datestamp'];
+					$loop++;
+				}
+				break;
+		}
+
+
+		if(isset($path) && $path!=''){
+
+			//new rss reader from e_rss.php in plugin folder
+			if (is_readable($path)) {
+				require_once($path);
+				foreach($eplug_rss_data as $key=>$rs){
+					foreach($rs as $k=>$row){
+						$this -> rssItems[$k]['author'] = $row['author'];
+						$this -> rssItems[$k]['author_email'] = $row['author_email'];
+						$this -> rssItems[$k]['title'] = $row['title'];
+						if($row['link']){
+							if(eregi("http",$row['link'])){
+								$this -> rssItems[$k]['link'] = $row['link'];
+							}else{
+								$this -> rssItems[$k]['link'] = $e107->base_path.$PLUGINS_DIRECTORY.$row['link'];
+							}
+						}
+						$this -> rssItems[$k]['description'] = $row['description'];
+						if($row['enc_url']){
+							$this -> rssItems[$k]['enc_url'] = $e107->base_path.$PLUGINS_DIRECTORY.$row['enc_url'].$row['item_id'];
+						}
+						if($row['enc_leng']){
+							$this -> rssItems[$k]['enc_leng'] = $row['enc_leng'];
+						}
+
+						if($eplug_rss['enc_type']){
+							$this -> rssItems[$k]['enc_type'] = $this->getmime($eplug_rss['enc_type']);
+						}elseif($row['enc_type']){
+							$this -> rssItems[$k]['enc_type'] = $row['enc_type'];
+						}
+
+						$this -> rssItems[$k]['category_name'] = $row['category_name'];
+						if($row['category_link']){
+							if(eregi("http",$row['category_link'])){
+								$this -> rssItems[$k]['category_link'] = $row['category_link'];
+							}else{
+								$this -> rssItems[$k]['category_link'] = $e107->base_path.$PLUGINS_DIRECTORY.$row['category_link'];
+							}
+						}
+						if($row['datestamp']){
+							$this -> rssItems[$k]['pubdate'] = $row['datestamp'];
+						}
+						
+						if($row['custom']){
+							$this -> rssItems[$k]['custom'] = $row['custom'];
+						}
+					}
+				}
+			}
+		}
+
+	}
+
+	function buildRss($rss_title) {
+		global $sql, $pref, $tp, $e107, $PLUGINS_DIRECTORY,$topic_id,$content_type ;
+		header('Content-type: application/xml', TRUE);
+
+		$rss_title = $tp->toRss($tp->toHtml($pref['sitename'],'','defs')." : ".$tp->toHtml($rss_title,'','defs'));
+        $rss_namespace = ($this->rssNamespace) ? "xmlns:".$this->rssNamespace : "";
+        $rss_custom_channel = ($this->rssCustomChannel) ? $this->rssCustomChannel : "";
+		
+	
+		$time = time();
+		switch ($this -> rssType) {
+			case 1:		// Rss 1.0
+				echo "<?xml version=\"1.0\" encoding=\"".CHARSET."\" ?>
+						<!-- generator=\"e107\" -->
+						<!-- content type=\"".$this -> contentType."\" -->
+						<rss version=\"0.92\">
+						<channel>
+						<title>".$tp->toRss($rss_title)."</title>
+						<link>".$pref['siteurl']."</link>
+						<description>".$tp->toRss($pref['sitedescription'])."</description>
+						<lastBuildDate>".$itemdate = date("r", ($time + $this -> offset))."</lastBuildDate>
+						<docs>http://backend.userland.com/rss092</docs>\n";
+
+					foreach($this -> rssItems as $value)
+					{
+
+                    	// Multi-language rss links.
+						$link 		= (e_LANQRY) ? str_replace("?","?".e_LANQRY,$value['link']) : $value['link'];
+
+						echo "
+							<item>
+							<title>".$tp->toRss($value['title'])."</title>
+							<description>".substr($tp->toRss($value['description']),0,160)."</description>
+							<author>".$this->nospam($value['author_email'])." (".$value['author'].")</author>
+							<link>".$link."</link>
+							</item>";
+					}
+					echo "
+						</channel>
+						</rss>";
+			break;
+
+			case 2: // rss 2.0
+				$sitebutton = (strstr(SITEBUTTON, "http:") ? SITEBUTTON : SITEURL.str_replace("../", "", e_IMAGE).SITEBUTTON);
+				echo "<?xml version=\"1.0\" encoding=\"".CHARSET."\"?>
+				<!-- generator=\"e107\" -->
+				<!-- content type=\"".$this -> contentType."\" -->
+				<rss {$rss_namespace} version=\"2.0\" 
+					xmlns:content=\"http://purl.org/rss/1.0/modules/content/\" 
+					xmlns:atom=\"http://www.w3.org/2005/Atom\"
+					xmlns:dc=\"http://purl.org/dc/elements/1.1/\"
+					xmlns:sy=\"http://purl.org/rss/1.0/modules/syndication/\"
+
+				>
+				<channel>
+				<title>".$tp->toRss($rss_title)."</title>
+				<link>".$pref['siteurl']."</link>
+				<description>".$tp->toRss($pref['sitedescription'])."</description>\n";
+
+				echo $tp->toHtml($rss_custom_channel,FALSE)."\n"; // CDATA and toRss() must not be used for $rss_custom_channel. 
+
+				echo "<language>".CORE_LC.(defined("CORE_LC2") ? "-".CORE_LC2 : "")."</language>
+				<copyright>".$tp->toRss(SITEDISCLAIMER)."</copyright>
+				<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>
+				<sy:updatePeriod>hourly</sy:updatePeriod>
+				<sy:updateFrequency>1</sy:updateFrequency>
+
+				<ttl>60</ttl>\n";
+				
+				echo "<atom:link href=\"".e_SELF."?".e_QUERY."\" rel=\"self\" type=\"application/rss+xml\" />\n";
+
+				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>\n";
+				}
+
+				// 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.
+					$link 		= (e_LANQRY) ? str_replace("?","?".e_LANQRY,$value['link']) : $value['link'];
+                    $catlink	= (e_LANQRY) ? str_replace("?","?".e_LANQRY,$value['category_link']) : $value['category_link'];
+
+					echo "<item>\n";
+					echo "<title>".$tp->toRss($value['title'])."</title>\n";
+
+					if($link){
+						echo "<link>".$link."</link>\n";
+					}
+
+					echo "<description>".$tp->toRss($value['description'],TRUE)."</description>\n";
+					
+					if($value['content_encoded'])
+					{
+						echo "<content:encoded>".$tp->toRss($value['content_encoded'],TRUE)."</content:encoded>\n";	
+					}
+					
+					/*if($value['media_content_url'])
+					{
+						foreach($value['media_content_url'] as $k=>$mcu)
+						{
+							echo "<media:content url=\"".$tp->toRss($mcu)."\" medium=\"".$value['media_content_type'][$k]."\">";	
+						}
+					}*/
+					
+					
+					if($value['category_name'] && $catlink){
+						echo "<category domain='".$catlink."'>".$tp -> toRss($value['category_name'])."</category>\n";
+					}
+
+					if($value['comment']){
+						//echo "<comments>".$tp->toRss($value['comment'])."</comments>\n";
+						echo "<comments>".$value['comment']."</comments>\n";
+					}
+
+					if($value['author'])
+					{
+						echo "<dc:creator>".$value['author']."</dc:creator>\n"; // correct tag for author without email. 
+					}
+
+					// enclosure support for podcasting etc.
+					if($value['enc_url'] && $value['enc_leng'] && $value['enc_type']){
+						echo "<enclosure url=\"".$value['enc_url']."\" length=\"".$value['enc_leng']."\" type=\"".$value['enc_type']."\"   />\n";
+					}
+
+					echo "<pubDate>".date("r", ($value['pubdate'] + $this -> offset))."</pubDate>\n";
+
+					if($link){
+						echo "<guid isPermaLink=\"true\">".$link."</guid>\n";
+					}
+					
+					if(isset($value['custom'])) // custom tags. (podcasts etc)
+					{
+						foreach($value['custom'] as $cKey => $cVal)
+						{
+							echo "<".$cKey.">".$tp->toRss($cVal)."</".$cKey.">\n";	
+						}		
+					}
+
+					echo "</item>\n\n";
+				}
+		   //		echo "<atom:link href=\"".e_SELF."?".($this -> contentType).".4.".$this -> topicId ."\" rel=\"self\" type=\"application/rss+xml\" />";
+				echo "
+				</channel>
+				</rss>";
+			break;
+
+			case 3: // rdf
+				echo "<?xml version=\"1.0\" encoding=\"".CHARSET."\" ?>
+				<!-- generator=\"e107\" -->
+				<!-- content type=\"".$this -> contentType."\" -->
+				<rdf:RDF xmlns=\"http://purl.org/rss/1.0/\" xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\" xmlns:dc=\"http://purl.org/dc/elements/1.1/\" xmlns:sy=\"http://purl.org/rss/1.0/modules/syndication/\" xmlns:admin=\"http://webns.net/mvcb/\" xmlns:content=\"http://purl.org/rss/1.0/modules/content/\">
+				<channel rdf:about=\"".$pref['siteurl']."\">
+				<title>".$tp->toRss($rss_title)."</title>
+				<link>".$pref['siteurl']."</link>
+				<description>".$tp->toRss($pref['sitedescription'])."</description>
+				<dc:language>".CORE_LC.(defined("CORE_LC2") ? "-".CORE_LC2 : "")."</dc:language>
+				<dc:date>".$this->get_iso_8601_date($time + $this -> offset). "</dc:date>
+				<dc:creator>".$this->nospam($pref['siteadminemail'])."</dc:creator>
+				<admin:generatorAgent rdf:resource=\"http://e107.org\" />
+				<admin:errorReportsTo rdf:resource=\"mailto:".$this->nospam($pref['siteadminemail'])."\" />
+				<sy:updatePeriod>hourly</sy:updatePeriod>
+				<sy:updateFrequency>1</sy:updateFrequency>
+				<sy:updateBase>2000-01-01T12:00+00:00</sy:updateBase>
+				<items>
+				<rdf:Seq>";
+
+				foreach($this -> rssItems as $value)
+				{
+
+                    // Multi-language rss links.
+					$link = (e_LANQRY) ? str_replace("?","?".e_LANQRY,$value['link']) : $value['link'];
+
+					echo "
+						<rdf:li rdf:resource=\"".$link."\" />";
+				}
+
+				echo "
+				</rdf:Seq>
+				</items>
+				</channel>";
+
+				reset($this -> rssItems);
+				unset($link);
+				foreach($this -> rssItems as $value)
+				{
+
+                    // Multi-language rss links.
+					$link = (e_LANQRY) ? str_replace("?","?".e_LANQRY,$value['link']) : $value['link'];
+
+					echo "
+						<item rdf:about=\"".$link."\">
+						<title>".$tp->toRss($value['title'])."</title>
+						<link>".$link."</link>
+						<dc:date>".$this->get_iso_8601_date($time + $this -> offset)."</dc:date>
+						<dc:creator>".$value['author']."</dc:creator>
+						<dc:subject>".$tp->toRss($value['category_name'])."</dc:subject>
+						<description>".$tp->toRss($value['description'])."</description>
+						</item>";
+				}
+				echo "
+				</rdf:RDF>";
+			break;
+
+			//new feed for atom - still in development, and not yet tested
+			case 4:
+				echo "<?xml version='1.0' encoding='".CHARSET."'?>\n
+				<feed xmlns='http://www.w3.org/2005/Atom'>\n";
+				/*
+				<feed version='0.3'
+				  xmlns='http://purl.org/atom/ns#'
+				  xmlns:dc='http://purl.org/dc/elements/1.1/'
+				  xml:lang='".CORE_LC.(defined("CORE_LC2") ? "-".CORE_LC2 : "")."'>\n";
+				  */
+
+					//required
+					echo "
+					<id>".$pref['siteurl']."</id>\n
+					<title type='text'>".$tp->toRss($rss_title)."</title>\n
+					<updated>".$this->get_iso_8601_date($time + $this -> offset)."</updated>\n";
+
+					//recommended
+					echo "
+					<author>\n
+						<name>e107</name>\n";
+						//<email></email>\n
+						echo "
+						<uri>http://e107.org/</uri>\n
+					</author>\n
+					<link rel='self' href='".$e107->base_path.$PLUGINS_DIRECTORY."rss_menu/".e_PAGE."?".e_QUERY."' />\n";
+
+					//optional
+					include(e_ADMIN."ver.php");
+					echo "
+					<category term='e107'/>\n
+					<contributor>\n
+						<name>e107</name>\n
+					</contributor>\n
+					<generator uri='http://e107.org/' version='".$e107info['e107_version']."'>e107</generator>\n";
+					//<icon>/icon.jpg</icon>\n
+					echo "
+					<logo>".(strstr(SITEBUTTON, "http:") ? SITEBUTTON : SITEURL.str_replace("../", "", e_IMAGE).SITEBUTTON)."</logo>\n
+					<rights type='html'>".$pref['siteadmin']." - ".$this->nospam($pref['siteadminemail'])."</rights>\n";
+					if($pref['sitedescription']){
+					echo "
+					<subtitle type='text'>".$pref['sitedescription']."</subtitle>\n";
+                    }
+					foreach($this -> rssItems as $value) {
+					echo "
+					<entry>\n";
+
+						//required
+						echo "
+						<id>".$value['link']."</id>\n
+						<title type='text'>".$tp->toRss($value['title'])."</title>\n
+						<updated>".$this->get_iso_8601_date($value['pubdate'] + $this -> offset)."</updated>\n";
+
+						//recommended
+                        $author = ($value['author']) ? $value['author'] : "unknown";
+
+						echo "
+						<author>\n";
+						echo "
+						<name>".$author."</name>\n";
+						echo ($value['author_email']) ? "\t\t\t\t\t\t<email>".$this->nospam($value['author_email'])."</email>\n" : "";
+						echo "</author>\n";
+						//<content>complete story here</content>\n
+						echo "
+						<link rel='alternate' type='text/html' href='".$value['link']."' />\n
+						<summary type='text'>".strip_tags($tp->toRss($value['description'],FALSE))."</summary>\n";
+
+						//optional
+						if($value['category_name']){
+							echo "<category term='".$tp -> toRss($value['category_name'])."'/>\n";
+						}
+						//<contributor>
+						//	<name>Jane Doe</name>
+						//</contributor>
+						echo "<published>".$this->get_iso_8601_date($value['pubdate'] + $this -> offset)."</published>\n";
+						//<source>
+						//	<id>http://example.org/</id>
+						//	<title>Fourty-Two</title>
+						//	<updated>2003-12-13T18:30:02Z</updated>
+						//	<rights>� 2005 Example, Inc.</rights>
+						//</source>
+						//<rights type='html'>&amp;copy; 2005 John Doe</rights>
+						echo "
+					</entry>\n";
+					}
+				echo "
+				</feed>\n";
+
+			break;
+		}
+	}
+
+	function getmime($file){
+		$ext = strtolower(str_replace(".","",strrchr(basename($file), ".")));
+		$mime["mp3"] = "audio/mpeg";
+		return $mime[$ext];
+	}
+
+	function get_iso_8601_date($int_date) {
+		//$int_date: current date in UNIX timestamp
+		$date_mod = date('Y-m-d\TH:i:s', $int_date);
+		$pre_timezone = date('O', $int_date);
+		$time_zone = substr($pre_timezone, 0, 3).":".substr($pre_timezone, 3, 2);
+		$date_mod .= $time_zone;
+		return $date_mod;
+	}
+
+	function nospam($text){
+		$tmp = explode("@",$text);
+		return ($tmp[0] != "") ? $tmp[0].RSS_LAN_2 : RSS_LAN_3;
+	}
+
+}
+
+?>
diff -x .svn -aruN 0.7.24.src/e107_plugins/rss_menu/rss_shortcodes.php 0.7.26.src/e107_plugins/rss_menu/rss_shortcodes.php
--- 0.7.24.src/e107_plugins/rss_menu/rss_shortcodes.php	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_plugins/rss_menu/rss_shortcodes.php	2011-09-02 07:34:29.000000000 -0500
@@ -1,5 +1,5 @@
 <?php
-// $Id: rss_shortcodes.php 11346 2010-02-17 18:56:14Z secretr $
+// $Id: rss_shortcodes.php 12342 2011-09-02 12:34:53Z secretr $
 if (!defined('e107_INIT')) { exit; }   
 
 include_once(e_HANDLER.'shortcode_handler.php');
@@ -9,7 +9,7 @@
 SC_BEGIN RSS_FEED
 global $row, $tp;
 $url2 = e_PLUGIN."rss_menu/rss.php?".e_LANQRY.$tp->toHTML($row['rss_url'], TRUE, 'constants').".2".($row['rss_topicid'] ? ".".$row['rss_topicid'] : '');
-return "<a href='".$url2."'>".$tp->toHTML($row['rss_name'], TRUE)."</a>";
+return "<a href='".$url2."'>".$tp->toHTML($row['rss_name'], TRUE,'defs')."</a>";
 SC_END
 
 SC_BEGIN RSS_ICON
@@ -25,16 +25,16 @@
 
 SC_BEGIN RSS_TYPES
 global $row, $tp;
-$url1 = e_PLUGIN."rss_menu/rss.php?".e_LANQRY.$tp->toHTML($row['rss_url'], TRUE, 'constants').".1".($row['rss_topicid'] ? ".".$row['rss_topicid'] : '');
-$url2 = e_PLUGIN."rss_menu/rss.php?".e_LANQRY.$tp->toHTML($row['rss_url'], TRUE, 'constants').".2".($row['rss_topicid'] ? ".".$row['rss_topicid'] : '');
-$url3 = e_PLUGIN."rss_menu/rss.php?".e_LANQRY.$tp->toHTML($row['rss_url'], TRUE, 'constants').".3".($row['rss_topicid'] ? ".".$row['rss_topicid'] : '');
-$url4 = e_PLUGIN."rss_menu/rss.php?".e_LANQRY.$tp->toHTML($row['rss_url'], TRUE, 'constants').".4".($row['rss_topicid'] ? ".".$row['rss_topicid'] : '');
+$url1 = e_PLUGIN_ABS."rss_menu/rss.php?".e_LANQRY.$tp->toHTML($row['rss_url'], TRUE, 'constants').".1".($row['rss_topicid'] ? ".".$row['rss_topicid'] : '');
+$url2 = e_PLUGIN_ABS."rss_menu/rss.php?".e_LANQRY.$tp->toHTML($row['rss_url'], TRUE, 'constants').".2".($row['rss_topicid'] ? ".".$row['rss_topicid'] : '');
+$url3 = e_PLUGIN_ABS."rss_menu/rss.php?".e_LANQRY.$tp->toHTML($row['rss_url'], TRUE, 'constants').".3".($row['rss_topicid'] ? ".".$row['rss_topicid'] : '');
+$url4 = e_PLUGIN_ABS."rss_menu/rss.php?".e_LANQRY.$tp->toHTML($row['rss_url'], TRUE, 'constants').".4".($row['rss_topicid'] ? ".".$row['rss_topicid'] : '');
 
 $text = "
-<a href='".$url1."'><img src='".e_PLUGIN_ABS."rss_menu/images/rss1.png' alt='RSS 0.92' /></a>
-<a href='".$url2."'><img src='".e_PLUGIN_ABS."rss_menu/images/rss2.png' alt='RSS 2.0' /></a>
-<a href='".$url3."'><img src='".e_PLUGIN_ABS."rss_menu/images/rss3.png' alt='RDF' /></a>
-<a href='".$url4."'><img src='".e_PLUGIN_ABS."rss_menu/images/rss4.png' alt='ATOM' /></a>
+<a href='".$url1."' class='rss'><img src='".e_PLUGIN_ABS."rss_menu/images/rss1.png' class='rss-img' alt='RSS 0.92' /></a>
+<a href='".$url2."' class='rss'><img src='".e_PLUGIN_ABS."rss_menu/images/rss2.png' class='rss-img' alt='RSS 2.0' /></a>
+<a href='".$url3."' class='rss'><img src='".e_PLUGIN_ABS."rss_menu/images/rss3.png' class='rss-img' alt='RDF' /></a>
+<a href='".$url4."' class='rss'><img src='".e_PLUGIN_ABS."rss_menu/images/rss4.png' class='rss-img' alt='ATOM' /></a>
 ";
 return $text;
 SC_END
diff -x .svn -aruN 0.7.24.src/e107_plugins/rss_menu/rss_sql.php 0.7.26.src/e107_plugins/rss_menu/rss_sql.php
--- 0.7.24.src/e107_plugins/rss_menu/rss_sql.php	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_plugins/rss_menu/rss_sql.php	2011-03-11 12:49:32.000000000 -0600
@@ -9,4 +9,4 @@
 	rss_class tinyint(1) unsigned NOT NULL default '0',
 	rss_limit tinyint(3) unsigned NOT NULL default '0',
 	PRIMARY KEY  (rss_id)
-) TYPE=MyISAM;
+) ENGINE=MyISAM;
diff -x .svn -aruN 0.7.24.src/e107_plugins/trackback/plugin.php 0.7.26.src/e107_plugins/trackback/plugin.php
--- 0.7.24.src/e107_plugins/trackback/plugin.php	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_plugins/trackback/plugin.php	2011-03-11 12:49:32.000000000 -0600
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $URL: https://e107.svn.sourceforge.net/svnroot/e107/trunk/e107_0.7/e107_plugins/trackback/plugin.php $
-|     $Revision: 11678 $
-|     $Id: plugin.php 11678 2010-08-22 00:43:45Z e107coders $
-|     $Author: e107coders $
+|     $Revision: 12092 $
+|     $Id: plugin.php 12092 2011-03-11 18:49:56Z e107steved $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 
@@ -67,7 +67,7 @@
   trackback_blogname varchar(150) NOT NULL default '',
   PRIMARY KEY  (trackback_id),
   KEY trackback_pid (trackback_pid)
-) TYPE=MyISAM;");
+) ENGINE=MyISAM;");
 
 // Create a link in main menu (yes=TRUE, no=FALSE) -------------------------------------------------------------
 $eplug_link = FALSE;
diff -x .svn -aruN 0.7.24.src/e107_plugins/trackback/trackback.php 0.7.26.src/e107_plugins/trackback/trackback.php
--- 0.7.24.src/e107_plugins/trackback/trackback.php	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_plugins/trackback/trackback.php	2011-05-19 15:19:05.000000000 -0500
@@ -11,12 +11,19 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $URL: https://e107.svn.sourceforge.net/svnroot/e107/trunk/e107_0.7/e107_plugins/trackback/trackback.php $
-|     $Revision: 11678 $
-|     $Id: trackback.php 11678 2010-08-22 00:43:45Z e107coders $
-|     $Author: e107coders $
+|     $Revision: 12222 $
+|     $Id: trackback.php 12222 2011-05-19 20:19:29Z e107steved $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 require_once("../../class2.php");
+
+if (!isset($pref['plug_installed']['trackback']))
+{
+	header('location:'.e_BASE.'index.php');
+	exit;
+}
+
 header('Content-Type: text/xml');
 include(e_PLUGIN."trackback/trackbackClass.php");
 $trackback = trackbackClass :: respondTrackback();
diff -x .svn -aruN 0.7.24.src/e107_plugins/tree_menu/tree_menu.php 0.7.26.src/e107_plugins/tree_menu/tree_menu.php
--- 0.7.24.src/e107_plugins/tree_menu/tree_menu.php	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_plugins/tree_menu/tree_menu.php	2011-09-02 07:50:11.000000000 -0500
@@ -10,9 +10,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $URL: https://e107.svn.sourceforge.net/svnroot/e107/trunk/e107_0.7/e107_plugins/tree_menu/tree_menu.php $
-|     $Revision: 11678 $
-|     $Id: tree_menu.php 11678 2010-08-22 00:43:45Z e107coders $
-|     $Author: e107coders $
+|     $Revision: 12344 $
+|     $Id: tree_menu.php 12344 2011-09-02 12:50:35Z secretr $
+|     $Author: secretr $
 +----------------------------------------------------------------------------+
 */
 
@@ -127,9 +127,9 @@
 function setlink($link_name, $link_url, $link_open, $link_description) 
 {
 	global $tp;
-	if (!strstr($link_url, "http:") && !strstr($link_url, "void") && strpos($link_url, "mailto:") !== 0) 
+	if (strpos($link_url, '://') === FALSE && strpos($link_url, 'mailto:') !== 0 && !strstr($link_url, "void")) 
 	{
-		$link_url = e_BASE.$link_url;
+		$link_url = SITEURL.$link_url;
 	}
 	$link_url =	$tp->replaceConstants($link_url, $nonrelative = TRUE, $all = false);
     $href = " href='".$link_url."'";
diff -x .svn -aruN 0.7.24.src/e107_themes/jayya/admin_template.php 0.7.26.src/e107_themes/jayya/admin_template.php
--- 0.7.24.src/e107_themes/jayya/admin_template.php	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_themes/jayya/admin_template.php	2010-09-30 16:42:46.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $URL: https://e107.svn.sourceforge.net/svnroot/e107/trunk/e107_0.7/e107_themes/jayya/admin_template.php $
-|     $Revision: 11703 $
-|     $Id: admin_template.php 11703 2010-08-25 12:12:44Z secretr $
-|     $Author: secretr $
+|     $Revision: 11836 $
+|     $Id: admin_template.php 11836 2010-09-30 21:43:10Z e107coders $
+|     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
 
@@ -88,7 +88,7 @@
     <tr>
     <td>
     {SETSTYLE=leftmenu}
-	".(e_PAGE != 'admin.php' ? '{ADMIN_UPDATE} ' : '')."
+	{ADMIN_UPDATE=notadminpanel}
     {ADMIN_LANG}
     {ADMIN_PWORD}
     {ADMIN_MSG}
@@ -116,7 +116,9 @@
     </td>";
 }
 $ADMIN_HEADER .= "
+
 <td class='default_menu'>
+{ADMIN_UPDATE=adminpanel}
 {SETSTYLE=default}
 ";
 
diff -x .svn -aruN 0.7.24.src/e107_themes/khatru/style.css 0.7.26.src/e107_themes/khatru/style.css
--- 0.7.24.src/e107_themes/khatru/style.css	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_themes/khatru/style.css	2010-09-28 14:29:32.000000000 -0500
@@ -1,481 +1,481 @@
-
-body {
-	background: #ffffff url(images/background.png) no-repeat; text-align: left; margin: 12px;
-	font: 7pt Verdana, Tahoma, Arial, Helvetica, sans-serif;
-	margin: 5px;
-	padding: 5px;
-}
-
-/* Header / logo ... */
-#header {
-	height: 124px;
-	width: 100%;
-	background: url(images/logo2.png) repeat-x;
-	float: left;
-}
-
-#logo1 {
-	position: absolute;
-	left:10px;
-	top:10px;
-	width: 192px;
-	height: 124px;
-	background: url(images/logo1.png) no-repeat;
-}
-
-#headerr {
-	position: absolute;
-	right:10px;
-	top:10px;
-	height: 124px;
-	width: 8px;
-	background-repeat: no-repeat;
-	background: url(images/logo3.png) no-repeat;
-}
-
-#banner {
-	position: absolute;
-	right:26px;
-	top:40px;
-}
-
-/* end */
-
-/* main layout ... */
-
-#mainbox {
-	width: 100%;
-	margin: 0; padding: 0;
-}
-
-
-#leftcontent {
-	position: absolute;
-	top: 136px;
-	left: 10px;
-	width: 18%;
-	margin:0; padding:0;
-	font: 10px verdana, tahoma, arial, helvetica, sans-serif;
-}
-#rightcontent {
-	position: absolute;
-	top: 136px;
-	right: 10px;
-	width: 18%;
-	margin:0; padding:0;
-	font: 10px verdana, tahoma, arial, helvetica, sans-serif;
-
-}
-
-#centercontent {
-	font: 9px Verdana, Tahoma, Arial, Helvetica, sans-serif;
-	margin-left: 20%;
-	width: 60%;
-}
-
-#footer {
-	text-align: center;
-	
-	font: 9px tahoma, verdana, arial, helvetica, sans-serif;
-	color:#5d6e75;
-}
-
-.clear {
-	clear: both;
-}
-
-
-
-
-
-
-
-.dcaption {
-    width: 100%;
-}
-
-.dcaption .left { background: url('images/topleft.png') no-repeat; float: left; height: 26px; width: 9px; margin-right: -3px; }
-.dcaption .right { background: url('images/topright.png') no-repeat; float: right; height: 26px; width: 9px; margin-left: -3px; }
-.dcaption .center {background-image: url('images/top.png'); color: #111; font: 10px Verdana, Tahoma, Arial, Helvetica, sans-serif; height: 26px; line-height: 26px; }
-
-.dbody {
-    width: 100%;
-}
-
-.dbody .leftwrapper {
-	margin:0; padding:0;
-	background: url("images/left.png") left repeat-y;
-}
-.dbody .rightwrapper {
-	margin:0; padding:0;
-	background: url("images/right.png") right repeat-y;
-}
-.dbody .leftcontent {
-	float:left;
-	width:9px;
-	margin:0; padding:0;
-}
-.dbody .rightcontent {
-	float:right;
-	width:9px;
-	margin:0; padding:0;
-}
-.dbody .dcenter {
-    background: #EEE url('images/menubg.png');
-	margin: 0 5px;
-}
-.dbody .dinner {
-	color: #222;
-    font: 9px Verdana, Tahoma, Arial, Helvetica, sans-serif;
-	padding: 4px;
-}
-
-.dbottom .left { background: url('images/bottomleft.png') no-repeat; float: left; height: 8px; width: 9px;  font-size: 1px; margin-right: -3px;}
-.dbottom .right { background: url('images/bottomright.png') no-repeat; float: right; height: 8px; width: 9px;  font-size: 1px; margin-left: -3px;}
-.dbottom .center {background-image: url('images/bottom.png');height: 8px;  font-size: 1px; }
-
-.dntop {
-	border-bottom: 1px solid #a9a9a9;
-	width: 99%;
-	margin-left: auto;
-	margin-right: auto;
-}
-
-/* end */
-
-
-
-.tbox.chatbox {
-	width: 80%;
-	margin-left: auto;
-	margin-right: auto;
-}
-
-
-a {
-	color: #00006e; 
-	font-family: verdana, arial, sans-serif; 
-	text-decoration: none;
-}
-a:hover {
-	color: #ec5800;
-	font-family: verdana, arial, sans-serif; 
-	text-decoration: underline;
-}
-
-
-.smalltext {
-	font: 9px tahoma, verdana, arial, helvetica, sans-serif;
-	color:#5d6e75;
-}
-
-form {
-	display: inline;
-}
-.spacer {
-	padding: 2px 0 2px 0;
-}
-
-#wm {
-	voice-family: "\"}\"";
-	voice-family: inherit;
-	background: #f3eded url(images/wblogo.png) bottom right no-repeat;
-	border: 1px solid #ede3e3;
-	padding: 10px 150px 10px 10px;
-	font: 10px verdana, tahoma, arial, helvetica, sans-serif;
-}
-
-.button {	
-	border: #b7b5b5 1px solid;
-	color: #000;
-	font: 9px verdana, tahoma, arial, helvetica, sans-serif;
-	text-align:center;
-	background-image : url(images/button.png);
-}
-
-h1 {
-  font-size: 1.4em;
-  font-weight: bold;
-  margin-top: 0em;
-  margin-bottom: 0em;
-  color: #ec5800;
-}
-
-h2 {
-  font-size: 1.2em;
-  font-weight: bold;
-  margin-top: 0em;
-  margin-bottom: 0em;
-  color: #ec5800;
-}
-
-.newstext {
-	font-size: 8pt;
-	line-height: 120%;
-	color: black;
-	text-align: left;
-	font: 7pt verdana, tahoma, arial, helvetica, sans-serif;
-}
-
-.newheadline {
-	font-size: 13px;
-	color: #ec5800;
-}
-
-.newsinfo {
-	font: 9px tahoma, verdana, arial, helvetica, sans-serif;
-	color:#5d6e75;
-}
-
-.newsinfo a {
-	background: transparent;
-	color: #5d6e75; 
-}
-
-.newsinfo a:hover {
-	color: #ec5800;
-	text-decoration: underline;
-}
-
-
-
-
-
-#pollquestion {
-	font: 8pt Verdana, Tahoma, Arial, Helvetica, sans-serif;
-}
-
-.helpbox {
-	color:#000;
-	font: 9px tahoma, verdana, arial, helvetica, sans-serif;
-	border: 0px none red;
-	background-color: transparent;
-}
-
-.nforumholder {
-	border: 1px solid #345487;
-	padding: 0px;
-	background: transparent;
-}
-
-.nforumcaption {
-	background-image: url(images/nforumcaption.png);
-	padding: 8px 4px 8px 4px;
-	font: 12px verdana, tahoma, arial, helvetica, sans-serif;
-	color: #fff;
-}
-
-.nforumcaption2 {
-	background-image: url(images/nforumcaption2.png);
-	padding: 8px 0px 8px 4px;
-	font: 10px verdana, tahoma, arial, helvetica, sans-serif;
-	color: #000;
-}
-
-.nforumcaption3 {
-	border: 1px solid #fff;
-	padding: 4px;
-	background-repeat: repeat-x repeat-y; background-image: url(images/menubg.png);
-	font: 11px verdana, tahoma, arial, helvetica, sans-serif;
-}
-
-.nforumthread {
-	border: 1px solid #fff;
-	padding: 4px;
-	background-repeat: repeat-x repeat-y; background-image: url(images/menubg2.png);
-	font: 10px verdana, tahoma, arial, helvetica, sans-serif;
-}
-
-.nforumthread2 {
-	border: 1px solid #fff;
-	padding: 4px;
-	background-color: #D1DCEB;
-	font: 10px verdana, tahoma, arial, helvetica, sans-serif;
-}
-
-.nforumreplycaption {
-	border: 1px solid #fff;
-	padding: 4px;
-	background-repeat: repeat-x repeat-y; background-image: url(images/menubg2.png);
-	font: 12px verdana, tahoma, arial, helvetica, sans-serif;
-}
-
-.nforumreply {
-	border: 1px solid #fff;
-	padding: 4px;
-	background-repeat: repeat-x repeat-y; background-image: url(images/menubg2.png);
-	font: 10px verdana, tahoma, arial, helvetica, sans-serif;
-}
-
-.nforumreply2 {
-	border: 1px solid #fff;
-	padding: 4px;
-	background-repeat: repeat-x repeat-y; background-image: url(images/menubg.png);
-	font: 10px verdana, tahoma, arial, helvetica, sans-serif;
-}
-.nforumdisclaimer {
-	font: 9px verdana, tahoma, arial, helvetica, sans-serif;
-	color:#5d6e75;
-}
-
-.nforumview1 {
-	border: 1px solid #fff;
-	padding: 4px;
-	background-repeat: repeat-x repeat-y; background-image: url(images/menubg.png);
-	font: 10px verdana, tahoma, arial, helvetica, sans-serif;
-}
-
-.nforumview2 {
-	border: 1px solid #fff;
-	padding: 4px;
-	background-repeat: repeat-x repeat-y; background-image: url(images/menubg.png);
-	font: 10px verdana, tahoma, arial, helvetica, sans-serif;
-}
-
-.nforumview3 {
-	padding: 4px;
-	background-color: #BCD0ED;
-	font: 10px verdana, tahoma, arial, helvetica, sans-serif;
-	color: #263448;
-}
-
-.nforumview4 {
-	padding: 4px;
-	background-color: #E4EAF2;
-	font: 9px verdana, tahoma, arial, helvetica, sans-serif;
-	color: #3A4F6C;
-}
-
-a.forumlink{
-	color: #4943c1;
-	text-decoration: none;
-}
-
-a.forumlink:hover {
-	color: #bbb;
-	text-decoration: underline;
-}
-
-td {
-	text-align: left;
-}
-
-.smallblacktext {
-	font: 10px tahoma, verdana, arial, helvetica, sans-serif;
-	color:#000;
-	line-height: 120%;
-}
-
-.tbox{
-	background-color: #fff;
-	border: #b7b5b5 1px solid;
-	color: #000000;
-	font: 10px verdana, tahoma, arial, helvetica, sans-serif;
-}
-
-.forumheader{
-	background: transparent;
-	font: 11px verdana, tahoma, arial, helvetica, sans-serif;
-	color:#000;
-	padding: 4px;
-	background-image: url(images/nforumcaption2.png);
-}
-
-.forumheader2{
-	background: transparent;
-	font: 12px verdana, tahoma, arial, helvetica, sans-serif;
-	color:#000;
-	padding: 4px;
-}
-
-.forumheader3{
-	background: transparent;
-	font: 11px verdana, tahoma, arial, helvetica, sans-serif;
-	color:#000;
-	padding: 4px;
-}
-
-.forumborder{
-	border: #000080 1px solid;
-}
-
-.chatb {
-	font-size: 12px;
-}
-
-.chatb a {
-	background: transparent;
-	color: #ec5800; 
-}
-
-.chatb a:hover {
-	color: #616060;
-	font-family: verdana, arial, sans-serif; 
-	text-decoration: underline;
-}
-
-p {
-	margin-top: 0px
-}
-
-.indent{
-	padding: 10px 10px 10px 10px;
-	margin: 5px;
-	font: 9px verdana, tahoma, arial, sans-serif;
-	color: #838387;
-	border: 1px solid #d6d6d6;
-}
-
-.nextprev{
-	color: #000000;
-	font: 9px verdana, tahoma, arial, helvetica, sans-serif;
-	padding : 2px;
-	text-align: right;
-}
-
-ul {
-	padding-left: 12px;
-}
-
-.commentinfo {
-	background-image: url(images/nforumcaption2.png);
-	padding: 8px 0px 8px 4px;
-	font: 10px verdana, tahoma, arial, helvetica, sans-serif;
-	color: #000;
-}
-
-.commentinfo a {
-	background: transparent;
-	color: #ec5800; 
-}
-
-.commentinfo a:hover {
-	color: #616060;
-	font-family: verdana, arial, sans-serif; 
-	text-decoration: underline;
-}
-
-.mediumtext {
-	font: 12px verdana, tahoma, arial, helvetica, sans-serif;
-	color: #000;
-}
-
-.fcaption {
-	background-image: url(images/nforumcaption2.png);
-	padding: 8px 0px 8px 4px;
-	font: 10px verdana, tahoma, arial, helvetica, sans-serif;
-	color: #000;
-}
-
-hr {
-	border-top: #666 1px solid;
-	border-bottom: #fff 1px solid;
-	height: 2px;
-	width: 99%;
-	text-align:center;
-}
-
-.linkspage_button{
-	vertical-align: middle;
-	border:0px;
+
+body {
+	background: #ffffff url(images/background.png) no-repeat; text-align: left; margin: 12px;
+	font: 7pt Verdana, Tahoma, Arial, Helvetica, sans-serif;
+	margin: 5px;
+	padding: 5px;
+}
+
+/* Header / logo ... */
+#header {
+	height: 124px;
+	width: 100%;
+	background: url(images/logo2.png) repeat-x;
+	float: left;
+}
+
+#logo1 {
+	position: absolute;
+	left:10px;
+	top:10px;
+	width: 192px;
+	height: 124px;
+	background: url(images/logo1.png) no-repeat;
+}
+
+#headerr {
+	position: absolute;
+	right:10px;
+	top:10px;
+	height: 124px;
+	width: 8px;
+	background-repeat: no-repeat;
+	background: url(images/logo3.png) no-repeat;
+}
+
+#banner {
+	position: absolute;
+	right:26px;
+	top:40px;
+}
+
+/* end */
+
+/* main layout ... */
+
+#mainbox {
+	width: 100%;
+	margin: 0; padding: 0;
+}
+
+
+#leftcontent {
+	position: absolute;
+	top: 136px;
+	left: 10px;
+	width: 18%;
+	margin:0; padding:0;
+	font: 10px verdana, tahoma, arial, helvetica, sans-serif;
+}
+#rightcontent {
+	position: absolute;
+	top: 136px;
+	right: 10px;
+	width: 18%;
+	margin:0; padding:0;
+	font: 10px verdana, tahoma, arial, helvetica, sans-serif;
+
+}
+
+#centercontent {
+	font: 9px Verdana, Tahoma, Arial, Helvetica, sans-serif;
+	margin-left: 20%;
+	width: 60%;
+}
+
+#footer {
+	text-align: center;
+	
+	font: 9px tahoma, verdana, arial, helvetica, sans-serif;
+	color:#5d6e75;
+}
+
+.clear {
+	clear: both;
+}
+
+
+
+
+
+
+
+.dcaption {
+    width: 100%;
+}
+
+.dcaption .left { background: url('images/topleft.png') no-repeat; float: left; height: 26px; width: 9px; margin-right: -3px; }
+.dcaption .right { background: url('images/topright.png') no-repeat; float: right; height: 26px; width: 9px; margin-left: -3px; }
+.dcaption .center {background-image: url('images/top.png'); color: #111; font: 10px Verdana, Tahoma, Arial, Helvetica, sans-serif; height: 26px; line-height: 26px; }
+
+.dbody {
+    width: 100%;
+}
+
+.dbody .leftwrapper {
+	margin:0; padding:0;
+	background: url("images/left.png") left repeat-y;
+}
+.dbody .rightwrapper {
+	margin:0; padding:0;
+	background: url("images/right.png") right repeat-y;
+}
+.dbody .leftcontent {
+	float:left;
+	width:9px;
+	margin:0; padding:0;
+}
+.dbody .rightcontent {
+	float:right;
+	width:9px;
+	margin:0; padding:0;
+}
+.dbody .dcenter {
+    background: #EEE url('images/menubg.png');
+	margin: 0 5px;
+}
+.dbody .dinner {
+	color: #222;
+    font: 9px Verdana, Tahoma, Arial, Helvetica, sans-serif;
+	padding: 4px;
+}
+
+.dbottom .left { background: url('images/bottomleft.png') no-repeat; float: left; height: 8px; width: 9px;  font-size: 1px; margin-right: -3px;}
+.dbottom .right { background: url('images/bottomright.png') no-repeat; float: right; height: 8px; width: 9px;  font-size: 1px; margin-left: -3px;}
+.dbottom .center {background-image: url('images/bottom.png');height: 8px;  font-size: 1px; }
+
+.dntop {
+	border-bottom: 1px solid #a9a9a9;
+	width: 99%;
+	margin-left: auto;
+	margin-right: auto;
+}
+
+/* end */
+
+
+
+.tbox.chatbox {
+	width: 80%;
+	margin-left: auto;
+	margin-right: auto;
+}
+
+
+a {
+	color: #00006e; 
+	font-family: verdana, arial, sans-serif; 
+	text-decoration: none;
+}
+a:hover {
+	color: #ec5800;
+	font-family: verdana, arial, sans-serif; 
+	text-decoration: underline;
+}
+
+
+.smalltext {
+	font: 9px tahoma, verdana, arial, helvetica, sans-serif;
+	color:#5d6e75;
+}
+
+form {
+	display: inline;
+}
+.spacer {
+	padding: 2px 0 2px 0;
+}
+
+#wm {
+	voice-family: "\"}\"";
+	voice-family: inherit;
+	background: #f3eded url(images/wblogo.png) bottom right no-repeat;
+	border: 1px solid #ede3e3;
+	padding: 10px 150px 10px 10px;
+	font: 10px verdana, tahoma, arial, helvetica, sans-serif;
+}
+
+.button {	
+	border: #b7b5b5 1px solid;
+	color: #000;
+	font: 9px verdana, tahoma, arial, helvetica, sans-serif;
+	text-align:center;
+	background-image : url(images/button.png);
+}
+
+h1 {
+  font-size: 1.4em;
+  font-weight: bold;
+  margin-top: 0em;
+  margin-bottom: 0em;
+  color: #ec5800;
+}
+
+h2 {
+  font-size: 1.2em;
+  font-weight: bold;
+  margin-top: 0em;
+  margin-bottom: 0em;
+  color: #ec5800;
+}
+
+.newstext {
+	font-size: 8pt;
+	line-height: 120%;
+	color: black;
+	text-align: left;
+	font: 7pt verdana, tahoma, arial, helvetica, sans-serif;
+}
+
+.newheadline {
+	font-size: 13px;
+	color: #ec5800;
+}
+
+.newsinfo {
+	font: 9px tahoma, verdana, arial, helvetica, sans-serif;
+	color:#5d6e75;
+}
+
+.newsinfo a {
+	background: transparent;
+	color: #5d6e75; 
+}
+
+.newsinfo a:hover {
+	color: #ec5800;
+	text-decoration: underline;
+}
+
+
+
+
+
+#pollquestion {
+	font: 8pt Verdana, Tahoma, Arial, Helvetica, sans-serif;
+}
+
+.helpbox {
+	color:#000;
+	font: 9px tahoma, verdana, arial, helvetica, sans-serif;
+	border: 0px none red;
+	background-color: transparent;
+}
+
+.nforumholder {
+	border: 1px solid #345487;
+	padding: 0px;
+	background: transparent;
+}
+
+.nforumcaption {
+	background-image: url(images/nforumcaption.png);
+	padding: 8px 4px 8px 4px;
+	font: 12px verdana, tahoma, arial, helvetica, sans-serif;
+	color: #fff;
+}
+
+.nforumcaption2 {
+	background-image: url(images/nforumcaption2.png);
+	padding: 8px 0px 8px 4px;
+	font: 10px verdana, tahoma, arial, helvetica, sans-serif;
+	color: #000;
+}
+
+.nforumcaption3 {
+	border: 1px solid #fff;
+	padding: 4px;
+	background-repeat: repeat; background-image: url(images/menubg.png);
+	font: 11px verdana, tahoma, arial, helvetica, sans-serif;
+}
+
+.nforumthread {
+	border: 1px solid #fff;
+	padding: 4px;
+	background-repeat: repeat; background-image: url(images/menubg2.png);
+	font: 10px verdana, tahoma, arial, helvetica, sans-serif;
+}
+
+.nforumthread2 {
+	border: 1px solid #fff;
+	padding: 4px;
+	background-color: #D1DCEB;
+	font: 10px verdana, tahoma, arial, helvetica, sans-serif;
+}
+
+.nforumreplycaption {
+	border: 1px solid #fff;
+	padding: 4px;
+	background-repeat: repeat; background-image: url(images/menubg2.png);
+	font: 12px verdana, tahoma, arial, helvetica, sans-serif;
+}
+
+.nforumreply {
+	border: 1px solid #fff;
+	padding: 4px;
+	background-repeat: repeat; background-image: url(images/menubg2.png);
+	font: 10px verdana, tahoma, arial, helvetica, sans-serif;
+}
+
+.nforumreply2 {
+	border: 1px solid #fff;
+	padding: 4px;
+	background-repeat: repeat; background-image: url(images/menubg.png);
+	font: 10px verdana, tahoma, arial, helvetica, sans-serif;
+}
+.nforumdisclaimer {
+	font: 9px verdana, tahoma, arial, helvetica, sans-serif;
+	color:#5d6e75;
+}
+
+.nforumview1 {
+	border: 1px solid #fff;
+	padding: 4px;
+	background-repeat: repeat; background-image: url(images/menubg.png);
+	font: 10px verdana, tahoma, arial, helvetica, sans-serif;
+}
+
+.nforumview2 {
+	border: 1px solid #fff;
+	padding: 4px;
+	background-repeat: repeat; background-image: url(images/menubg.png);
+	font: 10px verdana, tahoma, arial, helvetica, sans-serif;
+}
+
+.nforumview3 {
+	padding: 4px;
+	background-color: #BCD0ED;
+	font: 10px verdana, tahoma, arial, helvetica, sans-serif;
+	color: #263448;
+}
+
+.nforumview4 {
+	padding: 4px;
+	background-color: #E4EAF2;
+	font: 9px verdana, tahoma, arial, helvetica, sans-serif;
+	color: #3A4F6C;
+}
+
+a.forumlink{
+	color: #4943c1;
+	text-decoration: none;
+}
+
+a.forumlink:hover {
+	color: #bbb;
+	text-decoration: underline;
+}
+
+td {
+	text-align: left;
+}
+
+.smallblacktext {
+	font: 10px tahoma, verdana, arial, helvetica, sans-serif;
+	color:#000;
+	line-height: 120%;
+}
+
+.tbox{
+	background-color: #fff;
+	border: #b7b5b5 1px solid;
+	color: #000000;
+	font: 10px verdana, tahoma, arial, helvetica, sans-serif;
+}
+
+.forumheader{
+	background: transparent;
+	font: 11px verdana, tahoma, arial, helvetica, sans-serif;
+	color:#000;
+	padding: 4px;
+	background-image: url(images/nforumcaption2.png);
+}
+
+.forumheader2{
+	background: transparent;
+	font: 12px verdana, tahoma, arial, helvetica, sans-serif;
+	color:#000;
+	padding: 4px;
+}
+
+.forumheader3{
+	background: transparent;
+	font: 11px verdana, tahoma, arial, helvetica, sans-serif;
+	color:#000;
+	padding: 4px;
+}
+
+.forumborder{
+	border: #000080 1px solid;
+}
+
+.chatb {
+	font-size: 12px;
+}
+
+.chatb a {
+	background: transparent;
+	color: #ec5800; 
+}
+
+.chatb a:hover {
+	color: #616060;
+	font-family: verdana, arial, sans-serif; 
+	text-decoration: underline;
+}
+
+p {
+	margin-top: 0px
+}
+
+.indent{
+	padding: 10px 10px 10px 10px;
+	margin: 5px;
+	font: 9px verdana, tahoma, arial, sans-serif;
+	color: #838387;
+	border: 1px solid #d6d6d6;
+}
+
+.nextprev{
+	color: #000000;
+	font: 9px verdana, tahoma, arial, helvetica, sans-serif;
+	padding : 2px;
+	text-align: right;
+}
+
+ul {
+	padding-left: 12px;
+}
+
+.commentinfo {
+	background-image: url(images/nforumcaption2.png);
+	padding: 8px 0px 8px 4px;
+	font: 10px verdana, tahoma, arial, helvetica, sans-serif;
+	color: #000;
+}
+
+.commentinfo a {
+	background: transparent;
+	color: #ec5800; 
+}
+
+.commentinfo a:hover {
+	color: #616060;
+	font-family: verdana, arial, sans-serif; 
+	text-decoration: underline;
+}
+
+.mediumtext {
+	font: 12px verdana, tahoma, arial, helvetica, sans-serif;
+	color: #000;
+}
+
+.fcaption {
+	background-image: url(images/nforumcaption2.png);
+	padding: 8px 0px 8px 4px;
+	font: 10px verdana, tahoma, arial, helvetica, sans-serif;
+	color: #000;
+}
+
+hr {
+	border-top: #666 1px solid;
+	border-bottom: #fff 1px solid;
+	height: 2px;
+	width: 99%;
+	text-align:center;
+}
+
+.linkspage_button{
+	vertical-align: middle;
+	border:0px;
 }
\ No newline at end of file
diff -x .svn -aruN 0.7.24.src/e107_themes/templates/admin_template.php 0.7.26.src/e107_themes/templates/admin_template.php
--- 0.7.24.src/e107_themes/templates/admin_template.php	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_themes/templates/admin_template.php	2010-09-30 16:42:46.000000000 -0500
@@ -11,8 +11,8 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $URL: https://e107.svn.sourceforge.net/svnroot/e107/trunk/e107_0.7/e107_themes/templates/admin_template.php $
-|     $Revision: 11678 $
-|     $Id: admin_template.php 11678 2010-08-22 00:43:45Z e107coders $
+|     $Revision: 11836 $
+|     $Id: admin_template.php 11836 2010-09-30 21:43:10Z e107coders $
 |     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
@@ -28,7 +28,7 @@
 <table style='width:100%' cellspacing='10' cellpadding='10'>
 <tr>
 <td style='width:17%; vertical-align: top;'>
-".(e_PAGE != 'admin.php' ? '{ADMIN_UPDATE} ' : '')."
+{ADMIN_UPDATE=notadminpanel}
 {ADMIN_NAV}
 {ADMIN_LANG}
 {ADMIN_PWORD}
@@ -40,7 +40,8 @@
 {ADMIN_PLUGINS}
 </td>
 <td style='width:62%; vertical-align: top;'>
-";
+{ADMIN_UPDATE=adminpanel}";
+
 
 $ADMIN_FOOTER = "</td>
 <td style='width:17%; vertical-align:top'>
diff -x .svn -aruN 0.7.24.src/e107_themes/templates/contact_template.php 0.7.26.src/e107_themes/templates/contact_template.php
--- 0.7.24.src/e107_themes/templates/contact_template.php	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_themes/templates/contact_template.php	2011-03-12 06:37:53.000000000 -0600
@@ -1,5 +1,5 @@
 <?php
-// $Id: contact_template.php 11633 2010-07-30 09:28:28Z e107coders $
+// $Id: contact_template.php 12098 2011-03-12 12:38:17Z e107steved $
 
 if (!defined('e107_INIT')) { exit; }
 if (!defined("USER_WIDTH")){ define("USER_WIDTH","width:97%"); }
@@ -37,19 +37,19 @@
 	<table style='".USER_WIDTH."' cellpadding='1' cellspacing='7'>
 	{CONTACT_PERSON}
 	<tr><td>".LANCONTACT_03."<br />
-	<input type='text' name='author_name' size='30' class='tbox' value=\"".$_POST['author_name']."\" />
+	<input type='text' name='author_name' size='30' class='tbox' value=\"".varset($_POST['author_name'], '')."\" />
 	</td></tr>
 	<tr><td>".LANCONTACT_04."<br />
-	<input type='text' name='email_send' size='30' class='tbox' value='".($_POST['email_send'] ? $_POST['email_send'] : USEREMAIL)."' />
+	<input type='text' name='email_send' size='30' class='tbox' value='".(varset($_POST['email_send'], FALSE) ? $_POST['email_send'] : USEREMAIL)."' />
 	</td></tr>
 	<tr><td>
 	".LANCONTACT_05."<br />
-	<input type='text' name='subject' size='30' class='tbox' value=\"".$_POST['subject']."\" />
+	<input type='text' name='subject' size='30' class='tbox' value=\"".varset($_POST['subject'], '')."\" />
 	</td></tr>
 	{CONTACT_EMAIL_COPY}
 	<tr><td>
     ".LANCONTACT_06."<br />
-	<textarea cols='50' rows='10' name='body' class='tbox'>".stripslashes($_POST['body'])."</textarea>
+	<textarea cols='50' rows='10' name='body' class='tbox'>".stripslashes(varset($_POST['body'], ''))."</textarea>
 	</td></tr>
 	{CONTACT_IMAGECODE}
 	{CONTACT_IMAGECODE_INPUT}
diff -x .svn -aruN 0.7.24.src/e107_themes/templates/download_template.php 0.7.26.src/e107_themes/templates/download_template.php
--- 0.7.24.src/e107_themes/templates/download_template.php	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_themes/templates/download_template.php	2011-05-26 07:20:32.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $URL: https://e107.svn.sourceforge.net/svnroot/e107/trunk/e107_0.7/e107_themes/templates/download_template.php $
-|     $Revision: 11678 $
-|     $Id: download_template.php 11678 2010-08-22 00:43:45Z e107coders $
-|     $Author: e107coders $
+|     $Revision: 12224 $
+|     $Id: download_template.php 12224 2011-05-26 12:20:56Z secretr $
+|     $Author: secretr $
 +----------------------------------------------------------------------------+
 */
 if (!defined('e107_INIT')) { exit; }
@@ -213,7 +213,7 @@
 
 // ##### VIEW TABLE -------------------------------------------------------------------------------
 
-$DL_VIEW_PAGETITLE = PAGE_NAME." / {DOWNLOAD_CATEGORY} / {DOWNLOAD_VIEW_NAME}";
+$DL_VIEW_PAGETITLE = "{DOWNLOAD_VIEW_NAME} / {DOWNLOAD_CATEGORY} / ".PAGE_NAME;
 $DL_VIEW_CAPTION = "{DOWNLOAD_VIEW_CAPTION}";
 
 if(!isset($DL_VIEW_NEXTPREV))
diff -x .svn -aruN 0.7.24.src/e107_themes/templates/footer_default.php 0.7.26.src/e107_themes/templates/footer_default.php
--- 0.7.24.src/e107_themes/templates/footer_default.php	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_themes/templates/footer_default.php	2011-01-30 13:22:23.000000000 -0600
@@ -9,7 +9,7 @@
 * Default footer for user pages
 *
 * $URL: https://e107.svn.sourceforge.net/svnroot/e107/trunk/e107_0.7/e107_themes/templates/footer_default.php $
-* $Id: footer_default.php 11765 2010-09-07 21:46:27Z e107coders $
+* $Id: footer_default.php 12060 2011-01-30 19:22:47Z secretr $
 *
 */
 
@@ -21,28 +21,33 @@
 	{
 		session_start(); // restart
 	}
-	
-	// regenerate SID
-	$oldSID = session_id(); // old SID
-	$oldSData = $_SESSION; // old session data
-	session_regenerate_id(false); // true don't work on php4 - so time to move on people!	
-	$newSID = session_id(); // new SID
-	
-	// Clean
-	session_id($oldSID); // switch to the old session
-	session_destroy(); // destroy it
-	
-	// set new ID, reopen the session, set saved data
-	session_id($newSID);
-	session_start();
-	$_SESSION = $oldSData;
-	// give 3rd party code a way to prevent token re-generation
+	// give 3rd party code a way to prevent token re-generation, respect security level
 	if(!defsettrue('e_TOKEN_FREEZE'))
-	{
-		$_SESSION['regenerate_'.e_TOKEN_NAME] = time(); // class2 have to re-create token on the next request
+	{	
+		if(defset('e_SECURITY_LEVEL', 5) >= 10)
+		{
+			// regenerate SID
+			$oldSID = session_id(); // old SID
+			$oldSData = $_SESSION; // old session data
+			session_regenerate_id(false); // true don't work on php4 - so time to move on people!	
+			$newSID = session_id(); // new SID
+			
+			// Clean
+			session_id($oldSID); // switch to the old session
+			session_destroy(); // destroy it
+			
+			// set new ID, reopen the session, set saved data
+			session_id($newSID);
+			session_start();
+			$_SESSION = $oldSData;
+			
+			unset($oldSID, $newSID, $oldSData);
+		}
+		if(defset('e_SECURITY_LEVEL', 5) >= 8)
+		{
+			$_SESSION['regenerate_'.e_TOKEN_NAME] = time(); // class2 have to re-create token on the next request
+		}
 	}
-	unset($oldSID, $newSID, $oldSData);
-	
 	// write session data
 	session_write_close();
 // SESSION End
diff -x .svn -aruN 0.7.24.src/e107_themes/templates/fpw_template.php 0.7.26.src/e107_themes/templates/fpw_template.php
--- 0.7.24.src/e107_themes/templates/fpw_template.php	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_themes/templates/fpw_template.php	2011-07-22 07:32:26.000000000 -0500
@@ -1,5 +1,5 @@
 <?php
-// $Id: fpw_template.php 11346 2010-02-17 18:56:14Z secretr $
+// $Id: fpw_template.php 12322 2011-07-22 12:32:50Z secretr $
 
 
 if (!defined('e107_INIT')) { exit; }
@@ -10,7 +10,7 @@
 {
 		$FPW_TABLE = "
 		<div style='text-align:center'>
-		<form method='post' action='".e_SELF."'>
+		<form method='post' action='".SITEURL."fpw.php'>
 		<table style='".USER_WIDTH."' class='fborder'>
 
 		<tr>
@@ -31,7 +31,8 @@
 		</td>
 		</tr>";
 
-		if($FPW_TABLE_SECIMG_SECIMG){
+		if(defsettrue('USE_IMAGECODE'))
+		{
 				$FPW_TABLE .= "
 				<tr>
 					<td class='forumheader3' style='width:25%'>{FPW_TABLE_SECIMG_LAN}</td>
@@ -45,6 +46,7 @@
 		<tr style='vertical-align:top'>
 		<td class='forumheader' colspan='2' style='text-align:center'>
 		<input class='button' type='submit' name='pwsubmit' value='".LAN_156."' />
+		<input type='hidden' name='e-token' value=\"".e_TOKEN."\" />
 		</td>
 		</tr>
 		</table>
@@ -59,7 +61,7 @@
 		$FPW_TABLE_HEADER = "
 		<div style='width:100%;text-align:center;margin-left:auto;margin-right:auto'>
 			<div style='width:70%;margin-left:auto;margin-right:auto;text-align:center;'><br />
-			".(file_exists(THEME."images/login_logo.png") ? "<img src='".THEME."images/login_logo.png' alt='' />\n" : "<img src='".e_IMAGE."logo.png' alt='' />\n")."
+			{FPW_LOGIN_LOGO}
 			<br />";
 }
 // ##### ------------------------------------------------------------------------------------------
diff -x .svn -aruN 0.7.24.src/e107_themes/templates/header_default.php 0.7.26.src/e107_themes/templates/header_default.php
--- 0.7.24.src/e107_themes/templates/header_default.php	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_themes/templates/header_default.php	2011-07-23 16:02:20.000000000 -0500
@@ -6,8 +6,8 @@
 |     Released under the terms and conditions of the GNU General Public License (http://gnu.org).
 |
 |     $URL: https://e107.svn.sourceforge.net/svnroot/e107/trunk/e107_0.7/e107_themes/templates/header_default.php $
-|     $Revision: 11763 $
-|     $Id: header_default.php 11763 2010-09-07 18:51:43Z e107coders $
+|     $Revision: 12324 $
+|     $Id: header_default.php 12324 2011-07-23 21:02:44Z e107coders $
 |     $Author: e107coders $
 +-----------------------------------------------------------------------------------------------+
 */
@@ -72,7 +72,7 @@
 
 // send the charset to the browser - overrides spurious server settings with the lan pack settings.
 // Would like to set the MIME type appropriately - but it broke other things
-//if (stristr($_SERVER["HTTP_ACCEPT"], "application/xhtml+xml")) 
+//if (stristr($_SERVER["HTTP_ACCEPT"], "application/xhtml+xml"))
 //  header("Content-type: application/xhtml+xml; charset=".CHARSET, true);
 //else
   header("Content-type: text/html; charset=".CHARSET, true);
@@ -89,7 +89,7 @@
 <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";
+echo "<title>".(defined("e_PAGETITLE") ? e_PAGETITLE." - " : (defined("PAGE_NAME") ? PAGE_NAME." - " : "")).SITENAME."</title>\n";
 
 
 //
@@ -98,11 +98,13 @@
 echo "<!-- *JS* -->\n";
 
 // Wysiwyg JS support on or off.
-if (varset($pref['wysiwyg'],FALSE) && check_class($pref['post_html']) && varset($e_wysiwyg) != "") 
+if (((varset($pref['wysiwyg'],FALSE) && check_class($pref['post_html'])) || defsettrue('e_WYSIWYG')) && varset($e_wysiwyg) != "")
 {
 	require_once(e_HANDLER."tiny_mce/wysiwyg.php");
 	define("e_WYSIWYG",TRUE);
-	echo wysiwyg($e_wysiwyg);
+	$wy = new wysiwyg($e_wysiwyg);
+	$wy->render();
+	// echo wysiwyg();
 }
 else
 {
@@ -111,18 +113,18 @@
 
 
 echo "<script type='text/javascript' src='".e_FILE_ABS."e107.js'></script>\n";
-if (isset($theme_js_php) && $theme_js_php) 
+if (isset($theme_js_php) && $theme_js_php)
 {
 	echo "<script type='text/javascript' src='".THEME_ABS."theme-js.php'></script>\n";
-} 
-else 
+}
+else
 {
 	if (is_readable(THEME.'theme.js')) { echo "<script type='text/javascript' src='".THEME_ABS."theme.js'></script>\n"; }
 	if (is_readable(e_FILE.'user.js') && filesize(e_FILE.'user.js')) { echo "<script type='text/javascript' src='".e_FILE_ABS."user.js'></script>\n"; }
 }
 
 
-if (isset($eplug_js) && $eplug_js) 
+if (isset($eplug_js) && $eplug_js)
 {
 	echo "\n<!-- eplug_js -->\n";
 	if(is_array($eplug_js))
@@ -239,14 +241,32 @@
 {
 	global $pref,$tp;
 
-	if (!isset($pref['meta_'.$type][e_LANGUAGE])){ return;}
-	if (!$pref['meta_'.$type][e_LANGUAGE]){ return; }
+	// if (!isset($pref['meta_'.$type][e_LANGUAGE])){ return;}
+	// if (!$pref['meta_'.$type][e_LANGUAGE]){ return; }
 
-	if($type == "tag")
+	if($type == "tag" && defset($pref['meta_tag'][e_LANGUAGE]))
 	{
 		return str_replace("&lt;", "<", $tp -> toHTML($pref['meta_tag'][e_LANGUAGE], FALSE, "nobreak, no_hook, no_make_clickable"))."\n";
 	}
-	else
+	elseif($type == 'og')
+	{
+		if(!defined("META_OG") || !defined("XMLNS"))
+		{
+			return;
+		}
+		
+		$ret = '';
+		$tmp = unserialize(META_OG);
+		
+		// FB will still utilize 'name' instead of 'property' (which is not valid XHTML)
+		foreach($tmp as $k=>$v)
+		{
+			$ret .= '<meta name="og:'.$k.'" content="'.$v.'" />'."\n";
+		}
+
+		return $ret;		
+	}
+	elseif(defset($pref['meta_'.$type][e_LANGUAGE]))
 	{
 		return '<meta name="'.$type.'" content="'.$pref['meta_'.$type][e_LANGUAGE].'" />'."\n";
 	}
@@ -258,6 +278,8 @@
 echo render_meta('copyright');
 echo render_meta('author');
 echo render_meta('tag');
+echo render_meta('og');
+
 
 unset($key_merge,$diz_merge);
 
@@ -339,7 +361,7 @@
 	$e107_popup = 0;
 }
 if ($e107_popup != 1) {
-	
+
 //
 // L: (optional) Body JS to disable right clicks
 //
@@ -392,26 +414,26 @@
 	}
 
 	$e107ParseHeaderFlag = FALSE;				// Deliberately choose a distinct Name! (Its got to reach the footer)
-	if (e_PAGE == 'news.php' && isset($NEWSHEADER)) 
+	if (e_PAGE == 'news.php' && isset($NEWSHEADER))
 	{
 		parseheader($NEWSHEADER);
-	} 
-	else 
+	}
+	else
 	{
 		$full_query = e_SELF."?".e_QUERY."!";
-		foreach ($custompage as $key_extract => $cust_extract) 
+		foreach ($custompage as $key_extract => $cust_extract)
 		{
-			foreach ($cust_extract as $key => $kpage) 
+			foreach ($cust_extract as $key => $kpage)
 			{
-				if ($kpage && (strstr(e_SELF, $kpage) || strstr($full_query,$kpage))) 
+				if ($kpage && (strstr(e_SELF, $kpage) || strstr($full_query,$kpage)))
 				{
 					$e107ParseHeaderFlag = TRUE;
-					if ($key_extract=='no_array') 
+					if ($key_extract=='no_array')
 					{
 						$cust_header = $CUSTOMHEADER ? $CUSTOMHEADER : $HEADER;
 						$e107CustomFooter = $CUSTOMFOOTER ? $CUSTOMFOOTER : $FOOTER;
-					} 
-					else 
+					}
+					else
 					{
 						$cust_header = $CUSTOMHEADER[$key_extract] ? $CUSTOMHEADER[$key_extract] : $HEADER;
 						$e107CustomFooter = $CUSTOMFOOTER[$key_extract] ? $CUSTOMFOOTER[$key_extract] : $FOOTER;	// Another intentionally distinct name
diff -x .svn -aruN 0.7.24.src/e107_themes/templates/login_template.php 0.7.26.src/e107_themes/templates/login_template.php
--- 0.7.24.src/e107_themes/templates/login_template.php	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_themes/templates/login_template.php	2011-06-29 00:38:50.000000000 -0500
@@ -1,5 +1,5 @@
 <?php
-// $Id: login_template.php 11346 2010-02-17 18:56:14Z secretr $
+// $Id: login_template.php 12296 2011-06-29 05:39:14Z e107coders $
 
 if (!defined('e107_INIT')) { exit; }
 
@@ -7,7 +7,7 @@
 if(!isset($LOGIN_TABLE_HEADER))
 {
 	$LOGIN_TABLE_HEADER = "
-	<div style='width:100%;text-align:center; margin-left: auto;margin-right: auto'><br />
+	<div style='width:100%;text-align:center; margin-left: auto;margin-right: auto;margin-bottom:600px'><br />
 		<div style='text-align:center;width:70%;margin-left: auto;margin-right: auto'>
 			".(file_exists(THEME."images/login_logo.png") ? "<img src='".THEME_ABS."images/login_logo.png' alt='' />\n" : "<img src='".e_IMAGE."logo.png' alt='' />\n" );
 }
@@ -26,7 +26,7 @@
 		}
 		$LOGIN_TABLE .= "
 		<div style='text-align:center'>
-		".$rs -> form_open("post", e_SELF)."<table class='fborder' style='width:60%' >\n<tr>\n<td class='forumheader' style='text-align:center;' colspan='3'>".LAN_LOGIN_4."</td>\n</tr>\n<tr>\n<td class='forumheader3' width='40%'>".LAN_LOGIN_1."</td>\n<td class='forumheader3' width='40%'>{LOGIN_TABLE_USERNAME}</td>\n<td class='forumheader3' width='20%' rowspan='".($LOGIN_TABLE_SECIMG_SECIMG ? 3 : 2)."' style='vertical-align: middle; margin-left: auto; margin-right: auto; text-align: center;'>".(file_exists(THEME."images/password.png") ? "<img src='".THEME_ABS."images/password.png' alt='' />\n" : "<img src='".e_IMAGE."generic/".IMODE."/password.png' alt='' />\n" )."</td>\n</tr>\n<tr>\n<td class='forumheader3'>".LAN_LOGIN_2."</td>\n<td class='forumheader3'>{LOGIN_TABLE_PASSWORD}</td>\n</tr>\n";
+		".$rs -> form_open("post", e_SELF)."<table class='fborder' style='width:60%' >\n<tr>\n<td class='forumheader' style='text-align:center;' colspan='3'>".LAN_LOGIN_4."</td>\n</tr>\n<tr>\n<td class='forumheader3' style='width:40%'>".LAN_LOGIN_1."</td>\n<td class='forumheader3' style='width:40%'>{LOGIN_TABLE_USERNAME}</td>\n<td class='forumheader3' rowspan='".($LOGIN_TABLE_SECIMG_SECIMG ? 3 : 2)."' style='width:20%;vertical-align: middle; margin-left: auto; margin-right: auto; text-align: center;'>".(file_exists(THEME."images/password.png") ? "<img src='".THEME_ABS."images/password.png' alt='' />\n" : "<img src='".e_IMAGE."generic/".IMODE."/password.png' alt='' />\n" )."</td>\n</tr>\n<tr>\n<td class='forumheader3'>".LAN_LOGIN_2."</td>\n<td class='forumheader3'>{LOGIN_TABLE_PASSWORD}</td>\n</tr>\n";
 	if($LOGIN_TABLE_SECIMG_SECIMG){
 		$LOGIN_TABLE .= "<tr><td class='forumheader3'>{LOGIN_TABLE_SECIMG_LAN}</td>\n<td class='forumheader3'>{LOGIN_TABLE_SECIMG_HIDDEN} {LOGIN_TABLE_SECIMG_SECIMG} {LOGIN_TABLE_SECIMG_TEXTBOC}</td>\n</tr>\n";
 	}
diff -x .svn -aruN 0.7.24.src/e107_themes/templates/membersonly_template.php 0.7.26.src/e107_themes/templates/membersonly_template.php
--- 0.7.24.src/e107_themes/templates/membersonly_template.php	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/e107_themes/templates/membersonly_template.php	2011-06-29 00:38:50.000000000 -0500
@@ -11,8 +11,8 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $URL: https://e107.svn.sourceforge.net/svnroot/e107/trunk/e107_0.7/e107_themes/templates/membersonly_template.php $
-|     $Revision: 11678 $
-|     $Id: membersonly_template.php 11678 2010-08-22 00:43:45Z e107coders $
+|     $Revision: 12296 $
+|     $Id: membersonly_template.php 12296 2011-06-29 05:39:14Z e107coders $
 |     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
@@ -39,5 +39,5 @@
 </div>
 ";
 
-$MEMBERSONLY_END = "<div>";
+$MEMBERSONLY_END = "</div>";
 ?>
\ No newline at end of file
diff -x .svn -aruN 0.7.24.src/e107_themes/templates/request_template.php 0.7.26.src/e107_themes/templates/request_template.php
--- 0.7.24.src/e107_themes/templates/request_template.php	1969-12-31 18:00:00.000000000 -0600
+++ 0.7.26.src/e107_themes/templates/request_template.php	2011-01-21 20:11:15.000000000 -0600
@@ -0,0 +1,32 @@
+<?php
+/*
++ ----------------------------------------------------------------------------+
+|     e107 website system
+|
+|     Copyright (C) 2001-2002 Steve Dunstan (jalist@e107.org)
+|     Copyright (C) 2008-2010 e107 Inc (e107.org)
+|
+|     Released under the terms and conditions of the
+|     GNU General Public License (http://gnu.org).
+|
+|     $URL: https://e107.svn.sourceforge.net/svnroot/e107/trunk/e107_0.7/e107_themes/templates/membersonly_template.php $
+|     $Revision: 11678 $
+|     $Id: membersonly_template.php 11678 2010-08-22 00:43:45Z e107coders $
+|     $Author: e107coders $
++----------------------------------------------------------------------------+
+*/
+
+if (!defined('e107_INIT')) { exit; }
+
+$REQUEST_TEMPLATE = "<div class='request-splash'>
+
+	<h2 class='request-splash-message'>{REQUEST_MESSAGE}</h2>
+	<div class='request-splash-clicklink'>{REQUEST_CLICKLINK}</div>
+		
+<div class='request-splash-footer'>
+	<h2 class='request-splash-back'><a class='request-splash-back' href='".e_BASE."download.php'>".LAN_dl_64."</a></h2>
+</div>
+</div>";
+
+
+?>
\ No newline at end of file
diff -x .svn -aruN 0.7.24.src/email.php 0.7.26.src/email.php
--- 0.7.24.src/email.php	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/email.php	2010-11-02 17:36:17.000000000 -0500
@@ -11,8 +11,8 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $URL: https://e107.svn.sourceforge.net/svnroot/e107/trunk/e107_0.7/email.php $
-|     $Revision: 11808 $
-|     $Id: email.php 11808 2010-09-21 18:04:36Z e107steved $
+|     $Revision: 11948 $
+|     $Id: email.php 11948 2010-11-02 22:36:41Z e107steved $
 |     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
@@ -162,9 +162,27 @@
 	{
 	    // Load Mail Handler and Email Template.
 		require_once(e_HANDLER.'mail.php');
-	    $email_body = $EMAIL_HEADER;
+		if (file_exists(THEME.'email_template.php'))
+		{
+			require_once(THEME.'email_template.php');
+		}
+		else
+		{
+			require_once(e_THEME.'templates/email_template.php');
+		}
+
+		$email_body = '';
+		if(isset($EMAIL_HEADER))
+		{
+			$email_body = $tp->parseTemplate($EMAIL_HEADER);
+		}
+
 		$email_body .= (trim($comments) != '') ? $tp->toEmail($comments).'<hr />' : '';
-		$email_body .= $tp->toEmail($message).$EMAIL_FOOTER;
+		$email_body .= $tp->toEmail($message);
+		if (isset($EMAIL_FOOTER))
+		{
+			$email_body .= $tp->parseTemplate($EMAIL_FOOTER);
+		}
 
 		if (sendemail($email_send, LAN_EMAIL_3.SITENAME,$email_body))
 		{
diff -x .svn -aruN 0.7.24.src/fpw.php 0.7.26.src/fpw.php
--- 0.7.24.src/fpw.php	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/fpw.php	2011-07-22 07:32:26.000000000 -0500
@@ -11,12 +11,14 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $URL: https://e107.svn.sourceforge.net/svnroot/e107/trunk/e107_0.7/fpw.php $
-|     $Revision: 11753 $
-|     $Id: fpw.php 11753 2010-09-06 20:59:15Z e107coders $
-|     $Author: e107coders $
+|     $Id: fpw.php 12322 2011-07-22 12:32:50Z secretr $
 +----------------------------------------------------------------------------+
 */
 define('e_NOCACHE',TRUE);
+if(isset($_POST['pwsubmit']) && !isset($_POST['e-token']))
+{
+	$_POST['e-token'] = '';
+}
 require_once("class2.php");
 
 if(USER)
@@ -35,7 +37,7 @@
 }
 
 
-if (USE_IMAGECODE) 
+if (USE_IMAGECODE)
 {
 	require_once(e_HANDLER."secure_img_handler.php");
 	$sec_img = new secure_image;
@@ -43,27 +45,31 @@
 
 
 
-if ($pref['membersonly_enabled']) 
+if ($pref['membersonly_enabled'])
 {
-	if (!$FPW_TABLE_HEADER) 
+	$sc = array (
+	'FPW_LOGIN_LOGO' => file_exists(THEME."images/login_logo.png") ? "<img src='".THEME_ABS."images/login_logo.png' alt='' />\n" : "<img src='".e_IMAGE_ABS."logo.png' alt='' />\n"
+	);
+
+	//if (!$FPW_TABLE_HEADER)
 	{
-		if (file_exists(THEME."fpw_template.php")) 
+		if (file_exists(THEME."fpw_template.php"))
 		{
 			require_once(THEME."fpw_template.php");
-		} 
-		else 
+		}
+		else
 		{
 			require_once(e_THEME."templates/fpw_template.php");
 		}
 	}
-	$HEADER = preg_replace("/\{(.*?)\}/e", '$\1', $FPW_TABLE_HEADER);
-	$FOOTER = preg_replace("/\{(.*?)\}/e", '$\1', $FPW_TABLE_FOOTER);
+	$HEADER = $tp->simpleParse($FPW_TABLE_HEADER, $sc);
+	$FOOTER = $tp->simpleParse($FPW_TABLE_FOOTER, $sc);
 }
 
 require_once(HEADERF);
 
 
-function fpw_error($txt) 
+function fpw_error($txt)
 {
 	global $ns;
 	$ns->tablerender(LAN_03, "<div style='text-align:center'>".$txt."</div>");
@@ -77,19 +83,19 @@
 
 
 
-if (e_QUERY) 
+if (e_QUERY)
 {	// User has clicked on the emailed link
 	define("FPW_ACTIVE","TRUE");
 	$tmp = explode($fpw_sep, e_QUERY);
 	$tmpinfo = preg_replace("#[\W_]#", "", $tp -> toDB($tmp[0], true));
-	if ($sql->db_Select("tmp", "*", "`tmp_info` LIKE '%{$fpw_sep}{$tmpinfo}' ")) 
+	if ($sql->db_Select("tmp", "*", "`tmp_info` LIKE '%{$fpw_sep}{$tmpinfo}' "))
 	{
 		$row = $sql->db_Fetch();
 		extract($row);
 		$sql->db_Delete("tmp", "`tmp_info` LIKE '%{$fpw_sep}{$tmpinfo}' ");
 		$newpw = "";
 		$pwlen = rand(8, 12);
-		for($a = 0; $a <= $pwlen; $a++) 
+		for($a = 0; $a <= $pwlen; $a++)
 		{
 			$newpw .= chr(rand(97, 122));
 		}
@@ -105,11 +111,11 @@
 		<tr><td>".LAN_218."</td><td style='font-weight:bold'>{$loginName}</td></tr>
 		<tr><td>".LAN_FPW9."</td><td style='font-weight:bold'>{$newpw}</td></tr>
 		</table>
-		<br /><br />".LAN_FPW10." <a href='".e_LOGIN."'>".LAN_FPW11."</a> ".LAN_FPW12."</div>";
+		<br /><br />".LAN_FPW10." <a href=\"".e_LOGIN."\">".LAN_FPW11."</a> ".LAN_FPW12."</div>";
 		fpw_error($txt);
 
-	} 
-	else 
+	}
+	else
 	{
 		fpw_error(LAN_FPW7);
 	}
@@ -118,38 +124,41 @@
 
 // Request to reset password
 //--------------------------
-if (isset($_POST['pwsubmit'])) 
+if (isset($_POST['pwsubmit']))
 {	// Request for password reset submitted
 	require_once(e_HANDLER."mail.php");
 	$email = $_POST['email'];
 
-	if ($pref['fpwcode'] && extension_loaded("gd")) 
+	if ($pref['fpwcode'] && extension_loaded("gd"))
 	{
-		if (!$sec_img->verify_code($_POST['rand_num'], $_POST['code_verify'])) 
+		if (!$sec_img->verify_code($_POST['rand_num'], $_POST['code_verify']))
 		{
 			fpw_error(LAN_FPW3);
 		}
 	}
 
 	$clean_email = check_email($tp -> toDB($_POST['email']));
-	$clean_username = $tp -> toDB($_POST['username']);
+//	$clean_username = $tp -> toDB($_POST['username']);
+	$clean_username = 	$temp_name = str_replace('--', '', trim(preg_replace("/[\^\*\|\/;:#=\$'\"!#`\s\(\)%\?<>\\{}]/", '', $_POST['username'])));
+
+
  	$query = "`user_email`='{$clean_email}' ";
 	// Allow admins to remove 'username' from fpw_template.php if they wish.
 	$query .= (isset($_POST['username'])) ? " AND `user_loginname`='{$clean_username}'" : "";
 
-	if ($sql->db_Select("user", "*", $query)) 
+	if ($sql->db_Select("user", "*", $query))
 	{	// Found user in DB
 		$row = $sql->db_Fetch();
 		 extract($row);
 
-		if ($row['user_admin'] == 1 && $row['user_perms'] == "0") 
+		if ($row['user_admin'] == 1 && $row['user_perms'] == "0")
 		{	// Main admin expected to be competent enough to never forget password! (And its a security check - so warn them)
 			sendemail($pref['siteadminemail'], LAN_06, LAN_07."".$e107->getip()." ".LAN_08);
 			echo "<script type='text/javascript'>document.location.href='index.php'</script>\n";
 			die();
 		}
 
-		if ($result = $sql->db_Select("tmp", "*", "`tmp_ip` = 'pwreset' AND `tmp_info` LIKE '{$row['user_loginname']}{$fpw_sep}%'")) 
+		if ($result = $sql->db_Select("tmp", "*", "`tmp_ip` = 'pwreset' AND `tmp_info` LIKE '{$row['user_loginname']}{$fpw_sep}%'"))
 		{
 			fpw_error(LAN_FPW4);
 			exit;
@@ -170,11 +179,11 @@
 		$sql->db_Insert("tmp", "'pwreset',{$deltime},'{$row['user_loginname']}{$fpw_sep}{$rcode}'");
 
 
-		if (sendemail($_POST['email'], "".LAN_09."".SITENAME, $message)) 
+		if (sendemail($_POST['email'], "".LAN_09."".SITENAME, $message))
 		{
 			$text = "<div style='text-align:center'>".LAN_FPW6."</div>";
-		} 
-		else 
+		}
+		else
 		{
 			$text = "<div style='text-align:center'>".LAN_02."</div>";
 		}
@@ -182,35 +191,37 @@
 		$ns->tablerender(LAN_03, $text);
 		require_once(FOOTERF);
 		exit;
-	} 
-	else 
+	}
+	else
 	{
 		$text = LAN_213;
 		$ns->tablerender(LAN_214, "<div style='text-align:center'>".$text."</div>");
 	}
 }
 
-
-if (USE_IMAGECODE) 
+$sc = array();
+if (USE_IMAGECODE)
 {
-	$FPW_TABLE_SECIMG_LAN = LAN_FPW2;
-	$FPW_TABLE_SECIMG_HIDDEN = "<input type='hidden' name='rand_num' value='".$sec_img->random_number."' />";
-	$FPW_TABLE_SECIMG_SECIMG = $sec_img->r_image();
-	$FPW_TABLE_SECIMG_TEXTBOC = "<input class='tbox' type='text' name='code_verify' size='15' maxlength='20' />";
+	$sc = array (
+		'FPW_TABLE_SECIMG_LAN' => LAN_FPW2,
+		'FPW_TABLE_SECIMG_HIDDEN' => "<input type='hidden' name='rand_num' value='".$sec_img->random_number."' />",
+		'FPW_TABLE_SECIMG_SECIMG' => $sec_img->r_image(),
+		'FPW_TABLE_SECIMG_TEXTBOC' => "<input class='tbox' type='text' name='code_verify' size='15' maxlength='20' />"
+	);
 }
 
-if (!$FPW_TABLE) 
+if (!$FPW_TABLE)
 {
-	if (file_exists(THEME."fpw_template.php")) 
+	if (file_exists(THEME."fpw_template.php"))
 	{
 		require_once(THEME."fpw_template.php");
-	} 
-	else 
+	}
+	else
 	{
 		require_once(e_THEME."templates/fpw_template.php");
 	}
 }
-$text = preg_replace("/\{(.*?)\}/e", '$\1', $FPW_TABLE);
+$text = $tp->simpleParse($FPW_TABLE, $sc);
 
 $ns->tablerender(LAN_03, $text);
 require_once(FOOTERF);
diff -x .svn -aruN 0.7.24.src/login.php 0.7.26.src/login.php
--- 0.7.24.src/login.php	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/login.php	2011-06-29 00:38:50.000000000 -0500
@@ -11,8 +11,8 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $URL: https://e107.svn.sourceforge.net/svnroot/e107/trunk/e107_0.7/login.php $
-|     $Revision: 11678 $
-|     $Id: login.php 11678 2010-08-22 00:43:45Z e107coders $
+|     $Revision: 12296 $
+|     $Id: login.php 12296 2011-06-29 05:39:14Z e107coders $
 |     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
@@ -25,7 +25,8 @@
 }
 
 require_once("class2.php");
-if (USER)
+
+if (USER || e_LOGIN !='login.php') // Disable page if user logged in, or some custom e_LOGIN value is used. 
 {
 	header('location:'.e_BASE.'index.php');
 	exit();
@@ -90,7 +91,9 @@
 	echo $tp->simpleParse($LOGIN_TABLE_FOOTER, $tVars, false);
 }
 
-echo "</body></html>";
+$FOOTER = "";
+require_once(FOOTERF);
+//echo "</body></html>";
 
 $sql->db_Close();
 
diff -x .svn -aruN 0.7.24.src/membersonly.php 0.7.26.src/membersonly.php
--- 0.7.24.src/membersonly.php	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/membersonly.php	2011-06-29 00:38:50.000000000 -0500
@@ -11,8 +11,8 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $URL: https://e107.svn.sourceforge.net/svnroot/e107/trunk/e107_0.7/membersonly.php $
-|     $Revision: 11678 $
-|     $Id: membersonly.php 11678 2010-08-22 00:43:45Z e107coders $
+|     $Revision: 12296 $
+|     $Id: membersonly.php 12296 2011-06-29 05:39:14Z e107coders $
 |     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
@@ -38,4 +38,5 @@
 $ns->tablerender($MEMBERSONLY_CAPTION, $MEMBERSONLY_TABLE); 
 echo $MEMBERSONLY_END;
 
+require_once(FOOTERF);
 ?>
diff -x .svn -aruN 0.7.24.src/news.php 0.7.26.src/news.php
--- 0.7.24.src/news.php	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/news.php	2011-07-23 16:02:20.000000000 -0500
@@ -11,8 +11,8 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $URL: https://e107.svn.sourceforge.net/svnroot/e107/trunk/e107_0.7/news.php $
-|     $Revision: 11678 $
-|     $Id: news.php 11678 2010-08-22 00:43:45Z e107coders $
+|     $Revision: 12324 $
+|     $Id: news.php 12324 2011-07-23 21:02:44Z e107coders $
 |     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
@@ -66,9 +66,9 @@
 
 if ($action == 'all' || $action == 'cat') 
 {
-  $sub_action = intval(varset($tmp[1],0));
+	$sub_action = intval(varset($tmp[1],0));
 }
-
+unset($tmp);
 /*
 Variables Used:
 	$action - the basic display format/filter
@@ -237,8 +237,9 @@
 		{
 		  if($pref['meta_news_summary'] && $news['news_title'])
 		  {
-			define('META_DESCRIPTION',SITENAME.': '.$news['news_title'].' - '.$news['news_summary']);
+				setNewsMeta('extend',$news);
 		  }
+		  
 		  define("e_PAGETITLE",$news['news_title']);
 		}
 
@@ -246,26 +247,33 @@
 		{
 			/* Added by nlStart - show links to previous and next news */
 			if (!isset($news['news_extended'])) $news['news_extended'] = '';
-			$news['news_extended'].="<div style='text-align:center;'><a href='".e_SELF."?cat.".$id."'>".LAN_NEWS_85."</a> &nbsp; <a href='".e_SELF."'>".LAN_NEWS_84."</a></div>";
+			
+			$news['news_extended'].="<div style='text-align:center;'><a class='news-extended-category-link' href='".e_SELF."?cat.".$id."'>".LAN_NEWS_85."</a> &nbsp; <a class='news-extended-overview-link' href='".e_SELF."'>".LAN_NEWS_84."</a></div>";
+			
 			$prev_query = "SELECT news_id, news_title FROM `#news`
 				WHERE `news_id` < ".intval($sub_action)." AND `news_category`=".$id." AND `news_class` REGEXP '".e_CLASS_REGEXP."' 
 				AND NOT (`news_class` REGEXP ".$nobody_regexp.") 
 				AND `news_start` < ".time()." AND (`news_end`=0 || `news_end` > ".time().') ORDER BY `news_id` DESC LIMIT 1';
+			
 			$sql->db_Select_gen($prev_query);
 			$prev_news = $sql->db_Fetch();
+			
 			if ($prev_news)
 			{
-				$news['news_extended'].="<div style='float:right;'><a href='".e_SELF."?extend.".$prev_news['news_id']."'>".LAN_NEWS_86."</a></div>";
+				$news['news_extended'].="<div class='news-extended-older' style='float:left;'><a class='news-extended-older' href='".e_SELF."?extend.".$prev_news['news_id']."'>".LAN_NEWS_86."</a></div>";
 			}
+			
 			$next_query = "SELECT news_id, news_title FROM `#news` AS n
 				WHERE `news_id` > ".intval($sub_action)." AND `news_category` = ".$id." AND `news_class` REGEXP '".e_CLASS_REGEXP."' 
 				AND NOT (`news_class` REGEXP ".$nobody_regexp.") 
 				AND `news_start` < ".time()." AND (`news_end`=0 || `news_end` > ".time().') ORDER BY `news_id` ASC LIMIT 1';
+			
 			$sql->db_Select_gen($next_query);
 			$next_news = $sql->db_Fetch();
+			
 			if ($next_news)
 			{
-				$news['news_extended'].="<div style='float:left;'><a href='".e_SELF."?extend.".$next_news['news_id']."'>".LAN_NEWS_87."</a></div>";
+				$news['news_extended'].="<div class='news-extended-newer' style='float:right;'><a class='news-extended-newer' href='".e_SELF."?extend.".$next_news['news_id']."'>".LAN_NEWS_87."</a></div>";
 			}
 			$news['news_extended'].="<br /><br />";
 		}
@@ -455,7 +463,8 @@
 {
     if($action == "item" && $pref['meta_news_summary'] && $newsAr[1]['news_title'])
 	{
-	  define("META_DESCRIPTION",SITENAME.": ".$newsAr[1]['news_title']." - ".$newsAr[1]['news_summary']);
+		setNewsMeta('item',$newsAr[1]);
+		// define("META_DESCRIPTION",SITENAME.": ".$newsAr[1]['news_title']." - ".$newsAr[1]['news_summary']);
 	}
 	define("e_PAGETITLE", $p_title);
 }
@@ -508,6 +517,7 @@
 	$text = preg_replace("/\{(.*?)\}/e", '$\1', $NEWSCLAYOUT);
 
 	require_once(HEADERF);
+	$sub_action = intval($sub_action);
 	$parms = $news_total.",".ITEMVIEW.",".$newsfrom.",".e_SELF.'?'.($action ? $action : 'default' ).($sub_action ? ".".$sub_action : ".0").".[FROM]";
     $nextprev = $tp->parseTemplate("{NEXTPREV={$parms}}");
     $text .= ($nextprev ? "<div class='nextprev'>".$nextprev."</div>" : "");
@@ -551,6 +561,7 @@
 		$ix->render_newsitem($news);
 		$i++;
 	}
+	$sub_action = intval($sub_action);
 	$parms = $news_total.",".ITEMVIEW.",".$newsfrom.",".e_SELF.'?'.($action ? $action : 'default' ).($sub_action ? ".".$sub_action : ".0").".[FROM]";
 	$nextprev = $tp->parseTemplate("{NEXTPREV={$parms}}");
  	echo ($nextprev ? "<div class='nextprev'>".$nextprev."</div>" : "");
@@ -627,8 +638,10 @@
 }
 // #### END -----------------------------------------------------------------------------------------------------------
 
-if ($action != "item") {
-	if (is_numeric($action)){
+if ($action != "item") 
+{
+	if (is_numeric($action))
+	{
 		$action = "";
 	}
  //	$parms = $news_total.",".ITEMVIEW.",".$newsfrom.",".e_SELF.'?'."[FROM].".$action.(isset($sub_action) ? ".".$sub_action : "");
@@ -665,6 +678,34 @@
 	$e107cache->set($cache_tag, $cache_data);
 	$e107cache->set($cache_tag."_title", defined("e_PAGETITLE") ? e_PAGETITLE : '');
 	$e107cache->set($cache_tag."_diz", defined("META_DESCRIPTION") ? META_DESCRIPTION : '');
+	$e107cache->set($cache_tag."_og", defined("META_OG") ? META_OG : '');
+}
+
+/**
+ * Mode: extend or item
+ */
+function setNewsMeta($mode,$news)
+{
+	if($news['news_thumbnail'])
+	{
+		$image = (substr($news['news_thumbnail'],0,3)=="{e_") ? $tp->replaceConstants($news['news_thumbnail']) : SITEURL.e_IMAGE."newspost_images/".$news['news_thumbnail'];	
+	}
+	else
+	{
+		$image = "";
+	}
+		
+	$og_array = array(
+		'title'			=> $news['news_title'],
+		'type'			=> 'article',		  		
+		'url'			=> e_SELF."?".$mode.".".$news['news_id'],
+		'image'			=> ($image) ? $image : '',
+		'description' 	=> $news['news_summary'],
+		'site_name'		=> SITENAME
+	);
+		  	
+	define('META_OG',serialize($og_array));
+	define('META_DESCRIPTION',SITENAME.': '.$news['news_title'].' - '.$news['news_summary']);
 }
 
 function checkCache($cacheString){
@@ -672,14 +713,27 @@
 	$cache_data = $e107cache->retrieve($cacheString);
 	$cache_title = $e107cache->retrieve($cacheString."_title");
 	$cache_diz = $e107cache->retrieve($cacheString."_diz");
+	$cache_og = $e107cache->retrieve($cacheString."_og");
+	
 	$etitle = ($cache_title != "e_PAGETITLE") ? $cache_title : "";
-	$ediz = ($cache_diz != "META_DESCRIPTION") ? $cache_diz : "";
-	if($etitle){
+	$ediz	= ($cache_diz != "META_DESCRIPTION") ? $cache_diz : "";
+	$og		= ($cache_og != "META_OG") ? $cache_og : "";
+	
+	if($etitle)
+	{
 		define(e_PAGETITLE,$etitle);
 	}
-	if($ediz){
+	
+	if($ediz)
+	{
     	define("META_DESCRIPTION",$ediz);
 	}
+	
+	if($og)
+	{
+		define("META_OG",$og);
+	}	
+
 	if ($cache_data) {
 		return $cache_data;
 	} else {
diff -x .svn -aruN 0.7.24.src/page.php 0.7.26.src/page.php
--- 0.7.24.src/page.php	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/page.php	2011-06-28 20:09:22.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $URL: https://e107.svn.sourceforge.net/svnroot/e107/trunk/e107_0.7/page.php $
-|     $Revision: 11787 $
-|     $Id: page.php 11787 2010-09-16 13:04:59Z e107steved $
-|     $Author: e107steved $
+|     $Revision: 12290 $
+|     $Id: page.php 12290 2011-06-29 01:09:46Z e107coders $
+|     $Author: e107coders $
 |
 +----------------------------------------------------------------------------+
 */
@@ -203,6 +203,14 @@
 		{
 			$ptitle = "<div class='cpage_title'>".$this -> title."</div>";
 		}
+		
+
+		if(ADMIN && getperms("5"))
+		{
+ 			$text .= "<a href='".e_ADMIN_ABS."cpage.php?create.edit.".$this -> pageID."'>
+			<img src='".e_IMAGE_ABS."/admin_images/edit_16.png' alt='edit' title='Edit' style='border: 0px none; height: 16px; width: 16px;'>
+			</a><br />";
+		}
 
 		$text .= $this -> pageToRender;
 		$text .= $this -> pageIndex();
diff -x .svn -aruN 0.7.24.src/request.php 0.7.26.src/request.php
--- 0.7.24.src/request.php	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/request.php	2011-07-29 14:47:45.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $URL: https://e107.svn.sourceforge.net/svnroot/e107/trunk/e107_0.7/request.php $
-|     $Revision: 11704 $
-|     $Id: request.php 11704 2010-08-25 15:05:34Z secretr $
-|     $Author: secretr $
+|     $Revision: 12327 $
+|     $Id: request.php 12327 2011-07-29 19:48:09Z e107coders $
+|     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
 
@@ -21,6 +21,10 @@
 
 // Prevent token re-generation
 define('e_TOKEN_FREEZE', true);
+if($_SESSION['download_splash'])
+{
+	define('e_NOCACHE',TRUE);
+}
 
 require_once("class2.php");
 include_lan(e_LANGUAGEDIR.e_LANGUAGE."/lan_download.php");
@@ -33,10 +37,12 @@
 
 // ---------------------- Experimental ----------
 
+
 $req_cookie = 'e-request_'.md5($_SERVER['SERVER_ADDR']);
 
-if(isset($_COOKIE[$req_cookie]))
+if(isset($_COOKIE[$req_cookie]) && ($_COOKIE[$req_cookie]!= intval(e_QUERY)) && $_SESSION['download_splash'] !==TRUE) // if cookie found, suggest to try later
 {
+	$_SESSION['download_splash'] = FALSE;
 	require_once(HEADERF);
 	$srch = array("[", "]");
 	$repl = array("<a href='".$_SERVER['REQUEST_URI']."'>", "</a>");
@@ -44,16 +50,18 @@
 	
 	$ns->tablerender(LAN_dl_82,$text);
 	require_once(FOOTERF);
+	
 	exit();
 }
 
-if(varset($pref['download_nomultiple'])==1)
+if(varset($pref['download_nomultiple'])==1 )
 {
-	if(!setcookie($req_cookie, 1, time() + 60, "/"))
+	if(!setcookie($req_cookie, intval(e_QUERY), time() + 30, "/")) // set the cookie and if it fails, request cookies be enabled
 	{
+		$_SESSION['download_splash'] = FALSE;
 		require_once(HEADERF);
-		$srch = array("[", "]");
-		$repl = array("<a href='".$_SERVER['REQUEST_URI']."'>", "</a>");
+		$srch = array("]","[");
+		$repl = array("</a>","<a href='".$_SERVER['REQUEST_URI']."'>");
 		$text = str_replace($srch,$repl,LAN_dl_80);
 		$ns->tablerender(LAN_dl_81, $text);
 		require_once(FOOTERF);
@@ -146,6 +154,76 @@
 }
 
 
+if(varset($pref['download_splashdelay'])==1 )
+{
+	
+	if($type == 'file' && !varsettrue($_SESSION['download_splash']) && (e_MENU != "nosplash")) // just received request, so show page and refresh after a pause. 
+	{	
+		$SPLASH_PREVIEW = ((e_QUERY == "preview") && getperms('0')) ? TRUE : FALSE;
+		
+		if(!$SPLASH_PREVIEW)
+		{
+			$_SESSION['download_splash'] = TRUE;
+			
+			$theLink = SITEURL."request.php?".intval(e_QUERY);
+			header("Refresh: 3; url=\"".$theLink."\"");
+
+			function core_head() // deprecated function in 0.8
+			{
+				return '<meta http-equiv="refresh" content="5; URL=request.php?'.intval(e_QUERY).'" />';	// in case the header fails. 
+			}
+				
+		}
+		
+		require_once(HEADERF);
+	
+		$template_name = "request_template.php";
+		if(is_readable(THEME."templates/".$template_name))
+		{
+			require_once(THEME."templates/".$template_name);
+		}
+		elseif(is_readable(THEME.$template_name))
+		{
+			require_once(THEME.$template_name);
+		}
+		else
+		{
+			require_once(e_THEME."templates/".$template_name);
+		}
+		
+		$srch = array();
+		$repl = array();
+		
+		$srch[0] = "{REQUEST_MESSAGE}";
+		$repl[0] = defined("LAN_dl_83") ? LAN_dl_83 : "Your download will begin in a moment..."; 
+			
+		$srch[1] = "{REQUEST_CLICKLINK}";
+		$repl[1] = defined("LAN_dl_84") ? LAN_dl_84 : "If your download doesn't start within a few seconds, please [click here]."; 
+			
+		$srch[2] = "]";
+		$repl[2] = "</a>";
+		
+		$srch[3] = "[";
+		$repl[3] = "<a class='request-splash-clicklink' href='request.php?[nosplash]".intval(e_QUERY)."'>";
+		
+		$text = str_replace($srch,$repl,$REQUEST_TEMPLATE);
+				
+		$final_text = $tp->parseTemplate($text,TRUE);
+		
+		$ns->tablerender(LAN_dl_82,$final_text,'request-splash');
+		
+		require_once(FOOTERF);		
+		exit;		
+	} 
+	else // redirected, so continue.
+	{
+		$_SESSION['download_splash'] = FALSE;
+	}	
+		
+}
+
+
+
 if (preg_match("#.*\.[a-z,A-Z]{3,4}#", e_QUERY)) 
 {
 	if(strstr(e_QUERY, "pub_"))
@@ -390,9 +468,14 @@
 		header("Location: ".SITEURL.$file);
 		exit();
 	}
+	
 	@set_time_limit(10 * 60);
+	@session_write_close();
 	@e107_ini_set("max_execution_time", 10 * 60);
 	while (@ob_end_clean()); // kill all output buffering else it eats server resources
+	@ob_implicit_flush(TRUE);
+	
+	
 	$filename = $file;
 	$file = basename($file);
 	$path = realpath($filename);
diff -x .svn -aruN 0.7.24.src/search.php 0.7.26.src/search.php
--- 0.7.24.src/search.php	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/search.php	2011-09-02 05:37:40.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $URL: https://e107.svn.sourceforge.net/svnroot/e107/trunk/e107_0.7/search.php $
-|     $Revision: 11678 $
-|     $Id: search.php 11678 2010-08-22 00:43:45Z e107coders $
-|     $Author: e107coders $
+|     $Revision: 12341 $
+|     $Id: search.php 12341 2011-09-02 10:38:04Z secretr $
+|     $Author: secretr $
 +----------------------------------------------------------------------------+
 */
 
@@ -180,7 +180,7 @@
 	elseif ($search_prefs['time_restrict']) {
 		$time = time() - $search_prefs['time_secs'];
 		$query_check = $tp -> toDB($full_query);
-		$ip = getip();
+		$ip = $e107->getip();
 		if ($sql -> db_Select("tmp", "tmp_ip, tmp_time, tmp_info", "tmp_info LIKE 'type_search%' AND tmp_ip='".$ip."'")) {
 			$row = $sql -> db_Fetch();
 			if (($row['tmp_time'] > $time) && ($row['tmp_info'] != 'type_search '.$query_check)) {
diff -x .svn -aruN 0.7.24.src/signup.php 0.7.26.src/signup.php
--- 0.7.24.src/signup.php	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/signup.php	2011-04-12 16:09:21.000000000 -0500
@@ -11,7 +11,7 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $URL: https://e107.svn.sourceforge.net/svnroot/e107/trunk/e107_0.7/signup.php $
-|     $Id: signup.php 11760 2010-09-07 17:02:27Z e107steved $
+|     $Id: signup.php 12130 2011-04-12 21:09:45Z e107steved $
 +----------------------------------------------------------------------------+
 */
 
@@ -54,12 +54,12 @@
 	$errmsg = '';
 	require_once(HEADERF);
 
-    if(!$clean_email = check_email($tp -> toDB($_POST['resend_email'])))
+    if (!($clean_email = check_email($tp -> toDB($_POST['resend_email']))))
 	{
 		$clean_email = "xxx";
 	}
 
-    if(!$new_email = check_email($tp -> toDB($_POST['resend_newemail'])))
+    if (!($new_email = check_email($tp -> toDB($_POST['resend_newemail']))))
 	{
     	$new_email = FALSE;
 	}
@@ -75,19 +75,27 @@
 
 		if(trim($_POST['resend_password']) !="" && $new_email)
 		{
-        	if($sql->db_Select("user", "user_id", "user_password = \"".md5($_POST['resend_password'])."\" AND user_ban=2 AND user_sess !='' LIMIT 1"))
+        	if (($count = $sql->db_Select("user", "user_id", "user_password = \"".md5($_POST['resend_password'])."\" AND user_ban=2 AND user_sess !=''")) === 1)
 			{
+			//  Check for duplicate email
 				$row = $sql -> db_Fetch();
-            	if($sql->db_Update("user", "user_email='".$new_email."' WHERE user_id = '".$row['user_id']."' LIMIT 1 "))
+				if ($sql->db_select('user', 'user_id, user_email', "user_email='".$new_email."'"))
+				{	// Email address already used by someone
+					$ns -> tablerender(LAN_ERROR,LAN_SIGNUP_106);
+					require_once(FOOTERF);
+					exit;
+				}
+            	elseif($sql->db_Update("user", "user_email='".$new_email."' WHERE user_id = '".$row['user_id']."' LIMIT 1 "))
 				{
                 	$clean_email = $new_email;
 				}
 			}
 			else
 			{
-			   	//require_once(e_HANDLER."message_handler.php");
-			   	//message_handler("ALERT",LAN_SIGNUP_52); // Incorrect Password.
-			   	$errmsg = LAN_SIGNUP_52;
+				// Incorrect password, or multiple users with same password
+                $ns -> tablerender(LAN_ERROR,LAN_SIGNUP_105);
+                require_once(FOOTERF);
+                exit;
 			}
 		}
 
@@ -395,9 +403,14 @@
 	if($_POST['password1xup']) $_POST['password1'] = $_POST['password1xup'];
 	if($_POST['password2xup']) $_POST['password2'] = $_POST['password2xup'];
 
-//	Strip most invalid characters now %*|/|&nbsp;|\#|\=|\$%
-// another option would be /[^\w\pL\.]/u (non latin words)
-	$temp_name = trim(preg_replace('#[^a-z0-9_\.]#i', "", strip_tags($_POST['loginname'])));
+	//	Strip most invalid characters now %*|/|&nbsp;|\#|\=|\$%
+	// another option would be /[^\w\pL\.]/u (non latin words)
+
+	// /[\^\*\|\/;:#=\$'!#`\s\(\)%\?<>\\{}~@] // check for invalid characters
+	// [^a-z0-9_\.] this is not multi-language compatible
+	
+	//$temp_name = trim(preg_replace("/[\^\*\|\/;:#=\$'!#`\s\(\)%\?<>\\{}~@]/", "", strip_tags($_POST['loginname'])));
+	$temp_name = str_replace('--', '', trim(preg_replace("/[\^\*\|\/;:#=\$'\"!#`\s\(\)%\?<>\\{}]/", '', strip_tags($_POST['loginname']))));
 	if ($temp_name != $_POST['loginname'])
 	{
 		$error_message .= LAN_409."\\n";
@@ -405,7 +418,7 @@
 	}
 	$_POST['loginname'] = $temp_name;
 
-	if (strcasecmp($_POST['loginname'],"Anonymous") == 0)
+	if ((strcasecmp($_POST['loginname'],"Anonymous") == 0) || (strcasecmp($_POST['loginname'],LAN_ANONYMOUS) == 0))
 	{
 		$error_message .= LAN_103."\\n";
 		$error = TRUE;
@@ -640,16 +653,58 @@
 	}
 
 
-	// Avatar validation (already checked if compulsory field not filled in)
-	if ((varset($pref['signup_option_image'],0) > 0) && $_POST['image'])
+
+
+/**
+ *	Does some basic checks on a string claiming to represent an off-site image
+ *
+ *	@param string $imageName
+ *
+ *	@return boolean|string FALSE for unacceptable, potentially modified string if acceptable
+ */
+function checkRemoteImage($imageName)
+{
+	$newImageName = trim(str_replace(array('\'', '"', '(', ')'), '', $imageName));		// Strip invalid characters
+	if ($imageName != $newImageName)
+	{
+		return FALSE;
+	}
+	if (!preg_match('#(?:localhost|\..{2,6})\/.+\.(?:jpg|jpeg|png|svg|gif)$#i', $newImageName))
 	{
-		$_POST['image'] = str_replace(array('\'', '"', '(', ')'), '', $_POST['image']);   // these are invalid anyway, so why allow them? (XSS Fix)
-		$avName = e_IMAGE.'avatars/'.$tp -> toDB($_POST['image']);
-		if ($size = getimagesize($avName))
+		return FALSE;
+	}
+	return $newImageName;
+}
+
+
+	// Avatar validation (already checked if compulsory field not filled in)
+	$avName = varset($_POST['image'], '');
+	$_POST['image'] = '';
+	if ((varset($pref['signup_option_image'],0) > 0) && $avName)
+	{
+		$avmsg = '';
+		$avName = str_replace(array('\'', '"', '(', ')'), '', $avName);   // these are invalid anyway, so why allow them? (XSS Fix)
+		if (strpos($avName, '/') !== FALSE)
+		{	// Assume an off-site image
+			$avFullName = $avName = checkRemoteImage($avName);
+			if ($avName === FALSE)
+			{
+				$avmsg = LAN_SIGNUP_104;
+			}
+		}
+		else
+		{	// Its one of the standard choices
+			$avName = $tp -> toDB($avName);
+			$avFullName = e_IMAGE.'avatars/'.$avName;
+			if (!is_readable($avFullName))
+			{
+				$avmsg = LAN_SIGNUP_60;			// Error accessing avatar
+			}
+		}
+		if (!$avmsg && ($size = getimagesize($avFullName)))
 		{
 			$avwidth = $size[0];
 			$avheight = $size[1];
-			$avmsg = "";
 	
 			$pref['im_width'] = varset($pref['im_width'], 120);
 			$pref['im_height'] = varset($pref['im_height'], 100);
@@ -668,14 +723,13 @@
 		}
 		if ($avmsg) 
 		{
-			$_POST['image'] = "";
 			$error_message .= $avmsg;
 			$error = TRUE;
 		}
-	}
-	else
-	{
-		$_POST['image'] = "";
+		else
+		{
+			$_POST['image'] = $avName;
+		}
 	}
 
 
diff -x .svn -aruN 0.7.24.src/sitedown.php 0.7.26.src/sitedown.php
--- 0.7.24.src/sitedown.php	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/sitedown.php	2011-06-13 21:44:11.000000000 -0500
@@ -11,14 +11,14 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $URL: https://e107.svn.sourceforge.net/svnroot/e107/trunk/e107_0.7/sitedown.php $
-|     $Revision: 11678 $
-|     $Id: sitedown.php 11678 2010-08-22 00:43:45Z e107coders $
+|     $Revision: 12260 $
+|     $Id: sitedown.php 12260 2011-06-14 02:44:35Z e107coders $
 |     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
 require_once('class2.php');
 
-if (!varset($pref['maintainance_flag']))
+if (!varset($pref['maintainance_flag']) && !getperms('0')) // Allow main admin to test and view template before going offline.
 {
 	header('location: '.SITEURL);
 	exit();
diff -x .svn -aruN 0.7.24.src/submitnews.php 0.7.26.src/submitnews.php
--- 0.7.24.src/submitnews.php	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/submitnews.php	2011-01-05 03:38:31.000000000 -0600
@@ -11,8 +11,8 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $URL: https://e107.svn.sourceforge.net/svnroot/e107/trunk/e107_0.7/submitnews.php $
-|     $Revision: 11678 $
-|     $Id: submitnews.php 11678 2010-08-22 00:43:45Z e107coders $
+|     $Revision: 12027 $
+|     $Id: submitnews.php 12027 2011-01-05 09:38:55Z e107coders $
 |     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
@@ -40,6 +40,17 @@
 	exit;
 }
 
+
+		$newsCat = array();
+		if($sql->db_Select('news_category'))
+		{
+			while($row = $sql->db_Fetch())
+			{
+				$newsCat[$row['category_id']] = $row['category_name'];
+			}	
+		}
+		
+
 if (isset($_POST['submitnews_submit']) && $_POST['submitnews_title'] && $_POST['submitnews_item'])
 {
 	$ip = $e107->getip();
@@ -131,10 +142,10 @@
 
 	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);
+		$id = $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,"itemid"=>$id, "itemtitle" => $submitnews_title, "catid" => intval($_POST['cat_id']),"catname" => $newsCat[$_POST['cat_id']], "item" => $submitnews_item, "image" => $submitnews_file, "ip" => $ip);
 		$e_event->trigger("subnews", $edata_sn);
-		$ns->tablerender(LAN_133, "<div style='text-align:center'>".LAN_134."</div>");
+		$ns->tablerender(LAN_133, "<div class='submitnews-submitted' style='text-align:center'>".LAN_134."</div>");
 		require_once(FOOTERF);
 		exit;
 	}
@@ -182,15 +193,17 @@
   <td style='width:20%' class='forumheader3'>".NWSLAN_6.": </td>
 	<td style='width:80%' class='forumheader3'>";
 
-if (!$sql->db_Select("news_category"))
+if (!count($newsCat))
 {
 	$text .= NWSLAN_10;
 }
 else
 {
 	$text .= "
-		<select name='cat_id' class='tbox'>";
-	while (list($cat_id, $cat_name, $cat_icon) = $sql->db_Fetch())
+		<select name='cat_id' class='tbox'>
+		<option value=''>&nbsp;</option>\n";
+		foreach($newsCat as $cat_id=>$cat_name)
+	// while (list($cat_id, $cat_name, $cat_icon) = $sql->db_Fetch())
 	{
 		$sel = (varset($_POST['cat_id'],'') == $cat_id) ? "selected='selected'" : "";
 		$text .= "<option value='{$cat_id}' {$sel}>".$tp->toHTML($cat_name, FALSE, "defs")."</option>";
diff -x .svn -aruN 0.7.24.src/top.php 0.7.26.src/top.php
--- 0.7.24.src/top.php	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/top.php	2011-05-21 03:00:44.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $URL: https://e107.svn.sourceforge.net/svnroot/e107/trunk/e107_0.7/top.php $
-|     $Revision: 11678 $
-|     $Id: top.php 11678 2010-08-22 00:43:45Z e107coders $
-|     $Author: e107coders $
+|     $Revision: 12223 $
+|     $Id: top.php 12223 2011-05-21 08:01:08Z e107steved $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 require_once("class2.php");
@@ -75,14 +75,14 @@
 		 
 		while ($row = $sql->db_Fetch()) {
 			extract($row);
-			if (check_class($forum_class)) {
-
+			if (check_class($forum_class)) 
+			{
 				if($user_name)
 				{
 					$POSTER = "<a href='".e_HTTP."user.php?id.{$thread_user}'>{$user_name}</a>";
-				} else {
-					list($anonposter, $ipaddress) = explode(chr(1), $thread_anon);
-					$POSTER = $anonposter;
+				} else 
+				{
+					$POSTER = LAN_ANONYMOUS;
 				}
 
 				$LINKTOTHREAD = e_PLUGIN_ABS."forum/forum_viewtopic.php?".$thread_id;
diff -x .svn -aruN 0.7.24.src/usersettings.php 0.7.26.src/usersettings.php
--- 0.7.24.src/usersettings.php	2010-12-14 08:49:40.000000000 -0600
+++ 0.7.26.src/usersettings.php	2011-05-04 15:37:37.000000000 -0500
@@ -10,9 +10,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $URL: https://e107.svn.sourceforge.net/svnroot/e107/trunk/e107_0.7/usersettings.php $
-|     $Revision: 11707 $
-|     $Id: usersettings.php 11707 2010-08-26 23:20:16Z e107coders $
-|     $Author: e107coders $
+|     $Revision: 12188 $
+|     $Id: usersettings.php 12188 2011-05-04 20:38:01Z e107steved $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 
@@ -107,6 +107,30 @@
 }
 
 
+
+/**
+ *	Does some basic checks on a string claiming to represent an off-site image
+ *
+ *	@param string $imageName
+ *
+ *	@return boolean|string FALSE for unacceptable, potentially modified string if acceptable
+ */
+function checkRemoteImage($imageName)
+{
+	$newImageName = trim(str_replace(array('\'', '"', '(', ')'), '', $imageName));		// Strip invalid characters
+	if ($imageName != $newImageName)
+	{
+		return FALSE;
+	}
+	if (!preg_match('#(?:localhost|\..{2,6})\/.+\.(?:jpg|jpeg|png|svg|gif)$#i', $newImageName))
+	{
+		return FALSE;
+	}
+	return $newImageName;
+}
+
+
+
 // Save user settings (whether or not changed)
 //---------------------------------------------
 $error = "";
@@ -143,25 +167,74 @@
 
 
 	// Check external avatar
-	$_POST['image'] = str_replace(array('\'', '"', '(', ')'), '', $_POST['image']);   // these are invalid anyway, so why allow them? (XSS Fix)
-	if ($_POST['image'] && $size = getimagesize($_POST['image'])) {
-		$avwidth = $size[0];
-		$avheight = $size[1];
-		$avmsg = "";
-
-		$pref['im_width'] = ($pref['im_width']) ? $pref['im_width'] : 120;
-		$pref['im_height'] = ($pref['im_height']) ? $pref['im_height'] : 100;
-		if ($avwidth > $pref['im_width']) {
-			$avmsg .= LAN_USET_1." ($avwidth)<br />".LAN_USET_2.": {$pref['im_width']}<br /><br />";
+	$avName = varset($_POST['image'], '');
+	$avmsg = '';
+	$_POST['image'] = '';
+	if ($avName)
+	{
+		$avName = strip_if_magic($avName);
+		$avName = str_replace(array('\'', '"', '(', ')'), '', $avName);   // these are invalid anyway, so why allow them? (XSS Fix)
+		if (strpos($avName, '/') !== FALSE)
+		{	// Assume an off-site image
+			$avName = checkRemoteImage($avName);
+			if ($avName === FALSE)
+			{
+				$avmsg = LAN_USET_18;
+			}
+			$avFullName = $avName;
 		}
-		if ($avheight > $pref['im_height']) {
-			$avmsg .= LAN_USET_3." ($avheight)<br />".LAN_USET_4.": {$pref['im_height']}";
+		else
+		{	// Its one of the standard choices
+			$avName = $tp -> toDB($avName);
+			if (strpos($avName, '-upload-') === 0)
+			{	// Uploaded avatar
+				$avFullName = e_FILE.'public/avatars/'.str_replace('-upload-', '', $avName);
+			}
+			else
+			{	// Site-provided avatar
+				$avFullName = e_IMAGE.'avatars/'.$avName;
+			}
+			if (!is_readable($avFullName))
+			{
+				$avmsg = LAN_USET_19.': '.$avFullName;			// Error accessing avatar
+				$avName = FALSE;
+			}
 		}
-		if ($avmsg) {
-			$_POST['image'] = "";
+		if ($avmsg)
+		{
 			$error = $avmsg;
 		}
-
+		elseif (FALSE !== ($size = getimagesize($avFullName)))
+		{
+			$avwidth = $size[0];
+			$avheight = $size[1];
+			$avmsg = '';
+
+			$pref['im_width'] = ($pref['im_width']) ? $pref['im_width'] : 120;
+			$pref['im_height'] = ($pref['im_height']) ? $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']}";
+			}
+			if ($avmsg) 
+			{
+				$error = $avmsg;
+				$avName = '';
+			}
+			else
+			{
+				$_POST['image'] = $avName;
+			}
+		}
+		else
+		{
+			$error = LAN_USET_20.': '.$avFullName;
+			$avName = FALSE;
+		}
 	}
 
 	$signup_option_title = array(LAN_308, LAN_120, LAN_121, LAN_122, LAN_USET_6);
@@ -183,7 +256,7 @@
 	//	$temp_name = trim(preg_replace('#[^a-z0-9_\.]#i', "", strip_tags($_POST['loginname'])));
 	// The above preg_replace will break any non-latin login and should not be used. 
 	
-		$temp_name = htmlspecialchars($_POST['loginname'], ENT_QUOTES);
+		$temp_name = str_replace('--', '', trim(preg_replace("/[\^\*\|\/;:#=\$'\"!#`\s\(\)%\?<>\\{}]/", '', strip_tags($_POST['loginname']))));
 		if ($temp_name != $_POST['loginname'])
 		{
 			$error .= LAN_USET_13."\\n";
@@ -193,12 +266,16 @@
 		{
 			$error .= LAN_USET_14."\\n";
 		}
+		if ((strcasecmp($_POST['loginname'],"Anonymous") == 0) || (strcasecmp($_POST['loginname'],LAN_ANONYMOUS) == 0))
+		{
+			$error .= LAN_USET_11."\\n";
+		}
 		$_POST['loginname'] = $temp_name;
 	}
 
 
 // Password checks
-	$pwreset = "";
+	$pwreset = '';
 	if ($_POST['password1'] != $_POST['password2']) {
 		$error .= LAN_105."\\n";
 	}
@@ -284,7 +361,7 @@
 
 
 // Display name checks
-	if (isset($_POST['username']))
+	if (check_class($pref['displayname_class']) && isset($_POST['username']))
 	{
 	  // Impose a minimum length on display name
 	  $username = trim(strip_tags($_POST['username']));
