diff -x .svn -aruN 0.7.16.src/class2.php 0.7.17.src/class2.php
--- 0.7.16.src/class2.php	2009-08-15 06:54:05.000000000 -0500
+++ 0.7.17.src/class2.php	2010-01-20 21:57:19.000000000 -0600
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/class2.php,v $
-|     $Revision: 1.379 $
-|     $Date: 2009/08/15 11:54:29 $
-|     $Author: marj_nl_fr $
+|     $Revision: 1.389 $
+|     $Date: 2010/01/21 03:57:43 $
+|     $Author: mcfly_e107 $
 +----------------------------------------------------------------------------+
 */
 //
@@ -199,7 +199,7 @@
 //define("e_QUERY", $matches[2]);
 //define("e_QUERY", $_SERVER['QUERY_STRING']);
 $e_QUERY = str_replace("&","&amp;",$tp->post_toForm($e_QUERY));
-define("e_QUERY", $e_QUERY);
+define("e_QUERY", str_replace(array('{', '}'), '', $e_QUERY));
 //$e_QUERY = e_QUERY;
 
 define("e_TBQS", $_SERVER['QUERY_STRING']);
@@ -482,7 +482,7 @@
 	{
 		setcookie('e107language_'.$pref['cookie_name'], $_POST['sitelanguage'], time() + 86400, "/");
 		$_COOKIE['e107language_'.$pref['cookie_name']] = $_POST['sitelanguage'];
-		if (strpos(e_SELF, ADMINDIR) === FALSE) 
+		if (strpos(e_SELF, ADMINDIR) === FALSE)
 		{
 			$locat = ((!$_GET['elan'] && e_QUERY) || (e_QUERY && e_LANCODE)) ? e_SELF."?".e_QUERY : e_SELF;
 			header("Location:".$locat);
@@ -613,14 +613,14 @@
 init_session();
 
 // for multi-language these definitions needs to come after the language loaded.
-define("SITENAME", trim($tp->toHTML($pref['sitename'], "", "emotes_off, defs, no_make_clickable")));
+define("SITENAME", trim($tp->toHTML($pref['sitename'], "", 'USER_TITLE,value')));
 define("SITEBUTTON", $pref['sitebutton']);
 define("SITETAG", $tp->toHTML($pref['sitetag'], FALSE, "emotes_off, defs"));
-define("SITEDESCRIPTION", $tp->toHTML($pref['sitedescription'], "", "emotes_off, defs"));
+define("SITEDESCRIPTION", $tp->toHTML($pref['sitedescription'], "", "emotes_off,defs"));
 define("SITEADMIN", $pref['siteadmin']);
 define("SITEADMINEMAIL", $pref['siteadminemail']);
-define("SITEDISCLAIMER", $tp->toHTML($pref['sitedisclaimer'], "", "emotes_off, defs"));
-define("SITECONTACTINFO", $tp->toHTML($pref['sitecontactinfo'], TRUE, "emotes_off, defs"));
+define("SITEDISCLAIMER", $tp->toHTML($pref['sitedisclaimer'], "", "emotes_off,defs"));
+define("SITECONTACTINFO", $tp->toHTML($pref['sitecontactinfo'], TRUE, "emotes_off,defs"));
 
 // legacy module.php file loading.
 if (isset($pref['modules']) && $pref['modules']) {
@@ -652,14 +652,14 @@
 $sql->db_Mark_Time('Start: Load Theme');
 
 //###########  Module redefinable functions ###############
-if (!function_exists('checkvalidtheme')) 
+if (!function_exists('checkvalidtheme'))
 {
 	// arg1 = theme to check
-	function checkvalidtheme($theme_check) 
+	function checkvalidtheme($theme_check)
 	{
 	  global $ADMIN_DIRECTORY, $tp, $e107;
 
-	  if (ADMIN && strpos(e_QUERY, "themepreview") !== FALSE) 
+	  if (ADMIN && strpos(e_QUERY, "themepreview") !== FALSE)
 	  {	// Theme preview
 			list($action, $id) = explode('.', e_QUERY);
 			require_once(e_HANDLER."theme_handler.php");
@@ -670,22 +670,22 @@
 			define("THEME_ABS", e_THEME_ABS.$themeArray[$id]."/");
 			return;
 	  }
-	  if (@fopen(e_THEME.$theme_check."/theme.php", "r")) 
+	  if (@fopen(e_THEME.$theme_check."/theme.php", "r"))
 	  {  // 'normal' theme load
 		define("THEME", e_THEME.$theme_check."/");
 		define("THEME_ABS", e_THEME_ABS.$theme_check."/");
 		$e107->site_theme = $theme_check;
-	  } 
-	  else 
+	  }
+	  else
 	  {
-		function search_validtheme() 
+		function search_validtheme()
 		{
 		  global $e107;
 		  $th=substr(e_THEME, 0, -1);
 		  $handle=opendir($th);
-		  while ($file = readdir($handle)) 
+		  while ($file = readdir($handle))
 		  {
-			if (is_dir(e_THEME.$file) && is_readable(e_THEME.$file.'/theme.php')) 
+			if (is_dir(e_THEME.$file) && is_readable(e_THEME.$file.'/theme.php'))
 			{
 			  closedir($handle);
 			  $e107->site_theme = $file;
@@ -698,7 +698,7 @@
 		$e107tmp_theme = search_validtheme();
 		define("THEME", e_THEME.$e107tmp_theme."/");
 		define("THEME_ABS", e_THEME_ABS.$e107tmp_theme."/");
-		if (ADMIN && strpos(e_SELF, $ADMIN_DIRECTORY) === FALSE) 
+		if (ADMIN && strpos(e_SELF, $ADMIN_DIRECTORY) === FALSE)
 		{
 		  echo '<script>alert("'.$tp->toJS(CORE_LAN1).'")</script>';
 		}
@@ -714,9 +714,9 @@
 $sql->db_Mark_Time('Start: Misc Setup');
 
 //------------------------------------------------------------------------------------------------------------------------------------//
-if (!class_exists('e107table')) 
+if (!class_exists('e107table'))
 {
-	class e107table 
+	class e107table
 	{
 		function tablerender($caption, $text, $mode = "default", $return = false) {
 			/*
@@ -755,9 +755,9 @@
 
 $e107->ban();
 
-if(varset($pref['force_userupdate']) && USER) 
+if(varset($pref['force_userupdate']) && USER)
 {
-  if(force_userupdate()) 
+  if(force_userupdate())
   {
 	header("Location: ".e_BASE."usersettings.php?update");
 	exit();
@@ -778,9 +778,15 @@
 
 
 
-if ($pref['maintainance_flag'] && ADMIN == FALSE && strpos(e_SELF, "admin.php") === FALSE && strpos(e_SELF, "sitedown.php") === FALSE) {
-	header("Location: ".SITEURL."sitedown.php");
-	exit();
+if (varset($pref['maintainance_flag'])
+ && strpos(e_SELF, 'admin.php') === FALSE && strpos(e_SELF, 'sitedown.php') === FALSE)
+{
+	if(!ADMIN || ($pref['maintainance_flag'] == e_UC_MAINADMIN && !getperms('0')))
+	{
+		// 307 Temporary Redirect
+		header('Location: '.SITEURL.'sitedown.php', TRUE, 307);
+		exit();
+	}
 }
 
 $sql->db_Mark_Time('(Start: Login/logout/ban/tz)');
@@ -790,13 +796,13 @@
 	$usr = new userlogin($_POST['username'], $_POST['userpass'], $_POST['autologin']);
 }
 
-if (e_QUERY == 'logout') 
+if (e_QUERY == 'logout')
 {
 	$ip = $e107->getip();
 	$udata=(USER === TRUE) ? USERID.".".USERNAME : "0";
 	$sql->db_Update("online", "online_user_id = '0', online_pagecount=online_pagecount+1 WHERE online_user_id = '{$udata}' LIMIT 1");
 
-	if ($pref['user_tracking'] == 'session') 
+	if ($pref['user_tracking'] == 'session')
 	{
 		session_destroy();
 		$_SESSION[$pref['cookie_name']]='';
@@ -804,7 +810,7 @@
 
 	cookie($pref['cookie_name'], '', (time() - 2592000));
 	$e_event->trigger('logout');
-	header('location:'.e_BASE.'index.php');      
+	header('location:'.e_BASE.'index.php');
 	exit();
 }
 
@@ -867,15 +873,15 @@
 //----------------------------
 // The following files are assumed to use admin theme:
 //	  1. Any file in the admin directory (check for non-plugin added to avoid mismatches)
-// 	  2. any plugin file starting with 'admin_' 
-// 	  3. any plugin file in a folder called admin/ 
+// 	  2. any plugin file starting with 'admin_'
+// 	  3. any plugin file in a folder called admin/
 // 	  4. any file that specifies $eplug_admin = TRUE;
 //
 // e_SELF has the full HTML path
 $inAdminDir = FALSE;
 $isPluginDir = strpos(e_SELF,'/'.$PLUGINS_DIRECTORY) !== FALSE;		// True if we're in a plugin
 $e107Path = str_replace($e107->base_path, "", e_SELF);				// Knock off the initial bits
-if	( 
+if	(
 		 (!$isPluginDir && strpos($e107Path, $ADMIN_DIRECTORY) === 0 ) 								// Core admin directory
 	  || ($isPluginDir && (strpos(e_PAGE,"admin_") === 0 || strpos($e107Path, "admin/") !== FALSE)) // Plugin admin file or directory
 	  || (varsettrue($eplug_admin))																	// Admin forced
@@ -896,12 +902,12 @@
 		define("MAINTHEME", e_THEME.$pref['sitetheme']."/");		MAINTHEME no longer used in core distribution
 	  }  */
 		checkvalidtheme($pref['admintheme']);
-	} 
+	}
 	elseif (USERTHEME !== FALSE && USERTHEME != "USERTHEME" && !$inAdminDir)
 	{
 		checkvalidtheme(USERTHEME);
-	} 
-	else 
+	}
+	else
 	{
 		checkvalidtheme($pref['sitetheme']);
 	}
@@ -914,16 +920,16 @@
 // here we USE the theme
 if ($inAdminDir)
 {
-  if (file_exists(THEME.'admin_theme.php')) 
+  if (file_exists(THEME.'admin_theme.php'))
   {
 	require_once(THEME.'admin_theme.php');
-  } 
-  else 
+  }
+  else
   {
 	require_once(THEME."theme.php");
   }
-} 
-else 
+}
+else
 {
   require_once(THEME."theme.php");
 }
@@ -937,8 +943,8 @@
 if ($inAdminDir)
 {
   include_lan(e_LANGUAGEDIR.e_LANGUAGE."/admin/lan_".e_PAGE);
-} 
-elseif (!in_array("lan_".e_PAGE,$exclude_lan) && !$isPluginDir) 
+}
+elseif (!in_array("lan_".e_PAGE,$exclude_lan) && !$isPluginDir)
 {
   include_lan(e_LANGUAGEDIR.e_LANGUAGE."/lan_".e_PAGE);
 }
@@ -952,7 +958,7 @@
 
 if (Empty($pref['newsposts']) ? define("ITEMVIEW", 15) : define("ITEMVIEW", $pref['newsposts']));
 
-if ($pref['antiflood1'] == 1) 
+if ($pref['antiflood1'] == 1)
 {
   define('FLOODPROTECT', TRUE);
   define('FLOODTIMEOUT', max(varset($pref['antiflood_timeout'],10),3));
@@ -1119,25 +1125,37 @@
 	return FALSE;
 }
 
-function getperms($arg, $ap = ADMINPERMS) {
+function getperms($arg, $ap = ADMINPERMS)
+{
+	if(!ADMIN)
+	{
+		return FALSE;
+	}
 	global $PLUGINS_DIRECTORY;
-	if ($ap == "0") {
+	if ($ap == "0")
+	{
 		return TRUE;
 	}
-	if ($ap == "") {
+	if ($ap == "")
+	{
 		return FALSE;
 	}
 	$ap='.'.$ap;
-	if ($arg == 'P' && preg_match("#(.*?)/".$PLUGINS_DIRECTORY."(.*?)/(.*?)#", e_SELF, $matches)) {
+	if ($arg == 'P' && preg_match("#(.*?)/".$PLUGINS_DIRECTORY."(.*?)/(.*?)#", e_SELF, $matches))
+	{
 		$psql=new db;
-		if ($psql->db_Select('plugin', 'plugin_id', "plugin_path = '".$matches[2]."' ")) {
+		if ($psql->db_Select('plugin', 'plugin_id', "plugin_path = '".$matches[2]."' "))
+		{
 			$row=$psql->db_Fetch();
 			$arg='P'.$row[0];
 		}
 	}
-	if (strpos($ap, ".".$arg.".") !== FALSE) {
+	if (strpos($ap, ".".$arg.".") !== FALSE)
+	{
 		return TRUE;
-	} else {
+	}
+	else
+	{
 		return FALSE;
 	}
 }
@@ -1326,7 +1344,7 @@
 				$row['online_pagecount'] = 1;
 			}
 
-			if ($row['online_pagecount'] > $online_bancount && ($row['online_ip'] != "127.0.0.1")) 
+			if ($row['online_pagecount'] > $online_bancount && ($row['online_ip'] != "127.0.0.1"))
 			{
 				include_lan(e_LANGUAGEDIR.e_LANGUAGE.'/admin/lan_banlist.php');
 				$sql->db_Insert('banlist', "'{$ip}', '0', '".str_replace('--HITS--',$row['online_pagecount'],BANLAN_78)."' ");
@@ -1416,7 +1434,7 @@
 	global $sql, $pref, $user_pref, $tp, $currentUser, $e107;
 
 	define('USERIP', $e107->getip());
-	if (!isset($_COOKIE[$pref['cookie_name']]) && !isset($_SESSION[$pref['cookie_name']])) 
+	if (!isset($_COOKIE[$pref['cookie_name']]) && !isset($_SESSION[$pref['cookie_name']]))
 	{
 		define("USER", FALSE);
 		define('USERID', 0);
@@ -1425,12 +1443,12 @@
 		define("GUEST", TRUE);
 		define('USERCLASS', '');
 		define('USEREMAIL', '');
-	} 
-	else 
+	}
+	else
 	{
 		list($uid, $upw)=(isset($_COOKIE[$pref['cookie_name']]) && $_COOKIE[$pref['cookie_name']] ? explode(".", $_COOKIE[$pref['cookie_name']]) : explode(".", $_SESSION[$pref['cookie_name']]));
 
-		if (empty($uid) || empty($upw)) 
+		if (empty($uid) || empty($upw))
 		{
 			cookie($pref['cookie_name'], "", (time() - 2592000));
 			$_SESSION[$pref['cookie_name']] = "";
@@ -1478,7 +1496,7 @@
 
 			if ($result['user_ban'] == 1) { exit; }
 
-			if ($result['user_admin']) 
+			if ($result['user_admin'])
 			{
 				define('ADMIN', TRUE);
 				define('ADMINID', $result['user_id']);
@@ -1486,8 +1504,8 @@
 				define('ADMINPERMS', $result['user_perms']);
 				define('ADMINEMAIL', $result['user_email']);
 				define('ADMINPWCHANGE', $result['user_pwchange']);
-			} 
-			else 
+			}
+			else
 			{
 				define('ADMIN', FALSE);
 			}
@@ -1497,7 +1515,7 @@
 			$tempClasses = class_list();
 			if (check_class(varset($pref['allow_theme_select'],FALSE), $tempClasses))
 			{	// User can set own theme
-				if (isset($_POST['settheme'])) 
+				if (isset($_POST['settheme']))
 				{
 					$user_pref['sitetheme'] = ($pref['sitetheme'] == $_POST['sitetheme'] ? "" : $_POST['sitetheme']);
 					save_prefs('user');
@@ -1512,8 +1530,8 @@
 
 			define("USERTHEME", (isset($user_pref['sitetheme']) && file_exists(e_THEME.$user_pref['sitetheme']."/theme.php") ? $user_pref['sitetheme'] : FALSE));
 //			global $ADMIN_DIRECTORY, $PLUGINS_DIRECTORY;   Don't look very necessary
-		} 
-		else 
+		}
+		else
 		{
 			define("USER", FALSE);
 			define('USERID', 0);
@@ -1526,6 +1544,20 @@
 
 	define('USERCLASS_LIST', class_list());
 	define('e_CLASS_REGEXP', "(^|,)(".str_replace(",", "|", USERCLASS_LIST).")(,|$)");
+	
+	if(USER)
+	{
+		define('POST_REFERER', md5($currentUser['user_password'].$currentUser['user_lastvisit'].USERCLASS_LIST));
+	}
+	else
+	{
+		define('POST_REFERER', '');
+	}
+	if(isset($_POST['__referer']) && $_POST['__referer'] != POST_REFERER) {
+		header('location:'.e_BASE.'index.php');
+		exit;
+	}
+	
 }
 
 $sql->db_Mark_Time('Start: Go online');
@@ -1580,7 +1612,7 @@
 }
 
 // -----------------------------------------------------------------------------
-function table_exists($check) { 
+function table_exists($check) {
 	if (!$GLOBALS['mySQLtablelist']) {
 		$tablist=mysql_list_tables($GLOBALS['mySQLdefaultdb']);
 		while (list($temp) = mysql_fetch_array($tablist)) {
@@ -1661,12 +1693,12 @@
 	return (isset($ret)) ? $ret : '';
 }
 
-if(!function_exists("print_a")) 
+if(!function_exists("print_a"))
 {
-  function print_a($var, $return = false) 
+  function print_a($var, $return = false)
   {
 	$charset = "utf-8";
-	if(defined("CHARSET")) 
+	if(defined("CHARSET"))
 	{
 	  $charset = CHARSET;
 	}
@@ -1674,8 +1706,8 @@
 	{
 	  echo '<pre>'.htmlspecialchars(print_r($var, true), ENT_QUOTES, $charset).'</pre>';
 	  return true;
-	} 
-	else 
+	}
+	else
 	{
 	  return '<pre>'.htmlspecialchars(print_r($var, true), ENT_QUOTES, $charset).'</pre>';
 	}
@@ -1706,16 +1738,18 @@
 
 	if (!varset($pref['disable_emailcheck'],TRUE) && !trim($currentUser['user_email'])) return TRUE;
 
-	if($sql -> db_Select("user_extended_struct", "user_extended_struct_name, user_extended_struct_type", "user_extended_struct_required = '1'"))
+	if($sql -> db_Select('user_extended_struct', 'user_extended_struct_applicable, user_extended_struct_write, user_extended_struct_name, user_extended_struct_type', 'user_extended_struct_required = 1 AND user_extended_struct_applicable != '.e_UC_NOBODY))
 	{
-	  while($row = $sql -> db_Fetch())
-	  {
-		$user_extended_struct_name = "user_{$row['user_extended_struct_name']}";
-		if ((!$currentUser[$user_extended_struct_name]) || (($row['user_extended_struct_type'] == 7) && ($currentUser[$user_extended_struct_name] == '0000-00-00')))
+		while($row = $sql -> db_Fetch())
 		{
-		  return TRUE;
+			if (!check_class($row['user_extended_struct_applicable'])) { continue; }		// Must be applicable to this user class
+			if (!check_class($row['user_extended_struct_write'])) { continue; }				// And user must be able to change it
+			$user_extended_struct_name = "user_{$row['user_extended_struct_name']}";
+			if ((!$currentUser[$user_extended_struct_name]) || (($row['user_extended_struct_type'] == 7) && ($currentUser[$user_extended_struct_name] == '0000-00-00')))
+			{
+			  return TRUE;
+			}
 		}
-	  }
 	}
 	return FALSE;
 }
diff -x .svn -aruN 0.7.16.src/comment.php 0.7.17.src/comment.php
--- 0.7.16.src/comment.php	2008-11-04 16:10:09.000000000 -0600
+++ 0.7.17.src/comment.php	2010-01-15 15:09:54.000000000 -0600
@@ -11,8 +11,8 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/comment.php,v $
-|     $Revision: 1.59 $
-|     $Date: 2008/11/04 22:10:32 $
+|     $Revision: 1.61 $
+|     $Date: 2010/01/15 21:10:18 $
 |     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
@@ -143,15 +143,15 @@
 	{
 	  case "news" :
 	  case "poll" :
-		echo "<script type='text/javascript'>document.location.href='".e_BASE."comment.php?comment.{$table}.{$redirectFlag}'</script>\n";
+		echo "<script type='text/javascript'>document.location.href='".e_HTTP."comment.php?comment.{$table}.{$redirectFlag}'</script>\n";
 		exit;
 		break;
 	  case "download" :
-		echo "<script type='text/javascript'>document.location.href='".e_BASE."download.php?view.{$redirectFlag}'</script>\n";
+		echo "<script type='text/javascript'>document.location.href='".e_HTTP."download.php?view.{$redirectFlag}'</script>\n";
 		exit;
 		break;
 	  case "page" :
-		echo "<script type='text/javascript'>document.location.href='".e_BASE."page.php?{$redirectFlag}'</script>\n";
+		echo "<script type='text/javascript'>document.location.href='".e_HTTP."page.php?{$redirectFlag}'</script>\n";
 		exit;
 		break;
 	}
@@ -316,31 +316,39 @@
 		  }
 		  break;
 		default :		// Hope its a plugin table
-		  $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} "))
+			$e_comment = $cobj->get_e_comment();
+			if ($table == $e_comment[$table]['eplug_comment_ids'])
 			{
-			  $row = $sql->db_Fetch();
-			  $subject = $row[$e_comment[$table]['db_title']];
-			  $title = $e_comment[$table]['plugin_name'];
-			  $field = $id;
-			  require_once(HEADERF);
+				if ($sql->db_Select($table,$e_comment[$table]['db_title'],$e_comment[$table]['db_id']."={$id} "))
+				{
+				  $row = $sql->db_Fetch();
+				  $subject = $row[$e_comment[$table]['db_title']];
+				  $title = $e_comment[$table]['plugin_name'];
+				  $field = $id;
+				  require_once(HEADERF);
+				}
+				else
+				{
+				  header("location:".e_BASE."index.php");
+				  exit;
+				}
 			}
 			else
-			{
-			  header("location:".e_BASE."index.php");
-			  exit;
+			{	// Error - emit some debug code
+				require_once(HEADERF);
+				if (E107_DEBUG_LEVEL)
+				{
+					echo "Comment error: {$table}  Field: {$e_comment['db_id']}  ID {$id}   Title: {$e_comment['db_title']}<br />";
+					echo "<pre>";
+					var_dump($e_comment);
+					echo "</pre>"; 
+				}
+				else
+				{
+					header('location:'.e_BASE.'index.php');
+					exit;
+				}
 			}
-		  }
-		  else
-		  {	// Error - emit some debug code
-			require_once(HEADERF);
-			echo "Comment error: {$table}  Field: {$e_comment['db_id']}  ID {$id}   Title: {$e_comment['db_title']}<br />";
-			echo "<pre>";
-			var_dump($e_comment);
-			echo "</pre>"; 
-		  }
 	  }
 	}
 }
@@ -352,7 +360,7 @@
 
 if(isset($pref['trackbackEnabled']) && $pref['trackbackEnabled'] && $table == "news")
 {
-  echo "<span class='smalltext'><b>".$pref['trackbackString']."</b> ".$e107->http_path.e_PLUGIN."trackback/trackback.php?pid={$id}</span>";
+  echo "<span class='smalltext'><b>".$pref['trackbackString']."</b> ".SITEURLBASE.e_PLUGIN_ABS."trackback/trackback.php?pid={$id}</span>";
 }
 
 $field = ($field ? $field : ($id ? $id : ""));			// ID of associated source item
@@ -398,7 +406,7 @@
 		echo "<a name='track'></a>".COMLAN_316;
 	}
 	if (ADMIN && getperms("B")) {
-		echo "<div style='text-align:right'><a href='".e_PLUGIN."trackback/modtrackback.php?".$id."'>".COMLAN_317."</a></div><br />";
+		echo "<div style='text-align:right'><a href='".e_PLUGIN_ABS."trackback/modtrackback.php?".$id."'>".COMLAN_317."</a></div><br />";
 	}
 }
 
diff -x .svn -aruN 0.7.16.src/download.php 0.7.17.src/download.php
--- 0.7.16.src/download.php	2009-03-19 17:06:38.000000000 -0500
+++ 0.7.17.src/download.php	2010-01-22 07:30:04.000000000 -0600
@@ -3,7 +3,7 @@
 + ----------------------------------------------------------------------------+
 |     e107 website system
 |
-|     Steve Dunstan 2001-2002
+|     �Steve Dunstan 2001-2002
 |     http://e107.org
 |     jalist@e107.org
 |
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/download.php,v $
-|     $Revision: 1.100 $
-|     $Date: 2009/03/19 22:07:02 $
-|     $Author: bugrain $
+|     $Revision: 1.104 $
+|     $Date: 2010/01/22 13:30:28 $
+|     $Author: mcfly_e107 $
 |
 +----------------------------------------------------------------------------+
 */
@@ -59,7 +59,7 @@
 $sort_options = array('ASC', 'DESC');
 
 
-if (!e_QUERY || $_GET['elan'])
+if (!e_QUERY || varsettrue($_GET['elan']))
 {
 	$action = 'maincats';		// List categories
 	$maincatval = '';			// Show all main categories
@@ -197,8 +197,9 @@
 	  }
 	}
 
-	$download_cat_table_start = preg_replace("/\{(.*?)\}/e", '$\1', $DOWNLOAD_CAT_TABLE_START);
-
+//	$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'>
@@ -209,7 +210,9 @@
 		</p>
 		</form>";
 
-	$download_cat_table_end = preg_replace("/\{(.*?)\}/e", '$\1', $DOWNLOAD_CAT_TABLE_END);
+//	$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();
@@ -263,6 +266,7 @@
 	$total_downloads = $sql->db_Count("download", "(*)", "WHERE download_category = '{$id}' AND download_active > 0 AND download_visible REGEXP '".e_CLASS_REGEXP."'");
 
 	require_once(HEADERF);
+	$text = '';
 
 	/* SHOW SUBCATS ... */
 	if($sql -> db_Select("download_category", "download_category_id", "download_category_parent='{$id}' "))
@@ -293,10 +297,12 @@
 			list($download_category_icon, $download_category_icon_empty) = explode(chr(1), $row['parent_icon']);
 		}
 		$DOWNLOAD_CAT_MAIN_ICON = ($download_category_icon ? "<img src='".e_IMAGE."icons/".$download_category_icon."' alt='' style='float: left' />" : "&nbsp;");
-		$DOWNLOAD_CAT_MAIN_NAME = $tp->toHTML($row['parent_name']);
-		$download_cat_table_start = preg_replace("/\{(.*?)\}/e", '$\1', $DOWNLOAD_CAT_TABLE_START);
+		$DOWNLOAD_CAT_MAIN_NAME = $tp->toHTML($row['parent_name'], FALSE, 'TITLE');
+//		$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_table_end = preg_replace("/\{(.*?)\}/e", '$\1', $DOWNLOAD_CAT_TABLE_END);
+//		$download_cat_table_end = preg_replace("/\{(.*?)\}/e", '$\1', $DOWNLOAD_CAT_TABLE_END);
+		$download_cat_table_end = $tp->simpleParse($DOWNLOAD_CAT_TABLE_END);
 		$text = $download_cat_table_start.$download_cat_table_string.$download_cat_table_end;
 		if($DOWNLOAD_CAT_TABLE_RENDERPLAIN)
 		{
@@ -306,8 +312,8 @@
 		{
 			$ns->tablerender($type, $text);
 		}
-		$text = "";		// If other files, show in a separate block
-		$type = "";   	// Cancel title once displayed
+		$text = '';		// If other files, show in a separate block
+		$type = '';   	// Cancel title once displayed
 	}  // End of subcategory display
 
 // Now display individual downloads
@@ -322,14 +328,14 @@
 
 	if ($total_downloads < $view) { $dl_from = 0; }
 
-	if(strstr($download_category_icon, chr(1)))
+	if(isset($download_category_icon) && strstr($download_category_icon, chr(1)))
 	{
 		list($download_category_icon, $download_category_icon_empty) = explode(chr(1), $download_category_icon);
 	}
-	$DOWNLOAD_CATEGORY_ICON = ($download_category_icon ? "<img src='".e_IMAGE."icons/".$download_category_icon."' alt='' style='float: left' />" : "&nbsp;");
+	$DOWNLOAD_CATEGORY_ICON = (varsettrue($download_category_icon) ? "<img src='".e_IMAGE."icons/".$download_category_icon."' alt='' style='float: left' />" : "&nbsp;");
 
-	$DOWNLOAD_CATEGORY = $tp->toHTML($download_category_name,FALSE,"emotes_off, no_make_clickable");
-	$DOWNLOAD_CATEGORY_DESCRIPTION = $tp -> toHTML($download_category_description, TRUE,'description');
+	$DOWNLOAD_CATEGORY = $tp->toHTML($download_category_name,FALSE,'TITLE');
+	$DOWNLOAD_CATEGORY_DESCRIPTION = $tp -> toHTML($download_category_description, TRUE,'DESCRIPTION');
 
 	$load_template = 'download_template';
 	if (!isset($DOWNLOAD_LIST_TABLE)) eval($template_load_core);
@@ -345,6 +351,7 @@
 	// $total_downloads - total number of entries matching search criteria
 	$filetotal = $sql->db_Select("download", "*", "download_category='{$id}' AND download_active > 0 AND download_visible IN (".USERCLASS_LIST.") ORDER BY {$order} {$sort} LIMIT {$dl_from}, {$view}");
 	$ft = ($filetotal < $view ? $filetotal : $view);
+	$download_list_table_string = '';
 	while ($row = $sql->db_Fetch())
 	{
 		extract($row);
@@ -355,14 +362,17 @@
 	$DOWNLOAD_LIST_TOTAL_AMOUNT = $tdownloads." ".LAN_dl_16;
 	$DOWNLOAD_LIST_TOTAL_FILES = $ft." ".LAN_dl_17;
 
-	$download_list_table_start = preg_replace("/\{(.*?)\}/e", '$\1', $DOWNLOAD_LIST_TABLE_START);
-	$download_list_table_end = preg_replace("/\{(.*?)\}/e", '$\1', $DOWNLOAD_LIST_TABLE_END);
+//	$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;
 
 
 	if ($filetotal)
 	{  // Only show list if some files in it
-		if($DOWNLOAD_LIST_TABLE_RENDERPLAIN)
+		if(varsettrue($DOWNLOAD_LIST_TABLE_RENDERPLAIN))
 		{
 			echo $text;
 		}
@@ -435,7 +445,7 @@
 	define("e_PAGETITLE", $DL_TITLE);
 
 	require_once(HEADERF);
-	$DL_TEMPLATE = $DOWNLOAD_VIEW_TABLE_START.$DOWNLOAD_VIEW_TABLE.$DOWNLOAD_VIEW_TABLE_END;
+	$DL_TEMPLATE = varset($DOWNLOAD_VIEW_TABLE_START, '').$DOWNLOAD_VIEW_TABLE.varset($DOWNLOAD_VIEW_TABLE_END, '');
 	$text = $tp->parseTemplate($DL_TEMPLATE, TRUE, $download_shortcodes);
 
 	if(!isset($DL_VIEW_CAPTION))
@@ -461,9 +471,12 @@
     $text .= $tp->parseTemplate($DL_VIEW_NEXTPREV,TRUE,$download_shortcodes);
 	$caption = $tp->parseTemplate($DL_VIEW_CAPTION,TRUE,$download_shortcodes);
 
-	if($DOWNLOAD_VIEW_TABLE_RENDERPLAIN) {
+	if(varsettrue($DOWNLOAD_VIEW_TABLE_RENDERPLAIN))
+	{
 		echo $text;
-	} else {
+	}
+	else
+	{
 
 		$ns->tablerender($caption, $text);
 	}
@@ -471,7 +484,7 @@
 	unset($text);
 
 	if ($dl['download_comment']) {
-		$cobj->compose_comment("download", "comment", $id, $width,$dl['download_name'], $showrate=FALSE);
+		$cobj->compose_comment("download", "comment", $id, 0, $dl['download_name'], $showrate=FALSE);
 	}
 
 	require_once(FOOTERF);
@@ -542,7 +555,7 @@
 			<input class='button' type='submit' name='report_download' value=\"".LAN_dl_45."\" />
 			</td>
 			</tr>
-			</table>";
+			</table></form>";
 		$ns->tablerender(LAN_dl_50, $text);
 	}
 	require_once(FOOTERF);
@@ -595,9 +608,11 @@
 		$DOWNLOAD_MIRROR_DESCRIPTION_LAN = LAN_dl_71;
 		$DOWNLOAD_MIRROR_REQUEST = LAN_dl_72."'".$download_name."'";
 
-		$download_mirror_start = preg_replace("/\{(.*?)\}/e", '$\1', $DOWNLOAD_MIRROR_START);
-		$download_mirror_end = preg_replace("/\{(.*?)\}/e", '$\1', $DOWNLOAD_MIRROR_END);
-
+//		$download_mirror_start = preg_replace("/\{(.*?)\}/e", '$\1', $DOWNLOAD_MIRROR_START);
+		$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) {
@@ -634,7 +649,8 @@
 	$DOWNLOAD_MIRROR_REQUESTS = (ADMIN ? LAN_dl_73.$mirrorRequests : "");
 	$DOWNLOAD_TOTAL_MIRROR_REQUESTS = (ADMIN ? LAN_dl_74.$mirror_count : "");
 
-	return(preg_replace("/\{(.*?)\}/e", '$\1', $DOWNLOAD_MIRROR));
+//	return(preg_replace("/\{(.*?)\}/e", '$\1', $DOWNLOAD_MIRROR));
+	return($tp->simpleParse($DOWNLOAD_MIRROR));
 }
 
 function parsesize($size) {
@@ -673,9 +689,9 @@
 
 	$template = ($current_row == 1) ? $DOWNLOAD_CAT_PARENT_TABLE : str_replace("forumheader3","forumheader3 forumheader3_alt",$DOWNLOAD_CAT_PARENT_TABLE);
 
-	$DOWNLOAD_CAT_MAIN_ICON = '';
-	$DOWNLOAD_CAT_MAIN_NAME = '';
-	$DOWNLOAD_CAT_MAIN_DESCRIPTION = '';
+	$tVars['DOWNLOAD_CAT_MAIN_ICON'] = '';
+	$tVars['DOWNLOAD_CAT_MAIN_NAME'] = '';
+	$tVars['DOWNLOAD_CAT_MAIN_DESCRIPTION'] = '';
 
 	if (check_class($download_category_class))
 	{
@@ -683,11 +699,12 @@
 		{
 			list($download_category_icon, $download_category_icon_empty) = explode(chr(1), $download_category_icon);
 		}
-		$DOWNLOAD_CAT_MAIN_ICON = ($download_category_icon ? "<img src='".e_IMAGE."icons/".$download_category_icon."' alt='' style='float: left' />" : "&nbsp;");
-		$DOWNLOAD_CAT_MAIN_NAME = $tp->toHTML($download_category_name,FALSE,"emotes_off, no_make_clickable");
-		$DOWNLOAD_CAT_MAIN_DESCRIPTION = $tp->toHTML($row['download_category_description'],TRUE,'DESCRIPTION');
+		$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');
 	}
-	return(preg_replace("/\{(.*?)\}/e", '$\1', $template));
+//	return(preg_replace("/\{(.*?)\}/e", '$\1', $template));
+	return($tp->simpleParse($template, $tVars));
 }
 
 
@@ -719,31 +736,33 @@
 	$current_row = ($current_row) ? 0 : 1;  // Alternating CSS for each row.(backwards compatible)
 	$template = ($current_row == 1) ? $DOWNLOAD_CAT_CHILD_TABLE : str_replace("forumheader3","forumheader3 forumheader3_alt",$DOWNLOAD_CAT_CHILD_TABLE);
 
-	$DOWNLOAD_CAT_SUB_ICON = get_cat_icons($row['download_category_icon'],$row['d_count']);
-	$DOWNLOAD_CAT_SUB_NEW_ICON = check_new_download($row['d_last_subs']);
-	$dcatname=$tp->toHTML($row['download_category_name'],FALSE,"emotes_off, no_make_clickable");
-	$DOWNLOAD_CAT_SUB_NAME = ($row['d_count'] ? "<a href='".e_BASE."download.php?list.".$row['download_category_id']."'>".$dcatname."</a>" : $dcatname);
-	$DOWNLOAD_CAT_SUB_NAME_LINKED = "<a href='".e_BASE."download.php?list.".$row['download_category_id']."'>".$dcatname."</a>";
-	$DOWNLOAD_CAT_SUB_DESCRIPTION = $tp->toHTML($row['download_category_description'],TRUE,'description');
-	$DOWNLOAD_CAT_SUB_COUNT = $row['d_count'];
-	$DOWNLOAD_CAT_SUB_SIZE = parsesize( $row['d_size']);
-	$DOWNLOAD_CAT_SUB_DOWNLOADED = intval( $row['d_requests']);
-	$DOWNLOAD_CAT_SUBSUB = "";
+	$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');
+	$tVars['DOWNLOAD_CAT_SUB_NAME'] = ($row['d_count'] ? "<a href='".e_BASE."download.php?list.".$row['download_category_id']."'>".$dcatname."</a>" : $dcatname);
+	$tVars['DOWNLOAD_CAT_SUB_NAME_LINKED'] = "<a href='".e_BASE."download.php?list.".$row['download_category_id']."'>".$dcatname."</a>";
+	$tVars['DOWNLOAD_CAT_SUB_DESCRIPTION'] = $tp->toHTML($row['download_category_description'],TRUE,'DESCRIPTION');
+	$tVars['DOWNLOAD_CAT_SUB_COUNT'] = $row['d_count'];
+	$tVars['DOWNLOAD_CAT_SUB_SIZE'] = parsesize( $row['d_size']);
+	$tVars['DOWNLOAD_CAT_SUB_DOWNLOADED'] = intval( $row['d_requests']);
+	$tVars['DOWNLOAD_CAT_SUBSUB'] = "";
 	// check for subsub cats ...
 	foreach($row['subsubcats'] as $subrow)
 	{
-	  $DOWNLOAD_CAT_SUBSUB_ICON = get_cat_icons($subrow['download_category_icon'],$subrow['d_count']);
-	  $DOWNLOAD_CAT_SUBSUB_DESCRIPTION = $tp->toHTML($subrow['download_category_description'],TRUE,'description');
-	  $DOWNLOAD_CAT_SUBSUB_COUNT = intval($subrow['d_count']);
-	  $DOWNLOAD_CAT_SUBSUB_SIZE = parsesize($subrow['d_size']);
-	  $DOWNLOAD_CAT_SUBSUB_DOWNLOADED = intval($subrow['d_requests']);
-
-	  $DOWNLOAD_CAT_SUBSUB_NEW_ICON = check_new_download($subrow['d_last']);
-	  $DOWNLOAD_CAT_SUBSUB_NAME = ($subrow['d_count'] ? "<a href='".e_BASE."download.php?list.".$subrow['download_category_id']."'>".$tp->toHTML($subrow['download_category_name'])."</a>" : $tp->toHTML($subrow['download_category_name'],FALSE,"emotes_off, no_make_clickable"));
-	  $DOWNLOAD_CAT_SUBSUB .= preg_replace("/\{(.*?)\}/e", '$\1', $DOWNLOAD_CAT_SUBSUB_TABLE);
+	  $tVars['DOWNLOAD_CAT_SUBSUB_ICON'] = get_cat_icons($subrow['download_category_icon'],$subrow['d_count']);
+	  $tVars['DOWNLOAD_CAT_SUBSUB_DESCRIPTION'] = $tp->toHTML($subrow['download_category_description'],TRUE,'DESCRIPTION');
+	  $tVars['DOWNLOAD_CAT_SUBSUB_COUNT'] = intval($subrow['d_count']);
+	  $tVars['DOWNLOAD_CAT_SUBSUB_SIZE'] = parsesize($subrow['d_size']);
+	  $tVars['DOWNLOAD_CAT_SUBSUB_DOWNLOADED'] = intval($subrow['d_requests']);
+
+	  $tVars['DOWNLOAD_CAT_SUBSUB_NEW_ICON'] = check_new_download($subrow['d_last']);
+	  $tVars['DOWNLOAD_CAT_SUBSUB_NAME'] = ($subrow['d_count'] ? "<a href='".e_BASE."download.php?list.".$subrow['download_category_id']."'>".$tp->toHTML($subrow['download_category_name'])."</a>" : $tp->toHTML($subrow['download_category_name'],FALSE,'TITLE'));
+//	  $tVars['DOWNLOAD_CAT_SUBSUB'] .= preg_replace("/\{(.*?)\}/e", '$\1', $DOWNLOAD_CAT_SUBSUB_TABLE);
+	  $tVars['DOWNLOAD_CAT_SUBSUB'] .= $tp->simpleParse($DOWNLOAD_CAT_SUBSUB_TABLE, $tVars);
 	}
 
-	return(preg_replace("/\{(.*?)\}/e", '$\1', $template));
+//	return(preg_replace("/\{(.*?)\}/e", '$\1', $template));
+	return($tp->simpleParse($template, $tVars));
 }
 
 
@@ -752,7 +771,7 @@
 // ***** $agreetext may not need to be global
 	global $download_shortcodes,$tp,$current_row,$DOWNLOAD_LIST_TABLE, $rater, $pref, $gen, $agreetext;
 
-	$agreetext = $tp->toHTML($pref['agree_text'],TRUE,"parse_sc");
+	$agreetext = $tp->toHTML(varset($pref['agree_text'], ''),TRUE,"parse_sc");
 	$current_row = ($current_row) ? 0 : 1;  // Alternating CSS for each row.(backwards compatible)
 	$template = ($current_row == 1) ? $DOWNLOAD_LIST_TABLE : str_replace("forumheader3","forumheader3 forumheader3_alt",$DOWNLOAD_LIST_TABLE);
 
diff -x .svn -aruN 0.7.16.src/e107_admin/admin.php 0.7.17.src/e107_admin/admin.php
--- 0.7.16.src/e107_admin/admin.php	2009-07-18 10:53:18.000000000 -0500
+++ 0.7.17.src/e107_admin/admin.php	2010-01-22 06:41:37.000000000 -0600
@@ -3,7 +3,7 @@
 + ----------------------------------------------------------------------------+
 |     e107 website system
 |
-|     Steve Dunstan 2001-2002
+|     Steve Dunstan 2001-2002
 |     http://e107.org
 |     jalist@e107.org
 |
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_admin/admin.php,v $
-|     $Revision: 1.42 $
-|     $Date: 2009/07/18 15:53:42 $
-|     $Author: marj_nl_fr $
+|     $Revision: 1.44 $
+|     $Date: 2010/01/22 12:42:01 $
+|     $Author: secretr $
 +----------------------------------------------------------------------------+
 */
 require_once('../class2.php');
@@ -105,6 +105,9 @@
 	$ns -> tablerender(LAN_WARNING, $text);
 }
 
+// More visible update check
+echo $tp->parseTemplate('{ADMIN_UPDATE}', true);
+
 // update users using old layout names to their new names
 $update_prefs = FALSE;
 if (!$pref['adminstyle'] || $pref['adminstyle'] == 'default') {
@@ -199,9 +202,12 @@
 	return $text;
 }
 
-function render_clean() {
+function render_clean() 
+{
 	global $td;
-	while ($td <= ADLINK_COLS) {
+	$text = '';
+	while ($td <= ADLINK_COLS) 
+	{
 		$text .= "<td class='td' style='width:20%;'></td>";
 		$td++;
 	}
diff -x .svn -aruN 0.7.16.src/e107_admin/banner.php 0.7.17.src/e107_admin/banner.php
--- 0.7.16.src/e107_admin/banner.php	2009-08-15 06:54:06.000000000 -0500
+++ 0.7.17.src/e107_admin/banner.php	2009-11-19 05:45:24.000000000 -0600
@@ -3,7 +3,7 @@
 + ----------------------------------------------------------------------------+
 |     e107 website system
 |
-|     Steve Dunstan 2001-2002
+|     (C)Steve Dunstan 2001-2002
 |     http://e107.org
 |     jalist@e107.org
 |
@@ -11,8 +11,8 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_admin/banner.php,v $
-|     $Revision: 1.35 $
-|     $Date: 2009/08/15 11:54:30 $
+|     $Revision: 1.37 $
+|     $Date: 2009/11/19 11:45:48 $
 |     $Author: marj_nl_fr $
 +----------------------------------------------------------------------------+
 */
@@ -20,8 +20,9 @@
 if (!getperms("D")) 
 {
 	header("location:".e_BASE."index.php");
-	exit;
+	exit();
 }
+
 $e_sub_cat = 'banner';
 require_once("auth.php");
 require_once(e_HANDLER."form_handler.php");
@@ -30,7 +31,7 @@
 require_once(e_HANDLER."file_class.php");
 $fl = new e_file;
 
-//@FIXME mix up in banner language files
+//FIXME mix up in banner language files
 include_lan(e_LANGUAGEDIR.e_LANGUAGE."/admin/lan_menus.php");
 include_lan(e_PLUGIN."banner_menu/languages/".e_LANGUAGE.".php");
 
@@ -210,6 +211,12 @@
 }
 
 if ($action == "create") {
+	if(isset($pref['install_date'])) { 
+		$_startYear = date('Y', $pref['install_date']);
+	} else {
+		$_startYear = date('Y') - 5;
+	}
+	$_endYear = date('Y') + 5;
 
 	if ($sub_action == "edit" && $id) {
 		if (!$sql->db_Select("banner", "*", "banner_id = '".$id."' " )) {
@@ -405,7 +412,7 @@
 		$text .= ($a == $_POST['startmonth'] ? "<option selected='selected'>".$a."</option>" : "<option>".$a."</option>");
 	}
 	$text .= "</select> <select name='startyear' class='tbox'><option selected='selected'> </option>";
-	for($a = 2003; $a <= 2010; $a++) {
+	for($a = $_startYear; $a <= $_endYear; $a++) {
 		$text .= ($a == $_POST['startyear'] ? "<option selected='selected'>".$a."</option>" : "<option>".$a."</option>");
 	}
 	$text .= "</select> ".BNRLAN_38."
@@ -423,7 +430,7 @@
 		$text .= ($a == $_POST['endmonth'] ? "<option selected='selected'>".$a."</option>" : "<option>".$a."</option>");
 	}
 	$text .= "</select> <select name='endyear' class='tbox'><option selected='selected'> </option>";
-	for($a = 2003; $a <= 2010; $a++) {
+	for($a = $_startYear; $a <= $_endYear; $a++) {
 		$text .= ($a == $_POST['endyear'] ? "<option selected='selected'>".$a."</option>" : "<option>".$a."</option>");
 	}
 	$text .= "</select> ".BNRLAN_38."
diff -x .svn -aruN 0.7.16.src/e107_admin/core_image.php 0.7.17.src/e107_admin/core_image.php
--- 0.7.16.src/e107_admin/core_image.php	2009-09-05 10:24:28.000000000 -0500
+++ 0.7.17.src/e107_admin/core_image.php	2010-01-22 08:36:18.000000000 -0600
@@ -11,8 +11,8 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_admin/core_image.php,v $
-|     $Revision: 1.54 $
-|     $Date: 2009/09/05 15:24:52 $
+|     $Revision: 1.55 $
+|     $Date: 2010/01/22 14:36:42 $
 |     $Author: mcfly_e107 $
 +----------------------------------------------------------------------------+
 */
@@ -26,7 +26,7 @@
     array (
       'beginner.php' => 'bbed82298047a4553e408cc460afe20b',
       'cascade.php' => 'b6fa1c7dddd3d44390b71ee08a4f0e51',
-      'categories.php' => 'b63b8bbc5027de63f37bbce566227c4f',
+      'categories.php' => 'f9ee2e59067ec08000a59104199f1983',
       'classis.php' => '428698ddfb7a4b1c5365bd351b2de43f',
       'combo.php' => 'a358842dea4d9c7c6a5865f8a3f392d6',
       'compact.php' => 'f8c7597e80b8a763651a58dc76ef23e0',
@@ -42,7 +42,7 @@
       'extended_country.php' => '9d6cf4a6e013a60c58d4687076bd187e',
     ),
     'ad_links.php' => 'bc9520a672754b6b283f734f9cbca86c',
-    'admin.php' => '8d2103f37e0353d51a2b75a5bf5083aa',
+    'admin.php' => 'c5b6064169444c7cb290fb0ff932fad6',
     'admin_classis.php' => 'ed861d18477db9ce0bc3620a69443723',
     'admin_combo.php' => '8958300a2a42fd2aa68977d566c1edb9',
     'admin_etalkers.php' => '9d684ef56c54bbf919e3346927cf4509',
@@ -52,7 +52,7 @@
     'article.php' => '7b21dc8ef4bc68ceb9ecf4d1c519a645',
     'auth.php' => '7dcd0adde42f2770dabc511c5d39e229',
     'banlist.php' => '6ff4252414f390d5080d778e59198a12',
-    'banner.php' => '0a0621d17caf7b6b81feae86c488fa71',
+    'banner.php' => 'ea233cfd4a1900c53a65309883e50636',
     'cache.php' => '62fc17d1f4c6db977c66642c5a76127a',
     'cascade.php' => '3d70a650778f09e6c85efd91b6ab5e4a',
     'categories.php' => 'cbbed37d26ab602700d46a0cb1955205',
@@ -62,13 +62,13 @@
     'comment.php' => '240a0a659d78c66c88ccf87341e4a520',
     'compact.php' => '20bccea2ef81cc86a86782fa4841e45f',
     'content.php' => 'bf2239404990afed185913002429e682',
-    'core_image.php' => '86c0c495be2753928bc01e4dadb51ec2',
-    'cpage.php' => '1df0b5ce8504060f4205abe16a247f63',
+    'core_image.php' => 'da8292f1df754f7699ab36723c68d657',
+    'cpage.php' => '2af6626d352252cdb393f51447b8630f',
     'credits.php' => '273cb301d908936a58a8d38b4e92ba5a',
     'db.php' => '1609930adca0aee8d3fe649e729feec9',
-    'db_verify.php' => '0699ccfd73686113023ee99cf406e6ce',
+    'db_verify.php' => '6914dea1498325e40066ddcdaab11761',
     'docs.php' => 'e5ebdd8fd30362636cfe1a3878b3fb18',
-    'download.php' => 'd094564bea2436690612c0e62e872acc',
+    'download.php' => 'eb33cb0fa0acf5bdb68afd6b87ed3bb2',
     'e107_update.php' => 'c23624862e7dc50fab29aa1890c7872a',
     'emoticon.php' => '9403ce6e8c4dc4ab34d32b3d74a1d699',
     'fileinspector.php' => 'e1d831bfb0ca6a9244a4ced5b0d85fc3',
@@ -92,21 +92,21 @@
     'notify.php' => 'ddd3d41f0c25db4528c9100c664f8e98',
     'phpinfo.php' => '994ea857810fe5f47ac8612f570aadb1',
     'plugin.php' => '61cbb2233ea02ae36ae683aaa256ee45',
-    'prefs.php' => '66788c47a76535afe18e4e518bb5e189',
+    'prefs.php' => '0a72c7d8a5aee33391314960ab886494',
     'review.php' => '1919d31943803a66cb2d12828bd92db2',
     'search.php' => 'b1239e5af6795205648d8965ec3a1ec9',
     'theme.php' => 'b05f7265501a3e1c5e7c47cb3f891831',
-    'ugflag.php' => 'b3b47767137dd7ea5e3726150507e158',
-    'update_routines.php' => '698d8846651f790d25d6fac3d620992c',
+    'ugflag.php' => '1406bbfb2d61475a6cf786e69e243eb1',
+    'update_routines.php' => '86058e8887a5cbe5059f6e8bea2450c6',
     'updateadmin.php' => '770fff43134883ea4d502498b28d70d2',
     'upload.php' => '26cedc21eaee3f3719e7a8aa591de10c',
     'userclass.php' => 'cbc4006fb0664fca537a910d2f54d59c',
-    'userclass2.php' => 'f82e66b1b45901c3c4b5158211086766',
+    'userclass2.php' => 'e3839b8174dedb39a8e4348a00b270c3',
     'userinfo.php' => 'd82d6eab0ae18e65b39f122193cadd3e',
-    'users.php' => 'bf2451b1d8c88001adb7174e052444e3',
+    'users.php' => '15a2adcc472bc1e726e2400ba6d4a04e',
     'users_extended.php' => '016339d4fdaeaac0d7e8bb7f91c46952',
     'users_extended_predefined.php' => '51128e45b6620f7b6ead6fbd8521b43e',
-    'ver.php' => '4058e237069cf55e650f4d9c493e625b',
+    'ver.php' => 'cc235c03eba17431cb58fde88315ff19',
     'wmessage.php' => '17afb0f8ef07cfd675cd92e9f7e606a3',
   ),
   $coredir['docs'] => 
@@ -154,7 +154,7 @@
       'center.bb' => '5a1957946e3d8898a0b3d86650771809',
       'code.bb' => '15d5237cb3d77aaa80e830ffeb6f6bbb',
       'color.bb' => '98b9d0ddcc76d2ee37af0f36eab8b1c3',
-      'email.bb' => '123a8b604a28524320639ba1e09bef35',
+      'email.bb' => '2a34e1c2752f7f4c1b903a831450402d',
       'file.bb' => '655f2a241ed9ba30d37803ba6d6338bc',
       'flash.bb' => 'b1000e9022a43d79457e0a58b4b5e611',
       'hide.bb' => 'cf30f78c78855565b0bf868a01142fb8',
@@ -175,7 +175,7 @@
       'textarea.bb' => 'c9af59e1cd5aedc873f40f40727b3685',
       'time.bb' => '3d83b0dfa9b139004bb19ee34b142b44',
       'u.bb' => '7f8703e65a5f24bd9d2edd5fc0dfef48',
-      'url.bb' => '29664480211309ec4b003a5e9e7505fa',
+      'url.bb' => 'e155b50c04ccfc87608a4b13486b9c46',
     ),
     'cache' => 
     array (
@@ -227,52 +227,52 @@
     'resetcore' => 
     array (
       'index.html' => 'd41d8cd98f00b204e9800998ecf8427e',
-      'resetcore.php' => '8a69dad2ea719f5f8a85160b049d34eb',
+      'resetcore.php' => '071ee061a66eb03cf4b239aeb5b01c09',
       'style.css' => 'e294495db6f91c4514c4f40d7b09fcd5',
     ),
     'shortcode' => 
     array (
       'batch' => 
       array (
-        'bbcode_shortcodes.php' => '979de9d7330c0e547d952f1c547d76e1',
-        'comment_shortcodes.php' => '97e52cf2411985c27833bbe5010b9e94',
+        'bbcode_shortcodes.php' => '6217387bb09cd7ccf238e60acbf4b640',
+        'comment_shortcodes.php' => '863dd332a109872a30f84b3dcd33cf6f',
         'contact_shortcodes.php' => 'd593f9dadff312c61eb27e32457d7f95',
-        'download_shortcodes.php' => 'cec84de6d1ce12113823adb02e2694d7',
+        'download_shortcodes.php' => '2e2d4f60ab50dc656e186925247cfc76',
         'index.html' => 'd41d8cd98f00b204e9800998ecf8427e',
         'news_archives.php' => 'b7513e4539e166bd371833f77b2c2434',
-        'news_shortcodes.php' => '6798aae0e58adfc65554dded3220439f',
-        'signup_shortcodes.php' => 'fbaad5179aa055dcd04f5bfdc6614782',
-        'sitedown_shortcodes.php' => '3ae9199cbae645d23869d517a5f6cef4',
+        'news_shortcodes.php' => 'c2a158cbafb4d7727f324dde64e257f8',
+        'signup_shortcodes.php' => '9b3feb7ccebc253b7a0826ccc4135a36',
+        'sitedown_shortcodes.php' => '3af27a1e8b5895ef7eb64ce80b300ce5',
         'user_shortcodes.php' => 'a3b47064debd03115dfb95cb82927438',
         'usersettings_shortcodes.php' => '21d6fd90f2efd6e7229fcf37d6ec689e',
       ),
-      'admin_alt_nav.sc' => '412e8fb7acac7746ea48b17854decfc4',
-      'admin_credits.sc' => '0eb1784fcb76e13c8addd81d9a741074',
+      'admin_alt_nav.sc' => '89693e0f8bded49fc0e75801e0d7086d',
+      'admin_credits.sc' => '1b7e691941c78f4a1d2cca5c7a81e839',
       'admin_docs.sc' => 'b010b7ac7618fa669c8777754a8337c6',
       'admin_help.sc' => '32247c5afa0c6afcd7f58ef51c5f105f',
-      'admin_icon.sc' => 'e479849c3b09aae88aae3532b0550a92',
-      'admin_lang.sc' => 'c45e891e84c208466768a591644df9e1',
-      'admin_latest.sc' => '96a92eb5000eb6e8f120b70734239968',
-      'admin_log.sc' => '68d201ee791ca1a72faee5dd643d3578',
+      'admin_icon.sc' => '4843c11cc5e5e14db4d5cacd537569c2',
+      'admin_lang.sc' => '7e18b909a1bcf3ce648e2c1a4a291b15',
+      'admin_latest.sc' => 'fb06a6035e4d79e2174fac1bbd86280c',
+      'admin_log.sc' => '9ed4a14759eb20032fb3e953b3374ce3',
       'admin_logged.sc' => 'dec16fb0a9f5485db6ca1b4955753c2e',
-      'admin_logo.sc' => 'bcfbd47e276c41bb3e13fd29346fa6d1',
+      'admin_logo.sc' => 'a97a3ad7bd7a505373ca5b794310a7ff',
       'admin_menu.sc' => '33785fcda56c60c219a4cc30f6018f5b',
       'admin_msg.sc' => '1906530f20e337964878fd144b1047c5',
       'admin_nav.sc' => 'c22be64cb31ee333f0510f6dd8778363',
       'admin_plugins.sc' => '67b6ef3a70b37eb92ae585f20334b9ca',
       'admin_preset.sc' => '57769dcbc4c658c8b14fbc0b19b94a28',
-      'admin_pword.sc' => 'abbe3f9d2709e86cfb37b378f2b3d13f',
+      'admin_pword.sc' => '242c091ee9825a4cf76674a7a0fb3b06',
       'admin_sel_lan.sc' => 'a71547c6cf41f800a8202b82cd504e64',
       'admin_siteinfo.sc' => '28e2f558747ecd09ee787b6f46eea3bf',
-      'admin_status.sc' => 'dd09c0b576dba2e5e9c710d7a932c9cf',
-      'admin_update.sc' => '19dcb86c4e80082a4071aea0ce8bc98a',
+      'admin_status.sc' => 'c201d54a31f083bce30477b62018da12',
+      'admin_update.sc' => '34243f3956bdf2b4c3270ab4fc60d8d3',
       'admin_userlan.sc' => 'd1ced8f4235d221877e47efcaaecc835',
       'banner.sc' => 'b5d2407d670146f95bb3c36edc2ca42d',
       'breadcrumb.sc' => '0591ee7dc26ded7ac9a359dea4b8fdf6',
       'custom.sc' => '0aceab8e9198f1ad243efca346c6ab6e',
       'e_image.sc' => '3819fdf5b9dfc7b189fb4073d33ae0d5',
       'email.sc' => 'a587a1b51fbefc39f3f267dfabe9d302',
-      'email_item.sc' => 'fa6140b7829cb0a32ae04ae4efd24d94',
+      'email_item.sc' => '9b33c016a97ff8ccb3b544ded7030712',
       'emailto.sc' => '2a090d41cd91744486aa4f74519f3c4b',
       'extended.sc' => '868d45e725d7565a1d9c5b743aba0967',
       'extended_icon.sc' => 'db16dbaa0dfa2f8fc944ba87c15a09d1',
@@ -285,15 +285,15 @@
       'logo.sc' => '7989dac8bea9ec4c0da489fb942ae507',
       'menu.sc' => 'fcc5325cabd8733f2b13f9406935ed3d',
       'news_alt.sc' => '25596ffed2cf4bed831b80397c77e295',
-      'news_categories.sc' => '5bcd029587b243e7206cb98a5411f286',
+      'news_categories.sc' => '84c01e079adf626fb875897e290bd212',
       'news_category.sc' => '25596ffed2cf4bed831b80397c77e295',
-      'newsfile.sc' => 'afe0363c51236eacdf1a5434d17533a3',
-      'newsimage.sc' => '75738371cff6146174ea00971730a0da',
+      'newsfile.sc' => '6f2f1591deaac955082369a610096aa0',
+      'newsimage.sc' => '9d887c7ae3e14839b7b0ecd13e8d40ed',
       'nextprev.sc' => '85bade909702980372c5c1c0b728dc1d',
-      'picture.sc' => '0f4d00920f1ddbac7293549862b3c0da',
+      'picture.sc' => 'aa9bc096ad37b40df413638f8d259fc9',
       'plugin.sc' => 'be06266acd86f06b244dd27266df8f12',
       'print_item.sc' => 'fb3b5508fed60548689a5c496d45e1b3',
-      'profile.sc' => 'ea7fc4eca12f39e19a735d2014fe341f',
+      'profile.sc' => 'abb4a34666ab0449e79291f0c3409523',
       'search.sc' => '12a174161a186e9a936fc10c946f0517',
       'setstyle.sc' => '88ec920b668233bd21ba95e2cdd607e7',
       'sitecontactinfo.sc' => '5467f65cd62b910389014b5fb8b33fe5',
@@ -307,10 +307,10 @@
       'theme_disclaimer.sc' => '606d98f47c1a64b179d9baf6e6930dbc',
       'uploadfile.sc' => '85ea5b2a10cde7c2267a40c359694aed',
       'user_avatar.sc' => '1501550f2414900d47edee2621b2e624',
-      'user_extended.sc' => '96cb880827295452164bd86c24cb0e78',
+      'user_extended.sc' => 'cea27d6ef17122c2368703c67b3cb363',
       'wmessage.sc' => 'c24f80349ceafd36f6cf0d6ec6875fa7',
     ),
-    'def_e107_prefs.php' => '5cec5e4f536beba7617fc585bbeac0a4',
+    'def_e107_prefs.php' => 'f20aa4b5c31f1fd0eece77f9b6931431',
     'e107.css' => 'e5cfa4047831f19def7df032ef8bc830',
     'e107.js' => 'e6e6fd1d50c5aefbe1a4c3ff0e4ced3d',
     'e_ajax.js' => 'b583773e72852158e27af8a9bba7c97f',
@@ -400,7 +400,7 @@
           ),
           'contextmenu.css' => '93ad8b3e8a5e1a48bf6ed727ca0384e2',
           'editor_plugin.js' => '615aede93687b7373e0518026a69d65f',
-          'editor_plugin_src.js' => 'a8ec7d4ed27fc25535456034069ca507',
+          'editor_plugin_src.js' => '0b695569756cf95e50df51bdaa8c97bb',
         ),
         'emoticons' => 
         array (
@@ -436,7 +436,7 @@
         'iespell' => 
         array (
           'editor_plugin.js' => '22526393cacb6447a0e3bfff2fb47773',
-          'editor_plugin_src.js' => '46a827c6cca2c40b0ec0402b454d8bd0',
+          'editor_plugin_src.js' => '846a9f4f15578063c989f5a42f7e0aba',
         ),
         'media' => 
         array (
@@ -478,8 +478,8 @@
           array (
             'en_dlg.js' => '3439c7545446063966919aaaf8c9bc93',
           ),
-          'editor_plugin.js' => '8711a73c0d6d417b635bf646dc5091c8',
-          'editor_plugin_src.js' => '2be6ec26bfa058d65bd23140e212707c',
+          'editor_plugin.js' => 'bcd5c851ca50eee87904b410c13c6d8c',
+          'editor_plugin_src.js' => '0e884e66491675542922768bf2e726c7',
           'media.htm' => 'ac37ca5e4be99e68ade8f8032e9042f1',
         ),
         'table' => 
@@ -511,7 +511,7 @@
             'cell.js' => 'd445d72fffdcbb12318d6019be4d1a53',
             'merge_cells.js' => 'cd321e3350c013d4123ec52ea8ca6173',
             'row.js' => '47978778bbc411d5dff43d1b437c4b70',
-            'table.js' => '4d836bff1b1f83c78581b1a19c54d6a1',
+            'table.js' => '8adaeae2fb56ed12588839a231654775',
           ),
           'jscripts' => 
           array (
@@ -525,8 +525,8 @@
             'en_dlg.js' => 'c1b41c798f4b9c6de38fdd28c9e7c2e2',
           ),
           'cell.htm' => '8897de52c93d9291d6b4312f6fa5b06f',
-          'editor_plugin.js' => '77d2afc9920cc9c46cbedf78e8f47b97',
-          'editor_plugin_src.js' => '81beb2553cc06be39b0fb88c5b4a3d93',
+          'editor_plugin.js' => 'b7789df41d0e9d67b532c4dd6a236b8e',
+          'editor_plugin_src.js' => '0b10410d75ccb9bbba0677282ab5faf1',
           'merge_cells.htm' => 'e186ab851531e109edfe36463de1194c',
           'row.htm' => '9c2f070ff15d6d76d86159c183432d44',
           'table.htm' => 'd834be5d0d403f36ca024aee92454e6f',
@@ -665,7 +665,7 @@
             'charmap.js' => 'c2efdc6070e8d49ab61179d086512749',
             'color_picker.js' => 'cd77c90f08f79f0653ea74efb104fdcf',
             'image.js' => '466f1e7b127166b8bb865f5006d280b0',
-            'link.js' => '9dbd489e76753fb9f6ac65be0863117a',
+            'link.js' => 'c32414e9afb8d7887903a182c6886517',
             'source_editor.js' => '9e10d96960c09241fef4ee2e0024411e',
           ),
           'jscripts' => 
@@ -704,11 +704,11 @@
           'about.htm' => '866230a747a5dc27812b6fc80f5edc6a',
           'anchor.htm' => '89fc96bc71b8f51c409ebeef480b148a',
           'charmap.htm' => 'c9f33a629f80fe46c4012dc17948576f',
-          'color_picker.htm' => '1cff74c461e5e659499dca809a20a02d',
+          'color_picker.htm' => 'd3e7193150c1c4dae2eff6102663a1e1',
           'editor_content.css' => '99f256c087e16872937f6cf9e4ea0c32',
           'editor_popup.css' => 'a2bbb5f95ba2d3422c1666222170d700',
           'editor_template.js' => 'e4f47b78c98d99433c91ec4a145f7ff5',
-          'editor_template_src.js' => '0b23a1d936587b11a71df98c27f09fc1',
+          'editor_template_src.js' => '53651bf7742c2c6a8004ad3a93506c7e',
           'editor_ui.css' => '62632779c868eddf46f3a8e121083d31',
           'image.htm' => '8453941b410a1a31f5d79e2ac8a41e0e',
           'link.htm' => 'de02c48a8f1664f083bae483b57e4781',
@@ -717,34 +717,35 @@
       ),
       'utils' => 
       array (
-        'editable_selects.js' => '21d35147bc49d964207943b002741b71',
-        'form_utils.js' => '8368da1eed7cc3329705e6bae180dec7',
+        'editable_selects.js' => '87431d12ad02791a8011c49fece0d6d7',
+        'form_utils.js' => 'ab110f8cd8e8f95bb502d3f235a3c29c',
         'mclayer.js' => '1c7d5ff736bf571af7b1407758db937e',
-        'mctabs.js' => '6e6136492058c6604b825381dc3ee409',
-        'validate.js' => 'a19e8dfb6020378bf0f4e41bc6ba140f',
+        'mctabs.js' => '8dfae5c7d17c514ded5526eadfd90851',
+        'validate.js' => '416c3f02787f9b7382a22cc278327c49',
       ),
       'blank.htm' => '72406c871a9be7972922686221a885a2',
       'filelist.php' => '63d5fa62565bc100d3345de82ab36985',
       'index.html' => 'd41d8cd98f00b204e9800998ecf8427e',
-      'tiny_mce.js' => 'a2ab08e402c47c4745a9853cc813e3a7',
-      'tiny_mce_gzip.php' => '846511eed428312feca1f0e5fec6cd91',
-      'tiny_mce_popup.js' => '6205d9cde4b1151ecf8ddcee6fe1c5fe',
-      'tiny_mce_src.js' => 'ef1de7b4cd52f8e2d91ad5c1c291e026',
-      'wysiwyg.php' => '5f33c86778ac867848d5dc252f1d1ea6',
+      'tiny_mce.js' => '9f93010a684382a5ff180c275f0ee985',
+      'tiny_mce_gzip.js' => 'ea730144f7836073b9dcc0bd09c3ab5d',
+      'tiny_mce_gzip.php' => 'a6c454f4e208b23d4cde4ec3b102ddb7',
+      'tiny_mce_popup.js' => '8ccd8e1ecd2700cb83ee770337b3b542',
+      'tiny_mce_src.js' => '3e0019162c45c999336c2fa811e4f522',
+      'wysiwyg.php' => '1bf50a462912590d5a217c7f1f111a95',
     ),
     'admin_handler.php' => '2d593943e40bf02d5d46cf6b6af6b7e7',
-    'admin_log_class.php' => '3cc96f21bcc7399e29c2b75d17fb2171',
+    'admin_log_class.php' => '6c5e7fae69c65876ee5d6dd890ce53f7',
     'arraystorage_class.php' => '4862b38926c8f68029c95d31990435a4',
     'avatar_handler.php' => '54c9f790d9f17e30f52b8011633d486c',
     'bbcode_handler.php' => 'f67a6447b8b883db0abc7fb20a572eb1',
     'cache_handler.php' => '87bea235aa6d8e55f1268675b237ae43',
-    'comment_class.php' => '85fc3b232366060f8cadd2ae31ae5fce',
+    'comment_class.php' => '73eb1c6a1b25e6c41d466267788152c2',
     'date_handler.php' => '35cd4c6db33032c31a3d1b622e0019ae',
     'db_debug_class.php' => '143f5d3f5a3545e9f041470ba1c5398f',
     'debug_handler.php' => 'f3f9d7859d53842492bf2b3c5009bb91',
     'e107_Compat_handler.php' => 'e76211b3178e4a9724933ecfe85ba8ea',
-    'e107_class.php' => 'de0052a652261489b4b9609b3b70af6c',
-    'e_parse_class.php' => 'fd67c8736895d13061299c83a5791a20',
+    'e107_class.php' => '6be837c862427a9a7503e1ea98d315e6',
+    'e_parse_class.php' => '1800de545be485e5bf9ab8a35cd09c89',
     'emailprint_class.php' => '7e364bbec69540e1087c19291d24e97a',
     'emote.php' => 'bbda3eafde2bb54c645194bf72dd47e3',
     'emote_filter.php' => '6348bb4a8adf203fccc2b5ecf4bff378',
@@ -760,9 +761,9 @@
     'mail.php' => '248bc747f9b99bd66acc3442b5c8d926',
     'mail_validation_class.php' => '75e722bf8c6975349ec402682323314e',
     'message_handler.php' => 'b6adb65802a3b790d7f8d0735a72364b',
-    'mysql_class.php' => '62b981a7b000a1ae33e28aebb4981178',
+    'mysql_class.php' => 'abdca227a3ed1a2e9fc59d023c5b553b',
     'news_class.php' => '6922663e75de2596a2662760f7f32c8c',
-    'notify_class.php' => '2d5c9ff51c06bddbdc21d80ff937e70c',
+    'notify_class.php' => '4efbb38b0c8c782fd5936f82b3a47643',
     'np_class.php' => 'c094b25f1ad27fff15947d364c9709f2',
     'override_class.php' => 'a1f7451103a7fb47f3e541c31cf32343',
     'parser_functions.php' => '81daef0e484ee070d440e4ebc9bc8095',
@@ -772,7 +773,7 @@
     'pcltrace.lib.php' => 'eb165fe908cc30c85975b7d35614990b',
     'pclzip.lib.php' => '1b0212a9a1e09b781172c8f6964296c2',
     'php_compatibility_handler.php' => '04e73e8835f5fd14a5febd20028c27d9',
-    'plugin_class.php' => '6a6d576a19c6d751944dd36b4925f942',
+    'plugin_class.php' => '8d1e4d6eaf865ef86ae8e566497fc2f1',
     'pop3_class.php' => '3164abd686583e15f96901ab722cd272',
     'popup_handler.php' => '8915aa18adc4e69df003becaf508003d',
     'pref_class.php' => '07f2ae7553c443ea4670abfb0ce23359',
@@ -780,24 +781,24 @@
     'profanity_filter.php' => '8287df29151f6bcb3b18b2230c85b45d',
     'rate_class.php' => '797ca52a4635684f253215fd1f595d70',
     'ren_help.php' => '3669752caadf96c167ee0674b23d8296',
-    'resize_handler.php' => '81c4ec905d4264437609d716226ca269',
+    'resize_handler.php' => '84bbee50fb760caa5056d34cb0bb91a5',
     'search_class.php' => '602ae9a9715b1fa9b04361bf10853e9b',
     'secure_img_handler.php' => '2cf9d9bb7616a5cc9d04d782a7bf8611',
-    'secure_img_render.php' => '7364c99eec3f7881b7e4c0a10fc75cdf',
+    'secure_img_render.php' => 'd3de35000a57f1e966e8161cb6644f6a',
     'session_handler.php' => '54f987aa4f0f2a31c646d9e0f81cd061',
     'shortcode_handler.php' => 'd7a00666489e6ae6ecfc57e9c5181206',
-    'sitelinks_class.php' => '538d7b083e4cb7f4c53aa72a5659ebdf',
+    'sitelinks_class.php' => 'c5d25658fcd5873e0f19a6874855b279',
     'smtp.php' => '71008c80b0a5e12faef990c0560f8226',
     'theme_handler.php' => '3a9a09ee4c47d1998d94ed0213b55020',
     'traffic_class.php' => 'b7cf43a2901e7e33e1c752d8d019fc8a',
     'traffic_class_display.php' => 'ab41779353db54ab54c6317f0464bae0',
-    'upload_handler.php' => '7c0f8b9d913d54bbb9f59526dbc0a996',
+    'upload_handler.php' => 'dd2fd5950d957f3fbc6eed19fcfceebd',
     'user_extended_class.php' => '457b2971e01c3149e2c2a59a8b42ebda',
     'user_func.php' => 'bb871abafb6c91109c809afa9514afcc',
-    'user_select_class.php' => 'd0ce7bea9522abbea48869734f8953ec',
+    'user_select_class.php' => '96101cbd954f536a4d8acfbd3c48a648',
     'userclass_class.php' => '2153be8f56417d0136b4fd01b80090e6',
     'usersession_class.php' => 'dcd6889bc9e8a11cba08fdd13f629615',
-    'xml_class.php' => 'f2c2995aac01ae6cc71a68f831b26d59',
+    'xml_class.php' => 'a6d97657089e41a4ddee26ba22bfcaf2',
   ),
   $coredir['images'] => 
   array (
@@ -1251,7 +1252,7 @@
     'logo_template_large.png' => 'cce83a8f84255d2bab00522b73a4e6d4',
     'pcmag.png' => 'abe521ccc3a89a43ff641ab3daf1f37d',
     'splash.jpg' => '7f749391cb6d31dcf9c9145f3d30df4d',
-    'thumb.php' => 'f5b3fd7e9034d12f538ec54fc24c5394',
+    'thumb.php' => '8e017b11162f39db45c61d4e5dad7f75',
   ),
   $coredir['languages'] => 
   array (
@@ -1262,7 +1263,7 @@
         'help' => 
         array (
           'administrator.php' => 'bfc3305d4af30024ef36e2c3cac685d5',
-          'banlist.php' => 'c250d64286674097b02906f4d71aa2f7',
+          'banlist.php' => 'f2248eceaed8e6bee2026ba65131ef6a',
           'cache.php' => 'f889aa4a1889a3112699c899eb655744',
           'cpage.php' => '021075ecadbb8683c0f567e91428e112',
           'db.php' => '56210313eb216b42cedde3f548461f70',
@@ -1293,7 +1294,7 @@
           'users_extended.php' => 'b73f20ff4c7d9f9b9eae883b300b2426',
           'wmessage.php' => '5aa5f420a6b29adad555ef7e55bd932f',
         ),
-        'lan_admin.php' => '0c19f38956892b98193c09327bf87e17',
+        'lan_admin.php' => 'b3ab0cb02553af8882d8ce9bb1b80797',
         'lan_admin_log.php' => '0f9dacdf93cb2d6a4145487de304cb87',
         'lan_administrator.php' => '59f82614923f75fe228f3356c94a50b2',
         'lan_banlist.php' => '4d598bd8a459d29905c29cc884ddc474',
@@ -1326,10 +1327,10 @@
         'lan_newspost.php' => 'd0b0582ef13530ea0c49d7f66df532db',
         'lan_notify.php' => '65a1a5a108c74ba8b2db5592c06a1ecd',
         'lan_plugin.php' => 'b1601f8c8075936fc4f204292c95cec9',
-        'lan_prefs.php' => '8ba7fba8bb47c0c0dcaca5d3e73ed4f8',
+        'lan_prefs.php' => 'b4f47be711cbf4a6f85618d88504be89',
         'lan_search.php' => '40348a80633b22b4013d2d21e623969c',
         'lan_theme.php' => '193c87b22b71daf4d434a672c873f96c',
-        'lan_ugflag.php' => '29f0ad8c752be1bf98cc067534994711',
+        'lan_ugflag.php' => '85a55702bd4727439416baa845814545',
         'lan_updateadmin.php' => 'ae3d2be7d92db3c4dd11f1e73fafeb7b',
         'lan_upload.php' => '2343ae710abf563db9beba208370675e',
         'lan_userclass.php' => '4ea892222af2878ae303e6234545107c',
@@ -1348,11 +1349,11 @@
       'lan_email.php' => '499e255fe29b037d49ea7b50fa679c09',
       'lan_error.php' => '9d5d4ac7a6672f0be9c83b06cebc8d16',
       'lan_fpw.php' => 'cb552bb8035414854363a77d844b194b',
-      'lan_installer.php' => '56c0e1638370b88f328e027f56fb194b',
+      'lan_installer.php' => '60b4f025eedfeea0389fba574b1de28b',
       'lan_login.php' => '3bf7ecb7c00be86b54c83370fab6f8c6',
       'lan_mail_handler.php' => '001b336311279c058df01c2ae04aa87d',
       'lan_membersonly.php' => '102bba47b482668bb433a5a607767bae',
-      'lan_news.php' => 'c3d990cb42ba5d40c6eaf915f6122448',
+      'lan_news.php' => '71dfe784ddd1407cc0bba2ac259a5982',
       'lan_notify.php' => 'f930fc0c3afd1516e3b63f63f6f51e16',
       'lan_np.php' => '3d6c87e7ffeaa79de1ba06da0175f367',
       'lan_online.php' => 'cf15db263203fc5cca674ac1e03923bd',
@@ -1406,9 +1407,9 @@
       'alt_auth_readme.txt' => '75b056df0169fa9a03bb31633d7fcbdb',
       'alt_login_class.php' => '343de18d3ab651476e092c72d484ae41',
       'ldap_auth.php' => '4d740c0d4ba51a7a8437df5fd6de3b85',
-      'ldap_conf.php' => '32f0718c8d2a6aa7f8d7b378ac0f371a',
+      'ldap_conf.php' => '4f502e0cc7f64f1511c9c18eb4c1a3ec',
       'otherdb_auth.php' => '868524702a10c3046d7822b463f82477',
-      'otherdb_conf.php' => '7871556c81544d7373f2adb7e49414f5',
+      'otherdb_conf.php' => 'eeb2f8f50cef75a4c6f417fb87c8f4db',
       'plugin.php' => '918fb0e07512efb82b6cecb01c566ba3',
     ),
     'alt_news' => 
@@ -1421,7 +1422,7 @@
       array (
         'English.php' => '34df03d8f502238bd6f3c8102f1fc399',
       ),
-      'banner_menu.php' => '32329ab6e68ec3b1cc6ec89374f3b4d6',
+      'banner_menu.php' => '0c3f634d646e176d71f71d171b167c45',
       'config.php' => '031969acc0c80390f405d4d56548ddcb',
     ),
     'blogcalendar_menu' => 
@@ -1430,10 +1431,10 @@
       array (
         'English.php' => 'bc4d844c9b0b8bb553913eb462542620',
       ),
-      'archive.php' => '1009f74ead67c5d568b5def571c7ab8b',
-      'blogcalendar_menu.php' => '5b8f10870951812d9702255d129e40e8',
+      'archive.php' => '6f2f66d3a9e706601505057e808c9c0f',
+      'blogcalendar_menu.php' => 'bbfe916cde09f90904450af2217199d9',
       'calendar.php' => '4c05e65f098d38d7ed84783a479d999e',
-      'config.php' => '8bf4ecf1ebf7b0a2628081ebdee358bb',
+      'config.php' => '8631f4f642ce1c85b5cd1eae0a425472',
       'functions.php' => 'f2cf77b89db87b5ac5d2a3935fd4ac59',
       'styles.php' => '44147a6b0a19c0228b6639ece5d79733',
     ),
@@ -1474,7 +1475,7 @@
       ),
       'languages' => 
       array (
-        'English.php' => '158355ab3a26f8c709126af50bbd4000',
+        'English.php' => '52530ff236e2f6499638a8cad0067f71',
         'English_search.php' => 'fc1f68851e4c41b94e1bf1fcf9c25e10',
       ),
       'log' => 
@@ -1488,18 +1489,18 @@
       'admin_config.php' => 'a1561d1cfc0cff6e5317dd58e7fe2946',
       'calendar.php' => '384127d0d8b697614b1b477514b7828a',
       'calendar_menu.php' => '89fa2cc5825235633565c48682940e16',
-      'calendar_shortcodes.php' => 'ebaa618f412cf3bc5f86ace42d413933',
+      'calendar_shortcodes.php' => '154b51d8ce3bad535c8ca9404f5c26a7',
       'calendar_sql.php' => '39899457df794d8b56c58d3b1c8db88e',
       'calendar_template.php' => 'd852ceef7f6c8c10c5b10db571e16ccb',
       'e_list.php' => 'bc86836aabe7f01b4285d512a3079e9e',
       'e_notify.php' => '4c206cee17bed1c6b02f66fe202252f5',
       'e_rss.php' => '077b415bf70aaae7b8de3d55a5912632',
-      'e_search.php' => 'a1681c6fed9972dd140b72b3ebfbd3c8',
+      'e_search.php' => '362f6a829204843bd9b631efc103f1ed',
       'ecal_class.php' => 'a1b10a8c8695f4cff9ed82e310825189',
-      'event.php' => '176f5d5c5d86d111205c7c07f3dde5c3',
+      'event.php' => '3cc0770931d8403d5202a5f834d3bee7',
       'index.html' => 'd41d8cd98f00b204e9800998ecf8427e',
       'next_event_menu.php' => '6d1819f703dc045efa0fd1a4041e6545',
-      'plugin.php' => 'ba58d6517d948f30f27dcbd7d1c2026a',
+      'plugin.php' => '57db903e7554311f2b1b9d025c42d7fc',
       'readme.pdf' => 'bde9420355a7306b71df8c5143575347',
       'subs_menu.php' => '816619639ab421ff3229f6536bb33416',
       'subscribe.php' => '4bb2bd64a5ef6aa97f9d70e0401ee465',
@@ -1527,15 +1528,15 @@
         'search_parser.php' => 'c576ea7d07ce91c106c3bae38912237c',
       ),
       'admin_chatbox.php' => '7d76c868314e4b0a58f1dd39555f9602',
-      'chat.php' => '9841a76774363747857756af2efa089a',
+      'chat.php' => 'bf857182350037976569c25605b3fd8c',
       'chat_template.php' => '14c2ebf62352cf10f2b0b83e100ae856',
-      'chatbox_menu.php' => '220560b75963403cec5df91632b2366f',
+      'chatbox_menu.php' => '52f23167ebd7b672b7ae3ef9d439f3aa',
       'chatbox_sql.php' => 'aeb0d501ff23212e304f7f9a83d6926d',
       'e_list.php' => '11fde3fe8b58bec52bc6220053498509',
       'e_notify.php' => '379fbef832829bc4e9188b9fed62f31f',
       'e_rss.php' => 'e48224955d484055c9c662f430d529ae',
-      'e_search.php' => '172e48694433f84b0f8d43ffb880e881',
-      'e_status.php' => 'd5fbab54f8fcb5ec5eaa42c1b328cf6a',
+      'e_search.php' => '8ad9fbdda429f4577da3cfdeaf2e2ce2',
+      'e_status.php' => 'ec7b5b0100e4be7210ea7e786096eeee',
       'plugin.php' => 'e5cdb4f2a42dc00b08d06b33dea455ed',
     ),
     'clock_menu' => 
@@ -1561,7 +1562,7 @@
       'comment_menu.php' => 'd3991926641aecf015f1acd6a3baeda6',
       'comment_menu_shortcodes.php' => '4c9b1835a7e9ef640fd708ce1fe09e82',
       'comment_menu_template.php' => '17f0cb0b44f43d0cf62770f2b7cb4526',
-      'config.php' => 'd8e5bd9258392c98d02009d552401aa4',
+      'config.php' => 'dfd61f70ec63748c9b4165e1b1ed6a2e',
     ),
     'compliance_menu' => 
     array (
@@ -1580,12 +1581,12 @@
     array (
       'handlers' => 
       array (
-        'content_class.php' => '2c19037a14a9f63c772f0acb1bb65aa4',
-        'content_convert_class.php' => '2e05d94418f8960eaac431741ce402a1',
+        'content_class.php' => '3239c1a9bf13760d0237db20e8a85629',
+        'content_convert_class.php' => '8c470c21aa29c843ab075f4d00b541da',
         'content_db_class.php' => '5274299167623166e2f573af85f0f614',
-        'content_defines.php' => '784711a6c68dc17c7752fb084400229c',
+        'content_defines.php' => 'f868c812a77fccfde537e59983c53057',
         'content_form_class.php' => '4b170990cb25cc001ebf69b0ee8b21d0',
-        'content_preset.php' => 'b91ea8f88734c800267bcf9761f2ea94',
+        'content_preset.php' => 'd7e6c36b40990e0e47b3ea2ce7a1c7c8',
       ),
       'images' => 
       array (
@@ -1663,7 +1664,7 @@
       array (
         'English' => 
         array (
-          'lan_content.php' => '1aabfcb774f17c28c7efadc19595adfa',
+          'lan_content.php' => '691107d1f32cd5146836a1777a53d54e',
           'lan_content_admin.php' => '8f25ada52878c4c2d9107f55a828c468',
           'lan_content_frontpage.php' => '1593838cd7ec925d50576a815bd3c9ee',
           'lan_content_help.php' => 'd7cea6d1b8db2650fce4962ddfcd295d',
@@ -1702,25 +1703,25 @@
         'content_submit_type_template.php' => '7b02354f168c4584ddd25ae8cca95977',
         'content_type_template.php' => '178512ba5abfce22a227339ecb5f0f73',
       ),
-      'admin_content_config.php' => '5eaadc48ca7f9d18cfcbba35937e778e',
+      'admin_content_config.php' => 'f36e878c65a8c79f043bc0331c1ca7d0',
       'content.js' => 'd41d8cd98f00b204e9800998ecf8427e',
-      'content.php' => '5fea84528fc95622b37bd2bc2d67bd5c',
-      'content_manager.php' => 'f05358be1e9f851366e6483a5c1fce9f',
-      'content_shortcodes.php' => 'b8292c1d2dbcf9cc3cb9e073b8e1cc00',
+      'content.php' => '3f38478c70fcb4d2369a2f726034cc23',
+      'content_manager.php' => 'bc9ac8cebbab351f315d47c0e2a98b2c',
+      'content_shortcodes.php' => '6fe643a18d7f1b8a877eed93f82bb165',
       'content_sql.php' => '2632a603dd04ed62bbb3f011d3c5de41',
-      'content_submit.php' => '15c56c828ea76a15aff7f020c0806d8f',
-      'content_update.php' => '3820d50a8de13fe523bc58e949229e67',
+      'content_submit.php' => '88504858bf71151a83e4208f9f2aaec2',
+      'content_update.php' => 'c2d108e2cf5541bbb73c7c01fb9acd5e',
       'content_update_check.php' => '83b6aa48eb79b70555f5d2d578baa07d',
       'e_comment.php' => 'd1f4f87a428c69c499818721d0f48331',
-      'e_emailprint.php' => '48572a480656347a64798b024168a7f1',
+      'e_emailprint.php' => 'acc4b0a4487f9de59e2c4f0515c84eb0',
       'e_frontpage.php' => 'fe4139040c268b13517b9a78fa35f190',
-      'e_help.php' => '950985bb6c445147d901bb4fb00b0f1d',
+      'e_help.php' => '0ba79a1b479f0f3a30329705f16db9af',
       'e_latest.php' => 'dad7101dbd2063723e94300723e67c2e',
-      'e_list.php' => '1e789a60e65a1273d9e89330285e90d2',
+      'e_list.php' => 'ab980f0952f90a44c3d27ed1edfcd354',
       'e_meta.php' => 'cbb645eebdedb216511c413fe64991a8',
-      'e_notify.php' => '66aca77c03a989a7466472266ff76939',
+      'e_notify.php' => '319fd61014384a89c0c6a4e8d9ab7f41',
       'e_rss.php' => '76954b881d598f26ecaebb4422f87696',
-      'e_search.php' => 'd86c2f562c466bd7200974bd16f07c45',
+      'e_search.php' => '0f2e95d9e27859e3465199cad83ab06c',
       'e_status.php' => 'cf12158206b16c94292788fb9771c478',
       'plugin.php' => '56bdd9e6d08541f0a9c79d512888503e',
     ),
@@ -1906,27 +1907,27 @@
       'e_linkgen.php' => '3184982dc3f9321a1d85df7cc41acf70',
       'e_list.php' => '523f01012192923c6901b7c088101ec0',
       'e_rss.php' => 'cf96fbd5d8ae9f83f6ca2b98ac069970',
-      'e_search.php' => '663a93cb1f0d05351ecbb85a3bf721d4',
+      'e_search.php' => 'f4c56981acab39ba01655f3e87e30178',
       'e_status.php' => 'e707e64a960612d443e16906faaf0e22',
       'forum.php' => '0bd4c27751efefb21188c3b483a822a7',
       'forum_admin.php' => 'bcc90af18bfeb211562007d667f3f80c',
-      'forum_class.php' => '61090373b95e4863d6c77cb136996378',
+      'forum_class.php' => '4372e64170d812460463f9ddaa62a43e',
       'forum_conf.php' => 'dbb20dfde501333fb794b1925d981416',
       'forum_mod.php' => '1071403b53a79f9122e711658c525a33',
-      'forum_post.php' => 'b545afc689403e19d7b0bcbacd57e260',
+      'forum_post.php' => '44e549ec7d03a16f2931abb7f13c6925',
       'forum_post_shortcodes.php' => '58d0390a6fa95d713603a203025eb3f2',
       'forum_shortcodes.php' => 'dce37f018fa3be3a2bb67c740fe4725f',
       'forum_sql.php' => '3355b8219c200d8d669ce08e59053465',
       'forum_stats.php' => '469ac229ea060727f3615e001f16a58f',
       'forum_test.php' => 'ed668e3268952cb268b3f4aca0d2e37a',
-      'forum_update.php' => '8e1fed1bae66e84eb3ad0235a60f0c69',
-      'forum_update_check.php' => '95b6355554098357b5648807c4e95705',
-      'forum_uploads.php' => '64ef8a41ae3938271710a64d622bb830',
-      'forum_viewforum.php' => '2f35f7cafbc651fe80991d4b7c83c1ed',
-      'forum_viewtopic.php' => 'ab460e959ba4523374375e92abebb874',
+      'forum_update.php' => '63a5647f79debe75e715681adfe2dd76',
+      'forum_update_check.php' => '2646a43a914e31003f48dda463d66267',
+      'forum_uploads.php' => '36fca56a93b36c9cd3496d349c50bce4',
+      'forum_viewforum.php' => '7200f82f14234fb54d819b6370e05868',
+      'forum_viewtopic.php' => '0d4242f1f118e20a102e1ed76adcf467',
       'index.php' => '1d225ecdb6dfb425fcdd39501ed196c7',
-      'newforumposts_menu.php' => '986abfe5b636e93afdb1e50b57df2ebf',
-      'newforumposts_menu_config.php' => '264e2763fdd9f384af958c3d76272a5e',
+      'newforumposts_menu.php' => 'ab6b416b0ad01df3f854398a66cb148c',
+      'newforumposts_menu_config.php' => 'f38dbc7c32d27aab6c0e95bc15c592ed',
       'plugin.php' => 'f0d1b3a504ce7ca5f93e7f905f2a52cc',
     ),
     'gsitemap' => 
@@ -1965,7 +1966,7 @@
       array (
         'English.php' => '847602620978795e90813a8ca2c2b2ec',
       ),
-      'lastseen_menu.php' => '2f1a208abccccfe316824d1defe2c857',
+      'lastseen_menu.php' => 'a0738ef6ff27ef111b4f65fe959c385f',
     ),
     'links_page' => 
     array (
@@ -1994,10 +1995,10 @@
         'search_comments.php' => 'f887861124deb8c3b087359cb9f3210c',
         'search_parser.php' => 'ff43c05ffddd9ce508c98e913f90e167',
       ),
-      'admin_linkspage_config.php' => '5576e1a0eee8984ad5909d901e481b30',
+      'admin_linkspage_config.php' => 'a4a7d85032faffa5f6f76f2c220e2ad1',
       'e_comment.php' => '13b0aa38e21d08a535276a7526cedde2',
-      'e_frontpage.php' => '0a352c2a0b559b9d930943f1928f9d45',
-      'e_help.php' => 'a8495b50a8243ebbb3e37c8bcb169184',
+      'e_frontpage.php' => '2dd845d8eaba9d87d944efc99d57b4dd',
+      'e_help.php' => 'b9ca624c084c10420ce63809870042b9',
       'e_latest.php' => '68bacd178e137861748385080b253ee4',
       'e_list.php' => '41486a930bbaf136d0a371c3201aa0e6',
       'e_notify.php' => 'eab13b015f9b5fa679fef28f63d72dde',
@@ -2008,7 +2009,7 @@
       'link_defines.php' => '1c9c8a4d29cac5f35e2164805bb3eca6',
       'link_menu.php' => 'db5245c494ebbf51adf0b2d7deafcd87',
       'link_shortcodes.php' => '0f5e9fd5e457177a51096a5952c3a15a',
-      'links.php' => '6eaaf2b65b6548aacae52b8eae58083c',
+      'links.php' => 'a428534f819e96eda33ffee77f8ef1db',
       'links_page_sql.php' => 'ebe16a35037a69b93eaa929782ca66ba',
       'links_template.php' => '01f0789358ececda57e350844c5257eb',
       'plugin.php' => '2a230e6fe081f8b5fac05a7765645acf',
@@ -2061,14 +2062,14 @@
         'list_members.php' => 'f2cec9a4125081502c309f794f72dc1b',
         'list_news.php' => '7faa1d6728ff1e692aa834ac4027c4e0',
       ),
-      'admin_list_config.php' => 'ca675031ff789bcf4f75e9ce98d86b87',
+      'admin_list_config.php' => '455fa2e4de5697ae7a8ffba4c71beabd',
       'list.php' => 'e26c96ef49382d150baa604c67efce6b',
-      'list_class.php' => '10b1f9d2874439afa88e9db4d8d1ec7e',
+      'list_class.php' => '9205c1ef63720a9e4dc368938f341b1d',
       'list_new_menu.php' => '3725d617fb04202bf88aed0c02f01718',
       'list_recent_menu.php' => '3865fe5b56a591c102a2192dd0094a5b',
       'list_shortcodes.php' => '1c4972d09e83f1945c6652126bba6248',
       'list_template.php' => 'ca73750411b19f1b8df71c5111fe1789',
-      'plugin.php' => '9eb14ccec83d20559b387b9c332a6d23',
+      'plugin.php' => 'b1e1a641faa99690f826efb8e29ead63',
     ),
     'log' => 
     array (
@@ -2171,14 +2172,14 @@
       ),
       'admin_config.php' => '0d9cb944bcb0efd5410b961ff4fea3d4',
       'consolidate.php' => '98cc86b8054e93d3f86f150504f0940b',
-      'e_meta.php' => '6f94262ca53688c5466e906f0d2f9dd4',
-      'log.php' => '309b0e75cb210dabbfbb17b940576435',
+      'e_meta.php' => '7b2961dfec34f7d8563081c97d7f9503',
+      'log.php' => '78aee0e1de7c44244c0e6c9446a9a82a',
       'log_sql.php' => '6593acd37950a8e486b0fc1490cf1750',
       'log_update.php' => '619bea78d9c76a1ec0cd4c44eeda36c5',
       'log_update_check.php' => 'f4e7f5fb3767e4c19adae8cb5e41e62c',
-      'loginfo.php' => '854e51cd364a5f34bbb98559a1d997a5',
+      'loginfo.php' => '60a95ee9db6f509751c61e1a84f5441d',
       'plugin.php' => '68060de28e330695a727e7b718a31fb6',
-      'stats.php' => '67166ee596b2c4553e000a04a44113e1',
+      'stats.php' => '91376cf9a24f67e20427fe136b543ae3',
     ),
     'login_menu' => 
     array (
@@ -2188,7 +2189,7 @@
       ),
       'config.php' => '5f0c8229c96c4d4cf5a806bfc8d1a1c4',
       'login_menu.php' => '14c9f12699735e3ed08594251271d3a3',
-      'login_menu_shortcodes.php' => 'e7b67b1a732e9b0e15a0d36f4834f3f0',
+      'login_menu_shortcodes.php' => '728270cac2f9b61167bd0e3cb5687f3c',
       'login_menu_template.php' => '88e210369bd4f7ba640e0008b274d782',
     ),
     'newforumposts_main' => 
@@ -2203,9 +2204,9 @@
       array (
         'English.php' => 'cbabc36202b6ab51003f0b859fb14598',
       ),
-      'admin_config.php' => '965609648b5052dad40742d8c76b8bf9',
+      'admin_config.php' => '6674b1d9e9941c95aa0a7aa6b48f2406',
       'newforumposts.sc' => '92de176e2d3503f91b9389d053d34348',
-      'newforumposts_main.php' => 'e402272915bc7520e4bafa8ee182885c',
+      'newforumposts_main.php' => '18767e97f0e0c844087226d72d58013e',
       'plugin.php' => '81caf517e35d6fdb13bf56fb6ab5395e',
     ),
     'newsfeed' => 
@@ -2327,12 +2328,12 @@
         'English.php' => 'cdc4aab2e1c8caf5ddf209e32946c623',
       ),
       'admin_pdf_config.php' => 'ab75370cbef1f9e7d32448717071eb82',
-      'e107pdf.php' => '3df3ae47abbe73366639b24f708c605c',
+      'e107pdf.php' => '7c686712869a23aa5e94514a3205c7b4',
       'fpdf.css' => '35c07d5049ac6e55b8ab473c6dc38bf0',
       'fpdf.php' => 'da7385d29345f1c12fe85b6cacf5e905',
-      'pdf.php' => '9c05a56fbb296b60cddcfc68ec1ae2c3',
+      'pdf.php' => '8957467cda2184fdff5f15791157539b',
       'pdf.sc' => 'e42b36c918e9c9951706689b949304f5',
-      'plugin.php' => 'd5aba62f42496d21e3ec8d48ded5b3ba',
+      'plugin.php' => '6796823038ad4e146e9365ebbb8bc59a',
       'ufpdf.php' => 'ba87afe3cb2f777f921ea8a3a0457abd',
     ),
     'pm' => 
@@ -2362,23 +2363,23 @@
         array (
           'English.php' => '61751a3038626ba9be918de75227725d',
         ),
-        'English.php' => 'a44c2c8b5b71a6f863ccf89acb9ef5ee',
+        'English.php' => '8d2a4b55dbf033d50c674566a6ec9886',
       ),
       'index.html' => 'd41d8cd98f00b204e9800998ecf8427e',
       'plugin.php' => 'c89f4e634476ef16447a5375f39ce495',
-      'pm.php' => 'c390585267c8b8e6ea965890860a6614',
-      'pm_class.php' => 'ef6f751b872acc6ea1994af7af67adba',
-      'pm_conf.php' => '06968bbec9d62e6dd85bff321d8d281f',
-      'pm_default.php' => '0213fb9bcfe60d37041f44136727649b',
+      'pm.php' => '9ed56b5b9d7ea9b0fd383419fec548e9',
+      'pm_class.php' => 'b1e9bc725aaa49b1a74707148929d365',
+      'pm_conf.php' => '74f1f7c63814631bcd74581304c9a718',
+      'pm_default.php' => 'b7981b895e3afc6bc95a2198f0c40423',
       'pm_func.php' => '61f9aea908d41a5d23a791efe67ac0ac',
       'pm_notes.txt' => 'df26332907da1f35c4731d8893aea23e',
-      'pm_shortcodes.php' => '69208fe4b9226991925074eb99bb6253',
+      'pm_shortcodes.php' => '877fd4430af30e01722599bbbe373793',
       'pm_sql.php' => '4608486c1027c6485dc32674fd536dc5',
-      'pm_template.php' => '082f8cb6a6298ce46a5ab2d3284ffd74',
+      'pm_template.php' => '16fd9cc065d391fbc560b25b743eb457',
       'pm_update.php' => 'cb5624f01693633d7509c2b47a91ae20',
       'pm_update_check.php' => 'a5b341b5373844cdfc1f961fb3d3151f',
-      'private_msg_menu.php' => 'c672e6f4be8aa79896f873fdd0eff9f3',
-      'sendpm.sc' => '8da5535f878725ca446739cef48fc9e5',
+      'private_msg_menu.php' => '2bcc304712f5e17de30c2f5db785f10b',
+      'sendpm.sc' => '67d107ca6fc1d9016d81abc9d8943a7f',
     ),
     'poll' => 
     array (
@@ -2403,7 +2404,7 @@
         'poll_template.php' => '0c83f7e4984e9a0b8bbc196262cc650f',
       ),
       'admin_config.php' => 'eeea52c7fab3125610a8e3903c0be8c9',
-      'oldpolls.php' => '27b1f706fd71bb52bf3f9f1e2eb0e155',
+      'oldpolls.php' => '1c0392dff78e6d380520da67d4fa6d3f',
       'plugin.php' => 'f68c44986bf5d097e3901f220726530b',
       'poll.php' => 'b51353ac9b1d4f9664b954d528644547',
       'poll_class.php' => 'ea623ef543f015e80366cbd1578dd972',
@@ -2416,7 +2417,7 @@
       array (
         'English.php' => '4e4018bc11471818ca7256c722e28c13',
       ),
-      'powered_by_menu.php' => '030115b6ab06ef38b31510aec2b11ee3',
+      'powered_by_menu.php' => 'f7e127119fd9a994e632d8e34146e0b0',
     ),
     'rss_menu' => 
     array (
@@ -2433,11 +2434,11 @@
       array (
         'English.php' => '90ba4c3b30c128eac2a16d0007416c89',
       ),
-      'admin_prefs.php' => '511047205732e1f3a5098052e3a2eb4e',
+      'admin_prefs.php' => 'fa338cfe9dd631e747e1b6092e4c63d5',
       'e_meta.php' => 'af7e8b4a56e0d4cbb7a469dea4b86f9c',
-      'plugin.php' => '46b1e37c9d18e6872083425afb3115fa',
+      'plugin.php' => 'c625320fd28a50b629309cd2f53217b7',
       'rss.php' => '28a7c3dcbe256b4f4893f3d8877c4b1f',
-      'rss_menu.php' => '1be0ce84109cbbbcdadf68cc93fb5c20',
+      'rss_menu.php' => '669e5f6d6947c14be8a689505daa29eb',
       'rss_shortcodes.php' => '5e842cc4bcb5262055b7bf4d9aa57f55',
       'rss_sql.php' => 'efee18037cab9fbf35cdf81f97efc2a3',
       'rss_template.php' => '023614657d162b0f155fbe50e6e3dce2',
@@ -2496,7 +2497,7 @@
       array (
         'English.php' => '11eb945ea792024fc2ecd881d77781d7',
       ),
-      'userlanguage_menu.php' => '4a7e90d9314e9893f32deeb30da2b32d',
+      'userlanguage_menu.php' => '99d231a6d60f23fb261f41495a636052',
     ),
     'usertheme_menu' => 
     array (
@@ -2576,7 +2577,7 @@
       'newsfeed_template.php' => 'bf35ae0a44194fb397c9816bd81c7522',
       'preview.jpg' => '1f1e5815a674ceb1eaa562caa0e23607',
       'style.css' => '18850902efe5f0feb78f6b1841639ffc',
-      'theme.php' => 'ae959d0742632c6b95373b34f2a7f69a',
+      'theme.php' => 'c76e1a19b9686a77e179e4d6e1f1c2c2',
     ),
     'human_condition' => 
     array (
@@ -2723,7 +2724,7 @@
       array (
         'English.php' => 'a17223b305835b22475b0cd9ada9c367',
       ),
-      'admin_template.php' => 'ca62e31cee0cb47fd3717de408938c5c',
+      'admin_template.php' => '1c17a3336acf13bcdc3fb6b64e1f835b',
       'canvas.css' => 'acdfee6441e3dc292657ca469b669df4',
       'index.html' => 'd41d8cd98f00b204e9800998ecf8427e',
       'nav_menu.css' => 'ac9d2df99166eb5ce87c16bb146bc413',
@@ -2768,7 +2769,7 @@
       'download_template.php' => '7f75f3bc5d34971eed94a6950338872f',
       'forum_post_template.php' => '98a5c625a01ff128d1f91ccdce82c014',
       'forum_posted_template.php' => 'daea1ec546752501459de41d6792faa8',
-      'forum_preview_template.php' => '4455c6b5e0991211db66dad466274bc0',
+      'forum_preview_template.php' => '2c7fba858270aae242c561daa47af19b',
       'forum_template.php' => '93227cac477be310f0e5a1f6b4a310e5',
       'forum_viewforum_template.php' => 'fd1e11b7929537e893966f3a4259df8d',
       'forum_viewtopic_template.php' => '9fd02192239781ffd835af2d90a8c4c0',
@@ -2924,7 +2925,7 @@
       ),
       'index.html' => 'd41d8cd98f00b204e9800998ecf8427e',
       'preview.jpg' => 'de22b398f66e271fdd908ac31f25e7e4',
-      'style.css' => 'bd8715343b586a898a6e4e7875e2f6b6',
+      'style.css' => '777f3c160f2eb69ee18847dab513f7c0',
       'theme.php' => 'd310e828e6ec8e6e741e05b81d38c019',
     ),
     'reline' => 
@@ -2961,7 +2962,7 @@
         'English.php' => '3288884b05004a91af4802cb7e2098a2',
       ),
       'admin_style.css' => '7850d3c2db60fb1e649a6eb6201cfc11',
-      'admin_template.php' => '2d58509103d7eb1518ef66d79313898e',
+      'admin_template.php' => '0a22984dde775acfa233bceeab95b519',
       'cube.sc' => 'f85e6d1f10ab3372ec7ebdb0548651ad',
       'full_width.css' => 'f806f549c1200131c4c043db72408da7',
       'index.html' => 'd41d8cd98f00b204e9800998ecf8427e',
@@ -2998,22 +2999,22 @@
     ),
     'templates' => 
     array (
-      'admin_template.php' => '2852767e150181d896f2dc30a08466ff',
-      'banner_template.php' => '58c9cb82186cc85b7a1af8398c6b888b',
+      'admin_template.php' => '16dd62c34b689eeb24d834fceab669c5',
+      'banner_template.php' => '1707ddce1e40320df1f49089e07678c6',
       'bbcode_template.php' => '884969ebee7a4a328a88f308f04c7822',
       'comment_template.php' => 'be07b00f84a5fbbeeef3ad557294700d',
       'contact_template.php' => '594ca4a1e569214733cf5d584c79eea0',
-      'download_template.php' => '5681bcd3468ce80571394a0a68fb0926',
+      'download_template.php' => '91bccf52792e230bd797907a4b95964c',
       'email_template.php' => 'bcab5cc478a5c82bb71f35926dab72fd',
-      'footer_default.php' => 'b5f07579a97a22b63bcdc500f0724c13',
+      'footer_default.php' => 'd63f728ad6d098f3f69188b78f5875b7',
       'fpw_template.php' => '326abf6c01f19246a9ebe07e64d07ead',
-      'header_default.php' => '573d6bf242b433a91f9d044f77bacbfe',
+      'header_default.php' => '3670d8d90a7fb6addf46b6c658ac0ff5',
       'index.html' => 'd41d8cd98f00b204e9800998ecf8427e',
-      'login_template.php' => 'cd32f6bad43c829a8fa6e166a987c987',
+      'login_template.php' => 'c099203f3730ca20be0767d76b4ffc3e',
       'membersonly_template.php' => '14635660ab8f2daed92f4260ed0f3fa1',
       'online_template.php' => '97ff2933cef883a08756aed1527a3349',
       'search_template.php' => '100782de2e0ac37b7286bc2a1f65a2c2',
-      'signup_template.php' => '2168fa51ff1cfcfb3b8f2aaf87287d99',
+      'signup_template.php' => '71b9b9f04c0ac3f93754ab1502d5174e',
       'sitedown_template.php' => '5e7c7db5ff15ed4a866d3fb46377c247',
       'trackback_template.php' => 'fd54d8c26c75f9d380e8ec90860b0107',
       'user_template.php' => '096eda6eb3cf505cde1669285c21f053',
@@ -3054,17 +3055,17 @@
   'article.php' => '274696e46f6946007b5a1d308e033b3a',
   'backend.php' => '312552577f67c7965a76bda84b949a64',
   'banner.php' => 'e028fd2fa6fac77863505acb501b6632',
-  'class2.php' => 'c08ffd487f8152cb9630d46c836752c0',
-  'comment.php' => 'd7bf36a5bec9342815f58c47ba847db7',
+  'class2.php' => '7f49e9734826dffb28efe70ed44f14b3',
+  'comment.php' => '22392707e8379be29e501b99176e1f74',
   'contact.php' => '086abf7a78a498f82d1824415ef794f2',
   'content.php' => '9a9f4da9afbd0d081e4f275fbcd13674',
-  'download.php' => '27df2991aa9ac193d6a9c2e9621cfdee',
+  'download.php' => '910e55b0e9974fb1a792911fef37ffd4',
   'e107.htaccess' => 'c5e1ad68b41f947be285926c0f81d914',
-  'e107.robots.txt' => '118aadbc5395ee3d4c6fade187097e5a',
+  'e107.robots.txt' => '3f7b0f4a9348e494b4cbc1ff8ce84831',
   'e107_config.php' => 'd41d8cd98f00b204e9800998ecf8427e',
-  'email.php' => '6f5a6b9bd588d7f774f4e1a731efa937',
+  'email.php' => '82281360946b771ab7dc3a405a2d1d91',
   'error.php' => '43c688d9b7c8fef79dd6f8a2ae64e3b4',
-  'favicon.ico' => '5fceb78b9124ddae4027396d7cfcd328',
+  'favicon.ico' => '82f615592baa82d1de71cd9101d1e5b9',
   'forum.php' => '3c10184d52685d7c9a6906a967b7e3d8',
   'forum_viewforum.php' => '4b9fcc3a820ed2f93b4dc707c3ebe3b4',
   'forum_viewtopic.php' => '5fea10d40850fd6f72cfbec7a328e120',
@@ -3072,24 +3073,24 @@
   'gsitemap.php' => '5a3d81b0d9ca3f41c6a8c46155c41cc7',
   'index.php' => '960de1b196ffa6e7887fe99ae65fa682',
   'links.php' => 'bed206fc2abe8f1307ef4db3b7fee63e',
-  'login.php' => 'b63487844599e96d23800fdb5b74fbf2',
+  'login.php' => '02f48c5e471635d4d50cac7488b1e75b',
   'membersonly.php' => '0903a2ef48312a12ce81b2fa17fe0233',
-  'news.php' => 'fe0005f77d9f317c5d9f2b8dacdb522a',
-  'online.php' => '76ab26b03b5e4d6f83f0c4b22257b8b6',
+  'news.php' => '81205fddc75cedb3f10fc346ff7ed358',
+  'online.php' => 'b4ad48b3c748231096732e7c5342b2b0',
   'page.php' => '0cb738f6c6cfe7b117f3ddad6a970493',
-  'print.php' => '82e7c7267881349a4ef5e11f3efb6de8',
+  'print.php' => '2fb2712c72cca248bdb4c06efd4a7912',
   'rate.php' => '4730b1d1cf3ace6af2179fb52a521366',
   'request.php' => 'c65a13737a9be96bd04ab836a9a14350',
   'search.php' => '69297aaac6cd8e8c44371e2bdd3d7eec',
-  'signup.php' => 'a55c004bf3704e9648f7154c51ab6286',
-  'sitedown.php' => 'f6723ac4ca112e3a684b094f970bda1d',
+  'signup.php' => 'e2e8ff4725d032a45ddba679b480eeae',
+  'sitedown.php' => '6583e7e3e5410c3b9097e5b49ae09968',
   'subcontent.php' => '5a534e399228320e38056244e944357d',
-  'submitnews.php' => '99735d671704e4610935275159d703a1',
+  'submitnews.php' => 'f3f70d135b6e2937701871e4ee8cf611',
   'top.php' => '9d7f39ec5411241994a7bd2777f592aa',
   'upload.php' => '0096a4384f7b820091deae6e94aa4f67',
   'user.php' => '04be88f587ad8a00cbf42eacbef75598',
-  'userposts.php' => '7b9cd08364856d45f52b5d4ebf2fe8e6',
-  'usersettings.php' => 'b035fd67e853e96d8164eaea1aa1e8be',
+  'userposts.php' => '8e51d39cc4bdb74563861c5779139730',
+  'usersettings.php' => '0f73f3495a500c15f4d930a1fbcf1bfe',
 );
 
 $deprecated_image = array (
@@ -3821,6 +3822,9 @@
       ),
       'plugins' => 
       array (
+        'compat2x' => 
+        array (
+        ),
         'contextmenu' => 
         array (
           'css' => 
@@ -3940,6 +3944,12 @@
           'images' => 
           array (
           ),
+          'img' => 
+          array (
+          ),
+          'js' => 
+          array (
+          ),
           'jscripts' => 
           array (
           ),
@@ -3956,6 +3966,9 @@
           'images' => 
           array (
           ),
+          'js' => 
+          array (
+          ),
           'jscripts' => 
           array (
           ),
@@ -4003,12 +4016,27 @@
           'css' => 
           array (
           ),
+          'docs' => 
+          array (
+            'en' => 
+            array (
+              'images' => 
+              array (
+              ),
+            ),
+          ),
           'images' => 
           array (
             'xp' => 
             array (
             ),
           ),
+          'img' => 
+          array (
+          ),
+          'js' => 
+          array (
+          ),
           'jscripts' => 
           array (
           ),
@@ -4045,6 +4073,15 @@
             'tw.js' => '69e5f2fe9dae27269c4a31a8245bb2c7',
             'zh_cn.js' => 'e9a1c3aeb41c08b7ee4bed86c3cc193b',
           ),
+          'skins' => 
+          array (
+            'default' => 
+            array (
+              'img' => 
+              array (
+              ),
+            ),
+          ),
         ),
       ),
       'utils' => 
@@ -5801,9 +5838,8 @@
   'ReadMe_English_iso-8859-1.txt' => 'a15c32416143ecdebb10fab747a9065a',
   'chat.php' => 'f99ca9a68e350852ff12b6f201ff46e4',
   'e107_6171_readme.txt' => '7f411eaafccc974f91447c8efd9992d4',
-  'e107_v0.7.15_full.tar.gz' => 'cb4e979a03311400f4feda26fe5832e4',
   'forum_post.php' => 'b4537a7296252a0d8c010824b698259b',
-  'install.php' => 'e5ab961c3e9aaeefd8bcc11b9e2ae6bc',
+  'install.php' => 'ffd03f3f3d62445d9bd0e4fbc96d361d',
   'oldpolls.php' => '2758e56550195c508819c6062b950bc3',
   'readme.txt' => 'ff257006036939e779d287cdfee3b4b3',
   'robots.txt' => '118aadbc5395ee3d4c6fade187097e5a',
diff -x .svn -aruN 0.7.16.src/e107_admin/cpage.php 0.7.17.src/e107_admin/cpage.php
--- 0.7.16.src/e107_admin/cpage.php	2009-08-03 13:35:40.000000000 -0500
+++ 0.7.17.src/e107_admin/cpage.php	2009-12-06 09:39:20.000000000 -0600
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_admin/cpage.php,v $
-|     $Revision: 1.46 $
-|     $Date: 2009/08/03 18:36:04 $
-|     $Author: marj_nl_fr $
+|     $Revision: 1.50 $
+|     $Date: 2009/12/06 15:39:44 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 
@@ -300,21 +300,31 @@
 
 
 		if($mode)
-		{	// Don't think $_POST['page_ip_restrict'] is ever set.
-			$update = $sql -> db_Update("page", "page_title='{$page_title}', page_text='{$page_text}', page_datestamp='".time()."', page_author='{$pauthor}', page_rating_flag='".intval($_POST['page_rating_flag'])."', page_comment_flag='".intval($_POST['page_comment_flag'])."', page_password='".$_POST['page_password']."', page_class='".$_POST['page_class']."', page_ip_restrict='".varset($_POST['page_ip_restrict'],'')."' WHERE page_id='{$mode}'");
+		{	// Saving existing page/menu after edit
+			// Don't think $_POST['page_ip_restrict'] is ever set.
+			$menuname = ($type ? ", page_theme = '".$tp -> toDB($_POST['menu_name'])."'" : "");
+			$update = $sql -> db_Update("page", "page_title='{$page_title}', page_text='{$page_text}', page_datestamp='".time()."', page_author='{$pauthor}', page_rating_flag='".intval($_POST['page_rating_flag'])."', page_comment_flag='".intval($_POST['page_comment_flag'])."', page_password='".$_POST['page_password']."', page_class='".$_POST['page_class']."', page_ip_restrict='".varset($_POST['page_ip_restrict'],'')."'{$menuname} WHERE page_id='{$mode}'");
 			$e107cache->clear("page_{$mode}");
 			$e107cache->clear("page-t_{$mode}");
 
 			if($type)  // it's a menu.
 			{
 				$menu_name = $tp -> toDB($_POST['menu_name']); // not to be confused with menu-caption.
-				if($sql -> db_Update("menus", "menu_name='$menu_name' WHERE menu_path='$mode' "))
-				{
-				  	$update++;
+				// Need to check whether menu already in table, else we can't distinguish between a failed update and no update needed
+				if ($sql->db_Select('menus', 'menu_name', "`menu_path` = '{$mode}'"))
+				{		// Updating existing entry
+					if($sql -> db_Update('menus', "menu_name='{$menu_name}' WHERE menu_path='{$mode}' ") !== FALSE)
+					{
+						$update++;
+					}
 				}
 				else
 				{
-                  	$sql -> db_Insert("menus", "0, '$menu_name', '0', '0', '0', '', '".$mode."' ");
+                  	$sql -> db_Insert('menus', "0, '$menu_name', '0', '0', '0', '', '".$mode."' ");
+					if ($sql -> db_Insert('menus', $menuData))
+					{
+						$update++;
+					}
 				}
 			}
 
@@ -343,8 +353,7 @@
 			admin_update($update, 'update', LAN_UPDATED);
 		}
 		else
-		{
-
+		{	// New page/menu
 			$menuname = ($type ? $tp -> toDB($_POST['menu_name']) : "");
 
 			admin_update($sql -> db_Insert("page", "0, '$page_title', '$page_text', '$pauthor', '".time()."', '".intval($_POST['page_rating_flag'])."', '".intval($_POST['page_comment_flag'])."', '".$_POST['page_password']."', '".$_POST['page_class']."', '', '".$menuname."'"), 'insert', CUSLAN_27);
diff -x .svn -aruN 0.7.16.src/e107_admin/db_verify.php 0.7.17.src/e107_admin/db_verify.php
--- 0.7.16.src/e107_admin/db_verify.php	2007-11-24 09:42:17.000000000 -0600
+++ 0.7.17.src/e107_admin/db_verify.php	2010-01-21 14:43:57.000000000 -0600
@@ -11,8 +11,8 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_admin/db_verify.php,v $
-|     $Revision: 1.26 $
-|     $Date: 2007/11/24 15:42:40 $
+|     $Revision: 1.28 $
+|     $Date: 2010/01/21 20:44:21 $
 |     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
@@ -56,33 +56,39 @@
 
 
 
-function read_tables($tab) {
+function read_tables($tab) 
+{
 	global $tablines;
 	global $table_list;
 	global $tables,$sql,$pref;
 
 	$file = split("\n", $tables[$tab]);
-	foreach($file as $line) {
+	foreach($file as $line) 
+	{
 		$line = ltrim(stripslashes($line));
-		if (preg_match("/CREATE TABLE (.*) /", $line, $match)) {
-			if($match[1] != "user_extended"){
-				$table_list[$match[1]]  = 1;
-				$current_table = $match[1];
-				$x = 0;
-				$cnt = 0;
+		if ($line)
+		{
+			if (preg_match("/CREATE TABLE (.*) /", $line, $match)) 
+			{
+				if($match[1] != "user_extended"){
+					$current_table = str_replace('`','',$match[1]);
+					$table_list[$current_table]  = 1;
+					$x = 0;
+					$cnt = 0;
+				}
 			}
-		}
 
-		if (strpos($line, "TYPE=") !== FALSE) {
-			$current_table = "";
-		}
+			if (strpos($line, "TYPE=") !== FALSE) {
+				$current_table = "";
+			}
 
-		if ($current_table && $x) {
-			$tablines[$current_table][$cnt++] = $line;
+			if ($current_table && $x) {
+				$tablines[$current_table][$cnt++] = $line;
 
-		}
+			}
 
-		$x = 1;
+			$x = 1;
+		}
 	}
 
 // Get multi-language tables as well
@@ -143,156 +149,167 @@
 		</tr>";
 	foreach(array_keys($table_list) as $k) 
 	{	// $k is the DB table name (less prefix)
-	  $prefix = MPREFIX;
-	  $current_tab = get_current($k, $prefix);		// Get list of fields and keys from actual table
-	  unset($fields);
-	  unset($xfields);
-	  if ($current_tab) 
-	  {
-		$lines = split("\n", $current_tab);			// Create one element of $lines per field or other line of info
-		$fieldnum = 0;
-		foreach($tablines[$k] as $x) 
-		{	// $x is a line of the DB definition from the *_sql.php file
-		  $x = str_replace('  ',' ',$x);				// Remove double spaces
-		  $fieldnum++;
-		  $ffound = 0;
-		  list($fname, $fparams) = split(" ", $x, 2);
-		  if ($fname == "KEY") 
-		  {
-			list($key, $keyname, $keyparms) = split(" ", $x, 3);
-			$fname = $key." ".$keyname;
-			$fparams = $keyparms;
-		  }
-		  $fields[$fname] = 1;
-		  $fparams = ltrim(rtrim($fparams));
-		  $fparams = preg_replace("/\r?\n$|\r[^\n]$|,$/", "", $fparams);
-
-		  if(stristr($k, "lan_") !== FALSE && $cur != 1)
-		  {
-			$text .= "<tr><td colspan='6' class='fcaption'>".ADLAN_132."</td></tr>";
-			$cur = 1;
-		  };
-
+		$prefix = MPREFIX;
+		$current_tab = get_current($k, $prefix);		// Get list of fields and keys from actual table
+		unset($fields);
+		unset($xfields);
+		if ($current_tab) 
+		{
+			$lines = split("\n", $current_tab);			// Create one element of $lines per field or other line of info
+			$fieldnum = 0;
+			foreach($tablines[$k] as $x) 
+			{	// $x is a line of the DB definition from the *_sql.php file
+				$x = str_replace('  ',' ',$x);				// Remove double spaces
+				$x = str_replace('`','',$x);				// Remove backticks
+				$fieldnum++;
+				$ffound = 0;
+				list($fname, $fparams) = split(" ", $x, 2);
+				if ($fname == "KEY") 
+				{
+					list($key, $keyname, $keyparms) = split(" ", $x, 3);
+					$fname = $key." ".$keyname;
+					$fparams = $keyparms;
+				}
+				elseif ($fname == 'PRIMARY')
+		  		{	// Nothing to do ATM
+		  		}
+				else
+				{		// Must be a field name
+					$fname = str_replace('`','',$fname);		// Just remove back ticks if present
+				}
+				$fields[$fname] = 1;
+				$fparams = ltrim(rtrim($fparams));
+				$fparams = preg_replace("/\r?\n$|\r[^\n]$|,$/", "", $fparams);
 
+				if(stristr($k, "lan_") !== FALSE && $cur != 1)
+				{
+					$text .= "<tr><td colspan='6' class='fcaption'>".ADLAN_132."</td></tr>";
+					$cur = 1;
+				};
 
-		  $text .= "<tr><td class='forumheader3'>$k</td><td class='forumheader3'>$fname";
-		  if (strpos($fparams, "KEY") !== FALSE) 
-		  {
-			$text .= " $fparams";
-		  }
-		  $text .= "</td>";
-		  $s = 0;
-		  $xfieldnum = -1;
-		  foreach($lines as $l) 
-		  {
-			$xfieldnum++;
-			list($xl, $tmp) = split("\n", $l, 2);			// $tmp should be null
-			$xl = ltrim(rtrim(stripslashes($xl)));
-			$xl = preg_replace("/\r?\n$|\r[^\n]$/", "", $xl);
-			$xl = str_replace('  ',' ',$xl);				// Remove double spaces
-			list($xfname, $xfparams) = split(" ", $xl, 2);	// Field name and the rest
 
-			if ($xfname == "KEY") 
-			{
-			  list($key, $keyname, $keyparms) = split(" ", $xl, 3);
-			  $xfname = $key." ".$keyname;
-			  $xfparams = $keyparms;
-			}
 
-			if ($xfname != "CREATE" && $xfname != ")") 
-			{
-			  $xfields[$xfname] = 1;
-			}
-			$xfparams = preg_replace("/,$/", "", $xfparams);
-			$fparams = preg_replace("/,$/", "", $fparams);
-			if ($xfname == $fname) 
-			{  // Field names match - or it could be the word 'KEY' and its name which matches
-			  $ffound = 1;
-//			  echo "Field: ".$xfname."   Actuals: ".$xfparams."   Expected: ".$fparams."<br />";
-			  $xfsplit = explode(' ',$xfparams);
-			  $fsplit  = explode(' ',$fparams);
-			  $skip = FALSE;
-			  $i = 0;
-			  $fld_err = FALSE;
-			  foreach ($xfsplit as $xf)
-			  {
-			    if ($skip)
+				$text .= "<tr><td class='forumheader3'>$k</td><td class='forumheader3'>$fname";
+				if (strpos($fparams, "KEY") !== FALSE) 
 				{
-				  $skip = FALSE;
-//				  echo "  Unskip: ".$xf."<br />";
+					$text .= " $fparams";
 				}
-				elseif (strcasecmp(trim($xf),'collate') == 0)
-				{	// Strip out the collation definition
-				  $skip = TRUE;
-//				  echo "Skip = ".$xf;
+				$text .= "</td>";
+				$s = 0;
+				$xfieldnum = -1;
+				foreach($lines as $l) 
+				{
+					$xfieldnum++;
+					list($xl, $tmp) = split("\n", $l, 2);			// $tmp should be null
+					$xl = ltrim(rtrim(stripslashes($xl)));
+					$xl = preg_replace("/\r?\n$|\r[^\n]$/", "", $xl);
+					$xl = str_replace('  ',' ',$xl);				// Remove double spaces
+					list($xfname, $xfparams) = split(" ", $xl, 2);	// Field name and the rest
+
+					if ($xfname == "KEY") 
+					{
+						list($key, $keyname, $keyparms) = split(" ", $xl, 3);
+						$xfname = $key." ".$keyname;
+						$xfparams = $keyparms;
+					}
+
+					if ($xfname != "CREATE" && $xfname != ")") 
+					{
+						$xfields[$xfname] = 1;
+					}
+					$xfparams = preg_replace("/,$/", "", $xfparams);
+					$fparams = preg_replace("/,$/", "", $fparams);
+					if ($xfname == $fname) 
+					{  // Field names match - or it could be the word 'KEY' and its name which matches
+						$ffound = 1;
+						//	echo "Field: ".$xfname."   Actuals: ".$xfparams."   Expected: ".$fparams."<br />";
+						$xfsplit = explode(' ',$xfparams);
+						$fsplit  = explode(' ',$fparams);
+						$skip = FALSE;
+						$i = 0;
+						$fld_err = FALSE;
+						foreach ($xfsplit as $xf)
+						{
+							if ($skip)
+							{
+								$skip = FALSE;
+								//	echo "  Unskip: ".$xf."<br />";
+							}
+							elseif (strcasecmp(trim($xf),'collate') == 0)
+							{	// Strip out the collation definition
+								$skip = TRUE;
+								//	echo "Skip = ".$xf;
+							}
+							else
+							{
+								//	echo "Compare: ".$xf." - ".$fsplit[$i]."<br />";
+								// Since VARCHAR and CHAR are interchangeable, convert to CHAR (strictly, VARCHAR(3) and smalller becomes CHAR() )
+								if (stripos($xf,'VARCHAR') === 0) $xf = substr($xf,3);
+								if (stripos($fsplit[$i],'VARCHAR') === 0) $fsplit[$i] = substr($fsplit[$i],3);
+								if (strcasecmp(trim($xf),trim($fsplit[$i])) != 0) 
+								{
+									$fld_err = TRUE;
+			//						echo "Mismatch: ".$xf." - ".$fsplit[$i]."<br />";
+								}
+								$i++;
+							}
+						}
+
+						if ($fld_err)
+						{
+							$text .= "<td class='forumheader' style='text-align:center'>".DBLAN_8."</td>";
+							$text .= "<td class='forumheader3' style='text-align:center'>".DBLAN_9."<div class='indent'>".$xfparams."</div><b>".DBLAN_10."</b><div class='indent'>".$fparams." <br />".fix_form($k,$fname,$fparams,"alter")."</div></td>";
+							$fix_active = TRUE;
+						} 
+						elseif ($fieldnum != $xfieldnum) 
+						{  // Field numbers different - missing field?
+							$text .= "<td class='fcaption' style='text-align:center'>".DBLAN_5." ".DBLAN_8."</td>
+								<td class='forumheader3' style='text-align:center'>".DBLAN_9." #{$xfieldnum}<br />".DBLAN_10." #{$fieldnum}</td>";
+						} 
+						else 
+						{
+							$text .= "<td class='forumheader3' style='text-align:center;'>OK</td>
+								<td class='forumheader3' style='text-align:center'>&nbsp;</td>";
+						}
+					}
+				}		// Finished checking one field
+
+				if ($ffound == 0) 
+				{
+					$text .= "<td class='forumheader' style='text-align:center'><strong><em>".DBLAN_11."</em></strong></td>
+						<td class='forumheader3' style='text-align:center'><b>".DBLAN_10." [$fparams]</b><br />".fix_form($k,$fname,$fparams,"insert",$prev_fname)."<br /></td>";
+					$fix_active = TRUE;
 				}
-				else
+				$prev_fname = $fname;
+				$text .= "</tr>\n";
+			}
+			foreach(array_keys($xfields) as $tf) 	// Pick up extra fields?
+			{
+				if (!$fields[$tf] && $k != "user_extended") 
 				{
-//				  echo "Compare: ".$xf." - ".$fsplit[$i]."<br />";
-				  // Since VARCHAR and CHAR are interchangeable, convert to CHAR (strictly, VARCHAR(3) and smalller becomes CHAR() )
-				  if (stripos($xf,'VARCHAR') === 0) $xf = substr($xf,3);
-				  if (stripos($fsplit[$i],'VARCHAR') === 0) $fsplit[$i] = substr($fsplit[$i],3);
-				  if (strcasecmp(trim($xf),trim($fsplit[$i])) != 0) 
-				  {
-				    $fld_err = TRUE;
-//					echo "Mismatch: ".$xf." - ".$fsplit[$i]."<br />";
-				  }
-				  $i++;
+					$fix_active = TRUE;
+					$text .= "<tr><td class='forumheader3' style='text-align:center'>{$k}</td><td class='forumheader3' style='text-align:center'>$tf</td><td class='forumheader3' style='text-align:center'><strong><em>".DBLAN_12."</em></strong></td><td class='forumheader3' style='text-align:center'>&nbsp;".fix_form($k,$tf,$fparams,"drop")."</td></tr>";
 				}
-			  }
-
-			  if ($fld_err)
-			  {
-				$text .= "<td class='forumheader' style='text-align:center'>".DBLAN_8."</td>";
-				$text .= "<td class='forumheader3' style='text-align:center'>".DBLAN_9."<div class='indent'>".$xfparams."</div><b>".DBLAN_10."</b><div class='indent'>".$fparams." <br />".fix_form($k,$fname,$fparams,"alter")."</div></td>";
-				$fix_active = TRUE;
-			  } 
-			  elseif ($fieldnum != $xfieldnum) 
-			  {  // Field numbers different - missing field?
-				$text .= "<td class='fcaption' style='text-align:center'>".DBLAN_5." ".DBLAN_8."</td>
-						<td class='forumheader3' style='text-align:center'>".DBLAN_9." #{$xfieldnum}<br />".DBLAN_10." #{$fieldnum}</td>";
-			  } 
-			  else 
-			  {
-				$text .= "<td class='forumheader3' style='text-align:center;'>OK</td>
-						<td class='forumheader3' style='text-align:center'>&nbsp;</td>";
-			  }
 			}
-		  }		// Finished checking one field
-
-		  if ($ffound == 0) 
-		  {
-			$text .= "<td class='forumheader' style='text-align:center'><strong><em>".DBLAN_11."</em></strong></td>
-					<td class='forumheader3' style='text-align:center'><b>".DBLAN_10." [$fparams]</b><br />".fix_form($k,$fname,$fparams,"insert",$prev_fname)."<br /></td>";
-			$fix_active = TRUE;
-		  }
-		  $prev_fname = $fname;
-		  $text .= "</tr>\n";
-		}
-		foreach(array_keys($xfields) as $tf) 
-		{
-		  if (!$fields[$tf] && $k != "user_extended") 
-		  {
+		} 
+		else 
+		{	// Table Missing.  $k is table name.  $tf is field
+			$text .= "<tr><td class='forumheader3' style='text-align:center'>{$k}</td><td class='forumheader3' style='text-align:center'>&nbsp;</td><td class='forumheader' style='text-align:center'>".DBLAN_13."</td><td class='forumheader3' style='text-align:center'>&nbsp;".fix_form($k,$tf,$tablines[$k],'create')."</td></tr>";
 			$fix_active = TRUE;
-			$text .= "<tr><td class='forumheader3' style='text-align:center'>$k</td><td class='forumheader3' style='text-align:center'>$tf</td><td class='forumheader3' style='text-align:center'><strong><em>".DBLAN_12."</em></strong></td><td class='forumheader3' style='text-align:center'>&nbsp;".fix_form($k,$tf,$fparams,"drop")."</td></tr>";
-		  }
 		}
-	  } 
-	  else 
-	  {	// Table Missing.
-		$text .= "<tr><td class='forumheader3' style='text-align:center'>$k</td><td class='forumheader3' style='text-align:center'>&nbsp;</td><td class='forumheader' style='text-align:center'>".DBLAN_13."<br /><td class='forumheader3' style='text-align:center'>&nbsp;".fix_form($k,$tf,$tablines[$k],"create")."</td></tr>";
-		$fix_active = TRUE;
-	  }
 	}
 	$text .= "</table></div>";
 
-	if($fix_active){
+	if($fix_active)
+	{
 		$text .= "<div style='".ADMIN_WIDTH.";text-align:right'>
 		<input class='button' type='submit' name='do_fix' value='".DBLAN_21."' /></div>\n";
 	}
 
-	foreach(array_keys($_POST) as $j) {
-		if (preg_match("/table_(.*)/", $j, $mitch)) {
+	foreach(array_keys($_POST) as $j) 
+	{
+		if (preg_match("/table_(.*)/", $j, $mitch)) 
+		{
 			$lx = $mitch[1];
 			$text .= "<input type='hidden' name='table_{$lx}' value='1' />\n";
 		}
@@ -345,8 +362,14 @@
 			$query = "ALTER TABLE `".MPREFIX.$table."` DROP INDEX `$field`";
 		}
 
-		if($mode == "create"){
-			$query = "CREATE TABLE ".MPREFIX.$table." ($newval) TYPE=MyISAM;";
+		if($mode == "create")
+		{
+			//$query = "CREATE TABLE ".MPREFIX.$table." ($newval) TYPE=MyISAM;";
+			$query = "CREATE TABLE `".MPREFIX.$table."` ({$newval}";
+			if (!preg_match('#.*?\s+?(?:TYPE|ENGINE)\s*\=\s*(.*?);#is', $newval))
+			{
+				$query .= ') TYPE=MyISAM;';
+			}
 		}
 
 
@@ -399,18 +422,21 @@
 
 
 // --------------------------------------------------------------
-function fix_form($table,$field, $newvalue,$mode,$after =''){
-
-	if(stristr($field, "KEY ") !== FALSE){
+function fix_form($table,$field, $newvalue, $mode, $after ='')
+{
+	if($mode == "create")
+	{
+		$newvalue = implode("\n",$newvalue);
+		$field = $table;		// Value for $field may be rubbish!
+	}
+	elseif(stristr($field, "KEY ") !== FALSE)
+	{
 		$field = chop(str_replace("KEY ","",$field));
 		$mode = ($mode == "drop") ? "indexdrop" : "index";
 		$search = array("(",")");
 		$newvalue = str_replace($search,"",$newvalue);
 	}
 
-	if($mode == "create"){
-		$newvalue = implode("\n",$newvalue);
-	}
 
 	$text .= "<input type='checkbox'  name=\"fix_active[$field][]\" value='1' /> ".DBLAN_19."\n"; // 'attempt to fix'
 	$text .= "<input type='hidden' name=\"fix_newval[$field][]\" value=\"$newvalue\" />\n";
diff -x .svn -aruN 0.7.16.src/e107_admin/download.php 0.7.17.src/e107_admin/download.php
--- 0.7.16.src/e107_admin/download.php	2009-05-19 17:22:15.000000000 -0500
+++ 0.7.17.src/e107_admin/download.php	2010-01-02 16:10:11.000000000 -0600
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_admin/download.php,v $
-|     $Revision: 1.107 $
-|     $Date: 2009/05/19 22:22:39 $
-|     $Author: bugrain $
+|     $Revision: 1.110 $
+|     $Date: 2010/01/02 22:10:35 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 
@@ -62,14 +62,17 @@
 */
 
 $rs = new form;
+$action = '';
 $sub_action = '';
+$id = 0;
+$delete = '';
 if (e_QUERY)
 {
-	$tmp = explode(".", e_QUERY);
+	$tmp = explode('.', e_QUERY);
 	$action = $tmp[0];
-  $sub_action = varset($tmp[1],'');
-  $id = varset($tmp[2],'');
-  $from = varset($tmp[3], 0);
+	$sub_action = varset($tmp[1],'');
+	$id = varset($tmp[2],'');
+	$from = varset($tmp[3], 0);
 	unset($tmp);
 }
 
@@ -80,7 +83,7 @@
 	unset($_POST['searchquery']);
 }
 
-$from = ($from ? $from : 0);
+$from = varset($from, 0);
 $amount = 50;
 
 
@@ -656,11 +659,16 @@
 		$text .= "<div style='cursor:pointer' onclick=\"expandit('sdisp')\">".LAN_DISPLAYOPT."</div>";
 		$text .= "<div id='sdisp' style='padding-top:4px;display:none;text-align:center;margin-left:auto;margin-right:auto'>
 		<table class='forumheader3' style='width:95%'><tr>";
+
+/*
 		$fields = mysql_list_fields($mySQLdefaultdb, MPREFIX."download");
-		$columns = mysql_num_fields($fields);
+		$columns = mysql_num_fields($fields);			// Bug in PHP5.3 using mysql_num_fields() with mysql_list_fields()
 		for ($i = 0; $i < $columns; $i++) {
 			$fname[] = mysql_field_name($fields, $i);
 		}
+*/
+		$fname = $sql->db_FieldList('download', '', FALSE);
+
         $m = 0;
 		$replacechar = array("download_","_");
 	foreach($fname as $fcol)
@@ -848,7 +856,7 @@
 		}
 
 		$dt = 'display:none';
-		if (preg_match("/http:|ftp:/", $download_url))
+		if (preg_match("/http:|https:|ftp:/", $download_url))
 		{
 			$download_url_external = $download_url;
 			$download_url = '';
diff -x .svn -aruN 0.7.16.src/e107_admin/includes/categories.php 0.7.17.src/e107_admin/includes/categories.php
--- 0.7.16.src/e107_admin/includes/categories.php	2007-01-07 09:24:25.000000000 -0600
+++ 0.7.17.src/e107_admin/includes/categories.php	2009-11-01 14:41:00.000000000 -0600
@@ -11,8 +11,8 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_admin/includes/categories.php,v $
-|     $Revision: 1.12 $
-|     $Date: 2007/01/07 15:24:48 $
+|     $Revision: 1.13 $
+|     $Date: 2009/11/01 20:41:24 $
 |     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
@@ -37,39 +37,42 @@
 				$text_cat .= $text_rend;
 			}
 		}
-	} else {
+	} else 
+	{
 		$text_rend = render_links(e_ADMIN."plugin.php", ADLAN_98, ADLAN_99, "Z", E_16_PLUGMANAGER, 'default');
 
-		if ($text_rend) {
+		if ($text_rend) 
+		{
 			$text_check = TRUE;
 		}
 		$text_cat .= $text_rend;
-		if ($sql->db_Select("plugin", "*", "plugin_installflag=1")) {
-			while ($row = $sql->db_Fetch()) {
+		if ($sql->db_Select("plugin", "*", "plugin_installflag=1")) 
+		{
+			while ($row = $sql->db_Fetch()) 
+			{
 				extract($row);
 				include(e_PLUGIN.$plugin_path."/plugin.php");
-				if ($eplug_conffile) {
+				if ($eplug_conffile) 
+				{
 					$eplug_name = $tp->toHTML($eplug_name,FALSE,"defs, emotes_off");
 					$plugin_icon = $eplug_icon_small ? "<img src='".e_PLUGIN.$eplug_icon_small."' alt='".$eplug_caption."' style='border:0px; vertical-align:bottom; width: 16px; height: 16px' />" : E_16_PLUGIN;
 					$plugin_array[ucfirst($eplug_name)] = array('link' => e_PLUGIN.$plugin_path."/".$eplug_conffile, 'title' => $eplug_name, 'caption' => $eplug_caption, 'perms' => "P".$plugin_id, 'icon' => $plugin_icon);
-					//$text_rend = render_links(e_PLUGIN.$plugin_path."/".$eplug_conffile, $eplug_name, $eplug_caption, "P".$plugin_id, $plugin_icon, 'default');
-					if ($plugin_array[0]) {
-						$text_check = TRUE;
-					}
-					//$text_cat .= $text_rend;
+					$text_check = TRUE;
 				}
 				unset($eplug_conffile, $eplug_name, $eplug_caption, $eplug_icon_small);
 			}
 		}
 		ksort($plugin_array, SORT_STRING);
-		foreach ($plugin_array as $plug_key => $plug_value) {
+		foreach ($plugin_array as $plug_key => $plug_value) 
+		{
 			$text_cat .= render_links($plug_value['link'], $plug_value['title'], $plug_value['caption'], $plug_value['perms'], $plug_value['icon'], 'default');
 		}
 	}
 	$text_cat .= render_clean();
 	$text_cat .= "</table>
 		</td></tr>";
-	if ($text_check) {
+	if ($text_check) 
+	{
 		$text .= $text_cat;
 	}
 }
diff -x .svn -aruN 0.7.16.src/e107_admin/prefs.php 0.7.17.src/e107_admin/prefs.php
--- 0.7.16.src/e107_admin/prefs.php	2008-12-31 11:07:45.000000000 -0600
+++ 0.7.17.src/e107_admin/prefs.php	2009-09-28 15:59:36.000000000 -0500
@@ -11,8 +11,8 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_admin/prefs.php,v $
-|     $Revision: 1.106 $
-|     $Date: 2008/12/31 17:08:08 $
+|     $Revision: 1.107 $
+|     $Date: 2009/09/28 21:00:00 $
 |     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
@@ -946,6 +946,16 @@
 	<input type='radio' name='comments_emoticons' value='0'".(!$pref['comments_emoticons'] ? " checked='checked'" : "")." /> ".PRFLAN_113."
 	</td>
 	</tr>
+
+	<tr>
+	<td class='fcaption' style='text-align:left;' colspan='2'>".PRFLAN_209."</td>
+	</tr>
+	<tr>
+	<td style='width:50%' class='forumheader3'>".PRFLAN_208.": </td>
+	<td style='width:50%; text-align:right' class='forumheader3'>
+	".r_userclass('email_item_class',varset($pref['email_item_class'],e_UC_MEMBER),'off','nobody,admin,main,public,member,classes')."
+	</td>
+	</tr>
 	";
 
 $text .= pref_submit();
@@ -1037,7 +1047,7 @@
 	$var['signup']['text'] = PRFLAN_19;
 	$var['textpost']['text'] = PRFLAN_101;
 	$var['security']['text'] = PRFLAN_47;
-	$var['comments']['text'] = PRFLAN_87;
+	$var['comments']['text'] = PRFLAN_210;
 	$var['advanced']['text'] = PRFLAN_149;
 	show_admin_menu(LAN_OPTIONS, $action, $var, TRUE);
 }
diff -x .svn -aruN 0.7.16.src/e107_admin/ugflag.php 0.7.17.src/e107_admin/ugflag.php
--- 0.7.16.src/e107_admin/ugflag.php	2006-07-07 21:21:28.000000000 -0500
+++ 0.7.17.src/e107_admin/ugflag.php	2009-10-28 11:53:29.000000000 -0500
@@ -1,80 +1,132 @@
-<?php
+<?php 
 /*
-+ ----------------------------------------------------------------------------+
-|     e107 website system
-|
-|     Steve Dunstan 2001-2002
-|     http://e107.org
-|     jalist@e107.org
-|
-|     Released under the terms and conditions of the
-|     GNU General Public License (http://gnu.org).
-|
-|     $Source: /cvsroot/e107/e107_0.7/e107_admin/ugflag.php,v $
-|     $Revision: 1.11 $
-|     $Date: 2006/07/08 02:21:51 $
-|     $Author: e107coders $
-+----------------------------------------------------------------------------+
-*/
-require_once("../class2.php");
-if (!getperms("9")) {
-	header("location:".e_BASE."index.php");
-	 exit;
+ + ----------------------------------------------------------------------------+
+ |     e107 website system
+ |
+ |     ©Steve Dunstan 2001-2002
+ |     http://e107.org
+ |     jalist@e107.org
+ |
+ |     Released under the terms and conditions of the
+ |     GNU General Public License (http://gnu.org).
+ |
+ |     $Source: /cvsroot/e107/e107_0.7/e107_admin/ugflag.php,v $
+ |     $Revision: 1.13 $
+ |     $Date: 2009/10/28 16:53:53 $
+ |     $Author: marj_nl_fr $
+ +----------------------------------------------------------------------------+
+ */
+require_once ('../class2.php');
+if(!getperms('9'))
+{
+	header('location:'.e_BASE.'index.php');
+	exit();
 }
 
-require_once(e_HANDLER."ren_help.php");
-
-if (isset($_POST['updatesettings'])) {
+if(isset($_POST['updatesettings']))
+{
 	$pref['maintainance_flag'] = intval($_POST['maintainance_flag']);
 	$pref['maintainance_text'] = $tp->toDB($_POST['maintainance_text']);
 	save_prefs();
-	header("location:".e_SELF."?u");
-	exit;
-}
 
-require_once("auth.php");
-
-if (e_QUERY == "u") {
-	$ns->tablerender("", "<div style='text-align:center'><b>".UGFLAN_1.".</b></div>");
+	$message = '<div style="text-align:center"><b>'.UGFLAN_1.'.</b></div>';
 }
+else
+{
+	if(!isset($pref['maintainance_flag']))
+	{
+		$pref['maintainance_flag'] = e_UC_PUBLIC;
+	}
+	if(($pref['maintainance_flag']) == 1)
+	{
+		$pref['maintainance_flag'] = e_UC_ADMIN;
+	}
+}
+require_once (e_HANDLER.'ren_help.php');
 
-$maintainance_flag = $pref['maintainance_flag'];
-
-$text = "<div style='text-align:center'>
-	<form method='post' action='".e_SELF."' id='dataform'>
-	<table style='".ADMIN_WIDTH."' class='fborder'>
-	<tr>
-	<td style='width:30%' class='forumheader3'>".UGFLAN_2.": </td>
-	<td style='width:70%' class='forumheader3'>";
-
+require_once ('auth.php');
 
-if ($maintainance_flag == 1) {
-	$text .= "<input type='checkbox' name='maintainance_flag' value='1'  checked='checked' />";
-} else {
-	$text .= "<input type='checkbox' name='maintainance_flag' value='1' />";
+if(varset($message))
+{
+	$ns->tablerender('', $message);
 }
 
-$text .= "</td>
-	</tr>
 
-	<tr>
-	<td style='width:30%' class='forumheader3'>".UGFLAN_5."<br /><span class='smalltext'>".UGFLAN_6."</span></td>
-	<td style='width:70%' class='forumheader3'>
-	<textarea id='maintainance_text' class='tbox' name='maintainance_text' cols='63' style='max-width:80%' rows='10' onselect='storeCaret(this);' onclick='storeCaret(this);' onkeyup='storeCaret(this);'>".$pref['maintainance_text']."</textarea>
-	<br />".display_help("","maintenance")."  </td>
-	</tr>
-
-
-	<tr style='vertical-align:top'>
-	<td colspan='2'  style='text-align:center' class='forumheader'>
-	<input class='button' type='submit' name='updatesettings' value='".UGFLAN_3."' />
-	</td>
-	</tr>
+$text = '
+	<div style="text-align:center">
+	<form method="post" action="'.e_SELF.'" id="dataform">
+	<table style="'.ADMIN_WIDTH.'" class="fborder">
+		<colgroup span="2">
+			<col style="width:30%" />
+			<col style="width:70%" />
+		</colgroup>
+';
+
+$text .= '
+		<tr>
+			<td class="forumheader3">
+			'.UGFLAN_2.'
+			</td>
+			<td class="forumheader3">
+';
+
+$text .= '
+			<label>
+			<input type="radio" name="maintainance_flag" value="'.e_UC_PUBLIC.'"'.
+			((varset($pref['maintainance_flag']) == e_UC_PUBLIC) ? ' checked="checked"' : '')
+			.' />
+			'.LAN_DISABLED.'
+			</label>
+			<br />
+';
+$text .= '
+			<label>
+			<input type="radio" name="maintainance_flag" value="'.e_UC_ADMIN.'"'.
+			((varset($pref['maintainance_flag']) == e_UC_ADMIN) ? ' checked="checked"' : '')
+			.' />
+			'.UGFLAN_8.'
+			</label>
+			<br />
+';
+$text .= '
+			<label>
+			<input type="radio" name="maintainance_flag" value="'.e_UC_MAINADMIN.'"'.
+			((varset($pref['maintainance_flag']) == e_UC_MAINADMIN) ? ' checked="checked"' : '')
+			.' />
+			'.UGFLAN_9.'
+			</label>
+			<br />
+';
+
+$text .= '
+		</tr>
+';
+
+$text .= '
+		<tr>
+			<td class="forumheader3">
+			'.UGFLAN_5.'<br />
+			<span class="smalltext">'.UGFLAN_6.'</span>
+		</td>
+		<td class="forumheader3">
+			<textarea id="maintainance_text" class="tbox" name="maintainance_text"
+			 cols="63" style="width:100%" rows="10"
+			 onselect="storeCaret(this);" onclick="storeCaret(this);" onkeyup="storeCaret(this);">'.$pref['maintainance_text'].'</textarea>
+			'.display_help('', 'maintenance').'
+			</td>
+		</tr>
+';
+
+$text .= '
+			<tr>
+			<td colspan="2" style="text-align:center" class="forumheader">
+			<input class="button" type="submit" name="updatesettings" value="'.UGFLAN_3.'" />
+			</td>
+		</tr>
 	</table>
 	</form>
-	</div>";
+	</div>
+';
 
 $ns->tablerender(UGFLAN_4, $text);
-require_once("footer.php");
-
-?>
\ No newline at end of file
+require_once ('footer.php');
diff -x .svn -aruN 0.7.16.src/e107_admin/update_routines.php 0.7.17.src/e107_admin/update_routines.php
--- 0.7.16.src/e107_admin/update_routines.php	2007-06-11 14:27:11.000000000 -0500
+++ 0.7.17.src/e107_admin/update_routines.php	2009-12-15 16:20:48.000000000 -0600
@@ -11,8 +11,8 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_admin/update_routines.php,v $
-|     $Revision: 1.194 $
-|     $Date: 2007/06/11 19:27:34 $
+|     $Revision: 1.195 $
+|     $Date: 2009/12/15 22:21:12 $
 |     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
@@ -1663,7 +1663,7 @@
 		} else {
    		global $mySQLdefaultdb;
 		if (mysql_table_exists("link_category")) {
-			$fields = mysql_list_fields($mySQLdefaultdb, MPREFIX."link_category");
+			$fields = mysql_list_fields($mySQLdefaultdb, MPREFIX."link_category");		// This won't work with PHP5.3. But noone should be on version 0.603 now!!!!
 			$columns = mysql_num_fields($fields);
 			for ($i = 0; $i < $columns; $i++) {
 				if ("link_category_icon" == mysql_field_name($fields, $i)) {
diff -x .svn -aruN 0.7.16.src/e107_admin/userclass2.php 0.7.17.src/e107_admin/userclass2.php
--- 0.7.16.src/e107_admin/userclass2.php	2009-07-14 15:59:18.000000000 -0500
+++ 0.7.17.src/e107_admin/userclass2.php	2009-10-27 06:32:32.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_admin/userclass2.php,v $
-|     $Revision: 1.25 $
-|     $Date: 2009/07/14 20:59:42 $
-|     $Author: e107steved $
+|     $Revision: 1.26 $
+|     $Date: 2009/10/27 11:32:56 $
+|     $Author: marj_nl_fr $
 +----------------------------------------------------------------------------+
 */
 require_once("../class2.php");
@@ -205,11 +205,14 @@
 	<tr>
 	<td class='forumheader3' style='width:30%'>".UCSLAN_12."</td>
 	<td class='forumheader3' style='width:70%'>
-	<input class='tbox' type='text' size='30' maxlength='25' name='userclass_name' value='$userclass_name' /></td>
+	<input class='tbox' type='text' size='30' maxlength='25' name='userclass_name' value='$userclass_name' />
+	</td>
 	</tr>
 	<tr>
 	<td class='forumheader3'>".UCSLAN_13."</td>
-	<td class='forumheader3' style='width:70%'><input class='tbox' type='text' size='60' maxlength='85' name='userclass_description' value='$userclass_description' /></td>
+	<td class='forumheader3' style='width:70%'>
+	<input class='tbox' type='text' size='60' maxlength='85' name='userclass_description' value='$userclass_description' />
+	</td>
 	</tr>
 	";
 
@@ -230,12 +233,15 @@
 
 if(isset($_POST['edit']))
 {
-	$text .= "<input class='button' type='submit' name='updateclass' value='".UCSLAN_14."' />
-		<input type='hidden' name='userclass_id' value='$userclass_id' />";
+	$text .= "
+		<input class='button' type='submit' name='updateclass' value='".UCSLAN_14."' />
+		<input type='hidden' name='userclass_id' value='$userclass_id' />
+		";
 }
 else
 {
-	$text .= "<input class='button' type='submit' name='createclass' value='".UCSLAN_15."' />";
+	$text .= "<input class='button' type='submit' name='createclass' value='".UCSLAN_15."' />
+	";
 }
 
 $text .= "</td></tr></table>";
@@ -314,13 +320,16 @@
 // lazy get list again
 $class_total = $sql->db_Select("userclass_classes", "*", "ORDER BY userclass_name", "nowhere");
 
-$text .= "<br /><div style='text-align:center'>
+$text .= "
+	<br />
+	<div style='text-align:center'>
 	<table class='fborder' style='".ADMIN_WIDTH."'>
 	<tr>
 	<td class='fcaption'>".UCSLAN_12."</td>
 	<td class='fcaption'>".UCSLAN_24."</td>
 	<td class='fcaption'>".UCSLAN_13."</td>
-	</tr>\n";
+	</tr>
+	";
 	
 if ($class_total == "0")
 {
@@ -338,14 +347,17 @@
 				$rEditClass = e_UC_ADMIN;
 			}
 
-			$text .= "<tr>
+			$text .= "
+			<tr>
 			<td class='forumheader3'>{$row['userclass_name']}</td>
 			<td class='forumheader3'>".r_userclass_name($rEditClass)."</td>
-			<td class='forumheader3'>{$row['userclass_description']}</td>\n";
+			<td class='forumheader3'>{$row['userclass_description']}</td>";
 		}
 	}
 }
-$text .="</table>";
+$text .="
+</table>
+</div>";
 
 $ns->tablerender(UCSLAN_21, $text);
 
diff -x .svn -aruN 0.7.16.src/e107_admin/users.php 0.7.17.src/e107_admin/users.php
--- 0.7.16.src/e107_admin/users.php	2009-07-18 10:53:18.000000000 -0500
+++ 0.7.17.src/e107_admin/users.php	2009-12-15 16:20:48.000000000 -0600
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_admin/users.php,v $
-|     $Revision: 1.100 $
-|     $Date: 2009/07/18 15:53:42 $
-|     $Author: marj_nl_fr $
+|     $Revision: 1.101 $
+|     $Date: 2009/12/15 22:21:12 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 require_once("../class2.php");
@@ -68,6 +68,7 @@
 $from = varset($from, 0);
 $amount = 30;
 
+/*
 
 // ------- Check for Bounces --------------
 $bounce_act = '';
@@ -83,6 +84,7 @@
 	exit;
 }
 
+*/
 
 
 
@@ -495,6 +497,7 @@
 */
 
 
+
 $unverified = $sql -> db_Count("user", "(*)", "WHERE user_ban = 2");
 
 if (!e_QUERY || ($action == "main")) {
@@ -719,6 +722,8 @@
 		$prev[$disp] = $row[$disp];
 	}
 // -------------------------------------------------------------
+
+
 				$qry = (e_QUERY) ?  "?".e_QUERY : "";
 				$text .= "
 					<td style='width:30%;text-align:center' class='forumheader3'>
@@ -817,20 +822,29 @@
 		$text .= "<div style='cursor:pointer' onclick=\"expandit('sdisp')\">".LAN_DISPLAYOPT."</div>";
 		$text .= "<div  id='sdisp' style='padding-top:4px;display:none;text-align:center;margin-left:auto;margin-right:auto'>
 		<table class='forumheader3' style='width:95%'><tr>";
-		$fields = mysql_list_fields($mySQLdefaultdb, MPREFIX."user");
-		$columns = mysql_num_fields($fields);
-		for ($i = 0; $i < $columns; $i++) {
+/*
+		$fields = mysql_list_fields($mySQLdefaultdb, MPREFIX."user");		// Returns a resource. Deprecated
+		$columns = mysql_num_fields($fields);			// Bug in PHP5.3 using mysql_num_fields() with mysql_list_fields()
+
+		for ($i = 0; $i < $columns; $i++) 
+		{
 			$fname[] = mysql_field_name($fields, $i);
 		}
+*/
+		$fname = $sql->db_FieldList('user', '', FALSE);		// Get list of field names
 
 		// include extended fields in the list.
-        $sql -> db_Select("user_extended_struct");
-            while($row = $sql-> db_Fetch()){
-            $fname[] = "user_".$row['user_extended_struct_name'];
+        $sql -> db_Select('user_extended_struct');
+
+
+		while($row = $sql-> db_Fetch())
+		{
+			$fname[] = "user_".$row['user_extended_struct_name'];
 		}
         $m = 0;
-		foreach($fname as $fcol){
-        $checked = (in_array($fcol,$search_display)) ? "checked='checked'" : "";
+		foreach($fname as $fcol)
+		{
+			$checked = (in_array($fcol,$search_display)) ? "checked='checked'" : "";
 			$text .= "<td style='text-align:left; padding:0px'>";
 			$text .= "<input type='checkbox' name='searchdisp[]' value='".$fcol."' $checked />".str_replace("user_","",$fcol) . "</td>\n";
 			$m++;
@@ -850,7 +864,6 @@
 		$total_cap = (isset($_POST['searchquery'])) ? $user_total : $users;
 		$caption = USRLAN_77 ."&nbsp;&nbsp;   (total: $total_cap)";
 		$ns->tablerender($caption, $text);
-
 	}
 
 
diff -x .svn -aruN 0.7.16.src/e107_admin/ver.php 0.7.17.src/e107_admin/ver.php
--- 0.7.16.src/e107_admin/ver.php	2009-09-05 10:24:04.000000000 -0500
+++ 0.7.17.src/e107_admin/ver.php	2010-01-22 08:36:10.000000000 -0600
@@ -11,14 +11,14 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_admin/ver.php,v $
-|     $Revision: 1.28 $
-|     $Date: 2009/09/05 15:24:28 $
+|     $Revision: 1.29 $
+|     $Date: 2010/01/22 14:36:34 $
 |     $Author: mcfly_e107 $
 +----------------------------------------------------------------------------+
 */
 
 if (!defined('e107_INIT')) { exit; }
 
-$e107info['e107_version'] = "0.7.16";
+$e107info['e107_version'] = "0.7.17";
 
 ?>
\ No newline at end of file
diff -x .svn -aruN 0.7.16.src/e107_files/bbcode/email.bb 0.7.17.src/e107_files/bbcode/email.bb
--- 0.7.16.src/e107_files/bbcode/email.bb	2006-02-10 09:31:28.000000000 -0600
+++ 0.7.17.src/e107_files/bbcode/email.bb	2009-10-21 04:41:30.000000000 -0500
@@ -1,5 +1,25 @@
+
+global $pref;
+
+
+if($pref['make_clickable'])
+{
+
+	if($parm)
+	{
+		list($p1,$p2) = explode("@",$parm);
+		return "<a rel='external' href='javascript:window.location=\"mai\"+\"lto:\"+\"".$p1."\"+\"@\"+\"".$p2."\";self.close();' onmouseover='window.status=\"mai\"+\"lto:\"+\"".$p1."\"+\"@\"+\"".$p2."\"; return true;' onmouseout='window.status=\"\";return true;'>".$code_text."</a>";
+	}
+	else
+	{
+		list($p1,$p2) = explode("@",$code_text);
+		$email_text = (CHARSET != "utf-8" && CHARSET != "UTF-8") ? $p1."&copy;".$p2 : $p1."©".$p2;
+		return "<a rel='external' href='javascript:window.location=\"mai\"+\"lto:\"+\"".$p1."\"+\"@\"+\"".$p2."\";self.close();' onmouseover='window.status=\"mai\"+\"lto:\"+\"".$p1."\"+\"@\"+\"".$p2."\"; return true;' onmouseout='window.status=\"\";return true;'>".$email_text."</a>";
+	}
+}
+// Old method that attracts SPAM.
 if ($parm) {
-	return "<a href='mailto:".$tp -> toAttribute($parm)."'>".$code_text."</a>";
+  	return "<a href='mailto:".$tp -> toAttribute($parm)."'>".$code_text."</a>";
 } else {
-	return "<a href='mailto:".$tp -> toAttribute($code_text)."'>".$code_text."</a>";
+  	return "<a href='mailto:".$tp -> toAttribute($code_text)."'>".$code_text."</a>";
 }
\ No newline at end of file
diff -x .svn -aruN 0.7.16.src/e107_files/bbcode/url.bb 0.7.17.src/e107_files/bbcode/url.bb
--- 0.7.16.src/e107_files/bbcode/url.bb	2007-08-08 14:40:06.000000000 -0500
+++ 0.7.17.src/e107_files/bbcode/url.bb	2009-10-06 05:54:42.000000000 -0500
@@ -1,16 +1,18 @@
 global $pref;
 
 $parm     = trim($parm);
-$external = ($pref['links_new_window'] || strpos($parm, 'external') === 0) ? " rel='external'" : "";
+$external = ($pref['links_new_window'] || strpos($parm, 'external') === 0) ? ' rel="external"' : '';
 
 if ($parm && $parm != 'external' && strpos($parm, ' ') === FALSE)
 {
 	$parm = preg_replace('#^external.#is', '', $parm);
-	if (strtolower(substr($parm,0,11)) == 'javascript:') return '';
-	return "<a href='".$tp -> toAttribute($parm)."'".$external.">".$code_text."</a>";
+	if (strtolower(substr($parm, 0, 11)) == 'javascript:')
+		return '';
+	return '<a href="'.$tp->toAttribute($parm).'" class="bbcode"'.$external.'>'.$code_text.'</a>';
 }
 else
 {
-  if (strtolower(substr($code_text,0,11)) == 'javascript:') return '';
-	return "<a href='".$tp -> toAttribute($code_text)."'".$external.">".$code_text."</a>";
+	if (strtolower(substr($code_text, 0, 11)) == 'javascript:')
+		return '';
+	return '<a href="'.$tp->toAttribute($code_text).'" class="bbcode"'.$external.'>'.$code_text.'</a>';
 }
diff -x .svn -aruN 0.7.16.src/e107_files/def_e107_prefs.php 0.7.17.src/e107_files/def_e107_prefs.php
--- 0.7.16.src/e107_files/def_e107_prefs.php	2009-09-03 07:05:48.000000000 -0500
+++ 0.7.17.src/e107_files/def_e107_prefs.php	2009-09-28 15:59:36.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_files/def_e107_prefs.php,v $
-|     $Revision: 1.70 $
-|     $Date: 2009/09/03 12:06:12 $
-|     $Author: e107coders $
+|     $Revision: 1.71 $
+|     $Date: 2009/09/28 21:00:00 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 
@@ -166,7 +166,8 @@
   'memberlist_access' => '253',
   'check_updates' => '1',
   'user_tracking' => 'cookie',
-  'cookie_name' => 'e107cookie'
+  'cookie_name' => 'e107cookie',
+  'email_item_class' => '253'			// Members only
 );
 
 ?>
\ No newline at end of file
diff -x .svn -aruN 0.7.16.src/e107_files/resetcore/resetcore.php 0.7.17.src/e107_files/resetcore/resetcore.php
--- 0.7.16.src/e107_files/resetcore/resetcore.php	2006-10-24 08:37:42.000000000 -0500
+++ 0.7.17.src/e107_files/resetcore/resetcore.php	2009-11-07 05:10:18.000000000 -0600
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_files/resetcore/resetcore.php,v $
-|     $Revision: 1.15 $
-|     $Date: 2006/10/24 13:38:05 $
-|     $Author: mrpete $
+|     $Revision: 1.16 $
+|     $Date: 2009/11/07 11:10:42 $
+|     $Author: marj_nl_fr $
 +----------------------------------------------------------------------------+
 */
 
@@ -65,11 +65,10 @@
 $eArrayStorage = new ArrayData();
 
 echo "<?xml version='1.0' encoding='".CHARSET."' ?>\n";
-?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
+?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
 <html xmlns="http://www.w3.org/1999/xhtml">
 <head>
-<title><e107 resetcore></title>
+<title>e107 resetcore</title>
 <link rel="stylesheet" href="style.css" />
 <meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>" />
 <meta http-equiv="content-style-type" content="text/css" />
diff -x .svn -aruN 0.7.16.src/e107_files/shortcode/admin_alt_nav.sc 0.7.17.src/e107_files/shortcode/admin_alt_nav.sc
--- 0.7.16.src/e107_files/shortcode/admin_alt_nav.sc	2006-10-27 18:06:32.000000000 -0500
+++ 0.7.17.src/e107_files/shortcode/admin_alt_nav.sc	2010-01-03 08:45:54.000000000 -0600
@@ -100,7 +100,7 @@
 	$i=1;
 	while ($file = readdir($handle)) {
 		if ($file != "." && $file != ".." && $file != "CVS") {
-			$text .= adnav_main(str_replace("_", " ", $file), e_ADMIN."docs.php?".$i, E_16_DOCS);
+			$text .= adnav_main(str_replace("_", " ", $file), e_ADMIN_ABS."docs.php?".$i, E_16_DOCS);
 			$i++;
 		}
 	}
@@ -115,8 +115,8 @@
 		$text .= "<td style='width: 160px; white-space: nowrap'>
 		<div class='menuBar' style='width: 100%'>";
 
-		$text .= adnav_cat(ADLAN_53, e_BASE.'index.php', E_16_NAV_LEAV);
-		$text .= adnav_cat(ADLAN_46, e_ADMIN.'admin.php?logout', E_16_NAV_LGOT);
+		$text .= adnav_cat(ADLAN_53, e_HTTP.'index.php', E_16_NAV_LEAV);
+		$text .= adnav_cat(ADLAN_46, e_ADMIN_ABS.'admin.php?logout', E_16_NAV_LGOT);
 
 		$text .= "</div>
 		</td>";
diff -x .svn -aruN 0.7.16.src/e107_files/shortcode/admin_credits.sc 0.7.17.src/e107_files/shortcode/admin_credits.sc
--- 0.7.16.src/e107_files/shortcode/admin_credits.sc	2006-10-28 19:59:57.000000000 -0500
+++ 0.7.17.src/e107_files/shortcode/admin_credits.sc	2010-01-03 08:45:54.000000000 -0600
@@ -1,5 +1,5 @@
 if (ADMIN) {
 	return "<div style='text-align: center'>
-			<input class='button' type='button' onclick=\"javascript: window.open('".e_ADMIN."credits.php', 'myWindow', 'status = 1, height = 400, width = 300, resizable = 0')\" value='".LAN_CREDITS."' />
+			<input class='button' type='button' onclick=\"javascript: window.open('".e_ADMIN_ABS."credits.php', 'myWindow', 'status = 1, height = 400, width = 300, resizable = 0')\" value='".LAN_CREDITS."' />
 			</div>";
 }
diff -x .svn -aruN 0.7.16.src/e107_files/shortcode/admin_icon.sc 0.7.17.src/e107_files/shortcode/admin_icon.sc
--- 0.7.16.src/e107_files/shortcode/admin_icon.sc	2005-09-07 08:24:29.000000000 -0500
+++ 0.7.17.src/e107_files/shortcode/admin_icon.sc	2010-01-03 08:45:54.000000000 -0600
@@ -2,7 +2,7 @@
 	global $e_sub_cat, $e_icon_array, $PLUGINS_DIRECTORY;
 	if (strstr(e_SELF, $PLUGINS_DIRECTORY)) {
 		include('plugin.php');
-		$icon = ($eplug_icon && file_exists(e_PLUGIN.$eplug_icon)) ? "<img src='".e_PLUGIN.$eplug_icon."' alt='' style='border:0px; width: 32px; height: 32px' />" : E_32_CAT_PLUG;
+		$icon = ($eplug_icon && file_exists(e_PLUGIN.$eplug_icon)) ? "<img src='".e_PLUGIN_ABS.$eplug_icon."' alt='' style='border:0px; width: 32px; height: 32px' />" : E_32_CAT_PLUG;
 	} else {
 		$icon = $e_icon_array[$e_sub_cat];
 	}
diff -x .svn -aruN 0.7.16.src/e107_files/shortcode/admin_lang.sc 0.7.17.src/e107_files/shortcode/admin_lang.sc
--- 0.7.16.src/e107_files/shortcode/admin_lang.sc	2009-07-17 09:48:18.000000000 -0500
+++ 0.7.17.src/e107_files/shortcode/admin_lang.sc	2009-11-19 05:45:25.000000000 -0600
@@ -1,57 +1,52 @@
-if (ADMIN) {
+/* $Id: admin_lang.sc,v 1.22 2009/11/19 11:45:49 marj_nl_fr Exp $ */
+if(ADMIN)
+{
 	global $ns, $sql, $pref;
-	if ($pref['multilanguage'])
+	if($pref['multilanguage'])
 	{
-		$filepath = e_PLUGIN."userlanguage_menu/languages/".e_LANGUAGE.".php";
-		if(file_exists($filepath))
+		include_lan(e_PLUGIN.'userlanguage_menu/languages/'.e_LANGUAGE.'.php');
+		$lanlist = explode(',', e_LANLIST);
+		sort($lanlist);
+		foreach ($lanlist as $langval)
 		{
-			require_once($filepath);
-		}
-		else
-		{
-			require_once(e_PLUGIN."userlanguage_menu/languages/English.php");
-		}
-		$lanlist = explode(",",e_LANLIST);
-        sort($lanlist);
-		foreach($lanlist as $langval)
-		{
-			if (getperms($langval))
+			if(getperms($langval))
 			{
 				$lanperms[] = $langval;
 			}
 		}
-
-		require_once(e_HANDLER."language_class.php");
+		
+		require_once (e_HANDLER.'language_class.php');
 		$slng = new language;
 
-
+		
 		if(!getperms($sql->mySQLlanguage) && $lanperms)
 		{
 			$sql->mySQLlanguage = ($lanperms[0] != $pref['sitelanguage']) ? $lanperms[0] : "";
-			if ($pref['user_tracking'] == "session")
+			if($pref['user_tracking'] == "session")
 			{
 				$_SESSION['e107language_'.$pref['cookie_name']] = $lanperms[0];
-				if($pref['multilanguage_subdomain']){
+				if($pref['multilanguage_subdomain'])
+				{
 					header("Location:".$slng->subdomainUrl($lanperms[0]));
 				}
 			}
 			else
 			{
 				setcookie('e107language_'.$pref['cookie_name'], $lanperms[0], time() + 86400, '/');
-				$_COOKIE['e107language_'.$pref['cookie_name']]= $lanperms[0];
+				$_COOKIE['e107language_'.$pref['cookie_name']] = $lanperms[0];
 			}
 		}
-
-		foreach($GLOBALS['mySQLtablelist'] as $tabs)
+		
+		foreach ($GLOBALS['mySQLtablelist'] as $tabs)
 		{
 			$clang = strtolower($sql->mySQLlanguage);
-			if(strpos($tabs,"lan_".$clang) && $clang !="")
+			if(strpos($tabs, "lan_".$clang) && $clang != "")
 			{
-				$aff[] = str_replace(MPREFIX."lan_".$clang."_","",$tabs);
+				$aff[] = str_replace(MPREFIX."lan_".$clang."_", "", $tabs);
 			}
 		}
 
-
+		
 		$text .= "<div><img src='".e_IMAGE."admin_images/language_16.png' alt='' />&nbsp;";
 		if(isset($aff))
 		{
@@ -60,7 +55,7 @@
 			: <span class='button' style='cursor: pointer;' onclick='expandit(\"lan_tables\");'><a style='text-decoration:none' title='' href=\"javascript:void(0);\" >&nbsp;&nbsp;".count($aff)." ".UTHEME_MENU_L3."&nbsp;&nbsp;</a></span><br />
 			<span style='display:none' id='lan_tables'>
 			";
-			$text .= implode("<br />",$aff);
+			$text .= implode("<br />", $aff);
 			$text .= "</span>";
 		}
 		elseif($sql->mySQLlanguage && ($sql->mySQLlanguage != $pref['sitelanguage']))
@@ -74,30 +69,29 @@
 		}
 		$text .= "<br /><br /></div>";
 
-
-
+		
 		if(isset($pref['multilanguage_subdomain']) && $pref['multilanguage_subdomain'])
 		{
-        	$text .= "<div style='text-align:center'>
+			$text .= "<div style='text-align:center'>
 			<select class='tbox' name='lang_select' style='width:95%' onchange=\"location.href=this.options[selectedIndex].value\">";
-			foreach($lanperms as $lng)
+			foreach ($lanperms as $lng)
 			{
 				$selected = ($lng == $sql->mySQLlanguage || ($lng == $pref['sitelanguage'] && !$sql->mySQLlanguage)) ? "selected='selected'" : "";
-                $urlval = $slng->subdomainUrl($lng);
+				$urlval = $slng->subdomainUrl($lng);
 				$text .= "<option value='".$urlval."' $selected>$lng</option>\n";
 			}
 			$text .= "</select></div>";
-
+			
 		}
-        else
+		else
 		{
-
+		
 			$text .= "<div style='text-align:center'>
 			<form method='post' action='".e_SELF.(e_QUERY ? "?".e_QUERY : "")."'>
 			<div>
 			<select name='sitelanguage' class='tbox'>";
-
-			foreach($lanperms as $lng)
+			
+			foreach ($lanperms as $lng)
 			{
 				$langval = ($lng == $pref['sitelanguage'] && $lng == 'English') ? "" : $lng;
 				$selected = ($lng == $sql->mySQLlanguage || ($lng == $pref['sitelanguage'] && !$sql->mySQLlanguage)) ? "selected='selected'" : "";
@@ -110,7 +104,7 @@
 				</form>
 			</div>";
 		}
-
-		return $ns -> tablerender(UTHEME_MENU_L2, $text, '', TRUE);
+		
+		return $ns->tablerender(UTHEME_MENU_L2, $text, '', TRUE);
 	}
 }
diff -x .svn -aruN 0.7.16.src/e107_files/shortcode/admin_latest.sc 0.7.17.src/e107_files/shortcode/admin_latest.sc
--- 0.7.16.src/e107_files/shortcode/admin_latest.sc	2006-11-07 23:14:44.000000000 -0600
+++ 0.7.17.src/e107_files/shortcode/admin_latest.sc	2010-01-03 08:45:54.000000000 -0600
@@ -6,8 +6,8 @@
 	   		$active_uploads = $sql -> db_Count("upload", "(*)", "WHERE upload_active = '0' ");
 			$submitted_news = $sql -> db_Count("submitnews", "(*)", "WHERE submitnews_auth = '0' ");
 
-			$text = "<div style='padding-bottom: 2px;'>".E_16_NEWS.($submitted_news ? " <a href='".e_ADMIN."newspost.php?sn'>".ADLAN_LAT_2.": $submitted_news</a>" : " ".ADLAN_LAT_2.": 0")."</div>";
-			$text .= "<div style='padding-bottom: 2px;'>".E_16_UPLOADS.($active_uploads ? " <a href='".e_ADMIN."upload.php'>".ADLAN_LAT_7.": $active_uploads</a>" : " ".ADLAN_LAT_7.": ".$active_uploads)."</div>";
+			$text = "<div style='padding-bottom: 2px;'>".E_16_NEWS.($submitted_news ? " <a href='".e_ADMIN_ABS."newspost.php?sn'>".ADLAN_LAT_2.": $submitted_news</a>" : " ".ADLAN_LAT_2.": 0")."</div>";
+			$text .= "<div style='padding-bottom: 2px;'>".E_16_UPLOADS.($active_uploads ? " <a href='".e_ADMIN_ABS."upload.php'>".ADLAN_LAT_7.": $active_uploads</a>" : " ".ADLAN_LAT_7.": ".$active_uploads)."</div>";
 
 			foreach($pref['e_latest_list'] as $val)
 			{
@@ -25,7 +25,7 @@
 			$queryString = substr($queryString, 0, -3);
 
 			if($amount = $sql -> db_Select("generic", "*", $queryString)) {
-				$text .= "<br /><b><a href='".e_ADMIN."message.php'>".ADLAN_LAT_8." [".$amount."]</a></b>";
+				$text .= "<br /><b><a href='".e_ADMIN_ABS."message.php'>".ADLAN_LAT_8." [".$amount."]</a></b>";
 			}
 
 			return $ns -> tablerender(ADLAN_LAT_1, $text, '', TRUE);
diff -x .svn -aruN 0.7.16.src/e107_files/shortcode/admin_logo.sc 0.7.17.src/e107_files/shortcode/admin_logo.sc
--- 0.7.16.src/e107_files/shortcode/admin_logo.sc	2007-01-28 15:12:42.000000000 -0600
+++ 0.7.17.src/e107_files/shortcode/admin_logo.sc	2010-01-21 15:45:19.000000000 -0600
@@ -12,8 +12,8 @@
 }
 else
 {
-	$logo = e_IMAGE."adminlogo.png";
-	$path = $logo;
+	$logo = e_IMAGE_ABS."adminlogo.png";
+	$path = e_IMAGE."adminlogo.png";
 }
 
 $dimensions = getimagesize($path);
@@ -22,7 +22,7 @@
 
 if (isset($link) && $link) {
 	if ($link == 'index') {
-		$image = "<a href='".e_ADMIN."index.php'>".$image."</a>";
+		$image = "<a href='".e_ADMIN_ABS."index.php'>".$image."</a>";
 	}
 	else
 	{
diff -x .svn -aruN 0.7.16.src/e107_files/shortcode/admin_log.sc 0.7.17.src/e107_files/shortcode/admin_log.sc
--- 0.7.16.src/e107_files/shortcode/admin_log.sc	2007-07-16 15:49:52.000000000 -0500
+++ 0.7.17.src/e107_files/shortcode/admin_log.sc	2010-01-03 08:45:54.000000000 -0600
@@ -18,9 +18,9 @@
 				$text .= "<li>{$datestamp} - {$row['dblog_title']}</li>";
 			}
 			$text .= ($cnt ? "</ul>" : "");
-			$text .= "[ <a href='".e_ADMIN."admin_log.php?logall'>".ADLAN_117."</a> ]";
+			$text .= "[ <a href='".e_ADMIN_ABS."admin_log.php?logall'>".ADLAN_117."</a> ]";
 
-			$text .= "<br />[ <a href='".e_ADMIN."admin_log.php?purge' onclick=\"return jsconfirm('".LAN_CONFIRMDEL."')\">".ADLAN_118."</a> ]\n";
+			$text .= "<br />[ <a href='".e_ADMIN_ABS."admin_log.php?purge' onclick=\"return jsconfirm('".LAN_CONFIRMDEL."')\">".ADLAN_118."</a> ]\n";
 
 			$text .= "</div>";
 
diff -x .svn -aruN 0.7.16.src/e107_files/shortcode/admin_pword.sc 0.7.17.src/e107_files/shortcode/admin_pword.sc
--- 0.7.16.src/e107_files/shortcode/admin_pword.sc	2005-06-01 11:01:55.000000000 -0500
+++ 0.7.17.src/e107_files/shortcode/admin_pword.sc	2010-01-03 08:45:54.000000000 -0600
@@ -1,7 +1,7 @@
 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."updateadmin.php'>".ADLAN_103."</a></div>";
+		$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);
 	}
 }
diff -x .svn -aruN 0.7.16.src/e107_files/shortcode/admin_status.sc 0.7.17.src/e107_files/shortcode/admin_status.sc
--- 0.7.16.src/e107_files/shortcode/admin_status.sc	2007-05-11 16:03:40.000000000 -0500
+++ 0.7.17.src/e107_files/shortcode/admin_status.sc	2010-01-03 08:45:54.000000000 -0600
@@ -7,7 +7,7 @@
 			$unverified = $sql -> db_Count("user", "(*)", "WHERE user_ban=2");
 			$banned = $sql -> db_Count("user", "(*)", "WHERE user_ban=1");
 			$comments = $sql -> db_Count("comments");
-			$unver = ($unverified ? " <a href='".e_ADMIN."users.php?unverified'>".ADLAN_111."</a>" : ADLAN_111);
+			$unver = ($unverified ? " <a href='".e_ADMIN_ABS."users.php?unverified'>".ADLAN_111."</a>" : ADLAN_111);
 
 			$text = "<div style='padding-bottom: 2px;'>".E_16_USER." ".ADLAN_110.": ".$members."</div>";
 			$text .= "<div style='padding-bottom: 2px;'>".E_16_USER." {$unver}: ".$unverified."</div>";
@@ -25,7 +25,7 @@
 
 			if($flo = $sql -> db_Count("generic", "(*)", "WHERE gen_type='failed_login'"))
 			{
-				$text .= "<img src='".e_IMAGE."admin_images/failedlogin_16.png' alt='' style='vertical-align: middle;' /> <a href='".e_ADMIN."fla.php'>".ADLAN_146.": $flo</a>";
+				$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>";
 			}
 
 
diff -x .svn -aruN 0.7.16.src/e107_files/shortcode/admin_update.sc 0.7.17.src/e107_files/shortcode/admin_update.sc
--- 0.7.16.src/e107_files/shortcode/admin_update.sc	2009-09-03 08:29:37.000000000 -0500
+++ 0.7.17.src/e107_files/shortcode/admin_update.sc	2010-01-22 07:50:04.000000000 -0600
@@ -1,9 +1,9 @@
-// $Id: admin_update.sc,v 1.7 2009/09/03 13:30:01 e107coders Exp $
-
-
+// $Id: admin_update.sc,v 1.10 2010/01/22 13:50:28 secretr Exp $
+global $tp;
 	if (!ADMIN) return "";
 
 	global $e107cache,$ns, $pref;
+	
   	if (!varset($pref['check_updates'], FALSE)) return "";
 	
 	if (is_readable(e_ADMIN."ver.php"))
@@ -11,7 +11,8 @@
 		include(e_ADMIN."ver.php");
 	}
 
-	$feed = "http://sourceforge.net/export/rss2_projfiles.php?group_id=63748&rss_limit=5";
+	$feed = "http://www.e107.org/releases.php";
+	
 	$e107cache->CachePageMD5 = md5($e107info['e107_version']);
 
     if($cacheData = $e107cache->retrieve("updatecheck",3600, TRUE))
@@ -24,34 +25,48 @@
 	//if ((strpos(e_SELF,'localhost') !== FALSE) || (strpos(e_SELF,'127.0.0.1') !== FALSE)) return '';
 
 	require_once(e_HANDLER."xml_class.php");
+	
 	$xml = new parseXml;
-	require_once(e_HANDLER."magpie_rss.php");
-
+	$xm = new XMLParse();
+	
     $ftext = "";
+	
 	if($rawData = $xml -> getRemoteXmlFile($feed,5))
-	{
-	  $rss = new MagpieRSS( $rawData );
-      list($cur_version,$tag) = explode(" ",$e107info['e107_version']);
-      $c = 0;
-	  foreach($rss->items as $val)
-	  {
-		$search = array((strstr($val['title'],"(")),"e107","released"," v");
-		$version = trim(str_replace($search,"",$val['title']));
+	{	
+		$array = $xm->parse($rawData);
+		
+		list($cur_version,$tag) = explode(" ", $e107info['e107_version']);
 
-	 	if(version_compare($version,$cur_version)==1)
+		foreach($array['e107Release']['core'] as $val)
 		{
-        	$ftext = "<a rel='external' href='".$val['link']."' >e107 v".$version."</a><br />\n";
-            break;
+			$val = (array) $val;
+	
+			$version = varsettrue($val['attributes']['version']);
+			$link = varsettrue($val['attributes']['url']);
+			$compat = varsettrue($val['attributes']['compatibility']);
+	
+		 	if(($compat == '0.7') && version_compare($version,$cur_version)==1)
+			{
+	        	$ftext = "<a rel='external' href='".$link."' >".sprintf(LAN_NEWVERSION_DLD, "e107 v".$version)."</a><br />\n";
+	        	if(varsettrue($val['description']))
+	        	{
+	        		$ftext .= '<br />'.$tp->toHTML(trim($val['description']), true, 'BODY').'<br />';
+	        	}
+	        	if(varsettrue($val['attributes']['infourl']))
+	        	{
+	        		$ftext .= "<a rel='external' href='".$val['attributes']['infourl']."' >".LAN_NEWVERSION_MORE."</a>\n";
+	        	}
+				break;
+			}
 		}
-		$c++;
-	  }
 	}
-	else
-	{  // Error getting data
+	else // Error getting data
+	{  
 	  $ftext = ADLAN_154;
 	}
 
 	$e107cache->set("updatecheck", $ftext, TRUE);
+	
 	if($ftext)
 	{
 		return $ns -> tablerender(LAN_NEWVERSION, $ftext);
diff -x .svn -aruN 0.7.16.src/e107_files/shortcode/batch/bbcode_shortcodes.php 0.7.17.src/e107_files/shortcode/batch/bbcode_shortcodes.php
--- 0.7.16.src/e107_files/shortcode/batch/bbcode_shortcodes.php	2008-06-02 13:55:03.000000000 -0500
+++ 0.7.17.src/e107_files/shortcode/batch/bbcode_shortcodes.php	2010-01-09 08:38:58.000000000 -0600
@@ -3,7 +3,7 @@
 + ----------------------------------------------------------------------------+
 |     e107 website system
 |
-|     Steve Dunstan 2001-2002
+|     �Steve Dunstan 2001-2002
 |     http://e107.org
 |     jalist@e107.org
 |
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_files/shortcode/batch/bbcode_shortcodes.php,v $
-|     $Revision: 1.15 $
-|     $Date: 2008/06/02 18:55:26 $
-|     $Author: e107steved $
+|     $Revision: 1.16 $
+|     $Date: 2010/01/09 14:39:22 $
+|     $Author: secretr $
 +----------------------------------------------------------------------------+
 */
 if (!defined('e107_INIT')) { exit; }
@@ -72,7 +72,7 @@
 
 if(!isset($iconpath[$parm]))
 {
-	$iconpath[$parm] =  (file_exists(THEME."bbcode/bold.png") ? THEME."bbcode/" : e_IMAGE."generic/bbcode/");
+	$iconpath[$parm] =  (file_exists(THEME."bbcode/bold.png") ? THEME_ABS."bbcode/" : e_IMAGE_ABS."generic/bbcode/");
     $iconpath[$parm] .= $bbcode[$parm][3];
 }
 
diff -x .svn -aruN 0.7.16.src/e107_files/shortcode/batch/comment_shortcodes.php 0.7.17.src/e107_files/shortcode/batch/comment_shortcodes.php
--- 0.7.16.src/e107_files/shortcode/batch/comment_shortcodes.php	2008-05-25 03:25:10.000000000 -0500
+++ 0.7.17.src/e107_files/shortcode/batch/comment_shortcodes.php	2010-01-09 08:38:57.000000000 -0600
@@ -3,7 +3,7 @@
 + ----------------------------------------------------------------------------+
 |     e107 website system
 |
-|     Steve Dunstan 2001-2002
+|     �Steve Dunstan 2001-2002
 |     http://e107.org
 |     jalist@e107.org
 |
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_files/shortcode/batch/comment_shortcodes.php,v $
-|     $Revision: 1.22 $
-|     $Date: 2008/05/25 08:25:33 $
-|     $Author: e107steved $
+|     $Revision: 1.23 $
+|     $Date: 2010/01/09 14:39:21 $
+|     $Author: secretr $
 +----------------------------------------------------------------------------+
 */
 if (!defined('e107_INIT')) { exit; }
@@ -35,7 +35,7 @@
 global $USERNAME, $comrow;
 if (isset($comrow['user_id']) && $comrow['user_id']) 
 {
-	$USERNAME = "<a href='".e_BASE."user.php?id.".$comrow['user_id']."'>".$comrow['user_name']."</a>\n";
+	$USERNAME = "<a href='".SITEURL."user.php?id.".$comrow['user_id']."'>".$comrow['user_name']."</a>\n";
 }
 else
 {
@@ -58,7 +58,7 @@
 $REPLY = '';
 if($comrow['comment_lock'] != "1"){
 	if ($thisaction == "comment" && $pref['nested_comments']) {
-		$REPLY = "<a href='".e_BASE."comment.php?reply.".$thistable.".".$comrow['comment_id'].".".$thisid."'>".COMLAN_326."</a>";
+		$REPLY = "<a href='".SITEURL."comment.php?reply.".$thistable.".".$comrow['comment_id'].".".$thisid."'>".COMLAN_326."</a>";
 	}
 }
 return $REPLY;
@@ -111,7 +111,7 @@
 	else
 	{
 //		return "<a href='".e_SELF."?".$comment_edit_query.".edit.".$comrow['comment_id']."'><img src='".e_IMAGE."generic/".IMODE."/newsedit.png' alt='".COMLAN_318."' title='".COMLAN_318."' style='border: 0;' /></a>";
-		return "<a href='".e_BASE."comment.php?".$comment_edit_query.".edit.".$comrow['comment_id']."'><img src='".e_IMAGE."generic/".IMODE."/newsedit.png' alt='".COMLAN_318."' title='".COMLAN_318."' style='border: 0;' /></a>";
+		return "<a href='".SITEURL."comment.php?".$comment_edit_query.".edit.".$comrow['comment_id']."'><img src='".e_IMAGE."generic/".IMODE."/newsedit.png' alt='".COMLAN_318."' title='".COMLAN_318."' style='border: 0;' /></a>";
 	}
 }
 else
@@ -128,7 +128,7 @@
 SC_BEGIN IPADDRESS
 global $IPADDRESS, $comrow;
 require_once(e_HANDLER."encrypt_handler.php");
-return (ADMIN ? "<a href='".e_BASE."userposts.php?0.comments.".$comrow['user_id']."'>".COMLAN_330." ".decode_ip($comrow['comment_ip'])."</a>" : "");
+return (ADMIN ? "<a href='".SITEURL."userposts.php?0.comments.".$comrow['user_id']."'>".COMLAN_330." ".decode_ip($comrow['comment_ip'])."</a>" : "");
 SC_END
 
 SC_BEGIN LEVEL
diff -x .svn -aruN 0.7.16.src/e107_files/shortcode/batch/download_shortcodes.php 0.7.17.src/e107_files/shortcode/batch/download_shortcodes.php
--- 0.7.16.src/e107_files/shortcode/batch/download_shortcodes.php	2009-01-29 17:45:43.000000000 -0600
+++ 0.7.17.src/e107_files/shortcode/batch/download_shortcodes.php	2010-01-02 16:10:11.000000000 -0600
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_files/shortcode/batch/download_shortcodes.php,v $
-|     $Revision: 1.31 $
-|     $Date: 2009/01/29 23:46:07 $
-|     $Author: bugrain $
+|     $Revision: 1.32 $
+|     $Date: 2010/01/02 22:10:35 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 if (!defined('e107_INIT')) { exit; }
@@ -143,8 +143,8 @@
 SC_END
 
 SC_BEGIN DOWNLOAD_CATEGORY
-global $dl;
-return $dl['download_category_name'];
+global $tp,$dl;
+$text = $tp -> toHTML($dl['download_category_name'], FALSE,'TITLE');
 SC_END
 
 SC_BEGIN DOWNLOAD_CATEGORY_ICON
@@ -159,7 +159,7 @@
 
 SC_BEGIN DOWNLOAD_CATEGORY_DESCRIPTION
 global $tp,$dl;
-$text = $tp -> toHTML($dl['download_category_description'], TRUE,'description');
+$text = $tp -> toHTML($dl['download_category_description'], TRUE,'DESCRIPTION');
 if($parm){
 	return substr($text,0,$parm);
 }else{
diff -x .svn -aruN 0.7.16.src/e107_files/shortcode/batch/news_shortcodes.php 0.7.17.src/e107_files/shortcode/batch/news_shortcodes.php
--- 0.7.16.src/e107_files/shortcode/batch/news_shortcodes.php	2009-03-29 16:40:51.000000000 -0500
+++ 0.7.17.src/e107_files/shortcode/batch/news_shortcodes.php	2010-01-02 11:04:09.000000000 -0600
@@ -11,15 +11,15 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_files/shortcode/batch/news_shortcodes.php,v $
-|     $Revision: 1.40 $
-|     $Date: 2009/03/29 21:41:15 $
+|     $Revision: 1.44 $
+|     $Date: 2010/01/02 17:04:33 $
 |     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 if (!defined('e107_INIT')) { exit; }
 include_once(e_HANDLER.'shortcode_handler.php');
 $news_shortcodes = $tp -> e_sc -> parse_scbatch(__FILE__);
-if(!$GLOBALS['NEWS_CSSMODE']){ $GLOBALS['NEWS_CSSMODE'] = "news"; }
+if(!isset($GLOBALS['NEWS_CSSMODE'])){ $GLOBALS['NEWS_CSSMODE'] = "news"; }
 /*
 SC_BEGIN NEWSTITLE
 global $tp;
@@ -33,7 +33,7 @@
 $news_item = getcachedvars('current_news_item');
 $param = getcachedvars('current_news_param');
 $news_body = $tp -> toHTML($news_item['news_body'], TRUE, 'BODY, fromadmin', $news_item['news_author']);
-if($news_item['news_extended'] && (isset($_POST['preview']) || strpos(e_QUERY, 'extend') !== FALSE) && $parm != "noextend") 
+if($news_item['news_extended'] && (isset($_POST['preview']) || strpos(e_QUERY, 'extend') !== FALSE) && $parm != "noextend")
 {
     $news_extended = $tp -> toHTML($news_item['news_extended'], TRUE, 'BODY, fromadmin', $news_item['news_author']);
     $news_body .= "<br /><br />".$news_extended;
@@ -66,7 +66,7 @@
 global $tp;
 $news_item = getcachedvars('current_news_item');
 $param = getcachedvars('current_news_param');
-$category_name = $tp -> toHTML($news_item['category_name'],FALSE,"defs");
+$category_name = $tp -> toHTML($news_item['category_name'],FALSE,'TITLE');
 return "<a class='".$GLOBALS['NEWS_CSSMODE']."_category' style='".(isset($param['catlink']) ? $param['catlink'] : "#")."' href='".e_HTTP."news.php?cat.".$news_item['news_category']."'>".$category_name."</a>";
 SC_END
 
@@ -90,25 +90,26 @@
 SC_BEGIN NEWSDATE
 $news_item = getcachedvars('current_news_item');
 $param = getcachedvars('current_news_param');
+$date = ($news_item['news_start'] > 0) ? $news_item['news_start'] : $news_item['news_datestamp'];
 $con = new convert;
-if($parm == "")
+if($parm == '')
 {
-	return  $con -> convert_date($news_item['news_datestamp'], 'long');
+	return  $con->convert_date($date, 'long');
 }
 switch($parm)
 {
 	case 'long':
-		return  $con -> convert_date($news_item['news_datestamp'], 'long');
-		break;
+	return  $con->convert_date($date, 'long');
+	break;
 	case 'short':
-		return  $con -> convert_date($news_item['news_datestamp'], 'short');
-		break;
+	return  $con->convert_date($date, 'short');
+	break;
 	case 'forum':
-		return  $con -> convert_date($news_item['news_datestamp'], 'forum');
-		break;
+	return  $con->convert_date($date, 'forum');
+	break;
 	default :
-		return date($parm, $news_item['news_datestamp']);
-		break;
+	return date($parm, $date);
+	break;
 }
 SC_END
 
@@ -144,7 +145,7 @@
 {
 	$NEWIMAGE = $param['image_nonew_small'];
 }
-return ($news_item['news_allow_comments'] ? $param['commentoffstring'] 
+return ($news_item['news_allow_comments'] ? $param['commentoffstring']
 :
  ''.($pref['comments_icon'] ? $NEWIMAGE : '')." <a href='".e_HTTP."comment.php?comment.news.".$news_item['news_id']."'>".$param['commentlink'].$news_item['news_comment_total'].'</a>');
 SC_END
@@ -164,6 +165,10 @@
 
 
 SC_BEGIN EMAILICON
+if (!check_class(varset($pref['email_item_class'],e_UC_MEMBER)))
+{
+	return '';
+}
 $news_item = getcachedvars('current_news_item');
 $param = getcachedvars('current_news_param');
 require_once(e_HANDLER.'emailprint_class.php');
@@ -205,26 +210,26 @@
 global $tp;
 $news_item = getcachedvars('current_news_item');
 $param = getcachedvars('current_news_param');
-if ($news_item['news_extended'] && (strpos(e_QUERY, 'extend') === FALSE || $parm == "force")) 
+if ($news_item['news_extended'] && (strpos(e_QUERY, 'extend') === FALSE || $parm == "force"))
 {
-	if (defined("PRE_EXTENDEDSTRING")) 
+	if (defined("PRE_EXTENDEDSTRING"))
 	{
 		$es1 = PRE_EXTENDEDSTRING;
 	}
-	if (defined("POST_EXTENDEDSTRING")) 
+	if (defined("POST_EXTENDEDSTRING"))
 	{
 		$es2 = POST_EXTENDEDSTRING;
 	}
-	if (isset($_POST['preview'])) 
+	if (isset($_POST['preview']))
 	{
 		return $es1.EXTENDEDSTRING.$es2."<br />".$tp->toHTML($news_item['news_extended'], TRUE, 'BODY, fromadmin', $news_item['news_author']);
-	} 
-	else 
+	}
+	else
 	{
 		return $es1."<a class='".$GLOBALS['NEWS_CSSMODE']."_extendstring' href='".e_HTTP."news.php?extend.".$news_item['news_id']."'>".EXTENDEDSTRING."</a>".$es2;
 	}
-} 
-else 
+}
+else
 {
 	return "";
 }
@@ -234,7 +239,7 @@
 global $tp;
 $news_item = getcachedvars('current_news_item');
 $param = getcachedvars('current_news_param');
-$news_title = $tp -> toHTML($news_item['news_title'], TRUE,'no_hook,emotes_off, no_make_clickable');
+$news_title = $tp -> toHTML($news_item['news_title'], TRUE,'TITLE');
 return "<div class='category".$news_item['news_category']."'>".($news_item['news_render_type'] == 1 ? "<a href='".e_HTTP."comment.php?comment.news.".$news_item['news_id']."'>".$news_title."</a>" : $news_title)."</div>";
 SC_END
 
@@ -242,7 +247,7 @@
 global $tp;
 $news_item = getcachedvars('current_news_item');
 $param = getcachedvars('current_news_param');
-$news_title = $tp -> toHTML($news_item['news_title'], TRUE,'no_hook,emotes_off, no_make_clickable');
+$news_title = $tp -> toHTML($news_item['news_title'], TRUE,'TITLE');
 return "<div class='".(defined(ADMINNAME) ? ADMINNAME : "null")."'>".($news_item['news_render_type'] == 1 ? "<a href='".e_HTTP."comment.php?comment.news.".$news_item['news_id']."'>".$news_title."</a>" : $news_title)."</div>";
 SC_END
 
diff -x .svn -aruN 0.7.16.src/e107_files/shortcode/batch/signup_shortcodes.php 0.7.17.src/e107_files/shortcode/batch/signup_shortcodes.php
--- 0.7.16.src/e107_files/shortcode/batch/signup_shortcodes.php	2007-10-11 14:45:42.000000000 -0500
+++ 0.7.17.src/e107_files/shortcode/batch/signup_shortcodes.php	2009-11-11 13:53:20.000000000 -0600
@@ -11,8 +11,8 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_files/shortcode/batch/signup_shortcodes.php,v $
-|     $Revision: 1.14 $
-|     $Date: 2007/10/11 19:46:05 $
+|     $Revision: 1.16 $
+|     $Date: 2009/11/11 19:53:44 $
 |     $Author: e107steved $
 |
 | Mods to show extended field categories
@@ -80,26 +80,29 @@
 
 
 SC_BEGIN SIGNUP_DISPLAYNAME
-global $pref, $rs;
+global $pref, $rs, $signupValue;
 if (check_class($pref['displayname_class']))
 {
   $dis_name_len = varset($pref['displayname_maxlength'],15);
-  return $rs->form_text("name", $dis_name_len+5, ($_POST['name'] ? $_POST['name'] : $name), $dis_name_len);
+  $name = ($_POST['name'] ? $_POST['name'] : varset($signupValue['name']));
+  return $rs->form_text("name", $dis_name_len+5, $name, $dis_name_len);
 }
 SC_END
 
 
 SC_BEGIN SIGNUP_LOGINNAME
-global $rs;
+global $rs, $signupValue;
 $log_name_length = varset($pref['loginname_maxlength'],30);
-return $rs->form_text("loginname", $log_name_length+5,  ($_POST['loginname'] ? $_POST['loginname'] : $loginname), $log_name_length);
+$loginname = ($_POST['loginname'] ? $_POST['loginname'] : varset($signupValue['loginname']));
+return $rs->form_text("loginname", $log_name_length+5, $loginname, $log_name_length);
 SC_END
 
 SC_BEGIN SIGNUP_REALNAME
-global $rs, $pref;
+global $rs, $pref, $signupValue;
 if ($pref['signup_option_realname'])
 {
-	return $rs->form_text("realname", 30,  ($_POST['realname'] ? $_POST['realname'] : $realname), 100);
+	$realname = ($_POST['realname'] ? $_POST['realname'] : varset($signupValue['realname']));
+	return $rs->form_text("realname", 30,  $realname, 100);
 }
 SC_END
 
@@ -122,13 +125,15 @@
 SC_END
 
 SC_BEGIN SIGNUP_EMAIL
-global $rs;
-return $rs->form_text("email", 30, ($_POST['email'] ? $_POST['email'] : $email), 100);
+global $rs, $signupValue;
+$email = ($_POST['email'] ? $_POST['email'] : varset($signupValue['email']));
+return $rs->form_text("email", 30, $email, 100);
 SC_END
 
 SC_BEGIN SIGNUP_EMAIL_CONFIRM
-global $rs;
-return $rs->form_text("email_confirm", 30, ($_POST['email_confirm'] ? $_POST['email_confirm'] : $email_confirm), 100);
+global $rs, $signupValue;
+$email_confirm = ($_POST['email_confirm'] ? $_POST['email_confirm'] : varset($signupValue['email_confirm']));
+return $rs->form_text("email_confirm", 30, $email_confirm, 100);
 SC_END
 
 
@@ -209,13 +214,13 @@
 SC_END
 
 SC_BEGIN SIGNUP_SIGNATURE
-global $pref, $SIGNUP_SIGNATURE_START, $SIGNUP_SIGNATURE_END;
+global $pref, $SIGNUP_SIGNATURE_START, $SIGNUP_SIGNATURE_END, $signupValue;
 if($pref['signup_option_signature'])
 {
 	require_once(e_HANDLER."ren_help.php");
 	$SIGNUP_SIGNATURE_START = str_replace("{REN_HELP}", display_help('helpb', 2), $SIGNUP_SIGNATURE_START);
 	$SIGNUP_SIGNATURE_END = str_replace("{REN_HELP}", display_help('helpb', 2), $SIGNUP_SIGNATURE_END);
-	$sig = ($_POST['signature'] ? $_POST['signature'] : $signature);
+	$sig = ($_POST['signature'] ? $_POST['signature'] : varset($signupValue['signature']));
 	return $SIGNUP_SIGNATURE_START.$sig.$SIGNUP_SIGNATURE_END;
 }
 SC_END
@@ -274,6 +279,10 @@
 	$text .= "
 	<select style='width:99%' name='timezone' class='tbox'>\n";
 
+	if (!isset($user_timezone) || (($user_timezone |= 'GMT') && (($user_timezone < -12) || ($user_timezone > 13))))
+	{
+		$user_timezone = 'GMT';		// Default to something a bit more helpful
+	}
 	$count = 0;
 	while ($timezone[$count])
 	{
@@ -335,4 +344,4 @@
 
 */
 
-?>
\ No newline at end of file
+?>
diff -x .svn -aruN 0.7.16.src/e107_files/shortcode/batch/sitedown_shortcodes.php 0.7.17.src/e107_files/shortcode/batch/sitedown_shortcodes.php
--- 0.7.16.src/e107_files/shortcode/batch/sitedown_shortcodes.php	2006-06-29 23:16:16.000000000 -0500
+++ 0.7.17.src/e107_files/shortcode/batch/sitedown_shortcodes.php	2009-10-28 09:21:20.000000000 -0500
@@ -3,7 +3,7 @@
 + ----------------------------------------------------------------------------+
 |     e107 website system
 |
-|     Steve Dunstan 2001-2002
+|     ©Steve Dunstan 2001-2002
 |     http://e107.org
 |     jalist@e107.org
 |
@@ -11,21 +11,24 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_files/shortcode/batch/sitedown_shortcodes.php,v $
-|     $Revision: 1.1 $
-|     $Date: 2006/06/30 04:16:39 $
-|     $Author: e107coders $
+|     $Revision: 1.2 $
+|     $Date: 2009/10/28 14:21:44 $
+|     $Author: marj_nl_fr $
 +----------------------------------------------------------------------------+
 */
-if (!defined('e107_INIT')) { exit; }
+if (!defined('e107_INIT')) { exit(); }
 include_once(e_HANDLER.'shortcode_handler.php');
 $sitedown_shortcodes = $tp -> e_sc -> parse_scbatch(__FILE__);
 /*
 
 SC_BEGIN SITEDOWN_TABLE_MAINTAINANCETEXT
-global $pref,$tp;
-if($pref['maintainance_text']) {
+global $pref, $tp;
+if($pref['maintainance_text'])
+{
 	return $tp->toHTML($pref['maintainance_text'], TRUE, 'parse_sc', 'admin');
-} else {
+}
+else
+{
 	return "<b>- ".SITENAME." ".LAN_SITEDOWN_00." -</b><br /><br />".LAN_SITEDOWN_01 ;
 }
 SC_END
diff -x .svn -aruN 0.7.16.src/e107_files/shortcode/email_item.sc 0.7.17.src/e107_files/shortcode/email_item.sc
--- 0.7.16.src/e107_files/shortcode/email_item.sc	2008-09-04 15:06:40.000000000 -0500
+++ 0.7.17.src/e107_files/shortcode/email_item.sc	2009-09-28 15:59:37.000000000 -0500
@@ -1,3 +1,7 @@
+if (!check_class(varset($pref['email_item_class'],e_UC_MEMBER)))
+{
+	return '';
+}
 if (defined("ICONMAIL") && file_exists(THEME."images/".ICONMAIL)) 
 {
 	$icon = THEME_ABS."images/".ICONMAIL;
diff -x .svn -aruN 0.7.16.src/e107_files/shortcode/news_categories.sc 0.7.17.src/e107_files/shortcode/news_categories.sc
--- 0.7.16.src/e107_files/shortcode/news_categories.sc	2009-06-06 12:02:57.000000000 -0500
+++ 0.7.17.src/e107_files/shortcode/news_categories.sc	2010-01-03 08:45:54.000000000 -0600
@@ -76,10 +76,10 @@
 		extract($row3);
 
 		$search[0] = "/\{NEWSCATICON\}(.*?)/si";
-		$replace[0] = ($category_icon) ? "<a href='".e_BASE."news.php?cat.".$category_id."'><img src='".e_IMAGE."icons/".$category_icon."' alt='' style='".$param['caticon']."' /></a>" : "";
+		$replace[0] = ($category_icon) ? "<a href='".e_HTTP."news.php?cat.".$category_id."'><img src='".e_IMAGE_ABS."icons/".$category_icon."' alt='' style='".$param['caticon']."' /></a>" : "";
 
 		$search[1] = "/\{NEWSCATEGORY\}(.*?)/si";
-		$replace[1] = ($category_name) ? "<a href='".e_BASE."news.php?cat.".$category_id."' style='".$param['catlink']."' >".$tp->toHTML($category_name,TRUE,"defs")."</a>" : "";
+		$replace[1] = ($category_name) ? "<a href='".e_HTTP."news.php?cat.".$category_id."' style='".$param['catlink']."' >".$tp->toHTML($category_name,TRUE,"defs")."</a>" : "";
 
 		$text3 .= ($t % $nbr_cols == 0) ? "<tr>" : "";
 		$text3 .= "\n<td style='".NEWSCAT_CELL."; width:$wid%;'>\n";
diff -x .svn -aruN 0.7.16.src/e107_files/shortcode/newsfile.sc 0.7.17.src/e107_files/shortcode/newsfile.sc
--- 0.7.16.src/e107_files/shortcode/newsfile.sc	2006-06-02 10:52:51.000000000 -0500
+++ 0.7.17.src/e107_files/shortcode/newsfile.sc	2010-01-03 08:45:54.000000000 -0600
@@ -1,5 +1,5 @@
 
 
-$image = (file_exists(THEME."images/download.png") ? THEME."images/download.png" : e_IMAGE."generic/".IMODE."/download.png");
-return "<img src='$image' alt='' style='vertical-align: middle;' /> <a href='".e_FILE."downloads/".$parm."'>".$parm."</a>";
+$image = (file_exists(THEME."images/download.png") ? THEME_ABS."images/download.png" : e_IMAGE_ABS."generic/".IMODE."/download.png");
+return "<img src='$image' alt='' style='vertical-align: middle;' /> <a href='".e_FILE_ABS."downloads/".$parm."'>".$parm."</a>";
 
diff -x .svn -aruN 0.7.16.src/e107_files/shortcode/newsimage.sc 0.7.17.src/e107_files/shortcode/newsimage.sc
--- 0.7.16.src/e107_files/shortcode/newsimage.sc	2005-03-11 02:50:40.000000000 -0600
+++ 0.7.17.src/e107_files/shortcode/newsimage.sc	2010-01-03 08:45:54.000000000 -0600
@@ -1,4 +1,4 @@
 
 
-return "<img src='".e_IMAGE."newspost_images/".$parm."' alt='' />";
+return "<img src='".e_IMAGE_ABS."newspost_images/".$parm."' alt='' />";
 
diff -x .svn -aruN 0.7.16.src/e107_files/shortcode/picture.sc 0.7.17.src/e107_files/shortcode/picture.sc
--- 0.7.16.src/e107_files/shortcode/picture.sc	2006-04-30 18:48:16.000000000 -0500
+++ 0.7.17.src/e107_files/shortcode/picture.sc	2010-01-03 08:45:54.000000000 -0600
@@ -25,7 +25,7 @@
 }
 if($image && file_exists(e_FILE."public/avatars/".$image))
 {
-	 return "<img src='".e_FILE."public/avatars/{$image}' alt='' />";
+	 return "<img src='".e_FILE_ABS."public/avatars/{$image}' alt='' />";
 }
 else
 {
diff -x .svn -aruN 0.7.16.src/e107_files/shortcode/profile.sc 0.7.17.src/e107_files/shortcode/profile.sc
--- 0.7.16.src/e107_files/shortcode/profile.sc	2005-03-24 10:30:20.000000000 -0600
+++ 0.7.17.src/e107_files/shortcode/profile.sc	2010-01-03 08:45:54.000000000 -0600
@@ -1,2 +1,2 @@
 $id = ($parm) ? $parm : USERID;
-return "<a href='".e_BASE."user.php?id.{$id}'>".IMAGE_profile."</a>";
+return "<a href='".e_HTTP."user.php?id.{$id}'>".IMAGE_profile."</a>";
diff -x .svn -aruN 0.7.16.src/e107_files/shortcode/user_extended.sc 0.7.17.src/e107_files/shortcode/user_extended.sc
--- 0.7.16.src/e107_files/shortcode/user_extended.sc	2008-10-05 15:40:18.000000000 -0500
+++ 0.7.17.src/e107_files/shortcode/user_extended.sc	2010-01-03 08:45:54.000000000 -0600
@@ -83,7 +83,7 @@
 	}
 	elseif(file_exists(e_IMAGE."user_icons/{$parms[0]}.png"))
 	{
-		return "<img src='".e_IMAGE."user_icons/{$parms[0]}.png' style='width:16px; height:16px' alt='' />";
+		return "<img src='".e_IMAGE_ABS."user_icons/{$parms[0]}.png' style='width:16px; height:16px' alt='' />";
 	}
 	return "";
 }
diff -x .svn -aruN 0.7.16.src/e107_handlers/admin_log_class.php 0.7.17.src/e107_handlers/admin_log_class.php
--- 0.7.16.src/e107_handlers/admin_log_class.php	2008-06-27 16:21:56.000000000 -0500
+++ 0.7.17.src/e107_handlers/admin_log_class.php	2009-10-28 09:23:16.000000000 -0500
@@ -4,7 +4,7 @@
 + ----------------------------------------------------------------------------+
 |     e107 website system
 |
-|     �Steve Dunstan 2001-2002
+|     ©Steve Dunstan 2001-2002
 |     http://e107.org
 |     jalist@e107.org
 |
@@ -12,9 +12,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_handlers/admin_log_class.php,v $
-|     $Revision: 1.11 $
-|     $Date: 2008/06/27 21:22:19 $
-|     $Author: e107steved $
+|     $Revision: 1.12 $
+|     $Date: 2009/10/28 14:23:40 $
+|     $Author: marj_nl_fr $
 +----------------------------------------------------------------------------+
 */
 
diff -x .svn -aruN 0.7.16.src/e107_handlers/comment_class.php 0.7.17.src/e107_handlers/comment_class.php
--- 0.7.16.src/e107_handlers/comment_class.php	2009-08-15 06:54:06.000000000 -0500
+++ 0.7.17.src/e107_handlers/comment_class.php	2009-11-01 14:20:58.000000000 -0600
@@ -12,9 +12,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_handlers/comment_class.php,v $
-|     $Revision: 1.81 $
-|     $Date: 2009/08/15 11:54:30 $
-|     $Author: marj_nl_fr $
+|     $Revision: 1.82 $
+|     $Date: 2009/11/01 20:21:22 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 
@@ -738,7 +738,7 @@
 				$ret['comment_author'] = (USERID ? "<a href='".e_HTTP."user.php?id.".$comment_author_id."'>".$comment_author_name."</a>" : $comment_author_name);
 
 				//comment text
-				$comment = strip_tags(preg_replace("/\[.*\]/", "", $row['comment_comment'])); // remove bbcode
+				$comment = strip_tags(preg_replace("/\[.*?\]/", "", $row['comment_comment'])); // remove bbcode - but leave text in between
 				$ret['comment_comment'] = $tp->toHTML($comment, FALSE, "", "", $pref['main_wordwrap']);
 
 				//subject
diff -x .svn -aruN 0.7.16.src/e107_handlers/e107_class.php 0.7.17.src/e107_handlers/e107_class.php
--- 0.7.16.src/e107_handlers/e107_class.php	2008-05-16 14:39:55.000000000 -0500
+++ 0.7.17.src/e107_handlers/e107_class.php	2009-10-28 09:00:18.000000000 -0500
@@ -3,21 +3,21 @@
 + ----------------------------------------------------------------------------+
 |     e107 website system
 |
-|     Steve Dunstan 2001-2002
+|     Copyright (C) 2001-2009 e107 Inc
 |     http://e107.org
-|     jalist@e107.org
+|
 |
 |     Released under the terms and conditions of the
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_handlers/e107_class.php,v $
-|     $Revision: 1.62 $
-|     $Date: 2008/05/16 19:40:18 $
-|     $Author: e107steved $
+|     $Revision: 1.63 $
+|     $Date: 2009/10/28 14:00:42 $
+|     $Author: marj_nl_fr $
 +----------------------------------------------------------------------------+
 */
 
-if (!defined('e107_INIT')) { exit; }
+if (!defined('e107_INIT')) { exit(); }
 
 /**
  * Core e107 class
diff -x .svn -aruN 0.7.16.src/e107_handlers/e_parse_class.php 0.7.17.src/e107_handlers/e_parse_class.php
--- 0.7.16.src/e107_handlers/e_parse_class.php	2009-09-03 14:26:16.000000000 -0500
+++ 0.7.17.src/e107_handlers/e_parse_class.php	2010-01-21 20:22:22.000000000 -0600
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_handlers/e_parse_class.php,v $
-|     $Revision: 1.220 $
-|     $Date: 2009/09/03 19:26:40 $
-|     $Author: e107steved $
+|     $Revision: 1.225 $
+|     $Date: 2010/01/22 02:22:46 $
+|     $Author: mcfly_e107 $
 +----------------------------------------------------------------------------+
 */
 if (!defined('e107_INIT')) { exit; }
@@ -26,8 +26,8 @@
 	var $e_pf;
 	var $e_emote;
 	var $e_hook;
-	var $search = array('&#39;', '&#039;', '&quot;', 'onerror', '&gt;', '&amp;#039;', '&amp;quot;', ' & ');
-	var $replace = array("'", "'", '"', 'one<i></i>rror', '>', "'", '"', ' &amp; ');
+	var $search = array('&amp;#039;', '&#039;', '&#39;', '&quot;', 'onerror', '&gt;', '&amp;quot;', ' & ');
+	var $replace = array("'", "'", "'", '"', 'one<i></i>rror', '>', '"', ' &amp; ');
 	var $e_highlighting;		// Set to TRUE or FALSE once it has been calculated
 	var $e_query;			// Highlight query
 
@@ -105,6 +105,8 @@
 						)
 		);
 
+	var $replaceVars = array();
+
 	function e_parse()
 	{
 		// Preprocess the supermods to be useful default arrays with all values
@@ -239,6 +241,26 @@
 		return $this->e_sc->parseCodes($text, $parseSCFiles, $extraCodes);
 		// End parse {XXX} codes
 	}
+	
+	function simpleParse(&$template, $vars=false, $replaceUnset=true)
+	{
+		if($vars==false)
+		{
+			$this->replaceVars = &$GLOBALS;
+		}
+		else
+		{
+			$this->replaceVars = &$vars;
+		}
+		$this->replaceUnset = $replaceUnset;
+		return preg_replace_callback("#\{([a-zA-Z0-9_]+)\}#", array($this, 'simpleReplace'), $template);
+	}
+	
+	function simpleReplace($tmp) {
+		$unset = ($this->replaceUnset ? '' : $tmp[0]);
+		return (isset($this->replaceVars[$tmp[1]]) ? $this->replaceVars[$tmp[1]] : $unset);
+//		return (isset($this->replaceVars[$tmp[1]]) && is_string($this->replaceVars[$tmp[1]]) ? $this->replaceVars[$tmp[1]] : '');
+	}
 
 
 
@@ -407,7 +429,7 @@
 										break;
 								}
 								if ($i == 0)
-								{	
+								{
 									// No 'special' break boundary character found - break at the word boundary
 									$pulled = substr($sp,0,$width);
 								}
@@ -441,7 +463,7 @@
 
 
 
-	function html_truncate ($text, $len = 200, $more = "[more]")
+	function html_truncate ($text, $len = 200, $more = ' ... ')
 	{
 		$pos = 0;
 		$curlen = 0;
@@ -509,7 +531,7 @@
 
 	// Truncate a string to a maximum length $len - append the string $more if it was truncated
 	// Uses current CHARSET - for utf-8, returns $len characters rather than $len bytes
-	function text_truncate($text, $len = 200, $more = "[more]") 
+	function text_truncate($text, $len = 200, $more = ' ... ')
 	{
 	  if (strlen($text) <= $len) return $text; 		// Always valid
 	  if (strtolower(CHARSET) !== 'utf-8')
@@ -824,7 +846,7 @@
 	function toAttribute($text) {
 		$text = str_replace("&amp;","&",$text); // URLs posted without HTML access may have an &amp; in them.
 		$text = htmlspecialchars($text, ENT_QUOTES, CHARSET); // Xhtml compliance.
-		if (!preg_match('/&#|\'|"|\(|\)|<|>/s', $text)) 
+		if (!preg_match('/&#|\'|"|\(|\)|<|>/s', $text))
 		{
 		  $text = $this->replaceConstants($text);
 		  return $text;
diff -x .svn -aruN 0.7.16.src/e107_handlers/mysql_class.php 0.7.17.src/e107_handlers/mysql_class.php
--- 0.7.16.src/e107_handlers/mysql_class.php	2009-07-17 09:19:36.000000000 -0500
+++ 0.7.17.src/e107_handlers/mysql_class.php	2009-12-15 16:20:49.000000000 -0600
@@ -12,9 +12,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_handlers/mysql_class.php,v $
-|     $Revision: 1.84 $
-|     $Date: 2009/07/17 14:20:00 $
-|     $Author: marj_nl_fr $
+|     $Revision: 1.85 $
+|     $Date: 2009/12/15 22:21:13 $
+|     $Author: e107steved $
 |
 +----------------------------------------------------------------------------+
 */
@@ -30,8 +30,8 @@
 * MySQL Abstraction class
 *
 * @package e107
-* @version $Revision: 1.84 $
-* @author $Author: marj_nl_fr $
+* @version $Revision: 1.85 $
+* @author $Author: e107steved $
 */
 class db {
 
@@ -612,30 +612,36 @@
 	* @desc Enter description here...
 	* @access private
 	*/
+	/* Function not used
 	function db_Fieldname($offset) {
 		$result = @mysql_field_name($this->mySQLresult, $offset);
 		return $result;
 	}
+	*/
 
 	/**
 	* @return unknown
 	* @desc Enter description here...
 	* @access private
 	*/
+	/* Function not used
 	function db_Field_info() {
 		$result = @mysql_fetch_field($this->mySQLresult);
 		return $result;
 	}
+	*/
 
 	/**
 	* @return unknown
 	* @desc Enter description here...
 	* @access private
 	*/
+	/*	Function not used
 	function db_Num_fields() {
 		$result = @mysql_num_fields($this->mySQLresult);
 		return $result;
 	}
+	*/
 
 	/**
 	* @return unknown
@@ -779,8 +785,67 @@
 		return ($error)? FALSE : TRUE;
 	}
 
-	// Determines if a plugin field (and key) exist. OR if fieldid is numeric - return the field name in that position.
-    function db_Field($table,$fieldid="",$key=""){
+
+
+
+
+	/**
+	 *	Return a list of the field names in a table.
+	 *
+	 *	@param string $table - table name (no prefix)
+	 *	@param string $prefix - table prefix to apply. If empty, MPREFIX is used.
+	 *	@param boolean $retinfo = FALSE - just returns array of field names. TRUE - returns all field info
+	 *	@return array|boolean - FALSE on error, field list array on success
+	 */
+	function db_FieldList($table, $prefix = '', $retinfo = FALSE)
+	{
+		if(!$this->mySQLdefaultdb)
+		{
+			global $mySQLdefaultdb;
+			$this->mySQLdefaultdb = $mySQLdefaultdb;
+		}
+
+		if(!$this->mySQLaccess)
+		{
+			global $db_ConnectionID;
+			$this->mySQLaccess = $db_ConnectionID;
+		}
+
+		if ($prefix == '') $prefix = MPREFIX;
+
+		if (FALSE === ($result = mysql_query('SHOW COLUMNS FROM '.$prefix.$table,$this->mySQLaccess)))
+		{
+			return FALSE;		// Error return
+		}
+		$ret = array();
+        if (mysql_num_rows($result) > 0)
+		{
+			while ($row = mysql_fetch_assoc($result))
+			{
+				if ($retinfo) 
+				{
+					$ret[$row['Field']] = $row['Field'];
+				}
+				else
+				{
+					$ret[] = $row['Field']; 
+				}
+			}
+		}
+		return $ret;
+	}
+
+
+	/**
+	 *	Determines if a plugin field (and key) exist. OR if fieldid is numeric - return the field name in that position.
+	 *
+	 *	@param string $table - table name (no prefix)
+	 *	@param string $fieldid - Numeric offset or field/key name
+	 *	@param string $key - PRIMARY|INDEX|UNIQUE - type of key when searching for key name
+	 *	@return string|boolean - FALSE on error, field name on success, TRUE if key exists
+	 */
+    function db_Field($table,$fieldid="",$key="")
+	{
 		if(!$this->mySQLdefaultdb){
 			global $mySQLdefaultdb;
 			$this->mySQLdefaultdb = $mySQLdefaultdb;
diff -x .svn -aruN 0.7.16.src/e107_handlers/notify_class.php 0.7.17.src/e107_handlers/notify_class.php
--- 0.7.16.src/e107_handlers/notify_class.php	2009-08-11 12:24:56.000000000 -0500
+++ 0.7.17.src/e107_handlers/notify_class.php	2009-11-19 14:30:31.000000000 -0600
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_handlers/notify_class.php,v $
-|     $Revision: 1.16 $
-|     $Date: 2009/08/11 17:25:20 $
-|     $Author: marj_nl_fr $
+|     $Revision: 1.17 $
+|     $Date: 2009/11/19 20:30:55 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 
@@ -131,14 +131,14 @@
 }
 
 function notify_newspost($data) {
-	global $nt;
-	$message = '<b>'.$data['news_title'].'</b><br /><br />'.$data['news_summary'].'<br /><br />'.$data['data'].'<br /><br />'.$data['news_extended'];
+	global $nt, $tp;
+	$message = $tp->toDB('<b>'.$data['news_title'].'</b><br /><br />'.$data['news_summary'].'<br /><br />'.$data['data'].'<br /><br />'.$data['news_extended']);
 	$nt -> send('newspost', $data['news_title'], $message);
 }
 
 function notify_newsupd($data) {
-	global $nt;
-	$message = '<b>'.$data['news_title'].'</b><br /><br />'.$data['news_summary'].'<br /><br />'.$data['data'].'<br /><br />'.$data['news_extended'];
+	global $nt, $tp;
+	$message = $tp->toDB('<b>'.$data['news_title'].'</b><br /><br />'.$data['news_summary'].'<br /><br />'.$data['data'].'<br /><br />'.$data['news_extended']);
 	$nt -> send('newsupd', NT_LAN_NU_1.': '.$data['news_title'], $message);
 }
 
diff -x .svn -aruN 0.7.16.src/e107_handlers/plugin_class.php 0.7.17.src/e107_handlers/plugin_class.php
--- 0.7.16.src/e107_handlers/plugin_class.php	2007-12-03 14:42:27.000000000 -0600
+++ 0.7.17.src/e107_handlers/plugin_class.php	2009-10-29 08:36:03.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_handlers/plugin_class.php,v $
-|     $Revision: 1.67 $
-|     $Date: 2007/12/03 20:42:50 $
-|     $Author: e107steved $
+|     $Revision: 1.68 $
+|     $Date: 2009/10/29 13:36:27 $
+|     $Author: marj_nl_fr $
 |
 +----------------------------------------------------------------------------+
 */
@@ -736,7 +736,16 @@
 		  if ($debug == 'check')
 		  {
 		    $file_text = file_get_contents(e_PLUGIN.$plugin_path."/".$e_xxx.".php");
-			if ((substr($file_text,0,5) != '<'.'?php') || (substr($file_text,-2,2) !='?>')) $passfail = '<b>fail</b>'; else $passfail = 'pass';
+					if ((substr($file_text, 0, 5) != '<'.'?php')
+							|| ( (substr($file_text, -2, 2) != '?'.'>') && (strrpos($file_text, '?'.'>') !== FALSE) )
+							)
+					{
+						$passfail = '<b>fail</b>';
+					}
+					else
+					{
+						$passfail = 'pass';
+					}
 			echo $plugin_path."/".$e_xxx.".php - ".$passfail."<br />";
 		  }
 		  $p_addons[] = $e_xxx;
@@ -791,13 +800,18 @@
 
 	function checkAddon($plugin_path,$e_xxx)
 	{ // Return 0 = OK, 1 = Fail, 2 = inaccessible
-	  if(is_readable(e_PLUGIN.$plugin_path."/".$e_xxx.".php"))
-	  {
-		$file_text = file_get_contents(e_PLUGIN.$plugin_path."/".$e_xxx.".php");
-		if ((substr($file_text,0,5) != '<'.'?php') || (substr($file_text,-2,2) !='?>')) return 1;
-		return 0;
+		if(is_readable(e_PLUGIN.$plugin_path."/".$e_xxx.".php"))
+		{
+			$file_text = file_get_contents(e_PLUGIN.$plugin_path."/".$e_xxx.".php");
+			if ((substr($file_text, 0, 5) != '<'.'?php')
+					|| ( (substr($file_text, -2, 2) != '?'.'>') && (strrpos($file_text, '?'.'>') !== FALSE) )
+					)
+			{
+				return 1;
+			}
+			return 0;
 		}
-	  return 2;
+		return 2;
 	}
 }
 
diff -x .svn -aruN 0.7.16.src/e107_handlers/resize_handler.php 0.7.17.src/e107_handlers/resize_handler.php
--- 0.7.16.src/e107_handlers/resize_handler.php	2009-04-23 15:23:25.000000000 -0500
+++ 0.7.17.src/e107_handlers/resize_handler.php	2009-09-19 15:45:55.000000000 -0500
@@ -11,8 +11,8 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_handlers/resize_handler.php,v $
-|     $Revision: 1.13 $
-|     $Date: 2009/04/23 20:23:49 $
+|     $Revision: 1.14 $
+|     $Date: 2009/09/19 20:46:19 $
 |     $Author: e107steved $
 |
 |
@@ -228,6 +228,7 @@
 			{
 				case 'png' :
 					if (!imagepng($dst_img, $destName, 6)) { $returnError = -1; }		// Fix the quality for now
+					$outputFunc = 'imagepng';
 					break;
 				case 'gif' :
 					if (!imagegif($dst_img, $destName)) { $returnError = -1; }
@@ -239,7 +240,8 @@
 					$outputFunc = 'imagejpeg';
 					break;
 				default :
-					$returnError = -7;			// Invalid output extensiot
+					$returnError = -7;			// Invalid output extension
+					$outputFunc = 'none';
 			}
 		}
 
@@ -247,7 +249,7 @@
 		if (!imagedestroy($dst_img)) { $returnError = -3; }
 		if ($returnError)
 		{
-			echo "Resizing error (2): {$returnError}<br />";
+			echo "Resizing error (2): {$returnError} - {$outputFunc} -> {$destName}<br />";
 			return FALSE;
 		}  
 		break;
diff -x .svn -aruN 0.7.16.src/e107_handlers/secure_img_render.php 0.7.17.src/e107_handlers/secure_img_render.php
--- 0.7.16.src/e107_handlers/secure_img_render.php	2007-11-13 07:48:07.000000000 -0600
+++ 0.7.17.src/e107_handlers/secure_img_render.php	2009-10-28 09:23:16.000000000 -0500
@@ -3,7 +3,7 @@
 + ----------------------------------------------------------------------------+
 |     e107 website system
 |
-|     �Steve Dunstan 2001-2002
+|     ©Steve Dunstan 2001-2002
 |     http://e107.org
 |     jalist@e107.org
 |
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_handlers/secure_img_render.php,v $
-|     $Revision: 1.19 $
-|     $Date: 2007/11/13 13:48:30 $
-|     $Author: mcfly_e107 $
+|     $Revision: 1.20 $
+|     $Date: 2009/10/28 14:23:40 $
+|     $Author: marj_nl_fr $
 +----------------------------------------------------------------------------+
 */
 
diff -x .svn -aruN 0.7.16.src/e107_handlers/sitelinks_class.php 0.7.17.src/e107_handlers/sitelinks_class.php
--- 0.7.16.src/e107_handlers/sitelinks_class.php	2009-08-15 06:54:06.000000000 -0500
+++ 0.7.17.src/e107_handlers/sitelinks_class.php	2010-01-02 15:43:27.000000000 -0600
@@ -12,9 +12,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_handlers/sitelinks_class.php,v $
-|     $Revision: 1.121 $
-|     $Date: 2009/08/15 11:54:30 $
-|     $Author: marj_nl_fr $
+|     $Revision: 1.123 $
+|     $Date: 2010/01/02 21:43:51 $
+|     $Author: e107steved $
 +---------------------------------------------------------------+
 */
 
@@ -97,7 +97,7 @@
     // 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] = ($style["sub".$key]) ? $style["sub".$key] : $style[$key];
+                $aSubStyle[$key] = (isset($style["sub".$key])) ? $style["sub".$key] : $style[$key];
             }
         }else{
                 $style['subindent'] = "&nbsp;&nbsp;";
@@ -306,7 +306,7 @@
     if (isset($pref['frontpage']['all']))
     {
       list($fp,$fp_q) = explode("?",$pref['frontpage']['all']."?");
-      if (strpos(e_SELF,"/".$pref['frontpage']['all'])!== FALSE && $fp_q == $tmp[1] && $link == e_HTTP."index.php")
+      if (strpos(e_SELF,"/".$pref['frontpage']['all'])!== FALSE && $fp_q == varset($tmp[1],'') && $link == e_HTTP."index.php")
       {
         return TRUE;
       }
diff -x .svn -aruN 0.7.16.src/e107_handlers/tiny_mce/plugins/contextmenu/editor_plugin_src.js 0.7.17.src/e107_handlers/tiny_mce/plugins/contextmenu/editor_plugin_src.js
--- 0.7.16.src/e107_handlers/tiny_mce/plugins/contextmenu/editor_plugin_src.js	2009-06-30 19:36:48.000000000 -0500
+++ 0.7.17.src/e107_handlers/tiny_mce/plugins/contextmenu/editor_plugin_src.js	2009-10-02 13:45:21.000000000 -0500
@@ -1,5 +1,5 @@
 /**
- * $Id: editor_plugin_src.js,v 1.10 2009/07/01 00:37:12 e107coders Exp $
+ * $Id: editor_plugin_src.js,v 1.12 2009/10/02 18:45:45 e107coders Exp $
  *
  * @author Moxiecode
  * @copyright Copyright  2004-2008, Moxiecode Systems AB, All rights reserved.
diff -x .svn -aruN 0.7.16.src/e107_handlers/tiny_mce/plugins/iespell/editor_plugin_src.js 0.7.17.src/e107_handlers/tiny_mce/plugins/iespell/editor_plugin_src.js
--- 0.7.16.src/e107_handlers/tiny_mce/plugins/iespell/editor_plugin_src.js	2009-06-30 19:36:48.000000000 -0500
+++ 0.7.17.src/e107_handlers/tiny_mce/plugins/iespell/editor_plugin_src.js	2009-10-02 13:45:22.000000000 -0500
@@ -1,5 +1,5 @@
 /**
- * $Id: editor_plugin_src.js,v 1.10 2009/07/01 00:37:12 e107coders Exp $
+ * $Id: editor_plugin_src.js,v 1.12 2009/10/02 18:45:46 e107coders Exp $
  *
  * @author Moxiecode
  * @copyright Copyright  2004-2008, Moxiecode Systems AB, All rights reserved.
diff -x .svn -aruN 0.7.16.src/e107_handlers/tiny_mce/plugins/media/editor_plugin.js 0.7.17.src/e107_handlers/tiny_mce/plugins/media/editor_plugin.js
--- 0.7.16.src/e107_handlers/tiny_mce/plugins/media/editor_plugin.js	2009-06-30 19:36:49.000000000 -0500
+++ 0.7.17.src/e107_handlers/tiny_mce/plugins/media/editor_plugin.js	2009-10-02 13:45:22.000000000 -0500
@@ -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.onResolveName){b.theme.onResolveName.add(function(h,i){if(i.name=="img"){a(g,function(l,j){if(b.dom.hasClass(i.node,j)){i.name=l;i.title=b.dom.getAttrib(i.node,"title");return false}})}})}if(b&&b.plugins.contextmenu){b.plugins.contextmenu.onContextMenu.add(function(i,h,j){if(j.nodeName=="IMG"&&/mceItem(Flash|ShockWave|WindowsMedia|QuickTime|RealMedia)/.test(j.className)){h.add({title:"media.edit",icon:"media",cmd:"mceMedia"})}})}});b.onBeforeSetContent.add(e._objectsToSpans,e);b.onSetContent.add(function(){e._spansToImgs(b.getBody())});b.onPreProcess.add(function(g,i){var h=g.dom;if(i.set){e._spansToImgs(i.node);a(h.select("IMG",i.node),function(k){var j;if(f(k)){j=e._parse(k.title);h.setAttrib(k,"width",h.getAttrib(k,"width",j.width||100));h.setAttrib(k,"height",h.getAttrib(k,"height",j.height||100))}})}if(i.get){a(h.select("IMG",i.node),function(m){var l,j,k;if(g.getParam("media_use_script")){if(f(m)){m.className=m.className.replace(/mceItem/g,"mceTemp")}return}switch(m.className){case"mceItemFlash":l="d27cdb6e-ae6d-11cf-96b8-444553540000";j="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0";k="application/x-shockwave-flash";break;case"mceItemShockWave":l="166b1bca-3f9c-11cf-8075-444553540000";j="http://download.macromedia.com/pub/shockwave/cabs/director/sw.cab#version=8,5,1,0";k="application/x-director";break;case"mceItemWindowsMedia":l=g.getParam("media_wmp6_compatible")?"05589fa1-c356-11ce-bf01-00aa0055595a":"6bf52a52-394a-11d3-b153-00c04f79faa6";j="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701";k="application/x-mplayer2";break;case"mceItemQuickTime":l="02bf25d5-8c17-4b23-bc80-d3488abddc6b";j="http://www.apple.com/qtactivex/qtplugin.cab#version=6,0,2,0";k="video/quicktime";break;case"mceItemRealMedia":l="cfcdaa03-8be4-11cf-b84b-0020afbbccfa";j="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0";k="audio/x-pn-realaudio-plugin";break}if(l){h.replace(e._buildObj({classid:l,codebase:j,type:k},m),m)}})}});b.onPostProcess.add(function(g,h){h.content=h.content.replace(/_mce_value=/g,"value=")});function d(g,h){h=new RegExp(h+'="([^"]+)"',"g").exec(g);return h?b.dom.decode(h[1]):""}b.onPostProcess.add(function(g,h){if(g.getParam("media_use_script")){h.content=h.content.replace(/<img[^>]+>/g,function(j){var i=d(j,"class");if(/^(mceTempFlash|mceTempShockWave|mceTempWindowsMedia|mceTempQuickTime|mceTempRealMedia)$/.test(i)){at=e._parse(d(j,"title"));at.width=d(j,"width");at.height=d(j,"height");j='<script type="text/javascript">write'+i.substring(7)+"({"+e._serialize(at)+"});<\/script>"}return j})}})},getInfo:function(){return{longname:"Media",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/media",version:tinymce.majorVersion+"."+tinymce.minorVersion}},_objectsToSpans:function(b,e){var c=this,d=e.content;d=d.replace(/<script[^>]*>\s*write(Flash|ShockWave|WindowsMedia|QuickTime|RealMedia)\(\{([^\)]*)\}\);\s*<\/script>/gi,function(g,f,i){var h=c._parse(i);return'<img class="mceItem'+f+'" title="'+b.dom.encode(i)+'" src="'+c.url+'/img/trans.gif" width="'+h.width+'" height="'+h.height+'" />'});d=d.replace(/<object([^>]*)>/gi,'<span class="mceItemObject" $1>');d=d.replace(/<embed([^>]*)\/?>/gi,'<span class="mceItemEmbed" $1></span>');d=d.replace(/<embed([^>]*)>/gi,'<span class="mceItemEmbed" $1>');d=d.replace(/<\/(object)([^>]*)>/gi,"</span>");d=d.replace(/<\/embed>/gi,"");d=d.replace(/<param([^>]*)>/gi,function(g,f){return"<span "+f.replace(/value=/gi,"_mce_value=")+' class="mceItemParam"></span>'});d=d.replace(/\/ class=\"mceItemParam\"><\/span>/gi,'class="mceItemParam"></span>');e.content=d},_buildObj:function(g,h){var d,c=this.editor,f=c.dom,e=this._parse(h.title),b;b=c.getParam("media_strict",true)&&g.type=="application/x-shockwave-flash";e.width=g.width=f.getAttrib(h,"width")||100;e.height=g.height=f.getAttrib(h,"height")||100;if(e.src){e.src=c.convertURL(e.src,"src",h)}if(b){d=f.create("span",{id:e.id,mce_name:"object",type:"application/x-shockwave-flash",data:e.src,style:f.getAttrib(h,"style"),width:g.width,height:g.height})}else{d=f.create("span",{id:e.id,mce_name:"object",classid:"clsid:"+g.classid,style:f.getAttrib(h,"style"),codebase:g.codebase,width:g.width,height:g.height})}a(e,function(j,i){if(!/^(width|height|codebase|classid|id|_cx|_cy)$/.test(i)){if(g.type=="application/x-mplayer2"&&i=="src"&&!e.url){i="url"}if(j){f.add(d,"span",{mce_name:"param",name:i,_mce_value:j})}}});if(!b){f.add(d,"span",tinymce.extend({mce_name:"embed",type:g.type,style:f.getAttrib(h,"style")},e))}return d},_spansToImgs:function(e){var d=this,f=d.editor.dom,b,c;a(f.select("span",e),function(g){if(f.getAttrib(g,"class")=="mceItemObject"){c=f.getAttrib(g,"classid").toLowerCase().replace(/\s+/g,"");switch(c){case"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000":f.replace(d._createImg("mceItemFlash",g),g);break;case"clsid:166b1bca-3f9c-11cf-8075-444553540000":f.replace(d._createImg("mceItemShockWave",g),g);break;case"clsid:6bf52a52-394a-11d3-b153-00c04f79faa6":case"clsid:22d6f312-b0f6-11d0-94ab-0080c74c7e95":case"clsid:05589fa1-c356-11ce-bf01-00aa0055595a":f.replace(d._createImg("mceItemWindowsMedia",g),g);break;case"clsid:02bf25d5-8c17-4b23-bc80-d3488abddc6b":f.replace(d._createImg("mceItemQuickTime",g),g);break;case"clsid:cfcdaa03-8be4-11cf-b84b-0020afbbccfa":f.replace(d._createImg("mceItemRealMedia",g),g);break;default:f.replace(d._createImg("mceItemFlash",g),g)}return}if(f.getAttrib(g,"class")=="mceItemEmbed"){switch(f.getAttrib(g,"type")){case"application/x-shockwave-flash":f.replace(d._createImg("mceItemFlash",g),g);break;case"application/x-director":f.replace(d._createImg("mceItemShockWave",g),g);break;case"application/x-mplayer2":f.replace(d._createImg("mceItemWindowsMedia",g),g);break;case"video/quicktime":f.replace(d._createImg("mceItemQuickTime",g),g);break;case"audio/x-pn-realaudio-plugin":f.replace(d._createImg("mceItemRealMedia",g),g);break;default:f.replace(d._createImg("mceItemFlash",g),g)}}})},_createImg:function(c,h){var b,g=this.editor.dom,f={},e="",d;d=["id","name","width","height","bgcolor","align","flashvars","src","wmode","allowfullscreen","quality"];b=g.create("img",{src:this.url+"/img/trans.gif",width:g.getAttrib(h,"width")||100,height:g.getAttrib(h,"height")||100,style:g.getAttrib(h,"style"),"class":c});a(d,function(i){var j=g.getAttrib(h,i);if(j){f[i]=j}});a(g.select("span",h),function(i){if(g.hasClass(i,"mceItemParam")){f[g.getAttrib(i,"name")]=g.getAttrib(i,"_mce_value")}});if(f.movie){f.src=f.movie;delete f.movie}h=g.select(".mceItemEmbed",h)[0];if(h){a(d,function(i){var j=g.getAttrib(h,i);if(j&&!f[i]){f[i]=j}})}delete f.width;delete f.height;b.title=this._serialize(f);return b},_parse:function(b){return tinymce.util.JSON.parse("{"+b+"}")},_serialize:function(b){return tinymce.util.JSON.serialize(b).replace(/[{}]/g,"")}});tinymce.PluginManager.add("media",tinymce.plugins.MediaPlugin)})();
\ No newline at end of file
+(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
diff -x .svn -aruN 0.7.16.src/e107_handlers/tiny_mce/plugins/media/editor_plugin_src.js 0.7.17.src/e107_handlers/tiny_mce/plugins/media/editor_plugin_src.js
--- 0.7.16.src/e107_handlers/tiny_mce/plugins/media/editor_plugin_src.js	2009-06-30 19:36:49.000000000 -0500
+++ 0.7.17.src/e107_handlers/tiny_mce/plugins/media/editor_plugin_src.js	2009-10-02 13:45:22.000000000 -0500
@@ -1,5 +1,5 @@
 /**
- * $Id: editor_plugin_src.js,v 1.2 2009/07/01 00:37:13 e107coders Exp $
+ * $Id: editor_plugin_src.js,v 1.4 2009/10/02 18:45:46 e107coders Exp $
  *
  * @author Moxiecode
  * @copyright Copyright  2004-2008, Moxiecode Systems AB, All rights reserved.
@@ -61,7 +61,7 @@
 				if (ed.settings.content_css !== false)
 					ed.dom.loadCSS(url + "/css/content.css");
 
-				if (ed.theme.onResolveName) {
+				if (ed.theme && ed.theme.onResolveName) {
 					ed.theme.onResolveName.add(function(th, o) {
 						if (o.name == 'img') {
 							each(lo, function(v, k) {
@@ -341,7 +341,7 @@
 		_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'];	
+			args = ['id', 'name', 'width', 'height', 'bgcolor', 'align', 'flashvars', 'src', 'wmode', 'allowfullscreen', 'quality', 'data'];	
 
 			// Create image
 			im = dom.create('img', {
@@ -372,6 +372,12 @@
 				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) {
diff -x .svn -aruN 0.7.16.src/e107_handlers/tiny_mce/plugins/table/editor_plugin.js 0.7.17.src/e107_handlers/tiny_mce/plugins/table/editor_plugin.js
--- 0.7.16.src/e107_handlers/tiny_mce/plugins/table/editor_plugin.js	2009-06-30 19:36:49.000000000 -0500
+++ 0.7.17.src/e107_handlers/tiny_mce/plugins/table/editor_plugin.js	2009-10-02 13:45:22.000000000 -0500
@@ -1 +1 @@
-(function(){var a=tinymce.each;tinymce.create("tinymce.plugins.TablePlugin",{init:function(b,c){var d=this;d.editor=b;d.url=c;a([["table","table.desc","mceInsertTable",true],["delete_table","table.del","mceTableDelete"],["delete_col","table.delete_col_desc","mceTableDeleteCol"],["delete_row","table.delete_row_desc","mceTableDeleteRow"],["col_after","table.col_after_desc","mceTableInsertColAfter"],["col_before","table.col_before_desc","mceTableInsertColBefore"],["row_after","table.row_after_desc","mceTableInsertRowAfter"],["row_before","table.row_before_desc","mceTableInsertRowBefore"],["row_props","table.row_desc","mceTableRowProps",true],["cell_props","table.cell_desc","mceTableCellProps",true],["split_cells","table.split_cells_desc","mceTableSplitCells",true],["merge_cells","table.merge_cells_desc","mceTableMergeCells",true]],function(e){b.addButton(e[0],{title:e[1],cmd:e[2],ui:e[3]})});if(b.getParam("inline_styles")){b.onPreProcess.add(function(e,g){var f=e.dom;a(f.select("table",g.node),function(i){var h;if(h=f.getAttrib(i,"width")){f.setStyle(i,"width",h);f.setAttrib(i,"width")}if(h=f.getAttrib(i,"height")){f.setStyle(i,"height",h);f.setAttrib(i,"height")}})})}b.onInit.add(function(){if(b&&b.plugins.contextmenu){b.plugins.contextmenu.onContextMenu.add(function(h,f,j){var k,i=b.selection,g=i.getNode()||b.getBody();if(b.dom.getParent(j,"td")||b.dom.getParent(j,"th")){f.removeAll();if(g.nodeName=="A"&&!b.dom.getAttrib(g,"name")){f.add({title:"advanced.link_desc",icon:"link",cmd:b.plugins.advlink?"mceAdvLink":"mceLink",ui:true});f.add({title:"advanced.unlink_desc",icon:"unlink",cmd:"UnLink"});f.addSeparator()}if(g.nodeName=="IMG"&&g.className.indexOf("mceItem")==-1){f.add({title:"advanced.image_desc",icon:"image",cmd:b.plugins.advimage?"mceAdvImage":"mceImage",ui:true});f.addSeparator()}f.add({title:"table.desc",icon:"table",cmd:"mceInsertTable",ui:true,value:{action:"insert"}});f.add({title:"table.props_desc",icon:"table_props",cmd:"mceInsertTable",ui:true});f.add({title:"table.del",icon:"delete_table",cmd:"mceTableDelete",ui:true});f.addSeparator();k=f.addMenu({title:"table.cell"});k.add({title:"table.cell_desc",icon:"cell_props",cmd:"mceTableCellProps",ui:true});k.add({title:"table.split_cells_desc",icon:"split_cells",cmd:"mceTableSplitCells",ui:true});k.add({title:"table.merge_cells_desc",icon:"merge_cells",cmd:"mceTableMergeCells",ui:true});k=f.addMenu({title:"table.row"});k.add({title:"table.row_desc",icon:"row_props",cmd:"mceTableRowProps",ui:true});k.add({title:"table.row_before_desc",icon:"row_before",cmd:"mceTableInsertRowBefore"});k.add({title:"table.row_after_desc",icon:"row_after",cmd:"mceTableInsertRowAfter"});k.add({title:"table.delete_row_desc",icon:"delete_row",cmd:"mceTableDeleteRow"});k.addSeparator();k.add({title:"table.cut_row_desc",icon:"cut",cmd:"mceTableCutRow"});k.add({title:"table.copy_row_desc",icon:"copy",cmd:"mceTableCopyRow"});k.add({title:"table.paste_row_before_desc",icon:"paste",cmd:"mceTablePasteRowBefore"});k.add({title:"table.paste_row_after_desc",icon:"paste",cmd:"mceTablePasteRowAfter"});k=f.addMenu({title:"table.col"});k.add({title:"table.col_before_desc",icon:"col_before",cmd:"mceTableInsertColBefore"});k.add({title:"table.col_after_desc",icon:"col_after",cmd:"mceTableInsertColAfter"});k.add({title:"table.delete_col_desc",icon:"delete_col",cmd:"mceTableDeleteCol"})}else{f.add({title:"table.desc",icon:"table",cmd:"mceInsertTable",ui:true})}})}});b.onKeyDown.add(function(f,g){if(g.keyCode==9&&f.dom.getParent(f.selection.getNode(),"TABLE")){if(!tinymce.isGecko&&!tinymce.isOpera){tinyMCE.execInstanceCommand(f.editorId,"mceTableMoveToNextRow",true);return tinymce.dom.Event.cancel(g)}f.undoManager.add()}});if(!tinymce.isIE){if(b.getParam("table_selection",true)){b.onClick.add(function(f,g){g=g.target;if(g.nodeName==="TABLE"){f.selection.select(g)}})}}b.onNodeChange.add(function(f,e,h){var g=f.dom.getParent(h,"td,th,caption");e.setActive("table",h.nodeName==="TABLE"||!!g);if(g&&g.nodeName==="CAPTION"){g=null}e.setDisabled("delete_table",!g);e.setDisabled("delete_col",!g);e.setDisabled("delete_table",!g);e.setDisabled("delete_row",!g);e.setDisabled("col_after",!g);e.setDisabled("col_before",!g);e.setDisabled("row_after",!g);e.setDisabled("row_before",!g);e.setDisabled("row_props",!g);e.setDisabled("cell_props",!g);e.setDisabled("split_cells",!g||(parseInt(f.dom.getAttrib(g,"colspan","1"))<2&&parseInt(f.dom.getAttrib(g,"rowspan","1"))<2));e.setDisabled("merge_cells",!g)});if(!tinymce.isIE){b.onBeforeSetContent.add(function(e,f){if(f.initial){f.content=f.content.replace(/<(td|th)([^>]+|)>\s*<\/(td|th)>/g,tinymce.isOpera?"<$1$2>&nbsp;</$1>":'<$1$2><br mce_bogus="1" /></$1>')}})}},execCommand:function(f,e,g){var d=this.editor,c;switch(f){case"mceTableMoveToNextRow":case"mceInsertTable":case"mceTableRowProps":case"mceTableCellProps":case"mceTableSplitCells":case"mceTableMergeCells":case"mceTableInsertRowBefore":case"mceTableInsertRowAfter":case"mceTableDeleteRow":case"mceTableInsertColBefore":case"mceTableInsertColAfter":case"mceTableDeleteCol":case"mceTableCutRow":case"mceTableCopyRow":case"mceTablePasteRowBefore":case"mceTablePasteRowAfter":case"mceTableDelete":d.execCommand("mceBeginUndoLevel");this._doExecCommand(f,e,g);d.execCommand("mceEndUndoLevel");return true}return false},getInfo:function(){return{longname:"Tables",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/table",version:tinymce.majorVersion+"."+tinymce.minorVersion}},_doExecCommand:function(r,Z,ae){var V=this.editor,au=V,g=this.url;var n=V.selection.getNode();var W=V.dom.getParent(n,"tr");var aq=V.dom.getParent(n,"td,th");var F=V.dom.getParent(n,"table");var k=V.contentWindow.document;var av=F?F.getAttribute("border"):"";if(W&&aq==null){aq=W.cells[0]}function ap(y,x){for(var ax=0;ax<y.length;ax++){if(y[ax].length>0&&ap(y[ax],x)){return true}if(y[ax]==x){return true}}return false}function aj(x,i){var y;ad=e(F);x=x||0;i=i||0;x=Math.max(o.cellindex+x,0);i=Math.max(o.rowindex+i,0);V.execCommand("mceRepaint");y=d(ad,i,x);if(y){V.selection.select(y.firstChild||y);V.selection.collapse(1)}}function ah(){var i=k.createElement("td");if(!tinymce.isIE){i.innerHTML='<br mce_bogus="1"/>'}}function j(y){var x=V.dom.getAttrib(y,"colspan");var i=V.dom.getAttrib(y,"rowspan");x=x==""?1:parseInt(x);i=i==""?1:parseInt(i);return{colspan:x,rowspan:i}}function al(ax,az){var i,ay;for(ay=0;ay<ax.length;ay++){for(i=0;i<ax[ay].length;i++){if(ax[ay][i]==az){return{cellindex:i,rowindex:ay}}}}return null}function d(x,y,i){if(x[y]&&x[y][i]){return x[y][i]}return null}function A(aC,ax){var az=[],y=0,aA,ay,ax,aB;for(aA=0;aA<aC.rows.length;aA++){for(ay=0;ay<aC.rows[aA].cells.length;ay++,y++){az[y]=aC.rows[aA].cells[ay]}}for(aA=0;aA<az.length;aA++){if(az[aA]==ax){if(aB=az[aA+1]){return aB}}}}function e(aE){var i=[],aF=aE.rows,aC,aB,ay,az,aD,ax,aA;for(aB=0;aB<aF.length;aB++){for(aC=0;aC<aF[aB].cells.length;aC++){ay=aF[aB].cells[aC];az=j(ay);for(aD=aC;i[aB]&&i[aB][aD];aD++){}for(aA=aB;aA<aB+az.rowspan;aA++){if(!i[aA]){i[aA]=[]}for(ax=aD;ax<aD+az.colspan;ax++){i[aA][ax]=ay}}}}return i}function m(aG,aD,ay,ax){var y=e(aG),aF=al(y,ay);var aH,aC;if(ax.cells.length!=aD.childNodes.length){aH=aD.childNodes;aC=null;for(var aE=0;ay=d(y,aF.rowindex,aE);aE++){var aA=true;var aB=j(ay);if(ap(aH,ay)){ax.childNodes[aE]._delete=true}else{if((aC==null||ay!=aC)&&aB.colspan>1){for(var az=aE;az<aE+ay.colSpan;az++){ax.childNodes[az]._delete=true}}}if((aC==null||ay!=aC)&&aB.rowspan>1){ay.rowSpan=aB.rowspan+1}aC=ay}B(F)}}function O(x,i){while((x=x.previousSibling)!=null){if(x.nodeName==i){return x}}return null}function af(ax,ay){var x=ay.split(",");while((ax=ax.nextSibling)!=null){for(var y=0;y<x.length;y++){if(ax.nodeName.toLowerCase()==x[y].toLowerCase()){return ax}}}return null}function B(ax){if(ax.rows==0){return}var y=ax.rows[0];do{var x=af(y,"TR");if(y._delete){y.parentNode.removeChild(y);continue}var ay=y.cells[0];if(ay.cells>1){do{var i=af(ay,"TD,TH");if(ay._delete){ay.parentNode.removeChild(ay)}}while((ay=i)!=null)}}while((y=x)!=null)}function p(ax,aA,az){ax.rowSpan=1;var x=af(aA,"TR");for(var ay=1;ay<az&&x;ay++){var y=k.createElement("td");if(!tinymce.isIE){y.innerHTML='<br mce_bogus="1"/>'}if(tinymce.isIE){x.insertBefore(y,x.cells(ax.cellIndex))}else{x.insertBefore(y,x.cells[ax.cellIndex])}x=af(x,"TR")}}function S(aF,aH,aB){var y=e(aH);var ax=aB.cloneNode(false);var aG=al(y,aB.cells[0]);var aC=null;var aA=V.dom.getAttrib(aH,"border");var az=null;for(var aE=0;az=d(y,aG.rowindex,aE);aE++){var aD=null;if(aC!=az){for(var ay=0;ay<aB.cells.length;ay++){if(az==aB.cells[ay]){aD=az.cloneNode(true);break}}}if(aD==null){aD=aF.createElement("td");if(!tinymce.isIE){aD.innerHTML='<br mce_bogus="1"/>'}}aD.colSpan=1;aD.rowSpan=1;ax.appendChild(aD);aC=az}return ax}switch(r){case"mceTableMoveToNextRow":var L=A(F,aq);if(!L){V.execCommand("mceTableInsertRowAfter",aq);L=A(F,aq)}V.selection.select(L);V.selection.collapse(true);return true;case"mceTableRowProps":if(W==null){return true}if(Z){V.windowManager.open({url:g+"/row.htm",width:400+parseInt(V.getLang("table.rowprops_delta_width",0)),height:295+parseInt(V.getLang("table.rowprops_delta_height",0)),inline:1},{plugin_url:g})}return true;case"mceTableCellProps":if(aq==null){return true}if(Z){V.windowManager.open({url:g+"/cell.htm",width:400+parseInt(V.getLang("table.cellprops_delta_width",0)),height:295+parseInt(V.getLang("table.cellprops_delta_height",0)),inline:1},{plugin_url:g})}return true;case"mceInsertTable":if(Z){V.windowManager.open({url:g+"/table.htm",width:400+parseInt(V.getLang("table.table_delta_width",0)),height:320+parseInt(V.getLang("table.table_delta_height",0)),inline:1},{plugin_url:g,action:ae?ae.action:0})}return true;case"mceTableDelete":var G=V.dom.getParent(V.selection.getNode(),"table");if(G){G.parentNode.removeChild(G);V.execCommand("mceRepaint")}return true;case"mceTableSplitCells":case"mceTableMergeCells":case"mceTableInsertRowBefore":case"mceTableInsertRowAfter":case"mceTableDeleteRow":case"mceTableInsertColBefore":case"mceTableInsertColAfter":case"mceTableDeleteCol":case"mceTableCutRow":case"mceTableCopyRow":case"mceTablePasteRowBefore":case"mceTablePasteRowAfter":if(!F){return true}if(W&&F!=W.parentNode){F=W.parentNode}if(F&&W){switch(r){case"mceTableCutRow":if(!W||!aq){return true}V.tableRowClipboard=S(k,F,W);V.execCommand("mceTableDeleteRow");break;case"mceTableCopyRow":if(!W||!aq){return true}V.tableRowClipboard=S(k,F,W);break;case"mceTablePasteRowBefore":if(!W||!aq){return true}var v=V.tableRowClipboard.cloneNode(true);var h=O(W,"TR");if(h!=null){m(F,h,h.cells[0],v)}W.parentNode.insertBefore(v,W);break;case"mceTablePasteRowAfter":if(!W||!aq){return true}var X=af(W,"TR");var v=V.tableRowClipboard.cloneNode(true);m(F,W,aq,v);if(X==null){W.parentNode.appendChild(v)}else{X.parentNode.insertBefore(v,X)}break;case"mceTableInsertRowBefore":if(!W||!aq){return true}var ad=e(F);var o=al(ad,aq);var v=k.createElement("tr");var u=null;o.rowindex--;if(o.rowindex<0){o.rowindex=0}for(var ac=0;aq=d(ad,o.rowindex,ac);ac++){if(aq!=u){var E=j(aq);if(E.rowspan==1){var J=k.createElement("td");if(!tinymce.isIE){J.innerHTML='<br mce_bogus="1"/>'}J.colSpan=aq.colSpan;v.appendChild(J)}else{aq.rowSpan=E.rowspan+1}u=aq}}W.parentNode.insertBefore(v,W);aj(0,1);break;case"mceTableInsertRowAfter":if(!W||!aq){return true}var ad=e(F);var o=al(ad,aq);var v=k.createElement("tr");var u=null;for(var ac=0;aq=d(ad,o.rowindex,ac);ac++){if(aq!=u){var E=j(aq);if(E.rowspan==1){var J=k.createElement("td");if(!tinymce.isIE){J.innerHTML='<br mce_bogus="1"/>'}J.colSpan=aq.colSpan;v.appendChild(J)}else{aq.rowSpan=E.rowspan+1}u=aq}}if(v.hasChildNodes()){var X=af(W,"TR");if(X){X.parentNode.insertBefore(v,X)}else{F.appendChild(v)}}aj(0,1);break;case"mceTableDeleteRow":if(!W||!aq){return true}var ad=e(F);var o=al(ad,aq);if(ad.length==1&&F.nodeName=="TBODY"){V.dom.remove(V.dom.getParent(F,"table"));return true}var D=W.cells;var X=af(W,"TR");for(var ac=0;ac<D.length;ac++){if(D[ac].rowSpan>1){var J=D[ac].cloneNode(true);var E=j(D[ac]);J.rowSpan=E.rowspan-1;var ak=X.cells[ac];if(ak==null){X.appendChild(J)}else{X.insertBefore(J,ak)}}}var u=null;for(var ac=0;aq=d(ad,o.rowindex,ac);ac++){if(aq!=u){var E=j(aq);if(E.rowspan>1){aq.rowSpan=E.rowspan-1}else{W=aq.parentNode;if(W.parentNode){W._delete=true}}u=aq}}B(F);aj(0,-1);break;case"mceTableInsertColBefore":if(!W||!aq){return true}var ad=e(V.dom.getParent(F,"table"));var o=al(ad,aq);var u=null;for(var aa=0;aq=d(ad,aa,o.cellindex);aa++){if(aq!=u){var E=j(aq);if(E.colspan==1){var J=k.createElement(aq.nodeName);if(!tinymce.isIE){J.innerHTML='<br mce_bogus="1"/>'}J.rowSpan=aq.rowSpan;aq.parentNode.insertBefore(J,aq)}else{aq.colSpan++}u=aq}}aj();break;case"mceTableInsertColAfter":if(!W||!aq){return true}var ad=e(V.dom.getParent(F,"table"));var o=al(ad,aq);var u=null;for(var aa=0;aq=d(ad,aa,o.cellindex);aa++){if(aq!=u){var E=j(aq);if(E.colspan==1){var J=k.createElement(aq.nodeName);if(!tinymce.isIE){J.innerHTML='<br mce_bogus="1"/>'}J.rowSpan=aq.rowSpan;var ak=af(aq,"TD,TH");if(ak==null){aq.parentNode.appendChild(J)}else{ak.parentNode.insertBefore(J,ak)}}else{aq.colSpan++}u=aq}}aj(1);break;case"mceTableDeleteCol":if(!W||!aq){return true}var ad=e(F);var o=al(ad,aq);var u=null;if((ad.length>1&&ad[0].length<=1)&&F.nodeName=="TBODY"){V.dom.remove(V.dom.getParent(F,"table"));return true}for(var aa=0;aq=d(ad,aa,o.cellindex);aa++){if(aq!=u){var E=j(aq);if(E.colspan>1){aq.colSpan=E.colspan-1}else{if(aq.parentNode){aq.parentNode.removeChild(aq)}}u=aq}}aj(-1);break;case"mceTableSplitCells":if(!W||!aq){return true}var l=j(aq);var C=l.colspan;var H=l.rowspan;if(C>1||H>1){aq.colSpan=1;for(var am=1;am<C;am++){var J=k.createElement("td");if(!tinymce.isIE){J.innerHTML='<br mce_bogus="1"/>'}W.insertBefore(J,af(aq,"TD,TH"));if(H>1){p(J,W,H)}}p(aq,W,H)}F=V.dom.getParent(V.selection.getNode(),"table");break;case"mceTableMergeCells":var ao=[];var R=V.selection.getSel();var ad=e(F);if(tinymce.isIE||R.rangeCount==1){if(Z){var t=j(aq);V.windowManager.open({url:g+"/merge_cells.htm",width:240+parseInt(V.getLang("table.merge_cells_delta_width",0)),height:110+parseInt(V.getLang("table.merge_cells_delta_height",0)),inline:1},{action:"update",numcols:t.colspan,numrows:t.rowspan,plugin_url:g});return true}else{var U=parseInt(ae.numrows);var c=parseInt(ae.numcols);var o=al(ad,aq);if((""+U)=="NaN"){U=1}if((""+c)=="NaN"){c=1}var b=F.rows;for(var aa=o.rowindex;aa<ad.length;aa++){var ag=[];for(var ac=o.cellindex;ac<ad[aa].length;ac++){var f=d(ad,aa,ac);if(f&&!ap(ao,f)&&!ap(ag,f)){var N=al(ad,f);if(N.cellindex<o.cellindex+c&&N.rowindex<o.rowindex+U){ag[ag.length]=f}}}if(ag.length>0){ao[ao.length]=ag}var f=d(ad,o.rowindex,o.cellindex);a(au.dom.select("br",f),function(y,x){if(x>0&&au.dom.getAttrib("mce_bogus")){au.dom.remove(y)}})}}}else{var D=[];var R=V.selection.getSel();var Y=null;var an=null;var z=-1,aw=-1,w,at;if(R.rangeCount<2){return true}for(var am=0;am<R.rangeCount;am++){var ai=R.getRangeAt(am);var aq=ai.startContainer.childNodes[ai.startOffset];if(!aq){break}if(aq.nodeName=="TD"||aq.nodeName=="TH"){D[D.length]=aq}}var b=F.rows;for(var aa=0;aa<b.length;aa++){var ag=[];for(var ac=0;ac<b[aa].cells.length;ac++){var f=b[aa].cells[ac];for(var am=0;am<D.length;am++){if(f==D[am]){ag[ag.length]=f}}}if(ag.length>0){ao[ao.length]=ag}}var an=[];var Y=null;for(var aa=0;aa<ad.length;aa++){for(var ac=0;ac<ad[aa].length;ac++){ad[aa][ac]._selected=false;for(var am=0;am<D.length;am++){if(ad[aa][ac]==D[am]){if(z==-1){z=ac;aw=aa}w=ac;at=aa;ad[aa][ac]._selected=true}}}}for(var aa=aw;aa<=at;aa++){for(var ac=z;ac<=w;ac++){if(!ad[aa][ac]._selected){alert("Invalid selection for merge.");return true}}}}var s=1,q=1;var T=-1;for(var aa=0;aa<ao.length;aa++){var I=0;for(var ac=0;ac<ao[aa].length;ac++){var E=j(ao[aa][ac]);I+=E.colspan;if(T!=-1&&E.rowspan!=T){alert("Invalid selection for merge.");return true}T=E.rowspan}if(I>q){q=I}T=-1}var Q=-1;for(var ac=0;ac<ao[0].length;ac++){var M=0;for(var aa=0;aa<ao.length;aa++){var E=j(ao[aa][ac]);M+=E.rowspan;if(Q!=-1&&E.colspan!=Q){alert("Invalid selection for merge.");return true}Q=E.colspan}if(M>s){s=M}Q=-1}aq=ao[0][0];aq.rowSpan=s;aq.colSpan=q;for(var aa=0;aa<ao.length;aa++){for(var ac=0;ac<ao[aa].length;ac++){var P=ao[aa][ac].innerHTML;var K=P.replace(/[ \t\r\n]/g,"");if(K!="<br/>"&&K!="<br>"&&K!='<br mce_bogus="1"/>'&&(ac+aa>0)){aq.innerHTML+=P}if(ao[aa][ac]!=aq&&!ao[aa][ac]._deleted){var o=al(ad,ao[aa][ac]);var ar=ao[aa][ac].parentNode;ar.removeChild(ao[aa][ac]);ao[aa][ac]._deleted=true;if(!ar.hasChildNodes()){ar.parentNode.removeChild(ar);var ab=null;for(var ac=0;cellElm=d(ad,o.rowindex,ac);ac++){if(cellElm!=ab&&cellElm.rowSpan>1){cellElm.rowSpan--}ab=cellElm}if(aq.rowSpan>1){aq.rowSpan--}}}}}a(au.dom.select("br",aq),function(y,x){if(x>0&&au.dom.getAttrib(y,"mce_bogus")){au.dom.remove(y)}});break}F=V.dom.getParent(V.selection.getNode(),"table");V.addVisual(F);V.nodeChanged()}return true}return false}});tinymce.PluginManager.add("table",tinymce.plugins.TablePlugin)})();
\ No newline at end of file
+(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
diff -x .svn -aruN 0.7.16.src/e107_handlers/tiny_mce/plugins/table/editor_plugin_src.js 0.7.17.src/e107_handlers/tiny_mce/plugins/table/editor_plugin_src.js
--- 0.7.16.src/e107_handlers/tiny_mce/plugins/table/editor_plugin_src.js	2009-06-30 19:36:49.000000000 -0500
+++ 0.7.17.src/e107_handlers/tiny_mce/plugins/table/editor_plugin_src.js	2009-10-02 13:45:22.000000000 -0500
@@ -1,5 +1,5 @@
 /**
- * $Id: editor_plugin_src.js,v 1.12 2009/07/01 00:37:13 e107coders Exp $
+ * $Id: editor_plugin_src.js,v 1.14 2009/10/02 18:45:46 e107coders Exp $
  *
  * @author Moxiecode
  * @copyright Copyright  2004-2008, Moxiecode Systems AB, All rights reserved.
@@ -8,6 +8,20 @@
 (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;
@@ -55,6 +69,58 @@
 			}
 
 			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();
diff -x .svn -aruN 0.7.16.src/e107_handlers/tiny_mce/plugins/table/js/table.js 0.7.17.src/e107_handlers/tiny_mce/plugins/table/js/table.js
--- 0.7.16.src/e107_handlers/tiny_mce/plugins/table/js/table.js	2009-07-08 05:04:39.000000000 -0500
+++ 0.7.17.src/e107_handlers/tiny_mce/plugins/table/js/table.js	2009-09-20 21:33:03.000000000 -0500
@@ -24,14 +24,14 @@
 	border = formObj.elements['border'].value != "" ? formObj.elements['border'].value  : 0;
 	cellpadding = formObj.elements['cellpadding'].value != "" ? formObj.elements['cellpadding'].value : "";
 	cellspacing = formObj.elements['cellspacing'].value != "" ? formObj.elements['cellspacing'].value : "";
-	align = formObj.elements['align'].options[formObj.elements['align'].selectedIndex].value;
-	frame = formObj.elements['tframe'].options[formObj.elements['tframe'].selectedIndex].value;
-	rules = formObj.elements['rules'].options[formObj.elements['rules'].selectedIndex].value;
+	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 = formObj.elements['class'].options[formObj.elements['class'].selectedIndex].value;
+	className = getSelectValue(formObj, "class");
 	id = formObj.elements['id'].value;
 	summary = formObj.elements['summary'].value;
 	style = formObj.elements['style'].value;
diff -x .svn -aruN 0.7.16.src/e107_handlers/tiny_mce/themes/advanced/color_picker.htm 0.7.17.src/e107_handlers/tiny_mce/themes/advanced/color_picker.htm
--- 0.7.16.src/e107_handlers/tiny_mce/themes/advanced/color_picker.htm	2009-06-30 19:36:49.000000000 -0500
+++ 0.7.17.src/e107_handlers/tiny_mce/themes/advanced/color_picker.htm	2009-09-20 21:33:13.000000000 -0500
@@ -21,7 +21,7 @@
 			<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=" " />
+					<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 -->
diff -x .svn -aruN 0.7.16.src/e107_handlers/tiny_mce/themes/advanced/editor_template_src.js 0.7.17.src/e107_handlers/tiny_mce/themes/advanced/editor_template_src.js
--- 0.7.16.src/e107_handlers/tiny_mce/themes/advanced/editor_template_src.js	2009-06-30 19:36:50.000000000 -0500
+++ 0.7.17.src/e107_handlers/tiny_mce/themes/advanced/editor_template_src.js	2009-10-02 13:45:48.000000000 -0500
@@ -1,5 +1,5 @@
 /**
- * $Id: editor_template_src.js,v 1.14 2009/07/01 00:37:14 e107coders Exp $
+ * $Id: editor_template_src.js,v 1.16 2009/10/02 18:46:12 e107coders Exp $
  *
  * @author Moxiecode
  * @copyright Copyright  2004-2008, Moxiecode Systems AB, All rights reserved.
diff -x .svn -aruN 0.7.16.src/e107_handlers/tiny_mce/themes/advanced/js/link.js 0.7.17.src/e107_handlers/tiny_mce/themes/advanced/js/link.js
--- 0.7.16.src/e107_handlers/tiny_mce/themes/advanced/js/link.js	2009-07-06 15:33:57.000000000 -0500
+++ 0.7.17.src/e107_handlers/tiny_mce/themes/advanced/js/link.js	2009-09-20 21:33:14.000000000 -0500
@@ -63,8 +63,8 @@
 					ed.dom.setAttribs(e, {
 						href : f.href.value,
 						title : f.linktitle.value,
-						target : f.target_list ? f.target_list.options[f.target_list.selectedIndex].value : null,
-						'class' : f.class_list ? f.class_list.options[f.class_list.selectedIndex].value : null
+						target : f.target_list ? getSelectValue(f, "target_list") : null,
+						'class' : f.class_list ? getSelectValue(f, "class_list") : null
 					});
 				}
 			});
@@ -72,8 +72,8 @@
 			ed.dom.setAttribs(e, {
 				href : f.href.value,
 				title : f.linktitle.value,
-				target : f.target_list ? f.target_list.options[f.target_list.selectedIndex].value : null,
-				'class' : f.class_list ? f.class_list.options[f.class_list.selectedIndex].value : null
+				target : f.target_list ? getSelectValue(f, "target_list") : null,
+				'class' : f.class_list ? getSelectValue(f, "class_list") : null
 			});
 		}
 
diff -x .svn -aruN 0.7.16.src/e107_handlers/tiny_mce/tiny_mce_gzip.js 0.7.17.src/e107_handlers/tiny_mce/tiny_mce_gzip.js
--- 0.7.16.src/e107_handlers/tiny_mce/tiny_mce_gzip.js	1969-12-31 18:00:00.000000000 -0600
+++ 0.7.17.src/e107_handlers/tiny_mce/tiny_mce_gzip.js	2009-09-20 21:32:35.000000000 -0500
@@ -0,0 +1,134 @@
+var tinyMCE_GZ = {
+	settings : {
+		themes : '',
+		plugins : '',
+		languages : '',
+		disk_cache : true,
+		page_name : 'tiny_mce_gzip.php',
+		debug : false,
+		suffix : ''
+	},
+
+	init : function(s, cb, sc) {
+		var t = this, n, i, nl = document.getElementsByTagName('script');
+
+		for (n in s)
+			t.settings[n] = s[n];
+
+		s = t.settings;
+
+		for (i=0; i<nl.length; i++) {
+			n = nl[i];
+
+			if (n.src && n.src.indexOf('tiny_mce') != -1)
+				t.baseURL = n.src.substring(0, n.src.lastIndexOf('/'));
+		}
+
+		if (!t.coreLoaded)
+			t.loadScripts(1, s.themes, s.plugins, s.languages, cb, sc);
+	},
+
+	loadScripts : function(co, th, pl, la, cb, sc) {
+		var t = this, x, w = window, q, c = 0, ti, s = t.settings;
+
+		function get(s) {
+			x = 0;
+
+			try {
+				x = new ActiveXObject(s);
+			} catch (s) {
+			}
+
+			return x;
+		};
+
+		// Build query string
+		q = 'js=true&diskcache=' + (s.disk_cache ? 'true' : 'false') + '&core=' + (co ? 'true' : 'false') + '&suffix=' + escape(s.suffix) + '&themes=' + escape(th) + '&plugins=' + escape(pl) + '&languages=' + escape(la);
+
+		if (co)
+			t.coreLoaded = 1;
+
+		// Send request
+		x = w.XMLHttpRequest ? new XMLHttpRequest() : get('Msxml2.XMLHTTP') || get('Microsoft.XMLHTTP');
+		x.overrideMimeType && x.overrideMimeType('text/javascript');
+		x.open('GET', t.baseURL + '/' + s.page_name + '?' + q, !!cb);
+//		x.setRequestHeader('Content-Type', 'text/javascript');
+		x.send('');
+
+		// Handle asyncronous loading
+		if (cb) {
+			// Wait for response
+			ti = w.setInterval(function() {
+				if (x.readyState == 4 || c++ > 10000) {
+					w.clearInterval(ti);
+
+					if (c < 10000 && x.status == 200) {
+						t.loaded = 1;
+						t.eval(x.responseText);
+						tinymce.dom.Event.domLoaded = true;
+						cb.call(sc || t, x);
+					}
+
+					ti = x = null;
+				}
+			}, 10);
+		} else
+			t.eval(x.responseText);
+	},
+
+	start : function() {
+		var t = this, each = tinymce.each, s = t.settings, ln = s.languages.split(',');
+
+		tinymce.suffix = s.suffix;
+
+		function load(u) {
+			tinymce.ScriptLoader.markDone(tinyMCE.baseURI.toAbsolute(u));
+		};
+
+		// Add core languages
+		each(ln, function(c) {
+			if (c)
+				load('langs/' + c + '.js');
+		});
+
+		// Add themes with languages
+		each(s.themes.split(','), function(n) {
+			if (n) {
+				load('themes/' + n + '/editor_template' + s.suffix + '.js');
+
+				each (ln, function(c) {
+					if (c)
+						load('themes/' + n + '/langs/' + c + '.js');
+				});
+			}
+		});
+
+		// Add plugins with languages
+		each(s.plugins.split(','), function(n) {
+			if (n) {
+				load('plugins/' + n + '/editor_plugin' + s.suffix + '.js');
+
+				each(ln, function(c) {
+					if (c)
+						load('plugins/' + n + '/langs/' + c + '.js');
+				});
+			}
+		});
+	},
+
+	end : function() {
+	},
+
+	eval : function(co) {
+		var w = window;
+
+		// Evaluate script
+		if (!w.execScript) {
+			if (/Gecko/.test(navigator.userAgent))
+				eval(co, w); // Firefox 3.0
+			else
+				eval.call(w, co);
+		} else
+			w.execScript(co); // IE
+	}
+};
diff -x .svn -aruN 0.7.16.src/e107_handlers/tiny_mce/tiny_mce_gzip.php 0.7.17.src/e107_handlers/tiny_mce/tiny_mce_gzip.php
--- 0.7.16.src/e107_handlers/tiny_mce/tiny_mce_gzip.php	2006-03-02 23:06:48.000000000 -0600
+++ 0.7.17.src/e107_handlers/tiny_mce/tiny_mce_gzip.php	2009-09-20 21:32:35.000000000 -0500
@@ -1,229 +1,183 @@
 <?php
 /**
- * $RCSfile: tiny_mce_gzip.php,v $
- * $Revision: 1.2 $
- * $Date: 2006/03/03 05:07:11 $
+ * $Id: tiny_mce_gzip.php,v 1.3 2009/09/21 02:32:59 e107coders Exp $
  *
- * @version 1.07
  * @author Moxiecode
- * @copyright Copyright  20052006, Moxiecode Systems AB, All rights reserved.
+ * @copyright Copyright  2005-2006, Moxiecode Systems AB, All rights reserved.
  *
  * This file compresses the TinyMCE JavaScript using GZip and
  * enables the browser to do two requests instead of one for each .js file.
  * Notice: This script defaults the button_tile_map option to true for extra performance.
  */
 
-// General options
-$suffix = "";							// Set to "_src" to use source version
-$expiresOffset = 3600 * 24 * 10;		// 10 days util client cache expires
-$diskCache = false;						// If you enable this option gzip files will be cached on disk.
-$cacheDir = realpath(".");				// Absolute directory path to where cached gz files will be stored
-$debug = false;							// Enable this option if you need debuging info
-
-// Headers
-header("Content-type: text/javascript; charset: UTF-8");
-// header("Cache-Control: must-revalidate");
-header("Vary: Accept-Encoding"); // Handle proxies
-header("Expires: " . gmdate("D, d M Y H:i:s", time() + $expiresOffset) . " GMT");
-
-// Get data to load
-$theme = isset($_GET['theme']) ? TinyMCE_cleanInput($_GET['theme']) : "";
-$language = isset($_GET['language']) ? TinyMCE_cleanInput($_GET['language']) : "";
-$plugins = isset($_GET['plugins']) ? TinyMCE_cleanInput($_GET['plugins']) : "";
-$lang = isset($_GET['lang']) ? TinyMCE_cleanInput($_GET['lang']) : "en";
-$index = isset($_GET['index']) ? TinyMCE_cleanInput($_GET['index']) : -1;
-$cacheKey = md5($theme . $language . $plugins . $lang . $index . $debug);
-$cacheFile = $cacheDir == "" ? "" : $cacheDir . "/" . "tinymce_" .  $cacheKey . ".gz";
-$cacheData = "";
-
-// Patch older versions of PHP < 4.3.0
-if (!function_exists('file_get_contents')) {
-	function file_get_contents($filename) {
-		$fd = fopen($filename, 'rb');
-		$content = fread($fd, filesize($filename));
-		fclose($fd);
-		return $content;
+	// Set the error reporting to minimal.
+	@error_reporting(E_ERROR | E_WARNING | E_PARSE);
+
+	// Get input
+	$plugins = explode(',', getParam("plugins", ""));
+	$languages = explode(',', getParam("languages", ""));
+	$themes = explode(',', getParam("themes", ""));
+	$diskCache = getParam("diskcache", "") == "true";
+	$isJS = getParam("js", "") == "true";
+	$compress = getParam("compress", "true") == "true";
+	$core = getParam("core", "true") == "true";
+	$suffix = getParam("suffix", "_src") == "_src" ? "_src" : "";
+	$cachePath = realpath("."); // Cache path, this is where the .gz files will be stored
+	$expiresOffset = 3600 * 24 * 10; // Cache for 10 days in browser cache
+	$content = "";
+	$encodings = array();
+	$supportsGzip = false;
+	$enc = "";
+	$cacheKey = "";
+
+	// Custom extra javascripts to pack
+	$custom = array(/*
+		"some custom .js file",
+		"some custom .js file"
+	*/);
+
+	// Headers
+	header("Content-type: text/javascript");
+	header("Vary: Accept-Encoding");  // Handle proxies
+	header("Expires: " . gmdate("D, d M Y H:i:s", time() + $expiresOffset) . " GMT");
+
+	// Is called directly then auto init with default settings
+	if (!$isJS) {
+		echo getFileContents("tiny_mce_gzip.js");
+		echo "tinyMCE_GZ.init({});";
+		die();
 	}
-}
 
-// Security check function, can only contain a-z 0-9 , _ - and whitespace.
-function TinyMCE_cleanInput($str) {
-	return preg_replace("/[^0-9a-z\-_,]+/i", "", $str); // Remove anything but 0-9,a-z,-_
-}
-
-function TinyMCE_echo($str) {
-	global $cacheData, $diskCache;
-
-	if ($diskCache)
-		$cacheData .= $str;
-	else
-		echo $str;
-}
-
-// Only gzip the contents if clients and server support it
-$encodings = array();
-
-if (isset($_SERVER['HTTP_ACCEPT_ENCODING']))
-	$encodings = explode(',', strtolower(preg_replace("/\s+/", "", $_SERVER['HTTP_ACCEPT_ENCODING'])));
-
-// Check for gzip header or northon internet securities
-if ((in_array('gzip', $encodings) || isset($_SERVER['---------------'])) && function_exists('ob_gzhandler') && !ini_get('zlib.output_compression')) {
-	// Use cached file if it exists but not in debug mode
-	if (file_exists($cacheFile) && !$debug) {
-		header("Content-Encoding: gzip");
-		echo file_get_contents($cacheFile);
-		die;
-	}
-
-	if (!$diskCache)
-		ob_start("ob_gzhandler");
-} else
-	$diskCache = false;
-
-if ($index > -1) {
-	// Write main script and patch some things
-	if ($index == 0) {
-		TinyMCE_echo(file_get_contents(realpath("tiny_mce" . $suffix . ".js")));
-		TinyMCE_echo('TinyMCE.prototype.loadScript = function() {};var realTinyMCE = tinyMCE;');
-	} else
-		TinyMCE_echo('tinyMCE = realTinyMCE;');
-
-	// Do init based on index
-	TinyMCE_echo("tinyMCE.init(tinyMCECompressed.configs[" . $index . "]);");
-
-	// Load theme, language pack and theme language packs
-	if ($theme) {
-		TinyMCE_echo(file_get_contents(realpath("themes/" . $theme . "/editor_template" . $suffix . ".js")));
-		TinyMCE_echo(file_get_contents(realpath("themes/" . $theme . "/langs/" . $lang . ".js")));
+	// Setup cache info
+	if ($diskCache) {
+		if (!$cachePath)
+			die("alert('Real path failed.');");
+
+		$cacheKey = getParam("plugins", "") . getParam("languages", "") . getParam("themes", "") . $suffix;
+
+		foreach ($custom as $file)
+			$cacheKey .= $file;
+
+		$cacheKey = md5($cacheKey);
+
+		if ($compress)
+			$cacheFile = $cachePath . "/tiny_mce_" . $cacheKey . ".gz";
+		else
+			$cacheFile = $cachePath . "/tiny_mce_" . $cacheKey . ".js";
 	}
 
-	if ($language)
-		TinyMCE_echo(file_get_contents(realpath("langs/" . $language . ".js")));
+	// Check if it supports gzip
+	if (isset($_SERVER['HTTP_ACCEPT_ENCODING']))
+		$encodings = explode(',', strtolower(preg_replace("/\s+/", "", $_SERVER['HTTP_ACCEPT_ENCODING'])));
 
-	// Load all plugins and their language packs
-	$plugins = explode(",", $plugins);
-	foreach ($plugins as $plugin) {
-		$pluginFile = realpath("plugins/" . $plugin . "/editor_plugin" . $suffix . ".js");
-		$languageFile = realpath("plugins/" . $plugin . "/langs/" . $lang . ".js");
+	if ((in_array('gzip', $encodings) || in_array('x-gzip', $encodings) || isset($_SERVER['---------------'])) && function_exists('ob_gzhandler') && !ini_get('zlib.output_compression')) {
+		$enc = in_array('x-gzip', $encodings) ? "x-gzip" : "gzip";
+		$supportsGzip = true;
+	}
 
-		if ($pluginFile)
-			TinyMCE_echo(file_get_contents($pluginFile));
+	// Use cached file disk cache
+	if ($diskCache && $supportsGzip && file_exists($cacheFile)) {
+		if ($compress)
+			header("Content-Encoding: " . $enc);
 
-		if ($languageFile)
-			TinyMCE_echo(file_get_contents($languageFile));
+		echo getFileContents($cacheFile);
+		die();
 	}
 
-	// Reset tinyMCE compressor engine
-	TinyMCE_echo("tinyMCE = tinyMCECompressed;");
+	// Add core
+	if ($core == "true") {
+		$content .= getFileContents("tiny_mce" . $suffix . ".js");
 
-	// Write to cache
-	if ($diskCache) {
-		// Calculate compression ratio and debug target output path
-		if ($debug) {
-			$ratio = round(100 - strlen(gzencode($cacheData, 9, FORCE_GZIP)) / strlen($cacheData) * 100.0);
-			TinyMCE_echo("alert('TinyMCE was compressed by " . $ratio . "%.\\nOutput cache file: " . $cacheFile . "');");
-		}
+		// Patch loading functions
+		$content .= "tinyMCE_GZ.start();";
+	}
 
-		$cacheData = gzencode($cacheData, 9, FORCE_GZIP);
+	// Add core languages
+	foreach ($languages as $lang)
+		$content .= getFileContents("langs/" . $lang . ".js");
 
-		// Write to file if possible
-		$fp = @fopen($cacheFile, "wb");
-		if ($fp) {
-			fwrite($fp, $cacheData);
-			fclose($fp);
-		}
+	// Add themes
+	foreach ($themes as $theme) {
+		$content .= getFileContents( "themes/" . $theme . "/editor_template" . $suffix . ".js");
 
-		// Output
-		header("Content-Encoding: gzip");
-		echo $cacheData;
+		foreach ($languages as $lang)
+			$content .= getFileContents("themes/" . $theme . "/langs/" . $lang . ".js");
 	}
 
-	die;
-}
-?>
-
-function TinyMCECompressed() {
-	this.configs = new Array();
-	this.loadedFiles = new Array();
-	this.loadAdded = false;
-	this.isLoaded = false;
-}
-
-TinyMCECompressed.prototype.init = function(settings) {
-	var elements = document.getElementsByTagName('script');
-	var scriptURL = "";
-
-	for (var i=0; i<elements.length; i++) {
-		if (elements[i].src && elements[i].src.indexOf("tiny_mce_gzip.php") != -1) {
-			scriptURL = elements[i].src;
-			break;
-		}
+	// Add plugins
+	foreach ($plugins as $plugin) {
+		$content .= getFileContents("plugins/" . $plugin . "/editor_plugin" . $suffix . ".js");
+
+		foreach ($languages as $lang)
+			$content .= getFileContents("plugins/" . $plugin . "/langs/" . $lang . ".js");
 	}
 
-	settings["theme"] = typeof(settings["theme"]) != "undefined" ? settings["theme"] : "default";
-	settings["plugins"] = typeof(settings["plugins"]) != "undefined" ? settings["plugins"] : "";
-	settings["language"] = typeof(settings["language"]) != "undefined" ? settings["language"] : "en";
-	settings["button_tile_map"] = typeof(settings["button_tile_map"]) != "undefined" ? settings["button_tile_map"] : true;
-	this.configs[this.configs.length] = settings;
-	this.settings = settings;
-
-	scriptURL += "?theme=" + escape(this.getOnce(settings["theme"])) + "&language=" + escape(this.getOnce(settings["language"])) + "&plugins=" + escape(this.getOnce(settings["plugins"])) + "&lang=" + settings["language"] + "&index=" + escape(this.configs.length-1);
-	document.write('<sc'+'ript language="javascript" type="text/javascript" src="' + scriptURL + '"></script>');
-
-	if (!this.loadAdded) {
-		tinyMCE.addEvent(window, "DOMContentLoaded", TinyMCECompressed.prototype.onLoad);
-		tinyMCE.addEvent(window, "load", TinyMCECompressed.prototype.onLoad);
-		this.loadAdded = true;
-	}
-}
-
-TinyMCECompressed.prototype.onLoad = function() {
-	if (tinyMCE.isLoaded)
-		return true;
-
-	tinyMCE = realTinyMCE;
-	TinyMCE_Engine.prototype.onLoad();
-	tinyMCE._addUnloadEvents();
-	tinyMCE.isLoaded = true;
-}
-
-TinyMCECompressed.prototype.addEvent = function(o, n, h) {
-	if (o.attachEvent)
-		o.attachEvent("on" + n, h);
-	else
-		o.addEventListener(n, h, false);
-}
-
-TinyMCECompressed.prototype.getOnce = function(str) {
-	var ar = str.split(',');
-
-	for (var i=0; i<ar.length; i++) {
-		if (ar[i] == '')
-			continue;
-
-		// Skip load
-		for (var x=0; x<this.loadedFiles.length; x++) {
-			if (this.loadedFiles[x] == ar[i])
-				ar[i] = null;
-		}
+	// Add custom files
+	foreach ($custom as $file)
+		$content .= getFileContents($file);
+
+	// Restore loading functions
+	if ($core == "true")
+		$content .= "tinyMCE_GZ.end();";
+
+	// Generate GZIP'd content
+	if ($supportsGzip) {
+		if ($compress) {
+			header("Content-Encoding: " . $enc);
+			$cacheData = gzencode($content, 9, FORCE_GZIP);
+		} else
+			$cacheData = $content;
+
+		// Write gz file
+		if ($diskCache && $cacheKey != "")
+			putFileContents($cacheFile, $cacheData);
+
+		// Stream to client
+		echo $cacheData;
+	} else {
+		// Stream uncompressed content
+		echo $content;
+	}
+
+	/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+	function getParam($name, $def = false) {
+		if (!isset($_GET[$name]))
+			return $def;
 
-		this.loadedFiles[this.loadedFiles.length] = ar[i];
+		return preg_replace("/[^0-9a-z\-_,]+/i", "", $_GET[$name]); // Remove anything but 0-9,a-z,-_
 	}
 
-	// Glue
-	str = "";
-	for (var i=0; i<ar.length; i++) {
-		if (ar[i] == null)
-			continue;
+	function getFileContents($path) {
+		$path = realpath($path);
 
-		str += ar[i];
+		if (!$path || !@is_file($path))
+			return "";
 
-		if (i != ar.length-1)
-			str += ",";
+		if (function_exists("file_get_contents"))
+			return @file_get_contents($path);
+
+		$content = "";
+		$fp = @fopen($path, "r");
+		if (!$fp)
+			return "";
+
+		while (!feof($fp))
+			$content .= fgets($fp);
+
+		fclose($fp);
+
+		return $content;
 	}
 
-	return str;
-}
+	function putFileContents($path, $content) {
+		if (function_exists("file_put_contents"))
+			return @file_put_contents($path, $content);
 
-var tinyMCE = new TinyMCECompressed();
-var tinyMCECompressed = tinyMCE;
+		$fp = @fopen($path, "wb");
+		if ($fp) {
+			fwrite($fp, $content);
+			fclose($fp);
+		}
+	}
+?>
\ No newline at end of file
diff -x .svn -aruN 0.7.16.src/e107_handlers/tiny_mce/tiny_mce.js 0.7.17.src/e107_handlers/tiny_mce/tiny_mce.js
--- 0.7.16.src/e107_handlers/tiny_mce/tiny_mce.js	2009-06-30 19:36:50.000000000 -0500
+++ 0.7.17.src/e107_handlers/tiny_mce/tiny_mce.js	2009-10-02 13:45:10.000000000 -0500
@@ -1 +1 @@
-var tinymce={majorVersion:"3",minorVersion:"2.5",releaseDate:"2009-06-29",_init:function(){var o=this,k=document,l=window,j=navigator,b=j.userAgent,h,a,g,f,e,m;o.isOpera=l.opera&&opera.buildNumber;o.isWebKit=/WebKit/.test(b);o.isIE=!o.isWebKit&&!o.isOpera&&(/MSIE/gi).test(b)&&(/Explorer/gi).test(j.appName);o.isIE6=o.isIE&&/MSIE [56]/.test(b);o.isGecko=!o.isWebKit&&/Gecko/.test(b);o.isMac=b.indexOf("Mac")!=-1;o.isAir=/adobeair/i.test(b);if(l.tinyMCEPreInit){o.suffix=tinyMCEPreInit.suffix;o.baseURL=tinyMCEPreInit.base;o.query=tinyMCEPreInit.query;return}o.suffix="";a=k.getElementsByTagName("base");for(h=0;h<a.length;h++){if(m=a[h].href){if(/^https?:\/\/[^\/]+$/.test(m)){m+="/"}f=m?m.match(/.*\//)[0]:""}}function c(d){if(d.src&&/tiny_mce(|_gzip|_jquery|_prototype)(_dev|_src)?.js/.test(d.src)){if(/_(src|dev)\.js/g.test(d.src)){o.suffix="_src"}if((e=d.src.indexOf("?"))!=-1){o.query=d.src.substring(e+1)}o.baseURL=d.src.substring(0,d.src.lastIndexOf("/"));if(f&&o.baseURL.indexOf("://")==-1){o.baseURL=f+o.baseURL}return o.baseURL}return null}a=k.getElementsByTagName("script");for(h=0;h<a.length;h++){if(c(a[h])){return}}g=k.getElementsByTagName("head")[0];if(g){a=g.getElementsByTagName("script");for(h=0;h<a.length;h++){if(c(a[h])){return}}}return},is:function(b,a){var c=typeof(b);if(!a){return c!="undefined"}if(a=="array"&&(b.hasOwnProperty&&b instanceof Array)){return true}return c==a},each:function(d,a,c){var e,b;if(!d){return 0}c=c||d;if(typeof(d.length)!="undefined"){for(e=0,b=d.length;e<b;e++){if(a.call(c,d[e],e,d)===false){return 0}}}else{for(e in d){if(d.hasOwnProperty(e)){if(a.call(c,d[e],e,d)===false){return 0}}}}return 1},map:function(b,c){var d=[];tinymce.each(b,function(a){d.push(c(a))});return d},grep:function(b,c){var d=[];tinymce.each(b,function(a){if(!c||c(a)){d.push(a)}});return d},inArray:function(c,d){var e,b;if(c){for(e=0,b=c.length;e<b;e++){if(c[e]===d){return e}}}return -1},extend:function(f,d){var c,b=arguments;for(c=1;c<b.length;c++){d=b[c];tinymce.each(d,function(a,e){if(typeof(a)!=="undefined"){f[e]=a}})}return f},trim:function(a){return(a?""+a:"").replace(/^\s*|\s*$/g,"")},create:function(j,a){var i=this,b,e,f,g,d,h=0;j=/^((static) )?([\w.]+)(:([\w.]+))?/.exec(j);f=j[3].match(/(^|\.)(\w+)$/i)[2];e=i.createNS(j[3].replace(/\.\w+$/,""));if(e[f]){return}if(j[2]=="static"){e[f]=a;if(this.onCreate){this.onCreate(j[2],j[3],e[f])}return}if(!a[f]){a[f]=function(){};h=1}e[f]=a[f];i.extend(e[f].prototype,a);if(j[5]){b=i.resolve(j[5]).prototype;g=j[5].match(/\.(\w+)$/i)[1];d=e[f];if(h){e[f]=function(){return b[g].apply(this,arguments)}}else{e[f]=function(){this.parent=b[g];return d.apply(this,arguments)}}e[f].prototype[f]=e[f];i.each(b,function(c,k){e[f].prototype[k]=b[k]});i.each(a,function(c,k){if(b[k]){e[f].prototype[k]=function(){this.parent=b[k];return c.apply(this,arguments)}}else{if(k!=f){e[f].prototype[k]=c}}})}i.each(a["static"],function(c,k){e[f][k]=c});if(this.onCreate){this.onCreate(j[2],j[3],e[f].prototype)}},walk:function(c,b,d,a){a=a||this;if(c){if(d){c=c[d]}tinymce.each(c,function(f,e){if(b.call(a,f,e,d)===false){return false}tinymce.walk(f,b,d,a)})}},createNS:function(d,c){var b,a;c=c||window;d=d.split(".");for(b=0;b<d.length;b++){a=d[b];if(!c[a]){c[a]={}}c=c[a]}return c},resolve:function(d,c){var b,a;c=c||window;d=d.split(".");for(b=0,a=d.length;b<a;b++){c=c[d[b]];if(!c){break}}return c},addUnload:function(e,d){var c=this,a=window;e={func:e,scope:d||this};if(!c.unloads){function b(){var f=c.unloads,h,i;if(f){for(i in f){h=f[i];if(h&&h.func){h.func.call(h.scope,1)}}if(a.detachEvent){a.detachEvent("onbeforeunload",g);a.detachEvent("onunload",b)}else{if(a.removeEventListener){a.removeEventListener("unload",b,false)}}c.unloads=h=f=a=b=0;if(window.CollectGarbage){window.CollectGarbage()}}}function g(){var h=document;if(h.readyState=="interactive"){function f(){h.detachEvent("onstop",f);if(b){b()}h=0}if(h){h.attachEvent("onstop",f)}window.setTimeout(function(){if(h){h.detachEvent("onstop",f)}},0)}}if(a.attachEvent){a.attachEvent("onunload",b);a.attachEvent("onbeforeunload",g)}else{if(a.addEventListener){a.addEventListener("unload",b,false)}}c.unloads=[e]}else{c.unloads.push(e)}return e},removeUnload:function(c){var a=this.unloads,b=null;tinymce.each(a,function(e,d){if(e&&e.func==c){a.splice(d,1);b=c;return false}});return b},explode:function(a,b){return a?tinymce.map(a.split(b||","),tinymce.trim):a},_addVer:function(b){var a;if(!this.query){return b}a=(b.indexOf("?")==-1?"?":"&")+this.query;if(b.indexOf("#")==-1){return b+a}return b.replace("#",a+"#")}};window.tinymce=tinymce;tinymce._init();tinymce.create("tinymce.util.Dispatcher",{scope:null,listeners:null,Dispatcher:function(a){this.scope=a||this;this.listeners=[]},add:function(a,b){this.listeners.push({cb:a,scope:b||this.scope});return a},addToTop:function(a,b){this.listeners.unshift({cb:a,scope:b||this.scope});return a},remove:function(a){var b=this.listeners,c=null;tinymce.each(b,function(e,d){if(a==e.cb){c=a;b.splice(d,1);return false}});return c},dispatch:function(){var f,d=arguments,e,b=this.listeners,g;for(e=0;e<b.length;e++){g=b[e];f=g.cb.apply(g.scope,d);if(f===false){break}}return f}});(function(){var a=tinymce.each;tinymce.create("tinymce.util.URI",{URI:function(e,g){var f=this,h,d,c;e=tinymce.trim(e);g=f.settings=g||{};if(/^(mailto|tel|news|javascript|about):/i.test(e)||/^\s*#/.test(e)){f.source=e;return}if(e.indexOf("/")===0&&e.indexOf("//")!==0){e=(g.base_uri?g.base_uri.protocol||"http":"http")+"://mce_host"+e}if(!/^\w*:?\/\//.test(e)){e=(g.base_uri.protocol||"http")+"://mce_host"+f.toAbsPath(g.base_uri.path,e)}e=e.replace(/@@/g,"(mce_at)");e=/^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*):?([^:@]*))?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/.exec(e);a(["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"],function(b,j){var k=e[j];if(k){k=k.replace(/\(mce_at\)/g,"@@")}f[b]=k});if(c=g.base_uri){if(!f.protocol){f.protocol=c.protocol}if(!f.userInfo){f.userInfo=c.userInfo}if(!f.port&&f.host=="mce_host"){f.port=c.port}if(!f.host||f.host=="mce_host"){f.host=c.host}f.source=""}},setPath:function(c){var b=this;c=/^(.*?)\/?(\w+)?$/.exec(c);b.path=c[0];b.directory=c[1];b.file=c[2];b.source="";b.getURI()},toRelative:function(b){var c=this,d;if(b==="./"){return b}b=new tinymce.util.URI(b,{base_uri:c});if((b.host!="mce_host"&&c.host!=b.host&&b.host)||c.port!=b.port||c.protocol!=b.protocol){return b.getURI()}d=c.toRelPath(c.path,b.path);if(b.query){d+="?"+b.query}if(b.anchor){d+="#"+b.anchor}return d},toAbsolute:function(b,c){var b=new tinymce.util.URI(b,{base_uri:this});return b.getURI(this.host==b.host?c:0)},toRelPath:function(g,h){var c,f=0,d="",e,b;g=g.substring(0,g.lastIndexOf("/"));g=g.split("/");c=h.split("/");if(g.length>=c.length){for(e=0,b=g.length;e<b;e++){if(e>=c.length||g[e]!=c[e]){f=e+1;break}}}if(g.length<c.length){for(e=0,b=c.length;e<b;e++){if(e>=g.length||g[e]!=c[e]){f=e+1;break}}}if(f==1){return h}for(e=0,b=g.length-(f-1);e<b;e++){d+="../"}for(e=f-1,b=c.length;e<b;e++){if(e!=f-1){d+="/"+c[e]}else{d+=c[e]}}return d},toAbsPath:function(e,f){var c,b=0,g=[],d;d=/\/$/.test(f)?"/":"";e=e.split("/");f=f.split("/");a(e,function(h){if(h){g.push(h)}});e=g;for(c=f.length-1,g=[];c>=0;c--){if(f[c].length==0||f[c]=="."){continue}if(f[c]==".."){b++;continue}if(b>0){b--;continue}g.push(f[c])}c=e.length-b;if(c<=0){return"/"+g.reverse().join("/")+d}return"/"+e.slice(0,c).join("/")+"/"+g.reverse().join("/")+d},getURI:function(d){var c,b=this;if(!b.source||d){c="";if(!d){if(b.protocol){c+=b.protocol+"://"}if(b.userInfo){c+=b.userInfo+"@"}if(b.host){c+=b.host}if(b.port){c+=":"+b.port}}if(b.path){c+=b.path}if(b.query){c+="?"+b.query}if(b.anchor){c+="#"+b.anchor}b.source=c}return b.source}})})();(function(){var a=tinymce.each;tinymce.create("static tinymce.util.Cookie",{getHash:function(d){var b=this.get(d),c;if(b){a(b.split("&"),function(e){e=e.split("=");c=c||{};c[unescape(e[0])]=unescape(e[1])})}return c},setHash:function(j,b,g,f,i,c){var h="";a(b,function(e,d){h+=(!h?"":"&")+escape(d)+"="+escape(e)});this.set(j,h,g,f,i,c)},get:function(i){var h=document.cookie,g,f=i+"=",d;if(!h){return}d=h.indexOf("; "+f);if(d==-1){d=h.indexOf(f);if(d!=0){return null}}else{d+=2}g=h.indexOf(";",d);if(g==-1){g=h.length}return unescape(h.substring(d+f.length,g))},set:function(i,b,g,f,h,c){document.cookie=i+"="+escape(b)+((g)?"; expires="+g.toGMTString():"")+((f)?"; path="+escape(f):"")+((h)?"; domain="+h:"")+((c)?"; secure":"")},remove:function(e,b){var c=new Date();c.setTime(c.getTime()-1000);this.set(e,"",c,b,c)}})})();tinymce.create("static tinymce.util.JSON",{serialize:function(e){var c,a,d=tinymce.util.JSON.serialize,b;if(e==null){return"null"}b=typeof e;if(b=="string"){a="\bb\tt\nn\ff\rr\"\"''\\\\";return'"'+e.replace(/([\u0080-\uFFFF\x00-\x1f\"])/g,function(g,f){c=a.indexOf(f);if(c+1){return"\\"+a.charAt(c+1)}g=f.charCodeAt().toString(16);return"\\u"+"0000".substring(g.length)+g})+'"'}if(b=="object"){if(e.hasOwnProperty&&e instanceof Array){for(c=0,a="[";c<e.length;c++){a+=(c>0?",":"")+d(e[c])}return a+"]"}a="{";for(c in e){a+=typeof e[c]!="function"?(a.length>1?',"':'"')+c+'":'+d(e[c]):""}return a+"}"}return""+e},parse:function(s){try{return eval("("+s+")")}catch(ex){}}});tinymce.create("static tinymce.util.XHR",{send:function(g){var a,e,b=window,h=0;g.scope=g.scope||this;g.success_scope=g.success_scope||g.scope;g.error_scope=g.error_scope||g.scope;g.async=g.async===false?false:true;g.data=g.data||"";function d(i){a=0;try{a=new ActiveXObject(i)}catch(c){}return a}a=b.XMLHttpRequest?new XMLHttpRequest():d("Microsoft.XMLHTTP")||d("Msxml2.XMLHTTP");if(a){if(a.overrideMimeType){a.overrideMimeType(g.content_type)}a.open(g.type||(g.data?"POST":"GET"),g.url,g.async);if(g.content_type){a.setRequestHeader("Content-Type",g.content_type)}a.send(g.data);function f(){if(!g.async||a.readyState==4||h++>10000){if(g.success&&h<10000&&a.status==200){g.success.call(g.success_scope,""+a.responseText,a,g)}else{if(g.error){g.error.call(g.error_scope,h>10000?"TIMED_OUT":"GENERAL",a,g)}}a=null}else{b.setTimeout(f,10)}}if(!g.async){return f()}e=b.setTimeout(f,10)}}});(function(){var c=tinymce.extend,b=tinymce.util.JSON,a=tinymce.util.XHR;tinymce.create("tinymce.util.JSONRequest",{JSONRequest:function(d){this.settings=c({},d);this.count=0},send:function(f){var e=f.error,d=f.success;f=c(this.settings,f);f.success=function(h,g){h=b.parse(h);if(typeof(h)=="undefined"){h={error:"JSON Parse error."}}if(h.error){e.call(f.error_scope||f.scope,h.error,g)}else{d.call(f.success_scope||f.scope,h.result)}};f.error=function(h,g){e.call(f.error_scope||f.scope,h,g)};f.data=b.serialize({id:f.id||"c"+(this.count++),method:f.method,params:f.params});f.content_type="application/json";a.send(f)},"static":{sendRPC:function(d){return new tinymce.util.JSONRequest().send(d)}}})}());(function(c){var e=c.each,b=c.is;var d=c.isWebKit,a=c.isIE;c.create("tinymce.dom.DOMUtils",{doc:null,root:null,files:null,pixelStyles:/^(top|left|bottom|right|width|height|borderWidth)$/,props:{"for":"htmlFor","class":"className",className:"className",checked:"checked",disabled:"disabled",maxlength:"maxLength",readonly:"readOnly",selected:"selected",value:"value",id:"id",name:"name",type:"type"},DOMUtils:function(i,g){var f=this;f.doc=i;f.win=window;f.files={};f.cssFlicker=false;f.counter=0;f.boxModel=!c.isIE||i.compatMode=="CSS1Compat";f.stdMode=i.documentMode===8;f.settings=g=c.extend({keep_values:false,hex_colors:1,process_html:1},g);if(c.isIE6){try{i.execCommand("BackgroundImageCache",false,true)}catch(h){f.cssFlicker=true}}c.addUnload(f.destroy,f)},getRoot:function(){var f=this,g=f.settings;return(g&&f.get(g.root_element))||f.doc.body},getViewPort:function(g){var h,f;g=!g?this.win:g;h=g.document;f=this.boxModel?h.documentElement:h.body;return{x:g.pageXOffset||f.scrollLeft,y:g.pageYOffset||f.scrollTop,w:g.innerWidth||f.clientWidth,h:g.innerHeight||f.clientHeight}},getRect:function(i){var h,f=this,g;i=f.get(i);h=f.getPos(i);g=f.getSize(i);return{x:h.x,y:h.y,w:g.w,h:g.h}},getSize:function(j){var g=this,f,i;j=g.get(j);f=g.getStyle(j,"width");i=g.getStyle(j,"height");if(f.indexOf("px")===-1){f=0}if(i.indexOf("px")===-1){i=0}return{w:parseInt(f)||j.offsetWidth||j.clientWidth,h:parseInt(i)||j.offsetHeight||j.clientHeight}},getParent:function(i,h,g){return this.getParents(i,h,g,false)},getParents:function(p,k,i,m){var h=this,g,j=h.settings,l=[];p=h.get(p);m=m===undefined;if(j.strict_root){i=i||h.getRoot()}if(b(k,"string")){g=k;if(k==="*"){k=function(f){return f.nodeType==1}}else{k=function(f){return h.is(f,g)}}}while(p){if(p==i||!p.nodeType||p.nodeType===9){break}if(!k||k(p)){if(m){l.push(p)}else{return p}}p=p.parentNode}return m?l:null},get:function(f){var g;if(f&&this.doc&&typeof(f)=="string"){g=f;f=this.doc.getElementById(f);if(f&&f.id!==g){return this.doc.getElementsByName(g)[1]}}return f},select:function(h,g){var f=this;return c.dom.Sizzle(h,f.get(g)||f.get(f.settings.root_element)||f.doc,[])},is:function(g,f){return c.dom.Sizzle.matches(f,g.nodeType?[g]:g).length>0},add:function(j,l,f,i,k){var g=this;return this.run(j,function(n){var m,h;m=b(l,"string")?g.doc.createElement(l):l;g.setAttribs(m,f);if(i){if(i.nodeType){m.appendChild(i)}else{g.setHTML(m,i)}}return !k?n.appendChild(m):m})},create:function(i,f,g){return this.add(this.doc.createElement(i),i,f,g,1)},createHTML:function(m,f,j){var l="",i=this,g;l+="<"+m;for(g in f){if(f.hasOwnProperty(g)){l+=" "+g+'="'+i.encode(f[g])+'"'}}if(c.is(j)){return l+">"+j+"</"+m+">"}return l+" />"},remove:function(h,f){var g=this;return this.run(h,function(m){var l,k,j;l=m.parentNode;if(!l){return null}if(f){for(j=m.childNodes.length-1;j>=0;j--){g.insertAfter(m.childNodes[j],m)}}if(g.fixPsuedoLeaks){l=m.cloneNode(true);f="IELeakGarbageBin";k=g.get(f)||g.add(g.doc.body,"div",{id:f,style:"display:none"});k.appendChild(m);k.innerHTML="";return l}return l.removeChild(m)})},setStyle:function(i,f,g){var h=this;return h.run(i,function(l){var k,j;k=l.style;f=f.replace(/-(\D)/g,function(n,m){return m.toUpperCase()});if(h.pixelStyles.test(f)&&(c.is(g,"number")||/^[\-0-9\.]+$/.test(g))){g+="px"}switch(f){case"opacity":if(a){k.filter=g===""?"":"alpha(opacity="+(g*100)+")";if(!i.currentStyle||!i.currentStyle.hasLayout){k.display="inline-block"}}k[f]=k["-moz-opacity"]=k["-khtml-opacity"]=g||"";break;case"float":a?k.styleFloat=g:k.cssFloat=g;break;default:k[f]=g||""}if(h.settings.update_styles){h.setAttrib(l,"mce_style")}})},getStyle:function(i,f,h){i=this.get(i);if(!i){return false}if(this.doc.defaultView&&h){f=f.replace(/[A-Z]/g,function(j){return"-"+j});try{return this.doc.defaultView.getComputedStyle(i,null).getPropertyValue(f)}catch(g){return null}}f=f.replace(/-(\D)/g,function(k,j){return j.toUpperCase()});if(f=="float"){f=a?"styleFloat":"cssFloat"}if(i.currentStyle&&h){return i.currentStyle[f]}return i.style[f]},setStyles:function(i,j){var g=this,h=g.settings,f;f=h.update_styles;h.update_styles=0;e(j,function(k,l){g.setStyle(i,l,k)});h.update_styles=f;if(h.update_styles){g.setAttrib(i,h.cssText)}},setAttrib:function(h,i,f){var g=this;if(!h||!i){return}if(g.settings.strict){i=i.toLowerCase()}return this.run(h,function(k){var j=g.settings;switch(i){case"style":if(!b(f,"string")){e(f,function(l,m){g.setStyle(k,m,l)});return}if(j.keep_values){if(f&&!g._isRes(f)){k.setAttribute("mce_style",f,2)}else{k.removeAttribute("mce_style",2)}}k.style.cssText=f;break;case"class":k.className=f||"";break;case"src":case"href":if(j.keep_values){if(j.url_converter){f=j.url_converter.call(j.url_converter_scope||g,f,i,k)}g.setAttrib(k,"mce_"+i,f,2)}break;case"shape":k.setAttribute("mce_style",f);break}if(b(f)&&f!==null&&f.length!==0){k.setAttribute(i,""+f,2)}else{k.removeAttribute(i,2)}})},setAttribs:function(g,h){var f=this;return this.run(g,function(i){e(h,function(j,k){f.setAttrib(i,k,j)})})},getAttrib:function(i,j,h){var f,g=this;i=g.get(i);if(!i||i.nodeType!==1){return false}if(!b(h)){h=""}if(/^(src|href|style|coords|shape)$/.test(j)){f=i.getAttribute("mce_"+j);if(f){return f}}if(a&&g.props[j]){f=i[g.props[j]];f=f&&f.nodeValue?f.nodeValue:f}if(!f){f=i.getAttribute(j,2)}if(j==="style"){f=f||i.style.cssText;if(f){f=g.serializeStyle(g.parseStyle(f));if(g.settings.keep_values&&!g._isRes(f)){i.setAttribute("mce_style",f)}}}if(d&&j==="class"&&f){f=f.replace(/(apple|webkit)\-[a-z\-]+/gi,"")}if(a){switch(j){case"rowspan":case"colspan":if(f===1){f=""}break;case"size":if(f==="+0"||f===20||f===0){f=""}break;case"width":case"height":case"vspace":case"checked":case"disabled":case"readonly":if(f===0){f=""}break;case"hspace":if(f===-1){f=""}break;case"maxlength":case"tabindex":if(f===32768||f===2147483647||f==="32768"){f=""}break;case"multiple":case"compact":case"noshade":case"nowrap":if(f===65535){return j}return h;case"shape":f=f.toLowerCase();break;default:if(j.indexOf("on")===0&&f){f=(""+f).replace(/^function\s+\w+\(\)\s+\{\s+(.*)\s+\}$/,"$1")}}}return(f!==undefined&&f!==null&&f!=="")?""+f:h},getPos:function(m,i){var g=this,f=0,l=0,j,k=g.doc,h;m=g.get(m);i=i||k.body;if(m){if(a&&!g.stdMode){m=m.getBoundingClientRect();j=g.boxModel?k.documentElement:k.body;f=g.getStyle(g.select("html")[0],"borderWidth");f=(f=="medium"||g.boxModel&&!g.isIE6)&&2||f;m.top+=g.win.self!=g.win.top?2:0;return{x:m.left+j.scrollLeft-f,y:m.top+j.scrollTop-f}}h=m;while(h&&h!=i&&h.nodeType){f+=h.offsetLeft||0;l+=h.offsetTop||0;h=h.offsetParent}h=m.parentNode;while(h&&h!=i&&h.nodeType){f-=h.scrollLeft||0;l-=h.scrollTop||0;h=h.parentNode}}return{x:f,y:l}},parseStyle:function(h){var i=this,j=i.settings,k={};if(!h){return k}function f(w,q,v){var o,u,m,n;o=k[w+"-top"+q];if(!o){return}u=k[w+"-right"+q];if(o!=u){return}m=k[w+"-bottom"+q];if(u!=m){return}n=k[w+"-left"+q];if(m!=n){return}k[v]=n;delete k[w+"-top"+q];delete k[w+"-right"+q];delete k[w+"-bottom"+q];delete k[w+"-left"+q]}function g(n,m,l,p){var o;o=k[m];if(!o){return}o=k[l];if(!o){return}o=k[p];if(!o){return}k[n]=k[m]+" "+k[l]+" "+k[p];delete k[m];delete k[l];delete k[p]}h=h.replace(/&(#?[a-z0-9]+);/g,"&$1_MCE_SEMI_");e(h.split(";"),function(m){var l,n=[];if(m){m=m.replace(/_MCE_SEMI_/g,";");m=m.replace(/url\([^\)]+\)/g,function(o){n.push(o);return"url("+n.length+")"});m=m.split(":");l=c.trim(m[1]);l=l.replace(/url\(([^\)]+)\)/g,function(p,o){return n[parseInt(o)-1]});l=l.replace(/rgb\([^\)]+\)/g,function(o){return i.toHex(o)});if(j.url_converter){l=l.replace(/url\([\'\"]?([^\)\'\"]+)[\'\"]?\)/g,function(o,p){return"url("+j.url_converter.call(j.url_converter_scope||i,i.decode(p),"style",null)+")"})}k[c.trim(m[0]).toLowerCase()]=l}});f("border","","border");f("border","-width","border-width");f("border","-color","border-color");f("border","-style","border-style");f("padding","","padding");f("margin","","margin");g("border","border-width","border-style","border-color");if(a){if(k.border=="medium none"){k.border=""}}return k},serializeStyle:function(g){var f="";e(g,function(i,h){if(h&&i){if(c.isGecko&&h.indexOf("-moz-")===0){return}switch(h){case"color":case"background-color":i=i.toLowerCase();break}f+=(f?" ":"")+h+": "+i+";"}});return f},loadCSS:function(f){var h=this,i=h.doc,g;if(!f){f=""}g=h.select("head")[0];e(f.split(","),function(j){var k;if(h.files[j]){return}h.files[j]=true;k=h.create("link",{rel:"stylesheet",href:c._addVer(j)});if(a&&i.documentMode){k.onload=function(){i.recalc();k.onload=null}}g.appendChild(k)})},addClass:function(f,g){return this.run(f,function(h){var i;if(!g){return 0}if(this.hasClass(h,g)){return h.className}i=this.removeClass(h,g);return h.className=(i!=""?(i+" "):"")+g})},removeClass:function(h,i){var f=this,g;return f.run(h,function(k){var j;if(f.hasClass(k,i)){if(!g){g=new RegExp("(^|\\s+)"+i+"(\\s+|$)","g")}j=k.className.replace(g," ");return k.className=c.trim(j!=" "?j:"")}return k.className})},hasClass:function(g,f){g=this.get(g);if(!g||!f){return false}return(" "+g.className+" ").indexOf(" "+f+" ")!==-1},show:function(f){return this.setStyle(f,"display","block")},hide:function(f){return this.setStyle(f,"display","none")},isHidden:function(f){f=this.get(f);return !f||f.style.display=="none"||this.getStyle(f,"display")=="none"},uniqueId:function(f){return(!f?"mce_":f)+(this.counter++)},setHTML:function(i,g){var f=this;return this.run(i,function(m){var h,k,j,q,l,h;g=f.processHTML(g);if(a){function o(){try{m.innerHTML="<br />"+g;m.removeChild(m.firstChild)}catch(n){while(m.firstChild){m.firstChild.removeNode()}h=f.create("div");h.innerHTML="<br />"+g;e(h.childNodes,function(r,p){if(p){m.appendChild(r)}})}}if(f.settings.fix_ie_paragraphs){g=g.replace(/<p><\/p>|<p([^>]+)><\/p>|<p[^\/+]\/>/gi,'<p$1 mce_keep="true">&nbsp;</p>')}o();if(f.settings.fix_ie_paragraphs){j=m.getElementsByTagName("p");for(k=j.length-1,h=0;k>=0;k--){q=j[k];if(!q.hasChildNodes()){if(!q.mce_keep){h=1;break}q.removeAttribute("mce_keep")}}}if(h){g=g.replace(/<p ([^>]+)>|<p>/g,'<div $1 mce_tmp="1">');g=g.replace(/<\/p>/g,"</div>");o();if(f.settings.fix_ie_paragraphs){j=m.getElementsByTagName("DIV");for(k=j.length-1;k>=0;k--){q=j[k];if(q.mce_tmp){l=f.doc.createElement("p");q.cloneNode(false).outerHTML.replace(/([a-z0-9\-_]+)=/gi,function(p,n){var r;if(n!=="mce_tmp"){r=q.getAttribute(n);if(!r&&n==="class"){r=q.className}l.setAttribute(n,r)}});for(h=0;h<q.childNodes.length;h++){l.appendChild(q.childNodes[h].cloneNode(true))}q.swapNode(l)}}}}}else{m.innerHTML=g}return g})},processHTML:function(j){var g=this,i=g.settings;if(!i.process_html){return j}if(c.isGecko){j=j.replace(/<(\/?)strong>|<strong( [^>]+)>/gi,"<$1b$2>");j=j.replace(/<(\/?)em>|<em( [^>]+)>/gi,"<$1i$2>")}else{if(a){j=j.replace(/&apos;/g,"&#39;");j=j.replace(/\s+(disabled|checked|readonly|selected)\s*=\s*[\"\']?(false|0)[\"\']?/gi,"")}}j=j.replace(/<a( )([^>]+)\/>|<a\/>/gi,"<a$1$2></a>");if(i.keep_values){if(/<script|noscript|style/.test(j)){function f(h){h=h.replace(/(<!--\[CDATA\[|\]\]-->)/g,"\n");h=h.replace(/^[\r\n]*|[\r\n]*$/g,"");h=h.replace(/^\s*(\/\/\s*<!--|\/\/\s*<!\[CDATA\[|<!--|<!\[CDATA\[)[\r\n]*/g,"");h=h.replace(/\s*(\/\/\s*\]\]>|\/\/\s*-->|\]\]>|-->|\]\]-->)\s*$/g,"");return h}j=j.replace(/<script([^>]+|)>([\s\S]*?)<\/script>/g,function(h,l,k){if(!l){l=' type="text/javascript"'}l=l.replace(/(type|language)=\"?/,"$&mce-");l=l.replace(/src=\"([^\"]+)\"?/,function(m,n){if(i.url_converter){n=g.encode(i.url_converter.call(i.url_converter_scope||g,g.decode(n),"src","script"))}return'mce_src="'+n+'"'});if(c.trim(k)){k="<!--\n"+f(k)+"\n// -->"}return"<mce:script"+l+">"+k+"</mce:script>"});j=j.replace(/<style([^>]+|)>([\s\S]*?)<\/style>/g,function(h,l,k){if(k){k="<!--\n"+f(k)+"\n-->"}return"<mce:style"+l+">"+k+"</mce:style><style "+l+' mce_bogus="1">'+k+"</style>"});j=j.replace(/<noscript([^>]+|)>([\s\S]*?)<\/noscript>/g,function(h,l,k){return"<mce:noscript"+l+"><!--"+g.encode(k).replace(/--/g,"&#45;&#45;")+"--></mce:noscript>"})}j=j.replace(/<!\[CDATA\[([\s\S]+)\]\]>/g,"<!--[CDATA[$1]]-->");j=j.replace(/<([\w:]+) [^>]*(src|href|style|shape|coords)[^>]*>/gi,function(h,l){function k(o,n,q){var p=q;if(h.indexOf("mce_"+n)!=-1){return o}if(n=="style"){if(g._isRes(q)){return o}if(i.hex_colors){p=p.replace(/rgb\([^\)]+\)/g,function(m){return g.toHex(m)})}if(i.url_converter){p=p.replace(/url\([\'\"]?([^\)\'\"]+)\)/g,function(m,r){return"url("+g.encode(i.url_converter.call(i.url_converter_scope||g,g.decode(r),n,l))+")"})}}else{if(n!="coords"&&n!="shape"){if(i.url_converter){p=g.encode(i.url_converter.call(i.url_converter_scope||g,g.decode(q),n,l))}}}return" "+n+'="'+q+'" mce_'+n+'="'+p+'"'}h=h.replace(/ (src|href|style|coords|shape)=[\"]([^\"]+)[\"]/gi,k);h=h.replace(/ (src|href|style|coords|shape)=[\']([^\']+)[\']/gi,k);return h.replace(/ (src|href|style|coords|shape)=([^\s\"\'>]+)/gi,k)})}return j},getOuterHTML:function(f){var g;f=this.get(f);if(!f){return null}if(f.outerHTML!==undefined){return f.outerHTML}g=(f.ownerDocument||this.doc).createElement("body");g.appendChild(f.cloneNode(true));return g.innerHTML},setOuterHTML:function(i,g,j){var f=this;return this.run(i,function(h){var l,k;h=f.get(h);j=j||h.ownerDocument||f.doc;if(a&&h.nodeType==1){h.outerHTML=g}else{k=j.createElement("body");k.innerHTML=g;l=k.lastChild;while(l){f.insertAfter(l.cloneNode(true),h);l=l.previousSibling}f.remove(h)}})},decode:function(g){var h,i,f;if(/&[^;]+;/.test(g)){h=this.doc.createElement("div");h.innerHTML=g;i=h.firstChild;f="";if(i){do{f+=i.nodeValue}while(i.nextSibling)}return f||g}return g},encode:function(f){return f?(""+f).replace(/[<>&\"]/g,function(h,g){switch(h){case"&":return"&amp;";case'"':return"&quot;";case"<":return"&lt;";case">":return"&gt;"}return h}):f},insertAfter:function(h,g){var f=this;g=f.get(g);return this.run(h,function(k){var j,i;j=g.parentNode;i=g.nextSibling;if(i){j.insertBefore(k,i)}else{j.appendChild(k)}return k})},isBlock:function(f){if(f.nodeType&&f.nodeType!==1){return false}f=f.nodeName||f;return/^(H[1-6]|HR|P|DIV|ADDRESS|PRE|FORM|TABLE|LI|OL|UL|TR|TD|CAPTION|BLOCKQUOTE|CENTER|DL|DT|DD|DIR|FIELDSET|NOSCRIPT|NOFRAMES|MENU|ISINDEX|SAMP)$/.test(f)},replace:function(i,h,f){var g=this;if(b(h,"array")){i=i.cloneNode(true)}return g.run(h,function(j){if(f){e(j.childNodes,function(k){i.appendChild(k.cloneNode(true))})}if(g.fixPsuedoLeaks&&j.nodeType===1){j.parentNode.insertBefore(i,j);g.remove(j);return i}return j.parentNode.replaceChild(i,j)})},findCommonAncestor:function(h,f){var i=h,g;while(i){g=f;while(g&&i!=g){g=g.parentNode}if(i==g){break}i=i.parentNode}if(!i&&h.ownerDocument){return h.ownerDocument.documentElement}return i},toHex:function(f){var h=/^\s*rgb\s*?\(\s*?([0-9]+)\s*?,\s*?([0-9]+)\s*?,\s*?([0-9]+)\s*?\)\s*$/i.exec(f);function g(i){i=parseInt(i).toString(16);return i.length>1?i:"0"+i}if(h){f="#"+g(h[1])+g(h[2])+g(h[3]);return f}return f},getClasses:function(){var l=this,g=[],k,m={},n=l.settings.class_filter,j;if(l.classes){return l.classes}function o(f){e(f.imports,function(i){o(i)});e(f.cssRules||f.rules,function(i){switch(i.type||1){case 1:if(i.selectorText){e(i.selectorText.split(","),function(p){p=p.replace(/^\s*|\s*$|^\s\./g,"");if(/\.mce/.test(p)||!/\.[\w\-]+$/.test(p)){return}j=p;p=p.replace(/.*\.([a-z0-9_\-]+).*/i,"$1");if(n&&!(p=n(p,j))){return}if(!m[p]){g.push({"class":p});m[p]=1}})}break;case 3:o(i.styleSheet);break}})}try{e(l.doc.styleSheets,o)}catch(h){}if(g.length>0){l.classes=g}return g},run:function(j,i,h){var g=this,k;if(g.doc&&typeof(j)==="string"){j=g.get(j)}if(!j){return false}h=h||this;if(!j.nodeType&&(j.length||j.length===0)){k=[];e(j,function(l,f){if(l){if(typeof(l)=="string"){l=g.doc.getElementById(l)}k.push(i.call(h,l,f))}});return k}return i.call(h,j)},getAttribs:function(g){var f;g=this.get(g);if(!g){return[]}if(a){f=[];if(g.nodeName=="OBJECT"){return g.attributes}g.cloneNode(false).outerHTML.replace(/([a-z0-9\:\-_]+)=/gi,function(i,h){f.push({specified:1,nodeName:h})});return f}return g.attributes},destroy:function(g){var f=this;if(f.events){f.events.destroy()}f.win=f.doc=f.root=f.events=null;if(!g){c.removeUnload(f.destroy)}},createRng:function(){var f=this.doc;return f.createRange?f.createRange():new c.dom.Range(this)},split:function(k,j,n){var o=this,f=o.createRng(),l,i,m;function g(q,p){q=q[p];if(q&&q[p]&&q[p].nodeType==1&&h(q[p])){o.remove(q[p])}}function h(p){p=o.getOuterHTML(p);p=p.replace(/<(img|hr|table)/gi,"-");p=p.replace(/<[^>]+>/g,"");return p.replace(/[ \t\r\n]+|&nbsp;|&#160;/g,"")==""}if(k&&j){f.setStartBefore(k);f.setEndBefore(j);l=f.extractContents();f=o.createRng();f.setStartAfter(j);f.setEndAfter(k);i=f.extractContents();m=k.parentNode;g(l,"lastChild");if(!h(l)){m.insertBefore(l,k)}if(n){m.replaceChild(n,j)}else{m.insertBefore(j,k)}g(i,"firstChild");if(!h(i)){m.insertBefore(i,k)}o.remove(k);return n||j}},bind:function(j,f,i,h){var g=this;if(!g.events){g.events=new c.dom.EventUtils()}return g.events.add(j,f,i,h||this)},unbind:function(i,f,h){var g=this;if(!g.events){g.events=new c.dom.EventUtils()}return g.events.remove(i,f,h)},_isRes:function(f){return/^(top|left|bottom|right|width|height)/i.test(f)||/;\s*(top|left|bottom|right|width|height)/i.test(f)}});c.DOM=new c.dom.DOMUtils(document,{process_html:0})})(tinymce);(function(f){var h=0,c=1,e=2,d=tinymce.extend;function g(m,k){var j,l;if(m.parentNode!=k){return -1}for(l=k.firstChild,j=0;l!=m;l=l.nextSibling){j++}return j}function b(k){var j=0;while(k.previousSibling){j++;k=k.previousSibling}return j}function i(j,k){var l;if(j.nodeType==3){return j}if(k<0){return j}l=j.firstChild;while(l!=null&&k>0){--k;l=l.nextSibling}if(l!=null){return l}return j}function a(k){var j=k.doc;d(this,{dom:k,startContainer:j,startOffset:0,endContainer:j,endOffset:0,collapsed:true,commonAncestorContainer:j,START_TO_START:0,START_TO_END:1,END_TO_END:2,END_TO_START:3})}d(a.prototype,{setStart:function(k,j){this._setEndPoint(true,k,j)},setEnd:function(k,j){this._setEndPoint(false,k,j)},setStartBefore:function(j){this.setStart(j.parentNode,b(j))},setStartAfter:function(j){this.setStart(j.parentNode,b(j)+1)},setEndBefore:function(j){this.setEnd(j.parentNode,b(j))},setEndAfter:function(j){this.setEnd(j.parentNode,b(j)+1)},collapse:function(k){var j=this;if(k){j.endContainer=j.startContainer;j.endOffset=j.startOffset}else{j.startContainer=j.endContainer;j.startOffset=j.endOffset}j.collapsed=true},selectNode:function(j){this.setStartBefore(j);this.setEndAfter(j)},selectNodeContents:function(j){this.setStart(j,0);this.setEnd(j,j.nodeType===1?j.childNodes.length:j.nodeValue.length)},compareBoundaryPoints:function(m,n){var l=this,p=l.startContainer,o=l.startOffset,k=l.endContainer,j=l.endOffset;if(m===0){return l._compareBoundaryPoints(p,o,p,o)}if(m===1){return l._compareBoundaryPoints(p,o,k,j)}if(m===2){return l._compareBoundaryPoints(k,j,k,j)}if(m===3){return l._compareBoundaryPoints(k,j,p,o)}},deleteContents:function(){this._traverse(e)},extractContents:function(){return this._traverse(h)},cloneContents:function(){return this._traverse(c)},insertNode:function(m){var j=this,l,k;if(m.nodeType===3||m.nodeType===4){l=j.startContainer.splitText(j.startOffset);j.startContainer.parentNode.insertBefore(m,l)}else{if(j.startContainer.childNodes.length>0){k=j.startContainer.childNodes[j.startOffset]}j.startContainer.insertBefore(m,k)}},surroundContents:function(l){var j=this,k=j.extractContents();j.insertNode(l);l.appendChild(k);j.selectNode(l)},cloneRange:function(){var j=this;return d(new a(j.dom),{startContainer:j.startContainer,startOffset:j.startOffset,endContainer:j.endContainer,endOffset:j.endOffset,collapsed:j.collapsed,commonAncestorContainer:j.commonAncestorContainer})},_isCollapsed:function(){return(this.startContainer==this.endContainer&&this.startOffset==this.endOffset)},_compareBoundaryPoints:function(m,p,k,o){var q,l,j,r,t,s;if(m==k){if(p==o){return 0}else{if(p<o){return -1}else{return 1}}}q=k;while(q&&q.parentNode!=m){q=q.parentNode}if(q){l=0;j=m.firstChild;while(j!=q&&l<p){l++;j=j.nextSibling}if(p<=l){return -1}else{return 1}}q=m;while(q&&q.parentNode!=k){q=q.parentNode}if(q){l=0;j=k.firstChild;while(j!=q&&l<o){l++;j=j.nextSibling}if(l<o){return -1}else{return 1}}r=this.dom.findCommonAncestor(m,k);t=m;while(t&&t.parentNode!=r){t=t.parentNode}if(!t){t=r}s=k;while(s&&s.parentNode!=r){s=s.parentNode}if(!s){s=r}if(t==s){return 0}j=r.firstChild;while(j){if(j==t){return -1}if(j==s){return 1}j=j.nextSibling}},_setEndPoint:function(k,q,p){var l=this,j,m;if(k){l.startContainer=q;l.startOffset=p}else{l.endContainer=q;l.endOffset=p}j=l.endContainer;while(j.parentNode){j=j.parentNode}m=l.startContainer;while(m.parentNode){m=m.parentNode}if(m!=j){l.collapse(k)}else{if(l._compareBoundaryPoints(l.startContainer,l.startOffset,l.endContainer,l.endOffset)>0){l.collapse(k)}}l.collapsed=l._isCollapsed();l.commonAncestorContainer=l.dom.findCommonAncestor(l.startContainer,l.endContainer)},_traverse:function(r){var s=this,q,m=0,v=0,k,o,l,n,j,u;if(s.startContainer==s.endContainer){return s._traverseSameContainer(r)}for(q=s.endContainer,k=q.parentNode;k!=null;q=k,k=k.parentNode){if(k==s.startContainer){return s._traverseCommonStartContainer(q,r)}++m}for(q=s.startContainer,k=q.parentNode;k!=null;q=k,k=k.parentNode){if(k==s.endContainer){return s._traverseCommonEndContainer(q,r)}++v}o=v-m;l=s.startContainer;while(o>0){l=l.parentNode;o--}n=s.endContainer;while(o<0){n=n.parentNode;o++}for(j=l.parentNode,u=n.parentNode;j!=u;j=j.parentNode,u=u.parentNode){l=j;n=u}return s._traverseCommonAncestors(l,n,r)},_traverseSameContainer:function(o){var r=this,q,u,j,k,l,p,m;if(o!=e){q=r.dom.doc.createDocumentFragment()}if(r.startOffset==r.endOffset){return q}if(r.startContainer.nodeType==3){u=r.startContainer.nodeValue;j=u.substring(r.startOffset,r.endOffset);if(o!=c){r.startContainer.deleteData(r.startOffset,r.endOffset-r.startOffset);r.collapse(true)}if(o==e){return null}q.appendChild(r.dom.doc.createTextNode(j));return q}k=i(r.startContainer,r.startOffset);l=r.endOffset-r.startOffset;while(l>0){p=k.nextSibling;m=r._traverseFullySelected(k,o);if(q){q.appendChild(m)}--l;k=p}if(o!=c){r.collapse(true)}return q},_traverseCommonStartContainer:function(j,p){var s=this,r,k,l,m,q,o;if(p!=e){r=s.dom.doc.createDocumentFragment()}k=s._traverseRightBoundary(j,p);if(r){r.appendChild(k)}l=g(j,s.startContainer);m=l-s.startOffset;if(m<=0){if(p!=c){s.setEndBefore(j);s.collapse(false)}return r}k=j.previousSibling;while(m>0){q=k.previousSibling;o=s._traverseFullySelected(k,p);if(r){r.insertBefore(o,r.firstChild)}--m;k=q}if(p!=c){s.setEndBefore(j);s.collapse(false)}return r},_traverseCommonEndContainer:function(m,p){var s=this,r,o,j,k,q,l;if(p!=e){r=s.dom.doc.createDocumentFragment()}j=s._traverseLeftBoundary(m,p);if(r){r.appendChild(j)}o=g(m,s.endContainer);++o;k=s.endOffset-o;j=m.nextSibling;while(k>0){q=j.nextSibling;l=s._traverseFullySelected(j,p);if(r){r.appendChild(l)}--k;j=q}if(p!=c){s.setStartAfter(m);s.collapse(true)}return r},_traverseCommonAncestors:function(p,j,s){var w=this,l,v,o,q,r,k,u,m;if(s!=e){v=w.dom.doc.createDocumentFragment()}l=w._traverseLeftBoundary(p,s);if(v){v.appendChild(l)}o=p.parentNode;q=g(p,o);r=g(j,o);++q;k=r-q;u=p.nextSibling;while(k>0){m=u.nextSibling;l=w._traverseFullySelected(u,s);if(v){v.appendChild(l)}u=m;--k}l=w._traverseRightBoundary(j,s);if(v){v.appendChild(l)}if(s!=c){w.setStartAfter(p);w.collapse(true)}return v},_traverseRightBoundary:function(p,q){var s=this,l=i(s.endContainer,s.endOffset-1),r,o,n,j,k;var m=l!=s.endContainer;if(l==p){return s._traverseNode(l,m,false,q)}r=l.parentNode;o=s._traverseNode(r,false,false,q);while(r!=null){while(l!=null){n=l.previousSibling;j=s._traverseNode(l,m,false,q);if(q!=e){o.insertBefore(j,o.firstChild)}m=true;l=n}if(r==p){return o}l=r.previousSibling;r=r.parentNode;k=s._traverseNode(r,false,false,q);if(q!=e){k.appendChild(o)}o=k}return null},_traverseLeftBoundary:function(p,q){var s=this,m=i(s.startContainer,s.startOffset);var n=m!=s.startContainer,r,o,l,j,k;if(m==p){return s._traverseNode(m,n,true,q)}r=m.parentNode;o=s._traverseNode(r,false,true,q);while(r!=null){while(m!=null){l=m.nextSibling;j=s._traverseNode(m,n,true,q);if(q!=e){o.appendChild(j)}n=true;m=l}if(r==p){return o}m=r.nextSibling;r=r.parentNode;k=s._traverseNode(r,false,true,q);if(q!=e){k.appendChild(o)}o=k}return null},_traverseNode:function(j,o,r,s){var u=this,m,l,p,k,q;if(o){return u._traverseFullySelected(j,s)}if(j.nodeType==3){m=j.nodeValue;if(r){k=u.startOffset;l=m.substring(k);p=m.substring(0,k)}else{k=u.endOffset;l=m.substring(0,k);p=m.substring(k)}if(s!=c){j.nodeValue=p}if(s==e){return null}q=j.cloneNode(false);q.nodeValue=l;return q}if(s==e){return null}return j.cloneNode(false)},_traverseFullySelected:function(l,k){var j=this;if(k!=e){return k==c?l.cloneNode(true):l}l.parentNode.removeChild(l);return null}});f.Range=a})(tinymce.dom);(function(){function a(e){var d=this,h="\uFEFF",b,g;function c(j,i){if(j&&i){if(j.item&&i.item&&j.item(0)===i.item(0)){return 1}if(j.isEqual&&i.isEqual&&i.isEqual(j)){return 1}}return 0}function f(){var m=e.dom,j=e.getRng(),s=m.createRng(),p,k,n,q,o,l;function i(v){var t=v.parentNode.childNodes,u;for(u=t.length-1;u>=0;u--){if(t[u]==v){return u}}return -1}function r(v){var t=j.duplicate(),B,y,u,w,x=0,z=0,A,C;t.collapse(v);B=t.parentElement();t.pasteHTML(h);u=B.childNodes;for(y=0;y<u.length;y++){w=u[y];if(y>0&&(w.nodeType!==3||u[y-1].nodeType!==3)){z++}if(w.nodeType===3){A=w.nodeValue.indexOf(h);if(A!==-1){x+=A;break}x+=w.nodeValue.length}else{x=0}}t.moveStart("character",-1);t.text="";return{index:z,offset:x,parent:B}}n=j.item?j.item(0):j.parentElement();if(n.ownerDocument!=m.doc){return s}if(j.item||!n.hasChildNodes()){s.setStart(n.parentNode,i(n));s.setEnd(s.startContainer,s.startOffset+1);return s}l=e.isCollapsed();p=r(true);k=r(false);p.parent.normalize();k.parent.normalize();q=p.parent.childNodes[Math.min(p.index,p.parent.childNodes.length-1)];if(q.nodeType!=3){s.setStart(p.parent,p.index)}else{s.setStart(p.parent.childNodes[p.index],p.offset)}o=k.parent.childNodes[Math.min(k.index,k.parent.childNodes.length-1)];if(o.nodeType!=3){if(!l){k.index++}s.setEnd(k.parent,k.index)}else{s.setEnd(k.parent.childNodes[k.index],k.offset)}if(!l){q=s.startContainer;if(q.nodeType==1){s.setStart(q,Math.min(s.startOffset,q.childNodes.length))}o=s.endContainer;if(o.nodeType==1){s.setEnd(o,Math.min(s.endOffset,o.childNodes.length))}}d.addRange(s);return s}this.addRange=function(j){var o,m=e.dom.doc.body,p,k,q,l,n,i;q=j.startContainer;l=j.startOffset;n=j.endContainer;i=j.endOffset;o=m.createTextRange();q=q.nodeType==1?q.childNodes[Math.min(l,q.childNodes.length-1)]:q;n=n.nodeType==1?n.childNodes[Math.min(l==i?i:i-1,n.childNodes.length-1)]:n;if(q==n&&q.nodeType==1){if(/^(IMG|TABLE)$/.test(q.nodeName)&&l!=i){o=m.createControlRange();o.addElement(q)}else{o=m.createTextRange();if(!q.hasChildNodes()&&q.canHaveHTML){q.innerHTML=h}o.moveToElementText(q);if(q.innerHTML==h){o.collapse(true);q.removeChild(q.firstChild)}}if(l==i){o.collapse(i<=j.endContainer.childNodes.length-1)}o.select();return}function r(t,v){var u,s,w;if(t.nodeType!=3){return -1}u=t.nodeValue;s=m.createTextRange();t.nodeValue=u.substring(0,v)+h+u.substring(v);s.moveToElementText(t.parentNode);s.findText(h);w=Math.abs(s.moveStart("character",-1048575));t.nodeValue=u;return w}if(j.collapsed){pos=r(q,l);o=m.createTextRange();o.move("character",pos);o.select();return}else{if(q==n&&q.nodeType==3){p=r(q,l);o.move("character",p);o.moveEnd("character",i-l);o.select();return}p=r(q,l);k=r(n,i);o=m.createTextRange();if(p==-1){o.moveToElementText(q);p=0}else{o.move("character",p)}tmpRng=m.createTextRange();if(k==-1){tmpRng.moveToElementText(n)}else{tmpRng.move("character",k)}o.setEndPoint("EndToEnd",tmpRng);o.select();return}};this.getRangeAt=function(){if(!b||!c(g,e.getRng())){b=f();g=e.getRng()}return b};this.destroy=function(){g=b=null}}tinymce.dom.TridentSelection=a})();(function(){var p=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?/g,i=0,d=Object.prototype.toString,n=false;var b=function(D,t,A,v){A=A||[];var e=t=t||document;if(t.nodeType!==1&&t.nodeType!==9){return[]}if(!D||typeof D!=="string"){return A}var B=[],C,y,G,F,z,s,r=true,w=o(t);p.lastIndex=0;while((C=p.exec(D))!==null){B.push(C[1]);if(C[2]){s=RegExp.rightContext;break}}if(B.length>1&&j.exec(D)){if(B.length===2&&f.relative[B[0]]){y=g(B[0]+B[1],t)}else{y=f.relative[B[0]]?[t]:b(B.shift(),t);while(B.length){D=B.shift();if(f.relative[D]){D+=B.shift()}y=g(D,y)}}}else{if(!v&&B.length>1&&t.nodeType===9&&!w&&f.match.ID.test(B[0])&&!f.match.ID.test(B[B.length-1])){var H=b.find(B.shift(),t,w);t=H.expr?b.filter(H.expr,H.set)[0]:H.set[0]}if(t){var H=v?{expr:B.pop(),set:a(v)}:b.find(B.pop(),B.length===1&&(B[0]==="~"||B[0]==="+")&&t.parentNode?t.parentNode:t,w);y=H.expr?b.filter(H.expr,H.set):H.set;if(B.length>0){G=a(y)}else{r=false}while(B.length){var u=B.pop(),x=u;if(!f.relative[u]){u=""}else{x=B.pop()}if(x==null){x=t}f.relative[u](G,x,w)}}else{G=B=[]}}if(!G){G=y}if(!G){throw"Syntax error, unrecognized expression: "+(u||D)}if(d.call(G)==="[object Array]"){if(!r){A.push.apply(A,G)}else{if(t&&t.nodeType===1){for(var E=0;G[E]!=null;E++){if(G[E]&&(G[E]===true||G[E].nodeType===1&&h(t,G[E]))){A.push(y[E])}}}else{for(var E=0;G[E]!=null;E++){if(G[E]&&G[E].nodeType===1){A.push(y[E])}}}}}else{a(G,A)}if(s){b(s,e,A,v);b.uniqueSort(A)}return A};b.uniqueSort=function(r){if(c){n=false;r.sort(c);if(n){for(var e=1;e<r.length;e++){if(r[e]===r[e-1]){r.splice(e--,1)}}}}};b.matches=function(e,r){return b(e,null,null,r)};b.find=function(x,e,y){var w,u;if(!x){return[]}for(var t=0,s=f.order.length;t<s;t++){var v=f.order[t],u;if((u=f.match[v].exec(x))){var r=RegExp.leftContext;if(r.substr(r.length-1)!=="\\"){u[1]=(u[1]||"").replace(/\\/g,"");w=f.find[v](u,e,y);if(w!=null){x=x.replace(f.match[v],"");break}}}}if(!w){w=e.getElementsByTagName("*")}return{set:w,expr:x}};b.filter=function(A,z,D,t){var s=A,F=[],x=z,v,e,w=z&&z[0]&&o(z[0]);while(A&&z.length){for(var y in f.filter){if((v=f.match[y].exec(A))!=null){var r=f.filter[y],E,C;e=false;if(x==F){F=[]}if(f.preFilter[y]){v=f.preFilter[y](v,x,D,F,t,w);if(!v){e=E=true}else{if(v===true){continue}}}if(v){for(var u=0;(C=x[u])!=null;u++){if(C){E=r(C,v,u,x);var B=t^!!E;if(D&&E!=null){if(B){e=true}else{x[u]=false}}else{if(B){F.push(C);e=true}}}}}if(E!==undefined){if(!D){x=F}A=A.replace(f.match[y],"");if(!e){return[]}break}}}if(A==s){if(e==null){throw"Syntax error, unrecognized expression: "+A}else{break}}s=A}return x};var f=b.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF_-]|\\.)+)/,CLASS:/\.((?:[\w\u00c0-\uFFFF_-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF_-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF_-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*_-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\((even|odd|[\dn+-]*)\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF_-]|\\.)+)(?:\((['"]*)((?:\([^\)]+\)|[^\2\(\)]*)+)\2\))?/},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(e){return e.getAttribute("href")}},relative:{"+":function(x,e,w){var u=typeof e==="string",y=u&&!/\W/.test(e),v=u&&!y;if(y&&!w){e=e.toUpperCase()}for(var t=0,s=x.length,r;t<s;t++){if((r=x[t])){while((r=r.previousSibling)&&r.nodeType!==1){}x[t]=v||r&&r.nodeName===e?r||false:r===e}}if(v){b.filter(e,x,true)}},">":function(w,r,x){var u=typeof r==="string";if(u&&!/\W/.test(r)){r=x?r:r.toUpperCase();for(var s=0,e=w.length;s<e;s++){var v=w[s];if(v){var t=v.parentNode;w[s]=t.nodeName===r?t:false}}}else{for(var s=0,e=w.length;s<e;s++){var v=w[s];if(v){w[s]=u?v.parentNode:v.parentNode===r}}if(u){b.filter(r,w,true)}}},"":function(t,r,v){var s=i++,e=q;if(!r.match(/\W/)){var u=r=v?r:r.toUpperCase();e=m}e("parentNode",r,s,t,u,v)},"~":function(t,r,v){var s=i++,e=q;if(typeof r==="string"&&!r.match(/\W/)){var u=r=v?r:r.toUpperCase();e=m}e("previousSibling",r,s,t,u,v)}},find:{ID:function(r,s,t){if(typeof s.getElementById!=="undefined"&&!t){var e=s.getElementById(r[1]);return e?[e]:[]}},NAME:function(s,v,w){if(typeof v.getElementsByName!=="undefined"){var r=[],u=v.getElementsByName(s[1]);for(var t=0,e=u.length;t<e;t++){if(u[t].getAttribute("name")===s[1]){r.push(u[t])}}return r.length===0?null:r}},TAG:function(e,r){return r.getElementsByTagName(e[1])}},preFilter:{CLASS:function(t,r,s,e,w,x){t=" "+t[1].replace(/\\/g,"")+" ";if(x){return t}for(var u=0,v;(v=r[u])!=null;u++){if(v){if(w^(v.className&&(" "+v.className+" ").indexOf(t)>=0)){if(!s){e.push(v)}}else{if(s){r[u]=false}}}}return false},ID:function(e){return e[1].replace(/\\/g,"")},TAG:function(r,e){for(var s=0;e[s]===false;s++){}return e[s]&&o(e[s])?r[1]:r[1].toUpperCase()},CHILD:function(e){if(e[1]=="nth"){var r=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(e[2]=="even"&&"2n"||e[2]=="odd"&&"2n+1"||!/\D/.test(e[2])&&"0n+"+e[2]||e[2]);e[2]=(r[1]+(r[2]||1))-0;e[3]=r[3]-0}e[0]=i++;return e},ATTR:function(u,r,s,e,v,w){var t=u[1].replace(/\\/g,"");if(!w&&f.attrMap[t]){u[1]=f.attrMap[t]}if(u[2]==="~="){u[4]=" "+u[4]+" "}return u},PSEUDO:function(u,r,s,e,v){if(u[1]==="not"){if(u[3].match(p).length>1||/^\w/.test(u[3])){u[3]=b(u[3],null,null,r)}else{var t=b.filter(u[3],r,s,true^v);if(!s){e.push.apply(e,t)}return false}}else{if(f.match.POS.test(u[0])||f.match.CHILD.test(u[0])){return true}}return u},POS:function(e){e.unshift(true);return e}},filters:{enabled:function(e){return e.disabled===false&&e.type!=="hidden"},disabled:function(e){return e.disabled===true},checked:function(e){return e.checked===true},selected:function(e){e.parentNode.selectedIndex;return e.selected===true},parent:function(e){return !!e.firstChild},empty:function(e){return !e.firstChild},has:function(s,r,e){return !!b(e[3],s).length},header:function(e){return/h\d/i.test(e.nodeName)},text:function(e){return"text"===e.type},radio:function(e){return"radio"===e.type},checkbox:function(e){return"checkbox"===e.type},file:function(e){return"file"===e.type},password:function(e){return"password"===e.type},submit:function(e){return"submit"===e.type},image:function(e){return"image"===e.type},reset:function(e){return"reset"===e.type},button:function(e){return"button"===e.type||e.nodeName.toUpperCase()==="BUTTON"},input:function(e){return/input|select|textarea|button/i.test(e.nodeName)}},setFilters:{first:function(r,e){return e===0},last:function(s,r,e,t){return r===t.length-1},even:function(r,e){return e%2===0},odd:function(r,e){return e%2===1},lt:function(s,r,e){return r<e[3]-0},gt:function(s,r,e){return r>e[3]-0},nth:function(s,r,e){return e[3]-0==r},eq:function(s,r,e){return e[3]-0==r}},filter:{PSEUDO:function(w,s,t,x){var r=s[1],u=f.filters[r];if(u){return u(w,t,s,x)}else{if(r==="contains"){return(w.textContent||w.innerText||"").indexOf(s[3])>=0}else{if(r==="not"){var v=s[3];for(var t=0,e=v.length;t<e;t++){if(v[t]===w){return false}}return true}}}},CHILD:function(e,t){var w=t[1],r=e;switch(w){case"only":case"first":while(r=r.previousSibling){if(r.nodeType===1){return false}}if(w=="first"){return true}r=e;case"last":while(r=r.nextSibling){if(r.nodeType===1){return false}}return true;case"nth":var s=t[2],z=t[3];if(s==1&&z==0){return true}var v=t[0],y=e.parentNode;if(y&&(y.sizcache!==v||!e.nodeIndex)){var u=0;for(r=y.firstChild;r;r=r.nextSibling){if(r.nodeType===1){r.nodeIndex=++u}}y.sizcache=v}var x=e.nodeIndex-z;if(s==0){return x==0}else{return(x%s==0&&x/s>=0)}}},ID:function(r,e){return r.nodeType===1&&r.getAttribute("id")===e},TAG:function(r,e){return(e==="*"&&r.nodeType===1)||r.nodeName===e},CLASS:function(r,e){return(" "+(r.className||r.getAttribute("class"))+" ").indexOf(e)>-1},ATTR:function(v,t){var s=t[1],e=f.attrHandle[s]?f.attrHandle[s](v):v[s]!=null?v[s]:v.getAttribute(s),w=e+"",u=t[2],r=t[4];return e==null?u==="!=":u==="="?w===r:u==="*="?w.indexOf(r)>=0:u==="~="?(" "+w+" ").indexOf(r)>=0:!r?w&&e!==false:u==="!="?w!=r:u==="^="?w.indexOf(r)===0:u==="$="?w.substr(w.length-r.length)===r:u==="|="?w===r||w.substr(0,r.length+1)===r+"-":false},POS:function(u,r,s,v){var e=r[2],t=f.setFilters[e];if(t){return t(u,s,r,v)}}}};var j=f.match.POS;for(var l in f.match){f.match[l]=new RegExp(f.match[l].source+/(?![^\[]*\])(?![^\(]*\))/.source)}var a=function(r,e){r=Array.prototype.slice.call(r);if(e){e.push.apply(e,r);return e}return r};try{Array.prototype.slice.call(document.documentElement.childNodes)}catch(k){a=function(u,t){var r=t||[];if(d.call(u)==="[object Array]"){Array.prototype.push.apply(r,u)}else{if(typeof u.length==="number"){for(var s=0,e=u.length;s<e;s++){r.push(u[s])}}else{for(var s=0;u[s];s++){r.push(u[s])}}}return r}}var c;if(document.documentElement.compareDocumentPosition){c=function(r,e){var s=r.compareDocumentPosition(e)&4?-1:r===e?0:1;if(s===0){n=true}return s}}else{if("sourceIndex" in document.documentElement){c=function(r,e){var s=r.sourceIndex-e.sourceIndex;if(s===0){n=true}return s}}else{if(document.createRange){c=function(t,r){var s=t.ownerDocument.createRange(),e=r.ownerDocument.createRange();s.setStart(t,0);s.setEnd(t,0);e.setStart(r,0);e.setEnd(r,0);var u=s.compareBoundaryPoints(Range.START_TO_END,e);if(u===0){n=true}return u}}}}(function(){var r=document.createElement("div"),s="script"+(new Date).getTime();r.innerHTML="<a name='"+s+"'/>";var e=document.documentElement;e.insertBefore(r,e.firstChild);if(!!document.getElementById(s)){f.find.ID=function(u,v,w){if(typeof v.getElementById!=="undefined"&&!w){var t=v.getElementById(u[1]);return t?t.id===u[1]||typeof t.getAttributeNode!=="undefined"&&t.getAttributeNode("id").nodeValue===u[1]?[t]:undefined:[]}};f.filter.ID=function(v,t){var u=typeof v.getAttributeNode!=="undefined"&&v.getAttributeNode("id");return v.nodeType===1&&u&&u.nodeValue===t}}e.removeChild(r)})();(function(){var e=document.createElement("div");e.appendChild(document.createComment(""));if(e.getElementsByTagName("*").length>0){f.find.TAG=function(r,v){var u=v.getElementsByTagName(r[1]);if(r[1]==="*"){var t=[];for(var s=0;u[s];s++){if(u[s].nodeType===1){t.push(u[s])}}u=t}return u}}e.innerHTML="<a href='#'></a>";if(e.firstChild&&typeof e.firstChild.getAttribute!=="undefined"&&e.firstChild.getAttribute("href")!=="#"){f.attrHandle.href=function(r){return r.getAttribute("href",2)}}})();if(document.querySelectorAll){(function(){var e=b,s=document.createElement("div");s.innerHTML="<p class='TEST'></p>";if(s.querySelectorAll&&s.querySelectorAll(".TEST").length===0){return}b=function(w,v,t,u){v=v||document;if(!u&&v.nodeType===9&&!o(v)){try{return a(v.querySelectorAll(w),t)}catch(x){}}return e(w,v,t,u)};for(var r in e){b[r]=e[r]}})()}if(document.getElementsByClassName&&document.documentElement.getElementsByClassName){(function(){var e=document.createElement("div");e.innerHTML="<div class='test e'></div><div class='test'></div>";if(e.getElementsByClassName("e").length===0){return}e.lastChild.className="e";if(e.getElementsByClassName("e").length===1){return}f.order.splice(1,0,"CLASS");f.find.CLASS=function(r,s,t){if(typeof s.getElementsByClassName!=="undefined"&&!t){return s.getElementsByClassName(r[1])}}})()}function m(r,w,v,A,x,z){var y=r=="previousSibling"&&!z;for(var t=0,s=A.length;t<s;t++){var e=A[t];if(e){if(y&&e.nodeType===1){e.sizcache=v;e.sizset=t}e=e[r];var u=false;while(e){if(e.sizcache===v){u=A[e.sizset];break}if(e.nodeType===1&&!z){e.sizcache=v;e.sizset=t}if(e.nodeName===w){u=e;break}e=e[r]}A[t]=u}}}function q(r,w,v,A,x,z){var y=r=="previousSibling"&&!z;for(var t=0,s=A.length;t<s;t++){var e=A[t];if(e){if(y&&e.nodeType===1){e.sizcache=v;e.sizset=t}e=e[r];var u=false;while(e){if(e.sizcache===v){u=A[e.sizset];break}if(e.nodeType===1){if(!z){e.sizcache=v;e.sizset=t}if(typeof w!=="string"){if(e===w){u=true;break}}else{if(b.filter(w,[e]).length>0){u=e;break}}}e=e[r]}A[t]=u}}}var h=document.compareDocumentPosition?function(r,e){return r.compareDocumentPosition(e)&16}:function(r,e){return r!==e&&(r.contains?r.contains(e):true)};var o=function(e){return e.nodeType===9&&e.documentElement.nodeName!=="HTML"||!!e.ownerDocument&&e.ownerDocument.documentElement.nodeName!=="HTML"};var g=function(e,x){var t=[],u="",v,s=x.nodeType?[x]:x;while((v=f.match.PSEUDO.exec(e))){u+=v[0];e=e.replace(f.match.PSEUDO,"")}e=f.relative[e]?e+"*":e;for(var w=0,r=s.length;w<r;w++){b(e,s[w],t)}return b.filter(u,t)};window.tinymce.dom.Sizzle=b})();(function(d){var f=d.each,c=d.DOM,b=d.isIE,e=d.isWebKit,a;d.create("tinymce.dom.EventUtils",{EventUtils:function(){this.inits=[];this.events=[]},add:function(m,p,l,j){var g,h=this,i=h.events,k;if(p instanceof Array){k=[];f(p,function(o){k.push(h.add(m,o,l,j))});return k}if(m&&m.hasOwnProperty&&m instanceof Array){k=[];f(m,function(n){n=c.get(n);k.push(h.add(n,p,l,j))});return k}m=c.get(m);if(!m){return}g=function(n){if(h.disabled){return}n=n||window.event;if(n&&b){if(!n.target){n.target=n.srcElement}d.extend(n,h._stoppers)}if(!j){return l(n)}return l.call(j,n)};if(p=="unload"){d.unloads.unshift({func:g});return g}if(p=="init"){if(h.domLoaded){g()}else{h.inits.push(g)}return g}i.push({obj:m,name:p,func:l,cfunc:g,scope:j});h._add(m,p,g);return l},remove:function(l,m,k){var h=this,g=h.events,i=false,j;if(l&&l.hasOwnProperty&&l instanceof Array){j=[];f(l,function(n){n=c.get(n);j.push(h.remove(n,m,k))});return j}l=c.get(l);f(g,function(o,n){if(o.obj==l&&o.name==m&&(!k||(o.func==k||o.cfunc==k))){g.splice(n,1);h._remove(l,m,o.cfunc);i=true;return false}});return i},clear:function(l){var j=this,g=j.events,h,k;if(l){l=c.get(l);for(h=g.length-1;h>=0;h--){k=g[h];if(k.obj===l){j._remove(k.obj,k.name,k.cfunc);k.obj=k.cfunc=null;g.splice(h,1)}}}},cancel:function(g){if(!g){return false}this.stop(g);return this.prevent(g)},stop:function(g){if(g.stopPropagation){g.stopPropagation()}else{g.cancelBubble=true}return false},prevent:function(g){if(g.preventDefault){g.preventDefault()}else{g.returnValue=false}return false},destroy:function(){var g=this;f(g.events,function(j,h){g._remove(j.obj,j.name,j.cfunc);j.obj=j.cfunc=null});g.events=[];g=null},_add:function(h,i,g){if(h.attachEvent){h.attachEvent("on"+i,g)}else{if(h.addEventListener){h.addEventListener(i,g,false)}else{h["on"+i]=g}}},_remove:function(i,j,h){if(i){try{if(i.detachEvent){i.detachEvent("on"+j,h)}else{if(i.removeEventListener){i.removeEventListener(j,h,false)}else{i["on"+j]=null}}}catch(g){}}},_pageInit:function(h){var g=this;if(g.domLoaded){return}g.domLoaded=true;f(g.inits,function(i){i()});g.inits=[]},_wait:function(i){var g=this,h=i.document;if(i.tinyMCE_GZ&&tinyMCE_GZ.loaded){g.domLoaded=1;return}if(h.attachEvent){h.attachEvent("onreadystatechange",function(){if(h.readyState==="complete"){h.detachEvent("onreadystatechange",arguments.callee);g._pageInit(i)}});if(h.documentElement.doScroll&&i==i.top){(function(){if(g.domLoaded){return}try{h.documentElement.doScroll("left")}catch(j){setTimeout(arguments.callee,0);return}g._pageInit(i)})()}}else{if(h.addEventListener){g._add(i,"DOMContentLoaded",function(){g._pageInit(i)})}}g._add(i,"load",function(){g._pageInit(i)})},_stoppers:{preventDefault:function(){this.returnValue=false},stopPropagation:function(){this.cancelBubble=true}}});a=d.dom.Event=new d.dom.EventUtils();a._wait(window);d.addUnload(function(){a.destroy()})})(tinymce);(function(a){var b=a.each;a.create("tinymce.dom.Element",{Element:function(g,e){var c=this,f,d;e=e||{};c.id=g;c.dom=f=e.dom||a.DOM;c.settings=e;if(!a.isIE){d=c.dom.get(c.id)}b(["getPos","getRect","getParent","add","setStyle","getStyle","setStyles","setAttrib","setAttribs","getAttrib","addClass","removeClass","hasClass","getOuterHTML","setOuterHTML","remove","show","hide","isHidden","setHTML","get"],function(h){c[h]=function(){var j=[g],k;for(k=0;k<arguments.length;k++){j.push(arguments[k])}j=f[h].apply(f,j);c.update(h);return j}})},on:function(e,d,c){return a.dom.Event.add(this.id,e,d,c)},getXY:function(){return{x:parseInt(this.getStyle("left")),y:parseInt(this.getStyle("top"))}},getSize:function(){var c=this.dom.get(this.id);return{w:parseInt(this.getStyle("width")||c.clientWidth),h:parseInt(this.getStyle("height")||c.clientHeight)}},moveTo:function(c,d){this.setStyles({left:c,top:d})},moveBy:function(c,e){var d=this.getXY();this.moveTo(d.x+c,d.y+e)},resizeTo:function(c,d){this.setStyles({width:c,height:d})},resizeBy:function(c,e){var d=this.getSize();this.resizeTo(d.w+c,d.h+e)},update:function(d){var e=this,c,f=e.dom;if(a.isIE6&&e.settings.blocker){d=d||"";if(d.indexOf("get")===0||d.indexOf("has")===0||d.indexOf("is")===0){return}if(d=="remove"){f.remove(e.blocker);return}if(!e.blocker){e.blocker=f.uniqueId();c=f.add(e.settings.container||f.getRoot(),"iframe",{id:e.blocker,style:"position:absolute;",frameBorder:0,src:'javascript:""'});f.setStyle(c,"opacity",0)}else{c=f.get(e.blocker)}f.setStyle(c,"left",e.getStyle("left",1));f.setStyle(c,"top",e.getStyle("top",1));f.setStyle(c,"width",e.getStyle("width",1));f.setStyle(c,"height",e.getStyle("height",1));f.setStyle(c,"display",e.getStyle("display",1));f.setStyle(c,"zIndex",parseInt(e.getStyle("zIndex",1)||0)-1)}}})})(tinymce);(function(c){function e(f){return f.replace(/[\n\r]+/g,"")}var b=c.is,a=c.isIE,d=c.each;c.create("tinymce.dom.Selection",{Selection:function(i,h,g){var f=this;f.dom=i;f.win=h;f.serializer=g;d(["onBeforeSetContent","onBeforeGetContent","onSetContent","onGetContent"],function(j){f[j]=new c.util.Dispatcher(f)});if(!f.win.getSelection){f.tridentSel=new c.dom.TridentSelection(f)}c.addUnload(f.destroy,f)},getContent:function(g){var f=this,h=f.getRng(),l=f.dom.create("body"),j=f.getSel(),i,k,m;g=g||{};i=k="";g.get=true;g.format=g.format||"html";f.onBeforeGetContent.dispatch(f,g);if(g.format=="text"){return f.isCollapsed()?"":(h.text||(j.toString?j.toString():""))}if(h.cloneContents){m=h.cloneContents();if(m){l.appendChild(m)}}else{if(b(h.item)||b(h.htmlText)){l.innerHTML=h.item?h.item(0).outerHTML:h.htmlText}else{l.innerHTML=h.toString()}}if(/^\s/.test(l.innerHTML)){i=" "}if(/\s+$/.test(l.innerHTML)){k=" "}g.getInner=true;g.content=f.isCollapsed()?"":i+f.serializer.serialize(l,g)+k;f.onGetContent.dispatch(f,g);return g.content},setContent:function(i,g){var f=this,j=f.getRng(),l,k=f.win.document;g=g||{format:"html"};g.set=true;i=g.content=f.dom.processHTML(i);f.onBeforeSetContent.dispatch(f,g);i=g.content;if(j.insertNode){i+='<span id="__caret">_</span>';j.deleteContents();j.insertNode(f.getRng().createContextualFragment(i));l=f.dom.get("__caret");j=k.createRange();j.setStartBefore(l);j.setEndAfter(l);f.setRng(j);f.dom.remove("__caret")}else{if(j.item){k.execCommand("Delete",false,null);j=f.getRng()}j.pasteHTML(i)}f.onSetContent.dispatch(f,g)},getStart:function(){var f=this,g=f.getRng(),h;if(a){if(g.item){return g.item(0)}g=g.duplicate();g.collapse(1);h=g.parentElement();if(h&&h.nodeName=="BODY"){return h.firstChild}return h}else{h=g.startContainer;if(h.nodeName=="BODY"){return h.firstChild}return f.dom.getParent(h,"*")}},getEnd:function(){var f=this,g=f.getRng(),h;if(a){if(g.item){return g.item(0)}g=g.duplicate();g.collapse(0);h=g.parentElement();if(h&&h.nodeName=="BODY"){return h.lastChild}return h}else{h=g.endContainer;if(h.nodeName=="BODY"){return h.lastChild}return f.dom.getParent(h,"*")}},getBookmark:function(x){var j=this,m=j.getRng(),f,n,l,u=j.dom.getViewPort(j.win),v,p,z,o,w=-16777215,k,h=j.dom.getRoot(),g=0,i=0,y;n=u.x;l=u.y;if(x){return{rng:m,scrollX:n,scrollY:l}}if(a){if(m.item){v=m.item(0);d(j.dom.select(v.nodeName),function(s,r){if(v==s){p=r;return false}});return{tag:v.nodeName,index:p,scrollX:n,scrollY:l}}f=j.dom.doc.body.createTextRange();f.moveToElementText(h);f.collapse(true);z=Math.abs(f.move("character",w));f=m.duplicate();f.collapse(true);p=Math.abs(f.move("character",w));f=m.duplicate();f.collapse(false);o=Math.abs(f.move("character",w))-p;return{start:p-z,length:o,scrollX:n,scrollY:l}}v=j.getNode();k=j.getSel();if(!k){return null}if(v&&v.nodeName=="IMG"){return{scrollX:n,scrollY:l}}function q(A,D,t){var s=j.dom.doc.createTreeWalker(A,NodeFilter.SHOW_TEXT,null,false),E,B=0,C={};while((E=s.nextNode())!=null){if(E==D){C.start=B}if(E==t){C.end=B;return C}B+=e(E.nodeValue||"").length}return null}if(k.anchorNode==k.focusNode&&k.anchorOffset==k.focusOffset){v=q(h,k.anchorNode,k.focusNode);if(!v){return{scrollX:n,scrollY:l}}e(k.anchorNode.nodeValue||"").replace(/^\s+/,function(r){g=r.length});return{start:Math.max(v.start+k.anchorOffset-g,0),end:Math.max(v.end+k.focusOffset-g,0),scrollX:n,scrollY:l,beg:k.anchorOffset-g==0}}else{v=q(h,m.startContainer,m.endContainer);if(!v){return{scrollX:n,scrollY:l}}return{start:Math.max(v.start+m.startOffset-g,0),end:Math.max(v.end+m.endOffset-i,0),scrollX:n,scrollY:l,beg:m.startOffset-g==0}}},moveToBookmark:function(n){var o=this,g=o.getRng(),p=o.getSel(),j=o.dom.getRoot(),m,h,k;function i(q,t,D){var B=o.dom.doc.createTreeWalker(q,NodeFilter.SHOW_TEXT,null,false),x,s=0,A={},u,C,z,y;while((x=B.nextNode())!=null){z=y=0;k=x.nodeValue||"";h=e(k).length;s+=h;if(s>=t&&!A.startNode){u=t-(s-h);if(n.beg&&u>=h){continue}A.startNode=x;A.startOffset=u+y}if(s>=D){A.endNode=x;A.endOffset=D-(s-h)+y;return A}}return null}if(!n){return false}o.win.scrollTo(n.scrollX,n.scrollY);if(a){if(g=n.rng){try{g.select()}catch(l){}return true}o.win.focus();if(n.tag){g=j.createControlRange();d(o.dom.select(n.tag),function(r,q){if(q==n.index){g.addElement(r)}})}else{try{if(n.start<0){return true}g=p.createRange();g.moveToElementText(j);g.collapse(true);g.moveStart("character",n.start);g.moveEnd("character",n.length)}catch(f){return true}}try{g.select()}catch(l){}return true}if(!p){return false}if(n.rng){p.removeAllRanges();p.addRange(n.rng)}else{if(b(n.start)&&b(n.end)){try{m=i(j,n.start,n.end);if(m){g=o.dom.doc.createRange();g.setStart(m.startNode,m.startOffset);g.setEnd(m.endNode,m.endOffset);p.removeAllRanges();p.addRange(g)}if(!c.isOpera){o.win.focus()}}catch(l){}}}},select:function(g,l){var p=this,f=p.getRng(),q=p.getSel(),o,m,k,j=p.win.document;function h(u,t){var s,r;if(u){s=j.createTreeWalker(u,NodeFilter.SHOW_TEXT,null,false);while(u=s.nextNode()){r=u;if(c.trim(u.nodeValue).length!=0){if(t){return u}else{r=u}}}}return r}if(a){try{o=j.body;if(/^(IMG|TABLE)$/.test(g.nodeName)){f=o.createControlRange();f.addElement(g)}else{f=o.createTextRange();f.moveToElementText(g)}f.select()}catch(i){}}else{if(l){m=h(g,1)||p.dom.select("br:first",g)[0];k=h(g,0)||p.dom.select("br:last",g)[0];if(m&&k){f=j.createRange();if(m.nodeName=="BR"){f.setStartBefore(m)}else{f.setStart(m,0)}if(k.nodeName=="BR"){f.setEndBefore(k)}else{f.setEnd(k,k.nodeValue.length)}}else{f.selectNode(g)}}else{f.selectNode(g)}p.setRng(f)}return g},isCollapsed:function(){var f=this,h=f.getRng(),g=f.getSel();if(!h||h.item){return false}return !g||h.boundingWidth==0||h.collapsed},collapse:function(f){var g=this,h=g.getRng(),i;if(h.item){i=h.item(0);h=this.win.document.body.createTextRange();h.moveToElementText(i)}h.collapse(!!f);g.setRng(h)},getSel:function(){var g=this,f=this.win;return f.getSelection?f.getSelection():f.document.selection},getRng:function(j){var g=this,h,i;if(j&&g.tridentSel){return g.tridentSel.getRangeAt(0)}try{if(h=g.getSel()){i=h.rangeCount>0?h.getRangeAt(0):(h.createRange?h.createRange():g.win.document.createRange())}}catch(f){}if(!i){i=a?g.win.document.body.createTextRange():g.win.document.createRange()}return i},setRng:function(i){var h,g=this;if(!g.tridentSel){h=g.getSel();if(h){h.removeAllRanges();h.addRange(i)}}else{if(i.cloneRange){g.tridentSel.addRange(i);return}try{i.select()}catch(f){}}},setNode:function(g){var f=this;f.setContent(f.dom.getOuterHTML(g));return g},getNode:function(){var f=this,h=f.getRng(),g=f.getSel(),i;if(!a){if(!h){return f.dom.getRoot()}i=h.commonAncestorContainer;if(!h.collapsed){if(c.isWebKit&&g.anchorNode&&g.anchorNode.nodeType==1){return g.anchorNode.childNodes[g.anchorOffset]}if(h.startContainer==h.endContainer){if(h.startOffset-h.endOffset<2){if(h.startContainer.hasChildNodes()){i=h.startContainer.childNodes[h.startOffset]}}}}return f.dom.getParent(i,"*")}return h.item?h.item(0):h.parentElement()},getSelectedBlocks:function(g,f){var i=this,j=i.dom,m,h,l,k=[];m=j.getParent(g||i.getStart(),j.isBlock);h=j.getParent(f||i.getEnd(),j.isBlock);if(m){k.push(m)}if(m&&h&&m!=h){l=m;while((l=l.nextSibling)&&l!=h){if(j.isBlock(l)){k.push(l)}}}if(h&&m!=h){k.push(h)}return k},destroy:function(g){var f=this;f.win=null;if(f.tridentSel){f.tridentSel.destroy()}if(!g){c.removeUnload(f.destroy)}}})})(tinymce);(function(a){a.create("tinymce.dom.XMLWriter",{node:null,XMLWriter:function(c){function b(){var e=document.implementation;if(!e||!e.createDocument){try{return new ActiveXObject("MSXML2.DOMDocument")}catch(d){}try{return new ActiveXObject("Microsoft.XmlDom")}catch(d){}}else{return e.createDocument("","",null)}}this.doc=b();this.valid=a.isOpera||a.isWebKit;this.reset()},reset:function(){var b=this,c=b.doc;if(c.firstChild){c.removeChild(c.firstChild)}b.node=c.appendChild(c.createElement("html"))},writeStartElement:function(c){var b=this;b.node=b.node.appendChild(b.doc.createElement(c))},writeAttribute:function(c,b){if(this.valid){b=b.replace(/>/g,"%MCGT%")}this.node.setAttribute(c,b)},writeEndElement:function(){this.node=this.node.parentNode},writeFullEndElement:function(){var b=this,c=b.node;c.appendChild(b.doc.createTextNode(""));b.node=c.parentNode},writeText:function(b){if(this.valid){b=b.replace(/>/g,"%MCGT%")}this.node.appendChild(this.doc.createTextNode(b))},writeCDATA:function(b){this.node.appendChild(this.doc.createCDATASection(b))},writeComment:function(b){if(a.isIE){b=b.replace(/^\-|\-$/g," ")}this.node.appendChild(this.doc.createComment(b.replace(/\-\-/g," ")))},getContent:function(){var b;b=this.doc.xml||new XMLSerializer().serializeToString(this.doc);b=b.replace(/<\?[^?]+\?>|<html>|<\/html>|<html\/>|<!DOCTYPE[^>]+>/g,"");b=b.replace(/ ?\/>/g," />");if(this.valid){b=b.replace(/\%MCGT%/g,"&gt;")}return b}})})(tinymce);(function(a){a.create("tinymce.dom.StringWriter",{str:null,tags:null,count:0,settings:null,indent:null,StringWriter:function(b){this.settings=a.extend({indent_char:" ",indentation:0},b);this.reset()},reset:function(){this.indent="";this.str="";this.tags=[];this.count=0},writeStartElement:function(b){this._writeAttributesEnd();this.writeRaw("<"+b);this.tags.push(b);this.inAttr=true;this.count++;this.elementCount=this.count},writeAttribute:function(d,b){var c=this;c.writeRaw(" "+c.encode(d)+'="'+c.encode(b)+'"')},writeEndElement:function(){var b;if(this.tags.length>0){b=this.tags.pop();if(this._writeAttributesEnd(1)){this.writeRaw("</"+b+">")}if(this.settings.indentation>0){this.writeRaw("\n")}}},writeFullEndElement:function(){if(this.tags.length>0){this._writeAttributesEnd();this.writeRaw("</"+this.tags.pop()+">");if(this.settings.indentation>0){this.writeRaw("\n")}}},writeText:function(b){this._writeAttributesEnd();this.writeRaw(this.encode(b));this.count++},writeCDATA:function(b){this._writeAttributesEnd();this.writeRaw("<![CDATA["+b+"]]>");this.count++},writeComment:function(b){this._writeAttributesEnd();this.writeRaw("<!-- "+b+"-->");this.count++},writeRaw:function(b){this.str+=b},encode:function(b){return b.replace(/[<>&"]/g,function(c){switch(c){case"<":return"&lt;";case">":return"&gt;";case"&":return"&amp;";case'"':return"&quot;"}return c})},getContent:function(){return this.str},_writeAttributesEnd:function(b){if(!this.inAttr){return}this.inAttr=false;if(b&&this.elementCount==this.count){this.writeRaw(" />");return false}this.writeRaw(">");return true}})})(tinymce);(function(e){var g=e.extend,f=e.each,b=e.util.Dispatcher,d=e.isIE,a=e.isGecko;function c(h){return h.replace(/([?+*])/g,".$1")}e.create("tinymce.dom.Serializer",{Serializer:function(j){var i=this;i.key=0;i.onPreProcess=new b(i);i.onPostProcess=new b(i);try{i.writer=new e.dom.XMLWriter()}catch(h){i.writer=new e.dom.StringWriter()}i.settings=j=g({dom:e.DOM,valid_nodes:0,node_filter:0,attr_filter:0,invalid_attrs:/^(mce_|_moz_|sizset|sizcache)/,closed:/^(br|hr|input|meta|img|link|param|area)$/,entity_encoding:"named",entities:"160,nbsp,161,iexcl,162,cent,163,pound,164,curren,165,yen,166,brvbar,167,sect,168,uml,169,copy,170,ordf,171,laquo,172,not,173,shy,174,reg,175,macr,176,deg,177,plusmn,178,sup2,179,sup3,180,acute,181,micro,182,para,183,middot,184,cedil,185,sup1,186,ordm,187,raquo,188,frac14,189,frac12,190,frac34,191,iquest,192,Agrave,193,Aacute,194,Acirc,195,Atilde,196,Auml,197,Aring,198,AElig,199,Ccedil,200,Egrave,201,Eacute,202,Ecirc,203,Euml,204,Igrave,205,Iacute,206,Icirc,207,Iuml,208,ETH,209,Ntilde,210,Ograve,211,Oacute,212,Ocirc,213,Otilde,214,Ouml,215,times,216,Oslash,217,Ugrave,218,Uacute,219,Ucirc,220,Uuml,221,Yacute,222,THORN,223,szlig,224,agrave,225,aacute,226,acirc,227,atilde,228,auml,229,aring,230,aelig,231,ccedil,232,egrave,233,eacute,234,ecirc,235,euml,236,igrave,237,iacute,238,icirc,239,iuml,240,eth,241,ntilde,242,ograve,243,oacute,244,ocirc,245,otilde,246,ouml,247,divide,248,oslash,249,ugrave,250,uacute,251,ucirc,252,uuml,253,yacute,254,thorn,255,yuml,402,fnof,913,Alpha,914,Beta,915,Gamma,916,Delta,917,Epsilon,918,Zeta,919,Eta,920,Theta,921,Iota,922,Kappa,923,Lambda,924,Mu,925,Nu,926,Xi,927,Omicron,928,Pi,929,Rho,931,Sigma,932,Tau,933,Upsilon,934,Phi,935,Chi,936,Psi,937,Omega,945,alpha,946,beta,947,gamma,948,delta,949,epsilon,950,zeta,951,eta,952,theta,953,iota,954,kappa,955,lambda,956,mu,957,nu,958,xi,959,omicron,960,pi,961,rho,962,sigmaf,963,sigma,964,tau,965,upsilon,966,phi,967,chi,968,psi,969,omega,977,thetasym,978,upsih,982,piv,8226,bull,8230,hellip,8242,prime,8243,Prime,8254,oline,8260,frasl,8472,weierp,8465,image,8476,real,8482,trade,8501,alefsym,8592,larr,8593,uarr,8594,rarr,8595,darr,8596,harr,8629,crarr,8656,lArr,8657,uArr,8658,rArr,8659,dArr,8660,hArr,8704,forall,8706,part,8707,exist,8709,empty,8711,nabla,8712,isin,8713,notin,8715,ni,8719,prod,8721,sum,8722,minus,8727,lowast,8730,radic,8733,prop,8734,infin,8736,ang,8743,and,8744,or,8745,cap,8746,cup,8747,int,8756,there4,8764,sim,8773,cong,8776,asymp,8800,ne,8801,equiv,8804,le,8805,ge,8834,sub,8835,sup,8836,nsub,8838,sube,8839,supe,8853,oplus,8855,otimes,8869,perp,8901,sdot,8968,lceil,8969,rceil,8970,lfloor,8971,rfloor,9001,lang,9002,rang,9674,loz,9824,spades,9827,clubs,9829,hearts,9830,diams,338,OElig,339,oelig,352,Scaron,353,scaron,376,Yuml,710,circ,732,tilde,8194,ensp,8195,emsp,8201,thinsp,8204,zwnj,8205,zwj,8206,lrm,8207,rlm,8211,ndash,8212,mdash,8216,lsquo,8217,rsquo,8218,sbquo,8220,ldquo,8221,rdquo,8222,bdquo,8224,dagger,8225,Dagger,8240,permil,8249,lsaquo,8250,rsaquo,8364,euro",bool_attrs:/(checked|disabled|readonly|selected|nowrap)/,valid_elements:"*[*]",extended_valid_elements:0,valid_child_elements:0,invalid_elements:0,fix_table_elements:1,fix_list_elements:true,fix_content_duplication:true,convert_fonts_to_spans:false,font_size_classes:0,font_size_style_values:0,apply_source_formatting:0,indent_mode:"simple",indent_char:"\t",indent_levels:1,remove_linebreaks:1,remove_redundant_brs:1,element_format:"xhtml"},j);i.dom=j.dom;if(j.remove_redundant_brs){i.onPostProcess.add(function(k,l){l.content=l.content.replace(/(<br \/>\s*)+<\/(p|h[1-6]|div|li)>/gi,function(n,m,o){if(/^<br \/>\s*<\//.test(n)){return"</"+o+">"}return n})})}if(j.element_format=="html"){i.onPostProcess.add(function(k,l){l.content=l.content.replace(/<([^>]+) \/>/g,"<$1>")})}if(j.fix_list_elements){i.onPreProcess.add(function(v,s){var l,y,w=["ol","ul"],u,t,q,k=/^(OL|UL)$/,z;function m(r,x){var o=x.split(","),p;while((r=r.previousSibling)!=null){for(p=0;p<o.length;p++){if(r.nodeName==o[p]){return r}}}return null}for(y=0;y<w.length;y++){l=i.dom.select(w[y],s.node);for(u=0;u<l.length;u++){t=l[u];q=t.parentNode;if(k.test(q.nodeName)){z=m(t,"LI");if(!z){z=i.dom.create("li");z.innerHTML="&nbsp;";z.appendChild(t);q.insertBefore(z,q.firstChild)}else{z.appendChild(t)}}}}})}if(j.fix_table_elements){i.onPreProcess.add(function(k,l){f(i.dom.select("p table",l.node),function(m){if(d){m.outerHTML=m.outerHTML}i.dom.split(i.dom.getParent(m,"p"),m)})})}},setEntities:function(p){var n=this,j,m,h={},o="",k;if(n.entityLookup){return}j=p.split(",");for(m=0;m<j.length;m+=2){k=j[m];if(k==34||k==38||k==60||k==62){continue}h[String.fromCharCode(j[m])]=j[m+1];k=parseInt(j[m]).toString(16);o+="\\u"+"0000".substring(k.length)+k}if(!o){n.settings.entity_encoding="raw";return}n.entitiesRE=new RegExp("["+o+"]","g");n.entityLookup=h},setValidChildRules:function(h){this.childRules=null;this.addValidChildRules(h)},addValidChildRules:function(k){var j=this,l,h,i;if(!k){return}l="A|BR|SPAN|BDO|MAP|OBJECT|IMG|TT|I|B|BIG|SMALL|EM|STRONG|DFN|CODE|Q|SAMP|KBD|VAR|CITE|ABBR|ACRONYM|SUB|SUP|#text|#comment";h="A|BR|SPAN|BDO|OBJECT|APPLET|IMG|MAP|IFRAME|TT|I|B|U|S|STRIKE|BIG|SMALL|FONT|BASEFONT|EM|STRONG|DFN|CODE|Q|SAMP|KBD|VAR|CITE|ABBR|ACRONYM|SUB|SUP|INPUT|SELECT|TEXTAREA|LABEL|BUTTON|#text|#comment";i="H[1-6]|P|DIV|ADDRESS|PRE|FORM|TABLE|LI|OL|UL|TD|CAPTION|BLOCKQUOTE|CENTER|DL|DT|DD|DIR|FIELDSET|FORM|NOSCRIPT|NOFRAMES|MENU|ISINDEX|SAMP";f(k.split(","),function(n){var o=n.split(/\[|\]/),m;n="";f(o[1].split("|"),function(p){if(n){n+="|"}switch(p){case"%itrans":p=h;break;case"%itrans_na":p=h.substring(2);break;case"%istrict":p=l;break;case"%istrict_na":p=l.substring(2);break;case"%btrans":p=i;break;case"%bstrict":p=i;break}n+=p});m=new RegExp("^("+n.toLowerCase()+")$","i");f(o[0].split("/"),function(p){j.childRules=j.childRules||{};j.childRules[p]=m})});k="";f(j.childRules,function(n,m){if(k){k+="|"}k+=m});j.parentElementsRE=new RegExp("^("+k.toLowerCase()+")$","i")},setRules:function(i){var h=this;h._setup();h.rules={};h.wildRules=[];h.validElements={};return h.addRules(i)},addRules:function(i){var h=this,j;if(!i){return}h._setup();f(i.split(","),function(m){var q=m.split(/\[|\]/),l=q[0].split("/"),r,k,o,n=[];if(j){k=e.extend([],j.attribs)}if(q.length>1){f(q[1].split("|"),function(u){var p={},t;k=k||[];u=u.replace(/::/g,"~");u=/^([!\-])?([\w*.?~_\-]+|)([=:<])?(.+)?$/.exec(u);u[2]=u[2].replace(/~/g,":");if(u[1]=="!"){r=r||[];r.push(u[2])}if(u[1]=="-"){for(t=0;t<k.length;t++){if(k[t].name==u[2]){k.splice(t,1);return}}}switch(u[3]){case"=":p.defaultVal=u[4]||"";break;case":":p.forcedVal=u[4];break;case"<":p.validVals=u[4].split("?");break}if(/[*.?]/.test(u[2])){o=o||[];p.nameRE=new RegExp("^"+c(u[2])+"$");o.push(p)}else{p.name=u[2];k.push(p)}n.push(u[2])})}f(l,function(v,u){var w=v.charAt(0),t=1,p={};if(j){if(j.noEmpty){p.noEmpty=j.noEmpty}if(j.fullEnd){p.fullEnd=j.fullEnd}if(j.padd){p.padd=j.padd}}switch(w){case"-":p.noEmpty=true;break;case"+":p.fullEnd=true;break;case"#":p.padd=true;break;default:t=0}l[u]=v=v.substring(t);h.validElements[v]=1;if(/[*.?]/.test(l[0])){p.nameRE=new RegExp("^"+c(l[0])+"$");h.wildRules=h.wildRules||{};h.wildRules.push(p)}else{p.name=l[0];if(l[0]=="@"){j=p}h.rules[v]=p}p.attribs=k;if(r){p.requiredAttribs=r}if(o){v="";f(n,function(s){if(v){v+="|"}v+="("+c(s)+")"});p.validAttribsRE=new RegExp("^"+v.toLowerCase()+"$");p.wildAttribs=o}})});i="";f(h.validElements,function(m,l){if(i){i+="|"}if(l!="@"){i+=l}});h.validElementsRE=new RegExp("^("+c(i.toLowerCase())+")$")},findRule:function(m){var j=this,l=j.rules,h,k;j._setup();k=l[m];if(k){return k}l=j.wildRules;for(h=0;h<l.length;h++){if(l[h].nameRE.test(m)){return l[h]}}return null},findAttribRule:function(h,l){var j,k=h.wildAttribs;for(j=0;j<k.length;j++){if(k[j].nameRE.test(l)){return k[j]}}return null},serialize:function(m,l){var j,i=this,k;i._setup();l=l||{};l.format=l.format||"html";m=m.cloneNode(true);i.processObj=l;if(e.isWebKit){k=m.ownerDocument.implementation.createHTMLDocument("");k.body.appendChild(m)}i.key=""+(parseInt(i.key)+1);if(!l.no_events){l.node=m;i.onPreProcess.dispatch(i,l)}i.writer.reset();i._serializeNode(m,l.getInner);l.content=i.writer.getContent();if(!l.no_events){i.onPostProcess.dispatch(i,l)}i._postProcess(l);l.node=null;return e.trim(l.content)},_postProcess:function(n){var i=this,k=i.settings,j=n.content,m=[],l;if(n.format=="html"){l=i._protect({content:j,patterns:[{pattern:/(<script[^>]*>)(.*?)(<\/script>)/g},{pattern:/(<noscript[^>]*>)(.*?)(<\/noscript>)/g},{pattern:/(<style[^>]*>)(.*?)(<\/style>)/g},{pattern:/(<pre[^>]*>)(.*?)(<\/pre>)/g,encode:1},{pattern:/(<!--\[CDATA\[)(.*?)(\]\]-->)/g}]});j=l.content;if(k.entity_encoding!=="raw"){j=i._encode(j)}if(!n.set){j=j.replace(/<p>\s+<\/p>|<p([^>]+)>\s+<\/p>/g,k.entity_encoding=="numeric"?"<p$1>&#160;</p>":"<p$1>&nbsp;</p>");if(k.remove_linebreaks){j=j.replace(/\r?\n|\r/g," ");j=j.replace(/(<[^>]+>)\s+/g,"$1 ");j=j.replace(/\s+(<\/[^>]+>)/g," $1");j=j.replace(/<(p|h[1-6]|blockquote|hr|div|table|tbody|tr|td|body|head|html|title|meta|style|pre|script|link|object) ([^>]+)>\s+/g,"<$1 $2>");j=j.replace(/<(p|h[1-6]|blockquote|hr|div|table|tbody|tr|td|body|head|html|title|meta|style|pre|script|link|object)>\s+/g,"<$1>");j=j.replace(/\s+<\/(p|h[1-6]|blockquote|hr|div|table|tbody|tr|td|body|head|html|title|meta|style|pre|script|link|object)>/g,"</$1>")}if(k.apply_source_formatting&&k.indent_mode=="simple"){j=j.replace(/<(\/?)(ul|hr|table|meta|link|tbody|tr|object|body|head|html|map)(|[^>]+)>\s*/g,"\n<$1$2$3>\n");j=j.replace(/\s*<(p|h[1-6]|blockquote|div|title|style|pre|script|td|li|area)(|[^>]+)>/g,"\n<$1$2>");j=j.replace(/<\/(p|h[1-6]|blockquote|div|title|style|pre|script|td|li)>\s*/g,"</$1>\n");j=j.replace(/\n\n/g,"\n")}}j=i._unprotect(j,l);j=j.replace(/<!--\[CDATA\[([\s\S]+)\]\]-->/g,"<![CDATA[$1]]>");j=j.replace(/(type|language)=\"mce-/g,'$1="');if(k.entity_encoding=="raw"){j=j.replace(/<p>&nbsp;<\/p>|<p([^>]+)>&nbsp;<\/p>/g,"<p$1>\u00a0</p>")}j=j.replace(/<noscript([^>]+|)>([\s\S]*?)<\/noscript>/g,function(h,p,o){return"<noscript"+p+">"+i.dom.decode(o.replace(/<!--|-->/g,""))+"</noscript>"})}n.content=j},_serializeNode:function(D,o){var z=this,A=z.settings,x=z.writer,q,j,u,F,E,G,B,h,y,k,r,C,p,m;if(!A.node_filter||A.node_filter(D)){switch(D.nodeType){case 1:if(D.hasAttribute?D.hasAttribute("mce_bogus"):D.getAttribute("mce_bogus")){return}p=false;q=D.hasChildNodes();k=D.getAttribute("mce_name")||D.nodeName.toLowerCase();if(d){if(D.scopeName!=="HTML"&&D.scopeName!=="html"){k=D.scopeName+":"+k}}if(k.indexOf("mce:")===0){k=k.substring(4)}if(!z.validElementsRE||!z.validElementsRE.test(k)||(z.invalidElementsRE&&z.invalidElementsRE.test(k))||o){p=true;break}if(d){if(A.fix_content_duplication){if(D.mce_serialized==z.key){return}D.mce_serialized=z.key}if(k.charAt(0)=="/"){k=k.substring(1)}}else{if(a){if(D.nodeName==="BR"&&D.getAttribute("type")=="_moz"){return}}}if(z.childRules){if(z.parentElementsRE.test(z.elementName)){if(!z.childRules[z.elementName].test(k)){p=true;break}}z.elementName=k}r=z.findRule(k);k=r.name||k;m=A.closed.test(k);if((!q&&r.noEmpty)||(d&&!k)){p=true;break}if(r.requiredAttribs){G=r.requiredAttribs;for(F=G.length-1;F>=0;F--){if(this.dom.getAttrib(D,G[F])!==""){break}}if(F==-1){p=true;break}}x.writeStartElement(k);if(r.attribs){for(F=0,B=r.attribs,E=B.length;F<E;F++){G=B[F];y=z._getAttrib(D,G);if(y!==null){x.writeAttribute(G.name,y)}}}if(r.validAttribsRE){B=z.dom.getAttribs(D);for(F=B.length-1;F>-1;F--){h=B[F];if(h.specified){G=h.nodeName.toLowerCase();if(A.invalid_attrs.test(G)||!r.validAttribsRE.test(G)){continue}C=z.findAttribRule(r,G);y=z._getAttrib(D,C,G);if(y!==null){x.writeAttribute(G,y)}}}}if(k==="script"&&e.trim(D.innerHTML)){x.writeText("// ");x.writeCDATA(D.innerHTML.replace(/<!--|-->|<\[CDATA\[|\]\]>/g,""));q=false;break}if(r.padd){if(q&&(u=D.firstChild)&&u.nodeType===1&&D.childNodes.length===1){if(u.hasAttribute?u.hasAttribute("mce_bogus"):u.getAttribute("mce_bogus")){x.writeText("\u00a0")}}else{if(!q){x.writeText("\u00a0")}}}break;case 3:if(z.childRules&&z.parentElementsRE.test(z.elementName)){if(!z.childRules[z.elementName].test(D.nodeName)){return}}return x.writeText(D.nodeValue);case 4:return x.writeCDATA(D.nodeValue);case 8:return x.writeComment(D.nodeValue)}}else{if(D.nodeType==1){q=D.hasChildNodes()}}if(q&&!m){u=D.firstChild;while(u){z._serializeNode(u);z.elementName=k;u=u.nextSibling}}if(!p){if(!m){x.writeFullEndElement()}else{x.writeEndElement()}}},_protect:function(j){var i=this;j.items=j.items||[];function h(l){return l.replace(/[\r\n\\]/g,function(m){if(m==="\n"){return"\\n"}else{if(m==="\\"){return"\\\\"}}return"\\r"})}function k(l){return l.replace(/\\[\\rn]/g,function(m){if(m==="\\n"){return"\n"}else{if(m==="\\\\"){return"\\"}}return"\r"})}f(j.patterns,function(l){j.content=k(h(j.content).replace(l.pattern,function(n,o,m,p){m=k(m);if(l.encode){m=i._encode(m)}j.items.push(m);return o+"<!--mce:"+(j.items.length-1)+"-->"+p}))});return j},_unprotect:function(i,j){i=i.replace(/\<!--mce:([0-9]+)--\>/g,function(k,h){return j.items[parseInt(h)]});j.items=[];return i},_encode:function(m){var j=this,k=j.settings,i;if(k.entity_encoding!=="raw"){if(k.entity_encoding.indexOf("named")!=-1){j.setEntities(k.entities);i=j.entityLookup;m=m.replace(j.entitiesRE,function(h){var l;if(l=i[h]){h="&"+l+";"}return h})}if(k.entity_encoding.indexOf("numeric")!=-1){m=m.replace(/[\u007E-\uFFFF]/g,function(h){return"&#"+h.charCodeAt(0)+";"})}}return m},_setup:function(){var h=this,i=this.settings;if(h.done){return}h.done=1;h.setRules(i.valid_elements);h.addRules(i.extended_valid_elements);h.addValidChildRules(i.valid_child_elements);if(i.invalid_elements){h.invalidElementsRE=new RegExp("^("+c(i.invalid_elements.replace(/,/g,"|").toLowerCase())+")$")}if(i.attrib_value_filter){h.attribValueFilter=i.attribValueFilter}},_getAttrib:function(m,j,h){var l,k;h=h||j.name;if(j.forcedVal&&(k=j.forcedVal)){if(k==="{$uid}"){return this.dom.uniqueId()}return k}k=this.dom.getAttrib(m,h);if(this.settings.bool_attrs.test(h)&&k){k=(""+k).toLowerCase();if(k==="false"||k==="0"){return null}k=h}switch(h){case"rowspan":case"colspan":if(k=="1"){k=""}break}if(this.attribValueFilter){k=this.attribValueFilter(h,k,m)}if(j.validVals){for(l=j.validVals.length-1;l>=0;l--){if(k==j.validVals[l]){break}}if(l==-1){return null}}if(k===""&&typeof(j.defaultVal)!="undefined"){k=j.defaultVal;if(k==="{$uid}"){return this.dom.uniqueId()}return k}else{if(h=="class"&&this.processObj.get){k=k.replace(/\s?mceItem\w+\s?/g,"")}}if(k===""){return null}return k}})})(tinymce);(function(tinymce){var each=tinymce.each,Event=tinymce.dom.Event;tinymce.create("tinymce.dom.ScriptLoader",{ScriptLoader:function(s){this.settings=s||{};this.queue=[];this.lookup={}},isDone:function(u){return this.lookup[u]?this.lookup[u].state==2:0},markDone:function(u){this.lookup[u]={state:2,url:u}},add:function(u,cb,s,pr){var t=this,lo=t.lookup,o;if(o=lo[u]){if(cb&&o.state==2){cb.call(s||this)}return o}o={state:0,url:u,func:cb,scope:s||this};if(pr){t.queue.unshift(o)}else{t.queue.push(o)}lo[u]=o;return o},load:function(u,cb,s){var t=this,o;if(o=t.lookup[u]){if(cb&&o.state==2){cb.call(s||t)}return o}function loadScript(u){if(Event.domLoaded||t.settings.strict_mode){tinymce.util.XHR.send({url:tinymce._addVer(u),error:t.settings.error,async:false,success:function(co){t.eval(co)}})}else{document.write('<script type="text/javascript" src="'+tinymce._addVer(u)+'"><\/script>')}}if(!tinymce.is(u,"string")){each(u,function(u){loadScript(u)});if(cb){cb.call(s||t)}}else{loadScript(u);if(cb){cb.call(s||t)}}},loadQueue:function(cb,s){var t=this;if(!t.queueLoading){t.queueLoading=1;t.queueCallbacks=[];t.loadScripts(t.queue,function(){t.queueLoading=0;if(cb){cb.call(s||t)}each(t.queueCallbacks,function(o){o.func.call(o.scope)})})}else{if(cb){t.queueCallbacks.push({func:cb,scope:s||t})}}},eval:function(co){var w=window;if(!w.execScript){try{eval.call(w,co)}catch(ex){eval(co,w)}}else{w.execScript(co)}},loadScripts:function(sc,cb,s){var t=this,lo=t.lookup;function done(o){o.state=2;if(o.func){o.func.call(o.scope||t)}}function allDone(){var l;l=sc.length;each(sc,function(o){o=lo[o.url];if(o.state===2){done(o);l--}else{load(o)}});if(l===0&&cb){cb.call(s||t);cb=0}}function load(o){if(o.state>0){return}o.state=1;tinymce.dom.ScriptLoader.loadScript(o.url,function(){done(o);allDone()})}each(sc,function(o){var u=o.url;if(!lo[u]){lo[u]=o;t.queue.push(o)}else{o=lo[u]}if(o.state>0){return}if(!Event.domLoaded&&!t.settings.strict_mode){var ix,ol="";if(cb||o.func){o.state=1;ix=tinymce.dom.ScriptLoader._addOnLoad(function(){done(o);allDone()});if(tinymce.isIE){ol=' onreadystatechange="'}else{ol=' onload="'}ol+="tinymce.dom.ScriptLoader._onLoad(this,'"+u+"',"+ix+');"'}document.write('<script type="text/javascript" src="'+tinymce._addVer(u)+'"'+ol+"><\/script>");if(!o.func){done(o)}}else{load(o)}});allDone()},"static":{_addOnLoad:function(f){var t=this;t._funcs=t._funcs||[];t._funcs.push(f);return t._funcs.length-1},_onLoad:function(e,u,ix){if(!tinymce.isIE||e.readyState=="complete"){this._funcs[ix].call(this)}},loadScript:function(u,cb){var id=tinymce.DOM.uniqueId(),e;function done(){Event.clear(id);tinymce.DOM.remove(id);if(cb){cb.call(document,u);cb=0}}if(tinymce.isIE){tinymce.util.XHR.send({url:tinymce._addVer(u),async:false,success:function(co){window.execScript(co);done()}})}else{e=tinymce.DOM.create("script",{id:id,type:"text/javascript",src:tinymce._addVer(u)});Event.add(e,"load",done);(document.getElementsByTagName("head")[0]||document.body).appendChild(e)}}}});tinymce.ScriptLoader=new tinymce.dom.ScriptLoader()})(tinymce);(function(c){var b=c.DOM,a=c.is;c.create("tinymce.ui.Control",{Control:function(e,d){this.id=e;this.settings=d=d||{};this.rendered=false;this.onRender=new c.util.Dispatcher(this);this.classPrefix="";this.scope=d.scope||this;this.disabled=0;this.active=0},setDisabled:function(d){var f;if(d!=this.disabled){f=b.get(this.id);if(f&&this.settings.unavailable_prefix){if(d){this.prevTitle=f.title;f.title=this.settings.unavailable_prefix+": "+f.title}else{f.title=this.prevTitle}}this.setState("Disabled",d);this.setState("Enabled",!d);this.disabled=d}},isDisabled:function(){return this.disabled},setActive:function(d){if(d!=this.active){this.setState("Active",d);this.active=d}},isActive:function(){return this.active},setState:function(f,d){var e=b.get(this.id);f=this.classPrefix+f;if(d){b.addClass(e,f)}else{b.removeClass(e,f)}},isRendered:function(){return this.rendered},renderHTML:function(){},renderTo:function(d){b.setHTML(d,this.renderHTML())},postRender:function(){var e=this,d;if(a(e.disabled)){d=e.disabled;e.disabled=-1;e.setDisabled(d)}if(a(e.active)){d=e.active;e.active=-1;e.setActive(d)}},remove:function(){b.remove(this.id);this.destroy()},destroy:function(){c.dom.Event.clear(this.id)}})})(tinymce);tinymce.create("tinymce.ui.Container:tinymce.ui.Control",{Container:function(b,a){this.parent(b,a);this.controls=[];this.lookup={}},add:function(a){this.lookup[a.id]=a;this.controls.push(a);return a},get:function(a){return this.lookup[a]}});tinymce.create("tinymce.ui.Separator:tinymce.ui.Control",{Separator:function(b,a){this.parent(b,a);this.classPrefix="mceSeparator"},renderHTML:function(){return tinymce.DOM.createHTML("span",{"class":this.classPrefix})}});(function(d){var c=d.is,b=d.DOM,e=d.each,a=d.walk;d.create("tinymce.ui.MenuItem:tinymce.ui.Control",{MenuItem:function(g,f){this.parent(g,f);this.classPrefix="mceMenuItem"},setSelected:function(f){this.setState("Selected",f);this.selected=f},isSelected:function(){return this.selected},postRender:function(){var f=this;f.parent();if(c(f.selected)){f.setSelected(f.selected)}}})})(tinymce);(function(d){var c=d.is,b=d.DOM,e=d.each,a=d.walk;d.create("tinymce.ui.Menu:tinymce.ui.MenuItem",{Menu:function(h,g){var f=this;f.parent(h,g);f.items={};f.collapsed=false;f.menuCount=0;f.onAddItem=new d.util.Dispatcher(this)},expand:function(g){var f=this;if(g){a(f,function(h){if(h.expand){h.expand()}},"items",f)}f.collapsed=false},collapse:function(g){var f=this;if(g){a(f,function(h){if(h.collapse){h.collapse()}},"items",f)}f.collapsed=true},isCollapsed:function(){return this.collapsed},add:function(f){if(!f.settings){f=new d.ui.MenuItem(f.id||b.uniqueId(),f)}this.onAddItem.dispatch(this,f);return this.items[f.id]=f},addSeparator:function(){return this.add({separator:true})},addMenu:function(f){if(!f.collapse){f=this.createMenu(f)}this.menuCount++;return this.add(f)},hasMenus:function(){return this.menuCount!==0},remove:function(f){delete this.items[f.id]},removeAll:function(){var f=this;a(f,function(g){if(g.removeAll){g.removeAll()}else{g.remove()}g.destroy()},"items",f);f.items={}},createMenu:function(g){var f=new d.ui.Menu(g.id||b.uniqueId(),g);f.onAddItem.add(this.onAddItem.dispatch,this.onAddItem);return f}})})(tinymce);(function(e){var d=e.is,c=e.DOM,f=e.each,a=e.dom.Event,b=e.dom.Element;e.create("tinymce.ui.DropMenu:tinymce.ui.Menu",{DropMenu:function(h,g){g=g||{};g.container=g.container||c.doc.body;g.offset_x=g.offset_x||0;g.offset_y=g.offset_y||0;g.vp_offset_x=g.vp_offset_x||0;g.vp_offset_y=g.vp_offset_y||0;if(d(g.icons)&&!g.icons){g["class"]+=" mceNoIcons"}this.parent(h,g);this.onShowMenu=new e.util.Dispatcher(this);this.onHideMenu=new e.util.Dispatcher(this);this.classPrefix="mceMenu"},createMenu:function(j){var h=this,i=h.settings,g;j.container=j.container||i.container;j.parent=h;j.constrain=j.constrain||i.constrain;j["class"]=j["class"]||i["class"];j.vp_offset_x=j.vp_offset_x||i.vp_offset_x;j.vp_offset_y=j.vp_offset_y||i.vp_offset_y;g=new e.ui.DropMenu(j.id||c.uniqueId(),j);g.onAddItem.add(h.onAddItem.dispatch,h.onAddItem);return g},update:function(){var i=this,j=i.settings,g=c.get("menu_"+i.id+"_tbl"),l=c.get("menu_"+i.id+"_co"),h,k;h=j.max_width?Math.min(g.clientWidth,j.max_width):g.clientWidth;k=j.max_height?Math.min(g.clientHeight,j.max_height):g.clientHeight;if(!c.boxModel){i.element.setStyles({width:h+2,height:k+2})}else{i.element.setStyles({width:h,height:k})}if(j.max_width){c.setStyle(l,"width",h)}if(j.max_height){c.setStyle(l,"height",k);if(g.clientHeight<j.max_height){c.setStyle(l,"overflow","hidden")}}},showMenu:function(p,n,r){var z=this,A=z.settings,o,g=c.getViewPort(),u,l,v,q,i=2,k,j,m=z.classPrefix;z.collapse(1);if(z.isMenuVisible){return}if(!z.rendered){o=c.add(z.settings.container,z.renderNode());f(z.items,function(h){h.postRender()});z.element=new b("menu_"+z.id,{blocker:1,container:A.container})}else{o=c.get("menu_"+z.id)}if(!e.isOpera){c.setStyles(o,{left:-65535,top:-65535})}c.show(o);z.update();p+=A.offset_x||0;n+=A.offset_y||0;g.w-=4;g.h-=4;if(A.constrain){u=o.clientWidth-i;l=o.clientHeight-i;v=g.x+g.w;q=g.y+g.h;if((p+A.vp_offset_x+u)>v){p=r?r-u:Math.max(0,(v-A.vp_offset_x)-u)}if((n+A.vp_offset_y+l)>q){n=Math.max(0,(q-A.vp_offset_y)-l)}}c.setStyles(o,{left:p,top:n});z.element.update();z.isMenuVisible=1;z.mouseClickFunc=a.add(o,"click",function(s){var h;s=s.target;if(s&&(s=c.getParent(s,"tr"))&&!c.hasClass(s,m+"ItemSub")){h=z.items[s.id];if(h.isDisabled()){return}k=z;while(k){if(k.hideMenu){k.hideMenu()}k=k.settings.parent}if(h.settings.onclick){h.settings.onclick(s)}return a.cancel(s)}});if(z.hasMenus()){z.mouseOverFunc=a.add(o,"mouseover",function(w){var h,t,s;w=w.target;if(w&&(w=c.getParent(w,"tr"))){h=z.items[w.id];if(z.lastMenu){z.lastMenu.collapse(1)}if(h.isDisabled()){return}if(w&&c.hasClass(w,m+"ItemSub")){t=c.getRect(w);h.showMenu((t.x+t.w-i),t.y-i,t.x);z.lastMenu=h;c.addClass(c.get(h.id).firstChild,m+"ItemActive")}}})}z.onShowMenu.dispatch(z);if(A.keyboard_focus){a.add(o,"keydown",z._keyHandler,z);c.select("a","menu_"+z.id)[0].focus();z._focusIdx=0}},hideMenu:function(j){var g=this,i=c.get("menu_"+g.id),h;if(!g.isMenuVisible){return}a.remove(i,"mouseover",g.mouseOverFunc);a.remove(i,"click",g.mouseClickFunc);a.remove(i,"keydown",g._keyHandler);c.hide(i);g.isMenuVisible=0;if(!j){g.collapse(1)}if(g.element){g.element.hide()}if(h=c.get(g.id)){c.removeClass(h.firstChild,g.classPrefix+"ItemActive")}g.onHideMenu.dispatch(g)},add:function(i){var g=this,h;i=g.parent(i);if(g.isRendered&&(h=c.get("menu_"+g.id))){g._add(c.select("tbody",h)[0],i)}return i},collapse:function(g){this.parent(g);this.hideMenu(1)},remove:function(g){c.remove(g.id);this.destroy();return this.parent(g)},destroy:function(){var g=this,h=c.get("menu_"+g.id);a.remove(h,"mouseover",g.mouseOverFunc);a.remove(h,"click",g.mouseClickFunc);if(g.element){g.element.remove()}c.remove(h)},renderNode:function(){var i=this,j=i.settings,l,h,k,g;g=c.create("div",{id:"menu_"+i.id,"class":j["class"],style:"position:absolute;left:0;top:0;z-index:200000"});k=c.add(g,"div",{id:"menu_"+i.id+"_co","class":i.classPrefix+(j["class"]?" "+j["class"]:"")});i.element=new b("menu_"+i.id,{blocker:1,container:j.container});if(j.menu_line){c.add(k,"span",{"class":i.classPrefix+"Line"})}l=c.add(k,"table",{id:"menu_"+i.id+"_tbl",border:0,cellPadding:0,cellSpacing:0});h=c.add(l,"tbody");f(i.items,function(m){i._add(h,m)});i.rendered=true;return g},_keyHandler:function(j){var i=this,h=j.keyCode;function g(m){var k=i._focusIdx+m,l=c.select("a","menu_"+i.id)[k];if(l){i._focusIdx=k;l.focus()}}switch(h){case 38:g(-1);return;case 40:g(1);return;case 13:return;case 27:return this.hideMenu()}},_add:function(j,h){var i,q=h.settings,p,l,k,m=this.classPrefix,g;if(q.separator){l=c.add(j,"tr",{id:h.id,"class":m+"ItemSeparator"});c.add(l,"td",{"class":m+"ItemSeparator"});if(i=l.previousSibling){c.addClass(i,"mceLast")}return}i=l=c.add(j,"tr",{id:h.id,"class":m+"Item "+m+"ItemEnabled"});i=k=c.add(i,"td");i=p=c.add(i,"a",{href:"javascript:;",onclick:"return false;",onmousedown:"return false;"});c.addClass(k,q["class"]);g=c.add(i,"span",{"class":"mceIcon"+(q.icon?" mce_"+q.icon:"")});if(q.icon_src){c.add(g,"img",{src:q.icon_src})}i=c.add(i,q.element||"span",{"class":"mceText",title:h.settings.title},h.settings.title);if(h.settings.style){c.setAttrib(i,"style",h.settings.style)}if(j.childNodes.length==1){c.addClass(l,"mceFirst")}if((i=l.previousSibling)&&c.hasClass(i,m+"ItemSeparator")){c.addClass(l,"mceFirst")}if(h.collapse){c.addClass(l,m+"ItemSub")}if(i=l.previousSibling){c.removeClass(i,"mceLast")}c.addClass(l,"mceLast")}})})(tinymce);(function(b){var a=b.DOM;b.create("tinymce.ui.Button:tinymce.ui.Control",{Button:function(d,c){this.parent(d,c);this.classPrefix="mceButton"},renderHTML:function(){var f=this.classPrefix,e=this.settings,d,c;c=a.encode(e.label||"");d='<a id="'+this.id+'" href="javascript:;" class="'+f+" "+f+"Enabled "+e["class"]+(c?" "+f+"Labeled":"")+'" onmousedown="return false;" onclick="return false;" title="'+a.encode(e.title)+'">';if(e.image){d+='<img class="mceIcon" src="'+e.image+'" />'+c+"</a>"}else{d+='<span class="mceIcon '+e["class"]+'"></span>'+(c?'<span class="'+f+'Label">'+c+"</span>":"")+"</a>"}return d},postRender:function(){var c=this,d=c.settings;b.dom.Event.add(c.id,"click",function(f){if(!c.isDisabled()){return d.onclick.call(d.scope,f)}})}})})(tinymce);(function(d){var c=d.DOM,b=d.dom.Event,e=d.each,a=d.util.Dispatcher;d.create("tinymce.ui.ListBox:tinymce.ui.Control",{ListBox:function(h,g){var f=this;f.parent(h,g);f.items=[];f.onChange=new a(f);f.onPostRender=new a(f);f.onAdd=new a(f);f.onRenderMenu=new d.util.Dispatcher(this);f.classPrefix="mceListBox"},select:function(h){var g=this,j,i;if(h==undefined){return g.selectByIndex(-1)}if(h&&h.call){i=h}else{i=function(f){return f==h}}if(h!=g.selectedValue){e(g.items,function(k,f){if(i(k.value)){j=1;g.selectByIndex(f);return false}});if(!j){g.selectByIndex(-1)}}},selectByIndex:function(f){var g=this,h,i;if(f!=g.selectedIndex){h=c.get(g.id+"_text");i=g.items[f];if(i){g.selectedValue=i.value;g.selectedIndex=f;c.setHTML(h,c.encode(i.title));c.removeClass(h,"mceTitle")}else{c.setHTML(h,c.encode(g.settings.title));c.addClass(h,"mceTitle");g.selectedValue=g.selectedIndex=null}h=0}},add:function(i,f,h){var g=this;h=h||{};h=d.extend(h,{title:i,value:f});g.items.push(h);g.onAdd.dispatch(g,h)},getLength:function(){return this.items.length},renderHTML:function(){var i="",f=this,g=f.settings,j=f.classPrefix;i='<table id="'+f.id+'" cellpadding="0" cellspacing="0" class="'+j+" "+j+"Enabled"+(g["class"]?(" "+g["class"]):"")+'"><tbody><tr>';i+="<td>"+c.createHTML("a",{id:f.id+"_text",href:"javascript:;","class":"mceText",onclick:"return false;",onmousedown:"return false;"},c.encode(f.settings.title))+"</td>";i+="<td>"+c.createHTML("a",{id:f.id+"_open",tabindex:-1,href:"javascript:;","class":"mceOpen",onclick:"return false;",onmousedown:"return false;"},"<span></span>")+"</td>";i+="</tr></tbody></table>";return i},showMenu:function(){var g=this,j,i,h=c.get(this.id),f;if(g.isDisabled()||g.items.length==0){return}if(g.menu&&g.menu.isMenuVisible){return g.hideMenu()}if(!g.isMenuRendered){g.renderMenu();g.isMenuRendered=true}j=c.getPos(this.settings.menu_container);i=c.getPos(h);f=g.menu;f.settings.offset_x=i.x;f.settings.offset_y=i.y;f.settings.keyboard_focus=!d.isOpera;if(g.oldID){f.items[g.oldID].setSelected(0)}e(g.items,function(k){if(k.value===g.selectedValue){f.items[k.id].setSelected(1);g.oldID=k.id}});f.showMenu(0,h.clientHeight);b.add(c.doc,"mousedown",g.hideMenu,g);c.addClass(g.id,g.classPrefix+"Selected")},hideMenu:function(g){var f=this;if(g&&g.type=="mousedown"&&(g.target.id==f.id+"_text"||g.target.id==f.id+"_open")){return}if(!g||!c.getParent(g.target,".mceMenu")){c.removeClass(f.id,f.classPrefix+"Selected");b.remove(c.doc,"mousedown",f.hideMenu,f);if(f.menu){f.menu.hideMenu()}}},renderMenu:function(){var g=this,f;f=g.settings.control_manager.createDropMenu(g.id+"_menu",{menu_line:1,"class":g.classPrefix+"Menu mceNoIcons",max_width:150,max_height:150});f.onHideMenu.add(g.hideMenu,g);f.add({title:g.settings.title,"class":"mceMenuItemTitle",onclick:function(){if(g.settings.onselect("")!==false){g.select("")}}});e(g.items,function(h){h.id=c.uniqueId();h.onclick=function(){if(g.settings.onselect(h.value)!==false){g.select(h.value)}};f.add(h)});g.onRenderMenu.dispatch(g,f);g.menu=f},postRender:function(){var f=this,g=f.classPrefix;b.add(f.id,"click",f.showMenu,f);b.add(f.id+"_text","focus",function(h){if(!f._focused){f.keyDownHandler=b.add(f.id+"_text","keydown",function(l){var i=-1,j,k=l.keyCode;e(f.items,function(m,n){if(f.selectedValue==m.value){i=n}});if(k==38){j=f.items[i-1]}else{if(k==40){j=f.items[i+1]}else{if(k==13){j=f.selectedValue;f.selectedValue=null;f.settings.onselect(j);return b.cancel(l)}}}if(j){f.hideMenu();f.select(j.value)}})}f._focused=1});b.add(f.id+"_text","blur",function(){b.remove(f.id+"_text","keydown",f.keyDownHandler);f._focused=0});if(d.isIE6||!c.boxModel){b.add(f.id,"mouseover",function(){if(!c.hasClass(f.id,g+"Disabled")){c.addClass(f.id,g+"Hover")}});b.add(f.id,"mouseout",function(){if(!c.hasClass(f.id,g+"Disabled")){c.removeClass(f.id,g+"Hover")}})}f.onPostRender.dispatch(f,c.get(f.id))},destroy:function(){this.parent();b.clear(this.id+"_text");b.clear(this.id+"_open")}})})(tinymce);(function(d){var c=d.DOM,b=d.dom.Event,e=d.each,a=d.util.Dispatcher;d.create("tinymce.ui.NativeListBox:tinymce.ui.ListBox",{NativeListBox:function(g,f){this.parent(g,f);this.classPrefix="mceNativeListBox"},setDisabled:function(f){c.get(this.id).disabled=f},isDisabled:function(){return c.get(this.id).disabled},select:function(h){var g=this,j,i;if(h==undefined){return g.selectByIndex(-1)}if(h&&h.call){i=h}else{i=function(f){return f==h}}if(h!=g.selectedValue){e(g.items,function(k,f){if(i(k.value)){j=1;g.selectByIndex(f);return false}});if(!j){g.selectByIndex(-1)}}},selectByIndex:function(f){c.get(this.id).selectedIndex=f+1;this.selectedValue=this.items[f]?this.items[f].value:null},add:function(j,g,f){var i,h=this;f=f||{};f.value=g;if(h.isRendered()){c.add(c.get(this.id),"option",f,j)}i={title:j,value:g,attribs:f};h.items.push(i);h.onAdd.dispatch(h,i)},getLength:function(){return c.get(this.id).options.length-1},renderHTML:function(){var g,f=this;g=c.createHTML("option",{value:""},"-- "+f.settings.title+" --");e(f.items,function(h){g+=c.createHTML("option",{value:h.value},h.title)});g=c.createHTML("select",{id:f.id,"class":"mceNativeListBox"},g);return g},postRender:function(){var g=this,h;g.rendered=true;function f(j){var i=g.items[j.target.selectedIndex-1];if(i&&(i=i.value)){g.onChange.dispatch(g,i);if(g.settings.onselect){g.settings.onselect(i)}}}b.add(g.id,"change",f);b.add(g.id,"keydown",function(j){var i;b.remove(g.id,"change",h);i=b.add(g.id,"blur",function(){b.add(g.id,"change",f);b.remove(g.id,"blur",i)});if(j.keyCode==13||j.keyCode==32){f(j);return b.cancel(j)}});g.onPostRender.dispatch(g,c.get(g.id))}})})(tinymce);(function(c){var b=c.DOM,a=c.dom.Event,d=c.each;c.create("tinymce.ui.MenuButton:tinymce.ui.Button",{MenuButton:function(f,e){this.parent(f,e);this.onRenderMenu=new c.util.Dispatcher(this);e.menu_container=e.menu_container||b.doc.body},showMenu:function(){var g=this,j,i,h=b.get(g.id),f;if(g.isDisabled()){return}if(!g.isMenuRendered){g.renderMenu();g.isMenuRendered=true}if(g.isMenuVisible){return g.hideMenu()}j=b.getPos(g.settings.menu_container);i=b.getPos(h);f=g.menu;f.settings.offset_x=i.x;f.settings.offset_y=i.y;f.settings.vp_offset_x=i.x;f.settings.vp_offset_y=i.y;f.settings.keyboard_focus=g._focused;f.showMenu(0,h.clientHeight);a.add(b.doc,"mousedown",g.hideMenu,g);g.setState("Selected",1);g.isMenuVisible=1},renderMenu:function(){var f=this,e;e=f.settings.control_manager.createDropMenu(f.id+"_menu",{menu_line:1,"class":this.classPrefix+"Menu",icons:f.settings.icons});e.onHideMenu.add(f.hideMenu,f);f.onRenderMenu.dispatch(f,e);f.menu=e},hideMenu:function(g){var f=this;if(g&&g.type=="mousedown"&&b.getParent(g.target,function(h){return h.id===f.id||h.id===f.id+"_open"})){return}if(!g||!b.getParent(g.target,".mceMenu")){f.setState("Selected",0);a.remove(b.doc,"mousedown",f.hideMenu,f);if(f.menu){f.menu.hideMenu()}}f.isMenuVisible=0},postRender:function(){var e=this,f=e.settings;a.add(e.id,"click",function(){if(!e.isDisabled()){if(f.onclick){f.onclick(e.value)}e.showMenu()}})}})})(tinymce);(function(c){var b=c.DOM,a=c.dom.Event,d=c.each;c.create("tinymce.ui.SplitButton:tinymce.ui.MenuButton",{SplitButton:function(f,e){this.parent(f,e);this.classPrefix="mceSplitButton"},renderHTML:function(){var i,f=this,g=f.settings,e;i="<tbody><tr>";if(g.image){e=b.createHTML("img ",{src:g.image,"class":"mceAction "+g["class"]})}else{e=b.createHTML("span",{"class":"mceAction "+g["class"]},"")}i+="<td>"+b.createHTML("a",{id:f.id+"_action",href:"javascript:;","class":"mceAction "+g["class"],onclick:"return false;",onmousedown:"return false;",title:g.title},e)+"</td>";e=b.createHTML("span",{"class":"mceOpen "+g["class"]});i+="<td>"+b.createHTML("a",{id:f.id+"_open",href:"javascript:;","class":"mceOpen "+g["class"],onclick:"return false;",onmousedown:"return false;",title:g.title},e)+"</td>";i+="</tr></tbody>";return b.createHTML("table",{id:f.id,"class":"mceSplitButton mceSplitButtonEnabled "+g["class"],cellpadding:"0",cellspacing:"0",onmousedown:"return false;",title:g.title},i)},postRender:function(){var e=this,f=e.settings;if(f.onclick){a.add(e.id+"_action","click",function(){if(!e.isDisabled()){f.onclick(e.value)}})}a.add(e.id+"_open","click",e.showMenu,e);a.add(e.id+"_open","focus",function(){e._focused=1});a.add(e.id+"_open","blur",function(){e._focused=0});if(c.isIE6||!b.boxModel){a.add(e.id,"mouseover",function(){if(!b.hasClass(e.id,"mceSplitButtonDisabled")){b.addClass(e.id,"mceSplitButtonHover")}});a.add(e.id,"mouseout",function(){if(!b.hasClass(e.id,"mceSplitButtonDisabled")){b.removeClass(e.id,"mceSplitButtonHover")}})}},destroy:function(){this.parent();a.clear(this.id+"_action");a.clear(this.id+"_open")}})})(tinymce);(function(d){var c=d.DOM,a=d.dom.Event,b=d.is,e=d.each;d.create("tinymce.ui.ColorSplitButton:tinymce.ui.SplitButton",{ColorSplitButton:function(h,g){var f=this;f.parent(h,g);f.settings=g=d.extend({colors:"000000,993300,333300,003300,003366,000080,333399,333333,800000,FF6600,808000,008000,008080,0000FF,666699,808080,FF0000,FF9900,99CC00,339966,33CCCC,3366FF,800080,999999,FF00FF,FFCC00,FFFF00,00FF00,00FFFF,00CCFF,993366,C0C0C0,FF99CC,FFCC99,FFFF99,CCFFCC,CCFFFF,99CCFF,CC99FF,FFFFFF",grid_width:8,default_color:"#888888"},f.settings);f.onShowMenu=new d.util.Dispatcher(f);f.onHideMenu=new d.util.Dispatcher(f);f.value=g.default_color},showMenu:function(){var f=this,g,j,i,h;if(f.isDisabled()){return}if(!f.isMenuRendered){f.renderMenu();f.isMenuRendered=true}if(f.isMenuVisible){return f.hideMenu()}i=c.get(f.id);c.show(f.id+"_menu");c.addClass(i,"mceSplitButtonSelected");h=c.getPos(i);c.setStyles(f.id+"_menu",{left:h.x,top:h.y+i.clientHeight,zIndex:200000});i=0;a.add(c.doc,"mousedown",f.hideMenu,f);f.onShowMenu.dispatch(f);if(f._focused){f._keyHandler=a.add(f.id+"_menu","keydown",function(k){if(k.keyCode==27){f.hideMenu()}});c.select("a",f.id+"_menu")[0].focus()}f.isMenuVisible=1},hideMenu:function(g){var f=this;if(g&&g.type=="mousedown"&&c.getParent(g.target,function(h){return h.id===f.id+"_open"})){return}if(!g||!c.getParent(g.target,".mceSplitButtonMenu")){c.removeClass(f.id,"mceSplitButtonSelected");a.remove(c.doc,"mousedown",f.hideMenu,f);a.remove(f.id+"_menu","keydown",f._keyHandler);c.hide(f.id+"_menu")}f.onHideMenu.dispatch(f);f.isMenuVisible=0},renderMenu:function(){var k=this,f,j=0,l=k.settings,p,h,o,g;g=c.add(l.menu_container,"div",{id:k.id+"_menu","class":l.menu_class+" "+l["class"],style:"position:absolute;left:0;top:-1000px;"});f=c.add(g,"div",{"class":l["class"]+" mceSplitButtonMenu"});c.add(f,"span",{"class":"mceMenuLine"});p=c.add(f,"table",{"class":"mceColorSplitMenu"});h=c.add(p,"tbody");j=0;e(b(l.colors,"array")?l.colors:l.colors.split(","),function(i){i=i.replace(/^#/,"");if(!j--){o=c.add(h,"tr");j=l.grid_width-1}p=c.add(o,"td");p=c.add(p,"a",{href:"javascript:;",style:{backgroundColor:"#"+i},mce_color:"#"+i})});if(l.more_colors_func){p=c.add(h,"tr");p=c.add(p,"td",{colspan:l.grid_width,"class":"mceMoreColors"});p=c.add(p,"a",{id:k.id+"_more",href:"javascript:;",onclick:"return false;","class":"mceMoreColors"},l.more_colors_title);a.add(p,"click",function(i){l.more_colors_func.call(l.more_colors_scope||this);return a.cancel(i)})}c.addClass(f,"mceColorSplitMenu");a.add(k.id+"_menu","click",function(i){var m;i=i.target;if(i.nodeName=="A"&&(m=i.getAttribute("mce_color"))){k.setColor(m)}return a.cancel(i)});return g},setColor:function(g){var f=this;c.setStyle(f.id+"_preview","backgroundColor",g);f.value=g;f.hideMenu();f.settings.onselect(g)},postRender:function(){var f=this,g=f.id;f.parent();c.add(g+"_action","div",{id:g+"_preview","class":"mceColorPreview"});c.setStyle(f.id+"_preview","backgroundColor",f.value)},destroy:function(){this.parent();a.clear(this.id+"_menu");a.clear(this.id+"_more");c.remove(this.id+"_menu")}})})(tinymce);tinymce.create("tinymce.ui.Toolbar:tinymce.ui.Container",{renderHTML:function(){var l=this,e="",g,j,b=tinymce.DOM,m=l.settings,d,a,f,k;k=l.controls;for(d=0;d<k.length;d++){j=k[d];a=k[d-1];f=k[d+1];if(d===0){g="mceToolbarStart";if(j.Button){g+=" mceToolbarStartButton"}else{if(j.SplitButton){g+=" mceToolbarStartSplitButton"}else{if(j.ListBox){g+=" mceToolbarStartListBox"}}}e+=b.createHTML("td",{"class":g},b.createHTML("span",null,"<!-- IE -->"))}if(a&&j.ListBox){if(a.Button||a.SplitButton){e+=b.createHTML("td",{"class":"mceToolbarEnd"},b.createHTML("span",null,"<!-- IE -->"))}}if(b.stdMode){e+='<td style="position: relative">'+j.renderHTML()+"</td>"}else{e+="<td>"+j.renderHTML()+"</td>"}if(f&&j.ListBox){if(f.Button||f.SplitButton){e+=b.createHTML("td",{"class":"mceToolbarStart"},b.createHTML("span",null,"<!-- IE -->"))}}}g="mceToolbarEnd";if(j.Button){g+=" mceToolbarEndButton"}else{if(j.SplitButton){g+=" mceToolbarEndSplitButton"}else{if(j.ListBox){g+=" mceToolbarEndListBox"}}}e+=b.createHTML("td",{"class":g},b.createHTML("span",null,"<!-- IE -->"));return b.createHTML("table",{id:l.id,"class":"mceToolbar"+(m["class"]?" "+m["class"]:""),cellpadding:"0",cellspacing:"0",align:l.settings.align||""},"<tbody><tr>"+e+"</tr></tbody>")}});(function(b){var a=b.util.Dispatcher,c=b.each;b.create("tinymce.AddOnManager",{items:[],urls:{},lookup:{},onAdd:new a(this),get:function(d){return this.lookup[d]},requireLangPack:function(f){var d,e=b.EditorManager.settings;if(e&&e.language){d=this.urls[f]+"/langs/"+e.language+".js";if(!b.dom.Event.domLoaded&&!e.strict_mode){b.ScriptLoader.load(d)}else{b.ScriptLoader.add(d)}}},add:function(e,d){this.items.push(d);this.lookup[e]=d;this.onAdd.dispatch(this,e,d);return d},load:function(h,e,d,g){var f=this;if(f.urls[h]){return}if(e.indexOf("/")!=0&&e.indexOf("://")==-1){e=b.baseURL+"/"+e}f.urls[h]=e.substring(0,e.lastIndexOf("/"));b.ScriptLoader.add(e,d,g)}});b.PluginManager=new b.AddOnManager();b.ThemeManager=new b.AddOnManager()}(tinymce));(function(f){var g=f.each,h=f.extend,e=f.DOM,a=f.dom.Event,c=f.ThemeManager,b=f.PluginManager,d=f.explode;f.create("static tinymce.EditorManager",{editors:{},i18n:{},activeEditor:null,preInit:function(){var i=this,j=window.location;f.documentBaseURL=j.href.replace(/[\?#].*$/,"").replace(/[\/\\][^\/]+$/,"");if(!/[\/\\]$/.test(f.documentBaseURL)){f.documentBaseURL+="/"}f.baseURL=new f.util.URI(f.documentBaseURL).toAbsolute(f.baseURL);f.EditorManager.baseURI=new f.util.URI(f.baseURL);i.onBeforeUnload=new f.util.Dispatcher(i);a.add(window,"beforeunload",function(k){i.onBeforeUnload.dispatch(i,k)})},init:function(q){var p=this,l,k=f.ScriptLoader,o,n,i=[],m;function j(u,v,r){var t=u[v];if(!t){return}if(f.is(t,"string")){r=t.replace(/\.\w+$/,"");r=r?f.resolve(r):0;t=f.resolve(t)}return t.apply(r||this,Array.prototype.slice.call(arguments,2))}q=h({theme:"simple",language:"en",strict_loading_mode:document.contentType=="application/xhtml+xml"},q);p.settings=q;if(!a.domLoaded&&!q.strict_loading_mode){if(q.language){k.add(f.baseURL+"/langs/"+q.language+".js")}if(q.theme&&q.theme.charAt(0)!="-"&&!c.urls[q.theme]){c.load(q.theme,"themes/"+q.theme+"/editor_template"+f.suffix+".js")}if(q.plugins){l=d(q.plugins);if(f.inArray(l,"compat2x")!=-1){b.load("compat2x","plugins/compat2x/editor_plugin"+f.suffix+".js")}g(l,function(r){if(r&&r.charAt(0)!="-"&&!b.urls[r]){if(!f.isWebKit&&r=="safari"){return}b.load(r,"plugins/"+r+"/editor_plugin"+f.suffix+".js")}})}k.loadQueue()}a.add(document,"init",function(){var r,t;j(q,"onpageload");if(q.browsers){r=false;g(d(q.browsers),function(u){switch(u){case"ie":case"msie":if(f.isIE){r=true}break;case"gecko":if(f.isGecko){r=true}break;case"safari":case"webkit":if(f.isWebKit){r=true}break;case"opera":if(f.isOpera){r=true}break}});if(!r){return}}switch(q.mode){case"exact":r=q.elements||"";if(r.length>0){g(d(r),function(u){if(e.get(u)){m=new f.Editor(u,q);i.push(m);m.render(1)}else{o=0;g(document.forms,function(v){g(v.elements,function(w){if(w.name===u){u="mce_editor_"+o;e.setAttrib(w,"id",u);m=new f.Editor(u,q);i.push(m);m.render(1)}})})}})}break;case"textareas":case"specific_textareas":function s(v,u){return u.constructor===RegExp?u.test(v.className):e.hasClass(v,u)}g(e.select("textarea"),function(u){if(q.editor_deselector&&s(u,q.editor_deselector)){return}if(!q.editor_selector||s(u,q.editor_selector)){n=e.get(u.name);if(!u.id&&!n){u.id=u.name}if(!u.id||p.get(u.id)){u.id=e.uniqueId()}m=new f.Editor(u.id,q);i.push(m);m.render(1)}});break}if(q.oninit){r=t=0;g(i,function(u){t++;if(!u.initialized){u.onInit.add(function(){r++;if(r==t){j(q,"oninit")}})}else{r++}if(r==t){j(q,"oninit")}})}})},get:function(i){return this.editors[i]},getInstanceById:function(i){return this.get(i)},add:function(i){this.editors[i.id]=i;this._setActive(i);return i},remove:function(j){var i=this;if(!i.editors[j.id]){return null}delete i.editors[j.id];if(i.activeEditor==j){i._setActive(null);g(i.editors,function(k){i._setActive(k);return false})}j.destroy();return j},execCommand:function(o,m,l){var n=this,k=n.get(l),i;switch(o){case"mceFocus":k.focus();return true;case"mceAddEditor":case"mceAddControl":if(!n.get(l)){new f.Editor(l,n.settings).render()}return true;case"mceAddFrameControl":i=l.window;i.tinyMCE=tinyMCE;i.tinymce=f;f.DOM.doc=i.document;f.DOM.win=i;k=new f.Editor(l.element_id,l);k.render();if(f.isIE){function j(){k.destroy();i.detachEvent("onunload",j);i=i.tinyMCE=i.tinymce=null}i.attachEvent("onunload",j)}l.page_window=null;return true;case"mceRemoveEditor":case"mceRemoveControl":if(k){k.remove()}return true;case"mceToggleEditor":if(!k){n.execCommand("mceAddControl",0,l);return true}if(k.isHidden()){k.show()}else{k.hide()}return true}if(n.activeEditor){return n.activeEditor.execCommand(o,m,l)}return false},execInstanceCommand:function(m,l,k,j){var i=this.get(m);if(i){return i.execCommand(l,k,j)}return false},triggerSave:function(){g(this.editors,function(i){i.save()})},addI18n:function(k,l){var i,j=this.i18n;if(!f.is(k,"string")){g(k,function(n,m){g(n,function(q,p){g(q,function(s,r){if(p==="common"){j[m+"."+r]=s}else{j[m+"."+p+"."+r]=s}})})})}else{g(l,function(n,m){j[k+"."+m]=n})}},_setActive:function(i){this.selectedInstance=this.activeEditor=i}});f.EditorManager.preInit()})(tinymce);var tinyMCE=window.tinyMCE=tinymce.EditorManager;(function(n){var o=n.DOM,k=n.dom.Event,f=n.extend,l=n.util.Dispatcher;var j=n.each,a=n.isGecko,b=n.isIE,e=n.isWebKit;var d=n.is,h=n.ThemeManager,c=n.PluginManager,i=n.EditorManager;var p=n.inArray,m=n.grep,g=n.explode;n.create("tinymce.Editor",{Editor:function(u,r){var q=this;q.id=q.editorId=u;q.execCommands={};q.queryStateCommands={};q.queryValueCommands={};q.plugins={};j(["onPreInit","onBeforeRenderUI","onPostRender","onInit","onRemove","onActivate","onDeactivate","onClick","onEvent","onMouseUp","onMouseDown","onDblClick","onKeyDown","onKeyUp","onKeyPress","onContextMenu","onSubmit","onReset","onPaste","onPreProcess","onPostProcess","onBeforeSetContent","onBeforeGetContent","onSetContent","onGetContent","onLoadContent","onSaveContent","onNodeChange","onChange","onBeforeExecCommand","onExecCommand","onUndo","onRedo","onVisualAid","onSetProgressState"],function(s){q[s]=new l(q)});q.settings=r=f({id:u,language:"en",docs_language:"en",theme:"simple",skin:"default",delta_width:0,delta_height:0,popup_css:"",plugins:"",document_base_url:n.documentBaseURL,add_form_submit_trigger:1,submit_patch:1,add_unload_trigger:1,convert_urls:1,relative_urls:1,remove_script_host:1,table_inline_editing:0,object_resizing:1,cleanup:1,accessibility_focus:1,custom_shortcuts:1,custom_undo_redo_keyboard_shortcuts:1,custom_undo_redo_restore_selection:1,custom_undo_redo:1,doctype:'<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">',visual_table_class:"mceItemTable",visual:1,inline_styles:true,convert_fonts_to_spans:true,font_size_style_values:"xx-small,x-small,small,medium,large,x-large,xx-large",apply_source_formatting:1,directionality:"ltr",forced_root_block:"p",valid_elements:"@[id|class|style|title|dir<ltr?rtl|lang|xml::lang|onclick|ondblclick|onmousedown|onmouseup|onmouseover|onmousemove|onmouseout|onkeypress|onkeydown|onkeyup],a[rel|rev|charset|hreflang|tabindex|accesskey|type|name|href|target|title|class|onfocus|onblur],strong/b,em/i,strike,u,#p[align],-ol[type|compact],-ul[type|compact],-li,br,img[longdesc|usemap|src|border|alt=|title|hspace|vspace|width|height|align],-sub,-sup,-blockquote[cite],-table[border=0|cellspacing|cellpadding|width|frame|rules|height|align|summary|bgcolor|background|bordercolor],-tr[rowspan|width|height|align|valign|bgcolor|background|bordercolor],tbody,thead,tfoot,#td[colspan|rowspan|width|height|align|valign|bgcolor|background|bordercolor|scope],#th[colspan|rowspan|width|height|align|valign|scope],caption,-div,-span,-code,-pre,address,-h1,-h2,-h3,-h4,-h5,-h6,hr[size|noshade],-font[face|size|color],dd,dl,dt,cite,abbr,acronym,del[datetime|cite],ins[datetime|cite],object[classid|width|height|codebase|*],param[name|value],embed[type|width|height|src|*],script[src|type],map[name],area[shape|coords|href|alt|target],bdo,button,col[align|char|charoff|span|valign|width],colgroup[align|char|charoff|span|valign|width],dfn,fieldset,form[action|accept|accept-charset|enctype|method],input[accept|alt|checked|disabled|maxlength|name|readonly|size|src|type|value|tabindex|accesskey],kbd,label[for],legend,noscript,optgroup[label|disabled],option[disabled|label|selected|value],q[cite],samp,select[disabled|multiple|name|size],small,textarea[cols|rows|disabled|name|readonly],tt,var,big",hidden_input:1,padd_empty_editor:1,render_ui:1,init_theme:1,force_p_newlines:1,indentation:"30px",keep_styles:1,fix_table_elements:1,removeformat_selector:"span,b,strong,em,i,font,u,strike"},r);q.documentBaseURI=new n.util.URI(r.document_base_url||n.documentBaseURL,{base_uri:tinyMCE.baseURI});q.baseURI=i.baseURI;q.execCallback("setup",q)},render:function(u){var v=this,w=v.settings,x=v.id,q=n.ScriptLoader;if(!k.domLoaded){k.add(document,"init",function(){v.render()});return}if(!u){w.strict_loading_mode=1;tinyMCE.settings=w}if(!v.getElement()){return}if(w.strict_loading_mode){q.settings.strict_mode=w.strict_loading_mode;n.DOM.settings.strict=1}if(!/TEXTAREA|INPUT/i.test(v.getElement().nodeName)&&w.hidden_input&&o.getParent(x,"form")){o.insertAfter(o.create("input",{type:"hidden",name:x}),x)}if(n.WindowManager){v.windowManager=new n.WindowManager(v)}if(w.encoding=="xml"){v.onGetContent.add(function(s,t){if(t.save){t.content=o.encode(t.content)}})}if(w.add_form_submit_trigger){v.onSubmit.addToTop(function(){if(v.initialized){v.save();v.isNotDirty=1}})}if(w.add_unload_trigger){v._beforeUnload=tinyMCE.onBeforeUnload.add(function(){if(v.initialized&&!v.destroyed&&!v.isHidden()){v.save({format:"raw",no_events:true})}})}n.addUnload(v.destroy,v);if(w.submit_patch){v.onBeforeRenderUI.add(function(){var s=v.getElement().form;if(!s){return}if(s._mceOldSubmit){return}if(!s.submit.nodeType&&!s.submit.length){v.formElement=s;s._mceOldSubmit=s.submit;s.submit=function(){i.triggerSave();v.isNotDirty=1;return v.formElement._mceOldSubmit(v.formElement)}}s=null})}function r(){if(w.language){q.add(n.baseURL+"/langs/"+w.language+".js")}if(w.theme&&w.theme.charAt(0)!="-"&&!h.urls[w.theme]){h.load(w.theme,"themes/"+w.theme+"/editor_template"+n.suffix+".js")}j(g(w.plugins),function(s){if(s&&s.charAt(0)!="-"&&!c.urls[s]){if(!e&&s=="safari"){return}c.load(s,"plugins/"+s+"/editor_plugin"+n.suffix+".js")}});q.loadQueue(function(){if(!v.removed){v.init()}})}if(w.plugins.indexOf("compat2x")!=-1){c.load("compat2x","plugins/compat2x/editor_plugin"+n.suffix+".js");q.loadQueue(r)}else{r()}},init:function(){var v,F=this,G=F.settings,C,z,B=F.getElement(),r,q,D,y,A,E;i.add(F);if(G.theme){G.theme=G.theme.replace(/-/,"");r=h.get(G.theme);F.theme=new r();if(F.theme.init&&G.init_theme){F.theme.init(F,h.urls[G.theme]||n.documentBaseURL.replace(/\/$/,""))}}j(g(G.plugins.replace(/\-/g,"")),function(w){var H=c.get(w),t=c.urls[w]||n.documentBaseURL.replace(/\/$/,""),s;if(H){s=new H(F,t);F.plugins[w]=s;if(s.init){s.init(F,t)}}});if(G.popup_css!==false){if(G.popup_css){G.popup_css=F.documentBaseURI.toAbsolute(G.popup_css)}else{G.popup_css=F.baseURI.toAbsolute("themes/"+G.theme+"/skins/"+G.skin+"/dialog.css")}}if(G.popup_css_add){G.popup_css+=","+F.documentBaseURI.toAbsolute(G.popup_css_add)}F.controlManager=new n.ControlManager(F);F.undoManager=new n.UndoManager(F);F.undoManager.onAdd.add(function(t,s){if(!s.initial){return F.onChange.dispatch(F,s,t)}});F.undoManager.onUndo.add(function(t,s){return F.onUndo.dispatch(F,s,t)});F.undoManager.onRedo.add(function(t,s){return F.onRedo.dispatch(F,s,t)});if(G.custom_undo_redo){F.onExecCommand.add(function(t,w,u,H,s){if(w!="Undo"&&w!="Redo"&&w!="mceRepaint"&&(!s||!s.skip_undo)){F.undoManager.add()}})}F.onExecCommand.add(function(s,t){if(!/^(FontName|FontSize)$/.test(t)){F.nodeChanged()}});if(a){function x(s,t){if(!t||!t.initial){F.execCommand("mceRepaint")}}F.onUndo.add(x);F.onRedo.add(x);F.onSetContent.add(x)}F.onBeforeRenderUI.dispatch(F,F.controlManager);if(G.render_ui){C=G.width||B.style.width||B.offsetWidth;z=G.height||B.style.height||B.offsetHeight;F.orgDisplay=B.style.display;E=/^[0-9\.]+(|px)$/i;if(E.test(""+C)){C=Math.max(parseInt(C)+(r.deltaWidth||0),100)}if(E.test(""+z)){z=Math.max(parseInt(z)+(r.deltaHeight||0),100)}r=F.theme.renderUI({targetNode:B,width:C,height:z,deltaWidth:G.delta_width,deltaHeight:G.delta_height});F.editorContainer=r.editorContainer}if(document.domain&&location.hostname!=document.domain){n.relaxedDomain=document.domain}o.setStyles(r.sizeContainer||r.editorContainer,{width:C,height:z});z=(r.iframeHeight||z)+(typeof(z)=="number"?(r.deltaHeight||0):"");if(z<100){z=100}F.iframeHTML=G.doctype+'<html><head xmlns="http://www.w3.org/1999/xhtml">';if(G.document_base_url!=n.documentBaseURL){F.iframeHTML+='<base href="'+F.documentBaseURI.getURI()+'" />'}F.iframeHTML+='<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />';if(n.relaxedDomain){F.iframeHTML+='<script type="text/javascript">document.domain = "'+n.relaxedDomain+'";<\/script>'}y=G.body_id||"tinymce";if(y.indexOf("=")!=-1){y=F.getParam("body_id","","hash");y=y[F.id]||y}A=G.body_class||"";if(A.indexOf("=")!=-1){A=F.getParam("body_class","","hash");A=A[F.id]||""}F.iframeHTML+='</head><body id="'+y+'" class="mceContentBody '+A+'"></body></html>';if(n.relaxedDomain){if(b||(n.isOpera&&parseFloat(opera.version())>=9.5)){D='javascript:(function(){document.open();document.domain="'+document.domain+'";var ed = window.parent.tinyMCE.get("'+F.id+'");document.write(ed.iframeHTML);document.close();ed.setupIframe();})()'}else{if(n.isOpera){D='javascript:(function(){document.open();document.domain="'+document.domain+'";document.close();ed.setupIframe();})()'}}}v=o.add(r.iframeContainer,"iframe",{id:F.id+"_ifr",src:D||'javascript:""',frameBorder:"0",style:{width:"100%",height:z}});F.contentAreaContainer=r.iframeContainer;o.get(r.editorContainer).style.display=F.orgDisplay;o.get(F.id).style.display="none";if(!b||!n.relaxedDomain){F.setupIframe()}B=v=r=null},setupIframe:function(){var z=this,A=z.settings,u=o.get(z.id),v=z.getDoc(),r,x;if(!b||!n.relaxedDomain){v.open();v.write(z.iframeHTML);v.close()}if(!b){try{if(!A.readonly){v.designMode="On"}}catch(w){}}if(b){x=z.getBody();o.hide(x);if(!A.readonly){x.contentEditable=true}o.show(x)}z.dom=new n.DOM.DOMUtils(z.getDoc(),{keep_values:true,url_converter:z.convertURL,url_converter_scope:z,hex_colors:A.force_hex_style_colors,class_filter:A.class_filter,update_styles:1,fix_ie_paragraphs:1});z.serializer=new n.dom.Serializer({entity_encoding:A.entity_encoding,entities:A.entities,valid_elements:A.verify_html===false?"*[*]":A.valid_elements,extended_valid_elements:A.extended_valid_elements,valid_child_elements:A.valid_child_elements,invalid_elements:A.invalid_elements,fix_table_elements:A.fix_table_elements,fix_list_elements:A.fix_list_elements,fix_content_duplication:A.fix_content_duplication,convert_fonts_to_spans:A.convert_fonts_to_spans,font_size_classes:A.font_size_classes,font_size_style_values:A.font_size_style_values,apply_source_formatting:A.apply_source_formatting,remove_linebreaks:A.remove_linebreaks,element_format:A.element_format,dom:z.dom});z.selection=new n.dom.Selection(z.dom,z.getWin(),z.serializer);z.forceBlocks=new n.ForceBlocks(z,{forced_root_block:A.forced_root_block});z.editorCommands=new n.EditorCommands(z);z.serializer.onPreProcess.add(function(s,t){return z.onPreProcess.dispatch(z,t,s)});z.serializer.onPostProcess.add(function(s,t){return z.onPostProcess.dispatch(z,t,s)});z.onPreInit.dispatch(z);if(!A.gecko_spellcheck){z.getBody().spellcheck=0}if(!A.readonly){z._addEvents()}z.controlManager.onPostRender.dispatch(z,z.controlManager);z.onPostRender.dispatch(z);if(A.directionality){z.getBody().dir=A.directionality}if(A.nowrap){z.getBody().style.whiteSpace="nowrap"}if(A.custom_elements){function y(s,t){j(g(A.custom_elements),function(B){var C;if(B.indexOf("~")===0){B=B.substring(1);C="span"}else{C="div"}t.content=t.content.replace(new RegExp("<("+B+")([^>]*)>","g"),"<"+C+' mce_name="$1"$2>');t.content=t.content.replace(new RegExp("</("+B+")>","g"),"</"+C+">")})}z.onBeforeSetContent.add(y);z.onPostProcess.add(function(s,t){if(t.set){y(s,t)}})}if(A.handle_node_change_callback){z.onNodeChange.add(function(t,s,B){z.execCallback("handle_node_change_callback",z.id,B,-1,-1,true,z.selection.isCollapsed())})}if(A.save_callback){z.onSaveContent.add(function(s,B){var t=z.execCallback("save_callback",z.id,B.content,z.getBody());if(t){B.content=t}})}if(A.onchange_callback){z.onChange.add(function(t,s){z.execCallback("onchange_callback",z,s)})}if(A.convert_newlines_to_brs){z.onBeforeSetContent.add(function(s,t){if(t.initial){t.content=t.content.replace(/\r?\n/g,"<br />")}})}if(A.fix_nesting&&b){z.onBeforeSetContent.add(function(s,t){t.content=z._fixNesting(t.content)})}if(A.preformatted){z.onPostProcess.add(function(s,t){t.content=t.content.replace(/^\s*<pre.*?>/,"");t.content=t.content.replace(/<\/pre>\s*$/,"");if(t.set){t.content='<pre class="mceItemHidden">'+t.content+"</pre>"}})}if(A.verify_css_classes){z.serializer.attribValueFilter=function(D,B){var C,t;if(D=="class"){if(!z.classesRE){t=z.dom.getClasses();if(t.length>0){C="";j(t,function(s){C+=(C?"|":"")+s["class"]});z.classesRE=new RegExp("("+C+")","gi")}}return !z.classesRE||/(\bmceItem\w+\b|\bmceTemp\w+\b)/g.test(B)||z.classesRE.test(B)?B:""}return B}}if(A.convert_fonts_to_spans){z._convertFonts()}if(A.inline_styles){z._convertInlineElements()}if(A.cleanup_callback){z.onBeforeSetContent.add(function(s,t){t.content=z.execCallback("cleanup_callback","insert_to_editor",t.content,t)});z.onPreProcess.add(function(s,t){if(t.set){z.execCallback("cleanup_callback","insert_to_editor_dom",t.node,t)}if(t.get){z.execCallback("cleanup_callback","get_from_editor_dom",t.node,t)}});z.onPostProcess.add(function(s,t){if(t.set){t.content=z.execCallback("cleanup_callback","insert_to_editor",t.content,t)}if(t.get){t.content=z.execCallback("cleanup_callback","get_from_editor",t.content,t)}})}if(A.save_callback){z.onGetContent.add(function(s,t){if(t.save){t.content=z.execCallback("save_callback",z.id,t.content,z.getBody())}})}if(A.handle_event_callback){z.onEvent.add(function(s,t,B){if(z.execCallback("handle_event_callback",t,s,B)===false){k.cancel(t)}})}z.onSetContent.add(function(){z.addVisual(z.getBody())});if(A.padd_empty_editor){z.onPostProcess.add(function(s,t){t.content=t.content.replace(/^(<p[^>]*>(&nbsp;|&#160;|\s|\u00a0|)<\/p>[\r\n]*|<br \/>[\r\n]*)$/,"")})}if(a){function q(s,t){j(s.dom.select("a"),function(C){var B=C.parentNode;if(s.dom.isBlock(B)&&B.lastChild===C){s.dom.add(B,"br",{mce_bogus:1})}})}z.onExecCommand.add(function(s,t){if(t==="CreateLink"){q(s)}});z.onSetContent.add(z.selection.onSetContent.add(q));if(!A.readonly){try{v.designMode="Off";v.designMode="On"}catch(w){}}}setTimeout(function(){if(z.removed){return}z.load({initial:true,format:(A.cleanup_on_startup?"html":"raw")});z.startContent=z.getContent({format:"raw"});z.undoManager.add({initial:true});z.initialized=true;z.onInit.dispatch(z);z.execCallback("setupcontent_callback",z.id,z.getBody(),z.getDoc());z.execCallback("init_instance_callback",z);z.focus(true);z.nodeChanged({initial:1});if(A.content_css){n.each(g(A.content_css),function(s){z.dom.loadCSS(z.documentBaseURI.toAbsolute(s))})}if(A.auto_focus){setTimeout(function(){var s=i.get(A.auto_focus);s.selection.select(s.getBody(),1);s.selection.collapse(1);s.getWin().focus()},100)}},1);u=null},focus:function(r){var u,q=this,s=q.settings.content_editable;if(!r){if(!s&&(!b||q.selection.getNode().ownerDocument!=q.getDoc())){q.getWin().focus()}}if(i.activeEditor!=q){if((u=i.activeEditor)!=null){u.onDeactivate.dispatch(u,q)}q.onActivate.dispatch(q,u)}i._setActive(q)},execCallback:function(v){var q=this,u=q.settings[v],r;if(!u){return}if(q.callbackLookup&&(r=q.callbackLookup[v])){u=r.func;r=r.scope}if(d(u,"string")){r=u.replace(/\.\w+$/,"");r=r?n.resolve(r):0;u=n.resolve(u);q.callbackLookup=q.callbackLookup||{};q.callbackLookup[v]={func:u,scope:r}}return u.apply(r||q,Array.prototype.slice.call(arguments,1))},translate:function(q){var t=this.settings.language||"en",r=i.i18n;if(!q){return""}return r[t+"."+q]||q.replace(/{\#([^}]+)\}/g,function(u,s){return r[t+"."+s]||"{#"+s+"}"})},getLang:function(r,q){return i.i18n[(this.settings.language||"en")+"."+r]||(d(q)?q:"{#"+r+"}")},getParam:function(w,s,q){var t=n.trim,r=d(this.settings[w])?this.settings[w]:s,u;if(q==="hash"){u={};if(d(r,"string")){j(r.indexOf("=")>0?r.split(/[;,](?![^=;,]*(?:[;,]|$))/):r.split(","),function(x){x=x.split("=");if(x.length>1){u[t(x[0])]=t(x[1])}else{u[t(x[0])]=t(x)}})}else{u=r}return u}return r},nodeChanged:function(u){var q=this,r=q.selection,v=r.getNode()||q.getBody();if(q.initialized){q.onNodeChange.dispatch(q,u?u.controlManager||q.controlManager:q.controlManager,b&&v.ownerDocument!=q.getDoc()?q.getBody():v,r.isCollapsed(),u)}},addButton:function(u,r){var q=this;q.buttons=q.buttons||{};q.buttons[u]=r},addCommand:function(t,r,q){this.execCommands[t]={func:r,scope:q||this}},addQueryStateHandler:function(t,r,q){this.queryStateCommands[t]={func:r,scope:q||this}},addQueryValueHandler:function(t,r,q){this.queryValueCommands[t]={func:r,scope:q||this}},addShortcut:function(s,v,q,u){var r=this,w;if(!r.settings.custom_shortcuts){return false}r.shortcuts=r.shortcuts||{};if(d(q,"string")){w=q;q=function(){r.execCommand(w,false,null)}}if(d(q,"object")){w=q;q=function(){r.execCommand(w[0],w[1],w[2])}}j(g(s),function(t){var x={func:q,scope:u||this,desc:v,alt:false,ctrl:false,shift:false};j(g(t,"+"),function(y){switch(y){case"alt":case"ctrl":case"shift":x[y]=true;break;default:x.charCode=y.charCodeAt(0);x.keyCode=y.toUpperCase().charCodeAt(0)}});r.shortcuts[(x.ctrl?"ctrl":"")+","+(x.alt?"alt":"")+","+(x.shift?"shift":"")+","+x.keyCode]=x});return true},execCommand:function(x,w,z,q){var u=this,v=0,y,r;if(!/^(mceAddUndoLevel|mceEndUndoLevel|mceBeginUndoLevel|mceRepaint|SelectAll)$/.test(x)&&(!q||!q.skip_focus)){u.focus()}y={};u.onBeforeExecCommand.dispatch(u,x,w,z,y);if(y.terminate){return false}if(u.execCallback("execcommand_callback",u.id,u.selection.getNode(),x,w,z)){u.onExecCommand.dispatch(u,x,w,z,q);return true}if(y=u.execCommands[x]){r=y.func.call(y.scope,w,z);if(r!==true){u.onExecCommand.dispatch(u,x,w,z,q);return r}}j(u.plugins,function(s){if(s.execCommand&&s.execCommand(x,w,z)){u.onExecCommand.dispatch(u,x,w,z,q);v=1;return false}});if(v){return true}if(u.theme&&u.theme.execCommand&&u.theme.execCommand(x,w,z)){u.onExecCommand.dispatch(u,x,w,z,q);return true}if(n.GlobalCommands.execCommand(u,x,w,z)){u.onExecCommand.dispatch(u,x,w,z,q);return true}if(u.editorCommands.execCommand(x,w,z)){u.onExecCommand.dispatch(u,x,w,z,q);return true}u.getDoc().execCommand(x,w,z);u.onExecCommand.dispatch(u,x,w,z,q)},queryCommandState:function(w){var r=this,v,u;if(r._isHidden()){return}if(v=r.queryStateCommands[w]){u=v.func.call(v.scope);if(u!==true){return u}}v=r.editorCommands.queryCommandState(w);if(v!==-1){return v}try{return this.getDoc().queryCommandState(w)}catch(q){}},queryCommandValue:function(w){var r=this,v,u;if(r._isHidden()){return}if(v=r.queryValueCommands[w]){u=v.func.call(v.scope);if(u!==true){return u}}v=r.editorCommands.queryCommandValue(w);if(d(v)){return v}try{return this.getDoc().queryCommandValue(w)}catch(q){}},show:function(){var q=this;o.show(q.getContainer());o.hide(q.id);q.load()},hide:function(){var q=this,r=q.getDoc();if(b&&r){r.execCommand("SelectAll")}q.save();o.hide(q.getContainer());o.setStyle(q.id,"display",q.orgDisplay)},isHidden:function(){return !o.isHidden(this.id)},setProgressState:function(q,r,s){this.onSetProgressState.dispatch(this,q,r,s);return q},load:function(u){var q=this,s=q.getElement(),r;if(s){u=u||{};u.load=true;r=q.setContent(d(s.value)?s.value:s.innerHTML,u);u.element=s;if(!u.no_events){q.onLoadContent.dispatch(q,u)}u.element=s=null;return r}},save:function(v){var q=this,u=q.getElement(),r,s;if(!u||!q.initialized){return}v=v||{};v.save=true;if(!v.no_events){q.undoManager.typing=0;q.undoManager.add()}v.element=u;r=v.content=q.getContent(v);if(!v.no_events){q.onSaveContent.dispatch(q,v)}r=v.content;if(!/TEXTAREA|INPUT/i.test(u.nodeName)){u.innerHTML=r;if(s=o.getParent(q.id,"form")){j(s.elements,function(t){if(t.name==q.id){t.value=r;return false}})}}else{u.value=r}v.element=u=null;return r},setContent:function(r,s){var q=this;s=s||{};s.format=s.format||"html";s.set=true;s.content=r;if(!s.no_events){q.onBeforeSetContent.dispatch(q,s)}if(!n.isIE&&(r.length===0||/^\s+$/.test(r))){s.content=q.dom.setHTML(q.getBody(),'<br mce_bogus="1" />');s.format="raw"}s.content=q.dom.setHTML(q.getBody(),n.trim(s.content));if(s.format!="raw"&&q.settings.cleanup){s.getInner=true;s.content=q.dom.setHTML(q.getBody(),q.serializer.serialize(q.getBody(),s))}if(!s.no_events){q.onSetContent.dispatch(q,s)}return s.content},getContent:function(s){var q=this,r;s=s||{};s.format=s.format||"html";s.get=true;if(!s.no_events){q.onBeforeGetContent.dispatch(q,s)}if(s.format!="raw"&&q.settings.cleanup){s.getInner=true;r=q.serializer.serialize(q.getBody(),s)}else{r=q.getBody().innerHTML}r=r.replace(/^\s*|\s*$/g,"");s.content=r;if(!s.no_events){q.onGetContent.dispatch(q,s)}return s.content},isDirty:function(){var q=this;return n.trim(q.startContent)!=n.trim(q.getContent({format:"raw",no_events:1}))&&!q.isNotDirty},getContainer:function(){var q=this;if(!q.container){q.container=o.get(q.editorContainer||q.id+"_parent")}return q.container},getContentAreaContainer:function(){return this.contentAreaContainer},getElement:function(){return o.get(this.settings.content_element||this.id)},getWin:function(){var q=this,r;if(!q.contentWindow){r=o.get(q.id+"_ifr");if(r){q.contentWindow=r.contentWindow}}return q.contentWindow},getDoc:function(){var r=this,q;if(!r.contentDocument){q=r.getWin();if(q){r.contentDocument=q.document}}return r.contentDocument},getBody:function(){return this.bodyElement||this.getDoc().body},convertURL:function(q,x,w){var r=this,v=r.settings;if(v.urlconverter_callback){return r.execCallback("urlconverter_callback",q,w,true,x)}if(!v.convert_urls||(w&&w.nodeName=="LINK")||q.indexOf("file:")===0){return q}if(v.relative_urls){return r.documentBaseURI.toRelative(q)}q=r.documentBaseURI.toAbsolute(q,v.remove_script_host);return q},addVisual:function(u){var q=this,r=q.settings;u=u||q.getBody();if(!d(q.hasVisual)){q.hasVisual=r.visual}j(q.dom.select("table,a",u),function(t){var s;switch(t.nodeName){case"TABLE":s=q.dom.getAttrib(t,"border");if(!s||s=="0"){if(q.hasVisual){q.dom.addClass(t,r.visual_table_class)}else{q.dom.removeClass(t,r.visual_table_class)}}return;case"A":s=q.dom.getAttrib(t,"name");if(s){if(q.hasVisual){q.dom.addClass(t,"mceItemAnchor")}else{q.dom.removeClass(t,"mceItemAnchor")}}return}});q.onVisualAid.dispatch(q,u,q.hasVisual)},remove:function(){var q=this,r=q.getContainer();q.removed=1;q.hide();q.execCallback("remove_instance_callback",q);q.onRemove.dispatch(q);q.onExecCommand.listeners=[];i.remove(q);o.remove(r)},destroy:function(r){var q=this;if(q.destroyed){return}if(!r){n.removeUnload(q.destroy);tinyMCE.onBeforeUnload.remove(q._beforeUnload);if(q.theme&&q.theme.destroy){q.theme.destroy()}q.controlManager.destroy();q.selection.destroy();q.dom.destroy();if(!q.settings.content_editable){k.clear(q.getWin());k.clear(q.getDoc())}k.clear(q.getBody());k.clear(q.formElement)}if(q.formElement){q.formElement.submit=q.formElement._mceOldSubmit;q.formElement._mceOldSubmit=null}q.contentAreaContainer=q.formElement=q.container=q.settings.content_element=q.bodyElement=q.contentDocument=q.contentWindow=null;if(q.selection){q.selection=q.selection.win=q.selection.dom=q.selection.dom.doc=null}q.destroyed=1},_addEvents:function(){var w=this,v,y=w.settings,x={mouseup:"onMouseUp",mousedown:"onMouseDown",click:"onClick",keyup:"onKeyUp",keydown:"onKeyDown",keypress:"onKeyPress",submit:"onSubmit",reset:"onReset",contextmenu:"onContextMenu",dblclick:"onDblClick",paste:"onPaste"};function u(t,A){var s=t.type;if(w.removed){return}if(w.onEvent.dispatch(w,t,A)!==false){w[x[t.fakeType||t.type]].dispatch(w,t,A)}}j(x,function(t,s){switch(s){case"contextmenu":if(n.isOpera){w.dom.bind(w.getBody(),"mousedown",function(A){if(A.ctrlKey){A.fakeType="contextmenu";u(A)}})}else{w.dom.bind(w.getBody(),s,u)}break;case"paste":w.dom.bind(w.getBody(),s,function(A){u(A)});break;case"submit":case"reset":w.dom.bind(w.getElement().form||o.getParent(w.id,"form"),s,u);break;default:w.dom.bind(y.content_editable?w.getBody():w.getDoc(),s,u)}});w.dom.bind(y.content_editable?w.getBody():(a?w.getDoc():w.getWin()),"focus",function(s){w.focus(true)});if(n.isGecko){w.dom.bind(w.getDoc(),"DOMNodeInserted",function(t){var s;t=t.target;if(t.nodeType===1&&t.nodeName==="IMG"&&(s=t.getAttribute("mce_src"))){t.src=w.documentBaseURI.toAbsolute(s)}})}if(a){function q(){var B=this,D=B.getDoc(),C=B.settings;if(a&&!C.readonly){if(B._isHidden()){try{if(!C.content_editable){D.designMode="On"}}catch(A){}}try{D.execCommand("styleWithCSS",0,false)}catch(A){if(!B._isHidden()){try{D.execCommand("useCSS",0,true)}catch(A){}}}if(!C.table_inline_editing){try{D.execCommand("enableInlineTableEditing",false,false)}catch(A){}}if(!C.object_resizing){try{D.execCommand("enableObjectResizing",false,false)}catch(A){}}}}w.onBeforeExecCommand.add(q);w.onMouseDown.add(q)}w.onMouseUp.add(w.nodeChanged);w.onClick.add(w.nodeChanged);w.onKeyUp.add(function(s,t){var A=t.keyCode;if((A>=33&&A<=36)||(A>=37&&A<=40)||A==13||A==45||A==46||A==8||(n.isMac&&(A==91||A==93))||t.ctrlKey){w.nodeChanged()}});w.onReset.add(function(){w.setContent(w.startContent,{format:"raw"})});if(y.custom_shortcuts){if(y.custom_undo_redo_keyboard_shortcuts){w.addShortcut("ctrl+z",w.getLang("undo_desc"),"Undo");w.addShortcut("ctrl+y",w.getLang("redo_desc"),"Redo")}if(a){w.addShortcut("ctrl+b",w.getLang("bold_desc"),"Bold");w.addShortcut("ctrl+i",w.getLang("italic_desc"),"Italic");w.addShortcut("ctrl+u",w.getLang("underline_desc"),"Underline")}for(v=1;v<=6;v++){w.addShortcut("ctrl+"+v,"",["FormatBlock",false,"<h"+v+">"])}w.addShortcut("ctrl+7","",["FormatBlock",false,"<p>"]);w.addShortcut("ctrl+8","",["FormatBlock",false,"<div>"]);w.addShortcut("ctrl+9","",["FormatBlock",false,"<address>"]);function z(t){var s=null;if(!t.altKey&&!t.ctrlKey&&!t.metaKey){return s}j(w.shortcuts,function(A){if(n.isMac&&A.ctrl!=t.metaKey){return}else{if(!n.isMac&&A.ctrl!=t.ctrlKey){return}}if(A.alt!=t.altKey){return}if(A.shift!=t.shiftKey){return}if(t.keyCode==A.keyCode||(t.charCode&&t.charCode==A.charCode)){s=A;return false}});return s}w.onKeyUp.add(function(s,t){var A=z(t);if(A){return k.cancel(t)}});w.onKeyPress.add(function(s,t){var A=z(t);if(A){return k.cancel(t)}});w.onKeyDown.add(function(s,t){var A=z(t);if(A){A.func.call(A.scope);return k.cancel(t)}})}if(n.isIE){w.dom.bind(w.getDoc(),"controlselect",function(A){var t=w.resizeInfo,s;A=A.target;if(A.nodeName!=="IMG"){return}if(t){w.dom.unbind(t.node,t.ev,t.cb)}if(!w.dom.hasClass(A,"mceItemNoResize")){ev="resizeend";s=w.dom.bind(A,ev,function(C){var B;C=C.target;if(B=w.dom.getStyle(C,"width")){w.dom.setAttrib(C,"width",B.replace(/[^0-9%]+/g,""));w.dom.setStyle(C,"width","")}if(B=w.dom.getStyle(C,"height")){w.dom.setAttrib(C,"height",B.replace(/[^0-9%]+/g,""));w.dom.setStyle(C,"height","")}})}else{ev="resizestart";s=w.dom.bind(A,"resizestart",k.cancel,k)}t=w.resizeInfo={node:A,ev:ev,cb:s}});w.onKeyDown.add(function(s,t){switch(t.keyCode){case 8:if(w.selection.getRng().item){w.selection.getRng().item(0).removeNode();return k.cancel(t)}}})}if(n.isOpera){w.onClick.add(function(s,t){k.prevent(t)})}if(y.custom_undo_redo){function r(){w.undoManager.typing=0;w.undoManager.add()}if(n.isIE){w.dom.bind(w.getWin(),"blur",function(s){var t;if(w.selection){t=w.selection.getNode();if(!w.removed&&t.ownerDocument&&t.ownerDocument!=w.getDoc()){r()}}})}else{w.dom.bind(w.getDoc(),"blur",function(){if(w.selection&&!w.removed){r()}})}w.onMouseDown.add(r);w.onKeyUp.add(function(s,t){if((t.keyCode>=33&&t.keyCode<=36)||(t.keyCode>=37&&t.keyCode<=40)||t.keyCode==13||t.keyCode==45||t.ctrlKey){w.undoManager.typing=0;w.undoManager.add()}});w.onKeyDown.add(function(s,t){if((t.keyCode>=33&&t.keyCode<=36)||(t.keyCode>=37&&t.keyCode<=40)||t.keyCode==13||t.keyCode==45){if(w.undoManager.typing){w.undoManager.add();w.undoManager.typing=0}return}if(!w.undoManager.typing){w.undoManager.add();w.undoManager.typing=1}})}},_convertInlineElements:function(){var z=this,B=z.settings,r=z.dom,y,w,u,A,q;function x(s,t){if(!B.inline_styles){return}if(t.get){j(z.dom.select("table,u,strike",t.node),function(v){switch(v.nodeName){case"TABLE":if(y=r.getAttrib(v,"height")){r.setStyle(v,"height",y);r.setAttrib(v,"height","")}break;case"U":case"STRIKE":v.style.textDecoration=v.nodeName=="U"?"underline":"line-through";r.setAttrib(v,"mce_style","");r.setAttrib(v,"mce_name","span");break}})}else{if(t.set){j(z.dom.select("table,span",t.node).reverse(),function(v){if(v.nodeName=="TABLE"){if(y=r.getStyle(v,"height")){r.setAttrib(v,"height",y.replace(/[^0-9%]+/g,""))}}else{if(v.style.textDecoration=="underline"){u="u"}else{if(v.style.textDecoration=="line-through"){u="strike"}else{u=""}}if(u){v.style.textDecoration="";r.setAttrib(v,"mce_style","");w=r.create(u,{style:r.getAttrib(v,"style")});r.replace(w,v,1)}}})}}}z.onPreProcess.add(x);if(!B.cleanup_on_startup){z.onSetContent.add(function(s,t){if(t.initial){x(z,{node:z.getBody(),set:1})}})}},_convertFonts:function(){var w=this,x=w.settings,z=w.dom,v,r,q,u;if(!x.inline_styles){return}v=[8,10,12,14,18,24,36];r=["xx-small","x-small","small","medium","large","x-large","xx-large"];if(q=x.font_size_style_values){q=g(q)}if(u=x.font_size_classes){u=g(u)}function y(B){var C,A,t,s;if(!x.inline_styles){return}t=w.dom.select("font",B);for(s=t.length-1;s>=0;s--){C=t[s];A=z.create("span",{style:z.getAttrib(C,"style"),"class":z.getAttrib(C,"class")});z.setStyles(A,{fontFamily:z.getAttrib(C,"face"),color:z.getAttrib(C,"color"),backgroundColor:C.style.backgroundColor});if(C.size){if(q){z.setStyle(A,"fontSize",q[parseInt(C.size)-1])}else{z.setAttrib(A,"class",u[parseInt(C.size)-1])}}z.setAttrib(A,"mce_style","");z.replace(A,C,1)}}w.onPreProcess.add(function(s,t){if(t.get){y(t.node)}});w.onSetContent.add(function(s,t){if(t.initial){y(t.node)}})},_isHidden:function(){var q;if(!a){return 0}q=this.selection.getSel();return(!q||!q.rangeCount||q.rangeCount==0)},_fixNesting:function(r){var t=[],q;r=r.replace(/<(\/)?([^\s>]+)[^>]*?>/g,function(u,s,w){var v;if(s==="/"){if(!t.length){return""}if(w!==t[t.length-1].tag){for(q=t.length-1;q>=0;q--){if(t[q].tag===w){t[q].close=1;break}}return""}else{t.pop();if(t.length&&t[t.length-1].close){u=u+"</"+t[t.length-1].tag+">";t.pop()}}}else{if(/^(br|hr|input|meta|img|link|param)$/i.test(w)){return u}if(/\/>$/.test(u)){return u}t.push({tag:w})}return u});for(q=t.length-1;q>=0;q--){r+="</"+t[q].tag+">"}return r}})})(tinymce);(function(d){var f=d.each,c=d.isIE,a=d.isGecko,b=d.isOpera,e=d.isWebKit;d.create("tinymce.EditorCommands",{EditorCommands:function(g){this.editor=g},execCommand:function(k,j,l){var h=this,g=h.editor,i;switch(k){case"mceResetDesignMode":case"mceBeginUndoLevel":return true;case"unlink":h.UnLink();return true;case"JustifyLeft":case"JustifyCenter":case"JustifyRight":case"JustifyFull":h.mceJustify(k,k.substring(7).toLowerCase());return true;default:i=this[k];if(i){i.call(this,j,l);return true}}return false},Indent:function(){var g=this.editor,l=g.dom,j=g.selection,k,h,i;h=g.settings.indentation;i=/[a-z%]+$/i.exec(h);h=parseInt(h);if(g.settings.inline_styles&&(!this.queryStateInsertUnorderedList()&&!this.queryStateInsertOrderedList())){f(j.getSelectedBlocks(),function(m){l.setStyle(m,"paddingLeft",(parseInt(m.style.paddingLeft||0)+h)+i)});return}g.getDoc().execCommand("Indent",false,null);if(c){l.getParent(j.getNode(),function(m){if(m.nodeName=="BLOCKQUOTE"){m.dir=m.style.cssText=""}})}},Outdent:function(){var h=this.editor,m=h.dom,k=h.selection,l,g,i,j;i=h.settings.indentation;j=/[a-z%]+$/i.exec(i);i=parseInt(i);if(h.settings.inline_styles&&(!this.queryStateInsertUnorderedList()&&!this.queryStateInsertOrderedList())){f(k.getSelectedBlocks(),function(n){g=Math.max(0,parseInt(n.style.paddingLeft||0)-i);m.setStyle(n,"paddingLeft",g?g+j:"")});return}h.getDoc().execCommand("Outdent",false,null)},mceSetContent:function(h,g){this.editor.setContent(g)},mceToggleVisualAid:function(){var g=this.editor;g.hasVisual=!g.hasVisual;g.addVisual()},mceReplaceContent:function(h,g){var i=this.editor.selection;i.setContent(g.replace(/\{\$selection\}/g,i.getContent({format:"text"})))},mceInsertLink:function(i,h){var g=this.editor,j=g.selection,k=g.dom.getParent(j.getNode(),"a");if(d.is(h,"string")){h={href:h}}function l(m){f(h,function(o,n){g.dom.setAttrib(m,n,o)})}if(!k){g.execCommand("CreateLink",false,"javascript:mctmp(0);");f(g.dom.select("a[href=javascript:mctmp(0);]"),function(m){l(m)})}else{if(h.href){l(k)}else{g.dom.remove(k,1)}}},UnLink:function(){var g=this.editor,h=g.selection;if(h.isCollapsed()){h.select(h.getNode())}g.getDoc().execCommand("unlink",false,null);h.collapse(0)},FontName:function(i,h){var j=this,g=j.editor,k=g.selection,l;if(!h){if(k.isCollapsed()){k.select(k.getNode())}}else{if(g.settings.convert_fonts_to_spans){j._applyInlineStyle("span",{style:{fontFamily:h}})}else{g.getDoc().execCommand("FontName",false,h)}}},FontSize:function(j,i){var h=this.editor,l=h.settings,k,g;if(l.convert_fonts_to_spans&&i>=1&&i<=7){g=d.explode(l.font_size_style_values);k=d.explode(l.font_size_classes);if(k){i=k[i-1]||i}else{i=g[i-1]||i}}if(i>=1&&i<=7){h.getDoc().execCommand("FontSize",false,i)}else{this._applyInlineStyle("span",{style:{fontSize:i}})}},queryCommandValue:function(h){var g=this["queryValue"+h];if(g){return g.call(this,h)}return false},queryCommandState:function(h){var g;switch(h){case"JustifyLeft":case"JustifyCenter":case"JustifyRight":case"JustifyFull":return this.queryStateJustify(h,h.substring(7).toLowerCase());default:if(g=this["queryState"+h]){return g.call(this,h)}}return -1},_queryState:function(h){try{return this.editor.getDoc().queryCommandState(h)}catch(g){}},_queryVal:function(h){try{return this.editor.getDoc().queryCommandValue(h)}catch(g){}},queryValueFontSize:function(){var h=this.editor,g=0,i;if(i=h.dom.getParent(h.selection.getNode(),"span")){g=i.style.fontSize}if(!g&&(b||e)){if(i=h.dom.getParent(h.selection.getNode(),"font")){g=i.size}return g}return g||this._queryVal("FontSize")},queryValueFontName:function(){var h=this.editor,g=0,i;if(i=h.dom.getParent(h.selection.getNode(),"font")){g=i.face}if(i=h.dom.getParent(h.selection.getNode(),"span")){g=i.style.fontFamily.replace(/, /g,",").replace(/[\'\"]/g,"").toLowerCase()}if(!g){g=this._queryVal("FontName")}return g},mceJustify:function(o,p){var k=this.editor,m=k.selection,g=m.getNode(),q=g.nodeName,h,j,i=k.dom,l;if(k.settings.inline_styles&&this.queryStateJustify(o,p)){l=1}h=i.getParent(g,k.dom.isBlock);if(q=="IMG"){if(p=="full"){return}if(l){if(p=="center"){i.setStyle(h||g.parentNode,"textAlign","")}i.setStyle(g,"float","");this.mceRepaint();return}if(p=="center"){if(h&&/^(TD|TH)$/.test(h.nodeName)){h=0}if(!h||h.childNodes.length>1){j=i.create("p");j.appendChild(g.cloneNode(false));if(h){i.insertAfter(j,h)}else{i.insertAfter(j,g)}i.remove(g);g=j.firstChild;h=j}i.setStyle(h,"textAlign",p);i.setStyle(g,"float","")}else{i.setStyle(g,"float",p);i.setStyle(h||g.parentNode,"textAlign","")}this.mceRepaint();return}if(k.settings.inline_styles&&k.settings.forced_root_block){if(l){p=""}f(m.getSelectedBlocks(i.getParent(m.getStart(),i.isBlock),i.getParent(m.getEnd(),i.isBlock)),function(n){i.setAttrib(n,"align","");i.setStyle(n,"textAlign",p=="full"?"justify":p)});return}else{if(!l){k.getDoc().execCommand(o,false,null)}}if(k.settings.inline_styles){if(l){i.getParent(k.selection.getNode(),function(r){if(r.style&&r.style.textAlign){i.setStyle(r,"textAlign","")}});return}f(i.select("*"),function(s){var r=s.align;if(r){if(r=="full"){r="justify"}i.setStyle(s,"textAlign",r);i.setAttrib(s,"align","")}})}},mceSetCSSClass:function(h,g){this.mceSetStyleInfo(0,{command:"setattrib",name:"class",value:g})},getSelectedElement:function(){var w=this,o=w.editor,n=o.dom,s=o.selection,h=s.getRng(),l,k,u,p,j,g,q,i,x,v;if(s.isCollapsed()||h.item){return s.getNode()}v=o.settings.merge_styles_invalid_parents;if(d.is(v,"string")){v=new RegExp(v,"i")}if(c){l=h.duplicate();l.collapse(true);u=l.parentElement();k=h.duplicate();k.collapse(false);p=k.parentElement();if(u!=p){l.move("character",1);u=l.parentElement()}if(u==p){l=h.duplicate();l.moveToElementText(u);if(l.compareEndPoints("StartToStart",h)==0&&l.compareEndPoints("EndToEnd",h)==0){return v&&v.test(u.nodeName)?null:u}}}else{function m(r){return n.getParent(r,"*")}u=h.startContainer;p=h.endContainer;j=h.startOffset;g=h.endOffset;if(!h.collapsed){if(u==p){if(j-g<2){if(u.hasChildNodes()){i=u.childNodes[j];return v&&v.test(i.nodeName)?null:i}}}}if(u.nodeType!=3||p.nodeType!=3){return null}if(j==0){i=m(u);if(i&&i.firstChild!=u){i=null}}if(j==u.nodeValue.length){q=u.nextSibling;if(q&&q.nodeType==1){i=u.nextSibling}}if(g==0){q=p.previousSibling;if(q&&q.nodeType==1){x=q}}if(g==p.nodeValue.length){x=m(p);if(x&&x.lastChild!=p){x=null}}if(i==x){return v&&i&&v.test(i.nodeName)?null:i}}return null},mceSetStyleInfo:function(n,m){var q=this,h=q.editor,j=h.getDoc(),g=h.dom,i,k,r=h.selection,p=m.wrapper||"span",k=r.getBookmark(),o;function l(t,s){if(t.nodeType==1){switch(m.command){case"setattrib":return g.setAttrib(t,m.name,m.value);case"setstyle":return g.setStyle(t,m.name,m.value);case"removeformat":return g.setAttrib(t,"class","")}}}o=h.settings.merge_styles_invalid_parents;if(d.is(o,"string")){o=new RegExp(o,"i")}if((i=q.getSelectedElement())&&!h.settings.force_span_wrappers){l(i,1)}else{j.execCommand("FontName",false,"__");f(g.select("span,font"),function(u){var s,t;if(g.getAttrib(u,"face")=="__"||u.style.fontFamily==="__"){s=g.create(p,{mce_new:"1"});l(s);f(u.childNodes,function(v){s.appendChild(v.cloneNode(true))});g.replace(s,u)}})}f(g.select(p).reverse(),function(t){var s=t.parentNode;if(!g.getAttrib(t,"mce_new")){s=g.getParent(t,"*[mce_new]");if(s){g.remove(t,1)}}});f(g.select(p).reverse(),function(t){var s=t.parentNode;if(!s||!g.getAttrib(t,"mce_new")){return}if(h.settings.force_span_wrappers&&s.nodeName!="SPAN"){return}if(s.nodeName==p.toUpperCase()&&s.childNodes.length==1){return g.remove(s,1)}if(t.nodeType==1&&(!o||!o.test(s.nodeName))&&s.childNodes.length==1){l(s);g.setAttrib(t,"class","")}});f(g.select(p).reverse(),function(s){if(g.getAttrib(s,"mce_new")||(g.getAttribs(s).length<=1&&s.className==="")){if(!g.getAttrib(s,"class")&&!g.getAttrib(s,"style")){return g.remove(s,1)}g.setAttrib(s,"mce_new","")}});r.moveToBookmark(k)},queryStateJustify:function(k,h){var g=this.editor,j=g.selection.getNode(),i=g.dom;if(j&&j.nodeName=="IMG"){if(i.getStyle(j,"float")==h){return 1}return j.parentNode.style.textAlign==h}j=i.getParent(g.selection.getStart(),function(l){return l.nodeType==1&&l.style.textAlign});if(h=="full"){h="justify"}if(g.settings.inline_styles){return(j&&j.style.textAlign==h)}return this._queryState(k)},ForeColor:function(i,h){var g=this.editor;if(g.settings.convert_fonts_to_spans){this._applyInlineStyle("span",{style:{color:h}});return}else{g.getDoc().execCommand("ForeColor",false,h)}},HiliteColor:function(i,k){var h=this,g=h.editor,j=g.getDoc();if(g.settings.convert_fonts_to_spans){this._applyInlineStyle("span",{style:{backgroundColor:k}});return}function l(n){if(!a){return}try{j.execCommand("styleWithCSS",0,n)}catch(m){j.execCommand("useCSS",0,!n)}}if(a||b){l(true);j.execCommand("hilitecolor",false,k);l(false)}else{j.execCommand("BackColor",false,k)}},FormatBlock:function(n,h){var o=this,l=o.editor,p=l.selection,j=l.dom,g,k,m;function i(q){return/^(P|DIV|H[1-6]|ADDRESS|BLOCKQUOTE|PRE)$/.test(q.nodeName)}g=j.getParent(p.getNode(),function(q){return i(q)});if(g){if((c&&i(g.parentNode))||g.nodeName=="DIV"){k=l.dom.create(h);f(j.getAttribs(g),function(q){j.setAttrib(k,q.nodeName,j.getAttrib(g,q.nodeName))});m=p.getBookmark();j.replace(k,g,1);p.moveToBookmark(m);l.nodeChanged();return}}h=l.settings.forced_root_block?(h||"<p>"):h;if(h.indexOf("<")==-1){h="<"+h+">"}if(d.isGecko){h=h.replace(/<(div|blockquote|code|dt|dd|dl|samp)>/gi,"$1")}l.getDoc().execCommand("FormatBlock",false,h)},mceCleanup:function(){var h=this.editor,i=h.selection,g=i.getBookmark();h.setContent(h.getContent());i.moveToBookmark(g)},mceRemoveNode:function(j,k){var h=this.editor,i=h.selection,g,l=k||i.getNode();if(l==h.getBody()){return}g=i.getBookmark();h.dom.remove(l,1);i.moveToBookmark(g);h.nodeChanged()},mceSelectNodeDepth:function(i,j){var g=this.editor,h=g.selection,k=0;g.dom.getParent(h.getNode(),function(l){if(l.nodeType==1&&k++==j){h.select(l);g.nodeChanged();return false}},g.getBody())},mceSelectNode:function(h,g){this.editor.selection.select(g)},mceInsertContent:function(g,h){this.editor.selection.setContent(h)},mceInsertRawHTML:function(h,i){var g=this.editor;g.selection.setContent("tiny_mce_marker");g.setContent(g.getContent().replace(/tiny_mce_marker/g,i))},mceRepaint:function(){var i,g,j=this.editor;if(d.isGecko){try{i=j.selection;g=i.getBookmark(true);if(i.getSel()){i.getSel().selectAllChildren(j.getBody())}i.collapse(true);i.moveToBookmark(g)}catch(h){}}},queryStateUnderline:function(){var g=this.editor,h=g.selection.getNode();if(h&&h.nodeName=="A"){return false}return this._queryState("Underline")},queryStateOutdent:function(){var g=this.editor,h;if(g.settings.inline_styles){if((h=g.dom.getParent(g.selection.getStart(),g.dom.isBlock))&&parseInt(h.style.paddingLeft)>0){return true}if((h=g.dom.getParent(g.selection.getEnd(),g.dom.isBlock))&&parseInt(h.style.paddingLeft)>0){return true}}return this.queryStateInsertUnorderedList()||this.queryStateInsertOrderedList()||(!g.settings.inline_styles&&!!g.dom.getParent(g.selection.getNode(),"BLOCKQUOTE"))},queryStateInsertUnorderedList:function(){return this.editor.dom.getParent(this.editor.selection.getNode(),"UL")},queryStateInsertOrderedList:function(){return this.editor.dom.getParent(this.editor.selection.getNode(),"OL")},queryStatemceBlockQuote:function(){return !!this.editor.dom.getParent(this.editor.selection.getStart(),function(g){return g.nodeName==="BLOCKQUOTE"})},_applyInlineStyle:function(o,j,m){var q=this,n=q.editor,l=n.dom,i,p={},k,r;o=o.toUpperCase();if(m&&m.check_classes&&j["class"]){m.check_classes.push(j["class"])}function h(){f(l.select(o).reverse(),function(t){var s=0;f(l.getAttribs(t),function(u){if(u.nodeName.substring(0,1)!="_"&&l.getAttrib(t,u.nodeName)!=""){s++}});if(s==0){l.remove(t,1)}})}function g(){var s;f(l.select("span,font"),function(t){if(t.style.fontFamily=="mceinline"||t.face=="mceinline"){if(!s){s=n.selection.getBookmark()}j._mce_new="1";l.replace(l.create(o,j),t,1)}});f(l.select(o+"[_mce_new]"),function(u){function t(v){if(v.nodeType==1){f(j.style,function(x,w){l.setStyle(v,w,"")});if(j["class"]&&v.className&&m){f(m.check_classes,function(w){if(l.hasClass(v,w)){l.removeClass(v,w)}})}}}f(l.select(o,u),t);if(u.parentNode&&u.parentNode.nodeType==1&&u.parentNode.childNodes.length==1){t(u.parentNode)}l.getParent(u.parentNode,function(v){if(v.nodeType==1){if(j.style){f(j.style,function(y,x){var w;if(!p[x]&&(w=l.getStyle(v,x))){if(w===y){l.setStyle(u,x,"")}p[x]=1}})}if(j["class"]&&v.className&&m){f(m.check_classes,function(w){if(l.hasClass(v,w)){l.removeClass(u,w)}})}}return false});u.removeAttribute("_mce_new")});h();n.selection.moveToBookmark(s);return !!s}n.focus();n.getDoc().execCommand("FontName",false,"mceinline");g();if(k=q._applyInlineStyle.keyhandler){n.onKeyUp.remove(k);n.onKeyPress.remove(k);n.onKeyDown.remove(k);n.onSetContent.remove(q._applyInlineStyle.chandler)}if(n.selection.isCollapsed()){if(!c){f(l.getParents(n.selection.getNode(),"span"),function(s){f(j.style,function(u,t){var w;if(w=l.getStyle(s,t)){if(w==u){l.setStyle(s,t,"");r=2;return false}r=1;return false}});if(r){return false}});if(r==2){i=n.selection.getBookmark();h();n.selection.moveToBookmark(i);window.setTimeout(function(){n.nodeChanged()},1);return}}q._pendingStyles=d.extend(q._pendingStyles||{},j.style);q._applyInlineStyle.chandler=n.onSetContent.add(function(){delete q._pendingStyles});q._applyInlineStyle.keyhandler=k=function(s){if(q._pendingStyles){j.style=q._pendingStyles;delete q._pendingStyles}if(g()){n.onKeyDown.remove(q._applyInlineStyle.keyhandler);n.onKeyPress.remove(q._applyInlineStyle.keyhandler)}if(s.type=="keyup"){n.onKeyUp.remove(q._applyInlineStyle.keyhandler)}};n.onKeyDown.add(k);n.onKeyPress.add(k);n.onKeyUp.add(k)}else{q._pendingStyles=0}}})})(tinymce);(function(a){a.create("tinymce.UndoManager",{index:0,data:null,typing:0,UndoManager:function(c){var d=this,b=a.util.Dispatcher;d.editor=c;d.data=[];d.onAdd=new b(this);d.onUndo=new b(this);d.onRedo=new b(this)},add:function(d){var g=this,f,e=g.editor,c,h=e.settings,j;d=d||{};d.content=d.content||e.getContent({format:"raw",no_events:1});d.content=d.content.replace(/^\s*|\s*$/g,"");j=g.data[g.index>0&&(g.index==0||g.index==g.data.length)?g.index-1:g.index];if(!d.initial&&j&&d.content==j.content){return null}if(h.custom_undo_redo_levels){if(g.data.length>h.custom_undo_redo_levels){for(f=0;f<g.data.length-1;f++){g.data[f]=g.data[f+1]}g.data.length--;g.index=g.data.length}}if(h.custom_undo_redo_restore_selection&&!d.initial){d.bookmark=c=d.bookmark||e.selection.getBookmark()}if(g.index<g.data.length){g.index++}if(g.data.length===0&&!d.initial){return null}g.data.length=g.index+1;g.data[g.index++]=d;if(d.initial){g.index=0}if(g.data.length==2&&g.data[0].initial){g.data[0].bookmark=c}g.onAdd.dispatch(g,d);e.isNotDirty=0;return d},undo:function(){var e=this,c=e.editor,b=b,d;if(e.typing){e.add();e.typing=0}if(e.index>0){if(e.index==e.data.length&&e.index>1){d=e.index;e.typing=0;if(!e.add()){e.index=d}--e.index}b=e.data[--e.index];c.setContent(b.content,{format:"raw"});c.selection.moveToBookmark(b.bookmark);e.onUndo.dispatch(e,b)}return b},redo:function(){var d=this,c=d.editor,b=null;if(d.index<d.data.length-1){b=d.data[++d.index];c.setContent(b.content,{format:"raw"});c.selection.moveToBookmark(b.bookmark);d.onRedo.dispatch(d,b)}return b},clear:function(){var b=this;b.data=[];b.index=0;b.typing=0;b.add({initial:true})},hasUndo:function(){return this.index!=0||this.typing},hasRedo:function(){return this.index<this.data.length-1}})})(tinymce);(function(e){var b,d,a,c,f,h;b=e.dom.Event;d=e.isIE;a=e.isGecko;c=e.isOpera;f=e.each;h=e.extend;function g(i){i=i.innerHTML;i=i.replace(/<(img|hr|table|input|select|textarea)[ \>]/gi,"-");i=i.replace(/<[^>]+>/g,"");return i.replace(/[ \t\r\n]+/g,"")==""}e.create("tinymce.ForceBlocks",{ForceBlocks:function(j){var k=this,l=j.settings,m;k.editor=j;k.dom=j.dom;m=(l.forced_root_block||"p").toLowerCase();l.element=m.toUpperCase();j.onPreInit.add(k.setup,k);k.reOpera=new RegExp("(\\u00a0|&#160;|&nbsp;)</"+m+">","gi");k.rePadd=new RegExp("<p( )([^>]+)><\\/p>|<p( )([^>]+)\\/>|<p( )([^>]+)>\\s+<\\/p>|<p><\\/p>|<p\\/>|<p>\\s+<\\/p>".replace(/p/g,m),"gi");k.reNbsp2BR1=new RegExp("<p( )([^>]+)>[\\s\\u00a0]+<\\/p>|<p>[\\s\\u00a0]+<\\/p>".replace(/p/g,m),"gi");k.reNbsp2BR2=new RegExp("<%p()([^>]+)>(&nbsp;|&#160;)<\\/%p>|<%p>(&nbsp;|&#160;)<\\/%p>".replace(/%p/g,m),"gi");k.reBR2Nbsp=new RegExp("<p( )([^>]+)>\\s*<br \\/>\\s*<\\/p>|<p>\\s*<br \\/>\\s*<\\/p>".replace(/p/g,m),"gi");function i(n,p){if(c){p.content=p.content.replace(k.reOpera,"</"+m+">")}p.content=p.content.replace(k.rePadd,"<"+m+"$1$2$3$4$5$6>\u00a0</"+m+">");if(!d&&!c&&p.set){p.content=p.content.replace(k.reNbsp2BR1,"<"+m+"$1$2><br /></"+m+">");p.content=p.content.replace(k.reNbsp2BR2,"<"+m+"$1$2><br /></"+m+">")}else{p.content=p.content.replace(k.reBR2Nbsp,"<"+m+"$1$2>\u00a0</"+m+">")}}j.onBeforeSetContent.add(i);j.onPostProcess.add(i);if(l.forced_root_block){j.onInit.add(k.forceRoots,k);j.onSetContent.add(k.forceRoots,k);j.onBeforeGetContent.add(k.forceRoots,k)}},setup:function(){var j=this,i=j.editor,k=i.settings;if(k.forced_root_block){i.onKeyUp.add(j.forceRoots,j);i.onPreProcess.add(j.forceRoots,j)}if(k.force_br_newlines){if(d){i.onKeyPress.add(function(m,p){var q,o=m.selection;if(p.keyCode==13&&o.getNode().nodeName!="LI"){o.setContent('<br id="__" /> ',{format:"raw"});q=m.dom.get("__");q.removeAttribute("id");o.select(q);o.collapse();return b.cancel(p)}})}return}if(!d&&k.force_p_newlines){i.onKeyPress.add(function(m,n){if(n.keyCode==13&&!n.shiftKey){if(!j.insertPara(n)){b.cancel(n)}}});if(a){i.onKeyDown.add(function(m,n){if((n.keyCode==8||n.keyCode==46)&&!n.shiftKey){j.backspaceDelete(n,n.keyCode==8)}})}}function l(n,m){var o=i.dom.create(m);f(n.attributes,function(p){if(p.specified&&p.nodeValue){o.setAttribute(p.nodeName.toLowerCase(),p.nodeValue)}});f(n.childNodes,function(p){o.appendChild(p.cloneNode(true))});n.parentNode.replaceChild(o,n);return o}i.onPreProcess.add(function(m,n){f(m.dom.select("p,h1,h2,h3,h4,h5,h6,div",n.node),function(o){if(g(o)){f(m.dom.select("span,em,strong,b,i",n.node),function(p){if(!p.hasChildNodes()){p.appendChild(m.getDoc().createTextNode("\u00a0"));return false}})}})});if(d){if(k.element!="P"){i.onKeyPress.add(function(m,n){j.lastElm=m.selection.getNode().nodeName});i.onKeyUp.add(function(o,q){var s,p=o.selection,r=p.getNode(),m=o.getBody();if(m.childNodes.length===1&&r.nodeName=="P"){r=l(r,k.element);p.select(r);p.collapse();o.nodeChanged()}else{if(q.keyCode==13&&!q.shiftKey&&j.lastElm!="P"){s=o.dom.getParent(r,"p");if(s){l(s,k.element);o.nodeChanged()}}}})}}},find:function(o,k,l){var j=this.editor,i=j.getDoc().createTreeWalker(o,4,null,false),m=-1;while(o=i.nextNode()){m++;if(k==0&&o==l){return m}if(k==1&&m==l){return o}}return -1},forceRoots:function(p,D){var u=this,p=u.editor,H=p.getBody(),E=p.getDoc(),K=p.selection,v=K.getSel(),w=K.getRng(),I=-2,o,B,j,k,F=-16777215;var G,l,J,A,x,m=H.childNodes,z,y,q;for(z=m.length-1;z>=0;z--){G=m[z];if(G.nodeType==3||(!u.dom.isBlock(G)&&G.nodeType!=8)){if(!l){if(G.nodeType!=3||/[^\s]/g.test(G.nodeValue)){if(I==-2&&w){if(!d){if(w.startContainer.nodeType==1&&(y=w.startContainer.childNodes[w.startOffset])&&y.nodeType==1){q=y.getAttribute("id");y.setAttribute("id","__mce")}else{if(p.dom.getParent(w.startContainer,function(i){return i===H})){B=w.startOffset;j=w.endOffset;I=u.find(H,0,w.startContainer);o=u.find(H,0,w.endContainer)}}}else{k=E.body.createTextRange();k.moveToElementText(H);k.collapse(1);J=k.move("character",F)*-1;k=w.duplicate();k.collapse(1);A=k.move("character",F)*-1;k=w.duplicate();k.collapse(0);x=(k.move("character",F)*-1)-A;I=A-J;o=x}}l=p.dom.create(p.settings.forced_root_block);l.appendChild(G.cloneNode(1));G.parentNode.replaceChild(l,G)}}else{if(l.hasChildNodes()){l.insertBefore(G,l.firstChild)}else{l.appendChild(G)}}}else{l=null}}if(I!=-2){if(!d){l=H.getElementsByTagName(p.settings.element)[0];w=E.createRange();if(I!=-1){w.setStart(u.find(H,1,I),B)}else{w.setStart(l,0)}if(o!=-1){w.setEnd(u.find(H,1,o),j)}else{w.setEnd(l,0)}if(v){v.removeAllRanges();v.addRange(w)}}else{try{w=v.createRange();w.moveToElementText(H);w.collapse(1);w.moveStart("character",I);w.moveEnd("character",o);w.select()}catch(C){}}}else{if(!d&&(y=p.dom.get("__mce"))){if(q){y.setAttribute("id",q)}else{y.removeAttribute("id")}w=E.createRange();w.setStartBefore(y);w.setEndBefore(y);K.setRng(w)}}},getParentBlock:function(j){var i=this.dom;return i.getParent(j,i.isBlock)},insertPara:function(M){var A=this,o=A.editor,I=o.dom,N=o.getDoc(),R=o.settings,B=o.selection.getSel(),C=B.getRangeAt(0),Q=N.body;var F,G,D,K,J,l,j,m,q,i,x,P,k,p,E,H=I.getViewPort(o.getWin()),w,z,v;F=N.createRange();F.setStart(B.anchorNode,B.anchorOffset);F.collapse(true);G=N.createRange();G.setStart(B.focusNode,B.focusOffset);G.collapse(true);D=F.compareBoundaryPoints(F.START_TO_END,G)<0;K=D?B.anchorNode:B.focusNode;J=D?B.anchorOffset:B.focusOffset;l=D?B.focusNode:B.anchorNode;j=D?B.focusOffset:B.anchorOffset;if(K===l&&/^(TD|TH)$/.test(K.nodeName)){if(K.firstChild.nodeName=="BR"){I.remove(K.firstChild)}if(K.childNodes.length==0){o.dom.add(K,R.element,null,"<br />");P=o.dom.add(K,R.element,null,"<br />")}else{E=K.innerHTML;K.innerHTML="";o.dom.add(K,R.element,null,E);P=o.dom.add(K,R.element,null,"<br />")}C=N.createRange();C.selectNodeContents(P);C.collapse(1);o.selection.setRng(C);return false}if(K==Q&&l==Q&&Q.firstChild&&o.dom.isBlock(Q.firstChild)){K=l=K.firstChild;J=j=0;F=N.createRange();F.setStart(K,0);G=N.createRange();G.setStart(l,0)}K=K.nodeName=="HTML"?N.body:K;K=K.nodeName=="BODY"?K.firstChild:K;l=l.nodeName=="HTML"?N.body:l;l=l.nodeName=="BODY"?l.firstChild:l;m=A.getParentBlock(K);q=A.getParentBlock(l);i=m?m.nodeName:R.element;if(A.dom.getParent(m,"ol,ul,pre")){return true}if(m&&(m.nodeName=="CAPTION"||/absolute|relative|fixed/gi.test(I.getStyle(m,"position",1)))){i=R.element;m=null}if(q&&(q.nodeName=="CAPTION"||/absolute|relative|fixed/gi.test(I.getStyle(m,"position",1)))){i=R.element;q=null}if(/(TD|TABLE|TH|CAPTION)/.test(i)||(m&&i=="DIV"&&/left|right/gi.test(I.getStyle(m,"float",1)))){i=R.element;m=q=null}x=(m&&m.nodeName==i)?m.cloneNode(0):o.dom.create(i);P=(q&&q.nodeName==i)?q.cloneNode(0):o.dom.create(i);P.removeAttribute("id");if(/^(H[1-6])$/.test(i)&&K.nodeValue&&J==K.nodeValue.length){P=o.dom.create(R.element)}E=k=K;do{if(E==Q||E.nodeType==9||A.dom.isBlock(E)||/(TD|TABLE|TH|CAPTION)/.test(E.nodeName)){break}k=E}while((E=E.previousSibling?E.previousSibling:E.parentNode));E=p=l;do{if(E==Q||E.nodeType==9||A.dom.isBlock(E)||/(TD|TABLE|TH|CAPTION)/.test(E.nodeName)){break}p=E}while((E=E.nextSibling?E.nextSibling:E.parentNode));if(k.nodeName==i){F.setStart(k,0)}else{F.setStartBefore(k)}F.setEnd(K,J);x.appendChild(F.cloneContents()||N.createTextNode(""));try{G.setEndAfter(p)}catch(L){}G.setStart(l,j);P.appendChild(G.cloneContents()||N.createTextNode(""));C=N.createRange();if(!k.previousSibling&&k.parentNode.nodeName==i){C.setStartBefore(k.parentNode)}else{if(F.startContainer.nodeName==i&&F.startOffset==0){C.setStartBefore(F.startContainer)}else{C.setStart(F.startContainer,F.startOffset)}}if(!p.nextSibling&&p.parentNode.nodeName==i){C.setEndAfter(p.parentNode)}else{C.setEnd(G.endContainer,G.endOffset)}C.deleteContents();if(c){o.getWin().scrollTo(0,H.y)}if(x.firstChild&&x.firstChild.nodeName==i){x.innerHTML=x.firstChild.innerHTML}if(P.firstChild&&P.firstChild.nodeName==i){P.innerHTML=P.firstChild.innerHTML}if(g(x)){x.innerHTML="<br />"}function O(y,s){var r=[],T,S,t;y.innerHTML="";if(R.keep_styles){S=s;do{if(/^(SPAN|STRONG|B|EM|I|FONT|STRIKE|U)$/.test(S.nodeName)){T=S.cloneNode(false);I.setAttrib(T,"id","");r.push(T)}}while(S=S.parentNode)}if(r.length>0){for(t=r.length-1,T=y;t>=0;t--){T=T.appendChild(r[t])}r[0].innerHTML=c?"&nbsp;":"<br />";return r[0]}else{y.innerHTML=c?"&nbsp;":"<br />"}}if(g(P)){v=O(P,l)}if(c&&parseFloat(opera.version())<9.5){C.insertNode(x);C.insertNode(P)}else{C.insertNode(P);C.insertNode(x)}P.normalize();x.normalize();function u(r){return N.createTreeWalker(r,NodeFilter.SHOW_TEXT,null,false).nextNode()||r}C=N.createRange();C.selectNodeContents(a?u(v||P):v||P);C.collapse(1);B.removeAllRanges();B.addRange(C);w=o.dom.getPos(P).y;z=P.clientHeight;if(w<H.y||w+z>H.y+H.h){o.getWin().scrollTo(0,w<H.y?w:w-H.h+25)}return false},backspaceDelete:function(l,u){var x=this,k=x.editor,p=k.getBody(),j,m=k.selection,i=m.getRng(),o=i.startContainer,j,q,s;if(o&&k.dom.isBlock(o)&&!/^(TD|TH)$/.test(o.nodeName)&&u){if(o.childNodes.length==0||(o.childNodes.length==1&&o.firstChild.nodeName=="BR")){j=o;while((j=j.previousSibling)&&!k.dom.isBlock(j)){}if(j){if(o!=p.firstChild){q=k.dom.doc.createTreeWalker(j,NodeFilter.SHOW_TEXT,null,false);while(s=q.nextNode()){j=s}i=k.getDoc().createRange();i.setStart(j,j.nodeValue?j.nodeValue.length:0);i.setEnd(j,j.nodeValue?j.nodeValue.length:0);m.setRng(i);k.dom.remove(o)}return b.cancel(l)}}}function v(n){var r;n=n.target;if(n&&n.parentNode&&n.nodeName=="BR"&&(j=x.getParentBlock(n))){r=n.previousSibling;b.remove(p,"DOMNodeInserted",v);if(r&&r.nodeType==3&&/\s+$/.test(r.nodeValue)){return}if(n.previousSibling||n.nextSibling){k.dom.remove(n)}}}b._add(p,"DOMNodeInserted",v);window.setTimeout(function(){b._remove(p,"DOMNodeInserted",v)},1)}})})(tinymce);(function(c){var b=c.DOM,a=c.dom.Event,d=c.each,e=c.extend;c.create("tinymce.ControlManager",{ControlManager:function(f,j){var h=this,g;j=j||{};h.editor=f;h.controls={};h.onAdd=new c.util.Dispatcher(h);h.onPostRender=new c.util.Dispatcher(h);h.prefix=j.prefix||f.id+"_";h._cls={};h.onPostRender.add(function(){d(h.controls,function(i){i.postRender()})})},get:function(f){return this.controls[this.prefix+f]||this.controls[f]},setActive:function(h,f){var g=null;if(g=this.get(h)){g.setActive(f)}return g},setDisabled:function(h,f){var g=null;if(g=this.get(h)){g.setDisabled(f)}return g},add:function(g){var f=this;if(g){f.controls[g.id]=g;f.onAdd.dispatch(g,f)}return g},createControl:function(i){var h,g=this,f=g.editor;d(f.plugins,function(j){if(j.createControl){h=j.createControl(i,g);if(h){return false}}});switch(i){case"|":case"separator":return g.createSeparator()}if(!h&&f.buttons&&(h=f.buttons[i])){return g.createButton(i,h)}return g.add(h)},createDropMenu:function(f,n,h){var m=this,i=m.editor,j,g,k,l;n=e({"class":"mceDropDown",constrain:i.settings.constrain_menus},n);n["class"]=n["class"]+" "+i.getParam("skin")+"Skin";if(k=i.getParam("skin_variant")){n["class"]+=" "+i.getParam("skin")+"Skin"+k.substring(0,1).toUpperCase()+k.substring(1)}f=m.prefix+f;l=h||m._cls.dropmenu||c.ui.DropMenu;j=m.controls[f]=new l(f,n);j.onAddItem.add(function(r,q){var p=q.settings;p.title=i.getLang(p.title,p.title);if(!p.onclick){p.onclick=function(o){i.execCommand(p.cmd,p.ui||false,p.value)}}});i.onRemove.add(function(){j.destroy()});if(c.isIE){j.onShowMenu.add(function(){i.focus();g=i.selection.getBookmark(1)});j.onHideMenu.add(function(){if(g){i.selection.moveToBookmark(g);g=0}})}return m.add(j)},createListBox:function(m,i,l){var h=this,g=h.editor,j,k,f;if(h.get(m)){return null}i.title=g.translate(i.title);i.scope=i.scope||g;if(!i.onselect){i.onselect=function(n){g.execCommand(i.cmd,i.ui||false,n||i.value)}}i=e({title:i.title,"class":"mce_"+m,scope:i.scope,control_manager:h},i);m=h.prefix+m;if(g.settings.use_native_selects){k=new c.ui.NativeListBox(m,i)}else{f=l||h._cls.listbox||c.ui.ListBox;k=new f(m,i)}h.controls[m]=k;if(c.isWebKit){k.onPostRender.add(function(p,o){a.add(o,"mousedown",function(){g.bookmark=g.selection.getBookmark(1)});a.add(o,"focus",function(){g.selection.moveToBookmark(g.bookmark);g.bookmark=null})})}if(k.hideMenu){g.onMouseDown.add(k.hideMenu,k)}return h.add(k)},createButton:function(m,i,l){var h=this,g=h.editor,j,k,f;if(h.get(m)){return null}i.title=g.translate(i.title);i.label=g.translate(i.label);i.scope=i.scope||g;if(!i.onclick&&!i.menu_button){i.onclick=function(){g.execCommand(i.cmd,i.ui||false,i.value)}}i=e({title:i.title,"class":"mce_"+m,unavailable_prefix:g.getLang("unavailable",""),scope:i.scope,control_manager:h},i);m=h.prefix+m;if(i.menu_button){f=l||h._cls.menubutton||c.ui.MenuButton;k=new f(m,i);g.onMouseDown.add(k.hideMenu,k)}else{f=h._cls.button||c.ui.Button;k=new f(m,i)}return h.add(k)},createMenuButton:function(h,f,g){f=f||{};f.menu_button=1;return this.createButton(h,f,g)},createSplitButton:function(m,i,l){var h=this,g=h.editor,j,k,f;if(h.get(m)){return null}i.title=g.translate(i.title);i.scope=i.scope||g;if(!i.onclick){i.onclick=function(n){g.execCommand(i.cmd,i.ui||false,n||i.value)}}if(!i.onselect){i.onselect=function(n){g.execCommand(i.cmd,i.ui||false,n||i.value)}}i=e({title:i.title,"class":"mce_"+m,scope:i.scope,control_manager:h},i);m=h.prefix+m;f=l||h._cls.splitbutton||c.ui.SplitButton;k=h.add(new f(m,i));g.onMouseDown.add(k.hideMenu,k);return k},createColorSplitButton:function(f,n,h){var l=this,j=l.editor,i,k,m,g;if(l.get(f)){return null}n.title=j.translate(n.title);n.scope=n.scope||j;if(!n.onclick){n.onclick=function(o){if(c.isIE){g=j.selection.getBookmark(1)}j.execCommand(n.cmd,n.ui||false,o||n.value)}}if(!n.onselect){n.onselect=function(o){j.execCommand(n.cmd,n.ui||false,o||n.value)}}n=e({title:n.title,"class":"mce_"+f,menu_class:j.getParam("skin")+"Skin",scope:n.scope,more_colors_title:j.getLang("more_colors")},n);f=l.prefix+f;m=h||l._cls.colorsplitbutton||c.ui.ColorSplitButton;k=new m(f,n);j.onMouseDown.add(k.hideMenu,k);j.onRemove.add(function(){k.destroy()});if(c.isIE){k.onShowMenu.add(function(){j.focus();g=j.selection.getBookmark(1)});k.onHideMenu.add(function(){if(g){j.selection.moveToBookmark(g);g=0}})}return l.add(k)},createToolbar:function(k,h,j){var i,g=this,f;k=g.prefix+k;f=j||g._cls.toolbar||c.ui.Toolbar;i=new f(k,h);if(g.get(k)){return null}return g.add(i)},createSeparator:function(g){var f=g||this._cls.separator||c.ui.Separator;return new f()},setControlType:function(g,f){return this._cls[g.toLowerCase()]=f},destroy:function(){d(this.controls,function(f){f.destroy()});this.controls=null}})})(tinymce);(function(d){var a=d.util.Dispatcher,e=d.each,c=d.isIE,b=d.isOpera;d.create("tinymce.WindowManager",{WindowManager:function(f){var g=this;g.editor=f;g.onOpen=new a(g);g.onClose=new a(g);g.params={};g.features={}},open:function(z,h){var v=this,k="",n,m,i=v.editor.settings.dialog_type=="modal",q,o,j,g=d.DOM.getViewPort(),r;z=z||{};h=h||{};o=b?g.w:screen.width;j=b?g.h:screen.height;z.name=z.name||"mc_"+new Date().getTime();z.width=parseInt(z.width||320);z.height=parseInt(z.height||240);z.resizable=true;z.left=z.left||parseInt(o/2)-(z.width/2);z.top=z.top||parseInt(j/2)-(z.height/2);h.inline=false;h.mce_width=z.width;h.mce_height=z.height;h.mce_auto_focus=z.auto_focus;if(i){if(c){z.center=true;z.help=false;z.dialogWidth=z.width+"px";z.dialogHeight=z.height+"px";z.scroll=z.scrollbars||false}}e(z,function(p,f){if(d.is(p,"boolean")){p=p?"yes":"no"}if(!/^(name|url)$/.test(f)){if(c&&i){k+=(k?";":"")+f+":"+p}else{k+=(k?",":"")+f+"="+p}}});v.features=z;v.params=h;v.onOpen.dispatch(v,z,h);r=z.url||z.file;r=d._addVer(r);try{if(c&&i){q=1;window.showModalDialog(r,window,k)}else{q=window.open(r,z.name,k)}}catch(l){}if(!q){alert(v.editor.getLang("popup_blocked"))}},close:function(f){f.close();this.onClose.dispatch(this)},createInstance:function(i,h,g,m,l,k){var j=d.resolve(i);return new j(h,g,m,l,k)},confirm:function(h,f,i,g){g=g||window;f.call(i||this,g.confirm(this._decode(this.editor.getLang(h,h))))},alert:function(h,f,j,g){var i=this;g=g||window;g.alert(i._decode(i.editor.getLang(h,h)));if(f){f.call(j||i)}},_decode:function(f){return d.DOM.decode(f).replace(/\\n/g,"\n")}})}(tinymce));(function(a){a.CommandManager=function(){var c={},b={},d={};function e(i,h,g,f){if(typeof(h)=="string"){h=[h]}a.each(h,function(j){i[j.toLowerCase()]={func:g,scope:f}})}a.extend(this,{add:function(h,g,f){e(c,h,g,f)},addQueryStateHandler:function(h,g,f){e(b,h,g,f)},addQueryValueHandler:function(h,g,f){e(d,h,g,f)},execCommand:function(g,j,i,h,f){if(j=c[j.toLowerCase()]){if(j.func.call(g||j.scope,i,h,f)!==false){return true}}},queryCommandValue:function(){if(cmd=d[cmd.toLowerCase()]){return cmd.func.call(scope||cmd.scope,ui,value,args)}},queryCommandState:function(){if(cmd=b[cmd.toLowerCase()]){return cmd.func.call(scope||cmd.scope,ui,value,args)}}})};a.GlobalCommands=new a.CommandManager()})(tinymce);(function(b){function a(i,d,h,m){var j,g,e,l,f;function k(p,o){do{if(p.parentNode==o){return p}p=p.parentNode}while(p)}function c(o){m(o);b.walk(o,m,"childNodes")}j=i.findCommonAncestor(d,h);e=k(d,j)||d;l=k(h,j)||h;for(g=d;g&&g!=e;g=g.parentNode){for(f=g.nextSibling;f;f=f.nextSibling){c(f)}}if(e!=l){for(g=e.nextSibling;g&&g!=l;g=g.nextSibling){c(g)}}else{c(e)}for(g=h;g&&g!=l;g=g.parentNode){for(f=g.previousSibling;f;f=f.previousSibling){c(f)}}}b.GlobalCommands.add("RemoveFormat",function(){var m=this,l=m.dom,u=m.selection,d=u.getRng(1),e=[],h,f,j,q,g,o,c,i;function k(s){var r;l.getParent(s,function(v){if(l.is(v,m.getParam("removeformat_selector"))){r=v}return l.isBlock(v)},m.getBody());return r}function p(r){if(l.is(r,m.getParam("removeformat_selector"))){e.push(r)}}function t(r){p(r);b.walk(r,p,"childNodes")}h=u.getBookmark();q=d.startContainer;o=d.endContainer;g=d.startOffset;c=d.endOffset;q=q.nodeType==1?q.childNodes[Math.min(g,q.childNodes.length-1)]:q;o=o.nodeType==1?o.childNodes[Math.min(g==c?c:c-1,o.childNodes.length-1)]:o;if(q==o){f=k(q);if(q.nodeType==3){if(f&&f.nodeType==1){i=q.splitText(g);i.splitText(c-g);l.split(f,i);u.moveToBookmark(h)}return}t(l.split(f,q)||q)}else{f=k(q);j=k(o);if(f){if(q.nodeType==3){if(g==q.nodeValue.length){q.nodeValue+="\uFEFF"}q=q.splitText(g)}}if(j){if(o.nodeType==3){o.splitText(c)}}if(f&&f==j){l.replace(l.create("span",{id:"__end"},o.cloneNode(true)),o)}if(f){f=l.split(f,q)}else{f=q}if(i=l.get("__end")){o=i;j=k(o)}if(j){j=l.split(j,o)}else{j=o}a(l,f,j,p);if(q.nodeValue=="\uFEFF"){q.nodeValue=""}t(o);t(q)}b.each(e,function(r){l.remove(r,1)});l.remove("__end",1);u.moveToBookmark(h)})})(tinymce);(function(a){a.GlobalCommands.add("mceBlockQuote",function(){var j=this,o=j.selection,f=j.dom,l,k,e,d,p,c,m,h,b;function g(i){return f.getParent(i,function(q){return q.nodeName==="BLOCKQUOTE"})}l=f.getParent(o.getStart(),f.isBlock);k=f.getParent(o.getEnd(),f.isBlock);if(p=g(l)){if(l!=k||l.childNodes.length>1||(l.childNodes.length==1&&l.firstChild.nodeName!="BR")){d=o.getBookmark()}if(g(k)){m=p.cloneNode(false);while(e=k.nextSibling){m.appendChild(e.parentNode.removeChild(e))}}if(m){f.insertAfter(m,p)}b=o.getSelectedBlocks(l,k);for(h=b.length-1;h>=0;h--){f.insertAfter(b[h],p)}if(/^\s*$/.test(p.innerHTML)){f.remove(p,1)}if(m&&/^\s*$/.test(m.innerHTML)){f.remove(m,1)}if(!d){if(!a.isIE){c=j.getDoc().createRange();c.setStart(l,0);c.setEnd(l,0);o.setRng(c)}else{o.select(l);o.collapse(0);if(f.getParent(o.getStart(),f.isBlock)!=l){c=o.getRng();c.move("character",-1);c.select()}}}else{j.selection.moveToBookmark(d)}return}if(a.isIE&&!l&&!k){j.getDoc().execCommand("Indent");e=g(o.getNode());e.style.margin=e.dir="";return}if(!l||!k){return}if(l!=k||l.childNodes.length>1||(l.childNodes.length==1&&l.firstChild.nodeName!="BR")){d=o.getBookmark()}a.each(o.getSelectedBlocks(g(o.getStart()),g(o.getEnd())),function(i){if(i.nodeName=="BLOCKQUOTE"&&!p){p=i;return}if(!p){p=f.create("blockquote");i.parentNode.insertBefore(p,i)}if(i.nodeName=="BLOCKQUOTE"&&p){e=i.firstChild;while(e){p.appendChild(e.cloneNode(true));e=e.nextSibling}f.remove(i);return}p.appendChild(f.remove(i))});if(!d){if(!a.isIE){c=j.getDoc().createRange();c.setStart(l,0);c.setEnd(l,0);o.setRng(c)}else{o.select(l);o.collapse(1)}}else{o.moveToBookmark(d)}})})(tinymce);(function(a){a.each(["Cut","Copy","Paste"],function(b){a.GlobalCommands.add(b,function(){var c=this,e=c.getDoc();try{e.execCommand(b,false,null);if(!e.queryCommandSupported(b)){throw"Error"}}catch(d){c.windowManager.alert(c.getLang("clipboard_no_support"))}})})})(tinymce);(function(a){a.GlobalCommands.add("InsertHorizontalRule",function(){if(a.isOpera){return this.getDoc().execCommand("InsertHorizontalRule",false,"")}this.selection.setContent("<hr />")})})(tinymce);(function(){var a=tinymce.GlobalCommands;a.add(["mceEndUndoLevel","mceAddUndoLevel"],function(){this.undoManager.add()});a.add("Undo",function(){var b=this;if(b.settings.custom_undo_redo){b.undoManager.undo();b.nodeChanged();return true}return false});a.add("Redo",function(){var b=this;if(b.settings.custom_undo_redo){b.undoManager.redo();b.nodeChanged();return true}return false})})();
\ No newline at end of file
+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
diff -x .svn -aruN 0.7.16.src/e107_handlers/tiny_mce/tiny_mce_popup.js 0.7.17.src/e107_handlers/tiny_mce/tiny_mce_popup.js
--- 0.7.16.src/e107_handlers/tiny_mce/tiny_mce_popup.js	2009-06-30 19:36:50.000000000 -0500
+++ 0.7.17.src/e107_handlers/tiny_mce/tiny_mce_popup.js	2009-09-20 21:32:35.000000000 -0500
@@ -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.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 e=this,g,a=document.body,c=e.dom.getViewPort(window),d,f;d=e.getWindowArg("mce_width")-c.w;f=e.getWindowArg("mce_height")-c.h;if(e.isWindow){window.resizeBy(d,f)}else{e.editor.windowManager.resizeBy(d,f,e.id)}},executeOnLoad:function(s){this.onInit.add(function(){eval(s)})},storeSelection:function(){this.editor.windowManager.bookmark=tinyMCEPopup.editor.selection.getBookmark(1)},restoreSelection:function(){var a=tinyMCEPopup;if(!a.isWindow&&tinymce.isIE){a.editor.selection.moveToBookmark(a.editor.windowManager.bookmark)}},requireLangPack:function(){var b=this,a=b.getWindowArg("plugin_url")||b.getWindowArg("theme_url");if(a&&b.editor.settings.language&&b.features.translate_i18n!==false){a+="/langs/"+b.editor.settings.language+"_dlg.js";if(!tinymce.ScriptLoader.isDone(a)){document.write('<script type="text/javascript" src="'+tinymce._addVer(a)+'"><\/script>');tinymce.ScriptLoader.markDone(a)}}},pickColor:function(b,a){this.execCommand("mceColorPicker",true,{color:document.getElementById(a).value,func:function(e){document.getElementById(a).value=e;try{document.getElementById(a).onchange()}catch(d){}}})},openBrowser:function(a,c,b){tinyMCEPopup.restoreSelection();this.editor.execCallback("file_browser_callback",a,document.getElementById(a).value,c,window)},confirm:function(b,a,c){this.editor.windowManager.confirm(b,a,c,window)},alert:function(b,a,c){this.editor.windowManager.alert(b,a,c,window)},close:function(){var a=this;function b(){a.editor.windowManager.close(window);tinymce=tinyMCE=a.editor=a.params=a.dom=a.dom.doc=null}if(tinymce.isOpera){a.getWin().setTimeout(b,0)}else{b()}},_restoreSelection:function(){var a=window.event.srcElement;if(a.nodeName=="INPUT"&&(a.type=="submit"||a.type=="button")){tinyMCEPopup.restoreSelection()}},_onDOMLoaded:function(){var b=tinyMCEPopup,d=document.title,e,c,a;if(b.domLoaded){return}b.domLoaded=1;if(b.features.translate_i18n!==false){c=document.body.innerHTML;if(tinymce.isIE){c=c.replace(/ (value|title|alt)=([^"][^\s>]+)/gi,' $1="$2"')}document.dir=b.editor.getParam("directionality","");if((a=b.editor.translate(c))&&a!=c){document.body.innerHTML=a}if((a=b.editor.translate(d))&&a!=d){document.title=d=a}}document.body.style.display="";if(tinymce.isIE){document.attachEvent("onmouseup",tinyMCEPopup._restoreSelection);b.dom.add(b.dom.select("head")[0],"base",{target:"_self"})}b.restoreSelection();b.resizeToInnerSize();if(!b.isWindow){b.editor.windowManager.setTitle(window,d)}else{window.focus()}if(!tinymce.isIE&&!b.isWindow){tinymce.dom.Event._add(document,"focus",function(){b.editor.windowManager.focus(b.id)})}tinymce.each(b.dom.select("select"),function(f){f.onkeydown=tinyMCEPopup._accessHandler});tinymce.each(b.listeners,function(f){f.func.call(f.scope,b.editor)});if(b.getWindowArg("mce_auto_focus",true)){window.focus();tinymce.each(document.forms,function(g){tinymce.each(g.elements,function(f){if(b.dom.hasClass(f,"mceFocus")&&!f.disabled){f.focus();return false}})})}document.onkeyup=tinyMCEPopup._closeWinKeyHandler},_accessHandler:function(a){a=a||window.event;if(a.keyCode==13||a.keyCode==32){a=a.target||a.srcElement;if(a.onchange){a.onchange()}return tinymce.dom.Event.cancel(a)}},_closeWinKeyHandler:function(a){a=a||window.event;if(a.keyCode==27){tinyMCEPopup.close()}},_wait:function(){if(document.attachEvent){document.attachEvent("onreadystatechange",function(){if(document.readyState==="complete"){document.detachEvent("onreadystatechange",arguments.callee);tinyMCEPopup._onDOMLoaded()}});if(document.documentElement.doScroll&&window==window.top){(function(){if(tinyMCEPopup.domLoaded){return}try{document.documentElement.doScroll("left")}catch(a){setTimeout(arguments.callee,0);return}tinyMCEPopup._onDOMLoaded()})()}document.attachEvent("onload",tinyMCEPopup._onDOMLoaded)}else{if(document.addEventListener){window.addEventListener("DOMContentLoaded",tinyMCEPopup._onDOMLoaded,false);window.addEventListener("load",tinyMCEPopup._onDOMLoaded,false)}}}};tinyMCEPopup.init();tinyMCEPopup._wait();
\ No newline at end of file
diff -x .svn -aruN 0.7.16.src/e107_handlers/tiny_mce/tiny_mce_src.js 0.7.17.src/e107_handlers/tiny_mce/tiny_mce_src.js
--- 0.7.16.src/e107_handlers/tiny_mce/tiny_mce_src.js	2009-06-30 19:36:50.000000000 -0500
+++ 0.7.17.src/e107_handlers/tiny_mce/tiny_mce_src.js	2009-10-02 13:45:11.000000000 -0500
@@ -1,18 +1,23 @@
 var tinymce = {
 	majorVersion : '3',
-	minorVersion : '2.5',
-	releaseDate : '2009-06-29',
+	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;
 
-		// Browser checks
 		t.isOpera = w.opera && opera.buildNumber;
+
 		t.isWebKit = /WebKit/.test(ua);
+
 		t.isIE = !t.isWebKit && !t.isOpera && (/MSIE/gi).test(ua) && (/Explorer/gi).test(na.appName);
+
 		t.isIE6 = t.isIE && /MSIE [56]/.test(ua);
+
 		t.isGecko = !t.isWebKit && /Gecko/.test(ua);
+
 		t.isMac = ua.indexOf('Mac') != -1;
+
 		t.isAir = /adobeair/i.test(ua);
 
 		// TinyMCE .NET webcontrol might be setting the values for TinyMCE
@@ -49,7 +54,9 @@
 				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
-				if (base && t.baseURL.indexOf('://') == -1)
+				// 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;
@@ -90,7 +97,6 @@
 		return n == t;
 	},
 
-
 	each : function(o, cb, s) {
 		var n, l;
 
@@ -118,6 +124,7 @@
 		return 1;
 	},
 
+
 	map : function(a, f) {
 		var o = [];
 
@@ -296,7 +303,7 @@
 		o = o || window;
 
 		n = n.split('.');
-		for (i=0, l = n.length; i<l; i++) {
+		for (i = 0, l = n.length; i < l; i++) {
 			o = o[n[i]];
 
 			if (!o)
@@ -490,7 +497,7 @@
 			s = t.settings = s || {};
 
 			// Strange app protocol or local anchor
-			if (/^(mailto|tel|news|javascript|about):/i.test(u) || /^\s*#/.test(u)) {
+			if (/^(mailto|tel|news|javascript|about|data):/i.test(u) || /^\s*#/.test(u)) {
 				t.source = u;
 				return;
 			}
@@ -578,7 +585,7 @@
 		toAbsolute : function(u, nh) {
 			var u = new tinymce.util.URI(u, {base_uri : this});
 
-			return u.getURI(this.host == u.host ? nh : 0);
+			return u.getURI(this.host == u.host && this.protocol == u.protocol ? nh : 0);
 		},
 
 		toRelPath : function(base, path) {
@@ -624,7 +631,7 @@
 		},
 
 		toAbsPath : function(base, path) {
-			var i, nb = 0, o = [], tr;
+			var i, nb = 0, o = [], tr, outPath;
 
 			// Split paths
 			tr = /\/$/.test(path) ? '/' : '';
@@ -664,9 +671,19 @@
 
 			// If /a/b/c or /
 			if (i <= 0)
-				return '/' + o.reverse().join('/') + tr;
+				outPath = o.reverse().join('/');
+			else
+				outPath = base.slice(0, i).join('/') + '/' + o.reverse().join('/');
 
-			return '/' + base.slice(0, i).join('/') + '/' + o.reverse().join('/') + tr;
+			// 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) {
@@ -704,8 +721,7 @@
 
 			return t.source;
 		}
-
-		});
+	});
 })();
 (function() {
 	var each = tinymce.each;
@@ -775,8 +791,7 @@
 
 			this.set(n, '', d, p, d);
 		}
-
-		});
+	});
 })();
 tinymce.create('static tinymce.util.JSON', {
 	serialize : function(o) {
@@ -863,6 +878,8 @@
 			if (o.content_type)
 				x.setRequestHeader('Content-Type', o.content_type);
 
+			x.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
+
 			x.send(o.data);
 
 			function ready() {
@@ -884,8 +901,7 @@
 			// 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;
@@ -938,8 +954,7 @@
 				return new tinymce.util.JSONRequest().send(o);
 			}
 		}
-
-		});
+	});
 }());(function(tinymce) {
 	// Shorten names
 	var each = tinymce.each, is = tinymce.is;
@@ -1110,6 +1125,14 @@
 			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;
@@ -1393,6 +1416,18 @@
 			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;
 
@@ -1790,7 +1825,7 @@
 					if (x) {
 						// So if we replace the p elements with divs and mark them and then replace them back to paragraphs
 						// after we use innerHTML we can fix the DOM tree
-						h = h.replace(/<p ([^>]+)>|<p>/g, '<div $1 mce_tmp="1">');
+						h = h.replace(/<p ([^>]+)>|<p>/ig, '<div $1 mce_tmp="1">');
 						h = h.replace(/<\/p>/g, '</div>');
 
 						// Set the new HTML with DIVs
@@ -1841,7 +1876,7 @@
 		},
 
 		processHTML : function(h) {
-			var t = this, s = t.settings;
+			var t = this, s = t.settings, codeBlocks = [];
 
 			if (!s.process_html)
 				return h;
@@ -1861,7 +1896,7 @@
 			// Store away src and href in mce_src and mce_href since browsers mess them up
 			if (s.keep_values) {
 				// Wrap scripts and styles in comments for serialization purposes
-				if (/<script|noscript|style/.test(h)) {
+				if (/<script|noscript|style/i.test(h)) {
 					function trim(s) {
 						// Remove prefix and suffix code for element
 						s = s.replace(/(<!--\[CDATA\[|\]\]-->)/g, '\n');
@@ -1873,14 +1908,13 @@
 					};
 
 					// Wrap the script contents in CDATA and keep them from executing
-					h = h.replace(/<script([^>]+|)>([\s\S]*?)<\/script>/g, function(v, attribs, text) {
+					h = h.replace(/<script([^>]+|)>([\s\S]*?)<\/script>/gi, function(v, attribs, text) {
 						// Force type attribute
 						if (!attribs)
 							attribs = ' type="text/javascript"';
 
-						// Prefix script type/language attribute values with mce- to prevent it from executing
-						attribs = attribs.replace(/(type|language)=\"?/, '$&mce-');
-						attribs = attribs.replace(/src=\"([^\"]+)\"?/, function(a, url) {
+						// 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'));
 
@@ -1888,17 +1922,21 @@
 						});
 
 						// Wrap text contents
-						if (tinymce.trim(text))
-							text = '<!--\n' + trim(text) + '\n// -->';
+						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>/g, function(v, attribs, text) {
+					h = h.replace(/<style([^>]+|)>([\s\S]*?)<\/style>/gi, function(v, attribs, text) {
 						// Wrap text contents
-						if (text)
-							text = '<!--\n' + trim(text) + '\n-->';
+						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>';
 					});
@@ -1911,6 +1949,24 @@
 
 				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) {
@@ -1925,17 +1981,8 @@
 							if (t._isRes(c))
 								return m;
 
-							if (s.hex_colors) {
-								u = u.replace(/rgb\([^\)]+\)/g, function(v) {
-									return t.toHex(v);
-								});
-							}
-
-							if (s.url_converter) {
-								u = u.replace(/url\([\'\"]?([^\)\'\"]+)\)/g, function(x, c) {
-									return 'url(' + t.encode(s.url_converter.call(s.url_converter_scope || t, t.decode(c), b, n)) + ')';
-								});
-							}
+							// 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));
@@ -1949,6 +1996,11 @@
 
 					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;
@@ -1974,25 +2026,41 @@
 		setOuterHTML : function(e, h, d) {
 			var t = this;
 
-			return this.run(e, function(e) {
+			function setHTML(e, h, d) {
 				var n, tp;
+				
+				tp = d.createElement("body");
+				tp.innerHTML = h;
 
-				e = t.get(e);
-				d = d || e.ownerDocument || t.doc;
+				n = tp.lastChild;
+				while (n) {
+					t.insertAfter(n.cloneNode(true), e);
+					n = n.previousSibling;
+				}
 
-				if (isIE && e.nodeType == 1)
-					e.outerHTML = h;
-				else {
-					tp = d.createElement("body");
-					tp.innerHTML = h;
+				t.remove(e);
+			};
 
-					n = tp.lastChild;
-					while (n) {
-						t.insertAfter(n.cloneNode(true), e);
-						n = n.previousSibling;
-					}
+			return this.run(e, function(e) {
+				e = t.get(e);
 
-					t.remove(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);
 				}
 			});
 		},
@@ -2066,7 +2134,7 @@
 
 			n = n.nodeName || n;
 
-			return /^(H[1-6]|HR|P|DIV|ADDRESS|PRE|FORM|TABLE|LI|OL|UL|TR|TD|CAPTION|BLOCKQUOTE|CENTER|DL|DT|DD|DIR|FIELDSET|NOSCRIPT|NOFRAMES|MENU|ISINDEX|SAMP)$/.test(n);
+			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) {
@@ -2237,9 +2305,13 @@
 				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(/([a-z0-9\:\-_]+)=/gi, function(a, b) {
-					o.push({specified : 1, nodeName : b});
+				n.cloneNode(false).outerHTML.replace(/<\/?[\w:]+ ?|=[\"][^\"]+\"|=\'[^\']+\'|=\w+|>/gi, '').replace(/[\w:]+/gi, function(a) {
+					o.push({specified : 1, nodeName : a});
 				});
 
 				return o;
@@ -2293,16 +2365,29 @@
 				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.setStartBefore(pe);
-				r.setEndBefore(e);
+				r.setStart(pe.parentNode, nodeIndex(pe));
+				r.setEnd(e.parentNode, nodeIndex(e));
 				bef = r.extractContents();
 
 				// Get after chunk
 				r = t.createRng();
-				r.setStartAfter(e);
-				r.setEndAfter(pe);
+				r.setStart(e.parentNode, nodeIndex(e) + 1);
+				r.setEnd(pe.parentNode, nodeIndex(pe) + 1);
 				aft = r.extractContents();
 
 				// Insert chunks and remove parent
@@ -2350,6 +2435,27 @@
 		},
 
 
+		_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);
@@ -2384,10 +2490,8 @@
 			return s;
 		}
 		*/
+	});
 
-		});
-
-	// Setup page DOM
 	tinymce.DOM = new tinymce.dom.DOMUtils(document, {process_html : 0});
 })(tinymce);
 (function(ns) {
@@ -3296,6 +3400,7 @@
 				if (sc == ec && sc.nodeType == 3) {
 					startPos = getCharPos(sc, so);
 
+					ieRng = body.createTextRange();
 					ieRng.move('character', startPos);
 					ieRng.moveEnd('character', eo - so);
 					ieRng.select();
@@ -4597,10 +4702,8 @@
 				this.cancelBubble = true;
 			}
 		}
+	});
 
-		});
-
-	// Shorten name and setup global instance
 	Event = tinymce.dom.Event = new tinymce.dom.EventUtils();
 
 	// Dispatch DOM content loaded event for IE and Safari
@@ -4734,8 +4837,7 @@
 				dom.setStyle(b, 'zIndex', parseInt(t.getStyle('zIndex', 1) || 0) - 1);
 			}
 		}
-
-		});
+	});
 })(tinymce);
 (function(tinymce) {
 	function trimNl(s) {
@@ -5075,6 +5177,8 @@
 
 			// Handle explorer
 			if (isIE) {
+				t.tridentSel.destroy();
+
 				// Handle simple
 				if (r = b.rng) {
 					try {
@@ -5373,8 +5477,7 @@
 			if (!s)
 				tinymce.removeUnload(t.destroy);
 		}
-
-		});
+	});
 })(tinymce);
 (function(tinymce) {
 	tinymce.create('tinymce.dom.XMLWriter', {
@@ -5465,8 +5568,7 @@
 
 			return h;
 		}
-
-		});
+	});
 })(tinymce);
 (function(tinymce) {
 	tinymce.create('tinymce.dom.StringWriter', {
@@ -5592,8 +5694,7 @@
 
 			return true;
 		}
-
-		});
+	});
 })(tinymce);
 (function(tinymce) {
 	// Shorten names
@@ -5628,7 +5729,6 @@
 				closed : /^(br|hr|input|meta|img|link|param|area)$/,
 				entity_encoding : 'named',
 				entities : '160,nbsp,161,iexcl,162,cent,163,pound,164,curren,165,yen,166,brvbar,167,sect,168,uml,169,copy,170,ordf,171,laquo,172,not,173,shy,174,reg,175,macr,176,deg,177,plusmn,178,sup2,179,sup3,180,acute,181,micro,182,para,183,middot,184,cedil,185,sup1,186,ordm,187,raquo,188,frac14,189,frac12,190,frac34,191,iquest,192,Agrave,193,Aacute,194,Acirc,195,Atilde,196,Auml,197,Aring,198,AElig,199,Ccedil,200,Egrave,201,Eacute,202,Ecirc,203,Euml,204,Igrave,205,Iacute,206,Icirc,207,Iuml,208,ETH,209,Ntilde,210,Ograve,211,Oacute,212,Ocirc,213,Otilde,214,Ouml,215,times,216,Oslash,217,Ugrave,218,Uacute,219,Ucirc,220,Uuml,221,Yacute,222,THORN,223,szlig,224,agrave,225,aacute,226,acirc,227,atilde,228,auml,229,aring,230,aelig,231,ccedil,232,egrave,233,eacute,234,ecirc,235,euml,236,igrave,237,iacute,238,icirc,239,iuml,240,eth,241,ntilde,242,ograve,243,oacute,244,ocirc,245,otilde,246,ouml,247,divide,248,oslash,249,ugrave,250,uacute,251,ucirc,252,uuml,253,yacute,254,thorn,255,yuml,402,fnof,913,Alpha,914,Beta,915,Gamma,916,Delta,917,Epsilon,918,Zeta,919,Eta,920,Theta,921,Iota,922,Kappa,923,Lambda,924,Mu,925,Nu,926,Xi,927,Omicron,928,Pi,929,Rho,931,Sigma,932,Tau,933,Upsilon,934,Phi,935,Chi,936,Psi,937,Omega,945,alpha,946,beta,947,gamma,948,delta,949,epsilon,950,zeta,951,eta,952,theta,953,iota,954,kappa,955,lambda,956,mu,957,nu,958,xi,959,omicron,960,pi,961,rho,962,sigmaf,963,sigma,964,tau,965,upsilon,966,phi,967,chi,968,psi,969,omega,977,thetasym,978,upsih,982,piv,8226,bull,8230,hellip,8242,prime,8243,Prime,8254,oline,8260,frasl,8472,weierp,8465,image,8476,real,8482,trade,8501,alefsym,8592,larr,8593,uarr,8594,rarr,8595,darr,8596,harr,8629,crarr,8656,lArr,8657,uArr,8658,rArr,8659,dArr,8660,hArr,8704,forall,8706,part,8707,exist,8709,empty,8711,nabla,8712,isin,8713,notin,8715,ni,8719,prod,8721,sum,8722,minus,8727,lowast,8730,radic,8733,prop,8734,infin,8736,ang,8743,and,8744,or,8745,cap,8746,cup,8747,int,8756,there4,8764,sim,8773,cong,8776,asymp,8800,ne,8801,equiv,8804,le,8805,ge,8834,sub,8835,sup,8836,nsub,8838,sube,8839,supe,8853,oplus,8855,otimes,8869,perp,8901,sdot,8968,lceil,8969,rceil,8970,lfloor,8971,rfloor,9001,lang,9002,rang,9674,loz,9824,spades,9827,clubs,9829,hearts,9830,diams,338,OElig,339,oelig,352,Scaron,353,scaron,376,Yuml,710,circ,732,tilde,8194,ensp,8195,emsp,8201,thinsp,8204,zwnj,8205,zwj,8206,lrm,8207,rlm,8211,ndash,8212,mdash,8216,lsquo,8217,rsquo,8218,sbquo,8220,ldquo,8221,rdquo,8222,bdquo,8224,dagger,8225,Dagger,8240,permil,8249,lsaquo,8250,rsaquo,8364,euro',
-				bool_attrs : /(checked|disabled|readonly|selected|nowrap)/,
 				valid_elements : '*[*]',
 				extended_valid_elements : 0,
 				valid_child_elements : 0,
@@ -5712,14 +5812,21 @@
 
 			if (s.fix_table_elements) {
 				t.onPreProcess.add(function(se, o) {
-					each(t.dom.select('p table', o.node), function(n) {
-						// IE has a odd bug where tables inside paragraphs sometimes gets wrapped in a BODY and documentFragement element
-						// This hack seems to resolve that issue. This will normally not happed since your contents should be valid in the first place
-						if (isIE)
-							n.outerHTML = n.outerHTML;
-
-						t.dom.split(t.dom.getParent(n, 'p'), n);
-					});
+					// 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
+								}
+							}
+						});
+					}
 				});
 			}
 		},
@@ -6035,18 +6142,56 @@
 		},
 
 		serialize : function(n, o) {
-			var h, t = this, doc;
+			var h, t = this, doc, oldDoc, impl, selected;
 
 			t._setup();
 			o = o || {};
 			o.format = o.format || 'html';
-			n = n.cloneNode(true);
 			t.processObj = o;
 
-			// Nodes needs to be attached to something in WebKit due to a bug https://bugs.webkit.org/show_bug.cgi?id=25571
-			if (tinymce.isWebKit) {
-				doc = n.ownerDocument.implementation.createHTMLDocument("");
-				doc.body.appendChild(n);
+			// 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);
@@ -6064,6 +6209,10 @@
 			// 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);
 
@@ -6134,9 +6283,6 @@
 				// Restore CDATA sections
 				h = h.replace(/<!--\[CDATA\[([\s\S]+)\]\]-->/g, '<![CDATA[$1]]>');
 
-				// Restore scripts
-				h = h.replace(/(type|language)=\"mce-/g, '$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>');
@@ -6440,16 +6586,6 @@
 
 			v = this.dom.getAttrib(n, na);
 
-			// Bool attr
-			if (this.settings.bool_attrs.test(na) && v) {
-				v = ('' + v).toLowerCase();
-
-				if (v === 'false' || v === '0')
-					return null;
-
-				v = na;
-			}
-
 			switch (na) {
 				case 'rowspan':
 				case 'colspan':
@@ -6492,8 +6628,7 @@
 
 			return v;
 		}
-
-		});
+	});
 })(tinymce);
 (function(tinymce) {
 	var each = tinymce.each, Event = tinymce.dom.Event;
@@ -6765,8 +6900,7 @@
 				}
 			}
 		}
-
-		});
+	});
 
 	// Global script loader
 	tinymce.ScriptLoader = new tinymce.dom.ScriptLoader();
@@ -6870,12 +7004,13 @@
 		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 = {};
 	},
 
@@ -6889,8 +7024,7 @@
 	get : function(n) {
 		return this.lookup[n];
 	}
-
-	});
+});
 
 tinymce.create('tinymce.ui.Separator:tinymce.ui.Control', {
 	Separator : function(id, s) {
@@ -6901,8 +7035,7 @@
 	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;
 
@@ -6930,8 +7063,7 @@
 			if (is(t.selected))
 				t.setSelected(t.selected);
 		}
-
-		});
+	});
 })(tinymce);
 (function(tinymce) {
 	var is = tinymce.is, DOM = tinymce.DOM, each = tinymce.each, walk = tinymce.walk;
@@ -7029,8 +7161,7 @@
 
 			return m;
 		}
-
-		});
+	});
 })(tinymce);(function(tinymce) {
 	var is = tinymce.is, DOM = tinymce.DOM, each = tinymce.each, Event = tinymce.dom.Event, Element = tinymce.dom.Element;
 
@@ -7357,8 +7488,7 @@
 
 			DOM.addClass(ro, 'mceLast');
 		}
-
-		});
+	});
 })(tinymce);(function(tinymce) {
 	var DOM = tinymce.DOM;
 
@@ -7390,8 +7520,7 @@
 					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;
@@ -7401,11 +7530,17 @@
 			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';
 		},
 
@@ -7643,8 +7778,7 @@
 			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;
 
@@ -7772,15 +7906,16 @@
 
 			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;
 		},
 
@@ -7859,8 +7994,7 @@
 				}
 			});
 		}
-
-		});
+	});
 })(tinymce);
 (function(tinymce) {
 	var DOM = tinymce.DOM, Event = tinymce.dom.Event, each = tinymce.each;
@@ -7925,8 +8059,7 @@
 			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;
@@ -7944,6 +8077,7 @@
 			}, t.settings);
 
 			t.onShowMenu = new tinymce.util.Dispatcher(t);
+
 			t.onHideMenu = new tinymce.util.Dispatcher(t);
 
 			t.value = s.default_color;
@@ -8091,8 +8225,7 @@
 			Event.clear(this.id + '_more');
 			DOM.remove(this.id + '_menu');
 		}
-
-		});
+	});
 })(tinymce);
 tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', {
 	renderHTML : function() {
@@ -8155,8 +8288,7 @@
 
 		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;
 
@@ -8164,6 +8296,7 @@
 		items : [],
 		urls : {},
 		lookup : {},
+
 		onAdd : new Dispatcher(this),
 
 		get : function(n) {
@@ -8203,19 +8336,22 @@
 			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) {
+}(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() {
@@ -8280,10 +8416,6 @@
 				if (s.plugins) {
 					pl = explode(s.plugins);
 
-					// Load compat2x first
-					if (tinymce.inArray(pl, 'compat2x') != -1)
-						PluginManager.load('compat2x', 'plugins/compat2x/editor_plugin' + tinymce.suffix + '.js');
-
 					// Load rest if plugins
 					each(pl, function(v) {
 						if (v && v.charAt(0) != '-' && !PluginManager.urls[v]) {
@@ -8578,13 +8710,11 @@
 		_setActive : function(e) {
 			this.selectedInstance = this.activeEditor = e;
 		}
-
-		});
+	});
 
 	tinymce.EditorManager.preInit();
 })(tinymce);
 
-// Short for editor manager window.tinyMCE is needed when TinyMCE gets loaded though a XHR call
 var tinyMCE = window.tinyMCE = tinymce.EditorManager;
 (function(tinymce) {
 	var DOM = tinymce.DOM, Event = tinymce.dom.Event, extend = tinymce.extend, Dispatcher = tinymce.util.Dispatcher;
@@ -8597,53 +8727,90 @@
 			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);
 			});
 
-			// Default editor config
 			t.settings = s = extend({
 				id : id,
 				language : 'en',
@@ -8678,7 +8845,7 @@
 				apply_source_formatting : 1,
 				directionality : 'ltr',
 				forced_root_block : 'p',
-				valid_elements : '@[id|class|style|title|dir<ltr?rtl|lang|xml::lang|onclick|ondblclick|onmousedown|onmouseup|onmouseover|onmousemove|onmouseout|onkeypress|onkeydown|onkeyup],a[rel|rev|charset|hreflang|tabindex|accesskey|type|name|href|target|title|class|onfocus|onblur],strong/b,em/i,strike,u,#p[align],-ol[type|compact],-ul[type|compact],-li,br,img[longdesc|usemap|src|border|alt=|title|hspace|vspace|width|height|align],-sub,-sup,-blockquote[cite],-table[border=0|cellspacing|cellpadding|width|frame|rules|height|align|summary|bgcolor|background|bordercolor],-tr[rowspan|width|height|align|valign|bgcolor|background|bordercolor],tbody,thead,tfoot,#td[colspan|rowspan|width|height|align|valign|bgcolor|background|bordercolor|scope],#th[colspan|rowspan|width|height|align|valign|scope],caption,-div,-span,-code,-pre,address,-h1,-h2,-h3,-h4,-h5,-h6,hr[size|noshade],-font[face|size|color],dd,dl,dt,cite,abbr,acronym,del[datetime|cite],ins[datetime|cite],object[classid|width|height|codebase|*],param[name|value],embed[type|width|height|src|*],script[src|type],map[name],area[shape|coords|href|alt|target],bdo,button,col[align|char|charoff|span|valign|width],colgroup[align|char|charoff|span|valign|width],dfn,fieldset,form[action|accept|accept-charset|enctype|method],input[accept|alt|checked|disabled|maxlength|name|readonly|size|src|type|value|tabindex|accesskey],kbd,label[for],legend,noscript,optgroup[label|disabled],option[disabled|label|selected|value],q[cite],samp,select[disabled|multiple|name|size],small,textarea[cols|rows|disabled|name|readonly],tt,var,big',
+				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,
@@ -8690,10 +8857,10 @@
 				removeformat_selector : 'span,b,strong,em,i,font,u,strike'
 			}, s);
 
-			// Setup URIs
 			t.documentBaseURI = new tinymce.util.URI(s.document_base_url || tinymce.documentBaseURL, {
 				base_uri : tinyMCE.baseURI
 			});
+
 			t.baseURI = EditorManager.baseURI;
 
 			// Call setup
@@ -8811,12 +8978,7 @@
 				});
 			};
 
-			// Load compat2x first
-			if (s.plugins.indexOf('compat2x') != -1) {
-				PluginManager.load('compat2x', 'plugins/compat2x/editor_plugin' + tinymce.suffix + '.js');
-				sl.loadQueue(loadScripts);
-			} else
-				loadScripts();
+			loadScripts();
 		},
 
 		init : function() {
@@ -8824,7 +8986,6 @@
 
 			EditorManager.add(t);
 
-			// Create theme
 			if (s.theme) {
 				s.theme = s.theme.replace(/-/, '');
 				o = ThemeManager.get(s.theme);
@@ -8859,8 +9020,8 @@
 			if (s.popup_css_add)
 				s.popup_css += ',' + t.documentBaseURI.toAbsolute(s.popup_css_add);
 
-			// Setup control factory
 			t.controlManager = new tinymce.ControlManager(t);
+
 			t.undoManager = new tinymce.UndoManager(t);
 
 			// Pass through
@@ -9034,8 +9195,7 @@
 				DOM.show(b);
 			}
 
-			// Setup objects
-			t.dom = new tinymce.DOM.DOMUtils(t.getDoc(), {
+			t.dom = new tinymce.dom.DOMUtils(t.getDoc(), {
 				keep_values : true,
 				url_converter : t.convertURL,
 				url_converter_scope : t,
@@ -9045,26 +9205,13 @@
 				fix_ie_paragraphs : 1
 			});
 
-			t.serializer = new tinymce.dom.Serializer({
-				entity_encoding : s.entity_encoding,
-				entities : s.entities,
+			t.serializer = new tinymce.dom.Serializer(extend(s, {
 				valid_elements : s.verify_html === false ? '*[*]' : s.valid_elements,
-				extended_valid_elements : s.extended_valid_elements,
-				valid_child_elements : s.valid_child_elements,
-				invalid_elements : s.invalid_elements,
-				fix_table_elements : s.fix_table_elements,
-				fix_list_elements : s.fix_list_elements,
-				fix_content_duplication : s.fix_content_duplication,
-				convert_fonts_to_spans : s.convert_fonts_to_spans,
-				font_size_classes  : s.font_size_classes,
-				font_size_style_values : s.font_size_style_values,
-				apply_source_formatting : s.apply_source_formatting,
-				remove_linebreaks : s.remove_linebreaks,
-				element_format : s.element_format,
 				dom : t.dom
-			});
+			}));
 
 			t.selection = new tinymce.dom.Selection(t.dom, t.getWin(), t.serializer);
+
 			t.forceBlocks = new tinymce.ForceBlocks(t, {
 				forced_root_block : s.forced_root_block
 			});
@@ -10468,8 +10615,7 @@
 
 			return s;
 		}
-
-		});
+	});
 })(tinymce);
 (function(tinymce) {
 	var each = tinymce.each, isIE = tinymce.isIE, isGecko = tinymce.isGecko, isOpera = tinymce.isOpera, isWebKit = tinymce.isWebKit;
@@ -11523,8 +11669,7 @@
 		hasRedo : function() {
 			return this.index < this.data.length - 1;
 		}
-
-		});
+	});
 })(tinymce);
 (function(tinymce) {
 	// Shorten names
@@ -11537,6 +11682,17 @@
 	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;
 
@@ -11735,7 +11891,7 @@
 				nx = nl[i];
 
 				// Is text or non block element
-				if (nx.nodeType == 3 || (!t.dom.isBlock(nx) && nx.nodeType != 8)) {
+				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)) {
@@ -11775,9 +11931,11 @@
 								}
 							}
 
+							// 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);
-							bl.appendChild(nx.cloneNode(1));
 							nx.parentNode.replaceChild(bl, nx);
+							bl.appendChild(nx);
 						}
 					} else {
 						if (bl.hasChildNodes())
@@ -11950,7 +12108,7 @@
 			aft.removeAttribute('id');
 
 			// Is header and cursor is at the end, then force paragraph under
-			if (/^(H[1-6])$/.test(bn) && sn.nodeValue && so == sn.nodeValue.length)
+			if (/^(H[1-6])$/.test(bn) && isAtEnd(r, sb))
 				aft = ed.dom.create(se.element);
 
 			// Find start chop node
@@ -12095,7 +12253,46 @@
 		},
 
 		backspaceDelete : function(e, bs) {
-			var t = this, ed = t.editor, b = ed.getBody(), n, se = ed.selection, r = se.getRng(), sc = r.startContainer, n, w, tn;
+			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
@@ -12510,7 +12707,7 @@
 		setControlType : function(n, c) {
 			return this._cls[n.toLowerCase()] = c;
 		},
-
+	
 		destroy : function() {
 			each(this.controls, function(c) {
 				c.destroy();
@@ -12518,8 +12715,7 @@
 
 			this.controls = null;
 		}
-
-		});
+	});
 })(tinymce);
 (function(tinymce) {
 	var Dispatcher = tinymce.util.Dispatcher, each = tinymce.each, isIE = tinymce.isIE, isOpera = tinymce.isOpera;
@@ -12630,8 +12826,7 @@
 		_decode : function(s) {
 			return tinymce.DOM.decode(s).replace(/\\n/g, '\n');
 		}
-
-		});
+	});
 }(tinymce));(function(tinymce) {
 	tinymce.CommandManager = function() {
 		var execCommands = {}, queryStateCommands = {}, queryValueCommands = {};
@@ -12981,10 +13176,16 @@
 				doc.execCommand(cmd, false, null);
 
 				// On WebKit the command will just be ignored if it's not enabled
-				if (!doc.queryCommandSupported(cmd))
+				if (!doc.queryCommandEnabled(cmd))
 					throw 'Error';
 			} catch (ex) {
-				ed.windowManager.alert(ed.getLang('clipboard_no_support'));
+				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'));
 			}
 		});
 	});
diff -x .svn -aruN 0.7.16.src/e107_handlers/tiny_mce/utils/editable_selects.js 0.7.17.src/e107_handlers/tiny_mce/utils/editable_selects.js
--- 0.7.16.src/e107_handlers/tiny_mce/utils/editable_selects.js	2009-06-30 19:36:50.000000000 -0500
+++ 0.7.17.src/e107_handlers/tiny_mce/utils/editable_selects.js	2009-10-02 13:45:11.000000000 -0500
@@ -1,5 +1,5 @@
 /**
- * $Id: editable_selects.js,v 1.3 2009/07/01 00:37:14 e107coders Exp $
+ * $Id: editable_selects.js,v 1.5 2009/10/02 18:45:35 e107coders Exp $
  *
  * Makes select boxes editable.
  *
diff -x .svn -aruN 0.7.16.src/e107_handlers/tiny_mce/utils/form_utils.js 0.7.17.src/e107_handlers/tiny_mce/utils/form_utils.js
--- 0.7.16.src/e107_handlers/tiny_mce/utils/form_utils.js	2009-06-30 19:36:50.000000000 -0500
+++ 0.7.17.src/e107_handlers/tiny_mce/utils/form_utils.js	2009-10-02 13:45:11.000000000 -0500
@@ -1,5 +1,5 @@
 /**
- * $Id: form_utils.js,v 1.7 2009/07/01 00:37:14 e107coders Exp $
+ * $Id: form_utils.js,v 1.9 2009/10/02 18:45:35 e107coders Exp $
  *
  * Various form utilitiy functions.
  *
@@ -92,7 +92,7 @@
 function getSelectValue(form_obj, field_name) {
 	var elm = form_obj.elements[field_name];
 
-	if (elm == null || elm.options == null)
+	if (elm == null || elm.options == null || elm.selectedIndex === -1)
 		return "";
 
 	return elm.options[elm.selectedIndex].value;
diff -x .svn -aruN 0.7.16.src/e107_handlers/tiny_mce/utils/mctabs.js 0.7.17.src/e107_handlers/tiny_mce/utils/mctabs.js
--- 0.7.16.src/e107_handlers/tiny_mce/utils/mctabs.js	2009-06-30 19:36:50.000000000 -0500
+++ 0.7.17.src/e107_handlers/tiny_mce/utils/mctabs.js	2009-10-02 13:45:11.000000000 -0500
@@ -1,5 +1,5 @@
 /**
- * $Id: mctabs.js,v 1.7 2009/07/01 00:37:14 e107coders Exp $
+ * $Id: mctabs.js,v 1.9 2009/10/02 18:45:35 e107coders Exp $
  *
  * Moxiecode DHTML Tabs script.
  *
diff -x .svn -aruN 0.7.16.src/e107_handlers/tiny_mce/utils/validate.js 0.7.17.src/e107_handlers/tiny_mce/utils/validate.js
--- 0.7.16.src/e107_handlers/tiny_mce/utils/validate.js	2009-06-30 19:36:50.000000000 -0500
+++ 0.7.17.src/e107_handlers/tiny_mce/utils/validate.js	2009-10-02 13:45:11.000000000 -0500
@@ -1,5 +1,5 @@
 /**
- * $Id: validate.js,v 1.7 2009/07/01 00:37:14 e107coders Exp $
+ * $Id: validate.js,v 1.9 2009/10/02 18:45:35 e107coders Exp $
  *
  * Various form validation methods.
  *
diff -x .svn -aruN 0.7.16.src/e107_handlers/tiny_mce/wysiwyg.php 0.7.17.src/e107_handlers/tiny_mce/wysiwyg.php
--- 0.7.16.src/e107_handlers/tiny_mce/wysiwyg.php	2009-08-31 19:03:41.000000000 -0500
+++ 0.7.17.src/e107_handlers/tiny_mce/wysiwyg.php	2010-01-15 15:23:34.000000000 -0600
@@ -4,9 +4,9 @@
 |     e107 website system - Tiny MCE controller file.
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_handlers/tiny_mce/wysiwyg.php,v $
-|     $Revision: 1.39 $
-|     $Date: 2009/09/01 00:04:05 $
-|     $Author: e107coders $
+|     $Revision: 1.43 $
+|     $Date: 2010/01/15 21:23:58 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 
@@ -36,33 +36,74 @@
 	"Swedish" 	=> "sv"
 );
 
-if(!$tinylang[$lang]){
+if(!$tinylang[$lang])
+{
  $tinylang[$lang] = "en";
 }
 
-$thescript = (strpos($_SERVER['SERVER_SOFTWARE'],"mod_gzip")) ? "tiny_mce_gzip.php" : "tiny_mce.js";
+$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' src='".e_HANDLER."tiny_mce/".$thescript."'></script>\n";
+$text .= "
+	<script type='text/javascript'>
+	tinyMCE.init({
+		language : '".$tinylang[$lang]."',
+		mode : 'exact',
+		elements : '".$formids."',
+		theme : 'advanced',
+		plugins : '".implode(",",$mce_plugins)."'\n";
 
-$text .= "<script type='text/javascript'>\n	tinyMCE.init({\n";
 
-$text .= "language : '".$tinylang[$lang]."',\n";
-$text .= "mode : 'exact',\n";
-$text .= "elements : '".$formids."',\n";
-$text .= "theme : 'advanced'\n";
-$text .= ",plugins : 'table,contextmenu";
+/*$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) ? ",ibrowser" : ",image";
 $text .= (ADMIN) ? ",code" : "";
 $text .= "'"; // end of buttons 2
 
@@ -75,7 +116,8 @@
 $text .= ",trim_span_elements: true\n";
 $text .= ",inline_styles: true\n";
 $text .= ",debug: false\n";
-$text .= ",force_br_newlines: true\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";
@@ -83,7 +125,7 @@
 $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."style.css'\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" : "";
diff -x .svn -aruN 0.7.16.src/e107_handlers/upload_handler.php 0.7.17.src/e107_handlers/upload_handler.php
--- 0.7.16.src/e107_handlers/upload_handler.php	2008-07-06 16:24:58.000000000 -0500
+++ 0.7.17.src/e107_handlers/upload_handler.php	2009-12-18 15:34:51.000000000 -0600
@@ -4,7 +4,7 @@
 |        e107 website system
 |        /classes/upload_class.php
 |
-|        Steve Dunstan 2001-2002
+|        Steve Dunstan 2001-2002
 |        http://e107.org
 |        jalist@e107.org
 |
@@ -12,8 +12,8 @@
 |        GNU General Public License (http://gnu.org).
 |
 |   $Source: /cvsroot/e107/e107_0.7/e107_handlers/upload_handler.php,v $
-|   $Revision: 1.34 $
-|   $Date: 2008/07/06 21:25:21 $
+|   $Revision: 1.38 $
+|   $Date: 2009/12/18 21:35:15 $
 |   $Author: e107steved $
 +---------------------------------------------------------------+
 */
@@ -513,63 +513,75 @@
 */
 function vet_file($filename, $target_name, $allowed_filetypes = '', $unknown = FALSE)
 {
-// 1. Start by checking against filetypes - that's the easy one!
-  $file_ext = strtolower(substr(strrchr($target_name, "."), 1));
-  if (!in_array($file_ext, $allowed_filetypes))
-  {
-    if (is_bool($unknown)) return 1;	  // Reject out of hand if no possible alternative extensions
-	// Otherwise, it could be in the supplementary list
-	$tmp = explode(',', $unknown);
-	for ($i = 0; $i < count($tmp); $i++) { $tmp[$i] = strtolower(trim(str_replace('.', '', $tmp[$i])));  }
-	if (!in_array($file_ext, $tmp)) return 6;
-  }
+	// 1. Start by checking against filetypes - that's the easy one!
+	$file_ext = strtolower(substr(strrchr($target_name, "."), 1));
+	if (!in_array($file_ext, $allowed_filetypes))
+	{
+		if (is_bool($unknown)) return 1;	  // Reject out of hand if no possible alternative extensions
+		// Otherwise, it could be in the supplementary list
+		$tmp = explode(',', $unknown);
+		for ($i = 0; $i < count($tmp); $i++) { $tmp[$i] = strtolower(trim(str_replace('.', '', $tmp[$i])));  }
+		if (!in_array($file_ext, $tmp)) return 6;
+	}
 
 
-// 2. For all files, read the first little bit to check for any flags etc
-  $res = fopen($filename, 'rb');
-  $tstr = fread($res,100);
-  fclose($res);
-  if ($tstr === FALSE) return 2;			// If can't read file, not much use carrying on!
-  if (stristr($tstr,'<?php') !== FALSE) return 3;		// Pretty certain exploit
-  if (stristr($tstr,'<?') !== FALSE) return 7;			// Possible exploit - maybe allowable?
+	// 2. For all files, read the first little bit to check for any flags etc
+	$res = fopen($filename, 'rb');
+	$tstr = fread($res,100);
+	fclose($res);
+	if ($tstr === FALSE) return 2;			// If can't read file, not much use carrying on!
+	if (stristr($tstr,'<?php') !== FALSE) return 3;		// Pretty certain exploit
+	if (stristr($tstr,'<?') !== FALSE)				// Bit more tricky - can sometimes be OK
+	{
+		if (stristr($tstr, '<?xpacket') === FALSE)	// Allow the XMP header produced by CS4
+		{
+			return 7;
+		}
+	}
   
   
-// 3. Now do what we can based on file extension
-  switch ($file_ext)
-  {
-    case 'jpg' :
-	case 'gif' :
-	case 'png' :
-	case 'jpeg' :
-	case 'pjpeg' :
-	case 'bmp' :
-	  $ret = getimagesize($filename);
-	  if (!is_array($ret)) return 4;		// getimagesize didn't like something
-	  if (($ret[0] == 0) || ($ret[1] == 0)) return 5;		// Zero size picture or bad file format
-	  break;
-	  
-	case 'zip' :
-	case 'gzip' :
-	case 'gz' :
-	case 'tar' :
-	case 'bzip' :
-	case 'pdf' :
-	case 'rar' :
-	case '7z' :
-	case 'csv' :
-	  break;			// Just accept these
-
-	case 'php' :
-	case 'htm' :
-	case 'html' :
-	case 'cgi' :
-	case 'pl' :
-	  return 9;			// Never accept these! Whatever the user thinks!
-	  
-	default :
-	  if (is_bool($unknown)) return ($unknown ? TRUE : 8);
-  }
-  return TRUE;			// Accepted here
+	// 3. Now do what we can based on file extension
+	switch ($file_ext)
+	{
+		case 'jpg' :
+		case 'gif' :
+		case 'png' :
+		case 'jpeg' :
+		case 'pjpeg' :
+		case 'bmp' :
+			$ret = getimagesize($filename);
+			if (!is_array($ret)) return 4;		// getimagesize didn't like something
+			if (($ret[0] == 0) || ($ret[1] == 0)) return 5;		// Zero size picture or bad file format
+			break;
+
+		case 'zip' :
+		case 'gzip' :
+		case 'gz' :
+		case 'tar' :
+		case 'bzip' :
+		case 'pdf' :
+		case 'rar' :
+		case '7z' :
+		case 'csv' :
+		case 'wmv' :
+		case 'swf' :
+		case 'flv': //Flash stream
+		case 'f4v': //Flash stream
+		case 'mov': //media
+		case 'avi': //media
+			break;			// Just accept these
+
+		case 'php' :
+		case 'htm' :
+		case 'html' :
+		case 'cgi' :
+		case 'pl' :
+			return 9;			// Never accept these! Whatever the user thinks!
+		  
+		default :
+			if (is_bool($unknown)) return ($unknown ? TRUE : 8);
+	}
+	return TRUE;			// Accepted here
 }
 
 
diff -x .svn -aruN 0.7.16.src/e107_handlers/user_select_class.php 0.7.17.src/e107_handlers/user_select_class.php
--- 0.7.16.src/e107_handlers/user_select_class.php	2007-05-28 06:12:45.000000000 -0500
+++ 0.7.17.src/e107_handlers/user_select_class.php	2009-10-28 09:23:15.000000000 -0500
@@ -3,7 +3,7 @@
 + ----------------------------------------------------------------------------+
 |     e107 website system
 |
-|     Steve Dunstan 2001-2002
+|     ©Steve Dunstan 2001-2002
 |     http://e107.org
 |     jalist@e107.org
 |
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_handlers/user_select_class.php,v $
-|     $Revision: 1.12 $
-|     $Date: 2007/05/28 11:13:08 $
-|     $Author: e107steved $
+|     $Revision: 1.14 $
+|     $Date: 2009/10/28 14:23:39 $
+|     $Author: marj_nl_fr $
 +----------------------------------------------------------------------------+
 */
 
@@ -38,7 +38,7 @@
 				break;
 
 			case e_UC_MEMBER:
-				$where = "1";
+				$where = "user_ban != 1";
 				break;
 
 			case e_UC_NOBODY:
@@ -222,9 +222,11 @@
 		echo "\n</body>\n</html>";
 	}
 
-	function findusers($s) {
+	function findusers($s,$banned=FALSE) {
 		global $sql, $tp;
-		if ($sql->db_Select("user", "*", "user_name LIKE '%".$tp -> toDB($s)."%' ")) {
+		$inc = ($banned == FALSE) ? " AND user_ban != 1" : "";
+		if ($sql->db_Select("user", "*", "user_name LIKE '%".$tp -> toDB($s)."%'".$inc)) 
+		{
 			while ($row = $sql -> db_Fetch()) {
 				$ret[strtolower($row['user_name'])] = $row['user_name'];
 			}
diff -x .svn -aruN 0.7.16.src/e107_handlers/xml_class.php 0.7.17.src/e107_handlers/xml_class.php
--- 0.7.16.src/e107_handlers/xml_class.php	2009-09-03 08:29:37.000000000 -0500
+++ 0.7.17.src/e107_handlers/xml_class.php	2010-01-22 06:23:52.000000000 -0600
@@ -3,7 +3,7 @@
 + ----------------------------------------------------------------------------+
 |     e107 website system
 |
-|     Steve Dunstan 2001-2002
+|     Steve Dunstan 2001-2002
 |     http://e107.org
 |     jalist@e107.org
 |
@@ -11,8 +11,8 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_handlers/xml_class.php,v $
-|     $Revision: 1.9 $
-|     $Date: 2009/09/03 13:30:01 $
+|     $Revision: 1.11 $
+|     $Date: 2010/01/22 12:24:16 $
 |     $Author: e107coders $
 +----------------------------------------------------------------------------+
 */
@@ -41,7 +41,7 @@
 		if (function_exists('file_get_contents'))
 		{
 			$old_timeout = e107_ini_set('default_socket_timeout', $timeout);
-			$data = file_get_contents(urlencode($address));
+			$data = file_get_contents(urldecode($address));
 
 			// $data = file_get_contents(htmlspecialchars($address));	// buggy - sometimes fails.
 			if ($old_timeout !== FALSE)
@@ -263,4 +263,146 @@
    }
 }
 
+/**
+ * 0.7 Only Xml Parsing Function.
+ * Do not use in plugins if you want them to work in 0.8. 
+ */
+class XMLParse
+{
+    var $rawXML;
+    var $valueArray = array();
+    var $keyArray = array();
+    var $parsed = array();
+    var $index = 0;
+    var $attribKey = 'attributes';
+    var $valueKey = 'value';
+    var $cdataKey = 'cdata';
+    var $isError = false;
+    var $error = '';
+
+    function XMLParse($xml = NULL)
+    {
+        $this->rawXML = $xml;
+    }
+
+    function parse($xml = NULL)
+    {
+        if (!is_null($xml))
+        {
+            $this->rawXML = $xml;
+        }
+
+        $this->isError = false;
+           
+        if (!$this->parse_init())
+        {
+            return false;
+        }
+
+        $this->index = 0;
+        $this->parsed = $this->parse_recurse();
+        $this->status = 'parsing complete';
+
+        return $this->parsed;
+    }
+
+    function parse_recurse()
+    {       
+        $found = array();
+        $tagCount = array();
+
+        while (isset($this->valueArray[$this->index]))
+        {
+            $tag = $this->valueArray[$this->index];
+            $this->index++;
+
+            if ($tag['type'] == 'close')
+            {
+                return $found;
+            }
+
+            if ($tag['type'] == 'cdata')
+            {
+                $tag['tag'] = $this->cdataKey;
+                $tag['type'] = 'complete';
+            }
+
+            $tagName = $tag['tag'];
+
+            if (isset($tagCount[$tagName]))
+            {       
+                if ($tagCount[$tagName] == 1)
+                {
+                    $found[$tagName] = array($found[$tagName]);
+                }
+                   
+                $tagRef =& $found[$tagName][$tagCount[$tagName]];
+                $tagCount[$tagName]++;
+            }
+            else   
+            {
+                $tagCount[$tagName] = 1;
+                $tagRef =& $found[$tagName];
+            }
+
+            switch ($tag['type'])
+            {
+                case 'open':
+                    $tagRef = $this->parse_recurse();
+
+                    if (isset($tag['attributes']))
+                    {
+                        $tagRef[$this->attribKey] = $tag['attributes'];
+                    }
+                       
+                    if (isset($tag['value']))
+                    {
+                        if (isset($tagRef[$this->cdataKey]))   
+                        {
+                            $tagRef[$this->cdataKey] = (array)$tagRef[$this->cdataKey];   
+                            array_unshift($tagRef[$this->cdataKey], $tag['value']);
+                        }
+                        else
+                        {
+                            $tagRef[$this->cdataKey] = $tag['value'];
+                        }
+                    }
+                    break;
+
+                case 'complete':
+                    if (isset($tag['attributes']))
+                    {
+                        $tagRef[$this->attribKey] = $tag['attributes'];
+                        $tagRef =& $tagRef[$this->valueKey];
+                    }
+
+                    if (isset($tag['value']))
+                    {
+                        $tagRef = $tag['value'];
+                    }
+                    break;
+            }           
+        }
+
+        return $found;
+    }
+
+    function parse_init()
+    {
+        $this->parser = xml_parser_create();
+
+        $parser = $this->parser;
+        xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, 0);    
+        xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 1);       
+        if (!$res = (bool)xml_parse_into_struct($parser, $this->rawXML, $this->valueArray, $this->keyArray))
+        {
+            $this->isError = true;
+            $this->error = 'error: '.xml_error_string(xml_get_error_code($parser)).' at line '.xml_get_current_line_number($parser);
+        }
+        xml_parser_free($parser);
+
+        return $res;
+    }
+}
+
 ?>
\ No newline at end of file
diff -x .svn -aruN 0.7.16.src/e107_images/thumb.php 0.7.17.src/e107_images/thumb.php
--- 0.7.16.src/e107_images/thumb.php	2008-10-03 15:28:07.000000000 -0500
+++ 0.7.17.src/e107_images/thumb.php	2009-10-31 10:10:09.000000000 -0500
@@ -11,8 +11,8 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_images/thumb.php,v $
-|     $Revision: 1.4 $
-|     $Date: 2008/10/03 20:28:30 $
+|     $Revision: 1.5 $
+|     $Date: 2009/10/31 15:10:33 $
 |     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
@@ -32,6 +32,8 @@
 require_once("../class2.php");
 require_once(e_HANDLER."resize_handler.php");
 
+while (@ob_end_clean());		// Gets rid of any rubbish generated by other (badly written) code
+
 if (e_QUERY)
 {
 	$tmp = explode('+',rawurldecode(e_QUERY));
diff -x .svn -aruN 0.7.16.src/e107_languages/English/admin/help/banlist.php 0.7.17.src/e107_languages/English/admin/help/banlist.php
--- 0.7.16.src/e107_languages/English/admin/help/banlist.php	2007-02-11 04:33:35.000000000 -0600
+++ 0.7.17.src/e107_languages/English/admin/help/banlist.php	2009-12-18 15:00:40.000000000 -0600
@@ -11,8 +11,8 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_languages/English/admin/help/banlist.php,v $
-|     $Revision: 1.3 $
-|     $Date: 2007/02/11 10:33:58 $
+|     $Revision: 1.4 $
+|     $Date: 2009/12/18 21:01:04 $
 |     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
@@ -24,7 +24,8 @@
 Either enter their full IP address or use a wildcard to ban a range of IP addresses. You can also enter an email address to stop a user registering as a member on your site.<br /><br />
 <b>Banning by IP address:</b><br />
 Entering the IP address 123.123.123.123 will stop the user with that address visiting your site.<br />
-Entering the IP address 123.123.123.* will stop anyone in that IP range from visiting your site.<br /><br />
+Entering an IP address with one or more wildcards in the end blocks, such as 123.123.123.* or 214.098.*.*, will stop anyone in that IP range from visiting your 
+site. (Note that there must be exactly four groups of digits or asterisks)<br /><br />
 <b>Banning by email address</b><br />
 Entering the email address foo@bar.com will stop anyone using that email address from registering as a member on your site.<br />
 Entering the email address *@bar.com will stop anyone using that email domain from registering as a member on your site.<br /><br />
diff -x .svn -aruN 0.7.16.src/e107_languages/English/admin/lan_admin.php 0.7.17.src/e107_languages/English/admin/lan_admin.php
--- 0.7.16.src/e107_languages/English/admin/lan_admin.php	2009-07-18 10:53:18.000000000 -0500
+++ 0.7.17.src/e107_languages/English/admin/lan_admin.php	2010-01-22 07:53:29.000000000 -0600
@@ -4,9 +4,9 @@
 |     e107 website system - Language File.
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_languages/English/admin/lan_admin.php,v $
-|     $Revision: 1.61 $
-|     $Date: 2009/07/18 15:53:42 $
-|     $Author: marj_nl_fr $
+|     $Revision: 1.63 $
+|     $Date: 2010/01/22 13:53:53 $
+|     $Author: mcfly_e107 $
 +----------------------------------------------------------------------------+
 */
 define("ADLAN_0", "News");
@@ -173,7 +173,7 @@
 define("ADLAN_152", "Enter Code");
 
 define("ADLAN_153", "Administration Area");
-define('ADLAN_154', "Error contacting Sourceforge to check for new version");
+define('ADLAN_154', "Error contacting e107.org to check for new version");
 
 define('ADLAN_CL_1', 'Settings');
 define('ADLAN_CL_2', 'Users');
@@ -273,6 +273,6 @@
 
 define("LAN_CREDITS","Credits");
 define("LAN_NEWVERSION","New Version Available");
-
-
+define("LAN_NEWVERSION_MORE","learn more");
+define("LAN_NEWVERSION_DLD","Download %s from SF.net");
 ?>
\ No newline at end of file
diff -x .svn -aruN 0.7.16.src/e107_languages/English/admin/lan_prefs.php 0.7.17.src/e107_languages/English/admin/lan_prefs.php
--- 0.7.16.src/e107_languages/English/admin/lan_prefs.php	2009-03-08 13:38:14.000000000 -0500
+++ 0.7.17.src/e107_languages/English/admin/lan_prefs.php	2009-09-28 15:59:37.000000000 -0500
@@ -12,9 +12,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_languages/English/admin/lan_prefs.php,v $
-|     $Revision: 1.69 $
-|     $Date: 2009/03/08 18:38:38 $
-|     $Author: e107coders $
+|     $Revision: 1.70 $
+|     $Date: 2009/09/28 21:00:01 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 
@@ -193,5 +193,10 @@
 define("PRFLAN_176", "Email address for emails from site");
 define("PRFLAN_177", "Address specified for replies to emails from this site.");
 
+// Following numbers used for consistency with 0.8
+define('PRFLAN_208', 'User class which can email links to items on site');
+define('PRFLAN_209', 'Other Features');
+define('PRFLAN_210', 'Comments/Posting');
+
 
 ?>
\ No newline at end of file
diff -x .svn -aruN 0.7.16.src/e107_languages/English/admin/lan_ugflag.php 0.7.17.src/e107_languages/English/admin/lan_ugflag.php
--- 0.7.16.src/e107_languages/English/admin/lan_ugflag.php	2004-09-21 14:11:33.000000000 -0500
+++ 0.7.17.src/e107_languages/English/admin/lan_ugflag.php	2009-10-28 11:53:28.000000000 -0500
@@ -4,17 +4,20 @@
 |     e107 website system - Language File.
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_languages/English/admin/lan_ugflag.php,v $
-|     $Revision: 1.1 $
-|     $Date: 2004/09/21 19:11:55 $
-|     $Author: e107coders $
+|     $Revision: 1.3 $
+|     $Date: 2009/10/28 16:53:52 $
+|     $Author: marj_nl_fr $
 +----------------------------------------------------------------------------+
 */
-define("UGFLAN_1", "maintenance setting updated");
-define("UGFLAN_2", "Activate maintenance flag");
-define("UGFLAN_3", "Update Maintenance Setting");
-define("UGFLAN_4", "Maintenance Setting");
+define('UGFLAN_1', 'maintenance setting updated');
+define('UGFLAN_2', 'Activate maintenance flag');
+define('UGFLAN_3', 'Update Maintenance Setting');
+define('UGFLAN_4', 'Maintenance Setting');
 
-define("UGFLAN_5", "Text to display when site down");
-define("UGFLAN_6", "Leave blank to display default message");
+define('UGFLAN_5', 'Text to display when site down');
+define('UGFLAN_6', 'Leave blank to display default message');
+
+define('UGFLAN_8', 'Limit access to Admins only');
+define('UGFLAN_9', 'Limit access to Main-Admins only');
 
 ?>
\ No newline at end of file
diff -x .svn -aruN 0.7.16.src/e107_languages/English/lan_installer.php 0.7.17.src/e107_languages/English/lan_installer.php
--- 0.7.16.src/e107_languages/English/lan_installer.php	2009-07-18 13:37:21.000000000 -0500
+++ 0.7.17.src/e107_languages/English/lan_installer.php	2009-11-03 14:33:36.000000000 -0600
@@ -145,7 +145,7 @@
 //define("LANINS_103", 'Reviews');
 //define("LANINS_104", 'Review Front Page ...');
 
-define("LANINS_105", 'A database name or prefix beginning with some digits followed by “e” or “E” is not acceptable');
+define("LANINS_105", 'A database name or prefix beginning with some digits followed by “e” or “E” is not acceptable.  <br />A database name or prefix can not be empty.');
 define("LANINS_106", 'WARNING - E107 cannot write to the directories and/or files listed. While this will not stop E107 installing, it will mean that certain features are not available. 
 				You will need to change the file permissions to use these features');
 
diff -x .svn -aruN 0.7.16.src/e107_languages/English/lan_news.php 0.7.17.src/e107_languages/English/lan_news.php
--- 0.7.16.src/e107_languages/English/lan_news.php	2006-11-20 01:58:04.000000000 -0600
+++ 0.7.17.src/e107_languages/English/lan_news.php	2010-01-06 14:14:20.000000000 -0600
@@ -4,9 +4,9 @@
 |     e107 website system - Language File.
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_languages/English/lan_news.php,v $
-|     $Revision: 1.11 $
-|     $Date: 2006/11/20 07:58:27 $
-|     $Author: lisa_ $
+|     $Revision: 1.12 $
+|     $Date: 2010/01/06 20:14:44 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 define("PAGE_NAME", "News");
@@ -14,12 +14,6 @@
 
 define("LAN_NEWS_1", "News for specific members only");
 define("LAN_NEWS_2", "You are not allowed to see this news");
-//define("LAN_NEWS_3", "Please delete install.php from your server");
-//define("LAN_NEWS_4", "if you do not there is a potential security risk to your website");
-define("LAN_NEWS_5", "Error! Was unable to update news item into database!");
-define("LAN_NEWS_6", "News entered into database.");
-define("LAN_NEWS_7", "Error! Was unable to enter news item into database!");
-define("LAN_NEWS_8", "News entered into database for all languages. ID: ");
 define("LAN_NEWS_9", "Title only is set - <b>only the news title will be shown</b><br />");
 define("LAN_NEWS_10", "This news post is <b>inactive</b> (It will be not shown on front page). ");
 define("LAN_NEWS_11", "This news post is <b>active</b> (it will be shown on front page). ");
@@ -31,18 +25,16 @@
 define("LAN_NEWS_17", "b.");
 define("LAN_NEWS_18", "Info:");
 define("LAN_NEWS_19", "Now");
-define("LAN_NEWS_20", "News updated in database for the following language: ");
-define("LAN_NEWS_21", "News updated in database.");
-// define("LAN_NEWS_22", "Go to page: ");
 define("LAN_NEWS_23", "News Categories");
 define("LAN_NEWS_24", "create pdf of this news item");
-
-define("LAN_NEWS_82", "News - Category");
-define("LAN_NEWS_83", "No news items at the moment - please check back soon.");
-define("LAN_NEWS_84", "News Items");
-define("LAN_NEWS_99", "Comments");
-define("LAN_NEWS_100", "On");
-define("LAN_NEWS_307", "Total posts in this category: ");
+define("LAN_NEWS_25", "Edit");
+define('LAN_NEWS_31', 'Sticky news item');					// Added
+define('LAN_NEWS_82', 'News - Category');
+define('LAN_NEWS_83', 'No news items at the moment - please check back soon.');
+define('LAN_NEWS_84', 'Back to news overview');
+define('LAN_NEWS_85', 'Back to category overview');
+define('LAN_NEWS_86', 'Older News');
+define('LAN_NEWS_87', 'Newer News');
 define("LAN_NEWS_462", "No news items for specified month");
 
 ?>
\ No newline at end of file
diff -x .svn -aruN 0.7.16.src/e107_plugins/alt_auth/ldap_conf.php 0.7.17.src/e107_plugins/alt_auth/ldap_conf.php
--- 0.7.16.src/e107_plugins/alt_auth/ldap_conf.php	2006-10-18 10:23:43.000000000 -0500
+++ 0.7.17.src/e107_plugins/alt_auth/ldap_conf.php	2009-11-19 09:51:58.000000000 -0600
@@ -11,16 +11,16 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/alt_auth/ldap_conf.php,v $
-|     $Revision: 1.7 $
-|     $Date: 2006/10/18 15:24:06 $
-|     $Author: mcfly_e107 $
+|     $Revision: 1.8 $
+|     $Date: 2009/11/19 15:52:22 $
+|     $Author: marj_nl_fr $
 +----------------------------------------------------------------------------+
 */
 $eplug_admin = true;
 require_once("../../class2.php");
 require_once(e_ADMIN."auth.php");
 require_once(e_HANDLER."form_handler.php");
-include_lan("languages/".e_LANGUAGE."/lan_ldap_auth.php");
+include_lan(e_PLUGIN."alt_auth/languages/".e_LANGUAGE."/lan_ldap_auth.php");
 define("ALT_AUTH_ACTION", "ldap");
 require_once(e_PLUGIN."alt_auth/alt_auth_adminmenu.php");
 
diff -x .svn -aruN 0.7.16.src/e107_plugins/alt_auth/otherdb_conf.php 0.7.17.src/e107_plugins/alt_auth/otherdb_conf.php
--- 0.7.16.src/e107_plugins/alt_auth/otherdb_conf.php	2006-10-18 12:22:28.000000000 -0500
+++ 0.7.17.src/e107_plugins/alt_auth/otherdb_conf.php	2009-11-19 09:51:58.000000000 -0600
@@ -15,7 +15,7 @@
 require_once("../../class2.php");
 require_once(e_ADMIN."auth.php");
 require_once(e_HANDLER."form_handler.php");
-include_lan("languages/".e_LANGUAGE."/lan_otherdb_auth.php");
+include_lan(e_PLUGIN."alt_auth/languages/".e_LANGUAGE."/lan_otherdb_auth.php");
 define("ALT_AUTH_ACTION", "otherdb");
 require_once(e_PLUGIN."alt_auth/alt_auth_adminmenu.php");
 
diff -x .svn -aruN 0.7.16.src/e107_plugins/banner_menu/banner_menu.php 0.7.17.src/e107_plugins/banner_menu/banner_menu.php
--- 0.7.16.src/e107_plugins/banner_menu/banner_menu.php	2008-08-03 03:08:13.000000000 -0500
+++ 0.7.17.src/e107_plugins/banner_menu/banner_menu.php	2010-01-02 11:00:45.000000000 -0600
@@ -11,8 +11,8 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/banner_menu/banner_menu.php,v $
-|     $Revision: 1.13 $
-|     $Date: 2008/08/03 08:08:36 $
+|     $Revision: 1.14 $
+|     $Date: 2010/01/02 17:01:09 $
 |     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
@@ -74,11 +74,14 @@
   }
 
   $txt = $BANNER_MENU_START;
-  foreach($parms as $parm)
+  if (isset($parms))
   {
-	$bannersccode = file_get_contents(e_FILE."shortcode/banner.sc");
-	$BANNER = eval($bannersccode);
-	$txt .= preg_replace("/\{(.*?)\}/e", '$\1', $BANNER_MENU);
+	  foreach($parms as $parm)
+	  {
+		$bannersccode = file_get_contents(e_FILE."shortcode/banner.sc");
+		$BANNER = eval($bannersccode);
+		$txt .= preg_replace("/\{(.*?)\}/e", '$\1', $BANNER_MENU);
+	  }
   }
   $txt .= $BANNER_MENU_END;
 }
diff -x .svn -aruN 0.7.16.src/e107_plugins/blogcalendar_menu/archive.php 0.7.17.src/e107_plugins/blogcalendar_menu/archive.php
--- 0.7.16.src/e107_plugins/blogcalendar_menu/archive.php	2008-10-21 14:02:57.000000000 -0500
+++ 0.7.17.src/e107_plugins/blogcalendar_menu/archive.php	2010-01-09 06:01:13.000000000 -0600
@@ -11,8 +11,8 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/blogcalendar_menu/archive.php,v $
-|     $Revision: 1.7 $
-|     $Date: 2008/10/21 19:03:20 $
+|     $Revision: 1.8 $
+|     $Date: 2010/01/09 12:01:37 $
 |     $Author: e107steved $
 +----------------------------------------------------------------------------+
 | Based on code by: Thomas Bouve (crahan@gmx.net)
@@ -92,7 +92,7 @@
 					list($xmonth, $xday) = explode(" ", date("n j", $news['news_datestamp']));
 					if (!$day_links[$xmonth][$xday]) 
 					{
-						$day_links[$xmonth][$xday] = e_BASE."news.php?day.".formatdate($req_year, $xmonth, $xday);
+						$day_links[$xmonth][$xday] = e_HTTP."news.php?day.".formatdate($req_year, $xmonth, $xday);
 					}
 				}
 			}
@@ -123,7 +123,7 @@
 	// href the current month regardless of newsposts or any month with news
 	if (($req_year == $cur_year && $i == $cur_month) || $day_links[$i]) 
 	{
-		$archive .= "<a class='forumlink' href='".e_BASE."news.php?month.".formatDate($req_year, $i)."'>".$marray[$i-1]."</a>";
+		$archive .= "<a class='forumlink' href='".e_HTTP."news.php?month.".formatDate($req_year, $i)."'>".$marray[$i-1]."</a>";
 	} 
 	else 
 	{
diff -x .svn -aruN 0.7.16.src/e107_plugins/blogcalendar_menu/blogcalendar_menu.php 0.7.17.src/e107_plugins/blogcalendar_menu/blogcalendar_menu.php
--- 0.7.16.src/e107_plugins/blogcalendar_menu/blogcalendar_menu.php	2007-12-03 14:37:50.000000000 -0600
+++ 0.7.17.src/e107_plugins/blogcalendar_menu/blogcalendar_menu.php	2010-01-09 06:01:14.000000000 -0600
@@ -11,8 +11,8 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/blogcalendar_menu/blogcalendar_menu.php,v $
-|     $Revision: 1.10 $
-|     $Date: 2007/12/03 20:38:13 $
+|     $Revision: 1.11 $
+|     $Date: 2010/01/09 12:01:38 $
 |     $Author: e107steved $
 +----------------------------------------------------------------------------+
 | Based on code by: Thomas Bouve (crahan@gmx.net)
@@ -90,21 +90,21 @@
 	$xmonth = date("n", $news['news_datestamp']);
 	if (!isset($month_links[$xmonth]) || !$month_links[$xmonth])
 	{
-		$month_links[$xmonth] = e_BASE."news.php?month.".formatDate($req_year, $xmonth);
+		$month_links[$xmonth] = e_HTTP."news.php?month.".formatDate($req_year, $xmonth);
 	}
 	if($news['news_datestamp'] >= $month_start AND $news['news_datestamp'] <= $month_end)
 	{
 		$xday = date("j", $news['news_datestamp']);
 		if (!isset($day_links[$xday]) || !$day_links[$xday])
 		{
-			$day_links[$xday] = e_BASE."news.php?day.".formatDate($req_year, $req_month, $xday);
+			$day_links[$xday] = e_HTTP."news.php?day.".formatDate($req_year, $req_month, $xday);
 		}
 	}
 }
 
 // if we're listing the current year, add the current month to the list regardless of posts
 if ($req_year == $cur_year) {
-	$month_links[$cur_month] = e_BASE."news.php?month.".formatDate($cur_year, $cur_month);
+	$month_links[$cur_month] = e_HTTP."news.php?month.".formatDate($cur_year, $cur_month);
 }
 	
 // go over the link array and create the option fields
diff -x .svn -aruN 0.7.16.src/e107_plugins/blogcalendar_menu/config.php 0.7.17.src/e107_plugins/blogcalendar_menu/config.php
--- 0.7.16.src/e107_plugins/blogcalendar_menu/config.php	2005-05-25 04:43:03.000000000 -0500
+++ 0.7.17.src/e107_plugins/blogcalendar_menu/config.php	2009-11-19 05:45:25.000000000 -0600
@@ -3,7 +3,7 @@
 + ----------------------------------------------------------------------------+
 |     e107 website system
 |
-|     Steve Dunstan 2001-2002
+|     (C)Steve Dunstan 2001-2002
 |     http://e107.org
 |     jalist@e107.org
 |
@@ -11,25 +11,22 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/blogcalendar_menu/config.php,v $
-|     $Revision: 1.4 $
-|     $Date: 2005/05/25 09:43:25 $
-|     $Author: sweetas $
+|     $Revision: 1.5 $
+|     $Date: 2009/11/19 11:45:49 $
+|     $Author: marj_nl_fr $
 +----------------------------------------------------------------------------+
 */
 $eplug_admin = TRUE;
 require_once("../../class2.php");
-require_once(e_HANDLER."userclass_class.php");
-	
-$lan_file = e_PLUGIN."blogcalendar_menu/languages/".e_LANGUAGE.".php";
-if (file_exists($lan_file)) {
-	require_once($lan_file);
-} else {
-	require_once(e_PLUGIN."blogcalendar_menu/languages/English.php");
-}
 if (!getperms("1")) {
 	header("location:".e_BASE."index.php");
-	 exit ;
+	 exit();
 }
+
+require_once(e_HANDLER."userclass_class.php");
+	
+include_lan(e_PLUGIN."blogcalendar_menu/languages/".e_LANGUAGE.".php");
+
 require_once(e_ADMIN."auth.php");
 	
 if (isset($_POST['update_menu'])) {
diff -x .svn -aruN 0.7.16.src/e107_plugins/calendar_menu/calendar_shortcodes.php 0.7.17.src/e107_plugins/calendar_menu/calendar_shortcodes.php
--- 0.7.16.src/e107_plugins/calendar_menu/calendar_shortcodes.php	2009-08-23 05:39:29.000000000 -0500
+++ 0.7.17.src/e107_plugins/calendar_menu/calendar_shortcodes.php	2009-10-05 14:12:48.000000000 -0500
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/calendar_menu/calendar_shortcodes.php,v $
-|     $Revision: 1.16 $
-|     $Date: 2009/08/23 10:39:53 $
-|     $Author: marj_nl_fr $
+|     $Revision: 1.17 $
+|     $Date: 2009/10/05 19:13:12 $
+|     $Author: e107steved $
 |
 | 10.11.06 - mods for next CVS release
 +----------------------------------------------------------------------------+
@@ -450,24 +450,24 @@
 SC_END
 
 SC_BEGIN NEXT_EVENT_ICON
-  global $pref, $cal_row, $ecal_dir;
-  $fe_icon_file = "";
-  if ($pref['eventpost_showcaticon'] == 1)
-  {
+	global $pref, $cal_row, $ecal_dir;
+	$fe_icon_file = "";
+	if ($pref['eventpost_showcaticon'] == 1)
+	{
 		if($cal_row['event_cat_icon'] && file_exists($ecal_dir."images/".$cal_row['event_cat_icon']))
 		{
-		  $fe_icon_file = $ecal_dir."images/".$cal_row['event_cat_icon'];
+			$fe_icon_file = $ecal_dir."images/".$cal_row['event_cat_icon'];
 		}
 		elseif(defined('BULLET'))
 		{
-			$img = HEME.'images/'.BULLET;
+			$fe_icon_file = THEME.'images/'.BULLET;
 		}
 		elseif(file_exists(THEME.'images/bullet2.gif'))
 		{
-			$img = THEME.'images/bullet2.gif';
+			$fe_icon_file = THEME.'images/bullet2.gif';
 		}
-  }
-  return $fe_icon_file;
+	}
+	return $fe_icon_file;
 SC_END
 
 SC_BEGIN NEXT_EVENT_GAP
diff -x .svn -aruN 0.7.16.src/e107_plugins/calendar_menu/e_search.php 0.7.17.src/e107_plugins/calendar_menu/e_search.php
--- 0.7.16.src/e107_plugins/calendar_menu/e_search.php	2005-12-14 13:28:21.000000000 -0600
+++ 0.7.17.src/e107_plugins/calendar_menu/e_search.php	2009-11-19 05:45:25.000000000 -0600
@@ -1,11 +1,9 @@
 <?php
-if (!defined('e107_INIT')) { exit; }
+/* $Id: e_search.php,v 1.3 2009/11/19 11:45:49 marj_nl_fr Exp $ */
+if (!defined('e107_INIT')) { exit(); }
+
+include_lan(e_PLUGIN."calendar_menu/languages/".e_LANGUAGE."_search.php");
 
-if (file_exists(e_PLUGIN."calendar_menu/languages/".e_LANGUAGE."_search.php")) {
-	include_once(e_PLUGIN."calendar_menu/languages/".e_LANGUAGE."_search.php");
-} else {
-	include_once(e_PLUGIN."calendar_menu/languages/English_search.php");
-}
 $search_info[] = array('sfile' => e_PLUGIN.'calendar_menu/search/search_parser.php', 'qtype' => CM_SCH_LAN_1, 'refpage' => 'calendar.php');
 
 ?>
\ No newline at end of file
diff -x .svn -aruN 0.7.16.src/e107_plugins/calendar_menu/event.php 0.7.17.src/e107_plugins/calendar_menu/event.php
--- 0.7.16.src/e107_plugins/calendar_menu/event.php	2009-09-01 14:28:10.000000000 -0500
+++ 0.7.17.src/e107_plugins/calendar_menu/event.php	2009-12-12 04:15:07.000000000 -0600
@@ -11,8 +11,8 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/calendar_menu/event.php,v $
-|     $Revision: 1.35 $
-|     $Date: 2009/09/01 19:28:34 $
+|     $Revision: 1.36 $
+|     $Date: 2009/12/12 10:15:31 $
 |     $Author: e107steved $
 |
 | 09.11.06 - Started next batch of mods
@@ -53,69 +53,75 @@
   $category_filter = " AND (e.event_category = '".intval($_POST['event_cat_ids'])."') ";
 }
 
-/*
-// enter new category into db
-if (isset($_POST['ne_cat_create']))
-{
-    if ($_POST['ne_new_category'] != "")
-    {
-        $sql->db_Insert("event_cat", "0, '".$tp->toDB($_POST['ne_new_category'])."', '".$tp->toDB($_POST['ne_new_category_icon'])."', '0', '0', '0', '0', '', '', '0', '0', '0', '".time()."', '0'  ");
-        header("location:event.php?".$_POST['qs'].".m1");
-    }
-    else
-    {
-        header("location:event.php?".$_POST['qs'].".m3");
-    }
-}
-*/
+
+
 // Event to add or update
 if ((isset($_POST['ne_insert']) || isset($_POST['ne_update'])) && ($cal_super || check_class($pref['eventpost_admin'])))
 {  
-  if (($_POST['ne_event'] == "") || !isset($_POST['qs']))
-  {	// Problem - tell user to go away
-	header("location:event.php?".$ev_start.".m3");
-  }
-  else
-  {
-	$ev_start		= $ecal_class->make_date($_POST['ne_hour'], $_POST['ne_minute'],$_POST['start_date']);
-	$ev_end			= $ecal_class->make_date($_POST['end_hour'], $_POST['end_minute'],$_POST['end_date']);
-    $ev_title		= $tp->toDB($_POST['ne_title']);
-    $ev_location	= $tp->toDB($_POST['ne_location']);
-    $ev_event		= $tp->toDB($_POST['ne_event']);
-	$temp_date 		= getdate($ecal_class->make_date(0,0,$_POST['start_date']));
-    if ($_POST['recurring'] == 1)
-	{
-	  $rec_m = $temp_date['mday'];		// Day of month
-      $rec_y = $temp_date['mon'];			// Month number
-    }
+	if (($_POST['ne_event'] == '') || !isset($_POST['qs']))
+	{	// Problem - tell user to go away
+		header('location:event.php?'.$ev_start.'.0.m8');
+		exit;
+	}
 	else
 	{
-      $rec_m = "";
-      $rec_y = "";
-    }
-	
-	$report_msg = '.m3';
-    if (isset($_POST['ne_insert']))
-	{  // Bits specific to inserting a new event
-		$qry = " 0, '".intval($ev_start)."', '".intval($ev_end)."', '".intval($_POST['allday'])."', '".intval($_POST['recurring'])."', '".time()."', '$ev_title', '$ev_location', '$ev_event', '".USERID.".".USERNAME."', '".$tp -> toDB($_POST['ne_email'])."', '".intval($_POST['ne_category'])."', '".$tp -> toDB($_POST['ne_thread'])."', '".intval($rec_m)."', '".intval($rec_y)."' ";
-        $sql->db_Insert("event", $qry);
-		$ecal_class->cal_log(1,'db_Insert',$qry, $ev_start);
-        $qs = preg_replace("/ne./i", "", $_POST['qs']);	
-		$report_msg = '.m4';
-	}
-	
-	if (isset($_POST['ne_update']))
-	{  // Bits specific to updating an existing event
-		$qry = "event_start='".intval($ev_start)."', event_end='".intval($ev_end)."', event_allday='".intval($_POST['allday'])."', event_recurring='".intval($_POST['recurring'])."', event_datestamp= '".time()."', event_title= '$ev_title', event_location='$ev_location', event_details='$ev_event', event_contact='".$tp -> toDB($_POST['ne_email'])."', event_category='".intval($_POST['ne_category'])."', event_thread='".$tp -> toDB($_POST['ne_thread'])."', event_rec_m='".intval($rec_m)."', event_rec_y='".intval($rec_y)."' WHERE event_id='".intval($_POST['id'])."' ";
-        $sql->db_Update("event", $qry);
-		$ecal_class->cal_log(2,'db_Update',$qry, $ev_start);
-        $qs = preg_replace("/ed./i", "", $_POST['qs']);
-		$report_msg = '.m5';
+		if (!$cal_super)
+		{
+			$evCat = intval($_POST['ne_category']);
+			if ($sql->db_Select('event_cat', 'event_cat_addclass', 'event_cat_id = '.$evCat))
+			{
+				$row = $sql->db_Fetch(MYSQL_ASSOC);
+				if (!check_class($row['event_cat_addclass']))
+				{
+					header('location:event.php?'.$ev_start.'.0.m8');
+					exit;
+				}
+			}
+			else
+			{		// Invalid category - definitely go away!
+				header('location:'.e_BASE.'index.php');
+				exit;
+			}
+		}
+		$ev_start		= $ecal_class->make_date($_POST['ne_hour'], $_POST['ne_minute'],$_POST['start_date']);
+		$ev_end			= $ecal_class->make_date($_POST['end_hour'], $_POST['end_minute'],$_POST['end_date']);
+		$ev_title		= $tp->toDB($_POST['ne_title']);
+		$ev_location	= $tp->toDB($_POST['ne_location']);
+		$ev_event		= $tp->toDB($_POST['ne_event']);
+		$temp_date 		= getdate($ecal_class->make_date(0,0,$_POST['start_date']));
+		if ($_POST['recurring'] == 1)
+		{
+		  $rec_m = $temp_date['mday'];		// Day of month
+		  $rec_y = $temp_date['mon'];			// Month number
+		}
+		else
+		{
+		  $rec_m = "";
+		  $rec_y = "";
+		}
+		
+		$report_msg = '.m3';
+		if (isset($_POST['ne_insert']))
+		{  // Bits specific to inserting a new event
+			$qry = " 0, '".intval($ev_start)."', '".intval($ev_end)."', '".intval($_POST['allday'])."', '".intval($_POST['recurring'])."', '".time()."', '$ev_title', '$ev_location', '$ev_event', '".USERID.".".USERNAME."', '".$tp -> toDB($_POST['ne_email'])."', '".intval($_POST['ne_category'])."', '".$tp -> toDB($_POST['ne_thread'])."', '".intval($rec_m)."', '".intval($rec_y)."' ";
+			$sql->db_Insert("event", $qry);
+			$ecal_class->cal_log(1,'db_Insert',$qry, $ev_start);
+			$qs = preg_replace("/ne./i", "", $_POST['qs']);	
+			$report_msg = '.m4';
+		}
+		
+		if (isset($_POST['ne_update']))
+		{  // Bits specific to updating an existing event
+			$qry = "event_start='".intval($ev_start)."', event_end='".intval($ev_end)."', event_allday='".intval($_POST['allday'])."', event_recurring='".intval($_POST['recurring'])."', event_datestamp= '".time()."', event_title= '$ev_title', event_location='$ev_location', event_details='$ev_event', event_contact='".$tp -> toDB($_POST['ne_email'])."', event_category='".intval($_POST['ne_category'])."', event_thread='".$tp -> toDB($_POST['ne_thread'])."', event_rec_m='".intval($rec_m)."', event_rec_y='".intval($rec_y)."' WHERE event_id='".intval($_POST['id'])."' ";
+			$sql->db_Update("event", $qry);
+			$ecal_class->cal_log(2,'db_Update',$qry, $ev_start);
+			$qs = preg_replace("/ed./i", "", $_POST['qs']);
+			$report_msg = '.m5';
+		}
+		// Now clear cache  - just do the lot for now - get clever later
+		$e107cache->clear('nq_event_cal');
+		header("location:event.php?".$ev_start.".".$qs.$report_msg);
 	}
-	// Now clear cache  - just do the lot for now - get clever later
-	$e107cache->clear('nq_event_cal');
-    header("location:event.php?".$ev_start.".".$qs.$report_msg);
-  }
 }
 
 $action = "";		// Remove notice
@@ -209,7 +215,7 @@
 // ----------------------------------------------------------------------------------------------------------
 
 // Messages acknowledging actions
-$poss_message = array('m1' => EC_LAN_41, 'm2' => EC_LAN_42, 'm3' => EC_LAN_43, 'm4' => EC_LAN_44, 'm5' => EC_LAN_45);
+$poss_message = array('m1' => EC_LAN_41, 'm2' => EC_LAN_42, 'm3' => EC_LAN_43, 'm4' => EC_LAN_44, 'm5' => EC_LAN_45, 'm8' => EC_LAN_181);
 if (isset($qs[2])) if (isset($poss_message[$qs[2]])) $message = $poss_message[$qs[2]];
 
 if (isset($message))
@@ -398,7 +404,7 @@
 		".EC_LAN_67;
 		
 
-	$text .= make_hourmin("ne_",$ne_hour,$ne_minute)."&nbsp;&nbsp;".EC_LAN_73.make_hourmin('end_',$end_hour,$end_minute);
+		$text .= make_hourmin("ne_",$ne_hour,$ne_minute)."&nbsp;&nbsp;".EC_LAN_73.make_hourmin('end_',$end_hour,$end_minute);
 		$text .= "<br /><input type='checkbox' name='allday' value='1' ".(isset($allday) && $allday == 1 ? "checked='checked'" :"")." />";
         $text .= EC_LAN_64."
 		</td>
@@ -422,9 +428,9 @@
 		<select name='ne_category' class='tbox'>";
         // Check if supervisor, if so get all categories, otherwise just get those the user is allowed to see
 		$cal_arg = ($ecal_class->cal_super ? "" : "find_in_set(event_cat_addclass,'".USERCLASS_LIST."')");
-        if ($sql->db_Select("event_cat", "*", $cal_arg))
+        if ($sql->db_Select('event_cat', 'event_cat_id, event_cat_name', $cal_arg))
 		{
-            while ($row = $sql->db_Fetch())
+            while ($row = $sql->db_Fetch(MYSQL_ASSOC))
 			{
 				$text .= "<option value='{$row['event_cat_id']}' ".(isset($ne_category) && $ne_category == $row['event_cat_id'] ? "selected='selected'" :"")." >".$row['event_cat_name']."</option>";
             }
@@ -436,35 +442,6 @@
         $text .= "</select>
 		</td>
 		</tr>";
-        // * *BK* Check if the add class is appropriate for adding new categories
-        // * *BK* It will default to everybody class when created.  Need to go in to admin categories if
-        // * *BK* you want to change read class.
-        if (FALSE && check_class($pref['eventpost_addcat']) && $action != "ed")
-        {
-            require_once(e_HANDLER."file_class.php");
-            $fi = new e_file;
-            $imagelist = $fi->get_files(e_PLUGIN."calendar_menu/images", "\.\w{3}$");
-            $text .= "<tr>
-			<td class='forumheader3' style='width:20%' rowspan='2'>".EC_LAN_53." </td>
-			<td class='forumheader3' style='width:80%'>".EC_LAN_54."
-			<input class='tbox' type='text' name='ne_new_category' size='30' value='".(isset($ne_new_category) ? $ne_new_category : "")."' maxlength='100' style='width:95%' /> ";
-            $text .= "</td></tr>
-			<tr><td class='forumheader3' style='width:80%'>".EC_LAN_55;
-            $text .= " <input class='tbox' style='width:150px' type='text' id='ne_new_category_icon' name='ne_new_category_icon' />";
-            $text .= " <input class='button' type='button' style='width: 45px; cursor:hand;' value='".EC_LAN_90."' onclick='expandit(\"cat_icons\")' />";
-            $text .= "<div style='display:none' id='cat_icons'>";
-
-            foreach($imagelist as $img){
-                if ($img['fname']){
-                    $text .= "<a href=\"javascript:insertext('".$img['fname']."','ne_new_category_icon','cat_icons')\"><img src='".e_PLUGIN."calendar_menu/images/".$img['fname']."' style='border:0px' alt='' /></a> ";
-                }
-            }
-            $text .= "</div>";
-            $text .= "<div style='text-align:center'>
-			<input class='button' type='submit' name='ne_cat_create' value='".EC_LAN_56."' onclick='submitted=this.name' /></div>
-			</td>
-			</tr>";
-        }
 
         $text .= "
 		<tr>
diff -x .svn -aruN 0.7.16.src/e107_plugins/calendar_menu/languages/English.php 0.7.17.src/e107_plugins/calendar_menu/languages/English.php
--- 0.7.16.src/e107_plugins/calendar_menu/languages/English.php	2006-11-16 04:23:52.000000000 -0600
+++ 0.7.17.src/e107_plugins/calendar_menu/languages/English.php	2009-12-12 11:25:45.000000000 -0600
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/calendar_menu/languages/English.php,v $
-|     $Revision: 1.18 $
-|     $Date: 2006/11/16 10:24:15 $
-|     $Author: e107coders $
+|     $Revision: 1.19 $
+|     $Date: 2009/12/12 17:26:09 $
+|     $Author: e107steved $
 |
 | Various mods by steved:
 |	a) To reflect updates
@@ -236,6 +236,9 @@
 define('EC_LAN_143', "Facility not available");
 define('EC_LAN_144', " at ");
 
+// Gap to maintain compatibility with 0.8
+define('EC_LAN_181', "You aren't allowed to do that!");
+
 
 define('EC_ADLAN_A10', "Configuration");
 define('EC_ADLAN_A11', "Categories");
diff -x .svn -aruN 0.7.16.src/e107_plugins/calendar_menu/plugin.php 0.7.17.src/e107_plugins/calendar_menu/plugin.php
--- 0.7.16.src/e107_plugins/calendar_menu/plugin.php	2008-09-02 16:11:45.000000000 -0500
+++ 0.7.17.src/e107_plugins/calendar_menu/plugin.php	2009-11-19 05:45:25.000000000 -0600
@@ -3,7 +3,7 @@
 + ----------------------------------------------------------------------------+
 |     e107 website system
 |
-|     Steve Dunstan 2001-2002
+|     (C)Steve Dunstan 2001-2002
 |     http://e107.org
 |     jalist@e107.org
 |
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/calendar_menu/plugin.php,v $
-|     $Revision: 1.21 $ - with mods to hopefully trigger upgrade to new version
-|     $Date: 2008/09/02 21:12:08 $
-|     $Author: e107steved $
+|     $Revision: 1.23 $ - with mods to hopefully trigger upgrade to new version
+|     $Date: 2009/11/19 11:45:49 $
+|     $Author: marj_nl_fr $
 |
 | 22.07.06 - Mods for V3.6 upgrade, including log directory
 | 02.08.06 - Support for category icon display added
@@ -28,8 +28,8 @@
 if (!defined('e107_INIT')) { exit; }
 
 // Plugin info -------------------------------------------------------------------------------------------------------
-$lan_file = e_PLUGIN."calendar_menu/languages/".e_LANGUAGE.".php";
-@require_once(file_exists($lan_file) ? $lan_file : e_PLUGIN."calendar_menu/languages/English.php");
+include_lan(e_PLUGIN."calendar_menu/languages/".e_LANGUAGE.".php");
+
 $eplug_name = 'EC_ADLAN_1';
 $eplug_version = "3.6";
 $eplug_author = "jalist / cameron / McFly / Barry / Lisa_ / steved";
@@ -62,12 +62,12 @@
 
 // List of preferences -----------------------------------------------------------------------------------------------
 $eplug_prefs = array(
-"eventpost_admin" => 0,
+"eventpost_admin" => 254,			// Admin
 "eventpost_adminlog" => 0,
 "eventpost_showeventcount" => 1,
 "eventpost_forum" => 1,
 "eventpost_recentshow" => 0,
-"eventpost_super" => 0,
+"eventpost_super" => 254,			// Admin
 "eventpost_menulink" => 0,
 "eventpost_dateformat" => 1,
 "eventpost_fivemins" => 0,
diff -x .svn -aruN 0.7.16.src/e107_plugins/chatbox_menu/chatbox_menu.php 0.7.17.src/e107_plugins/chatbox_menu/chatbox_menu.php
--- 0.7.16.src/e107_plugins/chatbox_menu/chatbox_menu.php	2009-08-23 05:39:28.000000000 -0500
+++ 0.7.17.src/e107_plugins/chatbox_menu/chatbox_menu.php	2010-01-09 06:01:14.000000000 -0600
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/chatbox_menu/chatbox_menu.php,v $
-|     $Revision: 1.81 $
-|     $Date: 2009/08/23 10:39:52 $
-|     $Author: marj_nl_fr $
+|     $Revision: 1.82 $
+|     $Date: 2010/01/09 12:01:38 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 
@@ -133,7 +133,7 @@
 	if($pref['cb_layer'] == 2)
 	{
 
-		$oc = "onclick=\"javascript:sendInfo('".SITEURL.$PLUGINS_DIRECTORY."chatbox_menu/chatbox_menu.php', 'chatbox_posts', this.form);\"";
+		$oc = "onclick=\"javascript:sendInfo('".SITEURLBASE.e_PLUGIN_ABS."chatbox_menu/chatbox_menu.php', 'chatbox_posts', this.form);\"";
 	}
 	else
 	{
@@ -185,7 +185,7 @@
 			list($cb_uid, $cb_nick) = explode(".", $cb['cb_nick'], 2);
 			if($cb['user_name'])
 			{
-				$cb_nick = "<a href='".e_BASE."user.php?id.{$cb_uid}'>{$cb['user_name']}</a>";
+				$cb_nick = "<a href='".e_HTTP."user.php?id.{$cb_uid}'>{$cb['user_name']}</a>";
 			}
 			else
 			{
@@ -208,11 +208,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;" />';
 				}
 				// default chatbox style
 				$CHATBOXSTYLE = "<!-- chatbox -->\n<div class='spacer'>
@@ -230,7 +230,7 @@
 	$total_chats = $sql -> db_Count("chatbox");
 	if($total_chats > $chatbox_posts || CB_MOD)
 	{
-		$text .= "<br /><div style='text-align:center'><a href='".e_PLUGIN."chatbox_menu/chat.php'>".(CB_MOD ? CHATBOX_L13 : CHATBOX_L12)."</a> (".$total_chats.")</div>";
+		$text .= "<br /><div style='text-align:center'><a href='".e_PLUGIN_ABS."chatbox_menu/chat.php'>".(CB_MOD ? CHATBOX_L13 : CHATBOX_L12)."</a> (".$total_chats.")</div>";
 	}
 	$e107cache->set("nq_chatbox", $text);
 }
diff -x .svn -aruN 0.7.16.src/e107_plugins/chatbox_menu/chat.php 0.7.17.src/e107_plugins/chatbox_menu/chat.php
--- 0.7.16.src/e107_plugins/chatbox_menu/chat.php	2007-04-25 14:34:47.000000000 -0500
+++ 0.7.17.src/e107_plugins/chatbox_menu/chat.php	2009-11-19 05:45:24.000000000 -0600
@@ -3,7 +3,7 @@
 + ----------------------------------------------------------------------------+
 |     e107 website system
 |
-|     Steve Dunstan 2001-2002
+|     (C)Steve Dunstan 2001-2002
 |     http://e107.org
 |     jalist@e107.org
 |
@@ -11,17 +11,14 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/chatbox_menu/chat.php,v $
-|     $Revision: 1.25 $
-|     $Date: 2007/04/25 19:35:10 $
-|     $Author: e107steved $
+|     $Revision: 1.26 $
+|     $Date: 2009/11/19 11:45:48 $
+|     $Author: marj_nl_fr $
 +----------------------------------------------------------------------------+
 */
 require_once("../../class2.php");
-if (file_exists(e_PLUGIN."chatbox_menu/languages/".e_LANGUAGE."/".e_LANGUAGE.".php")) {
-	include_once(e_PLUGIN."chatbox_menu/languages/".e_LANGUAGE."/".e_LANGUAGE.".php");
-} else {
-	include_once(e_PLUGIN."chatbox_menu/languages/English/English.php");
-}
+include_lan(e_PLUGIN."chatbox_menu/languages/".e_LANGUAGE."/".e_LANGUAGE.".php");
+
 require_once(HEADERF);
 
 $sql->db_Select("menus", "*", "menu_name='chatbox_menu'");
diff -x .svn -aruN 0.7.16.src/e107_plugins/chatbox_menu/e_search.php 0.7.17.src/e107_plugins/chatbox_menu/e_search.php
--- 0.7.16.src/e107_plugins/chatbox_menu/e_search.php	2005-12-14 13:28:21.000000000 -0600
+++ 0.7.17.src/e107_plugins/chatbox_menu/e_search.php	2009-11-19 05:45:24.000000000 -0600
@@ -1,11 +1,8 @@
 <?php
-if (!defined('e107_INIT')) { exit; }
+/* $Id: e_search.php,v 1.8 2009/11/19 11:45:48 marj_nl_fr Exp $ */
+if (!defined('e107_INIT')) { exit(); }
 
-if (file_exists(e_PLUGIN."chatbox_menu/languages/".e_LANGUAGE."/lan_chatbox_search.php")) {
-	include_once(e_PLUGIN."chatbox_menu/languages/".e_LANGUAGE."/lan_chatbox_search.php");
-} else {
-	include_once(e_PLUGIN."chatbox_menu/languages/English/lan_chatbox_search.php");
-}
+include_lan(e_PLUGIN."chatbox_menu/languages/".e_LANGUAGE."/lan_chatbox_search.php");
 
 $search_info[] = array('sfile' => e_PLUGIN.'chatbox_menu/search/search_parser.php', 'qtype' => CB_SCH_LAN_1, 'refpage' => 'chat.php', 'advanced' => e_PLUGIN.'chatbox_menu/search/search_advanced.php');
 ?>
\ No newline at end of file
diff -x .svn -aruN 0.7.16.src/e107_plugins/chatbox_menu/e_status.php 0.7.17.src/e107_plugins/chatbox_menu/e_status.php
--- 0.7.16.src/e107_plugins/chatbox_menu/e_status.php	2005-12-14 13:28:21.000000000 -0600
+++ 0.7.17.src/e107_plugins/chatbox_menu/e_status.php	2010-01-09 06:01:15.000000000 -0600
@@ -2,5 +2,5 @@
 if (!defined('e107_INIT')) { exit; }
 
 $chatbox_posts = $sql -> db_Count("chatbox");
-$text .= "<div style='padding-bottom: 2px;'><img src='".e_PLUGIN."chatbox_menu/images/chatbox_16.png' style='width: 16px; height: 16px; vertical-align: bottom' alt='' /> ".ADLAN_115.": ".$chatbox_posts."</div>";
+$text .= "<div style='padding-bottom: 2px;'><img src='".e_PLUGIN_ABS."chatbox_menu/images/chatbox_16.png' style='width: 16px; height: 16px; vertical-align: bottom' alt='' /> ".ADLAN_115.": ".$chatbox_posts."</div>";
 ?>
\ No newline at end of file
diff -x .svn -aruN 0.7.16.src/e107_plugins/comment_menu/config.php 0.7.17.src/e107_plugins/comment_menu/config.php
--- 0.7.16.src/e107_plugins/comment_menu/config.php	2006-10-24 08:41:33.000000000 -0500
+++ 0.7.17.src/e107_plugins/comment_menu/config.php	2009-11-19 05:45:26.000000000 -0600
@@ -3,7 +3,7 @@
 + ----------------------------------------------------------------------------+
 |     e107 website system
 |
-|     Steve Dunstan 2001-2002
+|     (C)Steve Dunstan 2001-2002
 |     http://e107.org
 |     jalist@e107.org
 |
@@ -11,25 +11,22 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/comment_menu/config.php,v $
-|     $Revision: 1.5 $
-|     $Date: 2006/10/24 13:41:56 $
-|     $Author: mrpete $
+|     $Revision: 1.6 $
+|     $Date: 2009/11/19 11:45:50 $
+|     $Author: marj_nl_fr $
 +----------------------------------------------------------------------------+
 */
 $eplug_admin = TRUE;
 require_once("../../class2.php");
-require_once(e_HANDLER."userclass_class.php");
-	
-$lan_file = e_PLUGIN."comment_menu/languages/".e_LANGUAGE.".php";
-if (file_exists($lan_file)) {
-	require_once($lan_file);
-} else {
-	require_once(e_PLUGIN."comment_menu/languages/English.php");
-}
 if (!getperms("1")) {
 	header("location:".e_BASE."index.php");
 	 exit ;
 }
+
+require_once(e_HANDLER."userclass_class.php");
+	
+include_lan(e_PLUGIN."comment_menu/languages/".e_LANGUAGE.".php");
+
 require_once(e_ADMIN."auth.php");
 	
 if (isset($_POST['update_menu'])) {
diff -x .svn -aruN 0.7.16.src/e107_plugins/content/admin_content_config.php 0.7.17.src/e107_plugins/content/admin_content_config.php
--- 0.7.16.src/e107_plugins/content/admin_content_config.php	2007-01-13 17:21:01.000000000 -0600
+++ 0.7.17.src/e107_plugins/content/admin_content_config.php	2009-11-19 05:45:25.000000000 -0600
@@ -4,7 +4,7 @@
 |        e107 website system
 |        /admin/review.php
 |
-|        Steve Dunstan 2001-2002
+|        (C)Steve Dunstan 2001-2002
 |        http://e107.org
 |        jalist@e107.org
 |
@@ -12,9 +12,9 @@
 |        GNU General Public License (http://gnu.org).
 |
 |		$Source: /cvsroot/e107/e107_0.7/e107_plugins/content/admin_content_config.php,v $
-|		$Revision: 1.64 $
-|		$Date: 2007/01/13 23:21:24 $
-|		$Author: lisa_ $
+|		$Revision: 1.65 $
+|		$Date: 2009/11/19 11:45:49 $
+|		$Author: marj_nl_fr $
 +---------------------------------------------------------------+
 */
 
@@ -25,11 +25,9 @@
 $e_wysiwyg = "content_text,cat_text";
 $plugindir = e_PLUGIN."content/";
 
-$lan_file = $plugindir.'languages/'.e_LANGUAGE.'/lan_content_admin.php';
-include_once(file_exists($lan_file) ? $lan_file : $plugindir.'languages/English/lan_content_admin.php');
+include_lan($plugindir.'languages/'.e_LANGUAGE.'/lan_content_admin.php');
 
-$lan_file = $plugindir.'languages/'.e_LANGUAGE.'/lan_content.php';
-include_once(file_exists($lan_file) ? $lan_file : $plugindir.'languages/English/lan_content.php');
+include_lan($plugindir.'languages/'.e_LANGUAGE.'/lan_content.php');
 
 require_once(e_ADMIN."auth.php");
 require_once(e_HANDLER."form_handler.php");
diff -x .svn -aruN 0.7.16.src/e107_plugins/content/content_manager.php 0.7.17.src/e107_plugins/content/content_manager.php
--- 0.7.16.src/e107_plugins/content/content_manager.php	2008-10-07 14:21:54.000000000 -0500
+++ 0.7.17.src/e107_plugins/content/content_manager.php	2009-11-19 05:45:25.000000000 -0600
@@ -4,7 +4,7 @@
 |        e107 website system
 |        /admin/review.php
 |
-|        Steve Dunstan 2001-2002
+|        (C)Steve Dunstan 2001-2002
 |        http://e107.org
 |        jalist@e107.org
 |
@@ -12,9 +12,9 @@
 |        GNU General Public License (http://gnu.org).
 |
 |		$Source: /cvsroot/e107/e107_0.7/e107_plugins/content/content_manager.php,v $
-|		$Revision: 1.26 $
-|		$Date: 2008/10/07 19:22:17 $
-|		$Author: e107steved $
+|		$Revision: 1.27 $
+|		$Date: 2009/11/19 11:45:49 $
+|		$Author: marj_nl_fr $
 +---------------------------------------------------------------+
 */
 
@@ -38,11 +38,9 @@
 require_once($plugindir."handlers/content_form_class.php");
 $aform = new contentform;
 
-$lan_file = $plugindir.'languages/'.e_LANGUAGE.'/lan_content_admin.php';
-include_once(file_exists($lan_file) ? $lan_file : $plugindir.'languages/English/lan_content_admin.php');
+include_lan($plugindir.'languages/'.e_LANGUAGE.'/lan_content_admin.php');
 
-$lan_file = $plugindir.'languages/'.e_LANGUAGE.'/lan_content.php';
-include_once(file_exists($lan_file) ? $lan_file : $plugindir.'languages/English/lan_content.php');
+include_lan($plugindir.'languages/'.e_LANGUAGE.'/lan_content.php');
 
 $deltest = array_flip($_POST);
 
diff -x .svn -aruN 0.7.16.src/e107_plugins/content/content.php 0.7.17.src/e107_plugins/content/content.php
--- 0.7.16.src/e107_plugins/content/content.php	2009-01-29 09:26:13.000000000 -0600
+++ 0.7.17.src/e107_plugins/content/content.php	2009-11-19 05:45:25.000000000 -0600
@@ -4,7 +4,7 @@
 |        e107 website system
 |        /admin/review.php
 |
-|        Steve Dunstan 2001-2002
+|        (C)Steve Dunstan 2001-2002
 |        http://e107.org
 |        jalist@e107.org
 |
@@ -12,9 +12,9 @@
 |        GNU General Public License (http://gnu.org).
 |
 |		$Source: /cvsroot/e107/e107_0.7/e107_plugins/content/content.php,v $
-|		$Revision: 1.115 $
-|		$Date: 2009/01/29 15:26:37 $
-|		$Author: lisa_ $
+|		$Revision: 1.116 $
+|		$Date: 2009/11/19 11:45:49 $
+|		$Author: marj_nl_fr $
 +---------------------------------------------------------------+
 */
 
@@ -33,8 +33,7 @@
 $aa = new content;
 e107_require_once(e_HANDLER.'arraystorage_class.php');
 $eArrayStorage = new ArrayData();
-$lan_file = $plugindir."languages/".e_LANGUAGE."/lan_content.php";
-include_once(file_exists($lan_file) ? $lan_file : $plugindir."languages/English/lan_content.php");
+include_lan($plugindir."languages/".e_LANGUAGE."/lan_content.php");
 
 if(e_QUERY){
 	$qs = explode(".", e_QUERY);
diff -x .svn -aruN 0.7.16.src/e107_plugins/content/content_shortcodes.php 0.7.17.src/e107_plugins/content/content_shortcodes.php
--- 0.7.16.src/e107_plugins/content/content_shortcodes.php	2009-01-29 09:26:13.000000000 -0600
+++ 0.7.17.src/e107_plugins/content/content_shortcodes.php	2010-01-03 03:56:50.000000000 -0600
@@ -308,7 +308,7 @@
 if($row['content_pe'] && isset($content_pref["content_catall_peicon"]) && $content_pref["content_catall_peicon"]){
 	$EPICONS = $tp -> parseTemplate("{EMAIL_ITEM=".CONTENT_LAN_69." ".CONTENT_LAN_72."^plugin:content.".$row['content_id']."}");
 	$EPICONS .= " ".$tp -> parseTemplate("{PRINT_ITEM=".CONTENT_LAN_70." ".CONTENT_LAN_72."^plugin:content.".$row['content_id']."}");
-	$EPICONS .= " ".$tp -> parseTemplate("{PDF=".CONTENT_LAN_76." ".CONTENT_LAN_71."^plugin:content.".$row['content_id']."}");
+	$EPICONS .= " ".$tp -> parseTemplate("{PDF=".CONTENT_LAN_76." ".CONTENT_LAN_72."^plugin:content.".$row['content_id']."}");
 return $EPICONS;
 }
 SC_END
@@ -446,7 +446,7 @@
 if( (isset($content_pref["content_cat_peicon"]) && $content_pref["content_cat_peicon"] && $row['content_pe']) || (isset($content_pref["content_cat_peicon_all"]) && $content_pref["content_cat_peicon_all"])){
 	$EPICONS = $tp -> parseTemplate("{EMAIL_ITEM=".CONTENT_LAN_69." ".CONTENT_LAN_72."^plugin:content.$qs[1]}");
 	$EPICONS .= " ".$tp -> parseTemplate("{PRINT_ITEM=".CONTENT_LAN_70." ".CONTENT_LAN_72."^plugin:content.$qs[1]}");
-	$EPICONS .= " ".$tp -> parseTemplate("{PDF=".CONTENT_LAN_76." ".CONTENT_LAN_71."^plugin:content.$qs[1]}");
+	$EPICONS .= " ".$tp -> parseTemplate("{PDF=".CONTENT_LAN_76." ".CONTENT_LAN_72."^plugin:content.$qs[1]}");
 return $EPICONS;
 }
 SC_END
diff -x .svn -aruN 0.7.16.src/e107_plugins/content/content_submit.php 0.7.17.src/e107_plugins/content/content_submit.php
--- 0.7.16.src/e107_plugins/content/content_submit.php	2006-12-07 06:56:38.000000000 -0600
+++ 0.7.17.src/e107_plugins/content/content_submit.php	2009-11-19 05:45:25.000000000 -0600
@@ -4,7 +4,7 @@
 |        e107 website system
 |        /admin/review.php
 |
-|        Steve Dunstan 2001-2002
+|        (C)Steve Dunstan 2001-2002
 |        http://e107.org
 |        jalist@e107.org
 |
@@ -12,9 +12,9 @@
 |        GNU General Public License (http://gnu.org).
 |
 |		$Source: /cvsroot/e107/e107_0.7/e107_plugins/content/content_submit.php,v $
-|		$Revision: 1.25 $
-|		$Date: 2006/12/07 12:57:01 $
-|		$Author: mrpete $
+|		$Revision: 1.26 $
+|		$Date: 2009/11/19 11:45:49 $
+|		$Author: marj_nl_fr $
 +---------------------------------------------------------------+
 */
 
@@ -41,8 +41,7 @@
 $e_wysiwyg	= "content_text";
 global $tp;
 
-$lan_file = $plugindir.'languages/'.e_LANGUAGE.'/lan_content.php';
-include_once(file_exists($lan_file) ? $lan_file : $plugindir.'languages/English/lan_content.php');
+include_lan($plugindir.'languages/'.e_LANGUAGE.'/lan_content.php');
 
 if(e_QUERY){
 	$qs = explode(".", e_QUERY);
diff -x .svn -aruN 0.7.16.src/e107_plugins/content/content_update.php 0.7.17.src/e107_plugins/content/content_update.php
--- 0.7.16.src/e107_plugins/content/content_update.php	2006-07-28 09:06:51.000000000 -0500
+++ 0.7.17.src/e107_plugins/content/content_update.php	2009-11-19 05:45:25.000000000 -0600
@@ -3,7 +3,7 @@
 + ----------------------------------------------------------------------------+
 |     e107 website system
 |
-|     Steve Dunstan 2001-2002
+|     (C)Steve Dunstan 2001-2002
 |     http://e107.org
 |     jalist@e107.org
 |
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/content/content_update.php,v $
-|     $Revision: 1.17 $
-|     $Date: 2006/07/28 14:07:14 $
-|     $Author: lisa_ $
+|     $Revision: 1.18 $
+|     $Date: 2009/11/19 11:45:49 $
+|     $Author: marj_nl_fr $
 +----------------------------------------------------------------------------+
 */
 if (!defined('e107_INIT')) { exit; }
@@ -32,8 +32,7 @@
 require_once($plugindir."handlers/content_convert_class.php");
 $ac = new content_convert;
 
-$lan_file = $plugindir.'languages/'.e_LANGUAGE.'/lan_content_admin.php';
-include_once(file_exists($lan_file) ? $lan_file : $plugindir.'languages/English/lan_content_admin.php');
+include_lan($plugindir.'languages/'.e_LANGUAGE.'/lan_content_admin.php');
 
 if($sql->db_Select("plugin", "plugin_version", "plugin_path = 'content'"))
 {
diff -x .svn -aruN 0.7.16.src/e107_plugins/content/e_emailprint.php 0.7.17.src/e107_plugins/content/e_emailprint.php
--- 0.7.16.src/e107_plugins/content/e_emailprint.php	2006-05-31 16:29:36.000000000 -0500
+++ 0.7.17.src/e107_plugins/content/e_emailprint.php	2009-11-19 05:45:25.000000000 -0600
@@ -1,4 +1,5 @@
 <?php
+/* $Id: e_emailprint.php,v 1.28 2009/11/19 11:45:49 marj_nl_fr Exp $ */
 
 if (!defined('e107_INIT')) { exit; }
 
@@ -13,8 +14,7 @@
 
 		require_once(e_PLUGIN."content/content_shortcodes.php");
 
-		$lan_file = e_PLUGIN."content/languages/".e_LANGUAGE."/lan_content.php";
-		include_once(file_exists($lan_file) ? $lan_file : e_PLUGIN."content/languages/English/lan_content.php");
+		include_lan(e_PLUGIN."content/languages/".e_LANGUAGE."/lan_content.php");
 
 		if(!is_object($sql)){ $sql = new db; }
 		$sql -> db_Select($plugintable, "content_id, content_heading, content_subheading, content_text, content_author, content_image, content_parent, content_datestamp, content_class", "content_id='".intval($id)."' ");
diff -x .svn -aruN 0.7.16.src/e107_plugins/content/e_help.php 0.7.17.src/e107_plugins/content/e_help.php
--- 0.7.16.src/e107_plugins/content/e_help.php	2009-07-19 04:32:00.000000000 -0500
+++ 0.7.17.src/e107_plugins/content/e_help.php	2009-11-19 05:45:25.000000000 -0600
@@ -1,11 +1,10 @@
 <?php
+/* $Id: e_help.php,v 1.2 2009/11/19 11:45:49 marj_nl_fr Exp $ */
 if (!defined('e107_INIT')) { exit; }
 
 global $plugindir;
 require_once($plugindir."handlers/content_defines.php");
-$lan_file = $plugindir.'languages/'.e_LANGUAGE.'/lan_content_help.php';
-include_once(file_exists($lan_file) ? $lan_file : $plugindir.'languages/English/lan_content_help.php');
-
+include_lan($plugindir.'languages/'.e_LANGUAGE.'/lan_content_help.php');
 
 //$arrhide = array("creation", "submission", "paththeme", "general", "contentmanager", "menu", "recentpages", "catpages", "contentpages", "authorpage", "archivepage", "toppage", "scorepage");
 
diff -x .svn -aruN 0.7.16.src/e107_plugins/content/e_list.php 0.7.17.src/e107_plugins/content/e_list.php
--- 0.7.16.src/e107_plugins/content/e_list.php	2008-10-11 05:48:53.000000000 -0500
+++ 0.7.17.src/e107_plugins/content/e_list.php	2009-09-18 17:25:12.000000000 -0500
@@ -60,7 +60,7 @@
 				//get recent content for each main parent
 				$sqli = new db;
 				if(!$resultitem = $sqli -> db_Select("pcontent", "*", $qry)){
-					$LIST_DATA = "no items in ".$rowm['content_heading'];
+					$LIST_DATA = CONTENT_MENU_LAN_5." ".$rowm['content_heading'];
 				}else{
 					$LIST_DISPLAYSTYLE = ($arr[2] ? "" : "none");
 
diff -x .svn -aruN 0.7.16.src/e107_plugins/content/e_notify.php 0.7.17.src/e107_plugins/content/e_notify.php
--- 0.7.16.src/e107_plugins/content/e_notify.php	2007-09-06 02:23:14.000000000 -0500
+++ 0.7.17.src/e107_plugins/content/e_notify.php	2009-11-19 05:45:25.000000000 -0600
@@ -3,7 +3,7 @@
 + ----------------------------------------------------------------------------+
 |     e107 website system
 |
-|     Steve Dunstan 2001-2002
+|     (C)Steve Dunstan 2001-2002
 |     http://e107.org
 |     jalist@e107.org
 |
@@ -11,15 +11,14 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/content/e_notify.php,v $
-|     $Revision: 1.2 $
-|     $Date: 2007/09/06 07:23:37 $
-|     $Author: e107coders $
+|     $Revision: 1.3 $
+|     $Date: 2009/11/19 11:45:49 $
+|     $Author: marj_nl_fr $
 +----------------------------------------------------------------------------+
 */
 if (!defined('e107_INIT')) { exit; }   
 
-$lan_file = e_PLUGIN."content/languages/".e_LANGUAGE."/lan_content.php";
-include_once(file_exists($lan_file) ? $lan_file : e_PLUGIN."content/languages/English/lan_content.php");
+include_lan(e_PLUGIN."content/languages/".e_LANGUAGE."/lan_content.php");
 
 $config_category = CONTENT_NOTIFY_LAN_1;
 $config_events = array('content' => CONTENT_NOTIFY_LAN_2);
diff -x .svn -aruN 0.7.16.src/e107_plugins/content/e_search.php 0.7.17.src/e107_plugins/content/e_search.php
--- 0.7.16.src/e107_plugins/content/e_search.php	2005-12-14 13:28:21.000000000 -0600
+++ 0.7.17.src/e107_plugins/content/e_search.php	2009-11-19 05:45:25.000000000 -0600
@@ -1,11 +1,8 @@
 <?php
+/* $Id: e_search.php,v 1.5 2009/11/19 11:45:49 marj_nl_fr Exp $ */
 if (!defined('e107_INIT')) { exit; }
 
-if (file_exists(e_PLUGIN."content/languages/".e_LANGUAGE."/lan_content_search.php")) {
-	include_once(e_PLUGIN."content/languages/".e_LANGUAGE."/lan_content_search.php");
-} else {
-	include_once(e_PLUGIN."content/languages/English/lan_content_search.php");
-}
+include_lan(e_PLUGIN."content/languages/".e_LANGUAGE."/lan_content_search.php");
+
 $search_info[] = array( 'sfile' => e_PLUGIN.'content/search/search_parser.php', 'qtype' => CONT_SCH_LAN_1, 'refpage' => 'content.php', 'advanced' => e_PLUGIN.'content/search/search_advanced.php');
 
-?>
\ No newline at end of file
diff -x .svn -aruN 0.7.16.src/e107_plugins/content/handlers/content_class.php 0.7.17.src/e107_plugins/content/handlers/content_class.php
--- 0.7.16.src/e107_plugins/content/handlers/content_class.php	2009-08-23 05:39:28.000000000 -0500
+++ 0.7.17.src/e107_plugins/content/handlers/content_class.php	2009-11-19 05:45:26.000000000 -0600
@@ -4,7 +4,7 @@
 |        e107 website system
 |        /admin/review.php
 |
-|        Steve Dunstan 2001-2002
+|        (C)Steve Dunstan 2001-2002
 |        http://e107.org
 |        jalist@e107.org
 |
@@ -12,8 +12,8 @@
 |        GNU General Public License (http://gnu.org).
 |
 |		$Source: /cvsroot/e107/e107_0.7/e107_plugins/content/handlers/content_class.php,v $
-|		$Revision: 1.112 $
-|		$Date: 2009/08/23 10:39:52 $
+|		$Revision: 1.113 $
+|		$Date: 2009/11/19 11:45:50 $
 |		$Author: marj_nl_fr $
 +---------------------------------------------------------------+
 */
@@ -1281,7 +1281,7 @@
 			$menufile = "content_".$row['content_heading'];
 			$menuname = $row['content_heading'];
 
-			$data = chr(60)."?php\n". chr(47)."*\n+---------------------------------------------------------------+\n|        e107 website system\n|        ".e_PLUGIN."content/menus/".$menufile."_menu.php\n|\n|        Steve Dunstan 2001-2002\n|        http://e107.org\n|        jalist@e107.org\n|\n|        Released under the terms and conditions of the\n|        GNU General Public License (http://gnu.org).\n+---------------------------------------------------------------+\n\nThis file has been generated by ".e_PLUGIN."content/handlers/content_class.php.\n\n*". chr(47)."\n\n";
+			$data = chr(60)."?php\n". chr(47)."*\n+---------------------------------------------------------------+\n|        e107 website system\n|        ".e_PLUGIN."content/menus/".$menufile."_menu.php\n|\n|        (C)Steve Dunstan 2001-2002\n|        http://e107.org\n|        jalist@e107.org\n|\n|        Released under the terms and conditions of the\n|        GNU General Public License (http://gnu.org).\n+---------------------------------------------------------------+\n\nThis file has been generated by ".e_PLUGIN."content/handlers/content_class.php.\n\n*". chr(47)."\n\n";
 			$data .= "\n";
 			$data .= "unset(\$text);\n";
 			$data .= "\$text = \"\";\n";
@@ -1299,8 +1299,7 @@
 			$data .= "\$gen = new convert;\n";
 			$data .= "global \$tp;\n";
 			$data .= "\n";
-			$data .= "\$lan_file = e_PLUGIN.'content/languages/'.e_LANGUAGE.'/lan_content.php';\n";
-			$data .= "include_once(file_exists(\$lan_file) ? \$lan_file : e_PLUGIN.'content/languages/English/lan_content.php');\n";
+			$data .= "include_lan(e_PLUGIN.'content/languages/'.e_LANGUAGE.'/lan_content.php');\n";
 			$data .= '
 					$bullet = \'\';
 					if(defined(\'BULLET\'))
diff -x .svn -aruN 0.7.16.src/e107_plugins/content/handlers/content_convert_class.php 0.7.17.src/e107_plugins/content/handlers/content_convert_class.php
--- 0.7.16.src/e107_plugins/content/handlers/content_convert_class.php	2006-07-28 09:06:52.000000000 -0500
+++ 0.7.17.src/e107_plugins/content/handlers/content_convert_class.php	2009-11-19 05:45:25.000000000 -0600
@@ -4,7 +4,7 @@
 |        e107 website system
 |        content_convert_class.php
 |
-|        Steve Dunstan 2001-2002
+|        (C)Steve Dunstan 2001-2002
 |        http://e107.org
 |        jalist@e107.org
 |
@@ -12,9 +12,9 @@
 |        GNU General Public License (http://gnu.org).
 |
 |		$Source: /cvsroot/e107/e107_0.7/e107_plugins/content/handlers/content_convert_class.php,v $
-|		$Revision: 1.21 $
-|		$Date: 2006/07/28 14:07:15 $
-|		$Author: lisa_ $
+|		$Revision: 1.22 $
+|		$Date: 2009/11/19 11:45:49 $
+|		$Author: marj_nl_fr $
 +---------------------------------------------------------------+
 */
 
@@ -24,10 +24,8 @@
 $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().") ";
 
-$lan_file = $plugindir.'languages/'.e_LANGUAGE.'/lan_content.php';
-include_once(file_exists($lan_file) ? $lan_file : $plugindir.'languages/English/lan_content.php');
-$lan_file = $plugindir.'languages/'.e_LANGUAGE.'/lan_content_admin.php';
-include_once(file_exists($lan_file) ? $lan_file : $plugindir.'languages/English/lan_content_admin.php');
+include_lan(e_PLUGIN."content/languages/".e_LANGUAGE."/lan_content.php");
+include_lan(e_PLUGIN."content/languages/".e_LANGUAGE."/lan_content_admin.php");
 
 require_once($plugindir."handlers/content_class.php");
 $aa = new content;
diff -x .svn -aruN 0.7.16.src/e107_plugins/content/handlers/content_defines.php 0.7.17.src/e107_plugins/content/handlers/content_defines.php
--- 0.7.16.src/e107_plugins/content/handlers/content_defines.php	2006-07-13 05:00:47.000000000 -0500
+++ 0.7.17.src/e107_plugins/content/handlers/content_defines.php	2009-11-19 05:45:26.000000000 -0600
@@ -1,13 +1,13 @@
 <?php
+/* $Id: content_defines.php,v 1.10 2009/11/19 11:45:50 marj_nl_fr Exp $ */
 if (!defined('e107_INIT')) { exit; }
 
 global $plugindir;
 $plugindir = e_PLUGIN."content/";
 $imagedir = e_IMAGE."admin_images/";
-$lan_file = e_PLUGIN.'content/languages/'.e_LANGUAGE.'/lan_content_admin.php';
-include_once(file_exists($lan_file) ? $lan_file : e_PLUGIN.'content/languages/English/lan_content_admin.php');
-$lan_file = e_PLUGIN.'content/languages/'.e_LANGUAGE.'/lan_content.php';
-include_once(file_exists($lan_file) ? $lan_file : e_PLUGIN.'content/languages/English/lan_content.php');
+
+include_lan(e_PLUGIN."content/languages/".e_LANGUAGE."/lan_content.php");
+include_lan(e_PLUGIN."content/languages/".e_LANGUAGE."/lan_content_admin.php");
 
 if (!defined('CONTENT_ICON_EDIT')) { define("CONTENT_ICON_EDIT", "<img src='".$imagedir."maintain_16.png' alt='".CONTENT_ICON_LAN_0."' title='".CONTENT_ICON_LAN_0."' style='border:0; cursor:pointer;' />"); }
 if (!defined('CONTENT_ICON_LINK')) { define("CONTENT_ICON_LINK", "<img src='".$imagedir."leave_16.png' alt='".CONTENT_ICON_LAN_15."' title='".CONTENT_ICON_LAN_15."' style='border:0; cursor:pointer;' />"); }
diff -x .svn -aruN 0.7.16.src/e107_plugins/content/handlers/content_preset.php 0.7.17.src/e107_plugins/content/handlers/content_preset.php
--- 0.7.16.src/e107_plugins/content/handlers/content_preset.php	2007-06-12 17:50:26.000000000 -0500
+++ 0.7.17.src/e107_plugins/content/handlers/content_preset.php	2009-11-19 05:45:26.000000000 -0600
@@ -1,12 +1,12 @@
 <?php
+/* $Id: content_preset.php,v 1.11 2009/11/19 11:45:50 marj_nl_fr Exp $ */
 require_once("../../../class2.php");
 require_once(e_HANDLER."form_handler.php");
 $rs = new form;
 
-$lan_file = e_PLUGIN."content/languages/".e_LANGUAGE."/lan_content.php";
-include_once(file_exists($lan_file) ? $lan_file : e_PLUGIN."content/languages/English/lan_content.php");
-$lan_file = e_PLUGIN."content/languages/".e_LANGUAGE."/lan_content_admin.php";
-include_once(file_exists($lan_file) ? $lan_file : e_PLUGIN."content/languages/English/lan_content_admin.php");
+include_lan(e_PLUGIN."content/languages/".e_LANGUAGE."/lan_content.php");
+include_lan(e_PLUGIN."content/languages/".e_LANGUAGE."/lan_content_admin.php");
+
 $months = array(CONTENT_ADMIN_DATE_LAN_0, CONTENT_ADMIN_DATE_LAN_1, CONTENT_ADMIN_DATE_LAN_2, CONTENT_ADMIN_DATE_LAN_3, CONTENT_ADMIN_DATE_LAN_4, CONTENT_ADMIN_DATE_LAN_5, CONTENT_ADMIN_DATE_LAN_6, CONTENT_ADMIN_DATE_LAN_7, CONTENT_ADMIN_DATE_LAN_8, CONTENT_ADMIN_DATE_LAN_9, CONTENT_ADMIN_DATE_LAN_10, CONTENT_ADMIN_DATE_LAN_11);
 
 if(isset($_POST['addpreset'])){
diff -x .svn -aruN 0.7.16.src/e107_plugins/content/languages/English/lan_content.php 0.7.17.src/e107_plugins/content/languages/English/lan_content.php
--- 0.7.16.src/e107_plugins/content/languages/English/lan_content.php	2008-07-25 16:03:11.000000000 -0500
+++ 0.7.17.src/e107_plugins/content/languages/English/lan_content.php	2009-09-18 17:25:12.000000000 -0500
@@ -4,9 +4,9 @@
 |     e107 website system - Language File.
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/content/languages/English/lan_content.php,v $
-|     $Revision: 1.76 $
-|     $Date: 2008/07/25 21:03:34 $
-|     $Author: e107steved $
+|     $Revision: 1.77 $
+|     $Date: 2009/09/18 22:25:36 $
+|     $Author: secretr $
 +----------------------------------------------------------------------------+
 */
 
@@ -197,7 +197,7 @@
 define("CONTENT_MENU_LAN_2", "recent items");
 define("CONTENT_MENU_LAN_3", "categories");
 define("CONTENT_MENU_LAN_4", "content links");
-define("CONTENT_MENU_LAN_5", "");
+define("CONTENT_MENU_LAN_5", "no items in");
 define("CONTENT_MENU_LAN_6", "");
 define("CONTENT_MENU_LAN_7", "");
 define("CONTENT_MENU_LAN_8", "");
diff -x .svn -aruN 0.7.16.src/e107_plugins/forum/e_search.php 0.7.17.src/e107_plugins/forum/e_search.php
--- 0.7.16.src/e107_plugins/forum/e_search.php	2006-02-18 12:47:12.000000000 -0600
+++ 0.7.17.src/e107_plugins/forum/e_search.php	2009-11-19 05:45:24.000000000 -0600
@@ -1,11 +1,9 @@
 <?php
-if (!defined('e107_INIT')) { exit; }
+/* $Id: e_search.php,v 1.7 2009/11/19 11:45:48 marj_nl_fr Exp $ */
+if (!defined('e107_INIT')) { exit(); }
+
+include_lan(e_PLUGIN."forum/languages/".e_LANGUAGE."/lan_forum_search.php");
 
-if (file_exists(e_PLUGIN."forum/languages/".e_LANGUAGE."/lan_forum_search.php")) {
-	include_once(e_PLUGIN."forum/languages/".e_LANGUAGE."/lan_forum_search.php");
-} else {
-	include_once(e_PLUGIN."forum/languages/English/lan_forum_search.php");
-}
 $search_info[] = array(
 	'sfile' => e_PLUGIN.'forum/search/search_parser.php', 
 	'qtype' => FOR_SCH_LAN_1, 
diff -x .svn -aruN 0.7.16.src/e107_plugins/forum/forum_class.php 0.7.17.src/e107_plugins/forum/forum_class.php
--- 0.7.16.src/e107_plugins/forum/forum_class.php	2009-08-16 10:52:36.000000000 -0500
+++ 0.7.17.src/e107_plugins/forum/forum_class.php	2009-12-20 16:07:51.000000000 -0600
@@ -11,8 +11,8 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/forum/forum_class.php,v $
-|     $Revision: 1.73 $
-|     $Date: 2009/08/16 15:53:00 $
+|     $Revision: 1.76 $
+|     $Date: 2009/12/20 22:08:15 $
 |     $Author: e107steved $	   ** Amended by Marj to re-order list line 818 - 851
 +----------------------------------------------------------------------------+
 */
@@ -701,7 +701,7 @@
 			return -1;
 		}
 
-		$post_user = $thread_poster['post_userid'].".".$thread_poster['post_user_name'];
+		$post_user = $thread_poster['post_userid'].".".$tp->toDB($thread_poster['post_user_name']);
 		$thread_post_user = $post_user;
 		if($thread_poster['post_userid'] == 0)
 		{
@@ -739,6 +739,7 @@
 			$parent_thread = $this->thread_get_postinfo($thread_parent);
 			global $PLUGINS_DIRECTORY;
 			$thread_name = $tp->toText($parent_thread[0]['thread_name']);
+			$thread_name = str_replace('&quot;', '"', $thread_name);		// This not picked up by toText();
 			$datestamp = $gen->convert_date($post_time, "long");
 			$email_post = $tp->toHTML($thread_thread, TRUE);
 			$mail_link = "<a href='".SITEURL.$PLUGINS_DIRECTORY."forum/forum_viewtopic.php?".$thread_parent.".last'>".SITEURL.$PLUGINS_DIRECTORY."forum/forum_viewtopic.php?".$thread_parent.".last</a>";
@@ -1055,7 +1056,7 @@
 
 		if(file_exists(THEME.'forum/'.$filename) || is_readable(THEME.'forum/'.e_LANGUAGE."_".$filename))
 		{
-			$image = ($ML && is_readable(THEME.'forum/'.e_LANGUAGE."_".$filename)) ? THEME.'forum/'.e_LANGUAGE."_".$filename :  THEME.'forum/'.$filename;
+			$image = ($ML && is_readable(THEME.'forum/'.e_LANGUAGE."_".$filename)) ? THEME_ABS.'forum/'.e_LANGUAGE."_".$filename :  THEME_ABS.'forum/'.$filename;
 		}
 		else
 		{
@@ -1063,22 +1064,22 @@
 			{
 				if($ML)
 				{
-                	$image = (is_readable(e_PLUGIN."forum/images/".IMODE."/".e_LANGUAGE."_".$filename)) ? e_PLUGIN."forum/images/".IMODE."/".e_LANGUAGE."_".$filename : e_PLUGIN."forum/images/".IMODE."/English_".$filename;
+                	$image = (is_readable(e_PLUGIN."forum/images/".IMODE."/".e_LANGUAGE."_".$filename)) ? e_PLUGIN_ABS."forum/images/".IMODE."/".e_LANGUAGE."_".$filename : e_PLUGIN_ABS."forum/images/".IMODE."/English_".$filename;
 				}
 				else
 				{
-                	$image = e_PLUGIN."forum/images/".IMODE."/".$filename;
+                	$image = e_PLUGIN_ABS."forum/images/".IMODE."/".$filename;
 				}
 			}
 			else
 			{
 				if($ML)
 				{
-					$image = (is_readable(e_PLUGIN."forum/images/lite/".e_LANGUAGE."_".$filename)) ? e_PLUGIN."forum/images/lite/".e_LANGUAGE."_".$filename : e_PLUGIN."forum/images/lite/English_".$filename;
+					$image = (is_readable(e_PLUGIN."forum/images/lite/".e_LANGUAGE."_".$filename)) ? e_PLUGIN_ABS."forum/images/lite/".e_LANGUAGE."_".$filename : e_PLUGIN_ABS."forum/images/lite/English_".$filename;
 				}
 				else
                 {
-           			$image = e_PLUGIN."forum/images/lite/".$filename;
+           			$image = e_PLUGIN_ABS."forum/images/lite/".$filename;
 				}
 
 			}
diff -x .svn -aruN 0.7.16.src/e107_plugins/forum/forum_post.php 0.7.17.src/e107_plugins/forum/forum_post.php
--- 0.7.16.src/e107_plugins/forum/forum_post.php	2009-05-26 15:08:31.000000000 -0500
+++ 0.7.17.src/e107_plugins/forum/forum_post.php	2009-11-19 14:28:37.000000000 -0600
@@ -3,7 +3,7 @@
 + ----------------------------------------------------------------------------+
 |     e107 website system
 |
-|     Steve Dunstan 2001-2002
+|     (C)Steve Dunstan 2001-2002
 |     http://e107.org
 |     jalist@e107.org
 |
@@ -11,16 +11,15 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/forum/forum_post.php,v $
-|     $Revision: 1.88 $
-|     $Date: 2009/05/26 20:08:55 $
+|     $Revision: 1.90 $
+|     $Date: 2009/11/19 20:29:01 $
 |     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 
 require_once("../../class2.php");
 $e_wysiwyg = "post";
-$lan_file = e_PLUGIN.'forum/languages/'.e_LANGUAGE.'/lan_forum_post.php';
-include(file_exists($lan_file) ? $lan_file : e_PLUGIN.'forum/languages/English/lan_forum_post.php');
+include_lan(e_PLUGIN.'forum/languages/'.e_LANGUAGE.'/lan_forum_post.php');
 
 if (IsSet($_POST['fjsubmit'])) {
 	header("location:".e_BASE.$PLUGINS_DIRECTORY."forum/forum_viewforum.php?".$_POST['forumjump']);
@@ -295,6 +294,7 @@
 			$poll -> submit_poll(2);
 		}
 
+		$e107cache->clear("newforumposts");
 		if ($pref['forum_redirect'])
 		{
 			redirect(e_PLUGIN."forum/forum_viewtopic.php?{$iid}.last");
@@ -315,7 +315,6 @@
 			}
 
 			echo (isset($_POST['newthread']) ? $FORUMTHREADPOSTED : $FORUMREPLYPOSTED);
-			$e107cache->clear("newforumposts");
 			require_once(FOOTERF);
 			exit;
 		}
diff -x .svn -aruN 0.7.16.src/e107_plugins/forum/forum_update_check.php 0.7.17.src/e107_plugins/forum/forum_update_check.php
--- 0.7.16.src/e107_plugins/forum/forum_update_check.php	2005-12-14 13:28:22.000000000 -0600
+++ 0.7.17.src/e107_plugins/forum/forum_update_check.php	2009-12-15 16:20:49.000000000 -0600
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/forum/forum_update_check.php,v $
-|     $Revision: 1.8 $
-|     $Date: 2005/12/14 19:28:44 $
-|     $Author: sweetas $
+|     $Revision: 1.9 $
+|     $Date: 2009/12/15 22:21:13 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 if (!defined('e107_INIT')) { exit; }
@@ -40,6 +40,14 @@
 				return FALSE;
 			}
 		}
+
+
+		// Looking for:
+		//	forum_lastpost_info in table 'forum' - update if absent
+		//	thread_anon in table forum_t - update if absent
+		//	forum_sub in table 'forum' - update if present
+		// Bug in PHP5.3 using mysql_num_fields() with mysql_list_fields() - hence code replaced
+		/*
 		$fields = mysql_list_fields($mySQLdefaultdb, MPREFIX."forum");
 		if(!$fields)
 		{
@@ -48,7 +56,7 @@
 		$columns = mysql_num_fields($fields);
 		for ($i = 0; $i < $columns; $i++)
 		{
-			if ("forum_lastpost_info" == mysql_field_name($fields, $i))
+			if ("forum_lastpost_info" == mysql_field_name($fields, $i))	
 			{
 				$flist = mysql_list_fields($mySQLdefaultdb, MPREFIX."forum_t");
 				$cols = mysql_num_fields($flist);
@@ -65,6 +73,15 @@
 				return TRUE; //not needed
 			}
 		}
+		*/
+
+		if ($sql->db_Field('forum', 'forum_lastpost_info'))
+		{
+			if (!$sql->db_Field('forum_t', 'thread_anon'))
+			{
+				if ($sql->db_Field('forum', 'forum_sub')) return TRUE;		// Return if no update needed
+			}
+		}
 		return FALSE; //needed
 	}
 }
diff -x .svn -aruN 0.7.16.src/e107_plugins/forum/forum_update.php 0.7.17.src/e107_plugins/forum/forum_update.php
--- 0.7.16.src/e107_plugins/forum/forum_update.php	2006-01-09 03:54:51.000000000 -0600
+++ 0.7.17.src/e107_plugins/forum/forum_update.php	2009-12-15 16:20:49.000000000 -0600
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/forum/forum_update.php,v $
-|     $Revision: 1.15 $
-|     $Date: 2006/01/09 09:55:14 $
-|     $Author: sweetas $
+|     $Revision: 1.16 $
+|     $Date: 2009/12/15 22:21:13 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 if (!defined('e107_INIT')) { exit; }
@@ -34,8 +34,9 @@
 
 
 $forum_subs = FALSE;
+/*
 $fields = mysql_list_fields($mySQLdefaultdb, MPREFIX."forum");
-$columns = mysql_num_fields($fields);
+$columns = mysql_num_fields($fields);		// Bug in PHP5.3 using mysql_num_fields() with mysql_list_fields()
 for ($i = 0; $i < $columns; $i++)
 {
 	if("forum_sub" == mysql_field_name($fields, $i))
@@ -43,6 +44,13 @@
 		$forum_subs = TRUE;
 	}
 }
+*/
+
+if ($sql->db_Field('forum', 'forum_sub'))
+{
+	$forum_subs = TRUE;
+}
+
 
 $text = "";
 if(!$forum_subs)
diff -x .svn -aruN 0.7.16.src/e107_plugins/forum/forum_uploads.php 0.7.17.src/e107_plugins/forum/forum_uploads.php
--- 0.7.16.src/e107_plugins/forum/forum_uploads.php	2007-01-17 14:47:01.000000000 -0600
+++ 0.7.17.src/e107_plugins/forum/forum_uploads.php	2009-11-19 05:45:25.000000000 -0600
@@ -3,7 +3,7 @@
 + ----------------------------------------------------------------------------+
 |     e107 website system
 |
-|     Steve Dunstan 2001-2002
+|     (C)Steve Dunstan 2001-2002
 |     http://e107.org
 |     jalist@e107.org
 |
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/forum/forum_uploads.php,v $
-|     $Revision: 1.4 $
-|     $Date: 2007/01/17 20:47:24 $
-|     $Author: e107steved $
+|     $Revision: 1.5 $
+|     $Date: 2009/11/19 11:45:49 $
+|     $Author: marj_nl_fr $
 +----------------------------------------------------------------------------+
 */
 require_once("../../class2.php");
@@ -23,8 +23,7 @@
 	header("location:".e_BASE.$PLUGINS_DIRECTORY."forum/forum.php");
 	exit;
 }
-$lan_file = e_PLUGIN.'forum/languages/'.e_LANGUAGE.'/lan_forum_uploads.php';
-include_once(file_exists($lan_file) ? $lan_file : e_PLUGIN.'forum/languages/English/lan_forum_uploads.php');
+include_lan(e_PLUGIN.'forum/languages/'.e_LANGUAGE.'/lan_forum_uploads.php');
 
 if(is_array($_POST['delete']))
 {
diff -x .svn -aruN 0.7.16.src/e107_plugins/forum/forum_viewforum.php 0.7.17.src/e107_plugins/forum/forum_viewforum.php
--- 0.7.16.src/e107_plugins/forum/forum_viewforum.php	2007-09-26 14:35:30.000000000 -0500
+++ 0.7.17.src/e107_plugins/forum/forum_viewforum.php	2010-01-20 21:57:20.000000000 -0600
@@ -3,7 +3,7 @@
 + ----------------------------------------------------------------------------+
 |     e107 website system
 |
-|     Steve Dunstan 2001-2002
+|     (C)Steve Dunstan 2001-2002
 |     http://e107.org
 |     jalist@e107.org
 |
@@ -11,21 +11,20 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/forum/forum_viewforum.php,v $
-|     $Revision: 1.66 $
-|     $Date: 2007/09/26 19:35:53 $
-|     $Author: e107steved $
+|     $Revision: 1.68 $
+|     $Date: 2010/01/21 03:57:44 $
+|     $Author: mcfly_e107 $
 +----------------------------------------------------------------------------+
 */
 
 require_once("../../class2.php");
-$lan_file = e_PLUGIN.'forum/languages/'.e_LANGUAGE.'/lan_forum_viewforum.php';
-include_once(file_exists($lan_file) ? $lan_file : e_PLUGIN.'forum/languages/English/lan_forum_viewforum.php');
-
 if (isset($_POST['fjsubmit'])) {
 	header("location:".e_PLUGIN."forum/forum_viewforum.php?".$_POST['forumjump']);
-	exit;
+	exit();
 }
 
+include_lan(e_PLUGIN.'forum/languages/'.e_LANGUAGE.'/lan_forum_viewforum.php');
+
 if (!e_QUERY)
 {
 	js_location(e_PLUGIN."forum/forum.php");
@@ -274,8 +273,11 @@
 	$forum_view_forum = "";
 }
 
-$forum_view_start = preg_replace("/\{(.*?)\}/e", '$\1', $FORUM_VIEW_START);
-$forum_view_end = preg_replace("/\{(.*?)\}/e", '$\1', $FORUM_VIEW_END);
+//$forum_view_start = preg_replace("/\{(.*?)\}/e", '$\1', $FORUM_VIEW_START);
+$forum_view_start = $tp->simpleParse($FORUM_VIEW_START);
+
+//$forum_view_end = preg_replace("/\{(.*?)\}/e", '$\1', $FORUM_VIEW_END);
+$forum_view_end = $tp->simpleParse($FORUM_VIEW_END);
 
 
 if ($pref['forum_enclose'])
@@ -338,7 +340,7 @@
 
 	$THREADDATE = $gen->convert_date($thread_info['thread_datestamp'], 'forum');
 	$ICON = ($newflag ? IMAGE_new : IMAGE_nonew);
-	if ($REPLIES >= $pref['forum_popular']) 
+	if ($REPLIES >= $pref['forum_popular'])
 	{
 	  $ICON = ($newflag ? IMAGE_new_popular : IMAGE_nonew_popular);
 	}
@@ -460,7 +462,7 @@
 
 	if (!$REPLIES)
 	{
-		$REPLIES = LAN_317;		// 'None' 
+		$REPLIES = LAN_317;		// 'None'
 		$LASTPOST = " - ";
 	}
 
diff -x .svn -aruN 0.7.16.src/e107_plugins/forum/forum_viewtopic.php 0.7.17.src/e107_plugins/forum/forum_viewtopic.php
--- 0.7.16.src/e107_plugins/forum/forum_viewtopic.php	2006-11-19 16:41:32.000000000 -0600
+++ 0.7.17.src/e107_plugins/forum/forum_viewtopic.php	2009-11-19 09:26:25.000000000 -0600
@@ -11,16 +11,15 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/forum/forum_viewtopic.php,v $
-|     $Revision: 1.72 $
-|     $Date: 2006/11/19 22:41:55 $
-|     $Author: mcfly_e107 $
+|     $Revision: 1.73 $
+|     $Date: 2009/11/19 15:26:49 $
+|     $Author: marj_nl_fr $
 +----------------------------------------------------------------------------+
 */
 
 require_once('../../class2.php');
 
-include_once e_PLUGIN.'forum/languages/'.e_LANGUAGE.'/lan_forum_viewtopic.php';
-include_once e_PLUGIN.'forum/languages/English/lan_forum_viewtopic.php';
+include_lan(e_PLUGIN.'forum/languages/'.e_LANGUAGE.'/lan_forum_viewtopic.php');
 include_once(e_PLUGIN.'forum/forum_class.php');
 
 
diff -x .svn -aruN 0.7.16.src/e107_plugins/forum/newforumposts_menu_config.php 0.7.17.src/e107_plugins/forum/newforumposts_menu_config.php
--- 0.7.16.src/e107_plugins/forum/newforumposts_menu_config.php	2007-05-27 14:24:37.000000000 -0500
+++ 0.7.17.src/e107_plugins/forum/newforumposts_menu_config.php	2009-11-19 05:45:25.000000000 -0600
@@ -3,7 +3,7 @@
 + ----------------------------------------------------------------------------+
 |     e107 website system
 |
-|     Steve Dunstan 2001-2002
+|     (C)Steve Dunstan 2001-2002
 |     http://e107.org
 |     jalist@e107.org
 |
@@ -11,21 +11,20 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/forum/newforumposts_menu_config.php,v $
-|     $Revision: 1.2 $
-|     $Date: 2007/05/27 19:25:00 $
-|     $Author: e107steved $
+|     $Revision: 1.3 $
+|     $Date: 2009/11/19 11:45:49 $
+|     $Author: marj_nl_fr $
 +----------------------------------------------------------------------------+
 */
 $eplug_admin = TRUE;
 require_once("../../class2.php");
 if (!getperms("1")) {
 	header("location:".e_BASE."index.php");
-	 exit ;
+	 exit();
 }
 require_once(e_ADMIN."auth.php");
 	
-$lan_file = e_PLUGIN."forum/languages/".e_LANGUAGE."/lan_newforumposts_menu.php";
-require_once(file_exists($lan_file) ? $lan_file : e_PLUGIN."forum/languages/English/lan_newforumposts_menu.php");
+include_lan(e_PLUGIN."forum/languages/".e_LANGUAGE."/lan_newforumposts_menu.php");
 	
 if (isset($_POST['update_menu'])) {
 	while (list($key, $value) = each($_POST)) {
diff -x .svn -aruN 0.7.16.src/e107_plugins/forum/newforumposts_menu.php 0.7.17.src/e107_plugins/forum/newforumposts_menu.php
--- 0.7.16.src/e107_plugins/forum/newforumposts_menu.php	2009-08-23 05:39:28.000000000 -0500
+++ 0.7.17.src/e107_plugins/forum/newforumposts_menu.php	2009-11-19 05:45:25.000000000 -0600
@@ -3,7 +3,7 @@
 + ----------------------------------------------------------------------------+
 |     e107 website system
 |
-|     Steve Dunstan 2001-2002
+|     ©Steve Dunstan 2001-2002
 |     http://e107.org
 |     jalist@e107.org
 |
@@ -11,8 +11,8 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/forum/newforumposts_menu.php,v $
-|     $Revision: 1.23 $
-|     $Date: 2009/08/23 10:39:52 $
+|     $Revision: 1.24 $
+|     $Date: 2009/11/19 11:45:49 $
 |     $Author: marj_nl_fr $
 +----------------------------------------------------------------------------+
 */
@@ -21,14 +21,7 @@
 global $tp;
 $gen = new convert;
 
-if (file_exists(e_PLUGIN."forum/languages/".e_LANGUAGE."/lan_newforumposts_menu.php"))
-{
-	include_once(e_PLUGIN."forum/languages/".e_LANGUAGE."/lan_newforumposts_menu.php");
-}
-else
-{
-	include_once(e_PLUGIN."forum/languages/English/lan_newforumposts_menu.php");
-}
+include_lan(e_PLUGIN."forum/languages/".e_LANGUAGE."/lan_newforumposts_menu.php");
 
 $max_age = varset($menu_pref['newforumposts_maxage'],0);
 $max_age = $max_age == 0 ? '' : "(t.thread_datestamp > ".intval(time()-$max_age*86400).") AND ";
diff -x .svn -aruN 0.7.16.src/e107_plugins/lastseen/lastseen_menu.php 0.7.17.src/e107_plugins/lastseen/lastseen_menu.php
--- 0.7.16.src/e107_plugins/lastseen/lastseen_menu.php	2005-12-14 13:28:22.000000000 -0600
+++ 0.7.17.src/e107_plugins/lastseen/lastseen_menu.php	2009-11-19 05:45:26.000000000 -0600
@@ -3,7 +3,7 @@
 + ----------------------------------------------------------------------------+
 |     e107 website system
 |
-|     Steve Dunstan 2001-2002
+|     (C)Steve Dunstan 2001-2002
 |     http://e107.org
 |     jalist@e107.org
 |
@@ -11,22 +11,15 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/lastseen/lastseen_menu.php,v $
-|     $Revision: 1.7 $
-|     $Date: 2005/12/14 19:28:44 $
-|     $Author: sweetas $
+|     $Revision: 1.8 $
+|     $Date: 2009/11/19 11:45:50 $
+|     $Author: marj_nl_fr $
 +----------------------------------------------------------------------------+
 */
 
-if (!defined('e107_INIT')) { exit; }
+if (!defined('e107_INIT')) { exit(); }
 
-if (file_exists(e_PLUGIN."lastseen/languages/".e_LANGUAGE.".php"))
-{
-	include_once(e_PLUGIN."lastseen/languages/".e_LANGUAGE.".php");
-}
-else
-{
-	include_once(e_PLUGIN."lastseen/languages/English.php");
-}
+include_lan(e_PLUGIN."lastseen/languages/".e_LANGUAGE.".php");
 
 $sql -> db_Select("user", "user_id, user_name, user_currentvisit", "ORDER BY user_currentvisit DESC LIMIT 0,10", "nowhere");
 $userArray = $sql -> db_getList();
diff -x .svn -aruN 0.7.16.src/e107_plugins/links_page/admin_linkspage_config.php 0.7.17.src/e107_plugins/links_page/admin_linkspage_config.php
--- 0.7.16.src/e107_plugins/links_page/admin_linkspage_config.php	2006-11-01 12:48:23.000000000 -0600
+++ 0.7.17.src/e107_plugins/links_page/admin_linkspage_config.php	2009-11-19 09:51:58.000000000 -0600
@@ -3,7 +3,7 @@
 + ----------------------------------------------------------------------------+
 |    e107 website system
 |
-|    Steve Dunstan 2001-2002
+|    (C)Steve Dunstan 2001-2002
 |    http://e107.org
 |    jalist@e107.org
 |
@@ -11,9 +11,9 @@
 |    GNU    General Public  License (http://gnu.org).
 |
 |    $Source: /cvsroot/e107/e107_0.7/e107_plugins/links_page/admin_linkspage_config.php,v $
-|    $Revision: 1.8 $
-|    $Date: 2006/11/01 18:48:46 $
-|    $Author: lisa_ $
+|    $Revision: 1.10 $
+|    $Date: 2009/11/19 15:52:22 $
+|    $Author: marj_nl_fr $
 +----------------------------------------------------------------------------+
 */
 
@@ -34,8 +34,7 @@
 require_once(e_PLUGIN.'links_page/link_class.php');
 $lc = new linkclass;
 
-$lan_file = $plugindir."languages/".e_LANGUAGE.".php";
-include_once(file_exists($lan_file) ? $lan_file : $plugindir."languages/English.php");
+include_lan(e_PLUGIN.'links_page/languages/'.e_LANGUAGE.'.php');
 
 $linkspage_pref = $lc -> getLinksPagePref();
 
diff -x .svn -aruN 0.7.16.src/e107_plugins/links_page/e_frontpage.php 0.7.17.src/e107_plugins/links_page/e_frontpage.php
--- 0.7.16.src/e107_plugins/links_page/e_frontpage.php	2005-12-14 13:28:22.000000000 -0600
+++ 0.7.17.src/e107_plugins/links_page/e_frontpage.php	2009-11-19 05:45:25.000000000 -0600
@@ -3,7 +3,7 @@
 + ----------------------------------------------------------------------------+
 |     e107 website system
 |
-|     Steve Dunstan 2001-2002
+|     (C)Steve Dunstan 2001-2002
 |     http://e107.org
 |     jalist@e107.org
 |
@@ -11,19 +11,16 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/links_page/e_frontpage.php,v $
-|     $Revision: 1.6 $
-|     $Date: 2005/12/14 19:28:44 $
-|     $Author: sweetas $
+|     $Revision: 1.7 $
+|     $Date: 2009/11/19 11:45:49 $
+|     $Author: marj_nl_fr $
 +----------------------------------------------------------------------------+
 */
 
-if (!defined('e107_INIT')) { exit; }
+if (!defined('e107_INIT')) { exit(); }
+
+include_lan(e_PLUGIN."links_page/languages/".e_LANGUAGE.".php");
 
-if (file_exists(e_PLUGIN."links_page/languages/".e_LANGUAGE.".php")) {
-	include_once(e_PLUGIN."links_page/languages/".e_LANGUAGE.".php");
-	} else {
-	include_once(e_PLUGIN."links_page/languages/English.php");
-}
 $front_page['links_page'] = array('page' => $PLUGINS_DIRECTORY.'links_page/links.php', 'title' => LCLAN_PLUGIN_LAN_1);
 
 ?>
\ No newline at end of file
diff -x .svn -aruN 0.7.16.src/e107_plugins/links_page/e_help.php 0.7.17.src/e107_plugins/links_page/e_help.php
--- 0.7.16.src/e107_plugins/links_page/e_help.php	2009-07-19 04:32:00.000000000 -0500
+++ 0.7.17.src/e107_plugins/links_page/e_help.php	2009-11-19 09:51:58.000000000 -0600
@@ -1,8 +1,8 @@
 <?php
+/* $Id: e_help.php,v 1.3 2009/11/19 15:52:22 marj_nl_fr Exp $ */
 if (!defined('e107_INIT')) { exit; }
 
-$lan_file = $plugindir."languages/".e_LANGUAGE.".php";
-include_once(file_exists($lan_file) ? $lan_file : $plugindir."languages/English.php");
+include_lan(e_PLUGIN.'links_page/languages/'.e_LANGUAGE.'.php');
 
 if(!e_QUERY){
 	$text = LAN_ADMIN_HELP_1;
diff -x .svn -aruN 0.7.16.src/e107_plugins/links_page/links.php 0.7.17.src/e107_plugins/links_page/links.php
--- 0.7.16.src/e107_plugins/links_page/links.php	2009-01-30 16:02:21.000000000 -0600
+++ 0.7.17.src/e107_plugins/links_page/links.php	2009-11-19 05:45:25.000000000 -0600
@@ -3,7 +3,7 @@
 + ----------------------------------------------------------------------------+
 |     e107 website system
 |
-|     Steve Dunstan 2001-2002
+|     (C)Steve Dunstan 2001-2002
 |     http://e107.org
 |     jalist@e107.org
 |
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/links_page/links.php,v $
-|     $Revision: 1.52 $
-|     $Date: 2009/01/30 22:02:45 $
-|     $Author: lisa_ $
+|     $Revision: 1.53 $
+|     $Date: 2009/11/19 11:45:49 $
+|     $Author: marj_nl_fr $
 +----------------------------------------------------------------------------+
 */
 require_once('../../class2.php');
@@ -48,11 +48,8 @@
 		$from = "0";
 	}
 }
-if (file_exists(e_PLUGIN."links_page/languages/".e_LANGUAGE.".php")) {
-	include_once(e_PLUGIN."links_page/languages/".e_LANGUAGE.".php");
-	} else {
-	include_once(e_PLUGIN."links_page/languages/English.php");
-}
+include_lan(e_PLUGIN."links_page/languages/".e_LANGUAGE.".php");
+
 $lc -> setPageTitle();
 
 //submit comment
diff -x .svn -aruN 0.7.16.src/e107_plugins/list_new/admin_list_config.php 0.7.17.src/e107_plugins/list_new/admin_list_config.php
--- 0.7.16.src/e107_plugins/list_new/admin_list_config.php	2007-03-23 15:25:49.000000000 -0500
+++ 0.7.17.src/e107_plugins/list_new/admin_list_config.php	2009-11-19 05:45:25.000000000 -0600
@@ -3,7 +3,7 @@
 +---------------------------------------------------------------+
 |       e107 website system
 |
-|       Steve Dunstan 2001-2002
+|       (C)Steve Dunstan 2001-2002
 |       http://e107.org
 |       jalist@e107.org
 |
@@ -11,9 +11,9 @@
 |       GNU General Public License (http://gnu.org).
 |
 |		$Source: /cvsroot/e107/e107_0.7/e107_plugins/list_new/admin_list_config.php,v $
-|		$Revision: 1.8 $
-|		$Date: 2007/03/23 20:26:12 $
-|		$Author: lisa_ $
+|		$Revision: 1.9 $
+|		$Date: 2009/11/19 11:45:49 $
+|		$Author: marj_nl_fr $
 +---------------------------------------------------------------+
 */
 
@@ -30,8 +30,7 @@
 $rc = new listclass;
 
 //get language file
-$lan_file = $listplugindir."languages/".e_LANGUAGE.".php";
-include(file_exists($lan_file) ? $lan_file : $listplugindir."languages/English.php");
+include_lan($listplugindir."languages/".e_LANGUAGE.".php");
 
 //get all sections to use (and reload if new e_list.php files are added)
 $rc -> getSections();
diff -x .svn -aruN 0.7.16.src/e107_plugins/list_new/list_class.php 0.7.17.src/e107_plugins/list_new/list_class.php
--- 0.7.16.src/e107_plugins/list_new/list_class.php	2009-08-23 05:39:29.000000000 -0500
+++ 0.7.17.src/e107_plugins/list_new/list_class.php	2009-11-19 05:45:25.000000000 -0600
@@ -3,7 +3,7 @@
 +---------------------------------------------------------------+
 |       e107 website system
 |
-|       Steve Dunstan 2001-2002
+|       (C)Steve Dunstan 2001-2002
 |       http://e107.org
 |       jalist@e107.org
 |
@@ -11,12 +11,12 @@
 |       GNU General Public License (http://gnu.org).
 |
 |		$Source: /cvsroot/e107/e107_0.7/e107_plugins/list_new/list_class.php,v $
-|		$Revision: 1.19 $
-|		$Date: 2009/08/23 10:39:53 $
+|		$Revision: 1.20 $
+|		$Date: 2009/11/19 11:45:49 $
 |		$Author: marj_nl_fr $
 +---------------------------------------------------------------+
 */
-if (!defined('e107_INIT')) { exit; }
+if (!defined('e107_INIT')) { exit(); }
 
 global $sql, $rc, $list_pref, $sc_style, $tp, $list_shortcodes, $defaultarray;
 
@@ -30,8 +30,7 @@
 $defaultarray = array("news", "comment", "download", "members");
 
 //get language file
-$lan_file = $listplugindir."languages/".e_LANGUAGE.".php";
-include_once(file_exists($lan_file) ? $lan_file : $listplugindir."languages/English.php");
+include_lan($listplugindir."languages/".e_LANGUAGE.".php");
 
 if (file_exists(THEME."list_template.php")) {
 	require_once(THEME."list_template.php");
diff -x .svn -aruN 0.7.16.src/e107_plugins/list_new/plugin.php 0.7.17.src/e107_plugins/list_new/plugin.php
--- 0.7.16.src/e107_plugins/list_new/plugin.php	2008-09-02 16:11:45.000000000 -0500
+++ 0.7.17.src/e107_plugins/list_new/plugin.php	2009-11-19 05:45:25.000000000 -0600
@@ -4,7 +4,7 @@
 |        e107 website system
 |        code adapted from original by Lolo Irie (lolo_irie@e107coders.org)
 |
-|        Steve Dunstan 2001-2002
+|        (C)Steve Dunstan 2001-2002
 |        http://e107.org
 |        jalist@e107.org
 |
@@ -16,8 +16,7 @@
 if (!defined('e107_INIT')) { exit; }
 
 global $PLUGINS_DIRECTORY;
-$lan_file = e_PLUGIN."list_new/languages/".e_LANGUAGE.".php";
-include_once(file_exists($lan_file) ? $lan_file : e_PLUGIN."list_new/languages/English.php");
+include_lan(e_PLUGIN."list_new/languages/".e_LANGUAGE.".php");
 
 // Plugin info -------------------------------------------------------------------------------------------------------
 $eplug_name = 'LIST_PLUGIN_1';
diff -x .svn -aruN 0.7.16.src/e107_plugins/log/e_meta.php 0.7.17.src/e107_plugins/log/e_meta.php
--- 0.7.16.src/e107_plugins/log/e_meta.php	2007-08-14 14:26:32.000000000 -0500
+++ 0.7.17.src/e107_plugins/log/e_meta.php	2009-12-19 06:14:17.000000000 -0600
@@ -6,8 +6,8 @@
 |     Released under the terms and conditions of the GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/log/e_meta.php,v $
-|     $Revision: 1.2 $
-|     $Date: 2007/08/14 19:26:55 $
+|     $Revision: 1.3 $
+|     $Date: 2009/12/19 12:14:41 $
 |     $Author: e107steved $
 +-----------------------------------------------------------------------------------------------+
 */
@@ -18,25 +18,44 @@
 	if(!$pref['statCountAdmin'] && ADMIN)
 	{
 		/* don't count admin visits */
+		return;
 	}
-	else
+	// Page to log here
+	require_once(e_PLUGIN.'log/consolidate.php');
+	$err_flag = '';
+	if (defined('ERR_PAGE_ACTIVE'))
+	{	// We've got an error - set a flag to log it
+		$err_flag = "&err_direct=".ERR_PAGE_ACTIVE;
+		if (is_numeric(e_QUERY)) $err_flag .= '/'.substr(e_QUERY,0,10);		// This should pick up the error code - and limit numeric length to upset the malicious
+		$err_flag .= "&err_referer=".$_SERVER['HTTP_REFERER'];
+	}
+	echo "<script type='text/javascript'>
+			//<![CDATA[
+function rstr2b64(input)
+{
+	var b64pad  = \"=\"; /* base-64 pad character. \"=\" for strict RFC compliance   */
+	var tab = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\";
+	var output = \"\";
+	var len = input.length;
+	for(var i = 0; i < len; i += 3)
 	{
-		require_once(e_PLUGIN."log/consolidate.php");
-		$err_flag = '';
-		if (defined("ERR_PAGE_ACTIVE"))
-		{	// We've got an error - set a flag to log it
-		  $err_flag = "&err_direct=".ERR_PAGE_ACTIVE;
-		  if (is_numeric(e_QUERY)) $err_flag .= '/'.substr(e_QUERY,0,10);		// This should pick up the error code - and limit numeric length to upset the malicious
-		  $err_flag .= "&err_referer=".$_SERVER['HTTP_REFERER'];
+		var triplet = (input.charCodeAt(i) << 16)
+                | (i + 1 < len ? input.charCodeAt(i+1) << 8 : 0)
+                | (i + 2 < len ? input.charCodeAt(i+2)      : 0);
+		for(var j = 0; j < 4; j++)
+		{
+			if(i * 8 + j * 6 > input.length * 8) output += b64pad;
+			else output += tab.charAt((triplet >>> 6*(3-j)) & 0x3F);
 		}
-		echo "<script type='text/javascript'>\n";
-		echo "<!--\n";
-		echo "document.write( '<link rel=\"stylesheet\" type=\"text/css\" href=\"".e_PLUGIN_ABS."log/log.php?referer=' + ref + '&color=' + colord + '&eself=' + eself + '&res=' + res + '{$err_flag}\">' );\n";
-		echo "// -->\n";
-		echo "</script>\n\n";
 	}
+	return output;
+}
+var logString = 'referer=' + ref + '&colour=' + colord + '&eself=' + eself + '&res=' + res + '".$err_flag."';
+logString = rstr2b64(logString);
+document.write('<link rel=\"stylesheet\" type=\"text/css\" href=\"".e_PLUGIN_ABS."log/log.php?'+logString + '\">' );
+//]]>
+</script>\n";
 }
-
 
 
 ?>
\ No newline at end of file
diff -x .svn -aruN 0.7.16.src/e107_plugins/log/loginfo.php 0.7.17.src/e107_plugins/log/loginfo.php
--- 0.7.16.src/e107_plugins/log/loginfo.php	2007-02-10 09:54:08.000000000 -0600
+++ 0.7.17.src/e107_plugins/log/loginfo.php	2010-01-09 04:12:27.000000000 -0600
@@ -11,8 +11,8 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/log/loginfo.php,v $
-|     $Revision: 1.17 $
-|     $Date: 2007/02/10 15:54:31 $
+|     $Revision: 1.18 $
+|     $Date: 2010/01/09 10:12:51 $
 |     $Author: e107steved $
 |
 | File locking added
@@ -224,6 +224,7 @@
 
 function getOs($agent) {
 	$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'),
 		"windows2003" => array('name' => 'Windows 2003', 'rule' => 'wi(n|ndows)[ \-]?(2003|nt[ /]?5\.2)'),
 		"windowsxp"   => array('name' => 'Windows XP',   'rule' => 'Windows XP'),
@@ -257,11 +258,16 @@
 		"palm"        => array('name' => 'PalmOS',       'rule' => 'Palm[ \-]?(Source|OS)[ /]?([0-9.]{1,10})'),
 		"palm2"       => array('name' => 'PalmOS',       'rule' => 'Palm[ \-]?(Source|OS)')
 	);
-	foreach($os as $key => $info) {
-		if (preg_match("#".$info['rule']."#i", $agent, $results)) {
-			if(strstr($key, "win")) {
+	foreach($os as $key => $info) 
+	{
+		if (preg_match("#".$info['rule']."#i", $agent, $results)) 
+		{
+			if(strstr($key, "win")) 
+			{
 				return ($info['name']);
-			} else {
+			} 
+			else 
+			{
 				return ($info['name']." ".$results[1]);
 			}
 		}
diff -x .svn -aruN 0.7.16.src/e107_plugins/log/log.php 0.7.17.src/e107_plugins/log/log.php
--- 0.7.16.src/e107_plugins/log/log.php	2007-11-11 06:10:40.000000000 -0600
+++ 0.7.17.src/e107_plugins/log/log.php	2009-12-19 06:14:17.000000000 -0600
@@ -13,27 +13,37 @@
 | File locking, modified getip() 18.01.07
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/log/log.php,v $
-|     $Revision: 1.27 $
-|     $Date: 2007/11/11 12:11:03 $
+|     $Revision: 1.28 $
+|     $Date: 2009/12/19 12:14:41 $
 |     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 
-// File called with:
-// e_PLUGIN_ABS."log/log.php?referer=' + ref + '&color=' + colord + '&eself=' + eself + '&res=' + res + '\">' );\n";
-// referer= ref
-// color= colord
-// eself= eself 
-// res= res
-// err_direct - optional error flag
-// err_referer - referrer if came via error page
-define("log_INIT", TRUE);
+/* File to log page accesses - called with
+	e_PLUGIN_ABS."log/log.php?base64encode(referer=' + ref + '&color=' + colord + '&eself=' + eself + '&res=' + res + '\">' );)";
+		referer= ref
+		color= colord
+		eself= eself 
+		res= res
+		err_direct - optional error flag
+		err_referer - referrer if came via error page
+*/
+define('log_INIT', TRUE);
+
+$logVals = urldecode(base64_decode($_SERVER['QUERY_STRING']));
+parse_str($logVals, $vals);
+
+
+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
 
+//$logfp = fopen('logs/rcvstring.txt', 'a+'); fwrite($logfp, print_r($vals, TRUE)."\n"); fclose($logfp);
+
+$colour = strip_tags((isset($vals['colour']) ? $vals['colour'] : ''));
+$res = strip_tags((isset($vals['res']) ? $vals['res'] : ''));
+$self = strip_tags((isset($vals['eself']) ? $vals['eself'] : ''));
+$ref = addslashes(strip_tags((isset($vals['referer']) ? $vals['referer'] : '')));
 
-$colour = strip_tags((isset($_REQUEST['color']) ? $_REQUEST['color'] : ''));
-$res = strip_tags((isset($_REQUEST['res']) ? $_REQUEST['res'] : ''));
-$self = strip_tags((isset($_REQUEST['eself']) ? $_REQUEST['eself'] : ''));
-$ref = addslashes(strip_tags((isset($_REQUEST['referer']) ? $_REQUEST['referer'] : '')));
 $date = date("z.Y", time());
 $logPfile = "logs/logp_".$date.".php";
 
@@ -41,49 +51,48 @@
 // vet resolution and colour depth some more - avoid dud values
 if ($res && preg_match("#.*?((\d+)\w+?(\d+))#", $res, $match))
 {
-  $res = $match[2].'x'.$match[3];
+	$res = $match[2].'x'.$match[3];
 }
 else
 {
-  $res = '??';			// Can't decode resolution
+	$res = '??';			// Can't decode resolution
 }
 
 if ($colour && preg_match("#.*?(\d+)#",$colour,$match))
 {
-  $colour = intval($match[1]);
+	$colour = intval($match[1]);
 }
 else
 {
-  $colour='??';
+	$colour='??';
 }
 
 
-if ($err_code = strip_tags((isset($_REQUEST['err_direct']) ? $_REQUEST['err_direct'] : '')))
+if ($err_code = strip_tags((isset($vals['err_direct']) ? $vals['err_direct'] : '')))
 {
-  $ref = addslashes(strip_tags(isset($_REQUEST['err_referer']) ? $_REQUEST['err_referer'] : ''));
-  $log_string = $err_code.",".$self.",".$ref;
+	$ref = addslashes(strip_tags(isset($vals['err_referer']) ? $vals['err_referer'] : ''));
 // Uncomment the next two lines to create a separate CSV format log of invalid accesses - error code, entered URL, referrer
-//  $logname = "logs/errpages.csv";
-//  $logfp = fopen($logname, 'a+'); fwrite($logfp, $log_string."\n\r"); fclose($logfp);
-  $err_code .= ':';
+//	$log_string = $err_code.",".$self.",".$ref;
+//  $logfp = fopen("logs/errpages.csv", 'a+'); fwrite($logfp, $log_string."\n\r"); fclose($logfp);
+	$err_code .= ':';
 }
 
-if(strstr($ref, "admin")) 
+if(strstr($ref, 'admin')) 
 {
 	$ref = FALSE;
 }
 
-$screenstats = $res."@".$colour;
+$screenstats = $res.'@'.$colour;
 $agent = $_SERVER['HTTP_USER_AGENT'];
 $ip = getip();
 
 $oldref = $ref; // backup for search string being stripped off for referer
 if($ref && !strstr($ref, $_SERVER['HTTP_HOST'])) 
 {
-  if(preg_match("#http://(.*?)($|/)#is", $ref, $match)) 
-  {
-	$ref = $match[0];
-  }
+	if(preg_match("#http://(.*?)($|/)#is", $ref, $match)) 
+	{
+		$ref = $match[0];
+	}
 }
 
 $pageDisallow = "cache|file|eself|admin";
@@ -97,51 +106,52 @@
 $pageName = preg_replace("/".$tagRemove."/si", "", $pageName);
 if($pageName == "") $pageName = "index";
 
-$pageName = $err_code.$pageName;			// Add the error code at the beginning, so its treated uniquely
-
 if(preg_match("/".$pageDisallow."/i", $pageName)) return;
 
 
+$pageName = $err_code.$pageName;			// Add the error code at the beginning, so its treated uniquely
+//$logfp = fopen('logs/rcvstring.txt', 'a+'); fwrite($logfp, $pageName."\n"); fclose($logfp);
+
 $p_handle = fopen($logPfile, 'r+');
 if($p_handle && flock( $p_handle, LOCK_EX ) ) 
 {
-  $log_file_contents = '';
-  while (!feof($p_handle))
-  {  // Assemble a string of data
-    $log_file_contents.= fgets($p_handle,1000);
-  }
-  $log_file_contents = str_replace(array('<'.'?php','?'.'>'),'',$log_file_contents);
-  if (eval($log_file_contents) === FALSE) echo "error in log file contents<br /><br /><br /><br />";
+	$log_file_contents = '';
+	while (!feof($p_handle))
+	{  // Assemble a string of data
+		$log_file_contents.= fgets($p_handle,1000);
+	}
+	$log_file_contents = str_replace(array('<'.'?php','?'.'>'),'',$log_file_contents);
+	if (eval($log_file_contents) === FALSE) echo "error in log file contents<br /><br /><br /><br />";
 }
 else
 {
-  echo "Couldn't log data<br /><br /><br /><br />";
-  exit;
+	echo "Couldn't log data<br /><br /><br /><br />";
+	exit;
 }
 
 
 $flag = FALSE;
 if(array_key_exists($pageName, $pageInfo)) 
 {  // Existing page - just increment stats
-  $pageInfo[$pageName]['ttl'] ++;
+	$pageInfo[$pageName]['ttl'] ++;
 }
 else 
 {  // First access of page
-  $url = preg_replace("/".$tagRemove2."/si", "", $self);
-  if(preg_match("/".$pageDisallow."/i", $url)) return;
-  $pageInfo[$pageName] = array('url' => $url, 'ttl' => 1, 'unq' => 1);
-  $flag = TRUE;
+	$url = preg_replace("/".$tagRemove2."/si", "", $self);
+	if(preg_match("/".$pageDisallow."/i", $url)) return;
+	$pageInfo[$pageName] = array('url' => $url, 'ttl' => 1, 'unq' => 1);
+	$flag = TRUE;
 }
 
 if(!strstr($ipAddresses, $ip)) 
 {	/* unique visit */
-  if(!$flag) 
-  {
-	$pageInfo[$pageName]['unq'] ++;
-  }
-  $siteUnique ++;
-  $ipAddresses .= $ip.".";		// IP address is stored as hex string
-  require_once("loginfo.php");
+	if(!$flag) 
+	{
+		$pageInfo[$pageName]['unq'] ++;
+	}
+	$siteUnique ++;
+	$ipAddresses .= $ip.".";		// IP address is stored as hex string
+	require_once("loginfo.php");
 }
 
 $siteTotal ++;
@@ -169,42 +179,31 @@
 }
 
 
-
-function getip($mode=TRUE) 
+// Get current IP address - return as a hex-encoded string
+function getip() 
 {
-  if (getenv('HTTP_X_FORWARDED_FOR')) 
-  {
 	$ip = $_SERVER['REMOTE_ADDR'];
-	if (preg_match("#^(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})#", 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]);
+	if (getenv('HTTP_X_FORWARDED_FOR')) 
+	{
+		if (preg_match("#^(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})#", 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]);
+		}
+	}
+	if ($ip == "") 
+	{
+		$ip = "x.x.x.x";
 	}
-  }
-  else 
-  {
-	$ip = $_SERVER['REMOTE_ADDR'];
-  }
-  if ($ip == "") 
-  {
-	$ip = "x.x.x.x";
-  }
-  if($mode) 
-  {
 	$ipa = explode(".", $ip);
 	return sprintf('%02x%02x%02x%02x', $ipa[0], $ipa[1], $ipa[2], $ipa[3]);
-  }
-  else 
-  {
-	return $ip;
-  }
 }
 
 ?>
\ No newline at end of file
diff -x .svn -aruN 0.7.16.src/e107_plugins/log/stats.php 0.7.17.src/e107_plugins/log/stats.php
--- 0.7.16.src/e107_plugins/log/stats.php	2009-08-15 06:54:08.000000000 -0500
+++ 0.7.17.src/e107_plugins/log/stats.php	2009-10-28 09:23:16.000000000 -0500
@@ -3,7 +3,7 @@
 + ----------------------------------------------------------------------------+
 |     e107 website system
 |
-|     �Steve Dunstan 2001-2002
+|     ©Steve Dunstan 2001-2002
 |     http://e107.org
 |     jalist@e107.org
 |
@@ -11,8 +11,8 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/log/stats.php,v $
-|     $Revision: 1.43 $
-|     $Date: 2009/08/15 11:54:32 $
+|     $Revision: 1.44 $
+|     $Date: 2009/10/28 14:23:40 $
 |     $Author: marj_nl_fr $
 +----------------------------------------------------------------------------+
 */
diff -x .svn -aruN 0.7.16.src/e107_plugins/login_menu/login_menu_shortcodes.php 0.7.17.src/e107_plugins/login_menu/login_menu_shortcodes.php
--- 0.7.16.src/e107_plugins/login_menu/login_menu_shortcodes.php	2009-08-23 05:39:27.000000000 -0500
+++ 0.7.17.src/e107_plugins/login_menu/login_menu_shortcodes.php	2009-10-28 09:06:34.000000000 -0500
@@ -3,7 +3,7 @@
 + ----------------------------------------------------------------------------+
 |     e107 website system
 |
-|     Steve Dunstan 2001-2002
+|     ©Steve Dunstan 2001-2002
 |     http://e107.org
 |     jalist@e107.org
 |
@@ -11,8 +11,8 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/login_menu/login_menu_shortcodes.php,v $
-|     $Revision: 1.13 $
-|     $Date: 2009/08/23 10:39:51 $
+|     $Revision: 1.14 $
+|     $Date: 2009/10/28 14:06:58 $
 |     $Author: marj_nl_fr $
 +----------------------------------------------------------------------------+
 */
@@ -94,9 +94,11 @@
 
 SC_BEGIN LM_MAINTENANCE
 global $pref;
-if(ADMIN == TRUE){
-	return ($pref['maintainance_flag'] == 1 ? '<div style="text-align:center"><strong>'.LOGIN_MENU_L10.'</strong></div><br />' : '' );
+if(ADMIN && varset($pref['maintainance_flag']))
+{
+	return '<div style="text-align:center"><strong>'.LOGIN_MENU_L10.'</strong></div><br />';
 }
+return '';
 SC_END
 
 SC_BEGIN LM_ADMINLINK_BULLET
diff -x .svn -aruN 0.7.16.src/e107_plugins/newforumposts_main/admin_config.php 0.7.17.src/e107_plugins/newforumposts_main/admin_config.php
--- 0.7.16.src/e107_plugins/newforumposts_main/admin_config.php	2005-01-27 13:52:47.000000000 -0600
+++ 0.7.17.src/e107_plugins/newforumposts_main/admin_config.php	2009-11-19 05:45:26.000000000 -0600
@@ -3,7 +3,7 @@
 + ----------------------------------------------------------------------------+
 |     e107 website system
 |
-|     Steve Dunstan 2001-2002
+|     (C)Steve Dunstan 2001-2002
 |     http://e107.org
 |     jalist@e107.org
 |
@@ -11,24 +11,20 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/newforumposts_main/admin_config.php,v $
-|     $Revision: 1.3 $
-|     $Date: 2005/01/27 19:53:09 $
-|     $Author: streaky $
+|     $Revision: 1.4 $
+|     $Date: 2009/11/19 11:45:50 $
+|     $Author: marj_nl_fr $
 +----------------------------------------------------------------------------+
 */
 require_once("../../class2.php");
-require_once(e_HANDLER."userclass_class.php");
-	
-$lan_file = e_PLUGIN."newforumposts_main/languages/".e_LANGUAGE.".php";
-if (file_exists($lan_file)) {
-	require_once($lan_file);
-} else {
-	require_once(e_PLUGIN."newforumposts_main/languages/English.php");
-}
+
 if (!getperms("1")) {
 	header("location:".e_BASE."index.php");
 	 exit ;
 }
+require_once(e_HANDLER."userclass_class.php");
+	
+include_lan(e_PLUGIN."newforumposts_main/languages/".e_LANGUAGE.".php");
 require_once(e_ADMIN."auth.php");
 	
 if (isset($_POST['updatesettings'])) {
diff -x .svn -aruN 0.7.16.src/e107_plugins/newforumposts_main/newforumposts_main.php 0.7.17.src/e107_plugins/newforumposts_main/newforumposts_main.php
--- 0.7.16.src/e107_plugins/newforumposts_main/newforumposts_main.php	2008-07-28 15:15:34.000000000 -0500
+++ 0.7.17.src/e107_plugins/newforumposts_main/newforumposts_main.php	2009-11-19 05:45:26.000000000 -0600
@@ -3,7 +3,7 @@
 + ----------------------------------------------------------------------------+
 |     e107 website system
 |
-|     Steve Dunstan 2001-2002
+|     (C)Steve Dunstan 2001-2002
 |     http://e107.org
 |     jalist@e107.org
 |
@@ -11,18 +11,18 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/newforumposts_main/newforumposts_main.php,v $
-|     $Revision: 1.27 $
-|     $Date: 2008/07/28 20:15:57 $
-|     $Author: e107steved $
+|     $Revision: 1.28 $
+|     $Date: 2009/11/19 11:45:50 $
+|     $Author: marj_nl_fr $
 +----------------------------------------------------------------------------+
 */
 if (!defined('e107_INIT')) { exit; }
 
 require_once(e_HANDLER."userclass_class.php");
 $query = ($pref['nfp_posts'] ? "thread_lastpost" : "thread_datestamp");
-$lan_file = e_PLUGIN."newforumposts_main/languages/".e_LANGUAGE.".php";
+include_lan(e_PLUGIN."newforumposts_main/languages/".e_LANGUAGE.".php");
+
 $path = e_PLUGIN."forum/";
-include_once((file_exists($lan_file) ? $lan_file : e_PLUGIN."newforumposts_main/languages/English.php"));
 global $sql, $ns;
 // get template ...
 
diff -x .svn -aruN 0.7.16.src/e107_plugins/pdf/e107pdf.php 0.7.17.src/e107_plugins/pdf/e107pdf.php
--- 0.7.16.src/e107_plugins/pdf/e107pdf.php	2008-08-08 16:13:18.000000000 -0500
+++ 0.7.17.src/e107_plugins/pdf/e107pdf.php	2009-10-31 10:18:24.000000000 -0500
@@ -11,8 +11,8 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/pdf/e107pdf.php,v $
-|     $Revision: 1.19 $
-|     $Date: 2008/08/08 21:13:41 $
+|     $Revision: 1.20 $
+|     $Date: 2009/10/31 15:18:48 $
 |     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
@@ -129,9 +129,12 @@
 		$pdfpref = $this->getPDFPrefs();
 
 		//define logo and source pageurl (before the parser!)
-		if(is_readable(THEME."images/logopdf.png")){
+		if(is_readable(THEME."images/logopdf.png"))
+		{
 			$logo = THEME."images/logopdf.png";
-		}else{
+		}
+		else
+		{
 			$logo = e_IMAGE."logo.png";
 		}
 		define('PDFLOGO', $logo);					//define logo to add in header
@@ -140,7 +143,8 @@
 		//parse the data
 		$text[3] = $this->toPDF($text[3]);					//replace some in the title
 		$text[3] = $this->toPDFTitle($text[3]);			//replace some in the title
-		foreach($text as $k=>$v){
+		foreach($text as $k=>$v)
+		{
 			$text[$k] = $tp->toHTML($v, TRUE);
 		}
 
@@ -149,6 +153,7 @@
 		//$this->SetAutoPageBreak(true,25);
 
 		//start creating the pdf and adding the data
+		$this->DefOrientation=(varset($text[7], 'P') == 'L' ? 'L' : 'P'); 	// Page orientation - P=portrait, L=landscape
 		$this->AliasNbPages();						//calculate current page + number of pages
 		$this->AddPage();							//start page
 		$this->SetFont($pdfpref['pdf_font_family'],'',$pdfpref['pdf_font_size']);				//set font
diff -x .svn -aruN 0.7.16.src/e107_plugins/pdf/pdf.php 0.7.17.src/e107_plugins/pdf/pdf.php
--- 0.7.16.src/e107_plugins/pdf/pdf.php	2006-01-13 04:48:40.000000000 -0600
+++ 0.7.17.src/e107_plugins/pdf/pdf.php	2009-11-19 05:45:25.000000000 -0600
@@ -3,7 +3,7 @@
 + ----------------------------------------------------------------------------+
 |     e107 website system
 |
-|     Steve Dunstan 2001-2002
+|     (C)Steve Dunstan 2001-2002
 |     http://e107.org
 |     jalist@e107.org
 |
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/pdf/pdf.php,v $
-|     $Revision: 1.8 $
-|     $Date: 2006/01/13 10:49:03 $
-|     $Author: lisa_ $
+|     $Revision: 1.9 $
+|     $Date: 2009/11/19 11:45:49 $
+|     $Author: marj_nl_fr $
 +----------------------------------------------------------------------------+
 */
 require_once("../../class2.php");
@@ -25,8 +25,7 @@
 $source = $qs[0];
 $parms = $qs[1];
 
-$lan_file = e_PLUGIN."pdf/languages/".e_LANGUAGE.".php";
-include_once(file_exists($lan_file) ? $lan_file : e_PLUGIN."pdf/languages/English.php");
+include_lan(e_PLUGIN."pdf/languages/".e_LANGUAGE.".php");
 
 define('FPDF_FONTPATH', 'font/');
 require_once(e_PLUGIN."pdf/ufpdf.php");		//require the ufpdf class
diff -x .svn -aruN 0.7.16.src/e107_plugins/pdf/plugin.php 0.7.17.src/e107_plugins/pdf/plugin.php
--- 0.7.16.src/e107_plugins/pdf/plugin.php	2006-08-25 10:37:31.000000000 -0500
+++ 0.7.17.src/e107_plugins/pdf/plugin.php	2009-11-19 05:45:25.000000000 -0600
@@ -3,7 +3,7 @@
 +---------------------------------------------------------------+
 |        e107 website system
 |
-|        Steve Dunstan 2001-2002
+|        (C)Steve Dunstan 2001-2002
 |        http://e107.org
 |        jalist@e107.org
 |
@@ -14,8 +14,7 @@
 
 if (!defined('e107_INIT')) { exit; }
 
-$lan_file = e_PLUGIN."pdf/languages/".e_LANGUAGE.".php";
-include_once(file_exists($lan_file) ? $lan_file : e_PLUGIN."pdf/languages/English.php");
+include_lan(e_PLUGIN."pdf/languages/".e_LANGUAGE.".php");
 
 // Plugin info -------------------------------------------------------------------------------------------------------
 $eplug_name = "PDF_PLUGIN_LAN_1";
diff -x .svn -aruN 0.7.16.src/e107_plugins/pm/languages/English.php 0.7.17.src/e107_plugins/pm/languages/English.php
--- 0.7.16.src/e107_plugins/pm/languages/English.php	2007-08-02 15:40:59.000000000 -0500
+++ 0.7.17.src/e107_plugins/pm/languages/English.php	2009-12-12 11:25:45.000000000 -0600
@@ -66,6 +66,13 @@
 define('LAN_PM_63', "class:");
 define('LAN_PM_64', 'ERROR: You are not permitted to block messages from site administrators');
 define('LAN_PM_65', 'ERROR: Nothing to send');
+define('LAN_PM_66', 'Blocked Senders');
+define('LAN_PM_67', 'No users blocked');
+define('LAN_PM_68', 'User Name');
+define('LAN_PM_69', 'Date blocked');
+define('LAN_PM_70', 'Deleting block on user');
+define('LAN_PM_71', '--GOOD-- attachment(s) deleted. --FAIL-- failure(s)');
+define('LAN_PM_72', 'User deleted');
 
 define("LAN_PM_100", "New PM from ");
 define("LAN_PM_101", "You have received a new Private Message from ");
diff -x .svn -aruN 0.7.16.src/e107_plugins/pm/pm_class.php 0.7.17.src/e107_plugins/pm/pm_class.php
--- 0.7.16.src/e107_plugins/pm/pm_class.php	2008-11-29 07:38:54.000000000 -0600
+++ 0.7.17.src/e107_plugins/pm/pm_class.php	2009-12-12 11:25:45.000000000 -0600
@@ -11,8 +11,8 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/pm/pm_class.php,v $
-|     $Revision: 1.22 $
-|     $Date: 2008/11/29 13:39:17 $
+|     $Revision: 1.23 $
+|     $Date: 2009/12/12 17:26:09 $
 |     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
@@ -148,40 +148,51 @@
 	function del($pmid)
 	{
 		global $sql;
-		$ret = "";
+		$pmid = (int)$pmid;
+		$ret = '';
 		$del_pm = FALSE;
-		$newvals = "";
-		if($sql->db_Select("private_msg", "*", "pm_id = ".intval($pmid)." AND (pm_from = ".USERID." OR pm_to = ".USERID.")"))
+		$newvals = '';
+		if($sql->db_Select('private_msg', '*', 'pm_id = '.$pmid.' AND (pm_from = '.USERID.' OR pm_to = '.USERID.')'))
 		{
 			$row = $sql->db_Fetch();
 			if($row['pm_to'] == USERID)
 			{
-				$newvals = "pm_read_del = 1";
-				$ret .= LAN_PM_42."<br />";
+				$newvals = 'pm_read_del = 1';
+				$ret .= LAN_PM_42.'<br />';
 				if($row['pm_sent_del'] == 1) { $del_pm = TRUE; }
 			}
 			if($row['pm_from'] == USERID)
 			{
-				if($newvals != "") { $del_pm = TRUE; }
-				$newvals = "pm_sent_del = 1";
+				if($newvals != '') { $del_pm = TRUE; }
+				$newvals = 'pm_sent_del = 1';
 				$ret .= LAN_PM_43."<br />";
 				if($row['pm_read_del'] == 1) { $del_pm = TRUE; }
 			}
 
-			if(count($newvals) == 2 || $del_pm == TRUE)
+			if($del_pm == TRUE)
 			{
 				// Delete any attachments and remove PM from db
 				$attachments = explode(chr(0), $row['pm_attachments']);
+				$aCount = array(0,0);
 				foreach($attachments as $a)
 				{
-					$filename = getcwd()."/attachments/{$a}";
-					unlink($filename);
+					$a = trim($a);
+					if ($a)
+					{
+	//					$filename = getcwd()."/attachments/{$a}";
+						$filename = e_PLUGIN.'pm/attachments/'.$a;
+						if (unlink($filename)) $aCount[0]++; else $aCount[1]++;
+					}
+				}
+				if ($aCount[0] || $aCount[1])
+				{
+					$ret .= str_replace(array('--GOOD--', '--FAIL--'), $aCount, LAN_PM_71).'<br />';
 				}
-				$sql->db_Delete("private_msg", "pm_id = ".intval($pmid));
+				$sql->db_Delete('private_msg', 'pm_id = '.$pmid);
 			}
 			else
 			{
-				$sql->db_Update("private_msg", $newvals." WHERE pm_id = ".intval($pmid));
+				$sql->db_Update('private_msg', $newvals.' WHERE pm_id = '.$pmid);
 			}
 			return $ret;
 		}
@@ -189,7 +200,7 @@
 
 	function pm_send_notify($uid, $pminfo, $pmid, $attach_count = 0)
 	{
-		require_once(e_HANDLER."mail.php");
+		require_once(e_HANDLER.'mail.php');
 		global $PLUGINS_DIRECTORY;
 		$subject = LAN_PM_100.SITENAME;
 		$pmlink = SITEURL.$PLUGINS_DIRECTORY."pm/pm.php?show.{$pmid}";
@@ -217,13 +228,20 @@
 		sendemail($pminfo['from_email'], $subject, $txt, $pminfo['from_name']);
 	}
 
+
+	/**
+	 *	Get list of users blocked from sending to a specific user ID.
+	 *	@param integer $to - user ID
+	 *	@return array of blocked users as user IDs
+	 */
 	function block_get($to = USERID)
 	{
-		global $sql, $tp;
+		global $sql;
 		$ret = array();
-		if($sql->db_Select("private_msg_block", "pm_block_from", "pm_block_to = '".$tp -> toDB($to)."'"))
+		$to = intval($to);		// Precautionary
+		if ($sql->db_Select('private_msg_block', 'pm_block_from', 'pm_block_to = '.$to))
 		{
-			while($row = $sql->db_Fetch())
+			while($row = $sql->db_Fetch(MYSQL_ASSOC))
 			{
 				$ret[] = $row['pm_block_from'];
 			}
@@ -231,6 +249,27 @@
 		return $ret;
 	}
 
+
+	/**
+	 *	Get list of users blocked from sending to a specific user ID.
+	 *	@param integer $to - user ID
+	 *	@return array of blocked users, including specific user info
+	 */
+	function block_get_user($to = USERID)
+	{
+		global $sql, $tp;
+		$ret = array();
+		$to = intval($to);		// Precautionary
+		if ($sql->db_Select_gen('SELECT pm.*, u.user_name FROM `#private_msg_block` AS pm LEFT JOIN `#user` AS u ON `pm`.`pm_block_from` = `u`.`user_id` WHERE pm_block_to = '.$to))
+		{
+			while($row = $sql->db_Fetch(MYSQL_ASSOC))
+			{
+				$ret[] = $row;
+			}
+		}
+		return $ret;
+	}
+
 	function block_add($from, $to = USERID)
 	{
 		global $sql, $tp;
@@ -267,15 +306,16 @@
 	function block_del($from, $to = USERID)
 	{
 		global $sql;
-		if($sql->db_Select("user", "user_name", "user_id = '".intval($from)."'"))
+		$from = intval($from);
+		if($sql->db_Select('user', 'user_name', 'user_id = '.$from))
 		{
 			$uinfo = $sql->db_Fetch();
-			if($sql->db_Select("private_msg_block", "pm_block_id", "pm_block_from = '".intval($from)."' AND pm_block_to = '".intval($to)."'"))
+			if($sql->db_Select('private_msg_block', 'pm_block_id', 'pm_block_from = '.$from.' AND pm_block_to = '.intval($to)))
 			{
 				$row = $sql->db_Fetch();
-				if($sql->db_Delete("private_msg_block", "pm_block_id = '".intval($row['pm_block_id'])."'"))
+				if($sql->db_Delete('private_msg_block', 'pm_block_id = '.intval($row['pm_block_id'])))
 				{
-					return str_replace("{UNAME}", $uinfo['user_name'], LAN_PM_44);
+					return str_replace('{UNAME}', $uinfo['user_name'], LAN_PM_44);
 				}
 				else
 				{
@@ -284,7 +324,7 @@
 			}
 			else
 			{
-				return str_replace("{UNAME}", $uinfo['user_name'], LAN_PM_46);
+				return str_replace('{UNAME}', $uinfo['user_name'], LAN_PM_46);
 			}
 		}
 		else
@@ -297,7 +337,7 @@
 	{
 		global $sql, $tp;
 		$var = trim($var);
-		if($sql->db_Select("user", "user_id, user_name, user_class, user_email", "user_name LIKE '".$tp->toDB($var)."' LIMIT 1"))
+		if($sql->db_Select("user", "user_id, user_name, user_class, user_email", "user_name LIKE '".$sql -> escape(trim($var), TRUE)."'"))
 		{
 			$row = $sql->db_Fetch();
 			return $row;
diff -x .svn -aruN 0.7.16.src/e107_plugins/pm/pm_conf.php 0.7.17.src/e107_plugins/pm/pm_conf.php
--- 0.7.16.src/e107_plugins/pm/pm_conf.php	2008-12-30 10:34:47.000000000 -0600
+++ 0.7.17.src/e107_plugins/pm/pm_conf.php	2009-12-12 11:25:45.000000000 -0600
@@ -11,40 +11,40 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/pm/pm_conf.php,v $
-|     $Revision: 1.9 $
-|     $Date: 2008/12/30 16:35:10 $
+|     $Revision: 1.10 $
+|     $Date: 2009/12/12 17:26:09 $
 |     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 $retrieve_prefs[] = 'pm_prefs';
 $eplug_admin = TRUE;
-require_once("../../class2.php");
-require_once(e_PLUGIN."pm/pm_class.php");
-require_once(e_HANDLER."userclass_class.php");
-require_once(e_HANDLER."form_handler.php");
+require_once('../../class2.php');
+require_once(e_PLUGIN.'pm/pm_class.php');
+require_once(e_HANDLER.'userclass_class.php');
+require_once(e_HANDLER.'form_handler.php');
 
 if (!getperms("P"))
 {
-	header("location:".e_BASE."index.php");
+	header('location:'.e_BASE.'index.php');
 	exit;
 }
 
 $action = e_QUERY;
 
-require_once(e_ADMIN."auth.php");
+require_once(e_ADMIN.'auth.php');
 
-if($action == "")
+if($action == '')
 {
-	$action = "main";
+	$action = 'main';
 }
 
-$pm_prefs = $sysprefs->getArray("pm_prefs");
+$pm_prefs = $sysprefs->getArray('pm_prefs');
 
 //pm_prefs record not found in core table, set to defaults and create record
 if(!is_array($pm_prefs))
 {
-	require_once(e_PLUGIN."pm/pm_default.php");
-	$pm_prefs = pm_set_default_prefs();
+	require_once(e_PLUGIN.'pm/pm_default.php');
+	$pm_prefs = pm_set_default_prefs();			// Use the default settings
 	$sysprefs->setArray('pm_prefs');
 	$message = ADLAN_PM_3;
 }
@@ -62,6 +62,7 @@
 	$message = ADLAN_PM_4;
 }
 
+
 if(isset($_POST['addlimit']))
 {
 	if($sql->db_Select('generic','gen_id',"gen_type = 'pm_limit' AND gen_datestamp = {$_POST['newlimit_class']}"))
@@ -111,24 +112,25 @@
 	}
 }
 
+
 if(isset($message))
 {
-	$ns->tablerender("", $message);
+	$ns->tablerender('', $message);
 }
 
 
-if($action == "main")
+switch ($action)
 {
+	case 'main' :
 	$ns->tablerender(ADLAN_PM_12, show_options());
-}
-
-if($action == "limits")
-{
+		break;
+	case 'limits' :
 	$ns->tablerender(ADLAN_PM_14, show_limits());
 	$ns->tablerender(ADLAN_PM_15, add_limit());
+		break;
 }
 
-require_once(e_ADMIN."footer.php");
+require_once(e_ADMIN.'footer.php');
 
 function yes_no($fname)
 {
@@ -140,6 +142,7 @@
 }
 
 
+
 function show_options()
 {
 	global $pm_prefs;
@@ -176,7 +179,7 @@
 	</tr>
 	<tr>
 		<td class='forumheader3' style='width:75%'>".ADLAN_PM_23."</td>
-		<td class='forumheader3' style='width:25%'>".r_userclass('option[pm_class]', $pm_prefs['pm_class'], 'off', 'member, admin, classes')."</td>
+		<td class='forumheader3' style='width:25%'>".r_userclass('option[pm_class]', $pm_prefs['pm_class'], 'off', 'member,admin,classes')."</td>
 	</tr>
 	<tr>
 		<td class='forumheader3' style='width:75%'>".ADLAN_PM_24."</td>
@@ -184,15 +187,15 @@
 	</tr>
 	<tr>
 		<td class='forumheader3' style='width:75%'>".ADLAN_PM_25."</td>
-		<td class='forumheader3' style='width:25%'>".r_userclass('option[notify_class]', $pm_prefs['notify_class'], 'off', 'nobody, member, admin, classes')."</td>
+		<td class='forumheader3' style='width:25%'>".r_userclass('option[notify_class]', $pm_prefs['notify_class'], 'off', 'nobody,member,admin,classes')."</td>
 	</tr>
 	<tr>
 		<td class='forumheader3' style='width:75%'>".ADLAN_PM_26."</td>
-		<td class='forumheader3' style='width:25%'>".r_userclass('option[receipt_class]', $pm_prefs['receipt_class'], 'off', 'nobody, member, admin, classes')."</td>
+		<td class='forumheader3' style='width:25%'>".r_userclass('option[receipt_class]', $pm_prefs['receipt_class'], 'off', 'nobody,member,admin,classes')."</td>
 	</tr>
 	<tr>
 		<td class='forumheader3' style='width:75%'>".ADLAN_PM_27."</td>
-		<td class='forumheader3' style='width:25%'>".r_userclass('option[attach_class]', $pm_prefs['attach_class'], 'off', 'nobody, member, admin, classes')."</td>
+		<td class='forumheader3' style='width:25%'>".r_userclass('option[attach_class]', $pm_prefs['attach_class'], 'off', 'nobody,member,admin,classes')."</td>
 	</tr>
 	<tr>
 		<td class='forumheader3' style='width:75%'>".ADLAN_PM_28."</td>
@@ -200,11 +203,11 @@
 	</tr>
 	<tr>
 		<td class='forumheader3' style='width:75%'>".ADLAN_PM_29."</td>
-		<td class='forumheader3' style='width:25%'>".r_userclass('option[sendall_class]', $pm_prefs['sendall_class'], 'off', 'nobody, member, admin, classes')."</td>
+		<td class='forumheader3' style='width:25%'>".r_userclass('option[sendall_class]', $pm_prefs['sendall_class'], 'off', 'nobody,member,admin,classes')."</td>
 	</tr>
 	<tr>
 		<td class='forumheader3' style='width:75%'>".ADLAN_PM_30."</td>
-		<td class='forumheader3' style='width:25%'>".r_userclass('option[multi_class]', $pm_prefs['multi_class'], 'off', 'nobody, member, admin, classes')."</td>
+		<td class='forumheader3' style='width:25%'>".r_userclass('option[multi_class]', $pm_prefs['multi_class'], 'off', 'nobody,member,admin,classes')."</td>
 	</tr>
 	<tr>
 		<td class='forumheader3' style='width:75%'>".ADLAN_PM_31."</td>
@@ -219,13 +222,13 @@
 	return $txt;
 }
 
+
+
+
+
 function show_limits()
 {
 	global $sql, $pref;
-	if($sql->db_Select('userclass_classes','userclass_id, userclass_name'))
-	{
-		$classList = $sql->db_getList();
-	}
 	if($sql->db_Select("generic", "gen_id as limit_id, gen_datestamp as limit_classnum, gen_user_id as inbox_count, gen_ip as outbox_count, gen_intdata as inbox_size, gen_chardata as outbox_size", "gen_type = 'pm_limit'"))
 	{
 		while($row = $sql->db_Fetch())
@@ -301,10 +304,6 @@
 function add_limit()
 {
 	global $sql, $pref;
-	if($sql->db_Select('userclass_classes','userclass_id, userclass_name'))
-	{
-		$classList = $sql->db_getList();
-	}
 	if($sql->db_Select("generic", "gen_id as limit_id, gen_datestamp as limit_classnum, gen_user_id as inbox_count, gen_ip as outbox_count, gen_intdata as inbox_size, gen_chardata as outbox_size", "gen_type = 'pm_limit'"))
 	{
 		while($row = $sql->db_Fetch())
@@ -324,7 +323,7 @@
 
 	$txt .= "
 	<tr>
-	<td class='forumheader3'>".r_userclass("newlimit_class", 0, "off", "guest, member, admin, classes, language")."</td>
+	<td class='forumheader3'>".r_userclass("newlimit_class", 0, "off", "guest,member,admin,classes,language")."</td>
 	<td class='forumheader3'>
 		".ADLAN_PM_39."<input type='text' class='tbox' size='5' name='new_inbox_count' value='' /> 
 		".ADLAN_PM_40."<input type='text' class='tbox' size='5' name='new_outbox_count' value='' /> 
diff -x .svn -aruN 0.7.16.src/e107_plugins/pm/pm_default.php 0.7.17.src/e107_plugins/pm/pm_default.php
--- 0.7.16.src/e107_plugins/pm/pm_default.php	2005-12-14 13:28:30.000000000 -0600
+++ 0.7.17.src/e107_plugins/pm/pm_default.php	2009-12-12 11:25:45.000000000 -0600
@@ -4,19 +4,20 @@
 function pm_set_default_prefs()
 {
 	$ret = array(
-		'title' 				=> 'PMLAN_PM',
+		'title' 			=> 'PMLAN_PM',
 		'animate' 			=> '1',
 		'dropdown' 			=> '0',
-		'read_timeout' 	=> '0',
+		'read_timeout' 		=> '0',
 		'unread_timeout'	=> '0',
 		'popup'				=> '0',
 		'popup_delay'		=> '',
+		'perpage'			=> '10',
 		'pm_class'			=> e_UC_MEMBER,
 		'notify_class'		=>	e_UC_ADMIN,
-		'receipt_class'	=> e_UC_MEMBER,
+		'receipt_class'		=> e_UC_MEMBER,
 		'attach_class'		=>	e_UC_ADMIN,
 		'attach_size'		=> 500,
-		'sendall_class'	=>	e_UC_ADMIN,
+		'sendall_class'		=>	e_UC_ADMIN,
 		'multi_class'		=> e_UC_ADMIN,
 		'allow_userclass'	=> '1'
 	);
diff -x .svn -aruN 0.7.16.src/e107_plugins/pm/pm.php 0.7.17.src/e107_plugins/pm/pm.php
--- 0.7.16.src/e107_plugins/pm/pm.php	2009-08-24 17:01:25.000000000 -0500
+++ 0.7.17.src/e107_plugins/pm/pm.php	2009-12-12 11:25:45.000000000 -0600
@@ -3,7 +3,7 @@
 + ----------------------------------------------------------------------------+
 |     e107 website system
 |
-|     Steve Dunstan 2001-2002
+|     (C)Steve Dunstan 2001-2002
 |     http://e107.org
 |     jalist@e107.org
 |
@@ -11,28 +11,39 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/pm/pm.php,v $
-|     $Revision: 1.30 $
-|     $Date: 2009/08/24 22:01:49 $
-|     $Author: bugrain $
+|     $Revision: 1.32 $
+|     $Date: 2009/12/12 17:26:09 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 
 $retrieve_prefs[] = 'pm_prefs';
-require_once("../../class2.php");
-require_once(e_PLUGIN."pm/pm_class.php");
-require_once(e_PLUGIN."pm/pm_func.php");
-$lan_file = e_PLUGIN."pm/languages/".e_LANGUAGE.".php";
-include_once(is_readable($lan_file) ? $lan_file : e_PLUGIN."pm/languages/English.php");
+require_once('../../class2.php');
 
-define("ATTACHMENT_ICON", "<img src='".e_PLUGIN."pm/images/attach.png' alt='' />");
 
-$qs = explode(".", e_QUERY);
+
+
+
+	  if (!isset($pref['plug_installed']['pm']))
+	  {
+		header('location:'.e_BASE.'index.php');
+		exit;
+	  }
+
+
+require_once(e_PLUGIN.'pm/pm_class.php');
+require_once(e_PLUGIN.'pm/pm_func.php');
+include_lan(e_PLUGIN.'pm/languages/'.e_LANGUAGE.'.php');
+
+define('ATTACHMENT_ICON', "<img src='".e_PLUGIN."pm/images/attach.png' alt='' />");
+
+$qs = explode('.', e_QUERY);
 $action = varset($qs[0],'inbox');
 if (!$action) $action = 'inbox';
 
 $pm_proc_id = intval(varset($qs[1],0));
 
-$pm_prefs = $sysprefs->getArray("pm_prefs");
+$pm_prefs = $sysprefs->getArray('pm_prefs');
 
 if(!isset($pm_prefs['pm_class']) || !check_class($pm_prefs['pm_class']))
 {
@@ -43,12 +54,24 @@
 }
 
 $pm =& new private_message;
-$message = "";
+$message = '';
 $pm_prefs['perpage'] = intval($pm_prefs['perpage']);
 if($pm_prefs['perpage'] == 0)
 {
 	$pm_prefs['perpage'] = 10;
 }
+$pmSource = '';
+if (isset($_POST['pm_come_from']))
+{
+	$pmSource = $tp->toDB($_POST['pm_come_from']);
+}
+elseif (isset($qs[2]))
+{
+	$pmSource = $tp->toDB($qs[2]);
+}
+
+
+
 //Auto-delete message, if timeout set in admin
 $del_qry = array();
 $read_timeout = intval($pm_prefs['read_timeout']);
@@ -65,8 +88,8 @@
 }
 if(count($del_qry) > 0)
 {
-	$qry = implode(" OR ", $del_qry);
-	if($sql->db_Select("private_msg", "pm_id", $qry))
+	$qry = implode(' OR ', $del_qry).' AND (pm_from = '.USERID.' OR pm_to = '.USERID.')';
+	if($sql->db_Select('private_msg', 'pm_id', $qry))
 	{
 		$delList = $sql->db_getList();
 		foreach($delList as $p)
@@ -76,13 +99,15 @@
 	}
 }
 
-if("del" == $action || isset($_POST['pm_delete_selected']))
+
+
+if('del' == $action || isset($_POST['pm_delete_selected']))
 {
 	if(isset($_POST['pm_delete_selected']))
 	{
 		foreach(array_keys($_POST['selected_pm']) as $id)
 		{
-			$message .= LAN_PM_24.": $id <br />";
+			$message .= LAN_PM_24.": {$id} <br />";
 			$message .= $pm->del($id);
 		}
 	}
@@ -90,25 +115,47 @@
 	{
 		$message = $pm->del($pm_proc_id);
 	}
-	if($qs[2] != "")
+	if ($pmSource)
 	{
-		$action = $qs[2];
+		$action = $pmSource;
 	}
 	else
 	{
-		if(substr($_SERVER['HTTP_REFERER'], -5) == "inbox")
+		if(substr($_SERVER['HTTP_REFERER'], -5) == 'inbox')
 		{
-			$action = "inbox";
+			$action = 'inbox';
 		}
-		if(substr($_SERVER['HTTP_REFERER'], -6) == "outbox")
+		elseif(substr($_SERVER['HTTP_REFERER'], -6) == 'outbox')
 		{
-			$action = "outbox";
+			$action = 'outbox';
 		}
 	}
 	$pm_proc_id = 0;
 	unset($qs);
 }
 
+
+
+if('delblocked' == $action || isset($_POST['pm_delete_blocked_selected']))
+{
+	if(isset($_POST['pm_delete_blocked_selected']))
+	{
+		foreach(array_keys($_POST['selected_pm']) as $id)
+		{
+			$message .= LAN_PM_70.": {$id} <br />";
+			$message .= $pm->block_del($id).'<br />';
+		}
+		}
+	elseif('delblocked' == $action)
+	{
+		$message = $pm->block_del($pm_proc_id);
+	}
+	$action = 'blocked';
+	$pm_proc_id = 0;
+	unset($qs);
+}
+
+
 if('block' == $action)
 {
 	$message = $pm->block_add($pm_proc_id);
@@ -123,12 +170,13 @@
 	$pm_proc_id = 0;
 }
 
-if("get" == $action)
+if('get' == $action)
 {
 	$pm->send_file($pm_proc_id, intval($qs[2]));
 	exit;
 }
 
+
 require_once(HEADERF);
 
 if(isset($_POST['postpm']))
@@ -137,18 +185,22 @@
 	$action = 'outbox';
 }
 
-if($message != "")
+
+
+if($message != '')
 {
 	$ns->tablerender("", $message);
 }
 
-if("send" == $action)
+
+
+switch ($action)
 {
+	case 'send' :
 	$ns->tablerender(LAN_PM, show_send($pm_proc_id));
-}
+		break;
 
-if("reply" == $action)
-{
+	case 'reply' :
 	$pmid = $pm_proc_id;
 	if($pm_info = $pm->pm_get($pmid))
 	{
@@ -165,26 +217,34 @@
 	{
 		$ns->tablerender(LAN_PM, LAN_PM_57);
 	}
-}
-
-if("inbox" == $action)
-{
-	$ns->tablerender(LAN_PM." - ".LAN_PM_25, show_inbox($pm_proc_id), "PM");
-}
+		break;
 
-if("outbox" == $action)
-{
-	$ns->tablerender(LAN_PM." - ".LAN_PM_26, show_outbox($pm_proc_id), "PM");
+	case 'inbox' :
+		$ns->tablerender(LAN_PM." - ".LAN_PM_25, show_inbox($pm_proc_id), 'PM');
+		break;
+
+	case 'outbox' :
+		$ns->tablerender(LAN_PM." - ".LAN_PM_26, show_outbox($pm_proc_id), 'PM');
+		break;
+
+	case 'show' :
+		show_pm($pm_proc_id, $pmSource);
+		break;
+
+	case 'blocked' :
+		$ns->tablerender(LAN_PM." - ".LAN_PM_66, showBlocked($pm_proc_id), 'PM');
+		break;
 }
 
-if("show" == $action)
-{
-	show_pm($pm_proc_id);
-}
 
 require_once(FOOTERF);
 exit;
 
+
+
+
+
+
 function show_send($to_uid)
 {
 	global $tp, $pm_info, $pm_prefs;
@@ -203,9 +263,9 @@
 	{
 		return str_replace('{PERCENT}', $pm_outbox['outbox']['filled'], LAN_PM_13);
 	}
-	require_once(e_PLUGIN."pm/pm_shortcodes.php");
+	require_once(e_PLUGIN.'pm/pm_shortcodes.php');
 	$tpl_file = THEME."pm_template.php";
-	include_once(is_readable($tpl_file) ? $tpl_file : e_PLUGIN."pm/pm_template.php");
+	include_once(is_readable($tpl_file) ? $tpl_file : e_PLUGIN.'pm/pm_template.php');
 	$enc = (check_class($pm_prefs['attach_class']) ? "enctype='multipart/form-data'" : "");
 	$text = "<form {$enc} method='post' action='".e_SELF."' id='dataform'>
 	<div><input type='hidden' name='numsent' value='{$pm_outbox['outbox']['total']}' />".
@@ -214,6 +274,8 @@
 	return $text;
 }
 
+
+
 function show_inbox($start = 0)
 {
 	global $pm, $tp, $pm_shortcodes, $pm_info, $pm_blocks, $pmlist, $pm_start, $pm_prefs;
@@ -243,13 +305,16 @@
 	return $txt;
 }
 
+
+
+
 function show_outbox($start = 0)
 {
 	global $pm, $tp, $pm_shortcodes, $pm_info, $pm_start, $pm_prefs, $pmlist;
 	$pm_start = $start;
-	require_once(e_PLUGIN."pm/pm_shortcodes.php");
-	$tpl_file = THEME."pm_template.php";
-	include(is_readable($tpl_file) ? $tpl_file : e_PLUGIN."pm/pm_template.php");
+	require_once(e_PLUGIN.'pm/pm_shortcodes.php');
+	$tpl_file = THEME.'pm_template.php';
+	include(is_readable($tpl_file) ? $tpl_file : e_PLUGIN.'pm/pm_template.php');
 	$pmlist = $pm->pm_get_outbox(USERID, $pm_start, $pm_prefs['perpage']);
 	$txt = "<form method='post' action='".e_SELF."?".e_QUERY."' id='pm_list_form'>";
 	$txt .= $tp->parseTemplate($PM_OUTBOX_HEADER, true, $pm_shortcodes);
@@ -257,7 +322,7 @@
 	{
 		foreach($pmlist['messages'] as $rec)
 		{
-			if(trim($rec['pm_subject']) == '') { $rec['pm_subject'] = "[".LAN_PM_61."]"; }
+			if(trim($rec['pm_subject']) == '') { $rec['pm_subject'] = '['.LAN_PM_61.']'; }
 			$pm_info = $rec;
 			$txt .= $tp->parseTemplate($PM_OUTBOX_TABLE, true, $pm_shortcodes);
 		}
@@ -271,12 +336,14 @@
 	return $txt;
 }
 
-function show_pm($pmid)
+
+
+function show_pm($pmid, $comeFrom = '')
 {
 	global $pm, $tp, $pm_shortcodes, $pm_info, $ns;
-	require_once(e_PLUGIN."pm/pm_shortcodes.php");
-	$tpl_file = THEME."pm_template.php";
-	include_once(is_readable($tpl_file) ? $tpl_file : e_PLUGIN."pm/pm_template.php");
+	require_once(e_PLUGIN.'pm/pm_shortcodes.php');
+	$tpl_file = THEME.'pm_template.php';
+	include_once(is_readable($tpl_file) ? $tpl_file : e_PLUGIN.'pm/pm_template.php');
 	$pm_info = $pm->pm_get($pmid);
 	if($pm_info['pm_to'] != USERID && $pm_info['pm_from'] != USERID)
 	{
@@ -292,16 +359,24 @@
 	}
 	$txt .= $tp->parseTemplate($PM_SHOW, true, $pm_shortcodes);
 	$ns -> tablerender(LAN_PM, $txt);
-	if($pm_info['pm_from'] == USERID)
+	if (!$comeFrom)
+	{
+		if ($pm_info['pm_from'] == USERID) { $comeFrom = 'outbox'; } 
+	}
+	if ($comeFrom == 'outbox')
 	{	// Show Outbox
-		$ns->tablerender(LAN_PM." - ".LAN_PM_26, show_outbox($pm_proc_id), "PM");
+		$ns->tablerender(LAN_PM." - ".LAN_PM_26, show_outbox($pm_proc_id), 'PM');
 	}
 	else
 	{	// Show Inbox
-		$ns->tablerender(LAN_PM." - ".LAN_PM_25, show_inbox($pm_proc_id), "PM");
+		$ns->tablerender(LAN_PM." - ".LAN_PM_25, show_inbox($pm_proc_id), 'PM');
 	}
 }
 
+
+
+
+
 function post_pm()
 {
 	global $pm_prefs, $pm, $pref, $sql, $tp;
@@ -322,7 +397,7 @@
 	}
 	if(isset($_POST['pm_to']))
 	{
-		$msg = "";
+		$msg = '';
 		if(isset($_POST['to_userclass']) && $_POST['to_userclass'])
 		{
 			if(!$pm_prefs['allow_userclass'])
@@ -437,4 +512,56 @@
 		return $msg.$pm->add($_POST);
 	}
 }
+
+
+function pm_user_lookup()
+{
+	global $sql;
+
+
+		$query = "SELECT * FROM #user WHERE user_name REGEXP '^".$_POST['keyword']."' ";
+	  	if($sql -> db_Select_gen($query))
+	  	{
+			echo "[";
+	        while($row = $sql-> db_Fetch())
+	        {
+	              $u[] =  "{\"caption\":\"".$row['user_name']."\",\"value\":".$row['user_id']."}";
+	         }
+
+			echo implode(",",$u);
+	        echo "]";
+		}
+
+    	exit;
+}
+
+
+function showBlocked($start = 0)
+{
+	global $pm, $tp, $pm_shortcodes, $pmBlocked, $pmTotalBlocked, $pm_start, $pm_prefs ;
+	$pm_start = $start;
+	require_once(e_PLUGIN.'pm/pm_shortcodes.php');
+	$tpl_file = THEME.'pm_template.php';
+	include(is_readable($tpl_file) ? $tpl_file : e_PLUGIN.'pm/pm_template.php');
+	$pmBlocks = $pm->block_get_user();			// TODO - handle pagination, maybe (is it likely to be necessary?)
+	$txt = "<form method='post' action='".e_SELF."?".e_QUERY."'>";
+	$txt .= $tp->parseTemplate($PM_BLOCKED_HEADER, true, $pm_shortcodes);
+	if($pmTotalBlocked = count($pmBlocks))
+	{
+		foreach($pmBlocks as $pmBlocked)
+		{
+			$txt .= $tp->parseTemplate($PM_BLOCKED_TABLE, true, $pm_shortcodes);
+		}
+	}
+	else
+	{
+		$txt .= $tp->parseTemplate($PM_BLOCKED_EMPTY, true, $pm_shortcodes);
+	}
+	$txt .= $tp->parseTemplate($PM_BLOCKED_FOOTER, true, $pm_shortcodes);
+	$txt .= "</form>";
+	return $txt;
+}
+
+
+
 ?>
\ No newline at end of file
diff -x .svn -aruN 0.7.16.src/e107_plugins/pm/pm_shortcodes.php 0.7.17.src/e107_plugins/pm/pm_shortcodes.php
--- 0.7.16.src/e107_plugins/pm/pm_shortcodes.php	2009-08-24 17:01:25.000000000 -0500
+++ 0.7.17.src/e107_plugins/pm/pm_shortcodes.php	2009-12-12 11:25:46.000000000 -0600
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/pm/pm_shortcodes.php,v $
-|     $Revision: 1.22 $
-|     $Date: 2009/08/24 22:01:49 $
-|     $Author: bugrain $
+|     $Revision: 1.24 $
+|     $Date: 2009/12/12 17:26:10 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 if (!defined('e107_INIT')) { exit; }
@@ -42,6 +42,7 @@
 return $ret;
 SC_END
 
+
 SC_BEGIN FORM_TOCLASS
 global $pm_prefs, $pm_info;
 if($pm_info['from_name'])
@@ -240,10 +241,13 @@
 
 SC_BEGIN PM_SUBJECT
 global $pm_info, $tp;
-$ret = $tp->toHTML($pm_info['pm_subject'], true, 'no_make_clickable,no_hook');
-if('link' == $parm)
-{
-	$ret = "<a href='".e_PLUGIN_ABS."pm/pm.php?show.{$pm_info['pm_id']}'>".$ret."</a>";
+$ret = $tp->toHTML($pm_info['pm_subject'], true, 'USER_TITLE');
+$prm = explode(',',$parm);
+if('link' == $prm[0])
+{
+	$extra = '';
+	if (isset($prm[1])) $extra = '.'.$prm[1];
+	$ret = "<a href='".e_PLUGIN_ABS."pm/pm.php?show.{$pm_info['pm_id']}{$extra}'>".$ret."</a>";
 }
 return $ret;
 SC_END
@@ -262,7 +266,7 @@
 
 SC_BEGIN PM_SELECT
 global $pm_info;
-return "<input type='checkbox' name='selected_pm[{$pm_info['pm_id']}]' id='selected_pm[{$pm_info['pm_id']}]' value='1' />";
+return "<input type='checkbox' name='selected_pm[{$pm_info['pm_id']}]' value='1' />";
 SC_END
 
 SC_BEGIN PM_READ_ICON
@@ -371,6 +375,8 @@
 return '';
 SC_END
 
+
+
 SC_BEGIN PM_NEXTPREV
 global $pmlist, $tp, $pm_start, $pm_prefs, $pmlist;
 return $tp->parseTemplate("{NEXTPREV={$pmlist['total_messages']},{$pm_prefs['perpage']},{$pm_start},".e_SELF."?{$parm}.[FROM]}");
@@ -381,5 +387,53 @@
 SC_END
 
 
+//---------------------------------------
+//		Blocked senders management
+//---------------------------------------
+SC_BEGIN BLOCKED_SENDERS_MANAGE
+global $sql;
+$count = $sql->db_Count('private_msg_block', '(*)', 'WHERE `pm_block_to` = '.USERID);
+if (!$count) return '';
+return LAN_PM_66;
+SC_END
+
+
+SC_BEGIN PM_BLOCKED_SELECT
+global $pmBlocked;
+return "<input type='checkbox' name='selected_pm[{$pmBlocked['pm_block_from']}]' value='1' />";
+SC_END
+
+
+SC_BEGIN PM_BLOCKED_USER
+global $pmBlocked;
+if (!$pmBlocked['user_name'])
+{
+	return LAN_PM_72;
+}
+if('link' == $parm)
+{
+	return "<a href='".e_BASE."user.php?id.{$pmBlocked['pm_block_from']}'>{$pmBlocked['user_name']}</a>";
+}
+else
+{
+	return $pmBlocked['user_name'];
+}
+SC_END
+
+SC_BEGIN PM_BLOCKED_DATE
+global $pmBlocked;
+require_once(e_HANDLER.'date_handler.php');
+return convert::convert_date($pmBlocked['pm_block_datestamp'], $parm);
+SC_END
+
+SC_BEGIN PM_BLOCKED_DELETE
+global $pmBlocked;
+return "<a href='".e_PLUGIN_ABS."pm/pm.php?delblocked.{$pmBlocked['pm_block_from']}'><img src='".e_PLUGIN_ABS."pm/images/mail_delete.png' title='".LAN_PM_52."' alt='".LAN_PM_52."' class='icon S16' /></a>";
+SC_END
+
+SC_BEGIN DELETE_BLOCKED_SELECTED
+return "<input type='submit' name='pm_delete_blocked_selected' class='button' value='".LAN_PM_53."' />";
+SC_END
+
 */
 ?>
\ No newline at end of file
diff -x .svn -aruN 0.7.16.src/e107_plugins/pm/pm_template.php 0.7.17.src/e107_plugins/pm/pm_template.php
--- 0.7.16.src/e107_plugins/pm/pm_template.php	2009-08-24 17:01:25.000000000 -0500
+++ 0.7.17.src/e107_plugins/pm/pm_template.php	2009-12-12 11:25:46.000000000 -0600
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/pm/pm_template.php,v $
-|     $Revision: 1.15 $
-|     $Date: 2009/08/24 22:01:49 $
-|     $Author: bugrain $
+|     $Revision: 1.16 $
+|     $Date: 2009/12/12 17:26:10 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 if (!defined('e107_INIT')) { exit; }
@@ -103,7 +103,7 @@
 <tr>
 	<td class='forumheader3'>{PM_SELECT}</td>
 	<td class='forumheader3'>{PM_READ_ICON}</td>
-	<td class='forumheader3'>{PM_SUBJECT=link}{PM_ATTACHMENT_ICON}</td>
+	<td class='forumheader3'>{PM_SUBJECT=link,inbox}{PM_ATTACHMENT_ICON}</td>
 	<td class='forumheader3'>{PM_FROM=link}</td>
 	<td class='forumheader3'>{PM_DATE}</td>
 	<td class='forumheader3' style='text-align: center; white-space: nowrap'>{PM_DELETE=inbox}&nbsp;{PM_BLOCK_USER}</td>
@@ -119,6 +119,7 @@
 $PM_INBOX_FOOTER = "
 <tr>
 	<td class='forumheader' colspan='6' style='text-align:center'>
+	<input type='hidden' name='pm_come_from' value='inbox' />
 	{DELETE_SELECTED}
 	</td>
 </tr>
@@ -142,7 +143,7 @@
 <tr>
 	<td class='forumheader3'>{PM_SELECT}</td>
 	<td class='forumheader3'>{PM_READ_ICON}</td>
-	<td class='forumheader3'>{PM_SUBJECT=link}{PM_ATTACHMENT_ICON}</td>
+	<td class='forumheader3'>{PM_SUBJECT=link,outbox}{PM_ATTACHMENT_ICON}</td>
 		<td class='forumheader3'>{PM_TO=link}</td>
 	<td class='forumheader3'>{PM_DATE}</td>
 	<td class='forumheader3' style='text-align: center'>{PM_DELETE=outbox}</td>
@@ -158,6 +159,7 @@
 $PM_OUTBOX_FOOTER = "
 <tr>
 	<td class='forumheader' colspan='6' style='text-align:center'>
+	<input type='hidden' name='pm_come_from' value='outbox' />
 	{DELETE_SELECTED}
 	</td>
 </tr>
@@ -165,6 +167,43 @@
 </table>
 ";
 
+
+$PM_BLOCKED_HEADER = "
+<table class='fborder' style='width:95%'>
+<tr>
+	<td class='fcaption' style='width:5%'>&nbsp;</td>
+	<td class='fcaption' style='width:48%'>".LAN_PM_68."</td>
+	<td class='fcaption' style='width:42%'>".LAN_PM_69."</td>
+	<td class='fcaption' style='width:5%'>&nbsp;</td>
+</tr>
+";
+
+$PM_BLOCKED_TABLE = "
+<tr>
+	<td class='forumheader3'>{PM_BLOCKED_SELECT}</td>
+	<td class='forumheader3'>{PM_BLOCKED_USER=link}</td>
+	<td class='forumheader3'>{PM_BLOCKED_DATE}</td>
+	<td class='forumheader3' style='text-align: center'>{PM_BLOCKED_DELETE}</td>
+</tr>
+";
+
+$PM_BLOCKED_EMPTY = "
+<tr>
+	<td colspan='4' class='forumheader'>".LAN_PM_67."</td>
+</tr>
+";
+
+$PM_BLOCKED_FOOTER = "
+<tr>
+	<td class='forumheader' colspan='4' style='text-align:center'>
+	{DELETE_BLOCKED_SELECTED}
+	</td>
+</tr>
+</table>
+";
+
+
+
 $PM_SHOW =
 "<div style='text-align: center'>
 <table class='fborder' style='width:95%'>
diff -x .svn -aruN 0.7.16.src/e107_plugins/pm/private_msg_menu.php 0.7.17.src/e107_plugins/pm/private_msg_menu.php
--- 0.7.16.src/e107_plugins/pm/private_msg_menu.php	2008-07-28 15:15:35.000000000 -0500
+++ 0.7.17.src/e107_plugins/pm/private_msg_menu.php	2009-12-12 11:25:46.000000000 -0600
@@ -11,8 +11,8 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/pm/private_msg_menu.php,v $
-|     $Revision: 1.13 $
-|     $Date: 2008/07/28 20:15:58 $
+|     $Revision: 1.14 $
+|     $Date: 2009/12/12 17:26:10 $
 |     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
@@ -21,9 +21,9 @@
 global $sysprefs, $pref, $pm_prefs;
 if(!isset($pm_prefs['perpage']))
 {
-	$pm_prefs = $sysprefs->getArray("pm_prefs");
+	$pm_prefs = $sysprefs->getArray('pm_prefs');
 }
-require_once(e_PLUGIN."pm/pm_func.php");
+require_once(e_PLUGIN.'pm/pm_func.php');
 pm_getInfo('clear');
 
 define("PM_INBOX_ICON", "<img src='".e_PLUGIN_ABS."pm/images/mail_get.png' style='height:16px; width:16px; border:0px;' alt='".LAN_PM_25."' title='".LAN_PM_25."' />");
@@ -43,6 +43,9 @@
 $sc_style['NEWPM_ANIMATE']['pre'] = "<a href='".e_PLUGIN_ABS."pm/pm.php?inbox'>";
 $sc_style['NEWPM_ANIMATE']['post'] = "</a>";
 
+$sc_style['BLOCKED_SENDERS_MANAGE']['pre'] = "<br />[ <a href='".e_PLUGIN_ABS."pm/pm.php?blocked'>";
+$sc_style['BLOCKED_SENDERS_MANAGE']['post'] = '</a> ]';
+
 
 if(!isset($pm_menu_template))
 {
@@ -57,9 +60,11 @@
 	<a href='".e_PLUGIN_ABS."pm/pm.php?outbox'>".LAN_PM_26."</a><br />
 	{OUTBOX_TOTAL} ".LAN_PM_36.", {OUTBOX_UNREAD} ".LAN_PM_37." {OUTBOX_FILLED}
 	{SEND_PM_LINK}
+	{BLOCKED_SENDERS_MANAGE}
 	";
 }
 
+
 if(check_class($pm_prefs['pm_class']))
 {
 	global $tp, $pm_inbox;
diff -x .svn -aruN 0.7.16.src/e107_plugins/pm/sendpm.sc 0.7.17.src/e107_plugins/pm/sendpm.sc
--- 0.7.16.src/e107_plugins/pm/sendpm.sc	2009-08-15 06:54:08.000000000 -0500
+++ 0.7.17.src/e107_plugins/pm/sendpm.sc	2009-12-12 11:25:46.000000000 -0600
@@ -1,4 +1,5 @@
-include_lan(e_PLUGIN."pm/languages/".e_LANGUAGE.".php");
+include_lan(e_PLUGIN.'pm/languages/'.e_LANGUAGE.'.php');
+
 global $sysprefs, $pm_prefs;
 $pm_prefs = $sysprefs->getArray("pm_prefs");
 if(check_class($pm_prefs['pm_class']))
@@ -9,9 +10,9 @@
 	}
 	else
 	{
-		$img = "<img src='".e_PLUGIN."pm/images/pm.png' alt='".LAN_PM."' title='".LAN_PM."' style='border:0' />";
+		$img = "<img src='".e_PLUGIN_ABS."pm/images/pm.png' alt='".LAN_PM."' title='".LAN_PM."' style='border:0' />";
 	}
-	return  "<a href='".e_PLUGIN."pm/pm.php?send.{$parm}'>{$img}</a>";
+	return  "<a href='".e_PLUGIN_ABS."pm/pm.php?send.{$parm}'>{$img}</a>";
 }
 else
 {
diff -x .svn -aruN 0.7.16.src/e107_plugins/poll/oldpolls.php 0.7.17.src/e107_plugins/poll/oldpolls.php
--- 0.7.16.src/e107_plugins/poll/oldpolls.php	2009-08-20 05:17:49.000000000 -0500
+++ 0.7.17.src/e107_plugins/poll/oldpolls.php	2009-12-28 12:13:22.000000000 -0600
@@ -11,9 +11,9 @@
  |     GNU General Public License (http://gnu.org).
  |
  |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/poll/oldpolls.php,v $
- |     $Revision: 1.16 $
- |     $Date: 2009/08/20 10:18:13 $
- |     $Author: marj_nl_fr $
+ |     $Revision: 1.17 $
+ |     $Date: 2009/12/28 18:13:46 $
+ |     $Author: e107steved $
  +----------------------------------------------------------------------------+
  */
 require_once("../../class2.php");
@@ -72,7 +72,7 @@
 		{
 			$text .= "
 			<tr>
-			<td style='width:40%; text-align: right' class='mediumtext'><b>".$tp -> toHTML($option)."</b>&nbsp;&nbsp;</td>
+			<td style='width:40%; text-align: right' class='mediumtext'><b>".$tp -> toHTML($option, TRUE, 'TITLE')."</b>&nbsp;&nbsp;</td>
 			<td class='smalltext'>
 				<div style='background-image: url($barl); width: 5px; height: 14px; float: left;'>
 				</div>
diff -x .svn -aruN 0.7.16.src/e107_plugins/powered_by_menu/powered_by_menu.php 0.7.17.src/e107_plugins/powered_by_menu/powered_by_menu.php
--- 0.7.16.src/e107_plugins/powered_by_menu/powered_by_menu.php	2006-01-22 14:44:18.000000000 -0600
+++ 0.7.17.src/e107_plugins/powered_by_menu/powered_by_menu.php	2009-10-28 09:23:17.000000000 -0500
@@ -3,7 +3,7 @@
 + ----------------------------------------------------------------------------+
 |     e107 website system
 |
-|     �Steve Dunstan 2001-2002
+|     ©Steve Dunstan 2001-2002
 |     http://e107.org
 |     jalist@e107.org
 |
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/powered_by_menu/powered_by_menu.php,v $
-|     $Revision: 1.8 $
-|     $Date: 2006/01/22 20:44:41 $
-|     $Author: streaky $
+|     $Revision: 1.9 $
+|     $Date: 2009/10/28 14:23:41 $
+|     $Author: marj_nl_fr $
 +----------------------------------------------------------------------------+
 */
 if (!defined('e107_INIT')) { exit; }
diff -x .svn -aruN 0.7.16.src/e107_plugins/rss_menu/admin_prefs.php 0.7.17.src/e107_plugins/rss_menu/admin_prefs.php
--- 0.7.16.src/e107_plugins/rss_menu/admin_prefs.php	2006-10-18 21:49:35.000000000 -0500
+++ 0.7.17.src/e107_plugins/rss_menu/admin_prefs.php	2009-11-19 05:45:25.000000000 -0600
@@ -3,7 +3,7 @@
 + ----------------------------------------------------------------------------+
 |     e107 website system
 |
-|     Steve Dunstan 2001-2002
+|     (C)Steve Dunstan 2001-2002
 |     http://e107.org
 |     jalist@e107.org
 |
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/rss_menu/admin_prefs.php,v $
-|     $Revision: 1.12 $
-|     $Date: 2006/10/19 02:49:58 $
-|     $Author: e107coders $
+|     $Revision: 1.13 $
+|     $Date: 2009/11/19 11:45:49 $
+|     $Author: marj_nl_fr $
 +----------------------------------------------------------------------------+
 */
 /*
@@ -29,15 +29,14 @@
 */
 
 require_once("../../class2.php");
-if(!getperms("P")){ header("location:".e_BASE."index.php"); }
-$lan_file = e_PLUGIN."rss_menu/languages/".e_LANGUAGE.".php";
-require_once(file_exists($lan_file) ? $lan_file : e_PLUGIN."rss_menu/languages/English.php");
+if(!getperms("P")){ header("location:".e_BASE."index.php"); exit(); }
+
+include_lan(e_PLUGIN.'rss_menu/languages/'.e_LANGUAGE.'.php');
 
 require_once(e_ADMIN."auth.php");
 
 $imagedir = e_IMAGE."admin_images/";
-$lan_file = e_PLUGIN.'rss_menu/languages/'.e_LANGUAGE.'.php';
-include_once(file_exists($lan_file) ? $lan_file : e_PLUGIN.'rss_menu/languages/English.php');
+
 require_once(e_PLUGIN.'rss_menu/rss_shortcodes.php');
 $rss = new rss;
 
diff -x .svn -aruN 0.7.16.src/e107_plugins/rss_menu/plugin.php 0.7.17.src/e107_plugins/rss_menu/plugin.php
--- 0.7.16.src/e107_plugins/rss_menu/plugin.php	2006-11-22 15:01:53.000000000 -0600
+++ 0.7.17.src/e107_plugins/rss_menu/plugin.php	2009-11-19 05:45:25.000000000 -0600
@@ -3,7 +3,7 @@
 + ----------------------------------------------------------------------------+
 |     e107 website system
 |
-|     Steve Dunstan 2001-2002
+|     (C)Steve Dunstan 2001-2002
 |     http://e107.org
 |     jalist@e107.org
 |
@@ -11,15 +11,14 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/rss_menu/plugin.php,v $
-|     $Revision: 1.11 $
-|     $Date: 2006/11/22 21:02:16 $
-|     $Author: e107coders $
+|     $Revision: 1.12 $
+|     $Date: 2009/11/19 11:45:49 $
+|     $Author: marj_nl_fr $
 +----------------------------------------------------------------------------+
 */
-if (!defined('e107_INIT')) { exit; }
+if (!defined('e107_INIT')) { exit(); }
 
-$lan_file = e_PLUGIN."rss_menu/languages/".e_LANGUAGE.".php";
-require_once(file_exists($lan_file) ? $lan_file : e_PLUGIN."rss_menu/languages/English.php");
+include_lan(e_PLUGIN."rss_menu/languages/".e_LANGUAGE.".php");
 
 // Plugin info ----------------------------------------------------------------
 $eplug_name				= "RSS_PLUGIN_LAN_1";
diff -x .svn -aruN 0.7.16.src/e107_plugins/rss_menu/rss_menu.php 0.7.17.src/e107_plugins/rss_menu/rss_menu.php
--- 0.7.16.src/e107_plugins/rss_menu/rss_menu.php	2006-10-21 08:05:58.000000000 -0500
+++ 0.7.17.src/e107_plugins/rss_menu/rss_menu.php	2010-01-09 08:38:58.000000000 -0600
@@ -3,7 +3,7 @@
 + ----------------------------------------------------------------------------+
 |     e107 website system
 |
-|     Steve Dunstan 2001-2002
+|     Steve Dunstan 2001-2002
 |     http://e107.org
 |     jalist@e107.org
 |
@@ -11,15 +11,15 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/rss_menu/rss_menu.php,v $
-|     $Revision: 1.16 $
-|     $Date: 2006/10/21 13:06:21 $
-|     $Author: e107coders $
+|     $Revision: 1.17 $
+|     $Date: 2010/01/09 14:39:22 $
+|     $Author: secretr $
 +----------------------------------------------------------------------------+
 */
 if (!defined('e107_INIT')) { exit; }
 
 global $FILES_DIRECTORY,$pref,$sql;
-$path = e_PLUGIN."rss_menu/";
+$path = e_PLUGIN_ABS."rss_menu/";
 
 $des = "";
 $topic = "";
diff -x .svn -aruN 0.7.16.src/e107_plugins/userlanguage_menu/userlanguage_menu.php 0.7.17.src/e107_plugins/userlanguage_menu/userlanguage_menu.php
--- 0.7.16.src/e107_plugins/userlanguage_menu/userlanguage_menu.php	2009-08-14 06:32:10.000000000 -0500
+++ 0.7.17.src/e107_plugins/userlanguage_menu/userlanguage_menu.php	2010-01-19 16:17:17.000000000 -0600
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/userlanguage_menu/userlanguage_menu.php,v $
-|     $Revision: 1.14 $
-|     $Date: 2009/08/14 11:32:34 $
-|     $Author: marj_nl_fr $
+|     $Revision: 1.16 $
+|     $Date: 2010/01/19 22:17:41 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 
@@ -37,8 +37,6 @@
 		$selected = ($languageFolder == e_LANGUAGE) ? ' selected="selected"' : '';
 		$urlval   = $slng->subdomainUrl($languageFolder);
 		$text .= '
-				<option value="'.$urlval.'" $selected>$languageFolder</option>';
-		$text .= '
 				<option value="'.$urlval.'"'.$selected.'>'.$languageFolder.'</option>';
 	}
 	$text .= '
@@ -51,6 +49,7 @@
 	//FIXME may not work with session
 	$action = (e_QUERY && ! $_GET['elan']) ? e_SELF.'?'.e_QUERY : e_SELF;
 	$text = '
+	<form method="post" action="'.$action.'">
 		<div style="text-align:center">
 			<select name="sitelanguage" class="tbox">';
 	foreach($languageList as $languageFolder)
@@ -66,7 +65,8 @@
 			<br />
 			<button class="button" type="submit" name="setlanguage"><span>'.UTHEME_MENU_L1.'</span></button>';
 	$text .= '
-		</div>';
+		</div>
+	</form>';
 }
 
 $ns->tablerender(UTHEME_MENU_L2, $text, 'user_lan');
diff -x .svn -aruN 0.7.16.src/e107.robots.txt 0.7.17.src/e107.robots.txt
--- 0.7.16.src/e107.robots.txt	2009-08-15 08:12:23.000000000 -0500
+++ 0.7.17.src/e107.robots.txt	2009-10-28 10:34:00.000000000 -0500
@@ -1,4 +1,5 @@
 User-agent: *
+Disallow: /sitedown.php
 Disallow: /e107_admin/
 Disallow: /e107_handlers/
 Disallow: /e107_files/cache/
diff -x .svn -aruN 0.7.16.src/e107_themes/e107v4a/theme.php 0.7.17.src/e107_themes/e107v4a/theme.php
--- 0.7.16.src/e107_themes/e107v4a/theme.php	2007-03-18 06:20:06.000000000 -0500
+++ 0.7.17.src/e107_themes/e107v4a/theme.php	2009-12-10 14:22:50.000000000 -0600
@@ -11,8 +11,8 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_themes/e107v4a/theme.php,v $
-|     $Revision: 1.20 $
-|     $Date: 2007/03/18 11:20:29 $
+|     $Revision: 1.21 $
+|     $Date: 2009/12/10 20:23:14 $
 |     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
@@ -42,7 +42,8 @@
 $layout = "_default";
 $logo = THEME_ABS."images/bullet3.gif";
 
-$HEADER .=
+
+$HEADER =
 "
 <table style='width:100%; background-color:#E4E0E0' cellspacing='3' class='topborder'>
 <tr>
diff -x .svn -aruN 0.7.16.src/e107_themes/jayya/admin_template.php 0.7.17.src/e107_themes/jayya/admin_template.php
--- 0.7.16.src/e107_themes/jayya/admin_template.php	2009-08-03 14:40:19.000000000 -0500
+++ 0.7.17.src/e107_themes/jayya/admin_template.php	2010-01-22 07:50:04.000000000 -0600
@@ -3,7 +3,7 @@
 + ----------------------------------------------------------------------------+
 |     e107 website system
 |
-|     Steve Dunstan 2001-2002
+|     Steve Dunstan 2001-2002
 |     http://e107.org
 |     jalist@e107.org
 |
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_themes/jayya/admin_template.php,v $
-|     $Revision: 1.22 $
-|     $Date: 2009/08/03 19:40:43 $
-|     $Author: marj_nl_fr $
+|     $Revision: 1.23 $
+|     $Date: 2010/01/22 13:50:28 $
+|     $Author: secretr $
 +----------------------------------------------------------------------------+
 */
 
@@ -88,6 +88,7 @@
     <tr>
     <td>
     {SETSTYLE=leftmenu}
+	".(e_PAGE != 'admin.php' ? '{ADMIN_UPDATE} ' : '')."
     {ADMIN_LANG}
     {ADMIN_PWORD}
     {ADMIN_MSG}
@@ -106,7 +107,7 @@
     }
     else
     {
-        $ADMIN_HEADER .= "{ADMIN_UPDATE} {ADMIN_SITEINFO}";
+        $ADMIN_HEADER .= "{ADMIN_SITEINFO}";
     }
 
 
diff -x .svn -aruN 0.7.16.src/e107_themes/khatru/forum_preview_template.php 0.7.17.src/e107_themes/khatru/forum_preview_template.php
--- 0.7.16.src/e107_themes/khatru/forum_preview_template.php	2005-12-14 13:28:30.000000000 -0600
+++ 0.7.17.src/e107_themes/khatru/forum_preview_template.php	2010-01-22 06:23:52.000000000 -0600
@@ -1,31 +1,31 @@
-<?php
-/*
-+ ----------------------------------------------------------------------------+
-|     e107 website system
-|
-|     Steve Dunstan 2001-2002
-|     http://e107.org
-|     jalist@e107.org
-|
-|     Released under the terms and conditions of the
-|     GNU General Public License (http://gnu.org).
-|
-|     $Source: /cvsroot/e107/e107_0.7/e107_themes/khatru/forum_preview_template.php,v $
-|     $Revision: 1.2 $
-|     $Date: 2005/12/14 19:28:52 $
-|     $Author: sweetas $
-+----------------------------------------------------------------------------+
-*/
-
+<?php
+/*
++ ----------------------------------------------------------------------------+
+|     e107 website system
+|
+|     Steve Dunstan 2001-2002
+|     http://e107.org
+|     jalist@e107.org
+|
+|     Released under the terms and conditions of the
+|     GNU General Public License (http://gnu.org).
+|
+|     $Source: /cvsroot/e107/e107_0.7/e107_themes/khatru/forum_preview_template.php,v $
+|     $Revision: 1.3 $
+|     $Date: 2010/01/22 12:24:16 $
+|     $Author: e107coders $
++----------------------------------------------------------------------------+
+*/
+
 if (!defined('e107_INIT')) { exit; }
 
-$FORUM_PREVIEW = 
-($action != "nt" ? "" : " ( ".LAN_62.$tsubject." )")."
-<table style='width:100%'>
-<td style='width:20%' style='vertical-align:top'><b>".$poster."</b></td>
-<td style='width:80%'>
-<div class='smallblacktext' style='text-align:right'>".IMAGE_post2." ".LAN_322.$postdate."</div><br />".$tpost."</td>
-</tr>
-</table>";
-	
+$FORUM_PREVIEW = 
+($action != "nt" ? "" : " ( ".LAN_62.$tsubject." )")."
+<table style='width:100%'>
+<td style='width:20%' style='vertical-align:top'><b>".$poster."</b></td>
+<td style='width:80%'>
+<div class='smallblacktext' style='text-align:right'>".IMAGE_post2." ".LAN_322.$postdate."</div><br />".$tpost."</td>
+</tr>
+</table>";
+	
 ?>
\ No newline at end of file
diff -x .svn -aruN 0.7.16.src/e107_themes/khatru/newforumpost.php 0.7.17.src/e107_themes/khatru/newforumpost.php
--- 0.7.16.src/e107_themes/khatru/newforumpost.php	2006-01-13 07:26:59.000000000 -0600
+++ 0.7.17.src/e107_themes/khatru/newforumpost.php	2010-01-22 06:23:53.000000000 -0600
@@ -1,13 +1,13 @@
-<?php
-
+<?php
+
 if (!defined('e107_INIT')) { exit; }
 
-$NEWFORUMPOSTSTYLE_HEADER = "
-<!-- newforumposts -->\n<ul>\n";
-
-$NEWFORUMPOSTSTYLE_MAIN = "<li><span class='smalltext'>{THREAD} by {POSTER} [ views: {VIEWS}, replies: {REPLIES}, lastpost: {LASTPOST} ]\n</span>\n</li>\n";
-
-$NEWFORUMPOSTSTYLE_FOOTER = "</ul>\n<br /><br />\n<span class='smalltext'>".NFPM_LAN_6.": <b>{TOTAL_TOPICS}</b> | ".NFPM_LAN_4.": <b>{TOTAL_REPLIES}</b> | ".NFPM_LAN_3.": <b>{TOTAL_VIEWS}</b></span>";
-
-
+$NEWFORUMPOSTSTYLE_HEADER = "
+<!-- newforumposts -->\n<ul>\n";
+
+$NEWFORUMPOSTSTYLE_MAIN = "<li><span class='smalltext'>{THREAD} by {POSTER} [ views: {VIEWS}, replies: {REPLIES}, lastpost: {LASTPOST} ]\n</span>\n</li>\n";
+
+$NEWFORUMPOSTSTYLE_FOOTER = "</ul>\n<br /><br />\n<span class='smalltext'>".NFPM_LAN_6.": <b>{TOTAL_TOPICS}</b> | ".NFPM_LAN_4.": <b>{TOTAL_REPLIES}</b> | ".NFPM_LAN_3.": <b>{TOTAL_VIEWS}</b></span>";
+
+
 ?>
\ No newline at end of file
diff -x .svn -aruN 0.7.16.src/e107_themes/khatru/news_template.php 0.7.17.src/e107_themes/khatru/news_template.php
--- 0.7.16.src/e107_themes/khatru/news_template.php	2005-12-14 13:28:30.000000000 -0600
+++ 0.7.17.src/e107_themes/khatru/news_template.php	2010-01-22 06:23:53.000000000 -0600
@@ -1,31 +1,31 @@
-<?php
-/*
-+ ----------------------------------------------------------------------------+
-|     e107 website system
-|
-|     Steve Dunstan 2001-2002
-|     http://e107.org
-|     jalist@e107.org
-|
-|     Released under the terms and conditions of the
-|     GNU General Public License (http://gnu.org).
-|
-+----------------------------------------------------------------------------+
-*/
-
+<?php
+/*
++ ----------------------------------------------------------------------------+
+|     e107 website system
+|
+|     Steve Dunstan 2001-2002
+|     http://e107.org
+|     jalist@e107.org
+|
+|     Released under the terms and conditions of the
+|     GNU General Public License (http://gnu.org).
+|
++----------------------------------------------------------------------------+
+*/
+
 if (!defined('e107_INIT')) { exit; }
 
-$NEWSCOLUMNS = 2;
-
-$NEWSCLAYOUT = "
-<table style='width: 100%;'>
-<tr>
-<td style='width: 48%; vertical-align: top;'>{ITEMS1}</td>
-<td style='width: 4%;'></td>
-<td style='width: 48%; vertical-align: top;'>{ITEMS2}</td>
-</tr>
-</table>
-";
-
-
+$NEWSCOLUMNS = 2;
+
+$NEWSCLAYOUT = "
+<table style='width: 100%;'>
+<tr>
+<td style='width: 48%; vertical-align: top;'>{ITEMS1}</td>
+<td style='width: 4%;'></td>
+<td style='width: 48%; vertical-align: top;'>{ITEMS2}</td>
+</tr>
+</table>
+";
+
+
 ?>
\ No newline at end of file
diff -x .svn -aruN 0.7.16.src/e107_themes/khatru/poll_template.php 0.7.17.src/e107_themes/khatru/poll_template.php
--- 0.7.16.src/e107_themes/khatru/poll_template.php	2005-12-14 13:28:30.000000000 -0600
+++ 0.7.17.src/e107_themes/khatru/poll_template.php	2010-01-22 06:23:53.000000000 -0600
@@ -1,157 +1,157 @@
-<?php
-
+<?php
+
 if (!defined('e107_INIT')) { exit; }
 
-$POLL_NOTVOTED_START = "
-<div style='text-align:center'>
-<p>
-{QUESTION}
-</p>
-</div>
-<p>
-<br />
-";
-
-$POLL_NOTVOTED_LOOP = "
-{OPTIONBUTTON}{OPTION}
-<br /><br />";
-
-$POLL_NOTVOTED_END = "
-</p>
-<div style='text-align:center' class='smalltext'>
-<p>
-{SUBMITBUTTON}
-<br /><br />
-{AUTHOR}
-<br />
-{VOTE_TOTAL} {COMMENTS}
-<br />
-{OLDPOLLS}
-</p>
-</div>";
-
-/* ################################# */
-/*		template for polls when user HAS voted ...			*/
-
-$POLL_VOTED_START = "
-<div style='text-align:center'>
-{QUESTION}
-</div>
-<br />
-";
-
-$POLL_VOTED_LOOP = "
-<b>{OPTION}</b>
-<br /><div class='spacer'>{BAR}</div><br />
-<span class='smalltext'>{VOTES} | {PERCENTAGE}</span>
-<br /><br />
-";
-
-$POLL_VOTED_END = "
-<div style='text-align:center' class='smalltext'>
-{AUTHOR}
-<br />
-{VOTE_TOTAL} {COMMENTS}
-<br />
-{OLDPOLLS}
-</div>
-";
-
-
-/* ################################# */
-/*		template for polls when user CANNOT vote ...		*/
-
-
-$POLL_DISALLOWED_START = "
-<div style='text-align:center'>
-{QUESTION}
-</div>
-<br />
-";
-
-$POLL_DISALLOWED_LOOP = "
-<b>{OPTION}</b>
-<br /><br />
-";
-
-$POLL_DISALLOWED_END = "
-<div style='text-align:center' class='smalltext'>
-{DISALLOWMESSAGE}<br /><br />
-{VOTE_TOTAL} {COMMENTS}
-<br />
-{OLDPOLLS}
-</div>
-";
-
-
-/* ################################# */
-/*		template for forum polls when user HASN'T voted*/
-
-$POLL_FORUM_NOTVOTED_START = "
-<div style='text-align:center; margin-left: auto; margin-right: auto;'>
-<table class='fborder' style='width: 350px;'>
-<tr>
-<td class='forumheader' style='width: 100%; text-align: center;'>
-<div id='pollquestion'>{QUESTION}</div>
-</td>
-</tr>
-<tr>
-<td class='forumheader3' style='width: 100%;'>";
-
-$POLL_FORUM_NOTVOTED_LOOP = "
-{OPTIONBUTTON}<b>{OPTION}</b>
-<br /><br />";
-
-$POLL_FORUM_NOTVOTED_END = "
-</td>
-</tr>
-
-<tr>
-<td class='forumheader' style='width: 100%;'>
-<div style='text-align:center' class='smalltext'>
-{SUBMITBUTTON}
-</div>
-</td>
-</tr>
-</table>
-</div>";
-
-
-/* ################################# */
-/*		template for forum polls when user HAS voted		*/
-
-$POLL_FORUM_VOTED_START = "
-<div style='text-align:center; margin-left: auto; margin-right: auto;'>
-<table class='fborder' style='width: 350px;'>
-<tr>
-<td class='forumheader' style='width: 100%; text-align: center;'>
-<div id='pollquestion'>{QUESTION}</div>
-</td>
-</tr>
-<tr>
-<td class='forumheader3' style='width: 100%;'>
-";
-
-$POLL_FORUM_VOTED_LOOP = "
-<b>{OPTION}</b>
-<br />{BAR}<br />
-<span class='smalltext'>{VOTES} | {PERCENTAGE}</span>
-<br /><br />
-";
-
-$POLL_FORUM_VOTED_END = "
-</td>
-</tr>
-
-<tr>
-<td class='forumheader' style='width: 100%;'>
-<div style='text-align:center' class='smalltext'>
-{VOTE_TOTAL}
-</div>
-</td>
-</tr>
-</table>
-</div>
-";
-
+$POLL_NOTVOTED_START = "
+<div style='text-align:center'>
+<p>
+{QUESTION}
+</p>
+</div>
+<p>
+<br />
+";
+
+$POLL_NOTVOTED_LOOP = "
+{OPTIONBUTTON}{OPTION}
+<br /><br />";
+
+$POLL_NOTVOTED_END = "
+</p>
+<div style='text-align:center' class='smalltext'>
+<p>
+{SUBMITBUTTON}
+<br /><br />
+{AUTHOR}
+<br />
+{VOTE_TOTAL} {COMMENTS}
+<br />
+{OLDPOLLS}
+</p>
+</div>";
+
+/* ################################# */
+/*		template for polls when user HAS voted ...			*/
+
+$POLL_VOTED_START = "
+<div style='text-align:center'>
+{QUESTION}
+</div>
+<br />
+";
+
+$POLL_VOTED_LOOP = "
+<b>{OPTION}</b>
+<br /><div class='spacer'>{BAR}</div><br />
+<span class='smalltext'>{VOTES} | {PERCENTAGE}</span>
+<br /><br />
+";
+
+$POLL_VOTED_END = "
+<div style='text-align:center' class='smalltext'>
+{AUTHOR}
+<br />
+{VOTE_TOTAL} {COMMENTS}
+<br />
+{OLDPOLLS}
+</div>
+";
+
+
+/* ################################# */
+/*		template for polls when user CANNOT vote ...		*/
+
+
+$POLL_DISALLOWED_START = "
+<div style='text-align:center'>
+{QUESTION}
+</div>
+<br />
+";
+
+$POLL_DISALLOWED_LOOP = "
+<b>{OPTION}</b>
+<br /><br />
+";
+
+$POLL_DISALLOWED_END = "
+<div style='text-align:center' class='smalltext'>
+{DISALLOWMESSAGE}<br /><br />
+{VOTE_TOTAL} {COMMENTS}
+<br />
+{OLDPOLLS}
+</div>
+";
+
+
+/* ################################# */
+/*		template for forum polls when user HASN'T voted*/
+
+$POLL_FORUM_NOTVOTED_START = "
+<div style='text-align:center; margin-left: auto; margin-right: auto;'>
+<table class='fborder' style='width: 350px;'>
+<tr>
+<td class='forumheader' style='width: 100%; text-align: center;'>
+<div id='pollquestion'>{QUESTION}</div>
+</td>
+</tr>
+<tr>
+<td class='forumheader3' style='width: 100%;'>";
+
+$POLL_FORUM_NOTVOTED_LOOP = "
+{OPTIONBUTTON}<b>{OPTION}</b>
+<br /><br />";
+
+$POLL_FORUM_NOTVOTED_END = "
+</td>
+</tr>
+
+<tr>
+<td class='forumheader' style='width: 100%;'>
+<div style='text-align:center' class='smalltext'>
+{SUBMITBUTTON}
+</div>
+</td>
+</tr>
+</table>
+</div>";
+
+
+/* ################################# */
+/*		template for forum polls when user HAS voted		*/
+
+$POLL_FORUM_VOTED_START = "
+<div style='text-align:center; margin-left: auto; margin-right: auto;'>
+<table class='fborder' style='width: 350px;'>
+<tr>
+<td class='forumheader' style='width: 100%; text-align: center;'>
+<div id='pollquestion'>{QUESTION}</div>
+</td>
+</tr>
+<tr>
+<td class='forumheader3' style='width: 100%;'>
+";
+
+$POLL_FORUM_VOTED_LOOP = "
+<b>{OPTION}</b>
+<br />{BAR}<br />
+<span class='smalltext'>{VOTES} | {PERCENTAGE}</span>
+<br /><br />
+";
+
+$POLL_FORUM_VOTED_END = "
+</td>
+</tr>
+
+<tr>
+<td class='forumheader' style='width: 100%;'>
+<div style='text-align:center' class='smalltext'>
+{VOTE_TOTAL}
+</div>
+</td>
+</tr>
+</table>
+</div>
+";
+
 ?>
\ No newline at end of file
diff -x .svn -aruN 0.7.16.src/e107_themes/newsroom/style.css 0.7.17.src/e107_themes/newsroom/style.css
--- 0.7.16.src/e107_themes/newsroom/style.css	2006-11-09 02:34:04.000000000 -0600
+++ 0.7.17.src/e107_themes/newsroom/style.css	2010-01-22 06:23:53.000000000 -0600
@@ -99,7 +99,7 @@
 }
 
 .newsroomHilite {
-	background-color: #c00;
+	background-color: black;
 	color: #fff;
 	cursor: pointer;
 }
diff -x .svn -aruN 0.7.16.src/e107_themes/reline/admin_template.php 0.7.17.src/e107_themes/reline/admin_template.php
--- 0.7.16.src/e107_themes/reline/admin_template.php	2009-08-03 14:40:20.000000000 -0500
+++ 0.7.17.src/e107_themes/reline/admin_template.php	2010-01-22 07:50:04.000000000 -0600
@@ -3,7 +3,7 @@
 + ----------------------------------------------------------------------------+
 |     e107 website system
 |
-|     Steve Dunstan 2001-2002
+|     Steve Dunstan 2001-2002
 |     http://e107.org
 |     jalist@e107.org
 |
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_themes/reline/admin_template.php,v $
-|     $Revision: 1.2 $
-|     $Date: 2009/08/03 19:40:44 $
-|     $Author: marj_nl_fr $
+|     $Revision: 1.3 $
+|     $Date: 2010/01/22 13:50:28 $
+|     $Author: secretr $
 +----------------------------------------------------------------------------+
 */
 
@@ -69,14 +69,18 @@
 
 <tr><td class='bottom_left_menu_area'>
 {SETSTYLE=bottom_left_menu}
+".(e_PAGE != 'admin.php' ? '{ADMIN_UPDATE} ' : '')."
 {ADMIN_LANG}
 {ADMIN_PWORD}
 {ADMIN_MSG}
 {ADMIN_PLUGINS}";
 
-if ($prehelp!='') {
+if ($prehelp!='')
+{
 	$ADMIN_HEADER .= $prehelp;
-} else {
+}
+else
+{
 	$ADMIN_HEADER .= "{ADMIN_SITEINFO}";
 }
 
@@ -100,9 +104,12 @@
 <img class='cube_image' src='".THEME_ABS."images/cube.png' alt='' />
 </div>";
 
-if (ADMIN) {
+if (ADMIN) 
+{
 	$ADMIN_HEADER .= "{ADMIN_ALT_NAV=exit=off}";
-} else {
+} 
+else 
+{
 	$ADMIN_HEADER .= "<br />";
 }
 
diff -x .svn -aruN 0.7.16.src/e107_themes/templates/admin_template.php 0.7.17.src/e107_themes/templates/admin_template.php
--- 0.7.16.src/e107_themes/templates/admin_template.php	2009-08-03 14:40:20.000000000 -0500
+++ 0.7.17.src/e107_themes/templates/admin_template.php	2010-01-22 07:50:03.000000000 -0600
@@ -3,7 +3,7 @@
 + ----------------------------------------------------------------------------+
 |     e107 website system
 |
-|     Steve Dunstan 2001-2002
+|     Steve Dunstan 2001-2002
 |     http://e107.org
 |     jalist@e107.org
 |
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_themes/templates/admin_template.php,v $
-|     $Revision: 1.16 $
-|     $Date: 2009/08/03 19:40:44 $
-|     $Author: marj_nl_fr $
+|     $Revision: 1.18 $
+|     $Date: 2010/01/22 13:50:27 $
+|     $Author: secretr $
 +----------------------------------------------------------------------------+
 */
 
@@ -28,6 +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_NAV}
 {ADMIN_LANG}
 {ADMIN_PWORD}
@@ -45,7 +46,7 @@
 <td style='width:17%; vertical-align:top'>
 {ADMIN_MENU}
 {ADMIN_PRESET}
-{ADMIN_UPDATE}
+
 {ADMIN_SITEINFO}
 {ADMIN_DOCS}
 </td>
diff -x .svn -aruN 0.7.16.src/e107_themes/templates/banner_template.php 0.7.17.src/e107_themes/templates/banner_template.php
--- 0.7.16.src/e107_themes/templates/banner_template.php	2008-05-03 14:39:52.000000000 -0500
+++ 0.7.17.src/e107_themes/templates/banner_template.php	2010-01-02 11:00:45.000000000 -0600
@@ -1,9 +1,10 @@
 <?php
-// $Id: banner_template.php,v 1.7 2008/05/03 19:40:15 e107steved Exp $
+// $Id: banner_template.php,v 1.8 2010/01/02 17:01:09 e107steved Exp $
 
 if (!defined('e107_INIT')) { exit; }
 if (!defined("USER_WIDTH")){ define("USER_WIDTH","width:98%"); }
 
+include_lan(e_LANGUAGEDIR.e_LANGUAGE."/lan_banner.php");
 // ##### LOGIN TABLE -------------------------------------------------------------------------------
 global $BANNER_LOGIN_TABLE;
 if(!isset($BANNER_LOGIN_TABLE))
diff -x .svn -aruN 0.7.16.src/e107_themes/templates/download_template.php 0.7.17.src/e107_themes/templates/download_template.php
--- 0.7.16.src/e107_themes/templates/download_template.php	2007-09-20 06:07:51.000000000 -0500
+++ 0.7.17.src/e107_themes/templates/download_template.php	2010-01-20 21:57:20.000000000 -0600
@@ -3,7 +3,7 @@
 + ----------------------------------------------------------------------------+
 |     e107 website system
 |
-|     Steve Dunstan 2001-2002
+|     �Steve Dunstan 2001-2002
 |     http://e107.org
 |     jalist@e107.org
 |
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_themes/templates/download_template.php,v $
-|     $Revision: 1.18 $
-|     $Date: 2007/09/20 11:08:14 $
-|     $Author: e107coders $
+|     $Revision: 1.20 $
+|     $Date: 2010/01/21 03:57:44 $
+|     $Author: mcfly_e107 $
 +----------------------------------------------------------------------------+
 */
 if (!defined('e107_INIT')) { exit; }
@@ -249,6 +249,9 @@
 $sc_style['DOWNLOAD_VIEW_AUTHORWEBSITE']['pre'] = "<td style='width:80%' class='forumheader3'>";
 $sc_style['DOWNLOAD_VIEW_AUTHORWEBSITE']['post'] = "</td></tr>";
 
+$sc_style['DOWNLOAD_REPORT_LINK']['pre'] = "<tr><td style='width:20%' class='forumheader3' colspan='2'>";
+$sc_style['DOWNLOAD_REPORT_LINK']['post'] = "</td></tr>";
+
 if(!isset($DOWNLOAD_VIEW_TABLE))
 {
 		$DOWNLOAD_VIEW_TABLE = "
@@ -304,9 +307,7 @@
 		<td style='width:80%' class='forumheader3'>{DOWNLOAD_VIEW_RATING}</td>
 		</tr>
 
-		<tr>
-		<td style='width:20%' class='forumheader3' colspan='2'>{DOWNLOAD_REPORT_LINK}</td>
-		</tr>
+		{DOWNLOAD_REPORT_LINK}
 		</table>
 		<div style='text-align:right; ".USER_WIDTH."; margin-left: auto; margin-right: auto'>{DOWNLOAD_ADMIN_EDIT}</div>
 		</div>\n";
diff -x .svn -aruN 0.7.16.src/e107_themes/templates/footer_default.php 0.7.17.src/e107_themes/templates/footer_default.php
--- 0.7.16.src/e107_themes/templates/footer_default.php	2009-07-11 22:27:57.000000000 -0500
+++ 0.7.17.src/e107_themes/templates/footer_default.php	2009-12-10 14:22:51.000000000 -0600
@@ -11,16 +11,16 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_themes/templates/footer_default.php,v $
-|     $Revision: 1.54 $
-|     $Date: 2009/07/12 03:28:21 $
-|     $Author: e107coders $
+|     $Revision: 1.55 $
+|     $Date: 2009/12/10 20:23:15 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 if (!defined('e107_INIT')) { exit; }
 $In_e107_Footer = TRUE;	// For registered shutdown function
 
-global $eTraffic, $error_handler, $db_time, $sql, $sql2, $mySQLserver, $mySQLuser, $mySQLpassword, $mySQLdefaultdb, $CUSTOMFOOTER, $FOOTER, $e107;
-
+global $eTraffic, $error_handler, $db_time, $sql, $sql2, $mySQLserver, $mySQLuser, $mySQLpassword, $mySQLdefaultdb, $CUSTOMFOOTER, $FOOTER, $e107, $e107ParseHeaderFlag, $e107CustomFooter;
+global $pref;
 //
 // SHUTDOWN SEQUENCE
 //
@@ -62,7 +62,7 @@
 	//
 	// B Send footer template
 	//
-	parseheader(($ph ? $cust_footer : $FOOTER));
+	parseheader(($e107ParseHeaderFlag ? $e107CustomFooter : $FOOTER));
 
 	//
 	// C Dump all debug and traffic information
diff -x .svn -aruN 0.7.16.src/e107_themes/templates/header_default.php 0.7.17.src/e107_themes/templates/header_default.php
--- 0.7.16.src/e107_themes/templates/header_default.php	2009-07-13 05:17:17.000000000 -0500
+++ 0.7.17.src/e107_themes/templates/header_default.php	2010-01-08 18:01:23.000000000 -0600
@@ -6,9 +6,9 @@
 |     Released under the terms and conditions of the GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_themes/templates/header_default.php,v $
-|     $Revision: 1.112 $
-|     $Date: 2009/07/13 10:17:41 $
-|     $Author: marj_nl_fr $
+|     $Revision: 1.114 $
+|     $Date: 2010/01/09 00:01:47 $
+|     $Author: e107coders $
 +-----------------------------------------------------------------------------------------------+
 */
 
@@ -83,7 +83,7 @@
 //
 // C: Send start of HTML
 //
-echo "<html xmlns='http://www.w3.org/1999/xhtml'".(defined("TEXTDIRECTION") ? " dir='".TEXTDIRECTION."'" : "").(defined("CORE_LC") ? " xml:lang=\"".CORE_LC."\"" : "").">
+echo "<html xmlns='http://www.w3.org/1999/xhtml'".(defined("TEXTDIRECTION") ? " dir='".TEXTDIRECTION."'" : "").(defined("XMLNS") ? " ".XMLNS." " : "").(defined("CORE_LC") ? " xml:lang=\"".CORE_LC."\"" : "").">
 <head>
 <meta http-equiv='content-type' content='text/html; charset=".CHARSET."' />
 <meta http-equiv='content-style-type' content='text/css' />
@@ -391,27 +391,36 @@
 		$custompage['no_array'] = array();
 	}
 
-	$ph = FALSE;
-	if (e_PAGE == 'news.php' && isset($NEWSHEADER)) {
+	$e107ParseHeaderFlag = FALSE;				// Deliberately choose a distinct Name! (Its got to reach the footer)
+	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 ($cust_extract as $key => $kpage) {
-				if ($kpage && (strstr(e_SELF, $kpage) || strstr($full_query,$kpage))) {
-					$ph = TRUE;
-					if ($key_extract=='no_array') {
+		foreach ($custompage as $key_extract => $cust_extract) 
+		{
+			foreach ($cust_extract as $key => $kpage) 
+			{
+				if ($kpage && (strstr(e_SELF, $kpage) || strstr($full_query,$kpage))) 
+				{
+					$e107ParseHeaderFlag = TRUE;
+					if ($key_extract=='no_array') 
+					{
 						$cust_header = $CUSTOMHEADER ? $CUSTOMHEADER : $HEADER;
-						$cust_footer = $CUSTOMFOOTER ? $CUSTOMFOOTER : $FOOTER;
-					} else {
+						$e107CustomFooter = $CUSTOMFOOTER ? $CUSTOMFOOTER : $FOOTER;
+					} 
+					else 
+					{
 						$cust_header = $CUSTOMHEADER[$key_extract] ? $CUSTOMHEADER[$key_extract] : $HEADER;
-						$cust_footer = $CUSTOMFOOTER[$key_extract] ? $CUSTOMFOOTER[$key_extract] : $FOOTER;
+						$e107CustomFooter = $CUSTOMFOOTER[$key_extract] ? $CUSTOMFOOTER[$key_extract] : $FOOTER;	// Another intentionally distinct name
 					}
 					break;
 				}
 			}
 		}
-		parseheader(($ph ? $cust_header : $HEADER));
+		parseheader(($e107ParseHeaderFlag ? $cust_header : $HEADER));
 	}
 
 
@@ -436,4 +445,4 @@
 
 	unset($text);
 }
-?>
+?>
\ No newline at end of file
diff -x .svn -aruN 0.7.16.src/e107_themes/templates/login_template.php 0.7.17.src/e107_themes/templates/login_template.php
--- 0.7.16.src/e107_themes/templates/login_template.php	2007-12-06 15:35:39.000000000 -0600
+++ 0.7.17.src/e107_themes/templates/login_template.php	2009-12-15 16:11:47.000000000 -0600
@@ -1,12 +1,12 @@
 <?php
-// $Id: login_template.php,v 1.8 2007/12/06 21:36:02 e107steved Exp $
+// $Id: login_template.php,v 1.12 2009/12/15 22:12:11 e107steved Exp $
 
 if (!defined('e107_INIT')) { exit; }
 
 // ##### LOGIN HEADER TABLE -----------------------------------------------------------------------
 if(!isset($LOGIN_TABLE_HEADER))
 {
-	$LOGIN_TABLE_HEADER .= "
+	$LOGIN_TABLE_HEADER = "
 	<div style='width:100%;text-align:center; margin-left: auto;margin-right: auto'><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" );
@@ -15,9 +15,14 @@
 // ##### LOGIN TABLE -----------------------------------------------------------------------------
 if(!isset($LOGIN_TABLE))
 {
-		$LOGIN_TABLE = "";
-		if($LOGIN_TABLE_LOGINMESSAGE != ""){
-				$LOGIN_TABLE .= "<div style='text-align:center'>{LOGIN_TABLE_LOGINMESSAGE}</div>";
+		$LOGIN_TABLE = '';
+		if($LOGIN_TABLE_LOGINMESSAGE != '')
+		{
+			$LOGIN_TABLE .= "<div style='text-align:center'>{LOGIN_TABLE_LOGINMESSAGE}</div>";
+		}
+		if (!isset($LOGIN_TABLE_SECIMG_SECIMG))
+		{
+			$LOGIN_TABLE_SECIMG_SECIMG = FALSE;
 		}
 		$LOGIN_TABLE .= "
 		<div style='text-align:center'>
@@ -38,7 +43,7 @@
 			<div style='width:70%;margin-right:auto;margin-left:auto'>
 				<div style='text-align:center'><br />
 					{LOGIN_TABLE_FOOTER_USERREG}
-					&nbsp;&nbsp;&nbsp;<a href='fpw.php'>".LAN_LOGIN_12."</a>
+					&nbsp;&nbsp;&nbsp;<a href='".e_BASE."fpw.php'>".LAN_LOGIN_12."</a>
 				</div>
 			</div>
 		</div>
diff -x .svn -aruN 0.7.16.src/e107_themes/templates/signup_template.php 0.7.17.src/e107_themes/templates/signup_template.php
--- 0.7.16.src/e107_themes/templates/signup_template.php	2008-07-30 15:13:39.000000000 -0500
+++ 0.7.17.src/e107_themes/templates/signup_template.php	2009-11-24 14:07:40.000000000 -0600
@@ -11,8 +11,8 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/e107_themes/templates/signup_template.php,v $
-|     $Revision: 1.14 $
-|     $Date: 2008/07/30 20:14:02 $
+|     $Revision: 1.15 $
+|     $Date: 2009/11/24 20:08:04 $
 |     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
@@ -165,7 +165,7 @@
 
 if(!isset($COPPA_TEMPLATE))
 {
-$COPPA_TEMPLATE = LAN_109." <a href='http://www.cdt.org/legislation/105th/privacy/coppa.html'>".LAN_SIGNUP_14."</a>. ".LAN_SIGNUP_15." ".js_obfuscate(SITEADMINEMAIL).LAN_SIGNUP_14."</a> ".LAN_SIGNUP_16."
+$COPPA_TEMPLATE = LAN_109." <a href='http://www.ftc.gov/privacy/coppafaqs.shtm'>".LAN_SIGNUP_14."</a>. ".LAN_SIGNUP_15." ".js_obfuscate(SITEADMINEMAIL).LAN_SIGNUP_14."</a> ".LAN_SIGNUP_16."
 <br />
 <br />
 <div style='text-align:center'><b>".LAN_SIGNUP_17."</b>
diff -x .svn -aruN 0.7.16.src/email.php 0.7.17.src/email.php
--- 0.7.16.src/email.php	2007-01-07 09:24:25.000000000 -0600
+++ 0.7.17.src/email.php	2009-11-03 16:07:39.000000000 -0600
@@ -11,19 +11,24 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/email.php,v $
-|     $Revision: 1.21 $
-|     $Date: 2007/01/07 15:24:48 $
+|     $Revision: 1.24 $
+|     $Date: 2009/11/03 22:08:03 $
 |     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
-require_once("class2.php");
+require_once('class2.php');
+if (!check_class(varset($pref['email_item_class'],e_UC_MEMBER)))
+{
+	header('Location: '.e_BASE.'index.php');
+	exit();
+}
 require_once(HEADERF);
 
 $use_imagecode = FALSE;
-$imgtypes = array("jpeg", "png", "gif");
+$imgtypes = array('jpeg', 'png', 'gif');
 foreach($imgtypes as $t)
 {
-	if(function_exists("imagecreatefrom".$t))
+	if(function_exists('imagecreatefrom'.$t))
 	{
 		$use_imagecode = TRUE;
 	}
@@ -31,24 +36,31 @@
 
 if ($use_imagecode)
 {
-	require_once(e_HANDLER."secure_img_handler.php");
+	require_once(e_HANDLER.'secure_img_handler.php');
 	$sec_img = new secure_image;
 }
 
-$qs = explode(".", e_QUERY, 2);
-if ($qs[0] == "")
+if (e_QUERY)
+{
+	$qs = explode('.', e_QUERY, 2);
+}
+else
 {
-	header("location:".e_BASE."index.php");
+	header('location:'.e_BASE.'index.php');
 	exit;
 }
 $source = $qs[0];
-$parms = $qs[1];
-
-$emailurl = ($source == "referer") ? $_SERVER['HTTP_REFERER'] : SITEURL;
-
-$comments = $tp->post_toHTML($_POST['comment'], TRUE, 'retain_nl, emotes_off, no_make_clickable');
-$author = $tp->post_toHTML($_POST['author_name'],FALSE,"emotes_off, no_make_clickable");
-$email_send = check_email($_POST['email_send']);
+$parms = varset($qs[1], '');
+unset($qs);
+$error = '';
+$message = '';
+
+$referrer = strip_tags(urldecode(html_entity_decode(varset($_SERVER['HTTP_REFERER'],''), ENT_QUOTES)));
+$emailurl = ($source == 'referer') ? $referrer : SITEURL;
+
+$comments = $tp->post_toHTML(varset($_POST['comment'],''), TRUE, 'retain_nl, emotes_off, no_make_clickable');
+$author = $tp->post_toHTML(varset($_POST['author_name'],''),FALSE,'emotes_off, no_make_clickable');
+$email_send = check_email(varset($_POST['email_send'],''));
 
 
 if (isset($_POST['emailsubmit']))
@@ -62,19 +74,19 @@
 	{
 		if(!isset($_POST['code_verify']) || !isset($_POST['rand_num']))
 		{
-			header("location:".e_BASE."index.php");
+			header('location:'.e_BASE.'index.php');
 			exit;
 		}
 		if (!$sec_img->verify_code($_POST['rand_num'], $_POST['code_verify']))
 		{
-			header("location:".e_BASE."index.php");
+			header('location:'.e_BASE.'index.php');
 			exit;
 		}
 	}
 
-	if ($comments == "")
+	if ($comments == '')
 	{
-		$message = LAN_EMAIL_188." ".SITENAME." (".SITEURL.")";
+		$message = LAN_EMAIL_188.' '.SITENAME.' ('.SITEURL.')';
 		if (USER == TRUE)
 		{
 			$message .= "\n\n".LAN_EMAIL_1." ".USERNAME;
@@ -86,44 +98,44 @@
 	}
 	else
 	{
-		$message .= $comments;
+		$message .= $comments."\n";
 	}
 	$ip = $e107->getip();
 	$message .= "\n\n".LAN_EMAIL_2." ".$ip."\n\n";
 
-	if(strpos($source,'plugin:') !== FALSE)
+	if (substr($source,0,7) == 'plugin:')
 	{
 		$plugin = substr($source,7);
-		$text = "";
-		if(file_exists(e_PLUGIN.$plugin."/e_emailprint.php"))
+		$text = '';
+		if(file_exists(e_PLUGIN.$plugin.'/e_emailprint.php'))
 		{
-			include_once(e_PLUGIN.$plugin."/e_emailprint.php");
+			include_once(e_PLUGIN.$plugin.'/e_emailprint.php');
 			$text = email_item($parms);
 			$emailurl = SITEURL;
 		}
-		if($text == "")
+		if($text == '')
 		{
-			header("location:".e_BASE."index.php");
+			header('location:'.e_BASE.'index.php');
 			exit;
 		}
 		$message .= $text;
 	}
-	elseif($source == "referer")
+	elseif($source == 'referer')
 	{
 		if(!isset($_POST['referer']) || $_POST['referer'] == '')
 		{
-			header("location:".e_BASE."index.php");
+			header('location:'.e_BASE.'index.php');
 			exit;
 		}
-		$message .= $_POST['referer'];
-		$emailurl = $_POST['referer'];
+		$message .= strip_tags($_POST['referer']);
+		$emailurl = strip_tags($_POST['referer']);
 	}
 	else
 	{
-
-		$emailurl = $_POST['referer'];
-        $message = "";
-        if($sql->db_Select("news", "*", "news_id='".intval($parms)."'"))
+		$emailurl = strip_tags($_POST['referer']);
+        $message = '';
+		$parms = intval($parms);
+        if($sql->db_Select('news', '*', 'news_id='.$parms))
         {
             list($news_id, $news_title, $news_body, $news_extended, $news_datestamp, $news_author, $news_source, $news_url, $news_category, $news_allow_comments) = $sql->db_Fetch();
 			$message = "<h3 class='email_heading'>".$news_title."</h3><br />".$news_body."<br />".$news_extended."<br /><br /><a href='{e_BASE}news.php?extend.".$parms."'>{e_BASE}news.php?extend.".$parms."</a><br />";
@@ -131,20 +143,19 @@
 
         }
 
-		if($message == "")
+		if($message == '')
 		{
-			header("location:".e_BASE."index.php");
+			header('location:'.e_BASE.'index.php');
 			exit;
 		}
 	}
 
-	if ($error == "")
+	if ($error == '')
 	{
-
 	    // Load Mail Handler and Email Template.
-		require_once(e_HANDLER."mail.php");
+		require_once(e_HANDLER.'mail.php');
 	    $email_body = $EMAIL_HEADER;
-		$email_body .= (trim($comments) != "") ? $tp->toEmail($comments)."<hr />" : "";
+		$email_body .= (trim($comments) != '') ? $tp->toEmail($comments).'<hr />' : '';
 		$email_body .= $tp->toEmail($message).$EMAIL_FOOTER;
 
 		if (sendemail($email_send, LAN_EMAIL_3.SITENAME,$email_body))
@@ -205,20 +216,20 @@
 	</tr>
 	";
 
-	if($use_imagecode)
-	{
-		$text .= "<tr><td>".LAN_EMAIL_190."</td><td>";
-		$text .= $sec_img->r_image();
-		$text .= " <input class='tbox' type='text' name='code_verify' size='15' maxlength='20' />
-			<input type='hidden' name='rand_num' value='".$sec_img->random_number."' /></td></tr>";
-	}
+if($use_imagecode)
+{
+	$text .= "<tr><td>".LAN_EMAIL_190."</td><td>";
+	$text .= $sec_img->r_image();
+	$text .= " <input class='tbox' type='text' name='code_verify' size='15' maxlength='20' />
+		<input type='hidden' name='rand_num' value='".$sec_img->random_number."' /></td></tr>";
+}
 
 $text .= "
 	<tr style='vertical-align:top'>
 	<td style='width:25%'></td>
 	<td style='width:75%'>
 	<input class='button' type='submit' name='emailsubmit' value='".LAN_EMAIL_4."' />
-	<input type='hidden' name='referer' value='".$_SERVER['HTTP_REFERER']."' />
+	<input type='hidden' name='referer' value='".$referrer."' />
 </td>
 	</tr>
 	</table>
diff -x .svn -aruN 0.7.16.src/favicon.ico 0.7.17.src/favicon.ico
--- 0.7.16.src/favicon.ico	2005-04-01 01:11:27.000000000 -0600
+++ 0.7.17.src/favicon.ico	2010-01-22 06:23:53.000000000 -0600
@@ -1,12 +1,4 @@
-        h  f        h            6
-             00      #  00     %  .2  (                                                        ʦ     			   """ --- 000 ;;; @@@ HHH PPP XXX ``` hhh ppp yyy            T@ >@        	K  ( jK         			      """ $$$ --- /// 000 111 222 333 777 ;;; <<< === @@@ BBB EEE FFF GGG HHH JJJ KKK LLL MMM NNN OOO PPP QQQ RRR TTT UUU VVV WWW XXX \\\ ]]] ``` aaa bbb ccc ddd eee fff ggg hhh iii jjj lll nnn ppp qqq rrr sss ttt www yyy zzz {{{ }}} ~~~                                                                                                                                                     K        !                        "               
         
     !!       #""#         $$                                 ?                          ?    (                                                                  	                                          0```aaaB                                 wnnnXXXcccjjjeeeqqqͅ                     0UUUdddhhhTTTLLLnnnwwwddd5          ^```UUUqqqdddWWWHHH333KKKjjjpppyyyf       QQQ{{{aaaVVVMMM;;;222LLLfffttt        TTTgggVVVLLL@@@000333LLLjjjnnn        {{{FFF]]]KKK===777<<<///			222PPPVVV        www<<<OOO;;;EEEQQQRRRUUUNNN"""111BBB        ttt---JJJbbbhhheeeggggggiiilllJJJ$$$        ggg777~~~{{{{{{zzz}}}222       @GGGhhhtttwwwb          rrrLLLddd'                      XJJJ嗗aaam                                 hhh}}}yyy+                                             \\\sss                                                          (       @                                                 ʦ        !!! ((( 222 999 @@@ HHH PPP XXX ``` hhh ppp xxx                     	K  ( jK         			      """ $$$ --- /// 000 111 222 333 777 ;;; <<< === @@@ BBB EEE FFF GGG HHH JJJ KKK LLL MMM NNN OOO PPP QQQ RRR TTT UUU VVV WWW XXX \\\ ]]] ``` aaa bbb ccc ddd eee fff ggg hhh iii jjj lll nnn ppp qqq rrr sss ttt www yyy zzz {{{ }}} ~~~                                                                                                                                                     K                                              (&                         #!                       '                   #                 '             $#                   $$     ##                  
      
                           
     

          #             !! $         !!!!             ##########!#               !$$%%$$$$                   
&&&&&%#                     %''#                       !                                                                          ?                                      ?  ?(       @                                                                                   Butd                                                                                                          UUUQQQ                                                                                         +˿hhhJJJbbbgggOOO^^^R                                                                                 uLLLSSSiiihhhqqqsss[[[OOO                                                                 ,ϿeeeBBB```mmmggg___aaasss{{{iiiNNNeee>                                                          tEEEMMMlllnnneee```YYYUUUbbbqqqyyyZZZQQQ                                             ,ѿccc<<<^^^sssllleee```[[[SSSIIIVVVbbboookkkOOOlllA                                  u:::CCCmmmtttkkkeee```ZZZVVVMMM<<<HHHVVVbbbnnn}}}}}}XXXTTTy                     )YYY+++WWWxxxsssjjjeee```ZZZUUUPPPGGG///;;;IIIUUUbbbnnn{{{kkkNNNttt&             ȣ...222lll{{{pppjjjeee```ZZZUUUPPPKKKAAA"""...<<<HHHUUUbbbooo{{{WWWYYY             ###}}}zzzooojjjeee```ZZZUUUOOOJJJFFF:::!!!...;;;HHHUUUbbbooo{{{TTT              )))zzzoookkkeee___ZZZUUUOOOJJJDDD@@@444			!!!...;;;HHHUUUbbbooo{{{XXX              }}}###ssskkkeee```ZZZUUUOOOJJJDDD>>>;;;///!!!...;;;HHHUUUbbbnnn{{{UUU              |||nnneee___ZZZTTTOOOJJJDDD>>>999333---   !!!---;;;HHHUUUaaaooozzzSSS              zzziii___ZZZTTTOOOJJJDDD???999222333999222   !!!...;;;HHHUUUaaannnQQQ              xxxcccZZZTTTOOOIIIDDD???777555===CCCBBBDDDEEE'''!!!...:::GGGTTTbbbOOO              vvv^^^TTTOOOJJJEEE>>>777>>>KKKMMMLLLLLLLLLLLLQQQ@@@   """---:::GGGVVVMMM              uuuXXXNNNJJJEEE;;;;;;LLLXXXWWWVVVWWWWWWWWWWWWUUUZZZWWW+++"""---999JJJKKK              sssRRRJJJCCC;;;FFF]]]ccc```aaaaaaaaaaaaaaaaaaaaa``````gggLLL!!!--->>>III              qqqNNN@@@@@@ZZZuuuooohhhjjjllllllllllllllllllllllllllljjjpppjjj444


444GGG              pppBBBOOOrrryyyssstttvvvvvvvvvvvvvvvvvvvvvvvvuuuwww}}}ZZZFFF              ggg   sss}}}GGG>>>              u(((ZZZJJJ                h...eeexxxAAAdddԩ                      #uuu   777VVV===]                                       ~$$$


444XXXϬ                                            4ggg   MMMQQQ(((`                                                             """BBBɩ                                                                    8YYY   gggPPP~~~^                                                                                     


'''---¿+                                                                                             LIIImmmx                                                                                                        iiiM                                                       ?                                               ?(   0   `          	                                       ʦ            ((( 000 888 @@@ HHH PPP XXX ``` hhh ppp xxx                     	K  ( jK         			      """ $$$ --- /// 000 111 222 333 777 ;;; <<< === @@@ BBB EEE FFF GGG HHH JJJ KKK LLL MMM NNN OOO PPP QQQ RRR TTT UUU VVV WWW XXX \\\ ]]] ``` aaa bbb ccc ddd eee fff ggg hhh iii jjj lll nnn ppp qqq rrr sss ttt www yyy zzz {{{ }}} ~~~                                                                                                                                                     K                                                                      '#                                         !(                                     '$                                   (                               '%                              )                         (&                       #!)                   ('                 #)             ('           ##        ))      !
       

      
       
        
         
         
      
   
         
       
  
         
       
 
         
       
 
       
       

                            !                   )          !         !!  $              !!!!!!!!!!!!!  (                 !##! #                    !!##############!!(                      
#$$$$$$$$$$#!                           ##%%%%%%%%##
(                          
 $$%&&&&%$#
                                #%%''%% '                                 &&&%!                                     & '                                       
                                           # &                                            )                                                               ?                                                                                                                                                      ?                     ?              ?  (   0   `           $                                                                                                        CAAC2                                                                                                                                                                 MٍZZZSSSrrrk                                                                                                                                                         lgggNNNWWWYYYSSSYYY                                                                                                                                           +꿑QQQQQQZZZfffhhh[[[XXXQQQyyy_                                                                                                                                 ohhhJJJSSS^^^hhhiiitttrrr___ZZZTTT]]],                                                                                                                3NNNJJJVVVdddlllgggccchhhuuuzzziiiZZZXXXRRRj                                                                                                          {gggFFFOOO[[[kkklllfffccc___aaaiiisss~~~ttt___[[[TTTbbb                                                                                         #𿕕LLLEEERRRcccoookkkfffccc```ZZZXXXaaajjjqqq~~~jjj[[[XXXUUUF                                                                                 rhhh@@@HHHXXXmmmpppjjjfffccc___\\\WWWPPPXXXaaajjjqqq{{{xxx___[[[SSSggg                                                                  (ŗIII@@@LLLcccsssoooiiigggccc___\\\YYYRRRGGGPPPYYYaaajjjqqqyyyjjjZZZXXXVVVQ                                                         ieee999AAAUUUoootttmmmjjjgggccc___\\\XXXUUUOOO???GGGPPPYYYaaaiiirrryyyzzz^^^[[[UUUnnn                                             4@@@444CCCaaawwwsssllljjjgggccc___[[[XXXTTTRRRJJJ666>>>GGGPPPXXX```iiiqqqzzziii[[[XXXYYY4                                  sbbb---333KKKoooyyyqqqmmmjjjfffccc___[[[XXXTTTQQQNNNFFF...555???GGGPPPXXX```iiiqqqzzz{{{^^^[[[UUUttts                           555'''777\\\zzzwwwpppmmmjjjgggccc___[[[XXXTTTQQQMMMKKKBBB%%%---666???GGGOOOXXX```iiirrrzzzhhh[[[XXXZZZ                     ###)))BBBooo~~~tttpppnnnjjjfffccc___\\\XXXUUUQQQMMMIIIHHH>>>$$$...666???GGGOOOXXX```iiirrrzzz{{{]]]\\\SSS#                  HHH|||sssqqqnnnjjjfffccc```\\\XXXTTTQQQMMMJJJFFFDDD:::%%%---666>>>FFFOOOXXX```iiiqqqzzzdddUUU!                  QQQrrrqqqnnnjjjfffccc___[[[XXXUUUQQQMMMIIIFFFBBB@@@555%%%---555>>>FFFOOOXXX```iiiqqqzzzlllSSS"                  KKKzzzooommmjjjfffbbb___[[[XXXTTTQQQMMMIIIFFFBBB>>>===222			%%%---555>>>FFFOOOXXX```iiiqqqyyyhhhRRR"                  IIIwwwllljjjfffccc___[[[XXXUUUQQQMMMIIIFFFBBB>>>;;;999///$$$---555>>>GGGOOOXXX```iiiqqqyyyfffQQQ"                  FFFssshhhfffbbb___[[[XXXTTTPPPMMMIIIFFFBBB>>>;;;777555***   $$$,,,555>>>FFFOOOWWW```iiipppyyydddQQQ"                  CCCoooeeeccc___[[[XXXTTTPPPMMMIIIEEEBBB>>>;;;888333000...
-
-
-   $$$---555>>>FFFOOOXXX```hhhqqqzzzbbbQQQ"                  }}}			@@@kkkaaa___[[[XXXTTTPPPMMMIIIFFFAAA>>>;;;888222000444888777      
-
-
-$$$---555>>>FFFOOOWWW___hhhqqq___PPP"                  |||===ggg]]][[[XXXTTTPPPMMMIIIFFFBBB>>>;;;777111444===>>>===>>>BBB...   
-
-
-$$$---555>>>FFFOOOWWW___hhh]]]OOO"                  {{{;;;dddZZZXXXTTTPPPLLLIIIFFFBBB>>>;;;555333===EEEDDDDDDEEEDDDDDDHHHAAA      $$$,,,555>>>FFFNNNVVV```[[[OOO"                  yyy888```WWWTTTPPPMMMIIIFFFAAA>>>:::444:::GGGKKKJJJJJJKKKKKKKKKKKKIIIKKKOOO222   $$$,,,555>>>EEENNNWWWYYYNNN"                  xxx   555]]]SSSPPPMMMIIIEEEBBB>>>888777FFFRRRRRRQQQRRRRRRRRRRRRRRRRRRRRRQQQQQQWWWJJJ   			$$$,,,555===EEENNNVVVMMM"                  www   222YYYOOOMMMIIIFFFBBB===777???SSSYYYWWWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXVVVZZZ\\\666$$$,,,444===FFFUUULLL"                  vvv   ///UUUKKKIIIFFFCCC;;;;;;OOO______^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^___]]]]]]dddRRR$$$,,,444===SSSLLL"                  uuu   ,,,QQQHHHFFFAAA999EEE]]]gggffffffffffffffffffffffffffffffffffffffffffffffffffffffdddiiiiii999


###+++555PPPLLL"                  sss   ***NNNEEE>>>===UUUlllxxxuuukkkkkklllmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmlllmmmuuu[[[			$$$,,,MMMKKK"                  rrr   (((JJJ;;;IIIhhhxxx}}}sssqqqsssttttttttttttttttttttttttttttttttttttttttttttttttrrrxxxttt>>>&&&KKKJJJ"                  qqq   """BBB\\\zzz|||xxxzzz{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{zzz{{{bbb   IIIJJJ"                  lll+++DDDEEEJJJ!                     KKKnnnKKKGGG#                 $   &&&zzzWWW@@@III                            ǆ555   YYYoooGGG===jjjF                                       Bxxx      222VVV:::FFF                                                    |,,,   mmmrrr???444dddU                                                              dkkk      AAARRR---;;;                                                                      ###   www444%%%WWWU                                                                                      W]]]      RRRNNN...                                                                                                %%%|||+++KKKL                                                                                                              SQQQ      dddJJJ   ~~~                                                                                                                       222!!!			AAAP                                                                                                                                     
-qHHH   yyyIIIuuu+                                                                                                                                              /   ===   555l                                                                                                                                                            ȃ@@@lll%                                                                                                                                                                     F                                                                                                    ?                                                                                                                                                                                    ?                           ?            ?  
\ No newline at end of file
+          h  &               (                @                         ~ <   ]    l M   ,   p   w   F f    U  v  E 6 $           e    j  0  [ ' b       9  {   m  !    	 2 ` g t     * 5     c d  y       e          N _   f   i n u ~        , 6 6 ;   T  b  u                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              
 TI eMi;] 7xO3h>HF6.%^8 cw2 <+C|z
+9Z L*+'yWBkPA b{jm0lqK? [t$=nos;D z}~p@!QAa /vS,E)1` d(YJGR54_fg -rV	u<&&":# N\U X|                                                                (       @                                  |  ;   \     K  m  ,     v    D  c  S t     ! 	  3 
  {  6 &      ? G      h z   0  W _       H P  ) y  
+     f  ~   8 Z r 	  Z w   F L  k             
      .  > A   N  U W ~           R \ ^ f t     < E J R Y ^ ` u g                            %   ) , - -  5 7 > @  D  I L   T V z s b g k                                        
                          % c' >~ :
 ε}5 -;q AH- 
N?ԙ 0s***TsY盔. J}----<u}敧 hi۬oo5=-t*lW 2-<|-Kji ϴ-hM1zw-)ab :r@,L\bUIQU  >"{=ԦXeE -vO8&ץ !qD_S{R =gM4[T`{Kvm  Q:n}0	] 43#≽^u =Lyi/?pبB rȓP=f- kd-(FG}}69-}d-< VVTװ7Zooo" -x$ Ǜ5 
+-y G-C ;}_ +J                                                                                                                              
\ No newline at end of file
diff -x .svn -aruN 0.7.16.src/login.php 0.7.17.src/login.php
--- 0.7.16.src/login.php	2009-05-26 15:14:05.000000000 -0500
+++ 0.7.17.src/login.php	2010-01-20 21:57:20.000000000 -0600
@@ -3,7 +3,7 @@
 + ----------------------------------------------------------------------------+
 |     e107 website system
 |
-|     Steve Dunstan 2001-2002
+|     �Steve Dunstan 2001-2002
 |     http://e107.org
 |     jalist@e107.org
 |
@@ -11,29 +11,29 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/login.php,v $
-|     $Revision: 1.14 $
-|     $Date: 2009/05/26 20:14:29 $
-|     $Author: e107steved $
+|     $Revision: 1.16 $
+|     $Date: 2010/01/21 03:57:44 $
+|     $Author: mcfly_e107 $
 +----------------------------------------------------------------------------+
 */
 
 require_once("class2.php");
 if (USER)
 {
-	header('location:'.e_BASE.'index.php');      
+	header('location:'.e_BASE.'index.php');
 	exit();
 }
 
 $HEADER = "";
 require_once(HEADERF);
 $use_imagecode = ($pref['logcode'] && extension_loaded("gd"));
-if ($use_imagecode) 
+if ($use_imagecode)
 {
 	require_once(e_HANDLER."secure_img_handler.php");
 	$sec_img = new secure_image;
 }
 
-if (!USER) 
+if (!USER)
 {
 	require_once(e_HANDLER."form_handler.php");
 	$rs = new form;
@@ -54,20 +54,24 @@
 	$LOGIN_TABLE_SUBMIT = "<input class='button' type='submit' name='userlogin' value=\"".LAN_LOGIN_9."\" />";
 
 	$login_message = LAN_LOGIN_3." | ".SITENAME;
-	if (!$LOGIN_TABLE)
+	if (!isset($LOGIN_TABLE) || !$LOGIN_TABLE)
 	{
-		if (file_exists(THEME."login_template.php"))
+		if (file_exists(THEME.'login_template.php'))
 		{
-			require_once(THEME."login_template.php");
+			require_once(THEME.'login_template.php');
 		}
 		else
 		{
 			require_once(e_BASE.$THEMES_DIRECTORY."templates/login_template.php");
 		}
 	}
-	$text = preg_replace("/\{(.*?)\}/e", 'varset($\1,"\1")', $LOGIN_TABLE);
-	echo preg_replace("/\{(.*?)\}/e", 'varset($\1,"\1")', $LOGIN_TABLE_HEADER);
-
+//	$text = preg_replace("/\{(.*?)\}/e", 'varset($\1,"\1")', $LOGIN_TABLE);
+	$tVars = false;
+	$text = $tp->simpleParse($LOGIN_TABLE, $tVars, false);
+	
+//	echo preg_replace("/\{(.*?)\}/e", 'varset($\1,"\1")', $LOGIN_TABLE_HEADER);
+	echo $tp->simpleParse($LOGIN_TABLE_HEADER, $tVars, false);
+	
 	$ns->tablerender($login_message, $text, 'login_page');
 
 	$LOGIN_TABLE_FOOTER_USERREG = '&nbsp;';		// In case no registration system enabled
@@ -75,7 +79,8 @@
 	{
 		$LOGIN_TABLE_FOOTER_USERREG = "<a href='".e_SIGNUP."'>".LAN_LOGIN_11."</a>";
 	}
-	echo preg_replace("/\{([^ ]*?)\}/e", 'varset($\1,"\1")', $LOGIN_TABLE_FOOTER);
+//	echo preg_replace("/\{([^ ]*?)\}/e", 'varset($\1,"\1")', $LOGIN_TABLE_FOOTER);
+	echo $tp->simpleParse($LOGIN_TABLE_FOOTER, $tVars, false);
 }
 
 echo "</body></html>";
diff -x .svn -aruN 0.7.16.src/news.php 0.7.17.src/news.php
--- 0.7.16.src/news.php	2009-07-10 15:29:37.000000000 -0500
+++ 0.7.17.src/news.php	2010-01-06 14:14:21.000000000 -0600
@@ -11,15 +11,15 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/news.php,v $
-|     $Revision: 1.127 $
-|     $Date: 2009/07/10 20:30:01 $
+|     $Revision: 1.131 $
+|     $Date: 2010/01/06 20:14:45 $
 |     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 require_once("class2.php");
 require_once(e_HANDLER."news_class.php");
-require_once(e_HANDLER."comment_class.php");
-$cobj = new comment;
+//require_once(e_HANDLER."comment_class.php");
+//$cobj = new comment;
 
 if (isset($NEWSHEADER)) 
 {
@@ -28,25 +28,27 @@
   exit;
 }
 
+include_lan(e_LANGUAGEDIR.e_LANGUAGE.'/lan_news.php');		// Temporary
+
 $cacheString = 'news.php_default_';
 $action = '';
 $sub_action = '';
-$order = "news_datestamp";
+$order = 'news_datestamp';
 $newsfrom = 0;
 
-if (!defined("ITEMVIEW"))
+if (!defined('ITEMVIEW'))
 {
-  define("ITEMVIEW", varset($pref['newsposts'],15));
+  define('ITEMVIEW', varset($pref['newsposts'],15));
 }
 
 if (e_QUERY) 
 {
-  $tmp = explode(".", e_QUERY);
-  $action = $tmp[0];						// At least one parameter here
-  $sub_action = varset($tmp[1],'');			// Usually a numeric category, but don't presume yet
-  $id = varset($tmp[2],'');					// ID of specific news item where required
-  $newsfrom = intval(varset($tmp[2],0));	// Item number for first item on multi-page lists
-  $cacheString = 'news.php_'.e_QUERY;
+	$tmp = explode('.', e_QUERY);
+	$action = $tmp[0];							// At least one parameter here
+	$sub_action = varset($tmp[1],'');			// Usually a numeric category, or numeric news item number, but don't presume yet
+//	$id = varset($tmp[2],'');					// ID of specific news item where required
+	$newsfrom = intval(varset($tmp[2],0));		// Item number for first item on multi-page lists
+	$cacheString = 'news.php_'.e_QUERY;
 }
 
 //$newsfrom = (!is_numeric($action) || !e_QUERY ? 0 : ($action ? $action : e_QUERY));
@@ -97,7 +99,7 @@
 	if ($action == 'cat' && $category != 0)	
 	{
 		$gen = new convert;
-		$sql->db_Select("news_category", "*", "category_id='$category'");
+		$sql->db_Select("news_category", "*", "category_id='{$category}'");
 		$row = $sql->db_Fetch();
 		extract($row);  // still required for the table-render.  :(
 	}
@@ -132,7 +134,7 @@
 
 	if($category_name)
 	{
-		define("e_PAGETITLE", $tp->toHTML($category_name,FALSE,"TITLE"));
+		define('e_PAGETITLE', $tp->toHTML($category_name,FALSE,'TITLE'));
 	}
 
 	require_once(HEADERF);
@@ -159,10 +161,10 @@
 		</div>\n";
 
 	}
-	$param['itemlink'] = (defined("NEWSLIST_ITEMLINK")) ? NEWSLIST_ITEMLINK : "";
-	$param['thumbnail'] =(defined("NEWSLIST_THUMB")) ? NEWSLIST_THUMB : "border:0px";
-	$param['catlink']  = (defined("NEWSLIST_CATLINK")) ? NEWSLIST_CATLINK : "";
-	$param['caticon'] =  (defined("NEWSLIST_CATICON")) ? NEWSLIST_CATICON : ICONSTYLE;
+	$param['itemlink'] = (defined('NEWSLIST_ITEMLINK')) ? NEWSLIST_ITEMLINK : '';
+	$param['thumbnail'] =(defined('NEWSLIST_THUMB')) ? NEWSLIST_THUMB : 'border:0px';
+	$param['catlink']  = (defined('NEWSLIST_CATLINK')) ? NEWSLIST_CATLINK : '';
+	$param['caticon'] =  (defined('NEWSLIST_CATICON')) ? NEWSLIST_CATICON : ICONSTYLE;
 	$sql->db_Select_gen($query);
 	$newsList = $sql->db_getList();
 	foreach($newsList as $row)
@@ -178,13 +180,13 @@
 
     if(!$NEWSLISTTITLE)
 	{
-		$NEWSLISTTITLE = LAN_NEWS_82." '".$tp->toHTML($category_name,FALSE,"TITLE")."'";
+		$NEWSLISTTITLE = LAN_NEWS_82." '".$tp->toHTML($category_name,FALSE,'TITLE')."'";
 	}
 	else
 	{
-    	$NEWSLISTTITLE = str_replace("{NEWSCATEGORY}",$tp->toHTML($category_name,FALSE,"TITLE"),$NEWSLISTTITLE);
+    	$NEWSLISTTITLE = str_replace("{NEWSCATEGORY}",$tp->toHTML($category_name,FALSE,'TITLE'),$NEWSLISTTITLE);
 	}
-
+	$text .= "<div style='text-align:center;'><a href='".e_SELF."' alt=''>".LAN_NEWS_84."</a></div>";
 	ob_start();
 	$ns->tablerender($NEWSLISTTITLE, $text);
 	$cache_data = ob_get_flush();
@@ -198,55 +200,89 @@
 //------------------------------------------------------
 //		DISPLAY SINGLE ITEM IN EXTENDED FORMAT HERE
 //------------------------------------------------------
-if ($action == "extend") 
+if ($action == 'extend') 
 {	// --> Cache
 	if($newsCachedPage = checkCache($cacheString))
 	{
-	  require_once(HEADERF);
-	  renderCache($newsCachedPage, TRUE);
+		require_once(HEADERF);
+		renderCache($newsCachedPage, TRUE);		// This exits if cache used
 	}
 	// <-- Cache
 
 	if(isset($pref['trackbackEnabled']) && $pref['trackbackEnabled']) 
 	{
-	  $query = "SELECT COUNT(tb.trackback_pid) AS tb_count, n.*, u.user_id, u.user_name, 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
-		LEFT JOIN #trackback AS tb ON tb.trackback_pid  = n.news_id
-		WHERE n.news_id=".intval($sub_action)." AND n.news_class REGEXP '".e_CLASS_REGEXP."' 
-		AND NOT (n.news_class REGEXP ".$nobody_regexp.") 
-		AND n.news_start < ".time()." AND (n.news_end=0 || n.news_end>".time().") 
-		GROUP by n.news_id";
+		$query = "SELECT COUNT(tb.trackback_pid) AS tb_count, n.*, u.user_id, u.user_name, 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
+			LEFT JOIN #trackback AS tb ON tb.trackback_pid  = n.news_id
+			WHERE n.news_id=".intval($sub_action)." AND n.news_class REGEXP '".e_CLASS_REGEXP."' 
+			AND NOT (n.news_class REGEXP ".$nobody_regexp.") 
+			AND n.news_start < ".time()." AND (n.news_end=0 || n.news_end>".time().') ';
 	}
 	else
 	{
-	  $query = "SELECT n.*, u.user_id, u.user_name, 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_id=".intval($sub_action)." AND n.news_class REGEXP '".e_CLASS_REGEXP."' 
-		AND NOT (n.news_class REGEXP ".$nobody_regexp.") 
-		AND n.news_start < ".time()." AND (n.news_end=0 || n.news_end>".time().") ";
+		$query = "SELECT n.*, u.user_id, u.user_name, 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_id=".intval($sub_action)." AND n.news_class REGEXP '".e_CLASS_REGEXP."' 
+			AND NOT (n.news_class REGEXP ".$nobody_regexp.") 
+			AND n.news_start < ".time()." AND (n.news_end=0 || n.news_end>".time().") ";
 	}
-	$sql->db_Select_gen($query);
-	$news = $sql->db_Fetch();
+	if ($sql->db_Select_gen($query))
+	{
+		$news = $sql->db_Fetch();
+		$id = $news['news_category'];		// Use category of this news item to generate next/prev links
 
-	if($news['news_title'])
+		if($news['news_title'])
+		{
+		  if($pref['meta_news_summary'] && $news['news_title'])
+		  {
+			define('META_DESCRIPTION',SITENAME.': '.$news['news_title'].' - '.$news['news_summary']);
+		  }
+		  define("e_PAGETITLE",$news['news_title']);
+		}
+
+		if (TRUE)
+		{
+			/* 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>";
+			$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>";
+			}
+			$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'].="<br /><br />";
+		}
+		
+		require_once(HEADERF);
+		ob_start();
+		$ix->render_newsitem($news, 'extend');
+		$cache_data = ob_get_contents();
+		ob_end_flush();
+		setNewsCache($cacheString, $cache_data);
+		require_once(FOOTERF);
+		exit;
+	}
+	else
 	{
-	  if($pref['meta_news_summary'] && $news['news_title'])
-	  {
-       	define("META_DESCRIPTION",SITENAME.": ".$news['news_title']." - ".$news['news_summary']);
-	  }
-	  define("e_PAGETITLE",$news['news_title']);
+		$action = 'default';
 	}
-
-	require_once(HEADERF);
-	ob_start();
-	$ix->render_newsitem($news, "extend");
-	$cache_data = ob_get_contents();
-	ob_end_flush();
-	setNewsCache($cacheString, $cache_data);
-	require_once(FOOTERF);
-	exit;
 }
 
 
@@ -256,7 +292,7 @@
 // Show title, author, first part of news item...
 if (empty($order))
 {
-  $order = "news_datestamp";
+  $order = 'news_datestamp';
 }
 $order = $tp -> toDB($order, true);
 
@@ -413,7 +449,7 @@
 $newsAr = $sql -> db_getList();
 
 
-$p_title = ($action == "item") ? $newsAr[1]['news_title'] : $tp->toHTML($newsAr[1]['category_name'],FALSE,"TITLE");
+$p_title = ($action == "item") ? $newsAr[1]['news_title'] : $tp->toHTML($newsAr[1]['category_name'],FALSE,'TITLE');
 
 if($action != "" && !is_numeric($action))
 {
diff -x .svn -aruN 0.7.16.src/online.php 0.7.17.src/online.php
--- 0.7.16.src/online.php	2008-11-13 14:18:38.000000000 -0600
+++ 0.7.17.src/online.php	2009-10-03 16:57:49.000000000 -0500
@@ -11,8 +11,8 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/online.php,v $
-|     $Revision: 1.19 $
-|     $Date: 2008/11/13 20:19:01 $
+|     $Revision: 1.20 $
+|     $Date: 2009/10/03 21:58:13 $
 |     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
@@ -266,8 +266,8 @@
 $datestamp = $gen->convert_date($menu_pref['most_online_datestamp'], "short");
 	
 $ONLINE_TABLE_MOST_EVER_ONLINE = ONLINE_EL8.($menu_pref['most_members_online'] + $menu_pref['most_guests_online']);
-$ONLINE_TABLE_MOST_MEMBERS_ONLINE = strtolower(ONLINE_EL2).$menu_pref['most_members_online'];
-$ONLINE_TABLE_MOST_GUESTS_ONLINE = strtolower(ONLINE_EL1).$menu_pref['most_guests_online'];
+$ONLINE_TABLE_MOST_MEMBERS_ONLINE = ONLINE_EL2.$menu_pref['most_members_online'];
+$ONLINE_TABLE_MOST_GUESTS_ONLINE  = ONLINE_EL1.$menu_pref['most_guests_online'];
 $ONLINE_TABLE_DATESTAMP = $datestamp;
 	
 $total_members = $sql->db_Count("user","(*)","where user_ban = 0");
diff -x .svn -aruN 0.7.16.src/print.php 0.7.17.src/print.php
--- 0.7.16.src/print.php	2007-02-13 16:24:53.000000000 -0600
+++ 0.7.17.src/print.php	2009-11-10 05:52:07.000000000 -0600
@@ -3,7 +3,7 @@
 + ----------------------------------------------------------------------------+
 |     e107 website system
 |
-|     Steve Dunstan 2001-2002
+|     (C)Steve Dunstan 2001-2002
 |     http://e107.org
 |     jalist@e107.org
 |
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/print.php,v $
-|     $Revision: 1.15 $
-|     $Date: 2007/02/13 22:25:16 $
-|     $Author: e107coders $
+|     $Revision: 1.16 $
+|     $Date: 2009/11/10 11:52:31 $
+|     $Author: marj_nl_fr $
 +----------------------------------------------------------------------------+
 */
 require_once("class2.php");
@@ -55,8 +55,8 @@
 	$row = $sql->db_Fetch();
 	extract($row);
 	define("e_PAGETITLE", $news_title);
-	$news_body = $tp->toHTML($news_body, TRUE);
-	$news_extended = $tp->toHTML($news_extended, TRUE);
+	$news_body = $tp->toHTML($news_body, TRUE, 'BODY');
+	$news_extended = $tp->toHTML($news_extended, TRUE, 'BODY');
 	if ($news_author == 0)
 	{
 		$a_name = "e107";
@@ -73,7 +73,7 @@
 	$print_text = "<span style=\"font-size: 13px; color: black; font-family: tahoma, verdana, arial, helvetica; text-decoration: none\">
 	<b>".LAN_PRINT_135.": ".$news_title."</b>
 	<br />
-	(".LAN_PRINT_86." ".$tp->toHTML($category_name,FALSE,"defs").")
+	(".LAN_PRINT_86." ".$tp->toHTML($category_name, FALSE, "defs").")
 	<br />
 	".LAN_PRINT_94." ".$a_name."<br />
 	".$news_datestamp."
@@ -109,4 +109,4 @@
 
 require_once(FOOTERF);
 
-?>
+?>
\ No newline at end of file
diff -x .svn -aruN 0.7.16.src/signup.php 0.7.17.src/signup.php
--- 0.7.16.src/signup.php	2009-08-09 03:38:40.000000000 -0500
+++ 0.7.17.src/signup.php	2010-01-15 14:02:05.000000000 -0600
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/signup.php,v $
-|     $Revision: 1.133 $
-|     $Date: 2009/08/09 08:39:04 $
-|     $Author: marj_nl_fr $
+|     $Revision: 1.137 $
+|     $Date: 2010/01/15 20:02:29 $
+|     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
 
@@ -349,7 +349,7 @@
         $error = TRUE;
 	}
 
-	if($_POST['xupexist'])
+	if(varsettrue($pref['xup_enabled']) && $_POST['xupexist'])
 	{
 		require_once(e_HANDLER."xml_class.php");
 		$xml = new parseXml;
@@ -545,7 +545,7 @@
   if (strpos($tmp,'.') === FALSE) return FALSE;
   $em = array_reverse(explode('.',$tmp));
   $line = '';
-  $out = array();
+  $out = array('*@'.$tmp);		// First element looks for domain as email address
   foreach ($em as $e)
   {
     $line = '.'.$e.$line;
@@ -635,7 +635,7 @@
 	if ((varset($pref['signup_option_image'],0) > 0) && $_POST['image'])
 	{
 		$_POST['image'] = str_replace(array('\'', '"', '(', ')'), '', $_POST['image']);   // these are invalid anyway, so why allow them? (XSS Fix)
-		$avName = $tp -> toDB($_POST['image']);
+		$avName = e_IMAGE.'avatars/'.$tp -> toDB($_POST['image']);
 		if ($size = getimagesize($avName))
 		{
 			$avwidth = $size[0];
diff -x .svn -aruN 0.7.16.src/sitedown.php 0.7.17.src/sitedown.php
--- 0.7.16.src/sitedown.php	2009-08-15 06:54:05.000000000 -0500
+++ 0.7.17.src/sitedown.php	2009-10-28 10:38:03.000000000 -0500
@@ -3,7 +3,7 @@
 + ----------------------------------------------------------------------------+
 |     e107 website system
 |
-|     Steve Dunstan 2001-2002
+|     ©Steve Dunstan 2001-2002
 |     http://e107.org
 |     jalist@e107.org
 |
@@ -11,36 +11,35 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/sitedown.php,v $
-|     $Revision: 1.10 $
-|     $Date: 2009/08/15 11:54:29 $
+|     $Revision: 1.13 $
+|     $Date: 2009/10/28 15:38:27 $
 |     $Author: marj_nl_fr $
 +----------------------------------------------------------------------------+
 */
-require_once("class2.php");
+require_once('class2.php');
 
-global $pref;
-global $tp;
-
-include_lan(e_LANGUAGEDIR.e_LANGUAGE."/lan_sitedown.php");
-
-if (!$pref['maintainance_flag'] )
+if (!varset($pref['maintainance_flag']))
 {
-	header("location: ".SITEURL);
+	header('location: '.SITEURL);
+	exit();
 }
 
-require_once(e_FILE."shortcode/batch/sitedown_shortcodes.php");
+header('Content-type: text/html; charset='.CHARSET);
+
+include_lan(e_LANGUAGEDIR.e_LANGUAGE.'/lan_'.e_PAGE);
 
-if (!$SITEDOWN_TABLE) {
-	if (file_exists(THEME."sitedown_template.php"))
+require_once(e_FILE.'shortcode/batch/sitedown_shortcodes.php');
+
+if (!$SITEDOWN_TABLE)
+{
+	if (file_exists(THEME.'sitedown_template.php'))
 	{
-		require_once(THEME."sitedown_template.php");
+		require_once(THEME.'sitedown_template.php');
 	}
 	else
 	{
-		require_once(e_THEME."templates/sitedown_template.php");
+		require_once(e_THEME.'templates/sitedown_template.php');
 	}
 }
 
-	echo $tp->parseTemplate($SITEDOWN_TABLE, TRUE, $sitedown_shortcodes);
-
-?>
\ No newline at end of file
+echo $tp->parseTemplate($SITEDOWN_TABLE, TRUE, $sitedown_shortcodes);
diff -x .svn -aruN 0.7.16.src/submitnews.php 0.7.17.src/submitnews.php
--- 0.7.16.src/submitnews.php	2009-08-17 14:21:52.000000000 -0500
+++ 0.7.17.src/submitnews.php	2009-12-19 08:52:31.000000000 -0600
@@ -11,8 +11,8 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/submitnews.php,v $
-|     $Revision: 1.24 $
-|     $Date: 2009/08/17 19:22:16 $
+|     $Revision: 1.27 $
+|     $Date: 2009/12/19 14:52:55 $
 |     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
@@ -23,7 +23,7 @@
 
 if (!isset($pref['subnews_class']))
 {
-	$pref['subnews_class'] = '0';
+	$pref['subnews_class'] = e_UC_MEMBER;
 }
 
 if (!check_class($pref['subnews_class']))
@@ -92,24 +92,27 @@
 		}
 		else
 		{
-			$filename = $uploaded[0]['name'];
-			$filetype = $uploaded[0]['type'];
-			$filesize = $uploaded[0]['size'];
-			$fileext  = substr(strrchr($filename, "."), 1);
-			$today = getdate();
-			$submitnews_file = USERID."_".$today[0]."_".str_replace(" ", "_", substr($submitnews_title, 0, 6)).".".$fileext;
-			if (is_numeric($pref['subnews_resize']) && ($pref['subnews_resize'] > 30)  && ($pref['subnews_resize'] < 5000))
+			if (isset($uploaded[0]['name']) && isset($uploaded[0]['type']) && isset($uploaded[0]['size']))
 			{
-				require_once(e_HANDLER.'resize_handler.php');
-		
-				if (!resize_image(e_IMAGE.'newspost_images/'.$filename, e_IMAGE.'newspost_images/'.$submitnews_file, $pref['subnews_resize']))
+				$filename = $uploaded[0]['name'];
+				$filetype = $uploaded[0]['type'];
+				$filesize = $uploaded[0]['size'];
+				$fileext  = substr(strrchr($filename, "."), 1);
+				$today = getdate();
+				$submitnews_file = USERID."_".$today[0]."_".str_replace(" ", "_", substr($submitnews_title, 0, 6)).".".$fileext;
+				if (is_numeric($pref['subnews_resize']) && ($pref['subnews_resize'] > 30)  && ($pref['subnews_resize'] < 5000))
 				{
-				  rename(e_IMAGE.'newspost_images/'.$filename, e_IMAGE.'newspost_images/'.$submitnews_file);
+					require_once(e_HANDLER.'resize_handler.php');
+			
+					if (!resize_image(e_IMAGE.'newspost_images/'.$filename, e_IMAGE.'newspost_images/'.$submitnews_file, $pref['subnews_resize']))
+					{
+					  rename(e_IMAGE.'newspost_images/'.$filename, e_IMAGE.'newspost_images/'.$submitnews_file);
+					}
+				}
+				elseif ($filename)
+				{
+					rename(e_IMAGE.'newspost_images/'.$filename, e_IMAGE.'newspost_images/'.$submitnews_file);
 				}
-			}
-			elseif ($filename)
-			{
-				rename(e_IMAGE.'newspost_images/'.$filename, e_IMAGE.'newspost_images/'.$submitnews_file);
 			}
 		}
 	
@@ -179,10 +182,10 @@
 else
 {
 	$text .= "
-		<select name='submitnews_category' class='tbox'>";
+		<select name='cat_id' class='tbox'>";
 	while (list($cat_id, $cat_name, $cat_icon) = $sql->db_Fetch())
 	{
-		$sel = ($_POST['submitnews_category'] == $cat_id) ? "selected='selected'" : "";
+		$sel = (varset($_POST['cat_id'],'') == $cat_id) ? "selected='selected'" : "";
 		$text .= "<option value='{$cat_id}' {$sel}>".$tp->toHTML($cat_name, FALSE, "defs")."</option>";
 	}
 	$text .= "</select>";
diff -x .svn -aruN 0.7.16.src/userposts.php 0.7.17.src/userposts.php
--- 0.7.16.src/userposts.php	2009-08-23 05:39:27.000000000 -0500
+++ 0.7.17.src/userposts.php	2010-01-20 21:57:20.000000000 -0600
@@ -3,7 +3,7 @@
 + ----------------------------------------------------------------------------+
 |     e107 website system
 |
-|     Steve Dunstan 2001-2002
+|     �Steve Dunstan 2001-2002
 |     http://e107.org
 |     jalist@e107.org
 |
@@ -11,9 +11,9 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/userposts.php,v $
-|     $Revision: 1.31 $
-|     $Date: 2009/08/23 10:39:51 $
-|     $Author: marj_nl_fr $
+|     $Revision: 1.32 $
+|     $Date: 2010/01/21 03:57:44 $
+|     $Author: mcfly_e107 $
 +----------------------------------------------------------------------------+
 */
 require_once("class2.php");
@@ -103,16 +103,20 @@
 		$userposts_comments_table_string .= parse_userposts_comments_table($row);
 	}
 
-	$userposts_comments_table_start = preg_replace("/\{(.*?)\}/e", '$\1', $USERPOSTS_COMMENTS_TABLE_START);
-	$userposts_comments_table_end = preg_replace("/\{(.*?)\}/e", '$\1', $USERPOSTS_COMMENTS_TABLE_END);
+//	$userposts_comments_table_start = preg_replace("/\{(.*?)\}/e", '$\1', $USERPOSTS_COMMENTS_TABLE_START);
+	$userposts_comments_table_start = $tp->simpleParse($USERPOSTS_COMMENTS_TABLE_START);
 
+//	$userposts_comments_table_end = preg_replace("/\{(.*?)\}/e", '$\1', $USERPOSTS_COMMENTS_TABLE_END);
+	$userposts_comments_table_end = $tp->simpleParse($USERPOSTS_COMMENTS_TABLE_END);
+	
 	$ctext .= $userposts_comments_table_start."".$userposts_comments_table_string."".$userposts_comments_table_end;
 
 	$ns->tablerender($ccaption, $ctext);
 
 	$parms = $ctotal.",10,".$from.",".e_SELF."?[FROM].comments.".$id;
 	$USERPOSTS_NEXTPREV = $tp->parseTemplate("{NEXTPREV={$parms}}");
-	echo preg_replace("/\{(.*?)\}/e", '$\1', $USERPOSTS_NP_TABLE);
+//	echo preg_replace("/\{(.*?)\}/e", '$\1', $USERPOSTS_NP_TABLE);
+	echo $tp->simpleParse($USERPOSTS_NP_TABLE);
 }
 
 
@@ -194,16 +198,19 @@
 		{
 			$userposts_forum_table_string .= parse_userposts_forum_table($row);
 		}
-		$userposts_forum_table_start = preg_replace("/\{(.*?)\}/e", '$\1', $USERPOSTS_FORUM_TABLE_START);
+//		$userposts_forum_table_start = preg_replace("/\{(.*?)\}/e", '$\1', $USERPOSTS_FORUM_TABLE_START);
+		$userposts_forum_table_start = $tp->simpleParse($USERPOSTS_FORUM_TABLE_START);
 		$USERPOSTS_FORUM_SEARCH = "<input class='tbox' type='text' name='f_query' size='20' value='' maxlength='50' /> <input class='button' type='submit' name='fsearch' value='".UP_LAN_12."' />";
-		$userposts_forum_table_end = preg_replace("/\{(.*?)\}/e", '$\1', $USERPOSTS_FORUM_TABLE_END);
+//		$userposts_forum_table_end = preg_replace("/\{(.*?)\}/e", '$\1', $USERPOSTS_FORUM_TABLE_END);
+		$userposts_forum_table_end = $tp->simpleParse($USERPOSTS_FORUM_TABLE_END);
 		$ftext .= $userposts_forum_table_start."".$userposts_forum_table_string."".$userposts_forum_table_end;
 	}
 	$ns->tablerender($fcaption, $ftext);
 
 	$parms = $ftotal.",10,".$from.",".e_SELF."?[FROM].forums.".$id;
 	$USERPOSTS_NEXTPREV = $tp->parseTemplate("{NEXTPREV={$parms}}");
-	echo preg_replace("/\{(.*?)\}/e", '$\1', $USERPOSTS_NP_TABLE);
+//	echo preg_replace("/\{(.*?)\}/e", '$\1', $USERPOSTS_NP_TABLE);
+	echo $tp->simpleParse($USERPOSTS_NP_TABLE);
 }
 
 require_once(FOOTERF);
@@ -226,14 +233,15 @@
 	{
 		$bullet = '<img src="'.THEME.'images/bullet2.gif" alt="" style="vertical-align: middle;" />';
 	}
-	$USERPOSTS_COMMENTS_ICON		= $bullet;
-	$USERPOSTS_COMMENTS_DATESTAMP	= UP_LAN_11." ".$datestamp;
-	$USERPOSTS_COMMENTS_HEADING		= $row['comment_title'];
-	$USERPOSTS_COMMENTS_COMMENT		= $row['comment_comment'];
-	$USERPOSTS_COMMENTS_HREF_PRE	= "<a href='".$row['comment_url']."'>";
-	$USERPOSTS_COMMENTS_TYPE		= $row['comment_type'];
+	$tVars['USERPOSTS_COMMENTS_ICON']		= $bullet;
+	$tVars['USERPOSTS_COMMENTS_DATESTAMP']	= UP_LAN_11." ".$datestamp;
+	$tVars['USERPOSTS_COMMENTS_HEADING']	= $row['comment_title'];
+	$tVars['USERPOSTS_COMMENTS_COMMENT']	= $row['comment_comment'];
+	$tVars['USERPOSTS_COMMENTS_HREF_PRE']	= "<a href='".$row['comment_url']."'>";
+	$tVars['USERPOSTS_COMMENTS_TYPE']		= $row['comment_type'];
 
-	return(preg_replace("/\{(.*?)\}/e", '$\1', $USERPOSTS_COMMENTS_TABLE));
+//	return(preg_replace("/\{(.*?)\}/e", '$\1', $USERPOSTS_COMMENTS_TABLE));
+	return($tp->simpleParse($USERPOSTS_COMMENTS_TABLE, $tVars));
 }
 
 
@@ -247,7 +255,7 @@
 
 	$poster = substr($thread_user, (strpos($thread_user, ".")+1));
 	$datestamp = $gen->convert_date($thread_datestamp, "short");
-	$DATESTAMP = $datestamp;
+	$tVars['DATESTAMP'] = $datestamp;
 
 	if ($thread_parent)
 	{
@@ -261,25 +269,26 @@
 			list($thread_name) = $sql2->db_Fetch();
 			$cachevar[$thread_parent] = $thread_name;
 		}
-		$USERPOSTS_FORUM_TOPIC_PRE = UP_LAN_15.": ";
+		$tVars['USERPOSTS_FORUM_TOPIC_PRE'] = UP_LAN_15.": ";
 	}
 	else
 	{
-		$USERPOSTS_FORUM_TOPIC_PRE = UP_LAN_2.": ";
+		$tVars['USERPOSTS_FORUM_TOPIC_PRE'] = UP_LAN_2.": ";
 	}
 
 	$tmp = $thread_id;
 	$thread_thread = $tp->toHTML($thread_thread, TRUE, "USER_BODY", $id);
 
-	$USERPOSTS_FORUM_ICON = "<img src='".e_PLUGIN."forum/images/".IMODE."/new_small.png' alt='' />";
-	$USERPOSTS_FORUM_TOPIC_HREF_PRE = "<a href='".e_PLUGIN."forum/forum_viewtopic.php?".$tmp.".post'>";
-	$USERPOSTS_FORUM_TOPIC = $thread_name;
-	$USERPOSTS_FORUM_NAME_HREF_PRE = "<a href='".e_PLUGIN."forum/forum_viewforum.php?".$forum_id."'>";
-	$USERPOSTS_FORUM_NAME = $forum_name;
-	$USERPOSTS_FORUM_THREAD = $thread_thread;
-	$USERPOSTS_FORUM_DATESTAMP = UP_LAN_11." ".$datestamp;
+	$tVars['USERPOSTS_FORUM_ICON'] = "<img src='".e_PLUGIN."forum/images/".IMODE."/new_small.png' alt='' />";
+	$tVars['USERPOSTS_FORUM_TOPIC_HREF_PRE'] = "<a href='".e_PLUGIN."forum/forum_viewtopic.php?".$tmp.".post'>";
+	$tVars['USERPOSTS_FORUM_TOPIC'] = $thread_name;
+	$tVars['USERPOSTS_FORUM_NAME_HREF_PRE'] = "<a href='".e_PLUGIN."forum/forum_viewforum.php?".$forum_id."'>";
+	$tVars['USERPOSTS_FORUM_NAME'] = $forum_name;
+	$tVars['USERPOSTS_FORUM_THREAD'] = $thread_thread;
+	$tVars['USERPOSTS_FORUM_DATESTAMP'] = UP_LAN_11." ".$datestamp;
 
-	return(preg_replace("/\{(.*?)\}/e", '$\1', $USERPOSTS_FORUM_TABLE));
+//	return(preg_replace("/\{(.*?)\}/e", '$\1', $USERPOSTS_FORUM_TABLE));
+	return($tp->simpleParse($USERPOSTS_FORUM_TABLE, $tVars));
 }
 
 ?>
diff -x .svn -aruN 0.7.16.src/usersettings.php 0.7.17.src/usersettings.php
--- 0.7.16.src/usersettings.php	2009-07-14 14:26:00.000000000 -0500
+++ 0.7.17.src/usersettings.php	2009-11-23 15:03:42.000000000 -0600
@@ -3,7 +3,7 @@
 + ----------------------------------------------------------------------------+
 |     e107 website system
 |
-|     Steve Dunstan 2001-2002
+|     Steve Dunstan 2001-2002
 |     http://e107.org
 |     jalist@e107.org
 |
@@ -11,8 +11,8 @@
 |     GNU General Public License (http://gnu.org).
 |
 |     $Source: /cvsroot/e107/e107_0.7/usersettings.php,v $
-|     $Revision: 1.111 $
-|     $Date: 2009/07/14 19:26:24 $
+|     $Revision: 1.118 $
+|     $Date: 2009/11/23 21:04:06 $
 |     $Author: e107steved $
 +----------------------------------------------------------------------------+
 */
@@ -105,6 +105,12 @@
 
 if (isset($_POST['updatesettings']))
 {
+	if(!varset($_POST['__referer']))
+	{
+		header('location:'.e_BASE.'index.php');
+  		exit;
+	}
+	
 	if(!varsettrue($pref['auth_method']) || $pref['auth_method'] == '>e107')
 	{
 		$pref['auth_method'] = 'e107';
@@ -231,7 +237,7 @@
   if (strpos($tmp,'.') === FALSE) return FALSE;
   $em = array_reverse(explode('.',$tmp));
   $line = '';
-  $out = array();
+  $out = array('*@'.$tmp);		// First element looks for domain as email address
   foreach ($em as $e)
   {
     $line = '.'.$e.$line;
@@ -243,26 +249,29 @@
 
 	// Always validate an email address if entered. If its blank, that's OK if checking disabled
 	$_POST['email'] = $tp->toDB(trim(varset($_POST['email'],'')));
-	$do_email_validate = !varset($pref['disable_emailcheck'],FALSE) || ($_POST['email'] !='');
-	if ($do_email_validate && !check_email($_POST['email']))
+	$do_email_validate = (!varset($pref['disable_emailcheck'],FALSE)) || ($_POST['email'] !='');
+	if ($do_email_validate)
 	{
-	  $error .= LAN_106."\\n";
-	}
+		if  (!check_email($_POST['email']))
+		{
+			$error .= LAN_106."\\n";
+		}
 
-	// Check Email address against banlist.
-	$wc = make_email_query($_POST['email']);
-	if ($wc) $wc = ' OR '.$wc;
+		// Check Email address against banlist.
+		$wc = make_email_query($_POST['email']);
+		if ($wc) $wc = ' OR '.$wc;
 
-	if (($wc === FALSE) || ($do_email_validate && $sql->db_Select("banlist", "*", "banlist_ip='".$_POST['email']."'".$wc)))
-	{
-	  $error .= LAN_106."\\n";
-	}
+		if (($wc === FALSE) || ($do_email_validate && $sql->db_Select("banlist", "*", "banlist_ip='".$_POST['email']."'".$wc)))
+		{
+			$error .= LAN_106."\\n";
+		}
 
 
-	// Check for duplicate of email address (always)
-	if ($sql->db_Select("user", "user_name, user_email", "user_email='".$_POST['email']."' AND user_id !='".intval($inp)."' "))
-	{
-	  $error .= LAN_408."\\n";
+		// Check for duplicate of email address (always)
+		if ($sql->db_Select("user", "user_name, user_email", "user_email='".$_POST['email']."' AND user_id !='".intval($inp)."' "))
+		{
+			$error .= LAN_408."\\n";
+		}
 	}
 
 
@@ -370,26 +379,28 @@
 			}
 		}
 
-		foreach($_POST['ue'] as $key => $val)
+		foreach ($extList as $key => $settings)
 		{
-			if (isset($extList[$key]))
-			{	// Only allow valid keys
-				$err = $ue->user_extended_validate_entry($val,$extList[$key]);
-				if($err === TRUE && !$_uid)
-				{  // General error - usually empty field; could be unacceptable value, or regex fail and no error message defined
-					$error .= LAN_SIGNUP_6.($tp->toHtml($extList[$key]['user_extended_struct_text'],FALSE,"defs"))." ".LAN_SIGNUP_7."\\n";
-				}
-				elseif ($err)
-				{	// Specific error message returned - usually regex fail
-					$error .= $err."\\n";
-					$err = TRUE;
-				}
-				if(!$err)
-				{
-					$val = $tp->toDB($val);
-					$ue_fields .= ($ue_fields) ? ", " : "";
-					$ue_fields .= $key."='".$val."'";
-				}
+			if ($settings['user_extended_struct_applicable'] != e_UC_NOBODY)
+			{
+			$val = '';
+			if (isset($_POST['ue'][$key])) $val = $_POST['ue'][$key]; 
+			$err = $ue->user_extended_validate_entry($val,$settings);
+			if($err === TRUE && !$_uid)
+			{  // General error - usually empty field; could be unacceptable value, or regex fail and no error message defined
+				$error .= LAN_SIGNUP_6.($tp->toHtml($settings['user_extended_struct_text'],FALSE,'defs')).' '.LAN_SIGNUP_7."\\n";
+			}
+			elseif ($err)
+			{	// Specific error message returned - usually regex fail
+				$error .= $err."\\n";
+				$err = TRUE;
+			}
+			if(!$err)
+			{
+				$val = $tp->toDB($val);
+				$ue_fields .= ($ue_fields) ? ", " : "";
+				$ue_fields .= $key."='".$val."'";
+			}
 			}
 		}
 
@@ -622,6 +633,7 @@
 
 $text .= "
 	<input type='hidden' name='_uid' value='{$uuid}' />
+	<input type='hidden' name='__referer' value='".POST_REFERER."' />
 	</div>
 	</form>
 	";
@@ -646,7 +658,7 @@
 	}
 	if ($force)
 	{	// Remove 'orphaned' extended user field records
-		$sql->db_Select_gen("DELETE `#user_extended` FROM `#user_extended` LEFT JOIN `#user` ON `#user_extended`.`user_extended_id`=`#user`.`user_id`
+		$sql->db_Select_gen("DELETE `#user_extended` FROM `#user_extended` LEFT JOIN `#user` ON `#user_extended`.`user_extended_id` = `#user`.`user_id`
 				WHERE `#user`.`user_id` IS NULL");
 	}
 	return $temp1;
